@draftbit/core 46.11.5-d0abaf.2 → 46.11.5-d49547.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 (93) hide show
  1. package/lib/commonjs/components/Accordion/AccordionGroup.js.map +1 -1
  2. package/lib/commonjs/components/Accordion/AccordionItem.js +4 -22
  3. package/lib/commonjs/components/Accordion/AccordionItem.js.map +1 -1
  4. package/lib/commonjs/components/AnimatedCircularProgress.js +2 -11
  5. package/lib/commonjs/components/AnimatedCircularProgress.js.map +1 -1
  6. package/lib/commonjs/components/AvatarEdit.js +4 -15
  7. package/lib/commonjs/components/AvatarEdit.js.map +1 -1
  8. package/lib/commonjs/components/Button.js +10 -32
  9. package/lib/commonjs/components/Button.js.map +1 -1
  10. package/lib/commonjs/components/Checkbox/CheckboxGroup.js +16 -3
  11. package/lib/commonjs/components/Checkbox/CheckboxGroup.js.map +1 -1
  12. package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +22 -5
  13. package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js.map +1 -1
  14. package/lib/commonjs/components/Checkbox/CheckboxRow.js +6 -23
  15. package/lib/commonjs/components/Checkbox/CheckboxRow.js.map +1 -1
  16. package/lib/commonjs/components/DeckSwiper/index.js.map +1 -1
  17. package/lib/commonjs/components/Markdown.js.map +1 -1
  18. package/lib/commonjs/components/NumberInput.js +3 -11
  19. package/lib/commonjs/components/NumberInput.js.map +1 -1
  20. package/lib/commonjs/components/Picker/PickerComponent.web.js +4 -21
  21. package/lib/commonjs/components/Picker/PickerComponent.web.js.map +1 -1
  22. package/lib/commonjs/components/SwipeableView/SwipeableView.js +155 -0
  23. package/lib/commonjs/components/SwipeableView/SwipeableView.js.map +1 -0
  24. package/lib/commonjs/components/SwipeableView/SwipeableViewButton.js +13 -0
  25. package/lib/commonjs/components/SwipeableView/SwipeableViewButton.js.map +1 -0
  26. package/lib/commonjs/components/SwipeableView/SwipeableViewSwipeHandler.js +13 -0
  27. package/lib/commonjs/components/SwipeableView/SwipeableViewSwipeHandler.js.map +1 -0
  28. package/lib/commonjs/components/SwipeableView/index.js +28 -0
  29. package/lib/commonjs/components/SwipeableView/index.js.map +1 -0
  30. package/lib/commonjs/components/Table/TableCommon.js.map +1 -1
  31. package/lib/commonjs/components/Text.js +4 -50
  32. package/lib/commonjs/components/Text.js.map +1 -1
  33. package/lib/commonjs/constants.js +1 -1
  34. package/lib/commonjs/index.js +19 -0
  35. package/lib/commonjs/index.js.map +1 -1
  36. package/lib/commonjs/mappings/KeyboardAwareScrollView.js.map +1 -1
  37. package/lib/commonjs/mappings/MapCallout.js.map +1 -1
  38. package/lib/commonjs/mappings/Picker.js.map +1 -1
  39. package/lib/commonjs/mappings/Shadow.js.map +1 -1
  40. package/lib/commonjs/mappings/SwipeableView.js +182 -0
  41. package/lib/commonjs/mappings/SwipeableView.js.map +1 -0
  42. package/lib/commonjs/mappings/TabView.js.map +1 -1
  43. package/lib/commonjs/mappings/ToggleButton.js.map +1 -1
  44. package/lib/commonjs/utilities.js +27 -2
  45. package/lib/commonjs/utilities.js.map +1 -1
  46. package/lib/module/components/ActionSheet/index.js.map +1 -1
  47. package/lib/module/components/StarRating.js +23 -4
  48. package/lib/module/components/StarRating.js.map +1 -1
  49. package/lib/module/components/SwipeableView/SwipeableView.js +147 -0
  50. package/lib/module/components/SwipeableView/SwipeableView.js.map +1 -0
  51. package/lib/module/components/SwipeableView/SwipeableViewButton.js +6 -0
  52. package/lib/module/components/SwipeableView/SwipeableViewButton.js.map +1 -0
  53. package/lib/module/components/SwipeableView/SwipeableViewSwipeHandler.js +6 -0
  54. package/lib/module/components/SwipeableView/SwipeableViewSwipeHandler.js.map +1 -0
  55. package/lib/module/components/SwipeableView/index.js +4 -0
  56. package/lib/module/components/SwipeableView/index.js.map +1 -0
  57. package/lib/module/components/Touchable.js +2 -15
  58. package/lib/module/components/Touchable.js.map +1 -1
  59. package/lib/module/index.js +1 -0
  60. package/lib/module/index.js.map +1 -1
  61. package/lib/module/mappings/SwipeableView.js +175 -0
  62. package/lib/module/mappings/SwipeableView.js.map +1 -0
  63. package/lib/module/utilities.js +18 -0
  64. package/lib/module/utilities.js.map +1 -1
  65. package/lib/typescript/src/components/SwipeableView/SwipeableView.d.ts +29 -0
  66. package/lib/typescript/src/components/SwipeableView/SwipeableView.d.ts.map +1 -0
  67. package/lib/typescript/src/components/SwipeableView/SwipeableViewButton.d.ts +13 -0
  68. package/lib/typescript/src/components/SwipeableView/SwipeableViewButton.d.ts.map +1 -0
  69. package/lib/typescript/src/components/SwipeableView/SwipeableViewSwipeHandler.d.ts +13 -0
  70. package/lib/typescript/src/components/SwipeableView/SwipeableViewSwipeHandler.d.ts.map +1 -0
  71. package/lib/typescript/src/components/SwipeableView/index.d.ts +4 -0
  72. package/lib/typescript/src/components/SwipeableView/index.d.ts.map +1 -0
  73. package/lib/typescript/src/index.d.ts +1 -0
  74. package/lib/typescript/src/index.d.ts.map +1 -1
  75. package/lib/typescript/src/mappings/SwipeableView.d.ts +371 -0
  76. package/lib/typescript/src/mappings/SwipeableView.d.ts.map +1 -0
  77. package/lib/typescript/src/utilities.d.ts +6 -0
  78. package/lib/typescript/src/utilities.d.ts.map +1 -1
  79. package/package.json +4 -3
  80. package/src/components/SwipeableView/SwipeableView.js +117 -0
  81. package/src/components/SwipeableView/SwipeableView.tsx +299 -0
  82. package/src/components/SwipeableView/SwipeableViewButton.js +5 -0
  83. package/src/components/SwipeableView/SwipeableViewButton.tsx +18 -0
  84. package/src/components/SwipeableView/SwipeableViewSwipeHandler.js +5 -0
  85. package/src/components/SwipeableView/SwipeableViewSwipeHandler.tsx +20 -0
  86. package/src/components/SwipeableView/index.js +3 -0
  87. package/src/components/SwipeableView/index.tsx +3 -0
  88. package/src/index.js +1 -0
  89. package/src/index.tsx +6 -0
  90. package/src/mappings/SwipeableView.js +181 -0
  91. package/src/mappings/SwipeableView.ts +210 -0
  92. package/src/utilities.js +41 -0
  93. package/src/utilities.ts +71 -0
@@ -0,0 +1,371 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SwipeableView.d.ts","sourceRoot":"","sources":["../../../../src/mappings/SwipeableView.ts"],"names":[],"mappings":"AAqDA,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": "46.11.5-d0abaf.2+d0abaf3",
3
+ "version": "46.11.5-d49547.2+d495478",
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": "^46.11.5-d0abaf.2+d0abaf3",
44
+ "@draftbit/types": "^46.11.5-d49547.2+d495478",
45
45
  "@material-ui/core": "^4.11.0",
46
46
  "@material-ui/pickers": "^3.2.10",
47
47
  "@react-native-community/slider": "4.2.3",
@@ -61,6 +61,7 @@
61
61
  "react-native-reanimated": "~2.9.1",
62
62
  "react-native-shadow-2": "^7.0.6",
63
63
  "react-native-svg": "12.3.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": "d0abaf35fdb82d72e043fbe8f5f2c634d26c6a81"
97
+ "gitHead": "d49547859c2c87ff13960d1e68410aa1ff69ce4a"
97
98
  }
@@ -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);