@solibo/solibo-ui 2.2.15 → 2.2.17

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 (46) 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/assets/index9.css +1 -1
  12. package/dist/components/card/index.cjs +1 -1
  13. package/dist/components/card/index.js +50 -50
  14. package/dist/components/checkbox/index.cjs +1 -1
  15. package/dist/components/checkbox/index.js +24 -23
  16. package/dist/components/dropdown/index.cjs +1 -1
  17. package/dist/components/dropdown/index.js +211 -190
  18. package/dist/components/dropzone/index.cjs +1 -1
  19. package/dist/components/dropzone/index.js +84 -56
  20. package/dist/components/editor/index.cjs +1 -1
  21. package/dist/components/editor/index.js +1 -1
  22. package/dist/components/input/index.cjs +1 -1
  23. package/dist/components/input/index.js +1 -1
  24. package/dist/components/label/index.cjs +1 -1
  25. package/dist/components/label/index.js +16 -14
  26. package/dist/components/list/index.cjs +1 -1
  27. package/dist/components/list/index.js +20 -20
  28. package/dist/components/page-layout/index.cjs +1 -1
  29. package/dist/components/page-layout/index.js +13 -13
  30. package/dist/components/radio/index.cjs +1 -1
  31. package/dist/components/radio/index.js +13 -13
  32. package/dist/components/search/index.cjs +1 -1
  33. package/dist/components/search/index.js +78 -70
  34. package/dist/components/textarea/index.cjs +1 -1
  35. package/dist/components/textarea/index.js +39 -32
  36. package/dist/components/toggle/index.cjs +1 -1
  37. package/dist/components/toggle/index.js +10 -10
  38. package/dist/index-6TyCExT0.js +87 -0
  39. package/dist/index-DEQcFR32.cjs +1 -0
  40. package/dist/index.cjs +1 -1
  41. package/dist/index.d.ts +34 -9
  42. package/dist/index.js +1 -1
  43. package/dist/tokens.json +1 -1
  44. package/package.json +1 -1
  45. package/dist/index-Bre56YYa.js +0 -90
  46. 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 n=require("react/jsx-runtime"),V=require("classix"),s=require("react"),B=require("../button/index.cjs"),Ze=require("../form/index.cjs"),et=require("../../icons-BIdcCH-v.cjs"),we=require("../../index-DEQcFR32.cjs"),tt=require("../label/index.cjs"),nt=require("../list/index.cjs"),Ee=require("../loading/index.cjs"),$=require("../../index-BQoXmNo3.cjs");function G(t){return typeof t=="string"||typeof t=="number"?String(t):Array.isArray(t)?t.map(G).join(" "):s.isValidElement(t)?G(t.props.children):""}function st(t){return s.isValidElement(t)&&t.type==="option"}function it(t){return s.isValidElement(t)&&t.type==="optgroup"}function lt(t){return s.isValidElement(t)&&t.type===s.Fragment}function rt(t){return s.isValidElement(t)&&t.type===$.Select}function le(t,o,r=!1){const a=[];return s.Children.forEach(t,i=>{if(lt(i))a.push(...le(i.props.children,o,r));else if(st(i)){const x=G(i.props.children).trim(),k=i.props.value!=null?String(i.props.value):x;a.push({disabled:r||!!i.props.disabled,groupLabel:o,hidden:!!i.props.hidden,isPlaceholder:!!(i.props.hidden&&k===""),label:i.props.children,selected:!!i.props.selected,text:x,value:k})}else it(i)&&a.push(...le(i.props.children,i.props.label,r||!!i.props.disabled))}),a}function ot(t){const o=t.trim();if(!o)return null;const a=[.../[*?]/.test(o)?o:`*${o}*`].map(i=>i==="*"?".*":i==="?"?".":i.replace(/[|\\{}()[\]^$+.,]/g,"\\$&")).join("");return new RegExp(`^${a}$`,"i")}function at(t,o){const r=ot(o),a=t.filter(i=>!i.hidden&&!i.isPlaceholder);return r?a.filter(i=>r.test([i.groupLabel,i.text,i.value].filter(Boolean).join(" "))):a}function ct(t,o){return t.find(r=>r.value===o)??t.find(r=>r.isPlaceholder)??t[0]}function ut(t,o,r){var a,i;return o!=null?String(o):r!=null?String(r):((a=t.find(x=>x.selected))==null?void 0:a.value)??((i=t[0])==null?void 0:i.value)??""}function dt(t){if(rt(t)){const{children:o,placeholder:r,...a}=t.props;return{children:n.jsxs(n.Fragment,{children:[r&&n.jsx("option",{hidden:!0,value:"",children:r}),o]}),props:a}}return{children:t.props.children,props:t.props}}const ft="_combobox_7iy0q_3",pt="_dropdown_7iy0q_21",mt="_empty_7iy0q_29",_t="_group_7iy0q_30",bt="_placeholder_7iy0q_31",yt="_filter_7iy0q_39",vt="_native_7iy0q_71",xt="_option_7iy0q_81",ht="_options_7iy0q_107",jt="_panel_7iy0q_117",qt="_selected_7iy0q_142",gt="_text_7iy0q_146",wt="_trigger_7iy0q_154",Et="_minimal_7iy0q_199",St="_inline_7iy0q_259",Rt="_field_7iy0q_293",Nt="_label_7iy0q_297",l={combobox:ft,"combobox-input":"_combobox-input_7iy0q_12",dropdown:pt,empty:mt,group:_t,placeholder:bt,filter:yt,"filter-controls":"_filter-controls_7iy0q_46","loading-status":"_loading-status_7iy0q_57",native:vt,option:xt,options:ht,panel:jt,selected:qt,text:gt,trigger:wt,minimal:Et,inline:St,field:Rt,label:Nt,"inline-field":"_inline-field_7iy0q_302"};function Se(t,o){return{"--icon-svg":et.iconSVG(t,o)}}const It=({children:t,className:o,combobox:r=!1,description:a,errorMessage:i,invalid:x=!1,searchable:k,createOption:h,emptyLabel:Re="No matches found",errorLabel:m,onRetry:re,retryLabel:Ne="Retry",label:y,filterOptions:Ie=!0,hasNextPage:b=!1,loading:d=!1,loadingLabel:oe="Loading",loadMoreLabel:Ce="Load more",onLoadMore:R,onOpenChange:D,onSearchChange:F,searchValue:M,renderOption:A,searchPlaceholder:L="Filter",selectedItems:Ve,variant:j="default",...Be})=>{const O=dt(t),{defaultValue:$e,onChange:T,value:K,...ke}=O.props,c=$.sanitizeSelectProps(ke),{className:De,...Fe}=c,ae=s.useRef(null),ce=s.useRef(null),q=s.useId(),H=x&&i?`${q}-error`:void 0,ue=a?`${q}-description`:void 0,de=[c["aria-describedby"],ue,H].filter(Boolean).join(" ")||void 0,fe=x?!0:c["aria-invalid"],pe=s.useRef(null),g=s.useRef(null),P=s.useRef(null),me=s.useRef(null),J=s.useRef(!1),U=s.useRef(!1),X=s.useRef(R),_e=!!R,w=le(O.children),N=K!=null,Y=ut(w,K,$e),[Z,ee]=s.useState(()=>Y),[u,We]=s.useState(!1),[ze,be]=s.useState(!1),[Qe,Ge]=s.useState(null),[Me,Ae]=s.useState(""),v=M??Me,te=w.filter(e=>!e.hidden).length,Le=Qe??(d||!!m||b||te>8),E=k??(Le||ze||v.length>0),I=s.useCallback(e=>{M===void 0&&Ae(e),F==null||F(e)},[F,M]),_=s.useCallback(e=>{J.current===e||e&&c.disabled||(J.current=e,We(e),D==null||D(e),e||I(""))},[D,c.disabled,I]),W=N?String(K):Z,ye={default:$.resolveColor("--colors-semantic-content-secondary"),white:$.resolveColor("--color-white","white")},ve=c.disabled?$.resolveColor("--colors-semantic-content-disabled"):j==="minimal"?ye.white:ye.default,z=ct(w,W),Oe=Se("CaretDown",ve),Te=Se("MagnifyingGlass",ve),ne=at(w,Ie?v:""),S=v.trim(),Q=!!(r&&h&&S&&h.isValid(S)),Ke=y&&j==="inline"?we.formatInlineLabel(y):y,xe=e=>e?(A==null?void 0:A({groupLabel:e.groupLabel,isSelected:e.value===W,label:e.label,text:e.text,value:e.value}))??e.label:"Select an option";s.useEffect(()=>{u&&!v&&!d&&!m&&Ge(b||te>8)},[u,v,d,m,b,te]),s.useEffect(()=>{!N&&!w.some(e=>e.value===Z)&&ee(Y)},[Y,Z,N,w]),s.useEffect(()=>{u?E&&be(!0):be(!1)},[u,E]),s.useEffect(()=>{var e,f,p;u&&(r||E?(e=g.current)==null||e.focus():(p=(f=P.current)==null?void 0:f.querySelector("button:not(:disabled)"))==null||p.focus())},[u,r,E]),s.useEffect(()=>{if(!u)return;const e=f=>{var p;(p=ce.current)!=null&&p.contains(f.target)||_(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[_,u]),s.useEffect(()=>{X.current=R},[R]),s.useEffect(()=>{c.disabled&&_(!1)},[_,c.disabled]);const se=s.useCallback(()=>{!J.current||c.disabled||d||m||!b||!X.current||U.current||(U.current=!0,X.current())},[m,b,d,c.disabled]);s.useEffect(()=>{if(U.current=!1,!u||c.disabled||d||m||!b||!_e)return;const e=me.current,f=P.current;if(!e||!f||typeof IntersectionObserver>"u")return;let p=!0;const C=new IntersectionObserver(Xe=>{p&&Xe.some(Ye=>Ye.isIntersecting)&&se()},{root:f});return C.observe(e),()=>{p=!1,C.disconnect()}},[u,d,m,b,_e,se,ne.length,v,c.disabled]);const He=e=>{N||ee(e.target.value),T==null||T(e)},ie=()=>{var e;_(!1),r||(e=ae.current)==null||e.focus()},he=()=>{var e;I(""),_(!0),(e=g.current)==null||e.focus()},je=()=>{!h||!Q||(h.onCreate(S),he())},Pe=e=>{var C;N||ee(e);const f=pe.current;if(!f){ie();return}const p=(C=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value"))==null?void 0:C.set;p==null||p.call(f,e),f.dispatchEvent(new Event("change",{bubbles:!0})),r?he():ie()},Je=e=>{e.key==="Escape"&&ie(),e.key==="Enter"&&e.target===g.current&&Q&&(e.preventDefault(),je())},qe=n.jsx("div",{"aria-hidden":!d,"aria-label":oe,className:l["loading-status"],role:"status",children:d&&n.jsx(Ee.Loading,{size:"small"})}),ge=n.jsxs("div",{className:V(l.dropdown,j==="inline"&&l.inline,j==="minimal"&&l.minimal,o),onKeyDown:Je,ref:ce,...Be,children:[n.jsx("select",{...Fe,"aria-hidden":"true",className:V(l.native,De),onChange:He,ref:pe,tabIndex:-1,value:W,children:O.children}),r?n.jsxs("div",{className:l.combobox,onClick:()=>{var e;return(e=g.current)==null?void 0:e.focus()},children:[Ve,n.jsx("input",{"aria-describedby":de,"aria-invalid":fe,"aria-autocomplete":"list","aria-expanded":u,"aria-label":c["aria-label"]??y??L,className:l["combobox-input"],disabled:c.disabled,onChange:e=>{I(e.target.value),_(!0)},onClick:()=>_(!0),onFocus:()=>_(!0),placeholder:L||void 0,ref:g,role:"combobox",type:"text",value:v}),qe]}):n.jsx(B.Button,{"aria-describedby":de,"aria-invalid":fe,"aria-label":y?void 0:c["aria-label"],"aria-expanded":u,"aria-haspopup":"dialog","aria-labelledby":y?`${q} ${q}-value`:void 0,className:V(l.trigger,(z==null?void 0:z.isPlaceholder)&&l.placeholder),"data-open":u?"true":void 0,disabled:c.disabled,onClick:()=>_(!u),ref:ae,style:Oe,variant:"simple",children:n.jsx("span",{className:l.text,id:`${q}-value`,children:xe(z)})}),u&&n.jsxs("div",{className:l.panel,children:[!r&&E&&n.jsxs("div",{className:l["filter-controls"],children:[n.jsx(we.Input,{"aria-label":"Filter",className:l.filter,icon:"MagnifyingGlass",onChange:e=>I(e.target.value),placeholder:L,ref:g,style:Te,type:"search",value:v}),qe]}),n.jsxs(nt.List,{"aria-label":"Dropdown","aria-busy":d||void 0,className:l.options,ref:P,children:[ne.map(e=>{const f=e.value===W;return n.jsx("li",{"data-component":"dropdown",children:n.jsxs(B.Button,{"aria-label":f?`${e.text}, selected`:e.text,className:V(l.option,f&&l.selected),disabled:e.disabled,onClick:()=>Pe(e.value),variant:"tertiary",children:[n.jsx("span",{className:l.text,children:xe(e)}),e.groupLabel&&n.jsx("small",{className:l.group,children:e.groupLabel})]})},`${e.groupLabel??"root"}-${e.value}`)}),Q&&h&&n.jsx("li",{children:n.jsx(B.Button,{"aria-label":G(h.render(S))||S,className:l.option,onClick:je,variant:"tertiary",children:n.jsx("span",{className:l.text,children:h.render(S)})})}),ne.length===0&&!Q&&!d&&!m&&!b&&n.jsx("li",{className:l.empty,children:Re}),m&&n.jsxs("li",{className:l.empty,children:[n.jsx("span",{role:"alert",children:m}),re&&n.jsx(B.Button,{disabled:d,onClick:re,variant:"tertiary",children:Ne})]}),d&&!r&&!E&&n.jsx("li",{"aria-label":oe,className:l.empty,role:"status",children:n.jsx(Ee.Loading,{size:"small"})}),b&&R&&!m&&n.jsx("li",{ref:me,children:n.jsx(B.Button,{className:l.option,disabled:d,onClick:se,variant:"tertiary",children:Ce})})]})]})]}),Ue=y||a?n.jsxs("div",{className:V(l.label,j==="inline"&&l["inline-field"]),children:[n.jsx(tt.Label,{label:Ke,labelId:y?q:void 0,description:a,descriptionId:ue,inline:j==="inline"}),ge]}):ge;return n.jsxs("div",{className:l.field,"data-component":"dropdown",children:[Ue,H&&n.jsx(Ze.FieldError,{errorId:H,errorMessage:i})]})};exports.Dropdown=It;
@@ -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 it, jsx as l } from "react/jsx-runtime";
2
+ import k from "classix";
3
+ import rt, { Children as lt, isValidElement as F, useRef as _, useId as st, useState as D, useCallback as oe, useEffect as g } from "react";
4
+ import { Button as j } from "../button/index.js";
5
+ import { FieldError as at } from "../form/index.js";
6
+ import { i as ot } from "../../icons-DVeBguFb.js";
7
+ import { f as ct, I as dt } from "../../index-6TyCExT0.js";
8
+ import { Label as ut } from "../label/index.js";
9
+ import { List as ft } from "../list/index.js";
10
+ import { Loading as Re } from "../loading/index.js";
11
+ import { S as pt, s as mt, r as ce } from "../../index-GPsHvb4d.js";
12
+ import '../../assets/index41.css';function K(t) {
13
+ return typeof t == "string" || typeof t == "number" ? String(t) : Array.isArray(t) ? t.map(K).join(" ") : F(t) ? K(t.props.children) : "";
12
14
  }
13
- function Je(t) {
14
- return B(t) && t.type === "option";
15
+ function bt(t) {
16
+ return F(t) && t.type === "option";
15
17
  }
16
- function Ue(t) {
17
- return B(t) && t.type === "optgroup";
18
+ function yt(t) {
19
+ return F(t) && t.type === "optgroup";
18
20
  }
19
- function Xe(t) {
20
- return B(t) && t.type === ze.Fragment;
21
+ function _t(t) {
22
+ return F(t) && t.type === rt.Fragment;
21
23
  }
22
- function Ye(t) {
23
- return B(t) && t.type === He;
24
+ function vt(t) {
25
+ return F(t) && t.type === pt;
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 de(t, s, r = !1) {
28
+ const a = [];
29
+ return lt.forEach(t, (n) => {
30
+ if (_t(n))
31
+ a.push(...de(n.props.children, s, r));
32
+ else if (bt(n)) {
33
+ const w = K(n.props.children).trim(), W = n.props.value != null ? String(n.props.value) : w;
34
+ a.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 && W === ""),
37
39
  label: n.props.children,
38
40
  selected: !!n.props.selected,
39
- text: a,
40
- value: x
41
+ text: w,
42
+ value: W
41
43
  });
42
- } else Ue(n) && s.push(...re(n.props.children, n.props.label, l || !!n.props.disabled));
43
- }), s;
44
+ } else yt(n) && a.push(...de(n.props.children, n.props.label, r || !!n.props.disabled));
45
+ }), a;
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 ht(t) {
48
+ const s = t.trim();
49
+ if (!s) return null;
50
+ const a = [.../[*?]/.test(s) ? s : `*${s}*`].map((n) => n === "*" ? ".*" : n === "?" ? "." : n.replace(/[|\\{}()[\]^$+.,]/g, "\\$&")).join("");
51
+ return new RegExp(`^${a}$`, "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 gt(t, s) {
54
+ const r = ht(s), a = t.filter((n) => !n.hidden && !n.isPlaceholder);
55
+ return r ? a.filter((n) => r.test([n.groupLabel, n.text, n.value].filter(Boolean).join(" "))) : a;
54
56
  }
55
- function tt(t, i) {
56
- return t.find((l) => l.value === i) ?? t.find((l) => l.isPlaceholder) ?? t[0];
57
+ function wt(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 qt(t, s, r) {
61
+ var a, n;
62
+ return s != null ? String(s) : r != null ? String(r) : ((a = t.find((w) => w.selected)) == null ? void 0 : a.value) ?? ((n = t[0]) == null ? void 0 : n.value) ?? "";
61
63
  }
62
- function rt(t) {
63
- if (Ye(t)) {
64
+ function St(t) {
65
+ if (vt(t)) {
64
66
  const {
65
- children: i,
66
- placeholder: l,
67
- ...s
67
+ children: s,
68
+ placeholder: r,
69
+ ...a
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(it, { children: [
73
+ r && /* @__PURE__ */ l("option", { hidden: !0, value: "", children: r }),
74
+ s
73
75
  ] }),
74
- props: s
76
+ props: a
75
77
  };
76
78
  }
77
79
  return {
@@ -79,175 +81,194 @@ 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 It = "_combobox_7iy0q_3", Nt = "_dropdown_7iy0q_21", xt = "_empty_7iy0q_29", Et = "_group_7iy0q_30", Ct = "_placeholder_7iy0q_31", Rt = "_filter_7iy0q_39", Vt = "_native_7iy0q_71", $t = "_option_7iy0q_81", Bt = "_options_7iy0q_107", kt = "_panel_7iy0q_117", Dt = "_selected_7iy0q_142", jt = "_text_7iy0q_146", Ft = "_trigger_7iy0q_154", Wt = "_minimal_7iy0q_199", zt = "_inline_7iy0q_259", Qt = "_field_7iy0q_293", Gt = "_label_7iy0q_297", i = {
85
+ combobox: It,
86
+ "combobox-input": "_combobox-input_7iy0q_12",
87
+ dropdown: Nt,
88
+ empty: xt,
89
+ group: Et,
90
+ placeholder: Ct,
91
+ filter: Rt,
92
+ "filter-controls": "_filter-controls_7iy0q_46",
93
+ "loading-status": "_loading-status_7iy0q_57",
94
+ native: Vt,
95
+ option: $t,
96
+ options: Bt,
97
+ panel: kt,
98
+ selected: Dt,
99
+ text: jt,
100
+ trigger: Ft,
101
+ minimal: Wt,
102
+ inline: zt,
103
+ field: Qt,
104
+ label: Gt,
105
+ "inline-field": "_inline-field_7iy0q_302"
101
106
  };
102
- function ve(t, i) {
107
+ function Ve(t, s) {
103
108
  return {
104
- "--icon-svg": Pe(t, i)
109
+ "--icon-svg": ot(t, s)
105
110
  };
106
111
  }
107
- const Vt = ({
112
+ const Yt = ({
108
113
  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",
114
+ className: s,
115
+ combobox: r = !1,
116
+ description: a,
117
+ errorMessage: n,
118
+ invalid: w = !1,
119
+ searchable: W,
120
+ createOption: q,
121
+ emptyLabel: $e = "No matches found",
122
+ errorLabel: p,
123
+ onRetry: ue,
124
+ retryLabel: Be = "Retry",
116
125
  label: v,
117
- filterOptions: he = !0,
126
+ filterOptions: ke = !0,
118
127
  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
+ loading: d = !1,
129
+ loadingLabel: fe = "Loading",
130
+ loadMoreLabel: De = "Load more",
131
+ onLoadMore: R,
132
+ onOpenChange: z,
133
+ onSearchChange: Q,
134
+ searchValue: L,
135
+ renderOption: O,
136
+ searchPlaceholder: T = "Filter",
137
+ selectedItems: je,
128
138
  variant: S = "default",
129
- ...xe
139
+ ...Fe
130
140
  }) => {
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({
141
+ const H = St(t), {
142
+ defaultValue: We,
143
+ onChange: J,
144
+ value: P,
145
+ ...ze
146
+ } = H.props, o = mt(ze), {
147
+ className: Qe,
148
+ ...Ge
149
+ } = o, pe = _(null), me = _(null), I = st(), U = w && n ? `${I}-error` : void 0, be = a ? `${I}-description` : void 0, ye = [o["aria-describedby"], be, U].filter(Boolean).join(" ") || void 0, _e = w ? !0 : o["aria-invalid"], ve = _(null), N = _(null), X = _(null), he = _(null), Y = _(!1), Z = _(!1), ee = _(R), ge = !!R, x = de(H.children), V = P != null, te = qt(x, P, We), [ne, ie] = D(() => te), [c, Ae] = D(!1), [Me, we] = D(!1), [Ke, Le] = D(null), [Oe, Te] = D(""), h = L ?? Oe, re = x.filter((e) => !e.hidden).length, He = Ke ?? (d || !!p || y || re > 8), E = W ?? (He || Me || h.length > 0), $ = oe((e) => {
150
+ L === void 0 && Te(e), Q == null || Q(e);
151
+ }, [Q, L]), m = oe((e) => {
152
+ Y.current === e || e && o.disabled || (Y.current = e, Ae(e), z == null || z(e), e || $(""));
153
+ }, [z, o.disabled, $]), G = V ? String(P) : ne, qe = {
154
+ default: ce("--colors-semantic-content-secondary"),
155
+ white: ce("--color-white", "white")
156
+ }, Se = o.disabled ? ce("--colors-semantic-content-disabled") : S === "minimal" ? qe.white : qe.default, A = wt(x, G), Je = Ve("CaretDown", Se), Pe = Ve("MagnifyingGlass", Se), le = gt(x, ke ? h : ""), C = h.trim(), M = !!(r && q && C && q.isValid(C)), Ue = v && S === "inline" ? ct(v) : v, Ie = (e) => e ? (O == null ? void 0 : O({
147
157
  groupLabel: e.groupLabel,
148
- isSelected: e.value === L,
158
+ isSelected: e.value === G,
149
159
  label: e.label,
150
160
  text: e.text,
151
161
  value: e.value
152
162
  })) ?? 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(() => {
159
- if (!u)
163
+ g(() => {
164
+ c && !h && !d && !p && Le(y || re > 8);
165
+ }, [c, h, d, p, y, re]), g(() => {
166
+ !V && !x.some((e) => e.value === ne) && ie(te);
167
+ }, [te, ne, V, x]), g(() => {
168
+ c ? E && we(!0) : we(!1);
169
+ }, [c, E]), g(() => {
170
+ var e, u, f;
171
+ c && (r || E ? (e = N.current) == null || e.focus() : (f = (u = X.current) == null ? void 0 : u.querySelector("button:not(:disabled)")) == null || f.focus());
172
+ }, [c, r, E]), g(() => {
173
+ if (!c)
160
174
  return;
161
- const e = (d) => {
162
- var m;
163
- (m = se.current) != null && m.contains(d.target) || p(!1);
175
+ const e = (u) => {
176
+ var f;
177
+ (f = me.current) != null && f.contains(u.target) || m(!1);
164
178
  };
165
179
  return document.addEventListener("mousedown", e), () => {
166
180
  document.removeEventListener("mousedown", e);
167
181
  };
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();
182
+ }, [m, c]), g(() => {
183
+ ee.current = R;
184
+ }, [R]), g(() => {
185
+ o.disabled && m(!1);
186
+ }, [m, o.disabled]);
187
+ const se = oe(() => {
188
+ !Y.current || o.disabled || d || p || !y || !ee.current || Z.current || (Z.current = !0, ee.current());
189
+ }, [p, y, d, o.disabled]);
190
+ g(() => {
191
+ if (Z.current = !1, !c || o.disabled || d || p || !y || !ge) return;
192
+ const e = he.current, u = X.current;
193
+ if (!e || !u || typeof IntersectionObserver > "u") return;
194
+ let f = !0;
195
+ const B = new IntersectionObserver((tt) => {
196
+ f && tt.some((nt) => nt.isIntersecting) && se();
183
197
  }, {
184
- root: d
198
+ root: u
185
199
  });
186
- return V.observe(e), () => {
187
- m = !1, V.disconnect();
200
+ return B.observe(e), () => {
201
+ f = !1, B.disconnect();
188
202
  };
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 = () => {
203
+ }, [c, d, p, y, ge, se, le.length, h, o.disabled]);
204
+ const Xe = (e) => {
205
+ V || ie(e.target.value), J == null || J(e);
206
+ }, ae = () => {
193
207
  var e;
194
- p(!1), l || (e = le.current) == null || e.focus();
195
- }, fe = () => {
208
+ m(!1), r || (e = pe.current) == null || e.focus();
209
+ }, Ne = () => {
196
210
  var e;
197
- C(""), p(!0), (e = h.current) == null || e.focus();
198
- }, me = () => {
199
- !s || !W || (s.onCreate(g), fe());
200
- }, je = (e) => {
201
- var V;
202
- E || X(e);
203
- const d = ie.current;
204
- if (!d) {
205
- ee();
211
+ $(""), m(!0), (e = N.current) == null || e.focus();
212
+ }, xe = () => {
213
+ !q || !M || (q.onCreate(C), Ne());
214
+ }, Ye = (e) => {
215
+ var B;
216
+ V || ie(e);
217
+ const u = ve.current;
218
+ if (!u) {
219
+ ae();
206
220
  return;
207
221
  }
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", {
222
+ const f = (B = Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype, "value")) == null ? void 0 : B.set;
223
+ f == null || f.call(u, e), u.dispatchEvent(new Event("change", {
210
224
  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: () => {
225
+ })), r ? Ne() : ae();
226
+ }, Ze = (e) => {
227
+ e.key === "Escape" && ae(), e.key === "Enter" && e.target === N.current && M && (e.preventDefault(), xe());
228
+ }, Ee = /* @__PURE__ */ l("div", { "aria-hidden": !d, "aria-label": fe, className: i["loading-status"], role: "status", children: d && /* @__PURE__ */ l(Re, { size: "small" }) }), Ce = /* @__PURE__ */ b("div", { className: k(i.dropdown, S === "inline" && i.inline, S === "minimal" && i.minimal, s), onKeyDown: Ze, ref: me, ...Fe, children: [
229
+ /* @__PURE__ */ l("select", { ...Ge, "aria-hidden": "true", className: k(i.native, Qe), onChange: Xe, ref: ve, tabIndex: -1, value: G, children: H.children }),
230
+ r ? /* @__PURE__ */ b("div", { className: i.combobox, onClick: () => {
217
231
  var e;
218
- return (e = h.current) == null ? void 0 : e.focus();
232
+ return (e = N.current) == null ? void 0 : e.focus();
219
233
  }, 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 })
234
+ je,
235
+ /* @__PURE__ */ l("input", { "aria-describedby": ye, "aria-invalid": _e, "aria-autocomplete": "list", "aria-expanded": c, "aria-label": o["aria-label"] ?? v ?? T, className: i["combobox-input"], disabled: o.disabled, onChange: (e) => {
236
+ $(e.target.value), m(!0);
237
+ }, onClick: () => m(!0), onFocus: () => m(!0), placeholder: T || void 0, ref: N, role: "combobox", type: "text", value: h }),
238
+ Ee
239
+ ] }) : /* @__PURE__ */ l(j, { "aria-describedby": ye, "aria-invalid": _e, "aria-label": v ? void 0 : o["aria-label"], "aria-expanded": c, "aria-haspopup": "dialog", "aria-labelledby": v ? `${I} ${I}-value` : void 0, className: k(i.trigger, (A == null ? void 0 : A.isPlaceholder) && i.placeholder), "data-open": c ? "true" : void 0, disabled: o.disabled, onClick: () => m(!c), ref: pe, style: Je, variant: "simple", children: /* @__PURE__ */ l("span", { className: i.text, id: `${I}-value`, children: Ie(A) }) }),
240
+ c && /* @__PURE__ */ b("div", { className: i.panel, children: [
241
+ !r && E && /* @__PURE__ */ b("div", { className: i["filter-controls"], children: [
242
+ /* @__PURE__ */ l(dt, { "aria-label": "Filter", className: i.filter, icon: "MagnifyingGlass", onChange: (e) => $(e.target.value), placeholder: T, ref: N, style: Pe, type: "search", value: h }),
243
+ Ee
244
+ ] }),
245
+ /* @__PURE__ */ b(ft, { "aria-label": "Dropdown", "aria-busy": d || void 0, className: i.options, ref: X, children: [
246
+ le.map((e) => {
247
+ const u = e.value === G;
248
+ return /* @__PURE__ */ l("li", { "data-component": "dropdown", children: /* @__PURE__ */ b(j, { "aria-label": u ? `${e.text}, selected` : e.text, className: k(i.option, u && i.selected), disabled: e.disabled, onClick: () => Ye(e.value), variant: "tertiary", children: [
249
+ /* @__PURE__ */ l("span", { className: i.text, children: Ie(e) }),
250
+ e.groupLabel && /* @__PURE__ */ l("small", { className: i.group, children: e.groupLabel })
233
251
  ] }) }, `${e.groupLabel ?? "root"}-${e.value}`);
234
252
  }),
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 })
253
+ M && q && /* @__PURE__ */ l("li", { children: /* @__PURE__ */ l(j, { "aria-label": K(q.render(C)) || C, className: i.option, onClick: xe, variant: "tertiary", children: /* @__PURE__ */ l("span", { className: i.text, children: q.render(C) }) }) }),
254
+ le.length === 0 && !M && !d && !p && !y && /* @__PURE__ */ l("li", { className: i.empty, children: $e }),
255
+ p && /* @__PURE__ */ b("li", { className: i.empty, children: [
256
+ /* @__PURE__ */ l("span", { role: "alert", children: p }),
257
+ ue && /* @__PURE__ */ l(j, { disabled: d, onClick: ue, variant: "tertiary", children: Be })
240
258
  ] }),
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 }) })
259
+ d && !r && !E && /* @__PURE__ */ l("li", { "aria-label": fe, className: i.empty, role: "status", children: /* @__PURE__ */ l(Re, { size: "small" }) }),
260
+ y && R && !p && /* @__PURE__ */ l("li", { ref: he, children: /* @__PURE__ */ l(j, { className: i.option, disabled: d, onClick: se, variant: "tertiary", children: De }) })
243
261
  ] })
244
262
  ] })
263
+ ] }), et = v || a ? /* @__PURE__ */ b("div", { className: k(i.label, S === "inline" && i["inline-field"]), children: [
264
+ /* @__PURE__ */ l(ut, { label: Ue, labelId: v ? I : void 0, description: a, descriptionId: be, inline: S === "inline" }),
265
+ Ce
266
+ ] }) : Ce;
267
+ return /* @__PURE__ */ b("div", { className: i.field, "data-component": "dropdown", children: [
268
+ et,
269
+ U && /* @__PURE__ */ l(at, { errorId: U, errorMessage: n })
245
270
  ] });
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
271
  };
251
272
  export {
252
- Vt as Dropdown
273
+ Yt as Dropdown
253
274
  };
@@ -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;