@draftbit/core 46.7.9-13d0dd.2 → 46.7.9-3ec6a6.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 (65) hide show
  1. package/lib/commonjs/components/Accordion/AccordionItem.js +23 -4
  2. package/lib/commonjs/components/DatePicker/DatePicker.js +0 -6
  3. package/lib/commonjs/components/DeckSwiper/DeckSwiper.js +74 -0
  4. package/lib/commonjs/components/DeckSwiper/DeckSwiperCard.js +34 -0
  5. package/lib/commonjs/components/DeckSwiper/index.js +20 -0
  6. package/lib/commonjs/components/Divider.js +1 -14
  7. package/lib/commonjs/components/Elevation.js +2 -14
  8. package/lib/commonjs/components/Picker/Picker.js +1 -7
  9. package/lib/commonjs/index.js +13 -0
  10. package/lib/commonjs/mappings/DatePicker.js +1 -6
  11. package/lib/commonjs/mappings/DeckSwiper.js +55 -0
  12. package/lib/commonjs/mappings/DeckSwiperCard.js +23 -0
  13. package/lib/commonjs/mappings/Picker.js +0 -5
  14. package/lib/module/components/Accordion/AccordionItem.js +4 -25
  15. package/lib/module/components/DatePicker/DatePicker.js +1 -7
  16. package/lib/module/components/DeckSwiper/DeckSwiper.js +66 -0
  17. package/lib/module/components/DeckSwiper/DeckSwiperCard.js +26 -0
  18. package/lib/module/components/DeckSwiper/index.js +2 -0
  19. package/lib/module/components/Picker/Picker.js +2 -8
  20. package/lib/module/index.js +1 -0
  21. package/lib/module/mappings/DatePicker.js +2 -7
  22. package/lib/module/mappings/DeckSwiper.js +48 -0
  23. package/lib/module/mappings/DeckSwiperCard.js +16 -0
  24. package/lib/module/mappings/Picker.js +1 -6
  25. package/lib/typescript/src/components/DatePicker/DatePicker.d.ts +0 -1
  26. package/lib/typescript/src/components/DatePicker/DatePicker.d.ts.map +1 -1
  27. package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts +15 -0
  28. package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts.map +1 -0
  29. package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.d.ts +13 -0
  30. package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.d.ts.map +1 -0
  31. package/lib/typescript/src/components/DeckSwiper/index.d.ts +3 -0
  32. package/lib/typescript/src/components/DeckSwiper/index.d.ts.map +1 -0
  33. package/lib/typescript/src/components/Picker/Picker.d.ts +0 -1
  34. package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
  35. package/lib/typescript/src/index.d.ts +1 -0
  36. package/lib/typescript/src/index.d.ts.map +1 -1
  37. package/lib/typescript/src/mappings/DatePicker.d.ts +0 -10
  38. package/lib/typescript/src/mappings/DatePicker.d.ts.map +1 -1
  39. package/lib/typescript/src/mappings/DeckSwiper.d.ts +86 -0
  40. package/lib/typescript/src/mappings/DeckSwiper.d.ts.map +1 -0
  41. package/lib/typescript/src/mappings/DeckSwiperCard.d.ts +16 -0
  42. package/lib/typescript/src/mappings/DeckSwiperCard.d.ts.map +1 -0
  43. package/lib/typescript/src/mappings/Picker.d.ts +0 -10
  44. package/lib/typescript/src/mappings/Picker.d.ts.map +1 -1
  45. package/package.json +4 -3
  46. package/src/components/DatePicker/DatePicker.js +2 -7
  47. package/src/components/DatePicker/DatePicker.tsx +0 -9
  48. package/src/components/DeckSwiper/DeckSwiper.js +35 -0
  49. package/src/components/DeckSwiper/DeckSwiper.tsx +94 -0
  50. package/src/components/DeckSwiper/DeckSwiperCard.js +21 -0
  51. package/src/components/DeckSwiper/DeckSwiperCard.tsx +41 -0
  52. package/src/components/DeckSwiper/index.js +2 -0
  53. package/src/components/DeckSwiper/index.tsx +2 -0
  54. package/src/components/Picker/Picker.js +2 -7
  55. package/src/components/Picker/Picker.tsx +0 -9
  56. package/src/index.js +1 -0
  57. package/src/index.tsx +2 -0
  58. package/src/mappings/DatePicker.js +1 -6
  59. package/src/mappings/DatePicker.ts +0 -6
  60. package/src/mappings/DeckSwiper.js +48 -0
  61. package/src/mappings/DeckSwiper.ts +57 -0
  62. package/src/mappings/DeckSwiperCard.js +16 -0
  63. package/src/mappings/DeckSwiperCard.ts +20 -0
  64. package/src/mappings/Picker.js +1 -6
  65. package/src/mappings/Picker.ts +0 -6
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { View, StyleSheet, Text, Platform, Dimensions, Keyboard, } from "react-native";
2
+ import { View, StyleSheet, Text, Platform, Dimensions, } from "react-native";
3
3
  import { omit, pickBy, identity, isObject } from "lodash";
