@tangible/ui 0.2.23 → 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.
Files changed (46) hide show
  1. package/components/Checkbox/Checkbox.js +1 -1
  2. package/components/DatePicker/DateRangePicker.js +1 -1
  3. package/components/Dropdown/Dropdown.js +1 -1
  4. package/components/GradientPicker/GradientPicker.js +3 -3
  5. package/components/NavMenu/NavMenu.d.ts +32 -0
  6. package/components/NavMenu/NavMenu.js +230 -0
  7. package/components/NavMenu/index.d.ts +3 -0
  8. package/components/NavMenu/index.js +2 -0
  9. package/components/NavMenu/types.d.ts +103 -0
  10. package/components/NavMenu/types.js +6 -0
  11. package/components/index.d.ts +2 -0
  12. package/components/index.js +1 -0
  13. package/figma-tokens.json +90 -1
  14. package/package.json +5 -1
  15. package/skills/building-with-tui/SKILL.md +10 -6
  16. package/styles/all.css +1 -1
  17. package/styles/all.expanded.css +546 -64
  18. package/styles/all.expanded.unlayered.css +546 -64
  19. package/styles/all.unlayered.css +1 -1
  20. package/styles/components/_bundle.scss +2 -0
  21. package/styles/components/checkbox.scss +13 -2
  22. package/styles/components/color-picker.scss +12 -4
  23. package/styles/components/combobox.scss +7 -6
  24. package/styles/components/date-picker.scss +8 -6
  25. package/styles/components/dropdown.scss +3 -5
  26. package/styles/components/gradient-picker.scss +3 -5
  27. package/styles/components/input/index.scss +16 -6
  28. package/styles/components/multi-combobox.scss +6 -6
  29. package/styles/components/multi-select.scss +10 -7
  30. package/styles/components/nav-menu.scss +385 -0
  31. package/styles/components/radio.scss +11 -3
  32. package/styles/components/search-select.scss +7 -7
  33. package/styles/components/select.scss +7 -6
  34. package/styles/components/slider.scss +1 -1
  35. package/styles/components/switch.scss +1 -1
  36. package/styles/components/text-input.scss +15 -1
  37. package/styles/core.css +1 -1
  38. package/styles/core.unlayered.css +1 -1
  39. package/styles/index.scss +18 -0
  40. package/styles/system/_constants.scss +0 -6
  41. package/styles/system/_palettes.scss +6 -0
  42. package/styles/system/_text-styles.scss +200 -0
  43. package/styles/system/_tokens.scss +7 -0
  44. package/styles/system/index.scss +3 -1
  45. package/tui-manifest.json +115 -3
  46. package/utils/listbox/group.js +3 -1
