@charcoal-ui/react 3.10.1-beta.1 → 3.11.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 (98) hide show
  1. package/dist/components/Checkbox/index.d.ts.map +1 -1
  2. package/dist/components/DropdownSelector/Popover/index.d.ts +1 -2
  3. package/dist/components/DropdownSelector/Popover/index.d.ts.map +1 -1
  4. package/dist/components/DropdownSelector/index.d.ts +1 -1
  5. package/dist/components/DropdownSelector/index.d.ts.map +1 -1
  6. package/dist/components/Modal/index.d.ts +1 -1
  7. package/dist/components/Modal/index.d.ts.map +1 -1
  8. package/dist/components/Modal/useCustomModalOverlay.d.ts.map +1 -1
  9. package/dist/components/MultiSelect/index.d.ts.map +1 -1
  10. package/dist/components/Radio/index.d.ts +4 -4
  11. package/dist/components/Radio/index.d.ts.map +1 -1
  12. package/dist/components/TextArea/index.d.ts.map +1 -1
  13. package/dist/components/TextField/index.d.ts.map +1 -1
  14. package/dist/core/CharcoalProvider.d.ts +1 -1
  15. package/dist/core/CharcoalProvider.d.ts.map +1 -1
  16. package/dist/index.cjs.js +129 -351
  17. package/dist/index.cjs.js.map +1 -1
  18. package/dist/index.esm.js +95 -317
  19. package/dist/index.esm.js.map +1 -1
  20. package/package.json +13 -17
  21. package/src/components/Button/__snapshots__/index.story.storyshot +91 -939
  22. package/src/components/Button/index.story.tsx +14 -161
  23. package/src/components/Checkbox/__snapshots__/index.story.storyshot +560 -154
  24. package/src/components/Checkbox/index.story.tsx +46 -74
  25. package/src/components/Checkbox/index.tsx +1 -0
  26. package/src/components/DropdownSelector/Popover/index.tsx +1 -2
  27. package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +15 -0
  28. package/src/components/DropdownSelector/index.tsx +19 -4
  29. package/src/components/IconButton/__snapshots__/index.story.storyshot +6 -8
  30. package/src/components/IconButton/index.story.tsx +14 -37
  31. package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +139 -1
  32. package/src/components/LoadingSpinner/index.story.tsx +18 -7
  33. package/src/components/Modal/__snapshots__/index.story.storyshot +2 -0
  34. package/src/components/Modal/index.tsx +1 -1
  35. package/src/components/Modal/useCustomModalOverlay.tsx +5 -4
  36. package/src/components/MultiSelect/__snapshots__/index.story.storyshot +32 -44
  37. package/src/components/MultiSelect/index.story.tsx +88 -192
  38. package/src/components/MultiSelect/index.tsx +2 -1
  39. package/src/components/Radio/__snapshots__/index.story.storyshot +1 -1
  40. package/src/components/Radio/index.story.tsx +20 -21
  41. package/src/components/Radio/index.tsx +14 -13
  42. package/src/components/Switch/__snapshots__/index.story.storyshot +8 -9
  43. package/src/components/Switch/index.story.tsx +10 -18
  44. package/src/components/TagItem/__snapshots__/index.story.storyshot +791 -665
  45. package/src/components/TagItem/index.story.tsx +44 -161
  46. package/src/components/TextArea/TextArea.story.tsx +62 -24
  47. package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +1858 -472
  48. package/src/components/TextArea/index.tsx +2 -0
  49. package/src/components/TextField/TextField.story.tsx +77 -67
  50. package/src/components/TextField/__snapshots__/TextField.story.storyshot +2004 -786
  51. package/src/components/TextField/index.tsx +2 -0
  52. package/src/components/a11y.test.tsx +1 -1
  53. package/src/core/CharcoalProvider.tsx +1 -1
  54. package/dist/components/Button/index.story.d.ts +0 -19
  55. package/dist/components/Button/index.story.d.ts.map +0 -1
  56. package/dist/components/Checkbox/index.story.d.ts +0 -8
  57. package/dist/components/Checkbox/index.story.d.ts.map +0 -1
  58. package/dist/components/Clickable/index.story.d.ts +0 -6
  59. package/dist/components/Clickable/index.story.d.ts.map +0 -1
  60. package/dist/components/DropdownSelector/ListItem/index.story.d.ts +0 -9
  61. package/dist/components/DropdownSelector/ListItem/index.story.d.ts.map +0 -1
  62. package/dist/components/DropdownSelector/MenuList/index.story.d.ts +0 -8
  63. package/dist/components/DropdownSelector/MenuList/index.story.d.ts.map +0 -1
  64. package/dist/components/DropdownSelector/Popover/index.story.d.ts +0 -5
  65. package/dist/components/DropdownSelector/Popover/index.story.d.ts.map +0 -1
  66. package/dist/components/DropdownSelector/index.story.d.ts +0 -19
  67. package/dist/components/DropdownSelector/index.story.d.ts.map +0 -1
  68. package/dist/components/Icon/index.story.d.ts +0 -6
  69. package/dist/components/Icon/index.story.d.ts.map +0 -1
  70. package/dist/components/IconButton/index.story.d.ts +0 -9
  71. package/dist/components/IconButton/index.story.d.ts.map +0 -1
  72. package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts +0 -8
  73. package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts.map +0 -1
  74. package/dist/components/LoadingSpinner/index.story.d.ts +0 -6
  75. package/dist/components/LoadingSpinner/index.story.d.ts.map +0 -1
  76. package/dist/components/Modal/index.story.d.ts +0 -21
  77. package/dist/components/Modal/index.story.d.ts.map +0 -1
  78. package/dist/components/MultiSelect/index.story.d.ts +0 -82
  79. package/dist/components/MultiSelect/index.story.d.ts.map +0 -1
  80. package/dist/components/MultiSelect/index.test.d.ts +0 -2
  81. package/dist/components/MultiSelect/index.test.d.ts.map +0 -1
  82. package/dist/components/Radio/index.story.d.ts +0 -26
  83. package/dist/components/Radio/index.story.d.ts.map +0 -1
  84. package/dist/components/Radio/index.test.d.ts +0 -2
  85. package/dist/components/Radio/index.test.d.ts.map +0 -1
  86. package/dist/components/SegmentedControl/index.story.d.ts +0 -7
  87. package/dist/components/SegmentedControl/index.story.d.ts.map +0 -1
  88. package/dist/components/Switch/index.story.d.ts +0 -9
  89. package/dist/components/Switch/index.story.d.ts.map +0 -1
  90. package/dist/components/TagItem/index.story.d.ts +0 -16
  91. package/dist/components/TagItem/index.story.d.ts.map +0 -1
  92. package/dist/components/TextArea/TextArea.story.d.ts +0 -9
  93. package/dist/components/TextArea/TextArea.story.d.ts.map +0 -1
  94. package/dist/components/TextField/TextField.story.d.ts +0 -22
  95. package/dist/components/TextField/TextField.story.d.ts.map +0 -1
  96. package/dist/components/a11y.test.d.ts +0 -2
  97. package/dist/components/a11y.test.d.ts.map +0 -1
  98. package/src/components/LoadingSpinner/LoadingSpinnerIcon.story.tsx +0 -13
