@strapi/design-system 1.8.1 → 1.9.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.
Files changed (37) hide show
  1. package/dist/BaseCheckbox/BaseCheckbox.cjs +4 -4
  2. package/dist/BaseCheckbox/BaseCheckbox.js +19 -18
  3. package/dist/CarouselInput/Carousel.cjs +4 -4
  4. package/dist/CarouselInput/Carousel.js +13 -13
  5. package/dist/CarouselInput/CarouselInput.cjs +1 -1
  6. package/dist/CarouselInput/CarouselInput.js +14 -13
  7. package/dist/Checkbox/Checkbox.cjs +2 -2
  8. package/dist/Checkbox/Checkbox.js +22 -21
  9. package/dist/Combobox/Combobox.cjs +10 -10
  10. package/dist/Combobox/Combobox.js +57 -56
  11. package/dist/DatePicker/DatePicker.cjs +9 -9
  12. package/dist/DatePicker/DatePicker.js +67 -66
  13. package/dist/DateTimePicker/DateTimePicker.cjs +3 -3
  14. package/dist/DateTimePicker/DateTimePicker.js +46 -42
  15. package/dist/JSONInput/JSONInput.cjs +33 -1
  16. package/dist/JSONInput/JSONInput.js +85 -46
  17. package/dist/Popover/Popover.cjs +3 -3
  18. package/dist/Popover/Popover.js +52 -51
  19. package/dist/Select/MultiSelect.cjs +7 -7
  20. package/dist/Select/MultiSelect.js +45 -44
  21. package/dist/Select/SingleSelect.cjs +1 -1
  22. package/dist/Select/SingleSelect.js +35 -34
  23. package/dist/TextInput/TextInput.cjs +1 -1
  24. package/dist/TextInput/TextInput.js +15 -14
  25. package/dist/TimePicker/TimePicker.cjs +2 -2
  26. package/dist/TimePicker/TimePicker.js +38 -38
  27. package/dist/ToggleInput/ToggleInput.cjs +20 -4
  28. package/dist/ToggleInput/ToggleInput.js +44 -18
  29. package/dist/Typography/Typography.cjs +1 -1
  30. package/dist/Typography/Typography.js +6 -6
  31. package/dist/Typography/utils.cjs +1 -1
  32. package/dist/Typography/utils.js +4 -5
  33. package/dist/themes/utils.cjs +9 -9
  34. package/dist/themes/utils.js +9 -9
  35. package/package.json +10 -10
  36. package/dist/JSONInput/JSONInputContainer.cjs +0 -33
  37. package/dist/JSONInput/JSONInputContainer.js +0 -39
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),b=require("react"),p=require("styled-components"),f=require("./assets/checkmark-black.svg.cjs"),k=require("./assets/checkmark.svg.cjs"),l=require("./utils.cjs"),h=require("../Box/Box.cjs"),g=e=>e&&e.__esModule?e:{default:e};function x(e){if(e&&e.__esModule)return e;const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const t=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(o,r,t.get?t:{enumerable:!0,get:()=>e[r]})}}return o.default=e,Object.freeze(o)}const s=x(b),m=g(p),$=m.default.input`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),f=require("react"),k=require("styled-components"),h=require("./assets/checkmark-black.svg.cjs"),g=require("./assets/checkmark.svg.cjs"),l=require("./utils.cjs"),m=require("../hooks/useComposeRefs.cjs"),x=require("../Box/Box.cjs"),$=e=>e&&e.__esModule?e:{default:e};function y(e){if(e&&e.__esModule)return e;const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const t=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(o,r,t.get?t:{enumerable:!0,get:()=>e[r]})}}return o.default=e,Object.freeze(o)}const n=y(f),R=$(k),_=R.default.input`
2
2
  height: ${l.getCheckboxSize};
3
3
  min-width: ${l.getCheckboxSize};
4
4
  margin: 0;
@@ -16,7 +16,7 @@
16
16
  content: '';
17
17
  display: block;
18
18
  position: relative;
19
- background: url(${k}) no-repeat no-repeat center center;
19
+ background: url(${g}) no-repeat no-repeat center center;
20
20
  width: 10px;
21
21
  height: 10px;
22
22
  left: 50%;
@@ -25,7 +25,7 @@
25
25
  }
26
26
 
27
27
  &:disabled:after {
28
- background: url(${f}) no-repeat no-repeat center center;
28
+ background: url(${h}) no-repeat no-repeat center center;
29
29
  }
30
30
  }
31
31
 
@@ -59,4 +59,4 @@
59
59
  }
60
60
  }
61
61
  }
62
- `,i=({indeterminate:e=!1,size:o="M",name:r,value:t=!1,onValueChange:n,...u})=>{const c=s.useRef(null);s.useEffect(()=>{c.current&&e?c.current.indeterminate=e:c.current.indeterminate=!1},[e]);const d=()=>{n&&n(!t)};return a.jsx(h.Box,{children:a.jsx($,{size:o,checked:t,onChange:d,type:"checkbox",ref:c,name:r,...u})})};i.displayName="BaseCheckbox";exports.BaseCheckbox=i;
62
+ `,i=n.forwardRef(({indeterminate:e=!1,size:o="M",name:r,value:t=!1,onValueChange:a,...u},d)=>{const c=n.useRef(null),p=m.useComposedRefs(c,d);n.useEffect(()=>{c.current&&e?c.current.indeterminate=e:c.current.indeterminate=!1},[e]);const b=()=>{a&&a(!t)};return s.jsx(x.Box,{children:s.jsx(_,{size:o,checked:t,onChange:b,type:"checkbox",ref:p,name:r,...u})})});i.displayName="BaseCheckbox";exports.BaseCheckbox=i;
@@ -1,11 +1,12 @@
1
- import { jsx as a } from "react/jsx-runtime";
2
- import * as c from "react";
3
- import d from "styled-components";
4
- import p from "./assets/checkmark-black.svg.js";
5
- import u from "./assets/checkmark.svg.js";
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import * as e from "react";
3
+ import u from "styled-components";
4
+ import m from "./assets/checkmark-black.svg.js";
5
+ import f from "./assets/checkmark.svg.js";
6
6
  import { getCheckboxSize as n } from "./utils.js";
7
- import { Box as b } from "../Box/Box.js";
8
- const m = d.input`
7
+ import { useComposedRefs as b } from "../hooks/useComposeRefs.js";
8
+ import { Box as h } from "../Box/Box.js";
9
+ const k = u.input`
9
10
  height: ${n};
10
11
  min-width: ${n};
11
12
  margin: 0;
@@ -23,7 +24,7 @@ const m = d.input`
23
24
  content: '';
24
25
  display: block;
25
26
  position: relative;
26
- background: url(${u}) no-repeat no-repeat center center;
27
+ background: url(${f}) no-repeat no-repeat center center;
27
28
  width: 10px;
28
29
  height: 10px;
29
30
  left: 50%;
@@ -32,7 +33,7 @@ const m = d.input`
32
33
  }
33
34
 
34
35
  &:disabled:after {
35
- background: url(${p}) no-repeat no-repeat center center;
36
+ background: url(${m}) no-repeat no-repeat center center;
36
37
  }
37
38
  }
38
39
 
