nve-designsystem 0.1.80 → 0.1.82

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.
@@ -0,0 +1,21 @@
1
+ function u(t, c) {
2
+ const l = {
3
+ waitUntilFirstUpdate: !1,
4
+ ...c
5
+ };
6
+ return (a, o) => {
7
+ const { update: d } = a, f = Array.isArray(t) ? t : [t];
8
+ a.update = function(i) {
9
+ f.forEach((h) => {
10
+ const s = h;
11
+ if (i.has(s)) {
12
+ const n = i.get(s), e = this[s];
13
+ n !== e && (!l.waitUntilFirstUpdate || this.hasUpdated) && this[o](n, e);
14
+ }
15
+ }), d.call(this, i);
16
+ };
17
+ };
18
+ }
19
+ export {
20
+ u as w
21
+ };
@@ -0,0 +1,28 @@
1
+ import { INveComponent } from '../../interfaces/NveComponent.interface';
2
+ import { LitElement, TemplateResult } from 'lit';
3
+ /**
4
+ * Komponent for å sette .darkmode-klasse på root.
5
+ * Må kun være en av dem på siden, de vil ikke synkronisere data.
6
+ *
7
+ * Hvorvidt bruker foretrekker dark-mode eller ikke hentes fra browser via "prefers-color-scheme".
8
+ * Dersom bruker setter darkmode ved å klikke på komponenten, lagres valget i localstorage.
9
+ *
10
+ * Man kan bruke "darkmodeclass" for å sette klassen som legges til dersom den ikke er "darkmode"
11
+ */
12
+ export default class NveDarkmodeSwitch extends LitElement implements INveComponent {
13
+ constructor();
14
+ testId: string;
15
+ darkmode: boolean;
16
+ darkmodeclass: string;
17
+ localStorageVariable: string;
18
+ private toggleDarkmode;
19
+ private checkFocus;
20
+ private checkInput;
21
+ connectedCallback(): void;
22
+ render(): TemplateResult;
23
+ }
24
+ declare global {
25
+ interface HTMLElementTagNameMap {
26
+ 'nve-darkmode-switch': NveDarkmodeSwitch;
27
+ }
28
+ }
@@ -0,0 +1,53 @@
1
+ import { s as n, x as m } from "../../chunks/lit-element.js";
2
+ import { n as i, t as h } from "../../chunks/property.js";
3
+ var u = Object.defineProperty, k = Object.getOwnPropertyDescriptor, a = (t, e, c, s) => {
4
+ for (var o = s > 1 ? void 0 : s ? k(e, c) : e, d = t.length - 1, l; d >= 0; d--)
5
+ (l = t[d]) && (o = (s ? l(e, c, o) : l(o)) || o);
6
+ return s && o && u(e, c, o), o;
7
+ };
8
+ let r = class extends n {
9
+ constructor() {
10
+ super(), this.testId = "", this.darkmode = !1, this.darkmodeclass = "darkmode", this.localStorageVariable = "preferdarkmode";
11
+ }
12
+ toggleDarkmode(t) {
13
+ console.dir(1), this.darkmode = !!t.target.checked, localStorage.setItem(this.localStorageVariable, this.darkmode.toString()), this.darkmode ? document.documentElement.classList.add(this.darkmodeclass) : document.documentElement.classList.remove(this.darkmodeclass);
14
+ }
15
+ checkFocus() {
16
+ console.dir(2);
17
+ }
18
+ checkInput() {
19
+ console.dir(3);
20
+ }
21
+ connectedCallback() {
22
+ super.connectedCallback();
23
+ const t = localStorage.getItem(this.localStorageVariable);
24
+ let e = !1;
25
+ t === null ? window.matchMedia("(prefers-color-scheme: dark)").matches && (e = !0) : e = t === "true", e ? (this.darkmode = !0, document.documentElement.classList.add(this.darkmodeclass)) : (this.darkmode = !1, document.documentElement.classList.remove(this.darkmodeclass));
26
+ }
27
+ render() {
28
+ return m`<nve-switch
29
+ @change=${this.toggleDarkmode}
30
+ @focus=${this.checkFocus}
31
+ @input=${this.checkInput}
32
+ ?checked=${this.darkmode}
33
+ >
34
+ <nve-icon slot="onicon" name="dark_mode"></nve-icon>
35
+ <nve-icon slot="officon" name="light_mode"></nve-icon>
36
+ </nve-switch>`;
37
+ }
38
+ };
39
+ a([
40
+ i({ reflect: !0, type: String })
41
+ ], r.prototype, "testId", 2);
42
+ a([
43
+ i({ attribute: !1, type: Boolean })
44
+ ], r.prototype, "darkmode", 2);
45
+ a([
46
+ i({ attribute: !0, type: String })
47
+ ], r.prototype, "darkmodeclass", 2);
48
+ r = a([
49
+ h("nve-darkmode-switch")
50
+ ], r);
51
+ export {
52
+ r as default
53
+ };
@@ -1,18 +1,19 @@
1
- import { n, t as M } from "../../chunks/property.js";
1
+ import { n, t as E } from "../../chunks/property.js";
2
2
  import { r as p } from "../../chunks/state.js";
