@strapi/plugin-color-picker 4.15.1 → 4.15.3-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/ColorPickerInput-b422e4e7.js +206 -0
- package/dist/_chunks/{ColorPickerInput-cddbeb1a.js.map → ColorPickerInput-b422e4e7.js.map} +1 -1
- package/dist/_chunks/ColorPickerInput-ee59d80f.mjs +185 -0
- package/dist/_chunks/{ColorPickerInput-ca8fbb6e.mjs.map → ColorPickerInput-ee59d80f.mjs.map} +1 -1
- package/dist/_chunks/{index-e7d8fc7b.mjs → index-10d18ad6.mjs} +4 -12
- package/dist/_chunks/{index-e7d8fc7b.mjs.map → index-10d18ad6.mjs.map} +1 -1
- package/dist/_chunks/{index-0b5f614d.js → index-2b655cca.js} +4 -12
- package/dist/_chunks/{index-0b5f614d.js.map → index-2b655cca.js.map} +1 -1
- package/dist/admin/index.js +2 -2
- package/dist/admin/index.mjs +2 -2
- package/package.json +7 -10
- package/LICENSE +0 -15
- package/dist/_chunks/ColorPickerInput-ca8fbb6e.mjs +0 -277
- package/dist/_chunks/ColorPickerInput-cddbeb1a.js +0 -298
|
@@ -1,298 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
|
-
const React = require("react");
|
|
5
|
-
const designSystem = require("@strapi/design-system");
|
|
6
|
-
const icons = require("@strapi/icons");
|
|
7
|
-
const reactColorful = require("react-colorful");
|
|
8
|
-
const reactIntl = require("react-intl");
|
|
9
|
-
const styled = require("styled-components");
|
|
10
|
-
const index = require("./index-0b5f614d.js");
|
|
11
|
-
require("@strapi/helper-plugin");
|
|
12
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
13
|
-
function _interopNamespace(e) {
|
|
14
|
-
if (e && e.__esModule)
|
|
15
|
-
return e;
|
|
16
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
17
|
-
if (e) {
|
|
18
|
-
for (const k in e) {
|
|
19
|
-
if (k !== "default") {
|
|
20
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
21
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: () => e[k]
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
n.default = e;
|
|
29
|
-
return Object.freeze(n);
|
|
30
|
-
}
|
|
31
|
-
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
32
|
-
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
33
|
-
function setRef(ref, value) {
|
|
34
|
-
if (typeof ref === "function") {
|
|
35
|
-
ref(value);
|
|
36
|
-
} else if (ref !== null && ref !== void 0) {
|
|
37
|
-
ref.current = value;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function composeRefs(...refs) {
|
|
41
|
-
return (node) => refs.forEach((ref) => setRef(ref, node));
|
|
42
|
-
}
|
|
43
|
-
function useComposedRefs(...refs) {
|
|
44
|
-
return React__namespace.useCallback(composeRefs(...refs), refs);
|
|
45
|
-
}
|
|
46
|
-
const ColorPreview = styled__default.default.div`
|
|
47
|
-
border-radius: 50%;
|
|
48
|
-
width: 20px;
|
|
49
|
-
height: 20px;
|
|
50
|
-
margin-right: 10px;
|
|
51
|
-
background-color: ${(props) => props.color};
|
|
52
|
-
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
53
|
-
`;
|
|
54
|
-
const ColorPicker = styled__default.default(reactColorful.HexColorPicker)`
|
|
55
|
-
&& {
|
|
56
|
-
width: 100%;
|
|
57
|
-
aspect-ratio: 1.5;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.react-colorful__pointer {
|
|
61
|
-
width: ${({ theme }) => theme.spaces[3]};
|
|
62
|
-
height: ${({ theme }) => theme.spaces[3]};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.react-colorful__saturation {
|
|
66
|
-
border-radius: ${({ theme }) => theme.spaces[1]};
|
|
67
|
-
border-bottom: none;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.react-colorful__hue {
|
|
71
|
-
border-radius: 10px;
|
|
72
|
-
height: ${({ theme }) => theme.spaces[3]};
|
|
73
|
-
margin-top: ${({ theme }) => theme.spaces[2]};
|
|
74
|
-
}
|
|
75
|
-
`;
|
|
76
|
-
const ColorPickerToggle = styled__default.default(designSystem.BaseButton)`
|
|
77
|
-
display: flex;
|
|
78
|
-
justify-content: space-between;
|
|
79
|
-
align-items: center;
|
|
80
|
-
|
|
81
|
-
svg {
|
|
82
|
-
width: ${({ theme }) => theme.spaces[2]};
|
|
83
|
-
height: ${({ theme }) => theme.spaces[2]};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
svg > path {
|
|
87
|
-
fill: ${({ theme }) => theme.colors.neutral500};
|
|
88
|
-
justify-self: flex-end;
|
|
89
|
-
}
|
|
90
|
-
`;
|
|
91
|
-
const ColorPickerPopover = styled__default.default(designSystem.Popover)`
|
|
92
|
-
padding: ${({ theme }) => theme.spaces[2]};
|
|
93
|
-
min-height: 270px;
|
|
94
|
-
`;
|
|
95
|
-
const ColorPickerInput = React__namespace.forwardRef(
|
|
96
|
-
({
|
|
97
|
-
attribute,
|
|
98
|
-
description,
|
|
99
|
-
disabled = false,
|
|
100
|
-
error,
|
|
101
|
-
intlLabel,
|
|
102
|
-
labelAction,
|
|
103
|
-
name,
|
|
104
|
-
onChange,
|
|
105
|
-
required = false,
|
|
106
|
-
value = ""
|
|
107
|
-
}, forwardedRef) => {
|
|
108
|
-
const [showColorPicker, setShowColorPicker] = React__namespace.useState(false);
|
|
109
|
-
const colorPickerButtonRef = React__namespace.useRef(null);
|
|
110
|
-
const { formatMessage } = reactIntl.useIntl();
|
|
111
|
-
const color = value || "#000000";
|
|
112
|
-
const handleBlur = (e) => {
|
|
113
|
-
e.preventDefault();
|
|
114
|
-
if (!e.currentTarget.contains(e.relatedTarget)) {
|
|
115
|
-
setShowColorPicker(false);
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
const composedRefs = useComposedRefs(forwardedRef, colorPickerButtonRef);
|
|
119
|
-
return /* @__PURE__ */ jsxDevRuntime.jsxDEV(
|
|
120
|
-
designSystem.Field,
|
|
121
|
-
{
|
|
122
|
-
name,
|
|
123
|
-
id: name,
|
|
124
|
-
error,
|
|
125
|
-
hint: description && formatMessage(description),
|
|
126
|
-
required,
|
|
127
|
-
children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
|
128
|
-
/* @__PURE__ */ jsxDevRuntime.jsxDEV(designSystem.FieldLabel, { action: labelAction, children: formatMessage(intlLabel) }, void 0, false, {
|
|
129
|
-
fileName: "/Users/alex/dev/strapi/strapi/packages/plugins/color-picker/admin/src/components/ColorPickerInput.tsx",
|
|
130
|
-
lineNumber: 138,
|
|
131
|
-
columnNumber: 11
|
|
132
|
-
}, globalThis),
|
|
133
|
-
/* @__PURE__ */ jsxDevRuntime.jsxDEV(
|
|
134
|
-
ColorPickerToggle,
|
|
135
|
-
{
|
|
136
|
-
ref: composedRefs,
|
|
137
|
-
"aria-label": formatMessage({
|
|
138
|
-
id: index.getTrad("color-picker.toggle.aria-label"),
|
|
139
|
-
defaultMessage: "Color picker toggle"
|
|
140
|
-
}),
|
|
141
|
-
"aria-controls": "color-picker-value",
|
|
142
|
-
"aria-haspopup": "dialog",
|
|
143
|
-
"aria-expanded": showColorPicker,
|
|
144
|
-
"aria-disabled": disabled,
|
|
145
|
-
disabled,
|
|
146
|
-
onClick: () => setShowColorPicker(!showColorPicker),
|
|
147
|
-
children: [
|
|
148
|
-
/* @__PURE__ */ jsxDevRuntime.jsxDEV(designSystem.Flex, { children: [
|
|
149
|
-
/* @__PURE__ */ jsxDevRuntime.jsxDEV(ColorPreview, { color }, void 0, false, {
|
|
150
|
-
fileName: "/Users/alex/dev/strapi/strapi/packages/plugins/color-picker/admin/src/components/ColorPickerInput.tsx",
|
|
151
|
-
lineNumber: 153,
|
|
152
|
-
columnNumber: 15
|
|
153
|
-
}, globalThis),
|
|
154
|
-
/* @__PURE__ */ jsxDevRuntime.jsxDEV(
|
|
155
|
-
designSystem.Typography,
|
|
156
|
-
{
|
|
157
|
-
style: { textTransform: "uppercase" },
|
|
158
|
-
textColor: value ? void 0 : "neutral600",
|
|
159
|
-
variant: "omega",
|
|
160
|
-
children: color
|
|
161
|
-
},
|
|
162
|
-
void 0,
|
|
163
|
-
false,
|
|
164
|
-
{
|
|
165
|
-
fileName: "/Users/alex/dev/strapi/strapi/packages/plugins/color-picker/admin/src/components/ColorPickerInput.tsx",
|
|
166
|
-
lineNumber: 154,
|
|
167
|
-
columnNumber: 15
|
|
168
|
-
},
|
|
169
|
-
globalThis
|
|
170
|
-
)
|
|
171
|
-
] }, void 0, true, {
|
|
172
|
-
fileName: "/Users/alex/dev/strapi/strapi/packages/plugins/color-picker/admin/src/components/ColorPickerInput.tsx",
|
|
173
|
-
lineNumber: 152,
|
|
174
|
-
columnNumber: 13
|
|
175
|
-
}, globalThis),
|
|
176
|
-
/* @__PURE__ */ jsxDevRuntime.jsxDEV(icons.CarretDown, { "aria-hidden": true }, void 0, false, {
|
|
177
|
-
fileName: "/Users/alex/dev/strapi/strapi/packages/plugins/color-picker/admin/src/components/ColorPickerInput.tsx",
|
|
178
|
-
lineNumber: 162,
|
|
179
|
-
columnNumber: 13
|
|
180
|
-
}, globalThis)
|
|
181
|
-
]
|
|
182
|
-
},
|
|
183
|
-
void 0,
|
|
184
|
-
true,
|
|
185
|
-
{
|
|
186
|
-
fileName: "/Users/alex/dev/strapi/strapi/packages/plugins/color-picker/admin/src/components/ColorPickerInput.tsx",
|
|
187
|
-
lineNumber: 139,
|
|
188
|
-
columnNumber: 11
|
|
189
|
-
},
|
|
190
|
-
globalThis
|
|
191
|
-
),
|
|
192
|
-
showColorPicker && /* @__PURE__ */ jsxDevRuntime.jsxDEV(
|
|
193
|
-
ColorPickerPopover,
|
|
194
|
-
{
|
|
195
|
-
onBlur: handleBlur,
|
|
196
|
-
role: "dialog",
|
|
197
|
-
source: colorPickerButtonRef,
|
|
198
|
-
spacing: 4,
|
|
199
|
-
children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(designSystem.FocusTrap, { onEscape: () => setShowColorPicker(false), children: [
|
|
200
|
-
/* @__PURE__ */ jsxDevRuntime.jsxDEV(
|
|
201
|
-
ColorPicker,
|
|
202
|
-
{
|
|
203
|
-
color,
|
|
204
|
-
onChange: (hexValue) => onChange({ target: { name, value: hexValue, type: attribute.type } })
|
|
205
|
-
},
|
|
206
|
-
void 0,
|
|
207
|
-
false,
|
|
208
|
-
{
|
|
209
|
-
fileName: "/Users/alex/dev/strapi/strapi/packages/plugins/color-picker/admin/src/components/ColorPickerInput.tsx",
|
|
210
|
-
lineNumber: 172,
|
|
211
|
-
columnNumber: 17
|
|
212
|
-
},
|
|
213
|
-
globalThis
|
|
214
|
-
),
|
|
215
|
-
/* @__PURE__ */ jsxDevRuntime.jsxDEV(designSystem.Flex, { paddingTop: 3, paddingLeft: 4, justifyContent: "flex-end", children: [
|
|
216
|
-
/* @__PURE__ */ jsxDevRuntime.jsxDEV(designSystem.Box, { paddingRight: 2, children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(designSystem.Typography, { variant: "omega", as: "label", textColor: "neutral600", children: formatMessage({
|
|
217
|
-
id: index.getTrad("color-picker.input.format"),
|
|
218
|
-
defaultMessage: "HEX"
|
|
219
|
-
}) }, void 0, false, {
|
|
220
|
-
fileName: "/Users/alex/dev/strapi/strapi/packages/plugins/color-picker/admin/src/components/ColorPickerInput.tsx",
|
|
221
|
-
lineNumber: 180,
|
|
222
|
-
columnNumber: 21
|
|
223
|
-
}, globalThis) }, void 0, false, {
|
|
224
|
-
fileName: "/Users/alex/dev/strapi/strapi/packages/plugins/color-picker/admin/src/components/ColorPickerInput.tsx",
|
|
225
|
-
lineNumber: 179,
|
|
226
|
-
columnNumber: 19
|
|
227
|
-
}, globalThis),
|
|
228
|
-
/* @__PURE__ */ jsxDevRuntime.jsxDEV(
|
|
229
|
-
designSystem.FieldInput,
|
|
230
|
-
{
|
|
231
|
-
id: "color-picker-value",
|
|
232
|
-
"aria-label": formatMessage({
|
|
233
|
-
id: index.getTrad("color-picker.input.aria-label"),
|
|
234
|
-
defaultMessage: "Color picker input"
|
|
235
|
-
}),
|
|
236
|
-
style: { textTransform: "uppercase" },
|
|
237
|
-
value,
|
|
238
|
-
placeholder: "#000000",
|
|
239
|
-
onChange
|
|
240
|
-
},
|
|
241
|
-
void 0,
|
|
242
|
-
false,
|
|
243
|
-
{
|
|
244
|
-
fileName: "/Users/alex/dev/strapi/strapi/packages/plugins/color-picker/admin/src/components/ColorPickerInput.tsx",
|
|
245
|
-
lineNumber: 187,
|
|
246
|
-
columnNumber: 19
|
|
247
|
-
},
|
|
248
|
-
globalThis
|
|
249
|
-
)
|
|
250
|
-
] }, void 0, true, {
|
|
251
|
-
fileName: "/Users/alex/dev/strapi/strapi/packages/plugins/color-picker/admin/src/components/ColorPickerInput.tsx",
|
|
252
|
-
lineNumber: 178,
|
|
253
|
-
columnNumber: 17
|
|
254
|
-
}, globalThis)
|
|
255
|
-
] }, void 0, true, {
|
|
256
|
-
fileName: "/Users/alex/dev/strapi/strapi/packages/plugins/color-picker/admin/src/components/ColorPickerInput.tsx",
|
|
257
|
-
lineNumber: 171,
|
|
258
|
-
columnNumber: 15
|
|
259
|
-
}, globalThis)
|
|
260
|
-
},
|
|
261
|
-
void 0,
|
|
262
|
-
false,
|
|
263
|
-
{
|
|
264
|
-
fileName: "/Users/alex/dev/strapi/strapi/packages/plugins/color-picker/admin/src/components/ColorPickerInput.tsx",
|
|
265
|
-
lineNumber: 165,
|
|
266
|
-
columnNumber: 13
|
|
267
|
-
},
|
|
268
|
-
globalThis
|
|
269
|
-
),
|
|
270
|
-
/* @__PURE__ */ jsxDevRuntime.jsxDEV(designSystem.FieldHint, {}, void 0, false, {
|
|
271
|
-
fileName: "/Users/alex/dev/strapi/strapi/packages/plugins/color-picker/admin/src/components/ColorPickerInput.tsx",
|
|
272
|
-
lineNumber: 202,
|
|
273
|
-
columnNumber: 11
|
|
274
|
-
}, globalThis),
|
|
275
|
-
/* @__PURE__ */ jsxDevRuntime.jsxDEV(designSystem.FieldError, {}, void 0, false, {
|
|
276
|
-
fileName: "/Users/alex/dev/strapi/strapi/packages/plugins/color-picker/admin/src/components/ColorPickerInput.tsx",
|
|
277
|
-
lineNumber: 203,
|
|
278
|
-
columnNumber: 11
|
|
279
|
-
}, globalThis)
|
|
280
|
-
] }, void 0, true, {
|
|
281
|
-
fileName: "/Users/alex/dev/strapi/strapi/packages/plugins/color-picker/admin/src/components/ColorPickerInput.tsx",
|
|
282
|
-
lineNumber: 137,
|
|
283
|
-
columnNumber: 9
|
|
284
|
-
}, globalThis)
|
|
285
|
-
},
|
|
286
|
-
void 0,
|
|
287
|
-
false,
|
|
288
|
-
{
|
|
289
|
-
fileName: "/Users/alex/dev/strapi/strapi/packages/plugins/color-picker/admin/src/components/ColorPickerInput.tsx",
|
|
290
|
-
lineNumber: 129,
|
|
291
|
-
columnNumber: 7
|
|
292
|
-
},
|
|
293
|
-
globalThis
|
|
294
|
-
);
|
|
295
|
-
}
|
|
296
|
-
);
|
|
297
|
-
exports.ColorPickerInput = ColorPickerInput;
|
|
298
|
-
//# sourceMappingURL=ColorPickerInput-cddbeb1a.js.map
|