@strapi/plugin-color-picker 5.0.0-beta.1 → 5.0.0-beta.11
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-DUlALFSe.js +150 -0
- package/dist/_chunks/ColorPickerInput-DUlALFSe.js.map +1 -0
- package/dist/_chunks/ColorPickerInput-K16FHrOs.mjs +131 -0
- package/dist/_chunks/ColorPickerInput-K16FHrOs.mjs.map +1 -0
- package/dist/_chunks/{cs-4GdZY0p6.js → cs-CKl0OyEH.js} +1 -1
- package/dist/_chunks/cs-CKl0OyEH.js.map +1 -0
- package/dist/_chunks/{cs-A2xRj-2-.mjs → cs-DMmE6LK7.mjs} +1 -1
- package/dist/_chunks/cs-DMmE6LK7.mjs.map +1 -0
- package/dist/_chunks/{en-L6ZZWDJv.mjs → en-BlDau3us.mjs} +1 -1
- package/dist/_chunks/en-BlDau3us.mjs.map +1 -0
- package/dist/_chunks/{en-WeRHjVEB.js → en-Ct0C5cA2.js} +1 -1
- package/dist/_chunks/en-Ct0C5cA2.js.map +1 -0
- package/dist/_chunks/{index-rhrQWlM_.js → index-DYgSCaYT.js} +6 -8
- package/dist/_chunks/index-DYgSCaYT.js.map +1 -0
- package/dist/_chunks/{index-2Qkvylxv.mjs → index-kjptSDR8.mjs} +7 -7
- package/dist/_chunks/index-kjptSDR8.mjs.map +1 -0
- package/dist/_chunks/{ru-UXN_ByI9.js → ru-Wrg-npZz.js} +1 -1
- package/dist/_chunks/ru-Wrg-npZz.js.map +1 -0
- package/dist/_chunks/{ru-LLXYEOwl.mjs → ru-aOnA-eym.mjs} +1 -1
- package/dist/_chunks/ru-aOnA-eym.mjs.map +1 -0
- package/dist/_chunks/{sv-QqRPNQLw.mjs → sv-BaFDND79.mjs} +1 -1
- package/dist/_chunks/sv-BaFDND79.mjs.map +1 -0
- package/dist/_chunks/{sv-3-Yk9bKb.js → sv-CKY6es_6.js} +1 -1
- package/dist/_chunks/sv-CKY6es_6.js.map +1 -0
- package/dist/_chunks/{tr-qYGSw8gH.mjs → tr-CHHW_hYI.mjs} +1 -1
- package/dist/_chunks/tr-CHHW_hYI.mjs.map +1 -0
- package/dist/_chunks/{tr-AbD-f8F0.js → tr-DcLzQS-J.js} +1 -1
- package/dist/_chunks/tr-DcLzQS-J.js.map +1 -0
- package/dist/_chunks/{zh-fPTOIT6s.mjs → zh-DBH6uCXb.mjs} +1 -1
- package/dist/_chunks/zh-DBH6uCXb.mjs.map +1 -0
- package/dist/_chunks/{zh-c23gv_oM.js → zh-T5cJzhPD.js} +1 -1
- package/dist/_chunks/zh-T5cJzhPD.js.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/package.json +14 -14
- package/dist/_chunks/ColorPickerInput-QRiGH2qL.js +0 -177
- package/dist/_chunks/ColorPickerInput-QRiGH2qL.js.map +0 -1
- package/dist/_chunks/ColorPickerInput-RhMUg8K_.mjs +0 -156
- package/dist/_chunks/ColorPickerInput-RhMUg8K_.mjs.map +0 -1
- package/dist/_chunks/cs-4GdZY0p6.js.map +0 -1
- package/dist/_chunks/cs-A2xRj-2-.mjs.map +0 -1
- package/dist/_chunks/en-L6ZZWDJv.mjs.map +0 -1
- package/dist/_chunks/en-WeRHjVEB.js.map +0 -1
- package/dist/_chunks/index-2Qkvylxv.mjs.map +0 -1
- package/dist/_chunks/index-rhrQWlM_.js.map +0 -1
- package/dist/_chunks/ru-LLXYEOwl.mjs.map +0 -1
- package/dist/_chunks/ru-UXN_ByI9.js.map +0 -1
- package/dist/_chunks/sv-3-Yk9bKb.js.map +0 -1
- package/dist/_chunks/sv-QqRPNQLw.mjs.map +0 -1
- package/dist/_chunks/tr-AbD-f8F0.js.map +0 -1
- package/dist/_chunks/tr-qYGSw8gH.mjs.map +0 -1
- package/dist/_chunks/zh-c23gv_oM.js.map +0 -1
- package/dist/_chunks/zh-fPTOIT6s.mjs.map +0 -1
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const designSystem = require("@strapi/design-system");
|
|
6
|
+
const icons = require("@strapi/icons");
|
|
7
|
+
const admin = require("@strapi/strapi/admin");
|
|
8
|
+
const reactColorful = require("react-colorful");
|
|
9
|
+
const reactIntl = require("react-intl");
|
|
10
|
+
const styledComponents = require("styled-components");
|
|
11
|
+
const index = require("./index-DYgSCaYT.js");
|
|
12
|
+
function _interopNamespace(e) {
|
|
13
|
+
if (e && e.__esModule)
|
|
14
|
+
return e;
|
|
15
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
16
|
+
if (e) {
|
|
17
|
+
for (const k in e) {
|
|
18
|
+
if (k !== "default") {
|
|
19
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
20
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: () => e[k]
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
n.default = e;
|
|
28
|
+
return Object.freeze(n);
|
|
29
|
+
}
|
|
30
|
+
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
31
|
+
const ColorPreview = styledComponents.styled.div`
|
|
32
|
+
border-radius: 50%;
|
|
33
|
+
width: 20px;
|
|
34
|
+
height: 20px;
|
|
35
|
+
margin-right: 10px;
|
|
36
|
+
background-color: ${(props) => props.color};
|
|
37
|
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
38
|
+
`;
|
|
39
|
+
const ColorPicker = styledComponents.styled(reactColorful.HexColorPicker)`
|
|
40
|
+
&& {
|
|
41
|
+
width: 100%;
|
|
42
|
+
aspect-ratio: 1.5;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.react-colorful__pointer {
|
|
46
|
+
width: ${({ theme }) => theme.spaces[3]};
|
|
47
|
+
height: ${({ theme }) => theme.spaces[3]};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.react-colorful__saturation {
|
|
51
|
+
border-radius: ${({ theme }) => theme.spaces[1]};
|
|
52
|
+
border-bottom: none;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.react-colorful__hue {
|
|
56
|
+
border-radius: 10px;
|
|
57
|
+
height: ${({ theme }) => theme.spaces[3]};
|
|
58
|
+
margin-top: ${({ theme }) => theme.spaces[2]};
|
|
59
|
+
}
|
|
60
|
+
`;
|
|
61
|
+
const ColorPickerToggle = styledComponents.styled(designSystem.BaseButton)`
|
|
62
|
+
display: flex;
|
|
63
|
+
justify-content: space-between;
|
|
64
|
+
align-items: center;
|
|
65
|
+
|
|
66
|
+
svg {
|
|
67
|
+
width: ${({ theme }) => theme.spaces[2]};
|
|
68
|
+
height: ${({ theme }) => theme.spaces[2]};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
svg > path {
|
|
72
|
+
fill: ${({ theme }) => theme.colors.neutral500};
|
|
73
|
+
justify-self: flex-end;
|
|
74
|
+
}
|
|
75
|
+
`;
|
|
76
|
+
const ColorPickerPopover = styledComponents.styled(designSystem.Popover.Content)`
|
|
77
|
+
padding: ${({ theme }) => theme.spaces[2]};
|
|
78
|
+
min-height: 270px;
|
|
79
|
+
`;
|
|
80
|
+
const ColorPickerInput = React__namespace.forwardRef(
|
|
81
|
+
({ hint, disabled = false, labelAction, label, name, required = false }, forwardedRef) => {
|
|
82
|
+
const { onChange, value, error } = admin.useField(name);
|
|
83
|
+
const [showColorPicker, setShowColorPicker] = React__namespace.useState(false);
|
|
84
|
+
const colorPickerButtonRef = React__namespace.useRef(null);
|
|
85
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
86
|
+
const color = value || "#000000";
|
|
87
|
+
const composedRefs = designSystem.useComposedRefs(forwardedRef, colorPickerButtonRef);
|
|
88
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { name, id: name, error, hint, required, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
|
89
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { action: labelAction, children: label }),
|
|
90
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Popover.Root, { onOpenChange: setShowColorPicker, children: [
|
|
91
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
92
|
+
ColorPickerToggle,
|
|
93
|
+
{
|
|
94
|
+
ref: composedRefs,
|
|
95
|
+
"aria-label": formatMessage({
|
|
96
|
+
id: index.getTrad("color-picker.toggle.aria-label"),
|
|
97
|
+
defaultMessage: "Color picker toggle"
|
|
98
|
+
}),
|
|
99
|
+
"aria-controls": "color-picker-value",
|
|
100
|
+
"aria-haspopup": "dialog",
|
|
101
|
+
"aria-expanded": showColorPicker,
|
|
102
|
+
"aria-disabled": disabled,
|
|
103
|
+
disabled,
|
|
104
|
+
children: [
|
|
105
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { children: [
|
|
106
|
+
/* @__PURE__ */ jsxRuntime.jsx(ColorPreview, { color }),
|
|
107
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
108
|
+
designSystem.Typography,
|
|
109
|
+
{
|
|
110
|
+
style: { textTransform: "uppercase" },
|
|
111
|
+
textColor: value ? void 0 : "neutral600",
|
|
112
|
+
variant: "omega",
|
|
113
|
+
children: color
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
] }),
|
|
117
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CaretDown, { "aria-hidden": true })
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
) }),
|
|
121
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ColorPickerPopover, { sideOffset: 4, children: [
|
|
122
|
+
/* @__PURE__ */ jsxRuntime.jsx(ColorPicker, { color, onChange: (hexValue) => onChange(name, hexValue) }),
|
|
123
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { paddingTop: 3, paddingLeft: 4, justifyContent: "flex-end", children: [
|
|
124
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingRight: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", tag: "label", textColor: "neutral600", children: formatMessage({
|
|
125
|
+
id: index.getTrad("color-picker.input.format"),
|
|
126
|
+
defaultMessage: "HEX"
|
|
127
|
+
}) }) }),
|
|
128
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
129
|
+
designSystem.Field.Input,
|
|
130
|
+
{
|
|
131
|
+
"aria-label": formatMessage({
|
|
132
|
+
id: index.getTrad("color-picker.input.aria-label"),
|
|
133
|
+
defaultMessage: "Color picker input"
|
|
134
|
+
}),
|
|
135
|
+
style: { textTransform: "uppercase" },
|
|
136
|
+
value,
|
|
137
|
+
placeholder: "#000000",
|
|
138
|
+
onChange
|
|
139
|
+
}
|
|
140
|
+
) })
|
|
141
|
+
] })
|
|
142
|
+
] })
|
|
143
|
+
] }),
|
|
144
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {}),
|
|
145
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
146
|
+
] }) });
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
exports.ColorPickerInput = ColorPickerInput;
|
|
150
|
+
//# sourceMappingURL=ColorPickerInput-DUlALFSe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorPickerInput-DUlALFSe.js","sources":["../../admin/src/components/ColorPickerInput.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n BaseButton,\n Box,\n Field,\n Flex,\n Popover,\n Typography,\n useComposedRefs,\n} from '@strapi/design-system';\nimport { CaretDown } from '@strapi/icons';\nimport { useField, type InputProps } from '@strapi/strapi/admin';\nimport { HexColorPicker } from 'react-colorful';\nimport { useIntl } from 'react-intl';\nimport { styled } from 'styled-components';\n\nimport { getTrad } from '../utils/getTrad';\n\nconst ColorPreview = styled.div`\n border-radius: 50%;\n width: 20px;\n height: 20px;\n margin-right: 10px;\n background-color: ${(props) => props.color};\n border: 1px solid rgba(0, 0, 0, 0.1);\n`;\n\nconst ColorPicker = styled(HexColorPicker)`\n && {\n width: 100%;\n aspect-ratio: 1.5;\n }\n\n .react-colorful__pointer {\n width: ${({ theme }) => theme.spaces[3]};\n height: ${({ theme }) => theme.spaces[3]};\n }\n\n .react-colorful__saturation {\n border-radius: ${({ theme }) => theme.spaces[1]};\n border-bottom: none;\n }\n\n .react-colorful__hue {\n border-radius: 10px;\n height: ${({ theme }) => theme.spaces[3]};\n margin-top: ${({ theme }) => theme.spaces[2]};\n }\n`;\n\nconst ColorPickerToggle = styled(BaseButton)`\n display: flex;\n justify-content: space-between;\n align-items: center;\n\n svg {\n width: ${({ theme }) => theme.spaces[2]};\n height: ${({ theme }) => theme.spaces[2]};\n }\n\n svg > path {\n fill: ${({ theme }) => theme.colors.neutral500};\n justify-self: flex-end;\n }\n`;\n\nconst ColorPickerPopover = styled(Popover.Content)`\n padding: ${({ theme }) => theme.spaces[2]};\n min-height: 270px;\n`;\n\ntype ColorPickerInputProps = InputProps & {\n labelAction?: React.ReactNode;\n};\n\nexport const ColorPickerInput = React.forwardRef<HTMLButtonElement, ColorPickerInputProps>(\n ({ hint, disabled = false, labelAction, label, name, required = false }, forwardedRef) => {\n const { onChange, value, error } = useField(name);\n const [showColorPicker, setShowColorPicker] = React.useState(false);\n const colorPickerButtonRef = React.useRef<HTMLButtonElement>(null!);\n const { formatMessage } = useIntl();\n const color = value || '#000000';\n\n const composedRefs = useComposedRefs(forwardedRef, colorPickerButtonRef);\n\n return (\n <Field.Root name={name} id={name} error={error} hint={hint} required={required}>\n <Flex direction=\"column\" alignItems=\"stretch\" gap={1}>\n <Field.Label action={labelAction}>{label}</Field.Label>\n <Popover.Root onOpenChange={setShowColorPicker}>\n <Popover.Trigger>\n <ColorPickerToggle\n ref={composedRefs}\n aria-label={formatMessage({\n id: getTrad('color-picker.toggle.aria-label'),\n defaultMessage: 'Color picker toggle',\n })}\n aria-controls=\"color-picker-value\"\n aria-haspopup=\"dialog\"\n aria-expanded={showColorPicker}\n aria-disabled={disabled}\n disabled={disabled}\n >\n <Flex>\n <ColorPreview color={color} />\n <Typography\n style={{ textTransform: 'uppercase' }}\n textColor={value ? undefined : 'neutral600'}\n variant=\"omega\"\n >\n {color}\n </Typography>\n </Flex>\n <CaretDown aria-hidden />\n </ColorPickerToggle>\n </Popover.Trigger>\n <ColorPickerPopover sideOffset={4}>\n <ColorPicker color={color} onChange={(hexValue) => onChange(name, hexValue)} />\n <Flex paddingTop={3} paddingLeft={4} justifyContent=\"flex-end\">\n <Box paddingRight={2}>\n <Typography variant=\"omega\" tag=\"label\" textColor=\"neutral600\">\n {formatMessage({\n id: getTrad('color-picker.input.format'),\n defaultMessage: 'HEX',\n })}\n </Typography>\n </Box>\n <Field.Root>\n <Field.Input\n aria-label={formatMessage({\n id: getTrad('color-picker.input.aria-label'),\n defaultMessage: 'Color picker input',\n })}\n style={{ textTransform: 'uppercase' }}\n value={value}\n placeholder=\"#000000\"\n onChange={onChange}\n />\n </Field.Root>\n </Flex>\n </ColorPickerPopover>\n </Popover.Root>\n <Field.Hint />\n <Field.Error />\n </Flex>\n </Field.Root>\n );\n }\n);\n"],"names":["styled","HexColorPicker","BaseButton","Popover","React","useField","useIntl","useComposedRefs","Field","Flex","jsx","jsxs","getTrad","Typography","CaretDown","Box"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAM,eAAeA,iBAAO,OAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAKN,CAAC,UAAU,MAAM,KAAK;AAAA;AA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,KAAA,EAAI,cAAc,GACjB,UAACL,2BAAAA,IAAAG,aAAA,YAAA,EAAW,SAAQ,SAAQ,KAAI,SAAQ,WAAU,cAC/C,UAAc,cAAA;AAAA,cACb,IAAID,cAAQ,2BAA2B;AAAA,cACvC,gBAAgB;AAAA,YAAA,CACjB,GACH,EACF,CAAA;AAAA,YACAF,2BAAAA,IAACF,aAAM,MAAA,MAAN,EACC,UAAAE,2BAAA;AAAA,cAACF,aAAAA,MAAM;AAAA,cAAN;AAAA,gBACC,cAAY,cAAc;AAAA,kBACxB,IAAII,cAAQ,+BAA+B;AAAA,kBAC3C,gBAAgB;AAAA,gBAAA,CACjB;AAAA,gBACD,OAAO,EAAE,eAAe,YAAY;AAAA,gBACpC;AAAA,gBACA,aAAY;AAAA,gBACZ;AAAA,cAAA;AAAA,YAAA,GAEJ;AAAA,UAAA,GACF;AAAA,QAAA,GACF;AAAA,MAAA,GACF;AAAA,MACAF,+BAACF,aAAAA,MAAM,MAAN,EAAW;AAAA,MACZE,+BAACF,aAAAA,MAAM,OAAN,EAAY;AAAA,IAAA,EACf,CAAA,EACF,CAAA;AAAA,EAEJ;AACF;;"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { BaseButton, Popover, useComposedRefs, Field, Flex, Typography, Box } from "@strapi/design-system";
|
|
4
|
+
import { CaretDown } from "@strapi/icons";
|
|
5
|
+
import { useField } from "@strapi/strapi/admin";
|
|
6
|
+
import { HexColorPicker } from "react-colorful";
|
|
7
|
+
import { useIntl } from "react-intl";
|
|
8
|
+
import { styled } from "styled-components";
|
|
9
|
+
import { g as getTrad } from "./index-kjptSDR8.mjs";
|
|
10
|
+
const ColorPreview = styled.div`
|
|
11
|
+
border-radius: 50%;
|
|
12
|
+
width: 20px;
|
|
13
|
+
height: 20px;
|
|
14
|
+
margin-right: 10px;
|
|
15
|
+
background-color: ${(props) => props.color};
|
|
16
|
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
17
|
+
`;
|
|
18
|
+
const ColorPicker = styled(HexColorPicker)`
|
|
19
|
+
&& {
|
|
20
|
+
width: 100%;
|
|
21
|
+
aspect-ratio: 1.5;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.react-colorful__pointer {
|
|
25
|
+
width: ${({ theme }) => theme.spaces[3]};
|
|
26
|
+
height: ${({ theme }) => theme.spaces[3]};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.react-colorful__saturation {
|
|
30
|
+
border-radius: ${({ theme }) => theme.spaces[1]};
|
|
31
|
+
border-bottom: none;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.react-colorful__hue {
|
|
35
|
+
border-radius: 10px;
|
|
36
|
+
height: ${({ theme }) => theme.spaces[3]};
|
|
37
|
+
margin-top: ${({ theme }) => theme.spaces[2]};
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
const ColorPickerToggle = styled(BaseButton)`
|
|
41
|
+
display: flex;
|
|
42
|
+
justify-content: space-between;
|
|
43
|
+
align-items: center;
|
|
44
|
+
|
|
45
|
+
svg {
|
|
46
|
+
width: ${({ theme }) => theme.spaces[2]};
|
|
47
|
+
height: ${({ theme }) => theme.spaces[2]};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
svg > path {
|
|
51
|
+
fill: ${({ theme }) => theme.colors.neutral500};
|
|
52
|
+
justify-self: flex-end;
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
55
|
+
const ColorPickerPopover = styled(Popover.Content)`
|
|
56
|
+
padding: ${({ theme }) => theme.spaces[2]};
|
|
57
|
+
min-height: 270px;
|
|
58
|
+
`;
|
|
59
|
+
const ColorPickerInput = React.forwardRef(
|
|
60
|
+
({ hint, disabled = false, labelAction, label, name, required = false }, forwardedRef) => {
|
|
61
|
+
const { onChange, value, error } = useField(name);
|
|
62
|
+
const [showColorPicker, setShowColorPicker] = React.useState(false);
|
|
63
|
+
const colorPickerButtonRef = React.useRef(null);
|
|
64
|
+
const { formatMessage } = useIntl();
|
|
65
|
+
const color = value || "#000000";
|
|
66
|
+
const composedRefs = useComposedRefs(forwardedRef, colorPickerButtonRef);
|
|
67
|
+
return /* @__PURE__ */ jsx(Field.Root, { name, id: name, error, hint, required, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
|
68
|
+
/* @__PURE__ */ jsx(Field.Label, { action: labelAction, children: label }),
|
|
69
|
+
/* @__PURE__ */ jsxs(Popover.Root, { onOpenChange: setShowColorPicker, children: [
|
|
70
|
+
/* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsxs(
|
|
71
|
+
ColorPickerToggle,
|
|
72
|
+
{
|
|
73
|
+
ref: composedRefs,
|
|
74
|
+
"aria-label": formatMessage({
|
|
75
|
+
id: getTrad("color-picker.toggle.aria-label"),
|
|
76
|
+
defaultMessage: "Color picker toggle"
|
|
77
|
+
}),
|
|
78
|
+
"aria-controls": "color-picker-value",
|
|
79
|
+
"aria-haspopup": "dialog",
|
|
80
|
+
"aria-expanded": showColorPicker,
|
|
81
|
+
"aria-disabled": disabled,
|
|
82
|
+
disabled,
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ jsxs(Flex, { children: [
|
|
85
|
+
/* @__PURE__ */ jsx(ColorPreview, { color }),
|
|
86
|
+
/* @__PURE__ */ jsx(
|
|
87
|
+
Typography,
|
|
88
|
+
{
|
|
89
|
+
style: { textTransform: "uppercase" },
|
|
90
|
+
textColor: value ? void 0 : "neutral600",
|
|
91
|
+
variant: "omega",
|
|
92
|
+
children: color
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
] }),
|
|
96
|
+
/* @__PURE__ */ jsx(CaretDown, { "aria-hidden": true })
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
) }),
|
|
100
|
+
/* @__PURE__ */ jsxs(ColorPickerPopover, { sideOffset: 4, children: [
|
|
101
|
+
/* @__PURE__ */ jsx(ColorPicker, { color, onChange: (hexValue) => onChange(name, hexValue) }),
|
|
102
|
+
/* @__PURE__ */ jsxs(Flex, { paddingTop: 3, paddingLeft: 4, justifyContent: "flex-end", children: [
|
|
103
|
+
/* @__PURE__ */ jsx(Box, { paddingRight: 2, children: /* @__PURE__ */ jsx(Typography, { variant: "omega", tag: "label", textColor: "neutral600", children: formatMessage({
|
|
104
|
+
id: getTrad("color-picker.input.format"),
|
|
105
|
+
defaultMessage: "HEX"
|
|
106
|
+
}) }) }),
|
|
107
|
+
/* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsx(
|
|
108
|
+
Field.Input,
|
|
109
|
+
{
|
|
110
|
+
"aria-label": formatMessage({
|
|
111
|
+
id: getTrad("color-picker.input.aria-label"),
|
|
112
|
+
defaultMessage: "Color picker input"
|
|
113
|
+
}),
|
|
114
|
+
style: { textTransform: "uppercase" },
|
|
115
|
+
value,
|
|
116
|
+
placeholder: "#000000",
|
|
117
|
+
onChange
|
|
118
|
+
}
|
|
119
|
+
) })
|
|
120
|
+
] })
|
|
121
|
+
] })
|
|
122
|
+
] }),
|
|
123
|
+
/* @__PURE__ */ jsx(Field.Hint, {}),
|
|
124
|
+
/* @__PURE__ */ jsx(Field.Error, {})
|
|
125
|
+
] }) });
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
export {
|
|
129
|
+
ColorPickerInput
|
|
130
|
+
};
|
|
131
|
+
//# sourceMappingURL=ColorPickerInput-K16FHrOs.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorPickerInput-K16FHrOs.mjs","sources":["../../admin/src/components/ColorPickerInput.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n BaseButton,\n Box,\n Field,\n Flex,\n Popover,\n Typography,\n useComposedRefs,\n} from '@strapi/design-system';\nimport { CaretDown } from '@strapi/icons';\nimport { useField, type InputProps } from '@strapi/strapi/admin';\nimport { HexColorPicker } from 'react-colorful';\nimport { useIntl } from 'react-intl';\nimport { styled } from 'styled-components';\n\nimport { getTrad } from '../utils/getTrad';\n\nconst ColorPreview = styled.div`\n border-radius: 50%;\n width: 20px;\n height: 20px;\n margin-right: 10px;\n background-color: ${(props) => props.color};\n border: 1px solid rgba(0, 0, 0, 0.1);\n`;\n\nconst ColorPicker = styled(HexColorPicker)`\n && {\n width: 100%;\n aspect-ratio: 1.5;\n }\n\n .react-colorful__pointer {\n width: ${({ theme }) => theme.spaces[3]};\n height: ${({ theme }) => theme.spaces[3]};\n }\n\n .react-colorful__saturation {\n border-radius: ${({ theme }) => theme.spaces[1]};\n border-bottom: none;\n }\n\n .react-colorful__hue {\n border-radius: 10px;\n height: ${({ theme }) => theme.spaces[3]};\n margin-top: ${({ theme }) => theme.spaces[2]};\n }\n`;\n\nconst ColorPickerToggle = styled(BaseButton)`\n display: flex;\n justify-content: space-between;\n align-items: center;\n\n svg {\n width: ${({ theme }) => theme.spaces[2]};\n height: ${({ theme }) => theme.spaces[2]};\n }\n\n svg > path {\n fill: ${({ theme }) => theme.colors.neutral500};\n justify-self: flex-end;\n }\n`;\n\nconst ColorPickerPopover = styled(Popover.Content)`\n padding: ${({ theme }) => theme.spaces[2]};\n min-height: 270px;\n`;\n\ntype ColorPickerInputProps = InputProps & {\n labelAction?: React.ReactNode;\n};\n\nexport const ColorPickerInput = React.forwardRef<HTMLButtonElement, ColorPickerInputProps>(\n ({ hint, disabled = false, labelAction, label, name, required = false }, forwardedRef) => {\n const { onChange, value, error } = useField(name);\n const [showColorPicker, setShowColorPicker] = React.useState(false);\n const colorPickerButtonRef = React.useRef<HTMLButtonElement>(null!);\n const { formatMessage } = useIntl();\n const color = value || '#000000';\n\n const composedRefs = useComposedRefs(forwardedRef, colorPickerButtonRef);\n\n return (\n <Field.Root name={name} id={name} error={error} hint={hint} required={required}>\n <Flex direction=\"column\" alignItems=\"stretch\" gap={1}>\n <Field.Label action={labelAction}>{label}</Field.Label>\n <Popover.Root onOpenChange={setShowColorPicker}>\n <Popover.Trigger>\n <ColorPickerToggle\n ref={composedRefs}\n aria-label={formatMessage({\n id: getTrad('color-picker.toggle.aria-label'),\n defaultMessage: 'Color picker toggle',\n })}\n aria-controls=\"color-picker-value\"\n aria-haspopup=\"dialog\"\n aria-expanded={showColorPicker}\n aria-disabled={disabled}\n disabled={disabled}\n >\n <Flex>\n <ColorPreview color={color} />\n <Typography\n style={{ textTransform: 'uppercase' }}\n textColor={value ? undefined : 'neutral600'}\n variant=\"omega\"\n >\n {color}\n </Typography>\n </Flex>\n <CaretDown aria-hidden />\n </ColorPickerToggle>\n </Popover.Trigger>\n <ColorPickerPopover sideOffset={4}>\n <ColorPicker color={color} onChange={(hexValue) => onChange(name, hexValue)} />\n <Flex paddingTop={3} paddingLeft={4} justifyContent=\"flex-end\">\n <Box paddingRight={2}>\n <Typography variant=\"omega\" tag=\"label\" textColor=\"neutral600\">\n {formatMessage({\n id: getTrad('color-picker.input.format'),\n defaultMessage: 'HEX',\n })}\n </Typography>\n </Box>\n <Field.Root>\n <Field.Input\n aria-label={formatMessage({\n id: getTrad('color-picker.input.aria-label'),\n defaultMessage: 'Color picker input',\n })}\n style={{ textTransform: 'uppercase' }}\n value={value}\n placeholder=\"#000000\"\n onChange={onChange}\n />\n </Field.Root>\n </Flex>\n </ColorPickerPopover>\n </Popover.Root>\n <Field.Hint />\n <Field.Error />\n </Flex>\n </Field.Root>\n );\n }\n);\n"],"names":[],"mappings":";;;;;;;;;AAmBA,MAAM,eAAe,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,sBAKN,CAAC,UAAU,MAAM,KAAK;AAAA;AAAA;AAI5C,MAAM,cAAc,OAAO,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAO5B,CAAC,EAAE,YAAY,MAAM,OAAO,CAAC,CAAC;AAAA,cAC7B,CAAC,EAAE,YAAY,MAAM,OAAO,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA,qBAIvB,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aAAY;AAAA,gBACZ;AAAA,cAAA;AAAA,YAAA,GAEJ;AAAA,UAAA,GACF;AAAA,QAAA,GACF;AAAA,MAAA,GACF;AAAA,MACA,oBAAC,MAAM,MAAN,EAAW;AAAA,MACZ,oBAAC,MAAM,OAAN,EAAY;AAAA,IAAA,EACf,CAAA,EACF,CAAA;AAAA,EAEJ;AACF;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cs-CKl0OyEH.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cs-DMmE6LK7.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"en-BlDau3us.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"en-Ct0C5cA2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
3
|
const designSystem = require("@strapi/design-system");
|
|
4
4
|
const icons = require("@strapi/icons");
|
|
5
|
-
const
|
|
6
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
7
|
-
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
5
|
+
const styledComponents = require("styled-components");
|
|
8
6
|
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
|
9
7
|
const v = glob[path];
|
|
10
8
|
if (v) {
|
|
@@ -14,7 +12,7 @@ const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
|
|
14
12
|
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(reject.bind(null, new Error("Unknown variable dynamic import: " + path)));
|
|
15
13
|
});
|
|
16
14
|
};
|
|
17
|
-
const IconBox =
|
|
15
|
+
const IconBox = styledComponents.styled(designSystem.Flex)`
|
|
18
16
|
/* Hard code color values */
|
|
19
17
|
/* to stay consistent between themes */
|
|
20
18
|
background-color: #f0f0ff; /* primary100 */
|
|
@@ -25,7 +23,7 @@ const IconBox = styled__default.default(designSystem.Flex)`
|
|
|
25
23
|
}
|
|
26
24
|
`;
|
|
27
25
|
const ColorPickerIcon = () => {
|
|
28
|
-
return /* @__PURE__ */ jsxRuntime.jsx(IconBox, { justifyContent: "center", alignItems: "center", width: 7, height: 6, hasRadius: true, "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
26
|
+
return /* @__PURE__ */ jsxRuntime.jsx(IconBox, { justifyContent: "center", alignItems: "center", width: 7, height: 6, hasRadius: true, "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx(icons.PaintBrush, {}) });
|
|
29
27
|
};
|
|
30
28
|
const pluginId = "color-picker";
|
|
31
29
|
const getTrad = (id) => `${pluginId}.${id}`;
|
|
@@ -58,7 +56,7 @@ const index = {
|
|
|
58
56
|
defaultMessage: "Select any color"
|
|
59
57
|
},
|
|
60
58
|
components: {
|
|
61
|
-
Input: async () => Promise.resolve().then(() => require("./ColorPickerInput-
|
|
59
|
+
Input: async () => Promise.resolve().then(() => require("./ColorPickerInput-DUlALFSe.js")).then((module2) => ({
|
|
62
60
|
default: module2.ColorPickerInput
|
|
63
61
|
}))
|
|
64
62
|
},
|
|
@@ -104,7 +102,7 @@ const index = {
|
|
|
104
102
|
async registerTrads({ locales }) {
|
|
105
103
|
const importedTrads = await Promise.all(
|
|
106
104
|
locales.map((locale) => {
|
|
107
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/cs.json": () => Promise.resolve().then(() => require("./cs-
|
|
105
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/cs.json": () => Promise.resolve().then(() => require("./cs-CKl0OyEH.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-Ct0C5cA2.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("./ru-Wrg-npZz.js")), "./translations/sv.json": () => Promise.resolve().then(() => require("./sv-CKY6es_6.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("./tr-DcLzQS-J.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("./zh-T5cJzhPD.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
|
|
108
106
|
return {
|
|
109
107
|
data: prefixPluginTranslations(data, pluginId),
|
|
110
108
|
locale
|
|
@@ -122,4 +120,4 @@ const index = {
|
|
|
122
120
|
};
|
|
123
121
|
exports.getTrad = getTrad;
|
|
124
122
|
exports.index = index;
|
|
125
|
-
//# sourceMappingURL=index-
|
|
123
|
+
//# sourceMappingURL=index-DYgSCaYT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DYgSCaYT.js","sources":["../../admin/src/components/ColorPickerIcon.tsx","../../admin/src/pluginId.ts","../../admin/src/utils/getTrad.ts","../../admin/src/utils/prefixPluginTranslations.ts","../../admin/src/index.ts"],"sourcesContent":["import { Flex } from '@strapi/design-system';\nimport { PaintBrush } from '@strapi/icons';\nimport { styled } from 'styled-components';\n\nconst IconBox = styled(Flex)`\n /* Hard code color values */\n /* to stay consistent between themes */\n background-color: #f0f0ff; /* primary100 */\n border: 1px solid #d9d8ff; /* primary200 */\n\n svg > path {\n fill: #4945ff; /* primary600 */\n }\n`;\n\nexport const ColorPickerIcon = () => {\n return (\n <IconBox justifyContent=\"center\" alignItems=\"center\" width={7} height={6} hasRadius aria-hidden>\n <PaintBrush />\n </IconBox>\n );\n};\n","export const pluginId = 'color-picker';\n","import { pluginId } from '../pluginId';\n\nexport const getTrad = (id: string) => `${pluginId}.${id}`;\n","type TradOptions = Record<string, string>;\n\nconst prefixPluginTranslations = (trad: TradOptions, pluginId: string): TradOptions => {\n if (!pluginId) {\n throw new TypeError(\"pluginId can't be empty\");\n }\n return Object.keys(trad).reduce((acc, current) => {\n acc[`${pluginId}.${current}`] = trad[current];\n return acc;\n }, {} as TradOptions);\n};\n\nexport { prefixPluginTranslations };\n","import { ColorPickerIcon } from './components/ColorPickerIcon';\nimport { pluginId } from './pluginId';\nimport { getTrad } from './utils/getTrad';\nimport { prefixPluginTranslations } from './utils/prefixPluginTranslations';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n /**\n * TODO: we need to have the type for StrapiApp done from `@strapi/admin` package.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n register(app: any) {\n app.customFields.register({\n name: 'color',\n pluginId: 'color-picker',\n type: 'string',\n icon: ColorPickerIcon,\n intlLabel: {\n id: getTrad('color-picker.label'),\n defaultMessage: 'Color',\n },\n intlDescription: {\n id: getTrad('color-picker.description'),\n defaultMessage: 'Select any color',\n },\n components: {\n Input: async () =>\n import('./components/ColorPickerInput').then((module) => ({\n default: module.ColorPickerInput,\n })),\n },\n options: {\n advanced: [\n {\n intlLabel: {\n id: getTrad('color-picker.options.advanced.regex'),\n defaultMessage: 'RegExp pattern',\n },\n name: 'regex',\n type: 'text',\n defaultValue: '^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$',\n description: {\n id: getTrad('color-picker.options.advanced.regex.description'),\n defaultMessage: 'The text of the regular expression',\n },\n },\n {\n sectionTitle: {\n id: 'global.settings',\n defaultMessage: 'Settings',\n },\n items: [\n {\n name: 'required',\n type: 'checkbox',\n intlLabel: {\n id: getTrad('color-picker.options.advanced.requiredField'),\n defaultMessage: 'Required field',\n },\n description: {\n id: getTrad('color-picker.options.advanced.requiredField.description'),\n defaultMessage: \"You won't be able to create an entry if this field is empty\",\n },\n },\n ],\n },\n ],\n },\n });\n },\n async registerTrads({ locales }: { locales: string[] }) {\n const importedTrads = await Promise.all(\n locales.map((locale) => {\n return import(`./translations/${locale}.json`)\n .then(({ default: data }) => {\n return {\n data: prefixPluginTranslations(data, pluginId),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n\n return Promise.resolve(importedTrads);\n },\n};\n"],"names":["styled","Flex","jsx","PaintBrush","pluginId","module"],"mappings":";;;;;;;;;;;;;;AAIA,MAAM,UAAUA,iBAAAA,OAAOC,aAAAA,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWpB,MAAM,kBAAkB,MAAM;AACnC,wCACG,SAAQ,EAAA,gBAAe,UAAS,YAAW,UAAS,OAAO,GAAG,QAAQ,GAAG,WAAS,MAAC,eAAW,MAC7F,UAAAC,2BAAAA,IAACC,oBAAW,EACd,CAAA;AAEJ;ACrBO,MAAM,WAAW;ACEjB,MAAM,UAAU,CAAC,OAAe,GAAG,QAAQ,IAAI,EAAE;ACAxD,MAAM,2BAA2B,CAAC,MAAmBC,cAAkC;AACrF,MAAI,CAACA,WAAU;AACP,UAAA,IAAI,UAAU,yBAAyB;AAAA,EAC/C;AACA,SAAO,OAAO,KAAK,IAAI,EAAE,OAAO,CAAC,KAAK,YAAY;AAChD,QAAI,GAAGA,SAAQ,IAAI,OAAO,EAAE,IAAI,KAAK,OAAO;AACrC,WAAA;AAAA,EACT,GAAG,CAAiB,CAAA;AACtB;ACJA,MAAe,QAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKb,SAAS,KAAU;AACjB,QAAI,aAAa,SAAS;AAAA,MACxB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,MAAM;AAAA,MACN,MAAM;AAAA,MACN,WAAW;AAAA,QACT,IAAI,QAAQ,oBAAoB;AAAA,QAChC,gBAAgB;AAAA,MAClB;AAAA,MACA,iBAAiB;AAAA,QACf,IAAI,QAAQ,0BAA0B;AAAA,QACtC,gBAAgB;AAAA,MAClB;AAAA,MACA,YAAY;AAAA,QACV,OAAO,YACL,QAAO,QAAA,EAAA,KAAA,MAAA,QAAA,gCAA+B,CAAE,EAAA,KAAK,CAACC,aAAY;AAAA,UACxD,SAASA,QAAO;AAAA,QAAA,EAChB;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AA,GAAA,kBAAA,MAAA,OAAA,EACnC,KAAK,CAAC,EAAE,SAAS,WAAW;AACpB,iBAAA;AAAA,YACL,MAAM,yBAAyB,MAAM,QAAQ;AAAA,YAC7C;AAAA,UAAA;AAAA,QACF,CACD,EACA,MAAM,MAAM;AACJ,iBAAA;AAAA,YACL,MAAM,CAAC;AAAA,YACP;AAAA,UAAA;AAAA,QACF,CACD;AAAA,MAAA,CACJ;AAAA,IAAA;AAGI,WAAA,QAAQ,QAAQ,aAAa;AAAA,EACtC;AACF;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Flex
|
|
3
|
-
import {
|
|
4
|
-
import styled from "styled-components";
|
|
2
|
+
import { Flex } from "@strapi/design-system";
|
|
3
|
+
import { PaintBrush } from "@strapi/icons";
|
|
4
|
+
import { styled } from "styled-components";
|
|
5
5
|
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
|
6
6
|
const v = glob[path];
|
|
7
7
|
if (v) {
|
|
@@ -22,7 +22,7 @@ const IconBox = styled(Flex)`
|
|
|
22
22
|
}
|
|
23
23
|
`;
|
|
24
24
|
const ColorPickerIcon = () => {
|
|
25
|
-
return /* @__PURE__ */ jsx(IconBox, { justifyContent: "center", alignItems: "center", width: 7, height: 6, hasRadius: true, "aria-hidden": true, children: /* @__PURE__ */ jsx(
|
|
25
|
+
return /* @__PURE__ */ jsx(IconBox, { justifyContent: "center", alignItems: "center", width: 7, height: 6, hasRadius: true, "aria-hidden": true, children: /* @__PURE__ */ jsx(PaintBrush, {}) });
|
|
26
26
|
};
|
|
27
27
|
const pluginId = "color-picker";
|
|
28
28
|
const getTrad = (id) => `${pluginId}.${id}`;
|
|
@@ -55,7 +55,7 @@ const index = {
|
|
|
55
55
|
defaultMessage: "Select any color"
|
|
56
56
|
},
|
|
57
57
|
components: {
|
|
58
|
-
Input: async () => import("./ColorPickerInput-
|
|
58
|
+
Input: async () => import("./ColorPickerInput-K16FHrOs.mjs").then((module) => ({
|
|
59
59
|
default: module.ColorPickerInput
|
|
60
60
|
}))
|
|
61
61
|
},
|
|
@@ -101,7 +101,7 @@ const index = {
|
|
|
101
101
|
async registerTrads({ locales }) {
|
|
102
102
|
const importedTrads = await Promise.all(
|
|
103
103
|
locales.map((locale) => {
|
|
104
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/cs.json": () => import("./cs-
|
|
104
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/cs.json": () => import("./cs-DMmE6LK7.mjs"), "./translations/en.json": () => import("./en-BlDau3us.mjs"), "./translations/ru.json": () => import("./ru-aOnA-eym.mjs"), "./translations/sv.json": () => import("./sv-BaFDND79.mjs"), "./translations/tr.json": () => import("./tr-CHHW_hYI.mjs"), "./translations/zh.json": () => import("./zh-DBH6uCXb.mjs") }), `./translations/${locale}.json`).then(({ default: data }) => {
|
|
105
105
|
return {
|
|
106
106
|
data: prefixPluginTranslations(data, pluginId),
|
|
107
107
|
locale
|
|
@@ -121,4 +121,4 @@ export {
|
|
|
121
121
|
getTrad as g,
|
|
122
122
|
index as i
|
|
123
123
|
};
|
|
124
|
-
//# sourceMappingURL=index-
|
|
124
|
+
//# sourceMappingURL=index-kjptSDR8.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-kjptSDR8.mjs","sources":["../../admin/src/components/ColorPickerIcon.tsx","../../admin/src/pluginId.ts","../../admin/src/utils/getTrad.ts","../../admin/src/utils/prefixPluginTranslations.ts","../../admin/src/index.ts"],"sourcesContent":["import { Flex } from '@strapi/design-system';\nimport { PaintBrush } from '@strapi/icons';\nimport { styled } from 'styled-components';\n\nconst IconBox = styled(Flex)`\n /* Hard code color values */\n /* to stay consistent between themes */\n background-color: #f0f0ff; /* primary100 */\n border: 1px solid #d9d8ff; /* primary200 */\n\n svg > path {\n fill: #4945ff; /* primary600 */\n }\n`;\n\nexport const ColorPickerIcon = () => {\n return (\n <IconBox justifyContent=\"center\" alignItems=\"center\" width={7} height={6} hasRadius aria-hidden>\n <PaintBrush />\n </IconBox>\n );\n};\n","export const pluginId = 'color-picker';\n","import { pluginId } from '../pluginId';\n\nexport const getTrad = (id: string) => `${pluginId}.${id}`;\n","type TradOptions = Record<string, string>;\n\nconst prefixPluginTranslations = (trad: TradOptions, pluginId: string): TradOptions => {\n if (!pluginId) {\n throw new TypeError(\"pluginId can't be empty\");\n }\n return Object.keys(trad).reduce((acc, current) => {\n acc[`${pluginId}.${current}`] = trad[current];\n return acc;\n }, {} as TradOptions);\n};\n\nexport { prefixPluginTranslations };\n","import { ColorPickerIcon } from './components/ColorPickerIcon';\nimport { pluginId } from './pluginId';\nimport { getTrad } from './utils/getTrad';\nimport { prefixPluginTranslations } from './utils/prefixPluginTranslations';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n /**\n * TODO: we need to have the type for StrapiApp done from `@strapi/admin` package.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n register(app: any) {\n app.customFields.register({\n name: 'color',\n pluginId: 'color-picker',\n type: 'string',\n icon: ColorPickerIcon,\n intlLabel: {\n id: getTrad('color-picker.label'),\n defaultMessage: 'Color',\n },\n intlDescription: {\n id: getTrad('color-picker.description'),\n defaultMessage: 'Select any color',\n },\n components: {\n Input: async () =>\n import('./components/ColorPickerInput').then((module) => ({\n default: module.ColorPickerInput,\n })),\n },\n options: {\n advanced: [\n {\n intlLabel: {\n id: getTrad('color-picker.options.advanced.regex'),\n defaultMessage: 'RegExp pattern',\n },\n name: 'regex',\n type: 'text',\n defaultValue: '^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$',\n description: {\n id: getTrad('color-picker.options.advanced.regex.description'),\n defaultMessage: 'The text of the regular expression',\n },\n },\n {\n sectionTitle: {\n id: 'global.settings',\n defaultMessage: 'Settings',\n },\n items: [\n {\n name: 'required',\n type: 'checkbox',\n intlLabel: {\n id: getTrad('color-picker.options.advanced.requiredField'),\n defaultMessage: 'Required field',\n },\n description: {\n id: getTrad('color-picker.options.advanced.requiredField.description'),\n defaultMessage: \"You won't be able to create an entry if this field is empty\",\n },\n },\n ],\n },\n ],\n },\n });\n },\n async registerTrads({ locales }: { locales: string[] }) {\n const importedTrads = await Promise.all(\n locales.map((locale) => {\n return import(`./translations/${locale}.json`)\n .then(({ default: data }) => {\n return {\n data: prefixPluginTranslations(data, pluginId),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n\n return Promise.resolve(importedTrads);\n },\n};\n"],"names":["pluginId"],"mappings":";;;;;;;;;;;;;AAIA,MAAM,UAAU,OAAO,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWpB,MAAM,kBAAkB,MAAM;AACnC,6BACG,SAAQ,EAAA,gBAAe,UAAS,YAAW,UAAS,OAAO,GAAG,QAAQ,GAAG,WAAS,MAAC,eAAW,MAC7F,UAAA,oBAAC,cAAW,EACd,CAAA;AAEJ;ACrBO,MAAM,WAAW;ACEjB,MAAM,UAAU,CAAC,OAAe,GAAG,QAAQ,IAAI,EAAE;ACAxD,MAAM,2BAA2B,CAAC,MAAmBA,cAAkC;AACrF,MAAI,CAACA,WAAU;AACP,UAAA,IAAI,UAAU,yBAAyB;AAAA,EAC/C;AACA,SAAO,OAAO,KAAK,IAAI,EAAE,OAAO,CAAC,KAAK,YAAY;AAChD,QAAI,GAAGA,SAAQ,IAAI,OAAO,EAAE,IAAI,KAAK,OAAO;AACrC,WAAA;AAAA,EACT,GAAG,CAAiB,CAAA;AACtB;ACJA,MAAe,QAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKb,SAAS,KAAU;AACjB,QAAI,aAAa,SAAS;AAAA,MACxB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,MAAM;AAAA,MACN,MAAM;AAAA,MACN,WAAW;AAAA,QACT,IAAI,QAAQ,oBAAoB;AAAA,QAChC,gBAAgB;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A,CAAA,GAAA,kBAAA,MAAA,OAAA,EACnC,KAAK,CAAC,EAAE,SAAS,WAAW;AACpB,iBAAA;AAAA,YACL,MAAM,yBAAyB,MAAM,QAAQ;AAAA,YAC7C;AAAA,UAAA;AAAA,QACF,CACD,EACA,MAAM,MAAM;AACJ,iBAAA;AAAA,YACL,MAAM,CAAC;AAAA,YACP;AAAA,UAAA;AAAA,QACF,CACD;AAAA,MAAA,CACJ;AAAA,IAAA;AAGI,WAAA,QAAQ,QAAQ,aAAa;AAAA,EACtC;AACF;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ru-Wrg-npZz.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ru-aOnA-eym.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sv-BaFDND79.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sv-CKY6es_6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tr-CHHW_hYI.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tr-DcLzQS-J.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zh-DBH6uCXb.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zh-T5cJzhPD.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
package/dist/admin/index.js
CHANGED
package/dist/admin/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/plugin-color-picker",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.11",
|
|
4
4
|
"description": "Strapi maintained Custom Fields",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"strapi-server.js"
|
|
43
43
|
],
|
|
44
44
|
"scripts": {
|
|
45
|
-
"build": "strapi
|
|
45
|
+
"build": "strapi-plugin build",
|
|
46
46
|
"clean": "run -T rimraf ./dist",
|
|
47
47
|
"lint": "run -T eslint .",
|
|
48
48
|
"test:front": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js",
|
|
@@ -50,23 +50,23 @@
|
|
|
50
50
|
"test:front:watch": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js --watchAll",
|
|
51
51
|
"test:front:watch:ce": "run -T cross-env IS_EE=false jest --config ./jest.config.front.js --watchAll",
|
|
52
52
|
"test:ts:front": "run -T tsc -p admin/tsconfig.json",
|
|
53
|
-
"watch": "strapi
|
|
53
|
+
"watch": "strapi-plugin watch"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@strapi/design-system": "
|
|
57
|
-
"@strapi/icons": "
|
|
56
|
+
"@strapi/design-system": "2.0.0-beta.6",
|
|
57
|
+
"@strapi/icons": "2.0.0-beta.6",
|
|
58
58
|
"react-colorful": "5.6.1",
|
|
59
59
|
"react-intl": "6.6.2"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@strapi/
|
|
63
|
-
"@
|
|
64
|
-
"@testing-library/
|
|
65
|
-
"@
|
|
66
|
-
"react": "
|
|
67
|
-
"react-dom": "
|
|
62
|
+
"@strapi/sdk-plugin": "^5.0.0",
|
|
63
|
+
"@strapi/strapi": "5.0.0-beta.11",
|
|
64
|
+
"@testing-library/react": "15.0.7",
|
|
65
|
+
"@testing-library/user-event": "14.5.2",
|
|
66
|
+
"react": "18.3.1",
|
|
67
|
+
"react-dom": "18.3.1",
|
|
68
68
|
"react-router-dom": "6.22.3",
|
|
69
|
-
"styled-components": "
|
|
69
|
+
"styled-components": "6.1.8",
|
|
70
70
|
"typescript": "5.3.2"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"react": "^17.0.0 || ^18.0.0",
|
|
75
75
|
"react-dom": "^17.0.0 || ^18.0.0",
|
|
76
76
|
"react-router-dom": "^6.0.0",
|
|
77
|
-
"styled-components": "^
|
|
77
|
+
"styled-components": "^6.0.0"
|
|
78
78
|
},
|
|
79
79
|
"engines": {
|
|
80
80
|
"node": ">=18.0.0 <=20.x.x",
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"kind": "plugin",
|
|
87
87
|
"displayName": "Color Picker"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "0991f0ac0f739e43e6a5f9ac79acb8c774c359bf"
|
|
90
90
|
}
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const React = require("react");
|
|
5
|
-
const designSystem = require("@strapi/design-system");
|
|
6
|
-
const icons = require("@strapi/icons");
|
|
7
|
-
const admin = require("@strapi/strapi/admin");
|
|
8
|
-
const reactColorful = require("react-colorful");
|
|
9
|
-
const reactIntl = require("react-intl");
|
|
10
|
-
const styled = require("styled-components");
|
|
11
|
-
const index = require("./index-rhrQWlM_.js");
|
|
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
|
-
const ColorPreview = styled__default.default.div`
|
|
34
|
-
border-radius: 50%;
|
|
35
|
-
width: 20px;
|
|
36
|
-
height: 20px;
|
|
37
|
-
margin-right: 10px;
|
|
38
|
-
background-color: ${(props) => props.color};
|
|
39
|
-
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
40
|
-
`;
|
|
41
|
-
const ColorPicker = styled__default.default(reactColorful.HexColorPicker)`
|
|
42
|
-
&& {
|
|
43
|
-
width: 100%;
|
|
44
|
-
aspect-ratio: 1.5;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.react-colorful__pointer {
|
|
48
|
-
width: ${({ theme }) => theme.spaces[3]};
|
|
49
|
-
height: ${({ theme }) => theme.spaces[3]};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.react-colorful__saturation {
|
|
53
|
-
border-radius: ${({ theme }) => theme.spaces[1]};
|
|
54
|
-
border-bottom: none;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.react-colorful__hue {
|
|
58
|
-
border-radius: 10px;
|
|
59
|
-
height: ${({ theme }) => theme.spaces[3]};
|
|
60
|
-
margin-top: ${({ theme }) => theme.spaces[2]};
|
|
61
|
-
}
|
|
62
|
-
`;
|
|
63
|
-
const ColorPickerToggle = styled__default.default(designSystem.BaseButton)`
|
|
64
|
-
display: flex;
|
|
65
|
-
justify-content: space-between;
|
|
66
|
-
align-items: center;
|
|
67
|
-
|
|
68
|
-
svg {
|
|
69
|
-
width: ${({ theme }) => theme.spaces[2]};
|
|
70
|
-
height: ${({ theme }) => theme.spaces[2]};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
svg > path {
|
|
74
|
-
fill: ${({ theme }) => theme.colors.neutral500};
|
|
75
|
-
justify-self: flex-end;
|
|
76
|
-
}
|
|
77
|
-
`;
|
|
78
|
-
const ColorPickerPopover = styled__default.default(designSystem.Popover)`
|
|
79
|
-
padding: ${({ theme }) => theme.spaces[2]};
|
|
80
|
-
min-height: 270px;
|
|
81
|
-
`;
|
|
82
|
-
const ColorPickerInput = React__namespace.forwardRef(
|
|
83
|
-
({ hint, disabled = false, labelAction, label, name, required = false }, forwardedRef) => {
|
|
84
|
-
const { onChange, value, error } = admin.useField(name);
|
|
85
|
-
const [showColorPicker, setShowColorPicker] = React__namespace.useState(false);
|
|
86
|
-
const colorPickerButtonRef = React__namespace.useRef(null);
|
|
87
|
-
const { formatMessage } = reactIntl.useIntl();
|
|
88
|
-
const color = value || "#000000";
|
|
89
|
-
const handleBlur = (e) => {
|
|
90
|
-
e.preventDefault();
|
|
91
|
-
if (!e.currentTarget.contains(e.relatedTarget)) {
|
|
92
|
-
setShowColorPicker(false);
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
const composedRefs = designSystem.useComposedRefs(forwardedRef, colorPickerButtonRef);
|
|
96
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
97
|
-
designSystem.Field,
|
|
98
|
-
{
|
|
99
|
-
name,
|
|
100
|
-
id: name,
|
|
101
|
-
error,
|
|
102
|
-
hint,
|
|
103
|
-
required,
|
|
104
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
|
105
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.FieldLabel, { action: labelAction, children: label }),
|
|
106
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
107
|
-
ColorPickerToggle,
|
|
108
|
-
{
|
|
109
|
-
ref: composedRefs,
|
|
110
|
-
"aria-label": formatMessage({
|
|
111
|
-
id: index.getTrad("color-picker.toggle.aria-label"),
|
|
112
|
-
defaultMessage: "Color picker toggle"
|
|
113
|
-
}),
|
|
114
|
-
"aria-controls": "color-picker-value",
|
|
115
|
-
"aria-haspopup": "dialog",
|
|
116
|
-
"aria-expanded": showColorPicker,
|
|
117
|
-
"aria-disabled": disabled,
|
|
118
|
-
disabled,
|
|
119
|
-
onClick: () => setShowColorPicker(!showColorPicker),
|
|
120
|
-
children: [
|
|
121
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { children: [
|
|
122
|
-
/* @__PURE__ */ jsxRuntime.jsx(ColorPreview, { color }),
|
|
123
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
124
|
-
designSystem.Typography,
|
|
125
|
-
{
|
|
126
|
-
style: { textTransform: "uppercase" },
|
|
127
|
-
textColor: value ? void 0 : "neutral600",
|
|
128
|
-
variant: "omega",
|
|
129
|
-
children: color
|
|
130
|
-
}
|
|
131
|
-
)
|
|
132
|
-
] }),
|
|
133
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.CarretDown, { "aria-hidden": true })
|
|
134
|
-
]
|
|
135
|
-
}
|
|
136
|
-
),
|
|
137
|
-
showColorPicker && /* @__PURE__ */ jsxRuntime.jsx(
|
|
138
|
-
ColorPickerPopover,
|
|
139
|
-
{
|
|
140
|
-
onBlur: handleBlur,
|
|
141
|
-
role: "dialog",
|
|
142
|
-
source: colorPickerButtonRef,
|
|
143
|
-
spacing: 4,
|
|
144
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.FocusTrap, { onEscape: () => setShowColorPicker(false), children: [
|
|
145
|
-
/* @__PURE__ */ jsxRuntime.jsx(ColorPicker, { color, onChange: (hexValue) => onChange(name, hexValue) }),
|
|
146
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { paddingTop: 3, paddingLeft: 4, justifyContent: "flex-end", children: [
|
|
147
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingRight: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", as: "label", textColor: "neutral600", children: formatMessage({
|
|
148
|
-
id: index.getTrad("color-picker.input.format"),
|
|
149
|
-
defaultMessage: "HEX"
|
|
150
|
-
}) }) }),
|
|
151
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
152
|
-
designSystem.FieldInput,
|
|
153
|
-
{
|
|
154
|
-
id: "color-picker-value",
|
|
155
|
-
"aria-label": formatMessage({
|
|
156
|
-
id: index.getTrad("color-picker.input.aria-label"),
|
|
157
|
-
defaultMessage: "Color picker input"
|
|
158
|
-
}),
|
|
159
|
-
style: { textTransform: "uppercase" },
|
|
160
|
-
value,
|
|
161
|
-
placeholder: "#000000",
|
|
162
|
-
onChange
|
|
163
|
-
}
|
|
164
|
-
)
|
|
165
|
-
] })
|
|
166
|
-
] })
|
|
167
|
-
}
|
|
168
|
-
),
|
|
169
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.FieldHint, {}),
|
|
170
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.FieldError, {})
|
|
171
|
-
] })
|
|
172
|
-
}
|
|
173
|
-
);
|
|
174
|
-
}
|
|
175
|
-
);
|
|
176
|
-
exports.ColorPickerInput = ColorPickerInput;
|
|
177
|
-
//# sourceMappingURL=ColorPickerInput-QRiGH2qL.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPickerInput-QRiGH2qL.js","sources":["../../admin/src/components/ColorPickerInput.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n BaseButton,\n Box,\n Field,\n FieldError,\n FieldHint,\n FieldInput,\n FieldLabel,\n Flex,\n FocusTrap,\n Popover,\n Typography,\n useComposedRefs,\n} from '@strapi/design-system';\nimport { CarretDown } from '@strapi/icons';\nimport { useField, type InputProps } from '@strapi/strapi/admin';\nimport { HexColorPicker } from 'react-colorful';\nimport { useIntl } from 'react-intl';\nimport styled from 'styled-components';\n\nimport { getTrad } from '../utils/getTrad';\n\nconst ColorPreview = styled.div`\n border-radius: 50%;\n width: 20px;\n height: 20px;\n margin-right: 10px;\n background-color: ${(props) => props.color};\n border: 1px solid rgba(0, 0, 0, 0.1);\n`;\n\nconst ColorPicker = styled(HexColorPicker)`\n && {\n width: 100%;\n aspect-ratio: 1.5;\n }\n\n .react-colorful__pointer {\n width: ${({ theme }) => theme.spaces[3]};\n height: ${({ theme }) => theme.spaces[3]};\n }\n\n .react-colorful__saturation {\n border-radius: ${({ theme }) => theme.spaces[1]};\n border-bottom: none;\n }\n\n .react-colorful__hue {\n border-radius: 10px;\n height: ${({ theme }) => theme.spaces[3]};\n margin-top: ${({ theme }) => theme.spaces[2]};\n }\n`;\n\nconst ColorPickerToggle = styled(BaseButton)`\n display: flex;\n justify-content: space-between;\n align-items: center;\n\n svg {\n width: ${({ theme }) => theme.spaces[2]};\n height: ${({ theme }) => theme.spaces[2]};\n }\n\n svg > path {\n fill: ${({ theme }) => theme.colors.neutral500};\n justify-self: flex-end;\n }\n`;\n\nconst ColorPickerPopover = styled(Popover)`\n padding: ${({ theme }) => theme.spaces[2]};\n min-height: 270px;\n`;\n\ntype ColorPickerInputProps = InputProps & {\n labelAction?: React.ReactNode;\n};\n\nexport const ColorPickerInput = React.forwardRef<HTMLButtonElement, ColorPickerInputProps>(\n ({ hint, disabled = false, labelAction, label, name, required = false }, forwardedRef) => {\n const { onChange, value, error } = useField(name);\n const [showColorPicker, setShowColorPicker] = React.useState(false);\n const colorPickerButtonRef = React.useRef<HTMLButtonElement>(null!);\n const { formatMessage } = useIntl();\n const color = value || '#000000';\n\n const handleBlur: React.FocusEventHandler<HTMLDivElement> = (e) => {\n e.preventDefault();\n\n if (!e.currentTarget.contains(e.relatedTarget)) {\n setShowColorPicker(false);\n }\n };\n\n const composedRefs = useComposedRefs(forwardedRef, colorPickerButtonRef);\n\n return (\n <Field\n name={name}\n id={name}\n // GenericInput calls formatMessage and returns a string for the error\n error={error}\n hint={hint}\n required={required}\n >\n <Flex direction=\"column\" alignItems=\"stretch\" gap={1}>\n <FieldLabel action={labelAction}>{label}</FieldLabel>\n <ColorPickerToggle\n ref={composedRefs}\n aria-label={formatMessage({\n id: getTrad('color-picker.toggle.aria-label'),\n defaultMessage: 'Color picker toggle',\n })}\n aria-controls=\"color-picker-value\"\n aria-haspopup=\"dialog\"\n aria-expanded={showColorPicker}\n aria-disabled={disabled}\n disabled={disabled}\n onClick={() => setShowColorPicker(!showColorPicker)}\n >\n <Flex>\n <ColorPreview color={color} />\n <Typography\n style={{ textTransform: 'uppercase' }}\n textColor={value ? undefined : 'neutral600'}\n variant=\"omega\"\n >\n {color}\n </Typography>\n </Flex>\n <CarretDown aria-hidden />\n </ColorPickerToggle>\n {showColorPicker && (\n <ColorPickerPopover\n onBlur={handleBlur}\n role=\"dialog\"\n source={colorPickerButtonRef}\n spacing={4}\n >\n <FocusTrap onEscape={() => setShowColorPicker(false)}>\n <ColorPicker color={color} onChange={(hexValue) => onChange(name, hexValue)} />\n <Flex paddingTop={3} paddingLeft={4} justifyContent=\"flex-end\">\n <Box paddingRight={2}>\n <Typography variant=\"omega\" as=\"label\" textColor=\"neutral600\">\n {formatMessage({\n id: getTrad('color-picker.input.format'),\n defaultMessage: 'HEX',\n })}\n </Typography>\n </Box>\n <FieldInput\n id=\"color-picker-value\"\n aria-label={formatMessage({\n id: getTrad('color-picker.input.aria-label'),\n defaultMessage: 'Color picker input',\n })}\n style={{ textTransform: 'uppercase' }}\n value={value}\n placeholder=\"#000000\"\n onChange={onChange}\n />\n </Flex>\n </FocusTrap>\n </ColorPickerPopover>\n )}\n <FieldHint />\n <FieldError />\n </Flex>\n </Field>\n );\n }\n);\n"],"names":["styled","HexColorPicker","BaseButton","Popover","React","useField","useIntl","useComposedRefs","jsx","Field","Flex","FieldLabel","jsxs","getTrad","Typography","CarretDown","FocusTrap","Box","FieldInput","FieldHint","FieldError"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,eAAeA,gBAAO,QAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAKN,CAAC,UAAU,MAAM,KAAK;AAAA;AAAA;AAI5C,MAAM,cAAcA,gBAAAA,QAAOC,cAAAA,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAO5B,CAAC,EAAE,YAAY,MAAM,OAAO,CAAC,CAAC;AAAA,cAC7B,CAAC,EAAE,YAAY,MAAM,OAAO,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA,qBAIvB,CAAC,EAAE,YAAY,MAAM,OAAO,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAMrC,CAAC,EAAE,YAAY,MAAM,OAAO,CAAC,CAAC;AAAA,kBAC1B,CAAC,EAAE,YAAY,MAAM,OAAO,CAAC,CAAC;AAAA;AAAA;AAIhD,MAAM,oBAAoBD,gBAAAA,QAAOE,aAAAA,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAM9B,CAAC,EAAE,YAAY,MAAM,OAAO,CAAC,CAAC;AAAA,cAC7B,CAAC,EAAE,YAAY,MAAM,OAAO,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA,YAIhC,CAAC,EAAE,MAAA,MAAY,MAAM,OAAO,UAAU;AAAA;AAAA;AAAA;AAKlD,MAAM,qBAAqBF,gBAAAA,QAAOG,aAAAA,OAAO;AAAA,aAC5B,CAAC,EAAE,YAAY,MAAM,OAAO,CAAC,CAAC;AAAA;AAAA;AAQpC,MAAM,mBAAmBC,iBAAM;AAAA,EACpC,CAAC,EAAE,MAAM,WAAW,OAAO,aAAa,OAAO,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GN;AACF;;"}
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { BaseButton, Popover, useComposedRefs, Field, Flex, FieldLabel, Typography, FocusTrap, Box, FieldInput, FieldHint, FieldError } from "@strapi/design-system";
|
|
4
|
-
import { CarretDown } from "@strapi/icons";
|
|
5
|
-
import { useField } from "@strapi/strapi/admin";
|
|
6
|
-
import { HexColorPicker } from "react-colorful";
|
|
7
|
-
import { useIntl } from "react-intl";
|
|
8
|
-
import styled from "styled-components";
|
|
9
|
-
import { g as getTrad } from "./index-2Qkvylxv.mjs";
|
|
10
|
-
const ColorPreview = styled.div`
|
|
11
|
-
border-radius: 50%;
|
|
12
|
-
width: 20px;
|
|
13
|
-
height: 20px;
|
|
14
|
-
margin-right: 10px;
|
|
15
|
-
background-color: ${(props) => props.color};
|
|
16
|
-
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
17
|
-
`;
|
|
18
|
-
const ColorPicker = styled(HexColorPicker)`
|
|
19
|
-
&& {
|
|
20
|
-
width: 100%;
|
|
21
|
-
aspect-ratio: 1.5;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.react-colorful__pointer {
|
|
25
|
-
width: ${({ theme }) => theme.spaces[3]};
|
|
26
|
-
height: ${({ theme }) => theme.spaces[3]};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.react-colorful__saturation {
|
|
30
|
-
border-radius: ${({ theme }) => theme.spaces[1]};
|
|
31
|
-
border-bottom: none;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.react-colorful__hue {
|
|
35
|
-
border-radius: 10px;
|
|
36
|
-
height: ${({ theme }) => theme.spaces[3]};
|
|
37
|
-
margin-top: ${({ theme }) => theme.spaces[2]};
|
|
38
|
-
}
|
|
39
|
-
`;
|
|
40
|
-
const ColorPickerToggle = styled(BaseButton)`
|
|
41
|
-
display: flex;
|
|
42
|
-
justify-content: space-between;
|
|
43
|
-
align-items: center;
|
|
44
|
-
|
|
45
|
-
svg {
|
|
46
|
-
width: ${({ theme }) => theme.spaces[2]};
|
|
47
|
-
height: ${({ theme }) => theme.spaces[2]};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
svg > path {
|
|
51
|
-
fill: ${({ theme }) => theme.colors.neutral500};
|
|
52
|
-
justify-self: flex-end;
|
|
53
|
-
}
|
|
54
|
-
`;
|
|
55
|
-
const ColorPickerPopover = styled(Popover)`
|
|
56
|
-
padding: ${({ theme }) => theme.spaces[2]};
|
|
57
|
-
min-height: 270px;
|
|
58
|
-
`;
|
|
59
|
-
const ColorPickerInput = React.forwardRef(
|
|
60
|
-
({ hint, disabled = false, labelAction, label, name, required = false }, forwardedRef) => {
|
|
61
|
-
const { onChange, value, error } = useField(name);
|
|
62
|
-
const [showColorPicker, setShowColorPicker] = React.useState(false);
|
|
63
|
-
const colorPickerButtonRef = React.useRef(null);
|
|
64
|
-
const { formatMessage } = useIntl();
|
|
65
|
-
const color = value || "#000000";
|
|
66
|
-
const handleBlur = (e) => {
|
|
67
|
-
e.preventDefault();
|
|
68
|
-
if (!e.currentTarget.contains(e.relatedTarget)) {
|
|
69
|
-
setShowColorPicker(false);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
const composedRefs = useComposedRefs(forwardedRef, colorPickerButtonRef);
|
|
73
|
-
return /* @__PURE__ */ jsx(
|
|
74
|
-
Field,
|
|
75
|
-
{
|
|
76
|
-
name,
|
|
77
|
-
id: name,
|
|
78
|
-
error,
|
|
79
|
-
hint,
|
|
80
|
-
required,
|
|
81
|
-
children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
|
82
|
-
/* @__PURE__ */ jsx(FieldLabel, { action: labelAction, children: label }),
|
|
83
|
-
/* @__PURE__ */ jsxs(
|
|
84
|
-
ColorPickerToggle,
|
|
85
|
-
{
|
|
86
|
-
ref: composedRefs,
|
|
87
|
-
"aria-label": formatMessage({
|
|
88
|
-
id: getTrad("color-picker.toggle.aria-label"),
|
|
89
|
-
defaultMessage: "Color picker toggle"
|
|
90
|
-
}),
|
|
91
|
-
"aria-controls": "color-picker-value",
|
|
92
|
-
"aria-haspopup": "dialog",
|
|
93
|
-
"aria-expanded": showColorPicker,
|
|
94
|
-
"aria-disabled": disabled,
|
|
95
|
-
disabled,
|
|
96
|
-
onClick: () => setShowColorPicker(!showColorPicker),
|
|
97
|
-
children: [
|
|
98
|
-
/* @__PURE__ */ jsxs(Flex, { children: [
|
|
99
|
-
/* @__PURE__ */ jsx(ColorPreview, { color }),
|
|
100
|
-
/* @__PURE__ */ jsx(
|
|
101
|
-
Typography,
|
|
102
|
-
{
|
|
103
|
-
style: { textTransform: "uppercase" },
|
|
104
|
-
textColor: value ? void 0 : "neutral600",
|
|
105
|
-
variant: "omega",
|
|
106
|
-
children: color
|
|
107
|
-
}
|
|
108
|
-
)
|
|
109
|
-
] }),
|
|
110
|
-
/* @__PURE__ */ jsx(CarretDown, { "aria-hidden": true })
|
|
111
|
-
]
|
|
112
|
-
}
|
|
113
|
-
),
|
|
114
|
-
showColorPicker && /* @__PURE__ */ jsx(
|
|
115
|
-
ColorPickerPopover,
|
|
116
|
-
{
|
|
117
|
-
onBlur: handleBlur,
|
|
118
|
-
role: "dialog",
|
|
119
|
-
source: colorPickerButtonRef,
|
|
120
|
-
spacing: 4,
|
|
121
|
-
children: /* @__PURE__ */ jsxs(FocusTrap, { onEscape: () => setShowColorPicker(false), children: [
|
|
122
|
-
/* @__PURE__ */ jsx(ColorPicker, { color, onChange: (hexValue) => onChange(name, hexValue) }),
|
|
123
|
-
/* @__PURE__ */ jsxs(Flex, { paddingTop: 3, paddingLeft: 4, justifyContent: "flex-end", children: [
|
|
124
|
-
/* @__PURE__ */ jsx(Box, { paddingRight: 2, children: /* @__PURE__ */ jsx(Typography, { variant: "omega", as: "label", textColor: "neutral600", children: formatMessage({
|
|
125
|
-
id: getTrad("color-picker.input.format"),
|
|
126
|
-
defaultMessage: "HEX"
|
|
127
|
-
}) }) }),
|
|
128
|
-
/* @__PURE__ */ jsx(
|
|
129
|
-
FieldInput,
|
|
130
|
-
{
|
|
131
|
-
id: "color-picker-value",
|
|
132
|
-
"aria-label": formatMessage({
|
|
133
|
-
id: getTrad("color-picker.input.aria-label"),
|
|
134
|
-
defaultMessage: "Color picker input"
|
|
135
|
-
}),
|
|
136
|
-
style: { textTransform: "uppercase" },
|
|
137
|
-
value,
|
|
138
|
-
placeholder: "#000000",
|
|
139
|
-
onChange
|
|
140
|
-
}
|
|
141
|
-
)
|
|
142
|
-
] })
|
|
143
|
-
] })
|
|
144
|
-
}
|
|
145
|
-
),
|
|
146
|
-
/* @__PURE__ */ jsx(FieldHint, {}),
|
|
147
|
-
/* @__PURE__ */ jsx(FieldError, {})
|
|
148
|
-
] })
|
|
149
|
-
}
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
);
|
|
153
|
-
export {
|
|
154
|
-
ColorPickerInput
|
|
155
|
-
};
|
|
156
|
-
//# sourceMappingURL=ColorPickerInput-RhMUg8K_.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPickerInput-RhMUg8K_.mjs","sources":["../../admin/src/components/ColorPickerInput.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n BaseButton,\n Box,\n Field,\n FieldError,\n FieldHint,\n FieldInput,\n FieldLabel,\n Flex,\n FocusTrap,\n Popover,\n Typography,\n useComposedRefs,\n} from '@strapi/design-system';\nimport { CarretDown } from '@strapi/icons';\nimport { useField, type InputProps } from '@strapi/strapi/admin';\nimport { HexColorPicker } from 'react-colorful';\nimport { useIntl } from 'react-intl';\nimport styled from 'styled-components';\n\nimport { getTrad } from '../utils/getTrad';\n\nconst ColorPreview = styled.div`\n border-radius: 50%;\n width: 20px;\n height: 20px;\n margin-right: 10px;\n background-color: ${(props) => props.color};\n border: 1px solid rgba(0, 0, 0, 0.1);\n`;\n\nconst ColorPicker = styled(HexColorPicker)`\n && {\n width: 100%;\n aspect-ratio: 1.5;\n }\n\n .react-colorful__pointer {\n width: ${({ theme }) => theme.spaces[3]};\n height: ${({ theme }) => theme.spaces[3]};\n }\n\n .react-colorful__saturation {\n border-radius: ${({ theme }) => theme.spaces[1]};\n border-bottom: none;\n }\n\n .react-colorful__hue {\n border-radius: 10px;\n height: ${({ theme }) => theme.spaces[3]};\n margin-top: ${({ theme }) => theme.spaces[2]};\n }\n`;\n\nconst ColorPickerToggle = styled(BaseButton)`\n display: flex;\n justify-content: space-between;\n align-items: center;\n\n svg {\n width: ${({ theme }) => theme.spaces[2]};\n height: ${({ theme }) => theme.spaces[2]};\n }\n\n svg > path {\n fill: ${({ theme }) => theme.colors.neutral500};\n justify-self: flex-end;\n }\n`;\n\nconst ColorPickerPopover = styled(Popover)`\n padding: ${({ theme }) => theme.spaces[2]};\n min-height: 270px;\n`;\n\ntype ColorPickerInputProps = InputProps & {\n labelAction?: React.ReactNode;\n};\n\nexport const ColorPickerInput = React.forwardRef<HTMLButtonElement, ColorPickerInputProps>(\n ({ hint, disabled = false, labelAction, label, name, required = false }, forwardedRef) => {\n const { onChange, value, error } = useField(name);\n const [showColorPicker, setShowColorPicker] = React.useState(false);\n const colorPickerButtonRef = React.useRef<HTMLButtonElement>(null!);\n const { formatMessage } = useIntl();\n const color = value || '#000000';\n\n const handleBlur: React.FocusEventHandler<HTMLDivElement> = (e) => {\n e.preventDefault();\n\n if (!e.currentTarget.contains(e.relatedTarget)) {\n setShowColorPicker(false);\n }\n };\n\n const composedRefs = useComposedRefs(forwardedRef, colorPickerButtonRef);\n\n return (\n <Field\n name={name}\n id={name}\n // GenericInput calls formatMessage and returns a string for the error\n error={error}\n hint={hint}\n required={required}\n >\n <Flex direction=\"column\" alignItems=\"stretch\" gap={1}>\n <FieldLabel action={labelAction}>{label}</FieldLabel>\n <ColorPickerToggle\n ref={composedRefs}\n aria-label={formatMessage({\n id: getTrad('color-picker.toggle.aria-label'),\n defaultMessage: 'Color picker toggle',\n })}\n aria-controls=\"color-picker-value\"\n aria-haspopup=\"dialog\"\n aria-expanded={showColorPicker}\n aria-disabled={disabled}\n disabled={disabled}\n onClick={() => setShowColorPicker(!showColorPicker)}\n >\n <Flex>\n <ColorPreview color={color} />\n <Typography\n style={{ textTransform: 'uppercase' }}\n textColor={value ? undefined : 'neutral600'}\n variant=\"omega\"\n >\n {color}\n </Typography>\n </Flex>\n <CarretDown aria-hidden />\n </ColorPickerToggle>\n {showColorPicker && (\n <ColorPickerPopover\n onBlur={handleBlur}\n role=\"dialog\"\n source={colorPickerButtonRef}\n spacing={4}\n >\n <FocusTrap onEscape={() => setShowColorPicker(false)}>\n <ColorPicker color={color} onChange={(hexValue) => onChange(name, hexValue)} />\n <Flex paddingTop={3} paddingLeft={4} justifyContent=\"flex-end\">\n <Box paddingRight={2}>\n <Typography variant=\"omega\" as=\"label\" textColor=\"neutral600\">\n {formatMessage({\n id: getTrad('color-picker.input.format'),\n defaultMessage: 'HEX',\n })}\n </Typography>\n </Box>\n <FieldInput\n id=\"color-picker-value\"\n aria-label={formatMessage({\n id: getTrad('color-picker.input.aria-label'),\n defaultMessage: 'Color picker input',\n })}\n style={{ textTransform: 'uppercase' }}\n value={value}\n placeholder=\"#000000\"\n onChange={onChange}\n />\n </Flex>\n </FocusTrap>\n </ColorPickerPopover>\n )}\n <FieldHint />\n <FieldError />\n </Flex>\n </Field>\n );\n }\n);\n"],"names":[],"mappings":";;;;;;;;;AAwBA,MAAM,eAAe,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,sBAKN,CAAC,UAAU,MAAM,KAAK;AAAA;AAAA;AAI5C,MAAM,cAAc,OAAO,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAO5B,CAAC,EAAE,YAAY,MAAM,OAAO,CAAC,CAAC;AAAA,cAC7B,CAAC,EAAE,YAAY,MAAM,OAAO,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA,qBA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AAgB;AAAA,kBAAA,CACjB,GACH,EACF,CAAA;AAAA,kBACA;AAAA,oBAAC;AAAA,oBAAA;AAAA,sBACC,IAAG;AAAA,sBACH,cAAY,cAAc;AAAA,wBACxB,IAAI,QAAQ,+BAA+B;AAAA,wBAC3C,gBAAgB;AAAA,sBAAA,CACjB;AAAA,sBACD,OAAO,EAAE,eAAe,YAAY;AAAA,sBACpC;AAAA,sBACA,aAAY;AAAA,sBACZ;AAAA,oBAAA;AAAA,kBACF;AAAA,gBAAA,GACF;AAAA,cAAA,GACF;AAAA,YAAA;AAAA,UACF;AAAA,8BAED,WAAU,EAAA;AAAA,8BACV,YAAW,EAAA;AAAA,QAAA,GACd;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cs-4GdZY0p6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cs-A2xRj-2-.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"en-L6ZZWDJv.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"en-WeRHjVEB.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-2Qkvylxv.mjs","sources":["../../admin/src/components/ColorPickerIcon.tsx","../../admin/src/pluginId.ts","../../admin/src/utils/getTrad.ts","../../admin/src/utils/prefixPluginTranslations.ts","../../admin/src/index.ts"],"sourcesContent":["import { Flex, Icon } from '@strapi/design-system';\nimport { Paint } from '@strapi/icons';\nimport styled from 'styled-components';\n\nconst IconBox = styled(Flex)`\n /* Hard code color values */\n /* to stay consistent between themes */\n background-color: #f0f0ff; /* primary100 */\n border: 1px solid #d9d8ff; /* primary200 */\n\n svg > path {\n fill: #4945ff; /* primary600 */\n }\n`;\n\nexport const ColorPickerIcon = () => {\n return (\n <IconBox justifyContent=\"center\" alignItems=\"center\" width={7} height={6} hasRadius aria-hidden>\n <Icon as={Paint} />\n </IconBox>\n );\n};\n","export const pluginId = 'color-picker';\n","import { pluginId } from '../pluginId';\n\nexport const getTrad = (id: string) => `${pluginId}.${id}`;\n","type TradOptions = Record<string, string>;\n\nconst prefixPluginTranslations = (trad: TradOptions, pluginId: string): TradOptions => {\n if (!pluginId) {\n throw new TypeError(\"pluginId can't be empty\");\n }\n return Object.keys(trad).reduce((acc, current) => {\n acc[`${pluginId}.${current}`] = trad[current];\n return acc;\n }, {} as TradOptions);\n};\n\nexport { prefixPluginTranslations };\n","import { ColorPickerIcon } from './components/ColorPickerIcon';\nimport { pluginId } from './pluginId';\nimport { getTrad } from './utils/getTrad';\nimport { prefixPluginTranslations } from './utils/prefixPluginTranslations';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n /**\n * TODO: we need to have the type for StrapiApp done from `@strapi/admin` package.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n register(app: any) {\n app.customFields.register({\n name: 'color',\n pluginId: 'color-picker',\n type: 'string',\n icon: ColorPickerIcon,\n intlLabel: {\n id: getTrad('color-picker.label'),\n defaultMessage: 'Color',\n },\n intlDescription: {\n id: getTrad('color-picker.description'),\n defaultMessage: 'Select any color',\n },\n components: {\n Input: async () =>\n import('./components/ColorPickerInput').then((module) => ({\n default: module.ColorPickerInput,\n })),\n },\n options: {\n advanced: [\n {\n intlLabel: {\n id: getTrad('color-picker.options.advanced.regex'),\n defaultMessage: 'RegExp pattern',\n },\n name: 'regex',\n type: 'text',\n defaultValue: '^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$',\n description: {\n id: getTrad('color-picker.options.advanced.regex.description'),\n defaultMessage: 'The text of the regular expression',\n },\n },\n {\n sectionTitle: {\n id: 'global.settings',\n defaultMessage: 'Settings',\n },\n items: [\n {\n name: 'required',\n type: 'checkbox',\n intlLabel: {\n id: getTrad('color-picker.options.advanced.requiredField'),\n defaultMessage: 'Required field',\n },\n description: {\n id: getTrad('color-picker.options.advanced.requiredField.description'),\n defaultMessage: \"You won't be able to create an entry if this field is empty\",\n },\n },\n ],\n },\n ],\n },\n });\n },\n async registerTrads({ locales }: { locales: string[] }) {\n const importedTrads = await Promise.all(\n locales.map((locale) => {\n return import(`./translations/${locale}.json`)\n .then(({ default: data }) => {\n return {\n data: prefixPluginTranslations(data, pluginId),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n\n return Promise.resolve(importedTrads);\n },\n};\n"],"names":["pluginId"],"mappings":";;;;;;;;;;;;;AAIA,MAAM,UAAU,OAAO,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWpB,MAAM,kBAAkB,MAAM;AACnC,6BACG,SAAQ,EAAA,gBAAe,UAAS,YAAW,UAAS,OAAO,GAAG,QAAQ,GAAG,WAAS,MAAC,eAAW,MAC7F,8BAAC,MAAK,EAAA,IAAI,OAAO,EACnB,CAAA;AAEJ;ACrBO,MAAM,WAAW;ACEjB,MAAM,UAAU,CAAC,OAAe,GAAG,QAAQ,IAAI,EAAE;ACAxD,MAAM,2BAA2B,CAAC,MAAmBA,cAAkC;AACrF,MAAI,CAACA,WAAU;AACP,UAAA,IAAI,UAAU,yBAAyB;AAAA,EAC/C;AACA,SAAO,OAAO,KAAK,IAAI,EAAE,OAAO,CAAC,KAAK,YAAY;AAChD,QAAI,GAAGA,SAAQ,IAAI,OAAO,EAAE,IAAI,KAAK,OAAO;AACrC,WAAA;AAAA,EACT,GAAG,CAAiB,CAAA;AACtB;ACJA,MAAe,QAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKb,SAAS,KAAU;AACjB,QAAI,aAAa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AAA,mBAAA,GAAA,0BAAA,MAAA,OAAA,mBAAA,GAAA,0BAAA,MAAA,OAAA,mBAAA,GAAA,0BAAA,MAAA,OAAA,mBAAA,GAAA,0BAAA,MAAA,OAAA,mBAAA,EAAA,CAAA,GAAA,kBAAA,MAAA,OAAA,EACnC,KAAK,CAAC,EAAE,SAAS,WAAW;AACpB,iBAAA;AAAA,YACL,MAAM,yBAAyB,MAAM,QAAQ;AAAA,YAC7C;AAAA,UAAA;AAAA,QACF,CACD,EACA,MAAM,MAAM;AACJ,iBAAA;AAAA,YACL,MAAM,CAAC;AAAA,YACP;AAAA,UAAA;AAAA,QACF,CACD;AAAA,MAAA,CACJ;AAAA,IAAA;AAGI,WAAA,QAAQ,QAAQ,aAAa;AAAA,EACtC;AACF;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-rhrQWlM_.js","sources":["../../admin/src/components/ColorPickerIcon.tsx","../../admin/src/pluginId.ts","../../admin/src/utils/getTrad.ts","../../admin/src/utils/prefixPluginTranslations.ts","../../admin/src/index.ts"],"sourcesContent":["import { Flex, Icon } from '@strapi/design-system';\nimport { Paint } from '@strapi/icons';\nimport styled from 'styled-components';\n\nconst IconBox = styled(Flex)`\n /* Hard code color values */\n /* to stay consistent between themes */\n background-color: #f0f0ff; /* primary100 */\n border: 1px solid #d9d8ff; /* primary200 */\n\n svg > path {\n fill: #4945ff; /* primary600 */\n }\n`;\n\nexport const ColorPickerIcon = () => {\n return (\n <IconBox justifyContent=\"center\" alignItems=\"center\" width={7} height={6} hasRadius aria-hidden>\n <Icon as={Paint} />\n </IconBox>\n );\n};\n","export const pluginId = 'color-picker';\n","import { pluginId } from '../pluginId';\n\nexport const getTrad = (id: string) => `${pluginId}.${id}`;\n","type TradOptions = Record<string, string>;\n\nconst prefixPluginTranslations = (trad: TradOptions, pluginId: string): TradOptions => {\n if (!pluginId) {\n throw new TypeError(\"pluginId can't be empty\");\n }\n return Object.keys(trad).reduce((acc, current) => {\n acc[`${pluginId}.${current}`] = trad[current];\n return acc;\n }, {} as TradOptions);\n};\n\nexport { prefixPluginTranslations };\n","import { ColorPickerIcon } from './components/ColorPickerIcon';\nimport { pluginId } from './pluginId';\nimport { getTrad } from './utils/getTrad';\nimport { prefixPluginTranslations } from './utils/prefixPluginTranslations';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n /**\n * TODO: we need to have the type for StrapiApp done from `@strapi/admin` package.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n register(app: any) {\n app.customFields.register({\n name: 'color',\n pluginId: 'color-picker',\n type: 'string',\n icon: ColorPickerIcon,\n intlLabel: {\n id: getTrad('color-picker.label'),\n defaultMessage: 'Color',\n },\n intlDescription: {\n id: getTrad('color-picker.description'),\n defaultMessage: 'Select any color',\n },\n components: {\n Input: async () =>\n import('./components/ColorPickerInput').then((module) => ({\n default: module.ColorPickerInput,\n })),\n },\n options: {\n advanced: [\n {\n intlLabel: {\n id: getTrad('color-picker.options.advanced.regex'),\n defaultMessage: 'RegExp pattern',\n },\n name: 'regex',\n type: 'text',\n defaultValue: '^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$',\n description: {\n id: getTrad('color-picker.options.advanced.regex.description'),\n defaultMessage: 'The text of the regular expression',\n },\n },\n {\n sectionTitle: {\n id: 'global.settings',\n defaultMessage: 'Settings',\n },\n items: [\n {\n name: 'required',\n type: 'checkbox',\n intlLabel: {\n id: getTrad('color-picker.options.advanced.requiredField'),\n defaultMessage: 'Required field',\n },\n description: {\n id: getTrad('color-picker.options.advanced.requiredField.description'),\n defaultMessage: \"You won't be able to create an entry if this field is empty\",\n },\n },\n ],\n },\n ],\n },\n });\n },\n async registerTrads({ locales }: { locales: string[] }) {\n const importedTrads = await Promise.all(\n locales.map((locale) => {\n return import(`./translations/${locale}.json`)\n .then(({ default: data }) => {\n return {\n data: prefixPluginTranslations(data, pluginId),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n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AA,MAAA,OAAA,EACnC,KAAK,CAAC,EAAE,SAAS,WAAW;AACpB,iBAAA;AAAA,YACL,MAAM,yBAAyB,MAAM,QAAQ;AAAA,YAC7C;AAAA,UAAA;AAAA,QACF,CACD,EACA,MAAM,MAAM;AACJ,iBAAA;AAAA,YACL,MAAM,CAAC;AAAA,YACP;AAAA,UAAA;AAAA,QACF,CACD;AAAA,MAAA,CACJ;AAAA,IAAA;AAGI,WAAA,QAAQ,QAAQ,aAAa;AAAA,EACtC;AACF;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ru-LLXYEOwl.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ru-UXN_ByI9.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sv-3-Yk9bKb.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sv-QqRPNQLw.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tr-AbD-f8F0.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tr-qYGSw8gH.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zh-c23gv_oM.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zh-fPTOIT6s.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|