@oslokommune/punkt-elements 12.17.2 → 12.18.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 (53) hide show
  1. package/dist/index.d.ts +47 -0
  2. package/dist/{input-wrapper-6vTrKtsW.js → input-wrapper-DVXNuxVu.js} +4 -3
  3. package/dist/{input-wrapper-DX41tnbj.cjs → input-wrapper-tJE-X4Ac.cjs} +3 -3
  4. package/dist/{linkcard-BlWQ8jOv.js → linkcard-BHokvuVN.js} +10 -9
  5. package/dist/{linkcard-Det6CJ5D.cjs → linkcard-CUXMP6BH.cjs} +1 -1
  6. package/dist/modal-CjsQgmmH.cjs +30 -0
  7. package/dist/{modal-3OZTPqee.js → modal-lQfiTbGh.js} +2 -1
  8. package/dist/pkt-alert.cjs +1 -1
  9. package/dist/pkt-alert.js +18 -17
  10. package/dist/pkt-card.cjs +1 -1
  11. package/dist/pkt-card.js +4 -3
  12. package/dist/pkt-component-template.cjs +5 -5
  13. package/dist/pkt-component-template.js +18 -17
  14. package/dist/pkt-datepicker.cjs +1 -1
  15. package/dist/pkt-datepicker.js +2 -2
  16. package/dist/pkt-index.cjs +1 -1
  17. package/dist/pkt-index.js +17 -15
  18. package/dist/pkt-input-wrapper.cjs +1 -1
  19. package/dist/pkt-input-wrapper.js +1 -1
  20. package/dist/pkt-link.cjs +4 -4
  21. package/dist/pkt-link.js +3 -2
  22. package/dist/pkt-linkcard.cjs +1 -1
  23. package/dist/pkt-linkcard.js +1 -1
  24. package/dist/pkt-messagebox.cjs +3 -3
  25. package/dist/pkt-messagebox.js +7 -6
  26. package/dist/pkt-modal.cjs +1 -1
  27. package/dist/pkt-modal.js +1 -1
  28. package/dist/pkt-progressbar.cjs +1 -0
  29. package/dist/pkt-progressbar.js +6 -0
  30. package/dist/pkt-slot-controller-Ckk_yV0j.cjs +1 -0
  31. package/dist/pkt-slot-controller-RJvOnbF4.js +61 -0
  32. package/dist/pkt-tag.cjs +3 -3
  33. package/dist/pkt-tag.js +21 -20
  34. package/dist/pkt-textarea.cjs +1 -1
  35. package/dist/pkt-textarea.js +1 -1
  36. package/dist/pkt-textinput.cjs +1 -1
  37. package/dist/pkt-textinput.js +1 -1
  38. package/dist/progressbar-1PEs_SMc.js +155 -0
  39. package/dist/progressbar-BlzTFI9U.cjs +36 -0
  40. package/dist/progressbar.d.ts +8 -0
  41. package/dist/ref-CA2-0S_W.cjs +13 -0
  42. package/dist/ref-Dzme4zb6.js +143 -0
  43. package/dist/{textarea-BTpJjEhO.js → textarea-BXzQA_ub.js} +2 -2
  44. package/dist/{textarea-B45ZZYpx.cjs → textarea-D_ud1Mpa.cjs} +1 -1
  45. package/dist/{textinput-BIhQEr8z.cjs → textinput-52G3CfwA.cjs} +1 -1
  46. package/dist/{textinput-CVo5wG14.js → textinput-CTNWiIaP.js} +2 -2
  47. package/package.json +2 -2
  48. package/src/components/index.ts +10 -0
  49. package/src/components/progressbar/index.ts +12 -0
  50. package/src/components/progressbar/progressbar.ts +144 -0
  51. package/dist/modal-DYTVJjYh.cjs +0 -30
  52. package/dist/ref-C2yPtMJA.cjs +0 -13
  53. package/dist/ref-CaiKp3S2.js +0 -202
