@oslokommune/punkt-elements 19.14.3 → 19.15.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 (73) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/calendar-5XCeDtZX.cjs +85 -0
  3. package/dist/{calendar-D9w8M99G.js → calendar-CtWc545R.js} +45 -60
  4. package/dist/{checkbox-group-adbFTj8y.cjs → checkbox-group-BLurd7sf.cjs} +1 -1
  5. package/dist/{checkbox-group-C8mo9dkO.js → checkbox-group-Bum7k828.js} +1 -1
  6. package/dist/{combobox-jsPpImVF.cjs → combobox-BsXDULXd.cjs} +1 -1
  7. package/dist/{combobox-B8IeuEF0.js → combobox-C7tUHbG4.js} +1 -1
  8. package/dist/components/modal/modal.d.ts +7 -0
  9. package/dist/components/modal/modal.test.d.ts +9 -0
  10. package/dist/{datepicker-CjUY_mLR.js → datepicker-CJLcIDVk.js} +2 -2
  11. package/dist/{datepicker-CZYpIyJd.cjs → datepicker-DmZi4CNk.cjs} +1 -1
  12. package/dist/docs/components/modal.d.ts +2 -0
  13. package/dist/{fileupload-CyLRyoVU.cjs → fileupload-A_suUEPU.cjs} +1 -1
  14. package/dist/{fileupload-BmfFC748.js → fileupload-DehKWas6.js} +2 -2
  15. package/dist/{header-BCrefip0.cjs → header-BzAPmAsZ.cjs} +1 -1
  16. package/dist/{header-20rqKJFb.js → header-C6xhv3Ib.js} +1 -1
  17. package/dist/{input-wrapper-BwzajfFX.cjs → input-wrapper-BEmV0DGo.cjs} +2 -3
  18. package/dist/{input-wrapper-Bb6CZxmg.js → input-wrapper-xRJo_iVf.js} +2 -3
  19. package/dist/{modal-B3CQEBBB.js → modal-0D0paY70.js} +42 -23
  20. package/dist/modal-wEEmCcUx.cjs +39 -0
  21. package/dist/{option-group-element-CzehfgVZ.cjs → option-group-element-A2cOZRWA.cjs} +1 -1
  22. package/dist/{option-group-element-D5PgGNdt.js → option-group-element-fpMneBWa.js} +1 -1
  23. package/dist/pkt-calendar.cjs +1 -1
  24. package/dist/pkt-calendar.js +1 -1
  25. package/dist/pkt-checkbox-group.cjs +1 -1
  26. package/dist/pkt-checkbox-group.js +1 -1
  27. package/dist/pkt-combobox.cjs +1 -1
  28. package/dist/pkt-combobox.js +1 -1
  29. package/dist/pkt-datepicker.cjs +1 -1
  30. package/dist/pkt-datepicker.js +1 -1
  31. package/dist/pkt-fileupload.cjs +1 -1
  32. package/dist/pkt-fileupload.js +1 -1
  33. package/dist/pkt-header.cjs +1 -1
  34. package/dist/pkt-header.js +1 -1
  35. package/dist/pkt-index.cjs +1 -1
  36. package/dist/pkt-index.js +13 -13
  37. package/dist/pkt-input-wrapper.cjs +1 -1
  38. package/dist/pkt-input-wrapper.js +1 -1
  39. package/dist/pkt-modal.cjs +1 -1
  40. package/dist/pkt-modal.js +1 -1
  41. package/dist/pkt-radio-group.cjs +1 -1
  42. package/dist/pkt-radio-group.js +1 -1
  43. package/dist/pkt-select.cjs +1 -1
  44. package/dist/pkt-select.js +1 -1
  45. package/dist/pkt-textarea.cjs +1 -1
  46. package/dist/pkt-textarea.js +1 -1
  47. package/dist/pkt-textinput.cjs +1 -1
  48. package/dist/pkt-textinput.js +1 -1
  49. package/dist/pkt-timepicker.cjs +1 -1
  50. package/dist/pkt-timepicker.js +1 -1
  51. package/dist/{radio-group-CtZhXMF8.js → radio-group-BmJ3kcba.js} +1 -1
  52. package/dist/{radio-group-MxNLGu-0.cjs → radio-group-Q75EtJzu.cjs} +1 -1
  53. package/dist/{select-Bs-Z5Thd.js → select-ByPSk9WT.js} +1 -1
  54. package/dist/{select-Czz1y2nI.cjs → select-CCY2_EbI.cjs} +1 -1
  55. package/dist/shared-types/calendar.d.ts +0 -1
  56. package/dist/shared-utils/calendar/calendar-grid.d.ts +0 -4
  57. package/dist/shared-utils/calendar/index.d.ts +1 -1
  58. package/dist/{textarea-C-sdNBRk.cjs → textarea-D9RWiR6u.cjs} +1 -1
  59. package/dist/{textarea-COHaMHpP.js → textarea-DB7FMtTf.js} +1 -1
  60. package/dist/{textinput-0DZeMqBr.js → textinput-Djl_yr1D.js} +1 -1
  61. package/dist/{textinput-BqBgsBZF.cjs → textinput-l31MdBd4.cjs} +1 -1
  62. package/dist/{timepicker-C_k-K1jA.cjs → timepicker-Bw8zkwV9.cjs} +1 -1
  63. package/dist/{timepicker-CvdI7jDN.js → timepicker-D_gNCZ2v.js} +1 -1
  64. package/package.json +2 -2
  65. package/src/components/calendar/calendar.constraints.test.ts +15 -0
  66. package/src/components/calendar/calendar.core.test.ts +15 -0
  67. package/src/components/calendar/calendar.ts +7 -15
  68. package/src/components/input-wrapper/input-wrapper.test.ts +1 -0
  69. package/src/components/input-wrapper/input-wrapper.ts +2 -2
  70. package/src/components/modal/modal.test.ts +141 -0
  71. package/src/components/modal/modal.ts +24 -5
  72. package/dist/calendar-C5QwPrbk.cjs +0 -91
  73. package/dist/modal-BKeSXrzi.cjs +0 -35
package/CHANGELOG.md CHANGED
@@ -5,6 +5,44 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
5
5
 
6
6
  ---
7
7
 
