@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,436 @@
|
|
|
1
|
+
import{a as m}from"./chunk-5VNPX7DT.js";import{a,d as u,e as c}from"./chunk-W3ASGVKH.js";var b={label:{type:"string",default:"Action"},variant:{type:"string",default:"primary",enum:["primary","secondary"]},items:{type:"string",default:"[]"},open:{type:"boolean",default:!1},disabled:{type:"boolean",default:!1},"menu-label":{type:"string",default:"Autres actions"}},h=`/* 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
|
+
/* Bouton fractionn\xE9 : action principale et chevron accol\xE9s, un seul contour, filet interne ; menu en couche sup\xE9rieure. */
|
|
255
|
+
:host {
|
|
256
|
+
display: inline-block;
|
|
257
|
+
max-inline-size: 100%;
|
|
258
|
+
}
|
|
259
|
+
[part=base] {
|
|
260
|
+
display: inline-flex;
|
|
261
|
+
max-inline-size: 100%;
|
|
262
|
+
isolation: isolate;
|
|
263
|
+
vertical-align: top;
|
|
264
|
+
anchor-name: --bythium-split-button;
|
|
265
|
+
}
|
|
266
|
+
[part=main],[part=toggle] {
|
|
267
|
+
position: relative;
|
|
268
|
+
display: inline-flex;
|
|
269
|
+
align-items: center;
|
|
270
|
+
justify-content: center;
|
|
271
|
+
margin: 0;
|
|
272
|
+
line-height: 1.4;
|
|
273
|
+
white-space: nowrap;
|
|
274
|
+
user-select: none;
|
|
275
|
+
}
|
|
276
|
+
[part=main] {
|
|
277
|
+
flex: 0 1 auto;
|
|
278
|
+
min-inline-size: 0;
|
|
279
|
+
padding: 0 12px;
|
|
280
|
+
border-start-end-radius: 0;
|
|
281
|
+
border-end-end-radius: 0;
|
|
282
|
+
}
|
|
283
|
+
[part=base][data-single] [part=main] {
|
|
284
|
+
border-radius: var(--radius-control);
|
|
285
|
+
}
|
|
286
|
+
.text {
|
|
287
|
+
display: block;
|
|
288
|
+
min-inline-size: 0;
|
|
289
|
+
overflow: hidden;
|
|
290
|
+
text-overflow: ellipsis;
|
|
291
|
+
}
|
|
292
|
+
[part=toggle] {
|
|
293
|
+
flex: none;
|
|
294
|
+
inline-size: 28px;
|
|
295
|
+
padding: 0;
|
|
296
|
+
margin-inline-start: -1px;
|
|
297
|
+
border-start-start-radius: 0;
|
|
298
|
+
border-end-start-radius: 0;
|
|
299
|
+
}
|
|
300
|
+
[part=toggle][hidden] {
|
|
301
|
+
display: none;
|
|
302
|
+
}
|
|
303
|
+
/* Cible de 44 px du chevron : elle s'\xE9tend vers l'ext\xE9rieur seulement, jamais sur l'action principale voisine. */
|
|
304
|
+
[part=toggle].target::after {
|
|
305
|
+
inset-inline-start: 0;
|
|
306
|
+
inset-inline-end: min(0px, calc(100% - var(--target-touch-min)));
|
|
307
|
+
}
|
|
308
|
+
[part=toggle]:not(.primary) {
|
|
309
|
+
border-inline-start-color: color-mix(in oklch,var(--bythium-text-primary) 14%,var(--bythium-surface-raised));
|
|
310
|
+
}
|
|
311
|
+
[part=toggle].primary {
|
|
312
|
+
border-inline-start-color: color-mix(in oklch,var(--bythium-on-brand-primary) 32%,var(--bythium-brand-primary));
|
|
313
|
+
}
|
|
314
|
+
.primary:hover:not(:disabled),.primary:active:not(:disabled) {
|
|
315
|
+
background: var(--bythium-brand-primary-hover);
|
|
316
|
+
}
|
|
317
|
+
[part=main].primary:hover:not(:disabled) {
|
|
318
|
+
border-color: var(--bythium-brand-primary-hover);
|
|
319
|
+
}
|
|
320
|
+
[part=toggle].primary:hover:not(:disabled) {
|
|
321
|
+
border-block-color: var(--bythium-brand-primary-hover);
|
|
322
|
+
border-inline-end-color: var(--bythium-brand-primary-hover);
|
|
323
|
+
}
|
|
324
|
+
[part=toggle][aria-expanded=true]:not(.primary) {
|
|
325
|
+
background: color-mix(in oklch,var(--bythium-text-primary) 12%,var(--bythium-surface-raised));
|
|
326
|
+
}
|
|
327
|
+
[part=toggle][aria-expanded=true].primary {
|
|
328
|
+
background: var(--bythium-brand-primary-hover);
|
|
329
|
+
}
|
|
330
|
+
[part=toggle][aria-expanded=true] svg {
|
|
331
|
+
transform: rotate(180deg);
|
|
332
|
+
}
|
|
333
|
+
[part=main]:focus-visible,[part=toggle]:focus-visible {
|
|
334
|
+
z-index: 1;
|
|
335
|
+
}
|
|
336
|
+
:host([disabled]) {
|
|
337
|
+
opacity: 1;
|
|
338
|
+
}
|
|
339
|
+
[part=main]:disabled,[part=toggle]:disabled {
|
|
340
|
+
background: var(--bythium-surface-raised);
|
|
341
|
+
color: var(--bythium-text-muted);
|
|
342
|
+
border-color: var(--bythium-border-subtle);
|
|
343
|
+
box-shadow: none;
|
|
344
|
+
}
|
|
345
|
+
[part=menu] {
|
|
346
|
+
position: fixed;
|
|
347
|
+
inset: auto;
|
|
348
|
+
margin: 0;
|
|
349
|
+
inline-size: max-content;
|
|
350
|
+
min-inline-size: 180px;
|
|
351
|
+
max-inline-size: min(320px,calc(100vw - 16px));
|
|
352
|
+
max-block-size: min(320px,calc(100vh - 16px));
|
|
353
|
+
overflow: auto;
|
|
354
|
+
padding: 4px;
|
|
355
|
+
border: 1px solid var(--bythium-border-subtle);
|
|
356
|
+
border-radius: var(--radius-card);
|
|
357
|
+
background: var(--bythium-surface-overlay);
|
|
358
|
+
color: var(--bythium-text-primary);
|
|
359
|
+
box-shadow: var(--shadow-overlay);
|
|
360
|
+
}
|
|
361
|
+
[part=menu]:popover-open {
|
|
362
|
+
display: grid;
|
|
363
|
+
gap: 0;
|
|
364
|
+
}
|
|
365
|
+
@supports (position-anchor:--bythium-split-button) {
|
|
366
|
+
[part=menu] {
|
|
367
|
+
position-anchor: --bythium-split-button;
|
|
368
|
+
inset-block-start: anchor(bottom);
|
|
369
|
+
inset-inline-start: anchor(start);
|
|
370
|
+
margin-block: 4px;
|
|
371
|
+
margin-inline: 0;
|
|
372
|
+
min-inline-size: max(180px,anchor-size(width));
|
|
373
|
+
position-try-fallbacks: flip-inline,--bythium-split-button-pinned,flip-block,flip-block flip-inline;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
@position-try --bythium-split-button-pinned {
|
|
377
|
+
inset-inline-start: 8px;
|
|
378
|
+
inset-inline-end: auto;
|
|
379
|
+
}
|
|
380
|
+
[part=item] {
|
|
381
|
+
display: flex;
|
|
382
|
+
align-items: center;
|
|
383
|
+
inline-size: 100%;
|
|
384
|
+
min-block-size: 28px;
|
|
385
|
+
padding: 4px 8px;
|
|
386
|
+
border: 0;
|
|
387
|
+
border-radius: var(--radius-sm);
|
|
388
|
+
background: transparent;
|
|
389
|
+
color: var(--bythium-text-primary);
|
|
390
|
+
font-size: 13px;
|
|
391
|
+
font-weight: 400;
|
|
392
|
+
line-height: 20px;
|
|
393
|
+
text-align: start;
|
|
394
|
+
overflow-wrap: anywhere;
|
|
395
|
+
}
|
|
396
|
+
[part=item]:hover:not([aria-disabled=true]),[part=item]:focus-visible {
|
|
397
|
+
background: var(--bythium-state-hover);
|
|
398
|
+
}
|
|
399
|
+
[part=item]:active:not([aria-disabled=true]) {
|
|
400
|
+
background: var(--bythium-state-selected);
|
|
401
|
+
}
|
|
402
|
+
[part=item]:focus-visible {
|
|
403
|
+
outline-offset: -2px;
|
|
404
|
+
}
|
|
405
|
+
[part=item][aria-disabled=true] {
|
|
406
|
+
color: var(--bythium-text-muted);
|
|
407
|
+
cursor: not-allowed;
|
|
408
|
+
}
|
|
409
|
+
[part=item][aria-disabled=true]:hover {
|
|
410
|
+
background: transparent;
|
|
411
|
+
}
|
|
412
|
+
@media (pointer:coarse) {
|
|
413
|
+
[part=toggle] {
|
|
414
|
+
inline-size: 44px;
|
|
415
|
+
}
|
|
416
|
+
[part=item] {
|
|
417
|
+
min-block-size: 44px;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
@media (forced-colors:active) {
|
|
421
|
+
[part=menu] {
|
|
422
|
+
border-color: CanvasText;
|
|
423
|
+
}
|
|
424
|
+
[part=toggle][aria-expanded=true] {
|
|
425
|
+
border-color: Highlight;
|
|
426
|
+
}
|
|
427
|
+
[part=item][aria-disabled=true] {
|
|
428
|
+
color: GrayText;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
432
|
+
[part=toggle] svg {
|
|
433
|
+
transition: transform var(--duration-fast) var(--ease-standard);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
`;var y={variants:{variant:{primary:"primary",secondary:"secondary"}},defaultVariants:{variant:"primary"}},g=m("target",y);function l(t){if(!t.trim())return[];try{let n=JSON.parse(t);return Array.isArray(n)?n.filter(e=>!!e&&typeof e=="object"&&typeof e.label=="string"&&String(e.label).trim()!=="").map(e=>({value:String(e.value??e.label),label:String(e.label),disabled:e.disabled===!0})):[]}catch{return[]}}function x(){return a("svg",{viewBox:"0 0 16 16",width:12,height:12,fill:"none",stroke:"currentColor","stroke-width":1.5,"stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",focusable:"false"},a("path",{d:"M4 6l4 4 4-4"}))}function f(t){let n=l(t.items),e=n.length===0,i=g({variant:t.variant}),r=t.open&&!t.disabled&&!e;return[a("div",{part:"base","data-variant":t.variant,"data-single":e},a("button",{part:"main",type:"button",class:i,disabled:t.disabled},a("span",{class:"text"},t.label)),a("button",{part:"toggle",type:"button",class:i,"aria-haspopup":"menu","aria-expanded":String(r),"aria-controls":"menu","aria-label":`${t.menuLabel} : ${t.label}`,disabled:t.disabled||e,hidden:e},x()),a("div",{part:"menu",id:"menu",role:"menu",popover:"manual","aria-label":t.menuLabel},n.map((o,s)=>a("button",{part:"item",type:"button",role:"menuitem",tabindex:-1,"data-index":s,"aria-disabled":o.disabled?"true":null},o.label))))]}function v(t){return t.trim().charAt(0).normalize("NFD").charAt(0).toLocaleLowerCase("fr")}var d=class extends u{static props=b;static css=h;static delegatesFocus=!0;constructor(){super(),this.root.addEventListener("click",n=>this.#s(n)),this.root.addEventListener("keydown",n=>this.#l(n)),this.root.addEventListener("focusout",n=>{let e=n.relatedTarget;this.open&&e instanceof Node&&!this.root.contains(e)&&this.#n(!1)})}get menu(){return this.root.querySelector("[part=menu]")}get toggleButton(){return this.root.querySelector("[part=toggle]")}get options(){return[...this.root.querySelectorAll("[part=item]")]}view(){return f(this.props)}updated(){this.#a()}connected(){let n=this.signal;document.addEventListener("pointerdown",this.#o,{signal:n}),window.addEventListener("resize",this.#t,{signal:n}),document.addEventListener("scroll",this.#t,{capture:!0,passive:!0,signal:n})}#o=n=>{this.open&&!n.composedPath().includes(this)&&this.#n(!1)};#t=()=>{this.open&&this.#i()};#a(){let n=this.menu;if(!n)return;let e=this.open&&!this.disabled&&this.options.length>0;try{e!==n.matches(":popover-open")&&(e?n.showPopover():n.hidePopover())}catch{}e&&this.#i()}#i(){let n=this.menu,e=this.root.querySelector("[part=base]");if(!n||!e||typeof CSS<"u"&&CSS.supports("position-anchor","--bythium-split-button"))return;let i=e.getBoundingClientRect();n.style.setProperty("min-inline-size",`${i.width}px`);let r=n.getBoundingClientRect();n.style.setProperty("left",`${Math.max(8,Math.min(i.left,window.innerWidth-r.width-8))}px`);let o=i.bottom+4+r.height>window.innerHeight&&i.top-4-r.height>0;n.style.setProperty("top",`${o?i.top-4-r.height:i.bottom+4}px`)}#e(n){let e=this.options;e.length&&e[(n+e.length)%e.length]?.focus()}#r(n){this.disabled||!this.options.length||(this.open=!0,this.#e(n==="first"?0:-1))}#n(n){this.open&&(this.open=!1,n&&this.toggleButton?.focus())}#s(n){let e=n.target;if(e.closest("[part=main]")){this.disabled||this.emit("bythium-action",{source:"main"});return}if(e.closest("[part=toggle]")){this.open?this.#n(!0):this.#r("first");return}let i=e.closest("[part=item]");if(!i)return;let r=Number(i.dataset.index),o=l(this.items)[r];!o||o.disabled||(this.emit("bythium-select",{value:o.value,label:o.label,index:r}),this.#n(!0))}#l(n){let e=n.target;if(e.closest("[part=toggle]")&&(n.key==="ArrowDown"||n.key==="ArrowUp")){n.preventDefault(),this.#r(n.key==="ArrowDown"?"first":"last");return}if(!this.open)return;if(n.key==="Escape"){n.preventDefault(),n.stopPropagation(),this.#n(!0);return}let i=this.options,r=i.indexOf(e.closest("[part=item]"));if(!(r<0)){if(n.key==="Tab"){this.#n(!1);return}if(n.key==="ArrowDown")n.preventDefault(),this.#e(r+1);else if(n.key==="ArrowUp")n.preventDefault(),this.#e(r-1);else if(n.key==="Home")n.preventDefault(),this.#e(0);else if(n.key==="End")n.preventDefault(),this.#e(-1);else if(n.key.length===1&&n.key.trim()&&!n.ctrlKey&&!n.metaKey&&!n.altKey){let o=v(n.key);for(let s=1;s<=i.length;s++){let p=i[(r+s)%i.length];if(v(p.textContent??"")===o){n.preventDefault(),p.focus();break}}}}}};c("bythium-split-button",d);export{d as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function i(e){return typeof e=="string"&&/^en(-|$)/i.test(e.trim())?"en":"fr"}function o(e,n){return e[i(n)]}function l(e,n){return e.replace(/\{(\w+)\}/g,(r,t)=>Object.hasOwn(n,t)?String(n[t]):"")}function u(e,n="fr-CA"){let r=i(e)==="en"?"en-CA":n,t=(e??"").trim();if(!/^(fr|en)(-|$)/i.test(t))return r;try{let[s]=Intl.getCanonicalLocales(t);return s!==void 0&&Intl.NumberFormat.supportedLocalesOf(s).length>0?s:r}catch{return r}}export{o as a,l as b,u as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as d}from"./chunk-W3ASGVKH.js";var a="hint";function f(n){let t=n.trim();return t?d("span",{part:"hint",id:a,role:"tooltip",popover:"manual"},t):null}var u=(n,t="")=>n.trim()&&n.trim()!==t.trim()?a:null;function m(n,t){let r=!1,s=!1,i=!1,l=()=>t.getElementById(a),o=()=>{let e=l();if(!e||typeof e.showPopover!="function")return;let p=(r||s)&&!i&&n.isConnected;p!==e.matches(":popover-open")&&(p?e.showPopover():e.hidePopover())};return n.addEventListener("pointerenter",e=>{e.pointerType!=="touch"&&(r=!0,o())}),n.addEventListener("pointerleave",()=>{r=!1,i=!1,o()}),t.addEventListener("focusin",e=>{s=e.target?.matches?.(":focus-visible")??!1,o()}),t.addEventListener("focusout",()=>{s=!1,i=!1,o()}),t.addEventListener("keydown",e=>{e.key!=="Escape"||!l()?.matches(":popover-open")||(i=!0,o())}),{close(){r=!1,s=!1,l()?.matches(":popover-open")&&l()?.hidePopover()}}}export{f as a,u as b,m as c};
|