@strapi/design-system 1.7.0-alpha.4 → 1.7.0
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/README.md +1 -1
- package/dist/Combobox/Combobox.cjs +1 -0
- package/dist/Combobox/Combobox.js +1 -0
- package/dist/Layout/HeaderLayout.cjs +4 -3
- package/dist/Layout/HeaderLayout.js +31 -31
- package/dist/Popover/Popover.cjs +4 -4
- package/dist/Popover/Popover.js +12 -10
- package/dist/Select/MultiSelect.cjs +4 -4
- package/dist/Select/MultiSelect.js +87 -89
- package/dist/Select/SelectParts.cjs +6 -5
- package/dist/Select/SelectParts.js +16 -14
- package/dist/Select/SingleSelect.cjs +1 -1
- package/dist/Select/SingleSelect.js +64 -64
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ plugins more efficiently.
|
|
|
18
18
|
|
|
19
19
|
## Installation
|
|
20
20
|
|
|
21
|
-
Install Strapi Design System and
|
|
21
|
+
Install Strapi Design System and its peer dependencies:
|
|
22
22
|
|
|
23
23
|
```sh
|
|
24
24
|
$ yarn add react react-dom @strapi/design-system @strapi/icons styled-components react-router-dom
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
padding: ${({theme:e})=>e.spaces[2]} ${({theme:e})=>e.spaces[4]};
|
|
81
81
|
background-color: ${({theme:e})=>e.colors.neutral0};
|
|
82
82
|
border-radius: ${({theme:e})=>e.borderRadius};
|
|
83
|
+
user-select: none;
|
|
83
84
|
|
|
84
85
|
&[data-selected] {
|
|
85
86
|
background-color: ${({theme:e})=>e.colors.primary100};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react"),E=require("prop-types"),v=require("styled-components"),d=require("../Box/Box.cjs"),
|
|
2
|
-
width: ${
|
|
3
|
-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react"),E=require("prop-types"),v=require("styled-components"),d=require("../Box/Box.cjs"),u=require("../Flex/Flex.cjs"),B=require("../hooks/useElementOnScreen.cjs"),b=require("../hooks/useResizeObserver.cjs"),s=require("../Typography/Typography.cjs"),p=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},t=p(c),a=p(E),R=p(v),T=()=>{const e=c.useRef(null),[l,r]=c.useState(null),[n,o]=B.useElementOnScreen({root:null,rootMargin:"0px",threshold:0});return b.useResizeObserver(n,()=>{n.current&&r(n.current.getBoundingClientRect())}),c.useEffect(()=>{e.current&&r(e.current.getBoundingClientRect())},[e]),{containerRef:n,isVisible:o,baseHeaderLayoutRef:e,headerSize:l}},f=e=>{const{containerRef:l,isVisible:r,baseHeaderLayoutRef:n,headerSize:o}=T();return t.default.createElement(t.default.Fragment,null,t.default.createElement("div",{style:{height:o?.height},ref:l},r&&t.default.createElement(i,{ref:n,...e})),!r&&t.default.createElement(i,{...e,sticky:!0,width:o?.width}))};f.displayName="HeaderLayout";const L=R.default(d.Box)`
|
|
2
|
+
width: ${e=>e.width}px;
|
|
3
|
+
z-index: ${({theme:e})=>e.zIndices[1]};
|
|
4
|
+
`,i=t.default.forwardRef(({navigationAction:e,primaryAction:l,secondaryAction:r,subtitle:n,title:o,sticky:m,width:h,...y},x)=>{const g=typeof n=="string";return m?t.default.createElement(L,{paddingLeft:6,paddingRight:6,paddingTop:3,paddingBottom:3,position:"fixed",top:0,right:0,background:"neutral0",shadow:"tableShadow",width:h,"data-strapi-header-sticky":!0},t.default.createElement(u.Flex,{justifyContent:"space-between"},t.default.createElement(u.Flex,null,e&&t.default.createElement(d.Box,{paddingRight:3},e),t.default.createElement(d.Box,null,t.default.createElement(s.Typography,{variant:"beta",as:"h1",...y},o),g?t.default.createElement(s.Typography,{variant:"pi",textColor:"neutral600"},n):n),r?t.default.createElement(d.Box,{paddingLeft:4},r):null),t.default.createElement(u.Flex,null,l?t.default.createElement(d.Box,{paddingLeft:2},l):void 0))):t.default.createElement(d.Box,{ref:x,paddingLeft:10,paddingRight:10,paddingBottom:8,paddingTop:e?6:8,background:"neutral100","data-strapi-header":!0},e?t.default.createElement(d.Box,{paddingBottom:2},e):null,t.default.createElement(u.Flex,{justifyContent:"space-between"},t.default.createElement(u.Flex,{minWidth:0},t.default.createElement(s.Typography,{as:"h1",variant:"alpha",...y},o),r?t.default.createElement(d.Box,{paddingLeft:4},r):null),l),g?t.default.createElement(s.Typography,{variant:"epsilon",textColor:"neutral600",as:"p"},n):n)});i.displayName="BaseHeaderLayout";i.defaultProps={navigationAction:void 0,primaryAction:void 0,secondaryAction:void 0,subtitle:void 0,sticky:!1,width:void 0};i.propTypes={navigationAction:a.default.node,primaryAction:a.default.node,secondaryAction:a.default.node,sticky:a.default.bool,subtitle:a.default.oneOfType([a.default.string,a.default.node]),title:a.default.string.isRequired,width:a.default.number};f.defaultProps={navigationAction:void 0,primaryAction:void 0,secondaryAction:void 0,subtitle:void 0};f.propTypes={navigationAction:a.default.node,primaryAction:a.default.node,secondaryAction:a.default.node,subtitle:a.default.oneOfType([a.default.string,a.default.node]),title:a.default.string.isRequired};exports.BaseHeaderLayout=i;exports.HeaderLayout=f;
|
|
@@ -1,36 +1,37 @@
|
|
|
1
1
|
import e, { useRef as h, useState as E, useEffect as v } from "react";
|
|
2
|
-
import
|
|
2
|
+
import n from "prop-types";
|
|
3
3
|
import R from "styled-components";
|
|
4
|
-
import { Box as
|
|
4
|
+
import { Box as a } from "../Box/Box.js";
|
|
5
5
|
import { Flex as l } from "../Flex/Flex.js";
|
|
6
6
|
import { useElementOnScreen as b } from "../hooks/useElementOnScreen.js";
|
|
7
7
|
import { useResizeObserver as w } from "../hooks/useResizeObserver.js";
|
|
8
8
|
import { Typography as c } from "../Typography/Typography.js";
|
|
9
9
|
const L = () => {
|
|
10
|
-
const
|
|
10
|
+
const t = h(null), [o, i] = E(null), [r, d] = b({
|
|
11
11
|
root: null,
|
|
12
12
|
rootMargin: "0px",
|
|
13
13
|
threshold: 0
|
|
14
14
|
});
|
|
15
15
|
return w(r, () => {
|
|
16
|
-
r.current &&
|
|
16
|
+
r.current && i(r.current.getBoundingClientRect());
|
|
17
17
|
}), v(() => {
|
|
18
|
-
|
|
19
|
-
}, [
|
|
18
|
+
t.current && i(t.current.getBoundingClientRect());
|
|
19
|
+
}, [t]), {
|
|
20
20
|
containerRef: r,
|
|
21
21
|
isVisible: d,
|
|
22
|
-
baseHeaderLayoutRef:
|
|
22
|
+
baseHeaderLayoutRef: t,
|
|
23
23
|
headerSize: o
|
|
24
24
|
};
|
|
25
|
-
}, p = (
|
|
26
|
-
const { containerRef: o, isVisible:
|
|
27
|
-
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { style: { height: d?.height }, ref: o },
|
|
25
|
+
}, p = (t) => {
|
|
26
|
+
const { containerRef: o, isVisible: i, baseHeaderLayoutRef: r, headerSize: d } = L();
|
|
27
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { style: { height: d?.height }, ref: o }, i && /* @__PURE__ */ e.createElement(s, { ref: r, ...t })), !i && /* @__PURE__ */ e.createElement(s, { ...t, sticky: !0, width: d?.width }));
|
|
28
28
|
};
|
|
29
29
|
p.displayName = "HeaderLayout";
|
|
30
|
-
const x = R(
|
|
31
|
-
width: ${(
|
|
30
|
+
const x = R(a)`
|
|
31
|
+
width: ${(t) => t.width}px;
|
|
32
|
+
z-index: ${({ theme: t }) => t.zIndices[1]};
|
|
32
33
|
`, s = e.forwardRef(
|
|
33
|
-
({ navigationAction:
|
|
34
|
+
({ navigationAction: t, primaryAction: o, secondaryAction: i, subtitle: r, title: d, sticky: f, width: g, ...u }, y) => {
|
|
34
35
|
const m = typeof r == "string";
|
|
35
36
|
return f ? /* @__PURE__ */ e.createElement(
|
|
36
37
|
x,
|
|
@@ -45,23 +46,22 @@ const x = R(i)`
|
|
|
45
46
|
background: "neutral0",
|
|
46
47
|
shadow: "tableShadow",
|
|
47
48
|
width: g,
|
|
48
|
-
zIndex: 4,
|
|
49
49
|
"data-strapi-header-sticky": !0
|
|
50
50
|
},
|
|
51
|
-
/* @__PURE__ */ e.createElement(l, { justifyContent: "space-between" }, /* @__PURE__ */ e.createElement(l, null,
|
|
51
|
+
/* @__PURE__ */ e.createElement(l, { justifyContent: "space-between" }, /* @__PURE__ */ e.createElement(l, null, t && /* @__PURE__ */ e.createElement(a, { paddingRight: 3 }, t), /* @__PURE__ */ e.createElement(a, null, /* @__PURE__ */ e.createElement(c, { variant: "beta", as: "h1", ...u }, d), m ? /* @__PURE__ */ e.createElement(c, { variant: "pi", textColor: "neutral600" }, r) : r), i ? /* @__PURE__ */ e.createElement(a, { paddingLeft: 4 }, i) : null), /* @__PURE__ */ e.createElement(l, null, o ? /* @__PURE__ */ e.createElement(a, { paddingLeft: 2 }, o) : void 0))
|
|
52
52
|
) : /* @__PURE__ */ e.createElement(
|
|
53
|
-
|
|
53
|
+
a,
|
|
54
54
|
{
|
|
55
55
|
ref: y,
|
|
56
56
|
paddingLeft: 10,
|
|
57
57
|
paddingRight: 10,
|
|
58
58
|
paddingBottom: 8,
|
|
59
|
-
paddingTop:
|
|
59
|
+
paddingTop: t ? 6 : 8,
|
|
60
60
|
background: "neutral100",
|
|
61
61
|
"data-strapi-header": !0
|
|
62
62
|
},
|
|
63
|
-
|
|
64
|
-
/* @__PURE__ */ e.createElement(l, { justifyContent: "space-between" }, /* @__PURE__ */ e.createElement(l, { minWidth: 0 }, /* @__PURE__ */ e.createElement(c, { as: "h1", variant: "alpha", ...u }, d),
|
|
63
|
+
t ? /* @__PURE__ */ e.createElement(a, { paddingBottom: 2 }, t) : null,
|
|
64
|
+
/* @__PURE__ */ e.createElement(l, { justifyContent: "space-between" }, /* @__PURE__ */ e.createElement(l, { minWidth: 0 }, /* @__PURE__ */ e.createElement(c, { as: "h1", variant: "alpha", ...u }, d), i ? /* @__PURE__ */ e.createElement(a, { paddingLeft: 4 }, i) : null), o),
|
|
65
65
|
m ? /* @__PURE__ */ e.createElement(c, { variant: "epsilon", textColor: "neutral600", as: "p" }, r) : r
|
|
66
66
|
);
|
|
67
67
|
}
|
|
@@ -76,13 +76,13 @@ s.defaultProps = {
|
|
|
76
76
|
width: void 0
|
|
77
77
|
};
|
|
78
78
|
s.propTypes = {
|
|
79
|
-
navigationAction:
|
|
80
|
-
primaryAction:
|
|
81
|
-
secondaryAction:
|
|
82
|
-
sticky:
|
|
83
|
-
subtitle:
|
|
84
|
-
title:
|
|
85
|
-
width:
|
|
79
|
+
navigationAction: n.node,
|
|
80
|
+
primaryAction: n.node,
|
|
81
|
+
secondaryAction: n.node,
|
|
82
|
+
sticky: n.bool,
|
|
83
|
+
subtitle: n.oneOfType([n.string, n.node]),
|
|
84
|
+
title: n.string.isRequired,
|
|
85
|
+
width: n.number
|
|
86
86
|
};
|
|
87
87
|
p.defaultProps = {
|
|
88
88
|
navigationAction: void 0,
|
|
@@ -91,11 +91,11 @@ p.defaultProps = {
|
|
|
91
91
|
subtitle: void 0
|
|
92
92
|
};
|
|
93
93
|
p.propTypes = {
|
|
94
|
-
navigationAction:
|
|
95
|
-
primaryAction:
|
|
96
|
-
secondaryAction:
|
|
97
|
-
subtitle:
|
|
98
|
-
title:
|
|
94
|
+
navigationAction: n.node,
|
|
95
|
+
primaryAction: n.node,
|
|
96
|
+
secondaryAction: n.node,
|
|
97
|
+
subtitle: n.oneOfType([n.string, n.node]),
|
|
98
|
+
title: n.string.isRequired
|
|
99
99
|
};
|
|
100
100
|
export {
|
|
101
101
|
s as BaseHeaderLayout,
|
package/dist/Popover/Popover.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),w=require("react"),a=require("@floating-ui/react-dom"),y=require("styled-components"),u=require("../Box/Box.cjs"),k=require("../hooks/useIntersection.cjs"),_=require("../Portal/Portal.cjs"),v=e=>e&&typeof e=="object"&&"default"in e?e:{default:e};function S(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),w=require("react"),a=require("@floating-ui/react-dom"),y=require("styled-components"),u=require("../Box/Box.cjs"),k=require("../hooks/useIntersection.cjs"),_=require("../Portal/Portal.cjs"),v=e=>e&&typeof e=="object"&&"default"in e?e:{default:e};function S(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const i=S(w),f=v(y),O=["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"],$=f.default(u.Box)`
|
|
2
2
|
box-shadow: ${({theme:e})=>e.shadows.filterShadow};
|
|
3
|
-
z-index:
|
|
3
|
+
z-index: ${({theme:e})=>e.zIndices[0]};
|
|
4
4
|
border: 1px solid ${({theme:e})=>e.colors.neutral150};
|
|
5
5
|
background: ${({theme:e})=>e.colors.neutral0};
|
|
6
|
-
`,p=({source:e,children:t,spacing:o=0,fullWidth:r=!1,placement:s="bottom-start",centered:
|
|
6
|
+
`,p=({source:e,children:t,spacing:o=0,fullWidth:r=!1,placement:s="bottom-start",centered:l=!1,...c})=>{const[h,g]=i.useState(void 0),{x:m,y:x,reference:d,floating:j,strategy:P}=a.useFloating({strategy:"fixed",placement:l?"bottom":s,middleware:[a.offset({mainAxis:o}),a.shift(),a.flip()],whileElementsMounted:a.autoUpdate});return i.useLayoutEffect(()=>{d(e.current)},[e,d]),i.useLayoutEffect(()=>{r&&g(e.current.offsetWidth)},[r,e]),n.jsx($,{ref:j,style:{left:m,top:x,position:P,width:h||void 0},hasRadius:!0,background:"neutral0",padding:1,...c,children:t})},b=({children:e,intersectionId:t,onReachEnd:o,...r})=>{const s=i.useRef(null);return k.useIntersection(s,o??(()=>{}),{selectorToWatch:`#${t}`,skipWhen:!t||!o}),n.jsxs(q,{ref:s,...r,children:[e,t&&o&&n.jsx(u.Box,{id:t,width:"100%",height:"1px"})]})},q=f.default(u.Box)`
|
|
7
7
|
// 16 is base base size, 3 is the factor to get closer to 40px and 5 is the number of elements visible in the list
|
|
8
8
|
max-height: ${3*5}rem;
|
|
9
9
|
overflow-y: auto;
|
|
@@ -23,4 +23,4 @@
|
|
|
23
23
|
border-radius: ${({theme:e})=>e.borderRadius};
|
|
24
24
|
margin-right: 10px;
|
|
25
25
|
}
|
|
26
|
-
`,E=({children:e,source:t,spacing:o,fullWidth:r,placement:s,centered:
|
|
26
|
+
`,E=({children:e,source:t,spacing:o,fullWidth:r,placement:s,centered:l,...c})=>n.jsx(_.Portal,{children:n.jsx(p,{source:t,spacing:o,fullWidth:r,placement:s,centered:l,children:n.jsx(b,{...c,children:e})})});exports.Content=p;exports.POPOVER_PLACEMENTS=O;exports.Popover=E;exports.Scrolling=b;
|
package/dist/Popover/Popover.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { jsx as i, jsxs as x } from "react/jsx-runtime";
|
|
2
2
|
import * as a from "react";
|
|
3
|
-
import { useFloating as w, offset as k, shift as
|
|
4
|
-
import
|
|
3
|
+
import { useFloating as w, offset as k, shift as $, flip as y, autoUpdate as v } from "@floating-ui/react-dom";
|
|
4
|
+
import f from "styled-components";
|
|
5
5
|
import { Box as d } from "../Box/Box.js";
|
|
6
6
|
import { useIntersection as P } from "../hooks/useIntersection.js";
|
|
7
7
|
import { Portal as S } from "../Portal/Portal.js";
|
|
8
|
-
const T = ["top", "top-start", "top-end", "right", "right-start", "right-end", "bottom", "bottom-start", "bottom-end", "left", "left-start", "left-end"], W =
|
|
8
|
+
const T = ["top", "top-start", "top-end", "right", "right-start", "right-end", "bottom", "bottom-start", "bottom-end", "left", "left-start", "left-end"], W = f(d)`
|
|
9
9
|
box-shadow: ${({
|
|
10
10
|
theme: t
|
|
11
11
|
}) => t.shadows.filterShadow};
|
|
12
|
-
z-index:
|
|
12
|
+
z-index: ${({
|
|
13
|
+
theme: t
|
|
14
|
+
}) => t.zIndices[0]};
|
|
13
15
|
border: 1px solid ${({
|
|
14
16
|
theme: t
|
|
15
17
|
}) => t.colors.neutral150};
|
|
@@ -28,7 +30,7 @@ const T = ["top", "top-start", "top-end", "right", "right-start", "right-end", "
|
|
|
28
30
|
const [p, u] = a.useState(void 0), {
|
|
29
31
|
x: h,
|
|
30
32
|
y: m,
|
|
31
|
-
reference:
|
|
33
|
+
reference: c,
|
|
32
34
|
floating: b,
|
|
33
35
|
strategy: g
|
|
34
36
|
} = w({
|
|
@@ -36,12 +38,12 @@ const T = ["top", "top-start", "top-end", "right", "right-start", "right-end", "
|
|
|
36
38
|
placement: n ? "bottom" : s,
|
|
37
39
|
middleware: [k({
|
|
38
40
|
mainAxis: o
|
|
39
|
-
}),
|
|
41
|
+
}), $(), y()],
|
|
40
42
|
whileElementsMounted: v
|
|
41
43
|
});
|
|
42
44
|
return a.useLayoutEffect(() => {
|
|
43
|
-
|
|
44
|
-
}, [t,
|
|
45
|
+
c(t.current);
|
|
46
|
+
}, [t, c]), a.useLayoutEffect(() => {
|
|
45
47
|
r && u(t.current.offsetWidth);
|
|
46
48
|
}, [r, t]), i(W, {
|
|
47
49
|
ref: b,
|
|
@@ -68,7 +70,7 @@ const T = ["top", "top-start", "top-end", "right", "right-start", "right-end", "
|
|
|
68
70
|
}), {
|
|
69
71
|
selectorToWatch: `#${e}`,
|
|
70
72
|
skipWhen: !e || !o
|
|
71
|
-
}), x(
|
|
73
|
+
}), x(z, {
|
|
72
74
|
ref: s,
|
|
73
75
|
...r,
|
|
74
76
|
children: [t, e && o && i(d, {
|
|
@@ -77,7 +79,7 @@ const T = ["top", "top-start", "top-end", "right", "right-start", "right-end", "
|
|
|
77
79
|
height: "1px"
|
|
78
80
|
})]
|
|
79
81
|
});
|
|
80
|
-
},
|
|
82
|
+
}, z = f(d)`
|
|
81
83
|
// 16 is base base size, 3 is the factor to get closer to 40px and 5 is the number of elements visible in the list
|
|
82
84
|
max-height: ${3 * 5}rem;
|
|
83
85
|
overflow-y: auto;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),N=require("react"),X=require("@strapi/icons"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),N=require("react"),X=require("@strapi/icons"),y=require("styled-components"),s=require("./SelectParts.cjs"),Y=require("../BaseCheckbox/assets/checkmark.cjs"),g=require("../Box/Box.cjs"),J=require("../Field/Field.cjs"),K=require("../Field/FieldLabel.cjs");require("../Field/FieldInput.cjs");const Q=require("../Field/FieldHint.cjs"),U=require("../Field/FieldError.cjs");require("../Field/FieldContext.cjs");require("../Field/FieldAction.cjs");const Z=require("../Flex/Flex.cjs"),ee=require("../hooks/useId.cjs"),te=require("../hooks/useIntersection.cjs"),re=require("../Tag/Tag.cjs"),C=require("../Typography/Typography.cjs"),ne=e=>e&&typeof e=="object"&&"default"in e?e:{default:e};function ie(e){if(e&&e.__esModule)return e;const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return n.default=e,Object.freeze(n)}const a=ie(N),se=ne(y),oe=({children:e,clearLabel:n="Clear",customizeContent:r,disabled:o,error:l,hint:d,id:u,label:p,labelAction:O,onChange:x,onClear:M,onReachEnd:b,placeholder:R,required:I,selectButtonTitle:ae,startIcon:v,size:B="M",value:f,withTags:m,..._})=>{const q=a.useRef(null),[k,T]=a.useState(),[L,P]=a.useState(!1),h=ee.useId(u),E=`${h}-hint`,V=`${h}-error`,z=i=>{x?x(i):T(i)},A=i=>()=>{const j=Array.isArray(f)?f.filter(F=>F!==i):(k??[]).filter(F=>F!==i);x?x(j):T(j)},G=i=>{P(i)},S=a.useRef(null),H=()=>{S.current.focus()},$=`intersection-${h}`,D=i=>{b&&b(i)};te.useIntersection(q,D,{selectorToWatch:`#${$}`,skipWhen:!L});const c=typeof f<"u"?f:k,W=({value:i,textValue:j})=>t.jsx(re.Tag,{tabIndex:-1,disabled:o,icon:t.jsx(X.Cross,{}),onClick:A(i),children:j},i);return t.jsx(J.Field,{hint:d,error:l,id:h,required:I,children:t.jsxs(Z.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[t.jsx(K.FieldLabel,{onClick:H,action:O,children:p}),t.jsxs(s.Root,{onOpenChange:G,disabled:o,required:I,onValueChange:z,value:c,..._,multi:!0,children:[t.jsx(s.Trigger,{ref:S,"aria-label":p,"aria-describedby":`${E} ${V}`,id:h,startIcon:v,size:B,hasError:Boolean(l),disabled:o,clearLabel:n,onClear:c?.length?M:void 0,paddingLeft:m&&c?.length?1:3,children:t.jsx(s.Value,{placeholder:R,textColor:c?.length?"neutral800":"neutral600",children:c?.length?m?W:r?r(c):void 0:void 0})}),t.jsx(s.Portal,{children:t.jsx(s.Content,{position:"popper",sideOffset:4,children:t.jsxs(s.Viewport,{ref:q,children:[e,t.jsx(g.Box,{id:$,width:"100%",height:"1px"})]})})})]}),t.jsx(Q.FieldHint,{}),t.jsx(U.FieldError,{})]})})},le=a.forwardRef(({value:e,children:n,startIcon:r,...o},l)=>t.jsxs(s.Item,{ref:l,value:e.toString(),...o,children:[r&&t.jsx(g.Box,{as:"span","aria-hidden":!0,children:r}),t.jsx(s.ItemIndicator,{children:({isSelected:d,isIntermediate:u})=>t.jsx(w,{hasRadius:!0,overflow:"hidden",position:"relative",$indeterminate:u,$selected:d,zIndex:1,height:"18px",width:"18px"})}),t.jsx(C.Typography,{textColor:"neutral800",children:t.jsx(s.ItemText,{children:n})})]})),w=se.default(g.Box)`
|
|
2
2
|
border: 1px solid
|
|
3
3
|
${({theme:e,$selected:n,$indeterminate:r})=>n||r?e.colors.primary600:e.colors.neutral300};
|
|
4
4
|
background-color: ${({theme:e,$selected:n,$indeterminate:r})=>n||r?e.colors.primary600:e.colors.neutral0};
|
|
5
5
|
|
|
6
|
-
${({theme:e,$indeterminate:n})=>n&&
|
|
6
|
+
${({theme:e,$indeterminate:n})=>n&&y.css`
|
|
7
7
|
&::after {
|
|
8
8
|
content: '';
|
|
9
9
|
display: block;
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
}
|
|
19
19
|
`}
|
|
20
20
|
|
|
21
|
-
${({$selected:e})=>e&&
|
|
21
|
+
${({$selected:e})=>e&&y.css`
|
|
22
22
|
&::after {
|
|
23
23
|
content: '';
|
|
24
24
|
background: url(${Y}) no-repeat no-repeat center center;
|
|
@@ -27,4 +27,4 @@
|
|
|
27
27
|
position: absolute;
|
|
28
28
|
}
|
|
29
29
|
`}
|
|
30
|
-
`,ce=a.forwardRef(({children:e,label:n,startIcon:r,values:
|
|
30
|
+
`,ce=a.forwardRef(({children:e,label:n,startIcon:r,values:o=[],...l},d)=>t.jsxs(s.Group,{ref:d,children:[t.jsxs(s.Item,{value:o,...l,children:[r&&t.jsx(g.Box,{as:"span","aria-hidden":!0,children:r}),t.jsx(s.ItemIndicator,{children:({isSelected:u,isIntermediate:p})=>t.jsx(w,{hasRadius:!0,overflow:"hidden",position:"relative",$indeterminate:p,$selected:u,zIndex:1,height:"18px",width:"18px"})}),t.jsx(C.Typography,{textColor:"neutral800",children:n})]}),e]}));exports.MultiSelect=oe;exports.MultiSelectGroup=ce;exports.MultiSelectOption=le;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { Cross as
|
|
4
|
-
import
|
|
5
|
-
import { Item as S, ItemIndicator as F, ItemText as
|
|
1
|
+
import { jsxs as c, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import * as d from "react";
|
|
3
|
+
import { Cross as D } from "@strapi/icons";
|
|
4
|
+
import J, { css as T } from "styled-components";
|
|
5
|
+
import { Item as S, ItemIndicator as F, ItemText as K, Group as N, Root as Q, Trigger as U, Value as Z, Portal as ee, Content as re, Viewport as te } from "./SelectParts.js";
|
|
6
6
|
import ne from "../BaseCheckbox/assets/checkmark.js";
|
|
7
|
-
import { Box as
|
|
7
|
+
import { Box as x } from "../Box/Box.js";
|
|
8
8
|
import { Field as oe } from "../Field/Field.js";
|
|
9
9
|
import { FieldLabel as ie } from "../Field/FieldLabel.js";
|
|
10
10
|
import "../Field/FieldInput.js";
|
|
@@ -12,104 +12,104 @@ import { FieldHint as le } from "../Field/FieldHint.js";
|
|
|
12
12
|
import { FieldError as ae } from "../Field/FieldError.js";
|
|
13
13
|
import "../Field/FieldContext.js";
|
|
14
14
|
import "../Field/FieldAction.js";
|
|
15
|
-
import { Flex as
|
|
16
|
-
import { useId as
|
|
15
|
+
import { Flex as de } from "../Flex/Flex.js";
|
|
16
|
+
import { useId as ce } from "../hooks/useId.js";
|
|
17
17
|
import { useIntersection as se } from "../hooks/useIntersection.js";
|
|
18
18
|
import { Tag as he } from "../Tag/Tag.js";
|
|
19
|
-
import { Typography as
|
|
19
|
+
import { Typography as O } from "../Typography/Typography.js";
|
|
20
20
|
const Be = ({
|
|
21
21
|
children: r,
|
|
22
|
-
clearLabel:
|
|
23
|
-
customizeContent:
|
|
22
|
+
clearLabel: o = "Clear",
|
|
23
|
+
customizeContent: t,
|
|
24
24
|
disabled: i,
|
|
25
25
|
error: l,
|
|
26
26
|
hint: s,
|
|
27
27
|
id: h,
|
|
28
28
|
label: u,
|
|
29
|
-
labelAction:
|
|
29
|
+
labelAction: B,
|
|
30
30
|
onChange: f,
|
|
31
|
-
onClear:
|
|
32
|
-
onReachEnd:
|
|
33
|
-
placeholder:
|
|
34
|
-
required:
|
|
31
|
+
onClear: L,
|
|
32
|
+
onReachEnd: $,
|
|
33
|
+
placeholder: V,
|
|
34
|
+
required: b,
|
|
35
35
|
selectButtonTitle: pe,
|
|
36
|
-
startIcon:
|
|
37
|
-
size:
|
|
36
|
+
startIcon: E,
|
|
37
|
+
size: j = "M",
|
|
38
38
|
value: m,
|
|
39
|
-
withTags:
|
|
40
|
-
...
|
|
39
|
+
withTags: k,
|
|
40
|
+
...z
|
|
41
41
|
}) => {
|
|
42
|
-
const
|
|
43
|
-
f ? f(
|
|
44
|
-
},
|
|
45
|
-
const
|
|
46
|
-
f ? f(
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
}, y =
|
|
42
|
+
const w = d.useRef(null), [C, R] = d.useState(), [A, G] = d.useState(!1), p = ce(h), W = `${p}-hint`, q = `${p}-error`, H = (n) => {
|
|
43
|
+
f ? f(n) : R(n);
|
|
44
|
+
}, P = (n) => () => {
|
|
45
|
+
const g = Array.isArray(m) ? m.filter((I) => I !== n) : (C ?? []).filter((I) => I !== n);
|
|
46
|
+
f ? f(g) : R(g);
|
|
47
|
+
}, X = (n) => {
|
|
48
|
+
G(n);
|
|
49
|
+
}, y = d.useRef(null), Y = () => {
|
|
50
50
|
y.current.focus();
|
|
51
51
|
}, v = `intersection-${p}`;
|
|
52
|
-
se(
|
|
53
|
-
|
|
52
|
+
se(w, (n) => {
|
|
53
|
+
$ && $(n);
|
|
54
54
|
}, {
|
|
55
55
|
selectorToWatch: `#${v}`,
|
|
56
|
-
skipWhen: !
|
|
56
|
+
skipWhen: !A
|
|
57
57
|
});
|
|
58
|
-
const a = typeof m < "u" ? m :
|
|
59
|
-
value:
|
|
60
|
-
textValue:
|
|
58
|
+
const a = typeof m < "u" ? m : C, _ = ({
|
|
59
|
+
value: n,
|
|
60
|
+
textValue: g
|
|
61
61
|
}) => e(he, {
|
|
62
62
|
tabIndex: -1,
|
|
63
63
|
disabled: i,
|
|
64
|
-
icon: e(
|
|
65
|
-
onClick:
|
|
66
|
-
children:
|
|
67
|
-
},
|
|
64
|
+
icon: e(D, {}),
|
|
65
|
+
onClick: P(n),
|
|
66
|
+
children: g
|
|
67
|
+
}, n);
|
|
68
68
|
return e(oe, {
|
|
69
69
|
hint: s,
|
|
70
70
|
error: l,
|
|
71
71
|
id: p,
|
|
72
|
-
required:
|
|
73
|
-
children:
|
|
72
|
+
required: b,
|
|
73
|
+
children: c(de, {
|
|
74
74
|
direction: "column",
|
|
75
75
|
alignItems: "stretch",
|
|
76
76
|
gap: 1,
|
|
77
77
|
children: [e(ie, {
|
|
78
|
-
onClick:
|
|
79
|
-
action:
|
|
78
|
+
onClick: Y,
|
|
79
|
+
action: B,
|
|
80
80
|
children: u
|
|
81
|
-
}),
|
|
82
|
-
onOpenChange:
|
|
81
|
+
}), c(Q, {
|
|
82
|
+
onOpenChange: X,
|
|
83
83
|
disabled: i,
|
|
84
|
-
required:
|
|
85
|
-
onValueChange:
|
|
84
|
+
required: b,
|
|
85
|
+
onValueChange: H,
|
|
86
86
|
value: a,
|
|
87
|
-
...
|
|
87
|
+
...z,
|
|
88
88
|
multi: !0,
|
|
89
89
|
children: [e(U, {
|
|
90
90
|
ref: y,
|
|
91
91
|
"aria-label": u,
|
|
92
|
-
"aria-describedby": `${
|
|
92
|
+
"aria-describedby": `${W} ${q}`,
|
|
93
93
|
id: p,
|
|
94
|
-
startIcon:
|
|
95
|
-
size:
|
|
94
|
+
startIcon: E,
|
|
95
|
+
size: j,
|
|
96
96
|
hasError: Boolean(l),
|
|
97
97
|
disabled: i,
|
|
98
|
-
clearLabel:
|
|
99
|
-
onClear: a?.length ?
|
|
100
|
-
paddingLeft:
|
|
98
|
+
clearLabel: o,
|
|
99
|
+
onClear: a?.length ? L : void 0,
|
|
100
|
+
paddingLeft: k && a?.length ? 1 : 3,
|
|
101
101
|
children: e(Z, {
|
|
102
|
-
placeholder:
|
|
102
|
+
placeholder: V,
|
|
103
103
|
textColor: a?.length ? "neutral800" : "neutral600",
|
|
104
|
-
children: a?.length ?
|
|
104
|
+
children: a?.length ? k ? _ : t ? t(a) : void 0 : void 0
|
|
105
105
|
})
|
|
106
106
|
}), e(ee, {
|
|
107
107
|
children: e(re, {
|
|
108
108
|
position: "popper",
|
|
109
109
|
sideOffset: 4,
|
|
110
|
-
children:
|
|
111
|
-
ref:
|
|
112
|
-
children: [r, e(
|
|
110
|
+
children: c(te, {
|
|
111
|
+
ref: w,
|
|
112
|
+
children: [r, e(x, {
|
|
113
113
|
id: v,
|
|
114
114
|
width: "100%",
|
|
115
115
|
height: "1px"
|
|
@@ -120,24 +120,24 @@ const Be = ({
|
|
|
120
120
|
}), e(le, {}), e(ae, {})]
|
|
121
121
|
})
|
|
122
122
|
});
|
|
123
|
-
}, Le =
|
|
123
|
+
}, Le = d.forwardRef(({
|
|
124
124
|
value: r,
|
|
125
|
-
children:
|
|
126
|
-
startIcon:
|
|
125
|
+
children: o,
|
|
126
|
+
startIcon: t,
|
|
127
127
|
...i
|
|
128
|
-
}, l) =>
|
|
128
|
+
}, l) => c(S, {
|
|
129
129
|
ref: l,
|
|
130
130
|
value: r.toString(),
|
|
131
131
|
...i,
|
|
132
|
-
children: [
|
|
132
|
+
children: [t && e(x, {
|
|
133
133
|
as: "span",
|
|
134
134
|
"aria-hidden": !0,
|
|
135
|
-
children:
|
|
135
|
+
children: t
|
|
136
136
|
}), e(F, {
|
|
137
137
|
children: ({
|
|
138
138
|
isSelected: s,
|
|
139
139
|
isIntermediate: h
|
|
140
|
-
}) => e(
|
|
140
|
+
}) => e(M, {
|
|
141
141
|
hasRadius: !0,
|
|
142
142
|
overflow: "hidden",
|
|
143
143
|
position: "relative",
|
|
@@ -147,29 +147,29 @@ const Be = ({
|
|
|
147
147
|
height: "18px",
|
|
148
148
|
width: "18px"
|
|
149
149
|
})
|
|
150
|
-
}), e(
|
|
150
|
+
}), e(O, {
|
|
151
151
|
textColor: "neutral800",
|
|
152
|
-
children: e(
|
|
153
|
-
children:
|
|
152
|
+
children: e(K, {
|
|
153
|
+
children: o
|
|
154
154
|
})
|
|
155
155
|
})]
|
|
156
|
-
})),
|
|
156
|
+
})), M = J(x)`
|
|
157
157
|
border: 1px solid
|
|
158
158
|
${({
|
|
159
159
|
theme: r,
|
|
160
|
-
$selected:
|
|
161
|
-
$indeterminate:
|
|
162
|
-
}) =>
|
|
160
|
+
$selected: o,
|
|
161
|
+
$indeterminate: t
|
|
162
|
+
}) => o || t ? r.colors.primary600 : r.colors.neutral300};
|
|
163
163
|
background-color: ${({
|
|
164
164
|
theme: r,
|
|
165
|
-
$selected:
|
|
166
|
-
$indeterminate:
|
|
167
|
-
}) =>
|
|
165
|
+
$selected: o,
|
|
166
|
+
$indeterminate: t
|
|
167
|
+
}) => o || t ? r.colors.primary600 : r.colors.neutral0};
|
|
168
168
|
|
|
169
169
|
${({
|
|
170
170
|
theme: r,
|
|
171
|
-
$indeterminate:
|
|
172
|
-
}) =>
|
|
171
|
+
$indeterminate: o
|
|
172
|
+
}) => o && T`
|
|
173
173
|
&::after {
|
|
174
174
|
content: '';
|
|
175
175
|
display: block;
|
|
@@ -195,26 +195,26 @@ const Be = ({
|
|
|
195
195
|
position: absolute;
|
|
196
196
|
}
|
|
197
197
|
`}
|
|
198
|
-
`, Ve =
|
|
198
|
+
`, Ve = d.forwardRef(({
|
|
199
199
|
children: r,
|
|
200
|
-
label:
|
|
201
|
-
startIcon:
|
|
200
|
+
label: o,
|
|
201
|
+
startIcon: t,
|
|
202
202
|
values: i = [],
|
|
203
203
|
...l
|
|
204
|
-
}, s) =>
|
|
204
|
+
}, s) => c(N, {
|
|
205
205
|
ref: s,
|
|
206
|
-
children: [
|
|
206
|
+
children: [c(S, {
|
|
207
207
|
value: i,
|
|
208
208
|
...l,
|
|
209
|
-
children: [
|
|
209
|
+
children: [t && e(x, {
|
|
210
210
|
as: "span",
|
|
211
211
|
"aria-hidden": !0,
|
|
212
|
-
children:
|
|
212
|
+
children: t
|
|
213
213
|
}), e(F, {
|
|
214
214
|
children: ({
|
|
215
215
|
isSelected: h,
|
|
216
216
|
isIntermediate: u
|
|
217
|
-
}) => e(
|
|
217
|
+
}) => e(M, {
|
|
218
218
|
hasRadius: !0,
|
|
219
219
|
overflow: "hidden",
|
|
220
220
|
position: "relative",
|
|
@@ -224,11 +224,9 @@ const Be = ({
|
|
|
224
224
|
height: "18px",
|
|
225
225
|
width: "18px"
|
|
226
226
|
})
|
|
227
|
-
}), e(
|
|
227
|
+
}), e(O, {
|
|
228
228
|
textColor: "neutral800",
|
|
229
|
-
children:
|
|
230
|
-
children: n
|
|
231
|
-
})
|
|
229
|
+
children: o
|
|
232
230
|
})]
|
|
233
231
|
}), r]
|
|
234
232
|
}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),w=require("react"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),w=require("react"),u=require("@strapi/icons"),o=require("@strapi/ui-primitives"),p=require("styled-components"),h=require("../Box/Box.cjs"),l=require("../Flex/Flex.cjs"),R=require("../hooks/useComposeRefs.cjs");require("../themes/lightTheme/index.cjs");require("../themes/darkTheme/index.cjs");require("lodash");const d=require("../themes/utils.cjs"),f=require("../Typography/Typography.cjs"),I=e=>e&&typeof e=="object"&&"default"in e?e:{default:e};function T(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const c=T(w),i=I(p),q=c.forwardRef(({onClear:e,clearLabel:t="Clear",startIcon:s,disabled:n,hasError:g,size:m="M",children:x,...b},y)=>{const a=c.useRef(null),$=j=>{e&&!n&&(e(j),a.current.focus())},S=R.useComposedRefs(a,y);return r.jsx(o.Select.Trigger,{asChild:!0,children:r.jsxs(C,{"aria-disabled":n,$hasError:g,$size:m,ref:S,alignItems:"center",justifyContent:"space-between",position:"relative",overflow:"hidden",hasRadius:!0,background:n?"neutral150":"neutral0",paddingLeft:3,paddingRight:3,gap:4,cursor:"default",...b,children:[r.jsxs(l.Flex,{as:"span",gap:4,children:[s&&r.jsx(h.Box,{as:"span","aria-hidden":!0,children:s}),x]}),r.jsxs(l.Flex,{as:"span",gap:3,children:[e?r.jsx(v,{as:"button",hasRadius:!0,background:"transparent",role:"button",tabIndex:0,onClick:$,"aria-disabled":n,"aria-label":t,title:t,cursor:"pointer",children:r.jsx(u.Cross,{})}):null,r.jsx(k,{children:r.jsx(u.CarretDown,{})})]})]})})}),v=i.default(h.Box)`
|
|
2
2
|
border: none;
|
|
3
3
|
|
|
4
4
|
svg {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
}
|
|
12
12
|
`,C=i.default(l.Flex)`
|
|
13
13
|
border: 1px solid ${({theme:e,$hasError:t})=>t?e.colors.danger600:e.colors.neutral200};
|
|
14
|
-
min-height: ${({theme:e,$size:t})=>
|
|
14
|
+
min-height: ${({theme:e,$size:t})=>d.getThemeSize("input")({theme:e,size:t})};
|
|
15
15
|
|
|
16
16
|
&[aria-disabled='true'] {
|
|
17
17
|
color: ${e=>e.theme.colors.neutral600};
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
outline: none;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
${({theme:e,$hasError:t})=>
|
|
25
|
+
${({theme:e,$hasError:t})=>d.inputFocusStyle()({theme:e,hasError:t})};
|
|
26
26
|
`,k=i.default(o.Select.Icon)`
|
|
27
27
|
& > svg {
|
|
28
28
|
width: ${6/16}rem;
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
fill: ${({theme:e})=>e.colors.neutral600};
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
`,_=c.forwardRef(({children:e,placeholder:t,...s},n)=>r.jsx(
|
|
34
|
+
`,_=c.forwardRef(({children:e,placeholder:t,...s},n)=>r.jsx(f.Typography,{ref:n,ellipsis:!0,...s,children:r.jsx(V,{placeholder:t,children:e})})),V=i.default(o.Select.Value)`
|
|
35
35
|
display: flex;
|
|
36
36
|
gap: ${({theme:e})=>e.spaces[1]};
|
|
37
37
|
flex-wrap: wrap;
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
align-items: center;
|
|
60
60
|
gap: ${({theme:e})=>e.spaces[2]};
|
|
61
61
|
white-space: nowrap;
|
|
62
|
+
user-select: none;
|
|
62
63
|
|
|
63
64
|
&:focus-visible {
|
|
64
65
|
outline: none;
|
|
@@ -72,7 +73,7 @@
|
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
&[data-state='checked'] {
|
|
75
|
-
${
|
|
76
|
+
${f.Typography} {
|
|
76
77
|
font-weight: bold;
|
|
77
78
|
color: ${({theme:e})=>e.colors.primary600};
|
|
78
79
|
}
|
|
@@ -14,20 +14,20 @@ import { Typography as u } from "../Typography/Typography.js";
|
|
|
14
14
|
const v = a.forwardRef(({
|
|
15
15
|
onClear: e,
|
|
16
16
|
clearLabel: r = "Clear",
|
|
17
|
-
startIcon:
|
|
18
|
-
disabled:
|
|
17
|
+
startIcon: i,
|
|
18
|
+
disabled: n,
|
|
19
19
|
hasError: m,
|
|
20
20
|
size: h = "M",
|
|
21
21
|
children: f,
|
|
22
22
|
...g
|
|
23
23
|
}, $) => {
|
|
24
24
|
const d = a.useRef(null), w = (x) => {
|
|
25
|
-
e && !
|
|
25
|
+
e && !n && (e(x), d.current.focus());
|
|
26
26
|
}, b = S(d, $);
|
|
27
27
|
return t(o.Trigger, {
|
|
28
28
|
asChild: !0,
|
|
29
29
|
children: l(V, {
|
|
30
|
-
"aria-disabled":
|
|
30
|
+
"aria-disabled": n,
|
|
31
31
|
$hasError: m,
|
|
32
32
|
$size: h,
|
|
33
33
|
ref: b,
|
|
@@ -36,18 +36,19 @@ const v = a.forwardRef(({
|
|
|
36
36
|
position: "relative",
|
|
37
37
|
overflow: "hidden",
|
|
38
38
|
hasRadius: !0,
|
|
39
|
-
background:
|
|
39
|
+
background: n ? "neutral150" : "neutral0",
|
|
40
40
|
paddingLeft: 3,
|
|
41
41
|
paddingRight: 3,
|
|
42
42
|
gap: 4,
|
|
43
|
+
cursor: "default",
|
|
43
44
|
...g,
|
|
44
45
|
children: [l(c, {
|
|
45
46
|
as: "span",
|
|
46
47
|
gap: 4,
|
|
47
|
-
children: [
|
|
48
|
+
children: [i && t(p, {
|
|
48
49
|
as: "span",
|
|
49
50
|
"aria-hidden": !0,
|
|
50
|
-
children:
|
|
51
|
+
children: i
|
|
51
52
|
}), f]
|
|
52
53
|
}), l(c, {
|
|
53
54
|
as: "span",
|
|
@@ -59,7 +60,7 @@ const v = a.forwardRef(({
|
|
|
59
60
|
role: "button",
|
|
60
61
|
tabIndex: 0,
|
|
61
62
|
onClick: w,
|
|
62
|
-
"aria-disabled":
|
|
63
|
+
"aria-disabled": n,
|
|
63
64
|
"aria-label": r,
|
|
64
65
|
title: r,
|
|
65
66
|
cursor: "pointer",
|
|
@@ -125,11 +126,11 @@ const v = a.forwardRef(({
|
|
|
125
126
|
`, j = a.forwardRef(({
|
|
126
127
|
children: e,
|
|
127
128
|
placeholder: r,
|
|
128
|
-
...
|
|
129
|
-
},
|
|
130
|
-
ref:
|
|
129
|
+
...i
|
|
130
|
+
}, n) => t(u, {
|
|
131
|
+
ref: n,
|
|
131
132
|
ellipsis: !0,
|
|
132
|
-
...
|
|
133
|
+
...i,
|
|
133
134
|
children: t(F, {
|
|
134
135
|
placeholder: r,
|
|
135
136
|
children: e
|
|
@@ -185,6 +186,7 @@ const v = a.forwardRef(({
|
|
|
185
186
|
theme: e
|
|
186
187
|
}) => e.spaces[2]};
|
|
187
188
|
white-space: nowrap;
|
|
189
|
+
user-select: none;
|
|
188
190
|
|
|
189
191
|
&:focus-visible {
|
|
190
192
|
outline: none;
|
|
@@ -209,10 +211,10 @@ const v = a.forwardRef(({
|
|
|
209
211
|
}) => e.colors.primary600};
|
|
210
212
|
}
|
|
211
213
|
}
|
|
212
|
-
`, X = o.Root, Y = v, Z = j, _ = o.Portal, ee = B, re = D, oe = E, te = o.ItemIndicator, se = o.ItemText,
|
|
214
|
+
`, X = o.Root, Y = v, Z = j, _ = o.Portal, ee = B, re = D, oe = E, te = o.ItemIndicator, se = o.ItemText, ne = o.Group;
|
|
213
215
|
export {
|
|
214
216
|
ee as Content,
|
|
215
|
-
|
|
217
|
+
ne as Group,
|
|
216
218
|
oe as Item,
|
|
217
219
|
te as ItemIndicator,
|
|
218
220
|
se as ItemText,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),N=require("react"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),N=require("react"),s=require("./SelectParts.cjs"),I=require("../Box/Box.cjs"),V=require("../Field/Field.cjs"),H=require("../Field/FieldLabel.cjs");require("../Field/FieldInput.cjs");const W=require("../Field/FieldHint.cjs"),z=require("../Field/FieldError.cjs");require("../Field/FieldContext.cjs");require("../Field/FieldAction.cjs");const A=require("../Flex/Flex.cjs"),D=require("../hooks/useId.cjs"),G=require("../hooks/useIntersection.cjs"),J=require("../Typography/Typography.cjs");function K(t){if(t&&t.__esModule)return t;const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const l=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(i,r,l.get?l:{enumerable:!0,get:()=>t[r]})}}return i.default=t,Object.freeze(i)}const d=K(N),Q=({children:t,clearLabel:i="Clear",customizeContent:r,disabled:l,error:u,hint:q,id:y,label:p,labelAction:m,onChange:a,onClear:h,onReachEnd:f,placeholder:O,required:x,selectButtonTitle:X,startIcon:T,size:B="M",value:j,...R})=>{const[C,g]=d.useState(),[_,k]=d.useState(!1),o=D.useId(y),v=`${o}-hint`,P=`${o}-error`,$=n=>{a?a(typeof j=="number"?Number(n):n):g(n)},w=n=>{k(n)},L=n=>{h&&h(n),a||g("")},F=d.useRef(null),M=()=>{F.current.focus()},b=d.useRef(null),S=`intersection-${o}`,E=n=>{f&&f(n)};G.useIntersection(b,E,{selectorToWatch:`#${S}`,skipWhen:!_});const c=(typeof j<"u"?j.toString():C)??"";return e.jsx(V.Field,{hint:q,error:u,id:o,required:x,children:e.jsxs(A.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[e.jsx(H.FieldLabel,{onClick:M,action:m,children:p}),e.jsxs(s.Root,{onOpenChange:w,disabled:l,required:x,onValueChange:$,value:c,...R,children:[e.jsx(s.Trigger,{ref:F,"aria-label":p,"aria-describedby":`${v} ${P}`,id:o,startIcon:T,size:B,hasError:Boolean(u),disabled:l,clearLabel:i,onClear:c&&h?L:void 0,children:e.jsx(s.Value,{placeholder:O,textColor:c?"neutral800":"neutral600",children:c&&r?r(c):void 0})}),e.jsx(s.Portal,{children:e.jsx(s.Content,{position:"popper",sideOffset:4,children:e.jsxs(s.Viewport,{ref:b,children:[t,e.jsx(I.Box,{id:S,width:"100%",height:"1px"})]})})})]}),e.jsx(W.FieldHint,{}),e.jsx(z.FieldError,{})]})})},U=d.forwardRef(({value:t,startIcon:i,children:r,...l},u)=>e.jsxs(s.Item,{ref:u,value:t.toString(),...l,children:[i&&e.jsx(I.Box,{as:"span","aria-hidden":!0,children:i}),e.jsx(J.Typography,{textColor:"neutral800",children:e.jsx(s.ItemText,{children:r})})]}));exports.SingleSelect=Q;exports.SingleSelectOption=U;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { Item as q, ItemText as
|
|
1
|
+
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import * as i from "react";
|
|
3
|
+
import { Item as q, ItemText as H, Root as M, Trigger as P, Value as _, Portal as z, Content as A, Viewport as D } from "./SelectParts.js";
|
|
4
4
|
import { Box as R } from "../Box/Box.js";
|
|
5
5
|
import { Field as G } from "../Field/Field.js";
|
|
6
6
|
import { FieldLabel as J } from "../Field/FieldLabel.js";
|
|
@@ -14,86 +14,86 @@ import { useId as X } from "../hooks/useId.js";
|
|
|
14
14
|
import { useIntersection as Y } from "../hooks/useIntersection.js";
|
|
15
15
|
import { Typography as Z } from "../Typography/Typography.js";
|
|
16
16
|
const Ie = ({
|
|
17
|
-
children:
|
|
18
|
-
clearLabel:
|
|
19
|
-
customizeContent:
|
|
20
|
-
disabled:
|
|
17
|
+
children: s,
|
|
18
|
+
clearLabel: o = "Clear",
|
|
19
|
+
customizeContent: l,
|
|
20
|
+
disabled: d,
|
|
21
21
|
error: c,
|
|
22
|
-
hint:
|
|
23
|
-
id:
|
|
24
|
-
label:
|
|
25
|
-
labelAction:
|
|
22
|
+
hint: C,
|
|
23
|
+
id: O,
|
|
24
|
+
label: m,
|
|
25
|
+
labelAction: B,
|
|
26
26
|
onChange: h,
|
|
27
|
-
onClear:
|
|
28
|
-
onReachEnd:
|
|
29
|
-
placeholder:
|
|
30
|
-
required:
|
|
27
|
+
onClear: p,
|
|
28
|
+
onReachEnd: u,
|
|
29
|
+
placeholder: F,
|
|
30
|
+
required: g,
|
|
31
31
|
selectButtonTitle: ee,
|
|
32
|
-
startIcon:
|
|
33
|
-
size:
|
|
34
|
-
value:
|
|
35
|
-
...
|
|
32
|
+
startIcon: T,
|
|
33
|
+
size: $ = "M",
|
|
34
|
+
value: f,
|
|
35
|
+
...y
|
|
36
36
|
}) => {
|
|
37
|
-
const [
|
|
38
|
-
h ? h(typeof
|
|
37
|
+
const [w, I] = i.useState(), [V, k] = i.useState(!1), t = X(O), v = `${t}-hint`, E = `${t}-error`, L = (r) => {
|
|
38
|
+
h ? h(typeof f == "number" ? Number(r) : r) : I(r);
|
|
39
39
|
}, N = (r) => {
|
|
40
40
|
k(r);
|
|
41
41
|
}, j = (r) => {
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
}, x =
|
|
42
|
+
p && p(r), h || I("");
|
|
43
|
+
}, b = i.useRef(null), W = () => {
|
|
44
|
+
b.current.focus();
|
|
45
|
+
}, x = i.useRef(null), S = `intersection-${t}`;
|
|
46
46
|
Y(x, (r) => {
|
|
47
|
-
|
|
47
|
+
u && u(r);
|
|
48
48
|
}, {
|
|
49
|
-
selectorToWatch: `#${
|
|
49
|
+
selectorToWatch: `#${S}`,
|
|
50
50
|
skipWhen: !V
|
|
51
51
|
});
|
|
52
|
-
const n = (typeof
|
|
52
|
+
const n = (typeof f < "u" ? f.toString() : w) ?? "";
|
|
53
53
|
return e(G, {
|
|
54
|
-
hint:
|
|
54
|
+
hint: C,
|
|
55
55
|
error: c,
|
|
56
56
|
id: t,
|
|
57
|
-
required:
|
|
58
|
-
children:
|
|
57
|
+
required: g,
|
|
58
|
+
children: a(U, {
|
|
59
59
|
direction: "column",
|
|
60
60
|
alignItems: "stretch",
|
|
61
61
|
gap: 1,
|
|
62
62
|
children: [e(J, {
|
|
63
63
|
onClick: W,
|
|
64
|
-
action:
|
|
65
|
-
children:
|
|
66
|
-
}),
|
|
64
|
+
action: B,
|
|
65
|
+
children: m
|
|
66
|
+
}), a(M, {
|
|
67
67
|
onOpenChange: N,
|
|
68
|
-
disabled:
|
|
69
|
-
required:
|
|
68
|
+
disabled: d,
|
|
69
|
+
required: g,
|
|
70
70
|
onValueChange: L,
|
|
71
71
|
value: n,
|
|
72
|
-
...
|
|
73
|
-
children: [e(
|
|
74
|
-
ref:
|
|
75
|
-
"aria-label":
|
|
72
|
+
...y,
|
|
73
|
+
children: [e(P, {
|
|
74
|
+
ref: b,
|
|
75
|
+
"aria-label": m,
|
|
76
76
|
"aria-describedby": `${v} ${E}`,
|
|
77
77
|
id: t,
|
|
78
|
-
startIcon:
|
|
79
|
-
size:
|
|
78
|
+
startIcon: T,
|
|
79
|
+
size: $,
|
|
80
80
|
hasError: Boolean(c),
|
|
81
|
-
disabled:
|
|
82
|
-
clearLabel:
|
|
83
|
-
onClear: n &&
|
|
84
|
-
children: e(
|
|
85
|
-
placeholder:
|
|
81
|
+
disabled: d,
|
|
82
|
+
clearLabel: o,
|
|
83
|
+
onClear: n && p ? j : void 0,
|
|
84
|
+
children: e(_, {
|
|
85
|
+
placeholder: F,
|
|
86
86
|
textColor: n ? "neutral800" : "neutral600",
|
|
87
|
-
children: n ?
|
|
87
|
+
children: n && l ? l(n) : void 0
|
|
88
88
|
})
|
|
89
|
-
}), e(
|
|
89
|
+
}), e(z, {
|
|
90
90
|
children: e(A, {
|
|
91
91
|
position: "popper",
|
|
92
92
|
sideOffset: 4,
|
|
93
|
-
children:
|
|
93
|
+
children: a(D, {
|
|
94
94
|
ref: x,
|
|
95
|
-
children: [
|
|
96
|
-
id:
|
|
95
|
+
children: [s, e(R, {
|
|
96
|
+
id: S,
|
|
97
97
|
width: "100%",
|
|
98
98
|
height: "1px"
|
|
99
99
|
})]
|
|
@@ -103,23 +103,23 @@ const Ie = ({
|
|
|
103
103
|
}), e(K, {}), e(Q, {})]
|
|
104
104
|
})
|
|
105
105
|
});
|
|
106
|
-
}, be =
|
|
107
|
-
value:
|
|
108
|
-
startIcon:
|
|
109
|
-
children:
|
|
110
|
-
...
|
|
111
|
-
}, c) =>
|
|
106
|
+
}, be = i.forwardRef(({
|
|
107
|
+
value: s,
|
|
108
|
+
startIcon: o,
|
|
109
|
+
children: l,
|
|
110
|
+
...d
|
|
111
|
+
}, c) => a(q, {
|
|
112
112
|
ref: c,
|
|
113
|
-
value:
|
|
114
|
-
...
|
|
115
|
-
children: [
|
|
113
|
+
value: s.toString(),
|
|
114
|
+
...d,
|
|
115
|
+
children: [o && e(R, {
|
|
116
116
|
as: "span",
|
|
117
117
|
"aria-hidden": !0,
|
|
118
|
-
children:
|
|
118
|
+
children: o
|
|
119
119
|
}), e(Z, {
|
|
120
120
|
textColor: "neutral800",
|
|
121
|
-
children: e(
|
|
122
|
-
children:
|
|
121
|
+
children: e(H, {
|
|
122
|
+
children: l
|
|
123
123
|
})
|
|
124
124
|
})]
|
|
125
125
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/design-system",
|
|
3
|
-
"version": "1.7.0
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"@internationalized/number": "^3.2.0",
|
|
24
24
|
"@radix-ui/react-dropdown-menu": "^2.0.4",
|
|
25
25
|
"@radix-ui/react-use-callback-ref": "^1.0.0",
|
|
26
|
-
"@strapi/ui-primitives": "^1.7.0
|
|
26
|
+
"@strapi/ui-primitives": "^1.7.0",
|
|
27
27
|
"@uiw/react-codemirror": "^4.19.7",
|
|
28
28
|
"compute-scroll-into-view": "^1.0.17",
|
|
29
29
|
"prop-types": "^15.7.2"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@playwright/test": "1.27.1",
|
|
33
|
-
"@strapi/icons": "^1.7.0
|
|
33
|
+
"@strapi/icons": "^1.7.0",
|
|
34
34
|
"@types/react-router-dom": "^5.3.3",
|
|
35
35
|
"@types/styled-components": "^5.1.26",
|
|
36
36
|
"axe-playwright": "^1.1.11",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"@types/react": "17.0.2",
|
|
66
66
|
"@types/react-dom": "17.0.2"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "396ee39dddaa1a56571251403f0e87d03e08fd27"
|
|
69
69
|
}
|