@oslokommune/punkt-elements 12.30.0 → 12.30.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.
- package/dist/{button-BnmFhao8.js → button-BCcznC7Q.js} +6 -5
- package/dist/button-rngMU-vh.cjs +12 -0
- package/dist/index.d.ts +0 -1
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +1 -1
- package/package.json +4 -4
- package/src/components/button/button.ts +8 -7
- package/dist/button-DPb5WL9h.cjs +0 -12
|
@@ -8,12 +8,9 @@ var m = Object.defineProperty, y = Object.getOwnPropertyDescriptor, i = (t, n, r
|
|
|
8
8
|
};
|
|
9
9
|
let e = class extends c {
|
|
10
10
|
constructor() {
|
|
11
|
-
super(), this.internals = this.attachInternals(), this.defaultSlot = f(), 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 b(this, this.defaultSlot);
|
|
11
|
+
super(), this.internals = this.attachInternals(), this.defaultSlot = f(), 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 b(this, this.defaultSlot), this.addEventListener("click", this.handleClick), this.addEventListener("keydown", this.handleKeydown);
|
|
12
12
|
}
|
|
13
13
|
// Lifecycle
|
|
14
|
-
connectedCallback() {
|
|
15
|
-
super.connectedCallback(), this.addEventListener("click", this.handleClick), this.addEventListener("keydown", this.handleKeydown);
|
|
16
|
-
}
|
|
17
14
|
disconnectedCallback() {
|
|
18
15
|
super.disconnectedCallback(), this.removeEventListener("click", this.handleClick), this.removeEventListener("keydown", this.handleKeydown);
|
|
19
16
|
}
|
|
@@ -62,7 +59,11 @@ let e = class extends c {
|
|
|
62
59
|
);
|
|
63
60
|
}
|
|
64
61
|
handleKeydown(t) {
|
|
65
|
-
this.disabled || this.isLoading
|
|
62
|
+
if (!(this.disabled || this.isLoading) && (t.key === "Enter" || t.key === " ")) {
|
|
63
|
+
t.preventDefault();
|
|
64
|
+
const n = t.target;
|
|
65
|
+
n && n.click();
|
|
66
|
+
}
|
|
66
67
|
}
|
|
67
68
|
};
|
|
68
69
|
e.formAssociated = !0;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";const e=require("./element-r-PeQ419.cjs"),h=require("./pkt-slot-controller-Oc32unDk.cjs"),d=require("./ref-BUWgvhgU.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.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.setAttribute("aria-disabled","false")),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-btn__element-content">
|
|
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);
|
package/dist/index.d.ts
CHANGED
|
@@ -159,7 +159,6 @@ export declare class PktButton extends PktElement<IPktButton> implements IPktBut
|
|
|
159
159
|
type: TPktButtonType;
|
|
160
160
|
isLoading: boolean;
|
|
161
161
|
disabled: boolean;
|
|
162
|
-
connectedCallback(): void;
|
|
163
162
|
disconnectedCallback(): void;
|
|
164
163
|
protected updated(_changedProperties: PropertyValues): void;
|
|
165
164
|
render(): TemplateResult<1>;
|
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-rngMU-vh.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-index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./alert-CP5oN7df.cjs"),P=require("./button-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./alert-CP5oN7df.cjs"),P=require("./button-rngMU-vh.cjs"),c=require("./calendar-DUkAC9Hx.cjs"),k=require("./card-D6VEEvX3.cjs"),b=require("./checkbox-CDMUepTW.cjs"),t=require("./element-r-PeQ419.cjs"),m=require("./pkt-slot-controller-Oc32unDk.cjs"),s=require("./ref-BUWgvhgU.cjs"),g=require("./class-map-Dzci3Pfe.cjs"),h=require("./datepicker-NbLoqIKZ.cjs"),f=require("./helptext-C0mrdhRi.cjs"),y=require("./icon-DcJIqTIY.cjs"),O=require("./input-wrapper-Dqj4uers.cjs"),j=require("./link-C_bwx1Ml.cjs"),x=require("./linkcard-C6mZOE0R.cjs"),q=require("./loader-DQV1hMM3.cjs"),C=require("./messagebox-BSyLVNas.cjs"),v=require("./modal-CblCiNUi.cjs"),S=require("./progressbar-C_q48_qh.cjs"),p=require("./radiobutton-3e105CXX.cjs"),$=require("./tag-B3KEILId.cjs"),_=require("./textarea-BKCVcJ6E.cjs"),L=require("./textinput-BRupcl9v.cjs"),T=require("./select-DJu4Wr1y.cjs");var B=Object.defineProperty,M=Object.getOwnPropertyDescriptor,o=(a,e,r,i)=>{for(var n=i>1?void 0:i?M(e,r):e,l=a.length-1,u;l>=0;l--)(u=a[l])&&(n=(i?u(e,r,n):u(n))||n);return i&&n&&B(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 m.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="${g.e(e)}">
|
|
3
3
|
<h1 class="pkt-txt-28">${this.string}</h1>
|
|
4
4
|
|
package/dist/pkt-index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { P as w } from "./alert-CugVni4g.js";
|
|
2
|
-
import { P as O } from "./button-
|
|
2
|
+
import { P as O } from "./button-BCcznC7Q.js";
|
|
3
3
|
import { c as d } from "./calendar-DevhqUoj.js";
|
|
4
4
|
import { P as T } from "./calendar-DevhqUoj.js";
|
|
5
5
|
import { P as A } from "./card-CGMZxbH_.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-elements",
|
|
3
|
-
"version": "12.30.
|
|
3
|
+
"version": "12.30.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",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"urlpattern-polyfill": "^10.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@oslokommune/punkt-assets": "^12.30.
|
|
33
|
-
"@oslokommune/punkt-css": "^12.30.
|
|
32
|
+
"@oslokommune/punkt-assets": "^12.30.1",
|
|
33
|
+
"@oslokommune/punkt-css": "^12.30.1",
|
|
34
34
|
"sass": "^1.78.0",
|
|
35
35
|
"typescript": "^5.6.2",
|
|
36
36
|
"vite": "^5.4.4",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
58
58
|
},
|
|
59
59
|
"license": "MIT",
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "a4b93e347c6b9167efadde236794e42aafc18489"
|
|
61
61
|
}
|
|
@@ -52,6 +52,8 @@ export class PktButton extends PktElement<IPktButton> implements IPktButton {
|
|
|
52
52
|
constructor() {
|
|
53
53
|
super()
|
|
54
54
|
this.slotController = new PktSlotController(this, this.defaultSlot)
|
|
55
|
+
this.addEventListener('click', this.handleClick as EventListener)
|
|
56
|
+
this.addEventListener('keydown', this.handleKeydown as EventListener)
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
// Properties
|
|
@@ -69,12 +71,6 @@ export class PktButton extends PktElement<IPktButton> implements IPktButton {
|
|
|
69
71
|
|
|
70
72
|
// Lifecycle
|
|
71
73
|
|
|
72
|
-
connectedCallback() {
|
|
73
|
-
super.connectedCallback()
|
|
74
|
-
this.addEventListener('click', this.handleClick as EventListener)
|
|
75
|
-
this.addEventListener('keydown', this.handleKeydown as EventListener)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
74
|
disconnectedCallback() {
|
|
79
75
|
super.disconnectedCallback()
|
|
80
76
|
this.removeEventListener('click', this.handleClick as EventListener)
|
|
@@ -168,10 +164,12 @@ export class PktButton extends PktElement<IPktButton> implements IPktButton {
|
|
|
168
164
|
|
|
169
165
|
if (this.type === 'submit' && this.internals.form) {
|
|
170
166
|
this.internals.form.requestSubmit()
|
|
167
|
+
|
|
171
168
|
return
|
|
172
169
|
}
|
|
173
170
|
if (this.type === 'reset' && this.internals.form) {
|
|
174
171
|
this.internals.form.reset()
|
|
172
|
+
|
|
175
173
|
return
|
|
176
174
|
}
|
|
177
175
|
|
|
@@ -193,7 +191,10 @@ export class PktButton extends PktElement<IPktButton> implements IPktButton {
|
|
|
193
191
|
|
|
194
192
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
195
193
|
event.preventDefault()
|
|
196
|
-
|
|
194
|
+
const button = event.target as HTMLButtonElement
|
|
195
|
+
if (button) {
|
|
196
|
+
button.click()
|
|
197
|
+
}
|
|
197
198
|
}
|
|
198
199
|
}
|
|
199
200
|
}
|
package/dist/button-DPb5WL9h.cjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./element-r-PeQ419.cjs"),h=require("./pkt-slot-controller-Oc32unDk.cjs"),d=require("./ref-BUWgvhgU.cjs");var p=Object.defineProperty,u=Object.getOwnPropertyDescriptor,i=(o,t,n,a)=>{for(var s=a>1?void 0:a?u(t,n):t,r=o.length-1,l;r>=0;r--)(l=o[r])&&(s=(a?l(t,n,s):l(s))||s);return a&&s&&p(t,n,s),s};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)}connectedCallback(){super.connectedCallback(),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.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.setAttribute("aria-disabled","false")),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-btn__element-content">
|
|
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,n=this.getAttribute("class");t.add("pkt-btn"),n&&n.split(" ").forEach(a=>t.add(a)),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){this.disabled||this.isLoading||(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.handleClick(t))}};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);
|