react-restyle-components 0.2.22 → 0.2.24
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/README.md +0 -6
- package/lib/package.json +15 -4
- package/lib/src/App.js +12 -1
- package/lib/src/assets/styles/colors.css +217 -0
- package/lib/src/assets/styles/decorations.css +15 -0
- package/lib/src/assets/styles/fontface.css +17 -0
- package/lib/src/assets/styles/scrollbars.css +70 -0
- package/lib/src/assets/styles/typography.css +3 -0
- package/lib/src/core-components/atoms/button/Button.stories.d.ts +320 -0
- package/lib/src/core-components/atoms/button/Button.stories.js +66 -0
- package/lib/src/core-components/atoms/button/Button.test.d.ts +1 -0
- package/lib/src/core-components/atoms/button/Button.test.js +31 -0
- package/lib/src/core-components/atoms/button/Button.types.d.ts +36 -0
- package/lib/src/core-components/atoms/button/Button.types.js +1 -0
- package/lib/src/core-components/atoms/button/LinkButton.stories.d.ts +302 -0
- package/lib/src/core-components/atoms/button/LinkButton.stories.js +52 -0
- package/lib/src/core-components/atoms/button/ToggleButton.stories.d.ts +337 -0
- package/lib/src/core-components/atoms/button/ToggleButton.stories.js +62 -0
- package/lib/src/core-components/atoms/button/button.component.d.ts +6 -0
- package/lib/src/core-components/atoms/button/button.component.js +19 -0
- package/lib/src/core-components/atoms/button/button.module.css +477 -0
- package/lib/src/core-components/atoms/button/buttonGroup/ButtonGroup.stories.d.ts +53 -0
- package/lib/src/core-components/atoms/button/buttonGroup/ButtonGroup.stories.js +271 -0
- package/lib/src/core-components/atoms/button/buttonGroup/buttonGroup.component.d.ts +9 -0
- package/lib/src/core-components/atoms/button/buttonGroup/buttonGroup.component.js +4 -0
- package/lib/src/core-components/atoms/button/linkButton.component.d.ts +9 -0
- package/lib/src/core-components/atoms/button/linkButton.component.js +20 -0
- package/lib/src/core-components/atoms/button/toggleButton.component.d.ts +10 -0
- package/lib/src/core-components/atoms/button/toggleButton.component.js +21 -0
- package/lib/src/core-components/atoms/icons/icons.component.js +1 -1
- package/lib/src/core-components/atoms/pdf/pdf-typography.components.js +2 -2
- package/lib/src/core-components/atoms/tabs/tabs.component.d.ts +9 -2
- package/lib/src/core-components/atoms/tabs/tabs.component.js +14 -9
- package/lib/src/core-components/atoms/tooltip/Tooltip.module.css +44 -0
- package/lib/src/core-components/atoms/tooltip/Tooltip.stories.d.ts +31 -0
- package/lib/src/core-components/atoms/tooltip/Tooltip.stories.js +100 -0
- package/lib/src/core-components/atoms/tooltip/Tooltip.types.d.ts +23 -0
- package/lib/src/core-components/atoms/tooltip/Tooltip.types.js +1 -0
- package/lib/src/core-components/atoms/tooltip/tooltip.component.d.ts +16 -9
- package/lib/src/core-components/atoms/tooltip/tooltip.component.js +26 -24
- package/lib/src/core-components/index.d.ts +4 -1
- package/lib/src/core-components/index.js +4 -1
- package/lib/tc.css +1 -1
- package/package.json +15 -4
- package/lib/src/core-components/atoms/buttons/button.stories.d.ts +0 -6
- package/lib/src/core-components/atoms/buttons/button.stories.js +0 -36
- package/lib/src/core-components/atoms/buttons/buttons.component.d.ts +0 -11
- package/lib/src/core-components/atoms/buttons/buttons.component.js +0 -8
- package/lib/src/core-components/atoms/tooltip/tooltip.stories.d.ts +0 -6
- package/lib/src/core-components/atoms/tooltip/tooltip.stories.js +0 -13
|
@@ -0,0 +1,477 @@
|
|
|
1
|
+
:global .theme--dark {
|
|
2
|
+
--button_color: var(--N0);
|
|
3
|
+
|
|
4
|
+
--button_color_brand_secondary: var(--B300);
|
|
5
|
+
--button_bg_brand_secondary_hover: rgb(from var(--B400) r g b / 0.24);
|
|
6
|
+
|
|
7
|
+
--button_color_danger_secondary: var(--Red);
|
|
8
|
+
--button_bg_danger_secondary_hover: rgb(from var(--R500) r g b / 0.24);
|
|
9
|
+
|
|
10
|
+
--button_color_accent_secondary: var(--Accent);
|
|
11
|
+
--button_bg_accent_secondary_hover: rgb(from var(--A500) r g b / 0.24);
|
|
12
|
+
|
|
13
|
+
--button_color_neutral_primary: var(--N0);
|
|
14
|
+
--button_color_neutral_secondary: var(--Gl200);
|
|
15
|
+
--button_bg_neutral_primary: var(--Gl600);
|
|
16
|
+
--button_bg_neutral_primary_hover: var(--Gl700);
|
|
17
|
+
--button_bg_neutral_secondary_hover: rgb(from var(--Gl400) r g b / 0.24);
|
|
18
|
+
|
|
19
|
+
--button_color_disabled: var(--Gl500);
|
|
20
|
+
--button_bg_disabled_primary: var(--Gl800);
|
|
21
|
+
|
|
22
|
+
--button_color_toggle_secondary_unchecked: var(--Gl200);
|
|
23
|
+
--button_bg_toggle_primary_unchecked: var(--Gl800);
|
|
24
|
+
--button_bg_toggle_primary_unchecked_hover: var(--Gl700);
|
|
25
|
+
--button_bg_toggle_secondary_unchecked_hover: var(--Gl600);
|
|
26
|
+
--button_color_toggle_primary_brand: var(--B300);
|
|
27
|
+
--button_color_toggle_primary_accent: var(--A400);
|
|
28
|
+
}
|
|
29
|
+
:global .theme--light {
|
|
30
|
+
--button_color: var(--N0);
|
|
31
|
+
|
|
32
|
+
--button_color_brand_secondary: var(--B600);
|
|
33
|
+
--button_bg_brand_secondary_hover: var(--B50);
|
|
34
|
+
|
|
35
|
+
--button_color_danger_secondary: var(--R600);
|
|
36
|
+
--button_bg_danger_secondary_hover: var(--R50);
|
|
37
|
+
|
|
38
|
+
--button_color_accent_secondary: var(--A600);
|
|
39
|
+
--button_bg_accent_secondary_hover: var(--A50);
|
|
40
|
+
|
|
41
|
+
--button_color_neutral_primary: var(--N1000);
|
|
42
|
+
--button_color_neutral_secondary: var(--N600);
|
|
43
|
+
--button_bg_neutral_primary: var(--N50);
|
|
44
|
+
--button_bg_neutral_primary_hover: var(--N100);
|
|
45
|
+
--button_bg_neutral_secondary_hover: var(--N50);
|
|
46
|
+
|
|
47
|
+
--button_color_disabled: var(--N300);
|
|
48
|
+
--button_bg_disabled_primary: var(--N50);
|
|
49
|
+
--button_color_toggle_secondary_unchecked: var(--N600);
|
|
50
|
+
--button_bg_toggle_primary_unchecked: var(--N50);
|
|
51
|
+
--button_bg_toggle_primary_unchecked_hover: var(--N100);
|
|
52
|
+
--button_bg_toggle_secondary_unchecked_hover: var(--N50);
|
|
53
|
+
--button_color_toggle_primary_brand: var(--B500);
|
|
54
|
+
--button_color_toggle_primary_accent: var(--A600);
|
|
55
|
+
--button_group_divider_color_netural_primary: var(--N200);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
:where(.reset_button) {
|
|
59
|
+
background: none;
|
|
60
|
+
border: none;
|
|
61
|
+
border-radius: 0;
|
|
62
|
+
padding: 0;
|
|
63
|
+
margin: 0;
|
|
64
|
+
cursor: pointer;
|
|
65
|
+
font: inherit;
|
|
66
|
+
color: inherit;
|
|
67
|
+
text-shadow: unset;
|
|
68
|
+
user-select: none;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.visuallyHidden {
|
|
72
|
+
border: 0;
|
|
73
|
+
clip: rect(0 0 0 0);
|
|
74
|
+
height: 1px;
|
|
75
|
+
margin: -1px;
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
padding: 0;
|
|
78
|
+
position: absolute;
|
|
79
|
+
width: 1px;
|
|
80
|
+
white-space: nowrap;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
:where(.button) {
|
|
84
|
+
border-radius: var(--button_radius, 4px);
|
|
85
|
+
flex: var(--button_flex, none);
|
|
86
|
+
display: inline-flex;
|
|
87
|
+
align-items: center;
|
|
88
|
+
justify-content: var(--button-justify-content);
|
|
89
|
+
line-height: 0;
|
|
90
|
+
background-color: var(--button_bg);
|
|
91
|
+
color: var(--button_color, inherit);
|
|
92
|
+
gap: var(--button_gap, 4px);
|
|
93
|
+
height: var(--button_height);
|
|
94
|
+
font-size: var(--button_font_size);
|
|
95
|
+
padding-left: var(--button_padding);
|
|
96
|
+
padding-right: var(--button_padding);
|
|
97
|
+
--button_icon_width: auto;
|
|
98
|
+
background-clip: padding-box;
|
|
99
|
+
font-weight: 400;
|
|
100
|
+
box-sizing: border-box;
|
|
101
|
+
outline: none;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.button:where(.focus-visible:not(:disabled):focus-visible, .focus:not(:disabled):focus) {
|
|
105
|
+
box-shadow: var(--button_focus-shadow, 0 0 0 2px var(--global-focus-color));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.button:where(:disabled) {
|
|
109
|
+
cursor: default;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* Set size of svg icon in button */
|
|
113
|
+
.button :where(svg) {
|
|
114
|
+
width: var(--button_icon_size, var(--button_icon_width));
|
|
115
|
+
height: var(--button_icon_size, var(--button_icon_height));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/* 02: Cross-color rules */
|
|
119
|
+
/* These rules apply across all color/intents */
|
|
120
|
+
|
|
121
|
+
/* All secondary buttons have no BG in default state: */
|
|
122
|
+
.button-level-secondary {
|
|
123
|
+
--button_bg: transparent;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* 03 Color specific rules */
|
|
127
|
+
/* Colors for different colors/intents */
|
|
128
|
+
|
|
129
|
+
/* 03A: 'Brand' colors */
|
|
130
|
+
/* Text colors */
|
|
131
|
+
.button-theme-brand:not(:disabled).button-level-secondary {
|
|
132
|
+
--button_color: var(--button_color_brand_secondary);
|
|
133
|
+
}
|
|
134
|
+
/* Bg colors */
|
|
135
|
+
.button-theme-brand:not(:disabled).button-level-primary {
|
|
136
|
+
--button_bg: var(--B500);
|
|
137
|
+
}
|
|
138
|
+
.button-theme-brand:not(:disabled).button-level-primary:where(:hover, [data-dropdownmenu-state='open']) {
|
|
139
|
+
--button_bg: var(--B600);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.button-theme-brand:not(:disabled).button-level-secondary:where(:hover, [data-dropdownmenu-state='open']) {
|
|
143
|
+
--button_bg: var(--button_bg_brand_secondary_hover);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/* 03B: 'Danger' colors */
|
|
147
|
+
/* Text colors */
|
|
148
|
+
.button-theme-danger:not(:disabled).button-level-secondary {
|
|
149
|
+
--button_color: var(--button_color_danger_secondary);
|
|
150
|
+
}
|
|
151
|
+
/* bg colors */
|
|
152
|
+
.button-theme-danger:not(:disabled).button-level-primary {
|
|
153
|
+
--button_bg: var(--R500);
|
|
154
|
+
}
|
|
155
|
+
.button-theme-danger:not(:disabled).button-level-primary:where(:hover, [data-dropdownmenu-state='open']) {
|
|
156
|
+
--button_bg: var(--R600);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.button-theme-danger:not(:disabled).button-level-secondary:where(:hover, [data-dropdownmenu-state='open']) {
|
|
160
|
+
--button_bg: var(--button_bg_danger_secondary_hover);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/* 03C: 'Accent' colors */
|
|
164
|
+
/* Text colors */
|
|
165
|
+
.button-theme-accent:not(:disabled).button-level-secondary {
|
|
166
|
+
--button_color: var(--button_color_accent_secondary);
|
|
167
|
+
}
|
|
168
|
+
/* bg colors */
|
|
169
|
+
.button-theme-accent:not(:disabled).button-level-primary {
|
|
170
|
+
--button_bg: var(--A500);
|
|
171
|
+
}
|
|
172
|
+
.button-theme-accent:not(:disabled).button-level-primary:where(:hover, [data-dropdownmenu-state='open']) {
|
|
173
|
+
--button_bg: var(--A600);
|
|
174
|
+
}
|
|
175
|
+
.button-theme-accent:not(:disabled).button-level-secondary:where(:hover, [data-dropdownmenu-state='open']) {
|
|
176
|
+
--button_bg: var(--button_bg_accent_secondary_hover);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/* 03D: 'Neutral' colors */
|
|
180
|
+
/* Text colors */
|
|
181
|
+
.button-theme-neutral:not(:disabled).button-level-primary {
|
|
182
|
+
--button_color: var(--button_color_neutral_primary);
|
|
183
|
+
}
|
|
184
|
+
.button-theme-neutral:not(:disabled).button-level-secondary {
|
|
185
|
+
--button_color: var(--button_color_neutral_secondary);
|
|
186
|
+
}
|
|
187
|
+
/* bg colors */
|
|
188
|
+
.button-theme-neutral:not(:disabled).button-level-primary {
|
|
189
|
+
--button_bg: var(--button_bg_neutral_primary);
|
|
190
|
+
}
|
|
191
|
+
.button-theme-neutral:not(:disabled).button-level-primary:where(:hover, [data-dropdownmenu-state='open']) {
|
|
192
|
+
--button_bg: var(--button_bg_neutral_primary_hover);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.button-theme-neutral:not(:disabled).button-level-secondary:where(:hover, [data-dropdownmenu-state='open']) {
|
|
196
|
+
--button_bg: var(--button_bg_neutral_secondary_hover);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.button:disabled {
|
|
200
|
+
/* text color */
|
|
201
|
+
--button_color: var(--button_color_disabled);
|
|
202
|
+
}
|
|
203
|
+
.button:disabled.button-level-primary {
|
|
204
|
+
/* bg color */
|
|
205
|
+
--button_bg: var(--button_bg_disabled_primary);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/* 05: UISize setup */
|
|
209
|
+
.button-size-xl {
|
|
210
|
+
--button_font_size: 18px;
|
|
211
|
+
--button_height: 56px;
|
|
212
|
+
--button_loading_size: 56px;
|
|
213
|
+
--button_icon_height: 24px;
|
|
214
|
+
--button_padding: 20px;
|
|
215
|
+
--button_gap: 8px;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.button-size-l {
|
|
219
|
+
--button_font_size: 18px;
|
|
220
|
+
--button_height: 48px;
|
|
221
|
+
--button_loading_size: 24px;
|
|
222
|
+
--button_icon_height: 24px;
|
|
223
|
+
--button_padding: 16px;
|
|
224
|
+
--button_gap: 8px;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.button-size-m {
|
|
228
|
+
--button_font_size: 16px;
|
|
229
|
+
--button_height: 40px;
|
|
230
|
+
--button_loading_size: 20px;
|
|
231
|
+
--button_icon_height: 20px;
|
|
232
|
+
--button_padding: 12px;
|
|
233
|
+
--button_gap: 8px;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.button-size-s {
|
|
237
|
+
--button_font_size: 14px;
|
|
238
|
+
--button_height: 32px;
|
|
239
|
+
--button_loading_size: 16px;
|
|
240
|
+
--button_icon_height: 16px;
|
|
241
|
+
--button_padding: 8px;
|
|
242
|
+
--button_gap: 4px;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.button-size-xs {
|
|
246
|
+
--button_font_size: 12px;
|
|
247
|
+
--button_height: 24px;
|
|
248
|
+
--button_loading_size: 12px;
|
|
249
|
+
--button_icon_height: 12px;
|
|
250
|
+
--button_padding: 8px;
|
|
251
|
+
--button_gap: 4px;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.button-size-xxs {
|
|
255
|
+
--button_font_size: 12px;
|
|
256
|
+
--button_height: 20px;
|
|
257
|
+
--button_loading_size: 12px;
|
|
258
|
+
--button_icon_height: 12px;
|
|
259
|
+
--button_padding: 4px;
|
|
260
|
+
--button_gap: 2px;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/* 06: Size adjustments for Icon Only buttons. */
|
|
264
|
+
/* The icons are a bit bigger than when it is text + icon: */
|
|
265
|
+
.button-icon-only.button-size-xl {
|
|
266
|
+
--button_icon_height: 28px;
|
|
267
|
+
--button_padding: 13px;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.button-icon-only.button-size-l {
|
|
271
|
+
--button_icon_height: 28px;
|
|
272
|
+
--button_padding: 9px;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.button-icon-only.button-size-m {
|
|
276
|
+
--button_icon_height: 24px;
|
|
277
|
+
--button_padding: 7px;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.button-icon-only.button-size-s {
|
|
281
|
+
--button_icon_height: 20px;
|
|
282
|
+
--button_padding: 5px;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.button-icon-only.button-size-xs {
|
|
286
|
+
--button_icon_height: 18px;
|
|
287
|
+
--button_padding: 1.5px;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.button-icon-only.button-size-xxs {
|
|
291
|
+
--button_icon_height: 14px;
|
|
292
|
+
--button_padding: 1.5px;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.button-icon-only {
|
|
296
|
+
min-width: var(--button_height);
|
|
297
|
+
place-content: center;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/* Loading styles */
|
|
301
|
+
@keyframes spin {
|
|
302
|
+
to {
|
|
303
|
+
transform: rotate(360deg);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
:where(.loading) {
|
|
307
|
+
color: transparent;
|
|
308
|
+
pointer-events: none;
|
|
309
|
+
position: relative;
|
|
310
|
+
& > * {
|
|
311
|
+
visibility: hidden;
|
|
312
|
+
}
|
|
313
|
+
&::after {
|
|
314
|
+
content: '';
|
|
315
|
+
position: absolute;
|
|
316
|
+
top: calc(50% - var(--button_loading_size) * 0.5);
|
|
317
|
+
left: calc(50% - var(--button_loading_size) * 0.5);
|
|
318
|
+
display: block;
|
|
319
|
+
width: var(--button_loading_size);
|
|
320
|
+
aspect-ratio: 1;
|
|
321
|
+
border: calc(var(--button_loading_size) / 8) solid var(--button_color);
|
|
322
|
+
border-top-color: transparent;
|
|
323
|
+
border-radius: 50%;
|
|
324
|
+
box-sizing: border-box;
|
|
325
|
+
animation: spin 1s linear infinite;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/* 07 LinkButton */
|
|
330
|
+
/* LinkButton uses the same styles as Button but applies to an <a> element. */
|
|
331
|
+
/* This rule handle some extra resets we need to do for links: */
|
|
332
|
+
.linkButton {
|
|
333
|
+
text-decoration: none;
|
|
334
|
+
width: fit-content;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/* 08 ToggleButton */
|
|
338
|
+
|
|
339
|
+
.label {
|
|
340
|
+
display: flex;
|
|
341
|
+
width: max-content;
|
|
342
|
+
&:not(:has(:disabled, .loading)) {
|
|
343
|
+
cursor: pointer;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/* inactive/unchecked styles: */
|
|
348
|
+
|
|
349
|
+
.checkbox:not(:checked):not(:disabled) + .toggleButton.button-level-secondary {
|
|
350
|
+
--button_color: var(--button_color_toggle_secondary_unchecked);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.checkbox:not(:checked):not(:disabled) + .toggleButton.button-level-primary.button-theme-brand {
|
|
354
|
+
--button_color: var(--button_color_toggle_primary_brand);
|
|
355
|
+
}
|
|
356
|
+
.checkbox:not(:checked):not(:disabled) + .toggleButton.button-level-primary.button-theme-accent {
|
|
357
|
+
--button_color: var(--button_color_toggle_primary_accent);
|
|
358
|
+
}
|
|
359
|
+
.checkbox:not(:checked):not(:disabled) + .toggleButton.button-level-primary.button-theme-danger {
|
|
360
|
+
--button_color: var(--Red);
|
|
361
|
+
}
|
|
362
|
+
.checkbox:not(:checked):not(:disabled) + .toggleButton.button-level-primary.button-theme-neutral {
|
|
363
|
+
--button_color: var(--N500);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.checkbox:not(:checked):not(:disabled) + .toggleButton {
|
|
367
|
+
--button_bg: var(--button_bg_toggle_primary_unchecked);
|
|
368
|
+
}
|
|
369
|
+
.checkbox:not(:checked):not(:disabled) + .toggleButton.button-level-secondary {
|
|
370
|
+
--button_bg: transparent;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.checkbox:not(:checked):not(:disabled) + .toggleButton.button-level-primary:hover {
|
|
374
|
+
--button_bg: var(--button_bg_toggle_primary_unchecked_hover);
|
|
375
|
+
}
|
|
376
|
+
.checkbox:not(:checked):not(:disabled) + .toggleButton.button-level-secondary:hover {
|
|
377
|
+
--button_bg: var(--button_bg_toggle_secondary_unchecked_hover);
|
|
378
|
+
}
|
|
379
|
+
/* disabled checkbox styles: */
|
|
380
|
+
.checkbox:disabled + .toggleButton {
|
|
381
|
+
cursor: default;
|
|
382
|
+
pointer-events: none;
|
|
383
|
+
/* text color */
|
|
384
|
+
--button_color: var(--button_color_disabled);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.checkbox:disabled + .toggleButton.button-level-primary {
|
|
388
|
+
/* bg color */
|
|
389
|
+
--button_bg: var(--button_bg_disabled_primary);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.checkbox:where(.focus-visible:not(:disabled):focus-visible, .focus:not(:disabled):focus) + .toggleButton {
|
|
393
|
+
box-shadow: var(--button_focus-shadow, 0 0 0 2px var(--global-focus-color));
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.group {
|
|
397
|
+
display: flex;
|
|
398
|
+
border-radius: var(--button_radius, 4px);
|
|
399
|
+
|
|
400
|
+
&:where(.isverticalhug) {
|
|
401
|
+
height: max-content;
|
|
402
|
+
}
|
|
403
|
+
&:where(.ishorizontalhug) {
|
|
404
|
+
width: max-content;
|
|
405
|
+
}
|
|
406
|
+
&:where(.ishorizontalfill, .isverticalfill) {
|
|
407
|
+
--button_flex: 1 0 auto;
|
|
408
|
+
}
|
|
409
|
+
&:where(.ishorizontal.isverticalfill) {
|
|
410
|
+
& > * {
|
|
411
|
+
--button_height: auto;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
&:where(.ishorizontal) {
|
|
416
|
+
& > .button:not(:last-child),
|
|
417
|
+
& > *:not(:last-child) .button {
|
|
418
|
+
border-top-right-radius: 0;
|
|
419
|
+
border-bottom-right-radius: 0;
|
|
420
|
+
}
|
|
421
|
+
& > .button:not(:first-child),
|
|
422
|
+
& > *:not(:first-child) .button {
|
|
423
|
+
border-top-left-radius: 0;
|
|
424
|
+
border-bottom-left-radius: 0;
|
|
425
|
+
&::before {
|
|
426
|
+
width: 1px;
|
|
427
|
+
top: 0;
|
|
428
|
+
bottom: 0;
|
|
429
|
+
left: 0;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
&:where(.isvertical) {
|
|
434
|
+
flex-direction: column;
|
|
435
|
+
& > .button:not(:last-child),
|
|
436
|
+
& > *:not(:last-child) .button {
|
|
437
|
+
border-bottom-left-radius: 0;
|
|
438
|
+
border-bottom-right-radius: 0;
|
|
439
|
+
}
|
|
440
|
+
& > .button:not(:first-child),
|
|
441
|
+
& > *:not(:first-child) .button {
|
|
442
|
+
border-top-left-radius: 0;
|
|
443
|
+
border-top-right-radius: 0;
|
|
444
|
+
&::before {
|
|
445
|
+
height: 1px;
|
|
446
|
+
right: 0;
|
|
447
|
+
top: 0;
|
|
448
|
+
left: 0;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
& > .button:not(:first-child),
|
|
454
|
+
& > *:not(:first-child) .button {
|
|
455
|
+
position: relative;
|
|
456
|
+
&::before {
|
|
457
|
+
position: absolute;
|
|
458
|
+
display: block;
|
|
459
|
+
content: '';
|
|
460
|
+
background-color: color-mix(in srgb, var(--button_bg) 70%, white);
|
|
461
|
+
align-self: stretch;
|
|
462
|
+
}
|
|
463
|
+
&.button-theme-neutral.button-level-primary::before {
|
|
464
|
+
background-color: var(
|
|
465
|
+
--button_group_divider_color_netural_primary,
|
|
466
|
+
color-mix(in srgb, var(--button_bg) 70%, white)
|
|
467
|
+
);
|
|
468
|
+
}
|
|
469
|
+
&.button-level-secondary::before {
|
|
470
|
+
background-color: rgb(from var(--global-text-primary) r g b / 0.25);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
&:has(*:focus-visible, [data-dropdownmenu-state='open']) {
|
|
475
|
+
box-shadow: var(--button_focus-shadow, 0 0 0 2px rgb(from var(--global-focus-color) r g b / 0.3));
|
|
476
|
+
}
|
|
477
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { StoryObj } from '@storybook/react';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
parameters: {
|
|
6
|
+
componentSubtitle: string;
|
|
7
|
+
};
|
|
8
|
+
component: ({ children, orientation, horizontalSizing, verticalSizing, className, }: {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
orientation?: "horizontal" | "vertical" | undefined;
|
|
11
|
+
horizontalSizing?: "fill" | "hug" | undefined;
|
|
12
|
+
verticalSizing?: "fill" | "hug" | undefined;
|
|
13
|
+
className?: string | undefined;
|
|
14
|
+
}) => React.JSX.Element;
|
|
15
|
+
tags: string[];
|
|
16
|
+
decorators: ((Story: import("@storybook/csf").PartialStoryFn<import("@storybook/react/dist/types-a5624094").R, {
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
orientation?: "horizontal" | "vertical" | undefined;
|
|
19
|
+
horizontalSizing?: "fill" | "hug" | undefined;
|
|
20
|
+
verticalSizing?: "fill" | "hug" | undefined;
|
|
21
|
+
className?: string | undefined;
|
|
22
|
+
}>) => React.JSX.Element)[];
|
|
23
|
+
};
|
|
24
|
+
export default meta;
|
|
25
|
+
type Story = StoryObj<typeof meta>;
|
|
26
|
+
/**
|
|
27
|
+
* At its simplest you can just wrap any `Button` elements in a `ButtonGroup`.
|
|
28
|
+
*
|
|
29
|
+
* All props for button scale, variant, etc stay on the Button.
|
|
30
|
+
* You should use the same scale for all buttons in a group but could mix and match variants and levels.
|
|
31
|
+
*/
|
|
32
|
+
export declare const Basic: Story;
|
|
33
|
+
/**
|
|
34
|
+
* If only a single `Button` is passed in, it will be visually the same as not wrapping in a `ButtonGroup`.
|
|
35
|
+
*/
|
|
36
|
+
export declare const BasicOneButton: Story;
|
|
37
|
+
/**
|
|
38
|
+
* To creat a split button you would add a `DropdownMenu` as the last child. Its trigger should be a `Button`.
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* ButtonGroups can be passed `orientation="vertical"` to stack buttons vertically.
|
|
42
|
+
*/
|
|
43
|
+
export declare const Vertical: Story;
|
|
44
|
+
/**
|
|
45
|
+
* Vertical ButtonGroups can also contain a `DropdownMenu`.
|
|
46
|
+
*/
|
|
47
|
+
/**
|
|
48
|
+
* ButtonGroups also work with LinkButtons and ToggleButtons.
|
|
49
|
+
*
|
|
50
|
+
* However ToggleButton styling is not currently ideal as the divider is hard to see.
|
|
51
|
+
* Also note that ButtonGroup with ToggleButtons is not the same as a ToggleGroup. The former will allow multiple buttons to be active at once, whereas the latter will only allow one button to be active at a time.
|
|
52
|
+
*/
|
|
53
|
+
export declare const FillModes: Story;
|