@charcoal-ui/react 3.5.0 → 3.7.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.
Files changed (100) hide show
  1. package/dist/_lib/compat.d.ts +1 -0
  2. package/dist/_lib/compat.d.ts.map +1 -1
  3. package/dist/components/Button/StyledButton.d.ts +12 -0
  4. package/dist/components/Button/StyledButton.d.ts.map +1 -0
  5. package/dist/components/Button/index.d.ts +2 -2
  6. package/dist/components/Button/index.d.ts.map +1 -1
  7. package/dist/components/Button/lib/variantToBackground.d.ts +3 -0
  8. package/dist/components/Button/lib/variantToBackground.d.ts.map +1 -0
  9. package/dist/components/Button/lib/variantToFont.d.ts +3 -0
  10. package/dist/components/Button/lib/variantToFont.d.ts.map +1 -0
  11. package/dist/components/Checkbox/index.d.ts.map +1 -1
  12. package/dist/components/Checkbox/index.story.d.ts +6 -15
  13. package/dist/components/Checkbox/index.story.d.ts.map +1 -1
  14. package/dist/components/Clickable/index.story.d.ts +4 -6
  15. package/dist/components/Clickable/index.story.d.ts.map +1 -1
  16. package/dist/components/DropdownSelector/DropdownMenuItem.d.ts.map +1 -1
  17. package/dist/components/DropdownSelector/ListItem/index.d.ts.map +1 -1
  18. package/dist/components/DropdownSelector/Popover/index.d.ts.map +1 -1
  19. package/dist/components/DropdownSelector/index.d.ts.map +1 -1
  20. package/dist/components/DropdownSelector/index.story.d.ts +1 -0
  21. package/dist/components/DropdownSelector/index.story.d.ts.map +1 -1
  22. package/dist/components/FieldLabel/index.d.ts.map +1 -1
  23. package/dist/components/Icon/index.story.d.ts +1 -1
  24. package/dist/components/IconButton/index.d.ts.map +1 -1
  25. package/dist/components/LoadingSpinner/index.d.ts.map +1 -1
  26. package/dist/components/Modal/ModalPlumbing.d.ts.map +1 -1
  27. package/dist/components/Modal/index.d.ts.map +1 -1
  28. package/dist/components/Modal/index.story.d.ts +1 -0
  29. package/dist/components/Modal/index.story.d.ts.map +1 -1
  30. package/dist/components/MultiSelect/index.d.ts.map +1 -1
  31. package/dist/components/MultiSelect/index.story.d.ts +2 -0
  32. package/dist/components/MultiSelect/index.story.d.ts.map +1 -1
  33. package/dist/components/Radio/index.d.ts.map +1 -1
  34. package/dist/components/SegmentedControl/RadioGroupContext.d.ts +1 -1
  35. package/dist/components/SegmentedControl/RadioGroupContext.d.ts.map +1 -1
  36. package/dist/components/SegmentedControl/index.d.ts.map +1 -1
  37. package/dist/components/Switch/index.d.ts.map +1 -1
  38. package/dist/components/TagItem/index.d.ts.map +1 -1
  39. package/dist/components/TextField/TextField.story.d.ts.map +1 -1
  40. package/dist/components/TextField/index.d.ts.map +1 -1
  41. package/dist/index.cjs.js +1026 -384
  42. package/dist/index.cjs.js.map +1 -1
  43. package/dist/index.esm.js +991 -349
  44. package/dist/index.esm.js.map +1 -1
  45. package/dist/styled.d.ts +4 -4
  46. package/package.json +18 -21
  47. package/src/_lib/compat.ts +8 -0
  48. package/src/components/Button/StyledButton.tsx +66 -0
  49. package/src/components/Button/__snapshots__/index.story.storyshot +312 -592
  50. package/src/components/Button/index.tsx +14 -70
  51. package/src/components/Button/lib/variantToBackground.tsx +19 -0
  52. package/src/components/Button/lib/variantToFont.tsx +19 -0
  53. package/src/components/Checkbox/__snapshots__/index.story.storyshot +209 -40
  54. package/src/components/Checkbox/index.story.tsx +82 -64
  55. package/src/components/Checkbox/index.tsx +47 -17
  56. package/src/components/Clickable/__snapshots__/index.story.storyshot +4 -0
  57. package/src/components/Clickable/index.story.tsx +12 -9
  58. package/src/components/Clickable/index.tsx +1 -0
  59. package/src/components/DropdownSelector/DropdownMenuItem.tsx +6 -3
  60. package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +3 -10
  61. package/src/components/DropdownSelector/ListItem/index.tsx +6 -4
  62. package/src/components/DropdownSelector/MenuItemGroup/index.tsx +1 -1
  63. package/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot +4 -13
  64. package/src/components/DropdownSelector/Popover/__snapshots__/index.story.storyshot +20 -37
  65. package/src/components/DropdownSelector/Popover/index.tsx +5 -8
  66. package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +227 -294
  67. package/src/components/DropdownSelector/index.story.tsx +33 -0
  68. package/src/components/DropdownSelector/index.tsx +63 -20
  69. package/src/components/FieldLabel/index.tsx +77 -12
  70. package/src/components/IconButton/__snapshots__/index.story.storyshot +30 -54
  71. package/src/components/IconButton/index.tsx +51 -26
  72. package/src/components/LoadingSpinner/index.tsx +3 -6
  73. package/src/components/Modal/Dialog/index.tsx +1 -1
  74. package/src/components/Modal/ModalPlumbing.tsx +26 -5
  75. package/src/components/Modal/__snapshots__/index.story.storyshot +2450 -108
  76. package/src/components/Modal/index.story.tsx +27 -0
  77. package/src/components/Modal/index.tsx +19 -4
  78. package/src/components/MultiSelect/__snapshots__/index.story.storyshot +528 -25
  79. package/src/components/MultiSelect/index.story.tsx +60 -0
  80. package/src/components/MultiSelect/index.tsx +82 -22
  81. package/src/components/Radio/__snapshots__/index.story.storyshot +32 -49
  82. package/src/components/Radio/index.tsx +71 -23
  83. package/src/components/SegmentedControl/RadioGroupContext.tsx +1 -1
  84. package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +9 -10
  85. package/src/components/SegmentedControl/index.tsx +36 -16
  86. package/src/components/Switch/__snapshots__/index.story.storyshot +6 -18
  87. package/src/components/Switch/index.tsx +10 -15
  88. package/src/components/TagItem/__snapshots__/index.story.storyshot +39 -158
  89. package/src/components/TagItem/index.tsx +84 -19
  90. package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +55 -91
  91. package/src/components/TextField/TextField.story.tsx +35 -18
  92. package/src/components/TextField/__snapshots__/TextField.story.storyshot +92 -148
  93. package/src/components/TextField/index.tsx +0 -1
  94. package/dist/components/Checkbox/performance.test.d.ts +0 -4
  95. package/dist/components/Checkbox/performance.test.d.ts.map +0 -1
  96. package/dist/components/Checkbox/snapshot.test.d.ts +0 -2
  97. package/dist/components/Checkbox/snapshot.test.d.ts.map +0 -1
  98. package/src/components/Checkbox/__snapshots__/snapshot.test.tsx.snap +0 -763
  99. package/src/components/Checkbox/performance.test.tsx +0 -30
  100. package/src/components/Checkbox/snapshot.test.tsx +0 -66