@@ -1,103 +1,75 @@
1
1
  import { action } from '@storybook/addon-actions'
2
2
  import Checkbox from '.'
3
3
  import { Meta, StoryObj } from '@storybook/react'
4
+ import { useCallback, useState } from 'react'
5
+ import styled from 'styled-components'
4
6
 
5
7
  export default {
6
8
  title: 'Checkbox',
7
9
  component: Checkbox,
8
10
  } as Meta<typeof Checkbox>
9
11
 
10
- export const Labelled: StoryObj<typeof Checkbox> = {
11
- args: {
12
- checked: false,
13
- defaultChecked: false,
14
- disabled: false,
15
- readonly: false,
16
- invalid: false,
17
- },
18
- render: (props) => {
19
- return (
20
- <div>
21
- <div style={{ marginBottom: '1em' }}>
22
- <Checkbox
23
- {...props}
24
- name="labelled"
25
- label="label"
26
- onBlur={action('blur')}
27
- onClick={action('click')}
28
- onChange={action('change')}
29
- onFocus={action('focus')}
30
- >
31
- 同意する
32
- </Checkbox>
33
- </div>
34
-
35
- <div>
36
- <Checkbox
37
- {...props}
38
- name="labelled"
39
- label="label"
40
- onBlur={action('blur')}
41
- onClick={action('click')}
42
- onChange={action('change')}
43
- onFocus={action('focus')}
44
- >
45
- <span style={{ width: 200, display: 'block' }}>
46
- 同意する同意する同意する同意する同意する同意する同意する同意する同意する同意する同意する同意する同意する
47
- </span>
48
- </Checkbox>
49
- </div>
50
- </div>
51
- )
52
- },
53
- }
12
+ const InnerText = styled.span`
13
+ user-select: none;
14
+ `
54
15
 
