nve-designsystem 3.1.0 → 3.3.0

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 (197) hide show
  1. package/chunks/chunk.2PCBEMQZ.js +163 -226
  2. package/chunks/chunk.36O46B5H.js +15 -15
  3. package/chunks/chunk.4TUIT776.js +78 -96
  4. package/chunks/chunk.5JY5FUCG.js +965 -1245
  5. package/chunks/chunk.5P45LHIX.js +668 -96
  6. package/chunks/chunk.6CTB5ZDJ.js +107 -100
  7. package/chunks/chunk.B4BZKR24.js +29 -39
  8. package/chunks/chunk.D5YQDJ7X.js +122 -166
  9. package/chunks/chunk.EA437WHD.js +5 -5
  10. package/chunks/chunk.GI7VDIWX.js +14 -15
  11. package/chunks/chunk.GMYPQTFK.js +18 -20
  12. package/chunks/chunk.HVTXQL7M.js +191 -215
  13. package/chunks/chunk.IKV4VH3T.js +18 -16
  14. package/chunks/chunk.IVVHNXMC.js +26 -27
  15. package/chunks/chunk.JHOXTQXA.js +65 -74
  16. package/chunks/chunk.JXOKFADN.js +63 -90
  17. package/chunks/chunk.K7JGTRV7.js +24 -23
  18. package/chunks/chunk.KPLQLAWP.js +132 -147
  19. package/chunks/chunk.LD4M4QGE.js +61 -74
  20. package/chunks/chunk.MSKEYBDI.js +53 -71
  21. package/chunks/chunk.NYIIDP5N.js +39 -45
  22. package/chunks/chunk.RWUUFNUL.js +91 -114
  23. package/chunks/chunk.SAPQLUO4.js +249 -228
  24. package/chunks/chunk.SI4ACBFK.js +139 -5
  25. package/chunks/chunk.TP2GB2HO.js +361 -460
  26. package/chunks/chunk.UDWRA64J.js +185 -223
  27. package/chunks/chunk.URTPIBTY.js +119 -151
  28. package/chunks/chunk.VESXC477.js +63 -66
  29. package/chunks/chunk.XA43ZQPC.js +198 -313
  30. package/chunks/chunk.XQ2OKYYA.js +25 -26
  31. package/chunks/chunk.XZNBUGX7.js +6 -6
  32. package/chunks/chunk.YHLNUJ7P.js +93 -116
  33. package/chunks/chunk.ZH2AND3P.js +340 -399
  34. package/chunks/chunk.ZL53POKZ.js +61 -156
  35. package/chunks/chunk.js +20 -0
  36. package/chunks/class-map.js +49 -45
  37. package/chunks/decorate.js +105 -0
  38. package/chunks/directive-helpers.js +5 -7
  39. package/chunks/if-defined.js +5 -5
  40. package/chunks/lit.js +525 -0
  41. package/chunks/live.js +24 -24
  42. package/chunks/nve-alert.component.js +163 -0
  43. package/chunks/nve-carousel-item.component.js +36 -0
  44. package/chunks/nve-carousel.component.js +41 -0
  45. package/chunks/nve-checkbox-group.component.js +114 -0
  46. package/chunks/nve-checkbox.component.js +28 -0
  47. package/chunks/nve-dialog.component.js +39 -0
  48. package/chunks/nve-divider.component.js +23 -0
  49. package/chunks/nve-drawer.component.js +40 -0
  50. package/chunks/nve-dropdown.component.js +83 -0
  51. package/chunks/nve-input.component.js +80 -0
  52. package/chunks/nve-label.component.js +89 -0
  53. package/chunks/nve-menu-item.component.js +35 -0
  54. package/chunks/nve-menu.component.js +17 -0
  55. package/chunks/nve-option.component.js +27 -0
  56. package/chunks/nve-popup.component.js +15 -0
  57. package/chunks/nve-radio-button.component.js +20 -0
  58. package/chunks/nve-radio-group.component.js +78 -0
  59. package/chunks/nve-radio.component.js +18 -0
  60. package/chunks/nve-select.component.js +58 -0
  61. package/chunks/nve-skeleton.component.js +20 -0
  62. package/chunks/nve-spinner.component.js +23 -0
  63. package/chunks/nve-tooltip.component.js +20 -0
  64. package/chunks/nve-warning-level.component.js +57 -0
  65. package/chunks/ref.js +75 -84
  66. package/chunks/shoelace.js +10006 -0
  67. package/chunks/static-html.js +27 -0
  68. package/chunks/unsafe-html.js +24 -20
  69. package/chunks/updateInvalidProperty.js +7 -7
  70. package/chunks/watch.js +20 -20
  71. package/components/nve-accordion/nve-accordion.component.js +24 -30
  72. package/components/nve-accordion-item/nve-accordion-item.component.js +30 -64
  73. package/components/nve-accordion-item/nve-accordion-item.styles.js +5 -5
  74. package/components/nve-alert/nve-alert.component.js +2 -227
  75. package/components/nve-alert/nve-alert.styles.js +45 -27
  76. package/components/nve-badge/nve-badge.component.js +41 -45
  77. package/components/nve-badge/nve-badge.styles.js +33 -31
  78. package/components/nve-button/nve-button.component.d.ts +110 -10
  79. package/components/nve-button/nve-button.component.js +146 -39
  80. package/components/nve-button/nve-button.styles.js +214 -157
  81. package/components/nve-carousel/nve-carousel.component.js +2 -47
  82. package/components/nve-carousel/nve-carousel.styles.js +6 -6
  83. package/components/nve-carousel-item/nve-carousel-item.component.js +2 -40
  84. package/components/nve-carousel-item/nve-carousel-item.styles.js +5 -5
  85. package/components/nve-carousel-thumbnail/nve-carousel-thumbnail.component.js +44 -54
  86. package/components/nve-carousel-thumbnail/nve-carousel-thumbnail.styles.js +5 -5
  87. package/components/nve-checkbox/nve-checkbox.component.js +2 -34
  88. package/components/nve-checkbox/nve-checkbox.styles.js +7 -7
  89. package/components/nve-checkbox-group/nve-checkbox-group.component.js +2 -152
  90. package/components/nve-checkbox-group/nve-checkbox-group.styles.js +5 -5
  91. package/components/nve-combobox/nve-combobox.component.js +222 -440
  92. package/components/nve-combobox/nve-combobox.styles.js +6 -6
  93. package/components/nve-darkmode-switch/nve-darkmode-switch.component.js +32 -38
  94. package/components/nve-dialog/nve-dialog-styles.js +6 -6
  95. package/components/nve-dialog/nve-dialog.component.js +2 -54
  96. package/components/nve-divider/nve-divider.component.js +2 -30
  97. package/components/nve-drawer/nve-drawer.component.js +2 -44
  98. package/components/nve-drawer/nve-drawer.styles.js +6 -6
  99. package/components/nve-dropdown/nve-dropdown.component.js +2 -79
  100. package/components/nve-dropdown/nve-dropdown.styles.js +5 -5
  101. package/components/nve-heading/nve-heading.component.d.ts +29 -0
  102. package/components/nve-heading/nve-heading.component.js +45 -0
  103. package/components/nve-heading/nve-heading.styles.d.ts +2 -0
  104. package/components/nve-heading/nve-heading.styles.js +41 -0
  105. package/components/nve-icon/nve-icon.component.js +145 -164
  106. package/components/nve-icon/nve-icon.styles.js +11 -6
  107. package/components/nve-icon/offline-icons.js +16 -13
  108. package/components/nve-input/nve-input.component.js +2 -100
  109. package/components/nve-input/nve-input.styles.js +5 -5
  110. package/components/nve-label/nve-label.component.js +2 -115
  111. package/components/nve-label/nve-label.styles.js +5 -5
  112. package/components/nve-link-card/nve-link-card.component.d.ts +5 -2
  113. package/components/nve-link-card/nve-link-card.component.js +44 -80
  114. package/components/nve-link-card/nve-link-card.styles.js +71 -66
  115. package/components/nve-menu/nve-menu.component.js +2 -22
  116. package/components/nve-menu/nve-menu.styles.js +5 -5
  117. package/components/nve-menu-item/nve-menu-item.component.js +2 -43
  118. package/components/nve-menu-item/nve-menu-item.styles.js +7 -7
  119. package/components/nve-message-card/nve-message-card.component.js +61 -91
  120. package/components/nve-message-card/nve-message-card.styles.js +24 -27
  121. package/components/nve-navigation-card/nve-navigation-card.component.d.ts +52 -0
  122. package/components/nve-navigation-card/nve-navigation-card.component.js +60 -0
  123. package/components/nve-navigation-card/nve-navigation-card.styles.d.ts +2 -0
  124. package/components/nve-navigation-card/nve-navigation-card.styles.js +112 -0
  125. package/components/nve-option/nve-option.component.js +2 -41
  126. package/components/nve-option/nve-option.styles.js +5 -5
  127. package/components/nve-paragraph/nve-paragraph.component.d.ts +26 -0
  128. package/components/nve-paragraph/nve-paragraph.component.js +26 -0
  129. package/components/nve-paragraph/nve-paragraph.styles.d.ts +2 -0
  130. package/components/nve-paragraph/nve-paragraph.styles.js +105 -0
  131. package/components/nve-popup/nve-popup.component.js +2 -22
  132. package/components/nve-radio/nve-radio.component.js +2 -23
  133. package/components/nve-radio/nve-radio.styles.js +5 -5
  134. package/components/nve-radio-button/nve-radio-button.component.js +2 -25
  135. package/components/nve-radio-button/nve-radio-button.styles.js +5 -5
  136. package/components/nve-radio-group/nve-radio-group.component.js +2 -119
  137. package/components/nve-radio-group/nve-radio-group.styles.js +5 -5
  138. package/components/nve-relative-time/nve-relative-time.component.js +21 -56
  139. package/components/nve-relative-time/nve-relative-time.styles.js +5 -5
  140. package/components/nve-select/nve-select.component.js +2 -80
  141. package/components/nve-select/nve-select.styles.js +6 -6
  142. package/components/nve-skeleton/nve-skeleton.component.js +2 -27
  143. package/components/nve-skeleton/nve-skeleton.styles.js +5 -5
  144. package/components/nve-spinner/nve-spinner.component.js +2 -31
  145. package/components/nve-stepper/nve-step/nve-step.component.js +113 -173
  146. package/components/nve-stepper/nve-step/nve-step.styles.js +12 -12
  147. package/components/nve-stepper/nve-stepper-mobile.component.js +37 -49
  148. package/components/nve-stepper/nve-stepper-mobile.styles.js +7 -7
  149. package/components/nve-stepper/nve-stepper.component.js +94 -139
  150. package/components/nve-stepper/nve-stepper.styles.js +5 -5
  151. package/components/nve-switch/nve-switch.component.js +75 -107
  152. package/components/nve-switch/nve-switch.styles.js +7 -7
  153. package/components/nve-tab/nve-tab.component.js +30 -42
  154. package/components/nve-tab/nve-tab.styles.js +7 -7
  155. package/components/nve-tab-group/nve-tab-group.component.js +180 -260
  156. package/components/nve-tab-group/nve-tab-group.styles.js +5 -5
  157. package/components/nve-tab-panel/nve-tab-panel.component.js +21 -31
  158. package/components/nve-tab-panel/nve-tab-panel.styles.js +5 -5
  159. package/components/nve-tag/nve-tag.component.d.ts +3 -3
  160. package/components/nve-tag/nve-tag.component.js +71 -72
  161. package/components/nve-tag/nve-tag.styles.js +23 -22
  162. package/components/nve-textarea/nve-textarea.component.d.ts +3 -1
  163. package/components/nve-textarea/nve-textarea.component.js +112 -173
  164. package/components/nve-textarea/nve-textarea.styles.js +10 -5
  165. package/components/nve-tooltip/nve-tooltip.component.js +2 -30
  166. package/components/nve-tooltip/nve-tooltip.styles.js +5 -5
  167. package/components/nve-warning-level/nve-warning-level.component.js +2 -78
  168. package/components/nve-warning-level/nve-warning-level.styles.js +7 -7
  169. package/css/global.css +13 -55
  170. package/css/nve.css +1048 -393
  171. package/css/nve_dark.css +406 -305
  172. package/css/rme.css +1050 -395
  173. package/css/rme_dark.css +408 -307
  174. package/css/shoelace-styles.css +539 -0
  175. package/css/varsom.css +1046 -391
  176. package/css/varsom_dark.css +404 -303
  177. package/custom-elements.json +2905 -12389
  178. package/fonts/LICENSE.txt +37 -0
  179. package/fonts/SourceSans3-VariableFont_wght.woff2 +0 -0
  180. package/interfaces/NveComponent.interface.js +0 -1
  181. package/nve-designsystem.d.ts +5 -0
  182. package/nve-designsystem.js +46 -86
  183. package/package.json +26 -8
  184. package/registerIcons/systemLibraryCustomization.js +23 -91
  185. package/vite-env.d.js +0 -1
  186. package/chunks/chunk.3RPBFEDE.js +0 -162
  187. package/chunks/chunk.JCXLDPQF.js +0 -225
  188. package/chunks/chunk.JQBT7BOV.js +0 -8446
  189. package/chunks/chunk.MAQXLKQ7.js +0 -598
  190. package/chunks/lit-element.js +0 -508
  191. package/chunks/property.js +0 -37
  192. package/chunks/query.js +0 -13
  193. package/chunks/state.js +0 -7
  194. package/chunks/static.js +0 -26
  195. package/nve-designsystem.css +0 -1
  196. package/vscode.css-custom-data.json +0 -621
  197. package/vscode.html-custom-data.json +0 -2354
