@charcoal-ui/react 3.10.1 → 3.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/DropdownSelector/Popover/index.d.ts +1 -2
- package/dist/components/DropdownSelector/Popover/index.d.ts.map +1 -1
- package/dist/components/Modal/index.d.ts +1 -1
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/Modal/useCustomModalOverlay.d.ts.map +1 -1
- package/dist/components/MultiSelect/index.d.ts.map +1 -1
- package/dist/components/Radio/index.d.ts +4 -4
- package/dist/components/Radio/index.d.ts.map +1 -1
- package/dist/components/TextArea/index.d.ts.map +1 -1
- package/dist/components/TextField/index.d.ts.map +1 -1
- package/dist/core/CharcoalProvider.d.ts +1 -1
- package/dist/core/CharcoalProvider.d.ts.map +1 -1
- package/dist/index.cjs.js +123 -351
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +85 -313
- package/dist/index.esm.js.map +1 -1
- package/package.json +13 -17
- package/src/components/Checkbox/__snapshots__/index.story.storyshot +601 -173
- package/src/components/Checkbox/index.story.tsx +57 -77
- package/src/components/Checkbox/index.tsx +7 -2
- package/src/components/DropdownSelector/Popover/index.tsx +1 -2
- package/src/components/IconButton/__snapshots__/index.story.storyshot +6 -8
- package/src/components/IconButton/index.story.tsx +14 -37
- package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +139 -1
- package/src/components/LoadingSpinner/index.story.tsx +18 -7
- package/src/components/Modal/index.tsx +1 -1
- package/src/components/Modal/useCustomModalOverlay.tsx +5 -4
- package/src/components/MultiSelect/__snapshots__/index.story.storyshot +32 -44
- package/src/components/MultiSelect/index.story.tsx +88 -192
- package/src/components/MultiSelect/index.tsx +2 -1
- package/src/components/Radio/__snapshots__/index.story.storyshot +1 -1
- package/src/components/Radio/index.story.tsx +20 -21
- package/src/components/Radio/index.tsx +14 -13
- package/src/components/Switch/__snapshots__/index.story.storyshot +8 -9
- package/src/components/Switch/index.story.tsx +10 -18
- package/src/components/TagItem/__snapshots__/index.story.storyshot +791 -665
- package/src/components/TagItem/index.story.tsx +44 -161
- package/src/components/TextArea/TextArea.story.tsx +62 -24
- package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +1858 -472
- package/src/components/TextArea/index.tsx +2 -0
- package/src/components/TextField/TextField.story.tsx +77 -67
- package/src/components/TextField/__snapshots__/TextField.story.storyshot +2004 -786
- package/src/components/TextField/index.tsx +2 -0
- package/src/components/a11y.test.tsx +1 -1
- package/src/core/CharcoalProvider.tsx +1 -1
- package/dist/components/Button/index.story.d.ts +0 -14
- package/dist/components/Button/index.story.d.ts.map +0 -1
- package/dist/components/Checkbox/index.story.d.ts +0 -8
- package/dist/components/Checkbox/index.story.d.ts.map +0 -1
- package/dist/components/Clickable/index.story.d.ts +0 -6
- package/dist/components/Clickable/index.story.d.ts.map +0 -1
- package/dist/components/DropdownSelector/ListItem/index.story.d.ts +0 -9
- package/dist/components/DropdownSelector/ListItem/index.story.d.ts.map +0 -1
- package/dist/components/DropdownSelector/MenuList/index.story.d.ts +0 -8
- package/dist/components/DropdownSelector/MenuList/index.story.d.ts.map +0 -1
- package/dist/components/DropdownSelector/Popover/index.story.d.ts +0 -5
- package/dist/components/DropdownSelector/Popover/index.story.d.ts.map +0 -1
- package/dist/components/DropdownSelector/index.story.d.ts +0 -19
- package/dist/components/DropdownSelector/index.story.d.ts.map +0 -1
- package/dist/components/Icon/index.story.d.ts +0 -6
- package/dist/components/Icon/index.story.d.ts.map +0 -1
- package/dist/components/IconButton/index.story.d.ts +0 -9
- package/dist/components/IconButton/index.story.d.ts.map +0 -1
- package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts +0 -8
- package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts.map +0 -1
- package/dist/components/LoadingSpinner/index.story.d.ts +0 -6
- package/dist/components/LoadingSpinner/index.story.d.ts.map +0 -1
- package/dist/components/Modal/index.story.d.ts +0 -21
- package/dist/components/Modal/index.story.d.ts.map +0 -1
- package/dist/components/MultiSelect/index.story.d.ts +0 -82
- package/dist/components/MultiSelect/index.story.d.ts.map +0 -1
- package/dist/components/MultiSelect/index.test.d.ts +0 -2
- package/dist/components/MultiSelect/index.test.d.ts.map +0 -1
- package/dist/components/Radio/index.story.d.ts +0 -26
- package/dist/components/Radio/index.story.d.ts.map +0 -1
- package/dist/components/Radio/index.test.d.ts +0 -2
- package/dist/components/Radio/index.test.d.ts.map +0 -1
- package/dist/components/SegmentedControl/index.story.d.ts +0 -7
- package/dist/components/SegmentedControl/index.story.d.ts.map +0 -1
- package/dist/components/Switch/index.story.d.ts +0 -9
- package/dist/components/Switch/index.story.d.ts.map +0 -1
- package/dist/components/TagItem/index.story.d.ts +0 -16
- package/dist/components/TagItem/index.story.d.ts.map +0 -1
- package/dist/components/TextArea/TextArea.story.d.ts +0 -9
- package/dist/components/TextArea/TextArea.story.d.ts.map +0 -1
- package/dist/components/TextField/TextField.story.d.ts +0 -22
- package/dist/components/TextField/TextField.story.d.ts.map +0 -1
- package/dist/components/a11y.test.d.ts +0 -2
- package/dist/components/a11y.test.d.ts.map +0 -1
- package/src/components/LoadingSpinner/LoadingSpinnerIcon.story.tsx +0 -13
|
@@ -1,103 +1,83 @@
|
|
|
1
|
-
import { action } from '@storybook/addon-actions'
|
|
2
1
|
import Checkbox from '.'
|
|
3
2
|
import { Meta, StoryObj } from '@storybook/react'
|
|
3
|
+
import { useCallback, useState } from 'react'
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
title: 'Checkbox',
|
|
7
7
|
component: Checkbox,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
},
|
|
8
11
|
} as Meta<typeof Checkbox>
|
|
9
12
|
|
|
10
|
-
export const
|
|
11
|
-
|
|
12
|
-
checked:
|
|
13
|
-
|
|
14
|
-
disabled:
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
export const Default: StoryObj<typeof Checkbox> = {
|
|
14
|
+
argTypes: {
|
|
15
|
+
checked: { type: 'boolean' },
|
|
16
|
+
children: { type: 'string' },
|
|
17
|
+
disabled: { type: 'boolean' },
|
|
18
|
+
invalid: { type: 'boolean' },
|
|
19
|
+
readonly: { type: 'boolean' },
|
|
17
20
|
},
|
|
18
|
-
render: (props)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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>
|
|
21
|
+
render: function Render(props) {
|
|
22
|
+
const [checked, setChecked] = useState(props.checked)
|
|
23
|
+
const handleChange = useCallback((isSelected: boolean) => {
|
|
24
|
+
setChecked(isSelected)
|
|
25
|
+
}, [])
|
|
34
26
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
onFocus={action('focus')}
|
|
44
|
-
>
|
|
45
|
-
<span style={{ width: 200, display: 'block' }}>
|
|
46
|
-
同意する同意する同意する同意する同意する同意する同意する同意する同意する同意する同意する同意する同意する
|
|
47
|
-
</span>
|
|
48
|
-
</Checkbox>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
27
|
+
return (
|
|
28
|
+
<Checkbox
|
|
29
|
+
{...props}
|
|
30
|
+
checked={props.checked ?? checked}
|
|
31
|
+
name="default"
|
|
32
|
+
label="label"
|
|
33
|
+
onChange={handleChange}
|
|
34
|
+
/>
|
|
51
35
|
)
|
|
52
36
|
},
|
|
53
37
|
}
|
|
54
38
|
|
|
55
|
-
export const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
defaultChecked: false,
|
|
59
|
-
disabled: false,
|
|
60
|
-
readonly: false,
|
|
39
|
+
export const Label: StoryObj<typeof Checkbox> = {
|
|
40
|
+
render: () => {
|
|
41
|
+
return <Checkbox name="checkbox">Checkbox</Checkbox>
|
|
61
42
|
},
|
|
62
|
-
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const Checked: StoryObj<typeof Checkbox> = {
|
|
46
|
+
render: () => {
|
|
63
47
|
return (
|
|
64
|
-
<Checkbox
|
|
65
|
-
|
|
66
|
-
name="labelled"
|
|
67
|
-
label="label"
|
|
68
|
-
invalid
|
|
69
|
-
onBlur={action('blur')}
|
|
70
|
-
onClick={action('click')}
|
|
71
|
-
onChange={action('change')}
|
|
72
|
-
onFocus={action('focus')}
|
|
73
|
-
>
|
|
74
|
-
同意する
|
|
48
|
+
<Checkbox name="checked" checked>
|
|
49
|
+
Checked
|
|
75
50
|
</Checkbox>
|
|
76
51
|
)
|
|
77
52
|
},
|
|
78
53
|
}
|
|
79
54
|
|
|
80
|
-
export const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
55
|
+
export const Disabled: StoryObj<typeof Checkbox> = {
|
|
56
|
+
render: () => {
|
|
57
|
+
return (
|
|
58
|
+
<Checkbox name="disabled" disabled>
|
|
59
|
+
Disabled
|
|
60
|
+
</Checkbox>
|
|
61
|
+
)
|
|
62
|
+
},
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export const ReadOnly: StoryObj<typeof Checkbox> = {
|
|
66
|
+
render: () => {
|
|
67
|
+
return (
|
|
68
|
+
<Checkbox checked name="readonly" readonly>
|
|
69
|
+
ReadOnly
|
|
70
|
+
</Checkbox>
|
|
71
|
+
)
|
|
87
72
|
},
|
|
88
|
-
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export const Invalid: StoryObj<typeof Checkbox> = {
|
|
76
|
+
render: () => {
|
|
89
77
|
return (
|
|
90
|
-
<
|
|
91
|
-
|
|
92
|
-
|
|
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>
|
|
78
|
+
<Checkbox name="invalid" invalid>
|
|
79
|
+
Invalid
|
|
80
|
+
</Checkbox>
|
|
101
81
|
)
|
|
102
82
|
},
|
|
103
83
|
}
|
|
@@ -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
|
)
|
|
@@ -53,7 +54,7 @@ const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
|
|
|
53
54
|
const objectRef = useObjectRef(ref)
|
|
54
55
|
|
|
55
56
|
const { inputProps } = useCheckbox(ariaCheckboxProps, state, objectRef)
|
|
56
|
-
const isDisabled =
|
|
57
|
+
const isDisabled = props.disabled ?? false
|
|
57
58
|
|
|
58
59
|
return (
|
|
59
60
|
<InputRoot aria-disabled={isDisabled} className={props.className}>
|
|
@@ -87,6 +88,9 @@ const InputRoot = styled.label`
|
|
|
87
88
|
cursor: pointer;
|
|
88
89
|
|
|
89
90
|
gap: 4px;
|
|
91
|
+
&:has(input[readonly]) {
|
|
92
|
+
cursor: default;
|
|
93
|
+
}
|
|
90
94
|
&:disabled,
|
|
91
95
|
&[aria-disabled]:not([aria-disabled='false']) {
|
|
92
96
|
cursor: default;
|
|
@@ -112,8 +116,9 @@ const CheckboxInput = styled.input`
|
|
|
112
116
|
&:disabled {
|
|
113
117
|
cursor: default;
|
|
114
118
|
}
|
|
115
|
-
|
|
119
|
+
&[readonly] {
|
|
116
120
|
cursor: default;
|
|
121
|
+
opacity: 0.32;
|
|
117
122
|
}
|
|
118
123
|
|
|
119
124
|
&:checked {
|
|
@@ -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'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`Storybook Tests IconButton
|
|
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="
|
|
106
|
+
title="add"
|
|
107
107
|
>
|
|
108
108
|
<pixiv-icon
|
|
109
|
-
name="
|
|
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="
|
|
214
|
+
name="16/Add"
|
|
216
215
|
/>
|
|
217
216
|
</button>
|
|
218
217
|
</div>
|
|
219
218
|
`;
|
|
220
219
|
|
|
221
|
-
exports[`Storybook Tests IconButton
|
|
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="
|
|
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
|
-
|
|
10
|
-
|
|
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
|
|
13
|
+
export const Default: StoryObj<typeof IconButton> = {
|
|
40
14
|
args: {
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
48
|
-
isActive
|
|
25
|
+
render: () => {
|
|
26
|
+
return <IconButton icon="16/Add" isActive />
|
|
49
27
|
},
|
|
50
28
|
}
|
|
51
29
|
|
|
52
|
-
export const
|
|
53
|
-
|
|
54
|
-
variant
|
|
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
|
|
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
|
+
}
|
|
@@ -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
|
-
|
|
33
|
-
|
|
31
|
+
usePreventScroll(
|
|
32
|
+
typeof document !== 'undefined' ? document.body : null,
|
|
33
|
+
state.isOpen
|
|
34
|
+
)
|
|
34
35
|
|
|
35
36
|
useOverlayFocusContain()
|
|
36
37
|
|