@@ -66,15 +67,15 @@ const m = d.input`
66
67
  }
67
68
  }
68
69
  }
69
- `, f = ({ indeterminate: r = !1, size: l = "M", name: s, value: e = !1, onValueChange: t, ...i }) => {
70
- const o = c.useRef(null);
71
- return c.useEffect(() => {
70
+ `, x = e.forwardRef(({ indeterminate: r = !1, size: l = "M", name: s, value: t = !1, onValueChange: a, ...i }, d) => {
71
+ const o = e.useRef(null), p = b(o, d);
72
+ return e.useEffect(() => {
72
73
  o.current && r ? o.current.indeterminate = r : o.current.indeterminate = !1;
73
- }, [r]), a(b, { children: a(m, { size: l, checked: e, onChange: () => {
74
- t && t(!e);
75
- }, type: "checkbox", ref: o, name: s, ...i }) });
76
- };
77
- f.displayName = "BaseCheckbox";
74
+ }, [r]), c(h, { children: c(k, { size: l, checked: t, onChange: () => {
75
+ a && a(!t);
76
+ }, type: "checkbox", ref: p, name: s, ...i }) });
77
+ });
78
+ x.displayName = "BaseCheckbox";
78
79
  export {
79
- f as BaseCheckbox
80
+ x as BaseCheckbox
80
81
  };
@@ -1,13 +1,13 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),_=require("react"),g=require("@strapi/icons"),T=require("styled-components"),x=require("../helpers/keyboardKeys.cjs"),k=require("../Tooltip/Tooltip.cjs"),i=require("../Box/Box.cjs"),j=require("../Flex/Flex.cjs"),y=require("../Icon/Icon.cjs"),w=require("../Typography/Typography.cjs"),A=e=>e&&e.__esModule?e:{default:e};function K(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 a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:()=>e[r]})}}return n.default=e,Object.freeze(n)}const s=K(_),p=A(T),B=p.default(i.Box)`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),w=require("react"),g=require("@strapi/icons"),T=require("styled-components"),x=require("../helpers/keyboardKeys.cjs"),k=require("../Tooltip/Tooltip.cjs"),a=require("../Box/Box.cjs"),j=require("../Flex/Flex.cjs"),y=require("../Icon/Icon.cjs"),A=require("../Typography/Typography.cjs"),K=e=>e&&e.__esModule?e:{default:e};function B(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 i=B(w),p=K(T),D=p.default(a.Box)`
2
2
  grid-template-columns: auto 1fr auto;
3
3
  grid-template-areas: 'startAction slides endAction';
4
- `,D=p.default(j.Flex)`
4
+ `,O=p.default(j.Flex)`
5
5
  grid-area: slides;
6
- `,b=p.default(i.Box)`
6
+ `,b=p.default(a.Box)`
7
7
  grid-area: ${({area:e})=>e};
8
8
 
9
9
  &:focus svg path,
10
10
  &:hover svg path {
11
11
  fill: ${({theme:e})=>e.colors.neutral900};
12
12
  }
13
- `,O=({actions:e,children:n,label:r,nextLabel:a,onNext:h,onPrevious:f,previousLabel:C,secondaryLabel:l,selectedSlide:m,...R})=>{const c=s.useRef(null),u=s.useRef(null),d=s.Children.map(n,(o,q)=>s.cloneElement(o,{selected:q===m})),v=o=>{switch(o.key){case x.KeyboardKeys.RIGHT:{o.preventDefault(),u?.current&&u.current.focus(),h();break}case x.KeyboardKeys.LEFT:{o.preventDefault(),c?.current&&c.current.focus(),f();break}}};return t.jsx(i.Box,{...R,onKeyDown:v,children:t.jsxs(i.Box,{padding:2,borderColor:"neutral200",hasRadius:!0,background:"neutral100",children:[t.jsxs(B,{as:"section","aria-roledescription":"carousel","aria-label":r,display:"grid",position:"relative",children:[d&&d.length>1&&t.jsxs(t.Fragment,{children:[t.jsx(b,{as:"button",onClick:f,area:"startAction",ref:c,"aria-label":C,type:"button",children:t.jsx(y.Icon,{as:g.ChevronLeft,"aria-hidden":!0,width:"6px",height:"10px",color:"neutral600"})}),t.jsx(b,{as:"button",onClick:h,area:"endAction",ref:u,"aria-label":a,type:"button",children:t.jsx(y.Icon,{as:g.ChevronRight,"aria-hidden":!0,width:"6px",height:"10px",color:"neutral600"})})]}),t.jsx(D,{"aria-live":"polite",paddingLeft:2,paddingRight:2,width:"100%",overflow:"hidden",children:d}),e]}),l&&t.jsx(i.Box,{paddingTop:2,paddingLeft:4,paddingRight:4,children:t.jsx(k.Tooltip,{label:l,children:t.jsx(j.Flex,{justifyContent:"center",children:t.jsx(w.Typography,{variant:"pi",textColor:"neutral600",ellipsis:!0,children:l})})})})]})})};exports.Carousel=O;
13
+ `,F=i.forwardRef(({actions:e,children:n,label:r,nextLabel:s,onNext:f,onPrevious:h,previousLabel:C,secondaryLabel:l,selectedSlide:R,...m},v)=>{const c=i.useRef(null),u=i.useRef(null),d=i.Children.map(n,(o,_)=>i.cloneElement(o,{selected:_===R})),q=o=>{switch(o.key){case x.KeyboardKeys.RIGHT:{o.preventDefault(),u?.current&&u.current.focus(),f();break}case x.KeyboardKeys.LEFT:{o.preventDefault(),c?.current&&c.current.focus(),h();break}}};return t.jsx(a.Box,{ref:v,...m,onKeyDown:q,children:t.jsxs(a.Box,{padding:2,borderColor:"neutral200",hasRadius:!0,background:"neutral100",children:[t.jsxs(D,{as:"section","aria-roledescription":"carousel","aria-label":r,display:"grid",position:"relative",children:[d&&d.length>1&&t.jsxs(t.Fragment,{children:[t.jsx(b,{as:"button",onClick:h,area:"startAction",ref:c,"aria-label":C,type:"button",children:t.jsx(y.Icon,{as:g.ChevronLeft,"aria-hidden":!0,width:"6px",height:"10px",color:"neutral600"})}),t.jsx(b,{as:"button",onClick:f,area:"endAction",ref:u,"aria-label":s,type:"button",children:t.jsx(y.Icon,{as:g.ChevronRight,"aria-hidden":!0,width:"6px",height:"10px",color:"neutral600"})})]}),t.jsx(O,{"aria-live":"polite",paddingLeft:2,paddingRight:2,width:"100%",overflow:"hidden",children:d}),e]}),l&&t.jsx(a.Box,{paddingTop:2,paddingLeft:4,paddingRight:4,children:t.jsx(k.Tooltip,{label:l,children:t.jsx(j.Flex,{justifyContent:"center",children:t.jsx(A.Typography,{variant:"pi",textColor:"neutral600",ellipsis:!0,children:l})})})})]})})});exports.Carousel=F;
@@ -1,17 +1,17 @@
1
- import { jsx as e, jsxs as s, Fragment as A } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as s, Fragment as k } from "react/jsx-runtime";
2
2
  import * as o from "react";
3
- import { ChevronLeft as k, ChevronRight as D } from "@strapi/icons";
3
+ import { ChevronLeft as D, ChevronRight as K } from "@strapi/icons";
4
4
  import c from "styled-components";
5
5
  import { KeyboardKeys as h } from "../helpers/keyboardKeys.js";
6
- import { Tooltip as K } from "../Tooltip/Tooltip.js";
6
+ import { Tooltip as T } from "../Tooltip/Tooltip.js";
7
7
  import { Box as i } from "../Box/Box.js";
8
8
  import { Flex as g } from "../Flex/Flex.js";
9
9
  import { Icon as f } from "../Icon/Icon.js";
10
- import { Typography as T } from "../Typography/Typography.js";
11
- const j = c(i)`
10
+ import { Typography as j } from "../Typography/Typography.js";
11
+ const F = c(i)`
12
12
  grid-template-columns: auto 1fr auto;
13
13
  grid-template-areas: 'startAction slides endAction';
14
- `, F = c(g)`
14
+ `, E = c(g)`
15
15
  grid-area: slides;
16
16
  `, m = c(i)`
17
17
  grid-area: ${({ area: r }) => r};
@@ -20,21 +20,21 @@ const j = c(i)`
20
20
  &:hover svg path {
21
21
  fill: ${({ theme: r }) => r.colors.neutral900};
22
22
  }
23
- `, J = ({ actions: r, children: y, label: C, nextLabel: b, onNext: p, onPrevious: u, previousLabel: x, secondaryLabel: n, selectedSlide: R, ...v }) => {
24
- const a = o.useRef(null), l = o.useRef(null), d = o.Children.map(y, (t, w) => o.cloneElement(t, { selected: w === R }));
25
- return e(i, { ...v, onKeyDown: (t) => {
23
+ `, M = o.forwardRef(({ actions: r, children: y, label: C, nextLabel: b, onNext: p, onPrevious: u, previousLabel: R, secondaryLabel: a, selectedSlide: x, ...v }, w) => {
24
+ const n = o.useRef(null), l = o.useRef(null), d = o.Children.map(y, (t, A) => o.cloneElement(t, { selected: A === x }));
25
+ return e(i, { ref: w, ...v, onKeyDown: (t) => {
26
26
  switch (t.key) {
27
27
  case h.RIGHT: {
28
28
  t.preventDefault(), l?.current && l.current.focus(), p();
29
29
  break;
30
30
  }
31
31
  case h.LEFT: {
32
- t.preventDefault(), a?.current && a.current.focus(), u();
32
+ t.preventDefault(), n?.current && n.current.focus(), u();
33
33
  break;
34
34
  }
35
35
  }
36
- }, children: s(i, { padding: 2, borderColor: "neutral200", hasRadius: !0, background: "neutral100", children: [s(j, { as: "section", "aria-roledescription": "carousel", "aria-label": C, display: "grid", position: "relative", children: [d && d.length > 1 && s(A, { children: [e(m, { as: "button", onClick: u, area: "startAction", ref: a, "aria-label": x, type: "button", children: e(f, { as: k, "aria-hidden": !0, width: "6px", height: "10px", color: "neutral600" }) }), e(m, { as: "button", onClick: p, area: "endAction", ref: l, "aria-label": b, type: "button", children: e(f, { as: D, "aria-hidden": !0, width: "6px", height: "10px", color: "neutral600" }) })] }), e(F, { "aria-live": "polite", paddingLeft: 2, paddingRight: 2, width: "100%", overflow: "hidden", children: d }), r] }), n && e(i, { paddingTop: 2, paddingLeft: 4, paddingRight: 4, children: e(K, { label: n, children: e(g, { justifyContent: "center", children: e(T, { variant: "pi", textColor: "neutral600", ellipsis: !0, children: n }) }) }) })] }) });
37
- };
36
+ }, children: s(i, { padding: 2, borderColor: "neutral200", hasRadius: !0, background: "neutral100", children: [s(F, { as: "section", "aria-roledescription": "carousel", "aria-label": C, display: "grid", position: "relative", children: [d && d.length > 1 && s(k, { children: [e(m, { as: "button", onClick: u, area: "startAction", ref: n, "aria-label": R, type: "button", children: e(f, { as: D, "aria-hidden": !0, width: "6px", height: "10px", color: "neutral600" }) }), e(m, { as: "button", onClick: p, area: "endAction", ref: l, "aria-label": b, type: "button", children: e(f, { as: K, "aria-hidden": !0, width: "6px", height: "10px", color: "neutral600" }) })] }), e(E, { "aria-live": "polite", paddingLeft: 2, paddingRight: 2, width: "100%", overflow: "hidden", children: d }), r] }), a && e(i, { paddingTop: 2, paddingLeft: 4, paddingRight: 4, children: e(T, { label: a, children: e(g, { justifyContent: "center", children: e(j, { variant: "pi", textColor: "neutral600", ellipsis: !0, children: a }) }) }) })] }) });
37
+ });
38
38
  export {
39
- J as Carousel
39
+ M as Carousel
40
40
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),h=require("./Carousel.cjs"),I=require("../hooks/useId.cjs"),g=require("../Field/Field.cjs"),p=require("../Field/FieldLabel.cjs"),L=require("../Field/FieldHint.cjs"),m=require("../Field/FieldError.cjs"),C=require("../Flex/Flex.cjs"),v=({actions:n,children:s,error:t,hint:o,label:r,labelAction:l,nextLabel:d,onNext:u,onPrevious:c,previousLabel:a,required:x,secondaryLabel:F,selectedSlide:q,id:j,...b})=>{const i=I.useId(j);return e.jsx(g.Field,{hint:o,error:t,id:i,required:x,children:e.jsxs(C.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[r&&e.jsx(p.FieldLabel,{action:l,children:r}),e.jsx(h.Carousel,{actions:n,label:r,nextLabel:d,onNext:u,onPrevious:c,previousLabel:a,secondaryLabel:F,selectedSlide:q,id:i,...b,children:s}),e.jsx(L.FieldHint,{}),e.jsx(m.FieldError,{})]})})};exports.CarouselInput=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),I=require("react"),g=require("./Carousel.cjs"),p=require("../hooks/useId.cjs"),L=require("../Field/Field.cjs"),f=require("../Field/FieldLabel.cjs"),m=require("../Field/FieldHint.cjs"),C=require("../Field/FieldError.cjs"),v=require("../Flex/Flex.cjs"),y=I.forwardRef(({actions:t,children:n,error:s,hint:o,label:r,labelAction:l,nextLabel:d,onNext:u,onPrevious:c,previousLabel:a,required:x,secondaryLabel:q,selectedSlide:F,id:j,...b},h)=>{const i=p.useId(j);return e.jsx(L.Field,{hint:o,error:s,id:i,required:x,children:e.jsxs(v.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[r&&e.jsx(f.FieldLabel,{action:l,children:r}),e.jsx(g.Carousel,{ref:h,actions:t,label:r,nextLabel:d,onNext:u,onPrevious:c,previousLabel:a,secondaryLabel:q,selectedSlide:F,id:i,...b,children:n}),e.jsx(m.FieldHint,{}),e.jsx(C.FieldError,{})]})})});exports.CarouselInput=y;
@@ -1,15 +1,16 @@
1
- import { jsx as r, jsxs as F } from "react/jsx-runtime";
2
- import { Carousel as I } from "./Carousel.js";
3
- import { useId as L } from "../hooks/useId.js";
4
- import { Field as b } from "../Field/Field.js";
5
- import { FieldLabel as g } from "../Field/FieldLabel.js";
6
- import { FieldHint as j } from "../Field/FieldHint.js";
7
- import { FieldError as v } from "../Field/FieldError.js";
8
- import { Flex as C } from "../Flex/Flex.js";
9
- const w = ({ actions: i, children: t, error: n, hint: d, label: e, labelAction: m, nextLabel: l, onNext: s, onPrevious: c, previousLabel: p, required: a, secondaryLabel: u, selectedSlide: f, id: h, ...x }) => {
10
- const o = L(h);
11
- return r(b, { hint: d, error: n, id: o, required: a, children: F(C, { direction: "column", alignItems: "stretch", gap: 1, children: [e && r(g, { action: m, children: e }), r(I, { actions: i, label: e, nextLabel: l, onNext: s, onPrevious: c, previousLabel: p, secondaryLabel: u, selectedSlide: f, id: o, ...x, children: t }), r(j, {}), r(v, {})] }) });
12
- };
1
+ import { jsx as r, jsxs as I } from "react/jsx-runtime";
2
+ import { forwardRef as L } from "react";
3
+ import { Carousel as b } from "./Carousel.js";
4
+ import { useId as g } from "../hooks/useId.js";
5
+ import { Field as j } from "../Field/Field.js";
6
+ import { FieldLabel as v } from "../Field/FieldLabel.js";
7
+ import { FieldHint as C } from "../Field/FieldHint.js";
8
+ import { FieldError as q } from "../Field/FieldError.js";
9
+ import { Flex as w } from "../Flex/Flex.js";
10
+ const A = L(({ actions: i, children: t, error: m, hint: n, label: e, labelAction: d, nextLabel: l, onNext: s, onPrevious: c, previousLabel: p, required: a, secondaryLabel: f, selectedSlide: u, id: h, ...x }, F) => {
11
+ const o = g(h);
12
+ return r(j, { hint: n, error: m, id: o, required: a, children: I(w, { direction: "column", alignItems: "stretch", gap: 1, children: [e && r(v, { action: d, children: e }), r(b, { ref: F, actions: i, label: e, nextLabel: l, onNext: s, onPrevious: c, previousLabel: p, secondaryLabel: f, selectedSlide: u, id: o, ...x, children: t }), r(C, {}), r(q, {})] }) });
13
+ });
13
14
  export {
14
- w as CarouselInput
15
+ A as CarouselInput
15
16
  };