@@ -0,0 +1,200 @@
1
+ @use "sass:map";
2
+ @use "sass:meta";
3
+
4
+ // =============================================================================
5
+ // Text styles
6
+ // =============================================================================
7
+ //
8
+ // Named typographic treatments, applied by class: `.tui-text-style-{name}`.
9
+ // Every element using a style renders that one class, so a consumer can
10
+ // restyle (or opt out of) a treatment everywhere with one selector:
11
+ //
12
+ // .tui-text-style-overline { text-transform: none; }
13
+ //
14
+ // Every property is also a knob. Knobs are never declared, only read with
15
+ // fallbacks (like component API tokens), so they can be set anywhere,
16
+ // including :root, and nothing is added to .tui-interface:
17
+ //
18
+ // --tui-text-{style}-{family,size,weight,line-height,tracking,transform,color}
19
+ //
20
+ // Leveled collections (display, headline) also read a collection-wide knob,
21
+ // so one line retunes every level:
22
+ //
23
+ // --tui-text-headline-weight: 700; all six headline levels
24
+ // --tui-text-headline-04-weight: 600; just level 04
25
+ //
26
+ // Colour defaults to `inherit` except for the muted treatments (caption,
27
+ // overline), because .tui-interface deliberately inherits the host's text
28
+ // colour in light mode.
29
+ // =============================================================================
30
+
31
+ // Font stacks. Read through knobs at use sites; never declared.
32
+ $font-stack-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !default;
33
+ $font-stack-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace !default;
34
+
35
+ // Single styles: name → property defaults.
36
+ // Values are raw CSS. A string starting with "@" names a layer-1 primitive
37
+ // (defined on .tui-interface) and resolves to var(--{prefix}{name}).
38
+ $text-styles: (
39
+ body: (
40
+ size: "@typography-size-md",
41
+ weight: 400,
42
+ line-height: 1.5,
43
+ ),
44
+ body-sm: (
45
+ size: "@typography-size-sm",
46
+ weight: 400,
47
+ line-height: 1.45,
48
+ ),
49
+ // Form labels. Matches the existing `label, .tui-label` treatment.
50
+ label: (
51
+ size: "@typography-size-sm",
52
+ weight: 700,
53
+ line-height: 1.4,
54
+ color: "@color-fg",
55
+ ),
56
+ caption: (
57
+ size: "@typography-size-xs",
58
+ weight: 400,
59
+ line-height: 1.4,
60
+ color: "@color-fg-muted",
61
+ ),
62
+ // The small uppercase group label: listbox and menu group labels, the
63
+ // Dropdown header, picker field labels, nav group headings.
64
+ overline: (
65
+ size: "@typography-size-xs",
66
+ weight: 600,
67
+ line-height: 1.4,
68
+ tracking: 0.05em,
69
+ transform: uppercase,
70
+ color: "@color-fg-muted",
71
+ ),
72
+ ) !default;
73
+
74
+ // Leveled collections: shared defaults + per-level overrides. Level 01 is the
75
+ // largest. A level value may be a bare size or a map of overrides.
76
+ $text-collections: (
77
+ display: (
78
+ shared: (weight: 700, line-height: 1.15, tracking: -0.01em),
79
+ levels: (
80
+ 01: 4.5rem,
81
+ 02: 3.75rem,
82
+ 03: 3rem,
83
+ 04: 2.5rem,
84
+ ),
85
+ ),
86
+ headline: (
87
+ shared: (weight: 600, line-height: 1.25),
88
+ levels: (
89
+ 01: 2.25rem,
90
+ 02: 2rem,
91
+ 03: 1.75rem,
92
+ 04: (size: 1.5rem, weight: 500, line-height: 1.3),
93
+ 05: (size: 1.25rem, weight: 500, line-height: 1.35),
94
+ 06: (size: 1.125rem, weight: 500, line-height: 1.4),
95
+ ),
96
+ ),
97
+ ) !default;
98
+
99
+ $-props: (
100
+ family: font-family,
101
+ size: font-size,
102
+ weight: font-weight,
103
+ line-height: line-height,
104
+ tracking: letter-spacing,
105
+ transform: text-transform,
106
+ color: color,
107
+ );
108
+
109
+ $-fallbacks: (
110
+ family: inherit,
111
+ tracking: normal,
112
+ transform: none,
113
+ color: inherit,
114
+ );
115
+
116
+ @function -resolve($prefix, $value) {
117
+ @if meta.type-of($value) == string and str-slice($value, 1, 1) == "@" {
118
+ @return var(--#{$prefix}#{str-slice($value, 2)});
119
+ }
120
+ @return $value;
121
+ }
122
+
123
+ @function -pad($n) {
124
+ @return if($n < 10, "0#{$n}", "#{$n}");
125
+ }
126
+
127
+ // Declarations for one style. $chain is the knob prefixes to try, most
128
+ // specific first (e.g. headline-04, then headline).
129
+ @mixin -declarations($prefix, $chain, $values) {
130
+ @each $key, $prop in $-props {
131
+ $default: map.get($values, $key);
132
+ @if $default == null { $default: map.get($-fallbacks, $key); }
133
+ @if $default != null {
134
+ $value: -resolve($prefix, $default);
135
+ // Size is per level: a collection-wide size would flatten the scale.
136
+ $depth: if($key == size, 1, length($chain));
137
+ @for $i from $depth through 1 {
138
+ $value: var(--#{$prefix}text-#{nth($chain, $i)}-#{$key}, #{$value});
139
+ }
140
+ #{$prop}: $value;
141
+ }
142
+ }
143
+ }
144
+
145
+ // One style's declarations, for component rules. Components use this AND
146
+ // render the class: the mixin keeps static (CSS-only, PHP-rendered) markup
147
+ // styled without the class, the class gives consumers one selector to
148
+ // override every use. Both read the same knobs.
149
+ //
150
+ // @include sys.text-style(sys.$prefix, overline);
151
+ // @include sys.text-style(sys.$prefix, headline, 4);
152
+ @mixin text-style($prefix, $name, $level: null) {
153
+ @if $level == null {
154
+ $values: map.get($text-styles, $name);
155
+ @if $values == null { @error "Unknown text style `#{$name}`."; }
156
+ @include -declarations($prefix, ($name,), $values);
157
+ } @else {
158
+ $collection: map.get($text-collections, $name);
159
+ @if $collection == null { @error "Unknown text collection `#{$name}`."; }
160
+ $spec: map.get(map.get($collection, levels), $level);
161
+ @if $spec == null { @error "Unknown level `#{$level}` for `#{$name}`."; }
162
+ $own: if(meta.type-of($spec) == map, $spec, (size: $spec));
163
+ @include -declarations($prefix, ("#{$name}-#{-pad($level)}", $name), map.merge(map.get($collection, shared), $own));
164
+ }
165
+ }
166
+
167
+ // Emits every `.tui-text-style-*` class. Called inside the defaults layer, so
168
+ // component rules and utilities both win over it.
169
+ @mixin emit-text-styles($prefix) {
170
+ @each $name, $values in $text-styles {
171
+ :where(.#{$prefix}interface) .#{$prefix}text-style-#{$name} {
172
+ @include -declarations($prefix, ($name,), $values);
173
+ }
174
+ }
175
+
176
+ @each $name, $collection in $text-collections {
177
+ $shared: map.get($collection, shared);
178
+ @each $level, $spec in map.get($collection, levels) {
179
+ $id: "#{$name}-#{-pad($level)}";
180
+ $own: if(meta.type-of($spec) == map, $spec, (size: $spec));
181
+ :where(.#{$prefix}interface) .#{$prefix}text-style-#{$id} {
182
+ @include -declarations($prefix, ($id, $name), map.merge($shared, $own));
183
+ }
184
+ }
185
+ }
186
+ }
187
+
188
+ // Opt-in font family utilities: the only way the knobs below take effect,
189
+ // since the knobs themselves are never declared.
190
+ @mixin emit-font-utilities($prefix) {
191
+ :where(.#{$prefix}interface).#{$prefix}font-sans,
192
+ :where(.#{$prefix}interface) .#{$prefix}font-sans {
193
+ font-family: var(--#{$prefix}font-family-sans, #{$font-stack-sans});
194
+ }
195
+
196
+ :where(.#{$prefix}interface).#{$prefix}font-mono,
197
+ :where(.#{$prefix}interface) .#{$prefix}font-mono {
198
+ font-family: var(--#{$prefix}font-family-mono, #{$font-stack-mono});
199
+ }
200
+ }
@@ -87,6 +87,11 @@ $brand: 'blue';
87
87
 
88
88
  /* Neutral: borders/dividers */
89
89
  --#{$prefix}color-border: #{pf.tone($neutral, 300)};
90
+ /* Control boundaries — the border (or off-state fill) that identifies a
91
+ form control. WCAG 1.4.11 wants 3:1 against everything it sits on and
92
+ against the control's own fill. color-border is decorative and can't
93
+ carry that. 450 clears 3.16:1 against white, surface (25) and muted (100). */
94
+ --#{$prefix}color-border-control: #{pf.tone($neutral, 450)};
90
95
  --#{$prefix}color-divider: #{pf.tone($neutral, 200)};
91
96
 
92
97
  /* Neutral: control fills — hover washes, quiet fills, off-state tracks.
@@ -259,6 +264,8 @@ $generative-interact-shift: 0.05 !default; // hover/active darkens by this
259
264
 
260
265
  /* Borders */
261
266
  --#{$prefix}color-border: #{pf.tone($neutral, 750)};
267
+ /* 3.64:1+ against surface 975, faces 950 and elevated/muted 900. */
268
+ --#{$prefix}color-border-control: #{pf.tone($neutral, 500)};
262
269
  --#{$prefix}color-divider: #{pf.tone($neutral, 800)};
263
270
 
264
271
  /* Control fills */
@@ -3,4 +3,6 @@
3
3
  @forward "tokens";
4
4
  @forward "motion";
5
5
  @forward "control";
6
- @forward "checkerboard";
6
+ @forward "checkerboard";
7
+ @forward "text-styles";
8
+
package/tui-manifest.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "0.2.23",
3
- "generated": "2026-10-01T22:23:34.095Z",
2
+ "version": "0.2.25",
3
+ "generated": "2026-10-02T15:07:08.166Z",
4
4
  "components": {
5
5
  "Accordion": {
6
6
  "props": {
@@ -565,6 +565,7 @@
565
565
  "cssTokens": [
566
566
  "--tui-checkbox-accent",
567
567
  "--tui-checkbox-border",
568
+ "--tui-checkbox-border-hover",
568
569
  "--tui-checkbox-border-invalid",
569
570
  "--tui-checkbox-radius",
570
571
  "--tui-checkbox-bg",
@@ -1003,6 +1004,7 @@
1003
1004
  "--tui-combobox-input-bg",
1004
1005
  "--tui-combobox-input-fg",
1005
1006
  "--tui-combobox-input-border",
1007
+ "--tui-combobox-input-border-hover",
1006
1008
  "--tui-combobox-input-border-focus",
1007
1009
  "--tui-combobox-input-radius",
1008
1010
  "--tui-combobox-content-bg",
@@ -1909,6 +1911,7 @@
1909
1911
  "--tui-multicombobox-control-bg Token-field background",
1910
1912
  "--tui-multicombobox-control-fg Text / icon colour in the control",
1911
1913
  "--tui-multicombobox-control-border Control border colour (rest)",
1914
+ "--tui-multicombobox-control-border-hover Control border colour (hover; opt-in, default: no change)",
1912
1915
  "--tui-multicombobox-control-border-focus Control border colour (focus / open)",
1913
1916
  "--tui-multicombobox-control-radius Control border radius",
1914
1917
  "--tui-multicombobox-content-bg Listbox background",
@@ -2009,6 +2012,7 @@
2009
2012
  "--tui-multiselect-trigger-bg",
2010
2013
  "--tui-multiselect-trigger-fg",
2011
2014
  "--tui-multiselect-trigger-border",
2015
+ "--tui-multiselect-trigger-border-hover",
2012
2016
  "--tui-multiselect-trigger-border-focus",
2013
2017
  "--tui-multiselect-trigger-radius",
2014
2018
  "--tui-multiselect-content-bg",
@@ -2042,6 +2046,100 @@
2042
2046
  "use": null,
2043
2047
  "notFor": null
2044
2048
  },
2049
+ "NavMenu": {
2050
+ "props": {
2051
+ "style": {
2052
+ "type": "CSSProperties",
2053
+ "required": false
2054
+ },
2055
+ "title": {
2056
+ "type": "string",
2057
+ "required": false
2058
+ },
2059
+ "className": {
2060
+ "type": "string",
2061
+ "required": false
2062
+ },
2063
+ "id": {
2064
+ "type": "string",
2065
+ "required": false
2066
+ },
2067
+ "role": {
2068
+ "type": "AriaRole",
2069
+ "required": false
2070
+ },
2071
+ "rel": {
2072
+ "type": "string",
2073
+ "required": false
2074
+ },
2075
+ "onChange": {
2076
+ "type": "FormEventHandler<HTMLDivElement>",
2077
+ "required": false
2078
+ },
2079
+ "onClick": {
2080
+ "type": "MouseEventHandler<HTMLDivElement>",
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."
2093
+ }
2094
+ },
2095
+ "cssTokens": [
2096
+ "--tui-nav-menu-group-gap",
2097
+ "--tui-nav-menu-item-gap",
2098
+ "--tui-nav-menu-item-height",
2099
+ "--tui-nav-menu-item-padding-inline",
2100
+ "--tui-nav-menu-item-radius",
2101
+ "--tui-nav-menu-item-font-size",
2102
+ "--tui-nav-menu-item-fg",
2103
+ "--tui-nav-menu-item-weight",
2104
+ "--tui-nav-menu-item-bg-hover",
2105
+ "--tui-nav-menu-item-fg-hover",
2106
+ "--tui-nav-menu-item-bg-current",
2107
+ "--tui-nav-menu-item-fg-current",
2108
+ "--tui-nav-menu-item-weight-current",
2109
+ "--tui-nav-menu-item-fg-ancestor",
2110
+ "--tui-nav-menu-item-weight-ancestor",
2111
+ "--tui-nav-menu-item-fg-disabled",
2112
+ "--tui-nav-menu-icon-size",
2113
+ "--tui-nav-menu-indicator-width",
2114
+ "--tui-nav-menu-indicator-color",
2115
+ "--tui-nav-menu-sub-indent",
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"
2127
+ ],
2128
+ "story": {
2129
+ "title": "Components/NavMenu",
2130
+ "tags": [
2131
+ "autodocs",
2132
+ "stable"
2133
+ ]
2134
+ },
2135
+ "subcomponents": null,
2136
+ "description": null,
2137
+ "gotchas": null,
2138
+ "examples": null,
2139
+ "related": null,
2140
+ "use": null,
2141
+ "notFor": null
2142
+ },
2045
2143
  "Notice": {
2046
2144
  "props": {
2047
2145
  "inline": {
@@ -2579,6 +2677,7 @@
2579
2677
  "--tui-radio-accent",
2580
2678
  "--tui-radio-size",
2581
2679
  "--tui-radio-border",
2680
+ "--tui-radio-border-hover",
2582
2681
  "--tui-radio-border-invalid",
2583
2682
  "--tui-radio-bg",
2584
2683
  "--tui-radio-gap",
@@ -2834,6 +2933,7 @@
2834
2933
  "--tui-search-select-trigger-bg",
2835
2934
  "--tui-search-select-trigger-fg",
2836
2935
  "--tui-search-select-trigger-border",
2936
+ "--tui-search-select-trigger-border-hover",
2837
2937
  "--tui-search-select-trigger-border-focus",
2838
2938
  "--tui-search-select-trigger-radius",
2839
2939
  "--tui-search-select-panel-bg",
@@ -3152,6 +3252,7 @@
3152
3252
  "--tui-select-trigger-bg",
3153
3253
  "--tui-select-trigger-fg",
3154
3254
  "--tui-select-trigger-border",
3255
+ "--tui-select-trigger-border-hover",
3155
3256
  "--tui-select-trigger-border-focus",
3156
3257
  "--tui-select-trigger-radius",
3157
3258
  "--tui-select-content-bg",
@@ -4074,7 +4175,18 @@
4074
4175
  "tui-text-success",
4075
4176
  "tui-text-white",
4076
4177
  "tui-text-contrast-high",
4077
- "tui-text-contrast-low"
4178
+ "tui-text-contrast-low",
4179
+ "tui-font-sans",
4180
+ "tui-font-mono"
4181
+ ],
4182
+ "textStyles": [
4183
+ "tui-text-style-display-{01|02|03|04}",
4184
+ "tui-text-style-headline-{01|02|03|04|05|06}",
4185
+ "tui-text-style-body",
4186
+ "tui-text-style-body-sm",
4187
+ "tui-text-style-label",
4188
+ "tui-text-style-caption",
4189
+ "tui-text-style-overline"
4078
4190
  ],
4079
4191
  "borders": [
4080
4192
  "tui-border",
@@ -33,7 +33,9 @@ export function createListboxGroupComponents(config) {
33
33
  }, [groupContext]);
34
34
  // No aria-hidden — aria-labelledby on Group references this element,
35
35
  // so screen readers need access to read the label text.
36
- return (_jsx("div", { id: groupContext ? `${groupContext.groupId}-label` : undefined, className: cx(labelClass, className), children: children }));
36
+ return (_jsx("div", { id: groupContext ? `${groupContext.groupId}-label` : undefined,
37
+ // Shared text style: one class restyles every group label at once.
38
+ className: cx(labelClass, 'tui-text-style-overline', className), children: children }));
37
39
  }
38
40
  LabelComponent.displayName = `${componentName}.Label`;
39
41
  return { Group: GroupComponent, Label: LabelComponent };