@strapi/plugin-color-picker 0.0.0-next.837384c065457f44cba22eb6fb56079cc4b04a2b → 0.0.0-next.83f9ccf1fd746ed4fad4bebf04cf998ddaafb5bc

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 (79) hide show
  1. package/dist/admin/components/ColorPickerIcon.js +31 -0
  2. package/dist/admin/components/ColorPickerIcon.js.map +1 -0
  3. package/dist/admin/components/ColorPickerIcon.mjs +29 -0
  4. package/dist/admin/components/ColorPickerIcon.mjs.map +1 -0
  5. package/dist/admin/components/ColorPickerInput.js +199 -0
  6. package/dist/admin/components/ColorPickerInput.js.map +1 -0
  7. package/dist/admin/components/ColorPickerInput.mjs +178 -0
  8. package/dist/admin/components/ColorPickerInput.mjs.map +1 -0
  9. package/dist/admin/index.js +108 -3
  10. package/dist/admin/index.js.map +1 -0
  11. package/dist/admin/index.mjs +103 -3
  12. package/dist/admin/index.mjs.map +1 -0
  13. package/dist/admin/pluginId.js +6 -0
  14. package/dist/admin/pluginId.js.map +1 -0
  15. package/dist/admin/pluginId.mjs +4 -0
  16. package/dist/admin/pluginId.mjs.map +1 -0
  17. package/dist/admin/src/components/ColorPickerInput.d.ts +2 -2
  18. package/dist/admin/src/components/tests/ColorPickerInput.test.d.ts +1 -0
  19. package/dist/admin/translations/cs.json.js +17 -0
  20. package/dist/admin/translations/cs.json.js.map +1 -0
  21. package/dist/admin/translations/cs.json.mjs +15 -0
  22. package/dist/admin/translations/cs.json.mjs.map +1 -0
  23. package/dist/admin/translations/en.json.js +20 -0
  24. package/dist/admin/translations/en.json.js.map +1 -0
  25. package/dist/admin/translations/en.json.mjs +18 -0
  26. package/dist/admin/translations/en.json.mjs.map +1 -0
  27. package/dist/admin/translations/ru.json.js +20 -0
  28. package/dist/admin/translations/ru.json.js.map +1 -0
  29. package/dist/admin/translations/ru.json.mjs +18 -0
  30. package/dist/admin/translations/ru.json.mjs.map +1 -0
  31. package/dist/admin/translations/sv.json.js +17 -0
  32. package/dist/admin/translations/sv.json.js.map +1 -0
  33. package/dist/admin/translations/sv.json.mjs +15 -0
  34. package/dist/admin/translations/sv.json.mjs.map +1 -0
  35. package/dist/admin/translations/tr.json.js +17 -0
  36. package/dist/admin/translations/tr.json.js.map +1 -0
  37. package/dist/admin/translations/tr.json.mjs +15 -0
  38. package/dist/admin/translations/tr.json.mjs.map +1 -0
  39. package/dist/admin/translations/uk.json.js +20 -0
  40. package/dist/admin/translations/uk.json.js.map +1 -0
  41. package/dist/admin/translations/uk.json.mjs +18 -0
  42. package/dist/admin/translations/uk.json.mjs.map +1 -0
  43. package/dist/admin/translations/zh.json.js +17 -0
  44. package/dist/admin/translations/zh.json.js.map +1 -0
  45. package/dist/admin/translations/zh.json.mjs +15 -0
  46. package/dist/admin/translations/zh.json.mjs.map +1 -0
  47. package/dist/admin/utils/getTrad.js +8 -0
  48. package/dist/admin/utils/getTrad.js.map +1 -0
  49. package/dist/admin/utils/getTrad.mjs +6 -0
  50. package/dist/admin/utils/getTrad.mjs.map +1 -0
  51. package/dist/admin/utils/prefixPluginTranslations.js +11 -0
  52. package/dist/admin/utils/prefixPluginTranslations.js.map +1 -0
  53. package/dist/admin/utils/prefixPluginTranslations.mjs +9 -0
  54. package/dist/admin/utils/prefixPluginTranslations.mjs.map +1 -0
  55. package/dist/server/index.js +8 -10
  56. package/dist/server/index.js.map +1 -0
  57. package/dist/server/index.mjs +7 -12
  58. package/dist/server/index.mjs.map +1 -0
  59. package/dist/server/register.js +12 -0
  60. package/dist/server/register.js.map +1 -0
  61. package/dist/server/register.mjs +10 -0
  62. package/dist/server/register.mjs.map +1 -0
  63. package/package.json +15 -13
  64. package/dist/_chunks/ColorPickerInput-D6xkBHIN.js +0 -151
  65. package/dist/_chunks/ColorPickerInput-m6ZX3Kq-.mjs +0 -133
  66. package/dist/_chunks/cs-CKl0OyEH.js +0 -15
  67. package/dist/_chunks/cs-DMmE6LK7.mjs +0 -15
  68. package/dist/_chunks/en-BlDau3us.mjs +0 -18
  69. package/dist/_chunks/en-Ct0C5cA2.js +0 -18
  70. package/dist/_chunks/index-CCLaPAwT.js +0 -126
  71. package/dist/_chunks/index-CgXv8Era.mjs +0 -127
  72. package/dist/_chunks/ru-Wrg-npZz.js +0 -18
  73. package/dist/_chunks/ru-aOnA-eym.mjs +0 -18
  74. package/dist/_chunks/sv-BaFDND79.mjs +0 -15
  75. package/dist/_chunks/sv-CKY6es_6.js +0 -15
  76. package/dist/_chunks/tr-CHHW_hYI.mjs +0 -15
  77. package/dist/_chunks/tr-DcLzQS-J.js +0 -15
  78. package/dist/_chunks/zh-DBH6uCXb.mjs +0 -15
  79. package/dist/_chunks/zh-T5cJzhPD.js +0 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/plugin-color-picker",
