@tangible/ui 0.0.18 → 0.0.20

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 (80) hide show
  1. package/README.md +32 -1
  2. package/components/Avatar/Avatar.d.ts +3 -1
  3. package/components/Avatar/Avatar.js +6 -25
  4. package/components/Avatar/index.d.ts +2 -2
  5. package/components/Avatar/index.js +1 -1
  6. package/components/Avatar/types.d.ts +8 -8
  7. package/components/Avatar/types.js +0 -12
  8. package/components/Icon/Icon.d.ts +10 -1
  9. package/components/Icon/Icon.js +5 -1
  10. package/components/Modal/Modal.js +1 -1
  11. package/components/OverlapStack/OverlapStack.js +4 -2
  12. package/components/Pager/Pager.js +9 -3
  13. package/components/Pager/types.d.ts +9 -0
  14. package/components/Pager/types.js +2 -0
  15. package/components/Progress/Progress.js +3 -3
  16. package/components/Rating/Rating.js +4 -2
  17. package/components/Rating/types.d.ts +5 -1
  18. package/components/Rating/types.js +1 -0
  19. package/components/Select/Select.d.ts +1 -1
  20. package/components/Select/Select.js +5 -3
  21. package/components/Select/types.d.ts +5 -0
  22. package/components/StepIndicator/StepIndicator.js +6 -2
  23. package/components/StepIndicator/types.d.ts +3 -0
  24. package/components/StepIndicator/types.js +1 -0
  25. package/components/Table/BulkActionsBar.js +4 -1
  26. package/components/Table/DataTable.js +8 -5
  27. package/components/index.d.ts +3 -2
  28. package/components/index.js +2 -1
  29. package/package.json +3 -1
  30. package/styles/all.css +1 -1
  31. package/styles/all.expanded.css +220 -88
  32. package/styles/all.expanded.unlayered.css +220 -88
  33. package/styles/all.unlayered.css +1 -1
  34. package/styles/components/_bundle.scss +98 -71
  35. package/styles/components/accordion.scss +289 -0
  36. package/styles/components/avatar.scss +298 -0
  37. package/styles/components/button.scss +468 -0
  38. package/styles/components/card.scss +261 -0
  39. package/styles/components/checkbox.scss +184 -0
  40. package/styles/components/chip-group.scss +49 -0
  41. package/styles/components/chip.scss +472 -0
  42. package/styles/components/combobox.scss +378 -0
  43. package/styles/components/content-indicator.scss +114 -0
  44. package/styles/components/dropdown.scss +179 -0
  45. package/styles/components/field.scss +120 -0
  46. package/styles/components/icon-button.scss +311 -0
  47. package/styles/components/icon.scss +42 -0
  48. package/styles/components/input/index.scss +6 -1
  49. package/styles/components/modal.scss +312 -0
  50. package/styles/components/move-handle.scss +383 -0
  51. package/styles/components/multi-select.scss +449 -0
  52. package/styles/components/notice.scss +430 -0
  53. package/styles/components/overlap-stack.scss +82 -0
  54. package/styles/components/pager.scss +86 -0
  55. package/styles/components/popover.scss +70 -0
  56. package/styles/components/progress.scss +403 -0
  57. package/styles/components/radio.scss +259 -0
  58. package/styles/components/rating.scss +142 -0
  59. package/styles/components/segmented-control.scss +285 -0
  60. package/styles/components/select.scss +386 -0
  61. package/styles/components/sidebar.scss +240 -0
  62. package/styles/components/step-indicator.scss +118 -0
  63. package/styles/components/step-list.scss +130 -0
  64. package/styles/components/switch.scss +229 -0
  65. package/styles/components/table.scss +140 -0
  66. package/styles/components/tabs.scss +297 -0
  67. package/styles/components/text-input.scss +142 -0
  68. package/styles/components/textarea.scss +35 -0
  69. package/styles/components/toolbar.scss +62 -0
  70. package/styles/components/tooltip.scss +102 -0
  71. package/styles/core.css +1 -0
  72. package/styles/core.scss +12 -0
  73. package/styles/core.unlayered.css +1 -0
  74. package/styles/index.scss +34 -6
  75. package/styles/system/_constants.scss +2 -2
  76. package/styles/system/_motion.scss +20 -18
  77. package/styles/system/_tokens.scss +89 -10
  78. package/tui-manifest.json +10 -3
  79. package/utils/generative.d.ts +16 -0
  80. package/utils/generative.js +45 -0
