@strapi/design-system 1.7.0-alpha.4 → 1.7.0-alpha.5

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.
@@ -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"),I=require("styled-components"),i=require("./SelectParts.cjs"),Y=require("../BaseCheckbox/assets/checkmark.cjs"),F=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 s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:()=>e[r]})}}return n.default=e,Object.freeze(n)}const a=ie(N),oe=ne(I),se=({children:e,clearLabel:n="Clear",customizeContent:r=f=>f?.join(",")??"",disabled:s,error:l,hint:d,id:u,label:p,labelAction:O,onChange:x,onClear:M,onReachEnd:b,placeholder:R,required:m,selectButtonTitle:ae,startIcon:v,size:B="M",value:j,withTags:q,..._})=>{const f=a.useRef(null),[k,T]=a.useState(),[L,P]=a.useState(!1),h=ee.useId(u),z=`${h}-hint`,E=`${h}-error`,V=o=>{x?x(o):T(o)},A=o=>()=>{const g=Array.isArray(j)?j.filter(y=>y!==o):(k??[]).filter(y=>y!==o);x?x(g):T(g)},G=o=>{P(o)},S=a.useRef(null),H=()=>{S.current.focus()},$=`intersection-${h}`,D=o=>{b&&b(o)};te.useIntersection(f,D,{selectorToWatch:`#${$}`,skipWhen:!L});const c=typeof j<"u"?j:k,W=({value:o,textValue:g})=>t.jsx(re.Tag,{tabIndex:-1,disabled:s,icon:t.jsx(X.Cross,{}),onClick:A(o),children:g},o);return t.jsx(J.Field,{hint:d,error:l,id:h,required:m,children:t.jsxs(Z.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[t.jsx(K.FieldLabel,{onClick:H,action:O,children:p}),t.jsxs(i.Root,{onOpenChange:G,disabled:s,required:m,onValueChange:V,value:c,..._,multi:!0,children:[t.jsx(i.Trigger,{ref:S,"aria-label":p,"aria-describedby":`${z} ${E}`,id:h,startIcon:v,size:B,hasError:Boolean(l),disabled:s,clearLabel:n,onClear:c?.length?M:void 0,paddingLeft:q&&c?.length?1:3,children:t.jsx(i.Value,{placeholder:R,textColor:c?.length?"neutral800":"neutral600",children:c?.length?q?W:r(c):null})}),t.jsx(i.Portal,{children:t.jsx(i.Content,{position:"popper",sideOffset:4,children:t.jsxs(i.Viewport,{ref:f,children:[e,t.jsx(F.Box,{id:$,width:"100%",height:"1px"})]})})})]}),t.jsx(Q.FieldHint,{}),t.jsx(U.FieldError,{})]})})},le=a.forwardRef(({value:e,children:n,startIcon:r,...s},l)=>t.jsxs(i.Item,{ref:l,value:e.toString(),...s,children:[r&&t.jsx(F.Box,{as:"span","aria-hidden":!0,children:r}),t.jsx(i.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(i.ItemText,{children:n})})]})),w=oe.default(F.Box)`
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"),i=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:I,placeholder:R,required:b,selectButtonTitle:ae,startIcon:v,size:B="M",value:j,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=s=>{x?x(s):T(s)},A=s=>()=>{const f=Array.isArray(j)?j.filter(F=>F!==s):(k??[]).filter(F=>F!==s);x?x(f):T(f)},G=s=>{P(s)},S=a.useRef(null),H=()=>{S.current.focus()},$=`intersection-${h}`,D=s=>{I&&I(s)};te.useIntersection(q,D,{selectorToWatch:`#${$}`,skipWhen:!L});const c=typeof j<"u"?j:k,W=({value:s,textValue:f})=>t.jsx(re.Tag,{tabIndex:-1,disabled:o,icon:t.jsx(X.Cross,{}),onClick:A(s),children:f},s);return t.jsx(J.Field,{hint:d,error:l,id:h,required:b,children:t.jsxs(Z.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[t.jsx(K.FieldLabel,{onClick:H,action:O,children:p}),t.jsxs(i.Root,{onOpenChange:G,disabled:o,required:b,onValueChange:z,value:c,..._,multi:!0,children:[t.jsx(i.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(i.Value,{placeholder:R,textColor:c?.length?"neutral800":"neutral600",children:c?.length?m?W:r?r(c):void 0:void 0})}),t.jsx(i.Portal,{children:t.jsx(i.Content,{position:"popper",sideOffset:4,children:t.jsxs(i.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(i.Item,{ref:l,value:e.toString(),...o,children:[r&&t.jsx(g.Box,{as:"span","aria-hidden":!0,children:r}),t.jsx(i.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(i.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&&I.css`
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&&I.css`
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:s=[],...l},d)=>t.jsxs(i.Group,{ref:d,children:[t.jsxs(i.Item,{value:s,...l,children:[r&&t.jsx(F.Box,{as:"span","aria-hidden":!0,children:r}),t.jsx(i.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:t.jsx(i.ItemText,{children:n})})]}),e]}));exports.MultiSelect=se;exports.MultiSelectGroup=ce;exports.MultiSelectOption=le;
30
+ `,ce=a.forwardRef(({children:e,label:n,startIcon:r,values:o=[],...l},d)=>t.jsxs(i.Group,{ref:d,children:[t.jsxs(i.Item,{value:o,...l,children:[r&&t.jsx(g.Box,{as:"span","aria-hidden":!0,children:r}),t.jsx(i.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:t.jsx(i.ItemText,{children:n})})]}),e]}));exports.MultiSelect=oe;exports.MultiSelectGroup=ce;exports.MultiSelectOption=le;
@@ -1,26 +1,26 @@
1
- import { jsxs as d, jsx as e } from "react/jsx-runtime";
2
- import * as c from "react";
1
+ import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
+ import * as a from "react";
3
3
  import { Cross as J } from "@strapi/icons";
