@strapi/plugin-color-picker 0.0.0-next.f426350b859ddae6592e9bfa99e6be94ae22e117 → 0.0.0-next.f4ec69568d980c6fee91ce2ee0f41c138347aa81

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.
Files changed (63) hide show
  1. package/LICENSE +34 -12
  2. package/dist/_chunks/ColorPickerInput-B07RliGP.js +153 -0
  3. package/dist/_chunks/ColorPickerInput-B07RliGP.js.map +1 -0
  4. package/dist/_chunks/ColorPickerInput-CMg-0_-G.mjs +134 -0
  5. package/dist/_chunks/ColorPickerInput-CMg-0_-G.mjs.map +1 -0
  6. package/dist/_chunks/cs-CKl0OyEH.js +16 -0
  7. package/dist/_chunks/cs-CKl0OyEH.js.map +1 -0
  8. package/{admin/src/translations/cs.json → dist/_chunks/cs-DMmE6LK7.mjs} +6 -2
  9. package/dist/_chunks/cs-DMmE6LK7.mjs.map +1 -0
  10. package/{admin/src/translations/en.json → dist/_chunks/en-BlDau3us.mjs} +6 -2
  11. package/dist/_chunks/en-BlDau3us.mjs.map +1 -0
  12. package/dist/_chunks/en-Ct0C5cA2.js +19 -0
  13. package/dist/_chunks/en-Ct0C5cA2.js.map +1 -0
  14. package/dist/_chunks/index-B9LkgZbo.mjs +121 -0
  15. package/dist/_chunks/index-B9LkgZbo.mjs.map +1 -0
  16. package/dist/_chunks/index-BeQLcDEb.js +120 -0
  17. package/dist/_chunks/index-BeQLcDEb.js.map +1 -0
  18. package/dist/_chunks/ru-Wrg-npZz.js +19 -0
  19. package/dist/_chunks/ru-Wrg-npZz.js.map +1 -0
  20. package/{admin/src/translations/ru.json → dist/_chunks/ru-aOnA-eym.mjs} +6 -2
  21. package/dist/_chunks/ru-aOnA-eym.mjs.map +1 -0
  22. package/{admin/src/translations/sv.json → dist/_chunks/sv-BaFDND79.mjs} +6 -2
  23. package/dist/_chunks/sv-BaFDND79.mjs.map +1 -0
  24. package/dist/_chunks/sv-CKY6es_6.js +16 -0
  25. package/dist/_chunks/sv-CKY6es_6.js.map +1 -0
  26. package/{admin/src/translations/tr.json → dist/_chunks/tr-CHHW_hYI.mjs} +6 -2
  27. package/dist/_chunks/tr-CHHW_hYI.mjs.map +1 -0
  28. package/dist/_chunks/tr-DcLzQS-J.js +16 -0
  29. package/dist/_chunks/tr-DcLzQS-J.js.map +1 -0
  30. package/{admin/src/translations/zh.json → dist/_chunks/zh-DBH6uCXb.mjs} +6 -2
  31. package/dist/_chunks/zh-DBH6uCXb.mjs.map +1 -0
  32. package/dist/_chunks/zh-T5cJzhPD.js +16 -0
  33. package/dist/_chunks/zh-T5cJzhPD.js.map +1 -0
  34. package/dist/admin/index.js +4 -0
  35. package/dist/admin/index.js.map +1 -0
  36. package/dist/admin/index.mjs +5 -0
  37. package/dist/admin/index.mjs.map +1 -0
  38. package/dist/admin/src/components/ColorPickerIcon.d.ts +1 -0
  39. package/dist/admin/src/components/ColorPickerInput.d.ts +7 -0
  40. package/dist/admin/src/index.d.ts +18 -0
  41. package/dist/admin/src/pluginId.d.ts +1 -0
  42. package/dist/admin/src/utils/getTrad.d.ts +1 -0
  43. package/dist/admin/src/utils/prefixPluginTranslations.d.ts +3 -0
  44. package/dist/server/index.js +11 -5
  45. package/dist/server/index.js.map +1 -1
  46. package/dist/server/index.mjs +14 -0
  47. package/dist/server/index.mjs.map +1 -0
  48. package/dist/server/{index.d.ts → src/index.d.ts} +1 -0
  49. package/dist/server/src/index.d.ts.map +1 -0
  50. package/dist/server/{register.d.ts → src/register.d.ts} +1 -0
  51. package/dist/server/src/register.d.ts.map +1 -0
  52. package/package.json +65 -49
  53. package/admin/src/components/ColorPicker/ColorPickerIcon/index.js +0 -26
  54. package/admin/src/components/ColorPicker/ColorPickerInput/index.js +0 -206
  55. package/admin/src/components/tests/__snapshots__/color-picker-input.test.js.snap +0 -238
  56. package/admin/src/components/tests/color-picker-input.test.js +0 -65
  57. package/admin/src/index.js +0 -88
  58. package/admin/src/pluginId.js +0 -5
  59. package/admin/src/utils/getTrad.js +0 -5
  60. package/dist/server/register.js +0 -12
  61. package/dist/server/register.js.map +0 -1
  62. package/strapi-admin.js +0 -3
  63. package/strapi-server.js +0 -3
