@oslokommune/punkt-elements 20.0.5 → 20.1.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/CHANGELOG.md +16 -0
- package/dist/{alert-DPtmkrJq.cjs → alert-0a5lX0pL.cjs} +1 -1
- package/dist/{alert-B00bIA5q.js → alert-ZrB-P881.js} +1 -1
- package/dist/button-CJzu0l5A.js +125 -0
- package/dist/button-DHVRpzpS.cjs +32 -0
- package/dist/{checkbox-group-DHi7HgkS.cjs → checkbox-group-BF29zyLd.cjs} +1 -1
- package/dist/{checkbox-group-D038oaif.js → checkbox-group-CRIV5CX0.js} +1 -1
- package/dist/{combobox-BR2qOS5z.js → combobox-CLVwmqkY.js} +2 -1
- package/dist/{combobox-Bn51heWm.cjs → combobox-otZu39eS.cjs} +2 -1
- package/dist/{consent-ifEcAAhG.cjs → consent-BOSXNt4Y.cjs} +1 -1
- package/dist/{consent-KrraWq7K.js → consent-DwppvYBR.js} +1 -1
- package/dist/{datepicker-Bt8zKLPK.cjs → datepicker-Cnrbqm62.cjs} +1 -1
- package/dist/{datepicker-BZpiJeLW.js → datepicker-DHdFA8Dx.js} +1 -1
- package/dist/{fileupload-A7RNV7ic.js → fileupload-BQw5nlzQ.js} +2 -2
- package/dist/{fileupload-Cw4xeUZn.cjs → fileupload-Cjde62AR.cjs} +1 -1
- package/dist/{footer-dnW2aMEr.cjs → footer-NQaQc2DH.cjs} +1 -1
- package/dist/{footer-HqNhiUa1.js → footer-SbOYv50e.js} +1 -1
- package/dist/{header-VOj1cfsA.js → header-CZnKVVt4.js} +2 -2
- package/dist/{header-CKGwNWBI.cjs → header-YbbGgmsD.cjs} +1 -1
- package/dist/{input-wrapper-CdH6RH0a.cjs → input-wrapper-CbYMk21W.cjs} +1 -1
- package/dist/{input-wrapper-C6BRd-cu.js → input-wrapper-DYg1VHPv.js} +1 -1
- package/dist/{option-group-element-C8oJxuQQ.js → option-group-element-DtSw52Dr.js} +1 -1
- package/dist/{option-group-element-_LrpXfK1.cjs → option-group-element-dN0ntPZk.cjs} +1 -1
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +1 -1
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +1 -1
- package/dist/pkt-checkbox-group.cjs +1 -1
- package/dist/pkt-checkbox-group.js +1 -1
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +1 -1
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +1 -1
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-fileupload.cjs +1 -1
- package/dist/pkt-fileupload.js +1 -1
- package/dist/pkt-footer.cjs +1 -1
- package/dist/pkt-footer.js +1 -1
- package/dist/pkt-header.cjs +1 -1
- package/dist/pkt-header.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +15 -15
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +1 -1
- package/dist/pkt-radio-group.cjs +1 -1
- package/dist/pkt-radio-group.js +1 -1
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +1 -1
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +1 -1
- package/dist/pkt-timepicker.cjs +1 -1
- package/dist/pkt-timepicker.js +1 -1
- package/dist/{radio-group-Kr2BCSvg.js → radio-group-bRF8fnPW.js} +1 -1
- package/dist/{radio-group-RWgTs_uV.cjs → radio-group-u1IH7g-4.cjs} +1 -1
- package/dist/{select-CZ3L48N_.cjs → select-C7kAlSxs.cjs} +1 -1
- package/dist/{select-Curv4lWO.js → select-CXIEM2qY.js} +1 -1
- package/dist/shared-types/button.d.ts +13 -0
- package/dist/shared-types/index.d.ts +1 -1
- package/dist/{textarea-B1iUKCro.js → textarea-12le8b4I.js} +1 -1
- package/dist/{textarea-DbD7sOLV.cjs → textarea-CRcSfWgX.cjs} +1 -1
- package/dist/{textinput-CKbUvHNH.js → textinput-CC0zxUBT.js} +1 -1
- package/dist/{textinput-C_5jzdg3.cjs → textinput-Dooq2n8W.cjs} +1 -1
- package/dist/{timepicker-By-kvx3z.cjs → timepicker-BM4I5w-i.cjs} +1 -1
- package/dist/{timepicker-DkXpFBpQ.js → timepicker-Cz81VQu3.js} +1 -1
- package/package.json +2 -2
- package/src/components/button/button.ts +14 -14
- package/src/components/combobox/combobox.interaction.test.ts +23 -0
- package/src/components/combobox/combobox.ts +1 -0
- package/dist/button-BI1PsdE1.cjs +0 -32
- package/dist/button-Bd-0TYe7.js +0 -113
package/dist/button-BI1PsdE1.cjs
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
const e=require("./element-with-slot-D_8fAzCW.cjs"),t=require("./element-CEarCnHH.cjs"),n=require("./class-map-C82GtM1w.cjs"),r=require("./if-defined-Ci4ZQsgL.cjs");require("./icon-5A378_yh.cjs");var i,a=`https://punkt-cdn.oslo.kommune.no/latest/animations/`;typeof window<`u`&&(window.pktAnimationPath=window.pktAnimationPath||a);var o=class i extends e.t{constructor(...e){super(...e),this.iconName=`user`,this.secondIconName=`user`,this.size=`medium`,this.fullWidth=!1,this.fullWidthOnMobile=!1,this.skin=`primary`,this.variant=`label-only`,this.state=void 0,this.type=`button`,this.form=void 0,this.isLoading=!1,this.disabled=!1,this.loadingAnimationPath=typeof window<`u`?window.pktAnimationPath:a,this.relocatedAria={}}connectedCallback(){super.connectedCallback(),this.addEventListener(`click`,e=>{(this.disabled||this.hasAttribute(`disabled`)||this.isLoading)&&(e.preventDefault(),e.stopImmediatePropagation())},!0),this.addEventListener(`keydown`,e=>{(this.disabled||this.hasAttribute(`disabled`)||this.isLoading)&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopImmediatePropagation())},!0)}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),e===`disabled`&&n===`false`&&(this.disabled=!1),(e===`isloading`||e===`isLoading`)&&n===`false`&&(this.isLoading=!1)}willUpdate(e){super.willUpdate(e);let t=!1,n={...this.relocatedAria};for(let e of i.relocatedAriaAttributes){let r=this.getAttribute(e);r!==null&&(n[e]=r,this.removeAttribute(e),t=!0)}t&&(this.relocatedAria=n)}firstUpdated(e){super.firstUpdated(e),this.disabled===`false`&&(this.disabled=!1),this.isLoading===`false`&&(this.isLoading=!1)}render(){let i=this.form??this.getAttribute(`form`)??void 0,a={"pkt-btn":!0,[`pkt-btn--${this.size}`]:!!this.size,[`pkt-btn--${this.skin}`]:!!this.skin,[`pkt-btn--${this.variant}`]:!!this.variant,[`pkt-btn--${this.color}`]:!!this.color,[`pkt-btn--${this.state}`]:!!this.state,"pkt-btn--full":!!this.fullWidth,"pkt-btn--full-small":!!this.fullWidthOnMobile,"pkt-btn--isLoading":!!this.isLoading};return t._`
|
|
2
|
-
<button
|
|
3
|
-
class=${n.t(a)}
|
|
4
|
-
type=${this.type}
|
|
5
|
-
?disabled=${!!this.disabled}
|
|
6
|
-
aria-busy=${r.t(this.isLoading?`true`:void 0)}
|
|
7
|
-
aria-disabled=${r.t(this.disabled||this.isLoading?`true`:void 0)}
|
|
8
|
-
aria-haspopup=${r.t(this.relocatedAria[`aria-haspopup`])}
|
|
9
|
-
aria-expanded=${r.t(this.relocatedAria[`aria-expanded`])}
|
|
10
|
-
aria-controls=${r.t(this.relocatedAria[`aria-controls`])}
|
|
11
|
-
aria-label=${r.t(this.relocatedAria[`aria-label`])}
|
|
12
|
-
tabindex=${r.t(this.relocatedAria.tabindex)}
|
|
13
|
-
form=${r.t(i)}
|
|
14
|
-
>
|
|
15
|
-
${this.isLoading?t._`<pkt-icon
|
|
16
|
-
class="pkt-btn__icon pkt-btn__spinner"
|
|
17
|
-
name="spinner-blue"
|
|
18
|
-
path=${r.t(this.loadingAnimationPath)}
|
|
19
|
-
></pkt-icon>`:t.h}
|
|
20
|
-
${this.variant===`label-only`?t.h:t._`<pkt-icon
|
|
21
|
-
class="pkt-btn__icon pkt-icon"
|
|
22
|
-
name=${this.iconName}
|
|
23
|
-
path=${r.t(this.iconPath)}
|
|
24
|
-
></pkt-icon>`}
|
|
25
|
-
<span class="pkt-btn__text">${e.i(this)}</span>
|
|
26
|
-
${this.variant===`icons-right-and-left`?t._`<pkt-icon
|
|
27
|
-
class="pkt-btn__icon"
|
|
28
|
-
name=${this.secondIconName}
|
|
29
|
-
path=${r.t(this.secondIconPath)}
|
|
30
|
-
></pkt-icon>`:t.h}
|
|
31
|
-
</button>
|
|
32
|
-
`}};i=o,i.relocatedAriaAttributes=[`aria-haspopup`,`aria-expanded`,`aria-controls`,`aria-label`,`tabindex`],t.n([t.u({type:String})],o.prototype,`iconName`,void 0),t.n([t.u({type:String})],o.prototype,`secondIconName`,void 0),t.n([t.u({type:String})],o.prototype,`iconPath`,void 0),t.n([t.u({type:String})],o.prototype,`secondIconPath`,void 0),t.n([t.u({type:String})],o.prototype,`size`,void 0),t.n([t.u({type:Boolean,attribute:`full-width`})],o.prototype,`fullWidth`,void 0),t.n([t.u({type:Boolean,attribute:`full-width-on-mobile`})],o.prototype,`fullWidthOnMobile`,void 0),t.n([t.u({type:String})],o.prototype,`color`,void 0),t.n([t.u({type:String})],o.prototype,`skin`,void 0),t.n([t.u({type:String})],o.prototype,`variant`,void 0),t.n([t.u({type:String,reflect:!0})],o.prototype,`state`,void 0),t.n([t.u({type:String,reflect:!0})],o.prototype,`type`,void 0),t.n([t.u({type:String})],o.prototype,`form`,void 0),t.n([t.u({type:Boolean,reflect:!0})],o.prototype,`isLoading`,void 0),t.n([t.u({type:Boolean,reflect:!0})],o.prototype,`disabled`,void 0),t.n([t.u({type:String})],o.prototype,`loadingAnimationPath`,void 0),t.n([t.l()],o.prototype,`relocatedAria`,void 0);try{t.d(`pkt-button`)(o)}catch{console.warn(`Forsøker å definere <pkt-button>, men den er allerede definert`)}var s=o;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
|
package/dist/button-Bd-0TYe7.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { i as e, t } from "./element-with-slot-47quDZRt.js";
|
|
2
|
-
import { _ as n, d as r, h as i, l as a, n as o, u as s } from "./element-Bwc-likm.js";
|
|
3
|
-
import { t as c } from "./class-map-C9n5CNC8.js";
|
|
4
|
-
import { t as l } from "./if-defined-B3pYog2C.js";
|
|
5
|
-
import "./icon-CZDw42U7.js";
|
|
6
|
-
// src/components/button/button.ts
|
|
7
|
-
var u, d = "https://punkt-cdn.oslo.kommune.no/latest/animations/";
|
|
8
|
-
typeof window < "u" && (window.pktAnimationPath = window.pktAnimationPath || d);
|
|
9
|
-
var f = class r extends t {
|
|
10
|
-
constructor(...e) {
|
|
11
|
-
super(...e), this.iconName = "user", this.secondIconName = "user", this.size = "medium", this.fullWidth = !1, this.fullWidthOnMobile = !1, this.skin = "primary", this.variant = "label-only", this.state = void 0, this.type = "button", this.form = void 0, this.isLoading = !1, this.disabled = !1, this.loadingAnimationPath = typeof window < "u" ? window.pktAnimationPath : d, this.relocatedAria = {};
|
|
12
|
-
}
|
|
13
|
-
connectedCallback() {
|
|
14
|
-
super.connectedCallback(), this.addEventListener("click", (e) => {
|
|
15
|
-
(this.disabled || this.hasAttribute("disabled") || this.isLoading) && (e.preventDefault(), e.stopImmediatePropagation());
|
|
16
|
-
}, !0), this.addEventListener("keydown", (e) => {
|
|
17
|
-
(this.disabled || this.hasAttribute("disabled") || this.isLoading) && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopImmediatePropagation());
|
|
18
|
-
}, !0);
|
|
19
|
-
}
|
|
20
|
-
attributeChangedCallback(e, t, n) {
|
|
21
|
-
super.attributeChangedCallback(e, t, n), e === "disabled" && n === "false" && (this.disabled = !1), (e === "isloading" || e === "isLoading") && n === "false" && (this.isLoading = !1);
|
|
22
|
-
}
|
|
23
|
-
willUpdate(e) {
|
|
24
|
-
super.willUpdate(e);
|
|
25
|
-
let t = !1, n = { ...this.relocatedAria };
|
|
26
|
-
for (let e of r.relocatedAriaAttributes) {
|
|
27
|
-
let r = this.getAttribute(e);
|
|
28
|
-
r !== null && (n[e] = r, this.removeAttribute(e), t = !0);
|
|
29
|
-
}
|
|
30
|
-
t && (this.relocatedAria = n);
|
|
31
|
-
}
|
|
32
|
-
firstUpdated(e) {
|
|
33
|
-
super.firstUpdated(e), this.disabled === "false" && (this.disabled = !1), this.isLoading === "false" && (this.isLoading = !1);
|
|
34
|
-
}
|
|
35
|
-
render() {
|
|
36
|
-
let t = this.form ?? this.getAttribute("form") ?? void 0, r = {
|
|
37
|
-
"pkt-btn": !0,
|
|
38
|
-
[`pkt-btn--${this.size}`]: !!this.size,
|
|
39
|
-
[`pkt-btn--${this.skin}`]: !!this.skin,
|
|
40
|
-
[`pkt-btn--${this.variant}`]: !!this.variant,
|
|
41
|
-
[`pkt-btn--${this.color}`]: !!this.color,
|
|
42
|
-
[`pkt-btn--${this.state}`]: !!this.state,
|
|
43
|
-
"pkt-btn--full": !!this.fullWidth,
|
|
44
|
-
"pkt-btn--full-small": !!this.fullWidthOnMobile,
|
|
45
|
-
"pkt-btn--isLoading": !!this.isLoading
|
|
46
|
-
};
|
|
47
|
-
return n`
|
|
48
|
-
<button
|
|
49
|
-
class=${c(r)}
|
|
50
|
-
type=${this.type}
|
|
51
|
-
?disabled=${!!this.disabled}
|
|
52
|
-
aria-busy=${l(this.isLoading ? "true" : void 0)}
|
|
53
|
-
aria-disabled=${l(this.disabled || this.isLoading ? "true" : void 0)}
|
|
54
|
-
aria-haspopup=${l(this.relocatedAria["aria-haspopup"])}
|
|
55
|
-
aria-expanded=${l(this.relocatedAria["aria-expanded"])}
|
|
56
|
-
aria-controls=${l(this.relocatedAria["aria-controls"])}
|
|
57
|
-
aria-label=${l(this.relocatedAria["aria-label"])}
|
|
58
|
-
tabindex=${l(this.relocatedAria.tabindex)}
|
|
59
|
-
form=${l(t)}
|
|
60
|
-
>
|
|
61
|
-
${this.isLoading ? n`<pkt-icon
|
|
62
|
-
class="pkt-btn__icon pkt-btn__spinner"
|
|
63
|
-
name="spinner-blue"
|
|
64
|
-
path=${l(this.loadingAnimationPath)}
|
|
65
|
-
></pkt-icon>` : i}
|
|
66
|
-
${this.variant === "label-only" ? i : n`<pkt-icon
|
|
67
|
-
class="pkt-btn__icon pkt-icon"
|
|
68
|
-
name=${this.iconName}
|
|
69
|
-
path=${l(this.iconPath)}
|
|
70
|
-
></pkt-icon>`}
|
|
71
|
-
<span class="pkt-btn__text">${e(this)}</span>
|
|
72
|
-
${this.variant === "icons-right-and-left" ? n`<pkt-icon
|
|
73
|
-
class="pkt-btn__icon"
|
|
74
|
-
name=${this.secondIconName}
|
|
75
|
-
path=${l(this.secondIconPath)}
|
|
76
|
-
></pkt-icon>` : i}
|
|
77
|
-
</button>
|
|
78
|
-
`;
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
u = f, u.relocatedAriaAttributes = [
|
|
82
|
-
"aria-haspopup",
|
|
83
|
-
"aria-expanded",
|
|
84
|
-
"aria-controls",
|
|
85
|
-
"aria-label",
|
|
86
|
-
"tabindex"
|
|
87
|
-
], o([s({ type: String })], f.prototype, "iconName", void 0), o([s({ type: String })], f.prototype, "secondIconName", void 0), o([s({ type: String })], f.prototype, "iconPath", void 0), o([s({ type: String })], f.prototype, "secondIconPath", void 0), o([s({ type: String })], f.prototype, "size", void 0), o([s({
|
|
88
|
-
type: Boolean,
|
|
89
|
-
attribute: "full-width"
|
|
90
|
-
})], f.prototype, "fullWidth", void 0), o([s({
|
|
91
|
-
type: Boolean,
|
|
92
|
-
attribute: "full-width-on-mobile"
|
|
93
|
-
})], f.prototype, "fullWidthOnMobile", void 0), o([s({ type: String })], f.prototype, "color", void 0), o([s({ type: String })], f.prototype, "skin", void 0), o([s({ type: String })], f.prototype, "variant", void 0), o([s({
|
|
94
|
-
type: String,
|
|
95
|
-
reflect: !0
|
|
96
|
-
})], f.prototype, "state", void 0), o([s({
|
|
97
|
-
type: String,
|
|
98
|
-
reflect: !0
|
|
99
|
-
})], f.prototype, "type", void 0), o([s({ type: String })], f.prototype, "form", void 0), o([s({
|
|
100
|
-
type: Boolean,
|
|
101
|
-
reflect: !0
|
|
102
|
-
})], f.prototype, "isLoading", void 0), o([s({
|
|
103
|
-
type: Boolean,
|
|
104
|
-
reflect: !0
|
|
105
|
-
})], f.prototype, "disabled", void 0), o([s({ type: String })], f.prototype, "loadingAnimationPath", void 0), o([a()], f.prototype, "relocatedAria", void 0);
|
|
106
|
-
try {
|
|
107
|
-
r("pkt-button")(f);
|
|
108
|
-
} catch {
|
|
109
|
-
console.warn("Forsøker å definere <pkt-button>, men den er allerede definert");
|
|
110
|
-
}
|
|
111
|
-
// src/components/button/index.ts
|
|
112
|
-
var p = f;
|
|
113
|
-
export { f as n, p as t };
|