@@ -1,7 +1,7 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),d=require("styled-components"),a=require("../hooks/useId.cjs"),u=require("../Field/FieldContext.cjs"),x=require("../Typography/Typography.cjs"),h=require("../Field/Field.cjs"),b=require("../Flex/Flex.cjs"),f=require("../Box/Box.cjs"),p=require("../Field/FieldHint.cjs"),q=require("../Field/FieldError.cjs"),j=require("../BaseCheckbox/BaseCheckbox.cjs"),y=e=>e&&e.__esModule?e:{default:e},F=y(d),g=F.default(x.Typography)`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),u=require("react"),f=require("styled-components"),x=require("../hooks/useId.cjs"),b=require("../Field/FieldContext.cjs"),p=require("../Typography/Typography.cjs"),g=require("../BaseCheckbox/BaseCheckbox.cjs"),h=require("../Field/Field.cjs"),j=require("../Flex/Flex.cjs"),y=require("../Box/Box.cjs"),q=require("../Field/FieldHint.cjs"),F=require("../Field/FieldError.cjs"),_=e=>e&&e.__esModule?e:{default:e};function m(e){if(e&&e.__esModule)return e;const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,i.get?i:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const l=m(u),k=_(f),C=k.default(p.Typography)`
2
2
  display: flex;