55
- export const Invalid: StoryObj<typeof Checkbox> = {
56
- args: {
57
- checked: false,
58
- defaultChecked: false,
59
- disabled: false,
60
- readonly: false,
61
- },
16
+ export const Default: StoryObj<typeof Checkbox> = {
62
17
  render: (props) => {
18
+ const [checked, setChecked] = useState(props.checked)
19
+ const handleChange = useCallback((isSelected: boolean) => {
20
+ setChecked(isSelected)
21
+ action('change')(isSelected)
22
+ }, [])
23
+
63
24
  return (
64
25
  <Checkbox
65
26
  {...props}
27
+ checked={checked ?? props.checked}
66
28
  name="labelled"
67
29
  label="label"
68
- invalid
69
30
  onBlur={action('blur')}
70
31
  onClick={action('click')}
71
- onChange={action('change')}
32
+ onChange={handleChange}
72
33
  onFocus={action('focus')}
73
- >
74
- 同意する
34
+ />
35
+ )
36
+ },
37
+ }
38
+
39
+ export const Label: StoryObj<typeof Checkbox> = {
40
+ render: () => {
41
+ return (
42
+ <Checkbox name="labelled">
43
+ <InnerText>同意する</InnerText>
75
44
  </Checkbox>
76
45
  )
77
46
  },
78
47
  }
79
48
 
80
- export const Unlabelled: StoryObj<typeof Checkbox> = {
81
- args: {
82
- checked: false,
83
- defaultChecked: false,
84
- disabled: false,
85
- readonly: false,
86
- invalid: false,
49
+ export const Checked: StoryObj<typeof Checkbox> = {
50
+ render: () => {
51
+ return <Checkbox name="labelled" label="同意する" checked />
87
52
  },
88
- render: (props) => {
53
+ }
54
+
55
+ export const Disabled: StoryObj<typeof Checkbox> = {
56
+ render: () => {
57
+ return <Checkbox name="labelled" label="同意する" disabled />
58
+ },
59
+ }
60
+
61
+ export const ReadOnly: StoryObj<typeof Checkbox> = {
62
+ render: () => {
63
+ return <Checkbox name="labelled" label="同意する" readonly />
64
+ },
65
+ }
66
+
67
+ export const Invalid: StoryObj<typeof Checkbox> = {
68
+ render: () => {
89
69
  return (
90
- <div>
91
- <Checkbox
92
- {...props}
93
- name="unlabelled"
94
- label="label"
95
- onBlur={action('blur')}
96
- onClick={action('click')}
97
- onChange={action('change')}
98
- onFocus={action('focus')}
99
- />
100
- </div>
70
+ <Checkbox name="labelled" invalid>
71
+ 同意する
72
+ </Checkbox>
101
73
  )
102
74
  },
103
75
  }
@@ -46,6 +46,7 @@ const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
46
46
  // children がいない場合は aria-label をつけないといけない
47
47
  'aria-label': 'children' in props ? undefined : props.label,
48
48
  isDisabled: props.disabled,
49
+ isReadOnly: props.readonly,
49
50
  }),
50
51
  [invalid, props]
51
52
  )
@@ -1,5 +1,4 @@
1
- import { RefObject, useContext, useRef } from 'react'
2
- import { ReactNode } from 'react'
1
+ import { RefObject, useContext, useRef, ReactNode } from 'react'
3
2
  import { DismissButton, Overlay, usePopover } from '@react-aria/overlays'
4
3
  import styled from 'styled-components'
5
4
  import { ModalBackgroundContext } from '../../Modal/ModalBackgroundContext'
@@ -140,6 +140,7 @@ exports[`Storybook Tests DropdownSelector AssistiveText 1`] = `
140
140
  }
141
141
  >
142
142
  <select
143
+ onChange={[Function]}
143
144
  tabIndex={-1}
144
145
  value="1"
145
146
  >
@@ -301,6 +302,7 @@ exports[`Storybook Tests DropdownSelector CustomChildren 1`] = `
301
302
  }