3
- "version": "0.0.0-next.837384c065457f44cba22eb6fb56079cc4b04a2b",
3
+ "version": "0.0.0-next.83f9ccf1fd746ed4fad4bebf04cf998ddaafb5bc",
4
4
  "description": "Strapi maintained Custom Fields",
5
5
  "repository": {
6
6
  "type": "git",
@@ -42,7 +42,11 @@
42
42
  "strapi-server.js"
43
43
  ],
44
44
  "scripts": {
45
- "build": "strapi-plugin build",
45
+ "build": "run -T npm-run-all clean --parallel build:code build:types",
46
+ "build:code": "run -T rollup -c",
47
+ "build:types": "run -T run-p build:types:server build:types:admin",
48
+ "build:types:server": "run -T tsc -p server/tsconfig.build.json --emitDeclarationOnly",
49
+ "build:types:admin": "run -T tsc -p admin/tsconfig.build.json --emitDeclarationOnly",
46
50
  "clean": "run -T rimraf ./dist",
47
51
  "lint": "run -T eslint .",
48
52
  "test:front": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js",
@@ -50,24 +54,23 @@
50
54
  "test:front:watch": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js --watchAll",
51
55
  "test:front:watch:ce": "run -T cross-env IS_EE=false jest --config ./jest.config.front.js --watchAll",
52
56
  "test:ts:front": "run -T tsc -p admin/tsconfig.json",
53
- "watch": "strapi-plugin watch"
57
+ "watch": "run -T rollup -c -w"
54
58
  },
55
59
  "dependencies": {
56
- "@strapi/design-system": "2.0.0-rc.14",
57
- "@strapi/icons": "2.0.0-rc.14",
60
+ "@strapi/design-system": "2.0.1",
61
+ "@strapi/icons": "2.0.1",
58
62
  "react-colorful": "5.6.1",
59
63
  "react-intl": "6.6.2"
60
64
  },
61
65
  "devDependencies": {
62
- "@strapi/sdk-plugin": "^5.2.0",
63
- "@strapi/strapi": "0.0.0-next.837384c065457f44cba22eb6fb56079cc4b04a2b",
64
- "@testing-library/react": "15.0.7",
65
- "@testing-library/user-event": "14.5.2",
66
+ "@strapi/strapi": "0.0.0-next.83f9ccf1fd746ed4fad4bebf04cf998ddaafb5bc",
67
+ "@testing-library/react": "16.3.0",
68
+ "@testing-library/user-event": "14.6.1",
66
69
  "react": "18.3.1",
67
70
  "react-dom": "18.3.1",
68
71
  "react-router-dom": "6.22.3",
69
72
  "styled-components": "6.1.8",
70
- "typescript": "5.3.2"
73
+ "typescript": "5.4.4"
71
74
  },
72
75
  "peerDependencies": {
73
76
  "@strapi/strapi": "^5.0.0",
@@ -77,7 +80,7 @@
77
80
  "styled-components": "^6.0.0"
78
81
  },
