@charcoal-ui/react 3.7.0 → 3.9.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.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/Modal/useCustomModalOverlay.d.ts +12 -0
- package/dist/components/Modal/useCustomModalOverlay.d.ts.map +1 -0
- 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/TextArea/index.d.ts.map +1 -1
- package/dist/components/TextField/TextField.story.d.ts +14 -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 +1006 -2240
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1001 -2241
- package/dist/index.esm.js.map +1 -1
- package/dist/styled.d.ts +4 -4
- package/package.json +7 -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 +55 -42
- package/src/components/Checkbox/index.tsx +15 -17
- 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 +148 -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 +135 -13
- package/src/components/IconButton/index.story.tsx +30 -23
- package/src/components/IconButton/index.tsx +35 -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 +224 -171
- package/src/components/Modal/index.story.tsx +139 -133
- package/src/components/Modal/index.tsx +15 -20
- package/src/components/Modal/useCustomModalOverlay.tsx +42 -0
- 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 +1001 -121
- package/src/components/Radio/index.story.tsx +128 -63
- package/src/components/Radio/index.tsx +15 -17
- 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/TextArea/index.tsx +22 -14
- package/src/components/TextField/TextField.story.tsx +85 -64
- package/src/components/TextField/__snapshots__/TextField.story.storyshot +479 -167
- package/src/components/TextField/index.tsx +22 -21
|
@@ -1,76 +1,141 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { css } from 'styled-components'
|
|
3
|
-
import { Story } from '../../_lib/compat'
|
|
1
|
+
import styled from 'styled-components'
|
|
4
2
|
import Radio, { RadioGroup } from '.'
|
|
5
3
|
import { px } from '@charcoal-ui/utils'
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { StoryObj } from '@storybook/react'
|
|
5
|
+
import { useState } from 'react'
|
|
8
6
|
|
|
9
7
|
export default {
|
|
10
8
|
title: 'Radio',
|
|
11
9
|
component: Radio,
|
|
12
|
-
argTypes: {
|
|
13
|
-
value: {
|
|
14
|
-
control: { type: 'select' },
|
|
15
|
-
options,
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
10
|
args: {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
name: 'name',
|
|
12
|
+
label: 'label',
|
|
13
|
+
},
|
|
14
|
+
parameters: {
|
|
15
|
+
layout: 'centered',
|
|
23
16
|
},
|
|
24
17
|
}
|
|
25
18
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
19
|
+
const LayoutDiv = styled.div`
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
gap: ${({ theme }) => px(theme.spacing[24])};
|
|
23
|
+
`
|
|
24
|
+
|
|
25
|
+
export const Basic: StoryObj<typeof Radio> = {
|
|
26
|
+
render: function Render() {
|
|
27
|
+
const options = ['1', '2', '3']
|
|
28
|
+
const [value, setValue] = useState(options[0])
|
|
29
|
+
return (
|
|
30
|
+
<LayoutDiv>
|
|
31
|
+
<RadioGroup
|
|
32
|
+
label={'label'}
|
|
33
|
+
name={'name'}
|
|
34
|
+
value={value}
|
|
35
|
+
onChange={setValue}
|
|
36
|
+
>
|
|
37
|
+
{options.map((option) => (
|
|
38
|
+
<Radio key={option} value={option}>
|
|
39
|
+
Value {option}
|
|
40
|
+
</Radio>
|
|
41
|
+
))}
|
|
42
|
+
</RadioGroup>
|
|
43
|
+
</LayoutDiv>
|
|
44
|
+
)
|
|
45
|
+
},
|
|
33
46
|
}
|
|
34
47
|
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
readonly={readonly}
|
|
59
|
-
invalid={invalid}
|
|
60
|
-
>
|
|
61
|
-
{options.map((option) => (
|
|
62
|
-
<Radio
|
|
63
|
-
key={option}
|
|
64
|
-
value={option}
|
|
65
|
-
disabled={childDisabled}
|
|
66
|
-
className={className}
|
|
67
|
-
>
|
|
68
|
-
{name}({option})を選ぶ
|
|
69
|
-
</Radio>
|
|
70
|
-
))}
|
|
71
|
-
</RadioGroup>
|
|
72
|
-
))}
|
|
73
|
-
</div>
|
|
74
|
-
)
|
|
48
|
+
export const Disabled: StoryObj<typeof Radio> = {
|
|
49
|
+
render: function Render() {
|
|
50
|
+
const options = ['1', '2', '3']
|
|
51
|
+
const [value, setValue] = useState(options[0])
|
|
52
|
+
return (
|
|
53
|
+
<LayoutDiv>
|
|
54
|
+
<RadioGroup
|
|
55
|
+
label={'label'}
|
|
56
|
+
name={'name'}
|
|
57
|
+
value={value}
|
|
58
|
+
onChange={setValue}
|
|
59
|
+
disabled
|
|
60
|
+
>
|
|
61
|
+
{options.map((option) => (
|
|
62
|
+
<Radio key={option} value={option} disabled>
|
|
63
|
+
Value {option}
|
|
64
|
+
</Radio>
|
|
65
|
+
))}
|
|
66
|
+
</RadioGroup>
|
|
67
|
+
</LayoutDiv>
|
|
68
|
+
)
|
|
69
|
+
},
|
|
70
|
+
}
|
|
75
71
|
|
|
76
|
-
export const
|
|
72
|
+
export const PartialDisabled: StoryObj<typeof Radio> = {
|
|
73
|
+
render: function Render() {
|
|
74
|
+
const options = ['1', '2', '3']
|
|
75
|
+
const [value, setValue] = useState(options[0])
|
|
76
|
+
return (
|
|
77
|
+
<LayoutDiv>
|
|
78
|
+
<RadioGroup
|
|
79
|
+
label={'label'}
|
|
80
|
+
name={'name'}
|
|
81
|
+
value={value}
|
|
82
|
+
onChange={setValue}
|
|
83
|
+
>
|
|
84
|
+
{options.map((option) => (
|
|
85
|
+
<Radio key={option} value={option} disabled={option === '2'}>
|
|
86
|
+
Value {option}
|
|
87
|
+
</Radio>
|
|
88
|
+
))}
|
|
89
|
+
</RadioGroup>
|
|
90
|
+
</LayoutDiv>
|
|
91
|
+
)
|
|
92
|
+
},
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export const Readonly: StoryObj<typeof Radio> = {
|
|
96
|
+
render: function Render() {
|
|
97
|
+
const options = ['1', '2', '3']
|
|
98
|
+
const [value, setValue] = useState(options[0])
|
|
99
|
+
return (
|
|
100
|
+
<LayoutDiv>
|
|
101
|
+
<RadioGroup
|
|
102
|
+
label={'label'}
|
|
103
|
+
name={'name'}
|
|
104
|
+
value={value}
|
|
105
|
+
onChange={setValue}
|
|
106
|
+
readonly
|
|
107
|
+
>
|
|
108
|
+
{options.map((option) => (
|
|
109
|
+
<Radio key={option} value={option}>
|
|
110
|
+
Value {option}
|
|
111
|
+
</Radio>
|
|
112
|
+
))}
|
|
113
|
+
</RadioGroup>
|
|
114
|
+
</LayoutDiv>
|
|
115
|
+
)
|
|
116
|
+
},
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export const Invalid: StoryObj<typeof Radio> = {
|
|
120
|
+
render: function Render() {
|
|
121
|
+
const options = ['1', '2', '3']
|
|
122
|
+
const [value, setValue] = useState(options[0])
|
|
123
|
+
return (
|
|
124
|
+
<LayoutDiv>
|
|
125
|
+
<RadioGroup
|
|
126
|
+
label={'label'}
|
|
127
|
+
name={'name'}
|
|
128
|
+
value={value}
|
|
129
|
+
onChange={setValue}
|
|
130
|
+
invalid
|
|
131
|
+
>
|
|
132
|
+
{options.map((option) => (
|
|
133
|
+
<Radio key={option} value={option}>
|
|
134
|
+
Value {option}
|
|
135
|
+
</Radio>
|
|
136
|
+
))}
|
|
137
|
+
</RadioGroup>
|
|
138
|
+
</LayoutDiv>
|
|
139
|
+
)
|
|
140
|
+
},
|
|
141
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { memo, forwardRef, useCallback, useContext } from 'react'
|
|
2
2
|
import * as React from 'react'
|
|
3
|
-
import styled
|
|
3
|
+
import styled from 'styled-components'
|
|
4
4
|
import warning from 'warning'
|
|
5
|
+
import { focusVisibleFocusRingCss } from '@charcoal-ui/styled'
|
|
5
6
|
|
|
6
7
|
export type RadioProps = React.PropsWithChildren<{
|
|
7
8
|
value: string
|
|
@@ -45,7 +46,7 @@ const Radio = forwardRef<HTMLInputElement, RadioProps>(function RadioInner(
|
|
|
45
46
|
name={name}
|
|
46
47
|
value={value}
|
|
47
48
|
checked={isSelected}
|
|
48
|
-
invalid={invalid}
|
|
49
|
+
aria-invalid={invalid}
|
|
49
50
|
onChange={handleChange}
|
|
50
51
|
disabled={isDisabled || isReadonly}
|
|
51
52
|
ref={ref}
|
|
@@ -64,15 +65,13 @@ const RadioRoot = styled.label`
|
|
|
64
65
|
align-items: center;
|
|
65
66
|
cursor: pointer;
|
|
66
67
|
|
|
67
|
-
&:disabled,
|
|
68
68
|
&[aria-disabled]:not([aria-disabled='false']) {
|
|
69
69
|
opacity: 0.32;
|
|
70
|
+
cursor: default;
|
|
70
71
|
}
|
|
71
72
|
`
|
|
72
73
|
|
|
73
|
-
export const RadioInput = styled.input.attrs({ type: 'radio' })
|
|
74
|
-
invalid?: boolean
|
|
75
|
-
}>`
|
|
74
|
+
export const RadioInput = styled.input.attrs({ type: 'radio' })`
|
|
76
75
|
/** Make prior to browser default style */
|
|
77
76
|
&[type='radio'] {
|
|
78
77
|
appearance: none;
|
|
@@ -89,25 +88,24 @@ export const RadioInput = styled.input.attrs({ type: 'radio' })<{
|
|
|
89
88
|
background-color: var(--charcoal-surface1);
|
|
90
89
|
transition: 0.2s background-color, 0.2s box-shadow;
|
|
91
90
|
|
|
91
|
+
:disabled {
|
|
92
|
+
cursor: default;
|
|
93
|
+
}
|
|
94
|
+
|
|
92
95
|
&:not(:disabled):not([aria-disabled]),
|
|
93
96
|
&[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
97
|
&:hover {
|
|
101
98
|
background-color: var(--charcoal-surface1-hover);
|
|
102
99
|
}
|
|
103
100
|
&:active {
|
|
104
101
|
background-color: var(--charcoal-surface1-press);
|
|
105
102
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
103
|
+
${focusVisibleFocusRingCss}
|
|
104
|
+
&[aria-invalid='true'] {
|
|
105
|
+
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
106
|
+
&:focus {
|
|
107
|
+
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
108
|
+
}
|
|
111
109
|
}
|
|
112
110
|
}
|
|
113
111
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`
|
|
3
|
+
exports[`Storybook Tests SegmentedControl ObjectSegments 1`] = `
|
|
4
4
|
.c0 {
|
|
5
5
|
display: -webkit-inline-box;
|
|
6
6
|
display: -webkit-inline-flex;
|
|
@@ -259,7 +259,7 @@ exports[`Storyshots SegmentedControl Object Segments 1`] = `
|
|
|
259
259
|
</div>
|
|
260
260
|
`;
|
|
261
261
|
|
|
262
|
-
exports[`
|
|
262
|
+
exports[`Storybook Tests SegmentedControl StringSegments 1`] = `
|
|
263
263
|
.c0 {
|
|
264
264
|
display: -webkit-inline-box;
|
|
265
265
|
display: -webkit-inline-flex;
|
|
@@ -1,37 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { Story } from '../../_lib/compat'
|
|
1
|
+
import SegmentedControl from '.'
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react'
|
|
4
3
|
|
|
5
4
|
export default {
|
|
6
5
|
title: 'SegmentedControl',
|
|
7
6
|
component: SegmentedControl,
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const StringSegments: Story<SegmentedControlProps> = (props) => {
|
|
11
|
-
return <SegmentedControl {...props} onChange={action('change')} />
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
StringSegments.args = {
|
|
15
|
-
name: 'test',
|
|
16
|
-
data: ['option1', 'option2', 'option3'],
|
|
17
|
-
disabled: false,
|
|
18
|
-
readonly: false,
|
|
19
|
-
required: false,
|
|
20
|
-
}
|
|
7
|
+
} as Meta<typeof SegmentedControl>
|
|
21
8
|
|
|
22
|
-
export const
|
|
23
|
-
|
|
9
|
+
export const StringSegments: StoryObj<typeof SegmentedControl> = {
|
|
10
|
+
args: {
|
|
11
|
+
name: 'test',
|
|
12
|
+
data: ['option1', 'option2', 'option3'],
|
|
13
|
+
disabled: false,
|
|
14
|
+
readonly: false,
|
|
15
|
+
required: false,
|
|
16
|
+
},
|
|
24
17
|
}
|
|
25
18
|
|
|
26
|
-
ObjectSegments
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
19
|
+
export const ObjectSegments: StoryObj<typeof SegmentedControl> = {
|
|
20
|
+
args: {
|
|
21
|
+
name: 'test',
|
|
22
|
+
data: [
|
|
23
|
+
{ label: '選択肢1', value: 'option1' },
|
|
24
|
+
{ label: '選択肢2', value: 'option2' },
|
|
25
|
+
{ label: '選択肢3', value: 'option3' },
|
|
26
|
+
{ label: '選択肢4', value: 'option4', disabled: true },
|
|
27
|
+
],
|
|
28
|
+
disabled: false,
|
|
29
|
+
readonly: false,
|
|
30
|
+
required: false,
|
|
31
|
+
},
|
|
37
32
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`
|
|
3
|
+
exports[`Storybook Tests Switch Basic 1`] = `
|
|
4
4
|
.c0 {
|
|
5
5
|
display: inline-grid;
|
|
6
6
|
grid-template-columns: auto 1fr;
|
|
@@ -18,15 +18,148 @@ exports[`Storyshots Switch Labelled 1`] = `
|
|
|
18
18
|
cursor: default;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
.
|
|
21
|
+
.c1 {
|
|
22
|
+
-webkit-appearance: none;
|
|
23
|
+
-moz-appearance: none;
|
|
24
|
+
appearance: none;
|
|
25
|
+
display: -webkit-inline-box;
|
|
26
|
+
display: -webkit-inline-flex;
|
|
27
|
+
display: -ms-inline-flexbox;
|
|
28
|
+
display: inline-flex;
|
|
29
|
+
position: relative;
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
width: 28px;
|
|
32
|
+
border: 2px solid transparent;
|
|
33
|
+
-webkit-transition-property: background-color,box-shadow;
|
|
34
|
+
transition-property: background-color,box-shadow;
|
|
35
|
+
-webkit-transition-duration: 0.2s;
|
|
36
|
+
transition-duration: 0.2s;
|
|
37
|
+
cursor: inherit;
|
|
38
|
+
outline: none;
|
|
39
|
+
border-radius: 16px;
|
|
40
|
+
height: 16px;
|
|
41
|
+
margin: 0;
|
|
42
|
+
background-color: var(--charcoal-text4);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.c1:hover {
|
|
46
|
+
background-color: var(--charcoal-text4-hover);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.c1:active {
|
|
50
|
+
background-color: var(--charcoal-text4-press);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.c1:focus {
|
|
54
|
+
outline: none;
|
|
22
55
|
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
23
56
|
}
|
|
24
57
|
|
|
25
|
-
.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
58
|
+
.c1:focus:not(:focus-visible) {
|
|
59
|
+
box-shadow: none;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.c1:focus-visible {
|
|
63
|
+
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.c1::after {
|
|
67
|
+
content: '';
|
|
68
|
+
position: absolute;
|
|
69
|
+
display: block;
|
|
70
|
+
top: 0;
|
|
71
|
+
left: 0;
|
|
72
|
+
width: 12px;
|
|
73
|
+
height: 12px;
|
|
74
|
+
-webkit-transform: translateX(0);
|
|
75
|
+
-ms-transform: translateX(0);
|
|
76
|
+
transform: translateX(0);
|
|
77
|
+
-webkit-transition: -webkit-transform 0.2s;
|
|
78
|
+
-webkit-transition: transform 0.2s;
|
|
79
|
+
transition: transform 0.2s;
|
|
80
|
+
border-radius: 1024px;
|
|
81
|
+
background-color: var(--charcoal-text5);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.c1::after:hover {
|
|
85
|
+
background-color: var(--charcoal-text5-hover);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.c1::after:active {
|
|
89
|
+
background-color: var(--charcoal-text5-press);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.c1:checked {
|
|
93
|
+
background-color: var(--charcoal-brand);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.c1:checked:hover {
|
|
97
|
+
background-color: var(--charcoal-brand-hover);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.c1:checked:active {
|
|
101
|
+
background-color: var(--charcoal-brand-press);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.c1:checked::after {
|
|
105
|
+
-webkit-transform: translateX(12px);
|
|
106
|
+
-ms-transform: translateX(12px);
|
|
107
|
+
transform: translateX(12px);
|
|
108
|
+
-webkit-transition: -webkit-transform 0.2s;
|
|
109
|
+
-webkit-transition: transform 0.2s;
|
|
110
|
+
transition: transform 0.2s;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
<div
|
|
114
|
+
data-dark={false}
|
|
115
|
+
>
|
|
116
|
+
<div>
|
|
117
|
+
<label
|
|
118
|
+
className="c0"
|
|
119
|
+
>
|
|
120
|
+
<input
|
|
121
|
+
aria-label="label"
|
|
122
|
+
checked={false}
|
|
123
|
+
className="c1"
|
|
124
|
+
disabled={false}
|
|
125
|
+
name="name"
|
|
126
|
+
onChange={[Function]}
|
|
127
|
+
onClick={[Function]}
|
|
128
|
+
onDragStart={[Function]}
|
|
129
|
+
onKeyDown={[Function]}
|
|
130
|
+
onKeyUp={[Function]}
|
|
131
|
+
onMouseDown={[Function]}
|
|
132
|
+
onMouseEnter={[Function]}
|
|
133
|
+
onMouseLeave={[Function]}
|
|
134
|
+
onMouseUp={[Function]}
|
|
135
|
+
onTouchCancel={[Function]}
|
|
136
|
+
onTouchEnd={[Function]}
|
|
137
|
+
onTouchMove={[Function]}
|
|
138
|
+
onTouchStart={[Function]}
|
|
139
|
+
role="switch"
|
|
140
|
+
type="checkbox"
|
|
141
|
+
/>
|
|
142
|
+
</label>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
`;
|
|
146
|
+
|
|
147
|
+
exports[`Storybook Tests Switch Checked 1`] = `
|
|
148
|
+
.c0 {
|
|
149
|
+
display: inline-grid;
|
|
150
|
+
grid-template-columns: auto 1fr;
|
|
151
|
+
-webkit-align-items: center;
|
|
152
|
+
-webkit-box-align: center;
|
|
153
|
+
-ms-flex-align: center;
|
|
154
|
+
align-items: center;
|
|
155
|
+
cursor: pointer;
|
|
156
|
+
outline: 0;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.c0:disabled,
|
|
160
|
+
.c0[aria-disabled]:not([aria-disabled='false']) {
|
|
161
|
+
opacity: 0.32;
|
|
162
|
+
cursor: default;
|
|
30
163
|
}
|
|
31
164
|
|
|
32
165
|
.c1 {
|
|
@@ -62,6 +195,15 @@ exports[`Storyshots Switch Labelled 1`] = `
|
|
|
62
195
|
}
|
|
63
196
|
|
|
64
197
|
.c1:focus {
|
|
198
|
+
outline: none;
|
|
199
|
+
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.c1:focus:not(:focus-visible) {
|
|
203
|
+
box-shadow: none;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.c1:focus-visible {
|
|
65
207
|
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
66
208
|
}
|
|
67
209
|
|
|
@@ -117,11 +259,11 @@ exports[`Storyshots Switch Labelled 1`] = `
|
|
|
117
259
|
>
|
|
118
260
|
<div>
|
|
119
261
|
<label
|
|
120
|
-
aria-disabled={false}
|
|
121
262
|
className="c0"
|
|
122
263
|
>
|
|
123
264
|
<input
|
|
124
|
-
|
|
265
|
+
aria-label="label"
|
|
266
|
+
checked={true}
|
|
125
267
|
className="c1"
|
|
126
268
|
disabled={false}
|
|
127
269
|
name="name"
|
|
@@ -141,17 +283,12 @@ exports[`Storyshots Switch Labelled 1`] = `
|
|
|
141
283
|
role="switch"
|
|
142
284
|
type="checkbox"
|
|
143
285
|
/>
|
|
144
|
-
<div
|
|
145
|
-
className="c2"
|
|
146
|
-
>
|
|
147
|
-
選択する
|
|
148
|
-
</div>
|
|
149
286
|
</label>
|
|
150
287
|
</div>
|
|
151
288
|
</div>
|
|
152
289
|
`;
|
|
153
290
|
|
|
154
|
-
exports[`
|
|
291
|
+
exports[`Storybook Tests Switch Disabled 1`] = `
|
|
155
292
|
.c0 {
|
|
156
293
|
display: inline-grid;
|
|
157
294
|
grid-template-columns: auto 1fr;
|
|
@@ -169,10 +306,6 @@ exports[`Storyshots Switch Playground 1`] = `
|
|
|
169
306
|
cursor: default;
|
|
170
307
|
}
|
|
171
308
|
|
|
172
|
-
.c0:active > input {
|
|
173
|
-
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
309
|
.c2 {
|
|
177
310
|
font-size: 14px;
|
|
178
311
|
line-height: 22px;
|
|
@@ -213,6 +346,15 @@ exports[`Storyshots Switch Playground 1`] = `
|
|
|
213
346
|
}
|
|
214
347
|
|
|
215
348
|
.c1:focus {
|
|
349
|
+
outline: none;
|
|
350
|
+
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.c1:focus:not(:focus-visible) {
|
|
354
|
+
box-shadow: none;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.c1:focus-visible {
|
|
216
358
|
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
217
359
|
}
|
|
218
360
|
|
|
@@ -268,12 +410,13 @@ exports[`Storyshots Switch Playground 1`] = `
|
|
|
268
410
|
>
|
|
269
411
|
<div>
|
|
270
412
|
<label
|
|
413
|
+
aria-disabled={true}
|
|
271
414
|
className="c0"
|
|
272
415
|
>
|
|
273
416
|
<input
|
|
274
417
|
checked={false}
|
|
275
418
|
className="c1"
|
|
276
|
-
disabled={
|
|
419
|
+
disabled={true}
|
|
277
420
|
name="name"
|
|
278
421
|
onChange={[Function]}
|
|
279
422
|
onClick={[Function]}
|
|
@@ -294,14 +437,14 @@ exports[`Storyshots Switch Playground 1`] = `
|
|
|
294
437
|
<div
|
|
295
438
|
className="c2"
|
|
296
439
|
>
|
|
297
|
-
|
|
440
|
+
Label
|
|
298
441
|
</div>
|
|
299
442
|
</label>
|
|
300
443
|
</div>
|
|
301
444
|
</div>
|
|
302
445
|
`;
|
|
303
446
|
|
|
304
|
-
exports[`
|
|
447
|
+
exports[`Storybook Tests Switch Labelled 1`] = `
|
|
305
448
|
.c0 {
|
|
306
449
|
display: inline-grid;
|
|
307
450
|
grid-template-columns: auto 1fr;
|
|
@@ -319,8 +462,11 @@ exports[`Storyshots Switch Unlabelled 1`] = `
|
|
|
319
462
|
cursor: default;
|
|
320
463
|
}
|
|
321
464
|
|
|
322
|
-
.
|
|
323
|
-
|
|
465
|
+
.c2 {
|
|
466
|
+
font-size: 14px;
|
|
467
|
+
line-height: 22px;
|
|
468
|
+
color: var(--charcoal-text2);
|
|
469
|
+
margin-left: 4px;
|
|
324
470
|
}
|
|
325
471
|
|
|
326
472
|
.c1 {
|
|
@@ -356,6 +502,15 @@ exports[`Storyshots Switch Unlabelled 1`] = `
|
|
|
356
502
|
}
|
|
357
503
|
|
|
358
504
|
.c1:focus {
|
|
505
|
+
outline: none;
|
|
506
|
+
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
.c1:focus:not(:focus-visible) {
|
|
510
|
+
box-shadow: none;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
.c1:focus-visible {
|
|
359
514
|
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
360
515
|
}
|
|
361
516
|
|
|
@@ -411,11 +566,9 @@ exports[`Storyshots Switch Unlabelled 1`] = `
|
|
|
411
566
|
>
|
|
412
567
|
<div>
|
|
413
568
|
<label
|
|
414
|
-
aria-disabled={false}
|
|
415
569
|
className="c0"
|
|
416
570
|
>
|
|
417
571
|
<input
|
|
418
|
-
aria-label="label"
|
|
419
572
|
checked={false}
|
|
420
573
|
className="c1"
|
|
421
574
|
disabled={false}
|
|
@@ -436,6 +589,11 @@ exports[`Storyshots Switch Unlabelled 1`] = `
|
|
|
436
589
|
role="switch"
|
|
437
590
|
type="checkbox"
|
|
438
591
|
/>
|
|
592
|
+
<div
|
|
593
|
+
className="c2"
|
|
594
|
+
>
|
|
595
|
+
Label
|
|
596
|
+
</div>
|
|
439
597
|
</label>
|
|
440
598
|
</div>
|
|
441
599
|
</div>
|