@tangible/ui 0.2.24 → 0.2.25

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.
@@ -22,6 +22,16 @@
22
22
  --tui-nav-menu-indicator-color
23
23
  --tui-nav-menu-sub-indent
24
24
  --tui-nav-menu-sub-border
25
+ --tui-nav-menu-bar-gap
26
+ --tui-nav-menu-bar-bg-current
27
+ --tui-nav-menu-underline-width
28
+ --tui-nav-menu-underline-color
29
+ --tui-nav-menu-flyout-bg
30
+ --tui-nav-menu-flyout-fg
31
+ --tui-nav-menu-flyout-border
32
+ --tui-nav-menu-flyout-radius
33
+ --tui-nav-menu-flyout-shadow
34
+ --tui-nav-menu-flyout-min-width
25
35
  */
26
36
 
27
37
  @mixin styles() {
@@ -55,6 +65,18 @@
55
65
  // --tui-nav-menu-indicator-color That bar's colour
56
66
  // --tui-nav-menu-sub-indent / -border Nested list indent and guide line
57
67
  //
68
+ // Horizontal (orientation="horizontal"):
69
+ // --tui-nav-menu-bar-gap Space between bar items and clusters
70
+ // --tui-nav-menu-bar-bg-current Current bar item fill (default: none)
71
+ // --tui-nav-menu-underline-width / -color
72
+ // The current bar item's underline
73
+ // (default 2px, primary-base). Also marks
74
+ // an ancestor, since its page is in the
75
+ // flyout.
76
+ // --tui-nav-menu-flyout-{bg,fg,border,radius,shadow,min-width}
77
+ // The flyout panel (an elevated surface
78
+ // that owns its fg)
79
+ //
58
80
  // !important on the row's color, font-weight and text-decoration, the
59
81
  // Button precedent: rows are usually <a>, and hosts (WordPress themes, and
60
82
  // Storybook's own preview.css) style bare `a` unlayered, which beats every
@@ -191,12 +213,163 @@
191
213
  border-inline-start: var(--#{sys.$prefix}border-width) solid var(--#{sys.$prefix}nav-menu-sub-border, var(--#{sys.$prefix}color-border));
192
214
  }
193
215
 
216
+ // ==========================================================================
217
+ // Horizontal bar
218
+ // ==========================================================================
219
+ // Bar rows carry .is-bar (set by the component on top-level rows only), so
220
+ // nothing below reaches the rows inside a flyout, which keep the vertical
221
+ // treatment.
222
+
223
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}nav-menu.is-horizontal {
224
+ flex-direction: row;
225
+ flex-wrap: wrap;
226
+ align-items: center;
227
+ gap: var(--#{sys.$prefix}nav-menu-bar-gap, var(--#{sys.$prefix}spacing-xs));
228
+
229
+ // Wraps rather than overflowing (SC 1.4.10). The small-screen pattern is
230
+ // still to swap the bar for a Sidebar drawer; this keeps it from
231
+ // scrolling sideways meanwhile.
232
+ > .#{sys.$prefix}nav-menu__group > .#{sys.$prefix}nav-menu__list {
233
+ flex-direction: row;
234
+ flex-wrap: wrap;
235
+ align-items: center;
236
+ gap: var(--#{sys.$prefix}nav-menu-bar-gap, var(--#{sys.$prefix}spacing-xs));
237
+ }
238
+ }
239
+
240
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}nav-menu__entry.has-flyout {
241
+ position: relative;
242
+ }
243
+
244
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}nav-menu__entry.is-split {
245
+ display: flex;
246
+ align-items: center;
247
+ }
248
+
249
+ .#{sys.$prefix}interface .#{sys.$prefix}nav-menu__item.is-bar {
250
+ inline-size: auto;
251
+ white-space: nowrap;
252
+
253
+ // Current page, or an ancestor of it (whose page is inside the flyout):
254
+ // strong text, weight and an underline. No fill by default.
255
+ &[aria-current] {
256
+ --_bg: var(--#{sys.$prefix}nav-menu-bar-bg-current, transparent);
257
+ --_fg: var(--#{sys.$prefix}nav-menu-item-fg-current, var(--#{sys.$prefix}theme-primary-strong));
258
+ --_weight: var(--#{sys.$prefix}nav-menu-item-weight-current, var(--#{sys.$prefix}typography-weight-semibold, 600));
259
+
260
+ // The vertical leading bar doesn't apply in a bar.
261
+ &::before { content: none; }
262
+
263
+ &::after {
264
+ content: "";
265
+ position: absolute;
266
+ inset-inline: var(--_item-pad, var(--#{sys.$prefix}nav-menu-item-padding-inline, var(--#{sys.$prefix}spacing-sm)));
267
+ inset-block-end: 0;
268
+ block-size: var(--#{sys.$prefix}nav-menu-underline-width, 2px);
269
+ border-radius: var(--#{sys.$prefix}radius-full, 9999px);
270
+ background: var(--#{sys.$prefix}nav-menu-underline-color, var(--#{sys.$prefix}theme-primary-base));
271
+ }
272
+ }
273
+ }
274
+
275
+ // The row-is-the-toggle chevron, and the separate toggle of a link parent.
276
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}nav-menu__chevron {
277
+ display: inline-flex;
278
+ flex: none;
279
+ font-size: var(--#{sys.$prefix}nav-menu-icon-size, var(--#{sys.$prefix}icon-size-sm, 1rem));
280
+ transition: transform var(--#{sys.$prefix}motion-duration) var(--#{sys.$prefix}motion-timing);
281
+ }
282
+
283
+ :where(.#{sys.$prefix}interface) [aria-expanded="true"] > .#{sys.$prefix}nav-menu__chevron {
284
+ transform: rotate(180deg);
285
+ }
286
+
287
+ .#{sys.$prefix}interface .#{sys.$prefix}nav-menu__toggle {
288
+ display: inline-flex;
289
+ align-items: center;
290
+ justify-content: center;
291
+ box-sizing: border-box;
292
+ // At least the 24px target minimum (SC 2.5.8), as tall as the row.
293
+ min-inline-size: 1.5rem;
294
+ min-block-size: var(--#{sys.$prefix}nav-menu-item-height, var(--#{sys.$prefix}control-height-md, 2.5rem));
295
+ margin: 0;
296
+ padding-inline: var(--#{sys.$prefix}spacing-xxs);
297
+ border: 0;
298
+ border-radius: var(--#{sys.$prefix}nav-menu-item-radius, var(--#{sys.$prefix}radius-sm));
299
+ background: transparent;
300
+ color: var(--#{sys.$prefix}nav-menu-item-fg, var(--#{sys.$prefix}color-fg)) !important;
301
+ cursor: pointer;
302
+
303
+ &:hover {
304
+ background: var(--#{sys.$prefix}nav-menu-item-bg-hover, var(--#{sys.$prefix}color-fill-subtle));
305
+ }
306
+
307
+ &:focus-visible {
308
+ outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
309
+ outline-offset: calc(-1 * var(--#{sys.$prefix}focus-ring-width));
310
+ }
311
+ }
312
+
313
+ // ==========================================================================
314
+ // Flyout panel
315
+ // ==========================================================================
316
+ // Positioned by Floating UI (inline styles), not portaled, so the DOM and
317
+ // tab order run toggle -> panel. An elevated surface, so it owns its fg.
318
+
319
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}nav-menu__flyout {
320
+ z-index: var(--#{sys.$prefix}layer-overlay, 100);
321
+ display: flex;
322
+ flex-direction: column;
323
+ gap: var(--#{sys.$prefix}nav-menu-group-gap, var(--#{sys.$prefix}spacing-sm));
324
+ box-sizing: border-box;
325
+ min-inline-size: var(--#{sys.$prefix}nav-menu-flyout-min-width, 14rem);
326
+ padding: var(--#{sys.$prefix}spacing-xxs);
327
+ border: var(--#{sys.$prefix}border-width) solid var(--#{sys.$prefix}nav-menu-flyout-border, var(--#{sys.$prefix}color-border));
328
+ border-radius: var(--#{sys.$prefix}nav-menu-flyout-radius, var(--#{sys.$prefix}radius-md));
329
+ background: var(--#{sys.$prefix}nav-menu-flyout-bg, var(--#{sys.$prefix}color-bg-elevated));
330
+ color: var(--#{sys.$prefix}nav-menu-flyout-fg, var(--#{sys.$prefix}color-fg));
331
+ box-shadow: var(--#{sys.$prefix}nav-menu-flyout-shadow, var(--#{sys.$prefix}shadow-dropdown));
332
+
333
+ // `display: flex` above would otherwise override the hidden attribute.
334
+ &[hidden] {
335
+ display: none;
336
+ }
337
+
338
+ // The Sub inside a flyout is the panel's content, not an indented branch.
339
+ > .#{sys.$prefix}nav-menu__sub {
340
+ margin: 0;
341
+ padding: 0;
342
+ border: 0;
343
+ }
344
+
345
+ .#{sys.$prefix}nav-menu__sub.has-groups {
346
+ display: flex;
347
+ flex-direction: column;
348
+ gap: var(--#{sys.$prefix}nav-menu-group-gap, var(--#{sys.$prefix}spacing-sm));
349
+ }
350
+ }
351
+
194
352
  @media (forced-colors: active) {
195
353
  .#{sys.$prefix}interface .#{sys.$prefix}nav-menu__item[aria-current="page"] {
196
354
  outline: 2px solid Highlight;
197
355
  outline-offset: -2px;
198
356
  }
199
357
 
358
+ // The bar's underline is a background, which forced colours strip; it's
359
+ // the only current cue for an ancestor, so keep it as Highlight.
360
+ .#{sys.$prefix}interface .#{sys.$prefix}nav-menu__item.is-bar[aria-current]::after {
361
+ forced-color-adjust: none;
362
+ background: Highlight;
363
+ }
364
+
365
+ // Expanded state had no cue but the chevron's rotation. Before the focus
366
+ // rule below, so focus still wins.
367
+ .#{sys.$prefix}interface .#{sys.$prefix}nav-menu__item.is-toggle[aria-expanded="true"],
368
+ .#{sys.$prefix}interface .#{sys.$prefix}nav-menu__toggle[aria-expanded="true"] {
369
+ outline: 2px solid Highlight;
370
+ outline-offset: -2px;
371
+ }
372
+
200
373
  // Focus must stay distinct from the current row's outline: thicker and
201
374
  // outside the row. Without this, the two tie and the current-row rule
202
375
  // wins on order, so focus vanished on the row users land on most (SC 2.4.7).
package/tui-manifest.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "0.2.24",
3
- "generated": "2026-10-02T03:57:30.563Z",
2
+ "version": "0.2.25",
3
+ "generated": "2026-10-02T15:07:08.166Z",
4
4
  "components": {
5
5
  "Accordion": {
6
6
  "props": {
@@ -2079,6 +2079,17 @@
2079
2079
  "onClick": {
2080
2080
  "type": "MouseEventHandler<HTMLDivElement>",
2081
2081
  "required": false
2082
+ },
2083
+ "orientation": {
2084
+ "type": "\"vertical\" | \"horizontal\"",
2085
+ "required": false,
2086
+ "defaultValue": "vertical",
2087
+ "description": "`vertical` (sidebars) stacks groups and nests a `NavMenu.Sub` inline.\n`horizontal` makes a bar: groups become inline clusters (headings visually\nhidden, lists still labelled), and an item with a `NavMenu.Sub` opens it\nas a flyout. A flyout follows the APG disclosure pattern: a button with\n`aria-expanded`, opened by click or Enter/Space (never hover), closed by\nEscape (focus returns to the button), Tab-ing out or clicking elsewhere.\nOne flyout is open at a time. Groups inside a flyout show their headings."
2088
+ },
2089
+ "labels": {
2090
+ "type": "NavMenuLabels",
2091
+ "required": false,
2092
+ "description": "Visually hidden strings."
2082
2093
  }
2083
2094
  },
2084
2095
  "cssTokens": [
@@ -2102,7 +2113,17 @@
2102
2113
  "--tui-nav-menu-indicator-width",
2103
2114
  "--tui-nav-menu-indicator-color",
2104
2115
  "--tui-nav-menu-sub-indent",
2105
- "--tui-nav-menu-sub-border"
2116
+ "--tui-nav-menu-sub-border",
2117
+ "--tui-nav-menu-bar-gap",
2118
+ "--tui-nav-menu-bar-bg-current",
2119
+ "--tui-nav-menu-underline-width",
2120
+ "--tui-nav-menu-underline-color",
2121
+ "--tui-nav-menu-flyout-bg",
2122
+ "--tui-nav-menu-flyout-fg",
2123
+ "--tui-nav-menu-flyout-border",
2124
+ "--tui-nav-menu-flyout-radius",
2125
+ "--tui-nav-menu-flyout-shadow",
2126
+ "--tui-nav-menu-flyout-min-width"
2106
2127
  ],
2107
2128
  "story": {
2108
2129
  "title": "Components/NavMenu",