3
- import { f as S } from "../../chunks/chunk.SI4ACBFK.js";
4
- import { c as R, b as l, S as w } from "../../chunks/chunk.JS655M6J.js";
5
- import { i as E, x as g } from "../../chunks/lit-element.js";
6
- import { F as A, c as $, a as q, v as I } from "../../chunks/chunk.UEQZEZFU.js";
7
- import { e as v } from "../../chunks/query.js";
8
- import { H as L } from "../../chunks/chunk.NYIIDP5N.js";
9
- import { w as V } from "../../chunks/chunk.Q6ASPMKT.js";
10
- import { e as B } from "../../chunks/class-map.js";
11
- import G from "./nve-radio-group.styles.js";
12
- import { t as _ } from "../../chunks/updateInvalidProperty.js";
13
- var O = E`
14
- ${R}
15
- ${S}
3
+ import { f as V } from "../../chunks/chunk.SI4ACBFK.js";
4
+ import { c as y, b as l, S as C } from "../../chunks/chunk.JS655M6J.js";
5
+ import { i as _, x as g } from "../../chunks/lit-element.js";
6
+ import { F as x, c as k, a as M, v as S } from "../../chunks/chunk.UEQZEZFU.js";
7
+ import { e as b } from "../../chunks/query.js";
8
+ import { H as A } from "../../chunks/chunk.NYIIDP5N.js";
9
+ import { w as R } from "../../chunks/chunk.Q6ASPMKT.js";
10
+ import { e as $ } from "../../chunks/class-map.js";
11
+ import q from "./nve-radio-group.styles.js";
12
+ import { w as I } from "../../chunks/watch.js";
13
+ import { t as v } from "../../chunks/updateInvalidProperty.js";
14
+ var L = _`
15
+ ${y}
16
+ ${V}
16
17
 
17
18
  :host {
18
19
  display: block;
@@ -45,8 +46,8 @@ var O = E`
45
46
  white-space: nowrap;
46
47
  border: 0;
47
48
  }
48
- `, z = E`
49
- ${R}
49
+ `, B = _`
50
+ ${y}
50
51
 
51
52
  :host {
52
53
  display: inline-block;
@@ -56,31 +57,31 @@ var O = E`
56
57
  display: flex;
57
58
  flex-wrap: nowrap;
58
59
  }
59
- `, m = class extends w {
60
+ `, f = class extends C {
60
61
  constructor() {
61
62
  super(...arguments), this.disableRole = !1, this.label = "";
62
63
  }
63
64
  handleFocus(t) {
64
- const e = f(t.target);
65
+ const e = m(t.target);
65
66
  e == null || e.classList.add("sl-button-group__button--focus");
66
67
  }
67
68
  handleBlur(t) {
68
- const e = f(t.target);
69
+ const e = m(t.target);
69
70
  e == null || e.classList.remove("sl-button-group__button--focus");
70
71
  }
71
72
  handleMouseOver(t) {
72
- const e = f(t.target);
73
+ const e = m(t.target);
73
74
  e == null || e.classList.add("sl-button-group__button--hover");
74
75
  }
75
76
  handleMouseOut(t) {
76
- const e = f(t.target);
77
+ const e = m(t.target);
77
78
  e == null || e.classList.remove("sl-button-group__button--hover");
78
79
  }
79
80
  handleSlotChange() {
80
81
  const t = [...this.defaultSlot.assignedElements({ flatten: !0 })];
81
82
  t.forEach((e) => {
82
- const s = t.indexOf(e), o = f(e);
83
- o && (o.classList.add("sl-button-group__button"), o.classList.toggle("sl-button-group__button--first", s === 0), o.classList.toggle("sl-button-group__button--inner", s > 0 && s < t.length - 1), o.classList.toggle("sl-button-group__button--last", s === t.length - 1), o.classList.toggle("sl-button-group__button--radio", o.tagName.toLowerCase() === "sl-radio-button"));
83
+ const s = t.indexOf(e), i = m(e);
84
+ i && (i.classList.add("sl-button-group__button"), i.classList.toggle("sl-button-group__button--first", s === 0), i.classList.toggle("sl-button-group__button--inner", s > 0 && s < t.length - 1), i.classList.toggle("sl-button-group__button--last", s === t.length - 1), i.classList.toggle("sl-button-group__button--radio", i.tagName.toLowerCase() === "sl-radio-button"));
84
85
  });
85
86
  }
86
87
  render() {
@@ -100,29 +101,29 @@ var O = E`
100
101
  `;
101
102
  }
102
103
  };
