@oslokommune/punkt-elements 14.3.0 → 14.5.2

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 (149) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/{accordionitem-C_URrDjP.js → accordionitem-DB3tAjIZ.js} +4 -4
  3. package/dist/{accordionitem-DCZrHVNR.cjs → accordionitem-DHYmPA-o.cjs} +1 -1
  4. package/dist/{alert-UFQFbbzZ.js → alert-DqXar67l.js} +6 -6
  5. package/dist/{alert-SvqEDHuW.cjs → alert-GrKyqxuR.cjs} +1 -1
  6. package/dist/{backlink-C7qUmUzs.js → backlink-CqUcmiPQ.js} +11 -11
  7. package/dist/{backlink-BrIIpgJ7.cjs → backlink-QDcQd6vK.cjs} +1 -1
  8. package/dist/{button-DaM4jvhJ.cjs → button-R4l10Nqd.cjs} +1 -1
  9. package/dist/{button-CjXih_Nx.js → button-f36menSU.js} +5 -5
  10. package/dist/{calendar-CvfMj3fA.js → calendar-DiNuZ8Ai.js} +7 -8
  11. package/dist/{calendar-ZzLAjDpv.cjs → calendar-wuD6ZH0t.cjs} +3 -3
  12. package/dist/{card-C1gRTfXb.cjs → card-C2hWaMev.cjs} +1 -1
  13. package/dist/{card-CO3D8wQE.js → card-CnINxZma.js} +7 -7
  14. package/dist/{checkbox-C0TPnShf.cjs → checkbox-B-0FOdwi.cjs} +1 -1
  15. package/dist/{checkbox-CnhA52o_.js → checkbox-CkAwPK_E.js} +4 -4
  16. package/dist/{class-map-C_erArZz.cjs → class-map-CApIYSRo.cjs} +1 -1
  17. package/dist/{class-map-wy7PUk0P.js → class-map-Dt2jXOlF.js} +1 -1
  18. package/dist/{combobox-Dcp_fHcL.js → combobox-Dxa7XjLz.js} +55 -55
  19. package/dist/{combobox-C1xwAju5.cjs → combobox-yy6hIGmB.cjs} +13 -13
  20. package/dist/{consent-Daj-Xa7w.cjs → consent-FbFS1pmz.cjs} +1 -1
  21. package/dist/{consent-BO3Ga8N4.js → consent-c9PhWxnP.js} +3 -3
  22. package/dist/{datepicker-Bjb9GK1E.js → datepicker-C7GWMtXH.js} +222 -241
  23. package/dist/{datepicker-COIRRau0.cjs → datepicker-D_3vYgMt.cjs} +25 -25
  24. package/dist/{directive-helpers-BzAtj9by.js → directive-helpers-CQef4qUQ.js} +1 -1
  25. package/dist/{directive-helpers-4oOjKnGY.cjs → directive-helpers-CYIEJ8pI.cjs} +1 -1
  26. package/dist/{element-CRDRygXu.js → element-BXsf_NlG.js} +3 -3
  27. package/dist/{element-CJ_QKaki.cjs → element-aUzIoa1s.cjs} +3 -3
  28. package/dist/{heading-Dv_cH6N1.cjs → heading-CBepYb7H.cjs} +1 -1
  29. package/dist/{heading-BUdy170t.js → heading-J7dN9nRi.js} +13 -13
  30. package/dist/{helptext-hlcc584n.cjs → helptext-DebHGRsD.cjs} +1 -1
  31. package/dist/{helptext-Bn17Picx.js → helptext-DuyRRfCn.js} +5 -5
  32. package/dist/{icon-BB7e5iQN.js → icon-BgG6oO4Q.js} +1 -1
  33. package/dist/{icon-MRx-m0Or.cjs → icon-Dl9ZPqe6.cjs} +1 -1
  34. package/dist/{if-defined-Bc9-_I01.cjs → if-defined-BElHLTlB.cjs} +1 -1
  35. package/dist/{if-defined-BWZGb3bh.js → if-defined-CxHgig4I.js} +1 -1
  36. package/dist/index.d.ts +213 -55
  37. package/dist/input-element-DVZhYDJ_.js +840 -0
  38. package/dist/input-element-RBQVA8i0.cjs +1 -0
  39. package/dist/{input-wrapper-1PCXqtiu.js → input-wrapper-3qfjLkrP.js} +7 -7
  40. package/dist/{input-wrapper-CtBiAb04.cjs → input-wrapper-rgXsRNkk.cjs} +1 -1
  41. package/dist/{link-BboUBUcg.js → link-CZvcdRek.js} +4 -4
  42. package/dist/{link-Dw39h-YN.cjs → link-D85g20GS.cjs} +1 -1
  43. package/dist/{linkcard-DUA3kGGd.cjs → linkcard-B-9K02q8.cjs} +1 -1
  44. package/dist/{linkcard-BqJmHFu8.js → linkcard-C3RTcMqc.js} +4 -4
  45. package/dist/{listbox-mvKKzH-v.js → listbox-CLtowV6W.js} +36 -36
  46. package/dist/{listbox-DnoqOo5u.cjs → listbox-C_0RhGhk.cjs} +2 -2
  47. package/dist/{loader-DjGxT7C3.cjs → loader-1EXLdxfq.cjs} +1 -1
  48. package/dist/{loader-DIum_s_D.js → loader-Dci0SrOz.js} +5 -5
  49. package/dist/{messagebox-aPlConlJ.js → messagebox-CnZlttZp.js} +5 -5
  50. package/dist/{messagebox-ChIKVTO_.cjs → messagebox-dscnWgCd.cjs} +1 -1
  51. package/dist/{modal-B4qq0VFB.cjs → modal-ncKVjcyZ.cjs} +1 -1
  52. package/dist/{modal-jAUtM-NP.js → modal-wSGthXAC.js} +5 -5
  53. package/dist/pkt-accordion.cjs +1 -1
  54. package/dist/pkt-accordion.js +2 -2
  55. package/dist/pkt-alert.cjs +1 -1
  56. package/dist/pkt-alert.js +1 -1
  57. package/dist/pkt-backlink.cjs +1 -1
  58. package/dist/pkt-backlink.js +1 -1
  59. package/dist/pkt-button.cjs +1 -1
  60. package/dist/pkt-button.js +1 -1
  61. package/dist/pkt-calendar.cjs +1 -1
  62. package/dist/pkt-calendar.js +1 -1
  63. package/dist/pkt-card.cjs +1 -1
  64. package/dist/pkt-card.js +1 -1
  65. package/dist/pkt-checkbox.cjs +1 -1
  66. package/dist/pkt-checkbox.js +1 -1
  67. package/dist/pkt-combobox.cjs +1 -1
  68. package/dist/pkt-combobox.js +1 -1
  69. package/dist/pkt-consent.cjs +1 -1
  70. package/dist/pkt-consent.js +1 -1
  71. package/dist/pkt-datepicker.cjs +1 -1
  72. package/dist/pkt-datepicker.js +2 -2
  73. package/dist/pkt-header.cjs +1 -1
  74. package/dist/pkt-header.js +9 -9
  75. package/dist/pkt-heading.cjs +1 -1
  76. package/dist/pkt-heading.js +1 -1
  77. package/dist/pkt-helptext.cjs +1 -1
  78. package/dist/pkt-helptext.js +1 -1
  79. package/dist/pkt-icon.cjs +1 -1
  80. package/dist/pkt-icon.js +1 -1
  81. package/dist/pkt-index.cjs +1 -29
  82. package/dist/pkt-index.js +60 -157
  83. package/dist/pkt-input-wrapper.cjs +1 -1
  84. package/dist/pkt-input-wrapper.js +1 -1
  85. package/dist/pkt-link.cjs +1 -1
  86. package/dist/pkt-link.js +1 -1
  87. package/dist/pkt-linkcard.cjs +1 -1
  88. package/dist/pkt-linkcard.js +1 -1
  89. package/dist/pkt-listbox.cjs +1 -1
  90. package/dist/pkt-listbox.js +1 -1
  91. package/dist/pkt-loader.cjs +1 -1
  92. package/dist/pkt-loader.js +1 -1
  93. package/dist/pkt-messagebox.cjs +1 -1
  94. package/dist/pkt-messagebox.js +1 -1
  95. package/dist/pkt-modal.cjs +1 -1
  96. package/dist/pkt-modal.js +1 -1
  97. package/dist/pkt-options-controller-DjBCEHU4.cjs +1 -0
  98. package/dist/{pkt-options-controller-CZO1nxZ8.js → pkt-options-controller-zn5cmMvL.js} +3 -3
  99. package/dist/pkt-progressbar.cjs +1 -1
  100. package/dist/pkt-progressbar.js +2 -2
  101. package/dist/pkt-radiobutton.cjs +1 -1
  102. package/dist/pkt-radiobutton.js +1 -1
  103. package/dist/pkt-select.cjs +1 -1
  104. package/dist/pkt-select.js +1 -1
  105. package/dist/pkt-tabs.cjs +1 -1
  106. package/dist/pkt-tabs.js +2 -2
  107. package/dist/pkt-tag.cjs +1 -1
  108. package/dist/pkt-tag.js +1 -1
  109. package/dist/pkt-textarea.cjs +1 -1
  110. package/dist/pkt-textarea.js +1 -1
  111. package/dist/pkt-textinput.cjs +1 -1
  112. package/dist/pkt-textinput.js +1 -1
  113. package/dist/{progressbar-CmAQ-DVW.cjs → progressbar-ClY1WgnM.cjs} +1 -1
  114. package/dist/{progressbar-CVt73-JQ.js → progressbar-D5WBW1Dm.js} +5 -5
  115. package/dist/{radiobutton-BkqaqO5E.cjs → radiobutton-iHuLnuAn.cjs} +1 -1
  116. package/dist/{radiobutton-Caq8-GhM.js → radiobutton-oA20HijB.js} +15 -15
  117. package/dist/{ref-Xa5dbh--.js → ref-BxiKhrfa.js} +2 -2
  118. package/dist/{ref-BFa5Utho.cjs → ref-C5iJMIE1.cjs} +1 -1
  119. package/dist/{repeat-CJ79egkN.js → repeat-B55jMEsG.js} +2 -2
  120. package/dist/{repeat-BZb41H64.cjs → repeat-DcYSFU2y.cjs} +1 -1
  121. package/dist/select-Bug9sfr5.js +228 -0
  122. package/dist/select-jbIbD7hW.cjs +49 -0
  123. package/dist/{state-DS_kr2Fy.js → state-DgnkjP0q.js} +1 -1
  124. package/dist/{state-DSjcvzDN.cjs → state-GDzxl12x.cjs} +1 -1
  125. package/dist/{tabitem-D5zyipN1.cjs → tabitem-CtltSqDK.cjs} +1 -1
  126. package/dist/{tabitem-NV2fzs_-.js → tabitem-CypTmORF.js} +30 -30
  127. package/dist/{tag-B02fKJ66.cjs → tag-BfjOlIyS.cjs} +1 -1
  128. package/dist/{tag-CES41g0D.js → tag-DgoTYNVA.js} +6 -6
  129. package/dist/{textarea-a6T4aJJU.js → textarea-Da9E3RM7.js} +9 -9
  130. package/dist/{textarea-DyUy8u7X.cjs → textarea-Dfa4_ZBy.cjs} +1 -1
  131. package/dist/{textinput-IN3b0nSH.cjs → textinput-CLM9fRjm.cjs} +1 -1
  132. package/dist/{textinput-DIuM70dd.js → textinput-DaMYc5gd.js} +8 -8
  133. package/package.json +2 -2
  134. package/src/components/checkbox/checkbox.ts +1 -1
  135. package/src/components/combobox/combobox.ts +2 -2
  136. package/src/components/datepicker/datepicker-utils.test.ts +0 -25
  137. package/src/components/datepicker/datepicker-utils.ts +0 -28
  138. package/src/components/datepicker/datepicker.ts +0 -6
  139. package/src/components/header/header.ts +2 -0
  140. package/src/components/index.ts +0 -1
  141. package/src/components/radiobutton/radiobutton.ts +1 -1
  142. package/src/components/select/select.ts +14 -47
  143. package/src/components/textarea/textarea.ts +1 -1
  144. package/src/components/textinput/textinput.ts +1 -1
  145. package/dist/input-element-B8M8Nppd.js +0 -708
  146. package/dist/input-element-D697OAJo.cjs +0 -1
  147. package/dist/pkt-options-controller-CiuBG6Lt.cjs +0 -1
  148. package/dist/select-3dwlk22G.cjs +0 -49
  149. package/dist/select-_C-yztI0.js +0 -173
