@loadsmart/loadsmart-ui 7.1.0 → 7.2.1

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.
@@ -66,6 +66,7 @@ export interface SelectProps extends DropdownProps {
66
66
  onChange?: OnChange;
67
67
  onCreate?: OnCreate;
68
68
  onQueryChange?: OnQueryChange;
69
+ getInputProps?: () => Partial<TextFieldProps>;
69
70
  isValidNewOption?: ((query: string) => boolean) | boolean;
70
71
  createOptionPosition?: CreateOptionPosition;
71
72
  /**
package/dist/index.js CHANGED
@@ -2066,7 +2066,7 @@
2066
2066
  border-right-color: ${r.getToken("color-neutral-light")};
2067
2067
  border-right-width: 1px;
2068
2068
  border-right-style: solid;
2069
- `,Os=t.forwardRef((function(n,r){const{className:a}=n,l=e.__rest(n,["className"]),{disabled:i,expanded:s,toggle:c}=t.useContext(Ui),{register:u}=Sl();return d.default.createElement(Ts,{className:a},d.default.createElement(Cs,Object.assign({"data-testid":"select-trigger-search-field"},l,{ref:e=>{o.isFunction(r)&&r(e),u.setReference(e)},type:"search",disabled:i,onClick:function(){s||c()}})),d.default.createElement(js,null),d.default.createElement(ms.Handle,{"data-testid":"select-trigger-handle"}))}));function _s(e){return null==e?[]:Array.from(e.querySelectorAll("button")||[])}function zs(e){const{keys:n,onActivate:r,onDeactivate:o}=e,[a,l]=t.useState(!1),[i,s]=t.useState(-1),c=t.useRef(),[d,u]=t.useState([]);function g(){var e;s(-1),c.current&&(null===(e=c.current)||void 0===e||e.disconnect())}const f=t.useCallback((function(e){null!=e?(u(_s(e)),function(e){c.current=new MutationObserver((function(){u(_s(e))})),c.current.observe(e,{childList:!0})}(e)):g()}),[]);t.useEffect((function(){return function(){g()}}),[]),t.useEffect((function(){function e(e){const t=e,r=[...n||["TAB"]];if(!ls(t).is(r)||Re(d))return;t.preventDefault();const o=function(e,t,n){const r={Tab:e=>e.shiftKey?-1:1,ArrowUp:()=>-1,ArrowDown:()=>1},o=(r[as(e)]||function(){return 0})(e);return-1===t&&-1===o?(o+n)%n:(t+o+n)%n}(t,i,d.length);s(o),d[o].focus()}return a&&document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[a,n,i,d]);const p=t.useCallback((function(){l(!0),null==r||r()}),[r]),h=t.useCallback((function(){l(!1),null==o||o()}),[o]);return{containerRef:f,active:a,activate:p,deactivate:h}}const Ss={getKey:e=>o.lodash_get(e,"value"),getLabel:e=>o.lodash_get(e,"label")};function Rs(e,t){return null==t?Ss:e[t]||Ss}function Ds(e,t){const n=Array.from(e);if(Re(n))return null;if(t){const e=[];for(const[,t]of n)e.push(t);return e}{const[[,e]]=n;return e}}function Ms(e,t,n){var r;if(0==t.size)return"";if(n)return"";{const o=Ds(t,n);return null!==(r=Rs(e,o._type).getLabel(o))&&void 0!==r?r:""}}function As(t,n){return e.__awaiter(this,void 0,void 0,(function*(){const e=new RegExp(String(n||"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"i");const r=[],o=[];for(const a of t)r.push(Promise.resolve(a.fetch({query:n,regex:e}))),o.push(a.type);const a=yield Promise.allSettled(r);let l=[];return a.forEach(((e,t)=>{if("rejected"===e.status)return;const n=o[t];l=l.concat((e.value||[]).map((e=>Object.assign(Object.assign({},e),{_type:n}))))})),l}))}function Fs(e){e.target.select()}function Ls(n){const{datasources:r,adapters:o}=n,[a,l]=t.useState(new Map),[i,s]=t.useState("idle"),c=t.useRef();function d(){null!=c.current&&clearTimeout(c.current)}const u=t.useCallback((function(t){function n(){return e.__awaiter(this,void 0,void 0,(function*(){l(new Map),s("querying");const e=yield As(r,t);l(function(e,t){const n=new Map;return e.forEach((e=>{const r=Rs(t,e._type);n.set(r.getKey(e),e)})),n}(e,o)),s("queried")}))}d(),s("pending-query"),c.current=setTimeout((()=>{n()}),750)}),[o,r]),g=t.useCallback((function(){s("idle"),l(new Map)}),[]),f=t.useCallback((function(){return Array.from(a.values())}),[a]),p=t.useCallback((function(){g(),u("")}),[g,u]),h=t.useCallback((function(e){return a.get(e)}),[a]);return t.useEffect((()=>()=>{d()}),[]),{get:f,fetch:u,clear:g,status:i,getOptionByKey:h,reset:p}}function Ns(n){const r=Dr(),{multiple:l,onQueryChange:i,onChange:s,onCreate:c,id:d,name:u,disabled:g=!1,onBlur:f,isValidNewOption:p=(e=>Boolean(e)),createOptionPosition:h="last"}=n,m=t.useMemo((()=>function(e){let t=[];var n;return t=t.concat(e.datasources||[]),t=t.concat((n=e.options)?[function(){return{type:"generic",adapter:Ss,fetch:function({regex:e}){return n.filter((({label:t})=>e.test(t)))}}}]:[]),t.map((e=>e()))}(n)),[n.datasources,n.options]),b=t.useMemo((()=>function(e){return a.toArray(e).reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.type]:t.adapter})),{})}(m)),[m]),w=xs({selected:(v=n.value,a.toArray(v||[]).filter((e=>!Re(e)))),multiple:l,adapters:b,onChange:t.useCallback((function(e){null==s||s({target:{id:d,name:u,value:Ds(e,l)}})}),[d,l,u,s])});var v;const $=t.useRef(),k=zs({keys:["ARROW_UP","ARROW_DOWN"],onDeactivate(){var e;null===(e=$.current)||void 0===e||e.focus()}}),[y,x]=t.useState(!1),[P,E]=t.useState(Ms(b,w.selected,l)),T=Ls({datasources:m,adapters:b}),C=t.useMemo((()=>!P.length&&Re(T.get())&&Re(w.selected)&&o.isFunction(p)?!p(P):!p),[P,T,w.selected,p]),j=bs(Object.assign(Object.assign({},n),{expandDisabled:C}));t.useEffect((()=>{y&&(T.fetch(P),j.expand())}),[P,y]);const O=t.useCallback((function(e){const t=Rs(b,e._type),n=t.getKey(e);return{label:t.getLabel(e),value:n,checked:w.selected.has(n)}}),[b,w.selected]),_=t.useCallback((function(e){let t=T.getOptionByKey(e);return t||(t=w.selected.get(e)),t}),[T,w.selected]),z=t.useCallback((function(e){w.toggle(e)}),[w]),S=t.useCallback((function(){return{toggle:j.toggle,expanded:j.expanded,onBlur(e){x(!1),E(l?"":Ms(b,w.selected,l)),T.reset(),null==f||f(e)},expandDisabled:C}}),[b,j.expanded,j.toggle,l,T,w.selected,f,C]),R=t.useCallback((function(){return{id:d,ref(e){null!=e&&($.current=e)},value:P,onChange(e){const t=e.target.value.replace(/\s+/,"");x(""!==t),null==i||i(e),E(e.target.value)},onFocus:Fs}}),[d,P,i,j,T,w.selected]),D=t.useCallback((function(){return{onClick(){var e;x(!1),E(""),w.clear(),T.reset(),null===(e=$.current)||void 0===e||e.focus()}}}),[T,w]),M=t.useCallback((function(){return{ref:k.containerRef,role:"listbox"}}),[k.containerRef]),A=t.useCallback((function({option:e}){const{value:t,checked:n,label:r}=O(e);return{role:"option","aria-selected":n,id:String(t),onClick:()=>(x(!1),l||x(!1),z(e),l),tabIndex:-1}}),[O,z,l]),F=t.useCallback((function(){return{onClick:function(){return function(){e.__awaiter(this,void 0,void 0,(function*(){if(!o.isFunction(c))return;const e=c(P);let t;var n;e&&(n=e,t=a.isObject(n)&&o.isFunction(n.then)?yield e:e),T.fetch(P),t&&z(t)}))}(),l},tabIndex:-1}}),[l,c,P,T,z]),L=t.useCallback((function(){const e=e=>O(e).label.toLocaleLowerCase()===P.toLocaleLowerCase();return o.isFunction(c)&&"queried"===T.status&&(o.isFunction(p)?p(P)&&!!a.isNil([...T.get(),...Array.from(w.selected.values())].find(e)):p)}),[O,p,c,T,P,w.selected]);return t.useEffect((function(){T.fetch("")}),[m]),t.useEffect((function(){(n.autoFocus||r)&&(j.expanded?k.activate():k.deactivate())}),[j.expanded]),t.useEffect((function(){l||E(Ms(b,w.selected,l))}),[b,l,w.selected]),{status:T.status,options:T.get(),value:Ds(w.selected,l),query:P,disabled:g,selectable:w,getMenuProps:M,getSelectableOption:O,getOption:_,getOptionProps:A,getTriggerProps:R,getClearProps:D,getDropdownProps:S,getCreatebleProps:F,isCreatable:L,createOptionPosition:h}}const Bs=g.default.span`
2069
+ `,Os=t.forwardRef((function(n,r){const{className:a}=n,l=e.__rest(n,["className"]),{disabled:i,expanded:s,toggle:c}=t.useContext(Ui),{register:u}=Sl();return d.default.createElement(Ts,{className:a},d.default.createElement(Cs,Object.assign({},l,{"data-testid":"select-trigger-search-field",ref:e=>{o.isFunction(r)&&r(e),u.setReference(e)},type:"search",disabled:i,onClick:function(){s||c()}})),d.default.createElement(js,null),d.default.createElement(ms.Handle,{"data-testid":"select-trigger-handle"}))}));function _s(e){return null==e?[]:Array.from(e.querySelectorAll("button")||[])}function zs(e){const{keys:n,onActivate:r,onDeactivate:o}=e,[a,l]=t.useState(!1),[i,s]=t.useState(-1),c=t.useRef(),[d,u]=t.useState([]);function g(){var e;s(-1),c.current&&(null===(e=c.current)||void 0===e||e.disconnect())}const f=t.useCallback((function(e){null!=e?(u(_s(e)),function(e){c.current=new MutationObserver((function(){u(_s(e))})),c.current.observe(e,{childList:!0})}(e)):g()}),[]);t.useEffect((function(){return function(){g()}}),[]),t.useEffect((function(){function e(e){const t=e,r=[...n||["TAB"]];if(!ls(t).is(r)||Re(d))return;t.preventDefault();const o=function(e,t,n){const r={Tab:e=>e.shiftKey?-1:1,ArrowUp:()=>-1,ArrowDown:()=>1},o=(r[as(e)]||function(){return 0})(e);return-1===t&&-1===o?(o+n)%n:(t+o+n)%n}(t,i,d.length);s(o),d[o].focus()}return a&&document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[a,n,i,d]);const p=t.useCallback((function(){l(!0),null==r||r()}),[r]),h=t.useCallback((function(){l(!1),null==o||o()}),[o]);return{containerRef:f,active:a,activate:p,deactivate:h}}const Ss={getKey:e=>o.lodash_get(e,"value"),getLabel:e=>o.lodash_get(e,"label")};function Rs(e,t){return null==t?Ss:e[t]||Ss}function Ds(e,t){const n=Array.from(e);if(Re(n))return null;if(t){const e=[];for(const[,t]of n)e.push(t);return e}{const[[,e]]=n;return e}}function Ms(e,t,n){var r;if(0==t.size)return"";if(n)return"";{const o=Ds(t,n);return null!==(r=Rs(e,o._type).getLabel(o))&&void 0!==r?r:""}}function As(t,n){return e.__awaiter(this,void 0,void 0,(function*(){const e=new RegExp(String(n||"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"i");const r=[],o=[];for(const a of t)r.push(Promise.resolve(a.fetch({query:n,regex:e}))),o.push(a.type);const a=yield Promise.allSettled(r);let l=[];return a.forEach(((e,t)=>{if("rejected"===e.status)return;const n=o[t];l=l.concat((e.value||[]).map((e=>Object.assign(Object.assign({},e),{_type:n}))))})),l}))}function Fs(e){e.target.select()}function Ls(n){const{datasources:r,adapters:o}=n,[a,l]=t.useState(new Map),[i,s]=t.useState("idle"),c=t.useRef();function d(){null!=c.current&&clearTimeout(c.current)}const u=t.useCallback((function(t){function n(){return e.__awaiter(this,void 0,void 0,(function*(){l(new Map),s("querying");const e=yield As(r,t);l(function(e,t){const n=new Map;return e.forEach((e=>{const r=Rs(t,e._type);n.set(r.getKey(e),e)})),n}(e,o)),s("queried")}))}d(),s("pending-query"),c.current=setTimeout((()=>{n()}),750)}),[o,r]),g=t.useCallback((function(){s("idle"),l(new Map)}),[]),f=t.useCallback((function(){return Array.from(a.values())}),[a]),p=t.useCallback((function(){g(),u("")}),[g,u]),h=t.useCallback((function(e){return a.get(e)}),[a]);return t.useEffect((()=>()=>{d()}),[]),{get:f,fetch:u,clear:g,status:i,getOptionByKey:h,reset:p}}function Ns(n){const r=Dr(),{multiple:l,onQueryChange:i,onChange:s,onCreate:c,getInputProps:d,id:u,name:g,disabled:f=!1,onBlur:p,isValidNewOption:h=(e=>Boolean(e)),createOptionPosition:m="last"}=n,b=t.useMemo((()=>function(e){let t=[];var n;return t=t.concat(e.datasources||[]),t=t.concat((n=e.options)?[function(){return{type:"generic",adapter:Ss,fetch:function({regex:e}){return n.filter((({label:t})=>e.test(t)))}}}]:[]),t.map((e=>e()))}(n)),[n.datasources,n.options]),w=t.useMemo((()=>function(e){return a.toArray(e).reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.type]:t.adapter})),{})}(b)),[b]),v=xs({selected:($=n.value,a.toArray($||[]).filter((e=>!Re(e)))),multiple:l,adapters:w,onChange:t.useCallback((function(e){null==s||s({target:{id:u,name:g,value:Ds(e,l)}})}),[u,l,g,s])});var $;const k=t.useRef(),y=zs({keys:["ARROW_UP","ARROW_DOWN"],onDeactivate(){var e;null===(e=k.current)||void 0===e||e.focus()}}),[x,P]=t.useState(!1),[E,T]=t.useState(Ms(w,v.selected,l)),C=Ls({datasources:b,adapters:w}),j=t.useMemo((()=>!E.length&&Re(C.get())&&Re(v.selected)&&o.isFunction(h)?!h(E):!h),[E,C,v.selected,h]),O=bs(Object.assign(Object.assign({},n),{expandDisabled:j}));t.useEffect((()=>{x&&(C.fetch(E),O.expand())}),[E,x]);const _=t.useCallback((function(e){const t=Rs(w,e._type),n=t.getKey(e);return{label:t.getLabel(e),value:n,checked:v.selected.has(n)}}),[w,v.selected]),z=t.useCallback((function(e){let t=C.getOptionByKey(e);return t||(t=v.selected.get(e)),t}),[C,v.selected]),S=t.useCallback((function(e){v.toggle(e)}),[v]),R=t.useCallback((function(){return{toggle:O.toggle,expanded:O.expanded,onBlur(e){P(!1),T(l?"":Ms(w,v.selected,l)),C.reset(),null==p||p(e)},expandDisabled:j}}),[w,O.expanded,O.toggle,l,C,v.selected,p,j]),D=t.useCallback((function(){return Object.assign(Object.assign({},null==d?void 0:d()),{id:u,ref(e){null!=e&&(k.current=e)},value:E,onChange(e){const t=e.target.value.replace(/\s+/,"");P(""!==t),null==i||i(e),T(e.target.value)},onFocus:Fs})}),[u,E,i,O,C,v.selected]),M=t.useCallback((function(){return{onClick(){var e;P(!1),T(""),v.clear(),C.reset(),null===(e=k.current)||void 0===e||e.focus()}}}),[C,v]),A=t.useCallback((function(){return{ref:y.containerRef,role:"listbox"}}),[y.containerRef]),F=t.useCallback((function({option:e}){const{value:t,checked:n,label:r}=_(e);return{role:"option","aria-selected":n,id:String(t),onClick:()=>(P(!1),l||P(!1),S(e),l),tabIndex:-1}}),[_,S,l]),L=t.useCallback((function(){return{onClick:function(){return function(){e.__awaiter(this,void 0,void 0,(function*(){if(!o.isFunction(c))return;const e=c(E);let t;var n;e&&(n=e,t=a.isObject(n)&&o.isFunction(n.then)?yield e:e),C.fetch(E),t&&S(t)}))}(),l},tabIndex:-1}}),[l,c,E,C,S]),N=t.useCallback((function(){const e=e=>_(e).label.toLocaleLowerCase()===E.toLocaleLowerCase();return o.isFunction(c)&&"queried"===C.status&&(o.isFunction(h)?h(E)&&!!a.isNil([...C.get(),...Array.from(v.selected.values())].find(e)):h)}),[_,h,c,C,E,v.selected]);return t.useEffect((function(){C.fetch("")}),[b]),t.useEffect((function(){(n.autoFocus||r)&&(O.expanded?y.activate():y.deactivate())}),[O.expanded]),t.useEffect((function(){l||T(Ms(w,v.selected,l))}),[w,l,v.selected]),{status:C.status,options:C.get(),value:Ds(v.selected,l),query:E,disabled:f,selectable:v,getMenuProps:A,getSelectableOption:_,getOption:z,getOptionProps:F,getTriggerProps:D,getClearProps:M,getDropdownProps:R,getCreatebleProps:L,isCreatable:N,createOptionPosition:m}}const Bs=g.default.span`
2070
2070
  /* highlightMatch splits the label into separate HTML elements, thus we need
2071
2071
  to preserve white-spaces, otherwise the browser wouldn't render them. */
2072
2072
  white-space: pre;
@@ -2539,7 +2539,7 @@
2539
2539
  `}
2540
2540
  `,Id=g.default(fe)`
2541
2541
  ${l.conditional({"transform: rotate(180deg);":l.whenProps({$rotate:!0})})}
2542
- `;function Hd(t){const{expanded:n,disabled:r}=t,o=e.__rest(t,["expanded","disabled"]);return d.default.createElement(Bd,Object.assign({type:"button"},o,{"aria-haspopup":"true","aria-expanded":n,disabled:r,trailing:!r&&d.default.createElement(Id,{name:"chevron-down",size:16,$rotate:n})}))}const Wd={normalize:!0};function Ud(e,t=Wd){const n=Object.assign(Object.assign({},Wd),t),r=function(){let t=new Date;null!=e&&(t=new Date(e));return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),n.normalize?12:t.getUTCHours(),n.normalize?0:t.getUTCMinutes(),n.normalize?0:t.getUTCSeconds(),n.normalize?0:t.getUTCMilliseconds()))}();return{get:()=>r,getYear:()=>r.getUTCFullYear(),getMonth:()=>r.getUTCMonth(),getDate:()=>r.getUTCDate(),getTime:()=>r.getTime(),getWeekday:()=>r.getUTCDay(),getHours:()=>r.getUTCHours(),getMinutes:()=>r.getUTCMinutes(),getSeconds:()=>r.getUTCSeconds(),getMilliseconds:()=>r.getUTCMilliseconds(),matches(...e){if(Re(e))return!1;const t=e.map(qd),n=Ud(r);return t.some((e=>e(n)))},add:(e,t)=>Yd(r,e,t),subtract:(e,t)=>Yd(r,e,-1*t),set(e,t){const n={year:r.getUTCFullYear(),month:r.getUTCMonth(),day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds(),[e]:t};return r.setUTCFullYear(n.year),r.setUTCMonth(n.month),r.setUTCDate(n.day),r.setUTCHours(n.hour),r.setUTCMinutes(n.minute),r.setUTCSeconds(n.second),r.setUTCMilliseconds(n.millisecond),this},is:(e,t,n)=>function(t,n){let r;switch(e){case">=":r=t>=n;break;case">":r=t>n;break;case"<":r=t<n;break;case"<=":r=t<=n;break;default:r=t===n}return r}(Vd(r,n),Vd(t.get(),n)),toString:()=>r.toISOString()}}function Vd(e,t="day"){const n=Qd.toString(),r={year:4,month:7,day:10,hour:13,minute:16,second:19,millisecond:24}[t];if(null==r)throw new Error(`precision ${t} is not supported`);const o=n.slice(r),a=e.toISOString().slice(0,r);return new Date(`${a}${o}`).getTime()}function Yd(e,t,n){const r={year:0,month:0,day:0,hour:0,minute:0,second:0,millisecond:0,[t]:n};return Ud(new Date(Date.UTC(e.getUTCFullYear()+r.year,e.getUTCMonth()+r.month,e.getUTCDate()+r.day,e.getUTCHours()+r.hour,e.getUTCMinutes()+r.minute,e.getUTCSeconds()+r.second,e.getUTCMilliseconds()+r.millisecond)),{normalize:!1})}function qd(e){if(o.isFunction(e))return e;const[t,n]=function(e){let t;if(Array.isArray(e)){const n=null!=e[0]?Ud(e[0]):Qd,r=null!=e[1]?Ud(e[1]):Jd;t=[n.getTime(),r.getTime()]}else{const n=Ud(e).getTime();t=[n,n]}return t}(e);return function(e){if(t>n)throw new Zd([t,n]);return t<=e.getTime()&&e.getTime()<=n}}function Gd(e,t=2){return String(e).padStart(t,"0")}class Zd extends Error{constructor([e,t]){super(`Invalid constraint: [${e}, ${t}]`)}}const Kd=Ud(),Qd=Ud(0,{normalize:!1}),Jd=Ud(8639999999999999);function Xd(e){const{constraints:n,onSelect:r,mode:o="single"}=e,l="single"==o?1:2,i=Dr(),[s,c]=t.useState((()=>ru(e.selected))),[d,u]=t.useState((()=>{const t=null!=e.month?e.month:Kd.getMonth();return nu(null!=e.year?e.year:Kd.getYear(),t,l)}));function g(e){var t,n;const[r]=d,o=new Date(null!==(t=e.year)&&void 0!==t?t:r.year,null!==(n=e.month)&&void 0!==n?n:r.month);u(nu(o.getFullYear(),o.getMonth(),l))}function f(e){const[t,n]=ru(e);function o(e){return null!=e?Ud(e).toString():null}c([t,n]),i&&(null==r||r([o(t),o(n)]))}return t.useEffect((function(){g({month:e.month,year:e.year})}),[e.month,e.year]),t.useEffect((function(){const t=ru(e.selected);t[0]==s[0]&&t[1]==s[1]||c(t)}),[e.selected]),{mode:o,months:d,selected:s,constraints:a.toArray(n||[]),clear:function(){f([null,null])},set:g,select:f}}const eu=864e5;function tu(e,t){const n=Ud(Date.UTC(e,t)),r=n.getWeekday(),o=32-new Date(Date.UTC(e,t,32)).getUTCDate(),a=[];for(let e=r;e>0;e--)a.push(Ud(n.getTime()-e*eu));for(let e=0;e<o;e++)a.push(Ud(n.getTime()+e*eu));for(let e=0;(r+o+e)%7!=0;e++)a.push(Ud(n.getTime()+(o+e)*eu));return{month:n.getMonth(),year:n.getYear(),days:a}}function nu(e,t,n=1){if(t<0||t>11)throw new Error("Invalid month! Please, provide a number between 0 (January) and 11 (December).");const r=new Array;for(let o=0;o<n;o++)r.push(tu(e,t+o));return r}function ru(e){const[t,n]=a.toArray(e);return[null!=t?Ud(t).getTime():null,null!=n?Ud(null!=n?n:t).getTime():null]}const ou=(e,t)=>{const n=lu[t].format(e.get());return(iu[t]||o.identity)(n)};function au(e){const t=function(e){function t(e){return null!=e&&["M","d","D","Y","H","h","m","s","A","a","o"].includes(e)?"token":"string"}const n=[];let r,o=0,a=!1;for(;o<e.length;){const l=Math.max(0,n.length-1),i=e.charAt(o);o++,["[","]"].includes(i)?a="["===i:a?n[l]=`${n[l]||""}${i}`:r!==i&&[t(r),t(i)].includes("token")?n.push(i):n[l]=`${n[l]||""}${i}`,r=i}return n}(e);return{format:e=>t.map(((n,r)=>{const o=t[r-1];return n in lu?ou(e,n):n in su&&su[n].valid(o)?su[n].format(ou(e,o)):n})).join("")}}const lu={MM:new Intl.DateTimeFormat("en-US",{month:"2-digit"}),MMM:new Intl.DateTimeFormat("en-US",{month:"short"}),MMMM:new Intl.DateTimeFormat("en-US",{month:"long"}),D:new Intl.DateTimeFormat("en-US",{day:"numeric"}),DD:new Intl.DateTimeFormat("en-US",{day:"2-digit"}),ddd:new Intl.DateTimeFormat("en-US",{weekday:"short"}),dddd:new Intl.DateTimeFormat("en-US",{weekday:"long"}),YYYY:new Intl.DateTimeFormat("en-US",{year:"numeric"}),HH:new Intl.DateTimeFormat("en-US",{hour:"2-digit",hour12:!1}),hh:new Intl.DateTimeFormat("en-US",{hour:"2-digit",hour12:!0}),mm:new Intl.DateTimeFormat("en-US",{minute:"2-digit",hour12:!1}),ss:new Intl.DateTimeFormat("en-US",{second:"2-digit",hour12:!1}),a:new Intl.DateTimeFormat("en-US",{hour:"2-digit",hour12:!0}),A:new Intl.DateTimeFormat("en-US",{hour:"2-digit",hour12:!0})},iu={hh:e=>e?Gd(e.split(/\s/)[0],2):e,HH:e=>e?Gd(e,2):e,mm:e=>e?Gd(e,2):e,ss:e=>e?Gd(e,2):e,a:e=>e?(e.split(/\s/)[1]||"").toLowerCase():e,A:e=>e?(e.split(/\s/)[1]||"").toUpperCase():e},su={o:{valid:e=>new Set(["D","DD"]).has(e),format:e=>{return(t=parseInt(e,10))%10==1&&11!==t?"st":t%10==2&&12!==t?"nd":t%10==3&&13!==t?"rd":"th";var t}}},cu=g.default(Sn)`
2542
+ `;function Hd(t){const{expanded:n,disabled:r}=t,o=e.__rest(t,["expanded","disabled"]);return d.default.createElement(Bd,Object.assign({type:"button"},o,{"aria-haspopup":"true","aria-expanded":n,disabled:r,trailing:!r&&d.default.createElement(Id,{name:"chevron-down",size:16,$rotate:n})}))}const Wd={normalize:!0};function Ud(e,t=Wd){const n=Object.assign(Object.assign({},Wd),t),r=function(){let t=new Date;null!=e&&(t=new Date(e));return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),n.normalize?12:t.getUTCHours(),n.normalize?0:t.getUTCMinutes(),n.normalize?0:t.getUTCSeconds(),n.normalize?0:t.getUTCMilliseconds()))}();return{get:()=>r,getYear:()=>r.getUTCFullYear(),getMonth:()=>r.getUTCMonth(),getDate:()=>r.getUTCDate(),getTime:()=>r.getTime(),getWeekday:()=>r.getUTCDay(),getHours:()=>r.getUTCHours(),getMinutes:()=>r.getUTCMinutes(),getSeconds:()=>r.getUTCSeconds(),getMilliseconds:()=>r.getUTCMilliseconds(),matches(...e){if(Re(e))return!1;const t=e.map(qd),n=Ud(r);return t.some((e=>e(n)))},add:(e,t)=>Yd(r,e,t),subtract:(e,t)=>Yd(r,e,-1*t),set(e,t){const n={year:r.getUTCFullYear(),month:r.getUTCMonth(),day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds(),[e]:t};return r.setUTCFullYear(n.year),r.setUTCMonth(n.month),r.setUTCDate(n.day),r.setUTCHours(n.hour),r.setUTCMinutes(n.minute),r.setUTCSeconds(n.second),r.setUTCMilliseconds(n.millisecond),this},is:(e,t,n)=>function(t,n){let r;switch(e){case">=":r=t>=n;break;case">":r=t>n;break;case"<":r=t<n;break;case"<=":r=t<=n;break;default:r=t===n}return r}(Vd(r,n),Vd(t.get(),n)),toString:()=>r.toISOString()}}function Vd(e,t="day"){const n=Qd.toString(),r={year:4,month:7,day:10,hour:13,minute:16,second:19,millisecond:24}[t];if(null==r)throw new Error(`precision ${t} is not supported`);const o=n.slice(r),a=e.toISOString().slice(0,r);return new Date(`${a}${o}`).getTime()}function Yd(e,t,n){const r={year:0,month:0,day:0,hour:0,minute:0,second:0,millisecond:0,[t]:n};return Ud(new Date(Date.UTC(e.getUTCFullYear()+r.year,e.getUTCMonth()+r.month,e.getUTCDate()+r.day,e.getUTCHours()+r.hour,e.getUTCMinutes()+r.minute,e.getUTCSeconds()+r.second,e.getUTCMilliseconds()+r.millisecond)),{normalize:!1})}function qd(e){if(o.isFunction(e))return e;const[t,n]=function(e){let t;if(Array.isArray(e)){const n=null!=e[0]?Ud(e[0]):Qd,r=null!=e[1]?Ud(e[1]):Jd;t=[n.getTime(),r.getTime()]}else{const n=Ud(e).getTime();t=[n,n]}return t}(e);return function(e){if(t>n)throw new Zd([t,n]);return t<=e.getTime()&&e.getTime()<=n}}function Gd(e,t=2){return String(e).padStart(t,"0")}class Zd extends Error{constructor([e,t]){super(`Invalid constraint: [${e}, ${t}]`)}}const Kd=Ud(),Qd=Ud(0,{normalize:!1}),Jd=Ud(8639999999999999);function Xd(e){const{constraints:n,onSelect:r,mode:o="single"}=e,l="single"==o?1:2,i=Dr(),[s,c]=t.useState((()=>ru(e.selected))),[d,u]=t.useState((()=>{const t=null!=e.month?e.month:Kd.getMonth();return nu(null!=e.year?e.year:Kd.getYear(),t,l)}));function g(e){var t,n;const[r]=d,o=new Date(null!==(t=e.year)&&void 0!==t?t:r.year,null!==(n=e.month)&&void 0!==n?n:r.month);u(nu(o.getFullYear(),o.getMonth(),l))}function f(e){const[t,n]=ru(e);function o(e){return null!=e?Ud(e).toString():null}c([t,n]),i&&(null==r||r([o(t),o(n)]))}return t.useEffect((function(){g({month:e.month,year:e.year})}),[e.month,e.year]),t.useEffect((function(){const t=ru(e.selected);t[0]==s[0]&&t[1]==s[1]||c(t)}),[e.selected]),{mode:o,months:d,selected:s,constraints:a.toArray(n||[]),clear:function(){f([null,null])},set:g,select:f}}const eu=864e5;function tu(e,t){const n=Ud(Date.UTC(e,t)),r=n.getWeekday(),o=32-new Date(Date.UTC(e,t,32)).getUTCDate(),a=[];for(let e=r;e>0;e--)a.push(Ud(n.getTime()-e*eu));for(let e=0;e<o;e++)a.push(Ud(n.getTime()+e*eu));for(let e=0;(r+o+e)%7!=0;e++)a.push(Ud(n.getTime()+(o+e)*eu));return{month:n.getMonth(),year:n.getYear(),days:a}}function nu(e,t,n=1){if(t<0||t>11)throw new Error("Invalid month! Please, provide a number between 0 (January) and 11 (December).");const r=new Array;for(let o=0;o<n;o++)r.push(tu(e,t+o));return r}function ru(e){const[t,n]=a.toArray(e);return[null!=t?Ud(t).getTime():null,null!=n?Ud(null!=n?n:t).getTime():null]}const ou=(e,t)=>{const n=lu[t].format(e.get());return(iu[t]||o.identity)(n)};function au(e){const t=function(e){function t(e){return null!=e&&["M","d","D","Y","H","h","m","s","A","a","o"].includes(e)?"token":"string"}const n=[];let r,o=0,a=!1;for(;o<e.length;){const l=Math.max(0,n.length-1),i=e.charAt(o);o++,["[","]"].includes(i)?a="["===i:a?n[l]=`${n[l]||""}${i}`:r!==i&&[t(r),t(i)].includes("token")?n.push(i):n[l]=`${n[l]||""}${i}`,r=i}return n}(e);return{format:e=>t.map(((n,r)=>{const o=t[r-1];return n in lu?ou(e,n):n in su&&su[n].valid(o)?su[n].format(ou(e,o)):n})).join("")}}const lu={MM:new Intl.DateTimeFormat("en-US",{month:"2-digit"}),MMM:new Intl.DateTimeFormat("en-US",{month:"short"}),MMMM:new Intl.DateTimeFormat("en-US",{month:"long"}),D:new Intl.DateTimeFormat("en-US",{day:"numeric"}),DD:new Intl.DateTimeFormat("en-US",{day:"2-digit"}),ddd:new Intl.DateTimeFormat("en-US",{weekday:"short"}),dddd:new Intl.DateTimeFormat("en-US",{weekday:"long"}),YYYY:new Intl.DateTimeFormat("en-US",{year:"numeric"}),HH:new Intl.DateTimeFormat("en-US",{hour:"2-digit",hourCycle:"h23"}),hh:new Intl.DateTimeFormat("en-US",{hour:"2-digit",hour12:!0}),mm:new Intl.DateTimeFormat("en-US",{minute:"2-digit",hour12:!1}),ss:new Intl.DateTimeFormat("en-US",{second:"2-digit",hour12:!1}),a:new Intl.DateTimeFormat("en-US",{hour:"2-digit",hour12:!0}),A:new Intl.DateTimeFormat("en-US",{hour:"2-digit",hour12:!0})},iu={hh:e=>e?Gd(e.split(/\s/)[0],2):e,HH:e=>e?Gd(e,2):e,mm:e=>e?Gd(e,2):e,ss:e=>e?Gd(e,2):e,a:e=>e?(e.split(/\s/)[1]||"").toLowerCase():e,A:e=>e?(e.split(/\s/)[1]||"").toUpperCase():e},su={o:{valid:e=>new Set(["D","DD"]).has(e),format:e=>{return(t=parseInt(e,10))%10==1&&11!==t?"st":t%10==2&&12!==t?"nd":t%10==3&&13!==t?"rd":"th";var t}}},cu=g.default(Sn)`
2543
2543
  ${en(l.conditional({body:l.whenProps({$status:["default","faded"]}),"body-bold":l.whenProps({$status:["current-day","selection-start","selection","selection-end"]})}))}
2544
2544
 
2545
2545
  user-select: none;