3
3
  align-items: flex-start;
4
4
  * {
5
5
  cursor: ${({disabled:e})=>e?"not-allowed":"pointer"};
6
6
  }
7
- `,C=e=>{const{id:t}=u.useField();return r.jsx(j.BaseCheckbox,{id:t,...e})},k=({children:e,disabled:t=!1,id:l,hint:o,error:n,...c})=>{const i=a.useId(l);let s;return n?s=`${i}-error`:o&&(s=`${i}-hint`),r.jsx(h.Field,{id:i,hint:o,error:n,children:r.jsxs(b.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[r.jsxs(g,{as:"label",textColor:"neutral800",disabled:t,children:[r.jsx(C,{disabled:t,"aria-describedby":s,...c}),r.jsx(f.Box,{paddingLeft:2,children:e})]}),r.jsx(p.FieldHint,{}),r.jsx(q.FieldError,{})]})})};exports.Checkbox=k;
7
+ `,O=l.forwardRef((e,r)=>{const{id:t}=b.useField();return o.jsx(g.BaseCheckbox,{ref:r,id:t,...e})}),R=l.forwardRef(({children:e,disabled:r=!1,id:t,hint:i,error:c,...d},a)=>{const n=x.useId(t);let s;return c?s=`${n}-error`:i&&(s=`${n}-hint`),o.jsx(h.Field,{id:n,hint:i,error:c,children:o.jsxs(j.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[o.jsxs(C,{as:"label",textColor:"neutral800",disabled:r,children:[o.jsx(O,{ref:a,disabled:r,"aria-describedby":s,...d}),o.jsx(y.Box,{paddingLeft:2,children:e})]}),o.jsx(q.FieldHint,{}),o.jsx(F.FieldError,{})]})})});exports.Checkbox=R;
@@ -1,28 +1,29 @@
1
- import { jsx as r, jsxs as d } from "react/jsx-runtime";
2
- import a from "styled-components";
3
- import { useId as c } from "../hooks/useId.js";
4
- import { useField as p } from "../Field/FieldContext.js";
5
- import { Typography as f } from "../Typography/Typography.js";
6
- import { Field as x } from "../Field/Field.js";
7
- import { Flex as h } from "../Flex/Flex.js";
8
- import { Box as b } from "../Box/Box.js";
9
- import { FieldHint as u } from "../Field/FieldHint.js";
10
- import { FieldError as g } from "../Field/FieldError.js";
11
- import { BaseCheckbox as k } from "../BaseCheckbox/BaseCheckbox.js";
12
- const y = a(f)`
1
+ import { jsx as r, jsxs as s } from "react/jsx-runtime";
2
+ import * as a from "react";
3
+ import c from "styled-components";
4
+ import { useId as p } from "../hooks/useId.js";
5
+ import { useField as x } from "../Field/FieldContext.js";
6
+ import { Typography as h } from "../Typography/Typography.js";
7
+ import { BaseCheckbox as b } from "../BaseCheckbox/BaseCheckbox.js";
8
+ import { Field as u } from "../Field/Field.js";
9
+ import { Flex as g } from "../Flex/Flex.js";
10
+ import { Box as k } from "../Box/Box.js";
11
+ import { FieldHint as y } from "../Field/FieldHint.js";
12
+ import { FieldError as C } from "../Field/FieldError.js";
13
+ const F = c(h)`
13
14
  display: flex;
14
15
  align-items: flex-start;
15
16
  * {
16
17
  cursor: ${({ disabled: e }) => e ? "not-allowed" : "pointer"};
17
18
  }
