@sanity/color-input 3.0.0-studio-v3.0 → 3.0.0-v3-studio.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/lib/{index.js → cjs/index.js} +76 -76
- package/lib/{index.js.map → cjs/index.js.map} +1 -1
- package/lib/{index.modern.js → esm/index.js} +77 -77
- package/lib/{index.modern.js.map → esm/index.js.map} +1 -1
- package/lib/{index.d.ts → types/index.d.ts} +1 -2
- package/lib/types/index.d.ts.map +1 -0
- package/package.json +19 -14
- package/sanity.json +8 -0
- package/src/ColorInput.tsx +1 -1
- package/v2-incompatible.js +11 -0
- package/lib/index.d.ts.map +0 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {createPlugin as $
|
|
2
|
-
import {jsx as $
|
|
3
|
-
import {useRef as $
|
|
4
|
-
import {set as $
|
|
5
|
-
import {debounce as $
|
|
6
|
-
import {Button as $
|
|
7
|
-
import {AddIcon as $
|
|
8
|
-
import {Saturation as $
|
|
9
|
-
import {CustomPicker as $
|
|
10
|
-
import $
|
|
11
|
-
import {isValidHex as $
|
|
1
|
+
import {createPlugin as $gGrEF$createPlugin} from "sanity";
|
|
2
|
+
import {jsx as $gGrEF$jsx, Fragment as $gGrEF$Fragment, jsxs as $gGrEF$jsxs} from "react/jsx-runtime";
|
|
3
|
+
import {useRef as $gGrEF$useRef, useState as $gGrEF$useState, useEffect as $gGrEF$useEffect, useCallback as $gGrEF$useCallback, useMemo as $gGrEF$useMemo} from "react";
|
|
4
|
+
import {set as $gGrEF$set, setIfMissing as $gGrEF$setIfMissing, unset as $gGrEF$unset} from "sanity/form";
|
|
5
|
+
import {debounce as $gGrEF$debounce} from "lodash";
|
|
6
|
+
import {Button as $gGrEF$Button, Box as $gGrEF$Box, Flex as $gGrEF$Flex, Card as $gGrEF$Card, Stack as $gGrEF$Stack, Text as $gGrEF$Text, Inline as $gGrEF$Inline, useTheme as $gGrEF$useTheme} from "@sanity/ui";
|
|
7
|
+
import {AddIcon as $gGrEF$AddIcon, TrashIcon as $gGrEF$TrashIcon} from "@sanity/icons";
|
|
8
|
+
import {Saturation as $gGrEF$Saturation, Hue as $gGrEF$Hue, Alpha as $gGrEF$Alpha, Checkboard as $gGrEF$Checkboard, EditableInput as $gGrEF$EditableInput} from "react-color/lib/components/common";
|
|
9
|
+
import {CustomPicker as $gGrEF$CustomPicker} from "react-color";
|
|
10
|
+
import $gGrEF$styledcomponents from "styled-components";
|
|
11
|
+
import {isValidHex as $gGrEF$isValidHex} from "react-color/lib/helpers/color";
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
const $88b170db27d5e6f3$export$4e4b8c12b77623c0 = {
|
|
@@ -90,8 +90,8 @@ const $37ec22070cd01c8b$export$cc215b4b2c268dfd = {
|
|
|
90
90
|
|
|
91
91
|
|
|
92
92
|
const $69987db005d80051$export$5367735792921e7d = ({ onChange: onChange , rgb: rgb , hsl: hsl , hex: hex , disableAlpha: disableAlpha })=>{
|
|
93
|
-
const { sanity: sanity } = (0, $
|
|
94
|
-
const inputStyles = (0, $
|
|
93
|
+
const { sanity: sanity } = (0, $gGrEF$useTheme)();
|
|
94
|
+
const inputStyles = (0, $gGrEF$useMemo)(()=>({
|
|
95
95
|
input: {
|
|
96
96
|
width: "80%",
|
|
97
97
|
padding: "4px 10% 3px",
|
|
@@ -114,8 +114,8 @@ const $69987db005d80051$export$5367735792921e7d = ({ onChange: onChange , rgb: r
|
|
|
114
114
|
}), [
|
|
115
115
|
sanity
|
|
116
116
|
]);
|
|
117
|
-
const handleChange = (0, $
|
|
118
|
-
if ("hex" in data && data.hex && (0, $
|
|
117
|
+
const handleChange = (0, $gGrEF$useCallback)((data)=>{
|
|
118
|
+
if ("hex" in data && data.hex && (0, $gGrEF$isValidHex)(data.hex)) onChange({
|
|
119
119
|
hex: data.hex,
|
|
120
120
|
source: "hex"
|
|
121
121
|
});
|
|
@@ -144,22 +144,22 @@ const $69987db005d80051$export$5367735792921e7d = ({ onChange: onChange , rgb: r
|
|
|
144
144
|
hsl,
|
|
145
145
|
rgb
|
|
146
146
|
]);
|
|
147
|
-
return /*#__PURE__*/ (0, $
|
|
147
|
+
return /*#__PURE__*/ (0, $gGrEF$jsxs)((0, $gGrEF$Flex), {
|
|
148
148
|
children: [
|
|
149
|
-
/*#__PURE__*/ (0, $
|
|
149
|
+
/*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$Box), {
|
|
150
150
|
flex: 2,
|
|
151
151
|
marginRight: 1,
|
|
152
|
-
children: /*#__PURE__*/ (0, $
|
|
152
|
+
children: /*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$EditableInput), {
|
|
153
153
|
style: inputStyles,
|
|
154
154
|
label: "hex",
|
|
155
155
|
value: hex?.replace("#", ""),
|
|
156
156
|
onChange: handleChange
|
|
157
157
|
})
|
|
158
158
|
}),
|
|
159
|
-
/*#__PURE__*/ (0, $
|
|
159
|
+
/*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$Box), {
|
|
160
160
|
flex: 1,
|
|
161
161
|
marginRight: 1,
|
|
162
|
-
children: /*#__PURE__*/ (0, $
|
|
162
|
+
children: /*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$EditableInput), {
|
|
163
163
|
style: inputStyles,
|
|
164
164
|
label: "r",
|
|
165
165
|
value: rgb?.r,
|
|
@@ -168,10 +168,10 @@ const $69987db005d80051$export$5367735792921e7d = ({ onChange: onChange , rgb: r
|
|
|
168
168
|
dragMax: 255
|
|
169
169
|
})
|
|
170
170
|
}),
|
|
171
|
-
/*#__PURE__*/ (0, $
|
|
171
|
+
/*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$Box), {
|
|
172
172
|
flex: 1,
|
|
173
173
|
marginRight: 1,
|
|
174
|
-
children: /*#__PURE__*/ (0, $
|
|
174
|
+
children: /*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$EditableInput), {
|
|
175
175
|
style: inputStyles,
|
|
176
176
|
label: "g",
|
|
177
177
|
value: rgb?.g,
|
|
@@ -180,10 +180,10 @@ const $69987db005d80051$export$5367735792921e7d = ({ onChange: onChange , rgb: r
|
|
|
180
180
|
dragMax: 255
|
|
181
181
|
})
|
|
182
182
|
}),
|
|
183
|
-
/*#__PURE__*/ (0, $
|
|
183
|
+
/*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$Box), {
|
|
184
184
|
flex: 1,
|
|
185
185
|
marginRight: 1,
|
|
186
|
-
children: /*#__PURE__*/ (0, $
|
|
186
|
+
children: /*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$EditableInput), {
|
|
187
187
|
style: inputStyles,
|
|
188
188
|
label: "b",
|
|
189
189
|
value: rgb?.b,
|
|
@@ -192,9 +192,9 @@ const $69987db005d80051$export$5367735792921e7d = ({ onChange: onChange , rgb: r
|
|
|
192
192
|
dragMax: 255
|
|
193
193
|
})
|
|
194
194
|
}),
|
|
195
|
-
!disableAlpha && /*#__PURE__*/ (0, $
|
|
195
|
+
!disableAlpha && /*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$Box), {
|
|
196
196
|
flex: 1,
|
|
197
|
-
children: /*#__PURE__*/ (0, $
|
|
197
|
+
children: /*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$EditableInput), {
|
|
198
198
|
style: inputStyles,
|
|
199
199
|
label: "a",
|
|
200
200
|
value: Math.round((rgb?.a ?? 1) * 100),
|
|
@@ -208,14 +208,14 @@ const $69987db005d80051$export$5367735792921e7d = ({ onChange: onChange , rgb: r
|
|
|
208
208
|
};
|
|
209
209
|
|
|
210
210
|
|
|
211
|
-
const $167ca0588b34aece$var$ColorBox = (0, $
|
|
211
|
+
const $167ca0588b34aece$var$ColorBox = (0, $gGrEF$styledcomponents)((0, $gGrEF$Box))`
|
|
212
212
|
position: absolute;
|
|
213
213
|
top: 0;
|
|
214
214
|
left: 0;
|
|
215
215
|
width: 100%;
|
|
216
216
|
height: 100%;
|
|
217
217
|
`;
|
|
218
|
-
const $167ca0588b34aece$var$ReadOnlyContainer = (0, $
|
|
218
|
+
const $167ca0588b34aece$var$ReadOnlyContainer = (0, $gGrEF$styledcomponents)((0, $gGrEF$Flex))`
|
|
219
219
|
margin-top: 6rem;
|
|
220
220
|
background-color: var(--card-bg-color);
|
|
221
221
|
position: relative;
|
|
@@ -223,32 +223,32 @@ const $167ca0588b34aece$var$ReadOnlyContainer = (0, $jPEKE$styledcomponents)((0,
|
|
|
223
223
|
`;
|
|
224
224
|
const $167ca0588b34aece$var$ColorPickerInner = (props)=>{
|
|
225
225
|
const { width: width , color: { rgb: rgb , hex: hex , hsv: hsv , hsl: hsl } , onChange: onChange , onUnset: onUnset , disableAlpha: disableAlpha , readOnly: readOnly , } = props;
|
|
226
|
-
return /*#__PURE__*/ (0, $
|
|
226
|
+
return /*#__PURE__*/ (0, $gGrEF$jsx)("div", {
|
|
227
227
|
style: {
|
|
228
228
|
width: width
|
|
229
229
|
},
|
|
230
|
-
children: /*#__PURE__*/ (0, $
|
|
230
|
+
children: /*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$Card), {
|
|
231
231
|
padding: 1,
|
|
232
232
|
border: true,
|
|
233
233
|
radius: 1,
|
|
234
|
-
children: /*#__PURE__*/ (0, $
|
|
234
|
+
children: /*#__PURE__*/ (0, $gGrEF$jsxs)((0, $gGrEF$Stack), {
|
|
235
235
|
space: 2,
|
|
236
236
|
children: [
|
|
237
|
-
!readOnly && /*#__PURE__*/ (0, $
|
|
237
|
+
!readOnly && /*#__PURE__*/ (0, $gGrEF$jsxs)((0, $gGrEF$Fragment), {
|
|
238
238
|
children: [
|
|
239
|
-
/*#__PURE__*/ (0, $
|
|
239
|
+
/*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$Card), {
|
|
240
240
|
overflow: "hidden",
|
|
241
241
|
style: {
|
|
242
242
|
position: "relative",
|
|
243
243
|
height: "5em"
|
|
244
244
|
},
|
|
245
|
-
children: /*#__PURE__*/ (0, $
|
|
245
|
+
children: /*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$Saturation), {
|
|
246
246
|
onChange: onChange,
|
|
247
247
|
hsl: hsl,
|
|
248
248
|
hsv: hsv
|
|
249
249
|
})
|
|
250
250
|
}),
|
|
251
|
-
/*#__PURE__*/ (0, $
|
|
251
|
+
/*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$Card), {
|
|
252
252
|
shadow: 1,
|
|
253
253
|
radius: 3,
|
|
254
254
|
overflow: "hidden",
|
|
@@ -256,12 +256,12 @@ const $167ca0588b34aece$var$ColorPickerInner = (props)=>{
|
|
|
256
256
|
position: "relative",
|
|
257
257
|
height: "10px"
|
|
258
258
|
},
|
|
259
|
-
children: /*#__PURE__*/ (0, $
|
|
259
|
+
children: /*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$Hue), {
|
|
260
260
|
hsl: hsl,
|
|
261
261
|
onChange: !readOnly && onChange
|
|
262
262
|
})
|
|
263
263
|
}),
|
|
264
|
-
!disableAlpha && /*#__PURE__*/ (0, $
|
|
264
|
+
!disableAlpha && /*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$Card), {
|
|
265
265
|
shadow: 1,
|
|
266
266
|
radius: 3,
|
|
267
267
|
overflow: "hidden",
|
|
@@ -269,7 +269,7 @@ const $167ca0588b34aece$var$ColorPickerInner = (props)=>{
|
|
|
269
269
|
position: "relative",
|
|
270
270
|
height: "10px"
|
|
271
271
|
},
|
|
272
|
-
children: /*#__PURE__*/ (0, $
|
|
272
|
+
children: /*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$Alpha), {
|
|
273
273
|
rgb: rgb,
|
|
274
274
|
hsl: hsl,
|
|
275
275
|
onChange: onChange
|
|
@@ -277,9 +277,9 @@ const $167ca0588b34aece$var$ColorPickerInner = (props)=>{
|
|
|
277
277
|
})
|
|
278
278
|
]
|
|
279
279
|
}),
|
|
280
|
-
/*#__PURE__*/ (0, $
|
|
280
|
+
/*#__PURE__*/ (0, $gGrEF$jsxs)((0, $gGrEF$Flex), {
|
|
281
281
|
children: [
|
|
282
|
-
/*#__PURE__*/ (0, $
|
|
282
|
+
/*#__PURE__*/ (0, $gGrEF$jsxs)((0, $gGrEF$Card), {
|
|
283
283
|
flex: 1,
|
|
284
284
|
radius: 2,
|
|
285
285
|
overflow: "hidden",
|
|
@@ -288,33 +288,33 @@ const $167ca0588b34aece$var$ColorPickerInner = (props)=>{
|
|
|
288
288
|
minWidth: "4em"
|
|
289
289
|
},
|
|
290
290
|
children: [
|
|
291
|
-
/*#__PURE__*/ (0, $
|
|
292
|
-
/*#__PURE__*/ (0, $
|
|
291
|
+
/*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$Checkboard), {}),
|
|
292
|
+
/*#__PURE__*/ (0, $gGrEF$jsx)($167ca0588b34aece$var$ColorBox, {
|
|
293
293
|
style: {
|
|
294
294
|
backgroundColor: `rgba(${rgb?.r},${rgb?.g},${rgb?.b},${rgb?.a})`
|
|
295
295
|
}
|
|
296
296
|
}),
|
|
297
|
-
readOnly && /*#__PURE__*/ (0, $
|
|
297
|
+
readOnly && /*#__PURE__*/ (0, $gGrEF$jsx)($167ca0588b34aece$var$ReadOnlyContainer, {
|
|
298
298
|
padding: 2,
|
|
299
299
|
paddingBottom: 1,
|
|
300
300
|
sizing: "border",
|
|
301
301
|
justify: "space-between",
|
|
302
|
-
children: /*#__PURE__*/ (0, $
|
|
302
|
+
children: /*#__PURE__*/ (0, $gGrEF$jsxs)((0, $gGrEF$Stack), {
|
|
303
303
|
space: 3,
|
|
304
304
|
marginTop: 1,
|
|
305
305
|
children: [
|
|
306
|
-
/*#__PURE__*/ (0, $
|
|
306
|
+
/*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$Text), {
|
|
307
307
|
size: 3,
|
|
308
308
|
weight: "bold",
|
|
309
309
|
children: hex
|
|
310
310
|
}),
|
|
311
|
-
/*#__PURE__*/ (0, $
|
|
311
|
+
/*#__PURE__*/ (0, $gGrEF$jsxs)((0, $gGrEF$Inline), {
|
|
312
312
|
space: 3,
|
|
313
313
|
children: [
|
|
314
|
-
/*#__PURE__*/ (0, $
|
|
314
|
+
/*#__PURE__*/ (0, $gGrEF$jsxs)((0, $gGrEF$Text), {
|
|
315
315
|
size: 1,
|
|
316
316
|
children: [
|
|
317
|
-
/*#__PURE__*/ (0, $
|
|
317
|
+
/*#__PURE__*/ (0, $gGrEF$jsx)("strong", {
|
|
318
318
|
children: "RGB: "
|
|
319
319
|
}),
|
|
320
320
|
rgb?.r,
|
|
@@ -324,10 +324,10 @@ const $167ca0588b34aece$var$ColorPickerInner = (props)=>{
|
|
|
324
324
|
rgb?.b
|
|
325
325
|
]
|
|
326
326
|
}),
|
|
327
|
-
/*#__PURE__*/ (0, $
|
|
327
|
+
/*#__PURE__*/ (0, $gGrEF$jsxs)((0, $gGrEF$Text), {
|
|
328
328
|
size: 1,
|
|
329
329
|
children: [
|
|
330
|
-
/*#__PURE__*/ (0, $
|
|
330
|
+
/*#__PURE__*/ (0, $gGrEF$jsx)("strong", {
|
|
331
331
|
children: "HSL: "
|
|
332
332
|
}),
|
|
333
333
|
" ",
|
|
@@ -346,15 +346,15 @@ const $167ca0588b34aece$var$ColorPickerInner = (props)=>{
|
|
|
346
346
|
})
|
|
347
347
|
]
|
|
348
348
|
}),
|
|
349
|
-
!readOnly && /*#__PURE__*/ (0, $
|
|
349
|
+
!readOnly && /*#__PURE__*/ (0, $gGrEF$jsxs)((0, $gGrEF$Flex), {
|
|
350
350
|
align: "flex-start",
|
|
351
351
|
marginLeft: 2,
|
|
352
352
|
children: [
|
|
353
|
-
/*#__PURE__*/ (0, $
|
|
353
|
+
/*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$Box), {
|
|
354
354
|
style: {
|
|
355
355
|
width: 200
|
|
356
356
|
},
|
|
357
|
-
children: /*#__PURE__*/ (0, $
|
|
357
|
+
children: /*#__PURE__*/ (0, $gGrEF$jsx)((0, $69987db005d80051$export$5367735792921e7d), {
|
|
358
358
|
rgb: rgb,
|
|
359
359
|
hsl: hsl,
|
|
360
360
|
hex: hex,
|
|
@@ -362,12 +362,12 @@ const $167ca0588b34aece$var$ColorPickerInner = (props)=>{
|
|
|
362
362
|
disableAlpha: disableAlpha
|
|
363
363
|
})
|
|
364
364
|
}),
|
|
365
|
-
/*#__PURE__*/ (0, $
|
|
365
|
+
/*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$Box), {
|
|
366
366
|
marginLeft: 2,
|
|
367
|
-
children: /*#__PURE__*/ (0, $
|
|
367
|
+
children: /*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$Button), {
|
|
368
368
|
onClick: onUnset,
|
|
369
369
|
title: "Delete color",
|
|
370
|
-
icon: (0, $
|
|
370
|
+
icon: (0, $gGrEF$TrashIcon),
|
|
371
371
|
tone: "critical"
|
|
372
372
|
})
|
|
373
373
|
})
|
|
@@ -380,7 +380,7 @@ const $167ca0588b34aece$var$ColorPickerInner = (props)=>{
|
|
|
380
380
|
})
|
|
381
381
|
});
|
|
382
382
|
};
|
|
383
|
-
const $167ca0588b34aece$export$9feb1bc2e5f1ccb3 = (0, $
|
|
383
|
+
const $167ca0588b34aece$export$9feb1bc2e5f1ccb3 = (0, $gGrEF$CustomPicker)($167ca0588b34aece$var$ColorPickerInner);
|
|
384
384
|
|
|
385
385
|
|
|
386
386
|
const $9a1b799aa4bfa9c5$var$DEFAULT_COLOR = {
|
|
@@ -407,30 +407,30 @@ const $9a1b799aa4bfa9c5$var$DEFAULT_COLOR = {
|
|
|
407
407
|
};
|
|
408
408
|
function $9a1b799aa4bfa9c5$export$5a1d7ca0a925d9c2(props) {
|
|
409
409
|
const { onChange: onChange , schemaType: type , readOnly: readOnly , value: value } = props;
|
|
410
|
-
const focusRef = (0, $
|
|
410
|
+
const focusRef = (0, $gGrEF$useRef)(null);
|
|
411
411
|
// use local state so we can have instant ui updates while debouncing patch emits
|
|
412
|
-
const [color, setColor] = (0, $
|
|
413
|
-
(0, $
|
|
412
|
+
const [color, setColor] = (0, $gGrEF$useState)(value);
|
|
413
|
+
(0, $gGrEF$useEffect)(()=>setColor(value), [
|
|
414
414
|
value
|
|
415
415
|
]);
|
|
416
|
-
const emitSetColor = (0, $
|
|
416
|
+
const emitSetColor = (0, $gGrEF$useCallback)((nextColor)=>{
|
|
417
417
|
const fieldPatches = type.fields.filter((field)=>field.name in nextColor).map((field)=>{
|
|
418
418
|
const nextFieldValue = nextColor[field.name];
|
|
419
419
|
const isObject = field.type.jsonType === "object";
|
|
420
|
-
return (0, $
|
|
420
|
+
return (0, $gGrEF$set)(isObject ? Object.assign({
|
|
421
421
|
_type: field.type.name
|
|
422
422
|
}, nextFieldValue) : nextFieldValue, [
|
|
423
423
|
field.name
|
|
424
424
|
]);
|
|
425
425
|
});
|
|
426
426
|
onChange([
|
|
427
|
-
(0, $
|
|
427
|
+
(0, $gGrEF$setIfMissing)({
|
|
428
428
|
_type: type.name
|
|
429
429
|
}),
|
|
430
|
-
(0, $
|
|
430
|
+
(0, $gGrEF$set)(type.name, [
|
|
431
431
|
"_type"
|
|
432
432
|
]),
|
|
433
|
-
(0, $
|
|
433
|
+
(0, $gGrEF$set)(nextColor.rgb?.a, [
|
|
434
434
|
"alpha"
|
|
435
435
|
]),
|
|
436
436
|
...fieldPatches,
|
|
@@ -441,37 +441,37 @@ function $9a1b799aa4bfa9c5$export$5a1d7ca0a925d9c2(props) {
|
|
|
441
441
|
]);
|
|
442
442
|
// The color picker emits onChange events continuously while the user is sliding the
|
|
443
443
|
// hue/saturation/alpha selectors. This debounces the event to avoid excessive patches
|
|
444
|
-
const debouncedColorChange = (0, $
|
|
444
|
+
const debouncedColorChange = (0, $gGrEF$useMemo)(()=>(0, $gGrEF$debounce)(emitSetColor, 100), [
|
|
445
445
|
emitSetColor
|
|
446
446
|
]);
|
|
447
|
-
const handleColorChange = (0, $
|
|
447
|
+
const handleColorChange = (0, $gGrEF$useCallback)((nextColor)=>{
|
|
448
448
|
setColor(nextColor);
|
|
449
449
|
debouncedColorChange(nextColor);
|
|
450
450
|
}, [
|
|
451
451
|
debouncedColorChange,
|
|
452
452
|
setColor
|
|
453
453
|
]);
|
|
454
|
-
const handleCreateColor = (0, $
|
|
454
|
+
const handleCreateColor = (0, $gGrEF$useCallback)(()=>{
|
|
455
455
|
setColor($9a1b799aa4bfa9c5$var$DEFAULT_COLOR);
|
|
456
456
|
emitSetColor($9a1b799aa4bfa9c5$var$DEFAULT_COLOR);
|
|
457
457
|
}, [
|
|
458
458
|
emitSetColor
|
|
459
459
|
]);
|
|
460
|
-
const handleUnset = (0, $
|
|
460
|
+
const handleUnset = (0, $gGrEF$useCallback)(()=>{
|
|
461
461
|
setColor(undefined);
|
|
462
|
-
onChange((0, $
|
|
462
|
+
onChange((0, $gGrEF$unset)());
|
|
463
463
|
}, [
|
|
464
464
|
onChange
|
|
465
465
|
]);
|
|
466
|
-
return /*#__PURE__*/ (0, $
|
|
467
|
-
children: value ? /*#__PURE__*/ (0, $
|
|
466
|
+
return /*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$Fragment), {
|
|
467
|
+
children: value ? /*#__PURE__*/ (0, $gGrEF$jsx)((0, $167ca0588b34aece$export$9feb1bc2e5f1ccb3), {
|
|
468
468
|
/* ref={this.focusRef}*/ color: color,
|
|
469
469
|
onChange: handleColorChange,
|
|
470
470
|
readOnly: readOnly || typeof type.readOnly === "boolean" && type.readOnly,
|
|
471
471
|
disableAlpha: type.options?.disableAlpha,
|
|
472
472
|
onUnset: handleUnset
|
|
473
|
-
}) : /*#__PURE__*/ (0, $
|
|
474
|
-
icon: (0, $
|
|
473
|
+
}) : /*#__PURE__*/ (0, $gGrEF$jsx)((0, $gGrEF$Button), {
|
|
474
|
+
icon: (0, $gGrEF$AddIcon),
|
|
475
475
|
mode: "ghost",
|
|
476
476
|
text: "Create color",
|
|
477
477
|
ref: focusRef,
|
|
@@ -530,7 +530,7 @@ const $771ddc1e2be43f68$export$35e9368ef982300f = {
|
|
|
530
530
|
return {
|
|
531
531
|
title: title,
|
|
532
532
|
subtitle: subtitle,
|
|
533
|
-
media: ()=>/*#__PURE__*/ (0, $
|
|
533
|
+
media: ()=>/*#__PURE__*/ (0, $gGrEF$jsx)("div", {
|
|
534
534
|
style: {
|
|
535
535
|
backgroundColor: hex ?? "#000",
|
|
536
536
|
opacity: alpha ?? 1,
|
|
@@ -577,7 +577,7 @@ const $b26c91ff9252c28d$export$633851ea6f85c81b = {
|
|
|
577
577
|
|
|
578
578
|
|
|
579
579
|
|
|
580
|
-
const $df9eabe9bda49ea8$export$1d1c20ca26e20eb8 = (0, $
|
|
580
|
+
const $df9eabe9bda49ea8$export$1d1c20ca26e20eb8 = (0, $gGrEF$createPlugin)({
|
|
581
581
|
name: "@sanity/color-input",
|
|
582
582
|
schema: {
|
|
583
583
|
types: [
|
|
@@ -591,4 +591,4 @@ const $df9eabe9bda49ea8$export$1d1c20ca26e20eb8 = (0, $jPEKE$createPlugin)({
|
|
|
591
591
|
|
|
592
592
|
|
|
593
593
|
export {$df9eabe9bda49ea8$export$1d1c20ca26e20eb8 as colorInput, $88b170db27d5e6f3$export$4e4b8c12b77623c0 as hslaColor, $37ec22070cd01c8b$export$cc215b4b2c268dfd as rgbaColor, $771ddc1e2be43f68$export$35e9368ef982300f as color, $b26c91ff9252c28d$export$633851ea6f85c81b as hsvaColor, $9a1b799aa4bfa9c5$export$5a1d7ca0a925d9c2 as ColorInput};
|
|
594
|
-
//# sourceMappingURL=index.
|
|
594
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;AAAA;ACAO,MAAM,yCAAS,GAAG;IACvB,KAAK,EAAE,0BAA0B;IACjC,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE;QACN;YAAC,IAAI,EAAE,GAAG;YAAE,IAAI,EAAE,QAAQ;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ACF,CAAA;SACF;KACF;CACF;;;AI9EM,MAAM,yCAAS,GAAG;IACvB,KAAK,EAAE,sBAAsB;IAC7B,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE;QACN;YAAC,IAAI,EAAE,GAAG;YAAE,IAAI,EAAE,QAAQ;YAAE,KAAK,EAAE,KAAK;SAAC;QACzC;YAAC,IAAI,EAAE,GAAG;YAAE,IAAI,EAAE,QAAQ;YAAE,KAAK,EAAE,YAAY;SAAC;QAChD;YAAC,IAAI,EAAE,GAAG;YAAE,IAAI,EAAE,QAAQ;YAAE,KAAK,EAAE,OAAO;SAAC;QAC3C;YAAC,IAAI,EAAE,GAAG;YAAE,IAAI,EAAE,QAAQ;YAAE,KAAK,EAAE,OAAO;SAAC;KAC5C;CACF;;;;APJM,MAAM,yCAAU,GAAG,CAAA,GAAA,mBAAY,CAAA,CAAC;IACrC,IAAI,EAAE,qBAAqB;IAC3B,MAAM,EAAE;QACN,KAAK,EAAE;YAAC,CAAA,GAAA,yCAAS,CAAA;YAAE,CAAA,GAAA,yCAAS,CAAA;YAAE,CAAA,GAAA,yCAAS,CAAA;YAAE,CAAA,GAAA,yCAAK,CAAA;SAAC;KAChD;CACF,CAAC","sources":["src/index.ts","src/schemas/hslaColor.ts","src/schemas/rgbaColor.ts","src/schemas/color.tsx","src/ColorInput.tsx","src/ColorPicker.tsx","src/ColorPickerFields.tsx","src/schemas/hsvaColor.ts"],"sourcesContent":["import {createPlugin} from 'sanity'\nimport {hslaColor} from './schemas/hslaColor'\nimport {rgbaColor} from './schemas/rgbaColor'\nimport {color} from './schemas/color'\nimport {hsvaColor} from './schemas/hsvaColor'\n\nexport const colorInput = createPlugin({\n name: '@sanity/color-input',\n schema: {\n types: [hslaColor, hsvaColor, rgbaColor, color],\n },\n})\n\nexport {hslaColor, rgbaColor, color, hsvaColor}\nexport {ColorInput} from './ColorInput'\nexport type {ColorValue, ColorInputProps, ColorOptions, ColorSchemaType} from './ColorInput'\n","export const hslaColor = {\n title: 'Hue Saturation Lightness',\n name: 'hslaColor',\n type: 'object',\n fields: [\n {name: 'h', type: 'number', title: 'Hue'},\n {name: 's', type: 'number', title: 'Saturation'},\n {name: 'l', type: 'number', title: 'Lightness'},\n {name: 'a', type: 'number', title: 'Alpha'},\n ],\n}\n","export const rgbaColor = {\n title: 'Red Green Blue (rgb)',\n name: 'rgbaColor',\n type: 'object',\n fields: [\n {name: 'r', type: 'number', title: 'Red'},\n {name: 'g', type: 'number', title: 'Green'},\n {name: 'b', type: 'number', title: 'Blue'},\n {name: 'a', type: 'number', title: 'Alpha'},\n ],\n}\n","import React from 'react'\nimport {ColorInput} from '../ColorInput'\n\nconst round = (val: number = 1) => Math.round(val * 100)\n\nexport const color = {\n name: 'color',\n type: 'object',\n title: 'Color',\n components: {input: ColorInput},\n fields: [\n {\n title: 'Hex',\n name: 'hex',\n type: 'string',\n },\n {\n title: 'Alpha',\n name: 'alpha',\n type: 'number',\n },\n {\n title: 'Hue Saturation Lightness',\n name: 'hsl',\n type: 'hslaColor',\n },\n {\n title: 'Hue Saturation Value',\n name: 'hsv',\n type: 'hsvaColor',\n },\n {\n title: 'Red Green Blue (rgb)',\n name: 'rgb',\n type: 'rgbaColor',\n },\n ],\n preview: {\n select: {\n title: 'hex',\n alpha: 'alpha',\n hex: 'hex',\n hsl: 'hsl',\n },\n prepare({\n title,\n hex,\n hsl,\n alpha,\n }: {\n title?: string\n alpha?: number\n hex?: string\n hsl?: {h: number; s: number; l: number}\n }) {\n let subtitle = hex || 'No color set'\n if (hsl) {\n subtitle = `H:${round(hsl.h)} S:${round(hsl.s)} L:${round(hsl.l)} A:${round(alpha)}`\n }\n return {\n title: title,\n subtitle: subtitle,\n media: () => (\n <div\n style={{\n backgroundColor: hex ?? '#000',\n opacity: alpha ?? 1,\n position: 'absolute',\n height: '100%',\n width: '100%',\n top: '0',\n left: '0',\n }}\n />\n ),\n }\n },\n },\n}\n","import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'\nimport {set, setIfMissing, unset} from 'sanity/form'\nimport {debounce} from 'lodash'\nimport {Button} from '@sanity/ui'\nimport {AddIcon} from '@sanity/icons'\nimport {ColorPicker} from './ColorPicker'\nimport {ObjectInputProps} from 'sanity'\nimport {HSLColor, HSVColor, RGBColor} from 'react-color'\nimport {ObjectSchemaType} from '@sanity/types'\n\nconst DEFAULT_COLOR: ColorValue & {source: string} = {\n hex: '#24a3e3',\n hsl: {h: 200, s: 0.7732, l: 0.5156, a: 1},\n hsv: {h: 200, s: 0.8414, v: 0.8901, a: 1},\n rgb: {r: 46, g: 163, b: 227, a: 1},\n source: 'hex',\n}\n\nexport interface ColorValue {\n hex: string\n hsl: HSLColor\n hsv: HSVColor\n rgb: RGBColor\n}\n\nexport interface ColorOptions {\n disableAlpha?: boolean\n}\n\nexport type ColorSchemaType = ObjectSchemaType & {\n options?: ColorOptions\n}\nexport type ColorInputProps = ObjectInputProps<ColorValue, ColorSchemaType>\n\nexport function ColorInput(props: ColorInputProps) {\n const {onChange, schemaType: type, readOnly, value} = props\n const focusRef = useRef<HTMLButtonElement>(null)\n\n // use local state so we can have instant ui updates while debouncing patch emits\n const [color, setColor] = useState(value)\n useEffect(() => setColor(value), [value])\n\n const emitSetColor = useCallback(\n (nextColor: ColorValue) => {\n const fieldPatches = type.fields\n .filter((field) => field.name in nextColor)\n .map((field) => {\n const nextFieldValue = nextColor[field.name as keyof ColorValue]\n const isObject = field.type.jsonType === 'object'\n return set(\n isObject ? Object.assign({_type: field.type.name}, nextFieldValue) : nextFieldValue,\n [field.name]\n )\n })\n\n onChange([\n setIfMissing({_type: type.name}),\n set(type.name, ['_type']),\n set(nextColor.rgb?.a, ['alpha']),\n ...fieldPatches,\n ])\n },\n [onChange, type]\n )\n\n // The color picker emits onChange events continuously while the user is sliding the\n // hue/saturation/alpha selectors. This debounces the event to avoid excessive patches\n const debouncedColorChange = useMemo(() => debounce(emitSetColor, 100), [emitSetColor])\n const handleColorChange = useCallback(\n (nextColor: ColorValue) => {\n setColor(nextColor)\n debouncedColorChange(nextColor)\n },\n [debouncedColorChange, setColor]\n )\n\n const handleCreateColor = useCallback(() => {\n setColor(DEFAULT_COLOR)\n emitSetColor(DEFAULT_COLOR)\n }, [emitSetColor])\n\n const handleUnset = useCallback(() => {\n setColor(undefined)\n onChange(unset())\n }, [onChange])\n\n return (\n <>\n {value ? (\n <ColorPicker\n /* ref={this.focusRef}*/\n color={color}\n onChange={handleColorChange}\n readOnly={readOnly || (typeof type.readOnly === 'boolean' && type.readOnly)}\n disableAlpha={type.options?.disableAlpha}\n onUnset={handleUnset}\n />\n ) : (\n <Button\n icon={AddIcon}\n mode=\"ghost\"\n text=\"Create color\"\n ref={focusRef}\n disabled={Boolean(readOnly)}\n onClick={handleCreateColor}\n />\n )}\n </>\n )\n}\n","import React from 'react'\nimport {Alpha, Checkboard, Hue, Saturation} from 'react-color/lib/components/common'\nimport {CustomPicker, HEXColor, HSLColor, HSVColor, RGBColor} from 'react-color'\nimport {Box, Button, Card, Flex, Inline, Stack, Text} from '@sanity/ui'\nimport {TrashIcon} from '@sanity/icons'\nimport styled from 'styled-components'\nimport {ColorPickerFields} from './ColorPickerFields'\nimport {CustomPickerInjectedProps} from 'react-color/lib/components/common/ColorWrap'\nimport {ColorValue} from './ColorInput'\n\nconst ColorBox = styled(Box)`\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n`\n\nconst ReadOnlyContainer = styled(Flex)`\n margin-top: 6rem;\n background-color: var(--card-bg-color);\n position: relative;\n width: 100%;\n`\n\nexport interface ColorPickerProps\n extends CustomPickerInjectedProps<HSLColor | HSVColor | RGBColor | HEXColor> {\n width?: string\n disableAlpha: boolean\n readOnly?: boolean\n onUnset: () => void\n color: ColorValue\n}\n\nconst ColorPickerInner = (props: ColorPickerProps) => {\n const {\n width,\n color: {rgb, hex, hsv, hsl},\n onChange,\n onUnset,\n disableAlpha,\n readOnly,\n } = props\n return (\n <div style={{width}}>\n <Card padding={1} border radius={1}>\n <Stack space={2}>\n {!readOnly && (\n <>\n <Card overflow=\"hidden\" style={{position: 'relative', height: '5em'}}>\n <Saturation onChange={onChange} hsl={hsl} hsv={hsv} />\n </Card>\n\n <Card\n shadow={1}\n radius={3}\n overflow=\"hidden\"\n style={{position: 'relative', height: '10px'}}\n >\n <Hue hsl={hsl} onChange={!readOnly && onChange} />\n </Card>\n\n {!disableAlpha && (\n <Card\n shadow={1}\n radius={3}\n overflow=\"hidden\"\n style={{position: 'relative', height: '10px'}}\n >\n <Alpha rgb={rgb} hsl={hsl} onChange={onChange} />\n </Card>\n )}\n </>\n )}\n <Flex>\n <Card\n flex={1}\n radius={2}\n overflow=\"hidden\"\n style={{position: 'relative', minWidth: '4em'}}\n >\n <Checkboard />\n <ColorBox\n style={{\n backgroundColor: `rgba(${rgb?.r},${rgb?.g},${rgb?.b},${rgb?.a})`,\n }}\n />\n\n {readOnly && (\n <ReadOnlyContainer\n padding={2}\n paddingBottom={1}\n sizing=\"border\"\n justify=\"space-between\"\n >\n <Stack space={3} marginTop={1}>\n <Text size={3} weight=\"bold\">\n {hex}\n </Text>\n\n <Inline space={3}>\n <Text size={1}>\n <strong>RGB: </strong>\n {rgb?.r} {rgb?.g} {rgb?.b}\n </Text>\n <Text size={1}>\n <strong>HSL: </strong> {Math.round(hsl?.h ?? 0)} {Math.round(hsl?.s ?? 0)}%{' '}\n {Math.round(hsl?.l ?? 0)}\n </Text>\n </Inline>\n </Stack>\n </ReadOnlyContainer>\n )}\n </Card>\n\n {!readOnly && (\n <Flex align=\"flex-start\" marginLeft={2}>\n <Box style={{width: 200}}>\n <ColorPickerFields\n rgb={rgb}\n hsl={hsl}\n hex={hex}\n onChange={onChange}\n disableAlpha={disableAlpha}\n />\n </Box>\n <Box marginLeft={2}>\n <Button onClick={onUnset} title=\"Delete color\" icon={TrashIcon} tone=\"critical\" />\n </Box>\n </Flex>\n )}\n </Flex>\n </Stack>\n </Card>\n </div>\n )\n}\n\nexport const ColorPicker = CustomPicker(ColorPickerInner)\n","import React, {useCallback, useMemo} from 'react'\n// @ts-expect-error missing export\nimport {isValidHex} from 'react-color/lib/helpers/color'\nimport {EditableInput} from 'react-color/lib/components/common'\nimport {Box, Flex, useTheme} from '@sanity/ui'\nimport {ColorChangeHandler, HEXColor, HSLColor, HSVColor, RGBColor} from 'react-color'\nimport {EditableInputStyles} from 'react-color/lib/components/common/EditableInput'\n\ninterface ColorPickerFieldsProps {\n rgb?: RGBColor\n hsl?: HSLColor\n hex?: string\n disableAlpha: boolean\n onChange: ColorChangeHandler<HSLColor | HSVColor | RGBColor | HEXColor>\n}\n\nexport const ColorPickerFields = ({\n onChange,\n rgb,\n hsl,\n hex,\n disableAlpha,\n}: ColorPickerFieldsProps) => {\n const {sanity} = useTheme()\n\n const inputStyles: EditableInputStyles = useMemo(\n () => ({\n input: {\n width: '80%',\n padding: '4px 10% 3px',\n border: 'none',\n boxShadow: `inset 0 0 0 1px ${sanity.color.input.default.enabled.border}`,\n color: sanity.color.input.default.enabled.fg,\n backgroundColor: sanity.color.input.default.enabled.bg,\n fontSize: sanity.fonts.text.sizes[0].fontSize,\n textAlign: 'center',\n },\n label: {\n display: 'block',\n textAlign: 'center',\n fontSize: sanity.fonts.label.sizes[0].fontSize,\n color: sanity.color.base.fg,\n paddingTop: '3px',\n paddingBottom: '4px',\n textTransform: 'capitalize',\n },\n }),\n [sanity]\n )\n\n const handleChange: ColorChangeHandler<Record<string, string>> = useCallback(\n (data) => {\n if ('hex' in data && data.hex && isValidHex(data.hex)) {\n onChange({\n hex: data.hex,\n source: 'hex',\n })\n } else if (\n rgb &&\n (('r' in data && data.r) || ('g' in data && data.g) || ('b' in data && data.b))\n ) {\n onChange({\n r: Number(data.r) || rgb.r,\n g: Number(data.g) || rgb.g,\n b: Number(data.b) || rgb.b,\n a: rgb.a,\n source: 'rgb',\n })\n } else if (hsl && 'a' in data && data.a) {\n let alpha = Number(data.a)\n if (alpha < 0) {\n alpha = 0\n } else if (alpha > 100) {\n alpha = 100\n }\n alpha /= 100\n\n onChange({\n h: hsl.h,\n s: hsl.s,\n l: hsl.l,\n a: alpha,\n source: 'hsl',\n })\n }\n },\n [onChange, hsl, rgb]\n )\n\n return (\n <Flex>\n <Box flex={2} marginRight={1}>\n <EditableInput\n style={inputStyles}\n label=\"hex\"\n value={hex?.replace('#', '')}\n onChange={handleChange}\n />\n </Box>\n <Box flex={1} marginRight={1}>\n <EditableInput\n style={inputStyles}\n label=\"r\"\n value={rgb?.r}\n onChange={handleChange}\n dragLabel\n dragMax={255}\n />\n </Box>\n <Box flex={1} marginRight={1}>\n <EditableInput\n style={inputStyles}\n label=\"g\"\n value={rgb?.g}\n onChange={handleChange}\n dragLabel\n dragMax={255}\n />\n </Box>\n <Box flex={1} marginRight={1}>\n <EditableInput\n style={inputStyles}\n label=\"b\"\n value={rgb?.b}\n onChange={handleChange}\n dragLabel\n dragMax={255}\n />\n </Box>\n {!disableAlpha && (\n <Box flex={1}>\n <EditableInput\n style={inputStyles}\n label=\"a\"\n value={Math.round((rgb?.a ?? 1) * 100)}\n onChange={handleChange}\n dragLabel\n dragMax={100}\n />\n </Box>\n )}\n </Flex>\n )\n}\n","export const hsvaColor = {\n title: 'Hue Saturation Value',\n name: 'hsvaColor',\n type: 'object',\n fields: [\n {name: 'h', type: 'number', title: 'Hue'},\n {name: 's', type: 'number', title: 'Saturation'},\n {name: 'v', type: 'number', title: 'Value'},\n {name: 'a', type: 'number', title: 'Alpha'},\n ],\n}\n"],"names":[],"version":3,"file":"index.modern.js.map","sourceRoot":"../"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;AAAA;ACAO,MAAM,yCAAS,GAAG;IACvB,KAAK,EAAE,0BAA0B;IACjC,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE;QACN;YAAC,IAAI,EAAE,GAAG;YAAE,IAAI,EAAE,QAAQ;YAAE,KAAK,EAAE,KAAK;SAAC;QACzC;YAAC,IAAI,EAAE,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ACvB,KAAK,EAAE,sBAAsB;IAC7B,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE;QACN;YAAC,IAAI,EAAE,GAAG;YAAE,IAAI,EAAE,QAAQ;YAAE,KAAK,EAAE,KAAK;SAAC;QACzC;YAAC,IAAI,EAAE,GAAG;YAAE,IAAI,EAAE,QAAQ;YAAE,KAAK,EAAE,YAAY;SAAC;QAChD;YAAC,IAAI,EAAE,GAAG;YAAE,IAAI,EAAE,QAAQ;YAAE,KAAK,EAAE,OAAO;SAAC;QAC3C;YAAC,IAAI,EAAE,GAAG;YAAE,IAAI,EAAE,QAAQ;YAAE,KAAK,EAAE,OAAO;SAAC;KAC5C;CACF;;;;APJM,MAAM,yCAAU,GAAG,CAAA,GAAA,mBAAY,CAAA,CAAC;IACrC,IAAI,EAAE,qBAAqB;IAC3B,MAAM,EAAE;QACN,KAAK,EAAE;YAAC,CAAA,GAAA,yCAAS,CAAA;YAAE,CAAA,GAAA,yCAAS,CAAA;YAAE,CAAA,GAAA,yCAAS,CAAA;YAAE,CAAA,GAAA,yCAAK,CAAA;SAAC;KAChD;CACF,CAAC","sources":["src/index.ts","src/schemas/hslaColor.ts","src/schemas/rgbaColor.ts","src/schemas/color.tsx","src/ColorInput.tsx","src/ColorPicker.tsx","src/ColorPickerFields.tsx","src/schemas/hsvaColor.ts"],"sourcesContent":["import {createPlugin} from 'sanity'\nimport {hslaColor} from './schemas/hslaColor'\nimport {rgbaColor} from './schemas/rgbaColor'\nimport {color} from './schemas/color'\nimport {hsvaColor} from './schemas/hsvaColor'\n\nexport const colorInput = createPlugin({\n name: '@sanity/color-input',\n schema: {\n types: [hslaColor, hsvaColor, rgbaColor, color],\n },\n})\n\nexport {hslaColor, rgbaColor, color, hsvaColor}\nexport {ColorInput} from './ColorInput'\nexport type {ColorValue, ColorInputProps, ColorOptions, ColorSchemaType} from './ColorInput'\n","export const hslaColor = {\n title: 'Hue Saturation Lightness',\n name: 'hslaColor',\n type: 'object',\n fields: [\n {name: 'h', type: 'number', title: 'Hue'},\n {name: 's', type: 'number', title: 'Saturation'},\n {name: 'l', type: 'number', title: 'Lightness'},\n {name: 'a', type: 'number', title: 'Alpha'},\n ],\n}\n","export const rgbaColor = {\n title: 'Red Green Blue (rgb)',\n name: 'rgbaColor',\n type: 'object',\n fields: [\n {name: 'r', type: 'number', title: 'Red'},\n {name: 'g', type: 'number', title: 'Green'},\n {name: 'b', type: 'number', title: 'Blue'},\n {name: 'a', type: 'number', title: 'Alpha'},\n ],\n}\n","import React from 'react'\nimport {ColorInput} from '../ColorInput'\n\nconst round = (val: number = 1) => Math.round(val * 100)\n\nexport const color = {\n name: 'color',\n type: 'object',\n title: 'Color',\n components: {input: ColorInput},\n fields: [\n {\n title: 'Hex',\n name: 'hex',\n type: 'string',\n },\n {\n title: 'Alpha',\n name: 'alpha',\n type: 'number',\n },\n {\n title: 'Hue Saturation Lightness',\n name: 'hsl',\n type: 'hslaColor',\n },\n {\n title: 'Hue Saturation Value',\n name: 'hsv',\n type: 'hsvaColor',\n },\n {\n title: 'Red Green Blue (rgb)',\n name: 'rgb',\n type: 'rgbaColor',\n },\n ],\n preview: {\n select: {\n title: 'hex',\n alpha: 'alpha',\n hex: 'hex',\n hsl: 'hsl',\n },\n prepare({\n title,\n hex,\n hsl,\n alpha,\n }: {\n title?: string\n alpha?: number\n hex?: string\n hsl?: {h: number; s: number; l: number}\n }) {\n let subtitle = hex || 'No color set'\n if (hsl) {\n subtitle = `H:${round(hsl.h)} S:${round(hsl.s)} L:${round(hsl.l)} A:${round(alpha)}`\n }\n return {\n title: title,\n subtitle: subtitle,\n media: () => (\n <div\n style={{\n backgroundColor: hex ?? '#000',\n opacity: alpha ?? 1,\n position: 'absolute',\n height: '100%',\n width: '100%',\n top: '0',\n left: '0',\n }}\n />\n ),\n }\n },\n },\n}\n","import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'\nimport {set, setIfMissing, unset} from 'sanity/form'\nimport {debounce} from 'lodash'\nimport {Button} from '@sanity/ui'\nimport {AddIcon} from '@sanity/icons'\nimport {ColorPicker} from './ColorPicker'\nimport {ObjectInputProps} from 'sanity'\nimport {HSLColor, HSVColor, RGBColor} from 'react-color'\nimport {ObjectSchemaType} from 'sanity'\n\nconst DEFAULT_COLOR: ColorValue & {source: string} = {\n hex: '#24a3e3',\n hsl: {h: 200, s: 0.7732, l: 0.5156, a: 1},\n hsv: {h: 200, s: 0.8414, v: 0.8901, a: 1},\n rgb: {r: 46, g: 163, b: 227, a: 1},\n source: 'hex',\n}\n\nexport interface ColorValue {\n hex: string\n hsl: HSLColor\n hsv: HSVColor\n rgb: RGBColor\n}\n\nexport interface ColorOptions {\n disableAlpha?: boolean\n}\n\nexport type ColorSchemaType = ObjectSchemaType & {\n options?: ColorOptions\n}\nexport type ColorInputProps = ObjectInputProps<ColorValue, ColorSchemaType>\n\nexport function ColorInput(props: ColorInputProps) {\n const {onChange, schemaType: type, readOnly, value} = props\n const focusRef = useRef<HTMLButtonElement>(null)\n\n // use local state so we can have instant ui updates while debouncing patch emits\n const [color, setColor] = useState(value)\n useEffect(() => setColor(value), [value])\n\n const emitSetColor = useCallback(\n (nextColor: ColorValue) => {\n const fieldPatches = type.fields\n .filter((field) => field.name in nextColor)\n .map((field) => {\n const nextFieldValue = nextColor[field.name as keyof ColorValue]\n const isObject = field.type.jsonType === 'object'\n return set(\n isObject ? Object.assign({_type: field.type.name}, nextFieldValue) : nextFieldValue,\n [field.name]\n )\n })\n\n onChange([\n setIfMissing({_type: type.name}),\n set(type.name, ['_type']),\n set(nextColor.rgb?.a, ['alpha']),\n ...fieldPatches,\n ])\n },\n [onChange, type]\n )\n\n // The color picker emits onChange events continuously while the user is sliding the\n // hue/saturation/alpha selectors. This debounces the event to avoid excessive patches\n const debouncedColorChange = useMemo(() => debounce(emitSetColor, 100), [emitSetColor])\n const handleColorChange = useCallback(\n (nextColor: ColorValue) => {\n setColor(nextColor)\n debouncedColorChange(nextColor)\n },\n [debouncedColorChange, setColor]\n )\n\n const handleCreateColor = useCallback(() => {\n setColor(DEFAULT_COLOR)\n emitSetColor(DEFAULT_COLOR)\n }, [emitSetColor])\n\n const handleUnset = useCallback(() => {\n setColor(undefined)\n onChange(unset())\n }, [onChange])\n\n return (\n <>\n {value ? (\n <ColorPicker\n /* ref={this.focusRef}*/\n color={color}\n onChange={handleColorChange}\n readOnly={readOnly || (typeof type.readOnly === 'boolean' && type.readOnly)}\n disableAlpha={type.options?.disableAlpha}\n onUnset={handleUnset}\n />\n ) : (\n <Button\n icon={AddIcon}\n mode=\"ghost\"\n text=\"Create color\"\n ref={focusRef}\n disabled={Boolean(readOnly)}\n onClick={handleCreateColor}\n />\n )}\n </>\n )\n}\n","import React from 'react'\nimport {Alpha, Checkboard, Hue, Saturation} from 'react-color/lib/components/common'\nimport {CustomPicker, HEXColor, HSLColor, HSVColor, RGBColor} from 'react-color'\nimport {Box, Button, Card, Flex, Inline, Stack, Text} from '@sanity/ui'\nimport {TrashIcon} from '@sanity/icons'\nimport styled from 'styled-components'\nimport {ColorPickerFields} from './ColorPickerFields'\nimport {CustomPickerInjectedProps} from 'react-color/lib/components/common/ColorWrap'\nimport {ColorValue} from './ColorInput'\n\nconst ColorBox = styled(Box)`\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n`\n\nconst ReadOnlyContainer = styled(Flex)`\n margin-top: 6rem;\n background-color: var(--card-bg-color);\n position: relative;\n width: 100%;\n`\n\nexport interface ColorPickerProps\n extends CustomPickerInjectedProps<HSLColor | HSVColor | RGBColor | HEXColor> {\n width?: string\n disableAlpha: boolean\n readOnly?: boolean\n onUnset: () => void\n color: ColorValue\n}\n\nconst ColorPickerInner = (props: ColorPickerProps) => {\n const {\n width,\n color: {rgb, hex, hsv, hsl},\n onChange,\n onUnset,\n disableAlpha,\n readOnly,\n } = props\n return (\n <div style={{width}}>\n <Card padding={1} border radius={1}>\n <Stack space={2}>\n {!readOnly && (\n <>\n <Card overflow=\"hidden\" style={{position: 'relative', height: '5em'}}>\n <Saturation onChange={onChange} hsl={hsl} hsv={hsv} />\n </Card>\n\n <Card\n shadow={1}\n radius={3}\n overflow=\"hidden\"\n style={{position: 'relative', height: '10px'}}\n >\n <Hue hsl={hsl} onChange={!readOnly && onChange} />\n </Card>\n\n {!disableAlpha && (\n <Card\n shadow={1}\n radius={3}\n overflow=\"hidden\"\n style={{position: 'relative', height: '10px'}}\n >\n <Alpha rgb={rgb} hsl={hsl} onChange={onChange} />\n </Card>\n )}\n </>\n )}\n <Flex>\n <Card\n flex={1}\n radius={2}\n overflow=\"hidden\"\n style={{position: 'relative', minWidth: '4em'}}\n >\n <Checkboard />\n <ColorBox\n style={{\n backgroundColor: `rgba(${rgb?.r},${rgb?.g},${rgb?.b},${rgb?.a})`,\n }}\n />\n\n {readOnly && (\n <ReadOnlyContainer\n padding={2}\n paddingBottom={1}\n sizing=\"border\"\n justify=\"space-between\"\n >\n <Stack space={3} marginTop={1}>\n <Text size={3} weight=\"bold\">\n {hex}\n </Text>\n\n <Inline space={3}>\n <Text size={1}>\n <strong>RGB: </strong>\n {rgb?.r} {rgb?.g} {rgb?.b}\n </Text>\n <Text size={1}>\n <strong>HSL: </strong> {Math.round(hsl?.h ?? 0)} {Math.round(hsl?.s ?? 0)}%{' '}\n {Math.round(hsl?.l ?? 0)}\n </Text>\n </Inline>\n </Stack>\n </ReadOnlyContainer>\n )}\n </Card>\n\n {!readOnly && (\n <Flex align=\"flex-start\" marginLeft={2}>\n <Box style={{width: 200}}>\n <ColorPickerFields\n rgb={rgb}\n hsl={hsl}\n hex={hex}\n onChange={onChange}\n disableAlpha={disableAlpha}\n />\n </Box>\n <Box marginLeft={2}>\n <Button onClick={onUnset} title=\"Delete color\" icon={TrashIcon} tone=\"critical\" />\n </Box>\n </Flex>\n )}\n </Flex>\n </Stack>\n </Card>\n </div>\n )\n}\n\nexport const ColorPicker = CustomPicker(ColorPickerInner)\n","import React, {useCallback, useMemo} from 'react'\n// @ts-expect-error missing export\nimport {isValidHex} from 'react-color/lib/helpers/color'\nimport {EditableInput} from 'react-color/lib/components/common'\nimport {Box, Flex, useTheme} from '@sanity/ui'\nimport {ColorChangeHandler, HEXColor, HSLColor, HSVColor, RGBColor} from 'react-color'\nimport {EditableInputStyles} from 'react-color/lib/components/common/EditableInput'\n\ninterface ColorPickerFieldsProps {\n rgb?: RGBColor\n hsl?: HSLColor\n hex?: string\n disableAlpha: boolean\n onChange: ColorChangeHandler<HSLColor | HSVColor | RGBColor | HEXColor>\n}\n\nexport const ColorPickerFields = ({\n onChange,\n rgb,\n hsl,\n hex,\n disableAlpha,\n}: ColorPickerFieldsProps) => {\n const {sanity} = useTheme()\n\n const inputStyles: EditableInputStyles = useMemo(\n () => ({\n input: {\n width: '80%',\n padding: '4px 10% 3px',\n border: 'none',\n boxShadow: `inset 0 0 0 1px ${sanity.color.input.default.enabled.border}`,\n color: sanity.color.input.default.enabled.fg,\n backgroundColor: sanity.color.input.default.enabled.bg,\n fontSize: sanity.fonts.text.sizes[0].fontSize,\n textAlign: 'center',\n },\n label: {\n display: 'block',\n textAlign: 'center',\n fontSize: sanity.fonts.label.sizes[0].fontSize,\n color: sanity.color.base.fg,\n paddingTop: '3px',\n paddingBottom: '4px',\n textTransform: 'capitalize',\n },\n }),\n [sanity]\n )\n\n const handleChange: ColorChangeHandler<Record<string, string>> = useCallback(\n (data) => {\n if ('hex' in data && data.hex && isValidHex(data.hex)) {\n onChange({\n hex: data.hex,\n source: 'hex',\n })\n } else if (\n rgb &&\n (('r' in data && data.r) || ('g' in data && data.g) || ('b' in data && data.b))\n ) {\n onChange({\n r: Number(data.r) || rgb.r,\n g: Number(data.g) || rgb.g,\n b: Number(data.b) || rgb.b,\n a: rgb.a,\n source: 'rgb',\n })\n } else if (hsl && 'a' in data && data.a) {\n let alpha = Number(data.a)\n if (alpha < 0) {\n alpha = 0\n } else if (alpha > 100) {\n alpha = 100\n }\n alpha /= 100\n\n onChange({\n h: hsl.h,\n s: hsl.s,\n l: hsl.l,\n a: alpha,\n source: 'hsl',\n })\n }\n },\n [onChange, hsl, rgb]\n )\n\n return (\n <Flex>\n <Box flex={2} marginRight={1}>\n <EditableInput\n style={inputStyles}\n label=\"hex\"\n value={hex?.replace('#', '')}\n onChange={handleChange}\n />\n </Box>\n <Box flex={1} marginRight={1}>\n <EditableInput\n style={inputStyles}\n label=\"r\"\n value={rgb?.r}\n onChange={handleChange}\n dragLabel\n dragMax={255}\n />\n </Box>\n <Box flex={1} marginRight={1}>\n <EditableInput\n style={inputStyles}\n label=\"g\"\n value={rgb?.g}\n onChange={handleChange}\n dragLabel\n dragMax={255}\n />\n </Box>\n <Box flex={1} marginRight={1}>\n <EditableInput\n style={inputStyles}\n label=\"b\"\n value={rgb?.b}\n onChange={handleChange}\n dragLabel\n dragMax={255}\n />\n </Box>\n {!disableAlpha && (\n <Box flex={1}>\n <EditableInput\n style={inputStyles}\n label=\"a\"\n value={Math.round((rgb?.a ?? 1) * 100)}\n onChange={handleChange}\n dragLabel\n dragMax={100}\n />\n </Box>\n )}\n </Flex>\n )\n}\n","export const hsvaColor = {\n title: 'Hue Saturation Value',\n name: 'hsvaColor',\n type: 'object',\n fields: [\n {name: 'h', type: 'number', title: 'Hue'},\n {name: 's', type: 'number', title: 'Saturation'},\n {name: 'v', type: 'number', title: 'Value'},\n {name: 'a', type: 'number', title: 'Alpha'},\n ],\n}\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../../"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { ObjectInputProps } from "sanity";
|
|
1
|
+
import { ObjectInputProps, ObjectSchemaType } from "sanity";
|
|
2
2
|
import { HSLColor, HSVColor, RGBColor } from "react-color";
|
|
3
|
-
import { ObjectSchemaType } from "@sanity/types";
|
|
4
3
|
export const hslaColor: {
|
|
5
4
|
title: string;
|
|
6
5
|
name: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;AAAA,OAAO,MAAM;;;;;;;;;CAUZ,CAAA;ACVD,OAAO,MAAM;;;;;;;;;CAUZ,CAAA;AGQD;IACE,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,QAAQ,CAAA;IACb,GAAG,EAAE,QAAQ,CAAA;IACb,GAAG,EAAE,QAAQ,CAAA;CACd;AAED;IACE,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AAED,8BAA8B,gBAAgB,GAAG;IAC/C,OAAO,CAAC,EAAE,YAAY,CAAA;CACvB,CAAA;AACD,8BAA8B,iBAAiB,UAAU,EAAE,eAAe,CAAC,CAAA;AAE3E,2BAA2B,KAAK,EAAE,eAAe,eA2EhD;ACxGD,OAAO,MAAM;;;;;;;;;;;;;;;;;;;;;;;;mBAgDG,MAAM;mBAAK,MAAM;mBAAK,MAAM;;;;;;;;CAyB3C,CAAA;AC9ED,OAAO,MAAM;;;;;;;;;CAUZ,CAAA;ACJD,OAAO,MAAM,yCAKX,CAAA","sources":["src/src/schemas/hslaColor.ts","src/src/schemas/rgbaColor.ts","src/src/ColorPickerFields.tsx","src/src/ColorPicker.tsx","src/src/ColorInput.tsx","src/src/schemas/color.tsx","src/src/schemas/hsvaColor.ts","src/src/index.ts","src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,"import {createPlugin} from 'sanity'\nimport {hslaColor} from './schemas/hslaColor'\nimport {rgbaColor} from './schemas/rgbaColor'\nimport {color} from './schemas/color'\nimport {hsvaColor} from './schemas/hsvaColor'\n\nexport const colorInput = createPlugin({\n name: '@sanity/color-input',\n schema: {\n types: [hslaColor, hsvaColor, rgbaColor, color],\n },\n})\n\nexport {hslaColor, rgbaColor, color, hsvaColor}\nexport {ColorInput} from './ColorInput'\nexport type {ColorValue, ColorInputProps, ColorOptions, ColorSchemaType} from './ColorInput'\n"],"names":[],"version":3,"file":"index.d.ts.map","sourceRoot":"../../"}
|