@draftbit/core 43.4.15-7fb85c.1 → 43.4.15-f2b58e.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.
@@ -28,19 +28,23 @@ const RadioButtonGroup = _ref => {
28
28
  direction = _context.Direction.Vertical,
29
29
  value = "",
30
30
  onValueChange,
31
- defaultValue = "",
31
+ defaultValue,
32
32
  style,
33
33
  children,
34
34
  ...rest
35
35
  } = _ref;
36
36
  const [internalValue, setInternalValue] = React.useState("");
37
37
  React.useEffect(() => {
38
- const realValue = (0, _utilities.getValueForRadioButton)(value);
39
- setInternalValue(realValue);
38
+ if (value != null) {
39
+ const realValue = (0, _utilities.getValueForRadioButton)(value);
40
+ setInternalValue(realValue);
41
+ }
40
42
  }, [value]);
41
43
  React.useEffect(() => {
42
- const realDefaultValue = (0, _utilities.getValueForRadioButton)(defaultValue);
43
- setInternalValue(realDefaultValue);
44
+ if (defaultValue != null) {
45
+ const realDefaultValue = (0, _utilities.getValueForRadioButton)(defaultValue);
46
+ setInternalValue(realDefaultValue);
47
+ }
44
48
  }, [defaultValue]);
45
49
 
46
50
  const handleValueChange = newValue => {
@@ -65,7 +69,7 @@ const RadioButtonGroup = _ref => {
65
69
  }, style]
66
70
  }, rest), /*#__PURE__*/React.createElement(Provider, {
67
71
  value: {
68
- value: internalValue || "",
72
+ value: internalValue,
69
73
  onValueChange: handleValueChange,
70
74
  direction
71
75
  }
@@ -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","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,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EC,MAAAA,SAAS,EAAE;AAAb,KAAD,EAAoBlB,KAApB;AAAb,KAA6CE,IAA7C,gBACE,oBAAC,QAAD;AACE,IAAA,KAAK,EAAE;AACLL,MAAAA,KAAK,EAAEM,aAAa,IAAI,EADnB;AAELL,MAAAA,aAAa,EAAEY,iBAFV;AAGLhB,MAAAA;AAHK;AADT,kBAOE,oBAAC,iBAAD;AAAM,IAAA,KAAK,EAAEmB;AAAb,KAA+BZ,QAA/B,CAPF,CADF,CADF;AAaD,CAvDD;;eAyDeR,gB","sourcesContent":["import * as React from \"react\";\nimport { View, StyleProp, ViewStyle } from \"react-native\";\nimport type { Theme } from \"../../styles/DefaultTheme\";\nimport { getValueForRadioButton } from \"../../utilities\";\nimport { radioButtonGroupContext, Direction } from \"./context\";\nexport interface RadioButtonGroupProps {\n direction?: Direction;\n style?: StyleProp<ViewStyle>;\n value: string;\n onValueChange?: (value: string) => void;\n defaultValue?: string | number;\n theme: Theme;\n children: React.ReactNode;\n}\n\nconst { Provider } = radioButtonGroupContext;\n\nconst RadioButtonGroup: React.FC<RadioButtonGroupProps> = ({\n direction = Direction.Vertical,\n value = \"\",\n onValueChange,\n defaultValue = \"\",\n style,\n children,\n ...rest\n}) => {\n const [internalValue, setInternalValue] = React.useState<string>(\"\");\n\n React.useEffect(() => {\n const realValue = getValueForRadioButton(value);\n\n setInternalValue(realValue);\n }, [value]);\n\n React.useEffect(() => {\n const realDefaultValue = getValueForRadioButton(defaultValue);\n\n setInternalValue(realDefaultValue);\n }, [defaultValue]);\n\n const handleValueChange = (newValue: string | number) => {\n const realNewValue = getValueForRadioButton(newValue);\n\n setInternalValue(realNewValue);\n onValueChange?.(realNewValue);\n };\n\n const _containerStyle: StyleProp<ViewStyle> = [\n {\n flexDirection: direction === Direction.Horizontal ? \"row\" : \"column\",\n },\n ];\n\n if (direction !== Direction.Vertical) {\n _containerStyle.push({\n alignItems: \"center\",\n });\n }\n\n return (\n <View style={[{ minHeight: 40 }, style]} {...rest}>\n <Provider\n value={{\n value: internalValue || \"\",\n onValueChange: handleValueChange,\n direction,\n }}\n >\n <View style={_containerStyle}>{children}</View>\n </Provider>\n </View>\n );\n};\n\nexport default RadioButtonGroup;\n"]}
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,YAJyD;AAKzDC,IAAAA,KALyD;AAMzDC,IAAAA,QANyD;AAOzD,OAAGC;AAPsD,GAQrD;AACJ,QAAM,CAACC,aAAD,EAAgBC,gBAAhB,IAAoCC,KAAK,CAACC,QAAN,CAAe,EAAf,CAA1C;AAEAD,EAAAA,KAAK,CAACE,SAAN,CAAgB,MAAM;AACpB,QAAIV,KAAK,IAAI,IAAb,EAAmB;AACjB,YAAMW,SAAS,GAAG,uCAAuBX,KAAvB,CAAlB;AAEAO,MAAAA,gBAAgB,CAACI,SAAD,CAAhB;AACD;AACF,GAND,EAMG,CAACX,KAAD,CANH;AAQAQ,EAAAA,KAAK,CAACE,SAAN,CAAgB,MAAM;AACpB,QAAIR,YAAY,IAAI,IAApB,EAA0B;AACxB,YAAMU,gBAAgB,GAAG,uCAAuBV,YAAvB,CAAzB;AAEAK,MAAAA,gBAAgB,CAACK,gBAAD,CAAhB;AACD;AACF,GAND,EAMG,CAACV,YAAD,CANH;;AAQA,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,aADF;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,CA3DD;;eA6DeR,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 | number;\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(\"\");\n\n React.useEffect(() => {\n if (value != null) {\n const realValue = getValueForRadioButton(value);\n\n setInternalValue(realValue);\n }\n }, [value]);\n\n React.useEffect(() => {\n if (defaultValue != null) {\n const realDefaultValue = getValueForRadioButton(defaultValue);\n\n setInternalValue(realDefaultValue);\n }\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"]}
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
1
+ {"version":3,"sources":["PickerTypes.js"],"names":[],"mappings":"AAAA","sourcesContent":["export {};\n"]}
@@ -1,3 +1,5 @@
1
+ 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); }
2
+
1
3
  import React from "react";
