@charcoal-ui/react 6.0.0-beta.2 → 6.0.0-rc.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 (67) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +160 -152
  4. package/dist/layered.css +160 -152
  5. package/dist/layered.css.map +1 -1
  6. package/package.json +5 -5
  7. package/src/__tests__/css-variables.test.ts +66 -0
  8. package/src/components/Button/__snapshots__/index.css.snap +30 -30
  9. package/src/components/Button/index.css +30 -30
  10. package/src/components/Button/index.story.tsx +18 -0
  11. package/src/components/Checkbox/CheckboxInput/index.css +10 -10
  12. package/src/components/Checkbox/__snapshots__/index.css.snap +1 -1
  13. package/src/components/Checkbox/index.css +1 -1
  14. package/src/components/Checkbox/index.story.tsx +18 -0
  15. package/src/components/Clickable/index.story.tsx +14 -0
  16. package/src/components/DropdownSelector/DropdownMenuItem/index.css +3 -3
  17. package/src/components/DropdownSelector/ListItem/index.css +1 -1
  18. package/src/components/DropdownSelector/MenuItemGroup/index.css +1 -1
  19. package/src/components/DropdownSelector/Popover/index.css +2 -2
  20. package/src/components/DropdownSelector/__snapshots__/index.css.snap +6 -6
  21. package/src/components/DropdownSelector/index.css +6 -6
  22. package/src/components/DropdownSelector/index.story.tsx +49 -0
  23. package/src/components/FieldLabel/__snapshots__/index.css.snap +3 -3
  24. package/src/components/FieldLabel/index.css +3 -3
  25. package/src/components/HintText/__snapshots__/index.css.snap +3 -3
  26. package/src/components/HintText/index.css +3 -3
  27. package/src/components/HintText/index.story.tsx +12 -0
  28. package/src/components/IconButton/__snapshots__/index.css.snap +16 -16
  29. package/src/components/IconButton/index.css +16 -16
  30. package/src/components/IconButton/index.story.tsx +15 -0
  31. package/src/components/LoadingSpinner/__snapshots__/index.css.snap +7 -7
  32. package/src/components/LoadingSpinner/index.css +7 -7
  33. package/src/components/LoadingSpinner/index.story.tsx +13 -0
  34. package/src/components/Modal/Dialog/index.css +1 -1
  35. package/src/components/Modal/ModalPlumbing.css +1 -1
  36. package/src/components/Modal/__snapshots__/index.css.snap +2 -2
  37. package/src/components/Modal/index.css +2 -2
  38. package/src/components/Modal/index.story.tsx +20 -0
  39. package/src/components/MultiSelect/__snapshots__/index.css.snap +10 -10
  40. package/src/components/MultiSelect/index.css +10 -10
  41. package/src/components/MultiSelect/index.story.tsx +50 -0
  42. package/src/components/Pagination/Pagination.story.tsx +11 -0
  43. package/src/components/Pagination/__snapshots__/index.css.snap +11 -11
  44. package/src/components/Pagination/index.css +11 -11
  45. package/src/components/Radio/RadioInput/index.css +10 -10
  46. package/src/components/Radio/__snapshots__/index.css.snap +1 -1
  47. package/src/components/Radio/index.css +1 -1
  48. package/src/components/Radio/index.story.tsx +40 -0
  49. package/src/components/SegmentedControl/__snapshots__/index.css.snap +4 -4
  50. package/src/components/SegmentedControl/index.css +4 -4
  51. package/src/components/SegmentedControl/index.story.tsx +20 -0
  52. package/src/components/Switch/SwitchInput/index.css +9 -9
  53. package/src/components/Switch/__snapshots__/index.css.snap +1 -1
  54. package/src/components/Switch/index.css +1 -1
  55. package/src/components/Switch/index.story.tsx +19 -0
  56. package/src/components/TagItem/__snapshots__/index.css.snap +5 -4
  57. package/src/components/TagItem/index.css +5 -4
  58. package/src/components/TagItem/index.story.tsx +17 -0
  59. package/src/components/TextArea/TextArea.story.tsx +30 -0
  60. package/src/components/TextArea/__snapshots__/index.css.snap +7 -5
  61. package/src/components/TextArea/index.css +8 -5
  62. package/src/components/TextEllipsis/__snapshots__/index.css.snap +3 -0
  63. package/src/components/TextEllipsis/index.css +4 -0
  64. package/src/components/TextField/AssistiveText/index.css +2 -2
  65. package/src/components/TextField/TextField.story.tsx +30 -0
  66. package/src/components/TextField/__snapshots__/index.css.snap +6 -6
  67. package/src/components/TextField/index.css +6 -6
