nve-designsystem 0.2.10 → 0.2.12

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.
@@ -12,6 +12,8 @@ export default class NveIcon extends LitElement {
12
12
  library: 'Outlined' | 'Sharp';
13
13
  /** Navnet på ikonet i Material Symbols-biblioteket */
14
14
  name: string;
15
+ /** Boolean som angir om ikonet har hatt tid til å laste. */
16
+ private iconLoaded;
15
17
  protected firstUpdated(): void;
16
18
  render(): import('lit-html').TemplateResult<1>;
17
19
  }
@@ -1,35 +1,146 @@
1
- import { h as m, k as c } from "../../chunks/lit-element.js";
2
- import { n as p, t as y } from "../../chunks/property.js";
3
- import f from "./nve-icon.styles.js";
4
- var h = Object.defineProperty, d = Object.getOwnPropertyDescriptor, n = (e, s, o, a) => {
5
- for (var t = a > 1 ? void 0 : a ? d(s, o) : s, i = e.length - 1, l; i >= 0; i--)
6
- (l = e[i]) && (t = (a ? l(s, o, t) : l(t)) || t);
7
- return a && t && h(s, o, t), t;
1
+ import { h as U, k as z } from "../../chunks/lit-element.js";
2
+ import { n as F, t as H } from "../../chunks/property.js";
3
+ import { r as J } from "../../chunks/state.js";
4
+ import K from "./nve-icon.styles.js";
5
+ function R(r) {
6
+ return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
7
+ }
8
+ var $ = { exports: {} };
9
+ (function(r) {
10
+ (function() {
11
+ function i(e, n) {
12
+ document.addEventListener ? e.addEventListener("scroll", n, !1) : e.attachEvent("scroll", n);
13
+ }
14
+ function L(e) {
15
+ document.body ? e() : document.addEventListener ? document.addEventListener("DOMContentLoaded", function n() {
16
+ document.removeEventListener("DOMContentLoaded", n), e();
17
+ }) : document.attachEvent("onreadystatechange", function n() {
18
+ (document.readyState == "interactive" || document.readyState == "complete") && (document.detachEvent("onreadystatechange", n), e());
19
+ });
20
+ }
21
+ function p(e) {
22
+ this.g = document.createElement("div"), this.g.setAttribute("aria-hidden", "true"), this.g.appendChild(document.createTextNode(e)), this.h = document.createElement("span"), this.i = document.createElement("span"), this.m = document.createElement("span"), this.j = document.createElement("span"), this.l = -1, this.h.style.cssText = "max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;", this.i.style.cssText = "max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;", this.j.style.cssText = "max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;", this.m.style.cssText = "display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;", this.h.appendChild(this.m), this.i.appendChild(this.j), this.g.appendChild(this.h), this.g.appendChild(this.i);
23
+ }
24
+ function s(e, n) {
25
+ e.g.style.cssText = "max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;white-space:nowrap;font-synthesis:none;font:" + n + ";";
26
+ }
27
+ function x(e) {
28
+ var n = e.g.offsetWidth, t = n + 100;
29
+ return e.j.style.width = t + "px", e.i.scrollLeft = t, e.h.scrollLeft = e.h.scrollWidth + 100, e.l !== n ? (e.l = n, !0) : !1;
30
+ }
31
+ function y(e, n) {
32
+ function t() {
33
+ var l = u;
34
+ x(l) && l.g.parentNode !== null && n(l.l);
35
+ }
36
+ var u = e;
37
+ i(e.h, t), i(e.i, t), x(e);
38
+ }
39
+ function I(e, n, t) {
40
+ n = n || {}, t = t || window, this.family = e, this.style = n.style || "normal", this.weight = n.weight || "normal", this.stretch = n.stretch || "normal", this.context = t;
41
+ }
42
+ var O = null, T = null, P = null, A = null;
43
+ function q(e) {
44
+ return T === null && (N(e) && /Apple/.test(window.navigator.vendor) ? (e = /AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(window.navigator.userAgent), T = !!e && 603 > parseInt(e[1], 10)) : T = !1), T;
45
+ }
46
+ function N(e) {
47
+ return A === null && (A = !!e.document.fonts), A;
48
+ }
49
+ function v(e, n) {
50
+ var t = e.style, u = e.weight;
51
+ if (P === null) {
52
+ var l = document.createElement("div");
53
+ try {
54
+ l.style.font = "condensed 100px sans-serif";
55
+ } catch {
56
+ }
57
+ P = l.style.font !== "";
58
+ }
59
+ return [t, u, P ? e.stretch : "", "100px", n].join(" ");
60
+ }
61
+ I.prototype.load = function(e, n) {
62
+ var t = this, u = e || "BESbswy", l = 0, g = n || 3e3, S = (/* @__PURE__ */ new Date()).getTime();
63
+ return new Promise(function(k, M) {
64
+ if (N(t.context) && !q(t.context)) {
65
+ var B = new Promise(function(w, b) {
66
+ function d() {
67
+ (/* @__PURE__ */ new Date()).getTime() - S >= g ? b(Error("" + g + "ms timeout exceeded")) : t.context.document.fonts.load(v(t, '"' + t.family + '"'), u).then(function(m) {
68
+ 1 <= m.length ? w() : setTimeout(d, 25);
69
+ }, b);
70
+ }
71
+ d();
72
+ }), G = new Promise(function(w, b) {
73
+ l = setTimeout(function() {
74
+ b(Error("" + g + "ms timeout exceeded"));
75
+ }, g);
76
+ });
77
+ Promise.race([G, B]).then(function() {
78
+ clearTimeout(l), k(t);
79
+ }, M);
80
+ } else L(function() {
81
+ function w() {
82
+ var o;
83
+ (o = c != -1 && h != -1 || c != -1 && f != -1 || h != -1 && f != -1) && ((o = c != h && c != f && h != f) || (O === null && (o = /AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent), O = !!o && (536 > parseInt(o[1], 10) || parseInt(o[1], 10) === 536 && 11 >= parseInt(o[2], 10))), o = O && (c == D && h == D && f == D || c == W && h == W && f == W || c == _ && h == _ && f == _)), o = !o), o && (a.parentNode !== null && a.parentNode.removeChild(a), clearTimeout(l), k(t));
84
+ }
85
+ function b() {
86
+ if ((/* @__PURE__ */ new Date()).getTime() - S >= g) a.parentNode !== null && a.parentNode.removeChild(a), M(Error("" + g + "ms timeout exceeded"));
87
+ else {
88
+ var o = t.context.document.hidden;
89
+ (o === !0 || o === void 0) && (c = d.g.offsetWidth, h = m.g.offsetWidth, f = E.g.offsetWidth, w()), l = setTimeout(b, 50);
90
+ }
91
+ }
92
+ var d = new p(u), m = new p(u), E = new p(u), c = -1, h = -1, f = -1, D = -1, W = -1, _ = -1, a = document.createElement("div");
93
+ a.dir = "ltr", s(d, v(t, "sans-serif")), s(m, v(t, "serif")), s(E, v(t, "monospace")), a.appendChild(d.g), a.appendChild(m.g), a.appendChild(E.g), t.context.document.body.appendChild(a), D = d.g.offsetWidth, W = m.g.offsetWidth, _ = E.g.offsetWidth, b(), y(d, function(o) {
94
+ c = o, w();
95
+ }), s(d, v(t, '"' + t.family + '",sans-serif')), y(m, function(o) {
96
+ h = o, w();
97
+ }), s(m, v(t, '"' + t.family + '",serif')), y(E, function(o) {
98
+ f = o, w();
99
+ }), s(E, v(t, '"' + t.family + '",monospace'));
100
+ });
101
+ });
102
+ }, r.exports = I;
103
+ })();
104
+ })($);
105
+ var Q = $.exports;
106
+ const V = /* @__PURE__ */ R(Q);
107
+ var X = Object.defineProperty, Y = Object.getOwnPropertyDescriptor, j = (r, i, L, p) => {
108
+ for (var s = p > 1 ? void 0 : p ? Y(i, L) : i, x = r.length - 1, y; x >= 0; x--)
109
+ (y = r[x]) && (s = (p ? y(i, L, s) : y(s)) || s);
110
+ return p && s && X(i, L, s), s;
8
111
  };
