index.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792
  1. import React from 'react';
  2. import Types from '../../lib/Types';
  3. import Module from '../../lib/Module';
  4. import { Accordion as AccordionCtor } from 'native-base';
  5. import { Actionsheet as ActionsheetCtor } from 'native-base';
  6. import { Badge as BadgeCtor } from 'native-base';
  7. import { Body as BodyCtor } from 'native-base';
  8. import { Button as ButtonCtor } from 'native-base';
  9. import { Card as CardCtor } from 'native-base';
  10. import { CardItem as CardItemCtor } from 'native-base';
  11. import { Checkbox as CheckboxCtor } from 'native-base';
  12. import { Container as ContainerCtor } from 'native-base';
  13. import { Content as ContentCtor } from 'native-base';
  14. import { DatePicker as DatePickerCtor } from 'native-base';
  15. import { DeckSwiper as DeckSwiperCtor } from 'native-base';
  16. import { Fab as FabCtor } from 'native-base';
  17. import { Footer as FooterCtor } from 'native-base';
  18. import { FooterTab as FooterTabCtor } from 'native-base';
  19. import { Form as FormCtor } from 'native-base';
  20. import { Gravatar as GravatarCtor } from 'native-base';
  21. import { H1 as H1Ctor } from 'native-base';
  22. import { H2 as H2Ctor } from 'native-base';
  23. import { H3 as H3Ctor } from 'native-base';
  24. import { Header as HeaderCtor } from 'native-base';
  25. import { IconNB as IconNBCtor } from 'native-base';
  26. import { Input as InputCtor } from 'native-base';
  27. import { InputGroup as InputGroupCtor } from 'native-base';
  28. import { Item as ItemCtor } from 'native-base';
  29. import { Label as LabelCtor } from 'native-base';
  30. import { Left as LeftCtor } from 'native-base';
  31. import { List as ListCtor } from 'native-base';
  32. import { ListItem as ListItemCtor } from 'native-base';
  33. import { PickerItem as PickerItemCtor } from 'native-base';
  34. import { Radio as RadioCtor } from 'native-base';
  35. import { Right as RightCtor } from 'native-base';
  36. import { Root as RootCtor } from 'native-base';
  37. import { Segment as SegmentCtor } from 'native-base';
  38. import { Separator as SeparatorCtor } from 'native-base';
  39. import { Spinner as SpinnerCtor } from 'native-base';
  40. import { Subtitle as SubtitleCtor } from 'native-base';
  41. import { SwipeRow as SwipeRowCtor } from 'native-base';
  42. import { Switch as SwitchCtor } from 'native-base';
  43. import { Tab as TabCtor } from 'native-base';
  44. import { TabContainer as TabContainerCtor } from 'native-base';
  45. import { TabHeading as TabHeadingCtor } from 'native-base';
  46. import { Text as TextCtor } from 'native-base';
  47. import { Textarea as TextareaCtor } from 'native-base';
  48. import { Thumbnail as ThumbnailCtor } from 'native-base';
  49. import { Title as TitleCtor } from 'native-base';
  50. import { Toast as ToastCtor } from 'native-base';
  51. import { ToastContainer as ToastContainerCtor } from 'native-base';
  52. import { View as ViewCtor } from 'native-base';
  53. export class Accordion extends Module {
  54. constructor(props) {
  55. super(props);
  56. }
  57. display() {
  58. return <AccordionCtor {...this.props} />
  59. }
  60. }
  61. export class Actionsheet extends Module {
  62. constructor(props) {
  63. super(props);
  64. }
  65. display() {
  66. return <ActionsheetCtor {...this.props} />
  67. }
  68. }
  69. export class Badge extends Module {
  70. constructor(props) {
  71. super(props);
  72. }
  73. display() {
  74. let {
  75. text,
  76. icon,
  77. style,
  78. color,
  79. ...restProps
  80. } = this.props;
  81. return <BadgeCtor {...restProps} style={[{flexDirection: 'row'}, style]}>
  82. {icon ? <IconNBCtor name={icon} style={{ fontSize: 15, color, lineHeight: 27 }}/> : null}
  83. {text ? <TextCtor style={{ fontSize: 15, color, lineHeight: 27 }}>{text}</TextCtor> : null}
  84. </BadgeCtor>
  85. }
  86. }
  87. export class Body extends Module {
  88. constructor(props) {
  89. super(props);
  90. }
  91. display() {
  92. return <BodyCtor {...this.props} />
  93. }
  94. }
  95. export class Button extends Module {
  96. constructor(props) {
  97. super(props);
  98. }
  99. display() {
  100. let {
  101. text,
  102. icon,
  103. onPress,
  104. ...rest
  105. } = this.props;
  106. let run = () => {
  107. this.createAction(onPress)
  108. };
  109. return <ButtonCtor {...rest} onClick={run} onPress={run}>
  110. {icon ? <IconCtor name={icon} /> : null}
  111. {text ? <TextCtor>{text}</TextCtor> : null}
  112. </ButtonCtor>
  113. }
  114. }
  115. export class Card extends Module {
  116. constructor(props) {
  117. super(props);
  118. }
  119. display() {
  120. let {
  121. header,
  122. body,
  123. footer,
  124. ...rest
  125. } = this.props;
  126. return <CardCtor {...rest}>
  127. <CardItemCtor header>
  128. <TextCtor>{header}</TextCtor>
  129. </CardItemCtor>
  130. <CardItemCtor>
  131. <BodyCtor>
  132. <TextCtor>
  133. {body}
  134. </TextCtor>
  135. </BodyCtor>
  136. </CardItemCtor>
  137. <CardItemCtor footer>
  138. <TextCtor>{footer}</TextCtor>
  139. </CardItemCtor>
  140. </CardCtor>;
  141. }
  142. }
  143. export class CardItem extends Module {
  144. constructor(props) {
  145. super(props);
  146. }
  147. display() {
  148. return <CardItemCtor {...this.props} />
  149. }
  150. }
  151. export class Checkbox extends Module {
  152. constructor(props) {
  153. super(props);
  154. }
  155. display() {
  156. return <CheckboxCtor {...this.props} />
  157. }
  158. }
  159. export class Container extends Module {
  160. constructor(props) {
  161. super(props);
  162. }
  163. display() {
  164. return <ContainerCtor {...this.props} />
  165. }
  166. }
  167. export class Content extends Module {
  168. constructor(props) {
  169. super(props);
  170. }
  171. display() {
  172. return <ContentCtor {...this.props} />
  173. }
  174. }
  175. export class DatePicker extends Module {
  176. constructor(props) {
  177. super(props);
  178. }
  179. display() {
  180. return <DatePickerCtor {...this.props} />
  181. }
  182. }
  183. export class DeckSwiper extends Module {
  184. constructor(props) {
  185. super(props);
  186. }
  187. display() {
  188. return <DeckSwiperCtor {...this.props} />
  189. }
  190. }
  191. export class Fab extends Module {
  192. constructor(props) {
  193. super(props);
  194. }
  195. display() {
  196. return <FabCtor {...this.props} />
  197. }
  198. }
  199. export class Footer extends Module {
  200. constructor(props) {
  201. super(props);
  202. }
  203. display() {
  204. return <FooterCtor {...this.props} />
  205. }
  206. }
  207. export class FooterTab extends Module {
  208. constructor(props) {
  209. super(props);
  210. }
  211. display() {
  212. return <FooterTabCtor {...this.props} />
  213. }
  214. }
  215. export class Form extends Module {
  216. constructor(props) {
  217. super(props);
  218. }
  219. display() {
  220. return <FormCtor {...this.props}>
  221. <ItemCtor>
  222. <InputCtor placeholder="Username" />
  223. </ItemCtor>
  224. <ItemCtor last>
  225. <InputCtor placeholder="Password" />
  226. </ItemCtor>
  227. </FormCtor>
  228. }
  229. }
  230. export class Gravatar extends Module {
  231. constructor(props) {
  232. super(props);
  233. }
  234. display() {
  235. return <GravatarCtor {...this.props} />
  236. }
  237. }
  238. export class H1 extends Module {
  239. constructor(props) {
  240. super(props);
  241. }
  242. display() {
  243. let {
  244. content,
  245. ...rest
  246. } = this.props;
  247. return <H1Ctor {...rest}>
  248. {content}
  249. </H1Ctor>
  250. }
  251. }
  252. export class H2 extends Module {
  253. constructor(props) {
  254. super(props);
  255. }
  256. display() {
  257. let {
  258. content,
  259. ...rest
  260. } = this.props;
  261. return <H2Ctor {...rest}>
  262. {content}
  263. </H2Ctor>
  264. }
  265. }
  266. export class H3 extends Module {
  267. constructor(props) {
  268. super(props);
  269. }
  270. display() {
  271. let {
  272. content,
  273. ...rest
  274. } = this.props;
  275. return <H3Ctor {...rest}>
  276. {content}
  277. </H3Ctor>
  278. }
  279. }
  280. export class Header extends Module {
  281. constructor(props) {
  282. super(props);
  283. }
  284. display() {
  285. return <HeaderCtor {...this.props} />
  286. }
  287. }
  288. export class IconNB extends Module {
  289. constructor(props) {
  290. super(props);
  291. }
  292. display() {
  293. return <IconNBCtor {...this.props} />
  294. }
  295. }
  296. export class Input extends Module {
  297. constructor(props) {
  298. super(props);
  299. }
  300. display() {
  301. let {
  302. icon,
  303. placeholder,
  304. ...rest
  305. } = this.props;
  306. return <ItemCtor {...rest}>
  307. <InputCtor placeholder={placeholder}/>
  308. {icon ? <IconNBCtor active name={icon} /> : null}
  309. </ItemCtor>;
  310. }
  311. }
  312. export class InputGroup extends Module {
  313. constructor(props) {
  314. super(props);
  315. }
  316. display() {
  317. return <InputGroupCtor {...this.props} />
  318. }
  319. }
  320. export class Item extends Module {
  321. constructor(props) {
  322. super(props);
  323. }
  324. display() {
  325. let {
  326. placeholder,
  327. ...rest
  328. } = this.props;
  329. return <ItemCtor {...rest}>
  330. <InputCtor placeholder={placeholder}/>
  331. </ItemCtor>;
  332. }
  333. }
  334. export class Label extends Module {
  335. constructor(props) {
  336. super(props);
  337. }
  338. display() {
  339. return <LabelCtor {...this.props} />
  340. }
  341. }
  342. export class Left extends Module {
  343. constructor(props) {
  344. super(props);
  345. }
  346. display() {
  347. return <LeftCtor {...this.props} />
  348. }
  349. }
  350. export class List extends Module {
  351. constructor(props) {
  352. super(props);
  353. }
  354. display() {
  355. return <ListCtor {...this.props} />
  356. }
  357. }
  358. export class ListItem extends Module {
  359. constructor(props) {
  360. super(props);
  361. }
  362. display() {
  363. return <ListItemCtor {...this.props} />
  364. }
  365. }
  366. export class PickerItem extends Module {
  367. constructor(props) {
  368. super(props);
  369. }
  370. display() {
  371. return <PickerItemCtor {...this.props} />
  372. }
  373. }
  374. export class Radio extends Module {
  375. constructor(props) {
  376. super(props);
  377. }
  378. display() {
  379. return <RadioCtor {...this.props} />
  380. }
  381. }
  382. export class Right extends Module {
  383. constructor(props) {
  384. super(props);
  385. }
  386. display() {
  387. return <RightCtor {...this.props} />
  388. }
  389. }
  390. export class Root extends Module {
  391. constructor(props) {
  392. super(props);
  393. }
  394. display() {
  395. return <RootCtor {...this.props} />
  396. }
  397. }
  398. export class Segment extends Module {
  399. constructor(props) {
  400. super(props);
  401. }
  402. display() {
  403. return <SegmentCtor {...this.props} />
  404. }
  405. }
  406. export class Separator extends Module {
  407. constructor(props) {
  408. super(props);
  409. }
  410. display() {
  411. return <SeparatorCtor {...this.props} />
  412. }
  413. }
  414. export class Spinner extends Module {
  415. constructor(props) {
  416. super(props);
  417. }
  418. display() {
  419. return <SpinnerCtor {...this.props} />
  420. }
  421. }
  422. export class Subtitle extends Module {
  423. constructor(props) {
  424. super(props);
  425. }
  426. display() {
  427. return <SubtitleCtor {...this.props} />
  428. }
  429. }
  430. export class SwipeRow extends Module {
  431. constructor(props) {
  432. super(props);
  433. }
  434. display() {
  435. return <SwipeRowCtor {...this.props} />
  436. }
  437. }
  438. export class Switch extends Module {
  439. constructor(props) {
  440. super(props);
  441. }
  442. display() {
  443. return <SwitchCtor {...this.props} />
  444. }
  445. }
  446. export class Tab extends Module {
  447. constructor(props) {
  448. super(props);
  449. }
  450. display() {
  451. return <TabCtor {...this.props} />
  452. }
  453. }
  454. export class TabContainer extends Module {
  455. constructor(props) {
  456. super(props);
  457. }
  458. display() {
  459. return <TabContainerCtor {...this.props} />
  460. }
  461. }
  462. export class TabHeading extends Module {
  463. constructor(props) {
  464. super(props);
  465. }
  466. display() {
  467. return <TabHeadingCtor {...this.props} />
  468. }
  469. }
  470. export class Text extends Module {
  471. constructor(props) {
  472. super(props);
  473. }
  474. display() {
  475. let {
  476. content,
  477. ...rest
  478. } = this.props
  479. return <TextCtor {...rest} >
  480. {content}
  481. </TextCtor>
  482. }
  483. }
  484. export class Textarea extends Module {
  485. constructor(props) {
  486. super(props);
  487. }
  488. display() {
  489. let {
  490. ...rest
  491. } = this.props;
  492. return <TextareaCtor {...rest}>
  493. </TextareaCtor>
  494. }
  495. }
  496. export class Thumbnail extends Module {
  497. constructor(props) {
  498. super(props);
  499. }
  500. display() {
  501. return <ThumbnailCtor {...this.props} />
  502. }
  503. }
  504. export class Title extends Module {
  505. constructor(props) {
  506. super(props);
  507. }
  508. display() {
  509. return <TitleCtor {...this.props} />
  510. }
  511. }
  512. export class Toast extends Module {
  513. constructor(props) {
  514. super(props);
  515. }
  516. display() {
  517. return <ToastCtor {...this.props} />
  518. }
  519. }
  520. export class ToastContainer extends Module {
  521. constructor(props) {
  522. super(props);
  523. }
  524. display() {
  525. return <ToastContainerCtor {...this.props} />
  526. }
  527. }
  528. export class View extends Module {
  529. constructor(props) {
  530. super(props);
  531. }
  532. display() {
  533. return <ViewCtor {...this.props} />
  534. }
  535. }
  536. Text.Inputs = {
  537. uppercase: new Types.Bool().default(false),
  538. content: new Types.Text().default("Hello world!")
  539. }
  540. Accordion.Inputs = {
  541. }
  542. Actionsheet.Inputs = {
  543. }
  544. Body.Inputs = {
  545. }
  546. Button.Inputs = {
  547. text: new Types.Text().default("Press me"),
  548. onPress: new Types.Action(),
  549. block: new Types.Bool(),
  550. primary: new Types.Bool(),
  551. transparent: new Types.Bool(),
  552. success: new Types.Bool(),
  553. danger: new Types.Bool(),
  554. warning: new Types.Bool(),
  555. info: new Types.Bool(),
  556. bordered: new Types.Bool(),
  557. disabled: new Types.Bool(),
  558. rounded: new Types.Bool(),
  559. large: new Types.Bool(),
  560. small: new Types.Bool(),
  561. active: new Types.Bool()
  562. }
  563. Badge.Inputs = {
  564. icon: new Types.Text(),
  565. text: new Types.Text().require().default("1"),
  566. color: new Types.Text().color().require().default("rgba(255,255,255,1)"),
  567. primary: new Types.Bool(),
  568. success: new Types.Bool(),
  569. danger: new Types.Bool(),
  570. warning: new Types.Bool(),
  571. info: new Types.Bool()
  572. }
  573. Card.Inputs = {
  574. header: new Types.Text().default("Header"),
  575. body: new Types.Text().default("Lorem ipsum body bla la trapala"),
  576. footer: new Types.Text().default("Add footer here"),
  577. }
  578. CardItem.Inputs = {
  579. header: new Types.Bool(),
  580. cardBody: new Types.Bool(),
  581. footer: new Types.Bool(),
  582. button: new Types.Bool()
  583. }
  584. Checkbox.Inputs = {
  585. checked: new Types.Bool()
  586. }
  587. Container.Inputs = {
  588. }
  589. Content.Inputs = {
  590. disableKBDismissScroll: new Types.Bool(),
  591. keyboardShouldPersistTaps: new Types.Text(),
  592. padder: new Types.Bool()
  593. }
  594. DatePicker.Inputs = {
  595. }
  596. DeckSwiper.Inputs = {
  597. }
  598. Fab.Inputs = {
  599. }
  600. Footer.Inputs = {
  601. }
  602. FooterTab.Inputs = {
  603. }
  604. Form.Inputs = {
  605. }
  606. Gravatar.Inputs = {
  607. email: new Types.Text().require(),
  608. size: new Types.Real(),
  609. circular: new Types.Bool(),
  610. square: new Types.Bool()
  611. }
  612. H1.Inputs = {
  613. ...Text.Inputs
  614. }
  615. H2.Inputs = {
  616. ...Text.Inputs
  617. }
  618. H3.Inputs = {
  619. ...Text.Inputs
  620. }
  621. Header.Inputs = {
  622. searchBar: new Types.Bool(),
  623. rounded: new Types.Bool()
  624. }
  625. IconNB.Inputs = {
  626. }
  627. Item.Inputs = {
  628. inlineLabel: new Types.Bool(),
  629. floatingLabel: new Types.Bool(),
  630. stackedLabel: new Types.Bool(),
  631. fixedLabel: new Types.Bool(),
  632. success: new Types.Bool(),
  633. error: new Types.Bool()
  634. }
  635. Input.Inputs = {
  636. icon: new Types.Text(),
  637. placeholder: new Types.Text(),
  638. ...Item.Inputs
  639. }
  640. InputGroup.Inputs = {
  641. regular: new Types.Bool(),
  642. underline: new Types.Bool(),
  643. rounded: new Types.Bool(),
  644. success: new Types.Bool(),
  645. error: new Types.Bool(),
  646. disabled: new Types.Bool()
  647. }
  648. Label.Inputs = {
  649. floatBack: new Types.Real()
  650. }
  651. Left.Inputs = {
  652. }
  653. List.Inputs = {
  654. }
  655. ListItem.Inputs = {
  656. itemDivider: new Types.Bool(),
  657. button: new Types.Bool()
  658. }
  659. PickerItem.Inputs = {
  660. }
  661. Radio.Inputs = {
  662. selected: new Types.Bool(),
  663. standardStyle: new Types.Bool()
  664. }
  665. Right.Inputs = {
  666. }
  667. Root.Inputs = {
  668. }
  669. Segment.Inputs = {
  670. }
  671. Separator.Inputs = {
  672. }
  673. Spinner.Inputs = {
  674. color: new Types.Text(),
  675. inverse: new Types.Bool()
  676. }
  677. Subtitle.Inputs = {
  678. }
  679. SwipeRow.Inputs = {
  680. }
  681. Switch.Inputs = {
  682. }
  683. Tab.Inputs = {
  684. }
  685. TabContainer.Inputs = {
  686. }
  687. TabHeading.Inputs = {
  688. }
  689. Textarea.Inputs = {
  690. placeholder: new Types.Text(),
  691. rowSpan: new Types.Real(),
  692. bordered: new Types.Bool(),
  693. underline: new Types.Bool()
  694. }
  695. Thumbnail.Inputs = {
  696. square: new Types.Bool(),
  697. circular: new Types.Bool(),
  698. size: new Types.Real()
  699. }
  700. Title.Inputs = {
  701. }
  702. Toast.Inputs = {
  703. }
  704. ToastContainer.Inputs = {
  705. }
  706. View.Inputs = {
  707. }
  708. export default {
  709. Accordion,
  710. Actionsheet,
  711. Badge,
  712. Body,
  713. Button,
  714. Card,
  715. CardItem,
  716. Checkbox,
  717. Container,
  718. Content,
  719. DatePicker,
  720. DeckSwiper,
  721. Fab,
  722. Footer,
  723. FooterTab,
  724. Form,
  725. Gravatar,
  726. H1,
  727. H2,
  728. H3,
  729. Header,
  730. IconNB,
  731. Input,
  732. InputGroup,
  733. Item,
  734. Label,
  735. Left,
  736. List,
  737. ListItem,
  738. PickerItem,
  739. Radio,
  740. Right,
  741. Root,
  742. Segment,
  743. Separator,
  744. Spinner,
  745. Subtitle,
  746. SwipeRow,
  747. Switch,
  748. Tab,
  749. TabContainer,
  750. TabHeading,
  751. Text,
  752. Textarea,
  753. Thumbnail,
  754. Title,
  755. Toast,
  756. ToastContainer,
  757. View
  758. }