@hero-design/rn 8.40.3 → 8.41.1

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 (39) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/assets/fonts/hero-icons-mobile.ttf +0 -0
  3. package/es/index.js +613 -709
  4. package/lib/assets/fonts/hero-icons-mobile.ttf +0 -0
  5. package/lib/index.js +615 -713
  6. package/package.json +7 -8
  7. package/rollup.config.js +0 -1
  8. package/src/components/Error/StyledError.tsx +2 -1
  9. package/src/components/Error/__tests__/__snapshots__/index.spec.tsx.snap +115 -97
  10. package/src/components/Error/__tests__/index.spec.tsx +9 -6
  11. package/src/components/Icon/HeroIcon/glyphMap.json +1 -1
  12. package/src/components/Icon/IconList.ts +1 -0
  13. package/src/components/Modal/__tests__/__snapshots__/index.spec.tsx.snap +117 -0
  14. package/src/components/Modal/__tests__/index.spec.tsx +99 -0
  15. package/src/components/Modal/index.tsx +178 -82
  16. package/src/components/Portal/__tests__/__snapshots__/index.spec.tsx.snap +29 -0
  17. package/src/components/Portal/__tests__/index.spec.tsx +19 -0
  18. package/src/components/Portal/index.tsx +18 -5
  19. package/src/components/Success/StyledSuccess.tsx +2 -1
  20. package/src/components/Success/__tests__/__snapshots__/index.spec.tsx.snap +115 -95
  21. package/src/components/Success/__tests__/index.spec.tsx +9 -6
  22. package/src/index.ts +0 -2
  23. package/testUtils/setup.tsx +0 -18
  24. package/types/components/Error/StyledError.d.ts +3 -5
  25. package/types/components/Icon/IconList.d.ts +1 -1
  26. package/types/components/Icon/index.d.ts +1 -1
  27. package/types/components/Icon/utils.d.ts +1 -1
  28. package/types/components/Modal/index.d.ts +12 -8
  29. package/types/components/Portal/index.d.ts +10 -5
  30. package/types/components/Success/StyledSuccess.d.ts +3 -5
  31. package/types/index.d.ts +1 -2
  32. package/src/components/Modal/ModalContentWrapper.tsx +0 -112
  33. package/src/components/Modal/ModalPresenter/ModalPresenter.tsx +0 -135
  34. package/src/components/Modal/ModalPresenter/index.tsx +0 -9
  35. package/src/components/Modal/ModalProvider.tsx +0 -8
  36. package/types/components/Modal/ModalContentWrapper.d.ts +0 -16
  37. package/types/components/Modal/ModalPresenter/ModalPresenter.d.ts +0 -34
  38. package/types/components/Modal/ModalPresenter/index.d.ts +0 -3
  39. package/types/components/Modal/ModalProvider.d.ts +0 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.40.3",
3
+ "version": "8.41.1",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -21,14 +21,14 @@
21
21
  "dependencies": {
22
22
  "@emotion/native": "^11.9.3",
23
23
  "@emotion/react": "^11.9.3",
24
- "@hero-design/colors": "8.40.3",
24
+ "@hero-design/colors": "8.41.1",
25
25
  "date-fns": "^2.16.1",
26
26
  "events": "^3.2.0",
27
27
  "hero-editor": "^1.9.21",
28
28
  "nanoid": "^4.0.2"
29
29
  },
