@oslokommune/punkt-elements 16.26.6 → 17.0.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 +110 -0
- package/dist/accordion-CbXDxOho.cjs +47 -0
- package/dist/{accordion-CBdIk9gw.js → accordion-DEUHQ4JD.js} +45 -35
- package/dist/{alert-HHTGY0sp.js → alert-CbtVGrHD.js} +31 -17
- package/dist/{alert-B8dLsiTz.cjs → alert-CkUnbPdA.cjs} +5 -5
- package/dist/base-elements/input-element.d.ts +1 -0
- package/dist/button-Cod17rKo.js +115 -0
- package/dist/{button-B5tQpKeG.cjs → button-gvDXtBMC.cjs} +5 -2
- package/dist/{calendar-DIzGBdbh.cjs → calendar-BVXW8DqC.cjs} +1 -1
- package/dist/{calendar-CjlUA-Lb.js → calendar-CjC4qlh6.js} +1 -1
- package/dist/{checkbox-DfIvuwAj.cjs → checkbox-8uxbeU30.cjs} +1 -1
- package/dist/{checkbox-D3uflJEb.js → checkbox-DJDphhqz.js} +1 -1
- package/dist/{combobox-1xG07Oce.js → combobox-Du5yr-xM.js} +16 -2
- package/dist/combobox-hKrbYLUe.cjs +136 -0
- package/dist/components/accordion/accordion-context.d.ts +7 -0
- package/dist/components/accordion/accordion.d.ts +2 -0
- package/dist/components/accordion/accordionitem.d.ts +1 -0
- package/dist/components/alert/alert.d.ts +5 -0
- package/dist/components/alert/alert.test.d.ts +1 -0
- package/dist/components/button/button.d.ts +4 -1
- package/dist/components/datepicker/datepicker-base.d.ts +2 -0
- package/dist/components/datepicker/datepicker-utils.d.ts +2 -2
- package/dist/components/footer/footer-base.d.ts +44 -0
- package/dist/components/footer/footer-simple.d.ts +20 -0
- package/dist/components/footer/footer.accessibility.test.d.ts +0 -0
- package/dist/components/footer/footer.d.ts +22 -0
- package/dist/components/footer/footer.test.d.ts +0 -0
- package/dist/components/footer/index.d.ts +3 -0
- package/dist/components/footer/types.d.ts +16 -0
- package/dist/components/header/header-chrome-controller.d.ts +44 -0
- package/dist/components/header/header-global.accessibility.test.d.ts +0 -0
- package/dist/components/header/header-global.d.ts +78 -0
- package/dist/components/header/header-global.test.d.ts +0 -0
- package/dist/components/header/header-service.accessibility.test.d.ts +0 -0
- package/dist/components/header/header-service.d.ts +6 -21
- package/dist/components/header/header-service.test.d.ts +1 -1
- package/dist/components/header/header.d.ts +11 -3
- package/dist/components/header/header.test.d.ts +0 -0
- package/dist/components/header/index.d.ts +2 -1
- package/dist/components/header/types.d.ts +28 -2
- package/dist/components/header-menu/header-menu.d.ts +4 -5
- package/dist/components/header-menu/types.d.ts +1 -1
- package/dist/components/index.d.ts +5 -3
- package/dist/components/input-wrapper/input-wrapper.d.ts +2 -0
- package/dist/components/input-wrapper/input-wrapper.test.d.ts +1 -0
- package/dist/components/searchinput/searchinput.d.ts +5 -0
- package/dist/components/select/index.d.ts +1 -1
- package/dist/components/select/select.d.ts +2 -2
- package/dist/components/select/select.test.d.ts +1 -0
- package/dist/components/textarea/textarea.test.d.ts +2 -0
- package/dist/components/textinput/textinput.test.d.ts +1 -0
- package/dist/components/timepicker/timepicker.d.ts +2 -0
- package/dist/components/timepicker/timepicker.test.d.ts +3 -0
- package/dist/consent--Nw43WFU.cjs +18 -0
- package/dist/{consent-D5sY6JK3.js → consent-B2hSTCGC.js} +14 -7
- package/dist/consume-BiOhrhEy.js +167 -0
- package/dist/consume-DKf5SmP9.cjs +1 -0
- package/dist/{converters-BKGBRBpS.js → converters-BBfsEJV5.js} +25 -25
- package/dist/{converters-9jHlXDyy.cjs → converters-Cd0fPEly.cjs} +1 -1
- package/dist/{datepicker-B_J5APcK.js → datepicker--Fq8q-J3.js} +30 -12
- package/dist/{datepicker-DXxTiHJd.cjs → datepicker-CEoBYTBU.cjs} +11 -7
- package/dist/docs/components/alert.d.ts +3 -0
- package/dist/docs/components/footer.d.ts +9 -0
- package/dist/docs/components/form-sizes.d.ts +10 -0
- package/dist/docs/components/header-global-full.d.ts +20 -0
- package/dist/docs/components/header-global.d.ts +14 -0
- package/dist/docs/components/searchinput.d.ts +6 -3
- package/dist/fetch-header-footer-data-Pc32etrk.js +88 -0
- package/dist/fetch-header-footer-data-xohWFmYC.cjs +1 -0
- package/dist/fileupload-CGKUJrlj.cjs +401 -0
- package/dist/{fileupload-2hf8YNhO.js → fileupload-D4gQN64T.js} +156 -176
- package/dist/focus-trap-DG3pEuyJ.js +60 -0
- package/dist/focus-trap-DSv4Ifqm.cjs +1 -0
- package/dist/footer-BIrJeRuZ.js +303 -0
- package/dist/footer-Ber-jqM1.cjs +114 -0
- package/dist/footer.d.ts +1 -0
- package/dist/header-CrGRaoqe.js +1288 -0
- package/dist/header-DNeyR8DD.cjs +466 -0
- package/dist/header-menu-BHqK4QA6.cjs +126 -0
- package/dist/{header-menu-C8b5vd3n.js → header-menu-GFtJKM4j.js} +25 -97
- package/dist/{helptext-OfqH5npD.js → helptext-C_brWCIT.js} +1 -1
- package/dist/{helptext-eckq4JEX.cjs → helptext-Cq5rNaAC.cjs} +1 -1
- package/dist/{input-element-DZLXF2rI.cjs → input-element-B0qLbEdF.cjs} +1 -1
- package/dist/{input-element-DgylI1GK.js → input-element-C0RnXi-J.js} +11 -2
- package/dist/{input-wrapper-DwwE0JcO.js → input-wrapper-BweP6t3O.js} +12 -0
- package/dist/{input-wrapper-BRjQB4zM.cjs → input-wrapper-DPkkiG7S.cjs} +13 -11
- package/dist/{input-wrapper-DaA98B5l.js → input-wrapper-fWV5P4MN.js} +22 -15
- package/dist/{input-wrapper-LcZjpt0L.cjs → input-wrapper-wh3fWIhk.cjs} +1 -1
- package/dist/modal-CPnFteYS.cjs +35 -0
- package/dist/{modal-C6pScpdG.js → modal-xNK_wpHk.js} +11 -20
- 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-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-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 -0
- package/dist/pkt-footer.js +2 -0
- 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 +2 -2
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +27 -26
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +1 -1
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.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-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/{radiobutton-DFCA9V07.js → radiobutton-C6htwDrT.js} +1 -1
- package/dist/{radiobutton-BH6rl98w.cjs → radiobutton-DjWBoSHv.cjs} +1 -1
- package/dist/scroll-lock-BN8lOhV5.cjs +1 -0
- package/dist/scroll-lock-DAbNKAUy.js +18 -0
- package/dist/searchinput-CfUVfpqL.js +156 -0
- package/dist/searchinput-DGjeN1YI.cjs +60 -0
- package/dist/{select-C3Q_bGZb.cjs → select-CZvAW7W2.cjs} +2 -1
- package/dist/{select-YyR17Ml6.js → select-CsBXXbLP.js} +4 -3
- package/dist/setupTests.d.ts +0 -0
- package/dist/shared-types/footer.d.ts +95 -0
- package/dist/shared-types/{header-menu.d.ts → header-footer.d.ts} +51 -4
- package/dist/shared-types/header.d.ts +1 -1
- package/dist/shared-types/index.d.ts +6 -4
- package/dist/shared-types/searchinput.d.ts +2 -0
- package/dist/shared-types/select.d.ts +3 -2
- package/dist/shared-types/size.d.ts +4 -0
- package/dist/shared-types/timepicker.d.ts +0 -6
- package/dist/shared-utils/datepicker-utils.d.ts +5 -4
- package/dist/shared-utils/fileupload/focus-trap.d.ts +4 -10
- package/dist/shared-utils/focus-trap/index.d.ts +22 -0
- package/dist/shared-utils/{header-menu → header-footer}/example-data.d.ts +5 -4
- package/dist/shared-utils/header-footer/external-domain.d.ts +26 -0
- package/dist/shared-utils/{header-menu → header-footer}/fetch-header-footer-data.d.ts +6 -2
- package/dist/shared-utils/{header-menu → header-footer}/index.d.ts +2 -1
- package/dist/shared-utils/{header-menu → header-footer}/select-megamenu.d.ts +1 -1
- package/dist/shared-utils/scroll-lock/index.d.ts +24 -0
- package/dist/tabs-BqrKLCjd.js +214 -0
- package/dist/tabs-q62MK_-r.cjs +40 -0
- package/dist/{textarea-DNitIoWX.js → textarea-Cm392CEI.js} +5 -3
- package/dist/{textarea-Cb0pj6ki.cjs → textarea-sTcZxOIB.cjs} +3 -2
- package/dist/{textinput-CaIDCB2J.cjs → textinput-DqJbTglM.cjs} +3 -2
- package/dist/{textinput-CurFrsfQ.js → textinput-TSPcBcih.js} +5 -3
- package/dist/{timepicker-BcHEEtpX.cjs → timepicker-CqFYMV8q.cjs} +8 -7
- package/dist/{timepicker-Ch-ums4R.js → timepicker-DWbgTDKq.js} +10 -9
- package/package.json +3 -3
- package/src/components/accordion/accordion-context.ts +8 -0
- package/src/components/accordion/accordion.test.ts +44 -0
- package/src/components/accordion/accordion.ts +13 -3
- package/src/components/accordion/accordionitem.ts +9 -1
- package/src/components/alert/alert.test.ts +51 -2
- package/src/components/alert/alert.ts +11 -5
- package/src/components/breadcrumbs/breadcrumbs.test.ts +11 -3
- package/src/components/button/button.test.ts +23 -0
- package/src/components/button/button.ts +28 -3
- package/src/components/combobox/combobox.core.test.ts +20 -0
- package/src/components/combobox/combobox.ts +2 -0
- package/src/components/consent/consent.test.ts +6 -3
- package/src/components/consent/consent.ts +15 -7
- package/src/components/datepicker/datepicker-base.ts +5 -1
- package/src/components/datepicker/datepicker-utils.test.ts +10 -0
- package/src/components/datepicker/datepicker.core.test.ts +17 -0
- package/src/components/datepicker/datepicker.ts +8 -0
- package/src/components/footer/footer-base.ts +238 -0
- package/src/components/footer/footer-simple.ts +71 -0
- package/src/components/footer/footer.accessibility.test.ts +66 -0
- package/src/components/footer/footer.test.ts +238 -0
- package/src/components/footer/footer.ts +81 -0
- package/src/components/footer/index.ts +4 -0
- package/src/components/footer/types.ts +21 -0
- package/src/components/header/header-chrome-controller.ts +123 -0
- package/src/components/header/header-global.accessibility.test.ts +110 -0
- package/src/components/header/header-global.test.ts +329 -0
- package/src/components/header/header-global.ts +648 -0
- package/src/components/header/header-service.accessibility.test.ts +79 -0
- package/src/components/header/header-service.test.ts +32 -12
- package/src/components/header/header-service.ts +38 -162
- package/src/components/header/header.test.ts +84 -0
- package/src/components/header/header.ts +52 -5
- package/src/components/header/index.ts +6 -0
- package/src/components/header/types.ts +38 -0
- package/src/components/header-menu/header-menu.test.ts +131 -10
- package/src/components/header-menu/header-menu.ts +23 -24
- package/src/components/header-menu/types.ts +1 -1
- package/src/components/index.ts +18 -2
- package/src/components/input-wrapper/input-wrapper.test.ts +45 -0
- package/src/components/input-wrapper/input-wrapper.ts +17 -9
- package/src/components/modal/modal.ts +8 -9
- package/src/components/searchinput/searchinput.test.ts +43 -0
- package/src/components/searchinput/searchinput.ts +29 -12
- package/src/components/select/index.ts +1 -1
- package/src/components/select/select.test.ts +28 -0
- package/src/components/select/select.ts +4 -3
- package/src/components/textarea/textarea.test.ts +16 -0
- package/src/components/textarea/textarea.ts +3 -1
- package/src/components/textinput/textinput.test.ts +57 -0
- package/src/components/textinput/textinput.ts +3 -1
- package/src/components/timepicker/timepicker.test.ts +26 -0
- package/src/components/timepicker/timepicker.ts +12 -6
- package/dist/accordion-FISAiAbX.cjs +0 -47
- package/dist/button-C_YzTSuU.js +0 -96
- package/dist/combobox-BjBNyEly.cjs +0 -135
- package/dist/consent-X3wvhteO.cjs +0 -10
- package/dist/fileupload-BLVrslUX.cjs +0 -401
- package/dist/header-CFzvRT3j.js +0 -801
- package/dist/header-DaFGbtLu.cjs +0 -310
- package/dist/header-menu-DMdP_c6X.cjs +0 -126
- package/dist/modal-DKU7PnjJ.cjs +0 -35
- package/dist/searchinput-CyO5k4Q4.js +0 -148
- package/dist/searchinput-DG6YetL1.cjs +0 -60
- package/dist/shared-utils/modal-scroll-lock.d.ts +0 -10
- package/dist/tabs-CGo0ODPa.cjs +0 -40
- package/dist/tabs-ChdR0D1C.js +0 -379
- /package/dist/shared-utils/{header-menu → header-footer}/icon-map.d.ts +0 -0
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { d as e, n as t, o as n, p as r, s as i, t as a } from "./element-BoJrqauR.js";
|
|
2
|
-
import { t as o } from "./class-map-CAQCRB1W.js";
|
|
3
|
-
import "./icon-DGFEIlco.js";
|
|
4
|
-
import { t as s } from "./if-defined-D0bnetLJ.js";
|
|
5
|
-
import { t as c } from "./focus-modality-controller-Dc2S-KqR.js";
|
|
6
|
-
//#region src/components/searchinput/searchinput.ts
|
|
7
|
-
var l = class extends a {
|
|
8
|
-
constructor(...e) {
|
|
9
|
-
super(...e), this.appearance = "local", this.disabled = !1, this.fullwidth = !1, this.id = "", this.placeholder = "Søk…", this.value = "", this.focusModality = new c(this, ".pkt-searchinput");
|
|
10
|
-
}
|
|
11
|
-
get suggestionsId() {
|
|
12
|
-
return `${this.id}-suggestions`;
|
|
13
|
-
}
|
|
14
|
-
dispatchSearch() {
|
|
15
|
-
this.dispatchEvent(new CustomEvent("pkt-search", {
|
|
16
|
-
detail: { value: this.value },
|
|
17
|
-
bubbles: !0,
|
|
18
|
-
composed: !0
|
|
19
|
-
}));
|
|
20
|
-
}
|
|
21
|
-
onInput(e) {
|
|
22
|
-
let t = e.target;
|
|
23
|
-
this.value = t.value;
|
|
24
|
-
}
|
|
25
|
-
onInputKeydown(e) {
|
|
26
|
-
e.key === "Enter" && (e.preventDefault(), this.dispatchSearch());
|
|
27
|
-
}
|
|
28
|
-
onSearchClick(e) {
|
|
29
|
-
e.preventDefault(), this.dispatchSearch();
|
|
30
|
-
}
|
|
31
|
-
onSuggestionClick(e, t, n) {
|
|
32
|
-
let r = new CustomEvent("pkt-suggestion-click", {
|
|
33
|
-
detail: {
|
|
34
|
-
index: n,
|
|
35
|
-
suggestion: t
|
|
36
|
-
},
|
|
37
|
-
bubbles: !0,
|
|
38
|
-
composed: !0,
|
|
39
|
-
cancelable: !0
|
|
40
|
-
});
|
|
41
|
-
this.dispatchEvent(r) || e.preventDefault();
|
|
42
|
-
}
|
|
43
|
-
renderSuggestion(t, n) {
|
|
44
|
-
let i = r`
|
|
45
|
-
${t.title ? r`<h3 class="pkt-searchinput__suggestion-title">${t.title}</h3>` : e}
|
|
46
|
-
${t.text ? r`<p class="pkt-searchinput__suggestion-text">${t.text}</p>` : e}
|
|
47
|
-
`;
|
|
48
|
-
return t.href ? r`<a
|
|
49
|
-
href=${t.href}
|
|
50
|
-
class="pkt-searchinput__suggestion"
|
|
51
|
-
@click=${(e) => this.onSuggestionClick(e, t, n)}
|
|
52
|
-
>
|
|
53
|
-
${i}
|
|
54
|
-
</a>` : t.nonInteractive ? r`<div class="pkt-searchinput__suggestion">${i}</div>` : r`<button
|
|
55
|
-
type="button"
|
|
56
|
-
class="pkt-searchinput__suggestion"
|
|
57
|
-
@click=${(e) => this.onSuggestionClick(e, t, n)}
|
|
58
|
-
>
|
|
59
|
-
${i}
|
|
60
|
-
</button>`;
|
|
61
|
-
}
|
|
62
|
-
render() {
|
|
63
|
-
let t = o({
|
|
64
|
-
"pkt-searchinput": !0,
|
|
65
|
-
[`pkt-searchinput--${this.appearance}`]: !0,
|
|
66
|
-
"pkt-searchinput--fullwidth": this.fullwidth
|
|
67
|
-
}), n = o({
|
|
68
|
-
"pkt-searchinput__button": !0,
|
|
69
|
-
"pkt-input-icon": this.appearance === "local",
|
|
70
|
-
"pkt-btn": !0,
|
|
71
|
-
"pkt-btn--medium": !0,
|
|
72
|
-
"pkt-btn--icon-only": !0,
|
|
73
|
-
"pkt-btn--tertiary": this.appearance === "local",
|
|
74
|
-
"pkt-btn--primary": this.appearance === "global" || this.appearance === "local-with-button",
|
|
75
|
-
"pkt-btn--yellow": this.appearance === "global"
|
|
76
|
-
}), i = o({
|
|
77
|
-
"pkt-input": !0,
|
|
78
|
-
"pkt-input--fullwidth": this.fullwidth
|
|
79
|
-
}), a = this.appearance === "local" ? "pkt-input__container" : "pkt-searchinput__field", c = r`
|
|
80
|
-
${this.label ? r`<label for=${s(this.id || void 0)} class="pkt-inputwrapper__label"
|
|
81
|
-
>${this.label}</label
|
|
82
|
-
>` : e}
|
|
83
|
-
<div class=${a}>
|
|
84
|
-
<input
|
|
85
|
-
class=${i}
|
|
86
|
-
type="search"
|
|
87
|
-
name=${this.name || this.id}
|
|
88
|
-
id=${this.id}
|
|
89
|
-
placeholder=${this.placeholder || "Søk…"}
|
|
90
|
-
.value=${this.value}
|
|
91
|
-
?disabled=${this.disabled}
|
|
92
|
-
autocomplete="off"
|
|
93
|
-
aria-autocomplete="list"
|
|
94
|
-
aria-controls=${this.suggestionsId}
|
|
95
|
-
@input=${this.onInput}
|
|
96
|
-
@keydown=${this.onInputKeydown}
|
|
97
|
-
/>
|
|
98
|
-
<button
|
|
99
|
-
type="submit"
|
|
100
|
-
class=${n}
|
|
101
|
-
?disabled=${this.disabled}
|
|
102
|
-
@click=${this.onSearchClick}
|
|
103
|
-
>
|
|
104
|
-
<pkt-icon class="pkt-btn__icon" name="magnifying-glass-big" />
|
|
105
|
-
<span class="pkt-btn__text">${this.label || this.placeholder || "Søk…"}</span>
|
|
106
|
-
</button>
|
|
107
|
-
</div>
|
|
108
|
-
${this.suggestions ? r`<ul
|
|
109
|
-
id=${this.suggestionsId}
|
|
110
|
-
class="pkt-searchinput__suggestions"
|
|
111
|
-
aria-live="assertive"
|
|
112
|
-
>
|
|
113
|
-
${this.suggestions.map((e, t) => r` <li>${this.renderSuggestion(e, t)}</li> `)}
|
|
114
|
-
</ul>` : e}
|
|
115
|
-
`;
|
|
116
|
-
return this.action ? r`<form
|
|
117
|
-
role="search"
|
|
118
|
-
class=${t}
|
|
119
|
-
action=${this.action}
|
|
120
|
-
method=${s(this.method)}
|
|
121
|
-
@submit=${(e) => {
|
|
122
|
-
e.preventDefault();
|
|
123
|
-
}}
|
|
124
|
-
>
|
|
125
|
-
${c}
|
|
126
|
-
</form>` : r`<div role="search" class=${t}>${c}</div>`;
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
t([n({ type: String })], l.prototype, "appearance", void 0), t([n({
|
|
130
|
-
type: Boolean,
|
|
131
|
-
reflect: !0
|
|
132
|
-
})], l.prototype, "disabled", void 0), t([n({
|
|
133
|
-
type: Boolean,
|
|
134
|
-
reflect: !0
|
|
135
|
-
})], l.prototype, "fullwidth", void 0), t([n({
|
|
136
|
-
type: String,
|
|
137
|
-
reflect: !0
|
|
138
|
-
})], l.prototype, "id", void 0), t([n({ type: String })], l.prototype, "label", void 0), t([n({ type: String })], l.prototype, "name", void 0), t([n({ type: String })], l.prototype, "placeholder", void 0), t([n({ type: String })], l.prototype, "value", void 0), t([n({ type: Array })], l.prototype, "suggestions", void 0), t([n({ type: String })], l.prototype, "action", void 0), t([n({ type: String })], l.prototype, "method", void 0);
|
|
139
|
-
try {
|
|
140
|
-
i("pkt-searchinput")(l);
|
|
141
|
-
} catch {
|
|
142
|
-
console.warn("Forsøker å definere <pkt-searchinput>, men den er allerede definert");
|
|
143
|
-
}
|
|
144
|
-
//#endregion
|
|
145
|
-
//#region src/components/searchinput/index.ts
|
|
146
|
-
var u = l;
|
|
147
|
-
//#endregion
|
|
148
|
-
export { l as n, u as t };
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
const e=require("./element-DJzurxgt.cjs"),t=require("./class-map-CCZN5uS3.cjs");require("./icon-B8PVq2O6.cjs");const n=require("./if-defined-DrwbxQOj.cjs"),r=require("./focus-modality-controller-C1ocyv2J.cjs");var i=class extends e.t{constructor(...e){super(...e),this.appearance=`local`,this.disabled=!1,this.fullwidth=!1,this.id=``,this.placeholder=`Søk…`,this.value=``,this.focusModality=new r.t(this,`.pkt-searchinput`)}get suggestionsId(){return`${this.id}-suggestions`}dispatchSearch(){this.dispatchEvent(new CustomEvent(`pkt-search`,{detail:{value:this.value},bubbles:!0,composed:!0}))}onInput(e){let t=e.target;this.value=t.value}onInputKeydown(e){e.key===`Enter`&&(e.preventDefault(),this.dispatchSearch())}onSearchClick(e){e.preventDefault(),this.dispatchSearch()}onSuggestionClick(e,t,n){let r=new CustomEvent(`pkt-suggestion-click`,{detail:{index:n,suggestion:t},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(r)||e.preventDefault()}renderSuggestion(t,n){let r=e.p`
|
|
2
|
-
${t.title?e.p`<h3 class="pkt-searchinput__suggestion-title">${t.title}</h3>`:e.d}
|
|
3
|
-
${t.text?e.p`<p class="pkt-searchinput__suggestion-text">${t.text}</p>`:e.d}
|
|
4
|
-
`;return t.href?e.p`<a
|
|
5
|
-
href=${t.href}
|
|
6
|
-
class="pkt-searchinput__suggestion"
|
|
7
|
-
@click=${e=>this.onSuggestionClick(e,t,n)}
|
|
8
|
-
>
|
|
9
|
-
${r}
|
|
10
|
-
</a>`:t.nonInteractive?e.p`<div class="pkt-searchinput__suggestion">${r}</div>`:e.p`<button
|
|
11
|
-
type="button"
|
|
12
|
-
class="pkt-searchinput__suggestion"
|
|
13
|
-
@click=${e=>this.onSuggestionClick(e,t,n)}
|
|
14
|
-
>
|
|
15
|
-
${r}
|
|
16
|
-
</button>`}render(){let r=t.t({"pkt-searchinput":!0,[`pkt-searchinput--${this.appearance}`]:!0,"pkt-searchinput--fullwidth":this.fullwidth}),i=t.t({"pkt-searchinput__button":!0,"pkt-input-icon":this.appearance===`local`,"pkt-btn":!0,"pkt-btn--medium":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":this.appearance===`local`,"pkt-btn--primary":this.appearance===`global`||this.appearance===`local-with-button`,"pkt-btn--yellow":this.appearance===`global`}),a=t.t({"pkt-input":!0,"pkt-input--fullwidth":this.fullwidth}),o=this.appearance===`local`?`pkt-input__container`:`pkt-searchinput__field`,s=e.p`
|
|
17
|
-
${this.label?e.p`<label for=${n.t(this.id||void 0)} class="pkt-inputwrapper__label"
|
|
18
|
-
>${this.label}</label
|
|
19
|
-
>`:e.d}
|
|
20
|
-
<div class=${o}>
|
|
21
|
-
<input
|
|
22
|
-
class=${a}
|
|
23
|
-
type="search"
|
|
24
|
-
name=${this.name||this.id}
|
|
25
|
-
id=${this.id}
|
|
26
|
-
placeholder=${this.placeholder||`Søk…`}
|
|
27
|
-
.value=${this.value}
|
|
28
|
-
?disabled=${this.disabled}
|
|
29
|
-
autocomplete="off"
|
|
30
|
-
aria-autocomplete="list"
|
|
31
|
-
aria-controls=${this.suggestionsId}
|
|
32
|
-
@input=${this.onInput}
|
|
33
|
-
@keydown=${this.onInputKeydown}
|
|
34
|
-
/>
|
|
35
|
-
<button
|
|
36
|
-
type="submit"
|
|
37
|
-
class=${i}
|
|
38
|
-
?disabled=${this.disabled}
|
|
39
|
-
@click=${this.onSearchClick}
|
|
40
|
-
>
|
|
41
|
-
<pkt-icon class="pkt-btn__icon" name="magnifying-glass-big" />
|
|
42
|
-
<span class="pkt-btn__text">${this.label||this.placeholder||`Søk…`}</span>
|
|
43
|
-
</button>
|
|
44
|
-
</div>
|
|
45
|
-
${this.suggestions?e.p`<ul
|
|
46
|
-
id=${this.suggestionsId}
|
|
47
|
-
class="pkt-searchinput__suggestions"
|
|
48
|
-
aria-live="assertive"
|
|
49
|
-
>
|
|
50
|
-
${this.suggestions.map((t,n)=>e.p` <li>${this.renderSuggestion(t,n)}</li> `)}
|
|
51
|
-
</ul>`:e.d}
|
|
52
|
-
`;return this.action?e.p`<form
|
|
53
|
-
role="search"
|
|
54
|
-
class=${r}
|
|
55
|
-
action=${this.action}
|
|
56
|
-
method=${n.t(this.method)}
|
|
57
|
-
@submit=${e=>{e.preventDefault()}}
|
|
58
|
-
>
|
|
59
|
-
${s}
|
|
60
|
-
</form>`:e.p`<div role="search" class=${r}>${s}</div>`}};e.n([e.o({type:String})],i.prototype,`appearance`,void 0),e.n([e.o({type:Boolean,reflect:!0})],i.prototype,`disabled`,void 0),e.n([e.o({type:Boolean,reflect:!0})],i.prototype,`fullwidth`,void 0),e.n([e.o({type:String,reflect:!0})],i.prototype,`id`,void 0),e.n([e.o({type:String})],i.prototype,`label`,void 0),e.n([e.o({type:String})],i.prototype,`name`,void 0),e.n([e.o({type:String})],i.prototype,`placeholder`,void 0),e.n([e.o({type:String})],i.prototype,`value`,void 0),e.n([e.o({type:Array})],i.prototype,`suggestions`,void 0),e.n([e.o({type:String})],i.prototype,`action`,void 0),e.n([e.o({type:String})],i.prototype,`method`,void 0);try{e.s(`pkt-searchinput`)(i)}catch{console.warn(`Forsøker å definere <pkt-searchinput>, men den er allerede definert`)}var a=i;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const acquireModalScrollLock: (token: {
|
|
2
|
-
locked: boolean;
|
|
3
|
-
}) => void;
|
|
4
|
-
export declare const releaseModalScrollLock: (token: {
|
|
5
|
-
locked: boolean;
|
|
6
|
-
}) => void;
|
|
7
|
-
export type ModalScrollLockToken = {
|
|
8
|
-
locked: boolean;
|
|
9
|
-
};
|
|
10
|
-
export declare const createModalScrollLockToken: () => ModalScrollLockToken;
|
package/dist/tabs-CGo0ODPa.cjs
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
const e=require("./element-DJzurxgt.cjs"),t=require("./element-with-slot-BY7Jc-q8.cjs"),n=require("./if-defined-DrwbxQOj.cjs"),r=require("./ref-DO7TzO4O.cjs");var i=class extends Event{constructor(e,t,n,r){super(`context-request`,{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t,this.callback=n,this.subscribe=r??!1}};function a(e){return e}var o=class{constructor(e,t,n,r){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(e,t)=>{this.unsubscribe&&(this.unsubscribe!==t&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=e,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(e,t)),this.unsubscribe=t},this.host=e,t.context!==void 0){let e=t;this.context=e.context,this.callback=e.callback,this.subscribe=e.subscribe??!1}else this.context=t,this.callback=n,this.subscribe=r??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&=(this.unsubscribe(),void 0)}dispatchRequest(){this.host.dispatchEvent(new i(this.context,this.host,this.t,this.subscribe))}},s=class{get value(){return this.o}set value(e){this.setValue(e)}setValue(e,t=!1){let n=t||!Object.is(e,this.o);this.o=e,n&&this.updateObservers()}constructor(e){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:t}]of this.subscriptions)e(this.o,t)},e!==void 0&&(this.value=e)}addCallback(e,t,n){if(!n)return void e(this.value);this.subscriptions.has(e)||this.subscriptions.set(e,{disposer:()=>{this.subscriptions.delete(e)},consumerHost:t});let{disposer:r}=this.subscriptions.get(e);e(this.value,r)}clearCallbacks(){this.subscriptions.clear()}},c=class extends Event{constructor(e,t){super(`context-provider`,{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}},l=class extends s{constructor(e,t,n){super(t.context===void 0?n:t.initialValue),this.onContextRequest=e=>{if(e.context!==this.context)return;let t=e.contextTarget??e.composedPath()[0];t!==this.host&&(e.stopPropagation(),this.addCallback(e.callback,t,e.subscribe))},this.onProviderRequest=e=>{if(e.context!==this.context||(e.contextTarget??e.composedPath()[0])===this.host)return;let t=new Set;for(let[e,{consumerHost:n}]of this.subscriptions)t.has(e)||(t.add(e),n.dispatchEvent(new i(this.context,n,e,!0)));e.stopPropagation()},this.host=e,t.context===void 0?this.context=t:this.context=t.context,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener(`context-request`,this.onContextRequest),this.host.addEventListener(`context-provider`,this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new c(this.context,this.host))}};function u({context:e}){return(t,n)=>{let r=new WeakMap;if(typeof n==`object`)return{get(){return t.get.call(this)},set(e){return r.get(this).setValue(e),t.set.call(this,e)},init(t){return r.set(this,new l(this,{context:e,initialValue:t})),t}};{t.constructor.addInitializer((t=>{r.set(t,new l(t,{context:e}))}));let i=Object.getOwnPropertyDescriptor(t,n),a;if(i===void 0){let e=new WeakMap;a={get(){return e.get(this)},set(t){r.get(this).setValue(t),e.set(this,t)},configurable:!0,enumerable:!0}}else{let e=i.set;a={...i,set(t){r.get(this).setValue(t),e?.call(this,t)}}}Object.defineProperty(t,n,a);return}}}function d({context:e,subscribe:t}){return(n,r)=>{typeof r==`object`?r.addInitializer((function(){new o(this,{context:e,callback:e=>{n.set.call(this,e)},subscribe:t})})):n.constructor.addInitializer((n=>{new o(n,{context:e,callback:e=>{n[r]=e},subscribe:t})}))}}var f=a(Symbol(`pkt-tabs-context`)),p=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}updated(e){(e.has(`arrowNav`)||e.has(`disableArrowNav`))&&(this.context={...this.context,useArrowNav:this.useArrowNav}),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`;return e.p`
|
|
2
|
-
<div class=${this.separatorIconName||this.separatorIconPath?`pkt-tabs pkt-tabs--with-separator`:`pkt-tabs`}>
|
|
3
|
-
<div class="pkt-tabs__list" role=${n}>${t.n(this)}</div>
|
|
4
|
-
</div>
|
|
5
|
-
`}};e.n([e.o({type:Boolean,reflect:!0,attribute:`arrow-nav`})],p.prototype,`arrowNav`,void 0),e.n([e.o({type:Boolean,reflect:!0,attribute:`disable-arrow-nav`})],p.prototype,`disableArrowNav`,void 0),e.n([e.o({type:String,reflect:!0,attribute:`separator-icon-name`})],p.prototype,`separatorIconName`,void 0),e.n([e.o({type:String,reflect:!0,attribute:`separator-icon-path`})],p.prototype,`separatorIconPath`,void 0),e.n([e.a()],p.prototype,`tabRefs`,void 0),e.n([e.a()],p.prototype,`disabledMap`,void 0),e.n([e.a()],p.prototype,`tabCount`,void 0),e.n([u({context:f}),e.a()],p.prototype,`context`,void 0);try{e.s(`pkt-tabs`)(p)}catch{console.warn(`Forsøker å definere <pkt-tabs>, men den er allerede definert`)}var m=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=r.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 i=this.context?.useArrowNav??!0,a=this.active&&!this.disabled,o=[a?`active`:``,this.disabled?`pkt-tabs__item--disabled`:``].filter(Boolean).join(` `),s=i?`tab`:void 0,c=i?a:void 0,l=this.disabled?-1:a||!i?void 0:-1,u=`pkt-icon--small ${this.icon===`check`?`pkt-tabs__status-icon`:``}`,d=e.p`
|
|
6
|
-
${this.icon?e.p`<pkt-icon name=${this.icon} class=${u}></pkt-icon>`:``}
|
|
7
|
-
<span>${t.n(this)}</span>
|
|
8
|
-
${this.tag?e.p`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>`:``}
|
|
9
|
-
`;return this.href?e.p`
|
|
10
|
-
<a
|
|
11
|
-
${r.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.p`
|
|
25
|
-
<button
|
|
26
|
-
${r.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.o({type:Boolean,reflect:!0})],m.prototype,`active`,void 0),e.n([e.o({type:Boolean,reflect:!0})],m.prototype,`disabled`,void 0),e.n([e.o({type:String,reflect:!0})],m.prototype,`href`,void 0),e.n([e.o({type:String,reflect:!0})],m.prototype,`icon`,void 0),e.n([e.o({type:String,reflect:!0})],m.prototype,`controls`,void 0),e.n([e.o({type:String,reflect:!0})],m.prototype,`tag`,void 0),e.n([e.o({type:String,reflect:!0,attribute:`tag-skin`})],m.prototype,`tagSkin`,void 0),e.n([e.o({type:Number,reflect:!0})],m.prototype,`index`,void 0),e.n([d({context:f,subscribe:!0}),e.o({attribute:!1})],m.prototype,`context`,void 0);try{e.s(`pkt-tab-item`)(m)}catch{console.warn(`Forsøker å definere <pkt-tab-item>, men den er allerede definert`)}var h=p;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return h}});
|
package/dist/tabs-ChdR0D1C.js
DELETED
|
@@ -1,379 +0,0 @@
|
|
|
1
|
-
import { a as e, n as t, o as n, p as r, s as i } from "./element-BoJrqauR.js";
|
|
2
|
-
import { n as a, t as o } from "./element-with-slot-mXLg8gg8.js";
|
|
3
|
-
import { t as s } from "./if-defined-D0bnetLJ.js";
|
|
4
|
-
import { n as c, t as l } from "./ref-WGS0u7i2.js";
|
|
5
|
-
//#region node_modules/@lit/context/lib/context-request-event.js
|
|
6
|
-
var u = class extends Event {
|
|
7
|
-
constructor(e, t, n, r) {
|
|
8
|
-
super("context-request", {
|
|
9
|
-
bubbles: !0,
|
|
10
|
-
composed: !0
|
|
11
|
-
}), this.context = e, this.contextTarget = t, this.callback = n, this.subscribe = r ?? !1;
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region node_modules/@lit/context/lib/create-context.js
|
|
16
|
-
function d(e) {
|
|
17
|
-
return e;
|
|
18
|
-
}
|
|
19
|
-
//#endregion
|
|
20
|
-
//#region node_modules/@lit/context/lib/controllers/context-consumer.js
|
|
21
|
-
var f = class {
|
|
22
|
-
constructor(e, t, n, r) {
|
|
23
|
-
if (this.subscribe = !1, this.provided = !1, this.value = void 0, this.t = (e, t) => {
|
|
24
|
-
this.unsubscribe && (this.unsubscribe !== t && (this.provided = !1, this.unsubscribe()), this.subscribe || this.unsubscribe()), this.value = e, this.host.requestUpdate(), this.provided && !this.subscribe || (this.provided = !0, this.callback && this.callback(e, t)), this.unsubscribe = t;
|
|
25
|
-
}, this.host = e, t.context !== void 0) {
|
|
26
|
-
let e = t;
|
|
27
|
-
this.context = e.context, this.callback = e.callback, this.subscribe = e.subscribe ?? !1;
|
|
28
|
-
} else this.context = t, this.callback = n, this.subscribe = r ?? !1;
|
|
29
|
-
this.host.addController(this);
|
|
30
|
-
}
|
|
31
|
-
hostConnected() {
|
|
32
|
-
this.dispatchRequest();
|
|
33
|
-
}
|
|
34
|
-
hostDisconnected() {
|
|
35
|
-
this.unsubscribe &&= (this.unsubscribe(), void 0);
|
|
36
|
-
}
|
|
37
|
-
dispatchRequest() {
|
|
38
|
-
this.host.dispatchEvent(new u(this.context, this.host, this.t, this.subscribe));
|
|
39
|
-
}
|
|
40
|
-
}, p = class {
|
|
41
|
-
get value() {
|
|
42
|
-
return this.o;
|
|
43
|
-
}
|
|
44
|
-
set value(e) {
|
|
45
|
-
this.setValue(e);
|
|
46
|
-
}
|
|
47
|
-
setValue(e, t = !1) {
|
|
48
|
-
let n = t || !Object.is(e, this.o);
|
|
49
|
-
this.o = e, n && this.updateObservers();
|
|
50
|
-
}
|
|
51
|
-
constructor(e) {
|
|
52
|
-
this.subscriptions = /* @__PURE__ */ new Map(), this.updateObservers = () => {
|
|
53
|
-
for (let [e, { disposer: t }] of this.subscriptions) e(this.o, t);
|
|
54
|
-
}, e !== void 0 && (this.value = e);
|
|
55
|
-
}
|
|
56
|
-
addCallback(e, t, n) {
|
|
57
|
-
if (!n) return void e(this.value);
|
|
58
|
-
this.subscriptions.has(e) || this.subscriptions.set(e, {
|
|
59
|
-
disposer: () => {
|
|
60
|
-
this.subscriptions.delete(e);
|
|
61
|
-
},
|
|
62
|
-
consumerHost: t
|
|
63
|
-
});
|
|
64
|
-
let { disposer: r } = this.subscriptions.get(e);
|
|
65
|
-
e(this.value, r);
|
|
66
|
-
}
|
|
67
|
-
clearCallbacks() {
|
|
68
|
-
this.subscriptions.clear();
|
|
69
|
-
}
|
|
70
|
-
}, m = class extends Event {
|
|
71
|
-
constructor(e, t) {
|
|
72
|
-
super("context-provider", {
|
|
73
|
-
bubbles: !0,
|
|
74
|
-
composed: !0
|
|
75
|
-
}), this.context = e, this.contextTarget = t;
|
|
76
|
-
}
|
|
77
|
-
}, h = class extends p {
|
|
78
|
-
constructor(e, t, n) {
|
|
79
|
-
super(t.context === void 0 ? n : t.initialValue), this.onContextRequest = (e) => {
|
|
80
|
-
if (e.context !== this.context) return;
|
|
81
|
-
let t = e.contextTarget ?? e.composedPath()[0];
|
|
82
|
-
t !== this.host && (e.stopPropagation(), this.addCallback(e.callback, t, e.subscribe));
|
|
83
|
-
}, this.onProviderRequest = (e) => {
|
|
84
|
-
if (e.context !== this.context || (e.contextTarget ?? e.composedPath()[0]) === this.host) return;
|
|
85
|
-
let t = /* @__PURE__ */ new Set();
|
|
86
|
-
for (let [e, { consumerHost: n }] of this.subscriptions) t.has(e) || (t.add(e), n.dispatchEvent(new u(this.context, n, e, !0)));
|
|
87
|
-
e.stopPropagation();
|
|
88
|
-
}, this.host = e, t.context === void 0 ? this.context = t : this.context = t.context, this.attachListeners(), this.host.addController?.(this);
|
|
89
|
-
}
|
|
90
|
-
attachListeners() {
|
|
91
|
-
this.host.addEventListener("context-request", this.onContextRequest), this.host.addEventListener("context-provider", this.onProviderRequest);
|
|
92
|
-
}
|
|
93
|
-
hostConnected() {
|
|
94
|
-
this.host.dispatchEvent(new m(this.context, this.host));
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
//#endregion
|
|
98
|
-
//#region node_modules/@lit/context/lib/decorators/provide.js
|
|
99
|
-
function g({ context: e }) {
|
|
100
|
-
return (t, n) => {
|
|
101
|
-
let r = /* @__PURE__ */ new WeakMap();
|
|
102
|
-
if (typeof n == "object") return {
|
|
103
|
-
get() {
|
|
104
|
-
return t.get.call(this);
|
|
105
|
-
},
|
|
106
|
-
set(e) {
|
|
107
|
-
return r.get(this).setValue(e), t.set.call(this, e);
|
|
108
|
-
},
|
|
109
|
-
init(t) {
|
|
110
|
-
return r.set(this, new h(this, {
|
|
111
|
-
context: e,
|
|
112
|
-
initialValue: t
|
|
113
|
-
})), t;
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
{
|
|
117
|
-
t.constructor.addInitializer(((t) => {
|
|
118
|
-
r.set(t, new h(t, { context: e }));
|
|
119
|
-
}));
|
|
120
|
-
let i = Object.getOwnPropertyDescriptor(t, n), a;
|
|
121
|
-
if (i === void 0) {
|
|
122
|
-
let e = /* @__PURE__ */ new WeakMap();
|
|
123
|
-
a = {
|
|
124
|
-
get() {
|
|
125
|
-
return e.get(this);
|
|
126
|
-
},
|
|
127
|
-
set(t) {
|
|
128
|
-
r.get(this).setValue(t), e.set(this, t);
|
|
129
|
-
},
|
|
130
|
-
configurable: !0,
|
|
131
|
-
enumerable: !0
|
|
132
|
-
};
|
|
133
|
-
} else {
|
|
134
|
-
let e = i.set;
|
|
135
|
-
a = {
|
|
136
|
-
...i,
|
|
137
|
-
set(t) {
|
|
138
|
-
r.get(this).setValue(t), e?.call(this, t);
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
Object.defineProperty(t, n, a);
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
//#endregion
|
|
148
|
-
//#region node_modules/@lit/context/lib/decorators/consume.js
|
|
149
|
-
function _({ context: e, subscribe: t }) {
|
|
150
|
-
return (n, r) => {
|
|
151
|
-
typeof r == "object" ? r.addInitializer((function() {
|
|
152
|
-
new f(this, {
|
|
153
|
-
context: e,
|
|
154
|
-
callback: (e) => {
|
|
155
|
-
n.set.call(this, e);
|
|
156
|
-
},
|
|
157
|
-
subscribe: t
|
|
158
|
-
});
|
|
159
|
-
})) : n.constructor.addInitializer(((n) => {
|
|
160
|
-
new f(n, {
|
|
161
|
-
context: e,
|
|
162
|
-
callback: (e) => {
|
|
163
|
-
n[r] = e;
|
|
164
|
-
},
|
|
165
|
-
subscribe: t
|
|
166
|
-
});
|
|
167
|
-
}));
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
//#endregion
|
|
171
|
-
//#region src/components/tabs/tabs-context.ts
|
|
172
|
-
var v = d(Symbol("pkt-tabs-context")), y = class extends o {
|
|
173
|
-
constructor(...e) {
|
|
174
|
-
super(...e), this.arrowNav = !0, this.disableArrowNav = !1, this.separatorIconName = "", this.separatorIconPath = "", this.tabRefs = [], this.disabledMap = {}, this.tabCount = 0, this.context = {
|
|
175
|
-
useArrowNav: this.useArrowNav,
|
|
176
|
-
registerTab: this.registerTab.bind(this),
|
|
177
|
-
handleClick: this.handleClick.bind(this),
|
|
178
|
-
handleKeyUp: this.handleKeyUp.bind(this)
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
get useArrowNav() {
|
|
182
|
-
return this.arrowNav && !this.disableArrowNav;
|
|
183
|
-
}
|
|
184
|
-
updated(e) {
|
|
185
|
-
(e.has("arrowNav") || e.has("disableArrowNav")) && (this.context = {
|
|
186
|
-
...this.context,
|
|
187
|
-
useArrowNav: this.useArrowNav
|
|
188
|
-
}), this.updateComplete.then(() => this.syncSeparators());
|
|
189
|
-
}
|
|
190
|
-
syncSeparators() {
|
|
191
|
-
let e = this.querySelector(".pkt-tabs__list");
|
|
192
|
-
if (!e || (e.querySelectorAll(".pkt-tabs__separator").forEach((e) => e.remove()), !(this.separatorIconName || this.separatorIconPath))) return;
|
|
193
|
-
let t = Array.from(e.children).filter((e) => !e.classList.contains("pkt-tabs__separator"));
|
|
194
|
-
for (let e = 0; e < t.length - 1; e++) {
|
|
195
|
-
let n = document.createElement("span");
|
|
196
|
-
if (n.className = "pkt-tabs__separator", n.setAttribute("aria-hidden", "true"), n.setAttribute("role", "presentation"), this.separatorIconPath) {
|
|
197
|
-
let e = document.createElement("img");
|
|
198
|
-
e.setAttribute("src", this.separatorIconPath), e.setAttribute("alt", ""), e.setAttribute("aria-hidden", "true"), n.appendChild(e);
|
|
199
|
-
} else if (this.separatorIconName) {
|
|
200
|
-
let e = document.createElement("pkt-icon");
|
|
201
|
-
e.setAttribute("name", this.separatorIconName), e.classList.add("pkt-tabs__separator-icon"), n.appendChild(e);
|
|
202
|
-
}
|
|
203
|
-
t[e].after(n);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
registerTab(e, t, n = !1) {
|
|
207
|
-
this.tabRefs[t] = e, this.disabledMap[t] = n, this.tabCount = Math.max(this.tabCount, t + 1);
|
|
208
|
-
}
|
|
209
|
-
isTabDisabled(e) {
|
|
210
|
-
return !!this.disabledMap[e];
|
|
211
|
-
}
|
|
212
|
-
findEnabledIndex(e, t) {
|
|
213
|
-
let n = e + t;
|
|
214
|
-
for (; n >= 0 && n < this.tabCount;) {
|
|
215
|
-
if (!this.isTabDisabled(n)) return n;
|
|
216
|
-
n += t;
|
|
217
|
-
}
|
|
218
|
-
return null;
|
|
219
|
-
}
|
|
220
|
-
handleClick(e) {
|
|
221
|
-
this.isTabDisabled(e) || this.dispatchEvent(new CustomEvent("tab-selected", {
|
|
222
|
-
detail: { index: e },
|
|
223
|
-
bubbles: !0,
|
|
224
|
-
composed: !0
|
|
225
|
-
}));
|
|
226
|
-
}
|
|
227
|
-
handleKeyUp(e, t) {
|
|
228
|
-
if (this.useArrowNav) {
|
|
229
|
-
if (e.key === "ArrowLeft") {
|
|
230
|
-
e.preventDefault();
|
|
231
|
-
let n = this.findEnabledIndex(t, -1);
|
|
232
|
-
n !== null && this.tabRefs[n]?.focus();
|
|
233
|
-
}
|
|
234
|
-
if (e.key === "ArrowRight") {
|
|
235
|
-
e.preventDefault();
|
|
236
|
-
let n = this.findEnabledIndex(t, 1);
|
|
237
|
-
n !== null && this.tabRefs[n]?.focus();
|
|
238
|
-
}
|
|
239
|
-
(e.key === "Enter" || e.key === " " || e.key === "Spacebar" || e.key === "ArrowDown") && (e.preventDefault(), this.handleClick(t));
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
render() {
|
|
243
|
-
let e = this.useArrowNav ? "tablist" : "navigation";
|
|
244
|
-
return r`
|
|
245
|
-
<div class=${this.separatorIconName || this.separatorIconPath ? "pkt-tabs pkt-tabs--with-separator" : "pkt-tabs"}>
|
|
246
|
-
<div class="pkt-tabs__list" role=${e}>${a(this)}</div>
|
|
247
|
-
</div>
|
|
248
|
-
`;
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
t([n({
|
|
252
|
-
type: Boolean,
|
|
253
|
-
reflect: !0,
|
|
254
|
-
attribute: "arrow-nav"
|
|
255
|
-
})], y.prototype, "arrowNav", void 0), t([n({
|
|
256
|
-
type: Boolean,
|
|
257
|
-
reflect: !0,
|
|
258
|
-
attribute: "disable-arrow-nav"
|
|
259
|
-
})], y.prototype, "disableArrowNav", void 0), t([n({
|
|
260
|
-
type: String,
|
|
261
|
-
reflect: !0,
|
|
262
|
-
attribute: "separator-icon-name"
|
|
263
|
-
})], y.prototype, "separatorIconName", void 0), t([n({
|
|
264
|
-
type: String,
|
|
265
|
-
reflect: !0,
|
|
266
|
-
attribute: "separator-icon-path"
|
|
267
|
-
})], y.prototype, "separatorIconPath", void 0), t([e()], y.prototype, "tabRefs", void 0), t([e()], y.prototype, "disabledMap", void 0), t([e()], y.prototype, "tabCount", void 0), t([g({ context: v }), e()], y.prototype, "context", void 0);
|
|
268
|
-
try {
|
|
269
|
-
i("pkt-tabs")(y);
|
|
270
|
-
} catch {
|
|
271
|
-
console.warn("Forsøker å definere <pkt-tabs>, men den er allerede definert");
|
|
272
|
-
}
|
|
273
|
-
//#endregion
|
|
274
|
-
//#region src/components/tabs/tabitem.ts
|
|
275
|
-
var b = class extends o {
|
|
276
|
-
constructor() {
|
|
277
|
-
super(), this.active = !1, this.disabled = !1, this.href = "", this.icon = "", this.controls = "", this.tag = "", this.tagSkin = "blue", this.index = 0, this.elementRef = l();
|
|
278
|
-
}
|
|
279
|
-
connectedCallback() {
|
|
280
|
-
super.connectedCallback(), this.updateComplete.then(() => {
|
|
281
|
-
this.elementRef.value && this.context && this.context.registerTab(this.elementRef.value, this.index, this.disabled);
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
updated() {
|
|
285
|
-
this.elementRef.value && this.context && this.context.registerTab(this.elementRef.value, this.index, this.disabled);
|
|
286
|
-
}
|
|
287
|
-
handleClick(e) {
|
|
288
|
-
if (this.disabled) {
|
|
289
|
-
e.preventDefault(), e.stopPropagation();
|
|
290
|
-
return;
|
|
291
|
-
}
|
|
292
|
-
this.context && this.context.handleClick(this.index);
|
|
293
|
-
}
|
|
294
|
-
handleKeyDown(e) {
|
|
295
|
-
if (this.disabled && (e.key === "Enter" || e.key === " " || e.key === "Spacebar")) {
|
|
296
|
-
e.preventDefault(), e.stopPropagation();
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
this.context && this.context.handleKeyUp(e, this.index);
|
|
300
|
-
}
|
|
301
|
-
render() {
|
|
302
|
-
let e = this.context?.useArrowNav ?? !0, t = this.active && !this.disabled, n = [t ? "active" : "", this.disabled ? "pkt-tabs__item--disabled" : ""].filter(Boolean).join(" "), i = e ? "tab" : void 0, o = e ? t : void 0, l = this.disabled ? -1 : t || !e ? void 0 : -1, u = `pkt-icon--small ${this.icon === "check" ? "pkt-tabs__status-icon" : ""}`, d = r`
|
|
303
|
-
${this.icon ? r`<pkt-icon name=${this.icon} class=${u}></pkt-icon>` : ""}
|
|
304
|
-
<span>${a(this)}</span>
|
|
305
|
-
${this.tag ? r`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>` : ""}
|
|
306
|
-
`;
|
|
307
|
-
return this.href ? r`
|
|
308
|
-
<a
|
|
309
|
-
${c(this.elementRef)}
|
|
310
|
-
href=${s(this.disabled ? void 0 : this.href)}
|
|
311
|
-
class="pkt-tabs__link ${n}"
|
|
312
|
-
role=${s(i)}
|
|
313
|
-
aria-selected=${s(o)}
|
|
314
|
-
aria-disabled=${s(this.disabled ? "true" : void 0)}
|
|
315
|
-
aria-controls=${s(this.controls || void 0)}
|
|
316
|
-
tabindex=${s(l)}
|
|
317
|
-
@click=${this.handleClick}
|
|
318
|
-
@keydown=${this.handleKeyDown}
|
|
319
|
-
>
|
|
320
|
-
${d}
|
|
321
|
-
</a>
|
|
322
|
-
` : r`
|
|
323
|
-
<button
|
|
324
|
-
${c(this.elementRef)}
|
|
325
|
-
type="button"
|
|
326
|
-
class="pkt-tabs__button pkt-link-button ${n}"
|
|
327
|
-
?disabled=${this.disabled}
|
|
328
|
-
aria-disabled=${s(this.disabled ? "true" : void 0)}
|
|
329
|
-
role=${s(i)}
|
|
330
|
-
aria-selected=${s(o)}
|
|
331
|
-
aria-controls=${s(this.controls || void 0)}
|
|
332
|
-
tabindex=${s(l)}
|
|
333
|
-
@click=${this.handleClick}
|
|
334
|
-
@keydown=${this.handleKeyDown}
|
|
335
|
-
>
|
|
336
|
-
${d}
|
|
337
|
-
</button>
|
|
338
|
-
`;
|
|
339
|
-
}
|
|
340
|
-
};
|
|
341
|
-
t([n({
|
|
342
|
-
type: Boolean,
|
|
343
|
-
reflect: !0
|
|
344
|
-
})], b.prototype, "active", void 0), t([n({
|
|
345
|
-
type: Boolean,
|
|
346
|
-
reflect: !0
|
|
347
|
-
})], b.prototype, "disabled", void 0), t([n({
|
|
348
|
-
type: String,
|
|
349
|
-
reflect: !0
|
|
350
|
-
})], b.prototype, "href", void 0), t([n({
|
|
351
|
-
type: String,
|
|
352
|
-
reflect: !0
|
|
353
|
-
})], b.prototype, "icon", void 0), t([n({
|
|
354
|
-
type: String,
|
|
355
|
-
reflect: !0
|
|
356
|
-
})], b.prototype, "controls", void 0), t([n({
|
|
357
|
-
type: String,
|
|
358
|
-
reflect: !0
|
|
359
|
-
})], b.prototype, "tag", void 0), t([n({
|
|
360
|
-
type: String,
|
|
361
|
-
reflect: !0,
|
|
362
|
-
attribute: "tag-skin"
|
|
363
|
-
})], b.prototype, "tagSkin", void 0), t([n({
|
|
364
|
-
type: Number,
|
|
365
|
-
reflect: !0
|
|
366
|
-
})], b.prototype, "index", void 0), t([_({
|
|
367
|
-
context: v,
|
|
368
|
-
subscribe: !0
|
|
369
|
-
}), n({ attribute: !1 })], b.prototype, "context", void 0);
|
|
370
|
-
try {
|
|
371
|
-
i("pkt-tab-item")(b);
|
|
372
|
-
} catch {
|
|
373
|
-
console.warn("Forsøker å definere <pkt-tab-item>, men den er allerede definert");
|
|
374
|
-
}
|
|
375
|
-
//#endregion
|
|
376
|
-
//#region src/components/tabs/index.ts
|
|
377
|
-
var x = y;
|
|
378
|
-
//#endregion
|
|
379
|
-
export { b as n, y as r, x as t };
|
|
File without changes
|