@draftbit/core 43.2.4-aa029f.0 → 43.2.5-4ece9c.0

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.
Files changed (63) hide show
  1. package/lib/commonjs/components/CircleImage.js +17 -3
  2. package/lib/commonjs/components/DeprecatedCardWrapper.js +2 -14
  3. package/lib/commonjs/components/DeprecatedCardWrapper.js.map +1 -1
  4. package/lib/commonjs/components/DeprecatedFAB.js +20 -4
  5. package/lib/commonjs/components/DeprecatedFAB.js.map +1 -1
  6. package/lib/commonjs/components/NumberInput.js +25 -17
  7. package/lib/commonjs/components/NumberInput.js.map +1 -1
  8. package/lib/commonjs/components/StarRating.js +23 -5
  9. package/lib/commonjs/components/StarRating.js.map +1 -1
  10. package/lib/commonjs/components/Swiper/SwiperItem.js.map +1 -1
  11. package/lib/commonjs/components/ToggleButton.js +3 -3
  12. package/lib/commonjs/components/ToggleButton.js.map +1 -1
  13. package/lib/commonjs/index.js +0 -14
  14. package/lib/commonjs/index.js.map +1 -1
  15. package/lib/commonjs/mappings/AudioPlayer.js.map +1 -1
  16. package/lib/commonjs/mappings/Modal.js.map +1 -1
  17. package/lib/commonjs/mappings/Surface.js.map +1 -1
  18. package/lib/module/components/Accordion/AccordionItem.js +5 -22
  19. package/lib/module/components/Header.js.map +1 -1
  20. package/lib/module/components/NumberInput.js +27 -19
  21. package/lib/module/components/NumberInput.js.map +1 -1
  22. package/lib/module/components/ToggleButton.js +3 -3
  23. package/lib/module/components/ToggleButton.js.map +1 -1
  24. package/lib/module/index.js +0 -1
  25. package/lib/module/index.js.map +1 -1
  26. package/lib/module/mappings/MapMarker.js.map +1 -1
  27. package/lib/typescript/src/components/NumberInput.d.ts +2 -1
  28. package/lib/typescript/src/index.d.ts +0 -1
  29. package/package.json +3 -5
  30. package/src/components/NumberInput.js +19 -14
  31. package/src/components/NumberInput.tsx +28 -19
  32. package/src/components/ToggleButton.js +5 -3
  33. package/src/components/ToggleButton.tsx +5 -3
  34. package/src/index.js +0 -1
  35. package/src/index.tsx +0 -1
  36. package/lib/commonjs/components/TabView/TabView.js +0 -103
  37. package/lib/commonjs/components/TabView/TabView.js.map +0 -1
  38. package/lib/commonjs/components/TabView/TabViewItem.js +0 -27
  39. package/lib/commonjs/components/TabView/TabViewItem.js.map +0 -1
  40. package/lib/commonjs/components/TabView/index.js +0 -24
  41. package/lib/commonjs/components/TabView/index.js.map +0 -1
  42. package/lib/commonjs/mappings/TabView.js +0 -80
  43. package/lib/commonjs/mappings/TabView.js.map +0 -1
  44. package/lib/module/components/TabView/TabView.js +0 -88
  45. package/lib/module/components/TabView/TabView.js.map +0 -1
  46. package/lib/module/components/TabView/TabViewItem.js +0 -19
  47. package/lib/module/components/TabView/TabViewItem.js.map +0 -1
  48. package/lib/module/components/TabView/index.js +0 -3
  49. package/lib/module/components/TabView/index.js.map +0 -1
  50. package/lib/module/mappings/TabView.js +0 -71
  51. package/lib/module/mappings/TabView.js.map +0 -1
  52. package/lib/typescript/src/components/TabView/TabView.d.ts +0 -19
  53. package/lib/typescript/src/components/TabView/TabViewItem.d.ts +0 -10
  54. package/lib/typescript/src/components/TabView/index.d.ts +0 -2
  55. package/lib/typescript/src/mappings/TabView.d.ts +0 -111
  56. package/src/components/TabView/TabView.js +0 -33
  57. package/src/components/TabView/TabView.tsx +0 -97
  58. package/src/components/TabView/TabViewItem.js +0 -5
  59. package/src/components/TabView/TabViewItem.tsx +0 -21
  60. package/src/components/TabView/index.js +0 -2
  61. package/src/components/TabView/index.ts +0 -2
  62. package/src/mappings/TabView.js +0 -73
  63. package/src/mappings/TabView.ts +0 -80
@@ -1,41 +1,49 @@
1
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
2
 
3
3
  import React from "react";
4
- import { TextInput as NativeNumberInput } from "react-native";
4
+ import { TextInput } from "react-native";
5
5
 
