@draftbit/core 43.4.4-03ab3e.0 → 43.4.5-ccf125.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/Accordion/AccordionItem.js +21 -5
- package/lib/commonjs/components/Accordion/AccordionItem.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButton.js +9 -6
- package/lib/commonjs/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButtonGroup.js +18 -8
- package/lib/commonjs/components/RadioButton/RadioButtonGroup.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButtonRow.js +14 -9
- package/lib/commonjs/components/RadioButton/RadioButtonRow.js.map +1 -1
- package/lib/commonjs/components/StarRating.js +5 -4
- package/lib/commonjs/components/StarRating.js.map +1 -1
- package/lib/commonjs/components/Touchable.js +3 -16
- package/lib/commonjs/components/Touchable.js.map +1 -1
- package/lib/commonjs/hooks.js.map +1 -1
- package/lib/commonjs/mappings/Accordion.js.map +1 -1
- package/lib/commonjs/mappings/LinearGradient.js +2 -2
- package/lib/commonjs/mappings/LinearGradient.js.map +1 -1
- package/lib/commonjs/utilities.js +16 -0
- package/lib/commonjs/utilities.js.map +1 -1
- package/lib/module/components/DatePicker/DatePickerComponentType.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButton.js +8 -6
- package/lib/module/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButtonGroup.js +17 -8
- package/lib/module/components/RadioButton/RadioButtonGroup.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButtonRow.js +15 -10
- package/lib/module/components/RadioButton/RadioButtonRow.js.map +1 -1
- package/lib/module/components/Swiper/Swiper.js.map +1 -1
- package/lib/module/mappings/FAB.js.map +1 -1
- package/lib/module/mappings/ImageBackground.js.map +1 -1
- package/lib/module/mappings/KeyboardAvoidingView.js.map +1 -1
- package/lib/module/mappings/LinearGradient.js +2 -2
- package/lib/module/mappings/LinearGradient.js.map +1 -1
- package/lib/module/utilities.js +14 -0
- package/lib/module/utilities.js.map +1 -1
- package/lib/typescript/src/components/RadioButton/RadioButton.d.ts +1 -1
- package/lib/typescript/src/components/RadioButton/RadioButtonGroup.d.ts +1 -1
- package/lib/typescript/src/utilities.d.ts +1 -0
- package/package.json +2 -2
- package/src/components/RadioButton/RadioButton.js +9 -5
- package/src/components/RadioButton/RadioButton.tsx +12 -9
- package/src/components/RadioButton/RadioButtonGroup.js +14 -8
- package/src/components/RadioButton/RadioButtonGroup.tsx +21 -12
- package/src/components/RadioButton/RadioButtonRow.js +15 -9
- package/src/components/RadioButton/RadioButtonRow.tsx +19 -13
- package/src/mappings/LinearGradient.js +2 -2
- package/src/mappings/LinearGradient.ts +2 -2
- package/src/utilities.js +12 -0
- package/src/utilities.ts +13 -0
|
@@ -21,8 +21,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
21
21
|
|
|
22
22
|
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; }
|
|
23
23
|
|
|
24
|
-
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); }
|
|
25
|
-
|
|
26
24
|
const AccordionItem = _ref => {
|
|
27
25
|
let {
|
|
28
26
|
Icon,
|
|
@@ -37,9 +35,10 @@ const AccordionItem = _ref => {
|
|
|
37
35
|
textStyles,
|
|
38
36
|
viewStyles
|
|
39
37
|
} = (0, _utilities.extractStyles)(style);
|
|
40
|
-
return /*#__PURE__*/React.createElement(_reactNative.Pressable,
|
|
41
|
-
style: [styles.container, viewStyles]
|
|
42
|
-
|
|
38
|
+
return /*#__PURE__*/React.createElement(_reactNative.Pressable, {
|
|
39
|
+
style: [styles.container, viewStyles],
|
|
40
|
+
...rest
|
|
41
|
+
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
43
42
|
style: styles.row
|
|
44
43
|
}, icon ? /*#__PURE__*/React.createElement(Icon, {
|
|
45
44
|
name: icon,
|
|
@@ -74,5 +73,22 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
74
73
|
|
|
75
74
|
var _default = (0, _theming.withTheme)(AccordionItem);
|
|
76
75
|
|
|
76
|
+
exports.default = _default;
|
|
77
|
+
//# sourceMappingURL=AccordionItem.js.map flexDirection: "row",
|
|
78
|
+
alignItems: "center",
|
|
79
|
+
paddingLeft: 8
|
|
80
|
+
},
|
|
81
|
+
item: {
|
|
82
|
+
marginVertical: 6,
|
|
83
|
+
paddingLeft: 8
|
|
84
|
+
},
|
|
85
|
+
content: {
|
|
86
|
+
flex: 1,
|
|
87
|
+
justifyContent: "center"
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
var _default = (0, _theming.withTheme)(AccordionItem);
|
|
92
|
+
|
|
77
93
|
exports.default = _default;
|
|
78
94
|
//# sourceMappingURL=AccordionItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["AccordionItem.
|
|
1
|
+
{"version":3,"sources":["AccordionItem.js"],"names":["AccordionItem","Icon","icon","label","style","iconColor","theme","rest","textStyles","viewStyles","React","createElement","Pressable","styles","container","View","row","name","size","color","colors","primary","item","content","Text","selectable","StyleSheet","create","padding","flexDirection","alignItems","paddingLeft","marginVertical","flex","justifyContent"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AACA,MAAMA,aAAa,GAAG,QAA6D;AAAA,MAA5D;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,IAAR;AAAcC,IAAAA,KAAd;AAAqBC,IAAAA,KAArB;AAA4BC,IAAAA,SAA5B;AAAuCC,IAAAA,KAAvC;AAA8C,OAAGC;AAAjD,GAA4D;AAC/E,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAA6B,8BAAcL,KAAd,CAAnC;AACA,sBAAQM,KAAK,CAACC,aAAN,CAAoBC,sBAApB,EAA+B;AAAER,IAAAA,KAAK,EAAE,CAACS,MAAM,CAACC,SAAR,EAAmBL,UAAnB,CAAT;AAAyC,OAAGF;AAA5C,GAA/B,eACJG,KAAK,CAACC,aAAN,CAAoBI,iBAApB,EAA0B;AAAEX,IAAAA,KAAK,EAAES,MAAM,CAACG;AAAhB,GAA1B,EACId,IAAI,gBAAIQ,KAAK,CAACC,aAAN,CAAoBV,IAApB,EAA0B;AAAEgB,IAAAA,IAAI,EAAEf,IAAR;AAAcgB,IAAAA,IAAI,EAAE,EAApB;AAAwBC,IAAAA,KAAK,EAAEd,SAAS,IAAIC,KAAK,CAACc,MAAN,CAAaC;AAAzD,GAA1B,CAAJ,GAAqG,IAD7G,eAEIX,KAAK,CAACC,aAAN,CAAoBI,iBAApB,EAA0B;AAAEX,IAAAA,KAAK,EAAE,CAACS,MAAM,CAACS,IAAR,EAAcT,MAAM,CAACU,OAArB;AAAT,GAA1B,eACIb,KAAK,CAACC,aAAN,CAAoBa,aAApB,EAA0B;AAAEC,IAAAA,UAAU,EAAE,KAAd;AAAqBrB,IAAAA,KAAK,EAAEI;AAA5B,GAA1B,EAAoEL,KAApE,CADJ,CAFJ,CADI,CAAR;AAKH,CAPD;;AAQA,MAAMU,MAAM,GAAGa,wBAAWC,MAAX,CAAkB;AAC7Bb,EAAAA,SAAS,EAAE;AACPc,IAAAA,OAAO,EAAE;AADF,GADkB;AAI7BZ,EAAAA,GAAG,EAAE;AACDa,IAAAA,aAAa,EAAE,KADd;AAEDC,IAAAA,UAAU,EAAE,QAFX;AAGDC,IAAAA,WAAW,EAAE;AAHZ,GAJwB;AAS7BT,EAAAA,IAAI,EAAE;AACFU,IAAAA,cAAc,EAAE,CADd;AAEFD,IAAAA,WAAW,EAAE;AAFX,GATuB;AAa7BR,EAAAA,OAAO,EAAE;AACLU,IAAAA,IAAI,EAAE,CADD;AAELC,IAAAA,cAAc,EAAE;AAFX;AAboB,CAAlB,CAAf;;eAkBe,wBAAUlC,aAAV,C","sourcesContent":["import * as React from \"react\";\nimport { Pressable, StyleSheet, View, } from \"react-native\";\nimport Text from \"../Text\";\nimport { extractStyles } from \"../../utilities\";\nimport { withTheme } from \"../../theming\";\nconst AccordionItem = ({ Icon, icon, label, style, iconColor, theme, ...rest }) => {\n const { textStyles, viewStyles } = extractStyles(style);\n return (React.createElement(Pressable, { style: [styles.container, viewStyles], ...rest },\n React.createElement(View, { style: styles.row },\n icon ? (React.createElement(Icon, { name: icon, size: 24, color: iconColor || theme.colors.primary })) : null,\n React.createElement(View, { style: [styles.item, styles.content] },\n React.createElement(Text, { selectable: false, style: textStyles }, label)))));\n};\nconst styles = StyleSheet.create({\n container: {\n padding: 8,\n },\n row: {\n flexDirection: \"row\",\n alignItems: \"center\",\n paddingLeft: 8,\n },\n item: {\n marginVertical: 6,\n paddingLeft: 8,\n },\n content: {\n flex: 1,\n justifyContent: \"center\",\n },\n});\nexport default withTheme(AccordionItem);\n"]}
|
|
@@ -11,6 +11,8 @@ var _Config = _interopRequireDefault(require("../Config"));
|
|
|
11
11
|
|
|
12
12
|
var _IconButton = _interopRequireDefault(require("../IconButton"));
|
|
13
13
|
|
|
14
|
+
var _utilities = require("../../utilities");
|
|
15
|
+
|
|
14
16
|
var _context = require("./context");
|
|
15
17
|
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -29,7 +31,7 @@ const RadioButton = _ref => {
|
|
|
29
31
|
value,
|
|
30
32
|
selected,
|
|
31
33
|
unselectedColor,
|
|
32
|
-
onPress
|
|
34
|
+
onPress,
|
|
33
35
|
size = _Config.default.radioButtonSize,
|
|
34
36
|
selectedIcon = "MaterialIcons/radio-button-checked",
|
|
35
37
|
unselectedIcon = "MaterialIcons/radio-button-unchecked",
|
|
@@ -40,16 +42,17 @@ const RadioButton = _ref => {
|
|
|
40
42
|
value: contextValue,
|
|
41
43
|
onValueChange
|
|
42
44
|
} = (0, _context.useRadioButtonGroupContext)();
|
|
45
|
+
const realValue = (0, _utilities.getRealValue)(value);
|
|
46
|
+
const realContextValue = (0, _utilities.getRealValue)(contextValue);
|
|
47
|
+
const isSelected = selected !== null && selected !== void 0 ? selected : realContextValue && realValue && realContextValue === realValue;
|
|
43
48
|
|
|
44
49
|
const handlePress = () => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
onValueChange(value);
|
|
50
|
+
if (realValue) {
|
|
51
|
+
onPress === null || onPress === void 0 ? void 0 : onPress(realValue);
|
|
52
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(realValue);
|
|
49
53
|
}
|
|
50
54
|
};
|
|
51
55
|
|
|
52
|
-
const isSelected = selected || contextValue != null && contextValue === value;
|
|
53
56
|
return /*#__PURE__*/React.createElement(_IconButton.default, _extends({
|
|
54
57
|
Icon: Icon,
|
|
55
58
|
icon: isSelected ? selectedIcon : unselectedIcon,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["RadioButton.tsx"],"names":["RadioButton","Icon","disabled","color","value","selected","unselectedColor","onPress","size","Config","radioButtonSize","selectedIcon","unselectedIcon","style","rest","contextValue","onValueChange","
|
|
1
|
+
{"version":3,"sources":["RadioButton.tsx"],"names":["RadioButton","Icon","disabled","color","value","selected","unselectedColor","onPress","size","Config","radioButtonSize","selectedIcon","unselectedIcon","style","rest","contextValue","onValueChange","realValue","realContextValue","isSelected","handlePress"],"mappings":";;;;;;;AAAA;;AAGA;;AACA;;AACA;;AACA;;;;;;;;;;AAiBA,MAAMA,WAAuC,GAAG,QAa1C;AAAA,MAb2C;AAC/CC,IAAAA,IAD+C;AAE/CC,IAAAA,QAAQ,GAAG,KAFoC;AAG/CC,IAAAA,KAH+C;AAI/CC,IAAAA,KAJ+C;AAK/CC,IAAAA,QAL+C;AAM/CC,IAAAA,eAN+C;AAO/CC,IAAAA,OAP+C;AAQ/CC,IAAAA,IAAI,GAAGC,gBAAOC,eARiC;AAS/CC,IAAAA,YAAY,GAAG,oCATgC;AAU/CC,IAAAA,cAAc,GAAG,sCAV8B;AAW/CC,IAAAA,KAX+C;AAY/C,OAAGC;AAZ4C,GAa3C;AACJ,QAAM;AAAEV,IAAAA,KAAK,EAAEW,YAAT;AAAuBC,IAAAA;AAAvB,MAAyC,0CAA/C;AAEA,QAAMC,SAAS,GAAG,6BAAab,KAAb,CAAlB;AACA,QAAMc,gBAAgB,GAAG,6BAAaH,YAAb,CAAzB;AACA,QAAMI,UAAU,GACdd,QADc,aACdA,QADc,cACdA,QADc,GAEba,gBAAgB,IAAID,SAApB,IAAiCC,gBAAgB,KAAKD,SAFzD;;AAIA,QAAMG,WAAW,GAAG,MAAM;AACxB,QAAIH,SAAJ,EAAe;AACbV,MAAAA,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAGU,SAAH,CAAP;AACAD,MAAAA,aAAa,SAAb,IAAAA,aAAa,WAAb,YAAAA,aAAa,CAAGC,SAAH,CAAb;AACD;AACF,GALD;;AAOA,sBACE,oBAAC,mBAAD;AACE,IAAA,IAAI,EAAEhB,IADR;AAEE,IAAA,IAAI,EAAEkB,UAAU,GAAGR,YAAH,GAAkBC,cAFpC;AAGE,IAAA,KAAK,EAAEO,UAAU,GAAGhB,KAAH,GAAWG,eAH9B;AAIE,IAAA,QAAQ,EAAEJ,QAJZ;AAKE,IAAA,OAAO,EAAEkB,WALX;AAME,IAAA,IAAI,EAAEZ,IANR;AAOE,IAAA,KAAK,EAAEK;AAPT,KAQMC,IARN,EADF;AAYD,CAzCD;;eA2Ced,W","sourcesContent":["import * as React from \"react\";\nimport { StyleProp, ViewStyle } from \"react-native\";\n\nimport Config from \"../Config\";\nimport IconButton from \"../IconButton\";\nimport { getRealValue } from \"../../utilities\";\nimport { useRadioButtonGroupContext } from \"./context\";\n\nimport type { IconSlot } from \"../../interfaces/Icon\";\n\nexport type RadioButtonProps = {\n selected?: boolean;\n disabled?: boolean;\n color?: string;\n value?: string;\n unselectedColor?: string;\n onPress?: (value: string) => void;\n style?: StyleProp<ViewStyle>;\n size?: number;\n selectedIcon?: string;\n unselectedIcon?: string;\n} & IconSlot;\n\nconst RadioButton: React.FC<RadioButtonProps> = ({\n Icon,\n disabled = false,\n color,\n value,\n selected,\n unselectedColor,\n onPress,\n size = Config.radioButtonSize,\n selectedIcon = \"MaterialIcons/radio-button-checked\",\n unselectedIcon = \"MaterialIcons/radio-button-unchecked\",\n style,\n ...rest\n}) => {\n const { value: contextValue, onValueChange } = useRadioButtonGroupContext();\n\n const realValue = getRealValue(value);\n const realContextValue = getRealValue(contextValue);\n const isSelected =\n selected ??\n (realContextValue && realValue && realContextValue === realValue);\n\n const handlePress = () => {\n if (realValue) {\n onPress?.(realValue);\n onValueChange?.(realValue);\n }\n };\n\n return (\n <IconButton\n Icon={Icon}\n icon={isSelected ? selectedIcon : unselectedIcon}\n color={isSelected ? color : unselectedColor}\n disabled={disabled}\n onPress={handlePress}\n size={size}\n style={style}\n {...rest}\n />\n );\n};\n\nexport default RadioButton;\n"]}
|
|
@@ -9,6 +9,8 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _reactNative = require("react-native");
|
|
11
11
|
|
|
12
|
+
var _utilities = require("../../utilities");
|
|
13
|
+
|
|
12
14
|
var _context = require("./context");
|
|
13
15
|
|
|
14
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -25,27 +27,35 @@ const RadioButtonGroup = _ref => {
|
|
|
25
27
|
let {
|
|
26
28
|
direction = _context.Direction.Vertical,
|
|
27
29
|
value,
|
|
28
|
-
onValueChange
|
|
30
|
+
onValueChange,
|
|
29
31
|
defaultValue,
|
|
30
32
|
style,
|
|
31
33
|
children,
|
|
32
34
|
...rest
|
|
33
35
|
} = _ref;
|
|
34
|
-
const [internalValue, setInternalValue] = React.useState(
|
|
36
|
+
const [internalValue, setInternalValue] = React.useState();
|
|
35
37
|
React.useEffect(() => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
const realValue = (0, _utilities.getRealValue)(value);
|
|
39
|
+
|
|
40
|
+
if (realValue) {
|
|
41
|
+
setInternalValue(realValue);
|
|
38
42
|
}
|
|
39
43
|
}, [value]);
|
|
40
44
|
React.useEffect(() => {
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
const realDefaultValue = (0, _utilities.getRealValue)(defaultValue);
|
|
46
|
+
|
|
47
|
+
if (realDefaultValue) {
|
|
48
|
+
setInternalValue(realDefaultValue);
|
|
43
49
|
}
|
|
44
50
|
}, [defaultValue]);
|
|
45
51
|
|
|
46
52
|
const handleValueChange = newValue => {
|
|
47
|
-
|
|
48
|
-
|
|
53
|
+
const realNewValue = (0, _utilities.getRealValue)(newValue);
|
|
54
|
+
|
|
55
|
+
if (realNewValue) {
|
|
56
|
+
setInternalValue(newValue);
|
|
57
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue);
|
|
58
|
+
}
|
|
49
59
|
};
|
|
50
60
|
|
|
51
61
|
const _containerStyle = [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["RadioButtonGroup.tsx"],"names":["Provider","radioButtonGroupContext","RadioButtonGroup","direction","Direction","Vertical","value","onValueChange","defaultValue","style","children","rest","internalValue","setInternalValue","React","useState","useEffect","handleValueChange","newValue","_containerStyle","flexDirection","Horizontal","push","alignItems","minHeight"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;;;;;AAWA,MAAM;AAAEA,EAAAA;AAAF,IAAeC,gCAArB;;AAEA,MAAMC,gBAAiD,GAAG,QAQpD;AAAA,MARqD;AACzDC,IAAAA,SAAS,GAAGC,mBAAUC,QADmC;AAEzDC,IAAAA,KAFyD;AAGzDC,IAAAA,
|
|
1
|
+
{"version":3,"sources":["RadioButtonGroup.tsx"],"names":["Provider","radioButtonGroupContext","RadioButtonGroup","direction","Direction","Vertical","value","onValueChange","defaultValue","style","children","rest","internalValue","setInternalValue","React","useState","useEffect","realValue","realDefaultValue","handleValueChange","newValue","realNewValue","_containerStyle","flexDirection","Horizontal","push","alignItems","minHeight"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;;;AAWA,MAAM;AAAEA,EAAAA;AAAF,IAAeC,gCAArB;;AAEA,MAAMC,gBAAiD,GAAG,QAQpD;AAAA,MARqD;AACzDC,IAAAA,SAAS,GAAGC,mBAAUC,QADmC;AAEzDC,IAAAA,KAFyD;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,EAA1C;AAIAD,EAAAA,KAAK,CAACE,SAAN,CAAgB,MAAM;AACpB,UAAMC,SAAS,GAAG,6BAAaX,KAAb,CAAlB;;AAEA,QAAIW,SAAJ,EAAe;AACbJ,MAAAA,gBAAgB,CAACI,SAAD,CAAhB;AACD;AACF,GAND,EAMG,CAACX,KAAD,CANH;AAQAQ,EAAAA,KAAK,CAACE,SAAN,CAAgB,MAAM;AACpB,UAAME,gBAAgB,GAAG,6BAAaV,YAAb,CAAzB;;AAEA,QAAIU,gBAAJ,EAAsB;AACpBL,MAAAA,gBAAgB,CAACK,gBAAD,CAAhB;AACD;AACF,GAND,EAMG,CAACV,YAAD,CANH;;AAQA,QAAMW,iBAAiB,GAAIC,QAAD,IAAmB;AAC3C,UAAMC,YAAY,GAAG,6BAAaD,QAAb,CAArB;;AAEA,QAAIC,YAAJ,EAAkB;AAChBR,MAAAA,gBAAgB,CAACO,QAAD,CAAhB;AACAb,MAAAA,aAAa,SAAb,IAAAA,aAAa,WAAb,YAAAA,aAAa,CAAGa,QAAH,CAAb;AACD;AACF,GAPD;;AASA,QAAME,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,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,CA/DD;;eAiEeR,gB","sourcesContent":["import * as React from \"react\";\nimport { View, StyleProp, ViewStyle } from \"react-native\";\nimport type { Theme } from \"../../styles/DefaultTheme\";\nimport { getRealValue } 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<\n string | undefined\n >();\n\n React.useEffect(() => {\n const realValue = getRealValue(value);\n\n if (realValue) {\n setInternalValue(realValue);\n }\n }, [value]);\n\n React.useEffect(() => {\n const realDefaultValue = getRealValue(defaultValue);\n\n if (realDefaultValue) {\n setInternalValue(realDefaultValue);\n }\n }, [defaultValue]);\n\n const handleValueChange = (newValue: any) => {\n const realNewValue = getRealValue(newValue);\n\n if (realNewValue) {\n setInternalValue(newValue);\n onValueChange?.(newValue);\n }\n };\n\n const _containerStyle: StyleProp<ViewStyle> = [\n {\n flexDirection: direction === Direction.Horizontal ? \"row\" : \"column\",\n },\n ];\n\n if (direction !== Direction.Vertical) {\n _containerStyle.push({\n alignItems: \"center\",\n });\n }\n\n return (\n <View style={[{ minHeight: 40 }, style]} {...rest}>\n <Provider\n value={{\n value: internalValue || \"\",\n onValueChange: handleValueChange,\n direction,\n }}\n >\n <View style={_containerStyle}>{children}</View>\n </Provider>\n </View>\n );\n};\n\nexport default RadioButtonGroup;\n"]}
|
|
@@ -45,13 +45,13 @@ const getRadioButtonAlignment = (parentDirection, direction) => {
|
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
const renderLabel = (
|
|
49
|
-
if (typeof
|
|
48
|
+
const renderLabel = (label, labelStyle, textStyle) => {
|
|
49
|
+
if (typeof label === "string") {
|
|
50
50
|
return /*#__PURE__*/React.createElement(_Text.default, {
|
|
51
51
|
style: [labelStyle, textStyle]
|
|
52
|
-
},
|
|
52
|
+
}, label);
|
|
53
53
|
} else {
|
|
54
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null,
|
|
54
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, label);
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
57
|
|
|
@@ -62,7 +62,7 @@ const RadioButtonRow = _ref => {
|
|
|
62
62
|
value,
|
|
63
63
|
color,
|
|
64
64
|
unselectedColor,
|
|
65
|
-
onPress
|
|
65
|
+
onPress,
|
|
66
66
|
labelContainerStyle,
|
|
67
67
|
labelStyle,
|
|
68
68
|
radioButtonStyle,
|
|
@@ -77,10 +77,15 @@ const RadioButtonRow = _ref => {
|
|
|
77
77
|
onValueChange,
|
|
78
78
|
direction: parentDirection
|
|
79
79
|
} = (0, _context.useRadioButtonGroupContext)();
|
|
80
|
+
const realValue = (0, _utilities.getRealValue)(value);
|
|
81
|
+
const realContextValue = (0, _utilities.getRealValue)(contextValue);
|
|
82
|
+
const isSelected = selected !== null && selected !== void 0 ? selected : realContextValue && realValue && realContextValue === realValue;
|
|
80
83
|
|
|
81
84
|
const handlePress = () => {
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
if (realValue) {
|
|
86
|
+
onPress === null || onPress === void 0 ? void 0 : onPress(realValue);
|
|
87
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(realValue);
|
|
88
|
+
}
|
|
84
89
|
};
|
|
85
90
|
|
|
86
91
|
const {
|
|
@@ -104,10 +109,10 @@ const RadioButtonRow = _ref => {
|
|
|
104
109
|
}
|
|
105
110
|
}, /*#__PURE__*/React.createElement(_RadioButton.default, {
|
|
106
111
|
Icon: Icon,
|
|
107
|
-
selected:
|
|
112
|
+
selected: isSelected ? true : false,
|
|
113
|
+
value: realValue,
|
|
108
114
|
color: color,
|
|
109
115
|
unselectedColor: unselectedColor,
|
|
110
|
-
onPress: handlePress,
|
|
111
116
|
style: radioButtonStyle
|
|
112
117
|
})));
|
|
113
118
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["RadioButtonRow.tsx"],"names":["Direction","getRadioButtonAlignment","parentDirection","direction","GroupDirection","Horizontal","Row","RowReverse","renderLabel","
|
|
1
|
+
{"version":3,"sources":["RadioButtonRow.tsx"],"names":["Direction","getRadioButtonAlignment","parentDirection","direction","GroupDirection","Horizontal","Row","RowReverse","renderLabel","label","labelStyle","textStyle","RadioButtonRow","Icon","value","color","unselectedColor","onPress","labelContainerStyle","radioButtonStyle","selected","disabled","style","rest","contextValue","onValueChange","realValue","realContextValue","isSelected","handlePress","textStyles","viewStyles","styles","mainParent","flexDirection","alignItems","flex","StyleSheet","create","justifyContent","paddingStart","minHeight","paddingEnd","Platform","select","web","cursor","userSelect"],"mappings":";;;;;;;AAAA;;AACA;;AAQA;;AACA;;AACA;;AAGA;;AACA;;;;;;;;;;IAEYA,S;;;WAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;GAAAA,S,yBAAAA,S;;AAiBZ,MAAMC,uBAAuB,GAAG,CAC9BC,eAD8B,EAE9BC,SAF8B,KAG3B;AACH,MAAID,eAAe,KAAKE,mBAAeC,UAAvC,EAAmD;AACjD,WAAOF,SAAS,KAAKH,SAAS,CAACM,GAAxB,GAA8B,YAA9B,GAA6C,UAApD;AACD,GAFD,MAEO,IAAIH,SAAS,KAAKH,SAAS,CAACO,UAA5B,EAAwC;AAC7C,WAAO,YAAP;AACD,GAFM,MAEA;AACL,WAAO,UAAP;AACD;AACF,CAXD;;AAaA,MAAMC,WAAW,GAAG,CAClBC,KADkB,EAElBC,UAFkB,EAGlBC,SAHkB,KAIf;AACH,MAAI,OAAOF,KAAP,KAAiB,QAArB,EAA+B;AAC7B,wBAAO,oBAAC,aAAD;AAAM,MAAA,KAAK,EAAE,CAACC,UAAD,EAAaC,SAAb;AAAb,OAAuCF,KAAvC,CAAP;AACD,GAFD,MAEO;AACL,wBAAO,0CAAGA,KAAH,CAAP;AACD;AACF,CAVD;;AAYA,MAAMG,cAAwD,GAAG,QAe3D;AAAA,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KAAK,EAAE,CACLS,MAAM,CAACvB,KADF,EAEL;AACE0B,MAAAA,UAAU,EAAEhC,SAAS,KAAKH,SAAS,CAACM,GAAxB,GAA8B,YAA9B,GAA6C;AAD3D,KAFK,EAKLY,mBALK;AADT,KASGV,WAAW,CAACC,KAAD,EAAQC,UAAR,EAAoBoB,UAApB,CATd,CANF,eAiBE,oBAAC,iBAAD;AACE,IAAA,KAAK,EAAE;AACLM,MAAAA,IAAI,EAAE,CADD;AAELD,MAAAA,UAAU,EAAElC,uBAAuB,CAACC,eAAD,EAAkBC,SAAlB;AAF9B;AADT,kBAME,oBAAC,oBAAD;AACE,IAAA,IAAI,EAAEU,IADR;AAEE,IAAA,QAAQ,EAAEe,UAAU,GAAG,IAAH,GAAU,KAFhC;AAGE,IAAA,KAAK,EAAEF,SAHT;AAIE,IAAA,KAAK,EAAEX,KAJT;AAKE,IAAA,eAAe,EAAEC,eALnB;AAME,IAAA,KAAK,EAAEG;AANT,IANF,CAjBF,CADF;AAmCD,CAxED;;AA0EA,MAAMa,MAAM,GAAGK,wBAAWC,MAAX,CAAkB;AAC/BL,EAAAA,UAAU,EAAE;AACVE,IAAAA,UAAU,EAAE,QADF;AAEVI,IAAAA,cAAc,EAAE,cAFN;AAGVC,IAAAA,YAAY,EAAE,EAHJ;AAIVC,IAAAA,SAAS,EAAE,EAJD;AAKVC,IAAAA,UAAU,EAAE,EALF;AAMVN,IAAAA,IAAI,EAAE,CANI;AAOV,OAAGO,sBAASC,MAAT,CAAgB;AACjBC,MAAAA,GAAG,EAAE;AACHC,QAAAA,MAAM,EAAE,SADL;AAEHC,QAAAA,UAAU,EAAE;AAFT;AADY,KAAhB;AAPO,GADmB;AAe/BtC,EAAAA,KAAK,EAAE;AACL2B,IAAAA,IAAI,EAAE;AADD;AAfwB,CAAlB,CAAf;;eAoBexB,c","sourcesContent":["import * as React from \"react\";\nimport {\n StyleProp,\n ViewStyle,\n StyleSheet,\n TextStyle,\n View,\n Platform,\n} from \"react-native\";\nimport RadioButton, { RadioButtonProps } from \"./RadioButton\";\nimport Text from \"../Text\";\nimport { useRadioButtonGroupContext } from \"./context\";\nimport type { IconSlot } from \"../../interfaces/Icon\";\nimport { Direction as GroupDirection } from \"./context\";\nimport Touchable from \"../Touchable\";\nimport { extractStyles, getRealValue } from \"../../utilities\";\n\nexport enum Direction {\n Row = \"row\",\n RowReverse = \"row-reverse\",\n}\n\nexport interface RadioButtonRowProps extends Omit<RadioButtonProps, \"onPress\"> {\n label: string | React.ReactNode;\n value: string; // A string (or number that will be parsed String(number)) that this radio button row represents when selected\n color?: string;\n unselectedColor?: string;\n labelContainerStyle: StyleProp<ViewStyle>;\n radioButtonStyle?: StyleProp<ViewStyle>;\n labelStyle?: StyleProp<TextStyle>;\n onPress?: (value: string) => void;\n direction?: Direction;\n}\n\nconst getRadioButtonAlignment = (\n parentDirection: GroupDirection | undefined,\n direction: Direction\n) => {\n if (parentDirection === GroupDirection.Horizontal) {\n return direction === Direction.Row ? \"flex-start\" : \"flex-end\";\n } else if (direction === Direction.RowReverse) {\n return \"flex-start\";\n } else {\n return \"flex-end\";\n }\n};\n\nconst renderLabel = (\n label: string | React.ReactNode,\n labelStyle: StyleProp<TextStyle>,\n textStyle: StyleProp<TextStyle>\n) => {\n if (typeof label === \"string\") {\n return <Text style={[labelStyle, textStyle]}>{label}</Text>;\n } else {\n return <>{label}</>;\n }\n};\n\nconst RadioButtonRow: React.FC<RadioButtonRowProps & IconSlot> = ({\n Icon,\n label,\n value,\n color,\n unselectedColor,\n onPress,\n labelContainerStyle,\n labelStyle,\n radioButtonStyle,\n direction = Direction.Row,\n selected,\n disabled,\n style,\n ...rest\n}) => {\n const {\n value: contextValue,\n onValueChange,\n direction: parentDirection,\n } = useRadioButtonGroupContext();\n\n const realValue = getRealValue(value);\n const realContextValue = getRealValue(contextValue);\n const isSelected =\n selected ??\n (realContextValue && realValue && realContextValue === realValue);\n\n const handlePress = () => {\n if (realValue) {\n onPress?.(realValue);\n onValueChange?.(realValue);\n }\n };\n\n const { textStyles, viewStyles } = extractStyles(style);\n\n return (\n <Touchable\n onPress={handlePress}\n style={[styles.mainParent, { flexDirection: direction }, viewStyles]}\n disabled={disabled}\n {...rest}\n >\n <View\n style={[\n styles.label,\n {\n alignItems: direction === Direction.Row ? \"flex-start\" : \"flex-end\",\n },\n labelContainerStyle,\n ]}\n >\n {renderLabel(label, labelStyle, textStyles)}\n </View>\n <View\n style={{\n flex: 1,\n alignItems: getRadioButtonAlignment(parentDirection, direction),\n }}\n >\n <RadioButton\n Icon={Icon}\n selected={isSelected ? true : false}\n value={realValue}\n color={color}\n unselectedColor={unselectedColor}\n style={radioButtonStyle}\n />\n </View>\n </Touchable>\n );\n};\n\nconst styles = StyleSheet.create({\n mainParent: {\n alignItems: \"center\",\n justifyContent: \"space-around\",\n paddingStart: 20,\n minHeight: 50,\n paddingEnd: 20,\n flex: 1,\n ...Platform.select({\n web: {\n cursor: \"pointer\",\n userSelect: \"none\",\n },\n }),\n },\n label: {\n flex: 3,\n },\n});\n\nexport default RadioButtonRow;\n"]}
|
|
@@ -15,6 +15,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
17
|
|
|
18
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
19
|
+
|
|
18
20
|
const StarRating = _ref => {
|
|
19
21
|
let {
|
|
20
22
|
Icon,
|
|
@@ -45,10 +47,9 @@ const StarRating = _ref => {
|
|
|
45
47
|
!!onPress && onPress(r);
|
|
46
48
|
}, [onPress]);
|
|
47
49
|
const ratingRounded = Math.round(localRating * 2) / 2;
|
|
48
|
-
return /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
49
|
-
style: [styles.container, style]
|
|
50
|
-
|
|
51
|
-
}, [...Array(maxStars)].map((_, i) => /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
50
|
+
return /*#__PURE__*/React.createElement(_reactNative.View, _extends({
|
|
51
|
+
style: [styles.container, style]
|
|
52
|
+
}, rest), [...Array(maxStars)].map((_, i) => /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
52
53
|
key: i,
|
|
53
54
|
style: {
|
|
54
55
|
display: "flex"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["StarRating.
|
|
1
|
+
{"version":3,"sources":["StarRating.tsx"],"names":["StarRating","Icon","starSize","maxStars","rating","defaultValue","isEditable","activeColor","inactiveColor","style","onPress","rest","localRating","setLocalRating","React","useState","useEffect","ratingHandler","useCallback","r","ratingRounded","Math","round","styles","container","Array","map","_","i","display","touchContainer","pressable","StyleSheet","create","flexDirection","alignItems","position","top","right","left","bottom","zIndex","flex","height","width"],"mappings":";;;;;;;AAAA;;AACA;;AAOA;;;;;;;;AAiBA,MAAMA,UAA2B,GAAG,QAY9B;AAAA,MAZ+B;AACnCC,IAAAA,IADmC;AAEnCC,IAAAA,QAAQ,GAAG,EAFwB;AAGnCC,IAAAA,QAAQ,GAAG,CAHwB;AAInCC,IAAAA,MAAM,GAAG,CAJ0B;AAKnCC,IAAAA,YALmC;AAMnCC,IAAA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,CAAhB,KAAsB,GAAtB,GACI,yBADJ,GAEI,oBAJR;AAME,IAAA,IAAI,EAAE1B,QANR;AAOE,IAAA,KAAK,EAAEkB,aAAa,GAAGQ,CAAhB,GAAoBrB,WAApB,GAAkCC;AAP3C,IADF,EAUGF,UAAU,iBACT,oBAAC,iBAAD;AAAM,IAAA,KAAK,EAAEiB,MAAM,CAACO;AAApB,kBACE,oBAAC,sBAAD;AACE,IAAA,KAAK,EAAEP,MAAM,CAACQ,SADhB;AAEE,IAAA,OAAO,EAAE,MAAMd,aAAa,CAACW,CAAC,GAAG,GAAL;AAF9B,IADF,eAKE,oBAAC,sBAAD;AACE,IAAA,KAAK,EAAEL,MAAM,CAACQ,SADhB;AAEE,IAAA,OAAO,EAAE,MAAMd,aAAa,CAACW,CAAC,GAAG,CAAL;AAF9B,IALF,CAXJ,CADD,CADH,CADF;AA6BD,CApED;;AAsEA,MAAML,MAAM,GAAGS,wBAAWC,MAAX,CAAkB;AAC/BT,EAAAA,SAAS,EAAE;AACTU,IAAAA,aAAa,EAAE,KADN;AAETC,IAAAA,UAAU,EAAE;AAFH,GADoB;AAK/BL,EAAAA,cAAc,EAAE;AACdD,IAAAA,OAAO,EAAE,MADK;AAEdK,IAAAA,aAAa,EAAE,KAFD;AAGdE,IAAAA,QAAQ,EAAE,UAHI;AAIdC,IAAAA,GAAG,EAAE,CAJS;AAKdC,IAAAA,KAAK,EAAE,CALO;AAMdC,IAAAA,IAAI,EAAE,CANQ;AAOdC,IAAAA,MAAM,EAAE,CAPM;AAQdC,IAAAA,MAAM,EAAE;AARM,GALe;AAe/BV,EAAAA,SAAS,EAAE;AACTW,IAAAA,IAAI,EAAE,CADG;AAETC,IAAAA,MAAM,EAAE,MAFC;AAGTC,IAAAA,KAAK,EAAE;AAHE;AAfoB,CAAlB,CAAf;;eAsBe,wBAAU5C,UAAV,C","sourcesContent":["import * as React from \"react\";\nimport {\n View,\n StyleSheet,\n StyleProp,\n ViewStyle,\n Pressable,\n} from \"react-native\";\nimport { withTheme } from \"../theming\";\nimport type { Theme } from \"../styles/DefaultTheme\";\nimport type { IconSlot } from \"../interfaces/Icon\";\n\ntype Props = {\n starSize?: number;\n maxStars?: number;\n rating?: number;\n defaultValue?: number;\n isEditable?: boolean;\n activeColor?: string;\n inactiveColor?: string;\n theme: Theme;\n style?: StyleProp<ViewStyle>;\n onPress?: (newValue: number) => void;\n} & IconSlot;\n\nconst StarRating: React.FC<Props> = ({\n Icon,\n starSize = 16,\n maxStars = 5,\n rating = 0,\n defaultValue,\n isEditable = false,\n activeColor,\n inactiveColor,\n style,\n onPress,\n ...rest\n}) => {\n const [localRating, setLocalRating] = React.useState<number>(\n rating || defaultValue || 0\n );\n\n React.useEffect(() => {\n if (rating != null) {\n setLocalRating(rating);\n }\n }, [rating]);\n\n React.useEffect(() => {\n if (defaultValue != null) {\n setLocalRating(defaultValue);\n }\n }, [defaultValue]);\n\n const ratingHandler = React.useCallback(\n (r) => {\n setLocalRating(r);\n !!onPress && onPress(r);\n },\n [onPress]\n );\n\n const ratingRounded = Math.round(localRating * 2) / 2;\n\n return (\n <View style={[styles.container, style]} {...rest}>\n {[...Array(maxStars)].map((_, i) => (\n <View key={i} style={{ display: \"flex\" }}>\n <Icon\n name={\n ratingRounded - i === 0.5\n ? \"MaterialIcons/star-half\"\n : \"MaterialIcons/star\"\n }\n size={starSize}\n color={ratingRounded > i ? activeColor : inactiveColor}\n />\n {isEditable && (\n <View style={styles.touchContainer}>\n <Pressable\n style={styles.pressable}\n onPress={() => ratingHandler(i + 0.5)}\n />\n <Pressable\n style={styles.pressable}\n onPress={() => ratingHandler(i + 1)}\n />\n </View>\n )}\n </View>\n ))}\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {\n flexDirection: \"row\",\n alignItems: \"center\",\n },\n touchContainer: {\n display: \"flex\",\n flexDirection: \"row\",\n position: \"absolute\",\n top: 0,\n right: 0,\n left: 0,\n bottom: 0,\n zIndex: 1,\n },\n pressable: {\n flex: 1,\n height: \"100%\",\n width: \"50%\",\n },\n});\n\nexport default withTheme(StarRating);\n"]}
|
|
@@ -11,6 +11,8 @@ var _reactNative = require("react-native");
|
|
|
11
11
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
14
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
|
+
|
|
14
16
|
function Touchable(_ref) {
|
|
15
17
|
let {
|
|
16
18
|
children,
|
|
@@ -19,22 +21,7 @@ function Touchable(_ref) {
|
|
|
19
21
|
style,
|
|
20
22
|
...props
|
|
21
23
|
} = _ref;
|
|
22
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, {
|
|
23
|
-
onPress: onPress,
|
|
24
|
-
disabled: disabled,
|
|
25
|
-
hitSlop: 8,
|
|
26
|
-
style: _ref2 => {
|
|
27
|
-
let {
|
|
28
|
-
pressed
|
|
29
|
-
} = _ref2;
|
|
30
|
-
return [{
|
|
31
|
-
opacity: pressed || disabled ? 0.75 : 1
|
|
32
|
-
}, style];
|
|
33
|
-
},
|
|
34
|
-
...props
|
|
35
|
-
}, children);
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=Touchable.js.mapElement(_reactNative.Pressable, _extends({
|
|
24
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, _extends({
|
|
38
25
|
onPress: onPress,
|
|
39
26
|
disabled: disabled,
|
|
40
27
|
hitSlop: 8,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Touchable.
|
|
1
|
+
{"version":3,"sources":["Touchable.tsx"],"names":["Touchable","children","disabled","onPress","style","props","pressed","opacity"],"mappings":";;;;;;;AAAA;;AACA;;;;;;AASe,SAASA,SAAT,OAML;AAAA,MANwB;AAChCC,IAAAA,QADgC;AAEhCC,IAAAA,QAFgC;AAGhCC,IAAAA,OAHgC;AAIhCC,IAAAA,KAJgC;AAKhC,OAAGC;AAL6B,GAMxB;AACR,sBACE,6BAAC,sBAAD;AACE,IAAA,OAAO,EAAEF,OADX;AAEE,IAAA,QAAQ,EAAED,QAFZ;AAGE,IAAA,OAAO,EAAE,CAHX;AAIE,IAAA,KAAK,EAAE,SAAiB;AAAA,UAAhB;AAAEI,QAAAA;AAAF,OAAgB;AACtB,aAAO,CACL;AACEC,QAAAA,OAAO,EAAED,OAAO,IAAIJ,QAAX,GAAsB,IAAtB,GAA6B;AADxC,OADK,EAILE,KAJK,CAAP;AAMD;AAXH,KAYMC,KAZN,GAcGJ,QAdH,CADF;AAkBD","sourcesContent":["import React from \"react\";\nimport { Pressable, ViewStyle, PressableProps } from \"react-native\";\n\ntype Props = {\n disabled?: boolean;\n children: React.ReactNode;\n style?: ViewStyle;\n onPress?: () => void;\n} & PressableProps;\n\nexport default function Touchable({\n children,\n disabled,\n onPress,\n style,\n ...props\n}: Props) {\n return (\n <Pressable\n onPress={onPress}\n disabled={disabled}\n hitSlop={8}\n style={({ pressed }) => {\n return [\n {\n opacity: pressed || disabled ? 0.75 : 1,\n },\n style,\n ];\n }}\n {...props}\n >\n {children}\n </Pressable>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["hooks.
|
|
1
|
+
{"version":3,"sources":["hooks.ts"],"names":["usePrevious","value","ref","React","useRef","useEffect","current"],"mappings":";;;;;;;AAAA;;;;AAEO,SAASA,WAAT,CAAqBC,KAArB,EAAiC;AACtC;AACA;AACA,QAAMC,GAAG,GAAGC,eAAMC,MAAN,EAAZ,CAHsC,CAKtC;;;AACAD,iBAAME,SAAN,CAAgB,MAAM;AACpBH,IAAAA,GAAG,CAACI,OAAJ,GAAcL,KAAd;AACD,GAFD,EAEG,CAACA,KAAD,CAFH,EANsC,CAUtC;;;AACA,SAAOC,GAAG,CAACI,OAAX;AACD","sourcesContent":["import React from \"react\";\n\nexport function usePrevious(value: any) {\n // The ref object is a generic container whose current property is mutable\n // and can hold any value, similar to an instance property on a class\n const ref = React.useRef();\n\n // Store current value in ref\n React.useEffect(() => {\n ref.current = value;\n }, [value]);\n\n // Return previous value (happens before update in useEffect above)\n return ref.current;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Accordion.
|
|
1
|
+
{"version":3,"sources":["Accordion.ts"],"names":["SEED_DATA","name","tag","description","category","COMPONENT_TYPES","container","layout","paddingTop","paddingRight","paddingBottom","paddingLeft","fontSize","props","openColor","label","closedColor","caretColor","iconSize","defaultValue","expanded","icon"],"mappings":";;;;;;;AAAA;;AASO,MAAMA,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,WADiB;AAEvBC,EAAAA,GAAG,EAAE,gBAFkB;AAGvBC,EAAAA,WAAW,EAAE,+CAHU;AAIvBC,EAAAA,QAAQ,EAAEC,uBAAgBC,SAJH;AAKvBC,EAAAA,MAAM,EAAE;AACNC,IAAAA,UAAU,EAAE,CADN;AAENC,IAAAA,YAAY,EAAE,CAFR;AAGNC,IAAAA,aAAa,EAAE,CAHT;AAINC,IAAAA,WAAW,EAAE,CAJP;AAKNC,IAAAA,QAAQ,EAAE;AALJ,GALe;AAYvBC,EAAAA,KAAK,EAAE;AACLC,IAAAA,SAAS,EAAE,4BAAgB;AACzBC,MAAAA,KAAK,EAAE;AADkB,KAAhB,CADN;AAILC,IAAAA,WAAW,EAAE,4BAAgB;AAC3BD,MAAAA,KAAK,EAAE;AADoB,KAAhB,CAJR;AAOLE,IAAAA,UAAU,EAAE,4BAAgB;AAC1BF,MAAAA,KAAK,EAAE;AADmB,KAAhB,CAPP;AAULG,IAAAA,QAAQ,EAAE,6BAAiB;AACzBH,MAAAA,KAAK,EAAE,WADkB;AAEzBI,MAAAA,YAAY,EAAE;AAFW,KAAjB,CAVL;AAcLJ,IAAAA,KAAK,EAAE,2BAAe;AACpBA,MAAAA,KAAK,EAAE;AADa,KAAf,CAdF;AAiBLK,IAAAA,QAAQ,EAAE,iCAAqB;AAC7BL,MAAAA,KAAK,EAAE,UADsB;AAE7BZ,MAAAA,WAAW,EAAE;AAFgB,KAArB,CAjBL;AAqBLkB,IAAAA,IAAI,EAAE;AArBD;AAZgB,CAAlB","sourcesContent":["import {\n COMPONENT_TYPES,\n createNumberProp,\n createIconProp,\n createTextProp,\n createStaticBoolProp,\n createColorProp,\n} from \"@draftbit/types\";\n\nexport const SEED_DATA = {\n name: \"Accordion\",\n tag: \"AccordionGroup\",\n description: \"An expandable container containing components\",\n category: COMPONENT_TYPES.container,\n layout: {\n paddingTop: 8,\n paddingRight: 8,\n paddingBottom: 8,\n paddingLeft: 8,\n fontSize: 16,\n },\n props: {\n openColor: createColorProp({\n label: \"Open text color\",\n }),\n closedColor: createColorProp({\n label: \"Closed text Color\",\n }),\n caretColor: createColorProp({\n label: \"Caret color\",\n }),\n iconSize: createNumberProp({\n label: \"Icon size\",\n defaultValue: 24,\n }),\n label: createTextProp({\n label: \"Label\",\n }),\n expanded: createStaticBoolProp({\n label: \"Expanded\",\n description: \"Whether the AccordionGroup should be expanded or not\",\n }),\n icon: createIconProp(),\n },\n};\n"]}
|
|
@@ -78,11 +78,11 @@ const SEED_DATA = {
|
|
|
78
78
|
}),
|
|
79
79
|
color2: (0, _types.createColorProp)({
|
|
80
80
|
label: "Color 2",
|
|
81
|
-
defaultValue: "
|
|
81
|
+
defaultValue: "secondary"
|
|
82
82
|
}),
|
|
83
83
|
color1: (0, _types.createColorProp)({
|
|
84
84
|
label: "Color 1",
|
|
85
|
-
defaultValue: "
|
|
85
|
+
defaultValue: "primary"
|
|
86
86
|
})
|
|
87
87
|
}
|
|
88
88
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["LinearGradient.ts"],"names":["SEED_DATA","name","tag","description","layout","width","height","props","endY","group","GROUPS","basic","label","editable","required","defaultValue","min","max","step","precision","formType","FORM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,EAAE;AAFQ,KAAhB;AAjEH;AALgB,CAAlB","sourcesContent":["import {\n createColorProp,\n FORM_TYPES,\n GROUPS,\n PROP_TYPES,\n} from \"@draftbit/types\";\n\nexport const SEED_DATA = {\n name: \"Linear Gradient\",\n tag: \"LinearGradient\",\n description: \"Linear Gradient Component\",\n layout: { width: \"100%\", height: \"100%\" },\n props: {\n endY: {\n group: GROUPS.basic,\n label: \"End Y\",\n description: \"End position from Bottom\",\n editable: true,\n required: false,\n defaultValue: 100,\n min: 0,\n max: 100,\n step: 1,\n precision: 0,\n formType: FORM_TYPES.number,\n propType: PROP_TYPES.NUMBER,\n },\n endX: {\n group: GROUPS.basic,\n label: \"End X\",\n description: \"End position from Right\",\n editable: true,\n required: false,\n defaultValue: 100,\n min: 0,\n max: 100,\n step: 1,\n precision: 0,\n formType: FORM_TYPES.number,\n propType: PROP_TYPES.NUMBER,\n },\n startY: {\n group: GROUPS.basic,\n label: \"Start Y\",\n description: \"Start position from Top\",\n editable: true,\n required: false,\n defaultValue: 0,\n min: 0,\n max: 100,\n step: 1,\n precision: 0,\n formType: FORM_TYPES.number,\n propType: PROP_TYPES.NUMBER,\n },\n startX: {\n group: GROUPS.basic,\n label: \"Start X\",\n description: \"Start position from Left\",\n editable: true,\n required: false,\n defaultValue: 0,\n min: 0,\n max: 100,\n step: 1,\n precision: 0,\n formType: FORM_TYPES.number,\n propType: PROP_TYPES.NUMBER,\n },\n color3: createColorProp({\n label: \"Color 3\",\n defaultValue: undefined,\n }),\n color2: createColorProp({\n label: \"Color 2\",\n defaultValue: \"
|
|
1
|
+
{"version":3,"sources":["LinearGradient.ts"],"names":["SEED_DATA","name","tag","description","layout","width","height","props","endY","group","GROUPS","basic","label","editable","required","defaultValue","min","max","step","precision","formType","FORM_TYPES","number","propType","PROP_TYPES","NUMBER","endX","startY","startX","color3","undefined","color2","color1"],"mappings":";;;;;;;AAAA;;AAOO,MAAMA,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,iBADiB;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name: \"Linear Gradient\",\n tag: \"LinearGradient\",\n description: \"Linear Gradient Component\",\n layout: { width: \"100%\", height: \"100%\" },\n props: {\n endY: {\n group: GROUPS.basic,\n label: \"End Y\",\n description: \"End position from Bottom\",\n editable: true,\n required: false,\n defaultValue: 100,\n min: 0,\n max: 100,\n step: 1,\n precision: 0,\n formType: FORM_TYPES.number,\n propType: PROP_TYPES.NUMBER,\n },\n endX: {\n group: GROUPS.basic,\n label: \"End X\",\n description: \"End position from Right\",\n editable: true,\n required: false,\n defaultValue: 100,\n min: 0,\n max: 100,\n step: 1,\n precision: 0,\n formType: FORM_TYPES.number,\n propType: PROP_TYPES.NUMBER,\n },\n startY: {\n group: GROUPS.basic,\n label: \"Start Y\",\n description: \"Start position from Top\",\n editable: true,\n required: false,\n defaultValue: 0,\n min: 0,\n max: 100,\n step: 1,\n precision: 0,\n formType: FORM_TYPES.number,\n propType: PROP_TYPES.NUMBER,\n },\n startX: {\n group: GROUPS.basic,\n label: \"Start X\",\n description: \"Start position from Left\",\n editable: true,\n required: false,\n defaultValue: 0,\n min: 0,\n max: 100,\n step: 1,\n precision: 0,\n formType: FORM_TYPES.number,\n propType: PROP_TYPES.NUMBER,\n },\n color3: createColorProp({\n label: \"Color 3\",\n defaultValue: undefined,\n }),\n color2: createColorProp({\n label: \"Color 2\",\n defaultValue: \"secondary\",\n }),\n color1: createColorProp({\n label: \"Color 1\",\n defaultValue: \"primary\",\n }),\n },\n};\n"]}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.applyStyles = applyStyles;
|
|
7
7
|
exports.extractStyles = extractStyles;
|
|
8
|
+
exports.getRealValue = getRealValue;
|
|
8
9
|
|
|
9
10
|
var _reactNative = require("react-native");
|
|
10
11
|
|
|
@@ -71,4 +72,19 @@ function applyStyles(baseStyles, stylesToApply) {
|
|
|
71
72
|
|
|
72
73
|
return flattenedStyles;
|
|
73
74
|
}
|
|
75
|
+
|
|
76
|
+
function getRealValue(value) {
|
|
77
|
+
// console.log("getRealValue typeof", typeof value);
|
|
78
|
+
// console.log("getRealValue value", value);
|
|
79
|
+
switch (typeof value) {
|
|
80
|
+
case "string":
|
|
81
|
+
return value;
|
|
82
|
+
|
|
83
|
+
case "number":
|
|
84
|
+
return String(value);
|
|
85
|
+
|
|
86
|
+
default:
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
74
90
|
//# sourceMappingURL=utilities.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["utilities.ts"],"names":["extractStyles","style","color","fontFamily","fontWeight","fontSize","lineHeight","letterSpacing","textTransform","textAlign","textDecorationLine","textDecorationColor","textDecorationStyle","viewStyles","StyleSheet","flatten","textStyles","applyStyles","baseStyles","stylesToApply","flattenedStyles","key","value","Object","entries"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["utilities.ts"],"names":["extractStyles","style","color","fontFamily","fontWeight","fontSize","lineHeight","letterSpacing","textTransform","textAlign","textDecorationLine","textDecorationColor","textDecorationStyle","viewStyles","StyleSheet","flatten","textStyles","applyStyles","baseStyles","stylesToApply","flattenedStyles","key","value","Object","entries","getRealValue","String","undefined"],"mappings":";;;;;;;;;AAAA;;AAEO,SAASA,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,MAaFC,wBAAWC,OAAX,CAAmBd,KAAK,IAAI,EAA5B,CAbJ;;AAeA,QAAMe,UAAqB,GAAG;AAC5Bd,IAAAA,KAD4B;AAE5BC,IAAAA,UAF4B;AAG5BC,IAAAA,UAH4B;AAI5BC,IAAAA,QAJ4B;AAK5BC,IAAAA,UAL4B;AAM5BC,IAAAA,aAN4B;AAO5BC,IAAAA,aAP4B;AAQ5BC,IAAAA,SAR4B;AAS5BC,IAAAA,kBAT4B;AAU5BC,IAAAA,mBAV4B;AAW5BC,IAAAA;AAX4B,GAA9B;AAcA,SAAO;AAAEC,IAAAA,UAAF;AAAcG,IAAAA;AAAd,GAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,WAAT,CACLC,UADK,EAELC,aAFK,EAGL;AACA,MAAI,CAACA,aAAL,EAAoB;AAClB;AACD;;AAED,QAAMC,eAAe,GAAGN,wBAAWC,OAAX,CAAmBG,UAAnB,CAAxB;;AAEA,OAAK,MAAM,CAACG,GAAD,EAAMC,KAAN,CAAX,IAA2BC,MAAM,CAACC,OAAP,CAAeL,aAAf,CAA3B,EAA0D;AACxD,QAAIG,KAAK,IAAI,IAAb,EAAmB;AACjBF,MAAAA,eAAe,CAACC,GAAD,CAAf,GAAuBC,KAAvB;AACD;AACF;;AAED,SAAOF,eAAP;AACD;;AAEM,SAASK,YAAT,CAAsBH,KAAtB,EAAkC;AACvC;AACA;AACA,UAAQ,OAAOA,KAAf;AACE,SAAK,QAAL;AACE,aAAOA,KAAP;;AACF,SAAK,QAAL;AACE,aAAOI,MAAM,CAACJ,KAAD,CAAb;;AACF;AACE,aAAOK,SAAP;AANJ;AAQD","sourcesContent":["import { StyleSheet, StyleProp, TextStyle } from \"react-native\";\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 getRealValue(value: any) {\n // console.log(\"getRealValue typeof\", typeof value);\n // console.log(\"getRealValue value\", value);\n switch (typeof value) {\n case \"string\":\n return value;\n case \"number\":\n return String(value);\n default:\n return undefined;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
1
|
+
{"version":3,"sources":["DatePickerComponentType.js"],"names":[],"mappings":"AAAA","sourcesContent":["export {};\n"]}
|
|
@@ -3,6 +3,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import Config from "../Config";
|
|
5
5
|
import IconButton from "../IconButton";
|
|
6
|
+
import { getRealValue } from "../../utilities";
|
|
6
7
|
import { useRadioButtonGroupContext } from "./context";
|
|
7
8
|
|
|
8
9
|
const RadioButton = _ref => {
|
|
@@ -13,7 +14,7 @@ const RadioButton = _ref => {
|
|
|
13
14
|
value,
|
|
14
15
|
selected,
|
|
15
16
|
unselectedColor,
|
|
16
|
-
onPress
|
|
17
|
+
onPress,
|
|
17
18
|
size = Config.radioButtonSize,
|
|
18
19
|
selectedIcon = "MaterialIcons/radio-button-checked",
|
|
19
20
|
unselectedIcon = "MaterialIcons/radio-button-unchecked",
|
|
@@ -24,16 +25,17 @@ const RadioButton = _ref => {
|
|
|
24
25
|
value: contextValue,
|
|
25
26
|
onValueChange
|
|
26
27
|
} = useRadioButtonGroupContext();
|
|
28
|
+
const realValue = getRealValue(value);
|
|
29
|
+
const realContextValue = getRealValue(contextValue);
|
|
30
|
+
const isSelected = selected !== null && selected !== void 0 ? selected : realContextValue && realValue && realContextValue === realValue;
|
|
27
31
|
|
|
28
32
|
const handlePress = () => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
onValueChange(value);
|
|
33
|
+
if (realValue) {
|
|
34
|
+
onPress === null || onPress === void 0 ? void 0 : onPress(realValue);
|
|
35
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(realValue);
|
|
33
36
|
}
|
|
34
37
|
};
|
|
35
38
|
|
|
36
|
-
const isSelected = selected || contextValue != null && contextValue === value;
|
|
37
39
|
return /*#__PURE__*/React.createElement(IconButton, _extends({
|
|
38
40
|
Icon: Icon,
|
|
39
41
|
icon: isSelected ? selectedIcon : unselectedIcon,
|