@oslokommune/punkt-elements 20.1.0 → 20.1.3

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.
Files changed (108) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/{calendar-xYEsKilS.cjs → calendar-KZlln5k8.cjs} +2 -2
  3. package/dist/{calendar-CkAAgviq.js → calendar-T_iFl5mR.js} +2 -2
  4. package/dist/{checkbox-Cg7wnn8U.cjs → checkbox-BS0iHeSP.cjs} +1 -1
  5. package/dist/{checkbox-XvlUQmg5.js → checkbox-DCaSNEjy.js} +1 -1
  6. package/dist/{checkbox-group-BF29zyLd.cjs → checkbox-group-BZhrLn4e.cjs} +1 -1
  7. package/dist/{checkbox-group-CRIV5CX0.js → checkbox-group-GsfZSfMs.js} +2 -2
  8. package/dist/{combobox-DuXavWEY.cjs → combobox-DoUwp_6k.cjs} +2 -1
  9. package/dist/{combobox-CDJcIkNJ.js → combobox-_2jd4CHR.js} +4 -3
  10. package/dist/components/datepicker/datepicker-popup.d.ts +0 -1
  11. package/dist/components/datepicker/datepicker-utils.d.ts +2 -13
  12. package/dist/components/datepicker/datepicker.d.ts +32 -4
  13. package/dist/components/datepicker/index.d.ts +1 -0
  14. package/dist/{datepicker-DHdFA8Dx.js → datepicker-D60fq9D5.js} +227 -472
  15. package/dist/datepicker-DErgngTf.cjs +286 -0
  16. package/dist/{fileupload-Cjde62AR.cjs → fileupload-Cn7CvQtX.cjs} +1 -1
  17. package/dist/{fileupload-BQw5nlzQ.js → fileupload-dmzxRqGF.js} +4 -4
  18. package/dist/{header-YbbGgmsD.cjs → header-BQCGdOPT.cjs} +1 -1
  19. package/dist/{header-CZnKVVt4.js → header-Djjhqu7w.js} +2 -2
  20. package/dist/{helptext-CQaNvbiv.cjs → helptext-4xBIABJJ.cjs} +1 -1
  21. package/dist/{helptext-kKmVQkwo.js → helptext-CNg695BI.js} +1 -1
  22. package/dist/{input-element-CfZIyfon.cjs → input-element-BPzDBWdd.cjs} +1 -1
  23. package/dist/{input-element-DE0FzjgP.js → input-element-DsWlt-6T.js} +1 -1
  24. package/dist/{input-wrapper-DYg1VHPv.js → input-wrapper-BBUcHEKx.js} +2 -2
  25. package/dist/{input-wrapper-CbYMk21W.cjs → input-wrapper-EKGhSUKU.cjs} +1 -1
  26. package/dist/{listbox-df8gHweY.js → listbox-BcJbeoAT.js} +1 -1
  27. package/dist/{listbox-Du8llYth.cjs → listbox-gjzS_z0P.cjs} +1 -1
  28. package/dist/{modal-SBJ8aGvM.js → modal-CvqH9R3w.js} +1 -1
  29. package/dist/{modal-B3rnE83a.cjs → modal-Du-2AmLz.cjs} +1 -1
  30. package/dist/{option-group-element-dN0ntPZk.cjs → option-group-element-DgqdU9HX.cjs} +1 -1
  31. package/dist/{option-group-element-DtSw52Dr.js → option-group-element-Dr2FR6v7.js} +2 -2
  32. package/dist/pkt-calendar.cjs +1 -1
  33. package/dist/pkt-calendar.js +1 -1
  34. package/dist/pkt-checkbox-group.cjs +1 -1
  35. package/dist/pkt-checkbox-group.js +1 -1
  36. package/dist/pkt-checkbox.cjs +1 -1
  37. package/dist/pkt-checkbox.js +1 -1
  38. package/dist/pkt-combobox.cjs +1 -1
  39. package/dist/pkt-combobox.js +1 -1
  40. package/dist/pkt-datepicker.cjs +1 -1
  41. package/dist/pkt-datepicker.js +1 -1
  42. package/dist/pkt-fileupload.cjs +1 -1
  43. package/dist/pkt-fileupload.js +1 -1
  44. package/dist/pkt-header.cjs +1 -1
  45. package/dist/pkt-header.js +1 -1
  46. package/dist/pkt-helptext.cjs +1 -1
  47. package/dist/pkt-helptext.js +1 -1
  48. package/dist/pkt-index.cjs +1 -1
  49. package/dist/pkt-index.js +18 -18
  50. package/dist/pkt-input-wrapper.cjs +1 -1
  51. package/dist/pkt-input-wrapper.js +1 -1
  52. package/dist/pkt-listbox.cjs +1 -1
  53. package/dist/pkt-listbox.js +1 -1
  54. package/dist/pkt-modal.cjs +1 -1
  55. package/dist/pkt-modal.js +1 -1
  56. package/dist/pkt-progressbar.cjs +1 -1
  57. package/dist/pkt-progressbar.js +1 -1
  58. package/dist/pkt-radio-group.cjs +1 -1
  59. package/dist/pkt-radio-group.js +1 -1
  60. package/dist/pkt-radiobutton.cjs +1 -1
  61. package/dist/pkt-radiobutton.js +1 -1
  62. package/dist/pkt-searchinput.cjs +1 -1
  63. package/dist/pkt-searchinput.js +1 -1
  64. package/dist/pkt-select.cjs +1 -1
  65. package/dist/pkt-select.js +1 -1
  66. package/dist/pkt-textarea.cjs +1 -1
  67. package/dist/pkt-textarea.js +1 -1
  68. package/dist/pkt-textinput.cjs +1 -1
  69. package/dist/pkt-textinput.js +1 -1
  70. package/dist/pkt-timepicker.cjs +1 -1
  71. package/dist/pkt-timepicker.js +1 -1
  72. package/dist/{progressbar-Wyq_Q1Ur.cjs → progressbar-BKA9zFnE.cjs} +1 -1
  73. package/dist/{progressbar-DlbkKRgP.js → progressbar-aKjj5VZg.js} +1 -1
  74. package/dist/{radio-group-u1IH7g-4.cjs → radio-group-BLVe7aMS.cjs} +1 -1
  75. package/dist/{radio-group-bRF8fnPW.js → radio-group-DDymupLt.js} +2 -2
  76. package/dist/{radiobutton-Bf6aFfYt.js → radiobutton-CnExI3Vj.js} +1 -1
  77. package/dist/{radiobutton-86ZvvDmJ.cjs → radiobutton-XX3zhblA.cjs} +1 -1
  78. package/dist/{searchinput-D5l64Mkb.cjs → searchinput-C8UHexyf.cjs} +1 -1
  79. package/dist/{searchinput-DN8kDZQ1.js → searchinput-DUJlxKHH.js} +1 -1
  80. package/dist/{select-CXIEM2qY.js → select-C4RDEc9h.js} +2 -2
  81. package/dist/{select-C7kAlSxs.cjs → select-CbVmSYmi.cjs} +1 -1
  82. package/dist/shared-types/datepicker.d.ts +76 -0
  83. package/dist/shared-types/index.d.ts +2 -2
  84. package/dist/shared-utils/datepicker-utils.d.ts +18 -0
  85. package/dist/shared-utils/forms/focus-within.d.ts +13 -0
  86. package/dist/{textarea-CRcSfWgX.cjs → textarea-D4yCdiFY.cjs} +1 -1
  87. package/dist/{textarea-12le8b4I.js → textarea-WktT3N3w.js} +2 -2
  88. package/dist/{textinput-CC0zxUBT.js → textinput-BPrC2neL.js} +2 -2
  89. package/dist/{textinput-Dooq2n8W.cjs → textinput-C6AcbxnQ.cjs} +1 -1
  90. package/dist/{timepicker-Cz81VQu3.js → timepicker-D77gssQg.js} +2 -2
  91. package/dist/{timepicker-BM4I5w-i.cjs → timepicker-DaqrwM-g.cjs} +1 -1
  92. package/dist/{utils-Dn5ykFtS.js → utils-BtXhdgpe.js} +2 -2
  93. package/dist/utils-dl1XA5EE.cjs +1 -0
  94. package/package.json +2 -2
  95. package/src/components/calendar/calendar.selection.test.ts +16 -0
  96. package/src/components/calendar/calendar.ts +4 -3
  97. package/src/components/combobox/combobox.interaction.test.ts +23 -0
  98. package/src/components/combobox/combobox.ts +1 -0
  99. package/src/components/datepicker/datepicker-multiple.ts +2 -6
  100. package/src/components/datepicker/datepicker-popup.ts +3 -6
  101. package/src/components/datepicker/datepicker-utils.test.ts +40 -203
  102. package/src/components/datepicker/datepicker-utils.ts +3 -94
  103. package/src/components/datepicker/datepicker.accessibility.test.ts +2 -2
  104. package/src/components/datepicker/datepicker.core.test.ts +236 -0
  105. package/src/components/datepicker/datepicker.ts +179 -115
  106. package/src/components/datepicker/index.ts +1 -0
  107. package/dist/datepicker-Cnrbqm62.cjs +0 -294
  108. package/dist/utils-63cRpWut.cjs +0 -1
