@hero-design/rn 8.33.1 → 8.34.0
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/.turbo/turbo-build.log +1 -1
- package/assets/fonts/hero-icons-mobile.ttf +0 -0
- package/es/index.js +868 -655
- package/lib/assets/fonts/hero-icons-mobile.ttf +0 -0
- package/lib/index.js +871 -656
- package/package.json +8 -7
- package/rollup.config.js +1 -0
- package/src/components/Accordion/AccordionItem.tsx +1 -3
- package/src/components/Accordion/__tests__/AccordionItem.spec.tsx +5 -5
- package/src/components/Accordion/__tests__/__snapshots__/AccordionItem.spec.tsx.snap +26 -34
- package/src/components/Accordion/__tests__/__snapshots__/index.spec.tsx.snap +36 -48
- package/src/components/Accordion/__tests__/index.spec.tsx +2 -2
- package/src/components/Alert/__tests__/__snapshots__/index.spec.tsx.snap +26 -39
- package/src/components/Alert/__tests__/index.spec.tsx +8 -2
- package/src/components/Alert/index.tsx +2 -2
- package/src/components/Attachment/__tests__/__snapshots__/index.spec.tsx.snap +2 -3
- package/src/components/Attachment/index.tsx +3 -1
- package/src/components/Badge/StyledBadge.tsx +1 -4
- package/src/components/Badge/__tests__/Status.spec.tsx +1 -1
- package/src/components/Badge/__tests__/__snapshots__/Badge.spec.tsx.snap +18 -48
- package/src/components/Badge/__tests__/__snapshots__/Status.spec.tsx.snap +2 -3
- package/src/components/BottomNavigation/StyledBottomNavigation.tsx +1 -1
- package/src/components/BottomNavigation/__tests__/__snapshots__/index.spec.tsx.snap +4 -12
- package/src/components/BottomNavigation/index.tsx +0 -1
- package/src/components/BottomSheet/Header.tsx +1 -3
- package/src/components/BottomSheet/__tests__/__snapshots__/index.spec.tsx.snap +2 -3
- package/src/components/Button/Button.tsx +34 -11
- package/src/components/Button/StyledButton.tsx +45 -38
- package/src/components/Button/UtilityButton/StyledUtilityButton.tsx +2 -4
- package/src/components/Button/UtilityButton/__tests__/__snapshots__/index.spec.tsx.snap +8 -14
- package/src/components/Button/__tests__/StyledButton.spec.tsx +12 -6
- package/src/components/Button/__tests__/__snapshots__/Button.spec.tsx.snap +66 -90
- package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +56 -86
- package/src/components/Calendar/CalendarRowItem.tsx +5 -2
- package/src/components/Calendar/__tests__/__snapshots__/CalendarRowItem.spec.tsx.snap +10 -15
- package/src/components/Calendar/index.tsx +1 -1
- package/src/components/Card/__tests__/__snapshots__/index.spec.tsx.snap +12 -18
- package/src/components/Card/__tests__/index.spec.tsx +1 -1
- package/src/components/Carousel/CardCarousel.tsx +2 -0
- package/src/components/Carousel/CarouselItem.tsx +4 -4
- package/src/components/Carousel/StyledCarousel.tsx +1 -4
- package/src/components/Carousel/__tests__/CardCarousel.spec.tsx +18 -18
- package/src/components/Carousel/__tests__/__snapshots__/CardCarousel.spec.tsx.snap +24 -20
- package/src/components/Carousel/__tests__/__snapshots__/index.spec.tsx.snap +99 -165
- package/src/components/Checkbox/StyledCheckbox.tsx +1 -1
- package/src/components/Checkbox/__tests__/__snapshots__/index.spec.tsx.snap +8 -12
- package/src/components/Checkbox/index.tsx +1 -1
- package/src/components/ContentNavigator/StyledContentNavigator.tsx +1 -6
- package/src/components/ContentNavigator/__tests__/StyledContentNavigator.spec.tsx +1 -9
- package/src/components/ContentNavigator/__tests__/__snapshots__/StyledContentNavigator.spec.tsx.snap +0 -29
- package/src/components/ContentNavigator/__tests__/__snapshots__/index.spec.tsx.snap +124 -17
- package/src/components/ContentNavigator/__tests__/index.spec.tsx +16 -0
- package/src/components/ContentNavigator/index.tsx +30 -9
- package/src/components/DatePicker/__tests__/__snapshots__/DatePicker.spec.tsx.snap +12 -18
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +4 -6
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerCalendar.spec.tsx.snap +4 -6
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +13 -18
- package/src/components/Empty/StyledEmpty.tsx +2 -6
- package/src/components/Empty/__tests__/__snapshots__/index.spec.tsx.snap +22 -36
- package/src/components/Empty/index.tsx +4 -2
- package/src/components/Error/StyledError.tsx +2 -8
- package/src/components/Error/__tests__/__snapshots__/index.spec.tsx.snap +44 -76
- package/src/components/Error/index.tsx +6 -2
- package/src/components/FAB/ActionGroup/StyledActionGroup.tsx +1 -4
- package/src/components/FAB/ActionGroup/StyledActionItem.tsx +1 -5
- package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +54 -116
- package/src/components/FAB/ActionGroup/index.tsx +1 -1
- package/src/components/FAB/StyledFAB.tsx +1 -4
- package/src/components/FAB/__tests__/StyledFAB.spec.tsx +1 -1
- package/src/components/FAB/__tests__/__snapshots__/StyledFAB.spec.tsx.snap +2 -3
- package/src/components/FAB/__tests__/__snapshots__/index.spec.tsx.snap +4 -8
- package/src/components/Icon/HeroIcon/glyphMap.json +1 -1
- package/src/components/Icon/IconList.ts +2 -0
- package/src/components/List/BasicListItem.tsx +2 -6
- package/src/components/List/ListItem.tsx +3 -5
- package/src/components/List/__tests__/ListItem.spec.tsx +4 -4
- package/src/components/List/__tests__/StyledBasicListItem.spec.tsx +3 -1
- package/src/components/List/__tests__/StyledListItem.spec.tsx +3 -1
- package/src/components/List/__tests__/__snapshots__/BasicListItem.spec.tsx.snap +4 -10
- package/src/components/List/__tests__/__snapshots__/ListItem.spec.tsx.snap +23 -37
- package/src/components/List/__tests__/__snapshots__/StyledBasicListItem.spec.tsx.snap +8 -12
- package/src/components/List/__tests__/__snapshots__/StyledListItem.spec.tsx.snap +8 -12
- package/src/components/Modal/ModalContentWrapper.tsx +112 -0
- package/src/components/Modal/ModalPresenter/ModalPresenter.tsx +135 -0
- package/src/components/Modal/ModalPresenter/index.tsx +9 -0
- package/src/components/Modal/ModalProvider.tsx +8 -0
- package/src/components/Modal/__tests__/ModalContentWrapper.spec.tsx +25 -0
- package/src/components/Modal/__tests__/ModalPresenter.spec.tsx +57 -0
- package/src/components/Modal/__tests__/__snapshots__/ModalContentWrapper.spec.tsx.snap +35 -0
- package/src/components/Modal/__tests__/__snapshots__/ModalPresenter.spec.tsx.snap +55 -0
- package/src/components/Modal/__tests__/index.spec.tsx +50 -0
- package/src/components/Modal/index.tsx +121 -0
- package/src/components/PageControl/index.tsx +0 -1
- package/src/components/PinInput/PinCell.tsx +3 -1
- package/src/components/PinInput/StyledPinInput.tsx +2 -7
- package/src/components/PinInput/__tests__/__snapshots__/PinCell.spec.tsx.snap +25 -45
- package/src/components/PinInput/__tests__/__snapshots__/index.spec.tsx.snap +18 -34
- package/src/components/PinInput/index.tsx +2 -0
- package/src/components/Progress/ProgressCircle.tsx +1 -3
- package/src/components/Progress/__tests__/__snapshots__/index.spec.js.snap +3 -6
- package/src/components/Radio/__tests__/__snapshots__/Radio.spec.tsx.snap +2 -4
- package/src/components/Radio/__tests__/__snapshots__/RadioGroup.spec.tsx.snap +3 -6
- package/src/components/RichTextEditor/RichTextEditor.tsx +7 -11
- package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +16 -24
- package/src/components/SectionHeading/__tests__/__snapshots__/index.spec.tsx.snap +2 -3
- package/src/components/SectionHeading/__tests__/index.spec.tsx +3 -1
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/Option.spec.tsx.snap +1 -2
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +12 -24
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +86 -130
- package/src/components/Select/MultiSelect/__tests__/index.spec.tsx +6 -10
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/Option.spec.tsx.snap +1 -2
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +12 -24
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +49 -79
- package/src/components/Select/SingleSelect/__tests__/index.spec.tsx +5 -9
- package/src/components/Success/StyledSuccess.tsx +2 -6
- package/src/components/Success/__tests__/__snapshots__/index.spec.tsx.snap +40 -64
- package/src/components/Success/index.tsx +3 -1
- package/src/components/Swipeable/__tests__/SwipeableAction.spec.tsx +2 -2
- package/src/components/Swipeable/__tests__/__snapshots__/SwipeableAction.spec.tsx.snap +6 -9
- package/src/components/Swipeable/__tests__/__snapshots__/index.spec.tsx.snap +2 -3
- package/src/components/Swipeable/__tests__/index.spec.tsx +6 -4
- package/src/components/Switch/SelectorSwitch/Option.tsx +1 -1
- package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/Option.spec.tsx.snap +1 -2
- package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/index.spec.tsx.snap +1 -2
- package/src/components/Tabs/ScrollableTabsHeader.tsx +3 -3
- package/src/components/Tabs/__tests__/SceneView.spec.tsx +4 -4
- package/src/components/Tabs/__tests__/__snapshots__/SceneView.spec.tsx.snap +6 -9
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +33 -60
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabsHeader.spec.tsx.snap +7 -13
- package/src/components/Tabs/__tests__/__snapshots__/TabWithBadge.spec.tsx.snap +3 -8
- package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +45 -81
- package/src/components/Tabs/index.tsx +3 -3
- package/src/components/Tag/StyledTag.tsx +1 -4
- package/src/components/Tag/__tests__/Tag.spec.tsx +5 -1
- package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +47 -93
- package/src/components/Tag/index.tsx +5 -1
- package/src/components/TextInput/StyledTextInput.tsx +8 -16
- package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +72 -134
- package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +145 -257
- package/src/components/TextInput/index.tsx +2 -3
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +12 -23
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +21 -35
- package/src/components/Toast/Toast.tsx +6 -5
- package/src/components/Toast/ToastContainer.tsx +2 -0
- package/src/components/Toast/__tests__/Toast.spec.tsx +5 -1
- package/src/components/Toast/__tests__/__snapshots__/Toast.spec.tsx.snap +26 -39
- package/src/components/Toolbar/StyledToolbar.tsx +1 -1
- package/src/components/Toolbar/ToolbarItem.tsx +4 -6
- package/src/components/Toolbar/__tests__/__snapshots__/ToolbarGroup.spec.tsx.snap +12 -18
- package/src/components/Toolbar/__tests__/__snapshots__/ToolbarItem.spec.tsx.snap +14 -21
- package/src/index.ts +2 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +4 -0
- package/src/theme/components/badge.ts +15 -0
- package/src/theme/components/button.ts +16 -0
- package/src/theme/components/carousel.ts +15 -0
- package/src/theme/components/empty.ts +12 -0
- package/src/theme/components/error.ts +16 -0
- package/src/theme/components/fab.ts +11 -0
- package/src/theme/components/pinInput.ts +15 -0
- package/src/theme/components/success.ts +12 -0
- package/src/theme/components/tag.ts +16 -0
- package/src/theme/components/textInput.ts +1 -0
- package/src/theme/getTheme.ts +18 -18
- package/testUtils/setup.tsx +24 -0
- package/types/components/Badge/StyledBadge.d.ts +1 -1
- package/types/components/BottomNavigation/StyledBottomNavigation.d.ts +1 -1
- package/types/components/Button/StyledButton.d.ts +12 -5
- package/types/components/Button/UtilityButton/StyledUtilityButton.d.ts +1 -1
- package/types/components/Carousel/StyledCarousel.d.ts +1 -1
- package/types/components/Checkbox/StyledCheckbox.d.ts +1 -1
- package/types/components/ContentNavigator/StyledContentNavigator.d.ts +1 -5
- package/types/components/Empty/StyledEmpty.d.ts +2 -2
- package/types/components/Error/StyledError.d.ts +2 -2
- package/types/components/FAB/ActionGroup/StyledActionGroup.d.ts +2 -2
- package/types/components/FAB/ActionGroup/StyledActionItem.d.ts +1 -1
- package/types/components/FAB/StyledFAB.d.ts +1 -1
- package/types/components/Icon/IconList.d.ts +1 -1
- package/types/components/Icon/index.d.ts +1 -1
- package/types/components/Icon/utils.d.ts +1 -1
- package/types/components/Modal/ModalContentWrapper.d.ts +16 -0
- package/types/components/Modal/ModalPresenter/ModalPresenter.d.ts +34 -0
- package/types/components/Modal/ModalPresenter/index.d.ts +3 -0
- package/types/components/Modal/ModalProvider.d.ts +5 -0
- package/types/components/Modal/index.d.ts +33 -0
- package/types/components/PinInput/StyledPinInput.d.ts +2 -2
- package/types/components/RichTextEditor/RichTextEditor.d.ts +2 -2
- package/types/components/Success/StyledSuccess.d.ts +2 -2
- package/types/components/Tag/StyledTag.d.ts +1 -1
- package/types/components/TextInput/StyledTextInput.d.ts +7 -10
- package/types/components/Toolbar/StyledToolbar.d.ts +1 -1
- package/types/index.d.ts +2 -1
- package/types/theme/components/badge.d.ts +15 -0
- package/types/theme/components/button.d.ts +14 -0
- package/types/theme/components/carousel.d.ts +15 -0
- package/types/theme/components/empty.d.ts +11 -0
- package/types/theme/components/error.d.ts +15 -0
- package/types/theme/components/fab.d.ts +11 -0
- package/types/theme/components/pinInput.d.ts +15 -0
- package/types/theme/components/success.d.ts +11 -0
- package/types/theme/components/tag.d.ts +15 -0
- package/types/theme/components/textInput.d.ts +1 -0
- package/types/theme/getTheme.d.ts +18 -18
|
@@ -80,10 +80,9 @@ exports[`BasicListItem when suffix and prefix are icon name renders correctly 1`
|
|
|
80
80
|
undefined,
|
|
81
81
|
]
|
|
82
82
|
}
|
|
83
|
-
themeFontSize="large"
|
|
84
|
-
themeFontWeight="regular"
|
|
85
83
|
themeIntent="body"
|
|
86
84
|
themeTypeface="neutral"
|
|
85
|
+
themeVariant="regular"
|
|
87
86
|
>
|
|
88
87
|
List item
|
|
89
88
|
</Text>
|
|
@@ -95,16 +94,14 @@ exports[`BasicListItem when suffix and prefix are icon name renders correctly 1`
|
|
|
95
94
|
"color": "#4d6265",
|
|
96
95
|
"fontFamily": "BeVietnamPro-Regular",
|
|
97
96
|
"fontSize": 12,
|
|
98
|
-
"letterSpacing": 0.
|
|
97
|
+
"letterSpacing": 0.48,
|
|
99
98
|
"lineHeight": 16,
|
|
100
99
|
},
|
|
101
100
|
undefined,
|
|
102
101
|
]
|
|
103
102
|
}
|
|
104
|
-
themeFontSize="small"
|
|
105
103
|
themeFontWeight="regular"
|
|
106
104
|
themeIntent="subdued"
|
|
107
|
-
themeTypeface="neutral"
|
|
108
105
|
>
|
|
109
106
|
subtitle
|
|
110
107
|
</Text>
|
|
@@ -218,10 +215,9 @@ exports[`BasicListItem when suffix and prefix are react element renders correctl
|
|
|
218
215
|
undefined,
|
|
219
216
|
]
|
|
220
217
|
}
|
|
221
|
-
themeFontSize="large"
|
|
222
|
-
themeFontWeight="regular"
|
|
223
218
|
themeIntent="body"
|
|
224
219
|
themeTypeface="neutral"
|
|
220
|
+
themeVariant="regular"
|
|
225
221
|
>
|
|
226
222
|
List item
|
|
227
223
|
</Text>
|
|
@@ -233,16 +229,14 @@ exports[`BasicListItem when suffix and prefix are react element renders correctl
|
|
|
233
229
|
"color": "#4d6265",
|
|
234
230
|
"fontFamily": "BeVietnamPro-Regular",
|
|
235
231
|
"fontSize": 12,
|
|
236
|
-
"letterSpacing": 0.
|
|
232
|
+
"letterSpacing": 0.48,
|
|
237
233
|
"lineHeight": 16,
|
|
238
234
|
},
|
|
239
235
|
undefined,
|
|
240
236
|
]
|
|
241
237
|
}
|
|
242
|
-
themeFontSize="small"
|
|
243
238
|
themeFontWeight="regular"
|
|
244
239
|
themeIntent="subdued"
|
|
245
|
-
themeTypeface="neutral"
|
|
246
240
|
>
|
|
247
241
|
subtitle
|
|
248
242
|
</Text>
|
|
@@ -157,10 +157,9 @@ exports[`ListItem renders correctly ListItem with children 1`] = `
|
|
|
157
157
|
undefined,
|
|
158
158
|
]
|
|
159
159
|
}
|
|
160
|
-
themeFontSize="large"
|
|
161
|
-
themeFontWeight="regular"
|
|
162
160
|
themeIntent="body"
|
|
163
161
|
themeTypeface="neutral"
|
|
162
|
+
themeVariant="regular"
|
|
164
163
|
>
|
|
165
164
|
Menu List
|
|
166
165
|
</Text>
|
|
@@ -172,16 +171,14 @@ exports[`ListItem renders correctly ListItem with children 1`] = `
|
|
|
172
171
|
"color": "#4d6265",
|
|
173
172
|
"fontFamily": "BeVietnamPro-Regular",
|
|
174
173
|
"fontSize": 12,
|
|
175
|
-
"letterSpacing": 0.
|
|
174
|
+
"letterSpacing": 0.48,
|
|
176
175
|
"lineHeight": 16,
|
|
177
176
|
},
|
|
178
177
|
undefined,
|
|
179
178
|
]
|
|
180
179
|
}
|
|
181
|
-
themeFontSize="small"
|
|
182
180
|
themeFontWeight="regular"
|
|
183
181
|
themeIntent="subdued"
|
|
184
|
-
themeTypeface="neutral"
|
|
185
182
|
>
|
|
186
183
|
Got a common question?
|
|
187
184
|
</Text>
|
|
@@ -240,17 +237,16 @@ exports[`ListItem renders correctly ListItem with children 1`] = `
|
|
|
240
237
|
Object {
|
|
241
238
|
"color": "#001f23",
|
|
242
239
|
"fontFamily": "BeVietnamPro-Regular",
|
|
243
|
-
"fontSize":
|
|
244
|
-
"letterSpacing": 0.
|
|
245
|
-
"lineHeight":
|
|
240
|
+
"fontSize": 16,
|
|
241
|
+
"letterSpacing": 0.48,
|
|
242
|
+
"lineHeight": 24,
|
|
246
243
|
},
|
|
247
244
|
undefined,
|
|
248
245
|
]
|
|
249
246
|
}
|
|
250
|
-
themeFontSize="medium"
|
|
251
|
-
themeFontWeight="regular"
|
|
252
247
|
themeIntent="body"
|
|
253
248
|
themeTypeface="neutral"
|
|
249
|
+
themeVariant="regular"
|
|
254
250
|
>
|
|
255
251
|
Gross pay
|
|
256
252
|
</Text>
|
|
@@ -261,17 +257,16 @@ exports[`ListItem renders correctly ListItem with children 1`] = `
|
|
|
261
257
|
Object {
|
|
262
258
|
"color": "#001f23",
|
|
263
259
|
"fontFamily": "BeVietnamPro-Regular",
|
|
264
|
-
"fontSize":
|
|
265
|
-
"letterSpacing": 0.
|
|
266
|
-
"lineHeight":
|
|
260
|
+
"fontSize": 16,
|
|
261
|
+
"letterSpacing": 0.48,
|
|
262
|
+
"lineHeight": 24,
|
|
267
263
|
},
|
|
268
264
|
undefined,
|
|
269
265
|
]
|
|
270
266
|
}
|
|
271
|
-
themeFontSize="medium"
|
|
272
|
-
themeFontWeight="regular"
|
|
273
267
|
themeIntent="body"
|
|
274
268
|
themeTypeface="neutral"
|
|
269
|
+
themeVariant="regular"
|
|
275
270
|
>
|
|
276
271
|
$1052.03
|
|
277
272
|
</Text>
|
|
@@ -292,17 +287,16 @@ exports[`ListItem renders correctly ListItem with children 1`] = `
|
|
|
292
287
|
Object {
|
|
293
288
|
"color": "#001f23",
|
|
294
289
|
"fontFamily": "BeVietnamPro-Regular",
|
|
295
|
-
"fontSize":
|
|
296
|
-
"letterSpacing": 0.
|
|
297
|
-
"lineHeight":
|
|
290
|
+
"fontSize": 16,
|
|
291
|
+
"letterSpacing": 0.48,
|
|
292
|
+
"lineHeight": 24,
|
|
298
293
|
},
|
|
299
294
|
undefined,
|
|
300
295
|
]
|
|
301
296
|
}
|
|
302
|
-
themeFontSize="medium"
|
|
303
|
-
themeFontWeight="regular"
|
|
304
297
|
themeIntent="body"
|
|
305
298
|
themeTypeface="neutral"
|
|
299
|
+
themeVariant="regular"
|
|
306
300
|
>
|
|
307
301
|
Gross pay
|
|
308
302
|
</Text>
|
|
@@ -313,17 +307,16 @@ exports[`ListItem renders correctly ListItem with children 1`] = `
|
|
|
313
307
|
Object {
|
|
314
308
|
"color": "#001f23",
|
|
315
309
|
"fontFamily": "BeVietnamPro-Regular",
|
|
316
|
-
"fontSize":
|
|
317
|
-
"letterSpacing": 0.
|
|
318
|
-
"lineHeight":
|
|
310
|
+
"fontSize": 16,
|
|
311
|
+
"letterSpacing": 0.48,
|
|
312
|
+
"lineHeight": 24,
|
|
319
313
|
},
|
|
320
314
|
undefined,
|
|
321
315
|
]
|
|
322
316
|
}
|
|
323
|
-
themeFontSize="medium"
|
|
324
|
-
themeFontWeight="regular"
|
|
325
317
|
themeIntent="body"
|
|
326
318
|
themeTypeface="neutral"
|
|
319
|
+
themeVariant="regular"
|
|
327
320
|
>
|
|
328
321
|
$1052.03
|
|
329
322
|
</Text>
|
|
@@ -405,10 +398,9 @@ exports[`ListItem renders correctly ListItem with icon 1`] = `
|
|
|
405
398
|
undefined,
|
|
406
399
|
]
|
|
407
400
|
}
|
|
408
|
-
themeFontSize="large"
|
|
409
|
-
themeFontWeight="regular"
|
|
410
401
|
themeIntent="body"
|
|
411
402
|
themeTypeface="neutral"
|
|
403
|
+
themeVariant="regular"
|
|
412
404
|
>
|
|
413
405
|
List item
|
|
414
406
|
</Text>
|
|
@@ -420,16 +412,14 @@ exports[`ListItem renders correctly ListItem with icon 1`] = `
|
|
|
420
412
|
"color": "#4d6265",
|
|
421
413
|
"fontFamily": "BeVietnamPro-Regular",
|
|
422
414
|
"fontSize": 12,
|
|
423
|
-
"letterSpacing": 0.
|
|
415
|
+
"letterSpacing": 0.48,
|
|
424
416
|
"lineHeight": 16,
|
|
425
417
|
},
|
|
426
418
|
undefined,
|
|
427
419
|
]
|
|
428
420
|
}
|
|
429
|
-
themeFontSize="small"
|
|
430
421
|
themeFontWeight="regular"
|
|
431
422
|
themeIntent="subdued"
|
|
432
|
-
themeTypeface="neutral"
|
|
433
423
|
>
|
|
434
424
|
subtitle
|
|
435
425
|
</Text>
|
|
@@ -550,10 +540,9 @@ exports[`ListItem renders correctly ListItem with leading status 1`] = `
|
|
|
550
540
|
undefined,
|
|
551
541
|
]
|
|
552
542
|
}
|
|
553
|
-
themeFontSize="large"
|
|
554
|
-
themeFontWeight="regular"
|
|
555
543
|
themeIntent="body"
|
|
556
544
|
themeTypeface="neutral"
|
|
545
|
+
themeVariant="regular"
|
|
557
546
|
>
|
|
558
547
|
03:00 PM - 9:00 PM
|
|
559
548
|
</Text>
|
|
@@ -746,10 +735,9 @@ exports[`ListItem renders correctly ListItem with prefix suffix is React.Element
|
|
|
746
735
|
undefined,
|
|
747
736
|
]
|
|
748
737
|
}
|
|
749
|
-
themeFontSize="large"
|
|
750
|
-
themeFontWeight="regular"
|
|
751
738
|
themeIntent="body"
|
|
752
739
|
themeTypeface="neutral"
|
|
740
|
+
themeVariant="regular"
|
|
753
741
|
>
|
|
754
742
|
List item
|
|
755
743
|
</Text>
|
|
@@ -761,16 +749,14 @@ exports[`ListItem renders correctly ListItem with prefix suffix is React.Element
|
|
|
761
749
|
"color": "#4d6265",
|
|
762
750
|
"fontFamily": "BeVietnamPro-Regular",
|
|
763
751
|
"fontSize": 12,
|
|
764
|
-
"letterSpacing": 0.
|
|
752
|
+
"letterSpacing": 0.48,
|
|
765
753
|
"lineHeight": 16,
|
|
766
754
|
},
|
|
767
755
|
undefined,
|
|
768
756
|
]
|
|
769
757
|
}
|
|
770
|
-
themeFontSize="small"
|
|
771
758
|
themeFontWeight="regular"
|
|
772
759
|
themeIntent="subdued"
|
|
773
|
-
themeTypeface="neutral"
|
|
774
760
|
>
|
|
775
761
|
subtitle
|
|
776
762
|
</Text>
|
|
@@ -33,16 +33,15 @@ exports[`StyledListItemContainer renders correctly themeSelected false themeDisa
|
|
|
33
33
|
"color": "#001f23",
|
|
34
34
|
"fontFamily": "BeVietnamPro-Regular",
|
|
35
35
|
"fontSize": 14,
|
|
36
|
-
"letterSpacing": 0.
|
|
36
|
+
"letterSpacing": 0.48,
|
|
37
37
|
"lineHeight": 22,
|
|
38
38
|
},
|
|
39
39
|
undefined,
|
|
40
40
|
]
|
|
41
41
|
}
|
|
42
|
-
themeFontSize="medium"
|
|
43
|
-
themeFontWeight="regular"
|
|
44
42
|
themeIntent="body"
|
|
45
43
|
themeTypeface="neutral"
|
|
44
|
+
themeVariant="small"
|
|
46
45
|
>
|
|
47
46
|
StyledListItemContainer
|
|
48
47
|
</Text>
|
|
@@ -82,16 +81,15 @@ exports[`StyledListItemContainer renders correctly themeSelected false themeDisa
|
|
|
82
81
|
"color": "#001f23",
|
|
83
82
|
"fontFamily": "BeVietnamPro-Regular",
|
|
84
83
|
"fontSize": 14,
|
|
85
|
-
"letterSpacing": 0.
|
|
84
|
+
"letterSpacing": 0.48,
|
|
86
85
|
"lineHeight": 22,
|
|
87
86
|
},
|
|
88
87
|
undefined,
|
|
89
88
|
]
|
|
90
89
|
}
|
|
91
|
-
themeFontSize="medium"
|
|
92
|
-
themeFontWeight="regular"
|
|
93
90
|
themeIntent="body"
|
|
94
91
|
themeTypeface="neutral"
|
|
92
|
+
themeVariant="small"
|
|
95
93
|
>
|
|
96
94
|
StyledListItemContainer
|
|
97
95
|
</Text>
|
|
@@ -131,16 +129,15 @@ exports[`StyledListItemContainer renders correctly themeSelected true themeDisab
|
|
|
131
129
|
"color": "#001f23",
|
|
132
130
|
"fontFamily": "BeVietnamPro-Regular",
|
|
133
131
|
"fontSize": 14,
|
|
134
|
-
"letterSpacing": 0.
|
|
132
|
+
"letterSpacing": 0.48,
|
|
135
133
|
"lineHeight": 22,
|
|
136
134
|
},
|
|
137
135
|
undefined,
|
|
138
136
|
]
|
|
139
137
|
}
|
|
140
|
-
themeFontSize="medium"
|
|
141
|
-
themeFontWeight="regular"
|
|
142
138
|
themeIntent="body"
|
|
143
139
|
themeTypeface="neutral"
|
|
140
|
+
themeVariant="small"
|
|
144
141
|
>
|
|
145
142
|
StyledListItemContainer
|
|
146
143
|
</Text>
|
|
@@ -180,16 +177,15 @@ exports[`StyledListItemContainer renders correctly themeSelected true themeDisab
|
|
|
180
177
|
"color": "#001f23",
|
|
181
178
|
"fontFamily": "BeVietnamPro-Regular",
|
|
182
179
|
"fontSize": 14,
|
|
183
|
-
"letterSpacing": 0.
|
|
180
|
+
"letterSpacing": 0.48,
|
|
184
181
|
"lineHeight": 22,
|
|
185
182
|
},
|
|
186
183
|
undefined,
|
|
187
184
|
]
|
|
188
185
|
}
|
|
189
|
-
themeFontSize="medium"
|
|
190
|
-
themeFontWeight="regular"
|
|
191
186
|
themeIntent="body"
|
|
192
187
|
themeTypeface="neutral"
|
|
188
|
+
themeVariant="small"
|
|
193
189
|
>
|
|
194
190
|
StyledListItemContainer
|
|
195
191
|
</Text>
|
|
@@ -125,16 +125,15 @@ exports[`ListItemContainer renders correctly themeSelected false themeVariant ca
|
|
|
125
125
|
"color": "#001f23",
|
|
126
126
|
"fontFamily": "BeVietnamPro-Regular",
|
|
127
127
|
"fontSize": 14,
|
|
128
|
-
"letterSpacing": 0.
|
|
128
|
+
"letterSpacing": 0.48,
|
|
129
129
|
"lineHeight": 22,
|
|
130
130
|
},
|
|
131
131
|
undefined,
|
|
132
132
|
]
|
|
133
133
|
}
|
|
134
|
-
themeFontSize="medium"
|
|
135
|
-
themeFontWeight="regular"
|
|
136
134
|
themeIntent="body"
|
|
137
135
|
themeTypeface="neutral"
|
|
136
|
+
themeVariant="small"
|
|
138
137
|
>
|
|
139
138
|
StyledListItemContainer
|
|
140
139
|
</Text>
|
|
@@ -171,16 +170,15 @@ exports[`ListItemContainer renders correctly themeSelected false themeVariant fu
|
|
|
171
170
|
"color": "#001f23",
|
|
172
171
|
"fontFamily": "BeVietnamPro-Regular",
|
|
173
172
|
"fontSize": 14,
|
|
174
|
-
"letterSpacing": 0.
|
|
173
|
+
"letterSpacing": 0.48,
|
|
175
174
|
"lineHeight": 22,
|
|
176
175
|
},
|
|
177
176
|
undefined,
|
|
178
177
|
]
|
|
179
178
|
}
|
|
180
|
-
themeFontSize="medium"
|
|
181
|
-
themeFontWeight="regular"
|
|
182
179
|
themeIntent="body"
|
|
183
180
|
themeTypeface="neutral"
|
|
181
|
+
themeVariant="small"
|
|
184
182
|
>
|
|
185
183
|
StyledListItemContainer
|
|
186
184
|
</Text>
|
|
@@ -227,16 +225,15 @@ exports[`ListItemContainer renders correctly themeSelected true themeVariant car
|
|
|
227
225
|
"color": "#001f23",
|
|
228
226
|
"fontFamily": "BeVietnamPro-Regular",
|
|
229
227
|
"fontSize": 14,
|
|
230
|
-
"letterSpacing": 0.
|
|
228
|
+
"letterSpacing": 0.48,
|
|
231
229
|
"lineHeight": 22,
|
|
232
230
|
},
|
|
233
231
|
undefined,
|
|
234
232
|
]
|
|
235
233
|
}
|
|
236
|
-
themeFontSize="medium"
|
|
237
|
-
themeFontWeight="regular"
|
|
238
234
|
themeIntent="body"
|
|
239
235
|
themeTypeface="neutral"
|
|
236
|
+
themeVariant="small"
|
|
240
237
|
>
|
|
241
238
|
StyledListItemContainer
|
|
242
239
|
</Text>
|
|
@@ -273,16 +270,15 @@ exports[`ListItemContainer renders correctly themeSelected true themeVariant ful
|
|
|
273
270
|
"color": "#001f23",
|
|
274
271
|
"fontFamily": "BeVietnamPro-Regular",
|
|
275
272
|
"fontSize": 14,
|
|
276
|
-
"letterSpacing": 0.
|
|
273
|
+
"letterSpacing": 0.48,
|
|
277
274
|
"lineHeight": 22,
|
|
278
275
|
},
|
|
279
276
|
undefined,
|
|
280
277
|
]
|
|
281
278
|
}
|
|
282
|
-
themeFontSize="medium"
|
|
283
|
-
themeFontWeight="regular"
|
|
284
279
|
themeIntent="body"
|
|
285
280
|
themeTypeface="neutral"
|
|
281
|
+
themeVariant="small"
|
|
286
282
|
>
|
|
287
283
|
StyledListItemContainer
|
|
288
284
|
</Text>
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Animated,
|
|
4
|
+
Dimensions,
|
|
5
|
+
Easing,
|
|
6
|
+
Platform,
|
|
7
|
+
StyleProp,
|
|
8
|
+
ViewStyle,
|
|
9
|
+
} from 'react-native';
|
|
10
|
+
|
|
11
|
+
type ModalContentWrapperProps = {
|
|
12
|
+
children: React.ReactElement;
|
|
13
|
+
visible?: boolean;
|
|
14
|
+
onShow?: () => void;
|
|
15
|
+
testID?: string;
|
|
16
|
+
animationType?: 'none' | 'slide' | 'fade';
|
|
17
|
+
style?: StyleProp<ViewStyle>;
|
|
18
|
+
animated?: boolean;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type ModalContentWrapperHandler = {
|
|
22
|
+
hide: (callback?: () => void) => void;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const windowHeight = Dimensions.get('window').height;
|
|
26
|
+
const defaultAnimationConfig = {
|
|
27
|
+
easing: Easing.inOut(Easing.cubic),
|
|
28
|
+
duration: 400,
|
|
29
|
+
useNativeDriver: Platform.OS !== 'web',
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const ModalContentWrapper = forwardRef<
|
|
33
|
+
ModalContentWrapperHandler,
|
|
34
|
+
ModalContentWrapperProps
|
|
35
|
+
>(
|
|
36
|
+
(
|
|
37
|
+
{
|
|
38
|
+
animationType,
|
|
39
|
+
children,
|
|
40
|
+
testID,
|
|
41
|
+
onShow,
|
|
42
|
+
style,
|
|
43
|
+
visible,
|
|
44
|
+
animated = true,
|
|
45
|
+
},
|
|
46
|
+
ref
|
|
47
|
+
) => {
|
|
48
|
+
const animatedValue = React.useRef(new Animated.Value(0)).current;
|
|
49
|
+
|
|
50
|
+
const modalAnimation = animatedValue.interpolate(
|
|
51
|
+
animationType === 'fade'
|
|
52
|
+
? {
|
|
53
|
+
inputRange: [0, 1],
|
|
54
|
+
outputRange: [0, 1],
|
|
55
|
+
}
|
|
56
|
+
: {
|
|
57
|
+
inputRange: [0, 1],
|
|
58
|
+
outputRange: [windowHeight, 0],
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
React.useImperativeHandle(
|
|
63
|
+
ref,
|
|
64
|
+
() => ({
|
|
65
|
+
hide: (callback) => {
|
|
66
|
+
Animated.timing(animatedValue, {
|
|
67
|
+
toValue: 0,
|
|
68
|
+
...defaultAnimationConfig,
|
|
69
|
+
}).start(callback);
|
|
70
|
+
},
|
|
71
|
+
}),
|
|
72
|
+
[animatedValue]
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
React.useEffect(() => {
|
|
76
|
+
// Hiding animation will be called from the modal component
|
|
77
|
+
if (visible) {
|
|
78
|
+
Animated.timing(animatedValue, {
|
|
79
|
+
toValue: 1,
|
|
80
|
+
...defaultAnimationConfig,
|
|
81
|
+
// Prevent animation when updating the modal content
|
|
82
|
+
duration: animated ? defaultAnimationConfig.duration : 0,
|
|
83
|
+
}).start(() => {
|
|
84
|
+
onShow?.();
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}, [visible, animatedValue, onShow, animated]);
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<Animated.View
|
|
91
|
+
testID={testID}
|
|
92
|
+
style={[
|
|
93
|
+
style,
|
|
94
|
+
{
|
|
95
|
+
...(animationType === 'fade' ? { opacity: modalAnimation } : {}),
|
|
96
|
+
...(animationType === 'slide'
|
|
97
|
+
? {
|
|
98
|
+
transform: [{ translateY: modalAnimation }],
|
|
99
|
+
}
|
|
100
|
+
: {}),
|
|
101
|
+
},
|
|
102
|
+
]}
|
|
103
|
+
>
|
|
104
|
+
{children}
|
|
105
|
+
</Animated.View>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
ModalContentWrapper.displayName = 'ModalContentWrapper';
|
|
111
|
+
|
|
112
|
+
export default ModalContentWrapper;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import React, { forwardRef, useRef } from 'react';
|
|
2
|
+
import { Animated, StyleSheet, ViewProps } from 'react-native';
|
|
3
|
+
import RootSiblings from 'react-native-root-siblings';
|
|
4
|
+
import { useTheme } from '../../../theme';
|
|
5
|
+
import Box from '../../Box';
|
|
6
|
+
|
|
7
|
+
export type ModalPresenterHandles = {
|
|
8
|
+
animatedOut: (completion?: () => void) => void;
|
|
9
|
+
};
|
|
10
|
+
export type ModalDismissFunc = (onDismiss?: () => void) => void;
|
|
11
|
+
export type ModalUpdateFunc = (content: React.ReactNode) => void;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Modal handler is returned by `showModal` function.
|
|
15
|
+
*/
|
|
16
|
+
export type ModalHandler = {
|
|
17
|
+
/**
|
|
18
|
+
* Same `dismiss` function as in `ModalContentProps`.
|
|
19
|
+
*/
|
|
20
|
+
dismiss: ModalDismissFunc;
|
|
21
|
+
/**
|
|
22
|
+
* Same `update` function as in `ModalContentProps`.
|
|
23
|
+
*/
|
|
24
|
+
update: ModalUpdateFunc;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const ModalPresenter = forwardRef<ModalPresenterHandles, ViewProps>(
|
|
28
|
+
({ style, children, ...props }, ref) => {
|
|
29
|
+
const animatedOpacity = useRef(new Animated.Value(0));
|
|
30
|
+
const theme = useTheme();
|
|
31
|
+
|
|
32
|
+
React.useEffect(() => {
|
|
33
|
+
Animated.spring(animatedOpacity.current, {
|
|
34
|
+
toValue: 1,
|
|
35
|
+
useNativeDriver: true,
|
|
36
|
+
}).start();
|
|
37
|
+
}, []);
|
|
38
|
+
|
|
39
|
+
React.useImperativeHandle(ref, () => ({
|
|
40
|
+
animatedOut: (completion?: () => void) => {
|
|
41
|
+
Animated.spring(animatedOpacity.current, {
|
|
42
|
+
toValue: 0,
|
|
43
|
+
useNativeDriver: true,
|
|
44
|
+
}).start(() => {
|
|
45
|
+
completion?.();
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
}));
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<Box style={StyleSheet.absoluteFill}>
|
|
52
|
+
<Animated.View
|
|
53
|
+
style={[
|
|
54
|
+
{
|
|
55
|
+
width: '100%',
|
|
56
|
+
height: '100%',
|
|
57
|
+
backgroundColor: `${theme.colors.overlayGlobalSurface}66`, // 66 = 40% opacity as suggested by the mobile color guidelines
|
|
58
|
+
justifyContent: 'center',
|
|
59
|
+
alignItems: 'center',
|
|
60
|
+
opacity: animatedOpacity.current,
|
|
61
|
+
},
|
|
62
|
+
style,
|
|
63
|
+
]}
|
|
64
|
+
{...props}
|
|
65
|
+
>
|
|
66
|
+
{children}
|
|
67
|
+
</Animated.View>
|
|
68
|
+
</Box>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Present a modal on screen immediately.
|
|
75
|
+
*
|
|
76
|
+
* The new presented modal will be on top of existing modals if there are any.
|
|
77
|
+
*
|
|
78
|
+
* @param Content A component to be presented as a modal on screen.
|
|
79
|
+
* This component will be centered horizontally and vertically on screen with
|
|
80
|
+
* a semitransparent black overlay underneath.
|
|
81
|
+
* @param contentProps Props for this modal component.
|
|
82
|
+
* @returns A `ModalHandler` you can use to dismiss the modal.
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
export const showModal = (content: React.ReactNode): ModalHandler => {
|
|
86
|
+
let ref: ModalPresenterHandles | null = null;
|
|
87
|
+
let rootSiblings: RootSiblings | null = null;
|
|
88
|
+
|
|
89
|
+
const dismiss: ModalDismissFunc = (onDismiss) => {
|
|
90
|
+
if (rootSiblings) {
|
|
91
|
+
const cleanup = () => {
|
|
92
|
+
rootSiblings?.destroy();
|
|
93
|
+
rootSiblings = null;
|
|
94
|
+
ref = null;
|
|
95
|
+
onDismiss?.();
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
if (ref) {
|
|
99
|
+
ref.animatedOut(cleanup);
|
|
100
|
+
} else {
|
|
101
|
+
cleanup();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const update: ModalUpdateFunc = (newContent) => {
|
|
107
|
+
rootSiblings?.update(
|
|
108
|
+
<ModalPresenter
|
|
109
|
+
ref={(_ref) => {
|
|
110
|
+
ref = _ref;
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
{newContent}
|
|
114
|
+
</ModalPresenter>
|
|
115
|
+
);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
rootSiblings = new RootSiblings(
|
|
119
|
+
(
|
|
120
|
+
<ModalPresenter
|
|
121
|
+
ref={(_ref) => {
|
|
122
|
+
ref = _ref;
|
|
123
|
+
}}
|
|
124
|
+
>
|
|
125
|
+
{content}
|
|
126
|
+
</ModalPresenter>
|
|
127
|
+
)
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
return { dismiss, update };
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
ModalPresenter.displayName = 'ModalPresenter';
|
|
134
|
+
|
|
135
|
+
export default ModalPresenter;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { RootSiblingParent } from 'react-native-root-siblings';
|
|
3
|
+
|
|
4
|
+
const ModalProvider = ({ children }: { children: ReactNode }) => {
|
|
5
|
+
return <RootSiblingParent>{children}</RootSiblingParent>;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export default ModalProvider;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
3
|
+
import ModalContentWrapper from '../ModalContentWrapper';
|
|
4
|
+
import Typography from '../../Typography';
|
|
5
|
+
|
|
6
|
+
describe('ModalContentWrapper', () => {
|
|
7
|
+
it('should render correctly', () => {
|
|
8
|
+
const wrapper = renderWithTheme(
|
|
9
|
+
<ModalContentWrapper
|
|
10
|
+
testID="modal-content-wrapper"
|
|
11
|
+
style={{ backgroundColor: 'blue' }}
|
|
12
|
+
visible
|
|
13
|
+
>
|
|
14
|
+
<Typography.Text>Modal content</Typography.Text>
|
|
15
|
+
</ModalContentWrapper>
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
19
|
+
expect(wrapper.getByText('Modal content')).toBeTruthy();
|
|
20
|
+
expect(wrapper.getByTestId('modal-content-wrapper')).toBeTruthy();
|
|
21
|
+
expect(wrapper.getByTestId('modal-content-wrapper')).toHaveStyle({
|
|
22
|
+
backgroundColor: 'blue',
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
});
|