@strapi/plugin-color-picker 0.0.0-next.fc1775f7731f8999840e56e298a216b9a6c5c4ad → 0.0.0-next.fc9d26d995624dc886b29f563e1de655d47e6609

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 (58) hide show
  1. package/dist/admin/chunks/ColorPickerInput-BO3lsUmM.js +178 -0
  2. package/dist/admin/chunks/ColorPickerInput-BO3lsUmM.js.map +1 -0
  3. package/dist/admin/chunks/ColorPickerInput-CR8yH0F7.js +199 -0
  4. package/dist/admin/chunks/ColorPickerInput-CR8yH0F7.js.map +1 -0
  5. package/dist/admin/chunks/cs-BI5icLZ-.js +15 -0
  6. package/dist/admin/chunks/cs-BI5icLZ-.js.map +1 -0
  7. package/dist/admin/chunks/cs-DABbHfFT.js +17 -0
  8. package/dist/admin/chunks/cs-DABbHfFT.js.map +1 -0
  9. package/dist/admin/chunks/en-DhCwQ39J.js +20 -0
  10. package/dist/admin/chunks/en-DhCwQ39J.js.map +1 -0
  11. package/dist/admin/chunks/en-uI0wnpc1.js +18 -0
  12. package/dist/admin/chunks/en-uI0wnpc1.js.map +1 -0
  13. package/dist/admin/chunks/index-EI7HMw_Q.js +136 -0
  14. package/dist/admin/chunks/index-EI7HMw_Q.js.map +1 -0
  15. package/dist/admin/chunks/index-jpCMMLS-.js +139 -0
  16. package/dist/admin/chunks/index-jpCMMLS-.js.map +1 -0
  17. package/dist/admin/chunks/ru-DQvhmgfv.js +18 -0
  18. package/dist/admin/chunks/ru-DQvhmgfv.js.map +1 -0
  19. package/dist/admin/chunks/ru-DrsXE-1P.js +20 -0
  20. package/dist/admin/chunks/ru-DrsXE-1P.js.map +1 -0
  21. package/dist/admin/chunks/sv-BBGOioTo.js +17 -0
  22. package/dist/admin/chunks/sv-BBGOioTo.js.map +1 -0
  23. package/dist/admin/chunks/sv-soBCY9Rd.js +15 -0
  24. package/dist/admin/chunks/sv-soBCY9Rd.js.map +1 -0
  25. package/dist/admin/chunks/tr-D3HpnJJI.js +17 -0
  26. package/dist/admin/chunks/tr-D3HpnJJI.js.map +1 -0
  27. package/dist/admin/chunks/tr-pt6M-dRX.js +15 -0
  28. package/dist/admin/chunks/tr-pt6M-dRX.js.map +1 -0
  29. package/dist/admin/chunks/zh-CRS3clD4.js +17 -0
  30. package/dist/admin/chunks/zh-CRS3clD4.js.map +1 -0
  31. package/dist/admin/chunks/zh-DQMeqBK7.js +15 -0
  32. package/dist/admin/chunks/zh-DQMeqBK7.js.map +1 -0
  33. package/dist/admin/index.js +11 -2
  34. package/dist/admin/index.js.map +1 -0
  35. package/dist/admin/index.mjs +6 -4
  36. package/dist/admin/index.mjs.map +1 -0
  37. package/dist/admin/src/components/tests/ColorPickerInput.test.d.ts +1 -0
  38. package/dist/server/index.js +13 -9
  39. package/dist/server/index.js.map +1 -0
  40. package/dist/server/index.mjs +12 -11
  41. package/dist/server/index.mjs.map +1 -0
  42. package/package.json +9 -5
  43. package/dist/_chunks/ColorPickerInput-BiwD6BEw.mjs +0 -137
  44. package/dist/_chunks/ColorPickerInput-gD_Mb6qe.js +0 -155
  45. package/dist/_chunks/cs-CKl0OyEH.js +0 -15
  46. package/dist/_chunks/cs-DMmE6LK7.mjs +0 -15
  47. package/dist/_chunks/en-BlDau3us.mjs +0 -18
  48. package/dist/_chunks/en-Ct0C5cA2.js +0 -18
  49. package/dist/_chunks/index-CNTxZbMN.js +0 -126
  50. package/dist/_chunks/index-dnY2u5Dg.mjs +0 -127
  51. package/dist/_chunks/ru-Wrg-npZz.js +0 -18
  52. package/dist/_chunks/ru-aOnA-eym.mjs +0 -18
  53. package/dist/_chunks/sv-BaFDND79.mjs +0 -15
  54. package/dist/_chunks/sv-CKY6es_6.js +0 -15
  55. package/dist/_chunks/tr-CHHW_hYI.mjs +0 -15
  56. package/dist/_chunks/tr-DcLzQS-J.js +0 -15
  57. package/dist/_chunks/zh-DBH6uCXb.mjs +0 -15
  58. package/dist/_chunks/zh-T5cJzhPD.js +0 -15
