@oslokommune/punkt-elements 19.8.0 → 19.10.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 +35 -0
- package/dist/accordion-CMCCpxtz.cjs +47 -0
- package/dist/{accordion-BJh6X1Ek.js → accordion-Cp2o6wTY.js} +10 -9
- package/dist/{alert-WME3geaX.js → alert-CAPiwi4F.js} +5 -5
- package/dist/{alert-CKqtC9AM.cjs → alert-QfloIr-o.cjs} +1 -1
- package/dist/{async-directive-BGoo_npW.cjs → async-directive-DpyKp6qv.cjs} +1 -1
- package/dist/{async-directive-DsdqP_X7.js → async-directive-yh8hG41Q.js} +2 -2
- package/dist/{backlink-BRqhwUr2.cjs → backlink-CsFeerTH.cjs} +1 -1
- package/dist/{backlink-BslFewn-.js → backlink-ogvv493Y.js} +3 -3
- package/dist/base-elements/input-element.d.ts +17 -0
- package/dist/base-elements/option-group-element.d.ts +61 -0
- package/dist/base-elements/polyfill-form-value.test.d.ts +0 -0
- package/dist/{breadcrumbs-Cr3GugPv.js → breadcrumbs-53QVnTFP.js} +2 -2
- package/dist/{breadcrumbs-DG4i5UCh.cjs → breadcrumbs-D03id_ha.cjs} +1 -1
- package/dist/{button-B78im4wB.js → button-CeRr7oIn.js} +5 -5
- package/dist/{button-BNVTj7nB.cjs → button-Dh97H-58.cjs} +1 -1
- package/dist/{calendar-TcxvS-1_.cjs → calendar-C5QwPrbk.cjs} +1 -1
- package/dist/{calendar-BLaRXUBl.js → calendar-D9w8M99G.js} +3 -3
- package/dist/{card-CaLEuumN.cjs → card--NuWdTbG.cjs} +1 -1
- package/dist/{card-CYKhPUNI.js → card-_PlgXmgZ.js} +6 -6
- package/dist/{checkbox-Tq8ESzwH.js → checkbox-G8k3vg85.js} +39 -35
- package/dist/checkbox-QIcdn09A.cjs +40 -0
- package/dist/checkbox-group-DoueGGi5.js +50 -0
- package/dist/checkbox-group-nLazAkcg.cjs +1 -0
- package/dist/checkbox-group.d.ts +1 -0
- package/dist/{class-map-C4hdfSfY.js → class-map-Bf-QzUpN.js} +1 -1
- package/dist/{class-map-Drv0_anQ.cjs → class-map-Bh6toDeV.cjs} +1 -1
- package/dist/{combobox-89Ohd1Oe.cjs → combobox-ClXhKwR9.cjs} +1 -1
- package/dist/{combobox-Cpb67TV0.js → combobox-Cz_rq7Mm.js} +13 -13
- package/dist/components/checkbox/checkbox.d.ts +1 -0
- package/dist/components/checkbox-group/checkbox-group-context.d.ts +5 -0
- package/dist/components/checkbox-group/checkbox-group.d.ts +15 -0
- package/dist/components/checkbox-group/checkbox-group.test.d.ts +0 -0
- package/dist/components/checkbox-group/index.d.ts +3 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/radio-group/index.d.ts +3 -0
- package/dist/components/radio-group/radio-group-context.d.ts +7 -0
- package/dist/components/radio-group/radio-group.d.ts +14 -0
- package/dist/components/radio-group/radio-group.test.d.ts +0 -0
- package/dist/components/radiobutton/index.d.ts +1 -0
- package/dist/components/radiobutton/radiobutton.d.ts +8 -2
- package/dist/{consent-CleJMbVH.js → consent-CZMxUavj.js} +2 -2
- package/dist/{consent-Dl-R0iC3.cjs → consent-DimzcQxt.cjs} +1 -1
- package/dist/consume-Bp12si68.js +61 -0
- package/dist/consume-kEjgTrAp.cjs +1 -0
- package/dist/{datepicker-DBEKa1aJ.js → datepicker-C7ABsx7H.js} +12 -12
- package/dist/{datepicker-B9NCJX4o.cjs → datepicker-usIF9WY7.cjs} +2 -2
- package/dist/{directive-helpers-BRrz3Bcj.cjs → directive-helpers-Bv70GjQh.cjs} +1 -1
- package/dist/{directive-helpers-D96YEsht.js → directive-helpers-CwxFepWh.js} +1 -1
- package/dist/directives/slot-content.d.ts +4 -3
- package/dist/docs/components/checkbox-group.d.ts +13 -0
- package/dist/docs/components/radio-group.d.ts +13 -0
- package/dist/{element-BOmr9YLv.cjs → element-C6WTyJFE.cjs} +1 -1
- package/dist/{element-mwwC2Rra.js → element-DBugHPKM.js} +1 -0
- package/dist/{element-with-slot-DQv0cbbD.js → element-with-slot-DDLS-aLw.js} +6 -3
- package/dist/element-with-slot-DhiAuSjM.cjs +1 -0
- package/dist/{fileupload-2YAbjYuU.cjs → fileupload-2uTFjd81.cjs} +1 -1
- package/dist/{fileupload-DqWCXMPz.js → fileupload-BR9H6fET.js} +8 -8
- package/dist/{footer-DdLls3F-.js → footer-B3DMvo8-.js} +4 -4
- package/dist/{footer-vy9NqT65.cjs → footer-CyxRYvT-.cjs} +1 -1
- package/dist/{header-Dp0Lq7wS.js → header-BKeSkfB7.js} +11 -11
- package/dist/{header-9Y6Q6Cfq.cjs → header-Drj3lTrv.cjs} +1 -1
- package/dist/{header-menu-BfkCp8jw.cjs → header-menu-B_5hCNUl.cjs} +1 -1
- package/dist/{header-menu-ANj5nL2M.js → header-menu-buYE90FU.js} +4 -4
- package/dist/{heading-zoz-QZJ9.cjs → heading-DUYOvlxs.cjs} +1 -1
- package/dist/{heading-CUrZvkrM.js → heading-WBB5MO9i.js} +2 -2
- package/dist/{helptext-BCkwSz1m.cjs → helptext-C7cyihnu.cjs} +1 -1
- package/dist/{helptext-DCT_9dw1.js → helptext-DadLkcoO.js} +4 -4
- package/dist/{icon-JigbxxF7.js → icon-Bao96Zb8.js} +1 -1
- package/dist/{icon-Dnv6LtPC.cjs → icon-jPhyZD1z.cjs} +1 -1
- package/dist/if-defined-CiML3MTM.cjs +1 -0
- package/dist/{if-defined-Bebu3LXY.js → if-defined-O59_I-e-.js} +1 -1
- package/dist/{input-element-lLzfwdim.js → input-element-BBygBEei.js} +54 -17
- package/dist/input-element-C4SelHLD.cjs +1 -0
- package/dist/{input-wrapper-CTMf4kCK.cjs → input-wrapper-BT6B3Kco.cjs} +6 -2
- package/dist/{input-wrapper-C9K-_7g-.js → input-wrapper-DrSCuw6U.js} +12 -8
- package/dist/{link-LO_5_La8.cjs → link-CEP7w1et.cjs} +1 -1
- package/dist/{link-CmZwAw5u.js → link-CVnIn74-.js} +4 -4
- package/dist/{linkcard-UKsxADrP.cjs → linkcard-D8vitdrQ.cjs} +1 -1
- package/dist/{linkcard-CQluSyJJ.js → linkcard-IWiVvRKy.js} +4 -4
- package/dist/{listbox-Ct9jIV_5.js → listbox-BDesthOp.js} +4 -4
- package/dist/{listbox-g-vHHLkD.cjs → listbox-CvduK_YU.cjs} +1 -1
- package/dist/{loader-C_PH05aw.cjs → loader-B0hFoBtF.cjs} +1 -1
- package/dist/{loader-DzctJ9jW.js → loader-CAsUPHjl.js} +4 -4
- package/dist/{messagebox-D17GYxb9.js → messagebox-6_iNN5F3.js} +4 -4
- package/dist/{messagebox-X01V2l_N.cjs → messagebox-C19L2Duq.cjs} +1 -1
- package/dist/{modal-BymjMIJi.cjs → modal-CoEPzt4p.cjs} +1 -1
- package/dist/{modal-CELmA0-8.js → modal-D7MolBXb.js} +5 -5
- package/dist/option-group-element-BIuotbRu.js +135 -0
- package/dist/option-group-element-BYS7s-is.cjs +23 -0
- 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-group.cjs +1 -0
- package/dist/pkt-checkbox-group.js +2 -0
- 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-footer.cjs +1 -1
- package/dist/pkt-footer.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 +37 -35
- 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-CpEZcomb.cjs → pkt-options-controller-B3vVKnAG.cjs} +1 -1
- package/dist/{pkt-options-controller-D7l18Iw0.js → pkt-options-controller-ClFrUWZK.js} +1 -1
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +1 -1
- package/dist/pkt-radio-group.cjs +1 -0
- package/dist/pkt-radio-group.js +2 -0
- 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-CIXNSwTy.cjs → progressbar-CnX4fFfR.cjs} +1 -1
- package/dist/{progressbar-DH5lIBpx.js → progressbar-DZHiq7B0.js} +5 -5
- package/dist/provide-Cz18sYug.cjs +1 -0
- package/dist/provide-_MnlMGnw.js +111 -0
- package/dist/radio-group-BzV_JhgJ.js +52 -0
- package/dist/radio-group-C-8C0-Py.cjs +1 -0
- package/dist/radio-group.d.ts +1 -0
- package/dist/radiobutton-_089zFBB.cjs +38 -0
- package/dist/radiobutton-bkTAD5PV.js +108 -0
- package/dist/{ref-Emu5PNxk.cjs → ref-CB7e9nMY.cjs} +1 -1
- package/dist/{ref-CCSGk4MP.js → ref-y_5qv9vU.js} +2 -2
- package/dist/{repeat-CdxGS-_3.js → repeat-CV9S4zya.js} +2 -2
- package/dist/{repeat-Dh9YKoeV.cjs → repeat-CnnigVcj.cjs} +1 -1
- package/dist/{searchinput-Co8tcq-l.js → searchinput-Bkcr3Fby.js} +4 -4
- package/dist/{searchinput-CbClDE-d.cjs → searchinput-Mdc9Ihld.cjs} +1 -1
- package/dist/{select-Cz80KV3g.js → select-B6CN2Ymq.js} +7 -7
- package/dist/{select-CZk57p1_.cjs → select-BowvpCNa.cjs} +1 -1
- package/dist/shared-strings/nb.d.ts +1 -0
- package/dist/shared-types/index.d.ts +6 -2
- package/dist/shared-types/option-group.d.ts +50 -0
- package/dist/shared-types/radiobutton.d.ts +46 -0
- package/dist/{tabs-B8blHQrL.js → tabs-DZvtVA0y.js} +9 -8
- package/dist/tabs-Dm8xcPRs.cjs +40 -0
- package/dist/{tag-Bns7Xj1O.js → tag-C33BPIOm.js} +5 -5
- package/dist/{tag-B5dUg7AD.cjs → tag-DyVZrqOQ.cjs} +1 -1
- package/dist/tests/component-registry.d.ts +4 -0
- package/dist/tests/option-contexts.d.ts +7 -0
- package/dist/{textarea-Dwjx-Crl.cjs → textarea-DoH3Il8v.cjs} +1 -1
- package/dist/{textarea-Dfvx1I60.js → textarea-hW0kV5gj.js} +9 -9
- package/dist/{textinput-7zTPlXVj.js → textinput-B6G4dVuL.js} +8 -8
- package/dist/{textinput-BeraGRzb.cjs → textinput-CQknclmV.cjs} +1 -1
- package/dist/{timepicker-C0dSH4Ij.js → timepicker-Cd2QI6ua.js} +8 -8
- package/dist/{timepicker-DarB9eA6.cjs → timepicker-DB3gor6g.cjs} +1 -1
- package/package.json +2 -2
- package/src/components/checkbox/checkbox.test.ts +99 -0
- package/src/components/checkbox/checkbox.ts +14 -5
- package/src/components/checkbox-group/checkbox-group-context.ts +8 -0
- package/src/components/checkbox-group/checkbox-group.test.ts +406 -0
- package/src/components/checkbox-group/checkbox-group.ts +69 -0
- package/src/components/checkbox-group/index.ts +4 -0
- package/src/components/combobox/combobox.ts +1 -1
- package/src/components/datepicker/datepicker.ts +1 -1
- package/src/components/index.ts +3 -0
- package/src/components/input-wrapper/input-wrapper.ts +5 -1
- package/src/components/input-wrapper/wrapper-parity.test.ts +27 -2
- package/src/components/radio-group/index.ts +4 -0
- package/src/components/radio-group/radio-group-context.ts +8 -0
- package/src/components/radio-group/radio-group.test.ts +530 -0
- package/src/components/radio-group/radio-group.ts +65 -0
- package/src/components/radiobutton/index.ts +1 -0
- package/src/components/radiobutton/radiobutton.test.ts +95 -0
- package/src/components/radiobutton/radiobutton.ts +26 -11
- package/dist/accordion-5lSFQToJ.cjs +0 -47
- package/dist/checkbox-D69leWDh.cjs +0 -40
- package/dist/consume-BDnMAp2g.js +0 -167
- package/dist/consume-Le4HztPo.cjs +0 -1
- package/dist/element-with-slot-D7sTqOr3.cjs +0 -1
- package/dist/if-defined-2mkIDgOm.cjs +0 -1
- package/dist/input-element-CSfDGslx.cjs +0 -1
- package/dist/radiobutton-BPr22VmL.cjs +0 -38
- package/dist/radiobutton-l_3oGDbb.js +0 -97
- package/dist/tabs-CjX-GWvM.cjs +0 -40
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { _ as e, d as t, h as n, l as r, n as i, u as a } from "./element-mwwC2Rra.js";
|
|
2
|
-
import { t as o } from "./class-map-C4hdfSfY.js";
|
|
3
|
-
import { n as s, t as c } from "./ref-CCSGk4MP.js";
|
|
4
|
-
import { t as l } from "./input-element-lLzfwdim.js";
|
|
5
|
-
//#region src/components/radiobutton/radiobutton.ts
|
|
6
|
-
var u = class extends l {
|
|
7
|
-
constructor(...e) {
|
|
8
|
-
super(...e), this.inputRef = c(), this.value = "", this.checkHelptext = null, this.defaultChecked = !1, this.hasTile = !1, this.checked = null, this.type = "radio", this.inputSize = void 0, this.tagText = null, this.optionalTag = !1, this.requiredTag = !1, this._checked = !1;
|
|
9
|
-
}
|
|
10
|
-
connectedCallback() {
|
|
11
|
-
super.connectedCallback();
|
|
12
|
-
}
|
|
13
|
-
attributeChangedCallback(e, t, n) {
|
|
14
|
-
e === "checked" && (this._checked = this.checked === "" || this.checked === "true" || this.checked === !0), super.attributeChangedCallback(e, t, n);
|
|
15
|
-
}
|
|
16
|
-
render() {
|
|
17
|
-
let t = o({
|
|
18
|
-
"pkt-input-check__input": !0,
|
|
19
|
-
"pkt-input-check__input--tile": this.hasTile,
|
|
20
|
-
"pkt-input-check__input--tile-disabled": this.isDisabled && this.hasTile
|
|
21
|
-
}), r = o({
|
|
22
|
-
"pkt-input-check__input-checkbox": !0,
|
|
23
|
-
"pkt-input-check__input-checkbox--error": this.hasError
|
|
24
|
-
}), i = o({
|
|
25
|
-
"pkt-input-check__input-label": !0,
|
|
26
|
-
"pkt-input-check__input-label--disabled": this.isDisabled,
|
|
27
|
-
"pkt-sr-only": this.hideLabel
|
|
28
|
-
}), a = "pkt-tag pkt-tag--small pkt-tag--thin-text", c = this.pktStrings.get("forms"), l = () => e`
|
|
29
|
-
${this.tagText ? e`<span class=${a + " pkt-tag--gray"}>${this.tagText}</span>` : n}
|
|
30
|
-
${this.optionalTag ? e`<span class=${a + " pkt-tag--blue-light"}
|
|
31
|
-
>${this.optionalText ?? c.optional}</span
|
|
32
|
-
>` : n}
|
|
33
|
-
${this.requiredTag ? e`<span class=${a + " pkt-tag--beige"}
|
|
34
|
-
>${this.requiredText ?? c.required}</span
|
|
35
|
-
>` : n}
|
|
36
|
-
`, u = this.id + "-check-label", d = this.id + "-check-helptext";
|
|
37
|
-
return e`
|
|
38
|
-
<div class="pkt-input-check${this.inputSize ? ` pkt-input-check--${this.inputSize}` : ""}">
|
|
39
|
-
<div class=${t}>
|
|
40
|
-
<input
|
|
41
|
-
id=${this.id + "-internal"}
|
|
42
|
-
class=${r}
|
|
43
|
-
type="radio"
|
|
44
|
-
?disabled=${this.isDisabled}
|
|
45
|
-
form=""
|
|
46
|
-
name=${this.name + "-internal"}
|
|
47
|
-
${s(this.inputRef)}
|
|
48
|
-
@change=${this.toggleChecked}
|
|
49
|
-
@input=${this.handleInput}
|
|
50
|
-
@blur=${this.onBlur}
|
|
51
|
-
@focus=${this.onFocus}
|
|
52
|
-
?checked=${this.checked}
|
|
53
|
-
aria-labelledby=${this.label ? u : n}
|
|
54
|
-
aria-describedby=${this.checkHelptext ? d : n}
|
|
55
|
-
/>
|
|
56
|
-
${e`
|
|
57
|
-
<label class=${i} for=${this.id + "-internal"}>
|
|
58
|
-
<span id=${u}>${this.label} ${l()}</span>
|
|
59
|
-
${this.checkHelptext ? e`<div id=${d} class="pkt-input-check__input-helptext">
|
|
60
|
-
${this.checkHelptext}
|
|
61
|
-
</div>` : n}
|
|
62
|
-
</label>
|
|
63
|
-
`}
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
`;
|
|
67
|
-
}
|
|
68
|
-
handleInput(e) {
|
|
69
|
-
e.stopImmediatePropagation(), this.onInput();
|
|
70
|
-
}
|
|
71
|
-
toggleChecked(e = null) {
|
|
72
|
-
e && e.preventDefault(), e && e.stopImmediatePropagation(), this.touched = !0, this.inputRef.value && (this._checked = this.inputRef.value.matches(":checked"), this.valueChecked(this._checked));
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
i([a({
|
|
76
|
-
type: String,
|
|
77
|
-
reflect: !0
|
|
78
|
-
})], u.prototype, "value", void 0), i([a({ type: String })], u.prototype, "checkHelptext", void 0), i([a({ type: Boolean })], u.prototype, "defaultChecked", void 0), i([a({ type: Boolean })], u.prototype, "hasTile", void 0), i([a({
|
|
79
|
-
type: Boolean,
|
|
80
|
-
reflect: !0
|
|
81
|
-
})], u.prototype, "checked", void 0), i([a({
|
|
82
|
-
type: String,
|
|
83
|
-
reflect: !0
|
|
84
|
-
})], u.prototype, "type", void 0), i([a({
|
|
85
|
-
type: String,
|
|
86
|
-
attribute: "input-size"
|
|
87
|
-
})], u.prototype, "inputSize", void 0), i([a({ type: String })], u.prototype, "tagText", void 0), i([a({ type: Boolean })], u.prototype, "optionalTag", void 0), i([a({ type: String })], u.prototype, "optionalText", void 0), i([a({ type: Boolean })], u.prototype, "requiredTag", void 0), i([a({ type: String })], u.prototype, "requiredText", void 0), i([r()], u.prototype, "_checked", void 0);
|
|
88
|
-
try {
|
|
89
|
-
t("pkt-radiobutton")(u);
|
|
90
|
-
} catch {
|
|
91
|
-
console.warn("Forsøker å definere <pkt-radiobutton>, men den er allerede definert");
|
|
92
|
-
}
|
|
93
|
-
//#endregion
|
|
94
|
-
//#region src/components/radiobutton/index.ts
|
|
95
|
-
var d = u;
|
|
96
|
-
//#endregion
|
|
97
|
-
export { u as n, d as t };
|
package/dist/tabs-CjX-GWvM.cjs
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
const e=require("./element-BOmr9YLv.cjs"),t=require("./element-with-slot-D7sTqOr3.cjs"),n=require("./if-defined-2mkIDgOm.cjs"),r=require("./consume-Le4HztPo.cjs"),i=require("./ref-Emu5PNxk.cjs");var a=r.r(Symbol(`pkt-tabs-context`)),o=class extends t.t{constructor(...e){super(...e),this.arrowNav=!0,this.disableArrowNav=!1,this.separatorIconName=``,this.separatorIconPath=``,this.tabRefs=[],this.disabledMap={},this.tabCount=0,this.context={useArrowNav:this.useArrowNav,registerTab:this.registerTab.bind(this),handleClick:this.handleClick.bind(this),handleKeyUp:this.handleKeyUp.bind(this)}}get useArrowNav(){return this.arrowNav&&!this.disableArrowNav}willUpdate(e){(e.has(`arrowNav`)||e.has(`disableArrowNav`))&&(this.context={...this.context,useArrowNav:this.useArrowNav})}updated(){this.updateComplete.then(()=>this.syncSeparators())}syncSeparators(){let e=this.querySelector(`.pkt-tabs__list`);if(!e||(e.querySelectorAll(`.pkt-tabs__separator`).forEach(e=>e.remove()),!(this.separatorIconName||this.separatorIconPath)))return;let t=Array.from(e.children).filter(e=>!e.classList.contains(`pkt-tabs__separator`));for(let e=0;e<t.length-1;e++){let n=document.createElement(`span`);if(n.className=`pkt-tabs__separator`,n.setAttribute(`aria-hidden`,`true`),n.setAttribute(`role`,`presentation`),this.separatorIconPath){let e=document.createElement(`img`);e.setAttribute(`src`,this.separatorIconPath),e.setAttribute(`alt`,``),e.setAttribute(`aria-hidden`,`true`),n.appendChild(e)}else if(this.separatorIconName){let e=document.createElement(`pkt-icon`);e.setAttribute(`name`,this.separatorIconName),e.classList.add(`pkt-tabs__separator-icon`),n.appendChild(e)}t[e].after(n)}}registerTab(e,t,n=!1){this.tabRefs[t]=e,this.disabledMap[t]=n,this.tabCount=Math.max(this.tabCount,t+1)}isTabDisabled(e){return!!this.disabledMap[e]}findEnabledIndex(e,t){let n=e+t;for(;n>=0&&n<this.tabCount;){if(!this.isTabDisabled(n))return n;n+=t}return null}handleClick(e){this.isTabDisabled(e)||this.dispatchEvent(new CustomEvent(`tab-selected`,{detail:{index:e},bubbles:!0,composed:!0}))}handleKeyUp(e,t){if(this.useArrowNav){if(e.key===`ArrowLeft`){e.preventDefault();let n=this.findEnabledIndex(t,-1);n!==null&&this.tabRefs[n]?.focus()}if(e.key===`ArrowRight`){e.preventDefault();let n=this.findEnabledIndex(t,1);n!==null&&this.tabRefs[n]?.focus()}(e.key===`Enter`||e.key===` `||e.key===`Spacebar`||e.key===`ArrowDown`)&&(e.preventDefault(),this.handleClick(t))}}render(){let n=this.useArrowNav?`tablist`:`navigation`,r=this.separatorIconName||this.separatorIconPath?`pkt-tabs pkt-tabs--with-separator`:`pkt-tabs`;return e._`
|
|
2
|
-
<div class=${r}>
|
|
3
|
-
<div class="pkt-tabs__list" role=${n}>${t.i(this)}</div>
|
|
4
|
-
</div>
|
|
5
|
-
`}};e.n([e.u({type:Boolean,reflect:!0,attribute:`arrow-nav`})],o.prototype,`arrowNav`,void 0),e.n([e.u({type:Boolean,reflect:!0,attribute:`disable-arrow-nav`})],o.prototype,`disableArrowNav`,void 0),e.n([e.u({type:String,reflect:!0,attribute:`separator-icon-name`})],o.prototype,`separatorIconName`,void 0),e.n([e.u({type:String,reflect:!0,attribute:`separator-icon-path`})],o.prototype,`separatorIconPath`,void 0),e.n([e.l()],o.prototype,`tabRefs`,void 0),e.n([e.l()],o.prototype,`disabledMap`,void 0),e.n([e.l()],o.prototype,`tabCount`,void 0),e.n([r.n({context:a}),e.l()],o.prototype,`context`,void 0);try{e.d(`pkt-tabs`)(o)}catch{console.warn(`Forsøker å definere <pkt-tabs>, men den er allerede definert`)}var s=class extends t.t{constructor(){super(),this.active=!1,this.disabled=!1,this.href=``,this.icon=``,this.controls=``,this.tag=``,this.tagSkin=`blue`,this.index=0,this.elementRef=i.t()}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.elementRef.value&&this.context&&this.context.registerTab(this.elementRef.value,this.index,this.disabled)})}updated(){this.elementRef.value&&this.context&&this.context.registerTab(this.elementRef.value,this.index,this.disabled)}handleClick(e){if(this.disabled){e.preventDefault(),e.stopPropagation();return}this.context&&this.context.handleClick(this.index)}handleKeyDown(e){if(this.disabled&&(e.key===`Enter`||e.key===` `||e.key===`Spacebar`)){e.preventDefault(),e.stopPropagation();return}this.context&&this.context.handleKeyUp(e,this.index)}render(){let r=this.context?.useArrowNav??!0,a=this.active&&!this.disabled,o=[a?`active`:``,this.disabled?`pkt-tabs__item--disabled`:``].filter(Boolean).join(` `),s=r?`tab`:void 0,c=r?a:void 0,l=this.disabled?-1:a||!r?void 0:-1,u=`pkt-icon--small ${this.icon===`check`?`pkt-tabs__status-icon`:``}`,d=e._`
|
|
6
|
-
${this.icon?e._`<pkt-icon name=${this.icon} class=${u}></pkt-icon>`:``}
|
|
7
|
-
<span>${t.i(this)}</span>
|
|
8
|
-
${this.tag?e._`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>`:``}
|
|
9
|
-
`;return this.href?e._`
|
|
10
|
-
<a
|
|
11
|
-
${i.n(this.elementRef)}
|
|
12
|
-
href=${n.t(this.disabled?void 0:this.href)}
|
|
13
|
-
class="pkt-tabs__link ${o}"
|
|
14
|
-
role=${n.t(s)}
|
|
15
|
-
aria-selected=${n.t(c)}
|
|
16
|
-
aria-disabled=${n.t(this.disabled?`true`:void 0)}
|
|
17
|
-
aria-controls=${n.t(this.controls||void 0)}
|
|
18
|
-
tabindex=${n.t(l)}
|
|
19
|
-
@click=${this.handleClick}
|
|
20
|
-
@keydown=${this.handleKeyDown}
|
|
21
|
-
>
|
|
22
|
-
${d}
|
|
23
|
-
</a>
|
|
24
|
-
`:e._`
|
|
25
|
-
<button
|
|
26
|
-
${i.n(this.elementRef)}
|
|
27
|
-
type="button"
|
|
28
|
-
class="pkt-tabs__button pkt-link-button ${o}"
|
|
29
|
-
?disabled=${this.disabled}
|
|
30
|
-
aria-disabled=${n.t(this.disabled?`true`:void 0)}
|
|
31
|
-
role=${n.t(s)}
|
|
32
|
-
aria-selected=${n.t(c)}
|
|
33
|
-
aria-controls=${n.t(this.controls||void 0)}
|
|
34
|
-
tabindex=${n.t(l)}
|
|
35
|
-
@click=${this.handleClick}
|
|
36
|
-
@keydown=${this.handleKeyDown}
|
|
37
|
-
>
|
|
38
|
-
${d}
|
|
39
|
-
</button>
|
|
40
|
-
`}};e.n([e.u({type:Boolean,reflect:!0})],s.prototype,`active`,void 0),e.n([e.u({type:Boolean,reflect:!0})],s.prototype,`disabled`,void 0),e.n([e.u({type:String,reflect:!0})],s.prototype,`href`,void 0),e.n([e.u({type:String,reflect:!0})],s.prototype,`icon`,void 0),e.n([e.u({type:String,reflect:!0})],s.prototype,`controls`,void 0),e.n([e.u({type:String,reflect:!0})],s.prototype,`tag`,void 0),e.n([e.u({type:String,reflect:!0,attribute:`tag-skin`})],s.prototype,`tagSkin`,void 0),e.n([e.u({type:Number,reflect:!0})],s.prototype,`index`,void 0),e.n([r.t({context:a,subscribe:!0}),e.u({attribute:!1})],s.prototype,`context`,void 0);try{e.d(`pkt-tab-item`)(s)}catch{console.warn(`Forsøker å definere <pkt-tab-item>, men den er allerede definert`)}var c=o;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return c}});
|