302
303
  >
303
304
  <select
305
+ onChange={[Function]}
304
306
  tabIndex={-1}
305
307
  value="bold"
306
308
  >
@@ -465,6 +467,7 @@ exports[`Storybook Tests DropdownSelector Default 1`] = `
465
467
  }
466
468
  >
467
469
  <select
470
+ onChange={[Function]}
468
471
  tabIndex={-1}
469
472
  value=""
470
473
  >
@@ -622,6 +625,7 @@ exports[`Storybook Tests DropdownSelector Disabled 1`] = `
622
625
  }
623
626
  >
624
627
  <select
628
+ onChange={[Function]}
625
629
  tabIndex={-1}
626
630
  value="1"
627
631
  >
@@ -779,6 +783,7 @@ exports[`Storybook Tests DropdownSelector DisabledItem 1`] = `
779
783
  }
780
784
  >
781
785
  <select
786
+ onChange={[Function]}
782
787
  tabIndex={-1}
783
788
  value="2"
784
789
  >
@@ -1052,6 +1057,7 @@ exports[`Storybook Tests DropdownSelector InFormTag 1`] = `
1052
1057
  >
1053
1058
  <select
1054
1059
  name="exampleOption"
1060
+ onChange={[Function]}
1055
1061
  tabIndex={-1}
1056
1062
  value="1"
1057
1063
  >
@@ -1811,6 +1817,7 @@ exports[`Storybook Tests DropdownSelector InModal 1`] = `
1811
1817
  }
1812
1818
  >
1813
1819
  <select
1820
+ onChange={[Function]}
1814
1821
  tabIndex={-1}
1815
1822
  value="1"
1816
1823
  >
@@ -1987,6 +1994,7 @@ exports[`Storybook Tests DropdownSelector InModal 1`] = `
1987
1994
  }
1988
1995
  >
1989
1996
  <select
1997
+ onChange={[Function]}
1990
1998
  tabIndex={-1}
1991
1999
  value="2"
1992
2000
  >
@@ -2165,6 +2173,7 @@ exports[`Storybook Tests DropdownSelector Invalid 1`] = `
2165
2173
  }
2166
2174
  >
2167
2175
  <select
2176
+ onChange={[Function]}
2168
2177
  tabIndex={-1}
2169
2178
  value="1"
2170
2179
  >
@@ -2351,6 +2360,7 @@ exports[`Storybook Tests DropdownSelector InvalidAssistiveText 1`] = `
2351
2360
  }
2352
2361
  >
2353
2362
  <select
2363
+ onChange={[Function]}
2354
2364
  tabIndex={-1}
2355
2365
  value="1"
2356
2366
  >
