nve-designsystem 3.13.0 → 3.14.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.
@@ -94,7 +94,7 @@ function u(e) {
94
94
  } });
95
95
  }
96
96
  //#endregion
97
- //#region \0@oxc-project+runtime@0.115.0/helpers/decorate.js
97
+ //#region \0@oxc-project+runtime@0.120.0/helpers/decorate.js
98
98
  function d(e, t, n, r) {
99
99
  var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
100
100
  if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
@@ -1,9 +1,11 @@
1
1
  //#region src/components/nve-icon/offline-icons.ts
2
2
  var e = {
3
+ arrow_forward: "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\" width=\"24px\" fill=\"#000000\"><path d=\"M647-440H160v-80h487L423-744l57-56 320 320-320 320-57-56 224-224Z\"/></svg>",
3
4
  check_circle: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 -960 960 960\" fill=\"#000000\"><path d=\"m424-296 282-282-56-56-226 226-114-114-56 56 170 170Zm56 216q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z\"/></svg>",
4
5
  chevron_backward: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 -960 960 960\" fill=\"#000000\"><path d=\"M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z\"/></svg>",
5
6
  chevron_forward: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 -960 960 960\" fill=\"#000000\"><path d=\"M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z\"/></svg>",
6
7
  close: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 -960 960 960\" fill=\"#000000\"><path d=\"m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z\"/></svg>",
8
+ download: "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\" width=\"24px\" fill=\"#000000\"><path d=\"M480-320 280-520l56-58 104 104v-326h80v326l104-104 56 58-200 200ZM160-160v-200h80v120h480v-120h80v200H160Z\"/></svg>",
7
9
  error: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 -960 960 960\" fill=\"#000000\"><path d=\"M480-280q17 0 28.5-11.5T520-320q0-17-11.5-28.5T480-360q-17 0-28.5 11.5T440-320q0 17 11.5 28.5T480-280Zm-40-160h80v-240h-80v240Zm40 360q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z\"/></svg>",
8
10
  info: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 -960 960 960\" fill=\"#000000\"><path d=\"M440-280h80v-240h-80v240Zm40-320q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm0 520q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z\"/></svg>",
9
11
  lock: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 -960 960 960\" fill=\"#000000\"><path d=\"M240-80q-33 0-56.5-23.5T160-160v-400q0-33 23.5-56.5T240-640h40v-80q0-83 58.5-141.5T480-920q83 0 141.5 58.5T680-720v80h40q33 0 56.5 23.5T800-560v400q0 33-23.5 56.5T720-80H240Zm0-80h480v-400H240v400Zm240-120q33 0 56.5-23.5T560-360q0-33-23.5-56.5T480-440q-33 0-56.5 23.5T400-360q0 33 23.5 56.5T480-280ZM360-640h240v-80q0-50-35-85t-85-35q-50 0-85 35t-35 85v80ZM240-160v-400 400Z\"/></svg>",
@@ -0,0 +1,52 @@
1
+ import { LitElement } from 'lit';
2
+ import { INveComponent } from '../../interfaces/NveComponent.interface';
3
+ /**
4
+ * Denne komponenten er ment å brukes som hovednavigasjon på sider, for eksempel transportside (i motsetning til `nve-link-card`, som er mindre og brukes der navigasjonen ikke er hovedfokus).
5
+ *
6
+ * Komponenten brukes i grid-oppsett, har minimum høyde, og støtter enten dekorativt ikon (angis via path) eller tilleggstekst (maks 3 linjer, trunkeres automatisk) – aldri begge samtidig.
7
+ *
8
+ * Ikon angis med `iconPath`-prop og rendres automatisk med aria-hidden. Bruk kun illustrasjonsikoner fra NVE.
9
+ *
10
+ * @csspart navigation-card Topp-elementet for kortet
11
+ * @csspart label Overskriften på kortet
12
+ * @csspart leading-icon Ikonet øverst i kortet
13
+ * @csspart content Innholdet i kortet
14
+ * @csspart additional-text Ekstra tekst under overskriften
15
+ */
16
+ export default class NveNavigationCard extends LitElement implements INveComponent {
17
+ /** Test ID som kan brukes i testing og sporing */
18
+ testId: string | undefined;
19
+ /** Tittel som vises øverst på kortet (må settes) */
20
+ label: string;
21
+ /**
22
+ * Lenke for navigasjon (må settes for at kortet skal være klikkbart).
23
+ * Hvis du bruker komponenten uten å wrappe den i et rammeverks-router-element (f.eks. Vue Router eller React Router), må `href` settes.
24
+ */
25
+ href: string;
26
+ /** Ekstratekst som vises under tittelen (maks 3 linjer, trunkeres) */
27
+ additionalText: string | undefined;
28
+ /** Definerer hva som skjer når kortet klikkes: 'internal' (intern lenke), 'download' (nedlasting), 'external' (ekstern lenke) */
29
+ clickAction: 'internal' | 'download' | 'external';
30
+ /** Path til ikon som vises øverst i kortet (dekorativt) */
31
+ iconPath: string | undefined;
32
+ static styles: import('lit').CSSResult[];
33
+ /**
34
+ * Returnerer ikonnavnet som vises på kortet basert på clickAction.
35
+ */
36
+ private getIconName;
37
+ /**
38
+ * Genererer innholdet i kortet.
39
+ * Viser ikon (hvis iconPath), tittel og ev. additionalText.
40
+ */
41
+ private renderContent;
42
+ /**
43
+ * Rendrer kortet som <a> hvis ikke parent er en lenke,
44
+ * ellers som <div> for å unngå nestede lenker (SPA-routing).
45
+ */
46
+ render(): import('lit-html').TemplateResult<1>;
47
+ }
48
+ declare global {
49
+ interface HTMLElementTagNameMap {
50
+ 'nve-navigation-card': NveNavigationCard;
51
+ }
52
+ }
@@ -0,0 +1,62 @@
1
+ import { n as e, s as t, t as n } from "../../chunks/lit.js";
2
+ import { o as r, s as i, t as a } from "../../chunks/decorate.js";
3
+ import "../../chunks/class-map.js";
4
+ import { t as o } from "../../chunks/if-defined.js";
5
+ import "../../chunks/unsafe-html.js";
6
+ import "../nve-icon/nve-icon.component.js";
7
+ import s from "./nve-navigation-card.styles.js";
8
+ //#region src/components/nve-navigation-card/nve-navigation-card.component.ts
9
+ var c = class extends n {
10
+ constructor(...e) {
11
+ super(...e), this.testId = void 0, this.label = "", this.href = "", this.additionalText = void 0, this.clickAction = "internal", this.iconPath = void 0;
12
+ }
13
+ static {
14
+ this.styles = [s];
15
+ }
16
+ getIconName() {
17
+ switch (this.clickAction) {
18
+ case "internal": return "arrow_forward";
19
+ case "download": return "download";
20
+ case "external": return "open_in_new";
21
+ default: return "arrow_forward";
22
+ }
23
+ }
24
+ renderContent() {
25
+ return t`
26
+ <div part="content" class="navigation-card__content">
27
+ ${this.iconPath ? t`<img
28
+ part="leading-icon"
29
+ src="${this.iconPath}"
30
+ alt=""
31
+ aria-hidden="true"
32
+ class="navigation-card__icon"
33
+ />` : e}
34
+ <h2 part="label" class="navigation-card__label">${this.label}</h2>
35
+ ${!this.iconPath && this.additionalText ? t`<p part="additional-text" class="navigation-card__additional-text">${this.additionalText}</p>` : e}
36
+ </div>
37
+ <nve-icon aria-hidden="true" name="${this.getIconName()}" class="navigation-card__arrow" />
38
+ `;
39
+ }
40
+ render() {
41
+ return this.parentElement?.tagName.toLowerCase() === "a" || this.parentElement?.getAttribute("role") === "link" ? t`
42
+ <div part="navigation-card" class="navigation-card" testid=${o(this.testId)}>
43
+ ${this.renderContent()}
44
+ </div>
45
+ ` : t`
46
+ <a
47
+ testid=${o(this.testId)}
48
+ ?download=${this.clickAction === "download"}
49
+ part="navigation-card"
50
+ class="navigation-card"
51
+ href="${o(this.href)}"
52
+ target=${this.clickAction === "external" ? "_blank" : e}
53
+ >
54
+ ${this.renderContent()}
55
+ </a>
56
+ `;
57
+ }
58
+ };
59
+ a([r({ type: String })], c.prototype, "testId", void 0), a([r({ type: String })], c.prototype, "label", void 0), a([r({ type: String })], c.prototype, "href", void 0), a([r({ type: String })], c.prototype, "additionalText", void 0), a([r({ type: String })], c.prototype, "clickAction", void 0), a([r({ type: String })], c.prototype, "iconPath", void 0), c = a([i("nve-navigation-card")], c);
60
+ var l = c;
61
+ //#endregion
62
+ export { l as default };
@@ -0,0 +1,2 @@
1
+ declare const _default: import('lit').CSSResult;
2
+ export default _default;
@@ -0,0 +1,111 @@
1
+ import { u as e } from "../../chunks/lit.js";
2
+ //#region src/components/nve-navigation-card/nve-navigation-card.styles.ts
3
+ var t = e`
4
+ :host {
5
+ --nav-card-arrow-transition:
6
+ margin-left 0.3s cubic-bezier(0, 0, 0.2, 1), margin-right 0.3s cubic-bezier(0, 0, 0.2, 1);
7
+ --nav-card-arrow-transition-fast:
8
+ margin-left 0.3s cubic-bezier(0, 0, 0.2, 1), margin-right 0.3s cubic-bezier(0, 0, 0.2, 1);
9
+ display: flex;
10
+ height: 100%;
11
+ }
12
+
13
+ .navigation-card {
14
+ display: flex;
15
+ flex-direction: row;
16
+ justify-content: space-between;
17
+ align-items: center;
18
+ box-sizing: border-box;
19
+ width: 100%;
20
+ min-height: var(--sizing-card-link-card-height-x-large-min-height);
21
+ padding: var(--spacing-2x-large);
22
+ gap: var(--spacing-medium);
23
+ border-radius: var(--border-radius-small);
24
+ border: var(--border-width-stronger) solid transparent;
25
+ background: var(--color-neutrals-background-primary);
26
+ cursor: pointer;
27
+ text-decoration: none;
28
+ transition: border-color 0.3s ease;
29
+ }
30
+
31
+ .navigation-card:hover {
32
+ border-color: var(--color-neutrals-border-subtle);
33
+ }
34
+
35
+ .navigation-card:active {
36
+ border-color: var(--color-neutrals-border-mute);
37
+ }
38
+
39
+ .navigation-card:focus-visible {
40
+ outline: var(--color-interactive-primary-border-focus) solid 2px;
41
+ }
42
+
43
+ .navigation-card__content {
44
+ display: flex;
45
+ flex-direction: column;
46
+ gap: var(--spacing-medium);
47
+ align-items: flex-start;
48
+ align-self: stretch;
49
+ }
50
+
51
+ .navigation-card__icon {
52
+ width: var(--sizing-icon-3x-large);
53
+ height: var(--sizing-icon-3x-large);
54
+ }
55
+
56
+ .navigation-card__label {
57
+ font: var(--typography-heading-small);
58
+ color: var(--color-neutrals-foreground-primary);
59
+ transition: color 0.3s ease;
60
+ margin: 0;
61
+ }
62
+
63
+ .navigation-card:hover .navigation-card__label {
64
+ color: var(--color-brand-foreground-primary);
65
+ text-decoration-line: underline;
66
+ text-decoration-style: solid;
67
+ text-decoration-thickness: 5%;
68
+ text-underline-offset: 16%;
69
+ }
70
+
71
+ .navigation-card:active .navigation-card__label {
72
+ text-decoration-thickness: 10%;
73
+ text-underline-offset: 16%;
74
+ }
75
+
76
+ .navigation-card__additional-text {
77
+ font: var(--typography-body-compact-medium-compact);
78
+ color: var(--color-neutrals-foreground-subtle);
79
+ overflow: hidden;
80
+ display: -webkit-box;
81
+ -webkit-line-clamp: 3;
82
+ -webkit-box-orient: vertical;
83
+ text-overflow: ellipsis;
84
+ margin: 0;
85
+ }
86
+
87
+ .navigation-card__arrow {
88
+ flex-shrink: 0;
89
+ color: var(--color-brand-foreground-primary);
90
+ margin-right: var(--spacing-x-small);
91
+ transition: var(--nav-card-arrow-transition);
92
+ }
93
+
94
+ .navigation-card:hover .navigation-card__arrow {
95
+ margin-left: var(--spacing-2x-small);
96
+ margin-right: var(--spacing-2x-small);
97
+ transition: var(--nav-card-arrow-transition-fast);
98
+ }
99
+
100
+ .navigation-card:active .navigation-card__arrow {
101
+ margin-left: var(--spacing-x-small);
102
+ margin-right: 0;
103
+ transition: var(--nav-card-arrow-transition-fast);
104
+ }
105
+
106
+ nve-icon {
107
+ --icon-size: 24px;
108
+ }
109
+ `;
110
+ //#endregion
111
+ export { t as default };
package/css/global.css CHANGED
@@ -17,8 +17,9 @@ a {
17
17
  color: var(--color-neutrals-foreground-primary, #0d0d0e);
18
18
  }
19
19
 
20
- /* Brukes for å fjerne standard linje i <a> som ikke er i Shadow-DOMen som f.eks de som skal wrappe <nve-link-card> */
21
- a:has(nve-link-card) {
20
+ /* Brukes for å fjerne standard linje i <a> som ikke er i Shadow-DOMen som f.eks de som skal wrappe <nve-link-card> og <nve-navigation-card> */
21
+ a:has(nve-link-card),
22
+ a:has(nve-navigation-card) {
22
23
  text-decoration: unset;
23
24
  }
24
25