@draftbit/core 47.2.1-a33ddf.2 → 47.2.1-d833e1.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 (81) 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 +16 -3
  4. package/lib/commonjs/components/Checkbox/CheckboxGroup.js.map +1 -1
  5. package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +22 -5
  6. package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js.map +1 -1
  7. package/lib/commonjs/components/Checkbox/CheckboxRow.js +6 -23
  8. package/lib/commonjs/components/Checkbox/CheckboxRow.js.map +1 -1
  9. package/lib/commonjs/components/SwipeableView/SwipeableView.js +155 -0
  10. package/lib/commonjs/components/SwipeableView/SwipeableView.js.map +1 -0
  11. package/lib/commonjs/components/SwipeableView/SwipeableViewButton.js +13 -0
  12. package/lib/commonjs/components/SwipeableView/SwipeableViewButton.js.map +1 -0
  13. package/lib/commonjs/components/SwipeableView/SwipeableViewSwipeHandler.js +13 -0
  14. package/lib/commonjs/components/SwipeableView/SwipeableViewSwipeHandler.js.map +1 -0
  15. package/lib/commonjs/components/SwipeableView/index.js +28 -0
  16. package/lib/commonjs/components/SwipeableView/index.js.map +1 -0
  17. package/lib/commonjs/index.js +19 -0
  18. package/lib/commonjs/index.js.map +1 -1
  19. package/lib/commonjs/mappings/BottomSheet.js +37 -9
  20. package/lib/commonjs/mappings/BottomSheet.js.map +1 -1
  21. package/lib/commonjs/mappings/SwipeableView.js +183 -0
  22. package/lib/commonjs/mappings/SwipeableView.js.map +1 -0
  23. package/lib/commonjs/utilities.js +27 -2
  24. package/lib/commonjs/utilities.js.map +1 -1
  25. package/lib/module/components/BottomSheet/BottomSheet.js +18 -3
  26. package/lib/module/components/BottomSheet/BottomSheet.js.map +1 -1
  27. package/lib/module/components/SwipeableView/SwipeableView.js +147 -0
  28. package/lib/module/components/SwipeableView/SwipeableView.js.map +1 -0
  29. package/lib/module/components/SwipeableView/SwipeableViewButton.js +6 -0
  30. package/lib/module/components/SwipeableView/SwipeableViewButton.js.map +1 -0
  31. package/lib/module/components/SwipeableView/SwipeableViewSwipeHandler.js +6 -0
  32. package/lib/module/components/SwipeableView/SwipeableViewSwipeHandler.js.map +1 -0
  33. package/lib/module/components/SwipeableView/index.js +4 -0
  34. package/lib/module/components/SwipeableView/index.js.map +1 -0
  35. package/lib/module/constants.js +1 -1
  36. package/lib/module/index.js +1 -0
  37. package/lib/module/index.js.map +1 -1
  38. package/lib/module/mappings/BottomSheet.js +38 -10
  39. package/lib/module/mappings/BottomSheet.js.map +1 -1
  40. package/lib/module/mappings/SwipeableView.js +175 -0
  41. package/lib/module/mappings/SwipeableView.js.map +1 -0
  42. package/lib/module/mappings/TextArea.js.map +1 -1
  43. package/lib/module/utilities.js +18 -0
  44. package/lib/module/utilities.js.map +1 -1
  45. package/lib/typescript/src/components/BottomSheet/BottomSheet.d.ts +6 -1
  46. package/lib/typescript/src/components/BottomSheet/BottomSheet.d.ts.map +1 -1
  47. package/lib/typescript/src/components/SwipeableView/SwipeableView.d.ts +29 -0
  48. package/lib/typescript/src/components/SwipeableView/SwipeableView.d.ts.map +1 -0
  49. package/lib/typescript/src/components/SwipeableView/SwipeableViewButton.d.ts +13 -0
  50. package/lib/typescript/src/components/SwipeableView/SwipeableViewButton.d.ts.map +1 -0
  51. package/lib/typescript/src/components/SwipeableView/SwipeableViewSwipeHandler.d.ts +13 -0
  52. package/lib/typescript/src/components/SwipeableView/SwipeableViewSwipeHandler.d.ts.map +1 -0
  53. package/lib/typescript/src/components/SwipeableView/index.d.ts +4 -0
  54. package/lib/typescript/src/components/SwipeableView/index.d.ts.map +1 -0
  55. package/lib/typescript/src/index.d.ts +1 -0
  56. package/lib/typescript/src/index.d.ts.map +1 -1
  57. package/lib/typescript/src/mappings/BottomSheet.d.ts +48 -4
  58. package/lib/typescript/src/mappings/BottomSheet.d.ts.map +1 -1
  59. package/lib/typescript/src/mappings/SwipeableView.d.ts +426 -0
  60. package/lib/typescript/src/mappings/SwipeableView.d.ts.map +1 -0
  61. package/lib/typescript/src/utilities.d.ts +6 -0
  62. package/lib/typescript/src/utilities.d.ts.map +1 -1
  63. package/package.json +4 -3
  64. package/src/components/BottomSheet/BottomSheet.js +17 -2
  65. package/src/components/BottomSheet/BottomSheet.tsx +32 -4
  66. package/src/components/SwipeableView/SwipeableView.js +117 -0
  67. package/src/components/SwipeableView/SwipeableView.tsx +299 -0
  68. package/src/components/SwipeableView/SwipeableViewButton.js +5 -0
  69. package/src/components/SwipeableView/SwipeableViewButton.tsx +18 -0
  70. package/src/components/SwipeableView/SwipeableViewSwipeHandler.js +5 -0
  71. package/src/components/SwipeableView/SwipeableViewSwipeHandler.tsx +20 -0
  72. package/src/components/SwipeableView/index.js +3 -0
  73. package/src/components/SwipeableView/index.tsx +3 -0
  74. package/src/index.js +1 -0
  75. package/src/index.tsx +6 -0
  76. package/src/mappings/BottomSheet.js +37 -9
  77. package/src/mappings/BottomSheet.ts +43 -8
  78. package/src/mappings/SwipeableView.js +181 -0
  79. package/src/mappings/SwipeableView.ts +210 -0
  80. package/src/utilities.js +41 -0
  81. package/src/utilities.ts +71 -0