@@ -1,40 +1,147 @@
1
- import { n as f, t as u } from "../../chunks/property.js";
2
- import { b as m } from "../../chunks/chunk.JCXLDPQF.js";
3
- import "../../chunks/chunk.36O46B5H.js";
4
- import "../../chunks/chunk.3RPBFEDE.js";
5
- import "../../chunks/chunk.MAQXLKQ7.js";
6
- import "../../chunks/chunk.6CTB5ZDJ.js";
7
- import "../../chunks/chunk.YHLNUJ7P.js";
8
- import "../../chunks/chunk.4TUIT776.js";
9
- import c from "./nve-button.styles.js";
10
- var a = Object.defineProperty, d = Object.getOwnPropertyDescriptor, p = (r, t, i, e) => {
11
- for (var o = e > 1 ? void 0 : e ? d(t, i) : t, n = r.length - 1, l; n >= 0; n--)
12
- (l = r[n]) && (o = (e ? l(t, i, o) : l(o)) || o);
13
- return e && o && a(t, i, o), o;
14
- };
15
- let s = class extends m {
16
- constructor() {
17
- super(), this.size = "medium", this.testId = void 0;
18
- }
19
- // setter has-icon-only attributtet hvis det er kun ikone i standard sporet. Trengs for riktig styling.
20
- firstUpdated() {
21
- const r = this.shadowRoot?.querySelector(".button__label");
22
- if (r) {
23
- const t = r.assignedNodes().filter((e) => e.nodeType === Node.ELEMENT_NODE || e.textContent?.trim?.length);
24
- t.length === 1 && t[0].nodeName.toLowerCase() === "nve-icon" && this.setAttribute("has-icon-only", "");
25
- }
26
- }
27
- };
28
- s.styles = [m.styles, c];
29
- p([
30
- f({ reflect: !0 })
31
- ], s.prototype, "size", 2);
32
- p([
33
- f({ reflect: !0, type: String })
34
- ], s.prototype, "testId", 2);
35
- s = p([
36
- u("nve-button")
37
- ], s);
38
- export {
39
- s as default
1
+ import { n as e, t } from "../../chunks/lit.js";
2
+ import { a as n, o as r, r as i, s as a, t as o } from "../../chunks/decorate.js";
3
+ import { t as s } from "../../chunks/class-map.js";
4
+ import { t as c } from "../../chunks/if-defined.js";
5
+ import { r as l, t as u } from "../../chunks/static-html.js";
6
+ import d from "./nve-button.styles.js";
7
+ //#region src/components/nve-button/nve-button.component.ts
8
+ var f = class extends t {
9
+ static {
10
+ this.styles = [d];
11
+ }
12
+ getForm() {
13
+ if (this.form) {
14
+ let e = this.getRootNode().getElementById(this.form);
15
+ if (e instanceof HTMLFormElement) return e;
16
+ }
17
+ return this.closest("form");
18
+ }
19
+ constructLightDOMButton() {
20
+ let e = document.createElement("button");
21
+ return e.type = this.type, this.name && (e.name = this.name), e.value = this.value ?? "", (this.disabled || this.loading) && (e.disabled = !0), this.form && e.setAttribute("form", this.form), this.formAction && (e.formAction = this.formAction), this.formEnctype && (e.formEnctype = this.formEnctype), this.formMethod && (e.formMethod = this.formMethod), this.formNoValidate && (e.formNoValidate = !0), this.formTarget && (e.formTarget = this.formTarget), e.style.position = "absolute", e.style.width = "0", e.style.height = "0", e.style.clipPath = "inset(50%)", e.style.overflow = "hidden", e.style.whiteSpace = "nowrap", e;
22
+ }
23
+ handleClick(e) {
24
+ if (this.disabled || this.loading) {
25
+ e.preventDefault(), e.stopImmediatePropagation();
26
+ return;
27
+ }
28
+ if (this.type === "submit" || this.type === "reset") {
29
+ let e = this.getForm();
30
+ if (!e) return;
31
+ let t = this.constructLightDOMButton();
32
+ e.appendChild(t), t.click(), t.remove();
33
+ }
34
+ }
35
+ handleDefaultSlotChange(e) {
36
+ let t = e.target.assignedNodes({ flatten: !0 });
37
+ if (t.some((e) => e.nodeType === Node.TEXT_NODE && e.textContent?.trim())) return;
38
+ let n = t.filter((e) => e.nodeType === Node.ELEMENT_NODE);
39
+ n.length === 1 && (this.hasIconOrImgOnly = n.some((e) => {
40
+ let t = e.tagName.toLowerCase();
41
+ return t === "img" || t === "nve-icon";
42
+ }));
43
+ }
44
+ click() {
45
+ this.button.click();
46
+ }
47
+ focus(e) {
48
+ this.button.focus(e);
49
+ }
50
+ blur() {
51
+ this.button.blur();
52
+ }
53
+ isLink() {
54
+ return !!this.href;
55
+ }
56
+ forwardAriaAttributes(e) {
57
+ for (let t of this.getAttributeNames()) if (t.startsWith("aria-")) {
58
+ let n = this.getAttribute(t);
59
+ n !== null && (e.setAttribute(t, n), this.removeAttribute(t));
60
+ }
61
+ }
62
+ constructor() {
63
+ super(), this.testId = void 0, this.circle = !1, this.loading = !1, this.size = "medium", this.variant = "secondary", this.formNoValidate = !1, this.autofocus = !1, this.disabled = !1, this.type = "button", this.ariaExpanded = null, this.ariaHaspopup = null, this.ariaLabel = null, this.ariaPressed = null, this.hasIconOrImgOnly = !1;
64
+ }
65
+ updated() {
66
+ this.button && this.forwardAriaAttributes(this.button);
67
+ }
68
+ firstUpdated(e) {
69
+ this.autofocus && this.focus();
70
+ }
71
+ render() {
72
+ let t = this.isLink(), n = t ? u`a` : u`button`;
73
+ return l`
74
+ <${n}
75
+ part="base"
76
+ @click=${this.handleClick}
77
+ class=${s({
78
+ button: !0,
79
+ "button--small": this.size === "small",
80
+ "button--medium": this.size === "medium",
81
+ "button--large": this.size === "large",
82
+ "button--primary": this.variant === "primary",
83
+ "button--secondary": this.variant === "secondary",
84
+ "button--tertiary": this.variant === "tertiary",
85
+ "button--ghost": this.variant === "ghost",
86
+ "button--danger": this.variant === "danger",
87
+ "button--loading": this.loading,
88
+ "button--icon-only": this.hasIconOrImgOnly,
89
+ "button--circle": this.circle && this.hasIconOrImgOnly,
90
+ "button--disabled": this.disabled
91
+ })}
92
+ ?disabled=${c(t ? void 0 : this.disabled)}
93
+ type=${c(t ? void 0 : this.type)}
94
+ name=${c(t ? void 0 : this.name)}
95
+ value=${c(t ? void 0 : this.value)}
96
+ href=${c(t ? this.href : void 0)}
97
+ target=${c(t ? this.target : void 0)}
98
+ download=${c(t ? this.download : void 0)}
99
+ testid=${c(this.testId)}
100
+ form=${c(t ? void 0 : this.form)}
101
+ formaction=${c(t ? void 0 : this.formAction)}
102
+ formenctype=${c(t ? void 0 : this.formEnctype)}
103
+ formtarget=${c(t ? void 0 : this.formTarget)}
104
+ rel=${c(t && this.rel ? this.rel : void 0)}
105
+ aria-disabled=${c(t && this.disabled ? "true" : void 0)}
106
+ tabindex=${c(t && this.disabled ? "-1" : void 0)}
107
+ >
108
+ <slot part="start" name="start"></slot>
109
+
110
+ ${this.loading && this.hasIconOrImgOnly ? e : l`<slot part="label" @slotchange=${this.handleDefaultSlotChange}> </slot>`}
111
+ ${this.loading ? l`<div part="spinner" class="button__spinner"></div>` : e}
112
+ ${this.loading ? e : l`<slot part="end" name="end"></slot>`}
113
+ </${n}>
114
+ `;
115
+ }
40
116
  };
117
+ o([r({ type: String })], f.prototype, "testId", void 0), o([r({ type: Boolean })], f.prototype, "circle", void 0), o([r({
118
+ type: Boolean,
119
+ reflect: !0
120
+ })], f.prototype, "loading", void 0), o([r({ type: String })], f.prototype, "size", void 0), o([r({
121
+ type: String,
122
+ reflect: !0
123
+ })], f.prototype, "variant", void 0), o([r({ type: String })], f.prototype, "download", void 0), o([r({ type: String })], f.prototype, "href", void 0), o([r({ type: String })], f.prototype, "hreflang", void 0), o([r({ type: String })], f.prototype, "referrerpolicy", void 0), o([r({ type: String })], f.prototype, "rel", void 0), o([r({ type: String })], f.prototype, "target", void 0), o([r({ type: String })], f.prototype, "form", void 0), o([r({ type: String })], f.prototype, "formAction", void 0), o([r({ type: String })], f.prototype, "formEnctype", void 0), o([r({ type: String })], f.prototype, "formMethod", void 0), o([r({ type: Boolean })], f.prototype, "formNoValidate", void 0), o([r({ type: String })], f.prototype, "formTarget", void 0), o([r({ type: String })], f.prototype, "name", void 0), o([r({
124
+ type: Boolean,
125
+ reflect: !0
126
+ })], f.prototype, "autofocus", void 0), o([r({
127
+ type: Boolean,
128
+ reflect: !0
129
+ })], f.prototype, "disabled", void 0), o([r({ type: String })], f.prototype, "type", void 0), o([r({ type: String })], f.prototype, "value", void 0), o([r({
130
+ type: String,
131
+ attribute: "aria-controls"
132
+ })], f.prototype, "ariaControls", void 0), o([r({
133
+ type: String,
134
+ attribute: "aria-expanded"
135
+ })], f.prototype, "ariaExpanded", void 0), o([r({
136
+ type: String,
137
+ attribute: "aria-haspopup"
138
+ })], f.prototype, "ariaHaspopup", void 0), o([r({
139
+ type: String,
140
+ attribute: "aria-label"
141
+ })], f.prototype, "ariaLabel", void 0), o([r({
142
+ type: String,
143
+ attribute: "aria-pressed"
144
+ })], f.prototype, "ariaPressed", void 0), o([n()], f.prototype, "hasIconOrImgOnly", void 0), o([i(".button")], f.prototype, "button", void 0), f = o([a("nve-button")], f);
145
+ var p = f;
146
+ //#endregion
147
+ export { p as default };
@@ -1,223 +1,280 @@
1
- import { i as t } from "../../chunks/lit-element.js";
2
- const a = t`
3
- /* kan ikke bruke gap fordi den lager rom mellom slots selv om de er tomme */
4
- /* derfor setter margin på ::part(label) og substraherer margin verdi i horizontal padding i selve .button klassen */
1
+ import { u as e } from "../../chunks/lit.js";
2
+ //#region src/components/nve-button/nve-button.styles.ts
3
+ var t = e`
5
4
  :host {
5
+ display: inline-block;
6
+ position: relative;
7
+ width: fit-content;
8
+ --_img-small-size: var(--font-size-medium);
9
+ --_img-large-size: var(--font-size-large);
10
+ --_transition-time: 0.3s;
11
+ --nve-icon-color-hover: inherit;
12
+ --nve-icon-color-pressed: inherit;
6
13
  --nve-icon-color: inherit;
7
14
  }
8
15
 
9
16
  .button {
10
- width: fit-content;
17
+ padding-inline: unset;
18
+ margin: unset;
19
+ padding-block: unset;
20
+ display: flex;
21
+ background: var(--_button-background, transparent);
22
+ color: var(--_button-color, inherit);
23
+ border-radius: var(--border-radius-small);
24
+ border: var(--border-width-default) solid transparent;
25
+ border-color: var(--_button-border-color, transparent);
26
+ box-shadow: var(--_button-box-shadow, unset);
27
+ min-height: var(--sizing-fixed-sizing-medium);
28
+ min-width: var(--sizing-fixed-sizing-medium);
29
+ justify-content: center;
30
+ padding: var(--_button-padding, unset);
31
+ height: var(--_button-height, unset);
32
+ font: var(--_button-font, unset);
11
33
  align-items: center;
12
- box-sizing: border-box;
13
- position: relative;
14
- border: none;
15
- min-width: 48px;
34
+ gap: var(--spacing-x-small);
35
+ cursor: pointer;
36
+ text-align: center;
37
+ text-decoration: none;
16
38
  transition:
17
- background-color 0.3s ease,
18
- border-color 0.3s ease;
39
+ background var(--_transition-time) ease,
40
+ color var(--_transition-time) ease,
41
+ border-color var(--_transition-time) ease,
42
+ box-shadow var(--_transition-time) ease;
19
43
  }
20
44
 
21
- :host([has-icon-only])::part(base) {
22
- gap: unset;
45
+ .button:not(.button--loading):not(.button--disabled):hover {
46
+ background: var(--_button-background-hover, transparent);
47
+ color: var(--_button-color-hover, inherit);
48
+ border-color: var(--_button-border-color-hover, transparent);
49
+ box-shadow: var(--_button-box-shadow-hover, unset);
23
50
  }
24
51
 
25
- :host([has-icon-only]) .button--small {
26
- gap: unset;
27
- padding: var(--spacing-2x-small);
28
- min-width: unset;
52
+ .button:not(.button--loading):not(.button--disabled):active {
53
+ background: var(--_button-background-pressed, transparent);
54
+ color: var(--_button-color-pressed, inherit);
55
+ box-shadow: var(--_button-box-shadow-pressed, unset);
29
56
  }
30
57
 
31
- :host([has-icon-only]) .button--medium {
32
- gap: unset;
33
- padding: var(--spacing-x-small);
34
- min-width: unset;
35
- }
36
-
37
- :host([has-icon-only][circle])::part(base) {
38
- width: unset;
58
+ .button:focus-visible {
59
+ outline: var(--border-width-strong) solid var(--color-interactive-border-accessibility-focus);
39
60
  }
40
61
 
41
- :host([has-icon-only][loading])::part(spinner) {
42
- margin-right: 0;
62
+ /* Varianter */
63
+ .button--primary {
64
+ --_button-background: var(--color-interactive-background-primary-enabled);
65
+ --_button-color: var(--color-interactive-foreground-primary-enabled);
66
+ &:hover {
67
+ --_button-background-hover: var(--color-interactive-background-primary-hover);
68
+ --_button-color-hover: var(--color-interactive-foreground-primary-hover);
69
+ }
70
+ &:active {
71
+ --_button-background-pressed: var(--color-interactive-background-primary-pressed);
72
+ --_button-color-pressed: var(--color-interactive-foreground-primary-hover);
73
+ }
43
74
  }
44
75
 
45
- .button ::slotted(nve-badge) {
46
- position: absolute;
47
- top: 0;
48
- right: 0;
49
- transform: translate(50%, -50%);
50
- pointer-events: none;
76
+ .button--secondary {
77
+ --_button-background: var(--color-interactive-background-secondary-enabled);
78
+ --_button-color: var(--color-interactive-foreground-secondary-enabled);
79
+ &:hover {
80
+ --_button-background-hover: var(--color-interactive-background-secondary-hover);
81
+ --_button-color-hover: var(--color-interactive-foreground-secondary-hover);
82
+ }
83
+ &:active {
84
+ --_button-background-pressed: var(--color-interactive-background-secondary-pressed);
85
+ --_button-color-pressed: var(--color-interactive-foreground-secondary-hover);
86
+ }
51
87
  }
52
88
 
53
- :host::part(spinner) {
54
- --track-color: none;
55
- --track-width: 2.5px;
56
- position: relative;
57
- top: 0;
58
- font-size: var(--font-size-large);
59
- left: 0;
60
- margin-right: var(--spacing-x-small);
89
+ .button--tertiary {
90
+ --_button-background: transparent;
91
+ --_button-border-color: var(--color-interactive-border-secondary-enabled);
92
+ --_button-color: var(--color-interactive-foreground-secondary-enabled);
93
+ &:hover {
94
+ --_button-border-color-hover: var(--color-interactive-border-secondary-hover);
95
+ --_button-color-hover: var(--color-interactive-foreground-secondary-hover);
96
+ }
97
+ &:active {
98
+ --_button-box-shadow-pressed: inset 0 0 0 var(--border-width-default, 1px)
99
+ var(--color-interactive-border-secondary-hover);
100
+ --_button-color-pressed: var(--color-interactive-foreground-secondary-hover);
101
+ }
61
102
  }
62
103
 
63
- :host ::slotted(nve-icon) {
64
- font-size: var(--font-size-large);
65
- color: var(--nve-icon-color);
104
+ .button--ghost {
105
+ --_button-background: transparent;
106
+ --_button-color: var(--color-interactive-foreground-secondary-enabled);
107
+ &:hover {
108
+ --_button-background-hover: var(--color-interactive-background-tertiary-hover);
109
+ --_button-color-hover: var(--color-interactive-foreground-secondary-hover);
110
+ }
111
+ &:active {
112
+ --_button-background-pressed: var(--color-interactive-background-tertiary-pressed);
113
+ --_button-color-pressed: var(--color-interactive-foreground-secondary-hover);
114
+ }
115
+ }
116
+ .button--danger {
117
+ --_button-background: var(--color-feedback-background-emphasized-error);
118
+ --_button-color: var(--color-interactive-foreground-danger-enabled);
119
+ &:hover {
120
+ --_button-background-hover: var(--color-interactive-background-danger-hover);
121
+ --_button-color-hover: var(--color-interactive-foreground-danger-enabled);
122
+ }
123
+ &:active {
124
+ --_button-background-pressed: var(--color-interactive-background-danger-pressed);
125
+ --_button-color-pressed: var(--color-interactive-foreground-danger-enabled);
126
+ }
66
127
  }
67
128
 
68
- :host([size='small']) ::slotted(nve-icon) {
69
- font-size: var(--font-size-medium);
129
+ /* Størrelser */
130
+ .button--small {
131
+ padding: 0 var(--spacing-x-small);
132
+ height: calc(var(--spacing-2x-small) * 2 + var(--_img-small-size));
133
+ font: var(--typography-label-x-small);
134
+ line-height: 1em;
135
+ ::slotted(nve-icon) {
136
+ --icon-size: var(--_img-small-size);
137
+ }
138
+ ::slotted(img) {
139
+ width: var(--_img-small-size);
140
+ height: var(--_img-small-size);
141
+ }
70
142
  }
71
143
 
72
- :host([size='large']) ::slotted(nve-icon) {
73
- font-size: var(--font-size-large); // large og medium har samme ikonstr i figma
144
+ .button--medium {
145
+ padding: 0 var(--spacing-medium);
146
+ height: calc(var(--spacing-x-small) * 2 + var(--_img-large-size));
147
+ font: var(--typography-label-small);
148
+ line-height: 1em;
149
+ ::slotted(nve-icon) {
150
+ --icon-size: var(--_img-large-size);
151
+ }
152
+ ::slotted(img) {
153
+ width: var(--_img-large-size);
154
+ height: var(--_img-large-size);
155
+ }
74
156
  }
75
157
 
76
- :host::part(label) {
158
+ .button--large {
159
+ padding: var(--spacing-none) var(--spacing-large);
160
+ height: calc(var(--spacing-small) * 2 + var(--_img-large-size));
77
161
  font: var(--typography-label-medium);
162
+ ::slotted(nve-icon) {
163
+ --icon-size: var(--_img-large-size);
164
+ }
165
+ ::slotted(img) {
166
+ width: var(--_img-large-size);
167
+ height: var(--_img-large-size);
168
+ }
78
169
  }
79
170
 
80
- :host([size='medium'])::part(label) {
81
- font: var(--typography-label-small);
171
+ /* Ikon kun modifikatorer */
172
+ .button.button--small.button--icon-only,
173
+ .button.button--medium.button--icon-only,
174
+ .button.button--large.button--icon-only {
175
+ padding: 0;
176
+ color: var(--nve-icon-color, var(--_button-color));
177
+ &:hover {
178
+ color: var(--nve-icon-color-hover, var(--_button-color-hover));
179
+ }
180
+ &:active {
181
+ color: var(--nve-icon-color-pressed, var(--_button-color-pressed));
182
+ }
82
183
  }
83
184
 
84
- :host([size='small'])::part(label) {
85
- font: var(--typography-label-x-small);
185
+ .button--small.button--icon-only {
186
+ width: calc(var(--spacing-2x-small) * 2 + var(--_img-small-size));
86
187
  }
87
188
 
88
- /** check if has loading if yes apply changes to has-suffix class it shouldnt be fire if loading is not here */
89
-
90
- :host([loading]) .button--has-suffix.button--medium,
91
- :host([loading]) .button--has-suffix.button--large {
92
- padding-inline-end: var(--spacing-x-small);
189
+ .button--medium.button--icon-only {
190
+ width: calc(var(--spacing-x-small) * 2 + var(--_img-large-size));
93
191
  }
94
192
 
95
- :host([loading]) .button--has-suffix.button--small {
96
- padding-inline-end: 0.125rem;
193
+ .button--large.button--icon-only {
194
+ width: calc(var(--spacing-small) * 2 + var(--_img-large-size));
97
195
  }
98
196
 
99
- .button--has-suffix.button--medium {
100
- padding-inline-end: var(--spacing-medium, 1rem);
101
- }
102
- .button--has-suffix.button--large {
103
- padding-inline-end: var(--spacing-medium, 1rem);
197
+ /* Sirkulære knapper */
198
+ .button--medium.button--circle,
199
+ .button--large.button--circle,
200
+ .button--small.button--circle {
201
+ border-radius: var(--border-radius-circle);
104
202
  }
105
203
 
106
- :host::part(base) {
107
- gap: var(--spacing-x-small);
204
+ .button--medium.button--circle {
205
+ padding: var(--spacing-x-small);
108
206
  }
109
207
 
110
- .button--has-prefix.button--small {
111
- padding-inline-start: var(--spacing-x-small);
208
+ .button--large.button--circle {
209
+ padding: var(--spacing-small);
112
210
  }
113
211
 
114
- .button--has-prefix.button--large,
115
- .button--has-prefix.button--medium {
116
- padding-inline-start: var(--spacing-medium, 1rem);
212
+ .button--small.button--circle {
213
+ padding: var(--spacing-2x-small);
117
214
  }
118
215
 
119
- .button--has-label.button--large .button__label,
120
- .button--has-label.button--small .button__label,
121
- .button--has-label.button--medium .button__label {
122
- padding: unset;
123
- }
124
- .button:not(.button--has-label) .button__label {
125
- display: none;
216
+ /* Deaktivert */
217
+ .button--disabled {
218
+ cursor: not-allowed;
126
219
  }
127
220
 
128
- .button--small {
129
- height: var(--sizing-fixed-sizing-medium);
130
- min-height: unset;
131
- padding: 0px;
132
- }
133
- .button--large {
134
- height: var(--sizing-fixed-sizing-x-large);
135
- min-height: unset;
136
- padding: var(--spacing-medium, 1rem) calc(var(--spacing-medium, 1rem) - var(--spacing-x-small));
137
- }
138
- /* fjern gap forskjell på venstre og høyre */
139
- .button--medium {
140
- height: var(--sizing-fixed-sizing-large);
141
- min-height: unset;
142
- padding: var(--spacing-medium, 1rem) calc(var(--spacing-medium, 1rem) - var(--spacing-x-small));
221
+ .button--primary.button--disabled {
222
+ --_button-background: var(--color-interactive-background-primary-disabled);
223
+ --_button-color: var(--color-interactive-foreground-primary-disabled);
143
224
  }
144
225
 
145
- /* PRIMARY */
146
- :host([variant='primary']) .button--standard.button {
147
- background-color: var(--color-interactive-primary-background-default);
148
- color: var(--color-interactive-primary-foreground-default);
149
- border: none;
150
- }
151
- :host([variant='primary']) .button--standard.button:hover:not(.button--disabled),
152
- :host([variant='primary']) .button--standard.button:active:not(.button--disabled) {
153
- background: var(--color-interactive-primary-background-hover);
154
- color: var(--color-interactive-primary-foreground-default);
226
+ .button--secondary.button--disabled {
227
+ --_button-background: var(--color-interactive-background-secondary-disabled);
228
+ --_button-color: var(--color-interactive-foreground-secondary-disabled);
155
229
  }
156
230
 
157
- /* DEFAULT, aka SECONDARY */
158
- :host([variant='secondary']) .button--standard.button,
159
- :host([variant='default']) .button--standard.button {
160
- background: var(--color-interactive-secondary-background-default);
161
- color: var(--color-interactive-secondary-foreground-default);
162
- border: none;
163
- }
164
- :host([variant='secondary']) .button--standard.button:hover:not(.button--disabled),
165
- :host([variant='default']) .button--standard.button:hover:not(.button--disabled) {
166
- background: var(--color-interactive-secondary-background-hover);
167
- color: var(--color-interactive-secondary-foreground-hover);
231
+ .button--tertiary.button--disabled {
232
+ --_button-border-color: var(--color-interactive-border-secondary-disabled);
233
+ --_button-color: var(--color-interactive-foreground-secondary-disabled);
168
234
  }
169
235
 
170
- /* TEXT aka GHOST */
171
- :host([variant='text']) .button.button--standard,
172
- :host([variant='ghost']) .button.button--standard {
173
- color: var(--color-interactive-ghost-foreground-default);
174
- background-color: transparent;
175
- border-radius: var(--border-radius-small, 4px);
176
- border: none;
236
+ .button--ghost.button--disabled {
237
+ --_button-color: var(--color-interactive-foreground-secondary-disabled);
177
238
  }
178
239
 
179
- :host([variant='text'][circle]) .button.button--standard,
180
- :host([variant='ghost'][circle]) .button.button--standard {
181
- border-radius: 50%;
240
+ .button--danger.button--disabled {
241
+ --_button-background: var(--color-interactive-background-danger-disabled);
242
+ --_button-color: var(--color-interactive-foreground-danger-disabled);
182
243
  }
183
244
 
184
- :host([variant='text']) .button.button--standard:hover:not(.button--disabled),
185
- :host([variant='ghost']) .button.button--standard:hover:not(.button--disabled) {
186
- background-color: var(--color-interactive-ghost-background-hover);
187
- color: var(--color-interactive-ghost-foreground-hover);
245
+ /* Lastende */
246
+ .button--loading {
247
+ cursor: wait;
188
248
  }
189
249
 
190
- /* NEUTRAL, aka OUTLINE */
191
- :host([variant='neutral']) .button.button--standard,
192
- :host([variant='outline']) .button.button--standard,
193
- :host([outline]) .button.button {
194
- color: var(--color-interactive-outlined-foreground-default);
195
- border-color: var(--color-interactive-outlined-border-default);
196
- border-width: var(--border-width-default);
197
- border-style: solid;
198
- background-color: transparent;
199
- }
200
- :host([variant='neutral']) .button.button--standard:hover:not(.button--disabled),
201
- :host([variant='outline']) .button.button--standard:hover:not(.button--disabled),
202
- :host([outline]) .button.button:hover:not(.button--disabled) {
203
- border-color: var(--color-interactive-outlined-border-hover);
204
- color: var(--color-interactive-outlined-foreground-hover);
205
- border-width: var(--border-width-default);
206
- border-style: solid;
207
- background-color: transparent;
250
+ .button__spinner {
251
+ width: 20px;
252
+ height: 20px;
253
+ border: 2px solid var(--color-interactive-foreground-secondary-enabled);
254
+ border-color: var(--color-interactive-foreground-secondary-enabled) transparent transparent transparent;
255
+ border-radius: 50%;
256
+ animation: spin 0.8s linear infinite;
208
257
  }
209
258
 
210
- .button--loading .button__prefix,
211
- .button--loading .button__label,
212
- .button--loading .button__suffix,
213
- .button--loading .button__caret {
214
- visibility: unset;
259
+ @keyframes spin {
260
+ from {
261
+ transform: rotate(0deg);
262
+ }
263
+ to {
264
+ transform: rotate(360deg);
265
+ }
215
266
  }
216
267
 
217
- :host([has-icon-only][loading])::part(label) {
218
- display: none;
268
+ /*
269
+ * Badge
270
+ */
271
+ .button ::slotted(nve-badge) {
272
+ position: absolute;
273
+ top: 0;
274
+ right: 0;
275
+ translate: 50% -50%;
276
+ pointer-events: none;
219
277
  }
220
278
  `;
221
- export {
222
- a as default
223
- };
279
+ //#endregion
280
+ export { t as default };