@bythium/unisson 0.0.0-stage → 0.1.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/LICENSE +201 -0
- package/NOTICE +28 -0
- package/README.md +145 -2
- package/dist/CHANGELOG.md +17 -0
- package/dist/button-group.d.ts +29 -0
- package/dist/button-group.js +1 -0
- package/dist/button.d.ts +37 -0
- package/dist/button.js +1 -0
- package/dist/chunks/chunk-4GXKKP4T.js +460 -0
- package/dist/chunks/chunk-5TUKFRTD.js +376 -0
- package/dist/chunks/chunk-5VNPX7DT.js +1 -0
- package/dist/chunks/chunk-6TMCYM5S.js +436 -0
- package/dist/chunks/chunk-BAYUYXVR.js +1 -0
- package/dist/chunks/chunk-FGJHPGJI.js +1 -0
- package/dist/chunks/chunk-JOXL2SMV.js +373 -0
- package/dist/chunks/chunk-MWNIQCR3.js +298 -0
- package/dist/chunks/chunk-MYB6FQX2.js +394 -0
- package/dist/chunks/chunk-W3ASGVKH.js +1 -0
- package/dist/chunks/chunk-WKXQ2JMZ.js +557 -0
- package/dist/confirm-button.d.ts +37 -0
- package/dist/confirm-button.js +1 -0
- package/dist/copy-button.d.ts +25 -0
- package/dist/copy-button.js +1 -0
- package/dist/custom-elements.json +1480 -0
- package/dist/define.d.ts +8 -0
- package/dist/define.js +1 -0
- package/dist/icon-button.d.ts +33 -0
- package/dist/icon-button.js +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +1 -0
- package/dist/react/attributes.d.ts +10 -0
- package/dist/react/attributes.js +25 -0
- package/dist/react/button-group.d.ts +27 -0
- package/dist/react/button-group.js +7 -0
- package/dist/react/button.d.ts +35 -0
- package/dist/react/button.js +7 -0
- package/dist/react/confirm-button.d.ts +35 -0
- package/dist/react/confirm-button.js +7 -0
- package/dist/react/copy-button.d.ts +23 -0
- package/dist/react/copy-button.js +7 -0
- package/dist/react/icon-button.d.ts +31 -0
- package/dist/react/icon-button.js +7 -0
- package/dist/react/index.d.ts +8 -0
- package/dist/react/index.js +9 -0
- package/dist/react/runtime.js +11 -0
- package/dist/react/split-button.d.ts +31 -0
- package/dist/react/split-button.js +7 -0
- package/dist/react/toggle-button.d.ts +27 -0
- package/dist/react/toggle-button.js +7 -0
- package/dist/split-button.d.ts +33 -0
- package/dist/split-button.js +1 -0
- package/dist/svelte/OButton.svelte +14 -0
- package/dist/svelte/OButton.svelte.d.ts +36 -0
- package/dist/svelte/OButtonGroup.svelte +14 -0
- package/dist/svelte/OButtonGroup.svelte.d.ts +28 -0
- package/dist/svelte/OConfirmButton.svelte +14 -0
- package/dist/svelte/OConfirmButton.svelte.d.ts +36 -0
- package/dist/svelte/OCopyButton.svelte +14 -0
- package/dist/svelte/OCopyButton.svelte.d.ts +24 -0
- package/dist/svelte/OIconButton.svelte +14 -0
- package/dist/svelte/OIconButton.svelte.d.ts +32 -0
- package/dist/svelte/OSplitButton.svelte +14 -0
- package/dist/svelte/OSplitButton.svelte.d.ts +32 -0
- package/dist/svelte/OToggleButton.svelte +14 -0
- package/dist/svelte/OToggleButton.svelte.d.ts +28 -0
- package/dist/svelte/attributes.d.ts +10 -0
- package/dist/svelte/attributes.js +25 -0
- package/dist/svelte/index.d.ts +8 -0
- package/dist/svelte/index.js +8 -0
- package/dist/toggle-button.d.ts +29 -0
- package/dist/toggle-button.js +1 -0
- package/dist/tokens.css +200 -0
- package/dist/vue/attributes.d.ts +10 -0
- package/dist/vue/attributes.js +25 -0
- package/dist/vue/button-group.d.ts +27 -0
- package/dist/vue/button-group.js +6 -0
- package/dist/vue/button.d.ts +35 -0
- package/dist/vue/button.js +6 -0
- package/dist/vue/confirm-button.d.ts +35 -0
- package/dist/vue/confirm-button.js +6 -0
- package/dist/vue/copy-button.d.ts +23 -0
- package/dist/vue/copy-button.js +6 -0
- package/dist/vue/icon-button.d.ts +31 -0
- package/dist/vue/icon-button.js +6 -0
- package/dist/vue/index.d.ts +8 -0
- package/dist/vue/index.js +8 -0
- package/dist/vue/runtime.js +31 -0
- package/dist/vue/split-button.d.ts +31 -0
- package/dist/vue/split-button.js +6 -0
- package/dist/vue/toggle-button.d.ts +27 -0
- package/dist/vue/toggle-button.js +6 -0
- package/package.json +199 -4
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import{a,d as u,e as c}from"./chunk-W3ASGVKH.js";var b={label:{type:"string",default:""},items:{type:"string",default:""},orientation:{type:"string",default:"horizontal",enum:["horizontal","vertical"]},size:{type:"string",default:"md",enum:["sm","md","lg"]},disabled:{type:"boolean",default:!1}},p=`/* Styles de base de toute tranche : repris de src/shared/base.styles.css d'Orchestre, aux r\xE8gles de la convention
|
|
2
|
+
(jetons --bythium-*, propri\xE9t\xE9s logiques, pas de !important, mouvement sous no-preference).
|
|
3
|
+
tools/wc.generate.ts les place devant la feuille de chaque tranche : m\xEAme cascade que l'ancien d\xE9p\xF4t. */
|
|
4
|
+
:host {
|
|
5
|
+
display: inline-block;
|
|
6
|
+
min-inline-size: 0;
|
|
7
|
+
max-inline-size: 100%;
|
|
8
|
+
color: var(--bythium-text-primary);
|
|
9
|
+
font-family: var(--font-sans);
|
|
10
|
+
font-size: var(--font-size-base);
|
|
11
|
+
line-height: var(--line-height-base);
|
|
12
|
+
font-feature-settings: var(--font-features, normal);
|
|
13
|
+
letter-spacing: -0.006em;
|
|
14
|
+
vertical-align: middle;
|
|
15
|
+
}
|
|
16
|
+
:host([hidden]) {
|
|
17
|
+
display: none;
|
|
18
|
+
}
|
|
19
|
+
/* D\xE9sactiv\xE9 : couleurs att\xE9nu\xE9es qui gardent 4,5:1 (texte) et 3:1 (contour), jamais d'opacit\xE9 sur l'h\xF4te, qui ferait
|
|
20
|
+
\xE9chouer le contraste du libell\xE9 et des textes voisins (axe, WC-R04). Une tranche peut pr\xE9ciser sa propre r\xE8gle. */
|
|
21
|
+
:host([disabled]) {
|
|
22
|
+
color: var(--bythium-text-muted);
|
|
23
|
+
}
|
|
24
|
+
*,
|
|
25
|
+
*::before,
|
|
26
|
+
*::after {
|
|
27
|
+
box-sizing: border-box;
|
|
28
|
+
}
|
|
29
|
+
button,
|
|
30
|
+
input,
|
|
31
|
+
a,
|
|
32
|
+
select,
|
|
33
|
+
textarea {
|
|
34
|
+
font: inherit;
|
|
35
|
+
color: inherit;
|
|
36
|
+
}
|
|
37
|
+
button,
|
|
38
|
+
a,
|
|
39
|
+
input {
|
|
40
|
+
touch-action: manipulation;
|
|
41
|
+
}
|
|
42
|
+
button {
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
}
|
|
45
|
+
button:disabled,
|
|
46
|
+
input:disabled {
|
|
47
|
+
cursor: not-allowed;
|
|
48
|
+
}
|
|
49
|
+
button:disabled,
|
|
50
|
+
.control:disabled {
|
|
51
|
+
color: var(--bythium-text-muted);
|
|
52
|
+
}
|
|
53
|
+
/* Profil Linear : un bouton se lit par son fond et son libell\xE9, sa bordure reste d\xE9corative ; un champ garde un contour \xE0 3:1. */
|
|
54
|
+
button {
|
|
55
|
+
min-block-size: var(--control-height);
|
|
56
|
+
padding: 4px 10px;
|
|
57
|
+
border: 1px solid var(--bythium-border-subtle);
|
|
58
|
+
border-radius: var(--radius-control);
|
|
59
|
+
background-color: var(--bythium-surface-raised);
|
|
60
|
+
color: var(--bythium-text-primary);
|
|
61
|
+
font-size: var(--font-size-caption);
|
|
62
|
+
font-weight: var(--font-weight-medium);
|
|
63
|
+
}
|
|
64
|
+
.control {
|
|
65
|
+
min-block-size: var(--control-height);
|
|
66
|
+
padding: 4px 9px;
|
|
67
|
+
border: 1px solid var(--bythium-border-strong);
|
|
68
|
+
border-radius: var(--radius-control);
|
|
69
|
+
background-color: var(--bythium-surface-base);
|
|
70
|
+
color: var(--bythium-text-primary);
|
|
71
|
+
font-size: var(--font-size-base);
|
|
72
|
+
}
|
|
73
|
+
.control:hover:not(:disabled):not(:focus-visible) {
|
|
74
|
+
border-color: var(--bythium-text-muted);
|
|
75
|
+
}
|
|
76
|
+
button:hover:not(:disabled) {
|
|
77
|
+
background: color-mix(in oklch, var(--bythium-text-primary) 8%, var(--bythium-surface-raised));
|
|
78
|
+
}
|
|
79
|
+
button:active:not(:disabled) {
|
|
80
|
+
background: color-mix(in oklch, var(--bythium-text-primary) 12%, var(--bythium-surface-raised));
|
|
81
|
+
}
|
|
82
|
+
a {
|
|
83
|
+
display: inline-flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
gap: var(--space-2);
|
|
86
|
+
min-block-size: var(--target-touch-min);
|
|
87
|
+
color: var(--bythium-link);
|
|
88
|
+
text-decoration: underline;
|
|
89
|
+
text-underline-offset: 3px;
|
|
90
|
+
}
|
|
91
|
+
:where(button, input, a, select, textarea, [tabindex]):focus-visible {
|
|
92
|
+
outline: var(--focus-ring-width) solid var(--bythium-border-focus);
|
|
93
|
+
outline-offset: 1px;
|
|
94
|
+
}
|
|
95
|
+
input {
|
|
96
|
+
min-inline-size: 0;
|
|
97
|
+
max-inline-size: 100%;
|
|
98
|
+
accent-color: var(--bythium-brand-primary);
|
|
99
|
+
}
|
|
100
|
+
::placeholder {
|
|
101
|
+
color: var(--bythium-text-muted);
|
|
102
|
+
opacity: 1;
|
|
103
|
+
}
|
|
104
|
+
input[type='range'] {
|
|
105
|
+
min-block-size: var(--target-touch-min);
|
|
106
|
+
}
|
|
107
|
+
input[type='checkbox'],
|
|
108
|
+
input[type='radio'] {
|
|
109
|
+
inline-size: 16px;
|
|
110
|
+
block-size: 16px;
|
|
111
|
+
margin: 0;
|
|
112
|
+
}
|
|
113
|
+
label {
|
|
114
|
+
display: flex;
|
|
115
|
+
align-items: center;
|
|
116
|
+
gap: var(--space-2);
|
|
117
|
+
font-size: var(--font-size-caption);
|
|
118
|
+
}
|
|
119
|
+
.field {
|
|
120
|
+
display: grid;
|
|
121
|
+
gap: var(--space-1-5);
|
|
122
|
+
}
|
|
123
|
+
.row {
|
|
124
|
+
display: flex;
|
|
125
|
+
flex-wrap: wrap;
|
|
126
|
+
align-items: center;
|
|
127
|
+
gap: var(--space-2);
|
|
128
|
+
}
|
|
129
|
+
.sr-only {
|
|
130
|
+
position: absolute;
|
|
131
|
+
inline-size: 1px;
|
|
132
|
+
block-size: 1px;
|
|
133
|
+
padding: 0;
|
|
134
|
+
margin: -1px;
|
|
135
|
+
overflow: hidden;
|
|
136
|
+
clip-path: inset(50%);
|
|
137
|
+
white-space: nowrap;
|
|
138
|
+
border: 0;
|
|
139
|
+
}
|
|
140
|
+
/* A field inside a table whose column headers name its controls (bythium-slot-table labels="hidden") keeps its label
|
|
141
|
+
for assistive technologies only: the custom property inherits across the shadow boundaries down to the field. */
|
|
142
|
+
@container style(--bythium-field-labels: hidden) {
|
|
143
|
+
label[part=label][for],
|
|
144
|
+
legend[part=label] {
|
|
145
|
+
position: absolute;
|
|
146
|
+
inline-size: 1px;
|
|
147
|
+
block-size: 1px;
|
|
148
|
+
padding: 0;
|
|
149
|
+
margin: -1px;
|
|
150
|
+
overflow: hidden;
|
|
151
|
+
clip-path: inset(50%);
|
|
152
|
+
white-space: nowrap;
|
|
153
|
+
border: 0;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
.muted {
|
|
157
|
+
color: var(--bythium-text-muted);
|
|
158
|
+
}
|
|
159
|
+
.error {
|
|
160
|
+
color: var(--bythium-status-danger);
|
|
161
|
+
font-size: var(--font-size-base);
|
|
162
|
+
}
|
|
163
|
+
.primary {
|
|
164
|
+
border-color: var(--bythium-brand-primary);
|
|
165
|
+
background: var(--bythium-brand-primary);
|
|
166
|
+
color: var(--bythium-on-brand-primary);
|
|
167
|
+
box-shadow: inset 0 1px 0 0 color-mix(in oklch, var(--bythium-on-brand-primary) 16%, transparent);
|
|
168
|
+
}
|
|
169
|
+
.primary:hover:not(:disabled) {
|
|
170
|
+
background: var(--bythium-brand-primary-hover);
|
|
171
|
+
color: var(--bythium-on-brand-primary);
|
|
172
|
+
}
|
|
173
|
+
[aria-current],
|
|
174
|
+
[aria-selected='true'],
|
|
175
|
+
[aria-pressed='true'] {
|
|
176
|
+
border-color: var(--bythium-border-subtle);
|
|
177
|
+
background: var(--bythium-state-selected, var(--bythium-surface-raised));
|
|
178
|
+
}
|
|
179
|
+
slot {
|
|
180
|
+
max-inline-size: 100%;
|
|
181
|
+
}
|
|
182
|
+
/* Cible tactile de 44 px sans changer la taille visuelle (WC-R05, WC-D03) : classe \xAB target \xBB sur le contr\xF4le.
|
|
183
|
+
Le pseudo-\xE9l\xE9ment d\xE9borde du contr\xF4le de fa\xE7on sym\xE9trique, donc identique en ltr et en rtl. */
|
|
184
|
+
.target {
|
|
185
|
+
position: relative;
|
|
186
|
+
isolation: isolate;
|
|
187
|
+
}
|
|
188
|
+
/* Sous le contenu du contr\xF4le (z-index -1 dans son propre contexte d'empilement) : il ne masque jamais un enfant. */
|
|
189
|
+
.target::after {
|
|
190
|
+
content: '';
|
|
191
|
+
position: absolute;
|
|
192
|
+
z-index: -1;
|
|
193
|
+
inset-block: min(0px, calc((100% - var(--target-touch-min)) / 2));
|
|
194
|
+
inset-inline: min(0px, calc((100% - var(--target-touch-min)) / 2));
|
|
195
|
+
}
|
|
196
|
+
/* Rang\xE9es denses (H-05, WCAG 2.2 AA 2.5.8) : quand des zones de 44 px se chevaucheraient (points de pagination,
|
|
197
|
+
\xE9toiles, \xD7 d'\xE9tiquettes, lignes de cases, onglets serr\xE9s), la classe \xAB target-dense \xBB donne une zone d'au moins
|
|
198
|
+
24 px ; au pointeur grossier, elle revient \xE0 44 px (WC-D03). \xC0 poser \xE0 la place de \xAB target \xBB, sur le contr\xF4le. */
|
|
199
|
+
.target-dense {
|
|
200
|
+
position: relative;
|
|
201
|
+
isolation: isolate;
|
|
202
|
+
}
|
|
203
|
+
.target-dense::after {
|
|
204
|
+
content: '';
|
|
205
|
+
position: absolute;
|
|
206
|
+
z-index: -1;
|
|
207
|
+
inset-block: min(0px, calc((100% - 24px) / 2));
|
|
208
|
+
inset-inline: min(0px, calc((100% - 24px) / 2));
|
|
209
|
+
}
|
|
210
|
+
@media (pointer: coarse) {
|
|
211
|
+
.target-dense::after {
|
|
212
|
+
inset-block: min(0px, calc((100% - var(--target-touch-min)) / 2));
|
|
213
|
+
inset-inline: min(0px, calc((100% - var(--target-touch-min)) / 2));
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/* Transition pos\xE9e \xE0 l'arriv\xE9e du survol seulement : une bascule de th\xE8me ne s'anime pas, l'audit de contraste mesure l'\xE9tat final. */
|
|
217
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
218
|
+
button:hover:not(:disabled),
|
|
219
|
+
.control:hover:not(:disabled) {
|
|
220
|
+
transition:
|
|
221
|
+
background-color var(--duration-fast) var(--ease-standard),
|
|
222
|
+
border-color var(--duration-fast) var(--ease-standard);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
@media (prefers-contrast: more) {
|
|
226
|
+
button,
|
|
227
|
+
.control {
|
|
228
|
+
border-color: currentColor;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
@media (forced-colors: active) {
|
|
232
|
+
button,
|
|
233
|
+
input,
|
|
234
|
+
a {
|
|
235
|
+
border: 1px solid ButtonText;
|
|
236
|
+
}
|
|
237
|
+
:focus-visible {
|
|
238
|
+
outline-color: Highlight;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
/* Densit\xE9 confortable sur les appareils tactiles ; focus explicite, jamais supprim\xE9. */
|
|
242
|
+
@media (pointer: coarse) {
|
|
243
|
+
button,
|
|
244
|
+
.control,
|
|
245
|
+
select {
|
|
246
|
+
min-block-size: var(--target-touch-min);
|
|
247
|
+
}
|
|
248
|
+
input[type='checkbox'],
|
|
249
|
+
input[type='radio'] {
|
|
250
|
+
inline-size: 20px;
|
|
251
|
+
block-size: 20px;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
/* Boutons accol\xE9s : un seul contour continu, coins arrondis aux extr\xE9mit\xE9s, filets internes de 1 px partag\xE9s. */
|
|
255
|
+
:host {
|
|
256
|
+
display: inline-block;
|
|
257
|
+
max-inline-size: 100%;
|
|
258
|
+
}
|
|
259
|
+
:host([orientation=vertical]) {
|
|
260
|
+
min-inline-size: 0;
|
|
261
|
+
}
|
|
262
|
+
[part=base] {
|
|
263
|
+
display: inline-flex;
|
|
264
|
+
max-inline-size: 100%;
|
|
265
|
+
isolation: isolate;
|
|
266
|
+
vertical-align: top;
|
|
267
|
+
}
|
|
268
|
+
:host([orientation=vertical]) [part=base] {
|
|
269
|
+
flex-direction: column;
|
|
270
|
+
align-items: stretch;
|
|
271
|
+
}
|
|
272
|
+
.item,::slotted(button) {
|
|
273
|
+
position: relative;
|
|
274
|
+
flex: 0 1 auto;
|
|
275
|
+
min-inline-size: 0;
|
|
276
|
+
max-inline-size: 100%;
|
|
277
|
+
margin: 0;
|
|
278
|
+
min-block-size: var(--control-height, 30px);
|
|
279
|
+
padding: 0 10px;
|
|
280
|
+
border: 1px solid var(--bythium-border-subtle);
|
|
281
|
+
border-radius: 0;
|
|
282
|
+
background: var(--bythium-surface-raised);
|
|
283
|
+
color: var(--bythium-text-primary);
|
|
284
|
+
font: inherit;
|
|
285
|
+
font-size: 12px;
|
|
286
|
+
font-weight: 500;
|
|
287
|
+
line-height: 1.4;
|
|
288
|
+
letter-spacing: inherit;
|
|
289
|
+
white-space: nowrap;
|
|
290
|
+
overflow: hidden;
|
|
291
|
+
text-overflow: ellipsis;
|
|
292
|
+
cursor: pointer;
|
|
293
|
+
touch-action: manipulation;
|
|
294
|
+
user-select: none;
|
|
295
|
+
}
|
|
296
|
+
/* Filet interne : le bord de d\xE9but de chaque bouton suivant recouvre le bord de fin du pr\xE9c\xE9dent, d'un ton plus marqu\xE9. */
|
|
297
|
+
.item:not(:first-child),::slotted(button:not(:first-child)) {
|
|
298
|
+
margin-inline-start: -1px;
|
|
299
|
+
border-inline-start-color: color-mix(in oklch,var(--bythium-text-primary) 14%,var(--bythium-surface-raised));
|
|
300
|
+
}
|
|
301
|
+
.item:first-child,::slotted(button:first-child) {
|
|
302
|
+
border-start-start-radius: var(--radius-control);
|
|
303
|
+
border-end-start-radius: var(--radius-control);
|
|
304
|
+
}
|
|
305
|
+
.item:last-child,::slotted(button:last-child) {
|
|
306
|
+
border-start-end-radius: var(--radius-control);
|
|
307
|
+
border-end-end-radius: var(--radius-control);
|
|
308
|
+
}
|
|
309
|
+
:host([orientation=vertical]) .item,:host([orientation=vertical]) ::slotted(button) {
|
|
310
|
+
border-radius: 0;
|
|
311
|
+
text-align: center;
|
|
312
|
+
}
|
|
313
|
+
:host([orientation=vertical]) .item:not(:first-child),:host([orientation=vertical]) ::slotted(button:not(:first-child)) {
|
|
314
|
+
margin-inline-start: 0;
|
|
315
|
+
margin-block-start: -1px;
|
|
316
|
+
border-inline-start-color: var(--bythium-border-subtle);
|
|
317
|
+
border-block-start-color: color-mix(in oklch,var(--bythium-text-primary) 14%,var(--bythium-surface-raised));
|
|
318
|
+
}
|
|
319
|
+
:host([orientation=vertical]) .item:first-child,:host([orientation=vertical]) ::slotted(button:first-child) {
|
|
320
|
+
border-start-start-radius: var(--radius-control);
|
|
321
|
+
border-start-end-radius: var(--radius-control);
|
|
322
|
+
}
|
|
323
|
+
:host([orientation=vertical]) .item:last-child,:host([orientation=vertical]) ::slotted(button:last-child) {
|
|
324
|
+
border-end-start-radius: var(--radius-control);
|
|
325
|
+
border-end-end-radius: var(--radius-control);
|
|
326
|
+
}
|
|
327
|
+
.item:hover:not(:disabled),::slotted(button:hover:not(:disabled)) {
|
|
328
|
+
background: color-mix(in oklch,var(--bythium-text-primary) 8%,var(--bythium-surface-raised));
|
|
329
|
+
}
|
|
330
|
+
.item:active:not(:disabled),::slotted(button:active:not(:disabled)) {
|
|
331
|
+
background: color-mix(in oklch,var(--bythium-text-primary) 12%,var(--bythium-surface-raised));
|
|
332
|
+
}
|
|
333
|
+
/* Le focus passe au-dessus des voisins pour que l'anneau ne soit jamais rogn\xE9 par le bouton suivant. */
|
|
334
|
+
.item:focus-visible,::slotted(button:focus-visible) {
|
|
335
|
+
outline: 2px solid var(--bythium-border-focus);
|
|
336
|
+
outline-offset: 1px;
|
|
337
|
+
z-index: 1;
|
|
338
|
+
}
|
|
339
|
+
/* D\xE9sactiv\xE9 : texte att\xE9nu\xE9 encore lisible, sans opacit\xE9 sur le groupe. */
|
|
340
|
+
:host([disabled]) {
|
|
341
|
+
opacity: 1;
|
|
342
|
+
}
|
|
343
|
+
.item:disabled,::slotted(button:disabled),:host([disabled]) ::slotted(button) {
|
|
344
|
+
color: var(--bythium-text-muted);
|
|
345
|
+
cursor: not-allowed;
|
|
346
|
+
}
|
|
347
|
+
:host([size=sm]) .item,:host([size=sm]) ::slotted(button) {
|
|
348
|
+
min-block-size: 24px;
|
|
349
|
+
padding: 0 8px;
|
|
350
|
+
}
|
|
351
|
+
:host([size=lg]) .item,:host([size=lg]) ::slotted(button) {
|
|
352
|
+
min-block-size: 36px;
|
|
353
|
+
padding: 0 14px;
|
|
354
|
+
font-size: 13px;
|
|
355
|
+
}
|
|
356
|
+
@media (pointer:coarse) {
|
|
357
|
+
.item,::slotted(button),:host([size=sm]) .item,:host([size=sm]) ::slotted(button),:host([size=lg]) .item,:host([size=lg]) ::slotted(button) {
|
|
358
|
+
min-block-size: var(--target-touch-min);
|
|
359
|
+
min-inline-size: var(--target-touch-min);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
@media (forced-colors:active) {
|
|
363
|
+
.item,::slotted(button) {
|
|
364
|
+
border-color: ButtonText;
|
|
365
|
+
}
|
|
366
|
+
.item:disabled,::slotted(button:disabled) {
|
|
367
|
+
color: GrayText;
|
|
368
|
+
border-color: GrayText;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
372
|
+
.item:hover:not(:disabled),::slotted(button:hover:not(:disabled)) {
|
|
373
|
+
transition: background-color var(--duration-fast) var(--ease-standard);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
`;function l(t){if(!t.trim())return[];try{let e=JSON.parse(t);return Array.isArray(e)?e.filter(n=>!!n&&typeof n=="object"&&typeof n.label=="string"&&String(n.label).trim()!=="").map(n=>({value:String(n.value??n.label),label:String(n.label),disabled:n.disabled===!0})):[]}catch{return[]}}function m(t){let e=l(t.items),n=t.label.trim();return[a("div",{part:"base",role:"group","aria-label":n||null,"aria-disabled":t.disabled?"true":null,inert:t.disabled&&!e.length},e.length?e.map((i,s)=>a("button",{class:"item",type:"button","data-index":s,value:i.value,disabled:t.disabled||i.disabled},i.label)):a("slot"))]}var d=class extends u{static props=b;static css=p;static delegatesFocus=!0;constructor(){super(),this.addEventListener("click",e=>{if(!this.isConnectedElement||this.disabled)return;let n=e.composedPath().find(r=>r instanceof HTMLButtonElement);if(!n||n.disabled)return;if(this.root.contains(n)){let r=Number(n.dataset.index),o=l(this.items)[r];o&&!o.disabled&&this.emit("bythium-action",{value:o.value,label:o.label,index:r});return}if(n.parentElement!==this)return;let i=(n.textContent??"").trim().replace(/\s+/g," ")||n.getAttribute("aria-label")||"",s=[...this.children].filter(r=>r instanceof HTMLButtonElement).indexOf(n);this.emit("bythium-action",{value:n.getAttribute("value")??i,label:i,index:s})})}view(){return m(this.props)}};c("bythium-button-group",d);export{d as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function f(n){var l,t,e="";if(typeof n=="string"||typeof n=="number")e+=n;else if(typeof n=="object")if(Array.isArray(n)){var a=n.length;for(l=0;l<a;l++)n[l]&&(t=f(n[l]))&&(e&&(e+=" "),e+=t)}else for(t in n)n[t]&&(e&&(e+=" "),e+=t);return e}function m(){for(var n,l,t=0,e="",a=arguments.length;t<a;t++)(n=arguments[t])&&(l=f(n))&&(e&&(e+=" "),e+=l);return e}var y=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,x=m,O=(n,l)=>t=>{var e;if(l?.variants==null)return x(n,t?.class,t?.className);let{variants:a,defaultVariants:u}=l,V=Object.keys(a).map(r=>{let i=t?.[r],s=u?.[r];if(i===null)return null;let o=y(i)||y(s);return a[r][o]}),v=t&&Object.entries(t).reduce((r,i)=>{let[s,o]=i;return o===void 0||(r[s]=o),r},{}),N=l==null||(e=l.compoundVariants)===null||e===void 0?void 0:e.reduce((r,i)=>{let{class:s,className:o,...b}=i;return Object.entries(b).every(C=>{let[c,d]=C;return Array.isArray(d)?d.includes({...u,...v}[c]):{...u,...v}[c]===d})?[...r,s,o]:r},[]);return x(n,V,N,t?.class,t?.className)};export{O as a};
|