@draftbit/core 46.9.1-f8902c.2 → 46.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/lib/commonjs/components/CircleImage.js +1 -15
  2. package/lib/commonjs/components/FormRow.js +2 -16
  3. package/lib/commonjs/components/Justification.js +1 -5
  4. package/lib/commonjs/components/ResizeMode.js +1 -5
  5. package/lib/commonjs/index.js +0 -7
  6. package/lib/module/components/Justification.js +0 -1
  7. package/lib/module/components/ResizeMode.js +0 -1
  8. package/lib/module/index.js +0 -1
  9. package/lib/typescript/src/index.d.ts +0 -1
  10. package/lib/typescript/src/index.d.ts.map +1 -1
  11. package/package.json +3 -4
  12. package/src/index.tsx +0 -2
  13. package/lib/commonjs/components/BottomSheet/BottomSheet.js +0 -89
  14. package/lib/commonjs/components/BottomSheet/BottomSheetComponent.js +0 -464
  15. package/lib/commonjs/components/BottomSheet/index.js +0 -13
  16. package/lib/commonjs/mappings/BottomSheet.js +0 -75
  17. package/lib/module/components/BottomSheet/BottomSheet.js +0 -81
  18. package/lib/module/components/BottomSheet/BottomSheetComponent.js +0 -470
  19. package/lib/module/components/BottomSheet/index.js +0 -1
  20. package/lib/module/mappings/BottomSheet.js +0 -68
  21. package/lib/typescript/src/components/BottomSheet/BottomSheet.d.ts +0 -20
  22. package/lib/typescript/src/components/BottomSheet/BottomSheet.d.ts.map +0 -1
  23. package/lib/typescript/src/components/BottomSheet/BottomSheetComponent.d.ts +0 -170
  24. package/lib/typescript/src/components/BottomSheet/BottomSheetComponent.d.ts.map +0 -1
  25. package/lib/typescript/src/components/BottomSheet/index.d.ts +0 -2
  26. package/lib/typescript/src/components/BottomSheet/index.d.ts.map +0 -1
  27. package/lib/typescript/src/mappings/BottomSheet.d.ts +0 -120
  28. package/lib/typescript/src/mappings/BottomSheet.d.ts.map +0 -1
  29. package/src/Provider.js +0 -9
  30. package/src/components/Accordion/AccordionGroup.js +0 -44
  31. package/src/components/Accordion/AccordionItem.js +0 -32
  32. package/src/components/Accordion/index.js +0 -2
  33. package/src/components/ActionSheet/ActionSheet.js +0 -45
  34. package/src/components/ActionSheet/ActionSheetCancel.js +0 -6
  35. package/src/components/ActionSheet/ActionSheetItem.js +0 -30
  36. package/src/components/ActionSheet/index.js +0 -3
  37. package/src/components/AnimatedCircularProgress.js +0 -43
  38. package/src/components/AspectRatio.js +0 -18
  39. package/src/components/AvatarEdit.js +0 -30
  40. package/src/components/Banner.js +0 -109
  41. package/src/components/BottomSheet/BottomSheet.js +0 -57
  42. package/src/components/BottomSheet/BottomSheet.tsx +0 -121
  43. package/src/components/BottomSheet/BottomSheetComponent.js +0 -437
  44. package/src/components/BottomSheet/BottomSheetComponent.tsx +0 -895
  45. package/src/components/BottomSheet/index.js +0 -1
  46. package/src/components/BottomSheet/index.ts +0 -1
  47. package/src/components/Button.js +0 -114
  48. package/src/components/Card.js +0 -57
  49. package/src/components/Checkbox/Checkbox.js +0 -62
  50. package/src/components/Checkbox/CheckboxGroup.js +0 -21
  51. package/src/components/Checkbox/CheckboxGroupRow.js +0 -76
  52. package/src/components/Checkbox/CheckboxRow.js +0 -77
  53. package/src/components/Checkbox/context.js +0 -14
  54. package/src/components/Checkbox/index.js +0 -3
  55. package/src/components/CircleImage.js +0 -8
  56. package/src/components/CircularProgress.js +0 -81
  57. package/src/components/Config.js +0 -64
  58. package/src/components/Container.js +0 -43
  59. package/src/components/DatePicker/DatePicker.js +0 -382
  60. package/src/components/DatePicker/DatePickerComponent.js +0 -13
  61. package/src/components/DatePicker/DatePickerComponent.web.js +0 -30
  62. package/src/components/DatePicker/DatePickerComponentType.js +0 -1
  63. package/src/components/DeckSwiper/DeckSwiper.js +0 -65
  64. package/src/components/DeckSwiper/DeckSwiperCard.js +0 -21
  65. package/src/components/DeckSwiper/index.js +0 -2
  66. package/src/components/DeprecatedButton.js +0 -83
  67. package/src/components/DeprecatedCardWrapper.js +0 -18
  68. package/src/components/DeprecatedFAB.js +0 -114
  69. package/src/components/Divider.js +0 -13
  70. package/src/components/Elevation.js +0 -20
  71. package/src/components/FAB.js +0 -46
  72. package/src/components/FieldSearchBarFull.js +0 -53
  73. package/src/components/FormRow.js +0 -19
  74. package/src/components/IconButton.js +0 -35
  75. package/src/components/Image.js +0 -47
  76. package/src/components/Justification.js +0 -1
  77. package/src/components/Layout.js +0 -50
  78. package/src/components/Markdown.js +0 -10
  79. package/src/components/NumberInput.js +0 -49
  80. package/src/components/Picker/Picker.js +0 -266
  81. package/src/components/Picker/PickerComponent.android.js +0 -69
  82. package/src/components/Picker/PickerComponent.ios.js +0 -79
  83. package/src/components/Picker/PickerComponent.web.js +0 -70
  84. package/src/components/Picker/PickerTypes.js +0 -1
  85. package/src/components/Portal/Portal.js +0 -35
  86. package/src/components/Portal/PortalConsumer.js +0 -27
  87. package/src/components/Portal/PortalHost.js +0 -107
  88. package/src/components/Portal/PortalManager.js +0 -32
  89. package/src/components/Pressable.js +0 -12
  90. package/src/components/ProgressBar.js +0 -118
  91. package/src/components/ProgressCircle.js +0 -13
  92. package/src/components/ProgressIndicator.js +0 -27
  93. package/src/components/RadioButton/RadioButton.js +0 -17
  94. package/src/components/RadioButton/RadioButtonFieldGroup.js +0 -17
  95. package/src/components/RadioButton/RadioButtonGroup.js +0 -43
  96. package/src/components/RadioButton/RadioButtonRow.js +0 -76
  97. package/src/components/RadioButton/context.js +0 -14
  98. package/src/components/RadioButton/index.js +0 -4
  99. package/src/components/ResizeMode.js +0 -1
  100. package/src/components/Row.js +0 -48
  101. package/src/components/RowBodyIcon.js +0 -8
  102. package/src/components/RowHeadlineImageCaption.js +0 -12
  103. package/src/components/RowHeadlineImageIcon.js +0 -14
  104. package/src/components/SVG.js +0 -13
  105. package/src/components/ScreenContainer.js +0 -35
  106. package/src/components/Shadow.js +0 -16
  107. package/src/components/Slider.js +0 -63
  108. package/src/components/StarRating.js +0 -50
  109. package/src/components/StepIndicator.js +0 -346
  110. package/src/components/Stepper.js +0 -41
  111. package/src/components/Surface.js +0 -32
  112. package/src/components/Swiper/Swiper.js +0 -29
  113. package/src/components/Swiper/SwiperItem.js +0 -9
  114. package/src/components/Swiper/index.js +0 -2
  115. package/src/components/Switch.js +0 -56
  116. package/src/components/TabView/TabView.js +0 -54
  117. package/src/components/TabView/TabViewItem.js +0 -11
  118. package/src/components/TabView/index.js +0 -2
  119. package/src/components/Text.js +0 -33
  120. package/src/components/TextField.js +0 -428
  121. package/src/components/ToggleButton.js +0 -39
  122. package/src/components/Touchable.js +0 -12
  123. package/src/components/Touchable.web.js +0 -2
  124. package/src/components/Typography.js +0 -36
  125. package/src/components/useAuthState.js +0 -31
  126. package/src/constants.js +0 -10
  127. package/src/hooks.js +0 -12
  128. package/src/index.js +0 -50
  129. package/src/interfaces/Icon.js +0 -8
  130. package/src/mappings/Accordion.js +0 -50
  131. package/src/mappings/AccordionItem.js +0 -17
  132. package/src/mappings/ActionSheet.js +0 -14
  133. package/src/mappings/ActionSheetCancel.js +0 -20
  134. package/src/mappings/ActionSheetItem.js +0 -24
  135. package/src/mappings/ActivityIndicator.js +0 -58
  136. package/src/mappings/AudioPlayer.js +0 -57
  137. package/src/mappings/AvatarEdit.js +0 -38
  138. package/src/mappings/Banner.js +0 -32
  139. package/src/mappings/BlurView.js +0 -42
  140. package/src/mappings/BottomSheet.js +0 -64
  141. package/src/mappings/BottomSheet.ts +0 -78
  142. package/src/mappings/Button.js +0 -116
  143. package/src/mappings/Card.js +0 -52
  144. package/src/mappings/CardBlock.js +0 -123
  145. package/src/mappings/CardContainer.js +0 -104
  146. package/src/mappings/CardContainerRating.js +0 -126
  147. package/src/mappings/CardContainerShortImage.js +0 -120
  148. package/src/mappings/CardInline.js +0 -52
  149. package/src/mappings/Carousel.js +0 -19
  150. package/src/mappings/Checkbox.js +0 -46
  151. package/src/mappings/CheckboxGroup.js +0 -26
  152. package/src/mappings/CheckboxRow.js +0 -61
  153. package/src/mappings/CircleImage.js +0 -25
  154. package/src/mappings/Container.js +0 -30
  155. package/src/mappings/CustomCode.js +0 -8
  156. package/src/mappings/DatePicker.js +0 -182
  157. package/src/mappings/DeckSwiper.js +0 -48
  158. package/src/mappings/DeckSwiperCard.js +0 -16
  159. package/src/mappings/Divider.js +0 -27
  160. package/src/mappings/FAB.js +0 -37
  161. package/src/mappings/Fetch.js +0 -13
  162. package/src/mappings/FieldSearchBarFull.js +0 -50
  163. package/src/mappings/FlashList.js +0 -113
  164. package/src/mappings/FlatList.js +0 -51
  165. package/src/mappings/HeaderLarge.js +0 -29
  166. package/src/mappings/HeaderMedium.js +0 -55
  167. package/src/mappings/HeaderOverline.js +0 -55
  168. package/src/mappings/Icon.js +0 -32
  169. package/src/mappings/IconButton.js +0 -33
  170. package/src/mappings/Image.js +0 -35
  171. package/src/mappings/ImageBackground.js +0 -29
  172. package/src/mappings/KeyboardAvoidingView.js +0 -41
  173. package/src/mappings/KeyboardAwareScrollView.js +0 -50
  174. package/src/mappings/Layout.js +0 -200
  175. package/src/mappings/LinearGradient.js +0 -82
  176. package/src/mappings/MapCallout.js +0 -22
  177. package/src/mappings/MapMarker.js +0 -48
  178. package/src/mappings/MapView.js +0 -142
  179. package/src/mappings/Markdown.js +0 -25
  180. package/src/mappings/Modal.js +0 -42
  181. package/src/mappings/NumberInput.js +0 -254
  182. package/src/mappings/Picker.js +0 -153
  183. package/src/mappings/ProgressBar.js +0 -101
  184. package/src/mappings/ProgressCircle.js +0 -109
  185. package/src/mappings/ProgressIndicator.js +0 -181
  186. package/src/mappings/RadioButton.js +0 -51
  187. package/src/mappings/RadioButtonGroup.js +0 -17
  188. package/src/mappings/RadioButtonRow.js +0 -42
  189. package/src/mappings/RowBodyIcon.js +0 -75
  190. package/src/mappings/RowHeadlineImageCaption.js +0 -167
  191. package/src/mappings/RowHeadlineImageIcon.js +0 -99
  192. package/src/mappings/SVG.js +0 -20
  193. package/src/mappings/SafeAreaView.js +0 -33
  194. package/src/mappings/ScrollView.js +0 -37
  195. package/src/mappings/Shadow.js +0 -95
  196. package/src/mappings/Slider.js +0 -60
  197. package/src/mappings/StarRating.js +0 -43
  198. package/src/mappings/Stepper.js +0 -32
  199. package/src/mappings/Surface.js +0 -14
  200. package/src/mappings/Swiper.js +0 -71
  201. package/src/mappings/SwiperItem.js +0 -9
  202. package/src/mappings/Switch.js +0 -81
  203. package/src/mappings/TabView.js +0 -75
  204. package/src/mappings/TabViewItem.js +0 -30
  205. package/src/mappings/Text.js +0 -251
  206. package/src/mappings/TextArea.js +0 -283
  207. package/src/mappings/TextField.js +0 -400
  208. package/src/mappings/TextInput.js +0 -402
  209. package/src/mappings/ToggleButton.js +0 -50
  210. package/src/mappings/Touchable.js +0 -67
  211. package/src/mappings/Video.js +0 -81
  212. package/src/mappings/View.js +0 -207
  213. package/src/mappings/WebView.js +0 -88
  214. package/src/styles/DarkTheme.js +0 -26
  215. package/src/styles/DefaultTheme.js +0 -111
  216. package/src/styles/fonts.js +0 -62
  217. package/src/styles/overlay.js +0 -60
  218. package/src/styles/shadow.js +0 -51
  219. package/src/theming.js +0 -3
  220. package/src/utilities.js +0 -102
