@draftbit/core 46.0.1-eb73d2.0 → 46.0.2
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/Carousel.js +1 -3
- package/lib/commonjs/components/Carousel.js.map +1 -1
- package/lib/commonjs/components/Checkbox/Checkbox.js.map +1 -1
- package/lib/commonjs/components/DatePicker/DatePickerComponent.web.js +3 -3
- package/lib/commonjs/components/DatePicker/DatePickerComponent.web.js.map +1 -1
- package/lib/commonjs/components/DeprecatedButton.js +4 -20
- package/lib/commonjs/components/DeprecatedButton.js.map +1 -1
- package/lib/commonjs/components/DeprecatedCardWrapper.js +2 -14
- package/lib/commonjs/components/DeprecatedCardWrapper.js.map +1 -1
- package/lib/commonjs/components/Justification.js +0 -3
- package/lib/commonjs/components/Picker/Picker.js +3 -3
- package/lib/commonjs/components/Picker/Picker.js.map +1 -1
- package/lib/commonjs/components/Picker/PickerComponent.android.js +2 -2
- package/lib/commonjs/components/Picker/PickerComponent.android.js.map +1 -1
- package/lib/commonjs/components/Picker/PickerComponent.ios.js +2 -2
- package/lib/commonjs/components/Picker/PickerComponent.ios.js.map +1 -1
- package/lib/commonjs/components/Picker/PickerComponent.web.js +2 -2
- package/lib/commonjs/components/Picker/PickerComponent.web.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButton.js +1 -1
- package/lib/commonjs/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButtonRow.js +1 -1
- package/lib/commonjs/components/RadioButton/RadioButtonRow.js.map +1 -1
- package/lib/commonjs/components/ResizeMode.js +0 -3
- package/lib/commonjs/components/Stepper.js +1 -1
- package/lib/commonjs/components/Stepper.js.map +1 -1
- package/lib/commonjs/mappings/KeyboardAvoidingView.js +2 -2
- package/lib/commonjs/mappings/KeyboardAvoidingView.js.map +1 -1
- package/lib/commonjs/mappings/RadioButtonGroup.js.map +1 -1
- package/lib/commonjs/mappings/RadioButtonRow.js.map +1 -1
- package/lib/module/components/Button.js +11 -32
- package/lib/module/components/Button.js.map +1 -1
- package/lib/module/components/Card.js.map +1 -1
- package/lib/module/components/Carousel.js +1 -3
- package/lib/module/components/Carousel.js.map +1 -1
- package/lib/module/components/Checkbox/Checkbox.js.map +1 -1
- package/lib/module/components/Checkbox/index.js.map +1 -1
- package/lib/module/components/CircleImage.js +2 -16
- package/lib/module/components/CircleImage.js.map +1 -1
- package/lib/module/components/DatePicker/DatePickerComponent.web.js +3 -3
- package/lib/module/components/DatePicker/DatePickerComponent.web.js.map +1 -1
- package/lib/module/components/DatePicker/DatePickerComponentType.js.map +1 -1
- package/lib/module/components/DeprecatedFAB.js +4 -20
- package/lib/module/components/DeprecatedFAB.js.map +1 -1
- package/lib/module/components/Justification.js +1 -1
- package/lib/module/components/NumberInput.js +2 -13
- package/lib/module/components/NumberInput.js.map +1 -1
- package/lib/module/components/Picker/Picker.js +3 -3
- package/lib/module/components/Picker/Picker.js.map +1 -1
- package/lib/module/components/Picker/PickerComponent.android.js +2 -2
- package/lib/module/components/Picker/PickerComponent.android.js.map +1 -1
- package/lib/module/components/Picker/PickerComponent.ios.js +2 -2
- package/lib/module/components/Picker/PickerComponent.ios.js.map +1 -1
- package/lib/module/components/Picker/PickerComponent.web.js +2 -2
- package/lib/module/components/Picker/PickerComponent.web.js.map +1 -1
- package/lib/module/components/Portal/PortalManager.js +1 -1
- package/lib/module/components/Portal/PortalManager.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButton.js +1 -1
- package/lib/module/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButtonGroup.js +4 -16
- package/lib/module/components/RadioButton/RadioButtonGroup.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButtonRow.js +7 -24
- package/lib/module/components/RadioButton/RadioButtonRow.js.map +1 -1
- package/lib/module/components/ResizeMode.js +1 -1
- package/lib/module/components/ScreenContainer.js +5 -21
- package/lib/module/components/ScreenContainer.js.map +1 -1
- package/lib/module/components/Stepper.js +1 -1
- package/lib/module/components/Stepper.js.map +1 -1
- package/lib/module/mappings/KeyboardAvoidingView.js +2 -2
- package/lib/module/mappings/KeyboardAvoidingView.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Checkbox/Checkbox.tsx +76 -77
- package/src/mappings/KeyboardAvoidingView.ts +2 -2
- package/src/Provider.js +0 -9
- package/src/components/Accordion/AccordionGroup.js +0 -44
- package/src/components/Accordion/AccordionItem.js +0 -32
- package/src/components/Accordion/index.js +0 -2
- package/src/components/ActionSheet/ActionSheet.js +0 -45
- package/src/components/ActionSheet/ActionSheetCancel.js +0 -6
- package/src/components/ActionSheet/ActionSheetItem.js +0 -30
- package/src/components/ActionSheet/index.js +0 -3
- package/src/components/AnimatedCircularProgress.js +0 -43
- package/src/components/AspectRatio.js +0 -18
- package/src/components/AvatarEdit.js +0 -30
- package/src/components/Banner.js +0 -109
- package/src/components/Button.js +0 -112
- package/src/components/Card.js +0 -57
- package/src/components/CardBlock.js +0 -54
- package/src/components/CardContainer.js +0 -69
- package/src/components/CardContainerRating.js +0 -79
- package/src/components/CardContainerShortImage.js +0 -33
- package/src/components/CardInline.js +0 -36
- package/src/components/Carousel.js +0 -66
- package/src/components/Checkbox/Checkbox.js +0 -63
- package/src/components/Checkbox/CheckboxGroup.js +0 -21
- package/src/components/Checkbox/CheckboxGroupRow.js +0 -77
- package/src/components/Checkbox/CheckboxRow.js +0 -78
- package/src/components/Checkbox/context.js +0 -14
- package/src/components/Checkbox/index.js +0 -3
- package/src/components/CircleImage.js +0 -8
- package/src/components/CircularProgress.js +0 -78
- package/src/components/Config.js +0 -63
- package/src/components/Container.js +0 -43
- package/src/components/DatePicker/DatePicker.js +0 -368
- package/src/components/DatePicker/DatePickerComponent.js +0 -13
- package/src/components/DatePicker/DatePickerComponent.web.js +0 -30
- package/src/components/DatePicker/DatePickerComponentType.js +0 -1
- package/src/components/DeprecatedButton.js +0 -95
- package/src/components/DeprecatedCardWrapper.js +0 -18
- package/src/components/DeprecatedFAB.js +0 -115
- package/src/components/Divider.js +0 -13
- package/src/components/Elevation.js +0 -20
- package/src/components/FAB.js +0 -46
- package/src/components/FieldSearchBarFull.js +0 -53
- package/src/components/FormRow.js +0 -19
- package/src/components/Header.js +0 -44
- package/src/components/HeaderLarge.js +0 -7
- package/src/components/HeaderMedium.js +0 -7
- package/src/components/HeaderOverline.js +0 -7
- package/src/components/IconButton.js +0 -35
- package/src/components/Image.js +0 -47
- package/src/components/Justification.js +0 -1
- package/src/components/Layout.js +0 -50
- package/src/components/NumberInput.js +0 -49
- package/src/components/Picker/Picker.js +0 -266
- package/src/components/Picker/PickerComponent.android.js +0 -68
- package/src/components/Picker/PickerComponent.ios.js +0 -78
- package/src/components/Picker/PickerComponent.web.js +0 -69
- package/src/components/Picker/PickerTypes.js +0 -1
- package/src/components/Portal/Portal.js +0 -35
- package/src/components/Portal/PortalConsumer.js +0 -28
- package/src/components/Portal/PortalHost.js +0 -105
- package/src/components/Portal/PortalManager.js +0 -29
- package/src/components/ProgressBar.js +0 -118
- package/src/components/ProgressCircle.js +0 -13
- package/src/components/ProgressIndicator.js +0 -27
- package/src/components/RadioButton/RadioButton.js +0 -17
- package/src/components/RadioButton/RadioButtonFieldGroup.js +0 -17
- package/src/components/RadioButton/RadioButtonGroup.js +0 -43
- package/src/components/RadioButton/RadioButtonRow.js +0 -76
- package/src/components/RadioButton/context.js +0 -14
- package/src/components/RadioButton/index.js +0 -4
- package/src/components/ResizeMode.js +0 -1
- package/src/components/Row.js +0 -48
- package/src/components/RowBodyIcon.js +0 -8
- package/src/components/RowHeadlineImageCaption.js +0 -12
- package/src/components/RowHeadlineImageIcon.js +0 -14
- package/src/components/ScreenContainer.js +0 -34
- package/src/components/Slider.js +0 -63
- package/src/components/StarRating.js +0 -50
- package/src/components/StepIndicator.js +0 -346
- package/src/components/Stepper.js +0 -39
- package/src/components/Surface.js +0 -32
- package/src/components/Swiper/Swiper.js +0 -29
- package/src/components/Swiper/SwiperItem.js +0 -9
- package/src/components/Swiper/index.js +0 -2
- package/src/components/Switch.js +0 -56
- package/src/components/Text.js +0 -28
- package/src/components/TextField.js +0 -420
- package/src/components/ToggleButton.js +0 -39
- package/src/components/Touchable.js +0 -12
- package/src/components/Touchable.web.js +0 -2
- package/src/components/Typography.js +0 -36
- package/src/components/useAuthState.js +0 -31
- package/src/constants.js +0 -10
- package/src/hooks.js +0 -12
- package/src/index.js +0 -52
- package/src/interfaces/Icon.js +0 -8
- package/src/mappings/Accordion.js +0 -41
- package/src/mappings/AccordionItem.js +0 -16
- package/src/mappings/ActionSheet.js +0 -13
- package/src/mappings/ActionSheetCancel.js +0 -19
- package/src/mappings/ActionSheetItem.js +0 -23
- package/src/mappings/ActivityIndicator.js +0 -53
- package/src/mappings/AudioPlayer.js +0 -20
- package/src/mappings/AvatarEdit.js +0 -37
- package/src/mappings/Banner.js +0 -32
- package/src/mappings/BlurView.js +0 -41
- package/src/mappings/Button.js +0 -56
- package/src/mappings/Card.js +0 -52
- package/src/mappings/CardBlock.js +0 -122
- package/src/mappings/CardContainer.js +0 -102
- package/src/mappings/CardContainerRating.js +0 -124
- package/src/mappings/CardContainerShortImage.js +0 -118
- package/src/mappings/CardInline.js +0 -51
- package/src/mappings/Carousel.js +0 -18
- package/src/mappings/Checkbox.js +0 -45
- package/src/mappings/CheckboxGroup.js +0 -25
- package/src/mappings/CheckboxRow.js +0 -56
- package/src/mappings/CircleImage.js +0 -24
- package/src/mappings/Container.js +0 -29
- package/src/mappings/CustomCode.js +0 -8
- package/src/mappings/DatePicker.js +0 -147
- package/src/mappings/Divider.js +0 -26
- package/src/mappings/FAB.js +0 -36
- package/src/mappings/Fetch.js +0 -12
- package/src/mappings/FieldSearchBarFull.js +0 -49
- package/src/mappings/FlatList.js +0 -19
- package/src/mappings/HeaderLarge.js +0 -28
- package/src/mappings/HeaderMedium.js +0 -54
- package/src/mappings/HeaderOverline.js +0 -54
- package/src/mappings/Icon.js +0 -25
- package/src/mappings/IconButton.js +0 -30
- package/src/mappings/Image.js +0 -15
- package/src/mappings/ImageBackground.js +0 -28
- package/src/mappings/KeyboardAvoidingView.js +0 -40
- package/src/mappings/KeyboardAwareScrollView.js +0 -49
- package/src/mappings/Layout.js +0 -195
- package/src/mappings/LinearGradient.js +0 -77
- package/src/mappings/MapCallout.js +0 -21
- package/src/mappings/MapMarker.js +0 -47
- package/src/mappings/MapView.js +0 -138
- package/src/mappings/Modal.js +0 -41
- package/src/mappings/Picker.js +0 -139
- package/src/mappings/ProgressBar.js +0 -100
- package/src/mappings/ProgressCircle.js +0 -108
- package/src/mappings/ProgressIndicator.js +0 -180
- package/src/mappings/RadioButton.js +0 -50
- package/src/mappings/RadioButtonGroup.js +0 -16
- package/src/mappings/RadioButtonRow.js +0 -37
- package/src/mappings/RowBodyIcon.js +0 -75
- package/src/mappings/RowHeadlineImageCaption.js +0 -167
- package/src/mappings/RowHeadlineImageIcon.js +0 -99
- package/src/mappings/SafeAreaView.js +0 -33
- package/src/mappings/ScrollView.js +0 -30
- package/src/mappings/Slider.js +0 -59
- package/src/mappings/StarRating.js +0 -42
- package/src/mappings/Stepper.js +0 -28
- package/src/mappings/Surface.js +0 -13
- package/src/mappings/Swiper.js +0 -60
- package/src/mappings/SwiperItem.js +0 -8
- package/src/mappings/Switch.js +0 -75
- package/src/mappings/Text.js +0 -232
- package/src/mappings/TextArea.js +0 -52
- package/src/mappings/TextField.js +0 -158
- package/src/mappings/TextInput.js +0 -208
- package/src/mappings/ToggleButton.js +0 -45
- package/src/mappings/Touchable.js +0 -12
- package/src/mappings/Video.js +0 -74
- package/src/mappings/View.js +0 -206
- package/src/mappings/WebView.js +0 -18
- package/src/styles/DarkTheme.js +0 -26
- package/src/styles/DefaultTheme.js +0 -111
- package/src/styles/fonts.js +0 -62
- package/src/styles/overlay.js +0 -60
- package/src/styles/shadow.js +0 -51
- package/src/theming.js +0 -3
- package/src/utilities.js +0 -102
|
@@ -30,7 +30,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
30
30
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
31
31
|
|
|
32
32
|
const Picker = _ref => {
|
|
33
|
-
var _options$find
|
|
33
|
+
var _options$find;
|
|
34
34
|
|
|
35
35
|
let {
|
|
36
36
|
style,
|
|
@@ -87,7 +87,7 @@ const Picker = _ref => {
|
|
|
87
87
|
};
|
|
88
88
|
|
|
89
89
|
const stylesWithoutMargin = style && (0, _lodash.default)(_reactNative.StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
|
|
90
|
-
const selectedLabel = selectedValue && ((
|
|
90
|
+
const selectedLabel = selectedValue && (((_options$find = options.find(o => o.value === selectedValue)) === null || _options$find === void 0 ? void 0 : _options$find.label) ?? selectedValue);
|
|
91
91
|
return /*#__PURE__*/React.createElement(_Touchable.default, {
|
|
92
92
|
disabled: disabled,
|
|
93
93
|
onPress: toggleFocus,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Picker","style","options","placeholder","selectedValue","disabled","onValueChange","onValueChangeOverride","props","viewStyles","borderRadius","borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderColor","backgroundColor","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","extractStyles","textField","React","useRef","undefined","itemValue","itemIndex","toggleFocus","current","stylesWithoutMargin","omit","StyleSheet","flatten","selectedLabel","find","o","value","label","styles","container","flex","opacity","position","top","left","right","bottom","width","map","create","alignSelf","withTheme"],"sources":["PickerComponent.web.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { View, StyleSheet } from \"react-native\";\nimport { Picker as NativePicker } from \"@react-native-picker/picker\";\nimport omit from \"lodash.omit\";\nimport { withTheme } from \"../../theming\";\nimport { extractStyles } from \"../../utilities\";\n\nimport TextField from \"../TextField\";\nimport Touchable from \"../Touchable\";\nimport { PickerComponentProps } from \"./PickerTypes\";\n\nconst Picker: React.FC<PickerComponentProps> = ({\n style,\n options,\n placeholder,\n selectedValue,\n disabled = false,\n onValueChange: onValueChangeOverride = () => {},\n ...props\n}) => {\n const {\n viewStyles: {\n borderRadius, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderTopWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderRightWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderBottomWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderLeftWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderColor, // eslint-disable-line @typescript-eslint/no-unused-vars\n backgroundColor, // eslint-disable-line @typescript-eslint/no-unused-vars\n padding, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingTop, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingRight, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingBottom, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingLeft, // eslint-disable-line @typescript-eslint/no-unused-vars\n ...viewStyles\n },\n } = extractStyles(style);\n\n const textField = React.useRef<typeof TextField | undefined>(undefined);\n\n const onValueChange = (itemValue: string, itemIndex: number) => {\n toggleFocus();\n onValueChangeOverride(itemValue, itemIndex);\n };\n\n const toggleFocus = () => {\n if (!disabled) {\n // @ts-ignore\n textField.current.toggleFocus(); // cannot determine if method exists due to component being wrapped in a withTheme()\n }\n };\n\n const stylesWithoutMargin =\n style &&\n omit(StyleSheet.flatten(style), [\n \"margin\",\n \"marginTop\",\n \"marginRight\",\n \"marginBottom\",\n \"marginLeft\",\n ]);\n\n const selectedLabel =\n selectedValue &&\n (options.find((o) => o.value === selectedValue)?.label ?? selectedValue);\n\n return (\n <Touchable\n disabled={disabled}\n onPress={toggleFocus}\n style={[styles.container, viewStyles]}\n >\n <View>\n <NativePicker\n enabled={!disabled}\n selectedValue={selectedValue}\n onValueChange={onValueChange}\n style={{\n flex: 1,\n opacity: 0,\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n width: \"100%\",\n }}\n >\n {options.map((o) => (\n <NativePicker.Item label={o.label} value={o.value} key={o.value} />\n ))}\n </NativePicker>\n <View pointerEvents=\"none\">\n <TextField\n {...props}\n value={selectedLabel}\n placeholder={placeholder}\n // @ts-ignore\n ref={textField} // cannot determine if ref is of correct type due to component being wrapped in a withTheme()\n disabled={disabled}\n // @ts-expect-error\n style={stylesWithoutMargin}\n />\n </View>\n </View>\n </Touchable>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {\n alignSelf: \"stretch\",\n },\n});\n\nexport default withTheme(Picker);\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAGA,MAAMA,MAAsC,GAAG,QAQzC;EAAA;;EAAA,IAR0C;IAC9CC,KAD8C;IAE9CC,OAF8C;IAG9CC,WAH8C;IAI9CC,aAJ8C;IAK9CC,QAAQ,GAAG,KALmC;IAM9CC,aAAa,EAAEC,qBAAqB,GAAG,MAAM,CAAE,CAND;IAO9C,GAAGC;EAP2C,CAQ1C;EACJ,MAAM;IACJC,UAAU,EAAE;MACVC,YADU;MACI;MACdC,WAFU;MAEG;MACbC,cAHU;MAGM;MAChBC,gBAJU;MAIQ;MAClBC,iBALU;MAKS;MACnBC,eANU;MAMO;MACjBC,WAPU;MAOG;MACbC,eARU;MAQO;MACjBC,OATU;MASD;MACTC,UAVU;MAUE;MACZC,YAXU;MAWI;MACdC,aAZU;MAYK;MACfC,WAbU;MAaG;MACb,GAAGb;IAdO;EADR,IAiBF,IAAAc,wBAAA,EAActB,KAAd,CAjBJ;EAmBA,MAAMuB,SAAS,GAAGC,KAAK,CAACC,MAAN,CAA2CC,SAA3C,CAAlB;;EAEA,MAAMrB,aAAa,GAAG,CAACsB,SAAD,EAAoBC,SAApB,KAA0C;IAC9DC,WAAW;IACXvB,qBAAqB,CAACqB,SAAD,EAAYC,SAAZ,CAArB;EACD,CAHD;;EAKA,MAAMC,WAAW,GAAG,MAAM;IACxB,IAAI,CAACzB,QAAL,EAAe;MACb;MACAmB,SAAS,CAACO,OAAV,CAAkBD,WAAlB,GAFa,CAEoB;IAClC;EACF,CALD;;EAOA,MAAME,mBAAmB,GACvB/B,KAAK,IACL,IAAAgC,eAAA,EAAKC,uBAAA,CAAWC,OAAX,CAAmBlC,KAAnB,CAAL,EAAgC,CAC9B,QAD8B,EAE9B,WAF8B,EAG9B,aAH8B,EAI9B,cAJ8B,EAK9B,YAL8B,CAAhC,CAFF;EAUA,MAAMmC,aAAa,GACjBhC,aAAa,
|
|
1
|
+
{"version":3,"names":["Picker","style","options","placeholder","selectedValue","disabled","onValueChange","onValueChangeOverride","props","viewStyles","borderRadius","borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderColor","backgroundColor","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","extractStyles","textField","React","useRef","undefined","itemValue","itemIndex","toggleFocus","current","stylesWithoutMargin","omit","StyleSheet","flatten","selectedLabel","find","o","value","label","styles","container","flex","opacity","position","top","left","right","bottom","width","map","create","alignSelf","withTheme"],"sources":["PickerComponent.web.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { View, StyleSheet } from \"react-native\";\nimport { Picker as NativePicker } from \"@react-native-picker/picker\";\nimport omit from \"lodash.omit\";\nimport { withTheme } from \"../../theming\";\nimport { extractStyles } from \"../../utilities\";\n\nimport TextField from \"../TextField\";\nimport Touchable from \"../Touchable\";\nimport { PickerComponentProps } from \"./PickerTypes\";\n\nconst Picker: React.FC<PickerComponentProps> = ({\n style,\n options,\n placeholder,\n selectedValue,\n disabled = false,\n onValueChange: onValueChangeOverride = () => {},\n ...props\n}) => {\n const {\n viewStyles: {\n borderRadius, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderTopWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderRightWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderBottomWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderLeftWidth, // eslint-disable-line @typescript-eslint/no-unused-vars\n borderColor, // eslint-disable-line @typescript-eslint/no-unused-vars\n backgroundColor, // eslint-disable-line @typescript-eslint/no-unused-vars\n padding, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingTop, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingRight, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingBottom, // eslint-disable-line @typescript-eslint/no-unused-vars\n paddingLeft, // eslint-disable-line @typescript-eslint/no-unused-vars\n ...viewStyles\n },\n } = extractStyles(style);\n\n const textField = React.useRef<typeof TextField | undefined>(undefined);\n\n const onValueChange = (itemValue: string, itemIndex: number) => {\n toggleFocus();\n onValueChangeOverride(itemValue, itemIndex);\n };\n\n const toggleFocus = () => {\n if (!disabled) {\n // @ts-ignore\n textField.current.toggleFocus(); // cannot determine if method exists due to component being wrapped in a withTheme()\n }\n };\n\n const stylesWithoutMargin =\n style &&\n omit(StyleSheet.flatten(style), [\n \"margin\",\n \"marginTop\",\n \"marginRight\",\n \"marginBottom\",\n \"marginLeft\",\n ]);\n\n const selectedLabel =\n selectedValue &&\n (options.find((o) => o.value === selectedValue)?.label ?? selectedValue);\n\n return (\n <Touchable\n disabled={disabled}\n onPress={toggleFocus}\n style={[styles.container, viewStyles]}\n >\n <View>\n <NativePicker\n enabled={!disabled}\n selectedValue={selectedValue}\n onValueChange={onValueChange}\n style={{\n flex: 1,\n opacity: 0,\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n width: \"100%\",\n }}\n >\n {options.map((o) => (\n <NativePicker.Item label={o.label} value={o.value} key={o.value} />\n ))}\n </NativePicker>\n <View pointerEvents=\"none\">\n <TextField\n {...props}\n value={selectedLabel}\n placeholder={placeholder}\n // @ts-ignore\n ref={textField} // cannot determine if ref is of correct type due to component being wrapped in a withTheme()\n disabled={disabled}\n // @ts-expect-error\n style={stylesWithoutMargin}\n />\n </View>\n </View>\n </Touchable>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {\n alignSelf: \"stretch\",\n },\n});\n\nexport default withTheme(Picker);\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAGA,MAAMA,MAAsC,GAAG,QAQzC;EAAA;;EAAA,IAR0C;IAC9CC,KAD8C;IAE9CC,OAF8C;IAG9CC,WAH8C;IAI9CC,aAJ8C;IAK9CC,QAAQ,GAAG,KALmC;IAM9CC,aAAa,EAAEC,qBAAqB,GAAG,MAAM,CAAE,CAND;IAO9C,GAAGC;EAP2C,CAQ1C;EACJ,MAAM;IACJC,UAAU,EAAE;MACVC,YADU;MACI;MACdC,WAFU;MAEG;MACbC,cAHU;MAGM;MAChBC,gBAJU;MAIQ;MAClBC,iBALU;MAKS;MACnBC,eANU;MAMO;MACjBC,WAPU;MAOG;MACbC,eARU;MAQO;MACjBC,OATU;MASD;MACTC,UAVU;MAUE;MACZC,YAXU;MAWI;MACdC,aAZU;MAYK;MACfC,WAbU;MAaG;MACb,GAAGb;IAdO;EADR,IAiBF,IAAAc,wBAAA,EAActB,KAAd,CAjBJ;EAmBA,MAAMuB,SAAS,GAAGC,KAAK,CAACC,MAAN,CAA2CC,SAA3C,CAAlB;;EAEA,MAAMrB,aAAa,GAAG,CAACsB,SAAD,EAAoBC,SAApB,KAA0C;IAC9DC,WAAW;IACXvB,qBAAqB,CAACqB,SAAD,EAAYC,SAAZ,CAArB;EACD,CAHD;;EAKA,MAAMC,WAAW,GAAG,MAAM;IACxB,IAAI,CAACzB,QAAL,EAAe;MACb;MACAmB,SAAS,CAACO,OAAV,CAAkBD,WAAlB,GAFa,CAEoB;IAClC;EACF,CALD;;EAOA,MAAME,mBAAmB,GACvB/B,KAAK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;IAPF;IAQE,KAAK,EAAE2B;EART,GADF,CApBF,CALF,CADF;AAyCD,CAjGD;;AAmGA,MAAMS,MAAM,GAAGP,uBAAA,CAAWkB,MAAX,CAAkB;EAC/BV,SAAS,EAAE;IACTW,SAAS,EAAE;EADF;AADoB,CAAlB,CAAf;;eAMe,IAAAC,kBAAA,EAAUtD,MAAV,C"}
|
|
@@ -44,7 +44,7 @@ const RadioButton = _ref => {
|
|
|
44
44
|
} = (0, _context.useRadioButtonGroupContext)();
|
|
45
45
|
const realValue = (0, _utilities.getValueForRadioButton)(value);
|
|
46
46
|
const realContextValue = (0, _utilities.getValueForRadioButton)(contextValue);
|
|
47
|
-
const isSelected = selected
|
|
47
|
+
const isSelected = selected ?? realContextValue === realValue;
|
|
48
48
|
|
|
49
49
|
const handlePress = () => {
|
|
50
50
|
onPress === null || onPress === void 0 ? void 0 : onPress(realValue);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RadioButton","Icon","disabled","color","value","selected","unselectedColor","onPress","size","Config","radioButtonSize","selectedIcon","unselectedIcon","style","rest","contextValue","onValueChange","useRadioButtonGroupContext","realValue","getValueForRadioButton","realContextValue","isSelected","handlePress"],"sources":["RadioButton.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { StyleProp, ViewStyle } from \"react-native\";\n\nimport Config from \"../Config\";\nimport IconButton from \"../IconButton\";\nimport { getValueForRadioButton } 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 | number;\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 = getValueForRadioButton(value);\n const realContextValue = getValueForRadioButton(contextValue);\n const isSelected = selected ?? realContextValue === realValue;\n\n const handlePress = () => {\n onPress?.(realValue);\n onValueChange?.(realValue);\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"],"mappings":";;;;;;;AAAA;;AAGA;;AACA;;AACA;;AACA;;;;;;;;;;AAiBA,MAAMA,WAAuC,GAAG,QAa1C;EAAA,IAb2C;IAC/CC,IAD+C;IAE/CC,QAAQ,GAAG,KAFoC;IAG/CC,KAH+C;IAI/CC,KAAK,GAAG,EAJuC;IAK/CC,QAL+C;IAM/CC,eAN+C;IAO/CC,OAP+C;IAQ/CC,IAAI,GAAGC,eAAA,CAAOC,eARiC;IAS/CC,YAAY,GAAG,oCATgC;IAU/CC,cAAc,GAAG,sCAV8B;IAW/CC,KAX+C;IAY/C,GAAGC;EAZ4C,CAa3C;EACJ,MAAM;IAAEV,KAAK,EAAEW,YAAT;IAAuBC;EAAvB,IAAyC,IAAAC,mCAAA,GAA/C;EAEA,MAAMC,SAAS,GAAG,IAAAC,iCAAA,EAAuBf,KAAvB,CAAlB;EACA,MAAMgB,gBAAgB,GAAG,IAAAD,iCAAA,EAAuBJ,YAAvB,CAAzB;EACA,MAAMM,UAAU,GAAGhB,
|
|
1
|
+
{"version":3,"names":["RadioButton","Icon","disabled","color","value","selected","unselectedColor","onPress","size","Config","radioButtonSize","selectedIcon","unselectedIcon","style","rest","contextValue","onValueChange","useRadioButtonGroupContext","realValue","getValueForRadioButton","realContextValue","isSelected","handlePress"],"sources":["RadioButton.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { StyleProp, ViewStyle } from \"react-native\";\n\nimport Config from \"../Config\";\nimport IconButton from \"../IconButton\";\nimport { getValueForRadioButton } 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 | number;\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 = getValueForRadioButton(value);\n const realContextValue = getValueForRadioButton(contextValue);\n const isSelected = selected ?? realContextValue === realValue;\n\n const handlePress = () => {\n onPress?.(realValue);\n onValueChange?.(realValue);\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"],"mappings":";;;;;;;AAAA;;AAGA;;AACA;;AACA;;AACA;;;;;;;;;;AAiBA,MAAMA,WAAuC,GAAG,QAa1C;EAAA,IAb2C;IAC/CC,IAD+C;IAE/CC,QAAQ,GAAG,KAFoC;IAG/CC,KAH+C;IAI/CC,KAAK,GAAG,EAJuC;IAK/CC,QAL+C;IAM/CC,eAN+C;IAO/CC,OAP+C;IAQ/CC,IAAI,GAAGC,eAAA,CAAOC,eARiC;IAS/CC,YAAY,GAAG,oCATgC;IAU/CC,cAAc,GAAG,sCAV8B;IAW/CC,KAX+C;IAY/C,GAAGC;EAZ4C,CAa3C;EACJ,MAAM;IAAEV,KAAK,EAAEW,YAAT;IAAuBC;EAAvB,IAAyC,IAAAC,mCAAA,GAA/C;EAEA,MAAMC,SAAS,GAAG,IAAAC,iCAAA,EAAuBf,KAAvB,CAAlB;EACA,MAAMgB,gBAAgB,GAAG,IAAAD,iCAAA,EAAuBJ,YAAvB,CAAzB;EACA,MAAMM,UAAU,GAAGhB,QAAQ,IAAIe,gBAAgB,KAAKF,SAApD;;EAEA,MAAMI,WAAW,GAAG,MAAM;IACxBf,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAGW,SAAH,CAAP;IACAF,aAAa,SAAb,IAAAA,aAAa,WAAb,YAAAA,aAAa,CAAGE,SAAH,CAAb;EACD,CAHD;;EAKA,oBACE,oBAAC,mBAAD;IACE,IAAI,EAAEjB,IADR;IAEE,IAAI,EAAEoB,UAAU,GAAGV,YAAH,GAAkBC,cAFpC;IAGE,KAAK,EAAES,UAAU,GAAGlB,KAAH,GAAWG,eAH9B;IAIE,QAAQ,EAAEJ,QAJZ;IAKE,OAAO,EAAEoB,WALX;IAME,IAAI,EAAEd,IANR;IAOE,KAAK,EAAEK;EAPT,GAQMC,IARN,EADF;AAYD,CArCD;;eAuCed,W"}
|
|
@@ -79,7 +79,7 @@ const RadioButtonRow = _ref => {
|
|
|
79
79
|
} = (0, _context.useRadioButtonGroupContext)();
|
|
80
80
|
const realValue = (0, _utilities.getValueForRadioButton)(value);
|
|
81
81
|
const realContextValue = (0, _utilities.getValueForRadioButton)(contextValue);
|
|
82
|
-
const isSelected = selected
|
|
82
|
+
const isSelected = selected ?? realContextValue === realValue;
|
|
83
83
|
|
|
84
84
|
const handlePress = () => {
|
|
85
85
|
onPress === null || onPress === void 0 ? void 0 : onPress(realValue);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Direction","getRadioButtonAlignment","parentDirection","direction","GroupDirection","Horizontal","Row","RowReverse","renderLabel","value","labelStyle","textStyle","RadioButtonRow","Icon","label","color","unselectedColor","onPress","labelContainerStyle","radioButtonStyle","selected","disabled","style","rest","contextValue","onValueChange","useRadioButtonGroupContext","realValue","getValueForRadioButton","realContextValue","isSelected","handlePress","textStyles","viewStyles","extractStyles","styles","mainParent","flexDirection","alignItems","flex","StyleSheet","create","justifyContent","paddingStart","minHeight","paddingEnd","display","Platform","select","web","cursor","userSelect"],"sources":["RadioButtonRow.tsx"],"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, getValueForRadioButton } 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 | number; // 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 value: string | React.ReactNode,\n labelStyle: StyleProp<TextStyle>,\n textStyle: StyleProp<TextStyle>\n) => {\n if (typeof value === \"string\") {\n return <Text style={[labelStyle, textStyle]}>{value}</Text>;\n } else {\n return <>{value}</>;\n }\n};\n\nconst RadioButtonRow: React.FC<RadioButtonRowProps & IconSlot> = ({\n Icon,\n label,\n value = \"\",\n color,\n unselectedColor,\n onPress,\n labelContainerStyle,\n labelStyle,\n radioButtonStyle,\n direction = Direction.Row,\n selected,\n disabled,\n style,\n ...rest\n}) => {\n const {\n value: contextValue,\n onValueChange,\n direction: parentDirection,\n } = useRadioButtonGroupContext();\n\n const realValue = getValueForRadioButton(value);\n const realContextValue = getValueForRadioButton(contextValue);\n const isSelected = selected ?? realContextValue === realValue;\n\n const handlePress = () => {\n onPress?.(realValue);\n onValueChange?.(realValue);\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}\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 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 RadioButtonRow;\n"],"mappings":";;;;;;;AAAA;;AACA;;AAQA;;AACA;;AACA;;AAGA;;AACA;;;;;;;;;;IAEYA,S;;;WAAAA,S;EAAAA,S;EAAAA,S;GAAAA,S,yBAAAA,S;;AAiBZ,MAAMC,uBAAuB,GAAG,CAC9BC,eAD8B,EAE9BC,SAF8B,KAG3B;EACH,IAAID,eAAe,KAAKE,kBAAA,CAAeC,UAAvC,EAAmD;IACjD,OAAOF,SAAS,KAAKH,SAAS,CAACM,GAAxB,GAA8B,YAA9B,GAA6C,UAApD;EACD,CAFD,MAEO,IAAIH,SAAS,KAAKH,SAAS,CAACO,UAA5B,EAAwC;IAC7C,OAAO,YAAP;EACD,CAFM,MAEA;IACL,OAAO,UAAP;EACD;AACF,CAXD;;AAaA,MAAMC,WAAW,GAAG,CAClBC,KADkB,EAElBC,UAFkB,EAGlBC,SAHkB,KAIf;EACH,IAAI,OAAOF,KAAP,KAAiB,QAArB,EAA+B;IAC7B,oBAAO,oBAAC,aAAD;MAAM,KAAK,EAAE,CAACC,UAAD,EAAaC,SAAb;IAAb,GAAuCF,KAAvC,CAAP;EACD,CAFD,MAEO;IACL,oBAAO,0CAAGA,KAAH,CAAP;EACD;AACF,CAVD;;AAYA,MAAMG,cAAwD,GAAG,QAe3D;EAAA,IAf4D;IAChEC,IADgE;IAEhEC,KAFgE;IAGhEL,KAAK,GAAG,EAHwD;IAIhEM,KAJgE;IAKhEC,eALgE;IAMhEC,OANgE;IAOhEC,mBAPgE;IAQhER,UARgE;IAShES,gBATgE;IAUhEhB,SAAS,GAAGH,SAAS,CAACM,GAV0C;IAWhEc,QAXgE;IAYhEC,QAZgE;IAahEC,KAbgE;IAchE,GAAGC;EAd6D,CAe5D;EACJ,MAAM;IACJd,KAAK,EAAEe,YADH;IAEJC,aAFI;IAGJtB,SAAS,EAAED;EAHP,IAIF,IAAAwB,mCAAA,GAJJ;EAMA,MAAMC,SAAS,GAAG,IAAAC,iCAAA,EAAuBnB,KAAvB,CAAlB;EACA,MAAMoB,gBAAgB,GAAG,IAAAD,iCAAA,EAAuBJ,YAAvB,CAAzB;EACA,MAAMM,UAAU,GAAGV,
|
|
1
|
+
{"version":3,"names":["Direction","getRadioButtonAlignment","parentDirection","direction","GroupDirection","Horizontal","Row","RowReverse","renderLabel","value","labelStyle","textStyle","RadioButtonRow","Icon","label","color","unselectedColor","onPress","labelContainerStyle","radioButtonStyle","selected","disabled","style","rest","contextValue","onValueChange","useRadioButtonGroupContext","realValue","getValueForRadioButton","realContextValue","isSelected","handlePress","textStyles","viewStyles","extractStyles","styles","mainParent","flexDirection","alignItems","flex","StyleSheet","create","justifyContent","paddingStart","minHeight","paddingEnd","display","Platform","select","web","cursor","userSelect"],"sources":["RadioButtonRow.tsx"],"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, getValueForRadioButton } 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 | number; // 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 value: string | React.ReactNode,\n labelStyle: StyleProp<TextStyle>,\n textStyle: StyleProp<TextStyle>\n) => {\n if (typeof value === \"string\") {\n return <Text style={[labelStyle, textStyle]}>{value}</Text>;\n } else {\n return <>{value}</>;\n }\n};\n\nconst RadioButtonRow: React.FC<RadioButtonRowProps & IconSlot> = ({\n Icon,\n label,\n value = \"\",\n color,\n unselectedColor,\n onPress,\n labelContainerStyle,\n labelStyle,\n radioButtonStyle,\n direction = Direction.Row,\n selected,\n disabled,\n style,\n ...rest\n}) => {\n const {\n value: contextValue,\n onValueChange,\n direction: parentDirection,\n } = useRadioButtonGroupContext();\n\n const realValue = getValueForRadioButton(value);\n const realContextValue = getValueForRadioButton(contextValue);\n const isSelected = selected ?? realContextValue === realValue;\n\n const handlePress = () => {\n onPress?.(realValue);\n onValueChange?.(realValue);\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}\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 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 RadioButtonRow;\n"],"mappings":";;;;;;;AAAA;;AACA;;AAQA;;AACA;;AACA;;AAGA;;AACA;;;;;;;;;;IAEYA,S;;;WAAAA,S;EAAAA,S;EAAAA,S;GAAAA,S,yBAAAA,S;;AAiBZ,MAAMC,uBAAuB,GAAG,CAC9BC,eAD8B,EAE9BC,SAF8B,KAG3B;EACH,IAAID,eAAe,KAAKE,kBAAA,CAAeC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E;MAFT;IADY,CAAhB;EAPO,CADmB;EAe/BrC,KAAK,EAAE;IACLyB,IAAI,EAAE;EADD;AAfwB,CAAlB,CAAf;;eAoBe3B,c"}
|
|
@@ -38,7 +38,7 @@ const Stepper = _ref => {
|
|
|
38
38
|
},
|
|
39
39
|
Icon
|
|
40
40
|
} = _ref;
|
|
41
|
-
const [value, setValue] = (0, _react.useState)(defaultValue
|
|
41
|
+
const [value, setValue] = (0, _react.useState)(defaultValue ?? 0);
|
|
42
42
|
|
|
43
43
|
const isValidValue = valueArg => valueArg >= min && valueArg <= max;
|
|
44
44
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Stepper","min","Infinity","max","value","valueProp","defaultValue","style","typeStyle","iconSize","iconColor","onChange","theme","colors","typography","Icon","setValue","useState","isValidValue","valueArg","handlePlusOrMinus","type","newValue","useEffect","isNumber","flexDirection","opacity","body1","textAlign","alignSelf","color","medium","marginHorizontal","withTheme"],"sources":["Stepper.tsx"],"sourcesContent":["import React, { FC, useEffect, useState } from \"react\";\nimport { View, Text, StyleProp, ViewStyle, TextStyle } from \"react-native\";\nimport { isNumber } from \"lodash\";\n\nimport { withTheme } from \"../theming\";\nimport type { Theme } from \"../styles/DefaultTheme\";\nimport type { IconSlot } from \"../interfaces/Icon\";\nimport IconButton from \"./IconButton\";\n\ntype Props = {\n min: number;\n max: number;\n value?: number;\n defaultValue?: number;\n style?: StyleProp<ViewStyle>;\n typeStyle?: StyleProp<TextStyle>;\n iconSize: number;\n iconColor?: string;\n onChange?: (value: number) => void;\n theme: Theme;\n} & IconSlot;\n\nconst Stepper: FC<Props> = ({\n min = -Infinity,\n max = Infinity,\n value: valueProp,\n defaultValue,\n style,\n typeStyle,\n iconSize = 24,\n iconColor,\n onChange,\n theme: { colors, typography },\n Icon,\n}) => {\n const [value, setValue] = useState(defaultValue ?? 0);\n\n const isValidValue = (valueArg: number) => valueArg >= min && valueArg <= max;\n\n const handlePlusOrMinus = (type: \"plus\" | \"minus\") => {\n const newValue = type === \"plus\" ? value + 1 : value - 1;\n\n if (isValidValue(newValue)) {\n setValue(newValue);\n onChange?.(newValue);\n }\n };\n\n useEffect(() => {\n if (\n valueProp != null &&\n isNumber(valueProp) &&\n valueProp !== value &&\n isValidValue(valueProp)\n ) {\n setValue(valueProp);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [valueProp]);\n\n return (\n <View style={[{ flexDirection: \"row\" }, style]}>\n <IconButton\n Icon={Icon}\n icon=\"MaterialIcons/remove\"\n onPress={() => handlePlusOrMinus(\"minus\")}\n size={iconSize}\n color={iconColor}\n disabled={value === min}\n style={{ opacity: value === min ? 0.5 : 1 }}\n />\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}\n </Text>\n\n <IconButton\n Icon={Icon}\n icon=\"MaterialIcons/add\"\n onPress={() => handlePlusOrMinus(\"plus\")}\n size={iconSize}\n color={iconColor}\n disabled={value === max}\n style={{ opacity: value === max ? 0.5 : 1 }}\n />\n </View>\n );\n};\n\nexport default withTheme(Stepper);\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;AAGA;;;;;;;;AAeA,MAAMA,OAAkB,GAAG,QAYrB;EAAA,IAZsB;IAC1BC,GAAG,GAAG,CAACC,QADmB;IAE1BC,GAAG,GAAGD,QAFoB;IAG1BE,KAAK,EAAEC,SAHmB;IAI1BC,YAJ0B;IAK1BC,KAL0B;IAM1BC,SAN0B;IAO1BC,QAAQ,GAAG,EAPe;IAQ1BC,SAR0B;IAS1BC,QAT0B;IAU1BC,KAAK,EAAE;MAAEC,MAAF;MAAUC;IAAV,CAVmB;IAW1BC;EAX0B,CAYtB;EACJ,MAAM,CAACX,KAAD,EAAQY,QAAR,IAAoB,IAAAC,eAAA,EAASX,
|
|
1
|
+
{"version":3,"names":["Stepper","min","Infinity","max","value","valueProp","defaultValue","style","typeStyle","iconSize","iconColor","onChange","theme","colors","typography","Icon","setValue","useState","isValidValue","valueArg","handlePlusOrMinus","type","newValue","useEffect","isNumber","flexDirection","opacity","body1","textAlign","alignSelf","color","medium","marginHorizontal","withTheme"],"sources":["Stepper.tsx"],"sourcesContent":["import React, { FC, useEffect, useState } from \"react\";\nimport { View, Text, StyleProp, ViewStyle, TextStyle } from \"react-native\";\nimport { isNumber } from \"lodash\";\n\nimport { withTheme } from \"../theming\";\nimport type { Theme } from \"../styles/DefaultTheme\";\nimport type { IconSlot } from \"../interfaces/Icon\";\nimport IconButton from \"./IconButton\";\n\ntype Props = {\n min: number;\n max: number;\n value?: number;\n defaultValue?: number;\n style?: StyleProp<ViewStyle>;\n typeStyle?: StyleProp<TextStyle>;\n iconSize: number;\n iconColor?: string;\n onChange?: (value: number) => void;\n theme: Theme;\n} & IconSlot;\n\nconst Stepper: FC<Props> = ({\n min = -Infinity,\n max = Infinity,\n value: valueProp,\n defaultValue,\n style,\n typeStyle,\n iconSize = 24,\n iconColor,\n onChange,\n theme: { colors, typography },\n Icon,\n}) => {\n const [value, setValue] = useState(defaultValue ?? 0);\n\n const isValidValue = (valueArg: number) => valueArg >= min && valueArg <= max;\n\n const handlePlusOrMinus = (type: \"plus\" | \"minus\") => {\n const newValue = type === \"plus\" ? value + 1 : value - 1;\n\n if (isValidValue(newValue)) {\n setValue(newValue);\n onChange?.(newValue);\n }\n };\n\n useEffect(() => {\n if (\n valueProp != null &&\n isNumber(valueProp) &&\n valueProp !== value &&\n isValidValue(valueProp)\n ) {\n setValue(valueProp);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [valueProp]);\n\n return (\n <View style={[{ flexDirection: \"row\" }, style]}>\n <IconButton\n Icon={Icon}\n icon=\"MaterialIcons/remove\"\n onPress={() => handlePlusOrMinus(\"minus\")}\n size={iconSize}\n color={iconColor}\n disabled={value === min}\n style={{ opacity: value === min ? 0.5 : 1 }}\n />\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}\n </Text>\n\n <IconButton\n Icon={Icon}\n icon=\"MaterialIcons/add\"\n onPress={() => handlePlusOrMinus(\"plus\")}\n size={iconSize}\n color={iconColor}\n disabled={value === max}\n style={{ opacity: value === max ? 0.5 : 1 }}\n />\n </View>\n );\n};\n\nexport default withTheme(Stepper);\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;AAGA;;;;;;;;AAeA,MAAMA,OAAkB,GAAG,QAYrB;EAAA,IAZsB;IAC1BC,GAAG,GAAG,CAACC,QADmB;IAE1BC,GAAG,GAAGD,QAFoB;IAG1BE,KAAK,EAAEC,SAHmB;IAI1BC,YAJ0B;IAK1BC,KAL0B;IAM1BC,SAN0B;IAO1BC,QAAQ,GAAG,EAPe;IAQ1BC,SAR0B;IAS1BC,QAT0B;IAU1BC,KAAK,EAAE;MAAEC,MAAF;MAAUC;IAAV,CAVmB;IAW1BC;EAX0B,CAYtB;EACJ,MAAM,CAACX,KAAD,EAAQY,QAAR,IAAoB,IAAAC,eAAA,EAASX,YAAY,IAAI,CAAzB,CAA1B;;EAEA,MAAMY,YAAY,GAAIC,QAAD,IAAsBA,QAAQ,IAAIlB,GAAZ,IAAmBkB,QAAQ,IAAIhB,GAA1E;;EAEA,MAAMiB,iBAAiB,GAAIC,IAAD,IAA4B;IACpD,MAAMC,QAAQ,GAAGD,IAAI,KAAK,MAAT,GAAkBjB,KAAK,GAAG,CAA1B,GAA8BA,KAAK,GAAG,CAAvD;;IAEA,IAAIc,YAAY,CAACI,QAAD,CAAhB,EAA4B;MAC1BN,QAAQ,CAACM,QAAD,CAAR;MACAX,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAGW,QAAH,CAAR;IACD;EACF,CAPD;;EASA,IAAAC,gBAAA,EAAU,MAAM;IACd,IACElB,SAAS,IAAI,IAAb,IACA,IAAAmB,gB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|
|
11
11
|
name: "Keyboard Avoiding View",
|
|
12
12
|
tag: "KeyboardAvoidingView",
|
|
13
13
|
description: "View that moves out of the way of the virtual keyboard. ",
|
|
14
|
-
category: _types.COMPONENT_TYPES.
|
|
14
|
+
category: _types.COMPONENT_TYPES.layout,
|
|
15
15
|
props: {
|
|
16
16
|
enabled: {
|
|
17
|
-
label: "
|
|
17
|
+
label: "Enabled",
|
|
18
18
|
description: "Enable the keyboard avoiding view",
|
|
19
19
|
editable: true,
|
|
20
20
|
required: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SEED_DATA","name","tag","description","category","COMPONENT_TYPES","
|
|
1
|
+
{"version":3,"names":["SEED_DATA","name","tag","description","category","COMPONENT_TYPES","layout","props","enabled","label","editable","required","defaultValue","formType","FORM_TYPES","boolean","propType","PROP_TYPES","BOOLEAN","group","GROUPS","basic","behavior","options","flatArray","STRING","keyboardVerticalOffset","number","NUMBER"],"sources":["KeyboardAvoidingView.ts"],"sourcesContent":["import {\n COMPONENT_TYPES,\n FORM_TYPES,\n PROP_TYPES,\n GROUPS,\n} from \"@draftbit/types\";\n\nexport const SEED_DATA = {\n name: \"Keyboard Avoiding View\",\n tag: \"KeyboardAvoidingView\",\n description: \"View that moves out of the way of the virtual keyboard. \",\n category: COMPONENT_TYPES.layout,\n props: {\n enabled: {\n label: \"Enabled\",\n description: \"Enable the keyboard avoiding view\",\n editable: true,\n required: true,\n defaultValue: true,\n formType: FORM_TYPES.boolean,\n propType: PROP_TYPES.BOOLEAN,\n group: GROUPS.basic,\n },\n behavior: {\n label: \"Resizing Behavior\",\n description:\n \"The behavior for how the keyboard resizing interacts with the rest of the screen. (Default: padding).\",\n editable: true,\n required: true,\n defaultValue: \"padding\",\n options: [\"padding\", \"position\", \"height\"],\n formType: FORM_TYPES.flatArray,\n propType: PROP_TYPES.STRING,\n group: GROUPS.basic,\n },\n keyboardVerticalOffset: {\n label: \"Keyboard Vertical Offset\",\n description:\n \"The distance between the bottom of the view and the keyboard\",\n editable: true,\n required: false,\n defaultValue: 0,\n formType: FORM_TYPES.number,\n propType: PROP_TYPES.NUMBER,\n group: GROUPS.basic,\n },\n },\n};\n"],"mappings":";;;;;;;AAAA;;AAOO,MAAMA,SAAS,GAAG;EACvBC,IAAI,EAAE,wBADiB;EAEvBC,GAAG,EAAE,sBAFkB;EAGvBC,WAAW,EAAE,0DAHU;EAIvBC,QAAQ,EAAEC,sBAAA,CAAgBC,MAJH;EAKvBC,KAAK,EAAE;IACLC,OAAO,EAAE;MACPC,KAAK,EAAE,SADA;MAEPN,WAAW,EAAE,mCAFN;MAGPO,QAAQ,EAAE,IAHH;MAIPC,QAAQ,EAAE,IAJH;MAKPC,YAAY,EAAE,IALP;MAMPC,QAAQ,EAAEC,iBAAA,CAAWC,OANd;MAOPC,QAAQ,EAAEC,iBAAA,CAAWC,OAPd;MAQPC,KAAK,EAAEC,aAAA,CAAOC;IARP,CADJ;IAWLC,QAAQ,EAAE;MACRb,KAAK,EAAE,mBADC;MAERN,WAAW,EACT,uGAHM;MAIRO,QAAQ,EAAE,IAJF;MAKRC,QAAQ,EAAE,IALF;MAMRC,YAAY,EAAE,SANN;MAORW,OAAO,EAAE,CAAC,SAAD,EAAY,UAAZ,EAAwB,QAAxB,CAPD;MAQRV,QAAQ,EAAEC,iBAAA,CAAWU,SARb;MASRR,QAAQ,EAAEC,iBAAA,CAAWQ,MATb;MAURN,KAAK,EAAEC,aAAA,CAAOC;IAVN,CAXL;IAuBLK,sBAAsB,EAAE;MACtBjB,KAAK,EAAE,0BADe;MAEtBN,WAAW,EACT,8DAHoB;MAItBO,QAAQ,EAAE,IAJY;MAKtBC,QAAQ,EAAE,KALY;MAMtBC,YAAY,EAAE,CANQ;MAOtBC,QAAQ,EAAEC,iBAAA,CAAWa,MAPC;MAQtBX,QAAQ,EAAEC,iBAAA,CAAWW,MARC;MAStBT,KAAK,EAAEC,aAAA,CAAOC;IATQ;EAvBnB;AALgB,CAAlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SEED_DATA","name","tag","category","COMPONENT_TYPES","input","layout","triggers","Triggers","OnValueChange","props","direction","createDirectionProp","fieldName","createFieldNameProp","handlerPropName","valuePropName","defaultValue"],"sources":["RadioButtonGroup.
|
|
1
|
+
{"version":3,"names":["SEED_DATA","name","tag","category","COMPONENT_TYPES","input","layout","triggers","Triggers","OnValueChange","props","direction","createDirectionProp","fieldName","createFieldNameProp","handlerPropName","valuePropName","defaultValue"],"sources":["RadioButtonGroup.ts"],"sourcesContent":["import {\n COMPONENT_TYPES,\n createFieldNameProp,\n createDirectionProp,\n Triggers,\n} from \"@draftbit/types\";\n\nexport const SEED_DATA = {\n name: \"Radio Button Group\",\n tag: \"RadioButtonGroup\",\n category: COMPONENT_TYPES.input,\n layout: {},\n triggers: [Triggers.OnValueChange],\n props: {\n direction: createDirectionProp(),\n fieldName: createFieldNameProp({\n handlerPropName: \"onValueChange\",\n valuePropName: \"value\",\n defaultValue: \"radioButtonGroupValue\",\n }),\n },\n};\n"],"mappings":";;;;;;;AAAA;;AAOO,MAAMA,SAAS,GAAG;EACvBC,IAAI,EAAE,oBADiB;EAEvBC,GAAG,EAAE,kBAFkB;EAGvBC,QAAQ,EAAEC,sBAAA,CAAgBC,KAHH;EAIvBC,MAAM,EAAE,EAJe;EAKvBC,QAAQ,EAAE,CAACC,eAAA,CAASC,aAAV,CALa;EAMvBC,KAAK,EAAE;IACLC,SAAS,EAAE,IAAAC,0BAAA,GADN;IAELC,SAAS,EAAE,IAAAC,0BAAA,EAAoB;MAC7BC,eAAe,EAAE,eADY;MAE7BC,aAAa,EAAE,OAFc;MAG7BC,YAAY,EAAE;IAHe,CAApB;EAFN;AANgB,CAAlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SEED_DATA","name","tag","category","COMPONENT_TYPES","input","layout","props","label","createTextProp","description","required","defaultValue","direction","createTextEnumProp","options","value","color","createColorProp","group","GROUPS","basic","unselectedColor"],"sources":["RadioButtonRow.
|
|
1
|
+
{"version":3,"names":["SEED_DATA","name","tag","category","COMPONENT_TYPES","input","layout","props","label","createTextProp","description","required","defaultValue","direction","createTextEnumProp","options","value","color","createColorProp","group","GROUPS","basic","unselectedColor"],"sources":["RadioButtonRow.ts"],"sourcesContent":["import {\n createTextProp,\n createTextEnumProp,\n COMPONENT_TYPES,\n createColorProp,\n GROUPS,\n} from \"@draftbit/types\";\n\nexport const SEED_DATA = {\n name: \"Radio Button Row\",\n tag: \"RadioButtonRow\",\n category: COMPONENT_TYPES.input,\n layout: {},\n props: {\n label: createTextProp({\n label: \"Label\",\n description: \"Label to show with the radio button\",\n required: true,\n defaultValue: \"First Option\",\n }),\n direction: createTextEnumProp({\n label: \"Direction\",\n description:\n \"Whether the checkbox will appear on the left or on the right\",\n options: [\"row\", \"row-reverse\"],\n }),\n value: createTextProp({\n label: \"Value\",\n description: \"Value of the radio button\",\n defaultValue: null,\n required: true,\n }),\n color: createColorProp({\n group: GROUPS.basic,\n description: \"Color for the button\",\n defaultValue: \"primary\",\n }),\n unselectedColor: createColorProp({\n group: GROUPS.basic,\n label: \"Unselected Color\",\n description: \"Unselected Color for the button\",\n defaultValue: \"primary\",\n }),\n },\n};\n"],"mappings":";;;;;;;AAAA;;AAQO,MAAMA,SAAS,GAAG;EACvBC,IAAI,EAAE,kBADiB;EAEvBC,GAAG,EAAE,gBAFkB;EAGvBC,QAAQ,EAAEC,sBAAA,CAAgBC,KAHH;EAIvBC,MAAM,EAAE,EAJe;EAKvBC,KAAK,EAAE;IACLC,KAAK,EAAE,IAAAC,qBAAA,EAAe;MACpBD,KAAK,EAAE,OADa;MAEpBE,WAAW,EAAE,qCAFO;MAGpBC,QAAQ,EAAE,IAHU;MAIpBC,YAAY,EAAE;IAJM,CAAf,CADF;IAOLC,SAAS,EAAE,IAAAC,yBAAA,EAAmB;MAC5BN,KAAK,EAAE,WADqB;MAE5BE,WAAW,EACT,8DAH0B;MAI5BK,OAAO,EAAE,CAAC,KAAD,EAAQ,aAAR;IAJmB,CAAnB,CAPN;IAaLC,KAAK,EAAE,IAAAP,qBAAA,EAAe;MACpBD,KAAK,EAAE,OADa;MAEpBE,WAAW,EAAE,2BAFO;MAGpBE,YAAY,EAAE,IAHM;MAIpBD,QAAQ,EAAE;IAJU,CAAf,CAbF;IAmBLM,KAAK,EAAE,IAAAC,sBAAA,EAAgB;MACrBC,KAAK,EAAEC,aAAA,CAAOC,KADO;MAErBX,WAAW,EAAE,sBAFQ;MAGrBE,YAAY,EAAE;IAHO,CAAhB,CAnBF;IAwBLU,eAAe,EAAE,IAAAJ,sBAAA,EAAgB;MAC/BC,KAAK,EAAEC,aAAA,CAAOC,KADiB;MAE/Bb,KAAK,EAAE,kBAFwB;MAG/BE,WAAW,EAAE,iCAHkB;MAI/BE,YAAY,EAAE;IAJiB,CAAhB;EAxBZ;AALgB,CAAlB"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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 { Text, Pressable, Platform, StyleSheet, ActivityIndicator } from "react-native";
|
|
3
5
|
import { withTheme } from "../theming";
|
|
@@ -55,7 +57,7 @@ function Base(_ref) {
|
|
|
55
57
|
buttonStyles.justifyContent = "flex-end";
|
|
56
58
|
}
|
|
57
59
|
|
|
58
|
-
return /*#__PURE__*/React.createElement(Pressable, {
|
|
60
|
+
return /*#__PURE__*/React.createElement(Pressable, _extends({
|
|
59
61
|
onPress: onPress,
|
|
60
62
|
disabled: disabled || loading,
|
|
61
63
|
style: _ref2 => {
|
|
@@ -65,9 +67,8 @@ function Base(_ref) {
|
|
|
65
67
|
return [styles.base, {
|
|
66
68
|
opacity: pressed || disabled ? 0.75 : 1
|
|
67
69
|
}, buttonStyles];
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
}, loading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
|
|
70
|
+
}
|
|
71
|
+
}, props), loading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
|
|
71
72
|
size: "small",
|
|
72
73
|
color: color,
|
|
73
74
|
style: styles.loading
|
|
@@ -87,14 +88,13 @@ const Solid = _ref3 => {
|
|
|
87
88
|
theme,
|
|
88
89
|
...props
|
|
89
90
|
} = _ref3;
|
|
90
|
-
return /*#__PURE__*/React.createElement(Base, {
|
|
91
|
+
return /*#__PURE__*/React.createElement(Base, _extends({
|
|
91
92
|
style: [{
|
|
92
93
|
color: "#FFF",
|
|
93
94
|
borderRadius: theme.roundness,
|
|
94
95
|
backgroundColor: theme.colors.primary
|
|
95
|
-
}, style]
|
|
96
|
-
|
|
97
|
-
});
|
|
96
|
+
}, style]
|
|
97
|
+
}, props));
|
|
98
98
|
};
|
|
99
99
|
|
|
100
100
|
const ButtonSolid = withTheme(Solid);
|
|
@@ -106,14 +106,13 @@ const Outline = _ref4 => {
|
|
|
106
106
|
theme,
|
|
107
107
|
...props
|
|
108
108
|
} = _ref4;
|
|
109
|
-
return /*#__PURE__*/React.createElement(Base, {
|
|
109
|
+
return /*#__PURE__*/React.createElement(Base, _extends({
|
|
110
110
|
style: [styles.outline, {
|
|
111
111
|
borderRadius: theme.roundness,
|
|
112
112
|
borderColor: theme.colors.primary,
|
|
113
113
|
color: theme.colors.primary
|
|
114
|
-
}, style]
|
|
115
|
-
|
|
116
|
-
});
|
|
114
|
+
}, style]
|
|
115
|
+
}, props));
|
|
117
116
|
};
|
|
118
117
|
|
|
119
118
|
const ButtonOutline = withTheme(Outline);
|
|
@@ -161,24 +160,4 @@ const styles = StyleSheet.create({
|
|
|
161
160
|
})
|
|
162
161
|
}
|
|
163
162
|
});
|
|
164
|
-
//# sourceMappingURL=Button.js.map: 0,
|
|
165
|
-
minHeight: undefined
|
|
166
|
-
},
|
|
167
|
-
loading: {
|
|
168
|
-
marginRight: 6
|
|
169
|
-
},
|
|
170
|
-
icon: { ...Platform.select({
|
|
171
|
-
web: {
|
|
172
|
-
marginTop: 1,
|
|
173
|
-
marginRight: 4,
|
|
174
|
-
alignSelf: "center"
|
|
175
|
-
},
|
|
176
|
-
default: {
|
|
177
|
-
marginBottom: 2,
|
|
178
|
-
marginRight: 4,
|
|
179
|
-
alignSelf: "center"
|
|
180
|
-
}
|
|
181
|
-
})
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
163
|
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Text","Pressable","Platform","StyleSheet","ActivityIndicator","withTheme","CONSTANTS","baseHeight","borderRadius","padding","icon","Base","Icon","title","onPress","loading","disabled","style","props","color","fontFamily","fontWeight","fontSize","lineHeight","letterSpacing","textTransform","textAlign","textDecorationLine","textDecorationColor","textDecorationStyle","buttonStyles","flatten","titleStyles","justifyContent","
|
|
1
|
+
{"version":3,"names":["React","Text","Pressable","Platform","StyleSheet","ActivityIndicator","withTheme","CONSTANTS","baseHeight","borderRadius","padding","icon","Base","Icon","title","onPress","loading","disabled","style","props","color","fontFamily","fontWeight","fontSize","lineHeight","letterSpacing","textTransform","textAlign","textDecorationLine","textDecorationColor","textDecorationStyle","buttonStyles","flatten","titleStyles","justifyContent","pressed","styles","base","opacity","Solid","theme","roundness","backgroundColor","colors","primary","ButtonSolid","Outline","outline","borderColor","ButtonOutline","create","position","flexDirection","alignItems","minHeight","paddingHorizontal","select","web","cursor","userSelect","borderWidth","bare","undefined","marginRight","marginTop","alignSelf","default","marginBottom"],"sources":["Button.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {\n Text,\n Pressable,\n Platform,\n StyleSheet,\n TextStyle,\n PressableProps,\n ActivityIndicator,\n} from \"react-native\";\n\nimport { withTheme } from \"../theming\";\n\nimport type { Theme } from \"../styles/DefaultTheme\";\nimport type { IconSlot } from \"../interfaces/Icon\";\n\nconst CONSTANTS = {\n baseHeight: 42,\n borderRadius: 4,\n padding: 8,\n icon: 24,\n};\n\ntype BaseProps = {\n title: string;\n disabled: boolean;\n loading: boolean;\n style?: TextStyle;\n onPress: () => void;\n icon?: string;\n} & PressableProps &\n IconSlot;\n\ntype Props = {\n title: string;\n disabled: boolean;\n loading: boolean;\n style?: TextStyle;\n onPress: () => void;\n icon?: string;\n theme: Theme;\n} & PressableProps &\n IconSlot;\n\nfunction Base({\n Icon,\n icon,\n title,\n onPress,\n loading,\n disabled,\n style,\n ...props\n}: BaseProps): JSX.Element {\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 ...buttonStyles\n } = StyleSheet.flatten(style || ({} as TextStyle));\n\n const titleStyles: 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 if (textAlign === \"left\") {\n buttonStyles.justifyContent = \"flex-start\";\n }\n\n if (textAlign === \"right\") {\n buttonStyles.justifyContent = \"flex-end\";\n }\n\n return (\n <Pressable\n onPress={onPress}\n disabled={disabled || loading}\n style={({ pressed }) => {\n return [\n styles.base,\n {\n opacity: pressed || disabled ? 0.75 : 1,\n },\n buttonStyles,\n ];\n }}\n {...props}\n >\n {loading ? (\n <ActivityIndicator size=\"small\" color={color} style={styles.loading} />\n ) : null}\n {icon && !loading ? (\n <Icon\n name={icon}\n color={color as string}\n style={styles.icon}\n size={CONSTANTS.icon}\n />\n ) : null}\n <Text style={titleStyles}>{title}</Text>\n </Pressable>\n );\n}\n\nconst Solid = ({ style, theme, ...props }: Props): JSX.Element => {\n return (\n <Base\n style={[\n {\n color: \"#FFF\",\n borderRadius: theme.roundness,\n backgroundColor: theme.colors.primary,\n },\n style,\n ]}\n {...props}\n />\n );\n};\n\nconst ButtonSolid: any = withTheme(Solid);\nexport { ButtonSolid };\n\nconst Outline = ({ style, theme, ...props }: Props): JSX.Element => {\n return (\n <Base\n style={[\n styles.outline,\n {\n borderRadius: theme.roundness,\n borderColor: theme.colors.primary,\n color: theme.colors.primary,\n },\n style,\n ]}\n {...props}\n />\n );\n};\n\nconst ButtonOutline: any = withTheme(Outline);\nexport { ButtonOutline };\n\nconst styles = StyleSheet.create({\n base: {\n position: \"relative\",\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"center\",\n minHeight: CONSTANTS.baseHeight,\n paddingHorizontal: 12,\n fontFamily: \"System\",\n fontWeight: \"700\",\n ...Platform.select({\n web: {\n cursor: \"pointer\",\n userSelect: \"none\",\n },\n }),\n },\n outline: {\n backgroundColor: \"transparent\",\n borderWidth: 1,\n },\n bare: {\n backgroundColor: \"transparent\",\n padding: 0,\n minHeight: undefined,\n },\n loading: {\n marginRight: 6,\n },\n icon: {\n ...Platform.select({\n web: {\n marginTop: 1,\n marginRight: 4,\n alignSelf: \"center\",\n },\n default: {\n marginBottom: 2,\n marginRight: 4,\n alignSelf: \"center\",\n },\n }),\n },\n});\n"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SACEC,IADF,EAEEC,SAFF,EAGEC,QAHF,EAIEC,UAJF,EAOEC,iBAPF,QAQO,cARP;AAUA,SAASC,SAAT,QAA0B,YAA1B;AAKA,MAAMC,SAAS,GAAG;EAChBC,UAAU,EAAE,EADI;EAEhBC,YAAY,EAAE,CAFE;EAGhBC,OAAO,EAAE,CAHO;EAIhBC,IAAI,EAAE;AAJU,CAAlB;;AA4BA,SAASC,IAAT,OAS2B;EAAA,IATb;IACZC,IADY;IAEZF,IAFY;IAGZG,KAHY;IAIZC,OAJY;IAKZC,OALY;IAMZC,QANY;IAOZC,KAPY;IAQZ,GAAGC;EARS,CASa;EACzB,MAAM;IACJC,KADI;IAEJC,UAFI;IAGJC,UAHI;IAIJC,Q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,CAACqD,MAAT,CAAgB;MACjBC,GAAG,EAAE;QACHC,MAAM,EAAE,SADL;QAEHC,UAAU,EAAE;MAFT;IADY,CAAhB;EATC,CADyB;EAiB/BZ,OAAO,EAAE;IACPL,eAAe,EAAE,aADV;IAEPkB,WAAW,EAAE;EAFN,CAjBsB;EAqB/BC,IAAI,EAAE;IACJnB,eAAe,EAAE,aADb;IAEJhC,OAAO,EAAE,CAFL;IAGJ4C,SAAS,EAAEQ;EAHP,CArByB;EA0B/B9C,OAAO,EAAE;IACP+C,WAAW,EAAE;EADN,CA1BsB;EA6B/BpD,IAAI,EAAE,EACJ,GAAGR,QAAQ,CAACqD,MAAT,CAAgB;MACjBC,GAAG,EAAE;QACHO,SAAS,EAAE,CADR;QAEHD,WAAW,EAAE,CAFV;QAGHE,SAAS,EAAE;MAHR,CADY;MAMjBC,OAAO,EAAE;QACPC,YAAY,EAAE,CADP;QAEPJ,WAAW,EAAE,CAFN;QAGPE,SAAS,EAAE;MAHJ;IANQ,CAAhB;EADC;AA7ByB,CAAlB,CAAf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","StyleSheet","View","Pressable","Image","Surface","Title","Subtitle","Caption","withTheme","Config","ICON_SIZE","cardIconSize","ICON_CONTAINER_SIZE","ICON_CONTAINER_PADDING","ICON_ELEVATION","cardIconElevation","TopRightCircleIcon","Icon","icon","theme","onPress","
|
|
1
|
+
{"version":3,"names":["React","StyleSheet","View","Pressable","Image","Surface","Title","Subtitle","Caption","withTheme","Config","ICON_SIZE","cardIconSize","ICON_CONTAINER_SIZE","ICON_CONTAINER_PADDING","ICON_ELEVATION","cardIconElevation","TopRightCircleIcon","Icon","icon","theme","onPress","justifyContent","alignItems","elevation","position","top","right","width","height","padding","borderRadius","backgroundColor","pressed","opacity","colors","surface","Card","image","cardImageUrl","title","subtitle","description","textCentered","aspectRatio","style","onPressIcon","titleStyle","subtitleStyle","descriptionStyle","children","bgColor","styles","flatten","innerPadding","uri","marginTop"],"sources":["Card.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n StyleSheet,\n View,\n ImageSourcePropType,\n StyleProp,\n ViewStyle,\n TextStyle,\n Pressable,\n} from \"react-native\";\nimport Image from \"./Image\";\nimport Surface from \"./Surface\";\nimport { Title, Subtitle, Caption } from \"./Typography\";\n\nimport { withTheme } from \"../theming\";\nimport Config from \"./Config\";\n\nimport type { Theme } from \"../styles/DefaultTheme\";\nimport type { IconSlot } from \"../interfaces/Icon\";\n\nconst ICON_SIZE = Config.cardIconSize;\nconst ICON_CONTAINER_SIZE = Config.cardIconSize * 2;\nconst ICON_CONTAINER_PADDING = Config.cardIconSize / 2 - 1;\nconst ICON_ELEVATION = Config.cardIconElevation;\n\nexport const TopRightCircleIcon = withTheme(\n ({\n Icon,\n icon,\n theme,\n onPress,\n }: {\n icon: string;\n theme: Theme;\n onPress?: () => void;\n } & IconSlot) => {\n return (\n <Surface\n style={{\n justifyContent: \"center\",\n alignItems: \"center\",\n elevation: ICON_ELEVATION,\n position: \"absolute\",\n top: 12,\n right: 12,\n width: ICON_CONTAINER_SIZE,\n height: ICON_CONTAINER_SIZE,\n padding: ICON_CONTAINER_PADDING,\n borderRadius: ICON_CONTAINER_SIZE,\n backgroundColor: \"rgba(0, 0, 0, 0.1)\",\n }}\n >\n <Pressable\n disabled={!onPress}\n onPress={onPress}\n style={({ pressed }) => {\n return [\n {\n opacity: pressed ? 0.8 : 1,\n },\n ];\n }}\n >\n <Icon name={icon} size={ICON_SIZE} color={theme.colors.surface} />\n </Pressable>\n </Surface>\n );\n }\n);\n\ntype Props = {\n image?: string | ImageSourcePropType;\n title?: string;\n subtitle?: string;\n description?: string;\n textCentered: boolean;\n icon?: string;\n aspectRatio?: number;\n elevation?: number;\n numColumns?: number;\n theme: Theme;\n titleStyle?: StyleProp<TextStyle>;\n subtitleStyle?: StyleProp<TextStyle>;\n descriptionStyle?: StyleProp<TextStyle>;\n style?: StyleProp<ViewStyle>;\n onPress?: () => void;\n onPressIcon?: () => void;\n children?: React.ReactNode;\n} & IconSlot;\n\nconst Card: React.FC<React.PropsWithChildren<Props>> = ({\n Icon,\n image = Config.cardImageUrl,\n title,\n subtitle,\n description,\n textCentered,\n icon,\n aspectRatio = 1.5,\n elevation = 2,\n style,\n onPress,\n onPressIcon,\n titleStyle,\n subtitleStyle,\n descriptionStyle,\n theme,\n children,\n}) => {\n const {\n backgroundColor: bgColor,\n padding,\n ...styles\n } = StyleSheet.flatten(style || {});\n\n const backgroundColor = bgColor ? bgColor : theme.colors.surface;\n const innerPadding = padding ? padding : 12;\n\n return (\n <Surface style={[{ elevation, backgroundColor }, styles]}>\n <Pressable\n disabled={!onPress}\n onPress={onPress}\n style={({ pressed }) => {\n return [\n {\n opacity: pressed ? 0.8 : 1,\n },\n ];\n }}\n >\n <Image\n style={{ aspectRatio }}\n source={typeof image === \"string\" ? { uri: image } : image}\n resizeMode=\"cover\"\n />\n <View style={{ padding: innerPadding }}>\n <View style={{ alignItems: textCentered ? \"center\" : \"flex-start\" }}>\n {title || (title && title !== \"\") ? (\n <Title text={title} style={titleStyle} />\n ) : null}\n {subtitle || (subtitle && subtitle !== \"\") ? (\n <Subtitle text={subtitle} style={subtitleStyle} />\n ) : null}\n {description || (description && description !== \"\") ? (\n <View style={{ marginTop: 4 }}>\n <Caption text={description} style={descriptionStyle} />\n </View>\n ) : null}\n {children}\n </View>\n </View>\n {icon ? (\n <TopRightCircleIcon Icon={Icon} icon={icon} onPress={onPressIcon} />\n ) : null}\n </Pressable>\n </Surface>\n );\n};\n\nexport default withTheme(Card);\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SACEC,UADF,EAEEC,IAFF,EAOEC,SAPF,QAQO,cARP;AASA,OAAOC,KAAP,MAAkB,SAAlB;AACA,OAAOC,OAAP,MAAoB,WAApB;AACA,SAASC,KAAT,EAAgBC,QAAhB,EAA0BC,OAA1B,QAAyC,cAAzC;AAEA,SAASC,SAAT,QAA0B,YAA1B;AACA,OA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AAK,IAAIA,KAAK,KAAK,EAA7B,gBACC,oBAAC,KAAD;IAAO,IAAI,EAAEA,KAAb;IAAoB,KAAK,EAAEO;EAA3B,EADD,GAEG,IAHN,EAIGN,QAAQ,IAAKA,QAAQ,IAAIA,QAAQ,KAAK,EAAtC,gBACC,oBAAC,QAAD;IAAU,IAAI,EAAEA,QAAhB;IAA0B,KAAK,EAAEO;EAAjC,EADD,GAEG,IANN,EAOGN,WAAW,IAAKA,WAAW,IAAIA,WAAW,KAAK,EAA/C,gBACC,oBAAC,IAAD;IAAM,KAAK,EAAE;MAAEc,SAAS,EAAE;IAAb;EAAb,gBACE,oBAAC,OAAD;IAAS,IAAI,EAAEd,WAAf;IAA4B,KAAK,EAAEO;EAAnC,EADF,CADD,GAIG,IAXN,EAYGC,QAZH,CADF,CAhBF,EAgCG/B,IAAI,gBACH,oBAAC,kBAAD;IAAoB,IAAI,EAAED,IAA1B;IAAgC,IAAI,EAAEC,IAAtC;IAA4C,OAAO,EAAE2B;EAArD,EADG,GAED,IAlCN,CADF,CADF;AAwCD,CApED;;AAsEA,eAAerC,SAAS,CAAC4B,IAAD,CAAxB"}
|
|
@@ -33,8 +33,6 @@ function Pager(_ref) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
function Carousel(_ref2) {
|
|
36
|
-
var _data$length;
|
|
37
|
-
|
|
38
36
|
let {
|
|
39
37
|
data,
|
|
40
38
|
children,
|
|
@@ -44,7 +42,7 @@ function Carousel(_ref2) {
|
|
|
44
42
|
} = _ref2;
|
|
45
43
|
const [index, setIndex] = React.useState(0);
|
|
46
44
|
const length = React.Children.count(children);
|
|
47
|
-
const itemsLength = ((
|
|
45
|
+
const itemsLength = ((data === null || data === void 0 ? void 0 : data.length) ?? 0) + length;
|
|
48
46
|
const slides = Array.isArray(data) ? data : [];
|
|
49
47
|
const {
|
|
50
48
|
width,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","withTheme","ScrollView","View","StyleSheet","Dimensions","Image","screenWidth","get","width","Pager","color","index","length","styles","pager","Array","from","map","_","i","current","opacity","size","bullet","backgroundColor","height","Carousel","data","children","dotColor","style","rest","setIndex","useState","Children","count","itemsLength","slides","isArray","flatten","slideWidth","slideHeight","container","nativeEvent","layoutWidth","layoutMeasurement","offset","contentOffset","x","currentIndex","Math","ceil","item","uri","child","s","props","cloneElement","create","position","bottom","left","right","flexDirection","justifyContent","alignItems","marginHorizontal","borderRadius"],"sources":["Carousel.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { withTheme } from \"../theming\";\nimport {\n ScrollView,\n View,\n StyleSheet,\n Dimensions,\n StyleProp,\n ViewStyle,\n} from \"react-native\";\nimport Image from \"./Image\";\n\nconst screenWidth = Dimensions.get(\"window\").width;\n\ntype Props = {\n data?: any[];\n children?: React.ReactNode;\n style?: StyleProp<ViewStyle>;\n dotColor?: string;\n theme: any;\n};\n\nfunction Pager({\n color,\n index,\n length,\n}: {\n color: string;\n index: number;\n length: number;\n}) {\n return (\n <View style={styles.pager}>\n {Array.from({ length }).map((_, i) => {\n const current = index === i;\n const opacity = current ? 1 : 0.5;\n const size = current ? 10 : 8;\n return (\n <View\n key={i}\n style={[\n styles.bullet,\n { backgroundColor: color, opacity, width: size, height: size },\n ]}\n />\n );\n })}\n </View>\n );\n}\n\nfunction Carousel({\n data,\n children,\n dotColor = \"strong\",\n style,\n ...rest\n}: React.PropsWithChildren<Props>) {\n const [index, setIndex] = React.useState(0);\n\n const length = React.Children.count(children);\n const itemsLength = (data?.length ?? 0) + length;\n const slides = Array.isArray(data) ? data : [];\n\n const { width, height } = StyleSheet.flatten(style || {});\n const slideWidth = width || screenWidth;\n const slideHeight = height || 250;\n\n return (\n <View style={[styles.container, style]} {...rest}>\n <ScrollView\n pagingEnabled\n horizontal\n decelerationRate=\"fast\"\n scrollEventThrottle={200}\n showsHorizontalScrollIndicator={false}\n onScroll={({ nativeEvent }) => {\n const layoutWidth = nativeEvent.layoutMeasurement.width;\n const offset = nativeEvent.contentOffset.x;\n const currentIndex = Math.ceil(offset / layoutWidth);\n setIndex(currentIndex);\n }}\n >\n {slides.length > 0\n ? slides.map((item, i) => {\n return (\n <Image\n key={i}\n resizeMode=\"cover\"\n source={typeof item === \"string\" ? { uri: item } : item}\n style={[{ width: slideWidth, height: slideHeight }]}\n />\n );\n })\n : null}\n {React.Children.map(children, (child: any) => {\n const s = child?.props?.style || {};\n return (\n <View style={{ width: slideWidth }}>\n {React.cloneElement(child, {\n style: { ...s, width: slideWidth },\n })}\n </View>\n );\n })}\n </ScrollView>\n <Pager color={dotColor} index={index} length={itemsLength} />\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n backgroundColor: \"#eee\",\n },\n pager: {\n position: \"absolute\",\n bottom: 12,\n left: 0,\n right: 0,\n flexDirection: \"row\",\n justifyContent: \"center\",\n alignItems: \"center\",\n },\n bullet: {\n marginHorizontal: 2,\n width: 10,\n height: 10,\n borderRadius: 20,\n backgroundColor: \"#000\",\n },\n});\n\nexport default withTheme(Carousel);\n"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,SAAT,QAA0B,YAA1B;AACA,SACEC,UADF,EAEEC,IAFF,EAGEC,UAHF,EAIEC,UAJF,QAOO,cAPP;AAQA,OAAOC,KAAP,MAAkB,SAAlB;AAEA,MAAMC,WAAW,GAAGF,UAAU,CAACG,GAAX,CAAe,QAAf,EAAyBC,KAA7C;;AAUA,SAASC,KAAT,OAQG;EAAA,IARY;IACbC,KADa;IAEbC,KAFa;IAGbC;EAHa,CAQZ;EACD,oBACE,oBAAC,IAAD;IAAM,KAAK,EAAEC,MAAM,CAACC;EAApB,GACGC,KAAK,CAACC,IAAN,CAAW;IAAEJ;EAAF,CAAX,EAAuBK,GAAvB,CAA2B,CAACC,CAAD,EAAIC,CAAJ,KAAU;IACpC,MAAMC,OAAO,GAAGT,KAAK,KAAKQ,CAA1B;IACA,MAAME,OAAO,GAAGD,OAAO,GAAG,CAAH,GAAO,GAA9B;IACA,MAAME,IAAI,GAAGF,OAAO,GAAG,EAAH,GAAQ,CAA5B;IACA,oBACE,oBAAC,IAAD;MACE,GAAG,EAAED,CADP;MAEE,KAAK,EAAE,CACLN,MAAM,CAACU,MADF,EAEL;QAAEC,eAAe,EAAEd,KAAnB;QAA0BW,OAA1B;QAAmCb,KAAK,EAAEc,IAA1C;QAAgDG,MAAM,EAAEH;MAAxD,CAFK;IAFT,EADF;EASD,CAbA,CADH,CADF;AAkBD;;AAED,SAASI,QAAT,QAMmC;EAAA
|
|
1
|
+
{"version":3,"names":["React","withTheme","ScrollView","View","StyleSheet","Dimensions","Image","screenWidth","get","width","Pager","color","index","length","styles","pager","Array","from","map","_","i","current","opacity","size","bullet","backgroundColor","height","Carousel","data","children","dotColor","style","rest","setIndex","useState","Children","count","itemsLength","slides","isArray","flatten","slideWidth","slideHeight","container","nativeEvent","layoutWidth","layoutMeasurement","offset","contentOffset","x","currentIndex","Math","ceil","item","uri","child","s","props","cloneElement","create","position","bottom","left","right","flexDirection","justifyContent","alignItems","marginHorizontal","borderRadius"],"sources":["Carousel.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { withTheme } from \"../theming\";\nimport {\n ScrollView,\n View,\n StyleSheet,\n Dimensions,\n StyleProp,\n ViewStyle,\n} from \"react-native\";\nimport Image from \"./Image\";\n\nconst screenWidth = Dimensions.get(\"window\").width;\n\ntype Props = {\n data?: any[];\n children?: React.ReactNode;\n style?: StyleProp<ViewStyle>;\n dotColor?: string;\n theme: any;\n};\n\nfunction Pager({\n color,\n index,\n length,\n}: {\n color: string;\n index: number;\n length: number;\n}) {\n return (\n <View style={styles.pager}>\n {Array.from({ length }).map((_, i) => {\n const current = index === i;\n const opacity = current ? 1 : 0.5;\n const size = current ? 10 : 8;\n return (\n <View\n key={i}\n style={[\n styles.bullet,\n { backgroundColor: color, opacity, width: size, height: size },\n ]}\n />\n );\n })}\n </View>\n );\n}\n\nfunction Carousel({\n data,\n children,\n dotColor = \"strong\",\n style,\n ...rest\n}: React.PropsWithChildren<Props>) {\n const [index, setIndex] = React.useState(0);\n\n const length = React.Children.count(children);\n const itemsLength = (data?.length ?? 0) + length;\n const slides = Array.isArray(data) ? data : [];\n\n const { width, height } = StyleSheet.flatten(style || {});\n const slideWidth = width || screenWidth;\n const slideHeight = height || 250;\n\n return (\n <View style={[styles.container, style]} {...rest}>\n <ScrollView\n pagingEnabled\n horizontal\n decelerationRate=\"fast\"\n scrollEventThrottle={200}\n showsHorizontalScrollIndicator={false}\n onScroll={({ nativeEvent }) => {\n const layoutWidth = nativeEvent.layoutMeasurement.width;\n const offset = nativeEvent.contentOffset.x;\n const currentIndex = Math.ceil(offset / layoutWidth);\n setIndex(currentIndex);\n }}\n >\n {slides.length > 0\n ? slides.map((item, i) => {\n return (\n <Image\n key={i}\n resizeMode=\"cover\"\n source={typeof item === \"string\" ? { uri: item } : item}\n style={[{ width: slideWidth, height: slideHeight }]}\n />\n );\n })\n : null}\n {React.Children.map(children, (child: any) => {\n const s = child?.props?.style || {};\n return (\n <View style={{ width: slideWidth }}>\n {React.cloneElement(child, {\n style: { ...s, width: slideWidth },\n })}\n </View>\n );\n })}\n </ScrollView>\n <Pager color={dotColor} index={index} length={itemsLength} />\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n backgroundColor: \"#eee\",\n },\n pager: {\n position: \"absolute\",\n bottom: 12,\n left: 0,\n right: 0,\n flexDirection: \"row\",\n justifyContent: \"center\",\n alignItems: \"center\",\n },\n bullet: {\n marginHorizontal: 2,\n width: 10,\n height: 10,\n borderRadius: 20,\n backgroundColor: \"#000\",\n },\n});\n\nexport default withTheme(Carousel);\n"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,SAAT,QAA0B,YAA1B;AACA,SACEC,UADF,EAEEC,IAFF,EAGEC,UAHF,EAIEC,UAJF,QAOO,cAPP;AAQA,OAAOC,KAAP,MAAkB,SAAlB;AAEA,MAAMC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AAgB;IAAA;;IAC5C,MAAMC,CAAC,GAAG,CAAAD,KAAK,SAAL,IAAAA,KAAK,WAAL,4BAAAA,KAAK,CAAEE,KAAP,8DAAc1B,KAAd,KAAuB,EAAjC;IACA,oBACE,oBAAC,IAAD;MAAM,KAAK,EAAE;QAAEtB,KAAK,EAAEgC;MAAT;IAAb,gBACGzC,KAAK,CAAC0D,YAAN,CAAmBH,KAAnB,EAA0B;MACzBxB,KAAK,EAAE,EAAE,GAAGyB,CAAL;QAAQ/C,KAAK,EAAEgC;MAAf;IADkB,CAA1B,CADH,CADF;EAOD,CATA,CAzBH,CADF,eAqCE,oBAAC,KAAD;IAAO,KAAK,EAAEX,QAAd;IAAwB,KAAK,EAAElB,KAA/B;IAAsC,MAAM,EAAEyB;EAA9C,EArCF,CADF;AAyCD;;AAED,MAAMvB,MAAM,GAAGV,UAAU,CAACuD,MAAX,CAAkB;EAC/BhB,SAAS,EAAE;IACTlB,eAAe,EAAE;EADR,CADoB;EAI/BV,KAAK,EAAE;IACL6C,QAAQ,EAAE,UADL;IAELC,MAAM,EAAE,EAFH;IAGLC,IAAI,EAAE,CAHD;IAILC,KAAK,EAAE,CAJF;IAKLC,aAAa,EAAE,KALV;IAMLC,cAAc,EAAE,QANX;IAOLC,UAAU,EAAE;EAPP,CAJwB;EAa/B1C,MAAM,EAAE;IACN2C,gBAAgB,EAAE,CADZ;IAEN1D,KAAK,EAAE,EAFD;IAGNiB,MAAM,EAAE,EAHF;IAIN0C,YAAY,EAAE,EAJR;IAKN3C,eAAe,EAAE;EALX;AAbuB,CAAlB,CAAf;AAsBA,eAAexB,SAAS,CAAC0B,QAAD,CAAxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","StyleSheet","useTheme","Touchable","usePrevious","Checkbox","Icon","status","disabled","onPress","onCheck","onUncheck","color","uncheckedColor","defaultValue","checkedIcon","uncheckedIcon","size","style","rest","internalValue","setInternalValue","useState","useEffect","previousDefaultValue","Boolean","colors","checkboxColor","primary","handlePress","newValue","styles","container","width","height","icon","absoluteFill","fillContainer","fill","opacity","borderColor","create","borderRadius","alignItems","justifyContent","alignSelf"],"sources":["Checkbox.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {\n View,\n StyleSheet,\n TouchableHighlightProps,\n StyleProp,\n ViewStyle,\n} from \"react-native\";\nimport { useTheme } from \"../../theming\";\nimport type { IconSlot } from \"../../interfaces/Icon\";\n\nimport Touchable from \"../Touchable\";\nimport { usePrevious } from \"../../hooks\";\n\nexport interface CheckboxProps {\n status?: boolean;\n disabled?: boolean;\n onPress?: (checked: boolean) => void;\n onCheck?: () => void;\n onUncheck?: () => void;\n color?: string;\n uncheckedColor?: string;\n checkedIcon?: string;\n uncheckedIcon?: string;\n defaultValue?: boolean;\n size?: number;\n style?: StyleProp<ViewStyle>;\n}\n\nconst Checkbox: React.FC
|
|
1
|
+
{"version":3,"names":["React","View","StyleSheet","useTheme","Touchable","usePrevious","Checkbox","Icon","status","disabled","onPress","onCheck","onUncheck","color","uncheckedColor","defaultValue","checkedIcon","uncheckedIcon","size","style","rest","internalValue","setInternalValue","useState","useEffect","previousDefaultValue","Boolean","colors","checkboxColor","primary","handlePress","newValue","styles","container","width","height","icon","absoluteFill","fillContainer","fill","opacity","borderColor","create","borderRadius","alignItems","justifyContent","alignSelf"],"sources":["Checkbox.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {\n View,\n StyleSheet,\n TouchableHighlightProps,\n StyleProp,\n ViewStyle,\n} from \"react-native\";\nimport { useTheme } from \"../../theming\";\nimport type { IconSlot } from \"../../interfaces/Icon\";\n\nimport Touchable from \"../Touchable\";\nimport { usePrevious } from \"../../hooks\";\n\nexport interface CheckboxProps {\n status?: boolean;\n disabled?: boolean;\n onPress?: (checked: boolean) => void;\n onCheck?: () => void;\n onUncheck?: () => void;\n color?: string;\n uncheckedColor?: string;\n checkedIcon?: string;\n uncheckedIcon?: string;\n defaultValue?: boolean;\n size?: number;\n style?: StyleProp<ViewStyle>;\n}\n\nconst Checkbox: React.FC<\n CheckboxProps & TouchableHighlightProps & IconSlot\n> = ({\n Icon,\n status,\n disabled = false,\n onPress,\n onCheck,\n onUncheck,\n color,\n uncheckedColor,\n defaultValue,\n checkedIcon = \"MaterialCommunityIcons/checkbox-marked\",\n uncheckedIcon = \"MaterialCommunityIcons/checkbox-blank-outline\",\n size = 24,\n style,\n ...rest\n}) => {\n const [internalValue, setInternalValue] = React.useState<boolean>(\n status || defaultValue || false\n );\n\n React.useEffect(() => {\n if (status != null) {\n setInternalValue(status);\n }\n }, [status]);\n\n // This special logic is to handle weird APIs like Airtable that return\n // true or undefined for a boolean\n const previousDefaultValue = usePrevious(defaultValue) as boolean | undefined;\n\n React.useEffect(() => {\n if (defaultValue !== previousDefaultValue) {\n setInternalValue(Boolean(defaultValue));\n }\n }, [defaultValue, previousDefaultValue]);\n\n const { colors } = useTheme();\n\n const checkboxColor = internalValue\n ? color || colors.primary\n : uncheckedColor || colors.primary;\n\n const handlePress = () => {\n const newValue = !internalValue;\n\n setInternalValue(newValue);\n onPress?.(newValue);\n\n if (newValue) {\n onCheck?.();\n }\n\n if (!newValue) {\n onUncheck?.();\n }\n };\n\n return (\n <Touchable\n {...rest}\n onPress={handlePress}\n disabled={disabled}\n accessibilityState={{ disabled }}\n accessibilityRole=\"button\"\n accessibilityLiveRegion=\"polite\"\n style={[styles.container, style, { width: size, height: size }]}\n >\n <Icon\n style={styles.icon}\n name={internalValue ? checkedIcon : uncheckedIcon}\n size={size}\n color={checkboxColor}\n />\n <View style={[StyleSheet.absoluteFill, styles.fillContainer]}>\n <View\n style={[\n styles.fill,\n { opacity: disabled ? 0.5 : 1 },\n { borderColor: checkboxColor },\n ]}\n />\n </View>\n </Touchable>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {\n borderRadius: 18,\n },\n fillContainer: {\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n icon: {\n alignSelf: \"center\",\n },\n fill: {\n borderRadius: 5,\n width: 30,\n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CADoB;EAI/BL,aAAa,EAAE;IACbM,UAAU,EAAE,QADC;IAEbC,cAAc,EAAE;EAFH,CAJgB;EAQ/BT,IAAI,EAAE;IACJU,SAAS,EAAE;EADP,CARyB;EAW/BP,IAAI,EAAE;IACJI,YAAY,EAAE,CADV;IAEJT,KAAK,EAAE,EAFH;IAGJC,MAAM,EAAE,EAHJ;IAIJW,SAAS,EAAE;EAJP;AAXyB,CAAlB,CAAf;AAmBA,eAAexC,QAAf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["default","Checkbox","CheckboxGroup","CheckboxRow"],"sources":["index.
|
|
1
|
+
{"version":3,"names":["default","Checkbox","CheckboxGroup","CheckboxRow"],"sources":["index.ts"],"sourcesContent":["export { default as Checkbox } from \"./Checkbox\";\nexport { default as CheckboxGroup } from \"./CheckboxGroup\";\nexport { default as CheckboxRow } from \"./CheckboxRow\";\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,QAApB,QAAoC,YAApC;AACA,SAASD,OAAO,IAAIE,aAApB,QAAyC,iBAAzC;AACA,SAASF,OAAO,IAAIG,WAApB,QAAuC,eAAvC"}
|