@@ -0,0 +1,426 @@
1
+ export declare const SHARED_SEED_DATA_PROPS: {
2
+ title: any;
3
+ side: {
4
+ group: string;
5
+ label: string;
6
+ description: string;
7
+ editable: boolean;
8
+ required: boolean;
9
+ formType: string;
10
+ propType: string;
11
+ defaultValue: null;
12
+ options: never[];
13
+ };
14
+ icon: {
15
+ label: string;
16
+ description: string;
17
+ formType: string;
18
+ propType: string;
19
+ defaultValue: string;
20
+ required: boolean;
21
+ editable: boolean;
22
+ group: string;
23
+ };
24
+ iconSize: {
25
+ label: string;
26
+ description: string;
27
+ formType: string;
28
+ propType: string;
29
+ group: string;
30
+ defaultValue: null;
31
+ editable: boolean;
32
+ required: boolean;
33
+ step: number;
34
+ };
35
+ backgroundColor: {
36
+ group: string;
37
+ label: string;
38
+ description: string;
39
+ editable: boolean;
40
+ required: boolean;
41
+ defaultValue: null;
42
+ formType: string;
43
+ propType: string;
44
+ };
45
+ color: {
46
+ group: string;
47
+ label: string;
48
+ description: string;
49
+ editable: boolean;
50
+ required: boolean;
51
+ defaultValue: null;
52
+ formType: string;
53
+ propType: string;
54
+ };
55
+ };
56
+ export declare const SEED_DATA: ({
57
+ name: string;
58
+ tag: string;
59
+ doc_link: string;
60
+ description: string;
61
+ category: string;
62
+ stylesPanelSections: string[];
63
+ layout: {
64
+ overflow: string;
65
+ flexDirection: string;
66
+ alignItems: string;
67
+ padding: number;
68
+ };
69
+ props: {
70
+ closeOnPress: {
71
+ label: string;
72
+ description: string;
73
+ formType: string;
74
+ propType: string;
75
+ defaultValue: boolean;
76
+ editable: boolean;
77
+ required: boolean;
78
+ group: string;
79
+ };
80
+ swipeActivationPercentage: {
81
+ label: string;
82
+ description: string;
83
+ formType: string;
84
+ propType: string;
85
+ group: string;
86
+ defaultValue: null;
87
+ editable: boolean;
88
+ required: boolean;
89
+ step: number;
90
+ };
91
+ disableLeftSwipe: {
92
+ label: string;
93
+ description: string;
94
+ formType: string;
95
+ propType: string;
96
+ defaultValue: boolean;
97
+ editable: boolean;
98
+ required: boolean;
99
+ group: string;
100
+ };
101
+ disableRightSwipe: {
102
+ label: string;
103
+ description: string;
104
+ formType: string;
105
+ propType: string;
106
+ defaultValue: boolean;
107
+ editable: boolean;
108
+ required: boolean;
109
+ group: string;
110
+ };
111
+ leftOpenValue: {
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
+ rightOpenValue: {
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
+ leftActivationValue: {
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
+ rightActivationValue: {
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
+ stopLeftSwipe: {
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
+ stopRightSwipe: {
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
+ directionalDistanceChangeThreshold: {
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
+ friction: {
189
+ label: string;
190
+ description: string;
191
+ formType: string;
192
+ propType: string;
193
+ group: string;
194
+ defaultValue: null;
195
+ editable: boolean;
196
+ required: boolean;
197
+ step: number;
198
+ };
199
+ tension: {
200
+ label: string;
201
+ description: string;
202
+ formType: string;
203
+ propType: string;
204
+ group: string;
205
+ defaultValue: null;
206
+ editable: boolean;
207
+ required: boolean;
208
+ step: number;
209
+ };
210
+ swipeToOpenVelocityContribution: {
211
+ label: string;
212
+ description: string;
213
+ formType: string;
214
+ propType: string;
215
+ group: string;
216
+ defaultValue: null;
217
+ editable: boolean;
218
+ required: boolean;
219
+ step: number;
220
+ };
221
+ swipeToOpenPercent: {
222
+ label: string;
223
+ description: string;
224
+ formType: string;
225
+ propType: string;
226
+ group: string;
227
+ defaultValue: null;
228
+ editable: boolean;
229
+ required: boolean;
230
+ step: number;
231
+ };
232
+ swipeToClosePercent: {
233
+ label: string;
234
+ description: string;
235
+ formType: string;
236
+ propType: string;
237
+ group: string;
238
+ defaultValue: null;
239
+ editable: boolean;
240
+ required: boolean;
241
+ step: number;
242
+ };
243
+ };
244
+ triggers?: undefined;
245
+ } | {
246
+ name: string;
247
+ tag: string;
248
+ description: string;
249
+ category: string;
250
+ stylesPanelSections: never[];
251
+ triggers: string[];
252
+ props: {
253
+ onPress: {
254
+ label: string;
255
+ description: string;
256
+ editable: boolean;
257
+ required: boolean;
258
+ formType: string;
259
+ propType: string;
260
+ defaultValue: null;
261
+ group: string;
262
+ };
263
+ title: any;
264
+ side: {
265
+ group: string;
266
+ label: string;
267
+ description: string;
268
+ editable: boolean;
269
+ required: boolean;
270
+ formType: string;
271
+ propType: string;
272
+ defaultValue: null;
273
+ options: never[];
274
+ };
275
+ icon: {
276
+ label: string;
277
+ description: string;
278
+ formType: string;
279
+ propType: string;
280
+ defaultValue: string;
281
+ required: boolean;
282
+ editable: boolean;
283
+ group: string;
284
+ };
285
+ iconSize: {
286
+ label: string;
287
+ description: string;
288
+ formType: string;
289
+ propType: string;
290
+ group: string;
291
+ defaultValue: null;
292
+ editable: boolean;
293
+ required: boolean;
294
+ step: number;
295
+ };
296
+ backgroundColor: {
297
+ group: string;
298
+ label: string;
299
+ description: string;
300
+ editable: boolean;
301
+ required: boolean;
302
+ defaultValue: null;
303
+ formType: string;
304
+ propType: string;
305
+ };
306
+ color: {
307
+ group: string;
308
+ label: string;
309
+ description: string;
310
+ editable: boolean;
311
+ required: boolean;
312
+ defaultValue: null;
313
+ formType: string;
314
+ propType: string;
315
+ };
316
+ closeOnPress?: undefined;
317
+ swipeActivationPercentage?: undefined;
318
+ disableLeftSwipe?: undefined;
319
+ disableRightSwipe?: undefined;
320
+ leftOpenValue?: undefined;
321
+ rightOpenValue?: undefined;
322
+ leftActivationValue?: undefined;
323
+ rightActivationValue?: undefined;
324
+ stopLeftSwipe?: undefined;
325
+ stopRightSwipe?: undefined;
326
+ directionalDistanceChangeThreshold?: undefined;
327
+ friction?: undefined;
328
+ tension?: undefined;
329
+ swipeToOpenVelocityContribution?: undefined;
330
+ swipeToOpenPercent?: undefined;
331
+ swipeToClosePercent?: undefined;
332
+ };
333
+ doc_link?: undefined;
334
+ layout?: undefined;
335
+ } | {
336
+ name: string;
337
+ tag: string;
338
+ description: string;
339
+ category: string;
340
+ stylesPanelSections: never[];
341
+ triggers: string[];
342
+ props: {
343
+ onSwipe: {
344
+ label: string;
345
+ description: string;
346
+ editable: boolean;
347
+ required: boolean;
348
+ formType: string;
349
+ propType: string;
350
+ defaultValue: null;
351
+ group: string;
352
+ };
353
+ title: any;
354
+ side: {
355
+ group: string;
356
+ label: string;
357
+ description: string;
358
+ editable: boolean;
359
+ required: boolean;
360
+ formType: string;
361
+ propType: string;
362
+ defaultValue: null;
363
+ options: never[];
364
+ };
365
+ icon: {
366
+ label: string;
367
+ description: string;
368
+ formType: string;
369
+ propType: string;
370
+ defaultValue: string;
371
+ required: boolean;
372
+ editable: boolean;
373
+ group: string;
374
+ };
375
+ iconSize: {
376
+ label: string;
377
+ description: string;
378
+ formType: string;
379
+ propType: string;
380
+ group: string;
381
+ defaultValue: null;
382
+ editable: boolean;
383
+ required: boolean;
384
+ step: number;
385
+ };
386
+ backgroundColor: {
387
+ group: string;
388
+ label: string;
389
+ description: string;
390
+ editable: boolean;
391
+ required: boolean;
392
+ defaultValue: null;
393
+ formType: string;
394
+ propType: string;
395
+ };
396
+ color: {
397
+ group: string;
398
+ label: string;
399
+ description: string;
400
+ editable: boolean;
401
+ required: boolean;
402
+ defaultValue: null;
403
+ formType: string;
404
+ propType: string;
405
+ };
406
+ closeOnPress?: undefined;
407
+ swipeActivationPercentage?: undefined;
408
+ disableLeftSwipe?: undefined;
409
+ disableRightSwipe?: undefined;
410
+ leftOpenValue?: undefined;
411
+ rightOpenValue?: undefined;
412
+ leftActivationValue?: undefined;
413
+ rightActivationValue?: undefined;
414
+ stopLeftSwipe?: undefined;
415
+ stopRightSwipe?: undefined;
416
+ directionalDistanceChangeThreshold?: undefined;
417
+ friction?: undefined;
418
+ tension?: undefined;
419
+ swipeToOpenVelocityContribution?: undefined;
420
+ swipeToOpenPercent?: undefined;
421
+ swipeToClosePercent?: undefined;
422
+ };
423
+ doc_link?: undefined;
424
+ layout?: undefined;
425
+ })[];
426
+ //# sourceMappingURL=SwipeableView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SwipeableView.d.ts","sourceRoot":"","sources":["../../../../src/mappings/SwipeableView.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmClC,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4JrB,CAAC"}
@@ -10,6 +10,12 @@ export declare function extractBorderAndMarginStyles(style: StyleProp<any>, addi
10
10
  borderStyles: import("lodash").Dictionary<any>;
11
11
  marginStyles: import("lodash").Dictionary<any>;
12
12
  };
13
+ export declare const flexItemStyleNames: string[];
14
+ export declare function extractFlexItemStyles(style: StyleProp<any>, additionalFlexItemStyles?: string[]): import("lodash").Dictionary<any>;
15
+ export declare const positionStyleNames: string[];
16
+ export declare function extractPositionStyles(style: StyleProp<any>, additionalPositionStyles?: string[]): import("lodash").Dictionary<any>;
17
+ export declare const effectsStyleNames: string[];
18
+ export declare function extractEffectStyles(style: StyleProp<any>, additionalEffectStyles?: string[]): import("lodash").Dictionary<any>;
13
19
  export declare const sizeStyleNames: string[];
14
20
  export declare function extractSizeStyles(style: StyleProp<any>, additionalSizeStyles?: string[]): import("lodash").Dictionary<any>;
15
21
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../../../src/utilities.ts"],"names":[],"mappings":";AAAA,OAAO,EAAc,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGhE,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,CAAC,GAAG,CAAC;;;EA+BlD;AAED,eAAO,MAAM,gBAAgB,UAwB5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,UAU5B,CAAC;AAEF,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,SAAS,CAAC,GAAG,CAAC,EACrB,sBAAsB,CAAC,EAAE,MAAM,EAAE,EACjC,sBAAsB,CAAC,EAAE,MAAM,EAAE;;;EAqBlC;AAED,eAAO,MAAM,cAAc,UAAsB,CAAC;AAElD,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,SAAS,CAAC,GAAG,CAAC,EACrB,oBAAoB,CAAC,EAAE,MAAM,EAAE,oCAahC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CACzB,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EACjC,aAAa,EAAE,SAAS,CAAC,GAAG,CAAC,GAAG,SAAS,OAe1C;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,UAQ5D"}
1
+ {"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../../../src/utilities.ts"],"names":[],"mappings":";AAAA,OAAO,EAAc,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGhE,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,CAAC,GAAG,CAAC;;;EA+BlD;AAED,eAAO,MAAM,gBAAgB,UAwB5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,UAU5B,CAAC;AAEF,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,SAAS,CAAC,GAAG,CAAC,EACrB,sBAAsB,CAAC,EAAE,MAAM,EAAE,EACjC,sBAAsB,CAAC,EAAE,MAAM,EAAE;;;EAqBlC;AAED,eAAO,MAAM,kBAAkB,UAM9B,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,SAAS,CAAC,GAAG,CAAC,EACrB,wBAAwB,CAAC,EAAE,MAAM,EAAE,oCAapC;AAED,eAAO,MAAM,kBAAkB,UAQ9B,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,SAAS,CAAC,GAAG,CAAC,EACrB,wBAAwB,CAAC,EAAE,MAAM,EAAE,oCAapC;AAED,eAAO,MAAM,iBAAiB,UAA2B,CAAC;AAE1D,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,SAAS,CAAC,GAAG,CAAC,EACrB,sBAAsB,CAAC,EAAE,MAAM,EAAE,oCAalC;AAED,eAAO,MAAM,cAAc,UAAsB,CAAC;AAElD,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,SAAS,CAAC,GAAG,CAAC,EACrB,oBAAoB,CAAC,EAAE,MAAM,EAAE,oCAahC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CACzB,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EACjC,aAAa,EAAE,SAAS,CAAC,GAAG,CAAC,GAAG,SAAS,OAe1C;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,UAQ5D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "47.2.1-a33ddf.2+a33ddf6",
3
+ "version": "47.2.1-d833e1.2+d833e1f",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -41,7 +41,7 @@
41
41
  "dependencies": {
42
42
  "@date-io/date-fns": "^1.3.13",
43
43
  "@draftbit/react-theme-provider": "^2.1.1",
44
- "@draftbit/types": "^47.2.1-a33ddf.2+a33ddf6",
44
+ "@draftbit/types": "^47.2.1-d833e1.2+d833e1f",
45
45
  "@material-ui/core": "^4.11.0",
46
46
  "@material-ui/pickers": "^3.2.10",
47
47
  "@react-native-community/slider": "4.2.4",
@@ -61,6 +61,7 @@
61
61
  "react-native-reanimated": "~2.12.0",
62
62
  "react-native-shadow-2": "^7.0.6",
63
63
  "react-native-svg": "13.4.0",
64
+ "react-native-swipe-list-view": "^3.2.9",
64
65
  "react-native-tab-view": "^3.4.0",
65
66
  "react-native-typography": "^1.4.1",
66
67
  "react-native-web-swiper": "^2.2.3",
@@ -93,5 +94,5 @@
93
94
  "node_modules/",
94
95
  "lib/"
95
96
  ],
96
- "gitHead": "a33ddf6d66acb34cd5de957e95359ef25284a90c"
97
+ "gitHead": "d833e1fefc9e0ad3ee353e9fd5e29ccb76f65f6b"
97
98
  }
@@ -2,10 +2,25 @@ import React from "react";
2
2
  import { StyleSheet, View, } from "react-native";
3
3
  import BottomSheetComponent from "./BottomSheetComponent";
4
4
  import { withTheme } from "../../theming";
5
- const BottomSheet = ({ theme, snapPoints = ["10%", "50%", "80%"], initialSnapIndex = 0, showHandle = true, handleColor = theme.colors.divider, topBorderRadius = 20, borderWidth = 1, borderColor = theme.colors.divider, onSettle, style, children, ...rest }) => {
5
+ const BottomSheet = ({ theme, snapPoints: snapPointsProp, topSnapPosition = "10%", middleSnapPosition = "50%", bottomSnapPosition = "80%", initialSnapIndex, initialSnapPosition = "bottom", showHandle = true, handleColor = theme.colors.divider, topBorderRadius = 20, borderWidth = 1, borderColor = theme.colors.divider, onSettle, style, children, ...rest }) => {
6
6
  const backgroundColor = (style === null || style === void 0 ? void 0 : style.backgroundColor) || theme.colors.background;
7
+ const snapPoints = snapPointsProp || [
8
+ topSnapPosition,
9
+ middleSnapPosition,
10
+ bottomSnapPosition,
11
+ ];
12
+ const getSnapIndexFromPosition = (position) => {
13
+ switch (position) {
14
+ case "top":
15
+ return 0;
16
+ case "middle":
17
+ return 1;
18
+ case "bottom":
19
+ return 2;
20
+ }
21
+ };
7
22
  return (React.createElement(View, { style: styles.parentContainer, pointerEvents: "box-none" },
8
- React.createElement(BottomSheetComponent, { componentType: "ScrollView", snapPoints: snapPoints, initialSnapIndex: initialSnapIndex, renderHandle: () => (React.createElement(React.Fragment, null, showHandle && (React.createElement(View, { style: [
23
+ React.createElement(BottomSheetComponent, { componentType: "ScrollView", snapPoints: snapPoints, initialSnapIndex: initialSnapIndex !== null && initialSnapIndex !== void 0 ? initialSnapIndex : getSnapIndexFromPosition(initialSnapPosition), renderHandle: () => (React.createElement(React.Fragment, null, showHandle && (React.createElement(View, { style: [
9
24
  styles.handleContainer,
10
25
  {
11
26
  backgroundColor,
@@ -11,9 +11,14 @@ import BottomSheetComponent from "./BottomSheetComponent";
11
11
  import type { Theme } from "../../styles/DefaultTheme";
12
12
  import { withTheme } from "../../theming";
13
13
 
14
+ type SnapPosition = "top" | "middle" | "bottom";
14
15
  export interface BottomSheetProps extends ScrollViewProps {
15
- snapPoints?: (string | number)[];
16
+ topSnapPosition?: string | number;
17
+ middleSnapPosition?: string | number;
18
+ bottomSnapPosition?: string | number;
19
+ snapPoints: (string | number)[];
16
20
  initialSnapIndex?: number;
21
+ initialSnapPosition: SnapPosition;
17
22
  showHandle?: boolean;
18
23
  handleColor?: string;
19
24
  topBorderRadius?: number;
@@ -26,8 +31,12 @@ export interface BottomSheetProps extends ScrollViewProps {
26
31
 
27
32
  const BottomSheet: React.FC<React.PropsWithChildren<BottomSheetProps>> = ({
28
33
  theme,
29
- snapPoints = ["10%", "50%", "80%"],
30
- initialSnapIndex = 0,
34
+ snapPoints: snapPointsProp,
35
+ topSnapPosition = "10%",
36
+ middleSnapPosition = "50%",
37
+ bottomSnapPosition = "80%",
38
+ initialSnapIndex,
39
+ initialSnapPosition = "bottom",
31
40
  showHandle = true,
32
41
  handleColor = theme.colors.divider,
33
42
  topBorderRadius = 20,
@@ -41,12 +50,31 @@ const BottomSheet: React.FC<React.PropsWithChildren<BottomSheetProps>> = ({
41
50
  const backgroundColor =
42
51
  (style as ViewStyle)?.backgroundColor || theme.colors.background;
43
52
 
53
+ const snapPoints = snapPointsProp || [
54
+ topSnapPosition,
55
+ middleSnapPosition,
56
+ bottomSnapPosition,
57
+ ];
58
+
59
+ const getSnapIndexFromPosition = (position: SnapPosition) => {
60
+ switch (position) {
61
+ case "top":
62
+ return 0;
63
+ case "middle":
64
+ return 1;
65
+ case "bottom":
66
+ return 2;
67
+ }
68
+ };
69
+
44
70
  return (
45
71
  <View style={styles.parentContainer} pointerEvents="box-none">
46
72
  <BottomSheetComponent
47
73
  componentType="ScrollView"
48
74
  snapPoints={snapPoints}
49
- initialSnapIndex={initialSnapIndex}
75
+ initialSnapIndex={
76
+ initialSnapIndex ?? getSnapIndexFromPosition(initialSnapPosition)
77
+ }
50
78
  renderHandle={() => (
51
79
  <>
52
80
  {showHandle && (
@@ -0,0 +1,117 @@
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);