@sanity/color-input 4.0.5 → 4.0.7
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/LICENSE +1 -1
- package/README.md +3 -20
- package/dist/_chunks-cjs/ColorInput.cjs +337 -0
- package/dist/_chunks-cjs/ColorInput.cjs.map +1 -0
- package/dist/_chunks-es/ColorInput.js +344 -0
- package/dist/_chunks-es/ColorInput.js.map +1 -0
- package/{lib/index.js → dist/index.cjs} +2 -2
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +64 -0
- package/dist/index.d.ts +64 -0
- package/{lib/index.mjs → dist/index.js} +2 -2
- package/dist/index.js.map +1 -0
- package/package.json +29 -63
- package/lib/_chunks-cjs/ColorInput.js +0 -1041
- package/lib/_chunks-cjs/ColorInput.js.map +0 -1
- package/lib/_chunks-es/ColorInput.mjs +0 -1051
- package/lib/_chunks-es/ColorInput.mjs.map +0 -1
- package/lib/_legacy/ColorInput.esm.js +0 -1051
- package/lib/_legacy/ColorInput.esm.js.map +0 -1
- package/lib/index.d.mts +0 -93
- package/lib/index.d.ts +0 -93
- package/lib/index.esm.js +0 -114
- package/lib/index.esm.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/index.mjs.map +0 -1
- package/sanity.json +0 -8
- package/src/ColorInput.tsx +0 -97
- package/src/ColorList.tsx +0 -70
- package/src/ColorPicker.tsx +0 -152
- package/src/ColorPickerFields.tsx +0 -144
- package/src/LazyColorInput.tsx +0 -3
- package/src/index.ts +0 -18
- package/src/schemas/color.tsx +0 -98
- package/src/schemas/hslaColor.ts +0 -13
- package/src/schemas/hsvaColor.ts +0 -13
- package/src/schemas/rgbaColor.ts +0 -13
- package/src/types.ts +0 -19
- package/v2-incompatible.js +0 -11
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
# @sanity/color-input
|
|
2
2
|
|
|
3
|
-
> For the v2 version, please refer to the [v2-branch](https://github.com/sanity-io/sanity/tree/next/packages/%40sanity/color-input).
|
|
4
|
-
|
|
5
3
|
## What is it?
|
|
6
4
|
|
|
7
5
|
Color input plugin for [Sanity](https://sanity.io/) that stores selected colors in hex, hsl, hsv and rgb format.
|
|
8
6
|
|
|
9
|
-

|
|
10
8
|
|
|
11
9
|
## Installation
|
|
12
10
|
|
|
@@ -69,7 +67,7 @@ To disable the alpha option, set `disableAlpha` to `true`:
|
|
|
69
67
|
|
|
70
68
|
Which will render accordingly:
|
|
71
69
|
|
|
72
|
-

|
|
73
71
|
|
|
74
72
|
### Color list
|
|
75
73
|
|
|
@@ -99,7 +97,7 @@ This uses the `react-color` under the hood https://casesandberg.github.io/react-
|
|
|
99
97
|
|
|
100
98
|
Which will render accordingly:
|
|
101
99
|
|
|
102
|
-

|
|
103
101
|
|
|
104
102
|
## Data model
|
|
105
103
|
|
|
@@ -135,18 +133,3 @@ Which will render accordingly:
|
|
|
135
133
|
## License
|
|
136
134
|
|
|
137
135
|
MIT-licensed. See LICENSE.
|
|
138
|
-
|
|
139
|
-
## Develop & test
|
|
140
|
-
|
|
141
|
-
This plugin uses [@sanity/plugin-kit](https://github.com/sanity-io/plugin-kit)
|
|
142
|
-
with default configuration for build & watch scripts.
|
|
143
|
-
|
|
144
|
-
See [Testing a plugin in Sanity Studio](https://github.com/sanity-io/plugin-kit#testing-a-plugin-in-sanity-studio)
|
|
145
|
-
on how to run this plugin with hotreload in the studio.
|
|
146
|
-
|
|
147
|
-
### Release new version
|
|
148
|
-
|
|
149
|
-
Run ["CI & Release" workflow](https://github.com/sanity-io/color-input/actions/workflows/main.yml).
|
|
150
|
-
Make sure to select the main branch and check "Release new version".
|
|
151
|
-
|
|
152
|
-
Semantic release will only release on configured branches, so it is safe to run release on any branch.
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var jsxRuntime = require("react/jsx-runtime"), react = require("react"), reactColor = require("react-color"), common = require("react-color/lib/components/common"), sanity = require("sanity"), styledComponents = require("styled-components"), useEffectEvent = require("use-effect-event"), icons = require("@sanity/icons"), ui = require("@sanity/ui"), tinycolor = require("tinycolor2"), color = require("react-color/lib/helpers/color");
|
|
3
|
+
function _interopDefaultCompat(e) {
|
|
4
|
+
return e && typeof e == "object" && "default" in e ? e : { default: e };
|
|
5
|
+
}
|
|
6
|
+
var tinycolor__default = /* @__PURE__ */ _interopDefaultCompat(tinycolor);
|
|
7
|
+
const ColorListWrap = styledComponents.styled(ui.Flex)`
|
|
8
|
+
gap: 0.25em;
|
|
9
|
+
`, ColorBoxContainer = styledComponents.styled.div`
|
|
10
|
+
width: 2.1em;
|
|
11
|
+
height: 2.1em;
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
position: relative;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
border-radius: 3px;
|
|
16
|
+
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAADFJREFUOE9jZGBgEGHAD97gk2YcNYBhmIQBgWSAP52AwoAQwJvQRg1gACckQoC2gQgAIF8IscwEtKYAAAAASUVORK5CYII=')
|
|
17
|
+
left center #fff;
|
|
18
|
+
`, ColorBox$1 = styledComponents.styled.div`
|
|
19
|
+
border-radius: inherit;
|
|
20
|
+
box-shadow: inset 0 0 0 1px var(--card-shadow-outline-color);
|
|
21
|
+
content: '';
|
|
22
|
+
position: absolute;
|
|
23
|
+
inset: 0;
|
|
24
|
+
z-index: 1;
|
|
25
|
+
`, validateColors = (colors) => colors.reduce((cls, c) => {
|
|
26
|
+
const color2 = c.hex ? tinycolor__default.default(c.hex) : tinycolor__default.default(c);
|
|
27
|
+
return color2.isValid() && cls.push({
|
|
28
|
+
color: c,
|
|
29
|
+
backgroundColor: color2.toRgbString()
|
|
30
|
+
}), cls;
|
|
31
|
+
}, []), ColorList = react.memo(function({ colors, onChange }) {
|
|
32
|
+
return colors ? /* @__PURE__ */ jsxRuntime.jsx(ColorListWrap, { wrap: "wrap", children: validateColors(colors).map(({ color: color2, backgroundColor }, idx) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
33
|
+
ColorBoxContainer,
|
|
34
|
+
{
|
|
35
|
+
onClick: () => {
|
|
36
|
+
onChange(color2);
|
|
37
|
+
},
|
|
38
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ColorBox$1, { style: { background: backgroundColor } })
|
|
39
|
+
},
|
|
40
|
+
`${backgroundColor}-${idx}`
|
|
41
|
+
)) }) : null;
|
|
42
|
+
}), ColorPickerFields = ({
|
|
43
|
+
onChange,
|
|
44
|
+
rgb,
|
|
45
|
+
hsl,
|
|
46
|
+
hex,
|
|
47
|
+
disableAlpha
|
|
48
|
+
}) => {
|
|
49
|
+
const { sanity: sanity2 } = ui.useTheme(), inputStyles = react.useMemo(
|
|
50
|
+
() => ({
|
|
51
|
+
input: {
|
|
52
|
+
width: "80%",
|
|
53
|
+
padding: "4px 10% 3px",
|
|
54
|
+
border: "none",
|
|
55
|
+
boxShadow: `inset 0 0 0 1px ${sanity2.color.input.default.enabled.border}`,
|
|
56
|
+
color: sanity2.color.input.default.enabled.fg,
|
|
57
|
+
backgroundColor: sanity2.color.input.default.enabled.bg,
|
|
58
|
+
fontSize: sanity2.fonts.text.sizes[0]?.fontSize,
|
|
59
|
+
textAlign: "center"
|
|
60
|
+
},
|
|
61
|
+
label: {
|
|
62
|
+
display: "block",
|
|
63
|
+
textAlign: "center",
|
|
64
|
+
fontSize: sanity2.fonts.label.sizes[0]?.fontSize,
|
|
65
|
+
color: sanity2.color.base.fg,
|
|
66
|
+
paddingTop: "3px",
|
|
67
|
+
paddingBottom: "4px",
|
|
68
|
+
textTransform: "capitalize"
|
|
69
|
+
}
|
|
70
|
+
}),
|
|
71
|
+
[sanity2]
|
|
72
|
+
), handleChange = react.useCallback(
|
|
73
|
+
(data) => {
|
|
74
|
+
if ("hex" in data && data.hex && color.isValidHex(data.hex))
|
|
75
|
+
onChange({
|
|
76
|
+
hex: data.hex,
|
|
77
|
+
source: "hex"
|
|
78
|
+
});
|
|
79
|
+
else if (rgb && ("r" in data && data.r || "g" in data && data.g || "b" in data && data.b))
|
|
80
|
+
onChange({
|
|
81
|
+
r: Number(data.r) || rgb.r,
|
|
82
|
+
g: Number(data.g) || rgb.g,
|
|
83
|
+
b: Number(data.b) || rgb.b,
|
|
84
|
+
a: rgb.a,
|
|
85
|
+
source: "rgb"
|
|
86
|
+
});
|
|
87
|
+
else if (hsl && "a" in data && data.a) {
|
|
88
|
+
let alpha = Number(data.a);
|
|
89
|
+
alpha < 0 ? alpha = 0 : alpha > 100 && (alpha = 100), alpha /= 100, onChange({
|
|
90
|
+
h: hsl.h,
|
|
91
|
+
s: hsl.s,
|
|
92
|
+
l: hsl.l,
|
|
93
|
+
a: alpha,
|
|
94
|
+
source: "hsl"
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
[onChange, hsl, rgb]
|
|
99
|
+
);
|
|
100
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { children: [
|
|
101
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 2, marginRight: 1, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
102
|
+
common.EditableInput,
|
|
103
|
+
{
|
|
104
|
+
style: inputStyles,
|
|
105
|
+
label: "hex",
|
|
106
|
+
value: hex?.replace("#", ""),
|
|
107
|
+
onChange: handleChange
|
|
108
|
+
}
|
|
109
|
+
) }),
|
|
110
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, marginRight: 1, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
111
|
+
common.EditableInput,
|
|
112
|
+
{
|
|
113
|
+
style: inputStyles,
|
|
114
|
+
label: "r",
|
|
115
|
+
value: rgb?.r,
|
|
116
|
+
onChange: handleChange,
|
|
117
|
+
dragLabel: !0,
|
|
118
|
+
dragMax: 255
|
|
119
|
+
}
|
|
120
|
+
) }),
|
|
121
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, marginRight: 1, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
122
|
+
common.EditableInput,
|
|
123
|
+
{
|
|
124
|
+
style: inputStyles,
|
|
125
|
+
label: "g",
|
|
126
|
+
value: rgb?.g,
|
|
127
|
+
onChange: handleChange,
|
|
128
|
+
dragLabel: !0,
|
|
129
|
+
dragMax: 255
|
|
130
|
+
}
|
|
131
|
+
) }),
|
|
132
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, marginRight: 1, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
133
|
+
common.EditableInput,
|
|
134
|
+
{
|
|
135
|
+
style: inputStyles,
|
|
136
|
+
label: "b",
|
|
137
|
+
value: rgb?.b,
|
|
138
|
+
onChange: handleChange,
|
|
139
|
+
dragLabel: !0,
|
|
140
|
+
dragMax: 255
|
|
141
|
+
}
|
|
142
|
+
) }),
|
|
143
|
+
!disableAlpha && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
144
|
+
common.EditableInput,
|
|
145
|
+
{
|
|
146
|
+
style: inputStyles,
|
|
147
|
+
label: "a",
|
|
148
|
+
value: Math.round((rgb?.a ?? 1) * 100),
|
|
149
|
+
onChange: handleChange,
|
|
150
|
+
dragLabel: !0,
|
|
151
|
+
dragMax: 100
|
|
152
|
+
}
|
|
153
|
+
) })
|
|
154
|
+
] });
|
|
155
|
+
}, ColorBox = styledComponents.styled(ui.Box)`
|
|
156
|
+
position: absolute;
|
|
157
|
+
top: 0;
|
|
158
|
+
left: 0;
|
|
159
|
+
width: 100%;
|
|
160
|
+
height: 100%;
|
|
161
|
+
`, ReadOnlyContainer = styledComponents.styled(ui.Flex)`
|
|
162
|
+
margin-top: 6rem;
|
|
163
|
+
background-color: var(--card-bg-color);
|
|
164
|
+
position: relative;
|
|
165
|
+
width: 100%;
|
|
166
|
+
`, ColorPickerInner = (props) => {
|
|
167
|
+
const {
|
|
168
|
+
width,
|
|
169
|
+
color: { rgb, hex, hsv, hsl },
|
|
170
|
+
onChange,
|
|
171
|
+
onUnset,
|
|
172
|
+
disableAlpha,
|
|
173
|
+
colorList,
|
|
174
|
+
readOnly
|
|
175
|
+
} = props;
|
|
176
|
+
return !hsl || !hsv ? null : /* @__PURE__ */ jsxRuntime.jsx("div", { style: { width }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { padding: 1, border: !0, radius: 1, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 2, children: [
|
|
177
|
+
!readOnly && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
178
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Card, { overflow: "hidden", style: { position: "relative", height: "5em" }, children: /* @__PURE__ */ jsxRuntime.jsx(common.Saturation, { onChange, hsl, hsv }) }),
|
|
179
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
180
|
+
ui.Card,
|
|
181
|
+
{
|
|
182
|
+
shadow: 1,
|
|
183
|
+
radius: 3,
|
|
184
|
+
overflow: "hidden",
|
|
185
|
+
style: { position: "relative", height: "10px" },
|
|
186
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(common.Hue, { hsl, onChange: !readOnly && onChange })
|
|
187
|
+
}
|
|
188
|
+
),
|
|
189
|
+
!disableAlpha && /* @__PURE__ */ jsxRuntime.jsx(
|
|
190
|
+
ui.Card,
|
|
191
|
+
{
|
|
192
|
+
shadow: 1,
|
|
193
|
+
radius: 3,
|
|
194
|
+
overflow: "hidden",
|
|
195
|
+
style: { position: "relative", height: "10px", background: "#fff" },
|
|
196
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(common.Alpha, { rgb, hsl, onChange })
|
|
197
|
+
}
|
|
198
|
+
)
|
|
199
|
+
] }),
|
|
200
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { children: [
|
|
201
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
202
|
+
ui.Card,
|
|
203
|
+
{
|
|
204
|
+
flex: 1,
|
|
205
|
+
radius: 2,
|
|
206
|
+
overflow: "hidden",
|
|
207
|
+
style: { position: "relative", minWidth: "4em", background: "#fff" },
|
|
208
|
+
children: [
|
|
209
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
210
|
+
common.Checkboard,
|
|
211
|
+
{
|
|
212
|
+
size: 8,
|
|
213
|
+
white: "transparent",
|
|
214
|
+
grey: "rgba(0,0,0,.08)",
|
|
215
|
+
renderers: {}
|
|
216
|
+
}
|
|
217
|
+
),
|
|
218
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
219
|
+
ColorBox,
|
|
220
|
+
{
|
|
221
|
+
style: {
|
|
222
|
+
backgroundColor: `rgba(${rgb?.r},${rgb?.g},${rgb?.b},${rgb?.a})`
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
),
|
|
226
|
+
readOnly && /* @__PURE__ */ jsxRuntime.jsx(
|
|
227
|
+
ReadOnlyContainer,
|
|
228
|
+
{
|
|
229
|
+
padding: 2,
|
|
230
|
+
paddingBottom: 1,
|
|
231
|
+
sizing: "border",
|
|
232
|
+
justify: "space-between",
|
|
233
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, marginTop: 1, children: [
|
|
234
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 3, weight: "bold", children: hex }),
|
|
235
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Inline, { space: 3, children: [
|
|
236
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: 1, children: [
|
|
237
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "RGB: " }),
|
|
238
|
+
rgb?.r,
|
|
239
|
+
" ",
|
|
240
|
+
rgb?.g,
|
|
241
|
+
" ",
|
|
242
|
+
rgb?.b
|
|
243
|
+
] }),
|
|
244
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: 1, children: [
|
|
245
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "HSL: " }),
|
|
246
|
+
" ",
|
|
247
|
+
Math.round(hsl?.h ?? 0),
|
|
248
|
+
" ",
|
|
249
|
+
Math.round((hsl?.s ?? 0) * 100),
|
|
250
|
+
"% ",
|
|
251
|
+
Math.round((hsl?.l ?? 0) * 100),
|
|
252
|
+
"%"
|
|
253
|
+
] })
|
|
254
|
+
] })
|
|
255
|
+
] })
|
|
256
|
+
}
|
|
257
|
+
)
|
|
258
|
+
]
|
|
259
|
+
}
|
|
260
|
+
),
|
|
261
|
+
!readOnly && /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "flex-start", marginLeft: 2, children: [
|
|
262
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { style: { width: 200 }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
263
|
+
ColorPickerFields,
|
|
264
|
+
{
|
|
265
|
+
rgb,
|
|
266
|
+
hsl,
|
|
267
|
+
hex,
|
|
268
|
+
onChange,
|
|
269
|
+
disableAlpha
|
|
270
|
+
}
|
|
271
|
+
) }),
|
|
272
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginLeft: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { onClick: onUnset, title: "Delete color", icon: icons.TrashIcon, tone: "critical" }) })
|
|
273
|
+
] })
|
|
274
|
+
] }),
|
|
275
|
+
colorList && /* @__PURE__ */ jsxRuntime.jsx(ColorList, { colors: colorList, onChange })
|
|
276
|
+
] }) }) });
|
|
277
|
+
}, ColorPicker = reactColor.CustomPicker(ColorPickerInner), DEFAULT_COLOR = {
|
|
278
|
+
hex: "#24a3e3",
|
|
279
|
+
hsl: { h: 200, s: 0.7732, l: 0.5156, a: 1 },
|
|
280
|
+
hsv: { h: 200, s: 0.8414, v: 0.8901, a: 1 },
|
|
281
|
+
rgb: { r: 46, g: 163, b: 227, a: 1 },
|
|
282
|
+
source: "hex"
|
|
283
|
+
};
|
|
284
|
+
function ColorInput(props) {
|
|
285
|
+
const { onChange, readOnly } = props, value = props.value, type = props.schemaType, focusRef = react.useRef(null), [color2, setColor] = react.useState(value);
|
|
286
|
+
react.useEffect(() => react.startTransition(() => setColor(value)), [value]);
|
|
287
|
+
const [emitColor, setEmitColor] = react.useState(void 0), debouncedColor = react.useDeferredValue(emitColor), handleChange = useEffectEvent.useEffectEvent((nextColor) => {
|
|
288
|
+
const fieldPatches = type.fields.filter((field) => field.name in nextColor).map((field) => {
|
|
289
|
+
const nextFieldValue = nextColor[field.name], isObject = field.type.jsonType === "object";
|
|
290
|
+
return sanity.set(
|
|
291
|
+
isObject ? Object.assign({ _type: field.type.name }, nextFieldValue) : nextFieldValue,
|
|
292
|
+
[field.name]
|
|
293
|
+
);
|
|
294
|
+
});
|
|
295
|
+
onChange([
|
|
296
|
+
sanity.setIfMissing({ _type: type.name }),
|
|
297
|
+
sanity.set(type.name, ["_type"]),
|
|
298
|
+
sanity.set(nextColor.rgb?.a, ["alpha"]),
|
|
299
|
+
...fieldPatches
|
|
300
|
+
]);
|
|
301
|
+
});
|
|
302
|
+
react.useEffect(() => {
|
|
303
|
+
if (!debouncedColor) return;
|
|
304
|
+
const raf = requestAnimationFrame(() => handleChange(debouncedColor));
|
|
305
|
+
return () => cancelAnimationFrame(raf);
|
|
306
|
+
}, [debouncedColor]);
|
|
307
|
+
const handleCreateColor = react.useCallback(() => {
|
|
308
|
+
setColor(DEFAULT_COLOR), setEmitColor(DEFAULT_COLOR);
|
|
309
|
+
}, []), handleColorChange = react.useCallback((nextColor) => {
|
|
310
|
+
setColor(nextColor), setEmitColor(nextColor);
|
|
311
|
+
}, []), handleUnset = react.useCallback(() => {
|
|
312
|
+
setColor(void 0), onChange(sanity.unset());
|
|
313
|
+
}, [onChange]);
|
|
314
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: value && value.hex ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
315
|
+
ColorPicker,
|
|
316
|
+
{
|
|
317
|
+
color: color2,
|
|
318
|
+
onChange: handleColorChange,
|
|
319
|
+
readOnly: readOnly || typeof type.readOnly == "boolean" && type.readOnly,
|
|
320
|
+
disableAlpha: !!type.options?.disableAlpha,
|
|
321
|
+
colorList: type.options?.colorList,
|
|
322
|
+
onUnset: handleUnset
|
|
323
|
+
}
|
|
324
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
325
|
+
ui.Button,
|
|
326
|
+
{
|
|
327
|
+
icon: icons.AddIcon,
|
|
328
|
+
mode: "ghost",
|
|
329
|
+
text: "Create color",
|
|
330
|
+
ref: focusRef,
|
|
331
|
+
disabled: !!readOnly,
|
|
332
|
+
onClick: handleCreateColor
|
|
333
|
+
}
|
|
334
|
+
) });
|
|
335
|
+
}
|
|
336
|
+
exports.default = ColorInput;
|
|
337
|
+
//# sourceMappingURL=ColorInput.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorInput.cjs","sources":["../../src/ColorList.tsx","../../src/ColorPickerFields.tsx","../../src/ColorInput.tsx"],"sourcesContent":["import type {Color, ColorChangeHandler} from 'react-color'\n\nimport {memo} from 'react'\nimport {styled} from 'styled-components'\nimport tinycolor from 'tinycolor2'\n\nimport {Flex} from '@sanity/ui'\n\nconst ColorListWrap = styled(Flex)`\n gap: 0.25em;\n`\n\nconst ColorBoxContainer = styled.div`\n width: 2.1em;\n height: 2.1em;\n cursor: pointer;\n position: relative;\n overflow: hidden;\n border-radius: 3px;\n background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAADFJREFUOE9jZGBgEGHAD97gk2YcNYBhmIQBgWSAP52AwoAQwJvQRg1gACckQoC2gQgAIF8IscwEtKYAAAAASUVORK5CYII=')\n left center #fff;\n`\n\nconst ColorBox = styled.div`\n border-radius: inherit;\n box-shadow: inset 0 0 0 1px var(--card-shadow-outline-color);\n content: '';\n position: absolute;\n inset: 0;\n z-index: 1;\n`\n\ninterface ValidatedColor {\n color: Color\n backgroundColor: string\n}\n\ninterface ColorListProps {\n colors?: Array<Color>\n onChange: ColorChangeHandler<Color>\n}\n\nconst validateColors = (colors: Array<Color>) =>\n colors.reduce((cls: Array<ValidatedColor>, c) => {\n // @ts-expect-error fix types later\n const color = c.hex ? tinycolor(c.hex) : tinycolor(c)\n if (color.isValid()) {\n cls.push({\n color: c,\n backgroundColor: color.toRgbString(),\n })\n }\n return cls\n }, [])\n\nexport const ColorList = memo(function ColorList({colors, onChange}: ColorListProps) {\n if (!colors) return null\n return (\n <ColorListWrap wrap=\"wrap\">\n {validateColors(colors).map(({color, backgroundColor}, idx) => (\n <ColorBoxContainer\n key={`${backgroundColor}-${idx}`}\n onClick={() => {\n onChange(color)\n }}\n >\n <ColorBox style={{background: backgroundColor}} />\n </ColorBoxContainer>\n ))}\n </ColorListWrap>\n )\n})\n","import type {Color, ColorChangeHandler, HSLColor, RGBColor} from 'react-color'\nimport type {EditableInputStyles} from 'react-color/lib/components/common/EditableInput'\n\nimport {useCallback, useMemo} from 'react'\nimport {EditableInput} from 'react-color/lib/components/common'\n// @ts-expect-error missing export\nimport {isValidHex} from 'react-color/lib/helpers/color'\n\nimport {Box, Flex, useTheme} from '@sanity/ui'\n\ninterface ColorPickerFieldsProps {\n rgb?: RGBColor\n hsl?: HSLColor\n hex?: string\n disableAlpha: boolean\n onChange: ColorChangeHandler<Color>\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","import type {CustomPickerInjectedProps} from 'react-color/lib/components/common/ColorWrap'\n\nimport {startTransition, useCallback, useDeferredValue, useEffect, useRef, useState} from 'react'\nimport {type Color, CustomPicker} from 'react-color'\nimport {Alpha, Checkboard, Hue, Saturation} from 'react-color/lib/components/common'\nimport {type ObjectInputProps, set, setIfMissing, unset} from 'sanity'\nimport {styled} from 'styled-components'\nimport {useEffectEvent} from 'use-effect-event'\n\nimport {AddIcon} from '@sanity/icons'\nimport {TrashIcon} from '@sanity/icons'\nimport {Box, Button, Card, Flex, Inline, Stack, Text} from '@sanity/ui'\n\nimport type {ColorSchemaType, ColorValue} from './types'\n\nimport {ColorList} from './ColorList'\nimport {ColorPickerFields} from './ColorPickerFields'\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\ninterface ColorPickerProps extends CustomPickerInjectedProps<Color> {\n width?: string\n disableAlpha: boolean\n colorList?: Array<Color> | undefined\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 colorList,\n readOnly,\n } = props\n\n if (!hsl || !hsv) {\n return null\n }\n\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', background: '#fff'}}\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', background: '#fff'}}\n >\n <Checkboard\n size={8}\n white=\"transparent\"\n grey=\"rgba(0,0,0,.08)\"\n renderers={{} as {canvas: unknown}}\n />\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)}{' '}\n {Math.round((hsl?.s ?? 0) * 100)}% {Math.round((hsl?.l ?? 0) * 100)}%\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 {colorList && <ColorList colors={colorList} onChange={onChange} />}\n </Stack>\n </Card>\n </div>\n )\n}\n\nconst ColorPicker = CustomPicker(ColorPickerInner)\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 default function ColorInput(props: ObjectInputProps) {\n const {onChange, readOnly} = props\n const value = props.value as ColorValue | undefined\n const type = props.schemaType as ColorSchemaType\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 // Marking the `setColor` in a transition allows React to interrupt render should the user start dragging the input before React is finished rendering\n useEffect(() => startTransition(() => setColor(value)), [value])\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 // and massively improve render performance and avoid jank\n const [emitColor, setEmitColor] = useState<typeof value>(undefined)\n const debouncedColor = useDeferredValue(emitColor)\n const handleChange = useEffectEvent((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 useEffect(() => {\n if (!debouncedColor) return undefined\n const raf = requestAnimationFrame(() => handleChange(debouncedColor))\n return () => cancelAnimationFrame(raf)\n }, [debouncedColor])\n\n const handleCreateColor = useCallback(() => {\n setColor(DEFAULT_COLOR)\n setEmitColor(DEFAULT_COLOR)\n }, [])\n\n const handleColorChange = useCallback((nextColor: ColorValue) => {\n setColor(nextColor)\n setEmitColor(nextColor)\n }, [])\n\n const handleUnset = useCallback(() => {\n setColor(undefined)\n onChange(unset())\n }, [onChange])\n\n return (\n <>\n {value && value.hex ? (\n <ColorPicker\n color={color!}\n onChange={handleColorChange}\n readOnly={readOnly || (typeof type.readOnly === 'boolean' && type.readOnly)}\n disableAlpha={!!type.options?.disableAlpha}\n colorList={type.options?.colorList}\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"],"names":["styled","Flex","ColorBox","color","tinycolor","memo","jsx","sanity","useTheme","useMemo","useCallback","isValidHex","Box","EditableInput","Card","jsxs","Stack","Fragment","Saturation","Hue","Alpha","Checkboard","Text","Inline","Button","TrashIcon","CustomPicker","useRef","useState","useEffect","startTransition","useDeferredValue","useEffectEvent","set","setIfMissing","unset","AddIcon"],"mappings":";;;;;;AAQA,MAAM,gBAAgBA,iBAAAA,OAAOC,OAAI;AAAA;AAAA,GAI3B,oBAAoBD,iBAAAA,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAW3BE,aAAWF,iBAAAA,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAmBlB,iBAAiB,CAAC,WACtB,OAAO,OAAO,CAAC,KAA4B,MAAM;AAE/C,QAAMG,SAAQ,EAAE,MAAMC,mBAAAA,QAAU,EAAE,GAAG,IAAIA,mBAAAA,QAAU,CAAC;AACpD,SAAID,OAAM,aACR,IAAI,KAAK;AAAA,IACP,OAAO;AAAA,IACP,iBAAiBA,OAAM,YAAA;AAAA,EAAY,CACpC,GAEI;AACT,GAAG,EAAE,GAEM,YAAYE,MAAAA,KAAK,SAAmB,EAAC,QAAQ,YAA2B;AACnF,SAAK,SAEHC,2BAAAA,IAAC,eAAA,EAAc,MAAK,QACjB,UAAA,eAAe,MAAM,EAAE,IAAI,CAAC,EAAC,OAAAH,QAAO,gBAAA,GAAkB,QACrDG,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MAEC,SAAS,MAAM;AACb,iBAASH,MAAK;AAAA,MAChB;AAAA,MAEA,yCAACD,YAAA,EAAS,OAAO,EAAC,YAAY,kBAAe,CAAG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