@strapi/plugin-color-picker 4.14.3 → 4.14.4
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/dist/_chunks/ColorPickerInput-1e9c7a15.js +47 -0
- package/dist/_chunks/ColorPickerInput-1e9c7a15.js.map +1 -0
- package/dist/_chunks/{ColorPickerInput-35879029.mjs → ColorPickerInput-3335ebf5.mjs} +37 -37
- package/dist/_chunks/ColorPickerInput-3335ebf5.mjs.map +1 -0
- package/dist/_chunks/{index-2963da37.js → index-3cecbc68.js} +2 -2
- package/dist/_chunks/{index-2963da37.js.map → index-3cecbc68.js.map} +1 -1
- package/dist/_chunks/{index-85aee7ac.mjs → index-e75c6fdb.mjs} +2 -2
- package/dist/_chunks/{index-85aee7ac.mjs.map → index-e75c6fdb.mjs.map} +1 -1
- package/dist/admin/components/ColorPickerInput.d.ts +1 -1
- package/dist/admin/index.d.ts +3 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/package.json +6 -6
- package/dist/_chunks/ColorPickerInput-35879029.mjs.map +0 -1
- package/dist/_chunks/ColorPickerInput-d3f12809.js +0 -47
- package/dist/_chunks/ColorPickerInput-d3f12809.js.map +0 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-3cecbc68.js"),y=require("react"),r=require("@strapi/design-system"),C=require("@strapi/icons"),P=require("react-colorful"),T=require("react-intl"),c=require("styled-components");require("@strapi/helper-plugin");function v(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const a=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(o,s,a.get?a:{enumerable:!0,get:()=>e[s]})}}return o.default=e,Object.freeze(o)}const l=v(y);function w(e,o){typeof e=="function"?e(o):e!=null&&(e.current=o)}function $(...e){return o=>e.forEach(s=>w(s,o))}function F(...e){return l.useCallback($(...e),e)}const _=c.div`
|
|
2
|
+
border-radius: 50%;
|
|
3
|
+
width: 20px;
|
|
4
|
+
height: 20px;
|
|
5
|
+
margin-right: 10px;
|
|
6
|
+
background-color: ${e=>e.color};
|
|
7
|
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
8
|
+
`,q=c(P.HexColorPicker)`
|
|
9
|
+
&& {
|
|
10
|
+
width: 100%;
|
|
11
|
+
aspect-ratio: 1.5;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.react-colorful__pointer {
|
|
15
|
+
width: ${({theme:e})=>e.spaces[3]};
|
|
16
|
+
height: ${({theme:e})=>e.spaces[3]};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.react-colorful__saturation {
|
|
20
|
+
border-radius: ${({theme:e})=>e.spaces[1]};
|
|
21
|
+
border-bottom: none;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.react-colorful__hue {
|
|
25
|
+
border-radius: 10px;
|
|
26
|
+
height: ${({theme:e})=>e.spaces[3]};
|
|
27
|
+
margin-top: ${({theme:e})=>e.spaces[2]};
|
|
28
|
+
}
|
|
29
|
+
`,S=c(r.BaseButton)`
|
|
30
|
+
display: flex;
|
|
31
|
+
justify-content: space-between;
|
|
32
|
+
align-items: center;
|
|
33
|
+
|
|
34
|
+
svg {
|
|
35
|
+
width: ${({theme:e})=>e.spaces[2]};
|
|
36
|
+
height: ${({theme:e})=>e.spaces[2]};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
svg > path {
|
|
40
|
+
fill: ${({theme:e})=>e.colors.neutral500};
|
|
41
|
+
justify-self: flex-end;
|
|
42
|
+
}
|
|
43
|
+
`,B=c(r.Popover)`
|
|
44
|
+
padding: ${({theme:e})=>e.spaces[2]};
|
|
45
|
+
min-height: 270px;
|
|
46
|
+
`,I=l.forwardRef(({attribute:e,description:o,disabled:s=!1,error:a,intlLabel:h,labelAction:m,name:u,onChange:f,required:R=!1,value:p=""},b)=>{const[d,x]=l.useState(!1),j=l.useRef(null),{formatMessage:i}=T.useIntl(),g=p||"#000000",E=n=>{n.preventDefault(),n.currentTarget.contains(n.relatedTarget)||x(!1)},k=F(b,j);return t.jsxRuntimeExports.jsx(r.Field,{name:u,id:u,error:a,hint:o&&i(o),required:R,children:t.jsxRuntimeExports.jsxs(r.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[t.jsxRuntimeExports.jsx(r.FieldLabel,{action:m,children:i(h)}),t.jsxRuntimeExports.jsxs(S,{ref:k,"aria-label":i({id:t.getTrad("color-picker.toggle.aria-label"),defaultMessage:"Color picker toggle"}),"aria-controls":"color-picker-value","aria-haspopup":"dialog","aria-expanded":d,"aria-disabled":s,disabled:s,onClick:()=>x(!d),children:[t.jsxRuntimeExports.jsxs(r.Flex,{children:[t.jsxRuntimeExports.jsx(_,{color:g}),t.jsxRuntimeExports.jsx(r.Typography,{style:{textTransform:"uppercase"},textColor:p?void 0:"neutral600",variant:"omega",children:g})]}),t.jsxRuntimeExports.jsx(C.CarretDown,{"aria-hidden":!0})]}),d&&t.jsxRuntimeExports.jsx(B,{onBlur:E,role:"dialog",source:j,spacing:4,children:t.jsxRuntimeExports.jsxs(r.FocusTrap,{onEscape:()=>x(!1),children:[t.jsxRuntimeExports.jsx(q,{color:g,onChange:n=>f({target:{name:u,value:n,type:e.type}})}),t.jsxRuntimeExports.jsxs(r.Flex,{paddingTop:3,paddingLeft:4,justifyContent:"flex-end",children:[t.jsxRuntimeExports.jsx(r.Box,{paddingRight:2,children:t.jsxRuntimeExports.jsx(r.Typography,{variant:"omega",as:"label",textColor:"neutral600",children:i({id:t.getTrad("color-picker.input.format"),defaultMessage:"HEX"})})}),t.jsxRuntimeExports.jsx(r.FieldInput,{id:"color-picker-value","aria-label":i({id:t.getTrad("color-picker.input.aria-label"),defaultMessage:"Color picker input"}),style:{textTransform:"uppercase"},value:p,placeholder:"#000000",onChange:f})]})]})}),t.jsxRuntimeExports.jsx(r.FieldHint,{}),t.jsxRuntimeExports.jsx(r.FieldError,{})]})})});exports.ColorPickerInput=I;
|
|
47
|
+
//# sourceMappingURL=ColorPickerInput-1e9c7a15.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorPickerInput-1e9c7a15.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":["setRef","ref","value","composeRefs","refs","node","useComposedRefs","React","ColorPreview","styled","props","ColorPicker","HexColorPicker","theme","ColorPickerToggle","BaseButton","ColorPickerPopover","Popover","ColorPickerInput","attribute","description","disabled","error","intlLabel","labelAction","name","onChange","required","forwardedRef","showColorPicker","setShowColorPicker","colorPickerButtonRef","formatMessage","useIntl","color","handleBlur","e","composedRefs","jsx","Field","Flex","FieldLabel","jsxs","getTrad","Typography","CarretDown","FocusTrap","hexValue","Box","FieldInput","FieldHint","FieldError"],"mappings":"slBAQA,SAASA,EAAUC,EAAqBC,EAAU,CAC5C,OAAOD,GAAQ,WACjBA,EAAIC,CAAK,EACAD,GAAQ,OAChBA,EAAkC,QAAUC,EAEjD,CAMA,SAASC,KAAkBC,EAAwB,CAC1C,OAACC,GAAYD,EAAK,QAASH,GAAQD,EAAOC,EAAKI,CAAI,CAAC,CAC7D,CAsBA,SAASC,KAAsBF,EAAwB,CAErD,OAAOG,EAAM,YAAYJ,EAAY,GAAGC,CAAI,EAAGA,CAAI,CACrD,CCxBA,MAAMI,EAAeC,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,sBAKLC,GAAUA,EAAM,KAAK;AAAA;AAAA,EAItCC,EAAcF,EAAOG,EAAAA,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAO5B,CAAC,CAAE,MAAAC,KAAYA,EAAM,OAAO,CAAC,CAAC;AAAA,cAC7B,CAAC,CAAE,MAAAA,KAAYA,EAAM,OAAO,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA,qBAIvB,CAAC,CAAE,MAAAA,KAAYA,EAAM,OAAO,CAAC,CAAC;AAAA;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AAgB,KAAA,CACjB,EACH,CACF,CAAA,EACAL,EAAA,kBAAA,IAACW,EAAA,WAAA,CACC,GAAG,qBACH,aAAYjB,EAAc,CACxB,GAAIW,UAAQ,+BAA+B,EAC3C,eAAgB,oBAAA,CACjB,EACD,MAAO,CAAE,cAAe,WAAY,EACpC,MAAAzC,EACA,YAAY,UACZ,SAAAwB,CAAA,CACF,CAAA,EACF,CAAA,EACF,CAAA,CACF,0BAEDwB,EAAU,UAAA,EAAA,0BACVC,EAAW,WAAA,EAAA,CAAA,EACd,CAAA,CAAA,CAGN,CACF"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { j as r, g as f } from "./index-
|
|
1
|
+
import { j as r, g as f } from "./index-e75c6fdb.mjs";
|
|
2
2
|
import * as a from "react";
|
|
3
|
-
import { BaseButton as
|
|
4
|
-
import { CarretDown as
|
|
5
|
-
import { HexColorPicker as
|
|
6
|
-
import { useIntl as
|
|
3
|
+
import { BaseButton as w, Popover as R, Field as $, Flex as g, FieldLabel as T, Typography as m, FocusTrap as F, Box as B, FieldInput as _, FieldHint as E, FieldError as I } from "@strapi/design-system";
|
|
4
|
+
import { CarretDown as M } from "@strapi/icons";
|
|
5
|
+
import { HexColorPicker as H } from "react-colorful";
|
|
6
|
+
import { useIntl as D } from "react-intl";
|
|
7
7
|
import l from "styled-components";
|
|
8
8
|
import "@strapi/helper-plugin";
|
|
9
|
-
function
|
|
9
|
+
function L(e, o) {
|
|
10
10
|
typeof e == "function" ? e(o) : e != null && (e.current = o);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
return (o) => e.forEach((i) =>
|
|
12
|
+
function S(...e) {
|
|
13
|
+
return (o) => e.forEach((i) => L(i, o));
|
|
14
14
|
}
|
|
15
15
|
function X(...e) {
|
|
16
|
-
return a.useCallback(
|
|
16
|
+
return a.useCallback(S(...e), e);
|
|
17
17
|
}
|
|
18
18
|
const q = l.div`
|
|
19
19
|
border-radius: 50%;
|
|
@@ -22,7 +22,7 @@ const q = l.div`
|
|
|
22
22
|
margin-right: 10px;
|
|
23
23
|
background-color: ${(e) => e.color};
|
|
24
24
|
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
25
|
-
`, z = l(
|
|
25
|
+
`, z = l(H)`
|
|
26
26
|
&& {
|
|
27
27
|
width: 100%;
|
|
28
28
|
aspect-ratio: 1.5;
|
|
@@ -43,7 +43,7 @@ const q = l.div`
|
|
|
43
43
|
height: ${({ theme: e }) => e.spaces[3]};
|
|
44
44
|
margin-top: ${({ theme: e }) => e.spaces[2]};
|
|
45
45
|
}
|
|
46
|
-
`, A = l(
|
|
46
|
+
`, A = l(w)`
|
|
47
47
|
display: flex;
|
|
48
48
|
justify-content: space-between;
|
|
49
49
|
align-items: center;
|
|
@@ -57,39 +57,39 @@ const q = l.div`
|
|
|
57
57
|
fill: ${({ theme: e }) => e.colors.neutral500};
|
|
58
58
|
justify-self: flex-end;
|
|
59
59
|
}
|
|
60
|
-
`, G = l(
|
|
60
|
+
`, G = l(R)`
|
|
61
61
|
padding: ${({ theme: e }) => e.spaces[2]};
|
|
62
62
|
min-height: 270px;
|
|
63
|
-
`,
|
|
63
|
+
`, W = a.forwardRef(
|
|
64
64
|
({
|
|
65
65
|
attribute: e,
|
|
66
66
|
description: o,
|
|
67
67
|
disabled: i = !1,
|
|
68
|
-
error:
|
|
69
|
-
intlLabel:
|
|
70
|
-
labelAction:
|
|
68
|
+
error: j,
|
|
69
|
+
intlLabel: k,
|
|
70
|
+
labelAction: C,
|
|
71
71
|
name: c,
|
|
72
72
|
onChange: h,
|
|
73
|
-
required:
|
|
73
|
+
required: b = !1,
|
|
74
74
|
value: n = ""
|
|
75
|
-
},
|
|
76
|
-
const [p, d] = a.useState(!1), x = a.useRef(), { formatMessage: t } =
|
|
75
|
+
}, y) => {
|
|
76
|
+
const [p, d] = a.useState(!1), x = a.useRef(null), { formatMessage: t } = D(), u = n || "#000000", v = (s) => {
|
|
77
77
|
s.preventDefault(), s.currentTarget.contains(s.relatedTarget) || d(!1);
|
|
78
|
-
},
|
|
78
|
+
}, P = X(y, x);
|
|
79
79
|
return /* @__PURE__ */ r.jsx(
|
|
80
|
-
|
|
80
|
+
$,
|
|
81
81
|
{
|
|
82
82
|
name: c,
|
|
83
83
|
id: c,
|
|
84
|
-
error:
|
|
84
|
+
error: j,
|
|
85
85
|
hint: o && t(o),
|
|
86
|
-
required:
|
|
86
|
+
required: b,
|
|
87
87
|
children: /* @__PURE__ */ r.jsxs(g, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
|
88
|
-
/* @__PURE__ */ r.jsx(
|
|
88
|
+
/* @__PURE__ */ r.jsx(T, { action: C, children: t(k) }),
|
|
89
89
|
/* @__PURE__ */ r.jsxs(
|
|
90
90
|
A,
|
|
91
91
|
{
|
|
92
|
-
ref:
|
|
92
|
+
ref: P,
|
|
93
93
|
"aria-label": t({
|
|
94
94
|
id: f("color-picker.toggle.aria-label"),
|
|
95
95
|
defaultMessage: "Color picker toggle"
|
|
@@ -104,16 +104,16 @@ const q = l.div`
|
|
|
104
104
|
/* @__PURE__ */ r.jsxs(g, { children: [
|
|
105
105
|
/* @__PURE__ */ r.jsx(q, { color: u }),
|
|
106
106
|
/* @__PURE__ */ r.jsx(
|
|
107
|
-
|
|
107
|
+
m,
|
|
108
108
|
{
|
|
109
|
-
style:
|
|
110
|
-
textColor: n ?
|
|
109
|
+
style: { textTransform: "uppercase" },
|
|
110
|
+
textColor: n ? void 0 : "neutral600",
|
|
111
111
|
variant: "omega",
|
|
112
112
|
children: u
|
|
113
113
|
}
|
|
114
114
|
)
|
|
115
115
|
] }),
|
|
116
|
-
/* @__PURE__ */ r.jsx(
|
|
116
|
+
/* @__PURE__ */ r.jsx(M, { "aria-hidden": !0 })
|
|
117
117
|
]
|
|
118
118
|
}
|
|
119
119
|
),
|
|
@@ -124,7 +124,7 @@ const q = l.div`
|
|
|
124
124
|
role: "dialog",
|
|
125
125
|
source: x,
|
|
126
126
|
spacing: 4,
|
|
127
|
-
children: /* @__PURE__ */ r.jsxs(
|
|
127
|
+
children: /* @__PURE__ */ r.jsxs(F, { onEscape: () => d(!1), children: [
|
|
128
128
|
/* @__PURE__ */ r.jsx(
|
|
129
129
|
z,
|
|
130
130
|
{
|
|
@@ -133,19 +133,19 @@ const q = l.div`
|
|
|
133
133
|
}
|
|
134
134
|
),
|
|
135
135
|
/* @__PURE__ */ r.jsxs(g, { paddingTop: 3, paddingLeft: 4, justifyContent: "flex-end", children: [
|
|
136
|
-
/* @__PURE__ */ r.jsx(
|
|
136
|
+
/* @__PURE__ */ r.jsx(B, { paddingRight: 2, children: /* @__PURE__ */ r.jsx(m, { variant: "omega", as: "label", textColor: "neutral600", children: t({
|
|
137
137
|
id: f("color-picker.input.format"),
|
|
138
138
|
defaultMessage: "HEX"
|
|
139
139
|
}) }) }),
|
|
140
140
|
/* @__PURE__ */ r.jsx(
|
|
141
|
-
|
|
141
|
+
_,
|
|
142
142
|
{
|
|
143
143
|
id: "color-picker-value",
|
|
144
144
|
"aria-label": t({
|
|
145
145
|
id: f("color-picker.input.aria-label"),
|
|
146
146
|
defaultMessage: "Color picker input"
|
|
147
147
|
}),
|
|
148
|
-
style:
|
|
148
|
+
style: { textTransform: "uppercase" },
|
|
149
149
|
value: n,
|
|
150
150
|
placeholder: "#000000",
|
|
151
151
|
onChange: h
|
|
@@ -155,14 +155,14 @@ const q = l.div`
|
|
|
155
155
|
] })
|
|
156
156
|
}
|
|
157
157
|
),
|
|
158
|
-
/* @__PURE__ */ r.jsx(
|
|
159
|
-
/* @__PURE__ */ r.jsx(
|
|
158
|
+
/* @__PURE__ */ r.jsx(E, {}),
|
|
159
|
+
/* @__PURE__ */ r.jsx(I, {})
|
|
160
160
|
] })
|
|
161
161
|
}
|
|
162
162
|
);
|
|
163
163
|
}
|
|
164
164
|
);
|
|
165
165
|
export {
|
|
166
|
-
|
|
166
|
+
W as ColorPickerInput
|
|
167
167
|
};
|
|
168
|
-
//# sourceMappingURL=ColorPickerInput-
|
|
168
|
+
//# sourceMappingURL=ColorPickerInput-3335ebf5.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorPickerInput-3335ebf5.mjs","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":["setRef","ref","value","composeRefs","refs","node","useComposedRefs","React","ColorPreview","styled","props","ColorPicker","HexColorPicker","theme","ColorPickerToggle","BaseButton","ColorPickerPopover","Popover","ColorPickerInput","attribute","description","disabled","error","intlLabel","labelAction","name","onChange","required","forwardedRef","showColorPicker","setShowColorPicker","colorPickerButtonRef","formatMessage","useIntl","color","handleBlur","e","composedRefs","jsx","Field","Flex","FieldLabel","jsxs","getTrad","Typography","CarretDown","FocusTrap","hexValue","Box","FieldInput","FieldHint","FieldError"],"mappings":";;;;;;;;AAQA,SAASA,EAAUC,GAAqBC,GAAU;AAC5C,EAAA,OAAOD,KAAQ,aACjBA,EAAIC,CAAK,IACAD,KAAQ,SAChBA,EAAkC,UAAUC;AAEjD;AAMA,SAASC,KAAkBC,GAAwB;AAC1C,SAAA,CAACC,MAAYD,EAAK,QAAQ,CAACH,MAAQD,EAAOC,GAAKI,CAAI,CAAC;AAC7D;AAsBA,SAASC,KAAsBF,GAAwB;AAErD,SAAOG,EAAM,YAAYJ,EAAY,GAAGC,CAAI,GAAGA,CAAI;AACrD;ACxBA,MAAMI,IAAeC,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,sBAKN,CAACC,MAAUA,EAAM,KAAK;AAAA;AAAA,GAItCC,IAAcF,EAAOG,CAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAO5B,CAAC,EAAE,OAAAC,QAAYA,EAAM,OAAO,CAAC,CAAC;AAAA,cAC7B,CAAC,EAAE,OAAAA,QAAYA,EAAM,OAAO,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA,qBAIvB,CAAC,EAAE,OAAAA,QAAYA,EAAM,OAAO,CAAC,CAAC;AAAA;AAAA;AAAA;A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AAAuB;AAAA,oBACA,UAAU,CAACa,MACTrB,EAAS,EAAE,QAAQ,EAAE,MAAAD,GAAM,OAAOsB,GAAU,MAAM5B,EAAU,QAAQ;AAAA,kBAAA;AAAA,gBAExE;AAAA,uCACCqB,GAAK,EAAA,YAAY,GAAG,aAAa,GAAG,gBAAe,YAClD,UAAA;AAAA,kBAACF,gBAAAA,EAAA,IAAAU,GAAA,EAAI,cAAc,GACjB,UAACV,gBAAAA,EAAAA,IAAAM,GAAA,EAAW,SAAQ,SAAQ,IAAG,SAAQ,WAAU,cAC9C,UAAcZ,EAAA;AAAA,oBACb,IAAIW,EAAQ,2BAA2B;AAAA,oBACvC,gBAAgB;AAAA,kBAAA,CACjB,GACH,EACF,CAAA;AAAA,kBACAL,gBAAAA,EAAA;AAAA,oBAACW;AAAA,oBAAA;AAAA,sBACC,IAAG;AAAA,sBACH,cAAYjB,EAAc;AAAA,wBACxB,IAAIW,EAAQ,+BAA+B;AAAA,wBAC3C,gBAAgB;AAAA,sBAAA,CACjB;AAAA,sBACD,OAAO,EAAE,eAAe,YAAY;AAAA,sBACpC,OAAAzC;AAAA,sBACA,aAAY;AAAA,sBACZ,UAAAwB;AAAA,oBAAA;AAAA,kBACF;AAAA,gBAAA,GACF;AAAA,cAAA,GACF;AAAA,YAAA;AAAA,UACF;AAAA,gCAEDwB,GAAU,EAAA;AAAA,gCACVC,GAAW,EAAA;AAAA,QAAA,GACd;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;"}
|
|
@@ -33,5 +33,5 @@ Check the top-level render call using <`+t+">.")}return r}}function Ee(e,r){{if(
|
|
|
33
33
|
svg > path {
|
|
34
34
|
fill: #4945ff; /* primary600 */
|
|
35
35
|
}
|
|
36
|
-
`,hr=()=>Z.jsx(mr,{justifyContent:"center",alignItems:"center",width:7,height:6,hasRadius:!0,"aria-hidden":!0,children:Z.jsx(Ce.Icon,{as:fr.Paint})}),Oe="color-picker",x=h=>`${Oe}.${h}`,yr={register(h){h.customFields.register({name:"color",pluginId:"color-picker",type:"string",icon:hr,intlLabel:{id:x("color-picker.label"),defaultMessage:"Color"},intlDescription:{id:x("color-picker.description"),defaultMessage:"Select any color"},components:{Input:async()=>Promise.resolve().then(()=>require("./ColorPickerInput-
|
|
37
|
-
//# sourceMappingURL=index-
|
|
36
|
+
`,hr=()=>Z.jsx(mr,{justifyContent:"center",alignItems:"center",width:7,height:6,hasRadius:!0,"aria-hidden":!0,children:Z.jsx(Ce.Icon,{as:fr.Paint})}),Oe="color-picker",x=h=>`${Oe}.${h}`,yr={register(h){h.customFields.register({name:"color",pluginId:"color-picker",type:"string",icon:hr,intlLabel:{id:x("color-picker.label"),defaultMessage:"Color"},intlDescription:{id:x("color-picker.description"),defaultMessage:"Select any color"},components:{Input:async()=>Promise.resolve().then(()=>require("./ColorPickerInput-1e9c7a15.js")).then(p=>({default:p.ColorPickerInput}))},options:{advanced:[{intlLabel:{id:x("color-picker.options.advanced.regex"),defaultMessage:"RegExp pattern"},name:"regex",type:"text",defaultValue:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",description:{id:x("color-picker.options.advanced.regex.description"),defaultMessage:"The text of the regular expression"}},{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:[{name:"required",type:"checkbox",intlLabel:{id:x("color-picker.options.advanced.requiredField"),defaultMessage:"Required field"},description:{id:x("color-picker.options.advanced.requiredField.description"),defaultMessage:"You won't be able to create an entry if this field is empty"}}]}]}})},async registerTrads({locales:h}){const p=await Promise.all(h.map(g=>vr(Object.assign({"./translations/cs.json":()=>Promise.resolve().then(()=>require("./cs-67f98136.js")),"./translations/en.json":()=>Promise.resolve().then(()=>require("./en-32ea9fdb.js")),"./translations/ru.json":()=>Promise.resolve().then(()=>require("./ru-c5a712be.js")),"./translations/sv.json":()=>Promise.resolve().then(()=>require("./sv-e4ea8db8.js")),"./translations/tr.json":()=>Promise.resolve().then(()=>require("./tr-fb5cfb93.js")),"./translations/zh.json":()=>Promise.resolve().then(()=>require("./zh-b25c84c2.js"))}),`./translations/${g}.json`).then(({default:y})=>({data:cr.prefixPluginTranslations(y,Oe),locale:g})).catch(()=>({data:{},locale:g}))));return Promise.resolve(p)}};exports.getTrad=x;exports.index=yr;exports.jsxRuntimeExports=Z;
|
|
37
|
+
//# sourceMappingURL=index-3cecbc68.js.map
|