@@ -50,33 +50,22 @@ exports[`Storyshots TextArea Auto Height 1`] = `
50
50
  margin-bottom: -4px;
51
51
  }
52
52
 
53
- .c5:hover:not(:disabled):not([aria-disabled]),
54
- .c5:hover[aria-disabled=false] {
53
+ .c5:not(:disabled):not([aria-disabled]):hover,
54
+ .c5[aria-disabled='false']:hover {
55
55
  color: var(--charcoal-text3-hover);
56
56
  }
57
57
 
58
- .c5:active:not(:disabled):not([aria-disabled]),
59
- .c5:active[aria-disabled=false] {
58
+ .c5:not(:disabled):not([aria-disabled]):active,
59
+ .c5[aria-disabled='false']:active {
60
60
  color: var(--charcoal-text3-press);
61
61
  }
62
62
 
63
- .c5:not(:disabled):not([aria-disabled]):focus,
64
- .c5[aria-disabled=false]:focus,
65
63
  .c5:not(:disabled):not([aria-disabled]):active,
66
- .c5[aria-disabled=false]:active {
67
- outline: none;
68
- box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
69
- }
70
-
71
- .c5:not(:disabled):not([aria-disabled]):focus:not(:focus-visible),
72
- .c5[aria-disabled=false]:focus:not(:focus-visible),
73
- .c5:not(:disabled):not([aria-disabled]):active:not(:focus-visible),
74
- .c5[aria-disabled=false]:active:not(:focus-visible) {
75
- outline: none;
76
- }
77
-
64
+ .c5[aria-disabled='false']:active,
65
+ .c5:not(:disabled):not([aria-disabled]):focus,
66
+ .c5[aria-disabled='false']:focus,
78
67
  .c5:not(:disabled):not([aria-disabled]):focus-visible,
79
- .c5[aria-disabled=false]:focus-visible {
68
+ .c5[aria-disabled='false']:focus-visible {
80
69
  outline: none;
81
70
  box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
82
71
  }
@@ -184,13 +173,13 @@ exports[`Storyshots TextArea Auto Height 1`] = `
184
173
  "border": 0,
