@draftbit/core 46.8.2-088bf8.2 → 46.8.2-0a0db3.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 (82) hide show
  1. package/lib/commonjs/components/Accordion/AccordionItem.js +23 -4
  2. package/lib/commonjs/components/AnimatedCircularProgress.js +12 -1
  3. package/lib/commonjs/components/AspectRatio.js +17 -1
  4. package/lib/commonjs/components/Banner.js +23 -4
  5. package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +23 -5
  6. package/lib/commonjs/components/Checkbox/context.js +1 -1
  7. package/lib/commonjs/components/CircleImage.js +15 -1
  8. package/lib/commonjs/components/CircularProgress.js +26 -8
  9. package/lib/commonjs/components/Container.js +15 -4
  10. package/lib/commonjs/components/DeprecatedCardWrapper.js +15 -1
  11. package/lib/commonjs/components/DeprecatedFAB.js +21 -3
  12. package/lib/commonjs/components/Divider.js +14 -1
  13. package/lib/commonjs/components/Elevation.js +14 -2
  14. package/lib/commonjs/components/FormRow.js +16 -2
  15. package/lib/commonjs/components/IconButton.js +19 -4
  16. package/lib/commonjs/components/Image.js +17 -2
  17. package/lib/commonjs/components/Layout.js +40 -19
  18. package/lib/commonjs/components/Picker/PickerComponent.web.js +20 -3
  19. package/lib/commonjs/components/Portal/PortalConsumer.js +22 -7
  20. package/lib/commonjs/components/Portal/PortalHost.js +44 -15
  21. package/lib/commonjs/components/Portal/PortalManager.js +34 -8
  22. package/lib/commonjs/components/Pressable.js +15 -2
  23. package/lib/commonjs/components/ProgressBar.js +37 -7
  24. package/lib/commonjs/components/RadioButton/RadioButton.js +13 -2
  25. package/lib/commonjs/components/RadioButton/RadioButtonFieldGroup.js +9 -1
  26. package/lib/commonjs/components/RadioButton/RadioButtonGroup.js +15 -2
  27. package/lib/commonjs/components/RadioButton/RadioButtonRow.js +23 -5
  28. package/lib/commonjs/components/RadioButton/context.js +1 -1
  29. package/lib/commonjs/components/ScreenContainer.js +24 -6
  30. package/lib/commonjs/components/StarRating.js +23 -4
  31. package/lib/commonjs/components/StepIndicator.js +57 -18
  32. package/lib/commonjs/components/Surface.js +14 -2
  33. package/lib/commonjs/components/Switch.js +19 -10
  34. package/lib/commonjs/components/TabView/TabView.js +132 -0
  35. package/lib/commonjs/components/TabView/TabViewItem.js +25 -0
  36. package/lib/commonjs/components/TabView/index.js +20 -0
  37. package/lib/commonjs/components/Text.js +50 -4
  38. package/lib/commonjs/components/TextField.js +76 -28
  39. package/lib/commonjs/components/ToggleButton.js +2 -15
  40. package/lib/commonjs/components/Touchable.js +15 -2
  41. package/lib/commonjs/hooks.js +2 -1
  42. package/lib/commonjs/index.js +13 -0
  43. package/lib/commonjs/mappings/TabView.js +77 -0
  44. package/lib/commonjs/mappings/TabViewItem.js +37 -0
  45. package/lib/module/components/Picker/PickerComponent.android.js +11 -8
  46. package/lib/module/components/TabView/TabView.js +113 -0
  47. package/lib/module/components/TabView/TabViewItem.js +20 -0
  48. package/lib/module/components/TabView/index.js +2 -0
  49. package/lib/module/index.js +1 -0
  50. package/lib/module/mappings/TabView.js +70 -0
  51. package/lib/module/mappings/TabViewItem.js +30 -0
  52. package/lib/typescript/src/components/TabView/TabView.d.ts +26 -0
  53. package/lib/typescript/src/components/TabView/TabView.d.ts.map +1 -0
  54. package/lib/typescript/src/components/TabView/TabViewItem.d.ts +11 -0
  55. package/lib/typescript/src/components/TabView/TabViewItem.d.ts.map +1 -0
  56. package/lib/typescript/src/components/TabView/index.d.ts +3 -0
  57. package/lib/typescript/src/components/TabView/index.d.ts.map +1 -0
  58. package/lib/typescript/src/index.d.ts +1 -0
  59. package/lib/typescript/src/index.d.ts.map +1 -1
  60. package/lib/typescript/src/mappings/TabView.d.ts +126 -0
  61. package/lib/typescript/src/mappings/TabView.d.ts.map +1 -0
  62. package/lib/typescript/src/mappings/TabViewItem.d.ts +25 -0
  63. package/lib/typescript/src/mappings/TabViewItem.d.ts.map +1 -0
  64. package/package.json +5 -4
  65. package/src/components/TabView/TabView.js +58 -0
  66. package/src/components/TabView/TabView.tsx +151 -0
  67. package/src/components/TabView/TabViewItem.js +11 -0
  68. package/src/components/TabView/TabViewItem.tsx +25 -0
  69. package/src/components/TabView/index.js +2 -0
  70. package/src/components/TabView/index.tsx +2 -0
  71. package/src/index.js +1 -0
  72. package/src/index.tsx +2 -0
  73. package/src/mappings/TabView.js +76 -0
  74. package/src/mappings/TabView.ts +86 -0
  75. package/src/mappings/TabViewItem.js +30 -0
  76. package/src/mappings/TabViewItem.ts +38 -0
  77. package/lib/commonjs/mappings/HtmlElements.js +0 -177
  78. package/lib/module/mappings/HtmlElements.js +0 -170
  79. package/lib/typescript/src/mappings/HtmlElements.d.ts +0 -77
  80. package/lib/typescript/src/mappings/HtmlElements.d.ts.map +0 -1
  81. package/src/mappings/HtmlElements.js +0 -193
  82. package/src/mappings/HtmlElements.ts +0 -207
