@oslokommune/punkt-elements 17.1.2 → 18.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 +35 -0
- package/dist/{accordion-BeLvLPrB.js → accordion-1_pdxTgJ.js} +27 -27
- package/dist/{accordion-B3GBlvUC.cjs → accordion-DobbH-Sv.cjs} +5 -5
- package/dist/{alert-Cs4Rmq_J.cjs → alert-COeHz6o2.cjs} +6 -6
- package/dist/{alert-DKK_Tb9J.js → alert-xspFetQ8.js} +26 -26
- package/dist/{async-directive-Da7TJpnq.cjs → async-directive-B5pcIMfO.cjs} +1 -1
- package/dist/{async-directive-BPf6K-V2.js → async-directive-D2Sht790.js} +5 -5
- package/dist/{backlink-D1y26pj3.js → backlink-C0jZFnZ2.js} +8 -8
- package/dist/{backlink-CMmrKTe4.cjs → backlink-ZMhqHaVs.cjs} +3 -3
- package/dist/base-elements/element.d.ts +13 -1
- package/dist/base-elements/input-element.d.ts +4 -2
- package/dist/{breadcrumbs-B6JGhJgC.cjs → breadcrumbs-BS64xd1s.cjs} +7 -7
- package/dist/{breadcrumbs-CcTQ3Grm.js → breadcrumbs-BvMownZN.js} +16 -16
- package/dist/{button-2-OSPJkj.js → button-C44vNLFC.js} +28 -28
- package/dist/{button-CE97NQIk.cjs → button-CR4CXtnj.cjs} +7 -7
- package/dist/{calendar-kn4SrtJy.cjs → calendar-DQ4byeom.cjs} +28 -27
- package/dist/{calendar-pOW3R5Pw.js → calendar-DgjCKMMV.js} +82 -68
- package/dist/{card-zQ0eKRMV.js → card-DhHqC265.js} +44 -44
- package/dist/{card-CETDFkxR.cjs → card-Dpqi6HVt.cjs} +26 -26
- package/dist/{checkbox-CH7NpINF.js → checkbox-BQ1K57AB.js} +23 -23
- package/dist/{checkbox-CQNr_sEg.cjs → checkbox-CXQxbiaX.cjs} +11 -11
- package/dist/{class-map-BeimMvPv.cjs → class-map-CzCE5pqG.cjs} +1 -1
- package/dist/{class-map-CnWCnBSX.js → class-map-F1DJHyb7.js} +3 -3
- package/dist/{combobox-Bvg0UO9w.cjs → combobox-BV4oDiII.cjs} +19 -18
- package/dist/{combobox-CRdYYlxu.js → combobox-DPck39I2.js} +55 -54
- package/dist/components/calendar/calendar.d.ts +21 -6
- package/dist/components/checkbox/checkbox.d.ts +4 -2
- package/dist/components/combobox/combobox-base.d.ts +2 -1
- package/dist/components/consent/strings.d.ts +1 -85
- package/dist/components/datepicker/datepicker-base.d.ts +0 -3
- package/dist/components/datepicker/datepicker-multiple.d.ts +0 -2
- package/dist/components/datepicker/datepicker-range.d.ts +0 -2
- package/dist/components/datepicker/datepicker-single.d.ts +0 -2
- package/dist/components/datepicker/datepicker-utils.d.ts +2 -1
- package/dist/components/fileupload/fileupload-base.d.ts +3 -2
- package/dist/components/header/header-service.d.ts +3 -1
- package/dist/components/header/header.d.ts +2 -1
- package/dist/components/helptext/helptext.d.ts +2 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/input-wrapper/input-wrapper.d.ts +4 -2
- package/dist/components/radiobutton/radiobutton.d.ts +4 -2
- package/dist/components/searchinput/searchinput.d.ts +2 -1
- package/dist/{consent-DZEkhgJ1.js → consent-BneInZov.js} +10 -10
- package/dist/{consent-CyY3RyoC.cjs → consent-_N9foluG.cjs} +5 -5
- package/dist/controllers/strings-controller.d.ts +27 -0
- package/dist/{datepicker-VTqSDQk5.cjs → datepicker-9NX5qt2z.cjs} +38 -37
- package/dist/{datepicker-ButIas85.js → datepicker-nSSSr1U7.js} +104 -104
- package/dist/{directive-helpers-CI8YZqku.js → directive-helpers-BARw3nEZ.js} +1 -1
- package/dist/{directive-helpers-BlAV5EQD.cjs → directive-helpers-D6AAMFKs.cjs} +1 -1
- package/dist/docs/components/fileupload.d.ts +1 -0
- package/dist/element-B8OGznK0.cjs +2 -0
- package/dist/{element-ChsFgr_B.js → element-BKSPVgs2.js} +240 -100
- package/dist/{element-with-slot-Bj7nm7fO.cjs → element-with-slot-DTxILHVv.cjs} +1 -1
- package/dist/{element-with-slot-BvG9ctC-.js → element-with-slot-YUAUFRqw.js} +4 -4
- package/dist/fileupload-D05VSbEP.cjs +402 -0
- package/dist/{fileupload-D5IQ9HDe.js → fileupload-E0LGGNgj.js} +370 -380
- package/dist/{footer-DbYQUYNR.cjs → footer-DBApIdGh.cjs} +32 -32
- package/dist/{footer-DrR64HiK.js → footer-DYilVBMC.js} +91 -91
- package/dist/format-B8meU8Tm.cjs +1 -0
- package/dist/format-BTeSVkED.js +18 -0
- package/dist/{header-ClgIac6n.cjs → header-B7tbX-Ok.cjs} +84 -84
- package/dist/{header-menu-BAsUNKSx.cjs → header-menu-1FFWhvNc.cjs} +24 -24
- package/dist/{header-menu-hVPXsb8g.js → header-menu-D522-VTV.js} +75 -75
- package/dist/{header-KvJ1mGwA.js → header-v3GWAzOK.js} +267 -264
- package/dist/{heading-CFmiSuCQ.cjs → heading-CvytvcL7.cjs} +1 -1
- package/dist/{heading-g-_IUB5T.js → heading-rx_oSCqe.js} +16 -16
- package/dist/helptext-DYFdcylX.cjs +27 -0
- package/dist/{helptext-DZng1D5i.js → helptext-LShGPm-b.js} +18 -19
- package/dist/{icon-9iwd2F2l.cjs → icon-BmMC09mi.cjs} +1 -1
- package/dist/{icon-D-LA22xD.js → icon-HYU1f54x.js} +17 -17
- package/dist/{if-defined-CGzIlZ9-.js → if-defined-BF8XcDi5.js} +1 -1
- package/dist/if-defined-CVYApOgK.cjs +1 -0
- package/dist/{input-element-DBMNBplu.js → input-element-D07DmR34.js} +121 -120
- package/dist/input-element-DumGj_oJ.cjs +1 -0
- package/dist/input-wrapper-Cci_wTvD.js +308 -0
- package/dist/input-wrapper-DDfapoRX.cjs +58 -0
- package/dist/{link-DK7gvmnj.cjs → link-11g2ZNin.cjs} +4 -4
- package/dist/{link-D-Eqm5KH.js → link-CQK0SH4H.js} +13 -13
- package/dist/{linkcard-zqbg7Oqm.js → linkcard-B4GlmjJ6.js} +16 -16
- package/dist/linkcard-DNYsVlV6.cjs +13 -0
- package/dist/{listbox-Dc4rGdPi.cjs → listbox-BlFRhyI7.cjs} +15 -15
- package/dist/{listbox-va_E8afs.js → listbox-wd_OofyF.js} +100 -99
- package/dist/{loader-D_RDICnw.js → loader-0C3qVk16.js} +14 -14
- package/dist/{loader-CMUkVJmE.cjs → loader-B9u2qUlR.cjs} +5 -5
- package/dist/{messagebox-Cv8LaSxv.cjs → messagebox-BD5tGmT-.cjs} +5 -5
- package/dist/{messagebox-Cw-OWDya.js → messagebox-C-y1ICmr.js} +15 -15
- package/dist/{modal-BtInv031.cjs → modal-BzPGQYCs.cjs} +8 -8
- package/dist/{modal-D0t_X2dX.js → modal-Cghs3w-d.js} +20 -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-backlink.cjs +1 -1
- package/dist/pkt-backlink.js +1 -1
- package/dist/pkt-breadcrumbs.cjs +1 -1
- package/dist/pkt-breadcrumbs.js +1 -1
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +1 -1
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +1 -1
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +1 -1
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +1 -1
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +1 -1
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +1 -1
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-fileupload.cjs +1 -1
- package/dist/pkt-fileupload.js +1 -1
- package/dist/pkt-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 +35 -34
- 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-C5EBX2T0.cjs → pkt-options-controller-CEEAqXaB.cjs} +1 -1
- package/dist/{pkt-options-controller-B77vH3PE.js → pkt-options-controller-PtjhmTGk.js} +1 -1
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +1 -1
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +1 -1
- package/dist/pkt-searchinput.cjs +1 -1
- package/dist/pkt-searchinput.js +1 -1
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- package/dist/pkt-tabs.cjs +1 -1
- package/dist/pkt-tabs.js +1 -1
- package/dist/pkt-tag.cjs +1 -1
- package/dist/pkt-tag.js +1 -1
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +1 -1
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +1 -1
- package/dist/pkt-timepicker.cjs +1 -1
- package/dist/pkt-timepicker.js +1 -1
- package/dist/{progressbar-CbcfLerF.js → progressbar-BexQQw1o.js} +21 -21
- package/dist/{progressbar-D5MmnQId.cjs → progressbar-X9mSvpjw.cjs} +5 -5
- package/dist/{radiobutton-BUnf3EPi.js → radiobutton-CkhTasn4.js} +24 -24
- package/dist/{radiobutton-DpsO1F-8.cjs → radiobutton-ln29Ad3U.cjs} +8 -8
- package/dist/{ref-CQoEIIp0.cjs → ref-CHbJYtKE.cjs} +1 -1
- package/dist/{ref-CWD6PjVd.js → ref-Chc_DZAb.js} +2 -2
- package/dist/{repeat-sY6B7fAT.cjs → repeat-CHDs__rN.cjs} +1 -1
- package/dist/{repeat-C02g7d5S.js → repeat-P9SMlKd5.js} +4 -4
- package/dist/searchinput-CPgMEAZZ.cjs +60 -0
- package/dist/{searchinput-DwnjsvJ1.js → searchinput-Da7dKHBH.js} +43 -43
- package/dist/{select-BOJi6H6T.cjs → select-DCuvdAuK.cjs} +4 -3
- package/dist/{select-DMre80qs.js → select-jabMSjft.js} +21 -20
- package/dist/shared-strings/consent.d.ts +71 -0
- package/dist/shared-strings/format.d.ts +21 -0
- package/dist/shared-strings/index.d.ts +14 -0
- package/dist/shared-strings/nb.d.ts +118 -0
- package/dist/shared-strings/resolve.d.ts +12 -0
- package/dist/shared-strings/store.d.ts +27 -0
- package/dist/shared-strings/types.d.ts +29 -0
- package/dist/shared-types/fileupload.d.ts +0 -27
- package/dist/shared-types/index.d.ts +1 -2
- package/dist/shared-utils/combobox/index.d.ts +1 -0
- package/dist/shared-utils/combobox/input-utils.d.ts +2 -1
- package/dist/shared-utils/combobox/messages.d.ts +7 -0
- package/dist/shared-utils/combobox/option-utils.d.ts +2 -1
- package/dist/shared-utils/combobox/selection-manager.d.ts +3 -2
- package/dist/{tabs-Cf9ai0FD.cjs → tabs-DV5CQNDL.cjs} +7 -7
- package/dist/{tabs-TvxgbrCF.js → tabs-D_hoi1zu.js} +32 -32
- package/dist/tag-BxYulmZn.cjs +27 -0
- package/dist/{tag-Ds6n1LIs.js → tag-DK5SgKry.js} +33 -32
- package/dist/tests/strings-override.test.d.ts +0 -0
- package/dist/{textarea-vfzIcXhX.js → textarea-BR7Riace.js} +30 -29
- package/dist/{textarea-BydiLM9Z.cjs → textarea-ffBD_VHq.cjs} +3 -2
- package/dist/{textinput-CMP2jPP_.js → textinput-CRNrsRNV.js} +28 -27
- package/dist/{textinput-DGdicNSx.cjs → textinput-CtHFzAux.cjs} +13 -12
- package/dist/timepicker-AfgJipo6.cjs +196 -0
- package/dist/{timepicker-ClwgYywH.js → timepicker-ixs_E5RY.js} +67 -64
- package/package.json +3 -3
- package/src/components/backlink/backlink.ts +1 -1
- package/src/components/breadcrumbs/breadcrumbs.ts +1 -1
- package/src/components/calendar/calendar.ts +56 -26
- package/src/components/checkbox/checkbox.test.ts +0 -2
- package/src/components/checkbox/checkbox.ts +8 -4
- package/src/components/combobox/combobox-base.ts +2 -1
- package/src/components/combobox/combobox-value.ts +10 -9
- package/src/components/combobox/combobox.selection.test.ts +5 -1
- package/src/components/combobox/combobox.ts +4 -1
- package/src/components/consent/strings.ts +1 -125
- package/src/components/datepicker/date-tags.ts +4 -1
- package/src/components/datepicker/datepicker-base.ts +2 -6
- package/src/components/datepicker/datepicker-multiple.ts +0 -3
- package/src/components/datepicker/datepicker-range.ts +4 -7
- package/src/components/datepicker/datepicker-single.ts +0 -3
- package/src/components/datepicker/datepicker-utils.test.ts +5 -5
- package/src/components/datepicker/datepicker-utils.ts +6 -11
- package/src/components/datepicker/datepicker.ts +8 -1
- package/src/components/fileupload/fileupload-base.ts +25 -16
- package/src/components/fileupload/fileupload-renderers.ts +2 -1
- package/src/components/fileupload/fileupload.test.ts +16 -0
- package/src/components/fileupload/fileupload.ts +19 -15
- package/src/components/header/header-global.ts +3 -3
- package/src/components/header/header-service.ts +13 -8
- package/src/components/header/header.ts +2 -1
- package/src/components/helptext/helptext.test.ts +1 -1
- package/src/components/helptext/helptext.ts +3 -3
- package/src/components/index.ts +9 -0
- package/src/components/input-wrapper/input-wrapper.ts +18 -10
- package/src/components/listbox/listbox.ts +3 -3
- package/src/components/radiobutton/radiobutton.ts +8 -4
- package/src/components/searchinput/searchinput.ts +5 -3
- package/src/components/select/select.ts +1 -0
- package/src/components/tag/tag.ts +2 -1
- package/src/components/textarea/textarea.ts +1 -0
- package/src/components/textinput/textinput.ts +1 -0
- package/src/components/timepicker/timepicker.ts +23 -21
- package/dist/element-BA8v6S7z.cjs +0 -2
- package/dist/fileupload-BeWiTAoW.cjs +0 -401
- package/dist/helptext-CTtKJcML.cjs +0 -27
- package/dist/if-defined-B89_ZeCj.cjs +0 -1
- package/dist/input-element-DYmQw-fH.cjs +0 -1
- package/dist/input-wrapper-BmxNvznr.js +0 -128
- package/dist/input-wrapper-D-fPaTbY.js +0 -176
- package/dist/input-wrapper-D5PR0rJn.cjs +0 -1
- package/dist/input-wrapper-Q-B-aBeb.cjs +0 -54
- package/dist/linkcard-B29cmZqh.cjs +0 -13
- package/dist/searchinput-Bh975rjX.cjs +0 -60
- package/dist/tag-CzojNU7z.cjs +0 -27
- package/dist/timepicker-DYrnLHqN.cjs +0 -195
- package/dist/translations/no.json.d.ts +0 -94
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
import {
|
|
4
|
-
import "./
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import { t as
|
|
8
|
-
import "./input-
|
|
1
|
+
import { _ as e, d as t, h as n, l as r, n as i, u as a } from "./element-BKSPVgs2.js";
|
|
2
|
+
import { t as o } from "./class-map-F1DJHyb7.js";
|
|
3
|
+
import { t as s } from "./format-BTeSVkED.js";
|
|
4
|
+
import { n as c } from "./element-with-slot-YUAUFRqw.js";
|
|
5
|
+
import "./icon-HYU1f54x.js";
|
|
6
|
+
import { t as l } from "./if-defined-BF8XcDi5.js";
|
|
7
|
+
import { n as u, t as d } from "./ref-Chc_DZAb.js";
|
|
8
|
+
import { t as f } from "./input-element-D07DmR34.js";
|
|
9
|
+
import "./input-wrapper-Cci_wTvD.js";
|
|
9
10
|
//#region ../../shared-utils/timepicker/time-utils.ts
|
|
10
11
|
var p = (e) => /^\d{2}:\d{2}$/.test(e) && parseInt(e.slice(0, 2), 10) <= 23 && parseInt(e.slice(3), 10) <= 59, m = (e) => {
|
|
11
12
|
let [t, n] = e.split(":").map(Number);
|
|
@@ -153,25 +154,26 @@ var p = (e) => /^\d{2}:\d{2}$/.test(e) && parseInt(e.slice(0, 2), 10) <= 23 && p
|
|
|
153
154
|
manageValidity(e) {
|
|
154
155
|
let t = this.hoursInputRef.value;
|
|
155
156
|
if (!t) return;
|
|
157
|
+
let n = this.pktStrings.get("validation");
|
|
156
158
|
if (this.required && !this.value) {
|
|
157
|
-
this.internals.setValidity({ valueMissing: !0 },
|
|
159
|
+
this.internals.setValidity({ valueMissing: !0 }, n.valueMissing, t), this._setAriaInvalid(!0);
|
|
158
160
|
return;
|
|
159
161
|
}
|
|
160
162
|
if (!this.value) {
|
|
161
163
|
this.internals.setValidity({}), this._setAriaInvalid(!1);
|
|
162
164
|
return;
|
|
163
165
|
}
|
|
164
|
-
let
|
|
165
|
-
if (this.min &&
|
|
166
|
-
this.internals.setValidity({ rangeUnderflow: !0 },
|
|
166
|
+
let r = m(this.value), i = h(this.step);
|
|
167
|
+
if (this.min && r < m(String(this.min))) {
|
|
168
|
+
this.internals.setValidity({ rangeUnderflow: !0 }, s(n.rangeUnderflowMin, { min: String(this.min) }), t), this._setAriaInvalid(!0);
|
|
167
169
|
return;
|
|
168
170
|
}
|
|
169
|
-
if (this.max &&
|
|
170
|
-
this.internals.setValidity({ rangeOverflow: !0 },
|
|
171
|
+
if (this.max && r > m(String(this.max))) {
|
|
172
|
+
this.internals.setValidity({ rangeOverflow: !0 }, s(n.rangeOverflowMax, { max: String(this.max) }), t), this._setAriaInvalid(!0);
|
|
171
173
|
return;
|
|
172
174
|
}
|
|
173
|
-
if (this.step &&
|
|
174
|
-
let e =
|
|
175
|
+
if (this.step && r % i !== 0) {
|
|
176
|
+
let e = i === 60 ? n.timeStepMismatchHour : i === 30 ? n.timeStepMismatchHalfHour : s(n.timeStepMismatch, { step: `${i}, ${i * 2}, ${i * 3}` });
|
|
175
177
|
this.internals.setValidity({ stepMismatch: !0 }, e, t), this._setAriaInvalid(!0);
|
|
176
178
|
return;
|
|
177
179
|
}
|
|
@@ -262,40 +264,40 @@ var p = (e) => /^\d{2}:\d{2}$/.test(e) && parseInt(e.slice(0, 2), 10) <= 23 && p
|
|
|
262
264
|
let t = v(this._hours, this._minutes, e, this._minuteStep);
|
|
263
265
|
this._hours = t.hours, this._minutes = t.minutes, this._syncValueFromDisplay();
|
|
264
266
|
}
|
|
265
|
-
_renderOption(
|
|
266
|
-
let
|
|
267
|
-
return
|
|
267
|
+
_renderOption(t, n) {
|
|
268
|
+
let r = String(t).padStart(2, "0"), i = t === (n === "hour" ? this._hours === "" ? NaN : parseInt(this._hours, 10) : this._minutes === "" ? NaN : parseInt(this._minutes, 10));
|
|
269
|
+
return e`
|
|
268
270
|
<button
|
|
269
|
-
class=${
|
|
271
|
+
class=${o({
|
|
270
272
|
"pkt-btn": !0,
|
|
271
273
|
"pkt-btn--tertiary": !0,
|
|
272
274
|
"pkt-btn--small": !0,
|
|
273
275
|
"pkt-btn--label-only": !0,
|
|
274
276
|
"pkt-timepicker-popup__option": !0,
|
|
275
|
-
"pkt-timepicker-popup__option--selected":
|
|
277
|
+
"pkt-timepicker-popup__option--selected": i
|
|
276
278
|
})}
|
|
277
279
|
type="button"
|
|
278
280
|
role="option"
|
|
279
|
-
aria-selected=${
|
|
280
|
-
tabindex=${
|
|
281
|
-
data-type=${
|
|
282
|
-
data-value=${
|
|
283
|
-
@click=${(
|
|
284
|
-
|
|
281
|
+
aria-selected=${i ? "true" : "false"}
|
|
282
|
+
tabindex=${i ? "0" : "-1"}
|
|
283
|
+
data-type=${n}
|
|
284
|
+
data-value=${t}
|
|
285
|
+
@click=${(e) => {
|
|
286
|
+
e.stopImmediatePropagation(), this._handleOptionClick(t, n);
|
|
285
287
|
}}
|
|
286
288
|
>
|
|
287
|
-
<span class="pkt-btn__text pkt-txt-14-light">${
|
|
289
|
+
<span class="pkt-btn__text pkt-txt-14-light">${r}</span>
|
|
288
290
|
</button>
|
|
289
291
|
`;
|
|
290
292
|
}
|
|
291
293
|
_renderPopup() {
|
|
292
|
-
return
|
|
294
|
+
return e`
|
|
293
295
|
<div
|
|
294
296
|
class="pkt-timepicker-popup"
|
|
295
297
|
id=${this.id + "-popup"}
|
|
296
298
|
?hidden=${!this._isOpen}
|
|
297
299
|
role="group"
|
|
298
|
-
aria-label=${this.
|
|
300
|
+
aria-label=${this.pktStrings.get("timepicker").selectTime}
|
|
299
301
|
@keydown=${this._handlePopupKeydown}
|
|
300
302
|
@focusout=${(e) => {
|
|
301
303
|
this.querySelector(".pkt-timepicker-popup")?.contains(e.relatedTarget) || this._closePopup();
|
|
@@ -304,7 +306,7 @@ var p = (e) => /^\d{2}:\d{2}$/.test(e) && parseInt(e.slice(0, 2), 10) <= 23 && p
|
|
|
304
306
|
<div
|
|
305
307
|
class="pkt-timepicker-popup__col"
|
|
306
308
|
role="listbox"
|
|
307
|
-
aria-label=${this.
|
|
309
|
+
aria-label=${this.pktStrings.get("timepicker").hours}
|
|
308
310
|
aria-orientation="vertical"
|
|
309
311
|
>
|
|
310
312
|
${this._hourOptions.map((e) => this._renderOption(e, "hour"))}
|
|
@@ -312,7 +314,7 @@ var p = (e) => /^\d{2}:\d{2}$/.test(e) && parseInt(e.slice(0, 2), 10) <= 23 && p
|
|
|
312
314
|
<div
|
|
313
315
|
class="pkt-timepicker-popup__col"
|
|
314
316
|
role="listbox"
|
|
315
|
-
aria-label=${this.
|
|
317
|
+
aria-label=${this.pktStrings.get("timepicker").minutes}
|
|
316
318
|
aria-orientation="vertical"
|
|
317
319
|
>
|
|
318
320
|
${this._minuteOptions.map((e) => this._renderOption(e, "minute"))}
|
|
@@ -321,28 +323,28 @@ var p = (e) => /^\d{2}:\d{2}$/.test(e) && parseInt(e.slice(0, 2), 10) <= 23 && p
|
|
|
321
323
|
`;
|
|
322
324
|
}
|
|
323
325
|
_renderContainer() {
|
|
324
|
-
let
|
|
325
|
-
return
|
|
326
|
+
let t = this.pktStrings.get("timepicker").hours, r = this.pktStrings.get("timepicker").minutes, i = this.label ? `${t}, ${this.label}` : t, a = this.label ? `${r}, ${this.label}` : r;
|
|
327
|
+
return e`
|
|
326
328
|
<div
|
|
327
329
|
class="pkt-input__container pkt-input__container--${this.inputSize}"
|
|
328
330
|
@click=${(e) => {
|
|
329
331
|
e.target.closest("button, input") || this.hoursInputRef.value?.focus();
|
|
330
332
|
}}
|
|
331
333
|
>
|
|
332
|
-
${this.stepArrows ?
|
|
334
|
+
${this.stepArrows ? e`
|
|
333
335
|
<button
|
|
334
336
|
class="pkt-input-icon pkt-btn pkt-btn--icon-only pkt-btn--tertiary pkt-btn--${this.inputSize} pkt-timepicker__button pkt-timepicker__button--prev"
|
|
335
337
|
type="button"
|
|
336
|
-
aria-label=${this.
|
|
338
|
+
aria-label=${this.pktStrings.get("timepicker").prevTime}
|
|
337
339
|
?disabled=${this.disabled}
|
|
338
340
|
@click=${() => this._stepTime(-1)}
|
|
339
341
|
>
|
|
340
342
|
<pkt-icon name="chevron-thin-left"></pkt-icon>
|
|
341
343
|
<span class="pkt-btn__text"
|
|
342
|
-
>${this.
|
|
344
|
+
>${this.pktStrings.get("timepicker").prevTime}</span
|
|
343
345
|
>
|
|
344
346
|
</button>
|
|
345
|
-
` :
|
|
347
|
+
` : n}
|
|
346
348
|
<input
|
|
347
349
|
${u(this.hoursInputRef)}
|
|
348
350
|
type="text"
|
|
@@ -355,14 +357,14 @@ var p = (e) => /^\d{2}:\d{2}$/.test(e) && parseInt(e.slice(0, 2), 10) <= 23 && p
|
|
|
355
357
|
data-max="23"
|
|
356
358
|
.value=${this._hours}
|
|
357
359
|
placeholder="––"
|
|
358
|
-
aria-label=${
|
|
360
|
+
aria-label=${i}
|
|
359
361
|
role="spinbutton"
|
|
360
|
-
aria-invalid=${this.hasError ? "true" :
|
|
361
|
-
aria-errormessage=${this.hasError ? `${this.id}-hours-error` :
|
|
362
|
+
aria-invalid=${this.hasError ? "true" : n}
|
|
363
|
+
aria-errormessage=${this.hasError ? `${this.id}-hours-error` : n}
|
|
362
364
|
aria-valuemin="0"
|
|
363
365
|
aria-valuemax="23"
|
|
364
|
-
aria-valuenow=${this._hours === "" ?
|
|
365
|
-
aria-valuetext=${this._hours === "" ?
|
|
366
|
+
aria-valuenow=${this._hours === "" ? n : this._hours}
|
|
367
|
+
aria-valuetext=${this._hours === "" ? n : `${this._hours} ${t.toLowerCase()}`}
|
|
366
368
|
autocomplete="off"
|
|
367
369
|
?disabled=${this.disabled}
|
|
368
370
|
@keydown=${this._handleHoursKeydown}
|
|
@@ -386,12 +388,12 @@ var p = (e) => /^\d{2}:\d{2}$/.test(e) && parseInt(e.slice(0, 2), 10) <= 23 && p
|
|
|
386
388
|
placeholder="––"
|
|
387
389
|
aria-label=${a}
|
|
388
390
|
role="spinbutton"
|
|
389
|
-
aria-invalid=${this.hasError ? "true" :
|
|
390
|
-
aria-errormessage=${this.hasError ? `${this.id}-hours-error` :
|
|
391
|
+
aria-invalid=${this.hasError ? "true" : n}
|
|
392
|
+
aria-errormessage=${this.hasError ? `${this.id}-hours-error` : n}
|
|
391
393
|
aria-valuemin="0"
|
|
392
394
|
aria-valuemax="59"
|
|
393
|
-
aria-valuenow=${this._minutes === "" ?
|
|
394
|
-
aria-valuetext=${this._minutes === "" ?
|
|
395
|
+
aria-valuenow=${this._minutes === "" ? n : this._minutes}
|
|
396
|
+
aria-valuetext=${this._minutes === "" ? n : `${this._minutes} ${r.toLowerCase()}`}
|
|
395
397
|
autocomplete="off"
|
|
396
398
|
?disabled=${this.disabled}
|
|
397
399
|
@keydown=${this._handleMinutesKeydown}
|
|
@@ -400,17 +402,17 @@ var p = (e) => /^\d{2}:\d{2}$/.test(e) && parseInt(e.slice(0, 2), 10) <= 23 && p
|
|
|
400
402
|
e.target.select(), e.stopImmediatePropagation();
|
|
401
403
|
}}
|
|
402
404
|
/>
|
|
403
|
-
${this.hidePicker && !this.stepArrows ?
|
|
405
|
+
${this.hidePicker && !this.stepArrows ? e`<pkt-icon
|
|
404
406
|
class="pkt-input-icon pkt-timepicker__icon"
|
|
405
407
|
name="clock"
|
|
406
408
|
aria-hidden="true"
|
|
407
|
-
></pkt-icon>` :
|
|
408
|
-
${!this.hidePicker && !this.stepArrows ?
|
|
409
|
+
></pkt-icon>` : n}
|
|
410
|
+
${!this.hidePicker && !this.stepArrows ? e`
|
|
409
411
|
<button
|
|
410
412
|
${u(this.buttonRef)}
|
|
411
413
|
class="pkt-input-icon pkt-btn pkt-btn--icon-only pkt-btn--tertiary pkt-btn--${this.inputSize} pkt-timepicker__button"
|
|
412
414
|
type="button"
|
|
413
|
-
aria-label=${this.
|
|
415
|
+
aria-label=${this.pktStrings.get("timepicker").openPicker}
|
|
414
416
|
aria-haspopup="listbox"
|
|
415
417
|
aria-expanded=${this._isOpen ? "true" : "false"}
|
|
416
418
|
aria-controls=${this.id + "-popup"}
|
|
@@ -419,24 +421,24 @@ var p = (e) => /^\d{2}:\d{2}$/.test(e) && parseInt(e.slice(0, 2), 10) <= 23 && p
|
|
|
419
421
|
>
|
|
420
422
|
<pkt-icon name="clock"></pkt-icon>
|
|
421
423
|
<span class="pkt-btn__text"
|
|
422
|
-
>${this.
|
|
424
|
+
>${this.pktStrings.get("timepicker").openPicker}</span
|
|
423
425
|
>
|
|
424
426
|
</button>
|
|
425
|
-
` :
|
|
426
|
-
${this.stepArrows ?
|
|
427
|
+
` : n}
|
|
428
|
+
${this.stepArrows ? e`
|
|
427
429
|
<button
|
|
428
430
|
class="pkt-input-icon pkt-btn pkt-btn--icon-only pkt-btn--tertiary pkt-btn--${this.inputSize} pkt-timepicker__button pkt-timepicker__button--next"
|
|
429
431
|
type="button"
|
|
430
|
-
aria-label=${this.
|
|
432
|
+
aria-label=${this.pktStrings.get("timepicker").nextTime}
|
|
431
433
|
?disabled=${this.disabled}
|
|
432
434
|
@click=${() => this._stepTime(1)}
|
|
433
435
|
>
|
|
434
436
|
<pkt-icon name="chevron-thin-right"></pkt-icon>
|
|
435
437
|
<span class="pkt-btn__text"
|
|
436
|
-
>${this.
|
|
438
|
+
>${this.pktStrings.get("timepicker").nextTime}</span
|
|
437
439
|
>
|
|
438
440
|
</button>
|
|
439
|
-
` :
|
|
441
|
+
` : n}
|
|
440
442
|
<input
|
|
441
443
|
${u(this.hiddenInputRef)}
|
|
442
444
|
type="time"
|
|
@@ -455,8 +457,9 @@ var p = (e) => /^\d{2}:\d{2}$/.test(e) && parseInt(e.slice(0, 2), 10) <= 23 && p
|
|
|
455
457
|
`;
|
|
456
458
|
}
|
|
457
459
|
render() {
|
|
458
|
-
return
|
|
460
|
+
return e`
|
|
459
461
|
<pkt-input-wrapper
|
|
462
|
+
.strings=${this.strings}
|
|
460
463
|
label="${this.label}"
|
|
461
464
|
?disabled=${this.disabled}
|
|
462
465
|
?fullwidth=${this.fullwidth}
|
|
@@ -479,7 +482,7 @@ var p = (e) => /^\d{2}:\d{2}$/.test(e) && parseInt(e.slice(0, 2), 10) <= 23 && p
|
|
|
479
482
|
.size=${this.inputSize}
|
|
480
483
|
>
|
|
481
484
|
<div class="pkt-contents" slot="helptext">${c(this, "helptext")}</div>
|
|
482
|
-
${!this.hidePicker && !this.stepArrows ?
|
|
485
|
+
${!this.hidePicker && !this.stepArrows ? e`
|
|
483
486
|
<div class="pkt-timepicker__anchor">
|
|
484
487
|
${this._renderContainer()} ${this._renderPopup()}
|
|
485
488
|
</div>
|
|
@@ -488,20 +491,20 @@ var p = (e) => /^\d{2}:\d{2}$/.test(e) && parseInt(e.slice(0, 2), 10) <= 23 && p
|
|
|
488
491
|
`;
|
|
489
492
|
}
|
|
490
493
|
};
|
|
491
|
-
|
|
494
|
+
i([a({
|
|
492
495
|
type: String,
|
|
493
496
|
reflect: !0
|
|
494
|
-
})], y.prototype, "value", void 0),
|
|
497
|
+
})], y.prototype, "value", void 0), i([a({
|
|
495
498
|
type: Boolean,
|
|
496
499
|
reflect: !0,
|
|
497
500
|
attribute: "hide-picker"
|
|
498
|
-
})], y.prototype, "hidePicker", void 0),
|
|
501
|
+
})], y.prototype, "hidePicker", void 0), i([a({
|
|
499
502
|
type: Boolean,
|
|
500
503
|
reflect: !0,
|
|
501
504
|
attribute: "step-arrows"
|
|
502
|
-
})], y.prototype, "stepArrows", void 0),
|
|
505
|
+
})], y.prototype, "stepArrows", void 0), i([r()], y.prototype, "_hours", void 0), i([r()], y.prototype, "_minutes", void 0), i([r()], y.prototype, "_isOpen", void 0);
|
|
503
506
|
try {
|
|
504
|
-
|
|
507
|
+
t("pkt-timepicker")(y);
|
|
505
508
|
} catch {
|
|
506
509
|
console.warn("Forsøker å definere <pkt-timepicker>, men den er allerede definert");
|
|
507
510
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-elements",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "18.0.0",
|
|
4
4
|
"description": "Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo",
|
|
5
5
|
"homepage": "https://punkt.oslo.kommune.no",
|
|
6
6
|
"author": "Team Designsystem, Oslo Origo",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@babel/plugin-transform-private-property-in-object": "^7.27.1",
|
|
42
42
|
"@babel/preset-env": "^7.28.3",
|
|
43
43
|
"@babel/preset-typescript": "^7.28.3",
|
|
44
|
-
"@oslokommune/punkt-assets": "^
|
|
44
|
+
"@oslokommune/punkt-assets": "^18.0.0",
|
|
45
45
|
"@testing-library/dom": "^10.4.1",
|
|
46
46
|
"@testing-library/jest-dom": "^6.9.1",
|
|
47
47
|
"@types/jest-axe": "^3.5.9",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"engines": {
|
|
84
84
|
"node": "^22.19.0 || ^24.0.0 || ^26.0.0"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "057d0045ccd1af4d0f6591f0e2b0e5ab6fda3843"
|
|
87
87
|
}
|
|
@@ -36,7 +36,7 @@ export class PktBackLink extends PktElement<IPktBackLink> implements IPktBackLin
|
|
|
36
36
|
render() {
|
|
37
37
|
return html`<nav
|
|
38
38
|
class="pkt-back-link"
|
|
39
|
-
aria-label=${this.ariaLabel || '
|
|
39
|
+
aria-label=${this.ariaLabel || this.pktStrings.get('backlink').label}
|
|
40
40
|
>
|
|
41
41
|
<a href=${ifDefined(this.href || '/')} class="pkt-link pkt-link--icon-left"
|
|
42
42
|
><pkt-icon
|
|
@@ -39,7 +39,7 @@ export class PktBreadcrumbs extends PktElement implements IPktBreadcrumbs {
|
|
|
39
39
|
const backLink = this.breadcrumbs[this.breadcrumbs.length - 2]
|
|
40
40
|
|
|
41
41
|
return html`
|
|
42
|
-
<nav class="pkt-breadcrumbs" aria-label
|
|
42
|
+
<nav class="pkt-breadcrumbs" aria-label=${this.pktStrings.get('breadcrumbs').ariaLabel}>
|
|
43
43
|
<ol class="pkt-breadcrumbs__list pkt-breadcrumbs--desktop">
|
|
44
44
|
${this.breadcrumbs.map((item, index) =>
|
|
45
45
|
index === this.breadcrumbs.length - 1
|
|
@@ -95,12 +95,32 @@ export class PktCalendar extends PktElement {
|
|
|
95
95
|
today: string | null = null
|
|
96
96
|
|
|
97
97
|
// Localization strings
|
|
98
|
-
@
|
|
99
|
-
@property({ type: Array, attribute: 'day-strings
|
|
100
|
-
@
|
|
101
|
-
@property({ type:
|
|
102
|
-
@
|
|
103
|
-
@property({ type:
|
|
98
|
+
/** @deprecated Bruk `strings={{ dates: { daysShort: [...] } }}` eller `setPktStrings()`. */
|
|
99
|
+
@property({ type: Array, attribute: 'day-strings' }) dayStrings?: string[]
|
|
100
|
+
/** @deprecated Bruk `strings={{ dates: { days: [...] } }}` eller `setPktStrings()`. */
|
|
101
|
+
@property({ type: Array, attribute: 'day-strings-long' }) dayStringsLong?: string[]
|
|
102
|
+
/** @deprecated Bruk `strings={{ dates: { months: [...] } }}` eller `setPktStrings()`. */
|
|
103
|
+
@property({ type: Array, attribute: 'month-strings' }) monthStrings?: string[]
|
|
104
|
+
/** @deprecated Bruk `strings={{ dates: { week: '...' } }}` eller `setPktStrings()`. */
|
|
105
|
+
@property({ type: String, attribute: 'week-string' }) weekString?: string
|
|
106
|
+
/** @deprecated Bruk `strings={{ calendar: { prevMonth: '...' } }}` eller `setPktStrings()`. */
|
|
107
|
+
@property({ type: String, attribute: 'prev-month-string' }) prevMonthString?: string
|
|
108
|
+
/** @deprecated Bruk `strings={{ calendar: { nextMonth: '...' } }}` eller `setPktStrings()`. */
|
|
109
|
+
@property({ type: String, attribute: 'next-month-string' }) nextMonthString?: string
|
|
110
|
+
|
|
111
|
+
/** Datonavn og navigasjonstekster, med de utfasede enkeltpropene lagt oppå. */
|
|
112
|
+
protected get calendarStrings() {
|
|
113
|
+
const dates = this.pktStrings.get('dates')
|
|
114
|
+
const calendar = this.pktStrings.get('calendar')
|
|
115
|
+
return {
|
|
116
|
+
daysShort: this.dayStrings ?? dates.daysShort,
|
|
117
|
+
days: this.dayStringsLong ?? dates.days,
|
|
118
|
+
months: this.monthStrings ?? dates.months,
|
|
119
|
+
week: this.weekString ?? dates.week,
|
|
120
|
+
prevMonth: this.prevMonthString ?? calendar.prevMonth,
|
|
121
|
+
nextMonth: this.nextMonthString ?? calendar.nextMonth,
|
|
122
|
+
}
|
|
123
|
+
}
|
|
104
124
|
|
|
105
125
|
// Internal state - selection tracking
|
|
106
126
|
@property({ type: Array }) private _selected: Date[] = []
|
|
@@ -230,8 +250,7 @@ export class PktCalendar extends PktElement {
|
|
|
230
250
|
}}
|
|
231
251
|
>
|
|
232
252
|
<nav class="pkt-cal-month-nav">
|
|
233
|
-
${this.renderMonthNavButton('prev')}
|
|
234
|
-
${this.renderMonthNav()}
|
|
253
|
+
${this.renderMonthNavButton('prev')} ${this.renderMonthNav()}
|
|
235
254
|
${this.renderMonthNavButton('next')}
|
|
236
255
|
</nav>
|
|
237
256
|
<table
|
|
@@ -253,7 +272,8 @@ export class PktCalendar extends PktElement {
|
|
|
253
272
|
private renderMonthNavButton(direction: 'prev' | 'next'): TemplateResult {
|
|
254
273
|
const isPrev = direction === 'prev'
|
|
255
274
|
const isAllowed = isPrev ? this.isPrevMonthAllowed() : this.isNextMonthAllowed()
|
|
256
|
-
const
|
|
275
|
+
const { prevMonth, nextMonth } = this.calendarStrings
|
|
276
|
+
const label = isPrev ? prevMonth : nextMonth
|
|
257
277
|
const iconName = isPrev ? 'chevron-thin-left' : 'chevron-thin-right'
|
|
258
278
|
const className = isPrev ? 'pkt-calendar__prev-month' : 'pkt-calendar__next-month'
|
|
259
279
|
const onClick = isPrev ? () => this.prevMonth() : () => this.nextMonth()
|
|
@@ -284,28 +304,32 @@ export class PktCalendar extends PktElement {
|
|
|
284
304
|
const days: TemplateResult[] = []
|
|
285
305
|
|
|
286
306
|
if (this.weeknumbers) {
|
|
287
|
-
days.push(
|
|
307
|
+
days.push(
|
|
308
|
+
html`<th><div class="pkt-calendar__week-number">${this.calendarStrings.week}</div></th>`,
|
|
309
|
+
)
|
|
288
310
|
}
|
|
289
311
|
|
|
290
|
-
|
|
312
|
+
const { days: dayNames, daysShort } = this.calendarStrings
|
|
313
|
+
for (let i = 0; i < daysShort.length; i++) {
|
|
291
314
|
days.push(
|
|
292
315
|
html`<th>
|
|
293
|
-
<div class="pkt-calendar__day-name" aria-label="${
|
|
294
|
-
${this.dayStrings[i]}
|
|
295
|
-
</div>
|
|
316
|
+
<div class="pkt-calendar__day-name" aria-label="${dayNames[i]}">${daysShort[i]}</div>
|
|
296
317
|
</th>`,
|
|
297
318
|
)
|
|
298
319
|
}
|
|
299
320
|
|
|
300
|
-
return html`<tr class="pkt-cal-week-row"
|
|
321
|
+
return html`<tr class="pkt-cal-week-row">
|
|
322
|
+
${days}
|
|
323
|
+
</tr>`
|
|
301
324
|
}
|
|
302
325
|
|
|
303
326
|
private renderMonthNav(): TemplateResult {
|
|
327
|
+
const dates = this.pktStrings.get('dates')
|
|
304
328
|
if (this.withcontrols) {
|
|
305
329
|
return html`<div class="pkt-cal-month-picker">
|
|
306
|
-
<label for="${this.id}-monthnav" class="pkt-hide">${
|
|
330
|
+
<label for="${this.id}-monthnav" class="pkt-hide">${dates.month}</label>
|
|
307
331
|
<select
|
|
308
|
-
aria-label="${
|
|
332
|
+
aria-label="${dates.month}"
|
|
309
333
|
class="pkt-input pkt-input-compact"
|
|
310
334
|
id="${this.id}-monthnav"
|
|
311
335
|
@change=${(e: Event) => {
|
|
@@ -314,14 +338,14 @@ export class PktCalendar extends PktElement {
|
|
|
314
338
|
this.changeMonth(this.year, parseInt(target.value))
|
|
315
339
|
}}
|
|
316
340
|
>
|
|
317
|
-
${this.
|
|
341
|
+
${this.calendarStrings.months.map(
|
|
318
342
|
(month, index) =>
|
|
319
343
|
html`<option value=${index} ?selected=${this.month === index}>${month}</option>`,
|
|
320
344
|
)}
|
|
321
345
|
</select>
|
|
322
|
-
<label for="${this.id}-yearnav" class="pkt-hide">${
|
|
346
|
+
<label for="${this.id}-yearnav" class="pkt-hide">${dates.year}</label>
|
|
323
347
|
<input
|
|
324
|
-
aria-label="${
|
|
348
|
+
aria-label="${dates.year}"
|
|
325
349
|
class="pkt-input pkt-cal-input-year pkt-input-compact"
|
|
326
350
|
id="${this.id}-yearnav"
|
|
327
351
|
type="number"
|
|
@@ -338,7 +362,7 @@ export class PktCalendar extends PktElement {
|
|
|
338
362
|
}
|
|
339
363
|
|
|
340
364
|
return html`<div class="pkt-txt-16-medium pkt-calendar__month-title" aria-live="polite">
|
|
341
|
-
${this.
|
|
365
|
+
${this.calendarStrings.months[this.month]} ${this.year}
|
|
342
366
|
</div>`
|
|
343
367
|
}
|
|
344
368
|
|
|
@@ -393,10 +417,12 @@ export class PktCalendar extends PktElement {
|
|
|
393
417
|
|
|
394
418
|
private getDayCellClasses(data: TDayViewData) {
|
|
395
419
|
const { currentDateISO, isToday, isSelected } = data
|
|
396
|
-
const isRangeStart =
|
|
420
|
+
const isRangeStart =
|
|
421
|
+
this.range &&
|
|
397
422
|
(this.selected.length === 2 || this.rangeHovered !== null) &&
|
|
398
423
|
currentDateISO === this.selected[0]
|
|
399
|
-
const isRangeEnd =
|
|
424
|
+
const isRangeEnd =
|
|
425
|
+
this.range && this.selected.length === 2 && currentDateISO === this.selected[1]
|
|
400
426
|
|
|
401
427
|
return {
|
|
402
428
|
'pkt-cal-today': isToday,
|
|
@@ -412,10 +438,12 @@ export class PktCalendar extends PktElement {
|
|
|
412
438
|
|
|
413
439
|
private getDayButtonClasses(data: TDayViewData) {
|
|
414
440
|
const { currentDateISO, isToday, isSelected, isDisabled } = data
|
|
415
|
-
const isRangeStart =
|
|
441
|
+
const isRangeStart =
|
|
442
|
+
this.range &&
|
|
416
443
|
(this.selected.length === 2 || this.rangeHovered !== null) &&
|
|
417
444
|
currentDateISO === this.selected[0]
|
|
418
|
-
const isRangeEnd =
|
|
445
|
+
const isRangeEnd =
|
|
446
|
+
this.range && this.selected.length === 2 && currentDateISO === this.selected[1]
|
|
419
447
|
|
|
420
448
|
return {
|
|
421
449
|
'pkt-calendar__date': true,
|
|
@@ -489,7 +517,9 @@ export class PktCalendar extends PktElement {
|
|
|
489
517
|
}
|
|
490
518
|
|
|
491
519
|
private renderWeekRow(cells: TemplateResult[]): TemplateResult {
|
|
492
|
-
return html`<tr class="pkt-cal-week-row" role="row"
|
|
520
|
+
return html`<tr class="pkt-cal-week-row" role="row">
|
|
521
|
+
${cells}
|
|
522
|
+
</tr>`
|
|
493
523
|
}
|
|
494
524
|
|
|
495
525
|
private renderCalendarBody() {
|
|
@@ -406,7 +406,6 @@ describe('PktCheckbox', () => {
|
|
|
406
406
|
await checkbox.updateComplete
|
|
407
407
|
|
|
408
408
|
expect(checkbox.optionalTag).toBe(true)
|
|
409
|
-
expect(checkbox.optionalText).toBe('Valgfritt')
|
|
410
409
|
|
|
411
410
|
const optionalTag = checkbox.querySelector('.pkt-tag--blue-light')
|
|
412
411
|
expect(optionalTag).toBeInTheDocument()
|
|
@@ -423,7 +422,6 @@ describe('PktCheckbox', () => {
|
|
|
423
422
|
await checkbox.updateComplete
|
|
424
423
|
|
|
425
424
|
expect(checkbox.requiredTag).toBe(true)
|
|
426
|
-
expect(checkbox.requiredText).toBe('Må fylles ut')
|
|
427
425
|
|
|
428
426
|
const requiredTag = checkbox.querySelector('.pkt-tag--beige')
|
|
429
427
|
expect(requiredTag).toBeInTheDocument()
|
|
@@ -36,9 +36,11 @@ export class PktCheckbox extends PktInputElement<Props> {
|
|
|
36
36
|
@property({ type: String, reflect: true }) type: string = 'checkbox'
|
|
37
37
|
@property({ type: String }) tagText: string | null = null
|
|
38
38
|
@property({ type: Boolean }) optionalTag: boolean = false
|
|
39
|
-
@
|
|
39
|
+
/** @deprecated Bruk `strings={{ forms: { optional: '…' } }}` eller `setPktStrings()`. */
|
|
40
|
+
@property({ type: String }) optionalText?: string
|
|
40
41
|
@property({ type: Boolean }) requiredTag: boolean = false
|
|
41
|
-
@
|
|
42
|
+
/** @deprecated Bruk `strings={{ forms: { required: '…' } }}` eller `setPktStrings()`. */
|
|
43
|
+
@property({ type: String }) requiredText?: string
|
|
42
44
|
|
|
43
45
|
connectedCallback() {
|
|
44
46
|
super.connectedCallback()
|
|
@@ -108,16 +110,18 @@ export class PktCheckbox extends PktInputElement<Props> {
|
|
|
108
110
|
|
|
109
111
|
const tagClasses = 'pkt-tag pkt-tag--small pkt-tag--thin-text'
|
|
110
112
|
|
|
113
|
+
const formStrings = this.pktStrings.get('forms')
|
|
114
|
+
|
|
111
115
|
const tags = () => {
|
|
112
116
|
return html`
|
|
113
117
|
${this.tagText
|
|
114
118
|
? html`<span class=${tagClasses + ' pkt-tag--gray'}>${this.tagText}</span>`
|
|
115
119
|
: nothing}
|
|
116
120
|
${this.optionalTag
|
|
117
|
-
? html`<span class=${tagClasses + ' pkt-tag--blue-light'}>${this.optionalText}</span>`
|
|
121
|
+
? html`<span class=${tagClasses + ' pkt-tag--blue-light'}>${this.optionalText ?? formStrings.optional}</span>`
|
|
118
122
|
: nothing}
|
|
119
123
|
${this.requiredTag
|
|
120
|
-
? html`<span class=${tagClasses + ' pkt-tag--beige'}>${this.requiredText}</span>`
|
|
124
|
+
? html`<span class=${tagClasses + ' pkt-tag--beige'}>${this.requiredText ?? formStrings.required}</span>`
|
|
121
125
|
: nothing}
|
|
122
126
|
`
|
|
123
127
|
}
|
|
@@ -7,6 +7,7 @@ import specs from 'componentSpecs/combobox.json'
|
|
|
7
7
|
|
|
8
8
|
import type { IPktComboboxOption, TPktComboboxTagPlacement } from './combobox-types'
|
|
9
9
|
import PktListbox from '../listbox'
|
|
10
|
+
import type { TComboboxMessageKey } from 'shared-utils/combobox'
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Base class for PktCombobox.
|
|
@@ -42,7 +43,7 @@ export class ComboboxBase extends PktInputElement {
|
|
|
42
43
|
@state() override _options: IPktComboboxOption[] = []
|
|
43
44
|
@state() protected _value: string[] = []
|
|
44
45
|
@state() protected _isOptionsOpen = false
|
|
45
|
-
@state() protected _userInfoMessage:
|
|
46
|
+
@state() protected _userInfoMessage: TComboboxMessageKey = ''
|
|
46
47
|
@state() protected _addValueText: string | null = null
|
|
47
48
|
@state() protected _maxIsReached: boolean = false
|
|
48
49
|
@state() protected _search: string = ''
|