@charcoal-ui/react 3.3.0 → 3.4.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 (59) hide show
  1. package/dist/_lib/useForwardedRef.d.ts +3 -0
  2. package/dist/_lib/useForwardedRef.d.ts.map +1 -0
  3. package/dist/components/Clickable/index.d.ts.map +1 -1
  4. package/dist/components/DropdownSelector/DropdownPopover.d.ts.map +1 -1
  5. package/dist/components/DropdownSelector/Popover/index.d.ts.map +1 -1
  6. package/dist/components/DropdownSelector/Popover/usePreventScroll.d.ts +2 -0
  7. package/dist/components/DropdownSelector/Popover/usePreventScroll.d.ts.map +1 -0
  8. package/dist/components/DropdownSelector/index.story.d.ts +1 -0
  9. package/dist/components/DropdownSelector/index.story.d.ts.map +1 -1
  10. package/dist/components/Icon/index.story.d.ts +1 -1
  11. package/dist/components/Modal/Dialog/index.d.ts +26 -0
  12. package/dist/components/Modal/Dialog/index.d.ts.map +1 -0
  13. package/dist/components/Modal/ModalBackgroundContext.d.ts +6 -0
  14. package/dist/components/Modal/ModalBackgroundContext.d.ts.map +1 -0
  15. package/dist/components/Modal/ModalPlumbing.d.ts.map +1 -1
  16. package/dist/components/Modal/__stories__/InternalScrollStory.d.ts +4 -0
  17. package/dist/components/Modal/__stories__/InternalScrollStory.d.ts.map +1 -0
  18. package/dist/components/Modal/index.d.ts +12 -2
  19. package/dist/components/Modal/index.d.ts.map +1 -1
  20. package/dist/components/Modal/index.story.d.ts +3 -2
  21. package/dist/components/Modal/index.story.d.ts.map +1 -1
  22. package/dist/index.cjs.js +388 -299
  23. package/dist/index.cjs.js.map +1 -1
  24. package/dist/index.esm.js +350 -262
  25. package/dist/index.esm.js.map +1 -1
  26. package/package.json +6 -6
  27. package/src/_lib/useForwardedRef.tsx +16 -0
  28. package/src/components/Button/__snapshots__/index.story.storyshot +1971 -0
  29. package/src/components/Checkbox/__snapshots__/index.story.storyshot +390 -0
  30. package/src/components/Clickable/__snapshots__/index.story.storyshot +100 -0
  31. package/src/components/Clickable/index.tsx +17 -35
  32. package/src/components/DropdownSelector/DropdownPopover.tsx +0 -1
  33. package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +245 -0
  34. package/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot +555 -0
  35. package/src/components/DropdownSelector/Popover/__snapshots__/index.story.storyshot +174 -0
  36. package/src/components/DropdownSelector/Popover/index.tsx +17 -2
  37. package/src/components/DropdownSelector/Popover/usePreventScroll.tsx +18 -0
  38. package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +1241 -0
  39. package/src/components/DropdownSelector/index.story.tsx +69 -13
  40. package/src/components/Icon/__snapshots__/index.story.storyshot +12 -0
  41. package/src/components/{Button/__snapshots__/index.test.tsx.snap → IconButton/__snapshots__/index.story.storyshot} +94 -91
  42. package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +81 -0
  43. package/src/components/Modal/Dialog/index.tsx +82 -0
  44. package/src/components/Modal/ModalBackgroundContext.tsx +8 -0
  45. package/src/components/Modal/ModalPlumbing.tsx +16 -4
  46. package/src/components/Modal/__snapshots__/index.story.storyshot +533 -0
  47. package/src/components/Modal/__stories__/InternalScrollStory.tsx +75 -0
  48. package/src/components/Modal/index.story.tsx +57 -38
  49. package/src/components/Modal/index.tsx +63 -94
  50. package/src/components/MultiSelect/__snapshots__/index.story.storyshot +511 -0
  51. package/src/components/Radio/__snapshots__/index.story.storyshot +319 -0
  52. package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +483 -0
  53. package/src/components/Switch/__snapshots__/index.story.storyshot +454 -0
  54. package/src/components/TagItem/__snapshots__/index.story.storyshot +1181 -0
  55. package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +1271 -0
  56. package/src/components/TextField/__snapshots__/TextField.story.storyshot +1800 -0
  57. package/dist/components/Button/index.test.d.ts +0 -4
  58. package/dist/components/Button/index.test.d.ts.map +0 -1
  59. package/src/components/Button/index.test.tsx +0 -24
