@tangible/ui 0.2.28 → 0.2.30
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/components/Accordion/Accordion.js +2 -1
- package/components/Avatar/Avatar.js +6 -2
- package/components/Button/types.d.ts +5 -5
- package/components/Chip/Chip.js +2 -1
- package/components/ChipGroup/ChipGroup.js +1 -1
- package/components/ChipGroup/types.d.ts +2 -1
- package/components/Chips/Chips.d.ts +2 -0
- package/components/Chips/Chips.js +2 -16
- package/components/ColorPicker/ColorField.d.ts +3 -3
- package/components/ColorPicker/ColorField.js +2 -1
- package/components/ColorPicker/ColorPicker.js +2 -1
- package/components/ColorPicker/usePointerDrag.d.ts +7 -0
- package/components/ColorPicker/usePointerDrag.js +15 -1
- package/components/Combobox/Combobox.js +3 -2
- package/components/ContentIndicator/types.d.ts +3 -3
- package/components/DatePicker/Calendar.js +4 -3
- package/components/DatePicker/DatePicker.js +3 -2
- package/components/DatePicker/PickerTrigger.js +2 -1
- package/components/DatePicker/types.d.ts +1 -1
- package/components/GradientPicker/GradientBar.js +3 -1
- package/components/GradientPicker/GradientPicker.js +4 -3
- package/components/Icon/Icon.d.ts +9 -2
- package/components/Icon/Icon.js +4 -3
- package/components/Icon/index.d.ts +1 -1
- package/components/IconButton/IconButton.js +13 -45
- package/components/IconButton/IconButtonCore.d.ts +9 -0
- package/components/IconButton/IconButtonCore.js +76 -0
- package/components/IconButton/types.d.ts +4 -3
- package/components/Modal/Modal.d.ts +12 -3
- package/components/Modal/Modal.js +38 -15
- package/components/MoveHandle/MoveHandle.js +3 -2
- package/components/MultiCombobox/MultiCombobox.js +3 -2
- package/components/MultiSelect/MultiSelect.js +3 -2
- package/components/NavMenu/NavMenu.js +2 -1
- package/components/NavMenu/types.d.ts +3 -3
- package/components/Notice/Notice.d.ts +7 -0
- package/components/Notice/Notice.js +6 -5
- package/components/Pager/Pager.js +5 -4
- package/components/Rating/Rating.js +2 -1
- package/components/SearchInput/SearchInput.js +3 -2
- package/components/SearchSelect/SearchSelect.js +3 -2
- package/components/SecretInput/SecretInput.js +3 -2
- package/components/Select/Select.js +3 -2
- package/components/Sidebar/Sidebar.js +2 -1
- package/components/StepIndicator/StepIndicator.js +4 -2
- package/components/StepIndicator/types.d.ts +2 -2
- package/components/StepList/types.d.ts +2 -2
- package/components/Tabs/types.d.ts +3 -3
- package/components/Toast/Toast.d.ts +5 -1
- package/components/Toast/Toast.js +3 -3
- package/components/Tooltip/Tooltip.d.ts +1 -1
- package/components/Tooltip/Tooltip.js +28 -6
- package/components/Tooltip/index.d.ts +1 -1
- package/components/Tooltip/types.d.ts +18 -0
- package/components/index.d.ts +2 -2
- package/figma-tokens.json +6 -4
- package/icons/cred/index.js +1 -0
- package/icons/icons.svg +7 -3
- package/icons/lms/index.d.ts +0 -3
- package/icons/lms/index.js +6 -33
- package/icons/manifest.json +71 -9
- package/icons/membersync/index.js +1 -0
- package/icons/player/index.js +1 -0
- package/icons/reaction/index.js +1 -0
- package/icons/registry.d.ts +14 -0
- package/icons/registry.js +7 -0
- package/icons/system/index.d.ts +11 -0
- package/icons/system/index.js +48 -0
- package/package.json +9 -2
- package/skills/building-with-tui/SKILL.md +249 -17
- package/styles/all.css +1 -1
- package/styles/all.expanded.css +127 -13
- package/styles/all.expanded.unlayered.css +127 -13
- package/styles/all.unlayered.css +1 -1
- package/styles/app.css +41 -0
- package/styles/components/_bundle.scss +2 -0
- package/styles/components/button.scss +6 -1
- package/styles/components/card.scss +17 -1
- package/styles/components/chip-group.scss +45 -28
- package/styles/components/chips.scss +21 -0
- package/styles/components/color-picker.scss +15 -1
- package/styles/components/gradient-picker.scss +2 -2
- package/styles/components/modal.scss +61 -0
- package/styles/components/tooltip.scss +8 -1
- package/styles/core.css +1 -1
- package/styles/core.unlayered.css +1 -1
- package/styles/system/_text-styles.scss +4 -0
- package/styles/system/_tokens.scss +7 -2
- package/styles/utilities/_index.scss +3 -0
- package/tui-manifest.json +46 -19
- package/utils/focus-trap.d.ts +1 -24
- package/utils/focus-trap.js +2 -65
- package/utils/scroll-lock.d.ts +4 -0
- package/utils/scroll-lock.js +25 -0
- package/utils/tabbable.d.ts +29 -0
- package/utils/tabbable.js +74 -0
- package/vanilla/modal.d.ts +37 -0
- package/vanilla/modal.js +453 -0
- package/vanilla/modal.min.js +1 -0
- package/vanilla/styles.css +1 -0
- package/vanilla/styles.unlayered.css +1 -0
package/styles/app.css
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
@layer resets, defaults, components, utilities;
|
|
2
|
+
@layer defaults {
|
|
3
|
+
:where(html, body) {
|
|
4
|
+
margin: 0;
|
|
5
|
+
}
|
|
6
|
+
:where(html[data-theme=dark], html:has(> body[data-theme=dark])) {
|
|
7
|
+
color-scheme: dark;
|
|
8
|
+
}
|
|
9
|
+
:where(html[data-theme=auto], html:has(> body[data-theme=auto])) {
|
|
10
|
+
color-scheme: light dark;
|
|
11
|
+
}
|
|
12
|
+
:where(body) {
|
|
13
|
+
min-height: 100dvh;
|
|
14
|
+
background: var(--tui-color-bg-surface);
|
|
15
|
+
color: var(--tui-color-fg);
|
|
16
|
+
}
|
|
17
|
+
:where(.tui-interface) {
|
|
18
|
+
--tui-input-bg: var(--tui-color-bg);
|
|
19
|
+
}
|
|
20
|
+
:where(.tui-interface:not(html), html.tui-interface > body) {
|
|
21
|
+
font-size: var(--tui-typography-size-sm);
|
|
22
|
+
}
|
|
23
|
+
:where(.tui-interface) {
|
|
24
|
+
--tui-text-headline-04-weight: 600;
|
|
25
|
+
--tui-text-headline-04-line-height: 1.25;
|
|
26
|
+
--tui-text-body-line-height: 1.4;
|
|
27
|
+
--tui-text-body-sm-line-height: 1.4;
|
|
28
|
+
--tui-field-helper-fg: var(--tui-color-fg-muted);
|
|
29
|
+
}
|
|
30
|
+
:where(.tui-interface :any-link) {
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
}
|
|
33
|
+
:where(.tui-interface a:not([class])) {
|
|
34
|
+
color: var(--tui-theme-primary-strong);
|
|
35
|
+
text-underline-offset: 0.2em;
|
|
36
|
+
}
|
|
37
|
+
:where(.tui-interface code) {
|
|
38
|
+
font-family: var(--tui-font-family-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, Liberation Mono, monospace);
|
|
39
|
+
font-size: 0.9em;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
@use "./checkbox" as checkbox;
|
|
8
8
|
@use "./chip" as chip;
|
|
9
9
|
@use "./chip-group" as chipgroup;
|
|
10
|
+
@use "./chips" as chips;
|
|
10
11
|
@use "./combobox" as combobox;
|
|
11
12
|
@use "./color-picker" as colorpicker;
|
|
12
13
|
@use "./gradient-picker" as gradientpicker;
|
|
@@ -87,6 +88,7 @@ $-input-dependents: (input, field, text-input, textarea, pager, search-input, se
|
|
|
87
88
|
@if -wants($only, checkbox) { @include checkbox.styles(); }
|
|
88
89
|
@if -wants($only, chip) { @include chip.styles(); }
|
|
89
90
|
@if -wants($only, chip-group) { @include chipgroup.styles(); }
|
|
91
|
+
@if -wants($only, chips) { @include chips.styles(); }
|
|
90
92
|
@if -wants($only, combobox) { @include combobox.styles(); }
|
|
91
93
|
@if -wants($only, color-picker) { @include colorpicker.styles(); }
|
|
92
94
|
@if -wants($only, gradient-picker) { @include gradientpicker.styles(); }
|
|
@@ -114,7 +114,12 @@ $_typography-lineHeight: var(--#{sys.$prefix}button-line-height, 1.4);
|
|
|
114
114
|
height: auto;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
// WebKit's UA sheet gives links `cursor: auto`, so an anchor Button showed
|
|
118
|
+
// the text cursor in Safari while Chromium's UA rule hid the gap. Button owns
|
|
119
|
+
// its cursor for <button>, so it owns it here too. The disabled rule below
|
|
120
|
+
// (0,2,0) still wins with not-allowed.
|
|
117
121
|
:where(.#{sys.$prefix}interface) :where(a).#{sys.$prefix}button {
|
|
122
|
+
cursor: pointer;
|
|
118
123
|
text-decoration: none;
|
|
119
124
|
}
|
|
120
125
|
|
|
@@ -246,7 +251,7 @@ $_typography-lineHeight: var(--#{sys.$prefix}button-line-height, 1.4);
|
|
|
246
251
|
--_radius: var(--#{sys.$prefix}button-radius, var(--#{sys.$prefix}radius-sm));
|
|
247
252
|
font-size: var(--#{sys.$prefix}button-font-size-xs, var(--#{sys.$prefix}typography-size-xs));
|
|
248
253
|
padding-block: 0;
|
|
249
|
-
padding-inline: var(--#{sys.$prefix}spacing-
|
|
254
|
+
padding-inline: var(--#{sys.$prefix}spacing-xs);
|
|
250
255
|
min-height: var(--#{sys.$prefix}control-height-xs, 1.5rem);
|
|
251
256
|
min-width: 2em;
|
|
252
257
|
}
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
// --tui-card-bg Background color
|
|
26
26
|
// --tui-card-bg-interact Hover/focus fill (default: no change; ghost: bg-muted)
|
|
27
27
|
// --tui-card-fg Text color (solid/elevated; outline, ghost and seamless inherit; ghost owns it on hover)
|
|
28
|
+
// --tui-card-link-fg Card.Link text color (default: the card's; overrides own their contrast)
|
|
28
29
|
// --tui-card-border Border color
|
|
29
30
|
// --tui-card-border-width Border width (falls back to --tui-border-width)
|
|
30
31
|
// --tui-card-border-interact Hover/focus border color
|
|
@@ -47,6 +48,9 @@
|
|
|
47
48
|
// resting fill (outline/ghost/seamless) re-point --_fg to inherit.
|
|
48
49
|
--_fg: var(--#{sys.$prefix}card-fg, var(--#{sys.$prefix}color-fg));
|
|
49
50
|
--_fg-interact: var(--_fg);
|
|
51
|
+
// Card.Link's colour, inherited down to it. Read from the card's own
|
|
52
|
+
// internals rather than `inherit`, which would take a styled heading's.
|
|
53
|
+
--_link-fg: var(--_fg);
|
|
50
54
|
--_border: var(--#{sys.$prefix}card-border, var(--#{sys.$prefix}color-border));
|
|
51
55
|
--_border-width: var(--#{sys.$prefix}card-border-width, var(--#{sys.$prefix}border-width));
|
|
52
56
|
--_border-interact: var(--#{sys.$prefix}card-border-interact, var(--#{sys.$prefix}theme-primary-base));
|
|
@@ -291,6 +295,7 @@
|
|
|
291
295
|
--_border: var(--_border-interact);
|
|
292
296
|
background-color: var(--_bg-interact);
|
|
293
297
|
color: var(--_fg-interact);
|
|
298
|
+
--_link-fg: var(--_fg-interact);
|
|
294
299
|
}
|
|
295
300
|
|
|
296
301
|
&:focus-visible,
|
|
@@ -298,6 +303,7 @@
|
|
|
298
303
|
--_border: var(--_border-interact);
|
|
299
304
|
background-color: var(--_bg-interact);
|
|
300
305
|
color: var(--_fg-interact);
|
|
306
|
+
--_link-fg: var(--_fg-interact);
|
|
301
307
|
}
|
|
302
308
|
|
|
303
309
|
&:active,
|
|
@@ -315,8 +321,18 @@
|
|
|
315
321
|
}
|
|
316
322
|
}
|
|
317
323
|
|
|
318
|
-
//
|
|
324
|
+
// Card.Link takes the card's text colour, not the UA's link blue: the
|
|
325
|
+
// whole card is the affordance (border, fill and focus ring carry the
|
|
326
|
+
// interaction). Where the card paints a fill it pins the card's fg, even
|
|
327
|
+
// inside a heading a host has coloured; unpainted variants (outline,
|
|
328
|
+
// seamless, ghost at rest) have --_fg at `inherit`, so the link inherits
|
|
329
|
+
// like the text around it. The underline is left to the host. !important,
|
|
330
|
+
// the Button precedent: host CSS styles bare `a` unlayered (WordPress
|
|
331
|
+
// themes, Storybook's preview.css), which beats any layered rule.
|
|
319
332
|
.#{sys.$prefix}stretched-link {
|
|
333
|
+
color: var(--#{sys.$prefix}card-link-fg, var(--_link-fg)) !important;
|
|
334
|
+
|
|
335
|
+
// Stretched link focus ring (WCAG 2.4.7)
|
|
320
336
|
&:focus {
|
|
321
337
|
outline: none;
|
|
322
338
|
}
|
|
@@ -4,13 +4,56 @@
|
|
|
4
4
|
--tui-chip-group-gap
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
// ==========================================================================
|
|
8
|
+
// Chip row layout — shared by ChipGroup and Chips
|
|
9
|
+
// ==========================================================================
|
|
10
|
+
//
|
|
11
|
+
// Included on each component's own root class, so the two share one layout
|
|
12
|
+
// and one gap token without sharing an identity: `.tui-chip-group` stays
|
|
13
|
+
// "the selectable group", and Chips' root is `.tui-chips`.
|
|
14
|
+
//
|
|
15
|
+
// Alignment is `data-align`, not `is-align-*`: the bare utility of that name
|
|
16
|
+
// sets align-items from the utilities layer, which outranks this one.
|
|
17
|
+
// ==========================================================================
|
|
18
|
+
|
|
19
|
+
@mixin layout() {
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-wrap: wrap;
|
|
22
|
+
gap: var(--_gap, var(--#{sys.$prefix}chip-group-gap, var(--#{sys.$prefix}spacing-sm)));
|
|
23
|
+
|
|
24
|
+
// Density
|
|
25
|
+
&.is-density-xs { --_gap: var(--#{sys.$prefix}chip-group-gap, var(--#{sys.$prefix}spacing-xs)); }
|
|
26
|
+
&.is-density-sm { --_gap: var(--#{sys.$prefix}chip-group-gap, var(--#{sys.$prefix}spacing-sm)); }
|
|
27
|
+
&.is-density-md { --_gap: var(--#{sys.$prefix}chip-group-gap, var(--#{sys.$prefix}spacing-md)); }
|
|
28
|
+
|
|
29
|
+
// Direction
|
|
30
|
+
&.is-direction-stack {
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
flex-wrap: nowrap;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Alignment — inline applies justify-content, stack applies align-items
|
|
36
|
+
&:not(.is-direction-stack) {
|
|
37
|
+
&[data-align="start"] { justify-content: flex-start; }
|
|
38
|
+
&[data-align="center"] { justify-content: center; }
|
|
39
|
+
&[data-align="end"] { justify-content: flex-end; }
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&.is-direction-stack {
|
|
43
|
+
&[data-align="start"] { align-items: flex-start; }
|
|
44
|
+
&[data-align="center"] { align-items: center; }
|
|
45
|
+
&[data-align="end"] { align-items: flex-end; }
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
7
49
|
@mixin styles() {
|
|
8
50
|
// ==========================================================================
|
|
9
51
|
// ChipGroup Component
|
|
10
52
|
// ==========================================================================
|
|
11
53
|
//
|
|
12
54
|
// Component API tokens (never defined here, only read via fallback):
|
|
13
|
-
// --tui-chip-group-gap Gap between chips
|
|
55
|
+
// --tui-chip-group-gap Gap between chips. Also reaches Chips, which
|
|
56
|
+
// shares this layout: tune one, both move.
|
|
14
57
|
//
|
|
15
58
|
// To override from consuming code:
|
|
16
59
|
// .my-context .tui-chip-group { --tui-chip-group-gap: 2rem; }
|
|
@@ -18,32 +61,6 @@
|
|
|
18
61
|
// ==========================================================================
|
|
19
62
|
|
|
20
63
|
.tui-chip-group {
|
|
21
|
-
|
|
22
|
-
flex-wrap: wrap;
|
|
23
|
-
gap: var(--_gap, var(--#{sys.$prefix}chip-group-gap, var(--#{sys.$prefix}spacing-sm)));
|
|
24
|
-
|
|
25
|
-
// Density
|
|
26
|
-
&.is-density-xs { --_gap: var(--#{sys.$prefix}chip-group-gap, var(--#{sys.$prefix}spacing-xs)); }
|
|
27
|
-
&.is-density-sm { --_gap: var(--#{sys.$prefix}chip-group-gap, var(--#{sys.$prefix}spacing-sm)); }
|
|
28
|
-
&.is-density-md { --_gap: var(--#{sys.$prefix}chip-group-gap, var(--#{sys.$prefix}spacing-md)); }
|
|
29
|
-
|
|
30
|
-
// Direction
|
|
31
|
-
&.is-direction-stack {
|
|
32
|
-
flex-direction: column;
|
|
33
|
-
flex-wrap: nowrap;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Alignment — inline applies justify-content, stack applies align-items
|
|
37
|
-
&:not(.is-direction-stack) {
|
|
38
|
-
&.is-align-start { justify-content: flex-start; }
|
|
39
|
-
&.is-align-center { justify-content: center; }
|
|
40
|
-
&.is-align-end { justify-content: flex-end; }
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
&.is-direction-stack {
|
|
44
|
-
&.is-align-start { align-items: flex-start; }
|
|
45
|
-
&.is-align-center { align-items: center; }
|
|
46
|
-
&.is-align-end { align-items: flex-end; }
|
|
47
|
-
}
|
|
64
|
+
@include layout();
|
|
48
65
|
}
|
|
49
66
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
@use "../system" as sys;
|
|
2
|
+
@use "./chip-group" as chipgroup;
|
|
3
|
+
|
|
4
|
+
@mixin styles() {
|
|
5
|
+
// ==========================================================================
|
|
6
|
+
// Chips Component
|
|
7
|
+
// ==========================================================================
|
|
8
|
+
//
|
|
9
|
+
// A presentational row of chips. Same layout as ChipGroup, including its
|
|
10
|
+
// gap token (--tui-chip-group-gap), without ChipGroup's class.
|
|
11
|
+
//
|
|
12
|
+
// ==========================================================================
|
|
13
|
+
|
|
14
|
+
.tui-chips {
|
|
15
|
+
@include chipgroup.layout();
|
|
16
|
+
|
|
17
|
+
// Chips has always sat a small step above what follows it. A rule, not
|
|
18
|
+
// an inline style, so consumer CSS and tui-margin-* utilities reach it.
|
|
19
|
+
margin-block-end: var(--#{sys.$prefix}spacing-sm);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -59,13 +59,27 @@
|
|
|
59
59
|
// Color slider — hue / alpha
|
|
60
60
|
// ---------------------------------------------------------------------------
|
|
61
61
|
.#{sys.$prefix}interface .#{sys.$prefix}color-slider {
|
|
62
|
+
--_height: var(--#{sys.$prefix}color-slider-height, 12px);
|
|
62
63
|
position: relative;
|
|
63
|
-
height: var(
|
|
64
|
+
height: var(--_height);
|
|
64
65
|
border-radius: var(--#{sys.$prefix}color-slider-radius, var(--#{sys.$prefix}radius-full, 999px));
|
|
65
66
|
cursor: pointer;
|
|
66
67
|
touch-action: none;
|
|
67
68
|
user-select: none;
|
|
68
69
|
|
|
70
|
+
// Hit area: the bar is thinner than a fingertip and WCAG 2.5.8's 24px
|
|
71
|
+
// target, so a real touch often lands just outside it and scrolls the
|
|
72
|
+
// page instead (iOS). The pseudo-element is part of the slider, so it
|
|
73
|
+
// catches the pointer without changing what's painted. It reaches 6px
|
|
74
|
+
// past each edge, so stacked sliders need at least 12px between them
|
|
75
|
+
// (the picker's spacing-sm gap) or the later one steals the overlap.
|
|
76
|
+
&::before {
|
|
77
|
+
content: '';
|
|
78
|
+
position: absolute;
|
|
79
|
+
inset-block: calc(-1 * max(0px, (1.5rem - var(--_height)) / 2));
|
|
80
|
+
inset-inline: 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
69
83
|
&:focus-visible {
|
|
70
84
|
outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
|
|
71
85
|
outline-offset: var(--#{sys.$prefix}focus-ring-offset);
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
cursor: grab;
|
|
58
58
|
|
|
59
59
|
// Invisible expanded hit area — the visual thumb is 16px but the pointer
|
|
60
|
-
// target must meet the 24px floor (WCAG 2.5.
|
|
60
|
+
// target must meet the 24px floor (WCAG 2.5.8 / house rule in CLAUDE.md).
|
|
61
61
|
&::before {
|
|
62
62
|
content: "";
|
|
63
63
|
position: absolute;
|
|
@@ -191,7 +191,7 @@
|
|
|
191
191
|
display: inline-flex;
|
|
192
192
|
width: calc(var(--#{sys.$prefix}control-height-sm, 2rem) - 2 * var(--#{sys.$prefix}spacing-xxs));
|
|
193
193
|
height: calc(var(--#{sys.$prefix}control-height-sm, 2rem) - 2 * var(--#{sys.$prefix}spacing-xxs));
|
|
194
|
-
// WCAG 2.5.
|
|
194
|
+
// WCAG 2.5.8 floor — keep the hit target at least 24px even if the
|
|
195
195
|
// control-height token shrinks in a dense context.
|
|
196
196
|
min-inline-size: 1.5rem;
|
|
197
197
|
min-block-size: 1.5rem;
|
|
@@ -77,6 +77,55 @@
|
|
|
77
77
|
padding-inline-end: calc(var(--_spacing) + var(--_offset-end));
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
// Native <dialog> host, for the vanilla build (src/vanilla/modal.ts). The
|
|
81
|
+
// <dialog> IS the .tui-modal layer above: full-viewport, scrolling, padding
|
|
82
|
+
// the box in from the edges. It paints the backdrop as its own background
|
|
83
|
+
// instead of through ::backdrop, so the colour reads --_backdrop from the
|
|
84
|
+
// element's normal cascade, and a click on the <dialog> itself is a click on
|
|
85
|
+
// the backdrop. The rules below undo the UA dialog box (fit-content size,
|
|
86
|
+
// centring margin, border, Canvas background).
|
|
87
|
+
dialog.#{sys.$prefix}modal {
|
|
88
|
+
inline-size: auto;
|
|
89
|
+
block-size: auto;
|
|
90
|
+
max-inline-size: none;
|
|
91
|
+
max-block-size: none;
|
|
92
|
+
margin: 0;
|
|
93
|
+
border: 0;
|
|
94
|
+
background: var(--_backdrop);
|
|
95
|
+
// The host paints no text of its own; the box sets its fg.
|
|
96
|
+
color: inherit;
|
|
97
|
+
// A tall box scrolls the <dialog>; don't hand the scroll on to the page.
|
|
98
|
+
overscroll-behavior: contain;
|
|
99
|
+
|
|
100
|
+
// .tui-modal's display: flex would otherwise show a closed dialog.
|
|
101
|
+
&:not([open]) {
|
|
102
|
+
display: none;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&::backdrop {
|
|
106
|
+
background: transparent;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// The <dialog> takes focus only as a fallback; the ring goes on the box.
|
|
110
|
+
&:focus-visible {
|
|
111
|
+
outline: none;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// A video or other embed filling the body at 16:9, the common case for a
|
|
116
|
+
// modal that exists to play something.
|
|
117
|
+
.#{sys.$prefix}modal__embed {
|
|
118
|
+
display: block;
|
|
119
|
+
inline-size: 100%;
|
|
120
|
+
aspect-ratio: 16 / 9;
|
|
121
|
+
border: 0;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
dialog.#{sys.$prefix}modal:focus-visible > .#{sys.$prefix}modal__dialog {
|
|
125
|
+
outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
|
|
126
|
+
outline-offset: var(--#{sys.$prefix}focus-ring-offset);
|
|
127
|
+
}
|
|
128
|
+
|
|
80
129
|
.#{sys.$prefix}modal__backdrop {
|
|
81
130
|
position: fixed; // Fixed so it covers viewport even when container scrolls
|
|
82
131
|
inset: 0;
|
|
@@ -320,6 +369,18 @@
|
|
|
320
369
|
transform: none;
|
|
321
370
|
opacity: 1;
|
|
322
371
|
}
|
|
372
|
+
|
|
373
|
+
// Native host: fade the backdrop it paints. The box above already keys
|
|
374
|
+
// off data-state, which the script sets after showModal() and flips to
|
|
375
|
+
// "closing" for the exit.
|
|
376
|
+
dialog.#{sys.$prefix}modal {
|
|
377
|
+
background-color: transparent;
|
|
378
|
+
transition: background-color var(--#{sys.$prefix}motion-duration) var(--#{sys.$prefix}motion-timing);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
dialog.#{sys.$prefix}modal[data-state="open"] {
|
|
382
|
+
background-color: var(--_backdrop);
|
|
383
|
+
}
|
|
323
384
|
}
|
|
324
385
|
|
|
325
386
|
// Windows High Contrast Mode support
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
--tui-tooltip-fg
|
|
6
6
|
--tui-tooltip-radius
|
|
7
7
|
--tui-tooltip-z
|
|
8
|
+
--tui-tooltip-max-width
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
11
|
@mixin styles() {
|
|
@@ -17,6 +18,9 @@
|
|
|
17
18
|
// --tui-tooltip-fg Text color (default: color-fg-inverted; light: color-fg)
|
|
18
19
|
// --tui-tooltip-radius Border radius (default: radius-sm)
|
|
19
20
|
// --tui-tooltip-z Z-index for portal (default: layer-top)
|
|
21
|
+
// --tui-tooltip-max-width
|
|
22
|
+
// Width before the text wraps (default: 250px). A length;
|
|
23
|
+
// the viewport clamp always applies on top of it.
|
|
20
24
|
//
|
|
21
25
|
// To override from consuming code:
|
|
22
26
|
// .my-context .tui-tooltip { --tui-tooltip-bg: #1a1a1a; }
|
|
@@ -29,11 +33,14 @@
|
|
|
29
33
|
--_fg: var(--#{sys.$prefix}tooltip-fg, var(--#{sys.$prefix}color-fg-inverted));
|
|
30
34
|
--_radius: var(--#{sys.$prefix}tooltip-radius, var(--#{sys.$prefix}radius-sm));
|
|
31
35
|
--_z: var(--#{sys.$prefix}tooltip-z, var(--#{sys.$prefix}layer-top));
|
|
36
|
+
// The token sits inside min(), so it can narrow or widen the tooltip but
|
|
37
|
+
// never past the viewport.
|
|
38
|
+
--_max-width: min(var(--#{sys.$prefix}tooltip-max-width, 250px), calc(100vw - (2 * var(--#{sys.$prefix}spacing-xs, 8px))));
|
|
32
39
|
|
|
33
40
|
// Layout
|
|
34
41
|
z-index: var(--_z);
|
|
35
42
|
width: max-content;
|
|
36
|
-
max-width:
|
|
43
|
+
max-width: var(--_max-width);
|
|
37
44
|
padding: 0.35em 0.65em;
|
|
38
45
|
// Re-enable pointer events (portal root has pointer-events: none)
|
|
39
46
|
pointer-events: auto;
|