@draftbit/core 46.8.1-a386d4.2 → 46.8.1-ae3332.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 (122) hide show
  1. package/lib/commonjs/components/Accordion/AccordionItem.js +23 -4
  2. package/lib/commonjs/components/DeckSwiper/DeckSwiper.js +38 -4
  3. package/lib/commonjs/components/Picker/Picker.js +8 -9
  4. package/lib/commonjs/components/ScreenContainer.js +2 -1
  5. package/lib/commonjs/index.js +0 -7
  6. package/lib/commonjs/mappings/Accordion.js +1 -0
  7. package/lib/commonjs/mappings/AccordionItem.js +1 -0
  8. package/lib/commonjs/mappings/ActionSheet.js +1 -0
  9. package/lib/commonjs/mappings/ActionSheetCancel.js +1 -0
  10. package/lib/commonjs/mappings/ActionSheetItem.js +1 -0
  11. package/lib/commonjs/mappings/LinearGradient.js +1 -0
  12. package/lib/commonjs/mappings/MapCallout.js +1 -0
  13. package/lib/commonjs/mappings/MapMarker.js +1 -0
  14. package/lib/commonjs/mappings/MapView.js +1 -0
  15. package/lib/commonjs/mappings/Swiper.js +1 -0
  16. package/lib/commonjs/mappings/SwiperItem.js +2 -1
  17. package/lib/commonjs/mappings/TextArea.js +1 -0
  18. package/lib/commonjs/mappings/TextField.js +1 -0
  19. package/lib/module/components/DeckSwiper/DeckSwiper.js +38 -4
  20. package/lib/module/components/NumberInput.js +3 -11
  21. package/lib/module/components/Picker/Picker.js +8 -9
  22. package/lib/module/components/Picker/PickerComponent.ios.js +36 -11
  23. package/lib/module/components/Portal/PortalHost.js +45 -15
  24. package/lib/module/components/ScreenContainer.js +2 -1
  25. package/lib/module/components/Switch.js +21 -10
  26. package/lib/module/index.js +0 -1
  27. package/lib/module/mappings/Accordion.js +2 -1
  28. package/lib/module/mappings/AccordionItem.js +2 -1
  29. package/lib/module/mappings/ActionSheet.js +2 -1
  30. package/lib/module/mappings/ActionSheetCancel.js +2 -1
  31. package/lib/module/mappings/ActionSheetItem.js +2 -1
  32. package/lib/module/mappings/LinearGradient.js +2 -1
  33. package/lib/module/mappings/MapCallout.js +2 -1
  34. package/lib/module/mappings/MapMarker.js +2 -1
  35. package/lib/module/mappings/MapView.js +2 -1
  36. package/lib/module/mappings/Swiper.js +2 -1
  37. package/lib/module/mappings/SwiperItem.js +3 -2
  38. package/lib/module/mappings/TextArea.js +2 -1
  39. package/lib/module/mappings/TextField.js +1 -0
  40. package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts +8 -2
  41. package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts.map +1 -1
  42. package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.d.ts +2 -3
  43. package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.d.ts.map +1 -1
  44. package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
  45. package/lib/typescript/src/components/ScreenContainer.d.ts.map +1 -1
  46. package/lib/typescript/src/index.d.ts +0 -1
  47. package/lib/typescript/src/index.d.ts.map +1 -1
  48. package/lib/typescript/src/mappings/Accordion.d.ts +1 -0
  49. package/lib/typescript/src/mappings/Accordion.d.ts.map +1 -1
  50. package/lib/typescript/src/mappings/AccordionItem.d.ts +1 -0
  51. package/lib/typescript/src/mappings/AccordionItem.d.ts.map +1 -1
  52. package/lib/typescript/src/mappings/ActionSheet.d.ts +1 -0
  53. package/lib/typescript/src/mappings/ActionSheet.d.ts.map +1 -1
  54. package/lib/typescript/src/mappings/ActionSheetCancel.d.ts +1 -0
  55. package/lib/typescript/src/mappings/ActionSheetCancel.d.ts.map +1 -1
  56. package/lib/typescript/src/mappings/ActionSheetItem.d.ts +1 -0
  57. package/lib/typescript/src/mappings/ActionSheetItem.d.ts.map +1 -1
  58. package/lib/typescript/src/mappings/LinearGradient.d.ts +1 -0
  59. package/lib/typescript/src/mappings/LinearGradient.d.ts.map +1 -1
  60. package/lib/typescript/src/mappings/MapCallout.d.ts +1 -0
  61. package/lib/typescript/src/mappings/MapCallout.d.ts.map +1 -1
  62. package/lib/typescript/src/mappings/MapMarker.d.ts +1 -0
  63. package/lib/typescript/src/mappings/MapMarker.d.ts.map +1 -1
  64. package/lib/typescript/src/mappings/MapView.d.ts +1 -0
  65. package/lib/typescript/src/mappings/MapView.d.ts.map +1 -1
  66. package/lib/typescript/src/mappings/Swiper.d.ts +1 -0
  67. package/lib/typescript/src/mappings/Swiper.d.ts.map +1 -1
  68. package/lib/typescript/src/mappings/SwiperItem.d.ts +1 -0
  69. package/lib/typescript/src/mappings/SwiperItem.d.ts.map +1 -1
  70. package/lib/typescript/src/mappings/TextArea.d.ts +1 -0
  71. package/lib/typescript/src/mappings/TextArea.d.ts.map +1 -1
  72. package/lib/typescript/src/mappings/TextField.d.ts +1 -1
  73. package/lib/typescript/src/mappings/TextField.d.ts.map +1 -1
  74. package/package.json +3 -4
  75. package/src/components/DeckSwiper/DeckSwiper.js +33 -3
  76. package/src/components/DeckSwiper/DeckSwiper.tsx +51 -9
  77. package/src/components/DeckSwiper/DeckSwiperCard.js +1 -1
  78. package/src/components/DeckSwiper/DeckSwiperCard.tsx +3 -6
  79. package/src/components/Picker/Picker.js +7 -8
  80. package/src/components/Picker/Picker.tsx +7 -9
  81. package/src/components/ScreenContainer.js +2 -1
  82. package/src/components/ScreenContainer.tsx +2 -1
  83. package/src/index.js +0 -1
  84. package/src/index.tsx +0 -2
  85. package/src/mappings/Accordion.js +10 -1
  86. package/src/mappings/Accordion.ts +10 -0
  87. package/src/mappings/AccordionItem.js +2 -1
  88. package/src/mappings/AccordionItem.ts +2 -0
  89. package/src/mappings/ActionSheet.js +2 -1
  90. package/src/mappings/ActionSheet.ts +7 -1
  91. package/src/mappings/ActionSheetCancel.js +2 -1
  92. package/src/mappings/ActionSheetCancel.ts +2 -0
  93. package/src/mappings/ActionSheetItem.js +2 -1
  94. package/src/mappings/ActionSheetItem.ts +2 -0
  95. package/src/mappings/LinearGradient.js +6 -1
  96. package/src/mappings/LinearGradient.ts +6 -0
  97. package/src/mappings/MapCallout.js +2 -1
  98. package/src/mappings/MapCallout.ts +2 -0
  99. package/src/mappings/MapMarker.js +2 -1
  100. package/src/mappings/MapMarker.ts +2 -0
  101. package/src/mappings/MapView.js +2 -1
  102. package/src/mappings/MapView.ts +2 -0
  103. package/src/mappings/Swiper.js +10 -1
  104. package/src/mappings/Swiper.ts +10 -0
  105. package/src/mappings/SwiperItem.js +2 -1
  106. package/src/mappings/SwiperItem.ts +5 -1
  107. package/src/mappings/TextArea.js +10 -1
  108. package/src/mappings/TextArea.ts +10 -0
  109. package/src/mappings/TextField.js +9 -0
  110. package/src/mappings/TextField.ts +9 -0
  111. package/lib/commonjs/components/Shadow.js +0 -46
  112. package/lib/commonjs/mappings/Shadow.js +0 -94
  113. package/lib/module/components/Shadow.js +0 -38
  114. package/lib/module/mappings/Shadow.js +0 -87
  115. package/lib/typescript/src/components/Shadow.d.ts +0 -24
  116. package/lib/typescript/src/components/Shadow.d.ts.map +0 -1
  117. package/lib/typescript/src/mappings/Shadow.d.ts +0 -173
  118. package/lib/typescript/src/mappings/Shadow.d.ts.map +0 -1
  119. package/src/components/Shadow.js +0 -16
  120. package/src/components/Shadow.tsx +0 -62
  121. package/src/mappings/Shadow.js +0 -87
  122. package/src/mappings/Shadow.ts +0 -95
