@charcoal-ui/react 4.0.0-beta.8 → 4.0.0-rc.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.
Files changed (90) hide show
  1. package/dist/_lib/compat.d.ts +0 -12
  2. package/dist/_lib/compat.d.ts.map +1 -1
  3. package/dist/_lib/createDivComponent.d.ts +2 -2
  4. package/dist/_lib/createDivComponent.d.ts.map +1 -1
  5. package/dist/components/Button/index.d.ts +2 -6
  6. package/dist/components/Button/index.d.ts.map +1 -1
  7. package/dist/components/Clickable/index.d.ts +4 -7
  8. package/dist/components/Clickable/index.d.ts.map +1 -1
  9. package/dist/components/IconButton/index.d.ts +1 -2
  10. package/dist/components/IconButton/index.d.ts.map +1 -1
  11. package/dist/components/Modal/Dialog/index.d.ts +1 -1
  12. package/dist/components/Modal/Dialog/index.d.ts.map +1 -1
  13. package/dist/components/Modal/ModalPlumbing.d.ts +6 -6
  14. package/dist/components/Modal/ModalPlumbing.d.ts.map +1 -1
  15. package/dist/components/Modal/index.d.ts.map +1 -1
  16. package/dist/components/Modal/useCustomModalOverlay.d.ts +1 -0
  17. package/dist/components/Modal/useCustomModalOverlay.d.ts.map +1 -1
  18. package/dist/components/TagItem/index.d.ts +2 -6
  19. package/dist/components/TagItem/index.d.ts.map +1 -1
  20. package/dist/components/TextArea/index.d.ts +1 -1
  21. package/dist/components/TextArea/index.d.ts.map +1 -1
  22. package/dist/components/TextField/AssistiveText/index.d.ts +2 -2
  23. package/dist/components/TextField/AssistiveText/index.d.ts.map +1 -1
  24. package/dist/components/TextField/index.d.ts +3 -3
  25. package/dist/components/TextField/index.d.ts.map +1 -1
  26. package/dist/core/CharcoalProvider.d.ts +4 -11
  27. package/dist/core/CharcoalProvider.d.ts.map +1 -1
  28. package/dist/index.cjs.js +300 -334
  29. package/dist/index.cjs.js.map +1 -1
  30. package/dist/index.css +2 -5
  31. package/dist/index.css.map +1 -1
  32. package/dist/index.d.ts +0 -1
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.esm.js +233 -265
  35. package/dist/index.esm.js.map +1 -1
  36. package/dist/layered.css +1214 -0
  37. package/dist/layered.css.map +1 -0
  38. package/package.json +17 -13
  39. package/src/README.mdx +68 -0
  40. package/src/SSR.mdx +67 -0
  41. package/src/_lib/compat.ts +0 -11
  42. package/src/_lib/index.ts +1 -1
  43. package/src/components/Button/__snapshots__/index.story.storyshot +9 -9
  44. package/src/components/Button/index.tsx +4 -10
  45. package/src/components/Checkbox/CheckboxInput/__snapshots__/index.story.storyshot +5 -5
  46. package/src/components/Checkbox/CheckboxInput/index.css +4 -5
  47. package/src/components/Checkbox/__snapshots__/index.story.storyshot +6 -6
  48. package/src/components/Clickable/__snapshots__/index.story.storyshot +2 -2
  49. package/src/components/Clickable/index.story.tsx +1 -1
  50. package/src/components/Clickable/index.tsx +7 -12
  51. package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +7 -6
  52. package/src/components/DropdownSelector/ListItem/index.story.tsx +11 -5
  53. package/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot +3 -3
  54. package/src/components/DropdownSelector/Popover/__snapshots__/index.story.storyshot +1 -1
  55. package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +14 -14
  56. package/src/components/Icon/__snapshots__/index.story.storyshot +1 -1
  57. package/src/components/IconButton/__snapshots__/index.story.storyshot +3 -3
  58. package/src/components/IconButton/index.tsx +3 -6
  59. package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +4 -4
  60. package/src/components/Modal/Dialog/index.tsx +2 -1
  61. package/src/components/Modal/__snapshots__/index.story.storyshot +102 -261
  62. package/src/components/Modal/index.story.tsx +26 -11
  63. package/src/components/Modal/index.tsx +5 -6
  64. package/src/components/Modal/useCustomModalOverlay.tsx +20 -0
  65. package/src/components/Radio/__snapshots__/index.story.storyshot +40 -65
  66. package/src/components/Radio/index.story.tsx +14 -7
  67. package/src/components/Radio/index.test.tsx +20 -27
  68. package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +2 -2
  69. package/src/components/Switch/__snapshots__/index.story.storyshot +4 -4
  70. package/src/components/TagItem/__snapshots__/index.story.storyshot +8 -8
  71. package/src/components/TagItem/index.tsx +4 -8
  72. package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +11 -11
  73. package/src/components/TextField/TextField.story.tsx +8 -9
  74. package/src/components/TextField/__snapshots__/TextField.story.storyshot +20 -26
  75. package/src/components/TextField/index.tsx +2 -2
  76. package/src/core/CharcoalProvider.tsx +5 -29
  77. package/src/index.ts +0 -5
  78. package/src/type.d.ts +2 -13
  79. package/dist/components/Modal/__stories__/InternalScrollStory.d.ts +0 -4
  80. package/dist/components/Modal/__stories__/InternalScrollStory.d.ts.map +0 -1
  81. package/dist/core/ComponentAbstraction.d.ts +0 -24
  82. package/dist/core/ComponentAbstraction.d.ts.map +0 -1
  83. package/dist/styled.d.ts +0 -95
  84. package/dist/styled.d.ts.map +0 -1
  85. package/src/components/Button/__snapshots__/index.test.tsx.snap +0 -11
  86. package/src/components/Button/index.test.tsx +0 -32
  87. package/src/components/Modal/__stories__/InternalScrollStory.tsx +0 -75
  88. package/src/components/a11y.test.tsx +0 -99
  89. package/src/core/ComponentAbstraction.tsx +0 -48
  90. package/src/styled.ts +0 -3
