@draftbit/core 46.4.4-746597.2 → 46.4.4-74e9b3.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/Accordion/AccordionItem.js +22 -4
- package/lib/commonjs/components/Accordion/AccordionItem.js.map +1 -1
- package/lib/commonjs/components/Accordion/index.js.map +1 -1
- package/lib/commonjs/components/ActionSheet/ActionSheetItem.js.map +1 -1
- package/lib/commonjs/components/Banner.js +23 -4
- package/lib/commonjs/components/Banner.js.map +1 -1
- package/lib/commonjs/components/CardContainer.js +14 -4
- package/lib/commonjs/components/CardContainer.js.map +1 -1
- package/lib/commonjs/components/CardContainerShortImage.js +16 -4
- package/lib/commonjs/components/CardContainerShortImage.js.map +1 -1
- package/lib/commonjs/components/CardInline.js.map +1 -1
- package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +22 -5
- package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js.map +1 -1
- package/lib/commonjs/components/Checkbox/index.js.map +1 -1
- package/lib/commonjs/components/CircleImage.js +2 -16
- package/lib/commonjs/components/CircleImage.js.map +1 -1
- package/lib/commonjs/components/DatePicker/DatePicker.js +17 -8
- package/lib/commonjs/components/DatePicker/DatePicker.js.map +1 -1
- package/lib/commonjs/components/DatePicker/DatePickerComponent.js.map +1 -1
- package/lib/commonjs/components/DatePicker/DatePickerComponent.web.js.map +1 -1
- package/lib/commonjs/components/DatePicker/DatePickerComponentType.js.map +1 -1
- package/lib/commonjs/components/DeprecatedButton.js +19 -3
- package/lib/commonjs/components/DeprecatedButton.js.map +1 -1
- package/lib/commonjs/components/DeprecatedCardWrapper.js +12 -1
- package/lib/commonjs/components/DeprecatedCardWrapper.js.map +1 -1
- package/lib/commonjs/components/IconButton.js +18 -4
- package/lib/commonjs/components/IconButton.js.map +1 -1
- package/lib/commonjs/components/Justification.js.map +1 -1
- package/lib/commonjs/components/Picker/Picker.js +5 -5
- package/lib/commonjs/components/Picker/Picker.js.map +1 -1
- package/lib/commonjs/components/Picker/PickerComponent.web.js +20 -5
- package/lib/commonjs/components/Picker/PickerComponent.web.js.map +1 -1
- package/lib/commonjs/components/Portal/Portal.js +27 -3
- package/lib/commonjs/components/Portal/Portal.js.map +1 -1
- package/lib/commonjs/components/Portal/PortalConsumer.js.map +1 -1
- package/lib/commonjs/components/Portal/PortalHost.js +45 -15
- package/lib/commonjs/components/Portal/PortalHost.js.map +1 -1
- package/lib/commonjs/components/ProgressBar.js +36 -7
- package/lib/commonjs/components/RadioButton/RadioButton.js +14 -3
- package/lib/commonjs/components/RadioButton/RadioButtonGroup.js +16 -4
- package/lib/commonjs/components/RadioButton/RadioButtonGroup.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButtonRow.js +22 -6
- package/lib/commonjs/components/RadioButton/index.js.map +1 -1
- package/lib/commonjs/components/ResizeMode.js +2 -1
- package/lib/commonjs/components/ResizeMode.js.map +1 -1
- package/lib/commonjs/components/RowHeadlineImageIcon.js.map +1 -1
- package/lib/commonjs/components/StepIndicator.js.map +1 -1
- package/lib/commonjs/components/Stepper.js +2 -2
- package/lib/commonjs/components/Stepper.js.map +1 -1
- package/lib/commonjs/components/Switch.js +19 -10
- package/lib/commonjs/components/Switch.js.map +1 -1
- package/lib/commonjs/components/TextField.js.map +1 -1
- package/lib/commonjs/components/ToggleButton.js +14 -2
- package/lib/commonjs/components/Typography.js.map +1 -1
- package/lib/commonjs/constants.js +1 -1
- package/lib/commonjs/constants.js.map +1 -1
- package/lib/commonjs/index.js +0 -7
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/interfaces/Icon.js.map +1 -1
- package/lib/commonjs/mappings/ActivityIndicator.js.map +1 -1
- package/lib/commonjs/mappings/AudioPlayer.js.map +1 -1
- package/lib/commonjs/mappings/AvatarEdit.js.map +1 -1
- package/lib/commonjs/mappings/BlurView.js.map +1 -1
- package/lib/commonjs/mappings/CardBlock.js.map +1 -1
- package/lib/commonjs/mappings/Carousel.js.map +1 -1
- package/lib/commonjs/mappings/Checkbox.js.map +1 -1
- package/lib/commonjs/mappings/CheckboxGroup.js.map +1 -1
- package/lib/commonjs/mappings/DatePicker.js +13 -0
- package/lib/commonjs/mappings/DatePicker.js.map +1 -1
- package/lib/commonjs/mappings/Divider.js.map +1 -1
- package/lib/commonjs/mappings/HeaderOverline.js.map +1 -1
- package/lib/commonjs/mappings/ImageBackground.js.map +1 -1
- package/lib/commonjs/mappings/KeyboardAwareScrollView.js.map +1 -1
- package/lib/commonjs/mappings/Modal.js.map +1 -1
- package/lib/commonjs/mappings/NumberInput.js.map +1 -1
- package/lib/commonjs/mappings/ProgressCircle.js.map +1 -1
- package/lib/commonjs/mappings/ProgressIndicator.js.map +1 -1
- package/lib/commonjs/mappings/RadioButton.js.map +1 -1
- package/lib/commonjs/mappings/Slider.js.map +1 -1
- package/lib/commonjs/mappings/Surface.js.map +1 -1
- package/lib/commonjs/mappings/SwiperItem.js.map +1 -1
- package/lib/commonjs/mappings/Switch.js.map +1 -1
- package/lib/commonjs/mappings/Video.js.map +1 -1
- package/lib/commonjs/mappings/WebView.js.map +1 -1
- package/lib/commonjs/styles/DarkTheme.js.map +1 -1
- package/lib/commonjs/styles/DefaultTheme.js.map +1 -1
- package/lib/commonjs/styles/overlay.js +1 -3
- package/lib/commonjs/styles/overlay.js.map +1 -1
- package/lib/commonjs/styles/shadow.js.map +1 -1
- package/lib/commonjs/utilities.js +1 -2
- package/lib/commonjs/utilities.js.map +1 -1
- package/lib/module/components/Banner.js +23 -4
- package/lib/module/components/Banner.js.map +1 -1
- package/lib/module/components/CardInline.js.map +1 -1
- package/lib/module/components/Checkbox/CheckboxGroup.js +17 -2
- package/lib/module/components/Checkbox/CheckboxGroup.js.map +1 -1
- package/lib/module/components/Checkbox/CheckboxRow.js +23 -6
- package/lib/module/components/Checkbox/CheckboxRow.js.map +1 -1
- package/lib/module/components/Checkbox/index.js.map +1 -1
- package/lib/module/components/CircleImage.js.map +1 -1
- package/lib/module/components/CircularProgress.js +27 -8
- package/lib/module/components/Container.js +16 -4
- package/lib/module/components/Container.js.map +1 -1
- package/lib/module/components/DatePicker/DatePicker.js +17 -8
- package/lib/module/components/DatePicker/DatePicker.js.map +1 -1
- package/lib/module/components/Picker/Picker.js +5 -5
- package/lib/module/components/Picker/Picker.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButton.js +14 -3
- package/lib/module/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButtonGroup.js +15 -3
- package/lib/module/components/RadioButton/RadioButtonGroup.js.map +1 -1
- package/lib/module/components/RowHeadlineImageCaption.js.map +1 -1
- package/lib/module/components/Stepper.js +3 -1
- package/lib/module/components/Stepper.js.map +1 -1
- package/lib/module/hooks.js.map +1 -1
- package/lib/module/index.js +0 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/mappings/DatePicker.js +14 -1
- package/lib/module/mappings/DatePicker.js.map +1 -1
- package/lib/module/mappings/SVG.js.map +1 -1
- package/lib/module/mappings/Slider.js.map +1 -1
- package/lib/module/mappings/Switch.js.map +1 -1
- package/lib/module/mappings/Video.js.map +1 -1
- package/lib/typescript/src/components/DatePicker/DatePicker.d.ts +4 -0
- package/lib/typescript/src/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +0 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mappings/DatePicker.d.ts +42 -0
- package/lib/typescript/src/mappings/DatePicker.d.ts.map +1 -1
- package/package.json +3 -5
- package/src/components/DatePicker/DatePicker.js +14 -8
- package/src/components/DatePicker/DatePicker.tsx +23 -7
- package/src/components/Stepper.js +1 -0
- package/src/components/Stepper.tsx +1 -1
- package/src/index.js +0 -1
- package/src/index.tsx +0 -1
- package/src/mappings/DatePicker.js +21 -1
- package/src/mappings/DatePicker.ts +23 -0
- package/lib/commonjs/components/BottomSheet/BottomSheet.native.js +0 -59
- package/lib/commonjs/components/BottomSheet/BottomSheet.native.js.map +0 -1
- package/lib/commonjs/components/BottomSheet/BottomSheet.web.js +0 -84
- package/lib/commonjs/components/BottomSheet/BottomSheet.web.js.map +0 -1
- package/lib/commonjs/components/BottomSheet/index.js +0 -14
- package/lib/commonjs/components/BottomSheet/index.js.map +0 -1
- package/lib/commonjs/components/BottomSheet/types.js +0 -6
- package/lib/commonjs/components/BottomSheet/types.js.map +0 -1
- package/lib/commonjs/mappings/BottomSheet.js +0 -21
- package/lib/commonjs/mappings/BottomSheet.js.map +0 -1
- package/lib/module/components/BottomSheet/BottomSheet.native.js +0 -50
- package/lib/module/components/BottomSheet/BottomSheet.native.js.map +0 -1
- package/lib/module/components/BottomSheet/BottomSheet.web.js +0 -76
- package/lib/module/components/BottomSheet/BottomSheet.web.js.map +0 -1
- package/lib/module/components/BottomSheet/index.js +0 -3
- package/lib/module/components/BottomSheet/index.js.map +0 -1
- package/lib/module/components/BottomSheet/types.js +0 -2
- package/lib/module/components/BottomSheet/types.js.map +0 -1
- package/lib/module/mappings/BottomSheet.js +0 -14
- package/lib/module/mappings/BottomSheet.js.map +0 -1
- package/lib/typescript/src/components/BottomSheet/BottomSheet.native.d.ts +0 -5
- package/lib/typescript/src/components/BottomSheet/BottomSheet.native.d.ts.map +0 -1
- package/lib/typescript/src/components/BottomSheet/BottomSheet.web.d.ts +0 -5
- package/lib/typescript/src/components/BottomSheet/BottomSheet.web.d.ts.map +0 -1
- package/lib/typescript/src/components/BottomSheet/index.d.ts +0 -2
- package/lib/typescript/src/components/BottomSheet/index.d.ts.map +0 -1
- package/lib/typescript/src/components/BottomSheet/types.d.ts +0 -9
- package/lib/typescript/src/components/BottomSheet/types.d.ts.map +0 -1
- package/lib/typescript/src/mappings/BottomSheet.d.ts +0 -20
- package/lib/typescript/src/mappings/BottomSheet.d.ts.map +0 -1
- package/src/components/BottomSheet/BottomSheet.native.js +0 -37
- package/src/components/BottomSheet/BottomSheet.native.tsx +0 -60
- package/src/components/BottomSheet/BottomSheet.web.js +0 -56
- package/src/components/BottomSheet/BottomSheet.web.tsx +0 -90
- package/src/components/BottomSheet/index.js +0 -2
- package/src/components/BottomSheet/index.tsx +0 -2
- package/src/components/BottomSheet/types.js +0 -1
- package/src/components/BottomSheet/types.tsx +0 -8
- package/src/mappings/BottomSheet.js +0 -20
- package/src/mappings/BottomSheet.ts +0 -25
|
@@ -6,6 +6,7 @@ import { withTheme } from "../../theming";
|
|
|
6
6
|
import Portal from "../Portal/Portal";
|
|
7
7
|
import Touchable from "../Touchable";
|
|
8
8
|
import DateTimePicker from "./DatePickerComponent";
|
|
9
|
+
import { extractStyles } from "../../utilities";
|
|
9
10
|
const AnimatedText = Animated.createAnimatedComponent(Text);
|
|
10
11
|
const FOCUS_ANIMATION_DURATION = 150;
|
|
11
12
|
const BLUR_ANIMATION_DURATION = 180;
|
|
@@ -24,7 +25,7 @@ const MONTHS = [
|
|
|
24
25
|
"November",
|
|
25
26
|
"December",
|
|
26
27
|
];
|
|
27
|
-
const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disabledOpacity }, date, onDateChange = () => { }, defaultValue, disabled = false, mode = "date", format, type = "underline", leftIconName, rightIconName, leftIconMode = "inset", label, placeholder, ...props }) => {
|
|
28
|
+
const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disabledOpacity }, date, onDateChange = () => { }, defaultValue, disabled = false, mode = "date", format, type = "underline", leftIconName, rightIconName, leftIconMode = "inset", label, labelSize, labelColor, placeholder, borderColor: inputBorderColor, borderColorActive: inputBorderColorActive, ...props }) => {
|
|
28
29
|
const [value, setValue] = React.useState(date || defaultValue);
|
|
29
30
|
React.useEffect(() => {
|
|
30
31
|
if (defaultValue != null) {
|
|
@@ -36,6 +37,7 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
36
37
|
const [placeholder1, setPlaceholder1] = React.useState("");
|
|
37
38
|
const [focused, setFocused] = React.useState(false);
|
|
38
39
|
const [labelLayout, setLabelLayout] = React.useState({ measured: false, width: 0 });
|
|
40
|
+
const { textStyles } = extractStyles(style);
|
|
39
41
|
const getValidDate = () => {
|
|
40
42
|
if (!value) {
|
|
41
43
|
return new Date();
|
|
@@ -125,8 +127,10 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
125
127
|
};
|
|
126
128
|
const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
|
|
127
129
|
const OUTLINE_MINIMIZED_LABEL_Y_OFFSET = -(16 * 0.5 + 4);
|
|
128
|
-
const MAXIMIZED_LABEL_FONT_SIZE = typography.subtitle1.fontSize;
|
|
129
|
-
const MINIMIZED_LABEL_FONT_SIZE =
|
|
130
|
+
const MAXIMIZED_LABEL_FONT_SIZE = (textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontSize) || typography.subtitle1.fontSize;
|
|
131
|
+
const MINIMIZED_LABEL_FONT_SIZE = labelSize
|
|
132
|
+
? labelSize
|
|
133
|
+
: typography.caption.fontSize;
|
|
130
134
|
const hasActiveOutline = focused;
|
|
131
135
|
let inputTextColor, activeColor, underlineColor, borderColor, placeholderColor, containerStyle, backgroundColor, inputStyle;
|
|
132
136
|
inputTextColor = colors.strong;
|
|
@@ -138,9 +142,9 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
138
142
|
backgroundColor = colors.divider;
|
|
139
143
|
}
|
|
140
144
|
else {
|
|
141
|
-
activeColor = colors.primary;
|
|
142
|
-
placeholderColor = borderColor = colors.light;
|
|
143
|
-
underlineColor = colors.light;
|
|
145
|
+
activeColor = inputBorderColorActive || colors.primary;
|
|
146
|
+
placeholderColor = borderColor = inputBorderColor || colors.light;
|
|
147
|
+
underlineColor = inputBorderColor || colors.light;
|
|
144
148
|
backgroundColor = colors.background;
|
|
145
149
|
}
|
|
146
150
|
const { lineHeight, ...subtitle1 } = typography.subtitle1;
|
|
@@ -202,6 +206,7 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
202
206
|
const labelStyle = {
|
|
203
207
|
...typography.subtitle1,
|
|
204
208
|
top: type === "solid" ? 16 : 0,
|
|
209
|
+
fontFamily: textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontFamily,
|
|
205
210
|
left: leftIconName && leftIconMode === "inset"
|
|
206
211
|
? ICON_SIZE + (type === "solid" ? 16 : 12)
|
|
207
212
|
: 0,
|
|
@@ -245,6 +250,7 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
245
250
|
styles.input,
|
|
246
251
|
inputStyle,
|
|
247
252
|
type === "solid" ? { marginHorizontal: 12 } : {},
|
|
253
|
+
textStyles,
|
|
248
254
|
];
|
|
249
255
|
// const render = (props) => <NativeTextInput {...props} />;
|
|
250
256
|
return (React.createElement(View, { style: [styles.container, style] },
|
|
@@ -282,7 +288,7 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
282
288
|
type === "solid" ? { paddingHorizontal: 12 } : {},
|
|
283
289
|
labelStyle,
|
|
284
290
|
{
|
|
285
|
-
color: colors.light,
|
|
291
|
+
color: labelColor || colors.light,
|
|
286
292
|
opacity: labeled.interpolate({
|
|
287
293
|
inputRange: [0, 1],
|
|
288
294
|
outputRange: [hasActiveOutline ? 1 : 0, 0],
|
|
@@ -294,7 +300,7 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
294
300
|
type === "solid" ? { paddingHorizontal: 12 } : {},
|
|
295
301
|
labelStyle,
|
|
296
302
|
{
|
|
297
|
-
color:
|
|
303
|
+
color: labelColor || placeholder,
|
|
298
304
|
opacity: hasActiveOutline ? labeled : 1,
|
|
299
305
|
},
|
|
300
306
|
], numberOfLines: 1 }, label))) : null,
|
|
@@ -23,6 +23,7 @@ import DateTimePicker from "./DatePickerComponent";
|
|
|
23
23
|
|
|
24
24
|
import type { Theme } from "../../styles/DefaultTheme";
|
|
25
25
|
import type { IconSlot } from "../../interfaces/Icon";
|
|
26
|
+
import { extractStyles } from "../../utilities";
|
|
26
27
|
|
|
27
28
|
const AnimatedText = Animated.createAnimatedComponent(Text);
|
|
28
29
|
|
|
@@ -47,10 +48,14 @@ type Props = {
|
|
|
47
48
|
mode?: "date" | "time" | "datetime";
|
|
48
49
|
type?: "solid" | "underline";
|
|
49
50
|
label?: string;
|
|
51
|
+
labelSize?: number;
|
|
52
|
+
labelColor: string;
|
|
50
53
|
placeholder?: string;
|
|
51
54
|
leftIconName?: string;
|
|
52
55
|
leftIconMode?: "outset" | "inset";
|
|
53
56
|
rightIconName?: string;
|
|
57
|
+
borderColor?: string;
|
|
58
|
+
borderColorActive?: string;
|
|
54
59
|
} & IconSlot &
|
|
55
60
|
TextInputProps;
|
|
56
61
|
|
|
@@ -84,7 +89,11 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
84
89
|
rightIconName,
|
|
85
90
|
leftIconMode = "inset",
|
|
86
91
|
label,
|
|
92
|
+
labelSize,
|
|
93
|
+
labelColor,
|
|
87
94
|
placeholder,
|
|
95
|
+
borderColor: inputBorderColor,
|
|
96
|
+
borderColorActive: inputBorderColorActive,
|
|
88
97
|
...props
|
|
89
98
|
}) => {
|
|
90
99
|
const [value, setValue] = React.useState<any>(date || defaultValue);
|
|
@@ -106,6 +115,8 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
106
115
|
width: number;
|
|
107
116
|
}>({ measured: false, width: 0 });
|
|
108
117
|
|
|
118
|
+
const { textStyles } = extractStyles(style);
|
|
119
|
+
|
|
109
120
|
const getValidDate = (): Date => {
|
|
110
121
|
if (!value) {
|
|
111
122
|
return new Date();
|
|
@@ -211,8 +222,11 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
211
222
|
|
|
212
223
|
const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
|
|
213
224
|
const OUTLINE_MINIMIZED_LABEL_Y_OFFSET = -(16 * 0.5 + 4);
|
|
214
|
-
const MAXIMIZED_LABEL_FONT_SIZE =
|
|
215
|
-
|
|
225
|
+
const MAXIMIZED_LABEL_FONT_SIZE =
|
|
226
|
+
textStyles?.fontSize || typography.subtitle1.fontSize;
|
|
227
|
+
const MINIMIZED_LABEL_FONT_SIZE = labelSize
|
|
228
|
+
? labelSize
|
|
229
|
+
: typography.caption.fontSize;
|
|
216
230
|
|
|
217
231
|
const hasActiveOutline = focused;
|
|
218
232
|
|
|
@@ -233,9 +247,9 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
233
247
|
underlineColor = "transparent";
|
|
234
248
|
backgroundColor = colors.divider;
|
|
235
249
|
} else {
|
|
236
|
-
activeColor = colors.primary;
|
|
237
|
-
placeholderColor = borderColor = colors.light;
|
|
238
|
-
underlineColor = colors.light;
|
|
250
|
+
activeColor = inputBorderColorActive || colors.primary;
|
|
251
|
+
placeholderColor = borderColor = inputBorderColor || colors.light;
|
|
252
|
+
underlineColor = inputBorderColor || colors.light;
|
|
239
253
|
backgroundColor = colors.background;
|
|
240
254
|
}
|
|
241
255
|
|
|
@@ -306,6 +320,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
306
320
|
const labelStyle = {
|
|
307
321
|
...typography.subtitle1,
|
|
308
322
|
top: type === "solid" ? 16 : 0,
|
|
323
|
+
fontFamily: textStyles?.fontFamily,
|
|
309
324
|
left:
|
|
310
325
|
leftIconName && leftIconMode === "inset"
|
|
311
326
|
? ICON_SIZE + (type === "solid" ? 16 : 12)
|
|
@@ -351,6 +366,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
351
366
|
styles.input,
|
|
352
367
|
inputStyle,
|
|
353
368
|
type === "solid" ? { marginHorizontal: 12 } : {},
|
|
369
|
+
textStyles,
|
|
354
370
|
];
|
|
355
371
|
|
|
356
372
|
// const render = (props) => <NativeTextInput {...props} />;
|
|
@@ -406,7 +422,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
406
422
|
type === "solid" ? { paddingHorizontal: 12 } : {},
|
|
407
423
|
labelStyle,
|
|
408
424
|
{
|
|
409
|
-
color: colors.light,
|
|
425
|
+
color: labelColor || colors.light,
|
|
410
426
|
opacity: labeled.interpolate({
|
|
411
427
|
inputRange: [0, 1],
|
|
412
428
|
outputRange: [hasActiveOutline ? 1 : 0, 0],
|
|
@@ -423,7 +439,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
423
439
|
type === "solid" ? { paddingHorizontal: 12 } : {},
|
|
424
440
|
labelStyle,
|
|
425
441
|
{
|
|
426
|
-
color:
|
|
442
|
+
color: labelColor || placeholder,
|
|
427
443
|
opacity: hasActiveOutline ? labeled : 1,
|
|
428
444
|
},
|
|
429
445
|
]}
|
|
@@ -36,4 +36,5 @@ const Stepper = ({ min = -Infinity, max = Infinity, value: valueProp, defaultVal
|
|
|
36
36
|
] }, value),
|
|
37
37
|
React.createElement(IconButton, { Icon: Icon, icon: "MaterialIcons/add", onPress: () => handlePlusOrMinus("plus"), size: iconSize, color: iconColor, disabled: value === max, style: { opacity: value === max ? 0.5 : 1 } })));
|
|
38
38
|
};
|
|
39
|
+
//oh hello
|
|
39
40
|
export default withTheme(Stepper);
|
package/src/index.js
CHANGED
|
@@ -29,7 +29,6 @@ export { default as Touchable } from "./components/Touchable";
|
|
|
29
29
|
export { AccordionGroup, AccordionItem } from "./components/Accordion";
|
|
30
30
|
export { ActionSheet, ActionSheetItem, ActionSheetCancel, } from "./components/ActionSheet";
|
|
31
31
|
export { Swiper, SwiperItem } from "./components/Swiper";
|
|
32
|
-
export { BottomSheet } from "./components/BottomSheet";
|
|
33
32
|
export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
|
|
34
33
|
export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
|
|
35
34
|
/* Deprecated: Fix or Delete! */
|
package/src/index.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, GROUPS, Triggers, } from "@draftbit/types";
|
|
1
|
+
import { COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, GROUPS, Triggers, StylesPanelSections, createNumberProp, createColorProp, } from "@draftbit/types";
|
|
2
2
|
const SEED_DATA_PROPS = {
|
|
3
3
|
label: {
|
|
4
4
|
label: "Label",
|
|
@@ -10,6 +10,12 @@ const SEED_DATA_PROPS = {
|
|
|
10
10
|
required: true,
|
|
11
11
|
group: GROUPS.data,
|
|
12
12
|
},
|
|
13
|
+
labelSize: createNumberProp({
|
|
14
|
+
label: "Label Size",
|
|
15
|
+
}),
|
|
16
|
+
labelColor: createColorProp({
|
|
17
|
+
label: "Label Color",
|
|
18
|
+
}),
|
|
13
19
|
mode: {
|
|
14
20
|
label: "Mode",
|
|
15
21
|
description: "Choose between date, time and datetime",
|
|
@@ -21,6 +27,12 @@ const SEED_DATA_PROPS = {
|
|
|
21
27
|
options: ["date", "time", "datetime"],
|
|
22
28
|
group: GROUPS.basic,
|
|
23
29
|
},
|
|
30
|
+
borderColor: createColorProp({
|
|
31
|
+
label: "Border Color",
|
|
32
|
+
}),
|
|
33
|
+
borderColorActive: createColorProp({
|
|
34
|
+
label: "Border Color",
|
|
35
|
+
}),
|
|
24
36
|
format: {
|
|
25
37
|
label: "Format",
|
|
26
38
|
description: "Create an output format for the date.",
|
|
@@ -139,6 +151,14 @@ export const SEED_DATA = [
|
|
|
139
151
|
category: COMPONENT_TYPES.input,
|
|
140
152
|
layout: null,
|
|
141
153
|
triggers: [Triggers.OnDateChange],
|
|
154
|
+
StylesPanelSections: [
|
|
155
|
+
StylesPanelSections.Background,
|
|
156
|
+
StylesPanelSections.Borders,
|
|
157
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
158
|
+
StylesPanelSections.Position,
|
|
159
|
+
StylesPanelSections.Size,
|
|
160
|
+
StylesPanelSections.Typography,
|
|
161
|
+
],
|
|
142
162
|
props: {
|
|
143
163
|
...SEED_DATA_PROPS,
|
|
144
164
|
type: {
|
|
@@ -5,6 +5,9 @@ import {
|
|
|
5
5
|
FIELD_NAME,
|
|
6
6
|
GROUPS,
|
|
7
7
|
Triggers,
|
|
8
|
+
StylesPanelSections,
|
|
9
|
+
createNumberProp,
|
|
10
|
+
createColorProp,
|
|
8
11
|
} from "@draftbit/types";
|
|
9
12
|
|
|
10
13
|
const SEED_DATA_PROPS = {
|
|
@@ -18,6 +21,12 @@ const SEED_DATA_PROPS = {
|
|
|
18
21
|
required: true,
|
|
19
22
|
group: GROUPS.data,
|
|
20
23
|
},
|
|
24
|
+
labelSize: createNumberProp({
|
|
25
|
+
label: "Label Size",
|
|
26
|
+
}),
|
|
27
|
+
labelColor: createColorProp({
|
|
28
|
+
label: "Label Color",
|
|
29
|
+
}),
|
|
21
30
|
mode: {
|
|
22
31
|
label: "Mode",
|
|
23
32
|
description: "Choose between date, time and datetime",
|
|
@@ -29,6 +38,12 @@ const SEED_DATA_PROPS = {
|
|
|
29
38
|
options: ["date", "time", "datetime"],
|
|
30
39
|
group: GROUPS.basic,
|
|
31
40
|
},
|
|
41
|
+
borderColor: createColorProp({
|
|
42
|
+
label: "Border Color",
|
|
43
|
+
}),
|
|
44
|
+
borderColorActive: createColorProp({
|
|
45
|
+
label: "Border Color",
|
|
46
|
+
}),
|
|
32
47
|
format: {
|
|
33
48
|
label: "Format",
|
|
34
49
|
description: "Create an output format for the date.",
|
|
@@ -150,6 +165,14 @@ export const SEED_DATA = [
|
|
|
150
165
|
category: COMPONENT_TYPES.input,
|
|
151
166
|
layout: null,
|
|
152
167
|
triggers: [Triggers.OnDateChange],
|
|
168
|
+
StylesPanelSections: [
|
|
169
|
+
StylesPanelSections.Background,
|
|
170
|
+
StylesPanelSections.Borders,
|
|
171
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
172
|
+
StylesPanelSections.Position,
|
|
173
|
+
StylesPanelSections.Size,
|
|
174
|
+
StylesPanelSections.Typography,
|
|
175
|
+
],
|
|
153
176
|
props: {
|
|
154
177
|
...SEED_DATA_PROPS,
|
|
155
178
|
type: {
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _bottomSheet = _interopRequireWildcard(require("@gorhom/bottom-sheet"));
|
|
10
|
-
var _utilities = require("../../utilities");
|
|
11
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
-
const BottomSheetComponent = _ref => {
|
|
14
|
-
let {
|
|
15
|
-
style,
|
|
16
|
-
children,
|
|
17
|
-
step
|
|
18
|
-
} = _ref;
|
|
19
|
-
const bottomSheetRef = (0, _react.useRef)(null);
|
|
20
|
-
const {
|
|
21
|
-
viewStyles
|
|
22
|
-
} = (0, _utilities.extractStyles)(style);
|
|
23
|
-
|
|
24
|
-
// variables
|
|
25
|
-
const snapPoints = (0, _react.useMemo)(() => ["25%", "50%", "90%"], []);
|
|
26
|
-
|
|
27
|
-
// callbacks
|
|
28
|
-
const handleSheetChanges = (0, _react.useCallback)(index => {
|
|
29
|
-
console.log("handleSheetChanges", index);
|
|
30
|
-
}, []);
|
|
31
|
-
_react.default.useEffect(() => {
|
|
32
|
-
if (step === -1) {
|
|
33
|
-
var _bottomSheetRef$curre;
|
|
34
|
-
bottomSheetRef === null || bottomSheetRef === void 0 ? void 0 : (_bottomSheetRef$curre = bottomSheetRef.current) === null || _bottomSheetRef$curre === void 0 ? void 0 : _bottomSheetRef$curre.close();
|
|
35
|
-
}
|
|
36
|
-
}, [step]);
|
|
37
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
38
|
-
style: [containerStyle.container, viewStyles, {
|
|
39
|
-
backgroundColor: step !== -1 ? "grey" : "transparent"
|
|
40
|
-
}]
|
|
41
|
-
}, /*#__PURE__*/_react.default.createElement(_bottomSheet.default, {
|
|
42
|
-
ref: bottomSheetRef,
|
|
43
|
-
index: step,
|
|
44
|
-
snapPoints: snapPoints,
|
|
45
|
-
onChange: handleSheetChanges
|
|
46
|
-
}, /*#__PURE__*/_react.default.createElement(_bottomSheet.BottomSheetView, null, children)));
|
|
47
|
-
};
|
|
48
|
-
var _default = BottomSheetComponent;
|
|
49
|
-
exports.default = _default;
|
|
50
|
-
const containerStyle = _reactNative.StyleSheet.create({
|
|
51
|
-
container: {
|
|
52
|
-
flex: 1
|
|
53
|
-
},
|
|
54
|
-
contentContainer: {
|
|
55
|
-
flex: 1,
|
|
56
|
-
alignItems: "center"
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
//# sourceMappingURL=BottomSheet.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["BottomSheetComponent","style","children","step","bottomSheetRef","useRef","viewStyles","extractStyles","snapPoints","useMemo","handleSheetChanges","useCallback","index","console","log","React","useEffect","current","close","containerStyle","container","backgroundColor","StyleSheet","create","flex","contentContainer","alignItems"],"sourceRoot":"../../src","sources":["BottomSheet.native.tsx"],"mappings":";;;;;;AAAA;AACA;AACA;AAEA;AAAgD;AAAA;AAGhD,MAAMA,oBAAgD,GAAG,QAInD;EAAA,IAJoD;IACxDC,KAAK;IACLC,QAAQ;IACRC;EACF,CAAC;EACC,MAAMC,cAAc,GAAG,IAAAC,aAAM,EAAc,IAAI,CAAC;EAChD,MAAM;IAAEC;EAAW,CAAC,GAAG,IAAAC,wBAAa,EAACN,KAAK,CAAC;;EAE3C;EACA,MAAMO,UAAU,GAAG,IAAAC,cAAO,EAAC,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;;EAE3D;EACA,MAAMC,kBAAkB,GAAG,IAAAC,kBAAW,EAAEC,KAAa,IAAK;IACxDC,OAAO,CAACC,GAAG,CAAC,oBAAoB,EAAEF,KAAK,CAAC;EAC1C,CAAC,EAAE,EAAE,CAAC;EAENG,cAAK,CAACC,SAAS,CAAC,MAAM;IACpB,IAAIb,IAAI,KAAK,CAAC,CAAC,EAAE;MAAA;MACfC,cAAc,aAAdA,cAAc,gDAAdA,cAAc,CAAEa,OAAO,0DAAvB,sBAAyBC,KAAK,EAAE;IAClC;EACF,CAAC,EAAE,CAACf,IAAI,CAAC,CAAC;EAEV,oBACE,6BAAC,iBAAI;IACH,KAAK,EAAE,CACLgB,cAAc,CAACC,SAAS,EACxBd,UAAU,EACV;MAAEe,eAAe,EAAElB,IAAI,KAAK,CAAC,CAAC,GAAG,MAAM,GAAG;IAAc,CAAC;EACzD,gBAEF,6BAAC,oBAAW;IACV,GAAG,EAAEC,cAAe;IACpB,KAAK,EAAED,IAAK;IACZ,UAAU,EAAEK,UAAW;IACvB,QAAQ,EAAEE;EAAmB,gBAE7B,6BAAC,4BAAe,QAAER,QAAQ,CAAmB,CACjC,CACT;AAEX,CAAC;AAAC,eAEaF,oBAAoB;AAAA;AAEnC,MAAMmB,cAAc,GAAGG,uBAAU,CAACC,MAAM,CAAC;EACvCH,SAAS,EAAE;IACTI,IAAI,EAAE;EACR,CAAC;EACDC,gBAAgB,EAAE;IAChBD,IAAI,EAAE,CAAC;IACPE,UAAU,EAAE;EACd;AACF,CAAC,CAAC"}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _reactNativeScrollBottomSheet = _interopRequireDefault(require("react-native-scroll-bottom-sheet"));
|
|
10
|
-
var _utilities = require("../../utilities");
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
const windowHeight = _reactNative.Dimensions.get("window").height;
|
|
13
|
-
const BottomSheetComponent = _ref => {
|
|
14
|
-
let {
|
|
15
|
-
style,
|
|
16
|
-
children,
|
|
17
|
-
step
|
|
18
|
-
} = _ref;
|
|
19
|
-
const {
|
|
20
|
-
viewStyles
|
|
21
|
-
} = (0, _utilities.extractStyles)(style);
|
|
22
|
-
const bottomSheetRef = _react.default.useRef();
|
|
23
|
-
const webStep = _react.default.useMemo(() => step + 1, [step]);
|
|
24
|
-
const snapPoints = _react.default.useMemo(() => ["25%", "50%", windowHeight - 200], []);
|
|
25
|
-
_react.default.useEffect(() => {
|
|
26
|
-
var _bottomSheetRef$curre;
|
|
27
|
-
bottomSheetRef === null || bottomSheetRef === void 0 ? void 0 : (_bottomSheetRef$curre = bottomSheetRef.current) === null || _bottomSheetRef$curre === void 0 ? void 0 : _bottomSheetRef$curre.snapTo(snapPoints.length - webStep);
|
|
28
|
-
// bottomSheetRef.current.snapTo(step);
|
|
29
|
-
}, [webStep, step, snapPoints]);
|
|
30
|
-
if (step === -1) {
|
|
31
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
32
|
-
}
|
|
33
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
34
|
-
style: styles.container
|
|
35
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNativeScrollBottomSheet.default, {
|
|
36
|
-
ref: bottomSheetRef,
|
|
37
|
-
componentType: "ScrollView",
|
|
38
|
-
snapPoints: snapPoints,
|
|
39
|
-
initialSnapIndex: 0,
|
|
40
|
-
renderHandle: () => /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
41
|
-
style: styles.header
|
|
42
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
43
|
-
style: styles.panelHandle
|
|
44
|
-
})),
|
|
45
|
-
contentContainerStyle: styles.contentContainerStyle
|
|
46
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
47
|
-
style: {
|
|
48
|
-
...styles.container,
|
|
49
|
-
...viewStyles,
|
|
50
|
-
backgroundColor: webStep !== -1 ? "grey" : "transparent"
|
|
51
|
-
}
|
|
52
|
-
}, children)));
|
|
53
|
-
};
|
|
54
|
-
var _default = BottomSheetComponent;
|
|
55
|
-
exports.default = _default;
|
|
56
|
-
const styles = _reactNative.StyleSheet.create({
|
|
57
|
-
container: {
|
|
58
|
-
flex: 1
|
|
59
|
-
},
|
|
60
|
-
contentContainerStyle: {
|
|
61
|
-
padding: 16
|
|
62
|
-
},
|
|
63
|
-
header: {
|
|
64
|
-
alignItems: "center",
|
|
65
|
-
backgroundColor: "white",
|
|
66
|
-
paddingVertical: 20,
|
|
67
|
-
borderTopLeftRadius: 20,
|
|
68
|
-
borderTopRightRadius: 20
|
|
69
|
-
},
|
|
70
|
-
panelHandle: {
|
|
71
|
-
width: 40,
|
|
72
|
-
height: 2,
|
|
73
|
-
backgroundColor: "rgba(0,0,0,0.3)",
|
|
74
|
-
borderRadius: 4
|
|
75
|
-
},
|
|
76
|
-
item: {
|
|
77
|
-
padding: 20,
|
|
78
|
-
justifyContent: "center",
|
|
79
|
-
backgroundColor: "white",
|
|
80
|
-
alignItems: "center",
|
|
81
|
-
marginVertical: 10
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
//# sourceMappingURL=BottomSheet.web.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["windowHeight","Dimensions","get","height","BottomSheetComponent","style","children","step","viewStyles","extractStyles","bottomSheetRef","React","useRef","webStep","useMemo","snapPoints","useEffect","current","snapTo","length","styles","container","header","panelHandle","contentContainerStyle","backgroundColor","StyleSheet","create","flex","padding","alignItems","paddingVertical","borderTopLeftRadius","borderTopRightRadius","width","borderRadius","item","justifyContent","marginVertical"],"sourceRoot":"../../src","sources":["BottomSheet.web.tsx"],"mappings":";;;;;;AAAA;AACA;AACA;AAEA;AAAgD;AAGhD,MAAMA,YAAY,GAAGC,uBAAU,CAACC,GAAG,CAAC,QAAQ,CAAC,CAACC,MAAM;AAEpD,MAAMC,oBAAgD,GAAG,QAInD;EAAA,IAJoD;IACxDC,KAAK;IACLC,QAAQ;IACRC;EACF,CAAC;EACC,MAAM;IAAEC;EAAW,CAAC,GAAG,IAAAC,wBAAa,EAACJ,KAAK,CAAC;EAC3C,MAAMK,cAAc,GAAGC,cAAK,CAACC,MAAM,EAAO;EAE1C,MAAMC,OAAO,GAAGF,cAAK,CAACG,OAAO,CAAC,MAAMP,IAAI,GAAG,CAAC,EAAE,CAACA,IAAI,CAAC,CAAC;EACrD,MAAMQ,UAAU,GAAGJ,cAAK,CAACG,OAAO,CAC9B,MAAM,CAAC,KAAK,EAAE,KAAK,EAAEd,YAAY,GAAG,GAAG,CAAC,EACxC,EAAE,CACH;EAEDW,cAAK,CAACK,SAAS,CAAC,MAAM;IAAA;IACpBN,cAAc,aAAdA,cAAc,gDAAdA,cAAc,CAAEO,OAAO,0DAAvB,sBAAyBC,MAAM,CAACH,UAAU,CAACI,MAAM,GAAGN,OAAO,CAAC;IAC5D;EACF,CAAC,EAAE,CAACA,OAAO,EAAEN,IAAI,EAAEQ,UAAU,CAAC,CAAC;EAE/B,IAAIR,IAAI,KAAK,CAAC,CAAC,EAAE;IACf,oBAAO,2DAAK;EACd;EAEA,oBACE,6BAAC,iBAAI;IAAC,KAAK,EAAEa,MAAM,CAACC;EAAU,gBAC5B,6BAAC,qCAAiB;IAChB,GAAG,EAAEX,cAAe;IACpB,aAAa,EAAC,YAAY;IAC1B,UAAU,EAAEK,UAAW;IACvB,gBAAgB,EAAE,CAAE;IACpB,YAAY,EAAE,mBACZ,6BAAC,iBAAI;MAAC,KAAK,EAAEK,MAAM,CAACE;IAAO,gBACzB,6BAAC,iBAAI;MAAC,KAAK,EAAEF,MAAM,CAACG;IAAY,EAAG,CAErC;IACF,qBAAqB,EAAEH,MAAM,CAACI;EAAsB,gBAEpD,6BAAC,iBAAI;IACH,KAAK,EAAE;MACL,GAAGJ,MAAM,CAACC,SAAS;MACnB,GAAGb,UAAU;MACbiB,eAAe,EAAEZ,OAAO,KAAK,CAAC,CAAC,GAAG,MAAM,GAAG;IAC7C;EAAE,GAEDP,QAAQ,CACJ,CACW,CACf;AAEX,CAAC;AAAC,eAEaF,oBAAoB;AAAA;AAEnC,MAAMgB,MAAM,GAAGM,uBAAU,CAACC,MAAM,CAAC;EAC/BN,SAAS,EAAE;IACTO,IAAI,EAAE;EACR,CAAC;EACDJ,qBAAqB,EAAE;IACrBK,OAAO,EAAE;EACX,CAAC;EACDP,MAAM,EAAE;IACNQ,UAAU,EAAE,QAAQ;IACpBL,eAAe,EAAE,OAAO;IACxBM,eAAe,EAAE,EAAE;IACnBC,mBAAmB,EAAE,EAAE;IACvBC,oBAAoB,EAAE;EACxB,CAAC;EACDV,WAAW,EAAE;IACXW,KAAK,EAAE,EAAE;IACT/B,MAAM,EAAE,CAAC;IACTsB,eAAe,EAAE,iBAAiB;IAClCU,YAAY,EAAE;EAChB,CAAC;EACDC,IAAI,EAAE;IACJP,OAAO,EAAE,EAAE;IACXQ,cAAc,EAAE,QAAQ;IACxBZ,eAAe,EAAE,OAAO;IACxBK,UAAU,EAAE,QAAQ;IACpBQ,cAAc,EAAE;EAClB;AACF,CAAC,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "BottomSheet", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _BottomSheet.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
var _BottomSheet = _interopRequireDefault(require("./BottomSheet"));
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;AACA;AAAuD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.tsx"],"mappings":""}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.SEED_DATA = void 0;
|
|
7
|
-
var _types = require("@draftbit/types");
|
|
8
|
-
const SEED_DATA = {
|
|
9
|
-
name: "Bottom Sheet",
|
|
10
|
-
tag: "BottomSheet",
|
|
11
|
-
category: _types.COMPONENT_TYPES.container,
|
|
12
|
-
stylesPanelSections: [_types.StylesPanelSections.Background, _types.StylesPanelSections.Borders, _types.StylesPanelSections.Size, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Position, _types.StylesPanelSections.Effects],
|
|
13
|
-
props: {
|
|
14
|
-
step: (0, _types.createNumberProp)({
|
|
15
|
-
label: "Step",
|
|
16
|
-
description: "Step can be -1, 0, 1, or 2."
|
|
17
|
-
})
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
exports.SEED_DATA = SEED_DATA;
|
|
21
|
-
//# sourceMappingURL=BottomSheet.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["SEED_DATA","name","tag","category","COMPONENT_TYPES","container","stylesPanelSections","StylesPanelSections","Background","Borders","Size","MarginsAndPaddings","Position","Effects","props","step","createNumberProp","label","description"],"sourceRoot":"../../src","sources":["BottomSheet.ts"],"mappings":";;;;;;AAAA;AAMO,MAAMA,SAAS,GAAG;EACvBC,IAAI,EAAE,cAAc;EACpBC,GAAG,EAAE,aAAa;EAClBC,QAAQ,EAAEC,sBAAe,CAACC,SAAS;EACnCC,mBAAmB,EAAE,CACnBC,0BAAmB,CAACC,UAAU,EAC9BD,0BAAmB,CAACE,OAAO,EAC3BF,0BAAmB,CAACG,IAAI,EACxBH,0BAAmB,CAACI,kBAAkB,EACtCJ,0BAAmB,CAACK,QAAQ,EAC5BL,0BAAmB,CAACM,OAAO,CAC5B;EACDC,KAAK,EAAE;IACLC,IAAI,EAAE,IAAAC,uBAAgB,EAAC;MACrBC,KAAK,EAAE,MAAM;MACbC,WAAW,EAAE;IACf,CAAC;EACH;AACF,CAAC;AAAC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useMemo, useRef } from "react";
|
|
2
|
-
import { View, StyleSheet } from "react-native";
|
|
3
|
-
import BottomSheet, { BottomSheetView } from "@gorhom/bottom-sheet";
|
|
4
|
-
import { extractStyles } from "../../utilities";
|
|
5
|
-
const BottomSheetComponent = _ref => {
|
|
6
|
-
let {
|
|
7
|
-
style,
|
|
8
|
-
children,
|
|
9
|
-
step
|
|
10
|
-
} = _ref;
|
|
11
|
-
const bottomSheetRef = useRef(null);
|
|
12
|
-
const {
|
|
13
|
-
viewStyles
|
|
14
|
-
} = extractStyles(style);
|
|
15
|
-
|
|
16
|
-
// variables
|
|
17
|
-
const snapPoints = useMemo(() => ["25%", "50%", "90%"], []);
|
|
18
|
-
|
|
19
|
-
// callbacks
|
|
20
|
-
const handleSheetChanges = useCallback(index => {
|
|
21
|
-
console.log("handleSheetChanges", index);
|
|
22
|
-
}, []);
|
|
23
|
-
React.useEffect(() => {
|
|
24
|
-
if (step === -1) {
|
|
25
|
-
var _bottomSheetRef$curre;
|
|
26
|
-
bottomSheetRef === null || bottomSheetRef === void 0 ? void 0 : (_bottomSheetRef$curre = bottomSheetRef.current) === null || _bottomSheetRef$curre === void 0 ? void 0 : _bottomSheetRef$curre.close();
|
|
27
|
-
}
|
|
28
|
-
}, [step]);
|
|
29
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
30
|
-
style: [containerStyle.container, viewStyles, {
|
|
31
|
-
backgroundColor: step !== -1 ? "grey" : "transparent"
|
|
32
|
-
}]
|
|
33
|
-
}, /*#__PURE__*/React.createElement(BottomSheet, {
|
|
34
|
-
ref: bottomSheetRef,
|
|
35
|
-
index: step,
|
|
36
|
-
snapPoints: snapPoints,
|
|
37
|
-
onChange: handleSheetChanges
|
|
38
|
-
}, /*#__PURE__*/React.createElement(BottomSheetView, null, children)));
|
|
39
|
-
};
|
|
40
|
-
export default BottomSheetComponent;
|
|
41
|
-
const containerStyle = StyleSheet.create({
|
|
42
|
-
container: {
|
|
43
|
-
flex: 1
|
|
44
|
-
},
|
|
45
|
-
contentContainer: {
|
|
46
|
-
flex: 1,
|
|
47
|
-
alignItems: "center"
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
//# sourceMappingURL=BottomSheet.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useMemo","useRef","View","StyleSheet","BottomSheet","BottomSheetView","extractStyles","BottomSheetComponent","style","children","step","bottomSheetRef","viewStyles","snapPoints","handleSheetChanges","index","console","log","useEffect","current","close","containerStyle","container","backgroundColor","create","flex","contentContainer","alignItems"],"sourceRoot":"../../src","sources":["BottomSheet.native.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAC3D,SAASC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AAC/C,OAAOC,WAAW,IAAIC,eAAe,QAAQ,sBAAsB;AAEnE,SAASC,aAAa,QAAQ,iBAAiB;AAG/C,MAAMC,oBAAgD,GAAG,QAInD;EAAA,IAJoD;IACxDC,KAAK;IACLC,QAAQ;IACRC;EACF,CAAC;EACC,MAAMC,cAAc,GAAGV,MAAM,CAAc,IAAI,CAAC;EAChD,MAAM;IAAEW;EAAW,CAAC,GAAGN,aAAa,CAACE,KAAK,CAAC;;EAE3C;EACA,MAAMK,UAAU,GAAGb,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;;EAE3D;EACA,MAAMc,kBAAkB,GAAGf,WAAW,CAAEgB,KAAa,IAAK;IACxDC,OAAO,CAACC,GAAG,CAAC,oBAAoB,EAAEF,KAAK,CAAC;EAC1C,CAAC,EAAE,EAAE,CAAC;EAENjB,KAAK,CAACoB,SAAS,CAAC,MAAM;IACpB,IAAIR,IAAI,KAAK,CAAC,CAAC,EAAE;MAAA;MACfC,cAAc,aAAdA,cAAc,gDAAdA,cAAc,CAAEQ,OAAO,0DAAvB,sBAAyBC,KAAK,EAAE;IAClC;EACF,CAAC,EAAE,CAACV,IAAI,CAAC,CAAC;EAEV,oBACE,oBAAC,IAAI;IACH,KAAK,EAAE,CACLW,cAAc,CAACC,SAAS,EACxBV,UAAU,EACV;MAAEW,eAAe,EAAEb,IAAI,KAAK,CAAC,CAAC,GAAG,MAAM,GAAG;IAAc,CAAC;EACzD,gBAEF,oBAAC,WAAW;IACV,GAAG,EAAEC,cAAe;IACpB,KAAK,EAAED,IAAK;IACZ,UAAU,EAAEG,UAAW;IACvB,QAAQ,EAAEC;EAAmB,gBAE7B,oBAAC,eAAe,QAAEL,QAAQ,CAAmB,CACjC,CACT;AAEX,CAAC;AAED,eAAeF,oBAAoB;AAEnC,MAAMc,cAAc,GAAGlB,UAAU,CAACqB,MAAM,CAAC;EACvCF,SAAS,EAAE;IACTG,IAAI,EAAE;EACR,CAAC;EACDC,gBAAgB,EAAE;IAChBD,IAAI,EAAE,CAAC;IACPE,UAAU,EAAE;EACd;AACF,CAAC,CAAC"}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { StyleSheet, View, Dimensions } from "react-native";
|
|
3
|
-
import ScrollBottomSheet from "react-native-scroll-bottom-sheet";
|
|
4
|
-
import { extractStyles } from "../../utilities";
|
|
5
|
-
const windowHeight = Dimensions.get("window").height;
|
|
6
|
-
const BottomSheetComponent = _ref => {
|
|
7
|
-
let {
|
|
8
|
-
style,
|
|
9
|
-
children,
|
|
10
|
-
step
|
|
11
|
-
} = _ref;
|
|
12
|
-
const {
|
|
13
|
-
viewStyles
|
|
14
|
-
} = extractStyles(style);
|
|
15
|
-
const bottomSheetRef = React.useRef();
|
|
16
|
-
const webStep = React.useMemo(() => step + 1, [step]);
|
|
17
|
-
const snapPoints = React.useMemo(() => ["25%", "50%", windowHeight - 200], []);
|
|
18
|
-
React.useEffect(() => {
|
|
19
|
-
var _bottomSheetRef$curre;
|
|
20
|
-
bottomSheetRef === null || bottomSheetRef === void 0 ? void 0 : (_bottomSheetRef$curre = bottomSheetRef.current) === null || _bottomSheetRef$curre === void 0 ? void 0 : _bottomSheetRef$curre.snapTo(snapPoints.length - webStep);
|
|
21
|
-
// bottomSheetRef.current.snapTo(step);
|
|
22
|
-
}, [webStep, step, snapPoints]);
|
|
23
|
-
if (step === -1) {
|
|
24
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
25
|
-
}
|
|
26
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
27
|
-
style: styles.container
|
|
28
|
-
}, /*#__PURE__*/React.createElement(ScrollBottomSheet, {
|
|
29
|
-
ref: bottomSheetRef,
|
|
30
|
-
componentType: "ScrollView",
|
|
31
|
-
snapPoints: snapPoints,
|
|
32
|
-
initialSnapIndex: 0,
|
|
33
|
-
renderHandle: () => /*#__PURE__*/React.createElement(View, {
|
|
34
|
-
style: styles.header
|
|
35
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
36
|
-
style: styles.panelHandle
|
|
37
|
-
})),
|
|
38
|
-
contentContainerStyle: styles.contentContainerStyle
|
|
39
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
40
|
-
style: {
|
|
41
|
-
...styles.container,
|
|
42
|
-
...viewStyles,
|
|
43
|
-
backgroundColor: webStep !== -1 ? "grey" : "transparent"
|
|
44
|
-
}
|
|
45
|
-
}, children)));
|
|
46
|
-
};
|
|
47
|
-
export default BottomSheetComponent;
|
|
48
|
-
const styles = StyleSheet.create({
|
|
49
|
-
container: {
|
|
50
|
-
flex: 1
|
|
51
|
-
},
|
|
52
|
-
contentContainerStyle: {
|
|
53
|
-
padding: 16
|
|
54
|
-
},
|
|
55
|
-
header: {
|
|
56
|
-
alignItems: "center",
|
|
57
|
-
backgroundColor: "white",
|
|
58
|
-
paddingVertical: 20,
|
|
59
|
-
borderTopLeftRadius: 20,
|
|
60
|
-
borderTopRightRadius: 20
|
|
61
|
-
},
|
|
62
|
-
panelHandle: {
|
|
63
|
-
width: 40,
|
|
64
|
-
height: 2,
|
|
65
|
-
backgroundColor: "rgba(0,0,0,0.3)",
|
|
66
|
-
borderRadius: 4
|
|
67
|
-
},
|
|
68
|
-
item: {
|
|
69
|
-
padding: 20,
|
|
70
|
-
justifyContent: "center",
|
|
71
|
-
backgroundColor: "white",
|
|
72
|
-
alignItems: "center",
|
|
73
|
-
marginVertical: 10
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
//# sourceMappingURL=BottomSheet.web.js.map
|