4
4
  import K, { css as T } from "styled-components";
5
5
  import { Item as S, ItemIndicator as F, ItemText as O, 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 I } from "../Box/Box.js";
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";
11
11
  import { FieldHint as le } from "../Field/FieldHint.js";
12
- import { FieldError as ae } from "../Field/FieldError.js";
12
+ import { FieldError as de } from "../Field/FieldError.js";
13
13
  import "../Field/FieldContext.js";
14
14
  import "../Field/FieldAction.js";
15
- import { Flex as ce } from "../Flex/Flex.js";
16
- import { useId as de } from "../hooks/useId.js";
15
+ import { Flex as ae } 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
19
  import { Typography as M } from "../Typography/Typography.js";
20
20
  const Be = ({
21
21
  children: r,
22
- clearLabel: n = "Clear",
23
- customizeContent: o = (g) => g?.join(",") ?? "",
22
+ clearLabel: o = "Clear",
23
+ customizeContent: t,
24
24
  disabled: i,
25
25
  error: l,
26
26
  hint: s,
@@ -29,48 +29,48 @@ const Be = ({
29
29
  labelAction: L,
30
30
  onChange: f,
31
31
  onClear: V,
32
- onReachEnd: b,
33
- placeholder: j,
34
- required: k,
32
+ onReachEnd: $,
33
+ placeholder: E,
34
+ required: b,
35
35
  selectButtonTitle: pe,
36
- startIcon: z,
37
- size: E = "M",
36
+ startIcon: j,
37
+ size: z = "M",
38
38
  value: m,
39
- withTags: C,
39
+ withTags: k,
40
40
  ...A
41
41
  }) => {
42
- const g = c.useRef(null), [w, R] = c.useState(), [G, W] = c.useState(!1), p = de(h), q = `${p}-hint`, H = `${p}-error`, P = (t) => {
43
- f ? f(t) : R(t);
44
- }, X = (t) => () => {
45
- const x = Array.isArray(m) ? m.filter(($) => $ !== t) : (w ?? []).filter(($) => $ !== t);
46
- f ? f(x) : R(x);
47
- }, Y = (t) => {
48
- W(t);
49
- }, y = c.useRef(null), _ = () => {
42
+ const w = a.useRef(null), [C, R] = a.useState(), [G, W] = a.useState(!1), p = ce(h), q = `${p}-hint`, H = `${p}-error`, P = (n) => {
43
+ f ? f(n) : R(n);
44
+ }, X = (n) => () => {
45
+ const g = Array.isArray(m) ? m.filter((I) => I !== n) : (C ?? []).filter((I) => I !== n);
46
+ f ? f(g) : R(g);
47
+ }, Y = (n) => {
48
+ W(n);
49
+ }, y = a.useRef(null), _ = () => {
50
50
  y.current.focus();
51
51
  }, v = `intersection-${p}`;
52
- se(g, (t) => {
53
- b && b(t);
52
+ se(w, (n) => {
53
+ $ && $(n);
54
54
  }, {
55
55
  selectorToWatch: `#${v}`,
56
56
  skipWhen: !G
57
57
  });
58
- const a = typeof m < "u" ? m : w, D = ({
59
- value: t,
60
- textValue: x
58
+ const d = typeof m < "u" ? m : C, D = ({
59
+ value: n,
60
+ textValue: g
61
61
  }) => e(he, {
62
62
  tabIndex: -1,
63
63
  disabled: i,
64
64
  icon: e(J, {}),
65
- onClick: X(t),
66
- children: x
67
- }, t);
65
+ onClick: X(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: k,
73
- children: d(ce, {
72
+ required: b,
73
+ children: c(ae, {
74
74
  direction: "column",
75
75
  alignItems: "stretch",
76
76
  gap: 1,
@@ -78,12 +78,12 @@ const Be = ({
78
78
  onClick: _,
79
79
  action: L,
80
80
  children: u
81
- }), d(Q, {
81
+ }), c(Q, {
82
82
  onOpenChange: Y,
83
83
  disabled: i,
84
- required: k,
84
+ required: b,
85
85
  onValueChange: P,
86
- value: a,
86
+ value: d,
87
87
  ...A,
88
88
  multi: !0,
89
89
  children: [e(U, {
@@ -91,25 +91,25 @@ const Be = ({
91
91
  "aria-label": u,
92
92
  "aria-describedby": `${q} ${H}`,
93
93
  id: p,
94
- startIcon: z,
95
- size: E,
94
+ startIcon: j,
95
+ size: z,
96
96
  hasError: Boolean(l),
97
97
  disabled: i,
98
- clearLabel: n,
99
- onClear: a?.length ? V : void 0,
100
- paddingLeft: C && a?.length ? 1 : 3,
98
+ clearLabel: o,
99
+ onClear: d?.length ? V : void 0,
100
+ paddingLeft: k && d?.length ? 1 : 3,
101
101
  children: e(Z, {
102
- placeholder: j,
103
- textColor: a?.length ? "neutral800" : "neutral600",
104
- children: a?.length ? C ? D : o(a) : null
102
+ placeholder: E,
103
+ textColor: d?.length ? "neutral800" : "neutral600",
104
+ children: d?.length ? k ? D : t ? t(d) : 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: d(te, {
111
- ref: g,
112
- children: [r, e(I, {
110
+ children: c(te, {
111
+ ref: w,
112
+ children: [r, e(x, {
113
113
  id: v,
114
114
  width: "100%",
115
115
  height: "1px"
@@ -117,22 +117,22 @@ const Be = ({
117
117
  })
118
118
  })
119
119
  })]
120
- }), e(le, {}), e(ae, {})]
120
+ }), e(le, {}), e(de, {})]
121
121
  })
122
122
  });
123
- }, Le = c.forwardRef(({
123
+ }, Le = a.forwardRef(({
124
124
  value: r,
125
- children: n,
126
- startIcon: o,
125
+ children: o,
126
+ startIcon: t,
127
127
  ...i
128
- }, l) => d(S, {
128
+ }, l) => c(S, {
129
129
  ref: l,
130
130
  value: r.toString(),
131
131
  ...i,
132
- children: [o && e(I, {
132
+ children: [t && e(x, {
133
133
  as: "span",
134
134
  "aria-hidden": !0,
135
- children: o
135
+ children: t
136
136
  }), e(F, {
137
137
  children: ({
138
138
  isSelected: s,
@@ -150,26 +150,26 @@ const Be = ({
150
150
  }), e(M, {
151
151
  textColor: "neutral800",
152
152
  children: e(O, {
153
- children: n
153
+ children: o
154
154
  })
155
155
  })]
156
- })), B = K(I)`
156
+ })), B = K(x)`
157
157
  border: 1px solid
158
158
  ${({
159
159
  theme: r,
160
- $selected: n,
161
- $indeterminate: o
162
- }) => n || o ? r.colors.primary600 : r.colors.neutral300};
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: n,
166
- $indeterminate: o
167
- }) => n || o ? r.colors.primary600 : r.colors.neutral0};
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: n
172
- }) => n && T`
171
+ $indeterminate: o
172
+ }) => o && T`
173
173
  &::after {
174
174
  content: '';
175
175
  display: block;
@@ -195,21 +195,21 @@ const Be = ({
195
195
  position: absolute;
196
196
  }
197
197
  `}
198
- `, Ve = c.forwardRef(({
198
+ `, Ve = a.forwardRef(({
199
199
  children: r,
200
- label: n,
201
- startIcon: o,
200
+ label: o,
201
+ startIcon: t,
202
202
  values: i = [],
203
203
  ...l
204
- }, s) => d(N, {
204
+ }, s) => c(N, {
205
205
  ref: s,
206
- children: [d(S, {
206
+ children: [c(S, {
207
207
  value: i,
208
208
  ...l,
209
- children: [o && e(I, {
209
+ children: [t && e(x, {
210
210
  as: "span",
211
211
  "aria-hidden": !0,
212
- children: o
212
+ children: t
213
213
  }), e(F, {
214
214
  children: ({
215
215
  isSelected: h,
@@ -227,7 +227,7 @@ const Be = ({
227
227
  }), e(M, {
228
228
  textColor: "neutral800",
229
229
  children: e(O, {
230
- children: n
230
+ children: o
231
231
  })
232
232
  })]
233
233
  }), r]
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),N=require("react"),l=require("./SelectParts.cjs"),q=require("../Box/Box.cjs"),V=require("../Field/Field.cjs"),H=require("../Field/FieldLabel.cjs");require("../Field/FieldInput.cjs");const z=require("../Field/FieldHint.cjs"),W=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 n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(n,i,s.get?s:{enumerable:!0,get:()=>t[i]})}}return n.default=t,Object.freeze(n)}const d=K(N),Q=({children:t,clearLabel:n="Clear",customizeContent:i=p=>p?.toString()??"",disabled:s,error:u,hint:m,id:y,label:x,labelAction:O,onChange:a,onClear:h,onReachEnd:f,placeholder:T,required:g,selectButtonTitle:X,startIcon:B,size:C="M",value:j,...R})=>{const[p,F]=d.useState(),[_,k]=d.useState(!1),o=D.useId(y),v=`${o}-hint`,P=`${o}-error`,$=r=>{a?a(typeof j=="number"?Number(r):r):F(r)},w=r=>{k(r)},L=r=>{h&&h(r),a||F("")},b=d.useRef(null),M=()=>{b.current.focus()},S=d.useRef(null),I=`intersection-${o}`,E=r=>{f&&f(r)};G.useIntersection(S,E,{selectorToWatch:`#${I}`,skipWhen:!_});const c=(typeof j<"u"?j.toString():p)??"";return e.jsx(V.Field,{hint:m,error:u,id:o,required:g,children:e.jsxs(A.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[e.jsx(H.FieldLabel,{onClick:M,action:O,children:x}),e.jsxs(l.Root,{onOpenChange:w,disabled:s,required:g,onValueChange:$,value:c,...R,children:[e.jsx(l.Trigger,{ref:b,"aria-label":x,"aria-describedby":`${v} ${P}`,id:o,startIcon:B,size:C,hasError:Boolean(u),disabled:s,clearLabel:n,onClear:c&&h?L:void 0,children:e.jsx(l.Value,{placeholder:T,textColor:c?"neutral800":"neutral600",children:c?i(c):null})}),e.jsx(l.Portal,{children:e.jsx(l.Content,{position:"popper",sideOffset:4,children:e.jsxs(l.Viewport,{ref:S,children:[t,e.jsx(q.Box,{id:I,width:"100%",height:"1px"})]})})})]}),e.jsx(z.FieldHint,{}),e.jsx(W.FieldError,{})]})})},U=d.forwardRef(({value:t,startIcon:n,children:i,...s},u)=>e.jsxs(l.Item,{ref:u,value:t.toString(),...s,children:[n&&e.jsx(q.Box,{as:"span","aria-hidden":!0,children:n}),e.jsx(J.Typography,{textColor:"neutral800",children:e.jsx(l.ItemText,{children:i})})]}));exports.SingleSelect=Q;exports.SingleSelectOption=U;
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 d, jsx as e } from "react/jsx-runtime";
2
- import * as o from "react";
3
- import { Item as q, ItemText as z, Root as H, Trigger as M, Value as P, Portal as _, Content as A, Viewport as D } from "./SelectParts.js";
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: a,
18
- clearLabel: i = "Clear",
19
- customizeContent: s = (u) => u?.toString() ?? "",
20
- disabled: l,
17
+ children: s,
18
+ clearLabel: o = "Clear",
19
+ customizeContent: l,
20
+ disabled: d,
21
21
  error: c,
22
- hint: O,
23
- id: B,
24
- label: f,
25
- labelAction: F,
22
+ hint: C,
23
+ id: O,
24
+ label: m,
25
+ labelAction: B,
26
26
  onChange: h,
27
- onClear: m,
28
- onReachEnd: g,
29
- placeholder: T,
30
- required: I,
27
+ onClear: p,
28
+ onReachEnd: u,
29
+ placeholder: F,
30
+ required: g,
31
31
  selectButtonTitle: ee,
32
- startIcon: $,
33
- size: y = "M",
34
- value: p,
35
- ...w
32
+ startIcon: T,
33
+ size: $ = "M",
34
+ value: f,
35
+ ...y
36
36
  }) => {
37
- const [u, b] = o.useState(), [V, k] = o.useState(!1), t = X(B), v = `${t}-hint`, E = `${t}-error`, L = (r) => {
38
- h ? h(typeof p == "number" ? Number(r) : r) : b(r);
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
- m && m(r), h || b("");
43
- }, S = o.useRef(null), W = () => {
44
- S.current.focus();
45
- }, x = o.useRef(null), C = `intersection-${t}`;
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
- g && g(r);
47
+ u && u(r);
48
48
  }, {
49
- selectorToWatch: `#${C}`,
49
+ selectorToWatch: `#${S}`,
50
50
  skipWhen: !V
51
51
  });
52
- const n = (typeof p < "u" ? p.toString() : u) ?? "";
52
+ const n = (typeof f < "u" ? f.toString() : w) ?? "";
53
53
  return e(G, {
54
- hint: O,
54
+ hint: C,
55
55
  error: c,
56
56
  id: t,
57
- required: I,
58
- children: d(U, {
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: F,
65
- children: f
66
- }), d(H, {
64
+ action: B,
65
+ children: m
66
+ }), a(M, {
67
67
  onOpenChange: N,
68
- disabled: l,
69
- required: I,
68
+ disabled: d,
69
+ required: g,
70
70
  onValueChange: L,
71
71
  value: n,
72
- ...w,
73
- children: [e(M, {
74
- ref: S,
75
- "aria-label": f,
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: y,
78
+ startIcon: T,
79
+ size: $,
80
80
  hasError: Boolean(c),
81
- disabled: l,
82
- clearLabel: i,
83
- onClear: n && m ? j : void 0,
84
- children: e(P, {
85
- placeholder: T,
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 ? s(n) : null
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: d(D, {
93
+ children: a(D, {
94
94
  ref: x,
95
- children: [a, e(R, {
96
- id: C,
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 = o.forwardRef(({
107
- value: a,
108
- startIcon: i,
109
- children: s,
110
- ...l
111
- }, c) => d(q, {
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: a.toString(),
114
- ...l,
115
- children: [i && e(R, {
113
+ value: s.toString(),
114
+ ...d,
115
+ children: [o && e(R, {
116
116
  as: "span",
117
117
  "aria-hidden": !0,
118
- children: i
118
+ children: o
119
119
  }), e(Z, {
120
120
  textColor: "neutral800",
121
- children: e(z, {
122
- children: s
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-alpha.4",
3
+ "version": "1.7.0-alpha.5",
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-alpha.4",
26
+ "@strapi/ui-primitives": "^1.7.0-alpha.5",
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-alpha.4",
33
+ "@strapi/icons": "^1.7.0-alpha.5",
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": "1b57b2310cec4cc64f7a92a2e73eac6dfe1ab352"
68
+ "gitHead": "d1e66b3426b71272f8a6ec4249944c32f4b77fd9"
69
69
  }