@theroutingcompany/components 0.0.117-alpha.6 → 0.0.117-alpha.8
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 +26 -17
- package/dist/trc-components.es.js.map +1 -1
- package/dist/trc-components.umd.js +2 -2
- 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
|
@@ -2084,7 +2084,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
2084
2084
|
/* border-top-width: 0.5px; */
|
|
2085
2085
|
margin-top: -1px;
|
|
2086
2086
|
grid-area: decrement;
|
|
2087
|
-
`;function Bx(e,t){var n;if(e.length&&((n=e[0])!=null&&n.value)){const r=e[0].value;return t.indexOf(r)}}const Vd=c.forwardRef((e,t)=>{const{disabled:n,readOnly:r,required:o,paddingSize:a="small",label:i,errorMessage:l,placeholder:s="Enter number...",showStepper:u=!0,min:d,max:f,height:g=El.small,locale:m="en-US",isInvalid:h,boldLabel:b=!0,tooltipContent:v,..._}=e,y=Ft(),w=n??y,D=r,T=_n(t),P=WM({..._,isDisabled:w,isReadOnly:D,minValue:d,maxValue:f,placeholder:s,locale:m}),{labelProps:M,groupProps:$,inputProps:A,incrementButtonProps:z,decrementButtonProps:x,errorMessageProps:K}=UM({..._,isDisabled:w,isReadOnly:D,minValue:d,maxValue:f,placeholder:s,label:i},P,T);let O=null;typeof i=="string"?O=Q(Re,{...M,mb:p.spacing_150,bold:b,children:[i,v?E(Qe,{children:v}):null]}):c.isValidElement(i)&&(O=c.cloneElement(i,{...M}));const I=j=>{const{formatOptions:C}=e;if((C==null?void 0:C.style)==="unit"){const G=Intl.NumberFormat(m,C),B=G.formatToParts(1).filter(H=>H.type==="unit"),N=G.formatToParts(3).filter(H=>H.type==="unit"),V=Bx(B,P.inputValue),J=Bx(N,P.inputValue);let U;if(V&&V>-1?U=V:J&&J>-1&&(U=J),U){const H=j.target.selectionStart;if(H&&H>U){const X=U-1;j.target.setSelectionRange(X,X)}}}};return Q(Et,{children:[O,u?Q(HM,{...$,height:typeof g=="string"?g:void 0,children:[E(GM,{height:g,...A,"data-value":P.numberValue,paddingSize:a,ref:T,onClick:I,onFocus:I,required:o,"data-state":h?"invalid":void 0}),E(YM,{...z,children:E(De.KeyboardArrowUp,{})}),E(qM,{...x,children:E(De.KeyboardArrowDown,{})})]}):E(Nt,{height:g,ref:T,...A,"data-value":P.numberValue,paddingSize:a,required:o,"data-state":h?"invalid":void 0}),l?E(St,{...K,children:l}):null]})});Vd.displayName="NumberInput";const XM=e=>{var n;const t=Object.fromEntries(new FormData(e));for(let r=0;r<e.elements.length;r++){const o=e.elements[r];o.attributes["data-value"]&&(t[o.name]=(n=o.attributes["data-value"])==null?void 0:n.value)}return t},jx=c.forwardRef((e,t)=>{const{errorMessage:n,disabled:r,readOnly:o,paddingSize:a="large",label:i,validationState:l,placeholder:s="Enter text...",rows:u=5,boldLabel:d=!0,...f}=e,g=_n(t),m=Ft(),h=r??m,{labelProps:b,inputProps:v,errorMessageProps:_}=ua({...f,isDisabled:h,isReadOnly:o,placeholder:s,label:i,inputElementType:"textarea"},g);let y=null;return typeof i=="string"?y=E(Re,{...b,mb:p.spacing_150,bold:d,children:i}):c.isValidElement(i)&&(y=c.cloneElement(i,{...b,mb:p.spacing_150})),Q(Et,{children:[y,E(Nt,{as:"textarea","data-state":l,paddingSize:a,ref:g,placeholder:"Enter...",...v,rows:u}),n?E(St,{..._,children:n}):null]})});jx.displayName="TextAreaInput";const Bd=c.forwardRef((e,t)=>{const{isInvalid:n,...r}=e,{focus:o,height:a=El.small,inputBorderRadius:i,connectLeft:l=null,connectRight:s=null,errorMessage:u,disabled:d,readOnly:f,required:g,paddingSize:m,label:h,validationState:b=n===!0?"invalid":"valid",placeholder:v="Enter text...",className:_,fontSize:y,lineHeight:w,boldLabel:D=!0,...T}=r,P=_n(t),M=Ft(),$=d??M,{labelProps:A,inputProps:z,errorMessageProps:x}=ua({...T,isDisabled:$,isReadOnly:f,placeholder:v,label:h},P);let K=null;return typeof h=="string"?K=Q(Re,{...A,mb:p.spacing_150,bold:D,children:[h,r.tooltipContent?E(Qe,{children:r.tooltipContent}):null]}):c.isValidElement(h)&&(K=c.cloneElement(h,{...A,mb:p.spacing_100})),c.useEffect(()=>{o&&P.current&&P.current.focus()},[o,P]),Q(Et,{"data-id":"input-wrapper",children:[K,E(hd,{left:l,right:s,children:E(Nt,{height:a,fontSize:y,lineHeight:w,"data-id":"input-base",borderRadius:i,"data-state":b,paddingSize:m,ref:P,placeholder:"Enter...",type:"text",...z,required:g,className:_})}),u?E(St,{...x,children:u}):null]})});Bd.displayName="TextInput";const jd=c.createContext({});jd.displayName="FormControlContext";function zl(){return c.useContext(jd)}function JM({children:e,label:t,errorMessage:n,tooltipContent:r,tooltipIcon:o,validationState:a,id:i,...l}){const{errorMessageProps:s,fieldProps:u,labelProps:d}=al({errorMessage:n,label:t,validationState:a,id:i,...l});return E(jd.Provider,{value:u,children:Q(Et,{children:[Q(Re,{...d,display:"flex",mb:p.spacing_150,children:[t,r?E(Qe,{icon:o,children:r}):null]}),e,n?E(St,{...s,children:n}):null]})})}const Ux=c.forwardRef((e,t)=>{const{label:n,tooltipContent:r,tooltipIcon:o,...a}=e;return E(Bd,{paddingSize:"small",ref:t,label:Q(Re,{mb:p.spacing_150,children:[n,r?E(Qe,{icon:o,children:r}):null]}),...a})});Ux.displayName="TextFormControl";const Wx=c.forwardRef((e,t)=>{const{label:n,tooltipContent:r,tooltipIcon:o,...a}=e;return E(jx,{ref:t,label:Q(Re,{mb:p.spacing_150,children:[n,r?E(Qe,{icon:o,children:r}):null]}),...a})});Wx.displayName="TextAreaFormControl";const Hx=c.forwardRef((e,t)=>{const{label:n,tooltipContent:r,tooltipIcon:o,...a}=e;return E(Vd,{ref:t,label:Q(Re,{mb:p.spacing_150,children:[n,r?E(Qe,{icon:o,children:r}):null]}),...a})});Hx.displayName="NumberFormControl";const Gx=(e,t,n,r=[])=>{let o=!1,a=e.target;for(;a;){if(a.classList&&Array.from(a.classList).some(l=>r.includes(l))){o=!0;break}a=a.parentElement}o||t.current&&!t.current.contains(e.target)&&n()},Yx=L.default(Pr)`
|
|
2087
|
+
`;function Bx(e,t){var n;if(e.length&&((n=e[0])!=null&&n.value)){const r=e[0].value;return t.indexOf(r)}}const Vd=c.forwardRef((e,t)=>{const{disabled:n,readOnly:r,required:o,paddingSize:a="small",label:i,errorMessage:l,placeholder:s="Enter number...",showStepper:u=!0,min:d,max:f,height:g=El.small,locale:m="en-US",isInvalid:h,boldLabel:b=!0,tooltipContent:v,..._}=e,y=Ft(),w=n??y,D=r,T=_n(t),P=WM({..._,isDisabled:w,isReadOnly:D,minValue:d,maxValue:f,placeholder:s,locale:m}),{labelProps:M,groupProps:$,inputProps:A,incrementButtonProps:z,decrementButtonProps:x,errorMessageProps:K}=UM({..._,isDisabled:w,isReadOnly:D,minValue:d,maxValue:f,placeholder:s,label:i},P,T);let O=null;typeof i=="string"?O=Q(Re,{...M,mb:p.spacing_150,bold:b,children:[i,v?E(Qe,{children:v}):null]}):c.isValidElement(i)&&(O=c.cloneElement(i,{...M}));const I=j=>{const{formatOptions:C}=e;if((C==null?void 0:C.style)==="unit"){const G=Intl.NumberFormat(m,C),B=G.formatToParts(1).filter(H=>H.type==="unit"),N=G.formatToParts(3).filter(H=>H.type==="unit"),V=Bx(B,P.inputValue),J=Bx(N,P.inputValue);let U;if(V&&V>-1?U=V:J&&J>-1&&(U=J),U){const H=j.target.selectionStart;if(H&&H>U){const X=U-1;j.target.setSelectionRange(X,X)}}}};return Q(Et,{children:[O,u?Q(HM,{...$,height:typeof g=="string"?g:void 0,children:[E(GM,{height:g,...A,"data-value":P.numberValue,paddingSize:a,ref:T,onClick:I,onFocus:I,required:o,"data-state":h?"invalid":void 0}),E(YM,{...z,children:E(De.KeyboardArrowUp,{})}),E(qM,{...x,children:E(De.KeyboardArrowDown,{})})]}):E(Nt,{height:g,ref:T,...A,"data-value":P.numberValue,paddingSize:a,required:o,"data-state":h?"invalid":void 0}),l?E(St,{...K,children:l}):null]})});Vd.displayName="NumberInput";const XM=e=>{var n;const t=Object.fromEntries(new FormData(e));for(let r=0;r<e.elements.length;r++){const o=e.elements[r];o.attributes["data-value"]&&(t[o.name]=(n=o.attributes["data-value"])==null?void 0:n.value)}return t},jx=c.forwardRef((e,t)=>{const{errorMessage:n,disabled:r,readOnly:o,paddingSize:a="large",label:i,validationState:l,placeholder:s="Enter text...",rows:u=5,boldLabel:d=!0,...f}=e,g=_n(t),m=Ft(),h=r??m,{labelProps:b,inputProps:v,errorMessageProps:_}=ua({...f,isDisabled:h,isReadOnly:o,placeholder:s,label:i,inputElementType:"textarea"},g);let y=null;return typeof i=="string"?y=E(Re,{...b,mb:p.spacing_150,bold:d,children:i}):c.isValidElement(i)&&(y=c.cloneElement(i,{...b,mb:p.spacing_150})),Q(Et,{children:[y,E(Nt,{as:"textarea","data-state":l,paddingSize:a,ref:g,placeholder:"Enter...",...v,rows:u}),n?E(St,{..._,children:n}):null]})});jx.displayName="TextAreaInput";const Bd=c.forwardRef((e,t)=>{const{isInvalid:n,...r}=e,{focus:o,height:a=El.small,inputBorderRadius:i,connectLeft:l=null,connectRight:s=null,errorMessage:u,disabled:d,readOnly:f,required:g,paddingSize:m,label:h,validationState:b=n===!0?"invalid":"valid",placeholder:v="Enter text...",className:_,fontSize:y,lineHeight:w,boldLabel:D=!0,...T}=r,P=_n(t),M=Ft(),$=d??M,{labelProps:A,inputProps:z,errorMessageProps:x}=ua({...T,isDisabled:$,isReadOnly:f,placeholder:v,label:h},P);let K=null;return typeof h=="string"?K=Q(Re,{...A,mb:p.spacing_150,bold:D,children:[h,r.tooltipContent?E(Qe,{children:r.tooltipContent}):null]}):c.isValidElement(h)&&(K=c.cloneElement(h,{...A,mb:p.spacing_100})),c.useEffect(()=>{o&&P.current&&P.current.focus()},[o,P]),Q(Et,{"data-id":"input-wrapper",children:[K,E(hd,{left:l,right:s,children:E(Nt,{height:a,fontSize:y,lineHeight:w,"data-id":"input-base",borderRadius:i,"data-state":b,paddingSize:m,ref:P,placeholder:"Enter...",type:"text",...z,required:g,className:_})}),u?E(St,{...x,children:u}):null]})});Bd.displayName="TextInput";const jd=c.createContext({});jd.displayName="FormControlContext";function zl(){return c.useContext(jd)}function JM({children:e,label:t,errorMessage:n,tooltipContent:r,tooltipIcon:o,validationState:a,id:i,...l}){const{errorMessageProps:s,fieldProps:u,labelProps:d}=al({errorMessage:n,label:t,validationState:a,id:i,...l});return E(jd.Provider,{value:u,children:Q(Et,{children:[Q(Re,{...d,display:"flex",mb:p.spacing_150,bold:!0,children:[t,r?E(Qe,{icon:o,children:r}):null]}),e,n?E(St,{...s,children:n}):null]})})}const Ux=c.forwardRef((e,t)=>{const{label:n,tooltipContent:r,tooltipIcon:o,...a}=e;return E(Bd,{paddingSize:"small",ref:t,label:Q(Re,{mb:p.spacing_150,bold:!0,children:[n,r?E(Qe,{icon:o,children:r}):null]}),...a})});Ux.displayName="TextFormControl";const Wx=c.forwardRef((e,t)=>{const{label:n,tooltipContent:r,tooltipIcon:o,...a}=e;return E(jx,{ref:t,label:Q(Re,{mb:p.spacing_150,bold:!0,children:[n,r?E(Qe,{icon:o,children:r}):null]}),...a})});Wx.displayName="TextAreaFormControl";const Hx=c.forwardRef((e,t)=>{const{label:n,tooltipContent:r,tooltipIcon:o,...a}=e;return E(Vd,{ref:t,label:Q(Re,{mb:p.spacing_150,bold:!0,children:[n,r?E(Qe,{icon:o,children:r}):null]}),...a})});Hx.displayName="NumberFormControl";const Gx=(e,t,n,r=[])=>{let o=!1,a=e.target;for(;a;){if(a.classList&&Array.from(a.classList).some(l=>r.includes(l))){o=!0;break}a=a.parentElement}o||t.current&&!t.current.contains(e.target)&&n()},Yx=L.default(Pr)`
|
|
2088
2088
|
width: 32px;
|
|
2089
2089
|
height: 32px;
|
|
2090
2090
|
padding: 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;
|