@storybook/addon-docs 10.1.0-alpha.8 → 10.1.0-beta.0

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 (33) hide show
  1. package/dist/_browser-chunks/Color-S5NAVK5F.js +1096 -0
  2. package/dist/_browser-chunks/{DocsRenderer-HT7GNKAR.js → DocsRenderer-GHJI37HO.js} +2 -2
  3. package/dist/_browser-chunks/{chunk-MM7DTO55.js → chunk-A242L54C.js} +10 -16
  4. package/dist/_browser-chunks/chunk-CYSK6WYR.js +7 -0
  5. package/dist/_browser-chunks/chunk-DDRHE7EB.js +949 -0
  6. package/dist/_browser-chunks/{chunk-74ZUTOZN.js → chunk-OATZR77O.js} +9 -22
  7. package/dist/_browser-chunks/chunk-UUESKCKV.js +31 -0
  8. package/dist/_node-chunks/{chunk-QSBD55JK.js → chunk-OGE4GWLB.js} +13 -19
  9. package/dist/_node-chunks/chunk-PRNIBEEO.js +196 -0
  10. package/dist/_node-chunks/chunk-SEBYU7IP.js +168 -0
  11. package/dist/_node-chunks/chunk-SZXCUVK4.js +22630 -0
  12. package/dist/_node-chunks/mdx-plugin-NLBBLG32.js +1032 -0
  13. package/dist/_node-chunks/rehype-external-links-V2D4HT5U.js +121 -0
  14. package/dist/_node-chunks/{rehype-slug-X6WEPBMC.js → rehype-slug-U5W6TP4H.js} +24 -58
  15. package/dist/angular/index.js +3 -5
  16. package/dist/blocks.d.ts +5 -2
  17. package/dist/blocks.js +4658 -6651
  18. package/dist/ember/index.js +3 -5
  19. package/dist/index.js +4 -6
  20. package/dist/manager.js +11 -22
  21. package/dist/mdx-loader.js +13 -19
  22. package/dist/preset.js +160 -453
  23. package/dist/preview.js +2 -2
  24. package/package.json +6 -6
  25. package/dist/_browser-chunks/Color-64QXVMR3.js +0 -1675
  26. package/dist/_browser-chunks/chunk-DMNQCVA2.js +0 -12
  27. package/dist/_browser-chunks/chunk-UZFOWTVP.js +0 -974
  28. package/dist/_browser-chunks/chunk-YDZYZRYC.js +0 -39
  29. package/dist/_node-chunks/chunk-D63L7OCA.js +0 -231
  30. package/dist/_node-chunks/chunk-DB6BS7Z4.js +0 -36332
  31. package/dist/_node-chunks/chunk-Z5MUJETX.js +0 -248
  32. package/dist/_node-chunks/mdx-plugin-KCQDNOVO.js +0 -1654
  33. package/dist/_node-chunks/rehype-external-links-LSUHFLUY.js +0 -168
