@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,62 +1,86 @@
|
|
|
1
|
-
import { action } from '@storybook/addon-actions'
|
|
2
1
|
import { useState } from 'react'
|
|
3
|
-
import { Story } from '../../_lib/compat'
|
|
4
2
|
import Switch from '.'
|
|
3
|
+
import { Meta, StoryObj } from '@storybook/react'
|
|
5
4
|
|
|
6
5
|
export default {
|
|
7
6
|
title: 'Switch',
|
|
8
7
|
component: Switch,
|
|
9
|
-
|
|
8
|
+
args: {
|
|
9
|
+
name: 'name',
|
|
10
|
+
label: 'label',
|
|
11
|
+
},
|
|
12
|
+
parameters: {
|
|
13
|
+
layout: 'centered',
|
|
14
|
+
},
|
|
15
|
+
} as Meta<typeof Switch>
|
|
10
16
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
export const Basic: StoryObj<typeof Switch> = {
|
|
18
|
+
render: function Render(args) {
|
|
19
|
+
const [checked, setChecked] = useState(false)
|
|
20
|
+
return (
|
|
21
|
+
<div>
|
|
22
|
+
<Switch
|
|
23
|
+
{...args}
|
|
24
|
+
name="name"
|
|
25
|
+
onChange={(v) => {
|
|
26
|
+
setChecked(v)
|
|
27
|
+
}}
|
|
28
|
+
checked={args.checked ?? checked}
|
|
29
|
+
/>
|
|
30
|
+
</div>
|
|
31
|
+
)
|
|
32
|
+
},
|
|
14
33
|
}
|
|
15
34
|
|
|
16
|
-
export const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
)
|
|
35
|
+
export const Checked: StoryObj<typeof Switch> = {
|
|
36
|
+
render: function Render(args) {
|
|
37
|
+
const [checked, setChecked] = useState(true)
|
|
38
|
+
return (
|
|
39
|
+
<div>
|
|
40
|
+
<Switch
|
|
41
|
+
{...args}
|
|
42
|
+
name="name"
|
|
43
|
+
onChange={(v) => {
|
|
44
|
+
setChecked(v)
|
|
45
|
+
}}
|
|
46
|
+
checked={args.checked ?? checked}
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
49
|
+
)
|
|
50
|
+
},
|
|
33
51
|
}
|
|
34
52
|
|
|
35
|
-
export const Labelled:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
53
|
+
export const Labelled: StoryObj<typeof Switch> = {
|
|
54
|
+
render: function Render(args) {
|
|
55
|
+
const [checked, setChecked] = useState(false)
|
|
56
|
+
return (
|
|
57
|
+
<div>
|
|
58
|
+
<Switch
|
|
59
|
+
{...args}
|
|
60
|
+
checked={args.checked ?? checked}
|
|
61
|
+
onChange={setChecked}
|
|
62
|
+
>
|
|
63
|
+
Label
|
|
64
|
+
</Switch>
|
|
65
|
+
</div>
|
|
66
|
+
)
|
|
67
|
+
},
|
|
46
68
|
}
|
|
47
69
|
|
|
48
|
-
export const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
70
|
+
export const Disabled: StoryObj<typeof Switch> = {
|
|
71
|
+
render: function Render(args) {
|
|
72
|
+
const [checked, setChecked] = useState(false)
|
|
73
|
+
return (
|
|
74
|
+
<div>
|
|
75
|
+
<Switch
|
|
76
|
+
{...args}
|
|
77
|
+
checked={args.checked ?? checked}
|
|
78
|
+
onChange={setChecked}
|
|
79
|
+
disabled
|
|
80
|
+
>
|
|
81
|
+
Label
|
|
82
|
+
</Switch>
|
|
83
|
+
</div>
|
|
84
|
+
)
|
|
85
|
+
},
|
|
62
86
|
}
|
|
@@ -5,6 +5,7 @@ import * as React from 'react'
|
|
|
5
5
|
import { useToggleState } from 'react-stately'
|
|
6
6
|
import styled from 'styled-components'
|
|
7
7
|
import { useObjectRef } from '@react-aria/utils'
|
|
8
|
+
import { focusVisibleFocusRingCss } from '@charcoal-ui/styled'
|
|
8
9
|
|
|
9
10
|
export type SwitchProps = {
|
|
10
11
|
name: string
|
|
@@ -71,10 +72,6 @@ const Label = styled.label`
|
|
|
71
72
|
opacity: 0.32;
|
|
72
73
|
cursor: default;
|
|
73
74
|
}
|
|
74
|
-
|
|
75
|
-
:active > input {
|
|
76
|
-
box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
|
|
77
|
-
}
|
|
78
75
|
`
|
|
79
76
|
|
|
80
77
|
const LabelInner = styled.div`
|
|
@@ -107,9 +104,7 @@ const SwitchInput = styled.input.attrs({ type: 'checkbox' })`
|
|
|
107
104
|
:active {
|
|
108
105
|
background-color: var(--charcoal-text4-press);
|
|
109
106
|
}
|
|
110
|
-
|
|
111
|
-
box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
|
|
112
|
-
}
|
|
107
|
+
${focusVisibleFocusRingCss}
|
|
113
108
|
|
|
114
109
|
&::after {
|
|
115
110
|
content: '';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`
|
|
3
|
+
exports[`Storybook Tests TagItem Default 1`] = `
|
|
4
4
|
.c0 {
|
|
5
5
|
isolation: isolate;
|
|
6
6
|
position: relative;
|
|
@@ -30,12 +30,18 @@ exports[`Storyshots TagItem Default 1`] = `
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
.c0:not(:disabled):not([aria-disabled]):focus,
|
|
33
|
-
.c0[aria-disabled='false']:focus
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
.c0[aria-disabled='false']:focus {
|
|
34
|
+
outline: none;
|
|
35
|
+
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.c0:not(:disabled):not([aria-disabled]):focus:not(:focus-visible),
|
|
39
|
+
.c0[aria-disabled='false']:focus:not(:focus-visible) {
|
|
40
|
+
box-shadow: none;
|
|
41
|
+
}
|
|
42
|
+
|
|
36
43
|
.c0:not(:disabled):not([aria-disabled]):focus-visible,
|
|
37
44
|
.c0[aria-disabled='false']:focus-visible {
|
|
38
|
-
outline: none;
|
|
39
45
|
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
40
46
|
}
|
|
41
47
|
|
|
@@ -106,7 +112,6 @@ exports[`Storyshots TagItem Default 1`] = `
|
|
|
106
112
|
>
|
|
107
113
|
<a
|
|
108
114
|
className="c0"
|
|
109
|
-
href=""
|
|
110
115
|
onClick={[Function]}
|
|
111
116
|
onDragStart={[Function]}
|
|
112
117
|
onKeyDown={[Function]}
|
|
@@ -119,11 +124,9 @@ exports[`Storyshots TagItem Default 1`] = `
|
|
|
119
124
|
onTouchEnd={[Function]}
|
|
120
125
|
onTouchMove={[Function]}
|
|
121
126
|
onTouchStart={[Function]}
|
|
122
|
-
rel=""
|
|
123
127
|
role="button"
|
|
124
128
|
size="M"
|
|
125
129
|
tabIndex={0}
|
|
126
|
-
target=""
|
|
127
130
|
>
|
|
128
131
|
<div
|
|
129
132
|
className="c1"
|
|
@@ -145,7 +148,7 @@ exports[`Storyshots TagItem Default 1`] = `
|
|
|
145
148
|
</div>
|
|
146
149
|
`;
|
|
147
150
|
|
|
148
|
-
exports[`
|
|
151
|
+
exports[`Storybook Tests TagItem Playground 1`] = `
|
|
149
152
|
.c1 {
|
|
150
153
|
isolation: isolate;
|
|
151
154
|
position: relative;
|
|
@@ -175,12 +178,18 @@ exports[`Storyshots TagItem Playground 1`] = `
|
|
|
175
178
|
}
|
|
176
179
|
|
|
177
180
|
.c1:not(:disabled):not([aria-disabled]):focus,
|
|
178
|
-
.c1[aria-disabled='false']:focus
|
|
179
|
-
|
|
180
|
-
|
|
181
|
+
.c1[aria-disabled='false']:focus {
|
|
182
|
+
outline: none;
|
|
183
|
+
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.c1:not(:disabled):not([aria-disabled]):focus:not(:focus-visible),
|
|
187
|
+
.c1[aria-disabled='false']:focus:not(:focus-visible) {
|
|
188
|
+
box-shadow: none;
|
|
189
|
+
}
|
|
190
|
+
|
|
181
191
|
.c1:not(:disabled):not([aria-disabled]):focus-visible,
|
|
182
192
|
.c1[aria-disabled='false']:focus-visible {
|
|
183
|
-
outline: none;
|
|
184
193
|
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
185
194
|
}
|
|
186
195
|
|
|
@@ -219,12 +228,18 @@ exports[`Storyshots TagItem Playground 1`] = `
|
|
|
219
228
|
}
|
|
220
229
|
|
|
221
230
|
.c8:not(:disabled):not([aria-disabled]):focus,
|
|
222
|
-
.c8[aria-disabled='false']:focus
|
|
223
|
-
|
|
224
|
-
|
|
231
|
+
.c8[aria-disabled='false']:focus {
|
|
232
|
+
outline: none;
|
|
233
|
+
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.c8:not(:disabled):not([aria-disabled]):focus:not(:focus-visible),
|
|
237
|
+
.c8[aria-disabled='false']:focus:not(:focus-visible) {
|
|
238
|
+
box-shadow: none;
|
|
239
|
+
}
|
|
240
|
+
|
|
225
241
|
.c8:not(:disabled):not([aria-disabled]):focus-visible,
|
|
226
242
|
.c8[aria-disabled='false']:focus-visible {
|
|
227
|
-
outline: none;
|
|
228
243
|
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
229
244
|
}
|
|
230
245
|
|
|
@@ -263,12 +278,18 @@ exports[`Storyshots TagItem Playground 1`] = `
|
|
|
263
278
|
}
|
|
264
279
|
|
|
265
280
|
.c9:not(:disabled):not([aria-disabled]):focus,
|
|
266
|
-
.c9[aria-disabled='false']:focus
|
|
267
|
-
|
|
268
|
-
|
|
281
|
+
.c9[aria-disabled='false']:focus {
|
|
282
|
+
outline: none;
|
|
283
|
+
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.c9:not(:disabled):not([aria-disabled]):focus:not(:focus-visible),
|
|
287
|
+
.c9[aria-disabled='false']:focus:not(:focus-visible) {
|
|
288
|
+
box-shadow: none;
|
|
289
|
+
}
|
|
290
|
+
|
|
269
291
|
.c9:not(:disabled):not([aria-disabled]):focus-visible,
|
|
270
292
|
.c9[aria-disabled='false']:focus-visible {
|
|
271
|
-
outline: none;
|
|
272
293
|
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
273
294
|
}
|
|
274
295
|
|
|
@@ -307,12 +328,18 @@ exports[`Storyshots TagItem Playground 1`] = `
|
|
|
307
328
|
}
|
|
308
329
|
|
|
309
330
|
.c11:not(:disabled):not([aria-disabled]):focus,
|
|
310
|
-
.c11[aria-disabled='false']:focus
|
|
311
|
-
|
|
312
|
-
|
|
331
|
+
.c11[aria-disabled='false']:focus {
|
|
332
|
+
outline: none;
|
|
333
|
+
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.c11:not(:disabled):not([aria-disabled]):focus:not(:focus-visible),
|
|
337
|
+
.c11[aria-disabled='false']:focus:not(:focus-visible) {
|
|
338
|
+
box-shadow: none;
|
|
339
|
+
}
|
|
340
|
+
|
|
313
341
|
.c11:not(:disabled):not([aria-disabled]):focus-visible,
|
|
314
342
|
.c11[aria-disabled='false']:focus-visible {
|
|
315
|
-
outline: none;
|
|
316
343
|
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
317
344
|
}
|
|
318
345
|
|
|
@@ -351,12 +378,18 @@ exports[`Storyshots TagItem Playground 1`] = `
|
|
|
351
378
|
}
|
|
352
379
|
|
|
353
380
|
.c12:not(:disabled):not([aria-disabled]):focus,
|
|
354
|
-
.c12[aria-disabled='false']:focus
|
|
355
|
-
|
|
356
|
-
|
|
381
|
+
.c12[aria-disabled='false']:focus {
|
|
382
|
+
outline: none;
|
|
383
|
+
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.c12:not(:disabled):not([aria-disabled]):focus:not(:focus-visible),
|
|
387
|
+
.c12[aria-disabled='false']:focus:not(:focus-visible) {
|
|
388
|
+
box-shadow: none;
|
|
389
|
+
}
|
|
390
|
+
|
|
357
391
|
.c12:not(:disabled):not([aria-disabled]):focus-visible,
|
|
358
392
|
.c12[aria-disabled='false']:focus-visible {
|
|
359
|
-
outline: none;
|
|
360
393
|
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
361
394
|
}
|
|
362
395
|
|
|
@@ -395,12 +428,18 @@ exports[`Storyshots TagItem Playground 1`] = `
|
|
|
395
428
|
}
|
|
396
429
|
|
|
397
430
|
.c13:not(:disabled):not([aria-disabled]):focus,
|
|
398
|
-
.c13[aria-disabled='false']:focus
|
|
399
|
-
|
|
400
|
-
|
|
431
|
+
.c13[aria-disabled='false']:focus {
|
|
432
|
+
outline: none;
|
|
433
|
+
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
.c13:not(:disabled):not([aria-disabled]):focus:not(:focus-visible),
|
|
437
|
+
.c13[aria-disabled='false']:focus:not(:focus-visible) {
|
|
438
|
+
box-shadow: none;
|
|
439
|
+
}
|
|
440
|
+
|
|
401
441
|
.c13:not(:disabled):not([aria-disabled]):focus-visible,
|
|
402
442
|
.c13[aria-disabled='false']:focus-visible {
|
|
403
|
-
outline: none;
|
|
404
443
|
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
405
444
|
}
|
|
406
445
|
|