6
6
  const NumberInput = _ref => {
7
7
  let {
8
- defaultValue,
9
8
  onChangeText,
9
+ value,
10
+ defaultValue,
10
11
  ...props
11
12
  } = _ref;
12
- const [internalValue, setInternalValue] = React.useState(defaultValue);
13
+ const [isDecimal, setIsDecimal] = React.useState(value && !Number.isInteger(value));
13
14
  React.useEffect(() => {
14
- if (defaultValue != null) {
15
- setInternalValue(defaultValue);
15
+ if (value) {
16
+ setIsDecimal(value.toString().includes("."));
16
17
  }
17
- }, [defaultValue]);
18
-
19
- const handleChangeText = value => {
20
- setInternalValue(value);
18
+ }, [value]);
21
19
 
20
+ const handleChangeText = newValue => {
22
21
  if (onChangeText) {
23
- onChangeText(stringToInteger(value));
22
+ const parsedNumber = parseFloat(newValue);
23
+ const number = isNaN(parsedNumber) ? 0 : parsedNumber;
24
+ setIsDecimal(newValue.includes("."));
25
+ onChangeText(number);
24
26
  }
25
27
  };
26
28
 
27
- return /*#__PURE__*/React.createElement(NativeNumberInput, _extends({
28
- keyboardType: "numeric",
29
- onChangeText: handleChangeText
29
+ let strValue;
30
+
31
+ if (value != undefined) {
32
+ strValue = value.toString();
33
+
34
+ if (isDecimal && !strValue.includes(".")) {
35
+ strValue = `${strValue}.`;
36
+ }
37
+ }
38
+
39
+ return /*#__PURE__*/React.createElement(TextInput, _extends({
40
+ keyboardType: "numeric"
30
41
  }, props, {
31
- value: internalValue
42
+ value: strValue,
43
+ defaultValue: defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.toString(),
44
+ onChangeText: handleChangeText
32
45
  }));
33
46
  };
34
47
 
35
- const stringToInteger = str => {
36
- const number = parseFloat(str);
37
- return isNaN(number) ? 0 : number;
38
- };
39
-
40
48
  export default NumberInput; // comment to try to fix sourcemap issue
41
49
  //# sourceMappingURL=NumberInput.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["NumberInput.tsx"],"names":["React","TextInput","NativeNumberInput","NumberInput","defaultValue","onChangeText","props","internalValue","setInternalValue","useState","useEffect","handleChangeText","value","stringToInteger","str","number","parseFloat","isNaN"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,SAAS,IAAIC,iBAAtB,QAA+C,cAA/C;;AAOA,MAAMC,WAA4B,GAAG,QAI/B;AAAA,MAJgC;AACpCC,IAAAA,YADoC;AAEpCC,IAAAA,YAFoC;AAGpC,OAAGC;AAHiC,GAIhC;AACJ,QAAM,CAACC,aAAD,EAAgBC,gBAAhB,IAAoCR,KAAK,CAACS,QAAN,CAAeL,YAAf,CAA1C;AAEAJ,EAAAA,KAAK,CAACU,SAAN,CAAgB,MAAM;AACpB,QAAIN,YAAY,IAAI,IAApB,EAA0B;AACxBI,MAAAA,gBAAgB,CAACJ,YAAD,CAAhB;AACD;AACF,GAJD,EAIG,CAACA,YAAD,CAJH;;AAMA,QAAMO,gBAAgB,GAAIC,KAAD,IAAmB;AAC1CJ,IAAAA,gBAAgB,CAACI,KAAD,CAAhB;;AACA,QAAIP,YAAJ,EAAkB;AAChBA,MAAAA,YAAY,CAACQ,eAAe,CAACD,KAAD,CAAhB,CAAZ;AACD;AACF,GALD;;AAOA,sBACE,oBAAC,iBAAD;AACE,IAAA,YAAY,EAAC,SADf;AAEE,IAAA,YAAY,EAAED;AAFhB,KAGML,KAHN;AAIE,IAAA,KAAK,EAAEC;AAJT,KADF;AAQD,CA5BD;;AA8BA,MAAMM,eAAe,GAAIC,GAAD,IAAqC;AAC3D,QAAMC,MAAM,GAAGC,UAAU,CAACF,GAAD,CAAzB;AACA,SAAOG,KAAK,CAACF,MAAD,CAAL,GAAgB,CAAhB,GAAoBA,MAA3B;AACD,CAHD;;AAKA,eAAeZ,WAAf,C,CAEA","sourcesContent":["import React from \"react\";\nimport { TextInput as NativeNumberInput } from \"react-native\";\n\ninterface Props {\n defaultValue?: string;\n onChangeText: (value?: number) => void;\n}\n\nconst NumberInput: React.FC<Props> = ({\n defaultValue,\n onChangeText,\n ...props\n}) => {\n const [internalValue, setInternalValue] = React.useState(defaultValue);\n\n React.useEffect(() => {\n if (defaultValue != null) {\n setInternalValue(defaultValue);\n }\n }, [defaultValue]);\n\n const handleChangeText = (value: string) => {\n setInternalValue(value);\n if (onChangeText) {\n onChangeText(stringToInteger(value));\n }\n };\n\n return (\n <NativeNumberInput\n keyboardType=\"numeric\"\n onChangeText={handleChangeText}\n {...props}\n value={internalValue}\n />\n );\n};\n\nconst stringToInteger = (str: string | undefined): number => {\n const number = parseFloat(str as string);\n return isNaN(number) ? 0 : number;\n};\n\nexport default NumberInput;\n\n// comment to try to fix sourcemap issue\n"]}
1
+ {"version":3,"sources":["NumberInput.tsx"],"names":["React","TextInput","NumberInput","onChangeText","value","defaultValue","props","isDecimal","setIsDecimal","useState","Number","isInteger","useEffect","toString","includes","handleChangeText","newValue","parsedNumber","parseFloat","number","isNaN","strValue","undefined"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,SAAT,QAA0B,cAA1B;;AAQA,MAAMC,WAA4B,GAAG,QAK/B;AAAA,MALgC;AACpCC,IAAAA,YADoC;AAEpCC,IAAAA,KAFoC;AAGpCC,IAAAA,YAHoC;AAIpC,OAAGC;AAJiC,GAKhC;AACJ,QAAM,CAACC,SAAD,EAAYC,YAAZ,IAA4BR,KAAK,CAACS,QAAN,CAChCL,KAAK,IAAI,CAACM,MAAM,CAACC,SAAP,CAAiBP,KAAjB,CADsB,CAAlC;AAGAJ,EAAAA,KAAK,CAACY,SAAN,CAAgB,MAAM;AACpB,QAAIR,KAAJ,EAAW;AACTI,MAAAA,YAAY,CAACJ,KAAK,CAACS,QAAN,GAAiBC,QAAjB,CAA0B,GAA1B,CAAD,CAAZ;AACD;AACF,GAJD,EAIG,CAACV,KAAD,CAJH;;AAMA,QAAMW,gBAAgB,GAAIC,QAAD,IAAsB;AAC7C,QAAIb,YAAJ,EAAkB;AAChB,YAAMc,YAAY,GAAGC,UAAU,CAACF,QAAD,CAA/B;AACA,YAAMG,MAAM,GAAGC,KAAK,CAACH,YAAD,CAAL,GAAsB,CAAtB,GAA0BA,YAAzC;AACAT,MAAAA,YAAY,CAACQ,QAAQ,CAACF,QAAT,CAAkB,GAAlB,CAAD,CAAZ;AACAX,MAAAA,YAAY,CAACgB,MAAD,CAAZ;AACD;AACF,GAPD;;AASA,MAAIE,QAAJ;;AACA,MAAIjB,KAAK,IAAIkB,SAAb,EAAwB;AACtBD,IAAAA,QAAQ,GAAGjB,KAAK,CAACS,QAAN,EAAX;;AACA,QAAIN,SAAS,IAAI,CAACc,QAAQ,CAACP,QAAT,CAAkB,GAAlB,CAAlB,EAA0C;AACxCO,MAAAA,QAAQ,GAAI,GAAEA,QAAS,GAAvB;AACD;AACF;;AAED,sBACE,oBAAC,SAAD;AACE,IAAA,YAAY,EAAC;AADf,KAEMf,KAFN;AAGE,IAAA,KAAK,EAAEe,QAHT;AAIE,IAAA,YAAY,EAAEhB,YAAF,aAAEA,YAAF,uBAAEA,YAAY,CAAEQ,QAAd,EAJhB;AAKE,IAAA,YAAY,EAAEE;AALhB,KADF;AASD,CAzCD;;AA2CA,eAAeb,WAAf,C,CAEA","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"]}
@@ -38,8 +38,8 @@ const ToggleButton = _ref => {
38
38
  }, [defaultValue]);
39
39
 
40
40
  const handlePress = () => {
41
- setInternalValue(!toggled);
42
- onPress(!toggled);
41
+ setInternalValue(!internalValue);
42
+ onPress(!internalValue);
43
43
  };
44
44
 
45
45
  return /*#__PURE__*/React.createElement(IconButton, _extends({
@@ -52,7 +52,7 @@ const ToggleButton = _ref => {
52
52
  style: [styles.mainContainer, {
53
53
  width,
54
54
  height,
55
- backgroundColor: toggled ? colors[colorSecondary] : colors[color],
55
+ backgroundColor: internalValue ? colors[colorSecondary] : colors[color],
56
56
  borderColor: colors[borderColor]
57
57
  }, style]
58
58
  }, rest));
@@ -1 +1 @@
1
- {"version":3,"sources":["ToggleButton.tsx"],"names":["React","withTheme","StyleSheet","IconButton","ToggleButton","Icon","icon","toggled","onPress","defaultValue","disabled","color","colorSecondary","borderColor","iconSize","width","height","theme","colors","style","rest","internalValue","setInternalValue","useState","useEffect","handlePress","styles","mainContainer","backgroundColor","create","borderWidth"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,SAAT,QAA0B,YAA1B;AAEA,SAAoBC,UAApB,QAAiD,cAAjD;AACA,OAAOC,UAAP,MAAuB,cAAvB;;AAoBA,MAAMC,YAA6B,GAAG,QAgBhC;AAAA,MAhBiC;AACrCC,IAAAA,IADqC;AAErCC,IAAAA,IAFqC;AAGrCC,IAAAA,OAAO,GAAG,KAH2B;AAIrCC,IAAAA,OAAO,GAAG,MAAM,CAAE,CAJmB;AAKrCC,IAAAA,YALqC;AAMrCC,IAAAA,QAAQ,GAAG,KAN0B;AAOrCC,IAAAA,KAAK,GAAG,SAP6B;AAQrCC,IAAAA,cAAc,GAAG,SARoB;AASrCC,IAAAA,WAAW,GAA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,cAAD,CAAT,GAA4BM,MAAM,CAACP,KAAD,CAH5D;AAIEE,MAAAA,WAAW,EAAEK,MAAM,CAACL,WAAD;AAJrB,KAFK,EAQLM,KARK;AAPT,KAiBMC,IAjBN,EADF;AAqBD,CA3DD;;AA6DA,MAAMM,MAAM,GAAGxB,UAAU,CAAC2B,MAAX,CAAkB;AAC/BF,EAAAA,aAAa,EAAE;AACbG,IAAAA,WAAW,EAAE;AADA;AADgB,CAAlB,CAAf;AAMA,eAAe7B,SAAS,CAACG,YAAD,CAAxB","sourcesContent":["import * as React from \"react\";\nimport { withTheme } from \"../theming\";\nimport { colorTypes } from \"@draftbit/types\";\nimport { StyleProp, StyleSheet, ViewStyle } from \"react-native\";\nimport IconButton from \"./IconButton\";\nimport type { Theme } from \"../styles/DefaultTheme\";\nimport type { IconSlot } from \"../interfaces/Icon\";\n\ntype Props = {\n icon: string;\n toggled?: boolean;\n onPress?: (value: boolean) => void;\n defaultValue?: boolean;\n disabled?: boolean;\n color?: colorTypes;\n colorSecondary?: colorTypes;\n borderColor?: colorTypes;\n iconSize?: number;\n width?: number;\n height?: number;\n style?: StyleProp<ViewStyle>;\n theme: Theme;\n} & IconSlot;\n\nconst ToggleButton: React.FC<Props> = ({\n Icon,\n icon,\n toggled = false,\n onPress = () => {},\n defaultValue,\n disabled = false,\n color = \"primary\",\n colorSecondary = \"surface\",\n borderColor = \"divider\",\n iconSize = 25,\n width = 50,\n height = 50,\n theme: { colors },\n style,\n ...rest\n}) => {\n const [internalValue, setInternalValue] = React.useState<boolean>(\n toggled || defaultValue || false\n );\n\n React.useEffect(() => {\n if (toggled != null) {\n setInternalValue(toggled);\n }\n }, [toggled]);\n\n React.useEffect(() => {\n if (defaultValue != null) {\n setInternalValue(defaultValue);\n }\n }, [defaultValue]);\n\n const handlePress = () => {\n setInternalValue(!toggled);\n onPress(!toggled);\n };\n\n return (\n <IconButton\n Icon={Icon}\n icon={icon}\n size={iconSize}\n color={internalValue ? colors[color] : colors[colorSecondary]}\n onPress={handlePress}\n disabled={disabled}\n style={[\n styles.mainContainer,\n {\n width,\n height,\n backgroundColor: toggled ? colors[colorSecondary] : colors[color],\n borderColor: colors[borderColor],\n },\n style,\n ]}\n {...rest}\n />\n );\n};\n\nconst styles = StyleSheet.create({\n mainContainer: {\n borderWidth: 1,\n },\n});\n\nexport default withTheme(ToggleButton);\n"]}
1
+ {"version":3,"sources":["ToggleButton.tsx"],"names":["React","withTheme","StyleSheet","IconButton","ToggleButton","Icon","icon","toggled","onPress","defaultValue","disabled","color","colorSecondary","borderColor","iconSize","width","height","theme","colors","style","rest","internalValue","setInternalValue","useState","useEffect","handlePress","styles","mainContainer","backgroundColor","create","borderWidth"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,SAAT,QAA0B,YAA1B;AAEA,SAAoBC,UAApB,QAAiD,cAAjD;AACA,OAAOC,UAAP,MAAuB,cAAvB;;AAoBA,MAAMC,YAA6B,GAAG,QAgBhC;AAAA,MAhBiC;AACrCC,IAAAA,IADqC;AAErCC,IAAAA,IAFqC;AAGrCC,IAAAA,OAAO,GAAG,KAH2B;AAIrCC,IAAAA,OAAO,GAAG,MAAM,CAAE,CAJmB;AAKrCC,IAAAA,YALqC;AAMrCC,IAAAA,QAAQ,GAAG,KAN0B;AAOrCC,IAAAA,KAAK,GAAG,SAP6B;AAQrCC,IAAAA,cAAc,GAAG,SARoB;AASrCC,IAAAA,WAAW,GAAG,SATuB;AAUrCC,IAAAA,QAAQ,GAAG,EAV0B;AAWrCC,IAAAA,KAAK,GAAG,EAX6B;AAYrCC,IAAAA,MAAM,GAAG,EAZ4B;AAarCC,IAAAA,KAAK,EAAE;AAAEC,MAAAA;AAAF,KAb8B;AAcrCC,IAAAA,KAdqC;AAerC,OAAGC;AAfkC,GAgBjC;AACJ,QAAM,CAACC,aAAD,EAAgBC,gBAAhB,IAAoCtB,KAAK,CAACuB,QAAN,CACxChB,OAAO,IAAIE,YAAX,IAA2B,KAD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AAxB","sourcesContent":["import * as React from \"react\";\nimport { withTheme } from \"../theming\";\nimport { colorTypes } from \"@draftbit/types\";\nimport { StyleProp, StyleSheet, ViewStyle } from \"react-native\";\nimport IconButton from \"./IconButton\";\nimport type { Theme } from \"../styles/DefaultTheme\";\nimport type { IconSlot } from \"../interfaces/Icon\";\n\ntype Props = {\n icon: string;\n toggled?: boolean;\n onPress?: (value: boolean) => void;\n defaultValue?: boolean;\n disabled?: boolean;\n color?: colorTypes;\n colorSecondary?: colorTypes;\n borderColor?: colorTypes;\n iconSize?: number;\n width?: number;\n height?: number;\n style?: StyleProp<ViewStyle>;\n theme: Theme;\n} & IconSlot;\n\nconst ToggleButton: React.FC<Props> = ({\n Icon,\n icon,\n toggled = false,\n onPress = () => {},\n defaultValue,\n disabled = false,\n color = \"primary\",\n colorSecondary = \"surface\",\n borderColor = \"divider\",\n iconSize = 25,\n width = 50,\n height = 50,\n theme: { colors },\n style,\n ...rest\n}) => {\n const [internalValue, setInternalValue] = React.useState<boolean>(\n toggled || defaultValue || false\n );\n\n React.useEffect(() => {\n if (toggled != null) {\n setInternalValue(toggled);\n }\n }, [toggled]);\n\n React.useEffect(() => {\n if (defaultValue != null) {\n setInternalValue(defaultValue);\n }\n }, [defaultValue]);\n\n const handlePress = () => {\n setInternalValue(!internalValue);\n onPress(!internalValue);\n };\n\n return (\n <IconButton\n Icon={Icon}\n icon={icon}\n size={iconSize}\n color={internalValue ? colors[color] : colors[colorSecondary]}\n onPress={handlePress}\n disabled={disabled}\n style={[\n styles.mainContainer,\n {\n width,\n height,\n backgroundColor: internalValue\n ? colors[colorSecondary]\n : colors[color],\n borderColor: colors[borderColor],\n },\n style,\n ]}\n {...rest}\n />\n );\n};\n\nconst styles = StyleSheet.create({\n mainContainer: {\n borderWidth: 1,\n },\n});\n\nexport default withTheme(ToggleButton);\n"]}
@@ -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
  /* Deprecated: Fix or Delete! */
@@ -1 +1 @@
1
- {"version":3,"sources":["index.tsx"],"names":["injectIcon","withTheme","ThemeProvider","default","Provider","DefaultTheme","Link","ButtonSolid","ButtonOutline","Avatar","AvatarEdit","Card","Carousel","Checkbox","CheckboxGroup","CheckboxRow","CircleImage","Container","Divider","FAB","FieldSearchBarFull","IconButton","Image","NumberInput","ScreenContainer","StarRating","Surface","Switch","SwitchRow","TextField","ToggleButton","Touchable","AccordionGroup","AccordionItem","ActionSheet","ActionSheetItem","ActionSheetCancel","Swiper","SwiperItem","TabView","TabViewItem","Center","Circle","Square","Row","Stack","Spacer","RadioButton","RadioButtonGroup","RadioButtonRow","RadioButtonFieldGroup","Button","CardBlock","CardContainer","CardContainerRating","CardInline","DatePicker","HeaderLarge","HeaderMedium","HeaderOverline","Picker","ProgressBar","ProgressCircle","RowBodyIcon","RowHeadlineImageCaption","RowHeadlineImageIcon","Slider","Stepper","useAuthState"],"mappings":"AAAA,SAASA,UAAT,QAA2B,mBAA3B;AACA,SAASC,SAAT,EAAoBC,aAApB,QAAyC,WAAzC;AACA,SAASC,OAAO,IAAIC,QAApB,QAAoC,YAApC;AACA,SAASD,OAAO,IAAIE,YAApB,QAAwC,uBAAxC;AAEA,SAASC,IAAT,QAAqB,mBAArB;AACA,SAASC,WAAT,EAAsBC,aAAtB,QAA2C,qBAA3C;AACA,SAASL,OAAO,IAAIM,MAApB,QAAkC,0BAAlC;AACA,SAASN,OAAO,IAAIO,UAApB,QAAsC,yBAAtC;AACA,SAASP,OAAO,IAAIQ,IAApB,QAAgC,mBAAhC;AACA,SA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B,QAAkC,+BAAlC;AACA,SAAShD,OAAO,IAAIiD,SAApB,QAAqC,wBAArC;AACA,SAASjD,OAAO,IAAIkD,aAApB,QAAyC,4BAAzC;AACA,SAASlD,OAAO,IAAImD,mBAApB,QAA+C,kCAA/C;AACA,SAASnD,OAAO,IAAIoD,UAApB,QAAsC,yBAAtC;AACA,SAASpD,OAAO,IAAIqD,UAApB,QAAsC,oCAAtC;AACA,SAASrD,OAAO,IAAIsD,WAApB,QAAuC,0BAAvC;AACA,SAAStD,OAAO,IAAIuD,YAApB,QAAwC,2BAAxC;AACA,SAASvD,OAAO,IAAIwD,cAApB,QAA0C,6BAA1C;AACA,SAASxD,OAAO,IAAIyD,MAApB,QAAkC,4BAAlC;AACA,SAASzD,OAAO,IAAI0D,WAApB,QAAuC,0BAAvC;AACA,SAAS1D,OAAO,IAAI2D,cAApB,QAA0C,6BAA1C;AACA,SAAS3D,OAAO,IAAI4D,WAApB,QAAuC,0BAAvC;AACA,SAAS5D,OAAO,IAAI6D,uBAApB,QAAmD,sCAAnD;AACA,SAAS7D,OAAO,IAAI8D,oBAApB,QAAgD,mCAAhD;AACA,SAAS9D,OAAO,IAAI+D,MAApB,QAAkC,qBAAlC;AACA,SAAS/D,OAAO,IAAIgE,OAApB,QAAmC,sBAAnC;AACA,SAASC,YAAT,QAA6B,2BAA7B","sourcesContent":["export { injectIcon } from \"./interfaces/Icon\";\nexport { withTheme, ThemeProvider } from \"./theming\";\nexport { default as Provider } from \"./Provider\";\nexport { default as DefaultTheme } from \"./styles/DefaultTheme\";\n\nexport { Link } from \"./components/Text\";\nexport { ButtonSolid, ButtonOutline } from \"./components/Button\";\nexport { default as Avatar } from \"./components/CircleImage\";\nexport { default as AvatarEdit } from \"./components/AvatarEdit\";\nexport { default as Card } from \"./components/Card\";\nexport { default as Carousel } from \"./components/Carousel\";\nexport { Checkbox, CheckboxGroup, CheckboxRow } from \"./components/Checkbox\";\nexport { default as CircleImage } from \"./components/CircleImage\";\nexport { default as Container } from \"./components/Container\";\nexport { default as Divider } from \"./components/Divider\";\nexport { default as FAB } from \"./components/FAB\";\nexport { default as FieldSearchBarFull } from \"./components/FieldSearchBarFull\";\nexport { default as IconButton } from \"./components/IconButton\";\nexport { default as Image } from \"./components/Image\";\nexport { default as NumberInput } from \"./components/NumberInput\";\nexport { default as ScreenContainer } from \"./components/ScreenContainer\";\nexport { default as StarRating } from \"./components/StarRating\";\nexport { default as Surface } from \"./components/Surface\";\nexport { default as Switch, SwitchRow } from \"./components/Switch\";\nexport { default as TextField } from \"./components/TextField\";\nexport { default as ToggleButton } from \"./components/ToggleButton\";\nexport { default as Touchable } from \"./components/Touchable\";\nexport { AccordionGroup, AccordionItem } from \"./components/Accordion\";\nexport {\n ActionSheet,\n ActionSheetItem,\n ActionSheetCancel,\n} from \"./components/ActionSheet\";\nexport { Swiper, SwiperItem } from \"./components/Swiper\";\nexport { TabView, TabViewItem } from \"./components/TabView\";\n\nexport {\n Center,\n Circle,\n Square,\n Row,\n Stack,\n Spacer,\n} from \"./components/Layout\";\n\nexport {\n RadioButton,\n RadioButtonGroup,\n RadioButtonRow,\n RadioButtonFieldGroup,\n} from \"./components/RadioButton/index\";\n\n/* Deprecated: Fix or Delete! */\nexport { default as Button } from \"./components/DeprecatedButton\";\nexport { default as CardBlock } from \"./components/CardBlock\";\nexport { default as CardContainer } from \"./components/CardContainer\";\nexport { default as CardContainerRating } from \"./components/CardContainerRating\";\nexport { default as CardInline } from \"./components/CardInline\";\nexport { default as DatePicker } from \"./components/DatePicker/DatePicker\";\nexport { default as HeaderLarge } from \"./components/HeaderLarge\";\nexport { default as HeaderMedium } from \"./components/HeaderMedium\";\nexport { default as HeaderOverline } from \"./components/HeaderOverline\";\nexport { default as Picker } from \"./components/Picker/Picker\";\nexport { default as ProgressBar } from \"./components/ProgressBar\";\nexport { default as ProgressCircle } from \"./components/ProgressCircle\";\nexport { default as RowBodyIcon } from \"./components/RowBodyIcon\";\nexport { default as RowHeadlineImageCaption } from \"./components/RowHeadlineImageCaption\";\nexport { default as RowHeadlineImageIcon } from \"./components/RowHeadlineImageIcon\";\nexport { default as Slider } from \"./components/Slider\";\nexport { default as Stepper } from \"./components/Stepper\";\nexport { useAuthState } from \"./components/useAuthState\";\n"]}
1
+ {"version":3,"sources":["index.tsx"],"names":["injectIcon","withTheme","ThemeProvider","default","Provider","DefaultTheme","Link","ButtonSolid","ButtonOutline","Avatar","AvatarEdit","Card","Carousel","Checkbox","CheckboxGroup","CheckboxRow","CircleImage","Container","Divider","FAB","FieldSearchBarFull","IconButton","Image","NumberInput","ScreenContainer","StarRating","Surface","Switch","SwitchRow","TextField","ToggleButton","Touchable","AccordionGroup","AccordionItem","ActionSheet","ActionSheetItem","ActionSheetCancel","Swiper","SwiperItem","Center","Circle","Square","Row","Stack","Spacer","RadioButton","RadioButtonGroup","RadioButtonRow","RadioButtonFieldGroup","Button","CardBlock","CardContainer","CardContainerRating","CardInline","DatePicker","HeaderLarge","HeaderMedium","HeaderOverline","Picker","ProgressBar","ProgressCircle","RowBodyIcon","RowHeadlineImageCaption","RowHeadlineImageIcon","Slider","Stepper","useAuthState"],"mappings":"AAAA,SAASA,UAAT,QAA2B,mBAA3B;AACA,SAASC,SAAT,EAAoBC,aAApB,QAAyC,WAAzC;AACA,SAASC,OAAO,IAAIC,QAApB,QAAoC,YAApC;AACA,SAASD,OAAO,IAAIE,YAApB,QAAwC,uBAAxC;AAEA,SAASC,IAAT,QAAqB,mBAArB;AACA,SAASC,WAAT,EAAsBC,aAAtB,QAA2C,qBAA3C;AACA,SAASL,OAAO,IAAIM,MAApB,QAAkC,0BAAlC;AACA,SAASN,OAAO,IAAIO,UAApB,QAAsC,yBAAtC;AACA,SAASP,OAAO,IAAIQ,IAApB,QAAgC,mBAAhC;AACA,SAASR,OAAO,IAAIS,QAApB,QAAoC,uBAApC;AACA,SAASC,QAAT,EAAmBC,aAAnB,EAAkCC,WAAlC,QAAqD,uBAArD;AACA,SAASZ,OAAO,IAAIa,WAApB,QAA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,IAAIkD,UAApB,QAAsC,yBAAtC;AACA,SAASlD,OAAO,IAAImD,UAApB,QAAsC,oCAAtC;AACA,SAASnD,OAAO,IAAIoD,WAApB,QAAuC,0BAAvC;AACA,SAASpD,OAAO,IAAIqD,YAApB,QAAwC,2BAAxC;AACA,SAASrD,OAAO,IAAIsD,cAApB,QAA0C,6BAA1C;AACA,SAAStD,OAAO,IAAIuD,MAApB,QAAkC,4BAAlC;AACA,SAASvD,OAAO,IAAIwD,WAApB,QAAuC,0BAAvC;AACA,SAASxD,OAAO,IAAIyD,cAApB,QAA0C,6BAA1C;AACA,SAASzD,OAAO,IAAI0D,WAApB,QAAuC,0BAAvC;AACA,SAAS1D,OAAO,IAAI2D,uBAApB,QAAmD,sCAAnD;AACA,SAAS3D,OAAO,IAAI4D,oBAApB,QAAgD,mCAAhD;AACA,SAAS5D,OAAO,IAAI6D,MAApB,QAAkC,qBAAlC;AACA,SAAS7D,OAAO,IAAI8D,OAApB,QAAmC,sBAAnC;AACA,SAASC,YAAT,QAA6B,2BAA7B","sourcesContent":["export { injectIcon } from \"./interfaces/Icon\";\nexport { withTheme, ThemeProvider } from \"./theming\";\nexport { default as Provider } from \"./Provider\";\nexport { default as DefaultTheme } from \"./styles/DefaultTheme\";\n\nexport { Link } from \"./components/Text\";\nexport { ButtonSolid, ButtonOutline } from \"./components/Button\";\nexport { default as Avatar } from \"./components/CircleImage\";\nexport { default as AvatarEdit } from \"./components/AvatarEdit\";\nexport { default as Card } from \"./components/Card\";\nexport { default as Carousel } from \"./components/Carousel\";\nexport { Checkbox, CheckboxGroup, CheckboxRow } from \"./components/Checkbox\";\nexport { default as CircleImage } from \"./components/CircleImage\";\nexport { default as Container } from \"./components/Container\";\nexport { default as Divider } from \"./components/Divider\";\nexport { default as FAB } from \"./components/FAB\";\nexport { default as FieldSearchBarFull } from \"./components/FieldSearchBarFull\";\nexport { default as IconButton } from \"./components/IconButton\";\nexport { default as Image } from \"./components/Image\";\nexport { default as NumberInput } from \"./components/NumberInput\";\nexport { default as ScreenContainer } from \"./components/ScreenContainer\";\nexport { default as StarRating } from \"./components/StarRating\";\nexport { default as Surface } from \"./components/Surface\";\nexport { default as Switch, SwitchRow } from \"./components/Switch\";\nexport { default as TextField } from \"./components/TextField\";\nexport { default as ToggleButton } from \"./components/ToggleButton\";\nexport { default as Touchable } from \"./components/Touchable\";\nexport { AccordionGroup, AccordionItem } from \"./components/Accordion\";\nexport {\n ActionSheet,\n ActionSheetItem,\n ActionSheetCancel,\n} from \"./components/ActionSheet\";\nexport { Swiper, SwiperItem } from \"./components/Swiper\";\n\nexport {\n Center,\n Circle,\n Square,\n Row,\n Stack,\n Spacer,\n} from \"./components/Layout\";\n\nexport {\n RadioButton,\n RadioButtonGroup,\n RadioButtonRow,\n RadioButtonFieldGroup,\n} from \"./components/RadioButton/index\";\n\n/* Deprecated: Fix or Delete! */\nexport { default as Button } from \"./components/DeprecatedButton\";\nexport { default as CardBlock } from \"./components/CardBlock\";\nexport { default as CardContainer } from \"./components/CardContainer\";\nexport { default as CardContainerRating } from \"./components/CardContainerRating\";\nexport { default as CardInline } from \"./components/CardInline\";\nexport { default as DatePicker } from \"./components/DatePicker/DatePicker\";\nexport { default as HeaderLarge } from \"./components/HeaderLarge\";\nexport { default as HeaderMedium } from \"./components/HeaderMedium\";\nexport { default as HeaderOverline } from \"./components/HeaderOverline\";\nexport { default as Picker } from \"./components/Picker/Picker\";\nexport { default as ProgressBar } from \"./components/ProgressBar\";\nexport { default as ProgressCircle } from \"./components/ProgressCircle\";\nexport { default as RowBodyIcon } from \"./components/RowBodyIcon\";\nexport { default as RowHeadlineImageCaption } from \"./components/RowHeadlineImageCaption\";\nexport { default as RowHeadlineImageIcon } from \"./components/RowHeadlineImageIcon\";\nexport { default as Slider } from \"./components/Slider\";\nexport { default as Stepper } from \"./components/Stepper\";\nexport { useAuthState } from \"./components/useAuthState\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["MapMarker.js"],"names":["COMPONENT_TYPES","createBoolProp","createColorProp","createNumberProp","createTextProp","GROUPS","SEED_DATA","name","tag","description","category","deprecated","layout","props","latitude","label","required","precision","min","max","longitude","title","defaultValue","flat","group","basic","pinColor"],"mappings":"AAAA,SAASA,eAAT,EAA0BC,cAA1B,EAA0CC,eAA1C,EAA2DC,gBAA3D,EAA6EC,cAA7E,EAA6FC,MAA7F,QAA4G,iBAA5G;AACA,OAAO,MAAMC,SAAS,GAAG;AACrBC,EAAAA,IAAI,EAAE,YADe;AAErBC,EAAAA,GAAG,EAAE,WAFgB;AAGrBC,EAAAA,WAAW,EAAE,kCAHQ;AAIrBC,EAAAA,QAAQ,EAAEV,eAAe,CAACW,UAJL;AAKrBC,EAAAA,MAAM,EAAE,EALa;AAMrBC,EAAAA,KAAK,EAAE;AACHC,IAAAA,QAAQ,EAAEX,gBAAgB,CAAC;AACvBY,MAAAA,KAAK,EAAE,UADgB;AAEvBN,MAAAA,WAAW,EAAE,6CAFU;AAGvBO,MAAAA,QAAQ,EAAE,IAHa;AAIvBC,MAAAA,SAAS,EAAE,CAJY;AAKvBC,MAAAA,GAAG,EAAE,CAAC,EALiB;AAMvBC,MAAAA,GAAG,EAAE;AANkB,KAAD,CADvB;AASHC,IAAAA,SAAS,EAAEjB,gBAAgB,CAAC;AACxBY,MAAAA,KAAK,EAAE,WADiB;AAExBN,MAAAA,WAAW,EAAE,8CAFW;AAGxBO,MAAAA,QAAQ,EAAE,IAHc;AAIxBC,MAAAA,SAAS,EAAE,CAJa;AAKxBC,MAAAA,GAAG,EAAE,CAAC,GALkB;AAMxBC,MAAAA,GAAG,EAAE;AANmB,KAAD,CATxB;AAiBHE,IAAAA,KAAK,EAAEjB,cAAc,CAAC;AAClBW,MAAAA,KAAK,EAAE,OADW;AAElBN,MAAAA,WAAW,EAAE,qCAFK;AAGlBa,MAAAA,YAAY,EAAE;AAHI,KAAD,CAjBlB;AAsBHb,IAAAA,WAAW,EAAEL,cAAc,CAAC;AACxBW,MAAAA,KAAK,EAAE,aADiB;AAExBN,MAAAA,WAAW,EAAE,qCAFW;AAGxBa,MAAAA,YAAY,EAAE;AAHU,KAAD,CAtBxB;AA2BHC,IAAAA,IAAI,EAAEtB,cAAc,CAAC;AACjBc,MAAAA,KAAK,EAAE,MADU;AAEjBN,MAAAA,WAAW,EAAE,+GAFI;AAGjBe,MAAAA,KAAK,EAAEnB,MAAM,CAACoB,KAHG;AAIjBH,MAAAA,YAAY,EAAE;AAJG,KAAD,CA3BjB;AAiCHI,IAAAA,QAAQ,EAAExB,eAAe,CAAC;AACtBa,MAAAA,KAAK,EAAE,WADe;AAEtBN,MAAAA,WAAW,EAAE;AAFS,KAAD;AAjCtB;AANc,CAAlB","sourcesContent":["import { COMPONENT_TYPES, createBoolProp, createColorProp, createNumberProp, createTextProp, GROUPS, } from \"@draftbit/types\";\nexport const SEED_DATA = {\n name: \"Map Marker\",\n tag: \"MapMarker\",\n description: \"A marker to show inside map view\",\n category: COMPONENT_TYPES.deprecated,\n layout: {},\n props: {\n latitude: createNumberProp({\n label: \"Latitude\",\n description: \"The latitude in which the marker is located\",\n required: true,\n precision: 6,\n min: -90,\n max: 90,\n }),\n longitude: createNumberProp({\n label: \"Longitude\",\n description: \"The longitude in which the marker is located\",\n required: true,\n precision: 6,\n min: -180,\n max: 180,\n }),\n title: createTextProp({\n label: \"Title\",\n description: \"Title to show along with the marker\",\n defaultValue: null,\n }),\n description: createTextProp({\n label: \"Description\",\n description: \"Optional description for the marker\",\n defaultValue: null,\n }),\n flat: createBoolProp({\n label: \"Flat\",\n description: \"Sets whether this marker should be flat against the map (if true) or a billboard facing the camera (if false)\",\n group: GROUPS.basic,\n defaultValue: false,\n }),\n pinColor: createColorProp({\n label: \"Pin Color\",\n description: \"Sets the color of the marker\",\n }),\n },\n};\n"]}
1
+ {"version":3,"sources":["MapMarker.ts"],"names":["COMPONENT_TYPES","createBoolProp","createColorProp","createNumberProp","createTextProp","GROUPS","SEED_DATA","name","tag","description","category","deprecated","layout","props","latitude","label","required","prec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C,IAAAA,IAAI,EAAEtB,cAAc,CAAC;AACnBc,MAAAA,KAAK,EAAE,MADY;AAEnBN,MAAAA,WAAW,EACT,+GAHiB;AAInBe,MAAAA,KAAK,EAAEnB,MAAM,CAACoB,KAJK;AAKnBH,MAAAA,YAAY,EAAE;AALK,KAAD,CA3Bf;AAkCLI,IAAAA,QAAQ,EAAExB,eAAe,CAAC;AACxBa,MAAAA,KAAK,EAAE,WADiB;AAExBN,MAAAA,WAAW,EAAE;AAFW,KAAD;AAlCpB;AANgB,CAAlB","sourcesContent":["import {\n COMPONENT_TYPES,\n createBoolProp,\n createColorProp,\n createNumberProp,\n createTextProp,\n GROUPS,\n} from \"@draftbit/types\";\n\nexport const SEED_DATA = {\n name: \"Map Marker\",\n tag: \"MapMarker\",\n description: \"A marker to show inside map view\",\n category: COMPONENT_TYPES.deprecated,\n layout: {},\n props: {\n latitude: createNumberProp({\n label: \"Latitude\",\n description: \"The latitude in which the marker is located\",\n required: true,\n precision: 6,\n min: -90,\n max: 90,\n }),\n longitude: createNumberProp({\n label: \"Longitude\",\n description: \"The longitude in which the marker is located\",\n required: true,\n precision: 6,\n min: -180,\n max: 180,\n }),\n title: createTextProp({\n label: \"Title\",\n description: \"Title to show along with the marker\",\n defaultValue: null,\n }),\n description: createTextProp({\n label: \"Description\",\n description: \"Optional description for the marker\",\n defaultValue: null,\n }),\n flat: createBoolProp({\n label: \"Flat\",\n description:\n \"Sets whether this marker should be flat against the map (if true) or a billboard facing the camera (if false)\",\n group: GROUPS.basic,\n defaultValue: false,\n }),\n pinColor: createColorProp({\n label: \"Pin Color\",\n description: \"Sets the color of the marker\",\n }),\n },\n};\n"]}
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  interface Props {
3
- defaultValue?: string;
3
+ value?: number;
4
+ defaultValue?: number;
4
5
  onChangeText: (value?: number) => void;
5
6
  }
6
7
  declare const NumberInput: React.FC<Props>;
@@ -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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "43.2.4-aa029f.0+aa029f8e",
3
+ "version": "43.2.5-4ece9c.0+4ece9c37",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -41,7 +41,7 @@
41
41
  "dependencies": {
42
42
  "@date-io/date-fns": "^1.3.13",
43
43
  "@draftbit/react-theme-provider": "^2.1.1",
44
- "@draftbit/types": "^43.2.0",
44
+ "@draftbit/types": "^43.2.4",
45
45
  "@material-ui/core": "^4.11.0",
46
46
  "@material-ui/pickers": "^3.2.10",
47
47
  "@react-native-community/slider": "4.1.7",
@@ -53,8 +53,6 @@
53
53
  "lodash.omit": "^4.5.0",
54
54
  "lodash.tonumber": "^4.0.3",
55
55
  "react-native-modal-datetime-picker": "^13.0.0",
56
- "react-native-pager-view": "^5.4.9",
57
- "react-native-tab-view": "^3.1.1",
58
56
  "react-native-typography": "^1.4.1",
59
57
  "react-native-web-swiper": "^2.2.1"
60
58
  },
@@ -81,5 +79,5 @@
81
79
  ]
82
80
  ]
83
81
  },
84
- "gitHead": "aa029f8e3934e3717bc10f06e86131e0d9ef175d"
82
+ "gitHead": "4ece9c37d903c96c2a09b1bf4b52e6f397fe8745"
85
83
  }
@@ -1,23 +1,28 @@
1
1
  import React from "react";
2
- import { TextInput as NativeNumberInput } from "react-native";
3
- const NumberInput = ({ defaultValue, onChangeText, ...props }) => {
4
- const [internalValue, setInternalValue] = React.useState(defaultValue);
2
+ import { TextInput } from "react-native";
3
+ const NumberInput = ({ onChangeText, value, defaultValue, ...props }) => {
4
+ const [isDecimal, setIsDecimal] = React.useState(value && !Number.isInteger(value));
5
5
  React.useEffect(() => {
6
- if (defaultValue != null) {
7
- setInternalValue(defaultValue);
6
+ if (value) {
7
+ setIsDecimal(value.toString().includes("."));
8
8
  }
9
- }, [defaultValue]);
10
- const handleChangeText = (value) => {
11
- setInternalValue(value);
9
+ }, [value]);
10
+ const handleChangeText = (newValue) => {
12
11
  if (onChangeText) {
13
- onChangeText(stringToInteger(value));
12
+ const parsedNumber = parseFloat(newValue);
13
+ const number = isNaN(parsedNumber) ? 0 : parsedNumber;
14
+ setIsDecimal(newValue.includes("."));
15
+ onChangeText(number);
14
16
  }
15
17
  };
16
- return (React.createElement(NativeNumberInput, { keyboardType: "numeric", onChangeText: handleChangeText, ...props, value: internalValue }));
17
- };
18
- const stringToInteger = (str) => {
19
- const number = parseFloat(str);
20
- return isNaN(number) ? 0 : number;
18
+ let strValue;
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 }));
21
26
  };
