@theroutingcompany/components 0.0.152-alpha.1 → 0.0.152-alpha.2
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.
|
@@ -2468,7 +2468,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
2468
2468
|
justify-content: center;
|
|
2469
2469
|
align-items: center;
|
|
2470
2470
|
color: ${f.color_deprecated_fill_secondary_enabled};
|
|
2471
|
-
`,Ip=e=>{const{label:t,boldLabel:n=!0,autoFocus:r,className:o,excludeFromTabOrder:i,isClearable:u=!0,isDisabled:a,isSelectableAll:l=!1,autoSelectAll:s=!0,isAllSelectedText:c="All selected",placeholder:d="Select...",tooltipContent:p,tooltipIcon:h,errorMessage:v,isInvalid:g=!1,onFocus:$,onBlur:x,onSelectionChange:E}=e,C=b.default.useRef(null),_=!u,k=b.default.useRef(!1),S=b.default.useCallback(w=>{if(e.onSelectionChange){const F=s?!1:k.current;e.onSelectionChange(w,F)}},[e
|
|
2471
|
+
`,Ip=e=>{const{label:t,boldLabel:n=!0,autoFocus:r,className:o,excludeFromTabOrder:i,isClearable:u=!0,isDisabled:a,isSelectableAll:l=!1,autoSelectAll:s=!0,isAllSelectedText:c="All selected",placeholder:d="Select...",tooltipContent:p,tooltipIcon:h,errorMessage:v,isInvalid:g=!1,onFocus:$,onBlur:x,onSelectionChange:E}=e,C=b.default.useRef(null),_=!u,k=b.default.useRef(!1),S=b.default.useCallback(w=>{if(e.onSelectionChange){const F=s?!1:k.current;e.onSelectionChange(w,F)}},[e,s]),P=Hz({...e,disallowEmptySelection:_,onSelectionChange:S}),{labelProps:B,triggerProps:I,valueProps:T,menuProps:O,errorMessageProps:H}=jz({...e,disallowEmptySelection:_},P,C),{buttonProps:V}=Fr({...I,autoFocus:r,excludeFromTabOrder:i,isDisabled:a,onFocus:$,onBlur:x},C),[R,N]=b.default.useState(!1);b.default.useEffect(()=>{k.current=R},[R]);const W=s?P.selectionManager.isSelectAll:R,[G,z]=b.default.useState(!1),K=b.default.useCallback(()=>{const w=P.selectionManager.isSelectAll;!s&&!W&&w?(N(!0),E&&E(P.selectedKeys,!0)):(P.selectionManager.toggleSelectAll(),s||N(!w))},[s,W,P.selectionManager,P.selectedKeys,E]),D=b.default.useCallback(()=>{P.selectionManager.setFocusedKey(null)},[P.selectionManager]);b.default.useEffect(()=>{if(!s&&P.selectedItems){const w=Array.from(P.collection.getKeys()),F=Array.from(P.selectedKeys);!(w.length>0&&w.length===F.length&&w.every(Y=>F.includes(Y)))&&R&&N(!1)}},[P.selectedKeys,s,R,P.collection,P.selectedItems]);const A=(w,F=!1,U)=>m(Rt,{children:F&&U?m("span",{children:U}):m("span",{children:w.map(Y=>Y.textValue).join(", ")})});return Q(jt,{className:sE("select-wrapper",{"select-wrapper--opens":P.isOpen},o),children:[t?Q(et,{...B,mb:f.spacing_150,onClick:a?void 0:()=>P.open(),bold:n,children:[t,p?m(ft,{icon:h,children:p}):null]}):null,m(Z8,{focusRingClass:"select--focused",autoFocus:r,children:Q(Fp,{...V,ref:C,isOpen:P.isOpen,"data-state":g?"invalid":void 0,disabled:a??!1,children:[m("span",{...T,children:P.selectedItems?A(P.selectedItems,W,c):m(Bp,{children:d})}),m(Gz,{children:m(Il,{style:{width:"18px",height:"18px"},"aria-hidden":"true"})})]})}),v?m(Wt,{...H,children:v}):null,P.isOpen?Q(ar,{state:P,targetRef:C,isTargetWidth:!0,children:[l?Q(Ge,{children:[Q(Fl,{onMouseOver:()=>{z(!0),D()},onMouseOut:()=>z(!1),isFocused:G,tabIndex:G?0:-1,onClick:K,"aria-label":c,children:[m(Lf,{isDisabled:a??!1,isSelected:W,"aria-label":c,onChange:K}),Q(Jf,{children:[m(Et,{as:"span",children:c}),m(Qf,{children:W?m(Le.Check,{"aria-hidden":"true",style:{width:18,height:18}}):null})]})]}),m(i$,{})]}):null,m(OM,{...O,state:P,isSelectableAll:!0})]}):null]})};Ip.displayName="MultiSelectComponent";const fE=({items:e,...t})=>{const{children:n}=t,r=o=>o.textValue?m(zo,{textValue:o.textValue,children:o.textValue},o.id):m(zo,{children:o.name},o.id);if(!e)throw new Error("MultiSelect requires items");return m(Ip,{...t,items:e,children:n||r})};fE.displayName="MultiSelect";const Rp="nav-menu-portal";var pE=(e=>(e.Up="Up",e.Down="Down",e))(pE||{});const Mp=b.default.createContext({direction:"Down",menuRef:null,triggerRef:null,setTriggerRef:function(){throw new Error("Function not implemented.")},open:!1,setOpen:function(){throw new Error("Function not implemented.")}}),Yz=L.default.div`
|
|
2472
2472
|
position: relative;
|
|
2473
2473
|
width: inherit;
|
|
2474
2474
|
`,Go=y.forwardRef((e,t)=>{const[n,r]=y.useState(!1),[o,i]=y.useState(null),u=er(t);return y.useEffect(()=>{const a=document.getElementById(Rp);function l(s){const c=s.target;u.current&&!u.current.contains(c)&&!(a!=null&&a.contains(c))&&r(!1)}return document.addEventListener("mousedown",l),()=>{document.removeEventListener("mousedown",l)}},[u]),m(Mp.Provider,{value:{menuRef:u,triggerRef:o,setTriggerRef:i,open:n,setOpen:r,direction:e.direction??"Down"},children:m(Yz,{ref:u,role:"menu",children:e.children})})});Go.displayName="NavigationMenu";const qz=L.default.button`
|