@@ -1,34 +1,6 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`Storybook Tests react/Modal BackgroundScroll 1`] = `
4
- .c0 {
5
- display: grid;
6
- gap: 24px;
7
- }
8
-
9
- .c1 {
10
- color: var(--charcoal-text2);
11
- font-size: 14px;
12
- line-height: 22px;
13
- display: flow-root;
14
- }
15
-
16
- .c1::before {
17
- display: block;
18
- width: 0;
19
- height: 0;
20
- content: '';
21
- margin-top: -4px;
22
- }
23
-
24
- .c1::after {
25
- display: block;
26
- width: 0;
27
- height: 0;
28
- content: '';
29
- margin-bottom: -4px;
30
- }
31
-
3
+ exports[`Storybook Tests > react/Modal > BackgroundScroll 1`] = `
32
4
  <div
33
5
  data-dark={false}
34
6
  >
@@ -64,6 +36,7 @@ exports[`Storybook Tests react/Modal BackgroundScroll 1`] = `
64
36
  <div
65
37
  className="charcoal-modal-dialog"
66
38
  data-bottom-sheet={false}
39
+ data-size="M"
67
40
  onKeyDown={[Function]}
68
41
  role="dialog"
69
42
  style={Object {}}
@@ -83,10 +56,22 @@ exports[`Storybook Tests react/Modal BackgroundScroll 1`] = `
83
56
  className="charcoal-modal-body"
84
57
  >
85
58
  <div
86
- className="c0"
59
+ style={
60
+ Object {
61
+ "display": "grid",
62
+ "gap": 24,
63
+ }
64
+ }
87
65
  >
