@theroutingcompany/components 0.0.117-alpha.3 → 0.0.117-alpha.4
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.
|
@@ -2172,8 +2172,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
2172
2172
|
margin-top: ${p.spacing_100};
|
|
2173
2173
|
`,fF=({label:e,value:t,truncate:n=!1})=>Q(me,{role:"group",title:e,children:[E(Re,{htmlFor:`labeled-text-${e}`,color:p.color_gray_52,size:"medium",bold:!0,title:e,"aria-label":e,children:e}),E(dF,{id:`labeled-text-${e}`,title:typeof t=="string"?t:e,"aria-label":typeof t=="string"?t:e,truncate:n,children:t})]});function nw(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=nw(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function rw(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=nw(e))&&(r&&(r+=" "),r+=t);return r}function pF(e,t,n){let{keyboardDelegate:r,isDisabled:o}=e,a=Zi({usage:"search",sensitivity:"base"}),i=c.useMemo(()=>r||new $l(t.collection,t.disabledKeys,null,a),[r,t.collection,t.disabledKeys,a]),{menuTriggerProps:l,menuProps:s}=pd({isDisabled:o,type:"listbox"},t,n),u=y=>{switch(y.key){case"ArrowLeft":{y.preventDefault();let w=t.selectedKey!=null?i.getKeyAbove(t.selectedKey):i.getFirstKey();w&&t.setSelectedKey(w);break}case"ArrowRight":{y.preventDefault();let w=t.selectedKey!=null?i.getKeyBelow(t.selectedKey):i.getFirstKey();w&&t.setSelectedKey(w);break}}},{typeSelectProps:d}=cd({keyboardDelegate:i,selectionManager:t.selectionManager,onTypeSelect(y){t.setSelectedKey(y)}}),{labelProps:f,fieldProps:g,descriptionProps:m,errorMessageProps:h}=ol({...e,labelElementType:"span"});d.onKeyDown=d.onKeyDownCapture,delete d.onKeyDownCapture;let b=$n(e,{labelable:!0}),v=fe(d,l,g),_=ct();return{labelProps:{...f,onClick:()=>{e.isDisabled||(n.current.focus(),Kc("keyboard"))}},triggerProps:fe(b,{...v,isDisabled:o,onKeyDown:Ht(v.onKeyDown,u,e.onKeyDown),onKeyUp:e.onKeyUp,"aria-labelledby":[_,v["aria-labelledby"],v["aria-label"]&&!v["aria-labelledby"]?v.id:null].filter(Boolean).join(" "),onFocus(y){t.isFocused||(e.onFocus&&e.onFocus(y),e.onFocusChange&&e.onFocusChange(!0),t.setFocused(!0))},onBlur(y){t.isOpen||(e.onBlur&&e.onBlur(y),e.onFocusChange&&e.onFocusChange(!1),t.setFocused(!1))}}),valueProps:{id:_},menuProps:{...s,autoFocus:t.focusStrategy||!0,shouldSelectOnPressUp:!0,shouldFocusOnHover:!0,disallowEmptySelection:!0,onBlur:y=>{y.currentTarget.contains(y.relatedTarget)||(e.onBlur&&e.onBlur(y),e.onFocusChange&&e.onFocusChange(!1),t.setFocused(!1))},"aria-labelledby":[g["aria-labelledby"],v["aria-label"]&&!g["aria-labelledby"]?v.id:null].filter(Boolean).join(" ")},descriptionProps:m,errorMessageProps:h}}function gF(e,t,n){let{autoComplete:r,name:o,isDisabled:a}=e,i=Gm(),{visuallyHiddenProps:l}=Zm();var s;return{containerProps:{...l,"aria-hidden":!0},inputProps:{type:"text",tabIndex:i==null||t.isFocused||t.isOpen?-1:0,style:{fontSize:16},onFocus:()=>n.current.focus(),disabled:a},selectProps:{tabIndex:-1,autoComplete:r,disabled:a,name:o,size:t.collection.size,value:(s=t.selectedKey)!==null&&s!==void 0?s:"",onChange:u=>t.setSelectedKey(u.target.value)}}}function mF(e){let{state:t,triggerRef:n,label:r,name:o,isDisabled:a}=e,{containerProps:i,inputProps:l,selectProps:s}=gF(e,t,n);var u;return t.collection.size<=300?S.default.createElement("div",i,S.default.createElement("input",l),S.default.createElement("label",null,r,S.default.createElement("select",s,S.default.createElement("option",null),[...t.collection.getKeys()].map(d=>{let f=t.collection.getItem(d);if(f.type==="item")return S.default.createElement("option",{key:f.key,value:f.key},f.textValue)})))):o?S.default.createElement("input",{type:"hidden",autoComplete:s.autoComplete,name:o,disabled:a,value:(u=t.selectedKey)!==null&&u!==void 0?u:""}):null}function hF(e){let t=ua(e),[n,r]=c.useState(null),o=A$({...e,onSelectionChange:s=>{e.onSelectionChange!=null&&e.onSelectionChange(s),t.close(),a.commitValidation()}}),a=w0({...e,value:o.selectedKey}),[i,l]=c.useState(!1);return{...a,...o,...t,focusStrategy:n,open(s=null){o.collection.size!==0&&(r(s),t.open())},toggle(s=null){o.collection.size!==0&&(r(s),t.toggle())},isFocused:i,setFocused:l}}const ow=L.default.span`
|
|
2174
2174
|
${({lineHeight:e=p.font_size_200,fontSize:t=p.font_size_175})=>Sl({lineHeight:e,fontSize:t})}
|
|
2175
|
+
text-overflow: ellipsis;
|
|
2175
2176
|
`,Hd=L.default.span`
|
|
2176
2177
|
${({lineHeight:e=p.font_size_200,fontSize:t=p.font_size_175})=>El({lineHeight:e,fontSize:t})}
|
|
2178
|
+
text-overflow: ellipsis;
|
|
2177
2179
|
`,Gd=L.default(ht).attrs({as:"button"})`
|
|
2178
2180
|
display: flex;
|
|
2179
2181
|
background-color: ${p.color_white};
|
|
@@ -2219,6 +2221,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
2219
2221
|
`,bF=L.default.span`
|
|
2220
2222
|
display: inline-flex;
|
|
2221
2223
|
align-items: center;
|
|
2224
|
+
overflow: hidden;
|
|
2222
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,s=hF({...e,children:i}),u=S.useRef(null),{labelProps:d,triggerProps:f,valueProps:g,menuProps:m,errorMessageProps:h}=pF(e,s,u),{buttonProps:b}=Dr(f,u);return Q(Et,{children:[e.label?Q(Re,{...d,srOnly:n,mb:p.spacing_150,onClick:()=>s.open(),bold:t,children:[e.label,e.tooltipContent?E(Qe,{icon:e.tooltipIcon,children:e.tooltipContent}):null]}):null,E(mF,{state:s,triggerRef:u,label:e.label,name:e.name}),Q(Gd,{...b,ref:u,isOpen:s.isOpen,"data-state":a?"invalid":void 0,children:[E(bF,{...g,children:s.selectedItem?l==="textValue"?E(ow,{children:s.selectedItem.textValue}):E(ow,{children:s.selectedItem.rendered}):E(Hd,{children:r})}),o?E(Pl,{style:{width:"18px",height:"18px"},"aria-hidden":"true"}):null]}),e.errorMessage?E(St,{...h,children:e.errorMessage}):null,s.isOpen?E(Gr,{state:s,targetRef:u,isTargetWidth:!0,children:E(R$,{...m,state:s})}):null]})};aw.displayName="SingleSelect";function yF(e,t,n){const{disallowEmptySelection:r,isDisabled:o}=e,a=Zi({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}=ol({...e,labelElementType:"span"});d.onKeyDown=d.onKeyDownCapture,delete d.onKeyDownCapture;const h=$n(e,{labelable:!0}),b=fe(d,l,g),v=ct();return{labelProps:{...f,onClick:()=>{var _;e.isDisabled||((_=n.current)==null||_.focus(),Kc("keyboard"))}},triggerProps:fe(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`
|
|
2223
2226
|
width: ${p.sizing_500};
|
|
2224
2227
|
height: ${p.sizing_600};
|