4
4
  import { SafeAreaView } from "react-native-safe-area-context";
5
5
  import { Picker as NativePicker } from "@react-native-picker/picker";
@@ -35,7 +35,7 @@ const isIos = Platform.OS === "ios";
35
35
  const unstyledColor = "rgba(165, 173, 183, 1)";
36
36
  const disabledColor = "rgb(240, 240, 240)";
37
37
  const errorColor = "rgba(255, 69, 100, 1)";
38
- const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style, placeholder, value, disabled = false, assistiveText, label, iconColor = unstyledColor, iconSize = 24, leftIconMode = "inset", leftIconName, placeholderTextColor = unstyledColor, rightIconName, type = "solid", autoDismissKeyboard = true, }) => {
38
+ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style, placeholder, value, disabled = false, assistiveText, label, iconColor = unstyledColor, iconSize = 24, leftIconMode = "inset", leftIconName, placeholderTextColor = unstyledColor, rightIconName, type = "solid", }) => {
39
39
  var _a, _b;
40
40
  const androidPickerRef = React.useRef(undefined);
41
41
  const [internalValue, setInternalValue] = React.useState(value || defaultValue);
@@ -59,11 +59,6 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
59
59
  (_a = androidPickerRef === null || androidPickerRef === void 0 ? void 0 : androidPickerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
60
60
  }
61
61
  }, [pickerVisible, androidPickerRef]);
62
- React.useEffect(() => {
63
- if (pickerVisible && autoDismissKeyboard) {
64
- Keyboard.dismiss();
65
- }
66
- }, [pickerVisible, autoDismissKeyboard]);
67
62
  const normalizedOptions = normalizeOptions(options);
68
63
  const pickerOptions = placeholder
69
64
  ? [{ value: placeholder, label: placeholder }, ...normalizedOptions]
@@ -7,7 +7,6 @@ import {
7
7
  ViewStyle,
8
8
  StyleProp,
9
9
  Dimensions,
10
- Keyboard,
11
10
  } from "react-native";
12
11
  import { omit, pickBy, identity, isObject } from "lodash";
13
12
  import { SafeAreaView } from "react-native-safe-area-context";
@@ -49,7 +48,6 @@ export type PickerProps = {
49
48
  placeholderTextColor?: string;
50
49
  rightIconName?: string;
51
50
  type?: "solid" | "underline";
52
- autoDismissKeyboard?: boolean;
53
51
  theme: Theme;
54
52
  Icon: IconSlot["Icon"];
55
53
  };
@@ -109,7 +107,6 @@ const Picker: React.FC<PickerProps> = ({
109
107
  placeholderTextColor = unstyledColor,
110
108
  rightIconName,
111
109
  type = "solid",
112
- autoDismissKeyboard = true,
113
110
  }) => {
114
111
  const androidPickerRef = React.useRef<any | undefined>(undefined);
115
112
 
@@ -141,12 +138,6 @@ const Picker: React.FC<PickerProps> = ({
141
138
  }
142
139
  }, [pickerVisible, androidPickerRef]);
143
140
 
144
- React.useEffect(() => {
145
- if (pickerVisible && autoDismissKeyboard) {
146
- Keyboard.dismiss();
147
- }
148
- }, [pickerVisible, autoDismissKeyboard]);
149
-
150
141
  const normalizedOptions = normalizeOptions(options);
151
142
 
152
143
  const pickerOptions = placeholder
package/src/index.js CHANGED
@@ -31,6 +31,7 @@ export { ActionSheet, ActionSheetItem, ActionSheetCancel, } from "./components/A
31
31
  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
+ export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
34
35
  /* Deprecated: Fix or Delete! */
35
36
  export { default as DatePicker } from "./components/DatePicker/DatePicker";
36
37
  export { default as Picker } from "./components/Picker/Picker";
package/src/index.tsx CHANGED
@@ -51,6 +51,8 @@ export {
51
51
  RadioButtonFieldGroup,
52
52
  } from "./components/RadioButton/index";
53
53
 
54
+ export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
55
+
54
56
  /* Deprecated: Fix or Delete! */