103
- m.styles = z;
104
+ f.styles = B;
104
105
  l([
105
- v("slot")
106
- ], m.prototype, "defaultSlot", 2);
106
+ b("slot")
107
+ ], f.prototype, "defaultSlot", 2);
107
108
  l([
108
109
  p()
109
- ], m.prototype, "disableRole", 2);
110
+ ], f.prototype, "disableRole", 2);
110
111
  l([
111
112
  n()
112
- ], m.prototype, "label", 2);
113
- function f(t) {
113
+ ], f.prototype, "label", 2);
114
+ function m(t) {
114
115
  var e;
115
116
  const s = "sl-button, sl-radio-button";
116
117
  return (e = t.closest(s)) != null ? e : t.querySelector(s);
117
118
  }
118
- var a = class extends w {
119
+ var a = class extends C {
119
120
  constructor() {
120
- super(...arguments), this.formControlController = new A(this), this.hasSlotController = new L(this, "help-text", "label"), this.customValidityMessage = "", this.hasButtonGroup = !1, this.errorMessage = "", this.defaultValue = "", this.label = "", this.helpText = "", this.name = "option", this.value = "", this.size = "medium", this.form = "", this.required = !1;
121
+ super(...arguments), this.formControlController = new x(this), this.hasSlotController = new A(this, "help-text", "label"), this.customValidityMessage = "", this.hasButtonGroup = !1, this.errorMessage = "", this.defaultValue = "", this.label = "", this.helpText = "", this.name = "option", this.value = "", this.size = "medium", this.form = "", this.required = !1;
121
122
  }
122
123
  /** Gets the validity state object */
123
124
  get validity() {
124
125
  const t = this.required && !this.value;
125
- return this.customValidityMessage !== "" ? $ : t ? q : I;
126
+ return this.customValidityMessage !== "" ? k : t ? M : S;
126
127
  }
127
128
  /** Gets the validation message */
128
129
  get validationMessage() {
@@ -139,21 +140,21 @@ var a = class extends w {
139
140
  return [...this.querySelectorAll("sl-radio, sl-radio-button")];
140
141
  }
141
142
  handleRadioClick(t) {
142
- const e = t.target.closest("sl-radio, sl-radio-button"), s = this.getAllRadios(), o = this.value;
143
- e.disabled || (this.value = e.value, s.forEach((i) => i.checked = i === e), this.value !== o && (this.emit("sl-change"), this.emit("sl-input")));
143
+ const e = t.target.closest("sl-radio, sl-radio-button"), s = this.getAllRadios(), i = this.value;
144
+ e.disabled || (this.value = e.value, s.forEach((o) => o.checked = o === e), this.value !== i && (this.emit("sl-change"), this.emit("sl-input")));
144
145
  }
145
146
  handleKeyDown(t) {
146
147
  var e;
147
148
  if (!["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", " "].includes(t.key))
148
149
  return;
149
- const s = this.getAllRadios().filter((h) => !h.disabled), o = (e = s.find((h) => h.checked)) != null ? e : s[0], i = t.key === " " ? 0 : ["ArrowUp", "ArrowLeft"].includes(t.key) ? -1 : 1, u = this.value;
150
- let r = s.indexOf(o) + i;
151
- r < 0 && (r = s.length - 1), r > s.length - 1 && (r = 0), this.getAllRadios().forEach((h) => {
152
- h.checked = !1, this.hasButtonGroup || (h.tabIndex = -1);
153
- }), this.value = s[r].value, s[r].checked = !0, this.hasButtonGroup ? s[r].shadowRoot.querySelector("button").focus() : (s[r].tabIndex = 0, s[r].focus()), this.value !== u && (this.emit("sl-change"), this.emit("sl-input")), t.preventDefault();
150
+ const s = this.getAllRadios().filter((c) => !c.disabled), i = (e = s.find((c) => c.checked)) != null ? e : s[0], o = t.key === " " ? 0 : ["ArrowUp", "ArrowLeft"].includes(t.key) ? -1 : 1, h = this.value;
151
+ let r = s.indexOf(i) + o;
152
+ r < 0 && (r = s.length - 1), r > s.length - 1 && (r = 0), this.getAllRadios().forEach((c) => {
153
+ c.checked = !1, this.hasButtonGroup || (c.tabIndex = -1);
154
+ }), this.value = s[r].value, s[r].checked = !0, this.hasButtonGroup ? s[r].shadowRoot.querySelector("button").focus() : (s[r].tabIndex = 0, s[r].focus()), this.value !== h && (this.emit("sl-change"), this.emit("sl-input")), t.preventDefault();
154
155
  }
155
156
  handleLabelClick() {
156
- const t = this.getAllRadios(), s = t.find((o) => o.checked) || t[0];
157
+ const t = this.getAllRadios(), s = t.find((i) => i.checked) || t[0];
157
158
  s && s.focus();
158
159
  }
159
160
  handleInvalid(t) {
@@ -164,18 +165,18 @@ var a = class extends w {
164
165
  const s = this.getAllRadios();
165
166
  if (await Promise.all(
166
167
  // Sync the checked state and size
167
- s.map(async (o) => {
168
- await o.updateComplete, o.checked = o.value === this.value, o.size = this.size;
168
+ s.map(async (i) => {
169
+ await i.updateComplete, i.checked = i.value === this.value, i.size = this.size;
169
170
  })
170
- ), this.hasButtonGroup = s.some((o) => o.tagName.toLowerCase() === "sl-radio-button"), !s.some((o) => o.checked))
171
+ ), this.hasButtonGroup = s.some((i) => i.tagName.toLowerCase() === "sl-radio-button"), !s.some((i) => i.checked))
171
172
  if (this.hasButtonGroup) {
172
- const o = (t = s[0].shadowRoot) == null ? void 0 : t.querySelector("button");
173
- o && (o.tabIndex = 0);
173
+ const i = (t = s[0].shadowRoot) == null ? void 0 : t.querySelector("button");
174
+ i && (i.tabIndex = 0);
174
175
  } else
175
176
  s[0].tabIndex = 0;
176
177
  if (this.hasButtonGroup) {
177
- const o = (e = this.shadowRoot) == null ? void 0 : e.querySelector("sl-button-group");
178
- o && (o.disableRole = !0);
178
+ const i = (e = this.shadowRoot) == null ? void 0 : e.querySelector("sl-button-group");
179
+ i && (i.disableRole = !0);
179
180
  }
180
181
  }
181
182
  syncRadios() {
@@ -213,20 +214,20 @@ var a = class extends w {
213
214
  this.customValidityMessage = t, this.errorMessage = t, this.validationInput.setCustomValidity(t), this.formControlController.updateValidity();
214
215
  }
215
216
  render() {
216
- const t = this.hasSlotController.test("label"), e = this.hasSlotController.test("help-text"), s = this.label ? !0 : !!t, o = this.helpText ? !0 : !!e, i = g`
217
+ const t = this.hasSlotController.test("label"), e = this.hasSlotController.test("help-text"), s = this.label ? !0 : !!t, i = this.helpText ? !0 : !!e, o = g`
217
218
  <slot @slotchange=${this.syncRadios} @click=${this.handleRadioClick} @keydown=${this.handleKeyDown}></slot>
218
219
  `;
219
220
  return g`
220
221
  <fieldset
221
222
  part="form-control"
222
- class=${B({
223
+ class=${$({
223
224
  "form-control": !0,
224
225
  "form-control--small": this.size === "small",
225
226
  "form-control--medium": this.size === "medium",
226
227
  "form-control--large": this.size === "large",
227
228
  "form-control--radio-group": !0,
228
229
  "form-control--has-label": s,
229
- "form-control--has-help-text": o
230
+ "form-control--has-help-text": i
230
231
  })}
231
232
  role="radiogroup"
232
233
  aria-labelledby="label"
@@ -260,16 +261,16 @@ var a = class extends w {
260
261
 
261
262
  ${this.hasButtonGroup ? g`
262
263
  <sl-button-group part="button-group" exportparts="base:button-group__base" role="presentation">
263
- ${i}
264
+ ${o}
264
265
  </sl-button-group>
265
- ` : i}
266
+ ` : o}
266
267
  </div>
267
268
 
268
269
  <div
269
270
  part="form-control-help-text"
270
271
  id="help-text"
271
272
  class="form-control__help-text"
272
- aria-hidden=${o ? "false" : "true"}
273
+ aria-hidden=${i ? "false" : "true"}
273
274
  >
274
275
  <slot name="help-text">${this.helpText}</slot>
275
276
  </div>
@@ -277,13 +278,13 @@ var a = class extends w {
277
278
  `;
278
279
  }
279
280
  };
280
- a.styles = O;
281
- a.dependencies = { "sl-button-group": m };
281
+ a.styles = L;
282
+ a.dependencies = { "sl-button-group": f };
282
283
  l([
283
- v("slot:not([name])")
284
+ b("slot:not([name])")
284
285
  ], a.prototype, "defaultSlot", 2);
285
286
  l([
286
- v(".radio-group__validation-input")
287
+ b(".radio-group__validation-input")
287
288
  ], a.prototype, "validationInput", 2);
288
289
  l([
289
290
  p()
@@ -316,37 +317,19 @@ l([
316
317
  n({ type: Boolean, reflect: !0 })
317
318
  ], a.prototype, "required", 2);
318
319
  l([
319
- V("size", { waitUntilFirstUpdate: !0 })
320
+ R("size", { waitUntilFirstUpdate: !0 })
320
321
  ], a.prototype, "handleSizeChange", 1);
321
322
  l([
322
- V("value")
323
+ R("value")
323
324
  ], a.prototype, "handleValueChange", 1);
324
- var k = a;
325
+ var w = a;
325
326
  a.define("sl-radio-group");
326
- function D(t, e) {
327
- const s = {
328
- waitUntilFirstUpdate: !1,
329
- ...e
330
- };
331
- return (o, i) => {
332
- const { update: u } = o, r = Array.isArray(t) ? t : [t];
333
- o.update = function(h) {
334
- r.forEach((x) => {
335
- const b = x;
336
- if (h.has(b)) {
337
- const y = h.get(b), C = this[b];
338
- y !== C && (!s.waitUntilFirstUpdate || this.hasUpdated) && this[i](y, C);
339
- }
340
- }), u.call(this, h);
341
- };
342
- };
343
- }
344
- var T = Object.defineProperty, U = Object.getOwnPropertyDescriptor, c = (t, e, s, o) => {
345
- for (var i = o > 1 ? void 0 : o ? U(e, s) : e, u = t.length - 1, r; u >= 0; u--)
346
- (r = t[u]) && (i = (o ? r(e, s, i) : r(i)) || i);
347
- return o && i && T(e, s, i), i;
327
+ var G = Object.defineProperty, O = Object.getOwnPropertyDescriptor, u = (t, e, s, i) => {
328
+ for (var o = i > 1 ? void 0 : i ? O(e, s) : e, h = t.length - 1, r; h >= 0; h--)
329
+ (r = t[h]) && (o = (i ? r(e, s, o) : r(o)) || o);
330
+ return i && o && G(e, s, o), o;
348
331
  };
349
- let d = class extends k {
332
+ let d = class extends w {
350
333
  constructor() {
351
334
  super(), this.orientation = "vertical", this.disabled = !1, this.requiredLabel = "*Obligatorisk", this.testId = "", this.alreadyInvalid = !1, this.errorMessageCopy = "", this.getAllRadios = function() {
352
335
  return [
@@ -356,35 +339,35 @@ let d = class extends k {
356
339
  )
357
340
  ];
358
341
  }, this.handleRadioClick = function(t) {
359
- const e = t.target.closest("sl-radio, sl-radio-button, nve-radio, nve-radio-button"), s = this.getAllRadios(), o = this.value;
342
+ const e = t.target.closest("sl-radio, sl-radio-button, nve-radio, nve-radio-button"), s = this.getAllRadios(), i = this.value;
360
343
  if (!e || e.disabled)
361
344
  return;
362
- const i = e.shadowRoot.querySelectorAll("span[part='base']");
363
- i.length > 0 && i[0].focus(), this.value = e.value, s.forEach((u) => u.checked = u === e), this.value !== o && (this.emit("sl-change"), this.emit("sl-input"));
345
+ const o = e.shadowRoot.querySelectorAll("span[part='base']");
346
+ o.length > 0 && o[0].focus(), this.value = e.value, s.forEach((h) => h.checked = h === e), this.value !== i && (this.emit("sl-change"), this.emit("sl-input"));
364
347
  }, this.syncRadioElements = async function() {
365
- var e, s, o;
348
+ var e, s, i;
366
349
  const t = this.getAllRadios();
367
350
  if (await Promise.all(
368
351
  // Sync the checked state and size
369
352
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
370
- t.map(async (i) => {
371
- await i.updateComplete, i.checked = i.value === this.value, i.size = this.size;
353
+ t.map(async (o) => {
354
+ await o.updateComplete, o.checked = o.value === this.value, o.size = this.size;
372
355
  })
373
356
  ), this.hasButtonGroup = t.some(
374
357
  // @ts-ignore
375
- (i) => i.tagName.toLowerCase() === "sl-radio-button" || i.tagName.toLowerCase() === "nve-radio-button"
376
- ), !t.some((i) => i.checked))
358
+ (o) => o.tagName.toLowerCase() === "sl-radio-button" || o.tagName.toLowerCase() === "nve-radio-button"
359
+ ), !t.some((o) => o.checked))
377
360
  if (this.hasButtonGroup) {
378
- const i = (e = t[0].shadowRoot) == null ? void 0 : e.querySelector("button");
379
- i && (i.tabIndex = 0);
361
+ const o = (e = t[0].shadowRoot) == null ? void 0 : e.querySelector("button");
362
+ o && (o.tabIndex = 0);
380
363
  } else
381
364
  t[0].tabIndex = 0;
382
365
  if (this.hasButtonGroup) {
383
- const i = (
366
+ const o = (
384
367
  // @ts-ignore
385
- ((s = this.shadowRoot) == null ? void 0 : s.querySelector("sl-button-group")) || ((o = this.shadowRoot) == null ? void 0 : o.querySelector("nve-button-group"))
368
+ ((s = this.shadowRoot) == null ? void 0 : s.querySelector("sl-button-group")) || ((i = this.shadowRoot) == null ? void 0 : i.querySelector("nve-button-group"))
386
369
  );
387
- i && (i.disableRole = !0);
370
+ o && (o.disableRole = !0);
388
371
  }
389
372
  }, this.syncRadios = function() {
390
373
  if (customElements.get("sl-radio") && customElements.get("sl-radio-button") || // lagt til nve-radio og nve-radio-button
@@ -409,46 +392,46 @@ let d = class extends k {
409
392
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
410
393
  handlePropChange(t, e) {
411
394
  const s = this.getAllRadios();
412
- return e !== t ? (s.forEach((i) => {
413
- i.was_disabled === void 0 ? i.was_disabled = i.disabled : t === !0 ? i.disabled = i.was_disabled : (i.was_disabled = i.disabled, i.disabled = !0);
395
+ return e !== t ? (s.forEach((o) => {
396
+ o.was_disabled === void 0 ? o.was_disabled = o.disabled : t === !0 ? o.disabled = o.was_disabled : (o.was_disabled = o.disabled, o.disabled = !0);
414
397
  }), !0) : !1;
415
398
  }
416
399
  makeInvalid() {
417
400
  const t = this.getAllRadios();
418
- _(t, !0, "data-invalid"), this.errorMessageCopy || (this.errorMessageCopy = this.validationMessage), this.setCustomValidity(this.errorMessageCopy), this.style.setProperty("--radio-group-error-message", `"${this.errorMessageCopy}"`);
401
+ v(t, !0, "data-invalid"), this.errorMessageCopy || (this.errorMessageCopy = this.validationMessage), this.setCustomValidity(this.errorMessageCopy), this.style.setProperty("--radio-group-error-message", `"${this.errorMessageCopy}"`);
419
402
  }
420
403
  resetValidation() {
421
404
  const t = this.getAllRadios();
422
- this.errorMessageCopy = "", _(t, !1, "data-invalid"), this.setCustomValidity(""), this.style.removeProperty("--radio-group-error-message");
405
+ this.errorMessageCopy = "", v(t, !1, "data-invalid"), this.setCustomValidity(""), this.style.removeProperty("--radio-group-error-message");
423
406
  }
424
407
  };
425
- d.styles = [k.styles, G];
426
- c([
408
+ d.styles = [w.styles, q];
409
+ u([
427
410
  n({ reflect: !0 })
428
411
  ], d.prototype, "orientation", 2);
429
- c([
412
+ u([
430
413
  n({ type: Boolean, reflect: !0 })
431
414
  ], d.prototype, "disabled", 2);
432
- c([
415
+ u([
433
416
  n({ reflect: !0 })
434
417
  ], d.prototype, "errorMessage", 2);
435
- c([
418
+ u([
436
419
  n()
437
420
  ], d.prototype, "requiredLabel", 2);
438
- c([
421
+ u([
439
422
  n({ reflect: !0, type: String })
440
423
  ], d.prototype, "testId", 2);
441
- c([
424
+ u([
442
425
  p()
443
426
  ], d.prototype, "alreadyInvalid", 2);
444
- c([
427
+ u([
445
428
  p()
446
429
  ], d.prototype, "errorMessageCopy", 2);
447
- c([
448
- D("disabled")
430
+ u([
431
+ I("disabled")
449
432
  ], d.prototype, "connectedCallback", 1);
450
- d = c([
451
- M("nve-radio-group")
433
+ d = u([
434
+ E("nve-radio-group")
452
435
  ], d);
453
436
  export {
454
437
  d as default
@@ -137,7 +137,7 @@ let e = class extends h {
137
137
  return this.isLast ? "" : c`
138
138
  <div class="vertical-divider-container">
139
139
  <div
140
- style="${this.isOrientationVertical() ? `height:${this.spaceBetweenSteps}px` : `min-width:${this.spaceBetweenSteps}px`}"
140
+ style="${this.isOrientationVertical() ? `height:${this.spaceBetweenSteps}px` : ""}"
141
141
  class="${t} ${this.getDividerColorClass()}"
142
142
  ></div>
143
143
  </div>`;
@@ -84,7 +84,7 @@ const r = e`
84
84
  }
85
85
 
86
86
  .divider-not-reached-color {
87
- color:var(--neutrals-background-secondary, #E4E5E7);
87
+ background:var(--neutrals-background-secondary, #E4E5E7);
88
88
  }
89
89
 
90
90
  .divider-reached-color {
@@ -0,0 +1,53 @@
1
+ import { INveComponent } from '../../interfaces/NveComponent.interface';
2
+ import { CSSResultArray, LitElement, TemplateResult } from 'lit';
3
+ /**
4
+ * En vippe-bryter med støtte for ikoner.
5
+ *
6
+ * @slot - Tekst etter bryteren
7
+ * @slot onicon - Det første ikonet (til venstre). Synlig når status er PÅ
8
+ * @slot officon - Det andre ikonet (til høyre). Synlig når status er AV
9
+ *
10
+ * @event blur Bryter mister fokus
11
+ * @event change Bryter endres
12
+ * @event input Bryter endres
13
+ * @event focus Bryter får fokus
14
+ *
15
+ * @csspart base Topp-element
16
+ * @csspart control Element rundt bryteren
17
+ * @csspart thumb Bryter-indikatoren
18
+ * @csspart label Tekst bak bryteren
19
+ *
20
+ */
21
+ export default class NveSwitch extends LitElement implements INveComponent {
22
+ constructor();
23
+ testId: string;
24
+ /** Hidden checkbox som holder state */
25
+ input: HTMLInputElement;
26
+ private hasFocus;
27
+ title: string;
28
+ /** Navn på switch */
29
+ name: string;
30
+ /** Switchens verdi, bruk i forms */
31
+ value: string;
32
+ disabled: boolean;
33
+ /** Verdien til switchen. */
34
+ checked: boolean;
35
+ static styles: CSSResultArray;
36
+ private emit;
37
+ private handleBlur;
38
+ private handleInput;
39
+ private handleClick;
40
+ private handleFocus;
41
+ private handleKeyDown;
42
+ handleCheckedChange(): void;
43
+ /** click, focus og blur sendes til input (checkbox) */
44
+ click(): void;
45
+ focus(options?: FocusOptions): void;
46
+ blur(): void;
47
+ render(): TemplateResult;
48
+ }
49
+ declare global {
50
+ interface HTMLElementTagNameMap {
51
+ 'nve-switch': NveSwitch;
52
+ }
53
+ }