@charcoal-ui/react 3.4.0 → 3.6.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/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.story.d.ts +1 -0
- package/dist/components/Checkbox/index.story.d.ts.map +1 -1
- package/dist/components/DropdownSelector/DropdownMenuItem.d.ts.map +1 -1
- package/dist/components/DropdownSelector/ListItem/index.d.ts.map +1 -1
- package/dist/components/DropdownSelector/Popover/index.d.ts.map +1 -1
- package/dist/components/DropdownSelector/index.d.ts.map +1 -1
- package/dist/components/FieldLabel/index.d.ts.map +1 -1
- package/dist/components/IconButton/index.d.ts.map +1 -1
- package/dist/components/LoadingSpinner/index.d.ts.map +1 -1
- package/dist/components/Modal/ModalPlumbing.d.ts.map +1 -1
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/Modal/index.story.d.ts +1 -0
- package/dist/components/Modal/index.story.d.ts.map +1 -1
- package/dist/components/MultiSelect/index.d.ts.map +1 -1
- package/dist/components/MultiSelect/index.story.d.ts +2 -0
- package/dist/components/MultiSelect/index.story.d.ts.map +1 -1
- package/dist/components/Radio/index.d.ts.map +1 -1
- package/dist/components/SegmentedControl/index.d.ts.map +1 -1
- package/dist/components/Switch/index.d.ts.map +1 -1
- package/dist/components/TagItem/index.d.ts.map +1 -1
- package/dist/components/TextArea/index.d.ts.map +1 -1
- package/dist/components/TextField/TextField.story.d.ts.map +1 -1
- package/dist/components/TextField/index.d.ts +4 -0
- package/dist/components/TextField/index.d.ts.map +1 -1
- package/dist/components/TextField/useFocusWithClick.d.ts +3 -0
- package/dist/components/TextField/useFocusWithClick.d.ts.map +1 -0
- package/dist/index.cjs.js +935 -494
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +863 -422
- package/dist/index.esm.js.map +1 -1
- package/dist/styled.d.ts +4 -4
- package/package.json +9 -9
- package/src/components/Button/__snapshots__/index.story.storyshot +312 -592
- package/src/components/Button/index.tsx +50 -14
- package/src/components/Checkbox/__snapshots__/index.story.storyshot +209 -40
- package/src/components/Checkbox/__snapshots__/snapshot.test.tsx.snap +410 -80
- package/src/components/Checkbox/index.story.tsx +24 -0
- package/src/components/Checkbox/index.tsx +47 -17
- package/src/components/Clickable/__snapshots__/index.story.storyshot +4 -0
- package/src/components/Clickable/index.tsx +1 -0
- package/src/components/DropdownSelector/DropdownMenuItem.tsx +19 -3
- package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +3 -10
- package/src/components/DropdownSelector/ListItem/index.tsx +6 -4
- package/src/components/DropdownSelector/MenuItemGroup/index.tsx +1 -1
- package/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot +4 -13
- package/src/components/DropdownSelector/Popover/__snapshots__/index.story.storyshot +20 -37
- package/src/components/DropdownSelector/Popover/index.tsx +5 -8
- package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +60 -191
- package/src/components/DropdownSelector/index.tsx +70 -20
- package/src/components/FieldLabel/index.tsx +77 -12
- package/src/components/IconButton/__snapshots__/index.story.storyshot +30 -54
- package/src/components/IconButton/index.tsx +51 -26
- package/src/components/LoadingSpinner/index.tsx +3 -6
- package/src/components/Modal/Dialog/index.tsx +1 -1
- package/src/components/Modal/ModalPlumbing.tsx +26 -5
- package/src/components/Modal/__snapshots__/index.story.storyshot +2454 -108
- package/src/components/Modal/index.story.tsx +27 -0
- package/src/components/Modal/index.tsx +19 -4
- package/src/components/MultiSelect/__snapshots__/index.story.storyshot +528 -25
- package/src/components/MultiSelect/index.story.tsx +60 -0
- package/src/components/MultiSelect/index.tsx +82 -22
- package/src/components/Radio/__snapshots__/index.story.storyshot +32 -49
- package/src/components/Radio/index.tsx +71 -23
- package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +18 -19
- package/src/components/SegmentedControl/index.tsx +35 -15
- package/src/components/Switch/__snapshots__/index.story.storyshot +6 -18
- package/src/components/Switch/index.tsx +10 -15
- package/src/components/TagItem/__snapshots__/index.story.storyshot +39 -158
- package/src/components/TagItem/index.tsx +84 -19
- package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +126 -321
- package/src/components/TextArea/index.tsx +38 -43
- package/src/components/TextField/TextField.story.tsx +35 -19
- package/src/components/TextField/__snapshots__/TextField.story.storyshot +309 -563
- package/src/components/TextField/index.tsx +85 -84
- package/src/components/TextField/useFocusWithClick.tsx +22 -0
|
@@ -154,3 +154,63 @@ Playground.args = {
|
|
|
154
154
|
invalid: false,
|
|
155
155
|
variant: 'default',
|
|
156
156
|
}
|
|
157
|
+
|
|
158
|
+
export const Invalid: Story<PlaygroundProps> = ({ className, ...props }) => {
|
|
159
|
+
const [selected, setSelected] = useState<string[]>([])
|
|
160
|
+
|
|
161
|
+
return (
|
|
162
|
+
<StyledMultiSelectGroup
|
|
163
|
+
{...props}
|
|
164
|
+
selected={selected}
|
|
165
|
+
onChange={setSelected}
|
|
166
|
+
invalid
|
|
167
|
+
>
|
|
168
|
+
{[1, 2, 3, 4].map((idx) => (
|
|
169
|
+
<MultiSelect
|
|
170
|
+
value={`選択肢${idx}`}
|
|
171
|
+
variant={props.variant}
|
|
172
|
+
key={idx}
|
|
173
|
+
className={className}
|
|
174
|
+
>
|
|
175
|
+
選択肢{idx}
|
|
176
|
+
</MultiSelect>
|
|
177
|
+
))}
|
|
178
|
+
</StyledMultiSelectGroup>
|
|
179
|
+
)
|
|
180
|
+
}
|
|
181
|
+
Invalid.args = {
|
|
182
|
+
name: 'defaultName',
|
|
183
|
+
label: '',
|
|
184
|
+
disabled: false,
|
|
185
|
+
readonly: false,
|
|
186
|
+
variant: 'default',
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export const Overlay: Story<PlaygroundProps> = ({ className, ...props }) => {
|
|
190
|
+
const [selected, setSelected] = useState<string[]>([])
|
|
191
|
+
|
|
192
|
+
return (
|
|
193
|
+
<StyledMultiSelectGroup
|
|
194
|
+
{...props}
|
|
195
|
+
selected={selected}
|
|
196
|
+
onChange={setSelected}
|
|
197
|
+
>
|
|
198
|
+
{[1, 2, 3, 4].map((idx) => (
|
|
199
|
+
<MultiSelect
|
|
200
|
+
value={`選択肢${idx}`}
|
|
201
|
+
variant="overlay"
|
|
202
|
+
key={idx}
|
|
203
|
+
className={className}
|
|
204
|
+
>
|
|
205
|
+
選択肢{idx}
|
|
206
|
+
</MultiSelect>
|
|
207
|
+
))}
|
|
208
|
+
</StyledMultiSelectGroup>
|
|
209
|
+
)
|
|
210
|
+
}
|
|
211
|
+
Overlay.args = {
|
|
212
|
+
name: 'defaultName',
|
|
213
|
+
label: '',
|
|
214
|
+
disabled: false,
|
|
215
|
+
readonly: false,
|
|
216
|
+
}
|
|
@@ -2,8 +2,7 @@ import { ChangeEvent, useCallback, useContext, forwardRef, memo } from 'react'
|
|
|
2
2
|
import * as React from 'react'
|
|
3
3
|
import styled, { css } from 'styled-components'
|
|
4
4
|
import warning from 'warning'
|
|
5
|
-
import {
|
|
6
|
-
import { disabledSelector, px } from '@charcoal-ui/utils'
|
|
5
|
+
import { px } from '@charcoal-ui/utils'
|
|
7
6
|
|
|
8
7
|
import { MultiSelectGroupContext } from './context'
|
|
9
8
|
|
|
@@ -92,17 +91,36 @@ const MultiSelectRoot = styled.label`
|
|
|
92
91
|
align-items: center;
|
|
93
92
|
position: relative;
|
|
94
93
|
cursor: pointer;
|
|
95
|
-
${
|
|
94
|
+
gap: ${({ theme }) => px(theme.spacing[4])};
|
|
95
|
+
&:disabled,
|
|
96
|
+
&[aria-disabled]:not([aria-disabled='false']) {
|
|
97
|
+
opacity: 0.32;
|
|
96
98
|
cursor: default;
|
|
97
99
|
}
|
|
98
|
-
gap: ${({ theme }) => px(theme.spacing[4])};
|
|
99
|
-
${theme((o) => o.disabled)}
|
|
100
100
|
`
|
|
101
101
|
|
|
102
102
|
const MultiSelectLabel = styled.div`
|
|
103
103
|
display: flex;
|
|
104
104
|
align-items: center;
|
|
105
|
-
|
|
105
|
+
font-size: 14px;
|
|
106
|
+
line-height: 22px;
|
|
107
|
+
display: flow-root;
|
|
108
|
+
color: var(--charcoal-text2);
|
|
109
|
+
|
|
110
|
+
&::before {
|
|
111
|
+
display: block;
|
|
112
|
+
width: 0;
|
|
113
|
+
height: 0;
|
|
114
|
+
content: '';
|
|
115
|
+
margin-top: -4px;
|
|
116
|
+
}
|
|
117
|
+
&::after {
|
|
118
|
+
display: block;
|
|
119
|
+
width: 0;
|
|
120
|
+
height: 0;
|
|
121
|
+
content: '';
|
|
122
|
+
margin-bottom: -4px;
|
|
123
|
+
}
|
|
106
124
|
`
|
|
107
125
|
|
|
108
126
|
const MultiSelectInput = styled.input.attrs({ type: 'checkbox' })<{
|
|
@@ -115,18 +133,55 @@ const MultiSelectInput = styled.input.attrs({ type: 'checkbox' })<{
|
|
|
115
133
|
width: 20px;
|
|
116
134
|
height: 20px;
|
|
117
135
|
margin: 0;
|
|
136
|
+
background-color: var(--charcoal-text3);
|
|
137
|
+
border-radius: 999999px;
|
|
138
|
+
transition: 0.2s background-color, 0.2s box-shadow;
|
|
118
139
|
|
|
119
140
|
&:checked {
|
|
120
|
-
|
|
141
|
+
background-color: var(--charcoal-brand);
|
|
142
|
+
&:hover {
|
|
143
|
+
&:not(:disabled):not([aria-disabled]),
|
|
144
|
+
&[aria-disabled='false'] {
|
|
145
|
+
background-color: var(--charcoal-brand-hover);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&:active {
|
|
150
|
+
&:not(:disabled):not([aria-disabled]),
|
|
151
|
+
&[aria-disabled='false'] {
|
|
152
|
+
background-color: var(--charcoal-brand-press);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
&:hover {
|
|
158
|
+
&:not(:disabled):not([aria-disabled]),
|
|
159
|
+
&[aria-disabled='false'] {
|
|
160
|
+
background-color: var(--charcoal-text3-hover);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&:active {
|
|
165
|
+
&:not(:disabled):not([aria-disabled]),
|
|
166
|
+
&[aria-disabled='false'] {
|
|
167
|
+
background-color: var(--charcoal-text3-press);
|
|
168
|
+
}
|
|
121
169
|
}
|
|
122
170
|
|
|
123
171
|
${({ invalid, overlay }) =>
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
172
|
+
invalid &&
|
|
173
|
+
!overlay &&
|
|
174
|
+
css`
|
|
175
|
+
&:not(:disabled):not([aria-disabled]),
|
|
176
|
+
&[aria-disabled='false'] {
|
|
177
|
+
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
178
|
+
}
|
|
179
|
+
`}
|
|
180
|
+
${({ overlay }) =>
|
|
181
|
+
overlay &&
|
|
182
|
+
css`
|
|
183
|
+
background-color: var(--charcoal-surface4);
|
|
184
|
+
`}
|
|
130
185
|
}
|
|
131
186
|
`
|
|
132
187
|
|
|
@@ -141,20 +196,25 @@ const MultiSelectInputOverlay = styled.div<{
|
|
|
141
196
|
display: flex;
|
|
142
197
|
align-items: center;
|
|
143
198
|
justify-content: center;
|
|
144
|
-
|
|
199
|
+
width: 24px;
|
|
200
|
+
height: 24px;
|
|
201
|
+
border-radius: 999999px;
|
|
202
|
+
color: var(--charcoal-text5);
|
|
203
|
+
transition: 0.2s box-shadow;
|
|
145
204
|
${({ invalid, overlay }) =>
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
205
|
+
invalid &&
|
|
206
|
+
overlay &&
|
|
207
|
+
css`
|
|
208
|
+
&:not(:disabled):not([aria-disabled]),
|
|
209
|
+
&[aria-disabled='false'] {
|
|
210
|
+
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
211
|
+
}
|
|
212
|
+
`}
|
|
153
213
|
|
|
154
214
|
${({ overlay }) =>
|
|
155
215
|
overlay &&
|
|
156
216
|
css`
|
|
157
|
-
border-color:
|
|
217
|
+
border-color: var(--charcoal-text5);
|
|
158
218
|
border-width: 2px;
|
|
159
219
|
border-style: solid;
|
|
160
220
|
`}
|
|
@@ -13,7 +13,7 @@ exports[`Storyshots Radio Default 1`] = `
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
.c1:disabled,
|
|
16
|
-
.c1[aria-disabled]:not([aria-disabled=false]) {
|
|
16
|
+
.c1[aria-disabled]:not([aria-disabled='false']) {
|
|
17
17
|
opacity: 0.32;
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -30,44 +30,38 @@ exports[`Storyshots Radio Default 1`] = `
|
|
|
30
30
|
cursor: pointer;
|
|
31
31
|
border-radius: 999999px;
|
|
32
32
|
background-color: var(--charcoal-surface1);
|
|
33
|
-
-webkit-transition: 0.2s background-color;
|
|
34
|
-
transition: 0.2s background-color;
|
|
35
|
-
-webkit-transition: 0.2s box-shadow;
|
|
36
|
-
transition: 0.2s box-shadow;
|
|
37
|
-
-webkit-transition: all 0.2s !important;
|
|
38
|
-
transition: all 0.2s !important;
|
|
33
|
+
-webkit-transition: 0.2s background-color,0.2s box-shadow;
|
|
34
|
+
transition: 0.2s background-color,0.2s box-shadow;
|
|
39
35
|
}
|
|
40
36
|
|
|
41
|
-
.c2[type='radio']:
|
|
42
|
-
.c2[type='radio']
|
|
37
|
+
.c2[type='radio']:not(:disabled):not([aria-disabled]):hover,
|
|
38
|
+
.c2[type='radio'][aria-disabled='false']:hover {
|
|
43
39
|
background-color: var(--charcoal-surface1-hover);
|
|
44
40
|
}
|
|
45
41
|
|
|
46
|
-
.c2[type='radio']:
|
|
47
|
-
.c2[type='radio']
|
|
42
|
+
.c2[type='radio']:not(:disabled):not([aria-disabled]):active,
|
|
43
|
+
.c2[type='radio'][aria-disabled='false']:active {
|
|
48
44
|
background-color: var(--charcoal-surface1-press);
|
|
49
45
|
}
|
|
50
46
|
|
|
47
|
+
.c2[type='radio']:not(:disabled):not([aria-disabled]):focus,
|
|
48
|
+
.c2[type='radio'][aria-disabled='false']:focus,
|
|
49
|
+
.c2[type='radio']:not(:disabled):not([aria-disabled]):active,
|
|
50
|
+
.c2[type='radio'][aria-disabled='false']:active,
|
|
51
|
+
.c2[type='radio']:not(:disabled):not([aria-disabled]):focus-visible,
|
|
52
|
+
.c2[type='radio'][aria-disabled='false']:focus-visible {
|
|
53
|
+
outline: none;
|
|
54
|
+
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
55
|
+
}
|
|
56
|
+
|
|
51
57
|
.c2[type='radio']:not(:checked) {
|
|
52
58
|
border-width: 2px;
|
|
53
59
|
border-style: solid;
|
|
54
|
-
border-color:
|
|
60
|
+
border-color: var(--charcoal-text3);
|
|
55
61
|
}
|
|
56
62
|
|
|
57
63
|
.c2[type='radio']:checked {
|
|
58
64
|
background-color: var(--charcoal-brand);
|
|
59
|
-
-webkit-transition: 0.2s background-color;
|
|
60
|
-
transition: 0.2s background-color;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.c2[type='radio']:checked:hover:not(:disabled):not([aria-disabled]),
|
|
64
|
-
.c2[type='radio']:checked:hover[aria-disabled=false] {
|
|
65
|
-
background-color: var(--charcoal-brand-hover);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.c2[type='radio']:checked:active:not(:disabled):not([aria-disabled]),
|
|
69
|
-
.c2[type='radio']:checked:active[aria-disabled=false] {
|
|
70
|
-
background-color: var(--charcoal-brand-press);
|
|
71
65
|
}
|
|
72
66
|
|
|
73
67
|
.c2[type='radio']:checked::after {
|
|
@@ -78,39 +72,28 @@ exports[`Storyshots Radio Default 1`] = `
|
|
|
78
72
|
pointer-events: none;
|
|
79
73
|
background-color: var(--charcoal-text5);
|
|
80
74
|
border-radius: 999999px;
|
|
81
|
-
-webkit-transition: 0.2s background-color;
|
|
82
|
-
transition: 0.2s background-color;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.c2[type='radio']:checked::after:hover:not(:disabled):not([aria-disabled]),
|
|
86
|
-
.c2[type='radio']:checked::after:hover[aria-disabled=false] {
|
|
87
|
-
background-color: var(--charcoal-text5-hover);
|
|
75
|
+
-webkit-transition: 0.2s background-color,0.2s box-shadow;
|
|
76
|
+
transition: 0.2s background-color,0.2s box-shadow;
|
|
88
77
|
}
|
|
89
78
|
|
|
90
|
-
.c2[type='radio']:checked
|
|
91
|
-
.c2[type='radio']:checked
|
|
92
|
-
background-color: var(--charcoal-
|
|
79
|
+
.c2[type='radio']:checked:not(:disabled):not([aria-disabled]):hover,
|
|
80
|
+
.c2[type='radio']:checked[aria-disabled='false']:hover {
|
|
81
|
+
background-color: var(--charcoal-brand-hover);
|
|
93
82
|
}
|
|
94
83
|
|
|
95
|
-
.c2[type='radio']:not(:disabled):not([aria-disabled]):
|
|
96
|
-
.c2[type='radio'][aria-disabled=false]:
|
|
97
|
-
|
|
98
|
-
.c2[type='radio'][aria-disabled=false]:active {
|
|
99
|
-
outline: none;
|
|
100
|
-
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
84
|
+
.c2[type='radio']:checked:not(:disabled):not([aria-disabled]):hover::after,
|
|
85
|
+
.c2[type='radio']:checked[aria-disabled='false']:hover::after {
|
|
86
|
+
background-color: var(--charcoal-text5-hover);
|
|
101
87
|
}
|
|
102
88
|
|
|
103
|
-
.c2[type='radio']:not(:disabled):not([aria-disabled]):
|
|
104
|
-
.c2[type='radio'][aria-disabled=false]:
|
|
105
|
-
|
|
106
|
-
.c2[type='radio'][aria-disabled=false]:active:not(:focus-visible) {
|
|
107
|
-
outline: none;
|
|
89
|
+
.c2[type='radio']:checked:not(:disabled):not([aria-disabled]):active,
|
|
90
|
+
.c2[type='radio']:checked[aria-disabled='false']:active {
|
|
91
|
+
background-color: var(--charcoal-brand-press);
|
|
108
92
|
}
|
|
109
93
|
|
|
110
|
-
.c2[type='radio']:not(:disabled):not([aria-disabled]):
|
|
111
|
-
.c2[type='radio'][aria-disabled=false]:
|
|
112
|
-
|
|
113
|
-
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
94
|
+
.c2[type='radio']:checked:not(:disabled):not([aria-disabled]):active::after,
|
|
95
|
+
.c2[type='radio']:checked[aria-disabled='false']:active::after {
|
|
96
|
+
background-color: var(--charcoal-text5-press);
|
|
114
97
|
}
|
|
115
98
|
|
|
116
99
|
.c3 {
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { memo, forwardRef, useCallback, useContext } from 'react'
|
|
2
2
|
import * as React from 'react'
|
|
3
|
-
import styled from 'styled-components'
|
|
3
|
+
import styled, { css } from 'styled-components'
|
|
4
4
|
import warning from 'warning'
|
|
5
|
-
import { theme } from '../../styled'
|
|
6
|
-
import { px } from '@charcoal-ui/utils'
|
|
7
5
|
|
|
8
6
|
export type RadioProps = React.PropsWithChildren<{
|
|
9
7
|
value: string
|
|
@@ -62,11 +60,14 @@ export default memo(Radio)
|
|
|
62
60
|
const RadioRoot = styled.label`
|
|
63
61
|
display: grid;
|
|
64
62
|
grid-template-columns: auto 1fr;
|
|
65
|
-
grid-gap:
|
|
63
|
+
grid-gap: 4px;
|
|
66
64
|
align-items: center;
|
|
67
65
|
cursor: pointer;
|
|
68
66
|
|
|
69
|
-
|
|
67
|
+
&:disabled,
|
|
68
|
+
&[aria-disabled]:not([aria-disabled='false']) {
|
|
69
|
+
opacity: 0.32;
|
|
70
|
+
}
|
|
70
71
|
`
|
|
71
72
|
|
|
72
73
|
export const RadioInput = styled.input.attrs({ type: 'radio' })<{
|
|
@@ -84,43 +85,90 @@ export const RadioInput = styled.input.attrs({ type: 'radio' })<{
|
|
|
84
85
|
width: 20px;
|
|
85
86
|
height: 20px;
|
|
86
87
|
cursor: pointer;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
border-radius: 999999px;
|
|
89
|
+
background-color: var(--charcoal-surface1);
|
|
90
|
+
transition: 0.2s background-color, 0.2s box-shadow;
|
|
91
|
+
|
|
92
|
+
&:not(:disabled):not([aria-disabled]),
|
|
93
|
+
&[aria-disabled='false'] {
|
|
94
|
+
${({ invalid = false }) =>
|
|
95
|
+
invalid &&
|
|
96
|
+
css`
|
|
97
|
+
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
98
|
+
`}
|
|
99
|
+
|
|
100
|
+
&:hover {
|
|
101
|
+
background-color: var(--charcoal-surface1-hover);
|
|
102
|
+
}
|
|
103
|
+
&:active {
|
|
104
|
+
background-color: var(--charcoal-surface1-press);
|
|
105
|
+
}
|
|
106
|
+
&:focus,
|
|
107
|
+
&:active,
|
|
108
|
+
&:focus-visible {
|
|
109
|
+
outline: none;
|
|
110
|
+
box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
94
113
|
|
|
95
114
|
&:not(:checked) {
|
|
96
115
|
border-width: 2px;
|
|
97
116
|
border-style: solid;
|
|
98
|
-
border-color:
|
|
117
|
+
border-color: var(--charcoal-text3);
|
|
99
118
|
}
|
|
100
119
|
|
|
101
120
|
&:checked {
|
|
102
|
-
|
|
103
|
-
|
|
121
|
+
background-color: var(--charcoal-brand);
|
|
104
122
|
&::after {
|
|
105
123
|
content: '';
|
|
106
124
|
display: block;
|
|
107
125
|
width: 8px;
|
|
108
126
|
height: 8px;
|
|
109
127
|
pointer-events: none;
|
|
128
|
+
background-color: var(--charcoal-text5);
|
|
129
|
+
border-radius: 999999px;
|
|
130
|
+
transition: 0.2s background-color, 0.2s box-shadow;
|
|
131
|
+
}
|
|
110
132
|
|
|
111
|
-
|
|
133
|
+
&:not(:disabled):not([aria-disabled]),
|
|
134
|
+
&[aria-disabled='false'] {
|
|
135
|
+
&:hover {
|
|
136
|
+
background-color: var(--charcoal-brand-hover);
|
|
137
|
+
&::after {
|
|
138
|
+
background-color: var(--charcoal-text5-hover);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
&:active {
|
|
142
|
+
background-color: var(--charcoal-brand-press);
|
|
143
|
+
&::after {
|
|
144
|
+
background-color: var(--charcoal-text5-press);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
112
147
|
}
|
|
113
148
|
}
|
|
114
|
-
|
|
115
|
-
${theme((o) => o.outline.default.focus)}
|
|
116
|
-
|
|
117
|
-
/* FIXME: o.outline.default.focus の transition に o.bg.brand の transition が打ち消されてしまう */
|
|
118
|
-
transition: all 0.2s !important;
|
|
119
149
|
}
|
|
120
150
|
`
|
|
121
151
|
|
|
122
152
|
const RadioLabel = styled.div`
|
|
123
|
-
|
|
153
|
+
font-size: 14px;
|
|
154
|
+
line-height: 22px;
|
|
155
|
+
display: flow-root;
|
|
156
|
+
color: var(--charcoal-text2);
|
|
157
|
+
|
|
158
|
+
&::before {
|
|
159
|
+
display: block;
|
|
160
|
+
width: 0;
|
|
161
|
+
height: 0;
|
|
162
|
+
content: '';
|
|
163
|
+
margin-top: -4px;
|
|
164
|
+
}
|
|
165
|
+
&::after {
|
|
166
|
+
display: block;
|
|
167
|
+
width: 0;
|
|
168
|
+
height: 0;
|
|
169
|
+
content: '';
|
|
170
|
+
margin-bottom: -4px;
|
|
171
|
+
}
|
|
124
172
|
`
|
|
125
173
|
|
|
126
174
|
export type RadioGroupProps = React.PropsWithChildren<{
|
|
@@ -138,7 +186,7 @@ export type RadioGroupProps = React.PropsWithChildren<{
|
|
|
138
186
|
const StyledRadioGroup = styled.div`
|
|
139
187
|
display: grid;
|
|
140
188
|
grid-template-columns: 1fr;
|
|
141
|
-
grid-gap:
|
|
189
|
+
grid-gap: 8px;
|
|
142
190
|
`
|
|
143
191
|
|
|
144
192
|
interface RadioGroupContext {
|
|
@@ -33,12 +33,8 @@ exports[`Storyshots SegmentedControl Object Segments 1`] = `
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
.c1:disabled,
|
|
36
|
-
.c1[aria-disabled]:not([aria-disabled=false]) {
|
|
36
|
+
.c1[aria-disabled]:not([aria-disabled='false']) {
|
|
37
37
|
cursor: default;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.c1:disabled,
|
|
41
|
-
.c1[aria-disabled]:not([aria-disabled=false]) {
|
|
42
38
|
opacity: 0.32;
|
|
43
39
|
}
|
|
44
40
|
|
|
@@ -99,7 +95,7 @@ exports[`Storyshots SegmentedControl Object Segments 1`] = `
|
|
|
99
95
|
aria-label="test"
|
|
100
96
|
aria-orientation="vertical"
|
|
101
97
|
className="c0"
|
|
102
|
-
id="
|
|
98
|
+
id="react-aria-1"
|
|
103
99
|
onBlur={[Function]}
|
|
104
100
|
onFocus={[Function]}
|
|
105
101
|
onKeyDown={[Function]}
|
|
@@ -114,7 +110,7 @@ exports[`Storyshots SegmentedControl Object Segments 1`] = `
|
|
|
114
110
|
checked={false}
|
|
115
111
|
className="c2"
|
|
116
112
|
disabled={false}
|
|
117
|
-
name="test
|
|
113
|
+
name="test"
|
|
118
114
|
onChange={[Function]}
|
|
119
115
|
onClick={[Function]}
|
|
120
116
|
onDragStart={[Function]}
|
|
@@ -129,6 +125,7 @@ exports[`Storyshots SegmentedControl Object Segments 1`] = `
|
|
|
129
125
|
onTouchEnd={[Function]}
|
|
130
126
|
onTouchMove={[Function]}
|
|
131
127
|
onTouchStart={[Function]}
|
|
128
|
+
required={false}
|
|
132
129
|
tabIndex={0}
|
|
133
130
|
type="radio"
|
|
134
131
|
value="option1"
|
|
@@ -152,7 +149,7 @@ exports[`Storyshots SegmentedControl Object Segments 1`] = `
|
|
|
152
149
|
checked={false}
|
|
153
150
|
className="c2"
|
|
154
151
|
disabled={false}
|
|
155
|
-
name="test
|
|
152
|
+
name="test"
|
|
156
153
|
onChange={[Function]}
|
|
157
154
|
onClick={[Function]}
|
|
158
155
|
onDragStart={[Function]}
|
|
@@ -167,6 +164,7 @@ exports[`Storyshots SegmentedControl Object Segments 1`] = `
|
|
|
167
164
|
onTouchEnd={[Function]}
|
|
168
165
|
onTouchMove={[Function]}
|
|
169
166
|
onTouchStart={[Function]}
|
|
167
|
+
required={false}
|
|
170
168
|
tabIndex={0}
|
|
171
169
|
type="radio"
|
|
172
170
|
value="option2"
|
|
@@ -190,7 +188,7 @@ exports[`Storyshots SegmentedControl Object Segments 1`] = `
|
|
|
190
188
|
checked={false}
|
|
191
189
|
className="c2"
|
|
192
190
|
disabled={false}
|
|
193
|
-
name="test
|
|
191
|
+
name="test"
|
|
194
192
|
onChange={[Function]}
|
|
195
193
|
onClick={[Function]}
|
|
196
194
|
onDragStart={[Function]}
|
|
@@ -205,6 +203,7 @@ exports[`Storyshots SegmentedControl Object Segments 1`] = `
|
|
|
205
203
|
onTouchEnd={[Function]}
|
|
206
204
|
onTouchMove={[Function]}
|
|
207
205
|
onTouchStart={[Function]}
|
|
206
|
+
required={false}
|
|
208
207
|
tabIndex={0}
|
|
209
208
|
type="radio"
|
|
210
209
|
value="option3"
|
|
@@ -228,7 +227,7 @@ exports[`Storyshots SegmentedControl Object Segments 1`] = `
|
|
|
228
227
|
checked={false}
|
|
229
228
|
className="c2"
|
|
230
229
|
disabled={true}
|
|
231
|
-
name="test
|
|
230
|
+
name="test"
|
|
232
231
|
onChange={[Function]}
|
|
233
232
|
onClick={[Function]}
|
|
234
233
|
onDragStart={[Function]}
|
|
@@ -242,6 +241,7 @@ exports[`Storyshots SegmentedControl Object Segments 1`] = `
|
|
|
242
241
|
onTouchEnd={[Function]}
|
|
243
242
|
onTouchMove={[Function]}
|
|
244
243
|
onTouchStart={[Function]}
|
|
244
|
+
required={false}
|
|
245
245
|
type="radio"
|
|
246
246
|
value="option4"
|
|
247
247
|
/>
|
|
@@ -292,12 +292,8 @@ exports[`Storyshots SegmentedControl String Segments 1`] = `
|
|
|
292
292
|
}
|
|
293
293
|
|
|
294
294
|
.c1:disabled,
|
|
295
|
-
.c1[aria-disabled]:not([aria-disabled=false]) {
|
|
295
|
+
.c1[aria-disabled]:not([aria-disabled='false']) {
|
|
296
296
|
cursor: default;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
.c1:disabled,
|
|
300
|
-
.c1[aria-disabled]:not([aria-disabled=false]) {
|
|
301
297
|
opacity: 0.32;
|
|
302
298
|
}
|
|
303
299
|
|
|
@@ -358,7 +354,7 @@ exports[`Storyshots SegmentedControl String Segments 1`] = `
|
|
|
358
354
|
aria-label="test"
|
|
359
355
|
aria-orientation="vertical"
|
|
360
356
|
className="c0"
|
|
361
|
-
id="
|
|
357
|
+
id="react-aria-5"
|
|
362
358
|
onBlur={[Function]}
|
|
363
359
|
onFocus={[Function]}
|
|
364
360
|
onKeyDown={[Function]}
|
|
@@ -373,7 +369,7 @@ exports[`Storyshots SegmentedControl String Segments 1`] = `
|
|
|
373
369
|
checked={false}
|
|
374
370
|
className="c2"
|
|
375
371
|
disabled={false}
|
|
376
|
-
name="test
|
|
372
|
+
name="test"
|
|
377
373
|
onChange={[Function]}
|
|
378
374
|
onClick={[Function]}
|
|
379
375
|
onDragStart={[Function]}
|
|
@@ -388,6 +384,7 @@ exports[`Storyshots SegmentedControl String Segments 1`] = `
|
|
|
388
384
|
onTouchEnd={[Function]}
|
|
389
385
|
onTouchMove={[Function]}
|
|
390
386
|
onTouchStart={[Function]}
|
|
387
|
+
required={false}
|
|
391
388
|
tabIndex={0}
|
|
392
389
|
type="radio"
|
|
393
390
|
value="option1"
|
|
@@ -411,7 +408,7 @@ exports[`Storyshots SegmentedControl String Segments 1`] = `
|
|
|
411
408
|
checked={false}
|
|
412
409
|
className="c2"
|
|
413
410
|
disabled={false}
|
|
414
|
-
name="test
|
|
411
|
+
name="test"
|
|
415
412
|
onChange={[Function]}
|
|
416
413
|
onClick={[Function]}
|
|
417
414
|
onDragStart={[Function]}
|
|
@@ -426,6 +423,7 @@ exports[`Storyshots SegmentedControl String Segments 1`] = `
|
|
|
426
423
|
onTouchEnd={[Function]}
|
|
427
424
|
onTouchMove={[Function]}
|
|
428
425
|
onTouchStart={[Function]}
|
|
426
|
+
required={false}
|
|
429
427
|
tabIndex={0}
|
|
430
428
|
type="radio"
|
|
431
429
|
value="option2"
|
|
@@ -449,7 +447,7 @@ exports[`Storyshots SegmentedControl String Segments 1`] = `
|
|
|
449
447
|
checked={false}
|
|
450
448
|
className="c2"
|
|
451
449
|
disabled={false}
|
|
452
|
-
name="test
|
|
450
|
+
name="test"
|
|
453
451
|
onChange={[Function]}
|
|
454
452
|
onClick={[Function]}
|
|
455
453
|
onDragStart={[Function]}
|
|
@@ -464,6 +462,7 @@ exports[`Storyshots SegmentedControl String Segments 1`] = `
|
|
|
464
462
|
onTouchEnd={[Function]}
|
|
465
463
|
onTouchMove={[Function]}
|
|
466
464
|
onTouchStart={[Function]}
|
|
465
|
+
required={false}
|
|
467
466
|
tabIndex={0}
|
|
468
467
|
type="radio"
|
|
469
468
|
value="option3"
|