@tangible/ui 0.0.1 → 0.0.2

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 (129) hide show
  1. package/components/Card/Card.d.ts +1 -0
  2. package/components/Card/Card.js +17 -20
  3. package/components/Checkbox/Checkbox.d.ts +9 -0
  4. package/components/Checkbox/Checkbox.js +92 -0
  5. package/components/Checkbox/index.d.ts +2 -0
  6. package/components/Checkbox/index.js +1 -0
  7. package/components/Checkbox/types.d.ts +10 -0
  8. package/components/Checkbox/types.js +1 -0
  9. package/components/Chip/Chip.d.ts +4 -1
  10. package/components/Chip/Chip.js +32 -7
  11. package/components/ChipGroup/ChipGroup.d.ts +5 -0
  12. package/components/ChipGroup/ChipGroup.js +68 -0
  13. package/components/ChipGroup/ChipGroupContext.d.ts +3 -0
  14. package/components/ChipGroup/ChipGroupContext.js +5 -0
  15. package/components/ChipGroup/index.d.ts +3 -0
  16. package/components/ChipGroup/index.js +2 -0
  17. package/components/ChipGroup/types.d.ts +36 -0
  18. package/components/ChipGroup/types.js +1 -0
  19. package/components/Chips/Chips.d.ts +2 -0
  20. package/components/Chips/Chips.js +1 -1
  21. package/components/Combobox/Combobox.d.ts +33 -0
  22. package/components/Combobox/Combobox.js +466 -0
  23. package/components/Combobox/ComboboxContext.d.ts +8 -0
  24. package/components/Combobox/ComboboxContext.js +36 -0
  25. package/components/Combobox/index.d.ts +2 -0
  26. package/components/Combobox/index.js +1 -0
  27. package/components/Combobox/types.d.ts +204 -0
  28. package/components/Combobox/types.js +1 -0
  29. package/components/Dropdown/Dropdown.js +2 -1
  30. package/components/Field/Field.d.ts +39 -0
  31. package/components/Field/Field.js +92 -0
  32. package/components/Field/FieldContext.d.ts +16 -0
  33. package/components/Field/FieldContext.js +10 -0
  34. package/components/Field/index.d.ts +2 -0
  35. package/components/Field/index.js +1 -0
  36. package/components/Modal/Modal.d.ts +4 -4
  37. package/components/Modal/Modal.js +14 -12
  38. package/components/MultiSelect/MultiSelect.d.ts +39 -0
  39. package/components/MultiSelect/MultiSelect.js +623 -0
  40. package/components/MultiSelect/MultiSelectContext.d.ts +20 -0
  41. package/components/MultiSelect/MultiSelectContext.js +56 -0
  42. package/components/MultiSelect/index.d.ts +2 -0
  43. package/components/MultiSelect/index.js +1 -0
  44. package/components/MultiSelect/types.d.ts +218 -0
  45. package/components/MultiSelect/types.js +3 -0
  46. package/components/Notice/Notice.d.ts +1 -1
  47. package/components/Notice/Notice.js +1 -1
  48. package/components/Progress/Progress.js +1 -1
  49. package/components/Progress/types.d.ts +7 -7
  50. package/components/Radio/Radio.d.ts +2 -0
  51. package/components/Radio/Radio.js +50 -0
  52. package/components/Radio/RadioGroup.d.ts +2 -0
  53. package/components/Radio/RadioGroup.js +54 -0
  54. package/components/Radio/RadioGroupContext.d.ts +3 -0
  55. package/components/Radio/RadioGroupContext.js +9 -0
  56. package/components/Radio/index.d.ts +8 -0
  57. package/components/Radio/index.js +6 -0
  58. package/components/Radio/types.d.ts +32 -0
  59. package/components/Radio/types.js +1 -0
  60. package/components/Rating/Rating.d.ts +5 -5
  61. package/components/Rating/Rating.js +2 -2
  62. package/components/SegmentedControl/SegmentedControl.js +20 -104
  63. package/components/SegmentedControl/types.d.ts +4 -8
  64. package/components/Select/Select.d.ts +39 -0
  65. package/components/Select/Select.js +497 -0
  66. package/components/Select/SelectContext.d.ts +20 -0
  67. package/components/Select/SelectContext.js +56 -0
  68. package/components/Select/index.d.ts +3 -0
  69. package/components/Select/index.js +1 -0
  70. package/components/Select/types.d.ts +216 -0
  71. package/components/Select/types.js +11 -0
  72. package/components/Sidebar/Sidebar.js +12 -12
  73. package/components/Sidebar/types.d.ts +5 -5
  74. package/components/StepIndicator/StepIndicator.js +1 -1
  75. package/components/StepList/StepList.js +2 -2
  76. package/components/StepList/types.d.ts +4 -4
  77. package/components/Switch/Switch.d.ts +9 -0
  78. package/components/Switch/Switch.js +91 -0
  79. package/components/Switch/index.d.ts +2 -0
  80. package/components/Switch/index.js +1 -0
  81. package/components/Switch/types.d.ts +11 -0
  82. package/components/Switch/types.js +1 -0
  83. package/components/TextInput/TextInput.d.ts +8 -0
  84. package/components/TextInput/TextInput.js +25 -0
  85. package/components/TextInput/index.d.ts +2 -0
  86. package/components/TextInput/index.js +1 -0
  87. package/components/TextInput/types.d.ts +32 -0
  88. package/components/TextInput/types.js +1 -0
  89. package/components/Textarea/Textarea.d.ts +6 -0
  90. package/components/Textarea/Textarea.js +49 -0
  91. package/components/Textarea/index.d.ts +2 -0
  92. package/components/Textarea/index.js +1 -0
  93. package/components/Textarea/types.d.ts +25 -0
  94. package/components/Textarea/types.js +1 -0
  95. package/components/index.d.ts +20 -0
  96. package/components/index.js +10 -0
  97. package/icons/icons.svg +1 -0
  98. package/icons/manifest.json +8 -0
  99. package/icons/registry.d.ts +2 -0
  100. package/icons/registry.js +1 -0
  101. package/icons/system/index.d.ts +2 -0
  102. package/icons/system/index.js +11 -0
  103. package/package.json +1 -1
  104. package/styles/all.css +1 -1
  105. package/styles/all.expanded.css +1187 -96
  106. package/styles/all.expanded.unlayered.css +1187 -96
  107. package/styles/all.unlayered.css +1 -1
  108. package/styles/components/_bundle.scss +20 -0
  109. package/styles/components/input/index.scss +5 -20
  110. package/styles/index.scss +16 -0
  111. package/styles/system/_control.scss +34 -0
  112. package/styles/system/_tokens.scss +8 -0
  113. package/styles/system/index.scss +2 -1
  114. package/styles/utilities/_index.scss +50 -0
  115. package/tui-manifest.json +632 -61
  116. package/utils/compose-events.d.ts +15 -0
  117. package/utils/compose-events.js +27 -0
  118. package/utils/hash.d.ts +15 -0
  119. package/utils/hash.js +32 -0
  120. package/utils/index.d.ts +3 -0
  121. package/utils/index.js +6 -0
  122. package/utils/is-dev.d.ts +5 -0
  123. package/utils/is-dev.js +7 -0
  124. package/utils/use-controllable-state.d.ts +19 -0
  125. package/utils/use-controllable-state.js +59 -0
  126. package/utils/use-roving-group.d.ts +33 -0
  127. package/utils/use-roving-group.js +123 -0
  128. package/utils/value-key.d.ts +16 -0
  129. package/utils/value-key.js +14 -0
