@oslokommune/punkt-elements 16.7.3 → 16.7.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 +18 -0
- package/dist/accordion-BB1JrONI.cjs +34 -0
- package/dist/accordion-nNH87Y60.js +130 -0
- package/dist/alert-BEEnTiCb.cjs +33 -0
- package/dist/alert-ePJuDtmm.js +171 -0
- package/dist/async-directive-B9P1Qa0k.cjs +1 -0
- package/dist/async-directive-CaQiqjyV.js +55 -0
- package/dist/backlink-Ba03LlbB.cjs +13 -0
- package/dist/backlink-CiwXrQYD.js +38 -0
- package/dist/booleanish-BmcOU-43.js +11 -0
- package/dist/booleanish-jJLlnr6-.cjs +1 -0
- package/dist/breadcrumbs-CD1zib3s.cjs +43 -0
- package/dist/breadcrumbs-CpuVqWhF.js +76 -0
- package/dist/button-BIpd1xJh.js +95 -0
- package/dist/button-D-TOBaJB.cjs +27 -0
- package/dist/calendar-BzEtOJla.js +2031 -0
- package/dist/calendar-E5jJLt8D.cjs +90 -0
- package/dist/card-BYJu1MYm.js +339 -0
- package/dist/card-CUFhMVim.cjs +87 -0
- package/dist/checkbox-BARDb9iV.cjs +31 -0
- package/dist/checkbox-Cspxcvt_.js +111 -0
- package/dist/class-map-C8HuhNzZ.js +27 -0
- package/dist/class-map-CJ-msbHs.cjs +1 -0
- package/dist/classutils-DEL164Ur.js +7 -0
- package/dist/classutils-z8YsPlOf.cjs +1 -0
- package/dist/combobox-BcdLZRDU.js +984 -0
- package/dist/combobox-CGbFTWq_.cjs +135 -0
- package/dist/consent-DeB_5sWH.js +197 -0
- package/dist/consent-hwu7pp3S.cjs +11 -0
- package/dist/datepicker-DpmlsnH_.cjs +273 -0
- package/dist/datepicker-OVd8pmnZ.js +1125 -0
- package/dist/dialog-polyfill.esm-1hPr0gl9.js +280 -0
- package/dist/dialog-polyfill.esm-D3Oinvk0.cjs +1 -0
- package/dist/directive-3THFsVew.js +28 -0
- package/dist/directive-CJ2giQBZ.cjs +1 -0
- package/dist/directive-helpers-D1QSxY17.cjs +1 -0
- package/dist/directive-helpers-Dkv2gKgs.js +25 -0
- package/dist/element-DjtxO-1r.cjs +2 -0
- package/dist/element-cZ85T_aa.js +693 -0
- package/dist/element-with-slot-4J2o3SeU.js +166 -0
- package/dist/element-with-slot-CWoTGA1B.cjs +1 -0
- package/dist/header-DWgPgGfS.cjs +304 -0
- package/dist/header-a6ztVNp3.js +782 -0
- package/dist/heading-BgSWIRii.cjs +1 -0
- package/dist/heading-DiQLPxdf.js +73 -0
- package/dist/helptext-CCBKKLus.js +65 -0
- package/dist/helptext-D-3QfZv5.cjs +24 -0
- package/dist/icon-Co72KtgF.js +86 -0
- package/dist/icon-Dr8sfT2X.cjs +1 -0
- package/dist/if-defined-Cjj8qN-Z.js +5 -0
- package/dist/if-defined-XKOD_t_V.cjs +1 -0
- package/dist/index.d.ts +1 -2
- package/dist/input-element-B1yxcfz4.cjs +1 -0
- package/dist/input-element-Bw1s6NlF.js +643 -0
- package/dist/input-wrapper-BRuVELpK.cjs +54 -0
- package/dist/input-wrapper-CDyHTR1V.js +164 -0
- package/dist/input-wrapper-Dwd-_sKm.cjs +1 -0
- package/dist/input-wrapper-YfTmpSSY.js +117 -0
- package/dist/link-CKAFMz9j.js +89 -0
- package/dist/link-CyTCpI0k.cjs +7 -0
- package/dist/linkcard-B0KOGaGj.js +55 -0
- package/dist/linkcard-BE4-FewK.cjs +13 -0
- package/dist/listbox-DCA2JoPV.cjs +106 -0
- package/dist/listbox-DuBgTFvH.js +397 -0
- package/dist/loader-6kFZUErT.js +66 -0
- package/dist/loader-CX2rsC01.cjs +16 -0
- package/dist/messagebox-Cwlg5sOr.js +110 -0
- package/dist/messagebox-Din9X53b.cjs +13 -0
- package/dist/modal-C_wtsh9m.js +209 -0
- package/dist/modal-DS_wUOIv.cjs +36 -0
- package/dist/pkt-accordion.cjs +1 -1
- package/dist/pkt-accordion.js +2 -7
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +2 -5
- package/dist/pkt-backlink.cjs +1 -1
- package/dist/pkt-backlink.js +2 -5
- package/dist/pkt-breadcrumbs.cjs +1 -43
- package/dist/pkt-breadcrumbs.js +2 -81
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +2 -5
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +2 -5
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +2 -5
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +2 -5
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +2 -5
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +2 -5
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +5 -9
- package/dist/pkt-header.cjs +1 -304
- package/dist/pkt-header.js +2 -861
- package/dist/pkt-heading.cjs +1 -1
- package/dist/pkt-heading.js +2 -5
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +2 -5
- package/dist/pkt-icon.cjs +1 -1
- package/dist/pkt-icon.js +2 -5
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +30 -66
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +2 -5
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +2 -5
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +2 -5
- package/dist/pkt-listbox.cjs +1 -1
- package/dist/pkt-listbox.js +2 -5
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +2 -5
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +2 -5
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +2 -5
- package/dist/pkt-options-controller-CRrI6WMk.js +43 -0
- package/dist/pkt-options-controller-CXUGx134.cjs +1 -0
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +2 -5
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +2 -5
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +2 -5
- package/dist/pkt-tabs.cjs +1 -1
- package/dist/pkt-tabs.js +2 -7
- package/dist/pkt-tag.cjs +1 -1
- package/dist/pkt-tag.js +2 -5
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +2 -5
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +2 -5
- package/dist/pkt-timepicker.cjs +1 -191
- package/dist/pkt-timepicker.js +2 -560
- package/dist/progressbar-CdXtmOBb.cjs +17 -0
- package/dist/progressbar-Dy9AiYQz.js +113 -0
- package/dist/radiobutton-GOnpUbCW.cjs +31 -0
- package/dist/radiobutton-V_KPbup_.js +84 -0
- package/dist/ref-BaJ0mBT_.cjs +1 -0
- package/dist/ref-RS8Uv6uC.js +30 -0
- package/dist/repeat-Cepr3469.js +57 -0
- package/dist/repeat-CqcDYBxr.cjs +1 -0
- package/dist/select-BSAFd8Wa.js +164 -0
- package/dist/select-C2i8sOk5.cjs +49 -0
- package/dist/tabs-D8nL9rWx.cjs +37 -0
- package/dist/tabs-Y7utmJi9.js +318 -0
- package/dist/tag-DLthw5b4.cjs +27 -0
- package/dist/tag-VwykmuQR.js +179 -0
- package/dist/textarea-D7aGOyDf.cjs +46 -0
- package/dist/textarea-DYOBhJrN.js +115 -0
- package/dist/textinput-BUgntXnM.js +124 -0
- package/dist/textinput-DFh8_9cx.cjs +70 -0
- package/dist/timepicker-BIfE7KKJ.cjs +191 -0
- package/dist/timepicker-DaSwn1FA.js +503 -0
- package/dist/utils-CUqCKGvp.js +7 -0
- package/dist/utils-CjAbIttF.cjs +1 -0
- package/package.json +6 -6
- package/src/components/alert/alert.test.ts +1 -1
- package/src/components/alert/alert.ts +6 -6
- package/src/components/datepicker/datepicker-utils.test.ts +16 -23
- package/dist/accordionitem-_9AiCIvd.cjs +0 -34
- package/dist/accordionitem-dCfSrxh5.js +0 -140
- package/dist/alert-BtOk8yRH.cjs +0 -33
- package/dist/alert-DlY2_grU.js +0 -117
- package/dist/async-directive-CMzWMlZ5.js +0 -65
- package/dist/async-directive-DoMuclel.cjs +0 -5
- package/dist/backlink-Ce5Vldop.js +0 -49
- package/dist/backlink-y3dwjKPC.cjs +0 -13
- package/dist/booleanish-BKVonob4.cjs +0 -1
- package/dist/booleanish-C9R0tdXH.js +0 -11
- package/dist/button-B_TXwNzt.cjs +0 -27
- package/dist/button-BiY-wlKF.js +0 -139
- package/dist/calendar-B2pji2zn.cjs +0 -90
- package/dist/calendar-DhjQDC4C.js +0 -2140
- package/dist/card-BwMNB5Bb.cjs +0 -87
- package/dist/card-CGlmcMSR.js +0 -233
- package/dist/checkbox-BsJZYA26.js +0 -147
- package/dist/checkbox-CTY8f_qn.cjs +0 -31
- package/dist/class-map-CEnykyO_.js +0 -34
- package/dist/class-map-CsENJXf1.cjs +0 -5
- package/dist/classutils-BwNK82ZQ.cjs +0 -1
- package/dist/classutils-RQs1k6D9.js +0 -7
- package/dist/combobox-DSB5WOxg.js +0 -815
- package/dist/combobox-DbICIgKG.cjs +0 -135
- package/dist/consent-DkOQpbsg.cjs +0 -11
- package/dist/consent-SNWV_mMU.js +0 -175
- package/dist/datepicker-BEWl9iz3.cjs +0 -273
- package/dist/datepicker-euHyzXnb.js +0 -1170
- package/dist/dialog-polyfill.esm-CPKZe7AL.cjs +0 -1
- package/dist/dialog-polyfill.esm-CbjBMXAG.js +0 -395
- package/dist/directive-C7oCP5Bh.cjs +0 -5
- package/dist/directive-helpers-BP2WOx60.cjs +0 -5
- package/dist/directive-helpers-rm-28gIj.js +0 -38
- package/dist/directive-oAbCiebi.js +0 -27
- package/dist/element-CPpT3rFQ.js +0 -638
- package/dist/element-gR_VtSiD.cjs +0 -27
- package/dist/element-with-slot-Dqk6-TRR.js +0 -240
- package/dist/element-with-slot-ZX-up7jO.cjs +0 -1
- package/dist/heading-D2tVS6lS.js +0 -103
- package/dist/heading-DrzbgDb6.cjs +0 -1
- package/dist/helptext-BKtU4mas.js +0 -82
- package/dist/helptext-DcRC7wW2.cjs +0 -24
- package/dist/icon-CxQcIa5F.js +0 -105
- package/dist/icon-q81vqPK_.cjs +0 -9
- package/dist/if-defined-B0krMLad.js +0 -10
- package/dist/if-defined-BOW3ODSj.cjs +0 -5
- package/dist/input-element-8nLwuQS4.js +0 -837
- package/dist/input-element-DdVhUvva.cjs +0 -1
- package/dist/input-wrapper-Bs4CRNst.js +0 -181
- package/dist/input-wrapper-Bv9aqqVq.cjs +0 -54
- package/dist/input-wrapper-CDgenrYA.js +0 -6
- package/dist/input-wrapper-EoSAbU-U.cjs +0 -1
- package/dist/link-C0rl-86s.cjs +0 -7
- package/dist/link-Cdqgl60z.js +0 -55
- package/dist/linkcard-Dimu7Rlx.cjs +0 -13
- package/dist/linkcard-Lbq_UhjZ.js +0 -56
- package/dist/listbox-Bia4_tvN.js +0 -440
- package/dist/listbox-La2GZQei.cjs +0 -106
- package/dist/loader-D1ugDXGV.cjs +0 -16
- package/dist/loader-DyN6RGC5.js +0 -95
- package/dist/messagebox-BGMVm2t9.js +0 -71
- package/dist/messagebox-M0yIgCz9.cjs +0 -13
- package/dist/modal-CMO1RtIi.cjs +0 -36
- package/dist/modal-DjPQDE-Z.js +0 -156
- package/dist/pkt-options-controller-5LXbEzuk.cjs +0 -1
- package/dist/pkt-options-controller-B5YalfCb.js +0 -39
- package/dist/progressbar-BqlMzkM_.cjs +0 -21
- package/dist/progressbar-sbHDFC12.js +0 -162
- package/dist/radiobutton-5ZqVVtTT.cjs +0 -31
- package/dist/radiobutton-D8Ai8ETa.js +0 -113
- package/dist/ref-Bg_Swj5w.js +0 -42
- package/dist/ref-CL-Xk9Xm.cjs +0 -5
- package/dist/repeat-BD8TKgJb.js +0 -61
- package/dist/repeat-Cfq8CDlf.cjs +0 -5
- package/dist/select-De-n8on9.js +0 -230
- package/dist/select-dTWibR6_.cjs +0 -49
- package/dist/state-C_1EOo3D.js +0 -12
- package/dist/state-Dg-53wQ8.cjs +0 -5
- package/dist/tabitem-B9-jeV97.js +0 -334
- package/dist/tabitem-BnhzqfW3.cjs +0 -65
- package/dist/tag-CbwO8yvD.cjs +0 -27
- package/dist/tag-D4FI5t3y.js +0 -117
- package/dist/textarea-BmLaKzsc.cjs +0 -50
- package/dist/textarea-CMiSJaYL.js +0 -133
- package/dist/textinput-em9y4yrL.cjs +0 -70
- package/dist/textinput-r8udK0IX.js +0 -152
- package/dist/utils-DznhwRXm.js +0 -8
- package/dist/utils-byXsEz1u.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./element-DjtxO-1r.cjs`);var t=class extends e.n{constructor(...e){super(...e),this.size=void 0,this.level=2,this.weight=void 0,this.visuallyHidden=!1,this.align=void 0}connectedCallback(){super.connectedCallback(),this.setAttribute(`role`,`heading`),this.setAttribute(`aria-level`,String(this.level)),this.updateHostClasses()}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),e===`level`&&n&&this.setLevel(Number(n)),e===`visuallyHidden`&&(this.visuallyHidden=n!==null&&n!==`false`),(e===`size`||e===`visuallyHidden`||e===`align`||e===`weight`)&&this.updateHostClasses()}updated(e){super.updated(e),e.has(`level`)&&(this.setLevel(this.level),this.hasAttribute(`size`)||(this.size=this.defaultSizeForLevel),this.hasAttribute(`weight`)||(this.weight=this.defaultWeightForLevel)),!this.hasAttribute(`size`)&&(e.has(`level`)||this.size===void 0)&&(this.size=this.defaultSizeForLevel),(e.has(`size`)||e.has(`visuallyHidden`)||e.has(`align`)||e.has(`weight`))&&this.updateHostClasses()}setLevel(e){e>=1&&e<=6?(this.level=e,this.setAttribute(`aria-level`,String(e))):console.warn(`Invalid heading level: ${e}. Must be between 1 and 6.`)}get defaultSizeForLevel(){switch(this.level){case 1:return`xlarge`;case 2:return`large`;case 3:return`medium`;case 4:return`small`;case 5:return`xsmall`;case 6:return`xsmall`;default:return`medium`}}get defaultWeightForLevel(){switch(this.level){case 1:return`regular`;case 2:return`regular`;case 3:return`medium`;case 4:return`medium`;case 5:return`medium`;case 6:return`medium`;default:return`medium`}}updateHostClasses(){this.classList.remove(`pkt-heading`,`pkt-heading--xsmall`,`pkt-heading--small`,`pkt-heading--medium`,`pkt-heading--large`,`pkt-heading--xlarge`,`pkt-sr-only`,`pkt-heading--start`,`pkt-heading--center`,`pkt-heading--end`,`pkt-heading--light`,`pkt-heading--regular`,`pkt-heading--medium`,`pkt-heading--bold`),this.classList.add(`pkt-heading`),this.size&&this.classList.add(`pkt-heading--${this.size}`),this.weight&&this.classList.add(`pkt-heading--fw-${this.weight}`),this.visuallyHidden&&this.classList.add(`pkt-sr-only`),this.align&&this.classList.add(`pkt-heading--${this.align}`)}render(){return e.d`<slot></slot>`}};e.r([e.s({type:String,reflect:!0})],t.prototype,`size`,void 0),e.r([e.s({type:Number,reflect:!0})],t.prototype,`level`,void 0),e.r([e.s({type:String,reflect:!0})],t.prototype,`weight`,void 0),e.r([e.s({type:Boolean,reflect:!0})],t.prototype,`visuallyHidden`,void 0),e.r([e.s({type:String,reflect:!0})],t.prototype,`align`,void 0);try{e.c(`pkt-heading`)(t)}catch{console.warn(`Forsøker å definere <pkt-heading>, men den er allerede definert`)}var n=t;Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return n}});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { c as e, d as t, n, r, s as i } from "./element-cZ85T_aa.js";
|
|
2
|
+
//#region src/components/heading/heading.ts
|
|
3
|
+
var a = class extends n {
|
|
4
|
+
constructor(...e) {
|
|
5
|
+
super(...e), this.size = void 0, this.level = 2, this.weight = void 0, this.visuallyHidden = !1, this.align = void 0;
|
|
6
|
+
}
|
|
7
|
+
connectedCallback() {
|
|
8
|
+
super.connectedCallback(), this.setAttribute("role", "heading"), this.setAttribute("aria-level", String(this.level)), this.updateHostClasses();
|
|
9
|
+
}
|
|
10
|
+
attributeChangedCallback(e, t, n) {
|
|
11
|
+
super.attributeChangedCallback(e, t, n), e === "level" && n && this.setLevel(Number(n)), e === "visuallyHidden" && (this.visuallyHidden = n !== null && n !== "false"), (e === "size" || e === "visuallyHidden" || e === "align" || e === "weight") && this.updateHostClasses();
|
|
12
|
+
}
|
|
13
|
+
updated(e) {
|
|
14
|
+
super.updated(e), e.has("level") && (this.setLevel(this.level), this.hasAttribute("size") || (this.size = this.defaultSizeForLevel), this.hasAttribute("weight") || (this.weight = this.defaultWeightForLevel)), !this.hasAttribute("size") && (e.has("level") || this.size === void 0) && (this.size = this.defaultSizeForLevel), (e.has("size") || e.has("visuallyHidden") || e.has("align") || e.has("weight")) && this.updateHostClasses();
|
|
15
|
+
}
|
|
16
|
+
setLevel(e) {
|
|
17
|
+
e >= 1 && e <= 6 ? (this.level = e, this.setAttribute("aria-level", String(e))) : console.warn(`Invalid heading level: ${e}. Must be between 1 and 6.`);
|
|
18
|
+
}
|
|
19
|
+
get defaultSizeForLevel() {
|
|
20
|
+
switch (this.level) {
|
|
21
|
+
case 1: return "xlarge";
|
|
22
|
+
case 2: return "large";
|
|
23
|
+
case 3: return "medium";
|
|
24
|
+
case 4: return "small";
|
|
25
|
+
case 5: return "xsmall";
|
|
26
|
+
case 6: return "xsmall";
|
|
27
|
+
default: return "medium";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
get defaultWeightForLevel() {
|
|
31
|
+
switch (this.level) {
|
|
32
|
+
case 1: return "regular";
|
|
33
|
+
case 2: return "regular";
|
|
34
|
+
case 3: return "medium";
|
|
35
|
+
case 4: return "medium";
|
|
36
|
+
case 5: return "medium";
|
|
37
|
+
case 6: return "medium";
|
|
38
|
+
default: return "medium";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
updateHostClasses() {
|
|
42
|
+
this.classList.remove("pkt-heading", "pkt-heading--xsmall", "pkt-heading--small", "pkt-heading--medium", "pkt-heading--large", "pkt-heading--xlarge", "pkt-sr-only", "pkt-heading--start", "pkt-heading--center", "pkt-heading--end", "pkt-heading--light", "pkt-heading--regular", "pkt-heading--medium", "pkt-heading--bold"), this.classList.add("pkt-heading"), this.size && this.classList.add(`pkt-heading--${this.size}`), this.weight && this.classList.add(`pkt-heading--fw-${this.weight}`), this.visuallyHidden && this.classList.add("pkt-sr-only"), this.align && this.classList.add(`pkt-heading--${this.align}`);
|
|
43
|
+
}
|
|
44
|
+
render() {
|
|
45
|
+
return t`<slot></slot>`;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
r([i({
|
|
49
|
+
type: String,
|
|
50
|
+
reflect: !0
|
|
51
|
+
})], a.prototype, "size", void 0), r([i({
|
|
52
|
+
type: Number,
|
|
53
|
+
reflect: !0
|
|
54
|
+
})], a.prototype, "level", void 0), r([i({
|
|
55
|
+
type: String,
|
|
56
|
+
reflect: !0
|
|
57
|
+
})], a.prototype, "weight", void 0), r([i({
|
|
58
|
+
type: Boolean,
|
|
59
|
+
reflect: !0
|
|
60
|
+
})], a.prototype, "visuallyHidden", void 0), r([i({
|
|
61
|
+
type: String,
|
|
62
|
+
reflect: !0
|
|
63
|
+
})], a.prototype, "align", void 0);
|
|
64
|
+
try {
|
|
65
|
+
e("pkt-heading")(a);
|
|
66
|
+
} catch {
|
|
67
|
+
console.warn("Forsøker å definere <pkt-heading>, men den er allerede definert");
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/components/heading/index.ts
|
|
71
|
+
var o = a;
|
|
72
|
+
//#endregion
|
|
73
|
+
export { a as n, o as t };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { c as e, d as t, l as n, o as r, r as i, s as a } from "./element-cZ85T_aa.js";
|
|
2
|
+
import { t as o } from "./class-map-C8HuhNzZ.js";
|
|
3
|
+
import { n as s, t as c } from "./element-with-slot-4J2o3SeU.js";
|
|
4
|
+
import { r as l } from "./icon-Co72KtgF.js";
|
|
5
|
+
import { n as u } from "./utils-CUqCKGvp.js";
|
|
6
|
+
import { t as d } from "./input-wrapper-CDyHTR1V.js";
|
|
7
|
+
//#region src/components/helptext/helptext.ts
|
|
8
|
+
var f = class extends c {
|
|
9
|
+
constructor(...e) {
|
|
10
|
+
super(...e), this.forId = u(), this.helptext = "", this.helptextDropdown = "", this.helptextDropdownButton = d.props.helptextDropdownButton.default, this.isHelpTextOpen = !1;
|
|
11
|
+
}
|
|
12
|
+
render() {
|
|
13
|
+
return t`${t`<div class="${o({
|
|
14
|
+
"pkt-inputwrapper__helptext-container": !0,
|
|
15
|
+
"pkt-inputwrapper__has-helptext": this.helptext || this.helptextDropdown || this.hasSlotContent()
|
|
16
|
+
})}">
|
|
17
|
+
<div class="pkt-inputwrapper__helptext" id="${this.forId}-helptext">
|
|
18
|
+
<div class="pkt-contents" name="helptext">${s(this)}</div>
|
|
19
|
+
${this.helptext && l(this.helptext)}
|
|
20
|
+
</div>
|
|
21
|
+
${this.helptextDropdown ? t`<div class="pkt-inputwrapper__helptext-expandable">
|
|
22
|
+
<button
|
|
23
|
+
class="pkt-link pkt-link--icon-right pkt-btn pkt-btn--small pkt-btn--tertiary pkt-btn--icon-right"
|
|
24
|
+
type="button"
|
|
25
|
+
@click=${() => {
|
|
26
|
+
let e = !this.isHelpTextOpen;
|
|
27
|
+
this.isHelpTextOpen = e, this.dispatchEvent(new CustomEvent("toggleHelpText", {
|
|
28
|
+
bubbles: !0,
|
|
29
|
+
detail: { isOpen: e }
|
|
30
|
+
}));
|
|
31
|
+
}}
|
|
32
|
+
>
|
|
33
|
+
<pkt-icon
|
|
34
|
+
class="pkt-btn__icon"
|
|
35
|
+
name="${this.isHelpTextOpen ? "chevron-thin-up" : "chevron-thin-down"}"
|
|
36
|
+
></pkt-icon>
|
|
37
|
+
<span class="pkt-btn__text">${l(this.helptextDropdownButton)}</span>
|
|
38
|
+
</button>
|
|
39
|
+
<div
|
|
40
|
+
class="${o({
|
|
41
|
+
"pkt-inputwrapper__helptext": !0,
|
|
42
|
+
"pkt-inputwrapper__helptext-expandable-open": this.isHelpTextOpen,
|
|
43
|
+
"pkt-inputwrapper__helptext-expandable-closed": !this.isHelpTextOpen
|
|
44
|
+
})}"
|
|
45
|
+
>
|
|
46
|
+
${l(this.helptextDropdown)}
|
|
47
|
+
</div>
|
|
48
|
+
</div>` : n}
|
|
49
|
+
</div>`}`;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
i([a({
|
|
53
|
+
type: String,
|
|
54
|
+
reflect: !0
|
|
55
|
+
})], f.prototype, "forId", void 0), i([a({ type: String })], f.prototype, "helptext", void 0), i([a({ type: String })], f.prototype, "helptextDropdown", void 0), i([a({ type: String })], f.prototype, "helptextDropdownButton", void 0), i([r()], f.prototype, "isHelpTextOpen", void 0);
|
|
56
|
+
try {
|
|
57
|
+
e("pkt-helptext")(f);
|
|
58
|
+
} catch {
|
|
59
|
+
console.warn("Forsøker å definere <pkt-helptext>, men den er allerede definert");
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/components/helptext/index.ts
|
|
63
|
+
var p = f;
|
|
64
|
+
//#endregion
|
|
65
|
+
export { f as n, p as t };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const e=require(`./element-DjtxO-1r.cjs`),t=require(`./class-map-CJ-msbHs.cjs`),n=require(`./element-with-slot-CWoTGA1B.cjs`),r=require(`./icon-Dr8sfT2X.cjs`),i=require(`./utils-CjAbIttF.cjs`),a=require(`./input-wrapper-Dwd-_sKm.cjs`);var o=class extends n.t{constructor(...e){super(...e),this.forId=i.n(),this.helptext=``,this.helptextDropdown=``,this.helptextDropdownButton=a.t.props.helptextDropdownButton.default,this.isHelpTextOpen=!1}render(){let i=()=>{let e=!this.isHelpTextOpen;this.isHelpTextOpen=e,this.dispatchEvent(new CustomEvent(`toggleHelpText`,{bubbles:!0,detail:{isOpen:e}}))},a=t.t({"pkt-inputwrapper__helptext-container":!0,"pkt-inputwrapper__has-helptext":this.helptext||this.helptextDropdown||this.hasSlotContent()});return e.d`${e.d`<div class="${a}">
|
|
2
|
+
<div class="pkt-inputwrapper__helptext" id="${this.forId}-helptext">
|
|
3
|
+
<div class="pkt-contents" name="helptext">${n.n(this)}</div>
|
|
4
|
+
${this.helptext&&r.r(this.helptext)}
|
|
5
|
+
</div>
|
|
6
|
+
${this.helptextDropdown?e.d`<div class="pkt-inputwrapper__helptext-expandable">
|
|
7
|
+
<button
|
|
8
|
+
class="pkt-link pkt-link--icon-right pkt-btn pkt-btn--small pkt-btn--tertiary pkt-btn--icon-right"
|
|
9
|
+
type="button"
|
|
10
|
+
@click=${i}
|
|
11
|
+
>
|
|
12
|
+
<pkt-icon
|
|
13
|
+
class="pkt-btn__icon"
|
|
14
|
+
name="${this.isHelpTextOpen?`chevron-thin-up`:`chevron-thin-down`}"
|
|
15
|
+
></pkt-icon>
|
|
16
|
+
<span class="pkt-btn__text">${r.r(this.helptextDropdownButton)}</span>
|
|
17
|
+
</button>
|
|
18
|
+
<div
|
|
19
|
+
class="${t.t({"pkt-inputwrapper__helptext":!0,"pkt-inputwrapper__helptext-expandable-open":this.isHelpTextOpen,"pkt-inputwrapper__helptext-expandable-closed":!this.isHelpTextOpen})}"
|
|
20
|
+
>
|
|
21
|
+
${r.r(this.helptextDropdown)}
|
|
22
|
+
</div>
|
|
23
|
+
</div>`:e.l}
|
|
24
|
+
</div>`}`}};e.r([e.s({type:String,reflect:!0})],o.prototype,`forId`,void 0),e.r([e.s({type:String})],o.prototype,`helptext`,void 0),e.r([e.s({type:String})],o.prototype,`helptextDropdown`,void 0),e.r([e.s({type:String})],o.prototype,`helptextDropdownButton`,void 0),e.r([e.o()],o.prototype,`isHelpTextOpen`,void 0);try{e.c(`pkt-helptext`)(o)}catch{console.warn(`Forsøker å definere <pkt-helptext>, 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}});
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { c as e, d as t, l as n, r, s as i, t as a, u as o } from "./element-cZ85T_aa.js";
|
|
2
|
+
import { n as s, r as c, t as l } from "./directive-3THFsVew.js";
|
|
3
|
+
//#region ../../node_modules/lit-html/directives/unsafe-html.js
|
|
4
|
+
var u = class extends s {
|
|
5
|
+
constructor(e) {
|
|
6
|
+
if (super(e), this.it = n, e.type !== c.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
|
|
7
|
+
}
|
|
8
|
+
render(e) {
|
|
9
|
+
if (e === n || e == null) return this._t = void 0, this.it = e;
|
|
10
|
+
if (e === o) return e;
|
|
11
|
+
if (typeof e != "string") throw Error(this.constructor.directiveName + "() called with a non-string value");
|
|
12
|
+
if (e === this.it) return this._t;
|
|
13
|
+
this.it = e;
|
|
14
|
+
let t = [e];
|
|
15
|
+
return t.raw = t, this._t = {
|
|
16
|
+
_$litType$: this.constructor.resultType,
|
|
17
|
+
strings: t,
|
|
18
|
+
values: []
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
u.directiveName = "unsafeHTML", u.resultType = 1;
|
|
23
|
+
var d = l(u), f = class extends u {};
|
|
24
|
+
f.directiveName = "unsafeSVG", f.resultType = 2;
|
|
25
|
+
var p = l(f), m = "https://punkt-cdn.oslo.kommune.no/latest/icons/";
|
|
26
|
+
typeof window < "u" && (window.pktFetch = window.pktFetch === void 0 ? fetch : window.pktFetch, window.pktIconPath = window.pktIconPath || m);
|
|
27
|
+
var h = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 32 32\"></svg>", g = {}, _ = 2, v = 1500, y = typeof Storage < "u" && typeof sessionStorage < "u", b = (e) => window.pktFetch(e).then((t) => {
|
|
28
|
+
if (!t.ok) throw Error("Missing icon: " + e);
|
|
29
|
+
return t.text();
|
|
30
|
+
}), x = async (e, t = _) => {
|
|
31
|
+
try {
|
|
32
|
+
return await b(e);
|
|
33
|
+
} catch {
|
|
34
|
+
return t > 0 ? (await new Promise((e) => setTimeout(e, v)), x(e, t - 1)) : (console.error("Failed to fetch icon: " + e), h);
|
|
35
|
+
}
|
|
36
|
+
}, S = async (e, t) => {
|
|
37
|
+
let n = t + e + ".svg";
|
|
38
|
+
return y && sessionStorage.getItem(n) ? sessionStorage.getItem(n) : n in g ? g[n] : typeof window < "u" && typeof window.pktFetch == "function" ? (g[n] = x(n).then((e) => (e !== h && y && sessionStorage.setItem(n, e), delete g[n], e)), g[n]) : h;
|
|
39
|
+
}, C = class extends a {
|
|
40
|
+
constructor(...e) {
|
|
41
|
+
super(...e), this.path = typeof window < "u" ? window.pktIconPath : m, this.name = "", this.icon = p(h), this._updatedProps = [];
|
|
42
|
+
}
|
|
43
|
+
connectedCallback() {
|
|
44
|
+
super.connectedCallback(), this.classList.add("pkt-icon");
|
|
45
|
+
}
|
|
46
|
+
async attributeChangedCallback(e, t, n) {
|
|
47
|
+
super.attributeChangedCallback(e, t, n), (e === "name" || e === "path") && this.getIcon(this.name);
|
|
48
|
+
}
|
|
49
|
+
async updated(e) {
|
|
50
|
+
super.updated(e), (e.has("name") || e.has("path")) && this.getIcon(this.name);
|
|
51
|
+
}
|
|
52
|
+
async getIcon(e = "") {
|
|
53
|
+
if (this._updatedProps.length > 0) {
|
|
54
|
+
this.path ||= typeof window < "u" ? window.pktIconPath : m;
|
|
55
|
+
try {
|
|
56
|
+
this.icon = p(await S(this.name || "", this.path));
|
|
57
|
+
} catch {
|
|
58
|
+
this.icon = p(h);
|
|
59
|
+
}
|
|
60
|
+
this._updatedProps = [];
|
|
61
|
+
} else this._updatedProps.includes(e) || this._updatedProps.push(e);
|
|
62
|
+
}
|
|
63
|
+
render() {
|
|
64
|
+
return t`${this.name && this.icon}`;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
r([i({
|
|
68
|
+
type: String,
|
|
69
|
+
reflect: !1
|
|
70
|
+
})], C.prototype, "path", void 0), r([i({
|
|
71
|
+
type: String,
|
|
72
|
+
reflect: !0
|
|
73
|
+
})], C.prototype, "name", void 0), r([i({ type: SVGElement })], C.prototype, "icon", void 0), r([i({
|
|
74
|
+
type: Array,
|
|
75
|
+
noAccessor: !0
|
|
76
|
+
})], C.prototype, "_updatedProps", void 0);
|
|
77
|
+
try {
|
|
78
|
+
e("pkt-icon")(C);
|
|
79
|
+
} catch {
|
|
80
|
+
console.warn("Forsøker å definere <pkt-icon>, men den er allerede definert");
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/components/icon/index.ts
|
|
84
|
+
var w = C;
|
|
85
|
+
//#endregion
|
|
86
|
+
export { C as n, d as r, w as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./element-DjtxO-1r.cjs`),t=require(`./directive-CJ2giQBZ.cjs`);var n=class extends t.n{constructor(n){if(super(n),this.it=e.l,n.type!==t.r.CHILD)throw Error(this.constructor.directiveName+`() can only be used in child bindings`)}render(t){if(t===e.l||t==null)return this._t=void 0,this.it=t;if(t===e.u)return t;if(typeof t!=`string`)throw Error(this.constructor.directiveName+`() called with a non-string value`);if(t===this.it)return this._t;this.it=t;let n=[t];return n.raw=n,this._t={_$litType$:this.constructor.resultType,strings:n,values:[]}}};n.directiveName=`unsafeHTML`,n.resultType=1;var r=t.t(n),i=class extends n{};i.directiveName=`unsafeSVG`,i.resultType=2;var a=t.t(i),o=`https://punkt-cdn.oslo.kommune.no/latest/icons/`;typeof window<`u`&&(window.pktFetch=window.pktFetch===void 0?fetch:window.pktFetch,window.pktIconPath=window.pktIconPath||o);var s=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>`,c={},l=2,u=1500,d=typeof Storage<`u`&&typeof sessionStorage<`u`,f=e=>window.pktFetch(e).then(t=>{if(!t.ok)throw Error(`Missing icon: `+e);return t.text()}),p=async(e,t=l)=>{try{return await f(e)}catch{return t>0?(await new Promise(e=>setTimeout(e,u)),p(e,t-1)):(console.error(`Failed to fetch icon: `+e),s)}},m=async(e,t)=>{let n=t+e+`.svg`;return d&&sessionStorage.getItem(n)?sessionStorage.getItem(n):n in c?c[n]:typeof window<`u`&&typeof window.pktFetch==`function`?(c[n]=p(n).then(e=>(e!==s&&d&&sessionStorage.setItem(n,e),delete c[n],e)),c[n]):s},h=class extends e.t{constructor(...e){super(...e),this.path=typeof window<`u`?window.pktIconPath:o,this.name=``,this.icon=a(s),this._updatedProps=[]}connectedCallback(){super.connectedCallback(),this.classList.add(`pkt-icon`)}async attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),(e===`name`||e===`path`)&&this.getIcon(this.name)}async updated(e){super.updated(e),(e.has(`name`)||e.has(`path`))&&this.getIcon(this.name)}async getIcon(e=``){if(this._updatedProps.length>0){this.path||=typeof window<`u`?window.pktIconPath:o;try{this.icon=a(await m(this.name||``,this.path))}catch{this.icon=a(s)}this._updatedProps=[]}else this._updatedProps.includes(e)||this._updatedProps.push(e)}render(){return e.d`${this.name&&this.icon}`}};e.r([e.s({type:String,reflect:!1})],h.prototype,`path`,void 0),e.r([e.s({type:String,reflect:!0})],h.prototype,`name`,void 0),e.r([e.s({type:SVGElement})],h.prototype,`icon`,void 0),e.r([e.s({type:Array,noAccessor:!0})],h.prototype,`_updatedProps`,void 0);try{e.c(`pkt-icon`)(h)}catch{console.warn(`Forsøker å definere <pkt-icon>, men den er allerede definert`)}var g=h;Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return g}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./element-DjtxO-1r.cjs`);var t=t=>t??e.l;Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return t}});
|
package/dist/index.d.ts
CHANGED
|
@@ -194,7 +194,6 @@ declare interface IPktAlert {
|
|
|
194
194
|
title?: string;
|
|
195
195
|
date?: string | null;
|
|
196
196
|
ariaLive?: TAriaLive | null;
|
|
197
|
-
'aria-live'?: TAriaLive | null;
|
|
198
197
|
compact?: boolean;
|
|
199
198
|
role?: string;
|
|
200
199
|
}
|
|
@@ -551,7 +550,7 @@ export declare class PktAlert extends PktElementWithSlot implements IPktAlert {
|
|
|
551
550
|
title: string;
|
|
552
551
|
skin: TAlertSkin;
|
|
553
552
|
ariaLive: TAriaLive;
|
|
554
|
-
|
|
553
|
+
ariaLiveAttr: TAriaLive | null;
|
|
555
554
|
closeAlert: boolean;
|
|
556
555
|
date: string | null;
|
|
557
556
|
role: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./element-DjtxO-1r.cjs`),t=require(`./element-with-slot-CWoTGA1B.cjs`),n=require(`./utils-CjAbIttF.cjs`),r=require(`./booleanish-jJLlnr6-.cjs`),i=require(`./input-wrapper-Dwd-_sKm.cjs`);(function(e){"use strict";let t=new WeakMap,n=new WeakMap,r=new WeakMap,i=new WeakMap,a=new WeakMap,o=new WeakMap,s=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,d=new WeakMap,f=new WeakMap,p=new WeakMap,m=new WeakMap,h=new WeakMap,g={ariaAtomic:`aria-atomic`,ariaAutoComplete:`aria-autocomplete`,ariaBusy:`aria-busy`,ariaChecked:`aria-checked`,ariaColCount:`aria-colcount`,ariaColIndex:`aria-colindex`,ariaColIndexText:`aria-colindextext`,ariaColSpan:`aria-colspan`,ariaCurrent:`aria-current`,ariaDescription:`aria-description`,ariaDisabled:`aria-disabled`,ariaExpanded:`aria-expanded`,ariaHasPopup:`aria-haspopup`,ariaHidden:`aria-hidden`,ariaInvalid:`aria-invalid`,ariaKeyShortcuts:`aria-keyshortcuts`,ariaLabel:`aria-label`,ariaLevel:`aria-level`,ariaLive:`aria-live`,ariaModal:`aria-modal`,ariaMultiLine:`aria-multiline`,ariaMultiSelectable:`aria-multiselectable`,ariaOrientation:`aria-orientation`,ariaPlaceholder:`aria-placeholder`,ariaPosInSet:`aria-posinset`,ariaPressed:`aria-pressed`,ariaReadOnly:`aria-readonly`,ariaRelevant:`aria-relevant`,ariaRequired:`aria-required`,ariaRoleDescription:`aria-roledescription`,ariaRowCount:`aria-rowcount`,ariaRowIndex:`aria-rowindex`,ariaRowIndexText:`aria-rowindextext`,ariaRowSpan:`aria-rowspan`,ariaSelected:`aria-selected`,ariaSetSize:`aria-setsize`,ariaSort:`aria-sort`,ariaValueMax:`aria-valuemax`,ariaValueMin:`aria-valuemin`,ariaValueNow:`aria-valuenow`,ariaValueText:`aria-valuetext`,role:`role`},_=(e,t)=>{for(let n in g){t[n]=null;let r=null,i=g[n];Object.defineProperty(t,n,{get(){return r},set(n){r=n,e.isConnected?T(e,i,n):u.set(e,t)}})}};function v(e){let t=i.get(e),{form:n}=t;P(e,n,t),A(e,t.labels)}let y=(e,t=!1)=>{let n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return i.has(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),r=n.nextNode(),a=!t||e.disabled;for(;r;)r.formDisabledCallback&&a&&E(r,e.disabled),r=n.nextNode()},b={attributes:!0,attributeFilter:[`disabled`,`name`]},x=z()?new MutationObserver(e=>{for(let t of e){let e=t.target;if(t.attributeName===`disabled`&&(e.constructor.formAssociated?E(e,e.hasAttribute(`disabled`)):e.localName===`fieldset`&&y(e)),t.attributeName===`name`&&e.constructor.formAssociated){let t=i.get(e),n=l.get(e);t.setFormValue(n)}}}):{};function S(e){e.forEach(e=>{let{addedNodes:t,removedNodes:n}=e,a=Array.from(t),o=Array.from(n);a.forEach(e=>{var t;if(i.has(e)&&e.constructor.formAssociated&&v(e),u.has(e)){let t=u.get(e);Object.keys(g).filter(e=>t[e]!==null).forEach(n=>{T(e,g[n],t[n])}),u.delete(e)}if(h.has(e)){let t=h.get(e);T(e,`internals-valid`,t.validity.valid.toString()),T(e,`internals-invalid`,(!t.validity.valid).toString()),T(e,`aria-invalid`,(!t.validity.valid).toString()),h.delete(e)}if(e.localName===`form`){let t=c.get(e),n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return i.has(e)&&e.constructor.formAssociated&&!(t&&t.has(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),r=n.nextNode();for(;r;)v(r),r=n.nextNode()}e.localName===`fieldset`&&((t=x.observe)==null||t.call(x,e,b),y(e,!0))}),o.forEach(e=>{let t=i.get(e);t&&r.get(t)&&D(t),s.has(e)&&s.get(e).disconnect()})})}function C(e){e.forEach(e=>{let{removedNodes:t}=e;t.forEach(t=>{let n=p.get(e.target);i.has(t)&&R(t),n.disconnect()})})}let ee=e=>{var t;let n=new MutationObserver(C);(window==null?void 0:window.ShadyDOM)?.inUse&&e.mode&&e.host&&(e=e.host),(t=n.observe)==null||t.call(n,e,{childList:!0}),p.set(e,n)};z()&&new MutationObserver(S);let w={childList:!0,subtree:!0},T=(e,t,n)=>{e.getAttribute(t)!==n&&e.setAttribute(t,n)},E=(e,t)=>{e.toggleAttribute(`internals-disabled`,t),t?T(e,`aria-disabled`,`true`):e.removeAttribute(`aria-disabled`),e.formDisabledCallback&&e.formDisabledCallback.apply(e,[t])},D=e=>{r.get(e).forEach(e=>{e.remove()}),r.set(e,[])},O=(e,t)=>{let n=document.createElement(`input`);return n.type=`hidden`,n.name=e.getAttribute(`name`),e.after(n),r.get(t).push(n),n},k=(e,t)=>{var n;r.set(t,[]),(n=x.observe)==null||n.call(x,e,b)},A=(e,t)=>{if(t.length){Array.from(t).forEach(t=>t.addEventListener(`click`,e.click.bind(e)));let n=t[0].id;t[0].id||(n=`${t[0].htmlFor}_Label`,t[0].id=n),T(e,`aria-labelledby`,n)}},j=e=>{let t=Array.from(e.elements).filter(e=>!e.tagName.includes(`-`)&&e.validity).map(e=>e.validity.valid),n=c.get(e)||[],r=Array.from(n).filter(e=>e.isConnected).map(e=>i.get(e).validity.valid),a=[...t,...r].includes(!1);e.toggleAttribute(`internals-invalid`,a),e.toggleAttribute(`internals-valid`,!a)},M=e=>{j(F(e.target))},N=e=>{j(F(e.target))},te=e=>{let t=[`button[type=submit]`,`input[type=submit]`,`button:not([type])`].map(e=>`${e}:not([disabled])`).map(t=>`${t}:not([form])${e.id?`,${t}[form='${e.id}']`:``}`).join(`,`);e.addEventListener(`click`,n=>{if(n.target.closest(t)){let t=c.get(e);if(e.noValidate)return;t.size&&Array.from(t).reverse().map(e=>i.get(e).reportValidity()).includes(!1)&&n.preventDefault()}})},ne=e=>{let t=c.get(e.target);t&&t.size&&t.forEach(e=>{e.constructor.formAssociated&&e.formResetCallback&&e.formResetCallback.apply(e)})},P=(e,t,n)=>{if(t){let r=c.get(t);if(r)r.add(e);else{let n=new Set;n.add(e),c.set(t,n),te(t),t.addEventListener(`reset`,ne),t.addEventListener(`input`,M),t.addEventListener(`change`,N)}o.set(t,{ref:e,internals:n}),e.constructor.formAssociated&&e.formAssociatedCallback&&setTimeout(()=>{e.formAssociatedCallback.apply(e,[t])},0),j(t)}},F=e=>{let t=e.parentNode;return t&&t.tagName!==`FORM`&&(t=F(t)),t},I=(e,t,n=DOMException)=>{if(!e.constructor.formAssociated)throw new n(t)},L=(e,t,n)=>{let r=c.get(e);return r&&r.size&&r.forEach(e=>{i.get(e)[n]()||(t=!1)}),t},R=e=>{if(e.constructor.formAssociated){let t=i.get(e),{labels:n,form:r}=t;A(e,n),P(e,r,t)}};function z(){return typeof MutationObserver<`u`}class B{constructor(){this.badInput=!1,this.customError=!1,this.patternMismatch=!1,this.rangeOverflow=!1,this.rangeUnderflow=!1,this.stepMismatch=!1,this.tooLong=!1,this.tooShort=!1,this.typeMismatch=!1,this.valid=!0,this.valueMissing=!1,Object.seal(this)}}let re=e=>(e.badInput=!1,e.customError=!1,e.patternMismatch=!1,e.rangeOverflow=!1,e.rangeUnderflow=!1,e.stepMismatch=!1,e.tooLong=!1,e.tooShort=!1,e.typeMismatch=!1,e.valid=!0,e.valueMissing=!1,e),ie=(e,t,n)=>(e.valid=V(t),Object.keys(t).forEach(n=>e[n]=t[n]),n&&j(n),e),V=e=>{let t=!0;for(let n in e)n!==`valid`&&e[n]!==!1&&(t=!1);return t},H=new WeakMap;function U(e,t){e.toggleAttribute(t,!0),e.part&&e.part.add(t)}class W extends Set{static get isPolyfilled(){return!0}constructor(e){if(super(),!e||!e.tagName||e.tagName.indexOf(`-`)===-1)throw TypeError(`Illegal constructor`);H.set(this,e)}add(e){if(!/^--/.test(e)||typeof e!=`string`)throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${e} must start with '--'.`);let t=super.add(e),n=H.get(this),r=`state${e}`;return n.isConnected?U(n,r):setTimeout(()=>{U(n,r)}),t}clear(){for(let[e]of this.entries())this.delete(e);super.clear()}delete(e){let t=super.delete(e),n=H.get(this);return n.isConnected?(n.toggleAttribute(`state${e}`,!1),n.part&&n.part.remove(`state${e}`)):setTimeout(()=>{n.toggleAttribute(`state${e}`,!1),n.part&&n.part.remove(`state${e}`)}),t}}function G(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}function K(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}var q;class J{constructor(e){q.set(this,void 0),K(this,q,e,`f`);for(let t=0;t<e.length;t++){let n=e[t];this[t]=n,n.hasAttribute(`name`)&&(this[n.getAttribute(`name`)]=n)}Object.freeze(this)}get length(){return G(this,q,`f`).length}[(q=new WeakMap,Symbol.iterator)](){return G(this,q,`f`)[Symbol.iterator]()}item(e){return this[e]==null?null:this[e]}namedItem(e){return this[e]==null?null:this[e]}}function ae(){let e=HTMLFormElement.prototype.checkValidity;HTMLFormElement.prototype.checkValidity=n;let t=HTMLFormElement.prototype.reportValidity;HTMLFormElement.prototype.reportValidity=r;function n(...t){let n=e.apply(this,t);return L(this,n,`checkValidity`)}function r(...e){let n=t.apply(this,e);return L(this,n,`reportValidity`)}let{get:i}=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,`elements`);Object.defineProperty(HTMLFormElement.prototype,`elements`,{get(...e){let t=i.call(this,...e),n=Array.from(c.get(this)||[]);return n.length===0?t:new J(Array.from(t).concat(n).sort((e,t)=>e.compareDocumentPosition?e.compareDocumentPosition(t)&2?1:-1:0))}})}class Y{static get isPolyfilled(){return!0}constructor(e){if(!e||!e.tagName||e.tagName.indexOf(`-`)===-1)throw TypeError(`Illegal constructor`);let r=e.getRootNode(),a=new B;this.states=new W(e),t.set(this,e),n.set(this,a),i.set(e,this),_(e,this),k(e,this),Object.seal(this),r instanceof DocumentFragment&&ee(r)}checkValidity(){let e=t.get(this);if(I(e,`Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element.`),!this.willValidate)return!0;let r=n.get(this);if(!r.valid){let t=new Event(`invalid`,{bubbles:!1,cancelable:!0,composed:!1});e.dispatchEvent(t)}return r.valid}get form(){let e=t.get(this);I(e,`Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.`);let n;return e.constructor.formAssociated===!0&&(n=F(e)),n}get labels(){let e=t.get(this);I(e,`Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.`);let n=e.getAttribute(`id`),r=e.getRootNode();return r&&n?r.querySelectorAll(`[for="${n}"]`):[]}reportValidity(){let e=t.get(this);if(I(e,`Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.`),!this.willValidate)return!0;let n=this.checkValidity(),r=f.get(this);if(r&&!e.constructor.formAssociated)throw new DOMException(`Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.`);return!n&&r&&(e.focus(),r.focus()),n}setFormValue(e){let n=t.get(this);if(I(n,`Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element.`),D(this),e!=null&&!(e instanceof FormData)){if(n.getAttribute(`name`)){let t=O(n,this);t.value=e}}else e!=null&&e instanceof FormData&&Array.from(e).reverse().forEach(([e,t])=>{if(typeof t==`string`){let r=O(n,this);r.name=e,r.value=t}});l.set(n,e)}setValidity(e,r,i){let o=t.get(this);if(I(o,`Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element.`),!e)throw TypeError(`Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.`);f.set(this,i);let s=n.get(this),c={};for(let t in e)c[t]=e[t];Object.keys(c).length===0&&re(s);let l=Object.assign(Object.assign({},s),c);delete l.valid;let{valid:u}=ie(s,l,this.form);if(!u&&!r)throw new DOMException(`Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true.`);a.set(this,u?``:r),o.isConnected?(o.toggleAttribute(`internals-invalid`,!u),o.toggleAttribute(`internals-valid`,u),T(o,`aria-invalid`,`${!u}`)):h.set(o,this)}get shadowRoot(){let e=t.get(this);return d.get(e)||null}get validationMessage(){return I(t.get(this),`Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element.`),a.get(this)}get validity(){return I(t.get(this),`Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element.`),n.get(this)}get willValidate(){let e=t.get(this);return I(e,`Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element.`),!(e.disabled||e.hasAttribute(`disabled`)||e.hasAttribute(`readonly`))}}function oe(){if(typeof window>`u`||!window.ElementInternals||!HTMLElement.prototype.attachInternals)return!1;class e extends HTMLElement{constructor(){super(),this.internals=this.attachInternals()}}let t=`element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g,``)}`;customElements.define(t,e);let n=new e;return[`shadowRoot`,`form`,`willValidate`,`validity`,`validationMessage`,`labels`,`setFormValue`,`setValidity`,`checkValidity`,`reportValidity`].every(e=>e in n.internals)}let X=!1,Z=!1;function Q(e){Z||(Z=!0,window.CustomStateSet=W,e&&(HTMLElement.prototype.attachInternals=function(...t){let n=e.call(this,t);return n.states=new W(this),n}))}function $(e=!0){if(!X){if(X=!0,typeof window<`u`&&(window.ElementInternals=Y),typeof CustomElementRegistry<`u`){let e=CustomElementRegistry.prototype.define;CustomElementRegistry.prototype.define=function(t,n,r){if(n.formAssociated){let e=n.prototype.connectedCallback;n.prototype.connectedCallback=function(){m.has(this)||(m.set(this,!0),this.hasAttribute(`disabled`)&&E(this,!0)),e?.apply(this),R(this)}}e.call(this,t,n,r)}}if(typeof HTMLElement<`u`&&(HTMLElement.prototype.attachInternals=function(){if(!this.tagName)return{};if(this.tagName.indexOf(`-`)===-1)throw Error(`Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.`);if(i.has(this))throw new DOMException(`DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.`);return new Y(this)}),typeof Element<`u`){function e(...e){let n=t.apply(this,e);if(d.set(this,n),z()){let e=new MutationObserver(S);window.ShadyDOM?e.observe(this,w):e.observe(n,w),s.set(this,e)}return n}let t=Element.prototype.attachShadow;Element.prototype.attachShadow=e}z()&&typeof document<`u`&&new MutationObserver(S).observe(document.documentElement,w),typeof HTMLFormElement<`u`&&ae(),(e||typeof window<`u`&&!window.CustomStateSet)&&Q()}}return customElements.polyfillWrapFlushCallback||(oe()?typeof window<`u`&&!window.CustomStateSet&&Q(HTMLElement.prototype.attachInternals):$(!1)),e.forceCustomStateSetPolyfill=Q,e.forceElementInternalsPolyfill=$,Object.defineProperty(e,`__esModule`,{value:!0}),e})({});var a=`on`,o=`--checked`,s=`,`,c=class extends t.t{static get formAssociated(){return!0}constructor(){super(),this.defaultValue=null,this.disabled=!1,this.readonly=!1,this.required=!1,this.max=null,this.maxlength=null,this.min=null,this.minlength=null,this.step=null,this.ariaDescribedBy=null,this.ariaLabelledby=null,this.name=``,this.pattern=null,this.placeholder=null,this.id=n.n(),this.counter=!1,this.hasError=!1,this.inline=!1,this.hasFieldset=!1,this.optionalTag=!1,this.requiredTag=!1,this.skipForwardTestid=!1,this.useWrapper=!0,this.fullwidth=!1,this.counterMaxLength=0,this.errorMessage=``,this.helptext=``,this.helptextDropdown=``,this.helptextDropdownButton=i.t.props.helptextDropdownButton.default,this.label=null,this.optionalText=e.i.forms.labels.optional,this.requiredText=e.i.forms.labels.required,this.tagText=null,this.dataTestid=``,this.touched=!1,this.internals=this.attachInternals()}manageValidity(t){if(!t){console.warn(`manageValidity called without valid input element`);return}this.required&&!this.value?this.internals.setValidity({valueMissing:!0},e.i.forms.messages.required,t):t.validity?.typeMismatch||t.validity?.badInput?this.internals.setValidity({typeMismatch:!0},e.i.forms.messages.invalid,t):t.validity?.patternMismatch?this.internals.setValidity({patternMismatch:!0},e.i.forms.messages.invalidPattern,t):t.validity?.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},e.i.forms.messages.tooShort,t):t.validity?.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},e.i.forms.messages.tooLong,t):t.validity?.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},this.min?e.i.forms.messages.rangeUnderflowMin.replace(`{min}`,this.min?.toString()):e.i.forms.messages.rangeUnderflow,t):t.validity?.stepMismatch?this.internals.setValidity({stepMismatch:!0},e.i.forms.messages.invalid,t):t.validity?.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},this.max?e.i.forms.messages.rangeOverflowMax.replace(`{max}`,this.max?.toString()):e.i.forms.messages.rangeOverflow,t):t.validity?.customError?this.internals.setValidity({customError:!0},t.validationMessage,t):this.internals.setValidity({})}setFormValue(e){if(this.internals)if(Array.isArray(e)){let t=new FormData;e.forEach(e=>{t.append(this.name,e)}),this.internals.setFormValue(t)}else this.internals.setFormValue(e)}coordinateRadioGroup(){if(!this.form||!this.name||this.type!==`radio`)return;let e=`pkt-radiobutton[name="${this.name}"], input[type=radio][name="${this.name}"]`;this.form.querySelectorAll(e).forEach(e=>{if(e!==this&&e.getAttribute(`name`)===this.name&&e.getAttribute(`value`)!==this.value){let t=e;t.checked&&(t.checked=!1,t.internals&&(t.internals.setFormValue(null),t.internals.states?.delete(o)))}})}valueChecked(e){if(!this.touched)return;let t=this.internals.form||this.closest(`form`),n=t?new FormData(t):null;if(this.type===`radio`&&this.coordinateRadioGroup(),typeof e==`string`?(this.checked=e===`true`,this.internals.ariaChecked=String(e===`true`)):typeof e==`boolean`&&(this.checked=e,this.internals.ariaChecked=String(e)),this.checked){let e=(typeof this.value==`string`?this.value:``)||a;this.internals.setFormValue(e),n&&n.append(this.name,e),this.internals.states.add(o)}else this.internals.setFormValue(null),n&&n.delete(this.name),this.internals.states.delete(o);this.dispatchChangeEvents(this.checked),this.internals.reportValidity()}valueChanged(e,t){(t!==this.value||t!==this._value)&&(typeof e==`string`?((this.multiple||this.range)&&e.includes(s)&&(e=e.split(s)),this.value=e,this._value=Array.isArray(e)?e:[e]):Array.isArray(e)?(this.value=this.multiple||this.range?e:e[0],this._value=e):(this.value=``,this._value=[]),(!this.value||this.value.length===0)&&t&&t.length!==0?this.clearInputValue():this.value&&this.value.toString()!==t?.toString()&&this.onChange(this.value))}dispatchChangeEvents(e){this.dispatchEvent(new Event(`change`,{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`value-change`,{detail:e,bubbles:!0,composed:!0}))}clearInputValue(){let e=this.multiple||this.range?[]:``;this.value=e,this.setFormValue(e),this.dispatchChangeEvents(e)}onFocus(){this.dispatchEvent(new FocusEvent(`focus`,{bubbles:!0,composed:!0}))}onBlur(){this.dispatchEvent(new FocusEvent(`blur`,{bubbles:!0,composed:!0}))}onInput(){this.dispatchEvent(new InputEvent(`input`,{bubbles:!0,composed:!0}))}normalizeValue(e){return(this.range||this.multiple)&&typeof e==`string`&&e.includes(s)?e.split(s):!this.multiple&&!this.range&&Array.isArray(e)?e[0]||``:e}validate(){this.inputRef?.value&&this.manageValidity(this.inputRef.value),this.inputRefTo?.value&&this.manageValidity(this.inputRefTo.value)}onChange(e){if(!this.touched){this.touched=!0,e&&this.setFormValue(e),this.validate();return}if(typeof e!=`string`&&!Array.isArray(e))return;let t=this.normalizeValue(e);this.setFormValue(t),this.validate(),this.dispatchChangeEvents(t)}formResetCallback(){if(this.touched=!1,this._options&&this._options.length&&this._options.forEach(e=>{`selected`in e&&(e.selected=!1)}),this.checked!==void 0)this.checked=!1,this.internals.ariaChecked=`false`,this.internals.setFormValue(``),this.inputRef?.value&&`checked`in this.inputRef.value&&(this.inputRef.value.checked=!1),this.valueChecked(this.checked);else{this.internals.setFormValue(``);let e=this.defaultValue||(this.multiple||this.range?[]:``);this.value=e,this._value=Array.isArray(e)?e:[e],this.valueChanged(this.value,null)}this.internals.ariaInvalid=`false`}updated(e){super.updated(e),e.has(`dataTestid`)&&this.dataTestid&&this.inputRef.value&&(this.skipForwardTestid?this.hasAttribute(`data-testid`)||this.setAttribute(`data-testid`,this.dataTestid):(this.inputRef.value.dataset.testid=this.dataTestid,this.removeAttribute(`data-testid`)))}firstUpdated(e){if(super.firstUpdated(e),this.form||=this.internals.form||this.closest(`form`),this.value&&this.defaultValue===null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null),this.defaultChecked&&(this.internals.ariaChecked=`true`,this.checked=!0),this.required&&(this.internals.ariaRequired=`true`),this.disabled&&(this.internals.ariaDisabled=`true`),this.id&&!this.name&&(this.name=this.id),this.checked!==void 0){let e=this.checked===``||this.checked===`true`||this.checked===!0;this.internals.ariaChecked=String(e);let t=e?(typeof this.value==`string`?this.value:``)||a:null;this.internals.setFormValue(t)}else this.setFormValue(this.value);this.inputRef&&this.inputRef.value&&(this.inputRef.value.setAttribute(`form`,``),this.manageValidity(this.inputRef.value)),this.inputRefTo&&this.inputRefTo.value&&(this.inputRefTo.value.setAttribute(`form`,``),this.manageValidity(this.inputRefTo.value))}};e.r([e.s({type:Boolean,reflect:!0})],c.prototype,`checked`,void 0),e.r([e.s({type:Boolean})],c.prototype,`defaultChecked`,void 0),e.r([e.s({type:Boolean})],c.prototype,`multiple`,void 0),e.r([e.s({type:Boolean})],c.prototype,`range`,void 0),e.r([e.s({type:String,reflect:!0})],c.prototype,`type`,void 0),e.r([e.s()],c.prototype,`defaultValue`,void 0),e.r([e.s({type:Boolean,reflect:!0})],c.prototype,`disabled`,void 0),e.r([e.s({type:Boolean,reflect:!0})],c.prototype,`readonly`,void 0),e.r([e.s({type:Boolean,reflect:!0})],c.prototype,`required`,void 0),e.r([e.s({reflect:!0,converter:{fromAttribute:e=>e,toAttribute:e=>e?.toString()??null}})],c.prototype,`max`,void 0),e.r([e.s({type:Number,reflect:!0})],c.prototype,`maxlength`,void 0),e.r([e.s({reflect:!0,converter:{fromAttribute:e=>e,toAttribute:e=>e?.toString()??null}})],c.prototype,`min`,void 0),e.r([e.s({type:Number,reflect:!0})],c.prototype,`minlength`,void 0),e.r([e.s({type:Number,reflect:!0})],c.prototype,`step`,void 0),e.r([e.s({type:String})],c.prototype,`ariaDescribedBy`,void 0),e.r([e.s({type:String})],c.prototype,`ariaLabelledby`,void 0),e.r([e.s({type:String,reflect:!0})],c.prototype,`name`,void 0),e.r([e.s({type:String,reflect:!0})],c.prototype,`pattern`,void 0),e.r([e.s({type:String,reflect:!0})],c.prototype,`placeholder`,void 0),e.r([e.s({type:String,reflect:!0})],c.prototype,`id`,void 0),e.r([e.s({type:Boolean})],c.prototype,`counter`,void 0),e.r([e.s({type:Boolean})],c.prototype,`hasError`,void 0),e.r([e.s({type:Boolean})],c.prototype,`inline`,void 0),e.r([e.s({type:Boolean})],c.prototype,`hasFieldset`,void 0),e.r([e.s({type:Boolean})],c.prototype,`optionalTag`,void 0),e.r([e.s({type:Boolean})],c.prototype,`requiredTag`,void 0),e.r([e.s({type:Boolean})],c.prototype,`skipForwardTestid`,void 0),e.r([e.s({type:Boolean,reflect:!0,converter:r.t})],c.prototype,`useWrapper`,void 0),e.r([e.s({type:Boolean,reflect:!0})],c.prototype,`fullwidth`,void 0),e.r([e.s({type:Number})],c.prototype,`counterMaxLength`,void 0),e.r([e.s({type:String})],c.prototype,`errorMessage`,void 0),e.r([e.s({type:String})],c.prototype,`helptext`,void 0),e.r([e.s({type:String})],c.prototype,`helptextDropdown`,void 0),e.r([e.s({type:String,reflect:!1})],c.prototype,`helptextDropdownButton`,void 0),e.r([e.s({type:String})],c.prototype,`label`,void 0),e.r([e.s({type:String,reflect:!1})],c.prototype,`optionalText`,void 0),e.r([e.s({type:String,reflect:!1})],c.prototype,`requiredText`,void 0),e.r([e.s({type:String,reflect:!1})],c.prototype,`tagText`,void 0),e.r([e.s({type:String,attribute:`data-testid`})],c.prototype,`dataTestid`,void 0),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return c}});
|