@strapi/plugin-color-picker 0.0.0-next.f45143c5e2a8a9d85691d0abf79a3f42024a0c71 → 0.0.0-next.f5b09a8e61e059f02784478e27c310c6290be088
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +12 -19
- package/dist/_chunks/ColorPickerInput-0d985ad5.mjs +277 -0
- package/dist/_chunks/ColorPickerInput-0d985ad5.mjs.map +1 -0
- package/dist/_chunks/ColorPickerInput-8875b370.js +298 -0
- package/dist/_chunks/ColorPickerInput-8875b370.js.map +1 -0
- package/{admin/src/translations/cs.json → dist/_chunks/cs-32e5b75a.mjs} +6 -2
- package/dist/_chunks/cs-32e5b75a.mjs.map +1 -0
- package/dist/_chunks/cs-c22467c6.js +16 -0
- package/dist/_chunks/cs-c22467c6.js.map +1 -0
- package/{admin/src/translations/en.json → dist/_chunks/en-2230584b.mjs} +6 -2
- package/dist/_chunks/en-2230584b.mjs.map +1 -0
- package/dist/_chunks/en-eb6717ab.js +19 -0
- package/dist/_chunks/en-eb6717ab.js.map +1 -0
- package/dist/_chunks/index-214132a2.mjs +124 -0
- package/dist/_chunks/index-214132a2.mjs.map +1 -0
- package/dist/_chunks/index-9695efa4.js +125 -0
- package/dist/_chunks/index-9695efa4.js.map +1 -0
- package/{admin/src/translations/ru.json → dist/_chunks/ru-0bf57448.mjs} +6 -2
- package/dist/_chunks/ru-0bf57448.mjs.map +1 -0
- package/dist/_chunks/ru-1d1cf8a8.js +19 -0
- package/dist/_chunks/ru-1d1cf8a8.js.map +1 -0
- package/dist/_chunks/sv-6e7fa200.js +16 -0
- package/dist/_chunks/sv-6e7fa200.js.map +1 -0
- package/{admin/src/translations/sv.json → dist/_chunks/sv-de6a785a.mjs} +6 -2
- package/dist/_chunks/sv-de6a785a.mjs.map +1 -0
- package/{admin/src/translations/tr.json → dist/_chunks/tr-4d632eac.mjs} +6 -2
- package/dist/_chunks/tr-4d632eac.mjs.map +1 -0
- package/dist/_chunks/tr-67b6e192.js +16 -0
- package/dist/_chunks/tr-67b6e192.js.map +1 -0
- package/{admin/src/translations/zh.json → dist/_chunks/zh-5ba3e025.mjs} +6 -2
- package/dist/_chunks/zh-5ba3e025.mjs.map +1 -0
- package/dist/_chunks/zh-e5010f8b.js +16 -0
- package/dist/_chunks/zh-e5010f8b.js.map +1 -0
- package/dist/admin/components/ColorPickerIcon.d.ts +1 -0
- package/dist/admin/components/ColorPickerInput.d.ts +32 -0
- package/dist/admin/hooks/useComposeRefs.d.ts +29 -0
- package/dist/admin/index.d.ts +18 -0
- package/dist/admin/index.js +9 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/admin/index.mjs +10 -0
- package/dist/admin/index.mjs.map +1 -0
- package/dist/admin/pluginId.d.ts +1 -0
- package/dist/admin/utils/getTrad.d.ts +1 -0
- package/dist/server/index.d.ts +5 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +13 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/index.mjs +14 -0
- package/dist/server/index.mjs.map +1 -0
- package/dist/server/register.d.ts +2 -0
- package/dist/server/register.d.ts.map +1 -0
- package/package.json +68 -38
- package/strapi-server.js +1 -1
- package/.eslintignore +0 -2
- package/.eslintrc.js +0 -14
- package/admin/src/components/ColorPicker/ColorPickerIcon/index.js +0 -25
- package/admin/src/components/ColorPicker/ColorPickerInput/index.js +0 -205
- package/admin/src/components/tests/__snapshots__/color-picker-input.test.js.snap +0 -238
- package/admin/src/components/tests/color-picker-input.test.js +0 -63
- package/admin/src/index.js +0 -87
- package/admin/src/pluginId.js +0 -5
- package/admin/src/utils/getTrad.js +0 -5
- package/color-picker.png +0 -0
- package/jest.config.front.js +0 -5
- package/server/index.js +0 -7
- package/server/register.js +0 -9
- package/strapi-admin.js +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorPickerInput-8875b370.js","sources":["../../admin/src/hooks/useComposeRefs.ts","../../admin/src/components/ColorPickerInput.tsx"],"sourcesContent":["import * as React from 'react';\n\ntype PossibleRef<T> = React.Ref<T> | undefined;\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef<T>(ref: PossibleRef<T>, value: T) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref !== null && ref !== undefined) {\n (ref as React.MutableRefObject<T>).current = value;\n }\n}\n\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs<T>(...refs: PossibleRef<T>[]) {\n return (node: T) => refs.forEach((ref) => setRef(ref, node));\n}\n\n/**\n * Takes multiple React like refs either React.Ref or a callback:\n * (node: T) => void and returns a single function that can be\n * passed to a React component as a ref.\n *\n * Example:\n * ```tsx\n * import { useComposedRefs } from '../hooks/useComposedRefs';\n *\n * const Component = React.forwardRef<HTMLInputElement, ComponentProps>((props, forwardedRef) => {\n * const ref = useComposedRefs(internalRef, forwardedRef);\n *\n * React.useEffect(() => {\n * ref.current.focus();\n * }, [ref]);\n *\n * return <input ref={ref} />\n * }\n * ```\n */\nfunction useComposedRefs<T>(...refs: PossibleRef<T>[]) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs);\n}\n\nexport { composeRefs, useComposedRefs };\n","import * as React from 'react';\n\nimport {\n BaseButton,\n Box,\n Field,\n FieldError,\n FieldHint,\n FieldInput,\n FieldLabel,\n Flex,\n FocusTrap,\n Popover,\n Typography,\n} from '@strapi/design-system';\nimport { CarretDown } from '@strapi/icons';\nimport { HexColorPicker } from 'react-colorful';\nimport { useIntl, MessageDescriptor } from 'react-intl';\nimport styled from 'styled-components';\n\nimport { useComposedRefs } from '../hooks/useComposeRefs';\nimport { getTrad } from '../utils/getTrad';\n\nconst ColorPreview = styled.div`\n border-radius: 50%;\n width: 20px;\n height: 20px;\n margin-right: 10px;\n background-color: ${(props) => props.color};\n border: 1px solid rgba(0, 0, 0, 0.1);\n`;\n\nconst ColorPicker = styled(HexColorPicker)`\n && {\n width: 100%;\n aspect-ratio: 1.5;\n }\n\n .react-colorful__pointer {\n width: ${({ theme }) => theme.spaces[3]};\n height: ${({ theme }) => theme.spaces[3]};\n }\n\n .react-colorful__saturation {\n border-radius: ${({ theme }) => theme.spaces[1]};\n border-bottom: none;\n }\n\n .react-colorful__hue {\n border-radius: 10px;\n height: ${({ theme }) => theme.spaces[3]};\n margin-top: ${({ theme }) => theme.spaces[2]};\n }\n`;\n\nconst ColorPickerToggle = styled(BaseButton)`\n display: flex;\n justify-content: space-between;\n align-items: center;\n\n svg {\n width: ${({ theme }) => theme.spaces[2]};\n height: ${({ theme }) => theme.spaces[2]};\n }\n\n svg > path {\n fill: ${({ theme }) => theme.colors.neutral500};\n justify-self: flex-end;\n }\n`;\n\nconst ColorPickerPopover = styled(Popover)`\n padding: ${({ theme }) => theme.spaces[2]};\n min-height: 270px;\n`;\n\n/**\n * TODO: A lot of these props should extend `FieldProps`\n */\ninterface ColorPickerInputProps {\n intlLabel: MessageDescriptor;\n /**\n * TODO: this should be extended from `FieldInputProps['onChange']\n * but that conflicts with it's secondary usage in `HexColorPicker`\n */\n onChange: (event: { target: { name: string; value: string; type: string } }) => void;\n attribute: { type: string; [key: string]: unknown };\n name: string;\n description?: MessageDescriptor;\n disabled?: boolean;\n error?: string;\n labelAction?: React.ReactNode;\n required?: boolean;\n value?: string;\n}\n\nexport const ColorPickerInput = React.forwardRef<HTMLButtonElement, ColorPickerInputProps>(\n (\n {\n attribute,\n description,\n disabled = false,\n error,\n intlLabel,\n labelAction,\n name,\n onChange,\n required = false,\n value = '',\n },\n forwardedRef\n ) => {\n const [showColorPicker, setShowColorPicker] = React.useState(false);\n const colorPickerButtonRef = React.useRef<HTMLButtonElement>(null!);\n const { formatMessage } = useIntl();\n const color = value || '#000000';\n\n const handleBlur: React.FocusEventHandler<HTMLDivElement> = (e) => {\n e.preventDefault();\n\n if (!e.currentTarget.contains(e.relatedTarget)) {\n setShowColorPicker(false);\n }\n };\n\n const composedRefs = useComposedRefs(forwardedRef, colorPickerButtonRef);\n\n return (\n <Field\n name={name}\n id={name}\n // GenericInput calls formatMessage and returns a string for the error\n error={error}\n hint={description && formatMessage(description)}\n required={required}\n >\n <Flex direction=\"column\" alignItems=\"stretch\" gap={1}>\n <FieldLabel action={labelAction}>{formatMessage(intlLabel)}</FieldLabel>\n <ColorPickerToggle\n ref={composedRefs}\n aria-label={formatMessage({\n id: getTrad('color-picker.toggle.aria-label'),\n defaultMessage: 'Color picker toggle',\n })}\n aria-controls=\"color-picker-value\"\n aria-haspopup=\"dialog\"\n aria-expanded={showColorPicker}\n aria-disabled={disabled}\n disabled={disabled}\n onClick={() => setShowColorPicker(!showColorPicker)}\n >\n <Flex>\n <ColorPreview color={color} />\n <Typography\n style={{ textTransform: 'uppercase' }}\n textColor={value ? undefined : 'neutral600'}\n variant=\"omega\"\n >\n {color}\n </Typography>\n </Flex>\n <CarretDown aria-hidden />\n </ColorPickerToggle>\n {showColorPicker && (\n <ColorPickerPopover\n onBlur={handleBlur}\n role=\"dialog\"\n source={colorPickerButtonRef}\n spacing={4}\n >\n <FocusTrap onEscape={() => setShowColorPicker(false)}>\n <ColorPicker\n color={color}\n onChange={(hexValue) =>\n onChange({ target: { name, value: hexValue, type: attribute.type } })\n }\n />\n <Flex paddingTop={3} paddingLeft={4} justifyContent=\"flex-end\">\n <Box paddingRight={2}>\n <Typography variant=\"omega\" as=\"label\" textColor=\"neutral600\">\n {formatMessage({\n id: getTrad('color-picker.input.format'),\n defaultMessage: 'HEX',\n })}\n </Typography>\n </Box>\n <FieldInput\n id=\"color-picker-value\"\n aria-label={formatMessage({\n id: getTrad('color-picker.input.aria-label'),\n defaultMessage: 'Color picker input',\n })}\n style={{ textTransform: 'uppercase' }}\n value={value}\n placeholder=\"#000000\"\n onChange={onChange}\n />\n </Flex>\n </FocusTrap>\n </ColorPickerPopover>\n )}\n <FieldHint />\n <FieldError />\n </Flex>\n </Field>\n );\n }\n);\n"],"names":["React","styled","HexColorPicker","BaseButton","Popover","useIntl","jsxDEV","Field","Flex","FieldLabel","this","getTrad","Typography","CarretDown","FocusTrap","Box","FieldInput","FieldHint","FieldError"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,SAAS,OAAU,KAAqB,OAAU;AAC5C,MAAA,OAAO,QAAQ,YAAY;AAC7B,QAAI,KAAK;AAAA,EACA,WAAA,QAAQ,QAAQ,QAAQ,QAAW;AAC3C,QAAkC,UAAU;AAAA,EAC/C;AACF;AAMA,SAAS,eAAkB,MAAwB;AAC1C,SAAA,CAAC,SAAY,KAAK,QAAQ,CAAC,QAAQ,OAAO,KAAK,IAAI,CAAC;AAC7D;AAsBA,SAAS,mBAAsB,MAAwB;AAErD,SAAOA,iBAAM,YAAY,YAAY,GAAG,IAAI,GAAG,IAAI;AACrD;ACxBA,MAAM,eAAeC,gBAAO,QAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAKN,CAAC,UAAU,MAAM,KAAK;AAAA;AAAA;AAI5C,MAAM,cAAcA,gBAAAA,QAAOC,cAAAA,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAO5B,CAAC,EAAE,YAAY,MAAM,OAAO,CAAC,CAAC;AAAA,cAC7B,CAAC,EAAE,YAAY,MAAM,OAAO,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA,qBAIvB,CAAC,EAAE,YAAY,MAAM,OAAO,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAMrC,CAAC,EAAE,YAAY,MAAM,OAAO,CAAC,CAAC;AAAA,kBAC1B,CAAC,EAAE,YAAY,MAAM,OAAO,CAAC,CAAC;AAAA;AAAA;AAIhD,MAAM,oBAAoBD,gBAAAA,QAAOE,aAAAA,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAM9B,CAAC,EAAE,YAAY,MAAM,OAAO,CAAC,CAAC;AAAA,cAC7B,CAAC,EAAE,YAAY,MAAM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
|
"color-picker.input.format": "HEX",
|
|
@@ -9,4 +9,8 @@
|
|
|
9
9
|
"color-picker.options.advanced.requiredField.description": "Pokud je toto pole prázdné, nebudete moci vytvořit záznam",
|
|
10
10
|
"color-picker.settings": "Nastavení",
|
|
11
11
|
"color-picker.toggle.aria-label": "Přepínač výběru barvy"
|
|
12
|
-
}
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
cs as default
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=cs-32e5b75a.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cs-32e5b75a.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const cs = {
|
|
4
|
+
"color-picker.description": "Vyberte libovolnou barvu",
|
|
5
|
+
"color-picker.input.aria-label": "Vstup pro výběr barvy",
|
|
6
|
+
"color-picker.input.format": "HEX",
|
|
7
|
+
"color-picker.label": "Barva",
|
|
8
|
+
"color-picker.options.advanced.regex": "RegExp vzor",
|
|
9
|
+
"color-picker.options.advanced.regex.description": "Zadejte regulární výraz pro ověření hodnoty HEX",
|
|
10
|
+
"color-picker.options.advanced.requiredField": "Povinné pole",
|
|
11
|
+
"color-picker.options.advanced.requiredField.description": "Pokud je toto pole prázdné, nebudete moci vytvořit záznam",
|
|
12
|
+
"color-picker.settings": "Nastavení",
|
|
13
|
+
"color-picker.toggle.aria-label": "Přepínač výběru barvy"
|
|
14
|
+
};
|
|
15
|
+
exports.default = cs;
|
|
16
|
+
//# sourceMappingURL=cs-c22467c6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cs-c22467c6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{
|
|
1
|
+
const en = {
|
|
2
2
|
"color-picker.description": "Select any color",
|
|
3
3
|
"color-picker.input.aria-label": "Color picker input",
|
|
4
4
|
"color-picker.input.format": "HEX",
|
|
@@ -12,4 +12,8 @@
|
|
|
12
12
|
"plugin.description.long": "A Strapi-maintained color picker custom field. Use saturation and hue sliders to select a color and save the value as a HEX string.",
|
|
13
13
|
"plugin.description.short": "A Strapi-maintained color picker custom field.",
|
|
14
14
|
"plugin.name": "Color picker"
|
|
15
|
-
}
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
en as default
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=en-2230584b.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"en-2230584b.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const en = {
|
|
4
|
+
"color-picker.description": "Select any color",
|
|
5
|
+
"color-picker.input.aria-label": "Color picker input",
|
|
6
|
+
"color-picker.input.format": "HEX",
|
|
7
|
+
"color-picker.label": "Color",
|
|
8
|
+
"color-picker.options.advanced.regex": "RegExp pattern",
|
|
9
|
+
"color-picker.options.advanced.regex.description": "Provide a regular expression to validate the HEX value",
|
|
10
|
+
"color-picker.options.advanced.requiredField": "Required field",
|
|
11
|
+
"color-picker.options.advanced.requiredField.description": "You won't be able to create an entry if this field is empty",
|
|
12
|
+
"color-picker.settings": "Settings",
|
|
13
|
+
"color-picker.toggle.aria-label": "Color picker toggle",
|
|
14
|
+
"plugin.description.long": "A Strapi-maintained color picker custom field. Use saturation and hue sliders to select a color and save the value as a HEX string.",
|
|
15
|
+
"plugin.description.short": "A Strapi-maintained color picker custom field.",
|
|
16
|
+
"plugin.name": "Color picker"
|
|
17
|
+
};
|
|
18
|
+
exports.default = en;
|
|
19
|
+
//# sourceMappingURL=en-eb6717ab.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"en-eb6717ab.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { prefixPluginTranslations } from "@strapi/helper-plugin";
|
|
2
|
+
import { jsxDEV } from "react/jsx-dev-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) => {
|
|
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)(reject.bind(null, new Error("Unknown variable dynamic import: " + path)));
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
const IconBox = styled(Flex)`
|
|
16
|
+
/* Hard code color values */
|
|
17
|
+
/* to stay consistent between themes */
|
|
18
|
+
background-color: #f0f0ff; /* primary100 */
|
|
19
|
+
border: 1px solid #d9d8ff; /* primary200 */
|
|
20
|
+
|
|
21
|
+
svg > path {
|
|
22
|
+
fill: #4945ff; /* primary600 */
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
const ColorPickerIcon = () => {
|
|
26
|
+
return /* @__PURE__ */ jsxDEV(IconBox, { justifyContent: "center", alignItems: "center", width: 7, height: 6, hasRadius: true, "aria-hidden": true, children: /* @__PURE__ */ jsxDEV(Icon, { as: Paint }, void 0, false, {
|
|
27
|
+
fileName: "/home/runner/work/strapi/strapi/packages/plugins/color-picker/admin/src/components/ColorPickerIcon.tsx",
|
|
28
|
+
lineNumber: 19,
|
|
29
|
+
columnNumber: 7
|
|
30
|
+
}, globalThis) }, void 0, false, {
|
|
31
|
+
fileName: "/home/runner/work/strapi/strapi/packages/plugins/color-picker/admin/src/components/ColorPickerIcon.tsx",
|
|
32
|
+
lineNumber: 18,
|
|
33
|
+
columnNumber: 5
|
|
34
|
+
}, globalThis);
|
|
35
|
+
};
|
|
36
|
+
const pluginId = "color-picker";
|
|
37
|
+
const getTrad = (id) => `${pluginId}.${id}`;
|
|
38
|
+
const index = {
|
|
39
|
+
/**
|
|
40
|
+
* TODO: we need to have the type for StrapiApp done from `@strapi/admin` package.
|
|
41
|
+
*/
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
|
+
register(app) {
|
|
44
|
+
app.customFields.register({
|
|
45
|
+
name: "color",
|
|
46
|
+
pluginId: "color-picker",
|
|
47
|
+
type: "string",
|
|
48
|
+
icon: ColorPickerIcon,
|
|
49
|
+
intlLabel: {
|
|
50
|
+
id: getTrad("color-picker.label"),
|
|
51
|
+
defaultMessage: "Color"
|
|
52
|
+
},
|
|
53
|
+
intlDescription: {
|
|
54
|
+
id: getTrad("color-picker.description"),
|
|
55
|
+
defaultMessage: "Select any color"
|
|
56
|
+
},
|
|
57
|
+
components: {
|
|
58
|
+
Input: async () => import("./ColorPickerInput-0d985ad5.mjs").then((module) => ({
|
|
59
|
+
default: module.ColorPickerInput
|
|
60
|
+
}))
|
|
61
|
+
},
|
|
62
|
+
options: {
|
|
63
|
+
advanced: [
|
|
64
|
+
{
|
|
65
|
+
intlLabel: {
|
|
66
|
+
id: getTrad("color-picker.options.advanced.regex"),
|
|
67
|
+
defaultMessage: "RegExp pattern"
|
|
68
|
+
},
|
|
69
|
+
name: "regex",
|
|
70
|
+
type: "text",
|
|
71
|
+
defaultValue: "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",
|
|
72
|
+
description: {
|
|
73
|
+
id: getTrad("color-picker.options.advanced.regex.description"),
|
|
74
|
+
defaultMessage: "The text of the regular expression"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
sectionTitle: {
|
|
79
|
+
id: "global.settings",
|
|
80
|
+
defaultMessage: "Settings"
|
|
81
|
+
},
|
|
82
|
+
items: [
|
|
83
|
+
{
|
|
84
|
+
name: "required",
|
|
85
|
+
type: "checkbox",
|
|
86
|
+
intlLabel: {
|
|
87
|
+
id: getTrad("color-picker.options.advanced.requiredField"),
|
|
88
|
+
defaultMessage: "Required field"
|
|
89
|
+
},
|
|
90
|
+
description: {
|
|
91
|
+
id: getTrad("color-picker.options.advanced.requiredField.description"),
|
|
92
|
+
defaultMessage: "You won't be able to create an entry if this field is empty"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
async registerTrads({ locales }) {
|
|
102
|
+
const importedTrads = await Promise.all(
|
|
103
|
+
locales.map((locale) => {
|
|
104
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/cs.json": () => import("./cs-32e5b75a.mjs"), "./translations/en.json": () => import("./en-2230584b.mjs"), "./translations/ru.json": () => import("./ru-0bf57448.mjs"), "./translations/sv.json": () => import("./sv-de6a785a.mjs"), "./translations/tr.json": () => import("./tr-4d632eac.mjs"), "./translations/zh.json": () => import("./zh-5ba3e025.mjs") }), `./translations/${locale}.json`).then(({ default: data }) => {
|
|
105
|
+
return {
|
|
106
|
+
data: prefixPluginTranslations(data, pluginId),
|
|
107
|
+
locale
|
|
108
|
+
};
|
|
109
|
+
}).catch(() => {
|
|
110
|
+
return {
|
|
111
|
+
data: {},
|
|
112
|
+
locale
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
})
|
|
116
|
+
);
|
|
117
|
+
return Promise.resolve(importedTrads);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
export {
|
|
121
|
+
getTrad as g,
|
|
122
|
+
index as i
|
|
123
|
+
};
|
|
124
|
+
//# sourceMappingURL=index-214132a2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-214132a2.mjs","sources":["../../admin/src/components/ColorPickerIcon.tsx","../../admin/src/pluginId.ts","../../admin/src/utils/getTrad.ts","../../admin/src/index.ts"],"sourcesContent":["import { Flex, Icon } from '@strapi/design-system';\nimport { Paint } from '@strapi/icons';\nimport styled from 'styled-components';\n\nconst IconBox = styled(Flex)`\n /* Hard code color values */\n /* to stay consistent between themes */\n background-color: #f0f0ff; /* primary100 */\n border: 1px solid #d9d8ff; /* primary200 */\n\n svg > path {\n fill: #4945ff; /* primary600 */\n }\n`;\n\nexport const ColorPickerIcon = () => {\n return (\n <IconBox justifyContent=\"center\" alignItems=\"center\" width={7} height={6} hasRadius aria-hidden>\n <Icon as={Paint} />\n </IconBox>\n );\n};\n","export const pluginId = 'color-picker';\n","import { pluginId } from '../pluginId';\n\nexport const getTrad = (id: string) => `${pluginId}.${id}`;\n","import { prefixPluginTranslations } from '@strapi/helper-plugin';\n\nimport { ColorPickerIcon } from './components/ColorPickerIcon';\nimport { pluginId } from './pluginId';\nimport { getTrad } from './utils/getTrad';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n /**\n * TODO: we need to have the type for StrapiApp done from `@strapi/admin` package.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n register(app: any) {\n app.customFields.register({\n name: 'color',\n pluginId: 'color-picker',\n type: 'string',\n icon: ColorPickerIcon,\n intlLabel: {\n id: getTrad('color-picker.label'),\n defaultMessage: 'Color',\n },\n intlDescription: {\n id: getTrad('color-picker.description'),\n defaultMessage: 'Select any color',\n },\n components: {\n Input: async () =>\n import('./components/ColorPickerInput').then((module) => ({\n default: module.ColorPickerInput,\n })),\n },\n options: {\n advanced: [\n {\n intlLabel: {\n id: getTrad('color-picker.options.advanced.regex'),\n defaultMessage: 'RegExp pattern',\n },\n name: 'regex',\n type: 'text',\n defaultValue: '^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$',\n description: {\n id: getTrad('color-picker.options.advanced.regex.description'),\n defaultMessage: 'The text of the regular expression',\n },\n },\n {\n sectionTitle: {\n id: 'global.settings',\n defaultMessage: 'Settings',\n },\n items: [\n {\n name: 'required',\n type: 'checkbox',\n intlLabel: {\n id: getTrad('color-picker.options.advanced.requiredField'),\n defaultMessage: 'Required field',\n },\n description: {\n id: getTrad('color-picker.options.advanced.requiredField.description'),\n defaultMessage: \"You won't be able to create an entry if this field is empty\",\n },\n },\n ],\n },\n ],\n },\n });\n },\n async registerTrads({ locales }: { locales: string[] }) {\n const importedTrads = await Promise.all(\n locales.map((locale) => {\n return import(`./translations/${locale}.json`)\n .then(({ default: data }) => {\n return {\n data: prefixPluginTranslations(data, pluginId),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n\n return Promise.resolve(importedTrads);\n },\n};\n"],"names":["this"],"mappings":";;;;;;;;;;;;;;AAIA,MAAM,UAAU,OAAO,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWpB,MAAM,kBAAkB,MAAM;AACnC,gCACG,SAAQ,EAAA,gBAAe,UAAS,YAAW,UAAS,OAAO,GAAG,QAAQ,GAAG,WAAS,MAAC,eAAW,MAC7F,UAAC,uBAAA,MAAA,EAAK,IAAI,MAAV,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,UAAiB,EADnB,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAEA,GAAAA,UAAA;AAEJ;ACrBO,MAAM,WAAW;ACEjB,MAAM,UAAU,CAAC,OAAe,GAAG,QAAQ,IAAI,EAAE;ACKxD,MAAe,QAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKb,SAAS,KAAU;AACjB,QAAI,aAAa,SAAS;AAAA,MACxB,MAAM;AAAA,MACN,U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mBAAA,GAAA,0BAAA,MAAA,OAAA,mBAAA,GAAA,0BAAA,MAAA,OAAA,mBAAA,GAAA,0BAAA,MAAA,OAAA,mBAAA,EAAA,CAAA,GAAA,kBAAA,MAAA,OAAA,EACnC,KAAK,CAAC,EAAE,SAAS,WAAW;AACpB,iBAAA;AAAA,YACL,MAAM,yBAAyB,MAAM,QAAQ;AAAA,YAC7C;AAAA,UAAA;AAAA,QACF,CACD,EACA,MAAM,MAAM;AACJ,iBAAA;AAAA,YACL,MAAM,CAAC;AAAA,YACP;AAAA,UAAA;AAAA,QACF,CACD;AAAA,MAAA,CACJ;AAAA,IAAA;AAGI,WAAA,QAAQ,QAAQ,aAAa;AAAA,EACtC;AACF;"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const helperPlugin = require("@strapi/helper-plugin");
|
|
3
|
+
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
|
+
const designSystem = require("@strapi/design-system");
|
|
5
|
+
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) => {
|
|
10
|
+
const v = glob[path];
|
|
11
|
+
if (v) {
|
|
12
|
+
return typeof v === "function" ? v() : Promise.resolve(v);
|
|
13
|
+
}
|
|
14
|
+
return new Promise((_, reject) => {
|
|
15
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(reject.bind(null, new Error("Unknown variable dynamic import: " + path)));
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
const IconBox = styled__default.default(designSystem.Flex)`
|
|
19
|
+
/* Hard code color values */
|
|
20
|
+
/* to stay consistent between themes */
|
|
21
|
+
background-color: #f0f0ff; /* primary100 */
|
|
22
|
+
border: 1px solid #d9d8ff; /* primary200 */
|
|
23
|
+
|
|
24
|
+
svg > path {
|
|
25
|
+
fill: #4945ff; /* primary600 */
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
const ColorPickerIcon = () => {
|
|
29
|
+
return /* @__PURE__ */ jsxDevRuntime.jsxDEV(IconBox, { justifyContent: "center", alignItems: "center", width: 7, height: 6, hasRadius: true, "aria-hidden": true, children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(designSystem.Icon, { as: icons.Paint }, void 0, false, {
|
|
30
|
+
fileName: "/home/runner/work/strapi/strapi/packages/plugins/color-picker/admin/src/components/ColorPickerIcon.tsx",
|
|
31
|
+
lineNumber: 19,
|
|
32
|
+
columnNumber: 7
|
|
33
|
+
}, globalThis) }, void 0, false, {
|
|
34
|
+
fileName: "/home/runner/work/strapi/strapi/packages/plugins/color-picker/admin/src/components/ColorPickerIcon.tsx",
|
|
35
|
+
lineNumber: 18,
|
|
36
|
+
columnNumber: 5
|
|
37
|
+
}, globalThis);
|
|
38
|
+
};
|
|
39
|
+
const pluginId = "color-picker";
|
|
40
|
+
const getTrad = (id) => `${pluginId}.${id}`;
|
|
41
|
+
const index = {
|
|
42
|
+
/**
|
|
43
|
+
* TODO: we need to have the type for StrapiApp done from `@strapi/admin` package.
|
|
44
|
+
*/
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
46
|
+
register(app) {
|
|
47
|
+
app.customFields.register({
|
|
48
|
+
name: "color",
|
|
49
|
+
pluginId: "color-picker",
|
|
50
|
+
type: "string",
|
|
51
|
+
icon: ColorPickerIcon,
|
|
52
|
+
intlLabel: {
|
|
53
|
+
id: getTrad("color-picker.label"),
|
|
54
|
+
defaultMessage: "Color"
|
|
55
|
+
},
|
|
56
|
+
intlDescription: {
|
|
57
|
+
id: getTrad("color-picker.description"),
|
|
58
|
+
defaultMessage: "Select any color"
|
|
59
|
+
},
|
|
60
|
+
components: {
|
|
61
|
+
Input: async () => Promise.resolve().then(() => require("./ColorPickerInput-8875b370.js")).then((module2) => ({
|
|
62
|
+
default: module2.ColorPickerInput
|
|
63
|
+
}))
|
|
64
|
+
},
|
|
65
|
+
options: {
|
|
66
|
+
advanced: [
|
|
67
|
+
{
|
|
68
|
+
intlLabel: {
|
|
69
|
+
id: getTrad("color-picker.options.advanced.regex"),
|
|
70
|
+
defaultMessage: "RegExp pattern"
|
|
71
|
+
},
|
|
72
|
+
name: "regex",
|
|
73
|
+
type: "text",
|
|
74
|
+
defaultValue: "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",
|
|
75
|
+
description: {
|
|
76
|
+
id: getTrad("color-picker.options.advanced.regex.description"),
|
|
77
|
+
defaultMessage: "The text of the regular expression"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
sectionTitle: {
|
|
82
|
+
id: "global.settings",
|
|
83
|
+
defaultMessage: "Settings"
|
|
84
|
+
},
|
|
85
|
+
items: [
|
|
86
|
+
{
|
|
87
|
+
name: "required",
|
|
88
|
+
type: "checkbox",
|
|
89
|
+
intlLabel: {
|
|
90
|
+
id: getTrad("color-picker.options.advanced.requiredField"),
|
|
91
|
+
defaultMessage: "Required field"
|
|
92
|
+
},
|
|
93
|
+
description: {
|
|
94
|
+
id: getTrad("color-picker.options.advanced.requiredField.description"),
|
|
95
|
+
defaultMessage: "You won't be able to create an entry if this field is empty"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
},
|
|
104
|
+
async registerTrads({ locales }) {
|
|
105
|
+
const importedTrads = await Promise.all(
|
|
106
|
+
locales.map((locale) => {
|
|
107
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/cs.json": () => Promise.resolve().then(() => require("./cs-c22467c6.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-eb6717ab.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("./ru-1d1cf8a8.js")), "./translations/sv.json": () => Promise.resolve().then(() => require("./sv-6e7fa200.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("./tr-67b6e192.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("./zh-e5010f8b.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
|
|
108
|
+
return {
|
|
109
|
+
data: helperPlugin.prefixPluginTranslations(data, pluginId),
|
|
110
|
+
locale
|
|
111
|
+
};
|
|
112
|
+
}).catch(() => {
|
|
113
|
+
return {
|
|
114
|
+
data: {},
|
|
115
|
+
locale
|
|
116
|
+
};
|
|
117
|
+
});
|
|
118
|
+
})
|
|
119
|
+
);
|
|
120
|
+
return Promise.resolve(importedTrads);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
exports.getTrad = getTrad;
|
|
124
|
+
exports.index = index;
|
|
125
|
+
//# sourceMappingURL=index-9695efa4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-9695efa4.js","sources":["../../admin/src/components/ColorPickerIcon.tsx","../../admin/src/pluginId.ts","../../admin/src/utils/getTrad.ts","../../admin/src/index.ts"],"sourcesContent":["import { Flex, Icon } from '@strapi/design-system';\nimport { Paint } from '@strapi/icons';\nimport styled from 'styled-components';\n\nconst IconBox = styled(Flex)`\n /* Hard code color values */\n /* to stay consistent between themes */\n background-color: #f0f0ff; /* primary100 */\n border: 1px solid #d9d8ff; /* primary200 */\n\n svg > path {\n fill: #4945ff; /* primary600 */\n }\n`;\n\nexport const ColorPickerIcon = () => {\n return (\n <IconBox justifyContent=\"center\" alignItems=\"center\" width={7} height={6} hasRadius aria-hidden>\n <Icon as={Paint} />\n </IconBox>\n );\n};\n","export const pluginId = 'color-picker';\n","import { pluginId } from '../pluginId';\n\nexport const getTrad = (id: string) => `${pluginId}.${id}`;\n","import { prefixPluginTranslations } from '@strapi/helper-plugin';\n\nimport { ColorPickerIcon } from './components/ColorPickerIcon';\nimport { pluginId } from './pluginId';\nimport { getTrad } from './utils/getTrad';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n /**\n * TODO: we need to have the type for StrapiApp done from `@strapi/admin` package.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n register(app: any) {\n app.customFields.register({\n name: 'color',\n pluginId: 'color-picker',\n type: 'string',\n icon: ColorPickerIcon,\n intlLabel: {\n id: getTrad('color-picker.label'),\n defaultMessage: 'Color',\n },\n intlDescription: {\n id: getTrad('color-picker.description'),\n defaultMessage: 'Select any color',\n },\n components: {\n Input: async () =>\n import('./components/ColorPickerInput').then((module) => ({\n default: module.ColorPickerInput,\n })),\n },\n options: {\n advanced: [\n {\n intlLabel: {\n id: getTrad('color-picker.options.advanced.regex'),\n defaultMessage: 'RegExp pattern',\n },\n name: 'regex',\n type: 'text',\n defaultValue: '^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$',\n description: {\n id: getTrad('color-picker.options.advanced.regex.description'),\n defaultMessage: 'The text of the regular expression',\n },\n },\n {\n sectionTitle: {\n id: 'global.settings',\n defaultMessage: 'Settings',\n },\n items: [\n {\n name: 'required',\n type: 'checkbox',\n intlLabel: {\n id: getTrad('color-picker.options.advanced.requiredField'),\n defaultMessage: 'Required field',\n },\n description: {\n id: getTrad('color-picker.options.advanced.requiredField.description'),\n defaultMessage: \"You won't be able to create an entry if this field is empty\",\n },\n },\n ],\n },\n ],\n },\n });\n },\n async registerTrads({ locales }: { locales: string[] }) {\n const importedTrads = await Promise.all(\n locales.map((locale) => {\n return import(`./translations/${locale}.json`)\n .then(({ default: data }) => {\n return {\n data: prefixPluginTranslations(data, pluginId),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n\n return Promise.resolve(importedTrads);\n },\n};\n"],"names":["styled","Flex","jsxDEV","Icon","Paint","this","module","prefixPluginTranslations"],"mappings":";;;;;;;;;;;;;;;;;AAIA,MAAM,UAAUA,gBAAAA,QAAOC,aAAAA,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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AAA,CACJ;AAAA,IAAA;AAGI,WAAA,QAAQ,QAAQ,aAAa;AAAA,EACtC;AACF;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{
|
|
1
|
+
const ru = {
|
|
2
2
|
"color-picker.description": "Выбирайте любые цвета",
|
|
3
3
|
"color-picker.input.aria-label": "Введите выбранный цвет",
|
|
4
4
|
"color-picker.input.format": "HEX",
|
|
@@ -12,4 +12,8 @@
|
|
|
12
12
|
"plugin.description.long": "Настраиваемое поле средства выбора цвета, поддерживаемое Strapi. Используйте ползунки насыщенности и оттенка, чтобы выбрать цвет и сохранить его HEX (шестнадцатеричное) значение.",
|
|
13
13
|
"plugin.description.short": "Настраиваемое поле средства выбора цвета, поддерживаемое Strapi.",
|
|
14
14
|
"plugin.name": "Выбор цвета"
|
|
15
|
-
}
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
ru as default
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=ru-0bf57448.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ru-0bf57448.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const ru = {
|
|
4
|
+
"color-picker.description": "Выбирайте любые цвета",
|
|
5
|
+
"color-picker.input.aria-label": "Введите выбранный цвет",
|
|
6
|
+
"color-picker.input.format": "HEX",
|
|
7
|
+
"color-picker.label": "Цвет",
|
|
8
|
+
"color-picker.options.advanced.regex": "Шаблон регулярного выражения (RegExp)",
|
|
9
|
+
"color-picker.options.advanced.regex.description": "Обеспечивает проверку с помощью регулярного выражение для HEX (шестнадцатеричного) HEX значения цвета",
|
|
10
|
+
"color-picker.options.advanced.requiredField": "Обязательное поле",
|
|
11
|
+
"color-picker.options.advanced.requiredField.description": "Вы не сможете продолжить, если это поле пусто",
|
|
12
|
+
"color-picker.settings": "Настройки",
|
|
13
|
+
"color-picker.toggle.aria-label": "Переключатель средства выбора цвета",
|
|
14
|
+
"plugin.description.long": "Настраиваемое поле средства выбора цвета, поддерживаемое Strapi. Используйте ползунки насыщенности и оттенка, чтобы выбрать цвет и сохранить его HEX (шестнадцатеричное) значение.",
|
|
15
|
+
"plugin.description.short": "Настраиваемое поле средства выбора цвета, поддерживаемое Strapi.",
|
|
16
|
+
"plugin.name": "Выбор цвета"
|
|
17
|
+
};
|
|
18
|
+
exports.default = ru;
|
|
19
|
+
//# sourceMappingURL=ru-1d1cf8a8.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ru-1d1cf8a8.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const sv = {
|
|
4
|
+
"color-picker.description": "Välj färger",
|
|
5
|
+
"color-picker.input.aria-label": "Färgväljarinmatning",
|
|
6
|
+
"color-picker.input.format": "HEX",
|
|
7
|
+
"color-picker.label": "Färgväljare",
|
|
8
|
+
"color-picker.options.advanced.regex": "RegEx-mönster",
|
|
9
|
+
"color-picker.options.advanced.regex.description": "Ange ett regex-mönster för att validera HEX-värdet",
|
|
10
|
+
"color-picker.options.advanced.requiredField": "Obligatoriskt fält",
|
|
11
|
+
"color-picker.options.advanced.requiredField.description": "Du kommer inte att kunna skapa en post om det här fältet är tomt",
|
|
12
|
+
"color-picker.settings": "Inställningar",
|
|
13
|
+
"color-picker.toggle.aria-label": "Växla färgväljare"
|
|
14
|
+
};
|
|
15
|
+
exports.default = sv;
|
|
16
|
+
//# sourceMappingURL=sv-6e7fa200.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sv-6e7fa200.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{
|
|
1
|
+
const sv = {
|
|
2
2
|
"color-picker.description": "Välj färger",
|
|
3
3
|
"color-picker.input.aria-label": "Färgväljarinmatning",
|
|
4
4
|
"color-picker.input.format": "HEX",
|
|
@@ -9,4 +9,8 @@
|
|
|
9
9
|
"color-picker.options.advanced.requiredField.description": "Du kommer inte att kunna skapa en post om det här fältet är tomt",
|
|
10
10
|
"color-picker.settings": "Inställningar",
|
|
11
11
|
"color-picker.toggle.aria-label": "Växla färgväljare"
|
|
12
|
-
}
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
sv as default
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=sv-de6a785a.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sv-de6a785a.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{
|
|
1
|
+
const tr = {
|
|
2
2
|
"color-picker.description": "Herhangi bir renk seç",
|
|
3
3
|
"color-picker.input.aria-label": "Renk seçici girişi",
|
|
4
4
|
"color-picker.input.format": "HEX",
|
|
@@ -9,4 +9,8 @@
|
|
|
9
9
|
"color-picker.options.advanced.requiredField.description": "Bu alan boş olursa yeni bir girdi oluşturamazsın",
|
|
10
10
|
"color-picker.settings": "Ayarlar",
|
|
11
11
|
"color-picker.toggle.aria-label": "Renk seçici anahtarı"
|
|
12
|
-
}
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
tr as default
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=tr-4d632eac.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tr-4d632eac.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const tr = {
|
|
4
|
+
"color-picker.description": "Herhangi bir renk seç",
|
|
5
|
+
"color-picker.input.aria-label": "Renk seçici girişi",
|
|
6
|
+
"color-picker.input.format": "HEX",
|
|
7
|
+
"color-picker.label": "Renk",
|
|
8
|
+
"color-picker.options.advanced.regex": "RegExp ifadesi",
|
|
9
|
+
"color-picker.options.advanced.regex.description": "HEX değerini doğrulamak için bir RegExp ifadesi sağla",
|
|
10
|
+
"color-picker.options.advanced.requiredField": "Zorunlu alan",
|
|
11
|
+
"color-picker.options.advanced.requiredField.description": "Bu alan boş olursa yeni bir girdi oluşturamazsın",
|
|
12
|
+
"color-picker.settings": "Ayarlar",
|
|
13
|
+
"color-picker.toggle.aria-label": "Renk seçici anahtarı"
|
|
14
|
+
};
|
|
15
|
+
exports.default = tr;
|
|
16
|
+
//# sourceMappingURL=tr-67b6e192.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tr-67b6e192.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{
|
|
1
|
+
const zh = {
|
|
2
2
|
"color-picker.description": "選擇任意顏色",
|
|
3
3
|
"color-picker.input.aria-label": "選色器輸入",
|
|
4
4
|
"color-picker.input.format": "HEX",
|
|
@@ -9,4 +9,8 @@
|
|
|
9
9
|
"color-picker.options.advanced.requiredField.description": "若此欄位為空,您將無法建立項目",
|
|
10
10
|
"color-picker.settings": "設定",
|
|
11
11
|
"color-picker.toggle.aria-label": "選色器開關"
|
|
12
|
-
}
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
zh as default
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=zh-5ba3e025.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zh-5ba3e025.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const zh = {
|
|
4
|
+
"color-picker.description": "選擇任意顏色",
|
|
5
|
+
"color-picker.input.aria-label": "選色器輸入",
|
|
6
|
+
"color-picker.input.format": "HEX",
|
|
7
|
+
"color-picker.label": "顏色",
|
|
8
|
+
"color-picker.options.advanced.regex": "正則表達模式",
|
|
9
|
+
"color-picker.options.advanced.regex.description": "提供正則表達式以驗證 HEX 值",
|
|
10
|
+
"color-picker.options.advanced.requiredField": "必填欄位",
|
|
11
|
+
"color-picker.options.advanced.requiredField.description": "若此欄位為空,您將無法建立項目",
|
|
12
|
+
"color-picker.settings": "設定",
|
|
13
|
+
"color-picker.toggle.aria-label": "選色器開關"
|
|
14
|
+
};
|
|
15
|
+
exports.default = zh;
|
|
16
|
+
//# sourceMappingURL=zh-e5010f8b.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zh-e5010f8b.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ColorPickerIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
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;
|
|
27
|
+
labelAction?: React.ReactNode;
|
|
28
|
+
required?: boolean;
|
|
29
|
+
value?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare const ColorPickerInput: React.ForwardRefExoticComponent<ColorPickerInputProps & React.RefAttributes<HTMLButtonElement>>;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
type PossibleRef<T> = React.Ref<T> | undefined;
|
|
3
|
+
/**
|
|
4
|
+
* A utility to compose multiple refs together
|
|
5
|
+
* Accepts callback refs and RefObject(s)
|
|
6
|
+
*/
|
|
7
|
+
declare function composeRefs<T>(...refs: PossibleRef<T>[]): (node: T) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Takes multiple React like refs either React.Ref or a callback:
|
|
10
|
+
* (node: T) => void and returns a single function that can be
|
|
11
|
+
* passed to a React component as a ref.
|
|
12
|
+
*
|
|
13
|
+
* Example:
|
|
14
|
+
* ```tsx
|
|
15
|
+
* import { useComposedRefs } from '../hooks/useComposedRefs';
|
|
16
|
+
*
|
|
17
|
+
* const Component = React.forwardRef<HTMLInputElement, ComponentProps>((props, forwardedRef) => {
|
|
18
|
+
* const ref = useComposedRefs(internalRef, forwardedRef);
|
|
19
|
+
*
|
|
20
|
+
* React.useEffect(() => {
|
|
21
|
+
* ref.current.focus();
|
|
22
|
+
* }, [ref]);
|
|
23
|
+
*
|
|
24
|
+
* return <input ref={ref} />
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
declare function useComposedRefs<T>(...refs: PossibleRef<T>[]): (node: T) => void;
|
|
29
|
+
export { composeRefs, useComposedRefs };
|