@oslokommune/punkt-elements 16.0.5 → 16.2.0
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/CHANGELOG.md +17 -0
- package/dist/{accordionitem-CHXGzgLv.js → accordionitem-Cj74XruR.js} +31 -31
- package/dist/accordionitem-D7sWqDM_.cjs +34 -0
- package/dist/alert-C95U_RZ0.cjs +33 -0
- package/dist/{alert-BHSd2Vpj.js → alert-ca_hFi-u.js} +19 -20
- package/dist/async-directive-B158h3ba.cjs +5 -0
- package/dist/async-directive-CKx6pubI.js +65 -0
- package/dist/{button-CHUuxLQV.js → button-BRovt5nm.js} +10 -11
- package/dist/button-BXN_JPaH.cjs +27 -0
- package/dist/{card-Db9QSEqh.cjs → card-DfHo45CG.cjs} +11 -13
- package/dist/{card-CmfUyl_s.js → card-DvgCTN4B.js} +47 -51
- package/dist/{checkbox-D6nltMuc.js → checkbox-CbIUMIYt.js} +2 -2
- package/dist/{checkbox-Cpyay9_l.cjs → checkbox-mmn3v9ry.cjs} +1 -1
- package/dist/{combobox-TKTemUxN.js → combobox-CwW0md6G.js} +31 -31
- package/dist/combobox-TKL44xnV.cjs +135 -0
- package/dist/{consent-BQLkfN3d.cjs → consent-CIhFwuFO.cjs} +1 -1
- package/dist/{consent-knPF4PS_.js → consent-CgS1L1xF.js} +1 -1
- package/dist/{datepicker-CPNcXd-o.cjs → datepicker-oN9L0Wnm.cjs} +14 -14
- package/dist/{datepicker-MuQYeXhL.js → datepicker-qRWWzmbo.js} +51 -51
- package/dist/element-with-slot-1djk8KXi.js +240 -0
- package/dist/element-with-slot-yT8k1Z37.cjs +1 -0
- package/dist/helptext-B366oeR9.cjs +24 -0
- package/dist/{helptext-TFpeGJ1P.js → helptext-DepcDYFV.js} +32 -39
- package/dist/index.d.ts +39 -90
- package/dist/input-element-Xe9FTi2a.cjs +1 -0
- package/dist/{input-element-BGNbdzy2.js → input-element-n5U38pZ1.js} +8 -7
- package/dist/{input-wrapper-CaUY90qz.js → input-wrapper-B__6jW4U.js} +25 -28
- package/dist/{input-wrapper-JU4D2TGu.cjs → input-wrapper-BdFdJU-k.cjs} +7 -9
- package/dist/link-DLjXMpvi.cjs +7 -0
- package/dist/link-oGYvBLYL.js +53 -0
- package/dist/linkcard-BhVIc18n.js +54 -0
- package/dist/linkcard-C20WC6Nw.cjs +13 -0
- package/dist/{loader-BF9K1VCZ.js → loader-BHt9i5Xp.js} +12 -13
- package/dist/{loader-C1LI8Q4z.cjs → loader-DxAGCcNF.cjs} +2 -2
- package/dist/messagebox-B8LW0PSQ.cjs +13 -0
- package/dist/messagebox-DkspcMQg.js +69 -0
- package/dist/modal-Bfk_ncLQ.cjs +36 -0
- package/dist/{modal-CGHWsjk8.js → modal-p1rvuP8e.js} +26 -27
- package/dist/pkt-accordion.cjs +1 -1
- package/dist/pkt-accordion.js +2 -2
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +1 -1
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +1 -1
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +1 -1
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +1 -1
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +1 -1
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +1 -1
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +2 -2
- package/dist/pkt-header.cjs +16 -17
- package/dist/pkt-header.js +62 -69
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +22 -22
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +1 -1
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +1 -1
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +1 -1
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +1 -1
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +1 -1
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +1 -1
- package/dist/pkt-options-controller-DIeKSpWv.cjs +1 -0
- package/dist/{pkt-options-controller-Z-bPox7n.js → pkt-options-controller-W4ITGQy9.js} +1 -1
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +2 -2
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +1 -1
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- package/dist/pkt-tabs.cjs +1 -1
- package/dist/pkt-tabs.js +2 -2
- package/dist/pkt-tag.cjs +1 -1
- package/dist/pkt-tag.js +1 -1
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +1 -1
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +1 -1
- package/dist/{progressbar-Bxh335uT.cjs → progressbar-CC9Qr82_.cjs} +1 -1
- package/dist/{progressbar-GSA4Md1u.js → progressbar-CcX-xiPI.js} +1 -1
- package/dist/{radiobutton-CNHCpKn0.cjs → radiobutton-BUDQYAH-.cjs} +1 -1
- package/dist/{radiobutton-DgC27mb0.js → radiobutton-RW3h0tJj.js} +2 -2
- package/dist/ref-DBGHvw2G.js +42 -0
- package/dist/ref-DahIePMT.cjs +5 -0
- package/dist/select-PuEeK4jQ.cjs +49 -0
- package/dist/{select-7VuYtPZv.js → select-iXKeM3yz.js} +37 -37
- package/dist/{tabitem-DQRzgAT4.js → tabitem-DZSzwag2.js} +30 -30
- package/dist/{tabitem-BKv4eN0a.cjs → tabitem-Jenus4Qd.cjs} +13 -13
- package/dist/{tag-DZPqFiem.js → tag-CIWBLpjv.js} +17 -18
- package/dist/tag-DeE1OpmF.cjs +27 -0
- package/dist/{textarea-VpCEjVFx.js → textarea-DR9lVDN-.js} +13 -13
- package/dist/{textarea-CO7Ikug5.cjs → textarea-DtiYQWjy.cjs} +7 -7
- package/dist/{textinput-C2AZ9ss2.js → textinput-0Bttvt9V.js} +22 -22
- package/dist/{textinput-DRFZU3dA.cjs → textinput-cKrjvbJW.cjs} +9 -9
- package/package.json +3 -3
- package/src/components/accordion/accordionitem.ts +4 -6
- package/src/components/alert/alert.ts +4 -8
- package/src/components/button/button.ts +4 -12
- package/src/components/card/card.ts +4 -19
- package/src/components/combobox/combobox-base.ts +0 -5
- package/src/components/combobox/combobox-utils.ts +1 -1
- package/src/components/combobox/combobox.ts +2 -1
- package/src/components/datepicker/datepicker.ts +2 -8
- package/src/components/header/header-service.ts +5 -19
- package/src/components/header/header.ts +4 -13
- package/src/components/helptext/helptext.test.ts +2 -12
- package/src/components/helptext/helptext.ts +5 -19
- package/src/components/input-wrapper/input-wrapper.test.ts +3 -3
- package/src/components/input-wrapper/input-wrapper.ts +5 -16
- package/src/components/link/link.ts +4 -12
- package/src/components/linkcard/linkcard.test.ts +2 -2
- package/src/components/linkcard/linkcard.ts +4 -13
- package/src/components/loader/loader.ts +4 -12
- package/src/components/messagebox/messagebox.ts +4 -9
- package/src/components/modal/modal.ts +4 -7
- package/src/components/select/select.ts +2 -5
- package/src/components/tabs/tabitem.ts +4 -7
- package/src/components/tabs/tabs.ts +4 -13
- package/src/components/tag/tag.ts +6 -12
- package/src/components/textarea/textarea.ts +2 -8
- package/src/components/textinput/textinput.ts +2 -8
- package/dist/accordionitem-To95GT6b.cjs +0 -34
- package/dist/alert-BDXWFRcf.cjs +0 -33
- package/dist/button-VWxZW89G.cjs +0 -27
- package/dist/combobox-DX2BLzIm.cjs +0 -135
- package/dist/helptext-BjW1WdOn.cjs +0 -24
- package/dist/input-element-CSDVA3Y6.cjs +0 -1
- package/dist/link-Bscfb6s9.js +0 -54
- package/dist/link-CDuv1jxx.cjs +0 -7
- package/dist/linkcard-3WUL0CpY.cjs +0 -13
- package/dist/linkcard-wNgRxJ-S.js +0 -55
- package/dist/messagebox-Dmot5szX.cjs +0 -13
- package/dist/messagebox-LBEzcr6B.js +0 -70
- package/dist/modal-S9MOKOaz.cjs +0 -37
- package/dist/pkt-options-controller-BogGk-6J.cjs +0 -1
- package/dist/pkt-slot-controller-D4nKlom5.cjs +0 -1
- package/dist/pkt-slot-controller-D7CrjM52.js +0 -95
- package/dist/ref-CxLwrCxt.cjs +0 -9
- package/dist/ref-Dma3n3i8.js +0 -102
- package/dist/select-PWPy5gTB.cjs +0 -49
- package/dist/tag-DmbgBCKu.cjs +0 -27
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const o=require("./element-CMTfByxQ.cjs");require("./button-
|
|
1
|
+
"use strict";const o=require("./element-CMTfByxQ.cjs");require("./button-BXN_JPaH.cjs");require("./icon-Dj0oZZSa.cjs");const k={i18n:{nb:{contentPresentation:{title:"Oslo kommune bruker informasjonskapsler",description:["For at nettstedet skal fungere og være trygt, bruker Oslo kommune informasjonskapsler. Noen er teknisk nødvendige, mens andre sikrer ulik funksjonalitet.","Godtar du alle informasjonskapsler, tillater du også at vi samler inn data om statistikk og brukeradferd. Da hjelper du oss med å lage et bedre nettsted uten at du trenger å dele noe personlig informasjon med oss."],buttons:{accept:"Godta alle",reject:"Kun nødvendige",settings:"Innstillinger for informasjonskapsler"}},contentSettings:{title:"Innstillinger for informasjonskapsler",description:["Her kan du velge hvilke typer informasjonskapsler du vil tillate. Tillatelsen gjelder i 90 dager. Husk at nødvendige informasjonskapsler ikke kan velges bort.","Du kan når som helst endre innstillingene og finne mer informasjon nederst på nettstedet under «Innstillinger for informasjonskapsler» og «Personvern og informasjonskapsler»."],buttons:{back:"Tilbake",save:"Lagre innstillinger"}}},en:{contentPresentation:{title:"Before you visit Oslo kommune ...",description:["This website uses cookies to make improvements. In this context, we need your consent to measure the traffic on the website in relation to statistics and feedback.","To read more about what we use cookies for, go to our privacy declaration which you will find at the bottom of our websites."],buttons:{accept:"Yes, I accept",reject:"Only necessary",settings:"Go to settings"}},contentSettings:{title:"Her kan du aktivt velge mellom ulike informasjonskapsler",description:["For å lese mer om hva vi bruker informasjonskapsler til gå til vår personvernserklering som du finner på våre nettsider"],buttons:{back:"Back",save:"Save settings"}}}}};var d=Object.defineProperty,p=Object.getOwnPropertyDescriptor,s=(r,e,t,n)=>{for(var i=n>1?void 0:n?p(e,t):e,a=r.length-1,l;a>=0;a--)(l=r[a])&&(i=(n?l(e,t,i):l(i))||i);return n&&i&&d(e,t,i),i};let c=null;function u(){return c||(c=new Promise((r,e)=>{if(document.querySelector("#oslo-consent-script")){r();return}const t=document.createElement("script");t.src="https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.js",t.id="oslo-consent-script",t.onload=()=>r(),t.onerror=e,document.head.appendChild(t);const n=document.createElement("link");n.href="https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.css",n.type="text/css",n.rel="stylesheet",n.id="oslo-consent-styles",document.head.appendChild(n)}),c)}exports.PktConsent=class extends o.PktElement{constructor(){super(),this.devMode=!1,this.hotjarId=null,this.googleAnalyticsId=null,this.cookieDomain=null,this.cookieSecure=null,this.cookieExpiryDays=null,this.triggerType="button",this.triggerText=null,this.i18nLanguage="nb"}connectedCallback(){super.connectedCallback(),this.triggerText=this.triggerText||k.i18n[this.i18nLanguage].contentPresentation.buttons.settings}disconnectedCallback(){var e;super.disconnectedCallback(),this._cookieEventHandler&&((e=window.__cookieEvents)==null||e.off("CookieManager.setCookie",this._cookieEventHandler))}returnJsonOrObject(e){let t;try{t=JSON.parse(e)}catch{t=e}return t}emitCookieConsents(e){const n=this.returnJsonOrObject(e.value).items.reduce((i,a)=>(i[a.name]=a.consent,i),{});this.dispatchEvent(new CustomEvent("toggle-consent",{detail:n,bubbles:!0,cancelable:!1}))}async firstUpdated(e){window.cookieBanner_googleAnalyticsId=this.googleAnalyticsId,window.cookieBanner_hotjarId=this.hotjarId,this.cookieDomain&&(window.cookieBanner_cookieDomain=this.cookieDomain),this.cookieSecure&&(window.cookieBanner_cookieSecure=this.cookieSecure),this.cookieExpiryDays&&(window.cookieBanner_cookieExpiryDays=this.cookieExpiryDays),this.devMode&&(window.cookieBanner_devMode=this.devMode),await u(),this.triggerInit()}triggerInit(){window.document.dispatchEvent(new Event("CookieBannerReady",{bubbles:!0,cancelable:!0})),window.cookieBanner.cookieConsent.validateConsentCookie().then(e=>{if(e){const n={value:window.cookieBanner.cookieConsent.getConsentCookie()};window.setTimeout(()=>this.emitCookieConsents(n),0),this._cookieEventHandler&&window.__cookieEvents.off("CookieManager.setCookie",this._cookieEventHandler),this._cookieEventHandler=i=>{this.emitCookieConsents(i)},window.__cookieEvents.on("CookieManager.setCookie",this._cookieEventHandler)}})}openModal(e){var t;e.preventDefault(),(t=window.cookieBanner)!=null&&t.cookieConsent||this.triggerInit(),setTimeout(()=>window.cookieBanner.openCookieModal())}render(){return this.triggerType==="link"?o.b`<a href="#" class="pkt-link" @click=${this.openModal}>${this.triggerText}</a>`:this.triggerType==="footerlink"?o.b`<a href="#" class="pkt-footer__link" @click=${this.openModal}>
|
|
2
2
|
<pkt-icon name="chevron-right" class="pkt-footer__link-icon"></pkt-icon>
|
|
3
3
|
${this.triggerText}
|
|
4
4
|
</a>`:this.triggerType==="icon"?o.b`<pkt-button
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const l=require("./element-CMTfByxQ.cjs"),I=require("./state-BNgpvY-A.cjs"),u=require("./calendar-43Y_6FD8.cjs"),A=require("./input-element-
|
|
1
|
+
"use strict";const l=require("./element-CMTfByxQ.cjs"),I=require("./state-BNgpvY-A.cjs"),u=require("./calendar-43Y_6FD8.cjs"),A=require("./input-element-Xe9FTi2a.cjs"),o=require("./ref-DahIePMT.cjs");require("./icon-Dj0oZZSa.cjs");require("./input-wrapper-BdFdJU-k.cjs");const m=require("./class-map-Bokp1SoS.cjs"),M=require("./repeat-C-FJ2vfy.cjs");require("./tag-DeE1OpmF.cjs");const O=require("./utils-byXsEz1u.cjs"),g=require("./if-defined-hKKmbsI8.cjs"),F=require("./element-with-slot-yT8k1Z37.cjs"),B={calendar:{buttonAltText:"Åpne kalender"}},j={calendar:{buttonAltText:"Åpne kalender"},generic:{from:"Fra",to:"Til"}};var q=Object.defineProperty,L=Object.getOwnPropertyDescriptor,k=(s,e,t,a)=>{for(var i=a>1?void 0:a?L(e,t):e,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(a?n(e,t,i):n(i))||i);return a&&i&&q(e,t,i),i};exports.PktDateTags=class extends l.PktElement{constructor(){super(...arguments),this.dates=[],this.dateformat="dd.MM.yyyy",this.className="pkt-datepicker__tags",this.idBase=O.uuidish()}render(){return this.classes={"pkt-date-tags":!0,[this.className]:!0},l.b`
|
|
2
2
|
<div class=${m.e(this.classes)} aria-live="polite">
|
|
3
3
|
${Array.isArray(this.dates)&&this.dates[0]?M.c(u.sortDateStrings((this.dates??[]).filter(Boolean)),e=>e,e=>{var t;return l.b` <pkt-tag
|
|
4
4
|
id=${this.idBase+e+"-tag"}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<time datetime=${e}>${u.fromISOtoLocal(e,this.dateformat)}</time>
|
|
10
10
|
</pkt-tag>`}):l.A}
|
|
11
11
|
</div>
|
|
12
|
-
`}};
|
|
12
|
+
`}};k([l.n({type:Array})],exports.PktDateTags.prototype,"dates",2);k([l.n({type:String})],exports.PktDateTags.prototype,"dateformat",2);k([l.n({type:String,attribute:"class"})],exports.PktDateTags.prototype,"className",2);k([l.n({type:String,attribute:"id-base"})],exports.PktDateTags.prototype,"idBase",2);exports.PktDateTags=k([l.t("pkt-date-tags")],exports.PktDateTags);const V={dateformat:{default:"dd.MM.yyyy"},weeknumbers:{default:!1},withcontrols:{default:!1},multiple:{default:!1},range:{default:!1}},$={props:V},y=()=>{const s=navigator.userAgent;return!!(/iP(hone|od|ad)/.test(s)||/Macintosh/.test(s)&&"ontouchend"in document)},K=()=>y()?"text":"date",U=s=>!s||s.length!==2?!0:u.isValidDateRange(s[0],s[1]),N=s=>u.sortDateStrings(s),z=(s,e,t,a,i)=>u.filterSelectableDates(s,e,t,a,i),W=(s,e,t,a,i,r)=>({"pkt-input":!0,"pkt-datepicker__input":!0,"pkt-input--fullwidth":s,"pkt-datepicker--hasrangelabels":e,"pkt-datepicker--multiple":t,"pkt-datepicker--range":a,"ios-readonly-hack":i===!1&&r==="text"}),H=()=>({"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0,"pkt-datepicker__calendar-button":!0}),G=s=>({"pkt-input-prefix":s,"pkt-hide":!s}),J=(s,e,t)=>!e&&!t?Array.isArray(s)?s[0]||"":s:Array.isArray(s)?s.join(","):s,Q=(s,e,t=!1)=>{var p;if(!s||!e)return;const a=((p=e.parentElement)==null?void 0:p.getBoundingClientRect())||e.getBoundingClientRect(),i=t?a.height+30:a.height,r=s.getBoundingClientRect().height;let n=t?"calc(100% - 30px)":"100%";a&&a.top+r>window.innerHeight&&a.top-r>0&&(n=`calc(100% - ${i}px - ${r}px)`),s.style.top=n},X=(s,e,t,a,i,r)=>{const{key:n}=s;n===","&&(s.preventDefault(),r?r(s):i&&i()),(n==="Space"||n===" ")&&(s.preventDefault(),e(s)),n==="Enter"&&(s.preventDefault(),t?t():a?a():i&&i())},Y=(s,e)=>{const{key:t}=s;(t==="Enter"||t===" "||t==="Space")&&(s.preventDefault(),e(s))},E={validateRangeOrder:U,sortDates:N,filterSelectableDates:z},Z={getInputType:K},b={submitForm(s){var t;const e=(t=s.internals)==null?void 0:t.form;e&&e.requestSubmit()},submitFormOrFallback(s,e){const t=s==null?void 0:s.form;t?t.requestSubmit():e()},validateDateInput(s,e,t,a,i){var n,p,R,S;const r=s.value;r&&(t&&t>r?e.setValidity({rangeUnderflow:!0},((p=(n=i==null?void 0:i.forms)==null?void 0:n.messages)==null?void 0:p.rangeUnderflow)||"Value is below minimum",s):a&&a<r&&e.setValidity({rangeOverflow:!0},((S=(R=i==null?void 0:i.forms)==null?void 0:R.messages)==null?void 0:S.rangeOverflow)||"Value is above maximum",s))}},w={addToSelected(s,e,t,a){const i=s.target;if(!i.value)return;const r=t?u.newDate(t):null,n=a?u.newDate(a):null,p=u.newDate(i.value.split(",")[0]);p&&!isNaN(p.getTime())&&(!r||p>=r)&&(!n||p<=n)&&e.value&&e.value.handleDateSelect(p),i.value=""},handleCalendarPosition(s,e,t=!1){Q(s.value??null,e.value??null,t)}},x={getInputClasses:W,getButtonClasses:H,getRangeLabelClasses:G},T={processDateSelection:J,updateInputValues(s,e,t,a,i,r){s.value&&(a&&(e!=null&&e.value)?(s.value.value=t[0]??"",e.value.value=t[1]??"",r(s.value),r(e.value)):i||(s.value.value=t.length?t[0]:"",r(s.value)))},processRangeBlur(s,e,t,a,i){var n;const r=s.target;if(r.value){i(r);const p=u.fromISOToDate(r.value);p&&((n=t==null?void 0:t.value)==null||n.handleDateSelect(p))}else e[0]&&a()}},C={handleInputKeydown:X,handleButtonKeydown:Y};var ee=Object.defineProperty,te=Object.getOwnPropertyDescriptor,c=(s,e,t,a)=>{for(var i=a>1?void 0:a?te(e,t):e,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(a?n(e,t,i):n(i))||i);return a&&i&&ee(e,t,i),i};let d=class extends l.PktElement{constructor(){super(...arguments),this.open=!1,this.multiple=!1,this.range=!1,this.weeknumbers=!1,this.withcontrols=!1,this.maxMultiple=null,this.selected=[],this.earliest=null,this.latest=null,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.today=null,this._hasBeenOpened=!1,this.popupRef=o.e(),this.calendarRef=o.e(),this.handleDocumentClick=s=>{if(!this.open)return;const e=s.composedPath(),t=this.parentElement,a=this.popupRef.value;!e.includes(this)&&!e.includes(a)&&!(t&&e.includes(t))&&(this.hide(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))},this.handleDocumentKeydown=s=>{this.open&&s.key==="Escape"&&(this.hide(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))}}firstUpdated(){this.calRef=this.calendarRef}updated(s){super.updated(s),s.has("open")&&(this.open?(this._hasBeenOpened=!0,document.addEventListener("keydown",this.handleDocumentKeydown),document.addEventListener("click",this.handleDocumentClick)):(document.removeEventListener("click",this.handleDocumentClick),document.removeEventListener("keydown",this.handleDocumentKeydown)))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.handleDocumentClick),document.removeEventListener("keydown",this.handleDocumentKeydown)}show(){var s;this.open=!0,(s=this.calendarRef.value)==null||s.focus()}hide(){this.open=!1}toggle(){this.open?this.hide():this.show()}contains(s){var e;return!!s&&!!((e=this.popupRef.value)!=null&&e.contains(s))}focusOnCurrentDate(){const s=this.calendarRef.value;s&&typeof s.focusOnCurrentDate=="function"&&s.focusOnCurrentDate()}addToSelected(s,e,t){if(this.calendarRef.value&&typeof w.addToSelected=="function")return w.addToSelected(s,this.calendarRef,e,t);const i=s.target;if(!i.value)return;const r=e?u.newDate(e):null,n=t?u.newDate(t):null,p=u.newDate(i.value.split(",")[0]);p&&!isNaN(p.getTime())&&(!r||p>=r)&&(!n||p<=n)&&this.handleDateSelect(p),i.value=""}handleDateSelect(s){const e=this.calendarRef.value;if(e&&typeof e.handleDateSelect=="function")return e.handleDateSelect(s);const t=u.formatISODate(s),i=this.selected.indexOf(t)>=0?this.selected.filter(r=>r!==t):[...this.selected,t];this.selected=i,this.dispatchEvent(new CustomEvent("date-selected",{detail:i,bubbles:!0,composed:!0}))}render(){const s={"pkt-calendar-popup":!0,show:this.open,hide:!this.open};return l.b`
|
|
13
13
|
<div
|
|
14
14
|
class="${m.e(s)}"
|
|
15
15
|
${o.n(this.popupRef)}
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
</div>
|
|
38
38
|
`}};c([l.n({type:Boolean,reflect:!0})],d.prototype,"open",2);c([l.n({type:Boolean})],d.prototype,"multiple",2);c([l.n({type:Boolean})],d.prototype,"range",2);c([l.n({type:Boolean})],d.prototype,"weeknumbers",2);c([l.n({type:Boolean})],d.prototype,"withcontrols",2);c([l.n({type:Number})],d.prototype,"maxMultiple",2);c([l.n({type:Array})],d.prototype,"selected",2);c([l.n({type:String})],d.prototype,"earliest",2);c([l.n({type:String})],d.prototype,"latest",2);c([l.n({type:Array})],d.prototype,"excludedates",2);c([l.n({type:Array})],d.prototype,"excludeweekdays",2);c([l.n({type:String})],d.prototype,"currentmonth",2);c([l.n({type:String})],d.prototype,"today",2);c([I.r()],d.prototype,"_hasBeenOpened",2);d=c([l.t("pkt-datepicker-popup")],d);var se=Object.defineProperty,v=(s,e,t,a)=>{for(var i=void 0,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=n(e,t,i)||i);return i&&se(e,t,i),i};class f extends l.PktElement{constructor(){super(...arguments),this.inputType="date",this.id="",this.readonly=!1,this.disabled=!1,this.inputClasses={},this.inputRef=o.e(),this.btnRef=o.e()}get inputElement(){return this.inputRef.value}get buttonElement(){return this.btnRef.value}get isInputReadonly(){return this.readonly||this.inputType==="text"}dispatchToggleCalendar(e){this.readonly||this.dispatchEvent(new CustomEvent("toggle-calendar",{detail:e,bubbles:!0,composed:!0}))}dispatchInput(e){this.dispatchEvent(new CustomEvent("input-change",{detail:e,bubbles:!0,composed:!0}))}dispatchFocus(){this.dispatchEvent(new CustomEvent("input-focus",{bubbles:!0,composed:!0}))}dispatchBlur(e){this.dispatchEvent(new CustomEvent("input-blur",{detail:e,bubbles:!0,composed:!0}))}dispatchChange(e){this.dispatchEvent(new CustomEvent("input-changed",{detail:e,bubbles:!0,composed:!0}))}renderCalendarButton(){var e;return l.b`
|
|
39
39
|
<button
|
|
40
|
-
class="${m.e(
|
|
40
|
+
class="${m.e(x.getButtonClasses())}"
|
|
41
41
|
type="button"
|
|
42
42
|
@click=${t=>this.dispatchToggleCalendar(t)}
|
|
43
43
|
@keydown=${t=>{const{key:a}=t;(a==="Enter"||a===" "||a==="Space")&&(t.preventDefault(),this.dispatchToggleCalendar(t))}}
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
@click=${e=>{e.preventDefault(),this.dispatchToggleCalendar(e)}}
|
|
63
63
|
@touchend=${e=>{e.preventDefault(),this.dispatchToggleCalendar(e)}}
|
|
64
64
|
?disabled=${this.disabled}
|
|
65
|
-
@keydown=${e=>C.handleInputKeydown(e,t=>this.dispatchToggleCalendar(t),()=>
|
|
65
|
+
@keydown=${e=>C.handleInputKeydown(e,t=>this.dispatchToggleCalendar(t),()=>b.submitFormOrFallback(this.internals,()=>{var t;return(t=this.inputRef.value)==null?void 0:t.blur()}),void 0,()=>{var t;return(t=this.inputRef.value)==null?void 0:t.blur()})}
|
|
66
66
|
@input=${e=>{this.dispatchInput(e),e.stopImmediatePropagation()}}
|
|
67
67
|
@focus=${()=>{this.dispatchFocus(),y()&&this.dispatchToggleCalendar(new Event("focus"))}}
|
|
68
68
|
@blur=${e=>{this.dispatchBlur(e),this.dispatchManageValidity(e.target),this.dispatchEvent(new CustomEvent("value-change",{detail:e.target.value,bubbles:!0,composed:!0}))}}
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
/>
|
|
72
72
|
${this.renderCalendarButton()}
|
|
73
73
|
</div>
|
|
74
|
-
`}};_([l.n({type:String})],exports.PktDatepickerSingle.prototype,"value",2);_([l.n({type:Object})],exports.PktDatepickerSingle.prototype,"strings",2);exports.PktDatepickerSingle=_([l.t("pkt-datepicker-single")],exports.PktDatepickerSingle);var ne=Object.defineProperty,le=Object.getOwnPropertyDescriptor,D=(s,e,t,a)=>{for(var i=a>1?void 0:a?le(e,t):e,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(a?n(e,t,i):n(i))||i);return a&&i&&ne(e,t,i),i};exports.PktDatepickerRange=class extends f{constructor(){super(...arguments),this.value=[],this.label="",this.showRangeLabels=!1,this.strings=j,this.inputRefTo=o.e()}get inputElementTo(){return this.inputRefTo.value}render(){var t,a,i,r;const e=
|
|
74
|
+
`}};_([l.n({type:String})],exports.PktDatepickerSingle.prototype,"value",2);_([l.n({type:Object})],exports.PktDatepickerSingle.prototype,"strings",2);exports.PktDatepickerSingle=_([l.t("pkt-datepicker-single")],exports.PktDatepickerSingle);var ne=Object.defineProperty,le=Object.getOwnPropertyDescriptor,D=(s,e,t,a)=>{for(var i=a>1?void 0:a?le(e,t):e,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(a?n(e,t,i):n(i))||i);return a&&i&&ne(e,t,i),i};exports.PktDatepickerRange=class extends f{constructor(){super(...arguments),this.value=[],this.label="",this.showRangeLabels=!1,this.strings=j,this.inputRefTo=o.e()}get inputElementTo(){return this.inputRefTo.value}render(){var t,a,i,r;const e=x.getRangeLabelClasses(this.showRangeLabels);return l.b`
|
|
75
75
|
<div class="pkt-input__container">
|
|
76
76
|
${this.showRangeLabels?l.b` <div class="pkt-input-prefix">${(t=this.strings.generic)==null?void 0:t.from}</div> `:l.A}
|
|
77
77
|
<input
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
?disabled=${this.disabled}
|
|
88
88
|
@click=${n=>{n.preventDefault(),this.dispatchToggleCalendar(n)}}
|
|
89
89
|
@touchend=${n=>{n.preventDefault(),this.dispatchToggleCalendar(n)}}
|
|
90
|
-
@keydown=${n=>C.handleInputKeydown(n,p=>this.dispatchToggleCalendar(p),()=>
|
|
90
|
+
@keydown=${n=>C.handleInputKeydown(n,p=>this.dispatchToggleCalendar(p),()=>b.submitFormOrFallback(this.internals,()=>{var p;return(p=this.inputRefTo.value)==null?void 0:p.focus()}),()=>{var p;return(p=this.inputRefTo.value)==null?void 0:p.focus()},()=>{var p;return(p=this.inputRef.value)==null?void 0:p.blur()})}
|
|
91
91
|
@input=${n=>{this.dispatchInput(n),n.stopImmediatePropagation()}}
|
|
92
92
|
@focus=${()=>{this.dispatchFocus(),y()&&this.dispatchToggleCalendar(new Event("focus"))}}
|
|
93
93
|
@blur=${n=>{this.dispatchBlur(n),this.dispatchEvent(new CustomEvent("range-blur",{detail:{event:n,values:this.value,inputType:"from"},bubbles:!0,composed:!0}))}}
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
?disabled=${this.disabled}
|
|
112
112
|
@click=${n=>{n.preventDefault(),this.dispatchToggleCalendar(n)}}
|
|
113
113
|
@touchend=${n=>{n.preventDefault(),this.dispatchToggleCalendar(n)}}
|
|
114
|
-
@keydown=${n=>C.handleInputKeydown(n,p=>this.dispatchToggleCalendar(p),()=>
|
|
114
|
+
@keydown=${n=>C.handleInputKeydown(n,p=>this.dispatchToggleCalendar(p),()=>b.submitFormOrFallback(this.internals,()=>{var p;return(p=this.inputRefTo.value)==null?void 0:p.blur()}),void 0,()=>{var p;return(p=this.inputRefTo.value)==null?void 0:p.blur()})}
|
|
115
115
|
@input=${n=>{this.dispatchInput(n),n.stopImmediatePropagation()}}
|
|
116
116
|
@focus=${()=>{this.dispatchFocus(),y()&&this.dispatchToggleCalendar(new Event("focus"))}}
|
|
117
117
|
@blur=${n=>{this.dispatchBlur(n),this.dispatchEvent(new CustomEvent("range-blur",{detail:{event:n,values:this.value,inputType:"to"},bubbles:!0,composed:!0}))}}
|
|
@@ -136,13 +136,13 @@
|
|
|
136
136
|
@blur=${e=>{this.dispatchBlur(e),this.dispatchAddToSelected(e)}}
|
|
137
137
|
@input=${e=>{this.dispatchInput(e),e.stopImmediatePropagation()}}
|
|
138
138
|
@focus=${()=>{this.dispatchFocus(),y()&&this.dispatchToggleCalendar(new Event("focus"))}}
|
|
139
|
-
@keydown=${e=>C.handleInputKeydown(e,t=>this.dispatchToggleCalendar(t),()=>
|
|
139
|
+
@keydown=${e=>C.handleInputKeydown(e,t=>this.dispatchToggleCalendar(t),()=>b.submitFormOrFallback(this.internals,()=>{var t;return(t=this.inputRef.value)==null?void 0:t.blur()}),void 0,void 0,t=>this.dispatchAddToSelected(t))}
|
|
140
140
|
@change=${e=>{this.dispatchChange(e),e.stopImmediatePropagation()}}
|
|
141
141
|
${o.n(this.inputRef)}
|
|
142
142
|
/>
|
|
143
143
|
${this.renderCalendarButton()}
|
|
144
144
|
</div>
|
|
145
|
-
`}};P([l.n({type:Array})],exports.PktDatepickerMultiple.prototype,"value",2);P([l.n({type:Number})],exports.PktDatepickerMultiple.prototype,"maxlength",2);P([l.n({type:Object})],exports.PktDatepickerMultiple.prototype,"strings",2);exports.PktDatepickerMultiple=P([l.t("pkt-datepicker-multiple")],exports.PktDatepickerMultiple);var ue=Object.defineProperty,oe=Object.getOwnPropertyDescriptor,h=(s,e,t,a)=>{for(var i=a>1?void 0:a?oe(e,t):e,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(a?n(e,t,i):n(i))||i);return a&&i&&ue(e,t,i),i};exports.PktDatepicker=class extends A.PktInputElement{constructor(){super(),this._valueProperty="",this._valueProcessing=!1,this.datepickerPopupRef=o.e(),this._value=[],this.label="Datovelger",this.dateformat=$.props.dateformat.default,this.multiple=$.props.multiple.default,this.maxlength=null,this.range=$.props.range.default,this.showRangeLabels=!1,this.min=null,this.max=null,this.weeknumbers=$.props.weeknumbers.default,this.withcontrols=$.props.withcontrols.default,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.today=null,this.calendarOpen=!1,this.timezone="Europe/Oslo",this.inputClasses={},this.calRef=o.e(),this.popupRef=o.e(),this.
|
|
145
|
+
`}};P([l.n({type:Array})],exports.PktDatepickerMultiple.prototype,"value",2);P([l.n({type:Number})],exports.PktDatepickerMultiple.prototype,"maxlength",2);P([l.n({type:Object})],exports.PktDatepickerMultiple.prototype,"strings",2);exports.PktDatepickerMultiple=P([l.t("pkt-datepicker-multiple")],exports.PktDatepickerMultiple);var ue=Object.defineProperty,oe=Object.getOwnPropertyDescriptor,h=(s,e,t,a)=>{for(var i=a>1?void 0:a?oe(e,t):e,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(a?n(e,t,i):n(i))||i);return a&&i&&ue(e,t,i),i};exports.PktDatepicker=class extends A.PktInputElement{constructor(){super(...arguments),this._valueProperty="",this._valueProcessing=!1,this.datepickerPopupRef=o.e(),this._value=[],this.label="Datovelger",this.dateformat=$.props.dateformat.default,this.multiple=$.props.multiple.default,this.maxlength=null,this.range=$.props.range.default,this.showRangeLabels=!1,this.min=null,this.max=null,this.weeknumbers=$.props.weeknumbers.default,this.withcontrols=$.props.withcontrols.default,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.today=null,this.calendarOpen=!1,this.timezone="Europe/Oslo",this.inputClasses={},this.calRef=o.e(),this.popupRef=o.e(),this.singleInputRef=o.e(),this.rangeInputRef=o.e(),this.multipleInputRef=o.e(),this.addToSelected=e=>{const t=this.datepickerPopupRef.value;return t&&typeof t.addToSelected=="function"?t.addToSelected(e,this.min,this.max):w.addToSelected(e,this.calRef,this.min,this.max)}}get value(){return this._valueProperty}set value(e){const t=this._valueProperty;this._valueProperty=Array.isArray(e)?e.join(","):e||"",this.valueChanged(this._valueProperty,t),this.requestUpdate("value",t)}get inputType(){return Z.getInputType()}connectedCallback(){super.connectedCallback(),this.timezone&&this.timezone!==window.pktTz&&(window.pktTz=this.timezone)}disconnectedCallback(){super.disconnectedCallback()}onInput(){this.dispatchEvent(new Event("input",{bubbles:!0}))}valueChanged(e,t){if(!(this._valueProcessing||e===t)){this._valueProcessing=!0;try{const a=u.valueToArray(e),i=this.multiple&&a.length>1?E.filterSelectableDates(a,this.min,this.max,this.excludedates,this.excludeweekdays):a;if(this.range&&!E.validateRangeOrder(i)){this._value=[],this._valueProperty="",super.valueChanged("",t);return}this._value=i;const r=u.arrayToCsv(i);if(this._valueProperty!==r&&(this._valueProperty=r),this.range&&i.length<2)return;super.valueChanged(r,t)}finally{this._valueProcessing=!1}}}attributeChangedCallback(e,t,a){e==="value"&&this.value!==t&&this.valueChanged(a,t),e==="excludedates"&&typeof this.excludedates=="string"&&(this.excludedates=u.valueToArray(a||"")),e==="excludeweekdays"&&typeof this.excludeweekdays=="string"&&(this.excludeweekdays=u.valueToArray(a||"")),super.attributeChangedCallback(e,t,a)}updated(e){if(e.has("value")&&(e.has("multiple")||e.has("range"))){const t=Array.isArray(this.value)?this.value.join(","):this.value,a=e.get("value"),i=Array.isArray(a)?a.join(","):a;this.valueChanged(t,i)}e.has("multiple")&&(this.multiple&&!Array.isArray(this._value)?this._value=u.valueToArray(this.value):!this.multiple&&Array.isArray(this._value)&&(this._value=this._value.filter(Boolean)),!this.multiple&&!this.range&&Array.isArray(this._value)&&(this._value=[this._value[0]??""])),super.updated(e)}get inputRef(){return{value:this.currentInputElement}}get inputRefTo(){return{value:this.currentInputElementTo}}get currentInputElement(){var e,t,a;return this.multiple?(e=this.multipleInputRef.value)==null?void 0:e.inputElement:this.range?(t=this.rangeInputRef.value)==null?void 0:t.inputElement:(a=this.singleInputRef.value)==null?void 0:a.inputElement}get currentInputElementTo(){var e;if(this.range)return(e=this.rangeInputRef.value)==null?void 0:e.inputElementTo}get currentButtonElement(){var e,t,a;return this.multiple?(e=this.multipleInputRef.value)==null?void 0:e.buttonElement:this.range?(t=this.rangeInputRef.value)==null?void 0:t.buttonElement:(a=this.singleInputRef.value)==null?void 0:a.buttonElement}get btnRef(){return{value:this.currentButtonElement}}renderInput(){return l.b`
|
|
146
146
|
<pkt-datepicker-single
|
|
147
147
|
.value=${this._value[0]??""}
|
|
148
148
|
.inputType=${this.inputType}
|
|
@@ -183,9 +183,9 @@
|
|
|
183
183
|
@input-change=${()=>this.onInput()}
|
|
184
184
|
@input-focus=${()=>this.onFocus()}
|
|
185
185
|
@input-blur=${e=>{var t;(t=this.calRef.value)!=null&&t.contains(e.detail.relatedTarget)||this.onBlur()}}
|
|
186
|
-
@range-blur=${e=>{const t=this.currentInputElement,a=this.currentInputElementTo;if(t&&a){const i=t.value,r=a.value;if(i&&r&&i>r)a.value="",this._value=[i],this.value=i;else{const n=[i,r].filter(Boolean);n.length>0&&(n[0]!==this._value[0]||n[1]!==this._value[1])&&(this._value=n,this.value=n.join(","))}}
|
|
186
|
+
@range-blur=${e=>{const t=this.currentInputElement,a=this.currentInputElementTo;if(t&&a){const i=t.value,r=a.value;if(i&&r&&i>r)a.value="",this._value=[i],this.value=i;else{const n=[i,r].filter(Boolean);n.length>0&&(n[0]!==this._value[0]||n[1]!==this._value[1])&&(this._value=n,this.value=n.join(","))}}T.processRangeBlur(e.detail.event,e.detail.values,this.calRef,()=>this.clearInputValue(),i=>this.manageValidity(i))}}
|
|
187
187
|
@manage-validity=${e=>this.manageValidity(e.detail)}
|
|
188
|
-
@validate-date-input=${e=>{
|
|
188
|
+
@validate-date-input=${e=>{b.validateDateInput(e.detail,this.internals,this.min,this.max,this.strings)}}
|
|
189
189
|
@handle-date-select=${e=>{var a,i;const t=u.fromISOToDate(e.detail);if(t){const r=u.formatISODate(t);this._value[0]!==r&&this._value[1]!==r&&((i=(a=this.calRef)==null?void 0:a.value)==null||i.handleDateSelect(t))}}}
|
|
190
190
|
@input-changed=${()=>{this.touched=!0}}
|
|
191
191
|
${o.n(this.rangeInputRef)}
|
|
@@ -228,11 +228,11 @@
|
|
|
228
228
|
.excludeweekdays=${this.excludeweekdays}
|
|
229
229
|
.currentmonth=${this.currentmonth?u.parseISODateString(this.currentmonth):null}
|
|
230
230
|
.today=${this.today}
|
|
231
|
-
@date-selected=${e=>{this.value=
|
|
231
|
+
@date-selected=${e=>{this.value=T.processDateSelection(e.detail,this.multiple,this.range),this._value=e.detail,T.updateInputValues(this.inputRef,this.inputRefTo,this._value,this.range,this.multiple,t=>this.manageValidity(t))}}
|
|
232
232
|
@close=${()=>{this.onBlur(),this.hideCalendar()}}
|
|
233
233
|
${o.n(this.datepickerPopupRef)}
|
|
234
234
|
></pkt-datepicker-popup>
|
|
235
|
-
`}render(){return this.inputClasses=
|
|
235
|
+
`}render(){return this.inputClasses=x.getInputClasses(this.fullwidth,this.showRangeLabels,this.multiple,this.range,this.readonly,this.inputType),l.b`
|
|
236
236
|
<pkt-input-wrapper
|
|
237
237
|
label="${this.label}"
|
|
238
238
|
forId="${this.id}-input"
|
|
@@ -257,7 +257,7 @@
|
|
|
257
257
|
.ariaDescribedBy=${this.ariaDescribedBy}
|
|
258
258
|
class="pkt-datepicker"
|
|
259
259
|
>
|
|
260
|
-
<div class="pkt-contents"
|
|
260
|
+
<div class="pkt-contents" slot="helptext">${F.slotContent(this,"helptext")}</div>
|
|
261
261
|
${this.multiple?l.b`<pkt-date-tags
|
|
262
262
|
.dates=${this._value}
|
|
263
263
|
dateformat=${this.dateformat}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { P as L, A as D, b as h, n as r, t as x } from "./element-CV9utnHJ.js";
|
|
2
2
|
import { r as z } from "./state-l4hGZdFJ.js";
|
|
3
|
-
import { s as H, f as N, a as Q, i as X, n as k, b as j, c as W, v as
|
|
4
|
-
import { P as ee } from "./input-element-
|
|
5
|
-
import { e as
|
|
3
|
+
import { s as H, f as N, a as Q, i as X, n as k, b as j, c as W, v as I, d as Y, p as Z, e as G } from "./calendar-B5Xwl8mV.js";
|
|
4
|
+
import { P as ee } from "./input-element-n5U38pZ1.js";
|
|
5
|
+
import { e as m, n as v } from "./ref-DBGHvw2G.js";
|
|
6
6
|
import "./icon-D0IQAVwS.js";
|
|
7
|
-
import "./input-wrapper-
|
|
7
|
+
import "./input-wrapper-B__6jW4U.js";
|
|
8
8
|
import { e as $ } from "./class-map-3ADKve8g.js";
|
|
9
9
|
import { c as te } from "./repeat-DnlRNf63.js";
|
|
10
|
-
import "./tag-
|
|
10
|
+
import "./tag-CIWBLpjv.js";
|
|
11
11
|
import { u as se, s as ie } from "./utils-DznhwRXm.js";
|
|
12
|
-
import { o as
|
|
13
|
-
import {
|
|
12
|
+
import { o as f } from "./if-defined-rXcLNTzN.js";
|
|
13
|
+
import { s as ae } from "./element-with-slot-1djk8KXi.js";
|
|
14
14
|
const J = {
|
|
15
15
|
calendar: { buttonAltText: "Åpne kalender" }
|
|
16
16
|
}, ne = {
|
|
@@ -131,7 +131,7 @@ const oe = { dateformat: { default: "dd.MM.yyyy" }, weeknumbers: { default: !1 }
|
|
|
131
131
|
e
|
|
132
132
|
));
|
|
133
133
|
}
|
|
134
|
-
},
|
|
134
|
+
}, P = {
|
|
135
135
|
addToSelected(e, t, s, n) {
|
|
136
136
|
const i = e.target;
|
|
137
137
|
if (!i.value) return;
|
|
@@ -170,7 +170,7 @@ var ke = Object.defineProperty, we = Object.getOwnPropertyDescriptor, c = (e, t,
|
|
|
170
170
|
};
|
|
171
171
|
let d = class extends L {
|
|
172
172
|
constructor() {
|
|
173
|
-
super(...arguments), this.open = !1, this.multiple = !1, this.range = !1, this.weeknumbers = !1, this.withcontrols = !1, this.maxMultiple = null, this.selected = [], this.earliest = null, this.latest = null, this.excludedates = [], this.excludeweekdays = [], this.currentmonth = null, this.today = null, this._hasBeenOpened = !1, this.popupRef =
|
|
173
|
+
super(...arguments), this.open = !1, this.multiple = !1, this.range = !1, this.weeknumbers = !1, this.withcontrols = !1, this.maxMultiple = null, this.selected = [], this.earliest = null, this.latest = null, this.excludedates = [], this.excludeweekdays = [], this.currentmonth = null, this.today = null, this._hasBeenOpened = !1, this.popupRef = m(), this.calendarRef = m(), this.handleDocumentClick = (e) => {
|
|
174
174
|
if (!this.open) return;
|
|
175
175
|
const t = e.composedPath(), s = this.parentElement, n = this.popupRef.value;
|
|
176
176
|
!t.includes(this) && !t.includes(n) && !(s && t.includes(s)) && (this.hide(), this.dispatchEvent(new CustomEvent("close", { bubbles: !0, composed: !0 })));
|
|
@@ -206,8 +206,8 @@ let d = class extends L {
|
|
|
206
206
|
e && typeof e.focusOnCurrentDate == "function" && e.focusOnCurrentDate();
|
|
207
207
|
}
|
|
208
208
|
addToSelected(e, t, s) {
|
|
209
|
-
if (this.calendarRef.value && typeof
|
|
210
|
-
return
|
|
209
|
+
if (this.calendarRef.value && typeof P.addToSelected == "function")
|
|
210
|
+
return P.addToSelected(e, this.calendarRef, t, s);
|
|
211
211
|
const i = e.target;
|
|
212
212
|
if (!i.value) return;
|
|
213
213
|
const a = t ? k(t) : null, l = s ? k(s) : null, o = k(i.value.split(",")[0]);
|
|
@@ -308,9 +308,9 @@ var Ce = Object.defineProperty, y = (e, t, s, n) => {
|
|
|
308
308
|
(l = e[a]) && (i = l(t, s, i) || i);
|
|
309
309
|
return i && Ce(t, s, i), i;
|
|
310
310
|
};
|
|
311
|
-
class
|
|
311
|
+
class g extends L {
|
|
312
312
|
constructor() {
|
|
313
|
-
super(...arguments), this.inputType = "date", this.id = "", this.readonly = !1, this.disabled = !1, this.inputClasses = {}, this.inputRef =
|
|
313
|
+
super(...arguments), this.inputType = "date", this.id = "", this.readonly = !1, this.disabled = !1, this.inputClasses = {}, this.inputRef = m(), this.btnRef = m();
|
|
314
314
|
}
|
|
315
315
|
// Shared getters
|
|
316
316
|
get inputElement() {
|
|
@@ -394,37 +394,37 @@ class m extends L {
|
|
|
394
394
|
}
|
|
395
395
|
y([
|
|
396
396
|
r({ type: String })
|
|
397
|
-
],
|
|
397
|
+
], g.prototype, "inputType");
|
|
398
398
|
y([
|
|
399
399
|
r({ type: String })
|
|
400
|
-
],
|
|
400
|
+
], g.prototype, "id");
|
|
401
401
|
y([
|
|
402
402
|
r({ type: String })
|
|
403
|
-
],
|
|
403
|
+
], g.prototype, "min");
|
|
404
404
|
y([
|
|
405
405
|
r({ type: String })
|
|
406
|
-
],
|
|
406
|
+
], g.prototype, "max");
|
|
407
407
|
y([
|
|
408
408
|
r({ type: String })
|
|
409
|
-
],
|
|
409
|
+
], g.prototype, "placeholder");
|
|
410
410
|
y([
|
|
411
411
|
r({ type: Boolean })
|
|
412
|
-
],
|
|
412
|
+
], g.prototype, "readonly");
|
|
413
413
|
y([
|
|
414
414
|
r({ type: Boolean })
|
|
415
|
-
],
|
|
415
|
+
], g.prototype, "disabled");
|
|
416
416
|
y([
|
|
417
417
|
r({ type: Object })
|
|
418
|
-
],
|
|
418
|
+
], g.prototype, "inputClasses");
|
|
419
419
|
y([
|
|
420
420
|
r({ type: Object })
|
|
421
|
-
],
|
|
421
|
+
], g.prototype, "internals");
|
|
422
422
|
var xe = Object.defineProperty, _e = Object.getOwnPropertyDescriptor, M = (e, t, s, n) => {
|
|
423
423
|
for (var i = n > 1 ? void 0 : n ? _e(t, s) : t, a = e.length - 1, l; a >= 0; a--)
|
|
424
424
|
(l = e[a]) && (i = (n ? l(t, s, i) : l(i)) || i);
|
|
425
425
|
return n && i && xe(t, s, i), i;
|
|
426
426
|
};
|
|
427
|
-
let B = class extends
|
|
427
|
+
let B = class extends g {
|
|
428
428
|
constructor() {
|
|
429
429
|
super(...arguments), this.value = "", this.strings = J;
|
|
430
430
|
}
|
|
@@ -445,9 +445,9 @@ let B = class extends m {
|
|
|
445
445
|
.type=${this.inputType}
|
|
446
446
|
id="${this.id}-input"
|
|
447
447
|
.value=${this.value}
|
|
448
|
-
min=${
|
|
449
|
-
max=${
|
|
450
|
-
placeholder=${
|
|
448
|
+
min=${f(this.min)}
|
|
449
|
+
max=${f(this.max)}
|
|
450
|
+
placeholder=${f(this.placeholder)}
|
|
451
451
|
?readonly=${this.isInputReadonly}
|
|
452
452
|
aria-describedby="${this.id}-helptext"
|
|
453
453
|
@click=${(e) => {
|
|
@@ -509,9 +509,9 @@ var De = Object.defineProperty, Te = Object.getOwnPropertyDescriptor, S = (e, t,
|
|
|
509
509
|
(l = e[a]) && (i = (n ? l(t, s, i) : l(i)) || i);
|
|
510
510
|
return n && i && De(t, s, i), i;
|
|
511
511
|
};
|
|
512
|
-
let C = class extends
|
|
512
|
+
let C = class extends g {
|
|
513
513
|
constructor() {
|
|
514
|
-
super(...arguments), this.value = [], this.label = "", this.showRangeLabels = !1, this.strings = ne, this.inputRefTo =
|
|
514
|
+
super(...arguments), this.value = [], this.label = "", this.showRangeLabels = !1, this.strings = ne, this.inputRefTo = m();
|
|
515
515
|
}
|
|
516
516
|
get inputElementTo() {
|
|
517
517
|
return this.inputRefTo.value;
|
|
@@ -528,9 +528,9 @@ let C = class extends m {
|
|
|
528
528
|
id="${this.id}-input"
|
|
529
529
|
aria-label="${this.label} ${((s = this.strings.generic) == null ? void 0 : s.from) ?? "Fra"}"
|
|
530
530
|
.value=${this.value[0] ?? ""}
|
|
531
|
-
min=${
|
|
532
|
-
max=${
|
|
533
|
-
placeholder=${
|
|
531
|
+
min=${f(this.min)}
|
|
532
|
+
max=${f(this.max)}
|
|
533
|
+
placeholder=${f(this.placeholder)}
|
|
534
534
|
?readonly=${this.isInputReadonly}
|
|
535
535
|
?disabled=${this.disabled}
|
|
536
536
|
@click=${(a) => {
|
|
@@ -592,9 +592,9 @@ let C = class extends m {
|
|
|
592
592
|
id="${this.id}-to"
|
|
593
593
|
aria-label="${this.label} ${((i = this.strings.generic) == null ? void 0 : i.to) ?? "Til"}"
|
|
594
594
|
.value=${this.value[1] ?? ""}
|
|
595
|
-
min=${
|
|
596
|
-
max=${
|
|
597
|
-
placeholder=${
|
|
595
|
+
min=${f(this.min)}
|
|
596
|
+
max=${f(this.max)}
|
|
597
|
+
placeholder=${f(this.placeholder)}
|
|
598
598
|
?readonly=${this.isInputReadonly}
|
|
599
599
|
?disabled=${this.disabled}
|
|
600
600
|
@click=${(a) => {
|
|
@@ -665,7 +665,7 @@ var Re = Object.defineProperty, Ee = Object.getOwnPropertyDescriptor, A = (e, t,
|
|
|
665
665
|
(l = e[a]) && (i = (n ? l(t, s, i) : l(i)) || i);
|
|
666
666
|
return n && i && Re(t, s, i), i;
|
|
667
667
|
};
|
|
668
|
-
let R = class extends
|
|
668
|
+
let R = class extends g {
|
|
669
669
|
constructor() {
|
|
670
670
|
super(...arguments), this.value = [], this.strings = J;
|
|
671
671
|
}
|
|
@@ -688,9 +688,9 @@ let R = class extends m {
|
|
|
688
688
|
class=${$(this.inputClasses)}
|
|
689
689
|
.type=${this.inputType}
|
|
690
690
|
id="${this.id}-input"
|
|
691
|
-
min=${
|
|
692
|
-
max=${
|
|
693
|
-
placeholder=${
|
|
691
|
+
min=${f(this.min)}
|
|
692
|
+
max=${f(this.max)}
|
|
693
|
+
placeholder=${f(this.placeholder)}
|
|
694
694
|
?readonly=${this.isInputReadonly}
|
|
695
695
|
?disabled=${this.isInputDisabled}
|
|
696
696
|
@click=${(e) => {
|
|
@@ -741,20 +741,17 @@ A([
|
|
|
741
741
|
R = A([
|
|
742
742
|
x("pkt-datepicker-multiple")
|
|
743
743
|
], R);
|
|
744
|
-
var Se = Object.defineProperty,
|
|
745
|
-
for (var i = n > 1 ? void 0 : n ?
|
|
744
|
+
var Se = Object.defineProperty, Ie = Object.getOwnPropertyDescriptor, p = (e, t, s, n) => {
|
|
745
|
+
for (var i = n > 1 ? void 0 : n ? Ie(t, s) : t, a = e.length - 1, l; a >= 0; a--)
|
|
746
746
|
(l = e[a]) && (i = (n ? l(t, s, i) : l(i)) || i);
|
|
747
747
|
return n && i && Se(t, s, i), i;
|
|
748
748
|
};
|
|
749
749
|
let u = class extends ee {
|
|
750
|
-
/**
|
|
751
|
-
* Housekeeping / lifecycle methods
|
|
752
|
-
*/
|
|
753
750
|
constructor() {
|
|
754
|
-
super(), this._valueProperty = "", this._valueProcessing = !1, this.datepickerPopupRef =
|
|
751
|
+
super(...arguments), this._valueProperty = "", this._valueProcessing = !1, this.datepickerPopupRef = m(), this._value = [], this.label = "Datovelger", this.dateformat = _.props.dateformat.default, this.multiple = _.props.multiple.default, this.maxlength = null, this.range = _.props.range.default, this.showRangeLabels = !1, this.min = null, this.max = null, this.weeknumbers = _.props.weeknumbers.default, this.withcontrols = _.props.withcontrols.default, this.excludedates = [], this.excludeweekdays = [], this.currentmonth = null, this.today = null, this.calendarOpen = !1, this.timezone = "Europe/Oslo", this.inputClasses = {}, this.calRef = m(), this.popupRef = m(), this.singleInputRef = m(), this.rangeInputRef = m(), this.multipleInputRef = m(), this.addToSelected = (e) => {
|
|
755
752
|
const t = this.datepickerPopupRef.value;
|
|
756
|
-
return t && typeof t.addToSelected == "function" ? t.addToSelected(e, this.min, this.max) :
|
|
757
|
-
}
|
|
753
|
+
return t && typeof t.addToSelected == "function" ? t.addToSelected(e, this.min, this.max) : P.addToSelected(e, this.calRef, this.min, this.max);
|
|
754
|
+
};
|
|
758
755
|
}
|
|
759
756
|
get value() {
|
|
760
757
|
return this._valueProperty;
|
|
@@ -769,6 +766,9 @@ let u = class extends ee {
|
|
|
769
766
|
get inputType() {
|
|
770
767
|
return be.getInputType();
|
|
771
768
|
}
|
|
769
|
+
/**
|
|
770
|
+
* Housekeeping / lifecycle methods
|
|
771
|
+
*/
|
|
772
772
|
connectedCallback() {
|
|
773
773
|
super.connectedCallback(), this.timezone && this.timezone !== window.pktTz && (window.pktTz = this.timezone);
|
|
774
774
|
}
|
|
@@ -782,7 +782,7 @@ let u = class extends ee {
|
|
|
782
782
|
if (!(this._valueProcessing || e === t)) {
|
|
783
783
|
this._valueProcessing = !0;
|
|
784
784
|
try {
|
|
785
|
-
const s =
|
|
785
|
+
const s = I(e), n = this.multiple && s.length > 1 ? q.filterSelectableDates(
|
|
786
786
|
s,
|
|
787
787
|
this.min,
|
|
788
788
|
this.max,
|
|
@@ -803,14 +803,14 @@ let u = class extends ee {
|
|
|
803
803
|
}
|
|
804
804
|
}
|
|
805
805
|
attributeChangedCallback(e, t, s) {
|
|
806
|
-
e === "value" && this.value !== t && this.valueChanged(s, t), e === "excludedates" && typeof this.excludedates == "string" && (this.excludedates =
|
|
806
|
+
e === "value" && this.value !== t && this.valueChanged(s, t), e === "excludedates" && typeof this.excludedates == "string" && (this.excludedates = I(s || "")), e === "excludeweekdays" && typeof this.excludeweekdays == "string" && (this.excludeweekdays = I(s || "")), super.attributeChangedCallback(e, t, s);
|
|
807
807
|
}
|
|
808
808
|
updated(e) {
|
|
809
809
|
if (e.has("value") && (e.has("multiple") || e.has("range"))) {
|
|
810
810
|
const t = Array.isArray(this.value) ? this.value.join(",") : this.value, s = e.get("value"), n = Array.isArray(s) ? s.join(",") : s;
|
|
811
811
|
this.valueChanged(t, n);
|
|
812
812
|
}
|
|
813
|
-
e.has("multiple") && (this.multiple && !Array.isArray(this._value) ? this._value =
|
|
813
|
+
e.has("multiple") && (this.multiple && !Array.isArray(this._value) ? this._value = I(this.value) : !this.multiple && Array.isArray(this._value) && (this._value = this._value.filter(Boolean)), !this.multiple && !this.range && Array.isArray(this._value) && (this._value = [this._value[0] ?? ""])), super.updated(e);
|
|
814
814
|
}
|
|
815
815
|
/**
|
|
816
816
|
* Element references
|
|
@@ -1033,7 +1033,7 @@ let u = class extends ee {
|
|
|
1033
1033
|
.ariaDescribedBy=${this.ariaDescribedBy}
|
|
1034
1034
|
class="pkt-datepicker"
|
|
1035
1035
|
>
|
|
1036
|
-
<div class="pkt-contents"
|
|
1036
|
+
<div class="pkt-contents" slot="helptext">${ae(this, "helptext")}</div>
|
|
1037
1037
|
${this.multiple ? h`<pkt-date-tags
|
|
1038
1038
|
.dates=${this._value}
|
|
1039
1039
|
dateformat=${this.dateformat}
|
|
@@ -1057,7 +1057,7 @@ let u = class extends ee {
|
|
|
1057
1057
|
*/
|
|
1058
1058
|
handleCalendarPosition() {
|
|
1059
1059
|
const e = this.multiple && !!this.maxlength;
|
|
1060
|
-
|
|
1060
|
+
P.handleCalendarPosition(this.popupRef, this.inputRef, e);
|
|
1061
1061
|
}
|
|
1062
1062
|
async showCalendar() {
|
|
1063
1063
|
var t;
|