nve-designsystem 0.1.55 → 0.1.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/chunks/chunk.2HU27ZWH.js +30 -38
  2. package/chunks/chunk.YCHBWCKL.js +2 -2
  3. package/chunks/directive-helpers.js +12 -0
  4. package/chunks/live.js +1 -1
  5. package/components/nve-alert/nve-alert.component.js +5 -4
  6. package/components/nve-alert/nve-alert.styles.js +1 -1
  7. package/components/nve-button/nve-button.component.js +7 -6
  8. package/components/nve-checkbox/nve-checkbox.component.js +1 -0
  9. package/components/nve-checkbox/nve-checkbox.styles.js +1 -1
  10. package/components/nve-checkbox-group/nve-checkbox-group.component.d.ts +1 -1
  11. package/components/nve-checkbox-group/nve-checkbox-group.component.js +74 -61
  12. package/components/nve-dialog/nve-dialog.component.js +2 -1
  13. package/components/nve-dropdown/nve-dropdown.component.js +1 -1
  14. package/components/nve-icon/nve-icon.styles.js +1 -1
  15. package/components/nve-input/nve-input.component.js +1 -0
  16. package/components/nve-input/nve-input.styles.js +9 -2
  17. package/components/nve-menu-item/nve-menu-item.component.js +30 -29
  18. package/components/nve-option/nve-option.component.js +1 -0
  19. package/components/nve-radio/nve-radio.component.js +1 -0
  20. package/components/nve-select/nve-select.component.js +1 -0
  21. package/components/nve-textarea/nve-textarea.component.d.ts +90 -0
  22. package/components/nve-textarea/nve-textarea.component.js +201 -0
  23. package/components/nve-textarea/nve-textarea.styles.d.ts +2 -0
  24. package/components/nve-textarea/nve-textarea.styles.js +103 -0
  25. package/css/global.css +2 -0
  26. package/nve-designsystem.d.ts +1 -0
  27. package/nve-designsystem.js +50 -46
  28. package/package.json +1 -1
@@ -1,10 +1,11 @@
1
- import { c as p, b as l, S as f } from "./chunk.JS655M6J.js";
1
+ import { c as p, b as o, S as f } from "./chunk.JS655M6J.js";
2
2
  import { i as g, x as y } from "./lit-element.js";
3
- import { w, u as L, g as m } from "./chunk.3WAW4E2K.js";
4
- import { w as b } from "./chunk.Q6ASPMKT.js";
3
+ import { w, u as L, g as b } from "./chunk.3WAW4E2K.js";
4
+ import { w as v } from "./chunk.Q6ASPMKT.js";
5
+ import { e as C } from "./directive-helpers.js";
5
6
  import { n as h } from "./property.js";
6
- import { r as _ } from "./state.js";
7
- var C = g`
7
+ import { r as I } from "./state.js";
8
+ var R = g`
8
9
  ${p}
9
10
 
10
11
  :host {
@@ -19,14 +20,7 @@ var C = g`
19
20
  height: 100%;
20
21
  width: 100%;
21
22
  }
22
- `;
23
- /**
24
- * @license
25
- * Copyright 2020 Google LLC
26
- * SPDX-License-Identifier: BSD-3-Clause
27
- */
28
- const I = (t, e) => e === void 0 ? (t == null ? void 0 : t._$litType$) !== void 0 : (t == null ? void 0 : t._$litType$) === e, H = (t) => t.strings === void 0, R = {}, M = (t, e = R) => t._$AH = e;
29
- var o = Symbol(), c = Symbol(), d, v = /* @__PURE__ */ new Map(), a = class extends f {
23
+ `, l = Symbol(), c = Symbol(), d, m = /* @__PURE__ */ new Map(), a = class extends f {
30
24
  constructor() {
31
25
  super(...arguments), this.initialRender = !1, this.svg = null, this.label = "", this.library = "default";
32
26
  }
@@ -40,7 +34,7 @@ var o = Symbol(), c = Symbol(), d, v = /* @__PURE__ */ new Map(), a = class exte
40
34
  </svg>`;
41
35
  try {
42
36
  if (r = await fetch(t, { mode: "cors" }), !r.ok)
43
- return r.status === 410 ? o : c;
37
+ return r.status === 410 ? l : c;
44
38
  } catch {
45
39
  return c;
46
40
  }
@@ -49,12 +43,12 @@ var o = Symbol(), c = Symbol(), d, v = /* @__PURE__ */ new Map(), a = class exte
49
43
  s.innerHTML = await r.text();
50
44
  const i = s.firstElementChild;
51
45
  if (((n = i == null ? void 0 : i.tagName) == null ? void 0 : n.toLowerCase()) !== "svg")
52
- return o;
46
+ return l;
53
47
  d || (d = new DOMParser());
54
48
  const u = d.parseFromString(i.outerHTML, "text/html").body.querySelector("svg");
55
- return u ? (u.part.add("svg"), document.adoptNode(u)) : o;
49
+ return u ? (u.part.add("svg"), document.adoptNode(u)) : l;
56
50
  } catch {
57
- return o;
51
+ return l;
58
52
  }
59
53
  }
60
54
  connectedCallback() {
@@ -67,7 +61,7 @@ var o = Symbol(), c = Symbol(), d, v = /* @__PURE__ */ new Map(), a = class exte
67
61
  super.disconnectedCallback(), L(this);
68
62
  }
