@sanity/color-input 4.0.1-canary.0 → 4.0.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.
@@ -1,1091 +0,0 @@
1
- import { defineType, definePlugin } from "sanity";
2
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
3
- import { TrashIcon } from "@sanity/icons";
4
- import { Flex, useTheme, Box, Card, Stack, Text, Inline, Button } from "@sanity/ui";
5
- import { CustomPicker } from "react-color";
6
- import { EditableInput, Saturation, Hue, Alpha, Checkboard } from "react-color/lib/components/common";
7
- import { styled } from "styled-components";
8
- import { memo, useMemo, useCallback, lazy } from "react";
9
- import { isValidHex } from "react-color/lib/helpers/color";
10
- function _typeof(obj) {
11
- "@babel/helpers - typeof";
12
- return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) {
13
- return typeof obj2;
14
- } : function(obj2) {
15
- return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
16
- }, _typeof(obj);
17
- }
18
- var trimLeft = /^\s+/, trimRight = /\s+$/;
19
- function tinycolor(color2, opts) {
20
- if (color2 = color2 || "", opts = opts || {}, color2 instanceof tinycolor)
21
- return color2;
22
- if (!(this instanceof tinycolor))
23
- return new tinycolor(color2, opts);
24
- var rgb = inputToRGB(color2);
25
- this._originalInput = color2, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format, this._gradientType = opts.gradientType, this._r < 1 && (this._r = Math.round(this._r)), this._g < 1 && (this._g = Math.round(this._g)), this._b < 1 && (this._b = Math.round(this._b)), this._ok = rgb.ok;
26
- }
27
- tinycolor.prototype = {
28
- isDark: function() {
29
- return this.getBrightness() < 128;
30
- },
31
- isLight: function() {
32
- return !this.isDark();
33
- },
34
- isValid: function() {
35
- return this._ok;
36
- },
37
- getOriginalInput: function() {
38
- return this._originalInput;
39
- },
40
- getFormat: function() {
41
- return this._format;
42
- },
43
- getAlpha: function() {
44
- return this._a;
45
- },
46
- getBrightness: function() {
47
- var rgb = this.toRgb();
48
- return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
49
- },
50
- getLuminance: function() {
51
- var rgb = this.toRgb(), RsRGB, GsRGB, BsRGB, R, G, B;
52
- return RsRGB = rgb.r / 255, GsRGB = rgb.g / 255, BsRGB = rgb.b / 255, RsRGB <= 0.03928 ? R = RsRGB / 12.92 : R = Math.pow((RsRGB + 0.055) / 1.055, 2.4), GsRGB <= 0.03928 ? G = GsRGB / 12.92 : G = Math.pow((GsRGB + 0.055) / 1.055, 2.4), BsRGB <= 0.03928 ? B = BsRGB / 12.92 : B = Math.pow((BsRGB + 0.055) / 1.055, 2.4), 0.2126 * R + 0.7152 * G + 0.0722 * B;
53
- },
54
- setAlpha: function(value) {
55
- return this._a = boundAlpha(value), this._roundA = Math.round(100 * this._a) / 100, this;
56
- },
57
- toHsv: function() {
58
- var hsv = rgbToHsv(this._r, this._g, this._b);
59
- return {
60
- h: hsv.h * 360,
61
- s: hsv.s,
62
- v: hsv.v,
63
- a: this._a
64
- };
65
- },
66
- toHsvString: function() {
67
- var hsv = rgbToHsv(this._r, this._g, this._b), h = Math.round(hsv.h * 360), s = Math.round(hsv.s * 100), v = Math.round(hsv.v * 100);
68
- return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
69
- },
70
- toHsl: function() {
71
- var hsl = rgbToHsl(this._r, this._g, this._b);
72
- return {
73
- h: hsl.h * 360,
74
- s: hsl.s,
75
- l: hsl.l,
76
- a: this._a
77
- };
78
- },
79
- toHslString: function() {
80
- var hsl = rgbToHsl(this._r, this._g, this._b), h = Math.round(hsl.h * 360), s = Math.round(hsl.s * 100), l = Math.round(hsl.l * 100);
81
- return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
82
- },
83
- toHex: function(allow3Char) {
84
- return rgbToHex(this._r, this._g, this._b, allow3Char);
85
- },
86
- toHexString: function(allow3Char) {
87
- return "#" + this.toHex(allow3Char);
88
- },
89
- toHex8: function(allow4Char) {
90
- return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
91
- },
92
- toHex8String: function(allow4Char) {
93
- return "#" + this.toHex8(allow4Char);
94
- },
95
- toRgb: function() {
96
- return {
97
- r: Math.round(this._r),
98
- g: Math.round(this._g),
99
- b: Math.round(this._b),
100
- a: this._a
101
- };
102
- },
103
- toRgbString: function() {
104
- return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")";
105
- },
106
- toPercentageRgb: function() {
107
- return {
108
- r: Math.round(bound01(this._r, 255) * 100) + "%",
109
- g: Math.round(bound01(this._g, 255) * 100) + "%",
110
- b: Math.round(bound01(this._b, 255) * 100) + "%",
111
- a: this._a
112
- };
113
- },
114
- toPercentageRgbString: function() {
115
- return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
116
- },
117
- toName: function() {
118
- return this._a === 0 ? "transparent" : this._a < 1 ? !1 : hexNames[rgbToHex(this._r, this._g, this._b, !0)] || !1;
119
- },
120
- toFilter: function(secondColor) {
121
- var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a), secondHex8String = hex8String, gradientType = this._gradientType ? "GradientType = 1, " : "";
122
- if (secondColor) {
123
- var s = tinycolor(secondColor);
124
- secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a);
125
- }
126
- return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
127
- },
128
- toString: function(format) {
129
- var formatSet = !!format;
130
- format = format || this._format;
131
- var formattedString = !1, hasAlpha = this._a < 1 && this._a >= 0, needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
132
- return needsAlphaFormat ? format === "name" && this._a === 0 ? this.toName() : this.toRgbString() : (format === "rgb" && (formattedString = this.toRgbString()), format === "prgb" && (formattedString = this.toPercentageRgbString()), (format === "hex" || format === "hex6") && (formattedString = this.toHexString()), format === "hex3" && (formattedString = this.toHexString(!0)), format === "hex4" && (formattedString = this.toHex8String(!0)), format === "hex8" && (formattedString = this.toHex8String()), format === "name" && (formattedString = this.toName()), format === "hsl" && (formattedString = this.toHslString()), format === "hsv" && (formattedString = this.toHsvString()), formattedString || this.toHexString());
133
- },
134
- clone: function() {
135
- return tinycolor(this.toString());
136
- },
137
- _applyModification: function(fn, args) {
138
- var color2 = fn.apply(null, [this].concat([].slice.call(args)));
139
- return this._r = color2._r, this._g = color2._g, this._b = color2._b, this.setAlpha(color2._a), this;
140
- },
141
- lighten: function() {
142
- return this._applyModification(_lighten, arguments);
143
- },
144
- brighten: function() {
145
- return this._applyModification(_brighten, arguments);
146
- },
147
- darken: function() {
148
- return this._applyModification(_darken, arguments);
149
- },
150
- desaturate: function() {
151
- return this._applyModification(_desaturate, arguments);
152
- },
153
- saturate: function() {
154
- return this._applyModification(_saturate, arguments);
155
- },
156
- greyscale: function() {
157
- return this._applyModification(_greyscale, arguments);
158
- },
159
- spin: function() {
160
- return this._applyModification(_spin, arguments);
161
- },
162
- _applyCombination: function(fn, args) {
163
- return fn.apply(null, [this].concat([].slice.call(args)));
164
- },
165
- analogous: function() {
166
- return this._applyCombination(_analogous, arguments);
167
- },
168
- complement: function() {
169
- return this._applyCombination(_complement, arguments);
170
- },
171
- monochromatic: function() {
172
- return this._applyCombination(_monochromatic, arguments);
173
- },
174
- splitcomplement: function() {
175
- return this._applyCombination(_splitcomplement, arguments);
176
- },
177
- // Disabled until https://github.com/bgrins/TinyColor/issues/254
178
- // polyad: function (number) {
179
- // return this._applyCombination(polyad, [number]);
180
- // },
181
- triad: function() {
182
- return this._applyCombination(polyad, [3]);
183
- },
184
- tetrad: function() {
185
- return this._applyCombination(polyad, [4]);
186
- }
187
- };
188
- tinycolor.fromRatio = function(color2, opts) {
189
- if (_typeof(color2) == "object") {
190
- var newColor = {};
191
- for (var i in color2)
192
- color2.hasOwnProperty(i) && (i === "a" ? newColor[i] = color2[i] : newColor[i] = convertToPercentage(color2[i]));
193
- color2 = newColor;
194
- }
195
- return tinycolor(color2, opts);
196
- };
197
- function inputToRGB(color2) {
198
- var rgb = {
199
- r: 0,
200
- g: 0,
201
- b: 0
202
- }, a = 1, s = null, v = null, l = null, ok = !1, format = !1;
203
- return typeof color2 == "string" && (color2 = stringInputToObject(color2)), _typeof(color2) == "object" && (isValidCSSUnit(color2.r) && isValidCSSUnit(color2.g) && isValidCSSUnit(color2.b) ? (rgb = rgbToRgb(color2.r, color2.g, color2.b), ok = !0, format = String(color2.r).substr(-1) === "%" ? "prgb" : "rgb") : isValidCSSUnit(color2.h) && isValidCSSUnit(color2.s) && isValidCSSUnit(color2.v) ? (s = convertToPercentage(color2.s), v = convertToPercentage(color2.v), rgb = hsvToRgb(color2.h, s, v), ok = !0, format = "hsv") : isValidCSSUnit(color2.h) && isValidCSSUnit(color2.s) && isValidCSSUnit(color2.l) && (s = convertToPercentage(color2.s), l = convertToPercentage(color2.l), rgb = hslToRgb(color2.h, s, l), ok = !0, format = "hsl"), color2.hasOwnProperty("a") && (a = color2.a)), a = boundAlpha(a), {
204
- ok,
205
- format: color2.format || format,
206
- r: Math.min(255, Math.max(rgb.r, 0)),
207
- g: Math.min(255, Math.max(rgb.g, 0)),
208
- b: Math.min(255, Math.max(rgb.b, 0)),
209
- a
210
- };
211
- }
212
- function rgbToRgb(r, g, b) {
213
- return {
214
- r: bound01(r, 255) * 255,
215
- g: bound01(g, 255) * 255,
216
- b: bound01(b, 255) * 255
217
- };
218
- }
219
- function rgbToHsl(r, g, b) {
220
- r = bound01(r, 255), g = bound01(g, 255), b = bound01(b, 255);
221
- var max = Math.max(r, g, b), min = Math.min(r, g, b), h, s, l = (max + min) / 2;
222
- if (max == min)
223
- h = s = 0;
224
- else {
225
- var d = max - min;
226
- switch (s = l > 0.5 ? d / (2 - max - min) : d / (max + min), max) {
227
- case r:
228
- h = (g - b) / d + (g < b ? 6 : 0);
229
- break;
230
- case g:
231
- h = (b - r) / d + 2;
232
- break;
233
- case b:
234
- h = (r - g) / d + 4;
235
- break;
236
- }
237
- h /= 6;
238
- }
239
- return {
240
- h,
241
- s,
242
- l
243
- };
244
- }
245
- function hslToRgb(h, s, l) {
246
- var r, g, b;
247
- h = bound01(h, 360), s = bound01(s, 100), l = bound01(l, 100);
248
- function hue2rgb(p2, q2, t) {
249
- return t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? p2 + (q2 - p2) * 6 * t : t < 1 / 2 ? q2 : t < 2 / 3 ? p2 + (q2 - p2) * (2 / 3 - t) * 6 : p2;
250
- }
251
- if (s === 0)
252
- r = g = b = l;
253
- else {
254
- var q = l < 0.5 ? l * (1 + s) : l + s - l * s, p = 2 * l - q;
255
- r = hue2rgb(p, q, h + 1 / 3), g = hue2rgb(p, q, h), b = hue2rgb(p, q, h - 1 / 3);
256
- }
257
- return {
258
- r: r * 255,
259
- g: g * 255,
260
- b: b * 255
261
- };
262
- }
263
- function rgbToHsv(r, g, b) {
264
- r = bound01(r, 255), g = bound01(g, 255), b = bound01(b, 255);
265
- var max = Math.max(r, g, b), min = Math.min(r, g, b), h, s, v = max, d = max - min;
266
- if (s = max === 0 ? 0 : d / max, max == min)
267
- h = 0;
268
- else {
269
- switch (max) {
270
- case r:
271
- h = (g - b) / d + (g < b ? 6 : 0);
272
- break;
273
- case g:
274
- h = (b - r) / d + 2;
275
- break;
276
- case b:
277
- h = (r - g) / d + 4;
278
- break;
279
- }
280
- h /= 6;
281
- }
282
- return {
283
- h,
284
- s,
285
- v
286
- };
287
- }
288
- function hsvToRgb(h, s, v) {
289
- h = bound01(h, 360) * 6, s = bound01(s, 100), v = bound01(v, 100);
290
- var i = Math.floor(h), f = h - i, p = v * (1 - s), q = v * (1 - f * s), t = v * (1 - (1 - f) * s), mod = i % 6, r = [v, q, p, p, t, v][mod], g = [t, v, v, q, p, p][mod], b = [p, p, t, v, v, q][mod];
291
- return {
292
- r: r * 255,
293
- g: g * 255,
294
- b: b * 255
295
- };
296
- }
297
- function rgbToHex(r, g, b, allow3Char) {
298
- var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
299
- return allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) ? hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) : hex.join("");
300
- }
301
- function rgbaToHex(r, g, b, a, allow4Char) {
302
- var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))];
303
- return allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1) ? hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0) : hex.join("");
304
- }
305
- function rgbaToArgbHex(r, g, b, a) {
306
- var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
307
- return hex.join("");
308
- }
309
- tinycolor.equals = function(color1, color2) {
310
- return !color1 || !color2 ? !1 : tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
311
- };
312
- tinycolor.random = function() {
313
- return tinycolor.fromRatio({
314
- r: Math.random(),
315
- g: Math.random(),
316
- b: Math.random()
317
- });
318
- };
319
- function _desaturate(color2, amount) {
320
- amount = amount === 0 ? 0 : amount || 10;
321
- var hsl = tinycolor(color2).toHsl();
322
- return hsl.s -= amount / 100, hsl.s = clamp01(hsl.s), tinycolor(hsl);
323
- }
324
- function _saturate(color2, amount) {
325
- amount = amount === 0 ? 0 : amount || 10;
326
- var hsl = tinycolor(color2).toHsl();
327
- return hsl.s += amount / 100, hsl.s = clamp01(hsl.s), tinycolor(hsl);
328
- }
329
- function _greyscale(color2) {
330
- return tinycolor(color2).desaturate(100);
331
- }
332
- function _lighten(color2, amount) {
333
- amount = amount === 0 ? 0 : amount || 10;
334
- var hsl = tinycolor(color2).toHsl();
335
- return hsl.l += amount / 100, hsl.l = clamp01(hsl.l), tinycolor(hsl);
336
- }
337
- function _brighten(color2, amount) {
338
- amount = amount === 0 ? 0 : amount || 10;
339
- var rgb = tinycolor(color2).toRgb();
340
- return rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100)))), rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100)))), rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100)))), tinycolor(rgb);
341
- }
342
- function _darken(color2, amount) {
343
- amount = amount === 0 ? 0 : amount || 10;
344
- var hsl = tinycolor(color2).toHsl();
345
- return hsl.l -= amount / 100, hsl.l = clamp01(hsl.l), tinycolor(hsl);
346
- }
347
- function _spin(color2, amount) {
348
- var hsl = tinycolor(color2).toHsl(), hue = (hsl.h + amount) % 360;
349
- return hsl.h = hue < 0 ? 360 + hue : hue, tinycolor(hsl);
350
- }
351
- function _complement(color2) {
352
- var hsl = tinycolor(color2).toHsl();
353
- return hsl.h = (hsl.h + 180) % 360, tinycolor(hsl);
354
- }
355
- function polyad(color2, number) {
356
- if (isNaN(number) || number <= 0)
357
- throw new Error("Argument to polyad must be a positive number");
358
- for (var hsl = tinycolor(color2).toHsl(), result = [tinycolor(color2)], step = 360 / number, i = 1; i < number; i++)
359
- result.push(tinycolor({
360
- h: (hsl.h + i * step) % 360,
361
- s: hsl.s,
362
- l: hsl.l
363
- }));
364
- return result;
365
- }
366
- function _splitcomplement(color2) {
367
- var hsl = tinycolor(color2).toHsl(), h = hsl.h;
368
- return [tinycolor(color2), tinycolor({
369
- h: (h + 72) % 360,
370
- s: hsl.s,
371
- l: hsl.l
372
- }), tinycolor({
373
- h: (h + 216) % 360,
374
- s: hsl.s,
375
- l: hsl.l
376
- })];
377
- }
378
- function _analogous(color2, results, slices) {
379
- results = results || 6, slices = slices || 30;
380
- var hsl = tinycolor(color2).toHsl(), part = 360 / slices, ret = [tinycolor(color2)];
381
- for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; )
382
- hsl.h = (hsl.h + part) % 360, ret.push(tinycolor(hsl));
383
- return ret;
384
- }
385
- function _monochromatic(color2, results) {
386
- results = results || 6;
387
- for (var hsv = tinycolor(color2).toHsv(), h = hsv.h, s = hsv.s, v = hsv.v, ret = [], modification = 1 / results; results--; )
388
- ret.push(tinycolor({
389
- h,
390
- s,
391
- v
392
- })), v = (v + modification) % 1;
393
- return ret;
394
- }
395
- tinycolor.mix = function(color1, color2, amount) {
396
- amount = amount === 0 ? 0 : amount || 50;
397
- var rgb1 = tinycolor(color1).toRgb(), rgb2 = tinycolor(color2).toRgb(), p = amount / 100, rgba = {
398
- r: (rgb2.r - rgb1.r) * p + rgb1.r,
399
- g: (rgb2.g - rgb1.g) * p + rgb1.g,
400
- b: (rgb2.b - rgb1.b) * p + rgb1.b,
401
- a: (rgb2.a - rgb1.a) * p + rgb1.a
402
- };
403
- return tinycolor(rgba);
404
- };
405
- tinycolor.readability = function(color1, color2) {
406
- var c1 = tinycolor(color1), c2 = tinycolor(color2);
407
- return (Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) / (Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05);
408
- };
409
- tinycolor.isReadable = function(color1, color2, wcag2) {
410
- var readability = tinycolor.readability(color1, color2), wcag2Parms, out;
411
- switch (out = !1, wcag2Parms = validateWCAG2Parms(wcag2), wcag2Parms.level + wcag2Parms.size) {
412
- case "AAsmall":
413
- case "AAAlarge":
414
- out = readability >= 4.5;
415
- break;
416
- case "AAlarge":
417
- out = readability >= 3;
418
- break;
419
- case "AAAsmall":
420
- out = readability >= 7;
421
- break;
422
- }
423
- return out;
424
- };
425
- tinycolor.mostReadable = function(baseColor, colorList, args) {
426
- var bestColor = null, bestScore = 0, readability, includeFallbackColors, level, size;
427
- args = args || {}, includeFallbackColors = args.includeFallbackColors, level = args.level, size = args.size;
428
- for (var i = 0; i < colorList.length; i++)
429
- readability = tinycolor.readability(baseColor, colorList[i]), readability > bestScore && (bestScore = readability, bestColor = tinycolor(colorList[i]));
430
- return tinycolor.isReadable(baseColor, bestColor, {
431
- level,
432
- size
433
- }) || !includeFallbackColors ? bestColor : (args.includeFallbackColors = !1, tinycolor.mostReadable(baseColor, ["#fff", "#000"], args));
434
- };
435
- var names = tinycolor.names = {
436
- aliceblue: "f0f8ff",
437
- antiquewhite: "faebd7",
438
- aqua: "0ff",
439
- aquamarine: "7fffd4",
440
- azure: "f0ffff",
441
- beige: "f5f5dc",
442
- bisque: "ffe4c4",
443
- black: "000",
444
- blanchedalmond: "ffebcd",
445
- blue: "00f",
446
- blueviolet: "8a2be2",
447
- brown: "a52a2a",
448
- burlywood: "deb887",
449
- burntsienna: "ea7e5d",
450
- cadetblue: "5f9ea0",
451
- chartreuse: "7fff00",
452
- chocolate: "d2691e",
453
- coral: "ff7f50",
454
- cornflowerblue: "6495ed",
455
- cornsilk: "fff8dc",
456
- crimson: "dc143c",
457
- cyan: "0ff",
458
- darkblue: "00008b",
459
- darkcyan: "008b8b",
460
- darkgoldenrod: "b8860b",
461
- darkgray: "a9a9a9",
462
- darkgreen: "006400",
463
- darkgrey: "a9a9a9",
464
- darkkhaki: "bdb76b",
465
- darkmagenta: "8b008b",
466
- darkolivegreen: "556b2f",
467
- darkorange: "ff8c00",
468
- darkorchid: "9932cc",
469
- darkred: "8b0000",
470
- darksalmon: "e9967a",
471
- darkseagreen: "8fbc8f",
472
- darkslateblue: "483d8b",
473
- darkslategray: "2f4f4f",
474
- darkslategrey: "2f4f4f",
475
- darkturquoise: "00ced1",
476
- darkviolet: "9400d3",
477
- deeppink: "ff1493",
478
- deepskyblue: "00bfff",
479
- dimgray: "696969",
480
- dimgrey: "696969",
481
- dodgerblue: "1e90ff",
482
- firebrick: "b22222",
483
- floralwhite: "fffaf0",
484
- forestgreen: "228b22",
485
- fuchsia: "f0f",
486
- gainsboro: "dcdcdc",
487
- ghostwhite: "f8f8ff",
488
- gold: "ffd700",
489
- goldenrod: "daa520",
490
- gray: "808080",
491
- green: "008000",
492
- greenyellow: "adff2f",
493
- grey: "808080",
494
- honeydew: "f0fff0",
495
- hotpink: "ff69b4",
496
- indianred: "cd5c5c",
497
- indigo: "4b0082",
498
- ivory: "fffff0",
499
- khaki: "f0e68c",
500
- lavender: "e6e6fa",
501
- lavenderblush: "fff0f5",
502
- lawngreen: "7cfc00",
503
- lemonchiffon: "fffacd",
504
- lightblue: "add8e6",
505
- lightcoral: "f08080",
506
- lightcyan: "e0ffff",
507
- lightgoldenrodyellow: "fafad2",
508
- lightgray: "d3d3d3",
509
- lightgreen: "90ee90",
510
- lightgrey: "d3d3d3",
511
- lightpink: "ffb6c1",
512
- lightsalmon: "ffa07a",
513
- lightseagreen: "20b2aa",
514
- lightskyblue: "87cefa",
515
- lightslategray: "789",
516
- lightslategrey: "789",
517
- lightsteelblue: "b0c4de",
518
- lightyellow: "ffffe0",
519
- lime: "0f0",
520
- limegreen: "32cd32",
521
- linen: "faf0e6",
522
- magenta: "f0f",
523
- maroon: "800000",
524
- mediumaquamarine: "66cdaa",
525
- mediumblue: "0000cd",
526
- mediumorchid: "ba55d3",
527
- mediumpurple: "9370db",
528
- mediumseagreen: "3cb371",
529
- mediumslateblue: "7b68ee",
530
- mediumspringgreen: "00fa9a",
531
- mediumturquoise: "48d1cc",
532
- mediumvioletred: "c71585",
533
- midnightblue: "191970",
534
- mintcream: "f5fffa",
535
- mistyrose: "ffe4e1",
536
- moccasin: "ffe4b5",
537
- navajowhite: "ffdead",
538
- navy: "000080",
539
- oldlace: "fdf5e6",
540
- olive: "808000",
541
- olivedrab: "6b8e23",
542
- orange: "ffa500",
543
- orangered: "ff4500",
544
- orchid: "da70d6",
545
- palegoldenrod: "eee8aa",
546
- palegreen: "98fb98",
547
- paleturquoise: "afeeee",
548
- palevioletred: "db7093",
549
- papayawhip: "ffefd5",
550
- peachpuff: "ffdab9",
551
- peru: "cd853f",
552
- pink: "ffc0cb",
553
- plum: "dda0dd",
554
- powderblue: "b0e0e6",
555
- purple: "800080",
556
- rebeccapurple: "663399",
557
- red: "f00",
558
- rosybrown: "bc8f8f",
559
- royalblue: "4169e1",
560
- saddlebrown: "8b4513",
561
- salmon: "fa8072",
562
- sandybrown: "f4a460",
563
- seagreen: "2e8b57",
564
- seashell: "fff5ee",
565
- sienna: "a0522d",
566
- silver: "c0c0c0",
567
- skyblue: "87ceeb",
568
- slateblue: "6a5acd",
569
- slategray: "708090",
570
- slategrey: "708090",
571
- snow: "fffafa",
572
- springgreen: "00ff7f",
573
- steelblue: "4682b4",
574
- tan: "d2b48c",
575
- teal: "008080",
576
- thistle: "d8bfd8",
577
- tomato: "ff6347",
578
- turquoise: "40e0d0",
579
- violet: "ee82ee",
580
- wheat: "f5deb3",
581
- white: "fff",
582
- whitesmoke: "f5f5f5",
583
- yellow: "ff0",
584
- yellowgreen: "9acd32"
585
- }, hexNames = tinycolor.hexNames = flip(names);
586
- function flip(o) {
587
- var flipped = {};
588
- for (var i in o)
589
- o.hasOwnProperty(i) && (flipped[o[i]] = i);
590
- return flipped;
591
- }
592
- function boundAlpha(a) {
593
- return a = parseFloat(a), (isNaN(a) || a < 0 || a > 1) && (a = 1), a;
594
- }
595
- function bound01(n, max) {
596
- isOnePointZero(n) && (n = "100%");
597
- var processPercent = isPercentage(n);
598
- return n = Math.min(max, Math.max(0, parseFloat(n))), processPercent && (n = parseInt(n * max, 10) / 100), Math.abs(n - max) < 1e-6 ? 1 : n % max / parseFloat(max);
599
- }
600
- function clamp01(val) {
601
- return Math.min(1, Math.max(0, val));
602
- }
603
- function parseIntFromHex(val) {
604
- return parseInt(val, 16);
605
- }
606
- function isOnePointZero(n) {
607
- return typeof n == "string" && n.indexOf(".") != -1 && parseFloat(n) === 1;
608
- }
609
- function isPercentage(n) {
610
- return typeof n == "string" && n.indexOf("%") != -1;
611
- }
612
- function pad2(c) {
613
- return c.length == 1 ? "0" + c : "" + c;
614
- }
615
- function convertToPercentage(n) {
616
- return n <= 1 && (n = n * 100 + "%"), n;
617
- }
618
- function convertDecimalToHex(d) {
619
- return Math.round(parseFloat(d) * 255).toString(16);
620
- }
621
- function convertHexToDecimal(h) {
622
- return parseIntFromHex(h) / 255;
623
- }
624
- var matchers = function() {
625
- var CSS_INTEGER = "[-\\+]?\\d+%?", CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?", CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")", PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?", PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
626
- return {
627
- CSS_UNIT: new RegExp(CSS_UNIT),
628
- rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
629
- rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
630
- hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
631
- hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
632
- hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
633
- hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
634
- hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
635
- hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
636
- hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
637
- hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
638
- };
639
- }();
640
- function isValidCSSUnit(color2) {
641
- return !!matchers.CSS_UNIT.exec(color2);
642
- }
643
- function stringInputToObject(color2) {
644
- color2 = color2.replace(trimLeft, "").replace(trimRight, "").toLowerCase();
645
- var named = !1;
646
- if (names[color2])
647
- color2 = names[color2], named = !0;
648
- else if (color2 == "transparent")
649
- return {
650
- r: 0,
651
- g: 0,
652
- b: 0,
653
- a: 0,
654
- format: "name"
655
- };
656
- var match;
657
- return (match = matchers.rgb.exec(color2)) ? {
658
- r: match[1],
659
- g: match[2],
660
- b: match[3]
661
- } : (match = matchers.rgba.exec(color2)) ? {
662
- r: match[1],
663
- g: match[2],
664
- b: match[3],
665
- a: match[4]
666
- } : (match = matchers.hsl.exec(color2)) ? {
667
- h: match[1],
668
- s: match[2],
669
- l: match[3]
670
- } : (match = matchers.hsla.exec(color2)) ? {
671
- h: match[1],
672
- s: match[2],
673
- l: match[3],
674
- a: match[4]
675
- } : (match = matchers.hsv.exec(color2)) ? {
676
- h: match[1],
677
- s: match[2],
678
- v: match[3]
679
- } : (match = matchers.hsva.exec(color2)) ? {
680
- h: match[1],
681
- s: match[2],
682
- v: match[3],
683
- a: match[4]
684
- } : (match = matchers.hex8.exec(color2)) ? {
685
- r: parseIntFromHex(match[1]),
686
- g: parseIntFromHex(match[2]),
687
- b: parseIntFromHex(match[3]),
688
- a: convertHexToDecimal(match[4]),
689
- format: named ? "name" : "hex8"
690
- } : (match = matchers.hex6.exec(color2)) ? {
691
- r: parseIntFromHex(match[1]),
692
- g: parseIntFromHex(match[2]),
693
- b: parseIntFromHex(match[3]),
694
- format: named ? "name" : "hex"
695
- } : (match = matchers.hex4.exec(color2)) ? {
696
- r: parseIntFromHex(match[1] + "" + match[1]),
697
- g: parseIntFromHex(match[2] + "" + match[2]),
698
- b: parseIntFromHex(match[3] + "" + match[3]),
699
- a: convertHexToDecimal(match[4] + "" + match[4]),
700
- format: named ? "name" : "hex8"
701
- } : (match = matchers.hex3.exec(color2)) ? {
702
- r: parseIntFromHex(match[1] + "" + match[1]),
703
- g: parseIntFromHex(match[2] + "" + match[2]),
704
- b: parseIntFromHex(match[3] + "" + match[3]),
705
- format: named ? "name" : "hex"
706
- } : !1;
707
- }
708
- function validateWCAG2Parms(parms) {
709
- var level, size;
710
- return parms = parms || {
711
- level: "AA",
712
- size: "small"
713
- }, level = (parms.level || "AA").toUpperCase(), size = (parms.size || "small").toLowerCase(), level !== "AA" && level !== "AAA" && (level = "AA"), size !== "small" && size !== "large" && (size = "small"), {
714
- level,
715
- size
716
- };
717
- }
718
- const ColorListWrap = styled(Flex)`
719
- gap: 0.25em;
720
- `, ColorBoxContainer = styled.div`
721
- width: 2.1em;
722
- height: 2.1em;
723
- cursor: pointer;
724
- position: relative;
725
- overflow: hidden;
726
- border-radius: 3px;
727
- background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAADFJREFUOE9jZGBgEGHAD97gk2YcNYBhmIQBgWSAP52AwoAQwJvQRg1gACckQoC2gQgAIF8IscwEtKYAAAAASUVORK5CYII=')
728
- left center #fff;
729
- `, ColorBox$1 = styled.div`
730
- border-radius: inherit;
731
- box-shadow: inset 0 0 0 1px var(--card-shadow-outline-color);
732
- content: '';
733
- position: absolute;
734
- inset: 0;
735
- z-index: 1;
736
- `, validateColors = (colors) => colors.reduce((cls, c) => {
737
- const color2 = c.hex ? tinycolor(c.hex) : tinycolor(c);
738
- return color2.isValid() && cls.push({
739
- color: c,
740
- backgroundColor: color2.toRgbString()
741
- }), cls;
742
- }, []), ColorList = memo(function({ colors, onChange }) {
743
- return colors ? /* @__PURE__ */ jsx(ColorListWrap, { wrap: "wrap", children: validateColors(colors).map(({ color: color2, backgroundColor }, idx) => /* @__PURE__ */ jsx(
744
- ColorBoxContainer,
745
- {
746
- onClick: () => {
747
- onChange(color2);
748
- },
749
- children: /* @__PURE__ */ jsx(ColorBox$1, { style: { background: backgroundColor } })
750
- },
751
- `${backgroundColor}-${idx}`
752
- )) }) : null;
753
- }), ColorPickerFields = ({
754
- onChange,
755
- rgb,
756
- hsl,
757
- hex,
758
- disableAlpha
759
- }) => {
760
- const { sanity } = useTheme(), inputStyles = useMemo(
761
- () => ({
762
- input: {
763
- width: "80%",
764
- padding: "4px 10% 3px",
765
- border: "none",
766
- boxShadow: `inset 0 0 0 1px ${sanity.color.input.default.enabled.border}`,
767
- color: sanity.color.input.default.enabled.fg,
768
- backgroundColor: sanity.color.input.default.enabled.bg,
769
- fontSize: sanity.fonts.text.sizes[0].fontSize,
770
- textAlign: "center"
771
- },
772
- label: {
773
- display: "block",
774
- textAlign: "center",
775
- fontSize: sanity.fonts.label.sizes[0].fontSize,
776
- color: sanity.color.base.fg,
777
- paddingTop: "3px",
778
- paddingBottom: "4px",
779
- textTransform: "capitalize"
780
- }
781
- }),
782
- [sanity]
783
- ), handleChange = useCallback(
784
- (data) => {
785
- if ("hex" in data && data.hex && isValidHex(data.hex))
786
- onChange({
787
- hex: data.hex,
788
- source: "hex"
789
- });
790
- else if (rgb && ("r" in data && data.r || "g" in data && data.g || "b" in data && data.b))
791
- onChange({
792
- r: Number(data.r) || rgb.r,
793
- g: Number(data.g) || rgb.g,
794
- b: Number(data.b) || rgb.b,
795
- a: rgb.a,
796
- source: "rgb"
797
- });
798
- else if (hsl && "a" in data && data.a) {
799
- let alpha = Number(data.a);
800
- alpha < 0 ? alpha = 0 : alpha > 100 && (alpha = 100), alpha /= 100, onChange({
801
- h: hsl.h,
802
- s: hsl.s,
803
- l: hsl.l,
804
- a: alpha,
805
- source: "hsl"
806
- });
807
- }
808
- },
809
- [onChange, hsl, rgb]
810
- );
811
- return /* @__PURE__ */ jsxs(Flex, { children: [
812
- /* @__PURE__ */ jsx(Box, { flex: 2, marginRight: 1, children: /* @__PURE__ */ jsx(
813
- EditableInput,
814
- {
815
- style: inputStyles,
816
- label: "hex",
817
- value: hex?.replace("#", ""),
818
- onChange: handleChange
819
- }
820
- ) }),
821
- /* @__PURE__ */ jsx(Box, { flex: 1, marginRight: 1, children: /* @__PURE__ */ jsx(
822
- EditableInput,
823
- {
824
- style: inputStyles,
825
- label: "r",
826
- value: rgb?.r,
827
- onChange: handleChange,
828
- dragLabel: !0,
829
- dragMax: 255
830
- }
831
- ) }),
832
- /* @__PURE__ */ jsx(Box, { flex: 1, marginRight: 1, children: /* @__PURE__ */ jsx(
833
- EditableInput,
834
- {
835
- style: inputStyles,
836
- label: "g",
837
- value: rgb?.g,
838
- onChange: handleChange,
839
- dragLabel: !0,
840
- dragMax: 255
841
- }
842
- ) }),
843
- /* @__PURE__ */ jsx(Box, { flex: 1, marginRight: 1, children: /* @__PURE__ */ jsx(
844
- EditableInput,
845
- {
846
- style: inputStyles,
847
- label: "b",
848
- value: rgb?.b,
849
- onChange: handleChange,
850
- dragLabel: !0,
851
- dragMax: 255
852
- }
853
- ) }),
854
- !disableAlpha && /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(
855
- EditableInput,
856
- {
857
- style: inputStyles,
858
- label: "a",
859
- value: Math.round((rgb?.a ?? 1) * 100),
860
- onChange: handleChange,
861
- dragLabel: !0,
862
- dragMax: 100
863
- }
864
- ) })
865
- ] });
866
- }, ColorBox = styled(Box)`
867
- position: absolute;
868
- top: 0;
869
- left: 0;
870
- width: 100%;
871
- height: 100%;
872
- `, ReadOnlyContainer = styled(Flex)`
873
- margin-top: 6rem;
874
- background-color: var(--card-bg-color);
875
- position: relative;
876
- width: 100%;
877
- `, ColorPickerInner = (props) => {
878
- const {
879
- width,
880
- color: { rgb, hex, hsv, hsl },
881
- onChange,
882
- onUnset,
883
- disableAlpha,
884
- colorList,
885
- readOnly
886
- } = props;
887
- return !hsl || !hsv ? null : /* @__PURE__ */ jsx("div", { style: { width }, children: /* @__PURE__ */ jsx(Card, { padding: 1, border: !0, radius: 1, children: /* @__PURE__ */ jsxs(Stack, { space: 2, children: [
888
- !readOnly && /* @__PURE__ */ jsxs(Fragment, { children: [
889
- /* @__PURE__ */ jsx(Card, { overflow: "hidden", style: { position: "relative", height: "5em" }, children: /* @__PURE__ */ jsx(Saturation, { onChange, hsl, hsv }) }),
890
- /* @__PURE__ */ jsx(
891
- Card,
892
- {
893
- shadow: 1,
894
- radius: 3,
895
- overflow: "hidden",
896
- style: { position: "relative", height: "10px" },
897
- children: /* @__PURE__ */ jsx(Hue, { hsl, onChange: !readOnly && onChange })
898
- }
899
- ),
900
- !disableAlpha && /* @__PURE__ */ jsx(
901
- Card,
902
- {
903
- shadow: 1,
904
- radius: 3,
905
- overflow: "hidden",
906
- style: { position: "relative", height: "10px", background: "#fff" },
907
- children: /* @__PURE__ */ jsx(Alpha, { rgb, hsl, onChange })
908
- }
909
- )
910
- ] }),
911
- /* @__PURE__ */ jsxs(Flex, { children: [
912
- /* @__PURE__ */ jsxs(
913
- Card,
914
- {
915
- flex: 1,
916
- radius: 2,
917
- overflow: "hidden",
918
- style: { position: "relative", minWidth: "4em", background: "#fff" },
919
- children: [
920
- /* @__PURE__ */ jsx(Checkboard, {}),
921
- /* @__PURE__ */ jsx(
922
- ColorBox,
923
- {
924
- style: {
925
- backgroundColor: `rgba(${rgb?.r},${rgb?.g},${rgb?.b},${rgb?.a})`
926
- }
927
- }
928
- ),
929
- readOnly && /* @__PURE__ */ jsx(
930
- ReadOnlyContainer,
931
- {
932
- padding: 2,
933
- paddingBottom: 1,
934
- sizing: "border",
935
- justify: "space-between",
936
- children: /* @__PURE__ */ jsxs(Stack, { space: 3, marginTop: 1, children: [
937
- /* @__PURE__ */ jsx(Text, { size: 3, weight: "bold", children: hex }),
938
- /* @__PURE__ */ jsxs(Inline, { space: 3, children: [
939
- /* @__PURE__ */ jsxs(Text, { size: 1, children: [
940
- /* @__PURE__ */ jsx("strong", { children: "RGB: " }),
941
- rgb?.r,
942
- " ",
943
- rgb?.g,
944
- " ",
945
- rgb?.b
946
- ] }),
947
- /* @__PURE__ */ jsxs(Text, { size: 1, children: [
948
- /* @__PURE__ */ jsx("strong", { children: "HSL: " }),
949
- " ",
950
- Math.round(hsl?.h ?? 0),
951
- " ",
952
- Math.round((hsl?.s ?? 0) * 100),
953
- "% ",
954
- Math.round((hsl?.l ?? 0) * 100),
955
- "%"
956
- ] })
957
- ] })
958
- ] })
959
- }
960
- )
961
- ]
962
- }
963
- ),
964
- !readOnly && /* @__PURE__ */ jsxs(Flex, { align: "flex-start", marginLeft: 2, children: [
965
- /* @__PURE__ */ jsx(Box, { style: { width: 200 }, children: /* @__PURE__ */ jsx(
966
- ColorPickerFields,
967
- {
968
- rgb,
969
- hsl,
970
- hex,
971
- onChange,
972
- disableAlpha
973
- }
974
- ) }),
975
- /* @__PURE__ */ jsx(Box, { marginLeft: 2, children: /* @__PURE__ */ jsx(Button, { onClick: onUnset, title: "Delete color", icon: TrashIcon, tone: "critical" }) })
976
- ] })
977
- ] }),
978
- colorList && /* @__PURE__ */ jsx(ColorList, { colors: colorList, onChange })
979
- ] }) }) });
980
- }, ColorPicker = CustomPicker(ColorPickerInner), ColorInput = lazy(() => import("./ColorInput.esm.js")), round = (val = 1) => Math.round(val * 100), colorTypeName = "color", color = defineType({
981
- name: colorTypeName,
982
- type: "object",
983
- title: "Color",
984
- components: { input: ColorInput },
985
- fields: [
986
- {
987
- title: "Hex",
988
- name: "hex",
989
- type: "string"
990
- },
991
- {
992
- title: "Alpha",
993
- name: "alpha",
994
- type: "number"
995
- },
996
- {
997
- title: "Hue Saturation Lightness",
998
- name: "hsl",
999
- type: "hslaColor"
1000
- },
1001
- {
1002
- title: "Hue Saturation Value",
1003
- name: "hsv",
1004
- type: "hsvaColor"
1005
- },
1006
- {
1007
- title: "Red Green Blue (rgb)",
1008
- name: "rgb",
1009
- type: "rgbaColor"
1010
- }
1011
- ],
1012
- preview: {
1013
- select: {
1014
- title: "hex",
1015
- alpha: "alpha",
1016
- hex: "hex",
1017
- hsl: "hsl"
1018
- },
1019
- prepare({
1020
- title,
1021
- hex,
1022
- hsl,
1023
- alpha
1024
- }) {
1025
- let subtitle = hex || "No color set";
1026
- return hsl && (subtitle = `H:${round(hsl.h)} S:${round(hsl.s)} L:${round(hsl.l)} A:${round(alpha)}`), {
1027
- title,
1028
- subtitle,
1029
- media: () => /* @__PURE__ */ jsx(
1030
- "div",
1031
- {
1032
- style: {
1033
- backgroundColor: hex ?? "#000",
1034
- opacity: alpha ?? 1,
1035
- position: "absolute",
1036
- height: "100%",
1037
- width: "100%",
1038
- top: "0",
1039
- left: "0"
1040
- }
1041
- }
1042
- )
1043
- };
1044
- }
1045
- }
1046
- }), hslaColor = defineType({
1047
- title: "Hue Saturation Lightness",
1048
- name: "hslaColor",
1049
- type: "object",
1050
- fields: [
1051
- { name: "h", type: "number", title: "Hue" },
1052
- { name: "s", type: "number", title: "Saturation" },
1053
- { name: "l", type: "number", title: "Lightness" },
1054
- { name: "a", type: "number", title: "Alpha" }
1055
- ]
1056
- }), hsvaColor = defineType({
1057
- title: "Hue Saturation Value",
1058
- name: "hsvaColor",
1059
- type: "object",
1060
- fields: [
1061
- { name: "h", type: "number", title: "Hue" },
1062
- { name: "s", type: "number", title: "Saturation" },
1063
- { name: "v", type: "number", title: "Value" },
1064
- { name: "a", type: "number", title: "Alpha" }
1065
- ]
1066
- }), rgbaColor = defineType({
1067
- title: "Red Green Blue (rgb)",
1068
- name: "rgbaColor",
1069
- type: "object",
1070
- fields: [
1071
- { name: "r", type: "number", title: "Red" },
1072
- { name: "g", type: "number", title: "Green" },
1073
- { name: "b", type: "number", title: "Blue" },
1074
- { name: "a", type: "number", title: "Alpha" }
1075
- ]
1076
- }), colorInput = definePlugin({
1077
- name: "@sanity/color-input",
1078
- schema: {
1079
- types: [hslaColor, hsvaColor, rgbaColor, color]
1080
- }
1081
- });
1082
- export {
1083
- ColorInput,
1084
- ColorPicker,
1085
- color,
1086
- colorInput,
1087
- hslaColor,
1088
- hsvaColor,
1089
- rgbaColor
1090
- };
1091
- //# sourceMappingURL=index.esm.js.map