22
27
  export default NumberInput;
23
28
  // comment to try to fix sourcemap issue
@@ -1,46 +1,55 @@
1
1
  import React from "react";
2
- import { TextInput as NativeNumberInput } from "react-native";
2
+ import { TextInput } from "react-native";
3
3
 
4
4
  interface Props {
5
- defaultValue?: string;
5
+ value?: number;
6
+ defaultValue?: number;
6
7
  onChangeText: (value?: number) => void;
7
8
  }
8
9
 
9
10
  const NumberInput: React.FC<Props> = ({
10
- defaultValue,
11
11
  onChangeText,
12
+ value,
13
+ defaultValue,
12
14
  ...props
13
15
  }) => {
14
- const [internalValue, setInternalValue] = React.useState(defaultValue);
15
-
16
+ const [isDecimal, setIsDecimal] = React.useState(
17
+ value && !Number.isInteger(value)
18
+ );
16
19
  React.useEffect(() => {
17
- if (defaultValue != null) {
18
- setInternalValue(defaultValue);
20
+ if (value) {
21
+ setIsDecimal(value.toString().includes("."));
19
22
  }
20
- }, [defaultValue]);
23
+ }, [value]);
21
24
 
22
- const handleChangeText = (value: string) => {
23
- setInternalValue(value);
25
+ const handleChangeText = (newValue: string) => {
24
26
  if (onChangeText) {
25
- onChangeText(stringToInteger(value));
27
+ const parsedNumber = parseFloat(newValue);
28
+ const number = isNaN(parsedNumber) ? 0 : parsedNumber;
29
+ setIsDecimal(newValue.includes("."));
30
+ onChangeText(number);
26
31
  }
27
32
  };
28
33
 
34
+ let strValue;
35
+ if (value != undefined) {
36
+ strValue = value.toString();
37
+ if (isDecimal && !strValue.includes(".")) {
38
+ strValue = `${strValue}.`;
39
+ }
40
+ }
41
+
29
42
  return (
30
- <NativeNumberInput
43
+ <TextInput
31
44
  keyboardType="numeric"
32
- onChangeText={handleChangeText}
33
45
  {...props}
34
- value={internalValue}
46
+ value={strValue}
47
+ defaultValue={defaultValue?.toString()}
48
+ onChangeText={handleChangeText}
35
49
  />
36
50
  );
37
51
  };
