@oslokommune/punkt-elements 12.37.3 → 12.37.4
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.
- package/CHANGELOG.md +17 -0
- package/dist/button-C1cqSjK2.cjs +12 -0
- package/dist/{button-sf_Yzx3X.js → button-DoVwr7W4.js} +45 -39
- package/dist/{consent-CTX9zf81.js → consent-D_uOqrp2.js} +1 -1
- package/dist/{consent-BNY1XvpV.cjs → consent-HOme2Fjt.cjs} +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +1 -1
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +2 -2
- package/package.json +2 -2
- package/src/components/button/button.ts +36 -6
- package/dist/button-jdMbbn-e.cjs +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,23 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [12.37.4](https://github.com/oslokommune/punkt/compare/12.37.3...12.37.4) (2025-05-12)
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
Ingen
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
Ingen
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
Ingen
|
|
18
|
+
|
|
19
|
+
### Chores
|
|
20
|
+
Ingen
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
|
|
8
25
|
## [12.37.3](https://github.com/oslokommune/punkt/compare/12.37.2...12.37.3) (2025-05-09)
|
|
9
26
|
|
|
10
27
|
### ⚠ BREAKING CHANGES
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";const i=require("./element-BSypUpzA.cjs"),h=require("./pkt-slot-controller-Da-RgXfS.cjs"),d=require("./ref-BvbyvXRH.cjs");var p=Object.defineProperty,u=Object.getOwnPropertyDescriptor,e=(o,t,s,n)=>{for(var a=n>1?void 0:n?u(t,s):t,r=o.length-1,l;r>=0;r--)(l=o[r])&&(a=(n?l(t,s,a):l(a))||a);return n&&a&&p(t,s,a),a};exports.PktButton=class extends i.PktElement{constructor(){super(),this.internals=this.attachInternals(),this.defaultSlot=d.e(),this.iconName="user",this.secondIconName="user",this.mode="light",this.size="medium",this.skin="primary",this.variant="label-only",this.state="normal",this.type="button",this.isLoading=!1,this.disabled=!1,this.slotController=new h.PktSlotController(this,this.defaultSlot),this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this.handleClick),this.removeEventListener("keydown",this.handleKeydown)}attributeChangedCallback(t,s,n){super.attributeChangedCallback(t,s,n),t==="disabled"&&n==="false"&&(this.disabled=!1),(t==="isloading"||t==="isLoading")&&n==="false"&&(this.isLoading=!1)}firstUpdated(t){super.firstUpdated(t),this.disabled==="false"&&(this.disabled=!1),this.isLoading==="false"&&(this.isLoading=!1)}updated(t){super.updated(t),this.setAttribute("role","button"),this.internals.role="button",this.disabled==="false"&&(this.disabled=!1),this.isLoading==="false"&&(this.isLoading=!1),this.disabled?(this.getAttribute("tabindex")!=="-1"&&this.setAttribute("tabindex","-1"),this.getAttribute("aria-disabled")!=="true"&&this.setAttribute("aria-disabled","true")):(this.getAttribute("tabindex")!=="0"&&this.setAttribute("tabindex","0"),this.getAttribute("aria-disabled")!=="false"&&this.removeAttribute("aria-disabled")),this.isLoading?this.getAttribute("aria-busy")!=="true"&&this.setAttribute("aria-busy","true"):this.hasAttribute("aria-busy")&&this.removeAttribute("aria-busy"),this.updateElementClasses()}render(){return i.x`
|
|
2
|
+
<div class="pkt-contents">
|
|
3
|
+
${this.isLoading?i.x`<pkt-icon
|
|
4
|
+
class="pkt-btn__icon pkt-btn__spinner"
|
|
5
|
+
name="spinner-blue"
|
|
6
|
+
path="https://punkt-cdn.oslo.kommune.no/latest/animations/"
|
|
7
|
+
></pkt-icon>`:i.E}
|
|
8
|
+
${this.variant!=="label-only"?i.x`<pkt-icon class="pkt-btn__icon pkt-icon" name=${this.iconName}></pkt-icon>`:i.E}
|
|
9
|
+
<span class="pkt-btn__text" ${d.n(this.defaultSlot)}></span>
|
|
10
|
+
${this.variant==="icons-right-and-left"?i.x`<pkt-icon class="pkt-btn__icon" name=${this.secondIconName}></pkt-icon>`:i.E}
|
|
11
|
+
</div>
|
|
12
|
+
`}updateElementClasses(){const t=new Set,s=this.getAttribute("class");t.add("pkt-btn"),s&&s.split(" ").forEach(n=>t.add(n)),this.size&&t.add(`pkt-btn--${this.size}`),this.skin&&t.add(`pkt-btn--${this.skin}`),this.variant&&t.add(`pkt-btn--${this.variant}`),this.color&&t.add(`pkt-btn--${this.color}`),this.isLoading&&t.add("pkt-btn--active"),this.state&&t.add(`pkt-btn--${this.state}`),this.disabled&&t.add("pkt-btn--disabled"),this.className=[...t].join(" ")}handleClick(t){if(this.disabled||this.isLoading){t.preventDefault(),t.stopImmediatePropagation();return}if(this.type==="submit"&&this.internals.form){this.internals.form.requestSubmit(this);return}if(this.type==="reset"&&this.internals.form){this.internals.form.reset();return}this.onClick&&typeof this.onClick=="function"&&this.onClick!==this.handleClick&&this.onClick(t),this.dispatchEvent(new CustomEvent("button-click",{bubbles:!0,composed:!0,detail:{originalEvent:t}}))}handleKeydown(t){if(!(this.disabled||this.isLoading)&&(t.key==="Enter"||t.key===" ")){t.preventDefault();const s=t.target;s&&s.click()}}};exports.PktButton.formAssociated=!0;e([i.n({type:String})],exports.PktButton.prototype,"iconName",2);e([i.n({type:String})],exports.PktButton.prototype,"secondIconName",2);e([i.n({type:String})],exports.PktButton.prototype,"mode",2);e([i.n({type:String})],exports.PktButton.prototype,"size",2);e([i.n({type:String})],exports.PktButton.prototype,"color",2);e([i.n({type:String})],exports.PktButton.prototype,"skin",2);e([i.n({type:String})],exports.PktButton.prototype,"variant",2);e([i.n({type:String})],exports.PktButton.prototype,"state",2);e([i.n({type:String,reflect:!0})],exports.PktButton.prototype,"type",2);e([i.n({type:Boolean})],exports.PktButton.prototype,"isLoading",2);e([i.n({type:Boolean})],exports.PktButton.prototype,"disabled",2);exports.PktButton=e([i.t("pkt-button")],exports.PktButton);
|
|
@@ -1,21 +1,27 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import { P as
|
|
3
|
-
import { e as
|
|
4
|
-
var
|
|
5
|
-
for (var
|
|
6
|
-
(h = t[d]) && (
|
|
7
|
-
return o &&
|
|
1
|
+
import { n as a, P as b, E as p, x as l, a as c } from "./element-DjjF_tEh.js";
|
|
2
|
+
import { P as f } from "./pkt-slot-controller-DtDaD9q_.js";
|
|
3
|
+
import { e as u, n as k } from "./ref-iIffqQAI.js";
|
|
4
|
+
var y = Object.defineProperty, m = Object.getOwnPropertyDescriptor, s = (t, e, n, o) => {
|
|
5
|
+
for (var r = o > 1 ? void 0 : o ? m(e, n) : e, d = t.length - 1, h; d >= 0; d--)
|
|
6
|
+
(h = t[d]) && (r = (o ? h(e, n, r) : h(r)) || r);
|
|
7
|
+
return o && r && y(e, n, r), r;
|
|
8
8
|
};
|
|
9
|
-
let i = class extends
|
|
9
|
+
let i = class extends b {
|
|
10
10
|
constructor() {
|
|
11
|
-
super(), this.internals = this.attachInternals(), this.defaultSlot =
|
|
11
|
+
super(), this.internals = this.attachInternals(), this.defaultSlot = u(), this.iconName = "user", this.secondIconName = "user", this.mode = "light", this.size = "medium", this.skin = "primary", this.variant = "label-only", this.state = "normal", this.type = "button", this.isLoading = !1, this.disabled = !1, this.slotController = new f(this, this.defaultSlot), this.addEventListener("click", this.handleClick), this.addEventListener("keydown", this.handleKeydown);
|
|
12
12
|
}
|
|
13
13
|
// Lifecycle
|
|
14
14
|
disconnectedCallback() {
|
|
15
15
|
super.disconnectedCallback(), this.removeEventListener("click", this.handleClick), this.removeEventListener("keydown", this.handleKeydown);
|
|
16
16
|
}
|
|
17
|
+
attributeChangedCallback(t, e, n) {
|
|
18
|
+
super.attributeChangedCallback(t, e, n), t === "disabled" && n === "false" && (this.disabled = !1), (t === "isloading" || t === "isLoading") && n === "false" && (this.isLoading = !1);
|
|
19
|
+
}
|
|
20
|
+
firstUpdated(t) {
|
|
21
|
+
super.firstUpdated(t), this.disabled === "false" && (this.disabled = !1), this.isLoading === "false" && (this.isLoading = !1);
|
|
22
|
+
}
|
|
17
23
|
updated(t) {
|
|
18
|
-
super.updated(t), this.setAttribute("role", "button"), this.internals.role = "button", this.disabled ? (this.getAttribute("tabindex") !== "-1" && this.setAttribute("tabindex", "-1"), this.getAttribute("aria-disabled") !== "true" && this.setAttribute("aria-disabled", "true")) : (this.getAttribute("tabindex") !== "0" && this.setAttribute("tabindex", "0"), this.getAttribute("aria-disabled") !== "false" && this.removeAttribute("aria-disabled")), this.isLoading ? this.getAttribute("aria-busy") !== "true" && this.setAttribute("aria-busy", "true") : this.hasAttribute("aria-busy") && this.removeAttribute("aria-busy"), this.updateElementClasses();
|
|
24
|
+
super.updated(t), this.setAttribute("role", "button"), this.internals.role = "button", this.disabled === "false" && (this.disabled = !1), this.isLoading === "false" && (this.isLoading = !1), this.disabled ? (this.getAttribute("tabindex") !== "-1" && this.setAttribute("tabindex", "-1"), this.getAttribute("aria-disabled") !== "true" && this.setAttribute("aria-disabled", "true")) : (this.getAttribute("tabindex") !== "0" && this.setAttribute("tabindex", "0"), this.getAttribute("aria-disabled") !== "false" && this.removeAttribute("aria-disabled")), this.isLoading ? this.getAttribute("aria-busy") !== "true" && this.setAttribute("aria-busy", "true") : this.hasAttribute("aria-busy") && this.removeAttribute("aria-busy"), this.updateElementClasses();
|
|
19
25
|
}
|
|
20
26
|
// Render
|
|
21
27
|
render() {
|
|
@@ -34,8 +40,8 @@ let i = class extends c {
|
|
|
34
40
|
}
|
|
35
41
|
// Methods
|
|
36
42
|
updateElementClasses() {
|
|
37
|
-
const t = /* @__PURE__ */ new Set(),
|
|
38
|
-
t.add("pkt-btn"),
|
|
43
|
+
const t = /* @__PURE__ */ new Set(), e = this.getAttribute("class");
|
|
44
|
+
t.add("pkt-btn"), e && e.split(" ").forEach((n) => t.add(n)), this.size && t.add(`pkt-btn--${this.size}`), this.skin && t.add(`pkt-btn--${this.skin}`), this.variant && t.add(`pkt-btn--${this.variant}`), this.color && t.add(`pkt-btn--${this.color}`), this.isLoading && t.add("pkt-btn--active"), this.state && t.add(`pkt-btn--${this.state}`), this.disabled && t.add("pkt-btn--disabled"), this.className = [...t].join(" ");
|
|
39
45
|
}
|
|
40
46
|
handleClick(t) {
|
|
41
47
|
if (this.disabled || this.isLoading) {
|
|
@@ -43,7 +49,7 @@ let i = class extends c {
|
|
|
43
49
|
return;
|
|
44
50
|
}
|
|
45
51
|
if (this.type === "submit" && this.internals.form) {
|
|
46
|
-
this.internals.form.requestSubmit();
|
|
52
|
+
this.internals.form.requestSubmit(this);
|
|
47
53
|
return;
|
|
48
54
|
}
|
|
49
55
|
if (this.type === "reset" && this.internals.form) {
|
|
@@ -61,47 +67,47 @@ let i = class extends c {
|
|
|
61
67
|
handleKeydown(t) {
|
|
62
68
|
if (!(this.disabled || this.isLoading) && (t.key === "Enter" || t.key === " ")) {
|
|
63
69
|
t.preventDefault();
|
|
64
|
-
const
|
|
65
|
-
|
|
70
|
+
const e = t.target;
|
|
71
|
+
e && e.click();
|
|
66
72
|
}
|
|
67
73
|
}
|
|
68
74
|
};
|
|
69
75
|
i.formAssociated = !0;
|
|
70
|
-
|
|
71
|
-
|
|
76
|
+
s([
|
|
77
|
+
a({ type: String })
|
|
72
78
|
], i.prototype, "iconName", 2);
|
|
73
|
-
|
|
74
|
-
|
|
79
|
+
s([
|
|
80
|
+
a({ type: String })
|
|
75
81
|
], i.prototype, "secondIconName", 2);
|
|
76
|
-
|
|
77
|
-
|
|
82
|
+
s([
|
|
83
|
+
a({ type: String })
|
|
78
84
|
], i.prototype, "mode", 2);
|
|
79
|
-
|
|
80
|
-
|
|
85
|
+
s([
|
|
86
|
+
a({ type: String })
|
|
81
87
|
], i.prototype, "size", 2);
|
|
82
|
-
|
|
83
|
-
|
|
88
|
+
s([
|
|
89
|
+
a({ type: String })
|
|
84
90
|
], i.prototype, "color", 2);
|
|
85
|
-
|
|
86
|
-
|
|
91
|
+
s([
|
|
92
|
+
a({ type: String })
|
|
87
93
|
], i.prototype, "skin", 2);
|
|
88
|
-
|
|
89
|
-
|
|
94
|
+
s([
|
|
95
|
+
a({ type: String })
|
|
90
96
|
], i.prototype, "variant", 2);
|
|
91
|
-
|
|
92
|
-
|
|
97
|
+
s([
|
|
98
|
+
a({ type: String })
|
|
93
99
|
], i.prototype, "state", 2);
|
|
94
|
-
|
|
95
|
-
|
|
100
|
+
s([
|
|
101
|
+
a({ type: String, reflect: !0 })
|
|
96
102
|
], i.prototype, "type", 2);
|
|
97
|
-
|
|
98
|
-
|
|
103
|
+
s([
|
|
104
|
+
a({ type: Boolean })
|
|
99
105
|
], i.prototype, "isLoading", 2);
|
|
100
|
-
|
|
101
|
-
|
|
106
|
+
s([
|
|
107
|
+
a({ type: Boolean })
|
|
102
108
|
], i.prototype, "disabled", 2);
|
|
103
|
-
i =
|
|
104
|
-
|
|
109
|
+
i = s([
|
|
110
|
+
c("pkt-button")
|
|
105
111
|
], i);
|
|
106
112
|
export {
|
|
107
113
|
i as P
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const s=require("./element-BSypUpzA.cjs");require("./button-
|
|
1
|
+
"use strict";const s=require("./element-BSypUpzA.cjs");require("./button-C1cqSjK2.cjs");require("./icon-BnKGwYjj.cjs");const g={i18n:{nb:{contentPresentation:{title:"Oslo kommune bruker informasjonskapsler",description:["For at nettstedet skal fungere og være trygt, bruker Oslo kommune informasjonskapsler. Noen er teknisk nødvendige, mens andre sikrer ulik funksjonalitet.","Godtar du alle informasjonskapsler, tillater du også at vi samler inn data om statistikk og brukeradferd. Da hjelper du oss med å lage et bedre nettsted uten at du trenger å dele noe personlig informasjon med oss."],buttons:{accept:"Godta alle",reject:"Kun nødvendige",settings:"Innstillinger for informasjonskapsler"}},contentSettings:{title:"Innstillinger for informasjonskapsler",description:["Her kan du velge hvilke typer informasjonskapsler du vil tillate. Tillatelsen gjelder i 90 dager. Husk at nødvendige informasjonskapsler ikke kan velges bort.","Du kan når som helst endre innstillingene og finne mer informasjon nederst på nettstedet under «Innstillinger for informasjonskapsler» og «Personvern og informasjonskapsler»."],buttons:{back:"Tilbake",save:"Lagre innstillinger"}}},en:{contentPresentation:{title:"Before you visit Oslo kommune ...",description:["This website uses cookies to make improvements. In this context, we need your consent to measure the traffic on the website in relation to statistics and feedback.","To read more about what we use cookies for, go to our privacy declaration which you will find at the bottom of our websites."],buttons:{accept:"Yes, I accept",reject:"Only necessary",settings:"Go to settings"}},contentSettings:{title:"Her kan du aktivt velge mellom ulike informasjonskapsler",description:["For å lese mer om hva vi bruker informasjonskapsler til gå til vår personvernserklering som du finner på våre nettsider"],buttons:{back:"Back",save:"Save settings"}}}}},c=globalThis,d=c.__cookieEvents||{events:{},on(t,e){this.events[t]||(this.events[t]=[]),this.events[t].push(e)},off(t,e){this.events[t]&&(this.events[t]=this.events[t].filter(n=>n!==e))},once(t,e){const n=o=>{this.off(t,n),e(o)};this.on(t,n)},emit(t,e){this.events[t]&&this.events[t].forEach(n=>n(e))}};c.__cookieEvents=d;const k=d;var p=Object.defineProperty,u=Object.getOwnPropertyDescriptor,a=(t,e,n,o)=>{for(var i=o>1?void 0:o?u(e,n):e,r=t.length-1,l;r>=0;r--)(l=t[r])&&(i=(o?l(e,n,i):l(i))||i);return o&&i&&p(e,n,i),i};exports.PktConsent=class extends s.PktElement{constructor(){super(),this.hotjarId=null,this.googleAnalyticsId=null,this.triggerType="button",this.triggerText=null,this.i18nLanguage="nb"}connectedCallback(){super.connectedCallback(),this.triggerText=this.triggerText||g.i18n[this.i18nLanguage].contentPresentation.buttons.settings,this.googleAnalyticsId&&(window.googleAnalyticsId=this.googleAnalyticsId),this.hotjarId&&(window.hotjarId=this.hotjarId),k.on("CookieManager.setCookie",e=>{this.emitCookieConsents(e)})}emitCookieConsents(e){const o=JSON.parse(e.value).items.reduce((i,r)=>(i[r.name]=r.consent,i),{});this.dispatchEvent(new CustomEvent("toggle-consent",{detail:o,bubbles:!0,composed:!0}))}firstUpdated(e){if(!document.querySelector("#oslo-consent-script")&&window.location.hostname.toLowerCase().includes("oslo.kommune.no")){window.googleAnalyticsId=this.googleAnalyticsId,window.hotjarId=this.hotjarId;const n=document.createElement("script");n.src="https://cdn.web.oslo.kommune.no/cb/cb-v1.0.0.js",n.id="oslo-consent-script",n.onload=()=>{this.triggerInit()},document.head.appendChild(n);const o=document.createElement("link");o.href="https://cdn.web.oslo.kommune.no/cb/cb-v1.0.0.css",o.type="text/css",o.rel="stylesheet",o.id="oslo-consent-styles",document.head.appendChild(o)}}triggerInit(){window.document.dispatchEvent(new Event("DOMContentLoaded",{bubbles:!0,cancelable:!0})),window.cookieBanner.cookieConsent.validateConsentCookie().then(e=>{if(e){const o={value:window.cookieBanner.cookieConsent.getConsentCookie().items};this.emitCookieConsents(o)}})}openModal(e){e.preventDefault(),window.cookieBanner.cookieConsent||this.triggerInit(),setTimeout(()=>window.cookieBanner.openCookieModal())}render(){return this.triggerType==="link"?s.x`<a href="#" class="pkt-link" @click=${this.openModal}>${this.triggerText}</a>`:this.triggerType==="footerlink"?s.x`<a href="#" class="pkt-footer__link" @click=${this.openModal}>
|
|
2
2
|
<pkt-icon name="chevron-right" class="pkt-footer__link-icon"></pkt-icon>
|
|
3
3
|
${this.triggerText}
|
|
4
4
|
</a>`:this.triggerType==="icon"?s.x`<pkt-button
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ import { Ref } from 'lit/directives/ref.js';
|
|
|
8
8
|
import { TemplateResult } from 'lit-html';
|
|
9
9
|
import { TZDate } from '@date-fns/tz';
|
|
10
10
|
|
|
11
|
+
declare type Booleanish = boolean | 'true' | 'false';
|
|
12
|
+
|
|
11
13
|
/**
|
|
12
14
|
* We define all props as optional. Native HTML attributes are optional by default,
|
|
13
15
|
* but the TS definition require either null or value. This way we can support showing a value as optional
|
|
@@ -111,8 +113,8 @@ export declare interface IPktButton {
|
|
|
111
113
|
variant?: TPktButtonVariant;
|
|
112
114
|
state?: TPktButtonState;
|
|
113
115
|
type?: TPktButtonType;
|
|
114
|
-
isLoading?:
|
|
115
|
-
disabled?:
|
|
116
|
+
isLoading?: Booleanish;
|
|
117
|
+
disabled?: Booleanish;
|
|
116
118
|
}
|
|
117
119
|
|
|
118
120
|
export declare interface IPktCombobox {
|
|
@@ -334,9 +336,11 @@ export declare class PktButton extends PktElement<IPktButton> implements IPktBut
|
|
|
334
336
|
variant: TPktButtonVariant;
|
|
335
337
|
state?: TPktButtonState;
|
|
336
338
|
type: TPktButtonType;
|
|
337
|
-
isLoading:
|
|
338
|
-
disabled:
|
|
339
|
+
isLoading: Booleanish;
|
|
340
|
+
disabled: Booleanish;
|
|
339
341
|
disconnectedCallback(): void;
|
|
342
|
+
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
343
|
+
protected firstUpdated(_changedProperties: PropertyValues): void;
|
|
340
344
|
protected updated(_changedProperties: PropertyValues): void;
|
|
341
345
|
render(): TemplateResult<1>;
|
|
342
346
|
private updateElementClasses;
|
package/dist/pkt-button.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./button-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./button-C1cqSjK2.cjs"),e=t.PktButton;Object.defineProperty(exports,"PktButton",{enumerable:!0,get:()=>t.PktButton});exports.default=e;
|
package/dist/pkt-button.js
CHANGED
package/dist/pkt-consent.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./consent-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./consent-HOme2Fjt.cjs"),t=e.PktConsent;Object.defineProperty(exports,"PktConsent",{enumerable:!0,get:()=>e.PktConsent});exports.default=t;
|
package/dist/pkt-consent.js
CHANGED
package/dist/pkt-index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("./alert-C2EPmB0W.cjs"),l=require("./accordionitem-RFwXQC_0.cjs"),d=require("./backlink-HHM21crL.cjs"),b=require("./button-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("./alert-C2EPmB0W.cjs"),l=require("./accordionitem-RFwXQC_0.cjs"),d=require("./backlink-HHM21crL.cjs"),b=require("./button-C1cqSjK2.cjs"),k=require("./calendar-CYY42kN4.cjs"),m=require("./card-DH-3qNgp.cjs"),g=require("./combobox-BokBs9Jo.cjs"),h=require("./consent-HOme2Fjt.cjs"),f=require("./checkbox-B7ObRUbU.cjs"),t=require("./element-BSypUpzA.cjs"),y=require("./pkt-slot-controller-Da-RgXfS.cjs"),s=require("./ref-BvbyvXRH.cjs"),O=require("./class-map-DCyaICmy.cjs"),j=require("./datepicker-B767w-e9.cjs"),q=require("./helptext-bMgnhZ1R.cjs"),x=require("./heading-BnJhJDMD.cjs"),C=require("./icon-BnKGwYjj.cjs"),v=require("./input-wrapper-B-f_SotM.cjs"),S=require("./link-BrDbM3GT.cjs"),$=require("./linkcard-s9yoOq90.cjs"),L=require("./loader-Bk4XPiOY.cjs"),_=require("./messagebox-B0kgftoP.cjs"),A=require("./modal-4aQZVxGl.cjs"),B=require("./progressbar-DiRfScnB.cjs"),p=require("./radiobutton-DP6RsaQc.cjs"),T=require("./tag-B9kFYxHg.cjs"),I=require("./textarea-DIZf7CVg.cjs"),M=require("./textinput-DMPRHokX.cjs"),R=require("./select-CQs_BAKs.cjs");var H=Object.defineProperty,w=Object.getOwnPropertyDescriptor,o=(a,e,r,i)=>{for(var n=i>1?void 0:i?w(e,r):e,u=a.length-1,c;u>=0;u--)(c=a[u])&&(n=(i?c(e,r,n):c(n))||n);return i&&n&&H(e,r,n),n};exports.PktComponent=class extends t.PktElement{constructor(){super(),this.string="",this.strings=[],this.darkmode=!1,this._list=[],this.defaultSlot=s.e(),this.namedSlot=s.e(),this.slotController=new y.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="${O.e(e)}">
|
|
3
3
|
<h1 class="pkt-txt-28">${this.string}</h1>
|
|
4
4
|
|
package/dist/pkt-index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { P as A } from "./alert-C33z1kBf.js";
|
|
2
2
|
import { P as B, a as E } from "./accordionitem-vmwqD9rr.js";
|
|
3
3
|
import { P as O } from "./backlink-hvyJmwrO.js";
|
|
4
|
-
import { P as T } from "./button-
|
|
4
|
+
import { P as T } from "./button-DoVwr7W4.js";
|
|
5
5
|
import { c as f } from "./calendar-KDcOWD6V.js";
|
|
6
6
|
import { P as D } from "./calendar-KDcOWD6V.js";
|
|
7
7
|
import { P as G } from "./card-Cyww1yKr.js";
|
|
8
8
|
import { P as K } from "./combobox-CnnTPWcA.js";
|
|
9
|
-
import { P as U } from "./consent-
|
|
9
|
+
import { P as U } from "./consent-D_uOqrp2.js";
|
|
10
10
|
import { P as q } from "./checkbox-DCjl4VM0.js";
|
|
11
11
|
import { P as k, t as h, x as P, n, a as c } from "./element-DjjF_tEh.js";
|
|
12
12
|
import { P as x } from "./pkt-slot-controller-DtDaD9q_.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-elements",
|
|
3
|
-
"version": "12.37.
|
|
3
|
+
"version": "12.37.4",
|
|
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",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
60
60
|
},
|
|
61
61
|
"license": "MIT",
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "d3af62954c720832c6aa2d39cc43689ec548465b"
|
|
63
63
|
}
|
|
@@ -5,6 +5,7 @@ import { html, nothing, PropertyValues } from 'lit'
|
|
|
5
5
|
import { property, customElement } from 'lit/decorators.js'
|
|
6
6
|
import { createRef, Ref, ref } from 'lit/directives/ref.js'
|
|
7
7
|
|
|
8
|
+
type Booleanish = boolean | 'true' | 'false'
|
|
8
9
|
export type TPktButtonMode = 'light' | 'dark'
|
|
9
10
|
export type TPktButtonSize = 'small' | 'medium' | 'large'
|
|
10
11
|
export type TPktButtonColor =
|
|
@@ -40,8 +41,8 @@ export interface IPktButton {
|
|
|
40
41
|
variant?: TPktButtonVariant
|
|
41
42
|
state?: TPktButtonState
|
|
42
43
|
type?: TPktButtonType
|
|
43
|
-
isLoading?:
|
|
44
|
-
disabled?:
|
|
44
|
+
isLoading?: Booleanish
|
|
45
|
+
disabled?: Booleanish
|
|
45
46
|
}
|
|
46
47
|
@customElement('pkt-button')
|
|
47
48
|
export class PktButton extends PktElement<IPktButton> implements IPktButton {
|
|
@@ -65,10 +66,10 @@ export class PktButton extends PktElement<IPktButton> implements IPktButton {
|
|
|
65
66
|
@property({ type: String }) color?: TPktButtonColor
|
|
66
67
|
@property({ type: String }) skin: TPktButtonSkin = 'primary'
|
|
67
68
|
@property({ type: String }) variant: TPktButtonVariant = 'label-only'
|
|
68
|
-
@property({ type: String
|
|
69
|
+
@property({ type: String }) state?: TPktButtonState = 'normal'
|
|
69
70
|
@property({ type: String, reflect: true }) type: TPktButtonType = 'button'
|
|
70
|
-
@property({ type: Boolean
|
|
71
|
-
@property({ type: Boolean
|
|
71
|
+
@property({ type: Boolean }) isLoading: Booleanish = false
|
|
72
|
+
@property({ type: Boolean }) disabled: Booleanish = false
|
|
72
73
|
|
|
73
74
|
// Lifecycle
|
|
74
75
|
|
|
@@ -78,12 +79,41 @@ export class PktButton extends PktElement<IPktButton> implements IPktButton {
|
|
|
78
79
|
this.removeEventListener('keydown', this.handleKeydown as EventListener)
|
|
79
80
|
}
|
|
80
81
|
|
|
82
|
+
attributeChangedCallback(name: string, _old: string | null, value: string | null): void {
|
|
83
|
+
super.attributeChangedCallback(name, _old, value)
|
|
84
|
+
// Convert strings to booleans
|
|
85
|
+
if (name === 'disabled' && value === 'false') {
|
|
86
|
+
this.disabled = false
|
|
87
|
+
}
|
|
88
|
+
if ((name === 'isloading' || name === 'isLoading') && value === 'false') {
|
|
89
|
+
this.isLoading = false
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
protected firstUpdated(_changedProperties: PropertyValues): void {
|
|
94
|
+
super.firstUpdated(_changedProperties)
|
|
95
|
+
|
|
96
|
+
if (this.disabled === 'false') {
|
|
97
|
+
this.disabled = false
|
|
98
|
+
}
|
|
99
|
+
if (this.isLoading === 'false') {
|
|
100
|
+
this.isLoading = false
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
81
104
|
protected updated(_changedProperties: PropertyValues): void {
|
|
82
105
|
super.updated(_changedProperties)
|
|
83
106
|
|
|
84
107
|
this.setAttribute('role', 'button')
|
|
85
108
|
this.internals.role = 'button'
|
|
86
109
|
|
|
110
|
+
if (this.disabled === 'false') {
|
|
111
|
+
this.disabled = false
|
|
112
|
+
}
|
|
113
|
+
if (this.isLoading === 'false') {
|
|
114
|
+
this.isLoading = false
|
|
115
|
+
}
|
|
116
|
+
|
|
87
117
|
if (this.disabled) {
|
|
88
118
|
if (this.getAttribute('tabindex') !== '-1') {
|
|
89
119
|
this.setAttribute('tabindex', '-1')
|
|
@@ -165,7 +195,7 @@ export class PktButton extends PktElement<IPktButton> implements IPktButton {
|
|
|
165
195
|
}
|
|
166
196
|
|
|
167
197
|
if (this.type === 'submit' && this.internals.form) {
|
|
168
|
-
this.internals.form.requestSubmit()
|
|
198
|
+
this.internals.form.requestSubmit(this)
|
|
169
199
|
|
|
170
200
|
return
|
|
171
201
|
}
|
package/dist/button-jdMbbn-e.cjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./element-BSypUpzA.cjs"),h=require("./pkt-slot-controller-Da-RgXfS.cjs"),d=require("./ref-BvbyvXRH.cjs");var p=Object.defineProperty,u=Object.getOwnPropertyDescriptor,i=(r,t,s,o)=>{for(var n=o>1?void 0:o?u(t,s):t,a=r.length-1,l;a>=0;a--)(l=r[a])&&(n=(o?l(t,s,n):l(n))||n);return o&&n&&p(t,s,n),n};exports.PktButton=class extends e.PktElement{constructor(){super(),this.internals=this.attachInternals(),this.defaultSlot=d.e(),this.iconName="user",this.secondIconName="user",this.mode="light",this.size="medium",this.skin="primary",this.variant="label-only",this.state="normal",this.type="button",this.isLoading=!1,this.disabled=!1,this.slotController=new h.PktSlotController(this,this.defaultSlot),this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this.handleClick),this.removeEventListener("keydown",this.handleKeydown)}updated(t){super.updated(t),this.setAttribute("role","button"),this.internals.role="button",this.disabled?(this.getAttribute("tabindex")!=="-1"&&this.setAttribute("tabindex","-1"),this.getAttribute("aria-disabled")!=="true"&&this.setAttribute("aria-disabled","true")):(this.getAttribute("tabindex")!=="0"&&this.setAttribute("tabindex","0"),this.getAttribute("aria-disabled")!=="false"&&this.removeAttribute("aria-disabled")),this.isLoading?this.getAttribute("aria-busy")!=="true"&&this.setAttribute("aria-busy","true"):this.hasAttribute("aria-busy")&&this.removeAttribute("aria-busy"),this.updateElementClasses()}render(){return e.x`
|
|
2
|
-
<div class="pkt-contents">
|
|
3
|
-
${this.isLoading?e.x`<pkt-icon
|
|
4
|
-
class="pkt-btn__icon pkt-btn__spinner"
|
|
5
|
-
name="spinner-blue"
|
|
6
|
-
path="https://punkt-cdn.oslo.kommune.no/latest/animations/"
|
|
7
|
-
></pkt-icon>`:e.E}
|
|
8
|
-
${this.variant!=="label-only"?e.x`<pkt-icon class="pkt-btn__icon pkt-icon" name=${this.iconName}></pkt-icon>`:e.E}
|
|
9
|
-
<span class="pkt-btn__text" ${d.n(this.defaultSlot)}></span>
|
|
10
|
-
${this.variant==="icons-right-and-left"?e.x`<pkt-icon class="pkt-btn__icon" name=${this.secondIconName}></pkt-icon>`:e.E}
|
|
11
|
-
</div>
|
|
12
|
-
`}updateElementClasses(){const t=new Set,s=this.getAttribute("class");t.add("pkt-btn"),s&&s.split(" ").forEach(o=>t.add(o)),this.size&&t.add(`pkt-btn--${this.size}`),this.skin&&t.add(`pkt-btn--${this.skin}`),this.variant&&t.add(`pkt-btn--${this.variant}`),this.color&&t.add(`pkt-btn--${this.color}`),this.isLoading&&t.add("pkt-btn--active"),this.state&&t.add(`pkt-btn--${this.state}`),this.disabled&&t.add("pkt-btn--disabled"),this.className=[...t].join(" ")}handleClick(t){if(this.disabled||this.isLoading){t.preventDefault(),t.stopImmediatePropagation();return}if(this.type==="submit"&&this.internals.form){this.internals.form.requestSubmit();return}if(this.type==="reset"&&this.internals.form){this.internals.form.reset();return}this.onClick&&typeof this.onClick=="function"&&this.onClick!==this.handleClick&&this.onClick(t),this.dispatchEvent(new CustomEvent("button-click",{bubbles:!0,composed:!0,detail:{originalEvent:t}}))}handleKeydown(t){if(!(this.disabled||this.isLoading)&&(t.key==="Enter"||t.key===" ")){t.preventDefault();const s=t.target;s&&s.click()}}};exports.PktButton.formAssociated=!0;i([e.n({type:String})],exports.PktButton.prototype,"iconName",2);i([e.n({type:String})],exports.PktButton.prototype,"secondIconName",2);i([e.n({type:String})],exports.PktButton.prototype,"mode",2);i([e.n({type:String})],exports.PktButton.prototype,"size",2);i([e.n({type:String})],exports.PktButton.prototype,"color",2);i([e.n({type:String})],exports.PktButton.prototype,"skin",2);i([e.n({type:String})],exports.PktButton.prototype,"variant",2);i([e.n({type:String,reflect:!0})],exports.PktButton.prototype,"state",2);i([e.n({type:String,reflect:!0})],exports.PktButton.prototype,"type",2);i([e.n({type:Boolean,reflect:!0})],exports.PktButton.prototype,"isLoading",2);i([e.n({type:Boolean,reflect:!0})],exports.PktButton.prototype,"disabled",2);exports.PktButton=i([e.t("pkt-button")],exports.PktButton);
|