@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
|
@@ -3,7 +3,6 @@ import { classMap } from 'lit/directives/class-map.js'
|
|
|
3
3
|
import { ifDefined } from 'lit/directives/if-defined.js'
|
|
4
4
|
import { customElement, state } from 'lit/decorators.js'
|
|
5
5
|
|
|
6
|
-
import { defaultFileUploadStrings } from 'shared-types'
|
|
7
6
|
import { navigateCyclic, trapTabInside, type IFileAndTransfer } from 'shared-utils/fileupload'
|
|
8
7
|
|
|
9
8
|
import '@/components/alert'
|
|
@@ -70,6 +69,7 @@ export class PktFileUpload extends PktFileUploadBase implements IPktFileUpload {
|
|
|
70
69
|
|
|
71
70
|
return html`
|
|
72
71
|
<pkt-input-wrapper
|
|
72
|
+
.strings=${this.strings}
|
|
73
73
|
.forId=${`${this.id}-input`}
|
|
74
74
|
.label=${this.label}
|
|
75
75
|
.helptext=${this.helptext}
|
|
@@ -95,6 +95,7 @@ export class PktFileUpload extends PktFileUploadBase implements IPktFileUpload {
|
|
|
95
95
|
private renderContent() {
|
|
96
96
|
const filesAndTransfers = this.getSortedFilesAndTransfers()
|
|
97
97
|
const previewableImages = this.getPreviewableImages(filesAndTransfers)
|
|
98
|
+
const fileuploadStrings = this.pktStrings.get('fileupload')
|
|
98
99
|
const supportedFormatsText = this.getSupportedFormatsText()
|
|
99
100
|
const helptextId = !this.label && this.helptext ? `${this.id}-helptext` : undefined
|
|
100
101
|
const errorId = this.hasEffectiveError ? `${this.id}-error` : undefined
|
|
@@ -103,25 +104,25 @@ export class PktFileUpload extends PktFileUploadBase implements IPktFileUpload {
|
|
|
103
104
|
const dropZoneCopy = isThumbnailView
|
|
104
105
|
? this.multiple
|
|
105
106
|
? {
|
|
106
|
-
dragInactive:
|
|
107
|
-
dragActive:
|
|
108
|
-
openFileDialog:
|
|
107
|
+
dragInactive: fileuploadStrings.dropZoneDragMultipleThumbnail,
|
|
108
|
+
dragActive: fileuploadStrings.dropZoneDragActiveMultipleThumbnail,
|
|
109
|
+
openFileDialog: fileuploadStrings.dropZoneOpenFileDialogMultipleThumbnail,
|
|
109
110
|
}
|
|
110
111
|
: {
|
|
111
|
-
dragInactive:
|
|
112
|
-
dragActive:
|
|
113
|
-
openFileDialog:
|
|
112
|
+
dragInactive: fileuploadStrings.dropZoneDragSingleThumbnail,
|
|
113
|
+
dragActive: fileuploadStrings.dropZoneDragActiveSingleThumbnail,
|
|
114
|
+
openFileDialog: fileuploadStrings.dropZoneOpenFileDialogSingleThumbnail,
|
|
114
115
|
}
|
|
115
116
|
: this.multiple
|
|
116
117
|
? {
|
|
117
|
-
dragInactive:
|
|
118
|
-
dragActive:
|
|
119
|
-
openFileDialog:
|
|
118
|
+
dragInactive: fileuploadStrings.dropZoneDragMultiple,
|
|
119
|
+
dragActive: fileuploadStrings.dropZoneDragActiveMultiple,
|
|
120
|
+
openFileDialog: fileuploadStrings.dropZoneOpenFileDialogMultiple,
|
|
120
121
|
}
|
|
121
122
|
: {
|
|
122
|
-
dragInactive:
|
|
123
|
-
dragActive:
|
|
124
|
-
openFileDialog:
|
|
123
|
+
dragInactive: fileuploadStrings.dropZoneDragSingle,
|
|
124
|
+
dragActive: fileuploadStrings.dropZoneDragActiveSingle,
|
|
125
|
+
openFileDialog: fileuploadStrings.dropZoneOpenFileDialogSingle,
|
|
125
126
|
}
|
|
126
127
|
|
|
127
128
|
return html`
|
|
@@ -194,7 +195,7 @@ export class PktFileUpload extends PktFileUploadBase implements IPktFileUpload {
|
|
|
194
195
|
</p>
|
|
195
196
|
${supportedFormatsText
|
|
196
197
|
? html`<p class="pkt-fileupload__drop-zone__placeholder__formats">
|
|
197
|
-
${
|
|
198
|
+
${fileuploadStrings.supportedFormatsPrefix} ${supportedFormatsText}
|
|
198
199
|
</p>`
|
|
199
200
|
: null}
|
|
200
201
|
</div>
|
|
@@ -351,13 +352,16 @@ export class PktFileUpload extends PktFileUploadBase implements IPktFileUpload {
|
|
|
351
352
|
|
|
352
353
|
private renderPreviewModal(previewableImages: IFileAndTransfer[]) {
|
|
353
354
|
if (!this.enableImagePreview || previewableImages.length === 0) return null
|
|
355
|
+
const fileuploadStrings = this.pktStrings.get('fileupload')
|
|
354
356
|
const currentImage = previewableImages[this.previewCurrentIndex]
|
|
355
357
|
if (!currentImage) return null
|
|
356
358
|
const hasMultipleImages = previewableImages.length > 1
|
|
357
359
|
const imageUrl = this.getThumbnailUrl(currentImage)
|
|
358
360
|
const hasImage = !!imageUrl && !this.failedImageFileIds[currentImage.fileId]?.preview
|
|
359
361
|
const filename =
|
|
360
|
-
currentImage.attributes?.targetFilename ||
|
|
362
|
+
currentImage.attributes?.targetFilename ||
|
|
363
|
+
currentImage.file?.name ||
|
|
364
|
+
fileuploadStrings.previewFallbackName
|
|
361
365
|
|
|
362
366
|
return html`
|
|
363
367
|
<pkt-modal
|
|
@@ -428,7 +428,7 @@ export class PktHeaderGlobal extends PktElement<IPktHeaderGlobal> implements IPk
|
|
|
428
428
|
}
|
|
429
429
|
|
|
430
430
|
private renderMenuToggle(localeData?: IHeaderFooterLocaleData) {
|
|
431
|
-
const menuText = localeData?.i18n?.menu || '
|
|
431
|
+
const menuText = localeData?.i18n?.menu || this.pktStrings.get('header').menu
|
|
432
432
|
const isOpen = this.openMenu === 'menu'
|
|
433
433
|
return html`
|
|
434
434
|
<pkt-button
|
|
@@ -466,7 +466,7 @@ export class PktHeaderGlobal extends PktElement<IPktHeaderGlobal> implements IPk
|
|
|
466
466
|
aria-controls=${SEARCH_PANEL_ID}
|
|
467
467
|
@click=${() => this.toggleMenu('search')}
|
|
468
468
|
>
|
|
469
|
-
${localeData.i18n?.search || '
|
|
469
|
+
${localeData.i18n?.search || this.pktStrings.get('header').search}
|
|
470
470
|
</pkt-button>
|
|
471
471
|
`
|
|
472
472
|
}
|
|
@@ -489,7 +489,7 @@ export class PktHeaderGlobal extends PktElement<IPktHeaderGlobal> implements IPk
|
|
|
489
489
|
id=${search.input.id || 'pkt-header-global-search'}
|
|
490
490
|
name=${ifDefined(search.input.name)}
|
|
491
491
|
placeholder=${ifDefined(placeholder)}
|
|
492
|
-
aria-label=${ifDefined(localeData.i18n?.search || '
|
|
492
|
+
aria-label=${ifDefined(localeData.i18n?.search || this.pktStrings.get('header').search)}
|
|
493
493
|
action=${search.endpoint}
|
|
494
494
|
method="get"
|
|
495
495
|
@pkt-search=${(e: CustomEvent<{ value: string }>) => this.handleSearch(e.detail.value)}
|
|
@@ -40,7 +40,8 @@ export class PktHeaderService extends PktElementWithSlot<IPktHeader> implements
|
|
|
40
40
|
@property({ type: String, attribute: 'logo-link' }) logoLink: string = DEFAULT_HEADER_LOGO_LINK
|
|
41
41
|
@property({ type: String, attribute: 'logo-path' }) logoPath: string | undefined =
|
|
42
42
|
typeof window !== 'undefined' ? window.pktLogoPath : defaultLogoPath
|
|
43
|
-
@
|
|
43
|
+
/** @deprecated Bruk `strings={{ header: { search: '…' } }}` eller `setPktStrings()`. */
|
|
44
|
+
@property({ type: String, attribute: 'search-placeholder' }) searchPlaceholder?: string
|
|
44
45
|
@property({ type: String, attribute: 'search-value' }) searchValue = ''
|
|
45
46
|
@property({ type: Number, attribute: 'mobile-breakpoint' }) mobileBreakpoint: number = 768
|
|
46
47
|
@property({ type: Number, attribute: 'tablet-breakpoint' }) tabletBreakpoint: number = 1280
|
|
@@ -333,6 +334,10 @@ export class PktHeaderService extends PktElementWithSlot<IPktHeader> implements
|
|
|
333
334
|
)
|
|
334
335
|
}
|
|
335
336
|
|
|
337
|
+
private get headerStrings() {
|
|
338
|
+
return this.pktStrings.get('header')
|
|
339
|
+
}
|
|
340
|
+
|
|
336
341
|
private renderLogo() {
|
|
337
342
|
if (this.hideLogo) return nothing
|
|
338
343
|
|
|
@@ -422,7 +427,7 @@ export class PktHeaderService extends PktElementWithSlot<IPktHeader> implements
|
|
|
422
427
|
@click=${() => this.handleMenuToggle('slot')}
|
|
423
428
|
aria-expanded=${this.openMenu === 'slot'}
|
|
424
429
|
aria-controls="mobile-slot-menu"
|
|
425
|
-
aria-label
|
|
430
|
+
aria-label=${this.headerStrings.openMenu}
|
|
426
431
|
>
|
|
427
432
|
${this.slotMenuText}
|
|
428
433
|
</pkt-button>
|
|
@@ -472,9 +477,9 @@ export class PktHeaderService extends PktElementWithSlot<IPktHeader> implements
|
|
|
472
477
|
state=${this.openMenu === 'search' ? 'active' : 'normal'}
|
|
473
478
|
aria-expanded=${this.openMenu === 'search'}
|
|
474
479
|
aria-controls="mobile-search-menu"
|
|
475
|
-
aria-label
|
|
480
|
+
aria-label=${this.headerStrings.openSearch}
|
|
476
481
|
>
|
|
477
|
-
|
|
482
|
+
${this.headerStrings.search}
|
|
478
483
|
</pkt-button>
|
|
479
484
|
<div class=${searchMenuClasses} ${ref(this.searchMenuRef)}>
|
|
480
485
|
${this.openMenu === 'search'
|
|
@@ -483,9 +488,9 @@ export class PktHeaderService extends PktElementWithSlot<IPktHeader> implements
|
|
|
483
488
|
id="mobile-search-menu"
|
|
484
489
|
class="pkt-header-service__search-input"
|
|
485
490
|
type="search"
|
|
486
|
-
label
|
|
491
|
+
label=${this.headerStrings.search}
|
|
487
492
|
useWrapper="false"
|
|
488
|
-
placeholder=${this.searchPlaceholder}
|
|
493
|
+
placeholder=${this.searchPlaceholder ?? this.headerStrings.search}
|
|
489
494
|
value=${this.searchValue}
|
|
490
495
|
autofocus
|
|
491
496
|
fullwidth
|
|
@@ -508,9 +513,9 @@ export class PktHeaderService extends PktElementWithSlot<IPktHeader> implements
|
|
|
508
513
|
id="header-service-search"
|
|
509
514
|
class="pkt-header-service__search-input"
|
|
510
515
|
type="search"
|
|
511
|
-
label
|
|
516
|
+
label=${this.headerStrings.search}
|
|
512
517
|
useWrapper="false"
|
|
513
|
-
placeholder=${this.searchPlaceholder}
|
|
518
|
+
placeholder=${this.searchPlaceholder ?? this.headerStrings.search}
|
|
514
519
|
value=${this.searchValue}
|
|
515
520
|
@input=${this.handleSearchInputChange}
|
|
516
521
|
@keydown=${this.handleSearchKeyDown}
|
|
@@ -44,7 +44,8 @@ export class PktHeader extends PktElementWithSlot<IPktHeader> implements IPktHea
|
|
|
44
44
|
@property({ type: String, attribute: 'service-link' }) serviceLink?: string
|
|
45
45
|
@property({ type: String, attribute: 'logo-link' }) logoLink?: string
|
|
46
46
|
@property({ type: String, attribute: 'logo-path' }) logoPath?: string
|
|
47
|
-
@
|
|
47
|
+
/** @deprecated Bruk `strings={{ header: { search: '…' } }}` eller `setPktStrings()`. */
|
|
48
|
+
@property({ type: String, attribute: 'search-placeholder' }) searchPlaceholder?: string
|
|
48
49
|
@property({ type: String, attribute: 'search-value' }) searchValue = ''
|
|
49
50
|
@property({ type: Number, attribute: 'mobile-breakpoint' }) mobileBreakpoint: number = 768
|
|
50
51
|
@property({ type: Number, attribute: 'tablet-breakpoint' }) tabletBreakpoint: number = 1280
|
|
@@ -103,7 +103,7 @@ describe('PktHelptext', () => {
|
|
|
103
103
|
expect(helptext.forId).toBeTruthy() // Should have a generated ID
|
|
104
104
|
expect(helptext.helptext).toBe('')
|
|
105
105
|
expect(helptext.helptextDropdown).toBe('')
|
|
106
|
-
expect(helptext.helptextDropdownButton).
|
|
106
|
+
expect(helptext.helptextDropdownButton).toBeUndefined()
|
|
107
107
|
expect(helptext.isHelpTextOpen).toBe(false)
|
|
108
108
|
})
|
|
109
109
|
|
|
@@ -4,7 +4,6 @@ import { unsafeHTML } from 'lit/directives/unsafe-html.js'
|
|
|
4
4
|
import { classMap } from 'lit/directives/class-map.js'
|
|
5
5
|
import { customElement, property, state } from 'lit/decorators.js'
|
|
6
6
|
import { uuidish } from 'shared-utils/utils'
|
|
7
|
-
import specs from 'componentSpecs/input-wrapper.json'
|
|
8
7
|
import '@/components/icon'
|
|
9
8
|
import { slotContent } from '@/directives/slot-content'
|
|
10
9
|
|
|
@@ -18,8 +17,9 @@ export class PktHelptext extends PktElementWithSlot {
|
|
|
18
17
|
@property({ type: String })
|
|
19
18
|
helptextDropdown: string = ''
|
|
20
19
|
|
|
20
|
+
/** @deprecated Bruk `strings={{ forms: { readMore: '…' } }}` eller `setPktStrings()`. */
|
|
21
21
|
@property({ type: String })
|
|
22
|
-
helptextDropdownButton
|
|
22
|
+
helptextDropdownButton?: string
|
|
23
23
|
|
|
24
24
|
@state() isHelpTextOpen: boolean = false
|
|
25
25
|
|
|
@@ -55,7 +55,7 @@ export class PktHelptext extends PktElementWithSlot {
|
|
|
55
55
|
class="pkt-btn__icon"
|
|
56
56
|
name="${this.isHelpTextOpen ? 'chevron-thin-up' : 'chevron-thin-down'}"
|
|
57
57
|
></pkt-icon>
|
|
58
|
-
<span class="pkt-btn__text">${unsafeHTML(this.helptextDropdownButton)}</span>
|
|
58
|
+
<span class="pkt-btn__text">${unsafeHTML(this.helptextDropdownButton ?? this.pktStrings.get('forms').readMore)}</span>
|
|
59
59
|
</button>
|
|
60
60
|
<div
|
|
61
61
|
id="${this.forId}-helptext-expandable"
|
package/src/components/index.ts
CHANGED
|
@@ -132,3 +132,12 @@ export type {
|
|
|
132
132
|
TPktSearchInputAppearance,
|
|
133
133
|
TPktSearchInputMethod,
|
|
134
134
|
} from '@/components/searchinput'
|
|
135
|
+
|
|
136
|
+
export {
|
|
137
|
+
getPktStrings,
|
|
138
|
+
nb as pktStringsNb,
|
|
139
|
+
resetPktStrings,
|
|
140
|
+
setPktStrings,
|
|
141
|
+
subscribePktStrings,
|
|
142
|
+
} from 'shared-strings'
|
|
143
|
+
export type { TPktStrings, TPktStringsNamespace, TPktStringsOverride } from 'shared-strings'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PktElementWithSlot } from '@/base-elements/element-with-slot'
|
|
2
2
|
import { slotContent } from '@/directives/slot-content'
|
|
3
3
|
import { counterStatusId, isCounterExceeded } from 'shared-utils/forms/described-by'
|
|
4
|
-
import
|
|
4
|
+
import { formatString } from 'shared-strings'
|
|
5
5
|
import { ifDefined } from 'lit/directives/if-defined.js'
|
|
6
6
|
import { html, nothing, PropertyValues } from 'lit'
|
|
7
7
|
import { unsafeHTML } from 'lit/directives/unsafe-html.js'
|
|
@@ -58,9 +58,11 @@ export class PktInputWrapper extends PktElementWithSlot<Props> {
|
|
|
58
58
|
@property({ type: String }) counterError: string | null = null
|
|
59
59
|
@property({ type: String, reflect: false }) counterPosition: TCounterPosition = 'bottom'
|
|
60
60
|
@property({ type: Boolean }) optionalTag: boolean = specs.props.optionalTag.default
|
|
61
|
-
@
|
|
61
|
+
/** @deprecated Bruk `strings={{ forms: { optional: '…' } }}` eller `setPktStrings()`. */
|
|
62
|
+
@property({ type: String }) optionalText?: string
|
|
62
63
|
@property({ type: Boolean }) requiredTag: boolean = specs.props.requiredTag.default
|
|
63
|
-
@
|
|
64
|
+
/** @deprecated Bruk `strings={{ forms: { required: '…' } }}` eller `setPktStrings()`. */
|
|
65
|
+
@property({ type: String }) requiredText?: string
|
|
64
66
|
@property({ type: String }) tagText: string | null = null
|
|
65
67
|
@property({ type: Boolean }) hasError: boolean = specs.props.hasError.default
|
|
66
68
|
@property({ type: String }) errorMessage: string = ''
|
|
@@ -102,16 +104,22 @@ export class PktInputWrapper extends PktElementWithSlot<Props> {
|
|
|
102
104
|
? `${this.forId}-helptext`
|
|
103
105
|
: nothing
|
|
104
106
|
|
|
107
|
+
const formStrings = this.pktStrings.get('forms')
|
|
108
|
+
|
|
105
109
|
const tagElement = () => {
|
|
106
110
|
return html`
|
|
107
111
|
${this.tagText
|
|
108
112
|
? html`<span class=${tagClasses + ' pkt-tag--gray'}>${this.tagText}</span>`
|
|
109
113
|
: nothing}
|
|
110
114
|
${this.optionalTag
|
|
111
|
-
? html`<span class=${tagClasses + ' pkt-tag--blue-light'}
|
|
115
|
+
? html`<span class=${tagClasses + ' pkt-tag--blue-light'}
|
|
116
|
+
>${this.optionalText ?? formStrings.optional}</span
|
|
117
|
+
>`
|
|
112
118
|
: nothing}
|
|
113
119
|
${this.requiredTag
|
|
114
|
-
? html`<span class=${tagClasses + ' pkt-tag--beige'}
|
|
120
|
+
? html`<span class=${tagClasses + ' pkt-tag--beige'}
|
|
121
|
+
>${this.requiredText ?? formStrings.required}</span
|
|
122
|
+
>`
|
|
115
123
|
: nothing}
|
|
116
124
|
`
|
|
117
125
|
}
|
|
@@ -149,8 +157,7 @@ export class PktInputWrapper extends PktElementWithSlot<Props> {
|
|
|
149
157
|
.forId=${this.forId}
|
|
150
158
|
.helptext=${this.helptext}
|
|
151
159
|
.helptextDropdown=${this.helptextDropdown}
|
|
152
|
-
.helptextDropdownButton=${this.helptextDropdownButton
|
|
153
|
-
specs.props.helptextDropdownButton.default}
|
|
160
|
+
.helptextDropdownButton=${this.helptextDropdownButton ?? formStrings.readMore}
|
|
154
161
|
@toggleHelpText=${(e: CustomEvent) => {
|
|
155
162
|
this.toggleDropdown(e)
|
|
156
163
|
}}
|
|
@@ -170,9 +177,10 @@ export class PktInputWrapper extends PktElementWithSlot<Props> {
|
|
|
170
177
|
</div>
|
|
171
178
|
<div class="pkt-sr-only" id=${counterStatusId(this.forId)} aria-live="polite">
|
|
172
179
|
${exceeded
|
|
173
|
-
?
|
|
174
|
-
|
|
175
|
-
|
|
180
|
+
? formatString(this.pktStrings.get('validation').counterExceeded, {
|
|
181
|
+
current: this.counterCurrent ?? 0,
|
|
182
|
+
max: this.counterMaxLength,
|
|
183
|
+
})
|
|
176
184
|
: ''}
|
|
177
185
|
</div>`
|
|
178
186
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { html, nothing, PropertyValues } from 'lit'
|
|
2
2
|
import { customElement, property, state } from 'lit/decorators.js'
|
|
3
3
|
import { ifDefined } from 'lit/directives/if-defined.js'
|
|
4
|
-
import strings from '@/translations/no.json'
|
|
5
4
|
import { PktElement } from '@/base-elements/element'
|
|
6
5
|
import { repeat } from 'lit/directives/repeat.js'
|
|
7
6
|
import { classMap } from 'lit/directives/class-map.js'
|
|
@@ -263,6 +262,7 @@ export class PktListbox extends PktElement implements IPktListbox {
|
|
|
263
262
|
}
|
|
264
263
|
|
|
265
264
|
private renderSearch() {
|
|
265
|
+
const listboxStrings = this.pktStrings.get('listbox')
|
|
266
266
|
return this.includeSearch
|
|
267
267
|
? html`
|
|
268
268
|
<div class="pkt-listbox__search">
|
|
@@ -272,9 +272,9 @@ export class PktListbox extends PktElement implements IPktListbox {
|
|
|
272
272
|
<input
|
|
273
273
|
class="pkt-txt-16-light"
|
|
274
274
|
type="text"
|
|
275
|
-
aria-label
|
|
275
|
+
aria-label=${listboxStrings.searchLabel}
|
|
276
276
|
form=""
|
|
277
|
-
placeholder=${this.searchPlaceholder
|
|
277
|
+
placeholder=${this.searchPlaceholder ?? listboxStrings.searchPlaceholder}
|
|
278
278
|
@input=${this.handleSearchInput}
|
|
279
279
|
@keydown=${this.handleSearchKeydown}
|
|
280
280
|
.value=${this.searchValue}
|
|
@@ -29,9 +29,11 @@ export class PktRadioButton extends PktInputElement<Props> {
|
|
|
29
29
|
@property({ type: String, reflect: true }) type: string = 'radio'
|
|
30
30
|
@property({ type: String }) tagText: string | null = null
|
|
31
31
|
@property({ type: Boolean }) optionalTag: boolean = false
|
|
32
|
-
@
|
|
32
|
+
/** @deprecated Bruk `strings={{ forms: { optional: '…' } }}` eller `setPktStrings()`. */
|
|
33
|
+
@property({ type: String }) optionalText?: string
|
|
33
34
|
@property({ type: Boolean }) requiredTag: boolean = false
|
|
34
|
-
@
|
|
35
|
+
/** @deprecated Bruk `strings={{ forms: { required: '…' } }}` eller `setPktStrings()`. */
|
|
36
|
+
@property({ type: String }) requiredText?: string
|
|
35
37
|
|
|
36
38
|
@state() _checked: boolean = false
|
|
37
39
|
|
|
@@ -69,16 +71,18 @@ export class PktRadioButton extends PktInputElement<Props> {
|
|
|
69
71
|
|
|
70
72
|
const tagClasses = 'pkt-tag pkt-tag--small pkt-tag--thin-text'
|
|
71
73
|
|
|
74
|
+
const formStrings = this.pktStrings.get('forms')
|
|
75
|
+
|
|
72
76
|
const tags = () => {
|
|
73
77
|
return html`
|
|
74
78
|
${this.tagText
|
|
75
79
|
? html`<span class=${tagClasses + ' pkt-tag--gray'}>${this.tagText}</span>`
|
|
76
80
|
: nothing}
|
|
77
81
|
${this.optionalTag
|
|
78
|
-
? html`<span class=${tagClasses + ' pkt-tag--blue-light'}>${this.optionalText}</span>`
|
|
82
|
+
? html`<span class=${tagClasses + ' pkt-tag--blue-light'}>${this.optionalText ?? formStrings.optional}</span>`
|
|
79
83
|
: nothing}
|
|
80
84
|
${this.requiredTag
|
|
81
|
-
? html`<span class=${tagClasses + ' pkt-tag--beige'}>${this.requiredText}</span>`
|
|
85
|
+
? html`<span class=${tagClasses + ' pkt-tag--beige'}>${this.requiredText ?? formStrings.required}</span>`
|
|
82
86
|
: nothing}
|
|
83
87
|
`
|
|
84
88
|
}
|
|
@@ -30,7 +30,8 @@ export class PktSearchInput extends PktElement<IPktSearchInput> implements IPktS
|
|
|
30
30
|
@property({ type: String, reflect: true }) id: string = ''
|
|
31
31
|
@property({ type: String }) label: string | undefined
|
|
32
32
|
@property({ type: String }) name: string | undefined
|
|
33
|
-
@
|
|
33
|
+
/** @deprecated Bruk `strings={{ searchinput: { placeholder: '…' } }}` eller `setPktStrings()`. */
|
|
34
|
+
@property({ type: String }) placeholder?: string
|
|
34
35
|
@property({ type: String }) value: string = ''
|
|
35
36
|
@property({ type: Array }) suggestions: IPktSearchInputSuggestion[] | undefined
|
|
36
37
|
@property({ type: String }) action: string | undefined
|
|
@@ -135,6 +136,7 @@ export class PktSearchInput extends PktElement<IPktSearchInput> implements IPktS
|
|
|
135
136
|
}
|
|
136
137
|
|
|
137
138
|
render() {
|
|
139
|
+
const searchStrings = this.pktStrings.get('searchinput')
|
|
138
140
|
const wrapperClasses = classMap({
|
|
139
141
|
'pkt-searchinput': true,
|
|
140
142
|
[`pkt-searchinput--${this.appearance}`]: true,
|
|
@@ -173,7 +175,7 @@ export class PktSearchInput extends PktElement<IPktSearchInput> implements IPktS
|
|
|
173
175
|
type="search"
|
|
174
176
|
name=${this.name || this.id}
|
|
175
177
|
id=${this.id}
|
|
176
|
-
placeholder=${this.placeholder ||
|
|
178
|
+
placeholder=${this.placeholder || searchStrings.placeholder}
|
|
177
179
|
.value=${this.value}
|
|
178
180
|
?disabled=${this.disabled}
|
|
179
181
|
autocomplete="off"
|
|
@@ -190,7 +192,7 @@ export class PktSearchInput extends PktElement<IPktSearchInput> implements IPktS
|
|
|
190
192
|
@click=${this.onSearchClick}
|
|
191
193
|
>
|
|
192
194
|
<pkt-icon class="pkt-btn__icon" name="magnifying-glass-big"></pkt-icon>
|
|
193
|
-
<span class="pkt-btn__text">${this.label || this.placeholder ||
|
|
195
|
+
<span class="pkt-btn__text">${this.label || this.placeholder || searchStrings.placeholder}</span>
|
|
194
196
|
</button>
|
|
195
197
|
</div>
|
|
196
198
|
${this.suggestions
|
|
@@ -10,6 +10,7 @@ import '@/components/icon'
|
|
|
10
10
|
import type { IAriaAttributes, THTMLButtonType } from 'shared-types'
|
|
11
11
|
import { PktIconName } from '@oslokommune/punkt-assets/dist/icons/icon'
|
|
12
12
|
import { ifDefined } from 'lit/directives/if-defined.js'
|
|
13
|
+
import { formatString } from 'shared-strings'
|
|
13
14
|
|
|
14
15
|
export type TTagSkin =
|
|
15
16
|
| 'blue'
|
|
@@ -68,7 +69,7 @@ export class PktTag extends PktElementWithSlot<IPktTag> implements IPktTag {
|
|
|
68
69
|
if (this.closeTag && !this.ariaLabel) {
|
|
69
70
|
const label = this.querySelector('button span, .pkt-tag > span')?.textContent?.trim()
|
|
70
71
|
if (label) {
|
|
71
|
-
this._ariaDescription =
|
|
72
|
+
this._ariaDescription = formatString(this.pktStrings.get('tag').remove, { label })
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
75
|
}
|
|
@@ -55,6 +55,7 @@ export class PktTextarea extends PktInputElement<Props> {
|
|
|
55
55
|
const labelledBy = this.ariaLabelledby || `${this.id}-input-label`
|
|
56
56
|
|
|
57
57
|
return html`<pkt-input-wrapper
|
|
58
|
+
.strings=${this.strings}
|
|
58
59
|
label=${this.label}
|
|
59
60
|
?counter=${showCounter}
|
|
60
61
|
?hasFieldset=${this.effectiveHasFieldset(false)}
|
|
@@ -6,7 +6,7 @@ import { classMap } from 'lit/directives/class-map.js'
|
|
|
6
6
|
import { PktInputElement } from '@/base-elements/input-element'
|
|
7
7
|
import { slotContent } from '@/directives/slot-content'
|
|
8
8
|
import { ElementProps } from '@/types/typeUtils'
|
|
9
|
-
import
|
|
9
|
+
import { formatString } from 'shared-strings'
|
|
10
10
|
import { isValidTimeString, timeToMinutes } from 'shared-utils/timepicker/time-utils'
|
|
11
11
|
import { getMinuteStep, getHourOptions, getMinuteOptions } from 'shared-utils/timepicker/options'
|
|
12
12
|
import { stepTime } from 'shared-utils/timepicker/stepper'
|
|
@@ -71,8 +71,10 @@ export class PktTimepicker extends PktInputElement<Props> {
|
|
|
71
71
|
const anchor = this.hoursInputRef.value
|
|
72
72
|
if (!anchor) return
|
|
73
73
|
|
|
74
|
+
const messages = this.pktStrings.get('validation')
|
|
75
|
+
|
|
74
76
|
if (this.required && !this.value) {
|
|
75
|
-
this.internals.setValidity({ valueMissing: true },
|
|
77
|
+
this.internals.setValidity({ valueMissing: true }, messages.valueMissing, anchor)
|
|
76
78
|
this._setAriaInvalid(true)
|
|
77
79
|
return
|
|
78
80
|
}
|
|
@@ -89,7 +91,7 @@ export class PktTimepicker extends PktInputElement<Props> {
|
|
|
89
91
|
if (this.min && totalMinutes < timeToMinutes(String(this.min))) {
|
|
90
92
|
this.internals.setValidity(
|
|
91
93
|
{ rangeUnderflow: true },
|
|
92
|
-
|
|
94
|
+
formatString(messages.rangeUnderflowMin, { min: String(this.min) }),
|
|
93
95
|
anchor,
|
|
94
96
|
)
|
|
95
97
|
this._setAriaInvalid(true)
|
|
@@ -99,7 +101,7 @@ export class PktTimepicker extends PktInputElement<Props> {
|
|
|
99
101
|
if (this.max && totalMinutes > timeToMinutes(String(this.max))) {
|
|
100
102
|
this.internals.setValidity(
|
|
101
103
|
{ rangeOverflow: true },
|
|
102
|
-
|
|
104
|
+
formatString(messages.rangeOverflowMax, { max: String(this.max) }),
|
|
103
105
|
anchor,
|
|
104
106
|
)
|
|
105
107
|
this._setAriaInvalid(true)
|
|
@@ -109,13 +111,12 @@ export class PktTimepicker extends PktInputElement<Props> {
|
|
|
109
111
|
if (this.step && totalMinutes % minuteStep !== 0) {
|
|
110
112
|
const stepMessage =
|
|
111
113
|
minuteStep === 60
|
|
112
|
-
?
|
|
114
|
+
? messages.timeStepMismatchHour
|
|
113
115
|
: minuteStep === 30
|
|
114
|
-
?
|
|
115
|
-
:
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
)
|
|
116
|
+
? messages.timeStepMismatchHalfHour
|
|
117
|
+
: formatString(messages.timeStepMismatch, {
|
|
118
|
+
step: `${minuteStep}, ${minuteStep * 2}, ${minuteStep * 3}`,
|
|
119
|
+
})
|
|
119
120
|
this.internals.setValidity({ stepMismatch: true }, stepMessage, anchor)
|
|
120
121
|
this._setAriaInvalid(true)
|
|
121
122
|
return
|
|
@@ -583,7 +584,7 @@ export class PktTimepicker extends PktInputElement<Props> {
|
|
|
583
584
|
id=${this.id + '-popup'}
|
|
584
585
|
?hidden=${!this._isOpen}
|
|
585
586
|
role="group"
|
|
586
|
-
aria-label=${this.
|
|
587
|
+
aria-label=${this.pktStrings.get('timepicker').selectTime}
|
|
587
588
|
@keydown=${this._handlePopupKeydown}
|
|
588
589
|
@focusout=${(e: FocusEvent) => {
|
|
589
590
|
if (!this.querySelector('.pkt-timepicker-popup')?.contains(e.relatedTarget as Node)) {
|
|
@@ -594,7 +595,7 @@ export class PktTimepicker extends PktInputElement<Props> {
|
|
|
594
595
|
<div
|
|
595
596
|
class="pkt-timepicker-popup__col"
|
|
596
597
|
role="listbox"
|
|
597
|
-
aria-label=${this.
|
|
598
|
+
aria-label=${this.pktStrings.get('timepicker').hours}
|
|
598
599
|
aria-orientation="vertical"
|
|
599
600
|
>
|
|
600
601
|
${this._hourOptions.map((h) => this._renderOption(h, 'hour'))}
|
|
@@ -602,7 +603,7 @@ export class PktTimepicker extends PktInputElement<Props> {
|
|
|
602
603
|
<div
|
|
603
604
|
class="pkt-timepicker-popup__col"
|
|
604
605
|
role="listbox"
|
|
605
|
-
aria-label=${this.
|
|
606
|
+
aria-label=${this.pktStrings.get('timepicker').minutes}
|
|
606
607
|
aria-orientation="vertical"
|
|
607
608
|
>
|
|
608
609
|
${this._minuteOptions.map((m) => this._renderOption(m, 'minute'))}
|
|
@@ -612,8 +613,8 @@ export class PktTimepicker extends PktInputElement<Props> {
|
|
|
612
613
|
}
|
|
613
614
|
|
|
614
615
|
private _renderContainer() {
|
|
615
|
-
const hoursLabel = this.
|
|
616
|
-
const minutesLabel = this.
|
|
616
|
+
const hoursLabel = this.pktStrings.get('timepicker').hours
|
|
617
|
+
const minutesLabel = this.pktStrings.get('timepicker').minutes
|
|
617
618
|
const hoursAriaLabel = this.label ? `${hoursLabel}, ${this.label}` : hoursLabel
|
|
618
619
|
const minutesAriaLabel = this.label ? `${minutesLabel}, ${this.label}` : minutesLabel
|
|
619
620
|
return html`
|
|
@@ -631,13 +632,13 @@ export class PktTimepicker extends PktInputElement<Props> {
|
|
|
631
632
|
class="pkt-input-icon pkt-btn pkt-btn--icon-only pkt-btn--tertiary pkt-btn--${this
|
|
632
633
|
.inputSize} pkt-timepicker__button pkt-timepicker__button--prev"
|
|
633
634
|
type="button"
|
|
634
|
-
aria-label=${this.
|
|
635
|
+
aria-label=${this.pktStrings.get('timepicker').prevTime}
|
|
635
636
|
?disabled=${this.disabled}
|
|
636
637
|
@click=${() => this._stepTime(-1)}
|
|
637
638
|
>
|
|
638
639
|
<pkt-icon name="chevron-thin-left"></pkt-icon>
|
|
639
640
|
<span class="pkt-btn__text"
|
|
640
|
-
>${this.
|
|
641
|
+
>${this.pktStrings.get('timepicker').prevTime}</span
|
|
641
642
|
>
|
|
642
643
|
</button>
|
|
643
644
|
`
|
|
@@ -719,7 +720,7 @@ export class PktTimepicker extends PktInputElement<Props> {
|
|
|
719
720
|
class="pkt-input-icon pkt-btn pkt-btn--icon-only pkt-btn--tertiary pkt-btn--${this
|
|
720
721
|
.inputSize} pkt-timepicker__button"
|
|
721
722
|
type="button"
|
|
722
|
-
aria-label=${this.
|
|
723
|
+
aria-label=${this.pktStrings.get('timepicker').openPicker}
|
|
723
724
|
aria-haspopup="listbox"
|
|
724
725
|
aria-expanded=${this._isOpen ? 'true' : 'false'}
|
|
725
726
|
aria-controls=${this.id + '-popup'}
|
|
@@ -728,7 +729,7 @@ export class PktTimepicker extends PktInputElement<Props> {
|
|
|
728
729
|
>
|
|
729
730
|
<pkt-icon name="clock"></pkt-icon>
|
|
730
731
|
<span class="pkt-btn__text"
|
|
731
|
-
>${this.
|
|
732
|
+
>${this.pktStrings.get('timepicker').openPicker}</span
|
|
732
733
|
>
|
|
733
734
|
</button>
|
|
734
735
|
`
|
|
@@ -739,13 +740,13 @@ export class PktTimepicker extends PktInputElement<Props> {
|
|
|
739
740
|
class="pkt-input-icon pkt-btn pkt-btn--icon-only pkt-btn--tertiary pkt-btn--${this
|
|
740
741
|
.inputSize} pkt-timepicker__button pkt-timepicker__button--next"
|
|
741
742
|
type="button"
|
|
742
|
-
aria-label=${this.
|
|
743
|
+
aria-label=${this.pktStrings.get('timepicker').nextTime}
|
|
743
744
|
?disabled=${this.disabled}
|
|
744
745
|
@click=${() => this._stepTime(1)}
|
|
745
746
|
>
|
|
746
747
|
<pkt-icon name="chevron-thin-right"></pkt-icon>
|
|
747
748
|
<span class="pkt-btn__text"
|
|
748
|
-
>${this.
|
|
749
|
+
>${this.pktStrings.get('timepicker').nextTime}</span
|
|
749
750
|
>
|
|
750
751
|
</button>
|
|
751
752
|
`
|
|
@@ -771,6 +772,7 @@ export class PktTimepicker extends PktInputElement<Props> {
|
|
|
771
772
|
render() {
|
|
772
773
|
return html`
|
|
773
774
|
<pkt-input-wrapper
|
|
775
|
+
.strings=${this.strings}
|
|
774
776
|
label="${this.label}"
|
|
775
777
|
?disabled=${this.disabled}
|
|
776
778
|
?fullwidth=${this.fullwidth}
|