@charcoal-ui/react 6.0.0-beta.2 → 6.0.0-rc.1
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/Modal/index.d.ts +1 -1
- package/dist/components/TagItem/index.d.ts +5 -4
- package/dist/components/TagItem/index.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +160 -152
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/layered.css +160 -152
- package/dist/layered.css.map +1 -1
- package/package.json +5 -5
- package/src/__tests__/css-variables.test.ts +66 -0
- package/src/components/Button/__snapshots__/index.css.snap +30 -30
- package/src/components/Button/index.css +30 -30
- package/src/components/Button/index.story.tsx +18 -0
- package/src/components/Checkbox/CheckboxInput/index.css +10 -10
- package/src/components/Checkbox/__snapshots__/index.css.snap +1 -1
- package/src/components/Checkbox/index.css +1 -1
- package/src/components/Checkbox/index.story.tsx +18 -0
- package/src/components/Clickable/index.story.tsx +14 -0
- package/src/components/DropdownSelector/DropdownMenuItem/index.css +3 -3
- package/src/components/DropdownSelector/ListItem/index.css +1 -1
- package/src/components/DropdownSelector/MenuItemGroup/index.css +1 -1
- package/src/components/DropdownSelector/Popover/index.css +2 -2
- package/src/components/DropdownSelector/__snapshots__/index.css.snap +6 -6
- package/src/components/DropdownSelector/index.css +6 -6
- package/src/components/DropdownSelector/index.story.tsx +49 -0
- package/src/components/FieldLabel/__snapshots__/index.css.snap +3 -3
- package/src/components/FieldLabel/index.css +3 -3
- package/src/components/HintText/__snapshots__/index.css.snap +3 -3
- package/src/components/HintText/index.css +3 -3
- package/src/components/HintText/index.story.tsx +12 -0
- package/src/components/IconButton/__snapshots__/index.css.snap +16 -16
- package/src/components/IconButton/index.css +16 -16
- package/src/components/IconButton/index.story.tsx +15 -0
- package/src/components/LoadingSpinner/__snapshots__/index.css.snap +7 -7
- package/src/components/LoadingSpinner/index.css +7 -7
- package/src/components/LoadingSpinner/index.story.tsx +13 -0
- package/src/components/Modal/Dialog/index.css +1 -1
- package/src/components/Modal/ModalPlumbing.css +1 -1
- package/src/components/Modal/__snapshots__/index.css.snap +2 -2
- package/src/components/Modal/index.css +2 -2
- package/src/components/Modal/index.story.tsx +20 -0
- package/src/components/MultiSelect/__snapshots__/index.css.snap +10 -10
- package/src/components/MultiSelect/index.css +10 -10
- package/src/components/MultiSelect/index.story.tsx +50 -0
- package/src/components/Pagination/Pagination.story.tsx +11 -0
- package/src/components/Pagination/__snapshots__/index.css.snap +11 -11
- package/src/components/Pagination/index.css +11 -11
- package/src/components/Radio/RadioInput/index.css +10 -10
- package/src/components/Radio/__snapshots__/index.css.snap +1 -1
- package/src/components/Radio/index.css +1 -1
- package/src/components/Radio/index.story.tsx +40 -0
- package/src/components/SegmentedControl/__snapshots__/index.css.snap +4 -4
- package/src/components/SegmentedControl/index.css +4 -4
- package/src/components/SegmentedControl/index.story.tsx +20 -0
- package/src/components/Switch/SwitchInput/index.css +9 -9
- package/src/components/Switch/__snapshots__/index.css.snap +1 -1
- package/src/components/Switch/index.css +1 -1
- package/src/components/Switch/index.story.tsx +19 -0
- package/src/components/TagItem/__snapshots__/index.css.snap +5 -4
- package/src/components/TagItem/__snapshots__/index.story.storyshot +17 -17
- package/src/components/TagItem/index.css +5 -4
- package/src/components/TagItem/index.story.tsx +17 -0
- package/src/components/TagItem/index.tsx +25 -7
- package/src/components/TextArea/TextArea.story.tsx +30 -0
- package/src/components/TextArea/__snapshots__/index.css.snap +7 -5
- package/src/components/TextArea/index.css +8 -5
- package/src/components/TextEllipsis/__snapshots__/index.css.snap +3 -0
- package/src/components/TextEllipsis/index.css +4 -0
- package/src/components/TextField/AssistiveText/index.css +2 -2
- package/src/components/TextField/TextField.story.tsx +30 -0
- package/src/components/TextField/__snapshots__/index.css.snap +6 -6
- package/src/components/TextField/index.css +6 -6
- package/src/index.ts +2 -2
|
@@ -118,3 +118,23 @@ export const UniformWidthAndFullWidthSegments: StoryObj<
|
|
|
118
118
|
fullWidth: true,
|
|
119
119
|
},
|
|
120
120
|
}
|
|
121
|
+
|
|
122
|
+
export const TokenV2: StoryObj<typeof SegmentedControl> = {
|
|
123
|
+
parameters: {
|
|
124
|
+
tokenVersion: 'v2',
|
|
125
|
+
},
|
|
126
|
+
args: {
|
|
127
|
+
name: 'token-v2',
|
|
128
|
+
data: [
|
|
129
|
+
{ label: '選択肢1', value: 'option1' },
|
|
130
|
+
{ label: '選択肢2', value: 'option2' },
|
|
131
|
+
{ label: '選択肢3', value: 'option3' },
|
|
132
|
+
{ label: 'Disabled', value: 'option4', disabled: true },
|
|
133
|
+
],
|
|
134
|
+
disabled: false,
|
|
135
|
+
readonly: false,
|
|
136
|
+
required: false,
|
|
137
|
+
uniformSegmentWidth: true,
|
|
138
|
+
fullWidth: false,
|
|
139
|
+
},
|
|
140
|
+
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
border-radius: 16px;
|
|
15
15
|
height: 16px;
|
|
16
16
|
margin: 0;
|
|
17
|
-
background-color: var(--charcoal-
|
|
17
|
+
background-color: var(--charcoal-color-container-neutral-default);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
.charcoal-switch-input:disabled,
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
transform: translateX(0);
|
|
35
35
|
transition: transform 0.2s;
|
|
36
36
|
border-radius: 1024px;
|
|
37
|
-
background-color: var(--charcoal-
|
|
37
|
+
background-color: var(--charcoal-color-icon-on-primary-default);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
.charcoal-switch-input:checked::after {
|
|
@@ -43,15 +43,15 @@
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
.charcoal-switch-input:checked {
|
|
46
|
-
background-color: var(--charcoal-
|
|
46
|
+
background-color: var(--charcoal-color-container-primary-default);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
.charcoal-switch-input:not(:disabled):hover {
|
|
50
|
-
background-color: var(--charcoal-
|
|
50
|
+
background-color: var(--charcoal-color-container-neutral-hover);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
.charcoal-switch-input:not(:disabled):active {
|
|
54
|
-
background-color: var(--charcoal-
|
|
54
|
+
background-color: var(--charcoal-color-container-neutral-press);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
.charcoal-switch-input:not(:disabled):focus {
|
|
@@ -66,17 +66,17 @@
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
.charcoal-switch-input:not(:disabled)::after:hover {
|
|
69
|
-
background-color: var(--charcoal-
|
|
69
|
+
background-color: var(--charcoal-color-icon-on-primary-hover);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
.charcoal-switch-input:not(:disabled)::after:active {
|
|
73
|
-
background-color: var(--charcoal-
|
|
73
|
+
background-color: var(--charcoal-color-icon-on-primary-press);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
.charcoal-switch-input:not(:disabled):checked:hover {
|
|
77
|
-
background-color: var(--charcoal-
|
|
77
|
+
background-color: var(--charcoal-color-container-primary-hover);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
.charcoal-switch-input:not(:disabled):checked:active {
|
|
81
|
-
background-color: var(--charcoal-
|
|
81
|
+
background-color: var(--charcoal-color-container-primary-press);
|
|
82
82
|
}
|
|
@@ -81,3 +81,22 @@ export const Disabled: StoryObj<typeof Switch> = {
|
|
|
81
81
|
)
|
|
82
82
|
},
|
|
83
83
|
}
|
|
84
|
+
|
|
85
|
+
export const TokenV2: StoryObj<typeof Switch> = {
|
|
86
|
+
parameters: {
|
|
87
|
+
tokenVersion: 'v2',
|
|
88
|
+
},
|
|
89
|
+
render: function Render() {
|
|
90
|
+
const [checked, setChecked] = useState(true)
|
|
91
|
+
return (
|
|
92
|
+
<div style={{ display: 'grid', gap: 16 }}>
|
|
93
|
+
<Switch name="token-v2-default" checked={checked} onChange={setChecked}>
|
|
94
|
+
Label
|
|
95
|
+
</Switch>
|
|
96
|
+
<Switch name="token-v2-disabled" checked disabled>
|
|
97
|
+
Disabled
|
|
98
|
+
</Switch>
|
|
99
|
+
</div>
|
|
100
|
+
)
|
|
101
|
+
},
|
|
102
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
.charcoal-tag-item {
|
|
2
|
-
--charcoal-tag-item-color: var(--charcoal-
|
|
2
|
+
--charcoal-tag-item-color: var(--charcoal-color-text-on-primary-default);
|
|
3
3
|
--charcoal-tag-item-size: 40px;
|
|
4
4
|
--charcoal-tag-item-padding-left: 24px;
|
|
5
5
|
--charcoal-tag-item-padding-right: 24px;
|
|
6
|
+
--charcoal-tag-item-bg: ;
|
|
6
7
|
isolation: isolate;
|
|
7
8
|
position: relative;
|
|
8
9
|
appearance: none;
|
|
@@ -39,7 +40,7 @@
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
.charcoal-tag-item[data-state='inactive'] {
|
|
42
|
-
--charcoal-tag-item-color: var(--charcoal-
|
|
43
|
+
--charcoal-tag-item-color: var(--charcoal-color-text-secondary-default);
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
.charcoal-tag-item[data-state='active'] {
|
|
@@ -71,7 +72,7 @@
|
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
.charcoal-tag-item__bg[data-bg-variant='image'] {
|
|
74
|
-
background-color: var(--charcoal-
|
|
75
|
+
background-color: var(--charcoal-color-container-on-img-default);
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
.charcoal-tag-item__bg[data-bg-variant='image']::before {
|
|
@@ -89,7 +90,7 @@
|
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
.charcoal-tag-item__bg[data-state='inactive'] {
|
|
92
|
-
background-color: var(--charcoal-
|
|
93
|
+
background-color: var(--charcoal-color-container-secondary-default);
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
.charcoal-tag-item__label {
|
|
@@ -5,7 +5,7 @@ exports[`Storybook Tests > react/TagItem > Active 1`] = `
|
|
|
5
5
|
<div
|
|
6
6
|
data-dark="false"
|
|
7
7
|
>
|
|
8
|
-
<
|
|
8
|
+
<a
|
|
9
9
|
class="charcoal-tag-item charcoal-tag-item__bg"
|
|
10
10
|
data-bg-variant="color"
|
|
11
11
|
data-size="M"
|
|
@@ -28,7 +28,7 @@ exports[`Storybook Tests > react/TagItem > Active 1`] = `
|
|
|
28
28
|
name="16/Remove"
|
|
29
29
|
style="--charcoal-icon-size: 16px;"
|
|
30
30
|
/>
|
|
31
|
-
</
|
|
31
|
+
</a>
|
|
32
32
|
</div>
|
|
33
33
|
</div>
|
|
34
34
|
`;
|
|
@@ -38,7 +38,7 @@ exports[`Storybook Tests > react/TagItem > BGColor 1`] = `
|
|
|
38
38
|
<div
|
|
39
39
|
data-dark="false"
|
|
40
40
|
>
|
|
41
|
-
<
|
|
41
|
+
<a
|
|
42
42
|
class="charcoal-tag-item charcoal-tag-item__bg"
|
|
43
43
|
data-bg-variant="color"
|
|
44
44
|
data-size="M"
|
|
@@ -56,7 +56,7 @@ exports[`Storybook Tests > react/TagItem > BGColor 1`] = `
|
|
|
56
56
|
女の子
|
|
57
57
|
</span>
|
|
58
58
|
</div>
|
|
59
|
-
</
|
|
59
|
+
</a>
|
|
60
60
|
</div>
|
|
61
61
|
</div>
|
|
62
62
|
`;
|
|
@@ -66,7 +66,7 @@ exports[`Storybook Tests > react/TagItem > BGImage 1`] = `
|
|
|
66
66
|
<div
|
|
67
67
|
data-dark="false"
|
|
68
68
|
>
|
|
69
|
-
<
|
|
69
|
+
<a
|
|
70
70
|
class="charcoal-tag-item charcoal-tag-item__bg"
|
|
71
71
|
data-bg-variant="image"
|
|
72
72
|
data-size="M"
|
|
@@ -84,7 +84,7 @@ exports[`Storybook Tests > react/TagItem > BGImage 1`] = `
|
|
|
84
84
|
#女の子
|
|
85
85
|
</span>
|
|
86
86
|
</div>
|
|
87
|
-
</
|
|
87
|
+
</a>
|
|
88
88
|
</div>
|
|
89
89
|
</div>
|
|
90
90
|
`;
|
|
@@ -94,7 +94,7 @@ exports[`Storybook Tests > react/TagItem > Default 1`] = `
|
|
|
94
94
|
<div
|
|
95
95
|
data-dark="false"
|
|
96
96
|
>
|
|
97
|
-
<
|
|
97
|
+
<a
|
|
98
98
|
class="charcoal-tag-item charcoal-tag-item__bg"
|
|
99
99
|
data-bg-variant="color"
|
|
100
100
|
data-size="M"
|
|
@@ -112,7 +112,7 @@ exports[`Storybook Tests > react/TagItem > Default 1`] = `
|
|
|
112
112
|
#女の子
|
|
113
113
|
</span>
|
|
114
114
|
</div>
|
|
115
|
-
</
|
|
115
|
+
</a>
|
|
116
116
|
</div>
|
|
117
117
|
</div>
|
|
118
118
|
`;
|
|
@@ -122,12 +122,12 @@ exports[`Storybook Tests > react/TagItem > Disabled 1`] = `
|
|
|
122
122
|
<div
|
|
123
123
|
data-dark="false"
|
|
124
124
|
>
|
|
125
|
-
<
|
|
125
|
+
<a
|
|
126
|
+
aria-disabled="true"
|
|
126
127
|
class="charcoal-tag-item charcoal-tag-item__bg"
|
|
127
128
|
data-bg-variant="color"
|
|
128
129
|
data-size="M"
|
|
129
130
|
data-state="default"
|
|
130
|
-
disabled=""
|
|
131
131
|
style="--charcoal-tag-item-bg: #7ACCB1;"
|
|
132
132
|
>
|
|
133
133
|
<div
|
|
@@ -141,7 +141,7 @@ exports[`Storybook Tests > react/TagItem > Disabled 1`] = `
|
|
|
141
141
|
#女の子
|
|
142
142
|
</span>
|
|
143
143
|
</div>
|
|
144
|
-
</
|
|
144
|
+
</a>
|
|
145
145
|
</div>
|
|
146
146
|
</div>
|
|
147
147
|
`;
|
|
@@ -151,7 +151,7 @@ exports[`Storybook Tests > react/TagItem > InActive 1`] = `
|
|
|
151
151
|
<div
|
|
152
152
|
data-dark="false"
|
|
153
153
|
>
|
|
154
|
-
<
|
|
154
|
+
<a
|
|
155
155
|
class="charcoal-tag-item charcoal-tag-item__bg"
|
|
156
156
|
data-bg-variant="color"
|
|
157
157
|
data-size="M"
|
|
@@ -169,7 +169,7 @@ exports[`Storybook Tests > react/TagItem > InActive 1`] = `
|
|
|
169
169
|
#女の子
|
|
170
170
|
</span>
|
|
171
171
|
</div>
|
|
172
|
-
</
|
|
172
|
+
</a>
|
|
173
173
|
</div>
|
|
174
174
|
</div>
|
|
175
175
|
`;
|
|
@@ -179,7 +179,7 @@ exports[`Storybook Tests > react/TagItem > Small 1`] = `
|
|
|
179
179
|
<div
|
|
180
180
|
data-dark="false"
|
|
181
181
|
>
|
|
182
|
-
<
|
|
182
|
+
<a
|
|
183
183
|
class="charcoal-tag-item charcoal-tag-item__bg"
|
|
184
184
|
data-bg-variant="color"
|
|
185
185
|
data-size="S"
|
|
@@ -197,7 +197,7 @@ exports[`Storybook Tests > react/TagItem > Small 1`] = `
|
|
|
197
197
|
#女の子
|
|
198
198
|
</span>
|
|
199
199
|
</div>
|
|
200
|
-
</
|
|
200
|
+
</a>
|
|
201
201
|
</div>
|
|
202
202
|
</div>
|
|
203
203
|
`;
|
|
@@ -207,7 +207,7 @@ exports[`Storybook Tests > react/TagItem > TranslatedLabel 1`] = `
|
|
|
207
207
|
<div
|
|
208
208
|
data-dark="false"
|
|
209
209
|
>
|
|
210
|
-
<
|
|
210
|
+
<a
|
|
211
211
|
class="charcoal-tag-item charcoal-tag-item__bg"
|
|
212
212
|
data-bg-variant="color"
|
|
213
213
|
data-size="M"
|
|
@@ -230,7 +230,7 @@ exports[`Storybook Tests > react/TagItem > TranslatedLabel 1`] = `
|
|
|
230
230
|
#女の子
|
|
231
231
|
</span>
|
|
232
232
|
</div>
|
|
233
|
-
</
|
|
233
|
+
</a>
|
|
234
234
|
</div>
|
|
235
235
|
</div>
|
|
236
236
|
`;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
.charcoal-tag-item {
|
|
2
|
-
--charcoal-tag-item-color: var(--charcoal-
|
|
2
|
+
--charcoal-tag-item-color: var(--charcoal-color-text-on-primary-default);
|
|
3
3
|
--charcoal-tag-item-size: 40px;
|
|
4
4
|
--charcoal-tag-item-padding-left: 24px;
|
|
5
5
|
--charcoal-tag-item-padding-right: 24px;
|
|
6
|
+
--charcoal-tag-item-bg: ;
|
|
6
7
|
|
|
7
8
|
isolation: isolate;
|
|
8
9
|
position: relative;
|
|
@@ -44,7 +45,7 @@
|
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
&[data-state='inactive'] {
|
|
47
|
-
--charcoal-tag-item-color: var(--charcoal-
|
|
48
|
+
--charcoal-tag-item-color: var(--charcoal-color-text-secondary-default);
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
&[data-state='active'] {
|
|
@@ -80,7 +81,7 @@
|
|
|
80
81
|
background-color: var(--charcoal-tag-item-bg);
|
|
81
82
|
|
|
82
83
|
&[data-bg-variant='image'] {
|
|
83
|
-
background-color: var(--charcoal-
|
|
84
|
+
background-color: var(--charcoal-color-container-on-img-default);
|
|
84
85
|
|
|
85
86
|
&::before {
|
|
86
87
|
content: '';
|
|
@@ -98,7 +99,7 @@
|
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
&[data-state='inactive'] {
|
|
101
|
-
background-color: var(--charcoal-
|
|
102
|
+
background-color: var(--charcoal-color-container-secondary-default);
|
|
102
103
|
}
|
|
103
104
|
}
|
|
104
105
|
|
|
@@ -64,3 +64,20 @@ export const Disabled: StoryObj<typeof TagItem> = {
|
|
|
64
64
|
return <TagItem label="#女の子" disabled />
|
|
65
65
|
},
|
|
66
66
|
}
|
|
67
|
+
|
|
68
|
+
export const TokenV2: StoryObj<typeof TagItem> = {
|
|
69
|
+
parameters: {
|
|
70
|
+
tokenVersion: 'v2',
|
|
71
|
+
},
|
|
72
|
+
render: function Render() {
|
|
73
|
+
return (
|
|
74
|
+
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 8 }}>
|
|
75
|
+
<TagItem label="#女の子" translatedLabel="girl" />
|
|
76
|
+
<TagItem label="#女の子" status="active" />
|
|
77
|
+
<TagItem label="#女の子" status="inactive" />
|
|
78
|
+
<TagItem label="#女の子" disabled />
|
|
79
|
+
<TagItem label="女の子" bgColor="var(--charcoal-brand)" />
|
|
80
|
+
</div>
|
|
81
|
+
)
|
|
82
|
+
},
|
|
83
|
+
}
|
|
@@ -4,27 +4,29 @@ import { useClassNames } from '../../_lib/useClassNames'
|
|
|
4
4
|
import './index.css'
|
|
5
5
|
|
|
6
6
|
import { useObjectRef } from 'react-aria/useObjectRef'
|
|
7
|
+
import { useLink } from 'react-aria'
|
|
7
8
|
|
|
8
9
|
type SizeMap = {
|
|
9
10
|
S: 32
|
|
10
11
|
M: 40
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
export type TagItemProps<T extends React.ElementType = '
|
|
14
|
+
export type TagItemProps<T extends React.ElementType = 'a'> = {
|
|
14
15
|
label: string
|
|
15
16
|
translatedLabel?: string
|
|
16
17
|
bgColor?: string
|
|
17
18
|
bgImage?: string
|
|
18
19
|
status?: 'default' | 'active' | 'inactive'
|
|
19
20
|
size?: keyof SizeMap
|
|
21
|
+
disabled?: boolean
|
|
20
22
|
/**
|
|
21
23
|
* The component used for root element.
|
|
22
|
-
* @type T extends React.ElementType = '
|
|
24
|
+
* @type T extends React.ElementType = 'a'
|
|
23
25
|
*/
|
|
24
26
|
component?: T
|
|
25
|
-
} & Omit<React.ComponentPropsWithRef<T>, 'children'>
|
|
27
|
+
} & Omit<React.ComponentPropsWithRef<T>, 'children' | 'disabled'>
|
|
26
28
|
|
|
27
|
-
const TagItem = forwardRef<
|
|
29
|
+
const TagItem = forwardRef<HTMLAnchorElement, TagItemProps>(
|
|
28
30
|
function TagItemInner<T extends React.ElementType>(
|
|
29
31
|
{
|
|
30
32
|
component,
|
|
@@ -34,9 +36,11 @@ const TagItem = forwardRef<HTMLButtonElement, TagItemProps>(
|
|
|
34
36
|
bgImage,
|
|
35
37
|
size = 'M',
|
|
36
38
|
status = 'default',
|
|
39
|
+
disabled,
|
|
40
|
+
'aria-disabled': ariaDisabled,
|
|
37
41
|
...props
|
|
38
42
|
}: TagItemProps<T>,
|
|
39
|
-
_ref: ForwardedRef<
|
|
43
|
+
_ref: ForwardedRef<HTMLAnchorElement>,
|
|
40
44
|
) {
|
|
41
45
|
const ref = useObjectRef(_ref)
|
|
42
46
|
|
|
@@ -52,11 +56,25 @@ const TagItem = forwardRef<HTMLButtonElement, TagItemProps>(
|
|
|
52
56
|
bgImage !== undefined && bgImage.length > 0 ? 'image' : 'color'
|
|
53
57
|
const bg = bgVariant === 'color' ? bgColor : `url(${bgImage ?? ''})`
|
|
54
58
|
|
|
55
|
-
const Component = useMemo(() => component ?? '
|
|
59
|
+
const Component = useMemo(() => component ?? 'a', [component])
|
|
60
|
+
const isButton = Component === 'button'
|
|
61
|
+
|
|
62
|
+
const { linkProps } = useLink(
|
|
63
|
+
{
|
|
64
|
+
isDisabled: disabled,
|
|
65
|
+
elementType: typeof Component === 'string' ? Component : 'a',
|
|
66
|
+
},
|
|
67
|
+
ref,
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
const disabledProps = isButton
|
|
71
|
+
? { disabled, 'aria-disabled': ariaDisabled }
|
|
72
|
+
: linkProps
|
|
56
73
|
|
|
57
74
|
return (
|
|
58
75
|
<Component
|
|
59
76
|
{...props}
|
|
77
|
+
{...disabledProps}
|
|
60
78
|
ref={ref}
|
|
61
79
|
className={className}
|
|
62
80
|
data-state={status}
|
|
@@ -84,6 +102,6 @@ const TagItem = forwardRef<HTMLButtonElement, TagItemProps>(
|
|
|
84
102
|
</Component>
|
|
85
103
|
)
|
|
86
104
|
},
|
|
87
|
-
) as <T extends React.ElementType = '
|
|
105
|
+
) as <T extends React.ElementType = 'a'>(p: TagItemProps<T>) => JSX.Element
|
|
88
106
|
|
|
89
107
|
export default memo(TagItem)
|
|
@@ -84,6 +84,36 @@ export const Invalid: StoryObj<typeof TextArea> = {
|
|
|
84
84
|
},
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
export const TokenV2: StoryObj<typeof TextArea> = {
|
|
88
|
+
parameters: {
|
|
89
|
+
tokenVersion: 'v2',
|
|
90
|
+
},
|
|
91
|
+
render() {
|
|
92
|
+
return (
|
|
93
|
+
<div style={{ display: 'grid', gap: 24, width: 320 }}>
|
|
94
|
+
<TextArea
|
|
95
|
+
label="Label"
|
|
96
|
+
showLabel
|
|
97
|
+
required
|
|
98
|
+
requiredText="*必須"
|
|
99
|
+
subLabel={<Clickable>Text Link</Clickable>}
|
|
100
|
+
placeholder="Placeholder"
|
|
101
|
+
assistiveText="説明が入ります"
|
|
102
|
+
showCount
|
|
103
|
+
maxLength={100}
|
|
104
|
+
/>
|
|
105
|
+
<TextArea
|
|
106
|
+
label="Invalid"
|
|
107
|
+
invalid
|
|
108
|
+
placeholder="Placeholder"
|
|
109
|
+
assistiveText="エラーメッセージ"
|
|
110
|
+
/>
|
|
111
|
+
<TextArea label="Disabled" disabled value="Disabled value" />
|
|
112
|
+
</div>
|
|
113
|
+
)
|
|
114
|
+
},
|
|
115
|
+
}
|
|
116
|
+
|
|
87
117
|
export const ReadOnly: StoryObj<typeof TextArea> = {
|
|
88
118
|
render() {
|
|
89
119
|
return <TextArea label="Label" readOnly value="読み取り専用" />
|
|
@@ -9,10 +9,12 @@
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.charcoal-text-area-container {
|
|
12
|
+
/* Runtime variable overridden by the React component. */
|
|
13
|
+
--charcoal-text-area-rows: 4;
|
|
12
14
|
position: relative;
|
|
13
15
|
overflow: hidden;
|
|
14
|
-
color: var(--charcoal-
|
|
15
|
-
background-color: var(--charcoal-
|
|
16
|
+
color: var(--charcoal-color-text-secondary-default);
|
|
17
|
+
background-color: var(--charcoal-color-container-secondary-default-a);
|
|
16
18
|
border-radius: 4px;
|
|
17
19
|
transition: 0.2s background-color,
|
|
18
20
|
0.2s box-shadow;
|
|
@@ -29,7 +31,7 @@
|
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
.charcoal-text-area-container:not([aria-disabled='true']):hover {
|
|
32
|
-
background-color: var(--charcoal-
|
|
34
|
+
background-color: var(--charcoal-color-container-secondary-hover-a);
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
.charcoal-text-area-container[aria-invalid='true']:focus-within {
|
|
@@ -64,7 +66,7 @@
|
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
.charcoal-text-area-textarea::placeholder {
|
|
67
|
-
color: var(--charcoal-
|
|
69
|
+
color: var(--charcoal-color-text-placeholder-default);
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
.charcoal-text-area-counter {
|
|
@@ -73,6 +75,6 @@
|
|
|
73
75
|
right: 8px;
|
|
74
76
|
line-height: 22px;
|
|
75
77
|
font-size: 14px;
|
|
76
|
-
color: var(--charcoal-
|
|
78
|
+
color: var(--charcoal-color-text-tertiary-default);
|
|
77
79
|
}
|
|
78
80
|
|
|
@@ -9,11 +9,14 @@
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.charcoal-text-area-container {
|
|
12
|
+
/* Runtime variable overridden by the React component. */
|
|
13
|
+
--charcoal-text-area-rows: 4;
|
|
14
|
+
|
|
12
15
|
position: relative;
|
|
13
16
|
overflow: hidden;
|
|
14
17
|
|
|
15
|
-
color: var(--charcoal-
|
|
16
|
-
background-color: var(--charcoal-
|
|
18
|
+
color: var(--charcoal-color-text-secondary-default);
|
|
19
|
+
background-color: var(--charcoal-color-container-secondary-default-a);
|
|
17
20
|
border-radius: 4px;
|
|
18
21
|
transition:
|
|
19
22
|
0.2s background-color,
|
|
@@ -30,7 +33,7 @@
|
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
&:not([aria-disabled='true']):hover {
|
|
33
|
-
background-color: var(--charcoal-
|
|
36
|
+
background-color: var(--charcoal-color-container-secondary-hover-a);
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
&[aria-invalid='true']:focus-within {
|
|
@@ -66,7 +69,7 @@
|
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
&::placeholder {
|
|
69
|
-
color: var(--charcoal-
|
|
72
|
+
color: var(--charcoal-color-text-placeholder-default);
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
75
|
|
|
@@ -77,5 +80,5 @@
|
|
|
77
80
|
|
|
78
81
|
line-height: 22px;
|
|
79
82
|
font-size: 14px;
|
|
80
|
-
color: var(--charcoal-
|
|
83
|
+
color: var(--charcoal-color-text-tertiary-default);
|
|
81
84
|
}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
font-size: 14px;
|
|
3
3
|
line-height: 22px;
|
|
4
4
|
margin: 0;
|
|
5
|
-
color: var(--charcoal-
|
|
5
|
+
color: var(--charcoal-color-text-secondary-default);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
.charcoal-text-field-assistive-text[data-invalid='true'] {
|
|
9
|
-
color: var(--charcoal-
|
|
9
|
+
color: var(--charcoal-color-text-negative-default);
|
|
10
10
|
}
|
|
@@ -79,6 +79,36 @@ export const Invalid: StoryObj<typeof TextField> = {
|
|
|
79
79
|
},
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
export const TokenV2: StoryObj<typeof TextField> = {
|
|
83
|
+
parameters: {
|
|
84
|
+
tokenVersion: 'v2',
|
|
85
|
+
},
|
|
86
|
+
render() {
|
|
87
|
+
return (
|
|
88
|
+
<div style={{ display: 'grid', gap: 24, width: 320 }}>
|
|
89
|
+
<TextField
|
|
90
|
+
label="Label"
|
|
91
|
+
showLabel
|
|
92
|
+
required
|
|
93
|
+
requiredText="*必須"
|
|
94
|
+
subLabel={<Clickable>Text Link</Clickable>}
|
|
95
|
+
placeholder="Placeholder"
|
|
96
|
+
assistiveText="説明が入ります"
|
|
97
|
+
showCount
|
|
98
|
+
maxLength={100}
|
|
99
|
+
/>
|
|
100
|
+
<TextField
|
|
101
|
+
label="Invalid"
|
|
102
|
+
invalid
|
|
103
|
+
placeholder="Placeholder"
|
|
104
|
+
assistiveText="エラーメッセージ"
|
|
105
|
+
/>
|
|
106
|
+
<TextField label="Disabled" disabled value="Disabled value" />
|
|
107
|
+
</div>
|
|
108
|
+
)
|
|
109
|
+
},
|
|
110
|
+
}
|
|
111
|
+
|
|
82
112
|
export const ReadOnly: StoryObj<typeof TextField> = {
|
|
83
113
|
render() {
|
|
84
114
|
return <TextField label="Label" readOnly value="読み取り専用" />
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
height: 40px;
|
|
14
14
|
transition: 0.2s background-color,
|
|
15
15
|
0.2s box-shadow;
|
|
16
|
-
color: var(--charcoal-
|
|
17
|
-
background-color: var(--charcoal-
|
|
16
|
+
color: var(--charcoal-color-text-secondary-default);
|
|
17
|
+
background-color: var(--charcoal-color-container-secondary-default-a);
|
|
18
18
|
border-radius: 4px;
|
|
19
19
|
padding: 0 8px;
|
|
20
20
|
line-height: 22px;
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
.charcoal-text-field-container:not([aria-disabled='true']):hover {
|
|
29
|
-
background-color: var(--charcoal-
|
|
29
|
+
background-color: var(--charcoal-color-container-secondary-hover-a);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
.charcoal-text-field-container:not([aria-disabled='true']):focus-within {
|
|
@@ -77,16 +77,16 @@
|
|
|
77
77
|
/* Display box-shadow for iOS Safari */
|
|
78
78
|
appearance: none;
|
|
79
79
|
background: transparent;
|
|
80
|
-
color: var(--charcoal-
|
|
80
|
+
color: var(--charcoal-color-text-secondary-default);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
.charcoal-text-field-input::placeholder {
|
|
84
|
-
color: var(--charcoal-
|
|
84
|
+
color: var(--charcoal-color-text-placeholder-default);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
.charcoal-text-field-line-counter {
|
|
88
88
|
line-height: 22px;
|
|
89
89
|
font-size: 14px;
|
|
90
|
-
color: var(--charcoal-
|
|
90
|
+
color: var(--charcoal-color-text-tertiary-default);
|
|
91
91
|
}
|
|
92
92
|
|