@oslokommune/punkt-elements 16.17.3 → 16.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/dist/{accordion-CU2tJ5vn.js → accordion-BjYsEbSM.js} +19 -19
- package/dist/{accordion-DDZkjXFb.cjs → accordion-DaeWPWod.cjs} +5 -5
- package/dist/{alert-ePJuDtmm.js → alert-BkzC5mVu.js} +22 -22
- package/dist/{alert-BEEnTiCb.cjs → alert-D_45dWPn.cjs} +6 -6
- package/dist/{async-directive-CaQiqjyV.js → async-directive-Cz6tcqge.js} +2 -2
- package/dist/async-directive-DO1QtVmf.cjs +1 -0
- package/dist/{backlink-CiwXrQYD.js → backlink-BXAdgAte.js} +6 -6
- package/dist/{backlink-Ba03LlbB.cjs → backlink-C42-3OG3.cjs} +2 -2
- package/dist/{breadcrumbs-CD1zib3s.cjs → breadcrumbs-CkjeLh3U.cjs} +6 -6
- package/dist/{breadcrumbs-CpuVqWhF.js → breadcrumbs-Dkb9TxMp.js} +15 -15
- package/dist/{button-BIpd1xJh.js → button-CR-KWhTT.js} +21 -21
- package/dist/{button-D-TOBaJB.cjs → button-Dwv11n6R.cjs} +7 -7
- package/dist/{calendar-DkjXla0I.cjs → calendar-Buvxe4l_.cjs} +11 -11
- package/dist/{calendar-Ch1dgnBo.js → calendar-DAq6iJdx.js} +50 -50
- package/dist/{card-CEDbo1t7.js → card-5PydU247.js} +43 -43
- package/dist/{card-C3POnP3O.cjs → card-C__IlsUa.cjs} +26 -26
- package/dist/{checkbox-CF5mSBR5.js → checkbox-CC1X7fw4.js} +23 -23
- package/dist/{checkbox-BerAYcfK.cjs → checkbox-DzMc0AJX.cjs} +10 -10
- package/dist/class-map-B8Ja0q7n.cjs +1 -0
- package/dist/{class-map-C8HuhNzZ.js → class-map-DH9hlJny.js} +7 -8
- package/dist/{combobox-DjvRMKOD.js → combobox-D-DY7YcW.js} +42 -42
- package/dist/{combobox-DYttdLJ4.cjs → combobox-x4tBGP3F.cjs} +17 -17
- package/dist/components/heading/heading.d.ts +5 -8
- package/dist/components/icon/icon.d.ts +6 -1
- package/dist/components/icon/icon.test.d.ts +2 -0
- package/dist/{consent-B5dIDyLD.cjs → consent-BB3g_ByO.cjs} +3 -3
- package/dist/{consent-DSHrt9eS.js → consent-Y14WZ0JS.js} +8 -8
- package/dist/{datepicker-D3QQbd_H.cjs → datepicker-BFI-3stE.cjs} +20 -20
- package/dist/{datepicker-M_jcY3wp.js → datepicker-CRk7aiwH.js} +57 -57
- package/dist/{directive-helpers-Dkv2gKgs.js → directive-helpers-Cep_4cpj.js} +1 -1
- package/dist/{directive-helpers-D1QSxY17.cjs → directive-helpers-f36YZFOG.cjs} +1 -1
- package/dist/element-CXAtr6Gu.cjs +2 -0
- package/dist/{element-cZ85T_aa.js → element-CduG0XyF.js} +47 -23
- package/dist/{element-with-slot-4J2o3SeU.js → element-with-slot-BVj9MXzi.js} +5 -6
- package/dist/element-with-slot-Cmxb9h4H.cjs +1 -0
- package/dist/{fileupload-IXSGrqiH.js → fileupload-C8muj8qd.js} +149 -149
- package/dist/{fileupload-qc0fHcR-.cjs → fileupload-YtsrgQTY.cjs} +40 -40
- package/dist/{header-C1hDYMRX.cjs → header-CjBip0zj.cjs} +57 -57
- package/dist/{header-BGknkrEt.js → header-DONTGbD9.js} +130 -130
- package/dist/{header-menu-zhGYdnvz.js → header-menu-BU-ylGrJ.js} +45 -45
- package/dist/{header-menu-CPI1_5oZ.cjs → header-menu-CnW7nzmF.cjs} +24 -24
- package/dist/heading-3o4Dk0Wn.js +80 -0
- package/dist/heading-C40-NX0r.cjs +1 -0
- package/dist/{helptext-BdqoW19r.js → helptext-C2aQBBo_.js} +12 -12
- package/dist/{helptext-KWXjKljV.cjs → helptext-DNLg43eI.cjs} +4 -4
- package/dist/icon-Dw6I0HDV.cjs +1 -0
- package/dist/{icon-Co72KtgF.js → icon-LaKyBKON.js} +39 -19
- package/dist/if-defined-LTjAScFG.cjs +1 -0
- package/dist/{if-defined-Cjj8qN-Z.js → if-defined-VShASPdu.js} +1 -1
- package/dist/{input-element-D0egtEnr.cjs → input-element-BHQVt4Q9.cjs} +1 -1
- package/dist/{input-element-B1ciW1N2.js → input-element-BrmkXIXi.js} +30 -30
- package/dist/{input-wrapper-DVU68NcJ.js → input-wrapper-B6WowlWG.js} +33 -33
- package/dist/{input-wrapper-DOIWggEv.cjs → input-wrapper-Dhkt20WW.cjs} +17 -17
- package/dist/{link-DMKjKawh.cjs → link-B5ur0Rym.cjs} +4 -4
- package/dist/{link-F51Ho7CV.js → link-ClUNY__5.js} +13 -13
- package/dist/linkcard-BIcCW-qw.cjs +13 -0
- package/dist/{linkcard-E07qJZMP.js → linkcard-DNJm5FvA.js} +15 -15
- package/dist/{listbox-0NHJvNjz.js → listbox-DXMIBv3y.js} +35 -35
- package/dist/{listbox-CcThiNBY.cjs → listbox-DbEobJNx.cjs} +14 -14
- package/dist/{loader-q_eO6zaE.cjs → loader-Uap9qDsV.cjs} +5 -5
- package/dist/{loader-teN65oWo.js → loader-gKdQpOOQ.js} +12 -12
- package/dist/{messagebox-D1QeQqb8.cjs → messagebox-BqBxXK8c.cjs} +5 -5
- package/dist/{messagebox-Ct9lfe0Z.js → messagebox-XRFecqyS.js} +15 -15
- package/dist/{modal-Ca-6xVkg.js → modal-CWgeT-RP.js} +19 -19
- package/dist/{modal-B7-0F5q7.cjs → modal-CrYHKOmr.cjs} +8 -8
- package/dist/pkt-accordion.cjs +1 -1
- package/dist/pkt-accordion.js +1 -1
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +1 -1
- package/dist/pkt-backlink.cjs +1 -1
- package/dist/pkt-backlink.js +1 -1
- package/dist/pkt-breadcrumbs.cjs +1 -1
- package/dist/pkt-breadcrumbs.js +1 -1
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +1 -1
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +1 -1
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +1 -1
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.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-header-menu.cjs +1 -1
- package/dist/pkt-header-menu.js +1 -1
- package/dist/pkt-header.cjs +1 -1
- package/dist/pkt-header.js +1 -1
- package/dist/pkt-heading.cjs +1 -1
- package/dist/pkt-heading.js +1 -1
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-icon.cjs +1 -1
- package/dist/pkt-icon.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +32 -32
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +1 -1
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +1 -1
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +1 -1
- package/dist/pkt-listbox.cjs +1 -1
- package/dist/pkt-listbox.js +1 -1
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +1 -1
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +1 -1
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +1 -1
- package/dist/{pkt-options-controller-CCB15L_G.js → pkt-options-controller-BTNtjEIS.js} +1 -1
- package/dist/{pkt-options-controller-CeAQ-D-i.cjs → pkt-options-controller-CBM8xHwR.cjs} +1 -1
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +1 -1
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +1 -1
- package/dist/pkt-searchinput.cjs +1 -1
- package/dist/pkt-searchinput.js +1 -1
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- package/dist/pkt-tabs.cjs +1 -1
- package/dist/pkt-tabs.js +1 -1
- package/dist/pkt-tag.cjs +1 -1
- package/dist/pkt-tag.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/{progressbar-o-M17HPA.js → progressbar-B0P_vmGD.js} +23 -24
- package/dist/progressbar-DADdvDl5.cjs +17 -0
- package/dist/{radiobutton-B1Xg6XzP.cjs → radiobutton-BfURufrZ.cjs} +8 -8
- package/dist/{radiobutton-BAn1V_mQ.js → radiobutton-C6zERHoy.js} +20 -20
- package/dist/{ref-RS8Uv6uC.js → ref-BgoHEsEt.js} +7 -8
- package/dist/ref-CBdWMlde.cjs +1 -0
- package/dist/{repeat-DV1O43YU.js → repeat-CKIii8Mi.js} +15 -16
- package/dist/repeat-CRRgmzVn.cjs +1 -0
- package/dist/{searchinput-BVIaoetB.cjs → searchinput-BrxfRzez.cjs} +13 -13
- package/dist/{searchinput-CIseS5tL.js → searchinput-fPvXHu2O.js} +31 -31
- package/dist/{select-6XCVj1lP.js → select-BIgFPp42.js} +13 -13
- package/dist/{select-DO0xGhQQ.cjs → select-DzZHv6Bz.cjs} +3 -3
- package/dist/shared-types/index.d.ts +1 -1
- package/dist/shared-types/skin.d.ts +4 -0
- package/dist/{tabs-ClI1XQDt.js → tabs-BJx6wwXD.js} +29 -29
- package/dist/{tabs-CN_RIMWg.cjs → tabs-DxQy8U-0.cjs} +7 -7
- package/dist/{tag-DWtajZk6.cjs → tag-CBFz0R9N.cjs} +5 -5
- package/dist/{tag-hl59gziI.js → tag-CzlnHhho.js} +19 -19
- package/dist/textarea-M_S9WK7s.cjs +46 -0
- package/dist/{textarea-DBSNSvrX.js → textarea-qHtkhelz.js} +24 -25
- package/dist/{textinput-BZZnFDk3.js → textinput-CZrBM-Fj.js} +26 -26
- package/dist/{textinput-Dsc-8-BB.cjs → textinput-C_6kvf87.cjs} +12 -12
- package/dist/{timepicker-DDQ7CfOy.js → timepicker-O0iCeJyW.js} +51 -51
- package/dist/{timepicker-C2Ua6vHY.cjs → timepicker-WiYLAncb.cjs} +20 -20
- package/package.json +2 -2
- package/src/components/card/card.ts +1 -1
- package/src/components/heading/heading.test.ts +79 -70
- package/src/components/heading/heading.ts +40 -78
- package/src/components/icon/icon.test.ts +101 -0
- package/src/components/icon/icon.ts +40 -1
- package/dist/async-directive-B9P1Qa0k.cjs +0 -1
- package/dist/class-map-CJ-msbHs.cjs +0 -1
- package/dist/directive-3THFsVew.js +0 -28
- package/dist/directive-CJ2giQBZ.cjs +0 -1
- package/dist/element-DjtxO-1r.cjs +0 -2
- package/dist/element-with-slot-CWoTGA1B.cjs +0 -1
- package/dist/heading-BxvE80bb.js +0 -73
- package/dist/heading-DRJTS27k.cjs +0 -1
- package/dist/icon-Dr8sfT2X.cjs +0 -1
- package/dist/if-defined-XKOD_t_V.cjs +0 -1
- package/dist/linkcard-CBmJbSoV.cjs +0 -13
- package/dist/progressbar-Ca7pRjmt.cjs +0 -17
- package/dist/ref-BaJ0mBT_.cjs +0 -1
- package/dist/repeat-DaDFvx86.cjs +0 -1
- package/dist/textarea-CV6z3LDf.cjs +0 -46
- /package/dist/{booleanish-CRaKZ75t.js → booleanish-BmcOU-43.js} +0 -0
- /package/dist/{booleanish-B5EFqFpJ.cjs → booleanish-jJLlnr6-.cjs} +0 -0
- /package/dist/{classutils-z8YsPlOf.cjs → classutils-CVTzKF0J.cjs} +0 -0
- /package/dist/{classutils-DEL164Ur.js → classutils-lVbGcvjN.js} +0 -0
- /package/dist/{converters-Bffq_YDm.cjs → converters-C_66kHUN.cjs} +0 -0
- /package/dist/{converters-jauYkvNh.js → converters-DSQXaDQ_.js} +0 -0
- /package/dist/{dialog-polyfill.esm-B7W3teD0.js → dialog-polyfill.esm-0dVT8G1o.js} +0 -0
- /package/dist/{dialog-polyfill.esm-BnAQvMQO.cjs → dialog-polyfill.esm-CYs2AHP1.cjs} +0 -0
- /package/dist/{focus-modality-controller-pzSZkDkH.js → focus-modality-controller-CaUqYdk0.js} +0 -0
- /package/dist/{focus-modality-controller-BSZAQk8y.cjs → focus-modality-controller-wI5SR8wH.cjs} +0 -0
- /package/dist/{input-wrapper-CQGoyLdZ.cjs → input-wrapper-CYCCx8MP.cjs} +0 -0
- /package/dist/{input-wrapper-DwSsP39J.js → input-wrapper-kw2y6Jp_.js} +0 -0
- /package/dist/{utils-BOOZ0ppt.js → utils-CUqCKGvp.js} +0 -0
- /package/dist/{utils-CM67Oudc.cjs → utils-CjAbIttF.cjs} +0 -0
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as i, t as a } from "./element-with-slot-
|
|
3
|
-
import "./icon-
|
|
4
|
-
import { t as o } from "./if-defined-
|
|
1
|
+
import { n as e, o as t, p as n, s as r } from "./element-CduG0XyF.js";
|
|
2
|
+
import { n as i, t as a } from "./element-with-slot-BVj9MXzi.js";
|
|
3
|
+
import "./icon-LaKyBKON.js";
|
|
4
|
+
import { t as o } from "./if-defined-VShASPdu.js";
|
|
5
5
|
//#region src/components/linkcard/linkcard.ts
|
|
6
6
|
var s = class extends a {
|
|
7
7
|
constructor(...e) {
|
|
8
8
|
super(...e), this.title = "", this.href = "#", this.iconName = "", this.external = !1, this.openInNewTab = !1, this.skin = "normal";
|
|
9
9
|
}
|
|
10
10
|
render() {
|
|
11
|
-
let e = ["pkt-linkcard", this.skin && `pkt-linkcard--${this.skin}`].filter(Boolean).join(" "),
|
|
12
|
-
return
|
|
11
|
+
let e = ["pkt-linkcard", this.skin && `pkt-linkcard--${this.skin}`].filter(Boolean).join(" "), t = ["pkt-linkcard__title", this.external && "pkt-link pkt-link--external"].filter(Boolean).join(" ");
|
|
12
|
+
return n`
|
|
13
13
|
<a
|
|
14
14
|
href=${this.href}
|
|
15
15
|
class=${e}
|
|
16
16
|
target=${this.openInNewTab ? "_blank" : "_self"}
|
|
17
17
|
rel=${o(this.openInNewTab ? "noopener noreferrer" : void 0)}
|
|
18
18
|
>
|
|
19
|
-
${this.iconName &&
|
|
20
|
-
${this.title &&
|
|
19
|
+
${this.iconName && n`<pkt-icon class="pkt-link__icon" name="${this.iconName}" />`}
|
|
20
|
+
${this.title && n`<div class=${t}>${this.title}</div>`}
|
|
21
21
|
|
|
22
22
|
<div class="pkt-linkcard__text">${i(this)}</div>
|
|
23
23
|
</a>
|
|
24
24
|
`;
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
-
|
|
27
|
+
e([t({
|
|
28
28
|
type: String,
|
|
29
29
|
reflect: !0
|
|
30
|
-
})], s.prototype, "title", void 0),
|
|
30
|
+
})], s.prototype, "title", void 0), e([t({
|
|
31
31
|
type: String,
|
|
32
32
|
reflect: !0
|
|
33
|
-
})], s.prototype, "href", void 0),
|
|
33
|
+
})], s.prototype, "href", void 0), e([t({
|
|
34
34
|
type: String,
|
|
35
35
|
reflect: !0
|
|
36
|
-
})], s.prototype, "iconName", void 0),
|
|
36
|
+
})], s.prototype, "iconName", void 0), e([t({
|
|
37
37
|
type: Boolean,
|
|
38
38
|
reflect: !0
|
|
39
|
-
})], s.prototype, "external", void 0),
|
|
39
|
+
})], s.prototype, "external", void 0), e([t({
|
|
40
40
|
type: Boolean,
|
|
41
41
|
reflect: !0
|
|
42
|
-
})], s.prototype, "openInNewTab", void 0),
|
|
42
|
+
})], s.prototype, "openInNewTab", void 0), e([t({
|
|
43
43
|
type: String,
|
|
44
44
|
reflect: !0
|
|
45
45
|
})], s.prototype, "skin", void 0);
|
|
46
46
|
try {
|
|
47
|
-
|
|
47
|
+
r("pkt-linkcard")(s);
|
|
48
48
|
} catch {
|
|
49
49
|
console.warn("Forsøker å definere <pkt-linkcard>, men den er allerede definert");
|
|
50
50
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as c } from "./class-map-
|
|
3
|
-
import { t as l } from "./if-defined-
|
|
4
|
-
import { t as u } from "./repeat-
|
|
5
|
-
import { n as d } from "./utils-
|
|
1
|
+
import { a as e, d as t, n, o as r, p as i, r as a, s as o, t as s } from "./element-CduG0XyF.js";
|
|
2
|
+
import { t as c } from "./class-map-DH9hlJny.js";
|
|
3
|
+
import { t as l } from "./if-defined-VShASPdu.js";
|
|
4
|
+
import { t as u } from "./repeat-CKIii8Mi.js";
|
|
5
|
+
import { n as d } from "./utils-CUqCKGvp.js";
|
|
6
6
|
//#region ../../shared-utils/combobox/option-utils.ts
|
|
7
7
|
var f = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label === t)) || null, p = (e, t) => {
|
|
8
8
|
if (!t) return -1;
|
|
@@ -115,7 +115,7 @@ var f = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label ==
|
|
|
115
115
|
return this._filteredOptions.length > 0 || this.options.length > 0;
|
|
116
116
|
}
|
|
117
117
|
render() {
|
|
118
|
-
return
|
|
118
|
+
return i`
|
|
119
119
|
<div
|
|
120
120
|
class=${c({
|
|
121
121
|
"pkt-listbox": !0,
|
|
@@ -138,7 +138,7 @@ var f = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label ==
|
|
|
138
138
|
`;
|
|
139
139
|
}
|
|
140
140
|
renderCheckboxOrCheckIcon(e, n) {
|
|
141
|
-
return this.isMultiSelect ?
|
|
141
|
+
return this.isMultiSelect ? i`
|
|
142
142
|
<input
|
|
143
143
|
class="pkt-input-check__input-checkbox"
|
|
144
144
|
type="checkbox"
|
|
@@ -152,10 +152,10 @@ var f = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label ==
|
|
|
152
152
|
aria-labelledby=${this.id + "-option-label-" + n}
|
|
153
153
|
?disabled=${this.disabled || e.disabled || this.maxIsReached && !e.selected}
|
|
154
154
|
/>
|
|
155
|
-
` : e.selected ?
|
|
155
|
+
` : e.selected ? i`<pkt-icon name="check-big"></pkt-icon>` : t;
|
|
156
156
|
}
|
|
157
157
|
renderEmptyMessage() {
|
|
158
|
-
return this.options.length > 0 || this._filteredOptions.length > 0 || this.userMessage ?
|
|
158
|
+
return this.options.length > 0 || this._filteredOptions.length > 0 || this.userMessage ? t : i`<div class="pkt-listbox__banner pkt-listbox__banner--empty">
|
|
159
159
|
<pkt-icon
|
|
160
160
|
class="pkt-listbox__banner-icon"
|
|
161
161
|
name="exclamation-mark-circle"
|
|
@@ -165,8 +165,8 @@ var f = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label ==
|
|
|
165
165
|
</div>`;
|
|
166
166
|
}
|
|
167
167
|
renderList() {
|
|
168
|
-
return
|
|
169
|
-
${u(this._filteredOptions, (e) => e.value, (e, n) =>
|
|
168
|
+
return i`
|
|
169
|
+
${u(this._filteredOptions, (e) => e.value, (e, n) => i`
|
|
170
170
|
<li
|
|
171
171
|
@click=${() => {
|
|
172
172
|
this.toggleOption(e);
|
|
@@ -189,18 +189,18 @@ var f = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label ==
|
|
|
189
189
|
>
|
|
190
190
|
${this.renderCheckboxOrCheckIcon(e, n)}
|
|
191
191
|
<span class="pkt-listbox__option-label" id=${this.id + "-option-label-" + n}>
|
|
192
|
-
${e.prefix ?
|
|
192
|
+
${e.prefix ? i`<span class="pkt-listbox__option-prefix">${e.prefix}</span>` : t}
|
|
193
193
|
${e.label || e.value}
|
|
194
194
|
</span>
|
|
195
|
-
${e.description ?
|
|
195
|
+
${e.description ? i`<span class="pkt-listbox__option-description pkt-txt-14-light"
|
|
196
196
|
>${e.description}</span
|
|
197
|
-
>` :
|
|
197
|
+
>` : t}
|
|
198
198
|
</li>
|
|
199
199
|
`)}
|
|
200
200
|
`;
|
|
201
201
|
}
|
|
202
202
|
renderNewOptionBanner() {
|
|
203
|
-
return this.allowUserInput && this.customUserInput ?
|
|
203
|
+
return this.allowUserInput && this.customUserInput ? i`
|
|
204
204
|
<div
|
|
205
205
|
class="pkt-listbox__banner pkt-listbox__banner--new-option pkt-listbox__option"
|
|
206
206
|
data-type="new-option"
|
|
@@ -213,27 +213,27 @@ var f = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label ==
|
|
|
213
213
|
<pkt-icon class="pkt-listbox__banner-icon" name="plus-sign" size="large"></pkt-icon>
|
|
214
214
|
Legg til "${this.customUserInput}"
|
|
215
215
|
</div>
|
|
216
|
-
` :
|
|
216
|
+
` : t;
|
|
217
217
|
}
|
|
218
218
|
renderMaximumReachedBanner() {
|
|
219
|
-
return this._selectedOptions = this.options.filter((e) => e.selected).length, this.isMultiSelect && this._selectedOptions > 0 && this.maxLength > 0 ?
|
|
219
|
+
return this._selectedOptions = this.options.filter((e) => e.selected).length, this.isMultiSelect && this._selectedOptions > 0 && this.maxLength > 0 ? i`
|
|
220
220
|
<div class="pkt-listbox__banner pkt-listbox__banner--maximum-reached">
|
|
221
221
|
${this._selectedOptions} av maks ${this.maxLength} mulige er valgt.
|
|
222
222
|
</div>
|
|
223
|
-
` :
|
|
223
|
+
` : t;
|
|
224
224
|
}
|
|
225
225
|
renderUserMessage() {
|
|
226
|
-
return this.userMessage ?
|
|
226
|
+
return this.userMessage ? i`<div class="pkt-listbox__banner pkt-listbox__banner--user-message">
|
|
227
227
|
<pkt-icon
|
|
228
228
|
class="pkt-listbox__banner-icon"
|
|
229
229
|
name="exclamation-mark-circle"
|
|
230
230
|
size="large"
|
|
231
231
|
></pkt-icon>
|
|
232
232
|
${this.userMessage}
|
|
233
|
-
</div>` :
|
|
233
|
+
</div>` : t;
|
|
234
234
|
}
|
|
235
235
|
renderSearch() {
|
|
236
|
-
return this.includeSearch ?
|
|
236
|
+
return this.includeSearch ? i`
|
|
237
237
|
<div class="pkt-listbox__search">
|
|
238
238
|
<span class="pkt-listbox__search-icon">
|
|
239
239
|
<pkt-icon name="magnifying-glass-small" size="large"></pkt-icon>
|
|
@@ -243,7 +243,7 @@ var f = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label ==
|
|
|
243
243
|
type="text"
|
|
244
244
|
aria-label="Søk i listen"
|
|
245
245
|
form=""
|
|
246
|
-
placeholder=${this.searchPlaceholder ||
|
|
246
|
+
placeholder=${this.searchPlaceholder || a.forms.search.placeholder}
|
|
247
247
|
@input=${this.handleSearchInput}
|
|
248
248
|
@keydown=${this.handleSearchKeydown}
|
|
249
249
|
.value=${this.searchValue}
|
|
@@ -253,7 +253,7 @@ var f = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label ==
|
|
|
253
253
|
role="searchbox"
|
|
254
254
|
/>
|
|
255
255
|
</div>
|
|
256
|
-
` :
|
|
256
|
+
` : t;
|
|
257
257
|
}
|
|
258
258
|
handleSearchInput(e) {
|
|
259
259
|
this.searchValue = e.target.value, this.dispatchEvent(new CustomEvent("search", {
|
|
@@ -353,40 +353,40 @@ var f = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label ==
|
|
|
353
353
|
r >= 0 && S(n[r]);
|
|
354
354
|
}
|
|
355
355
|
};
|
|
356
|
-
|
|
356
|
+
n([r({ type: String })], k.prototype, "id", void 0), n([r({ type: String })], k.prototype, "label", void 0), n([r({ type: Array })], k.prototype, "options", void 0), n([r({
|
|
357
357
|
type: Boolean,
|
|
358
358
|
reflect: !0,
|
|
359
359
|
attribute: "is-open"
|
|
360
|
-
})], k.prototype, "isOpen", void 0),
|
|
360
|
+
})], k.prototype, "isOpen", void 0), n([r({ type: Boolean })], k.prototype, "disabled", void 0), n([r({
|
|
361
361
|
type: Boolean,
|
|
362
362
|
attribute: "include-search"
|
|
363
|
-
})], k.prototype, "includeSearch", void 0),
|
|
363
|
+
})], k.prototype, "includeSearch", void 0), n([r({
|
|
364
364
|
type: Boolean,
|
|
365
365
|
attribute: "is-multi-select"
|
|
366
|
-
})], k.prototype, "isMultiSelect", void 0),
|
|
366
|
+
})], k.prototype, "isMultiSelect", void 0), n([r({
|
|
367
367
|
type: Boolean,
|
|
368
368
|
attribute: "allow-user-input"
|
|
369
|
-
})], k.prototype, "allowUserInput", void 0),
|
|
369
|
+
})], k.prototype, "allowUserInput", void 0), n([r({
|
|
370
370
|
type: Boolean,
|
|
371
371
|
attribute: "max-is-reached"
|
|
372
|
-
})], k.prototype, "maxIsReached", void 0),
|
|
372
|
+
})], k.prototype, "maxIsReached", void 0), n([r({
|
|
373
373
|
type: String,
|
|
374
374
|
attribute: "custom-user-input"
|
|
375
|
-
})], k.prototype, "customUserInput", void 0),
|
|
375
|
+
})], k.prototype, "customUserInput", void 0), n([r({
|
|
376
376
|
type: String,
|
|
377
377
|
attribute: "search-placeholder"
|
|
378
|
-
})], k.prototype, "searchPlaceholder", void 0),
|
|
378
|
+
})], k.prototype, "searchPlaceholder", void 0), n([r({
|
|
379
379
|
type: String,
|
|
380
380
|
attribute: "search-value"
|
|
381
|
-
})], k.prototype, "searchValue", void 0),
|
|
381
|
+
})], k.prototype, "searchValue", void 0), n([r({
|
|
382
382
|
type: Number,
|
|
383
383
|
attribute: "max-length"
|
|
384
|
-
})], k.prototype, "maxLength", void 0),
|
|
384
|
+
})], k.prototype, "maxLength", void 0), n([r({
|
|
385
385
|
type: String,
|
|
386
386
|
attribute: "user-message"
|
|
387
|
-
})], k.prototype, "userMessage", void 0),
|
|
387
|
+
})], k.prototype, "userMessage", void 0), n([e()], k.prototype, "_filteredOptions", void 0);
|
|
388
388
|
try {
|
|
389
|
-
|
|
389
|
+
o("pkt-listbox")(k);
|
|
390
390
|
} catch {
|
|
391
391
|
console.warn("Forsøker å definere <pkt-listbox>, men den er allerede definert");
|
|
392
392
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require(`./element-
|
|
1
|
+
const e=require(`./element-CXAtr6Gu.cjs`),t=require(`./class-map-B8Ja0q7n.cjs`),n=require(`./if-defined-LTjAScFG.cjs`),r=require(`./repeat-CRRgmzVn.cjs`),i=require(`./utils-CjAbIttF.cjs`);var a=(e,t)=>t&&(e.find(e=>e.value===t)||e.find(e=>e.label===t))||null,o=(e,t)=>{if(!t)return-1;let n=e.findIndex(e=>e.value===t);return n>=0?n:e.findIndex(e=>e.label===t)},s=(e,t)=>{if(!t)return[...e];let n=t.toLowerCase();return e.filter(e=>(e.fulltext||e.value+(e.label||``)+(e.prefix||``)).toLowerCase().includes(n))},c=e=>e.value+(e.label||``)+(e.prefix||``),l=(e,t)=>t!==null&&e>=t,u=(e,t)=>{if(!t)return{filtered:[...e],suggestion:null};let n=t.toLowerCase(),r=e.filter(e=>e.fulltext?.toLowerCase().includes(n));return{filtered:r,suggestion:r.find(e=>!e.selected&&e.label?.toLowerCase().startsWith(n))||null}},d=(e,t,n,r)=>{if(!e.trim())return{addValueText:null,userInfoMessage:``};let i=e.trim().toLowerCase(),a=t.find(e=>e.toLowerCase()===i),o=n.filter(e=>e.label?.toLowerCase().includes(i)||e.value.toLowerCase().includes(i)),s=o.find(e=>e.label?.toLowerCase()===i||e.value.toLowerCase()===i);return(o.length===0||!s)&&r?{addValueText:e,userInfoMessage:``}:o.length===0&&!r?{addValueText:null,userInfoMessage:`Ingen treff i søket`}:a?{addValueText:null,userInfoMessage:`Verdien er allerede valgt`}:{addValueText:null,userInfoMessage:``}},f=e=>/^[\p{L} ]$/u.test(e),p=(e=500)=>{let t=``,n;return{append:r=>(t+=r.toLowerCase(),n!==void 0&&clearTimeout(n),n=setTimeout(()=>{t=``},e),t),reset:()=>{t=``,n!==void 0&&(clearTimeout(n),n=void 0)},getBuffer:()=>t}},m=(e,t)=>{let n=t.toLowerCase();return e.findIndex(e=>e.textContent?.trim().toLowerCase().startsWith(n))},h=e=>{e.scrollIntoView({block:`nearest`}),window.setTimeout(()=>e.focus(),0)},g=e=>Array.from(e.querySelectorAll(`[role="option"]:not([data-disabled])`)||[]),_=e=>{let t=e.nextElementSibling;t&&h(t)},v=(e,t,n)=>{let r=e.previousElementSibling;if(e.dataset.index===`0`&&n){let e=t.querySelector(`[role="searchbox"]`);e&&h(e)}else r&&h(r)},y=e=>{let t=g(e);t[0]&&h(t[0])},b=e=>{let t=g(e),n=t[t.length-1];n&&h(n)},x=(e,t)=>{if(t.disabled)return;let n=g(e);if(t.allowUserInput&&t.customUserInput){let t=e.querySelector(`[data-type="new-option"]`);if(t){h(t);return}}let r=n.find(e=>e.dataset.selected===`true`);if(r){h(r);return}if(t.includeSearch&&!(document.activeElement instanceof HTMLInputElement)){let t=e.querySelector(`[role="searchbox"]`);if(t){window.setTimeout(()=>t.focus(),0);return}}n[0]&&h(n[0])},S=class extends e.t{constructor(...e){super(...e),this.id=i.n(),this.label=null,this.options=[],this.isOpen=!1,this.disabled=!1,this.includeSearch=!1,this.isMultiSelect=!1,this.allowUserInput=!1,this.maxIsReached=!1,this.customUserInput=null,this.searchPlaceholder=null,this.searchValue=null,this.maxLength=0,this.userMessage=null,this._selectedOptions=0,this.typeahead=p(),this._filteredOptions=[]}connectedCallback(){super.connectedCallback(),this.includeSearch&&!this.searchValue&&(this.searchValue=``),this.options.length>0&&this.filterOptions(),this.setAttribute(`tabindex`,`-1`),this.addEventListener(`focus`,this.focusFirstOrSelectedOption)}disconnectedCallback(){super.disconnectedCallback(),this.typeahead.reset()}updated(e){(e.has(`options`)||e.has(`searchValue`))&&this.filterOptions(),super.updated(e)}attributeChangedCallback(e,t,n){(e===`options`||e===`search-value`)&&this.filterOptions(),super.attributeChangedCallback(e,t,n)}get _hasOptions(){return this._filteredOptions.length>0||this.options.length>0}render(){return e.p`
|
|
2
2
|
<div
|
|
3
3
|
class=${t.t({"pkt-listbox":!0,"pkt-listbox__open":this.isOpen,"pkt-txt-16-light":!0})}
|
|
4
4
|
role=${n.t(this._hasOptions?`listbox`:void 0)}
|
|
@@ -14,7 +14,7 @@ const e=require(`./element-DjtxO-1r.cjs`),t=require(`./class-map-CJ-msbHs.cjs`),
|
|
|
14
14
|
</ul>
|
|
15
15
|
</div>
|
|
16
16
|
<div aria-live="polite" class="pkt-visually-hidden">${this.userMessage}</div>
|
|
17
|
-
`}renderCheckboxOrCheckIcon(t,n){return this.isMultiSelect?e.
|
|
17
|
+
`}renderCheckboxOrCheckIcon(t,n){return this.isMultiSelect?e.p`
|
|
18
18
|
<input
|
|
19
19
|
class="pkt-input-check__input-checkbox"
|
|
20
20
|
type="checkbox"
|
|
@@ -26,15 +26,15 @@ const e=require(`./element-DjtxO-1r.cjs`),t=require(`./class-map-CJ-msbHs.cjs`),
|
|
|
26
26
|
aria-labelledby=${this.id+`-option-label-`+n}
|
|
27
27
|
?disabled=${this.disabled||t.disabled||this.maxIsReached&&!t.selected}
|
|
28
28
|
/>
|
|
29
|
-
`:t.selected?e.
|
|
29
|
+
`:t.selected?e.p`<pkt-icon name="check-big"></pkt-icon>`:e.d}renderEmptyMessage(){return this.options.length>0||this._filteredOptions.length>0||this.userMessage?e.d:e.p`<div class="pkt-listbox__banner pkt-listbox__banner--empty">
|
|
30
30
|
<pkt-icon
|
|
31
31
|
class="pkt-listbox__banner-icon"
|
|
32
32
|
name="exclamation-mark-circle"
|
|
33
33
|
size="large"
|
|
34
34
|
></pkt-icon>
|
|
35
35
|
Tom liste
|
|
36
|
-
</div>`}renderList(){return e.
|
|
37
|
-
${r.t(this._filteredOptions,e=>e.value,(n,r)=>e.
|
|
36
|
+
</div>`}renderList(){return e.p`
|
|
37
|
+
${r.t(this._filteredOptions,e=>e.value,(n,r)=>e.p`
|
|
38
38
|
<li
|
|
39
39
|
@click=${()=>{this.toggleOption(n)}}
|
|
40
40
|
aria-selected=${n.selected?`true`:`false`}
|
|
@@ -51,15 +51,15 @@ const e=require(`./element-DjtxO-1r.cjs`),t=require(`./class-map-CJ-msbHs.cjs`),
|
|
|
51
51
|
>
|
|
52
52
|
${this.renderCheckboxOrCheckIcon(n,r)}
|
|
53
53
|
<span class="pkt-listbox__option-label" id=${this.id+`-option-label-`+r}>
|
|
54
|
-
${n.prefix?e.
|
|
54
|
+
${n.prefix?e.p`<span class="pkt-listbox__option-prefix">${n.prefix}</span>`:e.d}
|
|
55
55
|
${n.label||n.value}
|
|
56
56
|
</span>
|
|
57
|
-
${n.description?e.
|
|
57
|
+
${n.description?e.p`<span class="pkt-listbox__option-description pkt-txt-14-light"
|
|
58
58
|
>${n.description}</span
|
|
59
|
-
>`:e.
|
|
59
|
+
>`:e.d}
|
|
60
60
|
</li>
|
|
61
61
|
`)}
|
|
62
|
-
`}renderNewOptionBanner(){return this.allowUserInput&&this.customUserInput?e.
|
|
62
|
+
`}renderNewOptionBanner(){return this.allowUserInput&&this.customUserInput?e.p`
|
|
63
63
|
<div
|
|
64
64
|
class="pkt-listbox__banner pkt-listbox__banner--new-option pkt-listbox__option"
|
|
65
65
|
data-type="new-option"
|
|
@@ -72,18 +72,18 @@ const e=require(`./element-DjtxO-1r.cjs`),t=require(`./class-map-CJ-msbHs.cjs`),
|
|
|
72
72
|
<pkt-icon class="pkt-listbox__banner-icon" name="plus-sign" size="large"></pkt-icon>
|
|
73
73
|
Legg til "${this.customUserInput}"
|
|
74
74
|
</div>
|
|
75
|
-
`:e.
|
|
75
|
+
`:e.d}renderMaximumReachedBanner(){return this._selectedOptions=this.options.filter(e=>e.selected).length,this.isMultiSelect&&this._selectedOptions>0&&this.maxLength>0?e.p`
|
|
76
76
|
<div class="pkt-listbox__banner pkt-listbox__banner--maximum-reached">
|
|
77
77
|
${this._selectedOptions} av maks ${this.maxLength} mulige er valgt.
|
|
78
78
|
</div>
|
|
79
|
-
`:e.
|
|
79
|
+
`:e.d}renderUserMessage(){return this.userMessage?e.p`<div class="pkt-listbox__banner pkt-listbox__banner--user-message">
|
|
80
80
|
<pkt-icon
|
|
81
81
|
class="pkt-listbox__banner-icon"
|
|
82
82
|
name="exclamation-mark-circle"
|
|
83
83
|
size="large"
|
|
84
84
|
></pkt-icon>
|
|
85
85
|
${this.userMessage}
|
|
86
|
-
</div>`:e.
|
|
86
|
+
</div>`:e.d}renderSearch(){return this.includeSearch?e.p`
|
|
87
87
|
<div class="pkt-listbox__search">
|
|
88
88
|
<span class="pkt-listbox__search-icon">
|
|
89
89
|
<pkt-icon name="magnifying-glass-small" size="large"></pkt-icon>
|
|
@@ -93,7 +93,7 @@ const e=require(`./element-DjtxO-1r.cjs`),t=require(`./class-map-CJ-msbHs.cjs`),
|
|
|
93
93
|
type="text"
|
|
94
94
|
aria-label="Søk i listen"
|
|
95
95
|
form=""
|
|
96
|
-
placeholder=${this.searchPlaceholder||e.
|
|
96
|
+
placeholder=${this.searchPlaceholder||e.r.forms.search.placeholder}
|
|
97
97
|
@input=${this.handleSearchInput}
|
|
98
98
|
@keydown=${this.handleSearchKeydown}
|
|
99
99
|
.value=${this.searchValue}
|
|
@@ -103,4 +103,4 @@ const e=require(`./element-DjtxO-1r.cjs`),t=require(`./class-map-CJ-msbHs.cjs`),
|
|
|
103
103
|
role="searchbox"
|
|
104
104
|
/>
|
|
105
105
|
</div>
|
|
106
|
-
`:e.
|
|
106
|
+
`:e.d}handleSearchInput(e){this.searchValue=e.target.value,this.dispatchEvent(new CustomEvent(`search`,{detail:this.searchValue,bubbles:!1}))}handleSearchKeydown(e){switch(e.key){case`Enter`:e.preventDefault();break;case`ArrowUp`:case`Escape`:this.closeOptions(),e.preventDefault();break;case`ArrowDown`:this.focusFirstOrSelectedOption();break;case`Tab`:this.tabClose();break}}handleOptionKeydown(e){let t=e.currentTarget,n=t.dataset.value,r=t.dataset.type,i=t.dataset.selected===`true`;if(!(!g(this).length&&(!this.customUserInput||!this.allowUserInput&&this.customUserInput)&&r!==`new-option`&&r!==`searchbox`))switch(e.key){case` `:case`Enter`:this.toggleOption(t),e.preventDefault();break;case`Backspace`:n&&(i?this.toggleOption(t):this.closeOptions()),e.preventDefault();break;case`Escape`:this.closeOptions(),e.preventDefault();break;case`Tab`:this.tabClose();break;case`ArrowDown`:e.altKey?b(this):r===`searchbox`||r===`new-option`?y(this):_(t),e.preventDefault();break;case`ArrowUp`:if(e.altKey)y(this);else if(t.dataset.index===`0`&&this.includeSearch){let e=this.querySelector(`[role="searchbox"]`);e&&e.focus()}else if(t.dataset.index===`0`&&this.customUserInput){let e=this.querySelector(`[data-type="new-option"]`);e&&e.focus()}else v(t,this,this.includeSearch);e.preventDefault();break;case`Home`:y(this),e.preventDefault();break;case`End`:b(this),e.preventDefault();break;default:(e.metaKey||e.ctrlKey)&&e.key===`a`&&(this.selectAll(),e.preventDefault()),f(e.key)&&(this.handleTypeAhead(e.key),e.preventDefault());break}}focusFirstOrSelectedOption(){x(this,{disabled:this.disabled,allowUserInput:this.allowUserInput,customUserInput:this.customUserInput,includeSearch:this.includeSearch})}toggleOption(e){let t=e instanceof HTMLElement?e.dataset.disabled:e.disabled;if(this.disabled||t)return;let n=e instanceof HTMLElement?e.dataset.value:e.value;this.dispatchEvent(new CustomEvent(`option-toggle`,{detail:n,bubbles:!1}))}selectAll(){this.dispatchEvent(new CustomEvent(`select-all`,{bubbles:!1}))}closeOptions(){this.dispatchEvent(new CustomEvent(`close-options`,{bubbles:!1}))}tabClose(){this.dispatchEvent(new CustomEvent(`tab-close`,{bubbles:!1}))}filterOptions(){this._filteredOptions=s(this.options,this.searchValue)}handleTypeAhead(e){let t=this.typeahead.append(e),n=g(this),r=m(n,t);r>=0&&h(n[r])}};e.n([e.o({type:String})],S.prototype,`id`,void 0),e.n([e.o({type:String})],S.prototype,`label`,void 0),e.n([e.o({type:Array})],S.prototype,`options`,void 0),e.n([e.o({type:Boolean,reflect:!0,attribute:`is-open`})],S.prototype,`isOpen`,void 0),e.n([e.o({type:Boolean})],S.prototype,`disabled`,void 0),e.n([e.o({type:Boolean,attribute:`include-search`})],S.prototype,`includeSearch`,void 0),e.n([e.o({type:Boolean,attribute:`is-multi-select`})],S.prototype,`isMultiSelect`,void 0),e.n([e.o({type:Boolean,attribute:`allow-user-input`})],S.prototype,`allowUserInput`,void 0),e.n([e.o({type:Boolean,attribute:`max-is-reached`})],S.prototype,`maxIsReached`,void 0),e.n([e.o({type:String,attribute:`custom-user-input`})],S.prototype,`customUserInput`,void 0),e.n([e.o({type:String,attribute:`search-placeholder`})],S.prototype,`searchPlaceholder`,void 0),e.n([e.o({type:String,attribute:`search-value`})],S.prototype,`searchValue`,void 0),e.n([e.o({type:Number,attribute:`max-length`})],S.prototype,`maxLength`,void 0),e.n([e.o({type:String,attribute:`user-message`})],S.prototype,`userMessage`,void 0),e.n([e.a()],S.prototype,`_filteredOptions`,void 0);try{e.s(`pkt-listbox`)(S)}catch{console.warn(`Forsøker å definere <pkt-listbox>, men den er allerede definert`)}var C=S;Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return C}});
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
const e=require(`./element-
|
|
1
|
+
const e=require(`./element-CXAtr6Gu.cjs`),t=require(`./class-map-B8Ja0q7n.cjs`),n=require(`./element-with-slot-Cmxb9h4H.cjs`);require(`./icon-Dw6I0HDV.cjs`),window.pktAnimationPath=window.pktAnimationPath||`https://punkt-cdn.oslo.kommune.no/latest/animations/`;var r=class extends n.t{constructor(...e){super(...e),this.delay=0,this.inline=!1,this.isLoading=!0,this.message=null,this.size=`medium`,this.variant=`shapes`,this.loadingAnimationPath=window.pktAnimationPath,this._shouldDisplayLoader=!1}connectedCallback(){super.connectedCallback(),this._shouldDisplayLoader=this.delay===0,this.delay>0&&this.setupLoader()}updated(e){e.has(`delay`)&&this.setupLoader()}render(){let r=t.t({"pkt-loader":!0,[`pkt-loader--${this.inline?`inline`:`box`}`]:!0,[`pkt-loader--${this.size}`]:!0}),i=t.t({"pkt-contents":!0,"pkt-hide":this.isLoading});return e.p`<div
|
|
2
2
|
role="status"
|
|
3
3
|
aria-live="polite"
|
|
4
4
|
aria-busy=${this.isLoading?`true`:`false`}
|
|
5
5
|
class=${r}
|
|
6
6
|
>
|
|
7
|
-
${this.isLoading&&this._shouldDisplayLoader?e.
|
|
7
|
+
${this.isLoading&&this._shouldDisplayLoader?e.p`<div class="pkt-loader__spinner">
|
|
8
8
|
<pkt-icon
|
|
9
9
|
name=${this.getVariant(this.variant)}
|
|
10
10
|
path=${this.loadingAnimationPath}
|
|
11
11
|
class="pkt-loader__svg pkt-loader__${this.variant}"
|
|
12
12
|
></pkt-icon>
|
|
13
|
-
${this.message&&e.
|
|
14
|
-
</div>`:e.
|
|
13
|
+
${this.message&&e.p`<p>${this.message}</p>`}
|
|
14
|
+
</div>`:e.d}
|
|
15
15
|
<div class=${i}>${n.n(this)}</div>
|
|
16
|
-
</div>`}getVariant(e){switch(e){case`blue`:return`spinner-blue`;case`rainbow`:return`spinner`;default:return`loader`}}setupLoader(){this.delay>0&&(this._shouldDisplayLoader=!1,setTimeout(()=>{this._shouldDisplayLoader=!0,this.requestUpdate()},this.delay))}};e.
|
|
16
|
+
</div>`}getVariant(e){switch(e){case`blue`:return`spinner-blue`;case`rainbow`:return`spinner`;default:return`loader`}}setupLoader(){this.delay>0&&(this._shouldDisplayLoader=!1,setTimeout(()=>{this._shouldDisplayLoader=!0,this.requestUpdate()},this.delay))}};e.n([e.o({type:Number})],r.prototype,`delay`,void 0),e.n([e.o({type:Boolean})],r.prototype,`inline`,void 0),e.n([e.o({type:Boolean})],r.prototype,`isLoading`,void 0),e.n([e.o({type:String})],r.prototype,`message`,void 0),e.n([e.o({type:String})],r.prototype,`size`,void 0),e.n([e.o({type:String})],r.prototype,`variant`,void 0),e.n([e.o({type:String})],r.prototype,`loadingAnimationPath`,void 0),e.n([e.a()],r.prototype,`_shouldDisplayLoader`,void 0);try{e.s(`pkt-loader`)(r)}catch{console.warn(`Forsøker å definere <pkt-loader>, men den er allerede definert`)}var i=r;Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return i}});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as o } from "./class-map-
|
|
3
|
-
import { n as s, t as c } from "./element-with-slot-
|
|
4
|
-
import "./icon-
|
|
1
|
+
import { a as e, d as t, n, o as r, p as i, s as a } from "./element-CduG0XyF.js";
|
|
2
|
+
import { t as o } from "./class-map-DH9hlJny.js";
|
|
3
|
+
import { n as s, t as c } from "./element-with-slot-BVj9MXzi.js";
|
|
4
|
+
import "./icon-LaKyBKON.js";
|
|
5
5
|
//#region src/components/loader/loader.ts
|
|
6
6
|
window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/latest/animations/";
|
|
7
7
|
var l = class extends c {
|
|
@@ -19,25 +19,25 @@ var l = class extends c {
|
|
|
19
19
|
"pkt-loader": !0,
|
|
20
20
|
[`pkt-loader--${this.inline ? "inline" : "box"}`]: !0,
|
|
21
21
|
[`pkt-loader--${this.size}`]: !0
|
|
22
|
-
}),
|
|
22
|
+
}), n = o({
|
|
23
23
|
"pkt-contents": !0,
|
|
24
24
|
"pkt-hide": this.isLoading
|
|
25
25
|
});
|
|
26
|
-
return
|
|
26
|
+
return i`<div
|
|
27
27
|
role="status"
|
|
28
28
|
aria-live="polite"
|
|
29
29
|
aria-busy=${this.isLoading ? "true" : "false"}
|
|
30
30
|
class=${e}
|
|
31
31
|
>
|
|
32
|
-
${this.isLoading && this._shouldDisplayLoader ?
|
|
32
|
+
${this.isLoading && this._shouldDisplayLoader ? i`<div class="pkt-loader__spinner">
|
|
33
33
|
<pkt-icon
|
|
34
34
|
name=${this.getVariant(this.variant)}
|
|
35
35
|
path=${this.loadingAnimationPath}
|
|
36
36
|
class="pkt-loader__svg pkt-loader__${this.variant}"
|
|
37
37
|
></pkt-icon>
|
|
38
|
-
${this.message &&
|
|
39
|
-
</div>` :
|
|
40
|
-
<div class=${
|
|
38
|
+
${this.message && i`<p>${this.message}</p>`}
|
|
39
|
+
</div>` : t}
|
|
40
|
+
<div class=${n}>${s(this)}</div>
|
|
41
41
|
</div>`;
|
|
42
42
|
}
|
|
43
43
|
getVariant(e) {
|
|
@@ -53,9 +53,9 @@ var l = class extends c {
|
|
|
53
53
|
}, this.delay));
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
-
|
|
56
|
+
n([r({ type: Number })], l.prototype, "delay", void 0), n([r({ type: Boolean })], l.prototype, "inline", void 0), n([r({ type: Boolean })], l.prototype, "isLoading", void 0), n([r({ type: String })], l.prototype, "message", void 0), n([r({ type: String })], l.prototype, "size", void 0), n([r({ type: String })], l.prototype, "variant", void 0), n([r({ type: String })], l.prototype, "loadingAnimationPath", void 0), n([e()], l.prototype, "_shouldDisplayLoader", void 0);
|
|
57
57
|
try {
|
|
58
|
-
|
|
58
|
+
a("pkt-loader")(l);
|
|
59
59
|
} catch {
|
|
60
60
|
console.warn("Forsøker å definere <pkt-loader>, men den er allerede definert");
|
|
61
61
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const e=require(`./element-
|
|
2
|
-
${this.closable?e.
|
|
1
|
+
const e=require(`./element-CXAtr6Gu.cjs`),t=require(`./class-map-B8Ja0q7n.cjs`),n=require(`./element-with-slot-Cmxb9h4H.cjs`),r=require(`./classutils-CVTzKF0J.cjs`);require(`./icon-Dw6I0HDV.cjs`);var i={name:`pkt-messagebox`,react:`PktMessagebox`,"css-class":`pkt-messagebox`,isElement:!0,isPureReact:!0,events:{onClose:{description:`React: Event som trigges når meldingsboksen lukkes`},"on-close":{description:`Vue: Event som trigges når meldingsboksen lukkes`}},props:{title:{name:`Tittel`,description:`Tittelen på meldingsboksen`,type:`string`,category:`contents`},skin:{name:`Utseende`,description:`Velg farge på meldingsboksen`,type:[`beige`,`blue`,`red`,`green`],category:`ui`,default:`beige`},compact:{name:`Kompakt`,description:`Gjør meldingsboksen mindre`,type:`boolean`,category:`ui`,default:!1},closable:{name:`Kan lukkes`,description:`Viser lukkeknapp`,type:`boolean`,category:`ui`,default:!1}},slots:{default:{description:`Innholdet i meldingsboksen`}}},a=class extends n.t{constructor(){super(),this.closable=i.props.closable.default,this.compact=i.props.compact.default,this.title=``,this.skin=i.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._isClosed=!1}updated(e){super.updated(e),e.has(`_isClosed`)&&r.t(this,`pkt-hide`,this._isClosed)}render(){return e.p`<div class=${t.t({"pkt-messagebox":!0,"pkt-messagebox--compact":this.compact,[`pkt-messagebox--${this.skin}`]:this.skin,"pkt-messagebox--closable":this.closable,"pkt-hide":this._isClosed})}>
|
|
2
|
+
${this.closable?e.p`<div class="pkt-messagebox__close">
|
|
3
3
|
<button
|
|
4
4
|
@click=${this.close}
|
|
5
5
|
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only"
|
|
@@ -7,7 +7,7 @@ const e=require(`./element-DjtxO-1r.cjs`),t=require(`./class-map-CJ-msbHs.cjs`),
|
|
|
7
7
|
>
|
|
8
8
|
<pkt-icon name="close" class="pkt-link__icon"></pkt-icon>
|
|
9
9
|
</button>
|
|
10
|
-
</div>`:e.
|
|
11
|
-
${this.title?e.
|
|
10
|
+
</div>`:e.d}
|
|
11
|
+
${this.title?e.p`<div class="pkt-messagebox__title">${this.title}</div>`:e.d}
|
|
12
12
|
<div class="pkt-messagebox__text">${n.n(this)}</div>
|
|
13
|
-
</div>`}};e.
|
|
13
|
+
</div>`}};e.n([e.o({type:Boolean,reflect:!0})],a.prototype,`closable`,void 0),e.n([e.o({type:Boolean,reflect:!0})],a.prototype,`compact`,void 0),e.n([e.o({type:String,reflect:!0})],a.prototype,`title`,void 0),e.n([e.o({type:String,reflect:!0})],a.prototype,`skin`,void 0),e.n([e.a()],a.prototype,`_isClosed`,void 0);try{e.s(`pkt-messagebox`)(a)}catch{console.warn(`Forsøker å definere <pkt-messagebox>, men den er allerede definert`)}var o=a;Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return o}});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as o } from "./class-map-
|
|
3
|
-
import { n as s, t as c } from "./element-with-slot-
|
|
4
|
-
import { t as l } from "./classutils-
|
|
5
|
-
import "./icon-
|
|
1
|
+
import { a as e, d as t, n, o as r, p as i, s as a } from "./element-CduG0XyF.js";
|
|
2
|
+
import { t as o } from "./class-map-DH9hlJny.js";
|
|
3
|
+
import { n as s, t as c } from "./element-with-slot-BVj9MXzi.js";
|
|
4
|
+
import { t as l } from "./classutils-lVbGcvjN.js";
|
|
5
|
+
import "./icon-LaKyBKON.js";
|
|
6
6
|
var u = {
|
|
7
7
|
name: "pkt-messagebox",
|
|
8
8
|
react: "PktMessagebox",
|
|
@@ -64,14 +64,14 @@ var u = {
|
|
|
64
64
|
super.updated(e), e.has("_isClosed") && l(this, "pkt-hide", this._isClosed);
|
|
65
65
|
}
|
|
66
66
|
render() {
|
|
67
|
-
return
|
|
67
|
+
return i`<div class=${o({
|
|
68
68
|
"pkt-messagebox": !0,
|
|
69
69
|
"pkt-messagebox--compact": this.compact,
|
|
70
70
|
[`pkt-messagebox--${this.skin}`]: this.skin,
|
|
71
71
|
"pkt-messagebox--closable": this.closable,
|
|
72
72
|
"pkt-hide": this._isClosed
|
|
73
73
|
})}>
|
|
74
|
-
${this.closable ?
|
|
74
|
+
${this.closable ? i`<div class="pkt-messagebox__close">
|
|
75
75
|
<button
|
|
76
76
|
@click=${this.close}
|
|
77
77
|
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only"
|
|
@@ -79,27 +79,27 @@ var u = {
|
|
|
79
79
|
>
|
|
80
80
|
<pkt-icon name="close" class="pkt-link__icon"></pkt-icon>
|
|
81
81
|
</button>
|
|
82
|
-
</div>` :
|
|
83
|
-
${this.title ?
|
|
82
|
+
</div>` : t}
|
|
83
|
+
${this.title ? i`<div class="pkt-messagebox__title">${this.title}</div>` : t}
|
|
84
84
|
<div class="pkt-messagebox__text">${s(this)}</div>
|
|
85
85
|
</div>`;
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
|
-
|
|
88
|
+
n([r({
|
|
89
89
|
type: Boolean,
|
|
90
90
|
reflect: !0
|
|
91
|
-
})], d.prototype, "closable", void 0),
|
|
91
|
+
})], d.prototype, "closable", void 0), n([r({
|
|
92
92
|
type: Boolean,
|
|
93
93
|
reflect: !0
|
|
94
|
-
})], d.prototype, "compact", void 0),
|
|
94
|
+
})], d.prototype, "compact", void 0), n([r({
|
|
95
95
|
type: String,
|
|
96
96
|
reflect: !0
|
|
97
|
-
})], d.prototype, "title", void 0),
|
|
97
|
+
})], d.prototype, "title", void 0), n([r({
|
|
98
98
|
type: String,
|
|
99
99
|
reflect: !0
|
|
100
|
-
})], d.prototype, "skin", void 0),
|
|
100
|
+
})], d.prototype, "skin", void 0), n([e()], d.prototype, "_isClosed", void 0);
|
|
101
101
|
try {
|
|
102
|
-
|
|
102
|
+
a("pkt-messagebox")(d);
|
|
103
103
|
} catch {
|
|
104
104
|
console.warn("Forsøker å definere <pkt-messagebox>, men den er allerede definert");
|
|
105
105
|
}
|