@@ -1,382 +0,0 @@
1
- import * as React from "react";
2
- import { View, Animated, Text, StyleSheet, I18nManager, TextInput as NativeTextInput, Keyboard, } from "react-native";
3
- import { useSafeAreaInsets } from "react-native-safe-area-context";
4
- import dateFormat from "dateformat";
5
- import { withTheme } from "../../theming";
6
- import Portal from "../Portal/Portal";
7
- import Touchable from "../Touchable";
8
- import DateTimePicker from "./DatePickerComponent";
9
- import { extractStyles } from "../../utilities";
10
- const AnimatedText = Animated.createAnimatedComponent(Text);
11
- const FOCUS_ANIMATION_DURATION = 150;
12
- const BLUR_ANIMATION_DURATION = 180;
13
- const ICON_SIZE = 24;
14
- const MONTHS = [
15
- "January",
16
- "February",
17
- "March",
18
- "April",
19
- "May",
20
- "June",
21
- "July",
22
- "August",
23
- "September",
24
- "October",
25
- "November",
26
- "December",
27
- ];
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, autoDismissKeyboard = true, ...props }) => {
29
- const [value, setValue] = React.useState(date || defaultValue);
30
- React.useEffect(() => {
31
- if (defaultValue != null) {
32
- setValue(defaultValue);
33
- }
34
- }, [defaultValue]);
35
- const [pickerVisible, setPickerVisible] = React.useState(false);
36
- const [labeled] = React.useState(new Animated.Value(date ? 0 : 1));
37
- const [placeholder1, setPlaceholder1] = React.useState("");
38
- const [focused, setFocused] = React.useState(false);
39
- const [labelLayout, setLabelLayout] = React.useState({ measured: false, width: 0 });
40
- const { viewStyles, textStyles } = extractStyles(style);
41
- const getValidDate = () => {
42
- if (!value) {
43
- return new Date();
44
- }
45
- return typeof (value === null || value === void 0 ? void 0 : value.getMonth) === "function" ? value : new Date();
46
- };
47
- const formatDate = () => {
48
- if (!value)
49
- return "";
50
- let newDate = getValidDate();
51
- if (format)
52
- return dateFormat(newDate, format);
53
- if (mode === "time") {
54
- return `${newDate.toLocaleTimeString()}`;
55
- }
56
- if (mode === "datetime") {
57
- return `${newDate.toLocaleString()}`;
58
- }
59
- return `${MONTHS[newDate.getMonth()]} ${newDate.getDate()}, ${newDate.getFullYear()}`;
60
- };
61
- const toggleVisibility = async () => {
62
- setPickerVisible(!pickerVisible);
63
- focused ? _handleBlur() : _handleFocus();
64
- };
65
- const insets = useSafeAreaInsets();
66
- // const _restoreLabel = () =>
67
- // Animated.timing(labeled, {
68
- // toValue: 1,
69
- // duration: FOCUS_ANIMATION_DURATION,
70
- // useNativeDriver: true,
71
- // }).start();
72
- // const _minmizeLabel = () =>
73
- // Animated.timing(labeled, {
74
- // toValue: 0,
75
- // duration: BLUR_ANIMATION_DURATION,
76
- // useNativeDriver: true,
77
- // }).start();
78
- // const _showPlaceholder = () =>
79
- // setTimeout(() => setPlaceholder1(placeholder || ""), 50);
80
- const _hidePlaceholder = () => {
81
- setPlaceholder1("");
82
- };
83
- React.useEffect(() => {
84
- setValue(date);
85
- }, [date]);
86
- React.useEffect(() => {
87
- if (value || focused || placeholder1) {
88
- // _minmizeLabel();
89
- Animated.timing(labeled, {
90
- toValue: 0,
91
- duration: BLUR_ANIMATION_DURATION,
92
- useNativeDriver: true,
93
- }).start();
94
- }
95
- else {
96
- // _restoreLabel();
97
- Animated.timing(labeled, {
98
- toValue: 1,
99
- duration: FOCUS_ANIMATION_DURATION,
100
- useNativeDriver: true,
101
- }).start();
102
- }
103
- }, [value, focused, placeholder1, labeled]);
104
- React.useEffect(() => {
105
- const _showPlaceholder = () => setTimeout(() => setPlaceholder1(placeholder || ""), 50);
106
- if (focused || !label) {
107
- _showPlaceholder();
108
- }
109
- else {
110
- _hidePlaceholder();
111
- }
112
- return () => {
113
- clearTimeout(_showPlaceholder());
114
- };
115
- }, [focused, label, placeholder]);
116
- React.useEffect(() => {
117
- if (pickerVisible && autoDismissKeyboard) {
118
- Keyboard.dismiss();
119
- }
120
- }, [pickerVisible, autoDismissKeyboard]);
121
- const _handleFocus = () => {
122
- if (disabled) {
123
- return;
124
- }
125
- setFocused(true);
126
- };
127
- const _handleBlur = () => {
128
- if (disabled) {
129
- return;
130
- }
131
- setFocused(false);
132
- };
133
- const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
134
- const OUTLINE_MINIMIZED_LABEL_Y_OFFSET = -(16 * 0.5 + 4);
135
- const MAXIMIZED_LABEL_FONT_SIZE = textStyles.fontSize || typography.subtitle1.fontSize;
136
- const MINIMIZED_LABEL_FONT_SIZE = labelSize
137
- ? labelSize
138
- : typography.caption.fontSize;
139
- const hasActiveOutline = focused;
140
- let inputTextColor, activeColor, underlineColor, borderColor = inputBorderColor, placeholderColor, containerStyle, backgroundColor, inputStyle;
141
- inputTextColor = colors.strong;
142
- if (disabled) {
143
- activeColor = colors.light;
144
- placeholderColor = colors.light;
145
- borderColor = "transparent";
146
- underlineColor = "transparent";
147
- backgroundColor = colors.divider;
148
- }
149
- else {
150
- activeColor = inputBorderColorActive || colors.primary;
151
- placeholderColor = inputBorderColor || colors.light;
152
- underlineColor = inputBorderColor || colors.light;
153
- backgroundColor = colors.background;
154
- }
155
- const { lineHeight, ...subtitle1 } = typography.subtitle1;
156
- inputStyle = {
157
- paddingVertical: 0,
158
- color: inputTextColor,
159
- paddingLeft: leftIconName && leftIconMode === "inset"
160
- ? ICON_SIZE + (type === "solid" ? 16 : 12)
161
- : 0,
162
- paddingRight: rightIconName ? ICON_SIZE + 16 + 4 : 12,
163
- ...subtitle1,
164
- height: lineHeight,
165
- };
166
- if (type === "underline") {
167
- containerStyle = {
168
- borderTopLeftRadius: roundness,
169
- borderTopRightRadius: roundness,
170
- paddingBottom: 12,
171
- marginTop: 16,
172
- };
173
- }
174
- else {
175
- containerStyle = {
176
- borderRadius: roundness,
177
- borderColor: hasActiveOutline ? activeColor : borderColor,
178
- borderWidth: 1,
179
- paddingTop: labeled ? 16 * 1.5 : 16,
180
- paddingBottom: labeled ? 16 * 0.5 : 16,
181
- opacity: disabled ? disabledOpacity : 1,
182
- backgroundColor,
183
- };
184
- inputStyle.paddingHorizontal = 12;
185
- }
186
- if (leftIconName && leftIconMode === "outset") {
187
- containerStyle.marginLeft = ICON_SIZE + 8;
188
- }
189
- let leftIconColor;
190
- if (focused) {
191
- leftIconColor = colors.primary;
192
- }
193
- else {
194
- leftIconColor = colors.light;
195
- }
196
- const leftIconProps = {
197
- size: 24,
198
- color: leftIconColor,
199
- name: leftIconName || "",
200
- };
201
- const leftIconStyle = {
202
- position: "absolute",
203
- marginTop: type === "solid"
204
- ? leftIconMode === "inset"
205
- ? MINIMIZED_LABEL_FONT_SIZE + 4
206
- : 16
207
- : leftIconMode === "outset"
208
- ? 16
209
- : 0,
210
- };
211
- const labelStyle = {
212
- ...typography.subtitle1,
213
- top: type === "solid" ? 16 : 0,
214
- fontFamily: textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontFamily,
215
- left: leftIconName && leftIconMode === "inset"
216
- ? ICON_SIZE + (type === "solid" ? 16 : 12)
217
- : 0,
218
- transform: [
219
- {
220
- // Move label to top
221
- translateY: labeled.interpolate({
222
- inputRange: [0, 1],
223
- outputRange: [
224
- type === "solid"
225
- ? OUTLINE_MINIMIZED_LABEL_Y_OFFSET
226
- : MINIMIZED_LABEL_Y_OFFSET,
227
- 0,
228
- ],
229
- }),
230
- },
231
- {
232
- // Make label smaller
233
- scale: labeled.interpolate({
234
- inputRange: [0, 1],
235
- outputRange: [
236
- MINIMIZED_LABEL_FONT_SIZE / MAXIMIZED_LABEL_FONT_SIZE,
237
- 1,
238
- ],
239
- }),
240
- },
241
- {
242
- // Offset label scale since RN doesn't support transform origin
243
- translateX: labeled.interpolate({
244
- inputRange: [0, 1],
245
- outputRange: [
246
- -(1 - MINIMIZED_LABEL_FONT_SIZE / MAXIMIZED_LABEL_FONT_SIZE) *
247
- (labelLayout.width / 2),
248
- 0,
249
- ],
250
- }),
251
- },
252
- ],
253
- };
254
- const inputStyles = [
255
- styles.input,
256
- inputStyle,
257
- type === "solid" ? { marginHorizontal: 12 } : {},
258
- ];
259
- // const render = (props) => <NativeTextInput {...props} />;
260
- return (React.createElement(View, { style: [styles.container, style] },
261
- React.createElement(Touchable, { disabled: disabled, onPress: toggleVisibility },
262
- React.createElement(View, { pointerEvents: "none" },
263
- React.createElement(View, { style: [styles.container, style] },
264
- leftIconName && leftIconMode === "outset" ? (React.createElement(Icon, { ...leftIconProps, style: leftIconStyle })) : null,
265
- React.createElement(View, { style: [
266
- containerStyle,
267
- style ? { height: style.height } : {},
268
- viewStyles,
269
- ] },
270
- type === "underline" ? (
271
- // When type === 'flat', render an underline
272
- React.createElement(Animated.View, { style: [
273
- styles.underline,
274
- {
275
- backgroundColor: focused ? activeColor : underlineColor,
276
- // Underlines is thinner when input is not focused
277
- transform: [{ scaleY: focused ? 1 : 0.5 }],
278
- },
279
- ] })) : null,
280
- label ? (
281
- // Position colored placeholder and gray placeholder on top of each other and crossfade them
282
- // This gives the effect of animating the color, but allows us to use native driver
283
- React.createElement(View, { pointerEvents: "none", style: [
284
- StyleSheet.absoluteFill,
285
- {
286
- opacity:
287
- // Hide the label in minimized state until we measure its width
288
- date || focused ? (labelLayout.measured ? 1 : 0) : 1,
289
- },
290
- ] },
291
- React.createElement(AnimatedText, { onLayout: (e) => setLabelLayout({
292
- width: e.nativeEvent.layout.width,
293
- measured: true,
294
- }), style: [
295
- styles.placeholder,
296
- type === "solid" ? { paddingHorizontal: 12 } : {},
297
- labelStyle,
298
- {
299
- color: labelColor || colors.light,
300
- opacity: labeled.interpolate({
301
- inputRange: [0, 1],
302
- outputRange: [hasActiveOutline ? 1 : 0, 0],
303
- }),
304
- },
305
- ], numberOfLines: 1 }, label),
306
- React.createElement(AnimatedText, { style: [
307
- styles.placeholder,
308
- type === "solid" ? { paddingHorizontal: 12 } : {},
309
- labelStyle,
310
- {
311
- color: labelColor || placeholderColor,
312
- opacity: hasActiveOutline ? labeled : 1,
313
- },
314
- ], numberOfLines: 1 }, label))) : null,
315
- leftIconName && leftIconMode === "inset" ? (React.createElement(Icon, { ...leftIconProps, style: {
316
- ...leftIconStyle,
317
- marginLeft: type === "solid" ? 16 : 0,
318
- } })) : null,
319
- React.createElement(NativeTextInput, { value: formatDate(), placeholder: label ? placeholder1 : placeholder, editable: !disabled, placeholderTextColor: placeholderColor, selectionColor: activeColor, onFocus: _handleFocus, onBlur: _handleBlur, underlineColorAndroid: "transparent", style: [inputStyles, textStyles], ...props })),
320
- rightIconName ? (React.createElement(Icon, { name: rightIconName, size: ICON_SIZE, color: colors.light, style: {
321
- position: "absolute",
322
- right: 16,
323
- marginTop: type === "solid" ? MINIMIZED_LABEL_FONT_SIZE + 4 : 16,
324
- } })) : null))),
325
- pickerVisible && (React.createElement(Portal, null,
326
- React.createElement(View, { style: [
327
- styles.picker,
328
- {
329
- backgroundColor: colors.divider,
330
- },
331
- ] },
332
- React.createElement(View, { style: [
333
- styles.pickerContainer,
334
- {
335
- paddingTop: insets.top,
336
- paddingBottom: insets.bottom,
337
- paddingLeft: insets.left,
338
- paddingRight: insets.right,
339
- },
340
- ] },
341
- React.createElement(DateTimePicker, { value: getValidDate(), mode: mode, isVisible: pickerVisible, toggleVisibility: toggleVisibility, onChange: (_event, data) => {
342
- toggleVisibility();
343
- setValue(data);
344
- onDateChange(data);
345
- } })))))));
346
- };
347
- const styles = StyleSheet.create({
348
- container: {
349
- alignSelf: "stretch",
350
- },
351
- picker: {
352
- position: "absolute",
353
- bottom: 0,
354
- left: 0,
355
- right: 0,
356
- flexDirection: "row",
357
- justifyContent: "center",
358
- },
359
- underline: {
360
- position: "absolute",
361
- left: 0,
362
- right: 0,
363
- bottom: 0,
364
- height: 2,
365
- },
366
- input: {
367
- flexGrow: 1,
368
- justifyContent: "center",
369
- textAlignVertical: "center",
370
- margin: 0,
371
- textAlign: I18nManager.isRTL ? "right" : "left",
372
- },
373
- placeholder: {
374
- position: "absolute",
375
- left: 0,
376
- },
377
- pickerContainer: { flexDirection: "column", width: "100%", zIndex: 100 },
378
- closeButton: {
379
- alignSelf: "flex-end",
380
- },
381
- });
382
- export default withTheme(DatePicker);
@@ -1,13 +0,0 @@
1
- import React from "react";
2
- import { Platform } from "react-native";
3
- import DateTimePicker from "@react-native-community/datetimepicker";
4
- import DateTimePickerModal from "react-native-modal-datetime-picker";
5
- const DatePickerComponent = ({ value, onChange, mode, toggleVisibility, }) => {
6
- return Platform.OS === "ios" || Platform.OS === "android" ? (React.createElement(DateTimePickerModal, { date: value, mode: mode, isVisible: true, display: Platform.OS === "ios" ? "spinner" : "default", onCancel: () => {
7
- console.log("Picker cancelled before selecting anything.");
8
- toggleVisibility();
9
- }, onConfirm: (data) => {
10
- onChange(null, data);
11
- } })) : (React.createElement(DateTimePicker, { value: value, mode: mode, onChange: onChange, display: "default" }));
12
- };
13
- export default DatePickerComponent;
@@ -1,30 +0,0 @@
1
- import React from "react";
2
- import DateFnsUtils from "@date-io/date-fns";
3
- import { MuiPickersUtilsProvider, DatePicker, TimePicker, DateTimePicker, } from "@material-ui/pickers";
4
- import { createMuiTheme, ThemeProvider } from "@material-ui/core/styles";
5
- import { withTheme } from "../../theming";
6
- import Theme from "../../styles/DefaultTheme";
7
- const DatePickerComponent = ({ value, onChange, mode, toggleVisibility, isVisible, theme, }) => {
8
- const internalTheme = createMuiTheme({
9
- palette: {
10
- primary: {
11
- main: theme.colors.primary || Theme.colors.primary,
12
- },
13
- secondary: {
14
- main: theme.colors.secondary || Theme.colors.secondary,
15
- },
16
- },
17
- });
18
- const Picker = mode === "date"
19
- ? DatePicker
20
- : mode === "time"
21
- ? TimePicker
22
- : DateTimePicker;
23
- return (React.createElement(MuiPickersUtilsProvider, { utils: DateFnsUtils },
24
- React.createElement(ThemeProvider, { theme: internalTheme },
25
- React.createElement(Picker, { value: value, open: isVisible, onChange: (d) => {
26
- toggleVisibility();
27
- onChange(null, d);
28
- }, onClose: () => toggleVisibility(), variant: "dialog", TextFieldComponent: () => null }))));
29
- };
30
- export default withTheme(DatePickerComponent);
@@ -1 +0,0 @@
1
- export {};
@@ -1,65 +0,0 @@
1
- import React from "react";
2
- import { StyleSheet, View } from "react-native";
3
- import DeckSwiperComponent from "react-native-deck-swiper";
4
- const DeckSwiper = ({ onIndexChanged, onEndReached, startCardIndex = 0, infiniteSwiping = false, verticalEnabled = true, horizontalEnabled = true, visibleCardCount = 1, data, keyExtractor, renderItem, style, children, }) => {
5
- //Both 'renderItem' and 'data' are optional to allow direct children. But if one is included, both need to be included
6
- if ((data && !renderItem) || (renderItem && !data)) {
7
- throw new Error("'renderItem' and 'data' need to both be provided to lazily render. Either remove them entirley or include both");
8
- }
9
- if (data && renderItem && children) {
10
- console.warn("'children' of DeckSwiper ignored due to usage of 'data' and 'renderItem'");
11
- }
12
- const childrenArray = React.useMemo(() => React.Children.toArray(children), [children]);
13
- // an array of indices based on children count
14
- const cardsFillerData = React.useMemo(() => Array.from(Array(childrenArray.length).keys()), [childrenArray]);
15
- const cardsData = data || cardsFillerData;
16
- const renderCard = (card, index) => {
17
- if (renderItem) {
18
- return renderItem({ item: card, index });
19
- }
20
- else {
21
- return React.createElement(React.Fragment, null, childrenArray[index]);
22
- }
23
- };
24
- const renderFirstCard = () => {
25
- if (cardsData.length) {
26
- return renderCard(cardsData[0], 0);
27
- }
28
- return undefined;
29
- };
30
- const cardKeyExtractor = (card) => {
31
- if (keyExtractor) {
32
- return keyExtractor(card);
33
- }
34
- else {
35
- return card === null || card === void 0 ? void 0 : card.toString();
36
- }
37
- };
38
- /**
39
- * By default react-native-deck-swiper positions everything with absolute position.
40
- * To overcome this, it is wrapped in a View to be able to add the component in any layout structure.
41
- *
42
- *
43
- * Since all children of that View are absolutley positioned, the View does not have a height and still looks and behaves weird.
44
- * To fix/mitage this without setting a static height, the first card is rendered in invisible state to take up space.
45
- * This effectivley makes the default height of the container be the height of the first card.
46
- */
47
- return (React.createElement(View, null,
48
- React.createElement(View, { style: styles.containerHeightFiller }, renderFirstCard()),
49
- React.createElement(DeckSwiperComponent, { cards: cardsData, renderCard: renderCard, keyExtractor: cardKeyExtractor, containerStyle: StyleSheet.flatten([styles.cardsContainer, style]), cardStyle: styles.card, onSwiped: onIndexChanged, onSwipedAll: onEndReached, cardIndex: startCardIndex, infinite: infiniteSwiping, verticalSwipe: verticalEnabled, horizontalSwipe: horizontalEnabled, showSecondCard: visibleCardCount > 1, stackSize: visibleCardCount, backgroundColor: "transparent", cardVerticalMargin: 0, cardHorizontalMargin: 0 })));
50
- };
51
- const styles = StyleSheet.create({
52
- cardsContainer: {
53
- width: "100%",
54
- },
55
- card: {
56
- left: 0,
57
- right: 0,
58
- width: "auto",
59
- height: "auto",
60
- },
61
- containerHeightFiller: {
62
- opacity: 0.0,
63
- },
64
- });
65
- export default DeckSwiper;
@@ -1,21 +0,0 @@
1
- import React from "react";
2
- import { View, StyleSheet } from "react-native";
3
- import { withTheme } from "../../theming";
4
- const DeckSwiperCard = ({ style, children, theme }) => (React.createElement(View, { style: [
5
- styles.card,
6
- {
7
- backgroundColor: theme.colors.background,
8
- borderColor: theme.colors.divider,
9
- },
10
- style,
11
- ] }, children));
12
- const styles = StyleSheet.create({
13
- card: {
14
- flex: 1,
15
- alignItems: "center",
16
- justifyContent: "center",
17
- padding: 20,
18
- borderWidth: 2,
19
- },
20
- });
21
- export default withTheme(DeckSwiperCard);
@@ -1,2 +0,0 @@
1
- export { default as DeckSwiper } from "./DeckSwiper";
2
- export { default as DeckSwiperCard } from "./DeckSwiperCard";
@@ -1,83 +0,0 @@
1
- import * as React from "react";
2
- import { ActivityIndicator, View, Text, StyleSheet, Pressable, } from "react-native";
3
- import color from "color";
4
- import Config from "./Config";
5
- import Elevation from "./Elevation";
6
- import { withTheme } from "../theming";
7
- const Button = ({ Icon, icon, disabled = false, type = "solid", loading = false, labelColor, color: colorOverride, children, onPress, elevation = 0, theme: { colors, disabledOpacity, roundness, typography }, ...rest }) => {
8
- let backgroundColor, borderColor, textColor, borderWidth;
9
- const buttonColor = colorOverride || colors.primary;
10
- if (type === "solid") {
11
- backgroundColor = buttonColor;
12
- if (disabled) {
13
- textColor = color(colors.surface).alpha(disabledOpacity).rgb().string();
14
- }
15
- else {
16
- textColor = labelColor || colors.surface;
17
- }
18
- }
19
- else {
20
- backgroundColor = "transparent";
21
- if (disabled) {
22
- textColor = color(buttonColor).alpha(disabledOpacity).rgb().string();
23
- }
24
- else {
25
- textColor = labelColor || buttonColor;
26
- }
27
- }
28
- if (type === "outline") {
29
- if (disabled) {
30
- borderColor = color(buttonColor).alpha(disabledOpacity).rgb().string();
31
- }
32
- else {
33
- borderColor = buttonColor;
34
- }
35
- borderWidth = StyleSheet.hairlineWidth;
36
- }
37
- else {
38
- borderColor = "transparent";
39
- borderWidth = 0;
40
- }
41
- const buttonStyle = {
42
- backgroundColor,
43
- borderColor,
44
- borderWidth,
45
- borderRadius: roundness,
46
- };
47
- const textStyle = {
48
- textAlign: "center",
49
- color: textColor,
50
- marginVertical: 16,
51
- marginHorizontal: 16,
52
- };
53
- const iconStyle = [
54
- styles.icon,
55
- {
56
- marginLeft: 16,
57
- marginRight: -8,
58
- width: Config.buttonIconSize,
59
- },
60
- ];
61
- return (React.createElement(Elevation, { style: { elevation, alignSelf: "stretch" } },
62
- React.createElement(Pressable, { ...rest, onPress: onPress, accessibilityState: { disabled }, accessibilityRole: "button", disabled: disabled || loading, style: [styles.button, buttonStyle] },
63
- React.createElement(View, { style: styles.content },
64
- icon && loading !== true ? (React.createElement(View, { style: iconStyle },
65
- React.createElement(Icon, { name: icon, size: Config.buttonIconSize, color: textColor }))) : null,
66
- loading ? (React.createElement(ActivityIndicator, { size: "small", color: textColor, style: iconStyle })) : null,
67
- React.createElement(Text, { numberOfLines: 1, style: [textStyle, typography.button] }, children)))));
68
- };
69
- const styles = StyleSheet.create({
70
- button: {
71
- minWidth: 64,
72
- borderStyle: "solid",
73
- },
74
- content: {
75
- flexDirection: "row",
76
- alignItems: "center",
77
- justifyContent: "center",
78
- },
79
- icon: {
80
- width: Config.buttonIconSize,
81
- },
82
- });
83
- export default withTheme(Button);
@@ -1,18 +0,0 @@
1
- import React from "react";
2
- import { withTheme } from "../theming";
3
- import Touchable from "./Touchable";
4
- const getWidth = (numColumns) => {
5
- switch (numColumns) {
6
- case 1:
7
- return "33%";
8
- case 2:
9
- return "50%";
10
- default:
11
- return "100%";
12
- }
13
- };
14
- const Card = ({ numColumns = 3, children, onPress, style, ...rest }) => {
15
- const width = getWidth(numColumns);
16
- return (React.createElement(Touchable, { disabled: !onPress, onPress: onPress, style: [style, { width }], ...rest }, children));
17
- };
18
- export default withTheme(Card);