@draftbit/core 46.2.4-dedb7a.0 → 46.2.4-f941fc.0

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 (46) hide show
  1. package/lib/commonjs/components/Accordion/AccordionItem.js +25 -5
  2. package/lib/commonjs/components/DeprecatedButton.js +4 -22
  3. package/lib/commonjs/components/TabView/TabView.js +102 -0
  4. package/lib/commonjs/components/TabView/TabViewItem.js +26 -0
  5. package/lib/commonjs/components/TabView/index.js +23 -0
  6. package/lib/commonjs/index.js +14 -0
  7. package/lib/commonjs/mappings/NumberInput.js +149 -146
  8. package/lib/commonjs/mappings/TabView.js +79 -0
  9. package/lib/commonjs/mappings/TextArea.js +193 -188
  10. package/lib/commonjs/mappings/TextField.js +8 -3
  11. package/lib/commonjs/mappings/TextInput.js +180 -178
  12. package/lib/module/components/TabView/TabView.js +87 -0
  13. package/lib/module/components/TabView/TabViewItem.js +18 -0
  14. package/lib/module/components/TabView/index.js +2 -0
  15. package/lib/module/index.js +1 -0
  16. package/lib/module/mappings/NumberInput.js +149 -146
  17. package/lib/module/mappings/TabView.js +70 -0
  18. package/lib/module/mappings/TextArea.js +193 -188
  19. package/lib/module/mappings/TextField.js +8 -3
  20. package/lib/module/mappings/TextInput.js +180 -178
  21. package/lib/typescript/src/components/TabView/TabView.d.ts +19 -0
  22. package/lib/typescript/src/components/TabView/TabViewItem.d.ts +10 -0
  23. package/lib/typescript/src/components/TabView/index.d.ts +2 -0
  24. package/lib/typescript/src/index.d.ts +1 -0
  25. package/lib/typescript/src/mappings/TabView.d.ts +111 -0
  26. package/lib/typescript/src/mappings/TextArea.d.ts +42 -42
  27. package/lib/typescript/src/mappings/TextField.d.ts +118 -118
  28. package/package.json +4 -2
  29. package/src/components/TabView/TabView.js +34 -0
  30. package/src/components/TabView/TabView.tsx +97 -0
  31. package/src/components/TabView/TabViewItem.js +5 -0
  32. package/src/components/TabView/TabViewItem.tsx +21 -0
  33. package/src/components/TabView/index.js +2 -0
  34. package/src/components/TabView/index.ts +2 -0
  35. package/src/index.js +1 -0
  36. package/src/index.tsx +1 -0
  37. package/src/mappings/NumberInput.js +163 -160
  38. package/src/mappings/NumberInput.ts +168 -165
  39. package/src/mappings/TabView.js +73 -0
  40. package/src/mappings/TabView.ts +80 -0
  41. package/src/mappings/TextArea.js +220 -213
  42. package/src/mappings/TextArea.ts +227 -219
  43. package/src/mappings/TextField.js +9 -2
  44. package/src/mappings/TextField.ts +11 -3
  45. package/src/mappings/TextInput.js +208 -205
  46. package/src/mappings/TextInput.ts +215 -212