9
- let r = class extends m {
112
+ let C = class extends U {
10
113
  constructor() {
11
- super(...arguments), this.library = "Sharp", this.name = "";
114
+ super(...arguments), this.library = "Sharp", this.name = "", this.iconLoaded = !1;
12
115
  }
13
116
  firstUpdated() {
14
117
  if (!document.getElementById(`material-icons-${this.library.toLowerCase()}`)) {
15
- const e = document.createElement("link");
16
- e.id = `material-icons-${this.library.toLowerCase()}`, e.rel = "stylesheet", e.href = `https://fonts.googleapis.com/css2?family=Material+Symbols+${this.library}:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200`, document.head.appendChild(e);
118
+ const i = document.createElement("link");
119
+ i.id = `material-icons-${this.library.toLowerCase()}`, i.rel = "stylesheet", i.href = `https://fonts.googleapis.com/css2?family=Material+Symbols+${this.library}:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200`, document.head.appendChild(i);
17
120
  }
121
+ new V(`Material Symbols ${this.library}`).load().then(() => {
122
+ this.iconLoaded = !0, this.requestUpdate();
123
+ }).catch((i) => {
124
+ console.error("Failed to load the icon font:", i);
125
+ });
18
126
  }
19
127
  render() {
20
- return c`<span part="icon" style="font-family:Material Symbols ${this.library}">${this.name}</span>`;
128
+ return this.iconLoaded ? z`<span part="icon" style="font-family: 'Material Symbols ${this.library}'; ">${this.name}</span>` : z`<nve-skeleton class="placeholder" effect="sheen"></nve-skeleton>`;
21
129
  }
22
130
  };
23
- r.styles = [f];
24
- n([
25
- p({ type: String })
26
- ], r.prototype, "library", 2);
27
- n([
28
- p({ reflect: !0 })
29
- ], r.prototype, "name", 2);
30
- r = n([
31
- y("nve-icon")
32
- ], r);
131
+ C.styles = [K];
132
+ j([
133
+ F({ type: String })
134
+ ], C.prototype, "library", 2);
135
+ j([
136
+ F({ reflect: !0 })
137
+ ], C.prototype, "name", 2);
138
+ j([
139
+ J()
140
+ ], C.prototype, "iconLoaded", 2);
141
+ C = j([
142
+ H("nve-icon")
143
+ ], C);
33
144
  export {
34
- r as default
145
+ C as default
35
146
  };
@@ -1,5 +1,5 @@
1
1
  import { i as e } from "../../chunks/lit-element.js";
2
- const o = e`
2
+ const n = e`
3
3
  /* Brukes i dropdown. Eneste måten å override shadow dom for å rotere expand_more ikonet når menyen åpner */
4
4
  :host([name='expand_more']) {
5
5
  transform: var(--icon-rotation, none);
@@ -26,7 +26,13 @@ const o = e`
26
26
  line-height: 24px;
27
27
  font-weight: var(--font-weight-regular);
28
28
  }
29
+
30
+ .placeholder::part(indicator) {
31
+ width: 24px;
32
+ height: 24px;
33
+ border-radius: 4px;
34
+ }
29
35
  `;
30
36
  export {
31
- o as default
37
+ n as default
32
38
  };
@@ -28,6 +28,8 @@ export default class NveInput extends SlInput implements INveComponent {
28
28
  * Brukes for å kunne identifisere komponenten
29
29
  */
30
30
  inputId?: string;
31
+ /** Brukes for å hindre nettleseren fra å validere feltet */
32
+ noValidation: boolean;
31
33
  protected alreadyInvalid: boolean;
32
34
  static styles: import('lit').CSSResultGroup[];
33
35
  constructor();
@@ -1,4 +1,4 @@
1
- import { n as l, t as g } from "../../chunks/property.js";
1
+ import { n as o, t as g } from "../../chunks/property.js";
2
2
  import { r as b } from "../../chunks/state.js";
3
3
  import { i as y, k as h } from "../../chunks/lit-element.js";
4
4
  import { d as _ } from "../../chunks/chunk.GI7VDIWX.js";
@@ -358,8 +358,8 @@ var A = y`
358
358
  this.formControlController.setValidity(!1), this.formControlController.emitInvalidEvent(t);
359
359
  }
360
360
  handleKeyDown(t) {
361
- const o = t.metaKey || t.ctrlKey || t.shiftKey || t.altKey;
362
- t.key === "Enter" && !o && setTimeout(() => {
361
+ const l = t.metaKey || t.ctrlKey || t.shiftKey || t.altKey;
362
+ t.key === "Enter" && !l && setTimeout(() => {
363
363
  !t.defaultPrevented && !t.isComposing && this.formControlController.submit();
364
364
  });
365
365
  }
@@ -388,13 +388,13 @@ var A = y`
388
388
  this.input.select();
389
389
  }
390
390
  /** Sets the start and end positions of the text selection (0-based). */
391
- setSelectionRange(t, o, s = "none") {
392
- this.input.setSelectionRange(t, o, s);
391
+ setSelectionRange(t, l, s = "none") {
392
+ this.input.setSelectionRange(t, l, s);
393
393
  }
394
394
  /** Replaces a range of text with a new string. */
395
- setRangeText(t, o, s, a = "preserve") {
396
- const n = o ?? this.input.selectionStart, p = s ?? this.input.selectionEnd;
397
- this.input.setRangeText(t, n, p, a), this.value !== this.input.value && (this.value = this.input.value);
395
+ setRangeText(t, l, s, a = "preserve") {
396
+ const n = l ?? this.input.selectionStart, u = s ?? this.input.selectionEnd;
397
+ this.input.setRangeText(t, n, u, a), this.value !== this.input.value && (this.value = this.input.value);
398
398
  }
399
399
  /** Displays the browser picker for an input element (only works if the browser supports it for the input type). */
400
400
  showPicker() {
@@ -425,7 +425,7 @@ var A = y`
425
425
  this.input.setCustomValidity(t), this.formControlController.updateValidity();
426
426
  }
427
427
  render() {
428
- const t = this.hasSlotController.test("label"), o = this.hasSlotController.test("help-text"), s = this.label ? !0 : !!t, a = this.helpText ? !0 : !!o, p = this.clearable && !this.disabled && !this.readonly && (typeof this.value == "number" || this.value.length > 0);
428
+ const t = this.hasSlotController.test("label"), l = this.hasSlotController.test("help-text"), s = this.label ? !0 : !!t, a = this.helpText ? !0 : !!l, u = this.clearable && !this.disabled && !this.readonly && (typeof this.value == "number" || this.value.length > 0);
429
429
  return h`
430
430
  <div
431
431
  part="form-control"
@@ -504,7 +504,7 @@ var A = y`
504
504
  @blur=${this.handleBlur}
505
505
  />
506
506
 
507
- ${p ? h`
507
+ ${u ? h`
508
508
  <button
509
509
  part="clear-button"
510
510
  class="input__clear"
@@ -566,97 +566,97 @@ i([
566
566
  b()
567
567
  ], e.prototype, "hasFocus", 2);
568
568
  i([
569
- l()
569
+ o()
570
570
  ], e.prototype, "title", 2);
571
571
  i([
572
- l({ reflect: !0 })
572
+ o({ reflect: !0 })
573
573
  ], e.prototype, "type", 2);
574
574
  i([
575
- l()
575
+ o()
576
576
  ], e.prototype, "name", 2);
577
577
  i([
578
- l()
578
+ o()
579
579
  ], e.prototype, "value", 2);
580
580
  i([
581
581
  _()
582
582
  ], e.prototype, "defaultValue", 2);
583
583
  i([
584
- l({ reflect: !0 })
584
+ o({ reflect: !0 })
585
585
  ], e.prototype, "size", 2);
586
586
  i([
587
- l({ type: Boolean, reflect: !0 })
587
+ o({ type: Boolean, reflect: !0 })
588
588
  ], e.prototype, "filled", 2);
589
589
  i([
590
- l({ type: Boolean, reflect: !0 })
590
+ o({ type: Boolean, reflect: !0 })
591
591
  ], e.prototype, "pill", 2);
592
592
  i([
593
- l()
593
+ o()
594
594
  ], e.prototype, "label", 2);
595
595
  i([
596
- l({ attribute: "help-text" })
596
+ o({ attribute: "help-text" })
597
597
  ], e.prototype, "helpText", 2);
598
598
  i([
599
- l({ type: Boolean })
599
+ o({ type: Boolean })
600
600
  ], e.prototype, "clearable", 2);
601
601
  i([
602
- l({ type: Boolean, reflect: !0 })
602
+ o({ type: Boolean, reflect: !0 })
603
603
  ], e.prototype, "disabled", 2);
604
604
  i([
605
- l()
605
+ o()
606
606
  ], e.prototype, "placeholder", 2);
607
607
  i([
608
- l({ type: Boolean, reflect: !0 })
608
+ o({ type: Boolean, reflect: !0 })
609
609
  ], e.prototype, "readonly", 2);
610
610
  i([
611
- l({ attribute: "password-toggle", type: Boolean })
611
+ o({ attribute: "password-toggle", type: Boolean })
612
612
  ], e.prototype, "passwordToggle", 2);
613
613
  i([
614
- l({ attribute: "password-visible", type: Boolean })
614
+ o({ attribute: "password-visible", type: Boolean })
615
615
  ], e.prototype, "passwordVisible", 2);
616
616
  i([
617
- l({ attribute: "no-spin-buttons", type: Boolean })
617
+ o({ attribute: "no-spin-buttons", type: Boolean })
618
618
  ], e.prototype, "noSpinButtons", 2);
619
619
  i([
620
- l({ reflect: !0 })
620
+ o({ reflect: !0 })
621
621
  ], e.prototype, "form", 2);
622
622
  i([
623
- l({ type: Boolean, reflect: !0 })
623
+ o({ type: Boolean, reflect: !0 })
624
624
  ], e.prototype, "required", 2);
625
625
  i([
626
- l()
626
+ o()
627
627
  ], e.prototype, "pattern", 2);
628
628
  i([
629
- l({ type: Number })
629
+ o({ type: Number })
630
630
  ], e.prototype, "minlength", 2);
631
631
  i([
632
- l({ type: Number })
632
+ o({ type: Number })
633
633
  ], e.prototype, "maxlength", 2);
634
634
  i([
635
- l()
635
+ o()
636
636
  ], e.prototype, "min", 2);
637
637
  i([
638
- l()
638
+ o()
639
639
  ], e.prototype, "max", 2);
640
640
  i([
641
- l()
641
+ o()
642
642
  ], e.prototype, "step", 2);
643
643
  i([
644
- l()
644
+ o()
645
645
  ], e.prototype, "autocapitalize", 2);
646
646
  i([
647
- l()
647
+ o()
648
648
  ], e.prototype, "autocorrect", 2);
649
649
  i([
650
- l()
650
+ o()
651
651
  ], e.prototype, "autocomplete", 2);
652
652
  i([
653
- l({ type: Boolean })
653
+ o({ type: Boolean })
654
654
  ], e.prototype, "autofocus", 2);
655
655
  i([
656
- l()
656
+ o()
657
657
  ], e.prototype, "enterkeyhint", 2);
658
658
  i([
659
- l({
659
+ o({
660
660
  type: Boolean,
661
661
  converter: {
662
662
  // Allow "true|false" attribute values but keep the property boolean
@@ -666,7 +666,7 @@ i([
666
666
  })
667
667
  ], e.prototype, "spellcheck", 2);
668
668
  i([
669
- l()
669
+ o()
670
670
  ], e.prototype, "inputmode", 2);
671
671
  i([
672
672
  m("disabled", { waitUntilFirstUpdate: !0 })
@@ -679,14 +679,14 @@ i([
679
679
  ], e.prototype, "handleValueChange", 1);
680
680
  var v = e;
681
681
  e.define("sl-input");
682
- var D = Object.defineProperty, F = Object.getOwnPropertyDescriptor, d = (t, o, s, a) => {
683
- for (var n = a > 1 ? void 0 : a ? F(o, s) : o, p = t.length - 1, c; p >= 0; p--)
684
- (c = t[p]) && (n = (a ? c(o, s, n) : c(n)) || n);
685
- return a && n && D(o, s, n), n;
682
+ var B = Object.defineProperty, D = Object.getOwnPropertyDescriptor, d = (t, l, s, a) => {
683
+ for (var n = a > 1 ? void 0 : a ? D(l, s) : l, u = t.length - 1, c; u >= 0; u--)
684
+ (c = t[u]) && (n = (a ? c(l, s, n) : c(n)) || n);
685
+ return a && n && B(l, s, n), n;
686
686
  };
687
- let u = class extends v {
687
+ let p = class extends v {
688
688
  constructor() {
689
- super(), this.requiredLabel = "*Obligatorisk", this.testId = "", this.alreadyInvalid = !1;
689
+ super(), this.requiredLabel = "*Obligatorisk", this.testId = "", this.noValidation = !1, this.alreadyInvalid = !1;
690
690
  }
691
691
  connectedCallback() {
692
692
  super.connectedCallback(), this.addEventListener("sl-invalid", (t) => {
@@ -697,23 +697,23 @@ let u = class extends v {
697
697
  super.disconnectedCallback(), this.removeEventListener("sl-invalid", this.makeInvalid);
698
698
  }
699
699
  firstUpdated() {
700
- var o;
700
+ var l;
701
701
  super.firstUpdated(), this.requiredLabel && this.style.setProperty("--sl-input-required-content", `"${this.requiredLabel}"`);
702
- const t = (o = this.shadowRoot) == null ? void 0 : o.querySelector("input");
702
+ const t = (l = this.shadowRoot) == null ? void 0 : l.querySelector("input");
703
703
  t && r(this.autocomplete) && this.autocomplete === "false" && t.setAttribute("aria-autocomplete", "none");
704
704
  }
705
705
  updated(t) {
706
706
  super.updated(t);
707
- const o = this.hasAttribute("data-user-invalid");
708
- t.has("inputId") && this.updateInputId(), o && !this.alreadyInvalid && this.makeInvalid(), o || this.resetValidation();
707
+ const l = this.hasAttribute("data-user-invalid");
708
+ t.has("inputId") && this.updateInputId(), l && !this.alreadyInvalid && this.makeInvalid(), l || this.resetValidation();
709
709
  }
710
710
  updateInputId() {
711
- var o;
712
- const t = (o = this.shadowRoot) == null ? void 0 : o.querySelector("input");
711
+ var l;
712
+ const t = (l = this.shadowRoot) == null ? void 0 : l.querySelector("input");
713
713
  t && this.inputId && (t.id = this.inputId);
714
714
  }
715
715
  makeInvalid() {
716
- this.showErrorIcon(), this.showErrorMessage(), this.alreadyInvalid = !0;
716
+ this.noValidation || (this.showErrorIcon(), this.showErrorMessage(), this.alreadyInvalid = !0);
717
717
  }
718
718
  resetValidation() {
719
719
  this.hideErrorIcon(), this.style.setProperty("--nve-input-error-message", ""), this.alreadyInvalid = !1;
@@ -724,35 +724,38 @@ let u = class extends v {
724
724
  showErrorIcon() {
725
725
  const t = document.createElement("nve-icon");
726
726
  t.setAttribute("id", "error-icon"), t.setAttribute("name", "error"), t.setAttribute("slot", "suffix");
727
- const o = getComputedStyle(document.documentElement).getPropertyValue(
727
+ const l = getComputedStyle(document.documentElement).getPropertyValue(
728
728
  "--feedback-background-emphasized-error"
729
729
  );
730
- t.style.color = o.trim(), this.appendChild(t);
730
+ t.style.color = l.trim(), this.appendChild(t);
731
731
  }
732
732
  hideErrorIcon() {
733
733
  const t = this.querySelector("#error-icon");
734
734
  t && t.remove();
735
735
  }
736
736
  };
737
- u.styles = [v.styles, E];
737
+ p.styles = [v.styles, E];
738
738
  d([
739
- l()
740
- ], u.prototype, "requiredLabel", 2);
739
+ o()
740
+ ], p.prototype, "requiredLabel", 2);
741
741
  d([
742
- l({ reflect: !0 })
743
- ], u.prototype, "errorMessage", 2);
742
+ o({ reflect: !0 })
743
+ ], p.prototype, "errorMessage", 2);
744
744
  d([
745
- l({ reflect: !0, type: String })
746
- ], u.prototype, "testId", 2);
745
+ o({ reflect: !0, type: String })
746
+ ], p.prototype, "testId", 2);
747
747
  d([
748
- l({ type: String, reflect: !0 })
749
- ], u.prototype, "inputId", 2);
748
+ o({ type: String, reflect: !0 })
749
+ ], p.prototype, "inputId", 2);
750
+ d([
751
+ o({ type: Boolean })
752
+ ], p.prototype, "noValidation", 2);
750
753
  d([
751
754
  b()
752
- ], u.prototype, "alreadyInvalid", 2);
753
- u = d([
755
+ ], p.prototype, "alreadyInvalid", 2);
756
+ p = d([
754
757
  g("nve-input")
755
- ], u);
758
+ ], p);
756
759
  export {
757
- u as default
760
+ p as default
758
761
  };
@@ -0,0 +1,15 @@
1
+ import { INveComponent } from '../../interfaces/NveComponent.interface';
2
+ import { default as SlSkeleton } from '@shoelace-style/shoelace/dist/components/skeleton/skeleton.js';
3
+ /**
4
+ * Skeletons brukes til å gi en visuell representasjon av hvor innholdet til slutt vil bli tegnet.
5
+ */
6
+ export default class NveSkeleton extends SlSkeleton implements INveComponent {
7
+ testId: string | undefined;
8
+ static styles: import('lit').CSSResultGroup[];
9
+ constructor();
10
+ }
11
+ declare global {
12
+ interface HTMLElementTagNameMap {
13
+ 'nve-skeleton': NveSkeleton;
14
+ }
15
+ }
@@ -0,0 +1,113 @@
1
+ import { n as c, t as u } from "../../chunks/property.js";
2
+ import f from "./nve-skeleton.styles.js";
3
+ import { i as v, k as h } from "../../chunks/lit-element.js";
4
+ import { c as k, b as m, S as _ } from "../../chunks/chunk.5THGRZAA.js";
5
+ import { R as y } from "../../chunks/class-map.js";
6
+ var b = v`
7
+ :host {
8
+ --border-radius: var(--sl-border-radius-pill);
9
+ --color: var(--sl-color-neutral-200);
10
+ --sheen-color: var(--sl-color-neutral-300);
11
+
12
+ display: block;
13
+ position: relative;
14
+ }
15
+
16
+ .skeleton {
17
+ display: flex;
18
+ width: 100%;
19
+ height: 100%;
20
+ min-height: 1rem;
21
+ }
22
+
23
+ .skeleton__indicator {
24
+ flex: 1 1 auto;
25
+ background: var(--color);
26
+ border-radius: var(--border-radius);
27
+ }
28
+
29
+ .skeleton--sheen .skeleton__indicator {
30
+ background: linear-gradient(270deg, var(--sheen-color), var(--color), var(--color), var(--sheen-color));
31
+ background-size: 400% 100%;
32
+ animation: sheen 8s ease-in-out infinite;
33
+ }
34
+
35
+ .skeleton--pulse .skeleton__indicator {
36
+ animation: pulse 2s ease-in-out 0.5s infinite;
37
+ }
38
+
39
+ /* Forced colors mode */
40
+ @media (forced-colors: active) {
41
+ :host {
42
+ --color: GrayText;
43
+ }
44
+ }
45
+
46
+ @keyframes sheen {
47
+ 0% {
48
+ background-position: 200% 0;
49
+ }
50
+ to {
51
+ background-position: -200% 0;
52
+ }
53
+ }
54
+
55
+ @keyframes pulse {
56
+ 0% {
57
+ opacity: 1;
58
+ }
59
+ 50% {
60
+ opacity: 0.4;
61
+ }
62
+ 100% {
63
+ opacity: 1;
64
+ }
65
+ }
66
+ `, r = class extends _ {
67
+ constructor() {
68
+ super(...arguments), this.effect = "none";
69
+ }
70
+ render() {
71
+ return h`
72
+ <div
73
+ part="base"
74
+ class=${y({
75
+ skeleton: !0,
76
+ "skeleton--pulse": this.effect === "pulse",
77
+ "skeleton--sheen": this.effect === "sheen"
78
+ })}
79
+ >
80
+ <div part="indicator" class="skeleton__indicator"></div>
81
+ </div>
82
+ `;
83
+ }
84
+ };
85
+ r.styles = [k, b];
86
+ m([
87
+ c()
88
+ ], r.prototype, "effect", 2);
89
+ var d = r;
90
+ r.define("sl-skeleton");
91
+ var g = Object.defineProperty, x = Object.getOwnPropertyDescriptor, p = (i, o, l, t) => {
92
+ for (var e = t > 1 ? void 0 : t ? x(o, l) : o, a = i.length - 1, n; a >= 0; a--)
93
+ (n = i[a]) && (e = (t ? n(o, l, e) : n(e)) || e);
94
+ return t && e && g(o, l, e), e;
95
+ };
96
+ let s = class extends d {
97
+ constructor() {
98
+ super(), this.testId = void 0;
99
+ }
100
+ };
101
+ s.styles = [
102
+ d.styles,
103
+ f
104
+ ];
105
+ p([
106
+ c({ reflect: !0, type: String })
107
+ ], s.prototype, "testId", 2);
108
+ s = p([
109
+ u("nve-skeleton")
110
+ ], s);
111
+ export {
112
+ s as default
113
+ };
@@ -0,0 +1,2 @@
1
+ declare const _default: import('lit').CSSResult;
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { i as t } from "../../chunks/lit-element.js";
2
+ const s = t``;
3
+ export {
4
+ s as default
5
+ };
@@ -3215,6 +3215,16 @@
3215
3215
  "default": "''",
3216
3216
  "description": "Navnet på ikonet i Material Symbols-biblioteket"
3217
3217
  },
3218
+ {
3219
+ "kind": "field",
3220
+ "name": "iconLoaded",
3221
+ "type": {
3222
+ "text": "boolean"
3223
+ },
3224
+ "privacy": "private",
3225
+ "default": "false",
3226
+ "description": "Boolean som angir om ikonet har hatt tid til å laste."
3227
+ },
3218
3228
  {
3219
3229
  "kind": "method",
3220
3230
  "name": "firstUpdated",
@@ -3289,6 +3299,15 @@
3289
3299
  },
3290
3300
  "description": "Brukes for å kunne identifisere komponenten"
3291
3301
  },
3302
+ {
3303
+ "kind": "field",
3304
+ "name": "noValidation",
3305
+ "type": {
3306
+ "text": "boolean"
3307
+ },
3308
+ "default": "false",
3309
+ "description": "Brukes for å hindre nettleseren fra å validere feltet"
3310
+ },
3292
3311
  {
3293
3312
  "kind": "field",
3294
3313
  "name": "alreadyInvalid",
@@ -8607,6 +8626,120 @@
8607
8626
  }
8608
8627
  ]
8609
8628
  },
8629
+ {
8630
+ "kind": "javascript-module",
8631
+ "path": "components/nve-skeleton/nve-skeleton.js",
8632
+ "declarations": [
8633
+ {
8634
+ "kind": "class",
8635
+ "description": "Skeletons brukes til å gi en visuell representasjon av hvor innholdet til slutt vil bli tegnet.",
8636
+ "name": "NveSkeleton",
8637
+ "members": [
8638
+ {
8639
+ "kind": "field",
8640
+ "name": "testId",
8641
+ "type": {
8642
+ "text": "string | undefined"
8643
+ },
8644
+ "default": "undefined"
8645
+ },
8646
+ {
8647
+ "kind": "field",
8648
+ "name": "styles",
8649
+ "type": {
8650
+ "text": "array"
8651
+ },
8652
+ "static": true,
8653
+ "default": "[ SlSkeleton.styles, styles]"
8654
+ },
8655
+ {
8656
+ "kind": "field",
8657
+ "name": "effect",
8658
+ "type": {
8659
+ "text": "'pulse' | 'sheen' | 'none'"
8660
+ },
8661
+ "default": "'none'",
8662
+ "description": "Determines which effect the skeleton will use.",
8663
+ "attribute": "effect",
8664
+ "inheritedFrom": {
8665
+ "name": "SlSkeleton"
8666
+ }
8667
+ }
8668
+ ],
8669
+ "superclass": {
8670
+ "name": "SlSkeleton",
8671
+ "package": "@shoelace-style/shoelace/dist/components/skeleton/skeleton.js"
8672
+ },
8673
+ "tagNameWithoutPrefix": "skeleton",
8674
+ "tagName": "nve-skeleton",
8675
+ "customElement": true,
8676
+ "jsDoc": "/**\n * Skeletons brukes til å gi en visuell representasjon av hvor innholdet til slutt vil bli tegnet.\n */",
8677
+ "cssProperties": [
8678
+ {
8679
+ "description": "The skeleton's border radius.",
8680
+ "name": "--border-radius",
8681
+ "inheritedFrom": {
8682
+ "name": "SlSkeleton"
8683
+ }
8684
+ },
8685
+ {
8686
+ "description": "The color of the skeleton.",
8687
+ "name": "--color",
8688
+ "inheritedFrom": {
8689
+ "name": "SlSkeleton"
8690
+ }
8691
+ },
8692
+ {
8693
+ "description": "The sheen color when the skeleton is in its loading state.",
8694
+ "name": "--sheen-color",
8695
+ "inheritedFrom": {
8696
+ "name": "SlSkeleton"
8697
+ }
8698
+ }
8699
+ ],
8700
+ "cssParts": [
8701
+ {
8702
+ "description": "The component's base wrapper.",
8703
+ "name": "base",
8704
+ "inheritedFrom": {
8705
+ "name": "SlSkeleton"
8706
+ }
8707
+ },
8708
+ {
8709
+ "description": "The skeleton's indicator which is responsible for its color and animation.",
8710
+ "name": "indicator",
8711
+ "inheritedFrom": {
8712
+ "name": "SlSkeleton"
8713
+ }
8714
+ }
8715
+ ],
8716
+ "attributes": [
8717
+ {
8718
+ "name": "effect",
8719
+ "type": {
8720
+ "text": "'pulse' | 'sheen' | 'none'"
8721
+ },
8722
+ "default": "'none'",
8723
+ "description": "Determines which effect the skeleton will use.",
8724
+ "fieldName": "effect",
8725
+ "inheritedFrom": {
8726
+ "name": "SlSkeleton"
8727
+ }
8728
+ }
8729
+ ]
8730
+ }
8731
+ ],
8732
+ "exports": [
8733
+ {
8734
+ "kind": "js",
8735
+ "name": "default",
8736
+ "declaration": {
8737
+ "name": "NveSkeleton",
8738
+ "module": "components/nve-skeleton/nve-skeleton.js"
8739
+ }
8740
+ }
8741
+ ]
8742
+ },
8610
8743
  {
8611
8744
  "kind": "javascript-module",
8612
8745
  "path": "components/nve-spinner/nve-spinner.js",
@@ -10626,7 +10759,7 @@
10626
10759
  "package": {
10627
10760
  "name": "nve-designsystem",
10628
10761
  "description": "Designsystem for NVE",
10629
- "version": "0.2.9",
10762
+ "version": "0.2.11",
10630
10763
  "author": {
10631
10764
  "name": "NVE",
10632
10765
  "email": "nve@nve.no"
@@ -20,6 +20,7 @@ export { default as NveRadio } from './components/nve-radio/nve-radio.component'
20
20
  export { default as NveRadioButton } from './components/nve-radio-button/nve-radio-button.component';
21
21
  export { default as NveRadioGroup } from './components/nve-radio-group/nve-radio-group.component';
22
22
  export { default as NveSelect } from './components/nve-select/nve-select.component';
23
+ export { default as NveSkeleton } from './components/nve-skeleton/nve-skeleton.component';
23
24
  export { default as NveSpinner } from './components/nve-spinner/nve-spinner.component';
24
25
  export { default as NveStep } from './components/nve-stepper/nve-step/nve-step.component';
25
26
  export { default as NveStepper } from './components/nve-stepper/nve-stepper.component';
@@ -6,9 +6,9 @@ import { default as x } from "./components/nve-checkbox-group/nve-checkbox-group
6
6
  import { default as v } from "./components/nve-darkmode-switch/nve-darkmode-switch.component.js";
7
7
  import { default as N } from "./components/nve-dialog/nve-dialog.component.js";
8
8
  import { default as n } from "./components/nve-divider/nve-divider.component.js";
9
- import { default as S } from "./components/nve-dropdown/nve-dropdown.component.js";
10
- import { default as D } from "./components/nve-icon/nve-icon.component.js";
11
- import { default as g } from "./components/nve-input/nve-input.component.js";
9
+ import { default as c } from "./components/nve-dropdown/nve-dropdown.component.js";
10
+ import { default as k } from "./components/nve-icon/nve-icon.component.js";
11
+ import { default as b } from "./components/nve-input/nve-input.component.js";
12
12
  import { default as w } from "./components/nve-label/nve-label.component.js";
13
13
  import { default as I } from "./components/nve-menu/nve-menu.component.js";
14
14
  import { default as T } from "./components/nve-menu-item/nve-menu-item.component.js";
@@ -18,13 +18,14 @@ import { default as O } from "./components/nve-radio/nve-radio.component.js";
18
18
  import { default as j } from "./components/nve-radio-button/nve-radio-button.component.js";
19
19
  import { default as y } from "./components/nve-radio-group/nve-radio-group.component.js";
20
20
  import { default as E } from "./components/nve-select/nve-select.component.js";
21
- import { default as H } from "./components/nve-spinner/nve-spinner.component.js";
22
- import { default as K } from "./components/nve-stepper/nve-step/nve-step.component.js";
23
- import { default as U } from "./components/nve-stepper/nve-stepper.component.js";
24
- import { default as W } from "./components/nve-switch/nve-switch.component.js";
25
- import { default as Y } from "./components/nve-tag/nve-tag.component.js";
26
- import { default as _ } from "./components/nve-textarea/nve-textarea.component.js";
27
- import { default as ee } from "./components/nve-tooltip/nve-tooltip.component.js";
21
+ import { default as H } from "./components/nve-skeleton/nve-skeleton.component.js";
22
+ import { default as K } from "./components/nve-spinner/nve-spinner.component.js";
23
+ import { default as U } from "./components/nve-stepper/nve-step/nve-step.component.js";
24
+ import { default as W } from "./components/nve-stepper/nve-stepper.component.js";
25
+ import { default as Y } from "./components/nve-switch/nve-switch.component.js";
26
+ import { default as _ } from "./components/nve-tag/nve-tag.component.js";
27
+ import { default as ee } from "./components/nve-textarea/nve-textarea.component.js";
28
+ import { default as te } from "./components/nve-tooltip/nve-tooltip.component.js";
28
29
  export {
29
30
  t as NveAlert,
30
31
  r as NveBadge,
@@ -34,9 +35,9 @@ export {
34
35
  v as NveDarkmodeSwitch,
35
36
  N as NveDialog,
36
37
  n as NveDivider,
37
- S as NveDropdown,
38
- D as NveIcon,
39
- g as NveInput,
38
+ c as NveDropdown,
39
+ k as NveIcon,
40
+ b as NveInput,
40
41
  w as NveLabel,
41
42
  I as NveMenu,
42
43
  T as NveMenuItem,
@@ -46,11 +47,12 @@ export {
46
47
  j as NveRadioButton,
47
48
  y as NveRadioGroup,
48
49
  E as NveSelect,
49
- H as NveSpinner,
50
- K as NveStep,
51
- U as NveStepper,
52
- W as NveSwitch,
53
- Y as NveTag,
54
- _ as NveTextarea,
55
- ee as NveTooltip
50
+ H as NveSkeleton,
51
+ K as NveSpinner,
52
+ U as NveStep,
53
+ W as NveStepper,
54
+ Y as NveSwitch,
55
+ _ as NveTag,
56
+ ee as NveTextarea,
57
+ te as NveTooltip
56
58
  };
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "license": "MIT",
9
9
  "homepage": "https://github.com/NVE/Designsystem/",
10
- "version": "0.2.10",
10
+ "version": "0.2.12",
11
11
  "customElements": "custom-elements.json",
12
12
  "exports": {
13
13
  ".": {
@@ -24,6 +24,7 @@
24
24
  "scripts": {},
25
25
  "dependencies": {
26
26
  "@shoelace-style/shoelace": "^2.16.0",
27
+ "fontfaceobserver": "^2.3.0",
27
28
  "lit": "^3.2.0"
28
29
  },
29
30
  "devDependencies": {},