@draftbit/core 46.8.1-fe4ccb.2 → 46.8.2-088bf8.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.
- package/lib/commonjs/components/DeckSwiper/DeckSwiper.js +38 -4
- package/lib/commonjs/components/Picker/Picker.js +8 -9
- package/lib/commonjs/components/RadioButton/context.js +1 -1
- package/lib/commonjs/components/ScreenContainer.js +2 -1
- package/lib/commonjs/components/ToggleButton.js +15 -2
- package/lib/commonjs/hooks.js +1 -2
- package/lib/commonjs/index.js +0 -7
- package/lib/commonjs/mappings/Accordion.js +1 -0
- package/lib/commonjs/mappings/AccordionItem.js +1 -0
- package/lib/commonjs/mappings/ActionSheet.js +1 -0
- package/lib/commonjs/mappings/ActionSheetCancel.js +1 -0
- package/lib/commonjs/mappings/ActionSheetItem.js +1 -0
- package/lib/commonjs/mappings/HtmlElements.js +177 -0
- package/lib/commonjs/mappings/LinearGradient.js +1 -0
- package/lib/commonjs/mappings/MapCallout.js +1 -0
- package/lib/commonjs/mappings/MapMarker.js +1 -0
- package/lib/commonjs/mappings/MapView.js +1 -0
- package/lib/commonjs/mappings/Swiper.js +1 -0
- package/lib/commonjs/mappings/SwiperItem.js +2 -1
- package/lib/commonjs/mappings/TextArea.js +1 -0
- package/lib/commonjs/mappings/TextField.js +1 -0
- package/lib/module/components/DeckSwiper/DeckSwiper.js +38 -4
- package/lib/module/components/Picker/Picker.js +8 -9
- package/lib/module/components/Picker/PickerComponent.android.js +8 -11
- package/lib/module/components/ScreenContainer.js +2 -1
- package/lib/module/index.js +0 -1
- package/lib/module/mappings/Accordion.js +2 -1
- package/lib/module/mappings/AccordionItem.js +2 -1
- package/lib/module/mappings/ActionSheet.js +2 -1
- package/lib/module/mappings/ActionSheetCancel.js +2 -1
- package/lib/module/mappings/ActionSheetItem.js +2 -1
- package/lib/module/mappings/HtmlElements.js +170 -0
- package/lib/module/mappings/LinearGradient.js +2 -1
- package/lib/module/mappings/MapCallout.js +2 -1
- package/lib/module/mappings/MapMarker.js +2 -1
- package/lib/module/mappings/MapView.js +2 -1
- package/lib/module/mappings/Swiper.js +2 -1
- package/lib/module/mappings/SwiperItem.js +3 -2
- package/lib/module/mappings/TextArea.js +2 -1
- package/lib/module/mappings/TextField.js +1 -0
- package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts +8 -2
- package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts.map +1 -1
- package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.d.ts +2 -3
- package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.d.ts.map +1 -1
- package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
- package/lib/typescript/src/components/ScreenContainer.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +0 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mappings/Accordion.d.ts +1 -0
- package/lib/typescript/src/mappings/Accordion.d.ts.map +1 -1
- package/lib/typescript/src/mappings/AccordionItem.d.ts +1 -0
- package/lib/typescript/src/mappings/AccordionItem.d.ts.map +1 -1
- package/lib/typescript/src/mappings/ActionSheet.d.ts +1 -0
- package/lib/typescript/src/mappings/ActionSheet.d.ts.map +1 -1
- package/lib/typescript/src/mappings/ActionSheetCancel.d.ts +1 -0
- package/lib/typescript/src/mappings/ActionSheetCancel.d.ts.map +1 -1
- package/lib/typescript/src/mappings/ActionSheetItem.d.ts +1 -0
- package/lib/typescript/src/mappings/ActionSheetItem.d.ts.map +1 -1
- package/lib/typescript/src/mappings/HtmlElements.d.ts +77 -0
- package/lib/typescript/src/mappings/HtmlElements.d.ts.map +1 -0
- package/lib/typescript/src/mappings/LinearGradient.d.ts +1 -0
- package/lib/typescript/src/mappings/LinearGradient.d.ts.map +1 -1
- package/lib/typescript/src/mappings/MapCallout.d.ts +1 -0
- package/lib/typescript/src/mappings/MapCallout.d.ts.map +1 -1
- package/lib/typescript/src/mappings/MapMarker.d.ts +1 -0
- package/lib/typescript/src/mappings/MapMarker.d.ts.map +1 -1
- package/lib/typescript/src/mappings/MapView.d.ts +1 -0
- package/lib/typescript/src/mappings/MapView.d.ts.map +1 -1
- package/lib/typescript/src/mappings/Swiper.d.ts +1 -0
- package/lib/typescript/src/mappings/Swiper.d.ts.map +1 -1
- package/lib/typescript/src/mappings/SwiperItem.d.ts +1 -0
- package/lib/typescript/src/mappings/SwiperItem.d.ts.map +1 -1
- package/lib/typescript/src/mappings/TextArea.d.ts +1 -0
- package/lib/typescript/src/mappings/TextArea.d.ts.map +1 -1
- package/lib/typescript/src/mappings/TextField.d.ts +1 -1
- package/lib/typescript/src/mappings/TextField.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/components/DeckSwiper/DeckSwiper.js +33 -3
- package/src/components/DeckSwiper/DeckSwiper.tsx +51 -9
- package/src/components/DeckSwiper/DeckSwiperCard.js +1 -1
- package/src/components/DeckSwiper/DeckSwiperCard.tsx +3 -6
- package/src/components/Picker/Picker.js +7 -8
- package/src/components/Picker/Picker.tsx +7 -9
- package/src/components/ScreenContainer.js +2 -1
- package/src/components/ScreenContainer.tsx +2 -1
- package/src/index.js +0 -1
- package/src/index.tsx +0 -2
- package/src/mappings/Accordion.js +10 -1
- package/src/mappings/Accordion.ts +10 -0
- package/src/mappings/AccordionItem.js +2 -1
- package/src/mappings/AccordionItem.ts +2 -0
- package/src/mappings/ActionSheet.js +2 -1
- package/src/mappings/ActionSheet.ts +7 -1
- package/src/mappings/ActionSheetCancel.js +2 -1
- package/src/mappings/ActionSheetCancel.ts +2 -0
- package/src/mappings/ActionSheetItem.js +2 -1
- package/src/mappings/ActionSheetItem.ts +2 -0
- package/src/mappings/HtmlElements.js +193 -0
- package/src/mappings/HtmlElements.ts +207 -0
- package/src/mappings/LinearGradient.js +6 -1
- package/src/mappings/LinearGradient.ts +6 -0
- package/src/mappings/MapCallout.js +2 -1
- package/src/mappings/MapCallout.ts +2 -0
- package/src/mappings/MapMarker.js +2 -1
- package/src/mappings/MapMarker.ts +2 -0
- package/src/mappings/MapView.js +2 -1
- package/src/mappings/MapView.ts +2 -0
- package/src/mappings/Swiper.js +10 -1
- package/src/mappings/Swiper.ts +10 -0
- package/src/mappings/SwiperItem.js +2 -1
- package/src/mappings/SwiperItem.ts +5 -1
- package/src/mappings/TextArea.js +10 -1
- package/src/mappings/TextArea.ts +10 -0
- package/src/mappings/TextField.js +9 -0
- package/src/mappings/TextField.ts +9 -0
- package/lib/commonjs/components/Shadow.js +0 -42
- package/lib/commonjs/mappings/Shadow.js +0 -94
- package/lib/module/components/Shadow.js +0 -34
- package/lib/module/mappings/Shadow.js +0 -87
- package/lib/typescript/src/components/Shadow.d.ts +0 -24
- package/lib/typescript/src/components/Shadow.d.ts.map +0 -1
- package/lib/typescript/src/mappings/Shadow.d.ts +0 -173
- package/lib/typescript/src/mappings/Shadow.d.ts.map +0 -1
- package/src/components/Shadow.js +0 -16
- package/src/components/Shadow.tsx +0 -58
- package/src/mappings/Shadow.js +0 -87
- package/src/mappings/Shadow.ts +0 -95
|
@@ -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
|
-
},
|
|
41
|
-
cards:
|
|
42
|
-
renderCard:
|
|
43
|
-
keyExtractor:
|
|
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
|
|
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 (
|
|
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__*/
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.radioButtonGroupContext = exports.Direction = void 0;
|
|
7
7
|
exports.useRadioButtonGroupContext = useRadioButtonGroupContext;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
|
|
9
|
+
var Direction;
|
|
10
10
|
exports.Direction = Direction;
|
|
11
11
|
(function (Direction) {
|
|
12
12
|
Direction["Horizontal"] = "horizontal";
|
|
@@ -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");
|
|
@@ -11,7 +11,6 @@ var _IconButton = _interopRequireDefault(require("./IconButton"));
|
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
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); }
|
|
13
13
|
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; }
|
|
14
|
-
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); }
|
|
15
14
|
const ToggleButton = _ref => {
|
|
16
15
|
let {
|
|
17
16
|
Icon,
|
|
@@ -47,7 +46,7 @@ const ToggleButton = _ref => {
|
|
|
47
46
|
setInternalValue(!internalValue);
|
|
48
47
|
onPress(!internalValue);
|
|
49
48
|
};
|
|
50
|
-
return /*#__PURE__*/React.createElement(_IconButton.default,
|
|
49
|
+
return /*#__PURE__*/React.createElement(_IconButton.default, {
|
|
51
50
|
Icon: Icon,
|
|
52
51
|
icon: icon,
|
|
53
52
|
size: iconSize,
|
|
@@ -59,6 +58,20 @@ const ToggleButton = _ref => {
|
|
|
59
58
|
height,
|
|
60
59
|
backgroundColor: internalValue ? colors[colorSecondary] : colors[color],
|
|
61
60
|
borderColor: colors[borderColor]
|
|
61
|
+
}, style],
|
|
62
|
+
...rest
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
const styles = _reactNative.StyleSheet.create({
|
|
66
|
+
mainContainer: {
|
|
67
|
+
borderWidth: 1
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
var _default = (0, _theming.withTheme)(ToggleButton);
|
|
71
|
+
exports.default = _default;idth,
|
|
72
|
+
height,
|
|
73
|
+
backgroundColor: internalValue ? colors[colorSecondary] : colors[color],
|
|
74
|
+
borderColor: colors[borderColor]
|
|
62
75
|
}, style]
|
|
63
76
|
}, rest));
|
|
64
77
|
};
|
package/lib/commonjs/hooks.js
CHANGED
|
@@ -10,12 +10,11 @@ function usePrevious(value) {
|
|
|
10
10
|
// The ref object is a generic container whose current property is mutable
|
|
11
11
|
// and can hold any value, similar to an instance property on a class
|
|
12
12
|
const ref = _react.default.useRef();
|
|
13
|
-
|
|
14
13
|
// Store current value in ref
|
|
15
14
|
_react.default.useEffect(() => {
|
|
16
15
|
ref.current = value;
|
|
17
16
|
}, [value]);
|
|
18
|
-
|
|
19
17
|
// Return previous value (happens before update in useEffect above)
|
|
20
18
|
return ref.current;
|
|
19
|
+
}
|
|
21
20
|
}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -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"
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SEED_DATA = void 0;
|
|
7
|
+
var _types = require("@draftbit/types");
|
|
8
|
+
const SEED_DATA_TRIGGERS = [_types.Triggers.OnValueChange];
|
|
9
|
+
const ELEMENT_SEED_DATA = {
|
|
10
|
+
doc_link: "https://www.npmjs.com/package/@expo/html-elements",
|
|
11
|
+
code_link: "https://github.com/expo/expo/tree/master/packages/html-elements",
|
|
12
|
+
packageName: "@expo/html-elements",
|
|
13
|
+
stylesPanelSections: [_types.StylesPanelSections.Typography, _types.StylesPanelSections.LayoutSelectedItem, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Effects],
|
|
14
|
+
layout: {
|
|
15
|
+
margin: 0
|
|
16
|
+
},
|
|
17
|
+
triggers: SEED_DATA_TRIGGERS,
|
|
18
|
+
category: _types.COMPONENT_TYPES.webelement
|
|
19
|
+
};
|
|
20
|
+
const HEADING_SEED_DATA = {
|
|
21
|
+
...ELEMENT_SEED_DATA,
|
|
22
|
+
category: _types.COMPONENT_TYPES.text,
|
|
23
|
+
props: {
|
|
24
|
+
accessibilityLabel: {
|
|
25
|
+
group: _types.GROUPS.accessibility,
|
|
26
|
+
name: "accessibilityLabel",
|
|
27
|
+
label: "accessibilityLabel",
|
|
28
|
+
description: "Overrides the text that's read by the screen reader when the user interacts with the element. By default, the label is constructed by traversing all the children and accumulating all the Text nodes separated by space.",
|
|
29
|
+
editable: true,
|
|
30
|
+
required: false,
|
|
31
|
+
formType: _types.FORM_TYPES.string,
|
|
32
|
+
propType: _types.PROP_TYPES.STRING,
|
|
33
|
+
defaultValue: null
|
|
34
|
+
},
|
|
35
|
+
selectable: {
|
|
36
|
+
group: _types.GROUPS.advanced,
|
|
37
|
+
name: "selectable",
|
|
38
|
+
label: "selectable",
|
|
39
|
+
description: "Lets the user select text, to use the native copy and paste functionality.",
|
|
40
|
+
editable: true,
|
|
41
|
+
required: false,
|
|
42
|
+
formType: _types.FORM_TYPES.boolean,
|
|
43
|
+
propType: _types.PROP_TYPES.BOOLEAN,
|
|
44
|
+
defaultValue: null
|
|
45
|
+
},
|
|
46
|
+
children: {
|
|
47
|
+
group: _types.GROUPS.data,
|
|
48
|
+
label: "Text",
|
|
49
|
+
description: "Text",
|
|
50
|
+
editable: true,
|
|
51
|
+
required: true,
|
|
52
|
+
formType: _types.FORM_TYPES.string,
|
|
53
|
+
propType: _types.PROP_TYPES.STRING,
|
|
54
|
+
defaultValue: "Your Headline Here"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const TEXT_SEED_DATA = {
|
|
59
|
+
...ELEMENT_SEED_DATA,
|
|
60
|
+
category: _types.COMPONENT_TYPES.text,
|
|
61
|
+
props: {
|
|
62
|
+
children: {
|
|
63
|
+
group: _types.GROUPS.data,
|
|
64
|
+
label: "Text",
|
|
65
|
+
description: "Text",
|
|
66
|
+
defaultValue: "Your Text Here",
|
|
67
|
+
editable: true,
|
|
68
|
+
required: true,
|
|
69
|
+
formType: _types.FORM_TYPES.string,
|
|
70
|
+
propType: _types.PROP_TYPES.STRING
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const SEED_DATA = [{
|
|
75
|
+
name: "H1",
|
|
76
|
+
tag: "H1",
|
|
77
|
+
...HEADING_SEED_DATA
|
|
78
|
+
}, {
|
|
79
|
+
name: "H2",
|
|
80
|
+
tag: "H2",
|
|
81
|
+
...HEADING_SEED_DATA
|
|
82
|
+
}, {
|
|
83
|
+
name: "H3",
|
|
84
|
+
tag: "H3",
|
|
85
|
+
...HEADING_SEED_DATA
|
|
86
|
+
}, {
|
|
87
|
+
name: "H4",
|
|
88
|
+
tag: "H4",
|
|
89
|
+
...HEADING_SEED_DATA
|
|
90
|
+
}, {
|
|
91
|
+
name: "H5",
|
|
92
|
+
tag: "H5",
|
|
93
|
+
...HEADING_SEED_DATA
|
|
94
|
+
}, {
|
|
95
|
+
name: "H6",
|
|
96
|
+
tag: "H6",
|
|
97
|
+
...HEADING_SEED_DATA
|
|
98
|
+
}, {
|
|
99
|
+
name: "Anchor",
|
|
100
|
+
tag: "A",
|
|
101
|
+
...TEXT_SEED_DATA,
|
|
102
|
+
props: {
|
|
103
|
+
href: (0, _types.createTextProp)({
|
|
104
|
+
label: "href",
|
|
105
|
+
description: "Specify the URL",
|
|
106
|
+
defaultValue: ""
|
|
107
|
+
}),
|
|
108
|
+
target: {
|
|
109
|
+
group: _types.GROUPS.basic,
|
|
110
|
+
label: "target",
|
|
111
|
+
description: "decide where link should open",
|
|
112
|
+
formType: _types.FORM_TYPES.flatArray,
|
|
113
|
+
defaultValue: "_blank",
|
|
114
|
+
options: ["_blank", "_self", "_parent", "_top"]
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}, {
|
|
118
|
+
name: "Paragraph",
|
|
119
|
+
tag: "P",
|
|
120
|
+
...TEXT_SEED_DATA,
|
|
121
|
+
props: {
|
|
122
|
+
// NOTE - Keeping the props commented until we figure out a way to use this props from draftbit side.
|
|
123
|
+
// strong: createBoolProp({
|
|
124
|
+
// label: "Strong",
|
|
125
|
+
// description: "Strong",
|
|
126
|
+
// }),
|
|
127
|
+
// strike: createBoolProp({
|
|
128
|
+
// label: "Strike",
|
|
129
|
+
// description: "Strike through",
|
|
130
|
+
// }),
|
|
131
|
+
// italic: createBoolProp({
|
|
132
|
+
// label: "Italic",
|
|
133
|
+
// description: "Italic Fonts",
|
|
134
|
+
// }),
|
|
135
|
+
// bold: createBoolProp({
|
|
136
|
+
// label: "Bold",
|
|
137
|
+
// description: "Bold",
|
|
138
|
+
// }),
|
|
139
|
+
}
|
|
140
|
+
}, {
|
|
141
|
+
name: "Code",
|
|
142
|
+
tag: "Code",
|
|
143
|
+
...TEXT_SEED_DATA
|
|
144
|
+
}, {
|
|
145
|
+
name: "Pre",
|
|
146
|
+
tag: "Pre",
|
|
147
|
+
...TEXT_SEED_DATA
|
|
148
|
+
}, {
|
|
149
|
+
name: "Mark",
|
|
150
|
+
tag: "Mark",
|
|
151
|
+
...TEXT_SEED_DATA
|
|
152
|
+
}, {
|
|
153
|
+
name: "BR",
|
|
154
|
+
tag: "BR",
|
|
155
|
+
...TEXT_SEED_DATA
|
|
156
|
+
}, {
|
|
157
|
+
name: "BlockQuote",
|
|
158
|
+
tag: "BlockQuote",
|
|
159
|
+
...TEXT_SEED_DATA
|
|
160
|
+
}, {
|
|
161
|
+
name: "HR",
|
|
162
|
+
tag: "HR",
|
|
163
|
+
...TEXT_SEED_DATA
|
|
164
|
+
}, {
|
|
165
|
+
name: "Time",
|
|
166
|
+
tag: "Time",
|
|
167
|
+
...ELEMENT_SEED_DATA
|
|
168
|
+
}, {
|
|
169
|
+
name: "UL",
|
|
170
|
+
tag: "UL",
|
|
171
|
+
...ELEMENT_SEED_DATA
|
|
172
|
+
}, {
|
|
173
|
+
name: "LI",
|
|
174
|
+
tag: "LI",
|
|
175
|
+
...ELEMENT_SEED_DATA
|
|
176
|
+
}];
|
|
177
|
+
exports.SEED_DATA = SEED_DATA;
|
|
@@ -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: "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
|
-
},
|
|
34
|
-
cards:
|
|
35
|
-
renderCard:
|
|
36
|
-
keyExtractor:
|
|
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,
|
|
@@ -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
|
|
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 (
|
|
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__*/
|