package/LICENSE CHANGED
@@ -1,15 +1,37 @@
1
1
  Copyright (c) 2015-present Strapi Solutions SAS
2
-
2
+
3
3
  Portions of the Strapi software are licensed as follows:
4
-
5
- * If you are accessing or using any component of the software that resides under an "ee/" directory, then you are deemed to be using our Enterprise Editionof the software and you understand and agree that the software is not licensed under the "MIT Expat" license as set forth below but instead, all the software you access is licensed under the license defined in "strapi/packages/core/admin/ee/LICENSE" and located at https://github.com/strapi/strapi/blob/a76b557047e9ef1c168dbf1b6cf879bcc3022de6/packages/core/admin/ee/LICENSE, unless (a) you or the company you represent has signed an alternative agreement referencing this code, then such signed agreement applies or (b) you are using the software in connection with a subscription to our cloud offering, then the terms of the agreement relevant to the cloud offering which you have assented to apply and the software licenses included in that agreement shall apply.
6
-
7
- * If (a) you are not accessing or using the software that resides under an “ee/” directory and therefore you are only accessing or using our “Community Edition” of the Software and (b) you have no registered account on our cloud offering, then we are providing you the software under the "MIT Expat" license as set forth below.
8
-
4
+
5
+ * All software that resides under an "ee/" directory (theEE Software), if that directory exists, is licensed under the license defined below.
6
+
7
+ Enterprise License
8
+
9
+ If you or the company you represent has entered into a written agreement referencing the Enterprise Edition of the Strapi source code available at
10
+ https://github.com/strapi/strapi, then such agreement applies to your use of the Enterprise Edition of the Strapi Software. If you or the company you
11
+ represent is using the Enterprise Edition of the Strapi Software in connection with a subscription to our cloud offering, then the agreement you have
12
+ agreed to with respect to our cloud offering and the licenses included in such agreement apply to your use of the Enterprise Edition of the Strapi Software.
13
+ Otherwise, the Strapi Enterprise Software License Agreement (found here https://strapi.io/enterprise-terms) applies to your use of the Enterprise Edition of the Strapi Software.
14
+
15
+ BY ACCESSING OR USING THE ENTERPRISE EDITION OF THE STRAPI SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THE RELEVANT REFERENCED AGREEMENT.
16
+ IF YOU ARE NOT AUTHORIZED TO ACCEPT THESE TERMS ON BEHALF OF THE COMPANY YOU REPRESENT OR IF YOU DO NOT AGREE TO ALL OF THE RELEVANT TERMS AND CONDITIONS REFERENCED AND YOU
17
+ HAVE NOT OTHERWISE EXECUTED A WRITTEN AGREEMENT WITH STRAPI, YOU ARE NOT AUTHORIZED TO ACCESS OR USE OR ALLOW ANY USER TO ACCESS OR USE ANY PART OF
18
+ THE ENTERPRISE EDITION OF THE STRAPI SOFTWARE. YOUR ACCESS RIGHTS ARE CONDITIONAL ON YOUR CONSENT TO THE RELEVANT REFERENCED TERMS TO THE EXCLUSION OF ALL OTHER TERMS;
19
+ IF THE RELEVANT REFERENCED TERMS ARE CONSIDERED AN OFFER BY YOU, ACCEPTANCE IS EXPRESSLY LIMITED TO THE RELEVANT REFERENCED TERMS.
20
+
21
+ * All software outside of the above-mentioned directories or restrictions above is available under the "MIT Expat" license as set forth below.
22
+
9
23
  MIT Expat License
10
-
11
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
+
25
+ Permission is hereby granted, free of charge, to any person obtaining a copy
26
+ of this software and associated documentation files (the "Software"), to deal
27
+ in the Software without restriction, including without limitation the rights
28
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
29
+ copies of the Software, and to permit persons to whom the Software is
30
+ furnished to do so, subject to the following conditions:
31
+
32
+ The above copyright notice and this permission notice shall be included in all
33
+ copies or substantial portions of the Software.
34
+
35
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
37
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,153 @@
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 reactColorful = require("react-colorful");
8
+ const reactIntl = require("react-intl");
9
+ const styledComponents = require("styled-components");
10
+ const index = require("./index-BeQLcDEb.js");
11
+ function _interopNamespace(e) {
12
+ if (e && e.__esModule)
13
+ return e;
14
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
15
+ if (e) {
16
+ for (const k in e) {
17
+ if (k !== "default") {
18
+ const d = Object.getOwnPropertyDescriptor(e, k);
19
+ Object.defineProperty(n, k, d.get ? d : {
20
+ enumerable: true,
21
+ get: () => e[k]
22
+ });
23
+ }
24
+ }
25
+ }
26
+ n.default = e;
27
+ return Object.freeze(n);
28
+ }
29
+ const React__namespace = /* @__PURE__ */ _interopNamespace(React);
30
+ const ColorPreview = styledComponents.styled.div`
31
+ border-radius: 50%;
32
+ width: 20px;
33
+ height: 20px;
34
+ margin-right: 10px;
35
+ background-color: ${(props) => props.color};
36
+ border: 1px solid rgba(0, 0, 0, 0.1);
37
+ `;
38
+ const ColorPicker = styledComponents.styled(reactColorful.HexColorPicker)`
39
+ && {
40
+ width: 100%;
41
+ aspect-ratio: 1.5;
42
+ }
43
+
44
+ .react-colorful__pointer {
45
+ width: ${({ theme }) => theme.spaces[3]};
46
+ height: ${({ theme }) => theme.spaces[3]};
47
+ }
48
+
49
+ .react-colorful__saturation {
50
+ border-radius: ${({ theme }) => theme.spaces[1]};
51
+ border-bottom: none;
52
+ }
53
+
54
+ .react-colorful__hue {
55
+ border-radius: 10px;
56
+ height: ${({ theme }) => theme.spaces[3]};
57
+ margin-top: ${({ theme }) => theme.spaces[2]};
58
+ }
59
+ `;
60
+ const ColorPickerToggle = styledComponents.styled(designSystem.Button)`
61
+ & > span {
62
+ display: flex;
63
+ justify-content: space-between;
64
+ align-items: center;
65
+ width: 100%;
66
+ }
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 = styledComponents.styled(designSystem.Popover.Content)`
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, onChange, value, error }, forwardedRef) => {
84
+ const [showColorPicker, setShowColorPicker] = React__namespace.useState(false);
85
+ const colorPickerButtonRef = React__namespace.useRef(null);
86
+ const { formatMessage } = reactIntl.useIntl();
87
+ const color = value || "#000000";
88
+ const composedRefs = designSystem.useComposedRefs(forwardedRef, colorPickerButtonRef);
89
+ 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: [
90
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { action: labelAction, children: label }),
91
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Popover.Root, { onOpenChange: setShowColorPicker, children: [
92
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsxs(
93
+ ColorPickerToggle,
94
+ {
95
+ ref: composedRefs,
96
+ "aria-label": formatMessage({
97
+ id: index.getTrad("color-picker.toggle.aria-label"),
98
+ defaultMessage: "Color picker toggle"
99
+ }),
100
+ "aria-controls": "color-picker-value",
101
+ "aria-haspopup": "dialog",
102
+ "aria-expanded": showColorPicker,
103
+ "aria-disabled": disabled,
104
+ disabled,
105
+ variant: "tertiary",
106
+ size: "L",
107
+ children: [
108
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { children: [
109
+ /* @__PURE__ */ jsxRuntime.jsx(ColorPreview, { color }),
110
+ /* @__PURE__ */ jsxRuntime.jsx(
111
+ designSystem.Typography,
112
+ {
113
+ style: { textTransform: "uppercase" },
114
+ textColor: value ? void 0 : "neutral600",
115
+ variant: "omega",
116
+ children: color
117
+ }
118
+ )
119
+ ] }),
120
+ /* @__PURE__ */ jsxRuntime.jsx(icons.CaretDown, { "aria-hidden": true })
121
+ ]
122
+ }
123
+ ) }),
124
+ /* @__PURE__ */ jsxRuntime.jsxs(ColorPickerPopover, { sideOffset: 4, children: [
125
+ /* @__PURE__ */ jsxRuntime.jsx(ColorPicker, { color, onChange: (hexValue) => onChange(name, hexValue) }),
126
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { paddingTop: 3, paddingLeft: 4, justifyContent: "flex-end", children: [
127
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingRight: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", tag: "label", textColor: "neutral600", children: formatMessage({
128
+ id: index.getTrad("color-picker.input.format"),
129
+ defaultMessage: "HEX"
130
+ }) }) }),
131
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { children: /* @__PURE__ */ jsxRuntime.jsx(
132
+ designSystem.Field.Input,
133
+ {
134
+ "aria-label": formatMessage({
135
+ id: index.getTrad("color-picker.input.aria-label"),
136
+ defaultMessage: "Color picker input"
137
+ }),
138
+ style: { textTransform: "uppercase" },
139
+ value,
140
+ placeholder: "#000000",
141
+ onChange
142
+ }
143
+ ) })
144
+ ] })
145
+ ] })
146
+ ] }),
147
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {}),
148
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
149
+ ] }) });
150
+ }
151
+ );
152
+ exports.ColorPickerInput = ColorPickerInput;
153
+ //# sourceMappingURL=ColorPickerInput-B07RliGP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColorPickerInput-B07RliGP.js","sources":["../../admin/src/components/ColorPickerInput.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n Button,\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, type FieldValue } 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(Button)`\n & > span {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n }\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 FieldValue & {\n labelAction?: React.ReactNode;\n };\n\nexport const ColorPickerInput = React.forwardRef<HTMLButtonElement, ColorPickerInputProps>(\n (\n { hint, disabled = false, labelAction, label, name, required = false, onChange, value, error },\n forwardedRef\n ) => {\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 variant=\"tertiary\"\n size=\"L\"\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","Button","Popover","React","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;AAAA;AAI5C,MAAM,cAAcA,iBAAAA,OAAOC,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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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,134 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { Button, Popover, useComposedRefs, Field, Flex, Typography, Box } from "@strapi/design-system";
4
+ import { CaretDown } from "@strapi/icons";
5
+ import { HexColorPicker } from "react-colorful";
6
+ import { useIntl } from "react-intl";
7
+ import { styled } from "styled-components";
8
+ import { g as getTrad } from "./index-B9LkgZbo.mjs";
9
+ const ColorPreview = styled.div`
10
+ border-radius: 50%;
11
+ width: 20px;
12
+ height: 20px;
13
+ margin-right: 10px;
14
+ background-color: ${(props) => props.color};
15
+ border: 1px solid rgba(0, 0, 0, 0.1);
16
+ `;
17
+ const ColorPicker = styled(HexColorPicker)`
18
+ && {
19
+ width: 100%;
20
+ aspect-ratio: 1.5;
21
+ }
22
+
23
+ .react-colorful__pointer {
24
+ width: ${({ theme }) => theme.spaces[3]};
25
+ height: ${({ theme }) => theme.spaces[3]};
26
+ }
27
+
28
+ .react-colorful__saturation {
29
+ border-radius: ${({ theme }) => theme.spaces[1]};
30
+ border-bottom: none;
31
+ }
32
+
33
+ .react-colorful__hue {
34
+ border-radius: 10px;
35
+ height: ${({ theme }) => theme.spaces[3]};
36
+ margin-top: ${({ theme }) => theme.spaces[2]};
37
+ }
38
+ `;
39
+ const ColorPickerToggle = styled(Button)`
40
+ & > span {
41
+ display: flex;
42
+ justify-content: space-between;
43
+ align-items: center;
44
+ width: 100%;
45
+ }
46
+
47
+ svg {
48
+ width: ${({ theme }) => theme.spaces[2]};
49
+ height: ${({ theme }) => theme.spaces[2]};
50
+ }
51
+
52
+ svg > path {
53
+ fill: ${({ theme }) => theme.colors.neutral500};
54
+ justify-self: flex-end;
55
+ }
56
+ `;
57
+ const ColorPickerPopover = styled(Popover.Content)`
58
+ padding: ${({ theme }) => theme.spaces[2]};
59
+ min-height: 270px;
60
+ `;
61
+ const ColorPickerInput = React.forwardRef(
62
+ ({ hint, disabled = false, labelAction, label, name, required = false, onChange, value, error }, forwardedRef) => {
63
+ const [showColorPicker, setShowColorPicker] = React.useState(false);
64
+ const colorPickerButtonRef = React.useRef(null);
65
+ const { formatMessage } = useIntl();
66
+ const color = value || "#000000";
67
+ const composedRefs = useComposedRefs(forwardedRef, colorPickerButtonRef);
68
+ return /* @__PURE__ */ jsx(Field.Root, { name, id: name, error, hint, required, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
69
+ /* @__PURE__ */ jsx(Field.Label, { action: labelAction, children: label }),
70
+ /* @__PURE__ */ jsxs(Popover.Root, { onOpenChange: setShowColorPicker, children: [
71
+ /* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsxs(
72
+ ColorPickerToggle,
73
+ {
74
+ ref: composedRefs,
75
+ "aria-label": formatMessage({
76
+ id: getTrad("color-picker.toggle.aria-label"),
77
+ defaultMessage: "Color picker toggle"
78
+ }),
79
+ "aria-controls": "color-picker-value",
80
+ "aria-haspopup": "dialog",
81
+ "aria-expanded": showColorPicker,
82
+ "aria-disabled": disabled,
83
+ disabled,
84
+ variant: "tertiary",
85
+ size: "L",
86
+ children: [
87
+ /* @__PURE__ */ jsxs(Flex, { children: [
88
+ /* @__PURE__ */ jsx(ColorPreview, { color }),
89
+ /* @__PURE__ */ jsx(
90
+ Typography,
91
+ {
92
+ style: { textTransform: "uppercase" },
93
+ textColor: value ? void 0 : "neutral600",
94
+ variant: "omega",
95
+ children: color
96
+ }
97
+ )
98
+ ] }),
99
+ /* @__PURE__ */ jsx(CaretDown, { "aria-hidden": true })
100
+ ]
101
+ }
102
+ ) }),
103
+ /* @__PURE__ */ jsxs(ColorPickerPopover, { sideOffset: 4, children: [
104
+ /* @__PURE__ */ jsx(ColorPicker, { color, onChange: (hexValue) => onChange(name, hexValue) }),
105
+ /* @__PURE__ */ jsxs(Flex, { paddingTop: 3, paddingLeft: 4, justifyContent: "flex-end", children: [
106
+ /* @__PURE__ */ jsx(Box, { paddingRight: 2, children: /* @__PURE__ */ jsx(Typography, { variant: "omega", tag: "label", textColor: "neutral600", children: formatMessage({
107
+ id: getTrad("color-picker.input.format"),
108
+ defaultMessage: "HEX"
109
+ }) }) }),
110
+ /* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsx(
111
+ Field.Input,
112
+ {
113
+ "aria-label": formatMessage({
114
+ id: getTrad("color-picker.input.aria-label"),
115
+ defaultMessage: "Color picker input"
116
+ }),
117
+ style: { textTransform: "uppercase" },
118
+ value,
119
+ placeholder: "#000000",
120
+ onChange
121
+ }
122
+ ) })
123
+ ] })
124
+ ] })
125
+ ] }),
126
+ /* @__PURE__ */ jsx(Field.Hint, {}),
127
+ /* @__PURE__ */ jsx(Field.Error, {})
128
+ ] }) });
129
+ }
130
+ );
131
+ export {
132
+ ColorPickerInput
133
+ };
134
+ //# sourceMappingURL=ColorPickerInput-CMg-0_-G.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColorPickerInput-CMg-0_-G.mjs","sources":["../../admin/src/components/ColorPickerInput.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n Button,\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, type FieldValue } 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(Button)`\n & > span {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n }\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 FieldValue & {\n labelAction?: React.ReactNode;\n };\n\nexport const ColorPickerInput = React.forwardRef<HTMLButtonElement, ColorPickerInputProps>(\n (\n { hint, disabled = false, labelAction, label, name, required = false, onChange, value, error },\n forwardedRef\n ) => {\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 variant=\"tertiary\"\n size=\"L\"\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,CAAC,EAAE,YAAY,MAAM,OAAO,CAAC,CAAC;AAAA;AAAA;AAAA;AAA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AA,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,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const cs = {
4
+ "color-picker.description": "Vyberte libovolnou barvu",
5
+ "color-picker.input.aria-label": "Vstup pro výběr barvy",
6
+ "color-picker.input.format": "HEX",
7
+ "color-picker.label": "Barva",
8
+ "color-picker.options.advanced.regex": "RegExp vzor",
9
+ "color-picker.options.advanced.regex.description": "Zadejte regulární výraz pro ověření hodnoty HEX",
10
+ "color-picker.options.advanced.requiredField": "Povinné pole",
11
+ "color-picker.options.advanced.requiredField.description": "Pokud je toto pole prázdné, nebudete moci vytvořit záznam",
12
+ "color-picker.settings": "Nastavení",
13
+ "color-picker.toggle.aria-label": "Přepínač výběru barvy"
14
+ };
15
+ exports.default = cs;
16
+ //# sourceMappingURL=cs-CKl0OyEH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cs-CKl0OyEH.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- {
1
+ const cs = {
2
2
  "color-picker.description": "Vyberte libovolnou barvu",
3
3
  "color-picker.input.aria-label": "Vstup pro výběr barvy",
4
4
  "color-picker.input.format": "HEX",
@@ -9,4 +9,8 @@
9
9
  "color-picker.options.advanced.requiredField.description": "Pokud je toto pole prázdné, nebudete moci vytvořit záznam",
10
10
  "color-picker.settings": "Nastavení",
11
11
  "color-picker.toggle.aria-label": "Přepínač výběru barvy"
12
- }
12
+ };
13
+ export {
14
+ cs as default
15
+ };
16
+ //# sourceMappingURL=cs-DMmE6LK7.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cs-DMmE6LK7.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- {
1
+ const en = {
2
2
  "color-picker.description": "Select any color",
3
3
  "color-picker.input.aria-label": "Color picker input",
4
4
  "color-picker.input.format": "HEX",
@@ -12,4 +12,8 @@
12
12
  "plugin.description.long": "A Strapi-maintained color picker custom field. Use saturation and hue sliders to select a color and save the value as a HEX string.",
13
13
  "plugin.description.short": "A Strapi-maintained color picker custom field.",
14
14
  "plugin.name": "Color picker"
15
- }
15
+ };
16
+ export {
17
+ en as default
18
+ };
19
+ //# sourceMappingURL=en-BlDau3us.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"en-BlDau3us.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const en = {
4
+ "color-picker.description": "Select any color",
5
+ "color-picker.input.aria-label": "Color picker input",
6
+ "color-picker.input.format": "HEX",
7
+ "color-picker.label": "Color",
8
+ "color-picker.options.advanced.regex": "RegExp pattern",
9
+ "color-picker.options.advanced.regex.description": "Provide a regular expression to validate the HEX value",
10
+ "color-picker.options.advanced.requiredField": "Required field",
11
+ "color-picker.options.advanced.requiredField.description": "You won't be able to create an entry if this field is empty",
12
+ "color-picker.settings": "Settings",
13
+ "color-picker.toggle.aria-label": "Color picker toggle",
14
+ "plugin.description.long": "A Strapi-maintained color picker custom field. Use saturation and hue sliders to select a color and save the value as a HEX string.",
15
+ "plugin.description.short": "A Strapi-maintained color picker custom field.",
16
+ "plugin.name": "Color picker"
17
+ };
18
+ exports.default = en;
19
+ //# sourceMappingURL=en-Ct0C5cA2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"en-Ct0C5cA2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,121 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Flex } from "@strapi/design-system";
3
+ import { PaintBrush } from "@strapi/icons";
4
+ import { styled } from "styled-components";
5
+ const __variableDynamicImportRuntimeHelper = (glob, path) => {
6
+ const v = glob[path];
7
+ if (v) {
8
+ return typeof v === "function" ? v() : Promise.resolve(v);
9
+ }
10
+ return new Promise((_, reject) => {
11
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(reject.bind(null, new Error("Unknown variable dynamic import: " + path)));
12
+ });
13
+ };
14
+ const IconBox = styled(Flex)`
15
+ /* Hard code color values */
16
+ /* to stay consistent between themes */
17
+ background-color: #f0f0ff; /* primary100 */
18
+ border: 1px solid #d9d8ff; /* primary200 */
19
+
20
+ svg > path {
21
+ fill: #4945ff; /* primary600 */
22
+ }
23
+ `;
24
+ const ColorPickerIcon = () => {
25
+ return /* @__PURE__ */ jsx(IconBox, { justifyContent: "center", alignItems: "center", width: 7, height: 6, hasRadius: true, "aria-hidden": true, children: /* @__PURE__ */ jsx(PaintBrush, {}) });
26
+ };
27
+ const pluginId = "color-picker";
28
+ const getTrad = (id) => `${pluginId}.${id}`;
29
+ const prefixPluginTranslations = (trad, pluginId2) => {
30
+ return Object.keys(trad).reduce((acc, current) => {
31
+ acc[`${pluginId2}.${current}`] = trad[current];
32
+ return acc;
33
+ }, {});
34
+ };
35
+ const index = {
36
+ /**
37
+ * TODO: we need to have the type for StrapiApp done from `@strapi/admin` package.
38
+ */
39
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
40
+ register(app) {
41
+ app.customFields.register({
42
+ name: "color",
43
+ pluginId: "color-picker",
44
+ type: "string",
45
+ icon: ColorPickerIcon,
46
+ intlLabel: {
47
+ id: getTrad("color-picker.label"),
48
+ defaultMessage: "Color"
49
+ },
50
+ intlDescription: {
51
+ id: getTrad("color-picker.description"),
52
+ defaultMessage: "Select any color"
53
+ },
54
+ components: {
55
+ Input: async () => import("./ColorPickerInput-CMg-0_-G.mjs").then((module) => ({
56
+ default: module.ColorPickerInput
57
+ }))
58
+ },
59
+ options: {
60
+ advanced: [
61
+ {
62
+ intlLabel: {
63
+ id: getTrad("color-picker.options.advanced.regex"),
64
+ defaultMessage: "RegExp pattern"
65
+ },
66
+ name: "regex",
67
+ type: "text",
68
+ defaultValue: "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",
69
+ description: {
70
+ id: getTrad("color-picker.options.advanced.regex.description"),
71
+ defaultMessage: "The text of the regular expression"
72
+ }
73
+ },
74
+ {
75
+ sectionTitle: {
76
+ id: "global.settings",
77
+ defaultMessage: "Settings"
78
+ },
79
+ items: [
80
+ {
81
+ name: "required",
82
+ type: "checkbox",
83
+ intlLabel: {
84
+ id: getTrad("color-picker.options.advanced.requiredField"),
85
+ defaultMessage: "Required field"
86
+ },
87
+ description: {
88
+ id: getTrad("color-picker.options.advanced.requiredField.description"),
89
+ defaultMessage: "You won't be able to create an entry if this field is empty"
90
+ }
91
+ }
92
+ ]
93
+ }
94
+ ]
95
+ }
96
+ });
97
+ },
98
+ async registerTrads({ locales }) {
99
+ const importedTrads = await Promise.all(
100
+ locales.map((locale) => {
101
+ 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 }) => {
102
+ return {
103
+ data: prefixPluginTranslations(data, pluginId),
104
+ locale
105
+ };
106
+ }).catch(() => {
107
+ return {
108
+ data: {},
109
+ locale
110
+ };
111
+ });
112
+ })
113
+ );
114
+ return Promise.resolve(importedTrads);
115
+ }
116
+ };
117
+ export {
118
+ getTrad as g,
119
+ index as i
120
+ };
121
+ //# sourceMappingURL=index-B9LkgZbo.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-B9LkgZbo.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;AAIrF,SAAO,OAAO,KAAK,IAAI,EAAE,OAAO,CAAC,KAAK,YAAY;AACh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