8
+ ## [19.15.3](https://github.com/oslokommune/punkt/compare/19.15.2...19.15.3) (2026-10-19)
9
+
10
+ ### Bug Fixes
11
+ * Kalenderen viser ikke lenger datoer fra forrige og neste måned (#3064) (#3759). Datoene før og etter måneden var synlige, men kunne ikke velges, og musepekeren sa "ikke tillatt". Det så ut som datoene var sperret. Nå er de cellene tomme.
12
+
13
+ - Tomme celler i stedet for grå datoer fra måneden før og etter
14
+ - Vanlig musepeker over de tomme cellene. Datoer som faktisk ikke kan velges har fortsatt "ikke tillatt"
15
+ - Gjelder både React og Elements, også kalenderen i datepicker
16
+
17
+ **Bonusfikser i Elements**
18
+ - Skjermlesere får nå vite at kalenderen tillater flere datoer eller periode
19
+ - Tegntelleren i skjemafelt viser "0/100" som i React, ikke "0 /100"
20
+ - Månedsknappene og årfeltet i kalenderen har samme markup som i React
21
+
22
+ **Testing**
23
+ - Ny konformitetstest som sammenligner kalenderen i React og Elements
24
+ - Konformitetstestene fanger nå mellomrom som Lit tidligere skjulte
25
+
26
+ closes #3064
27
+
28
+ ---
29
+
30
+
31
+ ## [19.15.0](https://github.com/oslokommune/punkt/compare/19.14.3...19.15.0) (2026-10-16)
32
+
33
+ ### Features
34
+ * Modal får mulighet for ikon i overskriften (#3719) (#3738). Ny prop headingIconName legger et ikon foran overskriften. Ikonet
35
+ skalerer med overskriften. headingIconPath overstyrer hvor ikonet hentes
36
+ fra.
37
+
38
+ Bug funnet underveis: med flere modaler på samme side leste skjermlesere
39
+ opp overskriften fra feil modal. Hver modal får nå sine egne id-er.
40
+
41
+ closes #3719
42
+
43
+ ---
44
+
45
+
8
46
  ## [19.14.3](https://github.com/oslokommune/punkt/compare/19.14.2...19.14.3) (2026-10-16)
9
47
 
10
48
  ### Bug Fixes
@@ -0,0 +1,85 @@
1
+ const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs");require("./icon-jPhyZD1z.cjs");const n=require("./converters-BJ9Fe0kW.cjs");var r={multiple:!1,maxMultiple:0,range:!1,earliest:null,latest:null,weeknumbers:!1,withcontrols:!1};function i(e,t,r){let i=n.y(e,r?.in);return isNaN(t)?n.b(r?.in||e,NaN):(t&&i.setDate(i.getDate()+t),i)}function a(e,t){let[r,i]=n.v(e,t.start,t.end);return{start:r,end:i}}function o(e,t){let{start:r,end:i}=a(t?.in,e),o=+r>+i,s=o?+r:+i,c=o?i:r;c.setHours(0,0,0,0);let l=t?.step??1;if(!l)return[];l<0&&(l=-l,o=!o);let u=[];for(;+c<=s;)u.push(n.b(r,c)),c.setDate(c.getDate()+l),c.setHours(0,0,0,0);return o?u.reverse():u}function s(e,t){let r=n.y(e,t?.in).getDay();return r===0?7:r}function c(e,t){let r=(t.excludedates??[]).map(e=>typeof e==`string`?e:n.a(e));return!n.l(e,t.earliest,t.latest,r,t.excludeweekdays??[])}function l(e,t,n,r){return!!(c(e,n)||!t&&r.multiple&&r.maxMultiple>0&&r.selectedCount>=r.maxMultiple)}function u(e,t,r){let i=n.p(e,t,0);return!(r&&n.d(r)>i)}function d(e,t,r){let i=n.p(t===11?e+1:e,t===11?0:t+1,1);return!(r&&n.d(r)<i)}function f(e,t){let r=n.p(e,t,1),i=n.p(e,t+1,0),a=(r.getDay()+6)%7,o=i.getDate();return{firstDayOfMonth:r,lastDayOfMonth:i,startingDay:a,numDays:o,numRows:Math.ceil((o+a)/7),initialWeek:n._(r)}}function p(e,t,n,r){let{startingDay:i,numDays:a}=r;return e===0&&t<i?`prev-month`:n>a?`next-month`:`current-month`}function m(e){return typeof e==`string`&&(e=e.split(`,`)),e.length===1&&e[0]===``?[]:e.map(e=>n.m(e))}function h(e,t){let r=o({start:e,end:t}),i={};if(Array.isArray(r)&&r.length)for(let a=0;a<r.length;a++){let o=r[a],s=o>e&&o<t;i[n.a(o)]=s}return i}function g(e,t,n,r){if(t.length!==1)return!0;let i=o({start:t[0],end:e});if(!Array.isArray(i)||!i.length)return!0;for(let a=0;a<i.length;a++){for(let r of n??[])if(r>t[0]&&r<e)return!1;if((r??[]).includes(s(i[a]).toString()))return!1}return!0}function _(e,t){let r=n.a(e);return t.includes(r)?t:[...t,r]}function v(e,t){let r=n.a(e),i=t.indexOf(r);if(i===-1)return t;if(t.length===1)return[];let a=[...t];return a.splice(i,1),a}function y(e,t,r){let i=n.a(e);return t.includes(i)?v(e,t):r>0&&t.length>=r?t:_(e,t)}function b(e,t,r){let i=n.a(e),a=m(t);return t.includes(i)?t.indexOf(i)===0?[]:v(e,t):t.length>1||t.length===1&&(!g(e,a,r.excludedates,r.excludeweekdays)||a[0]>e)?[i]:_(e,t)}var x={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7};function S(e){let t=e.nodeName;return t===`INPUT`||t===`SELECT`||t===`BUTTON`&&!e.dataset?.date}function C(e,t,r){let a=i(e,t);if(!a)return null;let o=r(`button[data-date="${n.a(a)}"]`);for(;o instanceof HTMLButtonElement&&o.dataset.disabled;)if(a=i(a,t),o=r(`button[data-date="${n.a(a)}"]`),!o)return null;return a}function w(e){return x[e]??null}var T=class extends e.t{constructor(...e){super(...e),this.selected=[],this.multiple=r.multiple,this.maxMultiple=r.maxMultiple,this.range=r.range,this.earliest=r.earliest,this.latest=r.latest,this.excludedates=[],this.excludeweekdays=[],this.weeknumbers=r.weeknumbers,this.withcontrols=r.withcontrols,this.currentmonth=null,this.today=null,this._selected=[],this.inRange={},this.rangeHovered=null,this.year=0,this.month=0,this.week=0,this.currentmonthtouched=!1,this.focusedDate=null,this.selectableDates=[],this.tabIndexSet=0}get calendarStrings(){let e=this.pktStrings.get(`dates`),t=this.pktStrings.get(`calendar`);return{daysShort:this.dayStrings??e.daysShort,days:this.dayStringsLong??e.days,months:this.monthStrings??e.months,week:this.weekString??e.week,prevMonth:this.prevMonthString??t.prevMonth,nextMonth:this.nextMonthString??t.nextMonth}}get todayDate(){return this.today?n.m(this.today):n.g()}firstUpdated(e){this.addEventListener(`keydown`,this.handleKeydown)}disconnectedCallback(){this.removeEventListener(`keydown`,this.handleKeydown),super.disconnectedCallback()}updated(e){super.updated(e),e.has(`selected`)&&this.convertSelected()}convertSelected(){typeof this.selected==`string`&&(this.selected=this.selected.split(`,`)),this.selected.length===1&&this.selected[0]===``&&(this.selected=[]),this._selected=m(this.selected),this.range&&this.selected.length===2&&(this.inRange=h(this._selected[0],this._selected[1])),this.setCurrentMonth()}setCurrentMonth(){if(this.currentmonth===null&&!this.currentmonthtouched&&(this.currentmonthtouched=!0),this.selected.length&&this.selected[0]!==``){let e=n.m(this.selected[this.selected.length-1]);this.currentmonth=isNaN(e.getTime())?n.f(this.todayDate):e}else this.currentmonth===null&&(this.currentmonth=n.f(this.todayDate));(!this.currentmonth||isNaN(this.currentmonth.getTime()))&&(this.currentmonth=n.f(this.todayDate)),this.year=this.currentmonth.getFullYear(),this.month=this.currentmonth.getMonth()}handleKeydown(e){let t=w(e.key);t!==null&&this.handleArrowKey(e,t)}handleArrowKey(e,t){let r=e.target;if(S(r))return;if(e.preventDefault(),!this.focusedDate){this.focusOnCurrentDate();return}let i=C(this.focusedDate?n.d(this.focusedDate):n.p(this.year,this.month,1),t,this.querySelector.bind(this));if(i){let e=this.querySelector(`button[data-date="${n.a(i)}"]`);e instanceof HTMLButtonElement&&!e.dataset.disabled&&(this.focusedDate=n.a(i),e.focus())}}render(){return e._`
2
+ <div
3
+ class="pkt-calendar ${this.weeknumbers?`pkt-cal-weeknumbers`:``}"
4
+ @focusout=${this.closeEvent}
5
+ @keydown=${e=>{e.key===`Escape`&&(e.preventDefault(),this.close())}}
6
+ >
7
+ <nav class="pkt-cal-month-nav">
8
+ ${this.renderMonthNavButton(`prev`)} ${this.renderMonthNav()}
9
+ ${this.renderMonthNavButton(`next`)}
10
+ </nav>
11
+ <table
12
+ class="pkt-cal-days pkt-txt-12-medium pkt-calendar__body"
13
+ role="grid"
14
+ aria-multiselectable=${this.range||this.multiple?`true`:e.h}
15
+ >
16
+ <thead>
17
+ ${this.renderDayNames()}
18
+ </thead>
19
+ <tbody>
20
+ ${this.renderCalendarBody()}
21
+ </tbody>
22
+ </table>
23
+ </div>
24
+ `}renderMonthNavButton(t){let n=t===`prev`,r=n?this.isPrevMonthAllowed():this.isNextMonthAllowed(),{prevMonth:i,nextMonth:a}=this.calendarStrings,o=n?i:a,s=n?`chevron-thin-left`:`chevron-thin-right`,c=n?`pkt-calendar__prev-month`:`pkt-calendar__next-month`,l=n?()=>this.prevMonth():()=>this.nextMonth();return e._`<div>
25
+ <button
26
+ type="button"
27
+ aria-label="${o}"
28
+ @click=${()=>r&&l()}
29
+ @keydown=${e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),r&&l())}}
30
+ class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only ${c} ${r?``:`pkt-invisible`}"
31
+ data-disabled=${r?e.h:`disabled`}
32
+ aria-disabled=${r?e.h:`true`}
33
+ tabindex=${r?`0`:`-1`}
34
+ >
35
+ <pkt-icon class="pkt-btn__icon" name="${s}"></pkt-icon>
36
+ <span class="pkt-btn__text">${o}</span>
37
+ </button>
38
+ </div>`}renderDayNames(){let t=[];this.weeknumbers&&t.push(e._`<th><div class="pkt-calendar__week-number">${this.calendarStrings.week}</div></th>`);let{days:n,daysShort:r}=this.calendarStrings;for(let i=0;i<r.length;i++)t.push(e._`<th>
39
+ <div class="pkt-calendar__day-name" aria-label="${n[i]}">${r[i]}</div>
40
+ </th>`);return e._`<tr class="pkt-cal-week-row">
41
+ ${t}
42
+ </tr>`}renderMonthNav(){let t=this.pktStrings.get(`dates`);return this.withcontrols?e._`<div class="pkt-cal-month-picker">
43
+ <label for="${this.id}-monthnav" class="pkt-hide">${t.month}</label>
44
+ <select
45
+ aria-label="${t.month}"
46
+ class="pkt-input pkt-input-compact"
47
+ id="${this.id}-monthnav"
48
+ @change=${e=>{e.stopImmediatePropagation();let t=e.target;this.changeMonth(this.year,parseInt(t.value))}}
49
+ >
50
+ ${this.calendarStrings.months.map((t,n)=>e._`<option value=${n} ?selected=${this.month===n}>${t}</option>`)}
51
+ </select>
52
+ <label for="${this.id}-yearnav" class="pkt-hide">${t.year}</label>
53
+ <input
54
+ aria-label="${t.year}"
55
+ class="pkt-input pkt-cal-input-year pkt-input-compact"
56
+ id="${this.id}-yearnav"
57
+ type="number"
58
+ size="4"
59
+ placeholder="0000"
60
+ @change=${e=>{e.stopImmediatePropagation();let t=e.target;this.changeMonth(parseInt(t.value),this.month)}}
61
+ value=${this.year}
62
+ .value=${this.year}
63
+ />
64
+ </div>`:e._`<div class="pkt-txt-16-medium pkt-calendar__month-title" aria-live="polite">
65
+ ${this.calendarStrings.months[this.month]} ${this.year}
66
+ </div>`}getDayViewData(e,t){let r=n.p(this.year,this.month,e),i=n.a(r),a=i===n.a(t),o=this.selected.includes(i),s=this.isDayDisabled(r,o),c=this.calculateTabIndex(i,s,e);return{currentDate:r,currentDateISO:i,isToday:a,isSelected:o,isDisabled:s,ariaLabel:n.o(r),tabindex:c}}getDateConstraints(){return{earliest:this.earliest,latest:this.latest,excludedates:this.excludedates,excludeweekdays:this.excludeweekdays}}isDayDisabled(e,t){return l(e,t,this.getDateConstraints(),{multiple:this.multiple,maxMultiple:this.maxMultiple,selectedCount:this.selected.length})}calculateTabIndex(e,t,n){return this.focusedDate?this.focusedDate===e&&!t?`0`:`-1`:!t&&this.tabIndexSet===0?(this.tabIndexSet=n,`0`):this.tabIndexSet===n?`0`:`-1`}getDayCellClasses(e){let{currentDateISO:t,isToday:r,isSelected:i}=e,a=this.range&&(this.selected.length===2||this.rangeHovered!==null)&&t===this.selected[0],o=this.range&&this.selected.length===2&&t===this.selected[1];return{"pkt-cal-today":r,"pkt-cal-selected":i,"pkt-cal-in-range":this.inRange[t],"pkt-cal-excluded":this.isExcluded(e.currentDate),"pkt-cal-in-range-first":a,"pkt-cal-in-range-last":o,"pkt-cal-range-hover":this.rangeHovered!==null&&t===n.a(this.rangeHovered)}}getDayButtonClasses(e){let{currentDateISO:t,isToday:r,isSelected:i,isDisabled:a}=e,o=this.range&&(this.selected.length===2||this.rangeHovered!==null)&&t===this.selected[0],s=this.range&&this.selected.length===2&&t===this.selected[1];return{"pkt-calendar__date":!0,"pkt-calendar__date--today":r,"pkt-calendar__date--selected":i,"pkt-calendar__date--disabled":a,"pkt-calendar__date--in-range":this.inRange[t],"pkt-calendar__date--in-range-hover":this.rangeHovered!==null&&t===n.a(this.rangeHovered),"pkt-calendar__date--range-start":o,"pkt-calendar__date--range-end":s}}handleDayFocus(e,t){this.range&&!this.isExcluded(e)&&this.handleRangeHover(e),this.focusedDate=t}renderDayView(n,r){let i=this.getDayViewData(n,r),{currentDate:a,currentDateISO:o,isSelected:s,isDisabled:c,ariaLabel:l,tabindex:u}=i;this.selectableDates.push({currentDateISO:o,isDisabled:c,tabindex:u});let d=this.getDayCellClasses(i),f=this.getDayButtonClasses(i);return e._`<td class=${t.t(d)}>
67
+ <button
68
+ type="button"
69
+ aria-pressed=${s?`true`:`false`}
70
+ ?disabled=${c}
71
+ class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only ${t.t(f)}"
72
+ @mouseover=${()=>this.range&&!this.isExcluded(a)&&this.handleRangeHover(a)}
73
+ @focus=${()=>this.handleDayFocus(a,o)}
74
+ aria-label="${l}"
75
+ tabindex=${u}
76
+ data-disabled=${c?`disabled`:e.h}
77
+ data-date=${o}
78
+ @keydown=${e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),this.handleDateSelect(a))}}
79
+ @click=${e=>{c||(e.preventDefault(),this.handleDateSelect(a))}}
80
+ >
81
+ <span class="pkt-btn__text pkt-txt-14-light">${n}</span>
82
+ </button>
83
+ </td>`}renderEmptyDayCell(){return e._`<td class="pkt-cal-other"></td>`}renderWeekRow(t){return e._`<tr class="pkt-cal-week-row" role="row">
84
+ ${t}
85
+ </tr>`}renderCalendarBody(){let t=this.todayDate,n=f(this.year,this.month);this.selectableDates=[],this.tabIndexSet=0;let r=1;this.week=n.initialWeek;let i=[];for(let a=0;a<n.numRows;a++){let o=[];this.weeknumbers&&o.push(e._`<td class="pkt-cal-week">${this.week}</td>`),this.week++;for(let e=0;e<7;e++){let i=p(a,e,r,n);i===`current-month`?(o.push(this.renderDayView(r,t)),r++):(o.push(this.renderEmptyDayCell()),i===`next-month`&&r++)}i.push(this.renderWeekRow(o))}return i}isExcluded(e){return c(e,this.getDateConstraints())}isPrevMonthAllowed(){return u(this.year,this.month,this.earliest)}prevMonth(){let e=this.month===0?11:this.month-1,t=this.month===0?this.year-1:this.year;this.changeMonth(t,e)}isNextMonthAllowed(){return d(this.year,this.month,this.latest)}nextMonth(){let e=this.month===11?0:this.month+1,t=this.month===11?this.year+1:this.year;this.changeMonth(t,e)}changeMonth(e,t){this.year=typeof e==`string`?parseInt(e):e,this.month=typeof t==`string`?parseInt(t):t,this.currentmonth=n.f(new Date(this.year,this.month,1)),this.tabIndexSet=0,this.focusedDate=null,this.selectableDates=[]}emptySelected(){this.selected=[],this._selected=[],this.inRange={}}normalizeSelected(){return typeof this.selected==`string`?this.selected.split(`,`):this.selected}addToSelected(e){this.selected=_(e,this.normalizeSelected()),this._selected=m(this.selected),this.range&&this.selected.length===2&&(this.convertSelected(),this.close())}removeFromSelected(e){this.selected=v(e,this.normalizeSelected()),this._selected=m(this.selected)}toggleSelected(e){this.selected=y(e,this.normalizeSelected(),this.maxMultiple),this._selected=m(this.selected)}isRangeAllowed(e){return g(e,this._selected,this.excludedates,this.excludeweekdays)}handleRangeSelect(e){return this.selected=b(e,this.normalizeSelected(),{excludedates:this.excludedates,excludeweekdays:this.excludeweekdays}),this._selected=m(this.selected),this.selected.length===2?(this.convertSelected(),this.close()):this.selected.length===1&&(this.inRange={}),Promise.resolve()}handleRangeHover(e){if(!this.range||this._selected.length!==1||!this.isRangeAllowed(e)||this._selected[0]>=e){this.rangeHovered=null;return}this.rangeHovered=e,this.inRange=h(this._selected[0],e)}handleDateSelect(e){return e?(this.range?this.handleRangeSelect(e):this.multiple?this.toggleSelected(e):(this.selected.includes(n.a(e))?this.emptySelected():(this.emptySelected(),this.addToSelected(e)),this.close()),this.dispatchEvent(new CustomEvent(`date-selected`,{detail:this.selected,bubbles:!0,composed:!0})),Promise.resolve()):Promise.resolve()}focusOnCurrentDate(){let e=n.a(n.f(this.todayDate)),t=this.querySelector(`button[data-date="${e}"]`);if(t instanceof HTMLButtonElement){this.focusedDate=e,t.focus();return}let r=this.selectableDates.find(e=>!e.isDisabled);if(r){let e=this.querySelector(`button[data-date="${r.currentDateISO}"]`);e instanceof HTMLButtonElement&&(this.focusedDate=r.currentDateISO,e.focus())}}closeEvent(e){let t=e.target,n=e.relatedTarget;this.contains(n)||t.classList.contains(`pkt-invisible`)||t.closest(`.pkt-cal-month-picker`)||this.close()}close(){this.dispatchEvent(new CustomEvent(`close`,{detail:!0,bubbles:!0,composed:!0}))}};e.n([e.u({converter:n.t.csvToArray})],T.prototype,`selected`,void 0),e.n([e.u({type:Boolean})],T.prototype,`multiple`,void 0),e.n([e.u({type:Number,attribute:`max-multiple`})],T.prototype,`maxMultiple`,void 0),e.n([e.u({type:Boolean})],T.prototype,`range`,void 0),e.n([e.u({type:String})],T.prototype,`earliest`,void 0),e.n([e.u({type:String})],T.prototype,`latest`,void 0),e.n([e.u({converter:n.t.stringsToDate})],T.prototype,`excludedates`,void 0),e.n([e.u({converter:n.t.csvToArray})],T.prototype,`excludeweekdays`,void 0),e.n([e.u({type:Boolean})],T.prototype,`weeknumbers`,void 0),e.n([e.u({type:Boolean})],T.prototype,`withcontrols`,void 0),e.n([e.u({converter:n.t.stringToDate})],T.prototype,`currentmonth`,void 0),e.n([e.u({type:String})],T.prototype,`today`,void 0),e.n([e.u({type:Array,attribute:`day-strings`})],T.prototype,`dayStrings`,void 0),e.n([e.u({type:Array,attribute:`day-strings-long`})],T.prototype,`dayStringsLong`,void 0),e.n([e.u({type:Array,attribute:`month-strings`})],T.prototype,`monthStrings`,void 0),e.n([e.u({type:String,attribute:`week-string`})],T.prototype,`weekString`,void 0),e.n([e.u({type:String,attribute:`prev-month-string`})],T.prototype,`prevMonthString`,void 0),e.n([e.u({type:String,attribute:`next-month-string`})],T.prototype,`nextMonthString`,void 0),e.n([e.u({type:Array})],T.prototype,`_selected`,void 0),e.n([e.l()],T.prototype,`inRange`,void 0),e.n([e.u({type:Date})],T.prototype,`rangeHovered`,void 0),e.n([e.u({type:Number})],T.prototype,`year`,void 0),e.n([e.u({type:Number})],T.prototype,`month`,void 0),e.n([e.u({type:Number})],T.prototype,`week`,void 0),e.n([e.l()],T.prototype,`currentmonthtouched`,void 0),e.n([e.l()],T.prototype,`focusedDate`,void 0);try{e.d(`pkt-calendar`)(T)}catch{console.warn(`Forsøker å definere <pkt-calendar>, men den er allerede definert`)}var E=T;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return E}});
@@ -70,7 +70,6 @@ function A(e, t) {
70
70
  startingDay: i,
71
71
  numDays: a,
72
72
  numRows: Math.ceil((a + i) / 7),
73
- numDaysPrevMonth: _(e, t, 0).getDate(),
74
73
  initialWeek: c(n)
75
74
  };
76
75
  }
@@ -78,16 +77,12 @@ function j(e, t, n, r) {
78
77
  let { startingDay: i, numDays: a } = r;
79
78
  return e === 0 && t < i ? "prev-month" : n > a ? "next-month" : "current-month";
80
79
  }
81
- function M(e, t, n, r) {
82
- let { startingDay: i, numDaysPrevMonth: a, numDays: o } = r;
83
- return e === "prev-month" ? a - (i - t - 1) : e === "next-month" ? n - o : n;
84
- }
85
80
  //#endregion
86
81
  //#region ../../shared-utils/calendar/selection-manager.ts
87
- function N(e) {
82
+ function M(e) {
88
83
  return typeof e == "string" && (e = e.split(",")), e.length === 1 && e[0] === "" ? [] : e.map((e) => h(e));
89
84
  }
90
- function P(e, t) {
85
+ function N(e, t) {
91
86
  let n = w({
92
87
  start: e,
93
88
  end: t
@@ -98,7 +93,7 @@ function P(e, t) {
98
93
  }
99
94
  return r;
100
95
  }
101
- function F(e, t, n, r) {
96
+ function P(e, t, n, r) {
102
97
  if (t.length !== 1) return !0;
103
98
  let i = w({
104
99
  start: t[0],
@@ -111,50 +106,50 @@ function F(e, t, n, r) {
111
106
  }
112
107
  return !0;
113
108
  }
114
- function I(e, t) {
109
+ function F(e, t) {
115
110
  let n = l(e);
116
111
  return t.includes(n) ? t : [...t, n];
117
112
  }
118
- function L(e, t) {
113
+ function I(e, t) {
119
114
  let n = l(e), r = t.indexOf(n);
120
115
  if (r === -1) return t;
121
116
  if (t.length === 1) return [];
122
117
  let i = [...t];
123
118
  return i.splice(r, 1), i;
124
119
  }
125
- function R(e, t, n) {
120
+ function L(e, t, n) {
126
121
  let r = l(e);
127
- return t.includes(r) ? L(e, t) : n > 0 && t.length >= n ? t : I(e, t);
122
+ return t.includes(r) ? I(e, t) : n > 0 && t.length >= n ? t : F(e, t);
128
123
  }
129
- function z(e, t, n) {
130
- let r = l(e), i = N(t);
131
- return t.includes(r) ? t.indexOf(r) === 0 ? [] : L(e, t) : t.length > 1 || t.length === 1 && (!F(e, i, n.excludedates, n.excludeweekdays) || i[0] > e) ? [r] : I(e, t);
124
+ function R(e, t, n) {
125
+ let r = l(e), i = M(t);
126
+ return t.includes(r) ? t.indexOf(r) === 0 ? [] : I(e, t) : t.length > 1 || t.length === 1 && (!P(e, i, n.excludedates, n.excludeweekdays) || i[0] > e) ? [r] : F(e, t);
132
127
  }
133
128
  //#endregion
134
129
  //#region ../../shared-utils/calendar/keyboard-navigation.ts
135
- var B = {
130
+ var z = {
136
131
  ArrowLeft: -1,
137
132
  ArrowRight: 1,
138
133
  ArrowUp: -7,
139
134
  ArrowDown: 7
140
135
  };
141
- function V(e) {
136
+ function B(e) {
142
137
  let t = e.nodeName;
143
138
  return t === "INPUT" || t === "SELECT" || t === "BUTTON" && !e.dataset?.date;
144
139
  }
145
- function H(e, t, n) {
140
+ function V(e, t, n) {
146
141
  let r = S(e, t);
147
142
  if (!r) return null;
148
143
  let i = n(`button[data-date="${l(r)}"]`);
149
144
  for (; i instanceof HTMLButtonElement && i.dataset.disabled;) if (r = S(r, t), i = n(`button[data-date="${l(r)}"]`), !i) return null;
150
145
  return r;
151
146
  }
152
- function U(e) {
153
- return B[e] ?? null;
147
+ function H(e) {
148
+ return z[e] ?? null;
154
149
  }
155
150
  //#endregion
156
151
  //#region src/components/calendar/calendar.ts
157
- var W = class extends a {
152
+ var U = class extends a {
158
153
  constructor(...e) {
159
154
  super(...e), this.selected = [], this.multiple = x.multiple, this.maxMultiple = x.maxMultiple, this.range = x.range, this.earliest = x.earliest, this.latest = x.latest, this.excludedates = [], this.excludeweekdays = [], this.weeknumbers = x.weeknumbers, this.withcontrols = x.withcontrols, this.currentmonth = null, this.today = null, this._selected = [], this.inRange = {}, this.rangeHovered = null, this.year = 0, this.month = 0, this.week = 0, this.currentmonthtouched = !1, this.focusedDate = null, this.selectableDates = [], this.tabIndexSet = 0;
160
155
  }
@@ -182,7 +177,7 @@ var W = class extends a {
182
177
  super.updated(e), e.has("selected") && this.convertSelected();
183
178
  }
184
179
  convertSelected() {
185
- typeof this.selected == "string" && (this.selected = this.selected.split(",")), this.selected.length === 1 && this.selected[0] === "" && (this.selected = []), this._selected = N(this.selected), this.range && this.selected.length === 2 && (this.inRange = P(this._selected[0], this._selected[1])), this.setCurrentMonth();
180
+ typeof this.selected == "string" && (this.selected = this.selected.split(",")), this.selected.length === 1 && this.selected[0] === "" && (this.selected = []), this._selected = M(this.selected), this.range && this.selected.length === 2 && (this.inRange = N(this._selected[0], this._selected[1])), this.setCurrentMonth();
186
181
  }
187
182
  setCurrentMonth() {
188
183
  if (this.currentmonth === null && !this.currentmonthtouched && (this.currentmonthtouched = !0), this.selected.length && this.selected[0] !== "") {
@@ -192,17 +187,17 @@ var W = class extends a {
192
187
  (!this.currentmonth || isNaN(this.currentmonth.getTime())) && (this.currentmonth = f(this.todayDate)), this.year = this.currentmonth.getFullYear(), this.month = this.currentmonth.getMonth();
193
188
  }
194
189
  handleKeydown(e) {
195
- let t = U(e.key);
190
+ let t = H(e.key);
196
191
  t !== null && this.handleArrowKey(e, t);
197
192
  }
198
193
  handleArrowKey(e, t) {
199
194
  let n = e.target;
200
- if (V(n)) return;
195
+ if (B(n)) return;
201
196
  if (e.preventDefault(), !this.focusedDate) {
202
197
  this.focusOnCurrentDate();
203
198
  return;
204
199
  }
205
- let r = H(this.focusedDate ? d(this.focusedDate) : _(this.year, this.month, 1), t, this.querySelector.bind(this));
200
+ let r = V(this.focusedDate ? d(this.focusedDate) : _(this.year, this.month, 1), t, this.querySelector.bind(this));
206
201
  if (r) {
207
202
  let e = this.querySelector(`button[data-date="${l(r)}"]`);
208
203
  e instanceof HTMLButtonElement && !e.dataset.disabled && (this.focusedDate = l(r), e.focus());
@@ -224,7 +219,7 @@ var W = class extends a {
224
219
  <table
225
220
  class="pkt-cal-days pkt-txt-12-medium pkt-calendar__body"
226
221
  role="grid"
227
- ?aria-multiselectable=${this.range || this.multiple}
222
+ aria-multiselectable=${this.range || this.multiple ? "true" : n}
228
223
  >
229
224
  <thead>
230
225
  ${this.renderDayNames()}
@@ -247,8 +242,8 @@ var W = class extends a {
247
242
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), i && u());
248
243
  }}
249
244
  class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only ${l} ${i ? "" : "pkt-invisible"}"
250
- .data-disabled=${i ? n : "disabled"}
251
- ?aria-disabled=${!i}
245
+ data-disabled=${i ? n : "disabled"}
246
+ aria-disabled=${i ? n : "true"}
252
247
  tabindex=${i ? "0" : "-1"}
253
248
  >
254
249
  <pkt-icon class="pkt-btn__icon" name="${c}"></pkt-icon>
@@ -296,6 +291,7 @@ var W = class extends a {
296
291
  let t = e.target;
297
292
  this.changeMonth(parseInt(t.value), this.month);
298
293
  }}
294
+ value=${this.year}
299
295
  .value=${this.year}
300
296
  />
301
297
  </div>` : e`<div class="pkt-txt-16-medium pkt-calendar__month-title" aria-live="polite">
@@ -391,15 +387,8 @@ var W = class extends a {
391
387
  </button>
392
388
  </td>`;