79
82
  "engines": {
80
- "node": ">=18.0.0 <=22.x.x",
83
+ "node": ">=20.0.0 <=24.x.x",
81
84
  "npm": ">=6.0.0"
82
85
  },
83
86
  "strapi": {
@@ -85,6 +88,5 @@
85
88
  "description": "Color picker custom field",
86
89
  "kind": "plugin",
87
90
  "displayName": "Color Picker"
88
- },
89
- "gitHead": "837384c065457f44cba22eb6fb56079cc4b04a2b"
91
+ }
90
92
  }
@@ -1,151 +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 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;
@@ -1,133 +0,0 @@
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
- };
@@ -1,15 +0,0 @@
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;
@@ -1,15 +0,0 @@
1
- const cs = {
2
- "color-picker.description": "Vyberte libovolnou barvu",
3
- "color-picker.input.aria-label": "Vstup pro výběr barvy",
4
- "color-picker.input.format": "HEX",
5
- "color-picker.label": "Barva",
6
- "color-picker.options.advanced.regex": "RegExp vzor",
7
- "color-picker.options.advanced.regex.description": "Zadejte regulární výraz pro ověření hodnoty HEX",
8
- "color-picker.options.advanced.requiredField": "Povinné pole",
9
- "color-picker.options.advanced.requiredField.description": "Pokud je toto pole prázdné, nebudete moci vytvořit záznam",
10
- "color-picker.settings": "Nastavení",
11
- "color-picker.toggle.aria-label": "Přepínač výběru barvy"
12
- };
13
- export {
14
- cs as default
15
- };
@@ -1,18 +0,0 @@
1
- const en = {
2
- "color-picker.description": "Select any color",
3
- "color-picker.input.aria-label": "Color picker input",
4
- "color-picker.input.format": "HEX",
5
- "color-picker.label": "Color",
6
- "color-picker.options.advanced.regex": "RegExp pattern",
7
- "color-picker.options.advanced.regex.description": "Provide a regular expression to validate the HEX value",
8
- "color-picker.options.advanced.requiredField": "Required field",
9
- "color-picker.options.advanced.requiredField.description": "You won't be able to create an entry if this field is empty",
10
- "color-picker.settings": "Settings",
11
- "color-picker.toggle.aria-label": "Color picker toggle",
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
- "plugin.description.short": "A Strapi-maintained color picker custom field.",
14
- "plugin.name": "Color picker"
15
- };
16
- export {
17
- en as default
18
- };
@@ -1,18 +0,0 @@
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;
@@ -1,126 +0,0 @@
1
- "use strict";
2
- const jsxRuntime = require("react/jsx-runtime");
3
- const designSystem = require("@strapi/design-system");
4
- const icons = require("@strapi/icons");
5
- const styledComponents = require("styled-components");
6
- const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
7
- const v = glob[path];
8
- if (v) {
9
- return typeof v === "function" ? v() : Promise.resolve(v);
10
- }
11
- return new Promise((_, reject) => {
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
- );
20
- });
21
- };
22
- const IconBox = styledComponents.styled(designSystem.Flex)`
23
- /* Hard code color values */
24
- /* to stay consistent between themes */
25
- background-color: #f0f0ff; /* primary100 */
26
- border: 1px solid #d9d8ff; /* primary200 */
27
-
28
- svg > path {
29
- fill: #4945ff; /* primary600 */
30
- }
31
- `;
32
- const ColorPickerIcon = () => {
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, {}) });
34
- };
35
- const pluginId = "color-picker";
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
- };
43
- const index = {
44
- /**
45
- * TODO: we need to have the type for StrapiApp done from `@strapi/admin` package.
46
- */
47
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
48
- register(app) {
49
- app.customFields.register({
50
- name: "color",
51
- pluginId: "color-picker",
52
- type: "string",
53
- icon: ColorPickerIcon,
54
- intlLabel: {
55
- id: getTrad("color-picker.label"),
56
- defaultMessage: "Color"
57
- },
58
- intlDescription: {
59
- id: getTrad("color-picker.description"),
60
- defaultMessage: "Select any color"
61
- },
62
- components: {
63
- Input: async () => Promise.resolve().then(() => require("./ColorPickerInput-D6xkBHIN.js")).then((module2) => ({
64
- default: module2.ColorPickerInput
65
- }))
66
- },
67
- options: {
68
- advanced: [
69
- {
70
- intlLabel: {
71
- id: getTrad("color-picker.options.advanced.regex"),
72
- defaultMessage: "RegExp pattern"
73
- },
74
- name: "regex",
75
- type: "text",
76
- defaultValue: "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",
77
- description: {
78
- id: getTrad("color-picker.options.advanced.regex.description"),
79
- defaultMessage: "The text of the regular expression"
80
- }
81
- },
82
- {
83
- sectionTitle: {
84
- id: "global.settings",
85
- defaultMessage: "Settings"
86
- },
87
- items: [
88
- {
89
- name: "required",
90
- type: "checkbox",
91
- intlLabel: {
92
- id: getTrad("color-picker.options.advanced.requiredField"),
93
- defaultMessage: "Required field"
94
- },
95
- description: {
96
- id: getTrad("color-picker.options.advanced.requiredField.description"),
97
- defaultMessage: "You won't be able to create an entry if this field is empty"
98
- }
99
- }
100
- ]
101
- }
102
- ]
103
- }
104
- });
105
- },
106
- async registerTrads({ locales }) {
107
- const importedTrads = await Promise.all(
108
- locales.map((locale) => {
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 }) => {
110
- return {
111
- data: prefixPluginTranslations(data, pluginId),
112
- locale
113
- };
114
- }).catch(() => {
115
- return {
116
- data: {},
117
- locale
118
- };
119
- });
120
- })
121
- );
122
- return Promise.resolve(importedTrads);
123
- }
124
- };
125
- exports.getTrad = getTrad;
126
- exports.index = index;
@@ -1,127 +0,0 @@
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, segs) => {
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)(
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
- );
19
- });
20
- };
21
- const IconBox = styled(Flex)`
22
- /* Hard code color values */
23
- /* to stay consistent between themes */
24
- background-color: #f0f0ff; /* primary100 */
25
- border: 1px solid #d9d8ff; /* primary200 */
26
-
27
- svg > path {
28
- fill: #4945ff; /* primary600 */
29
- }
30
- `;
31
- const ColorPickerIcon = () => {
32
- return /* @__PURE__ */ jsx(IconBox, { justifyContent: "center", alignItems: "center", width: 7, height: 6, hasRadius: true, "aria-hidden": true, children: /* @__PURE__ */ jsx(PaintBrush, {}) });
33
- };
34
- const pluginId = "color-picker";
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
- };
42
- const index = {
43
- /**
44
- * TODO: we need to have the type for StrapiApp done from `@strapi/admin` package.
45
- */
46
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
47
- register(app) {
48
- app.customFields.register({
49
- name: "color",
50
- pluginId: "color-picker",
51
- type: "string",
52
- icon: ColorPickerIcon,
53
- intlLabel: {
54
- id: getTrad("color-picker.label"),
55
- defaultMessage: "Color"
56
- },
57
- intlDescription: {
58
- id: getTrad("color-picker.description"),
59
- defaultMessage: "Select any color"
60
- },
61
- components: {
62
- Input: async () => import("./ColorPickerInput-m6ZX3Kq-.mjs").then((module) => ({
63
- default: module.ColorPickerInput
64
- }))
65
- },
66
- options: {
67
- advanced: [
68
- {
69
- intlLabel: {
70
- id: getTrad("color-picker.options.advanced.regex"),
71
- defaultMessage: "RegExp pattern"
72
- },
73
- name: "regex",
74
- type: "text",
75
- defaultValue: "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",
76
- description: {
77
- id: getTrad("color-picker.options.advanced.regex.description"),
78
- defaultMessage: "The text of the regular expression"
79
- }
80
- },
81
- {
82
- sectionTitle: {
83
- id: "global.settings",
84
- defaultMessage: "Settings"
85
- },
86
- items: [
87
- {
88
- name: "required",
89
- type: "checkbox",
90
- intlLabel: {
91
- id: getTrad("color-picker.options.advanced.requiredField"),
92
- defaultMessage: "Required field"
93
- },
94
- description: {
95
- id: getTrad("color-picker.options.advanced.requiredField.description"),
96
- defaultMessage: "You won't be able to create an entry if this field is empty"
97
- }
98
- }
99
- ]
100
- }
101
- ]
102
- }
103
- });
104
- },
105
- async registerTrads({ locales }) {
106
- const importedTrads = await Promise.all(
107
- locales.map((locale) => {
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 }) => {
109
- return {
110
- data: prefixPluginTranslations(data, pluginId),
111
- locale
112
- };
113
- }).catch(() => {
114
- return {
115
- data: {},
116
- locale
117
- };
118
- });
119
- })
120
- );
121
- return Promise.resolve(importedTrads);
122
- }
123
- };
124
- export {
125
- getTrad as g,
126
- index as i
127
- };