@tangible/ui 0.2.16 → 0.2.18
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/Sidebar/Sidebar.d.ts +19 -1
- package/components/Sidebar/Sidebar.js +110 -3
- package/components/Sidebar/index.d.ts +2 -1
- package/components/Sidebar/index.js +1 -0
- package/components/Sidebar/types.d.ts +68 -0
- package/components/Sidebar/types.js +4 -1
- package/components/index.d.ts +2 -2
- package/components/index.js +1 -1
- package/figma-tokens.json +1 -1
- package/package.json +1 -1
- package/skills/building-with-tui/SKILL.md +20 -1
- package/styles/all.css +1 -1
- package/styles/all.expanded.css +48 -1
- package/styles/all.expanded.unlayered.css +48 -1
- package/styles/all.unlayered.css +1 -1
- package/styles/components/segmented-control.scss +43 -1
- package/styles/components/sidebar.scss +83 -0
- package/tui-manifest.json +21 -2
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
--tui-segmented-item-fg
|
|
12
12
|
--tui-segmented-item-bg-active
|
|
13
13
|
--tui-segmented-item-fg-active
|
|
14
|
+
--tui-segmented-item-border-active
|
|
14
15
|
--tui-segmented-indicator
|
|
15
16
|
--tui-segmented-indicator-size
|
|
16
17
|
*/
|
|
@@ -31,6 +32,7 @@
|
|
|
31
32
|
// --tui-segmented-item-fg Item foreground (inactive)
|
|
32
33
|
// --tui-segmented-item-bg-active Item background (active)
|
|
33
34
|
// --tui-segmented-item-fg-active Item foreground (active)
|
|
35
|
+
// --tui-segmented-item-border-active Item border (active, outline variant)
|
|
34
36
|
// --tui-segmented-indicator Underline indicator color
|
|
35
37
|
// --tui-segmented-indicator-size Underline indicator thickness
|
|
36
38
|
//
|
|
@@ -188,16 +190,56 @@
|
|
|
188
190
|
--_item-border: var(--#{sys.$prefix}segmented-border, var(--#{sys.$prefix}color-border));
|
|
189
191
|
--_item-bg-active: var(--#{sys.$prefix}segmented-item-bg-active, var(--#{sys.$prefix}theme-primary-subtlest));
|
|
190
192
|
--_item-fg-active: var(--#{sys.$prefix}segmented-item-fg-active, var(--#{sys.$prefix}theme-primary-strong));
|
|
193
|
+
// The selected border is this variant's whole selection indicator, so it
|
|
194
|
+
// needs its own API token like the fill and text already have. Reading the
|
|
195
|
+
// theme token directly meant a consumer recolouring one item by value could
|
|
196
|
+
// move the fill and the text but not the border it sits in — and the rule
|
|
197
|
+
// below is (0,5,0), so overriding it needed a border-color declaration
|
|
198
|
+
// heavier than anything the token layer offers.
|
|
199
|
+
--_item-border-active: var(--#{sys.$prefix}segmented-item-border-active, var(--#{sys.$prefix}theme-primary-base));
|
|
191
200
|
|
|
192
201
|
border: var(--#{sys.$prefix}border-width) solid var(--_item-border);
|
|
193
202
|
|
|
194
203
|
&[aria-checked="true"] {
|
|
195
|
-
border-color: var(
|
|
204
|
+
border-color: var(--_item-border-active);
|
|
196
205
|
background: var(--_item-bg-active);
|
|
197
206
|
color: var(--_item-fg-active);
|
|
198
207
|
}
|
|
199
208
|
}
|
|
200
209
|
|
|
210
|
+
// ---------------------------------------------------------------------------
|
|
211
|
+
// Outline variant — dark mode contrast correction
|
|
212
|
+
// ---------------------------------------------------------------------------
|
|
213
|
+
// The light defaults are fine (text 7.81:1, border 7.52:1). In dark mode the
|
|
214
|
+
// ladder lightens and the same two rungs fall under threshold against the
|
|
215
|
+
// dark page: the selected text reads 4.45:1 on the -subtlest fill (AA wants
|
|
216
|
+
// 4.5) and the selected border 2.64:1 against the page (SC 1.4.11 wants 3.0
|
|
217
|
+
// for a non-text indicator — and here the border IS the indicator). Stepping
|
|
218
|
+
// each one rung fixes both: text 6.50:1, border 3.60:1.
|
|
219
|
+
//
|
|
220
|
+
// Only the FALLBACKS move, so any consumer token still wins. Scoped exactly
|
|
221
|
+
// as Avatar scopes its own dark correction, including the nested-interface
|
|
222
|
+
// arm, so a nested .tui-interface without its own data-theme inherits it.
|
|
223
|
+
|
|
224
|
+
// Written out twice rather than shared through a mixin: this whole file is
|
|
225
|
+
// already inside `@mixin styles()`, and Sass forbids a mixin declaration
|
|
226
|
+
// inside a mixin. Avatar's dark correction duplicates for the same reason.
|
|
227
|
+
|
|
228
|
+
.#{sys.$prefix}interface[data-theme="dark"] .#{sys.$prefix}segmented.is-variant-outline .#{sys.$prefix}segmented__item,
|
|
229
|
+
.#{sys.$prefix}interface[data-theme="dark"] :where(.#{sys.$prefix}interface) .#{sys.$prefix}segmented.is-variant-outline .#{sys.$prefix}segmented__item {
|
|
230
|
+
--_item-fg-active: var(--#{sys.$prefix}segmented-item-fg-active, var(--#{sys.$prefix}theme-primary-stronger));
|
|
231
|
+
--_item-border-active: var(--#{sys.$prefix}segmented-item-border-active, var(--#{sys.$prefix}theme-primary-strong));
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
@media (prefers-color-scheme: dark) {
|
|
235
|
+
.#{sys.$prefix}interface[data-theme="auto"] .#{sys.$prefix}segmented.is-variant-outline .#{sys.$prefix}segmented__item,
|
|
236
|
+
.#{sys.$prefix}interface[data-theme="auto"] :where(.#{sys.$prefix}interface) .#{sys.$prefix}segmented.is-variant-outline .#{sys.$prefix}segmented__item {
|
|
237
|
+
--_item-fg-active: var(--#{sys.$prefix}segmented-item-fg-active, var(--#{sys.$prefix}theme-primary-stronger));
|
|
238
|
+
--_item-border-active: var(--#{sys.$prefix}segmented-item-border-active, var(--#{sys.$prefix}theme-primary-strong));
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
|
|
201
243
|
// ---------------------------------------------------------------------------
|
|
202
244
|
// Variant: Underline — Item Overrides
|
|
203
245
|
// ---------------------------------------------------------------------------
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
/* @tui-tokens
|
|
4
4
|
--tui-sidebar-width
|
|
5
|
+
--tui-sidebar-collapsed-width
|
|
5
6
|
--tui-sidebar-bg
|
|
6
7
|
--tui-sidebar-border
|
|
7
8
|
--tui-sidebar-divider
|
|
@@ -16,6 +17,7 @@
|
|
|
16
17
|
//
|
|
17
18
|
// Component API tokens (never defined here, only read via fallback):
|
|
18
19
|
// --tui-sidebar-width Fixed sidebar width
|
|
20
|
+
// --tui-sidebar-collapsed-width Width of the collapsed rail
|
|
19
21
|
// --tui-sidebar-bg Background color
|
|
20
22
|
// --tui-sidebar-border Edge border color (docked left/right edge)
|
|
21
23
|
// --tui-sidebar-divider Header/footer divider color
|
|
@@ -111,6 +113,87 @@
|
|
|
111
113
|
padding: var(--_padding);
|
|
112
114
|
}
|
|
113
115
|
|
|
116
|
+
// ---------------------------------------------------------------------------
|
|
117
|
+
// Collapsed rail
|
|
118
|
+
// ---------------------------------------------------------------------------
|
|
119
|
+
//
|
|
120
|
+
// `collapsible` narrows the sidebar to a rail wide enough for one control.
|
|
121
|
+
// Header, Nav and Footer go; anything else the consumer put directly in
|
|
122
|
+
// the sidebar — the toggle, an icon rail — stays. `display: none` rather
|
|
123
|
+
// than a zero width so the hidden regions leave the tab order and the
|
|
124
|
+
// accessibility tree with it: a rail you can still Tab into is a trap.
|
|
125
|
+
//
|
|
126
|
+
// Written as a top-level rule spelling out the hierarchy. Nesting this as
|
|
127
|
+
// `[data-collapsed="true"] &` would splice `.tui-interface` after the
|
|
128
|
+
// attribute and match nothing — the same trap that killed the drawer
|
|
129
|
+
// animations before 0.2.8.
|
|
130
|
+
|
|
131
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}sidebar[data-collapsed] {
|
|
132
|
+
transition: width var(--#{sys.$prefix}motion-duration) var(--#{sys.$prefix}motion-timing);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}sidebar[data-collapsed="true"] {
|
|
136
|
+
--_width: var(--#{sys.$prefix}sidebar-collapsed-width, 4.5rem);
|
|
137
|
+
|
|
138
|
+
align-items: center;
|
|
139
|
+
padding-block: var(--_padding);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
:where(.#{sys.$prefix}interface)
|
|
143
|
+
.#{sys.$prefix}sidebar[data-collapsed="true"]
|
|
144
|
+
> :is(
|
|
145
|
+
.#{sys.$prefix}sidebar__header,
|
|
146
|
+
.#{sys.$prefix}sidebar__nav,
|
|
147
|
+
.#{sys.$prefix}sidebar__footer
|
|
148
|
+
) {
|
|
149
|
+
display: none;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@media (prefers-reduced-motion: reduce) {
|
|
153
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}sidebar[data-collapsed] {
|
|
154
|
+
transition: none;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// ---------------------------------------------------------------------------
|
|
159
|
+
// Toggle
|
|
160
|
+
// ---------------------------------------------------------------------------
|
|
161
|
+
//
|
|
162
|
+
// Sits at the sidebar's content-facing edge while expanded — the edge the
|
|
163
|
+
// collapse travels towards — and centres itself once there is only a rail
|
|
164
|
+
// left to sit in.
|
|
165
|
+
//
|
|
166
|
+
// Full specificity, not `:where()`. The toggle IS an IconButton, whose own
|
|
167
|
+
// base rule is `.tui-interface .tui-icon-button` (0,2,0) and resets
|
|
168
|
+
// `margin: 0`. A (0,1,0) host rule loses to it outright, so the margin
|
|
169
|
+
// below would be dead CSS and the toggle would sit flush in the corner.
|
|
170
|
+
// At (0,2,0) the two tie and Sidebar wins on bundle order, which is why
|
|
171
|
+
// the house convention puts host rules at full specificity.
|
|
172
|
+
|
|
173
|
+
.#{sys.$prefix}interface .#{sys.$prefix}sidebar__toggle {
|
|
174
|
+
flex-shrink: 0;
|
|
175
|
+
margin: var(--_padding);
|
|
176
|
+
margin-block-end: 0;
|
|
177
|
+
align-self: flex-end;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.#{sys.$prefix}interface
|
|
181
|
+
.#{sys.$prefix}sidebar[data-position="right"]
|
|
182
|
+
> .#{sys.$prefix}sidebar__toggle {
|
|
183
|
+
align-self: flex-start;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// The collapsed root supplies its own `padding-block`, so the toggle drops
|
|
187
|
+
// its block-start margin rather than stacking on top of it — otherwise the
|
|
188
|
+
// control visibly steps down the rail as the sidebar collapses.
|
|
189
|
+
.#{sys.$prefix}interface
|
|
190
|
+
.#{sys.$prefix}sidebar[data-collapsed="true"]
|
|
191
|
+
> .#{sys.$prefix}sidebar__toggle {
|
|
192
|
+
align-self: center;
|
|
193
|
+
margin-inline: 0;
|
|
194
|
+
margin-block-start: 0;
|
|
195
|
+
}
|
|
196
|
+
|
|
114
197
|
// ---------------------------------------------------------------------------
|
|
115
198
|
// Drawer Mode
|
|
116
199
|
// ---------------------------------------------------------------------------
|
package/tui-manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.2.
|
|
3
|
-
"generated": "2026-08-
|
|
2
|
+
"version": "0.2.18",
|
|
3
|
+
"generated": "2026-08-30T20:29:02.985Z",
|
|
4
4
|
"components": {
|
|
5
5
|
"Accordion": {
|
|
6
6
|
"props": {
|
|
@@ -2962,6 +2962,7 @@
|
|
|
2962
2962
|
"--tui-segmented-item-fg",
|
|
2963
2963
|
"--tui-segmented-item-bg-active",
|
|
2964
2964
|
"--tui-segmented-item-fg-active",
|
|
2965
|
+
"--tui-segmented-item-border-active",
|
|
2965
2966
|
"--tui-segmented-indicator",
|
|
2966
2967
|
"--tui-segmented-indicator-size"
|
|
2967
2968
|
],
|
|
@@ -3137,6 +3138,23 @@
|
|
|
3137
3138
|
"defaultValue": "false",
|
|
3138
3139
|
"description": "Enable drawer mode (mobile overlay).\nEnable drawer mode (mobile overlay).\nWhen true, sidebar renders with backdrop, focus trap, and dialog semantics."
|
|
3139
3140
|
},
|
|
3141
|
+
"collapsible": {
|
|
3142
|
+
"type": "boolean",
|
|
3143
|
+
"required": false,
|
|
3144
|
+
"defaultValue": "false",
|
|
3145
|
+
"description": "Opt into the collapsed rail: the sidebar can shrink to\n`--tui-sidebar-collapsed-width`, hiding Header, Nav and Footer while\nleaving any other child — a `Sidebar.Toggle`, an icon rail — visible.\n\nDeliberately absent from drawer mode: a drawer is already a\nshow/hide overlay, and a rail inside one has nothing to sit beside."
|
|
3146
|
+
},
|
|
3147
|
+
"collapsed": {
|
|
3148
|
+
"type": "boolean",
|
|
3149
|
+
"required": false,
|
|
3150
|
+
"description": "Collapsed state (controlled). Pair with `onCollapsedChange`.\nLeave undefined to let the sidebar own the state."
|
|
3151
|
+
},
|
|
3152
|
+
"defaultCollapsed": {
|
|
3153
|
+
"type": "boolean",
|
|
3154
|
+
"required": false,
|
|
3155
|
+
"defaultValue": "false",
|
|
3156
|
+
"description": "Initial collapsed state when uncontrolled."
|
|
3157
|
+
},
|
|
3140
3158
|
"open": {
|
|
3141
3159
|
"type": "boolean",
|
|
3142
3160
|
"required": false,
|
|
@@ -3150,6 +3168,7 @@
|
|
|
3150
3168
|
},
|
|
3151
3169
|
"cssTokens": [
|
|
3152
3170
|
"--tui-sidebar-width",
|
|
3171
|
+
"--tui-sidebar-collapsed-width",
|
|
3153
3172
|
"--tui-sidebar-bg",
|
|
3154
3173
|
"--tui-sidebar-border",
|
|
3155
3174
|
"--tui-sidebar-divider",
|