@charcoal-ui/react 3.11.0 → 3.13.0-beta.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/Modal/index.d.ts +3 -0
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/index.cjs.js +10 -7
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +9 -7
- package/dist/index.esm.js.map +1 -1
- package/package.json +8 -8
- package/src/components/Button/__snapshots__/index.story.storyshot +9 -9
- package/src/components/Button/index.story.tsx +1 -1
- package/src/components/Checkbox/__snapshots__/index.story.storyshot +86 -64
- package/src/components/Checkbox/index.story.tsx +32 -24
- package/src/components/Checkbox/index.tsx +6 -2
- package/src/components/Clickable/__snapshots__/index.story.storyshot +2 -2
- package/src/components/Clickable/index.story.tsx +1 -1
- package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +1 -1
- package/src/components/DropdownSelector/ListItem/index.story.tsx +1 -1
- package/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot +3 -3
- package/src/components/DropdownSelector/MenuList/index.story.tsx +1 -1
- package/src/components/DropdownSelector/Popover/__snapshots__/index.story.storyshot +1 -1
- package/src/components/DropdownSelector/Popover/index.story.tsx +1 -1
- package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +14 -936
- package/src/components/DropdownSelector/index.story.tsx +2 -2
- package/src/components/Icon/__snapshots__/index.story.storyshot +1 -1
- package/src/components/Icon/index.story.tsx +1 -1
- package/src/components/IconButton/__snapshots__/index.story.storyshot +6 -3
- package/src/components/IconButton/index.story.tsx +1 -1
- package/src/components/IconButton/index.tsx +1 -1
- package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +4 -4
- package/src/components/LoadingSpinner/index.story.tsx +1 -1
- package/src/components/Modal/__snapshots__/index.story.storyshot +24 -12
- package/src/components/Modal/index.story.tsx +2 -2
- package/src/components/Modal/index.tsx +6 -2
- package/src/components/MultiSelect/__snapshots__/index.story.storyshot +4 -4
- package/src/components/MultiSelect/index.story.tsx +1 -1
- package/src/components/Radio/__snapshots__/index.story.storyshot +5 -5
- package/src/components/Radio/index.story.tsx +1 -1
- package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +2 -2
- package/src/components/SegmentedControl/index.story.tsx +1 -1
- package/src/components/Switch/__snapshots__/index.story.storyshot +4 -4
- package/src/components/Switch/index.story.tsx +1 -1
- package/src/components/TagItem/__snapshots__/index.story.storyshot +9 -9
- package/src/components/TagItem/index.story.tsx +2 -2
- package/src/components/TextArea/TextArea.story.tsx +1 -1
- package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +11 -11
- package/src/components/TextField/TextField.story.tsx +1 -1
- package/src/components/TextField/__snapshots__/TextField.story.storyshot +13 -13
- package/src/index.ts +5 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@charcoal-ui/react",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.13.0-beta.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"clean": "rimraf dist .tsbuildinfo"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@charcoal-ui/esbuild-plugin-styled-components": "^3.
|
|
23
|
+
"@charcoal-ui/esbuild-plugin-styled-components": "^3.13.0-beta.0",
|
|
24
24
|
"@react-types/dialog": "^3.5.8",
|
|
25
25
|
"@react-types/switch": "^3.1.2",
|
|
26
26
|
"@storybook/addon-actions": "^8.0.5",
|
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
"typescript": "^4.9.5"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@charcoal-ui/foundation": "^3.
|
|
52
|
-
"@charcoal-ui/icons": "^3.
|
|
53
|
-
"@charcoal-ui/styled": "^3.
|
|
54
|
-
"@charcoal-ui/theme": "^3.
|
|
55
|
-
"@charcoal-ui/utils": "^3.
|
|
51
|
+
"@charcoal-ui/foundation": "^3.13.0-beta.0",
|
|
52
|
+
"@charcoal-ui/icons": "^3.13.0-beta.0",
|
|
53
|
+
"@charcoal-ui/styled": "^3.13.0-beta.0",
|
|
54
|
+
"@charcoal-ui/theme": "^3.13.0-beta.0",
|
|
55
|
+
"@charcoal-ui/utils": "^3.13.0-beta.0",
|
|
56
56
|
"@react-aria/button": "^3.9.1",
|
|
57
57
|
"@react-aria/checkbox": "^3.13.0",
|
|
58
58
|
"@react-aria/dialog": "^3.5.10",
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"url": "https://github.com/pixiv/charcoal.git",
|
|
87
87
|
"directory": "packages/react"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "e78670e2b532ae98b4c063f5dce05f52c6d629c9"
|
|
90
90
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`Storybook Tests Button Danger 1`] = `
|
|
3
|
+
exports[`Storybook Tests react/Button Danger 1`] = `
|
|
4
4
|
.c0 {
|
|
5
5
|
cursor: pointer;
|
|
6
6
|
-webkit-appearance: none;
|
|
@@ -116,7 +116,7 @@ exports[`Storybook Tests Button Danger 1`] = `
|
|
|
116
116
|
</div>
|
|
117
117
|
`;
|
|
118
118
|
|
|
119
|
-
exports[`Storybook Tests Button Default 1`] = `
|
|
119
|
+
exports[`Storybook Tests react/Button Default 1`] = `
|
|
120
120
|
.c0 {
|
|
121
121
|
cursor: pointer;
|
|
122
122
|
-webkit-appearance: none;
|
|
@@ -232,7 +232,7 @@ exports[`Storybook Tests Button Default 1`] = `
|
|
|
232
232
|
</div>
|
|
233
233
|
`;
|
|
234
234
|
|
|
235
|
-
exports[`Storybook Tests Button Disabled 1`] = `
|
|
235
|
+
exports[`Storybook Tests react/Button Disabled 1`] = `
|
|
236
236
|
.c0 {
|
|
237
237
|
cursor: pointer;
|
|
238
238
|
-webkit-appearance: none;
|
|
@@ -348,7 +348,7 @@ exports[`Storybook Tests Button Disabled 1`] = `
|
|
|
348
348
|
</div>
|
|
349
349
|
`;
|
|
350
350
|
|
|
351
|
-
exports[`Storybook Tests Button FullWidth 1`] = `
|
|
351
|
+
exports[`Storybook Tests react/Button FullWidth 1`] = `
|
|
352
352
|
.c0 {
|
|
353
353
|
cursor: pointer;
|
|
354
354
|
-webkit-appearance: none;
|
|
@@ -464,7 +464,7 @@ exports[`Storybook Tests Button FullWidth 1`] = `
|
|
|
464
464
|
</div>
|
|
465
465
|
`;
|
|
466
466
|
|
|
467
|
-
exports[`Storybook Tests Button IsActive 1`] = `
|
|
467
|
+
exports[`Storybook Tests react/Button IsActive 1`] = `
|
|
468
468
|
.c0 {
|
|
469
469
|
cursor: pointer;
|
|
470
470
|
-webkit-appearance: none;
|
|
@@ -574,7 +574,7 @@ exports[`Storybook Tests Button IsActive 1`] = `
|
|
|
574
574
|
</div>
|
|
575
575
|
`;
|
|
576
576
|
|
|
577
|
-
exports[`Storybook Tests Button Navigation 1`] = `
|
|
577
|
+
exports[`Storybook Tests react/Button Navigation 1`] = `
|
|
578
578
|
.c0 {
|
|
579
579
|
cursor: pointer;
|
|
580
580
|
-webkit-appearance: none;
|
|
@@ -690,7 +690,7 @@ exports[`Storybook Tests Button Navigation 1`] = `
|
|
|
690
690
|
</div>
|
|
691
691
|
`;
|
|
692
692
|
|
|
693
|
-
exports[`Storybook Tests Button Overlay 1`] = `
|
|
693
|
+
exports[`Storybook Tests react/Button Overlay 1`] = `
|
|
694
694
|
.c0 {
|
|
695
695
|
cursor: pointer;
|
|
696
696
|
-webkit-appearance: none;
|
|
@@ -806,7 +806,7 @@ exports[`Storybook Tests Button Overlay 1`] = `
|
|
|
806
806
|
</div>
|
|
807
807
|
`;
|
|
808
808
|
|
|
809
|
-
exports[`Storybook Tests Button Primary 1`] = `
|
|
809
|
+
exports[`Storybook Tests react/Button Primary 1`] = `
|
|
810
810
|
.c0 {
|
|
811
811
|
cursor: pointer;
|
|
812
812
|
-webkit-appearance: none;
|
|
@@ -922,7 +922,7 @@ exports[`Storybook Tests Button Primary 1`] = `
|
|
|
922
922
|
</div>
|
|
923
923
|
`;
|
|
924
924
|
|
|
925
|
-
exports[`Storybook Tests Button Small 1`] = `
|
|
925
|
+
exports[`Storybook Tests react/Button Small 1`] = `
|
|
926
926
|
.c0 {
|
|
927
927
|
cursor: pointer;
|
|
928
928
|
-webkit-appearance: none;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`Storybook Tests Checkbox Checked 1`] = `
|
|
3
|
+
exports[`Storybook Tests react/Checkbox Checked 1`] = `
|
|
4
4
|
.c0 {
|
|
5
5
|
position: relative;
|
|
6
6
|
display: -webkit-box;
|
|
@@ -11,6 +11,10 @@ exports[`Storybook Tests Checkbox Checked 1`] = `
|
|
|
11
11
|
gap: 4px;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
.c0:has(input[readonly]) {
|
|
15
|
+
cursor: default;
|
|
16
|
+
}
|
|
17
|
+
|
|
14
18
|
.c0:disabled,
|
|
15
19
|
.c0[aria-disabled]:not([aria-disabled='false']) {
|
|
16
20
|
cursor: default;
|
|
@@ -39,12 +43,9 @@ exports[`Storybook Tests Checkbox Checked 1`] = `
|
|
|
39
43
|
cursor: default;
|
|
40
44
|
}
|
|
41
45
|
|
|
42
|
-
.c2[type='checkbox']
|
|
43
|
-
cursor: default;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.c2[type='checkbox']:read-only {
|
|
46
|
+
.c2[type='checkbox'][readonly] {
|
|
47
47
|
cursor: default;
|
|
48
|
+
opacity: 0.32;
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
.c2[type='checkbox']:checked {
|
|
@@ -110,6 +111,12 @@ exports[`Storybook Tests Checkbox Checked 1`] = `
|
|
|
110
111
|
color: var(--charcoal-text5);
|
|
111
112
|
}
|
|
112
113
|
|
|
114
|
+
.c4 {
|
|
115
|
+
color: var(--charcoal-text2);
|
|
116
|
+
font-size: 14px;
|
|
117
|
+
line-height: 20px;
|
|
118
|
+
}
|
|
119
|
+
|
|
113
120
|
<div
|
|
114
121
|
data-dark={false}
|
|
115
122
|
>
|
|
@@ -121,11 +128,10 @@ exports[`Storybook Tests Checkbox Checked 1`] = `
|
|
|
121
128
|
className="c1"
|
|
122
129
|
>
|
|
123
130
|
<input
|
|
124
|
-
aria-label="同意する"
|
|
125
131
|
checked={true}
|
|
126
132
|
className="c2"
|
|
127
133
|
disabled={false}
|
|
128
|
-
name="
|
|
134
|
+
name="checked"
|
|
129
135
|
onChange={[Function]}
|
|
130
136
|
onClick={[Function]}
|
|
131
137
|
onDragStart={[Function]}
|
|
@@ -152,11 +158,16 @@ exports[`Storybook Tests Checkbox Checked 1`] = `
|
|
|
152
158
|
/>
|
|
153
159
|
</div>
|
|
154
160
|
</div>
|
|
161
|
+
<div
|
|
162
|
+
className="c4"
|
|
163
|
+
>
|
|
164
|
+
Checked
|
|
165
|
+
</div>
|
|
155
166
|
</label>
|
|
156
167
|
</div>
|
|
157
168
|
`;
|
|
158
169
|
|
|
159
|
-
exports[`Storybook Tests Checkbox Default 1`] = `
|
|
170
|
+
exports[`Storybook Tests react/Checkbox Default 1`] = `
|
|
160
171
|
.c0 {
|
|
161
172
|
position: relative;
|
|
162
173
|
display: -webkit-box;
|
|
@@ -167,6 +178,10 @@ exports[`Storybook Tests Checkbox Default 1`] = `
|
|
|
167
178
|
gap: 4px;
|
|
168
179
|
}
|
|
169
180
|
|
|
181
|
+
.c0:has(input[readonly]) {
|
|
182
|
+
cursor: default;
|
|
183
|
+
}
|
|
184
|
+
|
|
170
185
|
.c0:disabled,
|
|
171
186
|
.c0[aria-disabled]:not([aria-disabled='false']) {
|
|
172
187
|
cursor: default;
|
|
@@ -195,12 +210,9 @@ exports[`Storybook Tests Checkbox Default 1`] = `
|
|
|
195
210
|
cursor: default;
|
|
196
211
|
}
|
|
197
212
|
|
|
198
|
-
.c2[type='checkbox']
|
|
199
|
-
cursor: default;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
.c2[type='checkbox']:read-only {
|
|
213
|
+
.c2[type='checkbox'][readonly] {
|
|
203
214
|
cursor: default;
|
|
215
|
+
opacity: 0.32;
|
|
204
216
|
}
|
|
205
217
|
|
|
206
218
|
.c2[type='checkbox']:checked {
|
|
@@ -282,12 +294,10 @@ exports[`Storybook Tests Checkbox Default 1`] = `
|
|
|
282
294
|
checked={false}
|
|
283
295
|
className="c2"
|
|
284
296
|
disabled={false}
|
|
285
|
-
name="
|
|
286
|
-
onBlur={[Function]}
|
|
297
|
+
name="default"
|
|
287
298
|
onChange={[Function]}
|
|
288
299
|
onClick={[Function]}
|
|
289
300
|
onDragStart={[Function]}
|
|
290
|
-
onFocus={[Function]}
|
|
291
301
|
onKeyDown={[Function]}
|
|
292
302
|
onKeyUp={[Function]}
|
|
293
303
|
onMouseDown={[Function]}
|
|
@@ -315,7 +325,7 @@ exports[`Storybook Tests Checkbox Default 1`] = `
|
|
|
315
325
|
</div>
|
|
316
326
|
`;
|
|
317
327
|
|
|
318
|
-
exports[`Storybook Tests Checkbox Disabled 1`] = `
|
|
328
|
+
exports[`Storybook Tests react/Checkbox Disabled 1`] = `
|
|
319
329
|
.c0 {
|
|
320
330
|
position: relative;
|
|
321
331
|
display: -webkit-box;
|
|
@@ -326,6 +336,10 @@ exports[`Storybook Tests Checkbox Disabled 1`] = `
|
|
|
326
336
|
gap: 4px;
|
|
327
337
|
}
|
|
328
338
|
|
|
339
|
+
.c0:has(input[readonly]) {
|
|
340
|
+
cursor: default;
|
|
341
|
+
}
|
|
342
|
+
|
|
329
343
|
.c0:disabled,
|
|
330
344
|
.c0[aria-disabled]:not([aria-disabled='false']) {
|
|
331
345
|
cursor: default;
|
|
@@ -354,12 +368,9 @@ exports[`Storybook Tests Checkbox Disabled 1`] = `
|
|
|
354
368
|
cursor: default;
|
|
355
369
|
}
|
|
356
370
|
|
|
357
|
-
.c2[type='checkbox']
|
|
358
|
-
cursor: default;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
.c2[type='checkbox']:read-only {
|
|
371
|
+
.c2[type='checkbox'][readonly] {
|
|
362
372
|
cursor: default;
|
|
373
|
+
opacity: 0.32;
|
|
363
374
|
}
|
|
364
375
|
|
|
365
376
|
.c2[type='checkbox']:checked {
|
|
@@ -426,6 +437,12 @@ exports[`Storybook Tests Checkbox Disabled 1`] = `
|
|
|
426
437
|
visibility: hidden;
|
|
427
438
|
}
|
|
428
439
|
|
|
440
|
+
.c4 {
|
|
441
|
+
color: var(--charcoal-text2);
|
|
442
|
+
font-size: 14px;
|
|
443
|
+
line-height: 20px;
|
|
444
|
+
}
|
|
445
|
+
|
|
429
446
|
<div
|
|
430
447
|
data-dark={false}
|
|
431
448
|
>
|
|
@@ -437,11 +454,10 @@ exports[`Storybook Tests Checkbox Disabled 1`] = `
|
|
|
437
454
|
className="c1"
|
|
438
455
|
>
|
|
439
456
|
<input
|
|
440
|
-
aria-label="同意する"
|
|
441
457
|
checked={false}
|
|
442
458
|
className="c2"
|
|
443
459
|
disabled={true}
|
|
444
|
-
name="
|
|
460
|
+
name="disabled"
|
|
445
461
|
onChange={[Function]}
|
|
446
462
|
onClick={[Function]}
|
|
447
463
|
onDragStart={[Function]}
|
|
@@ -468,11 +484,16 @@ exports[`Storybook Tests Checkbox Disabled 1`] = `
|
|
|
468
484
|
/>
|
|
469
485
|
</div>
|
|
470
486
|
</div>
|
|
487
|
+
<div
|
|
488
|
+
className="c4"
|
|
489
|
+
>
|
|
490
|
+
Disabled
|
|
491
|
+
</div>
|
|
471
492
|
</label>
|
|
472
493
|
</div>
|
|
473
494
|
`;
|
|
474
495
|
|
|
475
|
-
exports[`Storybook Tests Checkbox Invalid 1`] = `
|
|
496
|
+
exports[`Storybook Tests react/Checkbox Invalid 1`] = `
|
|
476
497
|
.c0 {
|
|
477
498
|
position: relative;
|
|
478
499
|
display: -webkit-box;
|
|
@@ -483,6 +504,10 @@ exports[`Storybook Tests Checkbox Invalid 1`] = `
|
|
|
483
504
|
gap: 4px;
|
|
484
505
|
}
|
|
485
506
|
|
|
507
|
+
.c0:has(input[readonly]) {
|
|
508
|
+
cursor: default;
|
|
509
|
+
}
|
|
510
|
+
|
|
486
511
|
.c0:disabled,
|
|
487
512
|
.c0[aria-disabled]:not([aria-disabled='false']) {
|
|
488
513
|
cursor: default;
|
|
@@ -511,12 +536,9 @@ exports[`Storybook Tests Checkbox Invalid 1`] = `
|
|
|
511
536
|
cursor: default;
|
|
512
537
|
}
|
|
513
538
|
|
|
514
|
-
.c2[type='checkbox']
|
|
515
|
-
cursor: default;
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
.c2[type='checkbox']:read-only {
|
|
539
|
+
.c2[type='checkbox'][readonly] {
|
|
519
540
|
cursor: default;
|
|
541
|
+
opacity: 0.32;
|
|
520
542
|
}
|
|
521
543
|
|
|
522
544
|
.c2[type='checkbox']:checked {
|
|
@@ -604,7 +626,7 @@ exports[`Storybook Tests Checkbox Invalid 1`] = `
|
|
|
604
626
|
checked={false}
|
|
605
627
|
className="c2"
|
|
606
628
|
disabled={false}
|
|
607
|
-
name="
|
|
629
|
+
name="invalid"
|
|
608
630
|
onChange={[Function]}
|
|
609
631
|
onClick={[Function]}
|
|
610
632
|
onDragStart={[Function]}
|
|
@@ -634,13 +656,13 @@ exports[`Storybook Tests Checkbox Invalid 1`] = `
|
|
|
634
656
|
<div
|
|
635
657
|
className="c4"
|
|
636
658
|
>
|
|
637
|
-
|
|
659
|
+
Invalid
|
|
638
660
|
</div>
|
|
639
661
|
</label>
|
|
640
662
|
</div>
|
|
641
663
|
`;
|
|
642
664
|
|
|
643
|
-
exports[`Storybook Tests Checkbox Label 1`] = `
|
|
665
|
+
exports[`Storybook Tests react/Checkbox Label 1`] = `
|
|
644
666
|
.c0 {
|
|
645
667
|
position: relative;
|
|
646
668
|
display: -webkit-box;
|
|
@@ -651,6 +673,10 @@ exports[`Storybook Tests Checkbox Label 1`] = `
|
|
|
651
673
|
gap: 4px;
|
|
652
674
|
}
|
|
653
675
|
|
|
676
|
+
.c0:has(input[readonly]) {
|
|
677
|
+
cursor: default;
|
|
678
|
+
}
|
|
679
|
+
|
|
654
680
|
.c0:disabled,
|
|
655
681
|
.c0[aria-disabled]:not([aria-disabled='false']) {
|
|
656
682
|
cursor: default;
|
|
@@ -679,12 +705,9 @@ exports[`Storybook Tests Checkbox Label 1`] = `
|
|
|
679
705
|
cursor: default;
|
|
680
706
|
}
|
|
681
707
|
|
|
682
|
-
.c2[type='checkbox']
|
|
683
|
-
cursor: default;
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
.c2[type='checkbox']:read-only {
|
|
708
|
+
.c2[type='checkbox'][readonly] {
|
|
687
709
|
cursor: default;
|
|
710
|
+
opacity: 0.32;
|
|
688
711
|
}
|
|
689
712
|
|
|
690
713
|
.c2[type='checkbox']:checked {
|
|
@@ -757,13 +780,6 @@ exports[`Storybook Tests Checkbox Label 1`] = `
|
|
|
757
780
|
line-height: 20px;
|
|
758
781
|
}
|
|
759
782
|
|
|
760
|
-
.c5 {
|
|
761
|
-
-webkit-user-select: none;
|
|
762
|
-
-moz-user-select: none;
|
|
763
|
-
-ms-user-select: none;
|
|
764
|
-
user-select: none;
|
|
765
|
-
}
|
|
766
|
-
|
|
767
783
|
<div
|
|
768
784
|
data-dark={false}
|
|
769
785
|
>
|
|
@@ -778,7 +794,7 @@ exports[`Storybook Tests Checkbox Label 1`] = `
|
|
|
778
794
|
checked={false}
|
|
779
795
|
className="c2"
|
|
780
796
|
disabled={false}
|
|
781
|
-
name="
|
|
797
|
+
name="checkbox"
|
|
782
798
|
onChange={[Function]}
|
|
783
799
|
onClick={[Function]}
|
|
784
800
|
onDragStart={[Function]}
|
|
@@ -808,17 +824,13 @@ exports[`Storybook Tests Checkbox Label 1`] = `
|
|
|
808
824
|
<div
|
|
809
825
|
className="c4"
|
|
810
826
|
>
|
|
811
|
-
|
|
812
|
-
className="c5"
|
|
813
|
-
>
|
|
814
|
-
同意する
|
|
815
|
-
</span>
|
|
827
|
+
Checkbox
|
|
816
828
|
</div>
|
|
817
829
|
</label>
|
|
818
830
|
</div>
|
|
819
831
|
`;
|
|
820
832
|
|
|
821
|
-
exports[`Storybook Tests Checkbox ReadOnly 1`] = `
|
|
833
|
+
exports[`Storybook Tests react/Checkbox ReadOnly 1`] = `
|
|
822
834
|
.c0 {
|
|
823
835
|
position: relative;
|
|
824
836
|
display: -webkit-box;
|
|
@@ -829,6 +841,10 @@ exports[`Storybook Tests Checkbox ReadOnly 1`] = `
|
|
|
829
841
|
gap: 4px;
|
|
830
842
|
}
|
|
831
843
|
|
|
844
|
+
.c0:has(input[readonly]) {
|
|
845
|
+
cursor: default;
|
|
846
|
+
}
|
|
847
|
+
|
|
832
848
|
.c0:disabled,
|
|
833
849
|
.c0[aria-disabled]:not([aria-disabled='false']) {
|
|
834
850
|
cursor: default;
|
|
@@ -857,12 +873,9 @@ exports[`Storybook Tests Checkbox ReadOnly 1`] = `
|
|
|
857
873
|
cursor: default;
|
|
858
874
|
}
|
|
859
875
|
|
|
860
|
-
.c2[type='checkbox']
|
|
861
|
-
cursor: default;
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
.c2[type='checkbox']:read-only {
|
|
876
|
+
.c2[type='checkbox'][readonly] {
|
|
865
877
|
cursor: default;
|
|
878
|
+
opacity: 0.32;
|
|
866
879
|
}
|
|
867
880
|
|
|
868
881
|
.c2[type='checkbox']:checked {
|
|
@@ -926,26 +939,30 @@ exports[`Storybook Tests Checkbox ReadOnly 1`] = `
|
|
|
926
939
|
width: 24px;
|
|
927
940
|
height: 24px;
|
|
928
941
|
color: var(--charcoal-text5);
|
|
929
|
-
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
.c4 {
|
|
945
|
+
color: var(--charcoal-text2);
|
|
946
|
+
font-size: 14px;
|
|
947
|
+
line-height: 20px;
|
|
930
948
|
}
|
|
931
949
|
|
|
932
950
|
<div
|
|
933
951
|
data-dark={false}
|
|
934
952
|
>
|
|
935
953
|
<label
|
|
936
|
-
aria-disabled={
|
|
954
|
+
aria-disabled={false}
|
|
937
955
|
className="c0"
|
|
938
956
|
>
|
|
939
957
|
<div
|
|
940
958
|
className="c1"
|
|
941
959
|
>
|
|
942
960
|
<input
|
|
943
|
-
aria-label="同意する"
|
|
944
961
|
aria-readonly={true}
|
|
945
|
-
checked={
|
|
962
|
+
checked={true}
|
|
946
963
|
className="c2"
|
|
947
964
|
disabled={false}
|
|
948
|
-
name="
|
|
965
|
+
name="readonly"
|
|
949
966
|
onChange={[Function]}
|
|
950
967
|
onClick={[Function]}
|
|
951
968
|
onDragStart={[Function]}
|
|
@@ -964,7 +981,7 @@ exports[`Storybook Tests Checkbox ReadOnly 1`] = `
|
|
|
964
981
|
/>
|
|
965
982
|
<div
|
|
966
983
|
aria-hidden={true}
|
|
967
|
-
checked={
|
|
984
|
+
checked={true}
|
|
968
985
|
className="c3"
|
|
969
986
|
>
|
|
970
987
|
<pixiv-icon
|
|
@@ -973,6 +990,11 @@ exports[`Storybook Tests Checkbox ReadOnly 1`] = `
|
|
|
973
990
|
/>
|
|
974
991
|
</div>
|
|
975
992
|
</div>
|
|
993
|
+
<div
|
|
994
|
+
className="c4"
|
|
995
|
+
>
|
|
996
|
+
ReadOnly
|
|
997
|
+
</div>
|
|
976
998
|
</label>
|
|
977
999
|
</div>
|
|
978
1000
|
`;
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { action } from '@storybook/addon-actions'
|
|
2
1
|
import Checkbox from '.'
|
|
3
2
|
import { Meta, StoryObj } from '@storybook/react'
|
|
4
3
|
import { useCallback, useState } from 'react'
|
|
5
|
-
import styled from 'styled-components'
|
|
6
4
|
|
|
7
5
|
export default {
|
|
8
|
-
title: 'Checkbox',
|
|
6
|
+
title: 'react/Checkbox',
|
|
9
7
|
component: Checkbox,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
},
|
|
10
11
|
} as Meta<typeof Checkbox>
|
|
11
12
|
|
|
12
|
-
const InnerText = styled.span`
|
|
13
|
-
user-select: none;
|
|
14
|
-
`
|
|
15
|
-
|
|
16
13
|
export const Default: StoryObj<typeof Checkbox> = {
|
|
17
|
-
|
|
14
|
+
argTypes: {
|
|
15
|
+
checked: { type: 'boolean' },
|
|
16
|
+
children: { type: 'string' },
|
|
17
|
+
disabled: { type: 'boolean' },
|
|
18
|
+
invalid: { type: 'boolean' },
|
|
19
|
+
readonly: { type: 'boolean' },
|
|
20
|
+
},
|
|
21
|
+
render: function Render(props) {
|
|
18
22
|
const [checked, setChecked] = useState(props.checked)
|
|
19
23
|
const handleChange = useCallback((isSelected: boolean) => {
|
|
20
24
|
setChecked(isSelected)
|
|
21
|
-
action('change')(isSelected)
|
|
22
25
|
}, [])
|
|
23
26
|
|
|
24
27
|
return (
|
|
25
28
|
<Checkbox
|
|
26
29
|
{...props}
|
|
27
|
-
checked={checked ??
|
|
28
|
-
name="
|
|
30
|
+
checked={props.checked ?? checked}
|
|
31
|
+
name="default"
|
|
29
32
|
label="label"
|
|
30
|
-
onBlur={action('blur')}
|
|
31
|
-
onClick={action('click')}
|
|
32
33
|
onChange={handleChange}
|
|
33
|
-
onFocus={action('focus')}
|
|
34
34
|
/>
|
|
35
35
|
)
|
|
36
36
|
},
|
|
@@ -38,37 +38,45 @@ export const Default: StoryObj<typeof Checkbox> = {
|
|
|
38
38
|
|
|
39
39
|
export const Label: StoryObj<typeof Checkbox> = {
|
|
40
40
|
render: () => {
|
|
41
|
-
return
|
|
42
|
-
<Checkbox name="labelled">
|
|
43
|
-
<InnerText>同意する</InnerText>
|
|
44
|
-
</Checkbox>
|
|
45
|
-
)
|
|
41
|
+
return <Checkbox name="checkbox">Checkbox</Checkbox>
|
|
46
42
|
},
|
|
47
43
|
}
|
|
48
44
|
|
|
49
45
|
export const Checked: StoryObj<typeof Checkbox> = {
|
|
50
46
|
render: () => {
|
|
51
|
-
return
|
|
47
|
+
return (
|
|
48
|
+
<Checkbox name="checked" checked>
|
|
49
|
+
Checked
|
|
50
|
+
</Checkbox>
|
|
51
|
+
)
|
|
52
52
|
},
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
export const Disabled: StoryObj<typeof Checkbox> = {
|
|
56
56
|
render: () => {
|
|
57
|
-
return
|
|
57
|
+
return (
|
|
58
|
+
<Checkbox name="disabled" disabled>
|
|
59
|
+
Disabled
|
|
60
|
+
</Checkbox>
|
|
61
|
+
)
|
|
58
62
|
},
|
|
59
63
|
}
|
|
60
64
|
|
|
61
65
|
export const ReadOnly: StoryObj<typeof Checkbox> = {
|
|
62
66
|
render: () => {
|
|
63
|
-
return
|
|
67
|
+
return (
|
|
68
|
+
<Checkbox checked name="readonly" readonly>
|
|
69
|
+
ReadOnly
|
|
70
|
+
</Checkbox>
|
|
71
|
+
)
|
|
64
72
|
},
|
|
65
73
|
}
|
|
66
74
|
|
|
67
75
|
export const Invalid: StoryObj<typeof Checkbox> = {
|
|
68
76
|
render: () => {
|
|
69
77
|
return (
|
|
70
|
-
<Checkbox name="
|
|
71
|
-
|
|
78
|
+
<Checkbox name="invalid" invalid>
|
|
79
|
+
Invalid
|
|
72
80
|
</Checkbox>
|
|
73
81
|
)
|
|
74
82
|
},
|
|
@@ -54,7 +54,7 @@ const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
|
|
|
54
54
|
const objectRef = useObjectRef(ref)
|
|
55
55
|
|
|
56
56
|
const { inputProps } = useCheckbox(ariaCheckboxProps, state, objectRef)
|
|
57
|
-
const isDisabled =
|
|
57
|
+
const isDisabled = props.disabled ?? false
|
|
58
58
|
|
|
59
59
|
return (
|
|
60
60
|
<InputRoot aria-disabled={isDisabled} className={props.className}>
|
|
@@ -88,6 +88,9 @@ const InputRoot = styled.label`
|
|
|
88
88
|
cursor: pointer;
|
|
89
89
|
|
|
90
90
|
gap: 4px;
|
|
91
|
+
&:has(input[readonly]) {
|
|
92
|
+
cursor: default;
|
|
93
|
+
}
|
|
91
94
|
&:disabled,
|
|
92
95
|
&[aria-disabled]:not([aria-disabled='false']) {
|
|
93
96
|
cursor: default;
|
|
@@ -113,8 +116,9 @@ const CheckboxInput = styled.input`
|
|
|
113
116
|
&:disabled {
|
|
114
117
|
cursor: default;
|
|
115
118
|
}
|
|
116
|
-
|
|
119
|
+
&[readonly] {
|
|
117
120
|
cursor: default;
|
|
121
|
+
opacity: 0.32;
|
|
118
122
|
}
|
|
119
123
|
|
|
120
124
|
&:checked {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`Storybook Tests Clickable Button 1`] = `
|
|
3
|
+
exports[`Storybook Tests react/Clickable Button 1`] = `
|
|
4
4
|
.c0 {
|
|
5
5
|
cursor: pointer;
|
|
6
6
|
-webkit-appearance: none;
|
|
@@ -51,7 +51,7 @@ exports[`Storybook Tests Clickable Button 1`] = `
|
|
|
51
51
|
</div>
|
|
52
52
|
`;
|
|
53
53
|
|
|
54
|
-
exports[`Storybook Tests Clickable Link 1`] = `
|
|
54
|
+
exports[`Storybook Tests react/Clickable Link 1`] = `
|
|
55
55
|
.c0 {
|
|
56
56
|
cursor: pointer;
|
|
57
57
|
-webkit-appearance: none;
|