@@ -2,9 +2,15 @@
2
2
  @use "../../components/Avatar/styles" as avatar;
3
3
  @use "../../components/Button/styles" as button;
4
4
  @use "../../components/Card/styles" as card;
5
+ @use "../../components/Checkbox/styles" as checkbox;
5
6
  @use "../../components/Chip/styles" as chip;
7
+ @use "../../components/ChipGroup/styles" as chipgroup;
8
+ @use "../../components/Combobox/styles" as combobox;
6
9
  @use "../../components/ContentIndicator/styles" as contentindicator;
7
10
  @use "../../components/Dropdown/styles" as dropdown;
11
+ @use "../../components/Field/styles" as field;
12
+ @use "../../components/MultiSelect/styles" as multiselect;
13
+ @use "../../components/Select/styles" as select;
8
14
  @use "./input/index" as input;
9
15
  @use "../../components/Icon/styles" as icon;
10
16
  @use "../../components/IconButton/styles" as iconbutton;
@@ -12,14 +18,18 @@
12
18
  @use "../../components/Notice/styles" as notice;
13
19
  @use "../../components/OverlapStack/styles" as overlapstack;
14
20
  @use "../../components/Pager/styles" as pager;
21
+ @use "../../components/Radio/styles" as radio;
15
22
  @use "../../components/Rating/styles" as rating;
