@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
|
@@ -3,9 +3,10 @@ import { customElement, property, state } from 'lit/decorators.js'
|
|
|
3
3
|
import { html, nothing, PropertyValues } from 'lit'
|
|
4
4
|
import { PktElementWithSlot } from '@/base-elements/element-with-slot'
|
|
5
5
|
import { slotContent } from '@/directives/slot-content'
|
|
6
|
-
import type { TAriaLive, TAlertSkin } from 'shared-types'
|
|
6
|
+
import type { TAriaLive, TAlertSkin, TAlertSize } from 'shared-types'
|
|
7
7
|
import { updateClassAttribute } from '@/utils/classutils'
|
|
8
|
-
import
|
|
8
|
+
import { formatString } from 'shared-strings'
|
|
9
|
+
import specs from 'componentSpecs/alert.spec'
|
|
9
10
|
|
|
10
11
|
import '@/components/icon'
|
|
11
12
|
import '@/components/button'
|
|
@@ -23,7 +24,7 @@ export interface IPktAlert {
|
|
|
23
24
|
*/
|
|
24
25
|
compact?: boolean
|
|
25
26
|
role?: string
|
|
26
|
-
size?:
|
|
27
|
+
size?: TAlertSize
|
|
27
28
|
}
|
|
28
29
|
export class PktAlert extends PktElementWithSlot implements IPktAlert {
|
|
29
30
|
constructor() {
|
|
@@ -33,14 +34,20 @@ export class PktAlert extends PktElementWithSlot implements IPktAlert {
|
|
|
33
34
|
|
|
34
35
|
// Properties
|
|
35
36
|
|
|
36
|
-
@property({ type: Boolean, reflect: false })
|
|
37
|
+
@property({ type: Boolean, reflect: false })
|
|
38
|
+
compact = specs.deprecated!.compact.default as boolean
|
|
37
39
|
@property({ type: String, reflect: true }) title: string = ''
|
|
38
|
-
@property({ type: String, reflect: true }) skin: TAlertSkin =
|
|
39
|
-
.
|
|
40
|
-
|
|
40
|
+
@property({ type: String, reflect: true }) skin: TAlertSkin = (
|
|
41
|
+
specs.props!.skin as { default: TAlertSkin }
|
|
42
|
+
).default
|
|
43
|
+
@property({ type: String }) ariaLive: TAriaLive = (
|
|
44
|
+
specs.props!.ariaLive as { default: TAriaLive }
|
|
45
|
+
).default
|
|
41
46
|
@property({ type: String, reflect: true, attribute: 'aria-live' })
|
|
42
47
|
ariaLiveAttr: TAriaLive | null = null
|
|
43
|
-
@property({ type: Boolean, reflect: true }) closeAlert =
|
|
48
|
+
@property({ type: Boolean, reflect: true }) closeAlert = (
|
|
49
|
+
specs.props!.closeAlert as { default: boolean }
|
|
50
|
+
).default
|
|
44
51
|
@property({ type: String, reflect: true }) date: string | null = null
|
|
45
52
|
@property({ type: String, reflect: true }) role: string = 'status'
|
|
46
53
|
@property({ type: String, attribute: 'size' })
|
|
@@ -110,7 +117,7 @@ export class PktAlert extends PktElementWithSlot implements IPktAlert {
|
|
|
110
117
|
variant="icon-only"
|
|
111
118
|
@click=${this.close}
|
|
112
119
|
>
|
|
113
|
-
<span class="sr-only"
|
|
120
|
+
<span class="sr-only">${this.pktStrings.get('generic').close}</span>
|
|
114
121
|
</pkt-button>
|
|
115
122
|
</div>
|
|
116
123
|
`
|
|
@@ -120,7 +127,9 @@ export class PktAlert extends PktElementWithSlot implements IPktAlert {
|
|
|
120
127
|
<div class="pkt-alert__text">${slotContent(this)}</div>
|
|
121
128
|
|
|
122
129
|
${this.date
|
|
123
|
-
? html`<div class="pkt-alert__date">
|
|
130
|
+
? html`<div class="pkt-alert__date">
|
|
131
|
+
${formatString(this.pktStrings.get('alert').lastUpdated, { date: this.date })}
|
|
132
|
+
</div>`
|
|
124
133
|
: nothing}
|
|
125
134
|
</div>
|
|
126
135
|
</div>
|
|
@@ -9,7 +9,7 @@ expect.extend(toHaveNoViolations)
|
|
|
9
9
|
export interface BacklinkTestConfig extends BaseTestConfig {
|
|
10
10
|
href?: string
|
|
11
11
|
text?: string
|
|
12
|
-
ariaLabel?: string
|
|
12
|
+
ariaLabel?: string | null
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
// Use shared framework
|
|
@@ -70,7 +70,7 @@ describe('PktBackLink', () => {
|
|
|
70
70
|
|
|
71
71
|
expect(backlink.href).toBe('')
|
|
72
72
|
expect(backlink.text).toBe('Forsiden')
|
|
73
|
-
expect(backlink.ariaLabel).toBe(
|
|
73
|
+
expect(backlink.ariaLabel).toBe(null)
|
|
74
74
|
|
|
75
75
|
const nav = backlink.querySelector('nav')
|
|
76
76
|
const link = nav?.querySelector('a')
|
|
@@ -133,7 +133,7 @@ describe('PktBackLink', () => {
|
|
|
133
133
|
test('uses default aria-label when none provided', async () => {
|
|
134
134
|
const { backlink } = await createBacklinkTest()
|
|
135
135
|
|
|
136
|
-
expect(backlink.ariaLabel).toBe(
|
|
136
|
+
expect(backlink.ariaLabel).toBe(null)
|
|
137
137
|
|
|
138
138
|
const nav = backlink.querySelector('nav')
|
|
139
139
|
expect(nav?.getAttribute('aria-label')).toBe('Gå tilbake til forrige side')
|
|
@@ -2,21 +2,19 @@ import { PktElement } from '@/base-elements/element'
|
|
|
2
2
|
import { html } from 'lit'
|
|
3
3
|
import { property, customElement } from 'lit/decorators.js'
|
|
4
4
|
import { ifDefined } from 'lit/directives/if-defined.js'
|
|
5
|
+
import type { IPktBackLinkBase } from 'shared-types'
|
|
5
6
|
|
|
6
7
|
import '@/components/icon'
|
|
7
8
|
|
|
8
|
-
export interface IPktBackLink {
|
|
9
|
-
href?: string
|
|
10
|
-
text?: string
|
|
11
|
-
ariaLabel?: string
|
|
12
|
-
}
|
|
9
|
+
export interface IPktBackLink extends IPktBackLinkBase {}
|
|
13
10
|
|
|
14
11
|
export class PktBackLink extends PktElement<IPktBackLink> implements IPktBackLink {
|
|
15
12
|
// Properties
|
|
16
13
|
|
|
17
14
|
@property({ type: String }) href: string = ''
|
|
18
15
|
@property({ type: String }) text: string = 'Forsiden'
|
|
19
|
-
@
|
|
16
|
+
/** @deprecated Bruk `strings={{ backlink: { label: '…' } }}` eller `setPktStrings()`. */
|
|
17
|
+
@property({ type: String }) ariaLabel: string | null = null
|
|
20
18
|
|
|
21
19
|
// Lifecycle
|
|
22
20
|
|
|
@@ -36,7 +34,7 @@ export class PktBackLink extends PktElement<IPktBackLink> implements IPktBackLin
|
|
|
36
34
|
render() {
|
|
37
35
|
return html`<nav
|
|
38
36
|
class="pkt-back-link"
|
|
39
|
-
aria-label=${this.ariaLabel || '
|
|
37
|
+
aria-label=${this.ariaLabel || this.pktStrings.get('backlink').label}
|
|
40
38
|
>
|
|
41
39
|
<a href=${ifDefined(this.href || '/')} class="pkt-link pkt-link--icon-left"
|
|
42
40
|
><pkt-icon
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import { customElement, property } from 'lit/decorators.js'
|
|
2
2
|
import { html, nothing } from 'lit'
|
|
3
3
|
import { PktElement } from '@/base-elements/element'
|
|
4
|
+
import type { IBreadcrumb, IPktBreadcrumbsBase } from 'shared-types'
|
|
4
5
|
|
|
5
6
|
import '@/components/icon'
|
|
6
7
|
|
|
7
|
-
export
|
|
8
|
-
text: string
|
|
9
|
-
href: string
|
|
10
|
-
}
|
|
8
|
+
export type { IBreadcrumb }
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
/** @deprecated Use `IBreadcrumb`. */
|
|
11
|
+
export type IBreadcrumbItem = IBreadcrumb
|
|
12
|
+
|
|
13
|
+
export interface IPktBreadcrumbs extends IPktBreadcrumbsBase {}
|
|
15
14
|
|
|
16
15
|
export class PktBreadcrumbs extends PktElement implements IPktBreadcrumbs {
|
|
17
|
-
@property({ type: Array }) breadcrumbs:
|
|
16
|
+
@property({ type: Array }) breadcrumbs: IBreadcrumb[] = []
|
|
18
17
|
|
|
19
|
-
private handleLinkClick(event: MouseEvent, item:
|
|
18
|
+
private handleLinkClick(event: MouseEvent, item: IBreadcrumb, index: number) {
|
|
20
19
|
const navigateEvent = new CustomEvent('navigate', {
|
|
21
20
|
detail: { item, index, originalEvent: event },
|
|
22
21
|
bubbles: true,
|
|
@@ -39,7 +38,7 @@ export class PktBreadcrumbs extends PktElement implements IPktBreadcrumbs {
|
|
|
39
38
|
const backLink = this.breadcrumbs[this.breadcrumbs.length - 2]
|
|
40
39
|
|
|
41
40
|
return html`
|
|
42
|
-
<nav class="pkt-breadcrumbs" aria-label
|
|
41
|
+
<nav class="pkt-breadcrumbs" aria-label=${this.pktStrings.get('breadcrumbs').ariaLabel}>
|
|
43
42
|
<ol class="pkt-breadcrumbs__list pkt-breadcrumbs--desktop">
|
|
44
43
|
${this.breadcrumbs.map((item, index) =>
|
|
45
44
|
index === this.breadcrumbs.length - 1
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { PktBreadcrumbs } from './breadcrumbs'
|
|
2
|
-
export type { IBreadcrumbItem, IPktBreadcrumbs } from './breadcrumbs'
|
|
2
|
+
export type { IBreadcrumb, IBreadcrumbItem, IPktBreadcrumbs } from './breadcrumbs'
|
|
@@ -95,12 +95,32 @@ export class PktCalendar extends PktElement {
|
|
|
95
95
|
today: string | null = null
|
|
96
96
|
|
|
97
97
|
// Localization strings
|
|
98
|
-
@
|
|
99
|
-
@property({ type: Array, attribute: 'day-strings
|
|
100
|
-
@
|
|
101
|
-
@property({ type:
|
|
102
|
-
@
|
|
103
|
-
@property({ type:
|
|
98
|
+
/** @deprecated Bruk `strings={{ dates: { daysShort: [...] } }}` eller `setPktStrings()`. */
|
|
99
|
+
@property({ type: Array, attribute: 'day-strings' }) dayStrings?: string[]
|
|
100
|
+
/** @deprecated Bruk `strings={{ dates: { days: [...] } }}` eller `setPktStrings()`. */
|
|
101
|
+
@property({ type: Array, attribute: 'day-strings-long' }) dayStringsLong?: string[]
|
|
102
|
+
/** @deprecated Bruk `strings={{ dates: { months: [...] } }}` eller `setPktStrings()`. */
|
|
103
|
+
@property({ type: Array, attribute: 'month-strings' }) monthStrings?: string[]
|
|
104
|
+
/** @deprecated Bruk `strings={{ dates: { week: '...' } }}` eller `setPktStrings()`. */
|
|
105
|
+
@property({ type: String, attribute: 'week-string' }) weekString?: string
|
|
106
|
+
/** @deprecated Bruk `strings={{ calendar: { prevMonth: '...' } }}` eller `setPktStrings()`. */
|
|
107
|
+
@property({ type: String, attribute: 'prev-month-string' }) prevMonthString?: string
|
|
108
|
+
/** @deprecated Bruk `strings={{ calendar: { nextMonth: '...' } }}` eller `setPktStrings()`. */
|
|
109
|
+
@property({ type: String, attribute: 'next-month-string' }) nextMonthString?: string
|
|
110
|
+
|
|
111
|
+
/** Datonavn og navigasjonstekster, med de utfasede enkeltpropene lagt oppå. */
|
|
112
|
+
protected get calendarStrings() {
|
|
113
|
+
const dates = this.pktStrings.get('dates')
|
|
114
|
+
const calendar = this.pktStrings.get('calendar')
|
|
115
|
+
return {
|
|
116
|
+
daysShort: this.dayStrings ?? dates.daysShort,
|
|
117
|
+
days: this.dayStringsLong ?? dates.days,
|
|
118
|
+
months: this.monthStrings ?? dates.months,
|
|
119
|
+
week: this.weekString ?? dates.week,
|
|
120
|
+
prevMonth: this.prevMonthString ?? calendar.prevMonth,
|
|
121
|
+
nextMonth: this.nextMonthString ?? calendar.nextMonth,
|
|
122
|
+
}
|
|
123
|
+
}
|
|
104
124
|
|
|
105
125
|
// Internal state - selection tracking
|
|
106
126
|
@property({ type: Array }) private _selected: Date[] = []
|
|
@@ -230,8 +250,7 @@ export class PktCalendar extends PktElement {
|
|
|
230
250
|
}}
|
|
231
251
|
>
|
|
232
252
|
<nav class="pkt-cal-month-nav">
|
|
233
|
-
${this.renderMonthNavButton('prev')}
|
|
234
|
-
${this.renderMonthNav()}
|
|
253
|
+
${this.renderMonthNavButton('prev')} ${this.renderMonthNav()}
|
|
235
254
|
${this.renderMonthNavButton('next')}
|
|
236
255
|
</nav>
|
|
237
256
|
<table
|
|
@@ -253,7 +272,8 @@ export class PktCalendar extends PktElement {
|
|
|
253
272
|
private renderMonthNavButton(direction: 'prev' | 'next'): TemplateResult {
|
|
254
273
|
const isPrev = direction === 'prev'
|
|
255
274
|
const isAllowed = isPrev ? this.isPrevMonthAllowed() : this.isNextMonthAllowed()
|
|
256
|
-
const
|
|
275
|
+
const { prevMonth, nextMonth } = this.calendarStrings
|
|
276
|
+
const label = isPrev ? prevMonth : nextMonth
|
|
257
277
|
const iconName = isPrev ? 'chevron-thin-left' : 'chevron-thin-right'
|
|
258
278
|
const className = isPrev ? 'pkt-calendar__prev-month' : 'pkt-calendar__next-month'
|
|
259
279
|
const onClick = isPrev ? () => this.prevMonth() : () => this.nextMonth()
|
|
@@ -284,28 +304,32 @@ export class PktCalendar extends PktElement {
|
|
|
284
304
|
const days: TemplateResult[] = []
|
|
285
305
|
|
|
286
306
|
if (this.weeknumbers) {
|
|
287
|
-
days.push(
|
|
307
|
+
days.push(
|
|
308
|
+
html`<th><div class="pkt-calendar__week-number">${this.calendarStrings.week}</div></th>`,
|
|
309
|
+
)
|
|
288
310
|
}
|
|
289
311
|
|
|
290
|
-
|
|
312
|
+
const { days: dayNames, daysShort } = this.calendarStrings
|
|
313
|
+
for (let i = 0; i < daysShort.length; i++) {
|
|
291
314
|
days.push(
|
|
292
315
|
html`<th>
|
|
293
|
-
<div class="pkt-calendar__day-name" aria-label="${
|
|
294
|
-
${this.dayStrings[i]}
|
|
295
|
-
</div>
|
|
316
|
+
<div class="pkt-calendar__day-name" aria-label="${dayNames[i]}">${daysShort[i]}</div>
|
|
296
317
|
</th>`,
|
|
297
318
|
)
|
|
298
319
|
}
|
|
299
320
|
|
|
300
|
-
return html`<tr class="pkt-cal-week-row"
|
|
321
|
+
return html`<tr class="pkt-cal-week-row">
|
|
322
|
+
${days}
|
|
323
|
+
</tr>`
|
|
301
324
|
}
|
|
302
325
|
|
|
303
326
|
private renderMonthNav(): TemplateResult {
|
|
327
|
+
const dates = this.pktStrings.get('dates')
|
|
304
328
|
if (this.withcontrols) {
|
|
305
329
|
return html`<div class="pkt-cal-month-picker">
|
|
306
|
-
<label for="${this.id}-monthnav" class="pkt-hide">${
|
|
330
|
+
<label for="${this.id}-monthnav" class="pkt-hide">${dates.month}</label>
|
|
307
331
|
<select
|
|
308
|
-
aria-label="${
|
|
332
|
+
aria-label="${dates.month}"
|
|
309
333
|
class="pkt-input pkt-input-compact"
|
|
310
334
|
id="${this.id}-monthnav"
|
|
311
335
|
@change=${(e: Event) => {
|
|
@@ -314,14 +338,14 @@ export class PktCalendar extends PktElement {
|
|
|
314
338
|
this.changeMonth(this.year, parseInt(target.value))
|
|
315
339
|
}}
|
|
316
340
|
>
|
|
317
|
-
${this.
|
|
341
|
+
${this.calendarStrings.months.map(
|
|
318
342
|
(month, index) =>
|
|
319
343
|
html`<option value=${index} ?selected=${this.month === index}>${month}</option>`,
|
|
320
344
|
)}
|
|
321
345
|
</select>
|
|
322
|
-
<label for="${this.id}-yearnav" class="pkt-hide">${
|
|
346
|
+
<label for="${this.id}-yearnav" class="pkt-hide">${dates.year}</label>
|
|
323
347
|
<input
|
|
324
|
-
aria-label="${
|
|
348
|
+
aria-label="${dates.year}"
|
|
325
349
|
class="pkt-input pkt-cal-input-year pkt-input-compact"
|
|
326
350
|
id="${this.id}-yearnav"
|
|
327
351
|
type="number"
|
|
@@ -338,7 +362,7 @@ export class PktCalendar extends PktElement {
|
|
|
338
362
|
}
|
|
339
363
|
|
|
340
364
|
return html`<div class="pkt-txt-16-medium pkt-calendar__month-title" aria-live="polite">
|
|
341
|
-
${this.
|
|
365
|
+
${this.calendarStrings.months[this.month]} ${this.year}
|
|
342
366
|
</div>`
|
|
343
367
|
}
|
|
344
368
|
|
|
@@ -393,10 +417,12 @@ export class PktCalendar extends PktElement {
|
|
|
393
417
|
|
|
394
418
|
private getDayCellClasses(data: TDayViewData) {
|
|
395
419
|
const { currentDateISO, isToday, isSelected } = data
|
|
396
|
-
const isRangeStart =
|
|
420
|
+
const isRangeStart =
|
|
421
|
+
this.range &&
|
|
397
422
|
(this.selected.length === 2 || this.rangeHovered !== null) &&
|
|
398
423
|
currentDateISO === this.selected[0]
|
|
399
|
-
const isRangeEnd =
|
|
424
|
+
const isRangeEnd =
|
|
425
|
+
this.range && this.selected.length === 2 && currentDateISO === this.selected[1]
|
|
400
426
|
|
|
401
427
|
return {
|
|
402
428
|
'pkt-cal-today': isToday,
|
|
@@ -412,10 +438,12 @@ export class PktCalendar extends PktElement {
|
|
|
412
438
|
|
|
413
439
|
private getDayButtonClasses(data: TDayViewData) {
|
|
414
440
|
const { currentDateISO, isToday, isSelected, isDisabled } = data
|
|
415
|
-
const isRangeStart =
|
|
441
|
+
const isRangeStart =
|
|
442
|
+
this.range &&
|
|
416
443
|
(this.selected.length === 2 || this.rangeHovered !== null) &&
|
|
417
444
|
currentDateISO === this.selected[0]
|
|
418
|
-
const isRangeEnd =
|
|
445
|
+
const isRangeEnd =
|
|
446
|
+
this.range && this.selected.length === 2 && currentDateISO === this.selected[1]
|
|
419
447
|
|
|
420
448
|
return {
|
|
421
449
|
'pkt-calendar__date': true,
|
|
@@ -489,7 +517,9 @@ export class PktCalendar extends PktElement {
|
|
|
489
517
|
}
|
|
490
518
|
|
|
491
519
|
private renderWeekRow(cells: TemplateResult[]): TemplateResult {
|
|
492
|
-
return html`<tr class="pkt-cal-week-row" role="row"
|
|
520
|
+
return html`<tr class="pkt-cal-week-row" role="row">
|
|
521
|
+
${cells}
|
|
522
|
+
</tr>`
|
|
493
523
|
}
|
|
494
524
|
|
|
495
525
|
private renderCalendarBody() {
|
|
@@ -406,7 +406,6 @@ describe('PktCheckbox', () => {
|
|
|
406
406
|
await checkbox.updateComplete
|
|
407
407
|
|
|
408
408
|
expect(checkbox.optionalTag).toBe(true)
|
|
409
|
-
expect(checkbox.optionalText).toBe('Valgfritt')
|
|
410
409
|
|
|
411
410
|
const optionalTag = checkbox.querySelector('.pkt-tag--blue-light')
|
|
412
411
|
expect(optionalTag).toBeInTheDocument()
|
|
@@ -423,7 +422,6 @@ describe('PktCheckbox', () => {
|
|
|
423
422
|
await checkbox.updateComplete
|
|
424
423
|
|
|
425
424
|
expect(checkbox.requiredTag).toBe(true)
|
|
426
|
-
expect(checkbox.requiredText).toBe('Må fylles ut')
|
|
427
425
|
|
|
428
426
|
const requiredTag = checkbox.querySelector('.pkt-tag--beige')
|
|
429
427
|
expect(requiredTag).toBeInTheDocument()
|
|
@@ -36,9 +36,11 @@ export class PktCheckbox extends PktInputElement<Props> {
|
|
|
36
36
|
@property({ type: String, reflect: true }) type: string = 'checkbox'
|
|
37
37
|
@property({ type: String }) tagText: string | null = null
|
|
38
38
|
@property({ type: Boolean }) optionalTag: boolean = false
|
|
39
|
-
@
|
|
39
|
+
/** @deprecated Bruk `strings={{ forms: { optional: '…' } }}` eller `setPktStrings()`. */
|
|
40
|
+
@property({ type: String }) optionalText?: string
|
|
40
41
|
@property({ type: Boolean }) requiredTag: boolean = false
|
|
41
|
-
@
|
|
42
|
+
/** @deprecated Bruk `strings={{ forms: { required: '…' } }}` eller `setPktStrings()`. */
|
|
43
|
+
@property({ type: String }) requiredText?: string
|
|
42
44
|
|
|
43
45
|
connectedCallback() {
|
|
44
46
|
super.connectedCallback()
|
|
@@ -108,16 +110,18 @@ export class PktCheckbox extends PktInputElement<Props> {
|
|
|
108
110
|
|
|
109
111
|
const tagClasses = 'pkt-tag pkt-tag--small pkt-tag--thin-text'
|
|
110
112
|
|
|
113
|
+
const formStrings = this.pktStrings.get('forms')
|
|
114
|
+
|
|
111
115
|
const tags = () => {
|
|
112
116
|
return html`
|
|
113
117
|
${this.tagText
|
|
114
118
|
? html`<span class=${tagClasses + ' pkt-tag--gray'}>${this.tagText}</span>`
|
|
115
119
|
: nothing}
|
|
116
120
|
${this.optionalTag
|
|
117
|
-
? html`<span class=${tagClasses + ' pkt-tag--blue-light'}>${this.optionalText}</span>`
|
|
121
|
+
? html`<span class=${tagClasses + ' pkt-tag--blue-light'}>${this.optionalText ?? formStrings.optional}</span>`
|
|
118
122
|
: nothing}
|
|
119
123
|
${this.requiredTag
|
|
120
|
-
? html`<span class=${tagClasses + ' pkt-tag--beige'}>${this.requiredText}</span>`
|
|
124
|
+
? html`<span class=${tagClasses + ' pkt-tag--beige'}>${this.requiredText ?? formStrings.required}</span>`
|
|
121
125
|
: nothing}
|
|
122
126
|
`
|
|
123
127
|
}
|
|
@@ -7,6 +7,7 @@ import specs from 'componentSpecs/combobox.json'
|
|
|
7
7
|
|
|
8
8
|
import type { IPktComboboxOption, TPktComboboxTagPlacement } from './combobox-types'
|
|
9
9
|
import PktListbox from '../listbox'
|
|
10
|
+
import type { TComboboxMessageKey } from 'shared-utils/combobox'
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Base class for PktCombobox.
|
|
@@ -42,7 +43,7 @@ export class ComboboxBase extends PktInputElement {
|
|
|
42
43
|
@state() override _options: IPktComboboxOption[] = []
|
|
43
44
|
@state() protected _value: string[] = []
|
|
44
45
|
@state() protected _isOptionsOpen = false
|
|
45
|
-
@state() protected _userInfoMessage:
|
|
46
|
+
@state() protected _userInfoMessage: TComboboxMessageKey = ''
|
|
46
47
|
@state() protected _addValueText: string | null = null
|
|
47
48
|
@state() protected _maxIsReached: boolean = false
|
|
48
49
|
@state() protected _search: string = ''
|
|
@@ -3,6 +3,7 @@ import { findOptionByValue, isMaxSelectionReached } from 'shared-utils/combobox/
|
|
|
3
3
|
import { getSingleValueForInput } from 'shared-utils/combobox/input-utils'
|
|
4
4
|
import { selectionMutators } from './combobox-utils'
|
|
5
5
|
import { ComboboxBase } from './combobox-base'
|
|
6
|
+
import type { TComboboxMessageKey } from 'shared-utils/combobox'
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Value management layer for PktCombobox.
|
|
@@ -27,7 +28,7 @@ export class ComboboxValue extends ComboboxBase {
|
|
|
27
28
|
|
|
28
29
|
let shouldOptionsBeOpen: boolean = false
|
|
29
30
|
let shouldResetInput: boolean = true
|
|
30
|
-
let userInfoMessage:
|
|
31
|
+
let userInfoMessage: TComboboxMessageKey = ''
|
|
31
32
|
let searchValue: string | null = ''
|
|
32
33
|
|
|
33
34
|
if (isDisabled) return
|
|
@@ -35,7 +36,7 @@ export class ComboboxValue extends ComboboxBase {
|
|
|
35
36
|
// Not in option list and allowUserInput is true
|
|
36
37
|
if (!isInOption && this.allowUserInput && !isEmpty) {
|
|
37
38
|
this.addNewUserValue(value)
|
|
38
|
-
userInfoMessage = '
|
|
39
|
+
userInfoMessage = 'valueAdded'
|
|
39
40
|
shouldOptionsBeOpen = isMultiple
|
|
40
41
|
}
|
|
41
42
|
|
|
@@ -46,7 +47,7 @@ export class ComboboxValue extends ComboboxBase {
|
|
|
46
47
|
}
|
|
47
48
|
shouldResetInput = false
|
|
48
49
|
shouldOptionsBeOpen = true
|
|
49
|
-
userInfoMessage = '
|
|
50
|
+
userInfoMessage = 'noResults'
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
// Value is already selected — deselect it
|
|
@@ -85,7 +86,7 @@ export class ComboboxValue extends ComboboxBase {
|
|
|
85
86
|
|
|
86
87
|
// Multi-select with max selections reached
|
|
87
88
|
else if (isMultiple && isMaxItemsReached) {
|
|
88
|
-
userInfoMessage = '
|
|
89
|
+
userInfoMessage = 'maxSelected'
|
|
89
90
|
shouldResetInput = false
|
|
90
91
|
searchValue = value
|
|
91
92
|
}
|
|
@@ -93,7 +94,7 @@ export class ComboboxValue extends ComboboxBase {
|
|
|
93
94
|
// No matching condition — fallback
|
|
94
95
|
else {
|
|
95
96
|
isSingle && this.removeAllSelected()
|
|
96
|
-
userInfoMessage = '
|
|
97
|
+
userInfoMessage = 'noValidValue'
|
|
97
98
|
shouldResetInput = false
|
|
98
99
|
shouldOptionsBeOpen = true
|
|
99
100
|
searchValue = value
|
|
@@ -121,7 +122,7 @@ export class ComboboxValue extends ComboboxBase {
|
|
|
121
122
|
if (this._value.includes(value as string)) return
|
|
122
123
|
|
|
123
124
|
if (this.multiple && isMaxSelectionReached(this._value.length, this.maxlength)) {
|
|
124
|
-
this._userInfoMessage = '
|
|
125
|
+
this._userInfoMessage = 'maxSelected'
|
|
125
126
|
return
|
|
126
127
|
}
|
|
127
128
|
|
|
@@ -152,7 +153,7 @@ export class ComboboxValue extends ComboboxBase {
|
|
|
152
153
|
protected addAllOptions(): void {
|
|
153
154
|
if (!this.multiple) return
|
|
154
155
|
if (this.maxlength && this._options.length > this.maxlength) {
|
|
155
|
-
this._userInfoMessage = '
|
|
156
|
+
this._userInfoMessage = 'tooManySelected'
|
|
156
157
|
return
|
|
157
158
|
}
|
|
158
159
|
|
|
@@ -173,10 +174,10 @@ export class ComboboxValue extends ComboboxBase {
|
|
|
173
174
|
this._search = input
|
|
174
175
|
|
|
175
176
|
// If the typed value is already selected, don't toggle (which would deselect).
|
|
176
|
-
// Just reset the input and keep the "
|
|
177
|
+
// Just reset the input and keep the "alreadySelected" message.
|
|
177
178
|
if (input && this._value.includes(input)) {
|
|
178
179
|
this.resetComboboxInput(true)
|
|
179
|
-
this._userInfoMessage = '
|
|
180
|
+
this._userInfoMessage = 'alreadySelected'
|
|
180
181
|
return
|
|
181
182
|
}
|
|
182
183
|
|
|
@@ -269,7 +269,11 @@ describe('PktCombobox', () => {
|
|
|
269
269
|
;(combobox as any).toggleValue('cherry')
|
|
270
270
|
await combobox.updateComplete
|
|
271
271
|
|
|
272
|
-
expect(combobox['_userInfoMessage']).toBe('
|
|
272
|
+
expect(combobox['_userInfoMessage']).toBe('maxSelected')
|
|
273
|
+
const listbox = container.querySelector('pkt-listbox') as HTMLElement & {
|
|
274
|
+
userMessage: string
|
|
275
|
+
}
|
|
276
|
+
expect(listbox.userMessage).toBe('Maks antall valg nådd')
|
|
273
277
|
})
|
|
274
278
|
|
|
275
279
|
test('allows deselection when at maxlength', async () => {
|
|
@@ -281,6 +281,7 @@ export class PktCombobox extends ComboboxHandlers implements IPktCombobox {
|
|
|
281
281
|
render() {
|
|
282
282
|
return html`
|
|
283
283
|
<pkt-input-wrapper
|
|
284
|
+
.strings=${this.strings}
|
|
284
285
|
.size=${this.inputSize}
|
|
285
286
|
.label=${this.label}
|
|
286
287
|
.helptext=${this.helptext}
|
|
@@ -371,7 +372,9 @@ export class PktCombobox extends ComboboxHandlers implements IPktCombobox {
|
|
|
371
372
|
?allow-user-input=${this.allowUserInput && !this._maxIsReached}
|
|
372
373
|
?max-is-reached=${this._maxIsReached}
|
|
373
374
|
.customUserInput=${ifDefined(this._addValueText)}
|
|
374
|
-
.userMessage=${this._userInfoMessage
|
|
375
|
+
.userMessage=${this._userInfoMessage
|
|
376
|
+
? this.pktStrings.get('combobox')[this._userInfoMessage]
|
|
377
|
+
: ''}
|
|
375
378
|
@search=${this.handleSearch}
|
|
376
379
|
@option-toggle=${this.handleOptionToggled}
|
|
377
380
|
@select-all=${this.addAllOptions}
|
|
@@ -1,125 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
i18n: {
|
|
3
|
-
nb: {
|
|
4
|
-
contentPresentation: {
|
|
5
|
-
title: 'Oslo kommune bruker informasjonskapsler',
|
|
6
|
-
description: [
|
|
7
|
-
'For at nettstedet skal fungere og være trygt, bruker Oslo kommune informasjonskapsler. Noen er teknisk nødvendige, mens andre sikrer ulik funksjonalitet.',
|
|
8
|
-
'Godtar du alle informasjonskapsler, tillater du også at vi samler inn data om statistikk og brukeradferd. Da hjelper du oss med å lage et bedre nettsted uten at du trenger å dele noe personlig informasjon med oss.',
|
|
9
|
-
],
|
|
10
|
-
buttons: {
|
|
11
|
-
accept: 'Godta alle',
|
|
12
|
-
reject: 'Kun nødvendige',
|
|
13
|
-
settings: 'Innstillinger for informasjonskapsler',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
contentSettings: {
|
|
17
|
-
title: 'Innstillinger for informasjonskapsler',
|
|
18
|
-
description: [
|
|
19
|
-
'Her kan du velge hvilke typer informasjonskapsler du vil tillate. Tillatelsen gjelder i 90 dager. Husk at nødvendige informasjonskapsler ikke kan velges bort.',
|
|
20
|
-
'Du kan når som helst endre innstillingene og finne mer informasjon nederst på nettstedet under «Innstillinger for informasjonskapsler» og «Personvern og informasjonskapsler».',
|
|
21
|
-
],
|
|
22
|
-
buttons: {
|
|
23
|
-
back: 'Tilbake',
|
|
24
|
-
save: 'Lagre innstillinger',
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
en: {
|
|
29
|
-
contentPresentation: {
|
|
30
|
-
title: 'Before you visit Oslo kommune ...',
|
|
31
|
-
description: [
|
|
32
|
-
'This website uses cookies to make improvements. In this context, we need your consent to measure the traffic on the website in relation to statistics and feedback.',
|
|
33
|
-
'To read more about what we use cookies for, go to our privacy declaration which you will find at the bottom of our websites.',
|
|
34
|
-
],
|
|
35
|
-
buttons: {
|
|
36
|
-
accept: 'Yes, I accept',
|
|
37
|
-
reject: 'Only necessary',
|
|
38
|
-
settings: 'Go to settings',
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
contentSettings: {
|
|
42
|
-
title: 'Her kan du aktivt velge mellom ulike informasjonskapsler',
|
|
43
|
-
description: [
|
|
44
|
-
'For å lese mer om hva vi bruker informasjonskapsler til gå til vår personvernserklering som du finner på våre nettsider',
|
|
45
|
-
],
|
|
46
|
-
buttons: {
|
|
47
|
-
back: 'Back',
|
|
48
|
-
save: 'Save settings',
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
cookies: [
|
|
54
|
-
{
|
|
55
|
-
name: 'statistics',
|
|
56
|
-
defaultValue: null,
|
|
57
|
-
i18n: {
|
|
58
|
-
nb: {
|
|
59
|
-
title: 'Statistikk og analyse',
|
|
60
|
-
description:
|
|
61
|
-
'Jeg godtar at Oslo kommune bruker informasjonskapsler til å innhente data om statistikk og brukeradferd.',
|
|
62
|
-
buttons: {
|
|
63
|
-
yes: 'Ja',
|
|
64
|
-
no: 'Nei',
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
en: {
|
|
68
|
-
title: 'Statistics and analytics',
|
|
69
|
-
description: 'Select your preference for statistics and analytics',
|
|
70
|
-
buttons: {
|
|
71
|
-
yes: 'Yes',
|
|
72
|
-
no: 'No',
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
name: 'survey',
|
|
79
|
-
defaultValue: null,
|
|
80
|
-
i18n: {
|
|
81
|
-
nb: {
|
|
82
|
-
title: 'Skriftlige tilbakemeldinger',
|
|
83
|
-
description:
|
|
84
|
-
'Jeg godtar at Oslo kommune bruker informasjonskapsler til å vise responsfelt og registrere tilbakemeldinger.',
|
|
85
|
-
buttons: {
|
|
86
|
-
yes: 'Ja',
|
|
87
|
-
no: 'Nei',
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
en: {
|
|
91
|
-
title: 'Survey',
|
|
92
|
-
description: 'Select your preference for survey',
|
|
93
|
-
buttons: {
|
|
94
|
-
yes: 'Yes',
|
|
95
|
-
no: 'No',
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
name: 'functional',
|
|
102
|
-
defaultValue: true,
|
|
103
|
-
i18n: {
|
|
104
|
-
nb: {
|
|
105
|
-
title: 'Funksjonelle informasjonskapsler',
|
|
106
|
-
description:
|
|
107
|
-
'Jeg godtar at Oslo kommune bruker informasjonskapsler for å gjøre ulike funksjoner på nettstedet mulige (for eksempel skjemaer og barnehagevelger).',
|
|
108
|
-
buttons: {
|
|
109
|
-
yes: 'Ja',
|
|
110
|
-
no: 'Nei',
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
en: {
|
|
114
|
-
title: 'Functional cookies',
|
|
115
|
-
description:
|
|
116
|
-
'For the website to function optimally, we recommend that you accept these cookies',
|
|
117
|
-
buttons: {
|
|
118
|
-
yes: 'Yes',
|
|
119
|
-
no: 'No',
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
],
|
|
125
|
-
}
|
|
1
|
+
export { consentStrings } from 'shared-strings/consent'
|