@draftbit/core 44.1.5-f7f9c9.0 → 44.1.5
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.
|
@@ -1,3 +1,5 @@
|
|
|
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
|
+
|
|
1
3
|
import * as React from "react";
|
|
2
4
|
import { StyleSheet, View, Platform } from "react-native";
|
|
3
5
|
import Checkbox from "./Checkbox";
|
|
@@ -6,7 +8,7 @@ import { useCheckboxGroupContext } from "./context";
|
|
|
6
8
|
import { Direction as GroupDirection } from "./context";
|
|
7
9
|
import Touchable from "../Touchable";
|
|
8
10
|
import { extractStyles } from "../../utilities";
|
|
9
|
-
export
|
|
11
|
+
export let Direction;
|
|
10
12
|
|
|
11
13
|
(function (Direction) {
|
|
12
14
|
Direction["Row"] = "row";
|
|
@@ -69,14 +71,13 @@ const CheckboxGroupRow = _ref => {
|
|
|
69
71
|
textStyles,
|
|
70
72
|
viewStyles
|
|
71
73
|
} = extractStyles(style);
|
|
72
|
-
return /*#__PURE__*/React.createElement(Touchable, {
|
|
74
|
+
return /*#__PURE__*/React.createElement(Touchable, _extends({
|
|
73
75
|
onPress: handlePress,
|
|
74
76
|
style: [styles.mainParent, {
|
|
75
77
|
flexDirection: direction
|
|
76
78
|
}, viewStyles],
|
|
77
|
-
disabled: disabled
|
|
78
|
-
|
|
79
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
79
|
+
disabled: disabled
|
|
80
|
+
}, rest), /*#__PURE__*/React.createElement(View, {
|
|
80
81
|
style: [styles.label, {
|
|
81
82
|
alignItems: direction === Direction.Row ? "flex-start" : "flex-end"
|
|
82
83
|
}, labelContainerStyle]
|
|
@@ -116,21 +117,4 @@ const styles = StyleSheet.create({
|
|
|
116
117
|
}
|
|
117
118
|
});
|
|
118
119
|
export default CheckboxGroupRow;
|
|
119
|
-
//# sourceMappingURL=CheckboxGroupRow.js.mapnt: "space-around",
|
|
120
|
-
paddingStart: 20,
|
|
121
|
-
minHeight: 50,
|
|
122
|
-
paddingEnd: 20,
|
|
123
|
-
display: "flex",
|
|
124
|
-
...Platform.select({
|
|
125
|
-
web: {
|
|
126
|
-
cursor: "pointer",
|
|
127
|
-
userSelect: "none"
|
|
128
|
-
}
|
|
129
|
-
})
|
|
130
|
-
},
|
|
131
|
-
label: {
|
|
132
|
-
flex: 3
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
export default CheckboxGroupRow;
|
|
136
120
|
//# sourceMappingURL=CheckboxGroupRow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["CheckboxGroupRow.
|
|
1
|
+
{"version":3,"sources":["CheckboxGroupRow.tsx"],"names":["React","StyleSheet","View","Platform","Checkbox","Text","useCheckboxGroupContext","Direction","GroupDirection","Touchable","extractStyles","getCheckboxAlignment","parentDirection","direction","Horizontal","Row","RowReverse","renderLabel","value","labelStyle","textStyle","CheckboxGroupRow","Icon","label","status","onPress","labelContainerStyle","checkboxStyle","disabled","style","color","uncheckedColor","rest","values","selectedValues","onValueChange","Array","isArray","isChecked","includes","handlePress","textStyles","viewStyles","styles","mainParent","flexDirection","alignItems","flex","create","justifyContent","paddingStart","minHeight","paddingEnd","display","select","web","cursor","userSelect"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAGEC,UAHF,EAKEC,IALF,EAMEC,QANF,QAOO,cAPP;AAQA,OAAOC,QAAP,MAAwC,YAAxC;AACA,OAAOC,IAAP,MAAiB,SAAjB;AACA,SAASC,uBAAT,QAAwC,WAAxC;AAEA,SAASC,SAAS,IAAIC,cAAtB,QAA4C,WAA5C;AACA,OAAOC,SAAP,MAAsB,cAAtB;AACA,SAASC,aAAT,QAA8B,iBAA9B;AAEA,WAAY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E,WAHX;AAIE,IAAA,KAAK,EAAEb,aAJT;AAKE,IAAA,QAAQ,EAAEC,QALZ;AAME,IAAA,KAAK,EAAEE,KANT;AAOE,IAAA,cAAc,EAAEC;AAPlB,IANF,CAjBF,CADF;AAoCD,CAtED;;AAwEA,MAAMY,MAAM,GAAG1C,UAAU,CAAC+C,MAAX,CAAkB;AAC/BJ,EAAAA,UAAU,EAAE;AACVE,IAAAA,UAAU,EAAE,QADF;AAEVG,IAAAA,cAAc,EAAE,cAFN;AAGVC,IAAAA,YAAY,EAAE,EAHJ;AAIVC,IAAAA,SAAS,EAAE,EAJD;AAKVC,IAAAA,UAAU,EAAE,EALF;AAMVC,IAAAA,OAAO,EAAE,MANC;AAOV,OAAGlD,QAAQ,CAACmD,MAAT,CAAgB;AACjBC,MAAAA,GAAG,EAAE;AACHC,QAAAA,MAAM,EAAE,SADL;AAEHC,QAAAA,UAAU,EAAE;AAFT;AADY,KAAhB;AAPO,GADmB;AAe/BlC,EAAAA,KAAK,EAAE;AACLwB,IAAAA,IAAI,EAAE;AADD;AAfwB,CAAlB,CAAf;AAoBA,eAAe1B,gBAAf","sourcesContent":["import * as React from \"react\";\nimport {\n StyleProp,\n ViewStyle,\n StyleSheet,\n TextStyle,\n View,\n Platform,\n} from \"react-native\";\nimport Checkbox, { CheckboxProps } from \"./Checkbox\";\nimport Text from \"../Text\";\nimport { useCheckboxGroupContext } from \"./context\";\nimport type { IconSlot } from \"../../interfaces/Icon\";\nimport { Direction as GroupDirection } from \"./context\";\nimport Touchable from \"../Touchable\";\nimport { extractStyles } from \"../../utilities\";\n\nexport enum Direction {\n Row = \"row\",\n RowReverse = \"row-reverse\",\n}\n\nexport interface CheckboxGroupRowProps extends Omit<CheckboxProps, \"onPress\"> {\n label: string | React.ReactNode;\n value: string; // A string that this checkbox represents\n labelContainerStyle: StyleProp<ViewStyle>;\n checkboxStyle?: StyleProp<ViewStyle>;\n labelStyle?: StyleProp<TextStyle>;\n onPress?: (value: boolean) => void;\n direction?: Direction;\n color: string;\n unselectedColor: string;\n}\n\nconst getCheckboxAlignment = (\n parentDirection: GroupDirection | undefined,\n direction: Direction\n) => {\n if (parentDirection === GroupDirection.Horizontal) {\n return direction === Direction.Row ? \"flex-start\" : \"flex-end\";\n } else if (direction === Direction.RowReverse) {\n return \"flex-start\";\n } else {\n return \"flex-end\";\n }\n};\n\nconst renderLabel = (\n value: string | React.ReactNode,\n labelStyle: StyleProp<TextStyle>,\n textStyle: StyleProp<TextStyle>\n) => {\n if (typeof value === \"string\") {\n return <Text style={[labelStyle, textStyle]}>{value}</Text>;\n } else {\n return <>{value}</>;\n }\n};\n\nconst CheckboxGroupRow: React.FC<CheckboxGroupRowProps & IconSlot> = ({\n Icon,\n label = \"Label\",\n status,\n value,\n onPress,\n labelContainerStyle,\n labelStyle,\n checkboxStyle,\n direction = Direction.Row,\n disabled,\n style,\n color,\n uncheckedColor,\n ...rest\n}) => {\n const {\n values: selectedValues,\n onValueChange,\n direction: parentDirection,\n } = useCheckboxGroupContext();\n\n const values = Array.isArray(selectedValues) ? selectedValues : [];\n const isChecked = status || values.includes(value);\n\n const handlePress = () => {\n if (!disabled) {\n onPress?.(!isChecked);\n onValueChange?.(value, !isChecked);\n }\n };\n\n const { textStyles, viewStyles } = extractStyles(style);\n\n return (\n <Touchable\n onPress={handlePress}\n style={[styles.mainParent, { flexDirection: direction }, viewStyles]}\n disabled={disabled}\n {...rest}\n >\n <View\n style={[\n styles.label,\n {\n alignItems: direction === Direction.Row ? \"flex-start\" : \"flex-end\",\n },\n labelContainerStyle,\n ]}\n >\n {renderLabel(label, labelStyle, textStyles)}\n </View>\n <View\n style={{\n flex: 1,\n alignItems: getCheckboxAlignment(parentDirection, direction),\n }}\n >\n <Checkbox\n Icon={Icon}\n status={isChecked}\n onPress={handlePress}\n style={checkboxStyle}\n disabled={disabled}\n color={color}\n uncheckedColor={uncheckedColor}\n />\n </View>\n </Touchable>\n );\n};\n\nconst styles = StyleSheet.create({\n mainParent: {\n alignItems: \"center\",\n justifyContent: \"space-around\",\n paddingStart: 20,\n minHeight: 50,\n paddingEnd: 20,\n display: \"flex\",\n ...Platform.select({\n web: {\n cursor: \"pointer\",\n userSelect: \"none\",\n },\n }),\n },\n label: {\n flex: 3,\n },\n});\n\nexport default CheckboxGroupRow;\n"]}
|
|
@@ -1,11 +1,9 @@
|
|
|
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
1
|
import * as React from "react";
|
|
4
2
|
import { Animated, StyleSheet, View } from "react-native";
|
|
5
3
|
import shadow from "../styles/shadow";
|
|
6
4
|
import { withTheme } from "../theming";
|
|
7
|
-
|
|
8
5
|
/* directly copied from https://github.com/callstack/react-native-paper/blob/main/src/components/Surface.tsx#L62 */
|
|
6
|
+
|
|
9
7
|
const Elevation = _ref => {
|
|
10
8
|
let {
|
|
11
9
|
style,
|
|
@@ -21,11 +19,24 @@ const Elevation = _ref => {
|
|
|
21
19
|
colors
|
|
22
20
|
} = theme;
|
|
23
21
|
const borderRadius = radius;
|
|
24
|
-
return /*#__PURE__*/React.createElement(Animated.View,
|
|
22
|
+
return /*#__PURE__*/React.createElement(Animated.View, { ...rest,
|
|
25
23
|
style: [{
|
|
26
24
|
borderRadius,
|
|
27
25
|
backgroundColor: colors.surface
|
|
28
26
|
}, elevation ? shadow(elevation) : null, style]
|
|
27
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
28
|
+
style: {
|
|
29
|
+
overflow: "hidden",
|
|
30
|
+
borderRadius
|
|
31
|
+
}
|
|
32
|
+
}, children));
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default withTheme(Elevation);
|
|
36
|
+
//# sourceMappingURL=Elevation.js.map style: [{
|
|
37
|
+
borderRadius,
|
|
38
|
+
backgroundColor: colors.surface
|
|
39
|
+
}, elevation ? shadow(elevation) : null, style]
|
|
29
40
|
}), /*#__PURE__*/React.createElement(View, {
|
|
30
41
|
style: {
|
|
31
42
|
overflow: "hidden",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Elevation.
|
|
1
|
+
{"version":3,"sources":["Elevation.js"],"names":["React","Animated","StyleSheet","View","shadow","withTheme","Elevation","style","theme","children","rest","elevation","borderRadius","radius","flatten","colors","createElement","backgroundColor","surface","overflow"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,QAAT,EAAmBC,UAAnB,EAA+BC,IAA/B,QAA4C,cAA5C;AACA,OAAOC,MAAP,MAAmB,kBAAnB;AACA,SAASC,SAAT,QAA0B,YAA1B;AACA;;AACA,MAAMC,SAAS,GAAG,QAAyC;AAAA,MAAxC;AAAEC,IAAAA,KAAF;AAASC,IAAAA,KAAT;AAAgBC,IAAAA,QAAhB;AAA0B,OAAGC;AAA7B,GAAwC;AACvD,QAAM;AAAEC,IAAAA,SAAS,GAAG,CAAd;AAAiBC,IAAAA,YAAY,EAAEC;AAA/B,MAA0CX,UAAU,CAACY,OAAX,CAAmBP,KAAnB,KAA6B,EAA7E;AACA,QAAM;AAAEQ,IAAAA;AAAF,MAAaP,KAAnB;AACA,QAAMI,YAAY,GAAGC,MAArB;AACA,sBAAQb,KAAK,CAACgB,aAAN,CAAoBf,QAAQ,CAACE,IAA7B,EAAmC,EAAE,GAAGO,IAAL;AAAWH,IAAAA,KAAK,EAAE,CACrD;AACIK,MAAAA,YADJ;AAEIK,MAAAA,eAAe,EAAEF,MAAM,CAACG;AAF5B,KADqD,EAKrDP,SAAS,GAAGP,MAAM,CAACO,SAAD,CAAT,GAAuB,IALqB,EAMrDJ,KANqD;AAAlB,GAAnC,eAQJP,KAAK,CAACgB,aAAN,CAAoBb,IAApB,EAA0B;AAAEI,IAAAA,KAAK,EAAE;AAAEY,MAAAA,QAAQ,EAAE,QAAZ;AAAsBP,MAAAA;AAAtB;AAAT,GAA1B,EAA2EH,QAA3E,CARI,CAAR;AASH,CAbD;;AAcA,eAAeJ,SAAS,CAACC,SAAD,CAAxB","sourcesContent":["import * as React from \"react\";\nimport { Animated, StyleSheet, View, } from \"react-native\";\nimport shadow from \"../styles/shadow\";\nimport { withTheme } from \"../theming\";\n/* directly copied from https://github.com/callstack/react-native-paper/blob/main/src/components/Surface.tsx#L62 */\nconst Elevation = ({ style, theme, children, ...rest }) => {\n const { elevation = 4, borderRadius: radius } = StyleSheet.flatten(style) || {};\n const { colors } = theme;\n const borderRadius = radius;\n return (React.createElement(Animated.View, { ...rest, style: [\n {\n borderRadius,\n backgroundColor: colors.surface,\n },\n elevation ? shadow(elevation) : null,\n style,\n ] },\n React.createElement(View, { style: { overflow: \"hidden\", borderRadius } }, children)));\n};\nexport default withTheme(Elevation);\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "44.1.5
|
|
3
|
+
"version": "44.1.5",
|
|
4
4
|
"description": "Core (non-native) Components",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
]
|
|
80
80
|
]
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "79756ca007e224c16f745032bd46e9ce4ff617a1"
|
|
83
83
|
}
|