@strapi/plugin-color-picker 0.0.0-next.e6eaa3d0563c85f80fd88b258df70a55c057096e → 0.0.0-next.e8d8fc824d0f6a695b2a9ebaa4680ed21c3645ca

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 (48) hide show
  1. package/LICENSE +34 -12
  2. package/dist/_chunks/ColorPickerInput-D6xkBHIN.js +151 -0
  3. package/dist/_chunks/ColorPickerInput-m6ZX3Kq-.mjs +133 -0
  4. package/dist/_chunks/{cs-4GdZY0p6.js → cs-CKl0OyEH.js} +0 -1
  5. package/dist/_chunks/{cs-A2xRj-2-.mjs → cs-DMmE6LK7.mjs} +0 -1
  6. package/dist/_chunks/{en-L6ZZWDJv.mjs → en-BlDau3us.mjs} +0 -1
  7. package/dist/_chunks/{en-WeRHjVEB.js → en-Ct0C5cA2.js} +0 -1
  8. package/dist/_chunks/{index-OJYEuoCq.js → index-CCLaPAwT.js} +21 -12
  9. package/dist/_chunks/{index-uOrtnJpz.mjs → index-CgXv8Era.mjs} +21 -10
  10. package/dist/_chunks/{ru-UXN_ByI9.js → ru-Wrg-npZz.js} +0 -1
  11. package/dist/_chunks/{ru-LLXYEOwl.mjs → ru-aOnA-eym.mjs} +0 -1
  12. package/dist/_chunks/{sv-QqRPNQLw.mjs → sv-BaFDND79.mjs} +0 -1
  13. package/dist/_chunks/{sv-3-Yk9bKb.js → sv-CKY6es_6.js} +0 -1
  14. package/dist/_chunks/{tr-qYGSw8gH.mjs → tr-CHHW_hYI.mjs} +0 -1
  15. package/dist/_chunks/{tr-AbD-f8F0.js → tr-DcLzQS-J.js} +0 -1
  16. package/dist/_chunks/{zh-fPTOIT6s.mjs → zh-DBH6uCXb.mjs} +0 -1
  17. package/dist/_chunks/{zh-c23gv_oM.js → zh-T5cJzhPD.js} +0 -1
  18. package/dist/admin/index.js +1 -7
  19. package/dist/admin/index.mjs +1 -7
  20. package/dist/admin/src/components/ColorPickerInput.d.ts +3 -28
  21. package/dist/admin/src/utils/prefixPluginTranslations.d.ts +3 -0
  22. package/dist/server/index.js +0 -1
  23. package/dist/server/index.mjs +0 -1
  24. package/package.json +21 -23
  25. package/dist/_chunks/ColorPickerInput-0lOoTrf0.js +0 -206
  26. package/dist/_chunks/ColorPickerInput-0lOoTrf0.js.map +0 -1
  27. package/dist/_chunks/ColorPickerInput-fKB6YXW8.mjs +0 -185
  28. package/dist/_chunks/ColorPickerInput-fKB6YXW8.mjs.map +0 -1
  29. package/dist/_chunks/cs-4GdZY0p6.js.map +0 -1
  30. package/dist/_chunks/cs-A2xRj-2-.mjs.map +0 -1
  31. package/dist/_chunks/en-L6ZZWDJv.mjs.map +0 -1
  32. package/dist/_chunks/en-WeRHjVEB.js.map +0 -1
  33. package/dist/_chunks/index-OJYEuoCq.js.map +0 -1
  34. package/dist/_chunks/index-uOrtnJpz.mjs.map +0 -1
  35. package/dist/_chunks/ru-LLXYEOwl.mjs.map +0 -1
  36. package/dist/_chunks/ru-UXN_ByI9.js.map +0 -1
  37. package/dist/_chunks/sv-3-Yk9bKb.js.map +0 -1
  38. package/dist/_chunks/sv-QqRPNQLw.mjs.map +0 -1
  39. package/dist/_chunks/tr-AbD-f8F0.js.map +0 -1
  40. package/dist/_chunks/tr-qYGSw8gH.mjs.map +0 -1
  41. package/dist/_chunks/zh-c23gv_oM.js.map +0 -1
  42. package/dist/_chunks/zh-fPTOIT6s.mjs.map +0 -1
  43. package/dist/admin/index.js.map +0 -1
  44. package/dist/admin/index.mjs.map +0 -1
  45. package/dist/admin/src/hooks/useComposeRefs.d.ts +0 -29
  46. package/dist/server/index.js.map +0 -1
  47. package/dist/server/index.mjs.map +0 -1
  48. 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,151 @@
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-CCLaPAwT.js");
11
+ function _interopNamespace(e) {
12
+ if (e && e.__esModule) return e;
13
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
14
+ if (e) {
15
+ for (const k in e) {
16
+ if (k !== "default") {
17
+ const d = Object.getOwnPropertyDescriptor(e, k);
18
+ Object.defineProperty(n, k, d.get ? d : {
19
+ enumerable: true,
20
+ get: () => e[k]
21
+ });
22
+ }
23
+ }
24
+ }
25
+ n.default = e;
26
+ return Object.freeze(n);
27
+ }
28
+ const React__namespace = /* @__PURE__ */ _interopNamespace(React);
29
+ const ColorPreview = styledComponents.styled.div`
30
+ border-radius: 50%;
31
+ width: 20px;
32
+ height: 20px;
33
+ margin-right: 10px;
34
+ background-color: ${(props) => props.color};
35
+ border: 1px solid rgba(0, 0, 0, 0.1);
36
+ `;
37
+ const ColorPicker = styledComponents.styled(reactColorful.HexColorPicker)`
38
+ && {
39
+ width: 100%;
40
+ aspect-ratio: 1.5;
41
+ }
42
+
43
+ .react-colorful__pointer {
44
+ width: ${({ theme }) => theme.spaces[3]};
45
+ height: ${({ theme }) => theme.spaces[3]};
46
+ }
47
+
48
+ .react-colorful__saturation {
49
+ border-radius: ${({ theme }) => theme.spaces[1]};
50
+ border-bottom: none;
51
+ }
52
+
53
+ .react-colorful__hue {
54
+ border-radius: 10px;
55
+ height: ${({ theme }) => theme.spaces[3]};
56
+ margin-top: ${({ theme }) => theme.spaces[2]};
57
+ }
58
+ `;
59
+ const ColorPickerToggle = styledComponents.styled(designSystem.Button)`
60
+ & > span {
61
+ display: flex;
62
+ justify-content: space-between;
63
+ align-items: center;
64
+ width: 100%;
65
+ }
66
+
67
+ svg {
68
+ width: ${({ theme }) => theme.spaces[2]};
69
+ height: ${({ theme }) => theme.spaces[2]};
70
+ }
71
+
72
+ svg > path {
73
+ fill: ${({ theme }) => theme.colors.neutral500};
74
+ justify-self: flex-end;
75
+ }
76
+ `;
77
+ const ColorPickerPopover = styledComponents.styled(designSystem.Popover.Content)`
78
+ padding: ${({ theme }) => theme.spaces[2]};
79
+ min-height: 270px;
80
+ `;
81
+ const ColorPickerInput = React__namespace.forwardRef(
82
+ ({ hint, disabled = false, labelAction, label, name, required = false, onChange, value, error }, forwardedRef) => {
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
+ variant: "tertiary",
105
+ size: "L",
106
+ children: [
107
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { children: [
108
+ /* @__PURE__ */ jsxRuntime.jsx(ColorPreview, { color }),
109
+ /* @__PURE__ */ jsxRuntime.jsx(
110
+ designSystem.Typography,
111
+ {
112
+ style: { textTransform: "uppercase" },
113
+ textColor: value ? void 0 : "neutral600",
114
+ variant: "omega",
115
+ children: color
116
+ }
117
+ )
118
+ ] }),
119
+ /* @__PURE__ */ jsxRuntime.jsx(icons.CaretDown, { "aria-hidden": true })
120
+ ]
121
+ }
122
+ ) }),
123
+ /* @__PURE__ */ jsxRuntime.jsxs(ColorPickerPopover, { sideOffset: 4, children: [
124
+ /* @__PURE__ */ jsxRuntime.jsx(ColorPicker, { color, onChange: (hexValue) => onChange(name, hexValue) }),
125
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { paddingTop: 3, paddingLeft: 4, justifyContent: "flex-end", children: [
126
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingRight: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", tag: "label", textColor: "neutral600", children: formatMessage({
127
+ id: index.getTrad("color-picker.input.format"),
128
+ defaultMessage: "HEX"
129
+ }) }) }),
130
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { children: /* @__PURE__ */ jsxRuntime.jsx(
131
+ designSystem.Field.Input,
132
+ {
133
+ "aria-label": formatMessage({
134
+ id: index.getTrad("color-picker.input.aria-label"),
135
+ defaultMessage: "Color picker input"
136
+ }),
137
+ style: { textTransform: "uppercase" },
138
+ value,
139
+ placeholder: "#000000",
140
+ onChange
141
+ }
142
+ ) })
143
+ ] })
144
+ ] })
145
+ ] }),
146
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {}),
147
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
148
+ ] }) });
149
+ }
150
+ );
151
+ exports.ColorPickerInput = ColorPickerInput;
@@ -0,0 +1,133 @@
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-CgXv8Era.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
+ };
@@ -13,4 +13,3 @@ const cs = {
13
13
  "color-picker.toggle.aria-label": "Přepínač výběru barvy"
14
14
  };
