@oslokommune/punkt-elements 16.7.3 → 16.7.7
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-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,124 @@
|
|
|
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 } from "./element-with-slot-4J2o3SeU.js";
|
|
4
|
+
import "./icon-Co72KtgF.js";
|
|
5
|
+
import { t as c } from "./if-defined-Cjj8qN-Z.js";
|
|
6
|
+
import { n as l, t as u } from "./ref-RS8Uv6uC.js";
|
|
7
|
+
import { t as d } from "./input-element-Bw1s6NlF.js";
|
|
8
|
+
import "./input-wrapper-YfTmpSSY.js";
|
|
9
|
+
//#region src/components/textinput/textinput.ts
|
|
10
|
+
var f = class extends d {
|
|
11
|
+
constructor(...e) {
|
|
12
|
+
super(...e), this.inputRef = u(), this.value = "", this.type = "text", this.size = null, this.autocomplete = null, this.iconNameRight = null, this.prefix = null, this.suffix = null, this.omitSearchIcon = !1, this.counterCurrent = 0;
|
|
13
|
+
}
|
|
14
|
+
attributeChangedCallback(e, t, n) {
|
|
15
|
+
e === "value" && this.value !== t && (this.counterCurrent = n ? n.length : 0, this.valueChanged(n, t)), super.attributeChangedCallback(e, t, n);
|
|
16
|
+
}
|
|
17
|
+
updated(e) {
|
|
18
|
+
super.updated(e), e.has("value") && (this.counterCurrent = this.value?.length || 0, this.valueChanged(this.value, e.get("value"))), e.has("id") && !this.name && this.id && (this.name = this.id);
|
|
19
|
+
}
|
|
20
|
+
render() {
|
|
21
|
+
let e = this.type === "search" && !this.iconNameRight && !this.omitSearchIcon, r = o({
|
|
22
|
+
"pkt-input": !0,
|
|
23
|
+
"pkt-input--fullwidth": this.fullwidth,
|
|
24
|
+
"pkt-input--counter-error": this.counter && this.counterMaxLength && this.value.length && this.value.length > this.counterMaxLength
|
|
25
|
+
}), i = this.ariaLabelledby || `${this.id}-input-label`;
|
|
26
|
+
return t`
|
|
27
|
+
<pkt-input-wrapper
|
|
28
|
+
label="${this.label}"
|
|
29
|
+
?counter=${this.counter}
|
|
30
|
+
?disabled=${this.disabled}
|
|
31
|
+
?hasError=${this.hasError}
|
|
32
|
+
?hasFieldset=${this.hasFieldset}
|
|
33
|
+
?inline=${this.inline}
|
|
34
|
+
?optionalTag=${this.optionalTag}
|
|
35
|
+
?required=${this.required}
|
|
36
|
+
?requiredTag=${this.requiredTag}
|
|
37
|
+
useWrapper=${this.useWrapper}
|
|
38
|
+
.ariaDescribedBy=${this.ariaDescribedBy}
|
|
39
|
+
.counterCurrent=${this.counterCurrent}
|
|
40
|
+
.counterMaxLength=${this.counterMaxLength}
|
|
41
|
+
.errorMessage=${this.errorMessage}
|
|
42
|
+
.forId="${this.id + "-input"}"
|
|
43
|
+
.helptext=${this.helptext}
|
|
44
|
+
.helptextDropdown=${this.helptextDropdown}
|
|
45
|
+
.helptextDropdownButton=${this.helptextDropdownButton}
|
|
46
|
+
.optionalText=${this.optionalText}
|
|
47
|
+
.requiredText=${this.requiredText}
|
|
48
|
+
.tagText=${this.tagText}
|
|
49
|
+
class="pkt-textinput"
|
|
50
|
+
>
|
|
51
|
+
<div class="pkt-contents" slot="helptext">${s(this, "helptext")}</div>
|
|
52
|
+
<div class="pkt-input__container">
|
|
53
|
+
${this.prefix ? t`<div class="pkt-input-prefix">${this.prefix}</div>` : n}
|
|
54
|
+
<input
|
|
55
|
+
${l(this.inputRef)}
|
|
56
|
+
class=${r}
|
|
57
|
+
type=${this.type}
|
|
58
|
+
name=${(this.name || this.id) + "-input"}
|
|
59
|
+
id=${this.id + "-input"}
|
|
60
|
+
placeholder=${c(this.placeholder)}
|
|
61
|
+
aria-labelledby=${i}
|
|
62
|
+
autocomplete=${this.autocomplete || "off"}
|
|
63
|
+
minlength=${c(this.minlength || void 0)}
|
|
64
|
+
maxlength=${c(this.maxlength || void 0)}
|
|
65
|
+
min=${c(this.min || void 0)}
|
|
66
|
+
max=${c(this.max || void 0)}
|
|
67
|
+
step=${c(this.step || void 0)}
|
|
68
|
+
?readonly=${this.readonly}
|
|
69
|
+
size=${this.size || n}
|
|
70
|
+
.value=${this.value}
|
|
71
|
+
?disabled=${this.disabled}
|
|
72
|
+
aria-invalid=${this.hasError}
|
|
73
|
+
aria-errormessage=${`${this.id}-error`}
|
|
74
|
+
@input=${(e) => {
|
|
75
|
+
this.value = e.target.value, this.onInput(), e.stopImmediatePropagation();
|
|
76
|
+
}}
|
|
77
|
+
@change=${(e) => {
|
|
78
|
+
e.stopImmediatePropagation();
|
|
79
|
+
}}
|
|
80
|
+
@focus=${(e) => {
|
|
81
|
+
this.onFocus(), e.stopImmediatePropagation();
|
|
82
|
+
}}
|
|
83
|
+
@blur=${(e) => {
|
|
84
|
+
this.value = e.target.value, this.onBlur(), e.stopImmediatePropagation();
|
|
85
|
+
}}
|
|
86
|
+
@keydown=${(e) => {
|
|
87
|
+
if (e.key === "Enter") {
|
|
88
|
+
let e = this.internals.form;
|
|
89
|
+
e ? e.requestSubmit() : this.inputRef.value?.blur();
|
|
90
|
+
}
|
|
91
|
+
}}
|
|
92
|
+
/>
|
|
93
|
+
${this.suffix ? t`<div class="pkt-input-suffix">
|
|
94
|
+
${this.suffix}
|
|
95
|
+
${this.iconNameRight ? t`<pkt-icon
|
|
96
|
+
class="pkt-input-suffix-icon"
|
|
97
|
+
name=${this.iconNameRight}
|
|
98
|
+
></pkt-icon>` : n}
|
|
99
|
+
${e ? t`<pkt-icon
|
|
100
|
+
class="pkt-input-suffix-icon"
|
|
101
|
+
name="magnifying-glass-big"
|
|
102
|
+
></pkt-icon>` : n}
|
|
103
|
+
</div>` : n}
|
|
104
|
+
${!this.suffix && this.iconNameRight ? t`<pkt-icon class="pkt-input-icon" name=${this.iconNameRight}></pkt-icon>` : n}
|
|
105
|
+
${!this.suffix && e ? t`<pkt-icon class="pkt-input-icon" name="magnifying-glass-big"></pkt-icon>` : n}
|
|
106
|
+
</div>
|
|
107
|
+
</pkt-input-wrapper>
|
|
108
|
+
`;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
i([a({
|
|
112
|
+
type: String,
|
|
113
|
+
reflect: !0
|
|
114
|
+
})], f.prototype, "value", void 0), i([a({ type: String })], f.prototype, "type", void 0), i([a({ type: Number })], f.prototype, "size", void 0), i([a({ type: String })], f.prototype, "autocomplete", void 0), i([a({ type: String })], f.prototype, "iconNameRight", void 0), i([a({ type: String })], f.prototype, "prefix", void 0), i([a({ type: String })], f.prototype, "suffix", void 0), i([a({ type: Boolean })], f.prototype, "omitSearchIcon", void 0), i([r()], f.prototype, "counterCurrent", void 0);
|
|
115
|
+
try {
|
|
116
|
+
e("pkt-textinput")(f);
|
|
117
|
+
} catch {
|
|
118
|
+
console.warn("Forsøker å definere <pkt-textinput>, men den er allerede definert");
|
|
119
|
+
}
|
|
120
|
+
//#endregion
|
|
121
|
+
//#region src/components/textinput/index.ts
|
|
122
|
+
var p = f;
|
|
123
|
+
//#endregion
|
|
124
|
+
export { f as n, p as t };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const e=require(`./element-DjtxO-1r.cjs`),t=require(`./class-map-CJ-msbHs.cjs`),n=require(`./element-with-slot-CWoTGA1B.cjs`);require(`./icon-Dr8sfT2X.cjs`);const r=require(`./if-defined-XKOD_t_V.cjs`),i=require(`./ref-BaJ0mBT_.cjs`),a=require(`./input-element-B1yxcfz4.cjs`);require(`./input-wrapper-BRuVELpK.cjs`);var o=class extends a.t{constructor(...e){super(...e),this.inputRef=i.t(),this.value=``,this.type=`text`,this.size=null,this.autocomplete=null,this.iconNameRight=null,this.prefix=null,this.suffix=null,this.omitSearchIcon=!1,this.counterCurrent=0}attributeChangedCallback(e,t,n){e===`value`&&this.value!==t&&(this.counterCurrent=n?n.length:0,this.valueChanged(n,t)),super.attributeChangedCallback(e,t,n)}updated(e){super.updated(e),e.has(`value`)&&(this.counterCurrent=this.value?.length||0,this.valueChanged(this.value,e.get(`value`))),e.has(`id`)&&!this.name&&this.id&&(this.name=this.id)}render(){let a=this.type===`search`&&!this.iconNameRight&&!this.omitSearchIcon,o=t.t({"pkt-input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":this.counter&&this.counterMaxLength&&this.value.length&&this.value.length>this.counterMaxLength}),s=this.ariaLabelledby||`${this.id}-input-label`;return e.d`
|
|
2
|
+
<pkt-input-wrapper
|
|
3
|
+
label="${this.label}"
|
|
4
|
+
?counter=${this.counter}
|
|
5
|
+
?disabled=${this.disabled}
|
|
6
|
+
?hasError=${this.hasError}
|
|
7
|
+
?hasFieldset=${this.hasFieldset}
|
|
8
|
+
?inline=${this.inline}
|
|
9
|
+
?optionalTag=${this.optionalTag}
|
|
10
|
+
?required=${this.required}
|
|
11
|
+
?requiredTag=${this.requiredTag}
|
|
12
|
+
useWrapper=${this.useWrapper}
|
|
13
|
+
.ariaDescribedBy=${this.ariaDescribedBy}
|
|
14
|
+
.counterCurrent=${this.counterCurrent}
|
|
15
|
+
.counterMaxLength=${this.counterMaxLength}
|
|
16
|
+
.errorMessage=${this.errorMessage}
|
|
17
|
+
.forId="${this.id+`-input`}"
|
|
18
|
+
.helptext=${this.helptext}
|
|
19
|
+
.helptextDropdown=${this.helptextDropdown}
|
|
20
|
+
.helptextDropdownButton=${this.helptextDropdownButton}
|
|
21
|
+
.optionalText=${this.optionalText}
|
|
22
|
+
.requiredText=${this.requiredText}
|
|
23
|
+
.tagText=${this.tagText}
|
|
24
|
+
class="pkt-textinput"
|
|
25
|
+
>
|
|
26
|
+
<div class="pkt-contents" slot="helptext">${n.n(this,`helptext`)}</div>
|
|
27
|
+
<div class="pkt-input__container">
|
|
28
|
+
${this.prefix?e.d`<div class="pkt-input-prefix">${this.prefix}</div>`:e.l}
|
|
29
|
+
<input
|
|
30
|
+
${i.n(this.inputRef)}
|
|
31
|
+
class=${o}
|
|
32
|
+
type=${this.type}
|
|
33
|
+
name=${(this.name||this.id)+`-input`}
|
|
34
|
+
id=${this.id+`-input`}
|
|
35
|
+
placeholder=${r.t(this.placeholder)}
|
|
36
|
+
aria-labelledby=${s}
|
|
37
|
+
autocomplete=${this.autocomplete||`off`}
|
|
38
|
+
minlength=${r.t(this.minlength||void 0)}
|
|
39
|
+
maxlength=${r.t(this.maxlength||void 0)}
|
|
40
|
+
min=${r.t(this.min||void 0)}
|
|
41
|
+
max=${r.t(this.max||void 0)}
|
|
42
|
+
step=${r.t(this.step||void 0)}
|
|
43
|
+
?readonly=${this.readonly}
|
|
44
|
+
size=${this.size||e.l}
|
|
45
|
+
.value=${this.value}
|
|
46
|
+
?disabled=${this.disabled}
|
|
47
|
+
aria-invalid=${this.hasError}
|
|
48
|
+
aria-errormessage=${`${this.id}-error`}
|
|
49
|
+
@input=${e=>{this.value=e.target.value,this.onInput(),e.stopImmediatePropagation()}}
|
|
50
|
+
@change=${e=>{e.stopImmediatePropagation()}}
|
|
51
|
+
@focus=${e=>{this.onFocus(),e.stopImmediatePropagation()}}
|
|
52
|
+
@blur=${e=>{this.value=e.target.value,this.onBlur(),e.stopImmediatePropagation()}}
|
|
53
|
+
@keydown=${e=>{if(e.key===`Enter`){let e=this.internals.form;e?e.requestSubmit():this.inputRef.value?.blur()}}}
|
|
54
|
+
/>
|
|
55
|
+
${this.suffix?e.d`<div class="pkt-input-suffix">
|
|
56
|
+
${this.suffix}
|
|
57
|
+
${this.iconNameRight?e.d`<pkt-icon
|
|
58
|
+
class="pkt-input-suffix-icon"
|
|
59
|
+
name=${this.iconNameRight}
|
|
60
|
+
></pkt-icon>`:e.l}
|
|
61
|
+
${a?e.d`<pkt-icon
|
|
62
|
+
class="pkt-input-suffix-icon"
|
|
63
|
+
name="magnifying-glass-big"
|
|
64
|
+
></pkt-icon>`:e.l}
|
|
65
|
+
</div>`:e.l}
|
|
66
|
+
${!this.suffix&&this.iconNameRight?e.d`<pkt-icon class="pkt-input-icon" name=${this.iconNameRight}></pkt-icon>`:e.l}
|
|
67
|
+
${!this.suffix&&a?e.d`<pkt-icon class="pkt-input-icon" name="magnifying-glass-big"></pkt-icon>`:e.l}
|
|
68
|
+
</div>
|
|
69
|
+
</pkt-input-wrapper>
|
|
70
|
+
`}};e.r([e.s({type:String,reflect:!0})],o.prototype,`value`,void 0),e.r([e.s({type:String})],o.prototype,`type`,void 0),e.r([e.s({type:Number})],o.prototype,`size`,void 0),e.r([e.s({type:String})],o.prototype,`autocomplete`,void 0),e.r([e.s({type:String})],o.prototype,`iconNameRight`,void 0),e.r([e.s({type:String})],o.prototype,`prefix`,void 0),e.r([e.s({type:String})],o.prototype,`suffix`,void 0),e.r([e.s({type:Boolean})],o.prototype,`omitSearchIcon`,void 0),e.r([e.o()],o.prototype,`counterCurrent`,void 0);try{e.c(`pkt-textinput`)(o)}catch{console.warn(`Forsøker å definere <pkt-textinput>, 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,191 @@
|
|
|
1
|
+
const e=require(`./element-DjtxO-1r.cjs`),t=require(`./class-map-CJ-msbHs.cjs`),n=require(`./element-with-slot-CWoTGA1B.cjs`);require(`./icon-Dr8sfT2X.cjs`);const r=require(`./if-defined-XKOD_t_V.cjs`),i=require(`./ref-BaJ0mBT_.cjs`),a=require(`./input-element-B1yxcfz4.cjs`);require(`./input-wrapper-BRuVELpK.cjs`);var o=e=>/^\d{2}:\d{2}$/.test(e)&&parseInt(e.slice(0,2),10)<=23&&parseInt(e.slice(3),10)<=59,s=e=>{let[t,n]=e.split(`:`).map(Number);return t*60+n},c=e=>e?Math.max(1,Math.round(e/60)):1,l=(e,t)=>{let n=e?parseInt(String(e).split(`:`)[0],10):0,r=t?parseInt(String(t).split(`:`)[0],10):23;return Array.from({length:r-n+1},(e,t)=>t+n)},u=e=>{let t=c(e);return Array.from({length:Math.floor(60/t)},(e,n)=>n*t)},d=(e,t,n,r)=>{let i=e===``?n===1?0:23:parseInt(e,10),a=t===``?n===1?0:Math.floor(59/r)*r:parseInt(t,10);return a+=n*r,a>59?(a=0,i=(i+1)%24):a<0&&(a=Math.floor(59/r)*r,i=(i-1+24)%24),{hours:String(i).padStart(2,`0`),minutes:String(a).padStart(2,`0`)}},f=class extends a.t{constructor(...e){super(...e),this.hiddenInputRef=i.t(),this.hoursInputRef=i.t(),this.minutesInputRef=i.t(),this.buttonRef=i.t(),this.value=``,this.hidePicker=!1,this.stepArrows=!1,this._hours=``,this._minutes=``,this._isOpen=!1,this._hoursDigitCount=0,this._hoursFirstDigit=-1,this._minutesDigitCount=0,this._minutesFirstDigit=-1,this._hasFocus=!1,this._outsideClickHandler=e=>{this.contains(e.target)||this._closePopup()},this._handleComponentFocusIn=()=>{this._hasFocus||(this._hasFocus=!0,this.onFocus())},this._handleComponentFocusOut=e=>{this.contains(e.relatedTarget)||(this._hasFocus=!1,this.onBlur())},this._handleHoursKeydown=e=>{let t=e.target;switch(e.key){case`ArrowUp`:{e.preventDefault();let t=this._hours===``?0:parseInt(this._hours,10);this._hours=String((t+1)%24).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowDown`:{e.preventDefault();let t=this._hours===``?0:parseInt(this._hours,10);this._hours=String((t-1+24)%24).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowRight`:e.preventDefault(),this.minutesInputRef.value?.focus();break;case`Backspace`:case`Delete`:this._hoursDigitCount=0,this._hoursFirstDigit=-1;break;case`Tab`:break;case`Enter`:{e.preventDefault();let n=this.internals.form;n?n.requestSubmit():t.blur();break}default:if(/^\d$/.test(e.key)){e.preventDefault();let t=parseInt(e.key,10);if(this._hoursDigitCount===0)this._hoursFirstDigit=t,this._hours=String(t).padStart(2,`0`),this._hoursDigitCount=1,this.onInput(),t>=3&&(this._hoursFirstDigit=-1,this._hoursDigitCount=0,this._syncValueFromDisplay(),this.minutesInputRef.value?.focus());else{let e=this._hoursFirstDigit*10+t;this._hours=e<=23?String(e).padStart(2,`0`):String(t).padStart(2,`0`),this._hoursFirstDigit=-1,this._hoursDigitCount=0,this._syncValueFromDisplay(),this.onInput(),this.minutesInputRef.value?.focus()}}else e.preventDefault()}},this._handleHoursBlur=()=>{this._hours!==``&&(this._hours=String(parseInt(this._hours,10)).padStart(2,`0`)),this._hoursDigitCount=0,this._hoursFirstDigit=-1,this._syncValueFromDisplay()},this._handleMinutesKeydown=e=>{let t=e.target;switch(e.key){case`ArrowUp`:{e.preventDefault();let t=this._minutes===``?0:parseInt(this._minutes,10);this._minutes=String((t+this._minuteStep)%60).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowDown`:{e.preventDefault();let t=this._minutes===``?0:parseInt(this._minutes,10);this._minutes=String((t-this._minuteStep+60)%60).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowLeft`:e.preventDefault(),this.hoursInputRef.value?.focus();break;case`Backspace`:case`Delete`:this._minutesDigitCount=0,this._minutesFirstDigit=-1;break;case`Tab`:break;case`Enter`:{e.preventDefault();let n=this.internals.form;n?n.requestSubmit():t.blur();break}default:if(/^\d$/.test(e.key)){e.preventDefault();let t=parseInt(e.key,10);if(this._minutesDigitCount===0)this._minutesFirstDigit=t,this._minutes=String(t).padStart(2,`0`),this._minutesDigitCount=1,this.onInput(),t>=6&&(this._minutesFirstDigit=-1,this._minutesDigitCount=0,this._syncValueFromDisplay());else{let e=this._minutesFirstDigit*10+t;this._minutes=e<=59?String(e).padStart(2,`0`):String(t).padStart(2,`0`),this._minutesFirstDigit=-1,this._minutesDigitCount=0,this._syncValueFromDisplay(),this.onInput()}}else e.preventDefault()}},this._handleMinutesBlur=()=>{this._minutes!==``&&(this._minutes=String(parseInt(this._minutes,10)).padStart(2,`0`)),this._minutesDigitCount=0,this._minutesFirstDigit=-1,this._syncValueFromDisplay()},this._handlePopupKeydown=e=>{let t=document.activeElement,n=t.closest(`.pkt-timepicker-popup__col`);if(!n)return;let r=Array.from(n.querySelectorAll(`.pkt-timepicker-popup__option`)),i=r.indexOf(t),a=t.dataset.type??``;switch(e.key){case`ArrowDown`:e.preventDefault(),this._focusOptionAndSync(r[Math.min(i+1,r.length-1)],a);break;case`ArrowUp`:e.preventDefault(),this._focusOptionAndSync(r[Math.max(i-1,0)],a);break;case`Home`:e.preventDefault(),this._focusOptionAndSync(r[0],a);break;case`End`:e.preventDefault(),this._focusOptionAndSync(r[r.length-1],a);break;case`ArrowRight`:e.preventDefault(),a===`hour`&&(this._focusOptionAndSync(t,a),this.updateComplete.then(()=>{this._scrollToSelected(),this._focusSelectedOrFirst(`minute`)}));break;case`ArrowLeft`:e.preventDefault(),a===`minute`&&(this._focusOptionAndSync(t,a),this.updateComplete.then(()=>{this._scrollToSelected(),this._focusSelectedOrFirst(`hour`)}));break;case`Enter`:case` `:e.preventDefault(),t.click();break;case`Escape`:e.preventDefault(),this._closePopup(),this.buttonRef.value?.focus();break}}}get inputRef(){return this.hiddenInputRef}manageValidity(t){let n=this.hoursInputRef.value;if(!n)return;if(this.required&&!this.value){this.internals.setValidity({valueMissing:!0},e.i.forms.messages.required,n),this._setAriaInvalid(!0);return}if(!this.value){this.internals.setValidity({}),this._setAriaInvalid(!1);return}let r=s(this.value),i=c(this.step);if(this.min&&r<s(String(this.min))){this.internals.setValidity({rangeUnderflow:!0},e.i.forms.messages.rangeUnderflowMin.replace(`{min}`,String(this.min)),n),this._setAriaInvalid(!0);return}if(this.max&&r>s(String(this.max))){this.internals.setValidity({rangeOverflow:!0},e.i.forms.messages.rangeOverflowMax.replace(`{max}`,String(this.max)),n),this._setAriaInvalid(!0);return}if(this.step&&r%i!==0){let t=i===60?e.i.forms.messages.timeStepMismatchHour:i===30?e.i.forms.messages.timeStepMismatchHalfHour:e.i.forms.messages.timeStepMismatch.replace(`{step}`,`${i}, ${i*2}, ${i*3}`);this.internals.setValidity({stepMismatch:!0},t,n),this._setAriaInvalid(!0);return}this.internals.setValidity({}),this._setAriaInvalid(!1)}_setAriaInvalid(e){if(!this.touched&&e)return;let t=this.hoursInputRef.value,n=this.minutesInputRef.value;e?(t?.setAttribute(`aria-invalid`,`true`),n?.setAttribute(`aria-invalid`,`true`)):(t?.removeAttribute(`aria-invalid`),n?.removeAttribute(`aria-invalid`))}connectedCallback(){super.connectedCallback(),this.addEventListener(`focusin`,this._handleComponentFocusIn),this.addEventListener(`focusout`,this._handleComponentFocusOut),document.addEventListener(`click`,this._outsideClickHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`focusin`,this._handleComponentFocusIn),this.removeEventListener(`focusout`,this._handleComponentFocusOut),document.removeEventListener(`click`,this._outsideClickHandler)}willUpdate(e){super.willUpdate(e),e.has(`value`)&&this._syncDisplayFromValue()}updated(e){super.updated(e),this.classList.toggle(`pkt-timepicker--stepper`,this.stepArrows),this.classList.toggle(`pkt-timepicker--fullwidth`,this.fullwidth),e.has(`step`)&&this.step!==null&&!this._isValidStep(this.step)&&console.warn(`pkt-timepicker: step="${this.step}" er ikke en gyldig verdi. Step må være et multiplum av 60 (hele minutter) eller nøyaktig 3600 (hel time).`)}formResetCallback(){super.formResetCallback(),this._hours=``,this._minutes=``,this._isOpen=!1}_isValidStep(e){return e===3600||e<3600&&3600%e==0&&e%60==0}_syncDisplayFromValue(){let e=o(this.value)?this.value.split(`:`):null;e?(this._hours=e[0],this._minutes=e[1]):(this._hours=``,this._minutes=``)}_syncValueFromDisplay(){if(this._hours!==``&&this._minutes!==``){let e=`${this._hours}:${this._minutes}`;e!==this.value&&(this.value=e,this.onChange(e))}else this.value!==``&&(this.value=``,this.onChange(``))}get _minuteStep(){return c(this.step)}get _hourOptions(){return l(this.min,this.max)}get _minuteOptions(){return u(this.step)}_openPopup(){this._isOpen=!0,this.updateComplete.then(()=>{this._scrollToSelected(),this._focusSelectedOrFirst(`hour`)})}_closePopup(){this._isOpen=!1,this._syncValueFromDisplay()}_togglePopup(){this._isOpen?this._closePopup():this._openPopup()}_scrollToSelected(){let e=this.querySelector(`.pkt-timepicker-popup`);e&&e.querySelectorAll(`.pkt-timepicker-popup__col`).forEach(e=>{let t=e.querySelector(`.pkt-timepicker-popup__option--selected`);t&&t.scrollIntoView({block:`center`})})}_focusSelectedOrFirst(e){let t=this.querySelector(`.pkt-timepicker-popup`);if(!t)return;let n=t.querySelectorAll(`.pkt-timepicker-popup__col`),r=e===`hour`?n[0]:n[1];if(!r)return;let i=r.querySelector(`.pkt-timepicker-popup__option--selected`),a=r.querySelector(`.pkt-timepicker-popup__option`);(i||a)?.focus()}_handleOptionClick(e,t){let n=String(e).padStart(2,`0`);t===`hour`?(this._hours=n,this.updateComplete.then(()=>this._focusSelectedOrFirst(`minute`))):(this._minutes=n,this._closePopup(),this.buttonRef.value?.focus())}_focusOptionAndSync(e,t){if(!e)return;let n=parseInt(e.dataset.value??`0`,10);t===`hour`?this._hours=String(n).padStart(2,`0`):this._minutes=String(n).padStart(2,`0`),e.focus()}_stepTime(e){let t=d(this._hours,this._minutes,e,this._minuteStep);this._hours=t.hours,this._minutes=t.minutes,this._syncValueFromDisplay()}_renderOption(n,r){let i=String(n).padStart(2,`0`),a=n===(r===`hour`?this._hours===``?NaN:parseInt(this._hours,10):this._minutes===``?NaN:parseInt(this._minutes,10));return e.d`
|
|
2
|
+
<button
|
|
3
|
+
class=${t.t({"pkt-btn":!0,"pkt-btn--tertiary":!0,"pkt-btn--small":!0,"pkt-btn--label-only":!0,"pkt-timepicker-popup__option":!0,"pkt-timepicker-popup__option--selected":a})}
|
|
4
|
+
type="button"
|
|
5
|
+
role="option"
|
|
6
|
+
aria-selected=${a?`true`:`false`}
|
|
7
|
+
tabindex=${a?`0`:`-1`}
|
|
8
|
+
data-type=${r}
|
|
9
|
+
data-value=${n}
|
|
10
|
+
@click=${e=>{e.stopImmediatePropagation(),this._handleOptionClick(n,r)}}
|
|
11
|
+
>
|
|
12
|
+
<span class="pkt-btn__text pkt-txt-14-light">${i}</span>
|
|
13
|
+
</button>
|
|
14
|
+
`}_renderPopup(){return e.d`
|
|
15
|
+
<div
|
|
16
|
+
class="pkt-timepicker-popup"
|
|
17
|
+
id=${this.id+`-popup`}
|
|
18
|
+
?hidden=${!this._isOpen}
|
|
19
|
+
role="group"
|
|
20
|
+
aria-label=${this.strings.timepicker?.selectTime??`Velg tidspunkt`}
|
|
21
|
+
@keydown=${this._handlePopupKeydown}
|
|
22
|
+
@focusout=${e=>{this.querySelector(`.pkt-timepicker-popup`)?.contains(e.relatedTarget)||this._closePopup()}}
|
|
23
|
+
>
|
|
24
|
+
<div
|
|
25
|
+
class="pkt-timepicker-popup__col"
|
|
26
|
+
role="listbox"
|
|
27
|
+
aria-label=${this.strings.timepicker?.hours??`Timer`}
|
|
28
|
+
aria-orientation="vertical"
|
|
29
|
+
>
|
|
30
|
+
${this._hourOptions.map(e=>this._renderOption(e,`hour`))}
|
|
31
|
+
</div>
|
|
32
|
+
<div
|
|
33
|
+
class="pkt-timepicker-popup__col"
|
|
34
|
+
role="listbox"
|
|
35
|
+
aria-label=${this.strings.timepicker?.minutes??`Minutter`}
|
|
36
|
+
aria-orientation="vertical"
|
|
37
|
+
>
|
|
38
|
+
${this._minuteOptions.map(e=>this._renderOption(e,`minute`))}
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
`}_renderContainer(){let t=this.strings.timepicker?.hours??`Timer`,n=this.strings.timepicker?.minutes??`Minutter`,a=this.label?`${t}, ${this.label}`:t,o=this.label?`${n}, ${this.label}`:n;return e.d`
|
|
42
|
+
<div
|
|
43
|
+
class="pkt-input__container"
|
|
44
|
+
@click=${e=>{e.target.closest(`button, input`)||this.hoursInputRef.value?.focus()}}
|
|
45
|
+
>
|
|
46
|
+
${this.stepArrows?e.d`
|
|
47
|
+
<button
|
|
48
|
+
class="pkt-input-icon pkt-btn pkt-btn--icon-only pkt-btn--tertiary pkt-timepicker__button pkt-timepicker__button--prev"
|
|
49
|
+
type="button"
|
|
50
|
+
aria-label=${this.strings.timepicker?.prevTime??`Forrige tidspunkt`}
|
|
51
|
+
?disabled=${this.disabled}
|
|
52
|
+
@click=${()=>this._stepTime(-1)}
|
|
53
|
+
>
|
|
54
|
+
<pkt-icon name="chevron-thin-left"></pkt-icon>
|
|
55
|
+
<span class="pkt-btn__text"
|
|
56
|
+
>${this.strings.timepicker?.prevTime??`Forrige tidspunkt`}</span
|
|
57
|
+
>
|
|
58
|
+
</button>
|
|
59
|
+
`:e.l}
|
|
60
|
+
<input
|
|
61
|
+
${i.n(this.hoursInputRef)}
|
|
62
|
+
type="text"
|
|
63
|
+
inputmode="numeric"
|
|
64
|
+
maxlength="2"
|
|
65
|
+
size="2"
|
|
66
|
+
class="pkt-input pkt-timepicker__input"
|
|
67
|
+
id=${this.id+`-hours`}
|
|
68
|
+
data-min="0"
|
|
69
|
+
data-max="23"
|
|
70
|
+
.value=${this._hours}
|
|
71
|
+
placeholder="––"
|
|
72
|
+
aria-label=${a}
|
|
73
|
+
role="spinbutton"
|
|
74
|
+
aria-invalid=${this.hasError?`true`:e.l}
|
|
75
|
+
aria-valuemin="0"
|
|
76
|
+
aria-valuemax="23"
|
|
77
|
+
aria-valuenow=${this._hours===``?e.l:this._hours}
|
|
78
|
+
aria-valuetext=${this._hours===``?e.l:`${this._hours} ${t.toLowerCase()}`}
|
|
79
|
+
autocomplete="off"
|
|
80
|
+
?disabled=${this.disabled}
|
|
81
|
+
@keydown=${this._handleHoursKeydown}
|
|
82
|
+
@blur=${this._handleHoursBlur}
|
|
83
|
+
@focus=${e=>{e.target.select(),e.stopImmediatePropagation()}}
|
|
84
|
+
/>
|
|
85
|
+
<span class="pkt-timepicker__separator">:</span>
|
|
86
|
+
<input
|
|
87
|
+
${i.n(this.minutesInputRef)}
|
|
88
|
+
type="text"
|
|
89
|
+
inputmode="numeric"
|
|
90
|
+
maxlength="2"
|
|
91
|
+
size="2"
|
|
92
|
+
class="pkt-input pkt-timepicker__input"
|
|
93
|
+
id=${this.id+`-minutes`}
|
|
94
|
+
data-min="0"
|
|
95
|
+
data-max="59"
|
|
96
|
+
.value=${this._minutes}
|
|
97
|
+
placeholder="––"
|
|
98
|
+
aria-label=${o}
|
|
99
|
+
role="spinbutton"
|
|
100
|
+
aria-invalid=${this.hasError?`true`:e.l}
|
|
101
|
+
aria-valuemin="0"
|
|
102
|
+
aria-valuemax="59"
|
|
103
|
+
aria-valuenow=${this._minutes===``?e.l:this._minutes}
|
|
104
|
+
aria-valuetext=${this._minutes===``?e.l:`${this._minutes} ${n.toLowerCase()}`}
|
|
105
|
+
autocomplete="off"
|
|
106
|
+
?disabled=${this.disabled}
|
|
107
|
+
@keydown=${this._handleMinutesKeydown}
|
|
108
|
+
@blur=${this._handleMinutesBlur}
|
|
109
|
+
@focus=${e=>{e.target.select(),e.stopImmediatePropagation()}}
|
|
110
|
+
/>
|
|
111
|
+
${this.hidePicker&&!this.stepArrows?e.d`<pkt-icon
|
|
112
|
+
class="pkt-input-icon pkt-timepicker__icon"
|
|
113
|
+
name="clock"
|
|
114
|
+
aria-hidden="true"
|
|
115
|
+
></pkt-icon>`:e.l}
|
|
116
|
+
${!this.hidePicker&&!this.stepArrows?e.d`
|
|
117
|
+
<button
|
|
118
|
+
${i.n(this.buttonRef)}
|
|
119
|
+
class="pkt-input-icon pkt-btn pkt-btn--icon-only pkt-btn--tertiary pkt-timepicker__button"
|
|
120
|
+
type="button"
|
|
121
|
+
aria-label=${this.strings.timepicker?.openPicker??`Åpne tidspunkt-velger`}
|
|
122
|
+
aria-haspopup="listbox"
|
|
123
|
+
aria-expanded=${this._isOpen?`true`:`false`}
|
|
124
|
+
aria-controls=${this.id+`-popup`}
|
|
125
|
+
?disabled=${this.disabled}
|
|
126
|
+
@click=${this._togglePopup}
|
|
127
|
+
>
|
|
128
|
+
<pkt-icon name="clock"></pkt-icon>
|
|
129
|
+
<span class="pkt-btn__text"
|
|
130
|
+
>${this.strings.timepicker?.openPicker??`Åpne tidspunkt-velger`}</span
|
|
131
|
+
>
|
|
132
|
+
</button>
|
|
133
|
+
`:e.l}
|
|
134
|
+
${this.stepArrows?e.d`
|
|
135
|
+
<button
|
|
136
|
+
class="pkt-input-icon pkt-btn pkt-btn--icon-only pkt-btn--tertiary pkt-timepicker__button pkt-timepicker__button--next"
|
|
137
|
+
type="button"
|
|
138
|
+
aria-label=${this.strings.timepicker?.nextTime??`Neste tidspunkt`}
|
|
139
|
+
?disabled=${this.disabled}
|
|
140
|
+
@click=${()=>this._stepTime(1)}
|
|
141
|
+
>
|
|
142
|
+
<pkt-icon name="chevron-thin-right"></pkt-icon>
|
|
143
|
+
<span class="pkt-btn__text"
|
|
144
|
+
>${this.strings.timepicker?.nextTime??`Neste tidspunkt`}</span
|
|
145
|
+
>
|
|
146
|
+
</button>
|
|
147
|
+
`:e.l}
|
|
148
|
+
<input
|
|
149
|
+
${i.n(this.hiddenInputRef)}
|
|
150
|
+
type="time"
|
|
151
|
+
hidden
|
|
152
|
+
name=${this.name||this.id}
|
|
153
|
+
id=${this.id+`-input`}
|
|
154
|
+
.value=${this.value}
|
|
155
|
+
min=${r.t(this.min??void 0)}
|
|
156
|
+
max=${r.t(this.max??void 0)}
|
|
157
|
+
step=${r.t(this.step??void 0)}
|
|
158
|
+
?required=${this.required}
|
|
159
|
+
?disabled=${this.disabled}
|
|
160
|
+
tabindex="-1"
|
|
161
|
+
/>
|
|
162
|
+
</div>
|
|
163
|
+
`}render(){return e.d`
|
|
164
|
+
<pkt-input-wrapper
|
|
165
|
+
label="${this.label}"
|
|
166
|
+
?disabled=${this.disabled}
|
|
167
|
+
?fullwidth=${this.fullwidth}
|
|
168
|
+
?hasError=${this.hasError}
|
|
169
|
+
?inline=${this.inline}
|
|
170
|
+
?optionalTag=${this.optionalTag}
|
|
171
|
+
?required=${this.required}
|
|
172
|
+
?requiredTag=${this.requiredTag}
|
|
173
|
+
useWrapper=${this.useWrapper}
|
|
174
|
+
.ariaDescribedBy=${this.ariaDescribedBy}
|
|
175
|
+
.errorMessage=${this.errorMessage}
|
|
176
|
+
.forId="${this.id+`-hours`}"
|
|
177
|
+
.helptext=${this.helptext}
|
|
178
|
+
.helptextDropdown=${this.helptextDropdown}
|
|
179
|
+
.helptextDropdownButton=${this.helptextDropdownButton}
|
|
180
|
+
.optionalText=${this.optionalText}
|
|
181
|
+
.requiredText=${this.requiredText}
|
|
182
|
+
.tagText=${this.tagText}
|
|
183
|
+
>
|
|
184
|
+
<div class="pkt-contents" slot="helptext">${n.n(this,`helptext`)}</div>
|
|
185
|
+
${!this.hidePicker&&!this.stepArrows?e.d`
|
|
186
|
+
<div class="pkt-timepicker__anchor">
|
|
187
|
+
${this._renderContainer()} ${this._renderPopup()}
|
|
188
|
+
</div>
|
|
189
|
+
`:this._renderContainer()}
|
|
190
|
+
</pkt-input-wrapper>
|
|
191
|
+
`}};e.r([e.s({type:String,reflect:!0})],f.prototype,`value`,void 0),e.r([e.s({type:Boolean,reflect:!0,attribute:`hide-picker`})],f.prototype,`hidePicker`,void 0),e.r([e.s({type:Boolean,reflect:!0,attribute:`step-arrows`})],f.prototype,`stepArrows`,void 0),e.r([e.o()],f.prototype,`_hours`,void 0),e.r([e.o()],f.prototype,`_minutes`,void 0),e.r([e.o()],f.prototype,`_isOpen`,void 0);try{e.c(`pkt-timepicker`)(f)}catch{console.warn(`Forsøker å definere <pkt-timepicker>, men den er allerede definert`)}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return f}});
|