@@ -0,0 +1,143 @@
1
+ import { Z as u, E as d } from "./index-CFDwiDTU.js";
2
+ import { i as p, a as g, e as Y } from "./custom-element-CWfU4dcr.js";
3
+ /**
4
+ * @license
5
+ * Copyright 2020 Google LLC
6
+ * SPDX-License-Identifier: BSD-3-Clause
7
+ */
8
+ const { I: m } = u, C = (t) => t.strings === void 0, f = () => document.createComment(""), I = (t, s, e) => {
9
+ var o;
10
+ const i = t._$AA.parentNode, n = s === void 0 ? t._$AB : s._$AA;
11
+ if (e === void 0) {
12
+ const c = i.insertBefore(f(), n), $ = i.insertBefore(f(), n);
13
+ e = new m(c, $, t, t.options);
14
+ } else {
15
+ const c = e._$AB.nextSibling, $ = e._$AM, l = $ !== t;
16
+ if (l) {
17
+ let h;
18
+ (o = e._$AQ) == null || o.call(e, t), e._$AM = t, e._$AP !== void 0 && (h = t._$AU) !== $._$AU && e._$AP(h);
19
+ }
20
+ if (c !== n || l) {
21
+ let h = e._$AA;
22
+ for (; h !== c; ) {
23
+ const v = h.nextSibling;
24
+ i.insertBefore(h, n), h = v;
25
+ }
26
+ }
27
+ }
28
+ return e;
29
+ }, S = (t, s, e = t) => (t._$AI(s, e), t), M = {}, k = (t, s = M) => t._$AH = s, P = (t) => t._$AH, T = (t) => {
30
+ var i;
31
+ (i = t._$AP) == null || i.call(t, !1, !0);
32
+ let s = t._$AA;
33
+ const e = t._$AB.nextSibling;
34
+ for (; s !== e; ) {
35
+ const n = s.nextSibling;
36
+ s.remove(), s = n;
37
+ }
38
+ };
39
+ /**
40
+ * @license
41
+ * Copyright 2017 Google LLC
42
+ * SPDX-License-Identifier: BSD-3-Clause
43
+ */
44
+ const r = (t, s) => {
45
+ var i;
46
+ const e = t._$AN;
47
+ if (e === void 0) return !1;
48
+ for (const n of e) (i = n._$AO) == null || i.call(n, s, !1), r(n, s);
49
+ return !0;
50
+ }, A = (t) => {
51
+ let s, e;
52
+ do {
53
+ if ((s = t._$AM) === void 0) break;
54
+ e = s._$AN, e.delete(t), t = s;
55
+ } while ((e == null ? void 0 : e.size) === 0);
56
+ }, a = (t) => {
57
+ for (let s; s = t._$AM; t = s) {
58
+ let e = s._$AN;
59
+ if (e === void 0) s._$AN = e = /* @__PURE__ */ new Set();
60
+ else if (e.has(t)) break;
61
+ e.add(t), x(s);
62
+ }
63
+ };
64
+ function b(t) {
65
+ this._$AN !== void 0 ? (A(this), this._$AM = t, a(this)) : this._$AM = t;
66
+ }
67
+ function N(t, s = !1, e = 0) {
68
+ const i = this._$AH, n = this._$AN;
69
+ if (n !== void 0 && n.size !== 0) if (s) if (Array.isArray(i)) for (let o = e; o < i.length; o++) r(i[o], !1), A(i[o]);
70
+ else i != null && (r(i, !1), A(i));
71
+ else r(this, t);
72
+ }
73
+ const x = (t) => {
74
+ t.type == g.CHILD && (t._$AP ?? (t._$AP = N), t._$AQ ?? (t._$AQ = b));
75
+ };
76
+ class w extends p {
77
+ constructor() {
78
+ super(...arguments), this._$AN = void 0;
79
+ }
80
+ _$AT(s, e, i) {
81
+ super._$AT(s, e, i), a(this), this.isConnected = s._$AU;
82
+ }
83
+ _$AO(s, e = !0) {
84
+ var i, n;
85
+ s !== this.isConnected && (this.isConnected = s, s ? (i = this.reconnected) == null || i.call(this) : (n = this.disconnected) == null || n.call(this)), e && (r(this, s), A(this));
86
+ }
87
+ setValue(s) {
88
+ if (C(this._$Ct)) this._$Ct._$AI(s, this);
89
+ else {
90
+ const e = [...this._$Ct._$AH];
91
+ e[this._$Ci] = s, this._$Ct._$AI(e, this, 0);
92
+ }
93
+ }
94
+ disconnected() {
95
+ }
96
+ reconnected() {
97
+ }
98
+ }
99
+ /**
100
+ * @license
101
+ * Copyright 2020 Google LLC
102
+ * SPDX-License-Identifier: BSD-3-Clause
103
+ */
104
+ const U = () => new B();
105
+ class B {
106
+ }
107
+ const _ = /* @__PURE__ */ new WeakMap(), z = Y(class extends w {
108
+ render(t) {
109
+ return d;
110
+ }
111
+ update(t, [s]) {
112
+ var i;
113
+ const e = s !== this.Y;
114
+ return e && this.Y !== void 0 && this.rt(void 0), (e || this.lt !== this.ct) && (this.Y = s, this.ht = (i = t.options) == null ? void 0 : i.host, this.rt(this.ct = t.element)), d;
115
+ }
116
+ rt(t) {
117
+ if (this.isConnected || (t = void 0), typeof this.Y == "function") {
118
+ const s = this.ht ?? globalThis;
119
+ let e = _.get(s);
120
+ e === void 0 && (e = /* @__PURE__ */ new WeakMap(), _.set(s, e)), e.get(this.Y) !== void 0 && this.Y.call(this.ht, void 0), e.set(this.Y, t), t !== void 0 && this.Y.call(this.ht, t);
121
+ } else this.Y.value = t;
122
+ }
123
+ get lt() {
124
+ var t, s;
125
+ return typeof this.Y == "function" ? (t = _.get(this.ht ?? globalThis)) == null ? void 0 : t.get(this.Y) : (s = this.Y) == null ? void 0 : s.value;
126
+ }
127
+ disconnected() {
128
+ this.lt === this.ct && this.rt(void 0);
129
+ }
130
+ reconnected() {
131
+ this.rt(this.ct);
132
+ }
133
+ });
134
+ export {
135
+ T as M,
136
+ U as e,
137
+ C as f,
138
+ k as m,
139
+ z as n,
140
+ P as p,
141
+ I as r,
142
+ S as v
143
+ };
@@ -1,8 +1,8 @@
1
1
  import { T as l, E as h, r as c, a as $, x as g, n as p } from "./index-CFDwiDTU.js";
2
2
  import { e as m, i as f, a as n, t as b } from "./custom-element-CWfU4dcr.js";
3
- import { f as v, m as x, e as T, n as y } from "./ref-CaiKp3S2.js";
3
+ import { f as v, m as x, e as T, n as y } from "./ref-Dzme4zb6.js";
4
4
  import { e as w } from "./class-map-CBvUV2N3.js";
5
- import "./input-wrapper-6vTrKtsW.js";
5
+ import "./input-wrapper-DVXNuxVu.js";
6
6
  import "./index-RwtTBIhT.js";
