@strapi/design-system 1.7.2 → 1.7.3
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/Combobox/Combobox.cjs +10 -10
- package/dist/Combobox/Combobox.js +50 -50
- package/dist/Select/SelectParts.cjs +10 -8
- package/dist/Select/SelectParts.js +24 -22
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),te=require("react"),S=require("@strapi/icons"),n=require("@strapi/ui-primitives"),ne=require("styled-components"),se=require("../hooks/useControllableState.cjs"),le=require("../hooks/useId.cjs"),ae=require("../hooks/useIntersection.cjs"),ie=require("../themes/utils.cjs"),ce=require("../Loader/Loader.cjs"),$=require("../Box/Box.cjs"),h=require("../Typography/Typography.cjs"),de=require("../Field/Field.cjs"),b=require("../Flex/Flex.cjs"),ue=require("../Field/FieldLabel.cjs"),he=require("../Field/FieldHint.cjs"),be=require("../Field/FieldError.cjs"),xe=e=>e&&e.__esModule?e:{default:e};function pe(e){if(e&&e.__esModule)return e;const r=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(r,s,a.get?a:{enumerable:!0,get:()=>e[s]})}}return r.default=e,Object.freeze(r)}const c=pe(te),l=xe(ne),B=({children:e,clearLabel:r="clear",creatable:s=!1,createMessage:a=C=>`Create "${C}"`,defaultTextValue:p,disabled:d=!1,error:f,hasMoreItems:_=!1,hint:P,id:E,label:z,labelAction:D,loading:g=!1,loadingMessage:H="Loading content...",noOptionsMessage:L=()=>"No results found",onChange:j,onClear:m,onCreateOption:y,onInputChange:w,onLoadMore:I,placeholder:M="Select or enter a value",required:F=!1,startIcon:T,textValue:N,value:W})=>{const[C,U]=c.useState(!1),[i,q]=se.useControllableState({prop:N,defaultProp:p}),[A,v]=c.useState(""),R=c.useRef(null),V=c.useRef(null),G=c.useRef(null),u=le.useId(E),J=t=>{m&&!d&&(q(""),v(""),m(t),V.current.focus())},K=t=>{U(t)},Q=t=>{q(t)},X=t=>{v(t)},Y=t=>{w&&w(t)},Z=t=>{j&&j(t)},k=`intersection-${CSS.escape(u)}`,ee=t=>{I&&_&&!g&&I(t)},O=()=>{y&&i&&y(i)};ae.useIntersection(R,ee,{selectorToWatch:`#${k}`,skipWhen:!C});const oe=`${u}-hint`,re=`${u}-error`;return o.jsx(de.Field,{hint:P,error:f,id:u,required:F,children:o.jsxs(b.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[o.jsx(ue.FieldLabel,{action:D,children:z}),o.jsxs(n.Combobox.Root,{autocomplete:s?"list":"both",onOpenChange:K,onTextValueChange:Q,textValue:i,allowCustomValue:!0,disabled:d,required:F,value:W,onValueChange:Z,filterValue:A,onFilterValueChange:X,children:[o.jsxs(me,{$hasError:!!f,children:[o.jsxs(b.Flex,{flex:"1",as:"span",gap:3,children:[T?o.jsx($.Box,{as:"span","aria-hidden":!0,children:T}):null,o.jsx(Ce,{placeholder:M,id:u,"aria-invalid":!!f,"aria-labelledby":`${oe} ${re}`,onChange:Y,ref:V})]}),o.jsxs(b.Flex,{as:"span",gap:3,children:[i&&m?o.jsx(ge,{as:"button",hasRadius:!0,background:"transparent",type:"button",onClick:J,"aria-disabled":d,"aria-label":r,title:r,ref:G,children:o.jsx(S.Cross,{})}):null,o.jsx($e,{children:o.jsx(S.CarretDown,{})})]})]}),o.jsx(n.Combobox.Portal,{children:o.jsx(je,{sideOffset:4,children:o.jsxs(ye,{ref:R,children:[e,s?o.jsx(n.Combobox.CreateItem,{onPointerUp:O,onClick:O,asChild:!0,children:o.jsx(x,{children:o.jsx(h.Typography,{children:a(i??"")})})}):null,!s&&!g?o.jsx(n.Combobox.NoValueFound,{asChild:!0,children:o.jsx(x,{$hasHover:!1,children:o.jsx(h.Typography,{children:L(i??"")})})}):null,g?o.jsx(b.Flex,{justifyContent:"center",alignItems:"center",paddingTop:2,paddingBottom:2,children:o.jsx(ce.Loader,{small:!0,children:H})}):null,o.jsx($.Box,{id:k,width:"100%",height:"1px"})]})})})]}),o.jsx(he.FieldHint,{}),o.jsx(be.FieldError,{})]})})},fe=e=>o.jsx(B,{...e,creatable:!0}),ge=l.default($.Box)`
|
|
2
2
|
border: none;
|
|
3
3
|
|
|
4
4
|
svg {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
svg path {
|
|
10
10
|
fill: ${({theme:e})=>e.colors.neutral600};
|
|
11
11
|
}
|
|
12
|
-
`,
|
|
12
|
+
`,me=l.default(n.Combobox.Trigger)`
|
|
13
13
|
position: relative;
|
|
14
14
|
border: 1px solid ${({theme:e,$hasError:r})=>r?e.colors.danger600:e.colors.neutral200};
|
|
15
15
|
padding-right: ${({theme:e})=>e.spaces[3]};
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
${({theme:e,$hasError:r})=>ie.inputFocusStyle()({theme:e,hasError:r})};
|
|
37
|
-
`,
|
|
37
|
+
`,Ce=l.default(n.Combobox.TextInput)`
|
|
38
38
|
width: 100%;
|
|
39
39
|
font-size: ${14/16}rem;
|
|
40
40
|
color: ${({theme:e})=>e.colors.neutral800};
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
&[aria-disabled='true'] {
|
|
50
50
|
cursor: inherit;
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
`,$e=l.default(n.Combobox.Icon)`
|
|
53
53
|
& > svg {
|
|
54
54
|
width: ${6/16}rem;
|
|
55
55
|
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
&[aria-disabled='true'] {
|
|
62
62
|
cursor: inherit;
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
`,je=l.default(n.Combobox.Content)`
|
|
65
65
|
background: ${({theme:e})=>e.colors.neutral0};
|
|
66
66
|
box-shadow: ${({theme:e})=>e.shadows.filterShadow};
|
|
67
67
|
border: 1px solid ${({theme:e})=>e.colors.neutral150};
|
|
@@ -70,9 +70,9 @@
|
|
|
70
70
|
/* This is from the design-system figma file. */
|
|
71
71
|
max-height: 15rem;
|
|
72
72
|
z-index: ${({theme:e})=>e.zIndices[1]};
|
|
73
|
-
`,
|
|
73
|
+
`,ye=l.default(n.Combobox.Viewport)`
|
|
74
74
|
padding: ${({theme:e})=>e.spaces[1]};
|
|
75
|
-
`,
|
|
75
|
+
`,we=c.forwardRef(({children:e,value:r,disabled:s,textValue:a,...p},d)=>o.jsx(n.Combobox.ComboboxItem,{asChild:!0,value:r,disabled:s,textValue:a,children:o.jsx(x,{ref:d,...p,children:o.jsx(n.Combobox.ItemText,{asChild:!0,children:o.jsx(h.Typography,{children:e})})})})),x=l.default.div`
|
|
76
76
|
width: 100%;
|
|
77
77
|
border: none;
|
|
78
78
|
text-align: left;
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
&[data-selected] {
|
|
86
86
|
background-color: ${({theme:e})=>e.colors.primary100};
|
|
87
87
|
|
|
88
|
-
${
|
|
88
|
+
${h.Typography} {
|
|
89
89
|
color: ${({theme:e})=>e.colors.primary600};
|
|
90
90
|
font-weight: bold;
|
|
91
91
|
}
|
|
@@ -98,9 +98,9 @@
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
&[data-highlighted] {
|
|
101
|
-
${
|
|
101
|
+
${h.Typography} {
|
|
102
102
|
color: ${({theme:e})=>e.colors.primary600};
|
|
103
103
|
font-weight: bold;
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
`;exports.Combobox=
|
|
106
|
+
`;exports.Combobox=B;exports.CreatableCombobox=fe;exports.Option=we;exports.OptionBox=x;
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { Cross as
|
|
1
|
+
import { jsx as r, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import * as s from "react";
|
|
3
|
+
import { Cross as oe, CarretDown as te } from "@strapi/icons";
|
|
4
4
|
import { Combobox as t } from "@strapi/ui-primitives";
|
|
5
5
|
import l from "styled-components";
|
|
6
|
-
import { useControllableState as
|
|
7
|
-
import { useId as
|
|
8
|
-
import { useIntersection as
|
|
9
|
-
import { inputFocusStyle as
|
|
10
|
-
import { Loader as
|
|
11
|
-
import { Box as
|
|
12
|
-
import { Typography as
|
|
13
|
-
import { Field as
|
|
14
|
-
import { Flex as
|
|
15
|
-
import { FieldLabel as
|
|
16
|
-
import { FieldHint as
|
|
17
|
-
import { FieldError as
|
|
18
|
-
const
|
|
19
|
-
const [
|
|
20
|
-
prop:
|
|
21
|
-
defaultProp:
|
|
22
|
-
}), [
|
|
23
|
-
|
|
24
|
-
}, K = (o) => {
|
|
25
|
-
U(o);
|
|
6
|
+
import { useControllableState as ne } from "../hooks/useControllableState.js";
|
|
7
|
+
import { useId as le } from "../hooks/useId.js";
|
|
8
|
+
import { useIntersection as ie } from "../hooks/useIntersection.js";
|
|
9
|
+
import { inputFocusStyle as ae } from "../themes/utils.js";
|
|
10
|
+
import { Loader as se } from "../Loader/Loader.js";
|
|
11
|
+
import { Box as C } from "../Box/Box.js";
|
|
12
|
+
import { Typography as h } from "../Typography/Typography.js";
|
|
13
|
+
import { Field as de } from "../Field/Field.js";
|
|
14
|
+
import { Flex as p } from "../Flex/Flex.js";
|
|
15
|
+
import { FieldLabel as ce } from "../Field/FieldLabel.js";
|
|
16
|
+
import { FieldHint as ue } from "../Field/FieldHint.js";
|
|
17
|
+
import { FieldError as he } from "../Field/FieldError.js";
|
|
18
|
+
const pe = ({ children: e, clearLabel: n = "clear", creatable: d = !1, createMessage: f = (x) => `Create "${x}"`, defaultTextValue: m, disabled: c = !1, error: g, hasMoreItems: E = !1, hint: z, id: P, label: q, labelAction: D, loading: b = !1, loadingMessage: H = "Loading content...", noOptionsMessage: N = () => "No results found", onChange: I, onClear: $, onCreateOption: v, onInputChange: V, onLoadMore: y, placeholder: W = "Select or enter a value", required: R = !1, startIcon: k, textValue: L, value: U }) => {
|
|
19
|
+
const [x, A] = s.useState(!1), [i, T] = ne({
|
|
20
|
+
prop: L,
|
|
21
|
+
defaultProp: m
|
|
22
|
+
}), [G, F] = s.useState(""), S = s.useRef(null), B = s.useRef(null), J = s.useRef(null), u = le(P), K = (o) => {
|
|
23
|
+
$ && !c && (T(""), F(""), $(o), B.current.focus());
|
|
26
24
|
}, Q = (o) => {
|
|
27
|
-
|
|
25
|
+
A(o);
|
|
28
26
|
}, X = (o) => {
|
|
29
|
-
|
|
27
|
+
T(o);
|
|
30
28
|
}, Y = (o) => {
|
|
31
|
-
|
|
29
|
+
F(o);
|
|
32
30
|
}, Z = (o) => {
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
|
|
31
|
+
V && V(o);
|
|
32
|
+
}, _ = (o) => {
|
|
33
|
+
I && I(o);
|
|
34
|
+
}, O = `intersection-${CSS.escape(u)}`, M = (o) => {
|
|
35
|
+
y && E && !b && y(o);
|
|
36
|
+
}, j = () => {
|
|
37
|
+
v && i && v(i);
|
|
38
38
|
};
|
|
39
|
-
|
|
40
|
-
selectorToWatch: `#${
|
|
39
|
+
ie(S, M, {
|
|
40
|
+
selectorToWatch: `#${O}`,
|
|
41
41
|
/**
|
|
42
42
|
* We need to know when the select is open because only then will viewportRef
|
|
43
43
|
* not be null. Because it uses a portal that (sensibly) is not mounted 24/7.
|
|
44
44
|
*/
|
|
45
|
-
skipWhen: !
|
|
45
|
+
skipWhen: !x
|
|
46
46
|
});
|
|
47
|
-
const
|
|
48
|
-
return r(
|
|
49
|
-
},
|
|
47
|
+
const ee = `${u}-hint`, re = `${u}-error`;
|
|
48
|
+
return r(de, { hint: z, error: g, id: u, required: R, children: a(p, { direction: "column", alignItems: "stretch", gap: 1, children: [r(ce, { action: D, children: q }), a(t.Root, { autocomplete: d ? "list" : "both", onOpenChange: Q, onTextValueChange: X, textValue: i, allowCustomValue: !0, disabled: c, required: R, value: U, onValueChange: _, filterValue: G, onFilterValueChange: Y, children: [a(me, { $hasError: !!g, children: [a(p, { flex: "1", as: "span", gap: 3, children: [k ? r(C, { as: "span", "aria-hidden": !0, children: k }) : null, r(ge, { placeholder: W, id: u, "aria-invalid": !!g, "aria-labelledby": `${ee} ${re}`, onChange: Z, ref: B })] }), a(p, { as: "span", gap: 3, children: [i && $ ? r(fe, { as: "button", hasRadius: !0, background: "transparent", type: "button", onClick: K, "aria-disabled": c, "aria-label": n, title: n, ref: J, children: r(oe, {}) }) : null, r(be, { children: r(te, {}) })] })] }), r(t.Portal, { children: r($e, { sideOffset: 4, children: a(xe, { ref: S, children: [e, d ? r(t.CreateItem, { onPointerUp: j, onClick: j, asChild: !0, children: r(w, { children: r(h, { children: f(i ?? "") }) }) }) : null, !d && !b ? r(t.NoValueFound, { asChild: !0, children: r(w, { $hasHover: !1, children: r(h, { children: N(i ?? "") }) }) }) : null, b ? r(p, { justifyContent: "center", alignItems: "center", paddingTop: 2, paddingBottom: 2, children: r(se, { small: !0, children: H }) }) : null, r(C, { id: O, width: "100%", height: "1px" })] }) }) })] }), r(ue, {}), r(he, {})] }) });
|
|
49
|
+
}, Pe = (e) => r(pe, { ...e, creatable: !0 }), fe = l(C)`
|
|
50
50
|
border: none;
|
|
51
51
|
|
|
52
52
|
svg {
|
|
@@ -57,7 +57,7 @@ const he = ({ children: e, clearLabel: n = "clear", creatable: s = !1, createMes
|
|
|
57
57
|
svg path {
|
|
58
58
|
fill: ${({ theme: e }) => e.colors.neutral600};
|
|
59
59
|
}
|
|
60
|
-
`,
|
|
60
|
+
`, me = l(t.Trigger)`
|
|
61
61
|
position: relative;
|
|
62
62
|
border: 1px solid ${({ theme: e, $hasError: n }) => n ? e.colors.danger600 : e.colors.neutral200};
|
|
63
63
|
padding-right: ${({ theme: e }) => e.spaces[3]};
|
|
@@ -81,8 +81,8 @@ const he = ({ children: e, clearLabel: n = "clear", creatable: s = !1, createMes
|
|
|
81
81
|
outline: none;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
${({ theme: e, $hasError: n }) =>
|
|
85
|
-
`,
|
|
84
|
+
${({ theme: e, $hasError: n }) => ae()({ theme: e, hasError: n })};
|
|
85
|
+
`, ge = l(t.TextInput)`
|
|
86
86
|
width: 100%;
|
|
87
87
|
font-size: ${14 / 16}rem;
|
|
88
88
|
color: ${({ theme: e }) => e.colors.neutral800};
|
|
@@ -97,7 +97,7 @@ const he = ({ children: e, clearLabel: n = "clear", creatable: s = !1, createMes
|
|
|
97
97
|
&[aria-disabled='true'] {
|
|
98
98
|
cursor: inherit;
|
|
99
99
|
}
|
|
100
|
-
`,
|
|
100
|
+
`, be = l(t.Icon)`
|
|
101
101
|
& > svg {
|
|
102
102
|
width: ${6 / 16}rem;
|
|
103
103
|
|
|
@@ -109,7 +109,7 @@ const he = ({ children: e, clearLabel: n = "clear", creatable: s = !1, createMes
|
|
|
109
109
|
&[aria-disabled='true'] {
|
|
110
110
|
cursor: inherit;
|
|
111
111
|
}
|
|
112
|
-
`,
|
|
112
|
+
`, $e = l(t.Content)`
|
|
113
113
|
background: ${({ theme: e }) => e.colors.neutral0};
|
|
114
114
|
box-shadow: ${({ theme: e }) => e.shadows.filterShadow};
|
|
115
115
|
border: 1px solid ${({ theme: e }) => e.colors.neutral150};
|
|
@@ -118,9 +118,9 @@ const he = ({ children: e, clearLabel: n = "clear", creatable: s = !1, createMes
|
|
|
118
118
|
/* This is from the design-system figma file. */
|
|
119
119
|
max-height: 15rem;
|
|
120
120
|
z-index: ${({ theme: e }) => e.zIndices[1]};
|
|
121
|
-
`,
|
|
121
|
+
`, xe = l(t.Viewport)`
|
|
122
122
|
padding: ${({ theme: e }) => e.spaces[1]};
|
|
123
|
-
`,
|
|
123
|
+
`, qe = s.forwardRef(({ children: e, value: n, disabled: d, textValue: f, ...m }, c) => r(t.ComboboxItem, { asChild: !0, value: n, disabled: d, textValue: f, children: r(w, { ref: c, ...m, children: r(t.ItemText, { asChild: !0, children: r(h, { children: e }) }) }) })), w = l.div`
|
|
124
124
|
width: 100%;
|
|
125
125
|
border: none;
|
|
126
126
|
text-align: left;
|
|
@@ -133,7 +133,7 @@ const he = ({ children: e, clearLabel: n = "clear", creatable: s = !1, createMes
|
|
|
133
133
|
&[data-selected] {
|
|
134
134
|
background-color: ${({ theme: e }) => e.colors.primary100};
|
|
135
135
|
|
|
136
|
-
${
|
|
136
|
+
${h} {
|
|
137
137
|
color: ${({ theme: e }) => e.colors.primary600};
|
|
138
138
|
font-weight: bold;
|
|
139
139
|
}
|
|
@@ -146,15 +146,15 @@ const he = ({ children: e, clearLabel: n = "clear", creatable: s = !1, createMes
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
&[data-highlighted] {
|
|
149
|
-
${
|
|
149
|
+
${h} {
|
|
150
150
|
color: ${({ theme: e }) => e.colors.primary600};
|
|
151
151
|
font-weight: bold;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
`;
|
|
155
155
|
export {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
156
|
+
pe as Combobox,
|
|
157
|
+
Pe as CreatableCombobox,
|
|
158
|
+
qe as Option,
|
|
159
|
+
w as OptionBox
|
|
160
160
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),R=require("react"),d=require("@strapi/icons"),o=require("@strapi/ui-primitives"),p=require("styled-components"),j=require("../hooks/useComposeRefs.cjs"),u=require("../themes/utils.cjs"),c=require("../Flex/Flex.cjs"),f=require("../Box/Box.cjs"),g=require("../Typography/Typography.cjs"),I=e=>e&&e.__esModule?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 a=T(R),l=I(p),v=a.forwardRef(({onClear:e,clearLabel:t="Clear",startIcon:s,disabled:n,hasError:h,size:m="M",children:x,...b},$)=>{const i=a.useRef(null),S=y=>{e&&!n&&(e(y),i.current.focus())},w=j.useComposedRefs(i,$);return r.jsx(o.Select.Trigger,{asChild:!0,children:r.jsxs(q,{"aria-disabled":n,$hasError:h,$size:m,ref:w,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(c.Flex,{as:"span",gap:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),R=require("react"),d=require("@strapi/icons"),o=require("@strapi/ui-primitives"),p=require("styled-components"),j=require("../hooks/useComposeRefs.cjs"),u=require("../themes/utils.cjs"),c=require("../Flex/Flex.cjs"),f=require("../Box/Box.cjs"),g=require("../Typography/Typography.cjs"),I=e=>e&&e.__esModule?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 a=T(R),l=I(p),v=a.forwardRef(({onClear:e,clearLabel:t="Clear",startIcon:s,disabled:n,hasError:h,size:m="M",children:x,...b},$)=>{const i=a.useRef(null),S=y=>{e&&!n&&(e(y),i.current.focus())},w=j.useComposedRefs(i,$);return r.jsx(o.Select.Trigger,{asChild:!0,children:r.jsxs(q,{"aria-disabled":n,$hasError:h,$size:m,ref:w,alignItems:"center",justifyContent:"space-between",position:"relative",overflow:"hidden",hasRadius:!0,background:n?"neutral150":"neutral0",paddingLeft:3,paddingRight:3,gap:4,cursor:"default",width:"100%",...b,children:[r.jsxs(c.Flex,{flex:"1",as:"span",gap:3,children:[s&&r.jsx(f.Box,{as:"span","aria-hidden":!0,children:s}),x]}),r.jsxs(c.Flex,{as:"span",gap:3,children:[e?r.jsx(C,{as:"button",hasRadius:!0,background:"transparent",role:"button",tabIndex:0,onClick:S,"aria-disabled":n,"aria-label":t,title:t,cursor:"pointer",children:r.jsx(d.Cross,{})}):null,r.jsx(k,{children:r.jsx(d.CarretDown,{})})]})]})})}),C=l.default(f.Box)`
|
|
2
2
|
border: none;
|
|
3
3
|
|
|
4
4
|
svg {
|
|
@@ -31,11 +31,13 @@
|
|
|
31
31
|
fill: ${({theme:e})=>e.colors.neutral600};
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
`,
|
|
34
|
+
`,V=a.forwardRef(({children:e,placeholder:t,...s},n)=>r.jsx(_,{ref:n,ellipsis:!0,...s,children:r.jsx(P,{placeholder:t,children:e})})),_=l.default(g.Typography)`
|
|
35
|
+
flex: 1;
|
|
36
|
+
`,P=l.default(o.Select.Value)`
|
|
35
37
|
display: flex;
|
|
36
38
|
gap: ${({theme:e})=>e.spaces[1]};
|
|
37
39
|
flex-wrap: wrap;
|
|
38
|
-
`,
|
|
40
|
+
`,z=l.default(o.Select.Content)`
|
|
39
41
|
background: ${({theme:e})=>e.colors.neutral0};
|
|
40
42
|
box-shadow: ${({theme:e})=>e.shadows.filterShadow};
|
|
41
43
|
border: 1px solid ${({theme:e})=>e.colors.neutral150};
|
|
@@ -44,9 +46,9 @@
|
|
|
44
46
|
/* This is from the design-system figma file. */
|
|
45
47
|
max-height: 15rem;
|
|
46
48
|
z-index: ${({theme:e})=>e.zIndices[1]};
|
|
47
|
-
`,
|
|
49
|
+
`,F=l.default(o.Select.Viewport)`
|
|
48
50
|
padding: ${({theme:e})=>e.spaces[1]};
|
|
49
|
-
`,
|
|
51
|
+
`,O=a.forwardRef((e,t)=>r.jsx(B,{ref:t,...e})),M=p.css`
|
|
50
52
|
width: 100%;
|
|
51
53
|
border: none;
|
|
52
54
|
text-align: left;
|
|
@@ -65,8 +67,8 @@
|
|
|
65
67
|
outline: none;
|
|
66
68
|
background-color: ${({theme:e})=>e.colors.primary100};
|
|
67
69
|
}
|
|
68
|
-
`,
|
|
69
|
-
${
|
|
70
|
+
`,B=l.default(o.Select.Item)`
|
|
71
|
+
${M}
|
|
70
72
|
|
|
71
73
|
&:hover {
|
|
72
74
|
background-color: ${({theme:e})=>e.colors.primary100};
|
|
@@ -78,4 +80,4 @@
|
|
|
78
80
|
color: ${({theme:e})=>e.colors.primary600};
|
|
79
81
|
}
|
|
80
82
|
}
|
|
81
|
-
`,
|
|
83
|
+
`,D=o.Select.Root,G=v,E=V,N=o.Select.Portal,A=z,H=F,J=O,K=o.Select.ItemIndicator,L=o.Select.ItemText,Q=o.Select.Group;exports.Content=A;exports.Group=Q;exports.Item=J;exports.ItemIndicator=K;exports.ItemText=L;exports.Portal=N;exports.Root=D;exports.Trigger=G;exports.Value=E;exports.Viewport=H;
|
|
@@ -4,16 +4,16 @@ import { Cross as y, CarretDown as R } from "@strapi/icons";
|
|
|
4
4
|
import { Select as o } from "@strapi/ui-primitives";
|
|
5
5
|
import s, { css as I } from "styled-components";
|
|
6
6
|
import { useComposedRefs as S } from "../hooks/useComposeRefs.js";
|
|
7
|
-
import { getThemeSize as C, inputFocusStyle as
|
|
7
|
+
import { getThemeSize as C, inputFocusStyle as T } from "../themes/utils.js";
|
|
8
8
|
import { Flex as c } from "../Flex/Flex.js";
|
|
9
9
|
import { Box as p } from "../Box/Box.js";
|
|
10
10
|
import { Typography as u } from "../Typography/Typography.js";
|
|
11
|
-
const
|
|
11
|
+
const k = a.forwardRef(({ onClear: e, clearLabel: r = "Clear", startIcon: i, disabled: n, hasError: m, size: h = "M", children: f, ...g }, $) => {
|
|
12
12
|
const d = a.useRef(null), w = (x) => {
|
|
13
13
|
e && !n && (e(x), d.current.focus());
|
|
14
14
|
}, b = S(d, $);
|
|
15
|
-
return t(o.Trigger, { asChild: !0, children: l(V, { "aria-disabled": n, $hasError: m, $size: h, ref: b, alignItems: "center", justifyContent: "space-between", position: "relative", overflow: "hidden", hasRadius: !0, background: n ? "neutral150" : "neutral0", paddingLeft: 3, paddingRight: 3, gap: 4, cursor: "default", ...g, children: [l(c, { as: "span", gap:
|
|
16
|
-
}),
|
|
15
|
+
return t(o.Trigger, { asChild: !0, children: l(V, { "aria-disabled": n, $hasError: m, $size: h, ref: b, alignItems: "center", justifyContent: "space-between", position: "relative", overflow: "hidden", hasRadius: !0, background: n ? "neutral150" : "neutral0", paddingLeft: 3, paddingRight: 3, gap: 4, cursor: "default", width: "100%", ...g, children: [l(c, { flex: "1", as: "span", gap: 3, children: [i && t(p, { as: "span", "aria-hidden": !0, children: i }), f] }), l(c, { as: "span", gap: 3, children: [e ? t(v, { as: "button", hasRadius: !0, background: "transparent", role: "button", tabIndex: 0, onClick: w, "aria-disabled": n, "aria-label": r, title: r, cursor: "pointer", children: t(y, {}) }) : null, t(z, { children: t(R, {}) })] })] }) });
|
|
16
|
+
}), v = s(p)`
|
|
17
17
|
border: none;
|
|
18
18
|
|
|
19
19
|
svg {
|
|
@@ -37,7 +37,7 @@ const v = a.forwardRef(({ onClear: e, clearLabel: r = "Clear", startIcon: i, dis
|
|
|
37
37
|
outline: none;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
${({ theme: e, $hasError: r }) =>
|
|
40
|
+
${({ theme: e, $hasError: r }) => T()({ theme: e, hasError: r })};
|
|
41
41
|
`, z = s(o.Icon)`
|
|
42
42
|
& > svg {
|
|
43
43
|
width: ${6 / 16}rem;
|
|
@@ -46,11 +46,13 @@ const v = a.forwardRef(({ onClear: e, clearLabel: r = "Clear", startIcon: i, dis
|
|
|
46
46
|
fill: ${({ theme: e }) => e.colors.neutral600};
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
`, j = a.forwardRef(({ children: e, placeholder: r, ...i }, n) => t(
|
|
49
|
+
`, j = a.forwardRef(({ children: e, placeholder: r, ...i }, n) => t(F, { ref: n, ellipsis: !0, ...i, children: t(B, { placeholder: r, children: e }) })), F = s(u)`
|
|
50
|
+
flex: 1;
|
|
51
|
+
`, B = s(o.Value)`
|
|
50
52
|
display: flex;
|
|
51
53
|
gap: ${({ theme: e }) => e.spaces[1]};
|
|
52
54
|
flex-wrap: wrap;
|
|
53
|
-
`,
|
|
55
|
+
`, D = s(o.Content)`
|
|
54
56
|
background: ${({ theme: e }) => e.colors.neutral0};
|
|
55
57
|
box-shadow: ${({ theme: e }) => e.shadows.filterShadow};
|
|
56
58
|
border: 1px solid ${({ theme: e }) => e.colors.neutral150};
|
|
@@ -59,9 +61,9 @@ const v = a.forwardRef(({ onClear: e, clearLabel: r = "Clear", startIcon: i, dis
|
|
|
59
61
|
/* This is from the design-system figma file. */
|
|
60
62
|
max-height: 15rem;
|
|
61
63
|
z-index: ${({ theme: e }) => e.zIndices[1]};
|
|
62
|
-
`,
|
|
64
|
+
`, E = s(o.Viewport)`
|
|
63
65
|
padding: ${({ theme: e }) => e.spaces[1]};
|
|
64
|
-
`,
|
|
66
|
+
`, G = a.forwardRef((e, r) => t(q, { ref: r, ...e })), P = I`
|
|
65
67
|
width: 100%;
|
|
66
68
|
border: none;
|
|
67
69
|
text-align: left;
|
|
@@ -80,8 +82,8 @@ const v = a.forwardRef(({ onClear: e, clearLabel: r = "Clear", startIcon: i, dis
|
|
|
80
82
|
outline: none;
|
|
81
83
|
background-color: ${({ theme: e }) => e.colors.primary100};
|
|
82
84
|
}
|
|
83
|
-
`,
|
|
84
|
-
${
|
|
85
|
+
`, q = s(o.Item)`
|
|
86
|
+
${P}
|
|
85
87
|
|
|
86
88
|
&:hover {
|
|
87
89
|
background-color: ${({ theme: e }) => e.colors.primary100};
|
|
@@ -93,16 +95,16 @@ const v = a.forwardRef(({ onClear: e, clearLabel: r = "Clear", startIcon: i, dis
|
|
|
93
95
|
color: ${({ theme: e }) => e.colors.primary600};
|
|
94
96
|
}
|
|
95
97
|
}
|
|
96
|
-
`,
|
|
98
|
+
`, U = o.Root, W = k, X = j, Y = o.Portal, Z = D, _ = E, ee = G, re = o.ItemIndicator, oe = o.ItemText, te = o.Group;
|
|
97
99
|
export {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
100
|
+
Z as Content,
|
|
101
|
+
te as Group,
|
|
102
|
+
ee as Item,
|
|
103
|
+
re as ItemIndicator,
|
|
104
|
+
oe as ItemText,
|
|
105
|
+
Y as Portal,
|
|
106
|
+
U as Root,
|
|
107
|
+
W as Trigger,
|
|
108
|
+
X as Value,
|
|
109
|
+
_ as Viewport
|
|
108
110
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/design-system",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
"@radix-ui/react-dismissable-layer": "^1.0.3",
|
|
25
25
|
"@radix-ui/react-dropdown-menu": "^2.0.4",
|
|
26
26
|
"@radix-ui/react-use-callback-ref": "^1.0.0",
|
|
27
|
-
"@strapi/ui-primitives": "^1.7.
|
|
27
|
+
"@strapi/ui-primitives": "^1.7.3",
|
|
28
28
|
"@uiw/react-codemirror": "^4.19.16",
|
|
29
29
|
"compute-scroll-into-view": "^3.0.3",
|
|
30
30
|
"prop-types": "^15.8.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@playwright/test": "1.33.0",
|
|
34
|
-
"@strapi/icons": "^1.7.
|
|
34
|
+
"@strapi/icons": "^1.7.3",
|
|
35
35
|
"@types/react-router-dom": "^5.3.3",
|
|
36
36
|
"@types/styled-components": "^5.1.26",
|
|
37
37
|
"axe-playwright": "^1.2.3",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"test:e2e:watch": "chokidar '**/__tests__/*.e2e.js' -c 'npm run test:e2e -- --retries=0 {path}'",
|
|
63
63
|
"test:e2e:debug": "cross-env PWDEBUG=1 playwright test"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "5c0de191ef278ea93a0cddadbd9b5ffbda83054f"
|
|
66
66
|
}
|