88
66
  <div
89
- className="charcoal-modal-align c1"
67
+ style={
68
+ Object {
69
+ "color": "var(--charcoal-text2)",
70
+ "fontSize": 14,
71
+ "lineHeight": "22px",
72
+ "padding": "0 16px",
73
+ }
74
+ }
90
75
  >
91
76
  Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod placeat tenetur, necessitatibus laudantium cumque exercitationem provident. Quaerat iure enim, eveniet dolores earum odio quo possimus fugiat aspernatur, numquam, commodi repellat.
92
77
  </div>
@@ -291,35 +276,7 @@ exports[`Storybook Tests react/Modal BackgroundScroll 1`] = `
291
276
  </div>
292
277
  `;
293
278
 
294
- exports[`Storybook Tests react/Modal BottomSheet 1`] = `
295
- .c0 {
296
- display: grid;
297
- gap: 24px;
298
- }
299
-
300
- .c1 {
301
- color: var(--charcoal-text2);
302
- font-size: 14px;
303
- line-height: 22px;
304
- display: flow-root;
305
- }
306
-
307
- .c1::before {
308
- display: block;
309
- width: 0;
310
- height: 0;
311
- content: '';
312
- margin-top: -4px;
313
- }
314
-
315
- .c1::after {
316
- display: block;
317
- width: 0;
318
- height: 0;
319
- content: '';
320
- margin-bottom: -4px;
321
- }
322
-
279
+ exports[`Storybook Tests > react/Modal > BottomSheet 1`] = `
323
280
  <div
324
281
  data-dark={false}
325
282
  >
@@ -340,8 +297,6 @@ exports[`Storybook Tests react/Modal BottomSheet 1`] = `
340
297
  onPointerDown={[Function]}
341
298
  style={
342
299
  Object {
343
- "backgroundColor": "rgba(0, 0, 0, 0)",
344
- "overflow": "hidden",
345
300
  "zIndex": 10,
346
301
  }
347
302
  }
@@ -349,13 +304,10 @@ exports[`Storybook Tests react/Modal BottomSheet 1`] = `
349
304
  <div
350
305
  className="charcoal-modal-dialog"
351
306
  data-bottom-sheet={true}
307
+ data-size="M"
352
308
  onKeyDown={[Function]}
353
309
  role="dialog"
354
- style={
355
- Object {
356
- "transform": " translateY(100%)",
357
- }
358
- }
310
+ style={Object {}}
359
311
  tabIndex={-1}
360
312
  >
361
313
  <div
@@ -372,10 +324,22 @@ exports[`Storybook Tests react/Modal BottomSheet 1`] = `
372
324
  className="charcoal-modal-body"
373
325
  >
374
326
  <div
375
- className="c0"
327
+ style={
328
+ Object {
329
+ "display": "grid",
330
+ "gap": 24,
331
+ }
332
+ }
376
333
  >
377
334
  <div
378
- className="charcoal-modal-align c1"
335
+ style={
336
+ Object {
337
+ "color": "var(--charcoal-text2)",
338
+ "fontSize": 14,
339
+ "lineHeight": "22px",
340
+ "padding": "0 16px",
341
+ }
342
+ }
379
343
  >
380
344
  Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod placeat tenetur, necessitatibus laudantium cumque exercitationem provident. Quaerat iure enim, eveniet dolores earum odio quo possimus fugiat aspernatur, numquam, commodi repellat.
381
345
  </div>
@@ -383,6 +347,23 @@ exports[`Storybook Tests react/Modal BottomSheet 1`] = `
383
347
  <div
384
348
  className="charcoal-modal-buttons"
385
349
  >
350
+ <label
351
+ className="charcoal-checkbox__label"
352
+ htmlFor="test-id"
353
+ >
354
+ <input
355
+ checked={true}
356
+ className="charcoal-checkbox-input"
357
+ id="test-id"
358
+ onChange={[Function]}
359
+ type="checkbox"
360
+ />
361
+ <div
362
+ className="charcoal-checkbox__label_div"
363
+ >
364
+ test checkbox
365
+ </div>
366
+ </label>
386
367
  <button