69
63
  getIconSource() {
70
- const t = m(this.library);
64
+ const t = b(this.library);
71
65
  return this.name && t ? {
72
66
  url: t.resolver(this.name),
73
67
  fromLibrary: !0
@@ -81,23 +75,23 @@ var o = Symbol(), c = Symbol(), d, v = /* @__PURE__ */ new Map(), a = class exte
81
75
  }
82
76
  async setIcon() {
83
77
  var t;
84
- const { url: e, fromLibrary: n } = this.getIconSource(), r = n ? m(this.library) : void 0;
78
+ const { url: e, fromLibrary: n } = this.getIconSource(), r = n ? b(this.library) : void 0;
85
79
  if (!e) {
86
80
  this.svg = null;
87
81
  return;
88
82
  }
89
- let s = v.get(e);
90
- if (s || (s = this.resolveIcon(e, r), v.set(e, s)), !this.initialRender)
83
+ let s = m.get(e);
84
+ if (s || (s = this.resolveIcon(e, r), m.set(e, s)), !this.initialRender)
91
85
  return;
92
86
  const i = await s;
93
- if (i === c && v.delete(e), e === this.getIconSource().url) {
94
- if (I(i)) {
87
+ if (i === c && m.delete(e), e === this.getIconSource().url) {
88
+ if (C(i)) {
95
89
  this.svg = i;
96
90
  return;
97
91
  }
98
92
  switch (i) {
99
93
  case c:
100
- case o:
94
+ case l:
101
95
  this.svg = null, this.emit("sl-error");
102
96
  break;
103
97
  default:
@@ -109,30 +103,28 @@ var o = Symbol(), c = Symbol(), d, v = /* @__PURE__ */ new Map(), a = class exte
109
103
  return this.svg;
110
104
  }
111
105
  };
112
- a.styles = C;
113
- l([
114
- _()
106
+ a.styles = R;
107
+ o([
108
+ I()
115
109
  ], a.prototype, "svg", 2);
116
- l([
110
+ o([
117
111
  h({ reflect: !0 })
118
112
  ], a.prototype, "name", 2);
119
- l([
113
+ o([
120
114
  h()
121
115
  ], a.prototype, "src", 2);
122
- l([
116
+ o([
123
117
  h()
124
118
  ], a.prototype, "label", 2);
125
- l([
119
+ o([
126
120
  h({ reflect: !0 })
127
121
  ], a.prototype, "library", 2);
128
- l([
129
- b("label")
122
+ o([
123
+ v("label")
130
124
  ], a.prototype, "handleLabelChange", 1);
131
- l([
132
- b(["name", "src", "library"])
125
+ o([
126
+ v(["name", "src", "library"])
133
127
  ], a.prototype, "setIcon", 1);
134
128
  export {
135
- a as S,
136
- H as f,
137
- M as m
129
+ a as S
138
130
  };
@@ -33,6 +33,6 @@ function b(t) {
33
33
  });
34
34
  }
35
35
  export {
36
- b as a,
37
- d as g
36
+ d as a,
37
+ b as g
38
38
  };
@@ -0,0 +1,12 @@
1
+ import "./lit-element.js";
2
+ /**
3
+ * @license
4
+ * Copyright 2020 Google LLC
5
+ * SPDX-License-Identifier: BSD-3-Clause
6
+ */
7
+ const p = (i, $) => $ === void 0 ? (i == null ? void 0 : i._$litType$) !== void 0 : (i == null ? void 0 : i._$litType$) === $, s = (i) => i.strings === void 0, t = {}, d = (i, $ = t) => i._$AH = $;
8
+ export {
9
+ p as e,
10
+ s as f,
11
+ d as m
12
+ };
package/chunks/live.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { w as n, T as s } from "./lit-element.js";
2
2
  import { a as T, i as f, t } from "./class-map.js";
3
- import { f as l, m as p } from "./chunk.2HU27ZWH.js";
3
+ import { f as l, m as p } from "./directive-helpers.js";
4
4
  /**
5
5
  * @license
6
6
  * Copyright 2020 Google LLC
@@ -14,6 +14,7 @@ import "../../chunks/static.js";
14
14
  import "../../chunks/if-defined.js";
15
15
  import "../../chunks/state.js";
16
16
  import "../../chunks/chunk.3WAW4E2K.js";
17
+ import "../../chunks/directive-helpers.js";
17
18
  var T = $`
18
19
  ${z}
19
20
 
@@ -246,10 +247,10 @@ b("alert.hide", {
246
247
  });
247
248
  var _ = t;
248
249
  t.define("sl-alert");
249
- var D = Object.defineProperty, B = Object.getOwnPropertyDescriptor, n = (e, r, h, c) => {
250
- for (var s = c > 1 ? void 0 : c ? B(r, h) : r, p = e.length - 1, d; p >= 0; p--)
251
- (d = e[p]) && (s = (c ? d(r, h, s) : d(s)) || s);
252
- return c && s && D(r, h, s), s;
250
+ var D = Object.defineProperty, B = Object.getOwnPropertyDescriptor, n = (e, r, p, c) => {
251
+ for (var s = c > 1 ? void 0 : c ? B(r, p) : r, h = e.length - 1, d; h >= 0; h--)
252
+ (d = e[h]) && (s = (c ? d(r, p, s) : d(s)) || s);
253
+ return c && s && D(r, p, s), s;
253
254
  };
254
255
  let o = class extends _ {
255
256
  constructor() {
@@ -42,7 +42,7 @@ const a = r`
42
42
  padding: var(--spacing-xx-small);
43
43
  border-radius: 50%;
44
44
  stroke: var(--neutrals-foreground-primary);
45
- transition: background-color 0.3s ease;
45
+ transition: background-color var(--transition-time) ease;
46
46
  }
47
47
 
48
48
  :host::part(message)::after {
@@ -10,11 +10,12 @@ import { b as e, S as w } from "../../chunks/chunk.JS655M6J.js";
10
10
  import { e as F } from "../../chunks/class-map.js";
11
11
  import { s as d, n as f } from "../../chunks/static.js";
12
12
  import { o as s } from "../../chunks/if-defined.js";
13
- import { r as c } from "../../chunks/state.js";
13
+ import { r as m } from "../../chunks/state.js";
14
14
  import { e as V } from "../../chunks/query.js";
15
15
  import z from "./nve-button.styles.js";
16
16
  import "../../chunks/lit-element.js";
17
17
  import "../../chunks/chunk.3WAW4E2K.js";
18
+ import "../../chunks/directive-helpers.js";
18
19
  var t = class extends w {
19
20
  constructor() {
20
21
  super(...arguments), this.formControlController = new C(this, {
@@ -153,10 +154,10 @@ e([
153
154
  V(".button")
154
155
  ], t.prototype, "button", 2);
155
156
  e([
156
- c()
157
+ m()
157
158
  ], t.prototype, "hasFocus", 2);
158
159
  e([
159
- c()
160
+ m()
160
161
  ], t.prototype, "invalid", 2);
161
162
  e([
162
163
  r()
@@ -227,19 +228,19 @@ e([
227
228
  e([
228
229
  S("disabled", { waitUntilFirstUpdate: !0 })
229
230
  ], t.prototype, "handleDisabledChange", 1);
230
- var m = t;
231
+ var c = t;
231
232
  t.define("sl-button");
232
233
  var I = Object.defineProperty, k = Object.getOwnPropertyDescriptor, b = (o, i, a, n) => {
233
234
  for (var l = n > 1 ? void 0 : n ? k(i, a) : i, h = o.length - 1, p; h >= 0; h--)
234
235
  (p = o[h]) && (l = (n ? p(i, a, l) : p(l)) || l);
235
236
  return n && l && I(i, a, l), l;
236
237
  };
237
- let u = class extends m {
238
+ let u = class extends c {
238
239
  constructor() {
239
240
  super(), this.size = "large";
240
241
  }
241
242
  };
242
- u.styles = [m.styles, z];
243
+ u.styles = [c.styles, z];
243
244
  b([
244
245
  r({ reflect: !0 })
245
246
  ], u.prototype, "size", 2);
@@ -12,6 +12,7 @@ import { r as z } from "../../chunks/state.js";
12
12
  import { e as $ } from "../../chunks/query.js";
13
13
  import w from "./nve-checkbox.styles.js";
14
14
  import "../../chunks/chunk.3WAW4E2K.js";
15
+ import "../../chunks/directive-helpers.js";
15
16
  var F = m`
16
17
  ${f}
17
18
 
@@ -14,7 +14,7 @@ const e = r`
14
14
  border-radius: var(--border-radius-small);
15
15
  width: 1.1rem;
16
16
  height: 1.1rem;
17
- transition: all 0.3s ease-in;
17
+ transition: all var(--transition-time) ease-in;
18
18
  }
19
19
 
20
20
  :host::part(control control--checked),
@@ -3,7 +3,7 @@ import { LitElement } from 'lit';
3
3
  * Representerer en tilpasset sjekboksgruppekomponent.
4
4
  * Denne komponenten burde brukes kun med <nve-checkbox> komponent.
5
5
  * Man kan ta i bruk selectedValues som inneholder value-attributet fra alle aktive sjekkbokser inn i sjekkboksgruppen. Den
6
- * oppdaterer seg automatisk når mån klikker på sjekkbokser.
6
+ * oppdaterer seg automatisk når mån klikker på sjekkbokser. Man kan lagre både primitiver og objekter i selectedValues.
7
7
  * Valideres både med constraint validation (kun required støttes per i dag), og custom validering. Custom validering prioriteres når man submitter formen.
8
8
  * <nve-checkbox> komponenter som er wrappet i <nve-checkbox-group>
9
9
  * @slot default - innholder alle nve-checkbox komponenter for global style styring og validering
@@ -1,10 +1,10 @@
1
- import { s as u, x as n } from "../../chunks/lit-element.js";
2
- import { n as l, t as p } from "../../chunks/property.js";
3
- import { r as c } from "../../chunks/state.js";
4
- import { e as b } from "../../chunks/query.js";
1
+ import { s as p, x as c } from "../../chunks/lit-element.js";
2
+ import { n as a, t as b } from "../../chunks/property.js";
3
+ import { r as d } from "../../chunks/state.js";
4
+ import { e as f } from "../../chunks/query.js";
5
5
  import "../nve-label/nve-label.component.js";
6
- import v from "./nve-checkbox-group.styles.js";
7
- import { t as m } from "../../chunks/updateInvalidProperty.js";
6
+ import m from "./nve-checkbox-group.styles.js";
7
+ import { t as v } from "../../chunks/updateInvalidProperty.js";
8
8
  import "../nve-label/nve-label.styles.js";
9
9
  import "../nve-icon/nve-icon.component.js";
10
10
  import "../nve-icon/nve-icon.styles.js";
@@ -15,12 +15,25 @@ import "../../chunks/class-map.js";
15
15
  import "../../chunks/chunk.KRRLOROJ.js";
16
16
  import "../../chunks/chunk.MAS2SHYD.js";
17
17
  import "../../chunks/chunk.Q6ASPMKT.js";
18
- var f = Object.defineProperty, g = Object.getOwnPropertyDescriptor, i = (e, t, s, o) => {
19
- for (var a = o > 1 ? void 0 : o ? g(t, s) : t, h = e.length - 1, d; h >= 0; h--)
20
- (d = e[h]) && (a = (o ? d(t, s, a) : d(a)) || a);
21
- return o && a && f(t, s, a), a;
18
+ function u(e, t) {
19
+ if (e === t)
20
+ return !0;
21
+ if (typeof e != "object" || e === null || typeof t != "object" || t === null)
22
+ return !1;
23
+ let r = Object.keys(e), i = Object.keys(t);
24
+ if (r.length !== i.length)
25
+ return !1;
26
+ for (let l of r)
27
+ if (!i.includes(l) || !u(e[l], t[l]))
28
+ return !1;
29
+ return !0;
30
+ }
31
+ var g = Object.defineProperty, y = Object.getOwnPropertyDescriptor, o = (e, t, r, i) => {
32
+ for (var l = i > 1 ? void 0 : i ? y(t, r) : t, n = e.length - 1, h; n >= 0; n--)
33
+ (h = e[n]) && (l = (i ? h(t, r, l) : h(l)) || l);
34
+ return i && l && g(t, r, l), l;
22
35
  };
23
- let r = class extends u {
36
+ let s = class extends p {
24
37
  constructor() {
25
38
  super(), this.disabled = !1, this.required = !1, this.orientation = "vertical", this.requiredLabel = "*Obligatorisk", this.showErrorMessage = !1, this.isCustomValidationError = !1, this.updateSelectedValues = (e) => {
26
39
  if (!this.selectedValues)
@@ -29,8 +42,8 @@ let r = class extends u {
29
42
  if (t.checked)
30
43
  this.selectedValues.push(t.value);
31
44
  else {
32
- const s = this.selectedValues.findIndex((o) => o === t.value);
33
- s !== -1 && this.selectedValues.splice(s, 1);
45
+ const r = this.selectedValues.findIndex((i) => u(i, t.value));
46
+ r !== -1 && this.selectedValues.splice(r, 1);
34
47
  }
35
48
  this.requestUpdate();
36
49
  };
@@ -47,15 +60,15 @@ let r = class extends u {
47
60
  var t;
48
61
  if (this.requiredLabel && this.style.setProperty("--sl-checkbox-required-content", `"${this.requiredLabel}"`), !((t = this.selectedValues) != null && t.length))
49
62
  return;
50
- Array.from(this.querySelectorAll("nve-checkbox")).forEach((s) => {
51
- var o;
52
- (o = this.selectedValues) != null && o.includes(s.value) ? s.checked = !0 : s.checked = !1;
63
+ Array.from(this.querySelectorAll("nve-checkbox")).forEach((r) => {
64
+ var i;
65
+ (i = this.selectedValues) != null && i.includes(r.value) ? r.checked = !0 : r.checked = !1;
53
66
  });
54
67
  }
55
68
  updated(e) {
56
69
  if (super.updated(e), e.has("disabled")) {
57
70
  const t = Array.from(this.querySelectorAll("nve-checkbox"));
58
- m(t, this.disabled, "disabled");
71
+ v(t, this.disabled, "disabled");
59
72
  }
60
73
  }
61
74
  /** En 'fake' metode som gjør custom validering enklere på checkbox-group komponent */
@@ -86,8 +99,8 @@ let r = class extends u {
86
99
  }), this.showErrorMessage = !1;
87
100
  }
88
101
  makeInvalid() {
89
- Array.from(this.querySelectorAll("nve-checkbox")).forEach((s) => {
90
- s.toggleAttribute("data-user-invalid", !0), s.setCustomValidity(this.errorMessage || "Error");
102
+ Array.from(this.querySelectorAll("nve-checkbox")).forEach((r) => {
103
+ r.toggleAttribute("data-user-invalid", !0), r.setCustomValidity(this.errorMessage || "Error");
91
104
  }), this.showErrorMessage = !0;
92
105
  const t = new Event("sl-invalid", {
93
106
  bubbles: !0,
@@ -96,10 +109,10 @@ let r = class extends u {
96
109
  this.dispatchEvent(t);
97
110
  }
98
111
  checkIfRequiredValid() {
99
- return Array.from(this.querySelectorAll("nve-checkbox")).some((s) => s.checked);
112
+ return Array.from(this.querySelectorAll("nve-checkbox")).some((r) => r.checked);
100
113
  }
101
114
  render() {
102
- return n`
115
+ return c`
103
116
  <fieldset
104
117
  class="checkbox-group"
105
118
  aria-required=${this.required}
@@ -107,54 +120,54 @@ let r = class extends u {
107
120
  aria-describedby="error-message"
108
121
  aria-errormessage="error-message"
109
122
  >
110
- ${this.label ? n`<div class="checkbox-group__label">
123
+ ${this.label ? c`<div class="checkbox-group__label">
111
124
  <nve-label id="label" value=${this.label} size="small" tooltip=${this.tooltip}></nve-label>
112
125
  </div>` : null}
113
126
  <slot class="checkbox-group__checkboxes"></slot>
114
- ${this.showErrorMessage ? n`<span role="alert" id="error-message" class="checkbox-group__error-message"
127
+ ${this.showErrorMessage ? c`<span role="alert" id="error-message" class="checkbox-group__error-message"
115
128
  >${this.errorMessage || null}</span
116
129
  >` : null}
117
130
  </fieldset>
118
131
  `;
119
132
  }
120
133
  };
121
- r.styles = [v];
122
- i([
123
- l({ type: Boolean, reflect: !0 })
124
- ], r.prototype, "disabled", 2);
125
- i([
126
- l({ type: Boolean, reflect: !0 })
127
- ], r.prototype, "required", 2);
128
- i([
129
- l()
130
- ], r.prototype, "label", 2);
131
- i([
132
- l()
133
- ], r.prototype, "tooltip", 2);
134
- i([
135
- l()
136
- ], r.prototype, "orientation", 2);
137
- i([
138
- l()
139
- ], r.prototype, "errorMessage", 2);
140
- i([
141
- l()
142
- ], r.prototype, "requiredLabel", 2);
143
- i([
144
- l({ type: Array })
145
- ], r.prototype, "selectedValues", 2);
146
- i([
147
- b("slot")
148
- ], r.prototype, "slot", 2);
149
- i([
150
- c()
151
- ], r.prototype, "showErrorMessage", 2);
152
- i([
153
- c()
154
- ], r.prototype, "isCustomValidationError", 2);
155
- r = i([
156
- p("nve-checkbox-group")
157
- ], r);
134
+ s.styles = [m];
135
+ o([
136
+ a({ type: Boolean, reflect: !0 })
137
+ ], s.prototype, "disabled", 2);
138
+ o([
139
+ a({ type: Boolean, reflect: !0 })
140
+ ], s.prototype, "required", 2);
141
+ o([
142
+ a()
143
+ ], s.prototype, "label", 2);
144
+ o([
145
+ a()
146
+ ], s.prototype, "tooltip", 2);
147
+ o([
148
+ a()
149
+ ], s.prototype, "orientation", 2);
150
+ o([
151
+ a()
152
+ ], s.prototype, "errorMessage", 2);
153
+ o([
154
+ a()
155
+ ], s.prototype, "requiredLabel", 2);
156
+ o([
157
+ a({ type: Array })
158
+ ], s.prototype, "selectedValues", 2);
159
+ o([
160
+ f("slot")
161
+ ], s.prototype, "slot", 2);
162
+ o([
163
+ d()
164
+ ], s.prototype, "showErrorMessage", 2);
165
+ o([
166
+ d()
167
+ ], s.prototype, "isCustomValidationError", 2);
168
+ s = o([
169
+ b("nve-checkbox-group")
170
+ ], s);
158
171
  export {
159
- r as default
172
+ s as default
160
173
  };
@@ -1,4 +1,4 @@
1
- import { a as b } from "../../chunks/chunk.YCHBWCKL.js";
1
+ import { g as b } from "../../chunks/chunk.YCHBWCKL.js";
2
2
  import { d as A, c as F, b as r, S as L } from "../../chunks/chunk.JS655M6J.js";
3
3
  import { l as _, u as w } from "../../chunks/chunk.RK73WSZS.js";
4
4
  import { i as z, x } from "../../chunks/lit-element.js";
@@ -16,6 +16,7 @@ import K from "./nve-dialog-styles.js";
16
16
  import "../../chunks/static.js";
17
17
  import "../../chunks/state.js";
18
18
  import "../../chunks/chunk.3WAW4E2K.js";
19
+ import "../../chunks/directive-helpers.js";
19
20
  function* C(e = document.activeElement) {
20
21
  e != null && (yield e, "shadowRoot" in e && e.shadowRoot && e.shadowRoot.mode !== "closed" && (yield* A(C(e.shadowRoot.activeElement))));
21
22
  }
@@ -1,6 +1,6 @@
1
1
  import { c as b, b as r, S as y } from "../../chunks/chunk.JS655M6J.js";
2
2
  import { i as v, x as E } from "../../chunks/lit-element.js";
3
- import { g as k } from "../../chunks/chunk.YCHBWCKL.js";
3
+ import { a as k } from "../../chunks/chunk.YCHBWCKL.js";
4
4
  import { S as T } from "../../chunks/chunk.GMVRWIWU.js";
5
5
  import { s as g, w as u, a as c, g as f, b as m } from "../../chunks/chunk.KRRLOROJ.js";
6
6
  import { L as _ } from "../../chunks/chunk.MAS2SHYD.js";
@@ -3,7 +3,7 @@ const o = 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);
6
- transition: transform 0.3s ease;
6
+ transition: transform var(--transition-time) ease;
7
7
  }
8
8
 
9
9
  /* prevent icon beeing highlighted */
@@ -15,6 +15,7 @@ import { l as z } from "../../chunks/live.js";
15
15
  import { e as S } from "../../chunks/query.js";
16
16
  import P from "./nve-input.styles.js";
17
17
  import "../../chunks/chunk.3WAW4E2K.js";
18
+ import "../../chunks/directive-helpers.js";
18
19
  var E = k`
19
20
  ${_}
20
21
  ${y}
@@ -20,8 +20,16 @@ const a = r`
20
20
  border-radius: var(--border-radius-small);
21
21
  }
22
22
 
23
+ :host::part(base) {
24
+ transition: border var(--transition-time) ease-in-out;
25
+ }
26
+
23
27
  .input--standard:hover:not(.input--disabled) {
24
- border-color: var(--neutrals-border-subtle) !important;
28
+ border-color: var(--neutrals-foreground-primary) !important;
29
+ }
30
+
31
+ .input--filled:hover:not(.input--disabled) {
32
+ border-color: var(--neutrals-border-default) !important;
25
33
  }
26
34
 
27
35
  :host::after {
@@ -33,7 +41,6 @@ const a = r`
33
41
  :host([required]) .form-control--has-label .form-control__label::after,
34
42
  :host([requiredLabel])::part(form-control-label)::after {
35
43
  content: var(--sl-input-required-content);
36
- margin-top: var(--spacing-xx-small);
37
44
  font: var(--label-x-small-light);
38
45
  color: var(--feedback-background-emphasized-error);
39
46
  }
@@ -1,10 +1,11 @@
1
- import { c as $, b as r, S as w } from "../../chunks/chunk.JS655M6J.js";
1
+ import { c as $, b as l, S as w } from "../../chunks/chunk.JS655M6J.js";
2
2
  import { i as L, T as x, x as g } from "../../chunks/lit-element.js";
3
- import { f as A, S as E } from "../../chunks/chunk.2HU27ZWH.js";
4
- import { i as P, t as M, a as T, e as R } from "../../chunks/class-map.js";
5
- import { S as O } from "../../chunks/chunk.GMVRWIWU.js";
6
- import { H as D, g as z } from "../../chunks/chunk.NYIIDP5N.js";
7
- import { L as G } from "../../chunks/chunk.MAS2SHYD.js";
3
+ import { f as A } from "../../chunks/directive-helpers.js";
4
+ import { i as E, t as P, a as M, e as T } from "../../chunks/class-map.js";
5
+ import { S as R } from "../../chunks/chunk.GMVRWIWU.js";
6
+ import { H as O, g as D } from "../../chunks/chunk.NYIIDP5N.js";
7
+ import { L as z } from "../../chunks/chunk.MAS2SHYD.js";
8
+ import { S as G } from "../../chunks/chunk.2HU27ZWH.js";
8
9
  import { w as y } from "../../chunks/chunk.Q6ASPMKT.js";
9
10
  import { n as u, t as H } from "../../chunks/property.js";
10
11
  import { e as _ } from "../../chunks/query.js";
@@ -196,9 +197,9 @@ function V(e, i = !1, s = 0) {
196
197
  c(this, e);
197
198
  }
198
199
  const U = (e) => {
199
- e.type == M.CHILD && (e._$AP ?? (e._$AP = V), e._$AQ ?? (e._$AQ = B));
200
+ e.type == P.CHILD && (e._$AP ?? (e._$AP = V), e._$AQ ?? (e._$AQ = B));
200
201
  };
201
- class q extends P {
202
+ class q extends E {
202
203
  constructor() {
203
204
  super(...arguments), this._$AN = void 0;
204
205
  }
@@ -230,7 +231,7 @@ class q extends P {
230
231
  const j = () => new F();
231
232
  class F {
232
233
  }
233
- const v = /* @__PURE__ */ new WeakMap(), K = T(class extends q {
234
+ const v = /* @__PURE__ */ new WeakMap(), K = M(class extends q {
234
235
  render(e) {
235
236
  return x;
236
237
  }
@@ -290,8 +291,8 @@ var W = class {
290
291
  const t = this.host.renderRoot.querySelector("slot[name='submenu']"), n = t == null ? void 0 : t.assignedElements({ flatten: !0 }).filter((k) => k.localName === "sl-menu")[0], o = this.localize.dir() === "rtl";
291
292
  if (!n)
292
293
  return;
293
- const { left: l, top: d, width: f, height: b } = n.getBoundingClientRect();
294
- this.host.style.setProperty("--safe-triangle-submenu-start-x", `${o ? l + f : l}px`), this.host.style.setProperty("--safe-triangle-submenu-start-y", `${d}px`), this.host.style.setProperty("--safe-triangle-submenu-end-x", `${o ? l + f : l}px`), this.host.style.setProperty("--safe-triangle-submenu-end-y", `${d + b}px`);
294
+ const { left: r, top: d, width: f, height: b } = n.getBoundingClientRect();
295
+ this.host.style.setProperty("--safe-triangle-submenu-start-x", `${o ? r + f : r}px`), this.host.style.setProperty("--safe-triangle-submenu-start-y", `${d}px`), this.host.style.setProperty("--safe-triangle-submenu-end-x", `${o ? r + f : r}px`), this.host.style.setProperty("--safe-triangle-submenu-end-y", `${d + b}px`);
295
296
  }, (this.host = e).addController(this), this.hasSlotController = i, this.localize = s;
296
297
  }
297
298
  hostConnected() {
@@ -347,8 +348,8 @@ var W = class {
347
348
  if (!((e = this.host.parentElement) != null && e.computedStyleMap))
348
349
  return;
349
350
  const i = this.host.parentElement.computedStyleMap(), t = ["padding-top", "border-top-width", "margin-top"].reduce((n, o) => {
350
- var l;
351
- const d = (l = i.get(o)) != null ? l : new CSSUnitValue(0, "px"), b = (d instanceof CSSUnitValue ? d : new CSSUnitValue(0, "px")).to("px");
351
+ var r;
352
+ const d = (r = i.get(o)) != null ? r : new CSSUnitValue(0, "px"), b = (d instanceof CSSUnitValue ? d : new CSSUnitValue(0, "px")).to("px");
352
353
  return n - b.value;
353
354
  }, 0);
354
355
  this.skidding = t;
@@ -374,7 +375,7 @@ var W = class {
374
375
  }
375
376
  }, a = class extends w {
376
377
  constructor() {
377
- super(...arguments), this.type = "normal", this.checked = !1, this.value = "", this.disabled = !1, this.localize = new G(this), this.hasSlotController = new D(this, "submenu"), this.submenuController = new W(this, this.hasSlotController, this.localize), this.handleHostClick = (e) => {
378
+ super(...arguments), this.type = "normal", this.checked = !1, this.value = "", this.disabled = !1, this.localize = new z(this), this.hasSlotController = new O(this, "submenu"), this.submenuController = new W(this, this.hasSlotController, this.localize), this.handleHostClick = (e) => {
378
379
  this.disabled && (e.preventDefault(), e.stopImmediatePropagation());
379
380
  }, this.handleMouseOver = (e) => {
380
381
  this.focus(), e.stopPropagation();
@@ -409,7 +410,7 @@ var W = class {
409
410
  }
410
411
  /** Returns a text label based on the contents of the menu item's default slot. */
411
412
  getTextLabel() {
412
- return z(this.defaultSlot);
413
+ return D(this.defaultSlot);
413
414
  }
414
415
  isSubmenu() {
415
416
  return this.hasSlotController.test("submenu");
@@ -420,7 +421,7 @@ var W = class {
420
421
  <div
421
422
  id="anchor"
422
423
  part="base"
423
- class=${R({
424
+ class=${T({
424
425
  "menu-item": !0,
425
426
  "menu-item--rtl": e,
426
427
  "menu-item--checked": this.checked,
@@ -452,41 +453,41 @@ var W = class {
452
453
  };
453
454
  a.styles = N;
454
455
  a.dependencies = {
455
- "sl-icon": E,
456
- "sl-popup": O
456
+ "sl-icon": G,
457
+ "sl-popup": R
457
458
  };
458
- r([
459
+ l([
459
460
  _("slot:not([name])")
460
461
  ], a.prototype, "defaultSlot", 2);
461
- r([
462
+ l([
462
463
  _(".menu-item")
463
464
  ], a.prototype, "menuItem", 2);
464
- r([
465
+ l([
465
466
  u()
466
467
  ], a.prototype, "type", 2);
467
- r([
468
+ l([
468
469
  u({ type: Boolean, reflect: !0 })
469
470
  ], a.prototype, "checked", 2);
470
- r([
471
+ l([
471
472
  u()
472
473
  ], a.prototype, "value", 2);
473
- r([
474
+ l([
474
475
  u({ type: Boolean, reflect: !0 })
475
476
  ], a.prototype, "disabled", 2);
476
- r([
477
+ l([
477
478
  y("checked")
478
479
  ], a.prototype, "handleCheckedChange", 1);
479
- r([
480
+ l([
480
481
  y("disabled")
481
482
  ], a.prototype, "handleDisabledChange", 1);
482
- r([
483
+ l([
483
484
  y("type")
484
485
  ], a.prototype, "handleTypeChange", 1);
485
486
  var S = a;
486
487
  a.define("sl-menu-item");
487
488
  var Q = Object.defineProperty, X = Object.getOwnPropertyDescriptor, p = (e, i, s, t) => {
488
- for (var n = t > 1 ? void 0 : t ? X(i, s) : i, o = e.length - 1, l; o >= 0; o--)
489
- (l = e[o]) && (n = (t ? l(i, s, n) : l(n)) || n);
489
+ for (var n = t > 1 ? void 0 : t ? X(i, s) : i, o = e.length - 1, r; o >= 0; o--)
490
+ (r = e[o]) && (n = (t ? r(i, s, n) : r(n)) || n);
490
491
  return t && n && Q(i, s, n), n;
491
492
  };
492
493
  let h = class extends S {
@@ -9,6 +9,7 @@ import { r as d } from "../../chunks/state.js";
9
9
  import { e as C } from "../../chunks/query.js";
10
10
  import S from "./nve-option.styles.js";
11
11
  import "../../chunks/chunk.3WAW4E2K.js";
12
+ import "../../chunks/directive-helpers.js";
12
13
  var L = m`
13
14
  ${f}
14
15
 
@@ -7,6 +7,7 @@ import { e as _ } from "../../chunks/class-map.js";
7
7
  import { r as p } from "../../chunks/state.js";
8
8
  import y from "./nve-radio.styles.js";
9
9
  import "../../chunks/chunk.3WAW4E2K.js";
10
+ import "../../chunks/directive-helpers.js";
10
11
  var z = v`
11
12
  ${m}
12
13
 
@@ -19,6 +19,7 @@ import K from "./nve-select.styles.js";
19
19
  import "../../chunks/static.js";
20
20
  import "../../chunks/if-defined.js";
21
21
  import "../../chunks/chunk.3WAW4E2K.js";
22
+ import "../../chunks/directive-helpers.js";
22
23
  var H = k`
23
24
  ${O}
24
25
 
@@ -0,0 +1,90 @@
1
+ import { LitElement } from 'lit';
2
+ /**
3
+ * @dependency nve-icon
4
+ * @dependency nve-label
5
+ *
6
+ * Bruker sl-eventer for å være konsistent. Kan bruke våre egne eventer når vi droppper shoelace
7
+ * @event sl-blur - trigges når textarea mister fokus
8
+ * @event sl-change - trigges når textarea endrer verdi
9
+ * @event sl-input - trigges når textarea endrer verdi
10
+ * @event sl-invalid - trigges når textarea er invalid
11
+ *
12
+ * @csspart form-control - hoved komponent sitt container
13
+ * @csspart textarea-label - label og requiredLabel container
14
+ * @csspart base - textarea og ikone container
15
+ * @csspart help-text-container - container for hjelpetekst
16
+ *
17
+ * Skal brukes til å lage lang tekstfelt. Min høyde er satt opp til --sizing-2x-small. De fleste attributer som brukes på vanlig textarea
18
+ * burde bli støttet her. Hvis det er noe som mangler, bare å legge til.
19
+ * Man kan bruke label og tooltip attributer for å vise label over textarea. Samt med helpText. Trenger ikke noe eksta slots per i dag. Trengs ikke å lage separate slots for det.
20
+ * Siden vi skulle bruke ikoner inn i textarea var det enklere å lage vår egen komponent enn å leke med sl-textarea
21
+ */
22
+ export default class NveTextarea extends LitElement {
23
+ static styles: import("lit").CSSResult[];
24
+ /** Navnet på tekstområdet, sendt som et navn/verdi-par med skjemadata */
25
+ name: string;
26
+ /** Textarea verdi, sendt som et navn/verdi-par med skjemadata */
27
+ value: string;
28
+ /** Feil melding som vises under gruppe hvis validering feiler */
29
+ errorMessage?: string;
30
+ title: string;
31
+ /** Viser filled variant */
32
+ filled: boolean;
33
+ /** Label tekst */
34
+ label: string;
35
+ /** Hjelpetekst under textarea */
36
+ helpText: string;
37
+ /** Om textarea er deaktivert */
38
+ disabled: boolean;
39
+ /** Om textarea er skrivebeskyttet */
40
+ readonly: boolean;
41
+ /** Placeholder tekst */
42
+ placeholder: string;
43
+ /** Om textarea er obligatorisk */
44
+ required: boolean;
45
+ /** Tekst som vises for å markere at et felt er obligatorisk. Er satt til "*Obligatorisk" som standard.*/
46
+ requiredLabel: string;
47
+ /** Den minste lengden på inndata som vil bli betraktet som gyldig. */
48
+ minlength?: number;
49
+ /** Maksimal lengde på inndata som vil bli betraktet som gyldig. */
50
+ maxlength?: number;
51
+ /** Kontrollerer om og hvordan tekstinnput automatisk blir gjort stor som det blir skrevet inn av brukeren. */
52
+ autocapitalize: 'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters';
53
+ /** Indikerer om nettleserens autokorrekturfunksjon er på eller av. */
54
+ autocorrect?: string;
55
+ /** Indikerer om nettleserens autokorrekturfunksjon er på eller av. */
56
+ tooltip?: string;
57
+ /**
58
+ * Forteller nettleseren hvilken type data som vil bli skrevet inn av brukeren, slik at den kan vise det passende virtuelle
59
+ * tastaturet på støttede enheter.
60
+ */
61
+ inputmode?: 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url';
62
+ /** Bestemmer om feilmelding skal vises når validering feiler */
63
+ private showErrorMessage;
64
+ /** Om bruker starter å skrive noe i textarea */
65
+ private touched;
66
+ /** Hoved input felt i nve-textarea komponentet. Brukes til constraint validering */
67
+ input: HTMLTextAreaElement;
68
+ constructor();
69
+ firstUpdated(): void;
70
+ connectedCallback(): void;
71
+ disconnectedCallback(): void;
72
+ private emit;
73
+ private handleSubmit;
74
+ private handleBlur;
75
+ private handleChange;
76
+ private handleInput;
77
+ /** Sjekker constraint validation og hvis man kjørte setCustomValidity med en melding, checkValidity blir falsk og. Hvis man ikke bruker errorMessage property vil den vise default engelsk tekst istedenfor */
78
+ private checkValidity;
79
+ setCustomValidity(message?: string): void;
80
+ private makeInvalid;
81
+ private resetValidation;
82
+ /** Toggler riktig validering attribute for å vise riktig style */
83
+ private toggleValidationAttributes;
84
+ render(): import("lit-html").TemplateResult<1>;
85
+ }
86
+ declare global {
87
+ interface HTMLElementTagNameMap {
88
+ 'nve-textarea': NveTextarea;
89
+ }
90
+ }
@@ -0,0 +1,201 @@
1
+ import { s as m, x as r } from "../../chunks/lit-element.js";
2
+ import { n as a, t as b } from "../../chunks/property.js";
3
+ import { r as c } from "../../chunks/state.js";
4
+ import { e as v } from "../../chunks/query.js";
5
+ import f from "./nve-textarea.styles.js";
6
+ import { o as s } from "../../chunks/if-defined.js";
7
+ import { l as g } from "../../chunks/live.js";
8
+ import { e as u } from "../../chunks/class-map.js";
9
+ import "../nve-icon/nve-icon.component.js";
10
+ import "../nve-label/nve-label.component.js";
11
+ import "../../chunks/directive-helpers.js";
12
+ import "../nve-icon/nve-icon.styles.js";
13
+ import "../nve-label/nve-label.styles.js";
14
+ import "../nve-tooltip/nve-tooltip.component.js";
15
+ import "../../chunks/chunk.JS655M6J.js";
16
+ import "../../chunks/chunk.GMVRWIWU.js";
17
+ import "../../chunks/chunk.KRRLOROJ.js";
18
+ import "../../chunks/chunk.MAS2SHYD.js";
19
+ import "../../chunks/chunk.Q6ASPMKT.js";
20
+ var y = Object.defineProperty, x = Object.getOwnPropertyDescriptor, i = (t, o, n, h) => {
21
+ for (var l = h > 1 ? void 0 : h ? x(o, n) : o, p = t.length - 1, d; p >= 0; p--)
22
+ (d = t[p]) && (l = (h ? d(o, n, l) : d(l)) || l);
23
+ return h && l && y(o, n, l), l;
24
+ };
25
+ let e = class extends m {
26
+ constructor() {
27
+ super(), this.name = "", this.value = "", this.title = "", this.filled = !1, this.label = "", this.helpText = "", this.disabled = !1, this.readonly = !1, this.placeholder = "", this.required = !1, this.requiredLabel = "*Obligatorisk", this.autocapitalize = "off", this.showErrorMessage = !1, this.touched = !1;
28
+ }
29
+ firstUpdated() {
30
+ if (this.required) {
31
+ const t = this.input.checkValidity();
32
+ this.toggleAttribute("data-valid", t), this.toggleAttribute("data-invalid", !t);
33
+ }
34
+ }
35
+ connectedCallback() {
36
+ super.connectedCallback();
37
+ const t = this.closest("form");
38
+ t == null || t.addEventListener("submit", this.handleSubmit.bind(this));
39
+ }
40
+ disconnectedCallback() {
41
+ super.disconnectedCallback();
42
+ const t = this.closest("form");
43
+ t == null || t.removeEventListener("submit", this.handleSubmit.bind(this));
44
+ }
45
+ // kan senere flyttes til utils hvis blir brukt flere steder
46
+ emit(t) {
47
+ this.dispatchEvent(new CustomEvent(t));
48
+ }
49
+ handleSubmit(t) {
50
+ t.preventDefault(), this.checkValidity();
51
+ }
52
+ // validerer ikke hvis bruker ikke har tatt på input feltet
53
+ handleBlur() {
54
+ this.touched && this.checkValidity(), this.emit("sl-blur");
55
+ }
56
+ handleChange() {
57
+ this.value = this.input.value, this.emit("sl-change");
58
+ }
59
+ handleInput() {
60
+ this.touched = !0, this.value = this.input.value, this.emit("sl-input");
61
+ }
62
+ /** Sjekker constraint validation og hvis man kjørte setCustomValidity med en melding, checkValidity blir falsk og. Hvis man ikke bruker errorMessage property vil den vise default engelsk tekst istedenfor */
63
+ checkValidity() {
64
+ this.input.checkValidity() ? this.resetValidation() : this.makeInvalid();
65
+ }
66
+ setCustomValidity(t = "") {
67
+ this.input.setCustomValidity(t);
68
+ }
69
+ makeInvalid() {
70
+ this.errorMessage = this.errorMessage || this.input.validationMessage, this.showErrorMessage = !0, this.emit("sl-invalid"), this.toggleValidationAttributes(!1);
71
+ }
72
+ resetValidation() {
73
+ this.showErrorMessage = !1, this.toggleValidationAttributes(!0);
74
+ }
75
+ /** Toggler riktig validering attribute for å vise riktig style */
76
+ toggleValidationAttributes(t) {
77
+ this.toggleAttribute("data-valid", t), this.toggleAttribute("data-user-valid", t), this.toggleAttribute("data-invalid", !t), this.toggleAttribute("data-user-invalid", !t);
78
+ }
79
+ render() {
80
+ return r`
81
+ <div part="form-control" class=${u({ "form-control": !0, "form-control--has-label": this.label })}>
82
+ <div part="textarea-label">
83
+ ${this.label ? r`
84
+ <nve-label
85
+ class=${u({ textarea__label: !0 })}
86
+ for="input"
87
+ aria-hidden=${this.label ? "false" : "true"}
88
+ value=${this.label}
89
+ tooltip=${s(this.tooltip)}
90
+ ></nve-label>
91
+ ` : null}
92
+ ${this.required ? r`<span class="textarea__required-label">${this.requiredLabel}</span>` : null}
93
+ </div>
94
+ <div part="base">
95
+ <textarea
96
+ class="textarea__control"
97
+ title=${this.title}
98
+ name=${s(this.name)}
99
+ .value=${g(this.value)}
100
+ ?disabled=${this.disabled}
101
+ ?readonly=${this.readonly}
102
+ ?required=${this.required}
103
+ placeholder=${s(this.placeholder)}
104
+ minlength=${s(this.minlength)}
105
+ maxlength=${s(this.maxlength)}
106
+ autocapitalize=${s(this.autocapitalize)}
107
+ autocorrect=${s(this.autocorrect)}
108
+ ?autofocus=${this.autofocus}
109
+ inputmode=${s(this.inputmode)}
110
+ aria-describedby="help-text"
111
+ @change=${this.handleChange}
112
+ @input=${this.handleInput}
113
+ @blur=${this.handleBlur}
114
+ ></textarea>
115
+ <!-- Foreløpig kan man ha enten 'lock' eller 'error' ikone -->
116
+ ${this.disabled || this.showErrorMessage ? r`<div class="textarea__icon__container">
117
+ ${this.disabled ? r`<nve-icon name="lock"></nve-icon>` : null}
118
+ ${this.showErrorMessage ? r`<nve-icon class="textarea__icon--error" name="error"></nve-icon>` : null}
119
+ </div>` : null}
120
+ </div>
121
+ <div part="help-text-container" class="textarea__help-text__container">
122
+ <!-- Ikke vis hjelpe tekst mens feil -->
123
+ ${!this.showErrorMessage && this.helpText ? r`<span class="textarea__help-text" id="help-text" aria-hidden=${this.helpText ? "false" : "true"}
124
+ >${this.helpText}</span
125
+ >` : null}
126
+ ${this.showErrorMessage ? r`<span class="textarea__help-text textarea__help-text--error">${this.errorMessage}</span>` : null}
127
+ </div>
128
+ </div>
129
+ `;
130
+ }
131
+ };
132
+ e.styles = [f];
133
+ i([
134
+ a()
135
+ ], e.prototype, "name", 2);
136
+ i([
137
+ a()
138
+ ], e.prototype, "value", 2);
139
+ i([
140
+ a()
141
+ ], e.prototype, "errorMessage", 2);
142
+ i([
143
+ a()
144
+ ], e.prototype, "title", 2);
145
+ i([
146
+ a({ type: Boolean, reflect: !0 })
147
+ ], e.prototype, "filled", 2);
148
+ i([
149
+ a()
150
+ ], e.prototype, "label", 2);
151
+ i([
152
+ a()
153
+ ], e.prototype, "helpText", 2);
154
+ i([
155
+ a({ type: Boolean, reflect: !0 })
156
+ ], e.prototype, "disabled", 2);
157
+ i([
158
+ a({ type: Boolean, reflect: !0 })
159
+ ], e.prototype, "readonly", 2);
160
+ i([
161
+ a()
162
+ ], e.prototype, "placeholder", 2);
163
+ i([
164
+ a({ type: Boolean, reflect: !0 })
165
+ ], e.prototype, "required", 2);
166
+ i([
167
+ a()
168
+ ], e.prototype, "requiredLabel", 2);
169
+ i([
170
+ a({ type: Number })
171
+ ], e.prototype, "minlength", 2);
172
+ i([
173
+ a({ type: Number })
174
+ ], e.prototype, "maxlength", 2);
175
+ i([
176
+ a()
177
+ ], e.prototype, "autocapitalize", 2);
178
+ i([
179
+ a()
180
+ ], e.prototype, "autocorrect", 2);
181
+ i([
182
+ a()
183
+ ], e.prototype, "tooltip", 2);
184
+ i([
185
+ a()
186
+ ], e.prototype, "inputmode", 2);
187
+ i([
188
+ c()
189
+ ], e.prototype, "showErrorMessage", 2);
190
+ i([
191
+ c()
192
+ ], e.prototype, "touched", 2);
193
+ i([
194
+ v(".textarea__control")
195
+ ], e.prototype, "input", 2);
196
+ e = i([
197
+ b("nve-textarea")
198
+ ], e);
199
+ export {
200
+ e as default
201
+ };
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult;
2
+ export default _default;
@@ -0,0 +1,103 @@
1
+ import { i as r } from "../../chunks/lit-element.js";
2
+ const a = r`
3
+ :host {
4
+ width: fit-content;
5
+ display: flex;
6
+ }
7
+
8
+ :host::part(form-control) {
9
+ display: flex;
10
+ flex-direction: column;
11
+ gap: var(--spacing-x-small);
12
+ }
13
+
14
+ :host::part(base) {
15
+ display: flex;
16
+ position: relative; /** trengs for å posisjonere ikonen */
17
+ width: fit-content;
18
+ }
19
+
20
+ .textarea__control {
21
+ font: var(--body-small);
22
+ padding: var(--sizing-4x-small);
23
+ padding-right: var(--sizing-2x-small); /** trenger padding for å vise ikone så at teksten ikke dekker den */
24
+ border-radius: var(--border-radius-small);
25
+ border: var(--border-width-default, 1px) solid var(--neutrals-border-default);
26
+ min-height: var(--sizing-2x-small);
27
+ min-width: 30px;
28
+ transition: border var(--transition-time) ease-in-out;
29
+
30
+ &:hover:not(:disabled) {
31
+ border-color: var(--neutrals-foreground-primary);
32
+ }
33
+
34
+ &:focus-visible {
35
+ outline: var(--sl-focus-ring);
36
+ outline-offset: var(--sl-focus-ring-offset);
37
+ }
38
+ }
39
+
40
+ :host([data-user-invalid]) .textarea__control {
41
+ border-color: var(--feedback-background-emphasized-error);
42
+ }
43
+
44
+ :host([disabled]) .textarea__control {
45
+ opacity: 0.38;
46
+ background: var(--neutrals-background-primary-contrast);
47
+ }
48
+
49
+ :host([filled]) .textarea__control {
50
+ background: var(--neutrals-background-primary-contrast);
51
+ border: var(--border-width-default, 1px) solid var(--neutrals-border-subtle);
52
+
53
+ &:hover:not(:disabled) {
54
+ border-color: var(--neutrals-border-default);
55
+ }
56
+ }
57
+
58
+ :host([readonly]) .textarea__control {
59
+ background: var(--neutrals-background-secondary);
60
+ color: var(--neutrals-foreground-subtle,);
61
+ border: none;
62
+ }
63
+
64
+ :host::part(textarea-label) {
65
+ display: flex;
66
+ justify-content: space-between;
67
+ gap: 0.5rem;
68
+ align-items: center;
69
+ }
70
+
71
+ .textarea__required-label {
72
+ font: var(--label-x-small-light);
73
+ color: var(--feedback-background-emphasized-error);
74
+ }
75
+
76
+ .textarea__help-text__container {
77
+ display: flex;
78
+ flex-direction: column;
79
+ gap: 2px;
80
+ }
81
+
82
+ .textarea__help-text {
83
+ font: var(--label-x-small-light);
84
+ color: var(--sl-input-help-text-color);
85
+ }
86
+
87
+ .textarea__help-text--error {
88
+ color: var(--feedback-background-emphasized-error);
89
+ }
90
+
91
+ .textarea__icon__container {
92
+ position: absolute;
93
+ right: var(--sizing-4x-small);
94
+ top: var(--sizing-4x-small);
95
+ }
96
+
97
+ .textarea__icon--error {
98
+ color: var(--feedback-background-emphasized-error);
99
+ }
100
+ `;
101
+ export {
102
+ a as default
103
+ };
package/css/global.css CHANGED
@@ -2,6 +2,8 @@
2
2
  @import url('https://fonts.cdnfonts.com/css/source-sans-pro');
3
3
 
4
4
  :root {
5
+ --transition-time: 0.3s;
6
+
5
7
  --sl-focus-ring-color: var(--interactive-links-focus);
6
8
  --sl-focus-ring-style: solid;
7
9
  --sl-focus-ring-width: 2px;
@@ -17,6 +17,7 @@ export { default as NveRadio } from './components/nve-radio/nve-radio.component'
17
17
  export { default as NveRadioButton } from './components/nve-radio-button/nve-radio-button.component';
18
18
  export { default as NveRadioGroup } from './components/nve-radio-group/nve-radio-group.component';
19
19
  export { default as NveSpinner } from './components/nve-spinner/nve-spinner.component';
20
+ export { default as NveTextarea } from './components/nve-textarea/nve-textarea.component';
20
21
  export { default as NveTooltip } from './components/nve-tooltip/nve-tooltip.component';
21
22
  export { default as NveSelect } from './components/nve-select/nve-select.component';
22
23
  export { default as NveOption } from './components/nve-option/nve-option.component';
@@ -1,26 +1,27 @@
1
- import { default as Q } from "./components/nve-alert/nve-alert.component.js";
2
- import { default as V } from "./components/nve-badge/nve-badge.component.js";
3
- import { default as X } from "./components/nve-button/nve-button.component.js";
4
- import { default as Z } from "./components/nve-checkbox/nve-checkbox.component.js";
5
- import { default as $ } from "./components/nve-checkbox-group/nve-checkbox-group.component.js";
6
- import { default as to } from "./components/nve-dialog/nve-dialog.component.js";
7
- import { default as eo } from "./components/nve-divider/nve-divider.component.js";
8
- import { default as mo } from "./components/nve-dropdown/nve-dropdown.component.js";
9
- import { default as io } from "./components/nve-icon/nve-icon.component.js";
10
- import { default as uo } from "./components/nve-input/nve-input.component.js";
11
- import { default as xo } from "./components/nve-label/nve-label.component.js";
12
- import { default as so } from "./components/nve-menu/nve-menu.component.js";
13
- import { default as no } from "./components/nve-menu-item/nve-menu-item.component.js";
14
- import { default as So } from "./components/nve-popup/nve-popup.component.js";
15
- import { default as Bo } from "./components/nve-radio/nve-radio.component.js";
16
- import { default as Io } from "./components/nve-radio-button/nve-radio-button.component.js";
17
- import { default as go } from "./components/nve-radio-group/nve-radio-group.component.js";
18
- import { default as ko } from "./components/nve-spinner/nve-spinner.component.js";
19
- import { default as Go } from "./components/nve-tooltip/nve-tooltip.component.js";
20
- import { default as wo } from "./components/nve-select/nve-select.component.js";
21
- import { default as Lo } from "./components/nve-option/nve-option.component.js";
22
- import { default as Po } from "./components/nve-stepper/nve-stepper.component.js";
23
- import { default as jo } from "./components/nve-stepper/nve-step/nve-step.component.js";
1
+ import { default as V } from "./components/nve-alert/nve-alert.component.js";
2
+ import { default as X } from "./components/nve-badge/nve-badge.component.js";
3
+ import { default as Z } from "./components/nve-button/nve-button.component.js";
4
+ import { default as $ } from "./components/nve-checkbox/nve-checkbox.component.js";
5
+ import { default as to } from "./components/nve-checkbox-group/nve-checkbox-group.component.js";
6
+ import { default as eo } from "./components/nve-dialog/nve-dialog.component.js";
7
+ import { default as mo } from "./components/nve-divider/nve-divider.component.js";
8
+ import { default as io } from "./components/nve-dropdown/nve-dropdown.component.js";
9
+ import { default as uo } from "./components/nve-icon/nve-icon.component.js";
10
+ import { default as xo } from "./components/nve-input/nve-input.component.js";
11
+ import { default as so } from "./components/nve-label/nve-label.component.js";
12
+ import { default as no } from "./components/nve-menu/nve-menu.component.js";
13
+ import { default as So } from "./components/nve-menu-item/nve-menu-item.component.js";
14
+ import { default as Bo } from "./components/nve-popup/nve-popup.component.js";
15
+ import { default as Io } from "./components/nve-radio/nve-radio.component.js";
16
+ import { default as go } from "./components/nve-radio-button/nve-radio-button.component.js";
17
+ import { default as ko } from "./components/nve-radio-group/nve-radio-group.component.js";
18
+ import { default as Go } from "./components/nve-spinner/nve-spinner.component.js";
19
+ import { default as To } from "./components/nve-textarea/nve-textarea.component.js";
20
+ import { default as Ao } from "./components/nve-tooltip/nve-tooltip.component.js";
21
+ import { default as Oo } from "./components/nve-select/nve-select.component.js";
22
+ import { default as jo } from "./components/nve-option/nve-option.component.js";
23
+ import { default as yo } from "./components/nve-stepper/nve-stepper.component.js";
24
+ import { default as Eo } from "./components/nve-stepper/nve-step/nve-step.component.js";
24
25
  import "./chunks/chunk.7O2CYFQX.js";
25
26
  import "./chunks/chunk.JS655M6J.js";
26
27
  import "./chunks/lit-element.js";
@@ -28,6 +29,7 @@ import "./chunks/property.js";
28
29
  import "./chunks/chunk.2HU27ZWH.js";
29
30
  import "./chunks/chunk.3WAW4E2K.js";
30
31
  import "./chunks/chunk.Q6ASPMKT.js";
32
+ import "./chunks/directive-helpers.js";
31
33
  import "./chunks/state.js";
32
34
  import "./chunks/class-map.js";
33
35
  import "./chunks/static.js";
@@ -60,32 +62,34 @@ import "./components/nve-menu/nve-menu.styles.js";
60
62
  import "./components/nve-menu-item/nve-menu-item.styles.js";
61
63
  import "./components/nve-radio/nve-radio.styles.js";
62
64
  import "./components/nve-radio-group/nve-radio-group.styles.js";
65
+ import "./components/nve-textarea/nve-textarea.styles.js";
63
66
  import "./components/nve-select/nve-select.styles.js";
64
67
  import "./components/nve-option/nve-option.styles.js";
65
68
  import "./components/nve-stepper/nve-stepper.styles.js";
66
69
  import "./components/nve-stepper/nve-step/nve-step.styles.js";
67
70
  export {
68
- Q as NveAlert,
69
- V as NveBadge,
70
- X as NveButton,
71
- Z as NveCheckbox,
72
- $ as NveCheckboxGroup,
73
- to as NveDialog,
74
- eo as NveDivider,
75
- mo as NveDropdown,
76
- io as NveIcon,
77
- uo as NveInput,
78
- xo as NveLabel,
79
- so as NveMenu,
80
- no as NveMenuItem,
81
- Lo as NveOption,
82
- So as NvePopup,
83
- Bo as NveRadio,
84
- Io as NveRadioButton,
85
- go as NveRadioGroup,
86
- wo as NveSelect,
87
- ko as NveSpinner,
88
- jo as NveStep,
89
- Po as NveStepper,
90
- Go as NveTooltip
71
+ V as NveAlert,
72
+ X as NveBadge,
73
+ Z as NveButton,
74
+ $ as NveCheckbox,
75
+ to as NveCheckboxGroup,
76
+ eo as NveDialog,
77
+ mo as NveDivider,
78
+ io as NveDropdown,
79
+ uo as NveIcon,
80
+ xo as NveInput,
81
+ so as NveLabel,
82
+ no as NveMenu,
83
+ So as NveMenuItem,
84
+ jo as NveOption,
85
+ Bo as NvePopup,
86
+ Io as NveRadio,
87
+ go as NveRadioButton,
88
+ ko as NveRadioGroup,
89
+ Oo as NveSelect,
90
+ Go as NveSpinner,
91
+ Eo as NveStep,
92
+ yo as NveStepper,
93
+ To as NveTextarea,
94
+ Ao as NveTooltip
91
95
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nve-designsystem",
3
- "version": "0.1.55",
3
+ "version": "0.1.57",
4
4
  "exports": {
5
5
  ".": {
6
6
  "import": "./nve-designsystem.js",