55
57
  export { default as DatePicker } from "./components/DatePicker/DatePicker";
56
58
  export { default as Picker } from "./components/Picker/Picker";
@@ -1,4 +1,4 @@
1
- import { COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, GROUPS, Triggers, StylesPanelSections, createNumberProp, createColorProp, createStaticBoolProp, } from "@draftbit/types";
1
+ import { COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, GROUPS, Triggers, StylesPanelSections, createNumberProp, createColorProp, } from "@draftbit/types";
2
2
  const SEED_DATA_PROPS = {
3
3
  mode: {
4
4
  label: "Mode",
@@ -171,11 +171,6 @@ export const SEED_DATA = [
171
171
  required: true,
172
172
  group: GROUPS.basic,
173
173
  },
174
- autoDismissKeyboard: createStaticBoolProp({
175
- label: "Auto dismiss keyboard",
176
- description: "Automatically dismiss keyboard when DatePicker is opened",
177
- defaultValue: true,
178
- }),
179
174
  },
180
175
  },
181
176
  ];
@@ -8,7 +8,6 @@ import {
8
8
  StylesPanelSections,
9
9
  createNumberProp,
10
10
  createColorProp,
11
- createStaticBoolProp,
12
11
  } from "@draftbit/types";
13
12
 
14
13
  const SEED_DATA_PROPS = {
@@ -186,11 +185,6 @@ export const SEED_DATA = [
186
185
  required: true,
187
186
  group: GROUPS.basic,
188
187
  },
189
- autoDismissKeyboard: createStaticBoolProp({
190
- label: "Auto dismiss keyboard",
191
- description: "Automatically dismiss keyboard when DatePicker is opened",
192
- defaultValue: true,
193
- }),
194
188
  },
195
189
  },
196
190
  ];
