@oslokommune/punkt-react 12.11.0 → 12.11.1

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.
@@ -4990,38 +4990,38 @@ let Ie = class extends Pe {
4990
4990
  "pkt-btn": !0,
4991
4991
  "pkt-btn--icon-only": !0,
4992
4992
  "pkt-btn--tertiary": !0
4993
- }, this.addToSelected = (t) => {
4994
- const n = t.target;
4995
- if (!n.value) return;
4996
- const r = this.min ? He(this.min) : null, i = this.max ? He(this.max) : null, o = He(n.value.split(",")[0]);
4997
- o && !isNaN(o.getTime()) && (!r || o >= r) && (!i || o <= i) && this.calRef.value && this.calRef.value.handleDateSelect(o), n.value = "";
4993
+ }, this.addToSelected = (e) => {
4994
+ const t = e.target;
4995
+ if (!t.value) return;
4996
+ const n = this.min ? He(this.min) : null, r = this.max ? He(this.max) : null, i = He(t.value.split(",")[0]);
4997
+ i && !isNaN(i.getTime()) && (!n || i >= n) && (!r || i <= r) && this.calRef.value && this.calRef.value.handleDateSelect(i), t.value = "";
4998
4998
  };
4999
4999
  }
5000
5000
  /**
5001
5001
  * Housekeeping / lifecycle methods
5002
5002
  */
5003
5003
  async connectedCallback() {
5004
- super.connectedCallback(), this.isMobileSafari = /iP(ad|od|hone)/i.test(window.navigator.userAgent) && !!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/), this.inputType = this.isMobileSafari ? "text" : "date", document && document.body.addEventListener("click", (t) => {
5005
- var n, r;
5006
- (n = this.inputRef) != null && n.value && (r = this.btnRef) != null && r.value && !this.inputRef.value.contains(t.target) && !(this.inputRefTo.value && this.inputRefTo.value.contains(t.target)) && !this.btnRef.value.contains(t.target) && !t.target.closest(".pkt-calendar-popup") && this.calendarOpen && (this.onBlur(), this.hideCalendar());
5004
+ super.connectedCallback(), this.isMobileSafari = /iP(ad|od|hone)/i.test(window.navigator.userAgent) && !!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/), this.inputType = this.isMobileSafari ? "text" : "date", document && document.body.addEventListener("click", (e) => {
5005
+ var t, n;
5006
+ (t = this.inputRef) != null && t.value && (n = this.btnRef) != null && n.value && !this.inputRef.value.contains(e.target) && !(this.inputRefTo.value && this.inputRefTo.value.contains(e.target)) && !this.btnRef.value.contains(e.target) && !e.target.closest(".pkt-calendar-popup") && this.calendarOpen && (this.onBlur(), this.hideCalendar());
5007
5007
  }), this.value.length && this._value.length === 0 && (this._value = Array.isArray(this.value) ? this.value : this.value.split(",")), this.min = this.min || Dn.props.min.default, this.max = this.max || Dn.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 uc(20), this.handleCalendarPosition());
5008
5008
  }
