@tangible/ui 0.0.17 → 0.0.19

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 (57) hide show
  1. package/README.md +31 -1
  2. package/components/Popover/Popover.d.ts +21 -0
  3. package/components/Popover/Popover.js +148 -0
  4. package/components/Popover/PopoverContext.d.ts +3 -0
  5. package/components/Popover/PopoverContext.js +9 -0
  6. package/components/Popover/index.d.ts +2 -0
  7. package/components/Popover/index.js +1 -0
  8. package/components/Popover/types.d.ts +83 -0
  9. package/components/Popover/types.js +11 -0
  10. package/components/index.d.ts +2 -0
  11. package/components/index.js +1 -0
  12. package/package.json +7 -1
  13. package/styles/all.css +1 -1
  14. package/styles/all.expanded.css +35 -0
  15. package/styles/all.expanded.unlayered.css +35 -0
  16. package/styles/all.unlayered.css +1 -1
  17. package/styles/components/_bundle.scss +98 -69
  18. package/styles/components/accordion.scss +289 -0
  19. package/styles/components/avatar.scss +346 -0
  20. package/styles/components/button.scss +468 -0
  21. package/styles/components/card.scss +261 -0
  22. package/styles/components/checkbox.scss +184 -0
  23. package/styles/components/chip-group.scss +49 -0
  24. package/styles/components/chip.scss +472 -0
  25. package/styles/components/combobox.scss +378 -0
  26. package/styles/components/content-indicator.scss +114 -0
  27. package/styles/components/dropdown.scss +179 -0
  28. package/styles/components/field.scss +120 -0
  29. package/styles/components/icon-button.scss +311 -0
  30. package/styles/components/icon.scss +42 -0
  31. package/styles/components/modal.scss +312 -0
  32. package/styles/components/move-handle.scss +383 -0
  33. package/styles/components/multi-select.scss +449 -0
  34. package/styles/components/notice.scss +430 -0
  35. package/styles/components/overlap-stack.scss +81 -0
  36. package/styles/components/pager.scss +83 -0
  37. package/styles/components/popover.scss +70 -0
  38. package/styles/components/progress.scss +391 -0
  39. package/styles/components/radio.scss +259 -0
  40. package/styles/components/rating.scss +142 -0
  41. package/styles/components/segmented-control.scss +285 -0
  42. package/styles/components/select.scss +386 -0
  43. package/styles/components/sidebar.scss +240 -0
  44. package/styles/components/step-indicator.scss +118 -0
  45. package/styles/components/step-list.scss +130 -0
  46. package/styles/components/switch.scss +229 -0
  47. package/styles/components/table.scss +139 -0
  48. package/styles/components/tabs.scss +297 -0
  49. package/styles/components/text-input.scss +142 -0
  50. package/styles/components/textarea.scss +35 -0
  51. package/styles/components/toolbar.scss +62 -0
  52. package/styles/components/tooltip.scss +102 -0
  53. package/styles/core.css +1 -0
  54. package/styles/core.scss +12 -0
  55. package/styles/core.unlayered.css +1 -0
  56. package/styles/index.scss +29 -4
  57. package/tui-manifest.json +41 -2
