@tangible/ui 0.1.0 → 0.2.0

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 (48) hide show
  1. package/components/Button/types.d.ts +5 -2
  2. package/components/Chip/Chip.d.ts +28 -0
  3. package/components/Chip/Chip.js +19 -3
  4. package/components/Combobox/Combobox.d.ts +1 -1
  5. package/components/Combobox/Combobox.js +2 -2
  6. package/components/Combobox/types.d.ts +13 -0
  7. package/components/IconButton/types.d.ts +2 -2
  8. package/components/MultiCombobox/MultiCombobox.d.ts +33 -0
  9. package/components/MultiCombobox/MultiCombobox.js +595 -0
  10. package/components/MultiCombobox/MultiComboboxContext.d.ts +8 -0
  11. package/components/MultiCombobox/MultiComboboxContext.js +36 -0
  12. package/components/MultiCombobox/index.d.ts +3 -0
  13. package/components/MultiCombobox/index.js +2 -0
  14. package/components/MultiCombobox/types.d.ts +244 -0
  15. package/components/MultiCombobox/types.js +7 -0
  16. package/components/MultiSelect/MultiSelect.js +22 -2
  17. package/components/Select/Select.js +14 -0
  18. package/components/Slider/Slider.d.ts +2 -0
  19. package/components/Slider/Slider.js +29 -0
  20. package/components/Slider/index.d.ts +2 -0
  21. package/components/Slider/index.js +1 -0
  22. package/components/Slider/types.d.ts +39 -0
  23. package/components/Slider/types.js +1 -0
  24. package/components/index.d.ts +3 -0
  25. package/components/index.js +2 -0
  26. package/package.json +9 -1
  27. package/styles/all.css +1 -1
  28. package/styles/all.expanded.css +707 -50
  29. package/styles/all.expanded.unlayered.css +707 -50
  30. package/styles/all.unlayered.css +1 -1
  31. package/styles/components/_bundle.scss +4 -0
  32. package/styles/components/button.scss +45 -35
  33. package/styles/components/chip.scss +57 -0
  34. package/styles/components/combobox.scss +16 -2
  35. package/styles/components/icon-button.scss +32 -26
  36. package/styles/components/input/index.scss +1 -2
  37. package/styles/components/multi-combobox.scss +457 -0
  38. package/styles/components/multi-select.scss +34 -18
  39. package/styles/components/pager.scss +4 -2
  40. package/styles/components/progress.scss +1 -1
  41. package/styles/components/segmented-control.scss +44 -18
  42. package/styles/components/select.scss +19 -3
  43. package/styles/components/slider.scss +184 -0
  44. package/styles/components/switch.scss +1 -1
  45. package/styles/core.css +1 -1
  46. package/styles/core.unlayered.css +1 -1
  47. package/styles/system/_tokens.scss +13 -0
  48. package/tui-manifest.json +215 -6
@@ -8,6 +8,7 @@
8
8
  @use "./chip" as chip;
9
9
  @use "./chip-group" as chipgroup;
10
10
  @use "./combobox" as combobox;
11
+ @use "./multi-combobox" as multicombobox;
11
12
  @use "./content-indicator" as contentindicator;
12
13
  @use "./date-picker" as datepicker;
13
14
  @use "./dropdown" as dropdown;
@@ -27,6 +28,7 @@
27
28
  @use "./rating" as rating;
28
29
  @use "./progress" as progress;
29
30
  @use "./segmented-control" as segmentedcontrol;
31
+ @use "./slider" as slider;
30
32
  @use "./switch" as switch;
31
33
  @use "./sidebar" as sidebar;
32
34
  @use "./step-indicator" as stepindicator;
@@ -72,6 +74,7 @@ $-input-dependents: (input, field, text-input, textarea, pager);
72
74
  @if -wants($only, chip) { @include chip.styles(); }
73
75
  @if -wants($only, chip-group) { @include chipgroup.styles(); }
74
76
  @if -wants($only, combobox) { @include combobox.styles(); }