16
23
  @use "../../components/Progress/styles" as progress;
17
24
  @use "../../components/SegmentedControl/styles" as segmentedcontrol;
25
+ @use "../../components/Switch/styles" as switch;
18
26
  @use "../../components/Sidebar/styles" as sidebar;
19
27
  @use "../../components/StepIndicator/styles" as stepindicator;
20
28
  @use "../../components/StepList/styles" as steplist;
21
29
  @use "../../components/Table/styles" as table;
22
30
  @use "../../components/Tabs/styles" as tabs;
31
+ @use "../../components/Textarea/styles" as textarea;
32
+ @use "../../components/TextInput/styles" as textinput;
23
33
  @use "../../components/Toolbar/styles" as toolbar;
24
34
  @use "../../components/Tooltip/styles" as tooltip;
25
35
 
@@ -28,9 +38,15 @@
28
38
  @include avatar.styles();
29
39
  @include button.styles();
30
40
  @include card.styles();
41
+ @include checkbox.styles();
31
42
  @include chip.styles();
43
+ @include chipgroup.styles();
44
+ @include combobox.styles();
32
45
  @include contentindicator.styles();
33
46
  @include dropdown.styles();
47
+ @include field.styles();
48
+ @include multiselect.styles();
49
+ @include select.styles();
34
50
  @include input.styles();
35
51
  @include icon.styles();
36
52
  @include iconbutton.styles();
@@ -38,14 +54,18 @@
38
54
  @include notice.styles();
39
55
  @include overlapstack.styles();
40
56
  @include pager.styles();
57
+ @include radio.styles();
41
58
  @include rating.styles();
42
59
  @include progress.styles();
43
60
  @include segmentedcontrol.styles();
61
+ @include switch.styles();
44
62
  @include sidebar.styles();
45
63
  @include stepindicator.styles();
46
64
  @include steplist.styles();
47
65
  @include table.styles();
48
66
  @include tabs.styles();
67
+ @include textarea.styles();
68
+ @include textinput.styles();
49
69
  @include toolbar.styles();
50
70
  @include tooltip.styles();
51
71
  }
@@ -22,7 +22,6 @@
22
22
 
23
23
  // Structural (not tokenised)
24
24
  $_spacing-inline: 0.5em;