@@ -0,0 +1,48 @@
1
+ import { COMPONENT_TYPES, Triggers, createActionProp, createStaticNumberProp, createStaticBoolProp, BLOCK_STYLES_SECTIONS, } from "@draftbit/types";
2
+ export const SEED_DATA = {
3
+ name: "Deck Swiper",
4
+ tag: "DeckSwiper",
5
+ description: "Deck swiper container",
6
+ category: COMPONENT_TYPES.swiper,
7
+ stylesPanelSections: BLOCK_STYLES_SECTIONS,
8
+ layout: {
9
+ width: "100%",
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
+ startCardIndex: createStaticNumberProp({
22
+ label: "Start card index",
23
+ description: "Index of card to start swiping from",
24
+ defaultValue: 0,
25
+ }),
26
+ infiniteSwiping: createStaticBoolProp({
27
+ label: "Infinite swiping",
28
+ description: "Whether to infinitley loop through cards or not",
29
+ }),
30
+ verticalEnabled: createStaticBoolProp({
31
+ label: "Vertical swipe enabled",
32
+ description: "Whether cards should be swipeable vertically or not",
33
+ defaultValue: true,
34
+ }),
35
+ horizontalEnabled: createStaticBoolProp({
36
+ label: "Horizontal swipe enabled",
37
+ description: "Whether cards should be swipeable horizontally or not",
38
+ defaultValue: true,
39
+ }),
40
+ visibleCardCount: createStaticNumberProp({
41
+ label: "Visible card count",
42
+ description: "Number of cards visible behind (and including) the current card",
43
+ defaultValue: 1,
44
+ min: 1,
45
+ step: 1,
46
+ }),
47
+ },
48
+ };
@@ -0,0 +1,57 @@
1
+ import {
2
+ COMPONENT_TYPES,
3
+ Triggers,
4
+ createActionProp,
5
+ createStaticNumberProp,
6
+ createStaticBoolProp,
7
+ BLOCK_STYLES_SECTIONS,
8
+ } from "@draftbit/types";
9
+
10
+ export const SEED_DATA = {
11
+ name: "Deck Swiper",
12
+ tag: "DeckSwiper",
13
+ description: "Deck swiper container",
14
+ category: COMPONENT_TYPES.swiper,
15
+ stylesPanelSections: BLOCK_STYLES_SECTIONS,
16
+ layout: {
17
+ width: "100%",
18
+ },
19
+ triggers: [Triggers.OnIndexChanged, Triggers.OnEndReached],
20
+ props: {
21
+ onIndexChanged: createActionProp({
22
+ label: "On index changed",
23
+ description: "Action to execute when swipe to new index",
24
+ }),
25
+ onEndReached: createActionProp({
26
+ label: "On end reached",
27
+ description: "Action to execute when end of swiping reached",
28
+ }),
29
+ startCardIndex: createStaticNumberProp({
30
+ label: "Start card index",
31
+ description: "Index of card to start swiping from",
32
+ defaultValue: 0,
33
+ }),
34
+ infiniteSwiping: createStaticBoolProp({
35
+ label: "Infinite swiping",
36
+ description: "Whether to infinitley loop through cards or not",
37
+ }),
38
+ verticalEnabled: createStaticBoolProp({
39
+ label: "Vertical swipe enabled",
40
+ description: "Whether cards should be swipeable vertically or not",
41
+ defaultValue: true,
42
+ }),
43
+ horizontalEnabled: createStaticBoolProp({
44
+ label: "Horizontal swipe enabled",
45
+ description: "Whether cards should be swipeable horizontally or not",
46
+ defaultValue: true,
47
+ }),
48
+ visibleCardCount: createStaticNumberProp({
49
+ label: "Visible card count",
50
+ description:
51
+ "Number of cards visible behind (and including) the current card",
52
+ defaultValue: 1,
53
+ min: 1,
54
+ step: 1,
55
+ }),
56
+ },
57
+ };
@@ -0,0 +1,16 @@
1
+ import { COMPONENT_TYPES, CONTAINER_COMPONENT_STYLES_SECTIONS, } from "@draftbit/types";
2
+ export const SEED_DATA = {
3
+ name: "Deck Swiper Card",
4
+ tag: "DeckSwiperCard",
5
+ description: "Single Deck Swiper Card item to be used in DeckSwiper",
6
+ category: COMPONENT_TYPES.swiper,
7
+ stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
8
+ layout: {
9
+ flex: 1,
10
+ alignItems: "center",
11
+ justifyContent: "center",
12
+ padding: 20,
13
+ borderWidth: 2,
14
+ },
15
+ props: {},
16
+ };
@@ -0,0 +1,20 @@
1
+ import {
2
+ COMPONENT_TYPES,
3
+ CONTAINER_COMPONENT_STYLES_SECTIONS,
4
+ } from "@draftbit/types";
5
+
6
+ export const SEED_DATA = {
7
+ name: "Deck Swiper Card",
8
+ tag: "DeckSwiperCard",
9
+ description: "Single Deck Swiper Card item to be used in DeckSwiper",
10
+ category: COMPONENT_TYPES.swiper,
11
+ stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
12
+ layout: {
13
+ flex: 1,
14
+ alignItems: "center",
15
+ justifyContent: "center",
16
+ padding: 20,
17
+ borderWidth: 2,
18
+ },
19
+ props: {},
20
+ };
@@ -1,4 +1,4 @@
1
- import { COMPONENT_TYPES, Triggers, GROUPS, FORM_TYPES, PROP_TYPES, FIELD_NAME, createIconSizeProp, createColorProp, StylesPanelSections, createStaticBoolProp, } from "@draftbit/types";
1
+ import { COMPONENT_TYPES, Triggers, GROUPS, FORM_TYPES, PROP_TYPES, FIELD_NAME, createIconSizeProp, createColorProp, StylesPanelSections, } from "@draftbit/types";
2
2
  const SEED_DATA_PROPS = {
3
3
  label: {
4
4
  group: GROUPS.data,
@@ -142,11 +142,6 @@ export const SEED_DATA = [
142
142
  },
143
143
  iconSize: createIconSizeProp({ defaultValue: 24 }),
144
144
  iconColor: createColorProp({ label: "Icon Color" }),
145
- autoDismissKeyboard: createStaticBoolProp({
146
- label: "Auto dismiss keyboard",
147
- description: "Automatically dismiss keyboard when Picker is opened",
148
- defaultValue: true,
149
- }),
150
145
  },
151
146
  layout: {},
152
147
  },
@@ -8,7 +8,6 @@ import {
8
8
  createIconSizeProp,
9
9
  createColorProp,
10
10
  StylesPanelSections,
11
- createStaticBoolProp,
12
11
  } from "@draftbit/types";
13
12
 
14
13
  const SEED_DATA_PROPS = {
@@ -158,11 +157,6 @@ export const SEED_DATA = [
158
157
  },
159
158
  iconSize: createIconSizeProp({ defaultValue: 24 }),
160
159
  iconColor: createColorProp({ label: "Icon Color" }),
161
- autoDismissKeyboard: createStaticBoolProp({
162
- label: "Auto dismiss keyboard",
163
- description: "Automatically dismiss keyboard when Picker is opened",
164
- defaultValue: true,
165
- }),
166
160
  },
167
161
  layout: {},
168
162
  },