@tangible/ui 0.0.2 → 0.0.4

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 (64) hide show
  1. package/README.md +21 -13
  2. package/components/Accordion/Accordion.d.ts +1 -1
  3. package/components/Accordion/Accordion.js +3 -3
  4. package/components/Accordion/types.d.ts +8 -1
  5. package/components/Avatar/Avatar.js +16 -7
  6. package/components/Avatar/AvatarGroup.js +7 -5
  7. package/components/Avatar/types.d.ts +11 -0
  8. package/components/Button/Button.js +10 -3
  9. package/components/Button/types.d.ts +9 -1
  10. package/components/Card/Card.js +26 -13
  11. package/components/Checkbox/Checkbox.d.ts +1 -1
  12. package/components/Chip/Chip.d.ts +37 -1
  13. package/components/Chip/Chip.js +10 -8
  14. package/components/ChipGroup/ChipGroup.js +5 -4
  15. package/components/ChipGroup/types.d.ts +3 -0
  16. package/components/Dropdown/Dropdown.d.ts +19 -1
  17. package/components/Dropdown/Dropdown.js +84 -28
  18. package/components/Dropdown/index.d.ts +2 -2
  19. package/components/Dropdown/index.js +1 -1
  20. package/components/Dropdown/types.d.ts +15 -0
  21. package/components/IconButton/IconButton.js +5 -4
  22. package/components/IconButton/index.d.ts +1 -1
  23. package/components/IconButton/types.d.ts +24 -4
  24. package/components/Modal/Modal.d.ts +16 -2
  25. package/components/Modal/Modal.js +45 -20
  26. package/components/MoveHandle/MoveHandle.d.ts +2 -0
  27. package/components/MoveHandle/MoveHandle.js +84 -0
  28. package/components/MoveHandle/index.d.ts +2 -0
  29. package/components/MoveHandle/index.js +1 -0
  30. package/components/MoveHandle/types.d.ts +53 -0
  31. package/components/MoveHandle/types.js +1 -0
  32. package/components/Notice/Notice.js +32 -19
  33. package/components/Select/Select.js +6 -2
  34. package/components/Sidebar/Sidebar.d.ts +6 -1
  35. package/components/Sidebar/Sidebar.js +65 -11
  36. package/components/Sidebar/index.d.ts +1 -1
  37. package/components/Sidebar/types.d.ts +39 -14
  38. package/components/Tabs/Tabs.d.ts +1 -1
  39. package/components/Tabs/Tabs.js +12 -3
  40. package/components/Tabs/types.d.ts +20 -5
  41. package/components/TextInput/TextInput.js +10 -2
  42. package/components/Tooltip/Tooltip.d.ts +2 -2
  43. package/components/Tooltip/Tooltip.js +61 -40
  44. package/components/Tooltip/index.d.ts +1 -1
  45. package/components/Tooltip/types.d.ts +28 -1
  46. package/components/index.d.ts +4 -2
  47. package/components/index.js +2 -1
  48. package/icons/icons.svg +1 -0
  49. package/icons/manifest.json +8 -0
  50. package/icons/registry.d.ts +2 -0
  51. package/icons/registry.js +1 -0
  52. package/icons/system/index.d.ts +2 -0
  53. package/icons/system/index.js +11 -0
  54. package/package.json +1 -1
  55. package/styles/all.css +1 -1
  56. package/styles/all.expanded.css +961 -97
  57. package/styles/all.expanded.unlayered.css +961 -97
  58. package/styles/all.unlayered.css +1 -1
  59. package/styles/components/_bundle.scss +2 -0
  60. package/styles/index.scss +5 -0
  61. package/styles/system/_control.scss +18 -3
  62. package/styles/system/_tokens.scss +119 -2
  63. package/tui-manifest.json +526 -88
  64. package/utils/focus-trap.js +8 -1
@@ -15,6 +15,7 @@
15
15
  @use "../../components/Icon/styles" as icon;
16
16
  @use "../../components/IconButton/styles" as iconbutton;
17
17
  @use "../../components/Modal/styles" as modal;
18
+ @use "../../components/MoveHandle/styles" as movehandle;
18
19
  @use "../../components/Notice/styles" as notice;
19
20
  @use "../../components/OverlapStack/styles" as overlapstack;