@@ -0,0 +1,70 @@
1
+ import { COMPONENT_TYPES, createTextEnumProp, createColorProp, StylesPanelSections, Triggers, createActionProp, createStaticBoolProp, GROUPS } from "@draftbit/types";
2
+ export const SEED_DATA = {
3
+ name: "Tab View",
4
+ tag: "TabView",
5
+ description: "Tab view container",
6
+ category: COMPONENT_TYPES.swiper,
7
+ stylesPanelSections: [StylesPanelSections.Size, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position, StylesPanelSections.Effects, StylesPanelSections.LayoutSelectedItem, StylesPanelSections.Background, StylesPanelSections.Typography],
8
+ layout: {
9
+ flex: 1
10
+ },
11
+ triggers: [Triggers.OnIndexChanged, Triggers.OnEndReached],
12
+ props: {
13
+ onIndexChanged: createActionProp({
14
+ label: "On index changed",
15
+ description: "Action to execute when swipe to new index"
16
+ }),
17
+ onEndReached: createActionProp({
18
+ label: "On end reached",
19
+ description: "Action to execute when end of swiping reached"
20
+ }),
21
+ tabBarPosition: createTextEnumProp({
22
+ label: "Tab Bar Position",
23
+ description: "Position of tab bar",
24
+ options: ["top", "bottom"],
25
+ defaultValue: "top"
26
+ }),
27
+ keyboardDismissMode: createTextEnumProp({
28
+ label: "Keyboard Dismiss Mode",
29
+ description: "Keyboard Dismiss Mode",
30
+ options: ["auto", "on-drag", "none"],
31
+ defaultValue: "auto"
32
+ }),
33
+ swipeEnabled: createStaticBoolProp({
34
+ label: "Swipe Enabled",
35
+ description: "Whether swiping is enabled or not",
36
+ defaultValue: true
37
+ }),
38
+ scrollEnabled: createStaticBoolProp({
39
+ label: "Tab Scroll Enabled",
40
+ description: "Whether scrolling of tabs is enabled or not",
41
+ defaultValue: false
42
+ }),
43
+ activeColor: createColorProp({
44
+ label: "Active Color",
45
+ description: "Color of icon and text of active tab",
46
+ defaultValue: "primary"
47
+ }),
48
+ inactiveColor: createColorProp({
49
+ label: "Inactive Color",
50
+ description: "Color of icon and text of inactive tab(s)",
51
+ defaultValue: null
52
+ }),
53
+ pressColor: createColorProp({
54
+ label: "Press Color",
55
+ description: "Color of ripple when pressed",
56
+ defaultValue: "primary",
57
+ group: GROUPS.android
58
+ }),
59
+ indicatorColor: createColorProp({
60
+ label: "Indicator Color",
61
+ description: "Color of indicator",
62
+ defaultValue: "primary"
63
+ }),
64
+ tabsBackgroundColor: createColorProp({
65
+ label: "Tabs Background Color",
66
+ description: "Background color of tabs container",
67
+ defaultValue: "background"
68
+ })
69
+ }
70
+ };
@@ -0,0 +1,30 @@
1
+ import { COMPONENT_TYPES, createTextProp, createIconProp, CONTAINER_COMPONENT_STYLES_SECTIONS, GROUPS } from "@draftbit/types";
2
+ export const SEED_DATA = {
3
+ name: "Tab View Item",
4
+ tag: "TabViewItem",
5
+ description: "Single Tab View item to be used in TabView. Each item represents a single tab and its content",
6
+ category: COMPONENT_TYPES.swiper,
7
+ stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
8
+ layout: {
9
+ flex: 1
10
+ },
11
+ props: {
12
+ title: createTextProp({
13
+ label: "Title",
14
+ description: "Title of tab item",
15
+ defaultValue: "Title",
16
+ required: true,
17
+ group: GROUPS.basic
18
+ }),
19
+ icon: createIconProp({
20
+ defaultValue: null,
21
+ required: false
22
+ }),
23
+ accessibilityLabel: createTextProp({
24
+ label: "Accessibility Label",
25
+ description: "Accessibility Label",
26
+ defaultValue: null,
27
+ group: GROUPS.accessibility
28
+ })
29
+ }
30
+ };
@@ -0,0 +1,26 @@
1
+ import * as React from "react";
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ import type { IconSlot } from "../../interfaces/Icon";
4
+ import type { Theme } from "../../styles/DefaultTheme";
5
+ declare type TabBarPosition = "top" | "bottom";
6
+ declare type KeyboardDismissMode = "none" | "auto" | "on-drag";
7
+ declare type TabViewProps = {
8
+ onIndexChanged?: (index: number) => void;
9
+ onEndReached?: () => void;
10
+ tabBarPosition?: TabBarPosition;
11
+ keyboardDismissMode?: KeyboardDismissMode;
12
+ swipeEnabled?: boolean;
13
+ scrollEnabled?: boolean;
14
+ activeColor?: string;
15
+ inactiveColor?: string;
16
+ pressColor?: string;
17
+ indicatorColor?: string;
18
+ tabsBackgroundColor?: string;
19
+ style?: StyleProp<ViewStyle>;
20
+ theme: Theme;
21
+ } & IconSlot;
22
+ declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<React.PropsWithChildren<TabViewProps>, "theme"> & {
23
+ theme?: import("@draftbit/react-theme-provider").$DeepPartial<any> | undefined;
24
+ }> & import("@draftbit/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<React.PropsWithChildren<TabViewProps>> & React.FC<React.PropsWithChildren<TabViewProps>>, {}>;
25
+ export default _default;
26
+ //# sourceMappingURL=TabView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TabView.d.ts","sourceRoot":"","sources":["../../../../../src/components/TabView/TabView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAc,MAAM,cAAc,CAAC;AAWhE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAMvD,aAAK,cAAc,GAAG,KAAK,GAAG,QAAQ,CAAC;AACvC,aAAK,mBAAmB,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAEvD,aAAK,YAAY,GAAG;IAClB,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,KAAK,EAAE,KAAK,CAAC;CACd,GAAG,QAAQ,CAAC;;;;AAiHb,wBAA2C"}
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ export interface TabViewItemProps {
4
+ title: string;
5
+ icon?: string;
6
+ accessibilityLabel?: string;
7
+ style?: StyleProp<ViewStyle>;
8
+ }
9
+ declare const TabViewItem: React.FC<React.PropsWithChildren<TabViewItemProps>>;
10
+ export default TabViewItem;
11
+ //# sourceMappingURL=TabViewItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TabViewItem.d.ts","sourceRoot":"","sources":["../../../../../src/components/TabView/TabViewItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAoB,MAAM,cAAc,CAAC;AAGtE,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAKpE,CAAC;AAQF,eAAe,WAAW,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default as TabView } from "./TabView";
2
+ export { default as TabViewItem } from "./TabViewItem";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/TabView/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC"}
@@ -32,6 +32,7 @@ export { Swiper, SwiperItem } from "./components/Swiper";
32
32
  export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
33
33
  export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
34
34
  export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
35
+ export { TabView, TabViewItem } from "./components/TabView";
35
36
  export { default as DatePicker } from "./components/DatePicker/DatePicker";
36
37
  export { default as Picker } from "./components/Picker/Picker";
37
38
  export { default as ProgressBar } from "./components/ProgressBar";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,O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qBAAqB,GACtB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAErE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAG5D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,126 @@
1
+ export declare const SEED_DATA: {
2
+ name: string;
3
+ tag: string;
4
+ description: string;
5
+ category: string;
6
+ stylesPanelSections: string[];
7
+ layout: {
8
+ flex: number;
9
+ };
10
+ triggers: string[];
11
+ props: {
12
+ onIndexChanged: {
13
+ label: string;
14
+ description: string;
15
+ editable: boolean;
16
+ required: boolean;
17
+ formType: string;
18
+ propType: string;
19
+ defaultValue: null;
20
+ group: string;
21
+ };
22
+ onEndReached: {
23
+ label: string;
24
+ description: string;
25
+ editable: boolean;
26
+ required: boolean;
27
+ formType: string;
28
+ propType: string;
29
+ defaultValue: null;
30
+ group: string;
31
+ };
32
+ tabBarPosition: {
33
+ group: string;
34
+ label: string;
35
+ description: string;
36
+ editable: boolean;
37
+ required: boolean;
38
+ formType: string;
39
+ propType: string;
40
+ defaultValue: null;
41
+ options: never[];
42
+ };
43
+ keyboardDismissMode: {
44
+ group: string;
45
+ label: string;
46
+ description: string;
47
+ editable: boolean;
48
+ required: boolean;
49
+ formType: string;
50
+ propType: string;
51
+ defaultValue: null;
52
+ options: never[];
53
+ };
54
+ swipeEnabled: {
55
+ label: string;
56
+ description: string;
57
+ formType: string;
58
+ propType: string;
59
+ defaultValue: boolean;
60
+ editable: boolean;
61
+ required: boolean;
62
+ group: string;
63
+ };
64
+ scrollEnabled: {
65
+ label: string;
66
+ description: string;
67
+ formType: string;
68
+ propType: string;
69
+ defaultValue: boolean;
70
+ editable: boolean;
71
+ required: boolean;
72
+ group: string;
73
+ };
74
+ activeColor: {
75
+ group: string;
76
+ label: string;
77
+ description: string;
78
+ editable: boolean;
79
+ required: boolean;
80
+ defaultValue: null;
81
+ formType: string;
82
+ propType: string;
83
+ };
84
+ inactiveColor: {
85
+ group: string;
86
+ label: string;
87
+ description: string;
88
+ editable: boolean;
89
+ required: boolean;
90
+ defaultValue: null;
91
+ formType: string;
92
+ propType: string;
93
+ };
94
+ pressColor: {
95
+ group: string;
96
+ label: string;
97
+ description: string;
98
+ editable: boolean;
99
+ required: boolean;
100
+ defaultValue: null;
101
+ formType: string;
102
+ propType: string;
103
+ };
104
+ indicatorColor: {
105
+ group: string;
106
+ label: string;
107
+ description: string;
108
+ editable: boolean;
109
+ required: boolean;
110
+ defaultValue: null;
111
+ formType: string;
112
+ propType: string;
113
+ };
114
+ tabsBackgroundColor: {
115
+ group: string;
116
+ label: string;
117
+ description: string;
118
+ editable: boolean;
119
+ required: boolean;
120
+ defaultValue: null;
121
+ formType: string;
122
+ propType: string;
123
+ };
124
+ };
125
+ };
126
+ //# sourceMappingURL=TabView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TabView.d.ts","sourceRoot":"","sources":["../../../../src/mappings/TabView.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0ErB,CAAC"}
@@ -0,0 +1,25 @@
1
+ export declare const SEED_DATA: {
2
+ name: string;
3
+ tag: string;
4
+ description: string;
5
+ category: string;
6
+ stylesPanelSections: string[];
7
+ layout: {
8
+ flex: number;
9
+ };
10
+ props: {
11
+ title: any;
12
+ icon: {
13
+ label: string;
14
+ description: string;
15
+ formType: string;
16
+ propType: string;
17
+ defaultValue: string;
18
+ required: boolean;
19
+ editable: boolean;
20
+ group: string;
21
+ };
22
+ accessibilityLabel: any;
23
+ };
24
+ };
25
+ //# sourceMappingURL=TabViewItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TabViewItem.d.ts","sourceRoot":"","sources":["../../../../src/mappings/TabViewItem.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;CA6BrB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "46.8.2-088bf8.2+088bf87",
3
+ "version": "46.8.2-0a0db3.2+0a0db3b",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -41,8 +41,7 @@
41
41
  "dependencies": {
42
42
  "@date-io/date-fns": "^1.3.13",
43
43
  "@draftbit/react-theme-provider": "^2.1.1",
44
- "@draftbit/types": "^46.8.2-088bf8.2+088bf87",
45
- "@expo/html-elements": "^0.3.1",
44
+ "@draftbit/types": "^46.8.2-0a0db3.2+0a0db3b",
46
45
  "@material-ui/core": "^4.11.0",
47
46
  "@material-ui/pickers": "^3.2.10",
48
47
  "@react-native-community/slider": "4.2.3",
@@ -56,7 +55,9 @@
56
55
  "lodash.tonumber": "^4.0.3",
57
56
  "react-native-deck-swiper": "^2.0.12",
58
57
  "react-native-modal-datetime-picker": "^13.0.0",
58
+ "react-native-pager-view": "5.4.24",
59
59
  "react-native-svg": "12.3.0",
60
+ "react-native-tab-view": "^3.4.0",
60
61
  "react-native-typography": "^1.4.1",
61
62
  "react-native-web-swiper": "^2.2.3"
62
63
  },
@@ -93,5 +94,5 @@
93
94
  ]
