@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,261 @@
1
+ @use "../system" as sys;
2
+
3
+ /* @tui-tokens
4
+ --tui-card-bg
5
+ --tui-card-border
6
+ --tui-card-border-width
7
+ --tui-card-border-interact
8
+ --tui-card-radius
9
+ --tui-card-shadow
10
+ --tui-card-shadow-interact
11
+ --tui-card-padding
12
+ --tui-card-foot-basis
13
+ */
14
+
15
+ @mixin styles() {
16
+ // ==========================================================================
17
+ // Card Component
18
+ // ==========================================================================
19
+ //
20
+ // Component API tokens (never defined here, only read via fallback):
21
+ // --tui-card-bg Background color
22
+ // --tui-card-border Border color
23
+ // --tui-card-border-width Border width (falls back to --tui-border-width)
24
+ // --tui-card-border-interact Hover/focus border color
25
+ // --tui-card-radius Border radius
26
+ // --tui-card-shadow Box shadow (elevated style)
27
+ // --tui-card-shadow-interact Hover box shadow (elevated style)
28
+ // --tui-card-padding Padding (inline and block)
29
+ // --tui-card-foot-basis Flex basis for foot in inline layout
30
+ //
31
+ // To override from consuming code:
32
+ // .my-context .tui-card { --tui-card-bg: var(--tui-palette-color-blue-50); }
33
+ //
34
+ // ==========================================================================
35
+
36
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}card {
37
+ // Internal tokens — read component API with fallback to primitives
38
+ --_bg: var(--#{sys.$prefix}card-bg, var(--#{sys.$prefix}color-bg-surface));
39
+ --_border: var(--#{sys.$prefix}card-border, var(--#{sys.$prefix}color-border));
40
+ --_border-width: var(--#{sys.$prefix}card-border-width, var(--#{sys.$prefix}border-width));
41
+ --_border-interact: var(--#{sys.$prefix}card-border-interact, var(--#{sys.$prefix}theme-primary-base));
42
+ --_radius: var(--#{sys.$prefix}card-radius, var(--#{sys.$prefix}radius-md));
43
+ --_shadow: var(--#{sys.$prefix}card-shadow, var(--#{sys.$prefix}shadow-sm));
44
+ --_shadow-interact: var(--#{sys.$prefix}card-shadow-interact, var(--#{sys.$prefix}shadow-md));
45
+ --_padding: var(--#{sys.$prefix}card-padding, var(--#{sys.$prefix}spacing-lg));
46
+ // 500px fallback gives the foot slot enough room for action buttons in inline
47
+ // layout without crowding the body. Override via --tui-card-foot-basis.
48
+ --_foot-basis: var(--#{sys.$prefix}card-foot-basis, 500px);
49
+
50
+ container-type: inline-size;
51
+ container-name: tuiCard;
52
+ position: relative;
53
+ width: 100%;
54
+ border-style: solid;
55
+ border-width: var(--_border-width);
56
+ border-color: var(--_border);
57
+ border-radius: var(--_radius);
58
+ background-color: var(--_bg);
59
+
60
+ // -------------------------------------------------------------------------
61
+ // Media
62
+ // -------------------------------------------------------------------------
63
+ img.#{sys.$prefix}card__media {
64
+ max-width: 100%;
65
+
66
+ &.is-flush {
67
+ border-radius: 0;
68
+ }
69
+ }
70
+
71
+ .#{sys.$prefix}card__media.is-flush {
72
+ margin-inline: calc(var(--_padding) * -1);
73
+ max-width: calc(100% + 2 * var(--_padding));
74
+ border-radius: 0;
75
+ }
76
+
77
+ // -------------------------------------------------------------------------
78
+ // Slots
79
+ // -------------------------------------------------------------------------
80
+ &__head {
81
+ padding-block: var(--_padding);
82
+ padding-inline: var(--_padding);
83
+ width: 100%;
84
+
85
+ .#{sys.$prefix}card__media.is-flush:first-child {
86
+ margin-block-start: calc(var(--_padding) * -1);
87
+ // 1px inset is intentional for sub-pixel precision — ensures flush media
88
+ // corners sit cleanly inside the card border. Not referencing --tui-border-width
89
+ // because the visual correction is independent of border thickness.
90
+ border-start-end-radius: calc(var(--_radius) - 1px);
91
+ border-start-start-radius: calc(var(--_radius) - 1px);
92
+ }
93
+ }
94
+
95
+ &__body {
96
+ padding-inline: var(--_padding);
97
+ width: 100%;
98
+
99
+ > *:first-child {
100
+ margin-block-start: unset;
101
+ }
102
+
103
+ > *:last-child {
104
+ margin-block-end: unset;
105
+ }
106
+
107
+ > p {
108
+ margin: 0;
109
+ }
110
+
111
+ &:first-child {
112
+ padding-block-start: var(--_padding);
113
+ }
114
+
115
+ &:last-child {
116
+ padding-block-end: var(--_padding);
117
+ }
118
+ }
119
+
120
+ &__foot {
121
+ padding-block: var(--_padding);
122
+ padding-inline: var(--_padding);
123
+ width: 100%;
124
+
125
+ .#{sys.$prefix}card__media.is-flush:last-child {
126
+ margin-block-end: calc(var(--_padding) * -1);
127
+ border-end-end-radius: calc(var(--_radius) - 1px);
128
+ border-end-start-radius: calc(var(--_radius) - 1px);
129
+ }
130
+ }
131
+
132
+ // -------------------------------------------------------------------------
133
+ // Inline layout (container query)
134
+ // -------------------------------------------------------------------------
135
+ // :where() on the layout context keeps slot specificity equal to base
136
+ // selectors — consumers can override without fighting the cascade.
137
+ @container tuiCard (width >= 400px) {
138
+ :where(&.is-layout-inline) .#{sys.$prefix}card__inner {
139
+ display: flex;
140
+ flex-direction: row;
141
+ align-items: center;
142
+ gap: var(--_padding);
143
+
144
+ .#{sys.$prefix}card__media.is-flush {
145
+ object-fit: cover;
146
+ object-position: center;
147
+ margin-block: calc(var(--_padding) * -1);
148
+ height: calc(100% + 2 * var(--_padding));
149
+ }
150
+
151
+ *:has(.#{sys.$prefix}card__media.is-flush) {
152
+ align-self: stretch;
153
+ }
154
+
155
+ .#{sys.$prefix}card__head {
156
+ padding-inline-start: var(--_padding);
157
+ padding-block: var(--_padding);
158
+ flex: 0 1 auto;
159
+
160
+ &:has(.#{sys.$prefix}icon:only-child) {
161
+ flex: 0 0 max-content;
162
+ }
163
+
164
+ .#{sys.$prefix}card__media.is-flush:first-child {
165
+ margin-inline-end: var(--_padding);
166
+ max-width: calc(100% + var(--_padding));
167
+ border-start-end-radius: 0;
168
+ border-end-start-radius: calc(var(--_radius) - 1px);
169
+ }
170
+ }
171
+
172
+ .#{sys.$prefix}card__body {
173
+ flex: 2 1 auto;
174
+ padding-block: var(--_padding);
175
+ }
176
+
177
+ .#{sys.$prefix}card__foot {
178
+ width: unset;
179
+ flex: 0 1 var(--_foot-basis);
180
+ padding-block: var(--_padding);
181
+ padding-inline-end: var(--_padding);
182
+ margin-inline-start: auto;
183
+ justify-content: flex-end;
184
+
185
+ .#{sys.$prefix}card__media.is-flush:last-child {
186
+ margin-inline-start: var(--_padding);
187
+ max-width: calc(100% + var(--_padding));
188
+ border-end-start-radius: 0;
189
+ border-start-end-radius: calc(var(--_radius) - 1px);
190
+ }
191
+ }
192
+
193
+ .#{sys.$prefix}card__head,
194
+ .#{sys.$prefix}card__body,
195
+ .#{sys.$prefix}card__foot {
196
+ &:not(:first-child) {
197
+ padding-inline-start: 0;
198
+ }
199
+
200
+ &:not(:last-child) {
201
+ padding-inline-end: 0;
202
+ }
203
+ }
204
+ }
205
+ }
206
+
207
+ // -------------------------------------------------------------------------
208
+ // Interactive state
209
+ // -------------------------------------------------------------------------
210
+ &.has-interaction {
211
+ transition-duration: var(--#{sys.$prefix}motion-duration);
212
+ transition-timing-function: var(--#{sys.$prefix}motion-timing);
213
+ transition-property: border-color, color, background-color;
214
+
215
+ &:hover {
216
+ --_border: var(--_border-interact);
217
+ }
218
+
219
+ &:focus-visible,
220
+ &:has(:focus-visible) {
221
+ --_border: var(--_border-interact);
222
+ }
223
+
224
+ &:active,
225
+ &.active {
226
+ --_border: var(--#{sys.$prefix}card-border-active, var(--#{sys.$prefix}theme-primary-soft));
227
+ }
228
+ }
229
+
230
+ // Stretched link focus ring (WCAG 2.4.7)
231
+ .#{sys.$prefix}stretched-link {
232
+ &:focus {
233
+ outline: none;
234
+ }
235
+
236
+ &:focus-visible::after {
237
+ outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
238
+ outline-offset: calc(-1 * var(--#{sys.$prefix}focus-ring-offset));
239
+ border-radius: var(--_radius);
240
+ }
241
+ }
242
+
243
+ // Disabled state
244
+ &[aria-disabled="true"] {
245
+ opacity: var(--#{sys.$prefix}opacity-disabled);
246
+ pointer-events: none;
247
+ }
248
+
249
+ // -------------------------------------------------------------------------
250
+ // Elevated style
251
+ // -------------------------------------------------------------------------
252
+ &.is-style-elevated {
253
+ box-shadow: var(--_shadow);
254
+ transition-property: border-color, color, background-color, box-shadow;
255
+
256
+ &:hover {
257
+ box-shadow: var(--_shadow-interact);
258
+ }
259
+ }
260
+ }
261
+ }
@@ -0,0 +1,184 @@
1
+ @use "../system" as sys;
2
+
3
+ /* @tui-tokens
4
+ --tui-checkbox-accent
5
+ --tui-checkbox-border
6
+ --tui-checkbox-border-invalid
7
+ --tui-checkbox-radius
8
+ --tui-checkbox-bg
9
+ --tui-checkbox-size
10
+ --tui-checkbox-gap
11
+ --tui-checkbox-label-color
12
+ */
13
+
14
+ // Structural SCSS constants (compile away, not overridable)
15
+ $_checkmark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
16
+ $_indeterminate: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round'%3E%3Cpath d='M6 12h12'/%3E%3C/svg%3E");
17
+
18
+ @mixin styles() {
19
+ // ==========================================================================
20
+ // Checkbox Component
21
+ // ==========================================================================
22
+ //
23
+ // Custom checkbox via appearance: none. Opt-in via class OR convention:
24
+ // - `.tui-inline-choice__control` class on any input[type="checkbox"]
25
+ // - any `<input type="checkbox">` inside a `.tui-inline-choice` wrapper
26
+ // Bare `<input type="checkbox">` outside both contexts renders natively.
27
+ // Toggle (.tui-toggle) checkboxes are visually hidden and unaffected.
28
+ //
29
+ // Component API tokens (never defined here, only read via fallback):
30
+ // --tui-checkbox-accent Accent color for checked/indeterminate
31
+ // → --tui-input-accent → --tui-theme-primary-base
32
+ // --tui-checkbox-border Border color (unchecked)
33
+ // → --tui-color-border
34
+ // --tui-checkbox-border-invalid Border color (invalid)
35
+ // → --tui-theme-danger-base
36
+ // --tui-checkbox-radius Border radius
37
+ // → --tui-radius-sm
38
+ // --tui-checkbox-bg Background color (unchecked)
39
+ // → --tui-color-bg
40
+ // --tui-checkbox-size Font-size (controls box size via em units)
41
+ // --tui-checkbox-gap Gap between checkbox and label (labeled mode)
42
+ // --tui-checkbox-label-color Label text colour (labeled mode)
43
+ //
44
+ // Note: Checkmark/indeterminate icons are white (#fff) SVGs embedded as
45
+ // data URIs. CSS custom properties cannot be referenced inside data URIs,
46
+ // so the icon colour is fixed. Accent overrides must contrast against white
47
+ // at 3:1 or better to keep the icon legible.
48
+ //
49
+ // ==========================================================================
50
+
51
+ // ---------------------------------------------------------------------------
52
+ // Base custom checkbox
53
+ // ---------------------------------------------------------------------------
54
+
55
+ .#{sys.$prefix}interface :is(
56
+ .#{sys.$prefix}inline-choice__control[type="checkbox"],
57
+ .#{sys.$prefix}inline-choice input[type="checkbox"]
58
+ ) {
59
+ // Internal tokens with real fallbacks
60
+ --_accent: var(--#{sys.$prefix}checkbox-accent, var(--#{sys.$prefix}input-accent, var(--#{sys.$prefix}theme-primary-base)));
61
+ --_border: var(--#{sys.$prefix}checkbox-border, var(--#{sys.$prefix}color-border));
62
+ --_radius: var(--#{sys.$prefix}checkbox-radius, var(--#{sys.$prefix}radius-sm));
63
+ --_bg: var(--#{sys.$prefix}checkbox-bg, var(--#{sys.$prefix}color-bg));
64
+
65
+ // Reset native appearance
66
+ appearance: none;
67
+ margin: 0;
68
+
69
+ // Inherit font-size so the em-based box dimensions track the surrounding
70
+ // text. Without this, the input uses the browser default (~13.333px) and
71
+ // the box renders smaller than its context.
72
+ font-size: inherit;
73
+
74
+ // Box
75
+ display: inline-block;
76
+ width: 1em;
77
+ min-width: 1em;
78
+ height: 1em;
79
+ min-height: 1em;
80
+ flex-shrink: 0;
81
+
82
+ // Visual
83
+ border: var(--#{sys.$prefix}border-width) solid var(--_border);
84
+ border-radius: var(--_radius);
85
+ background-color: var(--_bg);
86
+ background-size: 75%;
87
+ background-position: center;
88
+ background-repeat: no-repeat;
89
+ cursor: pointer;
90
+
91
+ // Transitions
92
+ transition-duration: var(--#{sys.$prefix}motion-duration);
93
+ transition-timing-function: var(--#{sys.$prefix}motion-timing);
94
+ transition-property: background-color, border-color;
95
+
96
+ // Checked
97
+ &:checked {
98
+ background-color: var(--_accent);
99
+ border-color: var(--_accent);
100
+ background-image: $_checkmark;
101
+ }
102
+
103
+ // Indeterminate — uses :indeterminate pseudo-class which tracks the DOM property.
104
+ // NOT [data-indeterminate] — the browser clears the DOM property on click (giving
105
+ // visual feedback), then React's useEffect re-sets it. The data attribute never
106
+ // clears, which would prevent the visual toggle.
107
+ &:indeterminate {
108
+ background-color: var(--_accent);
109
+ border-color: var(--_accent);
110
+ background-image: $_indeterminate;
111
+ }
112
+
113
+ // Invalid
114
+ &[aria-invalid="true"] {
115
+ --_border: var(--#{sys.$prefix}checkbox-border-invalid, var(--#{sys.$prefix}theme-danger-base));
116
+ }
117
+
118
+ // Focus
119
+ &:focus-visible {
120
+ outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
121
+ outline-offset: var(--#{sys.$prefix}focus-ring-offset);
122
+ }
123
+
124
+ // Disabled — only in bare mode (no wrapper).
125
+ // Labeled mode uses .is-disabled on the wrapper to avoid 0.75 × 0.75 = 0.56 opacity stacking.
126
+ &:disabled {
127
+ cursor: not-allowed;
128
+ }
129
+ }
130
+
131
+ // Disabled opacity for bare checkboxes (not inside a labeled wrapper).
132
+ // Labeled mode applies opacity on the .is-disabled wrapper instead.
133
+ .#{sys.$prefix}interface .#{sys.$prefix}inline-choice__control[type="checkbox"]:disabled {
134
+ opacity: var(--#{sys.$prefix}opacity-disabled);
135
+ }
136
+
137
+ .#{sys.$prefix}interface .#{sys.$prefix}inline-choice :is(
138
+ .#{sys.$prefix}inline-choice__control[type="checkbox"],
139
+ input[type="checkbox"]
140
+ ):disabled {
141
+ opacity: 1;
142
+ }
143
+
144
+ // ---------------------------------------------------------------------------
145
+ // Checkbox-specific overrides for labeled mode (inside tui-inline-choice)
146
+ // ---------------------------------------------------------------------------
147
+
148
+ .#{sys.$prefix}interface .#{sys.$prefix}inline-choice:has(input[type="checkbox"]) {
149
+ gap: var(--#{sys.$prefix}checkbox-gap, var(--#{sys.$prefix}spacing-xs));
150
+
151
+ :is(.#{sys.$prefix}inline-choice__control[type="checkbox"], input[type="checkbox"]) {
152
+ font-size: var(--#{sys.$prefix}checkbox-size, 1.15em);
153
+ flex: 0 0 1em;
154
+ }
155
+
156
+ & > span {
157
+ color: var(--#{sys.$prefix}checkbox-label-color, inherit);
158
+ }
159
+ }
160
+
161
+ // Disabled label styling within inline-choice
162
+ .#{sys.$prefix}interface .#{sys.$prefix}inline-choice.is-disabled {
163
+ opacity: var(--#{sys.$prefix}opacity-disabled);
164
+ cursor: not-allowed;
165
+
166
+ input {
167
+ cursor: not-allowed;
168
+ }
169
+ }
170
+
171
+ // ---------------------------------------------------------------------------
172
+ // Forced colors (Windows High Contrast Mode)
173
+ // ---------------------------------------------------------------------------
174
+
175
+ @media (forced-colors: active) {
176
+ .#{sys.$prefix}interface :is(
177
+ .#{sys.$prefix}inline-choice__control[type="checkbox"],
178
+ .#{sys.$prefix}inline-choice input[type="checkbox"]
179
+ ) {
180
+ // Let the browser render the checkbox natively in WHCM
181
+ forced-color-adjust: auto;
182
+ }
183
+ }
184
+ }
@@ -0,0 +1,49 @@
1
+ @use "../system" as sys;
2
+
3
+ /* @tui-tokens
4
+ --tui-chip-group-gap
5
+ */
6
+
7
+ @mixin styles() {
8
+ // ==========================================================================
9
+ // ChipGroup Component
10
+ // ==========================================================================
11
+ //
12
+ // Component API tokens (never defined here, only read via fallback):
13
+ // --tui-chip-group-gap Gap between chips
14
+ //
15
+ // To override from consuming code:
16
+ // .my-context .tui-chip-group { --tui-chip-group-gap: 2rem; }
17
+ //
18
+ // ==========================================================================
19
+
20
+ .tui-chip-group {
21
+ display: flex;
22
+ flex-wrap: wrap;
23
+ gap: var(--_gap, var(--#{sys.$prefix}chip-group-gap, var(--#{sys.$prefix}spacing-sm)));
24
+
25
+ // Density
26
+ &.is-density-xs { --_gap: var(--#{sys.$prefix}chip-group-gap, var(--#{sys.$prefix}spacing-xs)); }
27
+ &.is-density-sm { --_gap: var(--#{sys.$prefix}chip-group-gap, var(--#{sys.$prefix}spacing-sm)); }
28
+ &.is-density-md { --_gap: var(--#{sys.$prefix}chip-group-gap, var(--#{sys.$prefix}spacing-md)); }
29
+
30
+ // Direction
31
+ &.is-direction-stack {
32
+ flex-direction: column;
33
+ flex-wrap: nowrap;
34
+ }
35
+
36
+ // Alignment — inline applies justify-content, stack applies align-items
37
+ &:not(.is-direction-stack) {
38
+ &.is-align-start { justify-content: flex-start; }
39
+ &.is-align-center { justify-content: center; }
40
+ &.is-align-end { justify-content: flex-end; }
41
+ }
42
+
43
+ &.is-direction-stack {
44
+ &.is-align-start { align-items: flex-start; }
45
+ &.is-align-center { align-items: center; }
46
+ &.is-align-end { align-items: flex-end; }
47
+ }
48
+ }
49
+ }