@@ -1,6 +1,6 @@
1
- import { T as A } from "./element-CRDRygXu.js";
1
+ import { T as A } from "./element-BXsf_NlG.js";
2
2
  import { e as M, i as b, t as j } from "./directive-oAbCiebi.js";
3
- import { p as C, v as h, s as v, M as x, m as D } from "./directive-helpers-BzAtj9by.js";
3
+ import { p as C, v as h, s as v, M as x, m as D } from "./directive-helpers-CQef4qUQ.js";
4
4
  /**
5
5
  * @license
6
6
  * Copyright 2017 Google LLC
@@ -1,4 +1,4 @@
1
- "use strict";const m=require("./element-CJ_QKaki.cjs"),x=require("./directive-C7oCP5Bh.cjs"),r=require("./directive-helpers-4oOjKnGY.cjs");/**
1
+ "use strict";const m=require("./element-aUzIoa1s.cjs"),x=require("./directive-C7oCP5Bh.cjs"),r=require("./directive-helpers-CYIEJ8pI.cjs");/**
2
2
  * @license
3
3
  * Copyright 2017 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
@@ -0,0 +1,228 @@
1
+ import { n as c, x as a, t as _ } from "./element-BXsf_NlG.js";
2
+ import { e as u, n as d } from "./ref-BxiKhrfa.js";
3
+ import { o as n } from "./if-defined-CxHgig4I.js";
4
+ import { r as $ } from "./state-DgnkjP0q.js";
5
+ import { P as x } from "./input-element-DVZhYDJ_.js";
6
+ import { P as m } from "./pkt-options-controller-zn5cmMvL.js";
7
+ import { P as b } from "./pkt-slot-controller-BPGj-LC5.js";
8
+ import "./input-wrapper-3qfjLkrP.js";
9
+ var P = Object.defineProperty, v = (e, t, s, o) => {
10
+ for (var i = void 0, l = e.length - 1, p; l >= 0; l--)
11
+ (p = e[l]) && (i = p(t, s, i) || i);
12
+ return i && P(t, s, i), i;
13
+ };
14
+ class h extends x {
15
+ constructor() {
16
+ super(...arguments), this._optionsProp = [], this._options = [];
17
+ }
18
+ /**
19
+ * Public getter for options that includes selected state
20
+ * Override this in subclasses to customize the selected state logic
21
+ */
22
+ get options() {
23
+ return this._options.map((t) => ({
24
+ ...t,
25
+ selected: this.isOptionSelected(t)
26
+ }));
27
+ }
28
+ /**
29
+ * Public setter for options
30
+ */
31
+ set options(t) {
32
+ this._optionsProp = t, this.requestUpdate("_optionsProp", this._options);
33
+ }
34
+ /**
35
+ * Determines if an option is selected
36
+ * Subclasses should override this to implement their selection logic
37
+ *
38
+ * @param option - The option to check
39
+ * @returns True if the option is selected
40
+ * @protected
41
+ */
42
+ isOptionSelected(t) {
43
+ return Array.isArray(this.value) ? this.value.includes(t.value) : t.value === this.value;
44
+ }
45
+ /**
46
+ * Finds an option by its value
47
+ *
48
+ * @param value - The value to search for
49
+ * @returns The option if found, undefined otherwise
50
+ * @protected
51
+ */
52
+ findOptionByValue(t) {
53
+ return this._options.find((s) => s.value === t);
54
+ }
55
+ /**
56
+ * Gets all currently selected options
57
+ *
58
+ * @returns Array of selected options
59
+ * @protected
60
+ */
61
+ getSelectedOptions() {
62
+ return this._options.filter((t) => this.isOptionSelected(t));
63
+ }
64
+ /**
65
+ * Parses options from either props or slot controller
66
+ * Call this in connectedCallback to initialize options
67
+ *
68
+ * @protected
69
+ */
70
+ parseOptions() {
71
+ var o, i;
72
+ const t = this._optionsProp.length > 0, s = ((i = (o = this.optionsController) == null ? void 0 : o.nodes) == null ? void 0 : i.length) && this.optionsController.nodes.length > 0;
73
+ t ? this._options = this._optionsProp : s && (this._options = this.optionsController.options);
74
+ }
75
+ /**
76
+ * Re-parse options when the component updates
77
+ * This ensures options stay in sync when they change dynamically
78
+ *
79
+ * @protected
80
+ */
81
+ willUpdate(t) {
82
+ super.willUpdate(t), this.parseOptions();
83
+ }
84
+ }
85
+ v([
86
+ c({ type: Array, attribute: "options" })
87
+ ], h.prototype, "_optionsProp");
88
+ v([
89
+ $()
90
+ ], h.prototype, "_options");
91
+ var g = Object.defineProperty, O = Object.getOwnPropertyDescriptor, f = (e, t, s, o) => {
92
+ for (var i = o > 1 ? void 0 : o ? O(t, s) : t, l = e.length - 1, p; l >= 0; l--)
93
+ (p = e[l]) && (i = (o ? p(t, s, i) : p(i)) || i);
94
+ return o && i && g(t, s, i), i;
95
+ };
96
+ let r = class extends h {
97
+ constructor() {
98
+ super(), this.inputRef = u(), this.helptextSlot = u(), this.value = "", this.selectedIndex = -1, this.selectedOptions = void 0, this.optionsController = new m(this), this.slotController = new b(this, this.helptextSlot), this.slotController.skipOptions = !0;
99
+ }
100
+ connectedCallback() {
101
+ super.connectedCallback(), this.parseOptions(), this._options.forEach((e) => {
102
+ e.selected && !this.value && (this.value = e.value);
103
+ });
104
+ }
105
+ // Support native Select method `add`
106
+ add(e, t) {
107
+ const s = {
108
+ value: e.value || e.text,
109
+ label: e.text || e.value,
110
+ selected: e.selected,
111
+ disabled: e.disabled
112
+ };
113
+ if (t === void 0)
114
+ this._options.push(s);
115
+ else if (typeof t == "number")
116
+ this._options.splice(t, 0, s);
117
+ else {
118
+ const o = t.value || t.text, i = this._options.findIndex((l) => l.value === o);
119
+ i >= 0 ? this._options.splice(i, 0, s) : this._options.push(s);
120
+ }
121
+ e.selected && (this.value = e.value || e.text, this.selectedIndex = this._options.findIndex((o) => o.value === this.value)), this.requestUpdate();
122
+ }
123
+ // Support native Select method `remove`
124
+ remove(e) {
125
+ var t;
126
+ typeof e == "number" && (this.selectedIndex === e && (this.value = ((t = this._options[0]) == null ? void 0 : t.value) || ""), this._options.splice(e, 1), this.requestUpdate());
127
+ }
128
+ // Support native Select method `item`
129
+ item(e) {
130
+ var t;
131
+ return (t = this.inputRef.value) == null ? void 0 : t.item(e);
132
+ }
133
+ // Support native Select method `namedItem`
134
+ namedItem(e) {
135
+ var t;
136
+ return (t = this.inputRef.value) == null ? void 0 : t.namedItem(e);
137
+ }
138
+ // Support native Select method `showPicker`
139
+ showPicker() {
140
+ this.inputRef.value && "showPicker" in this.inputRef.value && this.inputRef.value.showPicker();
141
+ }
142
+ attributeChangedCallback(e, t, s) {
143
+ var o, i;
144
+ e === "options" && (this._options = s ? JSON.parse(s) : []), e === "value" && this.value !== t && (this.selectedIndex = this.touched ? this.returnNumberOrNull((o = this.inputRef.value) == null ? void 0 : o.selectedIndex) : this._options.findIndex((l) => l.value === s), this.selectedOptions = (i = this.inputRef.value) == null ? void 0 : i.selectedOptions, this.valueChanged(s, t)), super.attributeChangedCallback(e, t, s);
145
+ }
146
+ update(e) {
147
+ var t, s;
148
+ super.update(e), e.has("_optionsProp") && this._optionsProp.length > 0 && (this._options = this._optionsProp, this.requestUpdate("_options"), !this.value && this._options.length > 0 && (this.value = this._options[0].value, this.selectedIndex = 0)), e.has("value") && this.value !== e.get("value") && (this.selectedIndex = this.touched ? this.returnNumberOrNull((t = this.inputRef.value) == null ? void 0 : t.selectedIndex) : this._options.findIndex((o) => o.value === this.value), this.selectedOptions = (s = this.inputRef.value) == null ? void 0 : s.selectedOptions, this.valueChanged(this.value, e.get("value"))), e.has("id") && !this.name && this.id && (this.name = this.id);
149
+ }
150
+ firstUpdated(e) {
151
+ var t;
152
+ super.firstUpdated(e), this._optionsProp.length && (this._options = this._optionsProp), !this.value && this._options.length > 0 ? (this.value = this._options[0].value, this.selectedIndex = 0) : this.selectedIndex = this._options.findIndex((s) => s.value === this.value), this.selectedOptions = (t = this.inputRef.value) == null ? void 0 : t.selectedOptions;
153
+ }
154
+ render() {
155
+ const e = `pkt-input ${this.fullwidth ? "pkt-input--fullwidth" : ""}`;
156
+ return a`
157
+ <pkt-input-wrapper
158
+ ?counter=${this.counter}
159
+ ?disabled=${this.disabled}
160
+ ?hasError=${this.hasError}
161
+ ?hasFieldset=${this.hasFieldset}
162
+ ?inline=${this.inline}
163
+ ?optionalTag=${this.optionalTag}
164
+ ?requiredTag=${this.requiredTag}
165
+ useWrapper=${this.useWrapper}
166
+ ariaDescribedBy=${n(this.ariaDescribedBy)}
167
+ class="pkt-select"
168
+ errorMessage=${n(this.errorMessage)}
169
+ forId=${this.id + "-input"}
170
+ helptext=${n(this.helptext)}
171
+ helptextDropdown=${n(this.helptextDropdown)}
172
+ helptextDropdownButton=${n(this.helptextDropdownButton)}
173
+ label=${n(this.label)}
174
+ optionalText=${n(this.optionalText)}
175
+ requiredText=${n(this.requiredText)}
176
+ tagText=${n(this.tagText)}
177
+ >
178
+ <select
179
+ class=${e}
180
+ aria-invalid=${this.hasError}
181
+ aria-errormessage=${`${this.id}-error`}
182
+ aria-labelledby=${n(this.ariaLabelledby)}
183
+ ?disabled=${this.disabled}
184
+ id=${this.id + "-input"}
185
+ name=${(this.name || this.id) + "-input"}
186
+ value=${this.value}
187
+ @change=${(t) => {
188
+ this.touched = !0, this.value = t.target.value, t.stopImmediatePropagation();
189
+ }}
190
+ @input=${(t) => {
191
+ this.onInput(), t.stopImmediatePropagation();
192
+ }}
193
+ @focus=${(t) => {
194
+ this.onFocus(), t.stopImmediatePropagation();
195
+ }}
196
+ @blur=${(t) => {
197
+ this.onBlur(), t.stopImmediatePropagation();
198
+ }}
199
+ ${d(this.inputRef)}
200
+ >
201
+ ${this._options.length > 0 ? this._options.map(
202
+ (t) => a`<option
203
+ value=${t.value}
204
+ ?selected=${this.value == t.value || t.selected}
205
+ ?disabled=${t.disabled}
206
+ ?hidden=${t.hidden}
207
+ >
208
+ ${t.label}
209
+ </option>`
210
+ ) : ""}
211
+ </select>
212
+ <div class="pkt-contents" ${d(this.helptextSlot)} name="helptext" slot="helptext"></div>
213
+ </pkt-input-wrapper>
214
+ `;
215
+ }
216
+ returnNumberOrNull(e) {
217
+ return e == null || isNaN(e) ? null : e;
218
+ }
219
+ };
220
+ f([
221
+ c({ type: String })
222
+ ], r.prototype, "value", 2);
223
+ r = f([
224
+ _("pkt-select")
225
+ ], r);
226
+ export {
227
+ r as P
228
+ };
@@ -0,0 +1,49 @@
1
+ "use strict";const p=require("./element-aUzIoa1s.cjs"),h=require("./ref-C5iJMIE1.cjs"),l=require("./if-defined-BElHLTlB.cjs"),c=require("./state-GDzxl12x.cjs"),v=require("./input-element-RBQVA8i0.cjs"),f=require("./pkt-options-controller-DjBCEHU4.cjs"),_=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-rgXsRNkk.cjs");var $=Object.defineProperty,u=(r,t,e,i)=>{for(var s=void 0,o=r.length-1,n;o>=0;o--)(n=r[o])&&(s=n(t,e,s)||s);return s&&$(t,e,s),s};class a extends v.PktInputElement{constructor(){super(...arguments),this._optionsProp=[],this._options=[]}get options(){return this._options.map(t=>({...t,selected:this.isOptionSelected(t)}))}set options(t){this._optionsProp=t,this.requestUpdate("_optionsProp",this._options)}isOptionSelected(t){return Array.isArray(this.value)?this.value.includes(t.value):t.value===this.value}findOptionByValue(t){return this._options.find(e=>e.value===t)}getSelectedOptions(){return this._options.filter(t=>this.isOptionSelected(t))}parseOptions(){var i,s;const t=this._optionsProp.length>0,e=((s=(i=this.optionsController)==null?void 0:i.nodes)==null?void 0:s.length)&&this.optionsController.nodes.length>0;t?this._options=this._optionsProp:e&&(this._options=this.optionsController.options)}willUpdate(t){super.willUpdate(t),this.parseOptions()}}u([p.n({type:Array,attribute:"options"})],a.prototype,"_optionsProp");u([c.r()],a.prototype,"_options");var x=Object.defineProperty,b=Object.getOwnPropertyDescriptor,d=(r,t,e,i)=>{for(var s=i>1?void 0:i?b(t,e):t,o=r.length-1,n;o>=0;o--)(n=r[o])&&(s=(i?n(t,e,s):n(s))||s);return i&&s&&x(t,e,s),s};exports.PktSelect=class extends a{constructor(){super(),this.inputRef=h.e(),this.helptextSlot=h.e(),this.value="",this.selectedIndex=-1,this.selectedOptions=void 0,this.optionsController=new f.PktOptionsSlotController(this),this.slotController=new _.PktSlotController(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){super.connectedCallback(),this.parseOptions(),this._options.forEach(t=>{t.selected&&!this.value&&(this.value=t.value)})}add(t,e){const i={value:t.value||t.text,label:t.text||t.value,selected:t.selected,disabled:t.disabled};if(e===void 0)this._options.push(i);else if(typeof e=="number")this._options.splice(e,0,i);else{const s=e.value||e.text,o=this._options.findIndex(n=>n.value===s);o>=0?this._options.splice(o,0,i):this._options.push(i)}t.selected&&(this.value=t.value||t.text,this.selectedIndex=this._options.findIndex(s=>s.value===this.value)),this.requestUpdate()}remove(t){var e;typeof t=="number"&&(this.selectedIndex===t&&(this.value=((e=this._options[0])==null?void 0:e.value)||""),this._options.splice(t,1),this.requestUpdate())}item(t){var e;return(e=this.inputRef.value)==null?void 0:e.item(t)}namedItem(t){var e;return(e=this.inputRef.value)==null?void 0:e.namedItem(t)}showPicker(){this.inputRef.value&&"showPicker"in this.inputRef.value&&this.inputRef.value.showPicker()}attributeChangedCallback(t,e,i){var s,o;t==="options"&&(this._options=i?JSON.parse(i):[]),t==="value"&&this.value!==e&&(this.selectedIndex=this.touched?this.returnNumberOrNull((s=this.inputRef.value)==null?void 0:s.selectedIndex):this._options.findIndex(n=>n.value===i),this.selectedOptions=(o=this.inputRef.value)==null?void 0:o.selectedOptions,this.valueChanged(i,e)),super.attributeChangedCallback(t,e,i)}update(t){var e,i;super.update(t),t.has("_optionsProp")&&this._optionsProp.length>0&&(this._options=this._optionsProp,this.requestUpdate("_options"),!this.value&&this._options.length>0&&(this.value=this._options[0].value,this.selectedIndex=0)),t.has("value")&&this.value!==t.get("value")&&(this.selectedIndex=this.touched?this.returnNumberOrNull((e=this.inputRef.value)==null?void 0:e.selectedIndex):this._options.findIndex(s=>s.value===this.value),this.selectedOptions=(i=this.inputRef.value)==null?void 0:i.selectedOptions,this.valueChanged(this.value,t.get("value"))),t.has("id")&&!this.name&&this.id&&(this.name=this.id)}firstUpdated(t){var e;super.firstUpdated(t),this._optionsProp.length&&(this._options=this._optionsProp),!this.value&&this._options.length>0?(this.value=this._options[0].value,this.selectedIndex=0):this.selectedIndex=this._options.findIndex(i=>i.value===this.value),this.selectedOptions=(e=this.inputRef.value)==null?void 0:e.selectedOptions}render(){const t=`pkt-input ${this.fullwidth?"pkt-input--fullwidth":""}`;return p.x`
2
+ <pkt-input-wrapper
3
+ ?counter=${this.counter}
4
+ ?disabled=${this.disabled}
5
+ ?hasError=${this.hasError}
6
+ ?hasFieldset=${this.hasFieldset}
7
+ ?inline=${this.inline}
8
+ ?optionalTag=${this.optionalTag}
9
+ ?requiredTag=${this.requiredTag}
10
+ useWrapper=${this.useWrapper}
11
+ ariaDescribedBy=${l.o(this.ariaDescribedBy)}
12
+ class="pkt-select"
13
+ errorMessage=${l.o(this.errorMessage)}
14
+ forId=${this.id+"-input"}
15
+ helptext=${l.o(this.helptext)}
16
+ helptextDropdown=${l.o(this.helptextDropdown)}
17
+ helptextDropdownButton=${l.o(this.helptextDropdownButton)}
18
+ label=${l.o(this.label)}
19
+ optionalText=${l.o(this.optionalText)}
20
+ requiredText=${l.o(this.requiredText)}
21
+ tagText=${l.o(this.tagText)}
22
+ >
23
+ <select
24
+ class=${t}
25
+ aria-invalid=${this.hasError}
26
+ aria-errormessage=${`${this.id}-error`}
27
+ aria-labelledby=${l.o(this.ariaLabelledby)}
28
+ ?disabled=${this.disabled}
29
+ id=${this.id+"-input"}
30
+ name=${(this.name||this.id)+"-input"}
31
+ value=${this.value}
32
+ @change=${e=>{this.touched=!0,this.value=e.target.value,e.stopImmediatePropagation()}}
33
+ @input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
34
+ @focus=${e=>{this.onFocus(),e.stopImmediatePropagation()}}
35
+ @blur=${e=>{this.onBlur(),e.stopImmediatePropagation()}}
36
+ ${h.n(this.inputRef)}
37
+ >
38
+ ${this._options.length>0?this._options.map(e=>p.x`<option
39
+ value=${e.value}
40
+ ?selected=${this.value==e.value||e.selected}
41
+ ?disabled=${e.disabled}
42
+ ?hidden=${e.hidden}
43
+ >
44
+ ${e.label}
45
+ </option>`):""}
46
+ </select>
47
+ <div class="pkt-contents" ${h.n(this.helptextSlot)} name="helptext" slot="helptext"></div>
48
+ </pkt-input-wrapper>
49
+ `}returnNumberOrNull(t){return t==null||isNaN(t)?null:t}};d([p.n({type:String})],exports.PktSelect.prototype,"value",2);exports.PktSelect=d([p.t("pkt-select")],exports.PktSelect);
@@ -1,4 +1,4 @@
1
- import { n as r } from "./element-CRDRygXu.js";
1
+ import { n as r } from "./element-BXsf_NlG.js";
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2017 Google LLC
@@ -1,4 +1,4 @@
1
- "use strict";const e=require("./element-CJ_QKaki.cjs");/**
1
+ "use strict";const e=require("./element-aUzIoa1s.cjs");/**
2
2
  * @license
3
3
  * Copyright 2017 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
@@ -1,4 +1,4 @@
1
- "use strict";const a=require("./element-CJ_QKaki.cjs"),g=require("./pkt-slot-controller-BzddBp7z.cjs"),v=require("./state-DSjcvzDN.cjs"),p=require("./ref-BFa5Utho.cjs"),u=require("./if-defined-Bc9-_I01.cjs");/**
1
+ "use strict";const a=require("./element-aUzIoa1s.cjs"),g=require("./pkt-slot-controller-BzddBp7z.cjs"),v=require("./state-GDzxl12x.cjs"),p=require("./ref-C5iJMIE1.cjs"),u=require("./if-defined-BElHLTlB.cjs");/**
2
2
  * @license
3
3
  * Copyright 2021 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
@@ -1,8 +1,8 @@
1
- import { P as $, x as p, n as h, a as y } from "./element-CRDRygXu.js";
1
+ import { P as $, x as p, n as h, t as y } from "./element-BXsf_NlG.js";
2
2
  import { P as C } from "./pkt-slot-controller-BPGj-LC5.js";
3
- import { r as w } from "./state-DS_kr2Fy.js";
4
- import { e as x, n as f } from "./ref-Xa5dbh--.js";
5
- import { o as u } from "./if-defined-BWZGb3bh.js";
3
+ import { r as w } from "./state-DgnkjP0q.js";
4
+ import { e as x, n as f } from "./ref-BxiKhrfa.js";
5
+ import { o as u } from "./if-defined-CxHgig4I.js";
6
6
  /**
7
7
  * @license
8
8
  * Copyright 2021 Google LLC
@@ -25,11 +25,11 @@ let P = class extends Event {
25
25
  */
26
26
  let m = class {
27
27
  constructor(t, s, i, e) {
28
- if (this.subscribe = !1, this.provided = !1, this.value = void 0, this.t = (a, r) => {
29
- this.unsubscribe && (this.unsubscribe !== r && (this.provided = !1, this.unsubscribe()), this.subscribe || this.unsubscribe()), this.value = a, this.host.requestUpdate(), this.provided && !this.subscribe || (this.provided = !0, this.callback && this.callback(a, r)), this.unsubscribe = r;
28
+ if (this.subscribe = !1, this.provided = !1, this.value = void 0, this.t = (n, r) => {
29
+ this.unsubscribe && (this.unsubscribe !== r && (this.provided = !1, this.unsubscribe()), this.subscribe || this.unsubscribe()), this.value = n, this.host.requestUpdate(), this.provided && !this.subscribe || (this.provided = !0, this.callback && this.callback(n, r)), this.unsubscribe = r;
30
30
  }, this.host = t, s.context !== void 0) {
31
- const a = s;
32
- this.context = a.context, this.callback = a.callback, this.subscribe = a.subscribe ?? !1;
31
+ const n = s;
32
+ this.context = n.context, this.callback = n.callback, this.subscribe = n.subscribe ?? !1;
33
33
  } else this.context = s, this.callback = i, this.subscribe = e ?? !1;
34
34
  this.host.addController(this);
35
35
  }
@@ -88,17 +88,17 @@ let _ = class extends Event {
88
88
  };
89
89
  class g extends N {
90
90
  constructor(t, s, i) {
91
- var e, a;
91
+ var e, n;
92
92
  super(s.context !== void 0 ? s.initialValue : i), this.onContextRequest = (r) => {
93
93
  if (r.context !== this.context) return;
94
- const n = r.contextTarget ?? r.composedPath()[0];
95
- n !== this.host && (r.stopPropagation(), this.addCallback(r.callback, n, r.subscribe));
94
+ const a = r.contextTarget ?? r.composedPath()[0];
95
+ a !== this.host && (r.stopPropagation(), this.addCallback(r.callback, a, r.subscribe));
96
96
  }, this.onProviderRequest = (r) => {
97
97
  if (r.context !== this.context || (r.contextTarget ?? r.composedPath()[0]) === this.host) return;
98
- const n = /* @__PURE__ */ new Set();
99
- for (const [v, { consumerHost: k }] of this.subscriptions) n.has(v) || (n.add(v), k.dispatchEvent(new P(this.context, k, v, !0)));
98
+ const a = /* @__PURE__ */ new Set();
99
+ for (const [v, { consumerHost: k }] of this.subscriptions) a.has(v) || (a.add(v), k.dispatchEvent(new P(this.context, k, v, !0)));
100
100
  r.stopPropagation();
101
- }, this.host = t, s.context !== void 0 ? this.context = s.context : this.context = s, this.attachListeners(), (a = (e = this.host).addController) == null || a.call(e, this);
101
+ }, this.host = t, s.context !== void 0 ? this.context = s.context : this.context = s, this.attachListeners(), (n = (e = this.host).addController) == null || n.call(e, this);
102
102
  }
103
103
  attachListeners() {
104
104
  this.host.addEventListener("context-request", this.onContextRequest), this.host.addEventListener("context-provider", this.onProviderRequest);
@@ -127,21 +127,21 @@ function R({ context: o }) {
127
127
  i.set(r, new g(r, { context: o }));
128
128
  }));
129
129
  const e = Object.getOwnPropertyDescriptor(t, s);
130
- let a;
130
+ let n;
131
131
  if (e === void 0) {
132
132
  const r = /* @__PURE__ */ new WeakMap();
133
- a = { get() {
133
+ n = { get() {
134
134
  return r.get(this);
135
- }, set(n) {
136
- i.get(this).setValue(n), r.set(this, n);
135
+ }, set(a) {
136
+ i.get(this).setValue(a), r.set(this, a);
137
137
  }, configurable: !0, enumerable: !0 };
138
138
  } else {
139
139
  const r = e.set;
140
- a = { ...e, set(n) {
141
- i.get(this).setValue(n), r == null || r.call(this, n);
140
+ n = { ...e, set(a) {
141
+ i.get(this).setValue(a), r == null || r.call(this, a);
142
142
  } };
143
143
  }
144
- return void Object.defineProperty(t, s, a);
144
+ return void Object.defineProperty(t, s, n);
145
145
  }
146
146
  };
147
147
  }
@@ -157,16 +157,16 @@ function A({ context: o, subscribe: t }) {
157
157
  s.set.call(this, e);
158
158
  }, subscribe: t });
159
159
  })) : s.constructor.addInitializer(((e) => {
160
- new m(e, { context: o, callback: (a) => {
161
- e[i] = a;
160
+ new m(e, { context: o, callback: (n) => {
161
+ e[i] = n;
162
162
  }, subscribe: t });
163
163
  }));
164
164
  };
165
165
  }
166
166
  const S = Symbol("pkt-tabs-context");
167
167
  var O = Object.defineProperty, T = Object.getOwnPropertyDescriptor, d = (o, t, s, i) => {
168
- for (var e = i > 1 ? void 0 : i ? T(t, s) : t, a = o.length - 1, r; a >= 0; a--)
169
- (r = o[a]) && (e = (i ? r(t, s, e) : r(e)) || e);
168
+ for (var e = i > 1 ? void 0 : i ? T(t, s) : t, n = o.length - 1, r; n >= 0; n--)
169
+ (r = o[n]) && (e = (i ? r(t, s, e) : r(e)) || e);
170
170
  return i && e && O(t, s, e), e;
171
171
  };
172
172
  let b = class extends $ {
@@ -240,8 +240,8 @@ b = d([
240
240
  ], b);
241
241
  const M = b;
242
242
  var j = Object.defineProperty, q = Object.getOwnPropertyDescriptor, l = (o, t, s, i) => {
243
- for (var e = i > 1 ? void 0 : i ? q(t, s) : t, a = o.length - 1, r; a >= 0; a--)
244
- (r = o[a]) && (e = (i ? r(t, s, e) : r(e)) || e);
243
+ for (var e = i > 1 ? void 0 : i ? q(t, s) : t, n = o.length - 1, r; n >= 0; n--)
244
+ (r = o[n]) && (e = (i ? r(t, s, e) : r(e)) || e);
245
245
  return i && e && j(t, s, e), e;
246
246
  };
247
247
  let c = class extends $ {
@@ -261,7 +261,7 @@ let c = class extends $ {
261
261
  }
262
262
  render() {
263
263
  var r;
264
- const o = ((r = this.context) == null ? void 0 : r.useArrowNav) ?? !0, t = this.active ? "active" : "", s = o ? "tab" : void 0, i = o ? this.active : void 0, e = this.active || !o ? void 0 : -1, a = p`
264
+ const o = ((r = this.context) == null ? void 0 : r.useArrowNav) ?? !0, t = this.active ? "active" : "", s = o ? "tab" : void 0, i = o ? this.active : void 0, e = this.active || !o ? void 0 : -1, n = p`
265
265
  ${this.icon ? p`<pkt-icon name=${this.icon} class="pkt-icon--small"></pkt-icon>` : ""}
266
266
  <span ${f(this.defaultSlot)}></span>
267
267
  ${this.tag ? p`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>` : ""}
@@ -278,7 +278,7 @@ let c = class extends $ {
278
278
  @click=${this.handleClick}
279
279
  @keyup=${this.handleKeyUp}
280
280
  >
281
- ${a}
281
+ ${n}
282
282
  </a>
283
283
  ` : p`
284
284
  <button
@@ -292,7 +292,7 @@ let c = class extends $ {
292
292
  @click=${this.handleClick}
293
293
  @keyup=${this.handleKeyUp}
294
294
  >
295
- ${a}
295
+ ${n}
296
296
  </button>
297
297
  `;