@@ -0,0 +1,178 @@
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 { useField } from '@strapi/strapi/admin';
6
+ import { HexColorPicker } from 'react-colorful';
7
+ import { useIntl } from 'react-intl';
8
+ import { styled } from 'styled-components';
9
+ import { g as getTrad } from './index-EI7HMw_Q.js';
10
+
11
+ const ColorPreview = styled.div`
12
+ border-radius: 50%;
13
+ width: 20px;
14
+ height: 20px;
15
+ margin-right: 10px;
16
+ background-color: ${(props)=>props.color};
17
+ border: 1px solid rgba(0, 0, 0, 0.1);
18
+ `;
19
+ const ColorPicker = styled(HexColorPicker)`
20
+ && {
21
+ width: 100%;
22
+ aspect-ratio: 1.5;
23
+ }
24
+
25
+ .react-colorful__pointer {
26
+ width: ${({ theme })=>theme.spaces[3]};
27
+ height: ${({ theme })=>theme.spaces[3]};
28
+ }
29
+
30
+ .react-colorful__saturation {
31
+ border-radius: ${({ theme })=>theme.spaces[1]};
32
+ border-bottom: none;
33
+ }
34
+
35
+ .react-colorful__hue {
36
+ border-radius: 10px;
37
+ height: ${({ theme })=>theme.spaces[3]};
38
+ margin-top: ${({ theme })=>theme.spaces[2]};
39
+ }
40
+ `;
41
+ const ColorPickerToggle = styled(Button)`
42
+ & > span {
43
+ display: flex;
44
+ justify-content: space-between;
45
+ align-items: center;
46
+ width: 100%;
47
+ }
48
+
49
+ svg {
50
+ width: ${({ theme })=>theme.spaces[2]};
51
+ height: ${({ theme })=>theme.spaces[2]};
52
+ }
53
+
54
+ svg > path {
55
+ fill: ${({ theme })=>theme.colors.neutral500};
56
+ justify-self: flex-end;
57
+ }
58
+ `;
59
+ const ColorPickerPopover = styled(Popover.Content)`
60
+ padding: ${({ theme })=>theme.spaces[2]};
61
+ min-height: 270px;
62
+ `;
63
+ const ColorPickerInput = /*#__PURE__*/ React.forwardRef(({ hint, disabled, labelAction, label, name, required, ...props }, forwardedRef)=>{
64
+ const [showColorPicker, setShowColorPicker] = React.useState(false);
65
+ const colorPickerButtonRef = React.useRef(null);
66
+ const { formatMessage } = useIntl();
67
+ const field = useField(name);
68
+ const color = field.value ?? '#000000';
69
+ const composedRefs = useComposedRefs(forwardedRef, colorPickerButtonRef);
70
+ return /*#__PURE__*/ jsx(Field.Root, {
71
+ name: name,
72
+ id: name,
73
+ error: field.error,
74
+ hint: hint,
75
+ required: required,
76
+ children: /*#__PURE__*/ jsxs(Flex, {
77
+ direction: "column",
78
+ alignItems: "stretch",
79
+ gap: 1,
80
+ children: [
81
+ /*#__PURE__*/ jsx(Field.Label, {
82
+ action: labelAction,
83
+ children: label
84
+ }),
85
+ /*#__PURE__*/ jsxs(Popover.Root, {
86
+ onOpenChange: setShowColorPicker,
87
+ children: [
88
+ /*#__PURE__*/ jsx(Popover.Trigger, {
89
+ children: /*#__PURE__*/ jsxs(ColorPickerToggle, {
90
+ ref: composedRefs,
91
+ "aria-label": formatMessage({
92
+ id: getTrad('color-picker.toggle.aria-label'),
93
+ defaultMessage: 'Color picker toggle'
94
+ }),
95
+ "aria-controls": "color-picker-value",
96
+ "aria-haspopup": "dialog",
97
+ "aria-expanded": showColorPicker,
98
+ "aria-disabled": disabled,
99
+ disabled: disabled,
100
+ variant: "tertiary",
101
+ size: "L",
102
+ children: [
103
+ /*#__PURE__*/ jsxs(Flex, {
104
+ children: [
105
+ /*#__PURE__*/ jsx(ColorPreview, {
106
+ color: color
107
+ }),
108
+ /*#__PURE__*/ jsx(Typography, {
109
+ style: {
110
+ textTransform: 'uppercase'
111
+ },
112
+ textColor: field.value ? undefined : 'neutral600',
113
+ variant: "omega",
114
+ children: color
115
+ })
116
+ ]
117
+ }),
118
+ /*#__PURE__*/ jsx(CaretDown, {
119
+ "aria-hidden": true
120
+ })
121
+ ]
122
+ })
123
+ }),
124
+ /*#__PURE__*/ jsxs(ColorPickerPopover, {
125
+ sideOffset: 4,
126
+ children: [
127
+ /*#__PURE__*/ jsx(ColorPicker, {
128
+ color: color,
129
+ onChange: (hexValue)=>field.onChange(name, hexValue)
130
+ }),
131
+ /*#__PURE__*/ jsxs(Flex, {
132
+ paddingTop: 3,
133
+ paddingLeft: 4,
134
+ justifyContent: "flex-end",
135
+ children: [
136
+ /*#__PURE__*/ jsx(Box, {
137
+ paddingRight: 2,
138
+ children: /*#__PURE__*/ jsx(Typography, {
139
+ variant: "omega",
140
+ tag: "label",
141
+ textColor: "neutral600",
142
+ children: formatMessage({
143
+ id: getTrad('color-picker.input.format'),
144
+ defaultMessage: 'HEX'
145
+ })
146
+ })
147
+ }),
148
+ /*#__PURE__*/ jsx(Field.Root, {
149
+ children: /*#__PURE__*/ jsx(Field.Input, {
150
+ "aria-label": formatMessage({
151
+ id: getTrad('color-picker.input.aria-label'),
152
+ defaultMessage: 'Color picker input'
153
+ }),
154
+ style: {
155
+ textTransform: 'uppercase'
156
+ },
157
+ name: name,
158
+ defaultValue: color,
159
+ placeholder: "#000000",
160
+ onChange: field.onChange,
161
+ ...props
162
+ })
163
+ })
164
+ ]
165
+ })
166
+ ]
167
+ })
168
+ ]
169
+ }),
170
+ /*#__PURE__*/ jsx(Field.Hint, {}),
171
+ /*#__PURE__*/ jsx(Field.Error, {})
172
+ ]
173
+ })
174
+ });
175
+ });
176
+
177
+ export { ColorPickerInput };
178
+ //# sourceMappingURL=ColorPickerInput-BO3lsUmM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColorPickerInput-BO3lsUmM.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 { type InputProps, useField } 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 labelAction?: React.ReactNode;\n};\n\nexport const ColorPickerInput = React.forwardRef<HTMLButtonElement, ColorPickerInputProps>(\n ({ hint, disabled, labelAction, label, name, required, ...props }, forwardedRef) => {\n const [showColorPicker, setShowColorPicker] = React.useState(false);\n const colorPickerButtonRef = React.useRef<HTMLButtonElement>(null!);\n const { formatMessage } = useIntl();\n const field = useField(name);\n const color = field.value ?? '#000000';\n\n const composedRefs = useComposedRefs(forwardedRef, colorPickerButtonRef);\n\n return (\n <Field.Root name={name} id={name} error={field.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={field.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) => field.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 name={name}\n defaultValue={color}\n placeholder=\"#000000\"\n onChange={field.onChange}\n {...props}\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":["ColorPreview","styled","div","props","color","ColorPicker","HexColorPicker","theme","spaces","ColorPickerToggle","Button","colors","neutral500","ColorPickerPopover","Popover","Content","ColorPickerInput","React","forwardRef","hint","disabled","labelAction","label","name","required","forwardedRef","showColorPicker","setShowColorPicker","useState","colorPickerButtonRef","useRef","formatMessage","useIntl","field","useField","value","composedRefs","useComposedRefs","_jsx","Field","Root","id","error","_jsxs","Flex","direction","alignItems","gap","Label","action","onOpenChange","Trigger","ref","aria-label","getTrad","defaultMessage","aria-controls","aria-haspopup","aria-expanded","aria-disabled","variant","size","Typography","style","textTransform","textColor","undefined","CaretDown","aria-hidden","sideOffset","onChange","hexValue","paddingTop","paddingLeft","justifyContent","Box","paddingRight","tag","Input","defaultValue","placeholder","Hint","Error"],"mappings":";;;;;;;;;;AAmBA,MAAMA,YAAAA,GAAeC,MAAOC,CAAAA,GAAG;;;;;AAKX,oBAAA,EAAE,CAACC,KAAAA,GAAUA,KAAMC,CAAAA,KAAK,CAAC;;AAE7C,CAAC;AAED,MAAMC,WAAAA,GAAcJ,MAAOK,CAAAA,cAAAA,CAAe;;;;;;;WAO/B,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;YAChC,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;;;;mBAI1B,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;;;;;;YAMxC,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;gBAC7B,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;;AAEjD,CAAC;AAED,MAAMC,iBAAAA,GAAoBR,MAAOS,CAAAA,MAAAA,CAAO;;;;;;;;;WAS7B,EAAE,CAAC,EAAEH,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;YAChC,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;;;;UAInC,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMI,CAAAA,MAAM,CAACC,UAAU,CAAC;;;AAGnD,CAAC;AAED,MAAMC,kBAAqBZ,GAAAA,MAAAA,CAAOa,OAAQC,CAAAA,OAA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,UAAA;;sDAClDpC,GAACqC,CAAAA,GAAAA,EAAAA;4CAAIC,YAAc,EAAA,CAAA;AACjB,4CAAA,QAAA,gBAAAtC,GAACwB,CAAAA,UAAAA,EAAAA;gDAAWF,OAAQ,EAAA,OAAA;gDAAQiB,GAAI,EAAA,OAAA;gDAAQZ,SAAU,EAAA,YAAA;0DAC/ClC,aAAc,CAAA;AACbU,oDAAAA,EAAAA,EAAIa,OAAQ,CAAA,2BAAA,CAAA;oDACZC,cAAgB,EAAA;AAClB,iDAAA;;;AAGJ,sDAAAjB,GAAA,CAACC,MAAMC,IAAI,EAAA;oEACTF,GAAA,CAACC,MAAMuC,KAAK,EAAA;AACVzB,gDAAAA,YAAAA,EAAYtB,aAAc,CAAA;AACxBU,oDAAAA,EAAAA,EAAIa,OAAQ,CAAA,+BAAA,CAAA;oDACZC,cAAgB,EAAA;AAClB,iDAAA,CAAA;gDACAQ,KAAO,EAAA;oDAAEC,aAAe,EAAA;AAAY,iDAAA;gDACpCzC,IAAMA,EAAAA,IAAAA;gDACNwD,YAAc3E,EAAAA,KAAAA;gDACd4E,WAAY,EAAA,SAAA;AACZV,gDAAAA,QAAAA,EAAUrC,MAAMqC,QAAQ;AACvB,gDAAA,GAAGnE;;;;;;;;;AAMd,8BAAAmC,GAAA,CAACC,MAAM0C,IAAI,EAAA,EAAA,CAAA;AACX,8BAAA3C,GAAA,CAACC,MAAM2C,KAAK,EAAA,EAAA;;;;AAIpB,CACA;;;;"}
@@ -0,0 +1,199 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var React = require('react');
5
+ var designSystem = require('@strapi/design-system');
6
+ var icons = require('@strapi/icons');
7
+ var admin = require('@strapi/strapi/admin');
8
+ var reactColorful = require('react-colorful');
9
+ var reactIntl = require('react-intl');
10
+ var styledComponents = require('styled-components');
11
+ var index = require('./index-jpCMMLS-.js');
12
+
13
+ function _interopNamespaceDefault(e) {
14
+ var n = Object.create(null);
15
+ if (e) {
16
+ Object.keys(e).forEach(function (k) {
17
+ if (k !== 'default') {
18
+ var d = Object.getOwnPropertyDescriptor(e, k);
19
+ Object.defineProperty(n, k, d.get ? d : {
20
+ enumerable: true,
21
+ get: function () { return e[k]; }
22
+ });
23
+ }
24
+ });
25
+ }
26
+ n.default = e;
27
+ return Object.freeze(n);
28
+ }
29
+
30
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
31
+
32
+ const ColorPreview = styledComponents.styled.div`
33
+ border-radius: 50%;
34
+ width: 20px;
35
+ height: 20px;
36
+ margin-right: 10px;
37
+ background-color: ${(props)=>props.color};
38
+ border: 1px solid rgba(0, 0, 0, 0.1);
39
+ `;
40
+ const ColorPicker = styledComponents.styled(reactColorful.HexColorPicker)`
41
+ && {
42
+ width: 100%;
43
+ aspect-ratio: 1.5;
44
+ }
45
+
46
+ .react-colorful__pointer {
47
+ width: ${({ theme })=>theme.spaces[3]};
48
+ height: ${({ theme })=>theme.spaces[3]};
49
+ }
50
+
51
+ .react-colorful__saturation {
52
+ border-radius: ${({ theme })=>theme.spaces[1]};
53
+ border-bottom: none;
54
+ }
55
+
56
+ .react-colorful__hue {
57
+ border-radius: 10px;
58
+ height: ${({ theme })=>theme.spaces[3]};
59
+ margin-top: ${({ theme })=>theme.spaces[2]};
60
+ }
61
+ `;
62
+ const ColorPickerToggle = styledComponents.styled(designSystem.Button)`
63
+ & > span {
64
+ display: flex;
65
+ justify-content: space-between;
66
+ align-items: center;
67
+ width: 100%;
68
+ }
69
+
70
+ svg {
71
+ width: ${({ theme })=>theme.spaces[2]};
72
+ height: ${({ theme })=>theme.spaces[2]};
73
+ }
74
+
75
+ svg > path {
76
+ fill: ${({ theme })=>theme.colors.neutral500};
77
+ justify-self: flex-end;
78
+ }
79
+ `;
80
+ const ColorPickerPopover = styledComponents.styled(designSystem.Popover.Content)`
81
+ padding: ${({ theme })=>theme.spaces[2]};
82
+ min-height: 270px;
83
+ `;
84
+ const ColorPickerInput = /*#__PURE__*/ React__namespace.forwardRef(({ hint, disabled, labelAction, label, name, required, ...props }, forwardedRef)=>{
85
+ const [showColorPicker, setShowColorPicker] = React__namespace.useState(false);
86
+ const colorPickerButtonRef = React__namespace.useRef(null);
87
+ const { formatMessage } = reactIntl.useIntl();
88
+ const field = admin.useField(name);
89
+ const color = field.value ?? '#000000';
90
+ const composedRefs = designSystem.useComposedRefs(forwardedRef, colorPickerButtonRef);
91
+ return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Field.Root, {
92
+ name: name,
93
+ id: name,
94
+ error: field.error,
95
+ hint: hint,
96
+ required: required,
97
+ children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
98
+ direction: "column",
99
+ alignItems: "stretch",
100
+ gap: 1,
101
+ children: [
102
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Field.Label, {
103
+ action: labelAction,
104
+ children: label
105
+ }),
106
+ /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Popover.Root, {
107
+ onOpenChange: setShowColorPicker,
108
+ children: [
109
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Popover.Trigger, {
110
+ children: /*#__PURE__*/ jsxRuntime.jsxs(ColorPickerToggle, {
111
+ ref: composedRefs,
112
+ "aria-label": formatMessage({
113
+ id: index.getTrad('color-picker.toggle.aria-label'),
114
+ defaultMessage: 'Color picker toggle'
115
+ }),
116
+ "aria-controls": "color-picker-value",
117
+ "aria-haspopup": "dialog",
118
+ "aria-expanded": showColorPicker,
119
+ "aria-disabled": disabled,
120
+ disabled: disabled,
121
+ variant: "tertiary",
122
+ size: "L",
123
+ children: [
124
+ /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
125
+ children: [
126
+ /*#__PURE__*/ jsxRuntime.jsx(ColorPreview, {
127
+ color: color
128
+ }),
129
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
130
+ style: {
131
+ textTransform: 'uppercase'
132
+ },
133
+ textColor: field.value ? undefined : 'neutral600',
134
+ variant: "omega",
135
+ children: color
136
+ })
137
+ ]
138
+ }),
139
+ /*#__PURE__*/ jsxRuntime.jsx(icons.CaretDown, {
140
+ "aria-hidden": true
141
+ })
142
+ ]
143
+ })
144
+ }),
145
+ /*#__PURE__*/ jsxRuntime.jsxs(ColorPickerPopover, {
146
+ sideOffset: 4,
147
+ children: [
148
+ /*#__PURE__*/ jsxRuntime.jsx(ColorPicker, {
149
+ color: color,
150
+ onChange: (hexValue)=>field.onChange(name, hexValue)
151
+ }),
152
+ /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
153
+ paddingTop: 3,
154
+ paddingLeft: 4,
155
+ justifyContent: "flex-end",
156
+ children: [
157
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
158
+ paddingRight: 2,
159
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
160
+ variant: "omega",
161
+ tag: "label",
162
+ textColor: "neutral600",
163
+ children: formatMessage({
164
+ id: index.getTrad('color-picker.input.format'),
165
+ defaultMessage: 'HEX'
166
+ })
167
+ })
168
+ }),
169
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Field.Root, {
170
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Field.Input, {
171
+ "aria-label": formatMessage({
172
+ id: index.getTrad('color-picker.input.aria-label'),
173
+ defaultMessage: 'Color picker input'
174
+ }),
175
+ style: {
176
+ textTransform: 'uppercase'
177
+ },
178
+ name: name,
179
+ defaultValue: color,
180
+ placeholder: "#000000",
181
+ onChange: field.onChange,
182
+ ...props
183
+ })
184
+ })
185
+ ]
186
+ })
187
+ ]
188
+ })
189
+ ]
190
+ }),
191
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Field.Hint, {}),
192
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Field.Error, {})
193
+ ]
194
+ })
195
+ });
196
+ });
197
+
198
+ exports.ColorPickerInput = ColorPickerInput;
199
+ //# sourceMappingURL=ColorPickerInput-CR8yH0F7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColorPickerInput-CR8yH0F7.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 { type InputProps, useField } 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 labelAction?: React.ReactNode;\n};\n\nexport const ColorPickerInput = React.forwardRef<HTMLButtonElement, ColorPickerInputProps>(\n ({ hint, disabled, labelAction, label, name, required, ...props }, forwardedRef) => {\n const [showColorPicker, setShowColorPicker] = React.useState(false);\n const colorPickerButtonRef = React.useRef<HTMLButtonElement>(null!);\n const { formatMessage } = useIntl();\n const field = useField(name);\n const color = field.value ?? '#000000';\n\n const composedRefs = useComposedRefs(forwardedRef, colorPickerButtonRef);\n\n return (\n <Field.Root name={name} id={name} error={field.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={field.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) => field.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 name={name}\n defaultValue={color}\n placeholder=\"#000000\"\n onChange={field.onChange}\n {...props}\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":["ColorPreview","styled","div","props","color","ColorPicker","HexColorPicker","theme","spaces","ColorPickerToggle","Button","colors","neutral500","ColorPickerPopover","Popover","Content","ColorPickerInput","React","forwardRef","hint","disabled","labelAction","label","name","required","forwardedRef","showColorPicker","setShowColorPicker","useState","colorPickerButtonRef","useRef","formatMessage","useIntl","field","useField","value","composedRefs","useComposedRefs","_jsx","Field","Root","id","error","_jsxs","Flex","direction","alignItems","gap","Label","action","onOpenChange","Trigger","ref","aria-label","getTrad","defaultMessage","aria-controls","aria-haspopup","aria-expanded","aria-disabled","variant","size","Typography","style","textTransform","textColor","undefined","CaretDown","aria-hidden","sideOffset","onChange","hexValue","paddingTop","paddingLeft","justifyContent","Box","paddingRight","tag","Input","defaultValue","placeholder","Hint","Error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAMA,YAAAA,GAAeC,uBAAOC,CAAAA,GAAG;;;;;AAKX,oBAAA,EAAE,CAACC,KAAAA,GAAUA,KAAMC,CAAAA,KAAK,CAAC;;AAE7C,CAAC;AAED,MAAMC,WAAAA,GAAcJ,uBAAOK,CAAAA,4BAAAA,CAAe;;;;;;;WAO/B,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;YAChC,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;;;;mBAI1B,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;;;;;;YAMxC,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;gBAC7B,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;;AAEjD,CAAC;AAED,MAAMC,iBAAAA,GAAoBR,uBAAOS,CAAAA,mBAAAA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cAAA,CAACC,mBAAM2C,KAAK,EAAA,EAAA;;;;AAIpB,CACA;;;;"}
@@ -0,0 +1,15 @@
1
+ var 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
+
14
+ export { cs as default };
15
+ //# sourceMappingURL=cs-BI5icLZ-.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cs-BI5icLZ-.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ var 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
+
16
+ exports.default = cs;
17
+ //# sourceMappingURL=cs-DABbHfFT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cs-DABbHfFT.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ var 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
+
19
+ exports.default = en;
20
+ //# sourceMappingURL=en-DhCwQ39J.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"en-DhCwQ39J.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,18 @@
1
+ var 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
+
17
+ export { en as default };
18
+ //# sourceMappingURL=en-uI0wnpc1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"en-uI0wnpc1.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,136 @@
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
+
6
+ const IconBox = styled(Flex)`
7
+ /* Hard code color values */
8
+ /* to stay consistent between themes */
9
+ background-color: #f0f0ff; /* primary100 */
10
+ border: 1px solid #d9d8ff; /* primary200 */
11
+
12
+ svg > path {
13
+ fill: #4945ff; /* primary600 */
14
+ }
15
+ `;
16
+ const ColorPickerIcon = ()=>{
17
+ return /*#__PURE__*/ jsx(IconBox, {
18
+ justifyContent: "center",
19
+ alignItems: "center",
20
+ width: 7,
21
+ height: 6,
22
+ hasRadius: true,
23
+ "aria-hidden": true,
24
+ children: /*#__PURE__*/ jsx(PaintBrush, {})
25
+ });
26
+ };
27
+
28
+ const pluginId = 'color-picker';
29
+
30
+ const getTrad = (id)=>`${pluginId}.${id}`;
31
+
32
+ const prefixPluginTranslations = (trad, pluginId)=>{
33
+ return Object.keys(trad).reduce((acc, current)=>{
34
+ acc[`${pluginId}.${current}`] = trad[current];
35
+ return acc;
36
+ }, {});
37
+ };
38
+
39
+ function __variableDynamicImportRuntime1__(path) {
40
+ switch (path) {
41
+ case './translations/cs.json': return import('./cs-BI5icLZ-.js');
42
+ case './translations/en.json': return import('./en-uI0wnpc1.js');
43
+ case './translations/ru.json': return import('./ru-DQvhmgfv.js');
44
+ case './translations/sv.json': return import('./sv-soBCY9Rd.js');
45
+ case './translations/tr.json': return import('./tr-pt6M-dRX.js');
46
+ case './translations/zh.json': return import('./zh-DQMeqBK7.js');
47
+ default: return new Promise(function(resolve, reject) {
48
+ (typeof queueMicrotask === 'function' ? queueMicrotask : setTimeout)(
49
+ reject.bind(null, new Error("Unknown variable dynamic import: " + path))
50
+ );
51
+ })
52
+ }
53
+ }
54
+ // eslint-disable-next-line import/no-default-export
55
+ var index = {
56
+ /**
57
+ * TODO: we need to have the type for StrapiApp done from `@strapi/admin` package.
58
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
59
+ register (app) {
60
+ app.customFields.register({
61
+ name: 'color',
62
+ pluginId: 'color-picker',
63
+ type: 'string',
64
+ icon: ColorPickerIcon,
65
+ intlLabel: {
66
+ id: getTrad('color-picker.label'),
67
+ defaultMessage: 'Color'
68
+ },
69
+ intlDescription: {
70
+ id: getTrad('color-picker.description'),
71
+ defaultMessage: 'Select any color'
72
+ },
73
+ components: {
74
+ Input: async ()=>import('./ColorPickerInput-BO3lsUmM.js').then((module)=>({
75
+ default: module.ColorPickerInput
76
+ }))
77
+ },
78
+ options: {
79
+ advanced: [
80
+ {
81
+ intlLabel: {
82
+ id: getTrad('color-picker.options.advanced.regex'),
83
+ defaultMessage: 'RegExp pattern'
84
+ },
85
+ name: 'regex',
86
+ type: 'text',
87
+ defaultValue: '^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$',
88
+ description: {
89
+ id: getTrad('color-picker.options.advanced.regex.description'),
90
+ defaultMessage: 'The text of the regular expression'
91
+ }
92
+ },
93
+ {
94
+ sectionTitle: {
95
+ id: 'global.settings',
96
+ defaultMessage: 'Settings'
97
+ },
98
+ items: [
99
+ {
100
+ name: 'required',
101
+ type: 'checkbox',
102
+ intlLabel: {
103
+ id: getTrad('color-picker.options.advanced.requiredField'),
104
+ defaultMessage: 'Required field'
105
+ },
106
+ description: {
107
+ id: getTrad('color-picker.options.advanced.requiredField.description'),
108
+ defaultMessage: "You won't be able to create an entry if this field is empty"
109
+ }
110
+ }
111
+ ]
112
+ }
113
+ ]
114
+ }
115
+ });
116
+ },
117
+ async registerTrads ({ locales }) {
118
+ const importedTrads = await Promise.all(locales.map((locale)=>{
119
+ return __variableDynamicImportRuntime1__(`./translations/${locale}.json`).then(({ default: data })=>{
120
+ return {
121
+ data: prefixPluginTranslations(data, pluginId),
122
+ locale
123
+ };
124
+ }).catch(()=>{
125
+ return {
126
+ data: {},
127
+ locale
128
+ };
129
+ });
130
+ }));
131
+ return Promise.resolve(importedTrads);
132
+ }
133
+ };
134
+
135
+ export { getTrad as g, index as i };
136
+ //# sourceMappingURL=index-EI7HMw_Q.js.map