@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["TextInput.ts"],"names":["GROUPS","COMPONENT_TYPES","FORM_TYPES","PROP_TYPES","FIELD_NAME","TEXT_INPUT_PROPS","NUMBER_INPUT_PROPS","Triggers","SEED_DATA_PROPS","style","group","basic","label","description","editable","required","formType","typeStyle","propType","THEME","defaultValue","clearButtonMode","options","flatArray","STRING","clearTextOnFocus","boolean","BOOLEAN","enablesReturnKeyAutomatically","underlineColorAndroid","color","fieldName","handlerPropName","SEED_DATA","name","tag","category","input","preview_image_url","supports_list_render","layout","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth","borderColor","paddingLeft","paddingRight","paddingTop","paddingBottom","borderRadius","triggers","OnChangeText","props","multiline","numberOfLines","min","step","precision","number","NUMBER","scrollEnabled","spellcheck","textContentType","advanced","textBreakStrategy"],"mappings":"AAAA,SACEA,MADF,EAEEC,eAFF,EAGEC,UAHF,EAIEC,UAJF,EAKEC,UALF,EAMEC,gBANF,EAOEC,kBAPF,EAQEC,QARF,QASO,iBATP;AAWA,OAAO,MAAMC,eAAe,GAAG;AAC7BC,EAAA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\n\nexport const SEED_DATA_PROPS = {\n style: {\n group: GROUPS.basic,\n label: \"Style\",\n description: \"Text Style\",\n editable: false,\n required: false,\n formType: FORM_TYPES.typeStyle,\n propType: PROP_TYPES.THEME,\n defaultValue: null,\n },\n clearButtonMode: {\n group: GROUPS.basic,\n label: \"Clear Button Mode\",\n description:\n \"Enables a button within the textInput to clear the data entered\",\n editable: true,\n required: false,\n options: [\"never\", \"while-editing\", \"unless-editing\", \"always\"],\n defaultValue: null,\n formType: FORM_TYPES.flatArray,\n propType: PROP_TYPES.STRING,\n },\n clearTextOnFocus: {\n group: GROUPS.basic,\n label: \"Clear Text on Focus\",\n description:\n \"If true, clears the text field automatically when its focused.\",\n editable: true,\n required: false,\n defaultValue: null,\n formType: FORM_TYPES.boolean,\n propType: PROP_TYPES.BOOLEAN,\n },\n enablesReturnKeyAutomatically: {\n group: GROUPS.basic,\n label: \"Enables Return Key Automatically\",\n description:\n \"If true, the keyboard disables the return key when there is no text and automatically enables it when there is (Default: false)\",\n editable: true,\n required: false,\n defaultValue: null,\n formType: FORM_TYPES.boolean,\n propType: PROP_TYPES.BOOLEAN,\n },\n underlineColorAndroid: {\n group: GROUPS.basic,\n label: \"Underline color\",\n description:\n \"(Android Only) The color of the underline(the line underneath the text when finished typing.\",\n editable: true,\n required: false,\n defaultValue: null,\n formType: FORM_TYPES.color,\n propType: PROP_TYPES.THEME,\n },\n fieldName: {\n ...FIELD_NAME,\n defaultValue: \"textInputValue\",\n handlerPropName: \"onChangeText\",\n },\n};\n\nexport const SEED_DATA = [\n {\n name: \"Text Input\",\n tag: \"TextInput\",\n description: \"An input field that allows users to type in data.\",\n category: COMPONENT_TYPES.input,\n preview_image_url:\n \"https://res.cloudinary.com/altos/image/upload/draftbit/Jigsaw/TextInput.png\",\n supports_list_render: false,\n layout: {\n borderLeftWidth: 1,\n borderRightWidth: 1,\n borderTopWidth: 1,\n borderBottomWidth: 1,\n borderColor: \"divider\",\n paddingLeft: 8,\n paddingRight: 8,\n paddingTop: 8,\n paddingBottom: 8,\n borderRadius: 8,\n },\n triggers: [Triggers.OnChangeText],\n props: {\n ...TEXT_INPUT_PROPS,\n ...SEED_DATA_PROPS,\n multiline: {\n group: GROUPS.basic,\n label: \"Multiple Lines\",\n description:\n \"Allows multiple lines of input, useful for situations where the user may be typing in a lot of data.\",\n editable: true,\n required: false,\n defaultValue: null,\n formType: FORM_TYPES.boolean,\n propType: PROP_TYPES.BOOLEAN,\n },\n numberOfLines: {\n group: GROUPS.basic,\n label: \"Number of Lines\",\n description:\n \"Sets the number of lines for the input (Multiple Lines needs to be true)\",\n editable: true,\n required: false,\n defaultValue: null,\n min: 0,\n step: 1,\n precision: 0,\n formType: FORM_TYPES.number,\n propType: PROP_TYPES.NUMBER,\n },\n scrollEnabled: {\n group: GROUPS.basic,\n label: \"Scroll Enabled\",\n description:\n \"If false, scrolling of the input will be disabled. Only works when Multiple Lines is true\",\n editable: true,\n required: false,\n defaultValue: null,\n formType: FORM_TYPES.boolean,\n propType: PROP_TYPES.BOOLEAN,\n },\n spellcheck: {\n group: GROUPS.basic,\n label: \"Disable Spell Check\",\n description:\n \"If false, disables spell-check style (red underlines). Default comes from Auto Correct\",\n editable: true,\n required: false,\n defaultValue: null,\n formType: FORM_TYPES.boolean,\n propType: PROP_TYPES.BOOLEAN,\n },\n textContentType: {\n group: GROUPS.advanced,\n label: \"Text Content Type\",\n description:\n \"Give the keyboard and system about what it should do with the input. For example, if its an address, autofill from address book\",\n editable: true,\n required: false,\n defaultValue: null,\n options: [\n \"none\",\n \"URL\",\n \"addressCity\",\n \"addressCityAndState\",\n \"addressState\",\n \"countryName\",\n \"creditCardNumber\",\n \"emailAddress\",\n \"familyName\",\n \"fullStreetAddress\",\n \"givenName\",\n \"jobTitle\",\n \"location\",\n \"middleName\",\n \"name\",\n \"namePrefix\",\n \"nameSuffix\",\n \"nickname\",\n \"organizationName\",\n \"postalCode\",\n \"streetAddressLine1\",\n \"streetAddressLine2\",\n \"sublocality\",\n \"telephoneNumber\",\n \"username\",\n \"password\",\n ],\n formType: FORM_TYPES.flatArray,\n propType: PROP_TYPES.STRING,\n },\n textBreakStrategy: {\n group: GROUPS.advanced,\n label: \"Text Break Strategy\",\n description:\n \"(Android Only) Set the text break strategy. (Default: simple)\",\n editable: true,\n required: false,\n defaultValue: null,\n options: [\"simple\", \"highQuality\", \"balanced\"],\n formType: FORM_TYPES.flatArray,\n propType: PROP_TYPES.STRING,\n },\n },\n },\n {\n name: \"Number Input\",\n tag: \"NumberInput\",\n description: \"An input field that allows users to type in data.\",\n category: COMPONENT_TYPES.input,\n preview_image_url:\n \"https://res.cloudinary.com/altos/image/upload/draftbit/Jigsaw/TextInput.png\",\n supports_list_render: false,\n layout: {\n borderLeftWidth: 1,\n borderRightWidth: 1,\n borderTopWidth: 1,\n borderBottomWidth: 1,\n borderColor: \"divider\",\n paddingLeft: 8,\n paddingRight: 8,\n paddingTop: 8,\n paddingBottom: 8,\n borderRadius: 8,\n },\n triggers: [Triggers.OnChangeText],\n props: {\n ...NUMBER_INPUT_PROPS,\n ...SEED_DATA_PROPS,\n },\n },\n];\n"]}
|
|
1
|
+
{"version":3,"sources":["TextInput.ts"],"names":["GROUPS","COMPONENT_TYPES","FORM_TYPES","PROP_TYPES","FIELD_NAME","TEXT_INPUT_PROPS","NUMBER_INPUT_PROPS","Triggers","createFieldNameProp","SEED_DATA_PROPS","style","group","basic","label","description","editable","required","formType","typeStyle","propType","THEME","defaultValue","clearButtonMode","options","flatArray","STRING","clearTextOnFocus","boolean","BOOLEAN","enablesReturnKeyAutomatically","underlineColorAndroid","color","fieldName","handlerPropName","SEED_DATA","name","tag","category","input","preview_image_url","supports_list_render","layout","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth","borderColor","paddingLeft","paddingRight","paddingTop","paddingBottom","borderRadius","triggers","OnChangeText","props","multiline","numberOfLines","min","step","precision","number","NUMBER","scrollEnabled","spellcheck","textContentType","advanced","textBreakStrategy","valuePropName"],"mappings":"AAAA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;AAEL,OAAGH,kBAFE;AAGL0B,IAAAA,SAAS,EAAExB,mBAAmB,CAAC;AAC7Ba,MAAAA,YAAY,EAAE,kBADe;AAE7B8C,MAAAA,aAAa,EAAE,OAFc;AAG7BlC,MAAAA,eAAe,EAAE;AAHY,KAAD;AAHzB;AArBT,CA7HuB,CAAlB","sourcesContent":["import {\n GROUPS,\n COMPONENT_TYPES,\n FORM_TYPES,\n PROP_TYPES,\n FIELD_NAME,\n TEXT_INPUT_PROPS,\n NUMBER_INPUT_PROPS,\n Triggers,\n createFieldNameProp,\n} from \"@draftbit/types\";\n\nexport const SEED_DATA_PROPS = {\n style: {\n group: GROUPS.basic,\n label: \"Style\",\n description: \"Text Style\",\n editable: false,\n required: false,\n formType: FORM_TYPES.typeStyle,\n propType: PROP_TYPES.THEME,\n defaultValue: null,\n },\n clearButtonMode: {\n group: GROUPS.basic,\n label: \"Clear Button Mode\",\n description:\n \"Enables a button within the textInput to clear the data entered\",\n editable: true,\n required: false,\n options: [\"never\", \"while-editing\", \"unless-editing\", \"always\"],\n defaultValue: null,\n formType: FORM_TYPES.flatArray,\n propType: PROP_TYPES.STRING,\n },\n clearTextOnFocus: {\n group: GROUPS.basic,\n label: \"Clear Text on Focus\",\n description:\n \"If true, clears the text field automatically when its focused.\",\n editable: true,\n required: false,\n defaultValue: null,\n formType: FORM_TYPES.boolean,\n propType: PROP_TYPES.BOOLEAN,\n },\n enablesReturnKeyAutomatically: {\n group: GROUPS.basic,\n label: \"Enables Return Key Automatically\",\n description:\n \"If true, the keyboard disables the return key when there is no text and automatically enables it when there is (Default: false)\",\n editable: true,\n required: false,\n defaultValue: null,\n formType: FORM_TYPES.boolean,\n propType: PROP_TYPES.BOOLEAN,\n },\n underlineColorAndroid: {\n group: GROUPS.basic,\n label: \"Underline color\",\n description:\n \"(Android Only) The color of the underline(the line underneath the text when finished typing.\",\n editable: true,\n required: false,\n defaultValue: null,\n formType: FORM_TYPES.color,\n propType: PROP_TYPES.THEME,\n },\n fieldName: {\n ...FIELD_NAME,\n defaultValue: \"textInputValue\",\n handlerPropName: \"onChangeText\",\n },\n};\n\nexport const SEED_DATA = [\n {\n name: \"Text Input\",\n tag: \"TextInput\",\n description: \"An input field that allows users to type in data.\",\n category: COMPONENT_TYPES.input,\n preview_image_url:\n \"https://res.cloudinary.com/altos/image/upload/draftbit/Jigsaw/TextInput.png\",\n supports_list_render: false,\n layout: {\n borderLeftWidth: 1,\n borderRightWidth: 1,\n borderTopWidth: 1,\n borderBottomWidth: 1,\n borderColor: \"divider\",\n paddingLeft: 8,\n paddingRight: 8,\n paddingTop: 8,\n paddingBottom: 8,\n borderRadius: 8,\n },\n triggers: [Triggers.OnChangeText],\n props: {\n ...TEXT_INPUT_PROPS,\n ...SEED_DATA_PROPS,\n multiline: {\n group: GROUPS.basic,\n label: \"Multiple Lines\",\n description:\n \"Allows multiple lines of input, useful for situations where the user may be typing in a lot of data.\",\n editable: true,\n required: false,\n defaultValue: null,\n formType: FORM_TYPES.boolean,\n propType: PROP_TYPES.BOOLEAN,\n },\n numberOfLines: {\n group: GROUPS.basic,\n label: \"Number of Lines\",\n description:\n \"Sets the number of lines for the input (Multiple Lines needs to be true)\",\n editable: true,\n required: false,\n defaultValue: null,\n min: 0,\n step: 1,\n precision: 0,\n formType: FORM_TYPES.number,\n propType: PROP_TYPES.NUMBER,\n },\n scrollEnabled: {\n group: GROUPS.basic,\n label: \"Scroll Enabled\",\n description:\n \"If false, scrolling of the input will be disabled. Only works when Multiple Lines is true\",\n editable: true,\n required: false,\n defaultValue: null,\n formType: FORM_TYPES.boolean,\n propType: PROP_TYPES.BOOLEAN,\n },\n spellcheck: {\n group: GROUPS.basic,\n label: \"Disable Spell Check\",\n description:\n \"If false, disables spell-check style (red underlines). Default comes from Auto Correct\",\n editable: true,\n required: false,\n defaultValue: null,\n formType: FORM_TYPES.boolean,\n propType: PROP_TYPES.BOOLEAN,\n },\n textContentType: {\n group: GROUPS.advanced,\n label: \"Text Content Type\",\n description:\n \"Give the keyboard and system about what it should do with the input. For example, if its an address, autofill from address book\",\n editable: true,\n required: false,\n defaultValue: null,\n options: [\n \"none\",\n \"URL\",\n \"addressCity\",\n \"addressCityAndState\",\n \"addressState\",\n \"countryName\",\n \"creditCardNumber\",\n \"emailAddress\",\n \"familyName\",\n \"fullStreetAddress\",\n \"givenName\",\n \"jobTitle\",\n \"location\",\n \"middleName\",\n \"name\",\n \"namePrefix\",\n \"nameSuffix\",\n \"nickname\",\n \"organizationName\",\n \"postalCode\",\n \"streetAddressLine1\",\n \"streetAddressLine2\",\n \"sublocality\",\n \"telephoneNumber\",\n \"username\",\n \"password\",\n ],\n formType: FORM_TYPES.flatArray,\n propType: PROP_TYPES.STRING,\n },\n textBreakStrategy: {\n group: GROUPS.advanced,\n label: \"Text Break Strategy\",\n description:\n \"(Android Only) Set the text break strategy. (Default: simple)\",\n editable: true,\n required: false,\n defaultValue: null,\n options: [\"simple\", \"highQuality\", \"balanced\"],\n formType: FORM_TYPES.flatArray,\n propType: PROP_TYPES.STRING,\n },\n },\n },\n {\n name: \"Number Input\",\n tag: \"NumberInput\",\n description: \"An input field that allows users to type in data.\",\n category: COMPONENT_TYPES.input,\n preview_image_url:\n \"https://res.cloudinary.com/altos/image/upload/draftbit/Jigsaw/TextInput.png\",\n supports_list_render: false,\n layout: {\n borderLeftWidth: 1,\n borderRightWidth: 1,\n borderTopWidth: 1,\n borderBottomWidth: 1,\n borderColor: \"divider\",\n paddingLeft: 8,\n paddingRight: 8,\n paddingTop: 8,\n paddingBottom: 8,\n borderRadius: 8,\n },\n triggers: [Triggers.OnChangeText],\n props: {\n ...SEED_DATA_PROPS,\n ...NUMBER_INPUT_PROPS,\n fieldName: createFieldNameProp({\n defaultValue: \"numberInputValue\",\n valuePropName: \"value\",\n handlerPropName: \"onChangeText\",\n }),\n },\n },\n];\n"]}
|
package/lib/module/utilities.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
|
+
import { isString, isNumber } from "lodash";
|
|
2
3
|
export function extractStyles(style) {
|
|
3
4
|
const {
|
|
4
5
|
color,
|
|
@@ -60,4 +61,13 @@ export function applyStyles(baseStyles, stylesToApply) {
|
|
|
60
61
|
|
|
61
62
|
return flattenedStyles;
|
|
62
63
|
}
|
|
64
|
+
export function getValueForRadioButton(value) {
|
|
65
|
+
if (isString(value)) {
|
|
66
|
+
return value;
|
|
67
|
+
} else if (isNumber(value)) {
|
|
68
|
+
return String(value);
|
|
69
|
+
} else {
|
|
70
|
+
throw new Error(`Invalid value: ${value}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
63
73
|
//# sourceMappingURL=utilities.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["utilities.ts"],"names":["StyleSheet","extractStyles","style","color","fontFamily","fontWeight","fontSize","lineHeight","letterSpacing","textTransform","textAlign","textDecorationLine","textDecorationColor","textDecorationStyle","viewStyles","flatten","textStyles","applyStyles","baseStyles","stylesToApply","flattenedStyles","key","value","Object","entries"],"mappings":"AAAA,SAASA,UAAT,QAAiD,cAAjD;AAEA,OAAO,SAASC,aAAT,CAAuBC,KAAvB,EAA8C;AACnD,QAAM;AACJC,IAAAA,KADI;AAEJC,IAAAA,UAFI;AAGJC,IAAAA,UAHI;AAIJC,IAAAA,QAJI;AAKJC,IAAAA,UALI;AAMJC,IAAAA,aANI;AAOJC,IAAAA,aAPI;AAQJC,IAAAA,SARI;AASJC,IAAAA,kBATI;AAUJC,IAAAA,mBAVI;AAWJC,IAAAA,mBAXI;AAYJ,OAAGC;AAZC,
|
|
1
|
+
{"version":3,"sources":["utilities.ts"],"names":["StyleSheet","isString","isNumber","extractStyles","style","color","fontFamily","fontWeight","fontSize","lineHeight","letterSpacing","textTransform","textAlign","textDecorationLine","textDecorationColor","textDecorationStyle","viewStyles","flatten","textStyles","applyStyles","baseStyles","stylesToApply","flattenedStyles","key","value","Object","entries","getValueForRadioButton","String","Error"],"mappings":"AAAA,SAAS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P;AACD;AAED,OAAO,SAASK,sBAAT,CAAgCH,KAAhC,EAAwD;AAC7D,MAAIvB,QAAQ,CAACuB,KAAD,CAAZ,EAAqB;AACnB,WAAOA,KAAP;AACD,GAFD,MAEO,IAAItB,QAAQ,CAACsB,KAAD,CAAZ,EAAqB;AAC1B,WAAOI,MAAM,CAACJ,KAAD,CAAb;AACD,GAFM,MAEA;AACL,UAAM,IAAIK,KAAJ,CAAW,kBAAiBL,KAAM,EAAlC,CAAN;AACD;AACF","sourcesContent":["import { StyleSheet, StyleProp, TextStyle } from \"react-native\";\nimport { isString, isNumber } from \"lodash\";\n\nexport function extractStyles(style: StyleProp<any>) {\n const {\n color,\n fontFamily,\n fontWeight,\n fontSize,\n lineHeight,\n letterSpacing,\n textTransform,\n textAlign,\n textDecorationLine,\n textDecorationColor,\n textDecorationStyle,\n ...viewStyles\n } = StyleSheet.flatten(style || {});\n\n const textStyles: TextStyle = {\n color,\n fontFamily,\n fontWeight,\n fontSize,\n lineHeight,\n letterSpacing,\n textTransform,\n textAlign,\n textDecorationLine,\n textDecorationColor,\n textDecorationStyle,\n };\n\n return { viewStyles, textStyles };\n}\n\n/**\n * Merges a style object on top of another style object. In React Native,\n * keys with undefined values in a style object will still override styles\n * that appear earlier in a sequence. This avoids that problem.\n *\n * This lets us avoid the `...(something ? { something } : {})` pattern.\n * There doesn't seem to be a better way to do this. These all seem to not\n * work (i.e. they all result in `{ color: undefined }`:\n * `const mergedStyles = [{ color: \"red\" }, { color: undefined }]`\n * `const mergedStyles = StyleSheet.compose({ color: \"red\" }, { color: undefined })`\n * `const mergedStyles = StyleSheet.flatten([{ color: \"red\" }, { color: undefined }])`\n */\nexport function applyStyles(\n baseStyles: Array<StyleProp<any>>,\n stylesToApply: StyleProp<any> | undefined\n) {\n if (!stylesToApply) {\n return;\n }\n\n const flattenedStyles = StyleSheet.flatten(baseStyles);\n\n for (const [key, value] of Object.entries(stylesToApply)) {\n if (value != null) {\n flattenedStyles[key] = value;\n }\n }\n\n return flattenedStyles;\n}\n\nexport function getValueForRadioButton(value: string | number) {\n if (isString(value)) {\n return value;\n } else if (isNumber(value)) {\n return String(value);\n } else {\n throw new Error(`Invalid value: ${value}`);\n }\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
interface Props {
|
|
3
|
-
value?: number;
|
|
4
|
-
defaultValue?: number;
|
|
5
|
-
onChangeText
|
|
3
|
+
value?: number | string;
|
|
4
|
+
defaultValue?: number | string;
|
|
5
|
+
onChangeText?: (value?: number) => void;
|
|
6
6
|
}
|
|
7
7
|
declare const NumberInput: React.FC<Props>;
|
|
8
8
|
export default NumberInput;
|
|
@@ -5,9 +5,9 @@ export declare type RadioButtonProps = {
|
|
|
5
5
|
selected?: boolean;
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
color?: string;
|
|
8
|
-
value?: string;
|
|
8
|
+
value?: string | number;
|
|
9
9
|
unselectedColor?: string;
|
|
10
|
-
onPress?: () => void;
|
|
10
|
+
onPress?: (value?: string) => void;
|
|
11
11
|
style?: StyleProp<ViewStyle>;
|
|
12
12
|
size?: number;
|
|
13
13
|
selectedIcon?: string;
|
|
@@ -5,9 +5,9 @@ import { Direction } from "./context";
|
|
|
5
5
|
export interface RadioButtonGroupProps {
|
|
6
6
|
direction?: Direction;
|
|
7
7
|
style?: StyleProp<ViewStyle>;
|
|
8
|
-
value
|
|
8
|
+
value: string;
|
|
9
9
|
onValueChange?: (value: string) => void;
|
|
10
|
-
defaultValue?: string;
|
|
10
|
+
defaultValue?: string | number;
|
|
11
11
|
theme: Theme;
|
|
12
12
|
children: React.ReactNode;
|
|
13
13
|
}
|
|
@@ -8,7 +8,7 @@ export declare enum Direction {
|
|
|
8
8
|
}
|
|
9
9
|
export interface RadioButtonRowProps extends Omit<RadioButtonProps, "onPress"> {
|
|
10
10
|
label: string | React.ReactNode;
|
|
11
|
-
value: string;
|
|
11
|
+
value: string | number;
|
|
12
12
|
color?: string;
|
|
13
13
|
unselectedColor?: string;
|
|
14
14
|
labelContainerStyle: StyleProp<ViewStyle>;
|
|
@@ -27,7 +27,6 @@ export { default as Touchable } from "./components/Touchable";
|
|
|
27
27
|
export { AccordionGroup, AccordionItem } from "./components/Accordion";
|
|
28
28
|
export { ActionSheet, ActionSheetItem, ActionSheetCancel, } from "./components/ActionSheet";
|
|
29
29
|
export { Swiper, SwiperItem } from "./components/Swiper";
|
|
30
|
-
export { TabView, TabViewItem } from "./components/TabView";
|
|
31
30
|
export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
|
|
32
31
|
export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
|
|
33
32
|
export { default as Button } from "./components/DeprecatedButton";
|
|
@@ -421,28 +421,29 @@ export declare const SEED_DATA: ({
|
|
|
421
421
|
};
|
|
422
422
|
triggers: string[];
|
|
423
423
|
props: {
|
|
424
|
-
|
|
424
|
+
fieldName: {
|
|
425
|
+
handlerPropName: string;
|
|
425
426
|
group: string;
|
|
426
427
|
label: string;
|
|
427
428
|
description: string;
|
|
428
|
-
editable: boolean;
|
|
429
|
-
required: boolean;
|
|
430
429
|
formType: string;
|
|
431
430
|
propType: string;
|
|
432
|
-
defaultValue:
|
|
431
|
+
defaultValue: string;
|
|
432
|
+
valuePropName: string;
|
|
433
|
+
editable: boolean;
|
|
434
|
+
required: boolean;
|
|
433
435
|
};
|
|
434
|
-
|
|
436
|
+
allowFontScaling: {
|
|
435
437
|
group: string;
|
|
436
438
|
label: string;
|
|
437
439
|
description: string;
|
|
438
440
|
editable: boolean;
|
|
439
441
|
required: boolean;
|
|
440
|
-
options: string[];
|
|
441
442
|
defaultValue: null;
|
|
442
443
|
formType: string;
|
|
443
444
|
propType: string;
|
|
444
445
|
};
|
|
445
|
-
|
|
446
|
+
autoFocus: {
|
|
446
447
|
group: string;
|
|
447
448
|
label: string;
|
|
448
449
|
description: string;
|
|
@@ -452,7 +453,7 @@ export declare const SEED_DATA: ({
|
|
|
452
453
|
formType: string;
|
|
453
454
|
propType: string;
|
|
454
455
|
};
|
|
455
|
-
|
|
456
|
+
caretHidden: {
|
|
456
457
|
group: string;
|
|
457
458
|
label: string;
|
|
458
459
|
description: string;
|
|
@@ -462,7 +463,7 @@ export declare const SEED_DATA: ({
|
|
|
462
463
|
formType: string;
|
|
463
464
|
propType: string;
|
|
464
465
|
};
|
|
465
|
-
|
|
466
|
+
contextMenuHidden: {
|
|
466
467
|
group: string;
|
|
467
468
|
label: string;
|
|
468
469
|
description: string;
|
|
@@ -472,19 +473,17 @@ export declare const SEED_DATA: ({
|
|
|
472
473
|
formType: string;
|
|
473
474
|
propType: string;
|
|
474
475
|
};
|
|
475
|
-
|
|
476
|
-
defaultValue: string;
|
|
477
|
-
handlerPropName: string;
|
|
476
|
+
disabled: {
|
|
478
477
|
group: string;
|
|
479
478
|
label: string;
|
|
480
479
|
description: string;
|
|
481
480
|
formType: string;
|
|
482
481
|
propType: string;
|
|
483
|
-
|
|
482
|
+
defaultValue: null;
|
|
484
483
|
editable: boolean;
|
|
485
484
|
required: boolean;
|
|
486
485
|
};
|
|
487
|
-
|
|
486
|
+
editable: {
|
|
488
487
|
group: string;
|
|
489
488
|
label: string;
|
|
490
489
|
description: string;
|
|
@@ -494,47 +493,52 @@ export declare const SEED_DATA: ({
|
|
|
494
493
|
formType: string;
|
|
495
494
|
propType: string;
|
|
496
495
|
};
|
|
497
|
-
|
|
496
|
+
keyboardAppearance: {
|
|
498
497
|
group: string;
|
|
499
498
|
label: string;
|
|
500
499
|
description: string;
|
|
501
500
|
editable: boolean;
|
|
502
501
|
required: boolean;
|
|
503
502
|
defaultValue: null;
|
|
503
|
+
options: string[];
|
|
504
504
|
formType: string;
|
|
505
505
|
propType: string;
|
|
506
506
|
};
|
|
507
|
-
|
|
507
|
+
keyboardType: {
|
|
508
508
|
group: string;
|
|
509
509
|
label: string;
|
|
510
510
|
description: string;
|
|
511
511
|
editable: boolean;
|
|
512
512
|
required: boolean;
|
|
513
513
|
defaultValue: null;
|
|
514
|
+
options: string[];
|
|
514
515
|
formType: string;
|
|
515
516
|
propType: string;
|
|
516
517
|
};
|
|
517
|
-
|
|
518
|
+
maxLength: {
|
|
518
519
|
group: string;
|
|
519
520
|
label: string;
|
|
520
521
|
description: string;
|
|
521
522
|
editable: boolean;
|
|
522
523
|
required: boolean;
|
|
523
524
|
defaultValue: null;
|
|
525
|
+
min: number;
|
|
526
|
+
step: number;
|
|
527
|
+
precision: number;
|
|
524
528
|
formType: string;
|
|
525
529
|
propType: string;
|
|
526
530
|
};
|
|
527
|
-
|
|
531
|
+
placeholder: {
|
|
528
532
|
group: string;
|
|
529
533
|
label: string;
|
|
530
534
|
description: string;
|
|
531
|
-
formType: string;
|
|
532
|
-
propType: string;
|
|
533
|
-
defaultValue: null;
|
|
534
535
|
editable: boolean;
|
|
535
536
|
required: boolean;
|
|
537
|
+
defaultValue: string;
|
|
538
|
+
formType: string;
|
|
539
|
+
propType: string;
|
|
536
540
|
};
|
|
537
|
-
|
|
541
|
+
placeholderTextColor: {
|
|
538
542
|
group: string;
|
|
539
543
|
label: string;
|
|
540
544
|
description: string;
|
|
@@ -544,18 +548,17 @@ export declare const SEED_DATA: ({
|
|
|
544
548
|
formType: string;
|
|
545
549
|
propType: string;
|
|
546
550
|
};
|
|
547
|
-
|
|
551
|
+
returnKeyLabel: {
|
|
548
552
|
group: string;
|
|
549
553
|
label: string;
|
|
550
554
|
description: string;
|
|
551
555
|
editable: boolean;
|
|
552
556
|
required: boolean;
|
|
553
557
|
defaultValue: null;
|
|
554
|
-
options: string[];
|
|
555
558
|
formType: string;
|
|
556
559
|
propType: string;
|
|
557
560
|
};
|
|
558
|
-
|
|
561
|
+
returnKeyType: {
|
|
559
562
|
group: string;
|
|
560
563
|
label: string;
|
|
561
564
|
description: string;
|
|
@@ -566,61 +569,58 @@ export declare const SEED_DATA: ({
|
|
|
566
569
|
formType: string;
|
|
567
570
|
propType: string;
|
|
568
571
|
};
|
|
569
|
-
|
|
572
|
+
selectionColor: {
|
|
570
573
|
group: string;
|
|
571
574
|
label: string;
|
|
572
575
|
description: string;
|
|
573
576
|
editable: boolean;
|
|
574
577
|
required: boolean;
|
|
575
578
|
defaultValue: null;
|
|
576
|
-
min: number;
|
|
577
|
-
step: number;
|
|
578
|
-
precision: number;
|
|
579
579
|
formType: string;
|
|
580
580
|
propType: string;
|
|
581
581
|
};
|
|
582
|
-
|
|
582
|
+
selectTextOnFocus: {
|
|
583
583
|
group: string;
|
|
584
584
|
label: string;
|
|
585
585
|
description: string;
|
|
586
586
|
editable: boolean;
|
|
587
587
|
required: boolean;
|
|
588
|
-
defaultValue:
|
|
588
|
+
defaultValue: null;
|
|
589
589
|
formType: string;
|
|
590
590
|
propType: string;
|
|
591
591
|
};
|
|
592
|
-
|
|
592
|
+
style: {
|
|
593
593
|
group: string;
|
|
594
594
|
label: string;
|
|
595
595
|
description: string;
|
|
596
596
|
editable: boolean;
|
|
597
597
|
required: boolean;
|
|
598
|
-
defaultValue: null;
|
|
599
598
|
formType: string;
|
|
600
599
|
propType: string;
|
|
600
|
+
defaultValue: null;
|
|
601
601
|
};
|
|
602
|
-
|
|
602
|
+
clearButtonMode: {
|
|
603
603
|
group: string;
|
|
604
604
|
label: string;
|
|
605
605
|
description: string;
|
|
606
606
|
editable: boolean;
|
|
607
607
|
required: boolean;
|
|
608
|
+
options: string[];
|
|
608
609
|
defaultValue: null;
|
|
609
610
|
formType: string;
|
|
610
611
|
propType: string;
|
|
611
612
|
};
|
|
612
|
-
|
|
613
|
+
clearTextOnFocus: {
|
|
613
614
|
group: string;
|
|
614
615
|
label: string;
|
|
615
616
|
description: string;
|
|
616
617
|
editable: boolean;
|
|
617
618
|
required: boolean;
|
|
618
619
|
defaultValue: null;
|
|
619
|
-
options: string[];
|
|
620
620
|
formType: string;
|
|
621
621
|
propType: string;
|
|
622
622
|
};
|
|
623
|
-
|
|
623
|
+
enablesReturnKeyAutomatically: {
|
|
624
624
|
group: string;
|
|
625
625
|
label: string;
|
|
626
626
|
description: string;
|
|
@@ -630,7 +630,7 @@ export declare const SEED_DATA: ({
|
|
|
630
630
|
formType: string;
|
|
631
631
|
propType: string;
|
|
632
632
|
};
|
|
633
|
-
|
|
633
|
+
underlineColorAndroid: {
|
|
634
634
|
group: string;
|
|
635
635
|
label: string;
|
|
636
636
|
description: string;
|
|
@@ -16,3 +16,4 @@ export declare function extractStyles(style: StyleProp<any>): {
|
|
|
16
16
|
* `const mergedStyles = StyleSheet.flatten([{ color: "red" }, { color: undefined }])`
|
|
17
17
|
*/
|
|
18
18
|
export declare function applyStyles(baseStyles: Array<StyleProp<any>>, stylesToApply: StyleProp<any> | undefined): any;
|
|
19
|
+
export declare function getValueForRadioButton(value: string | number): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "43.4.
|
|
3
|
+
"version": "43.4.6-28bb0e.2+28bb0e0f",
|
|
4
4
|
"description": "Core (non-native) Components",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -54,8 +54,6 @@
|
|
|
54
54
|
"lodash.omit": "^4.5.0",
|
|
55
55
|
"lodash.tonumber": "^4.0.3",
|
|
56
56
|
"react-native-modal-datetime-picker": "^13.0.0",
|
|
57
|
-
"react-native-pager-view": "^5.4.9",
|
|
58
|
-
"react-native-tab-view": "^3.1.1",
|
|
59
57
|
"react-native-typography": "^1.4.1",
|
|
60
58
|
"react-native-web-swiper": "^2.2.1"
|
|
61
59
|
},
|
|
@@ -82,5 +80,5 @@
|
|
|
82
80
|
]
|
|
83
81
|
]
|
|
84
82
|
},
|
|
85
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "28bb0e0ff5d5dceddbda9a94806ad0d7b00708d3"
|
|
86
84
|
}
|
|
@@ -1,28 +1,34 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useCallback, useState } from "react";
|
|
2
2
|
import { TextInput } from "react-native";
|
|
3
|
+
import { isString, isNumber, isNaN } from "lodash";
|
|
3
4
|
const NumberInput = ({ onChangeText, value, defaultValue, ...props }) => {
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const formatValueToStringNumber = useCallback((valueToFormat, currentStringNumberValue) => {
|
|
6
|
+
if (valueToFormat != null) {
|
|
7
|
+
if (isString(valueToFormat)) {
|
|
8
|
+
if (/^0[1-9]$/.test(valueToFormat)) {
|
|
9
|
+
return valueToFormat.slice(1);
|
|
10
|
+
}
|
|
11
|
+
else if (currentStringNumberValue?.includes(".") &&
|
|
12
|
+
valueToFormat === currentStringNumberValue + ".") {
|
|
13
|
+
return currentStringNumberValue;
|
|
14
|
+
}
|
|
15
|
+
else if (/^[+-]?([0-9]+\.?[0-9]*|\.[0-9]+)$/.test(valueToFormat)) {
|
|
16
|
+
return valueToFormat;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
else if (isNumber(valueToFormat) && !isNaN(valueToFormat)) {
|
|
20
|
+
return valueToFormat.toString();
|
|
21
|
+
}
|
|
8
22
|
}
|
|
9
|
-
|
|
23
|
+
return "0";
|
|
24
|
+
}, []);
|
|
25
|
+
const [stringNumberValue, setStringNumberValue] = useState(formatValueToStringNumber(value));
|
|
10
26
|
const handleChangeText = (newValue) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
onChangeText(number);
|
|
16
|
-
}
|
|
27
|
+
const newStringNumberValue = formatValueToStringNumber(newValue, stringNumberValue);
|
|
28
|
+
const number = parseFloat(newStringNumberValue);
|
|
29
|
+
setStringNumberValue(newStringNumberValue);
|
|
30
|
+
onChangeText?.(number);
|
|
17
31
|
};
|
|
18
|
-
|
|
19
|
-
if (value != undefined) {
|
|
20
|
-
strValue = value.toString();
|
|
21
|
-
if (isDecimal && !strValue.includes(".")) {
|
|
22
|
-
strValue = `${strValue}.`;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return (React.createElement(TextInput, { keyboardType: "numeric", ...props, value: strValue, defaultValue: defaultValue?.toString(), onChangeText: handleChangeText }));
|
|
32
|
+
return (React.createElement(TextInput, { keyboardType: "numeric", ...props, value: stringNumberValue, defaultValue: formatValueToStringNumber(defaultValue), onChangeText: handleChangeText }));
|
|
26
33
|
};
|
|
27
34
|
export default NumberInput;
|
|
28
|
-
// comment to try to fix sourcemap issue
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useCallback, useState } from "react";
|
|
2
2
|
import { TextInput } from "react-native";
|
|
3
|
+
import { isString, isNumber, isNaN } from "lodash";
|
|
3
4
|
|
|
4
5
|
interface Props {
|
|
5
|
-
value?: number;
|
|
6
|
-
defaultValue?: number;
|
|
7
|
-
onChangeText
|
|
6
|
+
value?: number | string;
|
|
7
|
+
defaultValue?: number | string;
|
|
8
|
+
onChangeText?: (value?: number) => void;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
const NumberInput: React.FC<Props> = ({
|
|
@@ -13,43 +14,54 @@ const NumberInput: React.FC<Props> = ({
|
|
|
13
14
|
defaultValue,
|
|
14
15
|
...props
|
|
15
16
|
}) => {
|
|
16
|
-
const
|
|
17
|
-
|
|
17
|
+
const formatValueToStringNumber = useCallback(
|
|
18
|
+
(valueToFormat?: number | string, currentStringNumberValue?: string) => {
|
|
19
|
+
if (valueToFormat != null) {
|
|
20
|
+
if (isString(valueToFormat)) {
|
|
21
|
+
if (/^0[1-9]$/.test(valueToFormat)) {
|
|
22
|
+
return valueToFormat.slice(1);
|
|
23
|
+
} else if (
|
|
24
|
+
currentStringNumberValue?.includes(".") &&
|
|
25
|
+
valueToFormat === currentStringNumberValue + "."
|
|
26
|
+
) {
|
|
27
|
+
return currentStringNumberValue;
|
|
28
|
+
} else if (/^[+-]?([0-9]+\.?[0-9]*|\.[0-9]+)$/.test(valueToFormat)) {
|
|
29
|
+
return valueToFormat;
|
|
30
|
+
}
|
|
31
|
+
} else if (isNumber(valueToFormat) && !isNaN(valueToFormat)) {
|
|
32
|
+
return valueToFormat.toString();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return "0";
|
|
37
|
+
},
|
|
38
|
+
[]
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const [stringNumberValue, setStringNumberValue] = useState(
|
|
42
|
+
formatValueToStringNumber(value)
|
|
18
43
|
);
|
|
19
|
-
React.useEffect(() => {
|
|
20
|
-
if (value) {
|
|
21
|
-
setIsDecimal(value.toString().includes("."));
|
|
22
|
-
}
|
|
23
|
-
}, [value]);
|
|
24
44
|
|
|
25
45
|
const handleChangeText = (newValue: string) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
};
|
|
46
|
+
const newStringNumberValue = formatValueToStringNumber(
|
|
47
|
+
newValue,
|
|
48
|
+
stringNumberValue
|
|
49
|
+
);
|
|
50
|
+
const number = parseFloat(newStringNumberValue);
|
|
33
51
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (isDecimal && !strValue.includes(".")) {
|
|
38
|
-
strValue = `${strValue}.`;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
52
|
+
setStringNumberValue(newStringNumberValue);
|
|
53
|
+
onChangeText?.(number);
|
|
54
|
+
};
|
|
41
55
|
|
|
42
56
|
return (
|
|
43
57
|
<TextInput
|
|
44
58
|
keyboardType="numeric"
|
|
45
59
|
{...props}
|
|
46
|
-
value={
|
|
47
|
-
defaultValue={defaultValue
|
|
60
|
+
value={stringNumberValue}
|
|
61
|
+
defaultValue={formatValueToStringNumber(defaultValue)}
|
|
48
62
|
onChangeText={handleChangeText}
|
|
49
63
|
/>
|
|
50
64
|
);
|
|
51
65
|
};
|
|
52
66
|
|
|
53
67
|
export default NumberInput;
|
|
54
|
-
|
|
55
|
-
// comment to try to fix sourcemap issue
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import Config from "../Config";
|
|
3
3
|
import IconButton from "../IconButton";
|
|
4
|
+
import { getValueForRadioButton } from "../../utilities";
|
|
4
5
|
import { useRadioButtonGroupContext } from "./context";
|
|
5
|
-
const RadioButton = ({ Icon, disabled = false, color, value, selected, unselectedColor, onPress
|
|
6
|
+
const RadioButton = ({ Icon, disabled = false, color, value = "", selected, unselectedColor, onPress, size = Config.radioButtonSize, selectedIcon = "MaterialIcons/radio-button-checked", unselectedIcon = "MaterialIcons/radio-button-unchecked", style, ...rest }) => {
|
|
6
7
|
const { value: contextValue, onValueChange } = useRadioButtonGroupContext();
|
|
8
|
+
const realValue = getValueForRadioButton(value);
|
|
9
|
+
const realContextValue = getValueForRadioButton(contextValue);
|
|
10
|
+
const isSelected = selected ?? realContextValue === realValue;
|
|
7
11
|
const handlePress = () => {
|
|
8
|
-
onPress
|
|
9
|
-
|
|
10
|
-
onValueChange(value);
|
|
11
|
-
}
|
|
12
|
+
onPress?.(realValue);
|
|
13
|
+
onValueChange?.(realValue);
|
|
12
14
|
};
|
|
13
|
-
const isSelected = selected || (contextValue != null && contextValue === value);
|
|
14
15
|
return (React.createElement(IconButton, { Icon: Icon, icon: isSelected ? selectedIcon : unselectedIcon, color: isSelected ? color : unselectedColor, disabled: disabled, onPress: handlePress, size: size, style: style, ...rest }));
|
|
15
16
|
};
|
|
16
17
|
export default RadioButton;
|