@draftbit/core 46.4.3 → 46.4.4-7f27fb.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/lib/commonjs/components/Container.js +17 -5
  2. package/lib/commonjs/components/Justification.js +5 -1
  3. package/lib/commonjs/components/ResizeMode.js +5 -1
  4. package/lib/commonjs/components/TabView/TabView.js +102 -0
  5. package/lib/commonjs/components/TabView/TabViewItem.js +26 -0
  6. package/lib/commonjs/components/TabView/index.js +23 -0
  7. package/lib/commonjs/index.js +14 -0
  8. package/lib/commonjs/mappings/TabView.js +79 -0
  9. package/lib/module/components/Justification.js +1 -0
  10. package/lib/module/components/ResizeMode.js +1 -0
  11. package/lib/module/components/TabView/TabView.js +87 -0
  12. package/lib/module/components/TabView/TabViewItem.js +18 -0
  13. package/lib/module/components/TabView/index.js +2 -0
  14. package/lib/module/components/ToggleButton.js +17 -3
  15. package/lib/module/index.js +1 -0
  16. package/lib/module/mappings/TabView.js +70 -0
  17. package/lib/typescript/src/components/TabView/TabView.d.ts +19 -0
  18. package/lib/typescript/src/components/TabView/TabViewItem.d.ts +10 -0
  19. package/lib/typescript/src/components/TabView/index.d.ts +2 -0
  20. package/lib/typescript/src/index.d.ts +1 -0
  21. package/lib/typescript/src/mappings/TabView.d.ts +111 -0
  22. package/package.json +6 -4
  23. package/src/Provider.js +9 -0
  24. package/src/components/Accordion/AccordionGroup.js +44 -0
  25. package/src/components/Accordion/AccordionItem.js +32 -0
  26. package/src/components/Accordion/index.js +2 -0
  27. package/src/components/ActionSheet/ActionSheet.js +45 -0
  28. package/src/components/ActionSheet/ActionSheetCancel.js +6 -0
  29. package/src/components/ActionSheet/ActionSheetItem.js +30 -0
  30. package/src/components/ActionSheet/index.js +3 -0
  31. package/src/components/AnimatedCircularProgress.js +43 -0
  32. package/src/components/AspectRatio.js +18 -0
  33. package/src/components/AvatarEdit.js +30 -0
  34. package/src/components/Banner.js +109 -0
  35. package/src/components/Button.js +114 -0
  36. package/src/components/Card.js +57 -0
  37. package/src/components/CardBlock.js +54 -0
  38. package/src/components/CardContainer.js +69 -0
  39. package/src/components/CardContainerRating.js +79 -0
  40. package/src/components/CardContainerShortImage.js +33 -0
  41. package/src/components/CardInline.js +36 -0
  42. package/src/components/Carousel.js +68 -0
  43. package/src/components/Checkbox/Checkbox.js +63 -0
  44. package/src/components/Checkbox/CheckboxGroup.js +21 -0
  45. package/src/components/Checkbox/CheckboxGroupRow.js +77 -0
  46. package/src/components/Checkbox/CheckboxRow.js +78 -0
  47. package/src/components/Checkbox/context.js +14 -0
  48. package/src/components/Checkbox/index.js +3 -0
  49. package/src/components/CircleImage.js +8 -0
  50. package/src/components/CircularProgress.js +81 -0
  51. package/src/components/Config.js +64 -0
  52. package/src/components/Container.js +43 -0
  53. package/src/components/DatePicker/DatePicker.js +368 -0
  54. package/src/components/DatePicker/DatePickerComponent.js +13 -0
  55. package/src/components/DatePicker/DatePickerComponent.web.js +30 -0
  56. package/src/components/DatePicker/DatePickerComponentType.js +1 -0
  57. package/src/components/DeprecatedButton.js +95 -0
  58. package/src/components/DeprecatedCardWrapper.js +18 -0
  59. package/src/components/DeprecatedFAB.js +115 -0
  60. package/src/components/Divider.js +13 -0
  61. package/src/components/Elevation.js +20 -0
  62. package/src/components/FAB.js +46 -0
  63. package/src/components/FieldSearchBarFull.js +53 -0
  64. package/src/components/FormRow.js +19 -0
  65. package/src/components/Header.js +44 -0
  66. package/src/components/HeaderLarge.js +7 -0
  67. package/src/components/HeaderMedium.js +7 -0
  68. package/src/components/HeaderOverline.js +7 -0
  69. package/src/components/IconButton.js +35 -0
  70. package/src/components/Image.js +47 -0
  71. package/src/components/Justification.js +1 -0
  72. package/src/components/Layout.js +50 -0
  73. package/src/components/NumberInput.js +49 -0
  74. package/src/components/Picker/Picker.js +267 -0
  75. package/src/components/Picker/PickerComponent.android.js +69 -0
  76. package/src/components/Picker/PickerComponent.ios.js +79 -0
  77. package/src/components/Picker/PickerComponent.web.js +70 -0
  78. package/src/components/Picker/PickerTypes.js +1 -0
  79. package/src/components/Portal/Portal.js +35 -0
  80. package/src/components/Portal/PortalConsumer.js +27 -0
  81. package/src/components/Portal/PortalHost.js +107 -0
  82. package/src/components/Portal/PortalManager.js +32 -0
  83. package/src/components/ProgressBar.js +118 -0
  84. package/src/components/ProgressCircle.js +13 -0
  85. package/src/components/ProgressIndicator.js +27 -0
  86. package/src/components/RadioButton/RadioButton.js +17 -0
  87. package/src/components/RadioButton/RadioButtonFieldGroup.js +17 -0
  88. package/src/components/RadioButton/RadioButtonGroup.js +43 -0
  89. package/src/components/RadioButton/RadioButtonRow.js +76 -0
  90. package/src/components/RadioButton/context.js +14 -0
  91. package/src/components/RadioButton/index.js +4 -0
  92. package/src/components/ResizeMode.js +1 -0
  93. package/src/components/Row.js +48 -0
  94. package/src/components/RowBodyIcon.js +8 -0
  95. package/src/components/RowHeadlineImageCaption.js +12 -0
  96. package/src/components/RowHeadlineImageIcon.js +14 -0
  97. package/src/components/SVG.js +13 -0
  98. package/src/components/ScreenContainer.js +34 -0
  99. package/src/components/Slider.js +63 -0
  100. package/src/components/StarRating.js +50 -0
  101. package/src/components/StepIndicator.js +346 -0
  102. package/src/components/Stepper.js +39 -0
  103. package/src/components/Surface.js +32 -0
  104. package/src/components/Swiper/Swiper.js +29 -0
  105. package/src/components/Swiper/SwiperItem.js +9 -0
  106. package/src/components/Swiper/index.js +2 -0
  107. package/src/components/Switch.js +56 -0
  108. package/src/components/TabView/TabView.js +34 -0
  109. package/src/components/TabView/TabView.tsx +97 -0
  110. package/src/components/TabView/TabViewItem.js +5 -0
  111. package/src/components/TabView/TabViewItem.tsx +21 -0
  112. package/src/components/TabView/index.js +2 -0
  113. package/src/components/TabView/index.tsx +2 -0
  114. package/src/components/Text.js +27 -0
  115. package/src/components/TextField.js +423 -0
  116. package/src/components/ToggleButton.js +39 -0
  117. package/src/components/Touchable.js +12 -0
  118. package/src/components/Touchable.web.js +2 -0
  119. package/src/components/Typography.js +36 -0
  120. package/src/components/useAuthState.js +31 -0
  121. package/src/constants.js +10 -0
  122. package/src/hooks.js +12 -0
  123. package/src/index.js +53 -0
  124. package/src/index.tsx +1 -0
  125. package/src/interfaces/Icon.js +8 -0
  126. package/src/mappings/Accordion.js +41 -0
  127. package/src/mappings/AccordionItem.js +16 -0
  128. package/src/mappings/ActionSheet.js +13 -0
  129. package/src/mappings/ActionSheetCancel.js +19 -0
  130. package/src/mappings/ActionSheetItem.js +23 -0
  131. package/src/mappings/ActivityIndicator.js +58 -0
  132. package/src/mappings/AudioPlayer.js +20 -0
  133. package/src/mappings/AvatarEdit.js +38 -0
  134. package/src/mappings/Banner.js +32 -0
  135. package/src/mappings/BlurView.js +42 -0
  136. package/src/mappings/Button.js +87 -0
  137. package/src/mappings/Card.js +52 -0
  138. package/src/mappings/CardBlock.js +123 -0
  139. package/src/mappings/CardContainer.js +104 -0
  140. package/src/mappings/CardContainerRating.js +126 -0
  141. package/src/mappings/CardContainerShortImage.js +120 -0
  142. package/src/mappings/CardInline.js +52 -0
  143. package/src/mappings/Carousel.js +19 -0
  144. package/src/mappings/Checkbox.js +46 -0
  145. package/src/mappings/CheckboxGroup.js +26 -0
  146. package/src/mappings/CheckboxRow.js +61 -0
  147. package/src/mappings/CircleImage.js +25 -0
  148. package/src/mappings/Container.js +30 -0
  149. package/src/mappings/CustomCode.js +8 -0
  150. package/src/mappings/DatePicker.js +157 -0
  151. package/src/mappings/Divider.js +27 -0
  152. package/src/mappings/FAB.js +37 -0
  153. package/src/mappings/Fetch.js +13 -0
  154. package/src/mappings/FieldSearchBarFull.js +50 -0
  155. package/src/mappings/FlashList.js +33 -0
  156. package/src/mappings/FlatList.js +24 -0
  157. package/src/mappings/HeaderLarge.js +29 -0
  158. package/src/mappings/HeaderMedium.js +55 -0
  159. package/src/mappings/HeaderOverline.js +55 -0
  160. package/src/mappings/Icon.js +32 -0
  161. package/src/mappings/IconButton.js +35 -0
  162. package/src/mappings/Image.js +35 -0
  163. package/src/mappings/ImageBackground.js +29 -0
  164. package/src/mappings/KeyboardAvoidingView.js +41 -0
  165. package/src/mappings/KeyboardAwareScrollView.js +50 -0
  166. package/src/mappings/Layout.js +200 -0
  167. package/src/mappings/LinearGradient.js +77 -0
  168. package/src/mappings/MapCallout.js +21 -0
  169. package/src/mappings/MapMarker.js +47 -0
  170. package/src/mappings/MapView.js +139 -0
  171. package/src/mappings/Modal.js +42 -0
  172. package/src/mappings/NumberInput.js +254 -0
  173. package/src/mappings/Picker.js +148 -0
  174. package/src/mappings/ProgressBar.js +101 -0
  175. package/src/mappings/ProgressCircle.js +109 -0
  176. package/src/mappings/ProgressIndicator.js +181 -0
  177. package/src/mappings/RadioButton.js +51 -0
  178. package/src/mappings/RadioButtonGroup.js +17 -0
  179. package/src/mappings/RadioButtonRow.js +42 -0
  180. package/src/mappings/RowBodyIcon.js +75 -0
  181. package/src/mappings/RowHeadlineImageCaption.js +167 -0
  182. package/src/mappings/RowHeadlineImageIcon.js +99 -0
  183. package/src/mappings/SVG.js +20 -0
  184. package/src/mappings/SafeAreaView.js +33 -0
  185. package/src/mappings/ScrollView.js +31 -0
  186. package/src/mappings/Slider.js +60 -0
  187. package/src/mappings/StarRating.js +43 -0
  188. package/src/mappings/Stepper.js +29 -0
  189. package/src/mappings/Surface.js +14 -0
  190. package/src/mappings/Swiper.js +60 -0
  191. package/src/mappings/SwiperItem.js +8 -0
  192. package/src/mappings/Switch.js +81 -0
  193. package/src/mappings/TabView.js +73 -0
  194. package/src/mappings/TabView.ts +80 -0
  195. package/src/mappings/Text.js +251 -0
  196. package/src/mappings/TextArea.js +263 -0
  197. package/src/mappings/TextField.js +381 -0
  198. package/src/mappings/TextInput.js +391 -0
  199. package/src/mappings/ToggleButton.js +50 -0
  200. package/src/mappings/Touchable.js +17 -0
  201. package/src/mappings/Video.js +81 -0
  202. package/src/mappings/View.js +207 -0
  203. package/src/mappings/WebView.js +88 -0
  204. package/src/styles/DarkTheme.js +26 -0
  205. package/src/styles/DefaultTheme.js +111 -0
  206. package/src/styles/fonts.js +62 -0
  207. package/src/styles/overlay.js +60 -0
  208. package/src/styles/shadow.js +51 -0
  209. package/src/theming.js +3 -0
  210. package/src/utilities.js +102 -0