38
52
 
39
- const stringToInteger = (str: string | undefined): number => {
40
- const number = parseFloat(str as string);
41
- return isNaN(number) ? 0 : number;
42
- };
43
-
44
53
  export default NumberInput;
45
54
 
46
55
  // comment to try to fix sourcemap issue
@@ -15,15 +15,17 @@ const ToggleButton = ({ Icon, icon, toggled = false, onPress = () => { }, defaul
15
15
  }
16
16
  }, [defaultValue]);
17
17
  const handlePress = () => {
18
- setInternalValue(!toggled);
19
- onPress(!toggled);
18
+ setInternalValue(!internalValue);
19
+ onPress(!internalValue);
20
20
  };
21
21
  return (React.createElement(IconButton, { Icon: Icon, icon: icon, size: iconSize, color: internalValue ? colors[color] : colors[colorSecondary], onPress: handlePress, disabled: disabled, style: [
22
22
  styles.mainContainer,
23
23
  {
24
24
  width,
25
25
  height,
26
- backgroundColor: toggled ? colors[colorSecondary] : colors[color],
26
+ backgroundColor: internalValue
27
+ ? colors[colorSecondary]
28
+ : colors[color],
27
29
  borderColor: colors[borderColor],
28
30
  },
29
31
  style,
@@ -56,8 +56,8 @@ const ToggleButton: React.FC<Props> = ({
56
56
  }, [defaultValue]);
57
57
 
58
58
  const handlePress = () => {
59
- setInternalValue(!toggled);
60
- onPress(!toggled);
59
+ setInternalValue(!internalValue);
60
+ onPress(!internalValue);
61
61
  };
62
62
 
63
63
  return (
@@ -73,7 +73,9 @@ const ToggleButton: React.FC<Props> = ({
73
73
  {
74
74
  width,
75
75
  height,
76
- backgroundColor: toggled ? colors[colorSecondary] : colors[color],
76
+ backgroundColor: internalValue
77
+ ? colors[colorSecondary]
78
+ : colors[color],
77
79
  borderColor: colors[borderColor],
78
80
  },
79
81
  style,
package/src/index.js CHANGED
@@ -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
  /* Deprecated: Fix or Delete! */
package/src/index.tsx CHANGED
@@ -32,7 +32,6 @@ export {
32
32
  ActionSheetCancel,
33
33
  } from "./components/ActionSheet";
34
34
  export { Swiper, SwiperItem } from "./components/Swiper";
35
- export { TabView, TabViewItem } from "./components/TabView";
36
35
 
37
36
  export {
38
37
  Center,
@@ -1,103 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var React = _interopRequireWildcard(require("react"));
9
-
10
- var _reactNativeTabView = require("react-native-tab-view");
11
-
12
- var _TabViewItem = _interopRequireDefault(require("./TabViewItem"));
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
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); }
17
-
18
- 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; }
19
-
20
- 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); }
21
-
22
- const TabViewComponent = _ref => {
23
- let {
24
- Icon,
25
- tabBarPosition,
26
- keyboardDismissMode,
27
- swipeEnabled,
28
- scrollEnabled,
29
- activeColor,
30
- inactiveColor,
31
- pressColor,
32
- indicatorColor,
33
- style,
34
- children
35
- } = _ref;
36
- const [index, setIndex] = React.useState(0);
37
- const [routes, setRoutes] = React.useState([]);
38
- const [tabScenes, setTabScenes] = React.useState({});
39
- React.useEffect(() => {
40
- const newRoutes = [];
41
- const scenes = {};
42
- React.Children.toArray(children).filter(child => child.type === _TabViewItem.default).forEach(child => {
43
- var _child$props;
44
-
45
- if (child !== null && child !== void 0 && (_child$props = child.props) !== null && _child$props !== void 0 && _child$props.id) {
46
- var _child$props2, _child$props3;
47
-
48
- newRoutes.push({
49
- key: child === null || child === void 0 ? void 0 : (_child$props2 = child.props) === null || _child$props2 === void 0 ? void 0 : _child$props2.id,
50
- ...(child === null || child === void 0 ? void 0 : child.props)
51
- });
52
-
53
- scenes[child === null || child === void 0 ? void 0 : (_child$props3 = child.props) === null || _child$props3 === void 0 ? void 0 : _child$props3.id] = () => child;
54
- }
55
- });
56
- setRoutes(newRoutes);
57
- setTabScenes(scenes);
58
- }, [children]);
59
-
60
- const indexChangeHandler = i => setIndex(i);
61
-
62
- const renderTabBar = props => {
63
- console.log(props);
64
- return /*#__PURE__*/React.createElement(_reactNativeTabView.TabBar, _extends({}, props, {
65
- activeColor: activeColor,
66
- inactiveColor: inactiveColor,
67
- pressColor: pressColor,
68
- scrollEnabled: scrollEnabled,
69
- indicatorStyle: {
70
- backgroundColor: indicatorColor
71
- },
72
- renderIcon: _ref2 => {
73
- let {
74
- route,
75
- color
76
- } = _ref2;
77
- return route !== null && route !== void 0 && route.icon ? /*#__PURE__*/React.createElement(Icon, {
78
- name: route.icon,
79
- color: color,
80
- size: 36
81
- }) : null;
82
- },
83
- style: style
84
- }));
85
- };
86
-
87
- return /*#__PURE__*/React.createElement(_reactNativeTabView.TabView, {
88
- navigationState: {
89
- index,
90
- routes
91
- },
92
- renderScene: (0, _reactNativeTabView.SceneMap)(tabScenes),
93
- renderTabBar: renderTabBar,
94
- onIndexChange: indexChangeHandler,
95
- tabBarPosition: tabBarPosition,
96
- keyboardDismissMode: keyboardDismissMode,
97
- swipeEnabled: swipeEnabled
98
- });
99
- };
100
-
101
- var _default = TabViewComponent;
102
- exports.default = _default;
103
- //# sourceMappingURL=TabView.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["TabView.tsx"],"names":["TabViewComponent","Icon","tabBarPosition","keyboardDismissMode","swipeEnabled","scrollEnabled","activeColor","inactiveColor","pressColor","indicatorColor","style","children","index","setIndex","React","useState","routes","setRoutes","tabScenes","setTabScenes","useEffect","newRoutes","scenes","Children","toArray","filter","child","type","TabViewItem","forEach","props","id","push","key","indexChangeHandler","i","renderTabBar","console","log","backgroundColor","route","color","icon"],"mappings":";;;;;;;AAAA;;AAEA;;AAGA;;;;;;;;;;AAmBA,MAAMA,gBAAgB,GAAG,QAYL;AAAA,MAZM;AACxBC,IAAAA,IADwB;AAExBC,IAAAA,cAFwB;AAGxBC,IAAAA,mBAHwB;AAIxBC,IAAAA,YAJwB;AAKxBC,IAAAA,aALwB;AAMxBC,IAAAA,WANwB;AAOxBC,IAAAA,aAPwB;AAQxBC,IAAAA,UARwB;AASxBC,IAAAA,cATwB;AAUxBC,IAAAA,KAVwB;AAWxBC,IAAAA;AAXwB,GAYN;AAClB,QAAM,CAACC,KAAD,EAAQC,QAAR,IAAoBC,KAAK,CAACC,QAAN,CAAe,CAAf,CAA1B;AACA,QAAM,CAACC,MAAD,EAASC,SAAT,IAAsBH,KAAK,CAACC,QAAN,CAAe,EAAf,CAA5B;AACA,QAAM,CAACG,SAAD,EAAYC,YAAZ,IAA4BL,KAAK,CAACC,QAAN,CAAe,EAAf,CAAlC;AAEAD,EAAAA,KAAK,CAACM,SAAN,CAAgB,MAAM;AACpB,UAAMC,SAAc,GAAG,EAAvB;AACA,UAAMC,MAAW,GAAG,EAApB;AAEAR,IAAAA,KAAK,CAACS,QAAN,CAAeC,OAAf,CAAuBb,QAAvB,EACGc,MADH,CACWC,KAAD,IAAgBA,KAAK,CAACC,IAAN,KAAeC,oBADzC,EAEGC,OAFH,CAEYH,KAAD,IAAgB;AAAA;;AACvB,UAAIA,KAAJ,aAAIA,KAAJ,+BAAIA,KAAK,CAAEI,KAAX,yCAAI,aAAcC,EAAlB,EAAsB;AAAA;;AACpBV,QAAAA,SAAS,CAACW,IAAV,CAAe;AACbC,UAAAA,GAAG,EAAEP,KAAF,aAAEA,KAAF,wCA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W,EAAE,kCAASE,SAAT,CAFf;AAGE,IAAA,YAAY,EAAEkB,YAHhB;AAIE,IAAA,aAAa,EAAEF,kBAJjB;AAKE,IAAA,cAAc,EAAEhC,cALlB;AAME,IAAA,mBAAmB,EAAEC,mBANvB;AAOE,IAAA,YAAY,EAAEC;AAPhB,IADF;AAWD,CAtED;;eAwEeJ,gB","sourcesContent":["import * as React from \"react\";\nimport { StyleProp, TextStyle, ViewStyle } from \"react-native\";\nimport { TabView, TabBar, SceneMap } from \"react-native-tab-view\";\n\n// import { withTheme } from \"../../theming\";\nimport TabViewItem from \"./TabViewItem\";\nimport type { IconSlot } from \"../../interfaces/Icon\";\n\ntype TabBarPosition = \"top\" | \"bottom\";\ntype KeyboardDismissMode = \"none\" | \"auto\" | \"on-drag\";\n\ntype TabViewProps = {\n tabBarPosition?: TabBarPosition;\n keyboardDismissMode?: KeyboardDismissMode;\n swipeEnabled?: boolean;\n scrollEnabled?: boolean;\n activeColor?: string;\n inactiveColor?: string;\n pressColor?: string;\n indicatorColor?: string;\n style?: StyleProp<TextStyle | ViewStyle>;\n children: React.ReactNode;\n} & IconSlot;\n\nconst TabViewComponent = ({\n Icon,\n tabBarPosition,\n keyboardDismissMode,\n swipeEnabled,\n scrollEnabled,\n activeColor,\n inactiveColor,\n pressColor,\n indicatorColor,\n style,\n children,\n}: TabViewProps) => {\n const [index, setIndex] = React.useState(0);\n const [routes, setRoutes] = React.useState([]);\n const [tabScenes, setTabScenes] = React.useState({});\n\n React.useEffect(() => {\n const newRoutes: any = [];\n const scenes: any = {};\n\n React.Children.toArray(children)\n .filter((child: any) => child.type === TabViewItem)\n .forEach((child: any) => {\n if (child?.props?.id) {\n newRoutes.push({\n key: child?.props?.id,\n ...child?.props,\n });\n scenes[child?.props?.id] = () => child;\n }\n });\n\n setRoutes(newRoutes);\n setTabScenes(scenes);\n }, [children]);\n\n const indexChangeHandler = (i: any) => setIndex(i);\n\n const renderTabBar = (props: any) => {\n console.log(props);\n return (\n <TabBar\n {...props}\n activeColor={activeColor}\n inactiveColor={inactiveColor}\n pressColor={pressColor}\n scrollEnabled={scrollEnabled}\n indicatorStyle={{ backgroundColor: indicatorColor }}\n renderIcon={({ route, color }) =>\n route?.icon ? (\n <Icon name={route.icon} color={color} size={36} />\n ) : null\n }\n style={style}\n />\n );\n };\n\n return (\n <TabView\n navigationState={{ index, routes }}\n renderScene={SceneMap(tabScenes)}\n renderTabBar={renderTabBar}\n onIndexChange={indexChangeHandler}\n tabBarPosition={tabBarPosition}\n keyboardDismissMode={keyboardDismissMode}\n swipeEnabled={swipeEnabled}\n />\n );\n};\n\nexport default TabViewComponent;\n"]}
@@ -1,27 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- const TabViewItem = _ref => {
9
- let {
10
- title,
11
- id,
12
- icon,
13
- children,
14
- accessibilityLabel
15
- } = _ref;
16
- console.log({
17
- title,
18
- id,
19
- icon,
20
- accessibilityLabel
21
- });
22
- return children;
23
- };
24
-
25
- var _default = TabViewItem;
26
- exports.default = _default;
27
- //# sourceMappingURL=TabViewItem.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["TabViewItem.tsx"],"names":["TabViewItem","title","id","icon","children","accessibilityLabel","console","log"],"mappings":";;;;;;;AASA,MAAMA,WAAW,GAAG,QAMI;AAAA,MANH;AACnBC,IAAAA,KADmB;AAEnBC,IAAAA,EAFmB;AAGnBC,IAAAA,IAHmB;AAInBC,IAAAA,QAJmB;AAKnBC,IAAAA;AALmB,GAMG;AACtBC,EAAAA,OAAO,CAACC,GAAR,CAAY;AAAEN,IAAAA,KAAF;AAASC,IAAAA,EAAT;AAAaC,IAAAA,IAAb;AAAmBE,IAAAA;AAAnB,GAAZ;AACA,SAAOD,QAAP;AACD,CATD;;eAWeJ,W","sourcesContent":["import React from \"react\";\ninterface TabViewItemProps {\n title: string;\n id: string;\n icon: string;\n accessibilityLabel: string;\n children: React.ReactNode;\n}\n\nconst TabViewItem = ({\n title,\n id,\n icon,\n children,\n accessibilityLabel,\n}: TabViewItemProps) => {\n console.log({ title, id, icon, accessibilityLabel });\n return children;\n};\n\nexport default TabViewItem;\n"]}
@@ -1,24 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "TabView", {
7
- enumerable: true,
8
- get: function () {
9
- return _TabView.default;
10
- }
11
- });
12
- Object.defineProperty(exports, "TabViewItem", {
13
- enumerable: true,
14
- get: function () {
15
- return _TabViewItem.default;
16
- }
17
- });
18
-
19
- var _TabView = _interopRequireDefault(require("./TabView"));
20
-
21
- var _TabViewItem = _interopRequireDefault(require("./TabViewItem"));
22
-
23
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AACA","sourcesContent":["export { default as TabView } from \"./TabView\";\nexport { default as TabViewItem } from \"./TabViewItem\";\n"]}