@draftbit/core 43.3.0 → 43.3.4-a9cc72.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/Divider.js +3 -13
- package/lib/commonjs/components/Divider.js.map +1 -1
- package/lib/commonjs/components/Stepper.js +28 -19
- package/lib/commonjs/components/Stepper.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/ActionSheet.js.map +1 -1
- package/lib/commonjs/mappings/RadioButtonRow.js.map +1 -1
- package/lib/commonjs/mappings/Stepper.js +9 -0
- package/lib/commonjs/mappings/Stepper.js.map +1 -1
- package/lib/commonjs/mappings/ToggleButton.js +60 -0
- package/lib/commonjs/mappings/ToggleButton.js.map +1 -0
- package/lib/commonjs/mappings/Touchable.js.map +1 -1
- package/lib/commonjs/mappings/Video.js.map +1 -1
- package/lib/commonjs/mappings/WebView.js.map +1 -1
- package/lib/module/components/Picker/PickerComponent.android.js +10 -7
- package/lib/module/components/Picker/PickerComponent.android.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButtonFieldGroup.js +4 -5
- package/lib/module/components/RadioButton/RadioButtonFieldGroup.js.map +1 -1
- package/lib/module/components/Stepper.js +27 -19
- package/lib/module/components/Stepper.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/MapMarker.js.map +1 -1
- package/lib/module/mappings/Stepper.js +10 -1
- package/lib/module/mappings/Stepper.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/Stepper.d.ts +2 -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/Stepper.d.ts +22 -0
- package/lib/typescript/src/mappings/ToggleButton.d.ts +124 -0
- package/package.json +3 -3
- package/src/components/Stepper.js +23 -21
- package/src/components/Stepper.tsx +27 -19
- 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/Stepper.js +10 -1
- package/src/mappings/Stepper.ts +10 -0
- package/src/mappings/ToggleButton.js +50 -0
- package/src/mappings/ToggleButton.ts +62 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["RadioButtonFieldGroup.
|
|
1
|
+
{"version":3,"sources":["RadioButtonFieldGroup.js"],"names":["React","View","Text","withTheme","RadioButtonGroup","RadioButtonFieldGroup","label","children","theme","labelStyle","style","rest","createElement","fontSize","typography","headline4","color"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,IAAT,QAAqB,cAArB;AACA,OAAOC,IAAP,MAAiB,SAAjB;AACA,SAASC,SAAT,QAA0B,eAA1B;AACA,OAAOC,gBAAP,MAA6B,oBAA7B;;AACA,MAAMC,qBAAqB,GAAG,QAA4D;AAAA,MAA3D;AAAEC,IAAAA,KAAF;AAASC,IAAAA,QAAT;AAAmBC,IAAAA,KAAnB;AAA0BC,IAAAA,UAA1B;AAAsCC,IAAAA,KAAtC;AAA6C,OAAGC;AAAhD,GAA2D;AACtF,sBAAQX,KAAK,CAACY,aAAN,CAAoBX,IAApB,EAA0B;AAAES,IAAAA,KAAK,EAAEA;AAAT,GAA1B,eACJV,KAAK,CAACY,aAAN,CAAoBV,IAApB,EAA0B;AAAEQ,IAAAA,KAAK,EAAE,CAC3B;AACIG,MAAAA,QAAQ,EAAEL,KAAK,CAACM,UAAN,CAAiBC,SAAjB,CAA2BF,QADzC;AAEIG,MAAAA,KAAK,EAAER,KAAK,CAACM,UAAN,CAAiBC,SAAjB,CAA2BC;AAFtC,KAD2B,EAK3BP,UAL2B;AAAT,GAA1B,EAMSH,KANT,CADI,eAQJN,KAAK,CAACY,aAAN,CAAoBR,gBAApB,EAAsC;AAAEI,IAAAA,KAAK,EAAEA,KAAT;AAAgB,OAAGG;AAAnB,GAAtC,EAAiEJ,QAAjE,CARI,CAAR;AASH,CAVD;;AAWA,eAAeJ,SAAS,CAACE,qBAAD,CAAxB","sourcesContent":["import React from \"react\";\nimport { View } from \"react-native\";\nimport Text from \"../Text\";\nimport { withTheme } from \"../../theming\";\nimport RadioButtonGroup from \"./RadioButtonGroup\";\nconst RadioButtonFieldGroup = ({ label, children, theme, labelStyle, style, ...rest }) => {\n return (React.createElement(View, { style: style },\n React.createElement(Text, { style: [\n {\n fontSize: theme.typography.headline4.fontSize,\n color: theme.typography.headline4.color,\n },\n labelStyle,\n ] }, label),\n React.createElement(RadioButtonGroup, { theme: theme, ...rest }, children)));\n};\nexport default withTheme(RadioButtonFieldGroup);\n"]}
|
|
@@ -2,11 +2,14 @@ import * as React from "react";
|
|
|
2
2
|
import { View, Text } from "react-native";
|
|
3
3
|
import { withTheme } from "../theming";
|
|
4
4
|
import IconButton from "./IconButton";
|
|
5
|
+
import isNumber from "lodash.isnumber";
|
|
5
6
|
|
|
6
7
|
const Stepper = _ref => {
|
|
7
8
|
let {
|
|
8
9
|
Icon,
|
|
9
10
|
value,
|
|
11
|
+
min,
|
|
12
|
+
max,
|
|
10
13
|
style,
|
|
11
14
|
onChange,
|
|
12
15
|
defaultValue,
|
|
@@ -22,32 +25,37 @@ const Stepper = _ref => {
|
|
|
22
25
|
} = _ref;
|
|
23
26
|
const [stateValue, setStateValue] = React.useState(value || defaultValue || 0);
|
|
24
27
|
React.useEffect(() => {
|
|
25
|
-
if (value
|
|
26
|
-
|
|
28
|
+
if (value || value === 0) {
|
|
29
|
+
onChange && onChange(stateValue);
|
|
27
30
|
}
|
|
28
|
-
}, [value]);
|
|
31
|
+
}, [onChange, stateValue, value]);
|
|
29
32
|
React.useEffect(() => {
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
let newValue = value || defaultValue || 0;
|
|
34
|
+
|
|
35
|
+
if (isNumber(max) && newValue > max) {
|
|
36
|
+
newValue = max;
|
|
32
37
|
}
|
|
33
|
-
}, [defaultValue]);
|
|
34
38
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
onChange && onChange(value - 1);
|
|
38
|
-
} else {
|
|
39
|
-
setStateValue(stateValue - 1);
|
|
39
|
+
if (isNumber(min) && newValue < min) {
|
|
40
|
+
newValue = min;
|
|
40
41
|
}
|
|
41
|
-
};
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
setStateValue(newValue);
|
|
44
|
+
}, [defaultValue, value, min, max]);
|
|
45
|
+
const handleMinus = React.useCallback(() => {
|
|
46
|
+
if (isNumber(min) && value === min) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
setStateValue(stateValue - 1);
|
|
51
|
+
}, [min, stateValue, value]);
|
|
52
|
+
const handlePlus = React.useCallback(() => {
|
|
53
|
+
if (isNumber(max) && value === max) {
|
|
54
|
+
return;
|
|
48
55
|
}
|
|
49
|
-
};
|
|
50
56
|
|
|
57
|
+
setStateValue(stateValue + 1);
|
|
58
|
+
}, [max, stateValue, value]);
|
|
51
59
|
return /*#__PURE__*/React.createElement(View, {
|
|
52
60
|
style: [{
|
|
53
61
|
flexDirection: "row"
|
|
@@ -60,7 +68,7 @@ const Stepper = _ref => {
|
|
|
60
68
|
onPress: handleMinus,
|
|
61
69
|
size: iconSize,
|
|
62
70
|
color: iconColor,
|
|
63
|
-
disabled:
|
|
71
|
+
disabled: stateValue === 0
|
|
64
72
|
}), /*#__PURE__*/React.createElement(Text, {
|
|
65
73
|
style: [typography.body1, {
|
|
66
74
|
textAlign: "center",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Stepper.tsx"],"names":["React","View","Text","withTheme","IconButton","Stepper","Icon","value","style","onChange","defaultValue","theme","colors","typography","roundness","iconSize","iconColor","strong","borderRadius","typeStyle","stateValue","setStateValue","useState","useEffect","handleMinus","handlePlus","flexDirection","body1","textAlign","alignSelf","color","medium","marginHorizontal"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,IAAT,EAAeC,IAAf,QAA4D,cAA5D;AACA,SAASC,SAAT,QAA0B,YAA1B;AAIA,OAAOC,UAAP,MAAuB,cAAvB;;
|
|
1
|
+
{"version":3,"sources":["Stepper.tsx"],"names":["React","View","Text","withTheme","IconButton","isNumber","Stepper","Icon","value","min","max","style","onChange","defaultValue","theme","colors","typography","roundness","iconSize","iconColor","strong","borderRadius","typeStyle","stateValue","setStateValue","useState","useEffect","newValue","handleMinus","useCallback","handlePlus","flexDirection","body1","textAlign","alignSelf","color","medium","marginHorizontal"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,IAAT,EAAeC,IAAf,QAA4D,cAA5D;AACA,SAASC,SAAT,QAA0B,YAA1B;AAIA,OAAOC,UAAP,MAAuB,cAAvB;AACA,OAAOC,QAAP,MAAqB,iBAArB;;AAgBA,MAAMC,OAAwB,GAAG,QAa3B;AAAA,MAb4B;AAChCC,IAAAA,IADgC;AAEhCC,IAAAA,KAFgC;AAGhCC,IAAAA,GAHgC;AAIhCC,IAAAA,GAJgC;AAKhCC,IAAAA,KALgC;AAMhCC,IAAAA,QANgC;AAOhCC,IAAAA,YAPgC;AAQhCC,IAAAA,KAAK,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA,UAAV;AAAsBC,MAAAA;AAAtB,KARyB;AAShCC,IAAAA,QAAQ,GAAG,EATqB;AAUhCC,IAAAA,SAAS,GAAGJ,MAAM,CAACK,MAVa;AAWhCC,IAAAA,YAAY,GAAGJ,SAXiB;AAYhCK,IAAAA;AAZgC,GAa5B;AACJ,QAAM,CAACC,UAA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U,GAAG,CAAd,CAAb;AACD,GALkB,EAKhB,CAACb,GAAD,EAAMa,UAAN,EAAkBf,KAAlB,CALgB,CAAnB;AAOA,sBACE,oBAAC,IAAD;AACE,IAAA,KAAK,EAAE,CACL;AAAEuB,MAAAA,aAAa,EAAE;AAAjB,KADK,EAELpB,KAFK,EAGLU,YAAY,GAAG;AAAEA,MAAAA;AAAF,KAAH,GAAsB,EAH7B;AADT,kBAOE,oBAAC,UAAD;AACE,IAAA,IAAI,EAAEd,IADR;AAEE,IAAA,IAAI,EAAC,sBAFP;AAGE,IAAA,OAAO,EAAEqB,WAHX;AAIE,IAAA,IAAI,EAAEV,QAJR;AAKE,IAAA,KAAK,EAAEC,SALT;AAME,IAAA,QAAQ,EAAEI,UAAU,KAAK;AAN3B,IAPF,eAeE,oBAAC,IAAD;AACE,IAAA,KAAK,EAAE,CACLP,UAAU,CAACgB,KADN,EAEL;AACEC,MAAAA,SAAS,EAAE,QADb;AAEEC,MAAAA,SAAS,EAAE,QAFb;AAGEC,MAAAA,KAAK,EAAEpB,MAAM,CAACqB,MAHhB;AAIEC,MAAAA,gBAAgB,EAAE;AAJpB,KAFK,EAQLf,SARK;AADT,KAYGd,KAAK,IAAIe,UAZZ,CAfF,eA6BE,oBAAC,UAAD;AACE,IAAA,IAAI,EAAEhB,IADR;AAEE,IAAA,IAAI,EAAC,mBAFP;AAGE,IAAA,OAAO,EAAEuB,UAHX;AAIE,IAAA,IAAI,EAAEZ,QAJR;AAKE,IAAA,KAAK,EAAEC;AALT,IA7BF,CADF;AAuCD,CAxFD;;AA0FA,eAAehB,SAAS,CAACG,OAAD,CAAxB","sourcesContent":["import * as React from \"react\";\nimport { View, Text, StyleProp, ViewStyle, TextStyle } from \"react-native\";\nimport { withTheme } from \"../theming\";\nimport type { Theme } from \"../styles/DefaultTheme\";\nimport type { IconSlot } from \"../interfaces/Icon\";\n\nimport IconButton from \"./IconButton\";\nimport isNumber from \"lodash.isnumber\";\n\ntype Props = {\n value?: number;\n min?: number;\n max?: number;\n theme: Theme;\n style?: StyleProp<ViewStyle>;\n onChange?: (value: number) => void;\n defaultValue?: number;\n iconSize?: number;\n iconColor?: string;\n borderRadius?: number;\n typeStyle?: StyleProp<TextStyle>;\n} & IconSlot;\n\nconst Stepper: React.FC<Props> = ({\n Icon,\n value,\n min,\n max,\n style,\n onChange,\n defaultValue,\n theme: { colors, typography, roundness },\n iconSize = 24,\n iconColor = colors.strong,\n borderRadius = roundness,\n typeStyle,\n}) => {\n const [stateValue, setStateValue] = React.useState(\n value || defaultValue || 0\n );\n\n React.useEffect(() => {\n if (value || value === 0) {\n onChange && onChange(stateValue);\n }\n }, [onChange, stateValue, value]);\n\n React.useEffect(() => {\n let newValue = value || defaultValue || 0;\n if (isNumber(max) && newValue > max) {\n newValue = max;\n }\n if (isNumber(min) && newValue < min) {\n newValue = min;\n }\n setStateValue(newValue);\n }, [defaultValue, value, min, max]);\n\n const handleMinus = React.useCallback(() => {\n if (isNumber(min) && value === min) {\n return;\n }\n setStateValue(stateValue - 1);\n }, [min, stateValue, value]);\n\n const handlePlus = React.useCallback(() => {\n if (isNumber(max) && value === max) {\n return;\n }\n setStateValue(stateValue + 1);\n }, [max, stateValue, value]);\n\n return (\n <View\n style={[\n { flexDirection: \"row\" },\n style,\n borderRadius ? { borderRadius } : {},\n ]}\n >\n <IconButton\n Icon={Icon}\n icon=\"MaterialIcons/remove\"\n onPress={handleMinus}\n size={iconSize}\n color={iconColor}\n disabled={stateValue === 0}\n />\n <Text\n style={[\n typography.body1,\n {\n textAlign: \"center\",\n alignSelf: \"center\",\n color: colors.medium,\n marginHorizontal: 8,\n },\n typeStyle,\n ]}\n >\n {value || stateValue}\n </Text>\n <IconButton\n Icon={Icon}\n icon=\"MaterialIcons/add\"\n onPress={handlePlus}\n size={iconSize}\n color={iconColor}\n />\n </View>\n );\n};\n\nexport default withTheme(Stepper);\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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ToggleButton.tsx"],"names":["React","withTheme","StyleSheet","IconButton","ToggleButton","Icon","icon","toggled","onPress","defaultValue","disabled","color","colorSecondary","borderColor","iconSize","width","height","theme","colors","style","rest","internalValue","setInternalValue","useState","useEffect","handlePress","styles","mainContainer","backgroundColor","create","borderWidth"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,SAAT,QAA0B,YAA1B;AAEA,SAAoBC,UAApB,QAAiD,cAAjD;AACA,OAAOC,UAAP,MAAuB,cAAvB;;AAoBA,MAAMC,YAA6B,GAAG,QAgBhC;AAAA,MAhBiC;AACrCC,IAAAA,IADqC;AAErCC,IAAAA,IAFqC;AAGrCC,IAAAA,OAAO,GAAG,KAH2B;AAIrCC,IAAAA,OAAO,GAAG,MAAM,CAAE,CAJmB;AAKrCC,IAAAA,YALqC;AAMrCC,IAAAA,QAAQ,GAAG,KAN0B;AAOrCC,IAAAA,KAAK,GAAG,SAP6B;AAQrCC,IAAAA,cAAc,GAAG,SARoB;AASrCC,IAAAA,WAAW,GAAG,SATuB;AAUrCC,IAAAA,QAAQ,GAAG,EAV0B;AAWrCC,IAAAA,KAAK,GAAG,EAX6B;AAYrCC,IAAAA,MAAM,GAAG,EAZ4B;AAarCC,IAAAA,KAA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AnBN,EADF;AAuBD,CA7DD;;AA+DA,MAAMM,MAAM,GAAGxB,UAAU,CAAC2B,MAAX,CAAkB;AAC/BF,EAAAA,aAAa,EAAE;AACbG,IAAAA,WAAW,EAAE;AADA;AADgB,CAAlB,CAAf;AAMA,eAAe7B,SAAS,CAACG,YAAD,CAAxB","sourcesContent":["import * as React from \"react\";\nimport { withTheme } from \"../theming\";\nimport { colorTypes } from \"@draftbit/types\";\nimport { StyleProp, StyleSheet, ViewStyle } from \"react-native\";\nimport IconButton from \"./IconButton\";\nimport type { Theme } from \"../styles/DefaultTheme\";\nimport type { IconSlot } from \"../interfaces/Icon\";\n\ntype Props = {\n icon: string;\n toggled?: boolean;\n onPress?: (value: boolean) => void;\n defaultValue?: boolean;\n disabled?: boolean;\n color?: colorTypes;\n colorSecondary?: colorTypes;\n borderColor?: colorTypes;\n iconSize?: number;\n width?: number;\n height?: number;\n style?: StyleProp<ViewStyle>;\n theme: Theme;\n} & IconSlot;\n\nconst ToggleButton: React.FC<Props> = ({\n Icon,\n icon,\n toggled = false,\n onPress = () => {},\n defaultValue,\n disabled = false,\n color = \"primary\",\n colorSecondary = \"surface\",\n borderColor = \"divider\",\n iconSize = 25,\n width = 50,\n height = 50,\n theme: { colors },\n style,\n ...rest\n}) => {\n const [internalValue, setInternalValue] = React.useState<boolean>(\n toggled || defaultValue || false\n );\n\n React.useEffect(() => {\n if (toggled != null) {\n setInternalValue(toggled);\n }\n }, [toggled]);\n\n React.useEffect(() => {\n if (defaultValue != null) {\n setInternalValue(defaultValue);\n }\n }, [defaultValue]);\n\n const handlePress = () => {\n setInternalValue(!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/module/index.js
CHANGED
|
@@ -22,6 +22,7 @@ export { default as StarRating } from "./components/StarRating";
|
|
|
22
22
|
export { default as Surface } from "./components/Surface";
|
|
23
23
|
export { default as Switch, SwitchRow } from "./components/Switch";
|
|
24
24
|
export { default as TextField } from "./components/TextField";
|
|
25
|
+
export { default as ToggleButton } from "./components/ToggleButton";
|
|
25
26
|
export { default as Touchable } from "./components/Touchable";
|
|
26
27
|
export { AccordionGroup, AccordionItem } from "./components/Accordion";
|
|
27
28
|
export { ActionSheet, ActionSheetItem, ActionSheetCancel } from "./components/ActionSheet";
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["injectIcon","withTheme","ThemeProvider","default","Provider","DefaultTheme","Link","ButtonSolid","ButtonOutline","Avatar","AvatarEdit","Card","Carousel","Checkbox","CheckboxGroup","CheckboxRow","CircleImage","Container","Divider","FAB","FieldSearchBarFull","IconButton","Image","NumberInput","ScreenContainer","StarRating","Surface","Switch","SwitchRow","TextField","Touchable","AccordionGroup","AccordionItem","ActionSheet","ActionSheetItem","ActionSheetCancel","Swiper","SwiperItem","Center","Circle","Square","Row","Stack","Spacer","RadioButton","RadioButtonGroup","RadioButtonRow","RadioButtonFieldGroup","Button","CardBlock","CardContainer","CardContainerRating","CardInline","DatePicker","HeaderLarge","HeaderMedium","HeaderOverline","Picker","ProgressBar","ProgressCircle","RowBodyIcon","RowHeadlineImageCaption","RowHeadlineImageIcon","Slider","Stepper","useAuthState"],"mappings":"AAAA,SAASA,UAAT,QAA2B,mBAA3B;AACA,SAASC,SAAT,EAAoBC,aAApB,QAAyC,WAAzC;AACA,SAASC,OAAO,IAAIC,QAApB,QAAoC,YAApC;AACA,SAASD,OAAO,IAAIE,YAApB,QAAwC,uBAAxC;AA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,MANF,QAOO,qBAPP;AASA,SACEC,WADF,EAEEC,gBAFF,EAGEC,cAHF,EAIEC,qBAJF,QAKO,gCALP;AAOA;;AACA,
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":["injectIcon","withTheme","ThemeProvider","default","Provider","DefaultTheme","Link","ButtonSolid","ButtonOutline","Avatar","AvatarEdit","Card","Carousel","Checkbox","CheckboxGroup","CheckboxRow","CircleImage","Container","Divider","FAB","FieldSearchBarFull","IconButton","Image","NumberInput","ScreenContainer","StarRating","Surface","Switch","SwitchRow","TextField","ToggleButton","Touchable","AccordionGroup","AccordionItem","ActionSheet","ActionSheetItem","ActionSheetCancel","Swiper","SwiperItem","Center","Circle","Square","Row","Stack","Spacer","RadioButton","RadioButtonGroup","RadioButtonRow","RadioButtonFieldGroup","Button","CardBlock","CardContainer","CardContainerRating","CardInline","DatePicker","HeaderLarge","HeaderMedium","HeaderOverline","Picker","ProgressBar","ProgressCircle","RowBodyIcon","RowHeadlineImageCaption","RowHeadlineImageIcon","Slider","Stepper","useAuthState"],"mappings":"AAAA,SAASA,UAAT,QAA2B,mBAA3B;AACA,SAASC,SAAT,EAAoBC,aAApB,QAAyC,WAAzC;AACA,SAASC,OAAO,IAAIC,QAApB,QAAoC,YAApC;AACA,SAASD,OAAO,IAAIE,YAApB,QAAwC,uBAAxC;AAEA,SAASC,IAAT,QAAqB,mBAArB;AACA,SAASC,WAAT,EAAsBC,aAAtB,QAA2C,qBAA3C;AACA,SAASL,OAAO,IAAIM,MAApB,QAAkC,0BAAlC;AACA,SAASN,OAAO,IAAIO,UAApB,QAAsC,yBAAtC;AACA,SAASP,OAAO,IAAIQ,IAApB,QAAgC,mBAAhC;AACA,SAASR,OAAO,IAAIS,QAApB,QAAoC,uBAApC;AACA,SAASC,QAAT,EAAmBC,aAAnB,EAAkCC,WAAlC,QAAqD,uBAArD;AACA,SAASZ,OAAO,IAAIa,WAApB,QAAuC,0BAAvC;AACA,SAASb,OAAO,IAAIc,SAApB,QAA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AO,IAAImD,UAApB,QAAsC,oCAAtC;AACA,SAASnD,OAAO,IAAIoD,WAApB,QAAuC,0BAAvC;AACA,SAASpD,OAAO,IAAIqD,YAApB,QAAwC,2BAAxC;AACA,SAASrD,OAAO,IAAIsD,cAApB,QAA0C,6BAA1C;AACA,SAAStD,OAAO,IAAIuD,MAApB,QAAkC,4BAAlC;AACA,SAASvD,OAAO,IAAIwD,WAApB,QAAuC,0BAAvC;AACA,SAASxD,OAAO,IAAIyD,cAApB,QAA0C,6BAA1C;AACA,SAASzD,OAAO,IAAI0D,WAApB,QAAuC,0BAAvC;AACA,SAAS1D,OAAO,IAAI2D,uBAApB,QAAmD,sCAAnD;AACA,SAAS3D,OAAO,IAAI4D,oBAApB,QAAgD,mCAAhD;AACA,SAAS5D,OAAO,IAAI6D,MAApB,QAAkC,qBAAlC;AACA,SAAS7D,OAAO,IAAI8D,OAApB,QAAmC,sBAAnC;AACA,SAASC,YAAT,QAA6B,2BAA7B","sourcesContent":["export { injectIcon } from \"./interfaces/Icon\";\nexport { withTheme, ThemeProvider } from \"./theming\";\nexport { default as Provider } from \"./Provider\";\nexport { default as DefaultTheme } from \"./styles/DefaultTheme\";\n\nexport { Link } from \"./components/Text\";\nexport { ButtonSolid, ButtonOutline } from \"./components/Button\";\nexport { default as Avatar } from \"./components/CircleImage\";\nexport { default as AvatarEdit } from \"./components/AvatarEdit\";\nexport { default as Card } from \"./components/Card\";\nexport { default as Carousel } from \"./components/Carousel\";\nexport { Checkbox, CheckboxGroup, CheckboxRow } from \"./components/Checkbox\";\nexport { default as CircleImage } from \"./components/CircleImage\";\nexport { default as Container } from \"./components/Container\";\nexport { default as Divider } from \"./components/Divider\";\nexport { default as FAB } from \"./components/FAB\";\nexport { default as FieldSearchBarFull } from \"./components/FieldSearchBarFull\";\nexport { default as IconButton } from \"./components/IconButton\";\nexport { default as Image } from \"./components/Image\";\nexport { default as NumberInput } from \"./components/NumberInput\";\nexport { default as ScreenContainer } from \"./components/ScreenContainer\";\nexport { default as StarRating } from \"./components/StarRating\";\nexport { default as Surface } from \"./components/Surface\";\nexport { default as Switch, SwitchRow } from \"./components/Switch\";\nexport { default as TextField } from \"./components/TextField\";\nexport { default as ToggleButton } from \"./components/ToggleButton\";\nexport { default as Touchable } from \"./components/Touchable\";\nexport { AccordionGroup, AccordionItem } from \"./components/Accordion\";\nexport {\n ActionSheet,\n ActionSheetItem,\n ActionSheetCancel,\n} from \"./components/ActionSheet\";\nexport { Swiper, SwiperItem } from \"./components/Swiper\";\n\nexport {\n Center,\n Circle,\n Square,\n Row,\n Stack,\n Spacer,\n} from \"./components/Layout\";\n\nexport {\n RadioButton,\n RadioButtonGroup,\n RadioButtonRow,\n RadioButtonFieldGroup,\n} from \"./components/RadioButton/index\";\n\n/* Deprecated: Fix or Delete! */\nexport { default as Button } from \"./components/DeprecatedButton\";\nexport { default as CardBlock } from \"./components/CardBlock\";\nexport { default as CardContainer } from \"./components/CardContainer\";\nexport { default as CardContainerRating } from \"./components/CardContainerRating\";\nexport { default as CardInline } from \"./components/CardInline\";\nexport { default as DatePicker } from \"./components/DatePicker/DatePicker\";\nexport { default as HeaderLarge } from \"./components/HeaderLarge\";\nexport { default as HeaderMedium } from \"./components/HeaderMedium\";\nexport { default as HeaderOverline } from \"./components/HeaderOverline\";\nexport { default as Picker } from \"./components/Picker/Picker\";\nexport { default as ProgressBar } from \"./components/ProgressBar\";\nexport { default as ProgressCircle } from \"./components/ProgressCircle\";\nexport { default as RowBodyIcon } from \"./components/RowBodyIcon\";\nexport { default as RowHeadlineImageCaption } from \"./components/RowHeadlineImageCaption\";\nexport { default as RowHeadlineImageIcon } from \"./components/RowHeadlineImageIcon\";\nexport { default as Slider } from \"./components/Slider\";\nexport { default as Stepper } from \"./components/Stepper\";\nexport { useAuthState } from \"./components/useAuthState\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["MapMarker.
|
|
1
|
+
{"version":3,"sources":["MapMarker.js"],"names":["COMPONENT_TYPES","createBoolProp","createColorProp","createNumberProp","createTextProp","GROUPS","SEED_DATA","name","tag","description","category","deprecated","layout","props","latitude","label","required","precision","min","max","longitude","title","defaultValue","flat","group","basic","pinColor"],"mappings":"AAAA,SAASA,eAAT,EAA0BC,cAA1B,EAA0CC,eAA1C,EAA2DC,gBAA3D,EAA6EC,cAA7E,EAA6FC,MAA7F,QAA4G,iBAA5G;AACA,OAAO,MAAMC,SAAS,GAAG;AACrBC,EAAAA,IAAI,EAAE,YADe;AAErBC,EAAAA,GAAG,EAAE,WAFgB;AAGrBC,EAAAA,WAAW,EAAE,kCAHQ;AAIrBC,EAAAA,QAAQ,EAAEV,eAAe,CAACW,UAJL;AAKrBC,EAAAA,MAAM,EAAE,EALa;AAMrBC,EAAAA,KAAK,EAAE;AACHC,IAAAA,QAAQ,EAAEX,gBAAgB,CAAC;AACvBY,MAAAA,KAAK,EAAE,UADgB;AAEvBN,MAAAA,WAAW,EAAE,6CAFU;AAGvBO,MAAAA,QAAQ,EAAE,IAHa;AAIvBC,MAAAA,SAAS,EAAE,CAJY;AAKvBC,MAAAA,GAAG,EAAE,CAAC,EALiB;AAMvBC,MAAAA,GAAG,EAAE;AANkB,KAAD,CADvB;AASHC,IAAAA,SAAS,EAAEjB,gBAAgB,CAAC;AACxBY,MAAAA,KAAK,EAAE,WADiB;AAExBN,MAAAA,WAAW,EAAE,8CAFW;AAGxBO,MAAAA,QAAQ,EAAE,IAHc;AAIxBC,MAAAA,SAAS,EAAE,CAJa;AAKxBC,MAAAA,GAAG,EAAE,CAAC,GALkB;AAMxBC,MAAAA,GAAG,EAAE;AANmB,KAAD,CATxB;AAiBHE,IAAAA,KAAK,EAAEjB,cAAc,CAAC;AAClBW,MAAAA,KAAK,EAAE,OADW;AAElBN,MAAAA,WAAW,EAAE,qCAFK;AAGlBa,MAAAA,YAAY,EAAE;AAHI,KAAD,CAjBlB;AAsBHb,IAAAA,WAAW,EAAEL,cAAc,CAAC;AACxBW,MAAAA,KAAK,EAAE,aADiB;AAExBN,MAAAA,WAAW,EAAE,qCAFW;AAGxBa,MAAAA,YAAY,EAAE;AAHU,KAAD,CAtBxB;AA2BHC,IAAAA,IAAI,EAAEtB,cAAc,CAAC;AACjBc,MAAAA,KAAK,EAAE,MADU;AAEjBN,MAAAA,WAAW,EAAE,+GAFI;AAGjBe,MAAAA,KAAK,EAAEnB,MAAM,CAACoB,KAHG;AAIjBH,MAAAA,YAAY,EAAE;AAJG,KAAD,CA3BjB;AAiCHI,IAAAA,QAAQ,EAAExB,eAAe,CAAC;AACtBa,MAAAA,KAAK,EAAE,WADe;AAEtBN,MAAAA,WAAW,EAAE;AAFS,KAAD;AAjCtB;AANc,CAAlB","sourcesContent":["import { COMPONENT_TYPES, createBoolProp, createColorProp, createNumberProp, createTextProp, GROUPS, } from \"@draftbit/types\";\nexport const SEED_DATA = {\n name: \"Map Marker\",\n tag: \"MapMarker\",\n description: \"A marker to show inside map view\",\n category: COMPONENT_TYPES.deprecated,\n layout: {},\n props: {\n latitude: createNumberProp({\n label: \"Latitude\",\n description: \"The latitude in which the marker is located\",\n required: true,\n precision: 6,\n min: -90,\n max: 90,\n }),\n longitude: createNumberProp({\n label: \"Longitude\",\n description: \"The longitude in which the marker is located\",\n required: true,\n precision: 6,\n min: -180,\n max: 180,\n }),\n title: createTextProp({\n label: \"Title\",\n description: \"Title to show along with the marker\",\n defaultValue: null,\n }),\n description: createTextProp({\n label: \"Description\",\n description: \"Optional description for the marker\",\n defaultValue: null,\n }),\n flat: createBoolProp({\n label: \"Flat\",\n description: \"Sets whether this marker should be flat against the map (if true) or a billboard facing the camera (if false)\",\n group: GROUPS.basic,\n defaultValue: false,\n }),\n pinColor: createColorProp({\n label: \"Pin Color\",\n description: \"Sets the color of the marker\",\n }),\n },\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createIconSizeProp, createColorProp, createFieldNameProp, Triggers } from "@draftbit/types";
|
|
1
|
+
import { COMPONENT_TYPES, createIconSizeProp, createColorProp, createFieldNameProp, createStaticNumberProp, Triggers } from "@draftbit/types";
|
|
2
2
|
export const SEED_DATA = [{
|
|
3
3
|
name: "Stepper",
|
|
4
4
|
tag: "Stepper",
|
|
@@ -17,6 +17,15 @@ export const SEED_DATA = [{
|
|
|
17
17
|
}),
|
|
18
18
|
iconColor: createColorProp({
|
|
19
19
|
defaultValue: "strong"
|
|
20
|
+
}),
|
|
21
|
+
min: createStaticNumberProp({
|
|
22
|
+
label: "Minimum",
|
|
23
|
+
description: "Minimum Number",
|
|
24
|
+
defaultValue: 0
|
|
25
|
+
}),
|
|
26
|
+
max: createStaticNumberProp({
|
|
27
|
+
label: "Maximum",
|
|
28
|
+
description: "Maximum Number"
|
|
20
29
|
})
|
|
21
30
|
}
|
|
22
31
|
}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Stepper.ts"],"names":["COMPONENT_TYPES","createIconSizeProp","createColorProp","createFieldNameProp","Triggers","SEED_DATA","name","tag","description","category","input","layout","triggers","OnChange","props","fieldName","defaultValue","handlerPropName","valuePropName","iconSize","iconColor"],"mappings":"AAAA,SACEA,eADF,EAEEC,kBAFF,EAGEC,eAHF,EAIEC,mBAJF,EAKEC,
|
|
1
|
+
{"version":3,"sources":["Stepper.ts"],"names":["COMPONENT_TYPES","createIconSizeProp","createColorProp","createFieldNameProp","createStaticNumberProp","Triggers","SEED_DATA","name","tag","description","category","input","layout","triggers","OnChange","props","fieldName","defaultValue","handlerPropName","valuePropName","iconSize","iconColor","min","label","max"],"mappings":"AAAA,SACEA,eADF,EAEEC,kBAFF,EAGEC,eAHF,EAIEC,mBAJF,EAKEC,sBALF,EAMEC,QANF,QAOO,iBAPP;AASA,OAAO,MAAMC,SAAS,GAAG,CACvB;AACEC,EAAAA,IAAI,EAAE,SADR;AAEEC,EAAAA,GAAG,EAAE,SAFP;AAGEC,EAAAA,WAAW,EAAE,uDAHf;AAIEC,EAAAA,QAAQ,EAAEV,eAAe,CAACW,KAJ5B;AAKEC,EAAAA,MAAM,EAAE,EALV;AAMEC,EAAAA,QAAQ,EAAE,CAACR,QAAQ,CAACS,QAAV,CANZ;AAOEC,EAAAA,KAAK,EAAE;AACLC,IAAAA,SAAS,EAAEb,mBAAmB,CAAC;AAC7Bc,MAAAA,YAAY,EAAE,cADe;AAE7BC,MAAAA,eAAe,EAAE,UAFY;AAG7BC,MAAAA,aAAa,EAAE;AAHc,KAAD,CADzB;AAMLC,IAAAA,QAAQ,EAAEnB,kBAAkB,CAAC;AAAEgB,MAAAA,YAAY,EAAE;AAAhB,KAAD,CANvB;AAOLI,IAAAA,SAAS,EAAEnB,eAAe,CAAC;AAAEe,MAAAA,YAAY,EAAE;AAAhB,KAAD,CAPrB;AAQLK,IAAAA,GAAG,EAAElB,sBAAsB,CAAC;AAC1BmB,MAAAA,KAAK,EAAE,SADmB;AAE1Bd,MAAAA,WAAW,EAAE,gBAFa;AAG1BQ,MAAAA,YAAY,EAAE;AAHY,KAAD,CARtB;AAaLO,IAAAA,GAAG,EAAEpB,sBAAsB,CAAC;AAC1BmB,MAAAA,KAAK,EAAE,SADmB;AAE1Bd,MAAAA,WAAW,EAAE;AAFa,KAAD;AAbtB;AAPT,CADuB,CAAlB","sourcesContent":["import {\n COMPONENT_TYPES,\n createIconSizeProp,\n createColorProp,\n createFieldNameProp,\n createStaticNumberProp,\n Triggers,\n} from \"@draftbit/types\";\n\nexport const SEED_DATA = [\n {\n name: \"Stepper\",\n tag: \"Stepper\",\n description: \"A component used to control the quantity of something\",\n category: COMPONENT_TYPES.input,\n layout: {},\n triggers: [Triggers.OnChange],\n props: {\n fieldName: createFieldNameProp({\n defaultValue: \"stepperValue\",\n handlerPropName: \"onChange\",\n valuePropName: \"value\",\n }),\n iconSize: createIconSizeProp({ defaultValue: 24 }),\n iconColor: createColorProp({ defaultValue: \"strong\" }),\n min: createStaticNumberProp({\n label: \"Minimum\",\n description: \"Minimum Number\",\n defaultValue: 0,\n }),\n max: createStaticNumberProp({\n label: \"Maximum\",\n description: \"Maximum Number\",\n }),\n },\n },\n];\n"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { GROUPS, COMPONENT_TYPES, createIconProp, createBoolProp, createColorProp, createStaticNumberProp, createFieldNameProp, createIconSizeProp, createActionProp, Triggers } from "@draftbit/types";
|
|
2
|
+
export const SEED_DATA = {
|
|
3
|
+
name: "Toggle Button",
|
|
4
|
+
tag: "ToggleButton",
|
|
5
|
+
category: COMPONENT_TYPES.deprecated,
|
|
6
|
+
layout: {},
|
|
7
|
+
triggers: [Triggers.OnPress],
|
|
8
|
+
props: {
|
|
9
|
+
onPress: createActionProp(),
|
|
10
|
+
icon: createIconProp({
|
|
11
|
+
required: true
|
|
12
|
+
}),
|
|
13
|
+
iconSize: createIconSizeProp(),
|
|
14
|
+
fieldName: createFieldNameProp({
|
|
15
|
+
defaultValue: false,
|
|
16
|
+
valuePropName: "toggled"
|
|
17
|
+
}),
|
|
18
|
+
disabled: createBoolProp({
|
|
19
|
+
label: "Disabled",
|
|
20
|
+
description: "Whether the button should be disabled",
|
|
21
|
+
group: GROUPS.basic
|
|
22
|
+
}),
|
|
23
|
+
color: createColorProp({
|
|
24
|
+
group: GROUPS.basic
|
|
25
|
+
}),
|
|
26
|
+
colorSecondary: createColorProp({
|
|
27
|
+
label: "Secondary Color",
|
|
28
|
+
group: GROUPS.basic
|
|
29
|
+
}),
|
|
30
|
+
borderColor: createColorProp({
|
|
31
|
+
label: "Border Color",
|
|
32
|
+
group: GROUPS.basic
|
|
33
|
+
}),
|
|
34
|
+
width: createStaticNumberProp({
|
|
35
|
+
label: "Width",
|
|
36
|
+
description: "Width",
|
|
37
|
+
defaultValue: 50
|
|
38
|
+
}),
|
|
39
|
+
height: createStaticNumberProp({
|
|
40
|
+
label: "Height",
|
|
41
|
+
description: "Height",
|
|
42
|
+
defaultValue: 50
|
|
43
|
+
}),
|
|
44
|
+
toggled: createBoolProp({
|
|
45
|
+
label: "Toggled",
|
|
46
|
+
description: "Whether the button should show the toggled state",
|
|
47
|
+
defaultValue: false
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=ToggleButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ToggleButton.ts"],"names":["GROUPS","COMPONENT_TYPES","createIconProp","createBoolProp","createColorProp","createStaticNumberProp","createFieldNameProp","createIconSizeProp","createActionProp","Triggers","SEED_DATA","name","tag","category","deprecated","layout","triggers","OnPress","props","onPress","icon","required","iconSize","fieldName","defaultValue","valuePropName","disabled","label","description","group","basic","color","colorSecondary","borderColor","width","height","toggled"],"mappings":"AAAA,SACEA,MADF,EAEEC,eAFF,EAGEC,cAHF,EAIEC,cAJF,EAKEC,eALF,EAMEC,sBANF,EAOEC,mBAPF,EAQEC,kBARF,EASEC,gBATF,EAUEC,QAVF,QAWO,iBAXP;AAaA,OAAO,MAAMC,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,eADiB;AAEvBC,EAAAA,GAAG,EAAE,cAFkB;AAGvBC,EAAAA,QAAQ,EAAEZ,eAAe,CAACa,UAHH;AAIvBC,EAAAA,MAAM,EAAE,EAJe;AAKvBC,EAAAA,QAAQ,EAAE,CAACP,QAAQ,CAACQ,OAAV,CALa;AAMvBC,EAAAA,KAAK,EAAE;AACLC,IAAAA,OAAO,EAAEX,gBAAgB,EADpB;AAELY,IAAAA,IAAI,EAAElB,cAAc,CAAC;AACnBmB,MAAAA,QAAQ,EAAE;AADS,KAAD,CAFf;AAKLC,IAAAA,QAAQ,EAAEf,kBAAkB,EALvB;AAMLgB,IAAAA,SAAS,EAAEjB,mBAAmB,CAAC;AAC7BkB,MAAAA,YAAY,EAAE,KADe;AAE7BC,MAAAA,aAAa,EAAE;AAFc,KAAD,CANzB;AAULC,IAAAA,QAAQ,EAAEvB,cAAc,CAAC;AACvBwB,MAAAA,KAAK,EAAE,UADgB;AAEvBC,MAAAA,WAAW,EAAE,uCAFU;AAGvBC,MAAAA,KAAK,EAAE7B,MAAM,CAAC8B;AAHS,KAAD,CAVnB;AAeLC,IAAAA,KAAK,EAAE3B,eAAe,CAAC;AACrByB,MAAAA,KAAK,EAAE7B,MAAM,CAAC8B;AADO,KAAD,CAfjB;AAkBLE,IAAAA,cAAc,EAAE5B,eAAe,CAAC;AAC9BuB,MAAAA,KAAK,EAAE,iBADuB;AAE9BE,MAAAA,KAAK,EAAE7B,MAAM,CAAC8B;AAFgB,KAAD,CAlB1B;AAsBLG,IAAAA,WAAW,EAAE7B,eAAe,CAAC;AAC3BuB,MAAAA,KAAK,EAAE,cADoB;AAE3BE,MAAAA,KAAK,EAAE7B,MAAM,CAAC8B;AAFa,KAAD,CAtBvB;AA0BLI,IAAAA,KAAK,EAAE7B,sBAAsB,CAAC;AAC5BsB,MAAAA,KAAK,EAAE,OADqB;AAE5BC,MAAAA,WAAW,EAAE,OAFe;AAG5BJ,MAAAA,YAAY,EAAE;AAHc,KAAD,CA1BxB;AA+BLW,IAAAA,MAAM,EAAE9B,sBAAsB,CAAC;AAC7BsB,MAAAA,KAAK,EAAE,QADsB;AAE7BC,MAAAA,WAAW,EAAE,QAFgB;AAG7BJ,MAAAA,YAAY,EAAE;AAHe,KAAD,CA/BzB;AAoCLY,IAAAA,OAAO,EAAEjC,cAAc,CAAC;AACtBwB,MAAAA,KAAK,EAAE,SADe;AAEtBC,MAAAA,WAAW,EAAE,kDAFS;AAGtBJ,MAAAA,YAAY,EAAE;AAHQ,KAAD;AApClB;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"]}
|
|
@@ -4,6 +4,8 @@ import type { Theme } from "../styles/DefaultTheme";
|
|
|
4
4
|
import type { IconSlot } from "../interfaces/Icon";
|
|
5
5
|
declare type Props = {
|
|
6
6
|
value?: number;
|
|
7
|
+
min?: number;
|
|
8
|
+
max?: number;
|
|
7
9
|
theme: Theme;
|
|
8
10
|
style?: StyleProp<ViewStyle>;
|
|
9
11
|
onChange?: (value: number) => void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { colorTypes } from "@draftbit/types";
|
|
3
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
4
|
+
import type { Theme } from "../styles/DefaultTheme";
|
|
5
|
+
import type { IconSlot } from "../interfaces/Icon";
|
|
6
|
+
declare type Props = {
|
|
7
|
+
icon: string;
|
|
8
|
+
toggled?: boolean;
|
|
9
|
+
onPress?: (value: boolean) => void;
|
|
10
|
+
defaultValue?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
color?: colorTypes;
|
|
13
|
+
colorSecondary?: colorTypes;
|
|
14
|
+
borderColor?: colorTypes;
|
|
15
|
+
iconSize?: number;
|
|
16
|
+
width?: number;
|
|
17
|
+
height?: number;
|
|
18
|
+
style?: StyleProp<ViewStyle>;
|
|
19
|
+
theme: Theme;
|
|
20
|
+
} & IconSlot;
|
|
21
|
+
declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<Props, "theme"> & {
|
|
22
|
+
theme?: import("@draftbit/react-theme-provider").$DeepPartial<any> | undefined;
|
|
23
|
+
}> & import("@draftbit/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<Props> & React.FC<Props>, {}>;
|
|
24
|
+
export default _default;
|
|
@@ -22,6 +22,7 @@ export { default as StarRating } from "./components/StarRating";
|
|
|
22
22
|
export { default as Surface } from "./components/Surface";
|
|
23
23
|
export { default as Switch, SwitchRow } from "./components/Switch";
|
|
24
24
|
export { default as TextField } from "./components/TextField";
|
|
25
|
+
export { default as ToggleButton } from "./components/ToggleButton";
|
|
25
26
|
export { default as Touchable } from "./components/Touchable";
|
|
26
27
|
export { AccordionGroup, AccordionItem } from "./components/Accordion";
|
|
27
28
|
export { ActionSheet, ActionSheetItem, ActionSheetCancel, } from "./components/ActionSheet";
|
|
@@ -39,5 +39,27 @@ export declare const SEED_DATA: {
|
|
|
39
39
|
formType: string;
|
|
40
40
|
propType: string;
|
|
41
41
|
};
|
|
42
|
+
min: {
|
|
43
|
+
label: string;
|
|
44
|
+
description: string;
|
|
45
|
+
formType: string;
|
|
46
|
+
propType: string;
|
|
47
|
+
group: string;
|
|
48
|
+
defaultValue: null;
|
|
49
|
+
editable: boolean;
|
|
50
|
+
required: boolean;
|
|
51
|
+
step: number;
|
|
52
|
+
};
|
|
53
|
+
max: {
|
|
54
|
+
label: string;
|
|
55
|
+
description: string;
|
|
56
|
+
formType: string;
|
|
57
|
+
propType: string;
|
|
58
|
+
group: string;
|
|
59
|
+
defaultValue: null;
|
|
60
|
+
editable: boolean;
|
|
61
|
+
required: boolean;
|
|
62
|
+
step: number;
|
|
63
|
+
};
|
|
42
64
|
};
|
|
43
65
|
}[];
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
export declare const SEED_DATA: {
|
|
2
|
+
name: string;
|
|
3
|
+
tag: string;
|
|
4
|
+
category: string;
|
|
5
|
+
layout: {};
|
|
6
|
+
triggers: string[];
|
|
7
|
+
props: {
|
|
8
|
+
onPress: {
|
|
9
|
+
label: string;
|
|
10
|
+
description: string;
|
|
11
|
+
editable: boolean;
|
|
12
|
+
required: boolean;
|
|
13
|
+
formType: string;
|
|
14
|
+
propType: string;
|
|
15
|
+
defaultValue: null;
|
|
16
|
+
group: string;
|
|
17
|
+
};
|
|
18
|
+
icon: {
|
|
19
|
+
label: string;
|
|
20
|
+
description: string;
|
|
21
|
+
formType: string;
|
|
22
|
+
propType: string;
|
|
23
|
+
defaultValue: string;
|
|
24
|
+
required: boolean;
|
|
25
|
+
editable: boolean;
|
|
26
|
+
group: string;
|
|
27
|
+
};
|
|
28
|
+
iconSize: {
|
|
29
|
+
group: string;
|
|
30
|
+
label: string;
|
|
31
|
+
description: string;
|
|
32
|
+
editable: boolean;
|
|
33
|
+
required: boolean;
|
|
34
|
+
formType: string;
|
|
35
|
+
propType: string;
|
|
36
|
+
defaultValue: number;
|
|
37
|
+
options: number[];
|
|
38
|
+
};
|
|
39
|
+
fieldName: {
|
|
40
|
+
handlerPropName: string;
|
|
41
|
+
group: string;
|
|
42
|
+
label: string;
|
|
43
|
+
description: string;
|
|
44
|
+
formType: string;
|
|
45
|
+
propType: string;
|
|
46
|
+
defaultValue: string;
|
|
47
|
+
valuePropName: string;
|
|
48
|
+
editable: boolean;
|
|
49
|
+
required: boolean;
|
|
50
|
+
};
|
|
51
|
+
disabled: {
|
|
52
|
+
label: string;
|
|
53
|
+
description: string;
|
|
54
|
+
formType: string;
|
|
55
|
+
propType: string;
|
|
56
|
+
defaultValue: boolean;
|
|
57
|
+
editable: boolean;
|
|
58
|
+
required: boolean;
|
|
59
|
+
group: string;
|
|
60
|
+
};
|
|
61
|
+
color: {
|
|
62
|
+
group: string;
|
|
63
|
+
label: string;
|
|
64
|
+
description: string;
|
|
65
|
+
editable: boolean;
|
|
66
|
+
required: boolean;
|
|
67
|
+
defaultValue: null;
|
|
68
|
+
formType: string;
|
|
69
|
+
propType: string;
|
|
70
|
+
};
|
|
71
|
+
colorSecondary: {
|
|
72
|
+
group: string;
|
|
73
|
+
label: string;
|
|
74
|
+
description: string;
|
|
75
|
+
editable: boolean;
|
|
76
|
+
required: boolean;
|
|
77
|
+
defaultValue: null;
|
|
78
|
+
formType: string;
|
|
79
|
+
propType: string;
|
|
80
|
+
};
|
|
81
|
+
borderColor: {
|
|
82
|
+
group: string;
|
|
83
|
+
label: string;
|
|
84
|
+
description: string;
|
|
85
|
+
editable: boolean;
|
|
86
|
+
required: boolean;
|
|
87
|
+
defaultValue: null;
|
|
88
|
+
formType: string;
|
|
89
|
+
propType: string;
|
|
90
|
+
};
|
|
91
|
+
width: {
|
|
92
|
+
label: string;
|
|
93
|
+
description: string;
|
|
94
|
+
formType: string;
|
|
95
|
+
propType: string;
|
|
96
|
+
group: string;
|
|
97
|
+
defaultValue: null;
|
|
98
|
+
editable: boolean;
|
|
99
|
+
required: boolean;
|
|
100
|
+
step: number;
|
|
101
|
+
};
|
|
102
|
+
height: {
|
|
103
|
+
label: string;
|
|
104
|
+
description: string;
|
|
105
|
+
formType: string;
|
|
106
|
+
propType: string;
|
|
107
|
+
group: string;
|
|
108
|
+
defaultValue: null;
|
|
109
|
+
editable: boolean;
|
|
110
|
+
required: boolean;
|
|
111
|
+
step: number;
|
|
112
|
+
};
|
|
113
|
+
toggled: {
|
|
114
|
+
label: string;
|
|
115
|
+
description: string;
|
|
116
|
+
formType: string;
|
|
117
|
+
propType: string;
|
|
118
|
+
defaultValue: boolean;
|
|
119
|
+
editable: boolean;
|
|
120
|
+
required: boolean;
|
|
121
|
+
group: string;
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "43.3.
|
|
3
|
+
"version": "43.3.4-a9cc72.1+a9cc7223",
|
|
4
4
|
"description": "Core (non-native) Components",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@date-io/date-fns": "^1.3.13",
|
|
43
43
|
"@draftbit/react-theme-provider": "^2.1.1",
|
|
44
|
-
"@draftbit/types": "^43.3.
|
|
44
|
+
"@draftbit/types": "^43.3.4-a9cc72.1+a9cc7223",
|
|
45
45
|
"@material-ui/core": "^4.11.0",
|
|
46
46
|
"@material-ui/pickers": "^3.2.10",
|
|
47
47
|
"@react-native-community/slider": "4.1.7",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
]
|
|
80
80
|
]
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "a9cc72234831da23420cd5dcd1987e11c9e01c14"
|
|
83
83
|
}
|