@charcoal-ui/react 4.0.0-beta.2 → 4.0.0-beta.4
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/Button/index.d.ts +9 -1
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.d.ts +9 -20
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/CheckboxInput/index.d.ts +9 -0
- package/dist/components/CheckboxInput/index.d.ts.map +1 -0
- package/dist/components/DropdownSelector/Popover/index.d.ts +1 -2
- package/dist/components/DropdownSelector/Popover/index.d.ts.map +1 -1
- package/dist/components/DropdownSelector/index.d.ts +1 -1
- package/dist/components/DropdownSelector/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 +188 -418
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +86 -0
- package/dist/index.css.map +1 -1
- package/dist/index.esm.js +167 -397
- package/dist/index.esm.js.map +1 -1
- package/package.json +14 -17
- package/src/components/Button/__snapshots__/index.story.storyshot +11 -49
- package/src/components/Button/__snapshots__/index.test.tsx.snap +11 -0
- package/src/components/Button/index.story.tsx +13 -66
- package/src/components/Button/index.test.tsx +32 -0
- package/src/components/Button/index.tsx +11 -1
- package/src/components/Checkbox/__snapshots__/index.story.storyshot +163 -517
- package/src/components/Checkbox/index.css +21 -0
- package/src/components/Checkbox/index.story.tsx +44 -79
- package/src/components/Checkbox/index.tsx +19 -157
- package/src/components/CheckboxInput/__snapshots__/index.story.storyshot +109 -0
- package/src/components/CheckboxInput/index.css +77 -0
- package/src/components/CheckboxInput/index.story.tsx +35 -0
- package/src/components/CheckboxInput/index.tsx +53 -0
- package/src/components/DropdownSelector/Popover/index.tsx +1 -2
- package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +15 -0
- package/src/components/DropdownSelector/index.tsx +19 -4
- 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/__snapshots__/index.story.storyshot +2 -0
- 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 -24
- 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
|
@@ -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
|
>
|
|
@@ -949,6 +954,7 @@ exports[`Storybook Tests DropdownSelector InFormTag 1`] = `
|
|
|
949
954
|
>
|
|
950
955
|
<select
|
|
951
956
|
name="exampleOption"
|
|
957
|
+
onChange={[Function]}
|
|
952
958
|
tabIndex={-1}
|
|
953
959
|
value="1"
|
|
954
960
|
>
|
|
@@ -1708,6 +1714,7 @@ exports[`Storybook Tests DropdownSelector InModal 1`] = `
|
|
|
1708
1714
|
}
|
|
1709
1715
|
>
|
|
1710
1716
|
<select
|
|
1717
|
+
onChange={[Function]}
|
|
1711
1718
|
tabIndex={-1}
|
|
1712
1719
|
value="1"
|
|
1713
1720
|
>
|
|
@@ -1884,6 +1891,7 @@ exports[`Storybook Tests DropdownSelector InModal 1`] = `
|
|
|
1884
1891
|
}
|
|
1885
1892
|
>
|
|
1886
1893
|
<select
|
|
1894
|
+
onChange={[Function]}
|
|
1887
1895
|
tabIndex={-1}
|
|
1888
1896
|
value="2"
|
|
1889
1897
|
>
|
|
@@ -2062,6 +2070,7 @@ exports[`Storybook Tests DropdownSelector Invalid 1`] = `
|
|
|
2062
2070
|
}
|
|
2063
2071
|
>
|
|
2064
2072
|
<select
|
|
2073
|
+
onChange={[Function]}
|
|
2065
2074
|
tabIndex={-1}
|
|
2066
2075
|
value="1"
|
|
2067
2076
|
>
|
|
@@ -2248,6 +2257,7 @@ exports[`Storybook Tests DropdownSelector InvalidAssistiveText 1`] = `
|
|
|
2248
2257
|
}
|
|
2249
2258
|
>
|
|
2250
2259
|
<select
|
|
2260
|
+
onChange={[Function]}
|
|
2251
2261
|
tabIndex={-1}
|
|
2252
2262
|
value="1"
|
|
2253
2263
|
>
|
|
@@ -2512,6 +2522,7 @@ exports[`Storybook Tests DropdownSelector Label 1`] = `
|
|
|
2512
2522
|
}
|
|
2513
2523
|
>
|
|
2514
2524
|
<select
|
|
2525
|
+
onChange={[Function]}
|
|
2515
2526
|
tabIndex={-1}
|
|
2516
2527
|
value="1"
|
|
2517
2528
|
>
|
|
@@ -2668,6 +2679,7 @@ exports[`Storybook Tests DropdownSelector LongNames 1`] = `
|
|
|
2668
2679
|
}
|
|
2669
2680
|
>
|
|
2670
2681
|
<select
|
|
2682
|
+
onChange={[Function]}
|
|
2671
2683
|
tabIndex={-1}
|
|
2672
2684
|
value="1"
|
|
2673
2685
|
>
|
|
@@ -2964,6 +2976,7 @@ exports[`Storybook Tests DropdownSelector RequiredText 1`] = `
|
|
|
2964
2976
|
}
|
|
2965
2977
|
>
|
|
2966
2978
|
<select
|
|
2979
|
+
onChange={[Function]}
|
|
2967
2980
|
tabIndex={-1}
|
|
2968
2981
|
value="1"
|
|
2969
2982
|
>
|
|
@@ -3120,6 +3133,7 @@ exports[`Storybook Tests DropdownSelector Section 1`] = `
|
|
|
3120
3133
|
}
|
|
3121
3134
|
>
|
|
3122
3135
|
<select
|
|
3136
|
+
onChange={[Function]}
|
|
3123
3137
|
tabIndex={-1}
|
|
3124
3138
|
value="banana"
|
|
3125
3139
|
>
|
|
@@ -3401,6 +3415,7 @@ exports[`Storybook Tests DropdownSelector SubLabel 1`] = `
|
|
|
3401
3415
|
}
|
|
3402
3416
|
>
|
|
3403
3417
|
<select
|
|
3418
|
+
onChange={[Function]}
|
|
3404
3419
|
tabIndex={-1}
|
|
3405
3420
|
value="1"
|
|
3406
3421
|
>
|
|
@@ -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(
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
+
}
|
|
@@ -685,6 +685,7 @@ exports[`Storybook Tests Modal BackgroundScroll 1`] = `
|
|
|
685
685
|
}
|
|
686
686
|
>
|
|
687
687
|
<select
|
|
688
|
+
onChange={[Function]}
|
|
688
689
|
tabIndex={-1}
|
|
689
690
|
value="10"
|
|
690
691
|
>
|
|
@@ -1784,6 +1785,7 @@ exports[`Storybook Tests Modal Default 1`] = `
|
|
|
1784
1785
|
}
|
|
1785
1786
|
>
|
|
1786
1787
|
<select
|
|
1788
|
+
onChange={[Function]}
|
|
1787
1789
|
tabIndex={-1}
|
|
1788
1790
|
value="10"
|
|
1789
1791
|
>
|
|
@@ -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
|
|