@@ -2615,6 +2625,7 @@ exports[`Storybook Tests DropdownSelector Label 1`] = `
2615
2625
  }
2616
2626
  >
2617
2627
  <select
2628
+ onChange={[Function]}
2618
2629
  tabIndex={-1}
2619
2630
  value="1"
2620
2631
  >
@@ -2771,6 +2782,7 @@ exports[`Storybook Tests DropdownSelector LongNames 1`] = `
2771
2782
  }
2772
2783
  >
2773
2784
  <select
2785
+ onChange={[Function]}
2774
2786
  tabIndex={-1}
2775
2787
  value="1"
2776
2788
  >
@@ -3067,6 +3079,7 @@ exports[`Storybook Tests DropdownSelector RequiredText 1`] = `
3067
3079
  }
3068
3080
  >
3069
3081
  <select
3082
+ onChange={[Function]}
3070
3083
  tabIndex={-1}
3071
3084
  value="1"
3072
3085
  >
@@ -3223,6 +3236,7 @@ exports[`Storybook Tests DropdownSelector Section 1`] = `
3223
3236
  }
3224
3237
  >
3225
3238
  <select
3239
+ onChange={[Function]}
3226
3240
  tabIndex={-1}
3227
3241
  value="banana"
3228
3242
  >
@@ -3504,6 +3518,7 @@ exports[`Storybook Tests DropdownSelector SubLabel 1`] = `
3504
3518
  }
3505
3519
  >
3506
3520
  <select
3521
+ onChange={[Function]}
3507
3522
  tabIndex={-1}
3508
3523
  value="1"
3509
3524
  >
@@ -1,4 +1,4 @@
1
- import { ReactNode, useState, useRef, useMemo } from 'react'
1
+ import React, { ReactNode, useState, useRef, useMemo, useCallback } from 'react'
2
2
  import styled, { css } from 'styled-components'
3
3
  import { disabledSelector } from '@charcoal-ui/utils'
4
4
  import Icon from '../Icon'
@@ -31,7 +31,10 @@ export type DropdownSelectorProps = {
31
31
 
32
32
  const defaultRequiredText = '*必須'
33
33
 
34
- export default function DropdownSelector(props: DropdownSelectorProps) {
34
+ export default function DropdownSelector({
35
+ onChange,
36
+ ...props
37
+ }: DropdownSelectorProps) {
35
38
  const triggerRef = useRef<HTMLButtonElement>(null)
36
39
  const [isOpen, setIsOpen] = useState(false)
37
40
  const preview = findPreviewRecursive(props.children, props.value)
@@ -45,6 +48,13 @@ export default function DropdownSelector(props: DropdownSelectorProps) {
45
48
 
46
49
  const { visuallyHiddenProps } = useVisuallyHidden()
47
50
 
51
+ const handleChange = useCallback(
52
+ (e: React.ChangeEvent<HTMLSelectElement>) => {
53
+ onChange(e.target.value)
54
+ },
55
+ [onChange]
56
+ )
57
+
48
58
  return (
49
59
  <DropdownSelectorRoot aria-disabled={props.disabled}>
50
60
  {props.showLabel === true && (
@@ -56,7 +66,12 @@ export default function DropdownSelector(props: DropdownSelectorProps) {
56
66
  />
57
67
  )}
58
68
  <div {...visuallyHiddenProps} aria-hidden="true">
59
- <select name={props.name} value={props.value} tabIndex={-1}>
69
+ <select
70
+ name={props.name}
71
+ value={props.value}
72
+ onChange={handleChange}
73
+ tabIndex={-1}
74
+ >
60
75
  {propsArray.map((itemProps) => {
61
76
  return (
62
77
  <option
@@ -96,7 +111,7 @@ export default function DropdownSelector(props: DropdownSelectorProps) {
96
111
  <MenuList
97
112
  value={props.value}
98
113
  onChange={(v) => {
99
- props.onChange(v)
114
+ onChange(v)
100
115
  setIsOpen(false)
101
116
  }}
102
117
  >
@@ -1,6 +1,6 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`Storybook Tests IconButton DefaultM 1`] = `
3
+ exports[`Storybook Tests IconButton Default 1`] = `
4
4
  .c0 {
5
5
  cursor: pointer;
6
6
  -webkit-appearance: none;
@@ -103,10 +103,10 @@ exports[`Storybook Tests IconButton DefaultM 1`] = `
103
103
  >
