@charcoal-ui/react 3.6.0 → 3.8.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/_lib/compat.d.ts +1 -0
- package/dist/_lib/compat.d.ts.map +1 -1
- package/dist/components/Button/StyledButton.d.ts +13 -0
- package/dist/components/Button/StyledButton.d.ts.map +1 -0
- package/dist/components/Button/index.d.ts +3 -2
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.story.d.ts +16 -32
- package/dist/components/Button/index.story.d.ts.map +1 -1
- package/dist/components/Button/lib/variantToBackground.d.ts +3 -0
- package/dist/components/Button/lib/variantToBackground.d.ts.map +1 -0
- package/dist/components/Button/lib/variantToFont.d.ts +3 -0
- package/dist/components/Button/lib/variantToFont.d.ts.map +1 -0
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.story.d.ts +6 -16
- package/dist/components/Checkbox/index.story.d.ts.map +1 -1
- package/dist/components/Clickable/index.story.d.ts +4 -6
- package/dist/components/Clickable/index.story.d.ts.map +1 -1
- package/dist/components/DropdownSelector/ListItem/index.story.d.ts +7 -7
- package/dist/components/DropdownSelector/ListItem/index.story.d.ts.map +1 -1
- package/dist/components/DropdownSelector/MenuList/index.story.d.ts +6 -9
- package/dist/components/DropdownSelector/MenuList/index.story.d.ts.map +1 -1
- package/dist/components/DropdownSelector/Popover/index.story.d.ts +3 -7
- package/dist/components/DropdownSelector/Popover/index.story.d.ts.map +1 -1
- package/dist/components/DropdownSelector/index.d.ts.map +1 -1
- package/dist/components/DropdownSelector/index.story.d.ts +9 -11
- package/dist/components/DropdownSelector/index.story.d.ts.map +1 -1
- package/dist/components/Icon/index.story.d.ts +4 -26
- package/dist/components/Icon/index.story.d.ts.map +1 -1
- package/dist/components/IconButton/index.d.ts +1 -0
- package/dist/components/IconButton/index.d.ts.map +1 -1
- package/dist/components/IconButton/index.story.d.ts +6 -25
- package/dist/components/IconButton/index.story.d.ts.map +1 -1
- package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts +8 -0
- package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts.map +1 -0
- package/dist/components/LoadingSpinner/index.d.ts +2 -2
- package/dist/components/LoadingSpinner/index.d.ts.map +1 -1
- package/dist/components/LoadingSpinner/index.story.d.ts +4 -7
- package/dist/components/LoadingSpinner/index.story.d.ts.map +1 -1
- package/dist/components/Modal/index.story.d.ts +16 -41
- package/dist/components/Modal/index.story.d.ts.map +1 -1
- package/dist/components/MultiSelect/index.d.ts.map +1 -1
- package/dist/components/Radio/index.d.ts +0 -2
- package/dist/components/Radio/index.d.ts.map +1 -1
- package/dist/components/Radio/index.story.d.ts +12 -23
- package/dist/components/Radio/index.story.d.ts.map +1 -1
- package/dist/components/SegmentedControl/RadioGroupContext.d.ts +1 -1
- package/dist/components/SegmentedControl/RadioGroupContext.d.ts.map +1 -1
- package/dist/components/SegmentedControl/index.story.d.ts +5 -8
- package/dist/components/SegmentedControl/index.story.d.ts.map +1 -1
- package/dist/components/Switch/index.d.ts.map +1 -1
- package/dist/components/Switch/index.story.d.ts +7 -12
- package/dist/components/Switch/index.story.d.ts.map +1 -1
- package/dist/components/TagItem/index.d.ts.map +1 -1
- package/dist/components/TagItem/index.story.d.ts +14 -24
- package/dist/components/TagItem/index.story.d.ts.map +1 -1
- package/dist/components/TextArea/TextArea.story.d.ts +7 -25
- package/dist/components/TextArea/TextArea.story.d.ts.map +1 -1
- package/dist/components/TextField/TextField.story.d.ts +13 -20
- package/dist/components/TextField/TextField.story.d.ts.map +1 -1
- package/dist/components/TextField/index.d.ts.map +1 -1
- package/dist/index.cjs.js +418 -206
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +387 -175
- package/dist/index.esm.js.map +1 -1
- package/dist/styled.d.ts +4 -4
- package/package.json +17 -20
- package/src/_lib/compat.ts +8 -0
- package/src/components/Button/StyledButton.tsx +71 -0
- package/src/components/Button/__snapshots__/index.story.storyshot +314 -118
- package/src/components/Button/index.story.tsx +141 -138
- package/src/components/Button/index.tsx +15 -104
- package/src/components/Button/lib/variantToBackground.tsx +19 -0
- package/src/components/Button/lib/variantToFont.tsx +19 -0
- package/src/components/Checkbox/__snapshots__/index.story.storyshot +12 -27
- package/src/components/Checkbox/index.story.tsx +82 -88
- package/src/components/Checkbox/index.tsx +2 -12
- package/src/components/Clickable/__snapshots__/index.story.storyshot +2 -2
- package/src/components/Clickable/index.story.tsx +12 -9
- package/src/components/DropdownSelector/DropdownMenuItem.tsx +1 -14
- package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +42 -37
- package/src/components/DropdownSelector/ListItem/index.story.tsx +8 -4
- package/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot +38 -38
- package/src/components/DropdownSelector/MenuList/index.story.tsx +33 -27
- package/src/components/DropdownSelector/Popover/__snapshots__/index.story.storyshot +11 -5
- package/src/components/DropdownSelector/Popover/index.story.tsx +6 -6
- package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +313 -151
- package/src/components/DropdownSelector/index.story.tsx +207 -171
- package/src/components/DropdownSelector/index.tsx +22 -22
- package/src/components/Icon/__snapshots__/index.story.storyshot +1 -1
- package/src/components/Icon/index.story.tsx +8 -12
- package/src/components/IconButton/__snapshots__/index.story.storyshot +130 -13
- package/src/components/IconButton/index.story.tsx +30 -23
- package/src/components/IconButton/index.tsx +32 -20
- package/src/components/LoadingSpinner/LoadingSpinnerIcon.story.tsx +12 -0
- package/src/components/LoadingSpinner/__snapshots__/LoadingSpinnerIcon.story.storyshot +28 -0
- package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +1 -35
- package/src/components/LoadingSpinner/index.story.tsx +11 -54
- package/src/components/LoadingSpinner/index.tsx +1 -1
- package/src/components/Modal/__snapshots__/index.story.storyshot +231 -194
- package/src/components/Modal/index.story.tsx +139 -133
- package/src/components/MultiSelect/__snapshots__/index.story.storyshot +56 -4
- package/src/components/MultiSelect/index.tsx +3 -0
- package/src/components/Radio/__snapshots__/index.story.storyshot +981 -121
- package/src/components/Radio/index.story.tsx +128 -63
- package/src/components/Radio/index.tsx +10 -16
- package/src/components/SegmentedControl/RadioGroupContext.tsx +1 -1
- package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +11 -11
- package/src/components/SegmentedControl/index.story.tsx +24 -29
- package/src/components/SegmentedControl/index.tsx +1 -1
- package/src/components/Switch/__snapshots__/index.story.storyshot +184 -26
- package/src/components/Switch/index.story.tsx +72 -48
- package/src/components/Switch/index.tsx +2 -7
- package/src/components/TagItem/__snapshots__/index.story.storyshot +72 -33
- package/src/components/TagItem/index.story.tsx +154 -159
- package/src/components/TagItem/index.tsx +2 -6
- package/src/components/TextArea/TextArea.story.tsx +29 -32
- package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +139 -83
- package/src/components/TextField/TextField.story.tsx +67 -66
- package/src/components/TextField/__snapshots__/TextField.story.storyshot +198 -162
- package/src/components/TextField/index.tsx +0 -7
- package/dist/components/Checkbox/performance.test.d.ts +0 -4
- package/dist/components/Checkbox/performance.test.d.ts.map +0 -1
- package/dist/components/Checkbox/snapshot.test.d.ts +0 -2
- package/dist/components/Checkbox/snapshot.test.d.ts.map +0 -1
- package/src/components/Checkbox/__snapshots__/snapshot.test.tsx.snap +0 -1093
- package/src/components/Checkbox/performance.test.tsx +0 -30
- package/src/components/Checkbox/snapshot.test.tsx +0 -66
|
@@ -1,109 +1,103 @@
|
|
|
1
1
|
import { action } from '@storybook/addon-actions'
|
|
2
2
|
import Checkbox from '.'
|
|
3
|
-
import {
|
|
3
|
+
import { Meta, StoryObj } from '@storybook/react'
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
title: 'Checkbox',
|
|
7
7
|
component: Checkbox,
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
type Props = {
|
|
11
|
-
checked: boolean
|
|
12
|
-
defaultChecked: boolean
|
|
13
|
-
disabled: boolean
|
|
14
|
-
readonly: boolean
|
|
15
|
-
className?: string
|
|
16
|
-
invalid: boolean
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const Labelled: Story<Props> = (props) => {
|
|
20
|
-
return (
|
|
21
|
-
<div>
|
|
22
|
-
<div style={{ marginBottom: '1em' }}>
|
|
23
|
-
<Checkbox
|
|
24
|
-
{...props}
|
|
25
|
-
name="labelled"
|
|
26
|
-
label="label"
|
|
27
|
-
onBlur={action('blur')}
|
|
28
|
-
onClick={action('click')}
|
|
29
|
-
onChange={action('change')}
|
|
30
|
-
onFocus={action('focus')}
|
|
31
|
-
>
|
|
32
|
-
同意する
|
|
33
|
-
</Checkbox>
|
|
34
|
-
</div>
|
|
8
|
+
} as Meta<typeof Checkbox>
|
|
35
9
|
|
|
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 (
|
|
36
20
|
<div>
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
</
|
|
49
|
-
</
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
Labelled.args = {
|
|
56
|
-
checked: false,
|
|
57
|
-
defaultChecked: false,
|
|
58
|
-
disabled: false,
|
|
59
|
-
readonly: false,
|
|
60
|
-
invalid: false,
|
|
61
|
-
}
|
|
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>
|
|
62
34
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
checked: false,
|
|
82
|
-
defaultChecked: false,
|
|
83
|
-
disabled: false,
|
|
84
|
-
readonly: false,
|
|
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
|
+
},
|
|
85
53
|
}
|
|
86
54
|
|
|
87
|
-
export const
|
|
88
|
-
|
|
89
|
-
|
|
55
|
+
export const Invalid: StoryObj<typeof Checkbox> = {
|
|
56
|
+
args: {
|
|
57
|
+
checked: false,
|
|
58
|
+
defaultChecked: false,
|
|
59
|
+
disabled: false,
|
|
60
|
+
readonly: false,
|
|
61
|
+
},
|
|
62
|
+
render: (props) => {
|
|
63
|
+
return (
|
|
90
64
|
<Checkbox
|
|
91
65
|
{...props}
|
|
92
|
-
name="
|
|
66
|
+
name="labelled"
|
|
93
67
|
label="label"
|
|
68
|
+
invalid
|
|
94
69
|
onBlur={action('blur')}
|
|
95
70
|
onClick={action('click')}
|
|
96
71
|
onChange={action('change')}
|
|
97
72
|
onFocus={action('focus')}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
73
|
+
>
|
|
74
|
+
同意する
|
|
75
|
+
</Checkbox>
|
|
76
|
+
)
|
|
77
|
+
},
|
|
101
78
|
}
|
|
102
79
|
|
|
103
|
-
Unlabelled
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
80
|
+
export const Unlabelled: StoryObj<typeof Checkbox> = {
|
|
81
|
+
args: {
|
|
82
|
+
checked: false,
|
|
83
|
+
defaultChecked: false,
|
|
84
|
+
disabled: false,
|
|
85
|
+
readonly: false,
|
|
86
|
+
invalid: false,
|
|
87
|
+
},
|
|
88
|
+
render: (props) => {
|
|
89
|
+
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>
|
|
101
|
+
)
|
|
102
|
+
},
|
|
109
103
|
}
|
|
@@ -8,6 +8,7 @@ import { disabledSelector } from '@charcoal-ui/utils'
|
|
|
8
8
|
|
|
9
9
|
import type { AriaCheckboxProps } from '@react-types/checkbox'
|
|
10
10
|
import Icon from '../Icon'
|
|
11
|
+
import { focusVisibleFocusRingCss } from '@charcoal-ui/styled'
|
|
11
12
|
|
|
12
13
|
type CheckboxLabelProps =
|
|
13
14
|
| {
|
|
@@ -123,18 +124,7 @@ const CheckboxInput = styled.input`
|
|
|
123
124
|
|
|
124
125
|
&:not(:disabled):not([aria-disabled]),
|
|
125
126
|
&[aria-disabled='false'] {
|
|
126
|
-
|
|
127
|
-
&:active {
|
|
128
|
-
outline: none;
|
|
129
|
-
box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
|
|
130
|
-
&:not(:focus-visible) {
|
|
131
|
-
outline: none;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
&:focus-visible {
|
|
135
|
-
outline: none;
|
|
136
|
-
box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
|
|
137
|
-
}
|
|
127
|
+
${focusVisibleFocusRingCss}
|
|
138
128
|
&[aria-invalid='true'] {
|
|
139
129
|
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
140
130
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`
|
|
3
|
+
exports[`Storybook Tests Clickable Button 1`] = `
|
|
4
4
|
.c0 {
|
|
5
5
|
cursor: pointer;
|
|
6
6
|
-webkit-appearance: none;
|
|
@@ -51,7 +51,7 @@ exports[`Storyshots Clickable Button 1`] = `
|
|
|
51
51
|
</div>
|
|
52
52
|
`;
|
|
53
53
|
|
|
54
|
-
exports[`
|
|
54
|
+
exports[`Storybook Tests Clickable Link 1`] = `
|
|
55
55
|
.c0 {
|
|
56
56
|
cursor: pointer;
|
|
57
57
|
-webkit-appearance: none;
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { action } from '@storybook/addon-actions'
|
|
2
2
|
import Clickable from '.'
|
|
3
|
+
import { Meta, StoryObj } from '@storybook/react'
|
|
3
4
|
|
|
4
5
|
export default {
|
|
5
6
|
title: 'Clickable',
|
|
6
7
|
component: Clickable,
|
|
7
|
-
}
|
|
8
|
+
} as Meta<typeof Clickable>
|
|
8
9
|
|
|
9
|
-
export const Button =
|
|
10
|
-
<Clickable onClick={action('click')}>button</Clickable
|
|
11
|
-
|
|
10
|
+
export const Button: StoryObj = {
|
|
11
|
+
render: () => <Clickable onClick={action('click')}>button</Clickable>,
|
|
12
|
+
}
|
|
12
13
|
|
|
13
|
-
export const Link =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
export const Link: StoryObj = {
|
|
15
|
+
render: () => (
|
|
16
|
+
<Clickable to="#" onClick={action('click')}>
|
|
17
|
+
link
|
|
18
|
+
</Clickable>
|
|
19
|
+
),
|
|
20
|
+
}
|
|
@@ -29,20 +29,7 @@ const StyledSpan = styled.span<{ isSelected?: boolean }>`
|
|
|
29
29
|
font-size: 14px;
|
|
30
30
|
line-height: 22px;
|
|
31
31
|
color: var(--charcoal-text2);
|
|
32
|
-
|
|
33
|
-
display: block;
|
|
34
|
-
width: 0;
|
|
35
|
-
height: 0;
|
|
36
|
-
content: '';
|
|
37
|
-
margin-top: -4px;
|
|
38
|
-
}
|
|
39
|
-
&::after {
|
|
40
|
-
display: block;
|
|
41
|
-
width: 0;
|
|
42
|
-
height: 0;
|
|
43
|
-
content: '';
|
|
44
|
-
margin-bottom: -4px;
|
|
45
|
-
}
|
|
32
|
+
padding: 9px 0;
|
|
46
33
|
|
|
47
34
|
display: flex;
|
|
48
35
|
align-items: center;
|
|
@@ -1,6 +1,38 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`
|
|
3
|
+
exports[`Storybook Tests DropdownSelector/ListItem Basic 1`] = `
|
|
4
|
+
.c0 {
|
|
5
|
+
list-style: none;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.c1 {
|
|
9
|
+
display: -webkit-box;
|
|
10
|
+
display: -webkit-flex;
|
|
11
|
+
display: -ms-flexbox;
|
|
12
|
+
display: flex;
|
|
13
|
+
-webkit-align-items: center;
|
|
14
|
+
-webkit-box-align: center;
|
|
15
|
+
-ms-flex-align: center;
|
|
16
|
+
align-items: center;
|
|
17
|
+
min-height: 40px;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
outline: none;
|
|
20
|
+
padding-right: 16px;
|
|
21
|
+
padding-left: 16px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.c1:disabled,
|
|
25
|
+
.c1[aria-disabled]:not([aria-disabled='false']) {
|
|
26
|
+
opacity: 0.32;
|
|
27
|
+
cursor: default;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.c1:hover,
|
|
31
|
+
.c1:focus,
|
|
32
|
+
.c1:focus-within {
|
|
33
|
+
background-color: var(--charcoal-surface3);
|
|
34
|
+
}
|
|
35
|
+
|
|
4
36
|
.c3 {
|
|
5
37
|
display: inline-grid;
|
|
6
38
|
grid-template-columns: auto 1fr;
|
|
@@ -18,10 +50,6 @@ exports[`Storyshots DropdownSelector/ListItem Basic 1`] = `
|
|
|
18
50
|
cursor: default;
|
|
19
51
|
}
|
|
20
52
|
|
|
21
|
-
.c3:active > input {
|
|
22
|
-
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
53
|
.c4 {
|
|
26
54
|
-webkit-appearance: none;
|
|
27
55
|
-moz-appearance: none;
|
|
@@ -55,6 +83,15 @@ exports[`Storyshots DropdownSelector/ListItem Basic 1`] = `
|
|
|
55
83
|
}
|
|
56
84
|
|
|
57
85
|
.c4:focus {
|
|
86
|
+
outline: none;
|
|
87
|
+
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.c4:focus:not(:focus-visible) {
|
|
91
|
+
box-shadow: none;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.c4:focus-visible {
|
|
58
95
|
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
59
96
|
}
|
|
60
97
|
|
|
@@ -105,38 +142,6 @@ exports[`Storyshots DropdownSelector/ListItem Basic 1`] = `
|
|
|
105
142
|
transition: transform 0.2s;
|
|
106
143
|
}
|
|
107
144
|
|
|
108
|
-
.c0 {
|
|
109
|
-
list-style: none;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.c1 {
|
|
113
|
-
display: -webkit-box;
|
|
114
|
-
display: -webkit-flex;
|
|
115
|
-
display: -ms-flexbox;
|
|
116
|
-
display: flex;
|
|
117
|
-
-webkit-align-items: center;
|
|
118
|
-
-webkit-box-align: center;
|
|
119
|
-
-ms-flex-align: center;
|
|
120
|
-
align-items: center;
|
|
121
|
-
min-height: 40px;
|
|
122
|
-
cursor: pointer;
|
|
123
|
-
outline: none;
|
|
124
|
-
padding-right: 16px;
|
|
125
|
-
padding-left: 16px;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.c1:disabled,
|
|
129
|
-
.c1[aria-disabled]:not([aria-disabled='false']) {
|
|
130
|
-
opacity: 0.32;
|
|
131
|
-
cursor: default;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
.c1:hover,
|
|
135
|
-
.c1:focus,
|
|
136
|
-
.c1:focus-within {
|
|
137
|
-
background-color: var(--charcoal-surface3);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
145
|
.c2 {
|
|
141
146
|
color: red;
|
|
142
147
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
|
-
import { Story } from '../../../_lib/compat'
|
|
3
2
|
import Icon from '../../Icon'
|
|
4
3
|
import Switch from '../../Switch'
|
|
5
|
-
import ListItem
|
|
4
|
+
import ListItem from '.'
|
|
6
5
|
import styled from 'styled-components'
|
|
6
|
+
import { Meta, StoryObj } from '@storybook/react'
|
|
7
7
|
|
|
8
8
|
export default {
|
|
9
9
|
title: 'DropdownSelector/ListItem',
|
|
10
10
|
component: ListItem,
|
|
11
|
-
}
|
|
11
|
+
} as Meta<typeof ListItem>
|
|
12
12
|
|
|
13
13
|
const CustomLink = styled.a`
|
|
14
14
|
color: red;
|
|
15
15
|
`
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
const BasicRender = () => {
|
|
18
18
|
const [checked, setChecked] = useState(false)
|
|
19
19
|
const handleCheck = () => {
|
|
20
20
|
setChecked((v) => !v)
|
|
@@ -49,3 +49,7 @@ export const Basic: Story<ListItemProps> = () => {
|
|
|
49
49
|
</>
|
|
50
50
|
)
|
|
51
51
|
}
|
|
52
|
+
|
|
53
|
+
export const Basic: StoryObj<typeof ListItem> = {
|
|
54
|
+
render: BasicRender,
|
|
55
|
+
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`
|
|
3
|
+
exports[`Storybook Tests DropdownSelector/MenuList Basic 1`] = `
|
|
4
|
+
.c0 {
|
|
5
|
+
padding: 0;
|
|
6
|
+
margin: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
4
9
|
.c1 {
|
|
5
10
|
list-style: none;
|
|
6
11
|
}
|
|
@@ -33,11 +38,6 @@ exports[`Storyshots DropdownSelector/MenuList Basic 1`] = `
|
|
|
33
38
|
background-color: var(--charcoal-surface3);
|
|
34
39
|
}
|
|
35
40
|
|
|
36
|
-
.c0 {
|
|
37
|
-
padding: 0;
|
|
38
|
-
margin: 0;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
41
|
<div
|
|
42
42
|
data-dark={false}
|
|
43
43
|
>
|
|
@@ -208,7 +208,12 @@ exports[`Storyshots DropdownSelector/MenuList Basic 1`] = `
|
|
|
208
208
|
</div>
|
|
209
209
|
`;
|
|
210
210
|
|
|
211
|
-
exports[`
|
|
211
|
+
exports[`Storybook Tests DropdownSelector/MenuList Disabled 1`] = `
|
|
212
|
+
.c0 {
|
|
213
|
+
padding: 0;
|
|
214
|
+
margin: 0;
|
|
215
|
+
}
|
|
216
|
+
|
|
212
217
|
.c1 {
|
|
213
218
|
list-style: none;
|
|
214
219
|
}
|
|
@@ -241,11 +246,6 @@ exports[`Storyshots DropdownSelector/MenuList Disabled 1`] = `
|
|
|
241
246
|
background-color: var(--charcoal-surface3);
|
|
242
247
|
}
|
|
243
248
|
|
|
244
|
-
.c0 {
|
|
245
|
-
padding: 0;
|
|
246
|
-
margin: 0;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
249
|
<div
|
|
250
250
|
data-dark={false}
|
|
251
251
|
>
|
|
@@ -287,7 +287,32 @@ exports[`Storyshots DropdownSelector/MenuList Disabled 1`] = `
|
|
|
287
287
|
</div>
|
|
288
288
|
`;
|
|
289
289
|
|
|
290
|
-
exports[`
|
|
290
|
+
exports[`Storybook Tests DropdownSelector/MenuList Group 1`] = `
|
|
291
|
+
.c0 {
|
|
292
|
+
padding: 0;
|
|
293
|
+
margin: 0;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.c2 {
|
|
297
|
+
display: block;
|
|
298
|
+
color: var(--charcoal-text3);
|
|
299
|
+
font-size: 12px;
|
|
300
|
+
font-weight: bold;
|
|
301
|
+
padding: 12px 0 8px 16px;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.c3 {
|
|
305
|
+
padding-left: 0;
|
|
306
|
+
margin: 0;
|
|
307
|
+
box-sizing: border-box;
|
|
308
|
+
list-style: none;
|
|
309
|
+
overflow: hidden;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.c1 {
|
|
313
|
+
display: block;
|
|
314
|
+
}
|
|
315
|
+
|
|
291
316
|
.c4 {
|
|
292
317
|
list-style: none;
|
|
293
318
|
}
|
|
@@ -320,31 +345,6 @@ exports[`Storyshots DropdownSelector/MenuList Group 1`] = `
|
|
|
320
345
|
background-color: var(--charcoal-surface3);
|
|
321
346
|
}
|
|
322
347
|
|
|
323
|
-
.c0 {
|
|
324
|
-
padding: 0;
|
|
325
|
-
margin: 0;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
.c2 {
|
|
329
|
-
display: block;
|
|
330
|
-
color: var(--charcoal-text3);
|
|
331
|
-
font-size: 12px;
|
|
332
|
-
font-weight: bold;
|
|
333
|
-
padding: 12px 0 8px 16px;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
.c3 {
|
|
337
|
-
padding-left: 0;
|
|
338
|
-
margin: 0;
|
|
339
|
-
box-sizing: border-box;
|
|
340
|
-
list-style: none;
|
|
341
|
-
overflow: hidden;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
.c1 {
|
|
345
|
-
display: block;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
348
|
<div
|
|
349
349
|
data-dark={false}
|
|
350
350
|
>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { action } from '@storybook/addon-actions'
|
|
2
|
-
import
|
|
3
|
-
import MenuList, { MenuListProps } from '.'
|
|
2
|
+
import MenuList from '.'
|
|
4
3
|
import MenuItem from '../MenuItem'
|
|
5
4
|
import MenuItemGroup from '../MenuItemGroup'
|
|
5
|
+
import { Meta, StoryObj } from '@storybook/react'
|
|
6
6
|
|
|
7
7
|
export default {
|
|
8
8
|
title: 'DropdownSelector/MenuList',
|
|
9
9
|
component: MenuList,
|
|
10
|
-
}
|
|
10
|
+
} as Meta<typeof MenuList>
|
|
11
11
|
|
|
12
12
|
function makeList(n: number, offset = 0) {
|
|
13
13
|
return [...(Array(n) as undefined[])].map((_, i) => {
|
|
@@ -20,32 +20,38 @@ function makeList(n: number, offset = 0) {
|
|
|
20
20
|
})
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export const Basic:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
export const Basic: StoryObj<typeof MenuList> = {
|
|
24
|
+
render: () => {
|
|
25
|
+
return (
|
|
26
|
+
<>
|
|
27
|
+
<MenuList onChange={action('onChange')}>{makeList(10)}</MenuList>
|
|
28
|
+
</>
|
|
29
|
+
)
|
|
30
|
+
},
|
|
29
31
|
}
|
|
30
32
|
|
|
31
|
-
export const Disabled:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
export const Disabled: StoryObj<typeof MenuList> = {
|
|
34
|
+
render: () => {
|
|
35
|
+
return (
|
|
36
|
+
<>
|
|
37
|
+
<MenuList onChange={action('onChange')}>
|
|
38
|
+
<MenuItem value="1">MenuItem</MenuItem>
|
|
39
|
+
<MenuItem value="2" disabled>
|
|
40
|
+
Disabled MenuItem
|
|
41
|
+
</MenuItem>
|
|
42
|
+
</MenuList>
|
|
43
|
+
</>
|
|
44
|
+
)
|
|
45
|
+
},
|
|
42
46
|
}
|
|
43
47
|
|
|
44
|
-
export const Group:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
export const Group: StoryObj<typeof MenuList> = {
|
|
49
|
+
render: () => {
|
|
50
|
+
return (
|
|
51
|
+
<MenuList onChange={action('onChange')} value="1">
|
|
52
|
+
<MenuItemGroup text="Section1">{makeList(5)}</MenuItemGroup>
|
|
53
|
+
<MenuItemGroup text="Section2">{makeList(5, 5)}</MenuItemGroup>
|
|
54
|
+
</MenuList>
|
|
55
|
+
)
|
|
56
|
+
},
|
|
51
57
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`
|
|
3
|
+
exports[`Storybook Tests DropdownSelector/Popover Basic 1`] = `
|
|
4
4
|
.c0 {
|
|
5
5
|
cursor: pointer;
|
|
6
6
|
-webkit-appearance: none;
|
|
@@ -71,13 +71,19 @@ exports[`Storyshots DropdownSelector/Popover Basic 1`] = `
|
|
|
71
71
|
height: 40px;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
.c1:not(:disabled):not([aria-disabled]):active,
|
|
75
|
-
.c1[aria-disabled='false']:active,
|
|
76
74
|
.c1:not(:disabled):not([aria-disabled]):focus,
|
|
77
|
-
.c1[aria-disabled='false']:focus
|
|
75
|
+
.c1[aria-disabled='false']:focus {
|
|
76
|
+
outline: none;
|
|
77
|
+
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.c1:not(:disabled):not([aria-disabled]):focus:not(:focus-visible),
|
|
81
|
+
.c1[aria-disabled='false']:focus:not(:focus-visible) {
|
|
82
|
+
box-shadow: none;
|
|
83
|
+
}
|
|
84
|
+
|
|
78
85
|
.c1:not(:disabled):not([aria-disabled]):focus-visible,
|
|
79
86
|
.c1[aria-disabled='false']:focus-visible {
|
|
80
|
-
outline: none;
|
|
81
87
|
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
82
88
|
}
|
|
83
89
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useRef, CSSProperties, useState } from 'react'
|
|
2
|
-
import
|
|
3
|
-
import Popover, { PopoverProps } from '.'
|
|
2
|
+
import Popover from '.'
|
|
4
3
|
import Button from '../../Button'
|
|
4
|
+
import { Meta, StoryObj } from '@storybook/react'
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
7
|
title: 'DropdownSelector/Popover',
|
|
8
8
|
component: Popover,
|
|
9
|
-
}
|
|
9
|
+
} as Meta<typeof Popover>
|
|
10
10
|
|
|
11
11
|
function Base(props: { style?: CSSProperties }) {
|
|
12
12
|
const [isOpen, setIsOpen] = useState(false)
|
|
@@ -33,8 +33,8 @@ function Base(props: { style?: CSSProperties }) {
|
|
|
33
33
|
)
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
export const Basic:
|
|
37
|
-
|
|
36
|
+
export const Basic: StoryObj = {
|
|
37
|
+
render: () => (
|
|
38
38
|
<>
|
|
39
39
|
<Base
|
|
40
40
|
style={{
|
|
@@ -61,5 +61,5 @@ export const Basic: Story<PopoverProps> = () => {
|
|
|
61
61
|
}}
|
|
62
62
|
/>
|
|
63
63
|
</>
|
|
64
|
-
)
|
|
64
|
+
),
|
|
65
65
|
}
|