185
174
  "clip": "rect(0 0 0 0)",
186
175
  "clipPath": "inset(50%)",
187
- "height": 1,
188
- "margin": "0 -1px -1px 0",
176
+ "height": "1px",
177
+ "margin": "-1px",
189
178
  "overflow": "hidden",
190
179
  "padding": 0,
191
180
  "position": "absolute",
192
181
  "whiteSpace": "nowrap",
193
- "width": 1,
182
+ "width": "1px",
194
183
  }
195
184
  }
196
185
  >
@@ -198,8 +187,6 @@ exports[`Storyshots TextArea Auto Height 1`] = `
198
187
  className="c3"
199
188
  htmlFor="test-id"
200
189
  id="test-id"
201
- onBlur={null}
202
- onFocus={null}
203
190
  >
204
191
  Label
205
192
  </label>
@@ -221,7 +208,9 @@ exports[`Storyshots TextArea Auto Height 1`] = `
221
208
  onChange={[Function]}
222
209
  placeholder="TextArea"
223
210
  readOnly={false}
211
+ required={false}
224
212
  rows={4}
213
+ value=""
225
214
  />
226
215
  </div>
227
216
  </div>
@@ -245,6 +234,8 @@ exports[`Storyshots TextArea Default 1`] = `
245
234
  -ms-letter-spacing: inherit;
246
235
  letter-spacing: inherit;
247
236
  word-spacing: inherit;
237
+ -webkit-text-decoration: none;
238
+ text-decoration: none;
248
239
  font: inherit;
249
240
  margin: 0;
250
241
  overflow: visible;
@@ -314,33 +305,22 @@ exports[`Storyshots TextArea Default 1`] = `
314
305
  margin-bottom: -4px;
315
306
  }
316
307
 