393
389
  }
394
- renderEmptyDayCell(t) {
395
- return e`<td class="pkt-cal-other">
396
- <div
397
- class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only"
398
- data-disabled="disabled"
399
- >
400
- <span class="pkt-btn__text pkt-txt-14-light">${t}</span>
401
- </div>
402
- </td>`;
390
+ renderEmptyDayCell() {
391
+ return e`<td class="pkt-cal-other"></td>`;
403
392
  }
404
393
  renderWeekRow(t) {
405
394
  return e`<tr class="pkt-cal-week-row" role="row">
@@ -417,11 +406,7 @@ var W = class extends a {
417
406
  this.weeknumbers && o.push(e`<td class="pkt-cal-week">${this.week}</td>`), this.week++;
418
407
  for (let e = 0; e < 7; e++) {
419
408
  let i = j(a, e, r, n);
420
- if (i === "current-month") o.push(this.renderDayView(r, t)), r++;
421
- else {
422
- let t = M(i, e, r, n);
423
- o.push(this.renderEmptyDayCell(t)), i === "next-month" && r++;
424
- }
409
+ i === "current-month" ? (o.push(this.renderDayView(r, t)), r++) : (o.push(this.renderEmptyDayCell()), i === "next-month" && r++);
425
410
  }
426
411
  i.push(this.renderWeekRow(o));
427
412
  }
@@ -454,29 +439,29 @@ var W = class extends a {
454
439
  return typeof this.selected == "string" ? this.selected.split(",") : this.selected;
455
440
  }
456
441
  addToSelected(e) {
457
- this.selected = I(e, this.normalizeSelected()), this._selected = N(this.selected), this.range && this.selected.length === 2 && (this.convertSelected(), this.close());
442
+ this.selected = F(e, this.normalizeSelected()), this._selected = M(this.selected), this.range && this.selected.length === 2 && (this.convertSelected(), this.close());
458
443
  }
459
444
  removeFromSelected(e) {
460
- this.selected = L(e, this.normalizeSelected()), this._selected = N(this.selected);
445
+ this.selected = I(e, this.normalizeSelected()), this._selected = M(this.selected);
461
446
  }
462
447
  toggleSelected(e) {
463
- this.selected = R(e, this.normalizeSelected(), this.maxMultiple), this._selected = N(this.selected);
448
+ this.selected = L(e, this.normalizeSelected(), this.maxMultiple), this._selected = M(this.selected);
464
449
  }
465
450
  isRangeAllowed(e) {
466
- return F(e, this._selected, this.excludedates, this.excludeweekdays);
451
+ return P(e, this._selected, this.excludedates, this.excludeweekdays);
467
452
  }
468
453
  handleRangeSelect(e) {
469
- return this.selected = z(e, this.normalizeSelected(), {
454
+ return this.selected = R(e, this.normalizeSelected(), {
470
455
  excludedates: this.excludedates,
471
456
  excludeweekdays: this.excludeweekdays
472
- }), this._selected = N(this.selected), this.selected.length === 2 ? (this.convertSelected(), this.close()) : this.selected.length === 1 && (this.inRange = {}), Promise.resolve();
457
+ }), this._selected = M(this.selected), this.selected.length === 2 ? (this.convertSelected(), this.close()) : this.selected.length === 1 && (this.inRange = {}), Promise.resolve();
473
458
  }
474
459
  handleRangeHover(e) {
475
460
  if (!this.range || this._selected.length !== 1 || !this.isRangeAllowed(e) || this._selected[0] >= e) {
476
461
  this.rangeHovered = null;
477
462
  return;
478
463
  }
479
- this.rangeHovered = e, this.inRange = P(this._selected[0], e);
464
+ this.rangeHovered = e, this.inRange = N(this._selected[0], e);
480
465
  }
481
466
  handleDateSelect(e) {
482
467
  return e ? (this.range ? this.handleRangeSelect(e) : this.multiple ? this.toggleSelected(e) : (this.selected.includes(l(e)) ? this.emptySelected() : (this.emptySelected(), this.addToSelected(e)), this.close()), this.dispatchEvent(new CustomEvent("date-selected", {
@@ -509,35 +494,35 @@ var W = class extends a {
509
494
  }));
510
495
  }
511
496
  };
512
- i([o({ converter: v.csvToArray })], W.prototype, "selected", void 0), i([o({ type: Boolean })], W.prototype, "multiple", void 0), i([o({
497
+ i([o({ converter: v.csvToArray })], U.prototype, "selected", void 0), i([o({ type: Boolean })], U.prototype, "multiple", void 0), i([o({
513
498
  type: Number,
514
499
  attribute: "max-multiple"
515
- })], W.prototype, "maxMultiple", void 0), i([o({ type: Boolean })], W.prototype, "range", void 0), i([o({ type: String })], W.prototype, "earliest", void 0), i([o({ type: String })], W.prototype, "latest", void 0), i([o({ converter: v.stringsToDate })], W.prototype, "excludedates", void 0), i([o({ converter: v.csvToArray })], W.prototype, "excludeweekdays", void 0), i([o({ type: Boolean })], W.prototype, "weeknumbers", void 0), i([o({ type: Boolean })], W.prototype, "withcontrols", void 0), i([o({ converter: v.stringToDate })], W.prototype, "currentmonth", void 0), i([o({ type: String })], W.prototype, "today", void 0), i([o({
500
+ })], U.prototype, "maxMultiple", void 0), i([o({ type: Boolean })], U.prototype, "range", void 0), i([o({ type: String })], U.prototype, "earliest", void 0), i([o({ type: String })], U.prototype, "latest", void 0), i([o({ converter: v.stringsToDate })], U.prototype, "excludedates", void 0), i([o({ converter: v.csvToArray })], U.prototype, "excludeweekdays", void 0), i([o({ type: Boolean })], U.prototype, "weeknumbers", void 0), i([o({ type: Boolean })], U.prototype, "withcontrols", void 0), i([o({ converter: v.stringToDate })], U.prototype, "currentmonth", void 0), i([o({ type: String })], U.prototype, "today", void 0), i([o({
516
501
  type: Array,
517
502
  attribute: "day-strings"
518
- })], W.prototype, "dayStrings", void 0), i([o({
503
+ })], U.prototype, "dayStrings", void 0), i([o({
519
504
  type: Array,
520
505
  attribute: "day-strings-long"
521
- })], W.prototype, "dayStringsLong", void 0), i([o({
506
+ })], U.prototype, "dayStringsLong", void 0), i([o({
522
507
  type: Array,
523
508
  attribute: "month-strings"
524
- })], W.prototype, "monthStrings", void 0), i([o({
509
+ })], U.prototype, "monthStrings", void 0), i([o({
525
510
  type: String,
526
511
  attribute: "week-string"
527
- })], W.prototype, "weekString", void 0), i([o({
512
+ })], U.prototype, "weekString", void 0), i([o({
528
513
  type: String,
529
514
  attribute: "prev-month-string"
530
- })], W.prototype, "prevMonthString", void 0), i([o({
515
+ })], U.prototype, "prevMonthString", void 0), i([o({
531
516
  type: String,
532
517
  attribute: "next-month-string"
533
- })], W.prototype, "nextMonthString", void 0), i([o({ type: Array })], W.prototype, "_selected", void 0), i([r()], W.prototype, "inRange", void 0), i([o({ type: Date })], W.prototype, "rangeHovered", void 0), i([o({ type: Number })], W.prototype, "year", void 0), i([o({ type: Number })], W.prototype, "month", void 0), i([o({ type: Number })], W.prototype, "week", void 0), i([r()], W.prototype, "currentmonthtouched", void 0), i([r()], W.prototype, "focusedDate", void 0);
518
+ })], U.prototype, "nextMonthString", void 0), i([o({ type: Array })], U.prototype, "_selected", void 0), i([r()], U.prototype, "inRange", void 0), i([o({ type: Date })], U.prototype, "rangeHovered", void 0), i([o({ type: Number })], U.prototype, "year", void 0), i([o({ type: Number })], U.prototype, "month", void 0), i([o({ type: Number })], U.prototype, "week", void 0), i([r()], U.prototype, "currentmonthtouched", void 0), i([r()], U.prototype, "focusedDate", void 0);
534
519
  try {
535
- t("pkt-calendar")(W);
520
+ t("pkt-calendar")(U);
536
521
  } catch {
537
522
  console.warn("Forsøker å definere <pkt-calendar>, men den er allerede definert");
538
523
  }
539
524
  //#endregion
540
525
  //#region src/components/calendar/index.ts
541
- var G = W;
526
+ var W = U;
542
527
  //#endregion
543
- export { W as n, G as t };
528
+ export { U as n, W as t };
@@ -1 +1 @@
1
- const e=require("./element-C6WTyJFE.cjs"),t=require("./checkbox-BwI9QNSh.cjs"),n=require("./option-group-element-CzehfgVZ.cjs"),r=require("./provide-Cz18sYug.cjs");var i=class extends n.t{constructor(...e){super(...e),this.optionSelector=`pkt-checkbox`,this.groupContext={name:``,hasTile:!1,hasError:!1},this.storedValue=null,this.validityApplied=!1}get value(){return this.options().filter(e=>n.n(e)&&!n.r(e)).map(n.i)}set value(e){let t=this.value;this.storedValue=Array.isArray(e)?e:e?e.split(`,`):[],this.applyStoredValue(this.options()),this.requestUpdate(`value`,t)}get hasStoredValue(){return this.storedValue!==null}storeCurrentValue(){this.storedValue=this.value}applyStoredValue(e){e.forEach(e=>{let t=!!this.storedValue?.includes(n.i(e));n.n(e)!==t&&(e.checked=t)})}syncValidity(){if(!this.required&&!this.validityApplied)return;this.validityApplied=this.required;let e=this.options(),t=this.required&&!e.some(e=>n.n(e)&&!n.r(e))?this.pktStrings.get(`validation`).checkboxGroupValueMissing:``;e.forEach(e=>e.setGroupValidity?.(t))}};e.n([r.t({context:t.r}),e.l()],i.prototype,`groupContext`,void 0),e.n([e.u({type:String})],i.prototype,`value`,null);try{e.d(`pkt-checkbox-group`)(i)}catch{console.warn(`Forsøker å definere <pkt-checkbox-group>, men den er allerede definert`)}var a=i;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
1
+ const e=require("./element-C6WTyJFE.cjs"),t=require("./checkbox-BwI9QNSh.cjs"),n=require("./option-group-element-A2cOZRWA.cjs"),r=require("./provide-Cz18sYug.cjs");var i=class extends n.t{constructor(...e){super(...e),this.optionSelector=`pkt-checkbox`,this.groupContext={name:``,hasTile:!1,hasError:!1},this.storedValue=null,this.validityApplied=!1}get value(){return this.options().filter(e=>n.n(e)&&!n.r(e)).map(n.i)}set value(e){let t=this.value;this.storedValue=Array.isArray(e)?e:e?e.split(`,`):[],this.applyStoredValue(this.options()),this.requestUpdate(`value`,t)}get hasStoredValue(){return this.storedValue!==null}storeCurrentValue(){this.storedValue=this.value}applyStoredValue(e){e.forEach(e=>{let t=!!this.storedValue?.includes(n.i(e));n.n(e)!==t&&(e.checked=t)})}syncValidity(){if(!this.required&&!this.validityApplied)return;this.validityApplied=this.required;let e=this.options(),t=this.required&&!e.some(e=>n.n(e)&&!n.r(e))?this.pktStrings.get(`validation`).checkboxGroupValueMissing:``;e.forEach(e=>e.setGroupValidity?.(t))}};e.n([r.t({context:t.r}),e.l()],i.prototype,`groupContext`,void 0),e.n([e.u({type:String})],i.prototype,`value`,null);try{e.d(`pkt-checkbox-group`)(i)}catch{console.warn(`Forsøker å definere <pkt-checkbox-group>, men den er allerede definert`)}var a=i;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
@@ -1,6 +1,6 @@
1
1
  import { d as e, l as t, n, u as r } from "./element-DBugHPKM.js";
2
2
  import { r as i } from "./checkbox-BDwOYcNM.js";
3
- import { i as a, n as o, r as s, t as c } from "./option-group-element-D5PgGNdt.js";
3
+ import { i as a, n as o, r as s, t as c } from "./option-group-element-fpMneBWa.js";
4
4
  import { t as l } from "./provide-_MnlMGnw.js";
5
5
  //#region src/components/checkbox-group/checkbox-group.ts
6
6
  var u = class extends c {
@@ -1,4 +1,4 @@
1
- const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./format-B8meU8Tm.cjs"),r=require("./element-with-slot-CcJPCLgn.cjs");require("./icon-jPhyZD1z.cjs");const i=require("./if-defined-CiML3MTM.cjs"),a=require("./ref-CB7e9nMY.cjs");require("./tag-BMtnaJ1A.cjs");const o=require("./repeat-CnnigVcj.cjs"),s=require("./listbox-CvduK_YU.cjs"),c=require("./input-element-BjnKPikY.cjs"),l=require("./pkt-options-controller-139UsV4h.cjs"),u=require("./input-wrapper-BwzajfFX.cjs");var d={multiple:!1,typeahead:!1,includeSearch:!1,allowUserInput:!1,displayValueAs:`label`,inputSize:`medium`,disabled:!1,hasError:!1,required:!1,requiredTag:!1,optionalTag:!1,fullwidth:!1,inline:!1,useWrapper:!0},f=(e,t,n)=>{switch(e){case`,`:return n?`addValue`:null;case`Enter`:return`addValue`;case`Tab`:case`ArrowDown`:return t?null:`focusListbox`;case`Escape`:return`closeOptions`;default:return null}},p=(e,t,n,r,i)=>{if(!e)return{action:`none`,value:null};let a=s.i(n,e);return!t.includes(e)&&!a?r?{action:`addUserValue`,value:e}:i?{action:`none`,value:null}:{action:`removeValue`,value:t[0]}:a&&!t.includes(a.value)?{action:`selectOption`,value:a.value}:{action:`none`,value:null}},m=(e,t,n,r,i)=>e.trim().toLowerCase()?{...s.c(e,t,n,r),shouldRemoveValue:!1,shouldResetInput:!1}:{addValueText:null,userInfoMessage:``,shouldRemoveValue:!i&&!!t[0],shouldResetInput:!0},h=(e,t,n)=>{let r=s.i(t,e);return n===`label`&&r?.label?r.label:e},g={markOptionSelected(e,t){if(t){for(let n of e)if(n.value===t){n.selected=!0;break}}},markOptionDeselected(e,t){if(t){for(let n of e)if(n.value===t){n.selected=!1;break}}},markAllSelected(e){for(let t of e)t.selected=!0},markAllDeselected(e){for(let t of e)t.selected=!1},removeUserAddedOptions(e){return e.filter(e=>!e.userAdded)}},_={parseOptionsFromSlot(e){let t=[];return e.forEach(e=>{if(!e.textContent&&!e.getAttribute(`value`))return;let n={value:e.getAttribute(`value`)||e.textContent||``,label:e.textContent||e.getAttribute(`value`)||``};e.getAttribute(`data-prefix`)&&(n.prefix=e.getAttribute(`data-prefix`)||void 0),e.getAttribute(`tagskincolor`)&&(n.tagSkinColor=e.getAttribute(`tagskincolor`)),e.getAttribute(`description`)&&(n.description=e.getAttribute(`description`)||void 0),n.fulltext=s.r(n),t.push(n)}),t}},v={cloneOptions(e){return Array.isArray(e)?e.map(e=>({...e})):[]},syncOptionsWithValues(e,t){let n=[...t];return e.forEach(e=>{e.value&&!e.label&&(e.label=e.value),e.selected&&!n.includes(e.value)&&n.push(e.value),e.fulltext=s.r(e),e.selected=e.selected||n.includes(e.value)}),{options:e,newValues:n}},mergeWithUserAdded(e,t,n){return[...t.filter(e=>e?.userAdded&&n.includes(e.value)).filter(t=>!(Array.isArray(e)?e:[]).some(e=>e.value===t.value)),...e]}},y=class extends c.t{constructor(){super(),this.value=``,this.options=[],this.defaultOptions=[],this.allowUserInput=d.allowUserInput,this.typeahead=d.typeahead,this.includeSearch=d.includeSearch,this.searchPlaceholder=null,this.multiple=d.multiple,this.maxlength=null,this.displayValueAs=d.displayValueAs,this.tagPlacement=null,this.isOpen=!1,this._options=[],this._value=[],this._isOptionsOpen=!1,this._userInfoMessage=``,this._messageValue=null,this._addValueText=null,this._maxIsReached=!1,this._search=``,this._inputFocus=!1,this._skipInputTab=!1,this._optionsFromSlot=!1,this._lastSlotGeneration=0,this._suppressNextOpen=!1,this.inputRef=a.t(),this.triggerRef=a.t(),this.listboxRef=a.t(),this._pendingDispatchFrom=null,this.optionsController=new l.t(this)}get _hasTextInput(){return this.typeahead||this.allowUserInput}get _selectionDescription(){if(!(!this.multiple||this._value.length===0))return`${this._value.length} valgt`}focusTrigger(){this._hasTextInput?this.inputRef.value?.focus():this.triggerRef.value?.focus()}focusAfterCommit(){this._skipInputTab=!0;let e=this.inputRef.value;e&&e.type!==`hidden`&&e.setAttribute(`tabindex`,`-1`),this.triggerRef.value?.focus()}restoreInputTab(){this._skipInputTab=!1}parseValue(){return this.parseToValues(this.value)}parseToValues(e){return Array.isArray(e)?this.multiple?e:e.length>0?[e[0]]:[]:e&&this.multiple?e.split(`,`):e?[e]:[]}updateMaxReached(){this._maxIsReached=s.l(this._value.length,this.maxlength)}syncPublicValue(){let e=this.multiple?this._value.join(`,`):this._value[0]||``;e!==(Array.isArray(this.value)?this.value.join(`,`):String(this.value||``))&&(this.value=e)}dispatchValueChange(e){let t=this._value;if(e?.join(`,`)!==t.join(`,`)){let e=this.multiple?[...t]:t[0]||``;this.onChange(e)}else t.length===0&&e&&e.length>0&&this.clearInputValue()}onChange(e){this.touched=!0,super.onChange(e)}valueChanged(){}};e.n([e.u({type:String,reflect:!0})],y.prototype,`value`,void 0),e.n([e.u({type:Array})],y.prototype,`options`,void 0),e.n([e.u({type:Array,attribute:`default-options`})],y.prototype,`defaultOptions`,void 0),e.n([e.u({type:Boolean,attribute:`allow-user-input`})],y.prototype,`allowUserInput`,void 0),e.n([e.u({type:Boolean})],y.prototype,`typeahead`,void 0),e.n([e.u({type:Boolean,attribute:`include-search`})],y.prototype,`includeSearch`,void 0),e.n([e.u({type:String,attribute:`search-placeholder`})],y.prototype,`searchPlaceholder`,void 0),e.n([e.u({type:Boolean})],y.prototype,`multiple`,void 0),e.n([e.u({type:Number})],y.prototype,`maxlength`,void 0),e.n([e.u({type:String,attribute:`display-value-as`})],y.prototype,`displayValueAs`,void 0),e.n([e.u({type:String,attribute:`tag-placement`})],y.prototype,`tagPlacement`,void 0),e.n([e.u({type:Boolean,attribute:`open`})],y.prototype,`isOpen`,void 0),e.n([e.l()],y.prototype,`_options`,void 0),e.n([e.l()],y.prototype,`_value`,void 0),e.n([e.l()],y.prototype,`_isOptionsOpen`,void 0),e.n([e.l()],y.prototype,`_userInfoMessage`,void 0),e.n([e.l()],y.prototype,`_messageValue`,void 0),e.n([e.l()],y.prototype,`_addValueText`,void 0),e.n([e.l()],y.prototype,`_maxIsReached`,void 0),e.n([e.l()],y.prototype,`_search`,void 0),e.n([e.l()],y.prototype,`_inputFocus`,void 0),e.n([e.l()],y.prototype,`_skipInputTab`,void 0);var b=class extends y{toggleValue(e){if(this.isDisabled)return;this.touched=!0,this._userInfoMessage=``,this._addValueText=null;let t=s.i(this.options,e)?.value||null,n=this._value.includes(e||t||``),r=!!t,i=this._options.find(t=>t.value===e)?.disabled||!1,a=!e?.trim(),o=!this.multiple,c=this.multiple,l=s.l(this._value.length,this.maxlength),u=!1,d=!0,f=``,p=null,m=``;i||(!r&&this.allowUserInput&&!a?(this.addNewUserValue(e),f=`valueAdded`,u=c):!r&&!this.allowUserInput?(o&&this._value[0]&&this.removeValue(this._value[0]),d=!1,u=!0,f=`noResults`):n?(this.removeValue(t),u=!0,o&&this._hasTextInput&&this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(this.inputRef.value.value=``)):a&&o?(this.removeAllSelected(),u=!0):o?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(t),u=!1,f=`valueSelected`,p=this._hasTextInput?h(t||``,this.options,this.displayValueAs):s.s(s.i(this.options,t),this.displayValueAs)):c&&!l?(this.setSelected(t),u=!0):c&&l?(f=`maxSelected`,d=!1,m=e):(o&&this.removeAllSelected(),f=`noValidValue`,d=!1,u=!0,m=e),this._isOptionsOpen=u,u||window.setTimeout(()=>{this.focusAfterCommit()},0),this._search=m||``,this.resetComboboxInput(d),this._userInfoMessage=f,this._messageValue=p,c&&this.updateMaxReached())}setSelected(e){if(!this._value.includes(e)){if(this.multiple&&s.l(this._value.length,this.maxlength)){this._userInfoMessage=`maxSelected`;return}!this.multiple&&this.removeAllSelected(),this._value=e?[...this._value,e]:this._value,g.markOptionSelected(this._options,e),this.resetComboboxInput(!0)}}removeSelected(e){if(!e)return;this._value=this._value.filter(t=>t!==e);let t=s.i(this.options,e);t&&(g.markOptionDeselected(this.options,e),t.userAdded?(this._options=[...this._options.filter(t=>t.value!==e)],this.options=[...this.options.filter(t=>t.value!==e)]):this._options.some(t=>t.value===e)?this.refreshOptionsFromValue():this._options=[...this._options,t])}addAllOptions(){if(this.multiple){if(this.maxlength&&this._options.length>this.maxlength){this._userInfoMessage=`tooManySelected`;return}this._value=this._options.map(e=>e.value),g.markAllSelected(this._options),this.requestUpdate()}}removeAllSelected(){this._value=[],g.markAllDeselected(this._options),this._options=g.removeUserAddedOptions(this._options),this.requestUpdate()}addValue(){let e=this.inputRef.value?.value.trim()||``;if(this._search=e,e&&this._value.includes(e)){this.resetComboboxInput(!0),this._userInfoMessage=`alreadySelected`;return}this.toggleValue(e)}removeValue(e){this._value=this.multiple?this._value.filter(t=>t!==e):[],this.removeSelected(e)}addNewUserValue(e){if(!e||e.trim()===``)return;if(!this.multiple)this._value[0]&&this.removeSelected(this._value[0]),this._value=[e];else if(!s.i(this.options,e)){if(s.l(this._value.length,this.maxlength))return;this._value=[...this._value,e]}let t={value:e,label:e,userAdded:!0,selected:!0};this.options=[t,...this.options],this._options=[t,...this._options],this.resetComboboxInput(!0),this.multiple||(this._isOptionsOpen=!1,window.setTimeout(()=>{this.focusAfterCommit()},0)),this.requestUpdate()}refreshOptionsFromValue(){let e=v.cloneOptions(this.options);e.forEach(e=>e.selected=this._value.includes(e.value)),this._options=v.syncOptionsWithValues(e,this._value).options}resetComboboxInput(e=!0){this._addValueText=null,this.inputRef.value&&this.inputRef.value.type!==`hidden`&&e&&(this._search=``,this.multiple?this.inputRef.value.value=``:(this.inputRef.value.value=this._value[0]?h(this._value[0],this.options,this.displayValueAs):``,this._userInfoMessage=``)),this.refreshOptionsFromValue()}removeLastValue(e){if(this._value.length===0)return;e.preventDefault();let t=this._value[this._value.length-1];t&&this.removeSelected(t),this.updateMaxReached()}},x=class extends b{handleInput(e){if(e.stopPropagation(),e.stopImmediatePropagation(),this.isDisabled)return;this.touched=!0;let t=e.target;if(this._search=t.value,this.checkForMatches(),this.typeahead){if(this._search){let{filtered:n,suggestion:r}=s.o(this.options,this._search);this._options=n,e.inputType!==`deleteContentBackward`&&r?.label&&this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(t.value=r.label,window.setTimeout(()=>t.setSelectionRange(this._search.length,t.value.length),0),t.selectionDirection=`backward`)}else this.refreshOptionsFromValue()}}handleFocus(){if(!this.isDisabled){if(this._skipInputTab=!1,this._suppressNextOpen){this._suppressNextOpen=!1,this._inputFocus=!0,this.requestUpdate();return}!this.multiple&&this._value[0]&&this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(this.inputRef.value.value=h(this._value[0],this.options,this.displayValueAs)),this._inputFocus=!0,this._search=``,this.refreshOptionsFromValue(),this._isOptionsOpen=!0,this.onFocus(),this.requestUpdate()}}handleCloseOptions(){this._isOptionsOpen=!1,this._hasTextInput&&(this._suppressNextOpen=!0),this.focusTrigger()}handleFocusOut(e){if(this.isDisabled||!this._isOptionsOpen)return;let t=e.relatedTarget;t?.closest(`pkt-combobox`)?.id===this.id||e.target?.classList?.contains(`pkt-combobox__value`)||t===this.inputRef.value||t===this.triggerRef.value||this.closeAndProcessInput()}closeAndProcessInput(){if(this._inputFocus=!1,this._addValueText=null,this._userInfoMessage=``,this._search=``,this.inputRef.value&&this.inputRef.value.type!==`hidden`){let e=this.inputRef.value.value;if(!this.multiple){if(!e)this._value[0]&&this.removeSelected(this._value[0]);else{let t=s.i(this.options,e);t&&t.value!==this._value[0]?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(t.value)):!t&&this.allowUserInput&&(this._value[0]&&this.removeSelected(this._value[0]),this.addNewUserValue(e))}}else if(e!==``){let{action:t,value:n}=p(e,this._value,this.options,this.allowUserInput,this.multiple);switch(t){case`addUserValue`:this.addNewUserValue(n);break;case`selectOption`:this.setSelected(n);break;case`removeValue`:this.removeValue(n)}}!this.multiple&&this._value[0]?this.inputRef.value.value=h(this._value[0],this.options,this.displayValueAs):this.inputRef.value.value=``}this._isOptionsOpen=!1,this.onBlur()}handleBlur(){this._inputFocus=!1,this.onBlur()}handleInputClick(e){if(this.isDisabled){e.preventDefault(),e.stopImmediatePropagation();return}this._hasTextInput?(this.inputRef.value?.focus(),this.requestUpdate()):(e.stopImmediatePropagation(),e.preventDefault(),this._isOptionsOpen=!this._isOptionsOpen,this._isOptionsOpen&&this.listboxRef.value?.focusFirstOrSelectedOption())}handlePlaceholderClick(e){this.isDisabled||(e.stopPropagation(),this._hasTextInput&&this.inputRef.value?(this.inputRef.value.focus(),this._inputFocus=!0,this.requestUpdate()):(this._isOptionsOpen=!this._isOptionsOpen,this.requestUpdate()))}handleSelectOnlyKeydown(e){if(!this.isDisabled)switch(e.key){case`Enter`:case` `:case`ArrowDown`:case`ArrowUp`:e.preventDefault(),this._isOptionsOpen?this._isOptionsOpen=!1:(this._isOptionsOpen=!0,this.listboxRef.value?.focusFirstOrSelectedOption());break;case`Escape`:this._isOptionsOpen&&=(e.preventDefault(),!1);break;case`Home`:case`End`:e.preventDefault(),this._isOptionsOpen||=!0,this.listboxRef.value?.focusFirstOrSelectedOption();break;case`ArrowLeft`:this.multiple&&this._value.length>0&&(e.preventDefault(),this.focusTag(this._value.length-1));break;case`Backspace`:case`Delete`:this.multiple&&this._value.length>0&&(e.preventDefault(),this.removeSelected(this._value[this._value.length-1]))}}handleOptionToggled(e){this.toggleValue(e.detail)}handleSearch(e){e.stopPropagation(),this._search=e.detail.toLowerCase(),this.checkForMatches()}handleInputKeydown(e){if(e.key===`Backspace`){let t=!this.inputRef.value?.value;!this._search&&t&&this.multiple&&this._value.length>0&&this.removeLastValue(e);return}if(e.key===`ArrowLeft`&&this.multiple&&this._value.length>0){let t=this.inputRef.value;if(t&&t.selectionStart===0&&!t.value){e.preventDefault(),this.focusTag(this._value.length-1);return}}let t=f(e.key,e.shiftKey,this.multiple);if(t&&!(e.key===`Tab`&&!this._isOptionsOpen)){if(t===`focusListbox`&&e.key===`Tab`&&!this.listboxRef.value?.querySelector(`[role="option"]:not([data-disabled]), [data-type="new-option"]`)){this.closeAndProcessInput();return}switch(e.preventDefault(),t){case`addValue`:this.addValue();break;case`focusListbox`:this.listboxRef.value?.focusFirstOrSelectedOption();break;case`closeOptions`:this._isOptionsOpen=!1}}}handleTagRemove(e){this.removeSelected(e),this._hasTextInput&&this.inputRef.value&&(this._inputFocus=!0,this.inputRef.value.focus(),this.requestUpdate())}getInsideTags(){return Array.from(this.querySelectorAll(`.pkt-combobox__input .pkt-combobox__tag-list pkt-tag`))}focusTag(e){let t=this.getInsideTags();t.forEach((t,n)=>{t.buttonTabindex=n===e?0:-1}),(t[e]?.querySelector(`button`))?.focus()}resetTagTabindices(){this.getInsideTags().forEach(e=>{e.buttonTabindex=-1})}handleTagKeydown(e,t){e.stopPropagation();let n=()=>{this.resetTagTabindices(),this._hasTextInput&&this.inputRef.value?this.inputRef.value.focus():this.triggerRef.value?.focus()};switch(e.key){case`ArrowLeft`:e.preventDefault(),t>0&&this.focusTag(t-1);break;case`ArrowRight`:e.preventDefault(),t<this._value.length-1?this.focusTag(t+1):n();break;case`Backspace`:case`Delete`:e.preventDefault();{let e=this._value[t],r=t>=this._value.length-1?t-1:t;this.removeSelected(e),r>=0?(this.requestUpdate(),this.updateComplete.then(()=>this.focusTag(r))):n()}break;case`Tab`:this.resetTagTabindices();break;case`Escape`:e.preventDefault(),n()}}checkForMatches(){let e=m(this.inputRef.value?.value||this._search||``,this._value,this.options,this.allowUserInput,this.multiple);if(e.shouldRemoveValue&&this.removeValue(this._value[0]),e.shouldResetInput){this.resetComboboxInput(!1);return}this._addValueText=e.addValueText,this._userInfoMessage=e.userInfoMessage}},S=class extends x{constructor(...e){super(...e),this.handleBodyClick=e=>{this._isOptionsOpen&&!this.contains(e.target)&&this.closeAndProcessInput()}}connectedCallback(){if(super.connectedCallback(),document?.body.addEventListener(`click`,this.handleBodyClick),this._options=[],this.defaultOptions&&this.defaultOptions.length){let e=this.options?.filter(e=>e.userAdded)||[];this.options=[...e,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=v.cloneOptions(this.options)}if(this.optionsController?.nodes&&this.optionsController.nodes.length){let e=_.parseOptionsFromSlot(this.optionsController.nodes);e.length&&(this.options=[...e],this._options=[...e],this._optionsFromSlot=!0,this._lastSlotGeneration=this.optionsController.generation)}}disconnectedCallback(){super.disconnectedCallback(),document?.body.removeEventListener(`click`,this.handleBodyClick)}firstUpdated(e){this.defaultValue!==null&&!this.value&&(this.value=this.defaultValue),super.firstUpdated(e)}willUpdate(e){if(this._optionsFromSlot&&this.optionsController){let e=this.optionsController.generation;if(e!==this._lastSlotGeneration){this._lastSlotGeneration=e;let t=_.parseOptionsFromSlot(this.optionsController.nodes),n=this._options.filter(e=>e.userAdded);this.options=[...n,...t]}}if(super.willUpdate(e),e.has(`isOpen`)&&(this._isOptionsOpen=this.isOpen),e.has(`defaultOptions`)&&this.defaultOptions.length){let e=(Array.isArray(this.options)?this.options:[]).filter(e=>e.userAdded)||[];this.options=[...e,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=v.cloneOptions(this.options)}let t=e.has(`value`),n=e.has(`_value`);if(t){let e=[...this._value],t=this.parseValue();t.join(`,`)!==this._value.join(`,`)&&(this._value=t,this._options.forEach(e=>e.selected=t.includes(e.value)),this._options=[...this._options]),this._pendingDispatchFrom??=e}else n&&(this._pendingDispatchFrom??=e.get(`_value`)??[]);if(e.has(`defaultValue`)&&this.defaultValue!=null&&!this._value.length){let e=this.parseToValues(this.defaultValue);e.length&&(this._pendingDispatchFrom??=[...this._value],this._value=e,this._options.forEach(t=>t.selected=e.includes(t.value)),this._options=[...this._options])}if(e.has(`options`)){let t=e.get(`options`)||this._options||[],n=v.mergeWithUserAdded(v.cloneOptions(this.options),t,this._value);this._options=n,n.length>this.options.length&&(this.options=n);let r=v.syncOptionsWithValues(this._options,this._value);this._options=r.options,r.newValues.length>this._value.length&&(this._pendingDispatchFrom??=[...this._value],this._value=r.newValues)}(t||n||e.has(`options`)||e.has(`defaultValue`))&&this.updateMaxReached(),this._pendingDispatchFrom&&this.syncPublicValue()}updated(e){if(this._pendingDispatchFrom){let e=this._pendingDispatchFrom;this._pendingDispatchFrom=null,this.dispatchValueChange(e)}if(e.has(`_search`)&&this.dispatchEvent(new CustomEvent(`search`,{detail:this._search,bubbles:!1})),!this._isOptionsOpen&&this._hasTextInput&&this.inputRef.value&&this.inputRef.value.type!==`hidden`){let e=!this.multiple&&this._value[0]?h(this._value[0],this.options,this.displayValueAs):``;this.inputRef.value.value!==e&&(this.inputRef.value.value=e)}this.classList.add(`pkt-combobox-component`),this.classList.toggle(`pkt-combobox-component--fullwidth`,!!this.fullwidth),super.updated(e)}formResetCallback(){this.touched=!1;let e=this.defaultValue||(this.multiple,``);this.value=e,this._value=this.parseValue(),this._options=this._options.filter(e=>!e.userAdded).map(e=>({...e,selected:this._value.includes(e.value)})),this.options=this.options.filter(e=>!e.userAdded).map(e=>({...e,selected:this._value.includes(e.value)})),this._search=``,this._isOptionsOpen=!1,this._userInfoMessage=``,this._addValueText=null,this._inputFocus=!1,this.updateMaxReached(),this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(this.inputRef.value.value=``),this.setFormValue(``),this.internals.ariaInvalid=`false`,this.requestUpdate()}attributeChangedCallback(e,t,n){if(e===`options`){this._options=v.cloneOptions(this.options);let e=v.syncOptionsWithValues(this._options,this._value);this._options=e.options,e.newValues.length>this._value.length&&(this._value=e.newValues),this._search=``}super.attributeChangedCallback(e,t,n)}render(){return e._`
1
+ const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./format-B8meU8Tm.cjs"),r=require("./element-with-slot-CcJPCLgn.cjs");require("./icon-jPhyZD1z.cjs");const i=require("./if-defined-CiML3MTM.cjs"),a=require("./ref-CB7e9nMY.cjs");require("./tag-BMtnaJ1A.cjs");const o=require("./repeat-CnnigVcj.cjs"),s=require("./listbox-CvduK_YU.cjs"),c=require("./input-element-BjnKPikY.cjs"),l=require("./pkt-options-controller-139UsV4h.cjs"),u=require("./input-wrapper-BEmV0DGo.cjs");var d={multiple:!1,typeahead:!1,includeSearch:!1,allowUserInput:!1,displayValueAs:`label`,inputSize:`medium`,disabled:!1,hasError:!1,required:!1,requiredTag:!1,optionalTag:!1,fullwidth:!1,inline:!1,useWrapper:!0},f=(e,t,n)=>{switch(e){case`,`:return n?`addValue`:null;case`Enter`:return`addValue`;case`Tab`:case`ArrowDown`:return t?null:`focusListbox`;case`Escape`:return`closeOptions`;default:return null}},p=(e,t,n,r,i)=>{if(!e)return{action:`none`,value:null};let a=s.i(n,e);return!t.includes(e)&&!a?r?{action:`addUserValue`,value:e}:i?{action:`none`,value:null}:{action:`removeValue`,value:t[0]}:a&&!t.includes(a.value)?{action:`selectOption`,value:a.value}:{action:`none`,value:null}},m=(e,t,n,r,i)=>e.trim().toLowerCase()?{...s.c(e,t,n,r),shouldRemoveValue:!1,shouldResetInput:!1}:{addValueText:null,userInfoMessage:``,shouldRemoveValue:!i&&!!t[0],shouldResetInput:!0},h=(e,t,n)=>{let r=s.i(t,e);return n===`label`&&r?.label?r.label:e},g={markOptionSelected(e,t){if(t){for(let n of e)if(n.value===t){n.selected=!0;break}}},markOptionDeselected(e,t){if(t){for(let n of e)if(n.value===t){n.selected=!1;break}}},markAllSelected(e){for(let t of e)t.selected=!0},markAllDeselected(e){for(let t of e)t.selected=!1},removeUserAddedOptions(e){return e.filter(e=>!e.userAdded)}},_={parseOptionsFromSlot(e){let t=[];return e.forEach(e=>{if(!e.textContent&&!e.getAttribute(`value`))return;let n={value:e.getAttribute(`value`)||e.textContent||``,label:e.textContent||e.getAttribute(`value`)||``};e.getAttribute(`data-prefix`)&&(n.prefix=e.getAttribute(`data-prefix`)||void 0),e.getAttribute(`tagskincolor`)&&(n.tagSkinColor=e.getAttribute(`tagskincolor`)),e.getAttribute(`description`)&&(n.description=e.getAttribute(`description`)||void 0),n.fulltext=s.r(n),t.push(n)}),t}},v={cloneOptions(e){return Array.isArray(e)?e.map(e=>({...e})):[]},syncOptionsWithValues(e,t){let n=[...t];return e.forEach(e=>{e.value&&!e.label&&(e.label=e.value),e.selected&&!n.includes(e.value)&&n.push(e.value),e.fulltext=s.r(e),e.selected=e.selected||n.includes(e.value)}),{options:e,newValues:n}},mergeWithUserAdded(e,t,n){return[...t.filter(e=>e?.userAdded&&n.includes(e.value)).filter(t=>!(Array.isArray(e)?e:[]).some(e=>e.value===t.value)),...e]}},y=class extends c.t{constructor(){super(),this.value=``,this.options=[],this.defaultOptions=[],this.allowUserInput=d.allowUserInput,this.typeahead=d.typeahead,this.includeSearch=d.includeSearch,this.searchPlaceholder=null,this.multiple=d.multiple,this.maxlength=null,this.displayValueAs=d.displayValueAs,this.tagPlacement=null,this.isOpen=!1,this._options=[],this._value=[],this._isOptionsOpen=!1,this._userInfoMessage=``,this._messageValue=null,this._addValueText=null,this._maxIsReached=!1,this._search=``,this._inputFocus=!1,this._skipInputTab=!1,this._optionsFromSlot=!1,this._lastSlotGeneration=0,this._suppressNextOpen=!1,this.inputRef=a.t(),this.triggerRef=a.t(),this.listboxRef=a.t(),this._pendingDispatchFrom=null,this.optionsController=new l.t(this)}get _hasTextInput(){return this.typeahead||this.allowUserInput}get _selectionDescription(){if(!(!this.multiple||this._value.length===0))return`${this._value.length} valgt`}focusTrigger(){this._hasTextInput?this.inputRef.value?.focus():this.triggerRef.value?.focus()}focusAfterCommit(){this._skipInputTab=!0;let e=this.inputRef.value;e&&e.type!==`hidden`&&e.setAttribute(`tabindex`,`-1`),this.triggerRef.value?.focus()}restoreInputTab(){this._skipInputTab=!1}parseValue(){return this.parseToValues(this.value)}parseToValues(e){return Array.isArray(e)?this.multiple?e:e.length>0?[e[0]]:[]:e&&this.multiple?e.split(`,`):e?[e]:[]}updateMaxReached(){this._maxIsReached=s.l(this._value.length,this.maxlength)}syncPublicValue(){let e=this.multiple?this._value.join(`,`):this._value[0]||``;e!==(Array.isArray(this.value)?this.value.join(`,`):String(this.value||``))&&(this.value=e)}dispatchValueChange(e){let t=this._value;if(e?.join(`,`)!==t.join(`,`)){let e=this.multiple?[...t]:t[0]||``;this.onChange(e)}else t.length===0&&e&&e.length>0&&this.clearInputValue()}onChange(e){this.touched=!0,super.onChange(e)}valueChanged(){}};e.n([e.u({type:String,reflect:!0})],y.prototype,`value`,void 0),e.n([e.u({type:Array})],y.prototype,`options`,void 0),e.n([e.u({type:Array,attribute:`default-options`})],y.prototype,`defaultOptions`,void 0),e.n([e.u({type:Boolean,attribute:`allow-user-input`})],y.prototype,`allowUserInput`,void 0),e.n([e.u({type:Boolean})],y.prototype,`typeahead`,void 0),e.n([e.u({type:Boolean,attribute:`include-search`})],y.prototype,`includeSearch`,void 0),e.n([e.u({type:String,attribute:`search-placeholder`})],y.prototype,`searchPlaceholder`,void 0),e.n([e.u({type:Boolean})],y.prototype,`multiple`,void 0),e.n([e.u({type:Number})],y.prototype,`maxlength`,void 0),e.n([e.u({type:String,attribute:`display-value-as`})],y.prototype,`displayValueAs`,void 0),e.n([e.u({type:String,attribute:`tag-placement`})],y.prototype,`tagPlacement`,void 0),e.n([e.u({type:Boolean,attribute:`open`})],y.prototype,`isOpen`,void 0),e.n([e.l()],y.prototype,`_options`,void 0),e.n([e.l()],y.prototype,`_value`,void 0),e.n([e.l()],y.prototype,`_isOptionsOpen`,void 0),e.n([e.l()],y.prototype,`_userInfoMessage`,void 0),e.n([e.l()],y.prototype,`_messageValue`,void 0),e.n([e.l()],y.prototype,`_addValueText`,void 0),e.n([e.l()],y.prototype,`_maxIsReached`,void 0),e.n([e.l()],y.prototype,`_search`,void 0),e.n([e.l()],y.prototype,`_inputFocus`,void 0),e.n([e.l()],y.prototype,`_skipInputTab`,void 0);var b=class extends y{toggleValue(e){if(this.isDisabled)return;this.touched=!0,this._userInfoMessage=``,this._addValueText=null;let t=s.i(this.options,e)?.value||null,n=this._value.includes(e||t||``),r=!!t,i=this._options.find(t=>t.value===e)?.disabled||!1,a=!e?.trim(),o=!this.multiple,c=this.multiple,l=s.l(this._value.length,this.maxlength),u=!1,d=!0,f=``,p=null,m=``;i||(!r&&this.allowUserInput&&!a?(this.addNewUserValue(e),f=`valueAdded`,u=c):!r&&!this.allowUserInput?(o&&this._value[0]&&this.removeValue(this._value[0]),d=!1,u=!0,f=`noResults`):n?(this.removeValue(t),u=!0,o&&this._hasTextInput&&this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(this.inputRef.value.value=``)):a&&o?(this.removeAllSelected(),u=!0):o?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(t),u=!1,f=`valueSelected`,p=this._hasTextInput?h(t||``,this.options,this.displayValueAs):s.s(s.i(this.options,t),this.displayValueAs)):c&&!l?(this.setSelected(t),u=!0):c&&l?(f=`maxSelected`,d=!1,m=e):(o&&this.removeAllSelected(),f=`noValidValue`,d=!1,u=!0,m=e),this._isOptionsOpen=u,u||window.setTimeout(()=>{this.focusAfterCommit()},0),this._search=m||``,this.resetComboboxInput(d),this._userInfoMessage=f,this._messageValue=p,c&&this.updateMaxReached())}setSelected(e){if(!this._value.includes(e)){if(this.multiple&&s.l(this._value.length,this.maxlength)){this._userInfoMessage=`maxSelected`;return}!this.multiple&&this.removeAllSelected(),this._value=e?[...this._value,e]:this._value,g.markOptionSelected(this._options,e),this.resetComboboxInput(!0)}}removeSelected(e){if(!e)return;this._value=this._value.filter(t=>t!==e);let t=s.i(this.options,e);t&&(g.markOptionDeselected(this.options,e),t.userAdded?(this._options=[...this._options.filter(t=>t.value!==e)],this.options=[...this.options.filter(t=>t.value!==e)]):this._options.some(t=>t.value===e)?this.refreshOptionsFromValue():this._options=[...this._options,t])}addAllOptions(){if(this.multiple){if(this.maxlength&&this._options.length>this.maxlength){this._userInfoMessage=`tooManySelected`;return}this._value=this._options.map(e=>e.value),g.markAllSelected(this._options),this.requestUpdate()}}removeAllSelected(){this._value=[],g.markAllDeselected(this._options),this._options=g.removeUserAddedOptions(this._options),this.requestUpdate()}addValue(){let e=this.inputRef.value?.value.trim()||``;if(this._search=e,e&&this._value.includes(e)){this.resetComboboxInput(!0),this._userInfoMessage=`alreadySelected`;return}this.toggleValue(e)}removeValue(e){this._value=this.multiple?this._value.filter(t=>t!==e):[],this.removeSelected(e)}addNewUserValue(e){if(!e||e.trim()===``)return;if(!this.multiple)this._value[0]&&this.removeSelected(this._value[0]),this._value=[e];else if(!s.i(this.options,e)){if(s.l(this._value.length,this.maxlength))return;this._value=[...this._value,e]}let t={value:e,label:e,userAdded:!0,selected:!0};this.options=[t,...this.options],this._options=[t,...this._options],this.resetComboboxInput(!0),this.multiple||(this._isOptionsOpen=!1,window.setTimeout(()=>{this.focusAfterCommit()},0)),this.requestUpdate()}refreshOptionsFromValue(){let e=v.cloneOptions(this.options);e.forEach(e=>e.selected=this._value.includes(e.value)),this._options=v.syncOptionsWithValues(e,this._value).options}resetComboboxInput(e=!0){this._addValueText=null,this.inputRef.value&&this.inputRef.value.type!==`hidden`&&e&&(this._search=``,this.multiple?this.inputRef.value.value=``:(this.inputRef.value.value=this._value[0]?h(this._value[0],this.options,this.displayValueAs):``,this._userInfoMessage=``)),this.refreshOptionsFromValue()}removeLastValue(e){if(this._value.length===0)return;e.preventDefault();let t=this._value[this._value.length-1];t&&this.removeSelected(t),this.updateMaxReached()}},x=class extends b{handleInput(e){if(e.stopPropagation(),e.stopImmediatePropagation(),this.isDisabled)return;this.touched=!0;let t=e.target;if(this._search=t.value,this.checkForMatches(),this.typeahead){if(this._search){let{filtered:n,suggestion:r}=s.o(this.options,this._search);this._options=n,e.inputType!==`deleteContentBackward`&&r?.label&&this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(t.value=r.label,window.setTimeout(()=>t.setSelectionRange(this._search.length,t.value.length),0),t.selectionDirection=`backward`)}else this.refreshOptionsFromValue()}}handleFocus(){if(!this.isDisabled){if(this._skipInputTab=!1,this._suppressNextOpen){this._suppressNextOpen=!1,this._inputFocus=!0,this.requestUpdate();return}!this.multiple&&this._value[0]&&this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(this.inputRef.value.value=h(this._value[0],this.options,this.displayValueAs)),this._inputFocus=!0,this._search=``,this.refreshOptionsFromValue(),this._isOptionsOpen=!0,this.onFocus(),this.requestUpdate()}}handleCloseOptions(){this._isOptionsOpen=!1,this._hasTextInput&&(this._suppressNextOpen=!0),this.focusTrigger()}handleFocusOut(e){if(this.isDisabled||!this._isOptionsOpen)return;let t=e.relatedTarget;t?.closest(`pkt-combobox`)?.id===this.id||e.target?.classList?.contains(`pkt-combobox__value`)||t===this.inputRef.value||t===this.triggerRef.value||this.closeAndProcessInput()}closeAndProcessInput(){if(this._inputFocus=!1,this._addValueText=null,this._userInfoMessage=``,this._search=``,this.inputRef.value&&this.inputRef.value.type!==`hidden`){let e=this.inputRef.value.value;if(!this.multiple){if(!e)this._value[0]&&this.removeSelected(this._value[0]);else{let t=s.i(this.options,e);t&&t.value!==this._value[0]?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(t.value)):!t&&this.allowUserInput&&(this._value[0]&&this.removeSelected(this._value[0]),this.addNewUserValue(e))}}else if(e!==``){let{action:t,value:n}=p(e,this._value,this.options,this.allowUserInput,this.multiple);switch(t){case`addUserValue`:this.addNewUserValue(n);break;case`selectOption`:this.setSelected(n);break;case`removeValue`:this.removeValue(n)}}!this.multiple&&this._value[0]?this.inputRef.value.value=h(this._value[0],this.options,this.displayValueAs):this.inputRef.value.value=``}this._isOptionsOpen=!1,this.onBlur()}handleBlur(){this._inputFocus=!1,this.onBlur()}handleInputClick(e){if(this.isDisabled){e.preventDefault(),e.stopImmediatePropagation();return}this._hasTextInput?(this.inputRef.value?.focus(),this.requestUpdate()):(e.stopImmediatePropagation(),e.preventDefault(),this._isOptionsOpen=!this._isOptionsOpen,this._isOptionsOpen&&this.listboxRef.value?.focusFirstOrSelectedOption())}handlePlaceholderClick(e){this.isDisabled||(e.stopPropagation(),this._hasTextInput&&this.inputRef.value?(this.inputRef.value.focus(),this._inputFocus=!0,this.requestUpdate()):(this._isOptionsOpen=!this._isOptionsOpen,this.requestUpdate()))}handleSelectOnlyKeydown(e){if(!this.isDisabled)switch(e.key){case`Enter`:case` `:case`ArrowDown`:case`ArrowUp`:e.preventDefault(),this._isOptionsOpen?this._isOptionsOpen=!1:(this._isOptionsOpen=!0,this.listboxRef.value?.focusFirstOrSelectedOption());break;case`Escape`:this._isOptionsOpen&&=(e.preventDefault(),!1);break;case`Home`:case`End`:e.preventDefault(),this._isOptionsOpen||=!0,this.listboxRef.value?.focusFirstOrSelectedOption();break;case`ArrowLeft`:this.multiple&&this._value.length>0&&(e.preventDefault(),this.focusTag(this._value.length-1));break;case`Backspace`:case`Delete`:this.multiple&&this._value.length>0&&(e.preventDefault(),this.removeSelected(this._value[this._value.length-1]))}}handleOptionToggled(e){this.toggleValue(e.detail)}handleSearch(e){e.stopPropagation(),this._search=e.detail.toLowerCase(),this.checkForMatches()}handleInputKeydown(e){if(e.key===`Backspace`){let t=!this.inputRef.value?.value;!this._search&&t&&this.multiple&&this._value.length>0&&this.removeLastValue(e);return}if(e.key===`ArrowLeft`&&this.multiple&&this._value.length>0){let t=this.inputRef.value;if(t&&t.selectionStart===0&&!t.value){e.preventDefault(),this.focusTag(this._value.length-1);return}}let t=f(e.key,e.shiftKey,this.multiple);if(t&&!(e.key===`Tab`&&!this._isOptionsOpen)){if(t===`focusListbox`&&e.key===`Tab`&&!this.listboxRef.value?.querySelector(`[role="option"]:not([data-disabled]), [data-type="new-option"]`)){this.closeAndProcessInput();return}switch(e.preventDefault(),t){case`addValue`:this.addValue();break;case`focusListbox`:this.listboxRef.value?.focusFirstOrSelectedOption();break;case`closeOptions`:this._isOptionsOpen=!1}}}handleTagRemove(e){this.removeSelected(e),this._hasTextInput&&this.inputRef.value&&(this._inputFocus=!0,this.inputRef.value.focus(),this.requestUpdate())}getInsideTags(){return Array.from(this.querySelectorAll(`.pkt-combobox__input .pkt-combobox__tag-list pkt-tag`))}focusTag(e){let t=this.getInsideTags();t.forEach((t,n)=>{t.buttonTabindex=n===e?0:-1}),(t[e]?.querySelector(`button`))?.focus()}resetTagTabindices(){this.getInsideTags().forEach(e=>{e.buttonTabindex=-1})}handleTagKeydown(e,t){e.stopPropagation();let n=()=>{this.resetTagTabindices(),this._hasTextInput&&this.inputRef.value?this.inputRef.value.focus():this.triggerRef.value?.focus()};switch(e.key){case`ArrowLeft`:e.preventDefault(),t>0&&this.focusTag(t-1);break;case`ArrowRight`:e.preventDefault(),t<this._value.length-1?this.focusTag(t+1):n();break;case`Backspace`:case`Delete`:e.preventDefault();{let e=this._value[t],r=t>=this._value.length-1?t-1:t;this.removeSelected(e),r>=0?(this.requestUpdate(),this.updateComplete.then(()=>this.focusTag(r))):n()}break;case`Tab`:this.resetTagTabindices();break;case`Escape`:e.preventDefault(),n()}}checkForMatches(){let e=m(this.inputRef.value?.value||this._search||``,this._value,this.options,this.allowUserInput,this.multiple);if(e.shouldRemoveValue&&this.removeValue(this._value[0]),e.shouldResetInput){this.resetComboboxInput(!1);return}this._addValueText=e.addValueText,this._userInfoMessage=e.userInfoMessage}},S=class extends x{constructor(...e){super(...e),this.handleBodyClick=e=>{this._isOptionsOpen&&!this.contains(e.target)&&this.closeAndProcessInput()}}connectedCallback(){if(super.connectedCallback(),document?.body.addEventListener(`click`,this.handleBodyClick),this._options=[],this.defaultOptions&&this.defaultOptions.length){let e=this.options?.filter(e=>e.userAdded)||[];this.options=[...e,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=v.cloneOptions(this.options)}if(this.optionsController?.nodes&&this.optionsController.nodes.length){let e=_.parseOptionsFromSlot(this.optionsController.nodes);e.length&&(this.options=[...e],this._options=[...e],this._optionsFromSlot=!0,this._lastSlotGeneration=this.optionsController.generation)}}disconnectedCallback(){super.disconnectedCallback(),document?.body.removeEventListener(`click`,this.handleBodyClick)}firstUpdated(e){this.defaultValue!==null&&!this.value&&(this.value=this.defaultValue),super.firstUpdated(e)}willUpdate(e){if(this._optionsFromSlot&&this.optionsController){let e=this.optionsController.generation;if(e!==this._lastSlotGeneration){this._lastSlotGeneration=e;let t=_.parseOptionsFromSlot(this.optionsController.nodes),n=this._options.filter(e=>e.userAdded);this.options=[...n,...t]}}if(super.willUpdate(e),e.has(`isOpen`)&&(this._isOptionsOpen=this.isOpen),e.has(`defaultOptions`)&&this.defaultOptions.length){let e=(Array.isArray(this.options)?this.options:[]).filter(e=>e.userAdded)||[];this.options=[...e,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=v.cloneOptions(this.options)}let t=e.has(`value`),n=e.has(`_value`);if(t){let e=[...this._value],t=this.parseValue();t.join(`,`)!==this._value.join(`,`)&&(this._value=t,this._options.forEach(e=>e.selected=t.includes(e.value)),this._options=[...this._options]),this._pendingDispatchFrom??=e}else n&&(this._pendingDispatchFrom??=e.get(`_value`)??[]);if(e.has(`defaultValue`)&&this.defaultValue!=null&&!this._value.length){let e=this.parseToValues(this.defaultValue);e.length&&(this._pendingDispatchFrom??=[...this._value],this._value=e,this._options.forEach(t=>t.selected=e.includes(t.value)),this._options=[...this._options])}if(e.has(`options`)){let t=e.get(`options`)||this._options||[],n=v.mergeWithUserAdded(v.cloneOptions(this.options),t,this._value);this._options=n,n.length>this.options.length&&(this.options=n);let r=v.syncOptionsWithValues(this._options,this._value);this._options=r.options,r.newValues.length>this._value.length&&(this._pendingDispatchFrom??=[...this._value],this._value=r.newValues)}(t||n||e.has(`options`)||e.has(`defaultValue`))&&this.updateMaxReached(),this._pendingDispatchFrom&&this.syncPublicValue()}updated(e){if(this._pendingDispatchFrom){let e=this._pendingDispatchFrom;this._pendingDispatchFrom=null,this.dispatchValueChange(e)}if(e.has(`_search`)&&this.dispatchEvent(new CustomEvent(`search`,{detail:this._search,bubbles:!1})),!this._isOptionsOpen&&this._hasTextInput&&this.inputRef.value&&this.inputRef.value.type!==`hidden`){let e=!this.multiple&&this._value[0]?h(this._value[0],this.options,this.displayValueAs):``;this.inputRef.value.value!==e&&(this.inputRef.value.value=e)}this.classList.add(`pkt-combobox-component`),this.classList.toggle(`pkt-combobox-component--fullwidth`,!!this.fullwidth),super.updated(e)}formResetCallback(){this.touched=!1;let e=this.defaultValue||(this.multiple,``);this.value=e,this._value=this.parseValue(),this._options=this._options.filter(e=>!e.userAdded).map(e=>({...e,selected:this._value.includes(e.value)})),this.options=this.options.filter(e=>!e.userAdded).map(e=>({...e,selected:this._value.includes(e.value)})),this._search=``,this._isOptionsOpen=!1,this._userInfoMessage=``,this._addValueText=null,this._inputFocus=!1,this.updateMaxReached(),this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(this.inputRef.value.value=``),this.setFormValue(``),this.internals.ariaInvalid=`false`,this.requestUpdate()}attributeChangedCallback(e,t,n){if(e===`options`){this._options=v.cloneOptions(this.options);let e=v.syncOptionsWithValues(this._options,this._value);this._options=e.options,e.newValues.length>this._value.length&&(this._value=e.newValues),this._search=``}super.attributeChangedCallback(e,t,n)}render(){return e._`
2
2
  <pkt-input-wrapper
3
3
  ${r.n(this,[`helptext`])}
4
4
  .strings=${this.strings}
@@ -10,7 +10,7 @@ import { t as f } from "./repeat-CV9S4zya.js";
10
10
  import { a as p, c as m, i as h, l as g, o as _, r as v, s as y } from "./listbox-BDesthOp.js";
11
11
  import { t as b } from "./input-element-mTphzs9b.js";
12
12
  import { t as x } from "./pkt-options-controller-CHosj1Oo.js";
13
- import { r as S } from "./input-wrapper-Bb6CZxmg.js";
13
+ import { r as S } from "./input-wrapper-xRJo_iVf.js";
14
14
  //#region ../../shared-types/combobox.ts
15
15
  var C = {
16
16
  multiple: !1,
@@ -6,6 +6,8 @@ type ModalSize = TPktSize | 'fit-content';
6
6
  export interface IPktModal {
7
7
  open?: boolean;
8
8
  headingText?: string;
9
+ headingIconName?: string;
10
+ headingIconPath?: string;
9
11
  removePadding?: boolean;
10
12
  hideCloseButton?: boolean;
11
13
  closeOnBackdropClick?: boolean;
@@ -18,6 +20,8 @@ export interface IPktModal {
18
20
  export declare class PktModal extends PktElementWithSlot implements IPktModal {
19
21
  open?: boolean;
20
22
  headingText?: string;
23
+ headingIconName?: string;
24
+ headingIconPath?: string;
21
25
  removePadding?: boolean;
22
26
  hideCloseButton?: boolean;
23
27
  closeOnBackdropClick?: boolean;
@@ -28,6 +32,9 @@ export declare class PktModal extends PktElementWithSlot implements IPktModal {
28
32
  transparentBackdrop?: boolean;
29
33
  dialogRef: Ref<HTMLDialogElement>;
30
34
  private _scrollLockToken;
35
+ private readonly _idSuffix;
36
+ private readonly _headingId;
37
+ private readonly _contentId;
31
38
  _isOpen: boolean;
32
39
  constructor();
33
40
  connectedCallback(): Promise<void>;
@@ -0,0 +1,9 @@
1
+ import { BaseTestConfig } from '../../tests/test-framework';
2
+ import { IPktModal } from './modal';
3
+ export interface ModalTestConfig extends IPktModal, BaseTestConfig {
4
+ }
5
+ export declare const createModalTest: (config?: ModalTestConfig) => Promise<{
6
+ container: HTMLElement;
7
+ modal: import('./modal').PktModal;
8
+ heading: Element | null;
9
+ }>;
@@ -2,7 +2,7 @@ import { _ as e, d as t, h as n, l as r, n as i, s as a, t as o, u as s } from "
2
2
  import { t as c } from "./class-map-Bf-QzUpN.js";
3
3
  import { n as ee } from "./element-with-slot-CVmm0_IE.js";
4
4
  import "./icon-Bao96Zb8.js";
5
- import "./calendar-D9w8M99G.js";
5
+ import "./calendar-CtWc545R.js";
6
6
  import { t as l } from "./if-defined-O59_I-e-.js";
7
7
  import { n as u, t as d } from "./ref-y_5qv9vU.js";
8
8
  import { a as f, c as p, d as m, h, i as g, m as _, n as v, r as y, s as b, t as x, u as S } from "./converters-CkjLSYpa.js";
@@ -10,7 +10,7 @@ import "./tag-uVXp7uP-.js";
10
10
  import { t as C } from "./repeat-CV9S4zya.js";
11
11
  import { n as w, t as T } from "./utils-BwF4QSrq.js";
12
12
  import { t as E } from "./input-element-mTphzs9b.js";
13
- import "./input-wrapper-Bb6CZxmg.js";
13
+ import "./input-wrapper-xRJo_iVf.js";
14
14
  //#region src/components/datepicker/date-tags.ts
15
15
  var D = class extends o {
16
16
  constructor(...e) {
@@ -1,4 +1,4 @@
1
- const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./element-with-slot-CcJPCLgn.cjs");require("./icon-jPhyZD1z.cjs"),require("./calendar-C5QwPrbk.cjs");const r=require("./if-defined-CiML3MTM.cjs"),i=require("./ref-CB7e9nMY.cjs"),a=require("./converters-BJ9Fe0kW.cjs");require("./tag-BMtnaJ1A.cjs");const o=require("./repeat-CnnigVcj.cjs"),s=require("./utils-63cRpWut.cjs"),c=require("./input-element-BjnKPikY.cjs");require("./input-wrapper-BwzajfFX.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=s.n()}render(){return this.classes={"pkt-date-tags":!0,[this.className]:!0},e._`
1
+ const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./element-with-slot-CcJPCLgn.cjs");require("./icon-jPhyZD1z.cjs"),require("./calendar-5XCeDtZX.cjs");const r=require("./if-defined-CiML3MTM.cjs"),i=require("./ref-CB7e9nMY.cjs"),a=require("./converters-BJ9Fe0kW.cjs");require("./tag-BMtnaJ1A.cjs");const o=require("./repeat-CnnigVcj.cjs"),s=require("./utils-63cRpWut.cjs"),c=require("./input-element-BjnKPikY.cjs");require("./input-wrapper-BEmV0DGo.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=s.n()}render(){return this.classes={"pkt-date-tags":!0,[this.className]:!0},e._`
2
2
  <div class=${t.t(this.classes)} aria-live="polite">
3
3
  ${Array.isArray(this.dates)&&this.dates[0]?o.t(a.h((this.dates??[]).filter(Boolean)),e=>e,t=>e._` <pkt-tag
4
4
  id=${this.idBase+t+`-tag`}