18
- `, C = (e) => {
19
- const { id: o } = p();
20
- return r(k, { id: o, ...e });
21
- }, q = ({ children: e, disabled: o = !1, id: s, hint: l, error: m, ...n }) => {
22
- const i = c(s);
23
- let t;
24
- return m ? t = `${i}-error` : l && (t = `${i}-hint`), r(x, { id: i, hint: l, error: m, children: d(h, { direction: "column", alignItems: "stretch", gap: 1, children: [d(y, { as: "label", textColor: "neutral800", disabled: o, children: [r(C, { disabled: o, "aria-describedby": t, ...n }), r(b, { paddingLeft: 2, children: e })] }), r(u, {}), r(g, {})] }) });
25
- };
19
+ `, w = a.forwardRef((e, o) => {
20
+ const { id: i } = x();
21
+ return r(b, { ref: o, id: i, ...e });
22
+ }), v = a.forwardRef(({ children: e, disabled: o = !1, id: i, hint: m, error: d, ...f }, n) => {
23
+ const t = p(i);
24
+ let l;
25
+ return d ? l = `${t}-error` : m && (l = `${t}-hint`), r(u, { id: t, hint: m, error: d, children: s(g, { direction: "column", alignItems: "stretch", gap: 1, children: [s(F, { as: "label", textColor: "neutral800", disabled: o, children: [r(w, { ref: n, disabled: o, "aria-describedby": l, ...f }), r(k, { paddingLeft: 2, children: e })] }), r(y, {}), r(C, {})] }) });
26
+ });
26
27
  export {
27
- q as Checkbox
28
+ v as Checkbox
28
29
  };
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),me=require("react"),M=require("@strapi/icons"),n=require("@strapi/ui-primitives"),Ce=require("styled-components"),$e=require("../helpers/strings.cjs"),j=require("../hooks/useControllableState.cjs"),I=require("../hooks/useId.cjs"),je=require("../hooks/useIntersection.cjs"),N=require("../themes/utils.cjs"),Ie=require("../Loader/Loader.cjs"),y=require("../Box/Box.cjs"),u=require("../Typography/Typography.cjs"),b=require("../Flex/Flex.cjs"),ye=require("../Field/Field.cjs"),we=require("../Field/FieldLabel.cjs"),qe=require("../Field/FieldHint.cjs"),Fe=require("../Field/FieldError.cjs"),Te=e=>e&&e.__esModule?e:{default:e};function ve(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 i=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(r,s,i.get?i:{enumerable:!0,get:()=>e[s]})}}return r.default=e,Object.freeze(r)}const x=ve(me),a=Te(Ce),H=({allowCustomValue:e,autocomplete:r,children:s,className:i,clearLabel:d="clear",creatable:l=!1,createMessage:f=p=>`Create "${p}"`,defaultFilterValue:h,defaultTextValue:w,defaultOpen:W=!1,open:U,onOpenChange:A,disabled:m=!1,error:q,filterValue:G,hasMoreItems:J=!1,id:F,isPrintableCharacter:K,loading:C=!1,loadingMessage:Q="Loading content...",noOptionsMessage:X=()=>"No results found",onChange:T,onClear:$,onCreateOption:v,onFilterValueChange:Y,onInputChange:R,onTextValueChange:Z,onLoadMore:k,placeholder:ee="Select or enter a value",required:oe=!1,size:re="M",startIcon:O,textValue:te,value:V,...ne})=>{const[p,se]=j.useControllableState({prop:U,defaultProp:W,onChange:A}),[c,S]=j.useControllableState({prop:te,defaultProp:e&&!w?V:w,onChange:Z}),[le,B]=j.useControllableState({prop:G,defaultProp:h,onChange:Y}),P=x.useRef(null),_=x.useRef(null),ie=x.useRef(null),ae=t=>{$&&!m&&(S(""),B(""),$(t),_.current.focus())},de=t=>{se(t)},ce=t=>{S(t)},ue=t=>{B(t)},he=t=>{R&&R(t)},pe=t=>{T&&T(t)},be=t=>{k&&J&&!C&&k(t)},z=()=>{v&&c&&v(c)},E=I.useId(F),xe=I.useId(),D=`intersection-${$e.stripReactIdOfColon(xe)}`;je.useIntersection(P,be,{selectorToWatch:`#${D}`,skipWhen:!p});const ge=`${E}-hint`,fe=`${E}-error`;return o.jsxs(n.Combobox.Root,{autocomplete:r||(l?"list":"both"),onOpenChange:de,open:p,onTextValueChange:ce,textValue:c,allowCustomValue:l||e,disabled:m,required:oe,value:V,onValueChange:pe,filterValue:le,onFilterValueChange:ue,isPrintableCharacter:K,children:[o.jsxs(Oe,{$hasError:!!q,$size:re,className:i,children:[o.jsxs(b.Flex,{flex:"1",as:"span",gap:3,children:[O?o.jsx(y.Box,{as:"span","aria-hidden":!0,children:O}):null,o.jsx(Ve,{placeholder:ee,id:F,"aria-invalid":!!q,"aria-describedby":`${ge} ${fe}`,onChange:he,ref:_,...ne})]}),o.jsxs(b.Flex,{as:"span",gap:3,children:[c&&$?o.jsx(ke,{as:"button",hasRadius:!0,background:"transparent",type:"button",onClick:ae,"aria-disabled":m,"aria-label":d,title:d,ref:ie,children:o.jsx(M.Cross,{})}):null,o.jsx(Se,{children:o.jsx(M.CarretDown,{})})]})]}),o.jsx(n.Combobox.Portal,{children:o.jsx(Be,{sideOffset:4,children:o.jsxs(Pe,{ref:P,children:[s,l?o.jsx(n.Combobox.CreateItem,{onPointerUp:z,onClick:z,asChild:!0,children:o.jsx(g,{children:o.jsx(u.Typography,{children:f(c??"")})})}):null,!l&&!C?o.jsx(n.Combobox.NoValueFound,{asChild:!0,children:o.jsx(g,{$hasHover:!1,children:o.jsx(u.Typography,{children:X(c??"")})})}):null,C?o.jsx(b.Flex,{justifyContent:"center",alignItems:"center",paddingTop:2,paddingBottom:2,children:o.jsx(Ie.Loader,{small:!0,children:Q})}):null,o.jsx(y.Box,{id:D,width:"100%",height:"1px"})]})})})]})},L=({error:e,hint:r,id:s,label:i,labelAction:d,required:l=!1,...f})=>{const h=I.useId(s);return o.jsx(ye.Field,{hint:r,error:e,id:h,required:l,children:o.jsxs(b.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[o.jsx(we.FieldLabel,{action:d,children:i}),o.jsx(H,{id:h,error:e,required:l,...f}),o.jsx(qe.FieldHint,{}),o.jsx(Fe.FieldError,{})]})})},Re=e=>o.jsx(L,{...e,creatable:!0}),ke=a.default(y.Box)`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),$e=require("react"),M=require("@strapi/icons"),n=require("@strapi/ui-primitives"),je=require("styled-components"),Ie=require("../helpers/strings.cjs"),ye=require("../hooks/useComposeRefs.cjs"),I=require("../hooks/useControllableState.cjs"),y=require("../hooks/useId.cjs"),we=require("../hooks/useIntersection.cjs"),Re=require("../Loader/Loader.cjs"),N=require("../themes/utils.cjs"),x=require("../Flex/Flex.cjs"),w=require("../Box/Box.cjs"),p=require("../Typography/Typography.cjs"),qe=require("../Field/Field.cjs"),Te=require("../Field/FieldLabel.cjs"),Fe=require("../Field/FieldHint.cjs"),ve=require("../Field/FieldError.cjs"),ke=e=>e&&e.__esModule?e:{default:e};function Oe(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 l=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(r,s,l.get?l:{enumerable:!0,get:()=>e[s]})}}return r.default=e,Object.freeze(r)}const u=Oe($e),a=ke(je),H=u.forwardRef(({allowCustomValue:e,autocomplete:r,children:s,className:l,clearLabel:d="clear",creatable:i=!1,createMessage:g=b=>`Create "${b}"`,defaultFilterValue:m,defaultTextValue:h,defaultOpen:W=!1,open:U,onOpenChange:A,disabled:C=!1,error:R,filterValue:G,hasMoreItems:J=!1,id:q,isPrintableCharacter:K,loading:$=!1,loadingMessage:Q="Loading content...",noOptionsMessage:X=()=>"No results found",onChange:T,onClear:j,onCreateOption:F,onFilterValueChange:Y,onInputChange:v,onTextValueChange:Z,onLoadMore:k,placeholder:ee="Select or enter a value",required:oe=!1,size:re="M",startIcon:O,textValue:te,value:V,...ne},se)=>{const[b,le]=I.useControllableState({prop:U,defaultProp:W,onChange:A}),[c,S]=I.useControllableState({prop:te,defaultProp:e&&!h?V:h,onChange:Z}),[ie,B]=I.useControllableState({prop:G,defaultProp:m,onChange:Y}),P=u.useRef(null),_=u.useRef(null),ae=ye.useComposedRefs(_,se),de=u.useRef(null),ce=t=>{j&&!C&&(S(""),B(""),j(t),_.current.focus())},ue=t=>{le(t)},he=t=>{S(t)},pe=t=>{B(t)},be=t=>{v&&v(t)},xe=t=>{T&&T(t)},fe=t=>{k&&J&&!$&&k(t)},z=()=>{F&&c&&F(c)},E=y.useId(q),ge=y.useId(),D=`intersection-${Ie.stripReactIdOfColon(ge)}`;we.useIntersection(P,fe,{selectorToWatch:`#${D}`,skipWhen:!b});const me=`${E}-hint`,Ce=`${E}-error`;return o.jsxs(n.Combobox.Root,{autocomplete:r||(i?"list":"both"),onOpenChange:ue,open:b,onTextValueChange:he,textValue:c,allowCustomValue:i||e,disabled:C,required:oe,value:V,onValueChange:xe,filterValue:ie,onFilterValueChange:pe,isPrintableCharacter:K,children:[o.jsxs(Be,{$hasError:!!R,$size:re,className:l,children:[o.jsxs(x.Flex,{flex:"1",as:"span",gap:3,children:[O?o.jsx(w.Box,{as:"span","aria-hidden":!0,children:O}):null,o.jsx(Pe,{placeholder:ee,id:q,"aria-invalid":!!R,"aria-describedby":`${me} ${Ce}`,onChange:be,ref:ae,...ne})]}),o.jsxs(x.Flex,{as:"span",gap:3,children:[c&&j?o.jsx(Se,{as:"button",hasRadius:!0,background:"transparent",type:"button",onClick:ce,"aria-disabled":C,"aria-label":d,title:d,ref:de,children:o.jsx(M.Cross,{})}):null,o.jsx(_e,{children:o.jsx(M.CarretDown,{})})]})]}),o.jsx(n.Combobox.Portal,{children:o.jsx(ze,{sideOffset:4,children:o.jsxs(Ee,{ref:P,children:[s,i?o.jsx(n.Combobox.CreateItem,{onPointerUp:z,onClick:z,asChild:!0,children:o.jsx(f,{children:o.jsx(p.Typography,{children:g(c??"")})})}):null,!i&&!$?o.jsx(n.Combobox.NoValueFound,{asChild:!0,children:o.jsx(f,{$hasHover:!1,children:o.jsx(p.Typography,{children:X(c??"")})})}):null,$?o.jsx(x.Flex,{justifyContent:"center",alignItems:"center",paddingTop:2,paddingBottom:2,children:o.jsx(Re.Loader,{small:!0,children:Q})}):null,o.jsx(w.Box,{id:D,width:"100%",height:"1px"})]})})})]})}),L=u.forwardRef(({error:e,hint:r,id:s,label:l,labelAction:d,required:i=!1,...g},m)=>{const h=y.useId(s);return o.jsx(qe.Field,{hint:r,error:e,id:h,required:i,children:o.jsxs(x.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[l?o.jsx(Te.FieldLabel,{action:d,children:l}):null,o.jsx(H,{ref:m,id:h,error:e,required:i,...g}),o.jsx(Fe.FieldHint,{}),o.jsx(ve.FieldError,{})]})})}),Ve=e=>o.jsx(L,{...e,creatable:!0}),Se=a.default(w.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
- `,Oe=a.default(n.Combobox.Trigger)`
12
+ `,Be=a.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]};
@@ -35,7 +35,7 @@
35
35
  }
36
36
 
37
37
  ${({theme:e,$hasError:r})=>N.inputFocusStyle()({theme:e,hasError:r})};
38
- `,Ve=a.default(n.Combobox.TextInput)`
38
+ `,Pe=a.default(n.Combobox.TextInput)`
39
39
  width: 100%;
40
40
  font-size: ${14/16}rem;
41
41
  color: ${({theme:e})=>e.colors.neutral800};
@@ -50,7 +50,7 @@
50
50
  &[aria-disabled='true'] {
51
51
  cursor: inherit;
52
52
  }
53
- `,Se=a.default(n.Combobox.Icon)`
53
+ `,_e=a.default(n.Combobox.Icon)`
54
54
  & > svg {
55
55
  width: ${6/16}rem;
56
56
 
@@ -62,7 +62,7 @@
62
62
  &[aria-disabled='true'] {
63
63
  cursor: inherit;
64
64
  }
65
- `,Be=a.default(n.Combobox.Content)`
65
+ `,ze=a.default(n.Combobox.Content)`
66
66
  background: ${({theme:e})=>e.colors.neutral0};
67
67
  box-shadow: ${({theme:e})=>e.shadows.filterShadow};
68
68
  border: 1px solid ${({theme:e})=>e.colors.neutral150};
@@ -71,9 +71,9 @@
71
71
  /* This is from the design-system figma file. */
72
72
  max-height: 15rem;
73
73
  z-index: ${({theme:e})=>e.zIndices[1]};
74
- `,Pe=a.default(n.Combobox.Viewport)`
74
+ `,Ee=a.default(n.Combobox.Viewport)`
75
75
  padding: ${({theme:e})=>e.spaces[1]};
76
- `,_e=x.forwardRef(({children:e,value:r,disabled:s,textValue:i,...d},l)=>o.jsx(n.Combobox.ComboboxItem,{asChild:!0,value:r,disabled:s,textValue:i,children:o.jsx(g,{ref:l,...d,children:o.jsx(n.Combobox.ItemText,{asChild:!0,children:o.jsx(u.Typography,{children:e})})})})),g=a.default.div`
76
+ `,De=u.forwardRef(({children:e,value:r,disabled:s,textValue:l,...d},i)=>o.jsx(n.Combobox.ComboboxItem,{asChild:!0,value:r,disabled:s,textValue:l,children:o.jsx(f,{ref:i,...d,children:o.jsx(n.Combobox.ItemText,{asChild:!0,children:o.jsx(p.Typography,{children:e})})})})),f=a.default.div`
77
77
  width: 100%;
78
78
  border: none;
79
79
  text-align: left;
@@ -86,7 +86,7 @@
86
86
  &[data-state='checked'] {
87
87
  background-color: ${({theme:e})=>e.colors.primary100};
88
88
 
89
- ${u.Typography} {
89
+ ${p.Typography} {
90
90
  color: ${({theme:e})=>e.colors.primary600};
91
91
  font-weight: bold;
92
92
  }
@@ -99,9 +99,9 @@
99
99
  }
100
100
 
101
101
  &[data-highlighted] {
102
- ${u.Typography} {
102
+ ${p.Typography} {
103
103
  color: ${({theme:e})=>e.colors.primary600};
104
104
  font-weight: bold;
105
105
  }
106
106
  }
107
- `;exports.Combobox=L;exports.ComboboxInput=H;exports.CreatableCombobox=Re;exports.Option=_e;exports.OptionBox=g;
107
+ `;exports.Combobox=L;exports.ComboboxInput=H;exports.CreatableCombobox=Ve;exports.Option=De;exports.OptionBox=f;
@@ -1,65 +1,66 @@
1
- import { jsx as r, jsxs as d } from "react/jsx-runtime";
2
- import * as m from "react";
3
- import { Cross as me, CarretDown as ge } from "@strapi/icons";
1
+ import { jsxs as c, jsx as r } from "react/jsx-runtime";
2
+ import * as u from "react";
3
+ import { Cross as be, CarretDown as $e } from "@strapi/icons";
4
4
  import { Combobox as n } from "@strapi/ui-primitives";
5
5
  import l from "styled-components";
6
- import { stripReactIdOfColon as be } from "../helpers/strings.js";
7
- import { useControllableState as I } from "../hooks/useControllableState.js";
8
- import { useId as w } from "../hooks/useId.js";
9
- import { useIntersection as $e } from "../hooks/useIntersection.js";
10
- import { getThemeSize as Ce, inputFocusStyle as xe } from "../themes/utils.js";
11
- import { Loader as Ie } from "../Loader/Loader.js";
12
- import { Box as R } from "../Box/Box.js";
13
- import { Typography as h } from "../Typography/Typography.js";
6
+ import { stripReactIdOfColon as Ce } from "../helpers/strings.js";
7
+ import { useComposedRefs as xe } from "../hooks/useComposeRefs.js";
8
+ import { useControllableState as w } from "../hooks/useControllableState.js";
9
+ import { useId as R } from "../hooks/useId.js";
10
+ import { useIntersection as Ie } from "../hooks/useIntersection.js";
11
+ import { Loader as we } from "../Loader/Loader.js";
12
+ import { getThemeSize as Re, inputFocusStyle as ve } from "../themes/utils.js";
14
13
  import { Flex as g } from "../Flex/Flex.js";
15
- import { Field as we } from "../Field/Field.js";
16
- import { FieldLabel as Re } from "../Field/FieldLabel.js";
17
- import { FieldHint as ve } from "../Field/FieldHint.js";
18
- import { FieldError as ye } from "../Field/FieldError.js";
19
- const ke = ({ allowCustomValue: e, autocomplete: o, children: c, className: u, clearLabel: a = "clear", creatable: i = !1, createMessage: b = (f) => `Create "${f}"`, defaultFilterValue: p, defaultTextValue: y, defaultOpen: W = !1, open: L, onOpenChange: U, disabled: $ = !1, error: k, filterValue: A, hasMoreItems: G = !1, id: V, isPrintableCharacter: J, loading: C = !1, loadingMessage: K = "Loading content...", noOptionsMessage: M = () => "No results found", onChange: T, onClear: x, onCreateOption: F, onFilterValueChange: Q, onInputChange: O, onTextValueChange: X, onLoadMore: z, placeholder: Y = "Select or enter a value", required: Z = !1, size: _ = "M", startIcon: B, textValue: ee, value: P, ...re }) => {
20
- const [f, oe] = I({
14
+ import { Box as v } from "../Box/Box.js";
15
+ import { Typography as f } from "../Typography/Typography.js";
16
+ import { Field as ye } from "../Field/Field.js";
17
+ import { FieldLabel as ke } from "../Field/FieldLabel.js";
18
+ import { FieldHint as Te } from "../Field/FieldHint.js";
19
+ import { FieldError as Ve } from "../Field/FieldError.js";
20
+ const Fe = u.forwardRef(({ allowCustomValue: e, autocomplete: o, children: h, className: a, clearLabel: s = "clear", creatable: i = !1, createMessage: b = (m) => `Create "${m}"`, defaultFilterValue: $, defaultTextValue: p, defaultOpen: W = !1, open: L, onOpenChange: U, disabled: C = !1, error: k, filterValue: A, hasMoreItems: G = !1, id: T, isPrintableCharacter: J, loading: x = !1, loadingMessage: K = "Loading content...", noOptionsMessage: M = () => "No results found", onChange: V, onClear: I, onCreateOption: F, onFilterValueChange: Q, onInputChange: O, onTextValueChange: X, onLoadMore: z, placeholder: Y = "Select or enter a value", required: Z = !1, size: _ = "M", startIcon: B, textValue: ee, value: P, ...re }, oe) => {
21
+ const [m, te] = w({
21
22
  prop: L,
22
23
  defaultProp: W,
23
24
  onChange: U
24
- }), [s, S] = I({
25
+ }), [d, S] = w({
25
26
  prop: ee,
26
- defaultProp: e && !y ? P : y,
27
+ defaultProp: e && !p ? P : p,
27
28
  onChange: X
28
- }), [te, j] = I({
29
+ }), [ne, j] = w({
29
30
  prop: A,
30
- defaultProp: p,
31
+ defaultProp: $,
31
32
  onChange: Q
32
- }), E = m.useRef(null), q = m.useRef(null), ne = m.useRef(null), ie = (t) => {
33
- x && !$ && (S(""), j(""), x(t), q.current.focus());
34
- }, le = (t) => {
35
- oe(t);
36
- }, ae = (t) => {
37
- S(t);
33
+ }), E = u.useRef(null), q = u.useRef(null), ie = xe(q, oe), le = u.useRef(null), ae = (t) => {
34
+ I && !C && (S(""), j(""), I(t), q.current.focus());
38
35
  }, se = (t) => {
39
- j(t);
36
+ te(t);
40
37
  }, de = (t) => {
41
- O && O(t);
38
+ S(t);
42
39
  }, ce = (t) => {
43
- T && T(t);
40
+ j(t);
44
41
  }, ue = (t) => {
45
- z && G && !C && z(t);
42
+ O && O(t);
43
+ }, he = (t) => {
44
+ V && V(t);
45
+ }, pe = (t) => {
46
+ z && G && !x && z(t);
46
47
  }, N = () => {
47
- F && s && F(s);
48
- }, D = w(V), he = w(), H = `intersection-${be(he)}`;
49
- $e(E, ue, {
48
+ F && d && F(d);
49
+ }, D = R(T), fe = R(), H = `intersection-${Ce(fe)}`;
50
+ Ie(E, pe, {
50
51
  selectorToWatch: `#${H}`,