77
+ @if -wants($only, multi-combobox) { @include multicombobox.styles(); }
75
78
  @if -wants($only, content-indicator) { @include contentindicator.styles(); }
76
79
  @if -wants($only, date-picker) { @include datepicker.styles(); }
77
80
  @if -wants($only, dropdown) { @include dropdown.styles(); }
@@ -91,6 +94,7 @@ $-input-dependents: (input, field, text-input, textarea, pager);
91
94
  @if -wants($only, rating) { @include rating.styles(); }
92
95
  @if -wants($only, progress) { @include progress.styles(); }
93
96
  @if -wants($only, segmented-control) { @include segmentedcontrol.styles(); }
97
+ @if -wants($only, slider) { @include slider.styles(); }
94
98
  @if -wants($only, switch) { @include switch.styles(); }
95
99
  @if -wants($only, sidebar) { @include sidebar.styles(); }
96
100
  @if -wants($only, step-indicator) { @include stepindicator.styles(); }
@@ -267,17 +267,21 @@ $_typography-lineHeight: var(--#{sys.$prefix}button-line-height, 1.4);
267
267
  }
268
268
  }
269
269
 
270
- &.is-theme-danger {
271
- --_bg: var(--#{sys.$prefix}button-bg, var(--#{sys.$prefix}theme-danger-base));
272
- --_fg: var(--#{sys.$prefix}button-fg, var(--#{sys.$prefix}color-fg-on-accent));
273
- --_border: var(--#{sys.$prefix}button-border, var(--#{sys.$prefix}theme-danger-base));
274
-
275
- &:hover,
276
- &:focus-visible,
277
- &:is(:active, [aria-pressed="true"]) {
278
- --_bg: var(--#{sys.$prefix}button-bg-interact, var(--#{sys.$prefix}theme-danger-stronger));
279
- --_fg: var(--#{sys.$prefix}button-fg-interact, var(--#{sys.$prefix}color-fg-on-accent));
280
- --_border: var(--#{sys.$prefix}button-border-interact, var(--#{sys.$prefix}theme-danger-stronger));
270
+ // Status themes (danger/success/warning/info) share one recipe:
271
+ // base fill, on-accent text, stronger step on interaction.
272
+ @each $status in (danger, success, warning, info) {
273
+ &.is-theme-#{$status} {
274
+ --_bg: var(--#{sys.$prefix}button-bg, var(--#{sys.$prefix}theme-#{$status}-base));
275
+ --_fg: var(--#{sys.$prefix}button-fg, var(--#{sys.$prefix}color-fg-on-accent));
276
+ --_border: var(--#{sys.$prefix}button-border, var(--#{sys.$prefix}theme-#{$status}-base));
277
+
278
+ &:hover,
279
+ &:focus-visible,
280
+ &:is(:active, [aria-pressed="true"]) {
281
+ --_bg: var(--#{sys.$prefix}button-bg-interact, var(--#{sys.$prefix}theme-#{$status}-stronger));
282
+ --_fg: var(--#{sys.$prefix}button-fg-interact, var(--#{sys.$prefix}color-fg-on-accent));
283
+ --_border: var(--#{sys.$prefix}button-border-interact, var(--#{sys.$prefix}theme-#{$status}-stronger));
284
+ }
281
285
  }
282
286
  }
283
287
 
@@ -312,17 +316,19 @@ $_typography-lineHeight: var(--#{sys.$prefix}button-line-height, 1.4);
312
316
  }
313
317
  }
314
318
 
315
- &.is-style-outline.is-theme-danger {
316
- --_bg: var(--#{sys.$prefix}button-bg, transparent);
317
- --_fg: var(--#{sys.$prefix}button-fg, var(--#{sys.$prefix}theme-danger-strong));
318
- --_border: var(--#{sys.$prefix}button-border, var(--#{sys.$prefix}theme-danger-base));
319
-
320
- &:hover,
321
- &:focus-visible,
322
- &:is(:active, [aria-pressed="true"]) {
323
- --_bg: var(--#{sys.$prefix}button-bg-interact, var(--#{sys.$prefix}theme-danger-base));
324
- --_fg: var(--#{sys.$prefix}button-fg-interact, var(--#{sys.$prefix}color-fg-on-accent));
325
- --_border: var(--#{sys.$prefix}button-border-interact, var(--#{sys.$prefix}theme-danger-base));
319
+ @each $status in (danger, success, warning, info) {
320
+ &.is-style-outline.is-theme-#{$status} {
321
+ --_bg: var(--#{sys.$prefix}button-bg, transparent);
322
+ --_fg: var(--#{sys.$prefix}button-fg, var(--#{sys.$prefix}theme-#{$status}-strong));
323
+ --_border: var(--#{sys.$prefix}button-border, var(--#{sys.$prefix}theme-#{$status}-base));
324
+
325
+ &:hover,
326
+ &:focus-visible,
327
+ &:is(:active, [aria-pressed="true"]) {
328
+ --_bg: var(--#{sys.$prefix}button-bg-interact, var(--#{sys.$prefix}theme-#{$status}-base));
329
+ --_fg: var(--#{sys.$prefix}button-fg-interact, var(--#{sys.$prefix}color-fg-on-accent));
330
+ --_border: var(--#{sys.$prefix}button-border-interact, var(--#{sys.$prefix}theme-#{$status}-base));
331
+ }
326
332
  }
327
333
  }
328
334
 
@@ -352,14 +358,16 @@ $_typography-lineHeight: var(--#{sys.$prefix}button-line-height, 1.4);
352
358
  }
353
359
  }
354
360
 
355
- &.is-style-ghost.is-theme-danger {
356
- --_fg: var(--#{sys.$prefix}button-fg, var(--#{sys.$prefix}theme-danger-strong));
361
+ @each $status in (danger, success, warning, info) {
362
+ &.is-style-ghost.is-theme-#{$status} {
363
+ --_fg: var(--#{sys.$prefix}button-fg, var(--#{sys.$prefix}theme-#{$status}-strong));
357
364
 
358
- &:hover,
359
- &:focus-visible,
360
- &:is(:active, [aria-pressed="true"]) {
361
- --_bg: var(--#{sys.$prefix}button-bg-interact, var(--#{sys.$prefix}theme-danger-subtlest));
362
- --_fg: var(--#{sys.$prefix}button-fg-interact, var(--#{sys.$prefix}theme-danger-stronger));
365
+ &:hover,
366
+ &:focus-visible,
367
+ &:is(:active, [aria-pressed="true"]) {
368
+ --_bg: var(--#{sys.$prefix}button-bg-interact, var(--#{sys.$prefix}theme-#{$status}-subtlest));
369
+ --_fg: var(--#{sys.$prefix}button-fg-interact, var(--#{sys.$prefix}theme-#{$status}-stronger));
370
+ }
363
371
  }
364
372
  }
365
373
 
@@ -391,13 +399,15 @@ $_typography-lineHeight: var(--#{sys.$prefix}button-line-height, 1.4);
391
399
  }
392
400
  }
393
401
 
394
- &.is-style-link.is-theme-danger {
395
- --_fg: var(--#{sys.$prefix}button-fg, var(--#{sys.$prefix}theme-danger-strong));
402
+ @each $status in (danger, success, warning, info) {
403
+ &.is-style-link.is-theme-#{$status} {
404
+ --_fg: var(--#{sys.$prefix}button-fg, var(--#{sys.$prefix}theme-#{$status}-strong));
396
405
 
397
- &:hover,
398
- &:focus-visible,
399
- &:is(:active, [aria-pressed="true"]) {
400
- --_fg: var(--#{sys.$prefix}button-fg-interact, var(--#{sys.$prefix}theme-danger-strongest));
406
+ &:hover,
407
+ &:focus-visible,
408
+ &:is(:active, [aria-pressed="true"]) {
409
+ --_fg: var(--#{sys.$prefix}button-fg-interact, var(--#{sys.$prefix}theme-#{$status}-strongest));
410
+ }
401
411
  }
402
412
  }
403
413
  }
@@ -165,6 +165,63 @@
165
165
  }
166
166
  }
167
167
 
168
+ // -------------------------------------------------------------------------
169
+ // Remove button — trailing dismiss affordance (token/tag pattern)
170
+ // -------------------------------------------------------------------------
171
+ // Rendered when `onRemove` is set: a real <button> nested in a display-only
172
+ // chip (the only focusable target). Sized in em so it tracks the chip text
173
+ // and is pulled toward the chip's end edge. The × glyph is held at ~1em
174
+ // (below the chip's 1.25em icon scale) so the button never drives the chip
175
+ // taller than its text — the padding keeps the tap target comfortable.
176
+ .#{sys.$prefix}chip__remove {
177
+ display: inline-flex;
178
+ align-items: center;
179
+ justify-content: center;
180
+ flex: none;
181
+ // The chip's own `gap` already spaces children; pull back so the × sits
182
+ // close to the label instead of doubling that gap.
183
+ margin-inline-start: calc(0.125em - #{$_spacing-within});
184
+ margin-inline-end: -0.1875em;
185
+ padding: 0.1875em;
186
+ border: 0;
187
+ border-radius: var(--#{sys.$prefix}radius-full, 999px);
188
+ background: transparent;
189
+ color: inherit;
190
+ cursor: pointer;
191
+ opacity: 0.65;
192
+ line-height: 0;
193
+ transition-duration: var(--#{sys.$prefix}motion-duration);
194
+ transition-timing-function: var(--#{sys.$prefix}motion-timing);
195
+ transition-property: opacity, outline-color;
196
+
197
+ // Hold the glyph at text height so it doesn't inflate the chip.
198
+ .#{sys.$prefix}icon,
199
+ .#{sys.$prefix}icon[class*="is-size-"] {
200
+ font-size: 0.9375em;
201
+ }
202
+
203
+ @media (hover: hover) {
204
+ &:hover { opacity: 1; }
205
+ }
206
+
207
+ &:focus-visible {
208
+ opacity: 1;
209
+ outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
210
+ outline-offset: var(--#{sys.$prefix}focus-ring-offset);
211
+ }
212
+
213
+ &:disabled {
214
+ cursor: not-allowed;
215
+ opacity: var(--#{sys.$prefix}opacity-disabled);
216
+ }
217
+ }
218
+
219
+ // A chip carrying a remove button trims its trailing padding so the button
220
+ // sits flush without a gap swallowing the chip's end.
221
+ &.has-remove {
222
+ padding-inline-end: calc(#{$_spacing-inline} - 0.125em);
223
+ }
224
+
168
225
 
169
226
  // -------------------------------------------------------------------------
170
227
  // Interactive behavior
@@ -14,6 +14,7 @@
14
14
  --tui-combobox-option-radius
15
15
  --tui-combobox-option-bg-hover
16
16
  --tui-combobox-option-bg-selected
17
+ --tui-combobox-option-gap
17
18
  */
18
19
 
19
20
  // Structural SCSS constants (compile away, not overridable)
@@ -151,7 +152,7 @@ $_label-letter-spacing: 0.05em;
151
152
 
152
153
  &:hover {
153
154
  color: var(--#{sys.$prefix}color-fg);
154
- background-color: var(--#{sys.$prefix}theme-secondary-subtlest);
155
+ background-color: var(--#{sys.$prefix}color-fill-subtle);
155
156
  }
156
157
 
157
158
  &:focus-visible {
@@ -244,7 +245,7 @@ $_label-letter-spacing: 0.05em;
244
245
  :where(.#{sys.$prefix}interface) .#{sys.$prefix}combobox__option {
245
246
  // Internal tokens with fallbacks to Select tokens
246
247
  --_option-radius: var(--#{sys.$prefix}combobox-option-radius, var(--#{sys.$prefix}select-option-radius, var(--#{sys.$prefix}radius-sm)));
247
- --_bg-hover: var(--#{sys.$prefix}combobox-option-bg-hover, var(--#{sys.$prefix}select-option-bg-hover, var(--#{sys.$prefix}theme-secondary-subtlest)));
248
+ --_bg-hover: var(--#{sys.$prefix}combobox-option-bg-hover, var(--#{sys.$prefix}select-option-bg-hover, var(--#{sys.$prefix}color-fill-subtle)));
248
249
  --_bg-selected: var(--#{sys.$prefix}combobox-option-bg-selected, var(--#{sys.$prefix}select-option-bg-selected, var(--#{sys.$prefix}theme-primary-subtlest)));
249
250
 
250
251
  // Layout
@@ -260,6 +261,15 @@ $_label-letter-spacing: 0.05em;
260
261
  font-size: var(--#{sys.$prefix}typography-size-sm);
261
262
  line-height: 1.4;
262
263
 
264
+ transition: background-color var(--#{sys.$prefix}motion-duration) var(--#{sys.$prefix}motion-timing);
265
+
266
+ // Rounded boxes shouldn't abut — a hairline of air between options.
267
+ // (Not `& + &`: sass expands both ampersands to the full compound
268
+ // selector, and the :where() prefix ends up mid-combinator — dead rule.)
269
+ & + .#{sys.$prefix}combobox__option {
270
+ margin-block-start: var(--#{sys.$prefix}combobox-option-gap, var(--#{sys.$prefix}select-option-gap, 2px));
271
+ }
272
+
263
273
  &:hover:not([data-disabled]),
264
274
  &[data-highlighted]:not([data-disabled]) {
265
275
  background-color: var(--_bg-hover);
@@ -336,6 +346,10 @@ $_label-letter-spacing: 0.05em;
336
346
  :where(.#{sys.$prefix}interface) .#{sys.$prefix}combobox__content {
337
347
  animation-duration: 0ms;
338
348
  }
349
+
350
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}combobox__option {
351
+ transition-duration: 0ms;
352
+ }
339
353
  }
340
354
 
341
355
  // ---------------------------------------------------------------------------
@@ -39,10 +39,9 @@
39
39
  // targets. Acceptable inside toolbars with adequate spacing; add padding or
40
40
  // min-size when used standalone on touch interfaces.
41
41
  //
42
- // Limited theme support:
43
- // Only `primary` and `danger` themes are implemented. IconButton is a
44
- // utility control (toolbars, close buttons, nav) where secondary/success/
45
- // warning themes add little value. Default ghost style uses neutral fg.
42
+ // Themes:
43
+ // secondary (default — neutral fg, grey interact washes), primary, and the
44
+ // status set (danger/success/warning/info) across all three variants.
46
45
  //
47
46
  // ==========================================================================
48
47
 
@@ -174,11 +173,14 @@
174
173
  --_bg-pressed: var(--#{sys.$prefix}theme-primary-subtle);
175
174
  }
176
175
 
177
- &.is-theme-danger {
178
- --_fg: var(--#{sys.$prefix}icon-button-fg, var(--#{sys.$prefix}theme-danger-base));
179
- --_fg-interact: var(--#{sys.$prefix}icon-button-fg-interact, var(--#{sys.$prefix}theme-danger-strong));
180
- --_bg-interact: var(--#{sys.$prefix}icon-button-bg-interact, var(--#{sys.$prefix}theme-danger-subtlest));
181
- --_bg-pressed: var(--#{sys.$prefix}theme-danger-subtle);
176
+ // Status themes (danger/success/warning/info) share one recipe.
177
+ @each $status in (danger, success, warning, info) {
178
+ &.is-theme-#{$status} {
179
+ --_fg: var(--#{sys.$prefix}icon-button-fg, var(--#{sys.$prefix}theme-#{$status}-base));
180
+ --_fg-interact: var(--#{sys.$prefix}icon-button-fg-interact, var(--#{sys.$prefix}theme-#{$status}-strong));
181
+ --_bg-interact: var(--#{sys.$prefix}icon-button-bg-interact, var(--#{sys.$prefix}theme-#{$status}-subtlest));
182
+ --_bg-pressed: var(--#{sys.$prefix}theme-#{$status}-subtle);
183
+ }
182
184
  }
183
185
 
184
186
  // -------------------------------------------------------------------------
@@ -198,10 +200,12 @@
198
200
  --_fg-interact: var(--#{sys.$prefix}icon-button-fg-interact, var(--#{sys.$prefix}theme-primary-strong));
199
201
  }
200
202
 
201
- &.is-style-outline.is-theme-danger {
202
- --_border: var(--#{sys.$prefix}icon-button-border, var(--#{sys.$prefix}theme-danger-base));
203
- --_bg-interact: var(--#{sys.$prefix}icon-button-bg-interact, var(--#{sys.$prefix}theme-danger-subtlest));
204
- --_fg-interact: var(--#{sys.$prefix}icon-button-fg-interact, var(--#{sys.$prefix}theme-danger-strong));
203
+ @each $status in (danger, success, warning, info) {
204
+ &.is-style-outline.is-theme-#{$status} {
205
+ --_border: var(--#{sys.$prefix}icon-button-border, var(--#{sys.$prefix}theme-#{$status}-base));
206
+ --_bg-interact: var(--#{sys.$prefix}icon-button-bg-interact, var(--#{sys.$prefix}theme-#{$status}-subtlest));
207
+ --_fg-interact: var(--#{sys.$prefix}icon-button-fg-interact, var(--#{sys.$prefix}theme-#{$status}-strong));
208
+ }
205
209
  }
206
210
 
207
211
  // Solid: filled background, darken on hover
@@ -237,19 +241,21 @@
237
241
  }
238
242
  }
239
243
 
240
- &.is-style-solid.is-theme-danger {
241
- --_bg: var(--#{sys.$prefix}icon-button-bg, var(--#{sys.$prefix}theme-danger-base));
242
- --_fg: var(--#{sys.$prefix}icon-button-fg, var(--#{sys.$prefix}color-fg-on-accent));
243
- --_bg-pressed: var(--#{sys.$prefix}theme-danger-stronger);
244
-
245
- &:hover,
246
- &:focus-visible,
247
- &:active {
248
- --_bg: var(--#{sys.$prefix}icon-button-bg-interact, var(--#{sys.$prefix}theme-danger-stronger));
249
- }
250
-
251
- &[aria-pressed="true"] {
252
- --_bg: var(--_bg-pressed);
244
+ @each $status in (danger, success, warning, info) {
245
+ &.is-style-solid.is-theme-#{$status} {
246
+ --_bg: var(--#{sys.$prefix}icon-button-bg, var(--#{sys.$prefix}theme-#{$status}-base));
247
+ --_fg: var(--#{sys.$prefix}icon-button-fg, var(--#{sys.$prefix}color-fg-on-accent));
248
+ --_bg-pressed: var(--#{sys.$prefix}theme-#{$status}-stronger);
249
+
250
+ &:hover,
251
+ &:focus-visible,
252
+ &:active {
253
+ --_bg: var(--#{sys.$prefix}icon-button-bg-interact, var(--#{sys.$prefix}theme-#{$status}-stronger));
254
+ }
255
+
256
+ &[aria-pressed="true"] {
257
+ --_bg: var(--_bg-pressed);
258
+ }
253
259
  }
254
260
  }
255
261
 
@@ -47,7 +47,6 @@
47
47
  input[type="search"],
48
48
  input[type="number"],
49
49
  input[type="tel"],
50
- input[type="range"],
51
50
  input[type="date"],
52
51
  input[type="month"],
53
52
  input[type="week"],
@@ -152,7 +151,7 @@
152
151
  :where(.#{sys.$prefix}interface) .#{sys.$prefix}toggle {
153
152
  // Internal tokens
154
153
  --_accent: var(--#{sys.$prefix}input-accent, var(--#{sys.$prefix}theme-primary-base));
155
- --_track-off: var(--#{sys.$prefix}theme-secondary-soft);
154
+ --_track-off: var(--#{sys.$prefix}color-fill-strong);
156
155
 
157
156
  input[type="checkbox"] {
158
157
  position: absolute;