@charcoal-ui/react 3.7.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/components/Button/StyledButton.d.ts +1 -0
- package/dist/components/Button/StyledButton.d.ts.map +1 -1
- package/dist/components/Button/index.d.ts +1 -0
- 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/Checkbox/index.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 -12
- 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/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 +80 -86
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +80 -86
- package/dist/index.esm.js.map +1 -1
- package/dist/styled.d.ts +4 -4
- package/package.json +6 -6
- package/src/components/Button/StyledButton.tsx +19 -14
- 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 +3 -0
- package/src/components/Checkbox/__snapshots__/index.story.storyshot +12 -27
- package/src/components/Checkbox/index.tsx +2 -12
- package/src/components/Clickable/__snapshots__/index.story.storyshot +2 -2
- 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 +145 -47
- package/src/components/DropdownSelector/index.story.tsx +207 -204
- package/src/components/DropdownSelector/index.tsx +17 -10
- 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 +212 -171
- 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/__snapshots__/index.story.storyshot +2 -2
- package/src/components/SegmentedControl/index.story.tsx +24 -29
- 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 +127 -73
- package/src/components/TextField/TextField.story.tsx +67 -66
- package/src/components/TextField/__snapshots__/TextField.story.storyshot +182 -147
- package/src/components/TextField/index.tsx +0 -7
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { action } from '@storybook/addon-actions'
|
|
2
1
|
import { useRef } from 'react'
|
|
3
|
-
import { Story } from '../../_lib/compat'
|
|
4
2
|
import { ClickableElement } from '../Clickable'
|
|
5
3
|
import Button, { ButtonProps } from '.'
|
|
4
|
+
import { Meta, StoryObj } from '@storybook/react'
|
|
6
5
|
|
|
7
6
|
export default {
|
|
8
7
|
title: 'Button',
|
|
@@ -21,167 +20,171 @@ export default {
|
|
|
21
20
|
},
|
|
22
21
|
},
|
|
23
22
|
},
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const DefaultStory = (args: ButtonProps) => (
|
|
27
|
-
<Button {...args} onClick={action('click')}>
|
|
28
|
-
Button
|
|
29
|
-
</Button>
|
|
30
|
-
)
|
|
23
|
+
render: (args) => <Button {...args}>Button</Button>,
|
|
24
|
+
} as Meta<typeof Button>
|
|
31
25
|
|
|
32
|
-
export const Default:
|
|
26
|
+
export const Default: StoryObj<typeof Button> = {}
|
|
33
27
|
|
|
34
|
-
export const Primary:
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
export const Primary: StoryObj<typeof Button> = {
|
|
29
|
+
args: {
|
|
30
|
+
variant: 'Primary',
|
|
31
|
+
},
|
|
37
32
|
}
|
|
38
33
|
|
|
39
|
-
export const Navigation:
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
export const Navigation: StoryObj<typeof Button> = {
|
|
35
|
+
args: {
|
|
36
|
+
variant: 'Navigation',
|
|
37
|
+
},
|
|
42
38
|
}
|
|
43
39
|
|
|
44
|
-
export const Overlay:
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
export const Overlay: StoryObj<typeof Button> = {
|
|
41
|
+
args: {
|
|
42
|
+
variant: 'Overlay',
|
|
43
|
+
},
|
|
47
44
|
}
|
|
48
45
|
|
|
49
|
-
export const Danger:
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
export const Danger: StoryObj<typeof Button> = {
|
|
47
|
+
args: {
|
|
48
|
+
variant: 'Danger',
|
|
49
|
+
},
|
|
52
50
|
}
|
|
53
51
|
|
|
54
|
-
export const Small:
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
export const Small: StoryObj<typeof Button> = {
|
|
53
|
+
args: {
|
|
54
|
+
size: 'S',
|
|
55
|
+
},
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
export const Fixed:
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
export const Fixed: StoryObj<typeof Button> = {
|
|
59
|
+
args: {
|
|
60
|
+
fullWidth: true,
|
|
61
|
+
},
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
export const Disabled:
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
export const Disabled: StoryObj<typeof Button> = {
|
|
65
|
+
args: {
|
|
66
|
+
disabled: true,
|
|
67
|
+
},
|
|
67
68
|
}
|
|
68
69
|
|
|
69
|
-
export const
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
export const Active: StoryObj<typeof Button> = {
|
|
71
|
+
args: {
|
|
72
|
+
isActive: true,
|
|
73
|
+
},
|
|
72
74
|
}
|
|
73
75
|
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
)
|
|
79
|
-
|
|
80
|
-
export const Nihongo: Story<ButtonProps> = NihongoStory.bind({})
|
|
81
|
-
|
|
82
|
-
const FocusStory = (args: ButtonProps) => <FocusStoryInternal {...args} />
|
|
83
|
-
const FocusStoryInternal = (args: ButtonProps) => {
|
|
84
|
-
const ref = useRef<ClickableElement>(null)
|
|
85
|
-
const focus = () => ref.current?.focus()
|
|
86
|
-
return (
|
|
87
|
-
<Button {...args} onMouseOver={focus} ref={ref}>
|
|
88
|
-
Mouse over to focus
|
|
89
|
-
</Button>
|
|
90
|
-
)
|
|
76
|
+
export const Link: StoryObj<typeof Button> = {
|
|
77
|
+
args: {
|
|
78
|
+
to: '#',
|
|
79
|
+
},
|
|
91
80
|
}
|
|
92
81
|
|
|
93
|
-
export const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
<div
|
|
97
|
-
css={`
|
|
98
|
-
display: grid;
|
|
99
|
-
gap: 24px;
|
|
100
|
-
`}
|
|
101
|
-
>
|
|
102
|
-
<div
|
|
103
|
-
css={`
|
|
104
|
-
display: grid;
|
|
105
|
-
grid: auto / auto-flow min-content;
|
|
106
|
-
gap: 8px;
|
|
107
|
-
`}
|
|
108
|
-
>
|
|
109
|
-
<Button {...args}>Grid</Button>
|
|
110
|
-
<Button {...args} variant="Navigation">
|
|
111
|
-
Layout
|
|
112
|
-
</Button>
|
|
113
|
-
<Button {...args} variant="Danger">
|
|
114
|
-
Sample
|
|
115
|
-
</Button>
|
|
116
|
-
</div>
|
|
117
|
-
<div
|
|
118
|
-
css={`
|
|
119
|
-
display: grid;
|
|
120
|
-
grid: auto-flow auto / 392px;
|
|
121
|
-
gap: 8px;
|
|
122
|
-
`}
|
|
123
|
-
>
|
|
124
|
-
<Button {...args} variant="Primary" fullWidth>
|
|
125
|
-
Submit
|
|
126
|
-
</Button>
|
|
127
|
-
<Button {...args} variant="Default" fullWidth>
|
|
128
|
-
Cancel
|
|
129
|
-
</Button>
|
|
130
|
-
</div>
|
|
131
|
-
<div
|
|
132
|
-
css={`
|
|
133
|
-
display: flex;
|
|
82
|
+
export const Nihongo: StoryObj<typeof Button> = {
|
|
83
|
+
render: (args) => <Button {...args}>日本語だよ</Button>,
|
|
84
|
+
}
|
|
134
85
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
<Button {...args}>
|
|
141
|
-
|
|
142
|
-
Layout
|
|
143
|
-
</Button>
|
|
144
|
-
<Button {...args} variant="Danger">
|
|
145
|
-
Sample
|
|
86
|
+
export const Focus: StoryObj<typeof Button> = {
|
|
87
|
+
render: function Render(args) {
|
|
88
|
+
const ref = useRef<ClickableElement>(null)
|
|
89
|
+
const focus = () => ref.current?.focus()
|
|
90
|
+
return (
|
|
91
|
+
<Button {...args} onMouseOver={focus} ref={ref}>
|
|
92
|
+
Mouse over to focus
|
|
146
93
|
</Button>
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
display: flex;
|
|
151
|
-
flex-direction: column;
|
|
152
|
-
width: 392px;
|
|
94
|
+
)
|
|
95
|
+
},
|
|
96
|
+
}
|
|
153
97
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
`}
|
|
158
|
-
>
|
|
159
|
-
<Button {...args} variant="Primary" fullWidth>
|
|
160
|
-
Submit
|
|
161
|
-
</Button>
|
|
162
|
-
<Button {...args} variant="Default" fullWidth>
|
|
163
|
-
Cancel
|
|
164
|
-
</Button>
|
|
165
|
-
</div>
|
|
98
|
+
export const LayoutExample: StoryObj<typeof Button> = {
|
|
99
|
+
render: (args: ButtonProps) => (
|
|
166
100
|
<div
|
|
167
101
|
css={`
|
|
168
|
-
display:
|
|
169
|
-
|
|
170
|
-
width: 392px;
|
|
171
|
-
|
|
172
|
-
& > * + * {
|
|
173
|
-
margin-top: 8px;
|
|
174
|
-
}
|
|
102
|
+
display: grid;
|
|
103
|
+
gap: 24px;
|
|
175
104
|
`}
|
|
176
105
|
>
|
|
177
|
-
<
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
106
|
+
<div
|
|
107
|
+
css={`
|
|
108
|
+
display: grid;
|
|
109
|
+
grid: auto / auto-flow min-content;
|
|
110
|
+
gap: 8px;
|
|
111
|
+
`}
|
|
112
|
+
>
|
|
113
|
+
<Button {...args}>Grid</Button>
|
|
114
|
+
<Button {...args} variant="Navigation">
|
|
115
|
+
Layout
|
|
116
|
+
</Button>
|
|
117
|
+
<Button {...args} variant="Danger">
|
|
118
|
+
Sample
|
|
119
|
+
</Button>
|
|
120
|
+
</div>
|
|
121
|
+
<div
|
|
122
|
+
css={`
|
|
123
|
+
display: grid;
|
|
124
|
+
grid: auto-flow auto / 392px;
|
|
125
|
+
gap: 8px;
|
|
126
|
+
`}
|
|
127
|
+
>
|
|
128
|
+
<Button {...args} variant="Primary" fullWidth>
|
|
129
|
+
Submit
|
|
130
|
+
</Button>
|
|
131
|
+
<Button {...args} variant="Default" fullWidth>
|
|
132
|
+
Cancel
|
|
133
|
+
</Button>
|
|
134
|
+
</div>
|
|
135
|
+
<div
|
|
136
|
+
css={`
|
|
137
|
+
display: flex;
|
|
138
|
+
|
|
139
|
+
& > * + * {
|
|
140
|
+
margin-left: 8px;
|
|
141
|
+
}
|
|
142
|
+
`}
|
|
143
|
+
>
|
|
144
|
+
<Button {...args}>Flex</Button>
|
|
145
|
+
<Button {...args} variant="Navigation">
|
|
146
|
+
Layout
|
|
147
|
+
</Button>
|
|
148
|
+
<Button {...args} variant="Danger">
|
|
149
|
+
Sample
|
|
150
|
+
</Button>
|
|
151
|
+
</div>
|
|
152
|
+
<div
|
|
153
|
+
css={`
|
|
154
|
+
display: flex;
|
|
155
|
+
flex-direction: column;
|
|
156
|
+
width: 392px;
|
|
157
|
+
|
|
158
|
+
& > * + * {
|
|
159
|
+
margin-top: 8px;
|
|
160
|
+
}
|
|
161
|
+
`}
|
|
162
|
+
>
|
|
163
|
+
<Button {...args} variant="Primary" fullWidth>
|
|
164
|
+
Submit
|
|
165
|
+
</Button>
|
|
166
|
+
<Button {...args} variant="Default" fullWidth>
|
|
167
|
+
Cancel
|
|
168
|
+
</Button>
|
|
169
|
+
</div>
|
|
170
|
+
<div
|
|
171
|
+
css={`
|
|
172
|
+
display: flex;
|
|
173
|
+
flex-direction: column;
|
|
174
|
+
width: 392px;
|
|
175
|
+
|
|
176
|
+
& > * + * {
|
|
177
|
+
margin-top: 8px;
|
|
178
|
+
}
|
|
179
|
+
`}
|
|
180
|
+
>
|
|
181
|
+
<Button {...args} variant="Primary" fullWidth>
|
|
182
|
+
すべて見る
|
|
183
|
+
</Button>
|
|
184
|
+
<Button {...args} variant="Default">
|
|
185
|
+
作品を投稿
|
|
186
|
+
</Button>
|
|
187
|
+
</div>
|
|
183
188
|
</div>
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
export const LayoutExample = LayoutExampleStory.bind({})
|
|
189
|
+
),
|
|
190
|
+
}
|
|
@@ -17,6 +17,7 @@ export type ButtonProps = Partial<{
|
|
|
17
17
|
variant: Variant
|
|
18
18
|
size: Size
|
|
19
19
|
fullWidth: boolean
|
|
20
|
+
isActive: boolean
|
|
20
21
|
}> &
|
|
21
22
|
ClickableProps
|
|
22
23
|
|
|
@@ -27,6 +28,7 @@ const Button = forwardRef<ClickableElement, ButtonProps>(function Button(
|
|
|
27
28
|
size = 'M',
|
|
28
29
|
fullWidth: fixed = false,
|
|
29
30
|
disabled = false,
|
|
31
|
+
isActive = false,
|
|
30
32
|
...rest
|
|
31
33
|
},
|
|
32
34
|
ref
|
|
@@ -39,6 +41,7 @@ const Button = forwardRef<ClickableElement, ButtonProps>(function Button(
|
|
|
39
41
|
$color={variantToFont(variant)}
|
|
40
42
|
$size={size}
|
|
41
43
|
$fullWidth={fixed}
|
|
44
|
+
$isActive={isActive}
|
|
42
45
|
ref={ref}
|
|
43
46
|
>
|
|
44
47
|
{children}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`
|
|
3
|
+
exports[`Storybook Tests Checkbox Invalid 1`] = `
|
|
4
4
|
.c0 {
|
|
5
5
|
position: relative;
|
|
6
6
|
display: -webkit-box;
|
|
@@ -54,23 +54,18 @@ exports[`Storyshots Checkbox Invalid 1`] = `
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
.c2[type='checkbox']:not(:disabled):not([aria-disabled]):focus,
|
|
57
|
-
.c2[type='checkbox'][aria-disabled='false']:focus
|
|
58
|
-
.c2[type='checkbox']:not(:disabled):not([aria-disabled]):active,
|
|
59
|
-
.c2[type='checkbox'][aria-disabled='false']:active {
|
|
57
|
+
.c2[type='checkbox'][aria-disabled='false']:focus {
|
|
60
58
|
outline: none;
|
|
61
59
|
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
62
60
|
}
|
|
63
61
|
|
|
64
62
|
.c2[type='checkbox']:not(:disabled):not([aria-disabled]):focus:not(:focus-visible),
|
|
65
|
-
.c2[type='checkbox'][aria-disabled='false']:focus:not(:focus-visible)
|
|
66
|
-
|
|
67
|
-
.c2[type='checkbox'][aria-disabled='false']:active:not(:focus-visible) {
|
|
68
|
-
outline: none;
|
|
63
|
+
.c2[type='checkbox'][aria-disabled='false']:focus:not(:focus-visible) {
|
|
64
|
+
box-shadow: none;
|
|
69
65
|
}
|
|
70
66
|
|
|
71
67
|
.c2[type='checkbox']:not(:disabled):not([aria-disabled]):focus-visible,
|
|
72
68
|
.c2[type='checkbox'][aria-disabled='false']:focus-visible {
|
|
73
|
-
outline: none;
|
|
74
69
|
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
75
70
|
}
|
|
76
71
|
|
|
@@ -167,7 +162,7 @@ exports[`Storyshots Checkbox Invalid 1`] = `
|
|
|
167
162
|
</div>
|
|
168
163
|
`;
|
|
169
164
|
|
|
170
|
-
exports[`
|
|
165
|
+
exports[`Storybook Tests Checkbox Labelled 1`] = `
|
|
171
166
|
.c0 {
|
|
172
167
|
position: relative;
|
|
173
168
|
display: -webkit-box;
|
|
@@ -221,23 +216,18 @@ exports[`Storyshots Checkbox Labelled 1`] = `
|
|
|
221
216
|
}
|
|
222
217
|
|
|
223
218
|
.c2[type='checkbox']:not(:disabled):not([aria-disabled]):focus,
|
|
224
|
-
.c2[type='checkbox'][aria-disabled='false']:focus
|
|
225
|
-
.c2[type='checkbox']:not(:disabled):not([aria-disabled]):active,
|
|
226
|
-
.c2[type='checkbox'][aria-disabled='false']:active {
|
|
219
|
+
.c2[type='checkbox'][aria-disabled='false']:focus {
|
|
227
220
|
outline: none;
|
|
228
221
|
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
229
222
|
}
|
|
230
223
|
|
|
231
224
|
.c2[type='checkbox']:not(:disabled):not([aria-disabled]):focus:not(:focus-visible),
|
|
232
|
-
.c2[type='checkbox'][aria-disabled='false']:focus:not(:focus-visible)
|
|
233
|
-
|
|
234
|
-
.c2[type='checkbox'][aria-disabled='false']:active:not(:focus-visible) {
|
|
235
|
-
outline: none;
|
|
225
|
+
.c2[type='checkbox'][aria-disabled='false']:focus:not(:focus-visible) {
|
|
226
|
+
box-shadow: none;
|
|
236
227
|
}
|
|
237
228
|
|
|
238
229
|
.c2[type='checkbox']:not(:disabled):not([aria-disabled]):focus-visible,
|
|
239
230
|
.c2[type='checkbox'][aria-disabled='false']:focus-visible {
|
|
240
|
-
outline: none;
|
|
241
231
|
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
242
232
|
}
|
|
243
233
|
|
|
@@ -400,7 +390,7 @@ exports[`Storyshots Checkbox Labelled 1`] = `
|
|
|
400
390
|
</div>
|
|
401
391
|
`;
|
|
402
392
|
|
|
403
|
-
exports[`
|
|
393
|
+
exports[`Storybook Tests Checkbox Unlabelled 1`] = `
|
|
404
394
|
.c0 {
|
|
405
395
|
position: relative;
|
|
406
396
|
display: -webkit-box;
|
|
@@ -454,23 +444,18 @@ exports[`Storyshots Checkbox Unlabelled 1`] = `
|
|
|
454
444
|
}
|
|
455
445
|
|
|
456
446
|
.c2[type='checkbox']:not(:disabled):not([aria-disabled]):focus,
|
|
457
|
-
.c2[type='checkbox'][aria-disabled='false']:focus
|
|
458
|
-
.c2[type='checkbox']:not(:disabled):not([aria-disabled]):active,
|
|
459
|
-
.c2[type='checkbox'][aria-disabled='false']:active {
|
|
447
|
+
.c2[type='checkbox'][aria-disabled='false']:focus {
|
|
460
448
|
outline: none;
|
|
461
449
|
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
462
450
|
}
|
|
463
451
|
|
|
464
452
|
.c2[type='checkbox']:not(:disabled):not([aria-disabled]):focus:not(:focus-visible),
|
|
465
|
-
.c2[type='checkbox'][aria-disabled='false']:focus:not(:focus-visible)
|
|
466
|
-
|
|
467
|
-
.c2[type='checkbox'][aria-disabled='false']:active:not(:focus-visible) {
|
|
468
|
-
outline: none;
|
|
453
|
+
.c2[type='checkbox'][aria-disabled='false']:focus:not(:focus-visible) {
|
|
454
|
+
box-shadow: none;
|
|
469
455
|
}
|
|
470
456
|
|
|
471
457
|
.c2[type='checkbox']:not(:disabled):not([aria-disabled]):focus-visible,
|
|
472
458
|
.c2[type='checkbox'][aria-disabled='false']:focus-visible {
|
|
473
|
-
outline: none;
|
|
474
459
|
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
475
460
|
}
|
|
476
461
|
|
|
@@ -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,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
|
+
}
|