51
52
  /**
52
53
  * We need to know when the select is open because only then will viewportRef
53
54
  * not be null. Because it uses a portal that (sensibly) is not mounted 24/7.
54
55
  */
55
- skipWhen: !f
56
+ skipWhen: !m
56
57
  });
57
- const pe = `${D}-hint`, fe = `${D}-error`;
58
- return d(n.Root, { autocomplete: o || (i ? "list" : "both"), onOpenChange: le, open: f, onTextValueChange: ae, textValue: s, allowCustomValue: i || e, disabled: $, required: Z, value: P, onValueChange: ce, filterValue: te, onFilterValueChange: se, isPrintableCharacter: J, children: [d(Fe, { $hasError: !!k, $size: _, className: u, children: [d(g, { flex: "1", as: "span", gap: 3, children: [B ? r(R, { as: "span", "aria-hidden": !0, children: B }) : null, r(Oe, { placeholder: Y, id: V, "aria-invalid": !!k, "aria-describedby": `${pe} ${fe}`, onChange: de, ref: q, ...re })] }), d(g, { as: "span", gap: 3, children: [s && x ? r(Te, { as: "button", hasRadius: !0, background: "transparent", type: "button", onClick: ie, "aria-disabled": $, "aria-label": a, title: a, ref: ne, children: r(me, {}) }) : null, r(ze, { children: r(ge, {}) })] })] }), r(n.Portal, { children: r(Be, { sideOffset: 4, children: d(Pe, { ref: E, children: [c, i ? r(n.CreateItem, { onPointerUp: N, onClick: N, asChild: !0, children: r(v, { children: r(h, { children: b(s ?? "") }) }) }) : null, !i && !C ? r(n.NoValueFound, { asChild: !0, children: r(v, { $hasHover: !1, children: r(h, { children: M(s ?? "") }) }) }) : null, C ? r(g, { justifyContent: "center", alignItems: "center", paddingTop: 2, paddingBottom: 2, children: r(Ie, { small: !0, children: K }) }) : null, r(R, { id: H, width: "100%", height: "1px" })] }) }) })] });
59
- }, Ve = ({ error: e, hint: o, id: c, label: u, labelAction: a, required: i = !1, ...b }) => {
60
- const p = w(c);
61
- return r(we, { hint: o, error: e, id: p, required: i, children: d(g, { direction: "column", alignItems: "stretch", gap: 1, children: [r(Re, { action: a, children: u }), r(ke, { id: p, error: e, required: i, ...b }), r(ve, {}), r(ye, {})] }) });
62
- }, Ye = (e) => r(Ve, { ...e, creatable: !0 }), Te = l(R)`
58
+ const me = `${D}-hint`, ge = `${D}-error`;
59
+ return c(n.Root, { autocomplete: o || (i ? "list" : "both"), onOpenChange: se, open: m, onTextValueChange: de, textValue: d, allowCustomValue: i || e, disabled: C, required: Z, value: P, onValueChange: he, filterValue: ne, onFilterValueChange: ce, isPrintableCharacter: J, children: [c(Be, { $hasError: !!k, $size: _, className: a, children: [c(g, { flex: "1", as: "span", gap: 3, children: [B ? r(v, { as: "span", "aria-hidden": !0, children: B }) : null, r(Pe, { placeholder: Y, id: T, "aria-invalid": !!k, "aria-describedby": `${me} ${ge}`, onChange: ue, ref: ie, ...re })] }), c(g, { as: "span", gap: 3, children: [d && I ? r(ze, { as: "button", hasRadius: !0, background: "transparent", type: "button", onClick: ae, "aria-disabled": C, "aria-label": s, title: s, ref: le, children: r(be, {}) }) : null, r(Se, { children: r($e, {}) })] })] }), r(n.Portal, { children: r(je, { sideOffset: 4, children: c(Ee, { ref: E, children: [h, i ? r(n.CreateItem, { onPointerUp: N, onClick: N, asChild: !0, children: r(y, { children: r(f, { children: b(d ?? "") }) }) }) : null, !i && !x ? r(n.NoValueFound, { asChild: !0, children: r(y, { $hasHover: !1, children: r(f, { children: M(d ?? "") }) }) }) : null, x ? r(g, { justifyContent: "center", alignItems: "center", paddingTop: 2, paddingBottom: 2, children: r(we, { small: !0, children: K }) }) : null, r(v, { id: H, width: "100%", height: "1px" })] }) }) })] });
60
+ }), Oe = u.forwardRef(({ error: e, hint: o, id: h, label: a, labelAction: s, required: i = !1, ...b }, $) => {
61
+ const p = R(h);
62
+ return r(ye, { hint: o, error: e, id: p, required: i, children: c(g, { direction: "column", alignItems: "stretch", gap: 1, children: [a ? r(ke, { action: s, children: a }) : null, r(Fe, { ref: $, id: p, error: e, required: i, ...b }), r(Te, {}), r(Ve, {})] }) });
63
+ }), rr = (e) => r(Oe, { ...e, creatable: !0 }), ze = l(v)`
63
64
  border: none;