2
4
  import { View } from "react-native";
3
5
  import Text from "../Text";
@@ -20,10 +22,9 @@ const RadioButtonFieldGroup = _ref => {
20
22
  fontSize: theme.typography.headline4.fontSize,
21
23
  color: theme.typography.headline4.color
22
24
  }, labelStyle]
23
- }, label), /*#__PURE__*/React.createElement(RadioButtonGroup, {
24
- theme: theme,
25
- ...rest
26
- }, children));
25
+ }, label), /*#__PURE__*/React.createElement(RadioButtonGroup, _extends({
26
+ theme: theme
27
+ }, rest), children));
27
28
  };
28
29
 
29
30
  export default withTheme(RadioButtonFieldGroup);
@@ -1 +1 @@
1
- {"version":3,"sources":["RadioButtonFieldGroup.js"],"names":["React","View","Text","withTheme","RadioButtonGroup","RadioButtonFieldGroup","label","children","theme","labelStyle","style","rest","createElement","fontSize","typography","headline4","color"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,IAAT,QAAqB,cAArB;AACA,OAAOC,IAAP,MAAiB,SAAjB;AACA,SAASC,SAAT,QAA0B,eAA1B;AACA,OAAOC,gBAAP,MAA6B,oBAA7B;;AACA,MAAMC,qBAAqB,GAAG,QAA4D;AAAA,MAA3D;AAAEC,IAAAA,KAAF;AAASC,IAAAA,QAAT;AAAmBC,IAAAA,KAAnB;AAA0BC,IAAAA,UAA1B;AAAsCC,IAAAA,KAAtC;AAA6C,OAAGC;AAAhD,GAA2D;AACtF,sBAAQX,KAAK,CAACY,aAAN,CAAoBX,IAApB,EAA0B;AAAES,IAAAA,KAAK,EAAEA;AAAT,GAA1B,eACJV,KAAK,CAACY,aAAN,CAAoBV,IAApB,EAA0B;AAAEQ,IAAAA,KAAK,EAAE,CAC3B;AACIG,MAAAA,QAAQ,EAAEL,KAAK,CAACM,UAAN,CAAiBC,SAAjB,CAA2BF,QADzC;AAEIG,MAAAA,KAAK,EAAER,KAAK,CAACM,UAAN,CAAiBC,SAAjB,CAA2BC;AAFtC,KAD2B,EAK3BP,UAL2B;AAAT,GAA1B,EAMSH,KANT,CADI,eAQJN,KAAK,CAACY,aAAN,CAAoBR,gBAApB,EAAsC;AAAEI,IAAAA,KAAK,EAAEA,KAAT;AAAgB,OAAGG;AAAnB,GAAtC,EAAiEJ,QAAjE,CARI,CAAR;AASH,CAVD;;AAWA,eAAeJ,SAAS,CAACE,qBAAD,CAAxB","sourcesContent":["import React from \"react\";\nimport { View } from \"react-native\";\nimport Text from \"../Text\";\nimport { withTheme } from \"../../theming\";\nimport RadioButtonGroup from \"./RadioButtonGroup\";\nconst RadioButtonFieldGroup = ({ label, children, theme, labelStyle, style, ...rest }) => {\n return (React.createElement(View, { style: style },\n React.createElement(Text, { style: [\n {\n fontSize: theme.typography.headline4.fontSize,\n color: theme.typography.headline4.color,\n },\n labelStyle,\n ] }, label),\n React.createElement(RadioButtonGroup, { theme: theme, ...rest }, children)));\n};\nexport default withTheme(RadioButtonFieldGroup);\n"]}
1
+ {"version":3,"sources":["RadioButtonFieldGroup.tsx"],"names":["React","View","Text","withTheme","RadioButtonGroup","RadioButtonFieldGroup","label","children","theme","labelStyle","style","rest","fontSize","typography","headline4","color"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,IAAT,QAAsD,cAAtD;AACA,OAAOC,IAAP,MAAiB,SAAjB;AACA,SAASC,SAAT,QAA0B,eAA1B;AACA,OAAOC,gBAAP,MAAwD,oBAAxD;;AAQA,MAAMC,qBAAsC,GAAG,QAOzC;AAAA,MAP0C;AAC9CC,IAAAA,KAD8C;AAE9CC,IAAAA,QAF8C;AAG9CC,IAAAA,KAH8C;AAI9CC,IAAAA,UAJ8C;AAK9CC,IAAAA,KAL8C;AAM9C,OAAGC;AAN2C,GAO1C;AACJ,sBACE,oBAAC,IAAD;AAAM,IAAA,KAAK,EAAED;AAAb,kBACE,oBAAC,IAAD;AACE,IAAA,KAAK,EAAE,CACL;AACEE,MAAAA,QAAQ,EAAEJ,KAAK,CAACK,UAAN,CAAiBC,SAAjB,CAA2BF,QADvC;AAEEG,MAAAA,KAAK,EAAEP,KAAK,CAACK,UAAN,CAAiBC,SAAjB,CAA2BC;AAFpC,KADK,EAKLN,UALK;AADT,KASGH,KATH,CADF,eAYE,oBAAC,gBAAD;AAAkB,IAAA,KAAK,EAAEE;AAAzB,KAAoCG,IAApC,GACGJ,QADH,CAZF,CADF;AAkBD,CA1BD;;AA4BA,eAAeJ,SAAS,CAACE,qBAAD,CAAxB","sourcesContent":["import React from \"react\";\nimport { View, StyleProp, TextStyle, ViewStyle } from \"react-native\";\nimport Text from \"../Text\";\nimport { withTheme } from \"../../theming\";\nimport RadioButtonGroup, { RadioButtonGroupProps } from \"./RadioButtonGroup\";\n\ninterface Props extends RadioButtonGroupProps {\n label?: string;\n labelStyle?: StyleProp<TextStyle>;\n style?: StyleProp<ViewStyle>;\n}\n\nconst RadioButtonFieldGroup: React.FC<Props> = ({\n label,\n children,\n theme,\n labelStyle,\n style,\n ...rest\n}) => {\n return (\n <View style={style}>\n <Text\n style={[\n {\n fontSize: theme.typography.headline4.fontSize,\n color: theme.typography.headline4.color,\n },\n labelStyle,\n ]}\n >\n {label}\n </Text>\n <RadioButtonGroup theme={theme} {...rest}>\n {children}\n </RadioButtonGroup>\n </View>\n );\n};\n\nexport default withTheme(RadioButtonFieldGroup);\n"]}
@@ -13,19 +13,23 @@ const RadioButtonGroup = _ref => {
13
13
  direction = Direction.Vertical,
14
14
  value = "",
15
15
  onValueChange,
16
- defaultValue = "",
16
+ defaultValue,
17
17
  style,
18
18
  children,
19
19
  ...rest
20
20
  } = _ref;