@@ -19,8 +19,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
19
19
 
20
20
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
21
 
22
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
23
-
24
22
  const Container = _ref => {
25
23
  let {
26
24
  useThemeGutterPadding,
@@ -82,9 +80,10 @@ const Container = _ref => {
82
80
  };
83
81
  const Wrap = elevation ? _Elevation.default : _reactNative.View;
84
82
  if (elevation) containerStyle.elevation = elevation;
85
- return /*#__PURE__*/React.createElement(Wrap, _extends({
86
- style: [containerStyle, style]
87
- }, rest), backgroundImage ? /*#__PURE__*/React.createElement(_reactNative.ImageBackground, {
83
+ return /*#__PURE__*/React.createElement(Wrap, {
84
+ style: [containerStyle, style],
85
+ ...rest
86
+ }, backgroundImage ? /*#__PURE__*/React.createElement(_reactNative.ImageBackground, {
88
87
  source: typeof backgroundImage === "string" ? {
89
88
  uri: backgroundImage
90
89
  } : backgroundImage,
@@ -101,4 +100,17 @@ const Container = _ref => {
101
100
 
102
101
  var _default = (0, _theming.withTheme)(Container);
103
102
 
103
+ exports.default = _default;izeMode: backgroundImageResizeMode,
104
+ style: {
105
+ flex: 1
106
+ }
107
+ }, /*#__PURE__*/React.createElement(_reactNative.View, {
108
+ style: innerStyle
109
+ }, children)) : /*#__PURE__*/React.createElement(_reactNative.View, {
110
+ style: innerStyle
111
+ }, children));
112
+ };
113
+
114
+ var _default = (0, _theming.withTheme)(Container);
115
+
104
116
  exports.default = _default;
@@ -1 +1,5 @@
1
- "use strict";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -1 +1,5 @@
1
- "use strict";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var React = _interopRequireWildcard(require("react"));
9
+
10
+ var _reactNativeTabView = require("react-native-tab-view");
11
+
12
+ var _TabViewItem = _interopRequireDefault(require("./TabViewItem"));
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
+
18
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
+
20
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
21
+
22
+ const TabViewComponent = _ref => {
23
+ let {
24
+ Icon,
25
+ tabBarPosition,
26
+ keyboardDismissMode,
27
+ swipeEnabled,
28
+ scrollEnabled,
29
+ activeColor,
30
+ inactiveColor,
31
+ pressColor,
32
+ indicatorColor,
33
+ style,
34
+ children
35
+ } = _ref;
36
+ const [index, setIndex] = React.useState(0);
37
+ const [routes, setRoutes] = React.useState([]);
38
+ const [tabScenes, setTabScenes] = React.useState({});
39
+ React.useEffect(() => {
40
+ const newRoutes = [];
41
+ const scenes = {};
42
+ React.Children.toArray(children).filter(child => child.type === _TabViewItem.default).forEach(child => {
43
+ var _child$props;
44
+
45
+ if (child !== null && child !== void 0 && (_child$props = child.props) !== null && _child$props !== void 0 && _child$props.id) {
46
+ var _child$props2, _child$props3;
47
+
48
+ newRoutes.push({
49
+ key: child === null || child === void 0 ? void 0 : (_child$props2 = child.props) === null || _child$props2 === void 0 ? void 0 : _child$props2.id,
50
+ ...(child === null || child === void 0 ? void 0 : child.props)
51
+ });
52
+
53
+ scenes[child === null || child === void 0 ? void 0 : (_child$props3 = child.props) === null || _child$props3 === void 0 ? void 0 : _child$props3.id] = () => child;
54
+ }
55
+ });
56
+ setRoutes(newRoutes);
57
+ setTabScenes(scenes);
58
+ }, [children]);
59
+
60
+ const indexChangeHandler = i => setIndex(i);
61
+
62
+ const renderTabBar = props => {
63
+ console.log(props);
64
+ return /*#__PURE__*/React.createElement(_reactNativeTabView.TabBar, _extends({}, props, {
65
+ activeColor: activeColor,
66
+ inactiveColor: inactiveColor,
67
+ pressColor: pressColor,
68
+ scrollEnabled: scrollEnabled,
69
+ indicatorStyle: {
70
+ backgroundColor: indicatorColor
71
+ },
72
+ renderIcon: _ref2 => {
73
+ let {
74
+ route,
75
+ color
76
+ } = _ref2;
77
+ return route !== null && route !== void 0 && route.icon ? /*#__PURE__*/React.createElement(Icon, {
78
+ name: route.icon,
79
+ color: color,
80
+ size: 36
81
+ }) : null;
82
+ },
83
+ style: style
84
+ }));
85
+ };
86
+
87
+ return /*#__PURE__*/React.createElement(_reactNativeTabView.TabView, {
88
+ navigationState: {
89
+ index,
90
+ routes
91
+ },
92
+ renderScene: (0, _reactNativeTabView.SceneMap)(tabScenes),
93
+ renderTabBar: renderTabBar,
94
+ onIndexChange: indexChangeHandler,
95
+ tabBarPosition: tabBarPosition,
96
+ keyboardDismissMode: keyboardDismissMode,
97
+ swipeEnabled: swipeEnabled
98
+ });
99
+ };
100
+
101
+ var _default = TabViewComponent;
102
+ exports.default = _default;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ const TabViewItem = _ref => {
9
+ let {
10
+ title,
11
+ id,
12
+ icon,
13
+ children,
14
+ accessibilityLabel
15
+ } = _ref;
16
+ console.log({
17
+ title,
18
+ id,
19
+ icon,
20
+ accessibilityLabel
21
+ });
22
+ return children;
23
+ };
24
+
25
+ var _default = TabViewItem;
26
+ exports.default = _default;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "TabView", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _TabView.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "TabViewItem", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _TabViewItem.default;
16
+ }
17
+ });
18
+
19
+ var _TabView = _interopRequireDefault(require("./TabView"));
20
+
21
+ var _TabViewItem = _interopRequireDefault(require("./TabViewItem"));
22
+
23
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -369,6 +369,18 @@ Object.defineProperty(exports, "SwitchRow", {
369
369
  return _Switch.SwitchRow;
370
370
  }
371
371
  });
372
+ Object.defineProperty(exports, "TabView", {
373
+ enumerable: true,
374
+ get: function () {
375
+ return _TabView.TabView;
376
+ }
377
+ });
378
+ Object.defineProperty(exports, "TabViewItem", {
379
+ enumerable: true,
380
+ get: function () {
381
+ return _TabView.TabViewItem;
382
+ }
383
+ });
372
384
  Object.defineProperty(exports, "TextField", {
373
385
  enumerable: true,
374
386
  get: function () {
@@ -472,6 +484,8 @@ var _ActionSheet = require("./components/ActionSheet");
472
484
 
473
485
  var _Swiper = require("./components/Swiper");
474
486
 
487
+ var _TabView = require("./components/TabView");
488
+
475
489
  var _Layout = require("./components/Layout");
476
490
 
477
491
  var _index = require("./components/RadioButton/index");
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SEED_DATA = void 0;
7
+
8
+ var _types = require("@draftbit/types");
9
+
10
+ const SEED_DATA = [{
11
+ name: "TabView",
12
+ tag: "TabView",
13
+ category: _types.COMPONENT_TYPES.container,
14
+ layout: {},
15
+ props: {
16
+ tabBarPosition: (0, _types.createTextEnumProp)({
17
+ label: "Tab Bar Position",
18
+ description: "Tab Bar Position",
19
+ options: ["top", "bottom"],
20
+ defaultValue: "top"
21
+ }),
22
+ keyboardDismissMode: (0, _types.createTextEnumProp)({
23
+ label: "Keyboard Dismiss Mode",
24
+ description: "Keyboard Dismiss Mode",
25
+ options: ["auto", "on-drag", "none"],
26
+ defaultValue: "auto"
27
+ }),
28
+ swipeEnabled: (0, _types.createBoolProp)({
29
+ label: "Swipe Enabled",
30
+ description: "Swipe Enabled",
31
+ defaultValue: true
32
+ }),
33
+ scrollEnabled: (0, _types.createBoolProp)({
34
+ label: "Scroll Enabled",
35
+ description: "Scroll Enabled",
36
+ defaultValue: true
37
+ }),
38
+ activeColor: (0, _types.createColorProp)({
39
+ label: "Active Color",
40
+ description: "Active Color",
41
+ defaultValue: "primary"
42
+ }),
43
+ inactiveColor: (0, _types.createColorProp)({
44
+ label: "Inactive Color",
45
+ description: "Inactive Color",
46
+ defaultValue: null
47
+ }),
48
+ pressColor: (0, _types.createColorProp)({
49
+ label: "Press Color",
50
+ description: "Press Color",
51
+ defaultValue: null
52
+ }),
53
+ indicatorColor: (0, _types.createColorProp)({
54
+ label: "Indicator Color",
55
+ description: "Indicator Color",
56
+ defaultValue: null
57
+ })
58
+ }
59
+ }, {
60
+ name: "TabViewItem",
61
+ tag: "TabViewItem",
62
+ category: _types.COMPONENT_TYPES.container,
63
+ layout: {},
64
+ props: {
65
+ title: (0, _types.createTextProp)({
66
+ label: "Title",
67
+ description: "Tab Title"
68
+ }),
69
+ id: (0, _types.createTextProp)({
70
+ label: "Id",
71
+ description: "Tab Id"
72
+ }),
73
+ accessibilityLabel: (0, _types.createTextProp)({
74
+ label: "Accessibility Label",
75
+ description: "Accessibility Label"
76
+ })
77
+ }
78
+ }];
79
+ exports.SEED_DATA = SEED_DATA;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,87 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ import * as React from "react";
4
+ import { TabView, TabBar, SceneMap } from "react-native-tab-view"; // import { withTheme } from "../../theming";
5
+
6
+ import TabViewItem from "./TabViewItem";
7
+
8
+ const TabViewComponent = _ref => {
9
+ let {
10
+ Icon,
11
+ tabBarPosition,
12
+ keyboardDismissMode,
13
+ swipeEnabled,
14
+ scrollEnabled,
15
+ activeColor,
16
+ inactiveColor,
17
+ pressColor,
18
+ indicatorColor,
19
+ style,
20
+ children
21
+ } = _ref;
22
+ const [index, setIndex] = React.useState(0);
23
+ const [routes, setRoutes] = React.useState([]);
24
+ const [tabScenes, setTabScenes] = React.useState({});
25
+ React.useEffect(() => {
26
+ const newRoutes = [];
27
+ const scenes = {};
28
+ React.Children.toArray(children).filter(child => child.type === TabViewItem).forEach(child => {
29
+ var _child$props;
30
+
31
+ if (child !== null && child !== void 0 && (_child$props = child.props) !== null && _child$props !== void 0 && _child$props.id) {
32
+ var _child$props2, _child$props3;
33
+
34
+ newRoutes.push({
35
+ key: child === null || child === void 0 ? void 0 : (_child$props2 = child.props) === null || _child$props2 === void 0 ? void 0 : _child$props2.id,
36
+ ...(child === null || child === void 0 ? void 0 : child.props)
37
+ });
38
+
39
+ scenes[child === null || child === void 0 ? void 0 : (_child$props3 = child.props) === null || _child$props3 === void 0 ? void 0 : _child$props3.id] = () => child;
40
+ }
41
+ });
42
+ setRoutes(newRoutes);
43
+ setTabScenes(scenes);
44
+ }, [children]);
45
+
46
+ const indexChangeHandler = i => setIndex(i);
47
+
48
+ const renderTabBar = props => {
49
+ console.log(props);
50
+ return /*#__PURE__*/React.createElement(TabBar, _extends({}, props, {
51
+ activeColor: activeColor,
52
+ inactiveColor: inactiveColor,
53
+ pressColor: pressColor,
54
+ scrollEnabled: scrollEnabled,
55
+ indicatorStyle: {
56
+ backgroundColor: indicatorColor
57
+ },
58
+ renderIcon: _ref2 => {
59
+ let {
60
+ route,
61
+ color
62
+ } = _ref2;
63
+ return route !== null && route !== void 0 && route.icon ? /*#__PURE__*/React.createElement(Icon, {
64
+ name: route.icon,
65
+ color: color,
66
+ size: 36
67
+ }) : null;
68
+ },
69
+ style: style
70
+ }));
71
+ };
72
+
73
+ return /*#__PURE__*/React.createElement(TabView, {
74
+ navigationState: {
75
+ index,
76
+ routes
77
+ },
78
+ renderScene: SceneMap(tabScenes),
79
+ renderTabBar: renderTabBar,
80
+ onIndexChange: indexChangeHandler,
81
+ tabBarPosition: tabBarPosition,
82
+ keyboardDismissMode: keyboardDismissMode,
83
+ swipeEnabled: swipeEnabled
84
+ });
85
+ };
86
+
87
+ export default TabViewComponent;
@@ -0,0 +1,18 @@
1
+ const TabViewItem = _ref => {
2
+ let {
3
+ title,
4
+ id,
5
+ icon,
6
+ children,
7
+ accessibilityLabel
8
+ } = _ref;
9
+ console.log({
10
+ title,
11
+ id,
12
+ icon,
13
+ accessibilityLabel
14
+ });
15
+ return children;
16
+ };
17
+
18
+ export default TabViewItem;
@@ -0,0 +1,2 @@
1
+ export { default as TabView } from "./TabView";
2
+ export { default as TabViewItem } from "./TabViewItem";
@@ -1,5 +1,3 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
1
  import * as React from "react";
4
2
  import { withTheme } from "../theming";
5
3
  import { StyleSheet } from "react-native";
@@ -42,13 +40,29 @@ const ToggleButton = _ref => {
42
40
  onPress(!internalValue);
43
41
  };
44
42
 
45
- return /*#__PURE__*/React.createElement(IconButton, _extends({
43
+ return /*#__PURE__*/React.createElement(IconButton, {
46
44
  Icon: Icon,
47
45
  icon: icon,
48
46
  size: iconSize,
49
47
  color: internalValue ? colors[color] : colors[colorSecondary],
50
48
  onPress: handlePress,
51
49
  disabled: disabled,
50
+ style: [styles.mainContainer, {
51
+ width,
52
+ height,
53
+ backgroundColor: internalValue ? colors[colorSecondary] : colors[color],
54
+ borderColor: colors[borderColor]
55
+ }, style],
56
+ ...rest
57
+ });
58
+ };
59
+
60
+ const styles = StyleSheet.create({
61
+ mainContainer: {
62
+ borderWidth: 1
63
+ }
64
+ });
65
+ export default withTheme(ToggleButton);: disabled,
52
66
  style: [styles.mainContainer, {
53
67
  width,
54
68
  height,
@@ -29,6 +29,7 @@ export { default as Touchable } from "./components/Touchable";
29
29
  export { AccordionGroup, AccordionItem } from "./components/Accordion";
30
30
  export { ActionSheet, ActionSheetItem, ActionSheetCancel } from "./components/ActionSheet";
31
31
  export { Swiper, SwiperItem } from "./components/Swiper";
32
+ export { TabView, TabViewItem } from "./components/TabView";
32
33
  export { Center, Circle, Square, Row, Stack, Spacer } from "./components/Layout";
33
34
  export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup } from "./components/RadioButton/index";
34
35
  /* Deprecated: Fix or Delete! */
@@ -0,0 +1,70 @@
1
+ import { COMPONENT_TYPES, createTextProp, createTextEnumProp, createBoolProp, createColorProp } from "@draftbit/types";
2
+ export const SEED_DATA = [{
3
+ name: "TabView",
4
+ tag: "TabView",
5
+ category: COMPONENT_TYPES.container,
6
+ layout: {},
7
+ props: {
8
+ tabBarPosition: createTextEnumProp({
9
+ label: "Tab Bar Position",
10
+ description: "Tab Bar Position",
11
+ options: ["top", "bottom"],
12
+ defaultValue: "top"
13
+ }),
14
+ keyboardDismissMode: createTextEnumProp({
15
+ label: "Keyboard Dismiss Mode",
16
+ description: "Keyboard Dismiss Mode",
17
+ options: ["auto", "on-drag", "none"],
18
+ defaultValue: "auto"
19
+ }),
20
+ swipeEnabled: createBoolProp({
21
+ label: "Swipe Enabled",
22
+ description: "Swipe Enabled",
23
+ defaultValue: true
24
+ }),
25
+ scrollEnabled: createBoolProp({
26
+ label: "Scroll Enabled",
27
+ description: "Scroll Enabled",
28
+ defaultValue: true
29
+ }),
30
+ activeColor: createColorProp({
31
+ label: "Active Color",
32
+ description: "Active Color",
33
+ defaultValue: "primary"
34
+ }),
35
+ inactiveColor: createColorProp({
36
+ label: "Inactive Color",
37
+ description: "Inactive Color",
38
+ defaultValue: null
39
+ }),
40
+ pressColor: createColorProp({
41
+ label: "Press Color",
42
+ description: "Press Color",
43
+ defaultValue: null
44
+ }),
45
+ indicatorColor: createColorProp({
46
+ label: "Indicator Color",
47
+ description: "Indicator Color",
48
+ defaultValue: null
49
+ })
50
+ }
51
+ }, {
52
+ name: "TabViewItem",
53
+ tag: "TabViewItem",
54
+ category: COMPONENT_TYPES.container,
55
+ layout: {},
56
+ props: {
57
+ title: createTextProp({
58
+ label: "Title",
59
+ description: "Tab Title"
60
+ }),
61
+ id: createTextProp({
62
+ label: "Id",
63
+ description: "Tab Id"
64
+ }),
65
+ accessibilityLabel: createTextProp({
66
+ label: "Accessibility Label",
67
+ description: "Accessibility Label"
68
+ })
69
+ }
70
+ }];
@@ -0,0 +1,19 @@
1
+ import * as React from "react";
2
+ import { StyleProp, TextStyle, ViewStyle } from "react-native";
3
+ import type { IconSlot } from "../../interfaces/Icon";
4
+ declare type TabBarPosition = "top" | "bottom";
5
+ declare type KeyboardDismissMode = "none" | "auto" | "on-drag";
6
+ declare type TabViewProps = {
7
+ tabBarPosition?: TabBarPosition;
8
+ keyboardDismissMode?: KeyboardDismissMode;
9
+ swipeEnabled?: boolean;
10
+ scrollEnabled?: boolean;
11
+ activeColor?: string;
12
+ inactiveColor?: string;
13
+ pressColor?: string;
14
+ indicatorColor?: string;
15
+ style?: StyleProp<TextStyle | ViewStyle>;
16
+ children: React.ReactNode;
17
+ } & IconSlot;
18
+ declare const TabViewComponent: ({ Icon, tabBarPosition, keyboardDismissMode, swipeEnabled, scrollEnabled, activeColor, inactiveColor, pressColor, indicatorColor, style, children, }: TabViewProps) => JSX.Element;
19
+ export default TabViewComponent;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ interface TabViewItemProps {
3
+ title: string;
4
+ id: string;
5
+ icon: string;
6
+ accessibilityLabel: string;
7
+ children: React.ReactNode;
8
+ }
9
+ declare const TabViewItem: ({ title, id, icon, children, accessibilityLabel, }: TabViewItemProps) => React.ReactNode;
10
+ export default TabViewItem;
@@ -0,0 +1,2 @@
1
+ export { default as TabView } from "./TabView";
2
+ export { default as TabViewItem } from "./TabViewItem";
@@ -29,6 +29,7 @@ export { default as Touchable } from "./components/Touchable";
29
29
  export { AccordionGroup, AccordionItem } from "./components/Accordion";
30
30
  export { ActionSheet, ActionSheetItem, ActionSheetCancel, } from "./components/ActionSheet";
31
31
  export { Swiper, SwiperItem } from "./components/Swiper";
32
+ export { TabView, TabViewItem } from "./components/TabView";
32
33
  export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
33
34
  export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
34
35
  export { default as CardBlock } from "./components/CardBlock";