317
- .c6:hover:not(:disabled):not([aria-disabled]),
318
- .c6:hover[aria-disabled=false] {
308
+ .c6:not(:disabled):not([aria-disabled]):hover,
309
+ .c6[aria-disabled='false']:hover {
319
310
  color: var(--charcoal-text3-hover);
320
311
  }
321
312
 
322
- .c6:active:not(:disabled):not([aria-disabled]),
323
- .c6:active[aria-disabled=false] {
313
+ .c6:not(:disabled):not([aria-disabled]):active,
314
+ .c6[aria-disabled='false']:active {
324
315
  color: var(--charcoal-text3-press);
325
316
  }
326
317
 
327
- .c6:not(:disabled):not([aria-disabled]):focus,
328
- .c6[aria-disabled=false]:focus,
329
318
  .c6:not(:disabled):not([aria-disabled]):active,
330
- .c6[aria-disabled=false]:active {
331
- outline: none;
332
- box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
333
- }
334
-
335
- .c6:not(:disabled):not([aria-disabled]):focus:not(:focus-visible),
336
- .c6[aria-disabled=false]:focus:not(:focus-visible),
337
- .c6:not(:disabled):not([aria-disabled]):active:not(:focus-visible),
338
- .c6[aria-disabled=false]:active:not(:focus-visible) {
339
- outline: none;
340
- }
341
-
319
+ .c6[aria-disabled='false']:active,
320
+ .c6:not(:disabled):not([aria-disabled]):focus,
321
+ .c6[aria-disabled='false']:focus,
342
322
  .c6:not(:disabled):not([aria-disabled]):focus-visible,
343
- .c6[aria-disabled=false]:focus-visible {
323
+ .c6[aria-disabled='false']:focus-visible {
344
324
  outline: none;
345
325
  box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
346
326
  }
@@ -456,13 +436,13 @@ exports[`Storyshots TextArea Default 1`] = `
456
436
  "border": 0,
457
437
  "clip": "rect(0 0 0 0)",
458
438
  "clipPath": "inset(50%)",
459
- "height": 1,
460
- "margin": "0 -1px -1px 0",
439
+ "height": "1px",
440
+ "margin": "-1px",
461
441
  "overflow": "hidden",
462
442
  "padding": 0,
463
443
  "position": "absolute",
464
444
  "whiteSpace": "nowrap",
465
- "width": 1,
445
+ "width": "1px",
466
446
  }
467
447
  }
468
448
  >
@@ -470,8 +450,6 @@ exports[`Storyshots TextArea Default 1`] = `
470
450
  className="c4"
471
451
  htmlFor="test-id"
472
452
  id="test-id"
473
- onBlur={null}
474
- onFocus={null}
475
453
  >
476
454
  Label
477
455
  </label>
@@ -500,7 +478,9 @@ exports[`Storyshots TextArea Default 1`] = `
500
478
  onChange={[Function]}
501
479
  placeholder="Text Area"
502
480
  readOnly={false}
481
+ required={false}
503
482
  rows={4}
483
+ value=""
504
484
  />
505
485
  </div>
506
486
  </div>
@@ -525,6 +505,8 @@ exports[`Storyshots TextArea Has Count 1`] = `
525
505
  -ms-letter-spacing: inherit;
526
506
  letter-spacing: inherit;
527
507
  word-spacing: inherit;
508
+ -webkit-text-decoration: none;
509
+ text-decoration: none;
528
510
  font: inherit;
529
511
  margin: 0;
530
512
  overflow: visible;
@@ -594,33 +576,22 @@ exports[`Storyshots TextArea Has Count 1`] = `
594
576
  margin-bottom: -4px;
595
577
  }
596
578
 
597
- .c6:hover:not(:disabled):not([aria-disabled]),
598
- .c6:hover[aria-disabled=false] {
579
+ .c6:not(:disabled):not([aria-disabled]):hover,
580
+ .c6[aria-disabled='false']:hover {
599
581
  color: var(--charcoal-text3-hover);
600
582
  }
601
583
 
602
- .c6:active:not(:disabled):not([aria-disabled]),
603
- .c6:active[aria-disabled=false] {
584
+ .c6:not(:disabled):not([aria-disabled]):active,
585
+ .c6[aria-disabled='false']:active {
604
586
  color: var(--charcoal-text3-press);
605
587
  }
606
588
 
607
- .c6:not(:disabled):not([aria-disabled]):focus,
608
- .c6[aria-disabled=false]:focus,
609
589
  .c6:not(:disabled):not([aria-disabled]):active,
610
- .c6[aria-disabled=false]:active {
611
- outline: none;
612
- box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
613
- }
614
-
615
- .c6:not(:disabled):not([aria-disabled]):focus:not(:focus-visible),
616
- .c6[aria-disabled=false]:focus:not(:focus-visible),
617
- .c6:not(:disabled):not([aria-disabled]):active:not(:focus-visible),
618
- .c6[aria-disabled=false]:active:not(:focus-visible) {
619
- outline: none;
620
- }
621
-
590
+ .c6[aria-disabled='false']:active,
591
+ .c6:not(:disabled):not([aria-disabled]):focus,
592
+ .c6[aria-disabled='false']:focus,
622
593
  .c6:not(:disabled):not([aria-disabled]):focus-visible,
623
- .c6[aria-disabled=false]:focus-visible {
594
+ .c6[aria-disabled='false']:focus-visible {
624
595
  outline: none;
625
596
  box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
626
597
  }
@@ -745,13 +716,13 @@ exports[`Storyshots TextArea Has Count 1`] = `
745
716
  "border": 0,
746
717
  "clip": "rect(0 0 0 0)",
747
718
  "clipPath": "inset(50%)",
748
- "height": 1,
749
- "margin": "0 -1px -1px 0",
719
+ "height": "1px",
720
+ "margin": "-1px",
750
721
  "overflow": "hidden",
751
722
  "padding": 0,
752
723
  "position": "absolute",
753
724
  "whiteSpace": "nowrap",
754
- "width": 1,
725
+ "width": "1px",
755
726
  }
756
727
  }
757
728
  >
@@ -759,8 +730,6 @@ exports[`Storyshots TextArea Has Count 1`] = `
759
730
  className="c4"
760
731
  htmlFor="test-id"
761
732
  id="test-id"
762
- onBlur={null}
763
- onFocus={null}
764
733
  >
765
734
  Label
766
735
  </label>
@@ -790,7 +759,9 @@ exports[`Storyshots TextArea Has Count 1`] = `
790
759
  onChange={[Function]}
791
760
  placeholder="Text Area"
792
761
  readOnly={false}
762
+ required={false}
793
763
  rows={4}
764
+ value=""
794
765
  />
795
766
  <span
796
767
  className="c10"
@@ -820,6 +791,8 @@ exports[`Storyshots TextArea Has Label 1`] = `
820
791
  -ms-letter-spacing: inherit;
821
792
  letter-spacing: inherit;
822
793
  word-spacing: inherit;
794
+ -webkit-text-decoration: none;
795
+ text-decoration: none;
823
796
  font: inherit;
824
797
  margin: 0;
825
798
  overflow: visible;
@@ -912,33 +885,22 @@ exports[`Storyshots TextArea Has Label 1`] = `
912
885
  margin-bottom: -4px;
913
886
  }
