kwant-ui 3.51.0-dev.42 → 3.51.0-dev.43
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/index.es.js +1 -1
- package/dist/index.js +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1082,7 +1082,7 @@ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import r,{css as
|
|
|
1082
1082
|
display: grid;
|
|
1083
1083
|
place-items: center;
|
|
1084
1084
|
cursor: pointer;
|
|
1085
|
-
`,zt=n=>{const{width:r="fit-content",minHeight:a="48px",message:c,type:l="info",showActionBtn:i,actionBtnLabel:o,showCloseBtn:s,onActionBtnClick:h,onClose:v}=n,u=(e=>xt[e])(l);return t(Mt,{type:l,width:r,minHeight:a,onMouseDown:e=>e.stopPropagation(),children:[e(Et,{children:u}),t(Ht,{children:[c," "]}),e(Pt,{role:"button",children:i&&e(ue,{label:o,variant:"outline",secondary:!0,onClick:h})}),s&&e(Ot,{onClick:v,children:yt})]})},Zt=({message:t,type:n,id:r,config:a})=>{const{removeToast:c}=m(ut);return e(mt,{children:e(zt,{minHeight:"60px",width:"100%",type:n,message:t,actionBtnLabel:a?.actionBtnLabel,showActionBtn:a?.showActionBtn,showCloseBtn:!0,onActionBtnClick:a?.onActionBtnClick,onClose:(e=>()=>c(e))(r)})})},jt=({children:n,position:r,timeout:a,offsetX:c,offsetY:l})=>{const[i,o]=v([]),[s,h]=v({position:r,timeout:a,offsetX:c,offsetY:l}),p=u([]),g=e=>{const t=p.current.find(t=>t.id===e);t&&(clearTimeout(t?.timeout),p.current=p.current.filter(t=>t.id!==e))},m=(e,t)=>{o(n=>{const r=n.findIndex(t=>t.id===e),a=[...n];return a[r]=t,a})},d=e=>{const t=i.filter(t=>t.id!==e);o(t),g(e)},f=()=>{i.length>=5&&(()=>{const[e,...t]=i;o(t),g(p.current[0].id)})()},_=e=>{let t=setTimeout(()=>{o(t=>t.filter(t=>t.id!==e.id)),g(e.id)},e.config?.timeout??s.timeout??5e3);p.current.push({id:e.id,timeout:t})},w=e=>"promise"===e?(t,n)=>{f();const r={message:n.pendingMessage,id:Ie(),type:e};return o(e=>[...e,r]),t.then(e=>{n.successMessage?m(r.id,{...r,message:n.successMessage,type:"success",config:{timeout:3e3}}):d(r.id),n.onSuccess?.(e)}).catch(e=>{n.errorMessage?m(r.id,{...r,message:n.errorMessage,type:"error",config:{timeout:3e3}}):d(r.id),n.onError?.(e)}).finally(()=>{_(r),n.onFinally?.()}),r.id}:(t,n)=>{f();const r={message:t,id:Ie(),type:e,config:n};return o(e=>[...e,r]),_(r),r.id},b={success:w("success"),error:w("error"),warning:w("warning"),info:w("info"),alert:w("alert"),promise:w("promise")};return t(ut.Provider,{value:{toast:b,removeToast:d,setConfig:h},children:[i.length>0&&H(e(gt,{position:s.position??"top-center",offsetX:s.offsetX??50,offsetY:s.offsetY??50,onClick:e=>e.stopPropagation(),children:i.map(t=>e(Zt,{...t},t.id))}),document.getElementById("toasts")),n]})},Vt=e=>{const{toast:t,setConfig:n,removeToast:r}=m(ut);return o(()=>{e&&n(e)},[e]),{...t,removeToast:r}},Ct=(e,t)=>{const{ignore:n,event:r="click"}=t||{},a=i.useRef();return i.useEffect(()=>{const t=t=>{if(n&&n.length)for(let e=0;e<n.length;e++)if(t.target.closest(n[e]))return;a.current&&!a.current.contains(t.target)&&e()};return document.addEventListener(r,t),()=>{document.removeEventListener(r,t)}},[a,e]),a};function At(e,t=400){const[n,r]=v(e);return o(()=>{const n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}const Lt=e=>{const[t,n]=v(e);return o(()=>{n(!!e)},[e]),{isActive:t,toggle:()=>{n(!t)},close:()=>{n(!1)},open:()=>{n(!0)},set:e=>{n(e)}}};var Bt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function kt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function St(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var Rt={exports:{}};Rt.exports=function(){var e=1e3,t=6e4,n=36e5,r="millisecond",a="second",c="minute",l="hour",i="day",o="week",s="month",h="quarter",v="year",u="date",p="Invalid Date",g=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,m=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,d={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},f=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},_={s:f,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),a=n%60;return(t<=0?"+":"-")+f(r,2,"0")+":"+f(a,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),a=t.clone().add(r,s),c=n-a<0,l=t.clone().add(r+(c?-1:1),s);return+(-(r+(n-a)/(c?a-l:l-a))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:s,y:v,w:o,d:i,D:u,h:l,m:c,s:a,ms:r,Q:h}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},w="en",b={};b[w]=d;var x="$isDayjsObject",y=function(e){return e instanceof P||!(!e||!e[x])},M=function e(t,n,r){var a;if(!t)return w;if("string"==typeof t){var c=t.toLowerCase();b[c]&&(a=c),n&&(b[c]=n,a=c);var l=t.split("-");if(!a&&l.length>1)return e(l[0])}else{var i=t.name;b[i]=t,a=i}return!r&&a&&(w=a),a||!r&&w},E=function(e,t){if(y(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new P(n)},H=_;H.l=M,H.i=y,H.w=function(e,t){return E(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var P=function(){function d(e){this.$L=M(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var f=d.prototype;return f.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(H.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(g);if(r){var a=r[2]-1||0,c=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],a,r[3]||1,r[4]||0,r[5]||0,r[6]||0,c)):new Date(r[1],a,r[3]||1,r[4]||0,r[5]||0,r[6]||0,c)}}return new Date(t)}(e),this.init()},f.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},f.$utils=function(){return H},f.isValid=function(){return!(this.$d.toString()===p)},f.isSame=function(e,t){var n=E(e);return this.startOf(t)<=n&&n<=this.endOf(t)},f.isAfter=function(e,t){return E(e)<this.startOf(t)},f.isBefore=function(e,t){return this.endOf(t)<E(e)},f.$g=function(e,t,n){return H.u(e)?this[t]:this.set(n,e)},f.unix=function(){return Math.floor(this.valueOf()/1e3)},f.valueOf=function(){return this.$d.getTime()},f.startOf=function(e,t){var n=this,r=!!H.u(t)||t,h=H.p(e),p=function(e,t){var a=H.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?a:a.endOf(i)},g=function(e,t){return H.w(n.toDate()[e].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},m=this.$W,d=this.$M,f=this.$D,_="set"+(this.$u?"UTC":"");switch(h){case v:return r?p(1,0):p(31,11);case s:return r?p(1,d):p(0,d+1);case o:var w=this.$locale().weekStart||0,b=(m<w?m+7:m)-w;return p(r?f-b:f+(6-b),d);case i:case u:return g(_+"Hours",0);case l:return g(_+"Minutes",1);case c:return g(_+"Seconds",2);case a:return g(_+"Milliseconds",3);default:return this.clone()}},f.endOf=function(e){return this.startOf(e,!1)},f.$set=function(e,t){var n,o=H.p(e),h="set"+(this.$u?"UTC":""),p=(n={},n[i]=h+"Date",n[u]=h+"Date",n[s]=h+"Month",n[v]=h+"FullYear",n[l]=h+"Hours",n[c]=h+"Minutes",n[a]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],g=o===i?this.$D+(t-this.$W):t;if(o===s||o===v){var m=this.clone().set(u,1);m.$d[p](g),m.init(),this.$d=m.set(u,Math.min(this.$D,m.daysInMonth())).$d}else p&&this.$d[p](g);return this.init(),this},f.set=function(e,t){return this.clone().$set(e,t)},f.get=function(e){return this[H.p(e)]()},f.add=function(r,h){var u,p=this;r=Number(r);var g=H.p(h),m=function(e){var t=E(p);return H.w(t.date(t.date()+Math.round(e*r)),p)};if(g===s)return this.set(s,this.$M+r);if(g===v)return this.set(v,this.$y+r);if(g===i)return m(1);if(g===o)return m(7);var d=(u={},u[c]=t,u[l]=n,u[a]=e,u)[g]||1,f=this.$d.getTime()+r*d;return H.w(f,this)},f.subtract=function(e,t){return this.add(-1*e,t)},f.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||"YYYY-MM-DDTHH:mm:ssZ",a=H.z(this),c=this.$H,l=this.$m,i=this.$M,o=n.weekdays,s=n.months,h=n.meridiem,v=function(e,n,a,c){return e&&(e[n]||e(t,r))||a[n].slice(0,c)},u=function(e){return H.s(c%12||12,e,"0")},g=h||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(m,function(e,r){return r||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return H.s(t.$y,4,"0");case"M":return i+1;case"MM":return H.s(i+1,2,"0");case"MMM":return v(n.monthsShort,i,s,3);case"MMMM":return v(s,i);case"D":return t.$D;case"DD":return H.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return v(n.weekdaysMin,t.$W,o,2);case"ddd":return v(n.weekdaysShort,t.$W,o,3);case"dddd":return o[t.$W];case"H":return String(c);case"HH":return H.s(c,2,"0");case"h":return u(1);case"hh":return u(2);case"a":return g(c,l,!0);case"A":return g(c,l,!1);case"m":return String(l);case"mm":return H.s(l,2,"0");case"s":return String(t.$s);case"ss":return H.s(t.$s,2,"0");case"SSS":return H.s(t.$ms,3,"0");case"Z":return a}return null}(e)||a.replace(":","")})},f.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},f.diff=function(r,u,p){var g,m=this,d=H.p(u),f=E(r),_=(f.utcOffset()-this.utcOffset())*t,w=this-f,b=function(){return H.m(m,f)};switch(d){case v:g=b()/12;break;case s:g=b();break;case h:g=b()/3;break;case o:g=(w-_)/6048e5;break;case i:g=(w-_)/864e5;break;case l:g=w/n;break;case c:g=w/t;break;case a:g=w/e;break;default:g=w}return p?g:H.a(g)},f.daysInMonth=function(){return this.endOf(s).$D},f.$locale=function(){return b[this.$L]},f.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=M(e,t,!0);return r&&(n.$L=r),n},f.clone=function(){return H.w(this.$d,this)},f.toDate=function(){return new Date(this.valueOf())},f.toJSON=function(){return this.isValid()?this.toISOString():null},f.toISOString=function(){return this.$d.toISOString()},f.toString=function(){return this.$d.toUTCString()},d}(),O=P.prototype;return E.prototype=O,[["$ms",r],["$s",a],["$m",c],["$H",l],["$W",i],["$M",s],["$y",v],["$D",u]].forEach(function(e){O[e[1]]=function(t){return this.$g(t,e[0],e[1])}}),E.extend=function(e,t){return e.$i||(e(t,P,E),e.$i=!0),E},E.locale=M,E.isDayjs=y,E.unix=function(e){return E(1e3*e)},E.en=b[w],E.Ls=b,E.p={},E}();var Dt=kt(Rt.exports);const It=()=>{const[e,t]=v({from:{hour:Dt().format("hh"),minute:Dt().format("mm"),clockType:Dt().format("a")},to:{hour:Dt().format("hh"),minute:Dt().format("mm"),clockType:Dt().format("a")}});return{time:e,setTime:t}},Tt=r.div`
|
|
1085
|
+
`,zt=n=>{const{width:r="fit-content",minHeight:a="48px",message:c,type:l="info",showActionBtn:i,actionBtnLabel:o,showCloseBtn:s,onActionBtnClick:h,onClose:v}=n,u=(e=>xt[e])(l);return t(Mt,{type:l,width:r,minHeight:a,onMouseDown:e=>e.stopPropagation(),children:[e(Et,{children:u}),t(Ht,{children:[c," "]}),e(Pt,{role:"button",children:i&&e(ue,{label:o,variant:"outline",secondary:!0,onClick:h})}),s&&e(Ot,{onClick:v,children:yt})]})},Zt=({message:t,type:n,id:r,config:a})=>{const{removeToast:c}=m(ut);return e(mt,{children:e(zt,{minHeight:"60px",width:"100%",type:n,message:t,actionBtnLabel:a?.actionBtnLabel,showActionBtn:a?.showActionBtn,showCloseBtn:!0,onActionBtnClick:a?.onActionBtnClick,onClose:(e=>()=>c(e))(r)})})},jt=({children:n,position:r,timeout:a,offsetX:c,offsetY:l})=>{const[i,o]=v([]),[s,h]=v({position:r,timeout:a,offsetX:c,offsetY:l}),p=u([]),g=e=>{const t=p.current.find(t=>t.id===e);t&&(clearTimeout(t?.timeout),p.current=p.current.filter(t=>t.id!==e))},m=(e,t)=>{o(n=>{const r=n.findIndex(t=>t.id===e),a=[...n];return a[r]=t,a})},d=e=>{const t=i.filter(t=>t.id!==e);o(t),g(e)},f=()=>{i.length>=5&&(()=>{const[e,...t]=i;o(t),g(p.current[0].id)})()},_=e=>{let t=setTimeout(()=>{o(t=>t.filter(t=>t.id!==e.id)),g(e.id)},e.config?.timeout??s.timeout??5e3);p.current.push({id:e.id,timeout:t})},w=e=>"promise"===e?(t,n)=>{f();const r={message:n.pendingMessage,id:Ie(),type:e};return o(e=>[...e,r]),t.then(e=>{n.successMessage?m(r.id,{...r,message:n.successMessage,type:"success",config:{timeout:3e3}}):d(r.id),n.onSuccess?.(e)}).catch(e=>{n.errorMessage?m(r.id,{...r,message:n.errorMessage,type:"error",config:{timeout:3e3}}):d(r.id),n.onError?.(e)}).finally(()=>{_(r),n.onFinally?.()}),r.id}:(t,n)=>{f();const r={message:t,id:Ie(),type:e,config:n};return o(e=>[...e,r]),_(r),r.id},b={success:w("success"),error:w("error"),warning:w("warning"),info:w("info"),alert:w("alert"),promise:w("promise")};return t(ut.Provider,{value:{toast:b,removeToast:d,setConfig:h},children:[i.length>0&&H(e(gt,{position:s.position??"top-center",offsetX:s.offsetX??50,offsetY:s.offsetY??50,onClick:e=>e.stopPropagation(),children:i.map(t=>e(Zt,{...t},t.id))}),document.getElementById("toasts")),n]})},Vt=e=>{const{toast:t,setConfig:n,removeToast:r}=m(ut);return o(()=>{e&&n(e)},[e]),{...t,removeToast:r}},Ct=(e,t)=>{const{ignore:n,event:r="click"}=t||{},a=i.useRef();return i.useEffect(()=>{const t=t=>{if(n&&n.length)for(let e=0;e<n.length;e++)if(t.target.closest(n[e]))return;a.current&&!a.current.contains(t.target)&&e()};return document.addEventListener(r,t),()=>{document.removeEventListener(r,t)}},[a]),a};function At(e,t=400){const[n,r]=v(e);return o(()=>{const n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}const Lt=e=>{const[t,n]=v(e);return o(()=>{n(!!e)},[e]),{isActive:t,toggle:()=>{n(!t)},close:()=>{n(!1)},open:()=>{n(!0)},set:e=>{n(e)}}};var Bt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function kt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function St(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var Rt={exports:{}};Rt.exports=function(){var e=1e3,t=6e4,n=36e5,r="millisecond",a="second",c="minute",l="hour",i="day",o="week",s="month",h="quarter",v="year",u="date",p="Invalid Date",g=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,m=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,d={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},f=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},_={s:f,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),a=n%60;return(t<=0?"+":"-")+f(r,2,"0")+":"+f(a,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),a=t.clone().add(r,s),c=n-a<0,l=t.clone().add(r+(c?-1:1),s);return+(-(r+(n-a)/(c?a-l:l-a))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:s,y:v,w:o,d:i,D:u,h:l,m:c,s:a,ms:r,Q:h}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},w="en",b={};b[w]=d;var x="$isDayjsObject",y=function(e){return e instanceof P||!(!e||!e[x])},M=function e(t,n,r){var a;if(!t)return w;if("string"==typeof t){var c=t.toLowerCase();b[c]&&(a=c),n&&(b[c]=n,a=c);var l=t.split("-");if(!a&&l.length>1)return e(l[0])}else{var i=t.name;b[i]=t,a=i}return!r&&a&&(w=a),a||!r&&w},E=function(e,t){if(y(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new P(n)},H=_;H.l=M,H.i=y,H.w=function(e,t){return E(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var P=function(){function d(e){this.$L=M(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var f=d.prototype;return f.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(H.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(g);if(r){var a=r[2]-1||0,c=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],a,r[3]||1,r[4]||0,r[5]||0,r[6]||0,c)):new Date(r[1],a,r[3]||1,r[4]||0,r[5]||0,r[6]||0,c)}}return new Date(t)}(e),this.init()},f.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},f.$utils=function(){return H},f.isValid=function(){return!(this.$d.toString()===p)},f.isSame=function(e,t){var n=E(e);return this.startOf(t)<=n&&n<=this.endOf(t)},f.isAfter=function(e,t){return E(e)<this.startOf(t)},f.isBefore=function(e,t){return this.endOf(t)<E(e)},f.$g=function(e,t,n){return H.u(e)?this[t]:this.set(n,e)},f.unix=function(){return Math.floor(this.valueOf()/1e3)},f.valueOf=function(){return this.$d.getTime()},f.startOf=function(e,t){var n=this,r=!!H.u(t)||t,h=H.p(e),p=function(e,t){var a=H.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?a:a.endOf(i)},g=function(e,t){return H.w(n.toDate()[e].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},m=this.$W,d=this.$M,f=this.$D,_="set"+(this.$u?"UTC":"");switch(h){case v:return r?p(1,0):p(31,11);case s:return r?p(1,d):p(0,d+1);case o:var w=this.$locale().weekStart||0,b=(m<w?m+7:m)-w;return p(r?f-b:f+(6-b),d);case i:case u:return g(_+"Hours",0);case l:return g(_+"Minutes",1);case c:return g(_+"Seconds",2);case a:return g(_+"Milliseconds",3);default:return this.clone()}},f.endOf=function(e){return this.startOf(e,!1)},f.$set=function(e,t){var n,o=H.p(e),h="set"+(this.$u?"UTC":""),p=(n={},n[i]=h+"Date",n[u]=h+"Date",n[s]=h+"Month",n[v]=h+"FullYear",n[l]=h+"Hours",n[c]=h+"Minutes",n[a]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],g=o===i?this.$D+(t-this.$W):t;if(o===s||o===v){var m=this.clone().set(u,1);m.$d[p](g),m.init(),this.$d=m.set(u,Math.min(this.$D,m.daysInMonth())).$d}else p&&this.$d[p](g);return this.init(),this},f.set=function(e,t){return this.clone().$set(e,t)},f.get=function(e){return this[H.p(e)]()},f.add=function(r,h){var u,p=this;r=Number(r);var g=H.p(h),m=function(e){var t=E(p);return H.w(t.date(t.date()+Math.round(e*r)),p)};if(g===s)return this.set(s,this.$M+r);if(g===v)return this.set(v,this.$y+r);if(g===i)return m(1);if(g===o)return m(7);var d=(u={},u[c]=t,u[l]=n,u[a]=e,u)[g]||1,f=this.$d.getTime()+r*d;return H.w(f,this)},f.subtract=function(e,t){return this.add(-1*e,t)},f.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||"YYYY-MM-DDTHH:mm:ssZ",a=H.z(this),c=this.$H,l=this.$m,i=this.$M,o=n.weekdays,s=n.months,h=n.meridiem,v=function(e,n,a,c){return e&&(e[n]||e(t,r))||a[n].slice(0,c)},u=function(e){return H.s(c%12||12,e,"0")},g=h||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(m,function(e,r){return r||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return H.s(t.$y,4,"0");case"M":return i+1;case"MM":return H.s(i+1,2,"0");case"MMM":return v(n.monthsShort,i,s,3);case"MMMM":return v(s,i);case"D":return t.$D;case"DD":return H.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return v(n.weekdaysMin,t.$W,o,2);case"ddd":return v(n.weekdaysShort,t.$W,o,3);case"dddd":return o[t.$W];case"H":return String(c);case"HH":return H.s(c,2,"0");case"h":return u(1);case"hh":return u(2);case"a":return g(c,l,!0);case"A":return g(c,l,!1);case"m":return String(l);case"mm":return H.s(l,2,"0");case"s":return String(t.$s);case"ss":return H.s(t.$s,2,"0");case"SSS":return H.s(t.$ms,3,"0");case"Z":return a}return null}(e)||a.replace(":","")})},f.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},f.diff=function(r,u,p){var g,m=this,d=H.p(u),f=E(r),_=(f.utcOffset()-this.utcOffset())*t,w=this-f,b=function(){return H.m(m,f)};switch(d){case v:g=b()/12;break;case s:g=b();break;case h:g=b()/3;break;case o:g=(w-_)/6048e5;break;case i:g=(w-_)/864e5;break;case l:g=w/n;break;case c:g=w/t;break;case a:g=w/e;break;default:g=w}return p?g:H.a(g)},f.daysInMonth=function(){return this.endOf(s).$D},f.$locale=function(){return b[this.$L]},f.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=M(e,t,!0);return r&&(n.$L=r),n},f.clone=function(){return H.w(this.$d,this)},f.toDate=function(){return new Date(this.valueOf())},f.toJSON=function(){return this.isValid()?this.toISOString():null},f.toISOString=function(){return this.$d.toISOString()},f.toString=function(){return this.$d.toUTCString()},d}(),O=P.prototype;return E.prototype=O,[["$ms",r],["$s",a],["$m",c],["$H",l],["$W",i],["$M",s],["$y",v],["$D",u]].forEach(function(e){O[e[1]]=function(t){return this.$g(t,e[0],e[1])}}),E.extend=function(e,t){return e.$i||(e(t,P,E),e.$i=!0),E},E.locale=M,E.isDayjs=y,E.unix=function(e){return E(1e3*e)},E.en=b[w],E.Ls=b,E.p={},E}();var Dt=kt(Rt.exports);const It=()=>{const[e,t]=v({from:{hour:Dt().format("hh"),minute:Dt().format("mm"),clockType:Dt().format("a")},to:{hour:Dt().format("hh"),minute:Dt().format("mm"),clockType:Dt().format("a")}});return{time:e,setTime:t}},Tt=r.div`
|
|
1086
1086
|
display: flex;
|
|
1087
1087
|
flex-direction: column;
|
|
1088
1088
|
|
package/dist/index.js
CHANGED
|
@@ -1082,7 +1082,7 @@
|
|
|
1082
1082
|
display: grid;
|
|
1083
1083
|
place-items: center;
|
|
1084
1084
|
cursor: pointer;
|
|
1085
|
-
`,rt=t=>{const{width:n="fit-content",minHeight:r="48px",message:a,type:c="info",showActionBtn:l,actionBtnLabel:i,showCloseBtn:s,onActionBtnClick:o,onClose:h}=t,v=(e=>Xe[e])(c);return e.jsxs(Ge,{type:c,width:n,minHeight:r,onMouseDown:e=>e.stopPropagation(),children:[e.jsx(Je,{children:v}),e.jsxs(et,{children:[a," "]}),e.jsx(tt,{role:"button",children:l&&e.jsx(Y,{label:i,variant:"outline",secondary:!0,onClick:o})}),s&&e.jsx(nt,{onClick:h,children:Ke})]})},at=({message:t,type:r,id:a,config:c})=>{const{removeToast:l}=n.useContext(Te);return e.jsx($e,{children:e.jsx(rt,{minHeight:"60px",width:"100%",type:r,message:t,actionBtnLabel:c?.actionBtnLabel,showActionBtn:c?.showActionBtn,showCloseBtn:!0,onActionBtnClick:c?.onActionBtnClick,onClose:(e=>()=>l(e))(a)})})},ct=e=>{const{toast:t,setConfig:r,removeToast:a}=n.useContext(Te);return n.useEffect(()=>{e&&r(e)},[e]),{...t,removeToast:a}},lt=(e,t)=>{const{ignore:r,event:a="click"}=t||{},c=n.useRef();return n.useEffect(()=>{const t=t=>{if(r&&r.length)for(let e=0;e<r.length;e++)if(t.target.closest(r[e]))return;c.current&&!c.current.contains(t.target)&&e()};return document.addEventListener(a,t),()=>{document.removeEventListener(a,t)}},[c
|
|
1085
|
+
`,rt=t=>{const{width:n="fit-content",minHeight:r="48px",message:a,type:c="info",showActionBtn:l,actionBtnLabel:i,showCloseBtn:s,onActionBtnClick:o,onClose:h}=t,v=(e=>Xe[e])(c);return e.jsxs(Ge,{type:c,width:n,minHeight:r,onMouseDown:e=>e.stopPropagation(),children:[e.jsx(Je,{children:v}),e.jsxs(et,{children:[a," "]}),e.jsx(tt,{role:"button",children:l&&e.jsx(Y,{label:i,variant:"outline",secondary:!0,onClick:o})}),s&&e.jsx(nt,{onClick:h,children:Ke})]})},at=({message:t,type:r,id:a,config:c})=>{const{removeToast:l}=n.useContext(Te);return e.jsx($e,{children:e.jsx(rt,{minHeight:"60px",width:"100%",type:r,message:t,actionBtnLabel:c?.actionBtnLabel,showActionBtn:c?.showActionBtn,showCloseBtn:!0,onActionBtnClick:c?.onActionBtnClick,onClose:(e=>()=>l(e))(a)})})},ct=e=>{const{toast:t,setConfig:r,removeToast:a}=n.useContext(Te);return n.useEffect(()=>{e&&r(e)},[e]),{...t,removeToast:a}},lt=(e,t)=>{const{ignore:r,event:a="click"}=t||{},c=n.useRef();return n.useEffect(()=>{const t=t=>{if(r&&r.length)for(let e=0;e<r.length;e++)if(t.target.closest(r[e]))return;c.current&&!c.current.contains(t.target)&&e()};return document.addEventListener(a,t),()=>{document.removeEventListener(a,t)}},[c]),c};function it(e,t=400){const[r,a]=n.useState(e);return n.useEffect(()=>{const n=setTimeout(()=>a(e),t);return()=>clearTimeout(n)},[e,t]),r}const st=e=>{const[t,r]=n.useState(e);return n.useEffect(()=>{r(!!e)},[e]),{isActive:t,toggle:()=>{r(!t)},close:()=>{r(!1)},open:()=>{r(!0)},set:e=>{r(e)}}};var ot="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ht(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function vt(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var ut={exports:{}};ut.exports=function(){var e=1e3,t=6e4,n=36e5,r="millisecond",a="second",c="minute",l="hour",i="day",s="week",o="month",h="quarter",v="year",u="date",p="Invalid Date",g=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,m=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,d={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},f=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},_={s:f,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),a=n%60;return(t<=0?"+":"-")+f(r,2,"0")+":"+f(a,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),a=t.clone().add(r,o),c=n-a<0,l=t.clone().add(r+(c?-1:1),o);return+(-(r+(n-a)/(c?a-l:l-a))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:o,y:v,w:s,d:i,D:u,h:l,m:c,s:a,ms:r,Q:h}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},w="en",b={};b[w]=d;var x="$isDayjsObject",y=function(e){return e instanceof P||!(!e||!e[x])},M=function e(t,n,r){var a;if(!t)return w;if("string"==typeof t){var c=t.toLowerCase();b[c]&&(a=c),n&&(b[c]=n,a=c);var l=t.split("-");if(!a&&l.length>1)return e(l[0])}else{var i=t.name;b[i]=t,a=i}return!r&&a&&(w=a),a||!r&&w},E=function(e,t){if(y(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new P(n)},H=_;H.l=M,H.i=y,H.w=function(e,t){return E(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var P=function(){function d(e){this.$L=M(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var f=d.prototype;return f.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(H.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(g);if(r){var a=r[2]-1||0,c=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],a,r[3]||1,r[4]||0,r[5]||0,r[6]||0,c)):new Date(r[1],a,r[3]||1,r[4]||0,r[5]||0,r[6]||0,c)}}return new Date(t)}(e),this.init()},f.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},f.$utils=function(){return H},f.isValid=function(){return!(this.$d.toString()===p)},f.isSame=function(e,t){var n=E(e);return this.startOf(t)<=n&&n<=this.endOf(t)},f.isAfter=function(e,t){return E(e)<this.startOf(t)},f.isBefore=function(e,t){return this.endOf(t)<E(e)},f.$g=function(e,t,n){return H.u(e)?this[t]:this.set(n,e)},f.unix=function(){return Math.floor(this.valueOf()/1e3)},f.valueOf=function(){return this.$d.getTime()},f.startOf=function(e,t){var n=this,r=!!H.u(t)||t,h=H.p(e),p=function(e,t){var a=H.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?a:a.endOf(i)},g=function(e,t){return H.w(n.toDate()[e].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},m=this.$W,d=this.$M,f=this.$D,_="set"+(this.$u?"UTC":"");switch(h){case v:return r?p(1,0):p(31,11);case o:return r?p(1,d):p(0,d+1);case s:var w=this.$locale().weekStart||0,b=(m<w?m+7:m)-w;return p(r?f-b:f+(6-b),d);case i:case u:return g(_+"Hours",0);case l:return g(_+"Minutes",1);case c:return g(_+"Seconds",2);case a:return g(_+"Milliseconds",3);default:return this.clone()}},f.endOf=function(e){return this.startOf(e,!1)},f.$set=function(e,t){var n,s=H.p(e),h="set"+(this.$u?"UTC":""),p=(n={},n[i]=h+"Date",n[u]=h+"Date",n[o]=h+"Month",n[v]=h+"FullYear",n[l]=h+"Hours",n[c]=h+"Minutes",n[a]=h+"Seconds",n[r]=h+"Milliseconds",n)[s],g=s===i?this.$D+(t-this.$W):t;if(s===o||s===v){var m=this.clone().set(u,1);m.$d[p](g),m.init(),this.$d=m.set(u,Math.min(this.$D,m.daysInMonth())).$d}else p&&this.$d[p](g);return this.init(),this},f.set=function(e,t){return this.clone().$set(e,t)},f.get=function(e){return this[H.p(e)]()},f.add=function(r,h){var u,p=this;r=Number(r);var g=H.p(h),m=function(e){var t=E(p);return H.w(t.date(t.date()+Math.round(e*r)),p)};if(g===o)return this.set(o,this.$M+r);if(g===v)return this.set(v,this.$y+r);if(g===i)return m(1);if(g===s)return m(7);var d=(u={},u[c]=t,u[l]=n,u[a]=e,u)[g]||1,f=this.$d.getTime()+r*d;return H.w(f,this)},f.subtract=function(e,t){return this.add(-1*e,t)},f.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||"YYYY-MM-DDTHH:mm:ssZ",a=H.z(this),c=this.$H,l=this.$m,i=this.$M,s=n.weekdays,o=n.months,h=n.meridiem,v=function(e,n,a,c){return e&&(e[n]||e(t,r))||a[n].slice(0,c)},u=function(e){return H.s(c%12||12,e,"0")},g=h||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(m,function(e,r){return r||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return H.s(t.$y,4,"0");case"M":return i+1;case"MM":return H.s(i+1,2,"0");case"MMM":return v(n.monthsShort,i,o,3);case"MMMM":return v(o,i);case"D":return t.$D;case"DD":return H.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return v(n.weekdaysMin,t.$W,s,2);case"ddd":return v(n.weekdaysShort,t.$W,s,3);case"dddd":return s[t.$W];case"H":return String(c);case"HH":return H.s(c,2,"0");case"h":return u(1);case"hh":return u(2);case"a":return g(c,l,!0);case"A":return g(c,l,!1);case"m":return String(l);case"mm":return H.s(l,2,"0");case"s":return String(t.$s);case"ss":return H.s(t.$s,2,"0");case"SSS":return H.s(t.$ms,3,"0");case"Z":return a}return null}(e)||a.replace(":","")})},f.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},f.diff=function(r,u,p){var g,m=this,d=H.p(u),f=E(r),_=(f.utcOffset()-this.utcOffset())*t,w=this-f,b=function(){return H.m(m,f)};switch(d){case v:g=b()/12;break;case o:g=b();break;case h:g=b()/3;break;case s:g=(w-_)/6048e5;break;case i:g=(w-_)/864e5;break;case l:g=w/n;break;case c:g=w/t;break;case a:g=w/e;break;default:g=w}return p?g:H.a(g)},f.daysInMonth=function(){return this.endOf(o).$D},f.$locale=function(){return b[this.$L]},f.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=M(e,t,!0);return r&&(n.$L=r),n},f.clone=function(){return H.w(this.$d,this)},f.toDate=function(){return new Date(this.valueOf())},f.toJSON=function(){return this.isValid()?this.toISOString():null},f.toISOString=function(){return this.$d.toISOString()},f.toString=function(){return this.$d.toUTCString()},d}(),O=P.prototype;return E.prototype=O,[["$ms",r],["$s",a],["$m",c],["$H",l],["$W",i],["$M",o],["$y",v],["$D",u]].forEach(function(e){O[e[1]]=function(t){return this.$g(t,e[0],e[1])}}),E.extend=function(e,t){return e.$i||(e(t,P,E),e.$i=!0),E},E.locale=M,E.isDayjs=y,E.unix=function(e){return E(1e3*e)},E.en=b[w],E.Ls=b,E.p={},E}();var pt=ht(ut.exports);const gt=()=>{const[e,t]=n.useState({from:{hour:pt().format("hh"),minute:pt().format("mm"),clockType:pt().format("a")},to:{hour:pt().format("hh"),minute:pt().format("mm"),clockType:pt().format("a")}});return{time:e,setTime:t}},mt=t.div`
|
|
1086
1086
|
display: flex;
|
|
1087
1087
|
flex-direction: column;
|
|
1088
1088
|
|
package/dist/package.json
CHANGED