@draftbit/core 46.11.5-d49547.2 → 46.11.6-74496c.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.
Files changed (90) hide show
  1. package/lib/commonjs/components/BottomSheet/BottomSheet.js +18 -3
  2. package/lib/commonjs/components/BottomSheet/BottomSheet.js.map +1 -1
  3. package/lib/commonjs/components/Checkbox/CheckboxGroup.js +3 -16
  4. package/lib/commonjs/components/Checkbox/CheckboxGroup.js.map +1 -1
  5. package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +5 -22
  6. package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js.map +1 -1
  7. package/lib/commonjs/components/Checkbox/CheckboxRow.js +23 -6
  8. package/lib/commonjs/components/Checkbox/CheckboxRow.js.map +1 -1
  9. package/lib/commonjs/index.js +0 -19
  10. package/lib/commonjs/index.js.map +1 -1
  11. package/lib/commonjs/mappings/BottomSheet.js +37 -9
  12. package/lib/commonjs/mappings/BottomSheet.js.map +1 -1
  13. package/lib/commonjs/utilities.js +2 -27
  14. package/lib/commonjs/utilities.js.map +1 -1
  15. package/lib/module/components/ActionSheet/ActionSheetItem.js.map +1 -1
  16. package/lib/module/components/BottomSheet/BottomSheet.js +18 -3
  17. package/lib/module/components/BottomSheet/BottomSheet.js.map +1 -1
  18. package/lib/module/components/BottomSheet/index.js.map +1 -1
  19. package/lib/module/components/DatePicker/DatePicker.js +27 -13
  20. package/lib/module/components/DatePicker/DatePicker.js.map +1 -1
  21. package/lib/module/components/Divider.js +17 -1
  22. package/lib/module/components/Divider.js.map +1 -1
  23. package/lib/module/components/StarRating.js +4 -23
  24. package/lib/module/components/StarRating.js.map +1 -1
  25. package/lib/module/index.js +0 -1
  26. package/lib/module/index.js.map +1 -1
  27. package/lib/module/mappings/BottomSheet.js +38 -10
  28. package/lib/module/mappings/BottomSheet.js.map +1 -1
  29. package/lib/module/mappings/IconButton.js.map +1 -1
  30. package/lib/module/mappings/SafeAreaView.js.map +1 -1
  31. package/lib/module/theming.js.map +1 -1
  32. package/lib/module/utilities.js +0 -18
  33. package/lib/module/utilities.js.map +1 -1
  34. package/lib/typescript/src/components/BottomSheet/BottomSheet.d.ts +6 -1
  35. package/lib/typescript/src/components/BottomSheet/BottomSheet.d.ts.map +1 -1
  36. package/lib/typescript/src/index.d.ts +0 -1
  37. package/lib/typescript/src/index.d.ts.map +1 -1
  38. package/lib/typescript/src/mappings/BottomSheet.d.ts +48 -4
  39. package/lib/typescript/src/mappings/BottomSheet.d.ts.map +1 -1
  40. package/lib/typescript/src/utilities.d.ts +0 -6
  41. package/lib/typescript/src/utilities.d.ts.map +1 -1
  42. package/package.json +3 -4
  43. package/src/components/BottomSheet/BottomSheet.js +17 -2
  44. package/src/components/BottomSheet/BottomSheet.tsx +32 -4
  45. package/src/index.js +0 -1
  46. package/src/index.tsx +0 -6
  47. package/src/mappings/BottomSheet.js +37 -9
  48. package/src/mappings/BottomSheet.ts +43 -8
  49. package/src/utilities.js +0 -41
  50. package/src/utilities.ts +0 -71
  51. package/lib/commonjs/components/SwipeableView/SwipeableView.js +0 -155
  52. package/lib/commonjs/components/SwipeableView/SwipeableView.js.map +0 -1
  53. package/lib/commonjs/components/SwipeableView/SwipeableViewButton.js +0 -13
  54. package/lib/commonjs/components/SwipeableView/SwipeableViewButton.js.map +0 -1
  55. package/lib/commonjs/components/SwipeableView/SwipeableViewSwipeHandler.js +0 -13
  56. package/lib/commonjs/components/SwipeableView/SwipeableViewSwipeHandler.js.map +0 -1
  57. package/lib/commonjs/components/SwipeableView/index.js +0 -28
  58. package/lib/commonjs/components/SwipeableView/index.js.map +0 -1
  59. package/lib/commonjs/mappings/SwipeableView.js +0 -182
  60. package/lib/commonjs/mappings/SwipeableView.js.map +0 -1
  61. package/lib/module/components/SwipeableView/SwipeableView.js +0 -147
  62. package/lib/module/components/SwipeableView/SwipeableView.js.map +0 -1
  63. package/lib/module/components/SwipeableView/SwipeableViewButton.js +0 -6
  64. package/lib/module/components/SwipeableView/SwipeableViewButton.js.map +0 -1
  65. package/lib/module/components/SwipeableView/SwipeableViewSwipeHandler.js +0 -6
  66. package/lib/module/components/SwipeableView/SwipeableViewSwipeHandler.js.map +0 -1
  67. package/lib/module/components/SwipeableView/index.js +0 -4
  68. package/lib/module/components/SwipeableView/index.js.map +0 -1
  69. package/lib/module/mappings/SwipeableView.js +0 -175
  70. package/lib/module/mappings/SwipeableView.js.map +0 -1
  71. package/lib/typescript/src/components/SwipeableView/SwipeableView.d.ts +0 -29
  72. package/lib/typescript/src/components/SwipeableView/SwipeableView.d.ts.map +0 -1
  73. package/lib/typescript/src/components/SwipeableView/SwipeableViewButton.d.ts +0 -13
  74. package/lib/typescript/src/components/SwipeableView/SwipeableViewButton.d.ts.map +0 -1
  75. package/lib/typescript/src/components/SwipeableView/SwipeableViewSwipeHandler.d.ts +0 -13
  76. package/lib/typescript/src/components/SwipeableView/SwipeableViewSwipeHandler.d.ts.map +0 -1
  77. package/lib/typescript/src/components/SwipeableView/index.d.ts +0 -4
  78. package/lib/typescript/src/components/SwipeableView/index.d.ts.map +0 -1
  79. package/lib/typescript/src/mappings/SwipeableView.d.ts +0 -371
  80. package/lib/typescript/src/mappings/SwipeableView.d.ts.map +0 -1
  81. package/src/components/SwipeableView/SwipeableView.js +0 -117
  82. package/src/components/SwipeableView/SwipeableView.tsx +0 -299
  83. package/src/components/SwipeableView/SwipeableViewButton.js +0 -5
  84. package/src/components/SwipeableView/SwipeableViewButton.tsx +0 -18
  85. package/src/components/SwipeableView/SwipeableViewSwipeHandler.js +0 -5
  86. package/src/components/SwipeableView/SwipeableViewSwipeHandler.tsx +0 -20
  87. package/src/components/SwipeableView/index.js +0 -3
  88. package/src/components/SwipeableView/index.tsx +0 -3
  89. package/src/mappings/SwipeableView.js +0 -181
  90. package/src/mappings/SwipeableView.ts +0 -210
