and-component-library
Version:
Distribution of AND Web Components
3 lines (2 loc) • 22.6 kB
JavaScript
function e(){}function t(e){return e()}function n(){return Object.create(null)}function o(e){e.forEach(t)}function i(e){return"function"==typeof e}function r(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function a(e,t){e.appendChild(t)}function l(e,t,n){e.insertBefore(t,n||null)}function s(e){e.parentNode.removeChild(e)}function c(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}function d(e){return document.createElement(e)}function h(e){return document.createTextNode(e)}function p(){return h(" ")}function u(e,t,n,o){return e.addEventListener(t,n,o),()=>e.removeEventListener(t,n,o)}function f(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function g(e,t,n){t in e?e[t]=n:f(e,t,n)}function m(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function b(e,t,n){e.classList[n?"add":"remove"](t)}let y;function x(e){y=e}function v(){if(!y)throw new Error("Function called outside component initialization");return y}function w(){const e=v();return(t,n)=>{const o=e.$$.callbacks[t];if(o){const i=function(e,t){const n=document.createEvent("CustomEvent");return n.initCustomEvent(e,!1,!1,t),n}(t,n);o.slice().forEach(t=>{t.call(e,i)})}}}const $=[],k=[],E=[],S=[],C=Promise.resolve();let A=!1;function D(e){E.push(e)}let F=!1;const M=new Set;function z(){if(!F){F=!0;do{for(let e=0;e<$.length;e+=1){const t=$[e];x(t),T(t.$$)}for(x(null),$.length=0;k.length;)k.pop()();for(let e=0;e<E.length;e+=1){const t=E[e];M.has(t)||(M.add(t),t())}E.length=0}while($.length);for(;S.length;)S.pop()();A=!1,F=!1,M.clear()}}function T(e){if(null!==e.fragment){e.update(),o(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(D)}}const Y=new Set;function _(e,t){e&&e.i&&(Y.delete(e),e.i(t))}const O="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:global;function V(e,t){e.d(1),t.delete(e.key)}function L(e,t){-1===e.$$.dirty[0]&&($.push(e),A||(A=!0,C.then(z)),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function j(r,a,l,c,d,h,p=[-1]){const u=y;x(r);const f=a.props||{},g=r.$$={fragment:null,ctx:null,props:h,update:e,not_equal:d,bound:n(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(u?u.$$.context:[]),callbacks:n(),dirty:p,skip_bound:!1};let m=!1;if(g.ctx=l?l(r,f,(e,t,...n)=>{const o=n.length?n[0]:t;return g.ctx&&d(g.ctx[e],g.ctx[e]=o)&&(!g.skip_bound&&g.bound[e]&&g.bound[e](o),m&&L(r,e)),t}):[],g.update(),m=!0,o(g.before_update),g.fragment=!!c&&c(g.ctx),a.target){if(a.hydrate){const e=function(e){return Array.from(e.childNodes)}(a.target);g.fragment&&g.fragment.l(e),e.forEach(s)}else g.fragment&&g.fragment.c();a.intro&&_(r.$$.fragment),function(e,n,r){const{fragment:a,on_mount:l,on_destroy:s,after_update:c}=e.$$;a&&a.m(n,r),D(()=>{const n=l.map(t).filter(i);s?s.push(...n):o(n),e.$$.on_mount=[]}),c.forEach(D)}(r,a.target,a.anchor),z()}x(u)}let P;"function"==typeof HTMLElement&&(P=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){for(const e in this.$$.slotted)this.appendChild(this.$$.slotted[e])}attributeChangedCallback(e,t,n){this[e]=n}$destroy(){!function(e,t){const n=e.$$;null!==n.fragment&&(o(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}(this,1),this.$destroy=e}$on(e,t){const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}});var R={dispatch(e,t,n){e.dispatchEvent&&e.dispatchEvent(new CustomEvent(t,{detail:n}))},dispatchCustomEvent(e,t,n,o){let i=o||{};t&&t.type&&t.target&&(i={type:t.type,target:t.target},n||(n=t.type)),this.dispatch(e,n,i)}};const W=[31,28,31,30,31,30,31,31,30,31,30,31],J=(e,t)=>1!==e?W[e]:(e=>e%4==0)(t)?29:28,H=(e,t)=>{const{days:n}=((e,t)=>{const n=new Date(t,e,1).getMonth();return{name:n[n],days:J(n,t)}})(e,t),o=Array.from({length:42}).map(()=>[]),i=new Date(t,e,1).getDay(),r=i>0?i-1:6;Array.from({length:n}).forEach((e,t)=>{o[r+t]=t+1});const a=o.map(e=>Array.isArray(e)?void 0:e);return a[35]?a:a.slice(0,-7)},N=()=>{},q=(()=>{let e=1;return()=>++e})();function B(e,t,n){const o=e.slice();return o[11]=t[n].allowed,o[12]=t[n].value,o}function G(e,t,n){const o=e.slice();return o[15]=t[n],o}function I(t){let n,o,i=t[15]+"";return{c(){n=d("div"),o=h(i),f(n,"class","cell cell-title")},m(e,t){l(e,n,t),a(n,o)},p:e,d(e){e&&s(n)}}}function K(e,t){let n,o,r,c,g,y=(t[12]||"")+"";return{key:e,first:null,c(){n=d("div"),o=h(y),r=p(),f(n,"class","cell"),b(n,"highlight",t[11]&&t[12]),b(n,"disabled",!t[11]),b(n,"selected",new Date(t[0].getFullYear(),t[0].getMonth(),t[0].getDate()).getTime()===new Date(t[2],t[1],t[12]).getTime()),this.first=n},m(e,s){l(e,n,s),a(n,o),a(n,r),c||(g=u(n,"click",(function(){i(t[11]&&t[12]?t[6].bind(this,t[12]):N)&&(t[11]&&t[12]?t[6].bind(this,t[12]):N).apply(this,arguments)})),c=!0)},p(e,i){t=e,16&i&&y!==(y=(t[12]||"")+"")&&m(o,y),16&i&&b(n,"highlight",t[11]&&t[12]),16&i&&b(n,"disabled",!t[11]),23&i&&b(n,"selected",new Date(t[0].getFullYear(),t[0].getMonth(),t[0].getDate()).getTime()===new Date(t[2],t[1],t[12]).getTime())},d(e){e&&s(n),c=!1,g()}}}function Q(t){let n,o,i,r,h=[],u=new Map,g=t[5],m=[];for(let e=0;e<g.length;e+=1)m[e]=I(G(t,g,e));let y=t[4];const x=e=>q();for(let e=0;e<y.length;e+=1){let n=B(t,y,e),o=x();u.set(o,h[e]=K(o,n))}return{c(){n=d("div"),o=d("div");for(let e=0;e<m.length;e+=1)m[e].c();i=p(),r=d("div");for(let e=0;e<h.length;e+=1)h[e].c();this.c=e,f(o,"class","row"),b(o,"hideVisibility",t[3]),f(r,"class","row"),b(r,"hideVisibility",t[3]),f(n,"class","container")},m(e,t){l(e,n,t),a(n,o);for(let e=0;e<m.length;e+=1)m[e].m(o,null);a(n,i),a(n,r);for(let e=0;e<h.length;e+=1)h[e].m(r,null)},p(e,[t]){if(32&t){let n;for(g=e[5],n=0;n<g.length;n+=1){const i=G(e,g,n);m[n]?m[n].p(i,t):(m[n]=I(i),m[n].c(),m[n].m(o,null))}for(;n<m.length;n+=1)m[n].d(1);m.length=g.length}if(8&t&&b(o,"hideVisibility",e[3]),87&t){const n=e[4];h=function(e,t,n,o,i,r,a,l,s,c,d,h){let p=e.length,u=r.length,f=p;const g={};for(;f--;)g[e[f].key]=f;const m=[],b=new Map,y=new Map;for(f=u;f--;){const e=h(i,r,f),l=n(e);let s=a.get(l);s?o&&s.p(e,t):(s=c(l,e),s.c()),b.set(l,m[f]=s),l in g&&y.set(l,Math.abs(f-g[l]))}const x=new Set,v=new Set;function w(e){_(e,1),e.m(l,d),a.set(e.key,e),d=e.first,u--}for(;p&&u;){const t=m[u-1],n=e[p-1],o=t.key,i=n.key;t===n?(d=t.first,p--,u--):b.has(i)?!a.has(o)||x.has(o)?w(t):v.has(i)?p--:y.get(o)>y.get(i)?(v.add(o),w(t)):(x.add(i),p--):(s(n,a),p--)}for(;p--;){const t=e[p];b.has(t.key)||s(t,a)}for(;u;)w(m[u-1]);return m}(h,t,x,1,e,n,u,r,V,K,null,B)}8&t&&b(r,"hideVisibility",e[3])},i:e,o:e,d(e){e&&s(n),c(m,e);for(let e=0;e<h.length;e+=1)h[e].d()}}}function U(e,t,n){const o=v(),i=w();let{date:r=new Date}=t,{month:a}=t,{year:l}=t,{isAllowed:s=(()=>!0)}=t,{hideWeeklyView:c=!1}=t;let d;const h=(e,t,n)=>!n||s(new Date(e,t,n));return e.$$set=e=>{"date"in e&&n(0,r=e.date),"month"in e&&n(1,a=e.month),"year"in e&&n(2,l=e.year),"isAllowed"in e&&n(7,s=e.isAllowed),"hideWeeklyView"in e&&n(3,c=e.hideWeeklyView)},e.$$.update=()=>{6&e.$$.dirty&&n(4,d=H(a,l).map(e=>({value:e,allowed:h(l,a,e)})))},[r,a,l,c,d,["Mo","Tu","We","Th","Fr","Sa","Su"],e=>{let t=new Date(l,a,e);i("datechange",new Date(l,a,e)),R.dispatchCustomEvent(o,new Event("datechange"),"datechange",t)},s]}class X extends P{constructor(e){super(),this.shadowRoot.innerHTML='<style>@import url(https://fonts.googleapis.com/css2?family=Poppins);:root{--step:50}.container{padding:2px;min-width:250px;min-height:190px;font-family:"Poppins", sans-serif;color:#323232;font-size:16px;font-size:torem(16px)}.row{display:flex;margin:0 6px;padding:0 8px;flex-wrap:wrap;justify-content:space-around}.hideVisibility{display:none}.cell{display:inline-block;width:20px;height:25px;text-align:center;padding:2px 4px;margin:1px}.cell-title{font-weight:800}.selected{background:#2897FF;border-radius:20px;color:white}.disabled{background:#efefef;cursor:not-allowed;color:#bfbfbf}.highlight:hover{border:1px solid #2897FF;border-radius:20px;cursor:pointer;padding:1px 3px}.selected.highlight:hover{background:#2897FF}</style>',j(this,{target:this.shadowRoot},U,Q,r,{date:0,month:1,year:2,isAllowed:7,hideWeeklyView:3}),e&&(e.target&&l(e.target,this,e.anchor),e.props&&(this.$set(e.props),z()))}static get observedAttributes(){return["date","month","year","isAllowed","hideWeeklyView"]}get date(){return this.$$.ctx[0]}set date(e){this.$set({date:e}),z()}get month(){return this.$$.ctx[1]}set month(e){this.$set({month:e}),z()}get year(){return this.$$.ctx[2]}set year(e){this.$set({year:e}),z()}get isAllowed(){return this.$$.ctx[7]}set isAllowed(e){this.$set({isAllowed:e}),z()}get hideWeeklyView(){return this.$$.ctx[3]}set hideWeeklyView(e){this.$set({hideWeeklyView:e}),z()}}function Z(e,t,n){const o=e.slice();return o[31]=t[n],o[33]=n,o}function ee(e,t,n){const o=e.slice();return o[34]=t[n],o[33]=n,o}function te(e){let t,n,o,i,r,c,g=e[10][e[0]][0]+"";return{c(){t=d("div"),n=h(g),o=p(),i=h(e[1]),f(t,"class","label"),f(t,"data-testid","monthAndYearTestLabel")},m(s,d){l(s,t,d),a(t,n),a(t,o),a(t,i),r||(c=u(t,"click",e[11]),r=!0)},p(e,t){1&t[0]&&g!==(g=e[10][e[0]][0]+"")&&m(n,g),2&t[0]&&m(i,e[1])},d(e){e&&s(t),r=!1,c()}}}function ne(e){let t,n,o,i;return{c(){t=d("div"),n=h(e[1]),f(t,"class","label"),f(t,"data-testid","yearTestLabel")},m(r,s){l(r,t,s),a(t,n),o||(i=u(t,"click",e[13]),o=!0)},p(e,t){2&t[0]&&m(n,e[1])},d(e){e&&s(t),o=!1,i()}}}function oe(e){let t,n,o,i;return{c(){t=d("div"),n=h(e[2]),o=h(" - "),i=h(e[3]),f(t,"class","label"),f(t,"data-testid","yearRangeTestLabel")},m(e,r){l(e,t,r),a(t,n),a(t,o),a(t,i)},p(e,t){4&t[0]&&m(n,e[2]),8&t[0]&&m(i,e[3])},d(e){e&&s(t)}}}function ie(e){let t,n,o,i,r,c,g=e[34].abbrev+"";function y(...t){return e[17](e[33],...t)}return{c(){t=d("div"),n=d("span"),o=h(g),i=p(),f(t,"class","selector--month selector--monthOrYear"),b(t,"selected",e[33]===e[0]&&e[9]===e[1])},m(e,s){l(e,t,s),a(t,n),a(n,o),a(t,i),r||(c=u(t,"click",y),r=!0)},p(n,i){e=n,128&i[0]&&g!==(g=e[34].abbrev+"")&&m(o,g),515&i[0]&&b(t,"selected",e[33]===e[0]&&e[9]===e[1])},d(e){e&&s(t),r=!1,c()}}}function re(e){let t,n,o,i,r,c,g=e[31].name+"";function y(...t){return e[18](e[31],...t)}return{c(){t=d("div"),n=d("span"),o=h(g),i=p(),f(t,"class","selector--year selector--monthOrYear"),b(t,"selected",e[31].name===e[1])},m(e,s){l(e,t,s),a(t,n),a(n,o),a(t,i),r||(c=u(t,"click",y),r=!0)},p(n,i){e=n,256&i[0]&&g!==(g=e[31].name+"")&&m(o,g),258&i[0]&&b(t,"selected",e[31].name===e[1])},d(e){e&&s(t),r=!1,c()}}}function ae(t){let n,i,r,h,g,m,y,x,v,w,$,k,E,S,C="monthAndYear"===t[6]&&te(t),A="year"===t[6]&&ne(t),D="yearRange"===t[6]&&oe(t),F=t[7],M=[];for(let e=0;e<F.length;e+=1)M[e]=ie(ee(t,F,e));let z=t[8],T=[];for(let e=0;e<z.length;e+=1)T[e]=re(Z(t,z,e));return{c(){n=d("div"),i=d("i"),r=p(),h=d("div"),C&&C.c(),g=p(),A&&A.c(),m=p(),D&&D.c(),y=p(),x=d("i"),v=p(),w=d("div");for(let e=0;e<M.length;e+=1)M[e].c();$=p(),k=d("div");for(let e=0;e<T.length;e+=1)T[e].c();this.c=e,f(i,"class","prev"),f(i,"data-testid","prevTest"),f(h,"class","heading-section"),f(x,"class","next"),f(x,"data-testid","nextTest"),f(n,"class","nav-container"),f(w,"class","selector"),b(w,"open",t[4]),f(k,"class","selector"),b(k,"open",t[5])},m(e,o){l(e,n,o),a(n,i),a(n,r),a(n,h),C&&C.m(h,null),a(h,g),A&&A.m(h,null),a(h,m),D&&D.m(h,null),a(n,y),a(n,x),l(e,v,o),l(e,w,o);for(let e=0;e<M.length;e+=1)M[e].m(w,null);l(e,$,o),l(e,k,o);for(let e=0;e<T.length;e+=1)T[e].m(k,null);E||(S=[u(i,"click",t[16]),u(x,"click",t[15])],E=!0)},p(e,t){if("monthAndYear"===e[6]?C?C.p(e,t):(C=te(e),C.c(),C.m(h,g)):C&&(C.d(1),C=null),"year"===e[6]?A?A.p(e,t):(A=ne(e),A.c(),A.m(h,m)):A&&(A.d(1),A=null),"yearRange"===e[6]?D?D.p(e,t):(D=oe(e),D.c(),D.m(h,null)):D&&(D.d(1),D=null),4739&t[0]){let n;for(F=e[7],n=0;n<F.length;n+=1){const o=ee(e,F,n);M[n]?M[n].p(o,t):(M[n]=ie(o),M[n].c(),M[n].m(w,null))}for(;n<M.length;n+=1)M[n].d(1);M.length=F.length}if(16&t[0]&&b(w,"open",e[4]),16642&t[0]){let n;for(z=e[8],n=0;n<z.length;n+=1){const o=Z(e,z,n);T[n]?T[n].p(o,t):(T[n]=re(o),T[n].c(),T[n].m(k,null))}for(;n<T.length;n+=1)T[n].d(1);T.length=z.length}32&t[0]&&b(k,"open",e[5])},i:e,o:e,d(e){e&&s(n),C&&C.d(),A&&A.d(),D&&D.d(),e&&s(v),e&&s(w),c(M,e),e&&s($),e&&s(k),c(T,e),E=!1,o(S)}}}function le(e,t,n){const o=v(),i=w();let r,a,l,s,c,{month:d=(new Date).getMonth()}=t,{year:h=(new Date).getFullYear()}=t,p=h,u="date",f=[["January","Jan"],["February","Feb"],["March","Mar"],["April","Apr"],["May","May"],["June","Jun"],["July","Jul"],["August","Aug"],["September","Sep"],["October","Oct"],["November","Nov"],["December","Dec"]],g=x(r),m=!1,b=!1,y="monthAndYear";function x(e){let t=[],o=n(2,a=e-4);n(3,l=e+4);let i=1;for(;i<=9;)t.push([o++,i]),i++;return i=0,t}function $(){"monthAndYear"===y?(n(6,y="year"),u="month",i("viewChange","month"),R.dispatchCustomEvent(o,new Event("viewChange"),"viewChange","month")):(n(6,y="monthAndYear"),u="date",i("viewChange","date"),R.dispatchCustomEvent(o,new Event("viewChange"),"viewChange","date")),n(4,m=!m)}function k(e,{i:t}){e.stopPropagation(),n(0,d=t),i("monthSelected",t),R.dispatchCustomEvent(o,new Event("monthSelected"),"monthSelected",t),$()}function E(){"year"===y?(n(6,y="yearRange"),u="year",i("viewChange","year"),R.dispatchCustomEvent(o,new Event("viewChange"),"viewChange","year")):(n(6,y="year"),u="month",i("viewChange","month"),R.dispatchCustomEvent(o,new Event("viewChange"),"viewChange","month")),n(5,b=!b)}function S(e,{y:t}){n(1,h=t),e.stopPropagation(),i("yearSelected",t.name),R.dispatchCustomEvent(o,new Event("yearSelected"),"yearSelected",t.name),E()}const C=()=>{if(11===d)return n(0,d=0),n(1,h+=1),i("monthSelected",d),i("yearSelected",h),R.dispatchCustomEvent(o,new Event("monthSelected"),"monthSelected",d),void R.dispatchCustomEvent(o,new Event("yearSelected"),"yearSelected",h);n(0,d+=1),i("monthSelected",d),R.dispatchCustomEvent(o,new Event("monthSelected"),"monthSelected",d)},A=()=>{if(0===d)return n(0,d=11),n(1,h-=1),i("monthSelected",d),i("yearSelected",h),R.dispatchCustomEvent(o,new Event("monthSelected"),"monthSelected",d),void R.dispatchCustomEvent(o,new Event("yearSelected"),"yearSelected",h);n(0,d-=1),i("monthSelected",d),R.dispatchCustomEvent(o,new Event("monthSelected"),"monthSelected",d)},D=()=>{n(1,h++,h),i("yearSelected",h),R.dispatchCustomEvent(o,new Event("yearSelected"),"yearSelected",h)},F=()=>{n(1,h--,h),i("yearSelected",h),R.dispatchCustomEvent(o,new Event("yearSelected"),"yearSelected",h)},M=()=>{n(19,r+=9)},z=()=>{n(19,r-=9)};return e.$$set=e=>{"month"in e&&n(0,d=e.month),"year"in e&&n(1,h=e.year)},e.$$.update=()=>{2&e.$$.dirty[0]&&n(19,r=h||(new Date).getFullYear()),524288&e.$$.dirty[0]&&n(21,g=x(r)),128&e.$$.dirty[0]&&n(7,s=s||f.map(e=>Object.assign({},{name:e[0],abbrev:e[1]}))),2097408&e.$$.dirty[0]&&n(8,c=g?g.map(e=>Object.assign({},{name:e[0],abbrev:e[1]})):c)},[d,h,a,l,m,b,y,s,c,p,f,$,k,E,S,()=>{switch(u){case"date":C();break;case"month":D();break;case"year":M();break;default:C()}},()=>{switch(u){case"date":A();break;case"month":F();break;case"year":z();break;default:A()}},(e,t)=>k(t,{i:e}),(e,t)=>S(t,{y:e})]}class se extends P{constructor(e){super(),this.shadowRoot.innerHTML='<style>@import url(https://fonts.googleapis.com/css2?family=Poppins);:root{--step:50}.nav-container{display:flex;justify-content:space-between;align-items:center;margin:6px 0;width:100%}.next{box-sizing:border-box;position:relative;display:block;transform:scale(var(--ggs, 1));width:22px;height:22px;cursor:pointer}.next::before{content:"";display:block;box-sizing:border-box;position:absolute;width:0;height:10px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:6px solid;top:6px;left:9px}.next::before{position:absolute;border-top:10px solid transparent;border-bottom:10px solid transparent;border-left:15px solid;top:0;left:0}.prev{box-sizing:border-box;position:relative;display:block;transform:scale(var(--ggs, 1));width:3px;height:22px;cursor:pointer;right:0}.prev::after{content:"";display:block;box-sizing:border-box;position:absolute;width:0;height:10px;border-top:10px solid transparent;border-bottom:10px solid transparent;border-right:16px solid;right:-20px}.heading-section{padding:5px 0;color:#323232;font-family:"Poppins", sans-serif;font-size:16px;font-size:torem(16px)}.label{cursor:pointer;padding:1px 0 0 15px}.selector{position:absolute;top:55px;left:0;right:0;bottom:0;background-color:#fff;font-family:"Poppins", sans-serif;font-size:16px;font-size:torem(16px);visibility:hidden;z-index:1;text-align:center}.selector.open{visibility:visible;opacity:1}.selector--month{font-weight:600;width:18%;margin:4% 2%;height:20%;display:inline-block;color:#4a4a4a;opacity:1}.selector--month:hover{margin:3% 1.5%}.selector--year{width:21%;margin:3% 4%;height:22%;display:inline-block;color:#4a4a4a;opacity:1}.selector--year:hover{margin:2% 3.5%}.selector--monthOrYear:hover{cursor:pointer;border-radius:10px;border:1px solid #2897FF}.selector--monthOrYear.selected{background:#2897FF;border-radius:10px;color:#fff}.selector--monthOrYear:before{content:\' \';display:inline-block;height:100%;vertical-align:middle}.selector--monthOrYear span{vertical-align:middle;display:inline-block}</style>',j(this,{target:this.shadowRoot},le,ae,r,{month:0,year:1},[-1,-1]),e&&(e.target&&l(e.target,this,e.anchor),e.props&&(this.$set(e.props),z()))}static get observedAttributes(){return["month","year"]}get month(){return this.$$.ctx[0]}set month(e){this.$set({month:e}),z()}get year(){return this.$$.ctx[1]}set year(e){this.$set({year:e}),z()}}const{customElements:ce}=O;function de(e){let t,n,i,r,c,h,m,b,y;return{c(){t=d("div"),n=d("div"),i=d("div"),r=d("and-calendar-navigation"),c=p(),h=d("and-calendar"),g(r,"class","nav-bar"),g(r,"month",e[4]),g(r,"year",e[5]),f(i,"class","month-name"),g(h,"month",e[4]),g(h,"year",e[5]),g(h,"date",m=e[8]?e[8]:new Date),g(h,"isallowed",e[1]),g(h,"hideweeklyview",e[7]),f(n,"class","box"),f(t,"class","container")},m(o,s){l(o,t,s),a(t,n),a(n,i),a(i,r),a(n,c),a(n,h),b||(y=[u(r,"viewChange",e[17]),u(r,"monthSelected",e[18]),u(r,"yearSelected",e[19]),u(h,"datechange",e[14])],b=!0)},p(e,t){16&t&&g(r,"month",e[4]),32&t&&g(r,"year",e[5]),16&t&&g(h,"month",e[4]),32&t&&g(h,"year",e[5]),256&t&&m!==(m=e[8]?e[8]:new Date)&&g(h,"date",m),2&t&&g(h,"isallowed",e[1]),128&t&&g(h,"hideweeklyview",e[7])},d(e){e&&s(t),b=!1,o(y)}}}function he(t){let n,i,r,c,g,b,y,x,v,w,$,k,E,S=t[6]&&de(t);return{c(){n=d("div"),i=d("div"),r=d("div"),c=d("label"),g=h(t[2]),b=d("br"),y=p(),x=d("input"),v=p(),w=d("i"),$=p(),S&&S.c(),this.c=e,f(c,"class","label"),f(c,"for",t[3]),f(x,"id",t[3]),f(x,"class","input"),f(x,"type","text"),f(x,"placeholder",t[0]),x.value=t[9],x.readOnly=!0,f(i,"class","relative")},m(e,o){l(e,n,o),a(n,i),a(i,r),a(r,c),a(c,g),a(r,b),a(r,y),a(r,x),a(r,v),a(r,w),a(i,$),S&&S.m(i,null),k||(E=[u(x,"focus",t[10]),u(w,"click",t[10])],k=!0)},p(e,[t]){4&t&&m(g,e[2]),8&t&&f(c,"for",e[3]),8&t&&f(x,"id",e[3]),1&t&&f(x,"placeholder",e[0]),512&t&&x.value!==e[9]&&(x.value=e[9]),e[6]?S?S.p(e,t):(S=de(e),S.c(),S.m(i,null)):S&&(S.d(1),S=null)},i:e,o:e,d(e){e&&s(n),S&&S.d(),k=!1,o(E)}}}function pe(e,t,n){const o=v(),i=w();customElements.define("and-calendar-navigation",se),customElements.define("and-calendar",X);let r,a,l,{placeholder:s="dd/mm/yyyy"}=t,{isallowed:c=(()=>!0)}=t,{selected:d=""}=t,{opencalendar:h=!1}=t,{label:p=""}=t,{id:u="and-date-picker"}=t,f=new Date,g=!1,m=!1;function b(e){n(20,g="date"!==e)}function y(e){n(4,a=e&&0===Object.keys(e).length&&e.constructor===Object?0:e)}function x(e){n(5,l=e)}let $,k,E;return e.$$set=e=>{"placeholder"in e&&n(0,s=e.placeholder),"isallowed"in e&&n(1,c=e.isallowed),"selected"in e&&n(15,d=e.selected),"opencalendar"in e&&n(16,h=e.opencalendar),"label"in e&&n(2,p=e.label),"id"in e&&n(3,u=e.id)},e.$$.update=()=>{1048576&e.$$.dirty&&n(7,$=g?"true":""),32768&e.$$.dirty&&n(8,k=d?"object"==typeof d?d:new Date(Date.parse(d)):""),256&e.$$.dirty&&n(9,E=k?k.toLocaleDateString():""),65536&e.$$.dirty&&n(6,m=h),256&e.$$.dirty&&(r=k?k.getDate():f.getDate(),n(4,a=k?k.getMonth():f.getMonth()),n(5,l=k?k.getFullYear():f.getFullYear()))},[s,c,p,u,a,l,m,$,k,E,()=>{n(6,m=!0)},b,y,x,e=>{n(6,m=!1),n(8,k=e.detail),i("datechange",k),R.dispatchCustomEvent(o,new Event("datechange"),"datechange",k)},d,h,e=>b(e.detail),e=>y(e.detail),e=>x(e.detail)]}class ue extends P{constructor(e){super(),this.shadowRoot.innerHTML='<style>@import url(https://fonts.googleapis.com/css2?family=Poppins);:root{--step:50}.relative{position:relative;display:inline-flex}.container{min-height:350px}.box{position:absolute;top:75px;left:0px;border-radius:0.3125rem;border:1px solid #323232;display:inline-block;overflow:hidden}.label{font-family:"Poppins", sans-serif;font-size:12px;font-size:torem(12px);color:#323232}.month-name{display:flex;justify-content:space-between;align-items:center;margin:6px 0}.nav-bar{min-width:100%}.input{font-family:"Poppins", sans-serif;border:0.8px solid #323232;border-radius:0.3125rem;min-width:9.6875rem;min-height:2.5rem;padding-left:1rem;box-sizing:border-box;color:#323232;font-size:16px;font-size:torem(16px)}.input:focus{outline:none !important;border:0.8px solid #2897FF}.input+i{position:absolute;float:right;top:10px;right:10px;z-index:2;color:#323232;display:block;box-sizing:border-box;transform:scale(var(--ggs, 1));width:20px;height:20px;border:2px solid;border-top:4px solid;border-radius:3px;cursor:pointer;top:37px}.input+i::before{content:"";position:absolute;display:block;box-sizing:border-box;width:10px;border-radius:3px;left:2px;background:currentColor;height:2px;top:2px}</style>',j(this,{target:this.shadowRoot},pe,he,r,{placeholder:0,isallowed:1,selected:15,opencalendar:16,label:2,id:3}),e&&(e.target&&l(e.target,this,e.anchor),e.props&&(this.$set(e.props),z()))}static get observedAttributes(){return["placeholder","isallowed","selected","opencalendar","label","id"]}get placeholder(){return this.$$.ctx[0]}set placeholder(e){this.$set({placeholder:e}),z()}get isallowed(){return this.$$.ctx[1]}set isallowed(e){this.$set({isallowed:e}),z()}get selected(){return this.$$.ctx[15]}set selected(e){this.$set({selected:e}),z()}get opencalendar(){return this.$$.ctx[16]}set opencalendar(e){this.$set({opencalendar:e}),z()}get label(){return this.$$.ctx[2]}set label(e){this.$set({label:e}),z()}get id(){return this.$$.ctx[3]}set id(e){this.$set({id:e}),z()}}ce.define("and-date-picker",ue);export default ue;
//# sourceMappingURL=DatePicker.js.map