298
298
  }
@@ -1,4 +1,4 @@
1
- "use strict";const h=require("./class-map-C_erArZz.cjs"),t=require("./element-CJ_QKaki.cjs"),k=require("./state-DSjcvzDN.cjs"),g=require("./pkt-slot-controller-BzddBp7z.cjs"),c=require("./ref-BFa5Utho.cjs");require("./icon-MRx-m0Or.cjs");const u=require("./if-defined-Bc9-_I01.cjs"),d={size:{default:"medium"},skin:{default:"blue"},closeTag:{default:!1},type:{default:"button"}},r={props:d};var f=Object.defineProperty,y=Object.getOwnPropertyDescriptor,i=(n,e,a,o)=>{for(var s=o>1?void 0:o?y(e,a):e,l=n.length-1,p;l>=0;l--)(p=n[l])&&(s=(o?p(e,a,s):p(s))||s);return o&&s&&f(e,a,s),s};exports.PktTag=class extends t.PktElement{constructor(){super(),this.defaultSlot=c.e(),this.closeTag=r.props.closeTag.default,this.size=r.props.size.default,this.skin=r.props.skin.default,this.textStyle=null,this.iconName=void 0,this.type=r.props.type.default,this.ariaLabel=null,this._isClosed=!1,this._ariaDescription=null,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!1,composed:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:e},bubbles:!1,composed:!0}))},this.slotController=new g.PktSlotController(this,this.defaultSlot),this._isClosed=!1}firstUpdated(e){var a,o;if(super.firstUpdated(e),this.closeTag&&!this.ariaLabel){const s=(o=(a=this.defaultSlot.value)==null?void 0:a.textContent)==null?void 0:o.trim();s&&(this._ariaDescription=`Klikk for å fjerne ${s}`)}}render(){const e={"pkt-tag":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.textStyle}`]:!!this.textStyle},a={"pkt-tag":!0,"pkt-btn":!0,"pkt-btn--tertiary":!0,[`pkt-tag--${this.textStyle}`]:!!this.textStyle,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,"pkt-btn--icons-right-and-left":this.closeTag&&!!this.iconName,"pkt-hide":this._isClosed};return this.closeTag?t.x`
1
+ "use strict";const h=require("./class-map-CApIYSRo.cjs"),t=require("./element-aUzIoa1s.cjs"),k=require("./state-GDzxl12x.cjs"),g=require("./pkt-slot-controller-BzddBp7z.cjs"),c=require("./ref-C5iJMIE1.cjs");require("./icon-Dl9ZPqe6.cjs");const u=require("./if-defined-BElHLTlB.cjs"),d={size:{default:"medium"},skin:{default:"blue"},closeTag:{default:!1},type:{default:"button"}},r={props:d};var f=Object.defineProperty,y=Object.getOwnPropertyDescriptor,i=(n,e,a,o)=>{for(var s=o>1?void 0:o?y(e,a):e,l=n.length-1,p;l>=0;l--)(p=n[l])&&(s=(o?p(e,a,s):p(s))||s);return o&&s&&f(e,a,s),s};exports.PktTag=class extends t.PktElement{constructor(){super(),this.defaultSlot=c.e(),this.closeTag=r.props.closeTag.default,this.size=r.props.size.default,this.skin=r.props.skin.default,this.textStyle=null,this.iconName=void 0,this.type=r.props.type.default,this.ariaLabel=null,this._isClosed=!1,this._ariaDescription=null,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!1,composed:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:e},bubbles:!1,composed:!0}))},this.slotController=new g.PktSlotController(this,this.defaultSlot),this._isClosed=!1}firstUpdated(e){var a,o;if(super.firstUpdated(e),this.closeTag&&!this.ariaLabel){const s=(o=(a=this.defaultSlot.value)==null?void 0:a.textContent)==null?void 0:o.trim();s&&(this._ariaDescription=`Klikk for å fjerne ${s}`)}}render(){const e={"pkt-tag":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.textStyle}`]:!!this.textStyle},a={"pkt-tag":!0,"pkt-btn":!0,"pkt-btn--tertiary":!0,[`pkt-tag--${this.textStyle}`]:!!this.textStyle,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,"pkt-btn--icons-right-and-left":this.closeTag&&!!this.iconName,"pkt-hide":this._isClosed};return this.closeTag?t.x`
2
2
  <button
3
3
  class=${h.e(a)}
4
4
  type=${this.type}
@@ -1,10 +1,10 @@
1
- import { e as u } from "./class-map-wy7PUk0P.js";
2
- import { P as m, x as p, n as r, a as g } from "./element-CRDRygXu.js";
3
- import { r as k } from "./state-DS_kr2Fy.js";
1
+ import { e as u } from "./class-map-Dt2jXOlF.js";
2
+ import { P as m, x as p, n as r, t as g } from "./element-BXsf_NlG.js";
3
+ import { r as k } from "./state-DgnkjP0q.js";
4
4
  import { P as y } from "./pkt-slot-controller-BPGj-LC5.js";
5
- import { e as b, n as f } from "./ref-Xa5dbh--.js";
6
- import "./icon-BB7e5iQN.js";
7
- import { o as d } from "./if-defined-BWZGb3bh.js";
5
+ import { e as b, n as f } from "./ref-BxiKhrfa.js";
6
+ import "./icon-BgG6oO4Q.js";
7
+ import { o as d } from "./if-defined-CxHgig4I.js";
8
8
  const _ = { size: { default: "medium" }, skin: { default: "blue" }, closeTag: { default: !1 }, type: { default: "button" } }, n = {
9
9
  props: _
10
10
  };
@@ -1,14 +1,14 @@
1
- import { T as l, E as $, x as f, n as d, a as g } from "./element-CRDRygXu.js";
2
- import { o as u } from "./if-defined-BWZGb3bh.js";
3
- import { r as x } from "./state-DS_kr2Fy.js";
4
- import { e as m, n as c } from "./ref-Xa5dbh--.js";
5
- import { e as v } from "./class-map-wy7PUk0P.js";
1
+ import { T as l, E as $, x as f, n as d, t as g } from "./element-BXsf_NlG.js";
2
+ import { o as u } from "./if-defined-CxHgig4I.js";
3
+ import { r as x } from "./state-DgnkjP0q.js";
4
+ import { e as m, n as c } from "./ref-BxiKhrfa.js";
5
+ import { e as v } from "./class-map-Dt2jXOlF.js";
6
6
  import { e as T, i as b, t as a } from "./directive-oAbCiebi.js";
7
- import { f as y, m as w } from "./directive-helpers-BzAtj9by.js";
8
- import { P as C } from "./input-element-B8M8Nppd.js";
7
+ import { f as y, m as w } from "./directive-helpers-CQef4qUQ.js";
8
+ import { P as C } from "./input-element-DVZhYDJ_.js";
9
9
  import { P as E } from "./pkt-slot-controller-BPGj-LC5.js";
10
- import "./input-wrapper-1PCXqtiu.js";
11
- import "./icon-BB7e5iQN.js";
10
+ import "./input-wrapper-3qfjLkrP.js";
11
+ import "./icon-BgG6oO4Q.js";
12
12
  /**
13
13
  * @license
14
14
  * Copyright 2020 Google LLC
@@ -1,4 +1,4 @@
1
- "use strict";const s=require("./element-CJ_QKaki.cjs"),p=require("./if-defined-Bc9-_I01.cjs"),c=require("./state-DSjcvzDN.cjs"),l=require("./ref-BFa5Utho.cjs"),$=require("./class-map-C_erArZz.cjs"),a=require("./directive-C7oCP5Bh.cjs"),d=require("./directive-helpers-4oOjKnGY.cjs"),x=require("./input-element-D697OAJo.cjs"),T=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-CtBiAb04.cjs");require("./icon-MRx-m0Or.cjs");/**
1
+ "use strict";const s=require("./element-aUzIoa1s.cjs"),p=require("./if-defined-BElHLTlB.cjs"),c=require("./state-GDzxl12x.cjs"),l=require("./ref-C5iJMIE1.cjs"),$=require("./class-map-CApIYSRo.cjs"),a=require("./directive-C7oCP5Bh.cjs"),d=require("./directive-helpers-CYIEJ8pI.cjs"),x=require("./input-element-RBQVA8i0.cjs"),T=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-rgXsRNkk.cjs");require("./icon-Dl9ZPqe6.cjs");/**
2
2
  * @license
3
3
  * Copyright 2020 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
@@ -1,4 +1,4 @@
1
- "use strict";const t=require("./element-CJ_QKaki.cjs"),a=require("./if-defined-Bc9-_I01.cjs"),l=require("./state-DSjcvzDN.cjs"),h=require("./ref-BFa5Utho.cjs"),c=require("./class-map-C_erArZz.cjs"),d=require("./input-element-D697OAJo.cjs"),x=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-CtBiAb04.cjs");require("./icon-MRx-m0Or.cjs");var $=Object.defineProperty,f=Object.getOwnPropertyDescriptor,r=(u,i,s,n)=>{for(var e=n>1?void 0:n?f(i,s):i,o=u.length-1,p;o>=0;o--)(p=u[o])&&(e=(n?p(i,s,e):p(e))||e);return n&&e&&$(i,s,e),e};exports.PktTextinput=class extends d.PktInputElement{constructor(){super(),this.inputRef=h.e(),this.helptextSlot=h.e(),this.value="",this.type="text",this.size=null,this.autocomplete=null,this.iconNameRight=null,this.prefix=null,this.suffix=null,this.omitSearchIcon=!1,this.counterCurrent=0,this.slotController=new x.PktSlotController(this,this.helptextSlot)}attributeChangedCallback(i,s,n){i==="value"&&this.value!==s&&(this.counterCurrent=n?n.length:0,this.valueChanged(n,s)),super.attributeChangedCallback(i,s,n)}updated(i){var s;super.updated(i),i.has("value")&&(this.counterCurrent=((s=this.value)==null?void 0:s.length)||0,this.valueChanged(this.value,i.get("value"))),i.has("id")&&!this.name&&this.id&&(this.name=this.id)}render(){const i=this.type==="search"&&!this.iconNameRight&&!this.omitSearchIcon,s=c.e({"pkt-input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":this.counter&&this.counterMaxLength&&this.value.length&&this.value.length>this.counterMaxLength}),n=this.ariaLabelledby||`${this.id}-input-label`;return t.x`
1
+ "use strict";const t=require("./element-aUzIoa1s.cjs"),a=require("./if-defined-BElHLTlB.cjs"),l=require("./state-GDzxl12x.cjs"),h=require("./ref-C5iJMIE1.cjs"),c=require("./class-map-CApIYSRo.cjs"),d=require("./input-element-RBQVA8i0.cjs"),x=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-rgXsRNkk.cjs");require("./icon-Dl9ZPqe6.cjs");var $=Object.defineProperty,f=Object.getOwnPropertyDescriptor,r=(u,i,s,n)=>{for(var e=n>1?void 0:n?f(i,s):i,o=u.length-1,p;o>=0;o--)(p=u[o])&&(e=(n?p(i,s,e):p(e))||e);return n&&e&&$(i,s,e),e};exports.PktTextinput=class extends d.PktInputElement{constructor(){super(),this.inputRef=h.e(),this.helptextSlot=h.e(),this.value="",this.type="text",this.size=null,this.autocomplete=null,this.iconNameRight=null,this.prefix=null,this.suffix=null,this.omitSearchIcon=!1,this.counterCurrent=0,this.slotController=new x.PktSlotController(this,this.helptextSlot)}attributeChangedCallback(i,s,n){i==="value"&&this.value!==s&&(this.counterCurrent=n?n.length:0,this.valueChanged(n,s)),super.attributeChangedCallback(i,s,n)}updated(i){var s;super.updated(i),i.has("value")&&(this.counterCurrent=((s=this.value)==null?void 0:s.length)||0,this.valueChanged(this.value,i.get("value"))),i.has("id")&&!this.name&&this.id&&(this.name=this.id)}render(){const i=this.type==="search"&&!this.iconNameRight&&!this.omitSearchIcon,s=c.e({"pkt-input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":this.counter&&this.counterMaxLength&&this.value.length&&this.value.length>this.counterMaxLength}),n=this.ariaLabelledby||`${this.id}-input-label`;return t.x`
2
2
  <pkt-input-wrapper
3
3
  label="${this.label}"
4
4
  ?counter=${this.counter}
@@ -1,12 +1,12 @@
1
- import { E as p, x as h, n as a, a as $ } from "./element-CRDRygXu.js";
2
- import { o as u } from "./if-defined-BWZGb3bh.js";
3
- import { r as f } from "./state-DS_kr2Fy.js";
4
- import { e as d, n as m } from "./ref-Xa5dbh--.js";
5
- import { e as g } from "./class-map-wy7PUk0P.js";
6
- import { P as x } from "./input-element-B8M8Nppd.js";
1
+ import { E as p, x as h, n as a, t as $ } from "./element-BXsf_NlG.js";
2
+ import { o as u } from "./if-defined-CxHgig4I.js";
3
+ import { r as f } from "./state-DgnkjP0q.js";
4
+ import { e as d, n as m } from "./ref-BxiKhrfa.js";
5
+ import { e as g } from "./class-map-Dt2jXOlF.js";
6
+ import { P as x } from "./input-element-DVZhYDJ_.js";
7
7
  import { P as v } from "./pkt-slot-controller-BPGj-LC5.js";
8
- import "./input-wrapper-1PCXqtiu.js";
9
- import "./icon-BB7e5iQN.js";
8
+ import "./input-wrapper-3qfjLkrP.js";
9
+ import "./icon-BgG6oO4Q.js";
10
10
  var y = Object.defineProperty, b = Object.getOwnPropertyDescriptor, o = (i, e, r, t) => {
11
11
  for (var n = t > 1 ? void 0 : t ? b(e, r) : e, l = i.length - 1, c; l >= 0; l--)
12
12
  (c = i[l]) && (n = (t ? c(e, r, n) : c(n)) || n);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-elements",
3
- "version": "14.3.0",
3
+ "version": "14.5.2",
4
4
  "description": "Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo",
5
5
  "homepage": "https://punkt.oslo.kommune.no",
6
6
  "author": "Team Designsystem, Oslo Origo",
@@ -79,5 +79,5 @@
79
79
  "url": "https://github.com/oslokommune/punkt/issues"
80
80
  },
81
81
  "license": "MIT",
82
- "gitHead": "892df7abaa2e9e117dc32b0c44c77592c80233cb"
82
+ "gitHead": "fd47b46c754cf9df72186df66db3f17d2bb925b4"
83
83
  }
@@ -23,7 +23,7 @@ type Props = ElementProps<
23
23
 
24
24
  @customElement('pkt-checkbox')
25
25
  export class PktCheckbox extends PktInputElement<Props> {
26
- private inputRef: Ref<HTMLInputElement> = createRef()
26
+ inputRef: Ref<HTMLInputElement> = createRef()
27
27
 
28
28
  @property({ type: String, reflect: true }) value: string = ''
29
29
  @property({ type: String }) checkHelptext: string | null = null
@@ -93,8 +93,8 @@ export class PktCombobox extends PktInputElement implements IPktCombobox {
93
93
 
94
94
  // State
95
95
  @state() _options: IPktComboboxOption[] = []
96
+ @state() _value: string[] = [] // Internal value representation
96
97
  @state() private _isOptionsOpen = false
97
- @state() private _value: string[] = []
98
98
  @state() private _userInfoMessage: string = ''
99
99
  @state() private _addValueText: string | null = null
100
100
  @state() private _maxIsReached: boolean = false
@@ -130,7 +130,7 @@ export class PktCombobox extends PktInputElement implements IPktCombobox {
130
130
  }
131
131
 
132
132
  // If options are provided via the options slot, we need to extract them
133
- if (this.optionsController.nodes.length) {
133
+ if (this.optionsController?.nodes && this.optionsController.nodes.length) {
134
134
  const options: IPktComboboxOption[] = []
135
135
  this.optionsController.nodes.forEach((node: Element) => {
136
136
  if (!node.textContent && !node.getAttribute('value')) return null
@@ -13,31 +13,6 @@ import { createRef } from 'lit/directives/ref.js'
13
13
 
14
14
  describe('datepicker-utils', () => {
15
15
  describe('valueUtils', () => {
16
- describe('normalizeNameForMultiple', () => {
17
- it('should return null when name is null', () => {
18
- expect(valueUtils.normalizeNameForMultiple(null, false, false)).toBe(null)
19
- expect(valueUtils.normalizeNameForMultiple(null, true, false)).toBe(null)
20
- expect(valueUtils.normalizeNameForMultiple(null, false, true)).toBe(null)
21
- })
22
-
23
- it('should add [] suffix for multiple inputs without []', () => {
24
- expect(valueUtils.normalizeNameForMultiple('dates', true, false)).toBe('dates[]')
25
- })
26
-
27
- it('should add [] suffix for range inputs without []', () => {
28
- expect(valueUtils.normalizeNameForMultiple('daterange', false, true)).toBe('daterange[]')
29
- })
30
-
31
- it('should not add [] suffix when already present', () => {
32
- expect(valueUtils.normalizeNameForMultiple('dates[]', true, false)).toBe('dates[]')
33
- expect(valueUtils.normalizeNameForMultiple('range[]', false, true)).toBe('range[]')
34
- })
35
-
36
- it('should not modify name for single inputs', () => {
37
- expect(valueUtils.normalizeNameForMultiple('singledate', false, false)).toBe('singledate')
38
- })
39
- })
40
-
41
16
  describe('validateRangeOrder', () => {
42
17
  it('should return true for incomplete ranges', () => {
43
18
  expect(valueUtils.validateRangeOrder([])).toBe(true)