25
- $_height: calc(2em - (2 * var(--#{sys.$prefix}border-width)));
26
25
 
27
26
  // ---------------------------------------------------------------------------
28
27
  // Labels
@@ -65,17 +64,15 @@
65
64
  --_border-invalid: var(--#{sys.$prefix}input-border-invalid, var(--#{sys.$prefix}theme-danger-base));
66
65
  --_radius: var(--#{sys.$prefix}input-radius, var(--#{sys.$prefix}radius-md));
67
66
 
68
- font-size: var(--#{sys.$prefix}typography-size-sm);
67
+ @include sys.control-sizing(sys.$prefix);
68
+
69
69
  font-family: inherit;
70
- box-sizing: content-box;
71
70
  border: var(--#{sys.$prefix}border-width) solid var(--_border);
72
71
  border-radius: var(--_radius);
73
72
  appearance: none;
74
73
  background-color: var(--_bg);
75
74
  color: var(--_fg);
76
- height: $_height;
77
75
  padding-inline: $_spacing-inline;
78
- padding-block: 0;
79
76
  min-width: 1px;
80
77
 
81
78
  transition-duration: var(--#{sys.$prefix}motion-duration);
@@ -93,22 +90,11 @@
93
90
  cursor: not-allowed;
94
91
  }
95
92
 
96
- &:invalid {
93
+ &:invalid,
94
+ &[aria-invalid="true"] {
97
95
  --_border: var(--_border-invalid);
98
96
  }
99
97
  }
100
-
101
- // ---------------------------------------------------------------------------
102
- // Search input with icon
103
- // ---------------------------------------------------------------------------
104
- :where(.#{sys.$prefix}interface) :is(input[type="search"], input[type="search"].#{sys.$prefix}input) {
105
- padding-inline-start: 2.5em !important;
106
- background-image: url('data:image/svg+xml;utf8,<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M8 16a8 8 0 1 1 8-8 8.009 8.009 0 0 1-8 8ZM8 2a6 6 0 1 0 6 6 6.006 6.006 0 0 0-6-6ZM19 20a1 1 0 0 1-.707-.293l-4-4a1 1 0 0 1 1.414-1.414l4 4A1 1 0 0 1 19 20Z" fill="%231F2A37"/></svg>');
107
- background-repeat: no-repeat;
108
- background-position: 0.75em 50%;
109
- background-size: 1em;
110
- }
111
-
112
98
  // ---------------------------------------------------------------------------
113
99
  // Select with dropdown arrow
114
100
  // ---------------------------------------------------------------------------
@@ -157,7 +143,7 @@
157
143
  :where(.#{sys.$prefix}interface) .#{sys.$prefix}toggle {
158
144
  // Internal tokens
159
145
  --_accent: var(--#{sys.$prefix}input-accent, var(--#{sys.$prefix}theme-primary-base));
160
- --_track-off: var(--#{sys.$prefix}palette-color-gray-300);
146
+ --_track-off: var(--#{sys.$prefix}theme-secondary-soft);
161
147
 
162
148
  input[type="checkbox"] {
163
149
  position: absolute;
@@ -236,7 +222,6 @@
236
222
 
237
223
  font-size: var(--#{sys.$prefix}typography-size-sm);
238
224
  font-family: inherit;
239
- box-sizing: content-box;
240
225
  border: var(--#{sys.$prefix}border-width) solid var(--_border);
241
226
  border-radius: var(--_radius);
242
227
  background-color: var(--_bg);
package/styles/index.scss CHANGED
@@ -10,6 +10,14 @@
10
10
  @include sys.emit-color-roles-dark(sys.$prefix);
11
11
  @include sys.emit-color-roles-auto(sys.$prefix);
12
12
 
13
+ // Reduced motion: kill all token-driven transitions/animations globally.
14
+ // Components using --tui-motion-duration get instant transitions for free.
15
+ @media (prefers-reduced-motion: reduce) {
16
+ :where(.#{sys.$prefix}interface) {
17
+ --#{sys.$prefix}motion-duration: 0ms;
18
+ }
19
+ }
20
+
13
21
  .#{sys.$prefix}interface {
14
22
  --#{sys.$prefix}spacing-base: 4px;
15
23
  @include sys.emit-spacing-primitives(#{sys.$prefix});
@@ -52,6 +60,14 @@
52
60
  color: var(--#{sys.$prefix}color-fg);
53
61
  }
54
62
 
63
+ // Universal border-box — all TUI elements use border-box sizing.
64
+ &,
65
+ *,
66
+ *::before,
67
+ *::after {
68
+ box-sizing: border-box;
69
+ }
70
+
55
71
  // Button element reset — kill common theme button styling
56
72
  button,
57
73
  [type="button"],
@@ -0,0 +1,34 @@
1
+ @use "constants" as sys;
2
+
3
+ // =============================================================================
4
+ // Control Sizing Mixin
5
+ // =============================================================================
6
+ //
7
+ // Unified height formula for all form controls (TextInput, Select, MultiSelect,
8
+ // Combobox). Include on the element that owns the control's visible box.
9
+ //
10
+ // Sets font-size, padding-block, and min-height. The consumer handles
11
+ // padding-inline, border, and everything else.
12
+ // Assumes border-box (set globally in the resets layer).
13
+ //
14
+ // Resulting heights (spacing-xxs = 4px):
15
+ // sm → 14px font → 36px
16
+ // md → 16px font → 40px (default)
17
+ // lg → 20px font → 48px
18
+ //
19
+ // Usage:
20
+ // .tui-select__trigger { @include sys.control-sizing(sys.$prefix); }
21
+ //
22
+ // =============================================================================
23
+
24
+ @mixin control-sizing($prefix) {
25
+ --_fs: var(--#{$prefix}typography-size-md);
26
+ --_py: var(--#{$prefix}spacing-xxs);
27
+
28
+ font-size: var(--_fs);
29
+ padding-block: var(--_py);
30
+ min-height: calc(2em + 2 * var(--_py));
31
+
32
+ &.is-size-sm { --_fs: var(--#{$prefix}typography-size-sm); }
33
+ &.is-size-lg { --_fs: var(--#{$prefix}typography-size-lg); }
34
+ }
@@ -26,6 +26,9 @@ $brand: 'blue';
26
26
  }
27
27
  @mixin emit-color-roles($prefix:'#{$prefix}', $brand:'blue', $neutral:'gray') {
28
28
  :where(.#{$prefix}interface) {
29
+ /* UA chrome: native controls, scrollbars render in light mode */
30
+ color-scheme: light;
31
+
29
32
  /* ========================
30
33
  PRIMITIVES
31
34
  ======================== */
@@ -66,6 +69,7 @@ $brand: 'blue';
66
69
 
67
70
  /* Neutral: text */
68
71
  --#{$prefix}color-fg: #{pf.tone($neutral, 900)};
72
+ --#{$prefix}color-fg-secondary: #{pf.tone($neutral, 600)};
69
73
  --#{$prefix}color-fg-muted: #{pf.tone($neutral, 500)};
70
74
  --#{$prefix}color-fg-on-accent: #fff;
71
75
  --#{$prefix}color-fg-inverted: #{pf.tone($neutral, 25)};
@@ -139,6 +143,9 @@ $brand: 'blue';
139
143
 
140
144
  // Private: actual dark override declarations
141
145
  @mixin _dark-overrides($prefix:'tui-', $brand:'blue', $neutral:'gray') {
146
+ /* UA chrome: native controls, scrollbars render in dark mode */
147
+ color-scheme: dark;
148
+
142
149
  /* Backgrounds */
143
150
  --#{$prefix}color-bg: #{pf.tone($neutral, 900)};
144
151
  --#{$prefix}color-bg-surface: #{pf.tone($neutral, 800)};
@@ -148,6 +155,7 @@ $brand: 'blue';
148
155
 
149
156
  /* Text */
150
157
  --#{$prefix}color-fg: #{pf.tone($neutral, 50)};
158
+ --#{$prefix}color-fg-secondary: #{pf.tone($neutral, 300)};
151
159
  --#{$prefix}color-fg-muted: #{pf.tone($neutral, 400)};
152
160
  --#{$prefix}color-fg-on-accent: #fff;
153
161
  --#{$prefix}color-fg-inverted: #{pf.tone($neutral, 900)};
@@ -1,4 +1,5 @@
1
1
  @forward "constants";
2
2
  @forward "palettes";
3
3
  @forward "tokens";
4
- @forward "motion";
4
+ @forward "motion";
5
+ @forward "control";
@@ -343,6 +343,56 @@
343
343
  border-right-style: solid !important;
344
344
  }
345
345
 
346
+ // ---------------------------
347
+ // Input reset — strip browser-specific pseudo-elements
348
+ // ---------------------------
349
+ // Opt-in: apply when you're replacing native chrome with your own UI.
350
+ // Works on the input directly or on a wrapper (e.g. tui-input-group).
351
+ .#{sys.$prefix}input-reset {
352
+ // Search: cancel button, results decorations
353
+ &::-webkit-search-decoration,
354
+ &::-webkit-search-cancel-button,
355
+ &::-webkit-search-results-button,
356
+ &::-webkit-search-results-decoration,
357
+ input::-webkit-search-decoration,
358
+ input::-webkit-search-cancel-button,
359
+ input::-webkit-search-results-button,
360
+ input::-webkit-search-results-decoration {
361
+ display: none !important;
362
+ -webkit-appearance: none !important;
363
+ }
364
+
365
+ // Number: spinner buttons
366
+ &::-webkit-inner-spin-button,
367
+ &::-webkit-outer-spin-button,
368
+ input::-webkit-inner-spin-button,
369
+ input::-webkit-outer-spin-button {
370
+ -webkit-appearance: none !important;
371
+ margin: 0 !important;
372
+ }
373
+ &[type="number"],
374
+ input[type="number"] {
375
+ -moz-appearance: textfield !important;
376
+ }
377
+
378
+ // Date/time: picker indicator
379
+ &::-webkit-calendar-picker-indicator,
380
+ input::-webkit-calendar-picker-indicator {
381
+ display: none !important;
382
+ -webkit-appearance: none !important;
383
+ }
384
+
385
+ // Color: swatch
386
+ &::-webkit-color-swatch-wrapper,
387
+ input::-webkit-color-swatch-wrapper {
388
+ padding: 0 !important;
389
+ }
390
+ &::-webkit-color-swatch,
391
+ input::-webkit-color-swatch {
392
+ border: none !important;
393
+ }
394
+ }
395
+
346
396
  // ---------------------------
347
397
  // Border color utilities (semantic-only)
348
398
  // ---------------------------