@@ -0,0 +1,312 @@
1
+ @use "../system" as sys;
2
+
3
+ /* @tui-tokens
4
+ --tui-modal-z
5
+ --tui-modal-max
6
+ --tui-modal-spacing
7
+ --tui-modal-offset-top
8
+ --tui-modal-offset-bottom
9
+ --tui-modal-offset-start
10
+ --tui-modal-offset-end
11
+ --tui-modal-backdrop
12
+ --tui-modal-bg
13
+ --tui-modal-border
14
+ --tui-modal-radius
15
+ --tui-modal-padding
16
+ --tui-modal-shadow
17
+ */
18
+
19
+ @mixin styles() {
20
+ // ==========================================================================
21
+ // Modal Component
22
+ // ==========================================================================
23
+ //
24
+ // Component API tokens (never defined here, only read via fallback):
25
+ // --tui-modal-z Z-index for modal layer
26
+ // --tui-modal-max Maximum width of dialog
27
+ // --tui-modal-spacing Base gap between dialog and viewport edge (all sides)
28
+ // --tui-modal-offset-top Extra inset from top (e.g. WP admin bar). Falls back to env(safe-area-inset-top)
29
+ // --tui-modal-offset-bottom Extra inset from bottom. Falls back to env(safe-area-inset-bottom)
30
+ // --tui-modal-offset-start Extra inset from inline-start (e.g. WP sidebar). Falls back to env(safe-area-inset-left)
31
+ // --tui-modal-offset-end Extra inset from inline-end. Falls back to env(safe-area-inset-right)
32
+ // --tui-modal-backdrop Backdrop overlay color
33
+ // --tui-modal-bg Dialog background color
34
+ // --tui-modal-border Dialog border color
35
+ // --tui-modal-radius Dialog border radius
36
+ // --tui-modal-padding Dialog padding (slots)
37
+ // --tui-modal-shadow Dialog box shadow
38
+ //
39
+ // To override from consuming code:
40
+ // .my-context .tui-modal { --tui-modal-max: 600px; }
41
+ //
42
+ // ==========================================================================
43
+
44
+ .#{sys.$prefix}modal {
45
+ // Container tokens
46
+ --_z: var(--#{sys.$prefix}modal-z, var(--#{sys.$prefix}layer-modal, 1000));
47
+ --_backdrop: var(--#{sys.$prefix}modal-backdrop, var(--#{sys.$prefix}color-bg-overlay));
48
+
49
+ // Viewport gap = spacing + offset on each side.
50
+ // --tui-modal-spacing: base breathing room (all sides).
51
+ // --tui-modal-offset-*: extra inset per side — use for WP admin bar/sidebar,
52
+ // or any host chrome. Falls back to device safe-area insets (notch, home
53
+ // indicator) which require `viewport-fit=cover` in the page's viewport meta.
54
+ --_spacing: var(--#{sys.$prefix}modal-spacing, var(--#{sys.$prefix}spacing-md));
55
+ --_offset-top: var(--#{sys.$prefix}modal-offset-top, env(safe-area-inset-top, 0px));
56
+ --_offset-bottom: var(--#{sys.$prefix}modal-offset-bottom, env(safe-area-inset-bottom, 0px));
57
+ --_offset-start: var(--#{sys.$prefix}modal-offset-start, env(safe-area-inset-left, 0px));
58
+ --_offset-end: var(--#{sys.$prefix}modal-offset-end, env(safe-area-inset-right, 0px));
59
+
60
+ position: fixed;
61
+ inset: 0;
62
+ z-index: var(--_z);
63
+ pointer-events: auto; // Reset inheritance from portal root
64
+
65
+ // Flexbox centering with overflow scroll for short viewports.
66
+ // Dialog uses margin-block: auto for vertical centering when there's room.
67
+ // When viewport is shorter than dialog min-height, container scrolls.
68
+ display: flex;
69
+ justify-content: center;
70
+ align-items: flex-start;
71
+ overflow: auto;
72
+ padding-block-start: calc(var(--_spacing) + var(--_offset-top));
73
+ padding-block-end: calc(var(--_spacing) + var(--_offset-bottom));
74
+ padding-inline-start: calc(var(--_spacing) + var(--_offset-start));
75
+ padding-inline-end: calc(var(--_spacing) + var(--_offset-end));
76
+ }
77
+
78
+ .#{sys.$prefix}modal__backdrop {
79
+ position: fixed; // Fixed so it covers viewport even when container scrolls
80
+ inset: 0;
81
+ background: var(--_backdrop);
82
+ transition: opacity var(--#{sys.$prefix}motion-duration) var(--#{sys.$prefix}motion-timing);
83
+ opacity: 0;
84
+ }
85
+
86
+ .#{sys.$prefix}modal[data-state="open"] .#{sys.$prefix}modal__backdrop {
87
+ opacity: 1;
88
+ }
89
+
90
+ // Close button needs compound selector to beat IconButton's
91
+ // `.tui-interface .tui-icon-button { position: relative }` specificity
92
+ // Positioned inside __dialog (which has position: relative)
93
+ .#{sys.$prefix}modal__dialog .#{sys.$prefix}modal__close {
94
+ position: absolute;
95
+ top: var(--#{sys.$prefix}spacing-sm);
96
+ inset-inline-end: var(--#{sys.$prefix}spacing-sm); // RTL-safe
97
+ z-index: 2;
98
+ }
99
+
100
+ .#{sys.$prefix}modal__dialog {
101
+ // Dialog tokens
102
+ --_max: var(--#{sys.$prefix}modal-max, 720px);
103
+ --_bg: var(--#{sys.$prefix}modal-bg, var(--#{sys.$prefix}color-bg-surface));
104
+ --_border: var(--#{sys.$prefix}modal-border, var(--#{sys.$prefix}color-border));
105
+ --_radius: var(--#{sys.$prefix}modal-radius, var(--#{sys.$prefix}radius-lg));
106
+ --_padding: var(--#{sys.$prefix}modal-padding, var(--#{sys.$prefix}spacing-lg));
107
+ --_shadow: var(--#{sys.$prefix}modal-shadow, var(--#{sys.$prefix}shadow-lg));
108
+
109
+ position: relative;
110
+ width: 100%;
111
+ max-inline-size: var(--_max);
112
+ max-block-size: calc(100dvh - var(--_spacing) * 2 - var(--_offset-top) - var(--_offset-bottom));
113
+ margin-block: auto; // Vertical centering via flexbox
114
+ overflow: hidden;
115
+ display: flex;
116
+ flex-direction: column;
117
+
118
+ // Minimum height prevents collapse on short viewports.
119
+ // Composed based on presence of head/foot slots via :has().
120
+ --_min-body: 8rem;
121
+ --_min-head: 0rem;
122
+ --_min-foot: 0rem;
123
+ min-block-size: calc(var(--_min-body) + var(--_min-head) + var(--_min-foot));
124
+
125
+ &:has(> .#{sys.$prefix}modal__head) {
126
+ --_min-head: 4rem;
127
+ }
128
+
129
+ &:has(> .#{sys.$prefix}modal__foot) {
130
+ --_min-foot: 4rem;
131
+ }
132
+
133
+ // Focus ring for when dialog itself receives focus (fallback target).
134
+ // WCAG 2.4.7 — keyboard users must see a focus indicator.
135
+ &:focus-visible {
136
+ outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
137
+ outline-offset: var(--#{sys.$prefix}focus-ring-offset);
138
+ }
139
+
140
+ // Box styling (previously extended from Card)
141
+ // Explicit color ensures dark mode works even when the portal root's
142
+ // inheritance chain is interrupted (e.g. Storybook reload timing).
143
+ color: var(--#{sys.$prefix}color-fg);
144
+ border-style: solid;
145
+ border-width: var(--#{sys.$prefix}border-width);
146
+ border-color: var(--_border);
147
+ border-radius: var(--_radius);
148
+ background-color: var(--_bg);
149
+ box-shadow: var(--_shadow);
150
+
151
+ // Body scrolling with min-height constraint.
152
+ // Outer sizes to content but can shrink; inner provides scroll context.
153
+ .#{sys.$prefix}modal__body {
154
+ flex: 1 1 auto;
155
+ min-height: var(--_min-body);
156
+ display: flex;
157
+ flex-direction: column;
158
+
159
+ // Block padding when body is first/last (no head/foot)
160
+ &:first-child .#{sys.$prefix}modal__body-inner {
161
+ padding-block-start: var(--_padding);
162
+ }
163
+
164
+ &:last-child .#{sys.$prefix}modal__body-inner {
165
+ padding-block-end: var(--_padding);
166
+ }
167
+ }
168
+
169
+ .#{sys.$prefix}modal__body-inner {
170
+ flex: 1 1 auto;
171
+ overflow: auto;
172
+ padding-inline: var(--_padding);
173
+
174
+ > *:first-child {
175
+ margin-block-start: unset;
176
+ }
177
+
178
+ > *:last-child {
179
+ margin-block-end: unset;
180
+ }
181
+
182
+ > p {
183
+ margin: 0;
184
+ margin-block-end: var(--#{sys.$prefix}spacing-md);
185
+
186
+ &:last-child {
187
+ margin-block-end: 0;
188
+ }
189
+ }
190
+ }
191
+
192
+ // Head slot
193
+ .#{sys.$prefix}modal__head {
194
+ padding-block: var(--_padding);
195
+ padding-inline: var(--_padding);
196
+ width: 100%;
197
+
198
+ // Icon layout: icon left, title/subtitle right
199
+ &.has-icon {
200
+ display: flex;
201
+ align-items: flex-start;
202
+ gap: var(--#{sys.$prefix}spacing-sm);
203
+ }
204
+
205
+ :is(h1, h2, h3, h4, h5, h6) {
206
+ margin-block: 0;
207
+ }
208
+ }
209
+
210
+ .#{sys.$prefix}modal__head-icon {
211
+ flex-shrink: 0;
212
+ display: flex;
213
+ align-items: center;
214
+ // Align with typical heading line-height
215
+ height: 1.5em;
216
+ font-size: var(--#{sys.$prefix}typography-size-lg);
217
+ color: var(--#{sys.$prefix}color-fg);
218
+ }
219
+
220
+ .#{sys.$prefix}modal__head-content {
221
+ flex: 1 1 auto;
222
+ min-width: 0;
223
+ }
224
+
225
+ .#{sys.$prefix}modal__head-subtitle {
226
+ margin-block-start: var(--#{sys.$prefix}spacing-xxs);
227
+ font-size: var(--#{sys.$prefix}typography-size-sm);
228
+ color: var(--#{sys.$prefix}color-fg-muted);
229
+ }
230
+
231
+ // Extra end-padding when close button is present to prevent overlap
232
+ &:has(> .#{sys.$prefix}modal__close) > .#{sys.$prefix}modal__head {
233
+ padding-inline-end: calc(var(--_padding) + var(--#{sys.$prefix}spacing-xl));
234
+ }
235
+
236
+ // Foot slot
237
+ .#{sys.$prefix}modal__foot {
238
+ padding-block: var(--_padding);
239
+ padding-inline: var(--_padding);
240
+ width: 100%;
241
+ }
242
+
243
+ // Size presets — scale min-body proportionally to width so short-content
244
+ // modals don't feel disproportionately tall at smaller sizes.
245
+ &.is-size-sm {
246
+ --_max: var(--#{sys.$prefix}modal-max, 480px);
247
+ --_min-body: 2rem;
248
+ }
249
+
250
+ &.is-size-md {
251
+ --_max: var(--#{sys.$prefix}modal-max, 720px);
252
+ }
253
+
254
+ &.is-size-lg {
255
+ --_max: var(--#{sys.$prefix}modal-max, 960px);
256
+ --_min-body: 10rem;
257
+ }
258
+
259
+ &.is-size-xl {
260
+ --_max: var(--#{sys.$prefix}modal-max, 1400px);
261
+ --_min-body: 12rem;
262
+ }
263
+
264
+ // Sticky header/footer option
265
+ &.is-sticky-head .#{sys.$prefix}modal__head {
266
+ position: sticky;
267
+ top: 0;
268
+ background: inherit;
269
+ z-index: 1;
270
+ }
271
+
272
+ &.is-sticky-foot .#{sys.$prefix}modal__foot {
273
+ position: sticky;
274
+ bottom: 0;
275
+ background: inherit;
276
+ z-index: 1;
277
+ }
278
+ }
279
+
280
+ @media (prefers-reduced-motion: no-preference) {
281
+ .#{sys.$prefix}modal__dialog {
282
+ transform: translateY(4px);
283
+ opacity: 0;
284
+ transition:
285
+ transform var(--#{sys.$prefix}motion-duration) var(--#{sys.$prefix}motion-timing),
286
+ opacity var(--#{sys.$prefix}motion-duration) var(--#{sys.$prefix}motion-timing);
287
+ }
288
+
289
+ .#{sys.$prefix}modal[data-state="open"] .#{sys.$prefix}modal__dialog {
290
+ transform: none;
291
+ opacity: 1;
292
+ }
293
+ }
294
+
295
+ // Windows High Contrast Mode support
296
+ @media (forced-colors: active) {
297
+ .#{sys.$prefix}modal__dialog {
298
+ border: 2px solid CanvasText;
299
+ }
300
+
301
+ .#{sys.$prefix}modal__backdrop {
302
+ // GrayText provides visible but subtle overlay
303
+ background: GrayText;
304
+ opacity: 0.5;
305
+ }
306
+ }
307
+
308
+ // Body scroll locking helper
309
+ .#{sys.$prefix}modal-open {
310
+ overflow: hidden;
311
+ }
312
+ }
@@ -0,0 +1,383 @@
1
+ @use "../system" as sys;
2
+
3
+ /* @tui-tokens
4
+ --tui-move-handle-size
5
+ --tui-move-handle-icon-size
6
+ --tui-move-handle-fg
7
+ --tui-move-handle-bg
8
+ --tui-move-handle-fg-interact
9
+ --tui-move-handle-bg-interact
10
+ */
11
+
12
+ @mixin styles() {
13
+ // ==========================================================================
14
+ // MoveHandle Component
15
+ // ==========================================================================
16
+ //
17
+ // Compact reorder control for sortable lists. Vertical stack of chevron-up,
18
+ // center (drag handle / index / lock), and chevron-down. The 'arrows' mode
19
+ // drops the center for explicit-move-only items (top-level containers).
20
+ //
21
+ // Component API tokens (never defined here, only read via fallback):
22
+ // --tui-move-handle-size Override container size
23
+ // --tui-move-handle-icon-size Override icon size
24
+ // --tui-move-handle-fg Chevron/handle foreground at rest
25
+ // --tui-move-handle-bg Panel background at rest
26
+ // --tui-move-handle-fg-interact Foreground on hover/focus
27
+ // --tui-move-handle-bg-interact Background on hover/focus
28
+ //
29
+ // ==========================================================================
30
+
31
+ // Structural SCSS vars (compile away)
32
+ // px for fixed touch-target sizing — immune to body font-size overrides
33
+ $_size-sm: 32px;
34
+ $_size-md: 40px;
35
+ $_handle-size-sm: 24px;
36
+ $_handle-size-md: 32px;
37
+ $_icon-scale: 0.6;
38
+ $_chevron-size: 16px;
39
+ // Center height tracks the container size (24px at md/40px, 19.2px at
40
+ // sm/32px) so a --tui-move-handle-size override keeps proportions instead
41
+ // of butting against a fixed per-size height.
42
+ $_center-scale: 0.6;
43
+
44
+ .#{sys.$prefix}interface .#{sys.$prefix}move-handle {
45
+ // Internal tokens
46
+ --_size: var(--#{sys.$prefix}move-handle-size, #{$_size-md});
47
+ --_icon-size: var(--#{sys.$prefix}move-handle-icon-size, calc(var(--_size) * #{$_icon-scale}));
48
+ --_fg: var(--#{sys.$prefix}move-handle-fg, var(--#{sys.$prefix}color-fg-muted));
49
+ --_bg: var(--#{sys.$prefix}move-handle-bg, var(--#{sys.$prefix}color-bg-muted));
50
+ --_fg-interact: var(
51
+ --#{sys.$prefix}move-handle-fg-interact,
52
+ var(--#{sys.$prefix}theme-primary-base)
53
+ );
54
+ --_bg-interact: var(
55
+ --#{sys.$prefix}move-handle-bg-interact,
56
+ var(--#{sys.$prefix}theme-primary-subtlest)
57
+ );
58
+ --_center-height: calc(var(--_size) * #{$_center-scale});
59
+
60
+ // Layout
61
+ display: inline-flex;
62
+ flex-direction: column;
63
+ align-items: center;
64
+ width: var(--_size);
65
+ min-height: calc(var(--_center-height) + 2 * #{$_chevron-size});
66
+ border-radius: var(--#{sys.$prefix}radius-sm);
67
+ background-color: var(--_bg);
68
+
69
+
70
+ // -------------------------------------------------------------------------
71
+ // Chevron buttons (up / down)
72
+ // -------------------------------------------------------------------------
73
+ &__up {
74
+ border-start-start-radius: var(--#{sys.$prefix}radius-sm);
75
+ border-start-end-radius: var(--#{sys.$prefix}radius-sm);
76
+ }
77
+ &__down {
78
+ border-end-start-radius: var(--#{sys.$prefix}radius-sm);
79
+ border-end-end-radius: var(--#{sys.$prefix}radius-sm);
80
+ }
81
+ &__up,
82
+ &__down {
83
+ // Reset
84
+ appearance: none;
85
+ border: none;
86
+ background: none;
87
+ padding: 0;
88
+ margin: 0;
89
+ font: inherit;
90
+ cursor: pointer;
91
+
92
+ // Layout
93
+ display: flex;
94
+ align-items: center;
95
+ justify-content: center;
96
+ width: 100%;
97
+ height: $_chevron-size;
98
+ color: var(--_fg);
99
+
100
+ // Motion
101
+ transition-duration: var(--#{sys.$prefix}motion-duration);
102
+ transition-timing-function: var(--#{sys.$prefix}motion-timing);
103
+ transition-property: background-color, color;
104
+
105
+ .#{sys.$prefix}icon {
106
+ font-size: var(--_icon-size);
107
+ line-height: 0.5;
108
+ }
109
+
110
+ &:hover {
111
+ color: var(--_fg-interact);
112
+ background-color: var(--_bg-interact);
113
+ }
114
+
115
+ &:focus-visible {
116
+ color: var(--_fg-interact);
117
+ outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
118
+ outline-offset: var(--#{sys.$prefix}focus-ring-offset);
119
+ }
120
+
121
+ &:disabled {
122
+ pointer-events: none;
123
+ opacity: var(--#{sys.$prefix}opacity-disabled);
124
+ }
125
+ }
126
+
127
+ // -------------------------------------------------------------------------
128
+ // Center area (handle / index / lock)
129
+ // -------------------------------------------------------------------------
130
+ &__center {
131
+ display: flex;
132
+ align-items: stretch;
133
+ justify-content: center;
134
+ flex: 1;
135
+ width: var(--_size);
136
+ min-height: var(--_center-height);
137
+
138
+ // Inherit parent radius when adjacent chevron buttons are absent
139
+ &:first-child {
140
+ border-start-start-radius: var(--#{sys.$prefix}radius-sm);
141
+ border-start-end-radius: var(--#{sys.$prefix}radius-sm);
142
+ }
143
+ &:last-child {
144
+ border-end-start-radius: var(--#{sys.$prefix}radius-sm);
145
+ border-end-end-radius: var(--#{sys.$prefix}radius-sm);
146
+ }
147
+ }
148
+
149
+ // Drag handle button
150
+ &__handle {
151
+ // Reset
152
+ appearance: none;
153
+ border: none;
154
+ background: none;
155
+ padding: 0;
156
+ margin: 0;
157
+ font: inherit;
158
+ cursor: grab;
159
+
160
+ // Layout — stretch to fill center area
161
+ display: flex;
162
+ flex: 1;
163
+ align-items: center;
164
+ justify-content: center;
165
+ width: var(--_size);
166
+ border-radius: inherit;
167
+ color: var(--_fg);
168
+
169
+ // Motion
170
+ transition-duration: var(--#{sys.$prefix}motion-duration);
171
+ transition-timing-function: var(--#{sys.$prefix}motion-timing);
172
+ transition-property: background-color, color;
173
+
174
+ .#{sys.$prefix}icon {
175
+ font-size: var(--_icon-size);
176
+ }
177
+
178
+ &:hover {
179
+ color: var(--_fg-interact);
180
+ background-color: var(--_bg-interact);
181
+ }
182
+
183
+ &:focus-visible {
184
+ color: var(--_fg-interact);
185
+ outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
186
+ outline-offset: var(--#{sys.$prefix}focus-ring-offset);
187
+ }
188
+
189
+ &:active {
190
+ cursor: grabbing;
191
+ }
192
+ }
193
+
194
+ // Index badge
195
+ &__index {
196
+ display: flex;
197
+ align-items: center;
198
+ align-self: center;
199
+ justify-content: center;
200
+ width: var(--_size);
201
+ border-radius: var(--#{sys.$prefix}radius-md);
202
+ font-size: var(--#{sys.$prefix}typography-size-sm, 0.875rem);
203
+ font-weight: var(--#{sys.$prefix}typography-weight-medium, 500);
204
+ color: var(--_fg);
205
+ user-select: none;
206
+ }
207
+
208
+ // Lock icon
209
+ &__lock {
210
+ display: flex;
211
+ align-items: center;
212
+ align-self: center;
213
+ justify-content: center;
214
+ width: var(--_size);
215
+ color: var(--_fg);
216
+ opacity: var(--#{sys.$prefix}opacity-disabled);
217
+
218
+ .#{sys.$prefix}icon {
219
+ font-size: var(--_icon-size);
220
+ }
221
+ }
222
+
223
+ // -------------------------------------------------------------------------
224
+ // Index ↔ handle hover swap
225
+ // -------------------------------------------------------------------------
226
+ // Uses opacity + position instead of display:none so the handle button
227
+ // remains focusable. Tab triggers :focus-within reliably because the
228
+ // button is always in the layout flow (just visually hidden).
229
+ &__center {
230
+ position: relative;
231
+ }
232
+
233
+ &.has-index {
234
+ .#{sys.$prefix}move-handle__index {
235
+ opacity: 1;
236
+ }
237
+
238
+ .#{sys.$prefix}move-handle__handle {
239
+ position: absolute;
240
+ opacity: 0;
241
+ pointer-events: none;
242
+ }
243
+
244
+ &:hover,
245
+ &:focus-within {
246
+ .#{sys.$prefix}move-handle__index {
247
+ display: none;
248
+ }
249
+
250
+ .#{sys.$prefix}move-handle__handle {
251
+ position: static;
252
+ opacity: 1;
253
+ pointer-events: auto;
254
+ }
255
+ }
256
+ }
257
+
258
+ // Touch devices: always show handle, hide index
259
+ @media (hover: none) {
260
+ &.has-index {
261
+ .#{sys.$prefix}move-handle__index {
262
+ display: none;
263
+ }
264
+
265
+ .#{sys.$prefix}move-handle__handle {
266
+ position: static;
267
+ opacity: 1;
268
+ pointer-events: auto;
269
+ }
270
+ }
271
+ }
272
+
273
+ // -------------------------------------------------------------------------
274
+ // Sizes
275
+ // -------------------------------------------------------------------------
276
+ &.is-size-sm {
277
+ --_size: var(--#{sys.$prefix}move-handle-size, #{$_size-sm});
278
+ // --_center-height derives from --_size; no per-size override needed.
279
+ }
280
+
281
+ // md is default (set via --_size initial value)
282
+
283
+ // -------------------------------------------------------------------------
284
+ // Locked state
285
+ // -------------------------------------------------------------------------
286
+ &.is-locked {
287
+ pointer-events: none;
288
+ }
289
+
290
+ // -------------------------------------------------------------------------
291
+ // Arrows variant — panel with chevrons only, no center (unless locked)
292
+ // -------------------------------------------------------------------------
293
+ &.is-arrows {
294
+ // No center to reserve space for — the stack is just the two chevrons.
295
+ min-height: calc(2 * #{$_chevron-size});
296
+
297
+ .#{sys.$prefix}move-handle__up,
298
+ .#{sys.$prefix}move-handle__down {
299
+ // Fill the panel when a consumer sets --tui-move-handle-size taller.
300
+ flex: 1;
301
+ min-height: #{$_chevron-size};
302
+ }
303
+ }
304
+
305
+ // -------------------------------------------------------------------------
306
+ // Handle variant — bare drag icon button, no panel chrome
307
+ // -------------------------------------------------------------------------
308
+ &.is-handle {
309
+ // Reset all full-variant styles
310
+ display: inline-flex;
311
+ align-items: center;
312
+ justify-content: center;
313
+ width: auto;
314
+ min-width: #{$_handle-size-md};
315
+ min-height: #{$_handle-size-md};
316
+ background: none;
317
+ border: none;
318
+ border-radius: var(--#{sys.$prefix}radius-sm);
319
+ padding: 0;
320
+ margin: 0;
321
+ font: inherit;
322
+ cursor: grab;
323
+ color: var(--_fg);
324
+
325
+ // Motion
326
+ transition-duration: var(--#{sys.$prefix}motion-duration);
327
+ transition-timing-function: var(--#{sys.$prefix}motion-timing);
328
+ transition-property: color;
329
+
330
+ .#{sys.$prefix}icon {
331
+ font-size: var(--_icon-size);
332
+ }
333
+
334
+ &:hover {
335
+ color: var(--_fg-interact);
336
+ }
337
+
338
+ &:focus-visible {
339
+ color: var(--_fg-interact);
340
+ outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
341
+ outline-offset: var(--#{sys.$prefix}focus-ring-offset);
342
+ }
343
+
344
+ &:active {
345
+ cursor: grabbing;
346
+ }
347
+
348
+ // WCAG 2.5.8: 24×24 meets AA Target Size (Minimum)
349
+ &.is-size-sm {
350
+ min-width: #{$_handle-size-sm};
351
+ min-height: #{$_handle-size-sm};
352
+ }
353
+ }
354
+ }
355
+
356
+ // ---------------------------------------------------------------------------
357
+ // Forced colors (high contrast mode)
358
+ // ---------------------------------------------------------------------------
359
+ @media (forced-colors: active) {
360
+ .#{sys.$prefix}move-handle__up,
361
+ .#{sys.$prefix}move-handle__down,
362
+ .#{sys.$prefix}move-handle__handle,
363
+ .#{sys.$prefix}move-handle.is-handle {
364
+ forced-color-adjust: none;
365
+ color: CanvasText;
366
+
367
+ &:hover,
368
+ &:active {
369
+ background-color: Highlight;
370
+ color: Canvas;
371
+ }
372
+
373
+ &:focus-visible {
374
+ outline: 2px solid Highlight;
375
+ outline-offset: 2px;
376
+ }
377
+
378
+ &:disabled {
379
+ color: GrayText;
380
+ }
381
+ }
382
+ }
383
+ }