@tangible/ui 0.0.18 → 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/package.json +3 -1
- package/styles/components/_bundle.scss +98 -71
- 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 +2 -2
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
@use "../system" as sys;
|
|
2
|
+
|
|
3
|
+
/* @tui-tokens: none — inherits --tui-progress-track, --tui-progress-fill */
|
|
4
|
+
|
|
5
|
+
@mixin styles() {
|
|
6
|
+
// ==========================================================================
|
|
7
|
+
// Step Indicator Component
|
|
8
|
+
// ==========================================================================
|
|
9
|
+
//
|
|
10
|
+
// Wraps Progress circle mode to show step states:
|
|
11
|
+
// - not-started: empty ring (0% fill, no icon)
|
|
12
|
+
// - in-progress: ring with progress fill, optional percentage
|
|
13
|
+
// - complete: solid filled circle + checkmark icon (uses Progress variant="solid")
|
|
14
|
+
// - locked: ring track + lock icon
|
|
15
|
+
//
|
|
16
|
+
// ## Coupling with Progress
|
|
17
|
+
//
|
|
18
|
+
// This component is tightly coupled to Progress circle mode internals.
|
|
19
|
+
// Changes to Progress may require updates here.
|
|
20
|
+
//
|
|
21
|
+
// ### Inherits from Progress:
|
|
22
|
+
// --tui-progress-track Ring track color
|
|
23
|
+
// --tui-progress-fill Ring fill color
|
|
24
|
+
//
|
|
25
|
+
// ### Manipulates Progress:
|
|
26
|
+
// - Sets --tui-progress-track per status (locked uses border color)
|
|
27
|
+
// - Overrides label font-size to fit icons
|
|
28
|
+
// - Uses variant="solid" for complete state (removes hollow centre)
|
|
29
|
+
//
|
|
30
|
+
// ==========================================================================
|
|
31
|
+
|
|
32
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}step-indicator {
|
|
33
|
+
display: inline-flex;
|
|
34
|
+
|
|
35
|
+
// Size overrides — StepIndicator uses fixed pixel sizes
|
|
36
|
+
// rather than Progress's em-based scaling
|
|
37
|
+
// xs = 16px, sm = 24px, md = 32px, lg = 40px
|
|
38
|
+
&.is-size-xs .#{sys.$prefix}progress {
|
|
39
|
+
font-size: 8px; // 2em = 16px circle
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&.is-size-sm .#{sys.$prefix}progress {
|
|
43
|
+
font-size: 12px; // 2em = 24px circle
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&.is-size-md .#{sys.$prefix}progress {
|
|
47
|
+
font-size: 16px; // 2em = 32px circle
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&.is-size-lg .#{sys.$prefix}progress {
|
|
51
|
+
font-size: 20px; // 2em = 40px circle
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Static icon states: hide the progress fill, show only track
|
|
55
|
+
// Note: complete handles its own background (solid green), so not included here
|
|
56
|
+
// Note: in-progress with custom icon should still show progress fill
|
|
57
|
+
&.is-status-locked.has-icon,
|
|
58
|
+
&.is-status-not-started.has-icon {
|
|
59
|
+
.#{sys.$prefix}progress__circle__bar {
|
|
60
|
+
// Override conic-gradient to show only track color
|
|
61
|
+
background: var(--#{sys.$prefix}progress-track, var(--#{sys.$prefix}color-border)) !important;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Center the icon properly within the progress circle
|
|
66
|
+
// Progress sets label font-size to 0.5em, but icons need to fill ~60% of circle
|
|
67
|
+
// Circle is 2em, so icon should be ~1.2em → need font-size ~1.2em on the label
|
|
68
|
+
// Must match Progress specificity (.tui-progress.is-mode-circle)
|
|
69
|
+
.#{sys.$prefix}progress.is-mode-circle .#{sys.$prefix}progress__label.is-inside {
|
|
70
|
+
font-size: 1.2em;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Value text styling (percentage display)
|
|
74
|
+
// Since we bumped label font-size to 1.2em for icons,
|
|
75
|
+
// value text needs smaller size to fit inside circle
|
|
76
|
+
&__value {
|
|
77
|
+
font-size: 0.5em;
|
|
78
|
+
font-weight: var(--#{sys.$prefix}font-weight-bold, 700);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// -------------------------------------------------------------------------
|
|
82
|
+
// Status-specific color overrides
|
|
83
|
+
// -------------------------------------------------------------------------
|
|
84
|
+
|
|
85
|
+
// Custom icons in not-started/in-progress states
|
|
86
|
+
&.is-status-not-started.has-icon {
|
|
87
|
+
.#{sys.$prefix}icon {
|
|
88
|
+
color: var(--#{sys.$prefix}color-fg-muted);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&.is-status-in-progress.has-icon {
|
|
93
|
+
.#{sys.$prefix}icon {
|
|
94
|
+
color: var(--#{sys.$prefix}theme-primary-base);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&.is-status-complete {
|
|
99
|
+
// Solid filled circle with white icon
|
|
100
|
+
// Note: Progress variant="solid" removes the mask (handled in Progress)
|
|
101
|
+
.#{sys.$prefix}progress__circle__bar {
|
|
102
|
+
background: var(--#{sys.$prefix}theme-success-base) !important;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.#{sys.$prefix}icon {
|
|
106
|
+
color: var(--#{sys.$prefix}color-fg-on-accent);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&.is-status-locked {
|
|
111
|
+
--#{sys.$prefix}progress-track: var(--#{sys.$prefix}color-border);
|
|
112
|
+
|
|
113
|
+
.#{sys.$prefix}icon {
|
|
114
|
+
color: var(--#{sys.$prefix}color-fg-muted);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
@use "../system" as sys;
|
|
2
|
+
|
|
3
|
+
/* @tui-tokens
|
|
4
|
+
--tui-steplist-gap
|
|
5
|
+
--tui-steplist-padding
|
|
6
|
+
--tui-steplist-radius
|
|
7
|
+
--tui-steplist-current-bg
|
|
8
|
+
--tui-steplist-current-border
|
|
9
|
+
--tui-steplist-hover-bg
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
@mixin styles() {
|
|
13
|
+
// ==========================================================================
|
|
14
|
+
// StepList Component
|
|
15
|
+
// ==========================================================================
|
|
16
|
+
//
|
|
17
|
+
// Component API tokens (never defined here, only read via fallback):
|
|
18
|
+
// --tui-steplist-gap Gap between items
|
|
19
|
+
// --tui-steplist-padding Item padding
|
|
20
|
+
// --tui-steplist-radius Item border radius
|
|
21
|
+
// --tui-steplist-current-bg Current item background
|
|
22
|
+
// --tui-steplist-current-border Current item left border accent
|
|
23
|
+
// --tui-steplist-hover-bg Hover background
|
|
24
|
+
//
|
|
25
|
+
// To override from consuming code:
|
|
26
|
+
// .my-context .tui-steplist__item { --tui-steplist-current-bg: hotpink; }
|
|
27
|
+
//
|
|
28
|
+
// ==========================================================================
|
|
29
|
+
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
// Root (nav wrapper)
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
|
|
34
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}steplist {
|
|
35
|
+
// No specific styling needed on the nav wrapper
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
// List
|
|
40
|
+
// ---------------------------------------------------------------------------
|
|
41
|
+
|
|
42
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}steplist__list {
|
|
43
|
+
// Internal tokens — read component API with fallback to primitives
|
|
44
|
+
--_gap: var(--#{sys.$prefix}steplist-gap, var(--#{sys.$prefix}spacing-xs));
|
|
45
|
+
|
|
46
|
+
list-style: none;
|
|
47
|
+
margin: 0;
|
|
48
|
+
padding: 0;
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
gap: var(--_gap);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// ---------------------------------------------------------------------------
|
|
55
|
+
// Item (anchor or button)
|
|
56
|
+
// ---------------------------------------------------------------------------
|
|
57
|
+
|
|
58
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}steplist__item {
|
|
59
|
+
// Internal tokens
|
|
60
|
+
--_padding: var(--#{sys.$prefix}steplist-padding, var(--#{sys.$prefix}spacing-sm));
|
|
61
|
+
--_radius: var(--#{sys.$prefix}steplist-radius, var(--#{sys.$prefix}radius-sm));
|
|
62
|
+
--_current-bg: var(--#{sys.$prefix}steplist-current-bg, var(--#{sys.$prefix}theme-primary-subtlest));
|
|
63
|
+
--_current-border: var(--#{sys.$prefix}steplist-current-border, var(--#{sys.$prefix}theme-primary-base));
|
|
64
|
+
--_hover-bg: var(--#{sys.$prefix}steplist-hover-bg, var(--#{sys.$prefix}color-bg-muted));
|
|
65
|
+
|
|
66
|
+
display: flex;
|
|
67
|
+
align-items: flex-start; // Align to top for multi-line content
|
|
68
|
+
gap: var(--#{sys.$prefix}spacing-sm);
|
|
69
|
+
width: 100%;
|
|
70
|
+
padding: var(--_padding);
|
|
71
|
+
padding-inline-start: calc(var(--_padding) - 3px); // Account for left border
|
|
72
|
+
border: none;
|
|
73
|
+
border-left: 3px solid transparent;
|
|
74
|
+
border-radius: var(--_radius);
|
|
75
|
+
background: transparent;
|
|
76
|
+
color: var(--#{sys.$prefix}color-fg);
|
|
77
|
+
font: inherit;
|
|
78
|
+
text-align: start;
|
|
79
|
+
text-decoration: none;
|
|
80
|
+
cursor: pointer;
|
|
81
|
+
transition-property: background-color, border-color;
|
|
82
|
+
transition-duration: var(--#{sys.$prefix}motion-duration);
|
|
83
|
+
transition-timing-function: var(--#{sys.$prefix}motion-timing);
|
|
84
|
+
|
|
85
|
+
&:hover:not([aria-disabled="true"]):not(:disabled) {
|
|
86
|
+
background-color: var(--_hover-bg);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&:focus-visible {
|
|
90
|
+
outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
|
|
91
|
+
outline-offset: var(--#{sys.$prefix}focus-ring-offset);
|
|
92
|
+
z-index: 1;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Current item styling
|
|
96
|
+
&.is-current,
|
|
97
|
+
&[aria-current] {
|
|
98
|
+
background-color: var(--_current-bg);
|
|
99
|
+
border-left-color: var(--_current-border);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Disabled styling
|
|
103
|
+
&.is-disabled,
|
|
104
|
+
&[aria-disabled="true"],
|
|
105
|
+
&:disabled {
|
|
106
|
+
cursor: not-allowed;
|
|
107
|
+
opacity: var(--#{sys.$prefix}opacity-disabled);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// ---------------------------------------------------------------------------
|
|
112
|
+
// Indicator (StepIndicator wrapper)
|
|
113
|
+
// ---------------------------------------------------------------------------
|
|
114
|
+
|
|
115
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}steplist__indicator {
|
|
116
|
+
flex-shrink: 0;
|
|
117
|
+
margin-top: 0.325em; // Slight offset to align with text baseline
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// ---------------------------------------------------------------------------
|
|
121
|
+
// Content
|
|
122
|
+
// ---------------------------------------------------------------------------
|
|
123
|
+
|
|
124
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}steplist__content {
|
|
125
|
+
flex: 1;
|
|
126
|
+
min-width: 0; // Allow text truncation/wrapping
|
|
127
|
+
line-height: var(--#{sys.$prefix}line-height-normal, 1.5);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
@use "../system" as sys;
|
|
2
|
+
|
|
3
|
+
/* @tui-tokens
|
|
4
|
+
--tui-switch-accent
|
|
5
|
+
--tui-switch-bg
|
|
6
|
+
--tui-switch-border
|
|
7
|
+
--tui-switch-border-width
|
|
8
|
+
--tui-switch-thumb-bg
|
|
9
|
+
--tui-switch-thumb-size
|
|
10
|
+
--tui-switch-track-height
|
|
11
|
+
--tui-switch-track-width
|
|
12
|
+
--tui-switch-size
|
|
13
|
+
--tui-switch-label-color
|
|
14
|
+
--tui-switch-font-size
|
|
15
|
+
--tui-switch-gap
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
@mixin styles() {
|
|
19
|
+
// ==========================================================================
|
|
20
|
+
// Switch Component (button role="switch")
|
|
21
|
+
// ==========================================================================
|
|
22
|
+
//
|
|
23
|
+
// Component API tokens (never defined here, only read via fallback):
|
|
24
|
+
// --tui-switch-accent Accent color for on state
|
|
25
|
+
// --tui-switch-bg Track background when off
|
|
26
|
+
// --tui-switch-border Track border color when off
|
|
27
|
+
// --tui-switch-border-width Track border width
|
|
28
|
+
// --tui-switch-thumb-bg Thumb background color
|
|
29
|
+
// --tui-switch-thumb-size Explicit thumb diameter
|
|
30
|
+
// --tui-switch-track-height Track height, border-box (overrides em default)
|
|
31
|
+
// --tui-switch-track-width Track width, border-box (overrides em default)
|
|
32
|
+
// --tui-switch-size Track font-size (controls em-based sizing)
|
|
33
|
+
// --tui-switch-label-color Label text colour
|
|
34
|
+
// --tui-switch-font-size Wrapper font-size (labeled mode)
|
|
35
|
+
// --tui-switch-gap Gap between track and label
|
|
36
|
+
//
|
|
37
|
+
// Geometry: the thumb inset derives from the border-box metrics —
|
|
38
|
+
// (track-height − 2·border-width − thumb-size) / 2 — and both the resting
|
|
39
|
+
// and checked transforms use it, so whitespace around the thumb is even on
|
|
40
|
+
// all four sides for any combination of the metric tokens (e.g. WP admin's
|
|
41
|
+
// 12px thumb in an 18×36 track with a 1px border → 2px inset everywhere).
|
|
42
|
+
//
|
|
43
|
+
// ==========================================================================
|
|
44
|
+
|
|
45
|
+
// Structural constants — ~2:1 aspect ratio (40px × 20px at 14px base font).
|
|
46
|
+
// Em-based so the track scales with --tui-switch-size / size class font-size.
|
|
47
|
+
// Default thumb is track height minus 4px ($_thumb-gutter each side before
|
|
48
|
+
// borders are subtracted), preserving the pre-token visual.
|
|
49
|
+
$_track-width: 2.8575em;
|
|
50
|
+
$_track-height: 1.4285em;
|
|
51
|
+
$_thumb-gutter: 2px;
|
|
52
|
+
|
|
53
|
+
// ---------------------------------------------------------------------------
|
|
54
|
+
// Switch wrapper (with label)
|
|
55
|
+
// ---------------------------------------------------------------------------
|
|
56
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}switch {
|
|
57
|
+
display: inline-flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
gap: var(--#{sys.$prefix}switch-gap, var(--#{sys.$prefix}spacing-xs));
|
|
60
|
+
font-size: var(--#{sys.$prefix}switch-font-size, var(--#{sys.$prefix}typography-size-md));
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
user-select: none;
|
|
63
|
+
|
|
64
|
+
&.is-size-sm { font-size: var(--#{sys.$prefix}typography-size-sm); }
|
|
65
|
+
&.is-size-lg { font-size: var(--#{sys.$prefix}typography-size-lg); }
|
|
66
|
+
|
|
67
|
+
&.is-disabled {
|
|
68
|
+
opacity: var(--#{sys.$prefix}opacity-disabled);
|
|
69
|
+
cursor: not-allowed;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// ---------------------------------------------------------------------------
|
|
74
|
+
// Switch label
|
|
75
|
+
// ---------------------------------------------------------------------------
|
|
76
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}switch__label {
|
|
77
|
+
font-weight: unset;
|
|
78
|
+
line-height: 1.25em;
|
|
79
|
+
font-size: var(--#{sys.$prefix}typography-size-sm);
|
|
80
|
+
color: var(--#{sys.$prefix}switch-label-color, inherit);
|
|
81
|
+
user-select: none;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// ---------------------------------------------------------------------------
|
|
85
|
+
// Switch track (the <button>)
|
|
86
|
+
// ---------------------------------------------------------------------------
|
|
87
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}switch__track {
|
|
88
|
+
// Internal tokens
|
|
89
|
+
--_accent: var(--#{sys.$prefix}switch-accent, var(--#{sys.$prefix}input-accent, var(--#{sys.$prefix}theme-primary-base)));
|
|
90
|
+
--_bg: var(--#{sys.$prefix}switch-bg, var(--#{sys.$prefix}theme-secondary-soft));
|
|
91
|
+
--_border: var(--#{sys.$prefix}switch-border, var(--_bg));
|
|
92
|
+
--_thumb-bg: var(--#{sys.$prefix}switch-thumb-bg, var(--#{sys.$prefix}color-bg));
|
|
93
|
+
--_track-height: var(--#{sys.$prefix}switch-track-height, #{$_track-height});
|
|
94
|
+
--_track-width: var(--#{sys.$prefix}switch-track-width, #{$_track-width});
|
|
95
|
+
--_border-width: var(--#{sys.$prefix}switch-border-width, var(--#{sys.$prefix}border-width));
|
|
96
|
+
--_thumb-size: var(
|
|
97
|
+
--#{sys.$prefix}switch-thumb-size,
|
|
98
|
+
calc(var(--_track-height) - #{$_thumb-gutter * 2})
|
|
99
|
+
);
|
|
100
|
+
// Even whitespace on all four sides, derived from the border-box metrics.
|
|
101
|
+
--_thumb-inset: calc(
|
|
102
|
+
(var(--_track-height) - 2 * var(--_border-width) - var(--_thumb-size)) / 2
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
// Size variants (bare track, without wrapper)
|
|
106
|
+
font-size: var(--#{sys.$prefix}switch-size, var(--#{sys.$prefix}typography-size-md));
|
|
107
|
+
&.is-size-sm { font-size: var(--#{sys.$prefix}typography-size-sm); }
|
|
108
|
+
&.is-size-lg { font-size: var(--#{sys.$prefix}typography-size-lg); }
|
|
109
|
+
|
|
110
|
+
position: relative;
|
|
111
|
+
display: inline-flex;
|
|
112
|
+
align-items: center;
|
|
113
|
+
flex-shrink: 0;
|
|
114
|
+
width: var(--_track-width);
|
|
115
|
+
height: var(--_track-height);
|
|
116
|
+
border-radius: 9999px;
|
|
117
|
+
border: var(--_border-width) solid var(--_border);
|
|
118
|
+
background-color: var(--_bg);
|
|
119
|
+
padding: 0;
|
|
120
|
+
cursor: pointer;
|
|
121
|
+
appearance: none;
|
|
122
|
+
font: inherit;
|
|
123
|
+
|
|
124
|
+
transition-duration: var(--#{sys.$prefix}motion-duration);
|
|
125
|
+
transition-timing-function: var(--#{sys.$prefix}motion-timing);
|
|
126
|
+
transition-property: background-color, border-color;
|
|
127
|
+
|
|
128
|
+
&:focus-visible {
|
|
129
|
+
outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
|
|
130
|
+
outline-offset: var(--#{sys.$prefix}focus-ring-offset);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&:disabled {
|
|
134
|
+
cursor: not-allowed;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Checked state
|
|
138
|
+
&[aria-checked="true"] {
|
|
139
|
+
background-color: var(--_accent);
|
|
140
|
+
border-color: var(--_accent);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Invalid state — danger border for visual feedback alongside aria-invalid.
|
|
144
|
+
// Only the border changes; the checked accent stays so the track remains
|
|
145
|
+
// legible against the thumb.
|
|
146
|
+
&[aria-invalid="true"] {
|
|
147
|
+
--_border: var(--#{sys.$prefix}theme-danger-base);
|
|
148
|
+
|
|
149
|
+
&[aria-checked="true"] {
|
|
150
|
+
border-color: var(--#{sys.$prefix}theme-danger-base);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// ---------------------------------------------------------------------------
|
|
156
|
+
// Switch thumb
|
|
157
|
+
// ---------------------------------------------------------------------------
|
|
158
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}switch__thumb {
|
|
159
|
+
display: block;
|
|
160
|
+
width: var(--_thumb-size);
|
|
161
|
+
height: var(--_thumb-size);
|
|
162
|
+
border-radius: 50%;
|
|
163
|
+
background-color: var(--_thumb-bg);
|
|
164
|
+
transform: translateX(var(--_thumb-inset));
|
|
165
|
+
transition-duration: var(--#{sys.$prefix}motion-duration);
|
|
166
|
+
transition-timing-function: var(--#{sys.$prefix}motion-timing);
|
|
167
|
+
transition-property: transform;
|
|
168
|
+
pointer-events: none;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Checked: slide thumb to inline-end
|
|
172
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}switch__track[aria-checked="true"] .#{sys.$prefix}switch__thumb {
|
|
173
|
+
transform: translateX(
|
|
174
|
+
calc(
|
|
175
|
+
var(--_track-width) - 2 * var(--_border-width) - var(--_thumb-size) - var(--_thumb-inset)
|
|
176
|
+
)
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// ---------------------------------------------------------------------------
|
|
181
|
+
// Forced colors (Windows High Contrast Mode)
|
|
182
|
+
// ---------------------------------------------------------------------------
|
|
183
|
+
|
|
184
|
+
@media (forced-colors: active) {
|
|
185
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}switch__track {
|
|
186
|
+
forced-color-adjust: none;
|
|
187
|
+
// Explicit 2px border — WHCM needs real pixel values; token references
|
|
188
|
+
// may resolve to 0 or be overridden, breaking the visible track outline.
|
|
189
|
+
// The internal width token must match so the derived thumb inset and
|
|
190
|
+
// transforms track the real border (previously the thumb misaligned
|
|
191
|
+
// in WHCM because the transform still used the 1px token).
|
|
192
|
+
--_border-width: 2px;
|
|
193
|
+
border: var(--_border-width) solid CanvasText;
|
|
194
|
+
background-color: Canvas;
|
|
195
|
+
|
|
196
|
+
&[aria-checked="true"] {
|
|
197
|
+
background-color: Highlight;
|
|
198
|
+
border-color: Highlight;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Use ButtonText for focus ring — distinguishable from Highlight track
|
|
202
|
+
// across all forced-colour palettes (including "High Contrast White"
|
|
203
|
+
// where CanvasText and Highlight can have insufficient contrast).
|
|
204
|
+
&:focus-visible {
|
|
205
|
+
outline-color: ButtonText;
|
|
206
|
+
outline-offset: 3px;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}switch__thumb {
|
|
211
|
+
background-color: CanvasText;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}switch__track[aria-checked="true"] .#{sys.$prefix}switch__thumb {
|
|
215
|
+
background-color: HighlightText;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// ---------------------------------------------------------------------------
|
|
220
|
+
// Reduced motion
|
|
221
|
+
// ---------------------------------------------------------------------------
|
|
222
|
+
|
|
223
|
+
@media (prefers-reduced-motion: reduce) {
|
|
224
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}switch__track,
|
|
225
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}switch__thumb {
|
|
226
|
+
transition: none;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
@use "../system" as sys;
|
|
2
|
+
|
|
3
|
+
/* @tui-tokens
|
|
4
|
+
--tui-table-border
|
|
5
|
+
--tui-table-bg
|
|
6
|
+
--tui-table-bg-head
|
|
7
|
+
--tui-table-fg
|
|
8
|
+
--tui-table-padding
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
@mixin styles() {
|
|
12
|
+
// ==========================================================================
|
|
13
|
+
// Table Component
|
|
14
|
+
// ==========================================================================
|
|
15
|
+
//
|
|
16
|
+
// Component API tokens (never defined here, only read via fallback):
|
|
17
|
+
// --tui-table-border Border color
|
|
18
|
+
// --tui-table-bg Background color
|
|
19
|
+
// --tui-table-bg-head Header background color
|
|
20
|
+
// --tui-table-fg Text color
|
|
21
|
+
// --tui-table-padding Cell padding
|
|
22
|
+
//
|
|
23
|
+
// To override from consuming code:
|
|
24
|
+
// .my-context .tui-table { --tui-table-border: hotpink; }
|
|
25
|
+
//
|
|
26
|
+
// ==========================================================================
|
|
27
|
+
|
|
28
|
+
:where(.#{sys.$prefix}interface) {
|
|
29
|
+
.#{sys.$prefix}table {
|
|
30
|
+
// Internal tokens — read component API with fallback to primitives
|
|
31
|
+
--_border: var(--#{sys.$prefix}table-border, var(--#{sys.$prefix}color-border));
|
|
32
|
+
--_bg: var(--#{sys.$prefix}table-bg, transparent);
|
|
33
|
+
--_bg-head: var(--#{sys.$prefix}table-bg-head, var(--#{sys.$prefix}color-bg-surface));
|
|
34
|
+
--_fg: var(--#{sys.$prefix}table-fg, var(--#{sys.$prefix}color-fg));
|
|
35
|
+
--_padding: var(--#{sys.$prefix}table-padding, var(--#{sys.$prefix}spacing-sm));
|
|
36
|
+
|
|
37
|
+
font-size: var(--#{sys.$prefix}typography-size-md);
|
|
38
|
+
width: 100%;
|
|
39
|
+
border-collapse: collapse;
|
|
40
|
+
border-bottom: var(--#{sys.$prefix}border-width) solid var(--_border);
|
|
41
|
+
background: var(--_bg);
|
|
42
|
+
|
|
43
|
+
&__bulkActions {
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
gap: var(--#{sys.$prefix}spacing-sm);
|
|
47
|
+
padding-inline: var(--_padding);
|
|
48
|
+
padding-block: var(--_padding);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&__sortButton {
|
|
52
|
+
padding: unset;
|
|
53
|
+
display: inline-flex;
|
|
54
|
+
gap: 0.5em;
|
|
55
|
+
color: inherit;
|
|
56
|
+
background-color: transparent;
|
|
57
|
+
text-transform: inherit;
|
|
58
|
+
font-size: inherit;
|
|
59
|
+
font-weight: inherit;
|
|
60
|
+
border-radius: var(--#{sys.$prefix}radius-sm);
|
|
61
|
+
|
|
62
|
+
&:focus-visible {
|
|
63
|
+
outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
|
|
64
|
+
outline-offset: var(--#{sys.$prefix}focus-ring-offset);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&__icon {
|
|
68
|
+
min-width: 1em;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Selection checkboxes
|
|
73
|
+
input[type="checkbox"] {
|
|
74
|
+
accent-color: var(--#{sys.$prefix}theme-primary-base);
|
|
75
|
+
|
|
76
|
+
&:focus-visible {
|
|
77
|
+
outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
|
|
78
|
+
outline-offset: var(--#{sys.$prefix}focus-ring-offset);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Selected row highlight
|
|
83
|
+
.#{sys.$prefix}table__row.is-selected {
|
|
84
|
+
td,
|
|
85
|
+
.#{sys.$prefix}table__cell--body {
|
|
86
|
+
background-color: var(--#{sys.$prefix}color-bg-surface-alt);
|
|
87
|
+
// Left border accent for non-color-only indication
|
|
88
|
+
&:first-child {
|
|
89
|
+
box-shadow: inset 3px 0 0 var(--#{sys.$prefix}theme-primary-base);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&__head,
|
|
95
|
+
&__foot,
|
|
96
|
+
thead,
|
|
97
|
+
tfoot {
|
|
98
|
+
text-align: left;
|
|
99
|
+
|
|
100
|
+
.#{sys.$prefix}table__cell,
|
|
101
|
+
th,
|
|
102
|
+
td {
|
|
103
|
+
color: var(--_fg);
|
|
104
|
+
background-color: var(--_bg-head);
|
|
105
|
+
text-transform: uppercase;
|
|
106
|
+
font-size: var(--#{sys.$prefix}typography-size-sm);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&__body,
|
|
111
|
+
&__foot,
|
|
112
|
+
tbody,
|
|
113
|
+
tfoot {
|
|
114
|
+
.#{sys.$prefix}table__cell,
|
|
115
|
+
th,
|
|
116
|
+
td {
|
|
117
|
+
border-top: var(--#{sys.$prefix}border-width) solid var(--_border);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&__cell,
|
|
122
|
+
th,
|
|
123
|
+
td {
|
|
124
|
+
padding-inline: var(--_padding);
|
|
125
|
+
padding-block: var(--_padding);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.#{sys.$prefix}button {
|
|
129
|
+
min-width: max-content;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Container for horizontal scrolling (tbody can't scroll)
|
|
134
|
+
.#{sys.$prefix}table-container {
|
|
135
|
+
overflow-x: auto;
|
|
136
|
+
-webkit-overflow-scrolling: touch;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|