64
65
 
65
66
  svg {
@@ -70,7 +71,7 @@ const ke = ({ allowCustomValue: e, autocomplete: o, children: c, className: u, c
70
71
  svg path {
71
72
  fill: ${({ theme: e }) => e.colors.neutral600};
72
73
  }
73
- `, Fe = l(n.Trigger)`
74
+ `, Be = l(n.Trigger)`
74
75
  position: relative;
75
76
  border: 1px solid ${({ theme: e, $hasError: o }) => o ? e.colors.danger600 : e.colors.neutral200};
76
77
  padding-right: ${({ theme: e }) => e.spaces[3]};
@@ -82,7 +83,7 @@ const ke = ({ allowCustomValue: e, autocomplete: o, children: c, className: u, c
82
83
  align-items: center;
83
84
  justify-content: space-between;
84
85
  gap: ${({ theme: e }) => e.spaces[4]};
85
- min-height: ${({ theme: e, $size: o }) => Ce("input")({ theme: e, size: o })};
86
+ min-height: ${({ theme: e, $size: o }) => Re("input")({ theme: e, size: o })};
86
87
 
87
88
  &[data-disabled] {
88
89
  color: ${({ theme: e }) => e.colors.neutral600};
@@ -95,8 +96,8 @@ const ke = ({ allowCustomValue: e, autocomplete: o, children: c, className: u, c
95
96
  outline: none;
96
97
  }
97
98
 
98
- ${({ theme: e, $hasError: o }) => xe()({ theme: e, hasError: o })};
99
- `, Oe = l(n.TextInput)`
99
+ ${({ theme: e, $hasError: o }) => ve()({ theme: e, hasError: o })};
100
+ `, Pe = l(n.TextInput)`
100
101
  width: 100%;
101
102
  font-size: ${14 / 16}rem;
102
103
  color: ${({ theme: e }) => e.colors.neutral800};
@@ -111,7 +112,7 @@ const ke = ({ allowCustomValue: e, autocomplete: o, children: c, className: u, c
111
112
  &[aria-disabled='true'] {
112
113
  cursor: inherit;
113
114
  }
114
- `, ze = l(n.Icon)`
115
+ `, Se = l(n.Icon)`
115
116
  & > svg {
116
117
  width: ${6 / 16}rem;
117
118
 
@@ -123,7 +124,7 @@ const ke = ({ allowCustomValue: e, autocomplete: o, children: c, className: u, c
123
124
  &[aria-disabled='true'] {
124
125
  cursor: inherit;
125
126
  }
126
- `, Be = l(n.Content)`
127
+ `, je = l(n.Content)`
127
128
  background: ${({ theme: e }) => e.colors.neutral0};
128
129
  box-shadow: ${({ theme: e }) => e.shadows.filterShadow};
129
130
  border: 1px solid ${({ theme: e }) => e.colors.neutral150};
@@ -132,9 +133,9 @@ const ke = ({ allowCustomValue: e, autocomplete: o, children: c, className: u, c
132
133
  /* This is from the design-system figma file. */
133
134
  max-height: 15rem;
134
135
  z-index: ${({ theme: e }) => e.zIndices[1]};
135
- `, Pe = l(n.Viewport)`
136
+ `, Ee = l(n.Viewport)`
136
137
  padding: ${({ theme: e }) => e.spaces[1]};
137
- `, Ze = m.forwardRef(({ children: e, value: o, disabled: c, textValue: u, ...a }, i) => r(n.ComboboxItem, { asChild: !0, value: o, disabled: c, textValue: u, children: r(v, { ref: i, ...a, children: r(n.ItemText, { asChild: !0, children: r(h, { children: e }) }) }) })), v = l.div`
138
+ `, or = u.forwardRef(({ children: e, value: o, disabled: h, textValue: a, ...s }, i) => r(n.ComboboxItem, { asChild: !0, value: o, disabled: h, textValue: a, children: r(y, { ref: i, ...s, children: r(n.ItemText, { asChild: !0, children: r(f, { children: e }) }) }) })), y = l.div`
138
139
  width: 100%;
139
140
  border: none;
140
141
  text-align: left;
@@ -147,7 +148,7 @@ const ke = ({ allowCustomValue: e, autocomplete: o, children: c, className: u, c
147
148
  &[data-state='checked'] {
148
149
  background-color: ${({ theme: e }) => e.colors.primary100};
149
150
 
150
- ${h} {
151
+ ${f} {
151
152
  color: ${({ theme: e }) => e.colors.primary600};
152
153
  font-weight: bold;
153
154
  }
@@ -160,16 +161,16 @@ const ke = ({ allowCustomValue: e, autocomplete: o, children: c, className: u, c
160
161
  }
161
162
 
162
163
  &[data-highlighted] {
163
- ${h} {
164
+ ${f} {
164
165
  color: ${({ theme: e }) => e.colors.primary600};
165
166
  font-weight: bold;
166
167
  }
167
168
  }
168
169
  `;
169
170
  export {
170
- Ve as Combobox,
171
- ke as ComboboxInput,
172
- Ye as CreatableCombobox,
173
- Ze as Option,
174
- v as OptionBox
171
+ Oe as Combobox,
172
+ Fe as ComboboxInput,
173
+ rr as CreatableCombobox,
174
+ or as Option,
175
+ y as OptionBox
175
176
  };