387
368
  className="charcoal-button"
388
369
  data-full-width={true}
@@ -391,6 +372,13 @@ exports[`Storybook Tests react/Modal BottomSheet 1`] = `
391
372
  >
392
373
  削除する
393
374
  </button>
375
+ <button
376
+ className="charcoal-button"
377
+ data-full-width={true}
378
+ onClick={[Function]}
379
+ >
380
+ キャンセル
381
+ </button>
394
382
  </div>
395
383
  </div>
396
384
  <button
@@ -412,35 +400,7 @@ exports[`Storybook Tests react/Modal BottomSheet 1`] = `
412
400
  </div>
413
401
  `;
414
402
 
415
- exports[`Storybook Tests react/Modal Default 1`] = `
416
- .c0 {
417
- display: grid;
418
- gap: 24px;
419
- }
420
-
421
- .c1 {
422
- color: var(--charcoal-text2);
423
- font-size: 14px;
424
- line-height: 22px;
425
- display: flow-root;
426
- }
427
-
428
- .c1::before {
429
- display: block;
430
- width: 0;
431
- height: 0;
432
- content: '';
433
- margin-top: -4px;
434
- }
435
-
436
- .c1::after {
437
- display: block;
438
- width: 0;
439
- height: 0;
440
- content: '';
441
- margin-bottom: -4px;
442
- }
443
-
403
+ exports[`Storybook Tests > react/Modal > Default 1`] = `
444
404
  <div
445
405
  data-dark={false}
446
406
  >
@@ -468,6 +428,7 @@ exports[`Storybook Tests react/Modal Default 1`] = `
468
428
  <div
469
429
  className="charcoal-modal-dialog"
470
430
  data-bottom-sheet={false}
431
+ data-size="M"
471
432
  onKeyDown={[Function]}
472
433
  role="dialog"
473
434
  style={Object {}}
@@ -487,10 +448,22 @@ exports[`Storybook Tests react/Modal Default 1`] = `
487
448
  className="charcoal-modal-body"
488
449
  >
489
450
  <div
490
- className="c0"
451
+ style={
452
+ Object {
453
+ "display": "grid",
454
+ "gap": 24,
455
+ }
456
+ }
491
457
  >
492
458
  <div
493
- className="charcoal-modal-align c1"
459
+ style={
460
+ Object {
461
+ "color": "var(--charcoal-text2)",
462
+ "fontSize": 14,
463
+ "lineHeight": "22px",
464
+ "padding": "0 16px",
465
+ }
466
+ }
494
467
  >
495
468
  Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod placeat tenetur, necessitatibus laudantium cumque exercitationem provident. Quaerat iure enim, eveniet dolores earum odio quo possimus fugiat aspernatur, numquam, commodi repellat.
496
469
  </div>
@@ -695,35 +668,7 @@ exports[`Storybook Tests react/Modal Default 1`] = `
695
668
  </div>
696
669
  `;
697
670
 
698
- exports[`Storybook Tests react/Modal FullBottomSheet 1`] = `
699
- .c0 {
700
- display: grid;
701
- gap: 24px;
702
- }
703
-
704
- .c1 {
705
- color: var(--charcoal-text2);
706
- font-size: 14px;
707
- line-height: 22px;
708
- display: flow-root;
709
- }
710
-
711
- .c1::before {
712
- display: block;
713
- width: 0;
714
- height: 0;
715
- content: '';
716
- margin-top: -4px;
717
- }
718
-
719
- .c1::after {
720
- display: block;
721
- width: 0;
722
- height: 0;
723
- content: '';
724
- margin-bottom: -4px;
725
- }
726
-
671
+ exports[`Storybook Tests > react/Modal > FullBottomSheet 1`] = `
727
672
  <div
728
673
  data-dark={false}
729
674
  >
@@ -744,8 +689,6 @@ exports[`Storybook Tests react/Modal FullBottomSheet 1`] = `
744
689
  onPointerDown={[Function]}