@@ -38,6 +38,79 @@ export declare const SEED_DATA: ({
38
38
  editable: boolean;
39
39
  required: boolean;
40
40
  };
41
+ label: {
42
+ group: string;
43
+ label: string;
44
+ description: string;
45
+ formType: string;
46
+ propType: string;
47
+ defaultValue: null;
48
+ editable: boolean;
49
+ required: boolean;
50
+ };
51
+ assistiveText: {
52
+ group: string;
53
+ label: string;
54
+ description: string;
55
+ formType: string;
56
+ propType: string;
57
+ defaultValue: null;
58
+ editable: boolean;
59
+ required: boolean;
60
+ };
61
+ error: {
62
+ group: string;
63
+ label: string;
64
+ description: string;
65
+ formType: string;
66
+ propType: string;
67
+ defaultValue: null;
68
+ editable: boolean;
69
+ required: boolean;
70
+ };
71
+ leftIconName: {
72
+ group: string;
73
+ label: string;
74
+ description: string;
75
+ formType: string;
76
+ propType: string;
77
+ defaultValue: null;
78
+ editable: boolean;
79
+ required: boolean;
80
+ };
81
+ leftIconMode: {
82
+ group: string;
83
+ label: string;
84
+ description: string;
85
+ formType: string;
86
+ propType: string;
87
+ defaultValue: null;
88
+ options: string[];
89
+ editable: boolean;
90
+ required: boolean;
91
+ };
92
+ rightIconName: {
93
+ group: string;
94
+ label: string;
95
+ description: string;
96
+ formType: string;
97
+ propType: string;
98
+ defaultValue: null;
99
+ editable: boolean;
100
+ required: boolean;
101
+ };
102
+ fieldName: {
103
+ handlerPropName: string;
104
+ defaultValue: string;
105
+ group: string;
106
+ label: string;
107
+ description: string;
108
+ formType: string;
109
+ propType: string;
110
+ valuePropName: string;
111
+ editable: boolean;
112
+ required: boolean;
113
+ };
41
114
  allowFontScaling: {
42
115
  group: string;
43
116
  label: string;
@@ -215,58 +288,74 @@ export declare const SEED_DATA: ({
215
288
  formType: string;
216
289
  propType: string;
217
290
  };
218
- label: {
291
+ };
292
+ layout: {};
293
+ stylesPanelSections?: undefined;
294
+ } | {
295
+ name: string;
296
+ tag: string;
297
+ description: string;
298
+ category: string;
299
+ stylesPanelSections: string[];
300
+ preview_image_url: string;
301
+ supports_list_render: boolean;
302
+ triggers: string[];
303
+ props: {
304
+ placeholder: {
305
+ defaultValue: string;
219
306
  group: string;
220
307
  label: string;
221
308
  description: string;
222
- formType: string;
223
- propType: string;
224
- defaultValue: null;
225
309
  editable: boolean;
226
310
  required: boolean;
311
+ formType: string;
312
+ propType: string;
227
313
  };
228
- assistiveText: {
229
- group: string;
314
+ type: {
230
315
  label: string;
231
316
  description: string;
232
317
  formType: string;
233
318
  propType: string;
234
- defaultValue: null;
319
+ defaultValue: string;
320
+ options: string[];
235
321
  editable: boolean;
236
322
  required: boolean;
237
- };
238
- error: {
239
323
  group: string;
324
+ };
325
+ multiline: {
240
326
  label: string;
241
327
  description: string;
328
+ group: string;
242
329
  formType: string;
243
330
  propType: string;
244
- defaultValue: null;
331
+ defaultValue: boolean;
245
332
  editable: boolean;
246
333
  required: boolean;
247
334
  };
248
- leftIconName: {
249
- group: string;
335
+ numberOfLines: {
250
336
  label: string;
251
337
  description: string;
252
338
  formType: string;
253
339
  propType: string;
340
+ group: string;
254
341
  defaultValue: null;
255
342
  editable: boolean;
256
343
  required: boolean;
344
+ step: number;
257
345
  };
258
- leftIconMode: {
346
+ fieldName: {
347
+ handlerPropName: string;
259
348
  group: string;
260
349
  label: string;
261
350
  description: string;
262
351
  formType: string;
263
352
  propType: string;
264
- defaultValue: null;
265
- options: string[];
353
+ defaultValue: string;
354
+ valuePropName: string;
266
355
  editable: boolean;
267
356
  required: boolean;
268
357
  };
269
- rightIconName: {
358
+ label: {
270
359
  group: string;
271
360
  label: string;
272
361
  description: string;
@@ -276,72 +365,54 @@ export declare const SEED_DATA: ({
276
365
  editable: boolean;
277
366
  required: boolean;
278
367
  };
279
- fieldName: {
280
- handlerPropName: string;
281
- defaultValue: string;
368
+ assistiveText: {
282
369
  group: string;
283
370
  label: string;
284
371
  description: string;
285
372
  formType: string;
286
373
  propType: string;
287
- valuePropName: string;
374
+ defaultValue: null;
288
375
  editable: boolean;
289
376
  required: boolean;
290
377
  };
291
- };
292
- layout: {};
293
- stylesPanelSections?: undefined;
294
- } | {
295
- name: string;
296
- tag: string;
297
- description: string;
298
- category: string;
299
- stylesPanelSections: string[];
300
- preview_image_url: string;
301
- supports_list_render: boolean;
302
- triggers: string[];
303
- props: {
304
- type: {
378
+ error: {
379
+ group: string;
305
380
  label: string;
306
381
  description: string;
307
382
  formType: string;
308
383
  propType: string;
309
- defaultValue: string;
310
- options: string[];
384
+ defaultValue: null;
311
385
  editable: boolean;
312
386
  required: boolean;
313
- group: string;
314
387
  };
315
- multiline: {
388
+ leftIconName: {
389
+ group: string;
316
390
  label: string;
317
391
  description: string;
318
- group: string;
319
392
  formType: string;
320
393
  propType: string;
321
- defaultValue: boolean;
394
+ defaultValue: null;
322
395
  editable: boolean;
323
396
  required: boolean;
324
397
  };
325
- numberOfLines: {
398
+ leftIconMode: {
399
+ group: string;
326
400
  label: string;
327
401
  description: string;
328
402
  formType: string;
329
403
  propType: string;
330
- group: string;
331
404
  defaultValue: null;
405
+ options: string[];
332
406
  editable: boolean;
333
407
  required: boolean;
334
- step: number;
335
408
  };
336
- fieldName: {
337
- handlerPropName: string;
409
+ rightIconName: {
338
410
  group: string;
339
411
  label: string;
340
412
  description: string;
341
413
  formType: string;
342
414
  propType: string;
343
- defaultValue: string;
344
- valuePropName: string;
415
+ defaultValue: null;
345
416
  editable: boolean;
346
417
  required: boolean;
347
418
  };
@@ -461,16 +532,6 @@ export declare const SEED_DATA: ({
461
532
  formType: string;
462
533
  propType: string;
463
534
  };
464
- placeholder: {
465
- group: string;
466
- label: string;
467
- description: string;
468
- editable: boolean;
469
- required: boolean;
470
- defaultValue: string;
471
- formType: string;
472
- propType: string;
473
- };
474
535
  placeholderTextColor: {
475
536
  group: string;
476
537
  label: string;
@@ -532,67 +593,6 @@ export declare const SEED_DATA: ({
532
593
  formType: string;
533
594
  propType: string;
534
595
  };
535
- label: {
536
- group: string;
537
- label: string;
538
- description: string;
539
- formType: string;
540
- propType: string;
541
- defaultValue: null;
542
- editable: boolean;
543
- required: boolean;
544
- };
545
- assistiveText: {
546
- group: string;
547
- label: string;
548
- description: string;
549
- formType: string;
550
- propType: string;
551
- defaultValue: null;
552
- editable: boolean;
553
- required: boolean;
554
- };
555
- error: {
556
- group: string;
557
- label: string;
558
- description: string;
559
- formType: string;
560
- propType: string;
561
- defaultValue: null;
562
- editable: boolean;
563
- required: boolean;
564
- };
565
- leftIconName: {
566
- group: string;
567
- label: string;
568
- description: string;
569
- formType: string;
570
- propType: string;
571
- defaultValue: null;
572
- editable: boolean;
573
- required: boolean;
574
- };
575
- leftIconMode: {
576
- group: string;
577
- label: string;
578
- description: string;
579
- formType: string;
580
- propType: string;
581
- defaultValue: null;
582
- options: string[];
583
- editable: boolean;
584
- required: boolean;
585
- };
586
- rightIconName: {
587
- group: string;
588
- label: string;
589
- description: string;
590
- formType: string;
591
- propType: string;
592
- defaultValue: null;
593
- editable: boolean;
594
- required: boolean;
595
- };
596
596
  };
597
597
  layout: {};
598
598
  })[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "46.2.4-dedb7a.0+dedb7a5d",
3
+ "version": "46.2.4-f941fc.0+f941fce3",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -53,6 +53,8 @@
53
53
  "lodash.omit": "^4.5.0",
54
54
  "lodash.tonumber": "^4.0.3",
55
55
  "react-native-modal-datetime-picker": "^13.0.0",
56
+ "react-native-pager-view": "5.4.24",
57
+ "react-native-tab-view": "^3.0.0",
56
58
  "react-native-typography": "^1.4.1",
57
59
  "react-native-web-swiper": "^2.2.3"
58
60
  },
@@ -79,5 +81,5 @@
79
81
  ]
80
82
  ]
81
83
  },
82
- "gitHead": "dedb7a5ddf0c05da6f0df9e49b2a927b6ec0a69d"
84
+ "gitHead": "f941fce333cbde99353912ffe850983d835bbd1e"
83
85
  }
@@ -0,0 +1,34 @@
1
+ import * as React from "react";
2
+ import { TabView, TabBar, SceneMap } from "react-native-tab-view";
3
+ // import { withTheme } from "../../theming";
4
+ import TabViewItem from "./TabViewItem";
5
+ const TabViewComponent = ({ Icon, tabBarPosition, keyboardDismissMode, swipeEnabled, scrollEnabled, activeColor, inactiveColor, pressColor, indicatorColor, style, children, }) => {
6
+ const [index, setIndex] = React.useState(0);
7
+ const [routes, setRoutes] = React.useState([]);
8
+ const [tabScenes, setTabScenes] = React.useState({});
9
+ React.useEffect(() => {
10
+ const newRoutes = [];
11
+ const scenes = {};
12
+ React.Children.toArray(children)
13
+ .filter((child) => child.type === TabViewItem)
14
+ .forEach((child) => {
15
+ var _a, _b, _c;
16
+ if ((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.id) {
17
+ newRoutes.push({
18
+ key: (_b = child === null || child === void 0 ? void 0 : child.props) === null || _b === void 0 ? void 0 : _b.id,
19
+ ...child === null || child === void 0 ? void 0 : child.props,
20
+ });
21
+ scenes[(_c = child === null || child === void 0 ? void 0 : child.props) === null || _c === void 0 ? void 0 : _c.id] = () => child;
22
+ }
23
+ });
24
+ setRoutes(newRoutes);
25
+ setTabScenes(scenes);
26
+ }, [children]);
27
+ const indexChangeHandler = (i) => setIndex(i);
28
+ const renderTabBar = (props) => {
29
+ console.log(props);
30
+ return (React.createElement(TabBar, { ...props, activeColor: activeColor, inactiveColor: inactiveColor, pressColor: pressColor, scrollEnabled: scrollEnabled, indicatorStyle: { backgroundColor: indicatorColor }, renderIcon: ({ route, color }) => (route === null || route === void 0 ? void 0 : route.icon) ? (React.createElement(Icon, { name: route.icon, color: color, size: 36 })) : null, style: style }));
31
+ };
32
+ return (React.createElement(TabView, { navigationState: { index, routes }, renderScene: SceneMap(tabScenes), renderTabBar: renderTabBar, onIndexChange: indexChangeHandler, tabBarPosition: tabBarPosition, keyboardDismissMode: keyboardDismissMode, swipeEnabled: swipeEnabled }));
33
+ };
34
+ export default TabViewComponent;
@@ -0,0 +1,97 @@
1
+ import * as React from "react";
2
+ import { StyleProp, TextStyle, ViewStyle } from "react-native";
3
+ import { TabView, TabBar, SceneMap } from "react-native-tab-view";
4
+
5
+ // import { withTheme } from "../../theming";
6
+ import TabViewItem from "./TabViewItem";
7
+ import type { IconSlot } from "../../interfaces/Icon";
8
+
9
+ type TabBarPosition = "top" | "bottom";
10
+ type KeyboardDismissMode = "none" | "auto" | "on-drag";
11
+
12
+ type TabViewProps = {
13
+ tabBarPosition?: TabBarPosition;
14
+ keyboardDismissMode?: KeyboardDismissMode;
15
+ swipeEnabled?: boolean;
16
+ scrollEnabled?: boolean;
17
+ activeColor?: string;
18
+ inactiveColor?: string;
19
+ pressColor?: string;
20
+ indicatorColor?: string;
21
+ style?: StyleProp<TextStyle | ViewStyle>;
22
+ children: React.ReactNode;
23
+ } & IconSlot;
24
+
25
+ const TabViewComponent = ({
26
+ Icon,
27
+ tabBarPosition,
28
+ keyboardDismissMode,
29
+ swipeEnabled,
30
+ scrollEnabled,
31
+ activeColor,
32
+ inactiveColor,
33
+ pressColor,
34
+ indicatorColor,
35
+ style,
36
+ children,
37
+ }: TabViewProps) => {
38
+ const [index, setIndex] = React.useState(0);
39
+ const [routes, setRoutes] = React.useState([]);
40
+ const [tabScenes, setTabScenes] = React.useState({});
41
+
42
+ React.useEffect(() => {
43
+ const newRoutes: any = [];
44
+ const scenes: any = {};
45
+
46
+ React.Children.toArray(children)
47
+ .filter((child: any) => child.type === TabViewItem)
48
+ .forEach((child: any) => {
49
+ if (child?.props?.id) {
50
+ newRoutes.push({
51
+ key: child?.props?.id,
52
+ ...child?.props,
53
+ });
54
+ scenes[child?.props?.id] = () => child;
55
+ }
56
+ });
57
+
58
+ setRoutes(newRoutes);
59
+ setTabScenes(scenes);
60
+ }, [children]);
61
+
62
+ const indexChangeHandler = (i: any) => setIndex(i);
63
+
64
+ const renderTabBar = (props: any) => {
65
+ console.log(props);
66
+ return (
67
+ <TabBar
68
+ {...props}
69
+ activeColor={activeColor}
70
+ inactiveColor={inactiveColor}
71
+ pressColor={pressColor}
72
+ scrollEnabled={scrollEnabled}
73
+ indicatorStyle={{ backgroundColor: indicatorColor }}
74
+ renderIcon={({ route, color }) =>
75
+ route?.icon ? (
76
+ <Icon name={route.icon} color={color} size={36} />
77
+ ) : null
78
+ }
79
+ style={style}
80
+ />
81
+ );
82
+ };
83
+
84
+ return (
85
+ <TabView
86
+ navigationState={{ index, routes }}
87
+ renderScene={SceneMap(tabScenes)}
88
+ renderTabBar={renderTabBar}
89
+ onIndexChange={indexChangeHandler}
90
+ tabBarPosition={tabBarPosition}
91
+ keyboardDismissMode={keyboardDismissMode}
92
+ swipeEnabled={swipeEnabled}
93
+ />
94
+ );
95
+ };
96
+
97
+ export default TabViewComponent;
@@ -0,0 +1,5 @@
1
+ const TabViewItem = ({ title, id, icon, children, accessibilityLabel, }) => {
2
+ console.log({ title, id, icon, accessibilityLabel });
3
+ return children;
4
+ };
5
+ export default TabViewItem;
@@ -0,0 +1,21 @@
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
+
10
+ const TabViewItem = ({
11
+ title,
12
+ id,
13
+ icon,
14
+ children,
15
+ accessibilityLabel,
16
+ }: TabViewItemProps) => {
17
+ console.log({ title, id, icon, accessibilityLabel });
18
+ return children;
19
+ };
20
+
21
+ export default TabViewItem;
@@ -0,0 +1,2 @@
1
+ export { default as TabView } from "./TabView";
2
+ export { default as TabViewItem } from "./TabViewItem";
@@ -0,0 +1,2 @@
1
+ export { default as TabView } from "./TabView";
2
+ export { default as TabViewItem } from "./TabViewItem";
package/src/index.js CHANGED
@@ -28,6 +28,7 @@ export { default as Touchable } from "./components/Touchable";
28
28
  export { AccordionGroup, AccordionItem } from "./components/Accordion";
29
29
  export { ActionSheet, ActionSheetItem, ActionSheetCancel, } from "./components/ActionSheet";
30
30
  export { Swiper, SwiperItem } from "./components/Swiper";
31
+ export { TabView, TabViewItem } from "./components/TabView";
31
32
  export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
32
33
  export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
33
34
  /* Deprecated: Fix or Delete! */
package/src/index.tsx CHANGED
@@ -33,6 +33,7 @@ export {
33
33
  ActionSheetCancel,
34
34
  } from "./components/ActionSheet";
35
35
  export { Swiper, SwiperItem } from "./components/Swiper";
36
+ export { TabView, TabViewItem } from "./components/TabView";
36
37
 
37
38
  export {
38
39
  Center,