@draftbit/core 43.4.4 → 43.4.5-ccf125.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/Accordion/AccordionItem.js +21 -5
- package/lib/commonjs/components/Accordion/AccordionItem.js.map +1 -1
- package/lib/commonjs/components/CardInline.js.map +1 -1
- package/lib/commonjs/components/DatePicker/DatePickerComponent.js.map +1 -1
- package/lib/commonjs/components/FieldSearchBarFull.js.map +1 -1
- package/lib/commonjs/components/FormRow.js +5 -18
- package/lib/commonjs/components/FormRow.js.map +1 -1
- package/lib/commonjs/components/NumberInput.js +4 -13
- package/lib/commonjs/components/NumberInput.js.map +1 -1
- package/lib/commonjs/components/Picker/PickerComponent.android.js +6 -20
- package/lib/commonjs/components/Picker/PickerComponent.android.js.map +1 -1
- package/lib/commonjs/components/Portal/PortalManager.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButton.js +9 -6
- package/lib/commonjs/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButtonGroup.js +18 -8
- package/lib/commonjs/components/RadioButton/RadioButtonGroup.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButtonRow.js +14 -9
- package/lib/commonjs/components/RadioButton/RadioButtonRow.js.map +1 -1
- package/lib/commonjs/components/RadioButton/index.js.map +1 -1
- package/lib/commonjs/components/ResizeMode.js +1 -2
- package/lib/commonjs/components/Swiper/Swiper.js.map +1 -1
- package/lib/commonjs/components/Touchable.js +3 -16
- package/lib/commonjs/components/Touchable.js.map +1 -1
- package/lib/commonjs/mappings/SafeAreaView.js.map +1 -1
- package/lib/commonjs/mappings/StarRating.js +2 -6
- package/lib/commonjs/mappings/StarRating.js.map +1 -1
- package/lib/commonjs/mappings/Surface.js.map +1 -1
- package/lib/commonjs/mappings/WebView.js.map +1 -1
- package/lib/commonjs/utilities.js +16 -0
- package/lib/commonjs/utilities.js.map +1 -1
- package/lib/module/components/DatePicker/DatePickerComponentType.js.map +1 -1
- package/lib/module/components/Header.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButton.js +8 -6
- package/lib/module/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButtonGroup.js +17 -8
- package/lib/module/components/RadioButton/RadioButtonGroup.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButtonRow.js +15 -10
- package/lib/module/components/RadioButton/RadioButtonRow.js.map +1 -1
- package/lib/module/mappings/ImageBackground.js.map +1 -1
- package/lib/module/mappings/KeyboardAvoidingView.js.map +1 -1
- package/lib/module/utilities.js +14 -0
- package/lib/module/utilities.js.map +1 -1
- package/lib/typescript/src/components/RadioButton/RadioButton.d.ts +1 -1
- package/lib/typescript/src/components/RadioButton/RadioButtonGroup.d.ts +1 -1
- package/lib/typescript/src/utilities.d.ts +1 -0
- package/package.json +2 -2
- package/src/components/RadioButton/RadioButton.js +9 -5
- package/src/components/RadioButton/RadioButton.tsx +12 -9
- package/src/components/RadioButton/RadioButtonGroup.js +14 -8
- package/src/components/RadioButton/RadioButtonGroup.tsx +21 -12
- package/src/components/RadioButton/RadioButtonRow.js +15 -9
- package/src/components/RadioButton/RadioButtonRow.tsx +19 -13
- package/src/utilities.js +12 -0
- package/src/utilities.ts +13 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["RadioButtonRow.tsx"],"names":["Direction","getRadioButtonAlignment","parentDirection","direction","GroupDirection","Horizontal","Row","RowReverse","renderLabel","
|
|
1
|
+
{"version":3,"sources":["RadioButtonRow.tsx"],"names":["Direction","getRadioButtonAlignment","parentDirection","direction","GroupDirection","Horizontal","Row","RowReverse","renderLabel","label","labelStyle","textStyle","RadioButtonRow","Icon","value","color","unselectedColor","onPress","labelContainerStyle","radioButtonStyle","selected","disabled","style","rest","contextValue","onValueChange","realValue","realContextValue","isSelected","handlePress","textStyles","viewStyles","styles","mainParent","flexDirection","alignItems","flex","StyleSheet","create","justifyContent","paddingStart","minHeight","pa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,EAAEU,IADR;AAEE,IAAA,QAAQ,EAAEe,UAAU,GAAG,IAAH,GAAU,KAFhC;AAGE,IAAA,KAAK,EAAEF,SAHT;AAIE,IAAA,KAAK,EAAEX,KAJT;AAKE,IAAA,eAAe,EAAEC,eALnB;AAME,IAAA,KAAK,EAAEG;AANT,IANF,CAjBF,CADF;AAmCD,CAxED;;AA0EA,MAAMa,MAAM,GAAGK,wBAAWC,MAAX,CAAkB;AAC/BL,EAAAA,UAAU,EAAE;AACVE,IAAAA,UAAU,EAAE,QADF;AAEVI,IAAAA,cAAc,EAAE,cAFN;AAGVC,IAAAA,YAAY,EAAE,EAHJ;AAIVC,IAAAA,SAAS,EAAE,EAJD;AAKVC,IAAAA,UAAU,EAAE,EALF;AAMVN,IAAAA,IAAI,EAAE,CANI;AAOV,OAAGO,sBAASC,MAAT,CAAgB;AACjBC,MAAAA,GAAG,EAAE;AACHC,QAAAA,MAAM,EAAE,SADL;AAEHC,QAAAA,UAAU,EAAE;AAFT;AADY,KAAhB;AAPO,GADmB;AAe/BtC,EAAAA,KAAK,EAAE;AACL2B,IAAAA,IAAI,EAAE;AADD;AAfwB,CAAlB,CAAf;;eAoBexB,c","sourcesContent":["import * as React from \"react\";\nimport {\n StyleProp,\n ViewStyle,\n StyleSheet,\n TextStyle,\n View,\n Platform,\n} from \"react-native\";\nimport RadioButton, { RadioButtonProps } from \"./RadioButton\";\nimport Text from \"../Text\";\nimport { useRadioButtonGroupContext } from \"./context\";\nimport type { IconSlot } from \"../../interfaces/Icon\";\nimport { Direction as GroupDirection } from \"./context\";\nimport Touchable from \"../Touchable\";\nimport { extractStyles, getRealValue } from \"../../utilities\";\n\nexport enum Direction {\n Row = \"row\",\n RowReverse = \"row-reverse\",\n}\n\nexport interface RadioButtonRowProps extends Omit<RadioButtonProps, \"onPress\"> {\n label: string | React.ReactNode;\n value: string; // A string (or number that will be parsed String(number)) that this radio button row represents when selected\n color?: string;\n unselectedColor?: string;\n labelContainerStyle: StyleProp<ViewStyle>;\n radioButtonStyle?: StyleProp<ViewStyle>;\n labelStyle?: StyleProp<TextStyle>;\n onPress?: (value: string) => void;\n direction?: Direction;\n}\n\nconst getRadioButtonAlignment = (\n parentDirection: GroupDirection | undefined,\n direction: Direction\n) => {\n if (parentDirection === GroupDirection.Horizontal) {\n return direction === Direction.Row ? \"flex-start\" : \"flex-end\";\n } else if (direction === Direction.RowReverse) {\n return \"flex-start\";\n } else {\n return \"flex-end\";\n }\n};\n\nconst renderLabel = (\n label: string | React.ReactNode,\n labelStyle: StyleProp<TextStyle>,\n textStyle: StyleProp<TextStyle>\n) => {\n if (typeof label === \"string\") {\n return <Text style={[labelStyle, textStyle]}>{label}</Text>;\n } else {\n return <>{label}</>;\n }\n};\n\nconst RadioButtonRow: React.FC<RadioButtonRowProps & IconSlot> = ({\n Icon,\n label,\n value,\n color,\n unselectedColor,\n onPress,\n labelContainerStyle,\n labelStyle,\n radioButtonStyle,\n direction = Direction.Row,\n selected,\n disabled,\n style,\n ...rest\n}) => {\n const {\n value: contextValue,\n onValueChange,\n direction: parentDirection,\n } = useRadioButtonGroupContext();\n\n const realValue = getRealValue(value);\n const realContextValue = getRealValue(contextValue);\n const isSelected =\n selected ??\n (realContextValue && realValue && realContextValue === realValue);\n\n const handlePress = () => {\n if (realValue) {\n onPress?.(realValue);\n onValueChange?.(realValue);\n }\n };\n\n const { textStyles, viewStyles } = extractStyles(style);\n\n return (\n <Touchable\n onPress={handlePress}\n style={[styles.mainParent, { flexDirection: direction }, viewStyles]}\n disabled={disabled}\n {...rest}\n >\n <View\n style={[\n styles.label,\n {\n alignItems: direction === Direction.Row ? \"flex-start\" : \"flex-end\",\n },\n labelContainerStyle,\n ]}\n >\n {renderLabel(label, labelStyle, textStyles)}\n </View>\n <View\n style={{\n flex: 1,\n alignItems: getRadioButtonAlignment(parentDirection, direction),\n }}\n >\n <RadioButton\n Icon={Icon}\n selected={isSelected ? true : false}\n value={realValue}\n color={color}\n unselectedColor={unselectedColor}\n style={radioButtonStyle}\n />\n </View>\n </Touchable>\n );\n};\n\nconst styles = StyleSheet.create({\n mainParent: {\n alignItems: \"center\",\n justifyContent: \"space-around\",\n paddingStart: 20,\n minHeight: 50,\n paddingEnd: 20,\n flex: 1,\n ...Platform.select({\n web: {\n cursor: \"pointer\",\n userSelect: \"none\",\n },\n }),\n },\n label: {\n flex: 3,\n },\n});\n\nexport default RadioButtonRow;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA","sourcesContent":["export { default as RadioButton } from \"./RadioButton\";\nexport { default as RadioButtonGroup } from \"./RadioButtonGroup\";\nexport { default as RadioButtonRow } from \"./RadioButtonRow\";\nexport { default as RadioButtonFieldGroup } from \"./RadioButtonFieldGroup\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Swiper.
|
|
1
|
+
{"version":3,"sources":["Swiper.tsx"],"names":["Swiper","vertical","loop","timeout","from","prevTitle","nextTitle","prevTitleColor","nextTitleColor","dotsTouchable","dotColor","dotActiveColor","children","style","prevTitleStyle","color","nextTitleStyle","dotProps","badgeStyle","backgroundColor","dotActiveStyle"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;AAkBA,MAAMA,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,cAPc;AAQdC,IAAAA,cARc;AASdC,IAAAA,aAAa,GAAG,IATF;AAUdC,IAAAA,QAVc;AAWdC,IAAAA,cAXc;AAYdC,IAAAA,QAZc;AAadC,IAAAA;AAbc,GAAD;AAAA,sBAeb,6BAAC,iBAAD;AAAM,IAAA,KAAK,EAAEA;AAAb,kBACE,6BAAC,6BAAD;AACE,IAAA,IAAI,EAAET,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;AAGbQ,MAAAA,cAAc,EAAE;AAAEC,QAAAA,KAAK,EAAER;AAAT,OAHH;AAIbS,MAAAA,cAAc,EAAE;AAAED,QAAAA,KAAK,EAAEP;AAAT,OAJH;AAKbC,MAAAA,aALa;AAMb,UAAIC,QAAQ,GACR;AAAEO,QAAAA,QAAQ,EAAE;AAAEC,UAAAA,UAAU,EAAE;AAAEC,YAAAA,eAAe,EAAET;AAAnB;AAAd;AAAZ,OADQ,GAER,EAFJ,CANa;AASb,UAAIC,cAAc,GACd;AAAES,QAAAA,cAAc,EAAE;AAAED,UAAAA,eAAe,EAAER;AAAnB;AAAlB,OADc,GAEd,EAFJ;AATa;AALjB,KAmBGC,QAnBH,CADF,CAfa;AAAA,CAAf;;eAwCeZ,M","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 prevTitleColor?: string;\n nextTitleColor?: string;\n dotsTouchable?: boolean;\n dotColor?: string;\n dotActiveColor?: string;\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 prevTitleColor,\n nextTitleColor,\n dotsTouchable = true,\n dotColor,\n dotActiveColor,\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 prevTitleStyle: { color: prevTitleColor },\n nextTitleStyle: { color: nextTitleColor },\n dotsTouchable,\n ...(dotColor\n ? { dotProps: { badgeStyle: { backgroundColor: dotColor } } }\n : {}),\n ...(dotActiveColor\n ? { dotActiveStyle: { backgroundColor: dotActiveColor } }\n : {}),\n }}\n >\n {children}\n </SwiperComponent>\n </View>\n);\n\nexport default Swiper;\n"]}
|
|
@@ -11,6 +11,8 @@ var _reactNative = require("react-native");
|
|
|
11
11
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
14
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
|
+
|
|
14
16
|
function Touchable(_ref) {
|
|
15
17
|
let {
|
|
16
18
|
children,
|
|
@@ -19,22 +21,7 @@ function Touchable(_ref) {
|
|
|
19
21
|
style,
|
|
20
22
|
...props
|
|
21
23
|
} = _ref;
|
|
22
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, {
|
|
23
|
-
onPress: onPress,
|
|
24
|
-
disabled: disabled,
|
|
25
|
-
hitSlop: 8,
|
|
26
|
-
style: _ref2 => {
|
|
27
|
-
let {
|
|
28
|
-
pressed
|
|
29
|
-
} = _ref2;
|
|
30
|
-
return [{
|
|
31
|
-
opacity: pressed || disabled ? 0.75 : 1
|
|
32
|
-
}, style];
|
|
33
|
-
},
|
|
34
|
-
...props
|
|
35
|
-
}, children);
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=Touchable.js.mapElement(_reactNative.Pressable, _extends({
|
|
24
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, _extends({
|
|
38
25
|
onPress: onPress,
|
|
39
26
|
disabled: disabled,
|
|
40
27
|
hitSlop: 8,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Touchable.
|
|
1
|
+
{"version":3,"sources":["Touchable.tsx"],"names":["Touchable","children","disabled","onPress","style","props","pressed","opacity"],"mappings":";;;;;;;AAAA;;AACA;;;;;;AASe,SAASA,SAAT,OAML;AAAA,MANwB;AAChCC,IAAAA,QADgC;AAEhCC,IAAAA,QAFgC;AAGhCC,IAAAA,OAHgC;AAIhCC,IAAAA,KAJgC;AAKhC,OAAGC;AAL6B,GAMxB;AACR,sBACE,6BAAC,sBAAD;AACE,IAAA,OAAO,EAAEF,OADX;AAEE,IAAA,QAAQ,EAAED,QAFZ;AAGE,IAAA,OAAO,EAAE,CAHX;AAIE,IAAA,KAAK,EAAE,SAAiB;AAAA,UAAhB;AAAEI,QAAAA;AAAF,OAAgB;AACtB,aAAO,CACL;AACEC,QAAAA,OAAO,EAAED,OAAO,IAAIJ,QAAX,GAAsB,IAAtB,GAA6B;AADxC,OADK,EAILE,KAJK,CAAP;AAMD;AAXH,KAYMC,KAZN,GAcGJ,QAdH,CADF;AAkBD","sourcesContent":["import React from \"react\";\nimport { Pressable, ViewStyle, PressableProps } from \"react-native\";\n\ntype Props = {\n disabled?: boolean;\n children: React.ReactNode;\n style?: ViewStyle;\n onPress?: () => void;\n} & PressableProps;\n\nexport default function Touchable({\n children,\n disabled,\n onPress,\n style,\n ...props\n}: Props) {\n return (\n <Pressable\n onPress={onPress}\n disabled={disabled}\n hitSlop={8}\n style={({ pressed }) => {\n return [\n {\n opacity: pressed || disabled ? 0.75 : 1,\n },\n style,\n ];\n }}\n {...props}\n >\n {children}\n </Pressable>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["SafeAreaView.
|
|
1
|
+
{"version":3,"sources":["SafeAreaView.ts"],"names":["SEED_DATA","name","tag","description","category","COMPONENT_TYPES","deprecated","props","edges","group","GROUPS","basic","label","editable","required","formType","FORM_T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_TYPES,\n} from \"@draftbit/types\";\n\nexport const SEED_DATA = {\n name: \"SafeAreaView\",\n tag: \"SafeAreaView\",\n description: \"A basic View that handles safe area\",\n category: COMPONENT_TYPES.deprecated,\n props: {\n edges: {\n group: GROUPS.basic,\n name: \"edges\",\n label: \"edges\",\n description: \"Provides edges to be used by safe area view\",\n editable: true,\n required: false,\n formType: FORM_TYPES.flatArray,\n propType: PROP_TYPES.STRING,\n options: [\"right\", \"bottom\", \"left\", \"top\"],\n defaultValue: [\"right\", \"bottom\", \"left\", \"top\"],\n },\n mode: {\n group: GROUPS.basic,\n name: \"mode\",\n label: \"mode\",\n description: \"Mode used by safe area view\",\n editable: true,\n required: false,\n options: [\"padding\", \"margin\"],\n formType: FORM_TYPES.flatArray,\n propType: PROP_TYPES.STRING,\n defaultValue: \"padding\",\n },\n },\n};\n"]}
|
|
@@ -24,7 +24,9 @@ const SEED_DATA = {
|
|
|
24
24
|
}),
|
|
25
25
|
fieldName: (0, _types.createFieldNameProp)({
|
|
26
26
|
defaultValue: "ratingValue",
|
|
27
|
+
// this is the name of the variable declared on the screen in Draftbit
|
|
27
28
|
handlerPropName: "onPress",
|
|
29
|
+
// the change handler prop in this component
|
|
28
30
|
valuePropName: "rating" // the value prop in this component
|
|
29
31
|
|
|
30
32
|
}),
|
|
@@ -54,10 +56,4 @@ const SEED_DATA = {
|
|
|
54
56
|
}
|
|
55
57
|
};
|
|
56
58
|
exports.SEED_DATA = SEED_DATA;
|
|
57
|
-
//# sourceMappingURL=StarRating.js.mapactive Color",
|
|
58
|
-
defaultValue: "divider"
|
|
59
|
-
})
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
exports.SEED_DATA = SEED_DATA;
|
|
63
59
|
//# sourceMappingURL=StarRating.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["StarRating.
|
|
1
|
+
{"version":3,"sources":["StarRating.ts"],"names":["SEED_DATA","name","tag","description","category","COMPONENT_TYPES","button","triggers","Triggers","OnPress","props","starSize","label","defaultValue","min","max","step","fieldName","handlerPropName","valuePropName","maxStars","rating","group","GROUPS","data","isEditable","activeColor","inactiveColor"],"mappings":";;;;;;;AAAA;;AAUO,MAAMA,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,aADiB;AAEvBC,EAAAA,GAAG,EAAE,YAFkB;AAGvBC,EAAAA,WAAW,EAAE,yBAHU;AAIvBC,EAAAA,QAAQ,EAAEC,uBAAgBC,MAJH;AAKvBC,EAAAA,QAAQ,EAAE,CAACC,gBAASC,OAAV,CALa;AAMvBC,EAAAA,KAAK,EAAE;AACLC,IAAAA,QAAQ,EAAE,mCAAuB;AAC/BC,MAAAA,KAAK,EAAE,WADwB;AAE/BT,MAAAA,WAAW,EAAE,8BAFkB;AAG/BU,MAAAA,YAAY,EAAE,EAHiB;AAI/BC,MAAAA,GAAG,EAAE,CAJ0B;AAK/BC,MAAAA,GAAG,EAAE,EAL0B;AAM/BC,MAAAA,IAAI,EAAE;AANyB,KAAvB,CADL;AASLC,IAAAA,SAAS,EAAE,gCAAoB;AAC7BJ,MAAAA,YAAY,EAAE,aADe;AACA;AAC7BK,MAAAA,eAAe,EAAE,SAFY;AAED;AAC5BC,MAAAA,aAAa,EAAE,QAHc,CAGJ;;AAHI,KAApB,CATN;AAcLC,IAAAA,QAAQ,EAAE,mCAAuB;AAC/BR,MAAAA,KAAK,EAAE,WADwB;AAE/BT,MAAAA,WAAW,EAAE,yBAFkB;AAG/BU,MAAAA,YAAY,EAAE,CAHiB;AAI/BC,MAAAA,GAAG,EAAE,CAJ0B;AAK/BC,MAAAA,GAAG,EAAE,EAL0B;AAM/BC,MAAAA,IAAI,EAAE;AANyB,KAAvB,CAdL;AAsBLK,IAAAA,MAAM,EAAE,mCAAuB;AAC7BC,MAAAA,KAAK,EAAEC,cAAOC,IADe;AAE7BZ,MAAAA,KAAK,EAAE;AAFsB,KAAvB,CAtBH;AA0BLa,IAAAA,UAAU,EAAE,iCAAqB;AAC/Bb,MAAAA,KAAK,EAAE;AADwB,KAArB,CA1BP;AA6BLc,IAAAA,WAAW,EAAE,4BAAgB;AAC3Bd,MAAAA,KAAK,EAAE,cADoB;AAE3BC,MAAAA,YAAY,EAAE;AAFa,KAAhB,CA7BR;AAiCLc,IAAAA,aAAa,EAAE,4BAAgB;AAC7Bf,MAAAA,KAAK,EAAE,gBADsB;AAE7BC,MAAAA,YAAY,EAAE;AAFe,KAAhB;AAjCV;AANgB,CAAlB","sourcesContent":["import {\n COMPONENT_TYPES,\n createStaticNumberProp,\n createFieldNameProp,\n createStaticBoolProp,\n Triggers,\n createColorProp,\n GROUPS,\n} from \"@draftbit/types\";\n\nexport const SEED_DATA = {\n name: \"Star Rating\",\n tag: \"StarRating\",\n description: \"A star rating component\",\n category: COMPONENT_TYPES.button,\n triggers: [Triggers.OnPress],\n props: {\n starSize: createStaticNumberProp({\n label: \"Star size\",\n description: \"Size of each individual star\",\n defaultValue: 16,\n min: 8,\n max: 36,\n step: 1,\n }),\n fieldName: createFieldNameProp({\n defaultValue: \"ratingValue\", // this is the name of the variable declared on the screen in Draftbit\n handlerPropName: \"onPress\", // the change handler prop in this component\n valuePropName: \"rating\", // the value prop in this component\n }),\n maxStars: createStaticNumberProp({\n label: \"Max stars\",\n description: \"The max number of stars\",\n defaultValue: 5,\n min: 0,\n max: 10,\n step: 1,\n }),\n rating: createStaticNumberProp({\n group: GROUPS.data,\n label: \"Rating\",\n }),\n isEditable: createStaticBoolProp({\n label: \"Editable\",\n }),\n activeColor: createColorProp({\n label: \"Active Color\",\n defaultValue: \"primary\",\n }),\n inactiveColor: createColorProp({\n label: \"Inactive Color\",\n defaultValue: \"divider\",\n }),\n },\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Surface.
|
|
1
|
+
{"version":3,"sources":["Surface.ts"],"names":["SEED_DATA","name","tag","description","category","COMPONENT_TYPES","layout","minHeight","props","elevation"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,SADiB;AAEvBC,EAAAA,GAAG,EAAE,SAFkB;AAGvBC,EAAAA,WAAW,EAAE,uBAHU;AAIvBC,EAAAA,QAAQ,EAAEC,uBAAgBC,MAJH;AAKvBA,EAAAA,MAAM,EAAE;AACNC,IAAAA,SAAS,EAAE;AADL,GALe;AAQvBC,EAAAA,KAAK,EAAE;AACLC,IAAAA,SAAS,EAAE,gCAAoB,CAApB;AADN;AARgB,CAAlB","sourcesContent":["import { COMPONENT_TYPES, createElevationType } from \"@draftbit/types\";\n\nexport const SEED_DATA = {\n name: \"Surface\",\n tag: \"Surface\",\n description: \"An elevated container\",\n category: COMPONENT_TYPES.layout,\n layout: {\n minHeight: 40,\n },\n props: {\n elevation: createElevationType(0),\n },\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["WebView.
|
|
1
|
+
{"version":3,"sources":["WebView.ts"],"names":["SEED_DATA","name","tag","description","category","COMPONENT_TYPES","media","layout","flex","props","source","defaultValue"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,UADiB;AAEvBC,EAAAA,GAAG,EAAE,SAFkB;AAGvBC,EAAAA,WAAW,EAAE,kCAHU;AAIvBC,EAAAA,QAAQ,EAAEC,uBAAgBC,KAJH;AAKvBC,EAAAA,MAAM,EAAE;AAAEC,IAAAA,IAAI,EAAE;AAAR,GALe;AAMvBC,EAAAA,KAAK,EAAE;AACLC,IAAAA,MAAM,EAAE,6BAAiB;AACvBC,MAAAA,YAAY,EAAE;AADS,KAAjB;AADH;AANgB,CAAlB","sourcesContent":["import { COMPONENT_TYPES, createSourceProp } from \"@draftbit/types\";\n\nexport const SEED_DATA = {\n name: \"Web View\",\n tag: \"WebView\",\n description: \"Render web content inside a view\",\n category: COMPONENT_TYPES.media,\n layout: { flex: 1 },\n props: {\n source: createSourceProp({\n defaultValue: \"https://reactnative.dev\",\n }),\n },\n};\n"]}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.applyStyles = applyStyles;
|
|
7
7
|
exports.extractStyles = extractStyles;
|
|
8
|
+
exports.getRealValue = getRealValue;
|
|
8
9
|
|
|
9
10
|
var _reactNative = require("react-native");
|
|
10
11
|
|
|
@@ -71,4 +72,19 @@ function applyStyles(baseStyles, stylesToApply) {
|
|
|
71
72
|
|
|
72
73
|
return flattenedStyles;
|
|
73
74
|
}
|
|
75
|
+
|
|
76
|
+
function getRealValue(value) {
|
|
77
|
+
// console.log("getRealValue typeof", typeof value);
|
|
78
|
+
// console.log("getRealValue value", value);
|
|
79
|
+
switch (typeof value) {
|
|
80
|
+
case "string":
|
|
81
|
+
return value;
|
|
82
|
+
|
|
83
|
+
case "number":
|
|
84
|
+
return String(value);
|
|
85
|
+
|
|
86
|
+
default:
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
74
90
|
//# sourceMappingURL=utilities.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["utilities.ts"],"names":["extractStyles","style","color","fontFamily","fontWeight","fontSize","lineHeight","letterSpacing","textTransform","textAlign","textDecorationLine","textDecorationColor","textDecorationStyle","viewStyles","StyleSheet","flatten","textStyles","applyStyles","baseStyles","stylesToApply","flattenedStyles","key","value","Object","entries"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["utilities.ts"],"names":["extractStyles","style","color","fontFamily","fontWeight","fontSize","lineHeight","letterSpacing","textTransform","textAlign","textDecorationLine","textDecorationColor","textDecorationStyle","viewStyles","StyleSheet","flatten","textStyles","applyStyles","baseStyles","stylesToApply","flattenedStyles","key","value","Object","entries","getRealValue","String","undefined"],"mappings":";;;;;;;;;AAAA;;AAEO,SAASA,aAAT,CAAuBC,KAAvB,EAA8C;AACnD,QAAM;AACJC,IAAAA,KADI;AAEJC,IAAAA,UAFI;AAGJC,IAAAA,UA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AANJ;AAQD","sourcesContent":["import { StyleSheet, StyleProp, TextStyle } from \"react-native\";\n\nexport function extractStyles(style: StyleProp<any>) {\n const {\n color,\n fontFamily,\n fontWeight,\n fontSize,\n lineHeight,\n letterSpacing,\n textTransform,\n textAlign,\n textDecorationLine,\n textDecorationColor,\n textDecorationStyle,\n ...viewStyles\n } = StyleSheet.flatten(style || {});\n\n const textStyles: TextStyle = {\n color,\n fontFamily,\n fontWeight,\n fontSize,\n lineHeight,\n letterSpacing,\n textTransform,\n textAlign,\n textDecorationLine,\n textDecorationColor,\n textDecorationStyle,\n };\n\n return { viewStyles, textStyles };\n}\n\n/**\n * Merges a style object on top of another style object. In React Native,\n * keys with undefined values in a style object will still override styles\n * that appear earlier in a sequence. This avoids that problem.\n *\n * This lets us avoid the `...(something ? { something } : {})` pattern.\n * There doesn't seem to be a better way to do this. These all seem to not\n * work (i.e. they all result in `{ color: undefined }`:\n * `const mergedStyles = [{ color: \"red\" }, { color: undefined }]`\n * `const mergedStyles = StyleSheet.compose({ color: \"red\" }, { color: undefined })`\n * `const mergedStyles = StyleSheet.flatten([{ color: \"red\" }, { color: undefined }])`\n */\nexport function applyStyles(\n baseStyles: Array<StyleProp<any>>,\n stylesToApply: StyleProp<any> | undefined\n) {\n if (!stylesToApply) {\n return;\n }\n\n const flattenedStyles = StyleSheet.flatten(baseStyles);\n\n for (const [key, value] of Object.entries(stylesToApply)) {\n if (value != null) {\n flattenedStyles[key] = value;\n }\n }\n\n return flattenedStyles;\n}\n\nexport function getRealValue(value: any) {\n // console.log(\"getRealValue typeof\", typeof value);\n // console.log(\"getRealValue value\", value);\n switch (typeof value) {\n case \"string\":\n return value;\n case \"number\":\n return String(value);\n default:\n return undefined;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
1
|
+
{"version":3,"sources":["DatePickerComponentType.js"],"names":[],"mappings":"AAAA","sourcesContent":["export {};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Header.
|
|
1
|
+
{"version":3,"sources":["Header.tsx"],"names":["React","View","Text","StyleSheet","withTheme","Divider","Touchable","Config","Header","Icon","titleTypeStyle","titleColor","title","buttonText","dividerTopMargin","icon","onPress","style","theme","colors","typography","styles","container","topContainer","color","flex","alignSelf","marginLeft","buttonContainer","subtitle2","light","marginRight","headerIconSize","marginTop","create","flexDirection","justifyContent","alignItems"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SACEC,IADF,EAEEC,IAFF,EAGEC,UAHF,QAOO,cAPP;AAQA,SAASC,SAAT,QAA0B,YAA1B;AACA,OAAOC,OAAP,MAAoB,WAApB;AACA,OAAOC,SAAP,MAAsB,aAAtB;AACA,OAAOC,MAAP,MAAmB,UAAnB;;AAiBA,MAAMC,MAAuB,GAAG,QAW1B;AAAA,MAX2B;AAC/BC,IAAAA,IAD+B;AAE/BC,IAAAA,cAF+B;AAG/BC,IAAAA,UAH+B;AAI/BC,IAAAA,KAJ+B;AAK/BC,IAAAA,UAL+B;AAM/BC,IAAAA,gBAN+B;AAO/BC,IAAAA,IAP+B;AAQ/BC,IAAAA,OAR+B;AAS/BC,IAAAA,KAT+B;AAU/BC,IAAAA,KAAK,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA;AAAV;AAVwB,GAW3B;AACJ,sBACE,oBAAC,IAAD;AAAM,IAAA,KAAK,EAAE,CAACC,MAAM,CAACC,SAAR,EAAmBL,KAAnB;AAAb,kBACE,oBAAC,IAAD;AAAM,IAAA,KAAK,EAAEI,MAAM,CAACE;AAApB,kBACE,oBAAC,IAAD;AACE,IAAA,KAAK,EAAE,CACLb,cADK,EAEL;AACEc,MAAAA,KAAK,EAAEb,UADT;AAEEc,MAAAA,IAAI,EAAE;AAFR,KAFK,CADT;AAQE,IAAA,aAAa,EAAE;AARjB,KAUGb,KAVH,CADF,EAaGI,OAAO,iBACN,oBAAC,SAAD;AACE,IAAA,KAAK,EAAE;AAAEU,MAAAA,SAAS,EAAE,QAAb;AAAuBC,MAAAA,UAAU,EAAE;AAAnC,KADT;AAEE,IAAA,OAAO,EAAEX;AAFX,kBAIE,oBAAC,IAAD;AAAM,IAAA,KAAK,EAAEK,MAAM,CAACO;AAApB,kBACE,oBAAC,IAAD;AACE,IAAA,KAAK,EAAE,CACLR,UAAU,CAACS,SADN,EAEL;AACEL,MAAAA,KAAK,EAAEL,MAAM,CAACW,KADhB;AAEEC,MAAAA,WAAW,EAAE;AAFf,KAFK,CADT;AAQE,IAAA,aAAa,EAAE;AARjB,KAUGlB,UAVH,CADF,eAaE,oBAAC,IAAD;AACE,IAAA,IAAI,EAAEE,IADR;AAEE,IAAA,IAAI,EAAER,MAAM,CAACyB,cAFf;AAGE,IAAA,KAAK,EAAEb,MAAM,CAACW;AAHhB,IAbF,CAJF,CAdJ,CADF,eAyCE,oBAAC,OAAD;AAAS,IAAA,KAAK,EAAE;AAAEG,MAAAA,SAAS,EAAEnB,gBAAgB,IAAI;AAAjC;AAAhB,IAzCF,CADF;AA6CD,CAzDD;;AA2DA,MAAMO,MAAM,GAAGlB,UAAU,CAAC+B,MAAX,CAAkB;AAC/BZ,EAAAA,SAAS,EAAE;AACTI,IAAAA,SAAS,EAAE;AADF,GADoB;AAI/BH,EAAAA,YAAY,EAAE;AACZY,IAAAA,aAAa,EAAE,KADH;AAEZC,IAAAA,cAAc,EAAE,eAFJ;AAGZC,IAAAA,UAAU,EAAE;AAHA,GAJiB;AAS/BT,EAAAA,eAAe,EAAE;AACfO,IAAAA,aAAa,EAAE,KADA;AAEfC,IAAAA,cAAc,EAAE,QAFD;AAGfC,IAAAA,UAAU,EAAE;AAHG;AATc,CAAlB,CAAf;AAgBA,eAAejC,SAAS,CAACI,MAAD,CAAxB","sourcesContent":["import * as React from \"react\";\nimport {\n View,\n Text,\n StyleSheet,\n StyleProp,\n TextStyle,\n ViewStyle,\n} from \"react-native\";\nimport { withTheme } from \"../theming\";\nimport Divider from \"./Divider\";\nimport Touchable from \"./Touchable\";\nimport Config from \"./Config\";\n\nimport type { Theme } from \"../styles/DefaultTheme\";\nimport type { IconSlot } from \"../interfaces/Icon\";\n\ntype Props = {\n titleTypeStyle?: StyleProp<TextStyle>;\n titleColor: string;\n title: string;\n buttonText: string;\n dividerTopMargin?: number;\n icon: string;\n onPress: () => void;\n style?: StyleProp<ViewStyle>;\n theme: Theme;\n} & IconSlot;\n\nconst Header: React.FC<Props> = ({\n Icon,\n titleTypeStyle,\n titleColor,\n title,\n buttonText,\n dividerTopMargin,\n icon,\n onPress,\n style,\n theme: { colors, typography },\n}) => {\n return (\n <View style={[styles.container, style]}>\n <View style={styles.topContainer}>\n <Text\n style={[\n titleTypeStyle,\n {\n color: titleColor,\n flex: 1,\n },\n ]}\n numberOfLines={1}\n >\n {title}\n </Text>\n {onPress && (\n <Touchable\n style={{ alignSelf: \"center\", marginLeft: 12 }}\n onPress={onPress}\n >\n <View style={styles.buttonContainer}>\n <Text\n style={[\n typography.subtitle2,\n {\n color: colors.light,\n marginRight: 8,\n },\n ]}\n numberOfLines={1}\n >\n {buttonText}\n </Text>\n <Icon\n name={icon}\n size={Config.headerIconSize}\n color={colors.light}\n />\n </View>\n </Touchable>\n )}\n </View>\n <Divider style={{ marginTop: dividerTopMargin || 16 }} />\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {\n alignSelf: \"stretch\",\n },\n topContainer: {\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n },\n buttonContainer: {\n flexDirection: \"row\",\n justifyContent: \"center\",\n alignItems: \"center\",\n },\n});\n\nexport default withTheme(Header);\n"]}
|
|
@@ -3,6 +3,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import Config from "../Config";
|
|
5
5
|
import IconButton from "../IconButton";
|
|
6
|
+
import { getRealValue } from "../../utilities";
|
|
6
7
|
import { useRadioButtonGroupContext } from "./context";
|
|
7
8
|
|
|
8
9
|
const RadioButton = _ref => {
|
|
@@ -13,7 +14,7 @@ const RadioButton = _ref => {
|
|
|
13
14
|
value,
|
|
14
15
|
selected,
|
|
15
16
|
unselectedColor,
|
|
16
|
-
onPress
|
|
17
|
+
onPress,
|
|
17
18
|
size = Config.radioButtonSize,
|
|
18
19
|
selectedIcon = "MaterialIcons/radio-button-checked",
|
|
19
20
|
unselectedIcon = "MaterialIcons/radio-button-unchecked",
|
|
@@ -24,16 +25,17 @@ const RadioButton = _ref => {
|
|
|
24
25
|
value: contextValue,
|
|
25
26
|
onValueChange
|
|
26
27
|
} = useRadioButtonGroupContext();
|
|
28
|
+
const realValue = getRealValue(value);
|
|
29
|
+
const realContextValue = getRealValue(contextValue);
|
|
30
|
+
const isSelected = selected !== null && selected !== void 0 ? selected : realContextValue && realValue && realContextValue === realValue;
|
|
27
31
|
|
|
28
32
|
const handlePress = () => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
onValueChange(value);
|
|
33
|
+
if (realValue) {
|
|
34
|
+
onPress === null || onPress === void 0 ? void 0 : onPress(realValue);
|
|
35
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(realValue);
|
|
33
36
|
}
|
|
34
37
|
};
|
|
35
38
|
|
|
36
|
-
const isSelected = selected || contextValue != null && contextValue === value;
|
|
37
39
|
return /*#__PURE__*/React.createElement(IconButton, _extends({
|
|
38
40
|
Icon: Icon,
|
|
39
41
|
icon: isSelected ? selectedIcon : unselectedIcon,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["RadioButton.tsx"],"names":["React","Config","IconButton","useRadioButtonGroupContext","RadioButton","Icon","disabled","color","value","selected","unselectedColor","onPress","size","radioButtonSize","selectedIcon","unselectedIcon","style","rest","contextValue","onValueChange","
|
|
1
|
+
{"version":3,"sources":["RadioButton.tsx"],"names":["React","Config","IconButton","getRealValue","useRadioButtonGroupContext","RadioButton","Icon","disabled","color","value","selected","unselectedColor","onPress","size","radioButtonSize","selectedIcon","unselectedIcon","style","rest","contextValue","onValueChange","realValue","realContextValue","isSelected","handlePress"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAGA,OAAOC,MAAP,MAAmB,WAAnB;AACA,OAAOC,UAAP,MAAuB,eAAvB;AACA,SAASC,YAAT,QAA6B,iBAA7B;AACA,SAASC,0BAAT,QAA2C,WAA3C;;AAiBA,MAAMC,WAAuC,GAAG,QAa1C;AAAA,MAb2C;AAC/CC,IAAAA,IAD+C;AAE/CC,IAAAA,QAAQ,GAAG,KAFoC;AAG/CC,IAAAA,KAH+C;AAI/CC,IAAAA,KAJ+C;AAK/CC,IAAAA,QAL+C;AAM/CC,IAAAA,eAN+C;AAO/CC,IAAAA,OAP+C;AAQ/CC,IAAAA,IAAI,GAAGZ,MAAM,CAACa,eARiC;AAS/CC,IAAAA,YAAY,GAAG,oCATgC;AAU/CC,IAAAA,cAAc,GAAG,sCAV8B;AAW/CC,IAAAA,KAX+C;AAY/C,OAAGC;AAZ4C,GAa3C;AACJ,QAAM;AAAET,IAAAA,KAAK,EAAEU,YAAT;AAAuBC,IAAAA;AAAvB,MAAyChB,0BAA0B,EAAzE;AAEA,QAAMiB,SAAS,GAAGlB,YAAY,CAACM,KAAD,CAA9B;AACA,QAAMa,gBAAgB,GAAGnB,YAAY,CAACgB,YAAD,CAArC;AACA,QAAMI,UAAU,GACdb,QADc,aACdA,QADc,cACdA,QADc,GAEbY,gBAAgB,IAAID,SAApB,IAAiCC,gBAAgB,KAAKD,SAFzD;;AAIA,QAAMG,WAAW,GAAG,MAAM;AACxB,QAAIH,SAAJ,EAAe;AACbT,MAAAA,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAGS,SAAH,CAAP;AACAD,MAAAA,aAAa,SAAb,IAAAA,aAAa,WAAb,YAAAA,aAAa,CAAGC,SAAH,CAAb;AACD;AACF,GALD;;AAOA,sBACE,oBAAC,UAAD;AACE,IAAA,IAAI,EAAEf,IADR;AAEE,IAAA,IAAI,EAAEiB,UAAU,GAAGR,YAAH,GAAkBC,cAFpC;AAGE,IAAA,KAAK,EAAEO,UAAU,GAAGf,KAAH,GAAWG,eAH9B;AAIE,IAAA,QAAQ,EAAEJ,QAJZ;AAKE,IAAA,OAAO,EAAEiB,WALX;AAME,IAAA,IAAI,EAAEX,IANR;AAOE,IAAA,KAAK,EAAEI;AAPT,KAQMC,IARN,EADF;AAYD,CAzCD;;AA2CA,eAAeb,WAAf","sourcesContent":["import * as React from \"react\";\nimport { StyleProp, ViewStyle } from \"react-native\";\n\nimport Config from \"../Config\";\nimport IconButton from \"../IconButton\";\nimport { getRealValue } from \"../../utilities\";\nimport { useRadioButtonGroupContext } from \"./context\";\n\nimport type { IconSlot } from \"../../interfaces/Icon\";\n\nexport type RadioButtonProps = {\n selected?: boolean;\n disabled?: boolean;\n color?: string;\n value?: string;\n unselectedColor?: string;\n onPress?: (value: string) => void;\n style?: StyleProp<ViewStyle>;\n size?: number;\n selectedIcon?: string;\n unselectedIcon?: string;\n} & IconSlot;\n\nconst RadioButton: React.FC<RadioButtonProps> = ({\n Icon,\n disabled = false,\n color,\n value,\n selected,\n unselectedColor,\n onPress,\n size = Config.radioButtonSize,\n selectedIcon = \"MaterialIcons/radio-button-checked\",\n unselectedIcon = \"MaterialIcons/radio-button-unchecked\",\n style,\n ...rest\n}) => {\n const { value: contextValue, onValueChange } = useRadioButtonGroupContext();\n\n const realValue = getRealValue(value);\n const realContextValue = getRealValue(contextValue);\n const isSelected =\n selected ??\n (realContextValue && realValue && realContextValue === realValue);\n\n const handlePress = () => {\n if (realValue) {\n onPress?.(realValue);\n onValueChange?.(realValue);\n }\n };\n\n return (\n <IconButton\n Icon={Icon}\n icon={isSelected ? selectedIcon : unselectedIcon}\n color={isSelected ? color : unselectedColor}\n disabled={disabled}\n onPress={handlePress}\n size={size}\n style={style}\n {...rest}\n />\n );\n};\n\nexport default RadioButton;\n"]}
|
|
@@ -2,6 +2,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { View } from "react-native";
|
|
5
|
+
import { getRealValue } from "../../utilities";
|
|
5
6
|
import { radioButtonGroupContext, Direction } from "./context";
|
|
6
7
|
const {
|
|
7
8
|
Provider
|
|
@@ -11,27 +12,35 @@ const RadioButtonGroup = _ref => {
|
|
|
11
12
|
let {
|
|
12
13
|
direction = Direction.Vertical,
|
|
13
14
|
value,
|
|
14
|
-
onValueChange
|
|
15
|
+
onValueChange,
|
|
15
16
|
defaultValue,
|
|
16
17
|
style,
|
|
17
18
|
children,
|
|
18
19
|
...rest
|
|
19
20
|
} = _ref;
|
|
20
|
-
const [internalValue, setInternalValue] = React.useState(
|
|
21
|
+
const [internalValue, setInternalValue] = React.useState();
|
|
21
22
|
React.useEffect(() => {
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
const realValue = getRealValue(value);
|
|
24
|
+
|
|
25
|
+
if (realValue) {
|
|
26
|
+
setInternalValue(realValue);
|
|
24
27
|
}
|
|
25
28
|
}, [value]);
|
|
26
29
|
React.useEffect(() => {
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
const realDefaultValue = getRealValue(defaultValue);
|
|
31
|
+
|
|
32
|
+
if (realDefaultValue) {
|
|
33
|
+
setInternalValue(realDefaultValue);
|
|
29
34
|
}
|
|
30
35
|
}, [defaultValue]);
|
|
31
36
|
|
|
32
37
|
const handleValueChange = newValue => {
|
|
33
|
-
|
|
34
|
-
|
|
38
|
+
const realNewValue = getRealValue(newValue);
|
|
39
|
+
|
|
40
|
+
if (realNewValue) {
|
|
41
|
+
setInternalValue(newValue);
|
|
42
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue);
|
|
43
|
+
}
|
|
35
44
|
};
|
|
36
45
|
|
|
37
46
|
const _containerStyle = [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["RadioButtonGroup.tsx"],"names":["React","View","radioButtonGroupContext","Direction","Provider","RadioButtonGroup","direction","Vertical","value","onValueChange","defaultValue","style","children","rest","internalValue","setInternalValue","useState","useEffect","handleValueChange","newValue","_containerStyle","flexDirection","Horizontal","push","alignItems","minHeight"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,IAAT,QAA2C,cAA3C;AAEA,SAASC,uBAAT,EAAkCC,SAAlC,QAAmD,WAAnD;AAWA,MAAM;AAAEC,EAAAA;AAAF,IAAeF,uBAArB;;AAEA,MAAMG,gBAAiD,GAAG,QAQpD;AAAA,MARqD;AACzDC,IAAAA,SAAS,GAAGH,SAAS,CAACI,QADmC;AAEzDC,IAAAA,KAFyD;AAGzDC,IAAAA,
|
|
1
|
+
{"version":3,"sources":["RadioButtonGroup.tsx"],"names":["React","View","getRealValue","radioButtonGroupContext","Direction","Provider","RadioButtonGroup","direction","Vertical","value","onValueChange","defaultValue","style","children","rest","internalValue","setInternalValue","useState","useEffect","realValue","realDefaultValue","handleValueChange","newValue","realNewValue","_containerStyle","flexDirection","Horizontal","push","alignItems","minHeight"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,IAAT,QAA2C,cAA3C;AAEA,SAASC,YAAT,QAA6B,iBAA7B;AACA,SAASC,uBAAT,EAAkCC,SAAlC,QAAmD,WAAnD;AAWA,MAAM;AAAEC,EAAAA;AAAF,IAAeF,uBAArB;;AAEA,MAAMG,gBAAiD,GAAG,QAQpD;AAAA,MARqD;AACzDC,IAAAA,SAAS,GAAGH,SAAS,CAACI,QADmC;AAEzDC,IAAAA,KAFyD;AAGzDC,IAAAA,aAHyD;AAIzDC,IAAAA,YAJyD;AAKzDC,IAAAA,KALyD;AAMzDC,IAAAA,QANyD;AAOzD,OAAGC;AAPsD,GAQrD;AACJ,QAAM,CAACC,aAAD,EAAgBC,gBAAhB,IAAoChB,KAAK,CAACiB,QAAN,EAA1C;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,kBAOE,oBAAC,IAAD;AAAM,IAAA,KAAK,EAAEiB;AAAb,KAA+BX,QAA/B,CAPF,CADF,CADF;AAaD,CA/DD;;AAiEA,eAAeP,gBAAf","sourcesContent":["import * as React from \"react\";\nimport { View, StyleProp, ViewStyle } from \"react-native\";\nimport type { Theme } from \"../../styles/DefaultTheme\";\nimport { getRealValue } from \"../../utilities\";\nimport { radioButtonGroupContext, Direction } from \"./context\";\nexport interface RadioButtonGroupProps {\n direction?: Direction;\n style?: StyleProp<ViewStyle>;\n value?: string;\n onValueChange?: (value: string) => void;\n defaultValue?: string | number;\n theme: Theme;\n children: React.ReactNode;\n}\n\nconst { Provider } = radioButtonGroupContext;\n\nconst RadioButtonGroup: React.FC<RadioButtonGroupProps> = ({\n direction = Direction.Vertical,\n value,\n onValueChange,\n defaultValue,\n style,\n children,\n ...rest\n}) => {\n const [internalValue, setInternalValue] = React.useState<\n string | undefined\n >();\n\n React.useEffect(() => {\n const realValue = getRealValue(value);\n\n if (realValue) {\n setInternalValue(realValue);\n }\n }, [value]);\n\n React.useEffect(() => {\n const realDefaultValue = getRealValue(defaultValue);\n\n if (realDefaultValue) {\n setInternalValue(realDefaultValue);\n }\n }, [defaultValue]);\n\n const handleValueChange = (newValue: any) => {\n const realNewValue = getRealValue(newValue);\n\n if (realNewValue) {\n setInternalValue(newValue);\n onValueChange?.(newValue);\n }\n };\n\n const _containerStyle: StyleProp<ViewStyle> = [\n {\n flexDirection: direction === Direction.Horizontal ? \"row\" : \"column\",\n },\n ];\n\n if (direction !== Direction.Vertical) {\n _containerStyle.push({\n alignItems: \"center\",\n });\n }\n\n return (\n <View style={[{ minHeight: 40 }, style]} {...rest}>\n <Provider\n value={{\n value: internalValue || \"\",\n onValueChange: handleValueChange,\n direction,\n }}\n >\n <View style={_containerStyle}>{children}</View>\n </Provider>\n </View>\n );\n};\n\nexport default RadioButtonGroup;\n"]}
|
|
@@ -7,7 +7,7 @@ import Text from "../Text";
|
|
|
7
7
|
import { useRadioButtonGroupContext } from "./context";
|
|
8
8
|
import { Direction as GroupDirection } from "./context";
|
|
9
9
|
import Touchable from "../Touchable";
|
|
10
|
-
import { extractStyles } from "../../utilities";
|
|
10
|
+
import { extractStyles, getRealValue } from "../../utilities";
|
|
11
11
|
export let Direction;
|
|
12
12
|
|
|
13
13
|
(function (Direction) {
|
|
@@ -25,13 +25,13 @@ const getRadioButtonAlignment = (parentDirection, direction) => {
|
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
const renderLabel = (
|
|
29
|
-
if (typeof
|
|
28
|
+
const renderLabel = (label, labelStyle, textStyle) => {
|
|
29
|
+
if (typeof label === "string") {
|
|
30
30
|
return /*#__PURE__*/React.createElement(Text, {
|
|
31
31
|
style: [labelStyle, textStyle]
|
|
32
|
-
},
|
|
32
|
+
}, label);
|
|
33
33
|
} else {
|
|
34
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null,
|
|
34
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, label);
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
|
|
@@ -42,7 +42,7 @@ const RadioButtonRow = _ref => {
|
|
|
42
42
|
value,
|
|
43
43
|
color,
|
|
44
44
|
unselectedColor,
|
|
45
|
-
onPress
|
|
45
|
+
onPress,
|
|
46
46
|
labelContainerStyle,
|
|
47
47
|
labelStyle,
|
|
48
48
|
radioButtonStyle,
|
|
@@ -57,10 +57,15 @@ const RadioButtonRow = _ref => {
|
|
|
57
57
|
onValueChange,
|
|
58
58
|
direction: parentDirection
|
|
59
59
|
} = useRadioButtonGroupContext();
|
|
60
|
+
const realValue = getRealValue(value);
|
|
61
|
+
const realContextValue = getRealValue(contextValue);
|
|
62
|
+
const isSelected = selected !== null && selected !== void 0 ? selected : realContextValue && realValue && realContextValue === realValue;
|
|
60
63
|
|
|
61
64
|
const handlePress = () => {
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
if (realValue) {
|
|
66
|
+
onPress === null || onPress === void 0 ? void 0 : onPress(realValue);
|
|
67
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(realValue);
|
|
68
|
+
}
|
|
64
69
|
};
|
|
65
70
|
|
|
66
71
|
const {
|
|
@@ -84,10 +89,10 @@ const RadioButtonRow = _ref => {
|
|
|
84
89
|
}
|
|
85
90
|
}, /*#__PURE__*/React.createElement(RadioButton, {
|
|
86
91
|
Icon: Icon,
|
|
87
|
-
selected:
|
|
92
|
+
selected: isSelected ? true : false,
|
|
93
|
+
value: realValue,
|
|
88
94
|
color: color,
|
|
89
95
|
unselectedColor: unselectedColor,
|
|
90
|
-
onPress: handlePress,
|
|
91
96
|
style: radioButtonStyle
|
|
92
97
|
})));
|
|
93
98
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["RadioButtonRow.tsx"],"names":["React","StyleSheet","View","Platform","RadioButton","Text","useRadioButtonGroupContext","Direction","GroupDirection","Touchable","extractStyles","getRadioButtonAlignment","parentDirection","direction","Horizontal","Row","RowReverse","renderLabel","
|
|
1
|
+
{"version":3,"sources":["RadioButtonRow.tsx"],"names":["React","StyleSheet","View","Platform","RadioButton","Text","useRadioButtonGroupContext","Direction","GroupDirection","Touchable","extractStyles","getRealValue","getRadioButtonAlignment","parentDirection","direction","Horizontal","Row","RowReverse","renderLabel","label","labelStyle","textStyle","RadioButtonRow","Icon","value","color","unselectedColor","onPress","labelContainerStyle","radioButtonStyle","selected","disabled","style","rest","contextValue","onValueChange","realValue","realContextValue","isSelected","handlePress","textStyles","viewStyles","styles","mainParent","flexDirection","alignItems","flex","create","justifyContent","paddingStart","minHeight","paddingEnd","select","web","cursor","userSelect"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAGEC,UAHF,EAKEC,IALF,EAMEC,QANF,QAOO,cAPP;AAQA,OAAOC,WAAP,MAA8C,eAA9C;AACA,OAAOC,IAAP,MAAiB,SAAjB;AACA,SAASC,0BAAT,QAA2C,WAA3C;AA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EAAkBC,SAAlB;AAF9B;AADT,kBAME,oBAAC,WAAD;AACE,IAAA,IAAI,EAAES,IADR;AAEE,IAAA,QAAQ,EAAEe,UAAU,GAAG,IAAH,GAAU,KAFhC;AAGE,IAAA,KAAK,EAAEF,SAHT;AAIE,IAAA,KAAK,EAAEX,KAJT;AAKE,IAAA,eAAe,EAAEC,eALnB;AAME,IAAA,KAAK,EAAEG;AANT,IANF,CAjBF,CADF;AAmCD,CAxED;;AA0EA,MAAMa,MAAM,GAAGzC,UAAU,CAAC8C,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;AAMVL,IAAAA,IAAI,EAAE,CANI;AAOV,OAAG3C,QAAQ,CAACiD,MAAT,CAAgB;AACjBC,MAAAA,GAAG,EAAE;AACHC,QAAAA,MAAM,EAAE,SADL;AAEHC,QAAAA,UAAU,EAAE;AAFT;AADY,KAAhB;AAPO,GADmB;AAe/BpC,EAAAA,KAAK,EAAE;AACL2B,IAAAA,IAAI,EAAE;AADD;AAfwB,CAAlB,CAAf;AAoBA,eAAexB,cAAf","sourcesContent":["import * as React from \"react\";\nimport {\n StyleProp,\n ViewStyle,\n StyleSheet,\n TextStyle,\n View,\n Platform,\n} from \"react-native\";\nimport RadioButton, { RadioButtonProps } from \"./RadioButton\";\nimport Text from \"../Text\";\nimport { useRadioButtonGroupContext } from \"./context\";\nimport type { IconSlot } from \"../../interfaces/Icon\";\nimport { Direction as GroupDirection } from \"./context\";\nimport Touchable from \"../Touchable\";\nimport { extractStyles, getRealValue } from \"../../utilities\";\n\nexport enum Direction {\n Row = \"row\",\n RowReverse = \"row-reverse\",\n}\n\nexport interface RadioButtonRowProps extends Omit<RadioButtonProps, \"onPress\"> {\n label: string | React.ReactNode;\n value: string; // A string (or number that will be parsed String(number)) that this radio button row represents when selected\n color?: string;\n unselectedColor?: string;\n labelContainerStyle: StyleProp<ViewStyle>;\n radioButtonStyle?: StyleProp<ViewStyle>;\n labelStyle?: StyleProp<TextStyle>;\n onPress?: (value: string) => void;\n direction?: Direction;\n}\n\nconst getRadioButtonAlignment = (\n parentDirection: GroupDirection | undefined,\n direction: Direction\n) => {\n if (parentDirection === GroupDirection.Horizontal) {\n return direction === Direction.Row ? \"flex-start\" : \"flex-end\";\n } else if (direction === Direction.RowReverse) {\n return \"flex-start\";\n } else {\n return \"flex-end\";\n }\n};\n\nconst renderLabel = (\n label: string | React.ReactNode,\n labelStyle: StyleProp<TextStyle>,\n textStyle: StyleProp<TextStyle>\n) => {\n if (typeof label === \"string\") {\n return <Text style={[labelStyle, textStyle]}>{label}</Text>;\n } else {\n return <>{label}</>;\n }\n};\n\nconst RadioButtonRow: React.FC<RadioButtonRowProps & IconSlot> = ({\n Icon,\n label,\n value,\n color,\n unselectedColor,\n onPress,\n labelContainerStyle,\n labelStyle,\n radioButtonStyle,\n direction = Direction.Row,\n selected,\n disabled,\n style,\n ...rest\n}) => {\n const {\n value: contextValue,\n onValueChange,\n direction: parentDirection,\n } = useRadioButtonGroupContext();\n\n const realValue = getRealValue(value);\n const realContextValue = getRealValue(contextValue);\n const isSelected =\n selected ??\n (realContextValue && realValue && realContextValue === realValue);\n\n const handlePress = () => {\n if (realValue) {\n onPress?.(realValue);\n onValueChange?.(realValue);\n }\n };\n\n const { textStyles, viewStyles } = extractStyles(style);\n\n return (\n <Touchable\n onPress={handlePress}\n style={[styles.mainParent, { flexDirection: direction }, viewStyles]}\n disabled={disabled}\n {...rest}\n >\n <View\n style={[\n styles.label,\n {\n alignItems: direction === Direction.Row ? \"flex-start\" : \"flex-end\",\n },\n labelContainerStyle,\n ]}\n >\n {renderLabel(label, labelStyle, textStyles)}\n </View>\n <View\n style={{\n flex: 1,\n alignItems: getRadioButtonAlignment(parentDirection, direction),\n }}\n >\n <RadioButton\n Icon={Icon}\n selected={isSelected ? true : false}\n value={realValue}\n color={color}\n unselectedColor={unselectedColor}\n style={radioButtonStyle}\n />\n </View>\n </Touchable>\n );\n};\n\nconst styles = StyleSheet.create({\n mainParent: {\n alignItems: \"center\",\n justifyContent: \"space-around\",\n paddingStart: 20,\n minHeight: 50,\n paddingEnd: 20,\n flex: 1,\n ...Platform.select({\n web: {\n cursor: \"pointer\",\n userSelect: \"none\",\n },\n }),\n },\n label: {\n flex: 3,\n },\n});\n\nexport default RadioButtonRow;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ImageBackground.
|
|
1
|
+
{"version":3,"sources":["ImageBackground.js"],"names":["COMPONENT_TYPES","createImageProp","createResizeModeProp","createTextEnumProp","createColorProp","SEED_DATA","name","tag","doc_link","code_link","description","category","media","layout","width","height","props","source","defaultValue","resizeMode","backgroundColor","label","backfaceVisibility","options"],"mappings":"AAAA,SAASA,eAAT,EAA0BC,eAA1B,EAA2CC,oBAA3C,EAAiEC,kBAAjE,EAAqFC,eAArF,QAA6G,iBAA7G;AACA,OAAO,MAAMC,SAAS,GAAG;AACrBC,EAAAA,IAAI,EAAE,kBADe;AAErBC,EAAAA,GAAG,EAAE,iBAFgB;AAGrBC,EAAAA,QAAQ,EAAE,oEAHW;AAIrBC,EAAAA,SAAS,EAAE,yFAJU;AAKrBC,EAAAA,WAAW,EAAE,8FALQ;AAMrBC,EAAAA,QAAQ,EAAEX,eAAe,CAACY,KANL;AAOrBC,EAAAA,MAAM,EAAE;AACJC,IAAAA,KAAK,EAAE,MADH;AAEJC,IAAAA,MAAM,EAAE;AAFJ,GAPa;AAWrBC,EAAAA,KAAK,EAAE;AACHC,IAAAA,MAAM,EAAEhB,eAAe,CAAC;AACpBiB,MAAAA,YAAY,EAAE;AADM,KAAD,CADpB;AAIHC,IAAAA,UAAU,EAAEjB,oBAAoB,EAJ7B;AAKHkB,IAAAA,eAAe,EAAEhB,eAAe,CAAC;AAC7BiB,MAAAA,KAAK,EAAE,kBADsB;AAE7BX,MAAAA,WAAW,EAAE;AAFgB,KAAD,CAL7B;AASHY,IAAAA,kBAAkB,EAAEnB,kBAAkB,CAAC;AACnCkB,MAAAA,KAAK,EAAE,qBAD4B;AAEnCX,MAAAA,WAAW,EAAE,iDAFsB;AAGnCa,MAAAA,OAAO,EAAE,CAAC,SAAD,EAAY,QAAZ;AAH0B,KAAD;AATnC;AAXc,CAAlB","sourcesContent":["import { COMPONENT_TYPES, createImageProp, createResizeModeProp, createTextEnumProp, createColorProp, } from \"@draftbit/types\";\nexport const SEED_DATA = {\n name: \"Image Background\",\n tag: \"ImageBackground\",\n doc_link: \"https://docs.expo.io/versions/latest/react-native/imagebackground/\",\n code_link: \"https://github.com/facebook/react-native/blob/master/Libraries/Image/ImageBackground.js\",\n description: \"A very simple drop-in replacement for Image that allows you to use an Image as a background.\",\n category: COMPONENT_TYPES.media,\n layout: {\n width: \"100%\",\n height: \"100%\",\n },\n props: {\n source: createImageProp({\n defaultValue: \"https://static.draftbit.com/images/placeholder-image-background.png\",\n }),\n resizeMode: createResizeModeProp(),\n backgroundColor: createColorProp({\n label: \"Background Color\",\n description: \"If no image is chosen render a colored background.\",\n }),\n backfaceVisibility: createTextEnumProp({\n label: \"Backface Visibility\",\n description: \"When animating a card, show the back face of it\",\n options: [\"visible\", \"hidden\"],\n }),\n },\n};\n"]}
|