745
690
  style={
746
691
  Object {
747
- "backgroundColor": "rgba(0, 0, 0, 0)",
748
- "overflow": "hidden",
749
692
  "zIndex": 10,
750
693
  }
751
694
  }
@@ -753,13 +696,10 @@ exports[`Storybook Tests react/Modal FullBottomSheet 1`] = `
753
696
  <div
754
697
  className="charcoal-modal-dialog"
755
698
  data-bottom-sheet="full"
699
+ data-size="M"
756
700
  onKeyDown={[Function]}
757
701
  role="dialog"
758
- style={
759
- Object {
760
- "transform": " translateY(100%)",
761
- }
762
- }
702
+ style={Object {}}
763
703
  tabIndex={-1}
764
704
  >
765
705
  <div
@@ -776,10 +716,22 @@ exports[`Storybook Tests react/Modal FullBottomSheet 1`] = `
776
716
  className="charcoal-modal-body"
777
717
  >
778
718
  <div
779
- className="c0"
719
+ style={
720
+ Object {
721
+ "display": "grid",
722
+ "gap": 24,
723
+ }
724
+ }
780
725
  >
781
726
  <div
782
- className="charcoal-modal-align c1"
727
+ style={
728
+ Object {
729
+ "color": "var(--charcoal-text2)",
730
+ "fontSize": 14,
731
+ "lineHeight": "22px",
732
+ "padding": "0 16px",
733
+ }
734
+ }
783
735
  >
784
736
  Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod placeat tenetur, necessitatibus laudantium cumque exercitationem provident. Quaerat iure enim, eveniet dolores earum odio quo possimus fugiat aspernatur, numquam, commodi repellat.
785
737
  </div>
@@ -903,27 +855,7 @@ exports[`Storybook Tests react/Modal FullBottomSheet 1`] = `
903
855
  </div>
904
856
  `;
905
857
 
906
- exports[`Storybook Tests react/Modal InternalScroll 1`] = `
907
- .c0 {
908
- overflow: auto;
909
- max-height: calc( 100vh - 184px - 56px );
910
- }
911
-
912
- .c1 {
913
- position: relative;
914
- }
915
-
916
- .c1::before {
917
- content: '';
918
- pointer-events: none;
919
- border-top: 1px solid rgba(0,0,0,0.08);
920
- position: absolute;
921
- left: 0;
922
- top: 0;
923
- width: 100%;
924
- height: 100%;
925
- }
926
-
858
+ exports[`Storybook Tests > react/Modal > NotDismmissableStory 1`] = `
927
859
  <div
928
860
  data-dark={false}
929
861
  >
@@ -951,6 +883,7 @@ exports[`Storybook Tests react/Modal InternalScroll 1`] = `
951
883
  <div
952
884
  className="charcoal-modal-dialog"
953
885
  data-bottom-sheet={false}
886
+ data-size="M"
954
887
  onKeyDown={[Function]}
955
888
  role="dialog"
956
889
  style={Object {}}
@@ -970,114 +903,22 @@ exports[`Storybook Tests react/Modal InternalScroll 1`] = `
970
903
  className="charcoal-modal-body"
971
904
  >
972
905
  <div
973
- className="c0"
906
+ style={
907
+ Object {
908
+ "display": "grid",
909
+ "gap": 24,
910
+ }
911
+ }
974
912
  >
975
913
  <div
976
914
  style={
977
915
  Object {
978
- "background": "linear-gradient(#e66465, #9198e5)",
979
- "height": 1000,
916
+ "color": "var(--charcoal-text2)",
917
+ "fontSize": 14,
918
+ "lineHeight": "22px",
919
+ "padding": "0 16px",
980
920
  }
981
921
  }
