@theroutingcompany/components 0.0.111-alpha.1 → 0.0.111
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.
|
@@ -2219,7 +2219,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
2219
2219
|
`,bF=N.default.span`
|
|
2220
2220
|
display: inline-flex;
|
|
2221
2221
|
align-items: center;
|
|
2222
|
-
`,vF=e=>E(Hr,{textValue:e.name,children:e.name},e.key),rw=e=>{const{boldLabel:t,hideLabel:n,placeholder:r="Select...",showCaret:o=!0,isInvalid:a,children:i=vF}=e,l=gF({...e,children:i}),s=S.useRef(null),{labelProps:u,triggerProps:d,valueProps:f,menuProps:m,errorMessageProps:g}=fF(e,l,s),{buttonProps:h}=Dr(d,s);return
|
|
2222
|
+
`,vF=e=>E(Hr,{textValue:e.name,children:e.name},e.key),rw=e=>{const{boldLabel:t,hideLabel:n,placeholder:r="Select...",showCaret:o=!0,isInvalid:a,children:i=vF}=e,l=gF({...e,children:i}),s=S.useRef(null),{labelProps:u,triggerProps:d,valueProps:f,menuProps:m,errorMessageProps:g}=fF(e,l,s),{buttonProps:h}=Dr(d,s);return J(Et,{children:[e.label?J(Re,{...u,srOnly:n,mb:p.spacing_150,onClick:()=>l.open(),bold:t,children:[e.label,e.tooltipContent?E(Qe,{icon:e.tooltipIcon,children:e.tooltipContent}):null]}):null,E(mF,{state:l,triggerRef:s,label:e.label,name:e.name}),J(Ud,{...h,ref:s,isOpen:l.isOpen,"data-state":a?"invalid":void 0,children:[E(bF,{...f,children:l.selectedItem?E(hF,{children:l.selectedItem.textValue}):E(jd,{children:r})}),o?E(Dl,{style:{width:"18px",height:"18px"},"aria-hidden":"true"}):null]}),e.errorMessage?E(St,{...g,children:e.errorMessage}):null,l.isOpen?E(Gr,{state:l,targetRef:s,isTargetWidth:!0,children:E(L$,{...m,state:l})}):null]})};rw.displayName="SingleSelect";function yF(e,t,n){const{disallowEmptySelection:r,isDisabled:o}=e,a=Ji({usage:"search",sensitivity:"base"}),i=c.useMemo(()=>new yl(t.collection,t.disabledKeys,null,a),[t.collection,t.disabledKeys,a]),{menuTriggerProps:l,menuProps:s}=pd({isDisabled:o,type:"listbox"},t,n),u=_=>{if(t.selectionMode==="single")switch(_.key){case"ArrowLeft":{_.preventDefault();const y=t.selectedKeys.size>0?i.getKeyAbove(t.selectedKeys.values().next().value):i.getFirstKey();y&&t.setSelectedKeys([y]);break}case"ArrowRight":{_.preventDefault();const y=t.selectedKeys.size>0?i.getKeyBelow(t.selectedKeys.values().next().value):i.getFirstKey();y&&t.setSelectedKeys([y]);break}}},{typeSelectProps:d}=cd({keyboardDelegate:i,selectionManager:t.selectionManager,onTypeSelect(_){t.setSelectedKeys([_])}}),{labelProps:f,fieldProps:m,errorMessageProps:g}=rl({...e,labelElementType:"span"});d.onKeyDown=d.onKeyDownCapture,delete d.onKeyDownCapture;const h=$n(e,{labelable:!0}),b=fe(d,l,m),v=ct();return{labelProps:{...f,onClick:()=>{var _;e.isDisabled||((_=n.current)==null||_.focus(),Kc("keyboard"))}},triggerProps:fe(h,{...b,onKeyDown:Wt(b.onKeyDown,u,e.onKeyDown),onKeyUp:e.onKeyUp,"aria-labelledby":[b["aria-labelledby"],b["aria-label"]&&!b["aria-labelledby"]?b.id:null,v].filter(Boolean).join(" "),onFocus(_){t.isFocused||(e.onFocus&&e.onFocus(_),t.setFocused(!0))},onBlur(_){t.isOpen||(e.onBlur&&e.onBlur(_),t.setFocused(!1))}}),valueProps:{id:v},menuProps:{...s,disallowEmptySelection:r,autoFocus:t.focusStrategy||!0,shouldSelectOnPressUp:!0,shouldFocusOnHover:!0,onBlur:_=>{_.currentTarget.contains(_.relatedTarget)||(e.onBlur&&e.onBlur(_),t.setFocused(!1))},"aria-labelledby":[m["aria-labelledby"],b["aria-label"]&&!m["aria-labelledby"]?b.id:null].filter(Boolean).join(" ")},errorMessageProps:g}}function $F(e){const{collection:t,disabledKeys:n,selectionManager:r,selectionManager:{setSelectedKeys:o,selectedKeys:a,selectionMode:i}}=P$(e),l=[],s=a.size!==0?Array.from(a).map(u=>{const d=t.getItem(u);return d||l.push(u),d}).filter(Y5):null;return l.length&&console.warn(`Select: Keys "${l.join(", ")}" passed to "selectedKeys" are not present in the collection.`),{collection:t,disabledKeys:n,selectionManager:r,selectionMode:i,selectedKeys:a,setSelectedKeys:o.bind(r),selectedItems:s}}function _F(e){const[t,n]=c.useState(!1),r=C$(e),o=$F({...e,onSelectionChange:a=>{e.onSelectionChange!=null&&(a==="all"?e.onSelectionChange(new Set(o.collection.getKeys())):e.onSelectionChange(a)),e.selectionMode==="single"&&r.close()}});return{...o,...r,close(){r.close()},open(){o.collection.size!==0&&r.open()},toggle(a){o.collection.size!==0&&r.toggle(a)},isFocused:t,setFocused:n}}const xF=N.default.span`
|
|
2223
2223
|
width: ${p.sizing_500};
|
|
2224
2224
|
height: ${p.sizing_600};
|
|
2225
2225
|
display: flex;
|