@@ -0,0 +1,120 @@
1
+ @use "../system" as sys;
2
+
3
+ /* @tui-tokens
4
+ --tui-field-gap
5
+ --tui-field-label-fg
6
+ --tui-field-helper-fg
7
+ --tui-field-error-fg
8
+ */
9
+
10
+ @mixin styles() {
11
+ // ==========================================================================
12
+ // Field Component
13
+ // ==========================================================================
14
+ //
15
+ // Provides consistent wrapper structure for form fields with label,
16
+ // helper text, and error messaging.
17
+ //
18
+ // Component API tokens (never defined here, only read via fallback):
19
+ // --tui-field-gap Gap between field elements
20
+ // --tui-field-label-fg Label text color
21
+ // --tui-field-helper-fg Helper text color
22
+ // --tui-field-error-fg Error text color
23
+ //
24
+ // To override from consuming code:
25
+ // .my-context .tui-field { --tui-field-gap: 0.5rem; }
26
+ //
27
+ // ==========================================================================
28
+
29
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}field {
30
+ // Internal tokens — read component API with fallback to primitives
31
+ --_gap: var(--#{sys.$prefix}field-gap, var(--#{sys.$prefix}spacing-xs));
32
+ --_label-fg: var(--#{sys.$prefix}field-label-fg, var(--#{sys.$prefix}color-fg));
33
+ --_helper-fg: var(--#{sys.$prefix}field-helper-fg, var(--#{sys.$prefix}color-fg-secondary));
34
+ --_error-fg: var(--#{sys.$prefix}field-error-fg, var(--#{sys.$prefix}theme-danger-base));
35
+
36
+ display: flex;
37
+ flex-direction: column;
38
+ gap: var(--_gap);
39
+
40
+ // -------------------------------------------------------------------------
41
+ // Inline layout: label and control on same row
42
+ // -------------------------------------------------------------------------
43
+ &.is-layout-inline {
44
+ display: grid;
45
+ grid-template-columns: auto 1fr;
46
+ align-items: baseline;
47
+ column-gap: var(--#{sys.$prefix}spacing-sm);
48
+ row-gap: var(--_gap);
49
+
50
+ // Label stays in first column
51
+ .#{sys.$prefix}field__label {
52
+ grid-column: 1;
53
+ }
54
+
55
+ // Control spans or sits in second column
56
+ // Using a wrapper or direct child selector
57
+ > :not(.#{sys.$prefix}field__label):not(.#{sys.$prefix}field__helper):not(.#{sys.$prefix}field__error) {
58
+ grid-column: 2;
59
+ }
60
+
61
+ // Helper/error span full width below
62
+ .#{sys.$prefix}field__helper,
63
+ .#{sys.$prefix}field__error {
64
+ grid-column: 2;
65
+ }
66
+ }
67
+
68
+ // -------------------------------------------------------------------------
69
+ // Label
70
+ // -------------------------------------------------------------------------
71
+ &__label {
72
+ color: var(--_label-fg);
73
+ font-size: var(--#{sys.$prefix}typography-size-sm);
74
+ font-weight: bold;
75
+ line-height: 1.25;
76
+ }
77
+
78
+ // -------------------------------------------------------------------------
79
+ // Required indicator
80
+ // -------------------------------------------------------------------------
81
+ &__required {
82
+ color: var(--_error-fg);
83
+ margin-inline-start: 0.125em;
84
+ }
85
+
86
+ // -------------------------------------------------------------------------
87
+ // Helper text
88
+ // -------------------------------------------------------------------------
89
+ &__helper {
90
+ color: var(--_helper-fg);
91
+ font-size: var(--#{sys.$prefix}typography-size-xs);
92
+ line-height: 1.4;
93
+ }
94
+
95
+ // -------------------------------------------------------------------------
96
+ // Error message
97
+ // -------------------------------------------------------------------------
98
+ &__error {
99
+ color: var(--_error-fg);
100
+ font-size: var(--#{sys.$prefix}typography-size-xs);
101
+ line-height: 1.4;
102
+ }
103
+
104
+ // -------------------------------------------------------------------------
105
+ // Error state
106
+ // -------------------------------------------------------------------------
107
+ &.is-error {
108
+ .#{sys.$prefix}field__label {
109
+ color: var(--_error-fg);
110
+ }
111
+ }
112
+
113
+ // -------------------------------------------------------------------------
114
+ // Disabled state
115
+ // -------------------------------------------------------------------------
116
+ &.is-disabled {
117
+ pointer-events: none;
118
+ }
119
+ }
120
+ }
@@ -0,0 +1,311 @@
1
+ @use "../system" as sys;
2
+
3
+ /* @tui-tokens
4
+ --tui-icon-button-bg
5
+ --tui-icon-button-fg
6
+ --tui-icon-button-border
7
+ --tui-icon-button-radius
8
+ --tui-icon-button-bg-interact
9
+ --tui-icon-button-fg-interact
10
+ */
11
+
12
+ @mixin styles() {
13
+ // ==========================================================================
14
+ // IconButton Component
15
+ // ==========================================================================
16
+ //
17
+ // Square button containing only an icon. For toolbar actions, close buttons,
18
+ // navigation controls, etc.
19
+ //
20
+ // Component API tokens (never defined here, only read via fallback):
21
+ // --tui-icon-button-bg Background color
22
+ // --tui-icon-button-fg Icon color
23
+ // --tui-icon-button-border Border color
24
+ // --tui-icon-button-radius Border radius
25
+ // --tui-icon-button-bg-interact Hover/focus/active background
26
+ // --tui-icon-button-fg-interact Hover/focus/active icon color
27
+ //
28
+ // To override from consuming code:
29
+ // .my-context .tui-icon-button { --tui-icon-button-bg: hotpink; }
30
+ //
31
+ // ---------------------------------------------------------------------------
32
+ // Notes
33
+ // ---------------------------------------------------------------------------
34
+ //
35
+ // Size xs:
36
+ // xs (24px) is IconButton-only — no shared --tui-control-height-xs token.
37
+ // Uses a smaller radius fallback (radius-sm) to stay proportional.
38
+ // At 24px, this is below WCAG 2.5.8's 24×24 CSS pixel minimum for pointer
39
+ // targets. Acceptable inside toolbars with adequate spacing; add padding or
40
+ // min-size when used standalone on touch interfaces.
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.
46
+ //
47
+ // ==========================================================================
48
+
49
+ // Size defaults (used as fallbacks when control-height tokens aren't set)
50
+ $_size-xs: 1.5rem; // 24px — xs is IconButton-only, no shared token
51
+ $_size-sm: 2rem; // 32px
52
+ $_size-md: 2.5rem; // 40px
53
+ $_size-lg: 3rem; // 48px
54
+
55
+ // Icon scale relative to button size.
56
+ // Icons render at 50% of the button's --_size dimension (e.g., 16px in a 32px button).
57
+ // This ratio keeps icons optically balanced within the square hit target.
58
+ $_icon-scale: 0.75;
59
+
60
+ // Note: NOT using :where() here - we need real specificity to compete with
61
+ // WordPress theme styles in plugin contexts.
62
+ .#{sys.$prefix}interface .#{sys.$prefix}icon-button {
63
+ // Internal tokens — read component API with fallback to primitives
64
+ --_bg: var(--#{sys.$prefix}icon-button-bg, transparent);
65
+ --_fg: var(--#{sys.$prefix}icon-button-fg, var(--#{sys.$prefix}color-fg));
66
+ --_border: var(--#{sys.$prefix}icon-button-border, transparent);
67
+ --_radius: var(--#{sys.$prefix}icon-button-radius, var(--#{sys.$prefix}radius-md));
68
+
69
+ // Interact state fallbacks
70
+ --_bg-interact: var(--#{sys.$prefix}icon-button-bg-interact, var(--#{sys.$prefix}theme-secondary-subtle));
71
+ --_fg-interact: var(--#{sys.$prefix}icon-button-fg-interact, var(--#{sys.$prefix}color-fg));
72
+
73
+ // Pressed/toggle state — visually distinct from hover
74
+ --_bg-pressed: var(--#{sys.$prefix}theme-secondary-soft);
75
+
76
+ // Reset
77
+ appearance: none;
78
+ border: none;
79
+ background: none;
80
+ padding: 0;
81
+ margin: 0;
82
+ font: inherit;
83
+ cursor: pointer;
84
+ text-decoration: none;
85
+
86
+ // Layout — square, centered content
87
+ display: inline-flex;
88
+ align-items: center;
89
+ justify-content: center;
90
+ position: relative;
91
+
92
+ // Default size (sm) — reads shared control-height token with hardcoded fallback
93
+ --_size: var(--#{sys.$prefix}control-height-sm, #{$_size-sm});
94
+ width: var(--_size);
95
+ height: var(--_size);
96
+
97
+ // Visual
98
+ background-color: var(--_bg);
99
+ color: var(--_fg);
100
+ border: var(--#{sys.$prefix}border-width) solid var(--_border);
101
+ border-radius: var(--_radius);
102
+
103
+ // Motion
104
+ transition-duration: var(--#{sys.$prefix}motion-duration);
105
+ transition-timing-function: var(--#{sys.$prefix}motion-timing);
106
+ transition-property: background-color, color, border-color;
107
+
108
+ // Icon sizing — scales with button size
109
+ .#{sys.$prefix}icon {
110
+ font-size: calc(var(--_size) * #{$_icon-scale});
111
+ }
112
+
113
+ // -------------------------------------------------------------------------
114
+ // States
115
+ // -------------------------------------------------------------------------
116
+ &:hover {
117
+ --_bg: var(--_bg-interact);
118
+ --_fg: var(--_fg-interact);
119
+ }
120
+
121
+ &:focus-visible {
122
+ --_bg: var(--_bg-interact);
123
+ --_fg: var(--_fg-interact);
124
+ outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
125
+ outline-offset: var(--#{sys.$prefix}focus-ring-offset);
126
+ }
127
+
128
+ &:active {
129
+ --_bg: var(--_bg-interact);
130
+ --_fg: var(--_fg-interact);
131
+ }
132
+
133
+ &[aria-pressed="true"] {
134
+ --_bg: var(--_bg-pressed);
135
+ --_fg: var(--_fg-interact);
136
+ }
137
+
138
+ &:where(:disabled, [aria-disabled="true"], .is-disabled) {
139
+ pointer-events: none;
140
+ cursor: not-allowed;
141
+ opacity: var(--#{sys.$prefix}opacity-disabled);
142
+ }
143
+
144
+ // -------------------------------------------------------------------------
145
+ // Sizes
146
+ // -------------------------------------------------------------------------
147
+ &.is-size-xs {
148
+ --_size: #{$_size-xs};
149
+ --_radius: var(--#{sys.$prefix}icon-button-radius, var(--#{sys.$prefix}radius-sm));
150
+ }
151
+
152
+ &.is-size-md {
153
+ --_size: var(--#{sys.$prefix}control-height-md, #{$_size-md});
154
+ }
155
+
156
+ &.is-size-lg {
157
+ --_size: var(--#{sys.$prefix}control-height-lg, #{$_size-lg});
158
+ }
159
+
160
+ // -------------------------------------------------------------------------
161
+ // Shape
162
+ // -------------------------------------------------------------------------
163
+ &.is-shape-circle {
164
+ border-radius: var(--#{sys.$prefix}radius-full);
165
+ }
166
+
167
+ // -------------------------------------------------------------------------
168
+ // Themes
169
+ // -------------------------------------------------------------------------
170
+ &.is-theme-primary {
171
+ --_fg: var(--#{sys.$prefix}icon-button-fg, var(--#{sys.$prefix}theme-primary-base));
172
+ --_fg-interact: var(--#{sys.$prefix}icon-button-fg-interact, var(--#{sys.$prefix}theme-primary-strong));
173
+ --_bg-interact: var(--#{sys.$prefix}icon-button-bg-interact, var(--#{sys.$prefix}theme-primary-subtlest));
174
+ --_bg-pressed: var(--#{sys.$prefix}theme-primary-subtle);
175
+ }
176
+
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);
182
+ }
183
+
184
+ // -------------------------------------------------------------------------
185
+ // Variants
186
+ // -------------------------------------------------------------------------
187
+ // Ghost is default (transparent background, no border)
188
+
189
+ // Outline: border visible, bg on hover
190
+ &.is-style-outline {
191
+ --_border: var(--#{sys.$prefix}icon-button-border, var(--#{sys.$prefix}color-border));
192
+ --_bg-interact: var(--#{sys.$prefix}icon-button-bg-interact, var(--#{sys.$prefix}theme-secondary-subtle));
193
+ }
194
+
195
+ &.is-style-outline.is-theme-primary {
196
+ --_border: var(--#{sys.$prefix}icon-button-border, var(--#{sys.$prefix}theme-primary-base));
197
+ --_bg-interact: var(--#{sys.$prefix}icon-button-bg-interact, var(--#{sys.$prefix}theme-primary-subtlest));
198
+ --_fg-interact: var(--#{sys.$prefix}icon-button-fg-interact, var(--#{sys.$prefix}theme-primary-strong));
199
+ }
200
+
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));
205
+ }
206
+
207
+ // Solid: filled background, darken on hover
208
+ &.is-style-solid {
209
+ --_bg: var(--#{sys.$prefix}icon-button-bg, var(--#{sys.$prefix}theme-secondary-subtle));
210
+ --_fg: var(--#{sys.$prefix}icon-button-fg, var(--#{sys.$prefix}color-fg));
211
+ --_bg-pressed: var(--#{sys.$prefix}theme-secondary-soft);
212
+
213
+ &:hover,
214
+ &:focus-visible,
215
+ &:active {
216
+ --_bg: var(--#{sys.$prefix}icon-button-bg-interact, var(--#{sys.$prefix}theme-secondary-soft));
217
+ }
218
+
219
+ &[aria-pressed="true"] {
220
+ --_bg: var(--_bg-pressed);
221
+ }
222
+ }
223
+
224
+ &.is-style-solid.is-theme-primary {
225
+ --_bg: var(--#{sys.$prefix}icon-button-bg, var(--#{sys.$prefix}theme-primary-base));
226
+ --_fg: var(--#{sys.$prefix}icon-button-fg, var(--#{sys.$prefix}color-fg-on-accent));
227
+ --_bg-pressed: var(--#{sys.$prefix}theme-primary-stronger);
228
+
229
+ &:hover,
230
+ &:focus-visible,
231
+ &:active {
232
+ --_bg: var(--#{sys.$prefix}icon-button-bg-interact, var(--#{sys.$prefix}theme-primary-stronger));
233
+ }
234
+
235
+ &[aria-pressed="true"] {
236
+ --_bg: var(--_bg-pressed);
237
+ }
238
+ }
239
+
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);
253
+ }
254
+ }
255
+
256
+ // -------------------------------------------------------------------------
257
+ // Loading spinner
258
+ // -------------------------------------------------------------------------
259
+ &[aria-busy="true"] {
260
+ pointer-events: none;
261
+
262
+ .#{sys.$prefix}icon {
263
+ visibility: hidden;
264
+ }
265
+ }
266
+
267
+ &__spinner {
268
+ position: absolute;
269
+ width: 1em;
270
+ height: 1em;
271
+ border: 0.15em solid currentColor;
272
+ border-right-color: transparent;
273
+ border-radius: 50%;
274
+ animation: #{sys.$prefix}spin 0.85s linear infinite;
275
+
276
+ @media (prefers-reduced-motion: reduce) {
277
+ animation: none;
278
+ border-style: dashed;
279
+ }
280
+ }
281
+ }
282
+
283
+ // ---------------------------------------------------------------------------
284
+ // Forced colors (high contrast mode)
285
+ // ---------------------------------------------------------------------------
286
+ @media (forced-colors: active) {
287
+ .#{sys.$prefix}icon-button {
288
+ forced-color-adjust: none;
289
+ background-color: Canvas;
290
+ color: CanvasText;
291
+ border-color: CanvasText;
292
+ }
293
+
294
+ .#{sys.$prefix}icon-button:is(:hover, :active) {
295
+ background-color: Highlight;
296
+ color: Canvas;
297
+ }
298
+
299
+ .#{sys.$prefix}icon-button:focus-visible {
300
+ outline: 2px solid Highlight;
301
+ outline-offset: 2px;
302
+ }
303
+
304
+ .#{sys.$prefix}icon-button:is(:disabled, [aria-disabled="true"]) {
305
+ color: GrayText;
306
+ border-color: GrayText;
307
+ background-color: Canvas;
308
+ }
309
+ }
310
+
311
+ }
@@ -0,0 +1,42 @@
1
+ @use "../system" as sys;
2
+
3
+ /* @tui-tokens
4
+ --tui-icon-size-xs
5
+ --tui-icon-size-sm
6
+ --tui-icon-size-md
7
+ --tui-icon-size-lg
8
+ --tui-icon-size-xl
9
+ --tui-icon-size-xxl
10
+ */
11
+
12
+ @mixin styles() {
13
+ // ==========================================================================
14
+ // Icon Component
15
+ // ==========================================================================
16
+ //
17
+ // Component API tokens (never defined here, only read via fallback):
18
+ // --tui-icon-size-{xs,sm,md,lg,xl,xxl} Size overrides per scale
19
+ //
20
+ // Default behavior: inherits font-size from parent (icons scale with text)
21
+ //
22
+ // ==========================================================================
23
+
24
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}icon {
25
+ display: inline-flex;
26
+ vertical-align: -0.125em;
27
+ line-height: 1;
28
+
29
+ // Size variants
30
+ @each $size in (xs, sm, md, lg, xl, xxl) {
31
+ &.is-size-#{$size} {
32
+ font-size: var(--#{sys.$prefix}icon-size-#{$size}, var(--#{sys.$prefix}typography-size-#{$size}));
33
+ }
34
+ }
35
+
36
+ svg {
37
+ width: 1em;
38
+ height: 1em;
39
+ fill: currentColor;
40
+ }
41
+ }
42
+ }