@oslokommune/punkt-elements 12.29.0 → 12.29.2

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.
@@ -0,0 +1,27 @@
1
+ "use strict";const d=require("./class-map-Dzci3Pfe.cjs"),e=require("./element-r-PeQ419.cjs"),k=require("./state-B77EXPZ9.cjs"),u=require("./pkt-slot-controller-Oc32unDk.cjs"),c=require("./ref-BUWgvhgU.cjs"),h=require("./classutils-BwNK82ZQ.cjs");require("./icon-DcJIqTIY.cjs");const v="pkt-alert",f=!0,m={onClose:{description:"React: Klikk-event for 'Lukk'-knappen"},close:{description:"Vue: Klikk-event for 'Lukk'-knappen"}},b={title:{name:"Tittel",description:"Tittelen som vises øverst i på meldingen",type:"string"},skin:{name:"Utseende",description:"Hvordan type melding er dette?",type:["info","success","warning","error"],default:"info"},date:{name:"Sist oppdatert",description:"Dato som vises nederst i på meldingen",type:"string"},ariaLive:{name:"aria-live",description:"Hvordan skal skjermleseren lese opp meldingen?",type:["off","polite","assertive"],default:"polite"},compact:{name:"Kompakt",description:"Gjør meldingen mindre",type:"boolean",default:!1},closeAlert:{name:"Vis 'Lukk'-knapp",description:"Viser 'Lukk'-knappen",type:"boolean",default:!1}},y={default:{description:"Innholdet i meldingen"}},a={name:v,"css-class":"pkt-alert","dark-mode":!0,isElement:f,events:m,props:b,slots:y};var _=Object.defineProperty,C=Object.getOwnPropertyDescriptor,s=(n,t,r,i)=>{for(var l=i>1?void 0:i?C(t,r):t,o=n.length-1,p;o>=0;o--)(p=n[o])&&(l=(i?p(t,r,l):p(l))||l);return i&&l&&_(t,r,l),l};exports.PktAlert=class extends e.PktElement{constructor(){super(),this.defaultSlot=c.e(),this.compact=a.props.compact.default,this.title="",this.skin=a.props.skin.default,this.ariaLive=a.props.ariaLive.default,this["aria-live"]=null,this.closeAlert=a.props.closeAlert.default,this.date=null,this._isClosed=!1,this.close=t=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:t},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:t},bubbles:!0,composed:!0}))},this.slotController=new u.PktSlotController(this,this.defaultSlot),this._isClosed=!1}connectedCallback(){super.connectedCallback(),this["aria-live"]=this.getAttribute("aria-live")||this.ariaLive}attributeChangedCallback(t,r,i){t==="ariaLive"&&(this["aria-live"]=i),super.attributeChangedCallback(t,r,i)}updated(t){super.updated(t),t.has("ariaLive")&&(this["aria-live"]=this.ariaLive),t.has("_isClosed")&&h.updateClassAttribute(this,"pkt-hide",this._isClosed)}render(){const t={"pkt-alert":!0,"pkt-alert--compact":this.compact,[`pkt-alert--${this.skin}`]:this.skin,"pkt-hide":this._isClosed};return e.x`
2
+ <div class=${d.e(t)}>
3
+ <pkt-icon
4
+ class="pkt-alert__icon"
5
+ name=${this.skin==="info"?"alert-information":`alert-${this.skin}`}
6
+ ></pkt-icon>
7
+
8
+ ${this.closeAlert?e.x`
9
+ <div class="pkt-alert__close">
10
+ <button
11
+ type="button"
12
+ class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only"
13
+ tabindex="0"
14
+ aria-label="close"
15
+ @click=${this.close}
16
+ >
17
+ <pkt-icon name="close" class="pkt-btn__icon" aria-hidden="true"></pkt-icon>
18
+ </button>
19
+ </div>
20
+ `:e.E}
21
+ ${this.title?e.x`<div class="pkt-alert__title">${this.title}</div>`:e.E}
22
+
23
+ <div class="pkt-alert__text" ${c.n(this.defaultSlot)}></div>
24
+
25
+ ${this.date?e.x`<div class="pkt-alert__date">Sist oppdatert: ${this.date}</div>`:e.E}
26
+ </div>
27
+ `}};s([e.n({type:Boolean,reflect:!1})],exports.PktAlert.prototype,"compact",2);s([e.n({type:String,reflect:!0})],exports.PktAlert.prototype,"title",2);s([e.n({type:String,reflect:!0})],exports.PktAlert.prototype,"skin",2);s([e.n({type:String})],exports.PktAlert.prototype,"ariaLive",2);s([e.n({type:String,reflect:!0})],exports.PktAlert.prototype,"aria-live",2);s([e.n({type:Boolean,reflect:!0})],exports.PktAlert.prototype,"closeAlert",2);s([e.n({type:String,reflect:!0})],exports.PktAlert.prototype,"date",2);s([k.r()],exports.PktAlert.prototype,"_isClosed",2);exports.PktAlert=s([e.t("pkt-alert")],exports.PktAlert);
@@ -3,15 +3,16 @@ import { P as m, x as n, E as u, n as r, a as h } from "./element-D_ZgQsSr.js";
3
3
  import { r as f } from "./state-DuS4ffEQ.js";
4
4
  import { P as v } from "./pkt-slot-controller-Clbye6cM.js";
5
5
  import { e as b, n as y } from "./ref-BSGI8ogR.js";
6
+ import { u as _ } from "./classutils-RQs1k6D9.js";
6
7
  import "./icon-BBFK-d-X.js";
