ferns-ui 0.39.0 → 0.39.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ActionSheet.d.ts +2 -317
- package/dist/ActionSheet.js.map +1 -1
- package/dist/Avatar.d.ts +1 -70
- package/dist/Avatar.js +4 -4
- package/dist/Avatar.js.map +1 -1
- package/dist/Badge.d.ts +1 -8
- package/dist/Badge.js.map +1 -1
- package/dist/Banner.d.ts +1 -14
- package/dist/Banner.js.map +1 -1
- package/dist/Body.d.ts +2 -10
- package/dist/Body.js.map +1 -1
- package/dist/Box.js +4 -4
- package/dist/Box.js.map +1 -1
- package/dist/Button.d.ts +1 -24
- package/dist/Button.js.map +1 -1
- package/dist/Card.d.ts +1 -3
- package/dist/Card.js +14 -4
- package/dist/Card.js.map +1 -1
- package/dist/CheckBox.d.ts +1 -1
- package/dist/CheckBox.js +2 -2
- package/dist/CheckBox.js.map +1 -1
- package/dist/Common.d.ts +713 -371
- package/dist/Common.js +0 -35
- package/dist/Common.js.map +1 -1
- package/dist/CustomSelect.d.ts +1 -12
- package/dist/CustomSelect.js +6 -3
- package/dist/CustomSelect.js.map +1 -1
- package/dist/DateTimeActionSheet.d.ts +1 -10
- package/dist/DateTimeActionSheet.js +8 -10
- package/dist/DateTimeActionSheet.js.map +1 -1
- package/dist/DecimalRangeActionSheet.d.ts +1 -13
- package/dist/DecimalRangeActionSheet.js.map +1 -1
- package/dist/ErrorBoundary.d.ts +1 -1
- package/dist/ErrorPage.d.ts +1 -5
- package/dist/ErrorPage.js.map +1 -1
- package/dist/Field.d.ts +2 -20
- package/dist/Field.js +15 -15
- package/dist/Field.js.map +1 -1
- package/dist/Form.d.ts +1 -7
- package/dist/Form.js.map +1 -1
- package/dist/Heading.d.ts +1 -1
- package/dist/Heading.js +2 -2
- package/dist/Heading.js.map +1 -1
- package/dist/HeightActionSheet.d.ts +1 -6
- package/dist/HeightActionSheet.js.map +1 -1
- package/dist/Hyperlink.d.ts +2 -14
- package/dist/Hyperlink.js +2 -1
- package/dist/Hyperlink.js.map +1 -1
- package/dist/Icon.d.ts +1 -1
- package/dist/Icon.js +4 -3
- package/dist/Icon.js.map +1 -1
- package/dist/IconButton.d.ts +1 -24
- package/dist/IconButton.js +6 -6
- package/dist/IconButton.js.map +1 -1
- package/dist/InfoTooltipButton.d.ts +1 -6
- package/dist/InfoTooltipButton.js.map +1 -1
- package/dist/Link.d.ts +1 -5
- package/dist/Link.js.map +1 -1
- package/dist/MobileAddressAutoComplete.d.ts +2 -11
- package/dist/MobileAddressAutoComplete.js +2 -2
- package/dist/MobileAddressAutoComplete.js.map +1 -1
- package/dist/Modal.d.ts +1 -17
- package/dist/Modal.js +2 -2
- package/dist/Modal.js.map +1 -1
- package/dist/NumberPickerActionSheet.d.ts +1 -8
- package/dist/NumberPickerActionSheet.js.map +1 -1
- package/dist/Page.d.ts +1 -21
- package/dist/Page.js.map +1 -1
- package/dist/PickerSelect.d.ts +1 -2
- package/dist/Pill.d.ts +1 -3
- package/dist/Pill.js +3 -5
- package/dist/Pill.js.map +1 -1
- package/dist/Pog.d.ts +2 -14
- package/dist/Pog.js +1 -1
- package/dist/Pog.js.map +1 -1
- package/dist/ProgressBar.d.ts +1 -5
- package/dist/ProgressBar.js.map +1 -1
- package/dist/SelectList.d.ts +4 -2
- package/dist/SelectList.js.map +1 -1
- package/dist/SideDrawer.d.ts +1 -11
- package/dist/SideDrawer.js.map +1 -1
- package/dist/Spinner.d.ts +1 -5
- package/dist/Spinner.js +2 -1
- package/dist/Spinner.js.map +1 -1
- package/dist/Switch.d.ts +1 -3
- package/dist/Switch.js +15 -5
- package/dist/Switch.js.map +1 -1
- package/dist/Table.d.ts +1 -28
- package/dist/Table.js +4 -2
- package/dist/Table.js.map +1 -1
- package/dist/TableHeader.d.ts +1 -17
- package/dist/TableHeader.js.map +1 -1
- package/dist/TableHeaderCell.d.ts +2 -11
- package/dist/TableHeaderCell.js +1 -1
- package/dist/TableHeaderCell.js.map +1 -1
- package/dist/TableRow.d.ts +2 -25
- package/dist/TableRow.js.map +1 -1
- package/dist/TapToEdit.d.ts +1 -2
- package/dist/TapToEdit.js +2 -2
- package/dist/TapToEdit.js.map +1 -1
- package/dist/Text.d.ts +1 -18
- package/dist/Text.js.map +1 -1
- package/dist/TextArea.d.ts +1 -4
- package/dist/TextArea.js +3 -9
- package/dist/TextArea.js.map +1 -1
- package/dist/TextField.d.ts +1 -1
- package/dist/TextField.js +6 -5
- package/dist/TextField.js.map +1 -1
- package/dist/TextFieldNumberActionSheet.d.ts +2 -8
- package/dist/TextFieldNumberActionSheet.js.map +1 -1
- package/dist/Toast.d.ts +2 -10
- package/dist/Toast.js +1 -1
- package/dist/Toast.js.map +1 -1
- package/dist/Tooltip.d.ts +1 -7
- package/dist/Tooltip.js +8 -6
- package/dist/Tooltip.js.map +1 -1
- package/dist/UnifiedAddressAutoComplete.d.ts +2 -11
- package/dist/UnifiedAddressAutoComplete.js +4 -4
- package/dist/UnifiedAddressAutoComplete.js.map +1 -1
- package/dist/Utilities.d.ts +3 -0
- package/dist/Utilities.js +24 -0
- package/dist/Utilities.js.map +1 -1
- package/dist/WebAddressAutocomplete.d.ts +2 -9
- package/dist/WebAddressAutocomplete.js +1 -0
- package/dist/WebAddressAutocomplete.js.map +1 -1
- package/dist/WithLabel.d.ts +1 -12
- package/dist/WithLabel.js.map +1 -1
- package/dist/dayjsExtended.js +1 -0
- package/dist/dayjsExtended.js.map +1 -1
- package/dist/index.d.ts +6 -7
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/package.json +17 -39
- package/src/ActionSheet.tsx +1 -351
- package/src/Avatar.tsx +5 -85
- package/src/Badge.tsx +1 -12
- package/src/Banner.tsx +1 -15
- package/src/Body.tsx +2 -11
- package/src/Box.tsx +4 -4
- package/src/Button.tsx +1 -27
- package/src/Card.tsx +15 -17
- package/src/CheckBox.tsx +2 -0
- package/src/Common.ts +801 -531
- package/src/CustomSelect.tsx +7 -13
- package/src/DateTimeActionSheet.tsx +9 -21
- package/src/DecimalRangeActionSheet.tsx +1 -14
- package/src/ErrorPage.tsx +1 -4
- package/src/Field.tsx +17 -37
- package/src/Form.tsx +1 -8
- package/src/Heading.tsx +8 -2
- package/src/HeightActionSheet.tsx +1 -7
- package/src/Hyperlink.tsx +7 -16
- package/src/Icon.tsx +4 -2
- package/src/IconButton.tsx +6 -43
- package/src/InfoTooltipButton.tsx +1 -6
- package/src/Link.tsx +2 -5
- package/src/MobileAddressAutoComplete.tsx +4 -11
- package/src/Modal.tsx +3 -26
- package/src/NumberPickerActionSheet.tsx +1 -9
- package/src/Page.tsx +1 -22
- package/src/PickerSelect.tsx +1 -1
- package/src/Pill.tsx +15 -17
- package/src/Pog.tsx +2 -14
- package/src/ProgressBar.tsx +1 -6
- package/src/SelectList.tsx +4 -4
- package/src/SideDrawer.tsx +1 -16
- package/src/Spinner.tsx +3 -7
- package/src/Switch.tsx +6 -12
- package/src/Table.tsx +5 -29
- package/src/TableHeader.tsx +1 -17
- package/src/TableHeaderCell.tsx +7 -11
- package/src/TableRow.tsx +2 -25
- package/src/TapToEdit.tsx +4 -4
- package/src/Text.tsx +1 -19
- package/src/TextArea.tsx +2 -10
- package/src/TextField.tsx +6 -3
- package/src/TextFieldNumberActionSheet.tsx +2 -9
- package/src/Toast.tsx +2 -14
- package/src/Tooltip.tsx +9 -15
- package/src/UnifiedAddressAutoComplete.tsx +6 -11
- package/src/Utilities.tsx +27 -1
- package/src/WebAddressAutocomplete.tsx +3 -9
- package/src/WithLabel.tsx +1 -13
- package/src/dayjsExtended.ts +1 -0
- package/src/index.tsx +6 -7
- package/dist/Layer.d.ts +0 -9
- package/dist/Layer.js +0 -12
- package/dist/Layer.js.map +0 -1
- package/dist/Meta.d.ts +0 -5
- package/dist/Meta.js +0 -7
- package/dist/Meta.js.map +0 -1
- package/dist/UnifiedScreens.d.ts +0 -9
- package/dist/UnifiedScreens.js +0 -25
- package/dist/UnifiedScreens.js.map +0 -1
- package/src/Layer.tsx +0 -17
- package/src/Meta.tsx +0 -9
- package/src/UnifiedScreens.ts +0 -24
package/src/ActionSheet.tsx
CHANGED
|
@@ -21,359 +21,9 @@ import {
|
|
|
21
21
|
TextInput,
|
|
22
22
|
UIManager,
|
|
23
23
|
View,
|
|
24
|
-
ViewStyle,
|
|
25
24
|
} from "react-native";
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
children?: React.ReactNode;
|
|
29
|
-
ref?: React.MutableRefObject<{
|
|
30
|
-
/**
|
|
31
|
-
* Open or close the ActionSheet.
|
|
32
|
-
*/
|
|
33
|
-
setModalVisible(visible?: boolean): void;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Open the Action Sheet.
|
|
37
|
-
*/
|
|
38
|
-
show(): void;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Close the ActionSheet.
|
|
42
|
-
*/
|
|
43
|
-
hide(): void;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Attach this to any child ScrollView Component's onScrollEndDrag,
|
|
47
|
-
* onMomentumScrollEnd,onScrollAnimationEnd callbacks to handle the ActionSheet
|
|
48
|
-
* closing and bouncing back properly.
|
|
49
|
-
*/
|
|
50
|
-
handleChildScrollEnd(): void;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Snap ActionSheet to given offset
|
|
54
|
-
*/
|
|
55
|
-
snapToOffset(offset: number): void;
|
|
56
|
-
}>;
|
|
57
|
-
/**
|
|
58
|
-
* Animate the opening and closing of ActionSheet.
|
|
59
|
-
|
|
60
|
-
| Type | Required |
|
|
61
|
-
| ---- | -------- |
|
|
62
|
-
| boolean | no |
|
|
63
|
-
|
|
64
|
-
Default: `true`
|
|
65
|
-
*/
|
|
66
|
-
animated?: boolean;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Use if you want to show the ActionSheet Partially on Opening. **Requires `gestureEnabled=true`**
|
|
70
|
-
|
|
71
|
-
| Type | Required |
|
|
72
|
-
| ---- | -------- |
|
|
73
|
-
| boolean | no |
|
|
74
|
-
|
|
75
|
-
Default:`1`
|
|
76
|
-
*/
|
|
77
|
-
|
|
78
|
-
initialOffsetFromBottom?: number;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* When touch ends and user has not moved farther from the set springOffset, the ActionSheet will return to previous position.
|
|
82
|
-
|
|
83
|
-
| Type | Required |
|
|
84
|
-
| ---- | -------- |
|
|
85
|
-
| number | no |
|
|
86
|
-
|
|
87
|
-
Default: `50`
|
|
88
|
-
*/
|
|
89
|
-
springOffset?: number;
|
|
90
|
-
/**
|
|
91
|
-
* Add elevation to the ActionSheet container.
|
|
92
|
-
|
|
93
|
-
| Type | Required |
|
|
94
|
-
| ---- | -------- |
|
|
95
|
-
| number | no |
|
|
96
|
-
|
|
97
|
-
Default: `0`
|
|
98
|
-
|
|
99
|
-
#
|
|
100
|
-
*/
|
|
101
|
-
elevation?: number;
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Color of the gestureEnabled Indicator.
|
|
105
|
-
|
|
106
|
-
| Type | Required |
|
|
107
|
-
| ---- | -------- |
|
|
108
|
-
| string | no |
|
|
109
|
-
|
|
110
|
-
Default: `"#f0f0f0"`
|
|
111
|
-
*/
|
|
112
|
-
indicatorColor?: string;
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Normally when the ActionSheet is fully opened, a small portion from the bottom is hidden by default. Use this prop if you want the ActionSheet to hover over the bottom of screen and not hide a little behind it.
|
|
116
|
-
|
|
117
|
-
| Type | Required |
|
|
118
|
-
| ---- | -------- |
|
|
119
|
-
| number | no |
|
|
120
|
-
|
|
121
|
-
Default:`0`
|
|
122
|
-
*/
|
|
123
|
-
extraScroll?: number;
|
|
124
|
-
/**
|
|
125
|
-
* Color of the overlay/backdrop.
|
|
126
|
-
|
|
127
|
-
| Type | Required |
|
|
128
|
-
| ---- | -------- |
|
|
129
|
-
| string | no |
|
|
130
|
-
|
|
131
|
-
Default: `"black"`
|
|
132
|
-
*/
|
|
133
|
-
overlayColor?: string;
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Keep the header always visible even when gestures are disabled.
|
|
137
|
-
|
|
138
|
-
| Type | Required |
|
|
139
|
-
| ---- | -------- |
|
|
140
|
-
| boolean | no |
|
|
141
|
-
|
|
142
|
-
Default: `false`
|
|
143
|
-
*/
|
|
144
|
-
headerAlwaysVisible?: boolean;
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Delay draw of ActionSheet on open for android.
|
|
148
|
-
|
|
149
|
-
| Type | Required |
|
|
150
|
-
| ---- | -------- |
|
|
151
|
-
| boolean | no |
|
|
152
|
-
|
|
153
|
-
Default: `false`
|
|
154
|
-
*/
|
|
155
|
-
|
|
156
|
-
delayActionSheetDraw?: boolean;
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Delay draw of ActionSheet on open for android time.
|
|
160
|
-
|
|
161
|
-
| Type | Required |
|
|
162
|
-
| ---- | -------- |
|
|
163
|
-
| number (ms) | no |
|
|
164
|
-
|
|
165
|
-
Default: `50`
|
|
166
|
-
*/
|
|
167
|
-
|
|
168
|
-
delayActionSheetDrawTime?: number;
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Your custom header component. Using this will hide the default indicator.
|
|
172
|
-
|
|
173
|
-
| Type | Required |
|
|
174
|
-
| ---- | -------- |
|
|
175
|
-
| React.Component | no |
|
|
176
|
-
*/
|
|
177
|
-
CustomHeaderComponent?: React.ReactNode;
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Any custom styles for the container.
|
|
181
|
-
|
|
182
|
-
| Type | Required |
|
|
183
|
-
| ---- | -------- |
|
|
184
|
-
| Object | no |
|
|
185
|
-
*/
|
|
186
|
-
containerStyle?: ViewStyle;
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Control closing ActionSheet by touching on backdrop.
|
|
190
|
-
|
|
191
|
-
| Type | Required |
|
|
192
|
-
| ---- | -------- |
|
|
193
|
-
| boolean | no |
|
|
194
|
-
|
|
195
|
-
Default: `true`
|
|
196
|
-
*/
|
|
197
|
-
closeOnTouchBackdrop?: boolean;
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Speed of opening animation. Higher means the ActionSheet will open more quickly.
|
|
201
|
-
|
|
202
|
-
| Type | Required |
|
|
203
|
-
| ---- | -------- |
|
|
204
|
-
| number | no |
|
|
205
|
-
|
|
206
|
-
Default: `12`
|
|
207
|
-
*/
|
|
208
|
-
openAnimationSpeed?: number;
|
|
209
|
-
/**
|
|
210
|
-
* Duration of closing animation.
|
|
211
|
-
|
|
212
|
-
| Type | Required |
|
|
213
|
-
| ---- | -------- |
|
|
214
|
-
| number | no |
|
|
215
|
-
|
|
216
|
-
Default: `300`
|
|
217
|
-
*/
|
|
218
|
-
closeAnimationDuration?: number;
|
|
219
|
-
/**
|
|
220
|
-
*
|
|
221
|
-
How much you want the ActionSheet to bounce when it is opened.
|
|
222
|
-
|
|
223
|
-
| Type | Required |
|
|
224
|
-
| ---- | -------- |
|
|
225
|
-
| number | no |
|
|
226
|
-
|
|
227
|
-
Default: `8`
|
|
228
|
-
*/
|
|
229
|
-
bounciness?: number;
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Will the ActionSheet close on `hardwareBackPress` event.
|
|
233
|
-
|
|
234
|
-
| Type | Required |
|
|
235
|
-
| ---- | -------- |
|
|
236
|
-
| boolean | no |
|
|
237
|
-
|
|
238
|
-
Default: `true`
|
|
239
|
-
*/
|
|
240
|
-
closeOnPressBack?: boolean;
|
|
241
|
-
/**
|
|
242
|
-
* Default opacity of the overlay/backdrop.
|
|
243
|
-
|
|
244
|
-
| Type | Required |
|
|
245
|
-
| ---- | -------- |
|
|
246
|
-
| number 0 - 1 | no |
|
|
247
|
-
|
|
248
|
-
Default: `0.3`
|
|
249
|
-
*/
|
|
250
|
-
defaultOverlayOpacity?: number;
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Enables gesture control of ActionSheet
|
|
254
|
-
|
|
255
|
-
| Type | Required |
|
|
256
|
-
| ---- | -------- |
|
|
257
|
-
| boolean | no |
|
|
258
|
-
|
|
259
|
-
Default: `false`
|
|
260
|
-
*/
|
|
261
|
-
gestureEnabled?: boolean;
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Bounces the ActionSheet on open.
|
|
265
|
-
|
|
266
|
-
| Type | Required |
|
|
267
|
-
| ---- | -------- |
|
|
268
|
-
| boolean | no |
|
|
269
|
-
|
|
270
|
-
Default: `false`
|
|
271
|
-
*/
|
|
272
|
-
bounceOnOpen?: boolean;
|
|
273
|
-
|
|
274
|
-
/**
|
|
275
|
-
* Setting the keyboard persistence of the ScrollView component, should be one of "never", "always", or "handled"
|
|
276
|
-
|
|
277
|
-
| Type | Required |
|
|
278
|
-
| ---- | -------- |
|
|
279
|
-
| string | no |
|
|
280
|
-
|
|
281
|
-
Default: `"never"`
|
|
282
|
-
*/
|
|
283
|
-
keyboardShouldPersistTaps?: boolean | "always" | "never" | "handled";
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Determine whether the modal should go under the system statusbar.
|
|
287
|
-
|
|
288
|
-
| Type | Required |
|
|
289
|
-
| ---- | -------- |
|
|
290
|
-
| boolean | no |
|
|
291
|
-
|
|
292
|
-
Default: `true`
|
|
293
|
-
*/
|
|
294
|
-
statusBarTranslucent?: boolean;
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* Prevent ActionSheet from closing on
|
|
298
|
-
* gesture or tapping on backdrop.
|
|
299
|
-
* Instead snap it to `bottomOffset` location
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
* | Type | Required |
|
|
303
|
-
| ---- | -------- |
|
|
304
|
-
| boolean | no |
|
|
305
|
-
*/
|
|
306
|
-
closable?: boolean;
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* Allow ActionSheet to draw under the StatusBar.
|
|
310
|
-
* This is enabled by default.
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
* | Type | Required |
|
|
314
|
-
| ---- | -------- |
|
|
315
|
-
| boolean | no |
|
|
316
|
-
Default: `true`
|
|
317
|
-
*/
|
|
318
|
-
drawUnderStatusBar?: boolean;
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* Snap ActionSheet to this location if `closable` is set to false;
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
* | Type | Required |
|
|
325
|
-
| ---- | -------- |
|
|
326
|
-
| number | no |
|
|
327
|
-
*/
|
|
328
|
-
|
|
329
|
-
bottomOffset?: number;
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* Change how ActionSheet behaves when keyboard is opened.
|
|
333
|
-
*
|
|
334
|
-
*
|
|
335
|
-
* | Type | Required |
|
|
336
|
-
| ---- | -------- |
|
|
337
|
-
| "padding" | "position" | no |
|
|
338
|
-
Default:`padding`
|
|
339
|
-
*/
|
|
340
|
-
|
|
341
|
-
keyboardMode?: "padding" | "position";
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
* Test ID for unit testing
|
|
345
|
-
*/
|
|
346
|
-
testID?: string;
|
|
347
|
-
|
|
348
|
-
/**
|
|
349
|
-
*
|
|
350
|
-
Event called when the ActionSheet closes.
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
* | Type | Required |
|
|
354
|
-
| ---- | -------- |
|
|
355
|
-
| function | no |
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
#
|
|
359
|
-
*/
|
|
360
|
-
|
|
361
|
-
onClose?: () => void;
|
|
362
|
-
|
|
363
|
-
/**
|
|
364
|
-
* An event called when the ActionSheet Opens.
|
|
365
|
-
|
|
366
|
-
| Type | Required |
|
|
367
|
-
| ---- | -------- |
|
|
368
|
-
| function | no |
|
|
369
|
-
*/
|
|
370
|
-
onOpen?: () => void;
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* Event called when position of ActionSheet changes.
|
|
374
|
-
*/
|
|
375
|
-
onPositionChanged?: (hasReachedTop: boolean) => void;
|
|
376
|
-
};
|
|
26
|
+
import {ActionSheetProps} from "./Common";
|
|
377
27
|
|
|
378
28
|
export const styles = StyleSheet.create({
|
|
379
29
|
scrollView: {
|
package/src/Avatar.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import React, {useContext, useEffect, useState} from "react";
|
|
|
5
5
|
import {Image, ImageResizeMode, Platform, Text, View} from "react-native";
|
|
6
6
|
|
|
7
7
|
import {Box} from "./Box";
|
|
8
|
-
import {AllColors, IconName, UnsignedUpTo12} from "./Common";
|
|
8
|
+
import {AllColors, AvatarProps, IconName, UnsignedUpTo12} from "./Common";
|
|
9
9
|
import {Icon} from "./Icon";
|
|
10
10
|
import {isMobileDevice} from "./MediaQuery";
|
|
11
11
|
import {ThemeContext} from "./Theme";
|
|
@@ -39,86 +39,6 @@ const statusIcons: {[id: string]: {icon: IconName; color: AllColors; label: stri
|
|
|
39
39
|
commuting: {icon: "car", color: "orange", label: "Commuting"},
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
export type AvatarStatus =
|
|
43
|
-
| "online"
|
|
44
|
-
| "offline"
|
|
45
|
-
| "doNotDisturb"
|
|
46
|
-
| "away"
|
|
47
|
-
| "meeting"
|
|
48
|
-
| "vacation"
|
|
49
|
-
| "sick"
|
|
50
|
-
| "outOfOffice"
|
|
51
|
-
| "commuting";
|
|
52
|
-
|
|
53
|
-
interface AvatarProps {
|
|
54
|
-
// Color for the background of the circle when no src picture is present.
|
|
55
|
-
backgroundColor?: AllColors;
|
|
56
|
-
// Color for the initials when no src picture is present.
|
|
57
|
-
textColor?: AllColors;
|
|
58
|
-
/**
|
|
59
|
-
* The name of the user. This is used for the placeholder treatment if an image is not available.
|
|
60
|
-
*/
|
|
61
|
-
name: string;
|
|
62
|
-
/**
|
|
63
|
-
* Override the generated initials from `name`.
|
|
64
|
-
*/
|
|
65
|
-
initials?: string;
|
|
66
|
-
/**
|
|
67
|
-
* Adds a white border around Avatar so it's visible when displayed on other images.
|
|
68
|
-
*/
|
|
69
|
-
outline?: boolean;
|
|
70
|
-
/**
|
|
71
|
-
* xs: 24px, sm: 32px, md: 48px, lg: 64px, xl: 120px.
|
|
72
|
-
*/
|
|
73
|
-
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
74
|
-
/**
|
|
75
|
-
* The URL of the user's image.
|
|
76
|
-
*/
|
|
77
|
-
src?: string;
|
|
78
|
-
/**
|
|
79
|
-
* The fit for the image within the Avatar: "cover" | "contain" | "none".
|
|
80
|
-
* Default is undefined. See Image.tsx for more info
|
|
81
|
-
*/
|
|
82
|
-
imageFit?: "cover" | "contain" | "none";
|
|
83
|
-
/**
|
|
84
|
-
* Allow user to edit the image of the avatar
|
|
85
|
-
*/
|
|
86
|
-
editAvatarImage?: boolean;
|
|
87
|
-
/**
|
|
88
|
-
* Function to handle the avatar image edit
|
|
89
|
-
*/
|
|
90
|
-
onChange?: (val: any) => void;
|
|
91
|
-
/**
|
|
92
|
-
* Resize image width. If only the width is provided, the image will preserve aspect ratio
|
|
93
|
-
*/
|
|
94
|
-
avatarImageWidth?: number;
|
|
95
|
-
/**
|
|
96
|
-
* Resize image height. If avatarImageWidth is also provided, the image aspect ratio may be distorted.
|
|
97
|
-
*/
|
|
98
|
-
avatarImageHeight?: number;
|
|
99
|
-
/**
|
|
100
|
-
* The image format that the image will be saved as after any edits by the expo-image-manipulator
|
|
101
|
-
*/
|
|
102
|
-
avatarImageFormat?: SaveFormat;
|
|
103
|
-
/**
|
|
104
|
-
* The status of the user to display with the avatar.
|
|
105
|
-
*/
|
|
106
|
-
status?: AvatarStatus;
|
|
107
|
-
/**
|
|
108
|
-
* If true, the status indicator will show a mobile icon instead of a dot, if status is one of
|
|
109
|
-
* "online", "away", "offline", or "doNotDisturb". Will show the normal status icon in other cases.
|
|
110
|
-
*/
|
|
111
|
-
statusMobile?: boolean;
|
|
112
|
-
/**
|
|
113
|
-
* Text to show when hovering over the avatar image. Only works on web.
|
|
114
|
-
*/
|
|
115
|
-
statusText?: string;
|
|
116
|
-
/**
|
|
117
|
-
* If edit icon should be present when no image is present
|
|
118
|
-
*/
|
|
119
|
-
shouldShowEditIconIfNoImage?: boolean;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
42
|
export const Avatar = (props: AvatarProps): React.ReactElement => {
|
|
123
43
|
const {theme} = useContext(ThemeContext);
|
|
124
44
|
|
|
@@ -272,8 +192,8 @@ export const Avatar = (props: AvatarProps): React.ReactElement => {
|
|
|
272
192
|
onHoverStart={() => setHovered(true)}
|
|
273
193
|
>
|
|
274
194
|
{src && isImageLoaded ? (
|
|
275
|
-
// TODO: Make our Image component rounding work so that we can use it for Avatar.
|
|
276
|
-
// unrounded box around the Image.
|
|
195
|
+
// TODO: Make our Image component rounding work so that we can use it for Avatar.
|
|
196
|
+
// Currently it creates an unrounded box around the Image.
|
|
277
197
|
<Image
|
|
278
198
|
resizeMode={imageFit as ImageResizeMode}
|
|
279
199
|
source={{uri: src, cache: "force-cache"}}
|
|
@@ -318,8 +238,8 @@ export const Avatar = (props: AvatarProps): React.ReactElement => {
|
|
|
318
238
|
}
|
|
319
239
|
|
|
320
240
|
if (status) {
|
|
321
|
-
// Need to wrap the tooltip so it doesn't expand to 100% width and render the tooltip off.
|
|
322
|
-
// tooltips on mobile because they intercept the edit avatar clicks.
|
|
241
|
+
// Need to wrap the tooltip so it doesn't expand to 100% width and render the tooltip off.
|
|
242
|
+
// Don't show the tooltips on mobile because they intercept the edit avatar clicks.
|
|
323
243
|
return (
|
|
324
244
|
<Box width={width}>
|
|
325
245
|
<Tooltip idealDirection="top" text={isMobileDevice() ? undefined : status}>
|
package/src/Badge.tsx
CHANGED
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
import React, {useContext} from "react";
|
|
2
2
|
import {Text, View} from "react-native";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {BadgeProps} from "./Common";
|
|
5
5
|
import {ThemeContext} from "./Theme";
|
|
6
6
|
|
|
7
|
-
interface BadgeProps {
|
|
8
|
-
// The text to display inside the badge.
|
|
9
|
-
title: string;
|
|
10
|
-
// Position relative to the text. Top should only be used with headings.
|
|
11
|
-
position?: "top" | "middle"; // default "middle"
|
|
12
|
-
// Some default badge types. Occasionally, a custom badge might be required for different color schemes.
|
|
13
|
-
type?: "info" | "error" | "warning" | "success" | "neutral" | "custom"; // default "info
|
|
14
|
-
// If `type` is set to "custom", a custom theme color should be provided.
|
|
15
|
-
color?: AllColors;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
7
|
export function Badge({
|
|
19
8
|
title,
|
|
20
9
|
position = "middle",
|
package/src/Banner.tsx
CHANGED
|
@@ -1,26 +1,12 @@
|
|
|
1
1
|
import React, {useEffect, useState} from "react";
|
|
2
2
|
|
|
3
3
|
import {Box} from "./Box";
|
|
4
|
-
import {
|
|
4
|
+
import {BannerProps, ButtonColor} from "./Common";
|
|
5
5
|
import {Icon} from "./Icon";
|
|
6
6
|
import {IconButton} from "./IconButton";
|
|
7
7
|
import {Text} from "./Text";
|
|
8
8
|
import {Unifier} from "./Unifier";
|
|
9
9
|
|
|
10
|
-
export interface BannerProps {
|
|
11
|
-
id: string;
|
|
12
|
-
dismissible?: boolean;
|
|
13
|
-
text: string;
|
|
14
|
-
subtext?: string;
|
|
15
|
-
iconName?: IconName;
|
|
16
|
-
color?: BoxColor;
|
|
17
|
-
textColor?: TextColor;
|
|
18
|
-
negativeXMargin?: number;
|
|
19
|
-
shape?: Rounding;
|
|
20
|
-
type?: "dismiss" | "action" | "permanent";
|
|
21
|
-
onClick?: () => void;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
10
|
function getKey(id: string): string {
|
|
25
11
|
return `@FernsUI:${id}`;
|
|
26
12
|
}
|
package/src/Body.tsx
CHANGED
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {useContext} from "react";
|
|
2
2
|
import {ActivityIndicator, KeyboardAvoidingView} from "react-native";
|
|
3
3
|
|
|
4
4
|
import {Box} from "./Box";
|
|
5
|
-
import {
|
|
5
|
+
import {BodyProps} from "./Common";
|
|
6
6
|
import {ThemeContext} from "./Theme";
|
|
7
7
|
|
|
8
|
-
export interface BodyProps {
|
|
9
|
-
scroll?: boolean;
|
|
10
|
-
loading?: boolean;
|
|
11
|
-
padding?: UnsignedUpTo12;
|
|
12
|
-
height?: number | string;
|
|
13
|
-
avoidKeyboard?: boolean; // default true
|
|
14
|
-
children?: ReactNode;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
8
|
export function Body({
|
|
18
9
|
scroll,
|
|
19
10
|
loading,
|
package/src/Box.tsx
CHANGED
|
@@ -51,8 +51,8 @@ export const Box = React.forwardRef((props: BoxProps, ref) => {
|
|
|
51
51
|
useImperativeHandle(ref, () => ({
|
|
52
52
|
scrollToEnd: () => {
|
|
53
53
|
if (scrollRef && scrollRef.current) {
|
|
54
|
-
// HACK HACK HACK...but it works. Probably need to do some onContentSizeChange or onLayout
|
|
55
|
-
// avoid this, but it works well enough.
|
|
54
|
+
// HACK HACK HACK...but it works. Probably need to do some onContentSizeChange or onLayout
|
|
55
|
+
// to avoid this, but it works well enough.
|
|
56
56
|
setTimeout(() => {
|
|
57
57
|
scrollRef && scrollRef.current && (scrollRef.current as any).scrollToEnd();
|
|
58
58
|
}, 50);
|
|
@@ -61,8 +61,8 @@ export const Box = React.forwardRef((props: BoxProps, ref) => {
|
|
|
61
61
|
|
|
62
62
|
scrollTo: (y: number) => {
|
|
63
63
|
if (scrollRef && scrollRef.current) {
|
|
64
|
-
// HACK HACK HACK...but it works. Probably need to do some onContentSizeChange or onLayout
|
|
65
|
-
// avoid this, but it works well enough.
|
|
64
|
+
// HACK HACK HACK...but it works. Probably need to do some onContentSizeChange or onLayout
|
|
65
|
+
// to avoid this, but it works well enough.
|
|
66
66
|
setTimeout(() => {
|
|
67
67
|
scrollRef && scrollRef.current && (scrollRef.current as any).scrollTo({y});
|
|
68
68
|
}, 50);
|
package/src/Button.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import React, {useContext, useState} from "react";
|
|
|
3
3
|
import {ActivityIndicator, Pressable, View} from "react-native";
|
|
4
4
|
|
|
5
5
|
import {Box} from "./Box";
|
|
6
|
-
import {
|
|
6
|
+
import {ButtonProps, Color, UnifiedTheme} from "./Common";
|
|
7
7
|
import {Icon} from "./Icon";
|
|
8
8
|
import {Modal} from "./Modal";
|
|
9
9
|
import {Text} from "./Text";
|
|
@@ -11,32 +11,6 @@ import {ThemeContext} from "./Theme";
|
|
|
11
11
|
import {Tooltip} from "./Tooltip";
|
|
12
12
|
import {Unifier} from "./Unifier";
|
|
13
13
|
|
|
14
|
-
export interface ButtonProps {
|
|
15
|
-
children?: React.ReactElement;
|
|
16
|
-
text: string;
|
|
17
|
-
// TODO make this work for all colors
|
|
18
|
-
color?: ButtonColor | Color;
|
|
19
|
-
// default gray
|
|
20
|
-
disabled?: boolean; // default false
|
|
21
|
-
inline?: boolean; // default false
|
|
22
|
-
size?: "sm" | "md" | "lg"; // default md
|
|
23
|
-
type?: "solid" | "ghost" | "outline"; // default solid
|
|
24
|
-
loading?: boolean;
|
|
25
|
-
onClick: any;
|
|
26
|
-
icon?: IconName;
|
|
27
|
-
iconPrefix?: IconPrefix;
|
|
28
|
-
iconColor?: ButtonColor | Color;
|
|
29
|
-
withConfirmation?: boolean;
|
|
30
|
-
confirmationText?: string;
|
|
31
|
-
confirmationHeading?: string;
|
|
32
|
-
shape?: "rounded" | "pill";
|
|
33
|
-
testID?: string;
|
|
34
|
-
tooltip?: {
|
|
35
|
-
text: string;
|
|
36
|
-
idealDirection?: TooltipDirection;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
14
|
const buttonTextColor: {[buttonColor: string]: "white" | "darkGray"} = {
|
|
41
15
|
blue: "white",
|
|
42
16
|
lightGray: "darkGray",
|
package/src/Card.tsx
CHANGED
|
@@ -3,21 +3,19 @@ import React from "react";
|
|
|
3
3
|
import {Box} from "./Box";
|
|
4
4
|
import {BoxProps} from "./Common";
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
);
|
|
22
|
-
}
|
|
6
|
+
export function Card({children, color = "white", padding = 4, width, ...rest}: BoxProps) {
|
|
7
|
+
return (
|
|
8
|
+
<Box
|
|
9
|
+
color={color}
|
|
10
|
+
direction="column"
|
|
11
|
+
display="flex"
|
|
12
|
+
padding={padding}
|
|
13
|
+
rounding={3}
|
|
14
|
+
shadow
|
|
15
|
+
width={width}
|
|
16
|
+
{...rest}
|
|
17
|
+
>
|
|
18
|
+
{children}
|
|
19
|
+
</Box>
|
|
20
|
+
);
|
|
23
21
|
}
|
package/src/CheckBox.tsx
CHANGED
|
@@ -17,6 +17,7 @@ export function CheckBox({
|
|
|
17
17
|
onChange,
|
|
18
18
|
onClick,
|
|
19
19
|
indeterminate,
|
|
20
|
+
testID,
|
|
20
21
|
}: CheckBoxProps): React.ReactElement {
|
|
21
22
|
if (checked && indeterminate) {
|
|
22
23
|
console.error("CheckBox cannot be checked and indeterminate at the same time");
|
|
@@ -47,6 +48,7 @@ export function CheckBox({
|
|
|
47
48
|
color={bgColor}
|
|
48
49
|
height={size === "sm" ? 16 : 24}
|
|
49
50
|
rounding={radio ? "circle" : size === "sm" ? 2 : 3}
|
|
51
|
+
testID={testID}
|
|
50
52
|
width={size === "sm" ? 16 : 24}
|
|
51
53
|
onClick={doOnClick}
|
|
52
54
|
>
|