@draftbit/core 43.4.5-d442fc.1 → 43.4.6-28bb0e.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/Elevation.js +3 -14
- package/lib/commonjs/components/Elevation.js.map +1 -1
- package/lib/commonjs/components/FAB.js +19 -5
- package/lib/commonjs/components/FAB.js.map +1 -1
- package/lib/commonjs/components/FieldSearchBarFull.js.map +1 -1
- package/lib/commonjs/components/NumberInput.js +30 -29
- package/lib/commonjs/components/NumberInput.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButton.js +9 -8
- package/lib/commonjs/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButtonGroup.js +13 -12
- package/lib/commonjs/components/RadioButton/RadioButtonGroup.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButtonRow.js +9 -6
- package/lib/commonjs/components/RadioButton/RadioButtonRow.js.map +1 -1
- package/lib/commonjs/index.js +0 -14
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/mappings/CheckboxRow.js +1 -1
- package/lib/commonjs/mappings/CheckboxRow.js.map +1 -1
- package/lib/commonjs/mappings/TextInput.js +7 -2
- package/lib/commonjs/mappings/TextInput.js.map +1 -1
- package/lib/commonjs/utilities.js +13 -0
- package/lib/commonjs/utilities.js.map +1 -1
- package/lib/module/components/NumberInput.js +26 -25
- package/lib/module/components/NumberInput.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButton.js +8 -8
- package/lib/module/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButtonGroup.js +12 -12
- package/lib/module/components/RadioButton/RadioButtonGroup.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButtonRow.js +10 -7
- package/lib/module/components/RadioButton/RadioButtonRow.js.map +1 -1
- package/lib/module/index.js +0 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/mappings/CheckboxRow.js +1 -1
- package/lib/module/mappings/CheckboxRow.js.map +1 -1
- package/lib/module/mappings/TextInput.js +8 -3
- package/lib/module/mappings/TextInput.js.map +1 -1
- package/lib/module/utilities.js +10 -0
- package/lib/module/utilities.js.map +1 -1
- package/lib/typescript/src/components/NumberInput.d.ts +3 -3
- package/lib/typescript/src/components/RadioButton/RadioButton.d.ts +2 -2
- package/lib/typescript/src/components/RadioButton/RadioButtonGroup.d.ts +2 -2
- package/lib/typescript/src/components/RadioButton/RadioButtonRow.d.ts +1 -1
- package/lib/typescript/src/index.d.ts +0 -1
- package/lib/typescript/src/mappings/TextInput.d.ts +38 -38
- package/lib/typescript/src/utilities.d.ts +1 -0
- package/package.json +2 -4
- package/src/components/NumberInput.js +27 -21
- package/src/components/NumberInput.tsx +41 -29
- package/src/components/RadioButton/RadioButton.js +7 -6
- package/src/components/RadioButton/RadioButton.tsx +11 -12
- package/src/components/RadioButton/RadioButtonGroup.js +10 -10
- package/src/components/RadioButton/RadioButtonGroup.tsx +18 -17
- package/src/components/RadioButton/RadioButtonRow.js +8 -5
- package/src/components/RadioButton/RadioButtonRow.tsx +12 -10
- package/src/index.js +0 -1
- package/src/index.tsx +0 -1
- package/src/mappings/CheckboxRow.js +1 -1
- package/src/mappings/CheckboxRow.ts +1 -1
- package/src/mappings/TextInput.js +7 -2
- package/src/mappings/TextInput.ts +7 -1
- package/src/utilities.js +12 -0
- package/src/utilities.ts +11 -0
- package/lib/commonjs/components/TabView/TabView.js +0 -103
- package/lib/commonjs/components/TabView/TabView.js.map +0 -1
- package/lib/commonjs/components/TabView/TabViewItem.js +0 -27
- package/lib/commonjs/components/TabView/TabViewItem.js.map +0 -1
- package/lib/commonjs/components/TabView/index.js +0 -24
- package/lib/commonjs/components/TabView/index.js.map +0 -1
- package/lib/commonjs/mappings/TabView.js +0 -80
- package/lib/commonjs/mappings/TabView.js.map +0 -1
- package/lib/module/components/TabView/TabView.js +0 -88
- package/lib/module/components/TabView/TabView.js.map +0 -1
- package/lib/module/components/TabView/TabViewItem.js +0 -19
- package/lib/module/components/TabView/TabViewItem.js.map +0 -1
- package/lib/module/components/TabView/index.js +0 -3
- package/lib/module/components/TabView/index.js.map +0 -1
- package/lib/module/mappings/TabView.js +0 -71
- package/lib/module/mappings/TabView.js.map +0 -1
- package/lib/typescript/src/components/TabView/TabView.d.ts +0 -19
- package/lib/typescript/src/components/TabView/TabViewItem.d.ts +0 -10
- package/lib/typescript/src/components/TabView/index.d.ts +0 -2
- package/lib/typescript/src/mappings/TabView.d.ts +0 -111
- package/src/components/TabView/TabView.js +0 -33
- package/src/components/TabView/TabView.tsx +0 -97
- package/src/components/TabView/TabViewItem.js +0 -5
- package/src/components/TabView/TabViewItem.tsx +0 -21
- package/src/components/TabView/index.js +0 -2
- package/src/components/TabView/index.ts +0 -2
- package/src/mappings/TabView.js +0 -73
- package/src/mappings/TabView.ts +0 -80
|
@@ -19,6 +19,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
19
19
|
|
|
20
20
|
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; }
|
|
21
21
|
|
|
22
|
+
function _extends() { _extends = Object.assign || 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); }
|
|
23
|
+
|
|
22
24
|
/* directly copied from https://github.com/callstack/react-native-paper/blob/main/src/components/Surface.tsx#L62 */
|
|
23
25
|
const Elevation = _ref => {
|
|
24
26
|
let {
|
|
@@ -35,24 +37,11 @@ const Elevation = _ref => {
|
|
|
35
37
|
colors
|
|
36
38
|
} = theme;
|
|
37
39
|
const borderRadius = radius;
|
|
38
|
-
return /*#__PURE__*/React.createElement(_reactNative.Animated.View, {
|
|
40
|
+
return /*#__PURE__*/React.createElement(_reactNative.Animated.View, _extends({}, rest, {
|
|
39
41
|
style: [{
|
|
40
42
|
borderRadius,
|
|
41
43
|
backgroundColor: colors.surface
|
|
42
44
|
}, elevation ? (0, _shadow.default)(elevation) : null, style]
|
|
43
|
-
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
44
|
-
style: {
|
|
45
|
-
overflow: "hidden",
|
|
46
|
-
borderRadius
|
|
47
|
-
}
|
|
48
|
-
}, children));
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
var _default = (0, _theming.withTheme)(Elevation);
|
|
52
|
-
|
|
53
|
-
exports.default = _default;
|
|
54
|
-
//# sourceMappingURL=Elevation.js.mape
|
|
55
|
-
}, elevation ? (0, _shadow.default)(elevation) : null, style]
|
|
56
45
|
}), /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
57
46
|
style: {
|
|
58
47
|
overflow: "hidden",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Elevation.
|
|
1
|
+
{"version":3,"sources":["Elevation.tsx"],"names":["Elevation","style","theme","children","rest","elevation","borderRadius","radius","StyleSheet","flatten","colors","backgroundColor","surface","overflow"],"mappings":";;;;;;;AAAA;;AACA;;AAQA;;AACA;;;;;;;;;;AAQA;AACA,MAAMA,SAA0B,GAAG,QAAyC;AAAA,MAAxC;AAAEC,IAAAA,KAAF;AAASC,IAAAA,KAAT;AAAgBC,IAAAA,QAAhB;AAA0B,OAAGC;AAA7B,GAAwC;AAC1E,QAAM;AAAEC,IAAAA,SAAS,GAAG,CAAd;AAAiBC,IAAAA,YAAY,EAAEC;AAA/B,MACJC,wBAAWC,OAAX,CAAmBR,KAAnB,KAA6B,EAD/B;AAEA,QAAM;AAAES,IAAAA;AAAF,MAAaR,KAAnB;AACA,QAAMI,YAAY,GAAGC,MAArB;AAEA,sBACE,oBAAC,qBAAD,CAAU,IAAV,eACMH,IADN;AAEE,IAAA,KAAK,EAAE,CACL;AACEE,MAAAA,YADF;AAEEK,MAAAA,eAAe,EAAED,MAAM,CAACE;AAF1B,KADK,EAKLP,SAAS,GAAG,qBAAOA,SAAP,CAAH,GAAuB,IAL3B,EAMLJ,KANK;AAFT,mBAWE,oBAAC,iBAAD;AAAM,IAAA,KAAK,EAAE;AAAEY,MAAAA,QAAQ,EAAE,QAAZ;AAAsBP,MAAAA;AAAtB;AAAb,KAAoDH,QAApD,CAXF,CADF;AAeD,CArBD;;eAuBe,wBAAUH,SAAV,C","sourcesContent":["import * as React from \"react\";\nimport {\n Animated,\n StyleSheet,\n ViewProps,\n StyleProp,\n ViewStyle,\n View,\n} from \"react-native\";\nimport shadow from \"../styles/shadow\";\nimport { withTheme } from \"../theming\";\nimport type { Theme } from \"../styles/DefaultTheme\";\n\ntype Props = {\n style?: StyleProp<ViewStyle>;\n theme: Theme;\n} & ViewProps;\n\n/* directly copied from https://github.com/callstack/react-native-paper/blob/main/src/components/Surface.tsx#L62 */\nconst Elevation: React.FC<Props> = ({ style, theme, children, ...rest }) => {\n const { elevation = 4, borderRadius: radius } =\n StyleSheet.flatten(style) || {};\n const { colors } = theme;\n const borderRadius = radius;\n\n return (\n <Animated.View\n {...rest}\n style={[\n {\n borderRadius,\n backgroundColor: colors.surface,\n },\n elevation ? shadow(elevation) : null,\n style,\n ]}\n >\n <View style={{ overflow: \"hidden\", borderRadius }}>{children}</View>\n </Animated.View>\n );\n};\n\nexport default withTheme(Elevation);\n"]}
|
|
@@ -15,8 +15,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
15
15
|
|
|
16
16
|
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; }
|
|
17
17
|
|
|
18
|
-
function _extends() { _extends = Object.assign || 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); }
|
|
19
|
-
|
|
20
18
|
const FAB = _ref => {
|
|
21
19
|
let {
|
|
22
20
|
onPress,
|
|
@@ -40,7 +38,7 @@ const FAB = _ref => {
|
|
|
40
38
|
borderRadius: size / 2,
|
|
41
39
|
overflow: "hidden"
|
|
42
40
|
}, style]
|
|
43
|
-
}, /*#__PURE__*/React.createElement(_reactNative.Pressable,
|
|
41
|
+
}, /*#__PURE__*/React.createElement(_reactNative.Pressable, {
|
|
44
42
|
onPress: onPress,
|
|
45
43
|
disabled: loading || disabled,
|
|
46
44
|
android_ripple: {
|
|
@@ -58,8 +56,9 @@ const FAB = _ref => {
|
|
|
58
56
|
borderRadius: size / 2,
|
|
59
57
|
backgroundColor
|
|
60
58
|
}];
|
|
61
|
-
}
|
|
62
|
-
|
|
59
|
+
},
|
|
60
|
+
...props
|
|
61
|
+
}, /*#__PURE__*/React.createElement(_reactNative.View, null, loading ? /*#__PURE__*/React.createElement(_reactNative.ActivityIndicator, {
|
|
63
62
|
style: size > 50 ? {
|
|
64
63
|
marginTop: 2,
|
|
65
64
|
marginLeft: 2
|
|
@@ -89,5 +88,20 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
89
88
|
|
|
90
89
|
var _default = (0, _theming.withTheme)(FAB);
|
|
91
90
|
|
|
91
|
+
exports.default = _default;
|
|
92
|
+
//# sourceMappingURL=FAB.js.map backgroundColor: "#5a45ff",
|
|
93
|
+
justifyContent: "center",
|
|
94
|
+
alignItems: "center",
|
|
95
|
+
..._reactNative.Platform.select({
|
|
96
|
+
web: {
|
|
97
|
+
cursor: "pointer",
|
|
98
|
+
userSelect: "none"
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
var _default = (0, _theming.withTheme)(FAB);
|
|
105
|
+
|
|
92
106
|
exports.default = _default;
|
|
93
107
|
//# sourceMappingURL=FAB.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FAB.
|
|
1
|
+
{"version":3,"sources":["FAB.js"],"names":["FAB","onPress","disabled","loading","iconName","style","theme","iconColor","bgColor","size","Icon","props","backgroundColor","colors","primary","color","React","createElement","View","width","height","borderRadius","overflow","Pressable","android_ripple","radius","pressed","styles","button","opacity","ActivityIndicator","marginTop","marginLeft","undefined","name","StyleSheet","create","justifyContent","alignItems","Platform","select","web","cursor","userSelect"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;AACA,MAAMA,GAAG,GAAG,QAAiI;AAAA,MAAhI;AAAEC,IAAAA,OAAF;AAAWC,IAAAA,QAAX;AAAqBC,IAAAA,OAArB;AAA8BC,IAAAA,QAAQ,GAAG,mBAAzC;AAA8DC,IAAAA,KAA9D;AAAqEC,IAAAA,KAArE;AAA4EC,IAAAA,SAA5E;AAAuFC,IAAAA,OAAvF;AAAgGC,IAAAA,IAAI,GAAG,EAAvG;AAA2GC,IAAAA,IAA3G;AAAiH,OAAGC;AAApH,GAAgI;AACzI,QAA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MAAAA,UAAU,EAAE;AAA5B,KAAZ,GAA8CC,SAAvD;AAAkExB,IAAAA,IAAI,EAAEA,IAAI,IAAI,EAAR,GAAa,OAAb,GAAuB,OAA/F;AAAwGM,IAAAA,KAAK,EAAEA;AAA/G,GAAvC,CAAJ,gBAAuKC,KAAK,CAACC,aAAN,CAAoBP,IAApB,EAA0B;AAAEwB,IAAAA,IAAI,EAAE9B,QAAR;AAAkBK,IAAAA,IAAI,EAAEA,IAAxB;AAA8BM,IAAAA,KAAK,EAAEA;AAArC,GAA1B,CAA9M,CAfJ,CATI,CAAR;AAyBH,CA5BD;;AA6BA,MAAMY,MAAM,GAAGQ,wBAAWC,MAAX,CAAkB;AAC7BR,EAAAA,MAAM,EAAE;AACJhB,IAAAA,eAAe,EAAE,SADb;AAEJyB,IAAAA,cAAc,EAAE,QAFZ;AAGJC,IAAAA,UAAU,EAAE,QAHR;AAIJ,OAAGC,sBAASC,MAAT,CAAgB;AACfC,MAAAA,GAAG,EAAE;AACDC,QAAAA,MAAM,EAAE,SADP;AAEDC,QAAAA,UAAU,EAAE;AAFX;AADU,KAAhB;AAJC;AADqB,CAAlB,CAAf;;eAae,wBAAU3C,GAAV,C","sourcesContent":["import * as React from \"react\";\nimport { View, StyleSheet, Pressable, ActivityIndicator, Platform, } from \"react-native\";\nimport { withTheme } from \"../theming\";\nconst FAB = ({ onPress, disabled, loading, iconName = \"MaterialIcons/add\", style, theme, iconColor, bgColor, size = 50, Icon, ...props }) => {\n const backgroundColor = bgColor || theme.colors.primary;\n const color = iconColor || \"#FFF\";\n return (React.createElement(View, { style: [\n {\n width: size,\n height: size,\n borderRadius: size / 2,\n overflow: \"hidden\",\n },\n style,\n ] },\n React.createElement(Pressable, { onPress: onPress, disabled: loading || disabled, android_ripple: {\n color: \"#333\",\n radius: size / 4,\n }, style: ({ pressed }) => {\n return [\n styles.button,\n {\n opacity: pressed || disabled ? 0.75 : 1,\n width: size,\n height: size,\n borderRadius: size / 2,\n backgroundColor,\n },\n ];\n }, ...props },\n React.createElement(View, null, loading ? (React.createElement(ActivityIndicator, { style: size > 50 ? { marginTop: 2, marginLeft: 2 } : undefined, size: size <= 50 ? \"small\" : \"large\", color: color })) : (React.createElement(Icon, { name: iconName, size: size, color: color }))))));\n};\nconst styles = StyleSheet.create({\n button: {\n backgroundColor: \"#5a45ff\",\n justifyContent: \"center\",\n alignItems: \"center\",\n ...Platform.select({\n web: {\n cursor: \"pointer\",\n userSelect: \"none\",\n },\n }),\n },\n});\nexport default withTheme(FAB);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FieldSearchBarFull.
|
|
1
|
+
{"version":3,"sources":["FieldSearchBarFull.js"],"names":["FieldSearchBarFull","showIcon","Icon","icon","placeholder","style","theme","colors","typography","onChange","changeOverride","onSubmit","submitOverride","value","defaultValue","focused","setIsFocused","React","useState","onBlur","internalValue","setInternalValue","useEffect","useCallback","text","onFocus","e","lineHeight","typeStyles","body2","handleChangeText","newValue","createElement","View","styles","container","name","size","Config","fieldSearchBarFullIconSize","color","primary","light","marginLeft","flex","TextInput","clearButtonMode","onChangeText","onSubmitEditing","placeholderTextColor","medium","StyleSheet","create","flexDirection","alignItems"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;AACA,MAAMA,kBAAkB,GAAG,QAA2K;AAAA,MAA1K;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,IAAZ;AAAkBC,IAAAA,IAAI,GAAG,QAAzB;AAAmCC,IAAAA,WAAW,GAAG,EAAjD;AAAqDC,IAAAA,KAArD;AAA4DC,IAAAA,KAAK,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA;AAAV,KAAnE;AAA2FC,IAAAA,QAAQ,EAAEC,cAArG;AAAqHC,IAAAA,QAAQ,EAAEC,cAA/H;AAA+IC,IAAAA,KAA/I;AAAsJC,IAAAA;AAAtJ,GAA0K;AAClM,QAAM,CAACC,OAAD,EAAUC,YAAV,IAA0BC,KAAK,CAAC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import { View, TextInput, StyleSheet, } from \"react-native\";\nimport { withTheme } from \"../theming\";\nimport Config from \"./Config\";\nconst FieldSearchBarFull = ({ showIcon, Icon, icon = \"search\", placeholder = \"\", style, theme: { colors, typography }, onChange: changeOverride, onSubmit: submitOverride, value, defaultValue, }) => {\n const [focused, setIsFocused] = React.useState(false);\n const onBlur = () => {\n setIsFocused(false);\n };\n const [internalValue, setInternalValue] = React.useState(value || defaultValue);\n React.useEffect(() => {\n if (value != null) {\n setInternalValue(value);\n }\n }, [value]);\n React.useEffect(() => {\n if (defaultValue != null) {\n setInternalValue(defaultValue);\n }\n }, [defaultValue]);\n const onChange = React.useCallback((text) => {\n changeOverride && changeOverride(text);\n }, [changeOverride]);\n const onFocus = () => {\n setIsFocused(true);\n };\n const onSubmit = (e) => {\n submitOverride && submitOverride(e);\n };\n const { lineHeight, ...typeStyles } = typography.body2; // eslint-disable-line @typescript-eslint/no-unused-vars\n const handleChangeText = (newValue) => {\n setInternalValue(newValue);\n if (onChange) {\n onChange(newValue);\n }\n };\n return (React.createElement(View, { style: [styles.container, style] },\n showIcon && (React.createElement(Icon, { name: icon, size: Config.fieldSearchBarFullIconSize, color: focused ? colors.primary : colors.light })),\n React.createElement(View, { style: { marginLeft: showIcon ? 12 : 0, flex: 1 } },\n React.createElement(TextInput, { clearButtonMode: \"while-editing\", placeholder: placeholder, value: internalValue, onBlur: onBlur, onFocus: onFocus, onChangeText: handleChangeText, onSubmitEditing: onSubmit, placeholderTextColor: colors.light, style: [\n {\n color: colors.medium,\n },\n typeStyles,\n ] }))));\n};\nconst styles = StyleSheet.create({\n container: {\n flexDirection: \"row\",\n alignItems: \"center\",\n },\n});\nexport default withTheme(FieldSearchBarFull);\n"]}
|
|
@@ -5,11 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
10
|
var _reactNative = require("react-native");
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
var _lodash = require("lodash");
|
|
13
|
+
|
|
14
|
+
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); }
|
|
15
|
+
|
|
16
|
+
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
17
|
|
|
14
18
|
function _extends() { _extends = Object.assign || 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
19
|
|
|
@@ -20,44 +24,41 @@ const NumberInput = _ref => {
|
|
|
20
24
|
defaultValue,
|
|
21
25
|
...props
|
|
22
26
|
} = _ref;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const formatValueToStringNumber = (0, _react.useCallback)((valueToFormat, currentStringNumberValue) => {
|
|
28
|
+
if (valueToFormat != null) {
|
|
29
|
+
if ((0, _lodash.isString)(valueToFormat)) {
|
|
30
|
+
if (/^0[1-9]$/.test(valueToFormat)) {
|
|
31
|
+
return valueToFormat.slice(1);
|
|
32
|
+
} else if (currentStringNumberValue !== null && currentStringNumberValue !== void 0 && currentStringNumberValue.includes(".") && valueToFormat === currentStringNumberValue + ".") {
|
|
33
|
+
return currentStringNumberValue;
|
|
34
|
+
} else if (/^[+-]?([0-9]+\.?[0-9]*|\.[0-9]+)$/.test(valueToFormat)) {
|
|
35
|
+
return valueToFormat;
|
|
36
|
+
}
|
|
37
|
+
} else if ((0, _lodash.isNumber)(valueToFormat) && !(0, _lodash.isNaN)(valueToFormat)) {
|
|
38
|
+
return valueToFormat.toString();
|
|
39
|
+
}
|
|
29
40
|
}
|
|
30
|
-
|
|
41
|
+
|
|
42
|
+
return "0";
|
|
43
|
+
}, []);
|
|
44
|
+
const [stringNumberValue, setStringNumberValue] = (0, _react.useState)(formatValueToStringNumber(value));
|
|
31
45
|
|
|
32
46
|
const handleChangeText = newValue => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
onChangeText(number);
|
|
38
|
-
}
|
|
47
|
+
const newStringNumberValue = formatValueToStringNumber(newValue, stringNumberValue);
|
|
48
|
+
const number = parseFloat(newStringNumberValue);
|
|
49
|
+
setStringNumberValue(newStringNumberValue);
|
|
50
|
+
onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(number);
|
|
39
51
|
};
|
|
40
52
|
|
|
41
|
-
let strValue;
|
|
42
|
-
|
|
43
|
-
if (value != undefined) {
|
|
44
|
-
strValue = value.toString();
|
|
45
|
-
|
|
46
|
-
if (isDecimal && !strValue.includes(".")) {
|
|
47
|
-
strValue = `${strValue}.`;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
53
|
return /*#__PURE__*/_react.default.createElement(_reactNative.TextInput, _extends({
|
|
52
54
|
keyboardType: "numeric"
|
|
53
55
|
}, props, {
|
|
54
|
-
value:
|
|
55
|
-
defaultValue: defaultValue
|
|
56
|
+
value: stringNumberValue,
|
|
57
|
+
defaultValue: formatValueToStringNumber(defaultValue),
|
|
56
58
|
onChangeText: handleChangeText
|
|
57
59
|
}));
|
|
58
60
|
};
|
|
59
61
|
|
|
60
|
-
var _default = NumberInput;
|
|
61
|
-
|
|
62
|
+
var _default = NumberInput;
|
|
62
63
|
exports.default = _default;
|
|
63
64
|
//# sourceMappingURL=NumberInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["NumberInput.tsx"],"names":["NumberInput","onChangeText","value","defaultValue","props","
|
|
1
|
+
{"version":3,"sources":["NumberInput.tsx"],"names":["NumberInput","onChangeText","value","defaultValue","props","formatValueToStringNumber","valueToFormat","currentStringNumberValue","test","slice","includes","toString","stringNumberValue","setStringNumberValue","handleChangeText","newValue","newStringNumberValue","number","parseFloat"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;;;AAQA,MAAMA,WAA4B,GAAG,QAK/B;AAAA,MALgC;AACpCC,IAAAA,YADoC;AAEpCC,IAAAA,KAFoC;AAGpCC,IAAAA,YAHoC;AAIpC,OAAGC;AAJiC,GAKhC;AACJ,QAAMC,yBAAyB,GAAG,wBAChC,CAACC,aAAD,EAAkCC,wBAAlC,KAAwE;AACtE,QAAID,aAAa,IAAI,IAArB,EAA2B;AACzB,UAAI,sBAASA,aAAT,CAAJ,EAA6B;AAC3B,YAAI,WAAWE,IAAX,CAAgBF,aAAhB,CAAJ,EAAoC;AAClC,iBAAOA,aAAa,CAACG,KAAd,CAAoB,CAApB,CAAP;AACD,SAFD,MAEO,IACLF,wBAAwB,SAAxB,IAAAA,wBAAwB,WAAxB,IAAAA,wBAAwB,CAAEG,QAA1B,CAAmC,GAAnC,KACAJ,aAAa,KAAKC,wBAAwB,GAAG,GAFxC,EAGL;AACA,iBAAOA,wBAAP;AACD,SALM,MAKA,IAAI,oCAAoCC,IAApC,CAAyCF,aAAzC,CAAJ,EAA6D;AAClE,iBAAOA,aAAP;AACD;AACF,OAXD,MAWO,IAAI,sBAASA,aAAT,KAA2B,CAAC,mBAAMA,aAAN,CAAhC,EAAsD;AAC3D,eAAOA,aAAa,CAACK,QAAd,EAAP;AACD;AACF;;AAED,WAAO,GAAP;AACD,GApB+B,EAqBhC,EArBgC,CAAlC;AAwBA,QAAM,CAACC,iBAAD,EAAoBC,oBAApB,IAA4C,qBAChDR,yBAAyB,CAACH,KAAD,CADuB,CAAlD;;AAIA,QAAMY,gBAAgB,GAAIC,QAAD,IAAsB;AAC7C,UAAMC,oBAAoB,GAAGX,yBAAyB,CACpDU,QADoD,EAEpDH,iBAFoD,CAAtD;AAIA,UAAMK,MAAM,GAAGC,UAAU,CAACF,oBAAD,CAAzB;AAEAH,IAAAA,oBAAoB,CAACG,oBAAD,CAApB;AACAf,IAAAA,YAAY,SAAZ,IAAAA,YAAY,WAAZ,YAAAA,YAAY,CAAGgB,MAAH,CAAZ;AACD,GATD;;AAWA,sBACE,6BAAC,sBAAD;AACE,IAAA,YAAY,EAAC;AADf,KAEMb,KAFN;AAGE,IAAA,KAAK,EAAEQ,iBAHT;AAIE,IAAA,YAAY,EAAEP,yBAAyB,CAACF,YAAD,CAJzC;AAKE,IAAA,YAAY,EAAEW;AALhB,KADF;AASD,CAtDD;;eAwDed,W","sourcesContent":["import React, { useCallback, useState } from \"react\";\nimport { TextInput } from \"react-native\";\nimport { isString, isNumber, isNaN } from \"lodash\";\n\ninterface Props {\n value?: number | string;\n defaultValue?: number | string;\n onChangeText?: (value?: number) => void;\n}\n\nconst NumberInput: React.FC<Props> = ({\n onChangeText,\n value,\n defaultValue,\n ...props\n}) => {\n const formatValueToStringNumber = useCallback(\n (valueToFormat?: number | string, currentStringNumberValue?: string) => {\n if (valueToFormat != null) {\n if (isString(valueToFormat)) {\n if (/^0[1-9]$/.test(valueToFormat)) {\n return valueToFormat.slice(1);\n } else if (\n currentStringNumberValue?.includes(\".\") &&\n valueToFormat === currentStringNumberValue + \".\"\n ) {\n return currentStringNumberValue;\n } else if (/^[+-]?([0-9]+\\.?[0-9]*|\\.[0-9]+)$/.test(valueToFormat)) {\n return valueToFormat;\n }\n } else if (isNumber(valueToFormat) && !isNaN(valueToFormat)) {\n return valueToFormat.toString();\n }\n }\n\n return \"0\";\n },\n []\n );\n\n const [stringNumberValue, setStringNumberValue] = useState(\n formatValueToStringNumber(value)\n );\n\n const handleChangeText = (newValue: string) => {\n const newStringNumberValue = formatValueToStringNumber(\n newValue,\n stringNumberValue\n );\n const number = parseFloat(newStringNumberValue);\n\n setStringNumberValue(newStringNumberValue);\n onChangeText?.(number);\n };\n\n return (\n <TextInput\n keyboardType=\"numeric\"\n {...props}\n value={stringNumberValue}\n defaultValue={formatValueToStringNumber(defaultValue)}\n onChangeText={handleChangeText}\n />\n );\n};\n\nexport default NumberInput;\n"]}
|
|
@@ -11,6 +11,8 @@ var _Config = _interopRequireDefault(require("../Config"));
|
|
|
11
11
|
|
|
12
12
|
var _IconButton = _interopRequireDefault(require("../IconButton"));
|
|
13
13
|
|
|
14
|
+
var _utilities = require("../../utilities");
|
|
15
|
+
|
|
14
16
|
var _context = require("./context");
|
|
15
17
|
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -26,10 +28,10 @@ const RadioButton = _ref => {
|
|
|
26
28
|
Icon,
|
|
27
29
|
disabled = false,
|
|
28
30
|
color,
|
|
29
|
-
value,
|
|
31
|
+
value = "",
|
|
30
32
|
selected,
|
|
31
33
|
unselectedColor,
|
|
32
|
-
onPress
|
|
34
|
+
onPress,
|
|
33
35
|
size = _Config.default.radioButtonSize,
|
|
34
36
|
selectedIcon = "MaterialIcons/radio-button-checked",
|
|
35
37
|
unselectedIcon = "MaterialIcons/radio-button-unchecked",
|
|
@@ -40,16 +42,15 @@ const RadioButton = _ref => {
|
|
|
40
42
|
value: contextValue,
|
|
41
43
|
onValueChange
|
|
42
44
|
} = (0, _context.useRadioButtonGroupContext)();
|
|
45
|
+
const realValue = (0, _utilities.getValueForRadioButton)(value);
|
|
46
|
+
const realContextValue = (0, _utilities.getValueForRadioButton)(contextValue);
|
|
47
|
+
const isSelected = selected !== null && selected !== void 0 ? selected : realContextValue === realValue;
|
|
43
48
|
|
|
44
49
|
const handlePress = () => {
|
|
45
|
-
onPress
|
|
46
|
-
|
|
47
|
-
if (onValueChange && value) {
|
|
48
|
-
onValueChange(value);
|
|
49
|
-
}
|
|
50
|
+
onPress === null || onPress === void 0 ? void 0 : onPress(realValue);
|
|
51
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(realValue);
|
|
50
52
|
};
|
|
51
53
|
|
|
52
|
-
const isSelected = selected || contextValue != null && contextValue === value;
|
|
53
54
|
return /*#__PURE__*/React.createElement(_IconButton.default, _extends({
|
|
54
55
|
Icon: Icon,
|
|
55
56
|
icon: isSelected ? selectedIcon : unselectedIcon,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["RadioButton.tsx"],"names":["RadioButton","Icon","disabled","color","value","selected","unselectedColor","onPress","size","Config","radioButtonSize","selectedIcon","unselectedIcon","style","rest","contextValue","onValueChange","
|
|
1
|
+
{"version":3,"sources":["RadioButton.tsx"],"names":["RadioButton","Icon","disabled","color","value","selected","unselectedColor","onPress","size","Config","radioButtonSize","selectedIcon","unselectedIcon","style","rest","contextValue","onValueChange","realValue","realContextValue","isSelected","handlePress"],"mappings":";;;;;;;AAAA;;AAGA;;AACA;;AACA;;AACA;;;;;;;;;;AAiBA,MAAMA,WAAuC,GAAG,QAa1C;AAAA,MAb2C;AAC/CC,IAAAA,IAD+C;AAE/CC,IAAAA,QAAQ,GAAG,KAFoC;AAG/CC,IAAAA,KAH+C;AAI/CC,IAAAA,KAAK,GAAG,EAJuC;AAK/CC,IAAAA,QAL+C;AAM/CC,IAAAA,eAN+C;AAO/CC,IAAAA,OAP+C;AAQ/CC,IAAAA,IAAI,GAAGC,gBAAOC,eARiC;AAS/CC,IAAAA,YAAY,GAAG,oCATgC;AAU/CC,IAAAA,cAAc,GAAG,sCAV8B;AAW/CC,IAAAA,KAX+C;AAY/C,OAAGC;AAZ4C,GAa3C;AACJ,QAAM;AAAEV,IAAAA,KAAK,EAAEW,YAAT;AAAuBC,IAAAA;AAAvB,MAAyC,0CAA/C;AAEA,QAAMC,SAAS,GAAG,uCAAuBb,KAAvB,CAAlB;AACA,QAAMc,gBAAgB,GAAG,uCAAuBH,YAAvB,CAAzB;AACA,QAAMI,UAAU,GAAGd,QAAH,aAAGA,QAAH,cAAGA,QAAH,GAAea,gBAAgB,KAAKD,SAApD;;AAEA,QAAMG,WAAW,GAAG,MAAM;AACxBb,IAAAA,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAGU,SAAH,CAAP;AACAD,IAAAA,aAAa,SAAb,IAAAA,aAAa,WAAb,YAAAA,aAAa,CAAGC,SAAH,CAAb;AACD,GAHD;;AAKA,sBACE,oBAAC,mBAAD;AACE,IAAA,IAAI,EAAEhB,IADR;AAEE,IAAA,IAAI,EAAEkB,UAAU,GAAGR,YAAH,GAAkBC,cAFpC;AAGE,IAAA,KAAK,EAAEO,UAAU,GAAGhB,KAAH,GAAWG,eAH9B;AAIE,IAAA,QAAQ,EAAEJ,QAJZ;AAKE,IAAA,OAAO,EAAEkB,WALX;AAME,IAAA,IAAI,EAAEZ,IANR;AAOE,IAAA,KAAK,EAAEK;AAPT,KAQMC,IARN,EADF;AAYD,CArCD;;eAuCed,W","sourcesContent":["import * as React from \"react\";\nimport { StyleProp, ViewStyle } from \"react-native\";\n\nimport Config from \"../Config\";\nimport IconButton from \"../IconButton\";\nimport { getValueForRadioButton } from \"../../utilities\";\nimport { useRadioButtonGroupContext } from \"./context\";\n\nimport type { IconSlot } from \"../../interfaces/Icon\";\n\nexport type RadioButtonProps = {\n selected?: boolean;\n disabled?: boolean;\n color?: string;\n value?: string | number;\n unselectedColor?: string;\n onPress?: (value?: string) => void;\n style?: StyleProp<ViewStyle>;\n size?: number;\n selectedIcon?: string;\n unselectedIcon?: string;\n} & IconSlot;\n\nconst RadioButton: React.FC<RadioButtonProps> = ({\n Icon,\n disabled = false,\n color,\n value = \"\",\n selected,\n unselectedColor,\n onPress,\n size = Config.radioButtonSize,\n selectedIcon = \"MaterialIcons/radio-button-checked\",\n unselectedIcon = \"MaterialIcons/radio-button-unchecked\",\n style,\n ...rest\n}) => {\n const { value: contextValue, onValueChange } = useRadioButtonGroupContext();\n\n const realValue = getValueForRadioButton(value);\n const realContextValue = getValueForRadioButton(contextValue);\n const isSelected = selected ?? realContextValue === realValue;\n\n const handlePress = () => {\n onPress?.(realValue);\n onValueChange?.(realValue);\n };\n\n return (\n <IconButton\n Icon={Icon}\n icon={isSelected ? selectedIcon : unselectedIcon}\n color={isSelected ? color : unselectedColor}\n disabled={disabled}\n onPress={handlePress}\n size={size}\n style={style}\n {...rest}\n />\n );\n};\n\nexport default RadioButton;\n"]}
|
|
@@ -9,6 +9,8 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _reactNative = require("react-native");
|
|
11
11
|
|
|
12
|
+
var _utilities = require("../../utilities");
|
|
13
|
+
|
|
12
14
|
var _context = require("./context");
|
|
13
15
|
|
|
14
16
|
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); }
|
|
@@ -24,28 +26,27 @@ const {
|
|
|
24
26
|
const RadioButtonGroup = _ref => {
|
|
25
27
|
let {
|
|
26
28
|
direction = _context.Direction.Vertical,
|
|
27
|
-
value,
|
|
28
|
-
onValueChange
|
|
29
|
-
defaultValue,
|
|
29
|
+
value = "",
|
|
30
|
+
onValueChange,
|
|
31
|
+
defaultValue = "",
|
|
30
32
|
style,
|
|
31
33
|
children,
|
|
32
34
|
...rest
|
|
33
35
|
} = _ref;
|
|
34
|
-
const [internalValue, setInternalValue] = React.useState(
|
|
36
|
+
const [internalValue, setInternalValue] = React.useState("");
|
|
35
37
|
React.useEffect(() => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
38
|
+
const realValue = (0, _utilities.getValueForRadioButton)(value);
|
|
39
|
+
setInternalValue(realValue);
|
|
39
40
|
}, [value]);
|
|
40
41
|
React.useEffect(() => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
42
|
+
const realDefaultValue = (0, _utilities.getValueForRadioButton)(defaultValue);
|
|
43
|
+
setInternalValue(realDefaultValue);
|
|
44
44
|
}, [defaultValue]);
|
|
45
45
|
|
|
46
46
|
const handleValueChange = newValue => {
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
const realNewValue = (0, _utilities.getValueForRadioButton)(newValue);
|
|
48
|
+
setInternalValue(realNewValue);
|
|
49
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(realNewValue);
|
|
49
50
|
};
|
|
50
51
|
|
|
51
52
|
const _containerStyle = [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["RadioButtonGroup.tsx"],"names":["Provider","radioButtonGroupContext","RadioButtonGroup","direction","Direction","Vertical","value","onValueChange","defaultValue","style","children","rest","internalValue","setInternalValue","React","useState","useEffect","handleValueChange","newValue","_containerStyle","flexDirection","Horizontal","push","alignItems","minHeight"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;;;;;AAWA,MAAM;AAAEA,EAAAA;AAAF,IAAeC,gCAArB;;AAEA,MAAMC,gBAAiD,GAAG,QAQpD;AAAA,MARqD;AACzDC,IAAAA,SAAS,GAAGC,mBAAUC,QADmC;AAEzDC,IAAAA,
|
|
1
|
+
{"version":3,"sources":["RadioButtonGroup.tsx"],"names":["Provider","radioButtonGroupContext","RadioButtonGroup","direction","Direction","Vertical","value","onValueChange","defaultValue","style","children","rest","internalValue","setInternalValue","React","useState","useEffect","realValue","realDefaultValue","handleValueChange","newValue","realNewValue","_containerStyle","flexDirection","Horiz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AAe,CAACG,IAAhB,CAAqB;AACnBC,MAAAA,UAAU,EAAE;AADO,KAArB;AAGD;;AAED,sBACE,oBAAC,iBAAD;AAAM,IAAA,KAAK,EAAE,CAAC;AAAEC,MAAAA,SAAS,EAAE;AAAb,KAAD,EAAoBlB,KAApB;AAAb,KAA6CE,IAA7C,gBACE,oBAAC,QAAD;AACE,IAAA,KAAK,EAAE;AACLL,MAAAA,KAAK,EAAEM,aAAa,IAAI,EADnB;AAELL,MAAAA,aAAa,EAAEY,iBAFV;AAGLhB,MAAAA;AAHK;AADT,kBAOE,oBAAC,iBAAD;AAAM,IAAA,KAAK,EAAEmB;AAAb,KAA+BZ,QAA/B,CAPF,CADF,CADF;AAaD,CAvDD;;eAyDeR,gB","sourcesContent":["import * as React from \"react\";\nimport { View, StyleProp, ViewStyle } from \"react-native\";\nimport type { Theme } from \"../../styles/DefaultTheme\";\nimport { getValueForRadioButton } from \"../../utilities\";\nimport { radioButtonGroupContext, Direction } from \"./context\";\nexport interface RadioButtonGroupProps {\n direction?: Direction;\n style?: StyleProp<ViewStyle>;\n value: string;\n onValueChange?: (value: string) => void;\n defaultValue?: string | number;\n theme: Theme;\n children: React.ReactNode;\n}\n\nconst { Provider } = radioButtonGroupContext;\n\nconst RadioButtonGroup: React.FC<RadioButtonGroupProps> = ({\n direction = Direction.Vertical,\n value = \"\",\n onValueChange,\n defaultValue = \"\",\n style,\n children,\n ...rest\n}) => {\n const [internalValue, setInternalValue] = React.useState<string>(\"\");\n\n React.useEffect(() => {\n const realValue = getValueForRadioButton(value);\n\n setInternalValue(realValue);\n }, [value]);\n\n React.useEffect(() => {\n const realDefaultValue = getValueForRadioButton(defaultValue);\n\n setInternalValue(realDefaultValue);\n }, [defaultValue]);\n\n const handleValueChange = (newValue: string | number) => {\n const realNewValue = getValueForRadioButton(newValue);\n\n setInternalValue(realNewValue);\n onValueChange?.(realNewValue);\n };\n\n const _containerStyle: StyleProp<ViewStyle> = [\n {\n flexDirection: direction === Direction.Horizontal ? \"row\" : \"column\",\n },\n ];\n\n if (direction !== Direction.Vertical) {\n _containerStyle.push({\n alignItems: \"center\",\n });\n }\n\n return (\n <View style={[{ minHeight: 40 }, style]} {...rest}>\n <Provider\n value={{\n value: internalValue || \"\",\n onValueChange: handleValueChange,\n direction,\n }}\n >\n <View style={_containerStyle}>{children}</View>\n </Provider>\n </View>\n );\n};\n\nexport default RadioButtonGroup;\n"]}
|
|
@@ -59,10 +59,10 @@ const RadioButtonRow = _ref => {
|
|
|
59
59
|
let {
|
|
60
60
|
Icon,
|
|
61
61
|
label,
|
|
62
|
-
value,
|
|
62
|
+
value = "",
|
|
63
63
|
color,
|
|
64
64
|
unselectedColor,
|
|
65
|
-
onPress
|
|
65
|
+
onPress,
|
|
66
66
|
labelContainerStyle,
|
|
67
67
|
labelStyle,
|
|
68
68
|
radioButtonStyle,
|
|
@@ -77,10 +77,13 @@ const RadioButtonRow = _ref => {
|
|
|
77
77
|
onValueChange,
|
|
78
78
|
direction: parentDirection
|
|
79
79
|
} = (0, _context.useRadioButtonGroupContext)();
|
|
80
|
+
const realValue = (0, _utilities.getValueForRadioButton)(value);
|
|
81
|
+
const realContextValue = (0, _utilities.getValueForRadioButton)(contextValue);
|
|
82
|
+
const isSelected = selected !== null && selected !== void 0 ? selected : realContextValue === realValue;
|
|
80
83
|
|
|
81
84
|
const handlePress = () => {
|
|
82
|
-
onPress(
|
|
83
|
-
onValueChange
|
|
85
|
+
onPress === null || onPress === void 0 ? void 0 : onPress(realValue);
|
|
86
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(realValue);
|
|
84
87
|
};
|
|
85
88
|
|
|
86
89
|
const {
|
|
@@ -104,10 +107,10 @@ const RadioButtonRow = _ref => {
|
|
|
104
107
|
}
|
|
105
108
|
}, /*#__PURE__*/React.createElement(_RadioButton.default, {
|
|
106
109
|
Icon: Icon,
|
|
107
|
-
selected:
|
|
110
|
+
selected: isSelected,
|
|
111
|
+
value: realValue,
|
|
108
112
|
color: color,
|
|
109
113
|
unselectedColor: unselectedColor,
|
|
110
|
-
onPress: handlePress,
|
|
111
114
|
style: radioButtonStyle
|
|
112
115
|
})));
|
|
113
116
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["RadioButtonRow.tsx"],"names":["Direction","getRadioButtonAlignment","parentDirection","direction","GroupDirection","Horizontal","Row","RowReverse","renderLabel","value","labelStyle","textStyle","RadioButtonRow","Icon","label","color","unselectedColor","onPress","labelContainerStyle","radioButtonStyle","selected","disabled","style","rest","contextValue","onValueChange","handlePress","textStyles","viewStyles","styles","mainParent","flexDirection","alignItems","flex","StyleSheet","create","justifyContent","paddingStart","minHeight","paddingEnd","Platform","select","web","cursor","userSelect"],"mappings":";;;;;;;AAAA;;AACA;;AAQA;;AACA;;AACA;;AAGA;;AACA;;;;;;;;;;IAEYA,S;;;WAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;GAAAA,S,yBAAAA,S;;AAiBZ,MAAMC,uBAAuB,GAAG,CAC9BC,eAD8B,EAE9BC,SAF8B,KAG3B;AACH,MAAID,eAAe,KAAKE,mBAAeC,UAAvC,EAAmD;AACjD,WAAOF,SAAS,KAAKH,SAAS,CAACM,GAAxB,GAA8B,YAA9B,GAA6C,UAApD;AACD,GAFD,MAEO,IAAIH,SAAS,KAAKH,SAAS,CAACO,UAA5B,EAAwC;AAC7C,WAAO,YAAP;AACD,GAFM,MAEA;AACL,WAAO,UAAP;AACD;AACF,CAXD;;AAaA,MAAMC,WAAW,GAAG,CAClBC,KADkB,EAElBC,UAFkB,EAGlBC,SAHkB,KAIf;AACH,MAAI,OAAOF,KAAP,KAAiB,QAArB,EAA+B;AAC7B,wBAAO,oBAAC,aAAD;AAAM,MAAA,KAAK,EAAE,CAACC,UAAD,EAAaC,SAAb;AAAb,OAAuCF,KAAvC,CAAP;AACD,GAFD,MAEO;AACL,wBAAO,0CAAGA,KAAH,CAAP;AACD;AACF,CAVD;;AAYA,MAAMG,cAAwD,GAAG,QAe3D;AAAA,MAf4D;AAChEC,IAAAA,IADgE;AAEhEC,IAAAA,KAFgE;AAGhEL,IAAAA,
|
|
1
|
+
{"version":3,"sources":["RadioButtonRow.tsx"],"names":["Direction","getRadioButtonAlignment","parentDirection","direction","GroupDirection","Horizontal","Row","RowReverse","renderLabel","value","labelStyle","textStyle","RadioButtonRow","Icon","label","color","unselectedColor","onPress","labelContainerStyle","radioButtonStyle","selected","disabled","style","rest","contextValue","onValueChange","realValue","realContextValue","isSelected","handlePress","textStyles","viewStyles","styles","mainParent","flexDirection","alignItems","flex","StyleSheet","create","justifyContent","paddingStart","minHeight","paddingEnd","Platform","select","web","cursor","userSelect"],"mappings":";;;;;;;AAAA;;AACA;;AAQA;;AACA;;AACA;;AAGA;;AACA;;;;;;;;;;IAEYA,S;;;WAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;GAAAA,S,yBAAAA,S;;AAiBZ,MAAMC,uBAAuB,GAAG,CAC9BC,eAD8B,EAE9BC,SAF8B,KAG3B;AACH,MAAID,eAAe,KAAKE,mBAAeC,UAAvC,EAAmD;AACjD,WAAOF,SAAS,KAAKH,SAAS,CAACM,GAAxB,GAA8B,YAA9B,GAA6C,UAApD;AACD,GAFD,MAEO,IAAIH,SAAS,KAAKH,SAAS,CAACO,UAA5B,EAAwC;AAC7C,WAAO,YAAP;AACD,GAFM,MAEA;AACL,WAAO,UAAP;AACD;AACF,CAXD;;AAaA,MAAMC,WAAW,GAAG,CAClBC,KADkB,EAElBC,UAFkB,EAGlBC,SAHkB,KAIf;AACH,MAAI,OAAOF,KAAP,KAAiB,QAArB,EAA+B;AAC7B,wBAAO,oBAAC,aAAD;AAAM,MAAA,KAAK,EAAE,CAACC,UAAD,EAAaC,SAAb;AAAb,OAAuCF,KAAvC,CAAP;AACD,GAFD,MAEO;AACL,wBAAO,0CAAGA,KAAH,CAAP;AACD;AACF,CAVD;;AAYA,MAAMG,cAAwD,GAAG,QAe3D;AAAA,MAf4D;AAChEC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B,MAAAA,UAAU,EAAEhC,SAAS,KAAKH,SAAS,CAACM,GAAxB,GAA8B,YAA9B,GAA6C;AAD3D,KAFK,EAKLY,mBALK;AADT,KASGV,WAAW,CAACM,KAAD,EAAQJ,UAAR,EAAoBoB,UAApB,CATd,CANF,eAiBE,oBAAC,iBAAD;AACE,IAAA,KAAK,EAAE;AACLM,MAAAA,IAAI,EAAE,CADD;AAELD,MAAAA,UAAU,EAAElC,uBAAuB,CAACC,eAAD,EAAkBC,SAAlB;AAF9B;AADT,kBAME,oBAAC,oBAAD;AACE,IAAA,IAAI,EAAEU,IADR;AAEE,IAAA,QAAQ,EAAEe,UAFZ;AAGE,IAAA,KAAK,EAAEF,SAHT;AAIE,IAAA,KAAK,EAAEX,KAJT;AAKE,IAAA,eAAe,EAAEC,eALnB;AAME,IAAA,KAAK,EAAEG;AANT,IANF,CAjBF,CADF;AAmCD,CApED;;AAsEA,MAAMa,MAAM,GAAGK,wBAAWC,MAAX,CAAkB;AAC/BL,EAAAA,UAAU,EAAE;AACVE,IAAAA,UAAU,EAAE,QADF;AAEVI,IAAAA,cAAc,EAAE,cAFN;AAGVC,IAAAA,YAAY,EAAE,EAHJ;AAIVC,IAAAA,SAAS,EAAE,EAJD;AAKVC,IAAAA,UAAU,EAAE,EALF;AAMVN,IAAAA,IAAI,EAAE,CANI;AAOV,OAAGO,sBAASC,MAAT,CAAgB;AACjBC,MAAAA,GAAG,EAAE;AACHC,QAAAA,MAAM,EAAE,SADL;AAEHC,QAAAA,UAAU,EAAE;AAFT;AADY,KAAhB;AAPO,GADmB;AAe/BjC,EAAAA,KAAK,EAAE;AACLsB,IAAAA,IAAI,EAAE;AADD;AAfwB,CAAlB,CAAf;;eAoBexB,c","sourcesContent":["import * as React from \"react\";\nimport {\n StyleProp,\n ViewStyle,\n StyleSheet,\n TextStyle,\n View,\n Platform,\n} from \"react-native\";\nimport RadioButton, { RadioButtonProps } from \"./RadioButton\";\nimport Text from \"../Text\";\nimport { useRadioButtonGroupContext } from \"./context\";\nimport type { IconSlot } from \"../../interfaces/Icon\";\nimport { Direction as GroupDirection } from \"./context\";\nimport Touchable from \"../Touchable\";\nimport { extractStyles, getValueForRadioButton } from \"../../utilities\";\n\nexport enum Direction {\n Row = \"row\",\n RowReverse = \"row-reverse\",\n}\n\nexport interface RadioButtonRowProps extends Omit<RadioButtonProps, \"onPress\"> {\n label: string | React.ReactNode;\n value: string | number; // A string (or number that will be parsed String(number)) that this radio button row represents when selected\n color?: string;\n unselectedColor?: string;\n labelContainerStyle: StyleProp<ViewStyle>;\n radioButtonStyle?: StyleProp<ViewStyle>;\n labelStyle?: StyleProp<TextStyle>;\n onPress?: (value: string) => void;\n direction?: Direction;\n}\n\nconst getRadioButtonAlignment = (\n parentDirection: GroupDirection | undefined,\n direction: Direction\n) => {\n if (parentDirection === GroupDirection.Horizontal) {\n return direction === Direction.Row ? \"flex-start\" : \"flex-end\";\n } else if (direction === Direction.RowReverse) {\n return \"flex-start\";\n } else {\n return \"flex-end\";\n }\n};\n\nconst renderLabel = (\n value: string | React.ReactNode,\n labelStyle: StyleProp<TextStyle>,\n textStyle: StyleProp<TextStyle>\n) => {\n if (typeof value === \"string\") {\n return <Text style={[labelStyle, textStyle]}>{value}</Text>;\n } else {\n return <>{value}</>;\n }\n};\n\nconst RadioButtonRow: React.FC<RadioButtonRowProps & IconSlot> = ({\n Icon,\n label,\n value = \"\",\n color,\n unselectedColor,\n onPress,\n labelContainerStyle,\n labelStyle,\n radioButtonStyle,\n direction = Direction.Row,\n selected,\n disabled,\n style,\n ...rest\n}) => {\n const {\n value: contextValue,\n onValueChange,\n direction: parentDirection,\n } = useRadioButtonGroupContext();\n\n const realValue = getValueForRadioButton(value);\n const realContextValue = getValueForRadioButton(contextValue);\n const isSelected = selected ?? realContextValue === realValue;\n\n const handlePress = () => {\n onPress?.(realValue);\n onValueChange?.(realValue);\n };\n\n const { textStyles, viewStyles } = extractStyles(style);\n\n return (\n <Touchable\n onPress={handlePress}\n style={[styles.mainParent, { flexDirection: direction }, viewStyles]}\n disabled={disabled}\n {...rest}\n >\n <View\n style={[\n styles.label,\n {\n alignItems: direction === Direction.Row ? \"flex-start\" : \"flex-end\",\n },\n labelContainerStyle,\n ]}\n >\n {renderLabel(label, labelStyle, textStyles)}\n </View>\n <View\n style={{\n flex: 1,\n alignItems: getRadioButtonAlignment(parentDirection, direction),\n }}\n >\n <RadioButton\n Icon={Icon}\n selected={isSelected}\n value={realValue}\n color={color}\n unselectedColor={unselectedColor}\n style={radioButtonStyle}\n />\n </View>\n </Touchable>\n );\n};\n\nconst styles = StyleSheet.create({\n mainParent: {\n alignItems: \"center\",\n justifyContent: \"space-around\",\n paddingStart: 20,\n minHeight: 50,\n paddingEnd: 20,\n flex: 1,\n ...Platform.select({\n web: {\n cursor: \"pointer\",\n userSelect: \"none\",\n },\n }),\n },\n label: {\n flex: 3,\n },\n});\n\nexport default RadioButtonRow;\n"]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -357,18 +357,6 @@ Object.defineProperty(exports, "SwitchRow", {
|
|
|
357
357
|
return _Switch.SwitchRow;
|
|
358
358
|
}
|
|
359
359
|
});
|
|
360
|
-
Object.defineProperty(exports, "TabView", {
|
|
361
|
-
enumerable: true,
|
|
362
|
-
get: function () {
|
|
363
|
-
return _TabView.TabView;
|
|
364
|
-
}
|
|
365
|
-
});
|
|
366
|
-
Object.defineProperty(exports, "TabViewItem", {
|
|
367
|
-
enumerable: true,
|
|
368
|
-
get: function () {
|
|
369
|
-
return _TabView.TabViewItem;
|
|
370
|
-
}
|
|
371
|
-
});
|
|
372
360
|
Object.defineProperty(exports, "TextField", {
|
|
373
361
|
enumerable: true,
|
|
374
362
|
get: function () {
|
|
@@ -468,8 +456,6 @@ var _ActionSheet = require("./components/ActionSheet");
|
|
|
468
456
|
|
|
469
457
|
var _Swiper = require("./components/Swiper");
|
|
470
458
|
|
|
471
|
-
var _TabView = require("./components/TabView");
|
|
472
|
-
|
|
473
459
|
var _Layout = require("./components/Layout");
|
|
474
460
|
|
|
475
461
|
var _index = require("./components/RadioButton/index");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAEA;;AASA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["export { injectIcon } from \"./interfaces/Icon\";\nexport { withTheme, ThemeProvider } from \"./theming\";\nexport { default as Provider } from \"./Provider\";\nexport { default as DefaultTheme } from \"./styles/DefaultTheme\";\n\nexport { Link } from \"./components/Text\";\nexport { ButtonSolid, ButtonOutline } from \"./components/Button\";\nexport { default as Avatar } from \"./components/CircleImage\";\nexport { default as AvatarEdit } from \"./components/AvatarEdit\";\nexport { default as Card } from \"./components/Card\";\nexport { default as Carousel } from \"./components/Carousel\";\nexport { Checkbox, CheckboxGroup, CheckboxRow } from \"./components/Checkbox\";\nexport { default as CircleImage } from \"./components/CircleImage\";\nexport { default as Container } from \"./components/Container\";\nexport { default as Divider } from \"./components/Divider\";\nexport { default as FAB } from \"./components/FAB\";\nexport { default as FieldSearchBarFull } from \"./components/FieldSearchBarFull\";\nexport { default as IconButton } from \"./components/IconButton\";\nexport { default as Image } from \"./components/Image\";\nexport { default as NumberInput } from \"./components/NumberInput\";\nexport { default as ScreenContainer } from \"./components/ScreenContainer\";\nexport { default as StarRating } from \"./components/StarRating\";\nexport { default as Surface } from \"./components/Surface\";\nexport { default as Switch, SwitchRow } from \"./components/Switch\";\nexport { default as TextField } from \"./components/TextField\";\nexport { default as ToggleButton } from \"./components/ToggleButton\";\nexport { default as Touchable } from \"./components/Touchable\";\nexport { AccordionGroup, AccordionItem } from \"./components/Accordion\";\nexport {\n ActionSheet,\n ActionSheetItem,\n ActionSheetCancel,\n} from \"./components/ActionSheet\";\nexport { Swiper, SwiperItem } from \"./components/Swiper\";\n\nexport {\n Center,\n Circle,\n Square,\n Row,\n Stack,\n Spacer,\n} from \"./components/Layout\";\n\nexport {\n RadioButton,\n RadioButtonGroup,\n RadioButtonRow,\n RadioButtonFieldGroup,\n} from \"./components/RadioButton/index\";\n\n/* Deprecated: Fix or Delete! */\nexport { default as Button } from \"./components/DeprecatedButton\";\nexport { default as CardBlock } from \"./components/CardBlock\";\nexport { default as CardContainer } from \"./components/CardContainer\";\nexport { default as CardContainerRating } from \"./components/CardContainerRating\";\nexport { default as CardInline } from \"./components/CardInline\";\nexport { default as DatePicker } from \"./components/DatePicker/DatePicker\";\nexport { default as HeaderLarge } from \"./components/HeaderLarge\";\nexport { default as HeaderMedium } from \"./components/HeaderMedium\";\nexport { default as HeaderOverline } from \"./components/HeaderOverline\";\nexport { default as Picker } from \"./components/Picker/Picker\";\nexport { default as ProgressBar } from \"./components/ProgressBar\";\nexport { default as ProgressCircle } from \"./components/ProgressCircle\";\nexport { default as RowBodyIcon } from \"./components/RowBodyIcon\";\nexport { default as RowHeadlineImageCaption } from \"./components/RowHeadlineImageCaption\";\nexport { default as RowHeadlineImageIcon } from \"./components/RowHeadlineImageIcon\";\nexport { default as Slider } from \"./components/Slider\";\nexport { default as Stepper } from \"./components/Stepper\";\nexport { useAuthState } from \"./components/useAuthState\";\n"]}
|
|
@@ -30,7 +30,7 @@ const SEED_DATA = {
|
|
|
30
30
|
}),
|
|
31
31
|
direction: (0, _types.createRowDirectionProp)(),
|
|
32
32
|
fieldName: (0, _types.createFieldNameProp)({
|
|
33
|
-
defaultValue: "
|
|
33
|
+
defaultValue: "checkboxRowValue",
|
|
34
34
|
valuePropName: "value",
|
|
35
35
|
handlerPropName: "onPress"
|
|
36
36
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["CheckboxRow.ts"],"names":["SEED_DATA","name","tag","category","COMPONENT_TYPES","input","layout","minHeight","triggers","Triggers","OnPress","props","label","description","required","defaultValue","labelStyle","editable","direction","fieldName","valuePropName","handlerPropName","color","uncheckedColor"],"mappings":";;;;;;;AAAA;;AAUO,MAAMA,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,cADiB;AAEvBC,EAAAA,GAAG,EAAE,aAFkB;AAGvBC,EAAAA,QAAQ,EAAEC,uBAAgBC,KAHH;AAIvBC,EAAAA,MAAM,EAAE;AACNC,IAAAA,SAAS,EAAE;AADL,GAJe;AAOvBC,EAAAA,QAAQ,EAAE,CAACC,gBAASC,OAAV,CAPa;AAQvBC,EAAAA,KAAK,EAAE;AACLC,IAAAA,KAAK,EAAE,2BAAe;AACpBA,MAAAA,KAAK,EAAE,OADa;AAEpBC,MAAAA,WAAW,EAAE,iCAFO;AAGpBC,MAAAA,QAAQ,EAAE,IAHU;AAIpBC,MAAAA,YAAY,EAAE;AAJM,KAAf,CADF;AAOLC,IAAAA,UAAU,EAAE,4BAAgB;AAC1BJ,MAAAA,KAAK,EAAE,aADmB;AAE1BC,MAAAA,WAAW,EAAE,gCAFa;AAG1BC,MAAAA,QAAQ,EAAE,KAHgB;AAI1BG,MAAAA,QAAQ,EAAE;AAJgB,KAAhB,CAPP;AAaLC,IAAAA,SAAS,EAAE,oCAbN;AAcLC,IAAAA,SAAS,EAAE,gCAAoB;AAC7BJ,MAAAA,YAAY,EAAE,
|
|
1
|
+
{"version":3,"sources":["CheckboxRow.ts"],"names":["SEED_DATA","name","tag","category","COMPONENT_TYPES","input","layout","minHeight","triggers","Triggers","OnPress","props","label","description","required","defaultValue","labelStyle","editable","direction","fieldName","valuePropName","handlerPropName","color","uncheckedColor"],"mappings":";;;;;;;AAAA;;AAUO,MAAMA,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,cADiB;AAEvBC,EAAAA,GAAG,EAAE,aAFkB;AAGvBC,EAAAA,QAAQ,EAAEC,uBAAgBC,KAHH;AAIvBC,EAAAA,MAAM,EAAE;AACNC,IAAAA,SAAS,EAAE;AADL,GAJe;AAOvBC,EAAAA,QAAQ,EAAE,CAACC,gBAASC,OAAV,CAPa;AAQvBC,EAAAA,KAAK,EAAE;AACLC,IAAAA,KAAK,EAAE,2BAAe;AACpBA,MAAAA,KAAK,EAAE,OADa;AAEpBC,MAAAA,WAAW,EAAE,iCAFO;AAGpBC,MAAAA,QAAQ,EAAE,IAHU;AAIpBC,MAAAA,YAAY,EAAE;AAJM,KAAf,CADF;AAOLC,IAAAA,UAAU,EAAE,4BAAgB;AAC1BJ,MAAAA,KAAK,EAAE,aADmB;AAE1BC,MAAAA,WAAW,EAAE,gCAFa;AAG1BC,MAAAA,QAAQ,EAAE,KAHgB;AAI1BG,MAAAA,QAAQ,EAAE;AAJgB,KAAhB,CAPP;AAaLC,IAAAA,SAAS,EAAE,oCAbN;AAcLC,IAAAA,SAAS,EAAE,gCAAoB;AAC7BJ,MAAAA,YAAY,EAAE,kBADe;AAE7BK,MAAAA,aAAa,EAAE,OAFc;AAG7BC,MAAAA,eAAe,EAAE;AAHY,KAApB,CAdN;AAmBLC,IAAAA,KAAK,EAAE,4BAAgB;AACrBT,MAAAA,WAAW,EAAE;AADQ,KAAhB,CAnBF;AAsBLU,IAAAA,cAAc,EAAE,4BAAgB;AAC9BX,MAAAA,KAAK,EAAE,kBADuB;AAE9BC,MAAAA,WAAW,EAAE;AAFiB,KAAhB;AAtBX;AARgB,CAAlB","sourcesContent":["import {\n createTextProp,\n createTextStyle,\n createRowDirectionProp,\n createFieldNameProp,\n COMPONENT_TYPES,\n Triggers,\n createColorProp,\n} from \"@draftbit/types\";\n\nexport const SEED_DATA = {\n name: \"Checkbox Row\",\n tag: \"CheckboxRow\",\n category: COMPONENT_TYPES.input,\n layout: {\n minHeight: 50,\n },\n triggers: [Triggers.OnPress],\n props: {\n label: createTextProp({\n label: \"Label\",\n description: \"Label to show with the checkbox\",\n required: true,\n defaultValue: \"First Option\",\n }),\n labelStyle: createTextStyle({\n label: \"Label Style\",\n description: \"Change the styles of the label\",\n required: false,\n editable: false,\n }),\n direction: createRowDirectionProp(),\n fieldName: createFieldNameProp({\n defaultValue: \"checkboxRowValue\",\n valuePropName: \"value\",\n handlerPropName: \"onPress\",\n }),\n color: createColorProp({\n description: \"Color for the button (used when the checkbox is checked)\",\n }),\n uncheckedColor: createColorProp({\n label: \"Unselected Color\",\n description: \"Color for the button when the checkbox is unchecked\",\n }),\n },\n};\n"]}
|