123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834 |
- import React from 'react';
- import Types from '../../lib/Types';
- import Module from '../../lib/Module';
- import { Accordion as AccordionCtor } from 'native-base';
- import { Actionsheet as ActionsheetCtor } from 'native-base';
- import { Badge as BadgeCtor } from 'native-base';
- import { Body as BodyCtor } from 'native-base';
- import { Button as ButtonCtor } from 'native-base';
- import { Card as CardCtor } from 'native-base';
- import { CardItem as CardItemCtor } from 'native-base';
- import { CheckBox as CheckboxCtor } from 'native-base';
- import { Container as ContainerCtor } from 'native-base';
- import { Content as ContentCtor } from 'native-base';
- import { DatePicker as DatePickerCtor } from 'native-base';
- import { DeckSwiper as DeckSwiperCtor } from 'native-base';
- import { Fab as FabCtor } from 'native-base';
- import { Footer as FooterCtor } from 'native-base';
- import { FooterTab as FooterTabCtor } from 'native-base';
- import { Form as FormCtor } from 'native-base';
- import { Gravatar as GravatarCtor } from 'native-base';
- import { H1 as H1Ctor } from 'native-base';
- import { H2 as H2Ctor } from 'native-base';
- import { H3 as H3Ctor } from 'native-base';
- import { Header as HeaderCtor } from 'native-base';
- import { IconNB as IconNBCtor } from 'native-base';
- import { Input as InputCtor } from 'native-base';
- import { InputGroup as InputGroupCtor } from 'native-base';
- import { Item as ItemCtor } from 'native-base';
- import { Label as LabelCtor } from 'native-base';
- import { Left as LeftCtor } from 'native-base';
- import { List as ListCtor } from 'native-base';
- import { ListItem as ListItemCtor } from 'native-base';
- import { PickerItem as PickerItemCtor } from 'native-base';
- import { Radio as RadioCtor } from 'native-base';
- import { Right as RightCtor } from 'native-base';
- import { Root as RootCtor } from 'native-base';
- import { Segment as SegmentCtor } from 'native-base';
- import { Separator as SeparatorCtor } from 'native-base';
- import { Spinner as SpinnerCtor } from 'native-base';
- import { Subtitle as SubtitleCtor } from 'native-base';
- import { SwipeRow as SwipeRowCtor } from 'native-base';
- import { Switch as SwitchCtor } from 'native-base';
- import { Tab as TabCtor } from 'native-base';
- import { TabContainer as TabContainerCtor } from 'native-base';
- import { TabHeading as TabHeadingCtor } from 'native-base';
- import { Text as TextCtor } from 'native-base';
- import { Textarea as TextareaCtor } from 'native-base';
- import { Thumbnail as ThumbnailCtor } from 'native-base';
- import { Title as TitleCtor } from 'native-base';
- import { Toast as ToastCtor } from 'native-base';
- import { ToastContainer as ToastContainerCtor } from 'native-base';
- import { View as ViewCtor } from 'native-base';
- export class Accordion extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <AccordionCtor {...this.props} />
- }
- }
- export class Actionsheet extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <ActionsheetCtor {...this.props} />
- }
- }
- export class Badge extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- let {
- text,
- icon,
- style,
- color,
- ...restProps
- } = this.props;
- return <BadgeCtor {...restProps} style={[{flexDirection: 'row'}, style]}>
- {icon ? <IconNBCtor name={icon} style={{ fontSize: 15, color, lineHeight: 27 }}/> : null}
- {text ? <TextCtor style={{ fontSize: 15, color, lineHeight: 27 }}>{text}</TextCtor> : null}
- </BadgeCtor>
- }
- }
- export class Body extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <BodyCtor {...this.props} />
- }
- }
- export class Button extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- let {
- text,
- icon,
- onPress,
- ...rest
- } = this.props;
- let run = () => {
- this.createAction(onPress)
- };
- return <ButtonCtor {...rest} onClick={run} onPress={run}>
- {icon ? <IconCtor name={icon} /> : null}
- {text ? <TextCtor>{text}</TextCtor> : null}
- </ButtonCtor>
- }
- }
- export class Card extends Module {
- constructor(props) {
- super(props);
- this.CoreSystem = props.CoreSystem;
- }
- display() {
- let {
- header,
- body,
- footer,
- bodyModules,
- ...rest
- } = this.props;
- let item = this.renderModule('Button','NativeBase');
- console.log("ITEM : ", item);
- return <CardCtor {...rest}>
- {header ? <CardItemCtor header>
- <TextCtor>{header}</TextCtor>
- </CardItemCtor>
- : null}
- <CardItemCtor>
- <BodyCtor>
- <TextCtor>
- {body}
- </TextCtor>
- {this.moduleArray(bodyModules)}
- </BodyCtor>
- </CardItemCtor>
- {footer ? <CardItemCtor footer>
- <TextCtor>{footer}</TextCtor>
- </CardItemCtor>
- : null}
- </CardCtor>;
- }
- }
- export class CardItem extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <CardItemCtor {...this.props} />
- }
- }
- export class Checkbox extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <CheckboxCtor {...this.props} />
- }
- }
- export class Container extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <ContainerCtor {...this.props} />
- }
- }
- export class Content extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <ContentCtor {...this.props} />
- }
- }
- export class DatePicker extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <DatePickerCtor {...this.props} />
- }
- }
- export class DeckSwiper extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <DeckSwiperCtor {...this.props} />
- }
- }
- export class Fab extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <FabCtor {...this.props} />
- }
- }
- export class Footer extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <FooterCtor {...this.props} />
- }
- }
- export class FooterTab extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <FooterTabCtor {...this.props} />
- }
- }
- export class Form extends Module {
- constructor(props) {
- super(props);
- this.state = {};
- }
-
- submit() {
- this.createAction(this.props.onSubmit);
- }
- change(item, value) {
- this.setState({
- [item]: value
- });
- }
- display() {
- let {
- inputs,
- button,
- onSubmit,
- ...rest
- } = this.props;
- return [
- <FormCtor {...rest}>
- {inputs ? inputs.map((item, index) => {
- return <ItemCtor key={index} last={index === inputs.length-1}>
- <InputCtor placeholder={item}
- placeholderLabel={item}
- value={this.state[item && item.toLowerCase()] || ''}
- onChangeText={(value) => this.change(item && item.toLowerCase(), value)}/>
- </ItemCtor>
- }) : null}
- </FormCtor>,
- button ? <ButtonCtor onPress={() => this.submit()}>
- <TextCtor>{button}</TextCtor>
- </ButtonCtor>: null
- ]
- }
- }
- export class Gravatar extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <GravatarCtor {...this.props} />
- }
- }
- export class H1 extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- let {
- content,
- ...rest
- } = this.props;
- return <H1Ctor {...rest}>
- {content}
- </H1Ctor>
- }
- }
- export class H2 extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- let {
- content,
- ...rest
- } = this.props;
- return <H2Ctor {...rest}>
- {content}
- </H2Ctor>
- }
- }
- export class H3 extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- let {
- content,
- ...rest
- } = this.props;
- return <H3Ctor {...rest}>
- {content}
- </H3Ctor>
- }
- }
- export class Header extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <HeaderCtor {...this.props} />
- }
- }
- export class IconNB extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <IconNBCtor {...this.props} />
- }
- }
- export class Input extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- let {
- icon,
- placeholder,
- ...rest
- } = this.props;
- return <ItemCtor {...rest}>
- <InputCtor placeholder={placeholder}/>
- {icon ? <IconNBCtor active name={icon} /> : null}
- </ItemCtor>;
- }
- }
- export class InputGroup extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <InputGroupCtor {...this.props} />
- }
- }
- export class Item extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- let {
- placeholder,
- mod,
- ...rest
- } = this.props;
- console.log("RENDERMOD:", mod);
- return <ContentCtor>
- <ItemCtor {...rest}>
- {this.module(mod)}
- </ItemCtor>
- </ContentCtor>;
- }
- }
- export class Label extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <LabelCtor {...this.props} />
- }
- }
- export class Left extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <LeftCtor {...this.props} />
- }
- }
- export class List extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <ListCtor {...this.props} />
- }
- }
- export class ListItem extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <ListItemCtor {...this.props} />
- }
- }
- export class PickerItem extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <PickerItemCtor {...this.props} />
- }
- }
- export class Radio extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <RadioCtor {...this.props} />
- }
- }
- export class Right extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <RightCtor {...this.props} />
- }
- }
- export class Root extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <RootCtor {...this.props} />
- }
- }
- export class Segment extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <SegmentCtor {...this.props} />
- }
- }
- export class Separator extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <SeparatorCtor {...this.props} />
- }
- }
- export class Spinner extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <SpinnerCtor {...this.props} />
- }
- }
- export class Subtitle extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <SubtitleCtor {...this.props} />
- }
- }
- export class SwipeRow extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <SwipeRowCtor {...this.props} />
- }
- }
- export class Switch extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <SwitchCtor {...this.props} />
- }
- }
- export class Tab extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <TabCtor {...this.props} />
- }
- }
- export class TabContainer extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <TabContainerCtor {...this.props} />
- }
- }
- export class TabHeading extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <TabHeadingCtor {...this.props} />
- }
- }
- export class Text extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- let {
- content,
- ...rest
- } = this.props
- return <TextCtor {...rest} >
- {content}
- </TextCtor>
- }
- }
- export class Textarea extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- let {
- ...rest
- } = this.props;
- return <TextareaCtor {...rest}>
- </TextareaCtor>
- }
- }
- export class Thumbnail extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <ThumbnailCtor {...this.props} />
- }
- }
- export class Title extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <TitleCtor {...this.props} />
- }
- }
- export class Toast extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <ToastCtor {...this.props} />
- }
- }
- export class ToastContainer extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <ToastContainerCtor {...this.props} />
- }
- }
- export class View extends Module {
- constructor(props) {
- super(props);
- }
- display() {
- return <ViewCtor {...this.props} />
- }
- }
- Text.Inputs = {
- uppercase: new Types.Bool().default(false),
- content: new Types.Text().default("Hello world!")
- }
- Accordion.Inputs = {
-
- }
- Actionsheet.Inputs = {
-
- }
- Body.Inputs = {
-
- }
- Button.Inputs = {
- text: new Types.Text().default("Press me"),
- onPress: new Types.Action(),
- block: new Types.Bool(),
- primary: new Types.Bool(),
- transparent: new Types.Bool(),
- success: new Types.Bool(),
- danger: new Types.Bool(),
- warning: new Types.Bool(),
- info: new Types.Bool(),
- bordered: new Types.Bool(),
- disabled: new Types.Bool(),
- rounded: new Types.Bool(),
- large: new Types.Bool(),
- small: new Types.Bool(),
- active: new Types.Bool()
- }
- Badge.Inputs = {
- icon: new Types.Text(),
- text: new Types.Text().require().default("1"),
- color: new Types.Text().color().require().default("rgba(255,255,255,1)"),
- primary: new Types.Bool(),
- success: new Types.Bool(),
- danger: new Types.Bool(),
- warning: new Types.Bool(),
- info: new Types.Bool()
- }
- Card.Inputs = {
- header: new Types.Text().default("Header"),
- body: new Types.Text().default("Lorem ipsum body bla la trapala"),
- footer: new Types.Text().default("Add footer here"),
- bodyModules: new Types.Array(new Types.Module()),
- texts: new Types.Array(new Types.Text())
- }
- CardItem.Inputs = {
- header: new Types.Bool(),
- cardBody: new Types.Bool(),
- footer: new Types.Bool(),
- button: new Types.Bool()
- }
- Checkbox.Inputs = {
- checked: new Types.Bool()
- }
- Container.Inputs = {
-
- }
- Content.Inputs = {
- disableKBDismissScroll: new Types.Bool(),
- keyboardShouldPersistTaps: new Types.Text(),
- padder: new Types.Bool()
- }
- DatePicker.Inputs = {
-
- }
- DeckSwiper.Inputs = {
-
- }
- Fab.Inputs = {
-
- }
- Footer.Inputs = {
-
- }
- FooterTab.Inputs = {
-
- }
- Form.Inputs = {
- inputs: new Types.Array(new Types.Text()),
- button: new Types.Text().default('Submit'),
- onSubmit: new Types.Action()
- }
- Gravatar.Inputs = {
- email: new Types.Text().require(),
- size: new Types.Real(),
- circular: new Types.Bool(),
- square: new Types.Bool()
- }
- H1.Inputs = {
- ...Text.Inputs
- }
- H2.Inputs = {
- ...Text.Inputs
- }
- H3.Inputs = {
- ...Text.Inputs
- }
- Header.Inputs = {
- searchBar: new Types.Bool(),
- rounded: new Types.Bool()
- }
- IconNB.Inputs = {
-
- }
- Item.Inputs = {
- mod: new Types.Module(),
- inlineLabel: new Types.Bool(),
- floatingLabel: new Types.Bool(),
- stackedLabel: new Types.Bool(),
- fixedLabel: new Types.Bool(),
- success: new Types.Bool(),
- error: new Types.Bool()
- }
- Input.Inputs = {
- icon: new Types.Text(),
- placeholder: new Types.Text(),
- ...Item.Inputs
- }
- InputGroup.Inputs = {
- regular: new Types.Bool(),
- underline: new Types.Bool(),
- rounded: new Types.Bool(),
- success: new Types.Bool(),
- error: new Types.Bool(),
- disabled: new Types.Bool()
- }
- Label.Inputs = {
- floatBack: new Types.Real()
- }
- Left.Inputs = {
-
- }
- List.Inputs = {
-
- }
- ListItem.Inputs = {
- itemDivider: new Types.Bool(),
- button: new Types.Bool()
- }
- PickerItem.Inputs = {
-
- }
- Radio.Inputs = {
- selected: new Types.Bool(),
- standardStyle: new Types.Bool()
- }
- Right.Inputs = {
-
- }
- Root.Inputs = {
-
- }
- Segment.Inputs = {
-
- }
- Separator.Inputs = {
-
- }
- Spinner.Inputs = {
- color: new Types.Text(),
- inverse: new Types.Bool()
- }
- Subtitle.Inputs = {
-
- }
- SwipeRow.Inputs = {
-
- }
- Switch.Inputs = {
-
- }
- Tab.Inputs = {
-
- }
- TabContainer.Inputs = {
-
- }
- TabHeading.Inputs = {
-
- }
- Textarea.Inputs = {
- placeholder: new Types.Text(),
- rowSpan: new Types.Real(),
- bordered: new Types.Bool(),
- underline: new Types.Bool()
- }
- Thumbnail.Inputs = {
- square: new Types.Bool(),
- circular: new Types.Bool(),
- size: new Types.Real()
- }
- Title.Inputs = {
-
- }
- Toast.Inputs = {
-
- }
- ToastContainer.Inputs = {
-
- }
- View.Inputs = {
-
- }
- export default {
- // Accordion,
- // Actionsheet,
- Badge,
- // Body,
- Button,
- Card,
- // CardItem,
- Checkbox,
- // Container,
- // Content,
- // DatePicker,
- // DeckSwiper,
- // Fab,
- // Footer,
- // FooterTab,
- Form,
- // Gravatar,
- H1,
- H2,
- H3,
- // Header,
- IconNB,
- Input,
- // InputGroup,
- // Item,
- // Label,
- // Left,
- // List,
- // ListItem,
- // PickerItem,
- Radio,
- // Right,
- // Root,
- // Segment,
- // Separator,
- // Spinner,
- // Subtitle,
- // SwipeRow,
- // Switch,
- // Tab,
- // TabContainer,
- // TabHeading,
- // Text,
- // Textarea,
- // Thumbnail,
- // Title,
- // Toast,
- // ToastContainer,
- // View
- }
|