@tangible/ui 0.2.0 → 0.2.1
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.
- package/components/ColorPicker/ColorArea.d.ts +24 -0
- package/components/ColorPicker/ColorArea.js +62 -0
- package/components/ColorPicker/ColorField.d.ts +59 -0
- package/components/ColorPicker/ColorField.js +88 -0
- package/components/ColorPicker/ColorPicker.d.ts +36 -0
- package/components/ColorPicker/ColorPicker.js +215 -0
- package/components/ColorPicker/ColorSlider.d.ts +20 -0
- package/components/ColorPicker/ColorSlider.js +38 -0
- package/components/ColorPicker/index.d.ts +14 -0
- package/components/ColorPicker/index.js +7 -0
- package/components/ColorPicker/labels.d.ts +42 -0
- package/components/ColorPicker/labels.js +38 -0
- package/components/ColorPicker/tracks.d.ts +4 -0
- package/components/ColorPicker/tracks.js +4 -0
- package/components/ColorPicker/usePointerDrag.d.ts +13 -0
- package/components/ColorPicker/usePointerDrag.js +34 -0
- package/components/Popover/index.d.ts +1 -1
- package/components/index.d.ts +3 -0
- package/components/index.js +1 -0
- package/icons/icons.svg +1 -0
- package/icons/manifest.json +8 -0
- package/icons/registry.d.ts +2 -0
- package/icons/registry.js +1 -0
- package/icons/system/index.d.ts +2 -0
- package/icons/system/index.js +11 -0
- package/package.json +5 -1
- package/styles/all.css +1 -1
- package/styles/all.expanded.css +273 -0
- package/styles/all.expanded.unlayered.css +273 -0
- package/styles/all.unlayered.css +1 -1
- package/styles/components/_bundle.scss +2 -0
- package/styles/components/color-picker.scss +378 -0
- package/tui-manifest.json +94 -4
- package/utils/color/color.d.ts +61 -0
- package/utils/color/color.js +293 -0
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
@use "./chip" as chip;
|
|
9
9
|
@use "./chip-group" as chipgroup;
|
|
10
10
|
@use "./combobox" as combobox;
|
|
11
|
+
@use "./color-picker" as colorpicker;
|
|
11
12
|
@use "./multi-combobox" as multicombobox;
|
|
12
13
|
@use "./content-indicator" as contentindicator;
|
|
13
14
|
@use "./date-picker" as datepicker;
|
|
@@ -74,6 +75,7 @@ $-input-dependents: (input, field, text-input, textarea, pager);
|
|
|
74
75
|
@if -wants($only, chip) { @include chip.styles(); }
|
|
75
76
|
@if -wants($only, chip-group) { @include chipgroup.styles(); }
|
|
76
77
|
@if -wants($only, combobox) { @include combobox.styles(); }
|
|
78
|
+
@if -wants($only, color-picker) { @include colorpicker.styles(); }
|
|
77
79
|
@if -wants($only, multi-combobox) { @include multicombobox.styles(); }
|
|
78
80
|
@if -wants($only, content-indicator) { @include contentindicator.styles(); }
|
|
79
81
|
@if -wants($only, date-picker) { @include datepicker.styles(); }
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
@use "../system" as sys;
|
|
2
|
+
|
|
3
|
+
/* @tui-tokens
|
|
4
|
+
--tui-color-area-radius
|
|
5
|
+
--tui-color-area-min-height
|
|
6
|
+
--tui-color-area-thumb-size
|
|
7
|
+
--tui-color-slider-radius
|
|
8
|
+
--tui-color-slider-height
|
|
9
|
+
--tui-color-slider-thumb-size
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
@mixin styles() {
|
|
13
|
+
// ==========================================================================
|
|
14
|
+
// ColorPicker primitives — ColorArea (2D) + ColorSlider (hue / alpha)
|
|
15
|
+
// ==========================================================================
|
|
16
|
+
//
|
|
17
|
+
// The thumb chrome (white ring + dark halo) and the alpha checkerboard use
|
|
18
|
+
// fixed neutral values on purpose: they must read on top of an ARBITRARY
|
|
19
|
+
// user colour, so they can't defer to theme tokens.
|
|
20
|
+
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// Color area — 2D saturation × value
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-area {
|
|
25
|
+
position: relative;
|
|
26
|
+
width: 100%;
|
|
27
|
+
aspect-ratio: 3 / 2;
|
|
28
|
+
min-height: var(--#{sys.$prefix}color-area-min-height, 140px);
|
|
29
|
+
border-radius: var(--#{sys.$prefix}color-area-radius, var(--#{sys.$prefix}radius-md));
|
|
30
|
+
cursor: crosshair;
|
|
31
|
+
touch-action: none;
|
|
32
|
+
user-select: none;
|
|
33
|
+
|
|
34
|
+
&:focus-visible {
|
|
35
|
+
outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
|
|
36
|
+
outline-offset: var(--#{sys.$prefix}focus-ring-offset);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&.is-disabled {
|
|
40
|
+
opacity: var(--#{sys.$prefix}opacity-disabled);
|
|
41
|
+
pointer-events: none;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-area__thumb {
|
|
46
|
+
position: absolute;
|
|
47
|
+
width: var(--#{sys.$prefix}color-area-thumb-size, 14px);
|
|
48
|
+
height: var(--#{sys.$prefix}color-area-thumb-size, 14px);
|
|
49
|
+
transform: translate(-50%, -50%);
|
|
50
|
+
border-radius: var(--#{sys.$prefix}radius-full, 999px);
|
|
51
|
+
background: var(--_swatch);
|
|
52
|
+
border: 2px solid #fff;
|
|
53
|
+
box-shadow: 0 0 0 1px rgb(0 0 0 / 0.35);
|
|
54
|
+
pointer-events: none;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// ---------------------------------------------------------------------------
|
|
58
|
+
// Color slider — hue / alpha
|
|
59
|
+
// ---------------------------------------------------------------------------
|
|
60
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-slider {
|
|
61
|
+
position: relative;
|
|
62
|
+
height: var(--#{sys.$prefix}color-slider-height, 12px);
|
|
63
|
+
border-radius: var(--#{sys.$prefix}color-slider-radius, var(--#{sys.$prefix}radius-full, 999px));
|
|
64
|
+
cursor: pointer;
|
|
65
|
+
touch-action: none;
|
|
66
|
+
user-select: none;
|
|
67
|
+
|
|
68
|
+
&:focus-visible {
|
|
69
|
+
outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
|
|
70
|
+
outline-offset: var(--#{sys.$prefix}focus-ring-offset);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&.is-disabled {
|
|
74
|
+
opacity: var(--#{sys.$prefix}opacity-disabled);
|
|
75
|
+
pointer-events: none;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Alpha checkerboard (fixed neutral — a transparency indicator)
|
|
79
|
+
&.has-checkerboard {
|
|
80
|
+
background-color: #fff;
|
|
81
|
+
background-image: linear-gradient(45deg, #ccc 25%, transparent 25%),
|
|
82
|
+
linear-gradient(-45deg, #ccc 25%, transparent 25%),
|
|
83
|
+
linear-gradient(45deg, transparent 75%, #ccc 75%),
|
|
84
|
+
linear-gradient(-45deg, transparent 75%, #ccc 75%);
|
|
85
|
+
background-size: 8px 8px;
|
|
86
|
+
background-position: 0 0, 0 4px, 4px -4px, -4px 0;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-slider__track {
|
|
91
|
+
position: absolute;
|
|
92
|
+
inset: 0;
|
|
93
|
+
border-radius: inherit;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-slider__thumb {
|
|
97
|
+
position: absolute;
|
|
98
|
+
top: 50%;
|
|
99
|
+
width: var(--#{sys.$prefix}color-slider-thumb-size, 16px);
|
|
100
|
+
height: var(--#{sys.$prefix}color-slider-thumb-size, 16px);
|
|
101
|
+
transform: translate(-50%, -50%);
|
|
102
|
+
border-radius: var(--#{sys.$prefix}radius-full, 999px);
|
|
103
|
+
background: transparent;
|
|
104
|
+
border: 2px solid #fff;
|
|
105
|
+
box-shadow: 0 0 0 1px rgb(0 0 0 / 0.35);
|
|
106
|
+
pointer-events: none;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// ---------------------------------------------------------------------------
|
|
110
|
+
// ColorPicker composition
|
|
111
|
+
// ---------------------------------------------------------------------------
|
|
112
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-picker {
|
|
113
|
+
display: flex;
|
|
114
|
+
flex-direction: column;
|
|
115
|
+
gap: var(--#{sys.$prefix}spacing-sm);
|
|
116
|
+
width: 100%;
|
|
117
|
+
|
|
118
|
+
&.is-disabled {
|
|
119
|
+
opacity: var(--#{sys.$prefix}opacity-disabled);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-picker__value {
|
|
124
|
+
display: flex;
|
|
125
|
+
align-items: center;
|
|
126
|
+
gap: var(--#{sys.$prefix}spacing-xxs);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Copy button fills the row height so it lines up with the field group.
|
|
130
|
+
// Extra specificity to beat IconButton's own fixed height.
|
|
131
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-picker__value .#{sys.$prefix}color-picker__copy {
|
|
132
|
+
flex: none;
|
|
133
|
+
align-self: stretch;
|
|
134
|
+
block-size: auto;
|
|
135
|
+
height: auto;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Compact format Select trigger; the value field takes the rest of the width.
|
|
139
|
+
// Smaller type keeps the trigger narrow so wide formats (oklch) don't squish
|
|
140
|
+
// the channel inputs. Height stays put — the named control-height token wins.
|
|
141
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-picker__format {
|
|
142
|
+
flex: none;
|
|
143
|
+
min-width: 0;
|
|
144
|
+
font-size: var(--#{sys.$prefix}typography-size-xs);
|
|
145
|
+
padding-inline: var(--#{sys.$prefix}spacing-xs);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// The value field group — one bordered box holding the hex/var input OR the
|
|
149
|
+
// per-channel inputs, with a compact format switcher at its trailing edge.
|
|
150
|
+
// Matches the control height of its neighbours (swatch, copy).
|
|
151
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-picker__field-group {
|
|
152
|
+
flex: 1 1 auto;
|
|
153
|
+
min-width: 0;
|
|
154
|
+
display: flex;
|
|
155
|
+
align-items: center;
|
|
156
|
+
gap: var(--#{sys.$prefix}spacing-xxs);
|
|
157
|
+
min-height: var(--#{sys.$prefix}control-height-md, 2.5rem);
|
|
158
|
+
padding-inline: var(--#{sys.$prefix}spacing-xxs);
|
|
159
|
+
border: var(--#{sys.$prefix}border-width) solid var(--#{sys.$prefix}color-border);
|
|
160
|
+
border-radius: var(--#{sys.$prefix}radius-md);
|
|
161
|
+
background: var(--#{sys.$prefix}input-bg, var(--#{sys.$prefix}color-bg-surface));
|
|
162
|
+
font-size: var(--#{sys.$prefix}typography-size-xs);
|
|
163
|
+
|
|
164
|
+
&:focus-within {
|
|
165
|
+
border-color: var(--#{sys.$prefix}focus-ring-color);
|
|
166
|
+
outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
|
|
167
|
+
outline-offset: calc(-1 * var(--#{sys.$prefix}border-width));
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Hex / var text input — borderless; the group owns the border + focus ring.
|
|
172
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-picker__field-input {
|
|
173
|
+
flex: 1 1 auto;
|
|
174
|
+
min-width: 0;
|
|
175
|
+
width: 100%;
|
|
176
|
+
border: 0;
|
|
177
|
+
padding: 0;
|
|
178
|
+
background: transparent;
|
|
179
|
+
color: inherit;
|
|
180
|
+
font: inherit;
|
|
181
|
+
text-align: start;
|
|
182
|
+
|
|
183
|
+
&:focus,
|
|
184
|
+
&:focus-visible {
|
|
185
|
+
outline: none;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// Per-channel inputs (rgb / hsl / hwb / oklch) — a borderless flex row that
|
|
190
|
+
// fills the field group; the group provides the border + focus ring.
|
|
191
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-picker__channels {
|
|
192
|
+
flex: 1 1 auto;
|
|
193
|
+
min-width: 0;
|
|
194
|
+
display: flex;
|
|
195
|
+
align-items: center;
|
|
196
|
+
gap: var(--#{sys.$prefix}spacing-xxs);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-picker__channel {
|
|
200
|
+
flex: 1 1 0;
|
|
201
|
+
min-width: 0;
|
|
202
|
+
display: flex;
|
|
203
|
+
align-items: baseline;
|
|
204
|
+
gap: 0.125em;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-picker__channel-letter {
|
|
208
|
+
flex: none;
|
|
209
|
+
color: var(--#{sys.$prefix}color-fg-muted);
|
|
210
|
+
font-size: var(--#{sys.$prefix}typography-size-xs);
|
|
211
|
+
line-height: 1;
|
|
212
|
+
user-select: none;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-picker__channel-input {
|
|
216
|
+
flex: 1 1 auto;
|
|
217
|
+
min-width: 0;
|
|
218
|
+
width: 100%;
|
|
219
|
+
border: 0;
|
|
220
|
+
padding: 0;
|
|
221
|
+
background: transparent;
|
|
222
|
+
color: inherit;
|
|
223
|
+
font: inherit;
|
|
224
|
+
text-align: start;
|
|
225
|
+
border-radius: var(--#{sys.$prefix}radius-sm);
|
|
226
|
+
|
|
227
|
+
// The group carries the :focus-within ring; each field additionally shows a
|
|
228
|
+
// subtle tint so a sighted keyboard user can tell WHICH channel has focus.
|
|
229
|
+
&:focus-visible {
|
|
230
|
+
outline: none;
|
|
231
|
+
background: var(--#{sys.$prefix}color-bg-muted);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-picker__var {
|
|
236
|
+
margin: 0;
|
|
237
|
+
font-size: var(--#{sys.$prefix}typography-size-xs);
|
|
238
|
+
color: var(--#{sys.$prefix}color-fg-muted);
|
|
239
|
+
|
|
240
|
+
code {
|
|
241
|
+
font-family: var(--#{sys.$prefix}font-family-mono, monospace);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// Kept in the DOM (so the aria-live region announces on toggle) but
|
|
245
|
+
// collapsed when there's nothing to say. Not display:none — that would
|
|
246
|
+
// remove it from the accessibility tree and defeat the live region.
|
|
247
|
+
&.is-empty {
|
|
248
|
+
block-size: 0;
|
|
249
|
+
overflow: hidden;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// ---------------------------------------------------------------------------
|
|
254
|
+
// ColorField — pill trigger with a circular icon-swatch, opens the picker
|
|
255
|
+
// ---------------------------------------------------------------------------
|
|
256
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-field {
|
|
257
|
+
display: inline-flex;
|
|
258
|
+
align-items: center;
|
|
259
|
+
gap: var(--#{sys.$prefix}spacing-sm);
|
|
260
|
+
min-block-size: var(--#{sys.$prefix}control-height-md, 2.5rem);
|
|
261
|
+
padding: var(--#{sys.$prefix}spacing-xxs);
|
|
262
|
+
padding-inline-end: var(--#{sys.$prefix}spacing-sm);
|
|
263
|
+
border: var(--#{sys.$prefix}border-width) solid var(--#{sys.$prefix}color-border);
|
|
264
|
+
border-radius: var(--#{sys.$prefix}radius-md);
|
|
265
|
+
background: var(--#{sys.$prefix}input-bg, var(--#{sys.$prefix}color-bg-surface));
|
|
266
|
+
color: var(--#{sys.$prefix}color-fg);
|
|
267
|
+
font: inherit;
|
|
268
|
+
font-size: var(--#{sys.$prefix}typography-size-sm);
|
|
269
|
+
line-height: 1;
|
|
270
|
+
cursor: pointer;
|
|
271
|
+
|
|
272
|
+
&.is-size-sm {
|
|
273
|
+
min-block-size: var(--#{sys.$prefix}control-height-sm, 2.25rem);
|
|
274
|
+
}
|
|
275
|
+
&.is-size-lg {
|
|
276
|
+
min-block-size: var(--#{sys.$prefix}control-height-lg, 3rem);
|
|
277
|
+
font-size: var(--#{sys.$prefix}typography-size-md);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// Compact: just the circular icon-swatch, no label.
|
|
281
|
+
&.is-swatch-only {
|
|
282
|
+
padding-inline-end: var(--#{sys.$prefix}spacing-xxs);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
&:hover {
|
|
286
|
+
border-color: var(--#{sys.$prefix}color-border-strong, var(--#{sys.$prefix}color-border));
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// Match the shared form-control focus treatment: border turns primary plus
|
|
290
|
+
// an offset ring. data-popover-open keeps it lit while the picker is open.
|
|
291
|
+
&:focus-visible,
|
|
292
|
+
&[data-popover-open] {
|
|
293
|
+
border-color: var(--#{sys.$prefix}input-border-focus, var(--#{sys.$prefix}theme-primary-base));
|
|
294
|
+
outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
|
|
295
|
+
outline-offset: var(--#{sys.$prefix}focus-ring-offset);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
&.is-disabled {
|
|
299
|
+
opacity: var(--#{sys.$prefix}opacity-disabled);
|
|
300
|
+
pointer-events: none;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// Icon-swatch — the colour (or a neutral fill for dynamic values) with a
|
|
305
|
+
// contrast-picked white/black icon centred on top. A rounded square that
|
|
306
|
+
// tracks the field's radius (rounds up with the token, matching the pill).
|
|
307
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-field__swatch {
|
|
308
|
+
// A square sized to the field's inner height. Both dimensions are set
|
|
309
|
+
// explicitly (not aspect-ratio) — in a flex row, flex-basis:auto would size
|
|
310
|
+
// the width from the icon content and defeat aspect-ratio.
|
|
311
|
+
--_size: calc(var(--#{sys.$prefix}control-height-md, 2.5rem) - 2 * var(--#{sys.$prefix}spacing-xxs) - 2 * var(--#{sys.$prefix}border-width));
|
|
312
|
+
flex: none;
|
|
313
|
+
display: inline-flex;
|
|
314
|
+
align-items: center;
|
|
315
|
+
justify-content: center;
|
|
316
|
+
inline-size: var(--_size);
|
|
317
|
+
block-size: var(--_size);
|
|
318
|
+
border-radius: var(--#{sys.$prefix}radius-sm);
|
|
319
|
+
background-color: var(--#{sys.$prefix}color-bg);
|
|
320
|
+
background-image: linear-gradient(var(--_swatch), var(--_swatch)),
|
|
321
|
+
linear-gradient(45deg, #ccc 25%, transparent 25%),
|
|
322
|
+
linear-gradient(-45deg, #ccc 25%, transparent 25%),
|
|
323
|
+
linear-gradient(45deg, transparent 75%, #ccc 75%),
|
|
324
|
+
linear-gradient(-45deg, transparent 75%, #ccc 75%);
|
|
325
|
+
background-size: 100% 100%, 6px 6px, 6px 6px, 6px 6px, 6px 6px;
|
|
326
|
+
background-position: 0 0, 0 0, 0 3px, 3px -3px, -3px 0;
|
|
327
|
+
}
|
|
328
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-field.is-size-sm .#{sys.$prefix}color-field__swatch {
|
|
329
|
+
--_size: calc(var(--#{sys.$prefix}control-height-sm, 2.25rem) - 2 * var(--#{sys.$prefix}spacing-xxs) - 2 * var(--#{sys.$prefix}border-width));
|
|
330
|
+
}
|
|
331
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-field.is-size-lg .#{sys.$prefix}color-field__swatch {
|
|
332
|
+
--_size: calc(var(--#{sys.$prefix}control-height-lg, 3rem) - 2 * var(--#{sys.$prefix}spacing-xxs) - 2 * var(--#{sys.$prefix}border-width));
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// The Icon renders <span class="tui-icon …"><svg width="1em"/></span>, so the
|
|
336
|
+
// glyph scales with FONT-SIZE, not inline/block-size (that only grows the span).
|
|
337
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-field__swatch-icon {
|
|
338
|
+
font-size: 1.25rem; // ~20px glyph
|
|
339
|
+
color: var(--_swatch-icon, #fff);
|
|
340
|
+
}
|
|
341
|
+
// Per-size overrides need the size class as an ANCESTOR of the icon — a nested
|
|
342
|
+
// `.is-size-sm &` inverts the order and never matches.
|
|
343
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-field.is-size-sm .#{sys.$prefix}color-field__swatch-icon {
|
|
344
|
+
font-size: 1.125rem; // ~18px
|
|
345
|
+
}
|
|
346
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-field.is-size-lg .#{sys.$prefix}color-field__swatch-icon {
|
|
347
|
+
font-size: 1.5rem; // ~24px
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-field__label {
|
|
351
|
+
min-inline-size: 0;
|
|
352
|
+
overflow: hidden;
|
|
353
|
+
text-overflow: ellipsis;
|
|
354
|
+
white-space: nowrap;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-field__popover {
|
|
358
|
+
inline-size: 20rem;
|
|
359
|
+
max-inline-size: calc(100vw - 2rem);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
@media (forced-colors: active) {
|
|
363
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-area,
|
|
364
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-slider {
|
|
365
|
+
&:focus-visible {
|
|
366
|
+
outline-color: Highlight;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-picker__channels:focus-within {
|
|
371
|
+
outline-color: Highlight;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.#{sys.$prefix}interface .#{sys.$prefix}color-picker__channel-input:focus-visible {
|
|
375
|
+
outline: 1px solid Highlight;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
package/tui-manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.2.
|
|
3
|
-
"generated": "2026-07-
|
|
2
|
+
"version": "0.2.1",
|
|
3
|
+
"generated": "2026-07-31T16:10:25.058Z",
|
|
4
4
|
"components": {
|
|
5
5
|
"Accordion": {
|
|
6
6
|
"props": {
|
|
@@ -799,6 +799,96 @@
|
|
|
799
799
|
"use": null,
|
|
800
800
|
"notFor": null
|
|
801
801
|
},
|
|
802
|
+
"ColorPicker": {
|
|
803
|
+
"props": {
|
|
804
|
+
"value": {
|
|
805
|
+
"type": "string",
|
|
806
|
+
"required": false,
|
|
807
|
+
"description": "Controlled value — a CSS colour OR a `var(--x[, fallback])` reference."
|
|
808
|
+
},
|
|
809
|
+
"onValueChange": {
|
|
810
|
+
"type": "(value: string) => void",
|
|
811
|
+
"required": false
|
|
812
|
+
},
|
|
813
|
+
"format": {
|
|
814
|
+
"type": "\"hex\" | \"rgb\" | \"hsl\" | \"hwb\" | \"oklch\"",
|
|
815
|
+
"required": false,
|
|
816
|
+
"description": "Controlled format for the value field."
|
|
817
|
+
},
|
|
818
|
+
"defaultFormat": {
|
|
819
|
+
"type": "\"hex\" | \"rgb\" | \"hsl\" | \"hwb\" | \"oklch\"",
|
|
820
|
+
"required": false,
|
|
821
|
+
"defaultValue": "hex",
|
|
822
|
+
"description": "Uncontrolled initial format."
|
|
823
|
+
},
|
|
824
|
+
"formats": {
|
|
825
|
+
"type": "ColorFormat[]",
|
|
826
|
+
"required": false,
|
|
827
|
+
"defaultValue": "['hex','rgb','hsl','hwb','oklch']",
|
|
828
|
+
"description": "Formats offered in the format selector, in order. The selector is hidden\nwhen only one is supplied."
|
|
829
|
+
},
|
|
830
|
+
"alpha": {
|
|
831
|
+
"type": "boolean",
|
|
832
|
+
"required": false,
|
|
833
|
+
"defaultValue": "true",
|
|
834
|
+
"description": "Show the alpha slider (and keep alpha in the emitted value)."
|
|
835
|
+
},
|
|
836
|
+
"disabled": {
|
|
837
|
+
"type": "boolean",
|
|
838
|
+
"required": false
|
|
839
|
+
},
|
|
840
|
+
"labels": {
|
|
841
|
+
"type": "ColorPickerLabels",
|
|
842
|
+
"required": false,
|
|
843
|
+
"description": "Override any user-facing string for i18n."
|
|
844
|
+
},
|
|
845
|
+
"className": {
|
|
846
|
+
"type": "string",
|
|
847
|
+
"required": false
|
|
848
|
+
},
|
|
849
|
+
"id": {
|
|
850
|
+
"type": "string",
|
|
851
|
+
"required": false
|
|
852
|
+
},
|
|
853
|
+
"style": {
|
|
854
|
+
"type": "CSSProperties",
|
|
855
|
+
"required": false
|
|
856
|
+
},
|
|
857
|
+
"title": {
|
|
858
|
+
"type": "string",
|
|
859
|
+
"required": false
|
|
860
|
+
},
|
|
861
|
+
"rel": {
|
|
862
|
+
"type": "string",
|
|
863
|
+
"required": false
|
|
864
|
+
},
|
|
865
|
+
"onClick": {
|
|
866
|
+
"type": "MouseEventHandler<HTMLDivElement>",
|
|
867
|
+
"required": false
|
|
868
|
+
}
|
|
869
|
+
},
|
|
870
|
+
"cssTokens": [
|
|
871
|
+
"--tui-color-area-radius",
|
|
872
|
+
"--tui-color-area-min-height",
|
|
873
|
+
"--tui-color-area-thumb-size",
|
|
874
|
+
"--tui-color-slider-radius",
|
|
875
|
+
"--tui-color-slider-height",
|
|
876
|
+
"--tui-color-slider-thumb-size"
|
|
877
|
+
],
|
|
878
|
+
"story": {
|
|
879
|
+
"title": "Forms/ColorPicker",
|
|
880
|
+
"tags": [
|
|
881
|
+
"autodocs"
|
|
882
|
+
]
|
|
883
|
+
},
|
|
884
|
+
"subcomponents": null,
|
|
885
|
+
"description": null,
|
|
886
|
+
"gotchas": null,
|
|
887
|
+
"examples": null,
|
|
888
|
+
"related": null,
|
|
889
|
+
"use": null,
|
|
890
|
+
"notFor": null
|
|
891
|
+
},
|
|
802
892
|
"Combobox": {
|
|
803
893
|
"props": {
|
|
804
894
|
"size": {
|
|
@@ -3324,9 +3414,9 @@
|
|
|
3324
3414
|
"membersync": 22,
|
|
3325
3415
|
"player": 24,
|
|
3326
3416
|
"reaction": 36,
|
|
3327
|
-
"system":
|
|
3417
|
+
"system": 95
|
|
3328
3418
|
},
|
|
3329
|
-
"total":
|
|
3419
|
+
"total": 227,
|
|
3330
3420
|
"manifest": "./icons/manifest.json"
|
|
3331
3421
|
}
|
|
3332
3422
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export type Rgb = {
|
|
2
|
+
r: number;
|
|
3
|
+
g: number;
|
|
4
|
+
b: number;
|
|
5
|
+
};
|
|
6
|
+
export type Hsv = {
|
|
7
|
+
h: number;
|
|
8
|
+
s: number;
|
|
9
|
+
v: number;
|
|
10
|
+
};
|
|
11
|
+
export type Hsva = Hsv & {
|
|
12
|
+
a: number;
|
|
13
|
+
};
|
|
14
|
+
export type ColorFormat = 'hex' | 'rgb' | 'hsl' | 'hwb' | 'oklch';
|
|
15
|
+
export declare const COLOR_FORMATS: ColorFormat[];
|
|
16
|
+
/** A parsed picker value: a concrete color, a CSS variable reference, or invalid. */
|
|
17
|
+
export type ParsedColor = {
|
|
18
|
+
kind: 'color';
|
|
19
|
+
hsva: Hsva;
|
|
20
|
+
} | {
|
|
21
|
+
kind: 'var';
|
|
22
|
+
raw: string;
|
|
23
|
+
name: string;
|
|
24
|
+
fallback?: string;
|
|
25
|
+
} | {
|
|
26
|
+
kind: 'invalid';
|
|
27
|
+
raw: string;
|
|
28
|
+
};
|
|
29
|
+
export declare function hsvToRgb({ h, s, v }: Hsv): Rgb;
|
|
30
|
+
export declare function rgbToHsv({ r, g, b }: Rgb): Hsv;
|
|
31
|
+
export declare function rgbToHex({ r, g, b }: Rgb, a?: number): string;
|
|
32
|
+
export declare function hexToRgba(hex: string): Hsva | null;
|
|
33
|
+
export declare function rgbToHsl({ r, g, b }: Rgb): {
|
|
34
|
+
h: number;
|
|
35
|
+
s: number;
|
|
36
|
+
l: number;
|
|
37
|
+
};
|
|
38
|
+
export declare function hslToRgb(h: number, s: number, l: number): Rgb;
|
|
39
|
+
export declare function rgbToHwb({ r, g, b }: Rgb): {
|
|
40
|
+
h: number;
|
|
41
|
+
w: number;
|
|
42
|
+
b: number;
|
|
43
|
+
};
|
|
44
|
+
export declare function hwbToRgb(h: number, w: number, bl: number): Rgb;
|
|
45
|
+
export declare function rgbToOklch({ r, g, b }: Rgb): {
|
|
46
|
+
l: number;
|
|
47
|
+
c: number;
|
|
48
|
+
h: number;
|
|
49
|
+
};
|
|
50
|
+
export declare function oklchToRgb(L: number, C: number, H: number): Rgb;
|
|
51
|
+
export declare function parseColor(value: string | null | undefined): ParsedColor;
|
|
52
|
+
export declare function formatColor(hsva: Hsva, format: ColorFormat): string;
|
|
53
|
+
/**
|
|
54
|
+
* Try to resolve a `var(--x)` reference to a concrete color for the swatch. Uses
|
|
55
|
+
* getComputedStyle if a DOM element is available and the var is set; otherwise
|
|
56
|
+
* falls back to the var's own fallback, then null. NEVER throws and never
|
|
57
|
+
* requires the variable to be present.
|
|
58
|
+
*/
|
|
59
|
+
export declare function resolveVarColor(parsed: Extract<ParsedColor, {
|
|
60
|
+
kind: 'var';
|
|
61
|
+
}>, el?: Element | null): string | null;
|