@theroutingcompany/components 0.0.117-alpha.7 → 0.0.117
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.
- package/dist/trc-components.es.js +22 -13
- package/dist/trc-components.es.js.map +1 -1
- package/dist/trc-components.umd.js +1 -1
- package/dist/trc-components.umd.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/types/components/SingleSelect/SingleSelect.d.ts +1 -0
|
@@ -2222,7 +2222,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
2222
2222
|
display: inline-flex;
|
|
2223
2223
|
align-items: center;
|
|
2224
2224
|
overflow: hidden;
|
|
2225
|
-
`,vF=e=>E(Hr,{textValue:e.name,children:e.name},e.key),aw=e=>{const{boldLabel:t=!0,hideLabel:n,placeholder:r="Select...",showCaret:o=!0,isInvalid:a,children:i=vF,displayValue:l="rendered"}=e,
|
|
2225
|
+
`,vF=e=>E(Hr,{textValue:e.name,children:e.name},e.key),aw=e=>{const{boldLabel:t=!0,hideLabel:n,placeholder:r="Select...",showCaret:o=!0,isInvalid:a,children:i=vF,displayValue:l="rendered",isPopoverTargetWidth:s=!0}=e,u=hF({...e,children:i}),d=S.useRef(null),{labelProps:f,triggerProps:g,valueProps:m,menuProps:h,errorMessageProps:b}=pF(e,u,d),{buttonProps:v}=Dr(g,d);return Q(Et,{children:[e.label?Q(Re,{...f,srOnly:n,mb:p.spacing_150,onClick:()=>u.open(),bold:t,children:[e.label,e.tooltipContent?E(Qe,{icon:e.tooltipIcon,children:e.tooltipContent}):null]}):null,E(mF,{state:u,triggerRef:d,label:e.label,name:e.name}),Q(Gd,{...v,ref:d,isOpen:u.isOpen,"data-state":a?"invalid":void 0,children:[E(bF,{...m,children:u.selectedItem?l==="textValue"?E(ow,{children:u.selectedItem.textValue}):E(ow,{children:u.selectedItem.rendered}):E(Hd,{children:r})}),o?E(Tl,{style:{width:"18px",height:"18px"},"aria-hidden":"true"}):null]}),e.errorMessage?E(St,{...b,children:e.errorMessage}):null,u.isOpen?E(Gr,{state:u,targetRef:d,isTargetWidth:s,children:E(R$,{...h,state:u})}):null]})};aw.displayName="SingleSelect";function yF(e,t,n){const{disallowEmptySelection:r,isDisabled:o}=e,a=Qi({usage:"search",sensitivity:"base"}),i=c.useMemo(()=>new _l(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:g,errorMessageProps:m}=al({...e,labelElementType:"span"});d.onKeyDown=d.onKeyDownCapture,delete d.onKeyDownCapture;const h=$n(e,{labelable:!0}),b=pe(d,l,g),v=ct();return{labelProps:{...f,onClick:()=>{var _;e.isDisabled||((_=n.current)==null||_.focus(),Kc("keyboard"))}},triggerProps:pe(h,{...b,onKeyDown:Ht(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":[g["aria-labelledby"],b["aria-label"]&&!g["aria-labelledby"]?b.id:null].filter(Boolean).join(" ")},errorMessageProps:m}}function $F(e){const{collection:t,disabledKeys:n,selectionManager:r,selectionManager:{setSelectedKeys:o,selectedKeys:a,selectionMode:i}}=k$(e),l=[],s=a.size!==0?Array.from(a).map(u=>{const d=t.getItem(u);return d||l.push(u),d}).filter(X5):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=I$(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=L.default.span`
|
|
2226
2226
|
width: ${p.sizing_500};
|
|
2227
2227
|
height: ${p.sizing_600};
|
|
2228
2228
|
display: flex;
|