30
30
  "peerDependencies": {
31
- "@hero-design/react-native-month-year-picker": "^8.40.3",
31
+ "@hero-design/react-native-month-year-picker": "^8.41.1",
32
32
  "@react-native-community/datetimepicker": "^3.5.2",
33
33
  "@react-native-community/slider": "4.1.12",
34
34
  "react": "18.0.0",
@@ -36,7 +36,6 @@
36
36
  "react-native-gesture-handler": "^1.10.3 | ~2.5.0",
37
37
  "react-native-linear-gradient": "^2.6.2",
38
38
  "react-native-pager-view": "^5.4.25",
39
- "react-native-root-siblings": "^4.1.1",
40
39
  "react-native-safe-area-context": "^3.0.2",
41
40
  "react-native-vector-icons": "^9.1.0",
42
41
  "react-native-webview": "^11.2.5"
@@ -48,8 +47,8 @@
48
47
  "@babel/preset-typescript": "^7.17.12",
49
48
  "@babel/runtime": "^7.18.9",
50
49
  "@emotion/jest": "^11.11.0",
51
- "@hero-design/eslint-plugin": "8.40.3",
52
- "@hero-design/react-native-month-year-picker": "^8.40.3",
50
+ "@hero-design/eslint-plugin": "8.41.1",
51
+ "@hero-design/react-native-month-year-picker": "^8.41.1",
53
52
  "@react-native-community/datetimepicker": "^3.5.2",
54
53
  "@react-native-community/slider": "4.1.12",
55
54
  "@rollup/plugin-babel": "^5.3.1",
@@ -65,12 +64,12 @@
65
64
  "@types/react-native": "^0.67.7",
66
65
  "@types/react-native-vector-icons": "^6.4.10",
67
66
  "babel-plugin-inline-import": "^3.0.0",
68
- "eslint-config-hd": "8.40.3",
67
+ "eslint-config-hd": "8.41.1",
69
68
  "eslint-plugin-import": "^2.27.5",
70
69
  "jest": "^29.6.2",
71
70
  "jest-environment-jsdom": "^29.6.2",
72
71
  "jest-junit": "^16.0.0",
73
- "prettier-config-hd": "8.40.3",
72
+ "prettier-config-hd": "8.41.1",
74
73
  "react": "18.0.0",
75
74
  "react-native": "0.69.7",
76
75
  "react-native-gesture-handler": "~2.5.0",
package/rollup.config.js CHANGED
@@ -35,7 +35,6 @@ export default {
35
35
  'react-native-vector-icons',
36
36
  'react-native-linear-gradient',
37
37
  '@hero-design/react-native-month-year-picker',
38
- 'react-native-root-siblings',
39
38
  ],
40
39
  plugins: [
41
40
  replace({
@@ -1,8 +1,9 @@
1
1
  import styled from '@emotion/native';
2
- import { Modal, View } from 'react-native';
2
+ import { View } from 'react-native';
3
3
  import Image from '../Image';
4
4
  import Typography from '../Typography';
5
5
  import Button from '../Button';
6
+ import Modal from '../Modal';
6
7
 
7
8
  type ErrorVariant = 'full-screen' | 'in-page';
8
9
 
@@ -245,146 +245,164 @@ exports[`Error renders error screen with image correctly 1`] = `
245
245
  `;
246
246
 
247
247
  exports[`Error renders full screen error page correctly 1`] = `
248
- <Modal
249
- animationType="slide"
250
- hardwareAccelerated={false}
251
- onDismiss={[Function]}
252
- onRequestClose={[Function]}
253
- style={
254
- [
248
+ [
249
+ <View
250
+ collapsable={false}
251
+ style={
255
252
  {
256
- "height": "100%",
257
- "width": "100%",
258
- },
259
- undefined,
260
- ]
261
- }
262
- visible={true}
263
- >
253
+ "backgroundColor": "#000000",
254
+ "bottom": 0,
255
+ "left": 0,
256
+ "opacity": 0,
257
+ "position": "absolute",
258
+ "right": 0,
259
+ "top": 0,
260
+ }
261
+ }
262
+ />,
264
263
  <View
264
+ collapsable={false}
265
265
  style={
266
- [
267
- {
268
- "backgroundColor": "#ccd2d3",
269
- "display": "flex",
270
- "flex": 1,
271
- "flexDirection": "column",
272
- },
273
- undefined,
274
- ]
266
+ {
267
+ "bottom": 0,
268
+ "left": 0,
269
+ "opacity": 1,
270
+ "position": "absolute",
271
+ "right": 0,
272
+ "top": 0,
273
+ "transform": [
274
+ {
275
+ "translateY": 1334,
276
+ },
277
+ ],
278
+ }
275
279
  }
276
- themeVariant="full-screen"
277
280
  >
278
281
  <View
279
282
  style={
280
283
  [
281
284
  {
282
- "alignItems": "center",
285
+ "backgroundColor": "#ccd2d3",
283
286
  "display": "flex",
284
287
  "flex": 1,
285
288
  "flexDirection": "column",
286
- "justifyContent": "center",
287
- "padding": 24,
288
289
  },
289
290
  undefined,
290
291
  ]
291
292
  }
293
+ themeVariant="full-screen"
292
294
  >
293
295
  <View
294
296
  style={
295
297
  [
296
298
  {
297
- "height": 176,
298
- "marginBottom": 24,
299
- "width": 176,
299
+ "alignItems": "center",
300
+ "display": "flex",
301
+ "flex": 1,
302
+ "flexDirection": "column",
303
+ "justifyContent": "center",
304
+ "padding": 24,
300
305
  },
301
306
  undefined,
302
307
  ]
303
308
  }
304
309
  >
305
- <Image
306
- source={
307
- {
308
- "uri": "path_to_image",
309
- }
310
+ <View
311
+ style={
312
+ [
313
+ {
314
+ "height": 176,
315
+ "marginBottom": 24,
316
+ "width": 176,
317
+ },
318
+ undefined,
319
+ ]
310
320
  }
321
+ >
322
+ <Image
323
+ source={
324
+ {
325
+ "uri": "path_to_image",
326
+ }
327
+ }
328
+ style={
329
+ [
330
+ {
331
+ "borderRadius": 0,
332
+ "height": 72,
333
+ "width": 72,
334
+ },
335
+ [
336
+ {
337
+ "height": 176,
338
+ "marginBottom": 24,
339
+ "resizeMode": "contain",
340
+ "width": 176,
341
+ },
342
+ undefined,
343
+ ],
344
+ ]
345
+ }
346
+ testID="error-image"
347
+ />
348
+ </View>
349
+ <Text
350
+ allowFontScaling={false}
311
351
  style={
312
352
  [
313
353
  {
314
- "borderRadius": 0,
315
- "height": 72,
316
- "width": 72,
354
+ "color": "#001f23",
355
+ "fontFamily": "RebondGrotesque-SemiBold",
356
+ "fontSize": 24,
357
+ "letterSpacing": 0.24,
358
+ "lineHeight": 32,
317
359
  },
318
360
  [
319
361
  {
320
- "height": 176,
321
- "marginBottom": 24,
322
- "resizeMode": "contain",
323
- "width": 176,
362
+ "color": "#001f23",
363
+ "marginBottom": 8,
364
+ "textAlign": "center",
324
365
  },
325
366
  undefined,
326
367
  ],
327
368
  ]
328
369
  }
329
- testID="error-image"
330
- />
331
- </View>
332
- <Text
333
- allowFontScaling={false}
334
- style={
335
- [
336
- {
337
- "color": "#001f23",
338
- "fontFamily": "RebondGrotesque-SemiBold",
339
- "fontSize": 24,
340
- "letterSpacing": 0.24,
341
- "lineHeight": 32,
342
- },
370
+ themeIntent="body"
371
+ themeLevel="h4"
372
+ themeTypeface="playful"
373
+ >
374
+ We’re sorry, something went wrong
375
+ </Text>
376
+ <Text
377
+ allowFontScaling={false}
378
+ style={
343
379
  [
344
380
  {
345
381
  "color": "#001f23",
346
- "marginBottom": 8,
347
- "textAlign": "center",
382
+ "fontFamily": "BeVietnamPro-Regular",
383
+ "fontSize": 18,
384
+ "letterSpacing": 0.54,
385
+ "lineHeight": 26,
348
386
  },
349
- undefined,
350
- ],
351
- ]
352
- }
353
- themeIntent="body"
354
- themeLevel="h4"
355
- themeTypeface="playful"
356
- >
357
- We’re sorry, something went wrong
358
- </Text>
359
- <Text
360
- allowFontScaling={false}
361
- style={
362
- [
363
- {
364
- "color": "#001f23",
365
- "fontFamily": "BeVietnamPro-Regular",
366
- "fontSize": 18,
367
- "letterSpacing": 0.54,
368
- "lineHeight": 26,
369
- },
370
- [
371
- {
372
- "color": "#4d6265",
373
- "textAlign": "center",
374
- },
375
- undefined,
376
- ],
377
- ]
378
- }
379
- themeIntent="body"
380
- themeTypeface="playful"
381
- themeVariant="regular"
382
- >
383
- Please try again later
384
- </Text>
387
+ [
388
+ {
389
+ "color": "#4d6265",
390
+ "textAlign": "center",
391
+ },
392
+ undefined,
393
+ ],
394
+ ]
395
+ }
396
+ themeIntent="body"
397
+ themeTypeface="playful"
398
+ themeVariant="regular"
399
+ >
400
+ Please try again later
401
+ </Text>
402
+ </View>
385
403
  </View>
386
- </View>
387
- </Modal>
404
+ </View>,
405
+ ]
388
406
  `;
389
407
 
390
408
  exports[`Error renders title only correctly 1`] = `
@@ -3,6 +3,7 @@ import { fireEvent } from '@testing-library/react-native';
3
3
  import renderWithTheme from '../../../testHelpers/renderWithTheme';
4
4
  import Error from '..';
5
5
  import Image from '../../Image';
6
+ import Portal from '../../Portal';
6
7
 
7
8
  const title = `We’re sorry, something went wrong`;
8
9
  const description = 'Please try again later';
@@ -46,12 +47,14 @@ describe('Error', () => {
46
47
  });
47
48
  it('renders full screen error page correctly', () => {
48
49
  const { toJSON, getByText, getByTestId } = renderWithTheme(
49
- <Error
50
- variant="full-screen"
51
- title={title}
52
- description={description}
53
- image="path_to_image"
54
- />
50
+ <Portal.Provider>
51
+ <Error
52
+ variant="full-screen"
53
+ title={title}
54
+ description={description}
55
+ image="path_to_image"
56
+ />
57
+ </Portal.Provider>
55
58
  );
56
59
 
57
60
  expect(getByText(title)).toBeTruthy();
@@ -1 +1 @@
1
- {"activate":59000,"add-emoji":59001,"add-person":59002,"adjustment":59003,"alignment":59004,"antenna":59005,"archive":59006,"assignment-warning":59007,"bank":59008,"bell":59009,"billing":59010,"bolt":59011,"bookmark-added":59012,"bookmark":59013,"box-check":59014,"box":59015,"bpay":59016,"buildings":59017,"cake":59018,"calendar-clock":59019,"calendar":59020,"candy-box-menu":59021,"caret-down-small":59022,"caret-down":59023,"caret-left-small":59024,"caret-left":59025,"caret-right-small":59026,"caret-right":59027,"caret-up-small":59028,"caret-up":59029,"check-radio":59030,"circle-add":59031,"circle-cancel":59032,"circle-check":59033,"circle-down":59034,"circle-info":59035,"circle-left":59036,"circle-ok":59037,"circle-pencil":59038,"circle-question":59039,"circle-remove":59040,"circle-right":59041,"circle-up":59042,"circle-warning":59043,"clock-3":59044,"clock":59045,"cloud-download":59046,"cloud-upload":59047,"cog":59048,"coin":59049,"contacts":59050,"credit-card":59051,"diamond":59052,"direction-arrows":59053,"directory":59054,"document":59055,"dollar-coin-shine":59056,"double-buildings":59057,"edit-template":59058,"envelope":59059,"exclude":59060,"expense":59061,"eye-circle":59062,"eye-invisible":59063,"eye":59064,"face-meh":59065,"face-sad":59066,"face-smiley":59067,"feed":59068,"feedbacks":59069,"file-certified":59070,"file-clone":59071,"file-copy":59072,"file-csv":59073,"file-dispose":59074,"file-doc":59075,"file-excel":59076,"file-export":59077,"file-lock":59078,"file-pdf":59079,"file-powerpoint":59080,"file-search":59081,"file-secured":59082,"file-sheets":59083,"file-slide":59084,"file-verified":59085,"file-word":59086,"file":59087,"filter":59088,"folder-user":59089,"folder":59090,"format-bold":59091,"format-heading1":59092,"format-heading2":59093,"format-italic":59094,"format-list-bulleted":59095,"format-list-numbered":59096,"format-underlined":59097,"funnel-filter":59098,"global-dollar":59099,"globe":59100,"graduation-cap":59101,"graph":59102,"happy-sun":59103,"health-bag":59104,"heart":59105,"home":59106,"image":59107,"import":59108,"incident-siren":59109,"instapay":59110,"list":59111,"loading-2":59112,"loading":59113,"location":59114,"lock":59115,"looks-one":59116,"looks-two":59117,"media-content":59118,"menu":59119,"money-notes":59120,"moneybag":59121,"moon":59122,"multiple-stars":59123,"multiple-users":59124,"node":59125,"open-folder":59126,"paperclip":59127,"payment-summary":59128,"pencil":59129,"phone":59130,"piggy-bank":59131,"plane-up":59132,"plane":59133,"play-circle":59134,"print":59135,"raising-hands":59136,"reply-arrow":59137,"reply":59138,"reschedule":59139,"rostering":59140,"save":59141,"schedule-send":59142,"schedule":59143,"search-person":59144,"send":59145,"speaker-active":59146,"speaker":59147,"star-award":59148,"star-badge":59149,"star-circle":59150,"star-medal":59151,"star":59152,"steps-circle":59153,"stopwatch":59154,"suitcase":59155,"surfing":59156,"survey":59157,"swag-pillar-benefit":59158,"swag-pillar-career":59159,"swag-pillar-money":59160,"swag-pillar-work":59161,"swag":59162,"switch":59163,"tag":59164,"target":59165,"teams":59166,"timesheet":59167,"touch-id":59168,"trash-bin":59169,"unlock":59170,"user":59171,"video-1":59172,"video-2":59173,"wallet":59174,"warning":59175,"activate-outlined":59176,"add-credit-card-outlined":59177,"add-person-outlined":59178,"add-section-outlined":59179,"add-time-outlined":59180,"add":59181,"adjustment-outlined":59182,"ai-outlined":59183,"alignment-2-outlined":59184,"alignment-outlined":59185,"all-caps":59186,"arrow-down":59187,"arrow-downwards":59188,"arrow-left":59189,"arrow-leftwards":59190,"arrow-right":59191,"arrow-rightwards":59192,"arrow-up":59193,"arrow-upwards":59194,"article-outlined":59195,"at-sign":59196,"auto-graph-outlined":59197,"beer-outlined":59198,"bell-active-outlined":59199,"bell-outlined":59200,"bell-slash-outlined":59201,"billing-outlined":59202,"body-outlined":59203,"bold":59204,"bolt-outlined":59205,"book-outlined":59206,"bookmark-added-outlined":59207,"bookmark-outlined":59208,"box-check-outlined":59209,"box-outlined":59210,"bullet-points":59211,"cake-outlined":59212,"calendar-dates-outlined":59213,"calendar-star-outlined":59214,"call-outlined":59215,"call-split-outlined":59216,"camera-outlined":59217,"cancel":59218,"car-forward-outlined":59219,"charging-station-outlined":59220,"chat-bubble-outlined":59221,"chat-unread-outlined":59222,"checkmark":59223,"circle-add-outlined":59224,"circle-cancel-outlined":59225,"circle-down-outlined":59226,"circle-info-outlined":59227,"circle-left-outlined":59228,"circle-ok-outlined":59229,"circle-question-outlined":59230,"circle-remove-outlined":59231,"circle-right-outlined":59232,"circle-up-outlined":59233,"circle-warning-outlined":59234,"clock-2-outlined":59235,"clock-outlined":59236,"cog-outlined":59237,"coin-outlined":59238,"coin-super-outlined":59239,"comment-outlined":59240,"contacts-outlined":59241,"contacts-user-outlined":59242,"credit-card-outlined":59243,"cup-outlined":59244,"dentistry-outlined":59245,"direction-arrows-outlined":59246,"directory-outlined":59247,"document-outlined":59248,"dollar-box-outlined":59249,"dollar-card-outlined":59250,"dollar-coin-shine-outlined":59251,"dollar-credit-card-outlined":59252,"dollar-sign":59253,"double-buildings-outlined":59254,"double-left-arrows":59255,"double-right-arrows":59256,"download-box-outlined":59257,"download-outlined":59258,"edit-template-outlined":59259,"email-outlined":59260,"enter-arrow":59261,"envelope-outlined":59262,"expense-outlined":59263,"explore-outlined":59264,"extension-outlined":59265,"external-link":59266,"eye-invisible-outlined":59267,"eye-outlined":59268,"face-id":59269,"face-meh-outlined":59270,"face-open-smiley-outlined":59271,"face-sad-outlined":59272,"face-smiley-outlined":59273,"fastfood-outlined":59274,"feed-outlined":59275,"file-certified-outlined":59276,"file-clone-outlined":59277,"file-copy-outlined":59278,"file-dispose-outlined":59279,"file-dollar-certified-outlined":59280,"file-dollar-outlined":59281,"file-download-outlined":59282,"file-export-outlined":59283,"file-lock-outlined":59284,"file-outlined":59285,"file-search-outlined":59286,"file-secured-outlined":59287,"file-statutory-outlined":59288,"file-verified-outlined":59289,"filter-outlined":59290,"folder-outlined":59291,"folder-user-outlined":59292,"form-outlined":59293,"funnel-filter-outline":59294,"graph-outlined":59295,"hand-holding-user-outlined":59296,"happy-sun-outlined":59297,"health-bag-outlined":59298,"heart-outlined":59299,"home-active-outlined":59300,"home-outlined":59301,"id-card-outlined":59302,"image-outlined":59303,"import-outlined":59304,"instapay-outlined":59305,"italic":59306,"link-1":59307,"link-2":59308,"list-outlined":59309,"live-help-outlined":59310,"location-on-outlined":59311,"location-outlined":59312,"lock-outlined":59313,"locked-file-outlined":59314,"log-out":59315,"mail-outlined":59316,"media-content-outlined":59317,"menu-close":59318,"menu-expand":59319,"menu-fold-outlined":59320,"menu-unfold-outlined":59321,"moneybag-outlined":59322,"moon-outlined":59323,"more-horizontal":59324,"more-vertical":59325,"multiple-folders-outlined":59326,"multiple-users-outlined":59327,"near-me-outlined":59328,"node-outlined":59329,"number-points":59330,"number":59331,"overview-outlined":59332,"payment-summary-outlined":59333,"payslip-outlined":59334,"pencil-outlined":59335,"percentage":59336,"phone-outlined":59337,"piggy-bank-outlined":59338,"plane-outlined":59339,"play-circle-outlined":59340,"print-outlined":59341,"propane-tank-outlined":59342,"qr-code-outlined":59343,"qualification-outlined":59344,"re-assign":59345,"redeem":59346,"refresh":59347,"remove":59348,"reply-outlined":59349,"restart":59350,"return-arrow":59351,"rostering-outlined":59352,"save-outlined":59353,"schedule-outlined":59354,"search-outlined":59355,"search-secured-outlined":59356,"send-outlined":59357,"share-1":59358,"share-2":59359,"share-outlined":59360,"show-chart-outlined":59361,"single-down-arrow":59362,"single-left-arrow":59363,"single-right-arrow":59364,"single-up-arrow":59365,"speaker-active-outlined":59366,"speaker-outlined":59367,"star-circle-outlined":59368,"star-outlined":59369,"stopwatch-outlined":59370,"strikethrough":59371,"styler-outlined":59372,"suitcase-clock-outlined":59373,"suitcase-outlined":59374,"survey-outlined":59375,"switch-outlined":59376,"sync":59377,"tag-outlined":59378,"target-outlined":59379,"tennis-outlined":59380,"ticket-outlined":59381,"timesheet-outlined":59382,"today-outlined":59383,"transfer":59384,"trash-bin-outlined":59385,"umbrela-outlined":59386,"unavailable":59387,"underline":59388,"union-outlined":59389,"unlock-outlined":59390,"upload-outlined":59391,"user-circle-outlined":59392,"user-gear-outlined":59393,"user-outlined":59394,"user-rectangle-outlined":59395,"video-1-outlined":59396,"video-2-outlined":59397,"volunteer-outlined":59398,"wallet-outlined":59399}
1
+ {"activate":59000,"add-emoji":59001,"add-person":59002,"adjustment":59003,"alignment":59004,"antenna":59005,"archive":59006,"assignment-warning":59007,"bank":59008,"bell":59009,"billing":59010,"bolt":59011,"bookmark-added":59012,"bookmark":59013,"box-check":59014,"box":59015,"bpay":59016,"buildings":59017,"cake":59018,"calendar-clock":59019,"calendar":59020,"candy-box-menu":59021,"caret-down-small":59022,"caret-down":59023,"caret-left-small":59024,"caret-left":59025,"caret-right-small":59026,"caret-right":59027,"caret-up-small":59028,"caret-up":59029,"check-radio":59030,"circle-add":59031,"circle-cancel":59032,"circle-check":59033,"circle-down":59034,"circle-info":59035,"circle-left":59036,"circle-ok":59037,"circle-pencil":59038,"circle-question":59039,"circle-remove":59040,"circle-right":59041,"circle-up":59042,"circle-warning":59043,"clock-3":59044,"clock":59045,"cloud-download":59046,"cloud-upload":59047,"cog":59048,"coin":59049,"contacts":59050,"credit-card":59051,"diamond":59052,"direction-arrows":59053,"directory":59054,"document":59055,"dollar-coin-shine":59056,"double-buildings":59057,"edit-template":59058,"envelope":59059,"exclude":59060,"expense":59061,"eye-circle":59062,"eye-invisible":59063,"eye":59064,"face-meh":59065,"face-sad":59066,"face-smiley":59067,"feed":59068,"feedbacks":59069,"file-certified":59070,"file-clone":59071,"file-copy":59072,"file-csv":59073,"file-dispose":59074,"file-doc":59075,"file-excel":59076,"file-export":59077,"file-lock":59078,"file-pdf":59079,"file-powerpoint":59080,"file-search":59081,"file-secured":59082,"file-sheets":59083,"file-slide":59084,"file-verified":59085,"file-word":59086,"file":59087,"filter":59088,"folder-user":59089,"folder":59090,"format-bold":59091,"format-heading1":59092,"format-heading2":59093,"format-italic":59094,"format-list-bulleted":59095,"format-list-numbered":59096,"format-underlined":59097,"funnel-filter":59098,"global-dollar":59099,"globe":59100,"graduation-cap":59101,"graph":59102,"happy-sun":59103,"health-bag":59104,"heart":59105,"home":59106,"image":59107,"import":59108,"incident-siren":59109,"instapay":59110,"list":59111,"loading-2":59112,"loading":59113,"location":59114,"lock":59115,"looks-one":59116,"looks-two":59117,"media-content":59118,"menu":59119,"money-notes":59120,"moneybag":59121,"moon":59122,"multiple-stars":59123,"multiple-users":59124,"node":59125,"open-folder":59126,"paperclip":59127,"payment-summary":59128,"pencil":59129,"phone":59130,"piggy-bank":59131,"plane-up":59132,"plane":59133,"play-circle":59134,"print":59135,"raising-hands":59136,"reply-arrow":59137,"reply":59138,"reschedule":59139,"rostering":59140,"save":59141,"schedule-send":59142,"schedule":59143,"search-person":59144,"send":59145,"speaker-active":59146,"speaker":59147,"star-award":59148,"star-badge":59149,"star-circle":59150,"star-medal":59151,"star":59152,"steps-circle":59153,"stopwatch":59154,"suitcase":59155,"surfing":59156,"survey":59157,"swag-pillar-benefit":59158,"swag-pillar-career":59159,"swag-pillar-money":59160,"swag-pillar-work":59161,"swag":59162,"switch":59163,"tag":59164,"target":59165,"teams":59166,"timesheet":59167,"touch-id":59168,"trash-bin":59169,"unlock":59170,"user":59171,"video-1":59172,"video-2":59173,"wallet":59174,"warning":59175,"activate-outlined":59176,"add-credit-card-outlined":59177,"add-person-outlined":59178,"add-section-outlined":59179,"add-time-outlined":59180,"add":59181,"adjustment-outlined":59182,"ai-outlined":59183,"alignment-2-outlined":59184,"alignment-outlined":59185,"all-caps":59186,"arrow-down":59187,"arrow-downwards":59188,"arrow-left":59189,"arrow-leftwards":59190,"arrow-right":59191,"arrow-rightwards":59192,"arrow-up":59193,"arrow-upwards":59194,"article-outlined":59195,"at-sign":59196,"auto-graph-outlined":59197,"beer-outlined":59198,"bell-active-outlined":59199,"bell-outlined":59200,"bell-slash-outlined":59201,"billing-outlined":59202,"body-outlined":59203,"bold":59204,"bolt-outlined":59205,"book-outlined":59206,"bookmark-added-outlined":59207,"bookmark-outlined":59208,"box-check-outlined":59209,"box-outlined":59210,"bullet-points":59211,"cake-outlined":59212,"calendar-dates-outlined":59213,"calendar-star-outlined":59214,"call-outlined":59215,"call-split-outlined":59216,"camera-outlined":59217,"cancel":59218,"car-forward-outlined":59219,"charging-station-outlined":59220,"chat-bubble-outlined":59221,"chat-unread-outlined":59222,"checkmark":59223,"circle-add-outlined":59224,"circle-cancel-outlined":59225,"circle-down-outlined":59226,"circle-info-outlined":59227,"circle-left-outlined":59228,"circle-ok-outlined":59229,"circle-question-outlined":59230,"circle-remove-outlined":59231,"circle-right-outlined":59232,"circle-up-outlined":59233,"circle-warning-outlined":59234,"clock-2-outlined":59235,"clock-outlined":59236,"cog-outlined":59237,"coin-outlined":59238,"coin-super-outlined":59239,"comment-outlined":59240,"contacts-outlined":59241,"contacts-user-outlined":59242,"credit-card-outlined":59243,"cup-outlined":59244,"dentistry-outlined":59245,"direction-arrows-outlined":59246,"directory-outlined":59247,"document-outlined":59248,"dollar-box-outlined":59249,"dollar-card-outlined":59250,"dollar-coin-shine-outlined":59251,"dollar-credit-card-outlined":59252,"dollar-sign":59253,"double-buildings-outlined":59254,"double-left-arrows":59255,"double-right-arrows":59256,"download-box-outlined":59257,"download-outlined":59258,"edit-template-outlined":59259,"email-outlined":59260,"enter-arrow":59261,"envelope-outlined":59262,"expense-outlined":59263,"explore-outlined":59264,"extension-outlined":59265,"external-link":59266,"eye-invisible-outlined":59267,"eye-outlined":59268,"face-id":59269,"face-meh-outlined":59270,"face-open-smiley-outlined":59271,"face-sad-outlined":59272,"face-smiley-outlined":59273,"fastfood-outlined":59274,"feed-outlined":59275,"file-certified-outlined":59276,"file-clone-outlined":59277,"file-copy-outlined":59278,"file-dispose-outlined":59279,"file-dollar-certified-outlined":59280,"file-dollar-outlined":59281,"file-download-outlined":59282,"file-export-outlined":59283,"file-lock-outlined":59284,"file-outlined":59285,"file-search-outlined":59286,"file-secured-outlined":59287,"file-statutory-outlined":59288,"file-verified-outlined":59289,"filter-outlined":59290,"folder-outlined":59291,"folder-user-outlined":59292,"form-outlined":59293,"funnel-filter-outline":59294,"graph-outlined":59295,"hand-holding-user-outlined":59296,"happy-sun-outlined":59297,"health-bag-outlined":59298,"heart-outlined":59299,"home-active-outlined":59300,"home-outlined":59301,"id-card-outlined":59302,"image-outlined":59303,"import-outlined":59304,"instapay-outlined":59305,"italic":59306,"link-1":59307,"link-2":59308,"list-outlined":59309,"live-help-outlined":59310,"location-on-outlined":59311,"location-outlined":59312,"lock-outlined":59313,"locked-file-outlined":59314,"log-out":59315,"mail-outlined":59316,"media-content-outlined":59317,"menu-close":59318,"menu-expand":59319,"menu-fold-outlined":59320,"menu-unfold-outlined":59321,"moneybag-outlined":59322,"moon-outlined":59323,"more-horizontal":59324,"more-vertical":59325,"multiple-folders-outlined":59326,"multiple-users-outlined":59327,"near-me-outlined":59328,"node-outlined":59329,"number-points":59330,"number":59331,"overview-outlined":59332,"payment-summary-outlined":59333,"payslip-outlined":59334,"pencil-outlined":59335,"percentage":59336,"phone-outlined":59337,"piggy-bank-outlined":59338,"plane-outlined":59339,"play-circle-outlined":59340,"print-outlined":59341,"propane-tank-outlined":59342,"qr-code-outlined":59343,"qualification-outlined":59344,"re-assign":59345,"redeem":59346,"refresh":59347,"remove":59348,"reply-outlined":59349,"restart":59350,"return-arrow":59351,"rostering-outlined":59352,"save-outlined":59353,"schedule-outlined":59354,"search-outlined":59355,"search-secured-outlined":59356,"send-outlined":59357,"share-1":59358,"share-2":59359,"share-outlined":59360,"show-chart-outlined":59361,"single-down-arrow":59362,"single-left-arrow":59363,"single-right-arrow":59364,"single-up-arrow":59365,"sparkle-outlined":59366,"speaker-active-outlined":59367,"speaker-outlined":59368,"star-circle-outlined":59369,"star-outlined":59370,"stopwatch-outlined":59371,"strikethrough":59372,"styler-outlined":59373,"suitcase-clock-outlined":59374,"suitcase-outlined":59375,"survey-outlined":59376,"switch-outlined":59377,"sync":59378,"tag-outlined":59379,"target-outlined":59380,"tennis-outlined":59381,"ticket-outlined":59382,"timesheet-outlined":59383,"today-outlined":59384,"transfer":59385,"trash-bin-outlined":59386,"umbrela-outlined":59387,"unavailable":59388,"underline":59389,"union-outlined":59390,"unlock-outlined":59391,"upload-outlined":59392,"user-circle-outlined":59393,"user-gear-outlined":59394,"user-outlined":59395,"user-rectangle-outlined":59396,"video-1-outlined":59397,"video-2-outlined":59398,"volunteer-outlined":59399,"wallet-outlined":59400}
@@ -366,6 +366,7 @@ const IconList = [
366
366
  'single-left-arrow',
367
367
  'single-right-arrow',
368
368
  'single-up-arrow',
369
+ 'sparkle-outlined',
369
370
  'speaker-active-outlined',
370
371
  'speaker-outlined',
371
372
  'star-circle-outlined',
@@ -0,0 +1,117 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Modal renders correctly 1`] = `
4
+ [
5
+ <View
6
+ collapsable={false}
7
+ style={
8
+ {
9
+ "backgroundColor": "#000000",
10
+ "bottom": 0,
11
+ "left": 0,
12
+ "opacity": 0.4,
13
+ "position": "absolute",
14
+ "right": 0,
15
+ "top": 0,
16
+ }
17
+ }
18
+ />,
19
+ <View
20
+ collapsable={false}
21
+ style={
22
+ {
23
+ "bottom": 0,
24
+ "left": 0,
25
+ "opacity": 1,
26
+ "position": "absolute",
27
+ "right": 0,
28
+ "top": 0,
29
+ "transform": [
30
+ {
31
+ "translateY": 0,
32
+ },
33
+ ],
34
+ }
35
+ }
36
+ >
37
+ <Text
38
+ allowFontScaling={false}
39
+ style={
40
+ [
41
+ {
42
+ "color": "#001f23",
43
+ "fontFamily": "BeVietnamPro-Regular",
44
+ "fontSize": 16,
45
+ "letterSpacing": 0.48,
46
+ "lineHeight": 24,
47
+ },
48
+ undefined,
49
+ ]
50
+ }
51
+ themeIntent="body"
52
+ themeTypeface="neutral"
53
+ themeVariant="regular"
54
+ >
55
+ Modal content
56
+ </Text>
57
+ </View>,
58
+ ]
59
+ `;
60
+
61
+ exports[`Modal renders correctly with transparent 1`] = `
62
+ [
63
+ <View
64
+ collapsable={false}
65
+ style={
66
+ {
67
+ "backgroundColor": "transparent",
68
+ "bottom": 0,
69
+ "left": 0,
70
+ "opacity": 0.4,
71
+ "position": "absolute",
72
+ "right": 0,
73
+ "top": 0,
74
+ }
75
+ }
76
+ />,
77
+ <View
78
+ collapsable={false}
79
+ style={
80
+ {
81
+ "bottom": 0,
82
+ "left": 0,
83
+ "opacity": 1,
84
+ "position": "absolute",
85
+ "right": 0,
86
+ "top": 0,
87
+ "transform": [
88
+ {
89
+ "translateY": 0,
90
+ },
91
+ ],
92
+ }
93
+ }
94
+ >
95
+ <Text
96
+ allowFontScaling={false}
97
+ style={
98
+ [
99
+ {
100
+ "color": "#001f23",
101
+ "fontFamily": "BeVietnamPro-Regular",
102
+ "fontSize": 16,
103
+ "letterSpacing": 0.48,
104
+ "lineHeight": 24,
105
+ },
106
+ undefined,
107
+ ]
108
+ }
109
+ themeIntent="body"
110
+ themeTypeface="neutral"
111
+ themeVariant="regular"
112
+ >
113
+ Modal content
114
+ </Text>
115
+ </View>,
116
+ ]
117
+ `;
@@ -0,0 +1,99 @@
1
+ import { fireEvent } from '@testing-library/react-native';
2
+ import React from 'react';
3
+ import { BackHandler } from 'react-native';
4
+ import Modal from '..';
5
+ import { Button } from '../../..';
6
+ import renderWithTheme from '../../../testHelpers/renderWithTheme';
7
+ import Portal from '../../Portal';
8
+ import Typography from '../../Typography';
9
+
10
+ describe('Modal', () => {
11
+ it('renders correctly', () => {
12
+ const wrapper = renderWithTheme(
13
+ <Portal.Provider>
14
+ <Modal visible>
15
+ <Typography.Body>Modal content</Typography.Body>
16
+ </Modal>
17
+ </Portal.Provider>
18
+ );
19
+
20
+ expect(wrapper.toJSON()).toMatchSnapshot();
21
+ });
22
+
23
+ it('renders correctly with transparent', () => {
24
+ const wrapper = renderWithTheme(
25
+ <Portal.Provider>
26
+ <Modal visible transparent>
27
+ <Typography.Body>Modal content</Typography.Body>
28
+ </Modal>
29
+ </Portal.Provider>
30
+ );
31
+
32
+ expect(wrapper.toJSON()).toMatchSnapshot();
33
+ });
34
+
35
+ it('trigger onShow callback correctly', () => {
36
+ const onShow = jest.fn();
37
+ renderWithTheme(
38
+ <Portal.Provider>
39
+ <Modal visible onShow={onShow}>
40
+ <Typography.Body>Modal content</Typography.Body>
41
+ </Modal>
42
+ </Portal.Provider>
43
+ );
44
+
45
+ expect(onShow).toBeCalledTimes(1);
46
+ });
47
+
48
+ it('trigger onRequestClose callback correctly', () => {
49
+ jest.mock('react-native/Libraries/Utilities/Platform', () => ({
50
+ OS: 'android',
51
+ select: () => null,
52
+ }));
53
+
54
+ const onRequestClose = jest.fn();
55
+ renderWithTheme(
56
+ <Portal.Provider>
57
+ <Modal visible onRequestClose={onRequestClose}>
58
+ <Typography.Body>Modal content</Typography.Body>
59
+ </Modal>
60
+ </Portal.Provider>
61
+ );
62
+
63
+ // @ts-expect-error: BackHandler mock
64
+ BackHandler.mockPressBack();
65
+ expect(onRequestClose).toBeCalled();
66
+ });
67
+
68
+ it('trigger onDismiss callback correctly', async () => {
69
+ jest.mock('react-native/Libraries/Utilities/Platform', () => ({
70
+ OS: 'ios',
71
+ select: () => null,
72
+ }));
73
+
74
+ const onDismiss = jest.fn();
75
+
76
+ const ModalExample = () => {
77
+ const [modalVisible, setModalVisible] = React.useState(true);
78
+
79
+ return (
80
+ <Portal.Provider>
81
+ <Modal
82
+ animationType="none"
83
+ visible={modalVisible}
84
+ onDismiss={onDismiss}
85
+ transparent
86
+ >
87
+ <Typography.Body>Modal content</Typography.Body>
88
+ <Button text="Close modal" onPress={() => setModalVisible(false)} />
89
+ </Modal>
90
+ </Portal.Provider>
91
+ );
92
+ };
93
+
94
+ const { getByText } = renderWithTheme(<ModalExample />);
95
+
96
+ fireEvent.press(getByText('Close modal'));
97
+ expect(onDismiss).toBeCalled();
98
+ });
99
+ });