@draftbit/core 43.4.5-958f08.1 → 43.4.5-d442fc.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/index.js.map +1 -1
- package/lib/commonjs/components/DatePicker/DatePickerComponent.js.map +1 -1
- package/lib/commonjs/components/Elevation.js +14 -3
- package/lib/commonjs/components/Elevation.js.map +1 -1
- package/lib/commonjs/components/FAB.js +5 -19
- package/lib/commonjs/components/FAB.js.map +1 -1
- package/lib/commonjs/components/FieldSearchBarFull.js.map +1 -1
- package/lib/commonjs/components/Portal/PortalConsumer.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButton.js +6 -9
- package/lib/commonjs/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButtonGroup.js +8 -18
- package/lib/commonjs/components/RadioButton/RadioButtonGroup.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButtonRow.js +9 -14
- package/lib/commonjs/components/RadioButton/RadioButtonRow.js.map +1 -1
- package/lib/commonjs/components/TabView/TabView.js +103 -0
- package/lib/commonjs/components/TabView/TabView.js.map +1 -0
- package/lib/commonjs/components/TabView/TabViewItem.js +27 -0
- package/lib/commonjs/components/TabView/TabViewItem.js.map +1 -0
- package/lib/commonjs/components/TabView/index.js +24 -0
- package/lib/commonjs/components/TabView/index.js.map +1 -0
- package/lib/commonjs/index.js +14 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/mappings/RowHeadlineImageIcon.js.map +1 -1
- package/lib/commonjs/mappings/TabView.js +80 -0
- package/lib/commonjs/mappings/TabView.js.map +1 -0
- package/lib/commonjs/utilities.js +0 -16
- package/lib/commonjs/utilities.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButton.js +6 -8
- package/lib/module/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButtonGroup.js +8 -17
- package/lib/module/components/RadioButton/RadioButtonGroup.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButtonRow.js +10 -15
- package/lib/module/components/RadioButton/RadioButtonRow.js.map +1 -1
- package/lib/module/components/TabView/TabView.js +88 -0
- package/lib/module/components/TabView/TabView.js.map +1 -0
- package/lib/module/components/TabView/TabViewItem.js +19 -0
- package/lib/module/components/TabView/TabViewItem.js.map +1 -0
- package/lib/module/components/TabView/index.js +3 -0
- package/lib/module/components/TabView/index.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/mappings/TabView.js +71 -0
- package/lib/module/mappings/TabView.js.map +1 -0
- package/lib/module/utilities.js +0 -14
- 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/components/TabView/TabView.d.ts +19 -0
- package/lib/typescript/src/components/TabView/TabViewItem.d.ts +10 -0
- package/lib/typescript/src/components/TabView/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/mappings/TabView.d.ts +111 -0
- package/lib/typescript/src/utilities.d.ts +0 -1
- package/package.json +4 -2
- package/src/components/RadioButton/RadioButton.js +5 -9
- package/src/components/RadioButton/RadioButton.tsx +9 -12
- package/src/components/RadioButton/RadioButtonGroup.js +8 -14
- package/src/components/RadioButton/RadioButtonGroup.tsx +12 -21
- package/src/components/RadioButton/RadioButtonRow.js +9 -15
- package/src/components/RadioButton/RadioButtonRow.tsx +13 -19
- package/src/components/TabView/TabView.js +33 -0
- package/src/components/TabView/TabView.tsx +97 -0
- package/src/components/TabView/TabViewItem.js +5 -0
- package/src/components/TabView/TabViewItem.tsx +21 -0
- package/src/components/TabView/index.js +2 -0
- package/src/components/TabView/index.ts +2 -0
- package/src/index.js +1 -0
- package/src/index.tsx +1 -0
- package/src/mappings/TabView.js +73 -0
- package/src/mappings/TabView.ts +80 -0
- package/src/utilities.js +0 -12
- package/src/utilities.ts +0 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AACA","sourcesContent":["export { default as AccordionGroup } from \"./AccordionGroup\";\nexport { default as AccordionItem } from \"./AccordionItem\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DatePickerComponent.
|
|
1
|
+
{"version":3,"sources":["DatePickerComponent.tsx"],"names":["DatePickerComponent","value","onChange","mode","toggleVisibility","Platform","OS","console","log","data"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AAGA,MAAMA,mBAAoC,GAAG,QAKvC;AAAA,MALwC;AAC5CC,IAAAA,KAD4C;AAE5CC,IAAAA,QAF4C;AAG5CC,IAAAA,IAH4C;AAI5CC,IAAAA;AAJ4C,GAKxC;AACJ,SAAOC,sBAASC,EAAT,KAAgB,KAAhB,IAAyBD,sBAASC,EAAT,KAAgB,SAAzC,gBACL,6BAAC,uCAAD;AACE,IAAA,IAAI,EAAEL,KADR;AAEE,IAAA,IAAI,EAAEE,IAFR;AAGE,IAAA,SAAS,EAAE,IAHb;AAIE,IAAA,OAAO,EAAEE,sBAASC,EAAT,KAAgB,KAAhB,GAAwB,SAAxB,GAAoC,SAJ/C;AAKE,IAAA,QAAQ,EAAE,MAAM;AACdC,MAAAA,OAAO,CAACC,GAAR,CAAY,6CAAZ;AACAJ,MAAAA,gBAAgB;AACjB,KARH;AASE,IAAA,SAAS,EAAGK,IAAD,IAAU;AACnBP,MAAAA,QAAQ,CAAC,IAAD,EAAOO,IAAP,CAAR;AACD;AAXH,IADK,gBAeL,6BAAC,uBAAD;AACE,IAAA,KAAK,EAAER,KADT;AAEE,IAAA,IAAI,EAAEE,IAFR;AAGE,IAAA,QAAQ,EAAED,QAHZ;AAIE,IAAA,OAAO,EAAE;AAJX,IAfF;AAsBD,CA5BD;;eA8BeF,mB","sourcesContent":["import React from \"react\";\nimport { Platform } from \"react-native\";\nimport DateTimePicker from \"@react-native-community/datetimepicker\";\nimport DateTimePickerModal from \"react-native-modal-datetime-picker\";\nimport { DatePickerComponentProps as Props } from \"./DatePickerComponentType\";\n\nconst DatePickerComponent: React.FC<Props> = ({\n value,\n onChange,\n mode,\n toggleVisibility,\n}) => {\n return Platform.OS === \"ios\" || Platform.OS === \"android\" ? (\n <DateTimePickerModal\n date={value}\n mode={mode}\n isVisible={true}\n display={Platform.OS === \"ios\" ? \"spinner\" : \"default\"}\n onCancel={() => {\n console.log(\"Picker cancelled before selecting anything.\");\n toggleVisibility();\n }}\n onConfirm={(data) => {\n onChange(null, data);\n }}\n />\n ) : (\n <DateTimePicker\n value={value}\n mode={mode}\n onChange={onChange}\n display={\"default\"}\n />\n );\n};\n\nexport default DatePickerComponent;\n"]}
|
|
@@ -19,8 +19,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
19
19
|
|
|
20
20
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
21
|
|
|
22
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
23
|
-
|
|
24
22
|
/* directly copied from https://github.com/callstack/react-native-paper/blob/main/src/components/Surface.tsx#L62 */
|
|
25
23
|
const Elevation = _ref => {
|
|
26
24
|
let {
|
|
@@ -37,11 +35,24 @@ const Elevation = _ref => {
|
|
|
37
35
|
colors
|
|
38
36
|
} = theme;
|
|
39
37
|
const borderRadius = radius;
|
|
40
|
-
return /*#__PURE__*/React.createElement(_reactNative.Animated.View,
|
|
38
|
+
return /*#__PURE__*/React.createElement(_reactNative.Animated.View, { ...rest,
|
|
41
39
|
style: [{
|
|
42
40
|
borderRadius,
|
|
43
41
|
backgroundColor: colors.surface
|
|
44
42
|
}, elevation ? (0, _shadow.default)(elevation) : null, style]
|
|
43
|
+
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
44
|
+
style: {
|
|
45
|
+
overflow: "hidden",
|
|
46
|
+
borderRadius
|
|
47
|
+
}
|
|
48
|
+
}, children));
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
var _default = (0, _theming.withTheme)(Elevation);
|
|
52
|
+
|
|
53
|
+
exports.default = _default;
|
|
54
|
+
//# sourceMappingURL=Elevation.js.mape
|
|
55
|
+
}, elevation ? (0, _shadow.default)(elevation) : null, style]
|
|
45
56
|
}), /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
46
57
|
style: {
|
|
47
58
|
overflow: "hidden",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Elevation.
|
|
1
|
+
{"version":3,"sources":["Elevation.js"],"names":["Elevation","style","theme","children","rest","elevation","borderRadius","radius","StyleSheet","flatten","colors","React","createElement","Animated","View","backgroundColor","surface","overflow"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;AACA;AACA,MAAMA,SAAS,GAAG,QAAyC;AAAA,MAAxC;AAAEC,IAAAA,KAAF;AAASC,IAAAA,KAAT;AAAgBC,IAAAA,QAAhB;AAA0B,OAAGC;AAA7B,GAAwC;AACvD,QAAM;AAAEC,IAAAA,SAAS,GAAG,CAAd;AAAiBC,IAAAA,YAAY,EAAEC;AAA/B,MAA0CC,wBAAWC,OAAX,CAAmBR,KAAnB,KAA6B,EAA7E;AACA,QAAM;AAAES,IAAAA;AAAF,MAAaR,KAAnB;AACA,QAAMI,YAAY,GAAGC,MAArB;AACA,sBAAQI,KAAK,CAACC,aAAN,CAAoBC,sBAASC,IAA7B,EAAmC,EAAE,GAAGV,IAAL;AAAWH,IAAAA,KAAK,EAAE,CACrD;AACIK,MAAAA,YADJ;AAEIS,MAAAA,eAAe,EAAEL,MAAM,CAACM;AAF5B,KADqD,EAKrDX,SAAS,GAAG,qBAAOA,SAAP,CAAH,GAAuB,IALqB,EAMrDJ,KANqD;AAAlB,GAAnC,eAQJU,KAAK,CAACC,aAAN,CAAoBE,iBAApB,EAA0B;AAAEb,IAAAA,KAAK,EAAE;AAAEgB,MAAAA,QAAQ,EAAE,QAAZ;AAAsBX,MAAAA;AAAtB;AAAT,GAA1B,EAA2EH,QAA3E,CARI,CAAR;AASH,CAbD;;eAce,wBAAUH,SAAV,C","sourcesContent":["import * as React from \"react\";\nimport { Animated, StyleSheet, View, } from \"react-native\";\nimport shadow from \"../styles/shadow\";\nimport { withTheme } from \"../theming\";\n/* directly copied from https://github.com/callstack/react-native-paper/blob/main/src/components/Surface.tsx#L62 */\nconst Elevation = ({ style, theme, children, ...rest }) => {\n const { elevation = 4, borderRadius: radius } = StyleSheet.flatten(style) || {};\n const { colors } = theme;\n const borderRadius = radius;\n return (React.createElement(Animated.View, { ...rest, style: [\n {\n borderRadius,\n backgroundColor: colors.surface,\n },\n elevation ? shadow(elevation) : null,\n style,\n ] },\n React.createElement(View, { style: { overflow: \"hidden\", borderRadius } }, children)));\n};\nexport default withTheme(Elevation);\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 FAB = _ref => {
|
|
19
21
|
let {
|
|
20
22
|
onPress,
|
|
@@ -38,7 +40,7 @@ const FAB = _ref => {
|
|
|
38
40
|
borderRadius: size / 2,
|
|
39
41
|
overflow: "hidden"
|
|
40
42
|
}, style]
|
|
41
|
-
}, /*#__PURE__*/React.createElement(_reactNative.Pressable, {
|
|
43
|
+
}, /*#__PURE__*/React.createElement(_reactNative.Pressable, _extends({
|
|
42
44
|
onPress: onPress,
|
|
43
45
|
disabled: loading || disabled,
|
|
44
46
|
android_ripple: {
|
|
@@ -56,9 +58,8 @@ const FAB = _ref => {
|
|
|
56
58
|
borderRadius: size / 2,
|
|
57
59
|
backgroundColor
|
|
58
60
|
}];
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
}, /*#__PURE__*/React.createElement(_reactNative.View, null, loading ? /*#__PURE__*/React.createElement(_reactNative.ActivityIndicator, {
|
|
61
|
+
}
|
|
62
|
+
}, props), /*#__PURE__*/React.createElement(_reactNative.View, null, loading ? /*#__PURE__*/React.createElement(_reactNative.ActivityIndicator, {
|
|
62
63
|
style: size > 50 ? {
|
|
63
64
|
marginTop: 2,
|
|
64
65
|
marginLeft: 2
|
|
@@ -88,20 +89,5 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
88
89
|
|
|
89
90
|
var _default = (0, _theming.withTheme)(FAB);
|
|
90
91
|
|
|
91
|
-
exports.default = _default;
|
|
92
|
-
//# sourceMappingURL=FAB.js.map backgroundColor: "#5a45ff",
|
|
93
|
-
justifyContent: "center",
|
|
94
|
-
alignItems: "center",
|
|
95
|
-
..._reactNative.Platform.select({
|
|
96
|
-
web: {
|
|
97
|
-
cursor: "pointer",
|
|
98
|
-
userSelect: "none"
|
|
99
|
-
}
|
|
100
|
-
})
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
var _default = (0, _theming.withTheme)(FAB);
|
|
105
|
-
|
|
106
92
|
exports.default = _default;
|
|
107
93
|
//# sourceMappingURL=FAB.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FAB.
|
|
1
|
+
{"version":3,"sources":["FAB.tsx"],"names":["FAB","onPress","disabled","loading","iconName","style","theme","iconColor","bgColor","size","Icon","props","backgroundColor","colors","primary","color","width","height","borderRadius","overflow","radius","pressed","styles","button","opacity","marginTop","marginLeft","undefined","StyleSheet","create","justifyContent","alignItems","Platform","select","web","cursor","userSelect"],"mappings":";;;;;;;AAAA;;AACA;;AAUA;;;;;;;;AAiBA,MAAMA,GAAoB,GAAG,QAYvB;AAAA,MAZwB;AAC5BC,IAAAA,OAD4B;AAE5BC,IAAAA,QAF4B;AAG5BC,IAAAA,OAH4B;AAI5BC,IAAAA,QAAQ,GAAG,mBAJiB;AAK5BC,IAAAA,KAL4B;AAM5BC,IAAAA,KAN4B;AAO5BC,IAAAA,SAP4B;AAQ5BC,IAAAA,OAR4B;AAS5BC,IAAAA,IAAI,GAAG,EATqB;AAU5BC,IAAAA,IAV4B;AAW5B,OAAGC;AAXyB,GAYxB;AACJ,QAAMC,eAAe,G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AAsB,IAAA,IAAI,EAAEK,IAA5B;AAAkC,IAAA,KAAK,EAAEM;AAAzC,IARJ,CArBF,CAXF,CADF;AA+CD,CA/DD;;AAiEA,MAAMO,MAAM,GAAGM,wBAAWC,MAAX,CAAkB;AAC/BN,EAAAA,MAAM,EAAE;AACNX,IAAAA,eAAe,EAAE,SADX;AAENkB,IAAAA,cAAc,EAAE,QAFV;AAGNC,IAAAA,UAAU,EAAE,QAHN;AAIN,OAAGC,sBAASC,MAAT,CAAgB;AACjBC,MAAAA,GAAG,EAAE;AACHC,QAAAA,MAAM,EAAE,SADL;AAEHC,QAAAA,UAAU,EAAE;AAFT;AADY,KAAhB;AAJG;AADuB,CAAlB,CAAf;;eAce,wBAAUpC,GAAV,C","sourcesContent":["import * as React from \"react\";\nimport {\n View,\n StyleSheet,\n Pressable,\n ActivityIndicator,\n StyleProp,\n ViewStyle,\n PressableProps,\n Platform,\n} from \"react-native\";\nimport { withTheme } from \"../theming\";\nimport type { Theme } from \"../styles/DefaultTheme\";\nimport type { IconSlot } from \"../interfaces/Icon\";\n\ntype Props = {\n disabled?: boolean;\n loading?: boolean;\n size?: number;\n bgColor?: string;\n iconColor?: string;\n iconName?: string;\n onPress: () => void;\n theme: Theme;\n style?: StyleProp<ViewStyle>;\n} & PressableProps &\n IconSlot;\n\nconst FAB: React.FC<Props> = ({\n onPress,\n disabled,\n loading,\n iconName = \"MaterialIcons/add\",\n style,\n theme,\n iconColor,\n bgColor,\n size = 50,\n Icon,\n ...props\n}) => {\n const backgroundColor = bgColor || theme.colors.primary;\n const color = iconColor || \"#FFF\";\n\n return (\n <View\n style={[\n {\n width: size,\n height: size,\n borderRadius: size / 2,\n overflow: \"hidden\",\n },\n style,\n ]}\n >\n <Pressable\n onPress={onPress}\n disabled={loading || disabled}\n android_ripple={{\n color: \"#333\",\n radius: size / 4,\n }}\n style={({ pressed }) => {\n return [\n styles.button,\n {\n opacity: pressed || disabled ? 0.75 : 1,\n width: size,\n height: size,\n borderRadius: size / 2,\n backgroundColor,\n },\n ];\n }}\n {...props}\n >\n <View>\n {loading ? (\n <ActivityIndicator\n style={size > 50 ? { marginTop: 2, marginLeft: 2 } : undefined}\n size={size <= 50 ? \"small\" : \"large\"}\n color={color}\n />\n ) : (\n <Icon name={iconName} size={size} color={color} />\n )}\n </View>\n </Pressable>\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n button: {\n backgroundColor: \"#5a45ff\",\n justifyContent: \"center\",\n alignItems: \"center\",\n ...Platform.select({\n web: {\n cursor: \"pointer\",\n userSelect: \"none\",\n },\n }),\n },\n});\n\nexport default withTheme(FAB);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FieldSearchBarFull.
|
|
1
|
+
{"version":3,"sources":["FieldSearchBarFull.tsx"],"names":["FieldSearchBarFull","showIcon","Icon","icon","placeholder","style","theme","colors","typography","onChange","changeOverride","onSubmit","submitOverride","value","defaultValue","focused","setIsFocused","React","useState","onBlur","internalValue","setInternalValue","useEffect","useCallback","text","onFocus","e","lineHeight","typeStyles","body2","handleChangeText","newValue","styles","container","Config","fieldSearchBarFullIconSize","primary","light","marginLeft","flex","color","medium","StyleSheet","create","flexDirection","alignItems"],"mappings":";;;;;;;AAAA;;AACA;;AASA;;AAGA;;;;;;;;AAcA,MAAMA,kBAAmC,GAAG,QAWtC;AAAA,MAXuC;AAC3CC,IAAAA,QAD2C;AAE3CC,IAAAA,IAF2C;AAG3CC,IAAAA,IAAI,GAAG,QAHoC;AAI3CC,IAAAA,WAAW,GAAG,EAJ6B;AAK3CC,IAAAA,KAL2C;AAM3CC,IAAAA,KAAK,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA;AAAV,KANoC;AAO3CC,IAAAA,QAAQ,EAAEC,cAPiC;AAQ3CC,IAAAA,QAAQ,EAAEC,cARiC;AAS3CC,IAAAA,KAT2C;AAU3CC,IAAAA;AAV2C,GAWvC;AACJ,QAAM,CAACC,OAAD,EAAUC,YAAV,IAA0BC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M,CAACC,SAAR,EAAmB5B,KAAnB;AAAb,KACGJ,QAAQ,iBACP,oBAAC,IAAD;AACE,IAAA,IAAI,EAAEE,IADR;AAEE,IAAA,IAAI,EAAE+B,gBAAOC,0BAFf;AAGE,IAAA,KAAK,EAAEpB,OAAO,GAAGR,MAAM,CAAC6B,OAAV,GAAoB7B,MAAM,CAAC8B;AAH3C,IAFJ,eAQE,oBAAC,iBAAD;AAAM,IAAA,KAAK,EAAE;AAAEC,MAAAA,UAAU,EAAErC,QAAQ,GAAG,EAAH,GAAQ,CAA9B;AAAiCsC,MAAAA,IAAI,EAAE;AAAvC;AAAb,kBACE,oBAAC,sBAAD;AACE,IAAA,eAAe,EAAC,eADlB;AAEE,IAAA,WAAW,EAAEnC,WAFf;AAGE,IAAA,KAAK,EAAEgB,aAHT;AAIE,IAAA,MAAM,EAAED,MAJV;AAKE,IAAA,OAAO,EAAEM,OALX;AAME,IAAA,YAAY,EAAEK,gBANhB;AAOE,IAAA,eAAe,EAAEnB,QAPnB;AAQE,IAAA,oBAAoB,EAAEJ,MAAM,CAAC8B,KAR/B;AASE,IAAA,KAAK,EAAE,CACL;AACEG,MAAAA,KAAK,EAAEjC,MAAM,CAACkC;AADhB,KADK,EAILb,UAJK;AATT,IADF,CARF,CADF;AA6BD,CAzFD;;AA2FA,MAAMI,MAAM,GAAGU,wBAAWC,MAAX,CAAkB;AAC/BV,EAAAA,SAAS,EAAE;AACTW,IAAAA,aAAa,EAAE,KADN;AAETC,IAAAA,UAAU,EAAE;AAFH;AADoB,CAAlB,CAAf;;eAOe,wBAAU7C,kBAAV,C","sourcesContent":["import * as React from \"react\";\nimport {\n View,\n TextInput,\n StyleSheet,\n StyleProp,\n ViewStyle,\n NativeSyntheticEvent,\n TextInputSubmitEditingEventData,\n} from \"react-native\";\nimport { withTheme } from \"../theming\";\nimport type { Theme } from \"../styles/DefaultTheme\";\nimport type { IconSlot } from \"../interfaces/Icon\";\nimport Config from \"./Config\";\n\ntype Props = {\n showIcon: boolean;\n icon?: string;\n placeholder?: string;\n style?: StyleProp<ViewStyle>;\n theme: Theme;\n onChange?: (text: string) => void;\n onSubmit?: (e: NativeSyntheticEvent<TextInputSubmitEditingEventData>) => void;\n value?: string;\n defaultValue?: string;\n} & IconSlot;\n\nconst FieldSearchBarFull: React.FC<Props> = ({\n showIcon,\n Icon,\n icon = \"search\",\n placeholder = \"\",\n style,\n theme: { colors, typography },\n onChange: changeOverride,\n onSubmit: submitOverride,\n value,\n defaultValue,\n}) => {\n const [focused, setIsFocused] = React.useState(false);\n\n const onBlur = () => {\n setIsFocused(false);\n };\n\n const [internalValue, setInternalValue] = React.useState<string | undefined>(\n value || defaultValue\n );\n\n React.useEffect(() => {\n if (value != null) {\n setInternalValue(value);\n }\n }, [value]);\n\n React.useEffect(() => {\n if (defaultValue != null) {\n setInternalValue(defaultValue);\n }\n }, [defaultValue]);\n\n const onChange = React.useCallback(\n (text: string) => {\n changeOverride && changeOverride(text);\n },\n [changeOverride]\n );\n\n const onFocus = () => {\n setIsFocused(true);\n };\n\n const onSubmit = (\n e: NativeSyntheticEvent<TextInputSubmitEditingEventData>\n ) => {\n submitOverride && submitOverride(e);\n };\n\n const { lineHeight, ...typeStyles } = typography.body2; // eslint-disable-line @typescript-eslint/no-unused-vars\n\n const handleChangeText = (newValue: string) => {\n setInternalValue(newValue);\n if (onChange) {\n onChange(newValue);\n }\n };\n\n return (\n <View style={[styles.container, style]}>\n {showIcon && (\n <Icon\n name={icon}\n size={Config.fieldSearchBarFullIconSize}\n color={focused ? colors.primary : colors.light}\n />\n )}\n <View style={{ marginLeft: showIcon ? 12 : 0, flex: 1 }}>\n <TextInput\n clearButtonMode=\"while-editing\"\n placeholder={placeholder}\n value={internalValue}\n onBlur={onBlur}\n onFocus={onFocus}\n onChangeText={handleChangeText}\n onSubmitEditing={onSubmit}\n placeholderTextColor={colors.light}\n style={[\n {\n color: colors.medium,\n },\n typeStyles,\n ]}\n />\n </View>\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {\n flexDirection: \"row\",\n alignItems: \"center\",\n },\n});\n\nexport default withTheme(FieldSearchBarFull);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["PortalConsumer.
|
|
1
|
+
{"version":3,"sources":["PortalConsumer.tsx"],"names":["PortalConsumer","React","Component","componentDidMount","checkManager","Promise","resolve","key","props","manager","mount","children","componentDidUpdate","update","componentWillUnmount","unmount","Error","render"],"mappings":";;;;;;;AAAA;;;;;;;;AAQe,MAAMA,cAAN,SAA6BC,KAAK,CAACC,SAAnC,CAAoD;AAAA;AAAA;;AAAA;AAAA;;AAC1C,QAAjBC,iBAAiB,GAAG;AACxB,SAAKC,YAAL,GADwB,CAGxB;;AACA,UAAMC,OAAO,CAACC,OAAR,EAAN;AAEA,SAAKC,GAAL,GAAW,KAAKC,KAAL,CAAWC,OAAX,CAAmBC,KAAnB,CAAyB,KAAKF,KAAL,CAAWG,QAApC,CAAX;AACD;;AAEDC,EAAAA,kBAAkB,GAAG;AACnB,SAAKR,YAAL;AAEA,SAAKI,KAAL,CAAWC,OAAX,CAAmBI,MAAnB,CAA0B,KAAKN,GAA/B,EAAoC,KAAKC,KAAL,CAAWG,QAA/C;AACD;;AAEDG,EAAAA,oBAAoB,GAAG;AACrB,SAAKV,YAAL;AAEA,SAAKI,KAAL,CAAWC,OAAX,CAAmBM,OAAnB,CAA2B,KAAKR,GAAhC;AACD;;AAIOH,EAAAA,YAAY,GAAG;AACrB,QAAI,CAAC,KAAKI,KAAL,CAAWC,OAAhB,EAAyB;AACvB,YAAM,IAAIO,KAAJ,CACJ,+GACE,iGADF,GAEE,qEAHE,CAAN;AAKD;AACF;;AAEDC,EAAAA,MAAM,GAAG;AACP,WAAO,IAAP;AACD;;AApCgE","sourcesContent":["import * as React from \"react\";\nimport { PortalMethods } from \"./PortalHost\";\n\ntype Props = {\n manager: PortalMethods;\n children: React.ReactNode;\n};\n\nexport default class PortalConsumer extends React.Component<Props> {\n async componentDidMount() {\n this.checkManager();\n\n // Delay updating to prevent React from going to infinite loop\n await Promise.resolve();\n\n this.key = this.props.manager.mount(this.props.children);\n }\n\n componentDidUpdate() {\n this.checkManager();\n\n this.props.manager.update(this.key, this.props.children);\n }\n\n componentWillUnmount() {\n this.checkManager();\n\n this.props.manager.unmount(this.key);\n }\n\n private key: any;\n\n private checkManager() {\n if (!this.props.manager) {\n throw new Error(\n \"Looks like you forgot to wrap your root component with `Provider` component from `react-native-paper`.\\n\\n\" +\n \"Please read our getting-started guide and make sure you've followed all the required steps.\\n\\n\" +\n \"https://callstack.github.io/react-native-paper/getting-started.html\"\n );\n }\n }\n\n render() {\n return null;\n }\n}\n"]}
|
|
@@ -11,8 +11,6 @@ var _Config = _interopRequireDefault(require("../Config"));
|
|
|
11
11
|
|
|
12
12
|
var _IconButton = _interopRequireDefault(require("../IconButton"));
|
|
13
13
|
|
|
14
|
-
var _utilities = require("../../utilities");
|
|
15
|
-
|
|
16
14
|
var _context = require("./context");
|
|
17
15
|
|
|
18
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -31,7 +29,7 @@ const RadioButton = _ref => {
|
|
|
31
29
|
value,
|
|
32
30
|
selected,
|
|
33
31
|
unselectedColor,
|
|
34
|
-
onPress,
|
|
32
|
+
onPress = () => {},
|
|
35
33
|
size = _Config.default.radioButtonSize,
|
|
36
34
|
selectedIcon = "MaterialIcons/radio-button-checked",
|
|
37
35
|
unselectedIcon = "MaterialIcons/radio-button-unchecked",
|
|
@@ -42,17 +40,16 @@ const RadioButton = _ref => {
|
|
|
42
40
|
value: contextValue,
|
|
43
41
|
onValueChange
|
|
44
42
|
} = (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;
|
|
48
43
|
|
|
49
44
|
const handlePress = () => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
onPress && onPress();
|
|
46
|
+
|
|
47
|
+
if (onValueChange && value) {
|
|
48
|
+
onValueChange(value);
|
|
53
49
|
}
|
|
54
50
|
};
|
|
55
51
|
|
|
52
|
+
const isSelected = selected || contextValue != null && contextValue === value;
|
|
56
53
|
return /*#__PURE__*/React.createElement(_IconButton.default, _extends({
|
|
57
54
|
Icon: Icon,
|
|
58
55
|
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","handlePress","isSelected"],"mappings":";;;;;;;AAAA;;AAGA;;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,OAAO,GAAG,MAAM,CAAE,CAP6B;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,WAAW,GAAG,MAAM;AACxBV,IAAAA,OAAO,IAAIA,OAAO,EAAlB;;AAEA,QAAIS,aAAa,IAAIZ,KAArB,EAA4B;AAC1BY,MAAAA,aAAa,CAACZ,KAAD,CAAb;AACD;AACF,GAND;;AAQA,QAAMc,UAAU,GACdb,QAAQ,IAAKU,YAAY,IAAI,IAAhB,IAAwBA,YAAY,KAAKX,KADxD;AAGA,sBACE,oBAAC,mBAAD;AACE,IAAA,IAAI,EAAEH,IADR;AAEE,IAAA,IAAI,EAAEiB,UAAU,GAAGP,YAAH,GAAkBC,cAFpC;AAGE,IAAA,KAAK,EAAEM,UAAU,GAAGf,KAAH,GAAWG,eAH9B;AAIE,IAAA,QAAQ,EAAEJ,QAJZ;AAKE,IAAA,OAAO,EAAEe,WALX;AAME,IAAA,IAAI,EAAET,IANR;AAOE,IAAA,KAAK,EAAEK;AAPT,KAQMC,IARN,EADF;AAYD,CAvCD;;eAyCed,W","sourcesContent":["import * as React from \"react\";\nimport { StyleProp, ViewStyle } from \"react-native\";\n\nimport Config from \"../Config\";\nimport IconButton from \"../IconButton\";\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?: () => 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 handlePress = () => {\n onPress && onPress();\n\n if (onValueChange && value) {\n onValueChange(value);\n }\n };\n\n const isSelected =\n selected || (contextValue != null && contextValue === value);\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,8 +9,6 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _reactNative = require("react-native");
|
|
11
11
|
|
|
12
|
-
var _utilities = require("../../utilities");
|
|
13
|
-
|
|
14
12
|
var _context = require("./context");
|
|
15
13
|
|
|
16
14
|
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); }
|
|
@@ -27,35 +25,27 @@ const RadioButtonGroup = _ref => {
|
|
|
27
25
|
let {
|
|
28
26
|
direction = _context.Direction.Vertical,
|
|
29
27
|
value,
|
|
30
|
-
onValueChange,
|
|
28
|
+
onValueChange = () => {},
|
|
31
29
|
defaultValue,
|
|
32
30
|
style,
|
|
33
31
|
children,
|
|
34
32
|
...rest
|
|
35
33
|
} = _ref;
|
|
36
|
-
const [internalValue, setInternalValue] = React.useState();
|
|
34
|
+
const [internalValue, setInternalValue] = React.useState(value || defaultValue);
|
|
37
35
|
React.useEffect(() => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (realValue) {
|
|
41
|
-
setInternalValue(realValue);
|
|
36
|
+
if (value != null) {
|
|
37
|
+
setInternalValue(value);
|
|
42
38
|
}
|
|
43
39
|
}, [value]);
|
|
44
40
|
React.useEffect(() => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (realDefaultValue) {
|
|
48
|
-
setInternalValue(realDefaultValue);
|
|
41
|
+
if (defaultValue != null) {
|
|
42
|
+
setInternalValue(defaultValue);
|
|
49
43
|
}
|
|
50
44
|
}, [defaultValue]);
|
|
51
45
|
|
|
52
46
|
const handleValueChange = newValue => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (realNewValue) {
|
|
56
|
-
setInternalValue(newValue);
|
|
57
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue);
|
|
58
|
-
}
|
|
47
|
+
setInternalValue(newValue);
|
|
48
|
+
onValueChange(newValue);
|
|
59
49
|
};
|
|
60
50
|
|
|
61
51
|
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","
|
|
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,aAAa,GAAG,MAAM,CAAE,CAHiC;AAIzDC,IAAAA,YAJyD;AAKzDC,IAAAA,KALyD;AAMzDC,IAAAA,QANyD;AAOzD,OAAGC;AAPsD,GAQrD;AACJ,QAAM,CAACC,aAAD,EAAgBC,gBAAhB,IAAoCC,KAAK,CAACC,QAAN,CACxCT,KAAK,IAAIE,YAD+B,CAA1C;AAIAM,EAAAA,KAAK,CAACE,SAAN,CAAgB,MAAM;AACpB,QAAIV,KAAK,IAAI,IAAb,EAAmB;AACjBO,MAAAA,gBAAgB,CAACP,KAAD,CAAhB;AACD;AACF,GAJD,EAIG,CAACA,KAAD,CAJH;AAMAQ,EAAAA,KAAK,CAACE,SAAN,CAAgB,MAAM;AACpB,QAAIR,YAAY,IAAI,IAApB,EAA0B;AACxBK,MAAAA,gBAAgB,CAACL,YAAD,CAAhB;AACD;AACF,GAJD,EAIG,CAACA,YAAD,CAJH;;AAMA,QAAMS,iBAAiB,GAAIC,QAAD,IAAsB;AAC9CL,IAAAA,gBAAgB,CAACK,QAAD,CAAhB;AACAX,IAAAA,aAAa,CAACW,QAAD,CAAb;AACD,GAHD;;AAKA,QAAMC,eAAqC,GAAG,CAC5C;AACEC,IAAAA,aAAa,EAAEjB,SAAS,KAAKC,mBAAUiB,UAAxB,GAAqC,KAArC,GAA6C;AAD9D,GAD4C,CAA9C;;AAMA,MAAIlB,SAAS,KAAKC,mBAAUC,QAA5B,EAAsC;AACpCc,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,EAAoBf,KAApB;AAAb,KAA6CE,IAA7C,gBACE,oBAAC,QAAD;AACE,IAAA,KAAK,EAAE;AACLL,MAAAA,KAAK,EAAEM,aAAa,IAAI,EADnB;AAELL,MAAAA,aAAa,EAAEU,iBAFV;AAGLd,MAAAA;AAHK;AADT,kBAOE,oBAAC,iBAAD;AAAM,IAAA,KAAK,EAAEgB;AAAb,KAA+BT,QAA/B,CAPF,CADF,CADF;AAaD,CAvDD;;eAyDeR,gB","sourcesContent":["import * as React from \"react\";\nimport { View, StyleProp, ViewStyle } from \"react-native\";\nimport type { Theme } from \"../../styles/DefaultTheme\";\nimport { 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;\n theme: Theme;\n children: React.ReactNode;\n}\n\nconst { Provider } = radioButtonGroupContext;\n\nconst RadioButtonGroup: React.FC<RadioButtonGroupProps> = ({\n direction = Direction.Vertical,\n value,\n onValueChange = () => {},\n defaultValue,\n style,\n children,\n ...rest\n}) => {\n const [internalValue, setInternalValue] = React.useState<string | undefined>(\n value || defaultValue\n );\n\n React.useEffect(() => {\n if (value != null) {\n setInternalValue(value);\n }\n }, [value]);\n\n React.useEffect(() => {\n if (defaultValue != null) {\n setInternalValue(defaultValue);\n }\n }, [defaultValue]);\n\n const handleValueChange = (newValue: string) => {\n setInternalValue(newValue);\n onValueChange(newValue);\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 = (value, labelStyle, textStyle) => {
|
|
49
|
+
if (typeof value === "string") {
|
|
50
50
|
return /*#__PURE__*/React.createElement(_Text.default, {
|
|
51
51
|
style: [labelStyle, textStyle]
|
|
52
|
-
},
|
|
52
|
+
}, value);
|
|
53
53
|
} else {
|
|
54
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null,
|
|
54
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, value);
|
|
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,15 +77,10 @@ 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;
|
|
83
80
|
|
|
84
81
|
const handlePress = () => {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(realValue);
|
|
88
|
-
}
|
|
82
|
+
onPress(value);
|
|
83
|
+
onValueChange && onValueChange(value);
|
|
89
84
|
};
|
|
90
85
|
|
|
91
86
|
const {
|
|
@@ -109,10 +104,10 @@ const RadioButtonRow = _ref => {
|
|
|
109
104
|
}
|
|
110
105
|
}, /*#__PURE__*/React.createElement(_RadioButton.default, {
|
|
111
106
|
Icon: Icon,
|
|
112
|
-
selected:
|
|
113
|
-
value: realValue,
|
|
107
|
+
selected: selected || contextValue != null && contextValue === value,
|
|
114
108
|
color: color,
|
|
115
109
|
unselectedColor: unselectedColor,
|
|
110
|
+
onPress: handlePress,
|
|
116
111
|
style: radioButtonStyle
|
|
117
112
|
})));
|
|
118
113
|
};
|
|
@@ -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","value","labelStyle","textStyle","RadioButtonRow","Icon","label","color","unselectedColor","onPress","labelContainerStyle","radioButtonStyle","selected","disabled","style","rest","contextValue","onValueChange","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,MAf4D;AAChEC,IAAAA,IADgE;AAEhEC,IAAAA,KAFgE;AAGhEL,IAAAA,KAHgE;AAIhEM,IAAAA,KAJgE;AAKhEC,IAAAA,eALgE;AAMhEC,IAAAA,OAAO,GAAG,MAAM,CAAE,CAN8C;AAOhEC,IAAAA,mBAPgE;AAQhER,IAAAA,UARgE;AAShES,IAAAA,gBATgE;AAUhEhB,IAAAA,SA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AK,EAAEM,KALT;AAME,IAAA,eAAe,EAAEC,eANnB;AAOE,IAAA,OAAO,EAAEU,WAPX;AAQE,IAAA,KAAK,EAAEP;AART,IANF,CAjBF,CADF;AAqCD,CAlED;;AAoEA,MAAMU,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/B9B,EAAAA,KAAK,EAAE;AACLmB,IAAAA,IAAI,EAAE;AADD;AAfwB,CAAlB,CAAf;;eAoBerB,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 } 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 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 value: string | React.ReactNode,\n labelStyle: StyleProp<TextStyle>,\n textStyle: StyleProp<TextStyle>\n) => {\n if (typeof value === \"string\") {\n return <Text style={[labelStyle, textStyle]}>{value}</Text>;\n } else {\n return <>{value}</>;\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 handlePress = () => {\n onPress(value);\n onValueChange && onValueChange(value);\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={\n selected || (contextValue != null && contextValue === value)\n }\n color={color}\n unselectedColor={unselectedColor}\n onPress={handlePress}\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"]}
|
|
@@ -0,0 +1,103 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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","indexChangeH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,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"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|