7
7
  /**
8
8
  * @license
@@ -1,4 +1,4 @@
1
- "use strict";const a=require("./index-CR7t1zY9.cjs"),s=require("./custom-element-B-TlBwRu.cjs"),u=require("./ref-C2yPtMJA.cjs"),p=require("./class-map-a5HUzP83.cjs");require("./input-wrapper-DX41tnbj.cjs");require("./index-CmTjXoAb.cjs");/**
1
+ "use strict";const a=require("./index-CR7t1zY9.cjs"),s=require("./custom-element-B-TlBwRu.cjs"),u=require("./ref-CA2-0S_W.cjs"),p=require("./class-map-a5HUzP83.cjs");require("./input-wrapper-tJE-X4Ac.cjs");require("./index-CmTjXoAb.cjs");/**
2
2
  * @license
3
3
  * Copyright 2020 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
@@ -1,4 +1,4 @@
1
- "use strict";const t=require("./index-CR7t1zY9.cjs"),h=require("./custom-element-B-TlBwRu.cjs"),o=require("./ref-C2yPtMJA.cjs"),l=require("./class-map-a5HUzP83.cjs");require("./input-wrapper-DX41tnbj.cjs");require("./index-CmTjXoAb.cjs");var c=Object.defineProperty,d=Object.getOwnPropertyDescriptor,r=(p,i,n,s)=>{for(var e=s>1?void 0:s?d(i,n):i,a=p.length-1,u;a>=0;a--)(u=p[a])&&(e=(s?u(i,n,e):u(e))||e);return s&&e&&c(i,n,e),e};exports.PktTextinput=class extends t.PktInputElement{constructor(){super(...arguments),this.value="",this.type="text",this.size=null,this.autocomplete="off",this.iconNameRight=null,this.prefix=null,this.suffix=null,this.omitSearchIcon=!1,this.counterCurrent=0,this.inputRef=o.e()}attributeChangedCallback(i,n,s){i==="value"&&this.value!==n&&(this.counterCurrent=s?s.length:0,this.valueChanged(s,n)),super.attributeChangedCallback(i,n,s)}updated(i){var n;super.updated(i),i.has("value")&&(this.counterCurrent=((n=this.value)==null?void 0:n.length)||0,this.valueChanged(this.value,i.get("value"))),i.has("id")&&!this.name&&this.id&&(this.name=this.id)}render(){const i=this.type==="search"&&!this.iconNameRight&&!this.omitSearchIcon,n=l.e({"pkt-input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":this.counter&&this.counterMaxLength&&this.value.length&&this.value.length>this.counterMaxLength}),s=this.ariaLabelledby||`${this.id}-input-label`;return t.x`
1
+ "use strict";const t=require("./index-CR7t1zY9.cjs"),h=require("./custom-element-B-TlBwRu.cjs"),o=require("./ref-CA2-0S_W.cjs"),l=require("./class-map-a5HUzP83.cjs");require("./input-wrapper-tJE-X4Ac.cjs");require("./index-CmTjXoAb.cjs");var c=Object.defineProperty,d=Object.getOwnPropertyDescriptor,r=(p,i,n,s)=>{for(var e=s>1?void 0:s?d(i,n):i,a=p.length-1,u;a>=0;a--)(u=p[a])&&(e=(s?u(i,n,e):u(e))||e);return s&&e&&c(i,n,e),e};exports.PktTextinput=class extends t.PktInputElement{constructor(){super(...arguments),this.value="",this.type="text",this.size=null,this.autocomplete="off",this.iconNameRight=null,this.prefix=null,this.suffix=null,this.omitSearchIcon=!1,this.counterCurrent=0,this.inputRef=o.e()}attributeChangedCallback(i,n,s){i==="value"&&this.value!==n&&(this.counterCurrent=s?s.length:0,this.valueChanged(s,n)),super.attributeChangedCallback(i,n,s)}updated(i){var n;super.updated(i),i.has("value")&&(this.counterCurrent=((n=this.value)==null?void 0:n.length)||0,this.valueChanged(this.value,i.get("value"))),i.has("id")&&!this.name&&this.id&&(this.name=this.id)}render(){const i=this.type==="search"&&!this.iconNameRight&&!this.omitSearchIcon,n=l.e({"pkt-input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":this.counter&&this.counterMaxLength&&this.value.length&&this.value.length>this.counterMaxLength}),s=this.ariaLabelledby||`${this.id}-input-label`;return t.x`
2
2
  <pkt-input-wrapper
3
3
  label="${this.label}"
4
4
  ?counter=${this.counter}
@@ -1,8 +1,8 @@
1
1
  import { r as c, a as d, x as h, E as n, n as p } from "./index-CFDwiDTU.js";
2
2
  import { t as $ } from "./custom-element-CWfU4dcr.js";
3
- import { e as g, n as m } from "./ref-CaiKp3S2.js";
3
+ import { e as g, n as m } from "./ref-Dzme4zb6.js";
4
4
  import { e as f } from "./class-map-CBvUV2N3.js";
5
- import "./input-wrapper-6vTrKtsW.js";
5
+ import "./input-wrapper-DVXNuxVu.js";
6
6
  import "./index-RwtTBIhT.js";
7
7
  var x = Object.defineProperty, y = Object.getOwnPropertyDescriptor, a = (i, e, r, t) => {
8
8
  for (var o = t > 1 ? void 0 : t ? y(e, r) : e, u = i.length - 1, l; u >= 0; u--)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-elements",
3
- "version": "12.17.2",
3
+ "version": "12.18.0",
4
4
  "description": "Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo",
5
5
  "homepage": "https://punkt.oslo.kommune.no",
6
6
  "author": "Team Designsystem, Oslo Origo",
@@ -57,5 +57,5 @@
57
57
  "url": "https://github.com/oslokommune/punkt/issues"
58
58
  },
59
59
  "license": "MIT",
60
- "gitHead": "998cf96281840a47cba5ba3e0c76e6fa1d2ed10e"
60
+ "gitHead": "ceaac8e8aac119c09de9e77927150022aa6e316d"
61
61
  }
@@ -10,6 +10,16 @@ export { PktLink } from './link'
10
10
  export { PktLinkCard } from './linkcard'
11
11
  export { PktMessagebox } from './messagebox'
12
12
  export { PktModal } from './modal'
13
+ export { PktProgressbar } from './progressbar'
13
14
  export { PktTag } from './tag'
14
15
  export { PktTextarea } from './textarea'
15
16
  export { PktTextinput } from './textinput'
17
+
18
+ export type {
19
+ IPktProgressbar,
20
+ TProgressbarRole,
21
+ TProgressbarSkin,
22
+ TProgressbarStatusPlacement,
23
+ TProgressbarStatusType,
24
+ TProgressbarTitlePosition,
25
+ } from './progressbar'
@@ -0,0 +1,12 @@
1
+ import PktProgressbar from './progressbar'
2
+
3
+ export { PktProgressbar } from './progressbar'
4
+ export type {
5
+ IPktProgressbar,
6
+ TProgressbarRole,
7
+ TProgressbarSkin,
8
+ TProgressbarStatusPlacement,
9
+ TProgressbarStatusType,
10
+ TProgressbarTitlePosition,
11
+ } from './progressbar'
12
+ export default PktProgressbar
@@ -0,0 +1,144 @@
1
+ import { ifDefined } from 'lit/directives/if-defined.js'
2
+ import { classMap } from 'lit/directives/class-map.js'
3
+ import { customElement, property, state } from 'lit/decorators.js'
4
+ import { html } from 'lit'
5
+ import { PktElement } from '../element'
6
+ import { Ref, createRef, ref } from 'lit/directives/ref.js'
7
+ import { styleMap } from 'lit/directives/style-map.js'
8
+ import { uuidish } from '@/utils/stringutils'
9
+
10
+ import '../icon'
11
+
12
+ export type TProgressbarRole = 'progressbar' | 'meter'
13
+ export type TProgressbarSkin = 'dark-blue' | 'light-blue' | 'green' | 'red'
14
+ export type TProgressbarStatusPlacement = 'center' | 'left' | 'following'
15
+ export type TProgressbarStatusType = 'none' | 'percentage' | 'fraction'
16
+ export type TProgressbarTitlePosition = 'left' | 'center'
17
+
18
+ export interface IPktProgressbar {
19
+ valueCurrent: number
20
+ valueMax?: number
21
+ valueMin?: number
22
+ ariaValueText?: string
23
+ skin?: TProgressbarSkin
24
+ title?: string
25
+ titlePosition?: TProgressbarTitlePosition
26
+ statusType?: TProgressbarStatusType
27
+ statusPlacement?: TProgressbarStatusPlacement
28
+ ariaLabel?: string
29
+ ariaLabelledby?: string
30
+ role?: TProgressbarRole
31
+ }
32
+
33
+ @customElement('pkt-progressbar')
34
+ export class PktProgressbar extends PktElement implements IPktProgressbar {
35
+ // Public properties
36
+ @property({ type: Number, reflect: true }) valueCurrent: number = 0
37
+ @property({ type: Number, reflect: true }) valueMax: number = 100
38
+ @property({ type: Number, reflect: true }) valueMin: number = 0
39
+ @property({ type: String, reflect: true }) skin: TProgressbarSkin = 'dark-blue'
40
+ @property({ type: String, reflect: true }) title: string = ''
41
+ @property({ type: String, reflect: true }) titlePosition: TProgressbarTitlePosition = 'left'
42
+ @property({ type: String, reflect: true }) statusType: TProgressbarStatusType = 'none'
43
+ @property({ type: String, reflect: true }) statusPlacement: TProgressbarStatusPlacement =
44
+ 'following'
45
+ @property({ type: String, reflect: true }) ariaLabel: string = ''
46
+ @property({ type: String, reflect: true }) ariaLabelledby: string = ''
47
+ @property({ type: String, reflect: true }) ariaValueText: string = ''
48
+ @property({ type: String, reflect: true }) role: TProgressbarRole = 'progressbar'
49
+
50
+ // State
51
+ @state() private labelWidth: number = 0
52
+ @state() private progressBarId: string = this.id
53
+
54
+ // Private properties
55
+ private labelRef: Ref<HTMLSpanElement> = createRef()
56
+ private progressBarRef: Ref<HTMLDivElement> = createRef()
57
+
58
+ firstUpdated(changedProperties: Map<string | number | symbol, unknown>) {
59
+ super.firstUpdated(changedProperties)
60
+ if (!this.id) {
61
+ this.progressBarId = uuidish()
62
+ } else {
63
+ this.progressBarId = this.id
64
+ }
65
+ }
66
+
67
+ updated(changedProperties: Map<string | number | symbol, unknown>) {
68
+ super.updated(changedProperties)
69
+ if (changedProperties.has('valueCurrent') && this.labelRef.value) {
70
+ this.labelWidth = this.labelRef.value.getBoundingClientRect().width || 0
71
+ }
72
+ if (changedProperties.has('id') && this.id) {
73
+ this.progressBarId = this.id
74
+ }
75
+ }
76
+
77
+ render() {
78
+ const totalSteps = this.valueMax - this.valueMin
79
+ const percentageOfSteps = (this.valueCurrent / totalSteps) * 100
80
+ const currentPercentage =
81
+ this.valueMax !== 100 || this.valueMin !== 0
82
+ ? Math.round(percentageOfSteps)
83
+ : this.valueCurrent
84
+ const formattedTitle = `${this.valueCurrent} av ${this.valueMax}`
85
+ const hasStatus = this.statusType !== 'none'
86
+
87
+ const ariaLabelledbyText =
88
+ this.ariaLabelledby || (this.progressBarId && `${this.progressBarId}-title`)
89
+
90
+ const barClasses = classMap({
91
+ 'pkt-progressbar__bar': true,
92
+ [`pkt-progressbar__bar--${this.skin}`]: !!this.skin,
93
+ })
94
+ const titleClasses = classMap({
95
+ 'pkt-progressbar__title': true,
96
+ [`pkt-progressbar__title-center`]: this.titlePosition === 'center',
97
+ })
98
+ const statusClasses = classMap({
99
+ 'pkt-progressbar__status': true,
100
+ [`pkt-progressbar__status--center`]: this.statusPlacement === 'center',
101
+ })
102
+ const placementClasses = classMap({
103
+ [`pkt-progressbar__status-placement--following`]: this.statusPlacement === 'following',
104
+ [`pkt-progressbar__status-placement--center`]: this.statusPlacement === 'center',
105
+ [`pkt-progressbar__status-placement--left`]: this.statusPlacement === 'left',
106
+ })
107
+
108
+ return html` <div
109
+ id=${this.progressBarId}
110
+ class="pkt-progressbar__container"
111
+ .ref=${this.progressBarRef}
112
+ style=${styleMap({
113
+ '--pkt-progress-label-width': `${this.labelWidth}px`,
114
+ '--pkt-progress-width': `${currentPercentage}%`,
115
+ })}
116
+ >
117
+ ${this.title &&
118
+ html`<p id=${`${this.progressBarId}-title`} class=${titleClasses}>${this.title}</p>`}
119
+
120
+ <div
121
+ .id=${this.progressBarId}
122
+ role=${this.role as any}
123
+ class="pkt-progressbar__bar-wrapper"
124
+ aria-valuemin=${this.valueMin}
125
+ aria-valuemax=${this.valueMax}
126
+ aria-valuenow=${this.valueCurrent}
127
+ aria-labelledby=${ifDefined(ariaLabelledbyText)}
128
+ aria-label=${ifDefined(this.ariaLabel)}
129
+ aria-valuetext=${ifDefined(this.ariaValueText)}
130
+ >
131
+ <div class=${barClasses}></div>
132
+ </div>
133
+
134
+ ${hasStatus &&
135
+ html`<div class=${statusClasses}>
136
+ <span class=${placementClasses} ${ref(this.labelRef)}>
137
+ ${this.statusType === 'percentage' ? `${currentPercentage}%` : formattedTitle}
138
+ </span>
139
+ </div>`}
140
+ </div>`
141
+ }
142
+ }
143
+
144
+ export default PktProgressbar
@@ -1,30 +0,0 @@
1
- "use strict";const c=require("./class-map-a5HUzP83.cjs"),k=require("./custom-element-B-TlBwRu.cjs"),n=require("./index-CR7t1zY9.cjs"),a=require("./ref-C2yPtMJA.cjs");require("./index-CmTjXoAb.cjs");const m="pkt-modal",u=!0,h={"background-click":{description:"Event som trigges når bakgrunnen trykkes på"},close:{description:"Event som trigges når meldingsboksen lukkes"}},g={headingText:{name:"Heading text",description:"Heading tekst på modalen",type:"string"},hideCloseButton:{name:"Gjem 'Lukk'-knapp",description:"Gjemmer lukkeknappen. Dersom denne er satt til true, vil ikke lukkeknappen vises, og dermed er det viktig at man tilbyr en annen måte som f.eks. en knapp for å lukke modalen på.",type:"boolean",default:!1},closeOnBackdropClick:{name:"Lukk modalen når bakgrunnen trykkes på",description:"Lukk modalen når bakgrunnen trykkes på",type:"boolean",default:!1},size:{name:"Størrelse",description:"Størrelsen på modalen",type:["small","medium","large"],default:"medium"}},f={default:{description:"Innholdet i meldingen. Her tilbyr vi støtteklasser for å style 1-3 knapper i modalen."}},p={name:m,"css-class":"pkt-modal",isElements:u,events:h,props:g,slots:f};var v=Object.defineProperty,b=Object.getOwnPropertyDescriptor,i=(d,e,t,o)=>{for(var s=o>1?void 0:o?b(e,t):e,l=d.length-1,r;l>=0;l--)(r=d[l])&&(s=(o?r(e,t,s):r(s))||s);return o&&s&&v(e,t,s),s};exports.PktModal=class extends n.PktElement{constructor(){super(),this.headingText="",this.removePadding=!1,this.hideCloseButton=p.props.hideCloseButton.default,this.closeOnBackdropClick=p.props.closeOnBackdropClick.default,this.size=p.props.size.default,this.defaultSlot=a.e(),this.dialogRef=a.e(),this._isOpen=!1,this.close=(e,t=!1)=>{var l;this._isOpen=!1,t||(l=this.dialogRef.value)==null||l.close();const o=document.activeElement;o&&!this.isElementInViewport(o)&&o.scrollIntoView({behavior:"smooth",block:"nearest"}),this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!0,composed:!0})),document.querySelector(".pkt-modal")&&document.body.classList.remove("pkt-modal--open"),this.requestUpdate()},this.showModal=e=>{var o;this._isOpen=!0,(o=this.dialogRef.value)==null||o.showModal(),document.querySelector(".pkt-modal")&&document.body.classList.add("pkt-modal--open"),this.dispatchEvent(new CustomEvent("showModal",{detail:{origin:e},bubbles:!0,composed:!0})),this.requestUpdate()},this.slotController=new a.PktSlotController(this,this.defaultSlot),this._isOpen=!1}async connectedCallback(){var e;super.connectedCallback(),document.addEventListener("keydown",this.handleKeyDown.bind(this)),document.addEventListener("click",this.handleBackdropClick.bind(this)),(e=this.dialogRef.value)==null||e.addEventListener("submit",t=>this.close(t,!0))}disconnectedCallback(){var e;super.disconnectedCallback(),document.removeEventListener("keydown",this.handleKeyDown.bind(this)),document.removeEventListener("click",this.handleBackdropClick.bind(this)),(e=this.dialogRef.value)==null||e.removeEventListener("submit",t=>this.close(t,!0))}handleKeyDown(e){e.key==="Escape"&&this.close(e)}handleBackdropClick(e){var t;this.closeOnBackdropClick&&e.target===((t=this.dialogRef)==null?void 0:t.value)&&this.close(e)}isElementInViewport(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}render(){const e={"pkt-modal":!0,"pkt-modal--removePadding":this.removePadding??!1,"pkt-modal--noHeadingText":this.headingText===""||this.headingText===void 0,[`pkt-modal--${this.size}`]:this.size!==void 0},t={"pkt-modal__headingText":!0,"pkt-txt-24":!0},o={"pkt-modal__content":!0,"pkt-txt-18-light":!0};return n.x`
2
- <dialog
3
- class=${c.e(e)}
4
- aria-modal=${this._isOpen}
5
- ${a.n(this.dialogRef)}
6
- aria-labelledby="pkt-modal__headingText"
7
- aria-describedby="pkt-modal__content"
8
- autofocus
9
- >
10
- <div class="pkt-modal__header">
11
- ${this.headingText?n.x`<h1 id="pkt-modal__headingText" class=${c.e(t)}>
12
- ${this.headingText}
13
- </h1>`:n.E}
14
- ${this.hideCloseButton?n.E:n.x`<div class="pkt-modal__closeButton">
15
- <button
16
- @click=${s=>this.close(s)}
17
- class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only"
18
- aria-label="close"
19
- >
20
- <pkt-icon name="close" class="pkt-link__icon"></pkt-icon>
21
- </button>
22
- </div>`}
23
- </div>
24
- <div
25
- id="pkt-modal__content"
26
- class=${c.e(o)}
27
- ${a.n(this.defaultSlot)}
28
- ></div>
29
- </dialog>
30
- `}};i([n.n({type:String,reflect:!0})],exports.PktModal.prototype,"headingText",2);i([n.n({type:Boolean,reflect:!0})],exports.PktModal.prototype,"removePadding",2);i([n.n({type:Boolean,reflect:!0})],exports.PktModal.prototype,"hideCloseButton",2);i([n.n({type:Boolean,reflect:!0})],exports.PktModal.prototype,"closeOnBackdropClick",2);i([n.n({type:String,reflect:!0})],exports.PktModal.prototype,"size",2);i([n.r()],exports.PktModal.prototype,"_isOpen",2);exports.PktModal=i([k.t("pkt-modal")],exports.PktModal);
@@ -1,13 +0,0 @@
1
- "use strict";const A=require("./index-CR7t1zY9.cjs"),$=require("./custom-element-B-TlBwRu.cjs");class N{constructor(e,...t){this.nodes=[],this.host=e,this.host.addController(this),this.slots=t,this.nodes=[],this.observer=new MutationObserver(i=>this.handleMutations(i))}hostConnected(){this.updateNodes(),this.observer.observe(this.host,{childList:!0})}hostDisconnected(){this.observer.disconnect()}hostUpdated(){this.updateSlots()}updateNodes(){this.nodes=[],Array.from(this.host.childNodes).forEach(t=>{var i;if(t.nodeType===Node.TEXT_NODE&&((i=t.nodeValue)!=null&&i.trim())){const o=document==null?void 0:document.createElement("template");o.content.appendChild(t),this.nodes.push(o)}else this.isSlotElement(t)||this.nodes.push(t)})}updateSlots(){this.slots.forEach(e=>{if(!e.value)return;const t=e.value.getAttribute("name"),o=this.nodes.flatMap(n=>n.getAttribute&&n.getAttribute("slot")==t?this.nodeFromElement(n,e):[]).filter(n=>e.value&&!e.value.contains(n)&&!n.contains(e.value));o.length>0&&e.value.replaceChildren(...o)})}handleMutations(e){let t=!1;e.forEach(i=>{i.type==="childList"&&(i.addedNodes.forEach(o=>{var h;const n=o.nodeType===Node.ELEMENT_NODE&&!this.isSlotElement(o),l=o.nodeType===Node.TEXT_NODE&&((h=o.nodeValue)==null?void 0:h.trim());if(n)this.nodes.push(o),t=!0;else if(l){const d=document==null?void 0:document.createElement("template");d.content.appendChild(o),this.nodes.push(d),t=!0}}),i.removedNodes.forEach(o=>{this.nodes=this.nodes.filter(n=>n!==o),t=!0}))}),t&&this.updateSlots()}isSlotElement(e){return this.slots.some(t=>t.value===e)}nodeFromElement(e,t){var i;return e===((i=t.value)==null?void 0:i.parentNode)?[]:e instanceof HTMLTemplateElement?Array.from(e.content.childNodes):[e]}}/**
2
- * @license
3
- * Copyright 2020 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */const{I:m}=A.Z,f=s=>s.strings===void 0,_=()=>document.createComment(""),E=(s,e,t)=>{var n;const i=s._$AA.parentNode,o=e===void 0?s._$AB:e._$AA;if(t===void 0){const l=i.insertBefore(_(),o),h=i.insertBefore(_(),o);t=new m(l,h,s,s.options)}else{const l=t._$AB.nextSibling,h=t._$AM,d=h!==s;if(d){let r;(n=t._$AQ)==null||n.call(t,s),t._$AM=s,t._$AP!==void 0&&(r=s._$AU)!==h._$AU&&t._$AP(r)}if(l!==o||d){let r=t._$AA;for(;r!==l;){const v=r.nextSibling;i.insertBefore(r,o),r=v}}}return t},g=(s,e,t=s)=>(s._$AI(e,t),s),C={},b=(s,e=C)=>s._$AH=e,M=s=>s._$AH,S=s=>{var i;(i=s._$AP)==null||i.call(s,!1,!0);let e=s._$AA;const t=s._$AB.nextSibling;for(;e!==t;){const o=e.nextSibling;e.remove(),e=o}};/**
6
- * @license
7
- * Copyright 2017 Google LLC
8
- * SPDX-License-Identifier: BSD-3-Clause
9
- */const c=(s,e)=>{var i;const t=s._$AN;if(t===void 0)return!1;for(const o of t)(i=o._$AO)==null||i.call(o,e,!1),c(o,e);return!0},a=s=>{let e,t;do{if((e=s._$AM)===void 0)break;t=e._$AN,t.delete(s),s=e}while((t==null?void 0:t.size)===0)},p=s=>{for(let e;e=s._$AM;s=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(s))break;t.add(s),Y(e)}};function T(s){this._$AN!==void 0?(a(this),this._$AM=s,p(this)):this._$AM=s}function y(s,e=!1,t=0){const i=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(e)if(Array.isArray(i))for(let n=t;n<i.length;n++)c(i[n],!1),a(i[n]);else i!=null&&(c(i,!1),a(i));else c(this,s)}const Y=s=>{s.type==$.t$1.CHILD&&(s._$AP??(s._$AP=y),s._$AQ??(s._$AQ=T))};class w extends $.i{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,i){super._$AT(e,t,i),p(this),this.isConnected=e._$AU}_$AO(e,t=!0){var i,o;e!==this.isConnected&&(this.isConnected=e,e?(i=this.reconnected)==null||i.call(this):(o=this.disconnected)==null||o.call(this)),t&&(c(this,e),a(this))}setValue(e){if(f(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}/**
10
- * @license
11
- * Copyright 2020 Google LLC
12
- * SPDX-License-Identifier: BSD-3-Clause
13
- */const x=()=>new k;class k{}const u=new WeakMap,B=$.e(class extends w{render(s){return A.E}update(s,[e]){var i;const t=e!==this.Y;return t&&this.Y!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.Y=e,this.ht=(i=s.options)==null?void 0:i.host,this.rt(this.ct=s.element)),A.E}rt(s){if(this.isConnected||(s=void 0),typeof this.Y=="function"){const e=this.ht??globalThis;let t=u.get(e);t===void 0&&(t=new WeakMap,u.set(e,t)),t.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),t.set(this.Y,s),s!==void 0&&this.Y.call(this.ht,s)}else this.Y.value=s}get lt(){var s,e;return typeof this.Y=="function"?(s=u.get(this.ht??globalThis))==null?void 0:s.get(this.Y):(e=this.Y)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});exports.M=S;exports.PktSlotController=N;exports.e=x;exports.f=f;exports.m=b;exports.n=B;exports.p=M;exports.r=E;exports.v=g;
@@ -1,202 +0,0 @@
1
- import { Z as p, E as A } from "./index-CFDwiDTU.js";
2
- import { i as v, a as N, e as m } from "./custom-element-CWfU4dcr.js";
3
- class w {
4
- constructor(e, ...t) {
5
- this.nodes = [], this.host = e, this.host.addController(this), this.slots = t, this.nodes = [], this.observer = new MutationObserver((i) => this.handleMutations(i));
6
- }
7
- hostConnected() {
8
- this.updateNodes(), this.observer.observe(this.host, { childList: !0 });
9
- }
10
- hostDisconnected() {
11
- this.observer.disconnect();
12
- }
13
- hostUpdated() {
14
- this.updateSlots();
15
- }
16
- updateNodes() {
17
- this.nodes = [], Array.from(this.host.childNodes).forEach((t) => {
18
- var i;
19
- if (t.nodeType === Node.TEXT_NODE && ((i = t.nodeValue) != null && i.trim())) {
20
- const o = document == null ? void 0 : document.createElement("template");
21
- o.content.appendChild(t), this.nodes.push(o);
22
- } else this.isSlotElement(t) || this.nodes.push(t);
23
- });
24
- }
25
- updateSlots() {
26
- this.slots.forEach((e) => {
27
- if (!e.value) return;
28
- const t = e.value.getAttribute("name"), o = this.nodes.flatMap(
29
- (n) => n.getAttribute && n.getAttribute("slot") == t ? this.nodeFromElement(n, e) : []
30
- ).filter(
31
- (n) => e.value && !e.value.contains(n) && !n.contains(e.value)
32
- );
33
- o.length > 0 && e.value.replaceChildren(...o);
34
- });
35
- }
36
- handleMutations(e) {
37
- let t = !1;
38
- e.forEach((i) => {
39
- i.type === "childList" && (i.addedNodes.forEach((o) => {
40
- var h;
41
- const n = o.nodeType === Node.ELEMENT_NODE && !this.isSlotElement(o), d = o.nodeType === Node.TEXT_NODE && ((h = o.nodeValue) == null ? void 0 : h.trim());
42
- if (n)
43
- this.nodes.push(o), t = !0;
44
- else if (d) {
45
- const l = document == null ? void 0 : document.createElement("template");
46
- l.content.appendChild(o), this.nodes.push(l), t = !0;
47
- }
48
- }), i.removedNodes.forEach((o) => {
49
- this.nodes = this.nodes.filter((n) => n !== o), t = !0;
50
- }));
51
- }), t && this.updateSlots();
52
- }
53
- isSlotElement(e) {
54
- return this.slots.some((t) => t.value === e);
55
- }
56
- nodeFromElement(e, t) {
57
- var i;
58
- return e === ((i = t.value) == null ? void 0 : i.parentNode) ? [] : e instanceof HTMLTemplateElement ? Array.from(e.content.childNodes) : [e];
59
- }
60
- }
61
- /**
62
- * @license
63
- * Copyright 2020 Google LLC
64
- * SPDX-License-Identifier: BSD-3-Clause
65
- */
66
- const { I: E } = p, g = (s) => s.strings === void 0, $ = () => document.createComment(""), B = (s, e, t) => {
67
- var n;
68
- const i = s._$AA.parentNode, o = e === void 0 ? s._$AB : e._$AA;
69
- if (t === void 0) {
70
- const d = i.insertBefore($(), o), h = i.insertBefore($(), o);
71
- t = new E(d, h, s, s.options);
72
- } else {
73
- const d = t._$AB.nextSibling, h = t._$AM, l = h !== s;
74
- if (l) {
75
- let r;
76
- (n = t._$AQ) == null || n.call(t, s), t._$AM = s, t._$AP !== void 0 && (r = s._$AU) !== h._$AU && t._$AP(r);
77
- }
78
- if (d !== o || l) {
79
- let r = t._$AA;
80
- for (; r !== d; ) {
81
- const _ = r.nextSibling;
82
- i.insertBefore(r, o), r = _;
83
- }
84
- }
85
- }
86
- return t;
87
- }, H = (s, e, t = s) => (s._$AI(e, t), s), C = {}, O = (s, e = C) => s._$AH = e, P = (s) => s._$AH, k = (s) => {
88
- var i;
89
- (i = s._$AP) == null || i.call(s, !1, !0);
90
- let e = s._$AA;
91
- const t = s._$AB.nextSibling;
92
- for (; e !== t; ) {
93
- const o = e.nextSibling;
94
- e.remove(), e = o;
95
- }
96
- };
97
- /**
98
- * @license
99
- * Copyright 2017 Google LLC
100
- * SPDX-License-Identifier: BSD-3-Clause
101
- */
102
- const c = (s, e) => {
103
- var i;
104
- const t = s._$AN;
105
- if (t === void 0) return !1;
106
- for (const o of t) (i = o._$AO) == null || i.call(o, e, !1), c(o, e);
107
- return !0;
108
- }, a = (s) => {
109
- let e, t;
110
- do {
111
- if ((e = s._$AM) === void 0) break;
112
- t = e._$AN, t.delete(s), s = e;
113
- } while ((t == null ? void 0 : t.size) === 0);
114
- }, f = (s) => {
115
- for (let e; e = s._$AM; s = e) {
116
- let t = e._$AN;
117
- if (t === void 0) e._$AN = t = /* @__PURE__ */ new Set();
118
- else if (t.has(s)) break;
119
- t.add(s), T(e);
120
- }
121
- };
122
- function b(s) {
123
- this._$AN !== void 0 ? (a(this), this._$AM = s, f(this)) : this._$AM = s;
124
- }
125
- function M(s, e = !1, t = 0) {
126
- const i = this._$AH, o = this._$AN;
127
- if (o !== void 0 && o.size !== 0) if (e) if (Array.isArray(i)) for (let n = t; n < i.length; n++) c(i[n], !1), a(i[n]);
128
- else i != null && (c(i, !1), a(i));
129
- else c(this, s);
130
- }
131
- const T = (s) => {
132
- s.type == N.CHILD && (s._$AP ?? (s._$AP = M), s._$AQ ?? (s._$AQ = b));
133
- };
134
- class S extends v {
135
- constructor() {
136
- super(...arguments), this._$AN = void 0;
137
- }
138
- _$AT(e, t, i) {
139
- super._$AT(e, t, i), f(this), this.isConnected = e._$AU;
140
- }
141
- _$AO(e, t = !0) {
142
- var i, o;
143
- e !== this.isConnected && (this.isConnected = e, e ? (i = this.reconnected) == null || i.call(this) : (o = this.disconnected) == null || o.call(this)), t && (c(this, e), a(this));
144
- }
145
- setValue(e) {
146
- if (g(this._$Ct)) this._$Ct._$AI(e, this);
147
- else {
148
- const t = [...this._$Ct._$AH];
149
- t[this._$Ci] = e, this._$Ct._$AI(t, this, 0);
150
- }
151
- }
152
- disconnected() {
153
- }
154
- reconnected() {
155
- }
156
- }
157
- /**
158
- * @license
159
- * Copyright 2020 Google LLC
160
- * SPDX-License-Identifier: BSD-3-Clause
161
- */
162
- const D = () => new y();
163
- class y {
164
- }
165
- const u = /* @__PURE__ */ new WeakMap(), I = m(class extends S {
166
- render(s) {
167
- return A;
168
- }
169
- update(s, [e]) {
170
- var i;
171
- const t = e !== this.Y;
172
- return t && this.Y !== void 0 && this.rt(void 0), (t || this.lt !== this.ct) && (this.Y = e, this.ht = (i = s.options) == null ? void 0 : i.host, this.rt(this.ct = s.element)), A;
173
- }
174
- rt(s) {
175
- if (this.isConnected || (s = void 0), typeof this.Y == "function") {
176
- const e = this.ht ?? globalThis;
177
- let t = u.get(e);
178
- t === void 0 && (t = /* @__PURE__ */ new WeakMap(), u.set(e, t)), t.get(this.Y) !== void 0 && this.Y.call(this.ht, void 0), t.set(this.Y, s), s !== void 0 && this.Y.call(this.ht, s);
179
- } else this.Y.value = s;
180
- }
181
- get lt() {
182
- var s, e;
183
- return typeof this.Y == "function" ? (s = u.get(this.ht ?? globalThis)) == null ? void 0 : s.get(this.Y) : (e = this.Y) == null ? void 0 : e.value;
184
- }
185
- disconnected() {
186
- this.lt === this.ct && this.rt(void 0);
187
- }
188
- reconnected() {
189
- this.rt(this.ct);
190
- }
191
- });
192
- export {
193
- k as M,
194
- w as P,
195
- D as e,
196
- g as f,
197
- O as m,
198
- I as n,
199
- P as p,
200
- B as r,
201
- H as v
202
- };