@oslokommune/punkt-elements 13.5.9 → 13.5.11

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.
@@ -1,16 +1,16 @@
1
1
  import { e as f } from "./class-map-BpTj9gtz.js";
2
- import { o } from "./if-defined-CmuO4Vz9.js";
3
- import { x as p, E as g, n as r, a as R } from "./element-CgEWt74-.js";
4
- import { r as x } from "./state-Bo2bck5_.js";
5
- import { n as y, f as $, a as C, b, p as _, d as w } from "./calendar-CJSxvwAq.js";
6
- import { P as S } from "./input-element-NnrDmp4r.js";
7
- import { e as m, n as d } from "./ref-BBYSqgeW.js";
8
- import { c as T } from "./repeat-C8BeHwYx.js";
2
+ import { o as h } from "./if-defined-CmuO4Vz9.js";
3
+ import { x as u, E as g, n as r, a as R } from "./element-CgEWt74-.js";
4
+ import { r as k } from "./state-Bo2bck5_.js";
5
+ import { n as v, f as y, a as w, b as $, p as C, d as x } from "./calendar-CJSxvwAq.js";
6
+ import { P as _ } from "./input-element-NnrDmp4r.js";
7
+ import { e as m, n as p } from "./ref-BBYSqgeW.js";
8
+ import { c as S } from "./repeat-C8BeHwYx.js";
9
9
  import "./icon-CC1js8eR.js";
10
10
  import "./input-wrapper-Dr__Sxql.js";
11
11
  import "./tag-DyXzTY68.js";
