@solibo/solibo-ui 2.2.15 → 2.2.16

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 (45) hide show
  1. package/dist/assets/index.css +1 -1
  2. package/dist/assets/index10.css +1 -1
  3. package/dist/assets/index13.css +1 -1
  4. package/dist/assets/index3.css +1 -1
  5. package/dist/assets/index30.css +1 -1
  6. package/dist/assets/index41.css +1 -1
  7. package/dist/assets/index42.css +1 -1
  8. package/dist/assets/index53.css +1 -1
  9. package/dist/assets/index54.css +1 -1
  10. package/dist/assets/index6.css +1 -1
  11. package/dist/components/card/index.cjs +1 -1
  12. package/dist/components/card/index.js +50 -50
  13. package/dist/components/checkbox/index.cjs +1 -1
  14. package/dist/components/checkbox/index.js +24 -23
  15. package/dist/components/dropdown/index.cjs +1 -1
  16. package/dist/components/dropdown/index.js +200 -190
  17. package/dist/components/dropzone/index.cjs +1 -1
  18. package/dist/components/dropzone/index.js +84 -56
  19. package/dist/components/editor/index.cjs +1 -1
  20. package/dist/components/editor/index.js +1 -1
  21. package/dist/components/input/index.cjs +1 -1
  22. package/dist/components/input/index.js +1 -1
  23. package/dist/components/label/index.cjs +1 -1
  24. package/dist/components/label/index.js +16 -14
  25. package/dist/components/list/index.cjs +1 -1
  26. package/dist/components/list/index.js +20 -20
  27. package/dist/components/page-layout/index.cjs +1 -1
  28. package/dist/components/page-layout/index.js +13 -13
  29. package/dist/components/radio/index.cjs +1 -1
  30. package/dist/components/radio/index.js +13 -13
  31. package/dist/components/search/index.cjs +1 -1
  32. package/dist/components/search/index.js +1 -1
  33. package/dist/components/textarea/index.cjs +1 -1
  34. package/dist/components/textarea/index.js +39 -32
  35. package/dist/components/toggle/index.cjs +1 -1
  36. package/dist/components/toggle/index.js +10 -10
  37. package/dist/index-6TyCExT0.js +87 -0
  38. package/dist/index-DEQcFR32.cjs +1 -0
  39. package/dist/index.cjs +1 -1
  40. package/dist/index.d.ts +31 -8
  41. package/dist/index.js +1 -1
  42. package/dist/tokens.json +1 -1
  43. package/package.json +1 -1
  44. package/dist/index-Bre56YYa.js +0 -90
  45. package/dist/index-CHJNMNDr.cjs +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index41.css');const s=require("react/jsx-runtime"),C=require("classix"),r=require("react"),V=require("../button/index.cjs"),$e=require("../../icons-BIdcCH-v.cjs"),fe=require("../../index-CHJNMNDr.cjs"),De=require("../list/index.cjs"),Fe=require("../loading/index.cjs"),F=require("../../index-BQoXmNo3.cjs");function L(t){return typeof t=="string"||typeof t=="number"?String(t):Array.isArray(t)?t.map(L).join(" "):r.isValidElement(t)?L(t.props.children):""}function Le(t){return r.isValidElement(t)&&t.type==="option"}function Me(t){return r.isValidElement(t)&&t.type==="optgroup"}function Qe(t){return r.isValidElement(t)&&t.type===r.Fragment}function We(t){return r.isValidElement(t)&&t.type===F.Select}function Z(t,c,i=!1){const o=[];return r.Children.forEach(t,n=>{if(Qe(n))o.push(...Z(n.props.children,c,i));else if(Le(n)){const a=L(n.props.children).trim(),h=n.props.value!=null?String(n.props.value):a;o.push({disabled:i||!!n.props.disabled,groupLabel:c,hidden:!!n.props.hidden,isPlaceholder:!!(n.props.hidden&&h===""),label:n.props.children,selected:!!n.props.selected,text:a,value:h})}else Me(n)&&o.push(...Z(n.props.children,n.props.label,i||!!n.props.disabled))}),o}function ze(t){const c=t.trim();if(!c)return null;const o=[.../[*?]/.test(c)?c:`*${c}*`].map(n=>n==="*"?".*":n==="?"?".":n.replace(/[|\\{}()[\]^$+.,]/g,"\\$&")).join("");return new RegExp(`^${o}$`,"i")}function Ge(t,c){const i=ze(c),o=t.filter(n=>!n.hidden&&!n.isPlaceholder);return i?o.filter(n=>i.test([n.groupLabel,n.text,n.value].filter(Boolean).join(" "))):o}function Pe(t,c){return t.find(i=>i.value===c)??t.find(i=>i.isPlaceholder)??t[0]}function Te(t,c,i){var o,n;return c!=null?String(c):i!=null?String(i):((o=t.find(a=>a.selected))==null?void 0:o.value)??((n=t[0])==null?void 0:n.value)??""}function Ae(t){if(We(t)){const{children:c,placeholder:i,...o}=t.props;return{children:s.jsxs(s.Fragment,{children:[i&&s.jsx("option",{hidden:!0,value:"",children:i}),c]}),props:o}}return{children:t.props.children,props:t.props}}const Ke="_combobox_5r227_3",Oe="_dropdown_5r227_20",He="_empty_5r227_25",Je="_group_5r227_26",Ue="_placeholder_5r227_27",Xe="_filter_5r227_35",Ye="_native_5r227_45",Ze="_option_5r227_55",et="_options_5r227_76",tt="_panel_5r227_83",nt="_selected_5r227_108",st="_text_5r227_112",rt="_trigger_5r227_120",lt="_minimal_5r227_157",it="_inline_5r227_217",ot="_label_5r227_249",l={combobox:Ke,"combobox-input":"_combobox-input_5r227_12",dropdown:Oe,empty:He,group:Je,placeholder:Ue,filter:Xe,native:Ye,option:Ze,options:et,panel:tt,selected:nt,text:st,trigger:rt,minimal:lt,inline:it,label:ot,"inline-field":"_inline-field_5r227_255"};function pe(t,c){return{"--icon-svg":$e.iconSVG(t,c)}}const ct=({children:t,className:c,combobox:i=!1,createOption:o,emptyLabel:n="No matches found",errorLabel:a,onRetry:h,retryLabel:me="Retry",label:b,filterOptions:_e=!0,hasNextPage:v=!1,loading:m=!1,loadMoreLabel:be="Load more",onLoadMore:g,onOpenChange:I,onSearchChange:B,searchValue:M,renderOption:Q,searchPlaceholder:W="Filter",selectedItems:ve,variant:j="default",...xe})=>{const z=Ae(t),{defaultValue:ye,onChange:G,value:P,...he}=z.props,u=F.sanitizeSelectProps(he),{className:ge,...je}=u,ee=r.useRef(null),te=r.useRef(null),k=r.useId(),ne=r.useRef(null),x=r.useRef(null),se=r.useRef(null),re=r.useRef(null),T=r.useRef(!1),A=r.useRef(!1),K=r.useRef(g),le=!!g,w=Z(z.children),E=P!=null,O=Te(w,P,ye),[H,J]=r.useState(()=>O),[d,we]=r.useState(!1),[Ee,Re]=r.useState(""),R=M??Ee,N=r.useCallback(e=>{M===void 0&&Re(e),B==null||B(e)},[B,M]),p=r.useCallback(e=>{T.current===e||e&&u.disabled||(T.current=e,we(e),I==null||I(e),e||N(""))},[I,u.disabled,N]),q=E?String(P):H,ie={default:F.resolveColor("--colors-semantic-content-secondary"),white:F.resolveColor("--color-white","white")},oe=j==="minimal"?ie.white:ie.default,$=Pe(w,q),Ne=pe("CaretDown",oe),Se=pe("MagnifyingGlass",oe),U=Ge(w,_e?R:""),y=R.trim(),D=!!(i&&o&&y&&o.isValid(y)),Ce=b&&j==="inline"?fe.formatInlineLabel(b):b,ce=e=>e?(Q==null?void 0:Q({groupLabel:e.groupLabel,isSelected:e.value===q,label:e.label,text:e.text,value:e.value}))??e.label:"Select an option";r.useEffect(()=>{!E&&!w.some(e=>e.value===H)&&J(O)},[O,H,E,w]),r.useEffect(()=>{var e;d&&((e=x.current)==null||e.focus())},[d]),r.useEffect(()=>{if(!d)return;const e=f=>{var _;(_=te.current)!=null&&_.contains(f.target)||p(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[p,d]),r.useEffect(()=>{K.current=g},[g]),r.useEffect(()=>{u.disabled&&p(!1)},[p,u.disabled]);const X=r.useCallback(()=>{!T.current||u.disabled||m||a||!v||!K.current||A.current||(A.current=!0,K.current())},[a,v,m,u.disabled]);r.useEffect(()=>{if(A.current=!1,!d||u.disabled||m||a||!v||!le)return;const e=re.current,f=se.current;if(!e||!f||typeof IntersectionObserver>"u")return;let _=!0;const S=new IntersectionObserver(ke=>{_&&ke.some(qe=>qe.isIntersecting)&&X()},{root:f});return S.observe(e),()=>{_=!1,S.disconnect()}},[d,m,a,v,le,X,U.length,R,u.disabled]);const Ve=e=>{E||J(e.target.value),G==null||G(e)},Y=()=>{var e;p(!1),i||(e=ee.current)==null||e.focus()},ae=()=>{var e;N(""),p(!0),(e=x.current)==null||e.focus()},ue=()=>{!o||!D||(o.onCreate(y),ae())},Ie=e=>{var S;E||J(e);const f=ne.current;if(!f){Y();return}const _=(S=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value"))==null?void 0:S.set;_==null||_.call(f,e),f.dispatchEvent(new Event("change",{bubbles:!0})),i?ae():Y()},Be=e=>{e.key==="Escape"&&Y(),e.key==="Enter"&&e.target===x.current&&D&&(e.preventDefault(),ue())},de=s.jsxs("div",{className:C(l.dropdown,j==="inline"&&l.inline,j==="minimal"&&l.minimal,c),onKeyDown:Be,ref:te,...xe,"data-component":"dropdown",children:[s.jsx("select",{...je,"aria-hidden":"true",className:C(l.native,ge),onChange:Ve,ref:ne,tabIndex:-1,value:q,children:z.children}),i?s.jsxs("div",{className:l.combobox,onClick:()=>{var e;return(e=x.current)==null?void 0:e.focus()},children:[ve,s.jsx("input",{"aria-autocomplete":"list","aria-expanded":d,"aria-label":u["aria-label"]??b??W,className:l["combobox-input"],disabled:u.disabled,onChange:e=>{N(e.target.value),p(!0)},onClick:()=>p(!0),onFocus:()=>p(!0),placeholder:W||void 0,ref:x,role:"combobox",type:"text",value:R})]}):s.jsx(V.Button,{"aria-expanded":d,"aria-haspopup":"dialog","aria-labelledby":b?`${k} ${k}-value`:void 0,className:C(l.trigger,($==null?void 0:$.isPlaceholder)&&l.placeholder),"data-open":d?"true":void 0,disabled:u.disabled,onClick:()=>p(!d),ref:ee,style:Ne,variant:"simple",children:s.jsx("span",{className:l.text,id:`${k}-value`,children:ce($)})}),d&&s.jsxs("div",{className:l.panel,children:[!i&&s.jsx(fe.Input,{"aria-label":"Filter",className:l.filter,icon:"MagnifyingGlass",onChange:e=>N(e.target.value),placeholder:W,ref:x,style:Se,type:"search",value:R}),s.jsxs(De.List,{"aria-label":"Dropdown","aria-busy":m||void 0,className:l.options,ref:se,children:[U.map(e=>{const f=e.value===q;return s.jsx("li",{"data-component":"dropdown",children:s.jsxs(V.Button,{"aria-label":f?`${e.text}, selected`:e.text,className:C(l.option,f&&l.selected),disabled:e.disabled,onClick:()=>Ie(e.value),variant:"tertiary",children:[s.jsx("span",{className:l.text,children:ce(e)}),e.groupLabel&&s.jsx("small",{className:l.group,children:e.groupLabel})]})},`${e.groupLabel??"root"}-${e.value}`)}),D&&o&&s.jsx("li",{children:s.jsx(V.Button,{"aria-label":L(o.render(y))||y,className:l.option,onClick:ue,variant:"tertiary",children:s.jsx("span",{className:l.text,children:o.render(y)})})}),U.length===0&&!D&&!m&&!a&&!v&&s.jsx("li",{className:l.empty,children:n}),a&&s.jsxs("li",{className:l.empty,children:[s.jsx("span",{role:"alert",children:a}),h&&s.jsx(V.Button,{disabled:m,onClick:h,variant:"tertiary",children:me})]}),m&&s.jsx("li",{"aria-label":"Loading",className:l.empty,role:"status",children:s.jsx(Fe.Loading,{size:"small"})}),v&&g&&!a&&s.jsx("li",{ref:re,children:s.jsx(V.Button,{className:l.option,disabled:m,onClick:X,variant:"tertiary",children:be})})]})]})]});return b?s.jsxs("div",{className:C(l.label,j==="inline"&&l["inline-field"]),"data-component":"dropdown",children:[s.jsx("span",{id:k,children:Ce}),de]}):de};exports.Dropdown=ct;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index41.css');const s=require("react/jsx-runtime"),B=require("classix"),i=require("react"),V=require("../button/index.cjs"),Te=require("../form/index.cjs"),Ae=require("../../icons-BIdcCH-v.cjs"),he=require("../../index-DEQcFR32.cjs"),Ke=require("../label/index.cjs"),Oe=require("../list/index.cjs"),He=require("../loading/index.cjs"),q=require("../../index-BQoXmNo3.cjs");function W(t){return typeof t=="string"||typeof t=="number"?String(t):Array.isArray(t)?t.map(W).join(" "):i.isValidElement(t)?W(t.props.children):""}function Je(t){return i.isValidElement(t)&&t.type==="option"}function Ue(t){return i.isValidElement(t)&&t.type==="optgroup"}function Xe(t){return i.isValidElement(t)&&t.type===i.Fragment}function Ye(t){return i.isValidElement(t)&&t.type===q.Select}function ie(t,o,r=!1){const a=[];return i.Children.forEach(t,n=>{if(Xe(n))a.push(...ie(n.props.children,o,r));else if(Je(n)){const v=W(n.props.children).trim(),$=n.props.value!=null?String(n.props.value):v;a.push({disabled:r||!!n.props.disabled,groupLabel:o,hidden:!!n.props.hidden,isPlaceholder:!!(n.props.hidden&&$===""),label:n.props.children,selected:!!n.props.selected,text:v,value:$})}else Ue(n)&&a.push(...ie(n.props.children,n.props.label,r||!!n.props.disabled))}),a}function Ze(t){const o=t.trim();if(!o)return null;const a=[.../[*?]/.test(o)?o:`*${o}*`].map(n=>n==="*"?".*":n==="?"?".":n.replace(/[|\\{}()[\]^$+.,]/g,"\\$&")).join("");return new RegExp(`^${a}$`,"i")}function et(t,o){const r=Ze(o),a=t.filter(n=>!n.hidden&&!n.isPlaceholder);return r?a.filter(n=>r.test([n.groupLabel,n.text,n.value].filter(Boolean).join(" "))):a}function tt(t,o){return t.find(r=>r.value===o)??t.find(r=>r.isPlaceholder)??t[0]}function nt(t,o,r){var a,n;return o!=null?String(o):r!=null?String(r):((a=t.find(v=>v.selected))==null?void 0:a.value)??((n=t[0])==null?void 0:n.value)??""}function st(t){if(Ye(t)){const{children:o,placeholder:r,...a}=t.props;return{children:s.jsxs(s.Fragment,{children:[r&&s.jsx("option",{hidden:!0,value:"",children:r}),o]}),props:a}}return{children:t.props.children,props:t.props}}const it="_combobox_10eim_3",rt="_dropdown_10eim_21",lt="_empty_10eim_29",ot="_group_10eim_30",at="_placeholder_10eim_31",ct="_filter_10eim_39",ut="_native_10eim_49",dt="_option_10eim_59",ft="_options_10eim_85",pt="_panel_10eim_95",mt="_selected_10eim_120",bt="_text_10eim_124",_t="_trigger_10eim_132",vt="_minimal_10eim_177",xt="_inline_10eim_237",yt="_field_10eim_271",ht="_label_10eim_275",l={combobox:it,"combobox-input":"_combobox-input_10eim_12",dropdown:rt,empty:lt,group:ot,placeholder:at,filter:ct,native:ut,option:dt,options:ft,panel:pt,selected:mt,text:bt,trigger:_t,minimal:vt,inline:xt,field:yt,label:ht,"inline-field":"_inline-field_10eim_280"};function je(t,o){return{"--icon-svg":Ae.iconSVG(t,o)}}const jt=({children:t,className:o,combobox:r=!1,description:a,errorMessage:n,invalid:v=!1,searchable:$,createOption:x,emptyLabel:ge="No matches found",errorLabel:b,onRetry:re,retryLabel:we="Retry",label:_,filterOptions:Ee=!0,hasNextPage:y=!1,loading:m=!1,loadMoreLabel:Re="Load more",onLoadMore:R,onOpenChange:k,onSearchChange:D,searchValue:z,renderOption:G,searchPlaceholder:M="Filter",selectedItems:Ne,variant:h="default",...Se})=>{const P=st(t),{defaultValue:Ie,onChange:T,value:A,...Ce}=P.props,c=q.sanitizeSelectProps(Ce),{className:Be,...Ve}=c,le=i.useRef(null),oe=i.useRef(null),j=i.useId(),K=v&&n?`${j}-error`:void 0,ae=a?`${j}-description`:void 0,ce=[c["aria-describedby"],ae,K].filter(Boolean).join(" ")||void 0,ue=v?!0:c["aria-invalid"],de=i.useRef(null),g=i.useRef(null),O=i.useRef(null),fe=i.useRef(null),H=i.useRef(!1),J=i.useRef(!1),U=i.useRef(R),pe=!!R,w=ie(P.children),X=$??w.filter(e=>!e.hidden).length>8,N=A!=null,Y=nt(w,A,Ie),[Z,ee]=i.useState(()=>Y),[f,qe]=i.useState(!1),[$e,ke]=i.useState(""),S=z??$e,I=i.useCallback(e=>{z===void 0&&ke(e),D==null||D(e)},[D,z]),p=i.useCallback(e=>{H.current===e||e&&c.disabled||(H.current=e,qe(e),k==null||k(e),e||I(""))},[k,c.disabled,I]),F=N?String(A):Z,me={default:q.resolveColor("--colors-semantic-content-secondary"),white:q.resolveColor("--color-white","white")},be=c.disabled?q.resolveColor("--colors-semantic-content-disabled"):h==="minimal"?me.white:me.default,L=tt(w,F),De=je("CaretDown",be),Fe=je("MagnifyingGlass",be),te=et(w,Ee?S:""),E=S.trim(),Q=!!(r&&x&&E&&x.isValid(E)),Le=_&&h==="inline"?he.formatInlineLabel(_):_,_e=e=>e?(G==null?void 0:G({groupLabel:e.groupLabel,isSelected:e.value===F,label:e.label,text:e.text,value:e.value}))??e.label:"Select an option";i.useEffect(()=>{!N&&!w.some(e=>e.value===Z)&&ee(Y)},[Y,Z,N,w]),i.useEffect(()=>{var e,u,d;f&&(r||X?(e=g.current)==null||e.focus():(d=(u=O.current)==null?void 0:u.querySelector("button:not(:disabled)"))==null||d.focus())},[f,r,X]),i.useEffect(()=>{if(!f)return;const e=u=>{var d;(d=oe.current)!=null&&d.contains(u.target)||p(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[p,f]),i.useEffect(()=>{U.current=R},[R]),i.useEffect(()=>{c.disabled&&p(!1)},[p,c.disabled]);const ne=i.useCallback(()=>{!H.current||c.disabled||m||b||!y||!U.current||J.current||(J.current=!0,U.current())},[b,y,m,c.disabled]);i.useEffect(()=>{if(J.current=!1,!f||c.disabled||m||b||!y||!pe)return;const e=fe.current,u=O.current;if(!e||!u||typeof IntersectionObserver>"u")return;let d=!0;const C=new IntersectionObserver(Me=>{d&&Me.some(Pe=>Pe.isIntersecting)&&ne()},{root:u});return C.observe(e),()=>{d=!1,C.disconnect()}},[f,m,b,y,pe,ne,te.length,S,c.disabled]);const Qe=e=>{N||ee(e.target.value),T==null||T(e)},se=()=>{var e;p(!1),r||(e=le.current)==null||e.focus()},ve=()=>{var e;I(""),p(!0),(e=g.current)==null||e.focus()},xe=()=>{!x||!Q||(x.onCreate(E),ve())},We=e=>{var C;N||ee(e);const u=de.current;if(!u){se();return}const d=(C=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value"))==null?void 0:C.set;d==null||d.call(u,e),u.dispatchEvent(new Event("change",{bubbles:!0})),r?ve():se()},ze=e=>{e.key==="Escape"&&se(),e.key==="Enter"&&e.target===g.current&&Q&&(e.preventDefault(),xe())},ye=s.jsxs("div",{className:B(l.dropdown,h==="inline"&&l.inline,h==="minimal"&&l.minimal,o),onKeyDown:ze,ref:oe,...Se,children:[s.jsx("select",{...Ve,"aria-hidden":"true",className:B(l.native,Be),onChange:Qe,ref:de,tabIndex:-1,value:F,children:P.children}),r?s.jsxs("div",{className:l.combobox,onClick:()=>{var e;return(e=g.current)==null?void 0:e.focus()},children:[Ne,s.jsx("input",{"aria-describedby":ce,"aria-invalid":ue,"aria-autocomplete":"list","aria-expanded":f,"aria-label":c["aria-label"]??_??M,className:l["combobox-input"],disabled:c.disabled,onChange:e=>{I(e.target.value),p(!0)},onClick:()=>p(!0),onFocus:()=>p(!0),placeholder:M||void 0,ref:g,role:"combobox",type:"text",value:S})]}):s.jsx(V.Button,{"aria-describedby":ce,"aria-invalid":ue,"aria-label":_?void 0:c["aria-label"],"aria-expanded":f,"aria-haspopup":"dialog","aria-labelledby":_?`${j} ${j}-value`:void 0,className:B(l.trigger,(L==null?void 0:L.isPlaceholder)&&l.placeholder),"data-open":f?"true":void 0,disabled:c.disabled,onClick:()=>p(!f),ref:le,style:De,variant:"simple",children:s.jsx("span",{className:l.text,id:`${j}-value`,children:_e(L)})}),f&&s.jsxs("div",{className:l.panel,children:[!r&&X&&s.jsx(he.Input,{"aria-label":"Filter",className:l.filter,icon:"MagnifyingGlass",onChange:e=>I(e.target.value),placeholder:M,ref:g,style:Fe,type:"search",value:S}),s.jsxs(Oe.List,{"aria-label":"Dropdown","aria-busy":m||void 0,className:l.options,ref:O,children:[te.map(e=>{const u=e.value===F;return s.jsx("li",{"data-component":"dropdown",children:s.jsxs(V.Button,{"aria-label":u?`${e.text}, selected`:e.text,className:B(l.option,u&&l.selected),disabled:e.disabled,onClick:()=>We(e.value),variant:"tertiary",children:[s.jsx("span",{className:l.text,children:_e(e)}),e.groupLabel&&s.jsx("small",{className:l.group,children:e.groupLabel})]})},`${e.groupLabel??"root"}-${e.value}`)}),Q&&x&&s.jsx("li",{children:s.jsx(V.Button,{"aria-label":W(x.render(E))||E,className:l.option,onClick:xe,variant:"tertiary",children:s.jsx("span",{className:l.text,children:x.render(E)})})}),te.length===0&&!Q&&!m&&!b&&!y&&s.jsx("li",{className:l.empty,children:ge}),b&&s.jsxs("li",{className:l.empty,children:[s.jsx("span",{role:"alert",children:b}),re&&s.jsx(V.Button,{disabled:m,onClick:re,variant:"tertiary",children:we})]}),m&&s.jsx("li",{"aria-label":"Loading",className:l.empty,role:"status",children:s.jsx(He.Loading,{size:"small"})}),y&&R&&!b&&s.jsx("li",{ref:fe,children:s.jsx(V.Button,{className:l.option,disabled:m,onClick:ne,variant:"tertiary",children:Re})})]})]})]}),Ge=_||a?s.jsxs("div",{className:B(l.label,h==="inline"&&l["inline-field"]),children:[s.jsx(Ke.Label,{label:Le,labelId:_?j:void 0,description:a,descriptionId:ae,inline:h==="inline"}),ye]}):ye;return s.jsxs("div",{className:l.field,"data-component":"dropdown",children:[Ge,K&&s.jsx(Te.FieldError,{errorId:K,errorMessage:n})]})};exports.Dropdown=jt;
@@ -1,77 +1,79 @@
1
- import { jsxs as _, Fragment as We, jsx as o } from "react/jsx-runtime";
2
- import $ from "classix";
3
- import ze, { Children as Ge, isValidElement as B, useRef as b, useId as Me, useState as te, useCallback as ne, useEffect as w } from "react";
4
- import { Button as k } from "../button/index.js";
5
- import { i as Pe } from "../../icons-DVeBguFb.js";
6
- import { f as qe, I as Ae } from "../../index-Bre56YYa.js";
7
- import { List as Ke } from "../list/index.js";
8
- import { Loading as Te } from "../loading/index.js";
9
- import { S as He, s as Oe, r as _e } from "../../index-GPsHvb4d.js";
10
- import '../../assets/index41.css';function z(t) {
11
- return typeof t == "string" || typeof t == "number" ? String(t) : Array.isArray(t) ? t.map(z).join(" ") : B(t) ? z(t.props.children) : "";
1
+ import { jsxs as b, Fragment as Oe, jsx as l } from "react/jsx-runtime";
2
+ import k from "classix";
3
+ import Je, { Children as Ue, isValidElement as j, useRef as m, useId as Xe, useState as se, useCallback as oe, useEffect as E } from "react";
4
+ import { Button as D } from "../button/index.js";
5
+ import { FieldError as Ye } from "../form/index.js";
6
+ import { i as Ze } from "../../icons-DVeBguFb.js";
7
+ import { f as et, I as tt } from "../../index-6TyCExT0.js";
8
+ import { Label as nt } from "../label/index.js";
9
+ import { List as rt } from "../list/index.js";
10
+ import { Loading as it } from "../loading/index.js";
11
+ import { S as lt, s as st, r as ae } from "../../index-GPsHvb4d.js";
12
+ import '../../assets/index41.css';function q(t) {
13
+ return typeof t == "string" || typeof t == "number" ? String(t) : Array.isArray(t) ? t.map(q).join(" ") : j(t) ? q(t.props.children) : "";
12
14
  }
13
- function Je(t) {
14
- return B(t) && t.type === "option";
15
+ function ot(t) {
16
+ return j(t) && t.type === "option";
15
17
  }
16
- function Ue(t) {
17
- return B(t) && t.type === "optgroup";
18
+ function at(t) {
19
+ return j(t) && t.type === "optgroup";
18
20
  }
19
- function Xe(t) {
20
- return B(t) && t.type === ze.Fragment;
21
+ function ct(t) {
22
+ return j(t) && t.type === Je.Fragment;
21
23
  }
22
- function Ye(t) {
23
- return B(t) && t.type === He;
24
+ function dt(t) {
25
+ return j(t) && t.type === lt;
24
26
  }
25
- function re(t, i, l = !1) {
26
- const s = [];
27
- return Ge.forEach(t, (n) => {
28
- if (Xe(n))
29
- s.push(...re(n.props.children, i, l));
30
- else if (Je(n)) {
31
- const a = z(n.props.children).trim(), x = n.props.value != null ? String(n.props.value) : a;
32
- s.push({
33
- disabled: l || !!n.props.disabled,
34
- groupLabel: i,
27
+ function ce(t, s, r = !1) {
28
+ const o = [];
29
+ return Ue.forEach(t, (n) => {
30
+ if (ct(n))
31
+ o.push(...ce(n.props.children, s, r));
32
+ else if (ot(n)) {
33
+ const y = q(n.props.children).trim(), F = n.props.value != null ? String(n.props.value) : y;
34
+ o.push({
35
+ disabled: r || !!n.props.disabled,
36
+ groupLabel: s,
35
37
  hidden: !!n.props.hidden,
36
- isPlaceholder: !!(n.props.hidden && x === ""),
38
+ isPlaceholder: !!(n.props.hidden && F === ""),
37
39
  label: n.props.children,
38
40
  selected: !!n.props.selected,
39
- text: a,
40
- value: x
41
+ text: y,
42
+ value: F
41
43
  });
42
- } else Ue(n) && s.push(...re(n.props.children, n.props.label, l || !!n.props.disabled));
43
- }), s;
44
+ } else at(n) && o.push(...ce(n.props.children, n.props.label, r || !!n.props.disabled));
45
+ }), o;
44
46
  }
45
- function Ze(t) {
46
- const i = t.trim();
47
- if (!i) return null;
48
- const s = [.../[*?]/.test(i) ? i : `*${i}*`].map((n) => n === "*" ? ".*" : n === "?" ? "." : n.replace(/[|\\{}()[\]^$+.,]/g, "\\$&")).join("");
49
- return new RegExp(`^${s}$`, "i");
47
+ function ut(t) {
48
+ const s = t.trim();
49
+ if (!s) return null;
50
+ const o = [.../[*?]/.test(s) ? s : `*${s}*`].map((n) => n === "*" ? ".*" : n === "?" ? "." : n.replace(/[|\\{}()[\]^$+.,]/g, "\\$&")).join("");
51
+ return new RegExp(`^${o}$`, "i");
50
52
  }
51
- function et(t, i) {
52
- const l = Ze(i), s = t.filter((n) => !n.hidden && !n.isPlaceholder);
53
- return l ? s.filter((n) => l.test([n.groupLabel, n.text, n.value].filter(Boolean).join(" "))) : s;
53
+ function ft(t, s) {
54
+ const r = ut(s), o = t.filter((n) => !n.hidden && !n.isPlaceholder);
55
+ return r ? o.filter((n) => r.test([n.groupLabel, n.text, n.value].filter(Boolean).join(" "))) : o;
54
56
  }
55
- function tt(t, i) {
56
- return t.find((l) => l.value === i) ?? t.find((l) => l.isPlaceholder) ?? t[0];
57
+ function pt(t, s) {
58
+ return t.find((r) => r.value === s) ?? t.find((r) => r.isPlaceholder) ?? t[0];
57
59
  }
58
- function nt(t, i, l) {
59
- var s, n;
60
- return i != null ? String(i) : l != null ? String(l) : ((s = t.find((a) => a.selected)) == null ? void 0 : s.value) ?? ((n = t[0]) == null ? void 0 : n.value) ?? "";
60
+ function mt(t, s, r) {
61
+ var o, n;
62
+ return s != null ? String(s) : r != null ? String(r) : ((o = t.find((y) => y.selected)) == null ? void 0 : o.value) ?? ((n = t[0]) == null ? void 0 : n.value) ?? "";
61
63
  }
62
- function rt(t) {
63
- if (Ye(t)) {
64
+ function bt(t) {
65
+ if (dt(t)) {
64
66
  const {
65
- children: i,
66
- placeholder: l,
67
- ...s
67
+ children: s,
68
+ placeholder: r,
69
+ ...o
68
70
  } = t.props;
69
71
  return {
70
- children: /* @__PURE__ */ _(We, { children: [
71
- l && /* @__PURE__ */ o("option", { hidden: !0, value: "", children: l }),
72
- i
72
+ children: /* @__PURE__ */ b(Oe, { children: [
73
+ r && /* @__PURE__ */ l("option", { hidden: !0, value: "", children: r }),
74
+ s
73
75
  ] }),
74
- props: s
76
+ props: o
75
77
  };
76
78
  }
77
79
  return {
@@ -79,175 +81,183 @@ function rt(t) {
79
81
  props: t.props
80
82
  };
81
83
  }
82
- const lt = "_combobox_5r227_3", st = "_dropdown_5r227_20", it = "_empty_5r227_25", ot = "_group_5r227_26", at = "_placeholder_5r227_27", ct = "_filter_5r227_35", ut = "_native_5r227_45", dt = "_option_5r227_55", pt = "_options_5r227_76", ft = "_panel_5r227_83", mt = "_selected_5r227_108", bt = "_text_5r227_112", _t = "_trigger_5r227_120", vt = "_minimal_5r227_157", yt = "_inline_5r227_217", ht = "_label_5r227_249", r = {
83
- combobox: lt,
84
- "combobox-input": "_combobox-input_5r227_12",
85
- dropdown: st,
86
- empty: it,
87
- group: ot,
88
- placeholder: at,
89
- filter: ct,
90
- native: ut,
91
- option: dt,
92
- options: pt,
93
- panel: ft,
94
- selected: mt,
95
- text: bt,
96
- trigger: _t,
97
- minimal: vt,
98
- inline: yt,
99
- label: ht,
100
- "inline-field": "_inline-field_5r227_255"
84
+ const vt = "_combobox_10eim_3", _t = "_dropdown_10eim_21", yt = "_empty_10eim_29", ht = "_group_10eim_30", gt = "_placeholder_10eim_31", wt = "_filter_10eim_39", xt = "_native_10eim_49", Nt = "_option_10eim_59", It = "_options_10eim_85", St = "_panel_10eim_95", Et = "_selected_10eim_120", Rt = "_text_10eim_124", $t = "_trigger_10eim_132", Ct = "_minimal_10eim_177", Bt = "_inline_10eim_237", Vt = "_field_10eim_271", kt = "_label_10eim_275", i = {
85
+ combobox: vt,
86
+ "combobox-input": "_combobox-input_10eim_12",
87
+ dropdown: _t,
88
+ empty: yt,
89
+ group: ht,
90
+ placeholder: gt,
91
+ filter: wt,
92
+ native: xt,
93
+ option: Nt,
94
+ options: It,
95
+ panel: St,
96
+ selected: Et,
97
+ text: Rt,
98
+ trigger: $t,
99
+ minimal: Ct,
100
+ inline: Bt,
101
+ field: Vt,
102
+ label: kt,
103
+ "inline-field": "_inline-field_10eim_280"
101
104
  };
102
- function ve(t, i) {
105
+ function Se(t, s) {
103
106
  return {
104
- "--icon-svg": Pe(t, i)
107
+ "--icon-svg": Ze(t, s)
105
108
  };
106
109
  }
107
- const Vt = ({
110
+ const At = ({
108
111
  children: t,
109
- className: i,
110
- combobox: l = !1,
111
- createOption: s,
112
- emptyLabel: n = "No matches found",
113
- errorLabel: a,
114
- onRetry: x,
115
- retryLabel: ye = "Retry",
116
- label: v,
117
- filterOptions: he = !0,
118
- hasNextPage: y = !1,
119
- loading: f = !1,
120
- loadMoreLabel: ge = "Load more",
121
- onLoadMore: N,
122
- onOpenChange: D,
123
- onSearchChange: j,
124
- searchValue: G,
125
- renderOption: M,
126
- searchPlaceholder: P = "Filter",
127
- selectedItems: we,
128
- variant: S = "default",
129
- ...xe
112
+ className: s,
113
+ combobox: r = !1,
114
+ description: o,
115
+ errorMessage: n,
116
+ invalid: y = !1,
117
+ searchable: F,
118
+ createOption: h,
119
+ emptyLabel: Ee = "No matches found",
120
+ errorLabel: v,
121
+ onRetry: de,
122
+ retryLabel: Re = "Retry",
123
+ label: _,
124
+ filterOptions: $e = !0,
125
+ hasNextPage: g = !1,
126
+ loading: p = !1,
127
+ loadMoreLabel: Ce = "Load more",
128
+ onLoadMore: R,
129
+ onOpenChange: L,
130
+ onSearchChange: Q,
131
+ searchValue: M,
132
+ renderOption: P,
133
+ searchPlaceholder: A = "Filter",
134
+ selectedItems: Be,
135
+ variant: w = "default",
136
+ ...Ve
130
137
  }) => {
131
- const q = rt(t), {
132
- defaultValue: Ne,
133
- onChange: A,
134
- value: K,
135
- ...Se
136
- } = q.props, c = Oe(Se), {
137
- className: Ie,
138
- ...Ee
139
- } = c, le = b(null), se = b(null), F = Me(), ie = b(null), h = b(null), oe = b(null), ae = b(null), T = b(!1), H = b(!1), O = b(N), ce = !!N, I = re(q.children), E = K != null, J = nt(I, K, Ne), [U, X] = te(() => J), [u, Re] = te(!1), [Ce, Ve] = te(""), R = G ?? Ce, C = ne((e) => {
140
- G === void 0 && Ve(e), j == null || j(e);
141
- }, [j, G]), p = ne((e) => {
142
- T.current === e || e && c.disabled || (T.current = e, Re(e), D == null || D(e), e || C(""));
143
- }, [D, c.disabled, C]), L = E ? String(K) : U, ue = {
144
- default: _e("--colors-semantic-content-secondary"),
145
- white: _e("--color-white", "white")
146
- }, de = S === "minimal" ? ue.white : ue.default, Q = tt(I, L), $e = ve("CaretDown", de), ke = ve("MagnifyingGlass", de), Y = et(I, he ? R : ""), g = R.trim(), W = !!(l && s && g && s.isValid(g)), Be = v && S === "inline" ? qe(v) : v, pe = (e) => e ? (M == null ? void 0 : M({
138
+ const K = bt(t), {
139
+ defaultValue: ke,
140
+ onChange: T,
141
+ value: H,
142
+ ...De
143
+ } = K.props, a = st(De), {
144
+ className: je,
145
+ ...Fe
146
+ } = a, ue = m(null), fe = m(null), x = Xe(), O = y && n ? `${x}-error` : void 0, pe = o ? `${x}-description` : void 0, me = [a["aria-describedby"], pe, O].filter(Boolean).join(" ") || void 0, be = y ? !0 : a["aria-invalid"], ve = m(null), N = m(null), J = m(null), _e = m(null), U = m(!1), X = m(!1), Y = m(R), ye = !!R, I = ce(K.children), Z = F ?? I.filter((e) => !e.hidden).length > 8, $ = H != null, ee = mt(I, H, ke), [te, ne] = se(() => ee), [u, Le] = se(!1), [Qe, We] = se(""), C = M ?? Qe, B = oe((e) => {
147
+ M === void 0 && We(e), Q == null || Q(e);
148
+ }, [Q, M]), f = oe((e) => {
149
+ U.current === e || e && a.disabled || (U.current = e, Le(e), L == null || L(e), e || B(""));
150
+ }, [L, a.disabled, B]), W = $ ? String(H) : te, he = {
151
+ default: ae("--colors-semantic-content-secondary"),
152
+ white: ae("--color-white", "white")
153
+ }, ge = a.disabled ? ae("--colors-semantic-content-disabled") : w === "minimal" ? he.white : he.default, z = pt(I, W), ze = Se("CaretDown", ge), Ge = Se("MagnifyingGlass", ge), re = ft(I, $e ? C : ""), S = C.trim(), G = !!(r && h && S && h.isValid(S)), qe = _ && w === "inline" ? et(_) : _, we = (e) => e ? (P == null ? void 0 : P({
147
154
  groupLabel: e.groupLabel,
148
- isSelected: e.value === L,
155
+ isSelected: e.value === W,
149
156
  label: e.label,
150
157
  text: e.text,
151
158
  value: e.value
152
159
  })) ?? e.label : "Select an option";
153
- w(() => {
154
- !E && !I.some((e) => e.value === U) && X(J);
155
- }, [J, U, E, I]), w(() => {
156
- var e;
157
- u && ((e = h.current) == null || e.focus());
158
- }, [u]), w(() => {
160
+ E(() => {
161
+ !$ && !I.some((e) => e.value === te) && ne(ee);
162
+ }, [ee, te, $, I]), E(() => {
163
+ var e, c, d;
164
+ u && (r || Z ? (e = N.current) == null || e.focus() : (d = (c = J.current) == null ? void 0 : c.querySelector("button:not(:disabled)")) == null || d.focus());
165
+ }, [u, r, Z]), E(() => {
159
166
  if (!u)
160
167
  return;
161
- const e = (d) => {
162
- var m;
163
- (m = se.current) != null && m.contains(d.target) || p(!1);
168
+ const e = (c) => {
169
+ var d;
170
+ (d = fe.current) != null && d.contains(c.target) || f(!1);
164
171
  };
165
172
  return document.addEventListener("mousedown", e), () => {
166
173
  document.removeEventListener("mousedown", e);
167
174
  };
168
- }, [p, u]), w(() => {
169
- O.current = N;
170
- }, [N]), w(() => {
171
- c.disabled && p(!1);
172
- }, [p, c.disabled]);
173
- const Z = ne(() => {
174
- !T.current || c.disabled || f || a || !y || !O.current || H.current || (H.current = !0, O.current());
175
- }, [a, y, f, c.disabled]);
176
- w(() => {
177
- if (H.current = !1, !u || c.disabled || f || a || !y || !ce) return;
178
- const e = ae.current, d = oe.current;
179
- if (!e || !d || typeof IntersectionObserver > "u") return;
180
- let m = !0;
181
- const V = new IntersectionObserver((Le) => {
182
- m && Le.some((Qe) => Qe.isIntersecting) && Z();
175
+ }, [f, u]), E(() => {
176
+ Y.current = R;
177
+ }, [R]), E(() => {
178
+ a.disabled && f(!1);
179
+ }, [f, a.disabled]);
180
+ const ie = oe(() => {
181
+ !U.current || a.disabled || p || v || !g || !Y.current || X.current || (X.current = !0, Y.current());
182
+ }, [v, g, p, a.disabled]);
183
+ E(() => {
184
+ if (X.current = !1, !u || a.disabled || p || v || !g || !ye) return;
185
+ const e = _e.current, c = J.current;
186
+ if (!e || !c || typeof IntersectionObserver > "u") return;
187
+ let d = !0;
188
+ const V = new IntersectionObserver((Te) => {
189
+ d && Te.some((He) => He.isIntersecting) && ie();
183
190
  }, {
184
- root: d
191
+ root: c
185
192
  });
186
193
  return V.observe(e), () => {
187
- m = !1, V.disconnect();
194
+ d = !1, V.disconnect();
188
195
  };
189
- }, [u, f, a, y, ce, Z, Y.length, R, c.disabled]);
190
- const De = (e) => {
191
- E || X(e.target.value), A == null || A(e);
192
- }, ee = () => {
196
+ }, [u, p, v, g, ye, ie, re.length, C, a.disabled]);
197
+ const Me = (e) => {
198
+ $ || ne(e.target.value), T == null || T(e);
199
+ }, le = () => {
193
200
  var e;
194
- p(!1), l || (e = le.current) == null || e.focus();
195
- }, fe = () => {
201
+ f(!1), r || (e = ue.current) == null || e.focus();
202
+ }, xe = () => {
196
203
  var e;
197
- C(""), p(!0), (e = h.current) == null || e.focus();
198
- }, me = () => {
199
- !s || !W || (s.onCreate(g), fe());
200
- }, je = (e) => {
204
+ B(""), f(!0), (e = N.current) == null || e.focus();
205
+ }, Ne = () => {
206
+ !h || !G || (h.onCreate(S), xe());
207
+ }, Pe = (e) => {
201
208
  var V;
202
- E || X(e);
203
- const d = ie.current;
204
- if (!d) {
205
- ee();
209
+ $ || ne(e);
210
+ const c = ve.current;
211
+ if (!c) {
212
+ le();
206
213
  return;
207
214
  }
208
- const m = (V = Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype, "value")) == null ? void 0 : V.set;
209
- m == null || m.call(d, e), d.dispatchEvent(new Event("change", {
215
+ const d = (V = Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype, "value")) == null ? void 0 : V.set;
216
+ d == null || d.call(c, e), c.dispatchEvent(new Event("change", {
210
217
  bubbles: !0
211
- })), l ? fe() : ee();
212
- }, Fe = (e) => {
213
- e.key === "Escape" && ee(), e.key === "Enter" && e.target === h.current && W && (e.preventDefault(), me());
214
- }, be = /* @__PURE__ */ _("div", { className: $(r.dropdown, S === "inline" && r.inline, S === "minimal" && r.minimal, i), onKeyDown: Fe, ref: se, ...xe, "data-component": "dropdown", children: [
215
- /* @__PURE__ */ o("select", { ...Ee, "aria-hidden": "true", className: $(r.native, Ie), onChange: De, ref: ie, tabIndex: -1, value: L, children: q.children }),
216
- l ? /* @__PURE__ */ _("div", { className: r.combobox, onClick: () => {
218
+ })), r ? xe() : le();
219
+ }, Ae = (e) => {
220
+ e.key === "Escape" && le(), e.key === "Enter" && e.target === N.current && G && (e.preventDefault(), Ne());
221
+ }, Ie = /* @__PURE__ */ b("div", { className: k(i.dropdown, w === "inline" && i.inline, w === "minimal" && i.minimal, s), onKeyDown: Ae, ref: fe, ...Ve, children: [
222
+ /* @__PURE__ */ l("select", { ...Fe, "aria-hidden": "true", className: k(i.native, je), onChange: Me, ref: ve, tabIndex: -1, value: W, children: K.children }),
223
+ r ? /* @__PURE__ */ b("div", { className: i.combobox, onClick: () => {
217
224
  var e;
218
- return (e = h.current) == null ? void 0 : e.focus();
225
+ return (e = N.current) == null ? void 0 : e.focus();
219
226
  }, children: [
220
- we,
221
- /* @__PURE__ */ o("input", { "aria-autocomplete": "list", "aria-expanded": u, "aria-label": c["aria-label"] ?? v ?? P, className: r["combobox-input"], disabled: c.disabled, onChange: (e) => {
222
- C(e.target.value), p(!0);
223
- }, onClick: () => p(!0), onFocus: () => p(!0), placeholder: P || void 0, ref: h, role: "combobox", type: "text", value: R })
224
- ] }) : /* @__PURE__ */ o(k, { "aria-expanded": u, "aria-haspopup": "dialog", "aria-labelledby": v ? `${F} ${F}-value` : void 0, className: $(r.trigger, (Q == null ? void 0 : Q.isPlaceholder) && r.placeholder), "data-open": u ? "true" : void 0, disabled: c.disabled, onClick: () => p(!u), ref: le, style: $e, variant: "simple", children: /* @__PURE__ */ o("span", { className: r.text, id: `${F}-value`, children: pe(Q) }) }),
225
- u && /* @__PURE__ */ _("div", { className: r.panel, children: [
226
- !l && /* @__PURE__ */ o(Ae, { "aria-label": "Filter", className: r.filter, icon: "MagnifyingGlass", onChange: (e) => C(e.target.value), placeholder: P, ref: h, style: ke, type: "search", value: R }),
227
- /* @__PURE__ */ _(Ke, { "aria-label": "Dropdown", "aria-busy": f || void 0, className: r.options, ref: oe, children: [
228
- Y.map((e) => {
229
- const d = e.value === L;
230
- return /* @__PURE__ */ o("li", { "data-component": "dropdown", children: /* @__PURE__ */ _(k, { "aria-label": d ? `${e.text}, selected` : e.text, className: $(r.option, d && r.selected), disabled: e.disabled, onClick: () => je(e.value), variant: "tertiary", children: [
231
- /* @__PURE__ */ o("span", { className: r.text, children: pe(e) }),
232
- e.groupLabel && /* @__PURE__ */ o("small", { className: r.group, children: e.groupLabel })
227
+ Be,
228
+ /* @__PURE__ */ l("input", { "aria-describedby": me, "aria-invalid": be, "aria-autocomplete": "list", "aria-expanded": u, "aria-label": a["aria-label"] ?? _ ?? A, className: i["combobox-input"], disabled: a.disabled, onChange: (e) => {
229
+ B(e.target.value), f(!0);
230
+ }, onClick: () => f(!0), onFocus: () => f(!0), placeholder: A || void 0, ref: N, role: "combobox", type: "text", value: C })
231
+ ] }) : /* @__PURE__ */ l(D, { "aria-describedby": me, "aria-invalid": be, "aria-label": _ ? void 0 : a["aria-label"], "aria-expanded": u, "aria-haspopup": "dialog", "aria-labelledby": _ ? `${x} ${x}-value` : void 0, className: k(i.trigger, (z == null ? void 0 : z.isPlaceholder) && i.placeholder), "data-open": u ? "true" : void 0, disabled: a.disabled, onClick: () => f(!u), ref: ue, style: ze, variant: "simple", children: /* @__PURE__ */ l("span", { className: i.text, id: `${x}-value`, children: we(z) }) }),
232
+ u && /* @__PURE__ */ b("div", { className: i.panel, children: [
233
+ !r && Z && /* @__PURE__ */ l(tt, { "aria-label": "Filter", className: i.filter, icon: "MagnifyingGlass", onChange: (e) => B(e.target.value), placeholder: A, ref: N, style: Ge, type: "search", value: C }),
234
+ /* @__PURE__ */ b(rt, { "aria-label": "Dropdown", "aria-busy": p || void 0, className: i.options, ref: J, children: [
235
+ re.map((e) => {
236
+ const c = e.value === W;
237
+ return /* @__PURE__ */ l("li", { "data-component": "dropdown", children: /* @__PURE__ */ b(D, { "aria-label": c ? `${e.text}, selected` : e.text, className: k(i.option, c && i.selected), disabled: e.disabled, onClick: () => Pe(e.value), variant: "tertiary", children: [
238
+ /* @__PURE__ */ l("span", { className: i.text, children: we(e) }),
239
+ e.groupLabel && /* @__PURE__ */ l("small", { className: i.group, children: e.groupLabel })
233
240
  ] }) }, `${e.groupLabel ?? "root"}-${e.value}`);
234
241
  }),
235
- W && s && /* @__PURE__ */ o("li", { children: /* @__PURE__ */ o(k, { "aria-label": z(s.render(g)) || g, className: r.option, onClick: me, variant: "tertiary", children: /* @__PURE__ */ o("span", { className: r.text, children: s.render(g) }) }) }),
236
- Y.length === 0 && !W && !f && !a && !y && /* @__PURE__ */ o("li", { className: r.empty, children: n }),
237
- a && /* @__PURE__ */ _("li", { className: r.empty, children: [
238
- /* @__PURE__ */ o("span", { role: "alert", children: a }),
239
- x && /* @__PURE__ */ o(k, { disabled: f, onClick: x, variant: "tertiary", children: ye })
242
+ G && h && /* @__PURE__ */ l("li", { children: /* @__PURE__ */ l(D, { "aria-label": q(h.render(S)) || S, className: i.option, onClick: Ne, variant: "tertiary", children: /* @__PURE__ */ l("span", { className: i.text, children: h.render(S) }) }) }),
243
+ re.length === 0 && !G && !p && !v && !g && /* @__PURE__ */ l("li", { className: i.empty, children: Ee }),
244
+ v && /* @__PURE__ */ b("li", { className: i.empty, children: [
245
+ /* @__PURE__ */ l("span", { role: "alert", children: v }),
246
+ de && /* @__PURE__ */ l(D, { disabled: p, onClick: de, variant: "tertiary", children: Re })
240
247
  ] }),
241
- f && /* @__PURE__ */ o("li", { "aria-label": "Loading", className: r.empty, role: "status", children: /* @__PURE__ */ o(Te, { size: "small" }) }),
242
- y && N && !a && /* @__PURE__ */ o("li", { ref: ae, children: /* @__PURE__ */ o(k, { className: r.option, disabled: f, onClick: Z, variant: "tertiary", children: ge }) })
248
+ p && /* @__PURE__ */ l("li", { "aria-label": "Loading", className: i.empty, role: "status", children: /* @__PURE__ */ l(it, { size: "small" }) }),
249
+ g && R && !v && /* @__PURE__ */ l("li", { ref: _e, children: /* @__PURE__ */ l(D, { className: i.option, disabled: p, onClick: ie, variant: "tertiary", children: Ce }) })
243
250
  ] })
244
251
  ] })
252
+ ] }), Ke = _ || o ? /* @__PURE__ */ b("div", { className: k(i.label, w === "inline" && i["inline-field"]), children: [
253
+ /* @__PURE__ */ l(nt, { label: qe, labelId: _ ? x : void 0, description: o, descriptionId: pe, inline: w === "inline" }),
254
+ Ie
255
+ ] }) : Ie;
256
+ return /* @__PURE__ */ b("div", { className: i.field, "data-component": "dropdown", children: [
257
+ Ke,
258
+ O && /* @__PURE__ */ l(Ye, { errorId: O, errorMessage: n })
245
259
  ] });
246
- return v ? /* @__PURE__ */ _("div", { className: $(r.label, S === "inline" && r["inline-field"]), "data-component": "dropdown", children: [
247
- /* @__PURE__ */ o("span", { id: F, children: Be }),
248
- be
249
- ] }) : be;
250
260
  };
251
261
  export {
252
- Vt as Dropdown
262
+ At as Dropdown
253
263
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index42.css');const i=require("react/jsx-runtime"),b=require("classix"),F=require("react"),q=require("../button/index.cjs"),I=require("../icon/index.cjs"),R="_dropzone_1rpsf_1",S="_dragging_1rpsf_19",T="_minimal_1rpsf_23",g={dropzone:R,dragging:S,minimal:T},k=({accepts:D,label:m="Select files",maxFileSize:_,multiple:u=!1,onChange:n,onValidation:a,variant:p="default",...y})=>{const f=F.useRef(null),[x,l]=F.useState(!1),c=e=>{e.preventDefault(),e.stopPropagation()},v=e=>{const t=f.current;if(!t)return;const s=new DataTransfer;for(const r of e)s.items.add(r);t.files=s.files,n==null||n({target:t,currentTarget:t})},z=e=>{const{validFiles:t,emptyFiles:s,oversizedFiles:r}=e.reduce((d,o)=>(o.size===0?d.emptyFiles.push(o):_&&o.size>_?d.oversizedFiles.push(o):d.validFiles.push(o),d),{validFiles:[],emptyFiles:[],oversizedFiles:[]});return(s.length>0||r.length>0)&&(a==null||a(s,r)),t},j=e=>{c(e),l(!1);const t=Array.from(e.dataTransfer.files??[]),s=z(t);if(s.length===0)return;const r=u?s:s.slice(0,1);v(r)},h=e=>{const t=Array.from(e.target.files??[]),s=z(t);if(s.length===t.length){n==null||n(e);return}const r=u?s:s.slice(0,1);v(r)};return i.jsx("div",{className:b(g.dropzone,g[p],x&&g.dragging),onDragEnter:e=>{c(e),l(!0)},onDragOver:e=>{c(e),l(!0)},onDragLeave:e=>{c(e),l(!1)},onDrop:j,...y,"data-component":"dropzone",children:i.jsxs("label",{children:[i.jsx("input",{accept:D,"aria-label":m,hidden:!0,multiple:u,onChange:h,ref:f,type:"file"}),i.jsx(I.Icon,{name:"UploadSimple",size:p==="minimal"?"medium":"large"}),i.jsx("br",{}),p!=="minimal"&&i.jsx(q.Button,{onClick:()=>{var e;return(e=f.current)==null?void 0:e.click()},type:"button",children:m})]})})};exports.Dropzone=k;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index42.css');const r=require("react/jsx-runtime"),J=require("classix"),p=require("react"),K=require("../button/index.cjs"),Q=require("../form/index.cjs"),W=require("../label/index.cjs"),X="_field_1tf8u_1",Y="_dropzone_1tf8u_19",Z="_upload_1tf8u_34",L="_hint_1tf8u_46",M="_files_1tf8u_52",V="_minimal_1tf8u_59",C="_dragging_1tf8u_76",l={field:X,dropzone:Y,upload:Z,hint:L,files:M,minimal:V,dragging:C},ee=({"aria-describedby":k,accepts:A,children:z,className:O,description:I,disabled:i=!1,dropLabel:P="or drag and drop",errorMessage:c,id:$,invalid:m=!1,label:a,maxFileSize:R,multiple:h=!1,name:w,onChange:d,onValidation:F,required:T=!1,uploadLabel:_=a??"Select files",variant:o="default"})=>{const x=p.useId(),q=$??x,j=(m||c)&&c?`${x}-error`:void 0,N=I&&o!=="minimal"?`${x}-description`:void 0,b=[k,N,j].filter(Boolean).join(" ")||void 0,u=p.useRef(0),S=p.useRef(null),D=p.useRef(null),[U,g]=p.useState(!1),v=e=>{e.preventDefault(),e.stopPropagation()},B=e=>{const t=D.current;if(!t)return;const s=new DataTransfer;for(const n of e)s.items.add(n);t.files=s.files,d==null||d({target:t,currentTarget:t})},E=e=>{const{validFiles:t,emptyFiles:s,oversizedFiles:n}=e.reduce((y,f)=>(f.size===0?y.emptyFiles.push(f):R&&f.size>R?y.oversizedFiles.push(f):y.validFiles.push(f),y),{validFiles:[],emptyFiles:[],oversizedFiles:[]});return(s.length>0||n.length>0)&&(F==null||F(s,n)),t},G=e=>{if(v(e),u.current=0,g(!1),i)return;const t=Array.from(e.dataTransfer.files??[]),s=E(t);if(s.length===0)return;const n=h?s:s.slice(0,1);B(n)},H=e=>{if(i)return;const t=Array.from(e.target.files??[]),s=E(t);if(s.length===t.length){d==null||d(e);return}const n=h?s:s.slice(0,1);B(n)};return r.jsxs("div",{className:J(l.field,l[o],U&&!i&&l.dragging,O),role:"group","aria-label":a??_,"data-disabled":i||void 0,"data-invalid":m||!!c||void 0,onDragEnter:e=>{var t,s;v(e),!(i||!((s=(t=e.dataTransfer)==null?void 0:t.types)!=null&&s.includes("Files")))&&(u.current+=1,g(!0))},onDragOver:e=>{var t,s;v(e),!(i||!((s=(t=e.dataTransfer)==null?void 0:t.types)!=null&&s.includes("Files")))&&(e.dataTransfer.dropEffect="copy",g(!0))},onDragLeave:e=>{v(e),u.current=Math.max(0,u.current-1),u.current===0&&g(!1)},onDrop:G,"data-component":"dropzone",children:[a&&o!=="minimal"&&r.jsx("label",{htmlFor:q,children:r.jsx(W.Label,{label:a,description:I,descriptionId:N,required:T})}),r.jsxs("div",{children:[r.jsxs("div",{className:l.dropzone,children:[r.jsx("input",{accept:A,"aria-label":a??_,"aria-describedby":b,"aria-invalid":m||!!c||void 0,disabled:i,hidden:!0,id:q,name:w,multiple:h,onInvalid:e=>{var t;e.preventDefault(),(t=S.current)==null||t.focus()},onChange:H,ref:D,required:T,type:"file"}),r.jsx(K.Button,{"aria-label":o==="minimal"?_:void 0,"aria-describedby":b,"aria-invalid":m||!!c||void 0,className:l.upload,disabled:i,icon:"UploadSimple",ref:S,onClick:()=>{var e;return(e=D.current)==null?void 0:e.click()},size:"small",variant:o==="minimal"?"tertiary":"secondary",children:o!=="minimal"&&_}),o!=="minimal"&&r.jsx("span",{className:l.hint,children:P})]}),j&&r.jsx(Q.FieldError,{errorId:j,errorMessage:c})]}),z&&r.jsx("div",{className:l.files,children:z})]})};exports.Dropzone=ee;