104
104
  <button
105
105
  className="c0 c1"
106
- title="close"
106
+ title="add"
107
107
  >
108
108
  <pixiv-icon
109
- name="24/Close"
109
+ name="16/Add"
110
110
  />
111
111
  </button>
112
112
  </div>
@@ -209,16 +209,15 @@ exports[`Storybook Tests IconButton IsActive 1`] = `
209
209
  >
210
210
  <button
211
211
  className="c0 c1"
212
- title="close"
213
212
  >
214
213
  <pixiv-icon
215
- name="24/Close"
214
+ name="16/Add"
216
215
  />
217
216
  </button>
218
217
  </div>
219
218
  `;
220
219
 
221
- exports[`Storybook Tests IconButton OverlayM 1`] = `
220
+ exports[`Storybook Tests IconButton Overlay 1`] = `
222
221
  .c0 {
223
222
  cursor: pointer;
224
223
  -webkit-appearance: none;
@@ -321,10 +320,9 @@ exports[`Storybook Tests IconButton OverlayM 1`] = `
321
320
  >
322
321
  <button
323
322
  className="c0 c1"
324
- title="close"
325
323
  >
326
324
  <pixiv-icon
327
- name="24/Close"
325
+ name="16/Add"
328
326
  />
329
327
  </button>
330
328
  </div>
@@ -1,57 +1,34 @@
1
1
  import '@charcoal-ui/icons'
2
2
  import IconButton from '.'
3
- import type { KnownIconType } from '@charcoal-ui/icons'
4
3
  import { Meta, StoryObj } from '@storybook/react'
5
4
 
6
5
  export default {
7
6
  title: 'IconButton',
8
7
  component: IconButton,
9
- argTypes: {
10
- variant: {
11
- control: {
12
- type: 'inline-radio',
13
- options: ['Default', 'Overlay'],
14
- },
15
- },
16
- size: {
17
- control: {
18
- type: 'inline-radio',
19
- options: ['M', 'S', 'XS'],
20
- },
21
- },
22
- isActive: {
23
- control: {
24
- type: 'boolean',
25
- },
26
- },
27
- },
28
- render: (props) => {
29
- const { size } = props
30
- const icon: keyof KnownIconType = {
31
- XS: '16/Remove' as const,
32
- S: '24/Close' as const,
33
- M: '24/Close' as const,
34
- }[size ?? 'M']
35
- return <IconButton title="close" {...props} icon={icon} />
8
+ parameters: {
9
+ layout: 'centered',
36
10
  },
37
11
  } as Meta<typeof IconButton>
38
12
 
39
- export const DefaultM: StoryObj<typeof IconButton> = {
13
+ export const Default: StoryObj<typeof IconButton> = {
40
14
  args: {
41
- variant: 'Default',
42
- size: 'M',
15
+ icon: '16/Add',
16
+ },
17
+ render: (props) => {
18
+ const title = props.icon.split('/').at(1)?.toLocaleLowerCase()
19
+
20
+ return <IconButton title={title} {...props} />
43
21
  },
44
22
  }
45
23
 
46
24
  export const IsActive: StoryObj<typeof IconButton> = {
47
- args: {
48
- isActive: true,
25
+ render: () => {
26
+ return <IconButton icon="16/Add" isActive />
49
27
  },
50
28
  }
51
29
 
52
- export const OverlayM: StoryObj<typeof IconButton> = {
53
- args: {
54
- variant: 'Overlay',
55
- size: 'M',
30
+ export const Overlay: StoryObj<typeof IconButton> = {
31
+ render: () => {
32
+ return <IconButton icon="16/Add" variant="Overlay" />
56
33
  },
57
34
  }
@@ -34,7 +34,145 @@ exports[`Storybook Tests LoadingSpinner Default 1`] = `
34
34
  data-dark={false}
35
35
  >
36
36
  <div
37
- className="c0 basic"
37
+ className="c0"
38
+ role="progressbar"
39
+ size={48}
40
+ >
41
+ <div
42
+ className="c1"
43
+ role="presentation"
44
+ />
45
+ </div>
46
+ </div>
47
+ `;
48
+
49
+ exports[`Storybook Tests LoadingSpinner Padding 1`] = `
50
+ .c0 {
51
+ box-sizing: content-box;
52
+ margin: auto;
53
+ padding: 24px;
54
+ border-radius: 8px;
55
+ font-size: 48px;
56
+ width: 48px;
57
+ height: 48px;
58
+ opacity: 0.84;
59
+ color: var(--charcoal-text4);
60
+ background-color: var(--charcoal-background1);
61
+ }
62
+
63
+ .c1 {
64
+ width: 1em;
65
+ height: 1em;
66
+ border-radius: 1em;
67
+ background-color: currentColor;
68
+ -webkit-animation: cNZOgq 1s both ease-out;
69
+ animation: cNZOgq 1s both ease-out;
70
+ -webkit-animation-iteration-count: infinite;
71
+ animation-iteration-count: infinite;
72
+ }
73
+
74
+ .c1[data-reset-animation] {
75
+ -webkit-animation: none;
76
+ animation: none;
77
+ }
78
+
79
+ <div
80
+ data-dark={false}
81
+ >
82
+ <div
83
+ className="c0"
84
+ role="progressbar"
85
+ size={48}
86
+ >
87
+ <div
88
+ className="c1"
89
+ role="presentation"
90
+ />
91
+ </div>
92
+ </div>
93
+ `;
94
+
95
+ exports[`Storybook Tests LoadingSpinner Size 1`] = `
96
+ .c0 {
97
+ box-sizing: content-box;
98
+ margin: auto;
99
+ padding: 16px;
100
+ border-radius: 8px;
101
+ font-size: 128px;
102
+ width: 128px;
103
+ height: 128px;
104
+ opacity: 0.84;
105
+ color: var(--charcoal-text4);
106
+ background-color: var(--charcoal-background1);
107
+ }
108
+
109
+ .c1 {
110
+ width: 1em;
111
+ height: 1em;
112
+ border-radius: 1em;
113
+ background-color: currentColor;
114
+ -webkit-animation: cNZOgq 1s both ease-out;
115
+ animation: cNZOgq 1s both ease-out;
116
+ -webkit-animation-iteration-count: infinite;
117
+ animation-iteration-count: infinite;
118
+ }
119
+
120
+ .c1[data-reset-animation] {
121
+ -webkit-animation: none;
122
+ animation: none;
123
+ }
124
+
125
+ <div
126
+ data-dark={false}
127
+ >
128
+ <div
129
+ className="c0"
130
+ role="progressbar"
131
+ size={128}
132
+ >
133
+ <div
134
+ className="c1"
135
+ role="presentation"
136
+ />
137
+ </div>
138
+ </div>
139
+ `;
140
+
141
+ exports[`Storybook Tests LoadingSpinner Transparent 1`] = `
142
+ .c0 {
143
+ box-sizing: content-box;
144
+ margin: auto;
145
+ padding: 16px;
146
+ border-radius: 8px;
147
+ font-size: 48px;
148
+ width: 48px;
149
+ height: 48px;
150
+ opacity: 0.84;
151
+ color: var(--charcoal-text4);
152
+ background-color: var(--charcoal-transparent);
153
+ }
154
+
155
+ .c1 {
156
+ width: 1em;
157
+ height: 1em;
158
+ border-radius: 1em;
159
+ background-color: currentColor;
160
+ -webkit-animation: cNZOgq 1s both ease-out;
161
+ animation: cNZOgq 1s both ease-out;
162
+ -webkit-animation-iteration-count: infinite;
163
+ animation-iteration-count: infinite;
164
+ }
165
+
166
+ .c1[data-reset-animation] {
167
+ -webkit-animation: none;
168
+ animation: none;
169
+ }
170
+
171
+ <div
172
+ data-dark={false}
173
+ >
174
+ <div
175
+ className="c0"
38
176
  role="progressbar"
39
177
  size={48}
40
178
  >
@@ -4,13 +4,24 @@ import LoadingSpinner from '.'
4
4
  export default {
5
5
  title: 'LoadingSpinner',
6
6
  component: LoadingSpinner,
7
- args: {
8
- size: 48,
9
- padding: 16,
10
- transparent: false,
11
- className: 'basic',
12
- },
13
7
  tags: ['skip-test'],
8
+ parameters: {
9
+ layout: 'centered',
10
+ },
14
11
  } as Meta<typeof LoadingSpinner>
15
12
 
16
- export const Default: StoryObj<typeof LoadingSpinner> = {}
13
+ export const Default: StoryObj<typeof LoadingSpinner> = {
14
+ render: (props) => <LoadingSpinner {...props} />,
15
+ }
16
+
17
+ export const Transparent: StoryObj<typeof LoadingSpinner> = {
18
+ render: () => <LoadingSpinner transparent />,
19
+ }
20
+
21
+ export const Size: StoryObj<typeof LoadingSpinner> = {
22
+ render: () => <LoadingSpinner size={128} />,
23
+ }
24
+
25
+ export const Padding: StoryObj<typeof LoadingSpinner> = {
26
+ render: () => <LoadingSpinner padding={24} />,
27
+ }
@@ -881,6 +881,7 @@ exports[`Storybook Tests Modal BackgroundScroll 1`] = `
881
881
  }
882
882
  >
883
883
  <select
884
+ onChange={[Function]}
884
885
  tabIndex={-1}
885
886
  value="10"
886
887
  >
@@ -2305,6 +2306,7 @@ exports[`Storybook Tests Modal Default 1`] = `
2305
2306
  }