21
21
  const [internalValue, setInternalValue] = React.useState("");
22
22
  React.useEffect(() => {
23
- const realValue = getValueForRadioButton(value);
24
- setInternalValue(realValue);
23
+ if (value != null) {
24
+ const realValue = getValueForRadioButton(value);
25
+ setInternalValue(realValue);
26
+ }
25
27
  }, [value]);
26
28
  React.useEffect(() => {
27
- const realDefaultValue = getValueForRadioButton(defaultValue);
28
- setInternalValue(realDefaultValue);
29
+ if (defaultValue != null) {
30
+ const realDefaultValue = getValueForRadioButton(defaultValue);
31
+ setInternalValue(realDefaultValue);
32
+ }
29
33
  }, [defaultValue]);
30
34
 
31
35
  const handleValueChange = newValue => {
@@ -50,7 +54,7 @@ const RadioButtonGroup = _ref => {
50
54
  }, style]
51
55
  }, rest), /*#__PURE__*/React.createElement(Provider, {
52
56
  value: {
53
- value: internalValue || "",
57
+ value: internalValue,
54
58
  onValueChange: handleValueChange,
55
59
  direction
56
60
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["RadioButtonGroup.tsx"],"names":["React","View","getValueForRadioButton","radioButtonGroupContext","Direction","Provider","RadioButtonGroup","direction","Vertical","value","onValueChange","defaultValue","style","children","rest","internalValue","setInternalValue","useState","useEffect","realValue","realDefaultValue","handleValueChange","newValue","realNewValue","_containerStyle","flexDirection","Horizontal","push","alignItems","minHeight"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,IAAT,QAA2C,cAA3C;AAEA,SAASC,sBAAT,QAAuC,iBAAvC;AACA,SAASC,uBAAT,EAAkCC,SAAlC,QAAmD,WAAnD;AAWA,MAAM;AAAEC,EAAAA;AAAF,IAAeF,uBAArB;;AAEA,MAAMG,gBAAiD,GAAG,QAQpD;AAAA,MARqD;AACzDC,IAAAA,SAAS,GAAGH,SAAS,CAACI,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,IAAoChB,KAAK,CAACiB,QAAN,CAAuB,EAAvB,CAA1C;AAEAjB,EAAAA,KAAK,CAACkB,SAAN,CAAgB,MAAM;AACpB,UAAMC,SAAS,GAAGjB,sBAAsB,CAACO,KAAD,CAAxC;AAEAO,IAAAA,gBAAgB,CAACG,SAAD,CAAhB;AACD,GAJD,EAIG,CAACV,KAAD,CAJH;AAMAT,EAAAA,KAAK,CAACkB,SAAN,CAAgB,MAAM;AACpB,UAAME,gBAAgB,GAAGlB,sBAAsB,CAACS,YAAD,CAA/C;AAEAK,IAAAA,gBAAgB,CAACI,gBAAD,CAAhB;AACD,GAJD,EAIG,CAACT,YAAD,CAJH;;AAMA,QAAMU,iBAAiB,GAAIC,QAAD,IAA+B;AACvD,UAAMC,YAAY,GAAGrB,sBAAsB,CAACoB,QAAD,CAA3C;AAEAN,IAAAA,gBAAgB,CAACO,YAAD,CAAhB;AACAb,IAAAA,aAAa,SAAb,IAAAA,aAAa,WAAb,YAAAA,aAAa,CAAGa,YAAH,CAAb;AACD,GALD;;AAOA,QAAMC,eAAqC,GAAG,CAC5C;AACEC,IAAAA,aAAa,EAAElB,SAAS,KAAKH,SAAS,CAACsB,UAAxB,GAAqC,KAArC,GAA6C;AAD9D,GAD4C,CAA9C;;AAMA,MAAInB,SAAS,KAAKH,SAAS,CAACI,QAA5B,EAAsC;AACpCgB,IAAAA,eAAe,CAACG,IAAhB,CAAqB;AACnBC,MAAAA,UAAU,EAAE;AADO,KAArB;AAGD;;AAED,sBACE,oBAAC,IAAD;AAAM,IAAA,KAAK,EAAE,CAAC;AAAEC,MAAAA,SAAS,EAAE;AAAb,KAAD,EAAoBjB,KAApB;AAAb,KAA6CE,IAA7C,gBACE,oBAAC,QAAD;AACE,IAAA,KAAK,EAAE;AACLL,MAAAA,KAAK,EAAEM,aAAa,IAAI,EADnB;AAELL,MAAAA,aAAa,EAAEW,iBAFV;AAGLd,MAAAA;AAHK;AADT,kBAOE,oBAAC,IAAD;AAAM,IAAA,KAAK,EAAEiB;AAAb,KAA+BX,QAA/B,CAPF,CADF,CADF;AAaD,CAvDD;;AAyDA,eAAeP,gBAAf","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"]}
1
+ {"version":3,"sources":["RadioButtonGroup.tsx"],"names":["React","View","getValueForRadioButton","radioButtonGroupContext","Direction","Provider","RadioButtonGroup","direction","Vertical","value","onValueChange","defaultValue","style","children","rest","internalValue","setInternalValue","useState","useEffect","realValue","realDefaultValue","handleValueChange","newValue","realNewValue","_containerStyle","flexDirection","Horizontal","push","alignItems","minHeight"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,IAAT,QAA2C,cAA3C;AAEA,SAASC,sBAAT,QAAuC,iBAAvC;AACA,SAASC,uBAAT,EAAkCC,SAAlC,QAAmD,WAAnD;AAWA,MAAM;AAAEC,EAAAA;AAAF,IAAeF,uBAArB;;AAEA,MAAMG,gBAAiD,GAAG,QAQpD;AAAA,MARqD;AACzDC,IAAAA,SAAS,GAAGH,SAAS,CAACI,QADmC;AAEzDC,IAAAA,KAAK,GAAG,EAFiD;AAGzDC,IAAAA,aAHyD;AAIzDC,I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;AAAb,KAA6CE,IAA7C,gBACE,oBAAC,QAAD;AACE,IAAA,KAAK,EAAE;AACLL,MAAAA,KAAK,EAAEM,aADF;AAELL,MAAAA,aAAa,EAAEW,iBAFV;AAGLd,MAAAA;AAHK;AADT,kBAOE,oBAAC,IAAD;AAAM,IAAA,KAAK,EAAEiB;AAAb,KAA+BX,QAA/B,CAPF,CADF,CADF;AAaD,CA3DD;;AA6DA,eAAeP,gBAAf","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 | number;\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(\"\");\n\n React.useEffect(() => {\n if (value != null) {\n const realValue = getValueForRadioButton(value);\n\n setInternalValue(realValue);\n }\n }, [value]);\n\n React.useEffect(() => {\n if (defaultValue != null) {\n const realDefaultValue = getValueForRadioButton(defaultValue);\n\n setInternalValue(realDefaultValue);\n }\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"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["Container.ts"],"names":["GROUPS","COMPONENT_TYPES","FORM_TYPES","PROP_TYPES","createElevationType","createImageProp","createResizeModeProp","SEED_DATA","name","tag","description","category","deprecated","layout","height","props","useThemeGutterPadding","group","basic","label","formType","boolean","propType","BOOLEAN","defaultValue","editable","required","backgroundImage","backgroundImageResizeMode","elevation"],"mappings":"AAAA,SACEA,MADF,EAEEC,eAFF,EAGEC,UAHF,EAIEC,UAJF,EAKEC,mBALF,EAMEC,eANF,EAOEC,oBAPF,QAQO,iBARP;AAUA,OAAO,MAAMC,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,WADiB;AAEvBC,EAAAA,GAAG,EAAE,WAFkB;AAGvBC,EAAAA,WAAW,EAAE,2CAHU;AAIvBC,EAAAA,QAAQ,EAAEV,eAAe,CAACW,UAJH;AAKvBC,EAAAA,MAAM,EAAE;AACNC,IAAAA,MAAM,EAAE;AADF,GALe;AAQvBC,EAAAA,KAAK,EAAE;AACLC,IAAAA,qBAAqB,EAAE;AACrBC,MAAAA,KAAK,EAAEjB,MAAM,CAACkB,KADO;AAErBC,MAAAA,KAAK,EAAE,oBAFc;AAGrBT,MAAAA,WAAW,EACT,gFAJmB;AAKrBU,MAAAA,QAAQ,EAAElB,UAAU,CAACmB,OALA;AAMrBC,MAAAA,QAAQ,EAAEnB,UAAU,CAACoB,OANA;AAOrBC,MAAAA,YAAY,EAAE,KAPO;AAQrBC,MAAAA,QAAQ,EAAE,KARW;AASrBC,MAAAA,QAAQ,EAAE;AATW,KADlB;AAYLC,IAAAA,eAAe,EAAEtB,eAAe,CAAC;AAC/Bc,MAAAA,KAAK,EAAE,kBADwB;AAE/BT,MAAAA,WAAW,EAAE,iCAFkB;AAG/Bc,MAAAA,YAAY,EAAE;AAHiB,KAAD,CAZ3B;AAiBLI,IAAAA,yBAAyB,EAAEtB,oBAAoB,EAjB1C;AAkBLuB,IAAAA,SAAS,EAAEzB,mBAAmB,CAAC,CAAD;AAlBzB;AARgB,CAAlB","sourcesContent":["import {\n GROUPS,\n COMPONENT_TYPES,\n FORM_TYPES,\n PROP_TYPES,\n createElevationType,\n createImageProp,\n createResizeModeProp,\n} from \"@draftbit/types\";\n\nexport const SEED_DATA = {\n name: \"Container\",\n tag: \"Container\",\n description: \"A container component with gutter padding\",\n category: COMPONENT_TYPES.deprecated,\n layout: {\n height: 250,\n },\n props: {\n useThemeGutterPadding: {\n group: GROUPS.basic,\n label: \"Use gutter padding\",\n description:\n \"When true, uses the theme gutter spacing as the container's horizontal padding\",\n formType: FORM_TYPES.boolean,\n propType: PROP_TYPES.BOOLEAN,\n defaultValue: false,\n editable: false,\n required: true,\n },\n backgroundImage: createImageProp({\n label: \"Background Image\",\n description: \"Apply a custom background image\",\n defaultValue: null,\n }),\n backgroundImageResizeMode: createResizeModeProp(),\n elevation: createElevationType(0),\n },\n};\n"]}
1
+ {"version":3,"sources":["Container.js"],"names":["GROUPS","COMPONENT_TYPES","FORM_TYPES","PROP_TYPES","createElevationType","createImageProp","createResizeModeProp","SEED_DATA","name","tag","description","category","deprecated","layout","height","props","useThemeGutterPadding","group","basic","label","formType","boolean","propType","BOOLEAN","defaultValue","editable","required","backgroundImage","backgroundImageResizeMode","elevation"],"mappings":"AAAA,SAASA,MAAT,EAAiBC,eAAjB,EAAkCC,UAAlC,EAA8CC,UAA9C,EAA0DC,mBAA1D,EAA+EC,eAA/E,EAAgGC,oBAAhG,QAA6H,iBAA7H;AACA,OAAO,MAAMC,SAAS,GAAG;AACrBC,EAAAA,IAAI,EAAE,WADe;AAErBC,EAAAA,GAAG,EAAE,WAFgB;AAGrBC,EAAAA,WAAW,EAAE,2CAHQ;AAIrBC,EAAAA,QAAQ,EAAEV,eAAe,CAACW,UAJL;AAKrBC,EAAAA,MAAM,EAAE;AACJC,IAAAA,MAAM,EAAE;AADJ,GALa;AAQrBC,EAAAA,KAAK,EAAE;AACHC,IAAAA,qBAAqB,EAAE;AACnBC,MAAAA,KAAK,EAAEjB,MAAM,CAACkB,KADK;AAEnBC,MAAAA,KAAK,EAAE,oBAFY;AAGnBT,MAAAA,WAAW,EAAE,gFAHM;AAInBU,MAAAA,QAAQ,EAAElB,UAAU,CAACmB,OAJF;AAKnBC,MAAAA,QAAQ,EAAEnB,UAAU,CAACoB,OALF;AAMnBC,MAAAA,YAAY,EAAE,KANK;AAOnBC,MAAAA,QAAQ,EAAE,KAPS;AAQnBC,MAAAA,QAAQ,EAAE;AARS,KADpB;AAWHC,IAAAA,eAAe,EAAEtB,eAAe,CAAC;AAC7Bc,MAAAA,KAAK,EAAE,kBADsB;AAE7BT,MAAAA,WAAW,EAAE,iCAFgB;AAG7Bc,MAAAA,YAAY,EAAE;AAHe,KAAD,CAX7B;AAgBHI,IAAAA,yBAAyB,EAAEtB,oBAAoB,EAhB5C;AAiBHuB,IAAAA,SAAS,EAAEzB,mBAAmB,CAAC,CAAD;AAjB3B;AARc,CAAlB","sourcesContent":["import { GROUPS, COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, createElevationType, createImageProp, createResizeModeProp, } from \"@draftbit/types\";\nexport const SEED_DATA = {\n name: \"Container\",\n tag: \"Container\",\n description: \"A container component with gutter padding\",\n category: COMPONENT_TYPES.deprecated,\n layout: {\n height: 250,\n },\n props: {\n useThemeGutterPadding: {\n group: GROUPS.basic,\n label: \"Use gutter padding\",\n description: \"When true, uses the theme gutter spacing as the container's horizontal padding\",\n formType: FORM_TYPES.boolean,\n propType: PROP_TYPES.BOOLEAN,\n defaultValue: false,\n editable: false,\n required: true,\n },\n backgroundImage: createImageProp({\n label: \"Background Image\",\n description: \"Apply a custom background image\",\n defaultValue: null,\n }),\n backgroundImageResizeMode: createResizeModeProp(),\n elevation: createElevationType(0),\n },\n};\n"]}
@@ -5,7 +5,7 @@ import { Direction } from "./context";
5
5
  export interface RadioButtonGroupProps {
6
6
  direction?: Direction;
7
7
  style?: StyleProp<ViewStyle>;
8
- value: string;
8
+ value: string | number;
9
9
  onValueChange?: (value: string) => void;
10
10
  defaultValue?: string | number;
11
11
  theme: Theme;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "43.4.15-7fb85c.1+7fb85c2d",
3
+ "version": "43.4.15-f2b58e.2+f2b58ec7",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -80,5 +80,5 @@
80
80
  ]
81
81
  ]
82
82
  },
83
- "gitHead": "7fb85c2dab4429b2ce879f759c01c27a869fc99f"
83
+ "gitHead": "f2b58ec707e4c6637ec50259daa196e7800176b4"
84
84
  }
@@ -3,15 +3,19 @@ import { View } from "react-native";
3
3
  import { getValueForRadioButton } from "../../utilities";
4
4
  import { radioButtonGroupContext, Direction } from "./context";
5
5
  const { Provider } = radioButtonGroupContext;
6
- const RadioButtonGroup = ({ direction = Direction.Vertical, value = "", onValueChange, defaultValue = "", style, children, ...rest }) => {
6
+ const RadioButtonGroup = ({ direction = Direction.Vertical, value = "", onValueChange, defaultValue, style, children, ...rest }) => {
7
7
  const [internalValue, setInternalValue] = React.useState("");
8
8
  React.useEffect(() => {
9
- const realValue = getValueForRadioButton(value);
10
- setInternalValue(realValue);
9
+ if (value != null) {
10
+ const realValue = getValueForRadioButton(value);
11
+ setInternalValue(realValue);
12
+ }
11
13
  }, [value]);
12
14
  React.useEffect(() => {
13
- const realDefaultValue = getValueForRadioButton(defaultValue);
14
- setInternalValue(realDefaultValue);
15
+ if (defaultValue != null) {
16
+ const realDefaultValue = getValueForRadioButton(defaultValue);
17
+ setInternalValue(realDefaultValue);
18
+ }
15
19
  }, [defaultValue]);
16
20
  const handleValueChange = (newValue) => {
17
21
  const realNewValue = getValueForRadioButton(newValue);
@@ -30,7 +34,7 @@ const RadioButtonGroup = ({ direction = Direction.Vertical, value = "", onValueC
30
34
  }
31
35
  return (React.createElement(View, { style: [{ minHeight: 40 }, style], ...rest },
32
36
  React.createElement(Provider, { value: {
33
- value: internalValue || "",
37
+ value: internalValue,
34
38
  onValueChange: handleValueChange,
35
39
  direction,
36
40
  } },
@@ -6,7 +6,7 @@ import { radioButtonGroupContext, Direction } from "./context";
6
6
  export interface RadioButtonGroupProps {
7
7
  direction?: Direction;
8
8
  style?: StyleProp<ViewStyle>;
9
- value: string;
9
+ value: string | number;
10
10
  onValueChange?: (value: string) => void;
11
11
  defaultValue?: string | number;
12
12
  theme: Theme;
@@ -19,23 +19,27 @@ const RadioButtonGroup: React.FC<RadioButtonGroupProps> = ({
19
19
  direction = Direction.Vertical,
20
20
  value = "",
21
21
  onValueChange,
22
- defaultValue = "",
22
+ defaultValue,
23
23
  style,
24
24
  children,
25
25
  ...rest
26
26
  }) => {
27
- const [internalValue, setInternalValue] = React.useState<string>("");
27
+ const [internalValue, setInternalValue] = React.useState("");
28
28
 
29
29
  React.useEffect(() => {
30
- const realValue = getValueForRadioButton(value);
30
+ if (value != null) {
31
+ const realValue = getValueForRadioButton(value);
31
32
 
32
- setInternalValue(realValue);
33
+ setInternalValue(realValue);
34
+ }
33
35
  }, [value]);
34
36
 
35
37
  React.useEffect(() => {
36
- const realDefaultValue = getValueForRadioButton(defaultValue);
38
+ if (defaultValue != null) {
39
+ const realDefaultValue = getValueForRadioButton(defaultValue);
37
40
 
38
- setInternalValue(realDefaultValue);
41
+ setInternalValue(realDefaultValue);
42
+ }
39
43
  }, [defaultValue]);
40
44
 
41
45
  const handleValueChange = (newValue: string | number) => {
@@ -61,7 +65,7 @@ const RadioButtonGroup: React.FC<RadioButtonGroupProps> = ({
61
65
  <View style={[{ minHeight: 40 }, style]} {...rest}>
62
66
  <Provider
63
67
  value={{
64
- value: internalValue || "",
68
+ value: internalValue,
65
69
  onValueChange: handleValueChange,
66
70
  direction,
67
71
  }}