5009
5009
  disconnectedCallback() {
5010
- super.disconnectedCallback(), document && document.body.removeEventListener("click", (t) => {
5011
- var n, r;
5012
- (n = this.inputRef) != null && n.value && (r = this.btnRef) != null && r.value && !this.inputRef.value.contains(t.target) && !this.btnRef.value.contains(t.target) && this.hideCalendar();
5010
+ super.disconnectedCallback(), document && document.body.removeEventListener("click", (e) => {
5011
+ var t, n;
5012
+ (t = this.inputRef) != null && t.value && (n = this.btnRef) != null && n.value && !this.inputRef.value.contains(e.target) && !this.btnRef.value.contains(e.target) && this.hideCalendar();
5013
5013
  });
5014
5014
  }
5015
- attributeChangedCallback(t, n, r) {
5016
- t === "value" && this.valueChanged(this.value, n), t === "excludedates" && typeof this.excludedates == "string" && (this.excludedates = (r == null ? void 0 : r.split(",")) ?? []), t === "excludeweekdays" && typeof this.excludeweekdays == "string" && (this.excludeweekdays = (r == null ? void 0 : r.split(",")) ?? []), super.attributeChangedCallback(t, n, r);
5015
+ attributeChangedCallback(e, t, n) {
5016
+ e === "value" && this.valueChanged(this.value, t), e === "excludedates" && typeof this.excludedates == "string" && (this.excludedates = (n == null ? void 0 : n.split(",")) ?? []), e === "excludeweekdays" && typeof this.excludeweekdays == "string" && (this.excludeweekdays = (n == null ? void 0 : n.split(",")) ?? []), super.attributeChangedCallback(e, t, n);
5017
5017
  }
5018
- firstUpdated(t) {
5019
- super.firstUpdated(t);
5018
+ firstUpdated(e) {
5019
+ super.firstUpdated(e);
5020
5020
  }
5021
- updated(t) {
5022
- if (super.updated(t), t.has("value")) {
5021
+ updated(e) {
5022
+ if (super.updated(e), e.has("value")) {
5023
5023
  if (this.range && this._value.length === 1) return;
5024
- this.valueChanged(this.value, t.get("value"));
5024
+ this.valueChanged(this.value, e.get("value"));
5025
5025
  }
5026
5026
  }
5027
5027
  /**
@@ -5036,26 +5036,26 @@ let Ie = class extends Pe {
5036
5036
  .value=${this._value[0] ?? ""}
5037
5037
  min=${this.min}
5038
5038
  max=${this.max}
5039
- @click=${(t) => {
5040
- t.preventDefault(), this.showCalendar();
5039
+ @click=${(e) => {
5040
+ e.preventDefault(), this.showCalendar();
5041
5041
  }}
5042
5042
  ?disabled=${this.disabled}
5043
- @keydown=${(t) => {
5044
- var n;
5045
- (t.key === "," || t.key === "Enter") && ((n = this.inputRef.value) == null || n.blur()), (t.key === "Space" || t.key === " ") && (t.preventDefault(), this.toggleCalendar(t));
5043
+ @keydown=${(e) => {
5044
+ var t;
5045
+ (e.key === "," || e.key === "Enter") && ((t = this.inputRef.value) == null || t.blur()), (e.key === "Space" || e.key === " ") && (e.preventDefault(), this.toggleCalendar(e));
5046
5046
  }}
5047
- @input=${(t) => {
5048
- this.onInput(), t.stopImmediatePropagation();
5047
+ @input=${(e) => {
5048
+ this.onInput(), e.stopImmediatePropagation();
5049
5049
  }}
5050
5050
  @focus=${() => {
5051
5051
  this.onFocus(), this.isMobileSafari && this.showCalendar();
5052
5052
  }}
5053
- @blur=${(t) => {
5054
- var n;
5055
- (n = this.calRef.value) != null && n.contains(t.relatedTarget) || this.onBlur(), this.manageValidity(t.target), this.value = t.target.value;
5053
+ @blur=${(e) => {
5054
+ var t;
5055
+ (t = this.calRef.value) != null && t.contains(e.relatedTarget) || this.onBlur(), this.manageValidity(e.target), this.value = e.target.value;
5056
5056
  }}
5057
- @change=${(t) => {
5058
- t.stopImmediatePropagation();
5057
+ @change=${(e) => {
5058
+ e.stopImmediatePropagation();
5059
5059
  }}
5060
5060
  ${Ze(this.inputRef)}
5061
5061
  />
@@ -5071,30 +5071,30 @@ let Ie = class extends Pe {
5071
5071
  .value=${this._value[0] ?? ""}
5072
5072
  min=${this.min}
5073
5073
  max=${this.max}
5074
- @click=${(t) => {
5075
- t.preventDefault(), this.showCalendar();
5074
+ @click=${(e) => {
5075
+ e.preventDefault(), this.showCalendar();
5076
5076
  }}
5077
5077
  ?disabled=${this.disabled}
5078
- @keydown=${(t) => {
5079
- var n;
5080
- (t.key === "," || t.key === "Enter") && ((n = this.inputRef.value) == null || n.blur()), (t.key === "Space" || t.key === " ") && (t.preventDefault(), this.toggleCalendar(t));
5078
+ @keydown=${(e) => {
5079
+ var t;
5080
+ (e.key === "," || e.key === "Enter") && ((t = this.inputRef.value) == null || t.blur()), (e.key === "Space" || e.key === " ") && (e.preventDefault(), this.toggleCalendar(e));
5081
5081
  }}
5082
- @input=${(t) => {
5083
- this.onInput(), t.stopImmediatePropagation();
5082
+ @input=${(e) => {
5083
+ this.onInput(), e.stopImmediatePropagation();
5084
5084
  }}
5085
5085
  @focus=${() => {
5086
5086
  this.onFocus(), this.isMobileSafari && this.showCalendar();
5087
5087
  }}
5088
- @blur=${(t) => {
5089
- var n, r;
5090
- if (t.target.value) {
5091
- this.manageValidity(t.target);
5092
- const i = Gs(t.target.value);
5093
- i && this._value[0] !== t.target.value && this._value[1] && (this.clearInputValue(), (r = (n = this.calRef) == null ? void 0 : n.value) == null || r.handleDateSelect(i));
5088
+ @blur=${(e) => {
5089
+ var t, n;
5090
+ if (e.target.value) {
5091
+ this.manageValidity(e.target);
5092
+ const r = Gs(e.target.value);
5093
+ r && this._value[0] !== e.target.value && this._value[1] && (this.clearInputValue(), (n = (t = this.calRef) == null ? void 0 : t.value) == null || n.handleDateSelect(r));
5094
5094
  } else this._value[0] && this.clearInputValue();
5095
5095
  }}
5096
- @change=${(t) => {
5097
- t.stopImmediatePropagation();
5096
+ @change=${(e) => {
5097
+ e.stopImmediatePropagation();
5098
5098
  }}
5099
5099
  ${Ze(this.inputRef)}
5100
5100
  />
@@ -5107,40 +5107,40 @@ let Ie = class extends Pe {
5107
5107
  .value=${this._value[1] ?? ""}
5108
5108
  min=${this.min}
5109
5109
  max=${this.max}
5110
- @click=${(t) => {
5111
- t.preventDefault(), this.showCalendar();
5110
+ @click=${(e) => {
5111
+ e.preventDefault(), this.showCalendar();
5112
5112
  }}
5113
5113
  ?disabled=${this.disabled}
5114
- @keydown=${(t) => {
5115
- var n;
5116
- (t.key === "," || t.key === "Enter") && ((n = this.inputRefTo.value) == null || n.blur()), (t.key === "Space" || t.key === " ") && (t.preventDefault(), this.toggleCalendar(t));
5114
+ @keydown=${(e) => {
5115
+ var t;
5116
+ (e.key === "," || e.key === "Enter") && ((t = this.inputRefTo.value) == null || t.blur()), (e.key === "Space" || e.key === " ") && (e.preventDefault(), this.toggleCalendar(e));
5117
5117
  }}
5118
- @input=${(t) => {
5119
- this.onInput(), t.stopImmediatePropagation();
5118
+ @input=${(e) => {
5119
+ this.onInput(), e.stopImmediatePropagation();
5120
5120
  }}
5121
5121
  @focus=${() => {
5122
5122
  this.onFocus(), this.isMobileSafari && this.showCalendar();
5123
5123
  }}
5124
- @blur=${(t) => {
5125
- var n, r, i;
5126
- if ((n = this.calRef.value) != null && n.contains(t.relatedTarget) || this.onBlur(), t.target.value) {
5127
- this.manageValidity(t.target);
5128
- const o = t.target.value;
5129
- this.min && this.min > o ? this.internals.setValidity(
5124
+ @blur=${(e) => {
5125
+ var t, n, r;
5126
+ if ((t = this.calRef.value) != null && t.contains(e.relatedTarget) || this.onBlur(), e.target.value) {
5127
+ this.manageValidity(e.target);
5128
+ const i = e.target.value;
5129
+ this.min && this.min > i ? this.internals.setValidity(
5130
5130
  { rangeUnderflow: !0 },
5131
5131
  this.strings.forms.messages.rangeUnderflow,
5132
- t.target
5133
- ) : this.max && this.max < o && this.internals.setValidity(
5132
+ e.target
5133
+ ) : this.max && this.max < i && this.internals.setValidity(
5134
5134
  { rangeOverflow: !0 },
5135
5135
  this.strings.forms.messages.rangeOverflow,
5136
- t.target
5136
+ e.target
5137
5137
  );
5138
- const u = Gs(t.target.value);
5139
- u && this._value[1] !== Je(u) && ((i = (r = this.calRef) == null ? void 0 : r.value) == null || i.handleDateSelect(u));
5138
+ const o = Gs(e.target.value);
5139
+ o && this._value[1] !== Je(o) && ((r = (n = this.calRef) == null ? void 0 : n.value) == null || r.handleDateSelect(o));
5140
5140
  }
5141
5141
  }}
5142
- @change=${(t) => {
5143
- t.stopImmediatePropagation();
5142
+ @change=${(e) => {
5143
+ e.stopImmediatePropagation();
5144
5144
  }}
5145
5145
  ${Ze(this.inputRefTo)}
5146
5146
  />
@@ -5154,25 +5154,25 @@ let Ie = class extends Pe {
5154
5154
  id="${this.id}-input"
5155
5155
  min=${this.min}
5156
5156
  max=${this.max}
5157
- @click=${(t) => {
5158
- t.preventDefault(), this.showCalendar();
5157
+ @click=${(e) => {
5158
+ e.preventDefault(), this.showCalendar();
5159
5159
  }}
5160
- @blur=${(t) => {
5161
- var n;
5162
- (n = this.calRef.value) != null && n.contains(t.relatedTarget) || this.onBlur(), this.addToSelected(t);
5160
+ @blur=${(e) => {
5161
+ var t;
5162
+ (t = this.calRef.value) != null && t.contains(e.relatedTarget) || this.onBlur(), this.addToSelected(e);
5163
5163
  }}
5164
- @input=${(t) => {
5165
- this.onInput(), t.stopImmediatePropagation();
5164
+ @input=${(e) => {
5165
+ this.onInput(), e.stopImmediatePropagation();
5166
5166
  }}
5167
5167
  @focus=${() => {
5168
5168
  this.onFocus(), this.isMobileSafari && this.showCalendar();
5169
5169
  }}
5170
- @keydown=${(t) => {
5171
- (t.key === "," || t.key === "Enter") && (t.preventDefault(), this.addToSelected(t)), (t.key === "Space" || t.key === " ") && (t.preventDefault(), this.toggleCalendar(t));
5170
+ @keydown=${(e) => {
5171
+ (e.key === "," || e.key === "Enter") && (e.preventDefault(), this.addToSelected(e)), (e.key === "Space" || e.key === " ") && (e.preventDefault(), this.toggleCalendar(e));
5172
5172
  }}
5173
5173
  ?disabled=${this.disabled || this.maxlength && this._value.length >= this.maxlength}
5174
- @change=${(t) => {
5175
- t.stopImmediatePropagation();
5174
+ @change=${(e) => {
5175
+ e.stopImmediatePropagation();
5176
5176
  }}
5177
5177
  ${Ze(this.inputRef)}
5178
5178
  />
@@ -5183,20 +5183,20 @@ let Ie = class extends Pe {
5183
5183
  <div class="pkt-datepicker__tags" aria-live="polite">
5184
5184
  ${this._value[0] ? sy(
5185
5185
  this._value ?? [],
5186
- (t) => t,
5187
- (t) => W`
5186
+ (e) => e,
5187
+ (e) => W`
5188
5188
  <pkt-tag
5189
- .id="${this.id + t + "-tag"}"
5189
+ .id="${this.id + e + "-tag"}"
5190
5190
  closeTag
5191
5191
  ariaLabel="${this.strings.calendar.deleteDate} ${sc(
5192
- t,
5192
+ e,
5193
5193
  this.dateformat
5194
5194
  )}"
5195
5195
  @close=${() => {
5196
- var n;
5197
- return (n = this.calRef.value) == null ? void 0 : n.handleDateSelect(Gs(t));
5196
+ var t;
5197
+ return (t = this.calRef.value) == null ? void 0 : t.handleDateSelect(Gs(e));
5198
5198
  }}
5199
- >${sc(t, this.dateformat)}</pkt-tag
5199
+ >${sc(e, this.dateformat)}</pkt-tag
5200
5200
  >
5201
5201
  `
5202
5202
  ) : ee}
@@ -5206,8 +5206,8 @@ let Ie = class extends Pe {
5206
5206
  renderCalendar() {
5207
5207
  return W`<div
5208
5208
  class="pkt-calendar-popup pkt-${this.calendarOpen ? "show" : "hide"}"
5209
- @focusout=${(t) => {
5210
- this.calendarOpen && this.handleFocusOut(t);
5209
+ @focusout=${(e) => {
5210
+ this.calendarOpen && this.handleFocusOut(e);
5211
5211
  }}
5212
5212
  id="${this.id}-popup"
5213
5213
  ${Ze(this.popupRef)}
@@ -5225,8 +5225,8 @@ let Ie = class extends Pe {
5225
5225
  .excludedates=${Array.isArray(this.excludedates) ? this.excludedates : this.excludedates.split(",")}
5226
5226
  .excludeweekdays=${this.excludeweekdays}
5227
5227
  .currentmonth=${this.currentmonth ? He(this.currentmonth) : null}
5228
- @date-selected=${(t) => {
5229
- this.value = !this.multiple && !this.range ? t.detail[0] : 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.multiple || (this.inputRef.value.value = this._value.length ? this._value[0] : ""));
5228
+ @date-selected=${(e) => {
5229
+ this.value = !this.multiple && !this.range ? e.detail[0] : e.detail, this._value = e.detail, this.inputRef.value && (this.range && this.inputRefTo.value ? (this.inputRef.value.value = this._value[0] ?? "", this.inputRefTo.value.value = this._value[1] ?? "") : this.multiple || (this.inputRef.value.value = this._value.length ? this._value[0] : ""));
5230
5230
  }}
5231
5231
  @close=${() => {
5232
5232
  this.onBlur(), this.hideCalendar();
@@ -5281,25 +5281,25 @@ let Ie = class extends Pe {
5281
5281
  * Handlers
5282
5282
  */
5283
5283
  handleCalendarPosition() {
5284
- var t;
5284
+ var e;
5285
5285
  if (this.popupRef.value && this.inputRef.value) {
5286
- const n = this.multiple && !!this.maxlength, r = ((t = this.inputRef.value.parentElement) == null ? void 0 : t.getBoundingClientRect()) || this.inputRef.value.getBoundingClientRect(), i = n ? r.height + 30 : r.height, o = this.popupRef.value.getBoundingClientRect().height;
5287
- let u = n ? "calc(100% - 30px)" : "100%";
5288
- r && r.top + o > window.innerHeight && r.top - o > 0 && (u = `calc(100% - ${i}px - ${o}px)`), this.popupRef.value.style.top = u;
5286
+ const t = this.multiple && !!this.maxlength, n = ((e = this.inputRef.value.parentElement) == null ? void 0 : e.getBoundingClientRect()) || this.inputRef.value.getBoundingClientRect(), r = t ? n.height + 30 : n.height, i = this.popupRef.value.getBoundingClientRect().height;
5287
+ let o = t ? "calc(100% - 30px)" : "100%";
5288
+ n && n.top + i > window.innerHeight && n.top - i > 0 && (o = `calc(100% - ${r}px - ${i}px)`), this.popupRef.value.style.top = o;
5289
5289
  }
5290
5290
  }
5291
- handleFocusOut(t) {
5292
- this.contains(t.target) || (this.onBlur(), this.hideCalendar());
5291
+ handleFocusOut(e) {
5292
+ this.contains(e.target) || (this.onBlur(), this.hideCalendar());
5293
5293
  }
5294
5294
  async showCalendar() {
5295
- var t;
5296
- this.calendarOpen = !0, await uc(20), this.handleCalendarPosition(), this.isMobileSafari && ((t = this.calRef.value) == null || t.focusOnCurrentDate());
5295
+ var e;
5296
+ this.calendarOpen = !0, await uc(20), this.handleCalendarPosition(), this.isMobileSafari && ((e = this.calRef.value) == null || e.focusOnCurrentDate());
5297
5297
  }
5298
5298
  hideCalendar() {
5299
5299
  this.calendarOpen = !1;
5300
5300
  }
5301
- async toggleCalendar(t) {
5302
- t.preventDefault(), this.calendarOpen ? this.hideCalendar() : this.showCalendar();
5301
+ async toggleCalendar(e) {
5302
+ e.preventDefault(), this.calendarOpen ? this.hideCalendar() : this.showCalendar();
5303
5303
  }
5304
5304
  };
5305
5305
  Ke([
@@ -5613,46 +5613,48 @@ var Ty = Object.defineProperty, By = Object.getOwnPropertyDescriptor, Nr = (e, t
5613
5613
  };
5614
5614
  let _n = class extends Ft {
5615
5615
  constructor() {
5616
- super(), this.headingText = "", this.hideCloseButton = Xs.props.hideCloseButton.default, this.closeOnBackdropClick = Xs.props.closeOnBackdropClick.default, this.size = Xs.props.size.default, this.defaultSlot = dt(), this.dialogRef = dt(), this._isOpen = !1, this.close = (t) => {
5616
+ super(), this.headingText = "", this.hideCloseButton = Xs.props.hideCloseButton.default, this.closeOnBackdropClick = Xs.props.closeOnBackdropClick.default, this.size = Xs.props.size.default, this.defaultSlot = dt(), this.dialogRef = dt(), this._isOpen = !1, this.close = (e, t = !1) => {
5617
5617
  var n;
5618
- this._isOpen = !1, (n = this.dialogRef.value) == null || n.close();
5618
+ this._isOpen = !1, t || (n = this.dialogRef.value) == null || n.close();
5619
5619
  const r = document.activeElement;
5620
5620
  r && !this.isElementInViewport(r) && r.scrollIntoView({ behavior: "smooth", block: "nearest" }), this.dispatchEvent(
5621
- new CustomEvent("close", { detail: { origin: t }, bubbles: !0, composed: !0 })
5621
+ new CustomEvent("close", { detail: { origin: e }, bubbles: !0, composed: !0 })
5622
5622
  ), document.querySelector(".pkt-modal") && document.body.classList.remove("pkt-modal--open"), this.requestUpdate();
5623
- }, this.showModal = (t) => {
5624
- var n;
5625
- this._isOpen = !0, (n = this.dialogRef.value) == null || n.showModal(), document.querySelector(".pkt-modal") && document.body.classList.add("pkt-modal--open"), this.dispatchEvent(
5626
- new CustomEvent("showModal", { detail: { origin: t }, bubbles: !0, composed: !0 })
5623
+ }, this.showModal = (e) => {
5624
+ var t;
5625
+ this._isOpen = !0, (t = this.dialogRef.value) == null || t.showModal(), document.querySelector(".pkt-modal") && document.body.classList.add("pkt-modal--open"), this.dispatchEvent(
5626
+ new CustomEvent("showModal", { detail: { origin: e }, bubbles: !0, composed: !0 })
5627
5627
  ), this.requestUpdate();
5628
5628
  }, this.slotController = new Fn(this, this.defaultSlot), this._isOpen = !1;
5629
5629
  }
5630
5630
  async connectedCallback() {
5631
- super.connectedCallback(), document.addEventListener("keydown", this.handleKeyDown.bind(this)), document.addEventListener("click", this.handleBackdropClick.bind(this));
5631
+ var e;
5632
+ super.connectedCallback(), document.addEventListener("keydown", this.handleKeyDown.bind(this)), document.addEventListener("click", this.handleBackdropClick.bind(this)), (e = this.dialogRef.value) == null || e.addEventListener("submit", (t) => this.close(t, !0));
5632
5633
  }
5633
5634
  disconnectedCallback() {
5634
- super.disconnectedCallback(), document.removeEventListener("keydown", this.handleKeyDown.bind(this)), document.removeEventListener("click", this.handleBackdropClick.bind(this));
5635
+ var e;
5636
+ super.disconnectedCallback(), document.removeEventListener("keydown", this.handleKeyDown.bind(this)), document.removeEventListener("click", this.handleBackdropClick.bind(this)), (e = this.dialogRef.value) == null || e.removeEventListener("submit", (t) => this.close(t, !0));
5635
5637
  }
5636
5638
  // P R I V A T E M E T H O D S
5637
- handleKeyDown(t) {
5638
- t.key === "Escape" && this.close(t);
5639
+ handleKeyDown(e) {
5640
+ e.key === "Escape" && this.close(e);
5639
5641
  }
5640
- handleBackdropClick(t) {
5641
- var n;
5642
- this.closeOnBackdropClick && t.target === ((n = this.dialogRef) == null ? void 0 : n.value) && this.close(t);
5642
+ handleBackdropClick(e) {
5643
+ var t;
5644
+ this.closeOnBackdropClick && e.target === ((t = this.dialogRef) == null ? void 0 : t.value) && this.close(e);
5643
5645
  }
5644
- isElementInViewport(t) {
5645
- const n = t.getBoundingClientRect();
5646
- return n.top >= 0 && n.left >= 0 && n.bottom <= (window.innerHeight || document.documentElement.clientHeight) && n.right <= (window.innerWidth || document.documentElement.clientWidth);
5646
+ isElementInViewport(e) {
5647
+ const t = e.getBoundingClientRect();
5648
+ return t.top >= 0 && t.left >= 0 && t.bottom <= (window.innerHeight || document.documentElement.clientHeight) && t.right <= (window.innerWidth || document.documentElement.clientWidth);
5647
5649
  }
5648
5650
  render() {
5649
- const t = {
5651
+ const e = {
5650
5652
  "pkt-modal": !0,
5651
5653
  [`pkt-modal--${this.size}`]: this.size !== void 0
5652
5654
  };
5653
5655
  return W`
5654
5656
  <dialog
5655
- class=${Ue(t)}
5657
+ class=${Ue(e)}
5656
5658
  aria-modal=${this._isOpen}
5657
5659
  ${Ze(this.dialogRef)}
5658
5660
  aria-labelledby="pkt-modal__headingText"
@@ -5665,7 +5667,7 @@ let _n = class extends Ft {
5665
5667
  </h1>` : ee}
5666
5668
  ${this.hideCloseButton ? ee : W`<div class="pkt-modal__closeButton">
5667
5669
  <button
5668
- @click=${(n) => this.close(n)}
5670
+ @click=${(t) => this.close(t)}
5669
5671
  class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only"
5670
5672
  aria-label="close"
5671
5673
  >
@@ -5744,7 +5746,7 @@ var Lp = { exports: {} };
5744
5746
  })();
5745
5747
  })(Lp);
5746
5748
  var Ny = Lp.exports;
5747
- const at = /* @__PURE__ */ qi(Ny), LS = Be(
5749
+ const at = /* @__PURE__ */ qi(Ny), NS = Be(
5748
5750
  ({ title: e, className: t, children: n, toggleProps: r, defaultOpen: i = !1, id: o }, u) => {
5749
5751
  const [c, d] = Dt(i), h = r ? r.isOpen : c, m = (b) => b ?? void 0, v = (b, k) => {
5750
5752
  b.preventDefault(), r !== void 0 && r.onToggleClick(b, k), d(!h);
@@ -5805,7 +5807,7 @@ const Ly = Be(
5805
5807
  }
5806
5808
  );
5807
5809
  Ly.displayName = "PktBackLink";
5808
- const PS = Be(
5810
+ const jS = Be(
5809
5811
  ({ breadcrumbs: e, navigationType: t, className: n, ...r }, i) => {
5810
5812
  const o = e.slice(0, 4), u = o[o.length - 2], c = [n, "pkt-breadcrumbs"].filter(Boolean).join(" ");
5811
5813
  return /* @__PURE__ */ g.jsxs("nav", { ref: i, "aria-label": "brødsmulemeny", className: c, children: [
@@ -5951,7 +5953,7 @@ const My = En({
5951
5953
  onValueChange: "value-change",
5952
5954
  onToggleHelpText: "toggleHelpText"
5953
5955
  }
5954
- }), OS = ({
5956
+ }), LS = ({
5955
5957
  columnOne: e,
5956
5958
  columnTwo: t,
5957
5959
  socialLinks: n,
@@ -6039,7 +6041,7 @@ const My = En({
6039
6041
  ) }, `sociallinks-${m}`)) })
6040
6042
  ] })
6041
6043
  ] }) });
6042
- }, MS = ({
6044
+ }, PS = ({
6043
6045
  links: e = [],
6044
6046
  personvernOgInfoLink: t = "https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",
6045
6047
  tilgjengelighetLink: n = "https://www.oslo.kommune.no/tilgjengelighet/",
@@ -6069,7 +6071,7 @@ const My = En({
6069
6071
  "Tilgjengelighet"
6070
6072
  ] }) })
6071
6073
  ] }) }) });
6072
- }, IS = Be(
6074
+ }, OS = Be(
6073
6075
  ({
6074
6076
  className: e,
6075
6077
  logoLink: t = "https://www.oslo.kommune.no/",
@@ -16286,7 +16288,7 @@ const nS = Be(
16286
16288
  }
16287
16289
  );
16288
16290
  nS.displayName = "PktRadioButton";
16289
- const qS = Be(
16291
+ const IS = Be(
16290
16292
  ({
16291
16293
  appearance: e = "local",
16292
16294
  disabled: t = !1,
@@ -16371,7 +16373,7 @@ const qS = Be(
16371
16373
  ] })
16372
16374
  );
16373
16375
  }
16374
- ), HS = Be(
16376
+ ), RS = Be(
16375
16377
  ({
16376
16378
  activeStep: e,
16377
16379
  className: t,
@@ -16399,7 +16401,7 @@ const qS = Be(
16399
16401
  ] }), iS = /* @__PURE__ */ g.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "none", children: [
16400
16402
  /* @__PURE__ */ g.jsx("path", { fill: "#2A2859", d: "M3 3h18v18H3z" }),
16401
16403
  /* @__PURE__ */ g.jsx("path", { d: "m10.34 16-1.11-1.14L7 12.58l1.11-1.15 2.23 2.28L15.88 8 17 9.15l-5.55 5.71L10.34 16Z", fill: "#F1FDFF" })
16402
- ] }), US = ({ children: e, className: t, status: n = "incomplete", title: r }) => /* @__PURE__ */ g.jsxs("li", { className: at("pkt-step", t, `pkt-step--${n}`), "data-testid": "pkt-step", children: [
16404
+ ] }), qS = ({ children: e, className: t, status: n = "incomplete", title: r }) => /* @__PURE__ */ g.jsxs("li", { className: at("pkt-step", t, `pkt-step--${n}`), "data-testid": "pkt-step", children: [
16403
16405
  /* @__PURE__ */ g.jsx("span", { className: "pkt-step__line pkt-step__line--1", "aria-hidden": !0 }),
16404
16406
  /* @__PURE__ */ g.jsx("span", { className: "pkt-step__line pkt-step__line--2", "aria-hidden": !0 }),
16405
16407
  /* @__PURE__ */ g.jsx("span", { className: at("pkt-step__indicator"), children: n === "current" ? aS : n === "completed" ? iS : rS }),
@@ -16408,7 +16410,7 @@ const qS = Be(
16408
16410
  /* @__PURE__ */ g.jsx("div", { className: "pkt-step__title", children: r }),
16409
16411
  /* @__PURE__ */ g.jsx("div", { className: "pkt-step__content", children: e })
16410
16412
  ] })
16411
- ] }), zS = Be(
16413
+ ] }), HS = Be(
16412
16414
  ({
16413
16415
  id: e,
16414
16416
  ariaDescribedby: t,
@@ -16489,17 +16491,17 @@ const qS = Be(
16489
16491
  );
16490
16492
  export {
16491
16493
  uS as PktAccordion,
16492
- LS as PktAccordionItem,
16494
+ NS as PktAccordionItem,
16493
16495
  Pp as PktAlert,
16494
16496
  Ly as PktBackLink,
16495
- PS as PktBreadcrumbs,
16497
+ jS as PktBreadcrumbs,
16496
16498
  Sr as PktButton,
16497
16499
  Oy as PktCard,
16498
16500
  fo as PktCheckbox,
16499
16501
  My as PktDatepicker,
16500
- OS as PktFooter,
16501
- MS as PktFooterSimple,
16502
- IS as PktHeader,
16502
+ LS as PktFooter,
16503
+ PS as PktFooterSimple,
16504
+ OS as PktHeader,
16503
16505
  pe as PktIcon,
16504
16506
  Iy as PktInput,
16505
16507
  Pa as PktInputWrapper,
@@ -16511,10 +16513,10 @@ export {
16511
16513
  K_ as PktPreview,
16512
16514
  tS as PktProgressbar,
16513
16515
  nS as PktRadioButton,
16514
- qS as PktSearchInput,
16516
+ IS as PktSearchInput,
16515
16517
  pp as PktSelect,
16516
- US as PktStep,
16517
- HS as PktStepper,
16518
+ qS as PktStep,
16519
+ RS as PktStepper,
16518
16520
  io as PktTable,
16519
16521
  oo as PktTableBody,
16520
16522
  Bt as PktTableDataCell,
@@ -16523,6 +16525,6 @@ export {
16523
16525
  gr as PktTableRow,
16524
16526
  V_ as PktTabs,
16525
16527
  $a as PktTag,
16526
- zS as PktTextarea,
16528
+ HS as PktTextarea,
16527
16529
  dp as PktTextinput
16528
16530
  };
@@ -389,7 +389,7 @@ React keys must be passed directly to JSX without using spread:
389
389
  * @license
390
390
  * Copyright 2017 Google LLC
391
391
  * SPDX-License-Identifier: BSD-3-Clause
392
- */const Du=(e,t,n)=>{const r=new Map;for(let i=t;i<=n;i++)r.set(e[i],i);return r},dg=Vr(class extends Ga{constructor(e){if(super(e),e.type!==Va.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let r;n===void 0?n=t:t!==void 0&&(r=t);const i=[],o=[];let u=0;for(const c of e)i[u]=r?r(c,u):u,o[u]=n(c,u),u++;return{values:o,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,r]){const i=cf(e),{values:o,keys:u}=this.dt(t,n,r);if(!Array.isArray(i))return this.ut=u,o;const c=this.ut??(this.ut=[]),d=[];let h,m,v=0,y=i.length-1,b=0,k=o.length-1;for(;v<=y&&b<=k;)if(i[v]===null)v++;else if(i[y]===null)y--;else if(c[v]===u[b])d[b]=On(i[v],o[b]),v++,b++;else if(c[y]===u[k])d[k]=On(i[y],o[k]),y--,k--;else if(c[v]===u[k])d[k]=On(i[v],o[k]),Gr(e,d[k+1],i[v]),v++,k--;else if(c[y]===u[b])d[b]=On(i[y],o[b]),Gr(e,i[v],i[y]),y--,b++;else if(h===void 0&&(h=Du(u,b,k),m=Du(c,v,y)),h.has(c[v]))if(h.has(c[y])){const x=m.get(u[b]),C=x!==void 0?i[x]:null;if(C===null){const T=Gr(e,i[v]);On(T,o[b]),d[b]=T}else d[b]=On(C,o[b]),Gr(e,i[v],C),i[x]=null;b++}else fs(i[y]),y--;else fs(i[v]),v++;for(;b<=k;){const x=Gr(e,d[k+1]);On(x,o[b]),d[b++]=x}for(;v<=y;){const x=i[v++];x!==null&&fs(x)}return this.ut=u,uf(e,d),Xt}}),hg="pkt-datepicker",fg=!0,mg={name:{type:"string",name:"Navn",description:"Navn som sendes brukes i skjema ved innsending"},label:{type:"string",name:"Etikett",description:"Tekst som vises over datovelgeren"},helptext:{type:"string",name:"Hjelpetekst",description:"Hjelpetekst som vises over datovelgeren"},helptextDropdown:{type:"string",name:"Utvidet hjelpetekst",description:"Hjelpetekst som vises i en lukket boks man kan åpne"},helptextDropdownButton:{type:"string",name:"Knappetekst for hjelpetekst",description:"Tekst som vises på knappen for å åpne/lukke utvidet hjelpetekst",default:"Les mer"},dateformat:{name:"Datoformat",description:"Datoformat for valgte datoer i flervalgsmodus",type:"string",default:"dd.MM.yyyy"},currentmonth:{name:"Nåværende måned",type:"ISOdatestring",description:"Måneden som skal vises i datovelgeren"},value:{name:"Verdi",type:"ISOdatestring",variant:"multiple",reflect:!0,description:"Kommaseparert liste av valgte datoer"},excludeweekdays:{name:"Utelat ukedager",type:"string",description:"Kommaseparert liste over ukedager (1-7) som skal ekskluderes"},excludedates:{name:"Utelat datoer",type:"ISOdatestring",variant:"multiple",description:"Kommaseparert liste over datoer som skal ekskluderes"},min:{name:"Tidligst tillatt",type:"ISOdatestring",default:null,description:"Første tillate dato i datovelgeren"},max:{name:"Senest tillatt",type:"ISOdatestring",default:null,description:"Siste tillate dato i datovelgeren"},weeknumbers:{name:"Vis ukenummer",type:"boolean",reflect:!0,default:!1,description:"Vis ukedager i datovelgerens kalender"},withcontrols:{name:"Med kontroller",type:"boolean",reflect:!0,default:!1,description:"Vis avanserte velgere for måned og år"},multiple:{name:"Flervalg",type:"boolean",reflect:!0,default:!1,description:"Tillat valg av flere enn én dato i samme velger"},maxlength:{name:"Maks antall",description:"Maks valgte datoer i flervalgsmodus",type:"number",default:4},range:{name:"Datotidsrom",type:"boolean",reflect:!0,default:!1,description:"Tillat å velge et tidsrom mellom to datoer i samme velger"},hasError:{type:"boolean",name:"Feil",description:"Viser feiltilstand for datovelgeren"},errorMessage:{type:"string",name:"Feilmelding",description:"Tekst som vises under datovelgeren ved feiltilstand"},disabled:{type:"boolean",name:"Deaktivert",default:!1,reflect:!0,description:"Er datovelgeren deaktivert?"},fullwidth:{type:"boolean",name:"Full bredde",default:!1,reflect:!0,description:"Skal datovelgeren ta opp hele bredden?"},required:{type:"boolean",name:"Påkrevd",default:!1,reflect:!0,description:"Er datovelgeren påkrevd?"},requiredTag:{type:"boolean",name:"Vise påkrevd-merking",default:!1,description:"Viser en merking som indikerer at datovelgeren er påkrevd"},requiredText:{type:"string",name:"Påkrevd-tekst",default:"Må fylles ut",description:"Tekst som vises i påkrevd-merkingen"},optionalTag:{type:"boolean",name:"Vise valgfritt-merking",default:!1,description:"Viser en merking som indikerer at datovelgeren er valgfri"},optionalText:{type:"string",name:"Valgfritt-tekst",default:"Valgfritt",description:"Tekst som vises i valgfritt-merkingen"},useWrapper:{type:"boolean",name:"Bruk wrapper",description:"Indikerer at feltet skal ha synlig label og hjelpetekst",default:!0},id:{type:"string",name:"ID",description:"Unik identifikasjon for datovelgeren"}},gg={change:{type:"Event",description:"Returnerer valgt dato som streng i ISO-format"},"value-change":{type:"CustomEvent",description:"Returnerer en <code>array</code> med valgte datoer i ISO-format"},toggleHelpText:{type:"CustomEvent",description:"Returnerer <code>event.detail { isOpen: true }</code> eller <code>event.detail { isOpen: false }</code> når hjelpeteksten åpnes eller lukkes"}},yn={name:hg,"css-class":"pkt-datepicker",isElement:fg,props:mg,events:gg};var vg=Object.defineProperty,yg=Object.getOwnPropertyDescriptor,Ve=(e,t,n,r)=>{for(var i=r>1?void 0:r?yg(t,n):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(i=(r?u(t,n,i):u(i))||i);return r&&i&&vg(t,n,i),i};const bu=e=>new Promise(t=>setTimeout(t,e));let Ie=class extends je{constructor(){super(...arguments),this.value="",this._value=this.value?Array.isArray(this.value)?this.value:this.value.split(","):[],this.label="Datovelger",this.dateformat=yn.props.dateformat.default,this.multiple=yn.props.multiple.default,this.maxlength=yn.props.maxlength.default,this.range=yn.props.range.default,this.min=null,this.max=null,this.weeknumbers=yn.props.weeknumbers.default,this.withcontrols=yn.props.withcontrols.default,this.fullwidth=!1,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.useWrapper=!0,this.calendarOpen=!1,this.timezone="Europe/Oslo",this.inputRef=ut(),this.inputRefTo=ut(),this.btnRef=ut(),this.calRef=ut(),this.popupRef=ut(),this.inputClasses={"pkt-input":!0,"pkt-datepicker__input":!0,"pkt-input--fullwidth":this.fullwidth},this.buttonClasses={"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0},this.addToSelected=t=>{const n=t.target;if(!n.value)return;const r=this.min?qe(this.min):null,i=this.max?qe(this.max):null,o=qe(n.value.split(",")[0]);o&&!isNaN(o.getTime())&&(!r||o>=r)&&(!i||o<=i)&&this.calRef.value&&this.calRef.value.handleDateSelect(o),n.value=""}}async connectedCallback(){super.connectedCallback(),this.isMobileSafari=/iP(ad|od|hone)/i.test(window.navigator.userAgent)&&!!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/),this.inputType=this.isMobileSafari?"text":"date",document&&document.body.addEventListener("click",t=>{var n,r;(n=this.inputRef)!=null&&n.value&&(r=this.btnRef)!=null&&r.value&&!this.inputRef.value.contains(t.target)&&!(this.inputRefTo.value&&this.inputRefTo.value.contains(t.target))&&!this.btnRef.value.contains(t.target)&&!t.target.closest(".pkt-calendar-popup")&&this.calendarOpen&&(this.onBlur(),this.hideCalendar())}),this.value.length&&this._value.length===0&&(this._value=Array.isArray(this.value)?this.value:this.value.split(",")),this.min=this.min||yn.props.min.default,this.max=this.max||yn.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 bu(20),this.handleCalendarPosition())}disconnectedCallback(){super.disconnectedCallback(),document&&document.body.removeEventListener("click",t=>{var n,r;(n=this.inputRef)!=null&&n.value&&(r=this.btnRef)!=null&&r.value&&!this.inputRef.value.contains(t.target)&&!this.btnRef.value.contains(t.target)&&this.hideCalendar()})}attributeChangedCallback(t,n,r){t==="value"&&this.valueChanged(this.value,n),t==="excludedates"&&typeof this.excludedates=="string"&&(this.excludedates=(r==null?void 0:r.split(","))??[]),t==="excludeweekdays"&&typeof this.excludeweekdays=="string"&&(this.excludeweekdays=(r==null?void 0:r.split(","))??[]),super.attributeChangedCallback(t,n,r)}firstUpdated(t){super.firstUpdated(t)}updated(t){if(super.updated(t),t.has("value")){if(this.range&&this._value.length===1)return;this.valueChanged(this.value,t.get("value"))}}renderInput(){return V`
392
+ */const Du=(e,t,n)=>{const r=new Map;for(let i=t;i<=n;i++)r.set(e[i],i);return r},dg=Vr(class extends Ga{constructor(e){if(super(e),e.type!==Va.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let r;n===void 0?n=t:t!==void 0&&(r=t);const i=[],o=[];let u=0;for(const c of e)i[u]=r?r(c,u):u,o[u]=n(c,u),u++;return{values:o,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,r]){const i=cf(e),{values:o,keys:u}=this.dt(t,n,r);if(!Array.isArray(i))return this.ut=u,o;const c=this.ut??(this.ut=[]),d=[];let h,m,v=0,y=i.length-1,b=0,k=o.length-1;for(;v<=y&&b<=k;)if(i[v]===null)v++;else if(i[y]===null)y--;else if(c[v]===u[b])d[b]=On(i[v],o[b]),v++,b++;else if(c[y]===u[k])d[k]=On(i[y],o[k]),y--,k--;else if(c[v]===u[k])d[k]=On(i[v],o[k]),Gr(e,d[k+1],i[v]),v++,k--;else if(c[y]===u[b])d[b]=On(i[y],o[b]),Gr(e,i[v],i[y]),y--,b++;else if(h===void 0&&(h=Du(u,b,k),m=Du(c,v,y)),h.has(c[v]))if(h.has(c[y])){const x=m.get(u[b]),C=x!==void 0?i[x]:null;if(C===null){const T=Gr(e,i[v]);On(T,o[b]),d[b]=T}else d[b]=On(C,o[b]),Gr(e,i[v],C),i[x]=null;b++}else fs(i[y]),y--;else fs(i[v]),v++;for(;b<=k;){const x=Gr(e,d[k+1]);On(x,o[b]),d[b++]=x}for(;v<=y;){const x=i[v++];x!==null&&fs(x)}return this.ut=u,uf(e,d),Xt}}),hg="pkt-datepicker",fg=!0,mg={name:{type:"string",name:"Navn",description:"Navn som sendes brukes i skjema ved innsending"},label:{type:"string",name:"Etikett",description:"Tekst som vises over datovelgeren"},helptext:{type:"string",name:"Hjelpetekst",description:"Hjelpetekst som vises over datovelgeren"},helptextDropdown:{type:"string",name:"Utvidet hjelpetekst",description:"Hjelpetekst som vises i en lukket boks man kan åpne"},helptextDropdownButton:{type:"string",name:"Knappetekst for hjelpetekst",description:"Tekst som vises på knappen for å åpne/lukke utvidet hjelpetekst",default:"Les mer"},dateformat:{name:"Datoformat",description:"Datoformat for valgte datoer i flervalgsmodus",type:"string",default:"dd.MM.yyyy"},currentmonth:{name:"Nåværende måned",type:"ISOdatestring",description:"Måneden som skal vises i datovelgeren"},value:{name:"Verdi",type:"ISOdatestring",variant:"multiple",reflect:!0,description:"Kommaseparert liste av valgte datoer"},excludeweekdays:{name:"Utelat ukedager",type:"string",description:"Kommaseparert liste over ukedager (1-7) som skal ekskluderes"},excludedates:{name:"Utelat datoer",type:"ISOdatestring",variant:"multiple",description:"Kommaseparert liste over datoer som skal ekskluderes"},min:{name:"Tidligst tillatt",type:"ISOdatestring",default:null,description:"Første tillate dato i datovelgeren"},max:{name:"Senest tillatt",type:"ISOdatestring",default:null,description:"Siste tillate dato i datovelgeren"},weeknumbers:{name:"Vis ukenummer",type:"boolean",reflect:!0,default:!1,description:"Vis ukedager i datovelgerens kalender"},withcontrols:{name:"Med kontroller",type:"boolean",reflect:!0,default:!1,description:"Vis avanserte velgere for måned og år"},multiple:{name:"Flervalg",type:"boolean",reflect:!0,default:!1,description:"Tillat valg av flere enn én dato i samme velger"},maxlength:{name:"Maks antall",description:"Maks valgte datoer i flervalgsmodus",type:"number",default:4},range:{name:"Datotidsrom",type:"boolean",reflect:!0,default:!1,description:"Tillat å velge et tidsrom mellom to datoer i samme velger"},hasError:{type:"boolean",name:"Feil",description:"Viser feiltilstand for datovelgeren"},errorMessage:{type:"string",name:"Feilmelding",description:"Tekst som vises under datovelgeren ved feiltilstand"},disabled:{type:"boolean",name:"Deaktivert",default:!1,reflect:!0,description:"Er datovelgeren deaktivert?"},fullwidth:{type:"boolean",name:"Full bredde",default:!1,reflect:!0,description:"Skal datovelgeren ta opp hele bredden?"},required:{type:"boolean",name:"Påkrevd",default:!1,reflect:!0,description:"Er datovelgeren påkrevd?"},requiredTag:{type:"boolean",name:"Vise påkrevd-merking",default:!1,description:"Viser en merking som indikerer at datovelgeren er påkrevd"},requiredText:{type:"string",name:"Påkrevd-tekst",default:"Må fylles ut",description:"Tekst som vises i påkrevd-merkingen"},optionalTag:{type:"boolean",name:"Vise valgfritt-merking",default:!1,description:"Viser en merking som indikerer at datovelgeren er valgfri"},optionalText:{type:"string",name:"Valgfritt-tekst",default:"Valgfritt",description:"Tekst som vises i valgfritt-merkingen"},useWrapper:{type:"boolean",name:"Bruk wrapper",description:"Indikerer at feltet skal ha synlig label og hjelpetekst",default:!0},id:{type:"string",name:"ID",description:"Unik identifikasjon for datovelgeren"}},gg={change:{type:"Event",description:"Returnerer valgt dato som streng i ISO-format"},"value-change":{type:"CustomEvent",description:"Returnerer en <code>array</code> med valgte datoer i ISO-format"},toggleHelpText:{type:"CustomEvent",description:"Returnerer <code>event.detail { isOpen: true }</code> eller <code>event.detail { isOpen: false }</code> når hjelpeteksten åpnes eller lukkes"}},yn={name:hg,"css-class":"pkt-datepicker",isElement:fg,props:mg,events:gg};var vg=Object.defineProperty,yg=Object.getOwnPropertyDescriptor,Ve=(e,t,n,r)=>{for(var i=r>1?void 0:r?yg(t,n):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(i=(r?u(t,n,i):u(i))||i);return r&&i&&vg(t,n,i),i};const bu=e=>new Promise(t=>setTimeout(t,e));let Ie=class extends je{constructor(){super(...arguments),this.value="",this._value=this.value?Array.isArray(this.value)?this.value:this.value.split(","):[],this.label="Datovelger",this.dateformat=yn.props.dateformat.default,this.multiple=yn.props.multiple.default,this.maxlength=yn.props.maxlength.default,this.range=yn.props.range.default,this.min=null,this.max=null,this.weeknumbers=yn.props.weeknumbers.default,this.withcontrols=yn.props.withcontrols.default,this.fullwidth=!1,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.useWrapper=!0,this.calendarOpen=!1,this.timezone="Europe/Oslo",this.inputRef=ut(),this.inputRefTo=ut(),this.btnRef=ut(),this.calRef=ut(),this.popupRef=ut(),this.inputClasses={"pkt-input":!0,"pkt-datepicker__input":!0,"pkt-input--fullwidth":this.fullwidth},this.buttonClasses={"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0},this.addToSelected=e=>{const t=e.target;if(!t.value)return;const n=this.min?qe(this.min):null,r=this.max?qe(this.max):null,i=qe(t.value.split(",")[0]);i&&!isNaN(i.getTime())&&(!n||i>=n)&&(!r||i<=r)&&this.calRef.value&&this.calRef.value.handleDateSelect(i),t.value=""}}async connectedCallback(){super.connectedCallback(),this.isMobileSafari=/iP(ad|od|hone)/i.test(window.navigator.userAgent)&&!!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/),this.inputType=this.isMobileSafari?"text":"date",document&&document.body.addEventListener("click",e=>{var t,n;(t=this.inputRef)!=null&&t.value&&(n=this.btnRef)!=null&&n.value&&!this.inputRef.value.contains(e.target)&&!(this.inputRefTo.value&&this.inputRefTo.value.contains(e.target))&&!this.btnRef.value.contains(e.target)&&!e.target.closest(".pkt-calendar-popup")&&this.calendarOpen&&(this.onBlur(),this.hideCalendar())}),this.value.length&&this._value.length===0&&(this._value=Array.isArray(this.value)?this.value:this.value.split(",")),this.min=this.min||yn.props.min.default,this.max=this.max||yn.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 bu(20),this.handleCalendarPosition())}disconnectedCallback(){super.disconnectedCallback(),document&&document.body.removeEventListener("click",e=>{var t,n;(t=this.inputRef)!=null&&t.value&&(n=this.btnRef)!=null&&n.value&&!this.inputRef.value.contains(e.target)&&!this.btnRef.value.contains(e.target)&&this.hideCalendar()})}attributeChangedCallback(e,t,n){e==="value"&&this.valueChanged(this.value,t),e==="excludedates"&&typeof this.excludedates=="string"&&(this.excludedates=(n==null?void 0:n.split(","))??[]),e==="excludeweekdays"&&typeof this.excludeweekdays=="string"&&(this.excludeweekdays=(n==null?void 0:n.split(","))??[]),super.attributeChangedCallback(e,t,n)}firstUpdated(e){super.firstUpdated(e)}updated(e){if(super.updated(e),e.has("value")){if(this.range&&this._value.length===1)return;this.valueChanged(this.value,e.get("value"))}}renderInput(){return V`
393
393
  <input
394
394
  class="${Re(this.inputClasses)}"
395
395
  .type=${this.inputType}
@@ -397,13 +397,13 @@ React keys must be passed directly to JSX without using spread:
397
397
  .value=${this._value[0]??""}
398
398
  min=${this.min}
399
399
  max=${this.max}
400
- @click=${t=>{t.preventDefault(),this.showCalendar()}}
400
+ @click=${e=>{e.preventDefault(),this.showCalendar()}}
401
401
  ?disabled=${this.disabled}
402
- @keydown=${t=>{var n;(t.key===","||t.key==="Enter")&&((n=this.inputRef.value)==null||n.blur()),(t.key==="Space"||t.key===" ")&&(t.preventDefault(),this.toggleCalendar(t))}}
403
- @input=${t=>{this.onInput(),t.stopImmediatePropagation()}}
402
+ @keydown=${e=>{var t;(e.key===","||e.key==="Enter")&&((t=this.inputRef.value)==null||t.blur()),(e.key==="Space"||e.key===" ")&&(e.preventDefault(),this.toggleCalendar(e))}}
403
+ @input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
404
404
  @focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
405
- @blur=${t=>{var n;(n=this.calRef.value)!=null&&n.contains(t.relatedTarget)||this.onBlur(),this.manageValidity(t.target),this.value=t.target.value}}
406
- @change=${t=>{t.stopImmediatePropagation()}}
405
+ @blur=${e=>{var t;(t=this.calRef.value)!=null&&t.contains(e.relatedTarget)||this.onBlur(),this.manageValidity(e.target),this.value=e.target.value}}
406
+ @change=${e=>{e.stopImmediatePropagation()}}
407
407
  ${Je(this.inputRef)}
408
408
  />
409
409
  `}renderRangeInput(){return V`
@@ -415,13 +415,13 @@ React keys must be passed directly to JSX without using spread:
415
415
  .value=${this._value[0]??""}
416
416
  min=${this.min}
417
417
  max=${this.max}
418
- @click=${t=>{t.preventDefault(),this.showCalendar()}}
418
+ @click=${e=>{e.preventDefault(),this.showCalendar()}}
419
419
  ?disabled=${this.disabled}
420
- @keydown=${t=>{var n;(t.key===","||t.key==="Enter")&&((n=this.inputRef.value)==null||n.blur()),(t.key==="Space"||t.key===" ")&&(t.preventDefault(),this.toggleCalendar(t))}}
421
- @input=${t=>{this.onInput(),t.stopImmediatePropagation()}}
420
+ @keydown=${e=>{var t;(e.key===","||e.key==="Enter")&&((t=this.inputRef.value)==null||t.blur()),(e.key==="Space"||e.key===" ")&&(e.preventDefault(),this.toggleCalendar(e))}}
421
+ @input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
422
422
  @focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
423
- @blur=${t=>{var n,r;if(t.target.value){this.manageValidity(t.target);const i=Cs(t.target.value);i&&this._value[0]!==t.target.value&&this._value[1]&&(this.clearInputValue(),(r=(n=this.calRef)==null?void 0:n.value)==null||r.handleDateSelect(i))}else this._value[0]&&this.clearInputValue()}}
424
- @change=${t=>{t.stopImmediatePropagation()}}
423
+ @blur=${e=>{var t,n;if(e.target.value){this.manageValidity(e.target);const r=Cs(e.target.value);r&&this._value[0]!==e.target.value&&this._value[1]&&(this.clearInputValue(),(n=(t=this.calRef)==null?void 0:t.value)==null||n.handleDateSelect(r))}else this._value[0]&&this.clearInputValue()}}
424
+ @change=${e=>{e.stopImmediatePropagation()}}
425
425
  ${Je(this.inputRef)}
426
426
  />
427
427
  <div class="pkt-input-prefix" id="${this.id}-to-label">Til</div>
@@ -433,13 +433,13 @@ React keys must be passed directly to JSX without using spread:
433
433
  .value=${this._value[1]??""}
434
434
  min=${this.min}
435
435
  max=${this.max}
436
- @click=${t=>{t.preventDefault(),this.showCalendar()}}
436
+ @click=${e=>{e.preventDefault(),this.showCalendar()}}
437
437
  ?disabled=${this.disabled}
438
- @keydown=${t=>{var n;(t.key===","||t.key==="Enter")&&((n=this.inputRefTo.value)==null||n.blur()),(t.key==="Space"||t.key===" ")&&(t.preventDefault(),this.toggleCalendar(t))}}
439
- @input=${t=>{this.onInput(),t.stopImmediatePropagation()}}
438
+ @keydown=${e=>{var t;(e.key===","||e.key==="Enter")&&((t=this.inputRefTo.value)==null||t.blur()),(e.key==="Space"||e.key===" ")&&(e.preventDefault(),this.toggleCalendar(e))}}
439
+ @input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
440
440
  @focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
441
- @blur=${t=>{var n,r,i;if((n=this.calRef.value)!=null&&n.contains(t.relatedTarget)||this.onBlur(),t.target.value){this.manageValidity(t.target);const o=t.target.value;this.min&&this.min>o?this.internals.setValidity({rangeUnderflow:!0},this.strings.forms.messages.rangeUnderflow,t.target):this.max&&this.max<o&&this.internals.setValidity({rangeOverflow:!0},this.strings.forms.messages.rangeOverflow,t.target);const u=Cs(t.target.value);u&&this._value[1]!==Xe(u)&&((i=(r=this.calRef)==null?void 0:r.value)==null||i.handleDateSelect(u))}}}
442
- @change=${t=>{t.stopImmediatePropagation()}}
441
+ @blur=${e=>{var t,n,r;if((t=this.calRef.value)!=null&&t.contains(e.relatedTarget)||this.onBlur(),e.target.value){this.manageValidity(e.target);const i=e.target.value;this.min&&this.min>i?this.internals.setValidity({rangeUnderflow:!0},this.strings.forms.messages.rangeUnderflow,e.target):this.max&&this.max<i&&this.internals.setValidity({rangeOverflow:!0},this.strings.forms.messages.rangeOverflow,e.target);const o=Cs(e.target.value);o&&this._value[1]!==Xe(o)&&((r=(n=this.calRef)==null?void 0:n.value)==null||r.handleDateSelect(o))}}}
442
+ @change=${e=>{e.stopImmediatePropagation()}}
443
443
  ${Je(this.inputRefTo)}
444
444
  />
445
445
  `}renderMultipleInput(){return V`
@@ -449,30 +449,30 @@ React keys must be passed directly to JSX without using spread:
449
449
  id="${this.id}-input"
450
450
  min=${this.min}
451
451
  max=${this.max}
452
- @click=${t=>{t.preventDefault(),this.showCalendar()}}
453
- @blur=${t=>{var n;(n=this.calRef.value)!=null&&n.contains(t.relatedTarget)||this.onBlur(),this.addToSelected(t)}}
454
- @input=${t=>{this.onInput(),t.stopImmediatePropagation()}}
452
+ @click=${e=>{e.preventDefault(),this.showCalendar()}}
453
+ @blur=${e=>{var t;(t=this.calRef.value)!=null&&t.contains(e.relatedTarget)||this.onBlur(),this.addToSelected(e)}}
454
+ @input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
455
455
  @focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
456
- @keydown=${t=>{(t.key===","||t.key==="Enter")&&(t.preventDefault(),this.addToSelected(t)),(t.key==="Space"||t.key===" ")&&(t.preventDefault(),this.toggleCalendar(t))}}
456
+ @keydown=${e=>{(e.key===","||e.key==="Enter")&&(e.preventDefault(),this.addToSelected(e)),(e.key==="Space"||e.key===" ")&&(e.preventDefault(),this.toggleCalendar(e))}}
457
457
  ?disabled=${this.disabled||this.maxlength&&this._value.length>=this.maxlength}
458
- @change=${t=>{t.stopImmediatePropagation()}}
458
+ @change=${e=>{e.stopImmediatePropagation()}}
459
459
  ${Je(this.inputRef)}
460
460
  />
461
461
  `}renderTags(){return V`
462
462
  <div class="pkt-datepicker__tags" aria-live="polite">
463
- ${this._value[0]?dg(this._value??[],t=>t,t=>V`
463
+ ${this._value[0]?dg(this._value??[],e=>e,e=>V`
464
464
  <pkt-tag
465
- .id="${this.id+t+"-tag"}"
465
+ .id="${this.id+e+"-tag"}"
466
466
  closeTag
467
- ariaLabel="${this.strings.calendar.deleteDate} ${vu(t,this.dateformat)}"
468
- @close=${()=>{var n;return(n=this.calRef.value)==null?void 0:n.handleDateSelect(Cs(t))}}
469
- >${vu(t,this.dateformat)}</pkt-tag
467
+ ariaLabel="${this.strings.calendar.deleteDate} ${vu(e,this.dateformat)}"
468
+ @close=${()=>{var t;return(t=this.calRef.value)==null?void 0:t.handleDateSelect(Cs(e))}}
469
+ >${vu(e,this.dateformat)}</pkt-tag
470
470
  >
471
471
  `):te}
472
472
  </div>
473
473
  `}renderCalendar(){return V`<div
474
474
  class="pkt-calendar-popup pkt-${this.calendarOpen?"show":"hide"}"
475
- @focusout=${t=>{this.calendarOpen&&this.handleFocusOut(t)}}
475
+ @focusout=${e=>{this.calendarOpen&&this.handleFocusOut(e)}}
476
476
  id="${this.id}-popup"
477
477
  ${Je(this.popupRef)}
478
478
  >
@@ -489,7 +489,7 @@ React keys must be passed directly to JSX without using spread:
489
489
  .excludedates=${Array.isArray(this.excludedates)?this.excludedates:this.excludedates.split(",")}
490
490
  .excludeweekdays=${this.excludeweekdays}
491
491
  .currentmonth=${this.currentmonth?qe(this.currentmonth):null}
492
- @date-selected=${t=>{this.value=!this.multiple&&!this.range?t.detail[0]: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.multiple||(this.inputRef.value.value=this._value.length?this._value[0]:""))}}
492
+ @date-selected=${e=>{this.value=!this.multiple&&!this.range?e.detail[0]:e.detail,this._value=e.detail,this.inputRef.value&&(this.range&&this.inputRefTo.value?(this.inputRef.value.value=this._value[0]??"",this.inputRefTo.value.value=this._value[1]??""):this.multiple||(this.inputRef.value.value=this._value.length?this._value[0]:""))}}
493
493
  @close=${()=>{this.onBlur(),this.hideCalendar()}}
494
494
  ${Je(this.calRef)}
495
495
  ></pkt-calendar>
@@ -532,7 +532,7 @@ React keys must be passed directly to JSX without using spread:
532
532
  </div>
533
533
  </pkt-input-wrapper>
534
534
  ${this.renderCalendar()}
535
- `}handleCalendarPosition(){var t;if(this.popupRef.value&&this.inputRef.value){const n=this.multiple&&!!this.maxlength,r=((t=this.inputRef.value.parentElement)==null?void 0:t.getBoundingClientRect())||this.inputRef.value.getBoundingClientRect(),i=n?r.height+30:r.height,o=this.popupRef.value.getBoundingClientRect().height;let u=n?"calc(100% - 30px)":"100%";r&&r.top+o>window.innerHeight&&r.top-o>0&&(u=`calc(100% - ${i}px - ${o}px)`),this.popupRef.value.style.top=u}}handleFocusOut(t){this.contains(t.target)||(this.onBlur(),this.hideCalendar())}async showCalendar(){var t;this.calendarOpen=!0,await bu(20),this.handleCalendarPosition(),this.isMobileSafari&&((t=this.calRef.value)==null||t.focusOnCurrentDate())}hideCalendar(){this.calendarOpen=!1}async toggleCalendar(t){t.preventDefault(),this.calendarOpen?this.hideCalendar():this.showCalendar()}};Ve([j({type:String,reflect:!0})],Ie.prototype,"value",2),Ve([j({type:Array})],Ie.prototype,"_value",2),Ve([j({type:String})],Ie.prototype,"label",2),Ve([j({type:String})],Ie.prototype,"dateformat",2),Ve([j({type:Boolean,reflect:!0})],Ie.prototype,"multiple",2),Ve([j({type:Number})],Ie.prototype,"maxlength",2),Ve([j({type:Boolean,reflect:!0})],Ie.prototype,"range",2),Ve([j({type:String})],Ie.prototype,"min",2),Ve([j({type:String})],Ie.prototype,"max",2),Ve([j({type:Boolean})],Ie.prototype,"weeknumbers",2),Ve([j({type:Boolean})],Ie.prototype,"withcontrols",2),Ve([j({type:Boolean})],Ie.prototype,"fullwidth",2),Ve([j({converter:lr.csvToArray})],Ie.prototype,"excludedates",2),Ve([j({converter:lr.csvToArray})],Ie.prototype,"excludeweekdays",2),Ve([j({type:String})],Ie.prototype,"currentmonth",2),Ve([j({type:Boolean})],Ie.prototype,"useWrapper",2),Ve([j({type:Boolean,reflect:!0})],Ie.prototype,"calendarOpen",2),Ve([j({type:String})],Ie.prototype,"timezone",2),Ie=Ve([At("pkt-datepicker")],Ie);const Dg="pkt-link",bg=!0,kg={href:{name:"URL",description:"URL til lenken",type:"string",default:"#"},target:{name:"Mål",description:"Mål for lenken",type:["_blank","_self","_parent","_top"],default:"_self"},iconName:{name:"Ikon",description:"Ikon som skal vises ved siden av lenketeksten",type:"icon"},iconPosition:{name:"Ikonposisjon",description:"Posisjonen til ikonet i forhold til lenketeksten",type:["left","right"]},external:{name:"Ekstern lenke",description:"Vis ikon for ekstern lenke",type:"boolean",default:!1}},wg={default:{description:"Innholdet i lenken"}},xs={name:Dg,"css-class":"pkt-link","dark-mode":!0,isElement:bg,props:kg,slots:wg};var Cg=Object.defineProperty,_g=Object.getOwnPropertyDescriptor,hr=(e,t,n,r)=>{for(var i=r>1?void 0:r?_g(t,n):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(i=(r?u(t,n,i):u(i))||i);return r&&i&&Cg(t,n,i),i};let Dn=class extends kt{constructor(){super(),this.defaultSlot=ut(),this.href=xs.props.href.default,this.iconName=void 0,this.iconPosition=void 0,this.external=xs.props.external.default,this.target=xs.props.target.default,this.slotController=new fn(this,this.defaultSlot)}render(){const e={"pkt-link":!0,"pkt-link--icon-left":!!this.iconName&&this.iconPosition==="left"||!!(this.iconName&&!this.iconPosition),"pkt-link--icon-right":!!this.iconName&&this.iconPosition==="right","pkt-link--external":this.external};return V`<a
535
+ `}handleCalendarPosition(){var e;if(this.popupRef.value&&this.inputRef.value){const t=this.multiple&&!!this.maxlength,n=((e=this.inputRef.value.parentElement)==null?void 0:e.getBoundingClientRect())||this.inputRef.value.getBoundingClientRect(),r=t?n.height+30:n.height,i=this.popupRef.value.getBoundingClientRect().height;let o=t?"calc(100% - 30px)":"100%";n&&n.top+i>window.innerHeight&&n.top-i>0&&(o=`calc(100% - ${r}px - ${i}px)`),this.popupRef.value.style.top=o}}handleFocusOut(e){this.contains(e.target)||(this.onBlur(),this.hideCalendar())}async showCalendar(){var e;this.calendarOpen=!0,await bu(20),this.handleCalendarPosition(),this.isMobileSafari&&((e=this.calRef.value)==null||e.focusOnCurrentDate())}hideCalendar(){this.calendarOpen=!1}async toggleCalendar(e){e.preventDefault(),this.calendarOpen?this.hideCalendar():this.showCalendar()}};Ve([j({type:String,reflect:!0})],Ie.prototype,"value",2),Ve([j({type:Array})],Ie.prototype,"_value",2),Ve([j({type:String})],Ie.prototype,"label",2),Ve([j({type:String})],Ie.prototype,"dateformat",2),Ve([j({type:Boolean,reflect:!0})],Ie.prototype,"multiple",2),Ve([j({type:Number})],Ie.prototype,"maxlength",2),Ve([j({type:Boolean,reflect:!0})],Ie.prototype,"range",2),Ve([j({type:String})],Ie.prototype,"min",2),Ve([j({type:String})],Ie.prototype,"max",2),Ve([j({type:Boolean})],Ie.prototype,"weeknumbers",2),Ve([j({type:Boolean})],Ie.prototype,"withcontrols",2),Ve([j({type:Boolean})],Ie.prototype,"fullwidth",2),Ve([j({converter:lr.csvToArray})],Ie.prototype,"excludedates",2),Ve([j({converter:lr.csvToArray})],Ie.prototype,"excludeweekdays",2),Ve([j({type:String})],Ie.prototype,"currentmonth",2),Ve([j({type:Boolean})],Ie.prototype,"useWrapper",2),Ve([j({type:Boolean,reflect:!0})],Ie.prototype,"calendarOpen",2),Ve([j({type:String})],Ie.prototype,"timezone",2),Ie=Ve([At("pkt-datepicker")],Ie);const Dg="pkt-link",bg=!0,kg={href:{name:"URL",description:"URL til lenken",type:"string",default:"#"},target:{name:"Mål",description:"Mål for lenken",type:["_blank","_self","_parent","_top"],default:"_self"},iconName:{name:"Ikon",description:"Ikon som skal vises ved siden av lenketeksten",type:"icon"},iconPosition:{name:"Ikonposisjon",description:"Posisjonen til ikonet i forhold til lenketeksten",type:["left","right"]},external:{name:"Ekstern lenke",description:"Vis ikon for ekstern lenke",type:"boolean",default:!1}},wg={default:{description:"Innholdet i lenken"}},xs={name:Dg,"css-class":"pkt-link","dark-mode":!0,isElement:bg,props:kg,slots:wg};var Cg=Object.defineProperty,_g=Object.getOwnPropertyDescriptor,hr=(e,t,n,r)=>{for(var i=r>1?void 0:r?_g(t,n):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(i=(r?u(t,n,i):u(i))||i);return r&&i&&Cg(t,n,i),i};let Dn=class extends kt{constructor(){super(),this.defaultSlot=ut(),this.href=xs.props.href.default,this.iconName=void 0,this.iconPosition=void 0,this.external=xs.props.external.default,this.target=xs.props.target.default,this.slotController=new fn(this,this.defaultSlot)}render(){const e={"pkt-link":!0,"pkt-link--icon-left":!!this.iconName&&this.iconPosition==="left"||!!(this.iconName&&!this.iconPosition),"pkt-link--icon-right":!!this.iconName&&this.iconPosition==="right","pkt-link--external":this.external};return V`<a
536
536
  class=${Re(e)}
537
537
  href=${this.href}
538
538
  @click=${this.handleClick}
@@ -550,9 +550,9 @@ React keys must be passed directly to JSX without using spread:
550
550
  </div>`:te}
551
551
  ${this.title?V`<div class="pkt-messagebox__title">${this.title}</div>`:te}
552
552
  <div class="pkt-messagebox__text" ${Je(this.defaultSlot)}></div>
553
- </div>`}};fr([j({type:Boolean,reflect:!0})],bn.prototype,"closable",2),fr([j({type:Boolean,reflect:!0})],bn.prototype,"compact",2),fr([j({type:String,reflect:!0})],bn.prototype,"title",2),fr([j({type:String,reflect:!0})],bn.prototype,"skin",2),fr([Pt()],bn.prototype,"_isClosed",2),bn=fr([At("pkt-messagebox")],bn);const Bg="pkt-modal",Ng=!0,jg={"background-click":{description:"Event som trigges når bakgrunnen trykkes på"},close:{description:"Event som trigges når meldingsboksen lukkes"}},Pg={headingText:{name:"Heading text",description:"Heading tekst på modalen",type:"string"},hideCloseButton:{name:"Gjem 'Lukk'-knapp",description:"Gjemmer lukkeknappen. Dersom denne er satt til true, vil ikke lukkeknappen vises, og dermed er det viktig at man tilbyr en annen måte som f.eks. en knapp for å lukke modalen på.",type:"boolean",default:!1},closeOnBackdropClick:{name:"Lukk modalen når bakgrunnen trykkes på",description:"Lukk modalen når bakgrunnen trykkes på",type:"boolean",default:!1},size:{name:"Størrelse",description:"Størrelsen på modalen",type:["small","medium","large"],default:"medium"}},Lg={default:{description:"Innholdet i meldingen. Her tilbyr vi støtteklasser for å style 1-3 knapper i modalen."}},Es={name:Bg,"css-class":"pkt-modal",isElements:Ng,events:jg,props:Pg,slots:Lg};var Og=Object.defineProperty,Mg=Object.getOwnPropertyDescriptor,mr=(e,t,n,r)=>{for(var i=r>1?void 0:r?Mg(t,n):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(i=(r?u(t,n,i):u(i))||i);return r&&i&&Og(t,n,i),i};let kn=class extends kt{constructor(){super(),this.headingText="",this.hideCloseButton=Es.props.hideCloseButton.default,this.closeOnBackdropClick=Es.props.closeOnBackdropClick.default,this.size=Es.props.size.default,this.defaultSlot=ut(),this.dialogRef=ut(),this._isOpen=!1,this.close=t=>{var n;this._isOpen=!1,(n=this.dialogRef.value)==null||n.close();const r=document.activeElement;r&&!this.isElementInViewport(r)&&r.scrollIntoView({behavior:"smooth",block:"nearest"}),this.dispatchEvent(new CustomEvent("close",{detail:{origin:t},bubbles:!0,composed:!0})),document.querySelector(".pkt-modal")&&document.body.classList.remove("pkt-modal--open"),this.requestUpdate()},this.showModal=t=>{var n;this._isOpen=!0,(n=this.dialogRef.value)==null||n.showModal(),document.querySelector(".pkt-modal")&&document.body.classList.add("pkt-modal--open"),this.dispatchEvent(new CustomEvent("showModal",{detail:{origin:t},bubbles:!0,composed:!0})),this.requestUpdate()},this.slotController=new fn(this,this.defaultSlot),this._isOpen=!1}async connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this.handleKeyDown.bind(this)),document.addEventListener("click",this.handleBackdropClick.bind(this))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.handleKeyDown.bind(this)),document.removeEventListener("click",this.handleBackdropClick.bind(this))}handleKeyDown(t){t.key==="Escape"&&this.close(t)}handleBackdropClick(t){var n;this.closeOnBackdropClick&&t.target===((n=this.dialogRef)==null?void 0:n.value)&&this.close(t)}isElementInViewport(t){const n=t.getBoundingClientRect();return n.top>=0&&n.left>=0&&n.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&n.right<=(window.innerWidth||document.documentElement.clientWidth)}render(){const t={"pkt-modal":!0,[`pkt-modal--${this.size}`]:this.size!==void 0};return V`
553
+ </div>`}};fr([j({type:Boolean,reflect:!0})],bn.prototype,"closable",2),fr([j({type:Boolean,reflect:!0})],bn.prototype,"compact",2),fr([j({type:String,reflect:!0})],bn.prototype,"title",2),fr([j({type:String,reflect:!0})],bn.prototype,"skin",2),fr([Pt()],bn.prototype,"_isClosed",2),bn=fr([At("pkt-messagebox")],bn);const Bg="pkt-modal",Ng=!0,jg={"background-click":{description:"Event som trigges når bakgrunnen trykkes på"},close:{description:"Event som trigges når meldingsboksen lukkes"}},Pg={headingText:{name:"Heading text",description:"Heading tekst på modalen",type:"string"},hideCloseButton:{name:"Gjem 'Lukk'-knapp",description:"Gjemmer lukkeknappen. Dersom denne er satt til true, vil ikke lukkeknappen vises, og dermed er det viktig at man tilbyr en annen måte som f.eks. en knapp for å lukke modalen på.",type:"boolean",default:!1},closeOnBackdropClick:{name:"Lukk modalen når bakgrunnen trykkes på",description:"Lukk modalen når bakgrunnen trykkes på",type:"boolean",default:!1},size:{name:"Størrelse",description:"Størrelsen på modalen",type:["small","medium","large"],default:"medium"}},Lg={default:{description:"Innholdet i meldingen. Her tilbyr vi støtteklasser for å style 1-3 knapper i modalen."}},Es={name:Bg,"css-class":"pkt-modal",isElements:Ng,events:jg,props:Pg,slots:Lg};var Og=Object.defineProperty,Mg=Object.getOwnPropertyDescriptor,mr=(e,t,n,r)=>{for(var i=r>1?void 0:r?Mg(t,n):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(i=(r?u(t,n,i):u(i))||i);return r&&i&&Og(t,n,i),i};let kn=class extends kt{constructor(){super(),this.headingText="",this.hideCloseButton=Es.props.hideCloseButton.default,this.closeOnBackdropClick=Es.props.closeOnBackdropClick.default,this.size=Es.props.size.default,this.defaultSlot=ut(),this.dialogRef=ut(),this._isOpen=!1,this.close=(e,t=!1)=>{var n;this._isOpen=!1,t||(n=this.dialogRef.value)==null||n.close();const r=document.activeElement;r&&!this.isElementInViewport(r)&&r.scrollIntoView({behavior:"smooth",block:"nearest"}),this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!0,composed:!0})),document.querySelector(".pkt-modal")&&document.body.classList.remove("pkt-modal--open"),this.requestUpdate()},this.showModal=e=>{var t;this._isOpen=!0,(t=this.dialogRef.value)==null||t.showModal(),document.querySelector(".pkt-modal")&&document.body.classList.add("pkt-modal--open"),this.dispatchEvent(new CustomEvent("showModal",{detail:{origin:e},bubbles:!0,composed:!0})),this.requestUpdate()},this.slotController=new fn(this,this.defaultSlot),this._isOpen=!1}async connectedCallback(){var e;super.connectedCallback(),document.addEventListener("keydown",this.handleKeyDown.bind(this)),document.addEventListener("click",this.handleBackdropClick.bind(this)),(e=this.dialogRef.value)==null||e.addEventListener("submit",t=>this.close(t,!0))}disconnectedCallback(){var e;super.disconnectedCallback(),document.removeEventListener("keydown",this.handleKeyDown.bind(this)),document.removeEventListener("click",this.handleBackdropClick.bind(this)),(e=this.dialogRef.value)==null||e.removeEventListener("submit",t=>this.close(t,!0))}handleKeyDown(e){e.key==="Escape"&&this.close(e)}handleBackdropClick(e){var t;this.closeOnBackdropClick&&e.target===((t=this.dialogRef)==null?void 0:t.value)&&this.close(e)}isElementInViewport(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}render(){const e={"pkt-modal":!0,[`pkt-modal--${this.size}`]:this.size!==void 0};return V`
554
554
  <dialog
555
- class=${Re(t)}
555
+ class=${Re(e)}
556
556
  aria-modal=${this._isOpen}
557
557
  ${Je(this.dialogRef)}
558
558
  aria-labelledby="pkt-modal__headingText"
@@ -565,7 +565,7 @@ React keys must be passed directly to JSX without using spread:
565
565
  </h1>`:te}
566
566
  ${this.hideCloseButton?te:V`<div class="pkt-modal__closeButton">
567
567
  <button
568
- @click=${n=>this.close(n)}
568
+ @click=${t=>this.close(t)}
569
569
  class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only"
570
570
  aria-label="close"
571
571
  >
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-react",
3
- "version": "12.11.0",
3
+ "version": "12.11.1",
4
4
  "description": "React komponentbibliotek til Punkt, et designsystem laget av Oslo Origo",
5
5
  "homepage": "https://punkt.oslo.kommune.no",
6
6
  "author": "Team Designsystem, Oslo Origo",
@@ -48,7 +48,7 @@
48
48
  "devDependencies": {
49
49
  "@oslokommune/punkt-assets": "^12.7.3",
50
50
  "@oslokommune/punkt-css": "^12.11.0",
51
- "@oslokommune/punkt-elements": "^12.11.0",
51
+ "@oslokommune/punkt-elements": "^12.11.1",
52
52
  "@testing-library/jest-dom": "^6.5.0",
53
53
  "@testing-library/react": "^16.0.1",
54
54
  "@testing-library/user-event": "^14.5.2",
@@ -111,5 +111,5 @@
111
111
  "url": "https://github.com/oslokommune/punkt/issues"
112
112
  },
113
113
  "license": "MIT",
114
- "gitHead": "727c8399a34e90ebfb7e843f0adfe0c4f828fa9f"
114
+ "gitHead": "85f7b78833f3b70bdeb9de59940e1c40d97aab57"
115
115
  }