7
- const _ = "pkt-alert", g = !0, C = {
8
+ const C = "pkt-alert", g = !0, $ = {
8
9
  onClose: {
9
10
  description: "React: Klikk-event for 'Lukk'-knappen"
10
11
  },
11
12
  close: {
12
13
  description: "Vue: Klikk-event for 'Lukk'-knappen"
13
14
  }
14
- }, $ = {
15
+ }, L = {
15
16
  title: {
16
17
  name: "Tittel",
17
18
  description: "Tittelen som vises øverst i på meldingen",
@@ -55,23 +56,23 @@ const _ = "pkt-alert", g = !0, C = {
55
56
  type: "boolean",
56
57
  default: !1
57
58
  }
58
- }, L = {
59
+ }, S = {
59
60
  default: {
60
61
  description: "Innholdet i meldingen"
61
62
  }
62
63
  }, p = {
63
- name: _,
64
+ name: C,
64
65
  "css-class": "pkt-alert",
65
66
  "dark-mode": !0,
66
67
  isElement: g,
67
- events: C,
68
- props: $,
69
- slots: L
68
+ events: $,
69
+ props: L,
70
+ slots: S
70
71
  };
71
- var S = Object.defineProperty, P = Object.getOwnPropertyDescriptor, i = (t, a, l, o) => {
72
- for (var s = o > 1 ? void 0 : o ? P(a, l) : a, c = t.length - 1, d; c >= 0; c--)
72
+ var A = Object.defineProperty, E = Object.getOwnPropertyDescriptor, i = (t, a, l, o) => {
73
+ for (var s = o > 1 ? void 0 : o ? E(a, l) : a, c = t.length - 1, d; c >= 0; c--)
73
74
  (d = t[c]) && (s = (o ? d(a, l, s) : d(s)) || s);
74
- return o && s && S(a, l, s), s;
75
+ return o && s && A(a, l, s), s;
75
76
  };
76
77
  let e = class extends m {
77
78
  constructor() {
@@ -83,6 +84,7 @@ let e = class extends m {
83
84
  );
84
85
  }, this.slotController = new v(this, this.defaultSlot), this._isClosed = !1;
85
86
  }
87
+ // Lifecycle
86
88
  connectedCallback() {
87
89
  super.connectedCallback(), this["aria-live"] = this.getAttribute("aria-live") || this.ariaLive;
88
90
  }
@@ -90,8 +92,9 @@ let e = class extends m {
90
92
  t === "ariaLive" && (this["aria-live"] = l), super.attributeChangedCallback(t, a, l);
91
93
  }
92
94
  updated(t) {
93
- super.updated(t), t.has("ariaLive") && (this["aria-live"] = this.ariaLive);
95
+ super.updated(t), t.has("ariaLive") && (this["aria-live"] = this.ariaLive), t.has("_isClosed") && _(this, "pkt-hide", this._isClosed);
94
96
  }
97
+ // Render
95
98
  render() {
96
99
  const t = {
97
100
  "pkt-alert": !0,
@@ -0,0 +1 @@
1
+ "use strict";function a(s,e,i){const r=s.getAttribute("class")||"",t=new Set(r.split(/\s+/).filter(Boolean));i?t.add(e):t.delete(e),s.setAttribute("class",Array.from(t).join(" "))}exports.updateClassAttribute=a;
@@ -0,0 +1,7 @@
1
+ function a(s, e, r) {
2
+ const i = s.getAttribute("class") || "", t = new Set(i.split(/\s+/).filter(Boolean));
3
+ r ? t.add(e) : t.delete(e), s.setAttribute("class", Array.from(t).join(" "));
4
+ }
5
+ export {
6
+ a as u
7
+ };
package/dist/index.d.ts CHANGED
@@ -14,6 +14,16 @@ import { TZDate } from '@date-fns/tz';
14
14
  */
15
15
  declare type ElementProps<Element, PropKeys extends keyof Element> = Partial<Pick<Element, PropKeys>>;
16
16
 
17
+ declare interface IPktAlert {
18
+ skin?: TAlertSkin;
19
+ closeAlert?: boolean;
20
+ title?: string;
21
+ date?: string | null;
22
+ ariaLive?: TAriaLive | null;
23
+ 'aria-live'?: TAriaLive | null;
24
+ compact?: boolean;
25
+ }
26
+
17
27
  export declare interface IPktButton {
18
28
  iconName?: string;
19
29
  secondIconName?: string;
@@ -37,6 +47,13 @@ declare interface IPktLinkCard {
37
47
  skin?: TLinkCardSkin;
38
48
  }
39
49
 
50
+ declare interface IPktMessagebox {
51
+ skin?: TMessageboxSkin;
52
+ title?: string;
53
+ compact?: boolean;
54
+ closable?: boolean;
55
+ }
56
+
40
57
  declare interface IPktModal {
41
58
  headingText?: string;
42
59
  removePadding?: boolean;
@@ -77,25 +94,25 @@ declare interface IPktTag {
77
94
  ariaLabel?: string;
78
95
  }
79
96
 
80
- export declare class PktAlert extends PktElement {
97
+ export declare class PktAlert extends PktElement implements IPktAlert {
81
98
  defaultSlot: Ref<HTMLElement>;
82
99
  constructor();
83
100
  compact: boolean;
84
101
  title: string;
85
102
  skin: TAlertSkin;
86
103
  ariaLive: TAriaLive;
87
- 'aria-live': TAriaLive;
104
+ 'aria-live': TAriaLive | null;
88
105
  closeAlert: boolean;
89
106
  date: string | null;
90
107
  _isClosed: boolean;
91
- private close;
92
108
  connectedCallback(): void;
93
109
  attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
94
110
  protected updated(_changedProperties: PropertyValues): void;
95
111
  render(): TemplateResult<1>;
112
+ private close;
96
113
  }
97
114
 
98
- export declare class PktButton extends PktElement implements IPktButton {
115
+ export declare class PktButton extends PktElement<IPktButton> implements IPktButton {
99
116
  static formAssociated: boolean;
100
117
  private internals;
101
118
  defaultSlot: Ref<HTMLElement>;
@@ -113,7 +130,7 @@ export declare class PktButton extends PktElement implements IPktButton {
113
130
  disabled: boolean;
114
131
  connectedCallback(): void;
115
132
  disconnectedCallback(): void;
116
- updated(changedProps: Map<string | number | symbol, unknown>): void;
133
+ protected updated(_changedProperties: PropertyValues): void;
117
134
  render(): TemplateResult<1>;
118
135
  private updateElementClasses;
119
136
  private handleClick;
@@ -504,7 +521,7 @@ export declare class PktLinkCard extends PktElement implements IPktLinkCard {
504
521
  render(): TemplateResult<1>;
505
522
  }
506
523
 
507
- export declare class PktMessagebox extends PktElement {
524
+ export declare class PktMessagebox extends PktElement implements IPktMessagebox {
508
525
  defaultSlot: Ref<HTMLElement>;
509
526
  constructor();
510
527
  closable: boolean;
@@ -512,8 +529,9 @@ export declare class PktMessagebox extends PktElement {
512
529
  title: string;
513
530
  skin: TMessageboxSkin;
514
531
  _isClosed: boolean;
515
- private close;
532
+ protected updated(_changedProperties: PropertyValues): void;
516
533
  render(): TemplateResult<1>;
534
+ private close;
517
535
  }
518
536
 
519
537
  export declare class PktModal extends PktElement implements IPktModal {
@@ -694,7 +712,7 @@ declare type Props_5 = ElementProps<PktTextinput, 'value' | 'type' | 'size' | 'a
694
712
 
695
713
  declare type TAlertSkin = 'error' | 'success' | 'warning' | 'info';
696
714
 
697
- declare type TAriaLive = 'off' | 'polite' | 'assertive' | null;
715
+ declare type TAriaLive = 'off' | 'polite' | 'assertive';
698
716
 
699
717
  declare type TCardSkin = 'outlined' | 'gray' | 'beige' | 'green' | 'blue';
700
718
 
@@ -0,0 +1,12 @@
1
+ "use strict";const s=require("./element-r-PeQ419.cjs"),b=require("./pkt-slot-controller-Oc32unDk.cjs"),c=require("./ref-BUWgvhgU.cjs"),d=require("./class-map-Dzci3Pfe.cjs"),k=require("./state-B77EXPZ9.cjs");require("./icon-DcJIqTIY.cjs");const u=require("./classutils-BwNK82ZQ.cjs"),m="pkt-messagebox",g=!0,h={onClose:{description:"React: Event som trigges når meldingsboksen lukkes"},"on-close":{description:"Vue: Event som trigges når meldingsboksen lukkes"}},f={title:{name:"Tittel",description:"Tittelen på meldingsboksen",type:"string"},skin:{name:"Utseende",description:"Velg farge på meldingsboksen",type:["beige","blue","red","green"],default:"beige"},compact:{name:"Kompakt",description:"Gjør meldingsboksen mindre",type:"boolean",default:!1},closable:{name:"Kan lukkes",description:"Viser lukkeknapp",type:"boolean",default:!1}},x={default:{description:"Innholdet i meldingsboksen"}},p={name:m,"css-class":"pkt-messagebox",isElement:g,events:h,props:f,slots:x};var v=Object.defineProperty,_=Object.getOwnPropertyDescriptor,o=(i,e,n,l)=>{for(var t=l>1?void 0:l?_(e,n):e,a=i.length-1,r;a>=0;a--)(r=i[a])&&(t=(l?r(e,n,t):r(t))||t);return l&&t&&v(e,n,t),t};exports.PktMessagebox=class extends s.PktElement{constructor(){super(),this.defaultSlot=c.e(),this.closable=p.props.closable.default,this.compact=p.props.compact.default,this.title="",this.skin=p.props.skin.default,this._isClosed=!1,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:e},bubbles:!0}))},this.slotController=new b.PktSlotController(this,this.defaultSlot),this._isClosed=!1}updated(e){super.updated(e),e.has("_isClosed")&&u.updateClassAttribute(this,"pkt-hide",this._isClosed)}render(){const e={"pkt-messagebox":!0,"pkt-messagebox--compact":this.compact,[`pkt-messagebox--${this.skin}`]:this.skin,"pkt-messagebox--closable":this.closable,"pkt-hide":this._isClosed};return s.x`<div class=${d.e(e)}>
2
+ ${this.closable?s.x`<div class="pkt-messagebox__close">
3
+ <button
4
+ @click=${this.close}
5
+ class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only"
6
+ >
7
+ <pkt-icon name="close" class="pkt-link__icon"></pkt-icon>
8
+ </button>
9
+ </div>`:s.E}
10
+ ${this.title?s.x`<div class="pkt-messagebox__title">${this.title}</div>`:s.E}
11
+ <div class="pkt-messagebox__text" ${c.n(this.defaultSlot)}></div>
12
+ </div>`}};o([s.n({type:Boolean,reflect:!0})],exports.PktMessagebox.prototype,"closable",2);o([s.n({type:Boolean,reflect:!0})],exports.PktMessagebox.prototype,"compact",2);o([s.n({type:String,reflect:!0})],exports.PktMessagebox.prototype,"title",2);o([s.n({type:String,reflect:!0})],exports.PktMessagebox.prototype,"skin",2);o([k.r()],exports.PktMessagebox.prototype,"_isClosed",2);exports.PktMessagebox=o([s.t("pkt-messagebox")],exports.PktMessagebox);
@@ -1,17 +1,18 @@
1
- import { P as b, x as c, E as d, n, a as k } from "./element-D_ZgQsSr.js";
2
- import { P as u } from "./pkt-slot-controller-Clbye6cM.js";
3
- import { e as g, n as f } from "./ref-BSGI8ogR.js";
4
- import { e as h } from "./class-map-BYCG9U47.js";
1
+ import { P as b, x as c, E as m, n, a as u } from "./element-D_ZgQsSr.js";
2
+ import { P as k } from "./pkt-slot-controller-Clbye6cM.js";
3
+ import { e as h, n as f } from "./ref-BSGI8ogR.js";
4
+ import { e as g } from "./class-map-BYCG9U47.js";
5
5
  import { r as v } from "./state-DuS4ffEQ.js";
6
6
  import "./icon-BBFK-d-X.js";
7
- const _ = "pkt-messagebox", x = !0, y = {
7
+ import { u as _ } from "./classutils-RQs1k6D9.js";
8
+ const x = "pkt-messagebox", y = !0, C = {
8
9
  onClose: {
9
10
  description: "React: Event som trigges når meldingsboksen lukkes"
10
11
  },
11
12
  "on-close": {
12
13
  description: "Vue: Event som trigges når meldingsboksen lukkes"
13
14
  }
14
- }, C = {
15
+ }, E = {
15
16
  title: {
16
17
  name: "Tittel",
17
18
  description: "Tittelen på meldingsboksen",
@@ -40,29 +41,34 @@ const _ = "pkt-messagebox", x = !0, y = {
40
41
  type: "boolean",
41
42
  default: !1
42
43
  }
43
- }, E = {
44
+ }, P = {
44
45
  default: {
45
46
  description: "Innholdet i meldingsboksen"
46
47
  }
47
- }, m = {
48
- name: _,
48
+ }, d = {
49
+ name: x,
49
50
  "css-class": "pkt-messagebox",
50
- isElement: x,
51
- events: y,
52
- props: C,
53
- slots: E
51
+ isElement: y,
52
+ events: C,
53
+ props: E,
54
+ slots: P
54
55
  };
55
- var P = Object.defineProperty, $ = Object.getOwnPropertyDescriptor, o = (e, l, p, i) => {
56
- for (var t = i > 1 ? void 0 : i ? $(l, p) : l, r = e.length - 1, a; r >= 0; r--)
57
- (a = e[r]) && (t = (i ? a(l, p, t) : a(t)) || t);
58
- return i && t && P(l, p, t), t;
56
+ var $ = Object.defineProperty, S = Object.getOwnPropertyDescriptor, o = (e, i, p, l) => {
57
+ for (var t = l > 1 ? void 0 : l ? S(i, p) : i, a = e.length - 1, r; a >= 0; a--)
58
+ (r = e[a]) && (t = (l ? r(i, p, t) : r(t)) || t);
59
+ return l && t && $(i, p, t), t;
59
60
  };
60
61
  let s = class extends b {
61
62
  constructor() {
62
- super(), this.defaultSlot = g(), this.closable = m.props.closable.default, this.compact = m.props.compact.default, this.title = "", this.skin = m.props.skin.default, this._isClosed = !1, this.close = (e) => {
63
+ super(), this.defaultSlot = h(), this.closable = d.props.closable.default, this.compact = d.props.compact.default, this.title = "", this.skin = d.props.skin.default, this._isClosed = !1, this.close = (e) => {
63
64
  this._isClosed = !0, this.dispatchEvent(new CustomEvent("close", { detail: { origin: e }, bubbles: !0 })), this.dispatchEvent(new CustomEvent("on-close", { detail: { origin: e }, bubbles: !0 }));
64
- }, this.slotController = new u(this, this.defaultSlot), this._isClosed = !1;
65
+ }, this.slotController = new k(this, this.defaultSlot), this._isClosed = !1;
66
+ }
67
+ // Lifecycle
68
+ updated(e) {
69
+ super.updated(e), e.has("_isClosed") && _(this, "pkt-hide", this._isClosed);
65
70
  }
71
+ // Render
66
72
  render() {
67
73
  const e = {
68
74
  "pkt-messagebox": !0,
@@ -71,7 +77,7 @@ let s = class extends b {
71
77
  "pkt-messagebox--closable": this.closable,
72
78
  "pkt-hide": this._isClosed
73
79
  };
74
- return c`<div class=${h(e)}>
80
+ return c`<div class=${g(e)}>
75
81
  ${this.closable ? c`<div class="pkt-messagebox__close">
76
82
  <button
77
83
  @click=${this.close}
@@ -79,8 +85,8 @@ let s = class extends b {
79
85
  >
80
86
  <pkt-icon name="close" class="pkt-link__icon"></pkt-icon>
81
87
  </button>
82
- </div>` : d}
83
- ${this.title ? c`<div class="pkt-messagebox__title">${this.title}</div>` : d}
88
+ </div>` : m}
89
+ ${this.title ? c`<div class="pkt-messagebox__title">${this.title}</div>` : m}
84
90
  <div class="pkt-messagebox__text" ${f(this.defaultSlot)}></div>
85
91
  </div>`;
86
92
  }
@@ -101,7 +107,7 @@ o([
101
107
  v()
102
108
  ], s.prototype, "_isClosed", 2);
103
109
  s = o([
104
- k("pkt-messagebox")
110
+ u("pkt-messagebox")
105
111
  ], s);
106
112
  export {
107
113
  s as P
@@ -12,13 +12,14 @@
12
12
  ${this.headingText}
13
13
  </h1>`:s.E}
14
14
  ${this.hideCloseButton?s.E:s.x`<div class="${d.e(i)}">
15
- <button
15
+ <pkt-button
16
16
  @click=${p=>this.close(p)}
17
17
  class=${d.e(a)}
18
18
  aria-label="close"
19
+ iconname="close"
20
+ variant="icon-only"
19
21
  >
20
- <pkt-icon name="close" class="pkt-link__icon"></pkt-icon>
21
- </button>
22
+ </pkt-button>
22
23
  </div>`}
23
24
  </div>
24
25
  <div class="pkt-modal__container">
@@ -1,5 +1,5 @@
1
1
  import { e as c } from "./class-map-BYCG9U47.js";
2
- import { P as f, x as p, E as k, n as d, a as g } from "./element-D_ZgQsSr.js";
2
+ import { P as f, x as p, E as k, n as r, a as g } from "./element-D_ZgQsSr.js";
3
3
  import { r as v } from "./state-DuS4ffEQ.js";
4
4
  import { P as b } from "./pkt-slot-controller-Clbye6cM.js";
5
5
  import { e as m, n as h } from "./ref-BSGI8ogR.js";
@@ -60,28 +60,28 @@ const y = "pkt-modal", _ = !0, C = {
60
60
  props: B,
61
61
  slots: w
62
62
  };
63
- var E = Object.defineProperty, S = Object.getOwnPropertyDescriptor, l = (t, e, o, s) => {
64
- for (var n = s > 1 ? void 0 : s ? S(e, o) : e, r = t.length - 1, a; r >= 0; r--)
65
- (a = t[r]) && (n = (s ? a(e, o, n) : a(n)) || n);
66
- return s && n && E(e, o, n), n;
63
+ var E = Object.defineProperty, S = Object.getOwnPropertyDescriptor, l = (t, e, o, n) => {
64
+ for (var s = n > 1 ? void 0 : n ? S(e, o) : e, d = t.length - 1, a; d >= 0; d--)
65
+ (a = t[d]) && (s = (n ? a(e, o, s) : a(s)) || s);
66
+ return n && s && E(e, o, s), s;
67
67
  };
68
68
  let i = class extends f {
69
69
  constructor() {
70
70
  super(), this.headingText = "", this.removePadding = !1, this.hideCloseButton = u.props.hideCloseButton.default, this.closeOnBackdropClick = u.props.closeOnBackdropClick.default, this.closeButtonSkin = "blue", this.size = u.props.size.default, this.defaultSlot = m(), this.dialogRef = m(), this._isOpen = !1, this.close = (t, e = !1) => {
71
- var s;
71
+ var n;
72
72
  if (!this._isOpen) return;
73
73
  this._isOpen = !1, document.body.classList.remove("pkt-modal--open");
74
74
  const o = document.activeElement;
75
75
  o && !this.isElementInViewport(o) && o.scrollIntoView({ behavior: "smooth", block: "nearest" }), this.dispatchEvent(
76
76
  new CustomEvent("close", { detail: { origin: t }, bubbles: !0, composed: !0 })
77
- ), e || (s = this.dialogRef.value) == null || s.close(), this.requestUpdate();
77
+ ), e || (n = this.dialogRef.value) == null || n.close(), this.requestUpdate();
78
78
  }, this.showModal = (t) => {
79
79
  var o;
80
80
  this._isOpen = !0, (o = this.dialogRef.value) == null || o.showModal();
81
81
  const e = document.querySelector(".pkt-modal");
82
82
  requestAnimationFrame(() => {
83
- var s;
84
- this.dialogRef.value && ((s = this.dialogRef.value) == null || s.focus());
83
+ var n;
84
+ this.dialogRef.value && ((n = this.dialogRef.value) == null || n.focus());
85
85
  }), e && document.body.classList.add("pkt-modal--open"), this.dispatchEvent(
86
86
  new CustomEvent("showModal", { detail: { origin: t }, bubbles: !0, composed: !0 })
87
87
  ), this.requestUpdate();
@@ -117,12 +117,12 @@ let i = class extends f {
117
117
  }, o = {
118
118
  "pkt-modal__content": !0,
119
119
  "pkt-txt-18-light": !0
120
- }, s = this.closeButtonSkin === "blue", n = {
120
+ }, n = this.closeButtonSkin === "blue", s = {
121
121
  "pkt-modal__closeButton": !0,
122
122
  [`pkt-modal__closeButton--${this.closeButtonSkin}`]: !0
123
- }, r = {
123
+ }, d = {
124
124
  "pkt-btn": !0,
125
- [`pkt-btn--${s ? "tertiary" : "primary"}`]: !0,
125
+ [`pkt-btn--${n ? "tertiary" : "primary"}`]: !0,
126
126
  "pkt-btn--icon-only": !0,
127
127
  "pkt-btn--medium": !0
128
128
  };
@@ -139,14 +139,15 @@ let i = class extends f {
139
139
  ${this.headingText ? p`<h1 id="pkt-modal__headingText" class=${c(e)}>
140
140
  ${this.headingText}
141
141
  </h1>` : k}
142
- ${this.hideCloseButton ? k : p`<div class="${c(n)}">
143
- <button
142
+ ${this.hideCloseButton ? k : p`<div class="${c(s)}">
143
+ <pkt-button
144
144
  @click=${(a) => this.close(a)}
145
- class=${c(r)}
145
+ class=${c(d)}
146
146
  aria-label="close"
147
+ iconname="close"
148
+ variant="icon-only"
147
149
  >
148
- <pkt-icon name="close" class="pkt-link__icon"></pkt-icon>
149
- </button>
150
+ </pkt-button>
150
151
  </div>`}
151
152
  </div>
152
153
  <div class="pkt-modal__container">
@@ -161,22 +162,22 @@ let i = class extends f {
161
162
  }
162
163
  };
163
164
  l([
164
- d({ type: String, reflect: !0 })
165
+ r({ type: String, reflect: !0 })
165
166
  ], i.prototype, "headingText", 2);
166
167
  l([
167
- d({ type: Boolean, reflect: !0 })
168
+ r({ type: Boolean, reflect: !0 })
168
169
  ], i.prototype, "removePadding", 2);
169
170
  l([
170
- d({ type: Boolean, reflect: !0 })
171
+ r({ type: Boolean, reflect: !0 })
171
172
  ], i.prototype, "hideCloseButton", 2);
172
173
  l([
173
- d({ type: Boolean, reflect: !0 })
174
+ r({ type: Boolean, reflect: !0 })
174
175
  ], i.prototype, "closeOnBackdropClick", 2);
175
176
  l([
176
- d({ type: String, reflect: !0 })
177
+ r({ type: String, reflect: !0 })
177
178
  ], i.prototype, "closeButtonSkin", 2);
178
179
  l([
179
- d({ type: String, reflect: !0 })
180
+ r({ type: String, reflect: !0 })
180
181
  ], i.prototype, "size", 2);
181
182
  l([
182
183
  v()
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./alert-Cx7AYawa.cjs"),t=e.PktAlert;Object.defineProperty(exports,"PktAlert",{enumerable:!0,get:()=>e.PktAlert});exports.default=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./alert-CP5oN7df.cjs"),t=e.PktAlert;Object.defineProperty(exports,"PktAlert",{enumerable:!0,get:()=>e.PktAlert});exports.default=t;
package/dist/pkt-alert.js CHANGED
@@ -1,4 +1,4 @@
1
- import { P as t } from "./alert-C_FCsFfo.js";
1
+ import { P as t } from "./alert-CugVni4g.js";
2
2
  const e = t;
3
3
  export {
4
4
  t as PktAlert,
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./alert-Cx7AYawa.cjs"),d=require("./button-DPb5WL9h.cjs"),c=require("./calendar-DUkAC9Hx.cjs"),k=require("./card-Bxe-jQD_.cjs"),P=require("./checkbox-CDMUepTW.cjs"),t=require("./element-r-PeQ419.cjs"),b=require("./pkt-slot-controller-Oc32unDk.cjs"),i=require("./ref-BUWgvhgU.cjs"),h=require("./class-map-Dzci3Pfe.cjs"),m=require("./datepicker-D6ifQ2so.cjs"),g=require("./helptext-C0mrdhRi.cjs"),f=require("./icon-DcJIqTIY.cjs"),y=require("./input-wrapper-Dqj4uers.cjs"),x=require("./link-C_bwx1Ml.cjs"),C=require("./linkcard-C6mZOE0R.cjs"),O=require("./messagebox-DJzOyZwE.cjs"),j=require("./modal-CV3LSNHb.cjs"),q=require("./progressbar-C_q48_qh.cjs"),v=require("./radiobutton-3e105CXX.cjs"),S=require("./tag-BMyii4Da.cjs"),$=require("./textarea-DxpzI67n.cjs"),_=require("./textinput-BRupcl9v.cjs"),T=require("./select-DJu4Wr1y.cjs");var L=Object.defineProperty,M=Object.getOwnPropertyDescriptor,o=(a,e,r,s)=>{for(var n=s>1?void 0:s?M(e,r):e,l=a.length-1,u;l>=0;l--)(u=a[l])&&(n=(s?u(e,r,n):u(n))||n);return s&&n&&L(e,r,n),n};exports.PktComponent=class extends t.PktElement{constructor(){super(),this.string="",this.strings=[],this.darkmode=!1,this._list=[],this.defaultSlot=i.e(),this.namedSlot=i.e(),this.slotController=new b.PktSlotController(this,this.defaultSlot,this.namedSlot)}connectedCallback(){this.strings.length&&this.strings.forEach(e=>{this._list.push(e.toUpperCase())}),super.connectedCallback()}render(){const e={"pkt-component":!0,"pkt-component--has-list":this.strings.length>0,"pkt-darkmode":this.darkmode};return t.x`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./alert-CP5oN7df.cjs"),d=require("./button-DPb5WL9h.cjs"),c=require("./calendar-DUkAC9Hx.cjs"),k=require("./card-Bxe-jQD_.cjs"),P=require("./checkbox-CDMUepTW.cjs"),t=require("./element-r-PeQ419.cjs"),b=require("./pkt-slot-controller-Oc32unDk.cjs"),i=require("./ref-BUWgvhgU.cjs"),h=require("./class-map-Dzci3Pfe.cjs"),m=require("./datepicker-D6ifQ2so.cjs"),g=require("./helptext-C0mrdhRi.cjs"),f=require("./icon-DcJIqTIY.cjs"),y=require("./input-wrapper-Dqj4uers.cjs"),x=require("./link-C_bwx1Ml.cjs"),C=require("./linkcard-C6mZOE0R.cjs"),O=require("./messagebox-BSyLVNas.cjs"),j=require("./modal-CblCiNUi.cjs"),q=require("./progressbar-C_q48_qh.cjs"),v=require("./radiobutton-3e105CXX.cjs"),S=require("./tag-BMyii4Da.cjs"),$=require("./textarea-DxpzI67n.cjs"),_=require("./textinput-BRupcl9v.cjs"),T=require("./select-DJu4Wr1y.cjs");var L=Object.defineProperty,M=Object.getOwnPropertyDescriptor,o=(a,e,r,s)=>{for(var n=s>1?void 0:s?M(e,r):e,l=a.length-1,u;l>=0;l--)(u=a[l])&&(n=(s?u(e,r,n):u(n))||n);return s&&n&&L(e,r,n),n};exports.PktComponent=class extends t.PktElement{constructor(){super(),this.string="",this.strings=[],this.darkmode=!1,this._list=[],this.defaultSlot=i.e(),this.namedSlot=i.e(),this.slotController=new b.PktSlotController(this,this.defaultSlot,this.namedSlot)}connectedCallback(){this.strings.length&&this.strings.forEach(e=>{this._list.push(e.toUpperCase())}),super.connectedCallback()}render(){const e={"pkt-component":!0,"pkt-component--has-list":this.strings.length>0,"pkt-darkmode":this.darkmode};return t.x`
2
2
  <div class="${h.e(e)}">
3
3
  <h1 class="pkt-txt-28">${this.string}</h1>
4
4
 
package/dist/pkt-index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { P as w } from "./alert-C_FCsFfo.js";
1
+ import { P as w } from "./alert-CugVni4g.js";
2
2
  import { P as O } from "./button-BnmFhao8.js";
3
3
  import { c as d } from "./calendar-DevhqUoj.js";
4
4
  import { P as j } from "./calendar-DevhqUoj.js";
@@ -14,8 +14,8 @@ import { P as N } from "./icon-BBFK-d-X.js";
14
14
  import { P as W } from "./input-wrapper-D-pEAZaj.js";
15
15
  import { P as z } from "./link-CDkU7zsB.js";
16
16
  import { P as J } from "./linkcard-Dr5iKZrV.js";
17
- import { P as V } from "./messagebox-BgLZ5zul.js";
18
- import { P as Y } from "./modal-CnSYSYsQ.js";
17
+ import { P as V } from "./messagebox-Di7LUz4C.js";
18
+ import { P as Y } from "./modal-DZUQb_yG.js";
19
19
  import { P as tt } from "./progressbar-CuZj4FWi.js";
20
20
  import { P as rt } from "./radiobutton-CcZ2-z8q.js";
21
21
  import { P as ot } from "./tag-DVk69673.js";
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./messagebox-DJzOyZwE.cjs"),t=e.PktMessagebox;Object.defineProperty(exports,"PktMessagebox",{enumerable:!0,get:()=>e.PktMessagebox});exports.default=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./messagebox-BSyLVNas.cjs"),t=e.PktMessagebox;Object.defineProperty(exports,"PktMessagebox",{enumerable:!0,get:()=>e.PktMessagebox});exports.default=t;
@@ -1,4 +1,4 @@
1
- import { P as s } from "./messagebox-BgLZ5zul.js";
1
+ import { P as s } from "./messagebox-Di7LUz4C.js";
2
2
  const a = s;
3
3
  export {
4
4
  s as PktMessagebox,
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./modal-CV3LSNHb.cjs"),t=e.PktModal;Object.defineProperty(exports,"PktModal",{enumerable:!0,get:()=>e.PktModal});exports.default=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./modal-CblCiNUi.cjs"),t=e.PktModal;Object.defineProperty(exports,"PktModal",{enumerable:!0,get:()=>e.PktModal});exports.default=t;
package/dist/pkt-modal.js CHANGED
@@ -1,4 +1,4 @@
1
- import { P as a } from "./modal-CnSYSYsQ.js";
1
+ import { P as a } from "./modal-DZUQb_yG.js";
2
2
  const t = a;
3
3
  export {
4
4
  a as PktModal,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-elements",
3
- "version": "12.29.0",
3
+ "version": "12.29.2",
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": "2f85764bd3da7652eacddf71afb9ab9f0ff652d4"
60
+ "gitHead": "bba55044dd965cd3cab5a32614be5a600b02b2ed"
61
61
  }
@@ -5,7 +5,7 @@ import { PktElement } from '@/base-elements/element'
5
5
  import { PktSlotController } from '@/controllers/pkt-slot-controller'
6
6
  import { ref, createRef, Ref } from 'lit/directives/ref.js'
7
7
  import { TAriaLive } from '@/types/aria'
8
-
8
+ import { updateClassAttribute } from '@/utils/classutils'
9
9
  import specs from 'componentSpecs/alert.json'
10
10
 
11
11
  import '@/components/icon'
@@ -16,13 +16,13 @@ export interface IPktAlert {
16
16
  skin?: TAlertSkin
17
17
  closeAlert?: boolean
18
18
  title?: string
19
- date?: string
20
- ariaLive?: TAriaLive
21
- 'aria-live'?: TAriaLive
19
+ date?: string | null
20
+ ariaLive?: TAriaLive | null
21
+ 'aria-live'?: TAriaLive | null
22
22
  compact?: boolean
23
23
  }
24
24
  @customElement('pkt-alert')
25
- export class PktAlert extends PktElement {
25
+ export class PktAlert extends PktElement implements IPktAlert {
26
26
  defaultSlot: Ref<HTMLElement> = createRef()
27
27
 
28
28
  constructor() {
@@ -31,27 +31,20 @@ export class PktAlert extends PktElement {
31
31
  this._isClosed = false
32
32
  }
33
33
 
34
+ // Properties
35
+
34
36
  @property({ type: Boolean, reflect: false }) compact = specs.props.compact.default
35
37
  @property({ type: String, reflect: true }) title: string = ''
36
38
  @property({ type: String, reflect: true }) skin: TAlertSkin = specs.props.skin
37
39
  .default as TAlertSkin
38
40
  @property({ type: String }) ariaLive: TAriaLive = specs.props.ariaLive.default as TAriaLive
39
- @property({ type: String, reflect: true }) 'aria-live': TAriaLive = null
41
+ @property({ type: String, reflect: true }) 'aria-live': TAriaLive | null = null
40
42
  @property({ type: Boolean, reflect: true }) closeAlert = specs.props.closeAlert.default
41
43
  @property({ type: String, reflect: true }) date: string | null = null
42
44
 
43
45
  @state() _isClosed: boolean = false
44
46
 
45
- private close = (event: MouseEvent) => {
46
- this._isClosed = true
47
- this.dispatchEvent(
48
- new CustomEvent('close', { detail: { origin: event }, bubbles: true, composed: true }),
49
- )
50
- // Historical support of old Vue implementations…
51
- this.dispatchEvent(
52
- new CustomEvent('on-close', { detail: { origin: event }, bubbles: true, composed: true }),
53
- )
54
- }
47
+ // Lifecycle
55
48
 
56
49
  connectedCallback(): void {
57
50
  super.connectedCallback()
@@ -70,8 +63,13 @@ export class PktAlert extends PktElement {
70
63
  if (_changedProperties.has('ariaLive')) {
71
64
  this['aria-live'] = this.ariaLive
72
65
  }
66
+ if (_changedProperties.has('_isClosed')) {
67
+ updateClassAttribute(this, 'pkt-hide', this._isClosed)
68
+ }
73
69
  }
74
70
 
71
+ // Render
72
+
75
73
  render() {
76
74
  const classes = {
77
75
  'pkt-alert': true,
@@ -112,4 +110,17 @@ export class PktAlert extends PktElement {
112
110
  </div>
113
111
  `
114
112
  }
113
+
114
+ // Methods
115
+
116
+ private close = (event: MouseEvent) => {
117
+ this._isClosed = true
118
+ this.dispatchEvent(
119
+ new CustomEvent('close', { detail: { origin: event }, bubbles: true, composed: true }),
120
+ )
121
+ // Historical support of old Vue implementations…
122
+ this.dispatchEvent(
123
+ new CustomEvent('on-close', { detail: { origin: event }, bubbles: true, composed: true }),
124
+ )
125
+ }
115
126
  }
@@ -1,6 +1,6 @@
1
1
  import { PktElement } from '@/base-elements/element'
2
2
  import { PktSlotController } from '@/controllers/pkt-slot-controller'
3
- import { html, nothing } from 'lit'
3
+ import { html, nothing, PropertyValues } from 'lit'
4
4
  import { property, customElement } from 'lit/decorators.js'
5
5
  import { createRef, Ref, ref } from 'lit/directives/ref.js'
6
6
 
@@ -43,7 +43,7 @@ export interface IPktButton {
43
43
  disabled?: boolean
44
44
  }
45
45
  @customElement('pkt-button')
46
- export class PktButton extends PktElement implements IPktButton {
46
+ export class PktButton extends PktElement<IPktButton> implements IPktButton {
47
47
  static formAssociated = true
48
48
  private internals = this.attachInternals()
49
49
  defaultSlot: Ref<HTMLElement> = createRef()
@@ -80,8 +80,8 @@ export class PktButton extends PktElement implements IPktButton {
80
80
  this.removeEventListener('keydown', this.handleKeydown as EventListener)
81
81
  }
82
82
 
83
- updated(changedProps: Map<string | number | symbol, unknown>) {
84
- super.updated(changedProps)
83
+ protected updated(_changedProperties: PropertyValues): void {
84
+ super.updated(_changedProperties)
85
85
 
86
86
  this.setAttribute('role', 'button')
87
87
 
@@ -100,7 +100,6 @@ export class PktButton extends PktElement implements IPktButton {
100
100
  this.setAttribute('aria-disabled', 'false')
101
101
  }
102
102
  }
103
-
104
103
  if (this.isLoading) {
105
104
  if (this.getAttribute('aria-busy') !== 'true') {
106
105
  this.setAttribute('aria-busy', 'true')
@@ -2,12 +2,13 @@ import { PktElement } from '@/base-elements/element'
2
2
  import { PktSlotController } from '@/controllers/pkt-slot-controller'
3
3
  import { ref } from 'lit/directives/ref.js'
4
4
  import { Ref, createRef } from 'lit/directives/ref.js'
5
- import { html, nothing } from 'lit'
5
+ import { html, nothing, PropertyValues } from 'lit'
6
6
  import { classMap } from 'lit/directives/class-map.js'
7
7
  import { customElement, property, state } from 'lit/decorators.js'
8
8
  import specs from 'componentSpecs/messagebox.json'
9
9
 
10
10
  import '@/components/icon'
11
+ import { updateClassAttribute } from '@/utils/classutils'
11
12
 
12
13
  export type TMessageboxSkin = 'beige' | 'blue' | 'red' | 'green'
13
14
 
@@ -19,7 +20,7 @@ export interface IPktMessagebox {
19
20
  }
20
21
 
21
22
  @customElement('pkt-messagebox')
22
- export class PktMessagebox extends PktElement {
23
+ export class PktMessagebox extends PktElement implements IPktMessagebox {
23
24
  defaultSlot: Ref<HTMLElement> = createRef()
24
25
 
25
26
  constructor() {
@@ -28,6 +29,8 @@ export class PktMessagebox extends PktElement {
28
29
  this._isClosed = false
29
30
  }
30
31
 
32
+ // Properties
33
+
31
34
  @property({ type: Boolean, reflect: true }) closable = specs.props.closable.default
32
35
  @property({ type: Boolean, reflect: true }) compact = specs.props.compact.default
33
36
  @property({ type: String, reflect: true }) title = ''
@@ -35,13 +38,18 @@ export class PktMessagebox extends PktElement {
35
38
 
36
39
  @state() _isClosed: boolean = false
37
40
 
38
- private close = (event: MouseEvent) => {
39
- this._isClosed = true
40
- this.dispatchEvent(new CustomEvent('close', { detail: { origin: event }, bubbles: true }))
41
- // Historical support of old Vue implementations…
42
- this.dispatchEvent(new CustomEvent('on-close', { detail: { origin: event }, bubbles: true }))
41
+ // Lifecycle
42
+
43
+ protected updated(_changedProperties: PropertyValues): void {
44
+ super.updated(_changedProperties)
45
+
46
+ if (_changedProperties.has('_isClosed')) {
47
+ updateClassAttribute(this, 'pkt-hide', this._isClosed)
48
+ }
43
49
  }
44
50
 
51
+ // Render
52
+
45
53
  render() {
46
54
  const classes = {
47
55
  'pkt-messagebox': true,
@@ -66,4 +74,12 @@ export class PktMessagebox extends PktElement {
66
74
  <div class="pkt-messagebox__text" ${ref(this.defaultSlot)}></div>
67
75
  </div>`
68
76
  }
77
+
78
+ // Methods
79
+ private close = (event: MouseEvent) => {
80
+ this._isClosed = true
81
+ this.dispatchEvent(new CustomEvent('close', { detail: { origin: event }, bubbles: true }))
82
+ // Historical support of old Vue implementations…
83
+ this.dispatchEvent(new CustomEvent('on-close', { detail: { origin: event }, bubbles: true }))
84
+ }
69
85
  }
@@ -166,13 +166,14 @@ export class PktModal extends PktElement implements IPktModal {
166
166
  : nothing}
167
167
  ${!this.hideCloseButton
168
168
  ? html`<div class="${classMap(closeButtonClasses)}">
169
- <button
169
+ <pkt-button
170
170
  @click=${(event: Event) => this.close(event)}
171
171
  class=${classMap(buttonClasses)}
172
172
  aria-label="close"
173
+ iconname="close"
174
+ variant="icon-only"
173
175
  >
174
- <pkt-icon name="close" class="pkt-link__icon"></pkt-icon>
175
- </button>
176
+ </pkt-button>
176
177
  </div>`
177
178
  : nothing}
178
179
  </div>
@@ -1,27 +0,0 @@
1
- "use strict";const d=require("./class-map-Dzci3Pfe.cjs"),t=require("./element-r-PeQ419.cjs"),k=require("./state-B77EXPZ9.cjs"),u=require("./pkt-slot-controller-Oc32unDk.cjs"),c=require("./ref-BUWgvhgU.cjs");require("./icon-DcJIqTIY.cjs");const h="pkt-alert",v=!0,f={onClose:{description:"React: Klikk-event for 'Lukk'-knappen"},close:{description:"Vue: Klikk-event for 'Lukk'-knappen"}},m={title:{name:"Tittel",description:"Tittelen som vises øverst i på meldingen",type:"string"},skin:{name:"Utseende",description:"Hvordan type melding er dette?",type:["info","success","warning","error"],default:"info"},date:{name:"Sist oppdatert",description:"Dato som vises nederst i på meldingen",type:"string"},ariaLive:{name:"aria-live",description:"Hvordan skal skjermleseren lese opp meldingen?",type:["off","polite","assertive"],default:"polite"},compact:{name:"Kompakt",description:"Gjør meldingen mindre",type:"boolean",default:!1},closeAlert:{name:"Vis 'Lukk'-knapp",description:"Viser 'Lukk'-knappen",type:"boolean",default:!1}},b={default:{description:"Innholdet i meldingen"}},n={name:h,"css-class":"pkt-alert","dark-mode":!0,isElement:v,events:f,props:m,slots:b};var y=Object.defineProperty,_=Object.getOwnPropertyDescriptor,i=(a,e,l,s)=>{for(var r=s>1?void 0:s?_(e,l):e,o=a.length-1,p;o>=0;o--)(p=a[o])&&(r=(s?p(e,l,r):p(r))||r);return s&&r&&y(e,l,r),r};exports.PktAlert=class extends t.PktElement{constructor(){super(),this.defaultSlot=c.e(),this.compact=n.props.compact.default,this.title="",this.skin=n.props.skin.default,this.ariaLive=n.props.ariaLive.default,this["aria-live"]=null,this.closeAlert=n.props.closeAlert.default,this.date=null,this._isClosed=!1,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:e},bubbles:!0,composed:!0}))},this.slotController=new u.PktSlotController(this,this.defaultSlot),this._isClosed=!1}connectedCallback(){super.connectedCallback(),this["aria-live"]=this.getAttribute("aria-live")||this.ariaLive}attributeChangedCallback(e,l,s){e==="ariaLive"&&(this["aria-live"]=s),super.attributeChangedCallback(e,l,s)}updated(e){super.updated(e),e.has("ariaLive")&&(this["aria-live"]=this.ariaLive)}render(){const e={"pkt-alert":!0,"pkt-alert--compact":this.compact,[`pkt-alert--${this.skin}`]:this.skin,"pkt-hide":this._isClosed};return t.x`
2
- <div class=${d.e(e)}>
3
- <pkt-icon
4
- class="pkt-alert__icon"
5
- name=${this.skin==="info"?"alert-information":`alert-${this.skin}`}
6
- ></pkt-icon>
7
-
8
- ${this.closeAlert?t.x`
9
- <div class="pkt-alert__close">
10
- <button
11
- type="button"
12
- class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only"
13
- tabindex="0"
14
- aria-label="close"
15
- @click=${this.close}
16
- >
17
- <pkt-icon name="close" class="pkt-btn__icon" aria-hidden="true"></pkt-icon>
18
- </button>
19
- </div>
20
- `:t.E}
21
- ${this.title?t.x`<div class="pkt-alert__title">${this.title}</div>`:t.E}
22
-
23
- <div class="pkt-alert__text" ${c.n(this.defaultSlot)}></div>
24
-
25
- ${this.date?t.x`<div class="pkt-alert__date">Sist oppdatert: ${this.date}</div>`:t.E}
26
- </div>
27
- `}};i([t.n({type:Boolean,reflect:!1})],exports.PktAlert.prototype,"compact",2);i([t.n({type:String,reflect:!0})],exports.PktAlert.prototype,"title",2);i([t.n({type:String,reflect:!0})],exports.PktAlert.prototype,"skin",2);i([t.n({type:String})],exports.PktAlert.prototype,"ariaLive",2);i([t.n({type:String,reflect:!0})],exports.PktAlert.prototype,"aria-live",2);i([t.n({type:Boolean,reflect:!0})],exports.PktAlert.prototype,"closeAlert",2);i([t.n({type:String,reflect:!0})],exports.PktAlert.prototype,"date",2);i([k.r()],exports.PktAlert.prototype,"_isClosed",2);exports.PktAlert=i([t.t("pkt-alert")],exports.PktAlert);
@@ -1,12 +0,0 @@
1
- "use strict";const e=require("./element-r-PeQ419.cjs"),b=require("./pkt-slot-controller-Oc32unDk.cjs"),p=require("./ref-BUWgvhgU.cjs"),k=require("./class-map-Dzci3Pfe.cjs"),d=require("./state-B77EXPZ9.cjs");require("./icon-DcJIqTIY.cjs");const u="pkt-messagebox",m=!0,g={onClose:{description:"React: Event som trigges når meldingsboksen lukkes"},"on-close":{description:"Vue: Event som trigges når meldingsboksen lukkes"}},h={title:{name:"Tittel",description:"Tittelen på meldingsboksen",type:"string"},skin:{name:"Utseende",description:"Velg farge på meldingsboksen",type:["beige","blue","red","green"],default:"beige"},compact:{name:"Kompakt",description:"Gjør meldingsboksen mindre",type:"boolean",default:!1},closable:{name:"Kan lukkes",description:"Viser lukkeknapp",type:"boolean",default:!1}},f={default:{description:"Innholdet i meldingsboksen"}},c={name:u,"css-class":"pkt-messagebox",isElement:m,events:g,props:h,slots:f};var x=Object.defineProperty,v=Object.getOwnPropertyDescriptor,o=(i,t,n,l)=>{for(var s=l>1?void 0:l?v(t,n):t,r=i.length-1,a;r>=0;r--)(a=i[r])&&(s=(l?a(t,n,s):a(s))||s);return l&&s&&x(t,n,s),s};exports.PktMessagebox=class extends e.PktElement{constructor(){super(),this.defaultSlot=p.e(),this.closable=c.props.closable.default,this.compact=c.props.compact.default,this.title="",this.skin=c.props.skin.default,this._isClosed=!1,this.close=t=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:t},bubbles:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:t},bubbles:!0}))},this.slotController=new b.PktSlotController(this,this.defaultSlot),this._isClosed=!1}render(){const t={"pkt-messagebox":!0,"pkt-messagebox--compact":this.compact,[`pkt-messagebox--${this.skin}`]:this.skin,"pkt-messagebox--closable":this.closable,"pkt-hide":this._isClosed};return e.x`<div class=${k.e(t)}>
2
- ${this.closable?e.x`<div class="pkt-messagebox__close">
3
- <button
4
- @click=${this.close}
5
- class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only"
6
- >
7
- <pkt-icon name="close" class="pkt-link__icon"></pkt-icon>
8
- </button>
9
- </div>`:e.E}
10
- ${this.title?e.x`<div class="pkt-messagebox__title">${this.title}</div>`:e.E}
11
- <div class="pkt-messagebox__text" ${p.n(this.defaultSlot)}></div>
12
- </div>`}};o([e.n({type:Boolean,reflect:!0})],exports.PktMessagebox.prototype,"closable",2);o([e.n({type:Boolean,reflect:!0})],exports.PktMessagebox.prototype,"compact",2);o([e.n({type:String,reflect:!0})],exports.PktMessagebox.prototype,"title",2);o([e.n({type:String,reflect:!0})],exports.PktMessagebox.prototype,"skin",2);o([d.r()],exports.PktMessagebox.prototype,"_isClosed",2);exports.PktMessagebox=o([e.t("pkt-messagebox")],exports.PktMessagebox);