@tangible/ui 0.0.17 → 0.0.19
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 +31 -1
- package/components/Popover/Popover.d.ts +21 -0
- package/components/Popover/Popover.js +148 -0
- package/components/Popover/PopoverContext.d.ts +3 -0
- package/components/Popover/PopoverContext.js +9 -0
- package/components/Popover/index.d.ts +2 -0
- package/components/Popover/index.js +1 -0
- package/components/Popover/types.d.ts +83 -0
- package/components/Popover/types.js +11 -0
- package/components/index.d.ts +2 -0
- package/components/index.js +1 -0
- package/package.json +7 -1
- package/styles/all.css +1 -1
- package/styles/all.expanded.css +35 -0
- package/styles/all.expanded.unlayered.css +35 -0
- package/styles/all.unlayered.css +1 -1
- package/styles/components/_bundle.scss +98 -69
- package/styles/components/accordion.scss +289 -0
- package/styles/components/avatar.scss +346 -0
- package/styles/components/button.scss +468 -0
- package/styles/components/card.scss +261 -0
- package/styles/components/checkbox.scss +184 -0
- package/styles/components/chip-group.scss +49 -0
- package/styles/components/chip.scss +472 -0
- package/styles/components/combobox.scss +378 -0
- package/styles/components/content-indicator.scss +114 -0
- package/styles/components/dropdown.scss +179 -0
- package/styles/components/field.scss +120 -0
- package/styles/components/icon-button.scss +311 -0
- package/styles/components/icon.scss +42 -0
- package/styles/components/modal.scss +312 -0
- package/styles/components/move-handle.scss +383 -0
- package/styles/components/multi-select.scss +449 -0
- package/styles/components/notice.scss +430 -0
- package/styles/components/overlap-stack.scss +81 -0
- package/styles/components/pager.scss +83 -0
- package/styles/components/popover.scss +70 -0
- package/styles/components/progress.scss +391 -0
- package/styles/components/radio.scss +259 -0
- package/styles/components/rating.scss +142 -0
- package/styles/components/segmented-control.scss +285 -0
- package/styles/components/select.scss +386 -0
- package/styles/components/sidebar.scss +240 -0
- package/styles/components/step-indicator.scss +118 -0
- package/styles/components/step-list.scss +130 -0
- package/styles/components/switch.scss +229 -0
- package/styles/components/table.scss +139 -0
- package/styles/components/tabs.scss +297 -0
- package/styles/components/text-input.scss +142 -0
- package/styles/components/textarea.scss +35 -0
- package/styles/components/toolbar.scss +62 -0
- package/styles/components/tooltip.scss +102 -0
- package/styles/core.css +1 -0
- package/styles/core.scss +12 -0
- package/styles/core.unlayered.css +1 -0
- package/styles/index.scss +29 -4
- package/tui-manifest.json +41 -2
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
@use "../system" as sys;
|
|
2
|
+
|
|
3
|
+
/* @tui-tokens
|
|
4
|
+
--tui-progress-track
|
|
5
|
+
--tui-progress-fill
|
|
6
|
+
--tui-progress-label
|
|
7
|
+
--tui-progress-radius
|
|
8
|
+
--tui-progress-z1-fill
|
|
9
|
+
--tui-progress-z2-fill
|
|
10
|
+
--tui-progress-z3-fill
|
|
11
|
+
--tui-progress-z4-fill
|
|
12
|
+
--tui-progress-z5-fill
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
@mixin styles() {
|
|
16
|
+
// ==========================================================================
|
|
17
|
+
// Progress Component
|
|
18
|
+
// ==========================================================================
|
|
19
|
+
//
|
|
20
|
+
// Component API tokens (never defined here, only read via fallback):
|
|
21
|
+
// --tui-progress-track Track/background color
|
|
22
|
+
// --tui-progress-fill Fill/bar color
|
|
23
|
+
// --tui-progress-label Label text color
|
|
24
|
+
// --tui-progress-radius Border radius
|
|
25
|
+
//
|
|
26
|
+
// Segmented mode adds:
|
|
27
|
+
// --tui-progress-z1-fill Segment 1 color (default: primary)
|
|
28
|
+
// --tui-progress-z2-fill Segment 2 color (default: warning)
|
|
29
|
+
// --tui-progress-z3-fill Segment 3 color (default: success)
|
|
30
|
+
// --tui-progress-z4-fill Segment 4 color (default: danger)
|
|
31
|
+
// --tui-progress-z5-fill Segment 5 color (default: info)
|
|
32
|
+
//
|
|
33
|
+
// To override from consuming code:
|
|
34
|
+
// .my-context .tui-progress { --tui-progress-fill: hotpink; }
|
|
35
|
+
//
|
|
36
|
+
// ==========================================================================
|
|
37
|
+
|
|
38
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}progress {
|
|
39
|
+
// Internal tokens — read component API with fallback to primitives
|
|
40
|
+
--_track: var(--#{sys.$prefix}progress-track, var(--#{sys.$prefix}color-border));
|
|
41
|
+
--_fill: var(--#{sys.$prefix}progress-fill, var(--#{sys.$prefix}theme-primary-base));
|
|
42
|
+
--_label: var(--#{sys.$prefix}progress-label, var(--#{sys.$prefix}color-fg));
|
|
43
|
+
--_radius: var(--#{sys.$prefix}progress-radius, var(--#{sys.$prefix}radius-md));
|
|
44
|
+
|
|
45
|
+
// Runtime vars (set by component)
|
|
46
|
+
--#{sys.$prefix}progress-value: 0;
|
|
47
|
+
--#{sys.$prefix}progress-max: 100;
|
|
48
|
+
--_pct: calc((var(--#{sys.$prefix}progress-value) / var(--#{sys.$prefix}progress-max)) * 100);
|
|
49
|
+
|
|
50
|
+
color: var(--_label);
|
|
51
|
+
|
|
52
|
+
// -------------------------------------------------------------------------
|
|
53
|
+
// Sizes
|
|
54
|
+
// -------------------------------------------------------------------------
|
|
55
|
+
&.is-size-xs {
|
|
56
|
+
font-size: var(--#{sys.$prefix}typography-size-xs);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&.is-size-sm {
|
|
60
|
+
font-size: var(--#{sys.$prefix}typography-size-sm);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&.is-size-md {
|
|
64
|
+
font-size: var(--#{sys.$prefix}typography-size-md);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&.is-size-lg {
|
|
68
|
+
font-size: var(--#{sys.$prefix}typography-size-lg);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// -------------------------------------------------------------------------
|
|
72
|
+
// Line mode
|
|
73
|
+
// -------------------------------------------------------------------------
|
|
74
|
+
&.is-mode-line {
|
|
75
|
+
.#{sys.$prefix}progress__track {
|
|
76
|
+
position: relative;
|
|
77
|
+
inline-size: 100%;
|
|
78
|
+
block-size: 1em;
|
|
79
|
+
background: var(--_track) !important;
|
|
80
|
+
border-radius: var(--_radius);
|
|
81
|
+
overflow: clip;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.#{sys.$prefix}progress__bar {
|
|
85
|
+
block-size: 100%;
|
|
86
|
+
inline-size: calc(var(--_pct) * 1%);
|
|
87
|
+
background: var(--_fill) !important;
|
|
88
|
+
border-radius: var(--_radius);
|
|
89
|
+
transition: inline-size var(--#{sys.$prefix}motion-duration) var(--#{sys.$prefix}motion-timing);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Inside label follows the bar's head
|
|
93
|
+
.#{sys.$prefix}progress__label-wrapper {
|
|
94
|
+
position: absolute;
|
|
95
|
+
font-size: 1em;
|
|
96
|
+
line-height: 1;
|
|
97
|
+
inset: 0;
|
|
98
|
+
display: grid;
|
|
99
|
+
grid-template-columns: 1fr minmax(max-content, calc(100% - (var(--_pct) * 1%)));
|
|
100
|
+
transition: grid-template-columns var(--#{sys.$prefix}motion-duration) var(--#{sys.$prefix}motion-timing);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.#{sys.$prefix}progress__label.is-inside {
|
|
104
|
+
pointer-events: none;
|
|
105
|
+
min-width: max-content;
|
|
106
|
+
font-weight: bold;
|
|
107
|
+
background: color-mix(in oklab, var(--_track) 50%, transparent);
|
|
108
|
+
border-radius: var(--_radius);
|
|
109
|
+
padding-inline: 0.5em;
|
|
110
|
+
grid-column: 2;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// -------------------------------------------------------------------------
|
|
115
|
+
// Circle mode
|
|
116
|
+
// -------------------------------------------------------------------------
|
|
117
|
+
&.is-mode-circle {
|
|
118
|
+
.#{sys.$prefix}progress__circle {
|
|
119
|
+
position: relative;
|
|
120
|
+
inline-size: 2em;
|
|
121
|
+
|
|
122
|
+
&__bar {
|
|
123
|
+
aspect-ratio: 1;
|
|
124
|
+
background:
|
|
125
|
+
conic-gradient(
|
|
126
|
+
var(--_fill) calc(var(--_pct) * 1%),
|
|
127
|
+
var(--_track) 0
|
|
128
|
+
) !important;
|
|
129
|
+
|
|
130
|
+
// Hollow centre with mask
|
|
131
|
+
-webkit-mask: radial-gradient(closest-side, transparent 78%, #000 0);
|
|
132
|
+
mask: radial-gradient(closest-side, transparent 78%, #000 0);
|
|
133
|
+
border-radius: 50%;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.#{sys.$prefix}progress__label.is-inside {
|
|
138
|
+
position: absolute;
|
|
139
|
+
inset: 0;
|
|
140
|
+
display: grid;
|
|
141
|
+
place-items: center;
|
|
142
|
+
font-size: 0.5em;
|
|
143
|
+
font-weight: bold;
|
|
144
|
+
pointer-events: none;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// -------------------------------------------------------------------------
|
|
149
|
+
// Circle mode: solid variant (no hollow centre)
|
|
150
|
+
// -------------------------------------------------------------------------
|
|
151
|
+
&.is-mode-circle.is-variant-solid {
|
|
152
|
+
.#{sys.$prefix}progress__circle__bar {
|
|
153
|
+
-webkit-mask: none;
|
|
154
|
+
mask: none;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// -------------------------------------------------------------------------
|
|
159
|
+
// Label styles (shared)
|
|
160
|
+
// -------------------------------------------------------------------------
|
|
161
|
+
.#{sys.$prefix}progress__label {
|
|
162
|
+
font-weight: 600;
|
|
163
|
+
white-space: nowrap;
|
|
164
|
+
|
|
165
|
+
&.is-end {
|
|
166
|
+
color: var(--#{sys.$prefix}color-fg-muted);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// -------------------------------------------------------------------------
|
|
171
|
+
// Label position: above / below (row of labels)
|
|
172
|
+
// -------------------------------------------------------------------------
|
|
173
|
+
.#{sys.$prefix}progress__labels {
|
|
174
|
+
display: flex;
|
|
175
|
+
justify-content: space-between;
|
|
176
|
+
align-items: baseline;
|
|
177
|
+
gap: var(--#{sys.$prefix}spacing-md);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
&.is-label-above .#{sys.$prefix}progress__labels {
|
|
181
|
+
margin-block-end: var(--#{sys.$prefix}spacing-xs);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
&.is-label-below .#{sys.$prefix}progress__labels {
|
|
185
|
+
margin-block-start: var(--#{sys.$prefix}spacing-xs);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// -------------------------------------------------------------------------
|
|
189
|
+
// Label position: inline (labels beside bar)
|
|
190
|
+
// -------------------------------------------------------------------------
|
|
191
|
+
.#{sys.$prefix}progress__inline {
|
|
192
|
+
display: flex;
|
|
193
|
+
align-items: center;
|
|
194
|
+
gap: var(--#{sys.$prefix}spacing-xs);
|
|
195
|
+
|
|
196
|
+
.#{sys.$prefix}progress__track {
|
|
197
|
+
flex: 1;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// -------------------------------------------------------------------------
|
|
202
|
+
// Segmented mode (z1, z2, z3...)
|
|
203
|
+
// -------------------------------------------------------------------------
|
|
204
|
+
&.is-segmented {
|
|
205
|
+
// Segment color defaults (customizable via component API)
|
|
206
|
+
--_z1: var(--#{sys.$prefix}progress-z1-fill, var(--#{sys.$prefix}theme-primary-base));
|
|
207
|
+
--_z2: var(--#{sys.$prefix}progress-z2-fill, var(--#{sys.$prefix}theme-warning-base));
|
|
208
|
+
--_z3: var(--#{sys.$prefix}progress-z3-fill, var(--#{sys.$prefix}theme-success-base));
|
|
209
|
+
--_z4: var(--#{sys.$prefix}progress-z4-fill, var(--#{sys.$prefix}theme-danger-base));
|
|
210
|
+
--_z5: var(--#{sys.$prefix}progress-z5-fill, var(--#{sys.$prefix}theme-info-base));
|
|
211
|
+
|
|
212
|
+
&.is-mode-line {
|
|
213
|
+
.#{sys.$prefix}progress__track {
|
|
214
|
+
display: flex;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.#{sys.$prefix}progress__bar {
|
|
218
|
+
flex-shrink: 0;
|
|
219
|
+
block-size: 100%;
|
|
220
|
+
inline-size: var(--tui-segment-width);
|
|
221
|
+
transition: inline-size var(--#{sys.$prefix}motion-duration) var(--#{sys.$prefix}motion-timing);
|
|
222
|
+
|
|
223
|
+
// First segment: left radius only
|
|
224
|
+
&:first-child {
|
|
225
|
+
border-radius: var(--_radius) 0 0 var(--_radius);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// Middle segments: no radius
|
|
229
|
+
&:not(:first-child):not(:last-child) {
|
|
230
|
+
border-radius: 0;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// Last segment: right radius only
|
|
234
|
+
&:last-child {
|
|
235
|
+
border-radius: 0 var(--_radius) var(--_radius) 0;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// Only segment: full radius
|
|
239
|
+
&:only-child {
|
|
240
|
+
border-radius: var(--_radius);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Segment colors
|
|
244
|
+
&.is-z1 {
|
|
245
|
+
background: var(--_z1) !important;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
&.is-z2 {
|
|
249
|
+
background: var(--_z2) !important;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
&.is-z3 {
|
|
253
|
+
background: var(--_z3) !important;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
&.is-z4 {
|
|
257
|
+
background: var(--_z4) !important;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
&.is-z5 {
|
|
261
|
+
background: var(--_z5) !important;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// Segment labels below the bar
|
|
267
|
+
.#{sys.$prefix}progress__segment-labels {
|
|
268
|
+
display: flex;
|
|
269
|
+
gap: var(--#{sys.$prefix}spacing-md);
|
|
270
|
+
margin-block-start: var(--#{sys.$prefix}spacing-xs);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.#{sys.$prefix}progress__segment-label {
|
|
274
|
+
display: inline-flex;
|
|
275
|
+
gap: 0.35em;
|
|
276
|
+
font-weight: 600;
|
|
277
|
+
|
|
278
|
+
&.is-z1 {
|
|
279
|
+
color: var(--_z1);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
&.is-z2 {
|
|
283
|
+
color: var(--_z2);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
&.is-z3 {
|
|
287
|
+
color: var(--_z3);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
&.is-z4 {
|
|
291
|
+
color: var(--_z4);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
&.is-z5 {
|
|
295
|
+
color: var(--_z5);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.#{sys.$prefix}progress__segment-label-text {
|
|
300
|
+
font-weight: 600;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.#{sys.$prefix}progress__segment-label-value {
|
|
304
|
+
font-weight: 600;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// -------------------------------------------------------------------------
|
|
309
|
+
// Indeterminate state
|
|
310
|
+
// -------------------------------------------------------------------------
|
|
311
|
+
&.is-indeterminate {
|
|
312
|
+
&.is-mode-line .#{sys.$prefix}progress__bar {
|
|
313
|
+
animation: #{sys.$prefix}progress-indeterminate 2s ease-in-out infinite backwards;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
&.is-mode-circle .#{sys.$prefix}progress__circle__bar {
|
|
317
|
+
animation: #{sys.$prefix}progress-spin 1s linear infinite;
|
|
318
|
+
background:
|
|
319
|
+
conic-gradient(var(--_fill) 25%, var(--_track) 0) !important;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
@media (prefers-reduced-motion: reduce) {
|
|
324
|
+
&.is-indeterminate {
|
|
325
|
+
&.is-mode-line .#{sys.$prefix}progress__bar {
|
|
326
|
+
animation: none;
|
|
327
|
+
inline-size: 50%;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
&.is-mode-circle .#{sys.$prefix}progress__circle__bar {
|
|
331
|
+
animation: none;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.#{sys.$prefix}progress__bar {
|
|
336
|
+
transition: none;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
@keyframes #{sys.$prefix}progress-indeterminate {
|
|
342
|
+
0% {
|
|
343
|
+
inline-size: 25%;
|
|
344
|
+
transform: translateX(-100%);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
30% {
|
|
348
|
+
inline-size: 60%;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
100% {
|
|
352
|
+
inline-size: 25%;
|
|
353
|
+
transform: translateX(420%);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
@keyframes #{sys.$prefix}progress-spin {
|
|
358
|
+
to {
|
|
359
|
+
transform: rotate(1turn);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// ---------------------------------------------------------------------------
|
|
364
|
+
// Forced colors (Windows High Contrast Mode)
|
|
365
|
+
// ---------------------------------------------------------------------------
|
|
366
|
+
|
|
367
|
+
@media (forced-colors: active) {
|
|
368
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}progress {
|
|
369
|
+
&.is-mode-line .#{sys.$prefix}progress__track {
|
|
370
|
+
forced-color-adjust: none;
|
|
371
|
+
background: Canvas !important;
|
|
372
|
+
border: 1px solid CanvasText;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
&.is-mode-line .#{sys.$prefix}progress__bar {
|
|
376
|
+
background: Highlight !important;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
&.is-mode-circle .#{sys.$prefix}progress__circle__bar {
|
|
380
|
+
forced-color-adjust: none;
|
|
381
|
+
background:
|
|
382
|
+
conic-gradient(
|
|
383
|
+
Highlight calc(var(--_pct) * 1%),
|
|
384
|
+
Canvas 0
|
|
385
|
+
) !important;
|
|
386
|
+
border: 1px solid CanvasText;
|
|
387
|
+
border-radius: 50%;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
@use "../system" as sys;
|
|
2
|
+
|
|
3
|
+
/* @tui-tokens
|
|
4
|
+
--tui-radio-accent
|
|
5
|
+
--tui-radio-size
|
|
6
|
+
--tui-radio-border
|
|
7
|
+
--tui-radio-bg
|
|
8
|
+
--tui-radio-gap
|
|
9
|
+
--tui-radio-font-size
|
|
10
|
+
--tui-radio-label-color
|
|
11
|
+
--tui-radio-description-color
|
|
12
|
+
--tui-radio-group-gap
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
@mixin styles() {
|
|
16
|
+
// ==========================================================================
|
|
17
|
+
// RadioGroup + Radio Components
|
|
18
|
+
// ==========================================================================
|
|
19
|
+
//
|
|
20
|
+
// Component API tokens (never defined here, only read via fallback):
|
|
21
|
+
// --tui-radio-accent Accent color for selected state
|
|
22
|
+
// --tui-radio-size Indicator size (falls back to 1.15em)
|
|
23
|
+
// --tui-radio-border Indicator border color (unchecked)
|
|
24
|
+
// --tui-radio-bg Indicator background color
|
|
25
|
+
// --tui-radio-gap Gap between indicator and label
|
|
26
|
+
// --tui-radio-font-size Font size for label + description base
|
|
27
|
+
// --tui-radio-label-color Label text color
|
|
28
|
+
// --tui-radio-description-color Description text color
|
|
29
|
+
// --tui-radio-group-gap Gap between items in the group
|
|
30
|
+
//
|
|
31
|
+
// ==========================================================================
|
|
32
|
+
|
|
33
|
+
// Structural constants
|
|
34
|
+
$_dot-ratio: 0.435; // dot is ~43.5% of indicator
|
|
35
|
+
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
// RadioGroup wrapper
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}radio-group {
|
|
40
|
+
--_group-gap: var(--#{sys.$prefix}radio-group-gap, var(--#{sys.$prefix}spacing-xs));
|
|
41
|
+
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
gap: var(--_group-gap);
|
|
45
|
+
|
|
46
|
+
&.is-horizontal {
|
|
47
|
+
flex-direction: row;
|
|
48
|
+
flex-wrap: wrap;
|
|
49
|
+
gap: var(--_group-gap);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&[aria-disabled="true"] {
|
|
53
|
+
opacity: var(--#{sys.$prefix}opacity-disabled);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// ---------------------------------------------------------------------------
|
|
58
|
+
// Radio item (outer wrapper)
|
|
59
|
+
// ---------------------------------------------------------------------------
|
|
60
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}radio {
|
|
61
|
+
// Internal tokens
|
|
62
|
+
--_accent: var(--#{sys.$prefix}radio-accent, var(--#{sys.$prefix}input-accent, var(--#{sys.$prefix}theme-primary-base)));
|
|
63
|
+
--_border: var(--#{sys.$prefix}radio-border, var(--#{sys.$prefix}input-border, var(--#{sys.$prefix}color-border)));
|
|
64
|
+
--_bg: var(--#{sys.$prefix}radio-bg, var(--#{sys.$prefix}color-bg));
|
|
65
|
+
--_size: var(--#{sys.$prefix}radio-size, 1.15em);
|
|
66
|
+
--_gap: var(--#{sys.$prefix}radio-gap, var(--#{sys.$prefix}spacing-xs));
|
|
67
|
+
--_fs: var(--#{sys.$prefix}radio-font-size, var(--#{sys.$prefix}typography-size-sm));
|
|
68
|
+
--_label-color: var(--#{sys.$prefix}radio-label-color, var(--#{sys.$prefix}color-fg));
|
|
69
|
+
--_desc-color: var(--#{sys.$prefix}radio-description-color, var(--#{sys.$prefix}color-fg-muted));
|
|
70
|
+
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-direction: column;
|
|
73
|
+
|
|
74
|
+
// Selected state — targets the control button inside
|
|
75
|
+
&:has(.#{sys.$prefix}radio__control[aria-checked="true"]) {
|
|
76
|
+
.#{sys.$prefix}radio__indicator {
|
|
77
|
+
border-color: var(--_accent);
|
|
78
|
+
|
|
79
|
+
&::after {
|
|
80
|
+
transform: scale(1);
|
|
81
|
+
background-color: var(--_accent);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// ---------------------------------------------------------------------------
|
|
88
|
+
// Radio control (the button with role="radio")
|
|
89
|
+
// ---------------------------------------------------------------------------
|
|
90
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}radio__control {
|
|
91
|
+
display: inline-flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
gap: var(--_gap);
|
|
94
|
+
padding: 0;
|
|
95
|
+
border: none;
|
|
96
|
+
background: none;
|
|
97
|
+
font: inherit;
|
|
98
|
+
font-size: var(--_fs);
|
|
99
|
+
color: var(--_label-color);
|
|
100
|
+
cursor: pointer;
|
|
101
|
+
appearance: none;
|
|
102
|
+
|
|
103
|
+
&:hover:not(:disabled):not([aria-disabled="true"]) .#{sys.$prefix}radio__indicator {
|
|
104
|
+
border-color: var(--_accent);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Focus ring delegated to indicator — intentional (tightly wraps circle
|
|
108
|
+
// instead of full button width). outline: none on button is not a bug.
|
|
109
|
+
&:focus-visible {
|
|
110
|
+
outline: none;
|
|
111
|
+
|
|
112
|
+
.#{sys.$prefix}radio__indicator {
|
|
113
|
+
outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
|
|
114
|
+
outline-offset: var(--#{sys.$prefix}focus-ring-offset);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&:disabled {
|
|
119
|
+
cursor: not-allowed;
|
|
120
|
+
opacity: var(--#{sys.$prefix}opacity-disabled);
|
|
121
|
+
pointer-events: none;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Group-disabled: no opacity here (group wrapper handles it),
|
|
125
|
+
// no pointer-events: none (so cursor: not-allowed is visible).
|
|
126
|
+
// JS guard prevents selection.
|
|
127
|
+
&[aria-disabled="true"] {
|
|
128
|
+
cursor: not-allowed;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// ---------------------------------------------------------------------------
|
|
133
|
+
// Radio indicator (the circle)
|
|
134
|
+
// ---------------------------------------------------------------------------
|
|
135
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}radio__indicator {
|
|
136
|
+
display: inline-flex;
|
|
137
|
+
align-items: center;
|
|
138
|
+
justify-content: center;
|
|
139
|
+
flex-shrink: 0;
|
|
140
|
+
width: var(--_size);
|
|
141
|
+
height: var(--_size);
|
|
142
|
+
border-radius: 50%;
|
|
143
|
+
border: var(--#{sys.$prefix}border-width) solid var(--_border);
|
|
144
|
+
background-color: var(--_bg);
|
|
145
|
+
transition-duration: var(--#{sys.$prefix}motion-duration);
|
|
146
|
+
transition-timing-function: var(--#{sys.$prefix}motion-timing);
|
|
147
|
+
transition-property: border-color;
|
|
148
|
+
|
|
149
|
+
// The dot
|
|
150
|
+
&::after {
|
|
151
|
+
content: "";
|
|
152
|
+
display: block;
|
|
153
|
+
width: calc(var(--_size) * #{$_dot-ratio});
|
|
154
|
+
height: calc(var(--_size) * #{$_dot-ratio});
|
|
155
|
+
border-radius: 50%;
|
|
156
|
+
background-color: transparent;
|
|
157
|
+
transform: scale(0);
|
|
158
|
+
transition-duration: var(--#{sys.$prefix}motion-duration);
|
|
159
|
+
transition-timing-function: var(--#{sys.$prefix}motion-timing);
|
|
160
|
+
transition-property: transform, background-color;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// ---------------------------------------------------------------------------
|
|
165
|
+
// Radio label
|
|
166
|
+
// ---------------------------------------------------------------------------
|
|
167
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}radio__label {
|
|
168
|
+
font-weight: unset;
|
|
169
|
+
line-height: 1.25em;
|
|
170
|
+
user-select: none;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// ---------------------------------------------------------------------------
|
|
174
|
+
// Radio body (description + nested content)
|
|
175
|
+
// ---------------------------------------------------------------------------
|
|
176
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}radio__body {
|
|
177
|
+
// Indent to align with label text (indicator size + gap)
|
|
178
|
+
padding-inline-start: calc(var(--_size) + var(--_gap));
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}radio__description {
|
|
182
|
+
display: block;
|
|
183
|
+
margin: 0;
|
|
184
|
+
font-size: var(--_fs);
|
|
185
|
+
color: var(--_desc-color);
|
|
186
|
+
line-height: var(--#{sys.$prefix}typography-line-height);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// ---------------------------------------------------------------------------
|
|
190
|
+
// Reduced motion
|
|
191
|
+
// ---------------------------------------------------------------------------
|
|
192
|
+
// Transitions use --tui-motion-duration which is zeroed globally under
|
|
193
|
+
// prefers-reduced-motion. Explicit rule as safety net.
|
|
194
|
+
@media (prefers-reduced-motion: reduce) {
|
|
195
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}radio__indicator,
|
|
196
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}radio__indicator::after {
|
|
197
|
+
transition: none;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// ---------------------------------------------------------------------------
|
|
202
|
+
// CSS-only inline-choice radio
|
|
203
|
+
// ---------------------------------------------------------------------------
|
|
204
|
+
//
|
|
205
|
+
// For native <input type="radio"> rendered without the React Radio component.
|
|
206
|
+
// Native rendering preserved (no appearance: none) — uses accent-color for
|
|
207
|
+
// checked state. Opt-in via class OR convention:
|
|
208
|
+
// - `.tui-inline-choice__control` class on input[type="radio"]
|
|
209
|
+
// - any `<input type="radio">` inside a `.tui-inline-choice` wrapper
|
|
210
|
+
// Bare `<input type="radio">` outside both contexts renders fully natively.
|
|
211
|
+
//
|
|
212
|
+
// Parallel to Checkbox/styles.scss — see that file for the matching pattern.
|
|
213
|
+
//
|
|
214
|
+
.#{sys.$prefix}interface :is(
|
|
215
|
+
.#{sys.$prefix}inline-choice__control[type="radio"],
|
|
216
|
+
.#{sys.$prefix}inline-choice input[type="radio"]
|
|
217
|
+
) {
|
|
218
|
+
--_accent: var(--#{sys.$prefix}input-accent, var(--#{sys.$prefix}theme-primary-base));
|
|
219
|
+
|
|
220
|
+
font-size: 1.15em;
|
|
221
|
+
width: 1em;
|
|
222
|
+
height: 1em;
|
|
223
|
+
flex: 0 0 1em;
|
|
224
|
+
margin: 0;
|
|
225
|
+
|
|
226
|
+
&:focus-visible {
|
|
227
|
+
outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
|
|
228
|
+
outline-offset: var(--#{sys.$prefix}focus-ring-offset);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
&:checked {
|
|
232
|
+
accent-color: var(--_accent);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// ---------------------------------------------------------------------------
|
|
237
|
+
// Forced colors (Windows High Contrast Mode)
|
|
238
|
+
// ---------------------------------------------------------------------------
|
|
239
|
+
|
|
240
|
+
@media (forced-colors: active) {
|
|
241
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}radio__indicator {
|
|
242
|
+
forced-color-adjust: none;
|
|
243
|
+
border-color: CanvasText;
|
|
244
|
+
background-color: Canvas;
|
|
245
|
+
|
|
246
|
+
&::after {
|
|
247
|
+
background-color: CanvasText;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}radio:has(.#{sys.$prefix}radio__control[aria-checked="true"]) .#{sys.$prefix}radio__indicator {
|
|
252
|
+
border-color: Highlight;
|
|
253
|
+
|
|
254
|
+
&::after {
|
|
255
|
+
background-color: Highlight;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|