20
21
  @use "../../components/Pager/styles" as pager;
@@ -51,6 +52,7 @@
51
52
  @include icon.styles();
52
53
  @include iconbutton.styles();
53
54
  @include modal.styles();
55
+ @include movehandle.styles();
54
56
  @include notice.styles();
55
57
  @include overlapstack.styles();
56
58
  @include pager.styles();
package/styles/index.scss CHANGED
@@ -10,6 +10,10 @@
10
10
  @include sys.emit-color-roles-dark(sys.$prefix);
11
11
  @include sys.emit-color-roles-auto(sys.$prefix);
12
12
 
13
+ @include sys.emit-accent-roles(sys.$prefix);
14
+ @include sys.emit-accent-roles-dark(sys.$prefix);
15
+ @include sys.emit-accent-roles-auto(sys.$prefix);
16
+
13
17
  // Reduced motion: kill all token-driven transitions/animations globally.
14
18
  // Components using --tui-motion-duration get instant transitions for free.
15
19
  @media (prefers-reduced-motion: reduce) {
@@ -47,6 +51,7 @@
47
51
  0 2px 4px rgba(var(--#{sys.$prefix}shadow-color), 0.06);
48
52
  --#{sys.$prefix}shadow-lg: 0 10px 15px rgba(var(--#{sys.$prefix}shadow-color), 0.1),
49
53
  0 4px 6px rgba(var(--#{sys.$prefix}shadow-color), 0.05);
54
+ --#{sys.$prefix}shadow-dropdown: 0 4px 12px rgba(var(--#{sys.$prefix}shadow-color), 0.15);
50
55
  }
51
56
  @layer resets {
52
57
  .#{sys.$prefix}interface {
@@ -16,6 +16,13 @@
16
16
  // md → 16px font → 40px (default)
17
17
  // lg → 20px font → 48px
18
18
  //
19
+ // Override from consuming context (e.g. Fields for WordPress):
20
+ // .my-context .tui-interface {
21
+ // --tui-control-height-sm: 32px;
22
+ // --tui-control-height-md: 36px;
23
+ // --tui-control-height-lg: 44px;
24
+ // }
25
+ //
19
26
  // Usage:
20
27
  // .tui-select__trigger { @include sys.control-sizing(sys.$prefix); }
21
28
  //
@@ -24,11 +31,19 @@
24
31
  @mixin control-sizing($prefix) {
25
32
  --_fs: var(--#{$prefix}typography-size-md);
26
33
  --_py: var(--#{$prefix}spacing-xxs);
34
+ --_height: calc(2em + 2 * var(--_py));
27
35
 
28
36
  font-size: var(--_fs);
29
37
  padding-block: var(--_py);
30
- min-height: calc(2em + 2 * var(--_py));
38
+ min-height: var(--#{$prefix}control-height-md, var(--_height));
39
+
40
+ &.is-size-sm {
41
+ --_fs: var(--#{$prefix}typography-size-sm);
42
+ min-height: var(--#{$prefix}control-height-sm, var(--_height));
43
+ }
31
44
 
32
- &.is-size-sm { --_fs: var(--#{$prefix}typography-size-sm); }
33
- &.is-size-lg { --_fs: var(--#{$prefix}typography-size-lg); }
45
+ &.is-size-lg {
46
+ --_fs: var(--#{$prefix}typography-size-lg);
47
+ min-height: var(--#{$prefix}control-height-lg, var(--_height));
48
+ }
34
49
  }
@@ -46,6 +46,9 @@ $brand: 'blue';
46
46
  --#{$prefix}focus-ring-offset: 2px;
47
47
  --#{$prefix}focus-ring-color: #2563eb;
48
48
 
49
+ /* Font Weight */
50
+ --#{$prefix}font-weight-medium: 500;
51
+
49
52
  /* Border */
50
53
  --#{$prefix}border-width: 1px;
51
54
 
@@ -62,7 +65,8 @@ $brand: 'blue';
62
65
 
63
66
  /* Neutral: surfaces */
64
67
  --#{$prefix}color-bg: #fff;
65
- --#{$prefix}color-bg-surface: #{pf.tone($neutral, 25)};
68
+ --#{$prefix}color-bg-surface: #{pf.tone($neutral, 25)};
69
+ --#{$prefix}color-bg-muted: #{pf.tone($neutral, 100)};
66
70
  --#{$prefix}color-bg-elevated: #fff;
67
71
  --#{$prefix}color-bg-inverted: #{pf.tone($neutral, 900)};
68
72
  --#{$prefix}color-bg-overlay: rgba(0, 0, 0, var(--#{$prefix}opacity-backdrop));
@@ -149,7 +153,8 @@ $brand: 'blue';
149
153
  /* Backgrounds */
150
154
  --#{$prefix}color-bg: #{pf.tone($neutral, 900)};
151
155
  --#{$prefix}color-bg-surface: #{pf.tone($neutral, 800)};
152
- --#{$prefix}color-bg-elevated: #{pf.tone($neutral, 700)};
156
+ --#{$prefix}color-bg-muted: #{pf.tone($neutral, 700)};
157
+ --#{$prefix}color-bg-elevated: #{pf.tone($neutral, 900)};
153
158
  --#{$prefix}color-bg-inverted: #{pf.tone($neutral, 50)};
154
159
  --#{$prefix}color-bg-overlay: rgba(0, 0, 0, 0.7);
155
160
 
@@ -221,6 +226,118 @@ $brand: 'blue';
221
226
  }
222
227
  }
223
228
 
229
+ // ==========================================================================
230
+ // Accent Roles (compact, OKLCH-derived)
231
+ // ==========================================================================
232
+ //
233
+ // For concepts that need their own colour identity but don't warrant a full
234
+ // 7-step scale (section, page, step, or any future accent slot).
235
+ //
236
+ // Public API per accent (component-safe):
237
+ // --tui-theme-{name}-base Primary fill (buttons, active states)
238
+ // --tui-theme-{name}-soft Tinted surface (chips, badges, subtle panels)
239
+ // --tui-theme-{name}-border Border for soft surfaces
240
+ // --tui-theme-{name}-on-base Foreground on base
241
+ // --tui-theme-{name}-on-soft Foreground on soft
242
+ //
243
+ // Components must only consume these role tokens, not the palette anchors.
244
+ //
245
+ // Primitives (swizzlable by consumers, OKLCH path only):
246
+ // --tui-palette-{name}-c OKLCH chroma (cap at ≤ 0.20)
247
+ // --tui-palette-{name}-h OKLCH hue (0–360)
248
+ //
249
+ // Two strategies for defining accents:
250
+ //
251
+ // Path A — map from existing core families (no OKLCH needed):
252
+ // .my-context {
253
+ // --tui-theme-section-base: var(--tui-theme-warning-base);
254
+ // --tui-theme-section-soft: var(--tui-theme-warning-subtle);
255
+ // --tui-theme-section-border: var(--tui-theme-warning-soft);
256
+ // --tui-theme-section-on-base: var(--tui-color-fg-on-accent);
257
+ // --tui-theme-section-on-soft: var(--tui-color-fg);
258
+ // }
259
+ //
260
+ // Path B — derive from OKLCH anchors (true custom accent):
261
+ // Uses @supports guard with Path A fallback. No silent failures.
262
+ //
263
+ // ==========================================================================
264
+
265
+ // Each accent: OKLCH anchors (c, h) + fallback core family for @supports guard
266
+ $accent-defaults: (
267
+ section: (c: 0.17, h: 55, fallback: warning), // warm orange/amber
268
+ page: (c: 0.15, h: 280, fallback: primary), // purple
269
+ step: (c: 0.14, h: 200, fallback: info), // teal-blue
270
+ ) !default;
271
+
272
+ // Emit accent role tokens with @supports progressive enhancement.
273
+ // Fallback (all browsers): maps role tokens from core family scales.
274
+ // Enhancement (oklch browsers): overrides with OKLCH-derived values.
275
+ @mixin emit-accent-roles($prefix, $accents: $accent-defaults) {
276
+ // --- Fallback: map from core families (works everywhere) ---
277
+ :where(.#{$prefix}interface) {
278
+ @each $name, $values in $accents {
279
+ $family: map.get($values, fallback);
280
+
281
+ /* Accent: #{$name} (fallback → #{$family}) */
282
+ --#{$prefix}theme-#{$name}-base: var(--#{$prefix}theme-#{$family}-base);
283
+ --#{$prefix}theme-#{$name}-soft: var(--#{$prefix}theme-#{$family}-subtle);
284
+ --#{$prefix}theme-#{$name}-border: var(--#{$prefix}theme-#{$family}-soft);
285
+ --#{$prefix}theme-#{$name}-on-base: var(--#{$prefix}color-fg-on-accent);
286
+ --#{$prefix}theme-#{$name}-on-soft: var(--#{$prefix}color-fg);
287
+ }
288
+ }
289
+
290
+ // --- Enhancement: OKLCH-derived (modern browsers) ---
291
+ @supports (color: oklch(0.5 0.1 0)) {
292
+ :where(.#{$prefix}interface) {
293
+ @each $name, $values in $accents {
294
+ $c: map.get($values, c);
295
+ $h: map.get($values, h);
296
+
297
+ /* Accent: #{$name} (OKLCH c=#{$c} h=#{$h}) */
298
+ --#{$prefix}palette-#{$name}-c: #{$c};
299
+ --#{$prefix}palette-#{$name}-h: #{$h};
300
+
301
+ --#{$prefix}theme-#{$name}-base: oklch(0.62 var(--#{$prefix}palette-#{$name}-c) var(--#{$prefix}palette-#{$name}-h));
302
+ --#{$prefix}theme-#{$name}-soft: oklch(0.92 calc(var(--#{$prefix}palette-#{$name}-c) * 0.55) var(--#{$prefix}palette-#{$name}-h));
303
+ --#{$prefix}theme-#{$name}-border: oklch(0.80 calc(var(--#{$prefix}palette-#{$name}-c) * 0.45) var(--#{$prefix}palette-#{$name}-h));
304
+ --#{$prefix}theme-#{$name}-on-base: oklch(0.98 0 0);
305
+ --#{$prefix}theme-#{$name}-on-soft: var(--#{$prefix}color-fg);
306
+ }
307
+ }
308
+ }
309
+ }
310
+
311
+ // Private: dark mode accent OKLCH overrides (swap L values, tighten chroma).
312
+ // Fallback path needs no dark override — core family vars already handle it.
313
+ @mixin _accent-dark-overrides($prefix, $accents: $accent-defaults) {
314
+ @supports (color: oklch(0.5 0.1 0)) {
315
+ @each $name, $_ in $accents {
316
+ --#{$prefix}theme-#{$name}-base: oklch(0.72 var(--#{$prefix}palette-#{$name}-c) var(--#{$prefix}palette-#{$name}-h));
317
+ --#{$prefix}theme-#{$name}-soft: oklch(0.30 calc(var(--#{$prefix}palette-#{$name}-c) * 0.35) var(--#{$prefix}palette-#{$name}-h));
318
+ --#{$prefix}theme-#{$name}-border: oklch(0.38 calc(var(--#{$prefix}palette-#{$name}-c) * 0.30) var(--#{$prefix}palette-#{$name}-h));
319
+ --#{$prefix}theme-#{$name}-on-base: oklch(0.18 0 0);
320
+ --#{$prefix}theme-#{$name}-on-soft: var(--#{$prefix}color-fg);
321
+ }
322
+ }
323
+ }
324
+
325
+ // Public: explicit dark mode (data-theme="dark")
326
+ @mixin emit-accent-roles-dark($prefix, $accents: $accent-defaults) {
327
+ :where(.#{$prefix}interface)[data-theme="dark"] {
328
+ @include _accent-dark-overrides($prefix, $accents);
329
+ }
330
+ }
331
+
332
+ // Public: auto mode - respects system preference (data-theme="auto")
333
+ @mixin emit-accent-roles-auto($prefix, $accents: $accent-defaults) {
334
+ @media (prefers-color-scheme: dark) {
335
+ :where(.#{$prefix}interface)[data-theme="auto"] {
336
+ @include _accent-dark-overrides($prefix, $accents);
337
+ }
338
+ }
339
+ }
340
+
224
341
  @mixin emit-spacing-primitives($prefix, $steps: $spacing-steps) {
225
342
  @each $n in $steps {
226
343
  --#{$prefix}palette-spacing-#{$n}: calc(var(--#{$prefix}spacing-base) * #{$n});