@oslokommune/punkt-elements 17.0.9 → 17.1.2
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 +36 -0
- package/dist/{accordion-CbXDxOho.cjs → accordion-B3GBlvUC.cjs} +2 -2
- package/dist/{accordion-DEUHQ4JD.js → accordion-BeLvLPrB.js} +12 -11
- package/dist/{alert-CkUnbPdA.cjs → alert-Cs4Rmq_J.cjs} +1 -1
- package/dist/{alert-CbtVGrHD.js → alert-DKK_Tb9J.js} +5 -5
- package/dist/{async-directive-Cw_7VW_-.js → async-directive-BPf6K-V2.js} +9 -6
- package/dist/async-directive-Da7TJpnq.cjs +1 -0
- package/dist/{backlink-DDGlLzk9.cjs → backlink-CMmrKTe4.cjs} +1 -1
- package/dist/{backlink-wMNLuQ0X.js → backlink-D1y26pj3.js} +3 -3
- package/dist/base-elements/input-element.d.ts +9 -4
- package/dist/booleanish-BF8l4scU.cjs +1 -0
- package/dist/{booleanish-MfutDT_4.js → booleanish-OQJTYSrw.js} +8 -1
- package/dist/{breadcrumbs-D3tfWqvC.cjs → breadcrumbs-B6JGhJgC.cjs} +1 -1
- package/dist/{breadcrumbs-CVTLNNsL.js → breadcrumbs-CcTQ3Grm.js} +2 -2
- package/dist/{button-Cod17rKo.js → button-2-OSPJkj.js} +10 -10
- package/dist/{button-gvDXtBMC.cjs → button-CE97NQIk.cjs} +2 -2
- package/dist/{calendar-BVXW8DqC.cjs → calendar-kn4SrtJy.cjs} +1 -1
- package/dist/{calendar-CjC4qlh6.js → calendar-pOW3R5Pw.js} +4 -4
- package/dist/{card-sydjK3Bb.cjs → card-CETDFkxR.cjs} +3 -3
- package/dist/{card-sDOe54um.js → card-zQ0eKRMV.js} +9 -8
- package/dist/{checkbox-DJDphhqz.js → checkbox-CH7NpINF.js} +12 -12
- package/dist/{checkbox-8uxbeU30.cjs → checkbox-CQNr_sEg.cjs} +8 -8
- package/dist/{class-map-CCZN5uS3.cjs → class-map-BeimMvPv.cjs} +1 -1
- package/dist/{class-map-CAQCRB1W.js → class-map-CnWCnBSX.js} +2 -2
- package/dist/combobox-Bvg0UO9w.cjs +139 -0
- package/dist/{combobox-CzZIf5hd.js → combobox-CRdYYlxu.js} +68 -37
- package/dist/components/accordion/accordion.d.ts +1 -1
- package/dist/components/accordion/accordionitem.d.ts +1 -1
- package/dist/components/alert/alert.d.ts +1 -1
- package/dist/components/backlink/backlink.d.ts +1 -1
- package/dist/components/breadcrumbs/breadcrumbs.d.ts +1 -1
- package/dist/components/button/button.d.ts +1 -1
- package/dist/components/card/card.d.ts +9 -9
- package/dist/components/checkbox/checkbox.d.ts +1 -1
- package/dist/components/combobox/combobox.d.ts +1 -1
- package/dist/components/consent/consent.d.ts +1 -1
- package/dist/components/datepicker/date-tags.d.ts +1 -1
- package/dist/components/datepicker/datepicker-multiple.d.ts +1 -1
- package/dist/components/datepicker/datepicker-popup.d.ts +1 -1
- package/dist/components/datepicker/datepicker-range.d.ts +1 -1
- package/dist/components/datepicker/datepicker-single.d.ts +1 -1
- package/dist/components/datepicker/datepicker-utils.d.ts +2 -2
- package/dist/components/datepicker/datepicker.d.ts +5 -5
- package/dist/components/fileupload/fileupload-base.d.ts +1 -1
- package/dist/components/fileupload/fileupload-renderers.d.ts +2 -2
- package/dist/components/fileupload/fileupload.d.ts +3 -1
- package/dist/components/header/header-user-menu.d.ts +1 -1
- package/dist/components/header/header.d.ts +1 -1
- package/dist/components/helptext/helptext.d.ts +1 -1
- package/dist/components/icon/icon.d.ts +1 -1
- package/dist/components/input-wrapper/input-wrapper.d.ts +1 -1
- package/dist/components/input-wrapper/tri-state.test.d.ts +0 -0
- package/dist/components/input-wrapper/wrapper-parity.test.d.ts +1 -0
- package/dist/components/link/link.d.ts +1 -1
- package/dist/components/linkcard/linkcard.d.ts +1 -1
- package/dist/components/listbox/listbox.d.ts +1 -1
- package/dist/components/loader/loader.d.ts +1 -1
- package/dist/components/messagebox/messagebox.d.ts +1 -1
- package/dist/components/modal/modal.d.ts +1 -1
- package/dist/components/progressbar/progressbar.d.ts +1 -1
- package/dist/components/radiobutton/radiobutton.d.ts +1 -1
- package/dist/components/searchinput/searchinput.d.ts +1 -1
- package/dist/components/select/select.d.ts +1 -1
- package/dist/components/select/select.test.d.ts +2 -2
- package/dist/components/tabs/tabitem.d.ts +1 -1
- package/dist/components/tabs/tabs.d.ts +1 -1
- package/dist/components/tag/tag.d.ts +1 -1
- package/dist/components/textarea/textarea.d.ts +3 -2
- package/dist/components/textarea/textarea.test.d.ts +2 -2
- package/dist/components/textinput/textinput.d.ts +1 -1
- package/dist/components/textinput/textinput.test.d.ts +2 -2
- package/dist/components/timepicker/timepicker.d.ts +1 -1
- package/dist/{consent--Nw43WFU.cjs → consent-CyY3RyoC.cjs} +1 -1
- package/dist/{consent-B2hSTCGC.js → consent-DZEkhgJ1.js} +2 -2
- package/dist/{consume-BiOhrhEy.js → consume-BDnMAp2g.js} +6 -6
- package/dist/{consume-DKf5SmP9.cjs → consume-Le4HztPo.cjs} +1 -1
- package/dist/converters-BJ9Fe0kW.cjs +1 -0
- package/dist/{converters-BBfsEJV5.js → converters-CkjLSYpa.js} +200 -202
- package/dist/{datepicker-BMuplkDE.js → datepicker-ButIas85.js} +46 -22
- package/dist/{datepicker-DrB54Rhc.cjs → datepicker-VTqSDQk5.cjs} +7 -8
- package/dist/dialog-polyfill.esm-B-g35ove.cjs +1 -0
- package/dist/{dialog-polyfill.esm-ChZRzCVh.js → dialog-polyfill.esm-DHSvqor8.js} +2 -2
- package/dist/{directive-helpers-BshFvt7A.cjs → directive-helpers-BlAV5EQD.cjs} +1 -1
- package/dist/{directive-helpers-DIF5DwN4.js → directive-helpers-CI8YZqku.js} +2 -2
- package/dist/directives/slot-content.d.ts +1 -1
- package/dist/docs/backlink.d.ts +1 -1
- package/dist/docs/components/accordion.d.ts +1 -1
- package/dist/docs/components/alert.d.ts +1 -1
- package/dist/docs/components/backlink.d.ts +1 -1
- package/dist/docs/components/breadcrumbs.d.ts +1 -1
- package/dist/docs/components/button.d.ts +1 -1
- package/dist/docs/components/calendar.d.ts +1 -1
- package/dist/docs/components/card.d.ts +1 -1
- package/dist/docs/components/checkbox.d.ts +1 -1
- package/dist/docs/components/combobox.d.ts +1 -1
- package/dist/docs/components/comboboxdemo.d.ts +1 -1
- package/dist/docs/components/consent.d.ts +1 -1
- package/dist/docs/components/datepicker.d.ts +1 -1
- package/dist/docs/components/datepickermultiple.d.ts +1 -1
- package/dist/docs/components/event-log.d.ts +1 -1
- package/dist/docs/components/fileupload.d.ts +1 -1
- package/dist/docs/components/footer.d.ts +1 -1
- package/dist/docs/components/form-sizes.d.ts +1 -1
- package/dist/docs/components/form.d.ts +1 -1
- package/dist/docs/components/header-full.d.ts +1 -1
- package/dist/docs/components/header-global-full.d.ts +1 -1
- package/dist/docs/components/header-global.d.ts +1 -1
- package/dist/docs/components/header-menu.d.ts +1 -1
- package/dist/docs/components/header.d.ts +1 -1
- package/dist/docs/components/heading.d.ts +1 -1
- package/dist/docs/components/icon.d.ts +1 -1
- package/dist/docs/components/input-wrapper.d.ts +1 -1
- package/dist/docs/components/link.d.ts +1 -1
- package/dist/docs/components/linkcard.d.ts +1 -1
- package/dist/docs/components/loader.d.ts +1 -1
- package/dist/docs/components/messagebox.d.ts +1 -1
- package/dist/docs/components/modal.d.ts +1 -1
- package/dist/docs/components/progressbar.d.ts +1 -1
- package/dist/docs/components/radiobutton.d.ts +1 -1
- package/dist/docs/components/searchinput.d.ts +1 -1
- package/dist/docs/components/select.d.ts +1 -1
- package/dist/docs/components/slots.d.ts +1 -1
- package/dist/docs/components/tabs.d.ts +1 -1
- package/dist/docs/components/tag.d.ts +1 -1
- package/dist/docs/components/textarea.d.ts +1 -1
- package/dist/docs/components/textinput.d.ts +1 -1
- package/dist/docs/components/timepicker.d.ts +1 -1
- package/dist/docs/components/verifisering.d.ts +15 -0
- package/dist/docs/header.d.ts +1 -1
- package/dist/docs/punkt-docs.d.ts +1 -1
- package/dist/element-BA8v6S7z.cjs +2 -0
- package/dist/{element-BoJrqauR.js → element-ChsFgr_B.js} +19 -16
- package/dist/{element-with-slot-BY7Jc-q8.cjs → element-with-slot-Bj7nm7fO.cjs} +1 -1
- package/dist/{element-with-slot-mXLg8gg8.js → element-with-slot-BvG9ctC-.js} +2 -2
- package/dist/fetch-header-footer-data-CUKV0biS.cjs +1 -0
- package/dist/{fileupload-CGKUJrlj.cjs → fileupload-BeWiTAoW.cjs} +8 -8
- package/dist/{fileupload-D4gQN64T.js → fileupload-D5IQ9HDe.js} +25 -20
- package/dist/{footer-Ber-jqM1.cjs → footer-DbYQUYNR.cjs} +1 -1
- package/dist/{footer-BIrJeRuZ.js → footer-DrR64HiK.js} +6 -6
- package/dist/{header-BFk1an4z.cjs → header-ClgIac6n.cjs} +12 -12
- package/dist/{header-Deg_LGJo.js → header-KvJ1mGwA.js} +48 -38
- package/dist/{header-menu-BHqK4QA6.cjs → header-menu-BAsUNKSx.cjs} +3 -3
- package/dist/{header-menu-GFtJKM4j.js → header-menu-hVPXsb8g.js} +10 -8
- package/dist/{heading-DyJpBFT2.cjs → heading-CFmiSuCQ.cjs} +1 -1
- package/dist/{heading-CD0PhL8g.js → heading-g-_IUB5T.js} +2 -2
- package/dist/{helptext-Cq5rNaAC.cjs → helptext-CTtKJcML.cjs} +4 -1
- package/dist/{helptext-C_brWCIT.js → helptext-DZng1D5i.js} +18 -14
- package/dist/{icon-B8PVq2O6.cjs → icon-9iwd2F2l.cjs} +1 -1
- package/dist/{icon-DGFEIlco.js → icon-D-LA22xD.js} +2 -2
- package/dist/if-defined-B89_ZeCj.cjs +1 -0
- package/dist/if-defined-CGzIlZ9-.js +5 -0
- package/dist/{input-element-C0RnXi-J.js → input-element-DBMNBplu.js} +155 -129
- package/dist/{input-element-B0qLbEdF.cjs → input-element-DYmQw-fH.cjs} +1 -1
- package/dist/input-wrapper-BmxNvznr.js +128 -0
- package/dist/{input-wrapper-BweP6t3O.js → input-wrapper-D-fPaTbY.js} +2 -2
- package/dist/{input-wrapper-wh3fWIhk.cjs → input-wrapper-D5PR0rJn.cjs} +1 -1
- package/dist/input-wrapper-Q-B-aBeb.cjs +54 -0
- package/dist/{link-FmkQvSQL.js → link-D-Eqm5KH.js} +8 -7
- package/dist/{link-Geze7498.cjs → link-DK7gvmnj.cjs} +2 -2
- package/dist/{linkcard-6LCXRTR-.cjs → linkcard-B29cmZqh.cjs} +1 -1
- package/dist/{linkcard-BKdT0zU_.js → linkcard-zqbg7Oqm.js} +4 -4
- package/dist/{listbox-89wMuQVK.cjs → listbox-Dc4rGdPi.cjs} +2 -2
- package/dist/{listbox-LdyWPu7W.js → listbox-va_E8afs.js} +6 -10
- package/dist/{loader-CgW4Vst3.cjs → loader-CMUkVJmE.cjs} +1 -1
- package/dist/{loader-BA-i8CaQ.js → loader-D_RDICnw.js} +4 -4
- package/dist/{messagebox-VD5oEZ19.cjs → messagebox-Cv8LaSxv.cjs} +1 -1
- package/dist/{messagebox-fiaAyHLG.js → messagebox-Cw-OWDya.js} +7 -6
- package/dist/{modal-CPnFteYS.cjs → modal-BtInv031.cjs} +1 -1
- package/dist/{modal-xNK_wpHk.js → modal-D0t_X2dX.js} +6 -6
- 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 +34 -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-DMxYwnnj.js → pkt-options-controller-B77vH3PE.js} +1 -1
- package/dist/{pkt-options-controller-CPrfqepu.cjs → pkt-options-controller-C5EBX2T0.cjs} +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-mtjtbpCO.js → progressbar-CbcfLerF.js} +6 -6
- package/dist/progressbar-D5MmnQId.cjs +17 -0
- package/dist/{radiobutton-C6htwDrT.js → radiobutton-BUnf3EPi.js} +8 -8
- package/dist/{radiobutton-DjWBoSHv.cjs → radiobutton-DpsO1F-8.cjs} +4 -4
- package/dist/ref-CQoEIIp0.cjs +1 -0
- package/dist/{ref-WGS0u7i2.js → ref-CWD6PjVd.js} +9 -7
- package/dist/{repeat-BH0cL82q.js → repeat-C02g7d5S.js} +13 -12
- package/dist/{repeat-DRnLAg0O.cjs → repeat-sY6B7fAT.cjs} +1 -1
- package/dist/{searchinput-DGjeN1YI.cjs → searchinput-Bh975rjX.cjs} +1 -1
- package/dist/{searchinput-CfUVfpqL.js → searchinput-DwnjsvJ1.js} +4 -4
- package/dist/select-BOJi6H6T.cjs +49 -0
- package/dist/{select-CsBXXbLP.js → select-DMre80qs.js} +24 -20
- package/dist/shared-types/booleanish.d.ts +11 -0
- package/dist/shared-types/index.d.ts +1 -1
- package/dist/shared-utils/date-utils.d.ts +16 -16
- package/dist/shared-utils/datepicker-utils.d.ts +11 -11
- package/dist/shared-utils/device-utils.d.ts +1 -1
- package/dist/shared-utils/forms/described-by.d.ts +24 -0
- package/dist/shared-utils/utils.d.ts +2 -2
- package/dist/shared-utils/value-utils.d.ts +2 -2
- package/dist/{tabs-q62MK_-r.cjs → tabs-Cf9ai0FD.cjs} +2 -2
- package/dist/{tabs-BqrKLCjd.js → tabs-TvxgbrCF.js} +7 -7
- package/dist/{tag-XE-VRxT2.cjs → tag-CzojNU7z.cjs} +1 -1
- package/dist/{tag-BTiTXyf5.js → tag-Ds6n1LIs.js} +5 -5
- package/dist/textarea-BydiLM9Z.cjs +49 -0
- package/dist/{textarea-Cm392CEI.js → textarea-vfzIcXhX.js} +36 -29
- package/dist/{textinput-TSPcBcih.js → textinput-CMP2jPP_.js} +30 -25
- package/dist/{textinput-DqJbTglM.cjs → textinput-DGdicNSx.cjs} +10 -10
- package/dist/{timepicker-DWbgTDKq.js → timepicker-ClwgYywH.js} +19 -14
- package/dist/{timepicker-CqFYMV8q.cjs → timepicker-DYrnLHqN.cjs} +5 -2
- package/dist/translations/no.json.d.ts +2 -1
- package/package.json +7 -4
- package/src/components/combobox/combobox.core.test.ts +2 -2
- package/src/components/combobox/combobox.ts +7 -1
- package/src/components/datepicker/datepicker-single.ts +1 -1
- package/src/components/datepicker/datepicker.ts +5 -3
- package/src/components/fileupload/fileupload.ts +6 -1
- package/src/components/helptext/helptext.ts +3 -0
- package/src/components/input-wrapper/input-wrapper.test.ts +3 -3
- package/src/components/input-wrapper/input-wrapper.ts +31 -29
- package/src/components/input-wrapper/tri-state.test.ts +91 -0
- package/src/components/input-wrapper/wrapper-parity.test.ts +141 -0
- package/src/components/select/select.test.ts +8 -7
- package/src/components/select/select.ts +13 -5
- package/src/components/textarea/textarea.test.ts +6 -6
- package/src/components/textarea/textarea.ts +20 -11
- package/src/components/textinput/textinput.test.ts +6 -6
- package/src/components/textinput/textinput.ts +17 -11
- package/src/components/timepicker/timepicker.ts +12 -5
- package/dist/async-directive-HLXOyE4A.cjs +0 -1
- package/dist/booleanish-B9Kf0nES.cjs +0 -1
- package/dist/combobox-BH9lym0-.cjs +0 -136
- package/dist/converters-Cd0fPEly.cjs +0 -1
- package/dist/dialog-polyfill.esm-J-GKtwrS.cjs +0 -1
- package/dist/element-DJzurxgt.cjs +0 -2
- package/dist/fetch-header-footer-data-xohWFmYC.cjs +0 -1
- package/dist/if-defined-D0bnetLJ.js +0 -5
- package/dist/if-defined-DrwbxQOj.cjs +0 -1
- package/dist/input-wrapper-DPkkiG7S.cjs +0 -57
- package/dist/input-wrapper-fWV5P4MN.js +0 -126
- package/dist/progressbar-BN5y20CC.cjs +0 -17
- package/dist/ref-DO7TzO4O.cjs +0 -1
- package/dist/select-CZvAW7W2.cjs +0 -50
- package/dist/textarea-sTcZxOIB.cjs +0 -47
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { a as e, c as t, d as n, f as r, l as i, n as a, o, p as s, s as c, u as l } from "./element-
|
|
2
|
-
import { t as u } from "./class-map-
|
|
3
|
-
import { i as d, r as f } from "./directive-helpers-
|
|
4
|
-
import { n as p } from "./element-with-slot-
|
|
5
|
-
import "./icon-
|
|
6
|
-
import { t as m } from "./if-defined-
|
|
7
|
-
import { n as h, t as g } from "./ref-
|
|
8
|
-
import { t as _ } from "./input-element-
|
|
9
|
-
import "./input-wrapper-
|
|
10
|
-
//#region node_modules/lit
|
|
11
|
-
var
|
|
1
|
+
import { a as e, c as t, d as n, f as r, l as i, n as a, o, p as s, s as c, u as l } from "./element-ChsFgr_B.js";
|
|
2
|
+
import { t as u } from "./class-map-CnWCnBSX.js";
|
|
3
|
+
import { i as d, r as f } from "./directive-helpers-CI8YZqku.js";
|
|
4
|
+
import { n as p } from "./element-with-slot-BvG9ctC-.js";
|
|
5
|
+
import "./icon-D-LA22xD.js";
|
|
6
|
+
import { t as m } from "./if-defined-CGzIlZ9-.js";
|
|
7
|
+
import { n as h, t as g } from "./ref-CWD6PjVd.js";
|
|
8
|
+
import { t as _ } from "./input-element-DBMNBplu.js";
|
|
9
|
+
import { r as v } from "./input-wrapper-BmxNvznr.js";
|
|
10
|
+
//#region ../../node_modules/lit-html/directives/live.js
|
|
11
|
+
var y = t(class extends i {
|
|
12
12
|
constructor(e) {
|
|
13
13
|
if (super(e), e.type !== l.PROPERTY && e.type !== l.ATTRIBUTE && e.type !== l.BOOLEAN_ATTRIBUTE) throw Error("The `live` directive is not allowed on child or event bindings");
|
|
14
14
|
if (!d(e)) throw Error("`live` bindings can only contain a single expression");
|
|
@@ -26,26 +26,27 @@ var v = t(class extends i {
|
|
|
26
26
|
} else if (e.type === l.ATTRIBUTE && i.getAttribute(a) === t + "") return r;
|
|
27
27
|
return f(e), t;
|
|
28
28
|
}
|
|
29
|
-
}),
|
|
29
|
+
}), b = class extends _ {
|
|
30
30
|
constructor(...e) {
|
|
31
|
-
super(...e), this.inputRef = g(), this.value = "", this.autocomplete = "off", this.rows = null, this.counterCurrent = 0;
|
|
31
|
+
super(...e), this.inputRef = g(), this.value = "", this.autocomplete = "off", this.rows = null, this.cols = null, this.counterCurrent = 0;
|
|
32
32
|
}
|
|
33
33
|
attributeChangedCallback(e, t, n) {
|
|
34
34
|
e === "value" && this.value !== t && (this.counterCurrent = n ? n.length : 0), super.attributeChangedCallback(e, t, n);
|
|
35
35
|
}
|
|
36
36
|
updated(e) {
|
|
37
|
-
super.updated(e), e.has("value") && (this.counterCurrent = this.value?.length || 0, this.valueChanged(this.value, e.get("value"))), e.has("id") && !this.name && this.id && (this.name = this.id);
|
|
37
|
+
super.updated(e), this.classList.add("pkt-textinput", "pkt-textarea"), e.has("value") && (this.counterCurrent = this.value?.length || 0, this.valueChanged(this.value, e.get("value"))), e.has("id") && !this.name && this.id && (this.name = this.id);
|
|
38
38
|
}
|
|
39
39
|
render() {
|
|
40
|
-
let e = u({
|
|
40
|
+
let e = this.effectiveCounter(this.counterMaxLength > 0), t = u({
|
|
41
41
|
"pkt-input": !0,
|
|
42
42
|
[`pkt-input--${this.inputSize}`]: !0,
|
|
43
43
|
"pkt-input--fullwidth": this.fullwidth,
|
|
44
|
-
"pkt-input--counter-error":
|
|
45
|
-
}),
|
|
44
|
+
"pkt-input--counter-error": e && this.counterMaxLength > 0 && this.value.length > this.counterMaxLength
|
|
45
|
+
}), n = this.ariaLabelledby || `${this.id}-input-label`;
|
|
46
46
|
return s`<pkt-input-wrapper
|
|
47
47
|
label=${this.label}
|
|
48
|
-
?counter=${
|
|
48
|
+
?counter=${e}
|
|
49
|
+
?hasFieldset=${this.effectiveHasFieldset(!1)}
|
|
49
50
|
?disabled=${this.disabled}
|
|
50
51
|
?hasError=${this.hasError}
|
|
51
52
|
?inline=${this.inline}
|
|
@@ -53,8 +54,8 @@ var v = t(class extends i {
|
|
|
53
54
|
?required=${this.required}
|
|
54
55
|
?requiredTag=${this.requiredTag}
|
|
55
56
|
useWrapper=${this.useWrapper}
|
|
56
|
-
.
|
|
57
|
-
.counterCurrent=${this.
|
|
57
|
+
.ariaDescribedby=${this.ariaDescribedby}
|
|
58
|
+
.counterCurrent=${this.value?.length ?? 0}
|
|
58
59
|
.counterMaxLength=${this.counterMaxLength}
|
|
59
60
|
.errorMessage=${this.errorMessage}
|
|
60
61
|
.forId="${this.id + "-input"}"
|
|
@@ -65,24 +66,30 @@ var v = t(class extends i {
|
|
|
65
66
|
.requiredText=${this.requiredText}
|
|
66
67
|
.tagText=${this.tagText}
|
|
67
68
|
.size=${this.inputSize}
|
|
68
|
-
class="pkt-textarea"
|
|
69
69
|
>
|
|
70
70
|
<div class="pkt-contents" slot="helptext">${p(this, "helptext")}</div>
|
|
71
71
|
<textarea
|
|
72
72
|
${h(this.inputRef)}
|
|
73
|
-
class=${
|
|
73
|
+
class=${t}
|
|
74
74
|
id=${this.id + "-input"}
|
|
75
75
|
name=${(this.name || this.id) + "-input"}
|
|
76
76
|
placeholder=${m(this.placeholder)}
|
|
77
|
-
.value=${
|
|
77
|
+
.value=${y(this.value)}
|
|
78
78
|
minlength=${m(this.minlength)}
|
|
79
79
|
maxlength=${m(this.maxlength)}
|
|
80
80
|
?readonly=${this.readonly}
|
|
81
81
|
autocomplete=${this.autocomplete}
|
|
82
|
-
aria-labelledby=${
|
|
82
|
+
aria-labelledby=${n}
|
|
83
83
|
aria-invalid=${this.hasError}
|
|
84
|
-
aria-errormessage=${`${this.id}-error`}
|
|
84
|
+
aria-errormessage=${m(this.hasError ? `${this.id}-input-error` : void 0)}
|
|
85
|
+
aria-describedby=${m(v({
|
|
86
|
+
id: this.id + "-input",
|
|
87
|
+
hasHelptext: !!this.helptext,
|
|
88
|
+
hasCounter: e,
|
|
89
|
+
ariaDescribedby: this.ariaDescribedby
|
|
90
|
+
}))}
|
|
85
91
|
rows=${m(this.rows ?? void 0)}
|
|
92
|
+
cols=${m(this.cols ?? void 0)}
|
|
86
93
|
?disabled=${this.disabled}
|
|
87
94
|
@input=${(e) => {
|
|
88
95
|
this.value = e.target.value, this.onInput(), e.stopImmediatePropagation();
|
|
@@ -103,14 +110,14 @@ var v = t(class extends i {
|
|
|
103
110
|
a([o({
|
|
104
111
|
type: String,
|
|
105
112
|
reflect: !0
|
|
106
|
-
})],
|
|
113
|
+
})], b.prototype, "value", void 0), a([o({ type: String })], b.prototype, "autocomplete", void 0), a([o({ type: Number })], b.prototype, "rows", void 0), a([o({ type: Number })], b.prototype, "cols", void 0), a([e()], b.prototype, "counterCurrent", void 0);
|
|
107
114
|
try {
|
|
108
|
-
c("pkt-textarea")(
|
|
115
|
+
c("pkt-textarea")(b);
|
|
109
116
|
} catch {
|
|
110
117
|
console.warn("Forsøker å definere <pkt-textarea>, men den er allerede definert");
|
|
111
118
|
}
|
|
112
119
|
//#endregion
|
|
113
120
|
//#region src/components/textarea/index.ts
|
|
114
|
-
var
|
|
121
|
+
var x = b;
|
|
115
122
|
//#endregion
|
|
116
|
-
export {
|
|
123
|
+
export { b as n, x as t };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { a as e, d as t, n, o as r, p as i, s as a } from "./element-
|
|
2
|
-
import { t as o } from "./class-map-
|
|
3
|
-
import { n as s } from "./element-with-slot-
|
|
4
|
-
import "./icon-
|
|
5
|
-
import { t as c } from "./if-defined-
|
|
6
|
-
import { n as l, t as u } from "./ref-
|
|
7
|
-
import { t as d } from "./input-element-
|
|
8
|
-
import "./input-wrapper-
|
|
1
|
+
import { a as e, d as t, n, o as r, p as i, s as a } from "./element-ChsFgr_B.js";
|
|
2
|
+
import { t as o } from "./class-map-CnWCnBSX.js";
|
|
3
|
+
import { n as s } from "./element-with-slot-BvG9ctC-.js";
|
|
4
|
+
import "./icon-D-LA22xD.js";
|
|
5
|
+
import { t as c } from "./if-defined-CGzIlZ9-.js";
|
|
6
|
+
import { n as l, t as u } from "./ref-CWD6PjVd.js";
|
|
7
|
+
import { t as d } from "./input-element-DBMNBplu.js";
|
|
8
|
+
import { r as f } from "./input-wrapper-BmxNvznr.js";
|
|
9
9
|
//#region src/components/textinput/textinput.ts
|
|
10
|
-
var
|
|
10
|
+
var p = class extends d {
|
|
11
11
|
constructor(...e) {
|
|
12
12
|
super(...e), this.inputRef = u(), this.value = "", this.type = "text", this.size = null, this.autocomplete = null, this.iconNameRight = null, this.prefix = null, this.suffix = null, this.omitSearchIcon = !1, this.counterCurrent = 0;
|
|
13
13
|
}
|
|
@@ -15,29 +15,29 @@ var f = class extends d {
|
|
|
15
15
|
e === "value" && this.value !== t && (this.counterCurrent = n ? n.length : 0), super.attributeChangedCallback(e, t, n);
|
|
16
16
|
}
|
|
17
17
|
updated(e) {
|
|
18
|
-
super.updated(e), e.has("value") && (this.counterCurrent = this.value?.length || 0, this.valueChanged(this.value, e.get("value"))), e.has("id") && !this.name && this.id && (this.name = this.id);
|
|
18
|
+
super.updated(e), this.classList.add("pkt-textinput"), e.has("value") && (this.counterCurrent = this.value?.length || 0, this.valueChanged(this.value, e.get("value"))), e.has("id") && !this.name && this.id && (this.name = this.id);
|
|
19
19
|
}
|
|
20
20
|
render() {
|
|
21
|
-
let e = this.type === "search" && !this.iconNameRight && !this.omitSearchIcon, n = o({
|
|
21
|
+
let e = this.type === "search" && !this.iconNameRight && !this.omitSearchIcon, n = this.effectiveCounter(this.counterMaxLength > 0), r = o({
|
|
22
22
|
"pkt-input": !0,
|
|
23
23
|
[`pkt-input--${this.inputSize}`]: !0,
|
|
24
24
|
"pkt-input--fullwidth": this.fullwidth,
|
|
25
|
-
"pkt-input--counter-error":
|
|
26
|
-
}),
|
|
25
|
+
"pkt-input--counter-error": n && this.counterMaxLength > 0 && this.value.length > this.counterMaxLength
|
|
26
|
+
}), a = this.ariaLabelledby || `${this.id}-input-label`;
|
|
27
27
|
return i`
|
|
28
28
|
<pkt-input-wrapper
|
|
29
29
|
label="${this.label}"
|
|
30
|
-
?counter=${
|
|
30
|
+
?counter=${n}
|
|
31
|
+
?hasFieldset=${this.effectiveHasFieldset(!1)}
|
|
31
32
|
?disabled=${this.disabled}
|
|
32
33
|
?hasError=${this.hasError}
|
|
33
|
-
?hasFieldset=${this.hasFieldset}
|
|
34
34
|
?inline=${this.inline}
|
|
35
35
|
?optionalTag=${this.optionalTag}
|
|
36
36
|
?required=${this.required}
|
|
37
37
|
?requiredTag=${this.requiredTag}
|
|
38
38
|
useWrapper=${this.useWrapper}
|
|
39
|
-
.
|
|
40
|
-
.counterCurrent=${this.
|
|
39
|
+
.ariaDescribedby=${this.ariaDescribedby}
|
|
40
|
+
.counterCurrent=${this.value?.length ?? 0}
|
|
41
41
|
.counterMaxLength=${this.counterMaxLength}
|
|
42
42
|
.errorMessage=${this.errorMessage}
|
|
43
43
|
.forId="${this.id + "-input"}"
|
|
@@ -48,19 +48,18 @@ var f = class extends d {
|
|
|
48
48
|
.requiredText=${this.requiredText}
|
|
49
49
|
.tagText=${this.tagText}
|
|
50
50
|
.size=${this.inputSize}
|
|
51
|
-
class="pkt-textinput"
|
|
52
51
|
>
|
|
53
52
|
<div class="pkt-contents" slot="helptext">${s(this, "helptext")}</div>
|
|
54
53
|
<div class=${`pkt-input__container pkt-input__container--${this.inputSize}`}>
|
|
55
54
|
${this.prefix ? i`<div class="pkt-input-prefix">${this.prefix}</div>` : t}
|
|
56
55
|
<input
|
|
57
56
|
${l(this.inputRef)}
|
|
58
|
-
class=${
|
|
57
|
+
class=${r}
|
|
59
58
|
type=${this.type}
|
|
60
59
|
name=${(this.name || this.id) + "-input"}
|
|
61
60
|
id=${this.id + "-input"}
|
|
62
61
|
placeholder=${c(this.placeholder)}
|
|
63
|
-
aria-labelledby=${
|
|
62
|
+
aria-labelledby=${a}
|
|
64
63
|
autocomplete=${this.autocomplete || "off"}
|
|
65
64
|
minlength=${c(this.minlength || void 0)}
|
|
66
65
|
maxlength=${c(this.maxlength || void 0)}
|
|
@@ -72,7 +71,13 @@ var f = class extends d {
|
|
|
72
71
|
.value=${this.value}
|
|
73
72
|
?disabled=${this.disabled}
|
|
74
73
|
aria-invalid=${this.hasError}
|
|
75
|
-
aria-errormessage=${`${this.id}-error`}
|
|
74
|
+
aria-errormessage=${c(this.hasError ? `${this.id}-input-error` : void 0)}
|
|
75
|
+
aria-describedby=${c(f({
|
|
76
|
+
id: this.id + "-input",
|
|
77
|
+
hasHelptext: !!this.helptext,
|
|
78
|
+
hasCounter: n,
|
|
79
|
+
ariaDescribedby: this.ariaDescribedby
|
|
80
|
+
}))}
|
|
76
81
|
@input=${(e) => {
|
|
77
82
|
this.value = e.target.value, this.onInput(), e.stopImmediatePropagation();
|
|
78
83
|
}}
|
|
@@ -113,14 +118,14 @@ var f = class extends d {
|
|
|
113
118
|
n([r({
|
|
114
119
|
type: String,
|
|
115
120
|
reflect: !0
|
|
116
|
-
})],
|
|
121
|
+
})], p.prototype, "value", void 0), n([r({ type: String })], p.prototype, "type", void 0), n([r({ type: Number })], p.prototype, "size", void 0), n([r({ type: String })], p.prototype, "autocomplete", void 0), n([r({ type: String })], p.prototype, "iconNameRight", void 0), n([r({ type: String })], p.prototype, "prefix", void 0), n([r({ type: String })], p.prototype, "suffix", void 0), n([r({ type: Boolean })], p.prototype, "omitSearchIcon", void 0), n([e()], p.prototype, "counterCurrent", void 0);
|
|
117
122
|
try {
|
|
118
|
-
a("pkt-textinput")(
|
|
123
|
+
a("pkt-textinput")(p);
|
|
119
124
|
} catch {
|
|
120
125
|
console.warn("Forsøker å definere <pkt-textinput>, men den er allerede definert");
|
|
121
126
|
}
|
|
122
127
|
//#endregion
|
|
123
128
|
//#region src/components/textinput/index.ts
|
|
124
|
-
var
|
|
129
|
+
var m = p;
|
|
125
130
|
//#endregion
|
|
126
|
-
export {
|
|
131
|
+
export { p as n, m as t };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-BA8v6S7z.cjs"),t=require("./class-map-BeimMvPv.cjs"),n=require("./element-with-slot-Bj7nm7fO.cjs");require("./icon-9iwd2F2l.cjs");const r=require("./if-defined-B89_ZeCj.cjs"),i=require("./ref-CQoEIIp0.cjs"),a=require("./input-element-DYmQw-fH.cjs"),o=require("./input-wrapper-Q-B-aBeb.cjs");var s=class extends a.t{constructor(...e){super(...e),this.inputRef=i.t(),this.value=``,this.type=`text`,this.size=null,this.autocomplete=null,this.iconNameRight=null,this.prefix=null,this.suffix=null,this.omitSearchIcon=!1,this.counterCurrent=0}attributeChangedCallback(e,t,n){e===`value`&&this.value!==t&&(this.counterCurrent=n?n.length:0),super.attributeChangedCallback(e,t,n)}updated(e){super.updated(e),this.classList.add(`pkt-textinput`),e.has(`value`)&&(this.counterCurrent=this.value?.length||0,this.valueChanged(this.value,e.get(`value`))),e.has(`id`)&&!this.name&&this.id&&(this.name=this.id)}render(){let a=this.type===`search`&&!this.iconNameRight&&!this.omitSearchIcon,s=this.effectiveCounter(this.counterMaxLength>0),c=t.t({"pkt-input":!0,[`pkt-input--${this.inputSize}`]:!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":s&&this.counterMaxLength>0&&this.value.length>this.counterMaxLength}),l=this.ariaLabelledby||`${this.id}-input-label`;return e.p`
|
|
2
2
|
<pkt-input-wrapper
|
|
3
3
|
label="${this.label}"
|
|
4
|
-
?counter=${
|
|
4
|
+
?counter=${s}
|
|
5
|
+
?hasFieldset=${this.effectiveHasFieldset(!1)}
|
|
5
6
|
?disabled=${this.disabled}
|
|
6
7
|
?hasError=${this.hasError}
|
|
7
|
-
?hasFieldset=${this.hasFieldset}
|
|
8
8
|
?inline=${this.inline}
|
|
9
9
|
?optionalTag=${this.optionalTag}
|
|
10
10
|
?required=${this.required}
|
|
11
11
|
?requiredTag=${this.requiredTag}
|
|
12
12
|
useWrapper=${this.useWrapper}
|
|
13
|
-
.
|
|
14
|
-
.counterCurrent=${this.
|
|
13
|
+
.ariaDescribedby=${this.ariaDescribedby}
|
|
14
|
+
.counterCurrent=${this.value?.length??0}
|
|
15
15
|
.counterMaxLength=${this.counterMaxLength}
|
|
16
16
|
.errorMessage=${this.errorMessage}
|
|
17
17
|
.forId="${this.id+`-input`}"
|
|
@@ -22,19 +22,18 @@ const e=require("./element-DJzurxgt.cjs"),t=require("./class-map-CCZN5uS3.cjs"),
|
|
|
22
22
|
.requiredText=${this.requiredText}
|
|
23
23
|
.tagText=${this.tagText}
|
|
24
24
|
.size=${this.inputSize}
|
|
25
|
-
class="pkt-textinput"
|
|
26
25
|
>
|
|
27
26
|
<div class="pkt-contents" slot="helptext">${n.n(this,`helptext`)}</div>
|
|
28
27
|
<div class=${`pkt-input__container pkt-input__container--${this.inputSize}`}>
|
|
29
28
|
${this.prefix?e.p`<div class="pkt-input-prefix">${this.prefix}</div>`:e.d}
|
|
30
29
|
<input
|
|
31
30
|
${i.n(this.inputRef)}
|
|
32
|
-
class=${
|
|
31
|
+
class=${c}
|
|
33
32
|
type=${this.type}
|
|
34
33
|
name=${(this.name||this.id)+`-input`}
|
|
35
34
|
id=${this.id+`-input`}
|
|
36
35
|
placeholder=${r.t(this.placeholder)}
|
|
37
|
-
aria-labelledby=${
|
|
36
|
+
aria-labelledby=${l}
|
|
38
37
|
autocomplete=${this.autocomplete||`off`}
|
|
39
38
|
minlength=${r.t(this.minlength||void 0)}
|
|
40
39
|
maxlength=${r.t(this.maxlength||void 0)}
|
|
@@ -46,7 +45,8 @@ const e=require("./element-DJzurxgt.cjs"),t=require("./class-map-CCZN5uS3.cjs"),
|
|
|
46
45
|
.value=${this.value}
|
|
47
46
|
?disabled=${this.disabled}
|
|
48
47
|
aria-invalid=${this.hasError}
|
|
49
|
-
aria-errormessage=${
|
|
48
|
+
aria-errormessage=${r.t(this.hasError?`${this.id}-input-error`:void 0)}
|
|
49
|
+
aria-describedby=${r.t(o.r({id:this.id+`-input`,hasHelptext:!!this.helptext,hasCounter:s,ariaDescribedby:this.ariaDescribedby}))}
|
|
50
50
|
@input=${e=>{this.value=e.target.value,this.onInput(),e.stopImmediatePropagation()}}
|
|
51
51
|
@change=${e=>{e.stopImmediatePropagation()}}
|
|
52
52
|
@focus=${e=>{this.onFocus(),e.stopImmediatePropagation()}}
|
|
@@ -68,4 +68,4 @@ const e=require("./element-DJzurxgt.cjs"),t=require("./class-map-CCZN5uS3.cjs"),
|
|
|
68
68
|
${!this.suffix&&a?e.p`<pkt-icon class="pkt-input-icon" name="magnifying-glass-big"></pkt-icon>`:e.d}
|
|
69
69
|
</div>
|
|
70
70
|
</pkt-input-wrapper>
|
|
71
|
-
`}};e.n([e.o({type:String,reflect:!0})],
|
|
71
|
+
`}};e.n([e.o({type:String,reflect:!0})],s.prototype,`value`,void 0),e.n([e.o({type:String})],s.prototype,`type`,void 0),e.n([e.o({type:Number})],s.prototype,`size`,void 0),e.n([e.o({type:String})],s.prototype,`autocomplete`,void 0),e.n([e.o({type:String})],s.prototype,`iconNameRight`,void 0),e.n([e.o({type:String})],s.prototype,`prefix`,void 0),e.n([e.o({type:String})],s.prototype,`suffix`,void 0),e.n([e.o({type:Boolean})],s.prototype,`omitSearchIcon`,void 0),e.n([e.a()],s.prototype,`counterCurrent`,void 0);try{e.s(`pkt-textinput`)(s)}catch{console.warn(`Forsøker å definere <pkt-textinput>, men den er allerede definert`)}var c=s;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return c}});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { a as e, d as t, n, o as r, p as i, r as a, s as o } from "./element-
|
|
2
|
-
import { t as s } from "./class-map-
|
|
3
|
-
import { n as c } from "./element-with-slot-
|
|
4
|
-
import "./icon-
|
|
5
|
-
import { t as l } from "./if-defined-
|
|
6
|
-
import { n as u, t as d } from "./ref-
|
|
7
|
-
import { t as f } from "./input-element-
|
|
8
|
-
import "./input-wrapper-
|
|
1
|
+
import { a as e, d as t, n, o as r, p as i, r as a, s as o } from "./element-ChsFgr_B.js";
|
|
2
|
+
import { t as s } from "./class-map-CnWCnBSX.js";
|
|
3
|
+
import { n as c } from "./element-with-slot-BvG9ctC-.js";
|
|
4
|
+
import "./icon-D-LA22xD.js";
|
|
5
|
+
import { t as l } from "./if-defined-CGzIlZ9-.js";
|
|
6
|
+
import { n as u, t as d } from "./ref-CWD6PjVd.js";
|
|
7
|
+
import { t as f } from "./input-element-DBMNBplu.js";
|
|
8
|
+
import "./input-wrapper-BmxNvznr.js";
|
|
9
9
|
//#region ../../shared-utils/timepicker/time-utils.ts
|
|
10
10
|
var p = (e) => /^\d{2}:\d{2}$/.test(e) && parseInt(e.slice(0, 2), 10) <= 23 && parseInt(e.slice(3), 10) <= 59, m = (e) => {
|
|
11
11
|
let [t, n] = e.split(":").map(Number);
|
|
@@ -143,9 +143,7 @@ var p = (e) => /^\d{2}:\d{2}$/.test(e) && parseInt(e.slice(0, 2), 10) <= 23 && p
|
|
|
143
143
|
case " ":
|
|
144
144
|
e.preventDefault(), t.click();
|
|
145
145
|
break;
|
|
146
|
-
case "Escape":
|
|
147
|
-
e.preventDefault(), this._closePopup(), this.buttonRef.value?.focus();
|
|
148
|
-
break;
|
|
146
|
+
case "Escape": e.preventDefault(), this._closePopup(), this.buttonRef.value?.focus();
|
|
149
147
|
}
|
|
150
148
|
};
|
|
151
149
|
}
|
|
@@ -182,7 +180,11 @@ var p = (e) => /^\d{2}:\d{2}$/.test(e) && parseInt(e.slice(0, 2), 10) <= 23 && p
|
|
|
182
180
|
_setAriaInvalid(e) {
|
|
183
181
|
if (!this.touched && e) return;
|
|
184
182
|
let t = this.hoursInputRef.value, n = this.minutesInputRef.value;
|
|
185
|
-
e
|
|
183
|
+
if (e) t?.setAttribute("aria-invalid", "true"), n?.setAttribute("aria-invalid", "true");
|
|
184
|
+
else {
|
|
185
|
+
if (this.hasError) return;
|
|
186
|
+
t?.removeAttribute("aria-invalid"), n?.removeAttribute("aria-invalid");
|
|
187
|
+
}
|
|
186
188
|
}
|
|
187
189
|
connectedCallback() {
|
|
188
190
|
super.connectedCallback(), this.addEventListener("focusin", this._handleComponentFocusIn), this.addEventListener("focusout", this._handleComponentFocusOut), document.addEventListener("click", this._outsideClickHandler);
|
|
@@ -194,7 +196,7 @@ var p = (e) => /^\d{2}:\d{2}$/.test(e) && parseInt(e.slice(0, 2), 10) <= 23 && p
|
|
|
194
196
|
super.willUpdate(e), e.has("value") && this._syncDisplayFromValue();
|
|
195
197
|
}
|
|
196
198
|
updated(e) {
|
|
197
|
-
super.updated(e), this.classList.toggle("pkt-timepicker--stepper", this.stepArrows), this.classList.toggle("pkt-timepicker--fullwidth", this.fullwidth), this.classList.toggle("pkt-timepicker--medium", this.inputSize === "medium"), this.classList.toggle("pkt-timepicker--small", this.inputSize === "small"), this.classList.toggle("pkt-timepicker--xsmall", this.inputSize === "xsmall"), e.has("step") && this.step !== null && !this._isValidStep(this.step) && console.warn(`pkt-timepicker: step="${this.step}" er ikke en gyldig verdi. Step må være et multiplum av 60 (hele minutter) eller nøyaktig 3600 (hel time).`);
|
|
199
|
+
super.updated(e), this.classList.add("pkt-timepicker"), this.classList.toggle("pkt-timepicker--stepper", this.stepArrows), this.classList.toggle("pkt-timepicker--fullwidth", this.fullwidth), this.classList.toggle("pkt-timepicker--medium", this.inputSize === "medium"), this.classList.toggle("pkt-timepicker--small", this.inputSize === "small"), this.classList.toggle("pkt-timepicker--xsmall", this.inputSize === "xsmall"), e.has("step") && this.step !== null && !this._isValidStep(this.step) && console.warn(`pkt-timepicker: step="${this.step}" er ikke en gyldig verdi. Step må være et multiplum av 60 (hele minutter) eller nøyaktig 3600 (hel time).`);
|
|
198
200
|
}
|
|
199
201
|
formResetCallback() {
|
|
200
202
|
super.formResetCallback(), this._hours = "", this._minutes = "", this._isOpen = !1;
|
|
@@ -356,6 +358,7 @@ var p = (e) => /^\d{2}:\d{2}$/.test(e) && parseInt(e.slice(0, 2), 10) <= 23 && p
|
|
|
356
358
|
aria-label=${r}
|
|
357
359
|
role="spinbutton"
|
|
358
360
|
aria-invalid=${this.hasError ? "true" : t}
|
|
361
|
+
aria-errormessage=${this.hasError ? `${this.id}-hours-error` : t}
|
|
359
362
|
aria-valuemin="0"
|
|
360
363
|
aria-valuemax="23"
|
|
361
364
|
aria-valuenow=${this._hours === "" ? t : this._hours}
|
|
@@ -384,6 +387,7 @@ var p = (e) => /^\d{2}:\d{2}$/.test(e) && parseInt(e.slice(0, 2), 10) <= 23 && p
|
|
|
384
387
|
aria-label=${a}
|
|
385
388
|
role="spinbutton"
|
|
386
389
|
aria-invalid=${this.hasError ? "true" : t}
|
|
390
|
+
aria-errormessage=${this.hasError ? `${this.id}-hours-error` : t}
|
|
387
391
|
aria-valuemin="0"
|
|
388
392
|
aria-valuemax="59"
|
|
389
393
|
aria-valuenow=${this._minutes === "" ? t : this._minutes}
|
|
@@ -457,12 +461,13 @@ var p = (e) => /^\d{2}:\d{2}$/.test(e) && parseInt(e.slice(0, 2), 10) <= 23 && p
|
|
|
457
461
|
?disabled=${this.disabled}
|
|
458
462
|
?fullwidth=${this.fullwidth}
|
|
459
463
|
?hasError=${this.hasError}
|
|
464
|
+
?hasFieldset=${this.effectiveHasFieldset(!1)}
|
|
460
465
|
?inline=${this.inline}
|
|
461
466
|
?optionalTag=${this.optionalTag}
|
|
462
467
|
?required=${this.required}
|
|
463
468
|
?requiredTag=${this.requiredTag}
|
|
464
469
|
useWrapper=${this.useWrapper}
|
|
465
|
-
.
|
|
470
|
+
.ariaDescribedby=${this.ariaDescribedby}
|
|
466
471
|
.errorMessage=${this.errorMessage}
|
|
467
472
|
.forId="${this.id + "-hours"}"
|
|
468
473
|
.helptext=${this.helptext}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-DJzurxgt.cjs"),t=require("./class-map-CCZN5uS3.cjs"),n=require("./element-with-slot-BY7Jc-q8.cjs");require("./icon-B8PVq2O6.cjs");const r=require("./if-defined-DrwbxQOj.cjs"),i=require("./ref-DO7TzO4O.cjs"),a=require("./input-element-B0qLbEdF.cjs");require("./input-wrapper-DPkkiG7S.cjs");var o=e=>/^\d{2}:\d{2}$/.test(e)&&parseInt(e.slice(0,2),10)<=23&&parseInt(e.slice(3),10)<=59,s=e=>{let[t,n]=e.split(`:`).map(Number);return t*60+n},c=e=>e?Math.max(1,Math.round(e/60)):1,l=(e,t)=>{let n=e?parseInt(String(e).split(`:`)[0],10):0,r=t?parseInt(String(t).split(`:`)[0],10):23;return Array.from({length:r-n+1},(e,t)=>t+n)},u=e=>{let t=c(e);return Array.from({length:Math.floor(60/t)},(e,n)=>n*t)},d=(e,t,n,r)=>{let i=e===``?n===1?0:23:parseInt(e,10),a=t===``?n===1?0:Math.floor(59/r)*r:parseInt(t,10);return a+=n*r,a>59?(a=0,i=(i+1)%24):a<0&&(a=Math.floor(59/r)*r,i=(i-1+24)%24),{hours:String(i).padStart(2,`0`),minutes:String(a).padStart(2,`0`)}},f=class extends a.t{constructor(...e){super(...e),this.hiddenInputRef=i.t(),this.hoursInputRef=i.t(),this.minutesInputRef=i.t(),this.buttonRef=i.t(),this.value=``,this.hidePicker=!1,this.stepArrows=!1,this._hours=``,this._minutes=``,this._isOpen=!1,this._hoursDigitCount=0,this._hoursFirstDigit=-1,this._minutesDigitCount=0,this._minutesFirstDigit=-1,this._hasFocus=!1,this._outsideClickHandler=e=>{this.contains(e.target)||this._closePopup()},this._handleComponentFocusIn=()=>{this._hasFocus||(this._hasFocus=!0,this.onFocus())},this._handleComponentFocusOut=e=>{this.contains(e.relatedTarget)||(this._hasFocus=!1,this.onBlur())},this._handleHoursKeydown=e=>{let t=e.target;switch(e.key){case`ArrowUp`:{e.preventDefault();let t=this._hours===``?0:parseInt(this._hours,10);this._hours=String((t+1)%24).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowDown`:{e.preventDefault();let t=this._hours===``?0:parseInt(this._hours,10);this._hours=String((t-1+24)%24).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowRight`:e.preventDefault(),this.minutesInputRef.value?.focus();break;case`Backspace`:case`Delete`:this._hoursDigitCount=0,this._hoursFirstDigit=-1;break;case`Tab`:break;case`Enter`:{e.preventDefault();let n=this.internals.form;n?n.requestSubmit():t.blur();break}default:if(/^\d$/.test(e.key)){e.preventDefault();let t=parseInt(e.key,10);if(this._hoursDigitCount===0)this._hoursFirstDigit=t,this._hours=String(t).padStart(2,`0`),this._hoursDigitCount=1,this.onInput(),t>=3&&(this._hoursFirstDigit=-1,this._hoursDigitCount=0,this._syncValueFromDisplay(),this.minutesInputRef.value?.focus());else{let e=this._hoursFirstDigit*10+t;this._hours=e<=23?String(e).padStart(2,`0`):String(t).padStart(2,`0`),this._hoursFirstDigit=-1,this._hoursDigitCount=0,this._syncValueFromDisplay(),this.onInput(),this.minutesInputRef.value?.focus()}}else e.preventDefault()}},this._handleHoursBlur=()=>{this._hours!==``&&(this._hours=String(parseInt(this._hours,10)).padStart(2,`0`)),this._hoursDigitCount=0,this._hoursFirstDigit=-1,this._syncValueFromDisplay()},this._handleMinutesKeydown=e=>{let t=e.target;switch(e.key){case`ArrowUp`:{e.preventDefault();let t=this._minutes===``?0:parseInt(this._minutes,10);this._minutes=String((t+this._minuteStep)%60).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowDown`:{e.preventDefault();let t=this._minutes===``?0:parseInt(this._minutes,10);this._minutes=String((t-this._minuteStep+60)%60).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowLeft`:e.preventDefault(),this.hoursInputRef.value?.focus();break;case`Backspace`:case`Delete`:this._minutesDigitCount=0,this._minutesFirstDigit=-1;break;case`Tab`:break;case`Enter`:{e.preventDefault();let n=this.internals.form;n?n.requestSubmit():t.blur();break}default:if(/^\d$/.test(e.key)){e.preventDefault();let t=parseInt(e.key,10);if(this._minutesDigitCount===0)this._minutesFirstDigit=t,this._minutes=String(t).padStart(2,`0`),this._minutesDigitCount=1,this.onInput(),t>=6&&(this._minutesFirstDigit=-1,this._minutesDigitCount=0,this._syncValueFromDisplay());else{let e=this._minutesFirstDigit*10+t;this._minutes=e<=59?String(e).padStart(2,`0`):String(t).padStart(2,`0`),this._minutesFirstDigit=-1,this._minutesDigitCount=0,this._syncValueFromDisplay(),this.onInput()}}else e.preventDefault()}},this._handleMinutesBlur=()=>{this._minutes!==``&&(this._minutes=String(parseInt(this._minutes,10)).padStart(2,`0`)),this._minutesDigitCount=0,this._minutesFirstDigit=-1,this._syncValueFromDisplay()},this._handlePopupKeydown=e=>{let t=document.activeElement,n=t.closest(`.pkt-timepicker-popup__col`);if(!n)return;let r=Array.from(n.querySelectorAll(`.pkt-timepicker-popup__option`)),i=r.indexOf(t),a=t.dataset.type??``;switch(e.key){case`ArrowDown`:e.preventDefault(),this._focusOptionAndSync(r[Math.min(i+1,r.length-1)],a);break;case`ArrowUp`:e.preventDefault(),this._focusOptionAndSync(r[Math.max(i-1,0)],a);break;case`Home`:e.preventDefault(),this._focusOptionAndSync(r[0],a);break;case`End`:e.preventDefault(),this._focusOptionAndSync(r[r.length-1],a);break;case`ArrowRight`:e.preventDefault(),a===`hour`&&(this._focusOptionAndSync(t,a),this.updateComplete.then(()=>{this._scrollToSelected(),this._focusSelectedOrFirst(`minute`)}));break;case`ArrowLeft`:e.preventDefault(),a===`minute`&&(this._focusOptionAndSync(t,a),this.updateComplete.then(()=>{this._scrollToSelected(),this._focusSelectedOrFirst(`hour`)}));break;case`Enter`:case` `:e.preventDefault(),t.click();break;case`Escape`:e.preventDefault(),this._closePopup(),this.buttonRef.value?.focus();break}}}get inputRef(){return this.hiddenInputRef}manageValidity(t){let n=this.hoursInputRef.value;if(!n)return;if(this.required&&!this.value){this.internals.setValidity({valueMissing:!0},e.r.forms.messages.required,n),this._setAriaInvalid(!0);return}if(!this.value){this.internals.setValidity({}),this._setAriaInvalid(!1);return}let r=s(this.value),i=c(this.step);if(this.min&&r<s(String(this.min))){this.internals.setValidity({rangeUnderflow:!0},e.r.forms.messages.rangeUnderflowMin.replace(`{min}`,String(this.min)),n),this._setAriaInvalid(!0);return}if(this.max&&r>s(String(this.max))){this.internals.setValidity({rangeOverflow:!0},e.r.forms.messages.rangeOverflowMax.replace(`{max}`,String(this.max)),n),this._setAriaInvalid(!0);return}if(this.step&&r%i!==0){let t=i===60?e.r.forms.messages.timeStepMismatchHour:i===30?e.r.forms.messages.timeStepMismatchHalfHour:e.r.forms.messages.timeStepMismatch.replace(`{step}`,`${i}, ${i*2}, ${i*3}`);this.internals.setValidity({stepMismatch:!0},t,n),this._setAriaInvalid(!0);return}this.internals.setValidity({}),this._setAriaInvalid(!1)}_setAriaInvalid(e){if(!this.touched&&e)return;let t=this.hoursInputRef.value,n=this.minutesInputRef.value;e?(t?.setAttribute(`aria-invalid`,`true`),n?.setAttribute(`aria-invalid`,`true`)):(t?.removeAttribute(`aria-invalid`),n?.removeAttribute(`aria-invalid`))}connectedCallback(){super.connectedCallback(),this.addEventListener(`focusin`,this._handleComponentFocusIn),this.addEventListener(`focusout`,this._handleComponentFocusOut),document.addEventListener(`click`,this._outsideClickHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`focusin`,this._handleComponentFocusIn),this.removeEventListener(`focusout`,this._handleComponentFocusOut),document.removeEventListener(`click`,this._outsideClickHandler)}willUpdate(e){super.willUpdate(e),e.has(`value`)&&this._syncDisplayFromValue()}updated(e){super.updated(e),this.classList.toggle(`pkt-timepicker--stepper`,this.stepArrows),this.classList.toggle(`pkt-timepicker--fullwidth`,this.fullwidth),this.classList.toggle(`pkt-timepicker--medium`,this.inputSize===`medium`),this.classList.toggle(`pkt-timepicker--small`,this.inputSize===`small`),this.classList.toggle(`pkt-timepicker--xsmall`,this.inputSize===`xsmall`),e.has(`step`)&&this.step!==null&&!this._isValidStep(this.step)&&console.warn(`pkt-timepicker: step="${this.step}" er ikke en gyldig verdi. Step må være et multiplum av 60 (hele minutter) eller nøyaktig 3600 (hel time).`)}formResetCallback(){super.formResetCallback(),this._hours=``,this._minutes=``,this._isOpen=!1}_isValidStep(e){return e===3600||e<3600&&3600%e==0&&e%60==0}_syncDisplayFromValue(){let e=o(this.value)?this.value.split(`:`):null;e?(this._hours=e[0],this._minutes=e[1]):(this._hours=``,this._minutes=``)}_syncValueFromDisplay(){if(this._hours!==``&&this._minutes!==``){let e=`${this._hours}:${this._minutes}`;e!==this.value&&(this.value=e,this.onChange(e))}else this.value!==``&&(this.value=``,this.onChange(``))}get _minuteStep(){return c(this.step)}get _hourOptions(){return l(this.min,this.max)}get _minuteOptions(){return u(this.step)}_openPopup(){this._isOpen=!0,this.updateComplete.then(()=>{this._scrollToSelected(),this._focusSelectedOrFirst(`hour`)})}_closePopup(){this._isOpen=!1,this._syncValueFromDisplay()}_togglePopup(){this._isOpen?this._closePopup():this._openPopup()}_scrollToSelected(){let e=this.querySelector(`.pkt-timepicker-popup`);e&&e.querySelectorAll(`.pkt-timepicker-popup__col`).forEach(e=>{let t=e.querySelector(`.pkt-timepicker-popup__option--selected`);t&&t.scrollIntoView({block:`center`})})}_focusSelectedOrFirst(e){let t=this.querySelector(`.pkt-timepicker-popup`);if(!t)return;let n=t.querySelectorAll(`.pkt-timepicker-popup__col`),r=e===`hour`?n[0]:n[1];if(!r)return;let i=r.querySelector(`.pkt-timepicker-popup__option--selected`),a=r.querySelector(`.pkt-timepicker-popup__option`);(i||a)?.focus()}_handleOptionClick(e,t){let n=String(e).padStart(2,`0`);t===`hour`?(this._hours=n,this.updateComplete.then(()=>this._focusSelectedOrFirst(`minute`))):(this._minutes=n,this._closePopup(),this.buttonRef.value?.focus())}_focusOptionAndSync(e,t){if(!e)return;let n=parseInt(e.dataset.value??`0`,10);t===`hour`?this._hours=String(n).padStart(2,`0`):this._minutes=String(n).padStart(2,`0`),e.focus()}_stepTime(e){let t=d(this._hours,this._minutes,e,this._minuteStep);this._hours=t.hours,this._minutes=t.minutes,this._syncValueFromDisplay()}_renderOption(n,r){let i=String(n).padStart(2,`0`),a=n===(r===`hour`?this._hours===``?NaN:parseInt(this._hours,10):this._minutes===``?NaN:parseInt(this._minutes,10));return e.p`
|
|
1
|
+
const e=require("./element-BA8v6S7z.cjs"),t=require("./class-map-BeimMvPv.cjs"),n=require("./element-with-slot-Bj7nm7fO.cjs");require("./icon-9iwd2F2l.cjs");const r=require("./if-defined-B89_ZeCj.cjs"),i=require("./ref-CQoEIIp0.cjs"),a=require("./input-element-DYmQw-fH.cjs");require("./input-wrapper-Q-B-aBeb.cjs");var o=e=>/^\d{2}:\d{2}$/.test(e)&&parseInt(e.slice(0,2),10)<=23&&parseInt(e.slice(3),10)<=59,s=e=>{let[t,n]=e.split(`:`).map(Number);return t*60+n},c=e=>e?Math.max(1,Math.round(e/60)):1,l=(e,t)=>{let n=e?parseInt(String(e).split(`:`)[0],10):0,r=t?parseInt(String(t).split(`:`)[0],10):23;return Array.from({length:r-n+1},(e,t)=>t+n)},u=e=>{let t=c(e);return Array.from({length:Math.floor(60/t)},(e,n)=>n*t)},d=(e,t,n,r)=>{let i=e===``?n===1?0:23:parseInt(e,10),a=t===``?n===1?0:Math.floor(59/r)*r:parseInt(t,10);return a+=n*r,a>59?(a=0,i=(i+1)%24):a<0&&(a=Math.floor(59/r)*r,i=(i-1+24)%24),{hours:String(i).padStart(2,`0`),minutes:String(a).padStart(2,`0`)}},f=class extends a.t{constructor(...e){super(...e),this.hiddenInputRef=i.t(),this.hoursInputRef=i.t(),this.minutesInputRef=i.t(),this.buttonRef=i.t(),this.value=``,this.hidePicker=!1,this.stepArrows=!1,this._hours=``,this._minutes=``,this._isOpen=!1,this._hoursDigitCount=0,this._hoursFirstDigit=-1,this._minutesDigitCount=0,this._minutesFirstDigit=-1,this._hasFocus=!1,this._outsideClickHandler=e=>{this.contains(e.target)||this._closePopup()},this._handleComponentFocusIn=()=>{this._hasFocus||(this._hasFocus=!0,this.onFocus())},this._handleComponentFocusOut=e=>{this.contains(e.relatedTarget)||(this._hasFocus=!1,this.onBlur())},this._handleHoursKeydown=e=>{let t=e.target;switch(e.key){case`ArrowUp`:{e.preventDefault();let t=this._hours===``?0:parseInt(this._hours,10);this._hours=String((t+1)%24).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowDown`:{e.preventDefault();let t=this._hours===``?0:parseInt(this._hours,10);this._hours=String((t-1+24)%24).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowRight`:e.preventDefault(),this.minutesInputRef.value?.focus();break;case`Backspace`:case`Delete`:this._hoursDigitCount=0,this._hoursFirstDigit=-1;break;case`Tab`:break;case`Enter`:{e.preventDefault();let n=this.internals.form;n?n.requestSubmit():t.blur();break}default:if(/^\d$/.test(e.key)){e.preventDefault();let t=parseInt(e.key,10);if(this._hoursDigitCount===0)this._hoursFirstDigit=t,this._hours=String(t).padStart(2,`0`),this._hoursDigitCount=1,this.onInput(),t>=3&&(this._hoursFirstDigit=-1,this._hoursDigitCount=0,this._syncValueFromDisplay(),this.minutesInputRef.value?.focus());else{let e=this._hoursFirstDigit*10+t;this._hours=e<=23?String(e).padStart(2,`0`):String(t).padStart(2,`0`),this._hoursFirstDigit=-1,this._hoursDigitCount=0,this._syncValueFromDisplay(),this.onInput(),this.minutesInputRef.value?.focus()}}else e.preventDefault()}},this._handleHoursBlur=()=>{this._hours!==``&&(this._hours=String(parseInt(this._hours,10)).padStart(2,`0`)),this._hoursDigitCount=0,this._hoursFirstDigit=-1,this._syncValueFromDisplay()},this._handleMinutesKeydown=e=>{let t=e.target;switch(e.key){case`ArrowUp`:{e.preventDefault();let t=this._minutes===``?0:parseInt(this._minutes,10);this._minutes=String((t+this._minuteStep)%60).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowDown`:{e.preventDefault();let t=this._minutes===``?0:parseInt(this._minutes,10);this._minutes=String((t-this._minuteStep+60)%60).padStart(2,`0`),this._syncValueFromDisplay(),this.onInput();break}case`ArrowLeft`:e.preventDefault(),this.hoursInputRef.value?.focus();break;case`Backspace`:case`Delete`:this._minutesDigitCount=0,this._minutesFirstDigit=-1;break;case`Tab`:break;case`Enter`:{e.preventDefault();let n=this.internals.form;n?n.requestSubmit():t.blur();break}default:if(/^\d$/.test(e.key)){e.preventDefault();let t=parseInt(e.key,10);if(this._minutesDigitCount===0)this._minutesFirstDigit=t,this._minutes=String(t).padStart(2,`0`),this._minutesDigitCount=1,this.onInput(),t>=6&&(this._minutesFirstDigit=-1,this._minutesDigitCount=0,this._syncValueFromDisplay());else{let e=this._minutesFirstDigit*10+t;this._minutes=e<=59?String(e).padStart(2,`0`):String(t).padStart(2,`0`),this._minutesFirstDigit=-1,this._minutesDigitCount=0,this._syncValueFromDisplay(),this.onInput()}}else e.preventDefault()}},this._handleMinutesBlur=()=>{this._minutes!==``&&(this._minutes=String(parseInt(this._minutes,10)).padStart(2,`0`)),this._minutesDigitCount=0,this._minutesFirstDigit=-1,this._syncValueFromDisplay()},this._handlePopupKeydown=e=>{let t=document.activeElement,n=t.closest(`.pkt-timepicker-popup__col`);if(!n)return;let r=Array.from(n.querySelectorAll(`.pkt-timepicker-popup__option`)),i=r.indexOf(t),a=t.dataset.type??``;switch(e.key){case`ArrowDown`:e.preventDefault(),this._focusOptionAndSync(r[Math.min(i+1,r.length-1)],a);break;case`ArrowUp`:e.preventDefault(),this._focusOptionAndSync(r[Math.max(i-1,0)],a);break;case`Home`:e.preventDefault(),this._focusOptionAndSync(r[0],a);break;case`End`:e.preventDefault(),this._focusOptionAndSync(r[r.length-1],a);break;case`ArrowRight`:e.preventDefault(),a===`hour`&&(this._focusOptionAndSync(t,a),this.updateComplete.then(()=>{this._scrollToSelected(),this._focusSelectedOrFirst(`minute`)}));break;case`ArrowLeft`:e.preventDefault(),a===`minute`&&(this._focusOptionAndSync(t,a),this.updateComplete.then(()=>{this._scrollToSelected(),this._focusSelectedOrFirst(`hour`)}));break;case`Enter`:case` `:e.preventDefault(),t.click();break;case`Escape`:e.preventDefault(),this._closePopup(),this.buttonRef.value?.focus()}}}get inputRef(){return this.hiddenInputRef}manageValidity(t){let n=this.hoursInputRef.value;if(!n)return;if(this.required&&!this.value){this.internals.setValidity({valueMissing:!0},e.r.forms.messages.required,n),this._setAriaInvalid(!0);return}if(!this.value){this.internals.setValidity({}),this._setAriaInvalid(!1);return}let r=s(this.value),i=c(this.step);if(this.min&&r<s(String(this.min))){this.internals.setValidity({rangeUnderflow:!0},e.r.forms.messages.rangeUnderflowMin.replace(`{min}`,String(this.min)),n),this._setAriaInvalid(!0);return}if(this.max&&r>s(String(this.max))){this.internals.setValidity({rangeOverflow:!0},e.r.forms.messages.rangeOverflowMax.replace(`{max}`,String(this.max)),n),this._setAriaInvalid(!0);return}if(this.step&&r%i!==0){let t=i===60?e.r.forms.messages.timeStepMismatchHour:i===30?e.r.forms.messages.timeStepMismatchHalfHour:e.r.forms.messages.timeStepMismatch.replace(`{step}`,`${i}, ${i*2}, ${i*3}`);this.internals.setValidity({stepMismatch:!0},t,n),this._setAriaInvalid(!0);return}this.internals.setValidity({}),this._setAriaInvalid(!1)}_setAriaInvalid(e){if(!this.touched&&e)return;let t=this.hoursInputRef.value,n=this.minutesInputRef.value;if(e)t?.setAttribute(`aria-invalid`,`true`),n?.setAttribute(`aria-invalid`,`true`);else{if(this.hasError)return;t?.removeAttribute(`aria-invalid`),n?.removeAttribute(`aria-invalid`)}}connectedCallback(){super.connectedCallback(),this.addEventListener(`focusin`,this._handleComponentFocusIn),this.addEventListener(`focusout`,this._handleComponentFocusOut),document.addEventListener(`click`,this._outsideClickHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`focusin`,this._handleComponentFocusIn),this.removeEventListener(`focusout`,this._handleComponentFocusOut),document.removeEventListener(`click`,this._outsideClickHandler)}willUpdate(e){super.willUpdate(e),e.has(`value`)&&this._syncDisplayFromValue()}updated(e){super.updated(e),this.classList.add(`pkt-timepicker`),this.classList.toggle(`pkt-timepicker--stepper`,this.stepArrows),this.classList.toggle(`pkt-timepicker--fullwidth`,this.fullwidth),this.classList.toggle(`pkt-timepicker--medium`,this.inputSize===`medium`),this.classList.toggle(`pkt-timepicker--small`,this.inputSize===`small`),this.classList.toggle(`pkt-timepicker--xsmall`,this.inputSize===`xsmall`),e.has(`step`)&&this.step!==null&&!this._isValidStep(this.step)&&console.warn(`pkt-timepicker: step="${this.step}" er ikke en gyldig verdi. Step må være et multiplum av 60 (hele minutter) eller nøyaktig 3600 (hel time).`)}formResetCallback(){super.formResetCallback(),this._hours=``,this._minutes=``,this._isOpen=!1}_isValidStep(e){return e===3600||e<3600&&3600%e==0&&e%60==0}_syncDisplayFromValue(){let e=o(this.value)?this.value.split(`:`):null;e?(this._hours=e[0],this._minutes=e[1]):(this._hours=``,this._minutes=``)}_syncValueFromDisplay(){if(this._hours!==``&&this._minutes!==``){let e=`${this._hours}:${this._minutes}`;e!==this.value&&(this.value=e,this.onChange(e))}else this.value!==``&&(this.value=``,this.onChange(``))}get _minuteStep(){return c(this.step)}get _hourOptions(){return l(this.min,this.max)}get _minuteOptions(){return u(this.step)}_openPopup(){this._isOpen=!0,this.updateComplete.then(()=>{this._scrollToSelected(),this._focusSelectedOrFirst(`hour`)})}_closePopup(){this._isOpen=!1,this._syncValueFromDisplay()}_togglePopup(){this._isOpen?this._closePopup():this._openPopup()}_scrollToSelected(){let e=this.querySelector(`.pkt-timepicker-popup`);e&&e.querySelectorAll(`.pkt-timepicker-popup__col`).forEach(e=>{let t=e.querySelector(`.pkt-timepicker-popup__option--selected`);t&&t.scrollIntoView({block:`center`})})}_focusSelectedOrFirst(e){let t=this.querySelector(`.pkt-timepicker-popup`);if(!t)return;let n=t.querySelectorAll(`.pkt-timepicker-popup__col`),r=e===`hour`?n[0]:n[1];if(!r)return;let i=r.querySelector(`.pkt-timepicker-popup__option--selected`),a=r.querySelector(`.pkt-timepicker-popup__option`);(i||a)?.focus()}_handleOptionClick(e,t){let n=String(e).padStart(2,`0`);t===`hour`?(this._hours=n,this.updateComplete.then(()=>this._focusSelectedOrFirst(`minute`))):(this._minutes=n,this._closePopup(),this.buttonRef.value?.focus())}_focusOptionAndSync(e,t){if(!e)return;let n=parseInt(e.dataset.value??`0`,10);t===`hour`?this._hours=String(n).padStart(2,`0`):this._minutes=String(n).padStart(2,`0`),e.focus()}_stepTime(e){let t=d(this._hours,this._minutes,e,this._minuteStep);this._hours=t.hours,this._minutes=t.minutes,this._syncValueFromDisplay()}_renderOption(n,r){let i=String(n).padStart(2,`0`),a=n===(r===`hour`?this._hours===``?NaN:parseInt(this._hours,10):this._minutes===``?NaN:parseInt(this._minutes,10));return e.p`
|
|
2
2
|
<button
|
|
3
3
|
class=${t.t({"pkt-btn":!0,"pkt-btn--tertiary":!0,"pkt-btn--small":!0,"pkt-btn--label-only":!0,"pkt-timepicker-popup__option":!0,"pkt-timepicker-popup__option--selected":a})}
|
|
4
4
|
type="button"
|
|
@@ -72,6 +72,7 @@ const e=require("./element-DJzurxgt.cjs"),t=require("./class-map-CCZN5uS3.cjs"),
|
|
|
72
72
|
aria-label=${a}
|
|
73
73
|
role="spinbutton"
|
|
74
74
|
aria-invalid=${this.hasError?`true`:e.d}
|
|
75
|
+
aria-errormessage=${this.hasError?`${this.id}-hours-error`:e.d}
|
|
75
76
|
aria-valuemin="0"
|
|
76
77
|
aria-valuemax="23"
|
|
77
78
|
aria-valuenow=${this._hours===``?e.d:this._hours}
|
|
@@ -98,6 +99,7 @@ const e=require("./element-DJzurxgt.cjs"),t=require("./class-map-CCZN5uS3.cjs"),
|
|
|
98
99
|
aria-label=${o}
|
|
99
100
|
role="spinbutton"
|
|
100
101
|
aria-invalid=${this.hasError?`true`:e.d}
|
|
102
|
+
aria-errormessage=${this.hasError?`${this.id}-hours-error`:e.d}
|
|
101
103
|
aria-valuemin="0"
|
|
102
104
|
aria-valuemax="59"
|
|
103
105
|
aria-valuenow=${this._minutes===``?e.d:this._minutes}
|
|
@@ -166,12 +168,13 @@ const e=require("./element-DJzurxgt.cjs"),t=require("./class-map-CCZN5uS3.cjs"),
|
|
|
166
168
|
?disabled=${this.disabled}
|
|
167
169
|
?fullwidth=${this.fullwidth}
|
|
168
170
|
?hasError=${this.hasError}
|
|
171
|
+
?hasFieldset=${this.effectiveHasFieldset(!1)}
|
|
169
172
|
?inline=${this.inline}
|
|
170
173
|
?optionalTag=${this.optionalTag}
|
|
171
174
|
?required=${this.required}
|
|
172
175
|
?requiredTag=${this.requiredTag}
|
|
173
176
|
useWrapper=${this.useWrapper}
|
|
174
|
-
.
|
|
177
|
+
.ariaDescribedby=${this.ariaDescribedby}
|
|
175
178
|
.errorMessage=${this.errorMessage}
|
|
176
179
|
.forId="${this.id+`-hours`}"
|
|
177
180
|
.helptext=${this.helptext}
|
|
@@ -78,7 +78,8 @@ declare const _default: {
|
|
|
78
78
|
"rangeUnderflowMin": "Verdien må være større enn eller lik {min}.",
|
|
79
79
|
"rangeOverflowMax": "Verdien må være mindre enn eller lik {max}.",
|
|
80
80
|
"dateUnderflow": "For tidlig dato",
|
|
81
|
-
"dateOverflow": "For sen dato"
|
|
81
|
+
"dateOverflow": "For sen dato",
|
|
82
|
+
"counterExceeded": "Du har brukt {current} av {max}"
|
|
82
83
|
},
|
|
83
84
|
"helptext": {
|
|
84
85
|
"helptextDropdownButton": "Les mer"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-elements",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.1.2",
|
|
4
4
|
"description": "Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo",
|
|
5
5
|
"homepage": "https://punkt.oslo.kommune.no",
|
|
6
6
|
"author": "Team Designsystem, Oslo Origo",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@babel/plugin-transform-private-property-in-object": "^7.27.1",
|
|
42
42
|
"@babel/preset-env": "^7.28.3",
|
|
43
43
|
"@babel/preset-typescript": "^7.28.3",
|
|
44
|
-
"@oslokommune/punkt-assets": "^17.
|
|
44
|
+
"@oslokommune/punkt-assets": "^17.1.2",
|
|
45
45
|
"@testing-library/dom": "^10.4.1",
|
|
46
46
|
"@testing-library/jest-dom": "^6.9.1",
|
|
47
47
|
"@types/jest-axe": "^3.5.9",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"jest-axe": "^10.0.0",
|
|
55
55
|
"jsdom": "^29.1.1",
|
|
56
56
|
"sass": "^1.101.0",
|
|
57
|
-
"typescript": "^
|
|
57
|
+
"typescript": "^7.0.2",
|
|
58
58
|
"vite": "^8.0.16",
|
|
59
59
|
"vite-plugin-dts": "^5.0.2",
|
|
60
60
|
"vite-plugin-web-components-hmr": "^0.1.3",
|
|
@@ -80,5 +80,8 @@
|
|
|
80
80
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
81
81
|
},
|
|
82
82
|
"license": "MIT",
|
|
83
|
-
"
|
|
83
|
+
"engines": {
|
|
84
|
+
"node": "^22.19.0 || ^24.0.0 || ^26.0.0"
|
|
85
|
+
},
|
|
86
|
+
"gitHead": "51f7f8d53f738720e275a3d9492b26f7ff16b88a"
|
|
84
87
|
}
|
|
@@ -81,7 +81,7 @@ describe('PktCombobox', () => {
|
|
|
81
81
|
const smallContainer = await createCombobox('id="size-small" label="Test" input-size="small"')
|
|
82
82
|
const smallCombobox = smallContainer.querySelector('pkt-combobox') as PktCombobox
|
|
83
83
|
await smallCombobox.updateComplete
|
|
84
|
-
const smallInner = smallCombobox.querySelector('pkt-input-wrapper
|
|
84
|
+
const smallInner = smallCombobox.querySelector('pkt-input-wrapper')
|
|
85
85
|
expect(smallInner?.classList.contains('pkt-inputwrapper--small')).toBe(true)
|
|
86
86
|
expect(smallInner?.classList.contains('pkt-inputwrapper--xsmall')).toBe(false)
|
|
87
87
|
|
|
@@ -92,7 +92,7 @@ describe('PktCombobox', () => {
|
|
|
92
92
|
)
|
|
93
93
|
const xsmallCombobox = xsmallContainer.querySelector('pkt-combobox') as PktCombobox
|
|
94
94
|
await xsmallCombobox.updateComplete
|
|
95
|
-
const xsmallInner = xsmallCombobox.querySelector('pkt-input-wrapper
|
|
95
|
+
const xsmallInner = xsmallCombobox.querySelector('pkt-input-wrapper')
|
|
96
96
|
expect(xsmallInner?.classList.contains('pkt-inputwrapper--small')).toBe(false)
|
|
97
97
|
expect(xsmallInner?.classList.contains('pkt-inputwrapper--xsmall')).toBe(true)
|
|
98
98
|
})
|
|
@@ -214,6 +214,9 @@ export class PktCombobox extends ComboboxHandlers implements IPktCombobox {
|
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
+
this.classList.add('pkt-combobox-component')
|
|
218
|
+
this.classList.toggle('pkt-combobox-component--fullwidth', !!this.fullwidth)
|
|
219
|
+
|
|
217
220
|
super.updated(changedProperties)
|
|
218
221
|
}
|
|
219
222
|
|
|
@@ -284,6 +287,9 @@ export class PktCombobox extends ComboboxHandlers implements IPktCombobox {
|
|
|
284
287
|
.helptextDropdown=${ifDefined(this.helptextDropdown)}
|
|
285
288
|
.helptextDropdownButton=${ifDefined(this.helptextDropdownButton)}
|
|
286
289
|
?fullwidth=${this.fullwidth}
|
|
290
|
+
?counter=${this.effectiveCounter(!!this.multiple && this.maxlength != null)}
|
|
291
|
+
.counterCurrent=${this._value.length}
|
|
292
|
+
.counterMaxLength=${this.maxlength ?? 0}
|
|
287
293
|
?hasError=${this.hasError}
|
|
288
294
|
?inline=${this.inline}
|
|
289
295
|
?disabled=${this.disabled}
|
|
@@ -295,7 +301,7 @@ export class PktCombobox extends ComboboxHandlers implements IPktCombobox {
|
|
|
295
301
|
.tagText=${this.tagText}
|
|
296
302
|
useWrapper=${this.useWrapper}
|
|
297
303
|
.forId=${this._hasTextInput ? this.id + '-input' : this.id + '-combobox'}
|
|
298
|
-
?hasFieldset=${!this._hasTextInput}
|
|
304
|
+
?hasFieldset=${this.effectiveHasFieldset(!this._hasTextInput)}
|
|
299
305
|
class="pkt-combobox__wrapper"
|
|
300
306
|
@labelClick=${this.handleInputClick}
|
|
301
307
|
>
|
|
@@ -37,7 +37,7 @@ export class PktDatepickerSingle extends PktDatepickerBase {
|
|
|
37
37
|
max=${ifDefined(this.max)}
|
|
38
38
|
placeholder=${ifDefined(this.placeholder)}
|
|
39
39
|
?readonly=${this.isInputReadonly}
|
|
40
|
-
aria-describedby="${this.id}-helptext"
|
|
40
|
+
aria-describedby="${this.id}-input-helptext"
|
|
41
41
|
@click=${(e: MouseEvent) => {
|
|
42
42
|
e.preventDefault()
|
|
43
43
|
this.dispatchToggleCalendar(e)
|
|
@@ -226,6 +226,9 @@ export class PktDatepicker extends PktInputElement<Props> {
|
|
|
226
226
|
this._value = [this._value[0] ?? '']
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
|
+
// Ytre boks, samme klasser og rolle som Reacts ytre div
|
|
230
|
+
this.classList.add('pkt-datepicker')
|
|
231
|
+
this.classList.toggle('pkt-datepicker--fullwidth', this.fullwidth)
|
|
229
232
|
this.classList.toggle('pkt-datepicker--medium', this.inputSize === 'medium')
|
|
230
233
|
this.classList.toggle('pkt-datepicker--small', this.inputSize === 'small')
|
|
231
234
|
this.classList.toggle('pkt-datepicker--xsmall', this.inputSize === 'xsmall')
|
|
@@ -501,7 +504,7 @@ export class PktDatepicker extends PktInputElement<Props> {
|
|
|
501
504
|
.counterMaxLength=${this.maxlength}
|
|
502
505
|
?disabled=${this.disabled}
|
|
503
506
|
?hasError=${this.hasError}
|
|
504
|
-
?hasFieldset=${this.
|
|
507
|
+
?hasFieldset=${this.effectiveHasFieldset(false)}
|
|
505
508
|
?inline=${this.inline}
|
|
506
509
|
?required=${this.required}
|
|
507
510
|
?optionalTag=${this.optionalTag}
|
|
@@ -514,9 +517,8 @@ export class PktDatepicker extends PktInputElement<Props> {
|
|
|
514
517
|
.helptext=${this.helptext}
|
|
515
518
|
.helptextDropdown=${this.helptextDropdown}
|
|
516
519
|
.helptextDropdownButton=${this.helptextDropdownButton}
|
|
517
|
-
.
|
|
520
|
+
.ariaDescribedby=${this.ariaDescribedby}
|
|
518
521
|
.size=${this.inputSize}
|
|
519
|
-
class="pkt-datepicker"
|
|
520
522
|
>
|
|
521
523
|
<div class="pkt-contents" slot="helptext">${slotContent(this, 'helptext')}</div>
|
|
522
524
|
${this.multiple
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { html } from 'lit'
|
|
1
|
+
import { html, PropertyValues } from 'lit'
|
|
2
2
|
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'
|
|
@@ -58,6 +58,11 @@ export class PktFileUpload extends PktFileUploadBase implements IPktFileUpload {
|
|
|
58
58
|
@state() private previewCurrentIndex = 0
|
|
59
59
|
@state() private failedImageFileIds: Record<string, FileImageFailureFlags> = {}
|
|
60
60
|
|
|
61
|
+
protected updated(changedProperties: PropertyValues): void {
|
|
62
|
+
super.updated(changedProperties)
|
|
63
|
+
this.classList.add('pkt-fileupload-component')
|
|
64
|
+
}
|
|
65
|
+
|
|
61
66
|
render() {
|
|
62
67
|
const content = this.renderContent()
|
|
63
68
|
|