94
95
  ]
95
96
  },
96
- "gitHead": "088bf87109989ec13afa5a6b64d29314afdc8caa"
97
+ "gitHead": "0a0db3be11947a0ea8b922d741a9c2604a0e6748"
97
98
  }
@@ -0,0 +1,58 @@
1
+ import * as React from "react";
2
+ import { StyleSheet } from "react-native";
3
+ import { TabView, TabBar, SceneMap, } from "react-native-tab-view";
4
+ import { withTheme } from "../../theming";
5
+ import { extractStyles } from "../../utilities";
6
+ const TabViewComponent = ({ Icon, onIndexChanged, onEndReached, tabBarPosition, keyboardDismissMode, swipeEnabled, scrollEnabled, activeColor, inactiveColor, pressColor, indicatorColor, tabsBackgroundColor, style, theme, children, }) => {
7
+ const [index, setIndex] = React.useState(0);
8
+ const [routes, setRoutes] = React.useState([]);
9
+ const [tabScenes, setTabScenes] = React.useState({});
10
+ const { textStyles, viewStyles } = extractStyles(style);
11
+ //Check type of child using props
12
+ //Regular '.type' cannot work because Draftbit strips the type in Draft view
13
+ const instanceOfTabViewItemProps = (object) => {
14
+ return "title" in object;
15
+ };
16
+ //Populate routes and scenes based on children
17
+ React.useEffect(() => {
18
+ const newRoutes = [];
19
+ const scenes = {};
20
+ React.Children.toArray(children)
21
+ .filter((child) => React.isValidElement(child) && instanceOfTabViewItemProps(child.props))
22
+ .forEach((item, idx) => {
23
+ const child = item;
24
+ newRoutes.push({
25
+ key: idx.toString(),
26
+ title: child.props.title,
27
+ icon: child.props.icon,
28
+ accessibilityLabel: child.props.accessibilityLabel,
29
+ });
30
+ scenes[idx] = () => child;
31
+ });
32
+ setRoutes(newRoutes);
33
+ setTabScenes(scenes);
34
+ }, [children]);
35
+ const indexChangeHandler = (i) => {
36
+ setIndex(i);
37
+ onIndexChanged === null || onIndexChanged === void 0 ? void 0 : onIndexChanged(i);
38
+ if (i === routes.length) {
39
+ onEndReached === null || onEndReached === void 0 ? void 0 : onEndReached();
40
+ }
41
+ };
42
+ const renderTabBar = (props) => {
43
+ return (React.createElement(TabBar, { ...props, activeColor: activeColor || theme.colors.primary, inactiveColor: inactiveColor || theme.colors.divider, pressColor: pressColor || theme.colors.primary, scrollEnabled: scrollEnabled, indicatorStyle: {
44
+ backgroundColor: indicatorColor || theme.colors.primary,
45
+ }, labelStyle: textStyles, renderIcon: ({ route, color }) => (route === null || route === void 0 ? void 0 : route.icon) ? (React.createElement(Icon, { name: route.icon, color: color, size: 16 })) : null, style: {
46
+ backgroundColor: tabsBackgroundColor || theme.colors.background,
47
+ } }));
48
+ };
49
+ //Cannot render TabView without at least one tab
50
+ if (!routes.length) {
51
+ return React.createElement(React.Fragment, null);
52
+ }
53
+ return (React.createElement(TabView, { style: [styles.tabView, viewStyles], navigationState: { index, routes }, renderScene: SceneMap(tabScenes), renderTabBar: renderTabBar, onIndexChange: indexChangeHandler, tabBarPosition: tabBarPosition, keyboardDismissMode: keyboardDismissMode, swipeEnabled: swipeEnabled }));
54
+ };
55
+ const styles = StyleSheet.create({
56
+ tabView: { flex: 1 },
57
+ });
58
+ export default withTheme(TabViewComponent);
@@ -0,0 +1,151 @@
1
+ import * as React from "react";
2
+ import { StyleProp, ViewStyle, StyleSheet } from "react-native";
3
+ import {
4
+ TabView,
5
+ TabBar,
6
+ SceneMap,
7
+ SceneRendererProps,
8
+ NavigationState,
9
+ Route,
10
+ } from "react-native-tab-view";
11
+
12
+ import { TabViewItemProps } from "./TabViewItem";
13
+ import type { IconSlot } from "../../interfaces/Icon";
14
+ import { withTheme } from "../../theming";
15
+ import type { Theme } from "../../styles/DefaultTheme";
16
+ import { extractStyles } from "../../utilities";
17
+
18
+ type TabBarProps = SceneRendererProps & {
19
+ navigationState: NavigationState<any>;
20
+ };
21
+ type TabBarPosition = "top" | "bottom";
22
+ type KeyboardDismissMode = "none" | "auto" | "on-drag";
23
+
24
+ type TabViewProps = {
25
+ onIndexChanged?: (index: number) => void;
26
+ onEndReached?: () => void;
27
+ tabBarPosition?: TabBarPosition;
28
+ keyboardDismissMode?: KeyboardDismissMode;
29
+ swipeEnabled?: boolean;
30
+ scrollEnabled?: boolean;
31
+ activeColor?: string;
32
+ inactiveColor?: string;
33
+ pressColor?: string;
34
+ indicatorColor?: string;
35
+ tabsBackgroundColor?: string;
36
+ style?: StyleProp<ViewStyle>;
37
+ theme: Theme;
38
+ } & IconSlot;
39
+
40
+ const TabViewComponent: React.FC<React.PropsWithChildren<TabViewProps>> = ({
41
+ Icon,
42
+ onIndexChanged,
43
+ onEndReached,
44
+ tabBarPosition,
45
+ keyboardDismissMode,
46
+ swipeEnabled,
47
+ scrollEnabled,
48
+ activeColor,
49
+ inactiveColor,
50
+ pressColor,
51
+ indicatorColor,
52
+ tabsBackgroundColor,
53
+ style,
54
+ theme,
55
+ children,
56
+ }) => {
57
+ const [index, setIndex] = React.useState(0);
58
+ const [routes, setRoutes] = React.useState<Route[]>([]);
59
+ const [tabScenes, setTabScenes] = React.useState({});
60
+
61
+ const { textStyles, viewStyles } = extractStyles(style);
62
+
63
+ //Check type of child using props
64
+ //Regular '.type' cannot work because Draftbit strips the type in Draft view
65
+ const instanceOfTabViewItemProps = (
66
+ object: any
67
+ ): object is TabViewItemProps => {
68
+ return "title" in object;
69
+ };
70
+
71
+ //Populate routes and scenes based on children
72
+ React.useEffect(() => {
73
+ const newRoutes: Route[] = [];
74
+ const scenes: any = {};
75
+
76
+ React.Children.toArray(children)
77
+ .filter(
78
+ (child) =>
79
+ React.isValidElement(child) && instanceOfTabViewItemProps(child.props)
80
+ )
81
+ .forEach((item: any, idx) => {
82
+ const child = item as React.ReactElement;
83
+ newRoutes.push({
84
+ key: idx.toString(),
85
+ title: child.props.title,
86
+ icon: child.props.icon,
87
+ accessibilityLabel: child.props.accessibilityLabel,
88
+ });
89
+ scenes[idx] = () => child;
90
+ });
91
+
92
+ setRoutes(newRoutes);
93
+ setTabScenes(scenes);
94
+ }, [children]);
95
+
96
+ const indexChangeHandler = (i: number) => {
97
+ setIndex(i);
98
+ onIndexChanged?.(i);
99
+ if (i === routes.length) {
100
+ onEndReached?.();
101
+ }
102
+ };
103
+
104
+ const renderTabBar: React.FC<TabBarProps> = (props) => {
105
+ return (
106
+ <TabBar
107
+ {...props}
108
+ activeColor={activeColor || theme.colors.primary}
109
+ inactiveColor={inactiveColor || theme.colors.divider}
110
+ pressColor={pressColor || theme.colors.primary}
111
+ scrollEnabled={scrollEnabled}
112
+ indicatorStyle={{
113
+ backgroundColor: indicatorColor || theme.colors.primary,
114
+ }}
115
+ labelStyle={textStyles}
116
+ renderIcon={({ route, color }) =>
117
+ route?.icon ? (
118
+ <Icon name={route.icon} color={color} size={16} />
119
+ ) : null
120
+ }
121
+ style={{
122
+ backgroundColor: tabsBackgroundColor || theme.colors.background,
123
+ }}
124
+ />
125
+ );
126
+ };
127
+
128
+ //Cannot render TabView without at least one tab
129
+ if (!routes.length) {
130
+ return <></>;
131
+ }
132
+
133
+ return (
134
+ <TabView
135
+ style={[styles.tabView, viewStyles]}
136
+ navigationState={{ index, routes }}
137
+ renderScene={SceneMap(tabScenes)}
138
+ renderTabBar={renderTabBar}
139
+ onIndexChange={indexChangeHandler}
140
+ tabBarPosition={tabBarPosition}
141
+ keyboardDismissMode={keyboardDismissMode}
142
+ swipeEnabled={swipeEnabled}
143
+ />
144
+ );
145
+ };
146
+
147
+ const styles = StyleSheet.create({
148
+ tabView: { flex: 1 },
149
+ });
150
+
151
+ export default withTheme(TabViewComponent);
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import { StyleSheet, View } from "react-native";
3
+ const TabViewItem = ({ style, children, }) => {
4
+ return React.createElement(View, { style: [styles.parentContainer, style] }, children);
5
+ };
6
+ const styles = StyleSheet.create({
7
+ parentContainer: {
8
+ flex: 1,
9
+ },
10
+ });
11
+ export default TabViewItem;
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import { StyleProp, ViewStyle, StyleSheet, View } from "react-native";
3
+
4
+ //Props used by parent (TabView) to create tabs
5
+ export interface TabViewItemProps {
6
+ title: string;
7
+ icon?: string;
8
+ accessibilityLabel?: string;
9
+ style?: StyleProp<ViewStyle>;
10
+ }
11
+
12
+ const TabViewItem: React.FC<React.PropsWithChildren<TabViewItemProps>> = ({
13
+ style,
14
+ children,
15
+ }) => {
16
+ return <View style={[styles.parentContainer, style]}>{children}</View>;
17
+ };
18
+
19
+ const styles = StyleSheet.create({
20
+ parentContainer: {
21
+ flex: 1,
22
+ },
23
+ });
24
+
25
+ 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
@@ -32,6 +32,7 @@ export { Swiper, SwiperItem } from "./components/Swiper";
32
32
  export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
33
33
  export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
34
34
  export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
35
+ export { TabView, TabViewItem } from "./components/TabView";
35
36
  /* Deprecated: Fix or Delete! */
36
37
  export { default as DatePicker } from "./components/DatePicker/DatePicker";
37
38
  export { default as Picker } from "./components/Picker/Picker";
package/src/index.tsx CHANGED
@@ -53,6 +53,8 @@ export {
53
53
 
54
54
  export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
55
55
 
56
+ export { TabView, TabViewItem } from "./components/TabView";
57
+
56
58
  /* Deprecated: Fix or Delete! */
57
59
  export { default as DatePicker } from "./components/DatePicker/DatePicker";
58
60
  export { default as Picker } from "./components/Picker/Picker";