nve-designsystem 0.1.51 → 0.1.54

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.
@@ -1,11 +1,12 @@
1
1
  import { LitElement } from 'lit';
2
2
  /**
3
3
  * Et ikon.
4
- * Vi bruker ikoner fra Material Symbols.
4
+ * Vi bruker ikoner fra Material Symbols. Man kan bruke både 'Sharp' og 'Outlined' ikoner.
5
5
  * @see https://fonts.google.com/icons
6
6
  */
7
7
  export default class NveIcon extends LitElement {
8
8
  static styles: import("lit").CSSResult[];
9
+ /** Bestemmer om man skal bruke 'sharp' eller 'outlined' ikoner */
9
10
  library: 'Outlined' | 'Sharp';
10
11
  /** Navnet på ikonet i Material Symbols-biblioteket */
11
12
  name: string;
@@ -1,31 +1,35 @@
1
- import { s as f, x as m } from "../../chunks/lit-element.js";
2
- import { n as i, t as y } from "../../chunks/property.js";
3
- import u from "./nve-icon.styles.js";
4
- var c = Object.defineProperty, v = Object.getOwnPropertyDescriptor, a = (l, t, n, s) => {
5
- for (var r = s > 1 ? void 0 : s ? v(t, n) : t, o = l.length - 1, p; o >= 0; o--)
6
- (p = l[o]) && (r = (s ? p(t, n, r) : p(r)) || r);
7
- return s && r && c(t, n, r), r;
1
+ import { s as m, x as c } from "../../chunks/lit-element.js";
2
+ import { n as p, t as y } from "../../chunks/property.js";
3
+ import f from "./nve-icon.styles.js";
4
+ var h = Object.defineProperty, d = Object.getOwnPropertyDescriptor, n = (e, s, i, o) => {
5
+ for (var t = o > 1 ? void 0 : o ? d(s, i) : s, a = e.length - 1, l; a >= 0; a--)
6
+ (l = e[a]) && (t = (o ? l(s, i, t) : l(t)) || t);
7
+ return o && t && h(s, i, t), t;
8
8
  };
9
- let e = class extends f {
9
+ let r = class extends m {
10
10
  constructor() {
11
11
  super(...arguments), this.library = "Outlined", this.name = "";
12
12
  }
13
13
  firstUpdated() {
14
+ if (!document.getElementById(`material-icons-${this.library.toLowerCase()}`)) {
15
+ const e = document.createElement("link");
16
+ e.id = `material-icons-${this.library.toLowerCase()}`, e.rel = "stylesheet", e.href = `https://fonts.googleapis.com/css2?family=Material+Symbols+${this.library}:opsz,wght,FILL,GRAD@24,400,0,0`, document.head.appendChild(e);
17
+ }
14
18
  }
15
19
  render() {
16
- return m`<span style="font-family:Material Symbols ${this.library}">${this.name}</span>`;
20
+ return c`<span part="icon" style="font-family:Material Symbols ${this.library}">${this.name}</span>`;
17
21
  }
18
22
  };
19
- e.styles = [u];
20
- a([
21
- i({ type: String })
22
- ], e.prototype, "library", 2);
23
- a([
24
- i({ reflect: !0 })
25
- ], e.prototype, "name", 2);
26
- e = a([
23
+ r.styles = [f];
24
+ n([
25
+ p({ type: String })
26
+ ], r.prototype, "library", 2);
27
+ n([
28
+ p({ reflect: !0 })
29
+ ], r.prototype, "name", 2);
30
+ r = n([
27
31
  y("nve-icon")
28
- ], e);
32
+ ], r);
29
33
  export {
30
- e as default
34
+ r as default
31
35
  };
@@ -1,25 +1,24 @@
1
1
  import { i as e } from "../../chunks/lit-element.js";
2
2
  const o = e`
3
-
4
3
  /* Brukes i dropdown. Eneste måten å override shadow dom for å rotere expand_more ikonet når menyen åpner */
5
4
  :host([name='expand_more']) {
6
5
  transform: var(--icon-rotation, none);
7
6
  transition: transform 0.3s ease;
8
7
  }
9
8
 
10
- /* prevent icon beeing highlighted */
9
+ /* prevent icon beeing highlighted */
11
10
  :host {
12
- -webkit-touch-callout: none; /* iOS Safari */
11
+ -webkit-touch-callout: none; /* iOS Safari */
13
12
  -webkit-user-select: none; /* Safari */
14
- -khtml-user-select: none; /* Konqueror HTML */
15
- -moz-user-select: none; /* Old versions of Firefox */
16
- -ms-user-select: none; /* Internet Explorer/Edge */
17
- user-select: none; /* Non-prefixed version, currently
13
+ -khtml-user-select: none; /* Konqueror HTML */
14
+ -moz-user-select: none; /* Old versions of Firefox */
15
+ -ms-user-select: none; /* Internet Explorer/Edge */
16
+ user-select: none; /* Non-prefixed version, currently
18
17
  supported by Chrome, Edge, Opera and Firefox */
19
- }
20
- :host {
18
+ }
19
+ :host {
21
20
  display: flex;
22
- }
21
+ }
23
22
 
24
23
  /* we need it to center the icon */
25
24
  :is(span) {
@@ -1,4 +1,4 @@
1
- import { LitElement } from "lit";
1
+ import { LitElement } from 'lit';
2
2
  export declare enum StepState {
3
3
  NotStarted = 0,
4
4
  Started = 1,
@@ -6,7 +6,6 @@ export declare enum StepState {
6
6
  Error = 3
7
7
  }
8
8
  export interface StepProps {
9
- icons: string[];
10
9
  title: string;
11
10
  description: string;
12
11
  state: StepState;
@@ -14,16 +13,37 @@ export interface StepProps {
14
13
  readyForEntrance: boolean;
15
14
  }
16
15
  export default class NveStep extends LitElement {
17
- icons: string[];
18
16
  title: string;
17
+ /**
18
+ * Avstand mellom steppene
19
+ */
19
20
  spaceBetweenSteps: number;
21
+ /**
22
+ * Hvilken ikonbibliotek som skal brukes, Sharp eller Outlined.
23
+ */
20
24
  iconLibrary: 'Outlined' | 'Sharp';
25
+ /**
26
+ * Stegets index
27
+ */
21
28
  index: number;
22
29
  description: string;
30
+ /**
31
+ * Er steget besøkt, ikke besøkt, fullført eller feilet
32
+ * @type {StepState}
33
+ */
23
34
  state: StepState;
24
- stepperIndex: number;
35
+ selectedStepIndex: number;
36
+ /**
37
+ * Er steget valgt
38
+ */
25
39
  isSelected: boolean;
40
+ /**
41
+ * Er steget det siste i rekken
42
+ */
26
43
  isLast: boolean;
44
+ /**
45
+ * Er det lov å gå inn i steget, alle krav er oppfylt
46
+ */
27
47
  entraceAllowed: boolean;
28
48
  static styles: import("lit").CSSResult[];
29
49
  iconForState(state: StepState): string;
@@ -32,6 +52,6 @@ export default class NveStep extends LitElement {
32
52
  }
33
53
  declare global {
34
54
  interface HTMLElementTagNameMap {
35
- "nve-step": NveStep;
55
+ 'nve-step': NveStep;
36
56
  }
37
57
  }
@@ -1,56 +1,54 @@
1
1
  import { s as d, x as l } from "../../../chunks/lit-element.js";
2
- import { n as i, t as h } from "../../../chunks/property.js";
2
+ import { n as r, t as h } from "../../../chunks/property.js";
3
3
  import y from "./nve-step.styles.js";
4
- var v = Object.defineProperty, u = Object.getOwnPropertyDescriptor, r = (e, s, p, n) => {
5
- for (var o = n > 1 ? void 0 : n ? u(s, p) : s, a = e.length - 1, c; a >= 0; a--)
6
- (c = e[a]) && (o = (n ? c(s, p, o) : c(o)) || o);
7
- return n && o && v(s, p, o), o;
4
+ var v = Object.defineProperty, u = Object.getOwnPropertyDescriptor, i = (e, t, c, n) => {
5
+ for (var o = n > 1 ? void 0 : n ? u(t, c) : t, a = e.length - 1, p; a >= 0; a--)
6
+ (p = e[a]) && (o = (n ? p(t, c, o) : p(o)) || o);
7
+ return n && o && v(t, c, o), o;
8
8
  }, f = /* @__PURE__ */ ((e) => (e[e.NotStarted = 0] = "NotStarted", e[e.Started = 1] = "Started", e[e.Done = 2] = "Done", e[e.Error = 3] = "Error", e))(f || {});
9
- let t = class extends d {
9
+ let s = class extends d {
10
10
  constructor() {
11
- super(...arguments), this.icons = [], this.title = "", this.spaceBetweenSteps = 200, this.iconLibrary = "Outlined", this.index = 0, this.description = "", this.state = 0, this.stepperIndex = 0, this.isSelected = !1, this.isLast = !1, this.entraceAllowed = !1;
11
+ super(...arguments), this.title = "", this.spaceBetweenSteps = 200, this.iconLibrary = "Outlined", this.index = 0, this.description = "", this.state = 0, this.selectedStepIndex = 0, this.isSelected = !1, this.isLast = !1, this.entraceAllowed = !1;
12
12
  }
13
13
  iconForState(e) {
14
- let s = "";
14
+ let t = "";
15
15
  switch (e) {
16
16
  case 0:
17
- s = `counter_${this.index + 1}`;
17
+ t = `counter_${this.index + 1}`;
18
18
  break;
19
19
  case 1:
20
- this.isSelected ? s = `counter_${this.index + 1}` : s = "error";
20
+ this.isSelected ? t = `counter_${this.index + 1}` : t = "error";
21
21
  break;
22
22
  case 2:
23
- s = "check_circle";
23
+ this.isSelected ? t = `counter_${this.index + 1}` : t = "check_circle";
24
24
  break;
25
25
  case 3:
26
- s = "error";
26
+ t = "error";
27
27
  break;
28
28
  default:
29
- s = `help_${this.iconLibrary}`;
29
+ t = `help_${this.iconLibrary}`;
30
30
  break;
31
31
  }
32
- return s;
32
+ return t;
33
33
  }
34
34
  onClick() {
35
- this.dispatchEvent(
36
- new CustomEvent("clicked", { detail: { index: this.index } })
37
- );
35
+ this.dispatchEvent(new CustomEvent("clicked", { detail: { index: this.index } }));
38
36
  }
39
37
  render() {
40
38
  return l`
41
39
  <div class="step">
42
- <div class="step-figure">
43
- <span
44
- @click="${this.onClick}"
45
- class="${this.isSelected ? "selected" : ""} ${this.state == 3 ? "hasError" : ""} ${this.state > 0 ? "" : "notStarted"}"
46
- >
47
- <nve-icon library=${this.iconLibrary} slot="suffix" name="${this.iconForState(this.state)}"></nve-icon>
48
- </span>
49
-
50
- ${this.isLast ? "" : l`<div
51
- style="width:${this.spaceBetweenSteps}px"
52
- class="divider-horizontal ${this.index < this.stepperIndex ? "selectedInterval" : ""} ${this.state > 0 ? "" : "notStarted"}"
53
- ></div>`}
40
+ <div class="step-figure">
41
+ <span
42
+ @click="${this.onClick}"
43
+ class="${this.index <= this.selectedStepIndex ? "reached" : ""} ${this.state == 3 ? "hasError" : ""} ${this.state > 0 ? "" : "notStarted"}"
44
+ >
45
+ <nve-icon library=${this.iconLibrary} slot="suffix" name="${this.iconForState(this.state)}"></nve-icon>
46
+ </span>
47
+
48
+ ${this.isLast ? "" : l`<div
49
+ style="width:${this.spaceBetweenSteps}px"
50
+ class="divider-horizontal ${this.index < this.selectedStepIndex ? "selectedInterval" : ""} ${this.state > 0 ? "" : "notStarted"}"
51
+ ></div>`}
54
52
  </div>
55
53
  <div class="step-title">${this.title}</div>
56
54
  <div class="step-description">${this.description}</div>
@@ -58,44 +56,41 @@ let t = class extends d {
58
56
  `;
59
57
  }
60
58
  };
61
- t.styles = [y];
62
- r([
63
- i({ type: Array })
64
- ], t.prototype, "icons", 2);
65
- r([
66
- i({ reflect: !0 })
67
- ], t.prototype, "title", 2);
68
- r([
69
- i({ type: Number })
70
- ], t.prototype, "spaceBetweenSteps", 2);
71
- r([
72
- i({ type: String })
73
- ], t.prototype, "iconLibrary", 2);
74
- r([
75
- i({ type: Number })
76
- ], t.prototype, "index", 2);
77
- r([
78
- i({ type: String })
79
- ], t.prototype, "description", 2);
80
- r([
81
- i({ type: Number })
82
- ], t.prototype, "state", 2);
83
- r([
84
- i({ type: Number })
85
- ], t.prototype, "stepperIndex", 2);
86
- r([
87
- i({ type: Boolean, reflect: !0 })
88
- ], t.prototype, "isSelected", 2);
89
- r([
90
- i({ type: Boolean })
91
- ], t.prototype, "isLast", 2);
92
- r([
93
- i({ type: Boolean })
94
- ], t.prototype, "entraceAllowed", 2);
95
- t = r([
59
+ s.styles = [y];
60
+ i([
61
+ r({ reflect: !0 })
62
+ ], s.prototype, "title", 2);
63
+ i([
64
+ r({ type: Number })
65
+ ], s.prototype, "spaceBetweenSteps", 2);
66
+ i([
67
+ r({ type: String })
68
+ ], s.prototype, "iconLibrary", 2);
69
+ i([
70
+ r({ type: Number })
71
+ ], s.prototype, "index", 2);
72
+ i([
73
+ r({ type: String })
74
+ ], s.prototype, "description", 2);
75
+ i([
76
+ r({ type: Number })
77
+ ], s.prototype, "state", 2);
78
+ i([
79
+ r({ type: Number })
80
+ ], s.prototype, "selectedStepIndex", 2);
81
+ i([
82
+ r({ type: Boolean, reflect: !0 })
83
+ ], s.prototype, "isSelected", 2);
84
+ i([
85
+ r({ type: Boolean })
86
+ ], s.prototype, "isLast", 2);
87
+ i([
88
+ r({ type: Boolean })
89
+ ], s.prototype, "entraceAllowed", 2);
90
+ s = i([
96
91
  h("nve-step")
97
- ], t);
92
+ ], s);
98
93
  export {
99
94
  f as StepState,
100
- t as default
95
+ s as default
101
96
  };
@@ -1,64 +1,66 @@
1
1
  import { i as t } from "../../../chunks/lit-element.js";
2
2
  const o = t`
3
- .step-figure {
4
- position: relative;
5
- display: flex;
6
- align-items: center;
7
-
8
- }
3
+ .step-figure {
4
+ position: relative;
5
+ display: flex;
6
+ align-items: center;
7
+ }
9
8
 
10
- .divider-horizontal {
11
- height: 2px;
12
- background-color: black;
13
- flex-grow: 1;
14
- }
9
+ .divider-horizontal {
10
+ height: 2px;
11
+ background-color: black;
12
+ flex-grow: 1;
13
+ }
15
14
 
16
- .step-title{
17
- font-size: 16px;
18
- font-weight:bold;
19
- padding-top:4px
20
- }
21
- .step-description{
22
- font-size: 14px;
23
- font-weight:bold;
24
- padding-top:4px
25
- }
15
+ .step-title {
16
+ font-size: 16px;
17
+ font-weight: bold;
18
+ padding-top: 4px;
19
+ }
20
+ .step-description {
21
+ font-size: 14px;
22
+ font-weight: bold;
23
+ padding-top: 4px;
24
+ }
26
25
 
27
- .selectedInterval {
28
- height: 4px;
29
- }
26
+ .selectedInterval {
27
+ height: 4px;
28
+ }
30
29
 
31
- .selected {
32
- font-variation-settings: "FILL" 1, "wght" 300, "GRAD" 1, "opsz" 48 !important;
33
- }
30
+ .reached {
31
+ font-variation-settings:
32
+ 'FILL' 1,
33
+ 'wght' 300,
34
+ 'GRAD' 1,
35
+ 'opsz' 48 !important;
36
+ }
34
37
 
35
- .hasError {
36
- color: red;
37
- }
38
+ .hasError {
39
+ color: red;
40
+ }
38
41
 
39
- .notStarted {
40
- color: rgb(184, 184, 184);
41
- }
42
+ .notStarted {
43
+ color: rgb(184, 184, 184);
44
+ }
42
45
 
43
- .evaluated {
44
- background-color: rgb(184, 184, 184);
45
- }
46
+ .evaluated {
47
+ background-color: rgb(184, 184, 184);
48
+ }
46
49
 
47
- span {
48
- cursor: pointer;
49
- font-size:2rem;
50
- display:flex;
51
- }
52
-
53
- .material-symbols-sharp {
54
- font-size: 2rem;
55
- font-variation-settings:
56
- 'FILL' 0,
57
- 'wght' 300,
58
- 'GRAD' 0,
59
- 'opsz' 24
60
- }
50
+ span {
51
+ cursor: pointer;
52
+ font-size: 2rem;
53
+ display: flex;
54
+ }
61
55
 
56
+ .material-symbols-sharp {
57
+ font-size: 2rem;
58
+ font-variation-settings:
59
+ 'FILL' 0,
60
+ 'wght' 300,
61
+ 'GRAD' 0,
62
+ 'opsz' 24;
63
+ }
62
64
  `;
63
65
  export {
64
66
  o as default
@@ -2,18 +2,49 @@ import { LitElement } from 'lit';
2
2
  import { StepProps } from './nve-step/nve-step.component';
3
3
  export default class NveStepper extends LitElement {
4
4
  static styles: import("lit").CSSResult[];
5
+ /**
6
+ * Hvilken retning steppene skal gå. TODO: implementer vertical
7
+ */
5
8
  orientation: 'horizontal' | 'vertical';
6
- selectedStep: number;
9
+ /**
10
+ * Indeks for valgt steg, gir mulighet for å styre hvilket steg som er valgt.
11
+ */
12
+ selectedStepIndex: {
13
+ value: number;
14
+ };
15
+ /**
16
+ * Avstand mellom steppene
17
+ */
7
18
  spaceBetweenSteps: number;
19
+ /**
20
+ * Hvilken ikonbibliotek som skal brukes, Sharp eller Outlined.
21
+ */
8
22
  iconLibrary: 'Outlined' | 'Sharp';
23
+ /**
24
+ * Mulighet om å endre teksten på knapp ved siste steg,
25
+ * default er disabled neste.
26
+ */
27
+ optionalEndButton: string;
28
+ /**
29
+ * Steppene som skal vises, se StepProps interface for data som skal sendes inn.
30
+ */
9
31
  steps: StepProps[];
10
- stepWidth: number;
32
+ /**
33
+ * Ved endring av props, re-render komponenten eksternt med document.querySelector("nve-stepper")?.reRender();
34
+ * Ellers vil man ikke se endringene før intern state endres.
35
+ */
36
+ reRender(): void;
11
37
  firstUpdated(): void;
12
38
  nextStep(): void;
13
39
  prevStep(): void;
14
40
  selectStep(event: any): void;
15
41
  setStep(index: number): void;
42
+ /**
43
+ * Sjekker om vi er på start eller slutten av steppene
44
+ * @returns 'start', 'end' eller undefined
45
+ */
16
46
  getExtremes(): "start" | "end" | undefined;
47
+ onComplete(): void;
17
48
  render(): import("lit-html").TemplateResult<1>;
18
49
  }
19
50
  declare global {
@@ -22,7 +53,9 @@ declare global {
22
53
  }
23
54
  }
24
55
  export interface StepperProps {
25
- selectedStep: number;
56
+ selectedStepIndex: {
57
+ value: number;
58
+ };
26
59
  steps: StepProps[];
27
60
  spaceBetweenSteps: number;
28
61
  }
@@ -1,59 +1,78 @@
1
- import { s as d, x as l } from "../../chunks/lit-element.js";
2
- import { n as p, t as S } from "../../chunks/property.js";
3
- import { StepState as h } from "./nve-step/nve-step.component.js";
4
- import f from "./nve-stepper.styles.js";
1
+ import { s as c, x as h } from "../../chunks/lit-element.js";
2
+ import { n as r, t as v } from "../../chunks/property.js";
3
+ import { StepState as l } from "./nve-step/nve-step.component.js";
4
+ import u from "./nve-stepper.styles.js";
5
5
  import "./nve-step/nve-step.styles.js";
6
- var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, r = (e, t, o, n) => {
7
- for (var i = n > 1 ? void 0 : n ? y(t, o) : t, a = e.length - 1, c; a >= 0; a--)
8
- (c = e[a]) && (i = (n ? c(t, o, i) : c(i)) || i);
9
- return n && i && v(t, o, i), i;
6
+ var S = Object.defineProperty, y = Object.getOwnPropertyDescriptor, n = (e, t, o, p) => {
7
+ for (var i = p > 1 ? void 0 : p ? y(t, o) : t, a = e.length - 1, d; a >= 0; a--)
8
+ (d = e[a]) && (i = (p ? d(t, o, i) : d(i)) || i);
9
+ return p && i && S(t, o, i), i;
10
10
  };
11
- let s = class extends d {
11
+ let s = class extends c {
12
12
  constructor() {
13
- super(...arguments), this.orientation = "horizontal", this.spaceBetweenSteps = 200, this.iconLibrary = "Outlined", this.steps = new Array(), this.stepWidth = 100;
13
+ super(...arguments), this.orientation = "horizontal", this.selectedStepIndex = { value: 0 }, this.spaceBetweenSteps = 200, this.iconLibrary = "Outlined", this.optionalEndButton = "", this.steps = new Array();
14
+ }
15
+ /**
16
+ * Ved endring av props, re-render komponenten eksternt med document.querySelector("nve-stepper")?.reRender();
17
+ * Ellers vil man ikke se endringene før intern state endres.
18
+ */
19
+ reRender() {
20
+ this.requestUpdate();
14
21
  }
15
22
  firstUpdated() {
16
- this.setStep(this.selectedStep);
23
+ this.setStep(this.selectedStepIndex.value);
17
24
  }
18
25
  nextStep() {
19
- this.selectedStep < this.steps.length - 1 && this.setStep(this.selectedStep + 1);
26
+ this.selectedStepIndex.value < this.steps.length - 1 && this.setStep(this.selectedStepIndex.value + 1);
20
27
  }
21
28
  prevStep() {
22
- this.selectedStep > 0 && this.setStep(this.selectedStep - 1);
29
+ this.selectedStepIndex.value > 0 && this.setStep(this.selectedStepIndex.value - 1);
23
30
  }
24
31
  selectStep(e) {
25
- e.detail.index > 0 && this.steps[e.detail.index - 1].state == h.NotStarted || this.setStep(e.detail.index);
32
+ e.detail.index > 0 && this.steps[e.detail.index - 1].state == l.NotStarted || this.setStep(e.detail.index);
26
33
  }
27
34
  setStep(e) {
28
35
  if (this.steps[e].readyForEntrance) {
29
- this.selectedStep = e;
36
+ this.selectedStepIndex.value = e;
30
37
  for (let t = 0; t < this.steps.length; t++)
31
- this.steps[t].isSelected = t === e, t <= e && this.steps[t].state < h.Done && (this.steps[t].state = h.Started), this.steps = [...this.steps];
38
+ this.steps[t].isSelected = t === e, t <= e && this.steps[t].state !== l.Done && (this.steps[t].state = l.Started), this.steps = [...this.steps];
32
39
  }
33
40
  }
41
+ /**
42
+ * Sjekker om vi er på start eller slutten av steppene
43
+ * @returns 'start', 'end' eller undefined
44
+ */
34
45
  getExtremes() {
35
- if (this.selectedStep === 0)
46
+ if (this.selectedStepIndex.value === 0)
36
47
  return "start";
37
- if (this.selectedStep === this.steps.length - 1)
48
+ if (this.selectedStepIndex.value === this.steps.length - 1)
38
49
  return "end";
39
50
  }
51
+ onComplete() {
52
+ this.dispatchEvent(new CustomEvent("complete", { bubbles: !0 }));
53
+ }
40
54
  render() {
41
- return l`
55
+ return h`
42
56
  <div class="stepper ${this.orientation}">
43
- <nve-button .disabled=${this.getExtremes() === "start"} size="medium" variant="primary" @click=${this.prevStep}
44
- ><nve-icon slot="prefix" name="navigate_before" library="${this.iconLibrary}"></nve-icon>Forrige</nve-button
45
- >
57
+ <div style="width: 120px">
58
+ <nve-button
59
+ .disabled=${this.getExtremes() === "start"}
60
+ size="medium"
61
+ variant="primary"
62
+ @click=${this.prevStep}
63
+ ><nve-icon slot="prefix" name="navigate_before" library="${this.iconLibrary}"></nve-icon>Forrige</nve-button
64
+ >
65
+ </div>
46
66
  <div class="flex-container">
47
67
  ${this.steps.map(
48
- (e, t) => l`
68
+ (e, t) => h`
49
69
  <nve-step
50
70
  @clicked=${this.selectStep}
51
71
  .iconLibrary=${this.iconLibrary}
52
- .icons=${e.icons}
53
72
  .title=${e.title}
54
73
  .description=${e.description}
55
74
  .state=${e.state}
56
- .stepperIndex=${this.selectedStep}
75
+ .selectedStepIndex=${this.selectedStepIndex.value}
57
76
  .isSelected=${e.isSelected}
58
77
  .isLast=${t === this.steps.length - 1}
59
78
  .index=${t}
@@ -65,31 +84,42 @@ let s = class extends d {
65
84
  `
66
85
  )}
67
86
  </div>
68
- <nve-button .disabled=${this.getExtremes() === "end"} size="medium" variant="primary" @click=${this.nextStep}>
69
- <nve-icon slot="suffix" name="navigate_next" library="${this.iconLibrary}"></nve-icon>Neste</nve-button
70
- >
87
+ <div style="width: 120px">
88
+ <nve-button
89
+ .disabled=${this.getExtremes() === "end" && this.optionalEndButton === ""}
90
+ size="medium"
91
+ variant="primary"
92
+ @click=${this.getExtremes() === "end" && this.optionalEndButton !== "" ? this.onComplete : this.nextStep}
93
+ >
94
+ <nve-icon slot="suffix" name="navigate_next" library="${this.iconLibrary}"></nve-icon>
95
+ ${this.getExtremes() === "end" && this.optionalEndButton !== "" ? this.optionalEndButton : "Neste"}
96
+ </nve-button>
97
+ </div>
71
98
  </div>
72
99
  `;
73
100
  }
74
101
  };
75
- s.styles = [f];
76
- r([
77
- p()
102
+ s.styles = [u];
103
+ n([
104
+ r()
78
105
  ], s.prototype, "orientation", 2);
79
- r([
80
- p({ type: Number })
81
- ], s.prototype, "selectedStep", 2);
82
- r([
83
- p({ type: Number })
106
+ n([
107
+ r({ type: Object })
108
+ ], s.prototype, "selectedStepIndex", 2);
109
+ n([
110
+ r({ type: Number })
84
111
  ], s.prototype, "spaceBetweenSteps", 2);
85
- r([
86
- p({ type: String })
112
+ n([
113
+ r({ type: String })
87
114
  ], s.prototype, "iconLibrary", 2);
88
- r([
89
- p({ type: Array })
115
+ n([
116
+ r({ type: String })
117
+ ], s.prototype, "optionalEndButton", 2);
118
+ n([
119
+ r({ type: Array })
90
120
  ], s.prototype, "steps", 2);
91
- s = r([
92
- S("nve-stepper")
121
+ s = n([
122
+ v("nve-stepper")
93
123
  ], s);
94
124
  export {
95
125
  s as default
@@ -1,75 +1,65 @@
1
1
  import { i as e } from "../../chunks/lit-element.js";
2
2
  const t = e`
3
- .stepper {
4
- display: flex;
5
- position: relative;
6
- align-items: center;
7
- justify-content: center;
8
- overflow: hidden;
9
- }
3
+ .stepper {
4
+ display: flex;
5
+ position: relative;
6
+ align-items: center;
7
+ justify-content: center;
8
+ overflow: hidden;
9
+ }
10
10
 
11
- a {
12
- cursor: pointer;
13
- user-select: none;
14
- }
15
- .step {
16
- height: 200px;
17
- }
18
- button {
19
- z-index: 2;
20
- user-select: none;
21
- }
11
+ a {
12
+ cursor: pointer;
13
+ user-select: none;
14
+ }
15
+ .step {
16
+ height: 200px;
17
+ }
18
+ button {
19
+ z-index: 2;
20
+ user-select: none;
21
+ }
22
22
 
23
- .scroll-menu {
24
- display: flex;
25
- align-items: center;
26
- overflow-x: hidden;
27
- }
23
+ .scroll-menu {
24
+ display: flex;
25
+ align-items: center;
26
+ overflow-x: hidden;
27
+ }
28
28
 
29
- .flex-container {
30
- display: flex;
31
- padding: 20px 60px 20px 60px;
32
- position: relative;
33
- }
34
- .hidden {
35
- visibility: hidden;
36
- pointer-events: none;
37
- }
38
- :host {
39
- -webkit-touch-callout: none; /* iOS Safari */
29
+ .flex-container {
30
+ display: flex;
31
+ padding: 20px 60px 20px 60px;
32
+ position: relative;
33
+ }
34
+ .hidden {
35
+ visibility: hidden;
36
+ pointer-events: none;
37
+ }
38
+ :host {
39
+ -webkit-touch-callout: none; /* iOS Safari */
40
40
  -webkit-user-select: none; /* Safari */
41
- -khtml-user-select: none; /* Konqueror HTML */
42
- -moz-user-select: none; /* Old versions of Firefox */
43
- -ms-user-select: none; /* Internet Explorer/Edge */
44
- user-select: none; /* Non-prefixed version, currently
41
+ -khtml-user-select: none; /* Konqueror HTML */
42
+ -moz-user-select: none; /* Old versions of Firefox */
43
+ -ms-user-select: none; /* Internet Explorer/Edge */
44
+ user-select: none; /* Non-prefixed version, currently
45
45
  supported by Chrome, Edge, Opera and Firefox */
46
- }
46
+ }
47
47
 
48
- .scroll-button.prev {
49
- background: linear-gradient(
50
- to right,
51
- #ffffff,
52
- #ffffff 60%,
53
- transparent 100%
54
- );
55
- padding: 20px 80px 20px 20px;
56
- margin: 0 60px;
57
- position: absolute;
58
- z-index: 1;
59
- left: 0;
60
- }
61
- .scroll-button.next {
62
- background: linear-gradient(
63
- to left,
64
- #ffffff,
65
- #ffffff 60%,
66
- transparent 100%
67
- );
68
- padding: 20px 80px 20px 80px;
69
- position: absolute;
70
- z-index: 1;
71
- right: 0;
72
- }
48
+ .scroll-button.prev {
49
+ background: linear-gradient(to right, #ffffff, #ffffff 60%, transparent 100%);
50
+ padding: 20px 80px 20px 20px;
51
+ margin: 0 60px;
52
+ position: absolute;
53
+ z-index: 1;
54
+ left: 0;
55
+ }
56
+ .scroll-button.next {
57
+ background: linear-gradient(to left, #ffffff, #ffffff 60%, transparent 100%);
58
+ padding: 20px 80px 20px 80px;
59
+ position: absolute;
60
+ z-index: 1;
61
+ right: 0;
62
+ }
73
63
  `;
74
64
  export {
75
65
  t as default
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nve-designsystem",
3
- "version": "0.1.51",
3
+ "version": "0.1.54",
4
4
  "exports": {
5
5
  ".": {
6
6
  "import": "./nve-designsystem.js",