@@ -0,0 +1,1096 @@
1
+ import {
2
+ getControlId
3
+ } from "./chunk-CYSK6WYR.js";
4
+ import {
5
+ __commonJS,
6
+ __toESM
7
+ } from "./chunk-A242L54C.js";
8
+
9
+ // ../../node_modules/color-name/index.js
10
+ var require_color_name = __commonJS({
11
+ "../../node_modules/color-name/index.js"(exports, module) {
12
+ "use strict";
13
+ module.exports = {
14
+ aliceblue: [240, 248, 255],
15
+ antiquewhite: [250, 235, 215],
16
+ aqua: [0, 255, 255],
17
+ aquamarine: [127, 255, 212],
18
+ azure: [240, 255, 255],
19
+ beige: [245, 245, 220],
20
+ bisque: [255, 228, 196],
21
+ black: [0, 0, 0],
22
+ blanchedalmond: [255, 235, 205],
23
+ blue: [0, 0, 255],
24
+ blueviolet: [138, 43, 226],
25
+ brown: [165, 42, 42],
26
+ burlywood: [222, 184, 135],
27
+ cadetblue: [95, 158, 160],
28
+ chartreuse: [127, 255, 0],
29
+ chocolate: [210, 105, 30],
30
+ coral: [255, 127, 80],
31
+ cornflowerblue: [100, 149, 237],
32
+ cornsilk: [255, 248, 220],
33
+ crimson: [220, 20, 60],
34
+ cyan: [0, 255, 255],
35
+ darkblue: [0, 0, 139],
36
+ darkcyan: [0, 139, 139],
37
+ darkgoldenrod: [184, 134, 11],
38
+ darkgray: [169, 169, 169],
39
+ darkgreen: [0, 100, 0],
40
+ darkgrey: [169, 169, 169],
41
+ darkkhaki: [189, 183, 107],
42
+ darkmagenta: [139, 0, 139],
43
+ darkolivegreen: [85, 107, 47],
44
+ darkorange: [255, 140, 0],
45
+ darkorchid: [153, 50, 204],
46
+ darkred: [139, 0, 0],
47
+ darksalmon: [233, 150, 122],
48
+ darkseagreen: [143, 188, 143],
49
+ darkslateblue: [72, 61, 139],
50
+ darkslategray: [47, 79, 79],
51
+ darkslategrey: [47, 79, 79],
52
+ darkturquoise: [0, 206, 209],
53
+ darkviolet: [148, 0, 211],
54
+ deeppink: [255, 20, 147],
55
+ deepskyblue: [0, 191, 255],
56
+ dimgray: [105, 105, 105],
57
+ dimgrey: [105, 105, 105],
58
+ dodgerblue: [30, 144, 255],
59
+ firebrick: [178, 34, 34],
60
+ floralwhite: [255, 250, 240],
61
+ forestgreen: [34, 139, 34],
62
+ fuchsia: [255, 0, 255],
63
+ gainsboro: [220, 220, 220],
64
+ ghostwhite: [248, 248, 255],
65
+ gold: [255, 215, 0],
66
+ goldenrod: [218, 165, 32],
67
+ gray: [128, 128, 128],
68
+ green: [0, 128, 0],
69
+ greenyellow: [173, 255, 47],
70
+ grey: [128, 128, 128],
71
+ honeydew: [240, 255, 240],
72
+ hotpink: [255, 105, 180],
73
+ indianred: [205, 92, 92],
74
+ indigo: [75, 0, 130],
75
+ ivory: [255, 255, 240],
76
+ khaki: [240, 230, 140],
77
+ lavender: [230, 230, 250],
78
+ lavenderblush: [255, 240, 245],
79
+ lawngreen: [124, 252, 0],
80
+ lemonchiffon: [255, 250, 205],
81
+ lightblue: [173, 216, 230],
82
+ lightcoral: [240, 128, 128],
83
+ lightcyan: [224, 255, 255],
84
+ lightgoldenrodyellow: [250, 250, 210],
85
+ lightgray: [211, 211, 211],
86
+ lightgreen: [144, 238, 144],
87
+ lightgrey: [211, 211, 211],
88
+ lightpink: [255, 182, 193],
89
+ lightsalmon: [255, 160, 122],
90
+ lightseagreen: [32, 178, 170],
91
+ lightskyblue: [135, 206, 250],
92
+ lightslategray: [119, 136, 153],
93
+ lightslategrey: [119, 136, 153],
94
+ lightsteelblue: [176, 196, 222],
95
+ lightyellow: [255, 255, 224],
96
+ lime: [0, 255, 0],
97
+ limegreen: [50, 205, 50],
98
+ linen: [250, 240, 230],
99
+ magenta: [255, 0, 255],
100
+ maroon: [128, 0, 0],
101
+ mediumaquamarine: [102, 205, 170],
102
+ mediumblue: [0, 0, 205],
103
+ mediumorchid: [186, 85, 211],
104
+ mediumpurple: [147, 112, 219],
105
+ mediumseagreen: [60, 179, 113],
106
+ mediumslateblue: [123, 104, 238],
107
+ mediumspringgreen: [0, 250, 154],
108
+ mediumturquoise: [72, 209, 204],
109
+ mediumvioletred: [199, 21, 133],
110
+ midnightblue: [25, 25, 112],
111
+ mintcream: [245, 255, 250],
112
+ mistyrose: [255, 228, 225],
113
+ moccasin: [255, 228, 181],
114
+ navajowhite: [255, 222, 173],
115
+ navy: [0, 0, 128],
116
+ oldlace: [253, 245, 230],
117
+ olive: [128, 128, 0],
118
+ olivedrab: [107, 142, 35],
119
+ orange: [255, 165, 0],
120
+ orangered: [255, 69, 0],
121
+ orchid: [218, 112, 214],
122
+ palegoldenrod: [238, 232, 170],
123
+ palegreen: [152, 251, 152],
124
+ paleturquoise: [175, 238, 238],
125
+ palevioletred: [219, 112, 147],
126
+ papayawhip: [255, 239, 213],
127
+ peachpuff: [255, 218, 185],
128
+ peru: [205, 133, 63],
129
+ pink: [255, 192, 203],
130
+ plum: [221, 160, 221],
131
+ powderblue: [176, 224, 230],
132
+ purple: [128, 0, 128],
133
+ rebeccapurple: [102, 51, 153],
134
+ red: [255, 0, 0],
135
+ rosybrown: [188, 143, 143],
136
+ royalblue: [65, 105, 225],
137
+ saddlebrown: [139, 69, 19],
138
+ salmon: [250, 128, 114],
139
+ sandybrown: [244, 164, 96],
140
+ seagreen: [46, 139, 87],
141
+ seashell: [255, 245, 238],
142
+ sienna: [160, 82, 45],
143
+ silver: [192, 192, 192],
144
+ skyblue: [135, 206, 235],
145
+ slateblue: [106, 90, 205],
146
+ slategray: [112, 128, 144],
147
+ slategrey: [112, 128, 144],
148
+ snow: [255, 250, 250],
149
+ springgreen: [0, 255, 127],
150
+ steelblue: [70, 130, 180],
151
+ tan: [210, 180, 140],
152
+ teal: [0, 128, 128],
153
+ thistle: [216, 191, 216],
154
+ tomato: [255, 99, 71],
155
+ turquoise: [64, 224, 208],
156
+ violet: [238, 130, 238],
157
+ wheat: [245, 222, 179],
158
+ white: [255, 255, 255],
159
+ whitesmoke: [245, 245, 245],
160
+ yellow: [255, 255, 0],
161
+ yellowgreen: [154, 205, 50]
162
+ };
163
+ }
164
+ });
165
+
166
+ // ../../node_modules/color-convert/conversions.js
167
+ var require_conversions = __commonJS({
168
+ "../../node_modules/color-convert/conversions.js"(exports, module) {
169
+ var cssKeywords = require_color_name(), reverseKeywords = {};
170
+ for (let key of Object.keys(cssKeywords))
171
+ reverseKeywords[cssKeywords[key]] = key;
172
+ var convert2 = {
173
+ rgb: { channels: 3, labels: "rgb" },
174
+ hsl: { channels: 3, labels: "hsl" },
175
+ hsv: { channels: 3, labels: "hsv" },
176
+ hwb: { channels: 3, labels: "hwb" },
177
+ cmyk: { channels: 4, labels: "cmyk" },
178
+ xyz: { channels: 3, labels: "xyz" },
179
+ lab: { channels: 3, labels: "lab" },
180
+ lch: { channels: 3, labels: "lch" },
181
+ hex: { channels: 1, labels: ["hex"] },
182
+ keyword: { channels: 1, labels: ["keyword"] },
183
+ ansi16: { channels: 1, labels: ["ansi16"] },
184
+ ansi256: { channels: 1, labels: ["ansi256"] },
185
+ hcg: { channels: 3, labels: ["h", "c", "g"] },
186
+ apple: { channels: 3, labels: ["r16", "g16", "b16"] },
187
+ gray: { channels: 1, labels: ["gray"] }
188
+ };
189
+ module.exports = convert2;
190
+ for (let model of Object.keys(convert2)) {
191
+ if (!("channels" in convert2[model]))
192
+ throw new Error("missing channels property: " + model);
193
+ if (!("labels" in convert2[model]))
194
+ throw new Error("missing channel labels property: " + model);
195
+ if (convert2[model].labels.length !== convert2[model].channels)
196
+ throw new Error("channel and label counts mismatch: " + model);
197
+ let { channels, labels } = convert2[model];
198
+ delete convert2[model].channels, delete convert2[model].labels, Object.defineProperty(convert2[model], "channels", { value: channels }), Object.defineProperty(convert2[model], "labels", { value: labels });
199
+ }
200
+ convert2.rgb.hsl = function(rgb) {
201
+ let r2 = rgb[0] / 255, g2 = rgb[1] / 255, b2 = rgb[2] / 255, min = Math.min(r2, g2, b2), max = Math.max(r2, g2, b2), delta = max - min, h2, s2;
202
+ max === min ? h2 = 0 : r2 === max ? h2 = (g2 - b2) / delta : g2 === max ? h2 = 2 + (b2 - r2) / delta : b2 === max && (h2 = 4 + (r2 - g2) / delta), h2 = Math.min(h2 * 60, 360), h2 < 0 && (h2 += 360);
203
+ let l2 = (min + max) / 2;
204
+ return max === min ? s2 = 0 : l2 <= 0.5 ? s2 = delta / (max + min) : s2 = delta / (2 - max - min), [h2, s2 * 100, l2 * 100];
205
+ };
206
+ convert2.rgb.hsv = function(rgb) {
207
+ let rdif, gdif, bdif, h2, s2, r2 = rgb[0] / 255, g2 = rgb[1] / 255, b2 = rgb[2] / 255, v2 = Math.max(r2, g2, b2), diff = v2 - Math.min(r2, g2, b2), diffc = function(c2) {
208
+ return (v2 - c2) / 6 / diff + 1 / 2;
209
+ };
210
+ return diff === 0 ? (h2 = 0, s2 = 0) : (s2 = diff / v2, rdif = diffc(r2), gdif = diffc(g2), bdif = diffc(b2), r2 === v2 ? h2 = bdif - gdif : g2 === v2 ? h2 = 1 / 3 + rdif - bdif : b2 === v2 && (h2 = 2 / 3 + gdif - rdif), h2 < 0 ? h2 += 1 : h2 > 1 && (h2 -= 1)), [
211
+ h2 * 360,
212
+ s2 * 100,
213
+ v2 * 100
214
+ ];
215
+ };
216
+ convert2.rgb.hwb = function(rgb) {
217
+ let r2 = rgb[0], g2 = rgb[1], b2 = rgb[2], h2 = convert2.rgb.hsl(rgb)[0], w2 = 1 / 255 * Math.min(r2, Math.min(g2, b2));
218
+ return b2 = 1 - 1 / 255 * Math.max(r2, Math.max(g2, b2)), [h2, w2 * 100, b2 * 100];
219
+ };
220
+ convert2.rgb.cmyk = function(rgb) {
221
+ let r2 = rgb[0] / 255, g2 = rgb[1] / 255, b2 = rgb[2] / 255, k2 = Math.min(1 - r2, 1 - g2, 1 - b2), c2 = (1 - r2 - k2) / (1 - k2) || 0, m2 = (1 - g2 - k2) / (1 - k2) || 0, y2 = (1 - b2 - k2) / (1 - k2) || 0;
222
+ return [c2 * 100, m2 * 100, y2 * 100, k2 * 100];
223
+ };
224
+ function comparativeDistance(x2, y2) {
225
+ return (x2[0] - y2[0]) ** 2 + (x2[1] - y2[1]) ** 2 + (x2[2] - y2[2]) ** 2;
226
+ }
227
+ convert2.rgb.keyword = function(rgb) {
228
+ let reversed = reverseKeywords[rgb];
229
+ if (reversed)
230
+ return reversed;
231
+ let currentClosestDistance = 1 / 0, currentClosestKeyword;
232
+ for (let keyword of Object.keys(cssKeywords)) {
233
+ let value = cssKeywords[keyword], distance = comparativeDistance(rgb, value);
234
+ distance < currentClosestDistance && (currentClosestDistance = distance, currentClosestKeyword = keyword);
235
+ }
236
+ return currentClosestKeyword;
237
+ };
238
+ convert2.keyword.rgb = function(keyword) {
239
+ return cssKeywords[keyword];
240
+ };
241
+ convert2.rgb.xyz = function(rgb) {
242
+ let r2 = rgb[0] / 255, g2 = rgb[1] / 255, b2 = rgb[2] / 255;
243
+ r2 = r2 > 0.04045 ? ((r2 + 0.055) / 1.055) ** 2.4 : r2 / 12.92, g2 = g2 > 0.04045 ? ((g2 + 0.055) / 1.055) ** 2.4 : g2 / 12.92, b2 = b2 > 0.04045 ? ((b2 + 0.055) / 1.055) ** 2.4 : b2 / 12.92;
244
+ let x2 = r2 * 0.4124 + g2 * 0.3576 + b2 * 0.1805, y2 = r2 * 0.2126 + g2 * 0.7152 + b2 * 0.0722, z2 = r2 * 0.0193 + g2 * 0.1192 + b2 * 0.9505;
245
+ return [x2 * 100, y2 * 100, z2 * 100];
246
+ };
247
+ convert2.rgb.lab = function(rgb) {
248
+ let xyz = convert2.rgb.xyz(rgb), x2 = xyz[0], y2 = xyz[1], z2 = xyz[2];
249
+ x2 /= 95.047, y2 /= 100, z2 /= 108.883, x2 = x2 > 8856e-6 ? x2 ** (1 / 3) : 7.787 * x2 + 16 / 116, y2 = y2 > 8856e-6 ? y2 ** (1 / 3) : 7.787 * y2 + 16 / 116, z2 = z2 > 8856e-6 ? z2 ** (1 / 3) : 7.787 * z2 + 16 / 116;
250
+ let l2 = 116 * y2 - 16, a2 = 500 * (x2 - y2), b2 = 200 * (y2 - z2);
251
+ return [l2, a2, b2];
252
+ };
253
+ convert2.hsl.rgb = function(hsl) {
254
+ let h2 = hsl[0] / 360, s2 = hsl[1] / 100, l2 = hsl[2] / 100, t2, t3, val;
255
+ if (s2 === 0)
256
+ return val = l2 * 255, [val, val, val];
257
+ l2 < 0.5 ? t2 = l2 * (1 + s2) : t2 = l2 + s2 - l2 * s2;
258
+ let t1 = 2 * l2 - t2, rgb = [0, 0, 0];
259
+ for (let i2 = 0; i2 < 3; i2++)
260
+ t3 = h2 + 1 / 3 * -(i2 - 1), t3 < 0 && t3++, t3 > 1 && t3--, 6 * t3 < 1 ? val = t1 + (t2 - t1) * 6 * t3 : 2 * t3 < 1 ? val = t2 : 3 * t3 < 2 ? val = t1 + (t2 - t1) * (2 / 3 - t3) * 6 : val = t1, rgb[i2] = val * 255;
261
+ return rgb;
262
+ };
263
+ convert2.hsl.hsv = function(hsl) {
264
+ let h2 = hsl[0], s2 = hsl[1] / 100, l2 = hsl[2] / 100, smin = s2, lmin = Math.max(l2, 0.01);
265
+ l2 *= 2, s2 *= l2 <= 1 ? l2 : 2 - l2, smin *= lmin <= 1 ? lmin : 2 - lmin;
266
+ let v2 = (l2 + s2) / 2, sv = l2 === 0 ? 2 * smin / (lmin + smin) : 2 * s2 / (l2 + s2);
267
+ return [h2, sv * 100, v2 * 100];
268
+ };
269
+ convert2.hsv.rgb = function(hsv) {
270
+ let h2 = hsv[0] / 60, s2 = hsv[1] / 100, v2 = hsv[2] / 100, hi = Math.floor(h2) % 6, f2 = h2 - Math.floor(h2), p2 = 255 * v2 * (1 - s2), q2 = 255 * v2 * (1 - s2 * f2), t2 = 255 * v2 * (1 - s2 * (1 - f2));
271
+ switch (v2 *= 255, hi) {
272
+ case 0:
273
+ return [v2, t2, p2];
274
+ case 1:
275
+ return [q2, v2, p2];
276
+ case 2:
277
+ return [p2, v2, t2];
278
+ case 3:
279
+ return [p2, q2, v2];
280
+ case 4:
281
+ return [t2, p2, v2];
282
+ case 5:
283
+ return [v2, p2, q2];
284
+ }
285
+ };
286
+ convert2.hsv.hsl = function(hsv) {
287
+ let h2 = hsv[0], s2 = hsv[1] / 100, v2 = hsv[2] / 100, vmin = Math.max(v2, 0.01), sl, l2;
288
+ l2 = (2 - s2) * v2;
289
+ let lmin = (2 - s2) * vmin;
290
+ return sl = s2 * vmin, sl /= lmin <= 1 ? lmin : 2 - lmin, sl = sl || 0, l2 /= 2, [h2, sl * 100, l2 * 100];
291
+ };
292
+ convert2.hwb.rgb = function(hwb) {
293
+ let h2 = hwb[0] / 360, wh = hwb[1] / 100, bl = hwb[2] / 100, ratio = wh + bl, f2;
294
+ ratio > 1 && (wh /= ratio, bl /= ratio);
295
+ let i2 = Math.floor(6 * h2), v2 = 1 - bl;
296
+ f2 = 6 * h2 - i2, (i2 & 1) !== 0 && (f2 = 1 - f2);
297
+ let n2 = wh + f2 * (v2 - wh), r2, g2, b2;
298
+ switch (i2) {
299
+ default:
300
+ case 6:
301
+ case 0:
302
+ r2 = v2, g2 = n2, b2 = wh;
303
+ break;
304
+ case 1:
305
+ r2 = n2, g2 = v2, b2 = wh;
306
+ break;
307
+ case 2:
308
+ r2 = wh, g2 = v2, b2 = n2;
309
+ break;
310
+ case 3:
311
+ r2 = wh, g2 = n2, b2 = v2;
312
+ break;
313
+ case 4:
314
+ r2 = n2, g2 = wh, b2 = v2;
315
+ break;
316
+ case 5:
317
+ r2 = v2, g2 = wh, b2 = n2;
318
+ break;
319
+ }
320
+ return [r2 * 255, g2 * 255, b2 * 255];
321
+ };
322
+ convert2.cmyk.rgb = function(cmyk) {
323
+ let c2 = cmyk[0] / 100, m2 = cmyk[1] / 100, y2 = cmyk[2] / 100, k2 = cmyk[3] / 100, r2 = 1 - Math.min(1, c2 * (1 - k2) + k2), g2 = 1 - Math.min(1, m2 * (1 - k2) + k2), b2 = 1 - Math.min(1, y2 * (1 - k2) + k2);
324
+ return [r2 * 255, g2 * 255, b2 * 255];
325
+ };
326
+ convert2.xyz.rgb = function(xyz) {
327
+ let x2 = xyz[0] / 100, y2 = xyz[1] / 100, z2 = xyz[2] / 100, r2, g2, b2;
328
+ return r2 = x2 * 3.2406 + y2 * -1.5372 + z2 * -0.4986, g2 = x2 * -0.9689 + y2 * 1.8758 + z2 * 0.0415, b2 = x2 * 0.0557 + y2 * -0.204 + z2 * 1.057, r2 = r2 > 31308e-7 ? 1.055 * r2 ** (1 / 2.4) - 0.055 : r2 * 12.92, g2 = g2 > 31308e-7 ? 1.055 * g2 ** (1 / 2.4) - 0.055 : g2 * 12.92, b2 = b2 > 31308e-7 ? 1.055 * b2 ** (1 / 2.4) - 0.055 : b2 * 12.92, r2 = Math.min(Math.max(0, r2), 1), g2 = Math.min(Math.max(0, g2), 1), b2 = Math.min(Math.max(0, b2), 1), [r2 * 255, g2 * 255, b2 * 255];
329
+ };
330
+ convert2.xyz.lab = function(xyz) {
331
+ let x2 = xyz[0], y2 = xyz[1], z2 = xyz[2];
332
+ x2 /= 95.047, y2 /= 100, z2 /= 108.883, x2 = x2 > 8856e-6 ? x2 ** (1 / 3) : 7.787 * x2 + 16 / 116, y2 = y2 > 8856e-6 ? y2 ** (1 / 3) : 7.787 * y2 + 16 / 116, z2 = z2 > 8856e-6 ? z2 ** (1 / 3) : 7.787 * z2 + 16 / 116;
333
+ let l2 = 116 * y2 - 16, a2 = 500 * (x2 - y2), b2 = 200 * (y2 - z2);
334
+ return [l2, a2, b2];
335
+ };
336
+ convert2.lab.xyz = function(lab) {
337
+ let l2 = lab[0], a2 = lab[1], b2 = lab[2], x2, y2, z2;
338
+ y2 = (l2 + 16) / 116, x2 = a2 / 500 + y2, z2 = y2 - b2 / 200;
339
+ let y22 = y2 ** 3, x22 = x2 ** 3, z22 = z2 ** 3;
340
+ return y2 = y22 > 8856e-6 ? y22 : (y2 - 16 / 116) / 7.787, x2 = x22 > 8856e-6 ? x22 : (x2 - 16 / 116) / 7.787, z2 = z22 > 8856e-6 ? z22 : (z2 - 16 / 116) / 7.787, x2 *= 95.047, y2 *= 100, z2 *= 108.883, [x2, y2, z2];
341
+ };
342
+ convert2.lab.lch = function(lab) {
343
+ let l2 = lab[0], a2 = lab[1], b2 = lab[2], h2;
344
+ h2 = Math.atan2(b2, a2) * 360 / 2 / Math.PI, h2 < 0 && (h2 += 360);
345
+ let c2 = Math.sqrt(a2 * a2 + b2 * b2);
346
+ return [l2, c2, h2];
347
+ };
348
+ convert2.lch.lab = function(lch) {
349
+ let l2 = lch[0], c2 = lch[1], hr = lch[2] / 360 * 2 * Math.PI, a2 = c2 * Math.cos(hr), b2 = c2 * Math.sin(hr);
350
+ return [l2, a2, b2];
351
+ };
352
+ convert2.rgb.ansi16 = function(args, saturation = null) {
353
+ let [r2, g2, b2] = args, value = saturation === null ? convert2.rgb.hsv(args)[2] : saturation;
354
+ if (value = Math.round(value / 50), value === 0)
355
+ return 30;
356
+ let ansi = 30 + (Math.round(b2 / 255) << 2 | Math.round(g2 / 255) << 1 | Math.round(r2 / 255));
357
+ return value === 2 && (ansi += 60), ansi;
358
+ };
359
+ convert2.hsv.ansi16 = function(args) {
360
+ return convert2.rgb.ansi16(convert2.hsv.rgb(args), args[2]);
361
+ };
362
+ convert2.rgb.ansi256 = function(args) {
363
+ let r2 = args[0], g2 = args[1], b2 = args[2];
364
+ return r2 === g2 && g2 === b2 ? r2 < 8 ? 16 : r2 > 248 ? 231 : Math.round((r2 - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(r2 / 255 * 5) + 6 * Math.round(g2 / 255 * 5) + Math.round(b2 / 255 * 5);
365
+ };
366
+ convert2.ansi16.rgb = function(args) {
367
+ let color = args % 10;
368
+ if (color === 0 || color === 7)
369
+ return args > 50 && (color += 3.5), color = color / 10.5 * 255, [color, color, color];
370
+ let mult = (~~(args > 50) + 1) * 0.5, r2 = (color & 1) * mult * 255, g2 = (color >> 1 & 1) * mult * 255, b2 = (color >> 2 & 1) * mult * 255;
371
+ return [r2, g2, b2];
372
+ };
373
+ convert2.ansi256.rgb = function(args) {
374
+ if (args >= 232) {
375
+ let c2 = (args - 232) * 10 + 8;
376
+ return [c2, c2, c2];
377
+ }
378
+ args -= 16;
379
+ let rem, r2 = Math.floor(args / 36) / 5 * 255, g2 = Math.floor((rem = args % 36) / 6) / 5 * 255, b2 = rem % 6 / 5 * 255;
380
+ return [r2, g2, b2];
381
+ };
382
+ convert2.rgb.hex = function(args) {
383
+ let string = (((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255)).toString(16).toUpperCase();
384
+ return "000000".substring(string.length) + string;
385
+ };
386
+ convert2.hex.rgb = function(args) {
387
+ let match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
388
+ if (!match)
389
+ return [0, 0, 0];
390
+ let colorString = match[0];
391
+ match[0].length === 3 && (colorString = colorString.split("").map((char) => char + char).join(""));
392
+ let integer = parseInt(colorString, 16), r2 = integer >> 16 & 255, g2 = integer >> 8 & 255, b2 = integer & 255;
393
+ return [r2, g2, b2];
394
+ };
395
+ convert2.rgb.hcg = function(rgb) {
396
+ let r2 = rgb[0] / 255, g2 = rgb[1] / 255, b2 = rgb[2] / 255, max = Math.max(Math.max(r2, g2), b2), min = Math.min(Math.min(r2, g2), b2), chroma = max - min, grayscale, hue;
397
+ return chroma < 1 ? grayscale = min / (1 - chroma) : grayscale = 0, chroma <= 0 ? hue = 0 : max === r2 ? hue = (g2 - b2) / chroma % 6 : max === g2 ? hue = 2 + (b2 - r2) / chroma : hue = 4 + (r2 - g2) / chroma, hue /= 6, hue %= 1, [hue * 360, chroma * 100, grayscale * 100];
398
+ };
399
+ convert2.hsl.hcg = function(hsl) {
400
+ let s2 = hsl[1] / 100, l2 = hsl[2] / 100, c2 = l2 < 0.5 ? 2 * s2 * l2 : 2 * s2 * (1 - l2), f2 = 0;
401
+ return c2 < 1 && (f2 = (l2 - 0.5 * c2) / (1 - c2)), [hsl[0], c2 * 100, f2 * 100];
402
+ };
403
+ convert2.hsv.hcg = function(hsv) {
404
+ let s2 = hsv[1] / 100, v2 = hsv[2] / 100, c2 = s2 * v2, f2 = 0;
405
+ return c2 < 1 && (f2 = (v2 - c2) / (1 - c2)), [hsv[0], c2 * 100, f2 * 100];
406
+ };
407
+ convert2.hcg.rgb = function(hcg) {
408
+ let h2 = hcg[0] / 360, c2 = hcg[1] / 100, g2 = hcg[2] / 100;
409
+ if (c2 === 0)
410
+ return [g2 * 255, g2 * 255, g2 * 255];
411
+ let pure = [0, 0, 0], hi = h2 % 1 * 6, v2 = hi % 1, w2 = 1 - v2, mg = 0;
412
+ switch (Math.floor(hi)) {
413
+ case 0:
414
+ pure[0] = 1, pure[1] = v2, pure[2] = 0;
415
+ break;
416
+ case 1:
417
+ pure[0] = w2, pure[1] = 1, pure[2] = 0;
418
+ break;
419
+ case 2:
420
+ pure[0] = 0, pure[1] = 1, pure[2] = v2;
421
+ break;
422
+ case 3:
423
+ pure[0] = 0, pure[1] = w2, pure[2] = 1;
424
+ break;
425
+ case 4:
426
+ pure[0] = v2, pure[1] = 0, pure[2] = 1;
427
+ break;
428
+ default:
429
+ pure[0] = 1, pure[1] = 0, pure[2] = w2;
430
+ }
431
+ return mg = (1 - c2) * g2, [
432
+ (c2 * pure[0] + mg) * 255,
433
+ (c2 * pure[1] + mg) * 255,
434
+ (c2 * pure[2] + mg) * 255
435
+ ];
436
+ };
437
+ convert2.hcg.hsv = function(hcg) {
438
+ let c2 = hcg[1] / 100, g2 = hcg[2] / 100, v2 = c2 + g2 * (1 - c2), f2 = 0;
439
+ return v2 > 0 && (f2 = c2 / v2), [hcg[0], f2 * 100, v2 * 100];
440
+ };
441
+ convert2.hcg.hsl = function(hcg) {
442
+ let c2 = hcg[1] / 100, l2 = hcg[2] / 100 * (1 - c2) + 0.5 * c2, s2 = 0;
443
+ return l2 > 0 && l2 < 0.5 ? s2 = c2 / (2 * l2) : l2 >= 0.5 && l2 < 1 && (s2 = c2 / (2 * (1 - l2))), [hcg[0], s2 * 100, l2 * 100];
444
+ };
445
+ convert2.hcg.hwb = function(hcg) {
446
+ let c2 = hcg[1] / 100, g2 = hcg[2] / 100, v2 = c2 + g2 * (1 - c2);
447
+ return [hcg[0], (v2 - c2) * 100, (1 - v2) * 100];
448
+ };
449
+ convert2.hwb.hcg = function(hwb) {
450
+ let w2 = hwb[1] / 100, v2 = 1 - hwb[2] / 100, c2 = v2 - w2, g2 = 0;
451
+ return c2 < 1 && (g2 = (v2 - c2) / (1 - c2)), [hwb[0], c2 * 100, g2 * 100];
452
+ };
453
+ convert2.apple.rgb = function(apple) {
454
+ return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
455
+ };
456
+ convert2.rgb.apple = function(rgb) {
457
+ return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
458
+ };
459
+ convert2.gray.rgb = function(args) {
460
+ return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
461
+ };
462
+ convert2.gray.hsl = function(args) {
463
+ return [0, 0, args[0]];
464
+ };
465
+ convert2.gray.hsv = convert2.gray.hsl;
466
+ convert2.gray.hwb = function(gray) {
467
+ return [0, 100, gray[0]];
468
+ };
469
+ convert2.gray.cmyk = function(gray) {
470
+ return [0, 0, 0, gray[0]];
471
+ };
472
+ convert2.gray.lab = function(gray) {
473
+ return [gray[0], 0, 0];
474
+ };
475
+ convert2.gray.hex = function(gray) {
476
+ let val = Math.round(gray[0] / 100 * 255) & 255, string = ((val << 16) + (val << 8) + val).toString(16).toUpperCase();
477
+ return "000000".substring(string.length) + string;
478
+ };
479
+ convert2.rgb.gray = function(rgb) {
480
+ return [(rgb[0] + rgb[1] + rgb[2]) / 3 / 255 * 100];
481
+ };
482
+ }
483
+ });
484
+
485
+ // ../../node_modules/color-convert/route.js
486
+ var require_route = __commonJS({
487
+ "../../node_modules/color-convert/route.js"(exports, module) {
488
+ var conversions = require_conversions();
489
+ function buildGraph() {
490
+ let graph = {}, models = Object.keys(conversions);
491
+ for (let len = models.length, i2 = 0; i2 < len; i2++)
492
+ graph[models[i2]] = {
493
+ // http://jsperf.com/1-vs-infinity
494
+ // micro-opt, but this is simple.
495
+ distance: -1,
496
+ parent: null
497
+ };
498
+ return graph;
499
+ }
500
+ function deriveBFS(fromModel) {
501
+ let graph = buildGraph(), queue = [fromModel];
502
+ for (graph[fromModel].distance = 0; queue.length; ) {
503
+ let current = queue.pop(), adjacents = Object.keys(conversions[current]);
504
+ for (let len = adjacents.length, i2 = 0; i2 < len; i2++) {
505
+ let adjacent = adjacents[i2], node = graph[adjacent];
506
+ node.distance === -1 && (node.distance = graph[current].distance + 1, node.parent = current, queue.unshift(adjacent));
507
+ }
508
+ }
509
+ return graph;
510
+ }
511
+ function link(from, to) {
512
+ return function(args) {
513
+ return to(from(args));
514
+ };
515
+ }
516
+ function wrapConversion(toModel, graph) {
517
+ let path = [graph[toModel].parent, toModel], fn = conversions[graph[toModel].parent][toModel], cur = graph[toModel].parent;
518
+ for (; graph[cur].parent; )
519
+ path.unshift(graph[cur].parent), fn = link(conversions[graph[cur].parent][cur], fn), cur = graph[cur].parent;
520
+ return fn.conversion = path, fn;
521
+ }
522
+ module.exports = function(fromModel) {
523
+ let graph = deriveBFS(fromModel), conversion = {}, models = Object.keys(graph);
524
+ for (let len = models.length, i2 = 0; i2 < len; i2++) {
525
+ let toModel = models[i2];
526
+ graph[toModel].parent !== null && (conversion[toModel] = wrapConversion(toModel, graph));
527
+ }
528
+ return conversion;
529
+ };
530
+ }
531
+ });
532
+
533
+ // ../../node_modules/color-convert/index.js
534
+ var require_color_convert = __commonJS({
535
+ "../../node_modules/color-convert/index.js"(exports, module) {
536
+ var conversions = require_conversions(), route = require_route(), convert2 = {}, models = Object.keys(conversions);
537
+ function wrapRaw(fn) {
538
+ let wrappedFn = function(...args) {
539
+ let arg0 = args[0];
540
+ return arg0 == null ? arg0 : (arg0.length > 1 && (args = arg0), fn(args));
541
+ };
542
+ return "conversion" in fn && (wrappedFn.conversion = fn.conversion), wrappedFn;
543
+ }
544
+ function wrapRounded(fn) {
545
+ let wrappedFn = function(...args) {
546
+ let arg0 = args[0];
547
+ if (arg0 == null)
548
+ return arg0;
549
+ arg0.length > 1 && (args = arg0);
550
+ let result = fn(args);
551
+ if (typeof result == "object")
552
+ for (let len = result.length, i2 = 0; i2 < len; i2++)
553
+ result[i2] = Math.round(result[i2]);
554
+ return result;
555
+ };
556
+ return "conversion" in fn && (wrappedFn.conversion = fn.conversion), wrappedFn;
557
+ }
558
+ models.forEach((fromModel) => {
559
+ convert2[fromModel] = {}, Object.defineProperty(convert2[fromModel], "channels", { value: conversions[fromModel].channels }), Object.defineProperty(convert2[fromModel], "labels", { value: conversions[fromModel].labels });
560
+ let routes = route(fromModel);
561
+ Object.keys(routes).forEach((toModel) => {
562
+ let fn = routes[toModel];
563
+ convert2[fromModel][toModel] = wrapRounded(fn), convert2[fromModel][toModel].raw = wrapRaw(fn);
564
+ });
565
+ });
566
+ module.exports = convert2;
567
+ }
568
+ });
569
+
570
+ // src/blocks/controls/Color.tsx
571
+ var import_color_convert = __toESM(require_color_convert(), 1);
572
+ import React, { useCallback, useEffect, useMemo, useState } from "react";
573
+ import { Button, Form, PopoverProvider } from "storybook/internal/components";
574
+ import { MarkupIcon } from "@storybook/icons";
575
+
576
+ // ../../node_modules/es-toolkit/dist/function/debounce.mjs
577
+ function debounce(func, debounceMs, { signal, edges } = {}) {
578
+ let pendingThis, pendingArgs = null, leading = edges != null && edges.includes("leading"), trailing = edges == null || edges.includes("trailing"), invoke = () => {
579
+ pendingArgs !== null && (func.apply(pendingThis, pendingArgs), pendingThis = void 0, pendingArgs = null);
580
+ }, onTimerEnd = () => {
581
+ trailing && invoke(), cancel();
582
+ }, timeoutId = null, schedule = () => {
583
+ timeoutId != null && clearTimeout(timeoutId), timeoutId = setTimeout(() => {
584
+ timeoutId = null, onTimerEnd();
585
+ }, debounceMs);
586
+ }, cancelTimer = () => {
587
+ timeoutId !== null && (clearTimeout(timeoutId), timeoutId = null);
588
+ }, cancel = () => {
589
+ cancelTimer(), pendingThis = void 0, pendingArgs = null;
590
+ }, flush = () => {
591
+ invoke();
592
+ }, debounced = function(...args) {
593
+ if (signal?.aborted)
594
+ return;
595
+ pendingThis = this, pendingArgs = args;
596
+ let isFirstCall = timeoutId == null;
597
+ schedule(), leading && isFirstCall && invoke();
598
+ };
599
+ return debounced.schedule = schedule, debounced.cancel = cancel, debounced.flush = flush, signal?.addEventListener("abort", cancel, { once: !0 }), debounced;
600
+ }
601
+
602
+ // ../../node_modules/es-toolkit/dist/function/partial.mjs
603
+ function partial(func, ...partialArgs) {
604
+ return partialImpl(func, placeholderSymbol, ...partialArgs);
605
+ }
606
+ function partialImpl(func, placeholder, ...partialArgs) {
607
+ let partialed = function(...providedArgs) {
608
+ let providedArgsIndex = 0, substitutedArgs = partialArgs.slice().map((arg) => arg === placeholder ? providedArgs[providedArgsIndex++] : arg), remainingArgs = providedArgs.slice(providedArgsIndex);
609
+ return func.apply(this, substitutedArgs.concat(remainingArgs));
610
+ };
611
+ return func.prototype && (partialed.prototype = Object.create(func.prototype)), partialed;
612
+ }
613
+ var placeholderSymbol = Symbol("partial.placeholder");
614
+ partial.placeholder = placeholderSymbol;
615
+
616
+ // ../../node_modules/es-toolkit/dist/function/partialRight.mjs
617
+ function partialRight(func, ...partialArgs) {
618
+ return partialRightImpl(func, placeholderSymbol2, ...partialArgs);
619
+ }
620
+ function partialRightImpl(func, placeholder, ...partialArgs) {
621
+ let partialedRight = function(...providedArgs) {
622
+ let placeholderLength = partialArgs.filter((arg) => arg === placeholder).length, rangeLength = Math.max(providedArgs.length - placeholderLength, 0), remainingArgs = providedArgs.slice(0, rangeLength), providedArgsIndex = rangeLength, substitutedArgs = partialArgs.slice().map((arg) => arg === placeholder ? providedArgs[providedArgsIndex++] : arg);
623
+ return func.apply(this, remainingArgs.concat(substitutedArgs));
624
+ };
625
+ return func.prototype && (partialedRight.prototype = Object.create(func.prototype)), partialedRight;
626
+ }
627
+ var placeholderSymbol2 = Symbol("partialRight.placeholder");
628
+ partialRight.placeholder = placeholderSymbol2;
629
+
630
+ // ../../node_modules/es-toolkit/dist/function/retry.mjs
631
+ var DEFAULT_RETRIES = Number.POSITIVE_INFINITY;
632
+
633
+ // ../../node_modules/react-colorful/dist/index.mjs
634
+ import e, { useRef as r, useMemo as t, useEffect as n, useState as o, useCallback as a, useLayoutEffect as l } from "react";
635
+ function u() {
636
+ return (u = Object.assign || function(e2) {
637
+ for (var r2 = 1; r2 < arguments.length; r2++) {
638
+ var t2 = arguments[r2];
639
+ for (var n2 in t2) Object.prototype.hasOwnProperty.call(t2, n2) && (e2[n2] = t2[n2]);
640
+ }
641
+ return e2;
642
+ }).apply(this, arguments);
643
+ }
644
+ function c(e2, r2) {
645
+ if (e2 == null) return {};
646
+ var t2, n2, o2 = {}, a2 = Object.keys(e2);
647
+ for (n2 = 0; n2 < a2.length; n2++) r2.indexOf(t2 = a2[n2]) >= 0 || (o2[t2] = e2[t2]);
648
+ return o2;
649
+ }
650
+ function i(e2) {
651
+ var t2 = r(e2), n2 = r(function(e3) {
652
+ t2.current && t2.current(e3);
653
+ });
654
+ return t2.current = e2, n2.current;
655
+ }
656
+ var s = function(e2, r2, t2) {
657
+ return r2 === void 0 && (r2 = 0), t2 === void 0 && (t2 = 1), e2 > t2 ? t2 : e2 < r2 ? r2 : e2;
658
+ }, f = function(e2) {
659
+ return "touches" in e2;
660
+ }, v = function(e2) {
661
+ return e2 && e2.ownerDocument.defaultView || self;
662
+ }, d = function(e2, r2, t2) {
663
+ var n2 = e2.getBoundingClientRect(), o2 = f(r2) ? (function(e3, r3) {
664
+ for (var t3 = 0; t3 < e3.length; t3++) if (e3[t3].identifier === r3) return e3[t3];
665
+ return e3[0];
666
+ })(r2.touches, t2) : r2;
667
+ return { left: s((o2.pageX - (n2.left + v(e2).pageXOffset)) / n2.width), top: s((o2.pageY - (n2.top + v(e2).pageYOffset)) / n2.height) };
668
+ }, h = function(e2) {
669
+ !f(e2) && e2.preventDefault();
670
+ }, m = e.memo(function(o2) {
671
+ var a2 = o2.onMove, l2 = o2.onKey, s2 = c(o2, ["onMove", "onKey"]), m2 = r(null), g2 = i(a2), p2 = i(l2), b2 = r(null), _2 = r(!1), x2 = t(function() {
672
+ var e2 = function(e3) {
673
+ h(e3), (f(e3) ? e3.touches.length > 0 : e3.buttons > 0) && m2.current ? g2(d(m2.current, e3, b2.current)) : t2(!1);
674
+ }, r2 = function() {
675
+ return t2(!1);
676
+ };
677
+ function t2(t3) {
678
+ var n2 = _2.current, o3 = v(m2.current), a3 = t3 ? o3.addEventListener : o3.removeEventListener;
679
+ a3(n2 ? "touchmove" : "mousemove", e2), a3(n2 ? "touchend" : "mouseup", r2);
680
+ }
681
+ return [function(e3) {
682
+ var r3 = e3.nativeEvent, n2 = m2.current;
683
+ if (n2 && (h(r3), !(function(e4, r4) {
684
+ return r4 && !f(e4);
685
+ })(r3, _2.current) && n2)) {
686
+ if (f(r3)) {
687
+ _2.current = !0;
688
+ var o3 = r3.changedTouches || [];
689
+ o3.length && (b2.current = o3[0].identifier);
690
+ }
691
+ n2.focus(), g2(d(n2, r3, b2.current)), t2(!0);
692
+ }
693
+ }, function(e3) {
694
+ var r3 = e3.which || e3.keyCode;
695
+ r3 < 37 || r3 > 40 || (e3.preventDefault(), p2({ left: r3 === 39 ? 0.05 : r3 === 37 ? -0.05 : 0, top: r3 === 40 ? 0.05 : r3 === 38 ? -0.05 : 0 }));
696
+ }, t2];
697
+ }, [p2, g2]), C2 = x2[0], E2 = x2[1], H2 = x2[2];
698
+ return n(function() {
699
+ return H2;
700
+ }, [H2]), e.createElement("div", u({}, s2, { onTouchStart: C2, onMouseDown: C2, className: "react-colorful__interactive", ref: m2, onKeyDown: E2, tabIndex: 0, role: "slider" }));
701
+ }), g = function(e2) {
702
+ return e2.filter(Boolean).join(" ");
703
+ }, p = function(r2) {
704
+ var t2 = r2.color, n2 = r2.left, o2 = r2.top, a2 = o2 === void 0 ? 0.5 : o2, l2 = g(["react-colorful__pointer", r2.className]);
705
+ return e.createElement("div", { className: l2, style: { top: 100 * a2 + "%", left: 100 * n2 + "%" } }, e.createElement("div", { className: "react-colorful__pointer-fill", style: { backgroundColor: t2 } }));
706
+ }, b = function(e2, r2, t2) {
707
+ return r2 === void 0 && (r2 = 0), t2 === void 0 && (t2 = Math.pow(10, r2)), Math.round(t2 * e2) / t2;
708
+ }, _ = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, x = function(e2) {
709
+ return L(C(e2));
710
+ }, C = function(e2) {
711
+ return e2[0] === "#" && (e2 = e2.substring(1)), e2.length < 6 ? { r: parseInt(e2[0] + e2[0], 16), g: parseInt(e2[1] + e2[1], 16), b: parseInt(e2[2] + e2[2], 16), a: e2.length === 4 ? b(parseInt(e2[3] + e2[3], 16) / 255, 2) : 1 } : { r: parseInt(e2.substring(0, 2), 16), g: parseInt(e2.substring(2, 4), 16), b: parseInt(e2.substring(4, 6), 16), a: e2.length === 8 ? b(parseInt(e2.substring(6, 8), 16) / 255, 2) : 1 };
712
+ }, E = function(e2, r2) {
713
+ return r2 === void 0 && (r2 = "deg"), Number(e2) * (_[r2] || 1);
714
+ }, H = function(e2) {
715
+ var r2 = /hsla?\(?\s*(-?\d*\.?\d+)(deg|rad|grad|turn)?[,\s]+(-?\d*\.?\d+)%?[,\s]+(-?\d*\.?\d+)%?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e2);
716
+ return r2 ? N({ h: E(r2[1], r2[2]), s: Number(r2[3]), l: Number(r2[4]), a: r2[5] === void 0 ? 1 : Number(r2[5]) / (r2[6] ? 100 : 1) }) : { h: 0, s: 0, v: 0, a: 1 };
717
+ };
718
+ var N = function(e2) {
719
+ var r2 = e2.s, t2 = e2.l;
720
+ return { h: e2.h, s: (r2 *= (t2 < 50 ? t2 : 100 - t2) / 100) > 0 ? 2 * r2 / (t2 + r2) * 100 : 0, v: t2 + r2, a: e2.a };
721
+ }, w = function(e2) {
722
+ return K(I(e2));
723
+ }, y = function(e2) {
724
+ var r2 = e2.s, t2 = e2.v, n2 = e2.a, o2 = (200 - r2) * t2 / 100;
725
+ return { h: b(e2.h), s: b(o2 > 0 && o2 < 200 ? r2 * t2 / 100 / (o2 <= 100 ? o2 : 200 - o2) * 100 : 0), l: b(o2 / 2), a: b(n2, 2) };
726
+ }, q = function(e2) {
727
+ var r2 = y(e2);
728
+ return "hsl(" + r2.h + ", " + r2.s + "%, " + r2.l + "%)";
729
+ }, k = function(e2) {
730
+ var r2 = y(e2);
731
+ return "hsla(" + r2.h + ", " + r2.s + "%, " + r2.l + "%, " + r2.a + ")";
732
+ }, I = function(e2) {
733
+ var r2 = e2.h, t2 = e2.s, n2 = e2.v, o2 = e2.a;
734
+ r2 = r2 / 360 * 6, t2 /= 100, n2 /= 100;
735
+ var a2 = Math.floor(r2), l2 = n2 * (1 - t2), u2 = n2 * (1 - (r2 - a2) * t2), c2 = n2 * (1 - (1 - r2 + a2) * t2), i2 = a2 % 6;
736
+ return { r: b(255 * [n2, u2, l2, l2, c2, n2][i2]), g: b(255 * [c2, n2, n2, u2, l2, l2][i2]), b: b(255 * [l2, l2, c2, n2, n2, u2][i2]), a: b(o2, 2) };
737
+ };
738
+ var z = function(e2) {
739
+ var r2 = /rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e2);
740
+ return r2 ? L({ r: Number(r2[1]) / (r2[2] ? 100 / 255 : 1), g: Number(r2[3]) / (r2[4] ? 100 / 255 : 1), b: Number(r2[5]) / (r2[6] ? 100 / 255 : 1), a: r2[7] === void 0 ? 1 : Number(r2[7]) / (r2[8] ? 100 : 1) }) : { h: 0, s: 0, v: 0, a: 1 };
741
+ };
742
+ var D = function(e2) {
743
+ var r2 = e2.toString(16);
744
+ return r2.length < 2 ? "0" + r2 : r2;
745
+ }, K = function(e2) {
746
+ var r2 = e2.r, t2 = e2.g, n2 = e2.b, o2 = e2.a, a2 = o2 < 1 ? D(b(255 * o2)) : "";
747
+ return "#" + D(r2) + D(t2) + D(n2) + a2;
748
+ }, L = function(e2) {
749
+ var r2 = e2.r, t2 = e2.g, n2 = e2.b, o2 = e2.a, a2 = Math.max(r2, t2, n2), l2 = a2 - Math.min(r2, t2, n2), u2 = l2 ? a2 === r2 ? (t2 - n2) / l2 : a2 === t2 ? 2 + (n2 - r2) / l2 : 4 + (r2 - t2) / l2 : 0;
750
+ return { h: b(60 * (u2 < 0 ? u2 + 6 : u2)), s: b(a2 ? l2 / a2 * 100 : 0), v: b(a2 / 255 * 100), a: o2 };
751
+ };
752
+ var S = e.memo(function(r2) {
753
+ var t2 = r2.hue, n2 = r2.onChange, o2 = g(["react-colorful__hue", r2.className]);
754
+ return e.createElement("div", { className: o2 }, e.createElement(m, { onMove: function(e2) {
755
+ n2({ h: 360 * e2.left });
756
+ }, onKey: function(e2) {
757
+ n2({ h: s(t2 + 360 * e2.left, 0, 360) });
758
+ }, "aria-label": "Hue", "aria-valuenow": b(t2), "aria-valuemax": "360", "aria-valuemin": "0" }, e.createElement(p, { className: "react-colorful__hue-pointer", left: t2 / 360, color: q({ h: t2, s: 100, v: 100, a: 1 }) })));
759
+ }), T = e.memo(function(r2) {
760
+ var t2 = r2.hsva, n2 = r2.onChange, o2 = { backgroundColor: q({ h: t2.h, s: 100, v: 100, a: 1 }) };
761
+ return e.createElement("div", { className: "react-colorful__saturation", style: o2 }, e.createElement(m, { onMove: function(e2) {
762
+ n2({ s: 100 * e2.left, v: 100 - 100 * e2.top });
763
+ }, onKey: function(e2) {
764
+ n2({ s: s(t2.s + 100 * e2.left, 0, 100), v: s(t2.v - 100 * e2.top, 0, 100) });
765
+ }, "aria-label": "Color", "aria-valuetext": "Saturation " + b(t2.s) + "%, Brightness " + b(t2.v) + "%" }, e.createElement(p, { className: "react-colorful__saturation-pointer", top: 1 - t2.v / 100, left: t2.s / 100, color: q(t2) })));
766
+ }), F = function(e2, r2) {
767
+ if (e2 === r2) return !0;
768
+ for (var t2 in e2) if (e2[t2] !== r2[t2]) return !1;
769
+ return !0;
770
+ }, P = function(e2, r2) {
771
+ return e2.replace(/\s/g, "") === r2.replace(/\s/g, "");
772
+ }, X = function(e2, r2) {
773
+ return e2.toLowerCase() === r2.toLowerCase() || F(C(e2), C(r2));
774
+ };
775
+ function Y(e2, t2, l2) {
776
+ var u2 = i(l2), c2 = o(function() {
777
+ return e2.toHsva(t2);
778
+ }), s2 = c2[0], f2 = c2[1], v2 = r({ color: t2, hsva: s2 });
779
+ n(function() {
780
+ if (!e2.equal(t2, v2.current.color)) {
781
+ var r2 = e2.toHsva(t2);
782
+ v2.current = { hsva: r2, color: t2 }, f2(r2);
783
+ }
784
+ }, [t2, e2]), n(function() {
785
+ var r2;
786
+ F(s2, v2.current.hsva) || e2.equal(r2 = e2.fromHsva(s2), v2.current.color) || (v2.current = { hsva: s2, color: r2 }, u2(r2));
787
+ }, [s2, e2, u2]);
788
+ var d2 = a(function(e3) {
789
+ f2(function(r2) {
790
+ return Object.assign({}, r2, e3);
791
+ });
792
+ }, []);
793
+ return [s2, d2];
794
+ }
795
+ var R, V = typeof window < "u" ? l : n, $ = function() {
796
+ return R || (typeof __webpack_nonce__ < "u" ? __webpack_nonce__ : void 0);
797
+ };
798
+ var J = /* @__PURE__ */ new Map(), Q = function(e2) {
799
+ V(function() {
800
+ var r2 = e2.current ? e2.current.ownerDocument : document;
801
+ if (r2 !== void 0 && !J.has(r2)) {
802
+ var t2 = r2.createElement("style");
803
+ t2.innerHTML = `.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`, J.set(r2, t2);
804
+ var n2 = $();
805
+ n2 && t2.setAttribute("nonce", n2), r2.head.appendChild(t2);
806
+ }
807
+ }, []);
808
+ }, U = function(t2) {
809
+ var n2 = t2.className, o2 = t2.colorModel, a2 = t2.color, l2 = a2 === void 0 ? o2.defaultColor : a2, i2 = t2.onChange, s2 = c(t2, ["className", "colorModel", "color", "onChange"]), f2 = r(null);
810
+ Q(f2);
811
+ var v2 = Y(o2, l2, i2), d2 = v2[0], h2 = v2[1], m2 = g(["react-colorful", n2]);
812
+ return e.createElement("div", u({}, s2, { ref: f2, className: m2 }), e.createElement(T, { hsva: d2, onChange: h2 }), e.createElement(S, { hue: d2.h, onChange: h2, className: "react-colorful__last-control" }));
813
+ }, W = { defaultColor: "000", toHsva: x, fromHsva: function(e2) {
814
+ return w({ h: e2.h, s: e2.s, v: e2.v, a: 1 });
815
+ }, equal: X }, Z = function(r2) {
816
+ return e.createElement(U, u({}, r2, { colorModel: W }));
817
+ }, ee = function(r2) {
818
+ var t2 = r2.className, n2 = r2.hsva, o2 = r2.onChange, a2 = { backgroundImage: "linear-gradient(90deg, " + k(Object.assign({}, n2, { a: 0 })) + ", " + k(Object.assign({}, n2, { a: 1 })) + ")" }, l2 = g(["react-colorful__alpha", t2]), u2 = b(100 * n2.a);
819
+ return e.createElement("div", { className: l2 }, e.createElement("div", { className: "react-colorful__alpha-gradient", style: a2 }), e.createElement(m, { onMove: function(e2) {
820
+ o2({ a: e2.left });
821
+ }, onKey: function(e2) {
822
+ o2({ a: s(n2.a + e2.left) });
823
+ }, "aria-label": "Alpha", "aria-valuetext": u2 + "%", "aria-valuenow": u2, "aria-valuemin": "0", "aria-valuemax": "100" }, e.createElement(p, { className: "react-colorful__alpha-pointer", left: n2.a, color: k(n2) })));
824
+ }, re = function(t2) {
825
+ var n2 = t2.className, o2 = t2.colorModel, a2 = t2.color, l2 = a2 === void 0 ? o2.defaultColor : a2, i2 = t2.onChange, s2 = c(t2, ["className", "colorModel", "color", "onChange"]), f2 = r(null);
826
+ Q(f2);
827
+ var v2 = Y(o2, l2, i2), d2 = v2[0], h2 = v2[1], m2 = g(["react-colorful", n2]);
828
+ return e.createElement("div", u({}, s2, { ref: f2, className: m2 }), e.createElement(T, { hsva: d2, onChange: h2 }), e.createElement(S, { hue: d2.h, onChange: h2 }), e.createElement(ee, { hsva: d2, onChange: h2, className: "react-colorful__last-control" }));
829
+ };
830
+ var le = { defaultColor: "hsla(0, 0%, 0%, 1)", toHsva: H, fromHsva: k, equal: P }, ue = function(r2) {
831
+ return e.createElement(re, u({}, r2, { colorModel: le }));
832
+ };
833
+ var Ee = { defaultColor: "rgba(0, 0, 0, 1)", toHsva: z, fromHsva: function(e2) {
834
+ var r2 = I(e2);
835
+ return "rgba(" + r2.r + ", " + r2.g + ", " + r2.b + ", " + r2.a + ")";
836
+ }, equal: P }, He = function(r2) {
837
+ return e.createElement(re, u({}, r2, { colorModel: Ee }));
838
+ };
839
+
840
+ // src/blocks/controls/Color.tsx
841
+ import { styled } from "storybook/theming";
842
+ var Wrapper = styled.div({
843
+ position: "relative",
844
+ maxWidth: 250
845
+ }), TooltipContent = styled.div({
846
+ width: 200,
847
+ margin: 5,
848
+ ".react-colorful__saturation": {
849
+ borderRadius: "4px 4px 0 0"
850
+ },
851
+ ".react-colorful__hue": {
852
+ boxShadow: "inset 0 0 0 1px rgb(0 0 0 / 5%)"
853
+ },
854
+ ".react-colorful__last-control": {
855
+ borderRadius: "0 0 4px 4px"
856
+ }
857
+ }), Swatches = styled.div({
858
+ display: "grid",
859
+ gridTemplateColumns: "repeat(9, 16px)",
860
+ gap: 6,
861
+ padding: 3,
862
+ marginTop: 5,
863
+ width: 200
864
+ }), swatchBackground = `url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')`, SwatchColor = styled(Button)(
865
+ ({ value, selected, theme }) => ({
866
+ width: 16,
867
+ height: 16,
868
+ boxShadow: selected ? `${theme.appBorderColor} 0 0 0 1px inset, ${theme.textMutedColor}50 0 0 0 4px` : `${theme.appBorderColor} 0 0 0 1px inset`,
869
+ border: "none",
870
+ borderRadius: theme.appBorderRadius,
871
+ "&, &:hover": {
872
+ background: "unset",
873
+ backgroundColor: "unset",
874
+ backgroundImage: `linear-gradient(${value}, ${value}), ${swatchBackground}, linear-gradient(hsl(0 0 100 / .4), hsl(0 0 100 / .4))`
875
+ }
876
+ })
877
+ ), Input = styled(Form.Input)(({ theme }) => ({
878
+ width: "100%",
879
+ paddingLeft: 30,
880
+ paddingRight: 30,
881
+ boxSizing: "border-box",
882
+ fontFamily: theme.typography.fonts.base,
883
+ '[aria-readonly="true"] > &': {
884
+ background: theme.base === "light" ? theme.color.lighter : "transparent"
885
+ }
886
+ })), PopoverTrigger = styled(SwatchColor)(({ disabled }) => ({
887
+ position: "absolute",
888
+ top: 4,
889
+ left: 4,
890
+ zIndex: 1,
891
+ cursor: disabled ? "not-allowed" : "pointer"
892
+ })), CycleColorSpaceButton = styled(Button)(({ theme }) => ({
893
+ position: "absolute",
894
+ zIndex: 1,
895
+ top: 6,
896
+ right: 7,
897
+ width: 20,
898
+ height: 20,
899
+ padding: 4,
900
+ boxSizing: "border-box",
901
+ cursor: "pointer",
902
+ color: theme.input.color
903
+ })), ColorSpace = /* @__PURE__ */ ((ColorSpace2) => (ColorSpace2.RGB = "rgb", ColorSpace2.HSL = "hsl", ColorSpace2.HEX = "hex", ColorSpace2))(ColorSpace || {}), COLOR_SPACES = Object.values(ColorSpace), COLOR_REGEXP = /\(([0-9]+),\s*([0-9]+)%?,\s*([0-9]+)%?,?\s*([0-9.]+)?\)/, RGB_REGEXP = /^\s*rgba?\(([0-9]+),\s*([0-9]+),\s*([0-9]+),?\s*([0-9.]+)?\)\s*$/i, HSL_REGEXP = /^\s*hsla?\(([0-9]+),\s*([0-9]+)%,\s*([0-9]+)%,?\s*([0-9.]+)?\)\s*$/i, HEX_REGEXP = /^\s*#?([0-9a-f]{3}|[0-9a-f]{6})\s*$/i, SHORTHEX_REGEXP = /^\s*#?([0-9a-f]{3})\s*$/i, ColorPicker = {
904
+ hex: Z,
905
+ rgb: He,
906
+ hsl: ue
907
+ }, fallbackColor = {
908
+ hex: "transparent",
909
+ rgb: "rgba(0, 0, 0, 0)",
910
+ hsl: "hsla(0, 0%, 0%, 0)"
911
+ }, stringToArgs = (value) => {
912
+ let match = value?.match(COLOR_REGEXP);
913
+ if (!match)
914
+ return [0, 0, 0, 1];
915
+ let [, x2, y2, z2, a2 = 1] = match;
916
+ return [x2, y2, z2, a2].map(Number);
917
+ }, parseRgb = (value) => {
918
+ let [r2, g2, b2, a2] = stringToArgs(value), [h2, s2, l2] = import_color_convert.default.rgb.hsl([r2, g2, b2]) || [0, 0, 0];
919
+ return {
920
+ valid: !0,
921
+ value,
922
+ keyword: import_color_convert.default.rgb.keyword([r2, g2, b2]),
923
+ colorSpace: "rgb" /* RGB */,
924
+ rgb: value,
925
+ hsl: `hsla(${h2}, ${s2}%, ${l2}%, ${a2})`,
926
+ hex: `#${import_color_convert.default.rgb.hex([r2, g2, b2]).toLowerCase()}`
927
+ };
928
+ }, parseHsl = (value) => {
929
+ let [h2, s2, l2, a2] = stringToArgs(value), [r2, g2, b2] = import_color_convert.default.hsl.rgb([h2, s2, l2]) || [0, 0, 0];
930
+ return {
931
+ valid: !0,
932
+ value,
933
+ keyword: import_color_convert.default.hsl.keyword([h2, s2, l2]),
934
+ colorSpace: "hsl" /* HSL */,
935
+ rgb: `rgba(${r2}, ${g2}, ${b2}, ${a2})`,
936
+ hsl: value,
937
+ hex: `#${import_color_convert.default.hsl.hex([h2, s2, l2]).toLowerCase()}`
938
+ };
939
+ }, parseHexOrKeyword = (value) => {
940
+ let plain = value.replace("#", ""), rgb = import_color_convert.default.keyword.rgb(plain) || import_color_convert.default.hex.rgb(plain), hsl = import_color_convert.default.rgb.hsl(rgb), mapped = value;
941
+ /[^#a-f0-9]/i.test(value) ? mapped = plain : HEX_REGEXP.test(value) && (mapped = `#${plain}`);
942
+ let valid = !0;
943
+ if (mapped.startsWith("#"))
944
+ valid = HEX_REGEXP.test(mapped);
945
+ else
946
+ try {
947
+ import_color_convert.default.keyword.hex(mapped);
948
+ } catch {
949
+ valid = !1;
950
+ }
951
+ return {
952
+ valid,
953
+ value: mapped,
954
+ keyword: import_color_convert.default.rgb.keyword(rgb),
955
+ colorSpace: "hex" /* HEX */,
956
+ rgb: `rgba(${rgb[0]}, ${rgb[1]}, ${rgb[2]}, 1)`,
957
+ hsl: `hsla(${hsl[0]}, ${hsl[1]}%, ${hsl[2]}%, 1)`,
958
+ hex: mapped
959
+ };
960
+ }, parseValue = (value) => {
961
+ if (value)
962
+ return RGB_REGEXP.test(value) ? parseRgb(value) : HSL_REGEXP.test(value) ? parseHsl(value) : parseHexOrKeyword(value);
963
+ }, getRealValue = (value, color, colorSpace) => {
964
+ if (!value || !color?.valid)
965
+ return fallbackColor[colorSpace];
966
+ if (colorSpace !== "hex" /* HEX */)
967
+ return color?.[colorSpace] || fallbackColor[colorSpace];
968
+ if (!color.hex.startsWith("#"))
969
+ try {
970
+ return `#${import_color_convert.default.keyword.hex(color.hex)}`;
971
+ } catch {
972
+ return fallbackColor.hex;
973
+ }
974
+ let short = color.hex.match(SHORTHEX_REGEXP);
975
+ if (!short)
976
+ return HEX_REGEXP.test(color.hex) ? color.hex : fallbackColor.hex;
977
+ let [r2, g2, b2] = short[1].split("");
978
+ return `#${r2}${r2}${g2}${g2}${b2}${b2}`;
979
+ }, useColorInput = (initialValue, onChange) => {
980
+ let [value, setValue] = useState(initialValue || ""), [color, setColor] = useState(() => parseValue(value)), [colorSpace, setColorSpace] = useState(color?.colorSpace || "hex" /* HEX */);
981
+ useEffect(() => {
982
+ let nextValue = initialValue || "", nextColor = parseValue(nextValue);
983
+ setValue(nextValue), setColor(nextColor), setColorSpace(nextColor?.colorSpace || "hex" /* HEX */);
984
+ }, [initialValue]);
985
+ let realValue = useMemo(
986
+ () => getRealValue(value, color, colorSpace).toLowerCase(),
987
+ [value, color, colorSpace]
988
+ ), updateValue = useCallback(
989
+ (update) => {
990
+ let parsed = parseValue(update), v2 = parsed?.value || update || "";
991
+ setValue(v2), v2 === "" && (setColor(void 0), onChange(void 0)), parsed && (setColor(parsed), setColorSpace(parsed.colorSpace), onChange(parsed.value));
992
+ },
993
+ [onChange]
994
+ ), cycleColorSpace = useCallback(() => {
995
+ let nextIndex = (COLOR_SPACES.indexOf(colorSpace) + 1) % COLOR_SPACES.length, nextSpace = COLOR_SPACES[nextIndex];
996
+ setColorSpace(nextSpace);
997
+ let updatedValue = color?.[nextSpace] || "";
998
+ setValue(updatedValue), onChange(updatedValue);
999
+ }, [color, colorSpace, onChange]);
1000
+ return { value, realValue, updateValue, color, colorSpace, cycleColorSpace };
1001
+ }, id = (value) => value.replace(/\s*/, "").toLowerCase(), usePresets = (presetColors, currentColor, colorSpace) => {
1002
+ let [selectedColors, setSelectedColors] = useState(currentColor?.valid ? [currentColor] : []);
1003
+ useEffect(() => {
1004
+ currentColor === void 0 && setSelectedColors([]);
1005
+ }, [currentColor]);
1006
+ let presets = useMemo(() => (presetColors || []).map((preset) => typeof preset == "string" ? parseValue(preset) : preset.title ? { ...parseValue(preset.color), keyword: preset.title } : parseValue(preset.color)).concat(selectedColors).filter(Boolean).slice(-27), [presetColors, selectedColors]), addPreset = useCallback(
1007
+ (color) => {
1008
+ color?.valid && (presets.some(
1009
+ (preset) => preset && preset[colorSpace] && id(preset[colorSpace] || "") === id(color[colorSpace] || "")
1010
+ ) || setSelectedColors((arr) => arr.concat(color)));
1011
+ },
1012
+ [colorSpace, presets]
1013
+ );
1014
+ return { presets, addPreset };
1015
+ }, ColorControl = ({
1016
+ name,
1017
+ value: initialValue,
1018
+ onChange,
1019
+ onFocus,
1020
+ onBlur,
1021
+ presetColors,
1022
+ startOpen = !1,
1023
+ argType
1024
+ }) => {
1025
+ let debouncedOnChange = useCallback(debounce(onChange, 200), [onChange]), { value, realValue, updateValue, color, colorSpace, cycleColorSpace } = useColorInput(
1026
+ initialValue,
1027
+ debouncedOnChange
1028
+ ), { presets, addPreset } = usePresets(presetColors ?? [], color, colorSpace), Picker = ColorPicker[colorSpace], readOnly = !!argType?.table?.readonly, controlId = getControlId(name);
1029
+ return React.createElement(Wrapper, null, React.createElement("label", { htmlFor: controlId, className: "sb-sr-only" }, name), React.createElement(
1030
+ Input,
1031
+ {
1032
+ id: controlId,
1033
+ value,
1034
+ onChange: (e2) => updateValue(e2.target.value),
1035
+ onFocus: (e2) => e2.target.select(),
1036
+ readOnly,
1037
+ placeholder: "Choose color..."
1038
+ }
1039
+ ), React.createElement(
1040
+ PopoverProvider,
1041
+ {
1042
+ defaultVisible: startOpen,
1043
+ visible: readOnly ? !1 : void 0,
1044
+ onVisibleChange: () => color && addPreset(color),
1045
+ popover: React.createElement(TooltipContent, null, React.createElement(
1046
+ Picker,
1047
+ {
1048
+ color: realValue === "transparent" ? "#000000" : realValue,
1049
+ onChange: updateValue,
1050
+ onFocus,
1051
+ onBlur
1052
+ }
1053
+ ), presets.length > 0 && React.createElement(Swatches, null, presets.map((preset, index) => React.createElement(
1054
+ SwatchColor,
1055
+ {
1056
+ key: `${preset?.value || index}-${index}`,
1057
+ variant: "ghost",
1058
+ padding: "small",
1059
+ size: "small",
1060
+ ariaLabel: "Pick this color",
1061
+ tooltip: preset?.keyword || preset?.value || "",
1062
+ value: preset?.value || "",
1063
+ selected: !!(color && preset && preset[colorSpace] && id(preset[colorSpace] || "") === id(color[colorSpace])),
1064
+ onClick: () => preset && updateValue(preset.value || "")
1065
+ }
1066
+ ))))
1067
+ },
1068
+ React.createElement(
1069
+ PopoverTrigger,
1070
+ {
1071
+ variant: "ghost",
1072
+ padding: "small",
1073
+ size: "small",
1074
+ ariaLabel: "Open color picker",
1075
+ value: realValue,
1076
+ style: { margin: 4 },
1077
+ disabled: readOnly
1078
+ }
1079
+ )
1080
+ ), value ? React.createElement(
1081
+ CycleColorSpaceButton,
1082
+ {
1083
+ variant: "ghost",
1084
+ padding: "small",
1085
+ size: "small",
1086
+ ariaLabel: "Cycle through color spaces",
1087
+ disabled: readOnly,
1088
+ onClick: readOnly ? void 0 : cycleColorSpace
1089
+ },
1090
+ React.createElement(MarkupIcon, null)
1091
+ ) : null);
1092
+ }, Color_default = ColorControl;
1093
+ export {
1094
+ ColorControl,
1095
+ Color_default as default
1096
+ };