@draftbit/core 43.4.4 → 43.4.5-c7a710.1
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/CardInline.js.map +1 -1
- package/lib/commonjs/components/DatePicker/DatePickerComponent.js.map +1 -1
- package/lib/commonjs/components/FieldSearchBarFull.js.map +1 -1
- package/lib/commonjs/components/FormRow.js +5 -18
- package/lib/commonjs/components/FormRow.js.map +1 -1
- package/lib/commonjs/components/NumberInput.js +4 -13
- package/lib/commonjs/components/NumberInput.js.map +1 -1
- package/lib/commonjs/components/Picker/PickerComponent.android.js +6 -20
- package/lib/commonjs/components/Picker/PickerComponent.android.js.map +1 -1
- package/lib/commonjs/components/Portal/PortalManager.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 +14 -13
- package/lib/commonjs/components/RadioButton/RadioButtonGroup.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButtonRow.js +13 -10
- package/lib/commonjs/components/RadioButton/RadioButtonRow.js.map +1 -1
- package/lib/commonjs/components/RadioButton/index.js.map +1 -1
- package/lib/commonjs/components/ResizeMode.js +1 -2
- package/lib/commonjs/components/Swiper/Swiper.js.map +1 -1
- package/lib/commonjs/components/Touchable.js +3 -16
- package/lib/commonjs/components/Touchable.js.map +1 -1
- package/lib/commonjs/mappings/SafeAreaView.js.map +1 -1
- package/lib/commonjs/mappings/StarRating.js +2 -6
- package/lib/commonjs/mappings/StarRating.js.map +1 -1
- package/lib/commonjs/mappings/Surface.js.map +1 -1
- package/lib/commonjs/mappings/WebView.js.map +1 -1
- package/lib/commonjs/utilities.js +13 -0
- package/lib/commonjs/utilities.js.map +1 -1
- package/lib/module/components/Header.js.map +1 -1
- package/lib/module/components/Picker/PickerComponent.web.js +17 -3
- package/lib/module/components/Picker/PickerComponent.web.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 +13 -13
- package/lib/module/components/RadioButton/RadioButtonGroup.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButtonRow.js +14 -11
- package/lib/module/components/RadioButton/RadioButtonRow.js.map +1 -1
- package/lib/module/mappings/BlurView.js.map +1 -1
- package/lib/module/mappings/CardContainerShortImage.js.map +1 -1
- package/lib/module/utilities.js +10 -0
- package/lib/module/utilities.js.map +1 -1
- 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/utilities.d.ts +1 -0
- package/package.json +2 -2
- package/src/components/RadioButton/RadioButton.js +7 -6
- package/src/components/RadioButton/RadioButton.tsx +11 -12
- package/src/components/RadioButton/RadioButtonGroup.js +11 -11
- package/src/components/RadioButton/RadioButtonGroup.tsx +19 -18
- package/src/components/RadioButton/RadioButtonRow.js +12 -9
- package/src/components/RadioButton/RadioButtonRow.tsx +16 -14
- package/src/utilities.js +12 -0
- package/src/utilities.ts +11 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["CardInline.
|
|
1
|
+
{"version":3,"sources":["CardInline.tsx"],"names":["CardInline","image","Config","cardImageUrl","title","subtitle","aspectRatio","elevation","style","titleStyle","subtitleStyle","onPress","alignItems","justifyContent","width","height","StyleSheet","flatten","imageStyles","pressed","opacity","uri","styles","overlay","color","create","position","top","bottom","left","right","padding","backgroundColor"],"mappings":";;;;;;;AACA;;AACA;;AASA;;AACA;;AACA;;AACA;;AACA;;;;AAfA;AA+BA,MAAMA,UAA2B,GAAG,QAU9B;AAAA,MAV+B;AACnCC,IAAAA,KAAK,GAAGC,gBAAOC,YADoB;AAEnCC,IAAAA,KAFmC;AAGnCC,I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B,MAAAA,KAAK,EAAE;AAAT,KAAD,EAAqBf,UAArB,CAAd;AAAgD,IAAA,IAAI,EAAEL;AAAtD,IADI,GAEF,IAHN,EAIGC,QAAQ,gBACP,6BAAC,oBAAD;AACE,IAAA,KAAK,EAAE,CAAC;AAAEmB,MAAAA,KAAK,EAAE;AAAT,KAAD,EAAwCd,aAAxC,CADT;AAEE,IAAA,IAAI,EAAEL;AAFR,IADO,GAKL,IATN,CAhBF,CADF,CADF;AAgCD,CA/CD;;AAiDA,MAAMiB,MAAM,GAAGN,wBAAWS,MAAX,CAAkB;AAC/BF,EAAAA,OAAO,EAAE;AACPG,IAAAA,QAAQ,EAAE,UADH;AAEPC,IAAAA,GAAG,EAAE,CAFE;AAGPC,IAAAA,MAAM,EAAE,CAHD;AAIPC,IAAAA,IAAI,EAAE,CAJC;AAKPC,IAAAA,KAAK,EAAE,CALA;AAMPC,IAAAA,OAAO,EAAE,EANF;AAOPC,IAAAA,eAAe,EAAE;AAPV;AADsB,CAAlB,CAAf;;eAYe,wBAAUhC,UAAV,C","sourcesContent":["// @ts-nocheck\nimport React from \"react\";\nimport {\n Pressable,\n View,\n ImageSourcePropType,\n StyleProp,\n ViewStyle,\n TextStyle,\n StyleSheet,\n} from \"react-native\";\nimport { Title, Subtitle } from \"./Typography\";\nimport Image from \"./Image\";\nimport Surface from \"./Surface\";\nimport Config from \"./Config\";\nimport { withTheme } from \"../theming\";\nimport theme from \"../styles/DefaultTheme\";\n\ntype Props = {\n image?: string | ImageSourcePropType;\n title?: string;\n subtitle?: string;\n aspectRatio?: number;\n elevation?: number;\n theme: typeof theme;\n style?: StyleProp<ViewStyle>;\n titleStyle?: StyleProp<TextStyle>;\n subtitleStyle?: StyleProp<TextStyle>;\n onPress: () => void;\n};\n\nconst CardInline: React.FC<Props> = ({\n image = Config.cardImageUrl,\n title,\n subtitle,\n aspectRatio = 1.5,\n elevation = 2,\n style,\n titleStyle,\n subtitleStyle,\n onPress,\n}) => {\n const { alignItems, justifyContent, width, height } = StyleSheet.flatten(\n style || {}\n );\n const imageStyles = width && height ? { width, height } : { aspectRatio };\n return (\n <Surface style={[{ elevation }, style]}>\n <Pressable\n disabled={!onPress}\n onPress={onPress}\n style={({ pressed }) => {\n return [\n {\n opacity: pressed ? 0.8 : 1,\n },\n ];\n }}\n >\n <Image\n style={imageStyles}\n source={typeof image === \"string\" ? { uri: image } : image}\n resizeMode=\"cover\"\n />\n <View style={[styles.overlay, { justifyContent, alignItems }]}>\n {title ? (\n <Title style={[{ color: \"white\" }, titleStyle]} text={title} />\n ) : null}\n {subtitle ? (\n <Subtitle\n style={[{ color: \"rgba(255, 255, 255, 0.7)\" }, subtitleStyle]}\n text={subtitle}\n />\n ) : null}\n </View>\n </Pressable>\n </Surface>\n );\n};\n\nconst styles = StyleSheet.create({\n overlay: {\n position: \"absolute\",\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n padding: 16,\n backgroundColor: \"rgba(0, 0, 0, 0.2)\",\n },\n});\n\nexport default withTheme(CardInline);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DatePickerComponent.
|
|
1
|
+
{"version":3,"sources":["DatePickerComponent.tsx"],"names":["DatePickerComponent","value","onChange","mode","toggleVisibility","Platform","OS","console","log","data"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AAGA,MAAMA,mBAAoC,GAAG,QAKvC;AAAA,MALwC;AAC5CC,IAAAA,KAD4C;AAE5CC,IAAAA,QAF4C;AAG5CC,IAAAA,IAH4C;AAI5CC,IAAAA;AAJ4C,GAKxC;AACJ,SAAOC,sBAASC,EAAT,KAAgB,KAAhB,IAAyBD,sBAASC,EAAT,KAAgB,SAAzC,gBACL,6BAAC,uCAAD;AACE,IAAA,IAAI,EAAEL,KADR;AAEE,IAAA,IAAI,EAAEE,IAFR;AAGE,IAAA,SAAS,EAAE,IAHb;AAIE,IAAA,OAAO,EAAEE,sBAASC,EAAT,KAAgB,KAAhB,GAAwB,SAAxB,GAAoC,SAJ/C;AAKE,IAAA,QAAQ,EAAE,MAAM;AACdC,MAAAA,OAAO,CAACC,GAAR,CAAY,6CAAZ;AACAJ,MAAAA,gBAAgB;AACjB,KARH;AASE,IAAA,SAAS,EAAGK,IAAD,IAAU;AACnBP,MAAAA,QAAQ,CAAC,IAAD,EAAOO,IAAP,CAAR;AACD;AAXH,IADK,gBAeL,6BAAC,uBAAD;AACE,IAAA,KAAK,EAAER,KADT;AAEE,IAAA,IAAI,EAAEE,IAFR;AAGE,IAAA,QAAQ,EAAED,QAHZ;AAIE,IAAA,OAAO,EAAE;AAJX,IAfF;AAsBD,CA5BD;;eA8BeF,mB","sourcesContent":["import React from \"react\";\nimport { Platform } from \"react-native\";\nimport DateTimePicker from \"@react-native-community/datetimepicker\";\nimport DateTimePickerModal from \"react-native-modal-datetime-picker\";\nimport { DatePickerComponentProps as Props } from \"./DatePickerComponentType\";\n\nconst DatePickerComponent: React.FC<Props> = ({\n value,\n onChange,\n mode,\n toggleVisibility,\n}) => {\n return Platform.OS === \"ios\" || Platform.OS === \"android\" ? (\n <DateTimePickerModal\n date={value}\n mode={mode}\n isVisible={true}\n display={Platform.OS === \"ios\" ? \"spinner\" : \"default\"}\n onCancel={() => {\n console.log(\"Picker cancelled before selecting anything.\");\n toggleVisibility();\n }}\n onConfirm={(data) => {\n onChange(null, data);\n }}\n />\n ) : (\n <DateTimePicker\n value={value}\n mode={mode}\n onChange={onChange}\n display={\"default\"}\n />\n );\n};\n\nexport default DatePickerComponent;\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,CAACC,QAAN,CAAe,KAAf,CAAhC;;AACA,QAAMC,MAAM,GAAG,MAAM;AACjBH,IAAAA,YAAY,CAAC,KAAD,CAAZ;AACH,GAFD;;AAGA,QAAM,CAACI,aAAD,EAAgBC,gBAAhB,IAAoCJ,KAAK,CAACC,QAAN,CAAeL,KAAK,IAAIC,YAAxB,CAA1C;AACAG,EAAAA,KAAK,CAACK,SAAN,CAAgB,MAAM;AAClB,QAAIT,KAAK,IAAI,IAAb,EAAmB;AACfQ,MAAAA,gBAAgB,CAACR,KAAD,CAAhB;AACH;AACJ,GAJD,EAIG,CAACA,KAAD,CAJH;AAKAI,EAAAA,KAAK,CAACK,SAAN,CAAgB,MAAM;AAClB,QAAIR,YAAY,IAAI,IAApB,EAA0B;AACtBO,MAAAA,gBAAgB,CAACP,YAAD,CAAhB;AACH;AACJ,GAJD,EAIG,CAACA,YAAD,CAJH;AAKA,QAAML,QAAQ,GAAGQ,KAAK,CAACM,WAAN,CAAmBC,IAAD,IAAU;AACzC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AAEA,WAAjD;AAA8DS,IAAAA,KAAK,EAAEO,aAArE;AAAoFD,IAAAA,MAAM,EAAEA,MAA5F;AAAoGM,IAAAA,OAAO,EAAEA,OAA7G;AAAsHsB,IAAAA,YAAY,EAAEjB,gBAApI;AAAsJkB,IAAAA,eAAe,EAAErC,QAAvK;AAAiLsC,IAAAA,oBAAoB,EAAE1C,MAAM,CAACmC,KAA9M;AAAqNrC,IAAAA,KAAK,EAAE,CACnP;AACImC,MAAAA,KAAK,EAAEjC,MAAM,CAAC2C;AADlB,KADmP,EAInPtB,UAJmP;AAA5N,GAA/B,CADJ,CAFI,CAAR;AASH,CAzCD;;AA0CA,MAAMM,MAAM,GAAGiB,wBAAWC,MAAX,CAAkB;AAC7BjB,EAAAA,SAAS,EAAE;AACPkB,IAAAA,aAAa,EAAE,KADR;AAEPC,IAAAA,UAAU,EAAE;AAFL;AADkB,CAAlB,CAAf;;eAMe,wBAAUtD,kBAAV,C","sourcesContent":["import * as React from \"react\";\nimport { 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"]}
|
|
@@ -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
|
function FormRow(_ref) {
|
|
23
25
|
let {
|
|
24
26
|
disabled,
|
|
@@ -33,28 +35,13 @@ function FormRow(_ref) {
|
|
|
33
35
|
textStyles,
|
|
34
36
|
viewStyles
|
|
35
37
|
} = (0, _utilities.extractStyles)(style);
|
|
36
|
-
return /*#__PURE__*/React.createElement(_Touchable.default, {
|
|
38
|
+
return /*#__PURE__*/React.createElement(_Touchable.default, _extends({
|
|
37
39
|
disabled: disabled,
|
|
38
40
|
onPress: onPress,
|
|
39
41
|
style: [styles.row, {
|
|
40
42
|
flexDirection: direction
|
|
41
|
-
}, viewStyles]
|
|
42
|
-
|
|
43
|
-
}, /*#__PURE__*/React.createElement(_reactNative.Text, {
|
|
44
|
-
style: textStyles
|
|
45
|
-
}, label), children);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const styles = _reactNative.StyleSheet.create({
|
|
49
|
-
row: {
|
|
50
|
-
marginLeft: 8,
|
|
51
|
-
marginRight: 8,
|
|
52
|
-
flexDirection: "row",
|
|
53
|
-
justifyContent: "space-between",
|
|
54
|
-
alignItems: "center"
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
//# sourceMappingURL=FormRow.js.mapE__*/React.createElement(_reactNative.Text, {
|
|
43
|
+
}, viewStyles]
|
|
44
|
+
}, rest), /*#__PURE__*/React.createElement(_reactNative.Text, {
|
|
58
45
|
style: textStyles
|
|
59
46
|
}, label), children);
|
|
60
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FormRow.
|
|
1
|
+
{"version":3,"sources":["FormRow.tsx"],"names":["FormRow","disabled","direction","children","label","style","onPress","rest","textStyles","viewStyles","styles","row","flexDirection","StyleSheet","create","marginLeft","marginRight","justifyContent","alignItems"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;;;;;AAWe,SAASA,OAAT,OAQL;AAAA,MARsB;AAC9BC,IAAAA,QAD8B;AAE9BC,IAAAA,SAF8B;AAG9BC,IAAAA,QAH8B;AAI9BC,IAAAA,KAJ8B;AAK9BC,IAAAA,KAL8B;AAM9BC,IAAAA,OAN8B;AAO9B,OAAGC;AAP2B,GAQtB;AACR,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAA6B,8BAAcJ,KAAd,CAAnC;AACA,sBACE,oBAAC,kBAAD;AACE,IAAA,QAAQ,EAAEJ,QADZ;AAEE,IAAA,OAAO,EAAEK,OAFX;AAGE,IAAA,KAAK,EAAE,CAACI,MAAM,CAACC,GAAR,EAAa;AAAEC,MAAAA,aAAa,EAAEV;AAAjB,KAAb,EAA2CO,UAA3C;AAHT,KAIMF,IAJN,gBAME,oBAAC,iBAAD;AAAM,IAAA,KAAK,EAAEC;AAAb,KAA0BJ,KAA1B,CANF,EAOGD,QAPH,CADF;AAWD;;AAED,MAAMO,MAAM,GAAGG,wBAAWC,MAAX,CAAkB;AAC/BH,EAAAA,GAAG,EAAE;AACHI,IAAAA,UAAU,EAAE,CADT;AAEHC,IAAAA,WAAW,EAAE,CAFV;AAGHJ,IAAAA,aAAa,EAAE,KAHZ;AAIHK,IAAAA,cAAc,EAAE,eAJb;AAKHC,IAAAA,UAAU,EAAE;AALT;AAD0B,CAAlB,CAAf","sourcesContent":["import * as React from \"react\";\nimport { Text, StyleProp, ViewStyle, StyleSheet } from \"react-native\";\nimport { RowDirection } from \"@draftbit/types\";\nimport { extractStyles } from \"../utilities\";\nimport Touchable from \"./Touchable\";\n\ntype Props = {\n disabled?: boolean;\n label: string;\n direction: RowDirection;\n children: React.ReactNode;\n style?: StyleProp<ViewStyle>;\n onPress: () => void;\n};\n\nexport default function FormRow({\n disabled,\n direction,\n children,\n label,\n style,\n onPress,\n ...rest\n}: Props) {\n const { textStyles, viewStyles } = extractStyles(style);\n return (\n <Touchable\n disabled={disabled}\n onPress={onPress}\n style={[styles.row, { flexDirection: direction }, viewStyles]}\n {...rest}\n >\n <Text style={textStyles}>{label}</Text>\n {children}\n </Touchable>\n );\n}\n\nconst styles = StyleSheet.create({\n row: {\n marginLeft: 8,\n marginRight: 8,\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n },\n});\n"]}
|
|
@@ -11,6 +11,8 @@ var _reactNative = require("react-native");
|
|
|
11
11
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
14
|
+
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
|
+
|
|
14
16
|
const NumberInput = _ref => {
|
|
15
17
|
let {
|
|
16
18
|
onChangeText,
|
|
@@ -46,19 +48,8 @@ const NumberInput = _ref => {
|
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.TextInput, {
|
|
50
|
-
keyboardType: "numeric"
|
|
51
|
-
...props,
|
|
52
|
-
value: strValue,
|
|
53
|
-
defaultValue: defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.toString(),
|
|
54
|
-
onChangeText: handleChangeText
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
var _default = NumberInput; // comment to try to fix sourcemap issue
|
|
59
|
-
|
|
60
|
-
exports.default = _default;
|
|
61
|
-
//# sourceMappingURL=NumberInput.js.mapmeric"
|
|
51
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.TextInput, _extends({
|
|
52
|
+
keyboardType: "numeric"
|
|
62
53
|
}, props, {
|
|
63
54
|
value: strValue,
|
|
64
55
|
defaultValue: defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.toString(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["NumberInput.
|
|
1
|
+
{"version":3,"sources":["NumberInput.tsx"],"names":["NumberInput","onChangeText","value","defaultValue","props","isDecimal","setIsDecimal","React","useState","Number","isInteger","useEffect","toString","includes","handleChangeText","newValue","parsedNumber","parseFloat","number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aAAEA,YAAF,uBAAEA,YAAY,CAAES,QAAd,EAJhB;AAKE,IAAA,YAAY,EAAEE;AALhB,KADF;AASD,CAzCD;;eA2Ced,W,EAEf","sourcesContent":["import React from \"react\";\nimport { TextInput } from \"react-native\";\n\ninterface Props {\n value?: number;\n defaultValue?: number;\n onChangeText: (value?: number) => void;\n}\n\nconst NumberInput: React.FC<Props> = ({\n onChangeText,\n value,\n defaultValue,\n ...props\n}) => {\n const [isDecimal, setIsDecimal] = React.useState(\n value && !Number.isInteger(value)\n );\n React.useEffect(() => {\n if (value) {\n setIsDecimal(value.toString().includes(\".\"));\n }\n }, [value]);\n\n const handleChangeText = (newValue: string) => {\n if (onChangeText) {\n const parsedNumber = parseFloat(newValue);\n const number = isNaN(parsedNumber) ? 0 : parsedNumber;\n setIsDecimal(newValue.includes(\".\"));\n onChangeText(number);\n }\n };\n\n let strValue;\n if (value != undefined) {\n strValue = value.toString();\n if (isDecimal && !strValue.includes(\".\")) {\n strValue = `${strValue}.`;\n }\n }\n\n return (\n <TextInput\n keyboardType=\"numeric\"\n {...props}\n value={strValue}\n defaultValue={defaultValue?.toString()}\n onChangeText={handleChangeText}\n />\n );\n};\n\nexport default NumberInput;\n\n// comment to try to fix sourcemap issue\n"]}
|
|
@@ -27,6 +27,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
27
27
|
|
|
28
28
|
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; }
|
|
29
29
|
|
|
30
|
+
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); }
|
|
31
|
+
|
|
30
32
|
const Picker = _ref => {
|
|
31
33
|
var _options$find$label, _options$find;
|
|
32
34
|
|
|
@@ -109,27 +111,11 @@ const Picker = _ref => {
|
|
|
109
111
|
key: o.value
|
|
110
112
|
}))), /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
111
113
|
pointerEvents: "none"
|
|
112
|
-
}, /*#__PURE__*/React.createElement(_TextField.default, {
|
|
114
|
+
}, /*#__PURE__*/React.createElement(_TextField.default, _extends({}, props, {
|
|
113
115
|
value: selectedLabel,
|
|
114
|
-
placeholder: placeholder
|
|
115
|
-
|
|
116
|
-
ref: textField
|
|
117
|
-
disabled: disabled,
|
|
118
|
-
// @ts-expect-error
|
|
119
|
-
style: stylesWithoutMargin
|
|
120
|
-
}))));
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
const styles = _reactNative.StyleSheet.create({
|
|
124
|
-
container: {
|
|
125
|
-
alignSelf: "stretch"
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
var _default = (0, _theming.withTheme)(Picker);
|
|
130
|
-
|
|
131
|
-
exports.default = _default;
|
|
132
|
-
//# sourceMappingURL=PickerComponent.android.js.map: textField // cannot determine if ref is of correct type due to component being wrapped in a withTheme()
|
|
116
|
+
placeholder: placeholder // @ts-ignore
|
|
117
|
+
,
|
|
118
|
+
ref: textField // cannot determine if ref is of correct type due to component being wrapped in a withTheme()
|
|
133
119
|
,
|
|
134
120
|
disabled: disabled // @ts-expect-error
|
|
135
121
|
,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["PickerComponent.android.
|
|
1
|
+
{"version":3,"sources":["PickerComponent.android.tsx"],"names":["Picker","style","options","placeholder","selectedValue","disabled","onValueChange","onValueChangeOverride","props","viewStyles","borderRadius","borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderColor","backgroundColor","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","textField","React","useRef","undefined","itemValue","itemIndex","toggleFocus","current","stylesWithoutMargin","StyleSheet","flatten","selectedLabel","find","o","value","label","styles","container","opacity","position","top","left","right","bottom","width","map","create","alignSelf"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAGA,MAAMA,MAAsC,GAAG,QAQzC;AAAA;;AAAA,MAR0C;AAC9CC,IAAAA,KAD8C;AAE9CC,IAAAA,OAF8C;AAG9CC,IAAAA,WAH8C;AAI9CC,IAAAA,aAJ8C;AAK9CC,IAAAA,QAAQ,GAAG,KALmC;AAM9CC,IAAAA,aAAa,EAAEC,qBAAqB,GAAG,MAAM,CAAE,CAND;AAO9C,OAAGC;AAP2C,GAQ1C;AACJ,QAAM;AACJC,IAAAA,UAAU,EAAE;AACVC,MAAAA,YADU;AACI;AACdC,MAAAA,WAFU;AAEG;AACbC,MAAAA,cAHU;AAGM;AAChBC,MAAAA,gBAJU;AAIQ;AAClBC,MAAAA,iBALU;AAKS;AACnBC,MAAAA,eANU;AAMO;AACjBC,MAAAA,WAPU;AAOG;AACbC,MAAAA,eARU;AAQO;AACjBC,MAAAA,OATU;AASD;AACTC,MAAAA,UAVU;AAUE;AACZC,MAAAA,YAXU;AAWI;AACdC,MAAAA,aAZU;AAYK;AACfC,MAAAA,WAbU;AAaG;AACb,SAAGb;AAdO;AADR,MAiBF,8BAAcR,KAAd,CAjBJ;AAmBA,QAAMsB,SAAS,GAAGC,KAAK,CAACC,MAAN,CAA2CC,SAA3C,CAAlB;;AAEA,QAAMpB,aAAa,GAAG,CAACqB,SAAD,EAAoBC,SAApB,KA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AAK,EAAEA,CAAC,CAACE,KAA5B;AAAmC,IAAA,KAAK,EAAEF,CAAC,CAACC,KAA5C;AAAmD,IAAA,GAAG,EAAED,CAAC,CAACC;AAA1D,IADD,CAdH,CADF,eAmBE,oBAAC,iBAAD;AAAM,IAAA,aAAa,EAAC;AAApB,kBACE,oBAAC,kBAAD,eACM7B,KADN;AAEE,IAAA,KAAK,EAAE0B,aAFT;AAGE,IAAA,WAAW,EAAE/B,WAHf,CAIE;AAJF;AAKE,IAAA,GAAG,EAAEoB,SALP,CAKkB;AALlB;AAME,IAAA,QAAQ,EAAElB,QANZ,CAOE;AAPF;AAQE,IAAA,KAAK,EAAE0B;AART,KADF,CAnBF,CALF,CADF;AAwCD,CAhGD;;AAkGA,MAAMQ,MAAM,GAAGP,wBAAWiB,MAAX,CAAkB;AAC/BT,EAAAA,SAAS,EAAE;AACTU,IAAAA,SAAS,EAAE;AADF;AADoB,CAAlB,CAAf;;eAMe,wBAAUlD,MAAV,C","sourcesContent":["import * as React from \"react\";\nimport { View, StyleSheet } from \"react-native\";\nimport omit from \"lodash.omit\";\nimport { withTheme } from \"../../theming\";\nimport { Picker as NativePicker } from \"@react-native-picker/picker\";\nimport { extractStyles } from \"../../utilities\";\n\nimport TextField from \"../TextField\";\nimport Touchable from \"../Touchable\";\nimport { PickerComponentProps } from \"./PickerTypes\";\n\nconst Picker: React.FC<PickerComponentProps> = ({\n style,\n options,\n placeholder,\n selectedValue,\n disabled = false,\n onValueChange: onValueChangeOverride = () => {},\n ...props\n}) => {\n const {\n viewStyles: {\n borderRadius, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderTopWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderRightWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderBottomWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderLeftWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderColor, // eslint-disable-line @typescript-eslint/no-unused-vars\n backgroundColor, // eslint-disable-line @typescript-eslint/no-unused-vars\n padding, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingTop, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingRight, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingBottom, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingLeft, // eslint-disable-line @typescript-eslint/no-unused-vars\n ...viewStyles\n },\n } = extractStyles(style);\n\n const textField = React.useRef<typeof TextField | undefined>(undefined);\n\n const onValueChange = (itemValue: string, itemIndex: number) => {\n toggleFocus();\n onValueChangeOverride(itemValue, itemIndex);\n };\n\n const toggleFocus = () => {\n if (!disabled) {\n // @ts-ignore\n textField.current.toggleFocus(); // cannot determine if method exists due to component being wrapped in a withTheme()\n }\n };\n\n const stylesWithoutMargin =\n style &&\n omit(StyleSheet.flatten(style), [\n \"margin\",\n \"marginTop\",\n \"marginRight\",\n \"marginBottom\",\n \"marginLeft\",\n ]);\n\n const selectedLabel =\n selectedValue &&\n (options.find((o) => o.value === selectedValue)?.label ?? selectedValue);\n\n return (\n <Touchable\n disabled={disabled}\n onPress={toggleFocus}\n style={[styles.container, viewStyles]}\n >\n <View>\n <NativePicker\n enabled={!disabled}\n selectedValue={selectedValue}\n onValueChange={onValueChange}\n style={{\n opacity: 0,\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n width: \"100%\",\n }}\n >\n {options.map((o) => (\n <NativePicker.Item label={o.label} value={o.value} key={o.value} />\n ))}\n </NativePicker>\n <View pointerEvents=\"none\">\n <TextField\n {...props}\n value={selectedLabel}\n placeholder={placeholder}\n // @ts-ignore\n ref={textField} // cannot determine if ref is of correct type due to component being wrapped in a withTheme()\n disabled={disabled}\n // @ts-expect-error\n style={stylesWithoutMargin}\n />\n </View>\n </View>\n </Touchable>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {\n alignSelf: \"stretch\",\n },\n});\n\nexport default withTheme(Picker);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["PortalManager.
|
|
1
|
+
{"version":3,"sources":["PortalManager.tsx"],"names":["PortalManager","React","PureComponent","portals","key","children","setState","state","map","item","filter","render","StyleSheet","absoluteFill"],"mappings":";;;;;;;AAAA;;AACA;;;;;;;;AASA;AACA;AACA;AACe,MAAMA,aAAN,SAA4BC,KAAK,CAACC,aAAlC,CAA2D;AAAA;AAAA;;AAAA,mCACzD;AACbC,MAAAA,OAAO,EAAE;AADI,KADyD;;AAAA,mCAKhE,CAACC,GAAD,EAAcC,QAAd,KAA4C;AAClD,WAAKC,QAAL,CAAeC,KAAD,KAAY;AACxBJ,QAAAA,OAAO,EAAE,CAAC,GAAGI,KAAK,CAACJ,OAAV,EAAmB;AAAEC,UAAAA,GAAF;AAAOC,UAAAA;AAAP,SAAnB;AADe,OAAZ,CAAd;AAGD,KATuE;;AAAA,oCAW/D,CAACD,GAAD,EAAcC,QAAd,KACP,KAAKC,QAAL,CAAeC,KAAD,KAAY;AACxBJ,MAAAA,OAAO,EAAEI,KAAK,CAACJ,OAAN,CAAcK,GAAd,CAAmBC,IAAD,IAAU;AACnC,YAAIA,IAAI,CAACL,GAAL,KAAaA,GAAjB,EAAsB;AACpB,iBAAO,EAAE,GAAGK,IAAL;AAAWJ,YAAAA;AAAX,WAAP;AACD;;AACD,eAAOI,IAAP;AACD,OALQ;AADe,KAAZ,CAAd,CAZsE;;AAAA,qCAqB7DL,GAAD,IACR,KAAKE,QAAL,CAAeC,KAAD,KAAY;AACxBJ,MAAAA,OAAO,EAAEI,KAAK,CAACJ,OAAN,CAAcO,MAAd,CAAsBD,IAAD,IAAUA,IAAI,CAACL,GAAL,KAAaA,GAA5C;AADe,KAAZ,CAAd,CAtBsE;AAAA;;AA0BxEO,EAAAA,MAAM,GAAG;AACP,WAAO,KAAKJ,KAAL,CAAWJ,OAAX,CAAmBK,GAAnB,CAAuB;AAAA,UAAC;AAAEJ,QAAAA,GAAF;AAAOC,QAAAA;AAAP,OAAD;AAAA,0BAC5B,oBAAC,iBAAD;AACE,QAAA,GAAG,EAAED,GADP;AAEE,QAAA,WAAW,EACT;AAAM;AAHV;AAKE,QAAA,aAAa,EAAC,UALhB;AAME,QAAA,KAAK,EAAEQ,wBAAWC;AANpB,SAQGR,QARH,CAD4B;AAAA,KAAvB,CAAP;AAYD;;AAvCuE","sourcesContent":["import * as React from \"react\";\nimport { View, StyleSheet } from \"react-native\";\n\ntype State = {\n portals: Array<{\n key: number;\n children: React.ReactNode;\n }>;\n};\n\n/**\n * Portal host is the component which actually renders all Portals.\n */\nexport default class PortalManager extends React.PureComponent<{}, State> {\n state: State = {\n portals: [],\n };\n\n mount = (key: number, children: React.ReactNode) => {\n this.setState((state) => ({\n portals: [...state.portals, { key, children }],\n }));\n };\n\n update = (key: number, children: React.ReactNode) =>\n this.setState((state) => ({\n portals: state.portals.map((item) => {\n if (item.key === key) {\n return { ...item, children };\n }\n return item;\n }),\n }));\n\n unmount = (key: number) =>\n this.setState((state) => ({\n portals: state.portals.filter((item) => item.key !== key),\n }));\n\n render() {\n return this.state.portals.map(({ key, children }) => (\n <View\n key={key}\n collapsable={\n false /* Need collapsable=false here to clip the elevations, otherwise they appear above sibling components */\n }\n pointerEvents=\"box-none\"\n style={StyleSheet.absoluteFill}\n >\n {children}\n </View>\n ));\n }\n}\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;;A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ed,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 = [{
|
|
@@ -64,7 +65,7 @@ const RadioButtonGroup = _ref => {
|
|
|
64
65
|
}, style]
|
|
65
66
|
}, rest), /*#__PURE__*/React.createElement(Provider, {
|
|
66
67
|
value: {
|
|
67
|
-
value: internalValue
|
|
68
|
+
value: internalValue !== null && internalValue !== void 0 ? internalValue : "",
|
|
68
69
|
onValueChange: handleValueChange,
|
|
69
70
|
direction
|
|
70
71
|
}
|
|
@@ -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","Horizontal","push","alignItems","minHeight"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;;;AAWA,MAAM;AAAEA,EAAAA;AAAF,IAAeC,gCAArB;;AAEA,MAAMC,gBAAiD,GAAG,QAQpD;AAAA,MARqD;AACzDC,IAAAA,SAAS,GAAGC,mBAAUC,QADmC;AAEzDC,IAAAA,KAAK,GAAG,EAFiD;AAGzDC,IAAAA,aAHyD;AAIzDC,IAAAA,YAAY,GAAG,EAJ0C;AAKzDC,IAAAA,KALyD;AAMzDC,IAAAA,QANyD;AAOzD,OAAGC;AAPsD,GAQrD;AACJ,QAAM,CAACC,aAAD,EAAgBC,gBAAhB,IAAoCC,KAAK,CAACC,QAAN,CAAuB,EAAvB,CAA1C;AAEAD,EAAAA,KAAK,CAACE,SAAN,CAAgB,MAAM;AACpB,UAAMC,SAAS,GAAG,uCAAuBX,KAAvB,CAAlB;AAEAO,IAAAA,gBAAgB,CAACI,SAAD,CAAhB;AACD,GAJD,EAIG,CAACX,KAAD,CAJH;AAMAQ,EAAAA,KAAK,CAACE,SAAN,CAAgB,MAAM;AACpB,UAAME,gBAAgB,GAAG,uCAAuBV,YAAvB,CAAzB;AAEAK,IAAAA,gBAAgB,CAACK,gBAAD,CAAhB;AACD,GAJD,EAIG,CAACV,YAAD,CAJH;;AAMA,QAAMW,iBAAiB,GAAIC,QAAD,IAA+B;AACvD,UAAMC,YAAY,GAAG,uCAAuBD,QAAvB,CAArB;AAEAP,IAAAA,gBAAgB,CAACQ,YAAD,CAAhB;AACAd,IAAAA,aAAa,SAAb,IAAAA,aAAa,WAAb,YAAAA,aAAa,CAAGc,YAAH,CAAb;AACD,GALD;;AAOA,QAAMC,eAAqC,GAAG,CAC5C;AACEC,IAAAA,aAAa,EAAEpB,SAAS,KAAKC,mBAAUoB,UAAxB,GAAqC,KAArC,GAA6C;AAD9D,GAD4C,CAA9C;;AAMA,MAAIrB,SAAS,KAAKC,mBAAUC,QAA5B,EAAsC;AACpCiB,IAAAA,eAAe,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,aAAF,aAAEA,aAAF,cAAEA,aAAF,GAAmB,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"]}
|
|
@@ -45,13 +45,13 @@ const getRadioButtonAlignment = (parentDirection, direction) => {
|
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
const renderLabel = (
|
|
49
|
-
if (typeof
|
|
48
|
+
const renderLabel = (label, labelStyle, textStyle) => {
|
|
49
|
+
if (typeof label === "string") {
|
|
50
50
|
return /*#__PURE__*/React.createElement(_Text.default, {
|
|
51
51
|
style: [labelStyle, textStyle]
|
|
52
|
-
},
|
|
52
|
+
}, label);
|
|
53
53
|
} else {
|
|
54
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null,
|
|
54
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, label);
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
57
|
|
|
@@ -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 ? true : false,
|
|
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","
|
|
1
|
+
{"version":3,"sources":["RadioButtonRow.tsx"],"names":["Direction","getRadioButtonAlignment","parentDirection","direction","GroupDirection","Horizontal","Row","RowReverse","renderLabel","label","labelStyle","textStyle","RadioButtonRow","Icon","value","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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EAAE,CACLS,MAAM,CAACvB,KADF,EAEL;AACE0B,MAAAA,UAAU,EAAEhC,SAAS,KAAKH,SAAS,CAACM,GAAxB,GAA8B,YAA9B,GAA6C;AAD3D,KAFK,EAKLY,mBALK;AADT,KASGV,WAAW,CAACC,KAAD,EAAQC,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,UAAU,GAAG,IAAH,GAAU,KAFhC;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/BtC,EAAAA,KAAK,EAAE;AACL2B,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 label: string | React.ReactNode,\n labelStyle: StyleProp<TextStyle>,\n textStyle: StyleProp<TextStyle>\n) => {\n if (typeof label === \"string\") {\n return <Text style={[labelStyle, textStyle]}>{label}</Text>;\n } else {\n return <>{label}</>;\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 ? true : false}\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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA","sourcesContent":["export { default as RadioButton } from \"./RadioButton\";\nexport { default as RadioButtonGroup } from \"./RadioButtonGroup\";\nexport { default as RadioButtonRow } from \"./RadioButtonRow\";\nexport { default as RadioButtonFieldGroup } from \"./RadioButtonFieldGroup\";\n"]}
|