12
- import { P as D } from "./pkt-slot-controller-BPGj-LC5.js";
13
- const I = {
12
+ import { P as T } from "./pkt-slot-controller-BPGj-LC5.js";
13
+ const D = {
14
14
  dateformat: {
15
15
  default: "dd.MM.yyyy"
16
16
  },
@@ -33,15 +33,15 @@ const I = {
33
33
  default: !1
34
34
  }
35
35
  }, c = {
36
- props: I
36
+ props: D
37
37
  };
38
- var P = Object.defineProperty, B = Object.getOwnPropertyDescriptor, n = (t, e, i, a) => {
39
- for (var s = a > 1 ? void 0 : a ? B(e, i) : e, h = t.length - 1, u; h >= 0; h--)
40
- (u = t[h]) && (s = (a ? u(e, i, s) : u(s)) || s);
41
- return a && s && P(e, i, s), s;
38
+ var I = Object.defineProperty, P = Object.getOwnPropertyDescriptor, n = (t, e, i, s) => {
39
+ for (var a = s > 1 ? void 0 : s ? P(e, i) : e, o = t.length - 1, d; o >= 0; o--)
40
+ (d = t[o]) && (a = (s ? d(e, i, a) : d(a)) || a);
41
+ return s && a && I(e, i, a), a;
42
42
  };
43
- const k = (t) => new Promise((e) => setTimeout(e, t));
44
- let l = class extends S {
43
+ const b = (t) => new Promise((e) => setTimeout(e, t));
44
+ let l = class extends _ {
45
45
  /**
46
46
  * Housekeeping / lifecycle methods
47
47
  */
@@ -49,9 +49,9 @@ let l = class extends S {
49
49
  super(), this._valueProperty = "", this._value = [], this.label = "Datovelger", this.dateformat = c.props.dateformat.default, this.multiple = c.props.multiple.default, this.maxlength = null, this.range = c.props.range.default, this.showRangeLabels = !1, this.min = null, this.max = null, this.weeknumbers = c.props.weeknumbers.default, this.withcontrols = c.props.withcontrols.default, this.excludedates = [], this.excludeweekdays = [], this.currentmonth = null, this.calendarOpen = !1, this.timezone = "Europe/Oslo", this.inputClasses = {}, this.buttonClasses = {}, this.inputRef = m(), this.inputRefTo = m(), this.btnRef = m(), this.calRef = m(), this.popupRef = m(), this.helptextSlot = m(), this.addToSelected = (t) => {
50
50
  const e = t.target;
51
51
  if (!e.value) return;
52
- const i = this.min ? y(this.min) : null, a = this.max ? y(this.max) : null, s = y(e.value.split(",")[0]);
53
- s && !isNaN(s.getTime()) && (!i || s >= i) && (!a || s <= a) && this.calRef.value && this.calRef.value.handleDateSelect(s), e.value = "";
54
- }, this.slotController = new D(this, this.helptextSlot);
52
+ const i = this.min ? v(this.min) : null, s = this.max ? v(this.max) : null, a = v(e.value.split(",")[0]);
53
+ a && !isNaN(a.getTime()) && (!i || a >= i) && (!s || a <= s) && this.calRef.value && this.calRef.value.handleDateSelect(a), e.value = "";
54
+ }, this.slotController = new T(this, this.helptextSlot);
55
55
  }
56
56
  get value() {
57
57
  return this._valueProperty;
@@ -64,11 +64,11 @@ let l = class extends S {
64
64
  super.connectedCallback();
65
65
  const t = navigator.userAgent, e = /iP(hone|od|ad)/.test(t);
66
66
  this.inputType = e ? "text" : "date", document && document.body.addEventListener("click", (i) => {
67
- var a, s;
68
- (a = this.inputRef) != null && a.value && ((s = this.btnRef) != null && s.value) && !this.inputRef.value.contains(i.target) && !(this.inputRefTo.value && this.inputRefTo.value.contains(i.target)) && !this.btnRef.value.contains(i.target) && !i.target.closest(".pkt-calendar-popup") && this.calendarOpen && (this.onBlur(), this.hideCalendar());
67
+ var s, a;
68
+ (s = this.inputRef) != null && s.value && ((a = this.btnRef) != null && a.value) && !this.inputRef.value.contains(i.target) && !(this.inputRefTo.value && this.inputRefTo.value.contains(i.target)) && !this.btnRef.value.contains(i.target) && !i.target.closest(".pkt-calendar-popup") && this.calendarOpen && (this.onBlur(), this.hideCalendar());
69
69
  }), document && document.body.addEventListener("keydown", (i) => {
70
70
  i.key === "Escape" && this.calendarOpen && this.hideCalendar();
71
- }), this.value && (this._value = Array.isArray(this.value) ? this.value.filter(Boolean) : this.value.split(",").filter(Boolean)), this.min = this.min || c.props.min.default, this.max = this.max || c.props.max.default, typeof this.excludedates == "string" && (this.excludedates = this.excludedates.split(",")), typeof this.excludeweekdays == "string" && (this.excludeweekdays = this.excludeweekdays.split(",")), (this.multiple || this.range) && this.name && !this.name.endsWith("[]") && (this.name = this.name + "[]"), this.calendarOpen && (await k(20), this.handleCalendarPosition());
71
+ }), this.value && (this._value = Array.isArray(this.value) ? this.value.filter(Boolean) : this.value.split(",").filter(Boolean)), this.min = this.min || c.props.min.default, this.max = this.max || c.props.max.default, typeof this.excludedates == "string" && (this.excludedates = this.excludedates.split(",")), typeof this.excludeweekdays == "string" && (this.excludeweekdays = this.excludeweekdays.split(",")), (this.multiple || this.range) && this.name && !this.name.endsWith("[]") && (this.name = this.name + "[]"), this.calendarOpen && (await b(20), this.handleCalendarPosition());
72
72
  }
73
73
  disconnectedCallback() {
74
74
  super.disconnectedCallback(), document && document.body.removeEventListener("click", (t) => {
@@ -80,27 +80,19 @@ let l = class extends S {
80
80
  this.dispatchEvent(new Event("input", { bubbles: !0 }));
81
81
  }
82
82
  valueChanged(t, e) {
83
- if (t !== e) {
84
- let i = [];
85
- if (t && (typeof t == "string" ? i = t.split(",").filter(Boolean) : i = String(t).split(",").filter(Boolean)), this.min || this.max) {
86
- const s = this.min ? new Date(this.min) : null, h = this.max ? new Date(this.max) : null;
87
- i = i.filter((u) => {
88
- const v = new Date(u);
89
- return !(isNaN(v.getTime()) || s && v < s || h && v > h);
90
- });
91
- }
92
- this._value = i;
93
- const a = i.join(",");
94
- this._valueProperty !== a && (this._valueProperty = a), super.valueChanged(a, e);
95
- }
83
+ if (t === e) return;
84
+ let i = [];
85
+ t && (typeof t == "string" ? i = t.split(",").filter(Boolean) : i = String(t).split(",").filter(Boolean)), this._value = i;
86
+ const s = i.join(",");
87
+ this._valueProperty !== s && (this._valueProperty = s), super.valueChanged(s, e);
96
88
  }
97
89
  attributeChangedCallback(t, e, i) {
98
90
  t === "value" && this.value !== e && this.valueChanged(i, e), t === "excludedates" && typeof this.excludedates == "string" && (this.excludedates = (i == null ? void 0 : i.split(",")) ?? []), t === "excludeweekdays" && typeof this.excludeweekdays == "string" && (this.excludeweekdays = (i == null ? void 0 : i.split(",")) ?? []), super.attributeChangedCallback(t, e, i);
99
91
  }
100
92
  updated(t) {
101
93
  if (t.has("value")) {
102
- const e = Array.isArray(this.value) ? this.value.join(",") : this.value, i = t.get("value"), a = Array.isArray(i) ? i.join(",") : i;
103
- this.valueChanged(e, a);
94
+ const e = Array.isArray(this.value) ? this.value.join(",") : this.value, i = t.get("value"), s = Array.isArray(i) ? i.join(",") : i;
95
+ this.valueChanged(e, s);
104
96
  }
105
97
  t.has("multiple") && (this.multiple && !Array.isArray(this._value) ? this._value = typeof this.value == "string" ? this.value ? this.value.split(",").filter(Boolean) : [] : [] : !this.multiple && Array.isArray(this._value) && (this._value = this._value.filter(Boolean)), !this.multiple && !this.range && Array.isArray(this._value) && (this._value = [this._value[0] ?? ""])), super.updated(t);
106
98
  }
@@ -108,15 +100,15 @@ let l = class extends S {
108
100
  * Rendering
109
101
  */
110
102
  renderInput() {
111
- return p`
103
+ return u`
112
104
  <input
113
105
  class="${f(this.inputClasses)}"
114
106
  .type=${this.inputType}
115
107
  id="${this.id}-input"
116
108
  .value=${this._value[0] ?? ""}
117
- min=${o(this.min)}
118
- max=${o(this.max)}
119
- placeholder=${o(this.placeholder)}
109
+ min=${h(this.min)}
110
+ max=${h(this.max)}
111
+ placeholder=${h(this.placeholder)}
120
112
  ?readonly=${this.readonly}
121
113
  aria-describedby="${this.id}-helptext"
122
114
  @click=${(t) => {
@@ -126,8 +118,8 @@ let l = class extends S {
126
118
  @keydown=${(t) => {
127
119
  var e, i;
128
120
  if (t.key === "," && ((e = this.inputRef.value) == null || e.blur()), (t.key === "Space" || t.key === " ") && (t.preventDefault(), this.toggleCalendar(t)), t.key === "Enter") {
129
- const a = this.internals.form;
130
- a ? a.requestSubmit() : (i = this.inputRef.value) == null || i.blur();
121
+ const s = this.internals.form;
122
+ s ? s.requestSubmit() : (i = this.inputRef.value) == null || i.blur();
131
123
  }
132
124
  }}
133
125
  @input=${(t) => {
@@ -143,7 +135,7 @@ let l = class extends S {
143
135
  @change=${(t) => {
144
136
  this.touched = !0, t.stopImmediatePropagation();
145
137
  }}
146
- ${d(this.inputRef)}
138
+ ${p(this.inputRef)}
147
139
  />
148
140
  `;
149
141
  }
@@ -152,26 +144,26 @@ let l = class extends S {
152
144
  "pkt-input-prefix": this.showRangeLabels,
153
145
  "pkt-hide": !this.showRangeLabels
154
146
  };
155
- return p`
156
- ${this.showRangeLabels ? p` <div class="pkt-input-prefix">${this.strings.generic.from}</div> ` : g}
147
+ return u`
148
+ ${this.showRangeLabels ? u` <div class="pkt-input-prefix">${this.strings.generic.from}</div> ` : g}
157
149
  <input
158
150
  class=${f(this.inputClasses)}
159
151
  .type=${this.inputType}
160
152
  id="${this.id}-input"
161
153
  .value=${this._value[0] ?? ""}
162
- min=${o(this.min)}
163
- max=${o(this.max)}
164
- placeholder=${o(this.placeholder)}
154
+ min=${h(this.min)}
155
+ max=${h(this.max)}
156
+ placeholder=${h(this.placeholder)}
165
157
  ?readonly=${this.readonly}
166
158
  ?disabled=${this.disabled}
167
159
  @click=${(e) => {
168
160
  e.preventDefault(), this.showCalendar();
169
161
  }}
170
162
  @keydown=${(e) => {
171
- var i, a;
163
+ var i, s;
172
164
  if (e.key === "," && ((i = this.inputRef.value) == null || i.blur()), (e.key === "Space" || e.key === " ") && (e.preventDefault(), this.toggleCalendar(e)), e.key === "Enter") {
173
- const s = this.internals.form;
174
- s ? s.requestSubmit() : (a = this.inputRefTo.value) == null || a.focus();
165
+ const a = this.internals.form;
166
+ a ? a.requestSubmit() : (s = this.inputRefTo.value) == null || s.focus();
175
167
  }
176
168
  }}
177
169
  @input=${(e) => {
@@ -181,41 +173,41 @@ let l = class extends S {
181
173
  this.onFocus(), this.isMobileSafari && this.showCalendar();
182
174
  }}
183
175
  @blur=${(e) => {
184
- var i, a;
176
+ var i, s;
185
177
  if (e.target.value) {
186
178
  this.manageValidity(e.target);
187
- const s = $(e.target.value);
188
- s && this._value[0] !== e.target.value && this._value[1] && (this.clearInputValue(), (a = (i = this.calRef) == null ? void 0 : i.value) == null || a.handleDateSelect(s));
179
+ const a = y(e.target.value);
180
+ a && this._value[0] !== e.target.value && this._value[1] && (this.clearInputValue(), (s = (i = this.calRef) == null ? void 0 : i.value) == null || s.handleDateSelect(a));
189
181
  } else this._value[0] && this.clearInputValue();
190
182
  }}
191
183
  @change=${(e) => {
192
184
  e.stopImmediatePropagation();
193
185
  }}
194
- ${d(this.inputRef)}
186
+ ${p(this.inputRef)}
195
187
  />
196
188
  <div class="${f(t)}" id="${this.id}-to-label">
197
189
  ${this.strings.generic.to}
198
190
  </div>
199
- ${this.showRangeLabels ? g : p` <div class="pkt-input-separator">–</div> `}
191
+ ${this.showRangeLabels ? g : u` <div class="pkt-input-separator">–</div> `}
200
192
  <input
201
193
  class=${f(this.inputClasses)}
202
194
  .type=${this.inputType}
203
195
  id="${this.id}-to"
204
196
  aria-labelledby="${this.id}-to-label"
205
197
  .value=${this._value[1] ?? ""}
206
- min=${o(this.min)}
207
- max=${o(this.max)}
208
- placeholder=${o(this.placeholder)}
198
+ min=${h(this.min)}
199
+ max=${h(this.max)}
200
+ placeholder=${h(this.placeholder)}
209
201
  ?readonly=${this.readonly}
210
202
  ?disabled=${this.disabled}
211
203
  @click=${(e) => {
212
204
  e.preventDefault(), this.showCalendar();
213
205
  }}
214
206
  @keydown=${(e) => {
215
- var i, a;
207
+ var i, s;
216
208
  if (e.key === "," && ((i = this.inputRefTo.value) == null || i.blur()), (e.key === "Space" || e.key === " ") && (e.preventDefault(), this.toggleCalendar(e)), e.key === "Enter") {
217
- const s = this.internals.form;
218
- s ? s.requestSubmit() : (a = this.inputRefTo.value) == null || a.blur();
209
+ const a = this.internals.form;
210
+ a ? a.requestSubmit() : (s = this.inputRefTo.value) == null || s.blur();
219
211
  }
220
212
  }}
221
213
  @input=${(e) => {
@@ -225,39 +217,39 @@ let l = class extends S {
225
217
  this.onFocus(), this.isMobileSafari && this.showCalendar();
226
218
  }}
227
219
  @blur=${(e) => {
228
- var i, a, s;
220
+ var i, s, a;
229
221
  if ((i = this.calRef.value) != null && i.contains(e.relatedTarget) || this.onBlur(), e.target.value) {
230
222
  this.manageValidity(e.target);
231
- const h = e.target.value;
232
- this.min && this.min > h ? this.internals.setValidity(
223
+ const o = e.target.value;
224
+ this.min && this.min > o ? this.internals.setValidity(
233
225
  { rangeUnderflow: !0 },
234
226
  this.strings.forms.messages.rangeUnderflow,
235
227
  e.target
236
- ) : this.max && this.max < h && this.internals.setValidity(
228
+ ) : this.max && this.max < o && this.internals.setValidity(
237
229
  { rangeOverflow: !0 },
238
230
  this.strings.forms.messages.rangeOverflow,
239
231
  e.target
240
232
  );
241
- const u = $(e.target.value);
242
- u && this._value[1] !== C(u) && ((s = (a = this.calRef) == null ? void 0 : a.value) == null || s.handleDateSelect(u));
233
+ const d = y(e.target.value);
234
+ d && this._value[1] !== w(d) && ((a = (s = this.calRef) == null ? void 0 : s.value) == null || a.handleDateSelect(d));
243
235
  }
244
236
  }}
245
237
  @change=${(e) => {
246
238
  this.touched = !0, e.stopImmediatePropagation();
247
239
  }}
248
- ${d(this.inputRefTo)}
240
+ ${p(this.inputRefTo)}
249
241
  />
250
242
  `;
251
243
  }
252
244
  renderMultipleInput() {
253
- return p`
245
+ return u`
254
246
  <input
255
247
  class=${f(this.inputClasses)}
256
248
  .type=${this.inputType}
257
249
  id="${this.id}-input"
258
- min=${o(this.min)}
259
- max=${o(this.max)}
260
- placeholder=${o(this.placeholder)}
250
+ min=${h(this.min)}
251
+ max=${h(this.max)}
252
+ placeholder=${h(this.placeholder)}
261
253
  ?readonly=${this.readonly}
262
254
  ?disabled=${this.disabled || this.maxlength && this._value.length >= this.maxlength}
263
255
  @click=${(t) => {
@@ -283,29 +275,29 @@ let l = class extends S {
283
275
  @change=${(t) => {
284
276
  this.touched = !0, t.stopImmediatePropagation();
285
277
  }}
286
- ${d(this.inputRef)}
278
+ ${p(this.inputRef)}
287
279
  />
288
280
  `;
289
281
  }
290
282
  renderTags() {
291
- return p`
283
+ return u`
292
284
  <div class="pkt-datepicker__tags" aria-live="polite">
293
- ${this._value[0] ? T(
285
+ ${this._value[0] ? S(
294
286
  (this._value ?? []).filter(Boolean).sort(),
295
287
  (t) => t,
296
- (t) => p`
288
+ (t) => u`
297
289
  <pkt-tag
298
290
  .id="${this.id + t + "-tag"}"
299
291
  closeTag
300
- ariaLabel="${this.strings.calendar.deleteDate} ${b(
292
+ ariaLabel="${this.strings.calendar.deleteDate} ${$(
301
293
  t,
302
294
  this.dateformat
303
295
  )}"
304
296
  @close=${() => {
305
297
  var e;
306
- return (e = this.calRef.value) == null ? void 0 : e.handleDateSelect($(t));
298
+ return (e = this.calRef.value) == null ? void 0 : e.handleDateSelect(y(t));
307
299
  }}
308
- ><time datetime="${t}">${b(t, this.dateformat)}</time></pkt-tag
300
+ ><time datetime="${t}">${$(t, this.dateformat)}</time></pkt-tag
309
301
  >
310
302
  `
311
303
  ) : g}
@@ -313,13 +305,13 @@ let l = class extends S {
313
305
  `;
314
306
  }
315
307
  renderCalendar() {
316
- return p`<div
308
+ return u`<div
317
309
  class="pkt-calendar-popup pkt-${this.calendarOpen ? "show" : "hide"}"
318
310
  @focusout=${(t) => {
319
311
  this.calendarOpen && this.handleFocusOut(t);
320
312
  }}
321
313
  id="${this.id}-popup"
322
- ${d(this.popupRef)}
314
+ ${p(this.popupRef)}
323
315
  >
324
316
  <pkt-calendar
325
317
  id="${this.id}-calendar"
@@ -333,14 +325,14 @@ let l = class extends S {
333
325
  .latest=${this.max}
334
326
  .excludedates=${Array.isArray(this.excludedates) ? this.excludedates : this.excludedates.split(",")}
335
327
  .excludeweekdays=${this.excludeweekdays}
336
- .currentmonth=${this.currentmonth ? _(this.currentmonth) : null}
328
+ .currentmonth=${this.currentmonth ? C(this.currentmonth) : null}
337
329
  @date-selected=${(t) => {
338
330
  this.value = !this.multiple && !this.range ? t.detail[0] : Array.isArray(t.detail) ? t.detail.join(",") : t.detail, this._value = t.detail, this.inputRef.value && (this.range && this.inputRefTo.value ? (this.inputRef.value.value = this._value[0] ?? "", this.inputRefTo.value.value = this._value[1] ?? "", this.manageValidity(this.inputRef.value), this.manageValidity(this.inputRefTo.value)) : this.multiple || (this.inputRef.value.value = this._value.length ? this._value[0] : "", this.manageValidity(this.inputRef.value)));
339
331
  }}
340
332
  @close=${() => {
341
333
  this.onBlur(), this.hideCalendar();
342
334
  }}
343
- ${d(this.calRef)}
335
+ ${p(this.calRef)}
344
336
  ></pkt-calendar>
345
337
  </div>`;
346
338
  }
@@ -358,7 +350,7 @@ let l = class extends S {
358
350
  "pkt-btn--icon-only": !0,
359
351
  "pkt-btn--tertiary": !0,
360
352
  "pkt-datepicker__calendar-button": !0
361
- }, p`
353
+ }, u`
362
354
  <pkt-input-wrapper
363
355
  label="${this.label}"
364
356
  forId="${this.id}-input"
@@ -383,7 +375,7 @@ let l = class extends S {
383
375
  .ariaDescribedBy=${this.ariaDescribedBy}
384
376
  class="pkt-datepicker"
385
377
  >
386
- <div class="pkt-contents" ${d(this.helptextSlot)} name="helptext" slot="helptext"></div>
378
+ <div class="pkt-contents" ${p(this.helptextSlot)} name="helptext" slot="helptext"></div>
387
379
  ${this.multiple ? this.renderTags() : g}
388
380
  <div
389
381
  class="pkt-datepicker__inputs ${this.range && this.showRangeLabels ? "pkt-input__range-inputs" : ""}"
@@ -398,7 +390,7 @@ let l = class extends S {
398
390
  (t.key === "Enter" || t.key === " " || t.key === "Space") && (t.preventDefault(), this.toggleCalendar(t));
399
391
  }}
400
392
  ?disabled=${this.disabled}
401
- ${d(this.btnRef)}
393
+ ${p(this.btnRef)}
402
394
  >
403
395
  <pkt-icon name="calendar"></pkt-icon>
404
396
  <span class="pkt-btn__text">${this.strings.calendar.buttonAltText}</span>
@@ -415,9 +407,9 @@ let l = class extends S {
415
407
  handleCalendarPosition() {
416
408
  var t;
417
409
  if (this.popupRef.value && this.inputRef.value) {
418
- const e = this.multiple && !!this.maxlength, i = ((t = this.inputRef.value.parentElement) == null ? void 0 : t.getBoundingClientRect()) || this.inputRef.value.getBoundingClientRect(), a = e ? i.height + 30 : i.height, s = this.popupRef.value.getBoundingClientRect().height;
419
- let h = e ? "calc(100% - 30px)" : "100%";
420
- i && i.top + s > window.innerHeight && i.top - s > 0 && (h = `calc(100% - ${a}px - ${s}px)`), this.popupRef.value.style.top = h;
410
+ const e = this.multiple && !!this.maxlength, i = ((t = this.inputRef.value.parentElement) == null ? void 0 : t.getBoundingClientRect()) || this.inputRef.value.getBoundingClientRect(), s = e ? i.height + 30 : i.height, a = this.popupRef.value.getBoundingClientRect().height;
411
+ let o = e ? "calc(100% - 30px)" : "100%";
412
+ i && i.top + a > window.innerHeight && i.top - a > 0 && (o = `calc(100% - ${s}px - ${a}px)`), this.popupRef.value.style.top = o;
421
413
  }
422
414
  }
423
415
  handleFocusOut(t) {
@@ -425,7 +417,7 @@ let l = class extends S {
425
417
  }
426
418
  async showCalendar() {
427
419
  var t;
428
- this.calendarOpen = !0, await k(20), this.handleCalendarPosition(), this.isMobileSafari && ((t = this.calRef.value) == null || t.focusOnCurrentDate());
420
+ this.calendarOpen = !0, await b(20), this.handleCalendarPosition(), this.isMobileSafari && ((t = this.calRef.value) == null || t.focusOnCurrentDate());
429
421
  }
430
422
  hideCalendar() {
431
423
  this.calendarOpen = !1;
@@ -474,10 +466,10 @@ n([
474
466
  r({ type: Boolean, reflect: !0 })
475
467
  ], l.prototype, "withcontrols", 2);
476
468
  n([
477
- r({ converter: w.csvToArray })
469
+ r({ converter: x.csvToArray })
478
470
  ], l.prototype, "excludedates", 2);
479
471
  n([
480
- r({ converter: w.csvToArray })
472
+ r({ converter: x.csvToArray })
481
473
  ], l.prototype, "excludeweekdays", 2);
482
474
  n([
483
475
  r({ type: String })
@@ -489,10 +481,10 @@ n([
489
481
  r({ type: String })
490
482
  ], l.prototype, "timezone", 2);
491
483
  n([
492
- x()
484
+ k()
493
485
  ], l.prototype, "inputClasses", 2);
494
486
  n([
495
- x()
487
+ k()
496
488
  ], l.prototype, "buttonClasses", 2);
497
489
  l = n([
498
490
  R("pkt-datepicker")
package/dist/index.d.ts CHANGED
@@ -571,6 +571,7 @@ export declare class PktCombobox extends PktInputElement implements IPktCombobox
571
571
  private handleFocusOut;
572
572
  private handleBlur;
573
573
  private handleInputClick;
574
+ private handlePlaceholderClick;
574
575
  private handleArrowClick;
575
576
  private handleOptionToggled;
576
577
  private handleSearch;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./combobox-DjO0RMUB.cjs"),o=e.PktCombobox;Object.defineProperty(exports,"PktCombobox",{enumerable:!0,get:()=>e.PktCombobox});exports.default=o;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./combobox-D84REr9N.cjs"),o=e.PktCombobox;Object.defineProperty(exports,"PktCombobox",{enumerable:!0,get:()=>e.PktCombobox});exports.default=o;
@@ -1,4 +1,4 @@
1
- import { P as o } from "./combobox-yE4aYhTi.js";
1
+ import { P as o } from "./combobox-BXP1PL0M.js";
2
2
  const b = o;
3
3
  export {
4
4
  o as PktCombobox,
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./datepicker-CmTrG5GE.cjs"),t=e.PktDatepicker;Object.defineProperty(exports,"PktDatepicker",{enumerable:!0,get:()=>e.PktDatepicker});exports.default=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./datepicker-DonUad47.cjs"),t=e.PktDatepicker;Object.defineProperty(exports,"PktDatepicker",{enumerable:!0,get:()=>e.PktDatepicker});exports.default=t;
@@ -1,4 +1,4 @@
1
- import { P as t } from "./datepicker-BJKJBoy_.js";
1
+ import { P as t } from "./datepicker-F3TwE9o7.js";
2
2
  const a = t;
3
3
  export {
4
4
  t as PktDatepicker,
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("./alert-7rUOhlNi.cjs"),l=require("./accordionitem-Csh7iSVG.cjs"),d=require("./backlink-JbBNi3qg.cjs"),b=require("./button-B8rdtaHB.cjs"),k=require("./calendar-32W9p9uc.cjs"),m=require("./card-DBlFf1ry.cjs"),g=require("./combobox-DjO0RMUB.cjs"),h=require("./consent-hYeFWNFr.cjs"),f=require("./checkbox-Gn7Wtk9h.cjs"),t=require("./element-6DBpyGQm.cjs"),y=require("./pkt-slot-controller-BzddBp7z.cjs"),s=require("./ref-iJtiv3o2.cjs"),O=require("./class-map-BBG2gMX4.cjs"),j=require("./datepicker-CmTrG5GE.cjs"),q=require("./helptext-CzQX6YVE.cjs"),x=require("./heading-CNycsyMj.cjs"),C=require("./icon-B_ryAy4Q.cjs"),v=require("./input-wrapper-CZ-a00V7.cjs"),S=require("./link-Cjl0xwSq.cjs"),$=require("./linkcard-DqIvb54H.cjs"),L=require("./loader-DNidjwH-.cjs"),_=require("./messagebox-CjPtPPrW.cjs"),A=require("./modal-CRtxhCaP.cjs"),B=require("./progressbar-DhMBXkww.cjs"),p=require("./radiobutton-CdT6v1oq.cjs"),T=require("./tag-Bbs0U_Au.cjs"),I=require("./textarea-CPXsMFUq.cjs"),M=require("./textinput-aNI5kibM.cjs"),R=require("./select-CD6Zn8YH.cjs");var H=Object.defineProperty,w=Object.getOwnPropertyDescriptor,o=(a,e,r,i)=>{for(var n=i>1?void 0:i?w(e,r):e,u=a.length-1,c;u>=0;u--)(c=a[u])&&(n=(i?c(e,r,n):c(n))||n);return i&&n&&H(e,r,n),n};exports.PktComponent=class extends t.PktElement{constructor(){super(),this.string="",this.strings=[],this.darkmode=!1,this._list=[],this.defaultSlot=s.e(),this.namedSlot=s.e(),this.slotController=new y.PktSlotController(this,this.defaultSlot,this.namedSlot)}connectedCallback(){this.strings.length&&this.strings.forEach(e=>{this._list.push(e.toUpperCase())}),super.connectedCallback()}render(){const e={"pkt-component":!0,"pkt-component--has-list":this.strings.length>0,"pkt-darkmode":this.darkmode};return t.x`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("./alert-7rUOhlNi.cjs"),l=require("./accordionitem-Csh7iSVG.cjs"),d=require("./backlink-JbBNi3qg.cjs"),b=require("./button-B8rdtaHB.cjs"),k=require("./calendar-32W9p9uc.cjs"),m=require("./card-DBlFf1ry.cjs"),g=require("./combobox-D84REr9N.cjs"),h=require("./consent-hYeFWNFr.cjs"),f=require("./checkbox-Gn7Wtk9h.cjs"),t=require("./element-6DBpyGQm.cjs"),y=require("./pkt-slot-controller-BzddBp7z.cjs"),s=require("./ref-iJtiv3o2.cjs"),O=require("./class-map-BBG2gMX4.cjs"),j=require("./datepicker-DonUad47.cjs"),q=require("./helptext-CzQX6YVE.cjs"),x=require("./heading-CNycsyMj.cjs"),C=require("./icon-B_ryAy4Q.cjs"),v=require("./input-wrapper-CZ-a00V7.cjs"),S=require("./link-Cjl0xwSq.cjs"),$=require("./linkcard-DqIvb54H.cjs"),L=require("./loader-DNidjwH-.cjs"),_=require("./messagebox-CjPtPPrW.cjs"),A=require("./modal-CRtxhCaP.cjs"),B=require("./progressbar-DhMBXkww.cjs"),p=require("./radiobutton-CdT6v1oq.cjs"),T=require("./tag-Bbs0U_Au.cjs"),I=require("./textarea-CPXsMFUq.cjs"),M=require("./textinput-aNI5kibM.cjs"),R=require("./select-CD6Zn8YH.cjs");var H=Object.defineProperty,w=Object.getOwnPropertyDescriptor,o=(a,e,r,i)=>{for(var n=i>1?void 0:i?w(e,r):e,u=a.length-1,c;u>=0;u--)(c=a[u])&&(n=(i?c(e,r,n):c(n))||n);return i&&n&&H(e,r,n),n};exports.PktComponent=class extends t.PktElement{constructor(){super(),this.string="",this.strings=[],this.darkmode=!1,this._list=[],this.defaultSlot=s.e(),this.namedSlot=s.e(),this.slotController=new y.PktSlotController(this,this.defaultSlot,this.namedSlot)}connectedCallback(){this.strings.length&&this.strings.forEach(e=>{this._list.push(e.toUpperCase())}),super.connectedCallback()}render(){const e={"pkt-component":!0,"pkt-component--has-list":this.strings.length>0,"pkt-darkmode":this.darkmode};return t.x`
2
2
  <div class="${O.e(e)}">
3
3
  <h1 class="pkt-txt-28">${this.string}</h1>
4
4
 
package/dist/pkt-index.js CHANGED
@@ -5,14 +5,14 @@ import { P as T } from "./button-DhispFOY.js";
5
5
  import { c as f } from "./calendar-CJSxvwAq.js";
6
6
  import { P as D } from "./calendar-CJSxvwAq.js";
7
7
  import { P as G } from "./card-BDz4RWxK.js";
8
- import { P as K } from "./combobox-yE4aYhTi.js";
8
+ import { P as K } from "./combobox-BXP1PL0M.js";
9
9
  import { P as U } from "./consent-BpcQFvbi.js";
10
10
  import { P as q } from "./checkbox-ym7z6cpt.js";
11
11
  import { P as k, t as h, x as P, n, a as c } from "./element-CgEWt74-.js";
12
12
  import { P as x } from "./pkt-slot-controller-BPGj-LC5.js";
13
13
  import { e as m, n as d } from "./ref-BBYSqgeW.js";
14
14
  import { e as u } from "./class-map-BpTj9gtz.js";
15
- import { P as F } from "./datepicker-BJKJBoy_.js";
15
+ import { P as F } from "./datepicker-F3TwE9o7.js";
16
16
  import { P as Q } from "./helptext-B7eI0iBQ.js";
17
17
  import { P as X } from "./heading-Bdh9absf.js";
18
18
  import { P as Z } from "./icon-CC1js8eR.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-elements",
3
- "version": "13.5.9",
3
+ "version": "13.5.11",
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",
@@ -41,7 +41,7 @@
41
41
  "@babel/preset-env": "^7.28.3",
42
42
  "@babel/preset-typescript": "^7.25.9",
43
43
  "@oslokommune/punkt-assets": "^13.3.1",
44
- "@oslokommune/punkt-css": "^13.5.0",
44
+ "@oslokommune/punkt-css": "^13.5.11",
45
45
  "@testing-library/jest-dom": "^6.6.3",
46
46
  "@vitest/ui": "^1.0.0",
47
47
  "jest-axe": "^9.0.0",
@@ -73,5 +73,5 @@
73
73
  "url": "https://github.com/oslokommune/punkt/issues"
74
74
  },
75
75
  "license": "MIT",
76
- "gitHead": "92ee2058dae920d5ab968d8a1691f435a795e2ca"
76
+ "gitHead": "09ba8de9047136b06b520d7208b31a1743bcf1d7"
77
77
  }
@@ -191,7 +191,6 @@ export class PktCombobox extends PktInputElement implements IPktCombobox {
191
191
  const filteredUserAdded = userAddedValues.filter(
192
192
  (userOpt) => !this.options.some((opt) => opt.value === userOpt.value),
193
193
  )
194
- // Merge, giving precedence to this.options
195
194
  this._options = [...filteredUserAdded, ...this.options]
196
195
  this._options.forEach((option) => {
197
196
  if (option.value && !option.label) {
@@ -287,7 +286,9 @@ export class PktCombobox extends PktInputElement implements IPktCombobox {
287
286
  ${this.placeholder &&
288
287
  (!this._value.length || (this.multiple && this.tagPlacement == 'outside')) &&
289
288
  !this._inputFocus
290
- ? html`<span class="pkt-combobox__placeholder">${this.placeholder}</span>`
289
+ ? html`<span class="pkt-combobox__placeholder" @click=${this.handlePlaceholderClick}
290
+ >${this.placeholder}</span
291
+ >`
291
292
  : this.tagPlacement !== 'outside'
292
293
  ? this.renderSingleOrMultipleValues()
293
294
  : nothing}
@@ -315,7 +316,12 @@ export class PktCombobox extends PktInputElement implements IPktCombobox {
315
316
  name="chevron-thin-down"
316
317
  ></pkt-icon>
317
318
  </div>
318
- <div ${ref(this.focusRef)} tabindex="-1" @keydown=${this.handleArrowClick}></div>
319
+ <div
320
+ ${ref(this.focusRef)}
321
+ tabindex="-1"
322
+ @keydown=${this.handleArrowClick}
323
+ class="pkt-contents"
324
+ ></div>
319
325
  </div>
320
326
 
321
327
  <pkt-listbox
@@ -421,12 +427,18 @@ export class PktCombobox extends PktInputElement implements IPktCombobox {
421
427
  if (!option) return ''
422
428
  switch (this.displayValueAs) {
423
429
  case 'prefixAndValue':
424
- return html`<span data-focusfix=${this.id}>${option.prefix || ''} ${option.value}</span>`
430
+ return html`<span class="pkt-combobox__value" data-focusfix=${this.id}
431
+ >${option.prefix || ''} ${option.value}</span
432
+ >`
425
433
  case 'value':
426
- return html`<span data-focusfix=${this.id}>${option.value}</span>`
434
+ return html`<span class="pkt-combobox__value" data-focusfix=${this.id}
435
+ >${option.value}</span
436
+ >`
427
437
  case 'label':
428
438
  default:
429
- return html`<span data-focusfix=${this.id}>${option.label || option.value}</span>`
439
+ return html`<span class="pkt-combobox__value" data-focusfix=${this.id}
440
+ >${option.label || option.value}</span
441
+ >`
430
442
  }
431
443
  }
432
444
 
@@ -499,7 +511,7 @@ export class PktCombobox extends PktInputElement implements IPktCombobox {
499
511
  this._isOptionsOpen = true
500
512
  this.onFocus()
501
513
 
502
- this.requestUpdate() // Ensure the UI updates
514
+ this.requestUpdate()
503
515
  }
504
516
 
505
517
  private handleFocusOut(e: FocusEvent): void {
@@ -559,11 +571,22 @@ export class PktCombobox extends PktInputElement implements IPktCombobox {
559
571
  this.inputRef.value?.type !== 'hidden'
560
572
  ) {
561
573
  this.inputRef.value?.focus()
574
+ this.requestUpdate()
562
575
  } else {
563
576
  this.handleArrowClick(e)
564
577
  }
565
578
  }
566
579
 
580
+ private handlePlaceholderClick(e: MouseEvent): void {
581
+ if (this.disabled) return
582
+ e.stopPropagation()
583
+ if (this.inputRef.value && this.inputRef.value.type !== 'hidden') {
584
+ this.inputRef.value.focus()
585
+ this._inputFocus = true
586
+ this.requestUpdate()
587
+ }
588
+ }
589
+
567
590
  private handleArrowClick(e: MouseEvent | KeyboardEvent): void {
568
591
  if (this.disabled) return
569
592
 
@@ -616,7 +639,7 @@ export class PktCombobox extends PktInputElement implements IPktCombobox {
616
639
  break
617
640
  case 'Escape':
618
641
  this._isOptionsOpen = false
619
- this.arrowRef.value?.focus() // Return focus to the button
642
+ this.arrowRef.value?.focus()
620
643
  e.preventDefault()
621
644
  break
622
645
  default: