@oslokommune/punkt-elements 17.1.3 → 18.1.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-CcUosZjL.js} +27 -27
- package/dist/{accordion-B3GBlvUC.cjs → accordion-k0pWTG1X.cjs} +5 -5
- package/dist/alert-BD8YVKia.cjs +35 -0
- package/dist/{alert-DKK_Tb9J.js → alert-Bmaly2Yo.js} +57 -52
- package/dist/{async-directive-BPf6K-V2.js → async-directive-COqx0IYj.js} +5 -5
- package/dist/{async-directive-Da7TJpnq.cjs → async-directive-DN2eg9gA.cjs} +1 -1
- package/dist/{backlink-D1y26pj3.js → backlink-C_ZO-ZbR.js} +9 -9
- package/dist/{backlink-CMmrKTe4.cjs → backlink-Ch64Pivx.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-CcTQ3Grm.js → breadcrumbs-CF_gAbUk.js} +16 -16
- package/dist/{breadcrumbs-B6JGhJgC.cjs → breadcrumbs-CzzbardP.cjs} +7 -7
- package/dist/{button-2-OSPJkj.js → button-C1CQSASU.js} +28 -28
- package/dist/{button-CE97NQIk.cjs → button-CF3dNKeI.cjs} +7 -7
- package/dist/{calendar-kn4SrtJy.cjs → calendar-BxF81kB9.cjs} +28 -27
- package/dist/{calendar-pOW3R5Pw.js → calendar-DRmxORMc.js} +82 -68
- package/dist/{card-CETDFkxR.cjs → card-Cg1daj05.cjs} +26 -26
- package/dist/{card-zQ0eKRMV.js → card-W_Jb0Tlo.js} +44 -44
- package/dist/{checkbox-CQNr_sEg.cjs → checkbox-BHQv8lHq.cjs} +11 -11
- package/dist/{checkbox-CH7NpINF.js → checkbox-BQw2dMSX.js} +23 -23
- package/dist/{class-map-BeimMvPv.cjs → class-map-C33ixq7O.cjs} +1 -1
- package/dist/{class-map-CnWCnBSX.js → class-map-wh4Yi3oj.js} +3 -3
- package/dist/{combobox-Bvg0UO9w.cjs → combobox-BpZow9OU.cjs} +19 -18
- package/dist/{combobox-CRdYYlxu.js → combobox-C9wwnUfM.js} +55 -54
- package/dist/components/accordion/accordion.d.ts +2 -6
- package/dist/components/accordion/accordionitem.d.ts +2 -8
- package/dist/components/alert/alert.d.ts +2 -2
- package/dist/components/backlink/backlink.d.ts +4 -5
- package/dist/components/backlink/backlink.test.d.ts +1 -1
- package/dist/components/breadcrumbs/breadcrumbs.d.ts +6 -7
- package/dist/components/breadcrumbs/index.d.ts +1 -1
- 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 +7 -4
- package/dist/components/fileupload/fileupload-types.d.ts +5 -43
- 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 +3 -1
- 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-CyY3RyoC.cjs → consent-CPtr7cBw.cjs} +5 -5
- package/dist/{consent-DZEkhgJ1.js → consent-D8MrqGKk.js} +10 -10
- package/dist/controllers/strings-controller.d.ts +27 -0
- package/dist/{datepicker-ButIas85.js → datepicker-D4YnAtWG.js} +104 -104
- package/dist/{datepicker-VTqSDQk5.cjs → datepicker-DaoumZT9.cjs} +38 -37
- package/dist/define-component-spec-BYOSeplU.js +6 -0
- package/dist/define-component-spec-DBNd2FJY.cjs +1 -0
- package/dist/{directive-helpers-CI8YZqku.js → directive-helpers-BWSAVe00.js} +1 -1
- package/dist/{directive-helpers-BlAV5EQD.cjs → directive-helpers-C6J4AkFk.cjs} +1 -1
- package/dist/docs/components/alert.d.ts +2 -3
- package/dist/docs/components/fileupload.d.ts +1 -0
- package/dist/element-DiFhBcIl.cjs +2 -0
- package/dist/{element-ChsFgr_B.js → element-WEzISABa.js} +241 -100
- package/dist/{element-with-slot-BvG9ctC-.js → element-with-slot-BKYUx4gb.js} +4 -4
- package/dist/{element-with-slot-Bj7nm7fO.cjs → element-with-slot-CBK4zrdN.cjs} +1 -1
- package/dist/{fileupload-D5IQ9HDe.js → fileupload-DEHSETw0.js} +340 -652
- package/dist/fileupload-DWu6FIMv.cjs +402 -0
- package/dist/{footer-DrR64HiK.js → footer-BJLEw6Ab.js} +91 -91
- package/dist/{footer-DbYQUYNR.cjs → footer-D_yYWkQ6.cjs} +32 -32
- package/dist/format-B8meU8Tm.cjs +1 -0
- package/dist/format-BTeSVkED.js +18 -0
- package/dist/{header-ClgIac6n.cjs → header-B7_4Cwaq.cjs} +84 -84
- package/dist/{header-KvJ1mGwA.js → header-DLVq7-dM.js} +267 -264
- package/dist/{header-menu-hVPXsb8g.js → header-menu-BsrrTjpT.js} +75 -75
- package/dist/{header-menu-BAsUNKSx.cjs → header-menu-m7nOOC1g.cjs} +24 -24
- package/dist/{heading-g-_IUB5T.js → heading-DSArgrDK.js} +16 -16
- package/dist/{heading-CFmiSuCQ.cjs → heading-_RPw2UW9.cjs} +1 -1
- package/dist/helptext-QMVsW5g6.cjs +27 -0
- package/dist/{helptext-DZng1D5i.js → helptext-dtVVufNH.js} +18 -19
- package/dist/{icon-D-LA22xD.js → icon-DEtOSWRK.js} +17 -17
- package/dist/{icon-9iwd2F2l.cjs → icon-DIavy2cB.cjs} +1 -1
- package/dist/{if-defined-CGzIlZ9-.js → if-defined-BmnvvxtR.js} +1 -1
- package/dist/if-defined-Dc3xFDaM.cjs +1 -0
- package/dist/input-element-DQY1Rpbp.cjs +1 -0
- package/dist/{input-element-DBMNBplu.js → input-element-IBypGOaV.js} +121 -120
- package/dist/input-wrapper-CQgAL1Br.js +308 -0
- package/dist/input-wrapper-mJZLVXy_.cjs +58 -0
- package/dist/link-DwLeY37f.js +131 -0
- package/dist/link-yk4IXDWm.cjs +7 -0
- package/dist/linkcard-BinKnxQF.cjs +13 -0
- package/dist/{linkcard-zqbg7Oqm.js → linkcard-D5DXpmXI.js} +16 -16
- package/dist/{listbox-Dc4rGdPi.cjs → listbox-C5zTRNAO.cjs} +15 -15
- package/dist/{listbox-va_E8afs.js → listbox-C8ooO8qZ.js} +100 -99
- package/dist/{loader-D_RDICnw.js → loader-C3HyayzL.js} +14 -14
- package/dist/{loader-CMUkVJmE.cjs → loader-DHF7M5Vn.cjs} +5 -5
- package/dist/{messagebox-Cv8LaSxv.cjs → messagebox-DqYf6VmQ.cjs} +5 -5
- package/dist/{messagebox-Cw-OWDya.js → messagebox-u8i3R5QA.js} +15 -15
- package/dist/{modal-BtInv031.cjs → modal-CnJ9y2TQ.cjs} +8 -8
- package/dist/{modal-D0t_X2dX.js → modal-V-jEe0aY.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-BhMNCWcc.cjs} +1 -1
- package/dist/{pkt-options-controller-B77vH3PE.js → pkt-options-controller-CuQ6SClv.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-DS4i8IWq.js} +21 -21
- package/dist/{progressbar-D5MmnQId.cjs → progressbar-DY5hxImR.cjs} +5 -5
- package/dist/{radiobutton-BUnf3EPi.js → radiobutton-BhvZztMZ.js} +24 -24
- package/dist/{radiobutton-DpsO1F-8.cjs → radiobutton-BswqwRnA.cjs} +8 -8
- package/dist/{ref-CQoEIIp0.cjs → ref-DZmN5Qgj.cjs} +1 -1
- package/dist/{ref-CWD6PjVd.js → ref-OU8ryfP6.js} +2 -2
- package/dist/{repeat-sY6B7fAT.cjs → repeat-DIa_g6WL.cjs} +1 -1
- package/dist/{repeat-C02g7d5S.js → repeat-Dx2H127b.js} +4 -4
- package/dist/{searchinput-DwnjsvJ1.js → searchinput-CJo1PpM7.js} +43 -43
- package/dist/searchinput-Cl46nW0r.cjs +60 -0
- package/dist/{select-DMre80qs.js → select-CBrjauXT.js} +21 -20
- package/dist/{select-BOJi6H6T.cjs → select-Dman8Skr.cjs} +4 -3
- 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 +121 -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 +40 -0
- package/dist/shared-types/accordion.d.ts +58 -0
- package/dist/shared-types/alert.d.ts +20 -0
- package/dist/shared-types/aria.d.ts +2 -1
- package/dist/shared-types/backlink.d.ts +23 -0
- package/dist/shared-types/breadcrumbs.d.ts +33 -0
- package/dist/shared-types/fileupload.d.ts +55 -28
- package/dist/shared-types/footer.d.ts +10 -0
- package/dist/shared-types/form-field.d.ts +45 -0
- package/dist/shared-types/header-footer.d.ts +2 -0
- package/dist/shared-types/index.d.ts +15 -6
- package/dist/shared-types/render-link.d.ts +22 -0
- package/dist/shared-types/skin.d.ts +2 -9
- 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-C1m5rSrR.cjs} +7 -7
- package/dist/{tabs-TvxgbrCF.js → tabs-Xu3mIedh.js} +32 -32
- package/dist/{tag-Ds6n1LIs.js → tag-Azkjhkeu.js} +33 -32
- package/dist/tag-BS6dDPxY.cjs +27 -0
- package/dist/tests/strings-override.test.d.ts +0 -0
- package/dist/{textarea-vfzIcXhX.js → textarea-D4qXcVGD.js} +30 -29
- package/dist/{textarea-BydiLM9Z.cjs → textarea-DftUkR6w.cjs} +3 -2
- package/dist/{textinput-DGdicNSx.cjs → textinput-Ar-1Sbqy.cjs} +13 -12
- package/dist/{textinput-CMP2jPP_.js → textinput-iCgwwNPU.js} +28 -27
- package/dist/{timepicker-ClwgYywH.js → timepicker-W6HVWtmA.js} +67 -64
- package/dist/timepicker-dpAF7h49.cjs +196 -0
- package/package.json +3 -3
- package/src/components/accordion/accordion.ts +2 -10
- package/src/components/accordion/accordionitem.ts +2 -9
- package/src/components/alert/alert.ts +19 -10
- package/src/components/backlink/backlink.test.ts +3 -3
- package/src/components/backlink/backlink.ts +5 -7
- package/src/components/breadcrumbs/breadcrumbs.ts +9 -10
- package/src/components/breadcrumbs/index.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 +29 -19
- package/src/components/fileupload/fileupload-renderers.ts +2 -1
- package/src/components/fileupload/fileupload-types.ts +5 -42
- 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 +10 -1
- package/src/components/input-wrapper/input-wrapper.ts +18 -10
- package/src/components/link/link.ts +8 -3
- 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/alert-Cs4Rmq_J.cjs +0 -33
- 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/link-D-Eqm5KH.js +0 -98
- package/dist/link-DK7gvmnj.cjs +0 -7
- 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-WEzISABa.js";
|
|
2
|
+
import { t as s } from "./class-map-wh4Yi3oj.js";
|
|
3
|
+
import "./icon-DEtOSWRK.js";
|
|
4
|
+
import { t as c } from "./if-defined-BmnvvxtR.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
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const e=require("./element-DiFhBcIl.cjs"),t=require("./class-map-C33ixq7O.cjs");require("./icon-DIavy2cB.cjs");const n=require("./if-defined-Dc3xFDaM.cjs"),r=require("./focus-modality-controller-C1ocyv2J.cjs");var i=class extends e.t{constructor(...e){super(...e),this.appearance=`local`,this.inputSize=`medium`,this.disabled=!1,this.fullwidth=!1,this.id=``,this.value=``,this.focusModality=new r.t(this,`.pkt-searchinput`)}willUpdate(e){super.willUpdate(e);let t=this.getAttribute(`aria-label`);t&&(this.inputAriaLabel=t,this.removeAttribute(`aria-label`))}get suggestionsId(){return`${this.id}-suggestions`}dispatchSearch(){this.dispatchEvent(new CustomEvent(`pkt-search`,{detail:{value:this.value},bubbles:!0,composed:!0}))}onInput(e){let t=e.target;this.value=t.value}onInputKeydown(e){e.key===`Enter`&&(this.action||e.preventDefault(),this.dispatchSearch())}onSearchClick(e){this.action||e.preventDefault(),this.dispatchSearch()}onSuggestionClick(e,t,n){let r=new CustomEvent(`pkt-suggestion-click`,{detail:{index:n,suggestion:t},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(r)||e.preventDefault()}renderSuggestion(t,n){let r=e._`
|
|
2
|
+
${t.title?e._`<h3 class="pkt-searchinput__suggestion-title">${t.title}</h3>`:e.h}
|
|
3
|
+
${t.text?e._`<p class="pkt-searchinput__suggestion-text">${t.text}</p>`:e.h}
|
|
4
|
+
`;return t.href?e._`<a
|
|
5
|
+
href=${t.href}
|
|
6
|
+
class="pkt-searchinput__suggestion"
|
|
7
|
+
@click=${e=>this.onSuggestionClick(e,t,n)}
|
|
8
|
+
>
|
|
9
|
+
${r}
|
|
10
|
+
</a>`:t.nonInteractive?e._`<div class="pkt-searchinput__suggestion">${r}</div>`:e._`<button
|
|
11
|
+
type="button"
|
|
12
|
+
class="pkt-searchinput__suggestion"
|
|
13
|
+
@click=${e=>this.onSuggestionClick(e,t,n)}
|
|
14
|
+
>
|
|
15
|
+
${r}
|
|
16
|
+
</button>`}render(){let r=this.pktStrings.get(`searchinput`),i=t.t({"pkt-searchinput":!0,[`pkt-searchinput--${this.appearance}`]:!0,[`pkt-searchinput--${this.inputSize}`]:!0,"pkt-searchinput--fullwidth":this.fullwidth}),a=t.t({"pkt-searchinput__button":!0,"pkt-input-icon":this.appearance===`local`,"pkt-btn":!0,[`pkt-btn--${this.inputSize}`]:!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":this.appearance===`local`,"pkt-btn--primary":this.appearance===`global`||this.appearance===`local-with-button`,"pkt-btn--yellow":this.appearance===`global`}),o=t.t({"pkt-input":!0,[`pkt-input--${this.inputSize}`]:!0,"pkt-input--fullwidth":this.fullwidth}),s=this.appearance===`local`?`pkt-input__container pkt-input__container--${this.inputSize}`:`pkt-searchinput__field`,c=e._`
|
|
17
|
+
${this.label?e._`<label for=${n.t(this.id||void 0)} class="pkt-inputwrapper__label"
|
|
18
|
+
>${this.label}</label
|
|
19
|
+
>`:e.h}
|
|
20
|
+
<div class=${s}>
|
|
21
|
+
<input
|
|
22
|
+
class=${o}
|
|
23
|
+
type="search"
|
|
24
|
+
name=${this.name||this.id}
|
|
25
|
+
id=${this.id}
|
|
26
|
+
placeholder=${this.placeholder||r.placeholder}
|
|
27
|
+
.value=${this.value}
|
|
28
|
+
?disabled=${this.disabled}
|
|
29
|
+
autocomplete="off"
|
|
30
|
+
aria-label=${n.t(this.inputAriaLabel)}
|
|
31
|
+
aria-autocomplete=${this.suggestions?`list`:e.h}
|
|
32
|
+
aria-controls=${this.suggestions?this.suggestionsId:e.h}
|
|
33
|
+
@input=${this.onInput}
|
|
34
|
+
@keydown=${this.onInputKeydown}
|
|
35
|
+
/>
|
|
36
|
+
<button
|
|
37
|
+
type="submit"
|
|
38
|
+
class=${a}
|
|
39
|
+
?disabled=${this.disabled}
|
|
40
|
+
@click=${this.onSearchClick}
|
|
41
|
+
>
|
|
42
|
+
<pkt-icon class="pkt-btn__icon" name="magnifying-glass-big"></pkt-icon>
|
|
43
|
+
<span class="pkt-btn__text">${this.label||this.placeholder||r.placeholder}</span>
|
|
44
|
+
</button>
|
|
45
|
+
</div>
|
|
46
|
+
${this.suggestions?e._`<ul
|
|
47
|
+
id=${this.suggestionsId}
|
|
48
|
+
class="pkt-searchinput__suggestions"
|
|
49
|
+
aria-live="assertive"
|
|
50
|
+
>
|
|
51
|
+
${this.suggestions.map((t,n)=>e._` <li>${this.renderSuggestion(t,n)}</li> `)}
|
|
52
|
+
</ul>`:e.h}
|
|
53
|
+
`;return this.action?e._`<form
|
|
54
|
+
role="search"
|
|
55
|
+
class=${i}
|
|
56
|
+
action=${this.action}
|
|
57
|
+
method=${n.t(this.method)}
|
|
58
|
+
>
|
|
59
|
+
${c}
|
|
60
|
+
</form>`:e._`<div role="search" class=${i}>${c}</div>`}};e.n([e.u({type:String})],i.prototype,`appearance`,void 0),e.n([e.u({type:String,attribute:`input-size`})],i.prototype,`inputSize`,void 0),e.n([e.u({type:Boolean,reflect:!0})],i.prototype,`disabled`,void 0),e.n([e.u({type:Boolean,reflect:!0})],i.prototype,`fullwidth`,void 0),e.n([e.u({type:String,reflect:!0})],i.prototype,`id`,void 0),e.n([e.u({type:String})],i.prototype,`label`,void 0),e.n([e.u({type:String})],i.prototype,`name`,void 0),e.n([e.u({type:String})],i.prototype,`placeholder`,void 0),e.n([e.u({type:String})],i.prototype,`value`,void 0),e.n([e.u({type:Array})],i.prototype,`suggestions`,void 0),e.n([e.u({type:String})],i.prototype,`action`,void 0),e.n([e.u({type:String})],i.prototype,`method`,void 0),e.n([e.l()],i.prototype,`inputAriaLabel`,void 0);try{e.d(`pkt-searchinput`)(i)}catch{console.warn(`Forsøker å definere <pkt-searchinput>, men den er allerede definert`)}var a=i;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
|
|
@@ -1,10 +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-WEzISABa.js";
|
|
2
|
+
import { n as a } from "./element-with-slot-BKYUx4gb.js";
|
|
3
|
+
import { t as o } from "./if-defined-BmnvvxtR.js";
|
|
4
|
+
import { n as s, t as c } from "./ref-OU8ryfP6.js";
|
|
5
|
+
import { t as l } from "./input-element-IBypGOaV.js";
|
|
6
|
+
import { t as u } from "./pkt-options-controller-CuQ6SClv.js";
|
|
7
|
+
import { r as d } from "./input-wrapper-CQgAL1Br.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
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-DiFhBcIl.cjs"),t=require("./element-with-slot-CBK4zrdN.cjs"),n=require("./if-defined-Dc3xFDaM.cjs"),r=require("./ref-DZmN5Qgj.cjs"),i=require("./input-element-DQY1Rpbp.cjs"),a=require("./pkt-options-controller-BhMNCWcc.cjs"),o=require("./input-wrapper-mJZLVXy_.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}});
|
|
@@ -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 { IPktStringsProps, TPktStringParams, TPktStrings, TPktStringsNamespace, TPktStringsOverride, TPktStringsShape, TPktStringValue, } from './types';
|
|
14
|
+
export { consentStrings } from './consent';
|
|
@@ -0,0 +1,121 @@
|
|
|
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
|
+
alert: {
|
|
70
|
+
lastUpdated: string;
|
|
71
|
+
};
|
|
72
|
+
tag: {
|
|
73
|
+
remove: string;
|
|
74
|
+
};
|
|
75
|
+
header: {
|
|
76
|
+
search: string;
|
|
77
|
+
menu: string;
|
|
78
|
+
openMenu: string;
|
|
79
|
+
openSearch: string;
|
|
80
|
+
};
|
|
81
|
+
listbox: {
|
|
82
|
+
searchLabel: string;
|
|
83
|
+
searchPlaceholder: string;
|
|
84
|
+
};
|
|
85
|
+
combobox: {
|
|
86
|
+
noResults: string;
|
|
87
|
+
maxSelected: string;
|
|
88
|
+
tooManySelected: string;
|
|
89
|
+
alreadySelected: string;
|
|
90
|
+
valueAdded: string;
|
|
91
|
+
noValidValue: string;
|
|
92
|
+
};
|
|
93
|
+
fileupload: {
|
|
94
|
+
dropZoneDragMultiple: string;
|
|
95
|
+
dropZoneDragSingle: string;
|
|
96
|
+
dropZoneDragMultipleThumbnail: string;
|
|
97
|
+
dropZoneDragSingleThumbnail: string;
|
|
98
|
+
dropZoneDragActiveMultiple: string;
|
|
99
|
+
dropZoneDragActiveSingle: string;
|
|
100
|
+
dropZoneDragActiveMultipleThumbnail: string;
|
|
101
|
+
dropZoneDragActiveSingleThumbnail: string;
|
|
102
|
+
dropZoneOpenFileDialogMultiple: string;
|
|
103
|
+
dropZoneOpenFileDialogSingle: string;
|
|
104
|
+
dropZoneOpenFileDialogMultipleThumbnail: string;
|
|
105
|
+
dropZoneOpenFileDialogSingleThumbnail: string;
|
|
106
|
+
supportedFormatsPrefix: string;
|
|
107
|
+
invalidFormat: string;
|
|
108
|
+
sizeTooLarge: string;
|
|
109
|
+
requiredMissing: string;
|
|
110
|
+
genericValidationRejection: string;
|
|
111
|
+
unknownFilename: string;
|
|
112
|
+
previewFallbackName: string;
|
|
113
|
+
previewImage: string;
|
|
114
|
+
fileLabelOne: string;
|
|
115
|
+
fileLabelOther: string;
|
|
116
|
+
srFileAdded: string;
|
|
117
|
+
srFilesAdded: string;
|
|
118
|
+
srFilesUploadedOfTotal: string;
|
|
119
|
+
srFilesFailedOfTotal: string;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
@@ -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 {};
|