982
- />
983
- </div>
984
- <div
985
- className="charcoal-modal-buttons c1"
986
- >
987
- <button
988
- className="charcoal-button"
989
- data-full-width={true}
990
- onClick={[Function]}
991
- >
992
- Close
993
- </button>
994
- </div>
995
- </div>
996
- </div>
997
- </div>
998
- </div>
999
- </div>
1000
- `;
1001
-
1002
- exports[`Storybook Tests react/Modal NotDismmissableStory 1`] = `
1003
- .c0 {
1004
- display: grid;
1005
- gap: 24px;
1006
- }
1007
-
1008
- .c1 {
1009
- color: var(--charcoal-text2);
1010
- font-size: 14px;
1011
- line-height: 22px;
1012
- display: flow-root;
1013
- }
1014
-
1015
- .c1::before {
1016
- display: block;
1017
- width: 0;
1018
- height: 0;
1019
- content: '';
1020
- margin-top: -4px;
1021
- }
1022
-
1023
- .c1::after {
1024
- display: block;
1025
- width: 0;
1026
- height: 0;
1027
- content: '';
1028
- margin-bottom: -4px;
1029
- }
1030
-
1031
- <div
1032
- data-dark={false}
1033
- >
1034
- <div
1035
- aria-hidden={null}
1036
- data-overlay-container={true}
1037
- >
1038
- <button
1039
- className="charcoal-button"
1040
- onClick={[Function]}
1041
- >
1042
- Open Modal
1043
- </button>
1044
- <div
1045
- className="charcoal-modal-background"
1046
- data-bottom-sheet={false}
1047
- onClick={[Function]}
1048
- onPointerDown={[Function]}
1049
- style={
1050
- Object {
1051
- "zIndex": 10,
1052
- }
1053
- }
1054
- >
1055
- <div
1056
- className="charcoal-modal-dialog"
1057
- data-bottom-sheet={false}
1058
- onKeyDown={[Function]}
1059
- role="dialog"
1060
- style={Object {}}
1061
- tabIndex={-1}
1062
- >
1063
- <div
1064
- className="charcoal-modal-header-root"
1065
- data-bottom-sheet={false}
1066
- >
1067
- <div
1068
- className="charcoal-modal-header-title"
1069
- >
1070
- react/Title
1071
- </div>
1072
- </div>
1073
- <div
1074
- className="charcoal-modal-body"
1075
- >
1076
- <div
1077
- className="c0"
1078
- >
1079
- <div
1080
- className="charcoal-modal-align c1"
1081
922
  >
1082
923
  Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod placeat tenetur, necessitatibus laudantium cumque exercitationem provident. Quaerat iure enim, eveniet dolores earum odio quo possimus fugiat aspernatur, numquam, commodi repellat.
1083
924
  </div>
@@ -8,10 +8,9 @@ import {
8
8
  ModalButtons,
9
9
  ModalHeader,
10
10
  } from './ModalPlumbing'
11
- import styled from 'styled-components'
12
- import { theme } from '../../styled'
13
11
  import TextField from '../TextField'
14
12
  import DropdownSelector from '../DropdownSelector'
13
+ import Checkbox from '../Checkbox'
15
14
  import DropdownMenuItem from '../DropdownSelector/DropdownMenuItem'
16
15
  import { Meta, StoryObj } from '@storybook/react'
17
16
 
@@ -106,14 +105,31 @@ const M = (props: ModalProps) => {
106
105
  )
107
106
  }
108
107
 
109
- const ModalVStack = styled.div`
110
- display: grid;
111
- gap: 24px;
112
- `
108
+ const ModalVStack = (props: Omit<React.ComponentProps<'div'>, 'style'>) => {
109
+ return (
110
+ <div
111
+ style={{
112
+ display: 'grid',
113
+ gap: 24,
114
+ }}
115
+ {...props}
116
+ />
117
+ )
118
+ }
113
119
 