@@ -0,0 +1,533 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Storyshots Modal Bottom Sheet 1`] = `
4
+ .c0 {
5
+ cursor: pointer;
6
+ -webkit-appearance: none;
7
+ -moz-appearance: none;
8
+ appearance: none;
9
+ background: transparent;
10
+ padding: 0;
11
+ border-style: none;
12
+ outline: none;
13
+ color: inherit;
14
+ text-rendering: inherit;
15
+ -webkit-letter-spacing: inherit;
16
+ -moz-letter-spacing: inherit;
17
+ -ms-letter-spacing: inherit;
18
+ letter-spacing: inherit;
19
+ word-spacing: inherit;
20
+ font: inherit;
21
+ margin: 0;
22
+ overflow: visible;
23
+ text-transform: none;
24
+ }
25
+
26
+ .c0:disabled,
27
+ .c0[aria-disabled]:not([aria-disabled=false]) {
28
+ cursor: default;
29
+ }
30
+
31
+ .c0:focus {
32
+ outline: none;
33
+ }
34
+
35
+ .c0::-moz-focus-inner {
36
+ border-style: none;
37
+ padding: 0;
38
+ }
39
+
40
+ .c1 {
41
+ width: -webkit-min-content;
42
+ width: -moz-min-content;
43
+ width: min-content;
44
+ display: inline-grid;
45
+ -webkit-align-items: center;
46
+ -webkit-box-align: center;
47
+ -ms-flex-align: center;
48
+ align-items: center;
49
+ -webkit-box-pack: center;
50
+ -webkit-justify-content: center;
51
+ -ms-flex-pack: center;
52
+ justify-content: center;
53
+ cursor: pointer;
54
+ -webkit-user-select: none;
55
+ -moz-user-select: none;
56
+ -ms-user-select: none;
57
+ user-select: none;
58
+ white-space: nowrap;
59
+ color: var(--charcoal-text2);
60
+ background-color: var(--charcoal-surface3);
61
+ font-size: 14px;
62
+ line-height: 22px;
63
+ font-weight: bold;
64
+ padding-right: 24px;
65
+ padding-left: 24px;
66
+ border-radius: 999999px;
67
+ -webkit-transition: 0.2s color,0.2s background-color,0.2s box-shadow;
68
+ transition: 0.2s color,0.2s background-color,0.2s box-shadow;
69
+ height: 40px;
70
+ }
71
+
72
+ .c1:hover:not(:disabled):not([aria-disabled]),
73
+ .c1:hover[aria-disabled=false] {
74
+ color: var(--charcoal-text2-hover);
75
+ }
76
+
77
+ .c1:active:not(:disabled):not([aria-disabled]),
78
+ .c1:active[aria-disabled=false] {
79
+ color: var(--charcoal-text2-press);
80
+ }
81
+
82
+ .c1:hover:not(:disabled):not([aria-disabled]),
83
+ .c1:hover[aria-disabled=false] {
84
+ background-color: var(--charcoal-surface3-hover);
85
+ }
86
+
87
+ .c1:active:not(:disabled):not([aria-disabled]),
88
+ .c1:active[aria-disabled=false] {
89
+ background-color: var(--charcoal-surface3-press);
90
+ }
91
+
92
+ .c1:disabled,
93
+ .c1[aria-disabled]:not([aria-disabled=false]) {
94
+ opacity: 0.32;
95
+ }
96
+
97
+ .c1:not(:disabled):not([aria-disabled]):focus,
98
+ .c1[aria-disabled=false]:focus,
99
+ .c1:not(:disabled):not([aria-disabled]):active,
100
+ .c1[aria-disabled=false]:active {
101
+ outline: none;
102
+ box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
103
+ }
104
+
105
+ .c1:not(:disabled):not([aria-disabled]):focus:not(:focus-visible),
106
+ .c1[aria-disabled=false]:focus:not(:focus-visible),
107
+ .c1:not(:disabled):not([aria-disabled]):active:not(:focus-visible),
108
+ .c1[aria-disabled=false]:active:not(:focus-visible) {
109
+ outline: none;
110
+ }
111
+
112
+ .c1:not(:disabled):not([aria-disabled]):focus-visible,
113
+ .c1[aria-disabled=false]:focus-visible {
114
+ outline: none;
115
+ box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
116
+ }
117
+
118
+ <div
119
+ data-dark={false}
120
+ >
121
+ <div
122
+ aria-hidden={null}
123
+ data-overlay-container={true}
124
+ >
125
+ <button
126
+ className="c0 c1"
127
+ disabled={false}
128
+ onClick={[Function]}
129
+ >
130
+ Open Modal
131
+ </button>
132
+ </div>
133
+ </div>
134
+ `;
135
+
136
+ exports[`Storyshots Modal Default 1`] = `
137
+ .c0 {
138
+ cursor: pointer;
139
+ -webkit-appearance: none;
140
+ -moz-appearance: none;
141
+ appearance: none;
142
+ background: transparent;
143
+ padding: 0;
144
+ border-style: none;
145
+ outline: none;
146
+ color: inherit;
147
+ text-rendering: inherit;
148
+ -webkit-letter-spacing: inherit;
149
+ -moz-letter-spacing: inherit;
150
+ -ms-letter-spacing: inherit;
151
+ letter-spacing: inherit;
152
+ word-spacing: inherit;
153
+ font: inherit;
154
+ margin: 0;
155
+ overflow: visible;
156
+ text-transform: none;
157
+ }
158
+
159
+ .c0:disabled,
160
+ .c0[aria-disabled]:not([aria-disabled=false]) {
161
+ cursor: default;
162
+ }
163
+
164
+ .c0:focus {
165
+ outline: none;
166
+ }
167
+
168
+ .c0::-moz-focus-inner {
169
+ border-style: none;
170
+ padding: 0;
171
+ }
172
+
173
+ .c1 {
174
+ width: -webkit-min-content;
175
+ width: -moz-min-content;
176
+ width: min-content;
177
+ display: inline-grid;
178
+ -webkit-align-items: center;
179
+ -webkit-box-align: center;
180
+ -ms-flex-align: center;
181
+ align-items: center;
182
+ -webkit-box-pack: center;
183
+ -webkit-justify-content: center;
184
+ -ms-flex-pack: center;
185
+ justify-content: center;
186
+ cursor: pointer;
187
+ -webkit-user-select: none;
188
+ -moz-user-select: none;
189
+ -ms-user-select: none;
190
+ user-select: none;
191
+ white-space: nowrap;
192
+ color: var(--charcoal-text2);
193
+ background-color: var(--charcoal-surface3);
194
+ font-size: 14px;
195
+ line-height: 22px;
196
+ font-weight: bold;
197
+ padding-right: 24px;
198
+ padding-left: 24px;
199
+ border-radius: 999999px;
200
+ -webkit-transition: 0.2s color,0.2s background-color,0.2s box-shadow;
201
+ transition: 0.2s color,0.2s background-color,0.2s box-shadow;
202
+ height: 40px;
203
+ }
204
+
205
+ .c1:hover:not(:disabled):not([aria-disabled]),
206
+ .c1:hover[aria-disabled=false] {
207
+ color: var(--charcoal-text2-hover);
208
+ }
209
+
210
+ .c1:active:not(:disabled):not([aria-disabled]),
211
+ .c1:active[aria-disabled=false] {
212
+ color: var(--charcoal-text2-press);
213
+ }
214
+
215
+ .c1:hover:not(:disabled):not([aria-disabled]),
216
+ .c1:hover[aria-disabled=false] {
217
+ background-color: var(--charcoal-surface3-hover);
218
+ }
219
+
220
+ .c1:active:not(:disabled):not([aria-disabled]),
221
+ .c1:active[aria-disabled=false] {
222
+ background-color: var(--charcoal-surface3-press);
223
+ }
224
+
225
+ .c1:disabled,
226
+ .c1[aria-disabled]:not([aria-disabled=false]) {
227
+ opacity: 0.32;
228
+ }
229
+
230
+ .c1:not(:disabled):not([aria-disabled]):focus,
231
+ .c1[aria-disabled=false]:focus,
232
+ .c1:not(:disabled):not([aria-disabled]):active,
233
+ .c1[aria-disabled=false]:active {
234
+ outline: none;
235
+ box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
236
+ }
237
+
238
+ .c1:not(:disabled):not([aria-disabled]):focus:not(:focus-visible),
239
+ .c1[aria-disabled=false]:focus:not(:focus-visible),
240
+ .c1:not(:disabled):not([aria-disabled]):active:not(:focus-visible),
241
+ .c1[aria-disabled=false]:active:not(:focus-visible) {
242
+ outline: none;
243
+ }
244
+
245
+ .c1:not(:disabled):not([aria-disabled]):focus-visible,
246
+ .c1[aria-disabled=false]:focus-visible {
247
+ outline: none;
248
+ box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
249
+ }
250
+
251
+ <div
252
+ data-dark={false}
253
+ >
254
+ <div
255
+ aria-hidden={null}
256
+ data-overlay-container={true}
257
+ >
258
+ <button
259
+ className="c0 c1"
260
+ disabled={false}
261
+ onClick={[Function]}
262
+ >
263
+ Open Modal
264
+ </button>
265
+ </div>
266
+ </div>
267
+ `;
268
+
269
+ exports[`Storyshots Modal Full Bottom Sheet 1`] = `
270
+ .c0 {
271
+ cursor: pointer;
272
+ -webkit-appearance: none;
273
+ -moz-appearance: none;
274
+ appearance: none;
275
+ background: transparent;
276
+ padding: 0;
277
+ border-style: none;
278
+ outline: none;
279
+ color: inherit;
280
+ text-rendering: inherit;
281
+ -webkit-letter-spacing: inherit;
282
+ -moz-letter-spacing: inherit;
283
+ -ms-letter-spacing: inherit;
284
+ letter-spacing: inherit;
285
+ word-spacing: inherit;
286
+ font: inherit;
287
+ margin: 0;
288
+ overflow: visible;
289
+ text-transform: none;
290
+ }
291
+
292
+ .c0:disabled,
293
+ .c0[aria-disabled]:not([aria-disabled=false]) {
294
+ cursor: default;
295
+ }
296
+
297
+ .c0:focus {
298
+ outline: none;
299
+ }
300
+
301
+ .c0::-moz-focus-inner {
302
+ border-style: none;
303
+ padding: 0;
304
+ }
305
+
306
+ .c1 {
307
+ width: -webkit-min-content;
308
+ width: -moz-min-content;
309
+ width: min-content;
310
+ display: inline-grid;
311
+ -webkit-align-items: center;
312
+ -webkit-box-align: center;
313
+ -ms-flex-align: center;
314
+ align-items: center;
315
+ -webkit-box-pack: center;
316
+ -webkit-justify-content: center;
317
+ -ms-flex-pack: center;
318
+ justify-content: center;
319
+ cursor: pointer;
320
+ -webkit-user-select: none;
321
+ -moz-user-select: none;
322
+ -ms-user-select: none;
323
+ user-select: none;
324
+ white-space: nowrap;
325
+ color: var(--charcoal-text2);
326
+ background-color: var(--charcoal-surface3);
327
+ font-size: 14px;
328
+ line-height: 22px;
329
+ font-weight: bold;
330
+ padding-right: 24px;
331
+ padding-left: 24px;
332
+ border-radius: 999999px;
333
+ -webkit-transition: 0.2s color,0.2s background-color,0.2s box-shadow;
334
+ transition: 0.2s color,0.2s background-color,0.2s box-shadow;
335
+ height: 40px;
336
+ }
337
+
338
+ .c1:hover:not(:disabled):not([aria-disabled]),
339
+ .c1:hover[aria-disabled=false] {
340
+ color: var(--charcoal-text2-hover);
341
+ }
342
+
343
+ .c1:active:not(:disabled):not([aria-disabled]),
344
+ .c1:active[aria-disabled=false] {
345
+ color: var(--charcoal-text2-press);
346
+ }
347
+
348
+ .c1:hover:not(:disabled):not([aria-disabled]),
349
+ .c1:hover[aria-disabled=false] {
350
+ background-color: var(--charcoal-surface3-hover);
351
+ }
352
+
353
+ .c1:active:not(:disabled):not([aria-disabled]),
354
+ .c1:active[aria-disabled=false] {
355
+ background-color: var(--charcoal-surface3-press);
356
+ }
357
+
358
+ .c1:disabled,
359
+ .c1[aria-disabled]:not([aria-disabled=false]) {
360
+ opacity: 0.32;
361
+ }
362
+
363
+ .c1:not(:disabled):not([aria-disabled]):focus,
364
+ .c1[aria-disabled=false]:focus,
365
+ .c1:not(:disabled):not([aria-disabled]):active,
366
+ .c1[aria-disabled=false]:active {
367
+ outline: none;
368
+ box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
369
+ }
370
+
371
+ .c1:not(:disabled):not([aria-disabled]):focus:not(:focus-visible),
372
+ .c1[aria-disabled=false]:focus:not(:focus-visible),
373
+ .c1:not(:disabled):not([aria-disabled]):active:not(:focus-visible),
374
+ .c1[aria-disabled=false]:active:not(:focus-visible) {
375
+ outline: none;
376
+ }
377
+
378
+ .c1:not(:disabled):not([aria-disabled]):focus-visible,
379
+ .c1[aria-disabled=false]:focus-visible {
380
+ outline: none;
381
+ box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
382
+ }
383
+
384
+ <div
385
+ data-dark={false}
386
+ >
387
+ <div
388
+ aria-hidden={null}
389
+ data-overlay-container={true}
390
+ >
391
+ <button
392
+ className="c0 c1"
393
+ disabled={false}
394
+ onClick={[Function]}
395
+ >
396
+ Open Modal
397
+ </button>
398
+ </div>
399
+ </div>
400
+ `;
401
+
402
+ exports[`Storyshots Modal Internal Scroll 1`] = `
403
+ .c0 {
404
+ cursor: pointer;
405
+ -webkit-appearance: none;
406
+ -moz-appearance: none;
407
+ appearance: none;
408
+ background: transparent;
409
+ padding: 0;
410
+ border-style: none;
411
+ outline: none;
412
+ color: inherit;
413
+ text-rendering: inherit;
414
+ -webkit-letter-spacing: inherit;
415
+ -moz-letter-spacing: inherit;
416
+ -ms-letter-spacing: inherit;
417
+ letter-spacing: inherit;
418
+ word-spacing: inherit;
419
+ font: inherit;
420
+ margin: 0;
421
+ overflow: visible;
422
+ text-transform: none;
423
+ }
424
+
425
+ .c0:disabled,
426
+ .c0[aria-disabled]:not([aria-disabled=false]) {
427
+ cursor: default;
428
+ }
429
+
430
+ .c0:focus {
431
+ outline: none;
432
+ }
433
+
434
+ .c0::-moz-focus-inner {
435
+ border-style: none;
436
+ padding: 0;
437
+ }
438
+
439
+ .c1 {
440
+ width: -webkit-min-content;
441
+ width: -moz-min-content;
442
+ width: min-content;
443
+ display: inline-grid;
444
+ -webkit-align-items: center;
445
+ -webkit-box-align: center;
446
+ -ms-flex-align: center;
447
+ align-items: center;
448
+ -webkit-box-pack: center;
449
+ -webkit-justify-content: center;
450
+ -ms-flex-pack: center;
451
+ justify-content: center;
452
+ cursor: pointer;
453
+ -webkit-user-select: none;
454
+ -moz-user-select: none;
455
+ -ms-user-select: none;
456
+ user-select: none;
457
+ white-space: nowrap;
458
+ color: var(--charcoal-text2);
459
+ background-color: var(--charcoal-surface3);
460
+ font-size: 14px;
461
+ line-height: 22px;
462
+ font-weight: bold;
463
+ padding-right: 24px;
464
+ padding-left: 24px;
465
+ border-radius: 999999px;
466
+ -webkit-transition: 0.2s color,0.2s background-color,0.2s box-shadow;
467
+ transition: 0.2s color,0.2s background-color,0.2s box-shadow;
468
+ height: 40px;
469
+ }
470
+
471
+ .c1:hover:not(:disabled):not([aria-disabled]),
472
+ .c1:hover[aria-disabled=false] {
473
+ color: var(--charcoal-text2-hover);
474
+ }
475
+
476
+ .c1:active:not(:disabled):not([aria-disabled]),
477
+ .c1:active[aria-disabled=false] {
478
+ color: var(--charcoal-text2-press);
479
+ }
480
+
481
+ .c1:hover:not(:disabled):not([aria-disabled]),
482
+ .c1:hover[aria-disabled=false] {
483
+ background-color: var(--charcoal-surface3-hover);
484
+ }
485
+
486
+ .c1:active:not(:disabled):not([aria-disabled]),
487
+ .c1:active[aria-disabled=false] {
488
+ background-color: var(--charcoal-surface3-press);
489
+ }
490
+
491
+ .c1:disabled,
492
+ .c1[aria-disabled]:not([aria-disabled=false]) {
493
+ opacity: 0.32;
494
+ }
495
+
496
+ .c1:not(:disabled):not([aria-disabled]):focus,
497
+ .c1[aria-disabled=false]:focus,
498
+ .c1:not(:disabled):not([aria-disabled]):active,
499
+ .c1[aria-disabled=false]:active {
500
+ outline: none;
501
+ box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
502
+ }
503
+
504
+ .c1:not(:disabled):not([aria-disabled]):focus:not(:focus-visible),
505
+ .c1[aria-disabled=false]:focus:not(:focus-visible),
506
+ .c1:not(:disabled):not([aria-disabled]):active:not(:focus-visible),
507
+ .c1[aria-disabled=false]:active:not(:focus-visible) {
508
+ outline: none;
509
+ }
510
+
511
+ .c1:not(:disabled):not([aria-disabled]):focus-visible,
512
+ .c1[aria-disabled=false]:focus-visible {
513
+ outline: none;
514
+ box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
515
+ }
516
+
517
+ <div
518
+ data-dark={false}
519
+ >
520
+ <div
521
+ aria-hidden={null}
522
+ data-overlay-container={true}
523
+ >
524
+ <button
525
+ className="c0 c1"
526
+ disabled={false}
527
+ onClick={[Function]}
528
+ >
529
+ Open Modal
530
+ </button>
531
+ </div>
532
+ </div>
533
+ `;
@@ -0,0 +1,75 @@
1
+ import { Story } from '../../../_lib/compat'
2
+ import Modal, { BottomSheet, ModalProps } from '..'
3
+ import { OverlayProvider } from '@react-aria/overlays'
4
+ import { useOverlayTriggerState } from 'react-stately'
5
+ import Button from '../../Button'
6
+ import { ModalBody, ModalButtons, ModalHeader } from '../ModalPlumbing'
7
+ import styled, { css } from 'styled-components'
8
+ import { maxWidth } from '@charcoal-ui/utils'
9
+
10
+ export const InternalScrollStory: Story<ModalProps> = (args: ModalProps) => {
11
+ const state = useOverlayTriggerState({})
12
+ return (
13
+ <OverlayProvider>
14
+ <Button onClick={() => state.open()}>Open Modal</Button>
15
+
16
+ <Modal {...args} isOpen={state.isOpen} onClose={() => state.close()}>
17
+ <ModalHeader />
18
+ <ModalBody>
19
+ <ModalBodyOverflowDiv $offset={56} $bottomSheet={args.bottomSheet}>
20
+ <div
21
+ style={{
22
+ height: 1000,
23
+ background: `linear-gradient(#e66465, #9198e5)`,
24
+ }}
25
+ ></div>
26
+ </ModalBodyOverflowDiv>
27
+ <TopBorderButtons>
28
+ <Button fullWidth onClick={() => state.close()}>
29
+ Close
30
+ </Button>
31
+ </TopBorderButtons>
32
+ </ModalBody>
33
+ </Modal>
34
+ </OverlayProvider>
35
+ )
36
+ }
37
+
38
+ // underlay padding-top: 40px (desktop)
39
+ // underlay padding-bottom: 40px (desktop)
40
+ // modal header: 64px (desktop)
41
+ // modal header: 48px (mobile-bottom-sheet)
42
+ // modal padding-bottom: 40px
43
+ // button and space: 56px
44
+ const MAX_HEIGHT_OFFSET = 64 + 40 + 40 + 40
45
+ const MAX_HEIGHT_OFFSET_MOBILE = MAX_HEIGHT_OFFSET - 40 * 2 - 16
46
+ const ModalBodyOverflowDiv = styled.div<{
47
+ $offset: number
48
+ $bottomSheet?: BottomSheet
49
+ }>`
50
+ overflow: auto;
51
+ max-height: calc(
52
+ 100vh - ${MAX_HEIGHT_OFFSET}px - ${({ $offset }) => $offset}px
53
+ );
54
+ ${({ $bottomSheet, $offset }) =>
55
+ ($bottomSheet === true || $bottomSheet === 'full') &&
56
+ css`
57
+ @media ${({ theme }) => maxWidth(theme.breakpoint.screen1)} {
58
+ max-height: calc(100vh - ${MAX_HEIGHT_OFFSET_MOBILE}px - ${$offset}px);
59
+ }
60
+ `}
61
+ `
62
+
63
+ const TopBorderButtons = styled(ModalButtons)`
64
+ position: relative;
65
+ &::before {
66
+ content: '';
67
+ pointer-events: none;
68
+ border-top: 1px solid ${({ theme }) => theme.border.default.color};
69
+ position: absolute;
70
+ left: 0;
71
+ top: 0;
72
+ width: 100%;
73
+ height: 100%;
74
+ }
75
+ `
@@ -12,6 +12,8 @@ import {
12
12
  import styled from 'styled-components'
13
13
  import { theme } from '../../styled'
14
14
  import TextField from '../TextField'
15
+ import DropdownSelector from '../DropdownSelector'
16
+ import DropdownMenuItem from '../DropdownSelector/DropdownMenuItem'
15
17
 
16
18
  export default {
17
19
  title: 'Modal',
@@ -43,51 +45,66 @@ const DefaultStory = (args: ModalProps) => {
43
45
  // hidden from screen readers when a modal opens.
44
46
  <OverlayProvider>
45
47
  <Button onClick={() => state.open()}>Open Modal</Button>
46
-
47
- <Modal
48
+ <M
48
49
  {...args}
50
+ isDismissable
49
51
  isOpen={state.isOpen}
50
52
  onClose={() => state.close()}
51
- isDismissable
52
- >
53
- <ModalHeader />
54
- <ModalBody>
55
- <ModalVStack>
56
- <StyledModalText>
57
- Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod
58
- placeat tenetur, necessitatibus laudantium cumque exercitationem
59
- provident. Quaerat iure enim, eveniet dolores earum odio quo
60
- possimus fugiat aspernatur, numquam, commodi repellat.
61
- </StyledModalText>
62
- <ModalAlign>
63
- <TextField
64
- showLabel
65
- label="Name"
66
- placeholder="Nagisa"
67
- ></TextField>
68
- </ModalAlign>
69
- <ModalAlign>
70
- <TextField
71
- showLabel
72
- label="Country"
73
- placeholder="Tokyo"
74
- ></TextField>
75
- </ModalAlign>
76
- </ModalVStack>
77
- <ModalButtons>
78
- <Button variant="Primary" onClick={() => state.close()} fullWidth>
79
- Apply
80
- </Button>
81
- <Button onClick={() => state.close()} fullWidth>
82
- Cancel
83
- </Button>
84
- </ModalButtons>
85
- </ModalBody>
86
- </Modal>
53
+ />
87
54
  </OverlayProvider>
88
55
  )
89
56
  }
90
57
 
58
+ const M = (props: ModalProps) => {
59
+ return (
60
+ <Modal {...props}>
61
+ <ModalHeader />
62
+ <ModalBody>
63
+ <ModalVStack>
64
+ <StyledModalText>
65
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod
66
+ placeat tenetur, necessitatibus laudantium cumque exercitationem
67
+ provident. Quaerat iure enim, eveniet dolores earum odio quo
68
+ possimus fugiat aspernatur, numquam, commodi repellat.
69
+ </StyledModalText>
70
+ <ModalAlign>
71
+ <TextField showLabel label="Name" placeholder="Nagisa"></TextField>
72
+ </ModalAlign>
73
+ <ModalAlign>
74
+ <TextField
75
+ autoFocus
76
+ showLabel
77
+ label="Country"
78
+ placeholder="Tokyo"
79
+ ></TextField>
80
+ </ModalAlign>
81
+ <ModalAlign>
82
+ <DropdownSelector
83
+ onChange={() => null}
84
+ value="10"
85
+ showLabel
86
+ label="Fruits"
87
+ placeholder="Apple"
88
+ >
89
+ <DropdownMenuItem value={'10'}>Apple</DropdownMenuItem>
90
+ <DropdownMenuItem value={'20'}>Banana</DropdownMenuItem>
91
+ <DropdownMenuItem value={'30'}>Orange</DropdownMenuItem>
92
+ </DropdownSelector>
93
+ </ModalAlign>
94
+ </ModalVStack>
95
+ <ModalButtons>
96
+ <Button variant="Primary" onClick={() => props.onClose()} fullWidth>
97
+ Apply
98
+ </Button>
99
+ <Button onClick={() => props.onClose()} fullWidth>
100
+ Cancel
101
+ </Button>
102
+ </ModalButtons>
103
+ </ModalBody>
104
+ </Modal>
105
+ )
106
+ }
107
+
91
108
  const ModalVStack = styled.div`
92
109
  display: grid;
93
110
  gap: 24px;
@@ -192,3 +209,5 @@ const BottomSheetStory = (args: ModalProps) => {
192
209
  }
193
210
 
194
211
  export const BottomSheet: Story<ModalProps> = BottomSheetStory.bind({})
212
+
213
+ export { InternalScrollStory as InternalScroll } from './__stories__/InternalScrollStory'