@@ -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-text4);
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-text5);
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-brand);
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-text4-hover);
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-text4-press);
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-text5-hover);
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-text5-press);
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-brand-hover);
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-brand-press);
81
+ background-color: var(--charcoal-color-container-primary-press);
82
82
  }
@@ -19,6 +19,6 @@
19
19
  .charcoal-switch__label_div {
20
20
  font-size: 14px;
21
21
  line-height: 22px;
22
- color: var(--charcoal-text2);
22
+ color: var(--charcoal-color-text-default);
23
23
  }
24
24
 
@@ -19,5 +19,5 @@
19
19
  .charcoal-switch__label_div {
20
20
  font-size: 14px;
21
21
  line-height: 22px;
22
- color: var(--charcoal-text2);
22
+ color: var(--charcoal-color-text-default);
23
23
  }
@@ -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-text5);
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-text2);
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-surface4);
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-surface3);
93
+ background-color: var(--charcoal-color-container-secondary-default);
93
94
  }
94
95
 
95
96
  .charcoal-tag-item__label {
@@ -1,8 +1,9 @@
1
1
  .charcoal-tag-item {
2
- --charcoal-tag-item-color: var(--charcoal-text5);
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-text2);
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-surface4);
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-surface3);
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
+ }
@@ -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-text2);
15
- background-color: var(--charcoal-surface3);
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-surface3-hover);
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-text3);
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-text3);
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-text2);
16
- background-color: var(--charcoal-surface3);
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-surface3-hover);
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-text3);
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-text3);
83
+ color: var(--charcoal-color-text-tertiary-default);
81
84
  }
@@ -1,4 +1,7 @@
1
1
  .charcoal-text-ellipsis {
2
+ /* Runtime variables overridden by the React component. */
3
+ --charcoal-text-ellipsis-line-limit: 1;
4
+ --charcoal-text-ellipsis-line-height: inherit;
2
5
  overflow: hidden;
3
6
  overflow-wrap: break-word;
4
7
  display: -webkit-box;
@@ -1,4 +1,8 @@
1
1
  .charcoal-text-ellipsis {
2
+ /* Runtime variables overridden by the React component. */
3
+ --charcoal-text-ellipsis-line-limit: 1;
4
+ --charcoal-text-ellipsis-line-height: inherit;
5
+
2
6
  overflow: hidden;
3
7
  overflow-wrap: break-word;
4
8
  display: -webkit-box;
@@ -2,9 +2,9 @@
2
2
  font-size: 14px;
3
3
  line-height: 22px;
4
4
  margin: 0;
5
- color: var(--charcoal-text2);
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-assertive);
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-text2);
17
- background-color: var(--charcoal-surface3);
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-surface3-hover);
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-text2);
80
+ color: var(--charcoal-color-text-secondary-default);
81
81
  }
82
82
 
83
83
  .charcoal-text-field-input::placeholder {
84
- color: var(--charcoal-text3);
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-text3);
90
+ color: var(--charcoal-color-text-tertiary-default);
91
91
  }
92
92
 
@@ -14,8 +14,8 @@
14
14
  transition:
15
15
  0.2s background-color,
16
16
  0.2s box-shadow;
17
- color: var(--charcoal-text2);
18
- background-color: var(--charcoal-surface3);
17
+ color: var(--charcoal-color-text-secondary-default);
18
+ background-color: var(--charcoal-color-container-secondary-default-a);
19
19
  border-radius: 4px;
20
20
  padding: 0 8px;
21
21
  line-height: 22px;
@@ -26,7 +26,7 @@
26
26
  }
27
27
 
28
28
  &:not([aria-disabled='true']):hover {
29
- background-color: var(--charcoal-surface3-hover);
29
+ background-color: var(--charcoal-color-container-secondary-hover-a);
30
30
  }
31
31
 
32
32
  &:not([aria-disabled='true']):focus-within {
@@ -79,15 +79,15 @@
79
79
  appearance: none;
80
80
  background: transparent;
81
81
 
82
- color: var(--charcoal-text2);
82
+ color: var(--charcoal-color-text-secondary-default);
83
83
 
84
84
  &::placeholder {
85
- color: var(--charcoal-text3);
85
+ color: var(--charcoal-color-text-placeholder-default);
86
86
  }
87
87
  }
88
88
 
89
89
  .charcoal-text-field-line-counter {
90
90
  line-height: 22px;
91
91
  font-size: 14px;
92
- color: var(--charcoal-text3);
92
+ color: var(--charcoal-color-text-tertiary-default);
93
93
  }