114
- const StyledModalText = styled(ModalAlign)`
115
- ${theme((o) => [o.font.text2, o.typography(14)])}
116
- `
120
+ const StyledModalText = (props: Omit<React.ComponentProps<'div'>, 'style'>) => {
121
+ return (
122
+ <div
123
+ style={{
124
+ fontSize: 14,
125
+ lineHeight: '22px',
126
+ padding: '0 16px',
127
+ color: 'var(--charcoal-text2)',
128
+ }}
129
+ {...props}
130
+ />
131
+ )
132
+ }
117
133
 
118
134
  export const Default: StoryObj<typeof Modal> = {}
119
135
 
@@ -201,6 +217,7 @@ export const BottomSheet: StoryObj<typeof Modal> = {
201
217
  </StyledModalText>
202
218
  </ModalVStack>
203
219
  <ModalButtons>
220
+ <Checkbox checked>test checkbox</Checkbox>
204
221
  <Button variant="Danger" onClick={() => state.close()} fullWidth>
205
222
  削除する
206
223
  </Button>
@@ -265,5 +282,3 @@ export const BackgroundScroll: StoryObj<typeof Modal> = {
265
282
  )
266
283
  },
267
284
  }
268
-
269
- export { InternalScrollStory as InternalScroll } from './__stories__/InternalScrollStory'
@@ -1,17 +1,17 @@
1
1
  import { useContext, forwardRef, memo } from 'react'
2
2
  import * as React from 'react'
3
3
  import { AriaModalOverlayProps, Overlay } from '@react-aria/overlays'
4
- import { useTheme } from 'styled-components'
5
4
  import type { AriaDialogProps } from '@react-types/dialog'
6
- import { maxWidth } from '@charcoal-ui/utils'
7
- import { useMedia } from '@charcoal-ui/styled'
8
5
  import { animated, useTransition, easings } from 'react-spring'
9
6
  import Button, { ButtonProps } from '../Button'
10
7
  import IconButton, { IconButtonProps } from '../IconButton'
11
8
  import { useObjectRef } from '@react-aria/utils'
12
9
  import { Dialog } from './Dialog'
13
10
  import { ModalBackgroundContext } from './ModalBackgroundContext'
14
- import { useCharcoalModalOverlay } from './useCustomModalOverlay'
11
+ import {
12
+ useCharcoalModalOverlay,
13
+ useWindowWidth,
14
+ } from './useCustomModalOverlay'
15
15
 
16
16
  import './index.css'
17
17
 
@@ -95,8 +95,7 @@ const Modal = forwardRef<HTMLDivElement, ModalProps>(function ModalInner(
95
95
  ref
96
96
  )
97
97
 
98
- const theme = useTheme()
99
- const isMobile = useMedia(maxWidth(theme.breakpoint.screen1)) ?? false
98
+ const isMobile = (useWindowWidth() ?? Infinity) < 744
100
99
  const transitionEnabled = isMobile && bottomSheet !== false
101
100
  const showDismiss = !isMobile || bottomSheet !== true
102
101
 
@@ -46,3 +46,23 @@ export function useCharcoalModalOverlay(
46
46
  underlayProps,
47
47
  }
48
48
  }
49
+
50
+ function isWindowDefined() {
51
+ return typeof window !== 'undefined'
52
+ }
53
+
54
+ export function useWindowWidth() {
55
+ const [width, setWidth] = React.useState(
56
+ isWindowDefined() ? window.innerWidth : null
57
+ )
58
+ React.useEffect(() => {
59
+ const handleResize = () => {
60
+ setWidth(window.innerWidth)
61
+ }
62
+ window.addEventListener('resize', handleResize)
63
+ return () => {
64
+ window.removeEventListener('resize', handleResize)
65
+ }
66
+ })
67
+ return width
68
+ }