15
15
  exports.default = cs;
16
- //# sourceMappingURL=cs-4GdZY0p6.js.map
@@ -13,4 +13,3 @@ const cs = {
13
13
  export {
14
14
  cs as default
15
15
  };
16
- //# sourceMappingURL=cs-A2xRj-2-.mjs.map
@@ -16,4 +16,3 @@ const en = {
16
16
  export {
17
17
  en as default
18
18
  };
19
- //# sourceMappingURL=en-L6ZZWDJv.mjs.map
@@ -16,4 +16,3 @@ const en = {
16
16
  "plugin.name": "Color picker"
17
17
  };
18
18
  exports.default = en;
19
- //# sourceMappingURL=en-WeRHjVEB.js.map
@@ -1,21 +1,25 @@
1
1
  "use strict";
2
- const helperPlugin = require("@strapi/helper-plugin");
3
2
  const jsxRuntime = require("react/jsx-runtime");
4
3
  const designSystem = require("@strapi/design-system");
5
4
  const icons = require("@strapi/icons");
6
- const styled = require("styled-components");
7
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
8
- const styled__default = /* @__PURE__ */ _interopDefault(styled);
9
- const __variableDynamicImportRuntimeHelper = (glob, path) => {
5
+ const styledComponents = require("styled-components");
6
+ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
10
7
  const v = glob[path];
11
8
  if (v) {
12
9
  return typeof v === "function" ? v() : Promise.resolve(v);
13
10
  }
14
11
  return new Promise((_, reject) => {
15
- (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(reject.bind(null, new Error("Unknown variable dynamic import: " + path)));
12
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
13
+ reject.bind(
14
+ null,
15
+ new Error(
16
+ "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
17
+ )
18
+ )
19
+ );
16
20
  });
17
21
  };
18
- const IconBox = styled__default.default(designSystem.Flex)`
22
+ const IconBox = styledComponents.styled(designSystem.Flex)`
19
23
  /* Hard code color values */
20
24
  /* to stay consistent between themes */
21
25
  background-color: #f0f0ff; /* primary100 */
@@ -26,10 +30,16 @@ const IconBox = styled__default.default(designSystem.Flex)`
26
30
  }
27
31
  `;
28
32
  const ColorPickerIcon = () => {
29
- return /* @__PURE__ */ jsxRuntime.jsx(IconBox, { justifyContent: "center", alignItems: "center", width: 7, height: 6, hasRadius: true, "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { as: icons.Paint }) });
33
+ return /* @__PURE__ */ jsxRuntime.jsx(IconBox, { justifyContent: "center", alignItems: "center", width: 7, height: 6, hasRadius: true, "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx(icons.PaintBrush, {}) });
30
34
  };
31
35
  const pluginId = "color-picker";
32
36
  const getTrad = (id) => `${pluginId}.${id}`;
37
+ const prefixPluginTranslations = (trad, pluginId2) => {
38
+ return Object.keys(trad).reduce((acc, current) => {
39
+ acc[`${pluginId2}.${current}`] = trad[current];
40
+ return acc;
41
+ }, {});
42
+ };
33
43
  const index = {
34
44
  /**
35
45
  * TODO: we need to have the type for StrapiApp done from `@strapi/admin` package.
@@ -50,7 +60,7 @@ const index = {
50
60
  defaultMessage: "Select any color"
51
61
  },
52
62
  components: {
53
- Input: async () => Promise.resolve().then(() => require("./ColorPickerInput-0lOoTrf0.js")).then((module2) => ({
63
+ Input: async () => Promise.resolve().then(() => require("./ColorPickerInput-D6xkBHIN.js")).then((module2) => ({
54
64
  default: module2.ColorPickerInput
55
65
  }))
56
66
  },
@@ -96,9 +106,9 @@ const index = {
96
106
  async registerTrads({ locales }) {
97
107
  const importedTrads = await Promise.all(
98
108
  locales.map((locale) => {
99
- return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/cs.json": () => Promise.resolve().then(() => require("./cs-4GdZY0p6.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-WeRHjVEB.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("./ru-UXN_ByI9.js")), "./translations/sv.json": () => Promise.resolve().then(() => require("./sv-3-Yk9bKb.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("./tr-AbD-f8F0.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("./zh-c23gv_oM.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
109
+ 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`, 3).then(({ default: data }) => {
100
110
  return {
101
- data: helperPlugin.prefixPluginTranslations(data, pluginId),
111
+ data: prefixPluginTranslations(data, pluginId),
102
112
  locale
103
113
  };
104
114
  }).catch(() => {
@@ -114,4 +124,3 @@ const index = {
114
124
  };
115
125
  exports.getTrad = getTrad;
116
126
  exports.index = index;
117
- //# sourceMappingURL=index-OJYEuoCq.js.map
@@ -1,15 +1,21 @@
1
- import { prefixPluginTranslations } from "@strapi/helper-plugin";
2
1
  import { jsx } from "react/jsx-runtime";
3
- import { Flex, Icon } from "@strapi/design-system";
4
- import { Paint } from "@strapi/icons";
5
- import styled from "styled-components";
6
- const __variableDynamicImportRuntimeHelper = (glob, path) => {
2
+ import { Flex } from "@strapi/design-system";
3
+ import { PaintBrush } from "@strapi/icons";
4
+ import { styled } from "styled-components";
5
+ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
7
6
  const v = glob[path];
8
7
  if (v) {
9
8
  return typeof v === "function" ? v() : Promise.resolve(v);
10
9
  }
11
10
  return new Promise((_, reject) => {
12
- (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(reject.bind(null, new Error("Unknown variable dynamic import: " + path)));
11
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
12
+ reject.bind(
13
+ null,
14
+ new Error(
15
+ "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
16
+ )
17
+ )
18
+ );
13
19
  });
14
20
  };
15
21
  const IconBox = styled(Flex)`
@@ -23,10 +29,16 @@ const IconBox = styled(Flex)`
23
29
  }
24
30
  `;
25
31
  const ColorPickerIcon = () => {
26
- return /* @__PURE__ */ jsx(IconBox, { justifyContent: "center", alignItems: "center", width: 7, height: 6, hasRadius: true, "aria-hidden": true, children: /* @__PURE__ */ jsx(Icon, { as: Paint }) });
32
+ return /* @__PURE__ */ jsx(IconBox, { justifyContent: "center", alignItems: "center", width: 7, height: 6, hasRadius: true, "aria-hidden": true, children: /* @__PURE__ */ jsx(PaintBrush, {}) });
27
33
  };
28
34
  const pluginId = "color-picker";
29
35
  const getTrad = (id) => `${pluginId}.${id}`;
36
+ const prefixPluginTranslations = (trad, pluginId2) => {
37
+ return Object.keys(trad).reduce((acc, current) => {
38
+ acc[`${pluginId2}.${current}`] = trad[current];
39
+ return acc;
40
+ }, {});
41
+ };
30
42
  const index = {
31
43
  /**
32
44
  * TODO: we need to have the type for StrapiApp done from `@strapi/admin` package.
@@ -47,7 +59,7 @@ const index = {
47
59
  defaultMessage: "Select any color"
48
60
  },
49
61
  components: {
50
- Input: async () => import("./ColorPickerInput-fKB6YXW8.mjs").then((module) => ({
62
+ Input: async () => import("./ColorPickerInput-m6ZX3Kq-.mjs").then((module) => ({
51
63
  default: module.ColorPickerInput
52
64
  }))
53
65
  },
@@ -93,7 +105,7 @@ const index = {
93
105
  async registerTrads({ locales }) {
94
106
  const importedTrads = await Promise.all(
95
107
  locales.map((locale) => {
96
- return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/cs.json": () => import("./cs-A2xRj-2-.mjs"), "./translations/en.json": () => import("./en-L6ZZWDJv.mjs"), "./translations/ru.json": () => import("./ru-LLXYEOwl.mjs"), "./translations/sv.json": () => import("./sv-QqRPNQLw.mjs"), "./translations/tr.json": () => import("./tr-qYGSw8gH.mjs"), "./translations/zh.json": () => import("./zh-fPTOIT6s.mjs") }), `./translations/${locale}.json`).then(({ default: data }) => {
108
+ 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`, 3).then(({ default: data }) => {
97
109
  return {
98
110
  data: prefixPluginTranslations(data, pluginId),
99
111
  locale
@@ -113,4 +125,3 @@ export {
113
125
  getTrad as g,
114
126
  index as i
115
127
  };
116
- //# sourceMappingURL=index-uOrtnJpz.mjs.map
@@ -16,4 +16,3 @@ const ru = {
16
16
  "plugin.name": "Выбор цвета"
17
17
  };
18
18
  exports.default = ru;
19
- //# sourceMappingURL=ru-UXN_ByI9.js.map
@@ -16,4 +16,3 @@ const ru = {
16
16
  export {
17
17
  ru as default
18
18
  };
19
- //# sourceMappingURL=ru-LLXYEOwl.mjs.map
@@ -13,4 +13,3 @@ const sv = {
13
13
  export {
14
14
  sv as default
15
15
  };
16
- //# sourceMappingURL=sv-QqRPNQLw.mjs.map
@@ -13,4 +13,3 @@ const sv = {
13
13
  "color-picker.toggle.aria-label": "Växla färgväljare"
14
14
  };
15
15
  exports.default = sv;
16
- //# sourceMappingURL=sv-3-Yk9bKb.js.map
@@ -13,4 +13,3 @@ const tr = {
13
13
  export {
14
14
  tr as default
15
15
  };
16
- //# sourceMappingURL=tr-qYGSw8gH.mjs.map
@@ -13,4 +13,3 @@ const tr = {
13
13
  "color-picker.toggle.aria-label": "Renk seçici anahtarı"
14
14
  };
15
15
  exports.default = tr;
16
- //# sourceMappingURL=tr-AbD-f8F0.js.map
@@ -13,4 +13,3 @@ const zh = {
13
13
  export {
14
14
  zh as default
15
15
  };
16
- //# sourceMappingURL=zh-fPTOIT6s.mjs.map
@@ -13,4 +13,3 @@ const zh = {
13
13
  "color-picker.toggle.aria-label": "選色器開關"
14
14
  };
15
15
  exports.default = zh;
16
- //# sourceMappingURL=zh-c23gv_oM.js.map
@@ -1,9 +1,3 @@
1
1
  "use strict";
2
- const index = require("../_chunks/index-OJYEuoCq.js");
3
- require("@strapi/helper-plugin");
4
- require("react/jsx-runtime");
5
- require("@strapi/design-system");
6
- require("@strapi/icons");
7
- require("styled-components");
2
+ const index = require("../_chunks/index-CCLaPAwT.js");
8
3
  module.exports = index.index;
9
- //# sourceMappingURL=index.js.map
@@ -1,10 +1,4 @@
1
- import { i } from "../_chunks/index-uOrtnJpz.mjs";
2
- import "@strapi/helper-plugin";
3
- import "react/jsx-runtime";
4
- import "@strapi/design-system";
5
- import "@strapi/icons";
6
- import "styled-components";
1
+ import { i } from "../_chunks/index-CgXv8Era.mjs";
7
2
  export {
8
3
  i as default
9
4
  };
10
- //# sourceMappingURL=index.mjs.map
@@ -1,32 +1,7 @@
1
1
  import * as React from 'react';
2
- import { MessageDescriptor } from 'react-intl';
3
- /**
4
- * TODO: A lot of these props should extend `FieldProps`
5
- */
6
- interface ColorPickerInputProps {
7
- intlLabel: MessageDescriptor;
8
- /**
9
- * TODO: this should be extended from `FieldInputProps['onChange']
10
- * but that conflicts with it's secondary usage in `HexColorPicker`
11
- */
12
- onChange: (event: {
13
- target: {
14
- name: string;
15
- value: string;
16
- type: string;
17
- };
18
- }) => void;
19
- attribute: {
20
- type: string;
21
- [key: string]: unknown;
22
- };
23
- name: string;
24
- description?: MessageDescriptor;
25
- disabled?: boolean;
26
- error?: string;
2
+ import { type InputProps, type FieldValue } from '@strapi/strapi/admin';
3
+ type ColorPickerInputProps = InputProps & FieldValue & {
27
4
  labelAction?: React.ReactNode;
28
- required?: boolean;
29
- value?: string;
30
- }
5
+ };
31
6
  export declare const ColorPickerInput: React.ForwardRefExoticComponent<ColorPickerInputProps & React.RefAttributes<HTMLButtonElement>>;
32
7
  export {};
@@ -0,0 +1,3 @@
1
+ type TradOptions = Record<string, string>;
2
+ declare const prefixPluginTranslations: (trad: TradOptions, pluginId: string) => TradOptions;
3
+ export { prefixPluginTranslations };
@@ -10,4 +10,3 @@ const index = {
10
10
  register
11
11
  };
12
12
  module.exports = index;
13
- //# sourceMappingURL=index.js.map
@@ -11,4 +11,3 @@ const index = {
11
11
  export {
12
12
  index as default
13
13
  };
14
- //# sourceMappingURL=index.mjs.map