@@ -12,7 +12,6 @@ var _theming = require("../../theming");
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
  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); }
14
14
  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; }
15
- 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); }
16
15
  const AccordionItem = _ref => {
17
16
  let {
18
17
  Icon,
@@ -27,9 +26,10 @@ const AccordionItem = _ref => {
27
26
  textStyles,
28
27
  viewStyles
29
28
  } = (0, _utilities.extractStyles)(style);
30
- return /*#__PURE__*/React.createElement(_reactNative.Pressable, _extends({
31
- style: [styles.container, viewStyles]
32
- }, rest), /*#__PURE__*/React.createElement(_reactNative.View, {
29
+ return /*#__PURE__*/React.createElement(_reactNative.Pressable, {
30
+ style: [styles.container, viewStyles],
31
+ ...rest
32
+ }, /*#__PURE__*/React.createElement(_reactNative.View, {
33
33
  style: styles.row
34
34
  }, icon ? /*#__PURE__*/React.createElement(Icon, {
35
35
  name: icon,
@@ -61,4 +61,23 @@ const styles = _reactNative.StyleSheet.create({
61
61
  }
62
62
  });
63
63
  var _default = (0, _theming.withTheme)(AccordionItem);
64
+ exports.default = _default;.StyleSheet.create({
65
+ container: {
66
+ padding: 8
67
+ },
68
+ row: {
69
+ flexDirection: "row",
70
+ alignItems: "center",
71
+ paddingLeft: 8
72
+ },
73
+ item: {
74
+ marginVertical: 6,
75
+ paddingLeft: 8
76
+ },
77
+ content: {
78
+ flex: 1,
79
+ justifyContent: "center"
80
+ }
81
+ });
82
+ var _default = (0, _theming.withTheme)(AccordionItem);
64
83
  exports.default = _default;
@@ -17,13 +17,47 @@ const DeckSwiper = _ref => {
17
17
  verticalEnabled = true,
18
18
  horizontalEnabled = true,
19
19
  visibleCardCount = 1,
20
+ data,
21
+ keyExtractor,
22
+ renderItem,
20
23
  style,
21
24
  children
22
25
  } = _ref;
26
+ //Both 'renderItem' and 'data' are optional to allow direct children. But if one is included, both need to be included
27
+ if (data && !renderItem || renderItem && !data) {
28
+ throw new Error("'renderItem' and 'data' need to both be provided to lazily render. Either remove them entirley or include both");
29
+ }
30
+ if (data && renderItem && children) {
31
+ console.warn("'children' of DeckSwiper ignored due to usage of 'data' and 'renderItem'");
32
+ }
23
33
  const childrenArray = _react.default.useMemo(() => _react.default.Children.toArray(children), [children]);
24
34
 
25
35
  // an array of indices based on children count
26
36
  const cardsFillerData = _react.default.useMemo(() => Array.from(Array(childrenArray.length).keys()), [childrenArray]);
37
+ const cardsData = data || cardsFillerData;
38
+ const renderCard = (card, index) => {
39
+ if (renderItem) {
40
+ return renderItem({
41
+ item: card,
42
+ index
43
+ });
44
+ } else {
45
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, childrenArray[index]);
46
+ }
47
+ };
48
+ const renderFirstCard = () => {
49
+ if (cardsData.length) {
50
+ return renderCard(cardsData[0], 0);
51
+ }
52
+ return undefined;
53
+ };
54
+ const cardKeyExtractor = card => {
55
+ if (keyExtractor) {
56
+ return keyExtractor(card);
57
+ } else {
58
+ return card === null || card === void 0 ? void 0 : card.toString();
59
+ }
60
+ };
27
61
 
28
62
  /**
29
63
  * By default react-native-deck-swiper positions everything with absolute position.
@@ -37,10 +71,10 @@ const DeckSwiper = _ref => {
37
71
 
38
72
  return /*#__PURE__*/_react.default.createElement(_reactNative.View, null, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
39
73
  style: styles.containerHeightFiller
40
- }, childrenArray.length && childrenArray[0]), /*#__PURE__*/_react.default.createElement(_reactNativeDeckSwiper.default, {
41
- cards: cardsFillerData,
42
- renderCard: (_, i) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, childrenArray[i]),
43
- keyExtractor: card => card === null || card === void 0 ? void 0 : card.toString(),
74
+ }, renderFirstCard()), /*#__PURE__*/_react.default.createElement(_reactNativeDeckSwiper.default, {
75
+ cards: cardsData,
76
+ renderCard: renderCard,
77
+ keyExtractor: cardKeyExtractor,
44
78
  containerStyle: _reactNative.StyleSheet.flatten([styles.cardsContainer, style]),
45
79
  cardStyle: styles.card,
46
80
  onSwiped: onIndexChanged,
@@ -46,6 +46,9 @@ const isWeb = _reactNative.Platform.OS === "web";
46
46
  const unstyledColor = "rgba(165, 173, 183, 1)";
47
47
  const disabledColor = "rgb(240, 240, 240)";
48
48
  const errorColor = "rgba(255, 69, 100, 1)";
49
+
50
+ //Empty string for 'value' is treated as a non-value
51
+ //reason: Draftbit uses empty string as initial value for string state*/
49
52
  const Picker = _ref => {
50
53
  var _find$label, _find;
51
54
  let {
@@ -76,12 +79,12 @@ const Picker = _ref => {
76
79
  setPickerVisible(!pickerVisible);
77
80
  };
78
81
  React.useEffect(() => {
79
- if (value != null) {
82
+ if (value != null && value !== "") {
80
83
  setInternalValue(value);
81
84
  }
82
85
  }, [value]);
83
86
  React.useEffect(() => {
84
- if (defaultValue != null) {
87
+ if (defaultValue != null && defaultValue !== "") {
85
88
  setInternalValue(defaultValue);
86
89
  }
87
90
  }, [defaultValue]);
@@ -96,11 +99,7 @@ const Picker = _ref => {
96
99
  _reactNative.Keyboard.dismiss();
97
100
  }
98
101
  }, [pickerVisible, autoDismissKeyboard]);
99
- const normalizedOptions = normalizeOptions(options);
100
- const pickerOptions = placeholder ? [{
101
- value: placeholder,
102
- label: placeholder
103
- }, ...normalizedOptions] : normalizedOptions;
102
+ const pickerOptions = normalizeOptions(options);
104
103
  const {
105
104
  viewStyles,
106
105
  textStyles
@@ -200,10 +199,10 @@ const Picker = _ref => {
200
199
  } : {})
201
200
  };
202
201
  const handleValueChange = (newValue, itemIndex) => {
203
- if (!placeholder || itemIndex > 0) {
202
+ if (newValue !== "") {
204
203
  onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue, itemIndex);
204
+ setInternalValue(newValue);
205
205
  }
206
- setInternalValue(newValue);
207
206
  };
208
207
  return (
209
208
  /*#__PURE__*/
@@ -12,6 +12,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
12
12
  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; }
13
13
  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); }
14
14
  function ScreenContainer(_ref) {
15
+ var _StyleSheet$flatten;
15
16
  let {
16
17
  scrollable = false,
17
18
  hasSafeArea = false,
@@ -22,7 +23,7 @@ function ScreenContainer(_ref) {
22
23
  children,
23
24
  ...rest
24
25
  } = _ref;
25
- const backgroundColor = theme.colors.background;
26
+ const backgroundColor = ((_StyleSheet$flatten = _reactNative.StyleSheet.flatten(style)) === null || _StyleSheet$flatten === void 0 ? void 0 : _StyleSheet$flatten.backgroundColor) || theme.colors.background;
26
27
  const edges = ["left", "right"];
27
28
  if (hasSafeArea || hasTopSafeArea) {
28
29
  edges.push("top");
@@ -273,12 +273,6 @@ Object.defineProperty(exports, "ScreenContainer", {
273
273
  return _ScreenContainer.default;
274
274
  }
275
275
  });
276
- Object.defineProperty(exports, "Shadow", {
277
- enumerable: true,
278
- get: function () {
279
- return _Shadow.default;
280
- }
281
- });
282
276
  Object.defineProperty(exports, "Slider", {
283
277
  enumerable: true,
284
278
  get: function () {
@@ -419,7 +413,6 @@ var _ActionSheet = require("./components/ActionSheet");
419
413
  var _Swiper = require("./components/Swiper");
420
414
  var _Layout = require("./components/Layout");
421
415
  var _index = require("./components/RadioButton/index");
422
- var _Shadow = _interopRequireDefault(require("./components/Shadow"));
423
416
  var _DeckSwiper = require("./components/DeckSwiper");
424
417
  var _DatePicker = _interopRequireDefault(require("./components/DatePicker/DatePicker"));
425
418
  var _Picker = _interopRequireDefault(require("./components/Picker/Picker"));
@@ -10,6 +10,7 @@ const SEED_DATA = {
10
10
  tag: "AccordionGroup",
11
11
  description: "An expandable container containing components",
12
12
  category: _types.COMPONENT_TYPES.container,
13
+ stylesPanelSections: [_types.StylesPanelSections.LayoutSelectedItem, _types.StylesPanelSections.Background, _types.StylesPanelSections.Size, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Position, _types.StylesPanelSections.Borders, _types.StylesPanelSections.Effects],
13
14
  layout: {
14
15
  paddingTop: 8,
15
16
  paddingRight: 8,
@@ -10,6 +10,7 @@ const SEED_DATA = {
10
10
  tag: "AccordionItem",
11
11
  description: "Item to be used in Accordion",
12
12
  category: _types.COMPONENT_TYPES.deprecated,
13
+ stylesPanelSections: _types.CONTAINER_COMPONENT_STYLES_SECTIONS,
13
14
  props: {
14
15
  icon: (0, _types.createIconProp)(),
15
16
  label: (0, _types.createTextProp)({
@@ -10,6 +10,7 @@ const SEED_DATA = {
10
10
  tag: "ActionSheet",
11
11
  description: "Action Sheet container",
12
12
  category: _types.COMPONENT_TYPES.actionsheet,
13
+ stylesPanelSections: [_types.StylesPanelSections.Size, _types.StylesPanelSections.Margins],
13
14
  props: {
14
15
  visible: (0, _types.createStaticBoolProp)({
15
16
  group: _types.GROUPS.data,
@@ -9,6 +9,7 @@ const SEED_DATA = {
9
9
  name: "Action Sheet Cancel",
10
10
  tag: "ActionSheetCancel",
11
11
  description: "Action Sheet cancel",
12
+ stylesPanelSections: [_types.StylesPanelSections.Size, _types.StylesPanelSections.Margins],
12
13
  category: _types.COMPONENT_TYPES.actionsheet,
13
14
  triggers: [_types.Triggers.OnPress],
14
15
  props: {
@@ -10,6 +10,7 @@ const SEED_DATA = {
10
10
  tag: "ActionSheetItem",
11
11
  description: "Action Sheet item",
12
12
  category: _types.COMPONENT_TYPES.actionsheet,
13
+ stylesPanelSections: [_types.StylesPanelSections.Size, _types.StylesPanelSections.Margins],
13
14
  triggers: [_types.Triggers.OnPress],
14
15
  layout: {
15
16
  textAlign: "center"
@@ -13,6 +13,7 @@ const SEED_DATA = {
13
13
  width: "100%",
14
14
  height: "100%"
15
15
  },
16
+ stylesPanelSections: [_types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Borders, _types.StylesPanelSections.Effects],
16
17
  props: {
17
18
  endY: {
18
19
  group: _types.GROUPS.basic,
@@ -9,6 +9,7 @@ const SEED_DATA = {
9
9
  name: "Map Callout",
10
10
  tag: "MapCallout",
11
11
  packageName: "@draftbit/maps",
12
+ stylesPanelSections: _types.CONTAINER_COMPONENT_STYLES_SECTIONS,
12
13
  description: "An info window to display on top of a marker when it is clicked",
13
14
  category: _types.COMPONENT_TYPES.map,
14
15
  triggers: [_types.Triggers.OnPress],
@@ -11,6 +11,7 @@ const SEED_DATA = {
11
11
  packageName: "@draftbit/maps",
12
12
  description: "A marker to show inside map view",
13
13
  category: _types.COMPONENT_TYPES.map,
14
+ stylesPanelSections: _types.CONTAINER_COMPONENT_STYLES_SECTIONS,
14
15
  layout: {},
15
16
  props: {
16
17
  latitude: (0, _types.createNumberProp)({
@@ -11,6 +11,7 @@ const SEED_DATA = {
11
11
  packageName: "@draftbit/maps",
12
12
  description: "A map view",
13
13
  category: _types.COMPONENT_TYPES.map,
14
+ stylesPanelSections: [_types.StylesPanelSections.Size, _types.StylesPanelSections.Margins],
14
15
  layout: {
15
16
  flex: 1,
16
17
  width: "100%",
@@ -10,6 +10,7 @@ const SEED_DATA = {
10
10
  tag: "Swiper",
11
11
  description: "Swiper container",
12
12
  category: _types.COMPONENT_TYPES.swiper,
13
+ stylesPanelSections: [_types.StylesPanelSections.LayoutSelectedItem, _types.StylesPanelSections.Background, _types.StylesPanelSections.Size, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Position, _types.StylesPanelSections.Borders, _types.StylesPanelSections.Effects],
13
14
  layout: {
14
15
  height: 300,
15
16
  width: "100%"
@@ -10,6 +10,7 @@ const SEED_DATA = {
10
10
  tag: "SwiperItem",
11
11
  description: "Swiper item",
12
12
  category: _types.COMPONENT_TYPES.swiper,
13
- props: {}
13
+ props: {},
14
+ stylesPanelSections: _types.CONTAINER_COMPONENT_STYLES_SECTIONS
14
15
  };
15
16
  exports.SEED_DATA = SEED_DATA;
@@ -10,6 +10,7 @@ const SEED_DATA = {
10
10
  tag: "TextInput",
11
11
  description: "An input field that allows for multiple lines.",
12
12
  category: _types.COMPONENT_TYPES.input,
13
+ stylesPanelSections: [_types.StylesPanelSections.Typography, _types.StylesPanelSections.Background, _types.StylesPanelSections.Size, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Position, _types.StylesPanelSections.Borders, _types.StylesPanelSections.Effects],
13
14
  layout: {
14
15
  borderLeftWidth: 1,
15
16
  borderRightWidth: 1,
@@ -279,6 +279,7 @@ const SEED_DATA = [{
279
279
  preview_image_url: "{CLOUDINARY_URL}/Textfield.png",
280
280
  supports_list_render: false,
281
281
  triggers: SEED_DATA_TRIGGERS,
282
+ stylesPanelSections: [_types.StylesPanelSections.Typography, _types.StylesPanelSections.Background, _types.StylesPanelSections.Size, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Position, _types.StylesPanelSections.Borders, _types.StylesPanelSections.Effects],
282
283
  props: {
283
284
  ...SEED_DATA_PROPS,
284
285
  type: {
@@ -10,13 +10,47 @@ const DeckSwiper = _ref => {
10
10
  verticalEnabled = true,
11
11
  horizontalEnabled = true,
12
12
  visibleCardCount = 1,
13
+ data,
14
+ keyExtractor,
15
+ renderItem,
13
16
  style,
14
17
  children
15
18
  } = _ref;
19
+ //Both 'renderItem' and 'data' are optional to allow direct children. But if one is included, both need to be included
20
+ if (data && !renderItem || renderItem && !data) {
21
+ throw new Error("'renderItem' and 'data' need to both be provided to lazily render. Either remove them entirley or include both");
22
+ }
23
+ if (data && renderItem && children) {
24
+ console.warn("'children' of DeckSwiper ignored due to usage of 'data' and 'renderItem'");
25
+ }
16
26
  const childrenArray = React.useMemo(() => React.Children.toArray(children), [children]);
17
27
 
18
28
  // an array of indices based on children count
19
29
  const cardsFillerData = React.useMemo(() => Array.from(Array(childrenArray.length).keys()), [childrenArray]);
30
+ const cardsData = data || cardsFillerData;
31
+ const renderCard = (card, index) => {
32
+ if (renderItem) {
33
+ return renderItem({
34
+ item: card,
35
+ index
36
+ });
37
+ } else {
38
+ return /*#__PURE__*/React.createElement(React.Fragment, null, childrenArray[index]);
39
+ }
40
+ };
41
+ const renderFirstCard = () => {
42
+ if (cardsData.length) {
43
+ return renderCard(cardsData[0], 0);
44
+ }
45
+ return undefined;
46
+ };
47
+ const cardKeyExtractor = card => {
48
+ if (keyExtractor) {
49
+ return keyExtractor(card);
50
+ } else {
51
+ return card === null || card === void 0 ? void 0 : card.toString();
52
+ }
53
+ };
20
54
 
21
55
  /**
22
56
  * By default react-native-deck-swiper positions everything with absolute position.
@@ -30,10 +64,10 @@ const DeckSwiper = _ref => {
30
64
 
31
65
  return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(View, {
32
66
  style: styles.containerHeightFiller
33
- }, childrenArray.length && childrenArray[0]), /*#__PURE__*/React.createElement(DeckSwiperComponent, {
34
- cards: cardsFillerData,
35
- renderCard: (_, i) => /*#__PURE__*/React.createElement(React.Fragment, null, childrenArray[i]),
36
- keyExtractor: card => card === null || card === void 0 ? void 0 : card.toString(),
67
+ }, renderFirstCard()), /*#__PURE__*/React.createElement(DeckSwiperComponent, {
68
+ cards: cardsData,
69
+ renderCard: renderCard,
70
+ keyExtractor: cardKeyExtractor,
37
71
  containerStyle: StyleSheet.flatten([styles.cardsContainer, style]),
38
72
  cardStyle: styles.card,
39
73
  onSwiped: onIndexChanged,
@@ -1,3 +1,4 @@
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); }
1
2
  import React, { useEffect, useState } from "react";
2
3
  import { TextInput } from "react-native";
3
4
  import { isString, isNumber, isNaN } from "lodash";
@@ -31,6 +32,7 @@ const NumberInput = _ref => {
31
32
  setCurrentStringNumberValue(newStringNumberValue);
32
33
  onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(number);
33
34
  };
35
+
34
36
  // run handleChangeText with value prop only when value prop changes (and first render to reset currentStringNumberValue)
35
37
  useEffect(() => {
36
38
  const nextStringNumberValue = formatValueToStringNumber(value);
@@ -39,6 +41,7 @@ const NumberInput = _ref => {
39
41
  }
40
42
  // eslint-disable-next-line react-hooks/exhaustive-deps
41
43
  }, [value]);
44
+
42
45
  // set currentStringNumberValue as defaultValue prop if there is a differnce on first render only
43
46
  useEffect(() => {
44
47
  const defaultStringNumberValue = formatValueToStringNumber(defaultValue);
@@ -47,17 +50,6 @@ const NumberInput = _ref => {
47
50
  }
48
51
  // eslint-disable-next-line react-hooks/exhaustive-deps
49
52
  }, []);
50
- return /*#__PURE__*/React.createElement(TextInput, {
51
- keyboardType: "numeric",
52
- value: currentStringNumberValue,
53
- onChangeText: handleChangeText,
54
- ...props
55
- });
56
- };
57
- export default NumberInput; setCurrentStringNumberValue(defaultStringNumberValue);
58
- }
59
- // eslint-disable-next-line react-hooks/exhaustive-deps
60
- }, []);
61
53
  return /*#__PURE__*/React.createElement(TextInput, _extends({
62
54
  keyboardType: "numeric",
63
55
  value: currentStringNumberValue,
@@ -37,6 +37,9 @@ const isWeb = Platform.OS === "web";
37
37
  const unstyledColor = "rgba(165, 173, 183, 1)";
38
38
  const disabledColor = "rgb(240, 240, 240)";
39
39
  const errorColor = "rgba(255, 69, 100, 1)";
40
+
41
+ //Empty string for 'value' is treated as a non-value
42
+ //reason: Draftbit uses empty string as initial value for string state*/
40
43
  const Picker = _ref => {
41
44
  var _find$label, _find;
42
45
  let {
@@ -67,12 +70,12 @@ const Picker = _ref => {
67
70
  setPickerVisible(!pickerVisible);
68
71
  };
69
72
  React.useEffect(() => {
70
- if (value != null) {
73
+ if (value != null && value !== "") {
71
74
  setInternalValue(value);
72
75
  }
73
76
  }, [value]);
74
77
  React.useEffect(() => {
75
- if (defaultValue != null) {
78
+ if (defaultValue != null && defaultValue !== "") {
76
79
  setInternalValue(defaultValue);
77
80
  }
78
81
  }, [defaultValue]);
@@ -87,11 +90,7 @@ const Picker = _ref => {
87
90
  Keyboard.dismiss();
88
91
  }
89
92
  }, [pickerVisible, autoDismissKeyboard]);
90
- const normalizedOptions = normalizeOptions(options);
91
- const pickerOptions = placeholder ? [{
92
- value: placeholder,
93
- label: placeholder
94
- }, ...normalizedOptions] : normalizedOptions;
93
+ const pickerOptions = normalizeOptions(options);
95
94
  const {
96
95
  viewStyles,
97
96
  textStyles
@@ -191,10 +190,10 @@ const Picker = _ref => {
191
190
  } : {})
192
191
  };
193
192
  const handleValueChange = (newValue, itemIndex) => {
194
- if (!placeholder || itemIndex > 0) {
193
+ if (newValue !== "") {
195
194
  onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue, itemIndex);
195
+ setInternalValue(newValue);
196
196
  }
197
- setInternalValue(newValue);
198
197
  };
199
198
  return (
200
199
  /*#__PURE__*/
@@ -1,4 +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
1
  import * as React from "react";
3
2
  import { View, StyleSheet } from "react-native";
4
3
  import { SafeAreaView } from "react-native-safe-area-context";
@@ -11,7 +10,6 @@ import TextField from "../TextField";
11
10
  import Touchable from "../Touchable";
12
11
  import { extractStyles } from "../../utilities";
13
12
  const Picker = _ref => {
14
- var _options$find$label, _options$find;
15
13
  let {
16
14
  Icon,
17
15
  style,
@@ -25,6 +23,7 @@ const Picker = _ref => {
25
23
  },
26
24
  ...props
27
25
  } = _ref;
26
+ var _a, _b;
28
27
  const {
29
28
  viewStyles: {
30
29
  borderRadius,
@@ -65,26 +64,24 @@ const Picker = _ref => {
65
64
  };
66
65
 
67
66
  const stylesWithoutMargin = style && omit(StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
68
- const selectedLabel = selectedValue && ((_options$find$label = (_options$find = options.find(o => o.value === selectedValue)) === null || _options$find === void 0 ? void 0 : _options$find.label) !== null && _options$find$label !== void 0 ? _options$find$label : selectedValue);
67
+ const selectedLabel = selectedValue && ((_b = (_a = options.find(o => o.value === selectedValue)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : selectedValue);
69
68
  return /*#__PURE__*/React.createElement(View, {
70
69
  style: [styles.container, viewStyles]
71
70
  }, /*#__PURE__*/React.createElement(Touchable, {
72
71
  disabled: disabled,
73
72
  onPress: toggleVisibility
74
- }, /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
73
+ }, /*#__PURE__*/React.createElement(TextField, {
74
+ ...props,
75
75
  value: String(selectedLabel),
76
- placeholder: placeholder
76
+ placeholder: placeholder,
77
77
  // @ts-ignore
78
- ,
79
- ref: textField // cannot determine if ref is of correct type due to component being wrapped in a withTheme()
80
- ,
78
+ ref: textField,
81
79
  disabled: disabled,
82
- pointerEvents: "none"
80
+ pointerEvents: "none",
83
81
  // @ts-expect-error
84
- ,
85
82
  style: stylesWithoutMargin,
86
83
  Icon: Icon
87
- }))), pickerVisible && /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(View, {
84
+ })), pickerVisible && /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(View, {
88
85
  style: [styles.picker, {
89
86
  backgroundColor: colors.divider
90
87
  }]
@@ -128,4 +125,32 @@ const styles = StyleSheet.create({
128
125
  alignSelf: "flex-end"
129
126
  }
130
127
  });
128
+ export default withTheme(Picker);nValueChange
129
+ }, options.map(o => /*#__PURE__*/React.createElement(NativePicker.Item, {
130
+ label: o.label,
131
+ value: o.value,
132
+ key: o.value
133
+ })))))));
134
+ };
135
+ const styles = StyleSheet.create({
136
+ container: {
137
+ alignSelf: "stretch"
138
+ },
139
+ picker: {
140
+ position: "absolute",
141
+ bottom: 0,
142
+ left: 0,
143
+ right: 0,
144
+ flexDirection: "row",
145
+ justifyContent: "center"
146
+ },
147
+ pickerContainer: {
148
+ backgroundColor: "white",
149
+ flexDirection: "column",
150
+ width: "100%"
151
+ },
152
+ closeButton: {
153
+ alignSelf: "flex-end"
154
+ }
155
+ });
131
156
  export default withTheme(Picker);
@@ -1,11 +1,7 @@
1
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
1
  import * as React from "react";
5
2
  import { View, StyleSheet } from "react-native";
6
3
  import PortalManager from "./PortalManager";
7
4
  export const PortalContext = /*#__PURE__*/React.createContext(null);
8
-
9
5
  /**
10
6
  * Portal host renders all of its children `Portal` elements.
11
7
  * For example, you can wrap a screen in `Portal.Host` to render items above the screen.
@@ -33,10 +29,10 @@ export const PortalContext = /*#__PURE__*/React.createContext(null);
33
29
  export default class PortalHost extends React.Component {
34
30
  constructor() {
35
31
  super(...arguments);
36
- _defineProperty(this, "setManager", manager => {
32
+ this.setManager = manager => {
37
33
  this.manager = manager;
38
- });
39
- _defineProperty(this, "mount", children => {
34
+ };
35
+ this.mount = children => {
40
36
  const key = this.nextKey++;
41
37
  if (this.manager) {
42
38
  this.manager.mount(key, children);
@@ -48,8 +44,8 @@ export default class PortalHost extends React.Component {
48
44
  });
49
45
  }
50
46
  return key;
51
- });
52
- _defineProperty(this, "update", (key, children) => {
47
+ };
48
+ this.update = (key, children) => {
53
49
  if (this.manager) {
54
50
  this.manager.update(key, children);
55
51
  } else {
@@ -66,8 +62,8 @@ export default class PortalHost extends React.Component {
66
62
  this.queue.push(op);
67
63
  }
68
64
  }
69
- });
70
- _defineProperty(this, "unmount", key => {
65
+ };
66
+ this.unmount = key => {
71
67
  if (this.manager) {
72
68
  this.manager.unmount(key);
73
69
  } else {
@@ -76,10 +72,9 @@ export default class PortalHost extends React.Component {
76
72
  key
77
73
  });
78
74
  }
79
- });
80
- _defineProperty(this, "nextKey", 0);
81
- _defineProperty(this, "queue", []);
82
- _defineProperty(this, "manager", void 0);
75
+ };
76
+ this.nextKey = 0;
77
+ this.queue = [];
83
78
  }
84
79
  componentDidMount() {
85
80
  const manager = this.manager;
@@ -117,6 +112,41 @@ export default class PortalHost extends React.Component {
117
112
  }));
118
113
  }
119
114
  }
115
+ PortalHost.displayName = "Portal.Host";
116
+ const styles = StyleSheet.create({
117
+ container: {
118
+ flex: 1
119
+ }
120
+ }); switch (action.type) {
121
+ case "mount":
122
+ manager.mount(action.key, action.children);
123
+ break;
124
+ case "update":
125
+ manager.update(action.key, action.children);
126
+ break;
127
+ case "unmount":
128
+ manager.unmount(action.key);
129
+ break;
130
+ }
131
+ }
132
+ }
133
+ }
134
+ render() {
135
+ return /*#__PURE__*/React.createElement(PortalContext.Provider, {
136
+ value: {
137
+ mount: this.mount,
138
+ update: this.update,
139
+ unmount: this.unmount
140
+ }
141
+ }, /*#__PURE__*/React.createElement(View, {
142
+ style: styles.container,
143
+ collapsable: false,
144
+ pointerEvents: "box-none"
145
+ }, this.props.children), /*#__PURE__*/React.createElement(PortalManager, {
146
+ ref: this.setManager
147
+ }));
148
+ }
149
+ }
120
150
  _defineProperty(PortalHost, "displayName", "Portal.Host");
121
151
  const styles = StyleSheet.create({
122
152
  container: {