@oslokommune/punkt-elements 17.1.3 → 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 +18 -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,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as s } from "./class-map-
|
|
3
|
-
import "./icon-
|
|
4
|
-
import { t as c } from "./if-defined-
|
|
1
|
+
import { _ as e, d as t, h as n, l as r, n as i, t as a, u as o } from "./element-BKSPVgs2.js";
|
|
2
|
+
import { t as s } from "./class-map-F1DJHyb7.js";
|
|
3
|
+
import "./icon-HYU1f54x.js";
|
|
4
|
+
import { t as c } from "./if-defined-BF8XcDi5.js";
|
|
5
5
|
import { t as l } from "./focus-modality-controller-Dc2S-KqR.js";
|
|
6
6
|
//#region src/components/searchinput/searchinput.ts
|
|
7
|
-
var u = class extends
|
|
7
|
+
var u = class extends a {
|
|
8
8
|
constructor(...e) {
|
|
9
|
-
super(...e), this.appearance = "local", this.inputSize = "medium", this.disabled = !1, this.fullwidth = !1, this.id = "", this.
|
|
9
|
+
super(...e), this.appearance = "local", this.inputSize = "medium", this.disabled = !1, this.fullwidth = !1, this.id = "", this.value = "", this.focusModality = new l(this, ".pkt-searchinput");
|
|
10
10
|
}
|
|
11
11
|
willUpdate(e) {
|
|
12
12
|
super.willUpdate(e);
|
|
@@ -45,32 +45,32 @@ var u = class extends o {
|
|
|
45
45
|
});
|
|
46
46
|
this.dispatchEvent(r) || e.preventDefault();
|
|
47
47
|
}
|
|
48
|
-
renderSuggestion(
|
|
49
|
-
let
|
|
50
|
-
${
|
|
51
|
-
${
|
|
48
|
+
renderSuggestion(t, r) {
|
|
49
|
+
let i = e`
|
|
50
|
+
${t.title ? e`<h3 class="pkt-searchinput__suggestion-title">${t.title}</h3>` : n}
|
|
51
|
+
${t.text ? e`<p class="pkt-searchinput__suggestion-text">${t.text}</p>` : n}
|
|
52
52
|
`;
|
|
53
|
-
return
|
|
54
|
-
href=${
|
|
53
|
+
return t.href ? e`<a
|
|
54
|
+
href=${t.href}
|
|
55
55
|
class="pkt-searchinput__suggestion"
|
|
56
|
-
@click=${(
|
|
56
|
+
@click=${(e) => this.onSuggestionClick(e, t, r)}
|
|
57
57
|
>
|
|
58
|
-
${
|
|
59
|
-
</a>` :
|
|
58
|
+
${i}
|
|
59
|
+
</a>` : t.nonInteractive ? e`<div class="pkt-searchinput__suggestion">${i}</div>` : e`<button
|
|
60
60
|
type="button"
|
|
61
61
|
class="pkt-searchinput__suggestion"
|
|
62
|
-
@click=${(
|
|
62
|
+
@click=${(e) => this.onSuggestionClick(e, t, r)}
|
|
63
63
|
>
|
|
64
|
-
${
|
|
64
|
+
${i}
|
|
65
65
|
</button>`;
|
|
66
66
|
}
|
|
67
67
|
render() {
|
|
68
|
-
let
|
|
68
|
+
let t = this.pktStrings.get("searchinput"), r = s({
|
|
69
69
|
"pkt-searchinput": !0,
|
|
70
70
|
[`pkt-searchinput--${this.appearance}`]: !0,
|
|
71
71
|
[`pkt-searchinput--${this.inputSize}`]: !0,
|
|
72
72
|
"pkt-searchinput--fullwidth": this.fullwidth
|
|
73
|
-
}),
|
|
73
|
+
}), i = s({
|
|
74
74
|
"pkt-searchinput__button": !0,
|
|
75
75
|
"pkt-input-icon": this.appearance === "local",
|
|
76
76
|
"pkt-btn": !0,
|
|
@@ -79,73 +79,73 @@ var u = class extends o {
|
|
|
79
79
|
"pkt-btn--tertiary": this.appearance === "local",
|
|
80
80
|
"pkt-btn--primary": this.appearance === "global" || this.appearance === "local-with-button",
|
|
81
81
|
"pkt-btn--yellow": this.appearance === "global"
|
|
82
|
-
}),
|
|
82
|
+
}), a = s({
|
|
83
83
|
"pkt-input": !0,
|
|
84
84
|
[`pkt-input--${this.inputSize}`]: !0,
|
|
85
85
|
"pkt-input--fullwidth": this.fullwidth
|
|
86
|
-
}),
|
|
87
|
-
${this.label ?
|
|
86
|
+
}), o = this.appearance === "local" ? `pkt-input__container pkt-input__container--${this.inputSize}` : "pkt-searchinput__field", l = e`
|
|
87
|
+
${this.label ? e`<label for=${c(this.id || void 0)} class="pkt-inputwrapper__label"
|
|
88
88
|
>${this.label}</label
|
|
89
|
-
>` :
|
|
90
|
-
<div class=${
|
|
89
|
+
>` : n}
|
|
90
|
+
<div class=${o}>
|
|
91
91
|
<input
|
|
92
|
-
class=${
|
|
92
|
+
class=${a}
|
|
93
93
|
type="search"
|
|
94
94
|
name=${this.name || this.id}
|
|
95
95
|
id=${this.id}
|
|
96
|
-
placeholder=${this.placeholder ||
|
|
96
|
+
placeholder=${this.placeholder || t.placeholder}
|
|
97
97
|
.value=${this.value}
|
|
98
98
|
?disabled=${this.disabled}
|
|
99
99
|
autocomplete="off"
|
|
100
100
|
aria-label=${c(this.inputAriaLabel)}
|
|
101
|
-
aria-autocomplete=${this.suggestions ? "list" :
|
|
102
|
-
aria-controls=${this.suggestions ? this.suggestionsId :
|
|
101
|
+
aria-autocomplete=${this.suggestions ? "list" : n}
|
|
102
|
+
aria-controls=${this.suggestions ? this.suggestionsId : n}
|
|
103
103
|
@input=${this.onInput}
|
|
104
104
|
@keydown=${this.onInputKeydown}
|
|
105
105
|
/>
|
|
106
106
|
<button
|
|
107
107
|
type="submit"
|
|
108
|
-
class=${
|
|
108
|
+
class=${i}
|
|
109
109
|
?disabled=${this.disabled}
|
|
110
110
|
@click=${this.onSearchClick}
|
|
111
111
|
>
|
|
112
112
|
<pkt-icon class="pkt-btn__icon" name="magnifying-glass-big"></pkt-icon>
|
|
113
|
-
<span class="pkt-btn__text">${this.label || this.placeholder ||
|
|
113
|
+
<span class="pkt-btn__text">${this.label || this.placeholder || t.placeholder}</span>
|
|
114
114
|
</button>
|
|
115
115
|
</div>
|
|
116
|
-
${this.suggestions ?
|
|
116
|
+
${this.suggestions ? e`<ul
|
|
117
117
|
id=${this.suggestionsId}
|
|
118
118
|
class="pkt-searchinput__suggestions"
|
|
119
119
|
aria-live="assertive"
|
|
120
120
|
>
|
|
121
|
-
${this.suggestions.map((
|
|
122
|
-
</ul>` :
|
|
121
|
+
${this.suggestions.map((t, n) => e` <li>${this.renderSuggestion(t, n)}</li> `)}
|
|
122
|
+
</ul>` : n}
|
|
123
123
|
`;
|
|
124
|
-
return this.action ?
|
|
124
|
+
return this.action ? e`<form
|
|
125
125
|
role="search"
|
|
126
|
-
class=${
|
|
126
|
+
class=${r}
|
|
127
127
|
action=${this.action}
|
|
128
128
|
method=${c(this.method)}
|
|
129
129
|
>
|
|
130
|
-
${
|
|
131
|
-
</form>` :
|
|
130
|
+
${l}
|
|
131
|
+
</form>` : e`<div role="search" class=${r}>${l}</div>`;
|
|
132
132
|
}
|
|
133
133
|
};
|
|
134
|
-
|
|
134
|
+
i([o({ type: String })], u.prototype, "appearance", void 0), i([o({
|
|
135
135
|
type: String,
|
|
136
136
|
attribute: "input-size"
|
|
137
|
-
})], u.prototype, "inputSize", void 0),
|
|
137
|
+
})], u.prototype, "inputSize", void 0), i([o({
|
|
138
138
|
type: Boolean,
|
|
139
139
|
reflect: !0
|
|
140
|
-
})], u.prototype, "disabled", void 0),
|
|
140
|
+
})], u.prototype, "disabled", void 0), i([o({
|
|
141
141
|
type: Boolean,
|
|
142
142
|
reflect: !0
|
|
143
|
-
})], u.prototype, "fullwidth", void 0),
|
|
143
|
+
})], u.prototype, "fullwidth", void 0), i([o({
|
|
144
144
|
type: String,
|
|
145
145
|
reflect: !0
|
|
146
|
-
})], u.prototype, "id", void 0),
|
|
146
|
+
})], u.prototype, "id", void 0), i([o({ type: String })], u.prototype, "label", void 0), i([o({ type: String })], u.prototype, "name", void 0), i([o({ type: String })], u.prototype, "placeholder", void 0), i([o({ type: String })], u.prototype, "value", void 0), i([o({ type: Array })], u.prototype, "suggestions", void 0), i([o({ type: String })], u.prototype, "action", void 0), i([o({ type: String })], u.prototype, "method", void 0), i([r()], u.prototype, "inputAriaLabel", void 0);
|
|
147
147
|
try {
|
|
148
|
-
|
|
148
|
+
t("pkt-searchinput")(u);
|
|
149
149
|
} catch {
|
|
150
150
|
console.warn("Forsøker å definere <pkt-searchinput>, men den er allerede definert");
|
|
151
151
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-B8OGznK0.cjs"),t=require("./element-with-slot-DTxILHVv.cjs"),n=require("./if-defined-CVYApOgK.cjs"),r=require("./ref-CHbJYtKE.cjs"),i=require("./input-element-DumGj_oJ.cjs"),a=require("./pkt-options-controller-CEEAqXaB.cjs"),o=require("./input-wrapper-DDfapoRX.cjs");var s=class extends i.t{constructor(...e){super(...e),this._optionsProp=[],this._options=[]}get options(){return this._options.map(e=>({...e,selected:this.isOptionSelected(e)}))}set options(e){this._optionsProp=e,this.requestUpdate(`_optionsProp`,this._options)}isOptionSelected(e){return Array.isArray(this.value)?this.value.includes(e.value):e.value===this.value}findOptionByValue(e){return this._options.find(t=>t.value===e)}getSelectedOptions(){return this._options.filter(e=>this.isOptionSelected(e))}parseOptions(){let e=this._optionsProp.length>0,t=this.optionsController?.nodes?.length&&this.optionsController.nodes.length>0;e?this._options=this._optionsProp:t&&(this._options=this.optionsController.options)}willUpdate(e){super.willUpdate(e),this.parseOptions()}};e.n([e.u({type:Array,attribute:`options`})],s.prototype,`_optionsProp`,void 0),e.n([e.l()],s.prototype,`_options`,void 0);var c=class extends s{constructor(){super(),this.inputRef=r.t(),this.value=``,this.selectedIndex=-1,this.selectedOptions=void 0,this.optionsController=new a.t(this)}connectedCallback(){super.connectedCallback(),this.parseOptions(),this._options.forEach(e=>{e.selected&&!this.value&&(this.value=e.value)})}add(e,t){let n={value:e.value||e.text,label:e.text||e.value,selected:e.selected,disabled:e.disabled};if(t===void 0)this._options.push(n);else if(typeof t==`number`)this._options.splice(t,0,n);else{let e=t.value||t.text,r=this._options.findIndex(t=>t.value===e);r>=0?this._options.splice(r,0,n):this._options.push(n)}e.selected&&(this.value=e.value||e.text,this.selectedIndex=this._options.findIndex(e=>e.value===this.value)),this.requestUpdate()}remove(e){typeof e==`number`&&(this.selectedIndex===e&&(this.value=this._options[0]?.value||``),this._options.splice(e,1),this.requestUpdate())}item(e){return this.inputRef.value?.item(e)}namedItem(e){return this.inputRef.value?.namedItem(e)}showPicker(){this.inputRef.value&&`showPicker`in this.inputRef.value&&this.inputRef.value.showPicker()}attributeChangedCallback(e,t,n){e===`options`&&(this._options=n?JSON.parse(n):[]),e===`value`&&this.value!==t&&(this.selectedIndex=this.touched?this.returnNumberOrNull(this.inputRef.value?.selectedIndex):this._options.findIndex(e=>e.value===n),this.selectedOptions=this.inputRef.value?.selectedOptions,this.valueChanged(n,t)),super.attributeChangedCallback(e,t,n)}update(e){super.update(e),e.has(`_optionsProp`)&&this._optionsProp.length>0&&(this._options=this._optionsProp,this.requestUpdate(`_options`),!this.value&&this._options.length>0&&(this.value=this._options[0].value,this.selectedIndex=0)),e.has(`value`)&&this.value!==e.get(`value`)&&(this.selectedIndex=this.touched?this.returnNumberOrNull(this.inputRef.value?.selectedIndex):this._options.findIndex(e=>e.value===this.value),this.selectedOptions=this.inputRef.value?.selectedOptions,this.valueChanged(this.value,e.get(`value`))),e.has(`id`)&&!this.name&&this.id&&(this.name=this.id)}firstUpdated(e){super.firstUpdated(e),this.classList.add(`pkt-select`),this._optionsProp.length&&(this._options=this._optionsProp),!this.value&&this._options.length>0?(this.value=this._options[0].value,this.selectedIndex=0):this.selectedIndex=this._options.findIndex(e=>e.value===this.value),this.selectedOptions=this.inputRef.value?.selectedOptions}render(){let i=`pkt-input pkt-input--${this.inputSize} ${this.fullwidth?`pkt-input--fullwidth`:``}`;return e._`
|
|
2
2
|
<pkt-input-wrapper
|
|
3
|
+
.strings=${this.strings}
|
|
3
4
|
.size=${this.inputSize}
|
|
4
5
|
?disabled=${this.disabled}
|
|
5
6
|
?hasError=${this.hasError}
|
|
@@ -35,7 +36,7 @@ const e=require("./element-BA8v6S7z.cjs"),t=require("./element-with-slot-Bj7nm7f
|
|
|
35
36
|
@blur=${e=>{this.onBlur(),e.stopImmediatePropagation()}}
|
|
36
37
|
${r.n(this.inputRef)}
|
|
37
38
|
>
|
|
38
|
-
${this._options.length>0?this._options.map(t=>e.
|
|
39
|
+
${this._options.length>0?this._options.map(t=>e._`<option
|
|
39
40
|
value=${t.value}
|
|
40
41
|
?selected=${this.value==t.value||t.selected}
|
|
41
42
|
?disabled=${t.disabled}
|
|
@@ -46,4 +47,4 @@ const e=require("./element-BA8v6S7z.cjs"),t=require("./element-with-slot-Bj7nm7f
|
|
|
46
47
|
</select>
|
|
47
48
|
<div class="pkt-contents" slot="helptext">${t.n(this,`helptext`)}</div>
|
|
48
49
|
</pkt-input-wrapper>
|
|
49
|
-
`}returnNumberOrNull(e){return e==null||isNaN(e)?null:e}};e.n([e.
|
|
50
|
+
`}returnNumberOrNull(e){return e==null||isNaN(e)?null:e}};e.n([e.u({type:String})],c.prototype,`value`,void 0);try{e.d(`pkt-select`)(c)}catch{console.warn(`Forsøker å definere <pkt-select>, men den er allerede definert`)}var l=c;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as a } from "./element-with-slot-
|
|
3
|
-
import { t as o } from "./if-defined-
|
|
4
|
-
import { n as s, t as c } from "./ref-
|
|
5
|
-
import { t as l } from "./input-element-
|
|
6
|
-
import { t as u } from "./pkt-options-controller-
|
|
7
|
-
import { r as d } from "./input-wrapper-
|
|
1
|
+
import { _ as e, d as t, l as n, n as r, u as i } from "./element-BKSPVgs2.js";
|
|
2
|
+
import { n as a } from "./element-with-slot-YUAUFRqw.js";
|
|
3
|
+
import { t as o } from "./if-defined-BF8XcDi5.js";
|
|
4
|
+
import { n as s, t as c } from "./ref-Chc_DZAb.js";
|
|
5
|
+
import { t as l } from "./input-element-D07DmR34.js";
|
|
6
|
+
import { t as u } from "./pkt-options-controller-PtjhmTGk.js";
|
|
7
|
+
import { r as d } from "./input-wrapper-Cci_wTvD.js";
|
|
8
8
|
//#region src/base-elements/options-input-element.ts
|
|
9
9
|
var f = class extends l {
|
|
10
10
|
constructor(...e) {
|
|
@@ -36,10 +36,10 @@ var f = class extends l {
|
|
|
36
36
|
super.willUpdate(e), this.parseOptions();
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
-
|
|
39
|
+
r([i({
|
|
40
40
|
type: Array,
|
|
41
41
|
attribute: "options"
|
|
42
|
-
})], f.prototype, "_optionsProp", void 0),
|
|
42
|
+
})], f.prototype, "_optionsProp", void 0), r([n()], f.prototype, "_options", void 0);
|
|
43
43
|
//#endregion
|
|
44
44
|
//#region src/components/select/select.ts
|
|
45
45
|
var p = class extends f {
|
|
@@ -88,9 +88,10 @@ var p = class extends f {
|
|
|
88
88
|
super.firstUpdated(e), this.classList.add("pkt-select"), this._optionsProp.length && (this._options = this._optionsProp), !this.value && this._options.length > 0 ? (this.value = this._options[0].value, this.selectedIndex = 0) : this.selectedIndex = this._options.findIndex((e) => e.value === this.value), this.selectedOptions = this.inputRef.value?.selectedOptions;
|
|
89
89
|
}
|
|
90
90
|
render() {
|
|
91
|
-
let
|
|
92
|
-
return
|
|
91
|
+
let t = `pkt-input pkt-input--${this.inputSize} ${this.fullwidth ? "pkt-input--fullwidth" : ""}`;
|
|
92
|
+
return e`
|
|
93
93
|
<pkt-input-wrapper
|
|
94
|
+
.strings=${this.strings}
|
|
94
95
|
.size=${this.inputSize}
|
|
95
96
|
?disabled=${this.disabled}
|
|
96
97
|
?hasError=${this.hasError}
|
|
@@ -111,7 +112,7 @@ var p = class extends f {
|
|
|
111
112
|
tagText=${o(this.tagText)}
|
|
112
113
|
>
|
|
113
114
|
<select
|
|
114
|
-
class=${
|
|
115
|
+
class=${t}
|
|
115
116
|
aria-invalid=${this.hasError}
|
|
116
117
|
aria-errormessage=${o(this.hasError ? `${this.id}-input-error` : void 0)}
|
|
117
118
|
aria-describedby=${o(d({
|
|
@@ -139,13 +140,13 @@ var p = class extends f {
|
|
|
139
140
|
}}
|
|
140
141
|
${s(this.inputRef)}
|
|
141
142
|
>
|
|
142
|
-
${this._options.length > 0 ? this._options.map((
|
|
143
|
-
value=${
|
|
144
|
-
?selected=${this.value ==
|
|
145
|
-
?disabled=${
|
|
146
|
-
?hidden=${
|
|
143
|
+
${this._options.length > 0 ? this._options.map((t) => e`<option
|
|
144
|
+
value=${t.value}
|
|
145
|
+
?selected=${this.value == t.value || t.selected}
|
|
146
|
+
?disabled=${t.disabled}
|
|
147
|
+
?hidden=${t.hidden}
|
|
147
148
|
>
|
|
148
|
-
${
|
|
149
|
+
${t.label}
|
|
149
150
|
</option>`) : ""}
|
|
150
151
|
</select>
|
|
151
152
|
<div class="pkt-contents" slot="helptext">${a(this, "helptext")}</div>
|
|
@@ -156,9 +157,9 @@ var p = class extends f {
|
|
|
156
157
|
return e == null || isNaN(e) ? null : e;
|
|
157
158
|
}
|
|
158
159
|
};
|
|
159
|
-
|
|
160
|
+
r([i({ type: String })], p.prototype, "value", void 0);
|
|
160
161
|
try {
|
|
161
|
-
|
|
162
|
+
t("pkt-select")(p);
|
|
162
163
|
} catch {
|
|
163
164
|
console.warn("Forsøker å definere <pkt-select>, men den er allerede definert");
|
|
164
165
|
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tekster og informasjonskapsel-oppsett for samtykkedialogen.
|
|
3
|
+
*
|
|
4
|
+
* Denne ligger utenfor `nb.ts` fordi formen er en annen: en liste med
|
|
5
|
+
* informasjonskapsler som hver har egne tekster per språk, ikke et flatt
|
|
6
|
+
* namespace. Den deles av Elements og React slik at de to ikke kommer i utakt.
|
|
7
|
+
*/
|
|
8
|
+
export declare const consentStrings: {
|
|
9
|
+
i18n: {
|
|
10
|
+
nb: {
|
|
11
|
+
contentPresentation: {
|
|
12
|
+
title: string;
|
|
13
|
+
description: string[];
|
|
14
|
+
buttons: {
|
|
15
|
+
accept: string;
|
|
16
|
+
reject: string;
|
|
17
|
+
settings: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
contentSettings: {
|
|
21
|
+
title: string;
|
|
22
|
+
description: string[];
|
|
23
|
+
buttons: {
|
|
24
|
+
back: string;
|
|
25
|
+
save: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
en: {
|
|
30
|
+
contentPresentation: {
|
|
31
|
+
title: string;
|
|
32
|
+
description: string[];
|
|
33
|
+
buttons: {
|
|
34
|
+
accept: string;
|
|
35
|
+
reject: string;
|
|
36
|
+
settings: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
contentSettings: {
|
|
40
|
+
title: string;
|
|
41
|
+
description: string[];
|
|
42
|
+
buttons: {
|
|
43
|
+
back: string;
|
|
44
|
+
save: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
cookies: {
|
|
50
|
+
name: string;
|
|
51
|
+
defaultValue: boolean;
|
|
52
|
+
i18n: {
|
|
53
|
+
nb: {
|
|
54
|
+
title: string;
|
|
55
|
+
description: string;
|
|
56
|
+
buttons: {
|
|
57
|
+
yes: string;
|
|
58
|
+
no: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
en: {
|
|
62
|
+
title: string;
|
|
63
|
+
description: string;
|
|
64
|
+
buttons: {
|
|
65
|
+
yes: string;
|
|
66
|
+
no: string;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
}[];
|
|
71
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TPktStringParams } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Setter verdier inn i `{navn}`-plassholdere.
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* formatString('Verdien må være større enn eller lik {min}.', { min: 5 })
|
|
7
|
+
* // → 'Verdien må være større enn eller lik 5.'
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* En plassholder uten tilsvarende verdi blir stående urørt, slik at en ufullstendig
|
|
11
|
+
* overstyring gir synlig, feilsøkbar tekst i stedet for et tomt felt.
|
|
12
|
+
*/
|
|
13
|
+
export declare function formatString(template: string, params?: TPktStringParams): string;
|
|
14
|
+
/**
|
|
15
|
+
* Velger entalls- eller flertallsform.
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* plural(count, s.fileLabelOne, s.fileLabelOther)
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function plural(count: number, one: string, other: string): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delt tekstkatalog for Punkt.
|
|
3
|
+
*
|
|
4
|
+
* Alle UI-tekster i designsystemet defineres i `nb.ts` og brukes derfra av både
|
|
5
|
+
* `@oslokommune/punkt-elements` og `@oslokommune/punkt-react`. Konsumenter kan
|
|
6
|
+
* overstyre tekster globalt med `setPktStrings()` eller per komponentinstans via
|
|
7
|
+
* `strings`-propen.
|
|
8
|
+
*/
|
|
9
|
+
export { nb } from './nb';
|
|
10
|
+
export { formatString, plural } from './format';
|
|
11
|
+
export { getPktStrings, resetPktStrings, setPktStrings, subscribePktStrings } from './store';
|
|
12
|
+
export { resolveNamespace, resolveStrings } from './resolve';
|
|
13
|
+
export type { TPktStringParams, TPktStrings, TPktStringsNamespace, TPktStringsOverride, TPktStringsShape, TPktStringValue, } from './types';
|
|
14
|
+
export { consentStrings } from './consent';
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
export declare const nb: {
|
|
2
|
+
/** Tekster som går igjen på tvers av flere komponenter. */
|
|
3
|
+
generic: {
|
|
4
|
+
from: string;
|
|
5
|
+
to: string;
|
|
6
|
+
close: string;
|
|
7
|
+
};
|
|
8
|
+
/** Etiketter og hjelpetekst rundt skjemafelt. */
|
|
9
|
+
forms: {
|
|
10
|
+
optional: string;
|
|
11
|
+
required: string;
|
|
12
|
+
readMore: string;
|
|
13
|
+
};
|
|
14
|
+
/** Valideringsmeldinger. Nøkkelnavnene følger `ValidityState` der det finnes et tilsvarende flagg. */
|
|
15
|
+
validation: {
|
|
16
|
+
valueMissing: string;
|
|
17
|
+
typeMismatch: string;
|
|
18
|
+
patternMismatch: string;
|
|
19
|
+
tooShort: string;
|
|
20
|
+
tooLong: string;
|
|
21
|
+
rangeUnderflow: string;
|
|
22
|
+
rangeOverflow: string;
|
|
23
|
+
rangeUnderflowMin: string;
|
|
24
|
+
rangeOverflowMax: string;
|
|
25
|
+
stepMismatch: string;
|
|
26
|
+
timeStepMismatch: string;
|
|
27
|
+
timeStepMismatchHour: string;
|
|
28
|
+
timeStepMismatchHalfHour: string;
|
|
29
|
+
dateUnderflow: string;
|
|
30
|
+
dateOverflow: string;
|
|
31
|
+
counterExceeded: string;
|
|
32
|
+
};
|
|
33
|
+
/** Måneds- og dagsnavn. Listene må ha henholdsvis 12 og 7 elementer. */
|
|
34
|
+
dates: {
|
|
35
|
+
month: string;
|
|
36
|
+
year: string;
|
|
37
|
+
week: string;
|
|
38
|
+
days: string[];
|
|
39
|
+
daysShort: string[];
|
|
40
|
+
months: string[];
|
|
41
|
+
monthsShort: string[];
|
|
42
|
+
};
|
|
43
|
+
calendar: {
|
|
44
|
+
prevMonth: string;
|
|
45
|
+
nextMonth: string;
|
|
46
|
+
};
|
|
47
|
+
datepicker: {
|
|
48
|
+
openPicker: string;
|
|
49
|
+
deleteDate: string;
|
|
50
|
+
};
|
|
51
|
+
timepicker: {
|
|
52
|
+
hours: string;
|
|
53
|
+
minutes: string;
|
|
54
|
+
openPicker: string;
|
|
55
|
+
prevTime: string;
|
|
56
|
+
nextTime: string;
|
|
57
|
+
selectTime: string;
|
|
58
|
+
};
|
|
59
|
+
searchinput: {
|
|
60
|
+
placeholder: string;
|
|
61
|
+
submit: string;
|
|
62
|
+
};
|
|
63
|
+
backlink: {
|
|
64
|
+
label: string;
|
|
65
|
+
};
|
|
66
|
+
breadcrumbs: {
|
|
67
|
+
ariaLabel: string;
|
|
68
|
+
};
|
|
69
|
+
tag: {
|
|
70
|
+
remove: string;
|
|
71
|
+
};
|
|
72
|
+
header: {
|
|
73
|
+
search: string;
|
|
74
|
+
menu: string;
|
|
75
|
+
openMenu: string;
|
|
76
|
+
openSearch: string;
|
|
77
|
+
};
|
|
78
|
+
listbox: {
|
|
79
|
+
searchLabel: string;
|
|
80
|
+
searchPlaceholder: string;
|
|
81
|
+
};
|
|
82
|
+
combobox: {
|
|
83
|
+
noResults: string;
|
|
84
|
+
maxSelected: string;
|
|
85
|
+
tooManySelected: string;
|
|
86
|
+
alreadySelected: string;
|
|
87
|
+
valueAdded: string;
|
|
88
|
+
noValidValue: string;
|
|
89
|
+
};
|
|
90
|
+
fileupload: {
|
|
91
|
+
dropZoneDragMultiple: string;
|
|
92
|
+
dropZoneDragSingle: string;
|
|
93
|
+
dropZoneDragMultipleThumbnail: string;
|
|
94
|
+
dropZoneDragSingleThumbnail: string;
|
|
95
|
+
dropZoneDragActiveMultiple: string;
|
|
96
|
+
dropZoneDragActiveSingle: string;
|
|
97
|
+
dropZoneDragActiveMultipleThumbnail: string;
|
|
98
|
+
dropZoneDragActiveSingleThumbnail: string;
|
|
99
|
+
dropZoneOpenFileDialogMultiple: string;
|
|
100
|
+
dropZoneOpenFileDialogSingle: string;
|
|
101
|
+
dropZoneOpenFileDialogMultipleThumbnail: string;
|
|
102
|
+
dropZoneOpenFileDialogSingleThumbnail: string;
|
|
103
|
+
supportedFormatsPrefix: string;
|
|
104
|
+
invalidFormat: string;
|
|
105
|
+
sizeTooLarge: string;
|
|
106
|
+
requiredMissing: string;
|
|
107
|
+
genericValidationRejection: string;
|
|
108
|
+
unknownFilename: string;
|
|
109
|
+
previewFallbackName: string;
|
|
110
|
+
previewImage: string;
|
|
111
|
+
fileLabelOne: string;
|
|
112
|
+
fileLabelOther: string;
|
|
113
|
+
srFileAdded: string;
|
|
114
|
+
srFilesAdded: string;
|
|
115
|
+
srFilesUploadedOfTotal: string;
|
|
116
|
+
srFilesFailedOfTotal: string;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TPktStrings, TPktStringsNamespace, TPktStringsOverride } from './types';
|
|
2
|
+
/** Slår opp ett namespace. */
|
|
3
|
+
export declare function resolveNamespace<K extends TPktStringsNamespace>(ns: K, ...layers: Array<TPktStringsOverride | undefined>): TPktStrings[K];
|
|
4
|
+
/**
|
|
5
|
+
* Slår opp flere namespace på én gang.
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* const s = resolveStrings(['forms', 'validation'], this.strings)
|
|
9
|
+
* s.forms.optional
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveStrings<NS extends TPktStringsNamespace>(namespaces: readonly NS[], ...layers: Array<TPktStringsOverride | undefined>): Pick<TPktStrings, NS>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { TPktStringsOverride } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Global tekstoverstyring. Tilstanden ligger på `globalThis` bak en
|
|
4
|
+
* `Symbol.for()`-nøkkel, slik at `punkt-react` og `punkt-elements` deler én og
|
|
5
|
+
* samme store på tvers av modulgrafer.
|
|
6
|
+
*/
|
|
7
|
+
type TListener = () => void;
|
|
8
|
+
/**
|
|
9
|
+
* Overstyrer tekster for hele applikasjonen. Kall det én gang ved oppstart.
|
|
10
|
+
* Flere kall merges sammen, namespace for namespace.
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* setPktStrings({ forms: { optional: 'Frivillig' } })
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function setPktStrings(overrides: TPktStringsOverride): void;
|
|
17
|
+
/**
|
|
18
|
+
* Gjeldende globale overstyringer. Identiteten endrer seg ved hvert
|
|
19
|
+
* `setPktStrings()`-kall, så den kan brukes direkte som snapshot i
|
|
20
|
+
* `useSyncExternalStore`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getPktStrings(): TPktStringsOverride;
|
|
23
|
+
/** Nullstiller til de innebygde tekstene. Ment for tester. */
|
|
24
|
+
export declare function resetPktStrings(): void;
|
|
25
|
+
/** Abonnerer på endringer. Returnerer en funksjon som melder av. */
|
|
26
|
+
export declare function subscribePktStrings(listener: TListener): () => void;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typene for tekstkatalogen. Katalogen er nøyaktig to nivåer dyp:
|
|
3
|
+
* namespace → nøkkel → string | string[].
|
|
4
|
+
*/
|
|
5
|
+
import type { nb } from './nb';
|
|
6
|
+
/** En enkelt tekstverdi. Lister brukes for måneds- og dagsnavn. */
|
|
7
|
+
export type TPktStringValue = string | readonly string[];
|
|
8
|
+
/** Formen alle språkbundler må følge. */
|
|
9
|
+
export type TPktStringsShape = Record<string, Record<string, TPktStringValue>>;
|
|
10
|
+
/**
|
|
11
|
+
* Hele katalogen, utledet fra bokmålsbundelen slik at `nb.ts` er det eneste
|
|
12
|
+
* stedet en nøkkel defineres.
|
|
13
|
+
*/
|
|
14
|
+
export type TPktStrings = typeof nb;
|
|
15
|
+
/** Navnet på et namespace i katalogen, f.eks. `'forms'` eller `'searchinput'`. */
|
|
16
|
+
export type TPktStringsNamespace = keyof TPktStrings;
|
|
17
|
+
/**
|
|
18
|
+
* Delvis overstyring av katalogen. Generisk over namespace slik at en komponent
|
|
19
|
+
* kan smalne typen til de namespacene den faktisk bruker:
|
|
20
|
+
*
|
|
21
|
+
* ```ts
|
|
22
|
+
* strings?: TPktStringsOverride<'forms' | 'validation' | 'searchinput'>
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export type TPktStringsOverride<NS extends TPktStringsNamespace = TPktStringsNamespace> = {
|
|
26
|
+
[K in NS]?: Partial<TPktStrings[K]>;
|
|
27
|
+
};
|
|
28
|
+
/** Verdier som kan settes inn i en `{plassholder}`. */
|
|
29
|
+
export type TPktStringParams = Record<string, string | number>;
|
|
@@ -44,30 +44,3 @@ export interface IFilesChangedDetail {
|
|
|
44
44
|
reason: TFilesChangedReason;
|
|
45
45
|
changedFileIds?: string[];
|
|
46
46
|
}
|
|
47
|
-
/** Default Norwegian Bokmål strings used by both implementations. */
|
|
48
|
-
export interface IFileUploadStrings {
|
|
49
|
-
dropZoneDragMultiple: string;
|
|
50
|
-
dropZoneDragSingle: string;
|
|
51
|
-
dropZoneDragMultipleThumbnail: string;
|
|
52
|
-
dropZoneDragSingleThumbnail: string;
|
|
53
|
-
dropZoneDragActiveMultiple: string;
|
|
54
|
-
dropZoneDragActiveSingle: string;
|
|
55
|
-
dropZoneDragActiveMultipleThumbnail: string;
|
|
56
|
-
dropZoneDragActiveSingleThumbnail: string;
|
|
57
|
-
dropZoneOpenFileDialogMultiple: string;
|
|
58
|
-
dropZoneOpenFileDialogSingle: string;
|
|
59
|
-
dropZoneOpenFileDialogMultipleThumbnail: string;
|
|
60
|
-
dropZoneOpenFileDialogSingleThumbnail: string;
|
|
61
|
-
supportedFormatsPrefix: string;
|
|
62
|
-
invalidFormatDefault: (formats: string) => string;
|
|
63
|
-
sizeTooLargeDefault: (maxSize: string) => string;
|
|
64
|
-
requiredMissing: string;
|
|
65
|
-
genericValidationRejection: string;
|
|
66
|
-
unknownFilename: string;
|
|
67
|
-
fileLabel: (count: number) => string;
|
|
68
|
-
srFileAdded: (filename: string) => string;
|
|
69
|
-
srFilesAdded: (count: number) => string;
|
|
70
|
-
srFilesUploadedOfTotal: (uploaded: number, total: number, label: string) => string;
|
|
71
|
-
srFilesFailedOfTotal: (failed: number, total: number, label: string) => string;
|
|
72
|
-
}
|
|
73
|
-
export declare const defaultFileUploadStrings: IFileUploadStrings;
|
|
@@ -21,5 +21,4 @@ export type { TProgressbarRole, TProgressbarSkin, TProgressbarStatusPlacement, T
|
|
|
21
21
|
export type { IPktComboboxOption, TPktComboboxTagSkin, TPktComboboxDisplayValue, TPktComboboxTagPlacement, } from './combobox';
|
|
22
22
|
export type { IPktSelectOption, TSelectOption } from './select';
|
|
23
23
|
export type { TPktSearchInputAppearance, TPktSearchInputMethod, IPktSearchInputSuggestion, IPktSearchInput, } from './searchinput';
|
|
24
|
-
export type { TUploadStrategy as TFileUploadStrategy, TFileUploadItemRenderer, TFilesChangedReason, TFileValidator, TTransferProgress, IFileItem, IFileTransfer, IFileValidateDetail, ITransferCancelledDetail, IFilesChangedDetail,
|
|
25
|
-
export { defaultFileUploadStrings } from './fileupload';
|
|
24
|
+
export type { TUploadStrategy as TFileUploadStrategy, TFileUploadItemRenderer, TFilesChangedReason, TFileValidator, TTransferProgress, IFileItem, IFileTransfer, IFileValidateDetail, ITransferCancelledDetail, IFilesChangedDetail, } from './fileupload';
|
|
@@ -8,3 +8,4 @@ export { isLetterOrSpace, createTypeaheadHandler, findTypeaheadOptionMatch } fro
|
|
|
8
8
|
export { getInputKeyAction, isArrowToggleKey, getInputValueAction, checkForMatches, getSingleValueForInput, } from './input-utils';
|
|
9
9
|
export type { TInputKeyAction, TFocusOutAction, IFocusOutResult, ICheckForMatchesResult, } from './input-utils';
|
|
10
10
|
export { focusAndScrollIntoView, getOptionElements, focusNextOption, focusPreviousOption, focusFirstOption, focusLastOption, focusFirstOrSelectedOption, } from './keyboard-navigation';
|
|
11
|
+
export type { TComboboxMessageKey } from './messages';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TComboboxMessageKey } from './messages';
|
|
1
2
|
/**
|
|
2
3
|
* Shared combobox input utility functions used by both Elements and React packages.
|
|
3
4
|
* Covers keyboard actions, focus-out validation, match checking, and input display.
|
|
@@ -23,7 +24,7 @@ export interface IFocusOutResult {
|
|
|
23
24
|
export declare const getInputValueAction: (inputValue: string, currentValues: string[], options: IPktComboboxOption[], allowUserInput: boolean, multiple: boolean) => IFocusOutResult;
|
|
24
25
|
export interface ICheckForMatchesResult {
|
|
25
26
|
addValueText: string | null;
|
|
26
|
-
userInfoMessage:
|
|
27
|
+
userInfoMessage: TComboboxMessageKey;
|
|
27
28
|
shouldRemoveValue: boolean;
|
|
28
29
|
shouldResetInput: boolean;
|
|
29
30
|
}
|