2306
2307
  >
2307
2308
  <select
2309
+ onChange={[Function]}
2308
2310
  tabIndex={-1}
2309
2311
  value="10"
2310
2312
  >
@@ -2,7 +2,7 @@ import { useContext, forwardRef, memo } from 'react'
2
2
  import * as React from 'react'
3
3
  import { AriaModalOverlayProps, Overlay } from '@react-aria/overlays'
4
4
  import styled, { css, useTheme } from 'styled-components'
5
- import { AriaDialogProps } from '@react-types/dialog'
5
+ import type { AriaDialogProps } from '@react-types/dialog'
6
6
  import { maxWidth } from '@charcoal-ui/utils'
7
7
  import { useMedia } from '@charcoal-ui/styled'
8
8
  import { animated, useTransition, easings } from 'react-spring'
@@ -5,8 +5,8 @@ import {
5
5
  ariaHideOutside,
6
6
  useOverlay,
7
7
  useOverlayFocusContain,
8
- usePreventScroll,
9
8
  } from '@react-aria/overlays'
9
+ import { usePreventScroll } from '../DropdownSelector/Popover/usePreventScroll'
10
10
 
11
11
  /**
12
12
  * We want to enable scrolling on the modal background,
@@ -28,9 +28,10 @@ export function useCharcoalModalOverlay(
28
28
  ref
29
29
  )
30
30
 
31
- usePreventScroll({
32
- isDisabled: !state.isOpen,
33
- })
31
+ usePreventScroll(
32
+ typeof document !== 'undefined' ? document.body : null,
33
+ state.isOpen
34
+ )
34
35
 
35
36
  useOverlayFocusContain()
36
37