914
887
 
915
- .c8:hover:not(:disabled):not([aria-disabled]),
916
- .c8:hover[aria-disabled=false] {
888
+ .c8:not(:disabled):not([aria-disabled]):hover,
889
+ .c8[aria-disabled='false']:hover {
917
890
  color: var(--charcoal-text3-hover);
918
891
  }
919
892
 
920
- .c8:active:not(:disabled):not([aria-disabled]),
921
- .c8:active[aria-disabled=false] {
893
+ .c8:not(:disabled):not([aria-disabled]):active,
894
+ .c8[aria-disabled='false']:active {
922
895
  color: var(--charcoal-text3-press);
923
896
  }
924
897
 
925
- .c8:not(:disabled):not([aria-disabled]):focus,
926
- .c8[aria-disabled=false]:focus,
927
898
  .c8:not(:disabled):not([aria-disabled]):active,
928
- .c8[aria-disabled=false]:active {
929
- outline: none;
930
- box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
931
- }
932
-
933
- .c8:not(:disabled):not([aria-disabled]):focus:not(:focus-visible),
934
- .c8[aria-disabled=false]:focus:not(:focus-visible),
935
- .c8:not(:disabled):not([aria-disabled]):active:not(:focus-visible),
936
- .c8[aria-disabled=false]:active:not(:focus-visible) {
937
- outline: none;
938
- }
939
-
899
+ .c8[aria-disabled='false']:active,
900
+ .c8:not(:disabled):not([aria-disabled]):focus,
901
+ .c8[aria-disabled='false']:focus,
940
902
  .c8:not(:disabled):not([aria-disabled]):focus-visible,
941
- .c8[aria-disabled=false]:focus-visible {
903
+ .c8[aria-disabled='false']:focus-visible {
942
904
  outline: none;
943
905
  box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
944
906
  }
@@ -1100,7 +1062,9 @@ exports[`Storyshots TextArea Has Label 1`] = `
1100
1062
  onChange={[Function]}
1101
1063
  placeholder="Text Area"
1102
1064
  readOnly={false}
1065
+ required={false}
1103
1066
  rows={4}
1067
+ value=""
1104
1068
  />
1105
1069
  </div>
1106
1070
  <p
@@ -1,10 +1,10 @@
1
- import { action } from '@storybook/addon-actions'
2
1
  import styled from 'styled-components'
3
2
  import { Story } from '../../_lib/compat'
4
3
  import Clickable from '../Clickable'
5
4
  import TextField, { TextFieldProps } from '.'
6
5
  import { px } from '@charcoal-ui/utils'
7
6
  import IconButton from '../IconButton'
7
+ import { useCallback, useState } from 'react'
8
8
 
9
9
  export default {
10
10
  title: 'TextField',
@@ -30,9 +30,7 @@ const Template: Story<Partial<TextFieldProps>> = (args) => (
30
30
  <TextField
31
31
  label="Label"
32
32
  requiredText="*必須"
33
- subLabel={
34
- <Clickable onClick={action('label-click')}>Text Link</Clickable>
35
- }
33
+ subLabel={<Clickable>Text Link</Clickable>}
36
34
  placeholder="TextField"
37
35
  {...args}
38
36
  />
@@ -64,21 +62,40 @@ HasAffix.args = {
64
62
  suffix: '.png',
65
63
  }
66
64
 
67
- export const PrefixIcon: Story<Partial<TextFieldProps>> = (args) => (
68
- <TextField
69
- label="Label"
70
- placeholder="作品を検索"
71
- prefix={
72
- <PrefixIconWrap>
73
- <pixiv-icon name="16/Search" />
74
- </PrefixIconWrap>
75
- }
76
- suffix={<IconButton variant="Overlay" icon={'16/Remove'} size="XS" />}
77
- {...args}
78
- />
79
- )
65
+ export const PrefixIcon: Story<Partial<TextFieldProps>> = (args) => {
66
+ const [value, setValue] = useState('')
67
+ const handleChange = useCallback((value: string) => {
68
+ setValue(value)
69
+ }, [])
70
+ const handleClear = useCallback(() => {
71
+ setValue('')
72
+ }, [])
73
+ return (
74
+ <TextField
75
+ {...args}
76
+ label="Label"
77
+ placeholder="作品を検索"
78
+ value={value}
79
+ onChange={handleChange}
80
+ prefix={
81
+ <PrefixIconWrap>
82
+ <pixiv-icon name="16/Search" />
83
+ </PrefixIconWrap>
84
+ }
85
+ suffix={
86
+ <IconButton
87
+ variant="Overlay"
88
+ icon={'16/Remove'}
89
+ size="XS"
90
+ onClick={handleClear}
91
+ />
92
+ }
93
+ />
94
+ )
95
+ }
80
96
 
81
97
  const PrefixIconWrap = styled.div`
82
- height: 16px;
98
+ display: flex;
99
+ align-items: center;
83
100
  color: ${({ theme }) => theme.color.text3};
84
101
  `