@draftbit/core 43.2.6-c2ac06.0 → 43.3.3
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/DeprecatedFAB.js +20 -4
- package/lib/commonjs/components/DeprecatedFAB.js.map +1 -1
- package/lib/commonjs/components/Elevation.js +3 -14
- package/lib/commonjs/components/Elevation.js.map +1 -1
- package/lib/commonjs/components/Swiper/Swiper.js.map +1 -1
- package/lib/commonjs/components/ToggleButton.js +86 -0
- package/lib/commonjs/components/ToggleButton.js.map +1 -0
- package/lib/commonjs/index.js +8 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/mappings/ActionSheetItem.js.map +1 -1
- package/lib/commonjs/mappings/Card.js +1 -1
- package/lib/commonjs/mappings/Card.js.map +1 -1
- package/lib/commonjs/mappings/DeprecatedButton.js.map +1 -1
- package/lib/commonjs/mappings/ToggleButton.js +60 -0
- package/lib/commonjs/mappings/ToggleButton.js.map +1 -0
- package/lib/module/components/Portal/PortalHost.js.map +1 -1
- package/lib/module/components/Swiper/Swiper.js.map +1 -1
- package/lib/module/components/ToggleButton.js +67 -0
- package/lib/module/components/ToggleButton.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/mappings/Card.js +1 -1
- package/lib/module/mappings/Card.js.map +1 -1
- package/lib/module/mappings/ToggleButton.js +51 -0
- package/lib/module/mappings/ToggleButton.js.map +1 -0
- package/lib/typescript/src/components/ToggleButton.d.ts +24 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/mappings/ToggleButton.d.ts +124 -0
- package/package.json +3 -3
- package/src/components/ToggleButton.js +39 -0
- package/src/components/ToggleButton.tsx +94 -0
- package/src/index.js +1 -0
- package/src/index.tsx +1 -0
- package/src/mappings/Card.js +1 -1
- package/src/mappings/Card.ts +1 -1
- package/src/mappings/ToggleButton.js +50 -0
- package/src/mappings/ToggleButton.ts +62 -0
|
@@ -27,8 +27,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
27
27
|
|
|
28
28
|
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; }
|
|
29
29
|
|
|
30
|
-
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); }
|
|
31
|
-
|
|
32
30
|
const FAB = _ref => {
|
|
33
31
|
let {
|
|
34
32
|
Icon,
|
|
@@ -130,7 +128,7 @@ const FAB = _ref => {
|
|
|
130
128
|
style: [{
|
|
131
129
|
elevation
|
|
132
130
|
}, style]
|
|
133
|
-
}, /*#__PURE__*/React.createElement(_Touchable.default,
|
|
131
|
+
}, /*#__PURE__*/React.createElement(_Touchable.default, { ...rest,
|
|
134
132
|
onPress: onPress,
|
|
135
133
|
accessibilityState: {
|
|
136
134
|
disabled
|
|
@@ -138,7 +136,7 @@ const FAB = _ref => {
|
|
|
138
136
|
accessibilityRole: "button",
|
|
139
137
|
disabled: disabled || loading,
|
|
140
138
|
style: buttonStyles
|
|
141
|
-
}
|
|
139
|
+
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
142
140
|
style: styles.content
|
|
143
141
|
}, icon && loading !== true ? /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
144
142
|
style: iconStyle
|
|
@@ -181,5 +179,23 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
181
179
|
|
|
182
180
|
var _default = (0, _theming.withTheme)(FAB);
|
|
183
181
|
|
|
182
|
+
exports.default = _default;
|
|
183
|
+
//# sourceMappingURL=DeprecatedFAB.js.map },
|
|
184
|
+
icon: {
|
|
185
|
+
alignItems: "center",
|
|
186
|
+
justifyContent: "center",
|
|
187
|
+
width: _Config.default.buttonIconSize
|
|
188
|
+
},
|
|
189
|
+
fixed: {
|
|
190
|
+
left: 0,
|
|
191
|
+
right: 0,
|
|
192
|
+
bottom: 0,
|
|
193
|
+
height: 64,
|
|
194
|
+
borderRadius: 0
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
var _default = (0, _theming.withTheme)(FAB);
|
|
199
|
+
|
|
184
200
|
exports.default = _default;
|
|
185
201
|
//# sourceMappingURL=DeprecatedFAB.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DeprecatedFAB.tsx"],"names":["FAB","Icon","icon","disabled","type","loading","color","colorOverride","label","onPress","elevation","style","theme","colors","disabledOpacity","roundness","typography","rest","backgroundColor","borderColor","textColor","borderWidth","buttonColor","primary","surface","alpha","rgb","string","StyleSheet","hairlineWidth","buttonStyle","borderRadius","alignItems","justifyContent","buttonStyles","styles","button","contentStyle","content","textStyle","textAlign","iconStyle","width","Config","buttonIconSize","FABSize","height","FABBorderRadius","push","marginLeft","marginRight","margin","FABFixedHeight","alignSelf","create","borderStyle","flexDirection","fixed","left","right","bottom"],"mappings":";;;;;;;AAAA;;AACA;;AASA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAuDA,MAAMA,GAAoB,GAAG,QAavB;AAAA,MAbwB;AAC5BC,IAAAA,IAD4B;AAE5BC,IAAAA,IAF4B;AAG5BC,IAAAA,QAAQ,GAAG,KAHiB;AAI5BC,I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F,IArBN,CARF,CADF,CADF;AAoCD,CAvID;;AAyIA,MAAM2B,MAAM,GAAGP,wBAAW0B,MAAX,CAAkB;AAC/BlB,EAAAA,MAAM,EAAE;AACNmB,IAAAA,WAAW,EAAE;AADP,GADuB;AAI/BjB,EAAAA,OAAO,EAAE;AACPkB,IAAAA,aAAa,EAAE,KADR;AAEPxB,IAAAA,UAAU,EAAE,QAFL;AAGPC,IAAAA,cAAc,EAAE;AAHT,GAJsB;AAS/B/B,EAAAA,IAAI,EAAE;AACJ8B,IAAAA,UAAU,EAAE,QADR;AAEJC,IAAAA,cAAc,EAAE,QAFZ;AAGJS,IAAAA,KAAK,EAAEC,gBAAOC;AAHV,GATyB;AAc/Ba,EAAAA,KAAK,EAAE;AACLC,IAAAA,IAAI,EAAE,CADD;AAELC,IAAAA,KAAK,EAAE,CAFF;AAGLC,IAAAA,MAAM,EAAE,CAHH;AAILd,IAAAA,MAAM,EAAE,EAJH;AAKLf,IAAAA,YAAY,EAAE;AALT;AAdwB,CAAlB,CAAf;;eAuBe,wBAAU/B,GAAV,C","sourcesContent":["import * as React from \"react\";\nimport {\n ActivityIndicator,\n View,\n StyleSheet,\n TouchableHighlightProps,\n StyleProp,\n ViewStyle,\n TextStyle,\n} from \"react-native\";\nimport color from \"color\";\nimport Config from \"./Config\";\nimport Text from \"./Text\";\nimport Touchable from \"./Touchable\";\nimport Elevation from \"./Elevation\";\nimport { withTheme } from \"../theming\";\n\nimport type { Theme } from \"../styles/DefaultTheme\";\nimport type { IconSlot } from \"../interfaces/Icon\";\n\n/**\n * A floating action button represents the primary action in an application.\n *\n * <div class=\"screenshots\">\n * <img src=\"screenshots/fab-1.png\" />\n * <img src=\"screenshots/fab-2.png\" />\n * </div>\n *\n * ## Usage\n * ```js\n * import * as React from 'react';\n * import { StyleSheet } from 'react-native';\n * import { FAB } from '@draftbit/ui';\n *\n * const MyComponent = () => (\n * <FAB\n * style={styles.fab}\n * type=\"outline\"\n * icon=\"add\"\n * onPress={() => console.log('Pressed')}\n * />\n * );\n *\n * const styles = StyleSheet.create({\n * fab: {\n * position: 'absolute',\n * margin: 16,\n * right: 0,\n * bottom: 0,\n * },\n * })\n *\n * export default MyComponent;\n * ```\n */\n\ntype Props = {\n disabled?: boolean;\n type?: \"solid\" | \"extended\" | \"outline\" | \"fixed\" | \"standard\";\n loading?: boolean;\n icon?: string;\n color?: string;\n label?: string;\n onPress: () => void;\n elevation?: number;\n theme: Theme;\n style?: StyleProp<ViewStyle>;\n} & TouchableHighlightProps &\n IconSlot;\n\nconst FAB: React.FC<Props> = ({\n Icon,\n icon,\n disabled = false,\n type = \"solid\",\n loading = false,\n color: colorOverride,\n label,\n onPress,\n elevation = 0,\n style,\n theme: { colors, disabledOpacity, roundness, typography },\n ...rest\n}) => {\n let backgroundColor, borderColor, textColor, borderWidth;\n const buttonColor = colorOverride || colors.primary;\n\n if (type === \"standard\" || type === \"extended\" || type === \"fixed\") {\n backgroundColor = buttonColor;\n\n if (disabled) {\n textColor = color(colors.surface).alpha(disabledOpacity).rgb().string();\n } else {\n textColor = colors.surface;\n }\n } else {\n backgroundColor = \"transparent\";\n\n if (disabled) {\n textColor = color(buttonColor).alpha(disabledOpacity).rgb().string();\n } else {\n textColor = buttonColor;\n }\n }\n\n if (type === \"outline\") {\n if (disabled) {\n borderColor = color(buttonColor).alpha(disabledOpacity).rgb().string();\n } else {\n borderColor = buttonColor;\n }\n borderWidth = StyleSheet.hairlineWidth;\n } else {\n borderColor = \"transparent\";\n borderWidth = 0;\n }\n\n const buttonStyle: StyleProp<ViewStyle> = {\n backgroundColor,\n borderColor,\n borderWidth,\n borderRadius: roundness,\n alignItems: \"center\",\n justifyContent: \"center\",\n };\n\n const buttonStyles: StyleProp<ViewStyle>[] = [styles.button, buttonStyle];\n\n const contentStyle: StyleProp<ViewStyle>[] = [styles.content];\n\n const textStyle: StyleProp<TextStyle> = {\n textAlign: \"center\",\n color: textColor,\n };\n\n const iconStyle: StyleProp<ViewStyle>[] = [\n styles.icon,\n {\n width: Config.buttonIconSize,\n },\n ];\n\n if (type === \"standard\" || type === \"outline\") {\n buttonStyle.width = Config.FABSize;\n buttonStyle.height = Config.FABSize;\n buttonStyle.borderRadius = Config.FABBorderRadius;\n\n contentStyle.push({\n width: Config.FABSize,\n height: Config.FABSize,\n });\n }\n\n if (type === \"extended\" || type === \"fixed\") {\n iconStyle.push({\n marginLeft: 16,\n marginRight: -8,\n });\n\n textStyle.margin = 16;\n }\n\n if (type === \"fixed\") {\n buttonStyles.push({\n height: Config.FABFixedHeight,\n alignSelf: \"stretch\",\n });\n }\n\n return (\n <Elevation style={[{ elevation }, style]}>\n <Touchable\n {...rest}\n onPress={onPress}\n accessibilityState={{ disabled }}\n accessibilityRole=\"button\"\n disabled={disabled || loading}\n style={buttonStyles}\n >\n <View style={styles.content}>\n {icon && loading !== true ? (\n <View style={iconStyle}>\n <Icon\n name={icon}\n size={Config.buttonIconSize}\n color={textColor}\n />\n </View>\n ) : null}\n {loading ? (\n <ActivityIndicator\n size=\"small\"\n color={textColor}\n style={iconStyle}\n />\n ) : null}\n {label ? (\n <Text numberOfLines={1} style={[textStyle, typography.button]}>\n {label}\n </Text>\n ) : null}\n </View>\n </Touchable>\n </Elevation>\n );\n};\n\nconst styles = StyleSheet.create({\n button: {\n borderStyle: \"solid\",\n },\n content: {\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n icon: {\n alignItems: \"center\",\n justifyContent: \"center\",\n width: Config.buttonIconSize,\n },\n fixed: {\n left: 0,\n right: 0,\n bottom: 0,\n height: 64,\n borderRadius: 0,\n },\n});\n\nexport default withTheme(FAB);\n"]}
|
|
1
|
+
{"version":3,"sources":["DeprecatedFAB.js"],"names":["FAB","Icon","icon","disabled","type","loading","color","colorOverride","label","onPress","elevation","style","theme","colors","disabledOpacity","roundness","typography","rest","backgroundColor","borderColor","textColor","borderWidth","buttonColor","primary","surface","alpha","rgb","string","StyleSheet","hairlineWidth","buttonStyle","borderRadius","alignItems","justifyContent","buttonStyles","styles","button","contentStyle","content","textStyle","textAlign","iconStyle","width","Config","buttonIconSize","FABSize","height","FABBorderRadius","push","marginLeft","marginRight","margin","FABFixedHeight","alignSelf","React","createElement","Elevation","Touchable","accessibilityState","accessibilityRole","View","name","size","ActivityIndicator","Text","numberOfLines","create","borderStyle","flexDirection","fixed","left","right","bottom"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AACA,MAAMA,GAAG,GAAG,QAAuM;AAAA,MAAtM;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,IAAR;AAAcC,IAAAA,QAAQ,GAAG,KAAzB;AAAgCC,IAAAA,IAAI,GAAG,OAAvC;AAAgDC,IAAAA,OAAO,GAAG,KAA1D;AAAiEC,IAAAA,KAAK,EAAEC,aAAxE;AAAuFC,IAAAA,KAAvF;AAA8FC,IAAAA,OAA9F;AAAuGC,IAAAA,SAAS,GAAG,CAAnH;AAAsHC,IAAAA,KAAtH;AAA6HC,IAAAA,KAAK,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA,eAAV;AAA2BC,MAAAA,SAA3B;AAAsCC,MAAAA;AAAtC,KAApI;AAAwL,OAAGC;AAA3L,GAAsM;AAC/M,MAAIC,eAAJ,EAAqBC,WAArB,EAAkCC,SAAlC,EAA6CC,WAA7C;AACA,QAAMC,WAAW,GAAGf,aAAa,IAAIM,MAAM,CAACU,OAA5C;;AACA,MAAInB,IAAI,KAAK,UAAT,IAAuBA,IAAI,KAAK,UAAhC,IAA8CA,IAAI,KAAK,OAA3D,EAAoE;AAChEc,IAAAA,eAAe,GAAGI,WAAlB;;AACA,QAAInB,QAAJ,EAAc;AACViB,MAAAA,SAAS,GAAG,oBAAMP,MAAM,CAACW,OAAb,EAAsBC,KAAtB,CAA4BX,eAA5B,EAA6CY,GAA7C,GAAmDC,MAAnD,EAAZ;AACH,KAFD,MAGK;AACDP,MAAAA,SAAS,GAAGP,MAAM,CAACW,O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AAE,CADH;AAEHC,IAAAA,KAAK,EAAE,CAFJ;AAGHC,IAAAA,MAAM,EAAE,CAHL;AAIH1B,IAAAA,MAAM,EAAE,EAJL;AAKHf,IAAAA,YAAY,EAAE;AALX;AAdsB,CAAlB,CAAf;;eAsBe,wBAAU/B,GAAV,C","sourcesContent":["import * as React from \"react\";\nimport { ActivityIndicator, View, StyleSheet, } from \"react-native\";\nimport color from \"color\";\nimport Config from \"./Config\";\nimport Text from \"./Text\";\nimport Touchable from \"./Touchable\";\nimport Elevation from \"./Elevation\";\nimport { withTheme } from \"../theming\";\nconst FAB = ({ Icon, icon, disabled = false, type = \"solid\", loading = false, color: colorOverride, label, onPress, elevation = 0, style, theme: { colors, disabledOpacity, roundness, typography }, ...rest }) => {\n let backgroundColor, borderColor, textColor, borderWidth;\n const buttonColor = colorOverride || colors.primary;\n if (type === \"standard\" || type === \"extended\" || type === \"fixed\") {\n backgroundColor = buttonColor;\n if (disabled) {\n textColor = color(colors.surface).alpha(disabledOpacity).rgb().string();\n }\n else {\n textColor = colors.surface;\n }\n }\n else {\n backgroundColor = \"transparent\";\n if (disabled) {\n textColor = color(buttonColor).alpha(disabledOpacity).rgb().string();\n }\n else {\n textColor = buttonColor;\n }\n }\n if (type === \"outline\") {\n if (disabled) {\n borderColor = color(buttonColor).alpha(disabledOpacity).rgb().string();\n }\n else {\n borderColor = buttonColor;\n }\n borderWidth = StyleSheet.hairlineWidth;\n }\n else {\n borderColor = \"transparent\";\n borderWidth = 0;\n }\n const buttonStyle = {\n backgroundColor,\n borderColor,\n borderWidth,\n borderRadius: roundness,\n alignItems: \"center\",\n justifyContent: \"center\",\n };\n const buttonStyles = [styles.button, buttonStyle];\n const contentStyle = [styles.content];\n const textStyle = {\n textAlign: \"center\",\n color: textColor,\n };\n const iconStyle = [\n styles.icon,\n {\n width: Config.buttonIconSize,\n },\n ];\n if (type === \"standard\" || type === \"outline\") {\n buttonStyle.width = Config.FABSize;\n buttonStyle.height = Config.FABSize;\n buttonStyle.borderRadius = Config.FABBorderRadius;\n contentStyle.push({\n width: Config.FABSize,\n height: Config.FABSize,\n });\n }\n if (type === \"extended\" || type === \"fixed\") {\n iconStyle.push({\n marginLeft: 16,\n marginRight: -8,\n });\n textStyle.margin = 16;\n }\n if (type === \"fixed\") {\n buttonStyles.push({\n height: Config.FABFixedHeight,\n alignSelf: \"stretch\",\n });\n }\n return (React.createElement(Elevation, { style: [{ elevation }, style] },\n React.createElement(Touchable, { ...rest, onPress: onPress, accessibilityState: { disabled }, accessibilityRole: \"button\", disabled: disabled || loading, style: buttonStyles },\n React.createElement(View, { style: styles.content },\n icon && loading !== true ? (React.createElement(View, { style: iconStyle },\n React.createElement(Icon, { name: icon, size: Config.buttonIconSize, color: textColor }))) : null,\n loading ? (React.createElement(ActivityIndicator, { size: \"small\", color: textColor, style: iconStyle })) : null,\n label ? (React.createElement(Text, { numberOfLines: 1, style: [textStyle, typography.button] }, label)) : null))));\n};\nconst styles = StyleSheet.create({\n button: {\n borderStyle: \"solid\",\n },\n content: {\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n icon: {\n alignItems: \"center\",\n justifyContent: \"center\",\n width: Config.buttonIconSize,\n },\n fixed: {\n left: 0,\n right: 0,\n bottom: 0,\n height: 64,\n borderRadius: 0,\n },\n});\nexport default withTheme(FAB);\n"]}
|
|
@@ -19,6 +19,8 @@ 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
|
+
|
|
22
24
|
/* directly copied from https://github.com/callstack/react-native-paper/blob/main/src/components/Surface.tsx#L62 */
|
|
23
25
|
const Elevation = _ref => {
|
|
24
26
|
let {
|
|
@@ -35,24 +37,11 @@ const Elevation = _ref => {
|
|
|
35
37
|
colors
|
|
36
38
|
} = theme;
|
|
37
39
|
const borderRadius = radius;
|
|
38
|
-
return /*#__PURE__*/React.createElement(_reactNative.Animated.View, {
|
|
40
|
+
return /*#__PURE__*/React.createElement(_reactNative.Animated.View, _extends({}, rest, {
|
|
39
41
|
style: [{
|
|
40
42
|
borderRadius,
|
|
41
43
|
backgroundColor: colors.surface
|
|
42
44
|
}, 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]
|
|
56
45
|
}), /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
57
46
|
style: {
|
|
58
47
|
overflow: "hidden",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Elevation.
|
|
1
|
+
{"version":3,"sources":["Elevation.tsx"],"names":["Elevation","style","theme","children","rest","elevation","borderRadius","radius","StyleSheet","flatten","colors","backgroundColor","surface","overflow"],"mappings":";;;;;;;AAAA;;AACA;;AAQA;;AACA;;;;;;;;;;AAQA;AACA,MAAMA,SAA0B,GAAG,QAAyC;AAAA,MAAxC;AAAEC,IAAAA,KAAF;AAASC,IAAAA,KAAT;AAAgBC,IAAAA,QAAhB;AAA0B,OAAGC;AAA7B,GAAwC;AAC1E,QAAM;AAAEC,IAAAA,SAAS,GAAG,CAAd;AAAiBC,IAAAA,YAAY,EAAEC;AAA/B,MACJC,wBAAWC,OAAX,CAAmBR,KAAnB,KAA6B,EAD/B;AAEA,QAAM;AAAES,IAAAA;AAAF,MAAaR,KAAnB;AACA,QAAMI,YAAY,GAAGC,MAArB;AAEA,sBACE,oBAAC,qBAAD,CAAU,IAAV,eACMH,IADN;AAEE,IAAA,KAAK,EAAE,CACL;AACEE,MAAAA,YADF;AAEEK,MAAAA,eAAe,EAAED,MAAM,CAACE;AAF1B,KADK,EAKLP,SAAS,GAAG,qBAAOA,SAAP,CAAH,GAAuB,IAL3B,EAMLJ,KANK;AAFT,mBAWE,oBAAC,iBAAD;AAAM,IAAA,KAAK,EAAE;AAAEY,MAAAA,QAAQ,EAAE,QAAZ;AAAsBP,MAAAA;AAAtB;AAAb,KAAoDH,QAApD,CAXF,CADF;AAeD,CArBD;;eAuBe,wBAAUH,SAAV,C","sourcesContent":["import * as React from \"react\";\nimport {\n Animated,\n StyleSheet,\n ViewProps,\n StyleProp,\n ViewStyle,\n View,\n} from \"react-native\";\nimport shadow from \"../styles/shadow\";\nimport { withTheme } from \"../theming\";\nimport type { Theme } from \"../styles/DefaultTheme\";\n\ntype Props = {\n style?: StyleProp<ViewStyle>;\n theme: Theme;\n} & ViewProps;\n\n/* directly copied from https://github.com/callstack/react-native-paper/blob/main/src/components/Surface.tsx#L62 */\nconst Elevation: React.FC<Props> = ({ style, theme, children, ...rest }) => {\n const { elevation = 4, borderRadius: radius } =\n StyleSheet.flatten(style) || {};\n const { colors } = theme;\n const borderRadius = radius;\n\n return (\n <Animated.View\n {...rest}\n style={[\n {\n borderRadius,\n backgroundColor: colors.surface,\n },\n elevation ? shadow(elevation) : null,\n style,\n ]}\n >\n <View style={{ overflow: \"hidden\", borderRadius }}>{children}</View>\n </Animated.View>\n );\n};\n\nexport default withTheme(Elevation);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Swiper.
|
|
1
|
+
{"version":3,"sources":["Swiper.js"],"names":["Swiper","vertical","loop","timeout","from","prevTitle","nextTitle","dotsTouchable","children","style","React","createElement","View","SwiperComponent","controlsProps"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;AACA,MAAMA,MAAM,GAAG;AAAA,MAAC;AAAEC,IAAAA,QAAQ,GAAG,KAAb;AAAoBC,IAAAA,IAAI,GAAG,KAA3B;AAAkCC,IAAAA,OAAO,GAAG,CAA5C;AAA+CC,IAAAA,IAAI,GAAG,CAAtD;AAAyDC,IAAAA,SAAS,GAAG,EAArE;AAAyEC,IAAAA,SAAS,GAAG,EAArF;AAAyFC,IAAAA,aAAa,GAAG,IAAzG;AAA+GC,IAAAA,QAA/G;AAAyHC,IAAAA;AAAzH,GAAD;AAAA,sBAAwIC,eAAMC,aAAN,CAAoBC,iBAApB,EAA0B;AAAEH,IAAAA,KAAK,EAAEA;AAAT,GAA1B,eACnJC,eAAMC,aAAN,CAAoBE,6BAApB,EAAqC;AAAET,IAAAA,IAAI,EAAEA,IAAR;AAAcF,IAAAA,IAAI,EAAEA,IAApB;AAA0BC,IAAAA,OAAO,EAAEA,OAAnC;AAA4CF,IAAAA,QAAQ,EAAEA,QAAtD;AAAgEa,IAAAA,aAAa,EAAE;AAC5GT,MAAAA,SAD4G;AAE5GC,MAAAA,SAF4G;AAG5GC,MAAAA;AAH4G;AAA/E,GAArC,EAISC,QAJT,CADmJ,CAAxI;AAAA,CAAf;;eAMeR,M","sourcesContent":["import React from \"react\";\nimport { View } from \"react-native\";\nimport SwiperComponent from \"react-native-web-swiper\";\nconst Swiper = ({ vertical = false, loop = false, timeout = 0, from = 0, prevTitle = \"\", nextTitle = \"\", dotsTouchable = true, children, style, }) => (React.createElement(View, { style: style },\n React.createElement(SwiperComponent, { from: from, loop: loop, timeout: timeout, vertical: vertical, controlsProps: {\n prevTitle,\n nextTitle,\n dotsTouchable,\n } }, children)));\nexport default Swiper;\n"]}
|
|
@@ -0,0 +1,86 @@
|
|
|
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 _theming = require("../theming");
|
|
11
|
+
|
|
12
|
+
var _reactNative = require("react-native");
|
|
13
|
+
|
|
14
|
+
var _IconButton = _interopRequireDefault(require("./IconButton"));
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
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); }
|
|
19
|
+
|
|
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
|
+
|
|
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
|
+
const ToggleButton = _ref => {
|
|
25
|
+
let {
|
|
26
|
+
Icon,
|
|
27
|
+
icon,
|
|
28
|
+
toggled = false,
|
|
29
|
+
onPress = () => {},
|
|
30
|
+
defaultValue,
|
|
31
|
+
disabled = false,
|
|
32
|
+
color = "primary",
|
|
33
|
+
colorSecondary = "surface",
|
|
34
|
+
borderColor = "divider",
|
|
35
|
+
iconSize = 25,
|
|
36
|
+
width = 50,
|
|
37
|
+
height = 50,
|
|
38
|
+
theme: {
|
|
39
|
+
colors
|
|
40
|
+
},
|
|
41
|
+
style,
|
|
42
|
+
...rest
|
|
43
|
+
} = _ref;
|
|
44
|
+
const [internalValue, setInternalValue] = React.useState(toggled || defaultValue || false);
|
|
45
|
+
React.useEffect(() => {
|
|
46
|
+
if (toggled != null) {
|
|
47
|
+
setInternalValue(toggled);
|
|
48
|
+
}
|
|
49
|
+
}, [toggled]);
|
|
50
|
+
React.useEffect(() => {
|
|
51
|
+
if (defaultValue != null) {
|
|
52
|
+
setInternalValue(defaultValue);
|
|
53
|
+
}
|
|
54
|
+
}, [defaultValue]);
|
|
55
|
+
|
|
56
|
+
const handlePress = () => {
|
|
57
|
+
setInternalValue(!internalValue);
|
|
58
|
+
onPress(!internalValue);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return /*#__PURE__*/React.createElement(_IconButton.default, _extends({
|
|
62
|
+
Icon: Icon,
|
|
63
|
+
icon: icon,
|
|
64
|
+
size: iconSize,
|
|
65
|
+
color: internalValue ? colors[color] : colors[colorSecondary],
|
|
66
|
+
onPress: handlePress,
|
|
67
|
+
disabled: disabled,
|
|
68
|
+
style: [styles.mainContainer, {
|
|
69
|
+
width,
|
|
70
|
+
height,
|
|
71
|
+
backgroundColor: internalValue ? colors[colorSecondary] : colors[color],
|
|
72
|
+
borderColor: colors[borderColor]
|
|
73
|
+
}, style]
|
|
74
|
+
}, rest));
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const styles = _reactNative.StyleSheet.create({
|
|
78
|
+
mainContainer: {
|
|
79
|
+
borderWidth: 1
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
var _default = (0, _theming.withTheme)(ToggleButton);
|
|
84
|
+
|
|
85
|
+
exports.default = _default;
|
|
86
|
+
//# sourceMappingURL=ToggleButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ToggleButton.tsx"],"names":["ToggleButton","Icon","icon","toggled","onPress","defaultValue","disabled","color","colorSecondary","borderColor","iconSize","width","height","theme","colors","style","rest","internalValue","setInternalValue","React","useState","useEffect","handlePress","styles","mainContainer","backgroundColor","StyleSheet","create","borderWidth"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;;;;;AAoBA,MAAMA,YAA6B,GAAG,QAgBhC;AAAA,MAhBiC;AACrCC,IAAAA,IADqC;AAErCC,IAAAA,IAFqC;AAGrCC,IAAAA,OAAO,GAAG,KAH2B;AAIrCC,IAAAA,OAAO,GAAG,MAAM,CAAE,CAJmB;AAKrCC,IAAAA,YALqC;AAMrCC,IAAAA,QAAQ,GAAG,KAN0B;AAOrCC,IAAAA,KAAK,GAAG,SAP6B;AAQrCC,IAAAA,cAAc,GAAG,SARoB;AASrCC,IAAAA,WAAW,GAAG,SATuB;AAUrCC,IAAAA,QAAQ,GAAG,EAV0B;AAWrCC,IAAAA,KAAK,GAAG,EAX6B;AAYrCC,IAAAA,MAAM,GAAG,EAZ4B;AAarCC,IAAAA,KAAK,EAAE;AAAEC,MAAAA;AAAF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A+DA,MAAMO,MAAM,GAAGG,wBAAWC,MAAX,CAAkB;AAC/BH,EAAAA,aAAa,EAAE;AACbI,IAAAA,WAAW,EAAE;AADA;AADgB,CAAlB,CAAf;;eAMe,wBAAU5B,YAAV,C","sourcesContent":["import * as React from \"react\";\nimport { withTheme } from \"../theming\";\nimport { colorTypes } from \"@draftbit/types\";\nimport { StyleProp, StyleSheet, ViewStyle } from \"react-native\";\nimport IconButton from \"./IconButton\";\nimport type { Theme } from \"../styles/DefaultTheme\";\nimport type { IconSlot } from \"../interfaces/Icon\";\n\ntype Props = {\n icon: string;\n toggled?: boolean;\n onPress?: (value: boolean) => void;\n defaultValue?: boolean;\n disabled?: boolean;\n color?: colorTypes;\n colorSecondary?: colorTypes;\n borderColor?: colorTypes;\n iconSize?: number;\n width?: number;\n height?: number;\n style?: StyleProp<ViewStyle>;\n theme: Theme;\n} & IconSlot;\n\nconst ToggleButton: React.FC<Props> = ({\n Icon,\n icon,\n toggled = false,\n onPress = () => {},\n defaultValue,\n disabled = false,\n color = \"primary\",\n colorSecondary = \"surface\",\n borderColor = \"divider\",\n iconSize = 25,\n width = 50,\n height = 50,\n theme: { colors },\n style,\n ...rest\n}) => {\n const [internalValue, setInternalValue] = React.useState<boolean>(\n toggled || defaultValue || false\n );\n\n React.useEffect(() => {\n if (toggled != null) {\n setInternalValue(toggled);\n }\n }, [toggled]);\n\n React.useEffect(() => {\n if (defaultValue != null) {\n setInternalValue(defaultValue);\n }\n }, [defaultValue]);\n\n const handlePress = () => {\n setInternalValue(!internalValue);\n onPress(!internalValue);\n };\n\n return (\n <IconButton\n Icon={Icon}\n icon={icon}\n size={iconSize}\n color={internalValue ? colors[color] : colors[colorSecondary]}\n onPress={handlePress}\n disabled={disabled}\n style={[\n styles.mainContainer,\n {\n width,\n height,\n backgroundColor: internalValue\n ? colors[colorSecondary]\n : colors[color],\n borderColor: colors[borderColor],\n },\n style,\n ]}\n {...rest}\n />\n );\n};\n\nconst styles = StyleSheet.create({\n mainContainer: {\n borderWidth: 1,\n },\n});\n\nexport default withTheme(ToggleButton);\n"]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -369,6 +369,12 @@ Object.defineProperty(exports, "ThemeProvider", {
|
|
|
369
369
|
return _theming.ThemeProvider;
|
|
370
370
|
}
|
|
371
371
|
});
|
|
372
|
+
Object.defineProperty(exports, "ToggleButton", {
|
|
373
|
+
enumerable: true,
|
|
374
|
+
get: function () {
|
|
375
|
+
return _ToggleButton.default;
|
|
376
|
+
}
|
|
377
|
+
});
|
|
372
378
|
Object.defineProperty(exports, "Touchable", {
|
|
373
379
|
enumerable: true,
|
|
374
380
|
get: function () {
|
|
@@ -440,6 +446,8 @@ var _Switch = _interopRequireWildcard(require("./components/Switch"));
|
|
|
440
446
|
|
|
441
447
|
var _TextField = _interopRequireDefault(require("./components/TextField"));
|
|
442
448
|
|
|
449
|
+
var _ToggleButton = _interopRequireDefault(require("./components/ToggleButton"));
|
|
450
|
+
|
|
443
451
|
var _Touchable = _interopRequireDefault(require("./components/Touchable"));
|
|
444
452
|
|
|
445
453
|
var _Accordion = require("./components/Accordion");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAEA;;AASA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["export { injectIcon } from \"./interfaces/Icon\";\nexport { withTheme, ThemeProvider } from \"./theming\";\nexport { default as Provider } from \"./Provider\";\nexport { default as DefaultTheme } from \"./styles/DefaultTheme\";\n\nexport { Link } from \"./components/Text\";\nexport { ButtonSolid, ButtonOutline } from \"./components/Button\";\nexport { default as Avatar } from \"./components/CircleImage\";\nexport { default as AvatarEdit } from \"./components/AvatarEdit\";\nexport { default as Card } from \"./components/Card\";\nexport { default as Carousel } from \"./components/Carousel\";\nexport { Checkbox, CheckboxGroup, CheckboxRow } from \"./components/Checkbox\";\nexport { default as CircleImage } from \"./components/CircleImage\";\nexport { default as Container } from \"./components/Container\";\nexport { default as Divider } from \"./components/Divider\";\nexport { default as FAB } from \"./components/FAB\";\nexport { default as FieldSearchBarFull } from \"./components/FieldSearchBarFull\";\nexport { default as IconButton } from \"./components/IconButton\";\nexport { default as Image } from \"./components/Image\";\nexport { default as NumberInput } from \"./components/NumberInput\";\nexport { default as ScreenContainer } from \"./components/ScreenContainer\";\nexport { default as StarRating } from \"./components/StarRating\";\nexport { default as Surface } from \"./components/Surface\";\nexport { default as Switch, SwitchRow } from \"./components/Switch\";\nexport { default as TextField } from \"./components/TextField\";\nexport { default as ToggleButton } from \"./components/ToggleButton\";\nexport { default as Touchable } from \"./components/Touchable\";\nexport { AccordionGroup, AccordionItem } from \"./components/Accordion\";\nexport {\n ActionSheet,\n ActionSheetItem,\n ActionSheetCancel,\n} from \"./components/ActionSheet\";\nexport { Swiper, SwiperItem } from \"./components/Swiper\";\n\nexport {\n Center,\n Circle,\n Square,\n Row,\n Stack,\n Spacer,\n} from \"./components/Layout\";\n\nexport {\n RadioButton,\n RadioButtonGroup,\n RadioButtonRow,\n RadioButtonFieldGroup,\n} from \"./components/RadioButton/index\";\n\n/* Deprecated: Fix or Delete! */\nexport { default as Button } from \"./components/DeprecatedButton\";\nexport { default as CardBlock } from \"./components/CardBlock\";\nexport { default as CardContainer } from \"./components/CardContainer\";\nexport { default as CardContainerRating } from \"./components/CardContainerRating\";\nexport { default as CardInline } from \"./components/CardInline\";\nexport { default as DatePicker } from \"./components/DatePicker/DatePicker\";\nexport { default as HeaderLarge } from \"./components/HeaderLarge\";\nexport { default as HeaderMedium } from \"./components/HeaderMedium\";\nexport { default as HeaderOverline } from \"./components/HeaderOverline\";\nexport { default as Picker } from \"./components/Picker/Picker\";\nexport { default as ProgressBar } from \"./components/ProgressBar\";\nexport { default as ProgressCircle } from \"./components/ProgressCircle\";\nexport { default as RowBodyIcon } from \"./components/RowBodyIcon\";\nexport { default as RowHeadlineImageCaption } from \"./components/RowHeadlineImageCaption\";\nexport { default as RowHeadlineImageIcon } from \"./components/RowHeadlineImageIcon\";\nexport { default as Slider } from \"./components/Slider\";\nexport { default as Stepper } from \"./components/Stepper\";\nexport { useAuthState } from \"./components/useAuthState\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ActionSheetItem.
|
|
1
|
+
{"version":3,"sources":["ActionSheetItem.js"],"names":["SEED_DATA","name","tag","description","category","COMPONENT_TYPES","button","triggers","Triggers","OnPress","layout","textAlign","props","onPress","label","group","GROUPS","basic","defaultValue","color"],"mappings":";;;;;;;AAAA;;AACO,MAAMA,SAAS,GAAG;AACrBC,EAAAA,IAAI,EAAE,mBADe;AAErBC,EAAAA,GAAG,EAAE,iBAFgB;AAGrBC,EAAAA,WAAW,EAAE,mBAHQ;AAIrBC,EAAAA,QAAQ,EAAEC,uBAAgBC,MAJL;AAKrBC,EAAAA,QAAQ,EAAE,CAACC,gBAASC,OAAV,CALW;AAMrBC,EAAAA,MAAM,EAAE;AACJC,IAAAA,SAAS,EAAE;AADP,GANa;AASrBC,EAAAA,KAAK,EAAE;AACHC,IAAAA,OAAO,EAAE,8BADN;AAEHC,IAAAA,KAAK,EAAE,2BAAe;AAClBC,MAAAA,KAAK,EAAEC,cAAOC,KADI;AAElBH,MAAAA,KAAK,EAAE,OAFW;AAGlBI,MAAAA,YAAY,EAAE;AAHI,KAAf,CAFJ;AAOHC,IAAAA,KAAK,EAAE,4BAAgB;AACnBL,MAAAA,KAAK,EAAE;AADY,KAAhB;AAPJ;AATc,CAAlB","sourcesContent":["import { COMPONENT_TYPES, createActionProp, createColorProp, createTextProp, GROUPS, Triggers, } from \"@draftbit/types\";\nexport const SEED_DATA = {\n name: \"Action Sheet Item\",\n tag: \"ActionSheetItem\",\n description: \"Action Sheet item\",\n category: COMPONENT_TYPES.button,\n triggers: [Triggers.OnPress],\n layout: {\n textAlign: \"center\",\n },\n props: {\n onPress: createActionProp(),\n label: createTextProp({\n group: GROUPS.basic,\n label: \"Label\",\n defaultValue: \"Option\",\n }),\n color: createColorProp({\n label: \"Font Color\",\n }),\n },\n};\n"]}
|
|
@@ -11,7 +11,7 @@ const SEED_DATA = {
|
|
|
11
11
|
name: "Card",
|
|
12
12
|
tag: "Card",
|
|
13
13
|
description: "A card you can customize however you'd like",
|
|
14
|
-
category: _types.COMPONENT_TYPES.
|
|
14
|
+
category: _types.COMPONENT_TYPES.card,
|
|
15
15
|
triggers: [_types.Triggers.OnPress, _types.Triggers.OnPressIcon],
|
|
16
16
|
props: {
|
|
17
17
|
onPress: (0, _types.createActionProp)(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Card.ts"],"names":["SEED_DATA","name","tag","description","category","COMPONENT_TYPES","
|
|
1
|
+
{"version":3,"sources":["Card.ts"],"names":["SEED_DATA","name","tag","description","category","COMPONENT_TYPES","card","triggers","Triggers","OnPress","OnPressIcon","props","onPress","onPressIcon","handlerPropName","elevation","image","title","label","defaultValue","titleStyle","subtitle","subtitleStyle","descriptionStyle","icon","aspectRatio","textCentered"],"mappings":";;;;;;;AAAA;;AAaO,MAAMA,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,MADiB;AAEvBC,EAAAA,GAAG,EAAE,MAFkB;AAGvBC,EAAAA,WAAW,EAAE,6CAHU;AAIvBC,EAAAA,QAAQ,EAAEC,uBAAgBC,IAJH;AAKvBC,EAAAA,QAAQ,EAAE,CAACC,gBAASC,OAAV,EAAmBD,gBAASE,WAA5B,CALa;AAMvBC,EAAAA,KAAK,EAAE;AACLC,IAAAA,OAAO,EAAE,8BADJ;AAELC,IAAAA,WAAW,EAAE,6BAAiB;AAC5BC,MAAAA,eAAe,EAAE;AADW,KAAjB,CAFR;AAKLC,IAAAA,SAAS,EAAE,gCAAoB,CAApB,CALN;AAMLC,IAAAA,KAAK,EAAE,6BANF;AAOLC,IAAAA,KAAK,EAAE,2BAAe;AACpBC,MAAAA,KAAK,EAAE,OADa;AAEpBf,MAAAA,WAAW,EAAE,kBAFO;AAGpB;AACAgB,MAAAA,YAAY,EAAE;AAJM,KAAf,CAPF;AAaLC,IAAAA,UAAU,EAAE,4BAAgB;AAC1BF,MAAAA,KAAK,EAAE;AADmB,KAAhB,CAbP;AAgBLG,IAAAA,QAAQ,EAAE,2BAAe;AACvBH,MAAAA,KAAK,EAAE,UADgB;AAEvBf,MAAAA,WAAW,EAAE,2BAFU;AAGvBgB,MAAAA,YAAY,EAAE,IAHS,CAIvB;;AAJuB,KAAf,CAhBL;AAsBLG,IAAAA,aAAa,EAAE,4BAAgB;AAC7BJ,MAAAA,KAAK,EAAE;AADsB,KAAhB,CAtBV;AAyBLf,IAAAA,WAAW,EAAE,2BAAe;AAC1Be,MAAAA,KAAK,EAAE,aADmB;AAE1Bf,MAAAA,WAAW,EAAE,mCAFa;AAG1B;AACA;AACAgB,MAAAA,YAAY,EAAE;AALY,KAAf,CAzBR;AAgCLI,IAAAA,gBAAgB,EAAE,4BAAgB;AAChCL,MAAAA,KAAK,EAAE;AADyB,KAAhB,CAhCb;AAmCLM,IAAAA,IAAI,EAAE,4BAnCD;AAoCLC,IAAAA,WAAW,EAAE,kCAAsB;AACjCN,MAAAA,YAAY,EAAE;AADmB,KAAtB,CApCR;AAuCLO,IAAAA,YAAY,EAAE,iCAAqB;AACjCR,MAAAA,KAAK,EAAE,eAD0B;AAEjCf,MAAAA,WAAW,EAAE;AAFoB,KAArB;AAvCT;AANgB,CAAlB","sourcesContent":["import {\n COMPONENT_TYPES,\n createElevationType,\n createTextProp,\n createImageProp,\n createIconProp,\n createAspectRatioProp,\n createStaticBoolProp,\n createTextStyle,\n createActionProp,\n Triggers,\n} from \"@draftbit/types\";\n\nexport const SEED_DATA = {\n name: \"Card\",\n tag: \"Card\",\n description: \"A card you can customize however you'd like\",\n category: COMPONENT_TYPES.card,\n triggers: [Triggers.OnPress, Triggers.OnPressIcon],\n props: {\n onPress: createActionProp(),\n onPressIcon: createActionProp({\n handlerPropName: \"onPressIcon\",\n }),\n elevation: createElevationType(3),\n image: createImageProp(),\n title: createTextProp({\n label: \"Title\",\n description: \"Large title text\",\n // defaultValue: \"Title\",\n defaultValue: null,\n }),\n titleStyle: createTextStyle({\n label: \"Title Style\",\n }),\n subtitle: createTextProp({\n label: \"Subtitle\",\n description: \"Text underneath the title\",\n defaultValue: null,\n // defaultValue: \"Edit me in the props panel on the right\",\n }),\n subtitleStyle: createTextStyle({\n label: \"Subtitle Style\",\n }),\n description: createTextProp({\n label: \"Description\",\n description: \"Smallest text underneath subtitle\",\n // defaultValue:\n // \"This bottom text is optional, but shows up to make your life a little easier!\",\n defaultValue: null,\n }),\n descriptionStyle: createTextStyle({\n label: \"Description Style\",\n }),\n icon: createIconProp(),\n aspectRatio: createAspectRatioProp({\n defaultValue: 1.5,\n }),\n textCentered: createStaticBoolProp({\n label: \"Centered Text\",\n description: \"Places your title and subtitle in the center\",\n }),\n },\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DeprecatedButton.
|
|
1
|
+
{"version":3,"sources":["DeprecatedButton.js"],"names":["SEED_DATA_PROPS","onPress","icon","group","GROUPS","basic","label","description","editable","required","formType","FORM_TYPES","propType","PROP_TYPES","STRING","defaultValue","children","data","string","color","THEME","labelColor","disabled","boolean","BOOLEAN","loading","SEED_DATA","name","tag","category","COMPONENT_TYPES","deprecated","triggers","Triggers","OnPress","props","type","uncategorized","layout"],"mappings":";;;;;;;AAAA;;AACA,MAAMA,eAAe,GAAG;AACpBC,EAAAA,OAAO,EAAE,8BADW;AAEpBC,EAAAA,IAAI,EAAE;AACFC,IAAAA,KAAK,EAAEC,cAAOC,KADZ;AAEFC,IAAAA,KAAK,EAAE,WAFL;AAGFC,IAAAA,WAAW,EAAE,kBAHX;AAIFC,IAAAA,QAAQ,EAAE,IAJR;AAKFC,IAAAA,QAAQ,EAAE,IALR;AAMFC,IAAAA,QAAQ,EAAEC,kBAAWT,IANnB;AAOFU,IAAAA,QAAQ,EAAEC,kBAAWC,MAPnB;AAQFC,IAAAA,YAAY,EAAE;AARZ,GAFc;AAYpBC,EAAAA,QAAQ,EAAE;AACNb,IAAAA,KAAK,EAAEC,cAAOa,IADR;AAENX,IAAAA,KAAK,EAAE,OAFD;AAGNC,IAAAA,WAAW,EAAE,cAHP;AAINE,IAAAA,QAAQ,EAAE,IAJJ;AAKND,IAAAA,QAAQ,EAAE,IALJ;AAMNE,IAAAA,QAAQ,EAAEC,kBAAWO,MANf;AAONN,IAAAA,QAAQ,EAAEC,kBAAWC,MAPf;AAQNC,IAAAA,YAAY,EAAE;AARR,GAZU;AAsBpBI,EAAAA,KAAK,EAAE;AACHhB,IAAAA,KAAK,EAAEC,cAAOC,KADX;AAEHC,IAAAA,KAAK,EAAE,gBAFJ;AAGHC,IAAAA,WAAW,EAAE,6CA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\"@draftbit/types\";\nconst SEED_DATA_PROPS = {\n onPress: createActionProp(),\n icon: {\n group: GROUPS.basic,\n label: \"Icon Name\",\n description: \"Name of the icon\",\n editable: true,\n required: true,\n formType: FORM_TYPES.icon,\n propType: PROP_TYPES.STRING,\n defaultValue: null,\n },\n children: {\n group: GROUPS.data,\n label: \"Label\",\n description: \"Button label\",\n required: true,\n editable: true,\n formType: FORM_TYPES.string,\n propType: PROP_TYPES.STRING,\n defaultValue: \"Get Started\",\n },\n color: {\n group: GROUPS.basic,\n label: \"Color Override\",\n description: \"Override the background color of the button\",\n editable: true,\n required: false,\n formType: FORM_TYPES.color,\n propType: PROP_TYPES.THEME,\n defaultValue: null,\n },\n labelColor: {\n group: GROUPS.basic,\n label: \"Label Color Override\",\n description: \"Override the label color of the button\",\n editable: true,\n required: false,\n formType: FORM_TYPES.color,\n propType: PROP_TYPES.THEME,\n defaultValue: null,\n },\n disabled: {\n group: GROUPS.basic,\n label: \"Disabled\",\n description: \"Whether the button should be disabled\",\n editable: true,\n required: false,\n formType: FORM_TYPES.boolean,\n propType: PROP_TYPES.BOOLEAN,\n defaultValue: null,\n },\n loading: {\n group: GROUPS.data,\n label: \"Loading\",\n description: \"Whether to show a loading indicator\",\n editable: true,\n required: false,\n formType: FORM_TYPES.boolean,\n propType: PROP_TYPES.BOOLEAN,\n defaultValue: null,\n },\n};\nexport const SEED_DATA = [\n {\n name: \"Button Outline\",\n tag: \"Button\",\n category: COMPONENT_TYPES.deprecated,\n triggers: [Triggers.OnPress],\n props: {\n ...SEED_DATA_PROPS,\n type: {\n group: GROUPS.uncategorized,\n label: \"Type\",\n description: \"Button type\",\n editable: false,\n required: true,\n formType: FORM_TYPES.string,\n propType: PROP_TYPES.STRING,\n defaultValue: \"outline\",\n },\n },\n layout: {},\n },\n {\n name: \"Button Solid\",\n tag: \"Button\",\n category: COMPONENT_TYPES.deprecated,\n triggers: [Triggers.OnPress],\n props: {\n ...SEED_DATA_PROPS,\n type: {\n group: GROUPS.uncategorized,\n label: \"Type\",\n description: \"Button type\",\n editable: false,\n required: true,\n formType: FORM_TYPES.string,\n propType: PROP_TYPES.STRING,\n defaultValue: \"solid\",\n },\n },\n layout: {},\n },\n];\n"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SEED_DATA = void 0;
|
|
7
|
+
|
|
8
|
+
var _types = require("@draftbit/types");
|
|
9
|
+
|
|
10
|
+
const SEED_DATA = {
|
|
11
|
+
name: "Toggle Button",
|
|
12
|
+
tag: "ToggleButton",
|
|
13
|
+
category: _types.COMPONENT_TYPES.deprecated,
|
|
14
|
+
layout: {},
|
|
15
|
+
triggers: [_types.Triggers.OnPress],
|
|
16
|
+
props: {
|
|
17
|
+
onPress: (0, _types.createActionProp)(),
|
|
18
|
+
icon: (0, _types.createIconProp)({
|
|
19
|
+
required: true
|
|
20
|
+
}),
|
|
21
|
+
iconSize: (0, _types.createIconSizeProp)(),
|
|
22
|
+
fieldName: (0, _types.createFieldNameProp)({
|
|
23
|
+
defaultValue: false,
|
|
24
|
+
valuePropName: "toggled"
|
|
25
|
+
}),
|
|
26
|
+
disabled: (0, _types.createBoolProp)({
|
|
27
|
+
label: "Disabled",
|
|
28
|
+
description: "Whether the button should be disabled",
|
|
29
|
+
group: _types.GROUPS.basic
|
|
30
|
+
}),
|
|
31
|
+
color: (0, _types.createColorProp)({
|
|
32
|
+
group: _types.GROUPS.basic
|
|
33
|
+
}),
|
|
34
|
+
colorSecondary: (0, _types.createColorProp)({
|
|
35
|
+
label: "Secondary Color",
|
|
36
|
+
group: _types.GROUPS.basic
|
|
37
|
+
}),
|
|
38
|
+
borderColor: (0, _types.createColorProp)({
|
|
39
|
+
label: "Border Color",
|
|
40
|
+
group: _types.GROUPS.basic
|
|
41
|
+
}),
|
|
42
|
+
width: (0, _types.createStaticNumberProp)({
|
|
43
|
+
label: "Width",
|
|
44
|
+
description: "Width",
|
|
45
|
+
defaultValue: 50
|
|
46
|
+
}),
|
|
47
|
+
height: (0, _types.createStaticNumberProp)({
|
|
48
|
+
label: "Height",
|
|
49
|
+
description: "Height",
|
|
50
|
+
defaultValue: 50
|
|
51
|
+
}),
|
|
52
|
+
toggled: (0, _types.createBoolProp)({
|
|
53
|
+
label: "Toggled",
|
|
54
|
+
description: "Whether the button should show the toggled state",
|
|
55
|
+
defaultValue: false
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
exports.SEED_DATA = SEED_DATA;
|
|
60
|
+
//# sourceMappingURL=ToggleButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ToggleButton.ts"],"names":["SEED_DATA","name","tag","category","COMPONENT_TYPES","deprecated","layout","triggers","Triggers","OnPress","props","onPress","icon","required","iconSize","fieldName","defaultValue","valuePropName","disabled","label","description","group","GROUPS","basic","color","colorSecondary","borderColor","width","height","toggled"],"mappings":";;;;;;;AAAA;;AAaO,MAAMA,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,eADiB;AAEvBC,EAAAA,GAAG,EAAE,cAFkB;AAGvBC,EAAAA,QAAQ,EAAEC,uBAAgBC,UAHH;AAIvBC,EAAAA,MAAM,EAAE,EAJe;AAKvBC,EAAAA,QAAQ,EAAE,CAACC,gBAASC,OAAV,CALa;AAMvBC,EAAAA,KAAK,EAAE;AACLC,IAAAA,OAAO,EAAE,8BADJ;AAELC,IAAAA,IAAI,EAAE,2BAAe;AACnBC,MAAAA,QAAQ,EAAE;AADS,KAAf,CAFD;AAKLC,IAAAA,QAAQ,EAAE,gCALL;AAMLC,IAAAA,SAAS,EAAE,gCAAoB;AAC7BC,MAAAA,YAAY,EAAE,KADe;AAE7BC,MAAAA,aAAa,EAAE;AAFc,KAApB,CANN;AAULC,IAAAA,QAAQ,EAAE,2BAAe;AACvBC,MAAAA,KAAK,EAAE,UADgB;AAEvBC,MAAAA,WAAW,EAAE,uCAFU;AAGvBC,MAAAA,KAAK,EAAEC,cAAOC;AAHS,KAAf,CAVL;AAeLC,IAAAA,KAAK,EAAE,4BAAgB;AACrBH,MAAAA,KAAK,EAAEC,cAAOC;AADO,KAAhB,CAfF;AAkBLE,IAAAA,cAAc,EAAE,4BAAgB;AAC9BN,MAAAA,KAAK,EAAE,iBADuB;AAE9BE,MAAAA,KAAK,EAAEC,cAAOC;AAFgB,KAAhB,CAlBX;AAsBLG,IAAAA,WAAW,EAAE,4BAAgB;AAC3BP,MAAAA,KAAK,EAAE,cADoB;AAE3BE,MAAAA,KAAK,EAAEC,cAAOC;AAFa,KAAhB,CAtBR;AA0BLI,IAAAA,KAAK,EAAE,mCAAuB;AAC5BR,MAAAA,KAAK,EAAE,OADqB;AAE5BC,MAAAA,WAAW,EAAE,OAFe;AAG5BJ,MAAAA,YAAY,EAAE;AAHc,KAAvB,CA1BF;AA+BLY,IAAAA,MAAM,EAAE,mCAAuB;AAC7BT,MAAAA,KAAK,EAAE,QADsB;AAE7BC,MAAAA,WAAW,EAAE,QAFgB;AAG7BJ,MAAAA,YAAY,EAAE;AAHe,KAAvB,CA/BH;AAoCLa,IAAAA,OAAO,EAAE,2BAAe;AACtBV,MAAAA,KAAK,EAAE,SADe;AAEtBC,MAAAA,WAAW,EAAE,kDAFS;AAGtBJ,MAAAA,YAAY,EAAE;AAHQ,KAAf;AApCJ;AANgB,CAAlB","sourcesContent":["import {\n GROUPS,\n COMPONENT_TYPES,\n createIconProp,\n createBoolProp,\n createColorProp,\n createStaticNumberProp,\n createFieldNameProp,\n createIconSizeProp,\n createActionProp,\n Triggers,\n} from \"@draftbit/types\";\n\nexport const SEED_DATA = {\n name: \"Toggle Button\",\n tag: \"ToggleButton\",\n category: COMPONENT_TYPES.deprecated,\n layout: {},\n triggers: [Triggers.OnPress],\n props: {\n onPress: createActionProp(),\n icon: createIconProp({\n required: true,\n }),\n iconSize: createIconSizeProp(),\n fieldName: createFieldNameProp({\n defaultValue: false,\n valuePropName: \"toggled\",\n }),\n disabled: createBoolProp({\n label: \"Disabled\",\n description: \"Whether the button should be disabled\",\n group: GROUPS.basic,\n }),\n color: createColorProp({\n group: GROUPS.basic,\n }),\n colorSecondary: createColorProp({\n label: \"Secondary Color\",\n group: GROUPS.basic,\n }),\n borderColor: createColorProp({\n label: \"Border Color\",\n group: GROUPS.basic,\n }),\n width: createStaticNumberProp({\n label: \"Width\",\n description: \"Width\",\n defaultValue: 50,\n }),\n height: createStaticNumberProp({\n label: \"Height\",\n description: \"Height\",\n defaultValue: 50,\n }),\n toggled: createBoolProp({\n label: \"Toggled\",\n description: \"Whether the button should show the toggled state\",\n defaultValue: false,\n }),\n },\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["PortalHost.
|
|
1
|
+
{"version":3,"sources":["PortalHost.js"],"names":["React","View","StyleSheet","PortalManager","PortalContext","createContext","PortalHost","Component","manager","children","key","nextKey","mount","queue","push","type","update","op","index","findIndex","o","unmount","componentDidMount","length","action","pop","render","createElement","Provider","value","style","styles","container","collapsable","pointerEvents","props","ref","setManager","create","flex"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,IAAT,EAAeC,UAAf,QAAiC,cAAjC;AACA,OAAOC,aAAP,MAA0B,iBAA1B;AACA,OAAO,MAAMC,aAAa,gBAAGJ,KAAK,CAACK,aAAN,CAAoB,IAApB,CAAtB;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,MAAMC,UAAN,SAAyBN,KAAK,CAACO,SAA/B,CAAyC;AAAA;AAAA;;AAAA,wCAsBtCC,OAAD,IAAa;AACtB,WAAKA,OAAL,GAAeA,OAAf;AACH,KAxBmD;;AAAA,mCAyB3CC,QAAD,IAAc;AAClB,YAAMC,GA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gBAAnC/B,U,iBACI,a;;AAuEzB,MAAMyB,MAAM,GAAG7B,UAAU,CAACoC,MAAX,CAAkB;AAC7BN,EAAAA,SAAS,EAAE;AACPO,IAAAA,IAAI,EAAE;AADC;AADkB,CAAlB,CAAf","sourcesContent":["import * as React from \"react\";\nimport { View, StyleSheet } from \"react-native\";\nimport PortalManager from \"./PortalManager\";\nexport const PortalContext = React.createContext(null);\n/**\n * Portal host renders all of its children `Portal` elements.\n * For example, you can wrap a screen in `Portal.Host` to render items above the screen.\n * If you're using the `Provider` component, it already includes `Portal.Host`.\n *\n * ## Usage\n * ```js\n * import * as React from 'react';\n * import { Text } from 'react-native';\n * import { Portal } from 'react-native-paper';\n *\n * export default class MyComponent extends React.Component {\n * render() {\n * return (\n * <Portal.Host>\n * <Text>Content of the app</Text>\n * </Portal.Host>\n * );\n * }\n * }\n * ```\n *\n * Here any `Portal` elements under `<App />` are rendered alongside `<App />` and will appear above `<App />` like a `Modal`.\n */\nexport default class PortalHost extends React.Component {\n static displayName = \"Portal.Host\";\n componentDidMount() {\n const manager = this.manager;\n const queue = this.queue;\n while (queue.length && manager) {\n const action = queue.pop();\n if (action) {\n switch (action.type) {\n case \"mount\":\n manager.mount(action.key, action.children);\n break;\n case \"update\":\n manager.update(action.key, action.children);\n break;\n case \"unmount\":\n manager.unmount(action.key);\n break;\n }\n }\n }\n }\n setManager = (manager) => {\n this.manager = manager;\n };\n mount = (children) => {\n const key = this.nextKey++;\n if (this.manager) {\n this.manager.mount(key, children);\n }\n else {\n this.queue.push({ type: \"mount\", key, children });\n }\n return key;\n };\n update = (key, children) => {\n if (this.manager) {\n this.manager.update(key, children);\n }\n else {\n const op = { type: \"mount\", key, children };\n const index = this.queue.findIndex((o) => o.type === \"mount\" || (o.type === \"update\" && o.key === key));\n if (index > -1) {\n // @ts-ignore\n this.queue[index] = op;\n }\n else {\n this.queue.push(op);\n }\n }\n };\n unmount = (key) => {\n if (this.manager) {\n this.manager.unmount(key);\n }\n else {\n this.queue.push({ type: \"unmount\", key });\n }\n };\n nextKey = 0;\n queue = [];\n manager;\n render() {\n return (React.createElement(PortalContext.Provider, { value: {\n mount: this.mount,\n update: this.update,\n unmount: this.unmount,\n } },\n React.createElement(View, { style: styles.container, collapsable: false, pointerEvents: \"box-none\" }, this.props.children),\n React.createElement(PortalManager, { ref: this.setManager })));\n }\n}\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Swiper.
|
|
1
|
+
{"version":3,"sources":["Swiper.tsx"],"names":["React","View","SwiperComponent","Swiper","vertical","loop","timeout","from","prevTitle","nextTitle","dotsTouchable","children","style"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,IAAT,QAA2C,cAA3C;AACA,OAAOC,eAAP,MAA4B,yBAA5B;;AAcA,MAAMC,MAAM,GAAG;AAAA,MAAC;AACdC,IAAAA,QAAQ,GAAG,KADG;AAEdC,IAAAA,IAAI,GAAG,KAFO;AAGdC,IAAAA,OAAO,GAAG,CAHI;AAIdC,IAAAA,IAAI,GAAG,CAJO;AAKdC,IAAAA,SAAS,GAAG,EALE;AAMdC,IAAAA,SAAS,GAAG,EANE;AAOdC,IAAAA,aAAa,GAAG,IAPF;AAQdC,IAAAA,QARc;AASdC,IAAAA;AATc,GAAD;AAAA,sBAWb,oBAAC,IAAD;AAAM,IAAA,KAAK,EAAEA;AAAb,kBACE,oBAAC,eAAD;AACE,IAAA,IAAI,EAAEL,IADR;AAEE,IAAA,IAAI,EAAEF,IAFR;AAGE,IAAA,OAAO,EAAEC,OAHX;AAIE,IAAA,QAAQ,EAAEF,QAJZ;AAKE,IAAA,aAAa,EAAE;AACbI,MAAAA,SADa;AAEbC,MAAAA,SAFa;AAGbC,MAAAA;AAHa;AALjB,KAWGC,QAXH,CADF,CAXa;AAAA,CAAf;;AA4BA,eAAeR,MAAf","sourcesContent":["import React from \"react\";\nimport { View, StyleProp, ViewStyle } from \"react-native\";\nimport SwiperComponent from \"react-native-web-swiper\";\n\nexport interface SwiperProps {\n vertical?: boolean;\n loop?: boolean;\n from?: number;\n timeout?: number;\n prevTitle?: string;\n nextTitle?: string;\n dotsTouchable?: boolean;\n children: React.ReactNode;\n style?: StyleProp<ViewStyle>;\n}\n\nconst Swiper = ({\n vertical = false,\n loop = false,\n timeout = 0,\n from = 0,\n prevTitle = \"\",\n nextTitle = \"\",\n dotsTouchable = true,\n children,\n style,\n}: SwiperProps) => (\n <View style={style}>\n <SwiperComponent\n from={from}\n loop={loop}\n timeout={timeout}\n vertical={vertical}\n controlsProps={{\n prevTitle,\n nextTitle,\n dotsTouchable,\n }}\n >\n {children}\n </SwiperComponent>\n </View>\n);\n\nexport default Swiper;\n"]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { withTheme } from "../theming";
|
|
5
|
+
import { StyleSheet } from "react-native";
|
|
6
|
+
import IconButton from "./IconButton";
|
|
7
|
+
|
|
8
|
+
const ToggleButton = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
Icon,
|
|
11
|
+
icon,
|
|
12
|
+
toggled = false,
|
|
13
|
+
onPress = () => {},
|
|
14
|
+
defaultValue,
|
|
15
|
+
disabled = false,
|
|
16
|
+
color = "primary",
|
|
17
|
+
colorSecondary = "surface",
|
|
18
|
+
borderColor = "divider",
|
|
19
|
+
iconSize = 25,
|
|
20
|
+
width = 50,
|
|
21
|
+
height = 50,
|
|
22
|
+
theme: {
|
|
23
|
+
colors
|
|
24
|
+
},
|
|
25
|
+
style,
|
|
26
|
+
...rest
|
|
27
|
+
} = _ref;
|
|
28
|
+
const [internalValue, setInternalValue] = React.useState(toggled || defaultValue || false);
|
|
29
|
+
React.useEffect(() => {
|
|
30
|
+
if (toggled != null) {
|
|
31
|
+
setInternalValue(toggled);
|
|
32
|
+
}
|
|
33
|
+
}, [toggled]);
|
|
34
|
+
React.useEffect(() => {
|
|
35
|
+
if (defaultValue != null) {
|
|
36
|
+
setInternalValue(defaultValue);
|
|
37
|
+
}
|
|
38
|
+
}, [defaultValue]);
|
|
39
|
+
|
|
40
|
+
const handlePress = () => {
|
|
41
|
+
setInternalValue(!internalValue);
|
|
42
|
+
onPress(!internalValue);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return /*#__PURE__*/React.createElement(IconButton, _extends({
|
|
46
|
+
Icon: Icon,
|
|
47
|
+
icon: icon,
|
|
48
|
+
size: iconSize,
|
|
49
|
+
color: internalValue ? colors[color] : colors[colorSecondary],
|
|
50
|
+
onPress: handlePress,
|
|
51
|
+
disabled: disabled,
|
|
52
|
+
style: [styles.mainContainer, {
|
|
53
|
+
width,
|
|
54
|
+
height,
|
|
55
|
+
backgroundColor: internalValue ? colors[colorSecondary] : colors[color],
|
|
56
|
+
borderColor: colors[borderColor]
|
|
57
|
+
}, style]
|
|
58
|
+
}, rest));
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const styles = StyleSheet.create({
|
|
62
|
+
mainContainer: {
|
|
63
|
+
borderWidth: 1
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
export default withTheme(ToggleButton);
|
|
67
|
+
//# sourceMappingURL=ToggleButton.js.map
|