@@ -1,13 +0,0 @@
1
- import React from "react";
2
- export interface SwipeableViewButtonProps {
3
- title: string;
4
- side: "left" | "right";
5
- onPress: (() => void) | null;
6
- icon?: string;
7
- iconSize?: number;
8
- backgroundColor?: string;
9
- color?: string;
10
- }
11
- declare const SwipeableViewButton: React.FC<SwipeableViewButtonProps>;
12
- export default SwipeableViewButton;
13
- //# sourceMappingURL=SwipeableViewButton.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SwipeableViewButton.d.ts","sourceRoot":"","sources":["../../../../../src/components/SwipeableView/SwipeableViewButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAGD,QAAA,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAE3D,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -1,13 +0,0 @@
1
- import React from "react";
2
- export interface SwipeableViewSwipeHandlerProps {
3
- title: string;
4
- side: "left" | "right";
5
- onSwipe: (() => void) | null;
6
- icon?: string;
7
- iconSize?: number;
8
- backgroundColor?: string;
9
- color?: string;
10
- }
11
- declare const SwipeableViewSwipeHandler: React.FC<SwipeableViewSwipeHandlerProps>;
12
- export default SwipeableViewSwipeHandler;
13
- //# sourceMappingURL=SwipeableViewSwipeHandler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SwipeableViewSwipeHandler.d.ts","sourceRoot":"","sources":["../../../../../src/components/SwipeableView/SwipeableViewSwipeHandler.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,8BAA8B;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAGD,QAAA,MAAM,yBAAyB,EAAE,KAAK,CAAC,EAAE,CACvC,8BAA8B,CAG/B,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
@@ -1,4 +0,0 @@
1
- export { default as SwipeableView } from "./SwipeableView";
2
- export { default as SwipeableViewButton } from "./SwipeableViewButton";
3
- export { default as SwipeableViewSwipeHandler } from "./SwipeableViewSwipeHandler";
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/SwipeableView/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -1,371 +0,0 @@
1
- export declare const SEED_DATA: ({
2
- name: string;
3
- tag: string;
4
- doc_link: string;
5
- description: string;
6
- category: string;
7
- stylesPanelSections: string[];
8
- layout: {
9
- overflow: string;
10
- flexDirection: string;
11
- alignItems: string;
12
- padding: number;
13
- };
14
- props: {
15
- closeOnPress: {
16
- label: string;
17
- description: string;
18
- formType: string;
19
- propType: string;
20
- defaultValue: boolean;
21
- editable: boolean;
22
- required: boolean;
23
- group: string;
24
- };
25
- swipeActivationPercentage: {
26
- label: string;
27
- description: string;
28
- formType: string;
29
- propType: string;
30
- group: string;
31
- defaultValue: null;
32
- editable: boolean;
33
- required: boolean;
34
- step: number;
35
- };
36
- disableLeftSwipe: {
37
- label: string;
38
- description: string;
39
- formType: string;
40
- propType: string;
41
- defaultValue: boolean;
42
- editable: boolean;
43
- required: boolean;
44
- group: string;
45
- };
46
- disableRightSwipe: {
47
- label: string;
48
- description: string;
49
- formType: string;
50
- propType: string;
51
- defaultValue: boolean;
52
- editable: boolean;
53
- required: boolean;
54
- group: string;
55
- };
56
- leftOpenValue: {
57
- label: string;
58
- description: string;
59
- formType: string;
60
- propType: string;
61
- group: string;
62
- defaultValue: null;
63
- editable: boolean;
64
- required: boolean;
65
- step: number;
66
- };
67
- rightOpenValue: {
68
- label: string;
69
- description: string;
70
- formType: string;
71
- propType: string;
72
- group: string;
73
- defaultValue: null;
74
- editable: boolean;
75
- required: boolean;
76
- step: number;
77
- };
78
- leftActivationValue: {
79
- label: string;
80
- description: string;
81
- formType: string;
82
- propType: string;
83
- group: string;
84
- defaultValue: null;
85
- editable: boolean;
86
- required: boolean;
87
- step: number;
88
- };
89
- rightActivationValue: {
90
- label: string;
91
- description: string;
92
- formType: string;
93
- propType: string;
94
- group: string;
95
- defaultValue: null;
96
- editable: boolean;
97
- required: boolean;
98
- step: number;
99
- };
100
- stopLeftSwipe: {
101
- label: string;
102
- description: string;
103
- formType: string;
104
- propType: string;
105
- group: string;
106
- defaultValue: null;
107
- editable: boolean;
108
- required: boolean;
109
- step: number;
110
- };
111
- stopRightSwipe: {
112
- label: string;
113
- description: string;
114
- formType: string;
115
- propType: string;
116
- group: string;
117
- defaultValue: null;
118
- editable: boolean;
119
- required: boolean;
120
- step: number;
121
- };
122
- directionalDistanceChangeThreshold: {
123
- label: string;
124
- description: string;
125
- formType: string;
126
- propType: string;
127
- group: string;
128
- defaultValue: null;
129
- editable: boolean;
130
- required: boolean;
131
- step: number;
132
- };
133
- friction: {
134
- label: string;
135
- description: string;
136
- formType: string;
137
- propType: string;
138
- group: string;
139
- defaultValue: null;
140
- editable: boolean;
141
- required: boolean;
142
- step: number;
143
- };
144
- tension: {
145
- label: string;
146
- description: string;
147
- formType: string;
148
- propType: string;
149
- group: string;
150
- defaultValue: null;
151
- editable: boolean;
152
- required: boolean;
153
- step: number;
154
- };
155
- swipeToOpenVelocityContribution: {
156
- label: string;
157
- description: string;
158
- formType: string;
159
- propType: string;
160
- group: string;
161
- defaultValue: null;
162
- editable: boolean;
163
- required: boolean;
164
- step: number;
165
- };
166
- swipeToOpenPercent: {
167
- label: string;
168
- description: string;
169
- formType: string;
170
- propType: string;
171
- group: string;
172
- defaultValue: null;
173
- editable: boolean;
174
- required: boolean;
175
- step: number;
176
- };
177
- swipeToClosePercent: {
178
- label: string;
179
- description: string;
180
- formType: string;
181
- propType: string;
182
- group: string;
183
- defaultValue: null;
184
- editable: boolean;
185
- required: boolean;
186
- step: number;
187
- };
188
- };
189
- triggers?: undefined;
190
- } | {
191
- name: string;
192
- tag: string;
193
- description: string;
194
- category: string;
195
- stylesPanelSections: never[];
196
- triggers: string[];
197
- props: {
198
- onPress: {
199
- label: string;
200
- description: string;
201
- editable: boolean;
202
- required: boolean;
203
- formType: string;
204
- propType: string;
205
- defaultValue: null;
206
- group: string;
207
- };
208
- title: any;
209
- side: {
210
- group: string;
211
- label: string;
212
- description: string;
213
- editable: boolean;
214
- required: boolean;
215
- formType: string;
216
- propType: string;
217
- defaultValue: null;
218
- options: never[];
219
- };
220
- icon: {
221
- label: string;
222
- description: string;
223
- formType: string;
224
- propType: string;
225
- defaultValue: string;
226
- required: boolean;
227
- editable: boolean;
228
- group: string;
229
- };
230
- iconSize: {
231
- label: string;
232
- description: string;
233
- formType: string;
234
- propType: string;
235
- group: string;
236
- defaultValue: null;
237
- editable: boolean;
238
- required: boolean;
239
- step: number;
240
- };
241
- backgroundColor: {
242
- group: string;
243
- label: string;
244
- description: string;
245
- editable: boolean;
246
- required: boolean;
247
- defaultValue: null;
248
- formType: string;
249
- propType: string;
250
- };
251
- color: {
252
- group: string;
253
- label: string;
254
- description: string;
255
- editable: boolean;
256
- required: boolean;
257
- defaultValue: null;
258
- formType: string;
259
- propType: string;
260
- };
261
- closeOnPress?: undefined;
262
- swipeActivationPercentage?: undefined;
263
- disableLeftSwipe?: undefined;
264
- disableRightSwipe?: undefined;
265
- leftOpenValue?: undefined;
266
- rightOpenValue?: undefined;
267
- leftActivationValue?: undefined;
268
- rightActivationValue?: undefined;
269
- stopLeftSwipe?: undefined;
270
- stopRightSwipe?: undefined;
271
- directionalDistanceChangeThreshold?: undefined;
272
- friction?: undefined;
273
- tension?: undefined;
274
- swipeToOpenVelocityContribution?: undefined;
275
- swipeToOpenPercent?: undefined;
276
- swipeToClosePercent?: undefined;
277
- };
278
- doc_link?: undefined;
279
- layout?: undefined;
280
- } | {
281
- name: string;
282
- tag: string;
283
- description: string;
284
- category: string;
285
- stylesPanelSections: never[];
286
- triggers: string[];
287
- props: {
288
- onSwipe: {
289
- label: string;
290
- description: string;
291
- editable: boolean;
292
- required: boolean;
293
- formType: string;
294
- propType: string;
295
- defaultValue: null;
296
- group: string;
297
- };
298
- title: any;
299
- side: {
300
- group: string;
301
- label: string;
302
- description: string;
303
- editable: boolean;
304
- required: boolean;
305
- formType: string;
306
- propType: string;
307
- defaultValue: null;
308
- options: never[];
309
- };
310
- icon: {
311
- label: string;
312
- description: string;
313
- formType: string;
314
- propType: string;
315
- defaultValue: string;
316
- required: boolean;
317
- editable: boolean;
318
- group: string;
319
- };
320
- iconSize: {
321
- label: string;
322
- description: string;
323
- formType: string;
324
- propType: string;
325
- group: string;
326
- defaultValue: null;
327
- editable: boolean;
328
- required: boolean;
329
- step: number;
330
- };
331
- backgroundColor: {
332
- group: string;
333
- label: string;
334
- description: string;
335
- editable: boolean;
336
- required: boolean;
337
- defaultValue: null;
338
- formType: string;
339
- propType: string;
340
- };
341
- color: {
342
- group: string;
343
- label: string;
344
- description: string;
345
- editable: boolean;
346
- required: boolean;
347
- defaultValue: null;
348
- formType: string;
349
- propType: string;
350
- };
351
- closeOnPress?: undefined;
352
- swipeActivationPercentage?: undefined;
353
- disableLeftSwipe?: undefined;
354
- disableRightSwipe?: undefined;
355
- leftOpenValue?: undefined;
356
- rightOpenValue?: undefined;
357
- leftActivationValue?: undefined;
358
- rightActivationValue?: undefined;
359
- stopLeftSwipe?: undefined;
360
- stopRightSwipe?: undefined;
361
- directionalDistanceChangeThreshold?: undefined;
362
- friction?: undefined;
363
- tension?: undefined;
364
- swipeToOpenVelocityContribution?: undefined;
365
- swipeToOpenPercent?: undefined;
366
- swipeToClosePercent?: undefined;
367
- };
368
- doc_link?: undefined;
369
- layout?: undefined;
370
- })[];
371
- //# sourceMappingURL=SwipeableView.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SwipeableView.d.ts","sourceRoot":"","sources":["../../../../src/mappings/SwipeableView.ts"],"names":[],"mappings":"AAqDA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4JrB,CAAC"}
@@ -1,117 +0,0 @@
1
- import React from "react";
2
- import { View, StyleSheet, Text, } from "react-native";
3
- import Pressable from "../Pressable";
4
- import { extractBorderAndMarginStyles, extractEffectStyles, extractFlexItemStyles, extractPositionStyles, extractSizeStyles, extractStyles, } from "../../utilities";
5
- import { SwipeRow } from "react-native-swipe-list-view";
6
- import { withTheme } from "../../theming";
7
- const SwipeableView = ({ theme, style, children, Icon, closeOnPress, leftOpenValue, rightOpenValue, leftActivationValue, rightActivationValue, swipeActivationPercentage = 80, stopLeftSwipe, stopRightSwipe, friction = 20, ...rest }) => {
8
- const instanceOfSwipeableViewButtonProps = (object) => {
9
- return "title" in object && "side" in object && "onPress" in object;
10
- };
11
- const instanceOfSwipeableViewSwipeHandlerProps = (object) => {
12
- return "title" in object && "side" in object && "onSwipe" in object;
13
- };
14
- const { viewStyles, textStyles } = extractStyles(style);
15
- const { borderStyles, marginStyles } = extractBorderAndMarginStyles(viewStyles);
16
- const parentContainerStyles = StyleSheet.flatten([
17
- borderStyles,
18
- marginStyles,
19
- extractFlexItemStyles(viewStyles),
20
- extractPositionStyles(viewStyles),
21
- extractEffectStyles(viewStyles),
22
- extractSizeStyles(viewStyles),
23
- ]);
24
- //Remove styles already consumed from viewStyles
25
- Object.keys(parentContainerStyles).forEach((key) => delete viewStyles[key]);
26
- const surfaceContainerStyles = viewStyles;
27
- const [componentWidth, setComponentWidth] = React.useState(null);
28
- const leftButtons = React.useMemo(() => React.Children.toArray(children).filter((child) => React.isValidElement(child) &&
29
- instanceOfSwipeableViewButtonProps(child.props) &&
30
- child.props.side === "left"), [children]);
31
- const rightButtons = React.useMemo(() => React.Children.toArray(children).filter((child) => React.isValidElement(child) &&
32
- instanceOfSwipeableViewButtonProps(child.props) &&
33
- child.props.side === "right"), [children]);
34
- const leftSwipeHandlers = React.useMemo(() => React.Children.toArray(children).filter((child) => React.isValidElement(child) &&
35
- instanceOfSwipeableViewSwipeHandlerProps(child.props) &&
36
- child.props.side === "left"), [children]);
37
- const rightSwipeHandlers = React.useMemo(() => React.Children.toArray(children).filter((child) => React.isValidElement(child) &&
38
- instanceOfSwipeableViewSwipeHandlerProps(child.props) &&
39
- child.props.side === "right"), [children]);
40
- const remainingChildren = React.useMemo(() => React.Children.toArray(children).filter((child) => React.isValidElement(child) &&
41
- !instanceOfSwipeableViewSwipeHandlerProps(child.props) &&
42
- !instanceOfSwipeableViewButtonProps(child.props)), [children]);
43
- if (leftButtons.length > 2 || rightButtons.length > 2) {
44
- throw Error("Cannot have more than 2 buttons per side");
45
- }
46
- if (leftSwipeHandlers.length > 1 || rightSwipeHandlers.length > 1) {
47
- throw Error("Cannot have more than 1 swiper handler per side");
48
- }
49
- if ((leftButtons.length && leftSwipeHandlers.length) ||
50
- (rightButtons.length && rightSwipeHandlers.length)) {
51
- throw Error("Cannot combine swiper handler and buttons on the same side");
52
- }
53
- //Renders a single button/item. Used for both buttons and swipe handler
54
- const renderBehindItem = (props, index) => (React.createElement(Pressable, { key: index.toString(), onPress: props.onPress, style: [
55
- styles.buttonContainer,
56
- { backgroundColor: props.backgroundColor || theme.colors.primary },
57
- ] },
58
- props.icon && (React.createElement(Icon, { name: props.icon, size: props.iconSize || 25, color: props.color || theme.colors.surface })),
59
- React.createElement(Text, { style: [textStyles, { color: props.color || theme.colors.surface }] }, props.title)));
60
- const isLeftSwipeHandler = !!leftSwipeHandlers.length;
61
- const isRightSwipeHandler = !!rightSwipeHandlers.length;
62
- const defaultLeftOpenValue = componentWidth ? componentWidth / 2 : 0;
63
- const defaultRightOpenValue = componentWidth ? -componentWidth / 2 : 0;
64
- return (React.createElement(View, { onLayout: (event) => {
65
- setComponentWidth(event.nativeEvent.layout.width);
66
- }, style: [styles.parentContainer, parentContainerStyles] },
67
- React.createElement(SwipeRow, { leftOpenValue: isLeftSwipeHandler ? 0 : leftOpenValue || defaultLeftOpenValue //If in swiping mode, don't keep open
68
- , rightOpenValue: isRightSwipeHandler ? 0 : rightOpenValue || defaultRightOpenValue, leftActivationValue: leftActivationValue || isLeftSwipeHandler
69
- ? defaultLeftOpenValue * (swipeActivationPercentage / 100) //When swipe passes activation percentage then it should be considered activated (call onSwipe)
70
- : defaultLeftOpenValue, rightActivationValue: rightActivationValue || isRightSwipeHandler
71
- ? defaultRightOpenValue * (swipeActivationPercentage / 100)
72
- : defaultRightOpenValue, stopLeftSwipe: stopLeftSwipe || defaultLeftOpenValue, stopRightSwipe: stopRightSwipe || defaultRightOpenValue, onLeftAction: isLeftSwipeHandler
73
- ? () => { var _a, _b; return (_b = (_a = leftSwipeHandlers[0].props).onSwipe) === null || _b === void 0 ? void 0 : _b.call(_a); }
74
- : undefined, onRightAction: isRightSwipeHandler
75
- ? () => { var _a, _b; return (_b = (_a = rightSwipeHandlers[0].props).onSwipe) === null || _b === void 0 ? void 0 : _b.call(_a); }
76
- : undefined, closeOnRowPress: closeOnPress, friction: friction, ...rest },
77
- React.createElement(View, { style: styles.behindContainer },
78
- React.createElement(View, { style: styles.behindContainerItem }, (isLeftSwipeHandler ? leftSwipeHandlers : leftButtons).map((item, index) => renderBehindItem(item.props, index))),
79
- React.createElement(View, { style: styles.behindContainerItem }, (isRightSwipeHandler ? rightSwipeHandlers : rightButtons).map((item, index) => renderBehindItem(item.props, index)))),
80
- React.createElement(View, { style: [
81
- styles.surfaceContainer,
82
- {
83
- backgroundColor: theme.colors.background,
84
- },
85
- surfaceContainerStyles,
86
- ] }, remainingChildren))));
87
- };
88
- const styles = StyleSheet.create({
89
- parentContainer: {
90
- overflow: "hidden",
91
- minHeight: 50,
92
- },
93
- behindContainer: {
94
- flex: 1,
95
- width: "100%",
96
- height: "100%",
97
- flexDirection: "row",
98
- },
99
- behindContainerItem: {
100
- flex: 1,
101
- flexDirection: "row",
102
- },
103
- buttonContainer: {
104
- flex: 1,
105
- alignItems: "center",
106
- justifyContent: "center",
107
- },
108
- surfaceContainer: {
109
- flexDirection: "row",
110
- width: "100%",
111
- height: "100%",
112
- padding: 10,
113
- alignItems: "center",
114
- overflow: "hidden",
115
- },
116
- });
117
- export default withTheme(SwipeableView);