@@ -1,294 +0,0 @@
1
- const e=require("./element-CEarCnHH.cjs"),t=require("./converters-Dp64-kF1.cjs"),n=require("./input-element-CfZIyfon.cjs"),r=require("./ref-C6VUWwmF.cjs");require("./calendar-xYEsKilS.cjs"),require("./icon-5A378_yh.cjs"),require("./input-wrapper-CbYMk21W.cjs");const i=require("./class-map-C82GtM1w.cjs"),a=require("./repeat-CjvNrcUr.cjs");require("./tag-BAikRN2Y.cjs");const o=require("./utils-63cRpWut.cjs"),s=require("./if-defined-Ci4ZQsgL.cjs"),c=require("./element-with-slot-D_8fAzCW.cjs");var l=class extends e.t{constructor(...e){super(...e),this.dates=[],this.dateformat=`dd.MM.yyyy`,this.className=`pkt-datepicker__tags`,this.idBase=o.n()}render(){return this.classes={"pkt-date-tags":!0,[this.className]:!0},e._`
2
- <div class=${i.t(this.classes)} aria-live="polite">
3
- ${Array.isArray(this.dates)&&this.dates[0]?a.t(t.h((this.dates??[]).filter(Boolean)),e=>e,n=>e._` <pkt-tag
4
- id=${this.idBase+n+`-tag`}
5
- closeTag
6
- @close=${()=>{this.dispatchEvent(new CustomEvent(`date-tag-removed`,{detail:n}))}}
7
- .ariaLabel=${`${this.pktStrings.get(`datepicker`).deleteDate} ${t.c(n,this.dateformat)}`}
8
- >
9
- <time datetime=${n}>${t.c(n,this.dateformat)}</time>
10
- </pkt-tag>`):e.h}
11
- </div>
12
- `}};e.n([e.u({type:Array})],l.prototype,`dates`,void 0),e.n([e.u({type:String})],l.prototype,`dateformat`,void 0),e.n([e.u({type:String,attribute:`class`})],l.prototype,`className`,void 0),e.n([e.u({type:String,attribute:`id-base`})],l.prototype,`idBase`,void 0);try{e.d(`pkt-date-tags`)(l)}catch{console.warn(`Forsøker å definere <pkt-date-tags>, men den er allerede definert`)}var u={name:`pkt-datepicker`,react:`PktDatepicker`,"css-class":`pkt-datepicker`,isElement:!0,isPureReact:!0,"dark-mode":!0,props:{name:{type:`string`,name:`Navn for innsending`,category:`tech`},form:{name:`Skjema`,description:`ID-en til skjemaet feltet hører til, når feltet ligger utenfor skjemaet`,type:`string`,required:!1,category:`tech`},label:{type:`string`,name:`Tekst/label`,category:`contents`},helptext:{type:`string`,name:`Hjelpetekst`,category:`contents`},helptextDropdown:{type:`string`,name:`Utvidet hjelpetekst`,description:`Hjelpetekst som vises i en lukket boks man kan åpne`,category:`contents`},helptextDropdownButton:{type:`string`,name:`Knappetekst for utvidet hjelpetekst`,default:`Les mer`,category:`contents`},dateformat:{name:`Datoformat for tags i flervalg`,type:`string`,default:`dd.MM.yyyy`,category:`tech`},currentmonth:{name:`Måned som vises i datovelgeren`,type:`ISOdatestring`,category:`tech`},value:{name:`Verdi (kommaseparert ved flervalg)`,type:`ISOdatestring`,variant:`multiple`,category:`tech`},excludeweekdays:{name:`Utelat ukedager`,type:`string`,description:`Kommaseparert liste over ukedager (1-7) som skal ekskluderes`,category:`functionality`},excludedates:{name:`Utelat datoer (Kommaseparerte ISO-datoer)`,type:`ISOdatestring`,variant:`multiple`,category:`functionality`},min:{name:`Tidligst tillatte dato`,type:`ISOdatestring`,default:null,category:`functionality`},max:{name:`Senest tillatte dato`,type:`ISOdatestring`,default:null,category:`functionality`},weeknumbers:{name:`Vis ukenummer`,type:`boolean`,reflect:!0,default:!1,category:`ui`},withcontrols:{name:`Med velgere for måned/år`,type:`boolean`,reflect:!0,default:!1,category:`ui`},multiple:{name:`Flervalg`,type:`boolean`,reflect:!0,default:!1,category:`functionality`,exclusiveGroup:`selectionMode`},maxlength:{name:`Maks antall datoer i flervalg`,type:`number`,category:`functionality`,showIf:{multiple:!0}},range:{name:`Datotidsrom (fra og til)`,type:`boolean`,reflect:!0,default:!1,category:`functionality`,exclusiveGroup:`selectionMode`},showRangeLabels:{attribute:`show-range-labels`,name:`Vis fra/til-etiketter`,type:`boolean`,default:!1,category:`ui`,showIf:{range:!0}},today:{name:`Dagens dato (overstyring)`,type:`ISOdatestring`,description:`ISO-datostreng som overstyrer dagens dato i kalenderen. Nyttig for snapshot-tester.`,category:`tech`},calendarOpen:{attribute:`calendar-open`,name:`Kalender åpen`,type:`boolean`,reflect:!0,default:!1,category:`ui`},hasError:{type:`boolean`,name:`Feil`,default:!1,category:`ui`},errorMessage:{type:`string`,name:`Feilmelding ved feil`,category:`contents`},disabled:{type:`boolean`,name:`Deaktivert`,default:!1,reflect:!0,category:`tech`},fullwidth:{type:`boolean`,name:`Full bredde`,default:!1,reflect:!0,category:`ui`},inputSize:{attribute:`input-size`,name:`Størrelse`,description:`Størrelsen på komponenten`,type:[`medium`,`small`,`xsmall`],default:`medium`,category:`ui`},required:{type:`boolean`,name:`Påkrevd`,default:!1,reflect:!0,category:`tech`},requiredTag:{type:`boolean`,name:`Vise påkrevd-merking`,default:!1,category:`ui`},requiredText:{type:`string`,name:`Påkrevd-tekst`,default:`Må fylles ut`,category:`contents`},optionalTag:{type:`boolean`,name:`Vise valgfritt-merking`,default:!1,category:`ui`},optionalText:{type:`string`,name:`Valgfritt-tekst`,default:`Valgfritt`,category:`contents`},tagText:{type:`string`,name:`Tag-tekst`,description:`Tekst som vises i en tag ved siden av label`,category:`ui`},useWrapper:{type:`boolean`,name:`Bruk wrapper`,description:`Indikerer at feltet skal ha synlig label og hjelpetekst`,displayAsFalse:!0,default:!0,category:`ui`},id:{type:`string`,name:`ID`,description:`Unik identifikasjon for datovelgeren`,category:`tech`},ariaDescribedby:{attribute:`aria-describedby`,name:`aria-describedby`,description:`Spesifiserer ID-en til elementet som beskriver feltet.`,type:`string`,category:`accessibility`},inline:{name:`Inline`,type:`boolean`,required:!1,default:!1,description:`Angir om feltet skal flyte med teksten`,category:`ui`},hasFieldset:{name:`Bruk fieldset`,type:`boolean`,required:!1,default:null,description:`Bruk fieldset og legend i stedet for label. Utledes automatisk når feltet består av flere kontroller.`,category:`ui`},counter:{name:`Teller`,type:`boolean`,required:!1,default:null,description:`Viser teller under feltet. Slås på av seg selv når det finnes en grense å telle mot; sett til false for å skru den av.`,category:`ui`}},events:{change:{type:`Event`,name:`change (Elements)`,description:`Returnerer valgt dato som streng i ISO-format. I range-modus utløses kun når begge datoer er valgt.`},"value-change":{type:`CustomEvent`,name:`value-change (Elements)`,description:`Returnerer en <code>array</code> med valgte datoer i ISO-format. I range-modus utløses kun når begge datoer er valgt.`},toggleHelpText:{type:`CustomEvent`,description:`Returnerer <code>event.detail { isOpen: true }</code> eller <code>event.detail { isOpen: false }</code> når hjelpeteksten åpnes eller lukkes`},onChange:{type:`Event`,name:`onChange (React)`,reactOnly:!0,description:`Utløses når en dato velges. <code>e.target.value</code> inneholder kommaseparerte ISO-datoer. I range-modus utløses kun når begge datoer er valgt.`},onValueChange:{type:`string[]`,name:`onValueChange (React)`,reactOnly:!0,description:`Returnerer en <code>string[]</code> med valgte datoer i ISO-format. I range-modus utløses kun når begge datoer er valgt.`}}},d=()=>{let e=navigator.userAgent;return!!(/iP(hone|od|ad)/.test(e)||/Macintosh/.test(e)&&`ontouchend`in document)},f=()=>d()?`text`:`date`,p=e=>!e||e.length!==2||t.u(e[0],e[1]),m=e=>t.h(e),h=(e,n,r,i,a)=>t.i(e,n,r,i,a),g=(e,t,n,r,i,a,o=`medium`)=>({"pkt-input":!0,"pkt-datepicker__input":!0,[`pkt-input--${o}`]:!0,"pkt-input--fullwidth":e,"pkt-datepicker--hasrangelabels":t,"pkt-datepicker--multiple":n,"pkt-datepicker--range":r,"ios-readonly-hack":i===!1&&a===`text`}),_=(e=`medium`)=>({"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0,[`pkt-btn--${e}`]:!0,"pkt-datepicker__calendar-button":!0}),v=e=>({"pkt-input-prefix":e,"pkt-hide":!e}),y=(e,t,n)=>!t&&!n?Array.isArray(e)?e[0]||``:e:Array.isArray(e)?e.join(`,`):e,b=(e,t,n=!1)=>{if(!e||!t)return;let r=t.parentElement?.getBoundingClientRect()||t.getBoundingClientRect(),i=n?r.height+30:r.height,a=e.getBoundingClientRect().height,o=n?`calc(100% - 30px)`:`100%`;r&&typeof window<`u`&&r.top+a>window.innerHeight&&r.top-a>0&&(o=`calc(100% - ${i}px - ${a}px)`),e.style.top=o},x=(e,t,n,r,i,a)=>{let{key:o}=e;o===`,`&&(e.preventDefault(),a?a(e):i&&i()),(o===`Space`||o===` `)&&(e.preventDefault(),t(e)),o===`Enter`&&(e.preventDefault(),n?n():r?r():i&&i())},S=(e,t)=>{let{key:n}=e;(n===`Enter`||n===` `||n===`Space`)&&(e.preventDefault(),t(e))},C={validateRangeOrder:p,sortDates:m,filterSelectableDates:h},w={getInputType:f},T={submitForm(e){let t=e.internals?.form;t&&t.requestSubmit()},submitFormOrFallback(e,t){let n=e?.form;n?n.requestSubmit():t()},validateDateInput(t,n,r,i,a){let o=t.value;if(!o)return;let s={...e.s.validation,...a};r&&r>o?n.setValidity({rangeUnderflow:!0},s.dateUnderflow,t):i&&i<o&&n.setValidity({rangeOverflow:!0},s.dateOverflow,t)}},E={addToSelected(e,n,r,i){let a=e.target;if(!a.value)return;let o=r?t.d(r):null,s=i?t.d(i):null,c=t.d(a.value.split(`,`)[0]);c&&!isNaN(c.getTime())&&(!o||c>=o)&&(!s||c<=s)&&n.value&&n.value.handleDateSelect(c),a.value=``},handleCalendarPosition(e,t,n=!1){b(e.value??null,t.value??null,n)}},D={getInputClasses:g,getButtonClasses:_,getRangeLabelClasses:v},O={processDateSelection:y,updateInputValues(e,t,n,r,i,a){e.value&&(r&&t?.value?(e.value.value=n[0]??``,t.value.value=n[1]??``,a(e.value),a(t.value)):i||(e.value.value=n.length?n[0]:``,a(e.value)))},processRangeBlur(e,n,r,i,a){let o=e.target;if(o.value){a(o);let e=t.s(o.value);e&&r?.value?.handleDateSelect(e)}else n[0]&&i()}},k={handleInputKeydown:x,handleButtonKeydown:S},A=class extends e.t{constructor(...e){super(...e),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=r.t(),this.calendarRef=r.t(),this.handleDocumentClick=e=>{if(!this.open)return;let t=e.composedPath(),n=this.parentElement,r=this.popupRef.value;t.includes(this)||t.includes(r)||n&&t.includes(n)||(this.hide(),this.dispatchEvent(new CustomEvent(`close`,{bubbles:!0,composed:!0})))},this.handleDocumentKeydown=e=>{this.open&&e.key===`Escape`&&(this.hide(),this.dispatchEvent(new CustomEvent(`close`,{bubbles:!0,composed:!0})))}}firstUpdated(){this.calRef=this.calendarRef}willUpdate(e){super.willUpdate(e),e.has(`open`)&&this.open&&(this._hasBeenOpened=!0)}updated(e){super.updated(e),e.has(`open`)&&(this.open?(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(){this.open=!0,this.calendarRef.value?.focus()}hide(){this.open=!1}toggle(){this.open?this.hide():this.show()}contains(e){return!!e&&!!this.popupRef.value?.contains(e)}focusOnCurrentDate(){let e=this.calendarRef.value;e&&typeof e.focusOnCurrentDate==`function`&&e.focusOnCurrentDate()}addToSelected(e,n,r){if(this.calendarRef.value&&typeof E.addToSelected==`function`)return E.addToSelected(e,this.calendarRef,n,r);let i=e.target;if(!i.value)return;let a=n?t.d(n):null,o=r?t.d(r):null,s=t.d(i.value.split(`,`)[0]);s&&!isNaN(s.getTime())&&(!a||s>=a)&&(!o||s<=o)&&this.handleDateSelect(s),i.value=``}handleDateSelect(e){let n=this.calendarRef.value;if(n&&typeof n.handleDateSelect==`function`)return n.handleDateSelect(e);let r=t.a(e),i=this.selected.indexOf(r)>=0?this.selected.filter(e=>e!==r):[...this.selected,r];this.selected=i,this.dispatchEvent(new CustomEvent(`date-selected`,{detail:i,bubbles:!0,composed:!0}))}render(){let t={"pkt-calendar-popup":!0,show:this.open,hide:!this.open};return e._`
13
- <div
14
- class="${i.t(t)}"
15
- ${r.n(this.popupRef)}
16
- id="date-popup"
17
- ?hidden=${!this.open}
18
- aria-hidden="${!this.open}"
19
- >
20
- ${this.open||this._hasBeenOpened?e._`<pkt-calendar
21
- ${r.n(this.calendarRef)}
22
- ?multiple=${this.multiple}
23
- ?range=${this.range}
24
- ?weeknumbers=${this.weeknumbers}
25
- ?withcontrols=${this.withcontrols}
26
- .maxMultiple=${this.maxMultiple}
27
- .selected=${this.selected}
28
- .earliest=${this.earliest}
29
- .latest=${this.latest}
30
- .excludedates=${this.excludedates}
31
- .excludeweekdays=${this.excludeweekdays}
32
- .currentmonth=${this.currentmonth}
33
- .today=${this.today}
34
- @date-selected=${e=>{this.selected=e.detail,this.dispatchEvent(new CustomEvent(`date-selected`,{detail:e.detail,bubbles:!0,composed:!0}))}}
35
- @close=${()=>{this.hide(),this.dispatchEvent(new CustomEvent(`close`,{bubbles:!0,composed:!0}))}}
36
- ></pkt-calendar>`:e.h}
37
- </div>
38
- `}};e.n([e.u({type:Boolean,reflect:!0})],A.prototype,`open`,void 0),e.n([e.u({type:Boolean})],A.prototype,`multiple`,void 0),e.n([e.u({type:Boolean})],A.prototype,`range`,void 0),e.n([e.u({type:Boolean})],A.prototype,`weeknumbers`,void 0),e.n([e.u({type:Boolean})],A.prototype,`withcontrols`,void 0),e.n([e.u({type:Number})],A.prototype,`maxMultiple`,void 0),e.n([e.u({type:Array})],A.prototype,`selected`,void 0),e.n([e.u({type:String})],A.prototype,`earliest`,void 0),e.n([e.u({type:String})],A.prototype,`latest`,void 0),e.n([e.u({type:Array})],A.prototype,`excludedates`,void 0),e.n([e.u({type:Array})],A.prototype,`excludeweekdays`,void 0),e.n([e.u({type:String})],A.prototype,`currentmonth`,void 0),e.n([e.u({type:String})],A.prototype,`today`,void 0),e.n([e.l()],A.prototype,`_hasBeenOpened`,void 0);try{e.d(`pkt-datepicker-popup`)(A)}catch{console.warn(`Forsøker å definere <pkt-datepicker-popup>, men den er allerede definert`)}var j=class extends e.t{constructor(...e){super(...e),this.inputType=`date`,this.id=``,this.readonly=!1,this.disabled=!1,this.inputClasses={},this.inputSize=`medium`,this.hasError=!1,this.hasHelptext=!1,this.inputRef=r.t(),this.btnRef=r.t()}get describedBy(){return this.hasHelptext?`${this.id}-input-helptext`:void 0}get errorMessageId(){return this.hasError?`${this.id}-input-error`:void 0}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(){return e._`
39
- <button
40
- class="${i.t(D.getButtonClasses(this.inputSize))}"
41
- type="button"
42
- @click=${e=>this.dispatchToggleCalendar(e)}
43
- @keydown=${e=>{let{key:t}=e;(t===`Enter`||t===` `||t===`Space`)&&(e.preventDefault(),this.dispatchToggleCalendar(e))}}
44
- ?disabled=${this.disabled}
45
- ${this.btnRef}
46
- >
47
- <pkt-icon name="calendar"></pkt-icon>
48
- <span class="pkt-btn__text">${this.pktStrings.get(`datepicker`).openPicker}</span>
49
- </button>
50
- `}createRenderRoot(){return this}};e.n([e.u({type:String})],j.prototype,`inputType`,void 0),e.n([e.u({type:String})],j.prototype,`id`,void 0),e.n([e.u({type:String})],j.prototype,`min`,void 0),e.n([e.u({type:String})],j.prototype,`max`,void 0),e.n([e.u({type:String})],j.prototype,`placeholder`,void 0),e.n([e.u({type:Boolean})],j.prototype,`readonly`,void 0),e.n([e.u({type:Boolean})],j.prototype,`disabled`,void 0),e.n([e.u({type:Object})],j.prototype,`inputClasses`,void 0),e.n([e.u({type:String})],j.prototype,`inputSize`,void 0),e.n([e.u({type:Object})],j.prototype,`internals`,void 0),e.n([e.u({type:Boolean})],j.prototype,`hasError`,void 0),e.n([e.u({type:Boolean})],j.prototype,`hasHelptext`,void 0);var M=class extends j{constructor(...e){super(...e),this.value=``}dispatchManageValidity(e){this.dispatchEvent(new CustomEvent(`manage-validity`,{detail:e,bubbles:!0,composed:!0}))}render(){return e._`
51
- <div class="pkt-input__container">
52
- <input
53
- class="${i.t(this.inputClasses)}"
54
- .type=${this.inputType}
55
- id="${this.id}-input"
56
- .value=${this.value}
57
- min=${s.t(this.min)}
58
- max=${s.t(this.max)}
59
- placeholder=${s.t(this.placeholder)}
60
- ?readonly=${this.isInputReadonly}
61
- aria-describedby=${s.t(this.describedBy)}
62
- aria-invalid=${this.hasError}
63
- aria-errormessage=${s.t(this.errorMessageId)}
64
- @click=${e=>{e.preventDefault(),this.dispatchToggleCalendar(e)}}
65
- @touchend=${e=>{e.preventDefault(),this.dispatchToggleCalendar(e)}}
66
- ?disabled=${this.disabled}
67
- @keydown=${e=>k.handleInputKeydown(e,e=>this.dispatchToggleCalendar(e),()=>T.submitFormOrFallback(this.internals,()=>this.inputRef.value?.blur()),void 0,()=>this.inputRef.value?.blur())}
68
- @input=${e=>{this.dispatchInput(e),e.stopImmediatePropagation()}}
69
- @focus=${()=>{this.dispatchFocus(),d()&&this.dispatchToggleCalendar(new Event(`focus`))}}
70
- @blur=${e=>{this.dispatchBlur(e),this.dispatchManageValidity(e.target),this.dispatchEvent(new CustomEvent(`value-change`,{detail:e.target.value,bubbles:!0,composed:!0}))}}
71
- @change=${e=>{this.dispatchChange(e),e.stopImmediatePropagation()}}
72
- ${r.n(this.inputRef)}
73
- />
74
- ${this.renderCalendarButton()}
75
- </div>
76
- `}};e.n([e.u({type:String})],M.prototype,`value`,void 0);try{e.d(`pkt-datepicker-single`)(M)}catch{console.warn(`Forsøker å definere <pkt-datepicker-single>, men den er allerede definert`)}var N=class extends j{constructor(...e){super(...e),this.value=[],this.label=``,this.showRangeLabels=!1,this.inputRefTo=r.t()}get inputElementTo(){return this.inputRefTo.value}render(){let t=D.getRangeLabelClasses(this.showRangeLabels);return e._`
77
- <div class="pkt-input__container">
78
- ${this.showRangeLabels?e._` <div class="pkt-input-prefix">${this.pktStrings.get(`generic`).from}</div> `:e.h}
79
- <input
80
- aria-describedby=${s.t(this.describedBy)}
81
- aria-invalid=${this.hasError}
82
- aria-errormessage=${s.t(this.errorMessageId)}
83
- class=${i.t(this.inputClasses)}
84
- .type=${this.inputType}
85
- id="${this.id}-input"
86
- aria-label="${this.label} ${this.pktStrings.get(`generic`).from}"
87
- .value=${this.value[0]??``}
88
- min=${s.t(this.min)}
89
- max=${s.t(this.max)}
90
- placeholder=${s.t(this.placeholder)}
91
- ?readonly=${this.isInputReadonly}
92
- ?disabled=${this.disabled}
93
- @click=${e=>{e.preventDefault(),this.dispatchToggleCalendar(e)}}
94
- @touchend=${e=>{e.preventDefault(),this.dispatchToggleCalendar(e)}}
95
- @keydown=${e=>k.handleInputKeydown(e,e=>this.dispatchToggleCalendar(e),()=>T.submitFormOrFallback(this.internals,()=>this.inputRefTo.value?.focus()),()=>this.inputRefTo.value?.focus(),()=>this.inputRef.value?.blur())}
96
- @input=${e=>{this.dispatchInput(e),e.stopImmediatePropagation()}}
97
- @focus=${()=>{this.dispatchFocus(),d()&&this.dispatchToggleCalendar(new Event(`focus`))}}
98
- @blur=${e=>{this.dispatchBlur(e),this.dispatchEvent(new CustomEvent(`range-blur`,{detail:{event:e,values:this.value,inputType:`from`},bubbles:!0,composed:!0}))}}
99
- @change=${e=>{this.dispatchChange(e),e.stopImmediatePropagation()}}
100
- ${r.n(this.inputRef)}
101
- />
102
- <div class="${i.t(t)}" id="${this.id}-to-label">
103
- ${this.pktStrings.get(`generic`).to}
104
- </div>
105
- ${this.showRangeLabels?e.h:e._` <div class="pkt-input-separator">–</div> `}
106
- <input
107
- aria-describedby=${s.t(this.describedBy)}
108
- aria-invalid=${this.hasError}
109
- aria-errormessage=${s.t(this.errorMessageId)}
110
- class=${i.t(this.inputClasses)}
111
- .type=${this.inputType}
112
- id="${this.id}-to"
113
- aria-label="${this.label} ${this.pktStrings.get(`generic`).to}"
114
- .value=${this.value[1]??``}
115
- min=${s.t(this.min)}
116
- max=${s.t(this.max)}
117
- placeholder=${s.t(this.placeholder)}
118
- ?readonly=${this.isInputReadonly}
119
- ?disabled=${this.disabled}
120
- @click=${e=>{e.preventDefault(),this.dispatchToggleCalendar(e)}}
121
- @touchend=${e=>{e.preventDefault(),this.dispatchToggleCalendar(e)}}
122
- @keydown=${e=>k.handleInputKeydown(e,e=>this.dispatchToggleCalendar(e),()=>T.submitFormOrFallback(this.internals,()=>this.inputRefTo.value?.blur()),void 0,()=>this.inputRefTo.value?.blur())}
123
- @input=${e=>{this.dispatchInput(e),e.stopImmediatePropagation()}}
124
- @focus=${()=>{this.dispatchFocus(),d()&&this.dispatchToggleCalendar(new Event(`focus`))}}
125
- @blur=${e=>{this.dispatchBlur(e),this.dispatchEvent(new CustomEvent(`range-blur`,{detail:{event:e,values:this.value,inputType:`to`},bubbles:!0,composed:!0}))}}
126
- @change=${e=>{this.dispatchChange(e),e.stopImmediatePropagation()}}
127
- ${r.n(this.inputRefTo)}
128
- />
129
- ${this.renderCalendarButton()}
130
- </div>
131
- `}};e.n([e.u({type:Array})],N.prototype,`value`,void 0),e.n([e.u({type:String})],N.prototype,`label`,void 0),e.n([e.u({type:Boolean})],N.prototype,`showRangeLabels`,void 0);try{e.d(`pkt-datepicker-range`)(N)}catch{console.warn(`Forsøker å definere <pkt-datepicker-range>, men den er allerede definert`)}var P=class extends j{constructor(...e){super(...e),this.value=[]}get isInputDisabled(){return this.disabled||this.maxlength!==void 0&&this.maxlength!==null&&this.value.length>=this.maxlength}dispatchAddToSelected(e){this.dispatchEvent(new CustomEvent(`add-to-selected`,{detail:e,bubbles:!0,composed:!0}))}render(){return e._`
132
- <div class="pkt-input__container">
133
- <input
134
- aria-describedby=${s.t(this.describedBy)}
135
- aria-invalid=${this.hasError}
136
- aria-errormessage=${s.t(this.errorMessageId)}
137
- class=${i.t(this.inputClasses)}
138
- .type=${this.inputType}
139
- id="${this.id}-input"
140
- min=${s.t(this.min)}
141
- max=${s.t(this.max)}
142
- placeholder=${s.t(this.placeholder)}
143
- ?readonly=${this.isInputReadonly}
144
- ?disabled=${this.isInputDisabled}
145
- @click=${e=>{e.preventDefault(),this.dispatchToggleCalendar(e)}}
146
- @touchend=${e=>{e.preventDefault(),this.dispatchToggleCalendar(e)}}
147
- @blur=${e=>{this.dispatchBlur(e),this.dispatchAddToSelected(e)}}
148
- @input=${e=>{this.dispatchInput(e),e.stopImmediatePropagation()}}
149
- @focus=${()=>{this.dispatchFocus(),d()&&this.dispatchToggleCalendar(new Event(`focus`))}}
150
- @keydown=${e=>k.handleInputKeydown(e,e=>this.dispatchToggleCalendar(e),()=>T.submitFormOrFallback(this.internals,()=>this.inputRef.value?.blur()),void 0,void 0,e=>this.dispatchAddToSelected(e))}
151
- @change=${e=>{this.dispatchChange(e),e.stopImmediatePropagation()}}
152
- ${r.n(this.inputRef)}
153
- />
154
- ${this.renderCalendarButton()}
155
- </div>
156
- `}};e.n([e.u({type:Array})],P.prototype,`value`,void 0),e.n([e.u({type:Number})],P.prototype,`maxlength`,void 0);try{e.d(`pkt-datepicker-multiple`)(P)}catch{console.warn(`Forsøker å definere <pkt-datepicker-multiple>, men den er allerede definert`)}var F,I=class i extends n.t{constructor(...e){super(...e),this._valueProperty=``,this.datepickerPopupRef=r.t(),this._value=[],this.label=`Datovelger`,this.dateformat=u.props.dateformat.default,this.multiple=u.props.multiple.default,this.maxlength=null,this.range=u.props.range.default,this.showRangeLabels=!1,this.min=null,this.max=null,this.weeknumbers=u.props.weeknumbers.default,this.withcontrols=u.props.withcontrols.default,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.today=null,this.calendarOpen=!1,this.timezone=`Europe/Oslo`,this.inputClasses={},this.calRef=r.t(),this.popupRef=r.t(),this.singleInputRef=r.t(),this.rangeInputRef=r.t(),this.multipleInputRef=r.t(),this.addToSelected=e=>{let t=this.datepickerPopupRef.value;return t&&typeof t.addToSelected==`function`?t.addToSelected(e,this.min,this.max):E.addToSelected(e,this.calRef,this.min,this.max)}}get value(){return this._valueProperty}set value(e){let t=this._valueProperty,n=Array.isArray(e)?e.join(`,`):e||``;n!==t&&(this._valueProperty=n,this.requestUpdate(`value`,t))}get inputType(){return w.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){e!==t&&(this.value=e??``,this.deriveValue(t))}deriveValue(e){let n=t.r(this._valueProperty),r=this.multiple&&n.length>1?C.filterSelectableDates(n,this.min,this.max,this.excludedates,this.excludeweekdays):n;this.range&&!C.validateRangeOrder(r)?(this._valueProperty=``,this.getAttribute(`value`)&&this.setAttribute(`value`,``),super.valueChanged(``,e),this._value=[]):(this._valueProperty=t.n(r),this.range&&r.length===1||super.valueChanged(this._valueProperty,e),this._value=r)}attributeChangedCallback(e,n,r){e===`excludedates`&&typeof this.excludedates==`string`&&(this.excludedates=t.r(r||``)),e===`excludeweekdays`&&typeof this.excludeweekdays==`string`&&(this.excludeweekdays=t.r(r||``)),super.attributeChangedCallback(e,n,r)}willUpdate(e){if(super.willUpdate(e),i.DERIVED_FROM.some(t=>e.has(t))){let t=e.get(`value`);this.deriveValue(Array.isArray(t)?t.join(`,`):t??null)}}updated(e){this.classList.add(`pkt-datepicker`),this.classList.toggle(`pkt-datepicker--fullwidth`,this.fullwidth),this.classList.toggle(`pkt-datepicker--medium`,this.inputSize===`medium`),this.classList.toggle(`pkt-datepicker--small`,this.inputSize===`small`),this.classList.toggle(`pkt-datepicker--xsmall`,this.inputSize===`xsmall`),super.updated(e)}get inputRef(){return{value:this.currentInputElement}}get inputRefTo(){return{value:this.currentInputElementTo}}get currentInputElement(){return this.multiple?this.multipleInputRef.value?.inputElement:this.range?this.rangeInputRef.value?.inputElement:this.singleInputRef.value?.inputElement}get currentInputElementTo(){if(this.range)return this.rangeInputRef.value?.inputElementTo}get currentButtonElement(){return this.multiple?this.multipleInputRef.value?.buttonElement:this.range?this.rangeInputRef.value?.buttonElement:this.singleInputRef.value?.buttonElement}get btnRef(){return{value:this.currentButtonElement}}renderInput(){return e._`
157
- <pkt-datepicker-single
158
- .value=${this._value[0]??``}
159
- .inputType=${this.inputType}
160
- .id=${this.id}
161
- .min=${this.min}
162
- .max=${this.max}
163
- .placeholder=${this.placeholder}
164
- .readonly=${this.readonly}
165
- .disabled=${this.isDisabled}
166
- .inputClasses=${this.inputClasses}
167
- .inputSize=${this.inputSize}
168
- .internals=${this.internals}
169
- .hasError=${this.hasError}
170
- .hasHelptext=${!!(this.helptext||this.helptextDropdown||this.hasSlotContent(`helptext`))}
171
- .strings=${this.strings}
172
- @toggle-calendar=${e=>this.toggleCalendar(e.detail)}
173
- @input-change=${()=>this.onInput()}
174
- @input-focus=${()=>this.onFocus()}
175
- @input-blur=${e=>{this.calRef.value?.contains(e.detail.relatedTarget)||this.onBlur()}}
176
- @manage-validity=${e=>this.manageValidity(e.detail)}
177
- @value-change=${e=>{this.value=e.detail}}
178
- @input-changed=${()=>{this.touched=!0}}
179
- ${r.n(this.singleInputRef)}
180
- ></pkt-datepicker-single>
181
- `}renderRangeInput(){return e._`
182
- <pkt-datepicker-range
183
- .value=${this._value}
184
- .inputType=${this.inputType}
185
- .id=${this.id}
186
- .label=${this.label}
187
- .min=${this.min}
188
- .max=${this.max}
189
- .placeholder=${this.placeholder}
190
- .readonly=${this.readonly}
191
- .disabled=${this.isDisabled}
192
- .showRangeLabels=${this.showRangeLabels}
193
- .inputClasses=${this.inputClasses}
194
- .inputSize=${this.inputSize}
195
- .internals=${this.internals}
196
- .hasError=${this.hasError}
197
- .hasHelptext=${!!(this.helptext||this.helptextDropdown||this.hasSlotContent(`helptext`))}
198
- .strings=${this.strings}
199
- @toggle-calendar=${e=>this.toggleCalendar(e.detail)}
200
- @input-change=${()=>this.onInput()}
201
- @input-focus=${()=>this.onFocus()}
202
- @input-blur=${e=>{this.calRef.value?.contains(e.detail.relatedTarget)||this.onBlur()}}
203
- @range-blur=${e=>{let t=this.currentInputElement,n=this.currentInputElementTo;if(t&&n){let e=t.value,r=n.value;if(e&&r&&e>r)n.value=``,this._value=[e],this.value=e;else{let t=[e,r].filter(Boolean);t.length>0&&(t[0]!==this._value[0]||t[1]!==this._value[1])&&(this._value=t,this.value=t.join(`,`))}}O.processRangeBlur(e.detail.event,e.detail.values,this.calRef,()=>this.clearInputValue(),e=>this.manageValidity(e))}}
204
- @manage-validity=${e=>this.manageValidity(e.detail)}
205
- @validate-date-input=${e=>{T.validateDateInput(e.detail,this.internals,this.min,this.max,this.pktStrings.get(`validation`))}}
206
- @handle-date-select=${e=>{let n=t.s(e.detail);if(n){let e=t.a(n);this._value[0]!==e&&this._value[1]!==e&&this.calRef?.value?.handleDateSelect(n)}}}
207
- @input-changed=${()=>{this.touched=!0}}
208
- ${r.n(this.rangeInputRef)}
209
- ></pkt-datepicker-range>
210
- `}renderMultipleInput(){return e._`
211
- <pkt-datepicker-multiple
212
- .value=${this._value}
213
- .inputType=${this.inputType}
214
- .id=${this.id}
215
- .min=${this.min}
216
- .max=${this.max}
217
- .placeholder=${this.placeholder}
218
- .readonly=${this.readonly}
219
- .disabled=${this.isDisabled}
220
- .maxlength=${this.maxlength}
221
- .inputClasses=${this.inputClasses}
222
- .inputSize=${this.inputSize}
223
- .internals=${this.internals}
224
- .hasError=${this.hasError}
225
- .hasHelptext=${!!(this.helptext||this.helptextDropdown||this.hasSlotContent(`helptext`))}
226
- .strings=${this.strings}
227
- @toggle-calendar=${e=>this.toggleCalendar(e.detail)}
228
- @input-change=${()=>this.onInput()}
229
- @input-focus=${()=>this.onFocus()}
230
- @input-blur=${e=>{this.calRef.value?.contains(e.detail.relatedTarget)||this.onBlur()}}
231
- @add-to-selected=${e=>this.addToSelected(e.detail)}
232
- @input-changed=${()=>{this.touched=!0}}
233
- ${r.n(this.multipleInputRef)}
234
- ></pkt-datepicker-multiple>
235
- `}renderCalendar(){return e._`
236
- <pkt-datepicker-popup
237
- class="pkt-contents"
238
- ?open=${this.calendarOpen}
239
- ?multiple=${this.multiple}
240
- ?range=${this.range}
241
- ?weeknumbers=${this.weeknumbers}
242
- ?withcontrols=${this.withcontrols}
243
- .maxMultiple=${this.maxlength}
244
- .selected=${this._value}
245
- .earliest=${this.min}
246
- .latest=${this.max}
247
- .excludedates=${Array.isArray(this.excludedates)?this.excludedates:this.excludedates.split(`,`)}
248
- .excludeweekdays=${this.excludeweekdays}
249
- .currentmonth=${this.currentmonth?t.m(this.currentmonth):null}
250
- .today=${this.today}
251
- @date-selected=${e=>{this.value=O.processDateSelection(e.detail,this.multiple,this.range),this._value=e.detail,O.updateInputValues(this.inputRef,this.inputRefTo,this._value,this.range,this.multiple,e=>this.manageValidity(e))}}
252
- @close=${()=>{this.onBlur(),this.hideCalendar()}}
253
- ${r.n(this.datepickerPopupRef)}
254
- ></pkt-datepicker-popup>
255
- `}render(){return this.inputClasses=D.getInputClasses(this.fullwidth,this.showRangeLabels,this.multiple,this.range,this.readonly,this.inputType,this.inputSize),e._`
256
- <pkt-input-wrapper
257
- ${c.n(this,[`helptext`])}
258
- .strings=${this.strings}
259
- label="${this.label}"
260
- forId="${this.id}-input"
261
- ?counter=${this.multiple&&!!this.maxlength}
262
- .counterCurrent=${this.value?this._value.length:0}
263
- .counterMaxLength=${this.maxlength}
264
- ?disabled=${this.isDisabled}
265
- ?hasError=${this.hasError}
266
- ?hasFieldset=${this.effectiveHasFieldset(!1)}
267
- ?inline=${this.inline}
268
- ?required=${this.required}
269
- ?optionalTag=${this.optionalTag}
270
- ?requiredTag=${this.requiredTag}
271
- useWrapper=${this.useWrapper}
272
- .optionalText=${this.optionalText}
273
- .requiredText=${this.requiredText}
274
- .tagText=${this.tagText}
275
- .errorMessage=${this.errorMessage}
276
- .helptext=${this.helptext}
277
- .helptextDropdown=${this.helptextDropdown}
278
- .helptextDropdownButton=${this.helptextDropdownButton}
279
- .ariaDescribedby=${this.ariaDescribedby}
280
- .size=${this.inputSize}
281
- >
282
- ${this.multiple?e._`<pkt-date-tags
283
- .dates=${this._value}
284
- dateformat=${this.dateformat}
285
- strings=${this.strings}
286
- id-base=${this.id}
287
- @date-tag-removed=${e=>{let n=this.datepickerPopupRef.value,r=t.s(e.detail);n&&r&&typeof n.handleDateSelect==`function`?n.handleDateSelect(r):this.calRef.value?.handleDateSelect(r)}}
288
- ></pkt-date-tags>`:e.h}
289
- <div class="pkt-datepicker__inputs ${this.range?`pkt-input__range-inputs`:``}">
290
- ${this.range?this.renderRangeInput():this.multiple?this.renderMultipleInput():this.renderInput()}
291
- </div>
292
- </pkt-input-wrapper>
293
- ${this.renderCalendar()}
294
- `}handleCalendarPosition(){let e=this.multiple&&!!this.maxlength;E.handleCalendarPosition(this.popupRef,this.inputRef,e)}async showCalendar(){let e=this.datepickerPopupRef.value;this.calendarOpen=!0,e&&typeof e.show==`function`?(e.show(),d()&&e.focusOnCurrentDate()):(await o.t(20),this.handleCalendarPosition(),d()&&this.calRef.value?.focusOnCurrentDate())}hideCalendar(){let e=this.datepickerPopupRef.value;if(this.calendarOpen=!1,e&&typeof e.hide==`function`)return e.hide()}async toggleCalendar(e){e.preventDefault();let t=this.datepickerPopupRef.value;if(t&&typeof t.toggle==`function`){let e=!!t.open;t.toggle(),this.calendarOpen=!e}else this.calendarOpen?this.hideCalendar():this.showCalendar()}clearInputValue(){this._value=[],this.value=``,this.setFormValue(this.value),this.dispatchEvent(new Event(`change`,{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`value-change`,{detail:this._value,bubbles:!0,composed:!0}))}};F=I,F.DERIVED_FROM=[`value`,`multiple`,`range`,`min`,`max`,`excludedates`,`excludeweekdays`],e.n([e.u({type:String,reflect:!0})],I.prototype,`value`,null),e.n([e.l()],I.prototype,`_value`,void 0),e.n([e.u({type:String,reflect:!0})],I.prototype,`label`,void 0),e.n([e.u({type:String})],I.prototype,`dateformat`,void 0),e.n([e.u({type:Boolean,reflect:!0})],I.prototype,`multiple`,void 0),e.n([e.u({type:Number,reflect:!0})],I.prototype,`maxlength`,void 0),e.n([e.u({type:Boolean,reflect:!0})],I.prototype,`range`,void 0),e.n([e.u({type:Boolean,attribute:`show-range-labels`})],I.prototype,`showRangeLabels`,void 0),e.n([e.u({type:String,reflect:!0})],I.prototype,`min`,void 0),e.n([e.u({type:String,reflect:!0})],I.prototype,`max`,void 0),e.n([e.u({type:Boolean})],I.prototype,`weeknumbers`,void 0),e.n([e.u({type:Boolean,reflect:!0})],I.prototype,`withcontrols`,void 0),e.n([e.u({converter:t.t.csvToArray})],I.prototype,`excludedates`,void 0),e.n([e.u({converter:t.t.csvToArray})],I.prototype,`excludeweekdays`,void 0),e.n([e.u({type:String})],I.prototype,`currentmonth`,void 0),e.n([e.u({type:String})],I.prototype,`today`,void 0),e.n([e.u({type:Boolean,reflect:!0,attribute:`calendar-open`})],I.prototype,`calendarOpen`,void 0),e.n([e.u({type:String})],I.prototype,`timezone`,void 0),e.n([e.l()],I.prototype,`inputClasses`,void 0);try{e.d(`pkt-datepicker`)(I)}catch{console.warn(`Forsøker å definere <pkt-datepicker>, men den er allerede definert`)}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return I}});
@@ -1 +0,0 @@
1
- var e=()=>(`00000000000000000`+(Math.random()*0x10000000000000000).toString(16)).slice(-16),t=e=>new Promise(t=>setTimeout(t,e)),n=()=>{let t=e(),n=e();return t.slice(0,8)+`-`+t.slice(8,12)+`-4`+t.slice(13)+`-a`+n.slice(1,4)+`-`+n.slice(4)};Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});