@oslokommune/punkt-elements 18.0.0 → 18.2.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 +34 -0
- package/dist/{accordion-1_pdxTgJ.js → accordion-CcUosZjL.js} +5 -5
- package/dist/{accordion-DobbH-Sv.cjs → accordion-k0pWTG1X.cjs} +1 -1
- package/dist/alert-BD8YVKia.cjs +35 -0
- package/dist/{alert-xspFetQ8.js → alert-Bmaly2Yo.js} +46 -41
- package/dist/{async-directive-D2Sht790.js → async-directive-COqx0IYj.js} +2 -2
- package/dist/{async-directive-B5pcIMfO.cjs → async-directive-DN2eg9gA.cjs} +1 -1
- package/dist/{backlink-C0jZFnZ2.js → backlink-C_ZO-ZbR.js} +4 -4
- package/dist/{backlink-ZMhqHaVs.cjs → backlink-Ch64Pivx.cjs} +1 -1
- package/dist/base-elements/element.d.ts +6 -1
- package/dist/base-elements/input-element.d.ts +2 -1
- package/dist/{breadcrumbs-BvMownZN.js → breadcrumbs-CF_gAbUk.js} +2 -2
- package/dist/{breadcrumbs-BS64xd1s.cjs → breadcrumbs-CzzbardP.cjs} +1 -1
- package/dist/{button-C44vNLFC.js → button-C1CQSASU.js} +5 -5
- package/dist/{button-CR4CXtnj.cjs → button-CF3dNKeI.cjs} +1 -1
- package/dist/{calendar-DQ4byeom.cjs → calendar-BxF81kB9.cjs} +1 -1
- package/dist/{calendar-DgjCKMMV.js → calendar-DRmxORMc.js} +3 -3
- package/dist/{card-Dpqi6HVt.cjs → card-Cg1daj05.cjs} +1 -1
- package/dist/{card-DhHqC265.js → card-W_Jb0Tlo.js} +7 -7
- package/dist/{checkbox-CXQxbiaX.cjs → checkbox-BHQv8lHq.cjs} +1 -1
- package/dist/{checkbox-BQ1K57AB.js → checkbox-BQw2dMSX.js} +4 -4
- package/dist/{class-map-CzCE5pqG.cjs → class-map-C33ixq7O.cjs} +1 -1
- package/dist/{class-map-F1DJHyb7.js → class-map-wh4Yi3oj.js} +1 -1
- package/dist/{combobox-BV4oDiII.cjs → combobox-BpZow9OU.cjs} +1 -1
- package/dist/{combobox-DPck39I2.js → combobox-C9wwnUfM.js} +12 -12
- 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 +5 -4
- 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 +7 -8
- package/dist/components/breadcrumbs/index.d.ts +1 -1
- package/dist/components/calendar/calendar.d.ts +2 -1
- package/dist/components/combobox/combobox-base.d.ts +2 -1
- package/dist/components/combobox/combobox.d.ts +2 -1
- package/dist/components/datepicker/date-tags.d.ts +2 -1
- package/dist/components/datepicker/datepicker.d.ts +2 -1
- package/dist/components/fileupload/fileupload-base.d.ts +4 -2
- package/dist/components/fileupload/fileupload-types.d.ts +5 -43
- package/dist/components/header/types.d.ts +3 -2
- package/dist/components/helptext/helptext.d.ts +2 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/components/input-wrapper/input-wrapper.d.ts +2 -1
- package/dist/components/listbox/listbox.d.ts +3 -2
- package/dist/components/tag/tag.d.ts +2 -1
- package/dist/components/timepicker/timepicker.d.ts +2 -1
- package/dist/{consent-_N9foluG.cjs → consent-CPtr7cBw.cjs} +1 -1
- package/dist/{consent-BneInZov.js → consent-D8MrqGKk.js} +2 -2
- package/dist/{datepicker-nSSSr1U7.js → datepicker-D4YnAtWG.js} +11 -11
- package/dist/{datepicker-9NX5qt2z.cjs → datepicker-DaoumZT9.cjs} +1 -1
- package/dist/define-component-spec-BYOSeplU.js +6 -0
- package/dist/define-component-spec-DBNd2FJY.cjs +1 -0
- package/dist/{directive-helpers-BARw3nEZ.js → directive-helpers-BWSAVe00.js} +1 -1
- package/dist/{directive-helpers-D6AAMFKs.cjs → directive-helpers-C6J4AkFk.cjs} +1 -1
- package/dist/docs/components/alert.d.ts +2 -3
- package/dist/{element-B8OGznK0.cjs → element-DiFhBcIl.cjs} +1 -1
- package/dist/{element-BKSPVgs2.js → element-WEzISABa.js} +1 -0
- package/dist/{element-with-slot-YUAUFRqw.js → element-with-slot-BKYUx4gb.js} +2 -2
- package/dist/{element-with-slot-DTxILHVv.cjs → element-with-slot-CBK4zrdN.cjs} +1 -1
- package/dist/{fileupload-E0LGGNgj.js → fileupload-DEHSETw0.js} +110 -412
- package/dist/{fileupload-D05VSbEP.cjs → fileupload-DWu6FIMv.cjs} +37 -37
- package/dist/{footer-DYilVBMC.js → footer-BJLEw6Ab.js} +4 -4
- package/dist/{footer-DBApIdGh.cjs → footer-D_yYWkQ6.cjs} +1 -1
- package/dist/{header-B7tbX-Ok.cjs → header-B7_4Cwaq.cjs} +1 -1
- package/dist/{header-v3GWAzOK.js → header-DLVq7-dM.js} +11 -11
- package/dist/{header-menu-D522-VTV.js → header-menu-BsrrTjpT.js} +4 -4
- package/dist/{header-menu-1FFWhvNc.cjs → header-menu-m7nOOC1g.cjs} +1 -1
- package/dist/{heading-rx_oSCqe.js → heading-DSArgrDK.js} +2 -2
- package/dist/{heading-CvytvcL7.cjs → heading-_RPw2UW9.cjs} +1 -1
- package/dist/{helptext-DYFdcylX.cjs → helptext-QMVsW5g6.cjs} +1 -1
- package/dist/{helptext-LShGPm-b.js → helptext-dtVVufNH.js} +4 -4
- package/dist/{icon-HYU1f54x.js → icon-DEtOSWRK.js} +1 -1
- package/dist/{icon-BmMC09mi.cjs → icon-DIavy2cB.cjs} +1 -1
- package/dist/{if-defined-BF8XcDi5.js → if-defined-BmnvvxtR.js} +1 -1
- package/dist/if-defined-Dc3xFDaM.cjs +1 -0
- package/dist/{input-element-DumGj_oJ.cjs → input-element-DQY1Rpbp.cjs} +1 -1
- package/dist/{input-element-D07DmR34.js → input-element-IBypGOaV.js} +2 -2
- package/dist/{input-wrapper-Cci_wTvD.js → input-wrapper-CQgAL1Br.js} +6 -6
- package/dist/{input-wrapper-DDfapoRX.cjs → input-wrapper-mJZLVXy_.cjs} +1 -1
- package/dist/{link-CQK0SH4H.js → link-DwLeY37f.js} +51 -18
- package/dist/link-yk4IXDWm.cjs +7 -0
- package/dist/{linkcard-DNYsVlV6.cjs → linkcard-BinKnxQF.cjs} +1 -1
- package/dist/{linkcard-B4GlmjJ6.js → linkcard-D5DXpmXI.js} +4 -4
- package/dist/{listbox-BlFRhyI7.cjs → listbox-C5zTRNAO.cjs} +1 -1
- package/dist/{listbox-wd_OofyF.js → listbox-C8ooO8qZ.js} +4 -4
- package/dist/{loader-0C3qVk16.js → loader-C3HyayzL.js} +4 -4
- package/dist/{loader-B9u2qUlR.cjs → loader-DHF7M5Vn.cjs} +1 -1
- package/dist/{messagebox-BD5tGmT-.cjs → messagebox-DqYf6VmQ.cjs} +1 -1
- package/dist/{messagebox-C-y1ICmr.js → messagebox-u8i3R5QA.js} +4 -4
- package/dist/{modal-BzPGQYCs.cjs → modal-CnJ9y2TQ.cjs} +1 -1
- package/dist/{modal-Cghs3w-d.js → modal-V-jEe0aY.js} +5 -5
- 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-CEEAqXaB.cjs → pkt-options-controller-BhMNCWcc.cjs} +1 -1
- package/dist/{pkt-options-controller-PtjhmTGk.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-BexQQw1o.js → progressbar-DS4i8IWq.js} +4 -4
- package/dist/{progressbar-X9mSvpjw.cjs → progressbar-DY5hxImR.cjs} +1 -1
- package/dist/{radiobutton-CkhTasn4.js → radiobutton-BhvZztMZ.js} +4 -4
- package/dist/{radiobutton-ln29Ad3U.cjs → radiobutton-BswqwRnA.cjs} +1 -1
- package/dist/{ref-CHbJYtKE.cjs → ref-DZmN5Qgj.cjs} +1 -1
- package/dist/{ref-Chc_DZAb.js → ref-OU8ryfP6.js} +2 -2
- package/dist/{repeat-CHDs__rN.cjs → repeat-DIa_g6WL.cjs} +1 -1
- package/dist/{repeat-P9SMlKd5.js → repeat-Dx2H127b.js} +2 -2
- package/dist/{searchinput-Da7dKHBH.js → searchinput-CJo1PpM7.js} +4 -4
- package/dist/{searchinput-CPgMEAZZ.cjs → searchinput-Cl46nW0r.cjs} +1 -1
- package/dist/{select-jabMSjft.js → select-CBrjauXT.js} +7 -7
- package/dist/{select-DCuvdAuK.cjs → select-Dman8Skr.cjs} +1 -1
- package/dist/shared-strings/index.d.ts +1 -1
- package/dist/shared-strings/nb.d.ts +3 -0
- package/dist/shared-strings/types.d.ts +17 -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 +56 -2
- package/dist/shared-types/footer.d.ts +10 -0
- package/dist/shared-types/form-field.d.ts +46 -0
- package/dist/shared-types/header-footer.d.ts +2 -0
- package/dist/shared-types/index.d.ts +15 -5
- package/dist/shared-types/render-link.d.ts +22 -0
- package/dist/shared-types/searchinput.d.ts +2 -1
- package/dist/shared-types/skin.d.ts +2 -9
- package/dist/{tabs-DV5CQNDL.cjs → tabs-C1m5rSrR.cjs} +1 -1
- package/dist/{tabs-D_hoi1zu.js → tabs-Xu3mIedh.js} +4 -4
- package/dist/{tag-DK5SgKry.js → tag-Azkjhkeu.js} +5 -5
- package/dist/{tag-BxYulmZn.cjs → tag-BS6dDPxY.cjs} +1 -1
- package/dist/{textarea-BR7Riace.js → textarea-D4qXcVGD.js} +9 -9
- package/dist/{textarea-ffBD_VHq.cjs → textarea-DftUkR6w.cjs} +1 -1
- package/dist/{textinput-CtHFzAux.cjs → textinput-Ar-1Sbqy.cjs} +1 -1
- package/dist/{textinput-CRNrsRNV.js → textinput-iCgwwNPU.js} +8 -8
- package/dist/{timepicker-ixs_E5RY.js → timepicker-W6HVWtmA.js} +8 -8
- package/dist/{timepicker-AfgJipo6.cjs → timepicker-dpAF7h49.cjs} +1 -1
- package/package.json +2 -2
- package/src/components/accordion/accordion.ts +2 -10
- package/src/components/accordion/accordionitem.ts +2 -9
- package/src/components/alert/alert.ts +21 -12
- package/src/components/backlink/backlink.test.ts +3 -3
- package/src/components/backlink/backlink.ts +4 -6
- package/src/components/breadcrumbs/breadcrumbs.ts +9 -10
- package/src/components/breadcrumbs/index.ts +1 -1
- package/src/components/calendar/calendar.ts +2 -1
- package/src/components/combobox/combobox-base.ts +2 -1
- package/src/components/combobox/combobox.ts +2 -1
- package/src/components/datepicker/date-tags.ts +2 -1
- package/src/components/datepicker/datepicker.ts +3 -1
- package/src/components/fileupload/fileupload-base.ts +4 -3
- package/src/components/fileupload/fileupload-types.ts +5 -42
- package/src/components/header/types.ts +6 -4
- package/src/components/helptext/helptext.ts +2 -1
- package/src/components/index.ts +2 -2
- package/src/components/input-wrapper/input-wrapper.ts +3 -2
- package/src/components/link/link.ts +8 -3
- package/src/components/listbox/listbox.ts +3 -2
- package/src/components/tag/tag.ts +2 -2
- package/src/components/timepicker/timepicker.ts +3 -2
- package/dist/alert-COeHz6o2.cjs +0 -33
- package/dist/if-defined-CVYApOgK.cjs +0 -1
- package/dist/link-11g2ZNin.cjs +0 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-B8OGznK0.cjs"),t=require("./class-map-CzCE5pqG.cjs"),n=require("./element-with-slot-DTxILHVv.cjs");require("./icon-BmMC09mi.cjs");const r=require("./if-defined-CVYApOgK.cjs"),i=require("./ref-CHbJYtKE.cjs");require("./tag-BxYulmZn.cjs");const a=require("./repeat-CHDs__rN.cjs"),o=require("./listbox-BlFRhyI7.cjs"),s=require("./input-element-DumGj_oJ.cjs"),c=require("./pkt-options-controller-CEEAqXaB.cjs");require("./input-wrapper-DDfapoRX.cjs");var l=(e,t,n)=>{switch(e){case`,`:return n?`addValue`:null;case`Enter`:return`addValue`;case`Tab`:case`ArrowDown`:return t?null:`focusListbox`;case`Escape`:return`closeOptions`;default:return null}},u=(e,t,n,r,i)=>{if(!e)return{action:`none`,value:null};let a=o.i(n,e);return!t.includes(e)&&!a?r?{action:`addUserValue`,value:e}:i?{action:`none`,value:null}:{action:`removeValue`,value:t[0]}:a&&!t.includes(a.value)?{action:`selectOption`,value:a.value}:{action:`none`,value:null}},d=(e,t,n,r,i)=>e.trim().toLowerCase()?{...o.s(e,t,n,r),shouldRemoveValue:!1,shouldResetInput:!1}:{addValueText:null,userInfoMessage:``,shouldRemoveValue:!i&&!!t[0],shouldResetInput:!0},f=(e,t,n)=>{let r=o.i(t,e);return n===`label`&&r?.label?r.label:e},p={markOptionSelected(e,t){if(t){for(let n of e)if(n.value===t){n.selected=!0;break}}},markOptionDeselected(e,t){if(t){for(let n of e)if(n.value===t){n.selected=!1;break}}},markAllSelected(e){for(let t of e)t.selected=!0},markAllDeselected(e){for(let t of e)t.selected=!1},removeUserAddedOptions(e){return e.filter(e=>!e.userAdded)}},m={parseOptionsFromSlot(e){let t=[];return e.forEach(e=>{if(!e.textContent&&!e.getAttribute(`value`))return;let n={value:e.getAttribute(`value`)||e.textContent||``,label:e.textContent||e.getAttribute(`value`)||``};e.getAttribute(`data-prefix`)&&(n.prefix=e.getAttribute(`data-prefix`)||void 0),e.getAttribute(`tagskincolor`)&&(n.tagSkinColor=e.getAttribute(`tagskincolor`)),e.getAttribute(`description`)&&(n.description=e.getAttribute(`description`)||void 0),n.fulltext=o.r(n),t.push(n)}),t}},h={syncOptionsWithValues(e,t){let n=[...t];return e.forEach(e=>{e.value&&!e.label&&(e.label=e.value),e.selected&&!n.includes(e.value)&&n.push(e.value),e.fulltext=o.r(e),e.selected=e.selected||n.includes(e.value)}),{options:e,newValues:n}},mergeWithUserAdded(e,t){return[...t.filter(e=>e?.userAdded&&e.selected).filter(t=>!(Array.isArray(e)?e:[]).some(e=>e.value===t.value)),...e]}},g={name:`pkt-combobox`,react:`PktCombobox`,"css-class":`pkt-combobox`,isElement:!0,isPureReact:!0,props:{name:{type:`string`,name:`Navn`,description:`Navn som brukes i skjema ved innsending`,category:`tech`},id:{type:`string`,name:`ID`,description:`Unik ID for feltet`,category:`tech`},label:{type:`string`,name:`Etikett/label`,description:`Tekst som vises over feltet`,category:`contents`},placeholder:{name:`Hint`,description:`Spesifiserer en kort hint som beskriver forventet verdi av feltet.`,type:`string`,category:`contents`,required:!1},multiple:{type:`boolean`,name:`Flervalg`,default:!1,description:`Mulighet for å velge flere valg`,category:`functionality`},tagPlacement:{attribute:`tag-placement`,type:[`inside`,`outside`],name:`Plassering av tags i flervalg`,description:`Plassering av valgte verdier i feltet ved flervalg`,category:`functionality`,showIf:{multiple:!0}},maxlength:{type:`number`,name:`Maks antall i flervalg`,description:`Maks antall valg dersom flervalg er aktivert`,category:`functionality`,showIf:{multiple:!0}},typeahead:{type:`boolean`,name:`Typeahead`,default:!1,description:`Mulighet for automatisk utfylling av feltet fra listen over valg`,category:`functionality`},includeSearch:{attribute:`include-search`,type:`boolean`,name:`Inkluder søk`,description:`Mulighet for å søke etter valg inni dropdown`,category:`functionality`},allowUserInput:{attribute:`allow-user-input`,type:`boolean`,name:`Brukervalgte verdier`,description:`Mulighet for å skrive inn egne verdier`,category:`functionality`},searchPlaceholder:{attribute:`search-placeholder`,type:`string`,name:`Søke-plassholder`,description:`Plassholdertekst for søkefeltet i dropdown`,category:`contents`,showIf:{includeSearch:!0}},displayValueAs:{attribute:`display-value-as`,type:[`label`,`value`,`prefixAndValue`],name:`Visning av valgt verdi`,description:`Hvordan valgt verdi vises i feltet`,default:`label`,category:`ui`},inputSize:{name:`Størrelse`,description:`Visuell størrelse via input-wrapper. small: kompakt wrapper og felt (42px). xsmall: samme wrapper som small, felt 36px.`,attribute:`input-size`,type:[`small`,`medium`,`xsmall`],default:`medium`,category:`ui`},value:{name:`Verdi`,type:`string`,description:`Valgt verdi. Streng ved enkelt valg, array av strenger ved flervalg.`,category:`tech`},helptext:{type:`string`,name:`Hjelpetekst`,description:`Hjelpetekst som vises over feltet`,category:`contents`},helptextDropdown:{type:`string`,name:`Utvidet hjelpetekst`,description:`Hjelpetekst som vises i en lukket boks man kan åpne`,category:`contents`},helptextDropdownButton:{type:`string`,name:`Knappetekst for hjelpetekst`,description:`Tekst som vises på knappen for å åpne/lukke utvidet hjelpetekst`,category:`contents`,default:`Les mer`},disabled:{type:`boolean`,name:`Deaktivert`,description:`Feltet er deaktivert`,category:`tech`},hasError:{type:`boolean`,name:`Feil`,description:`Feltet har en feil`,category:`ui`},errorMessage:{type:`string`,name:`Feilmelding`,description:`Tekst som vises under feltet ved feil`,category:`contents`},required:{type:`boolean`,name:`Påkrevd`,description:`Feltet må fylles ut`,category:`tech`},requiredTag:{type:`boolean`,name:`Påkrevd-merking`,description:`Viser en merking som indikerer at feltet er påkrevd`,category:`ui`},requiredText:{type:`string`,name:`Påkrevd-tekst`,description:`Tekst som vises i påkrevd-merkingen`,category:`contents`},optionalTag:{type:`boolean`,name:`Valgfritt-merking`,description:`Viser en merking som indikerer at feltet er valgfritt`,category:`ui`},optionalText:{type:`string`,name:`Valgfritt-tekst`,description:`Tekst som vises i valgfritt-merkingen`,category:`contents`},tagText:{type:`string`,name:`Tag-tekst`,description:`Tekst som vises i en tag ved siden av label`,category:`ui`},fullwidth:{type:`boolean`,name:`Full bredde`,description:`Skal feltet ta opp hele bredden?`,category:`ui`},defaultOptions:{attribute:`default-options`,name:`Initielle valg (default options)`,description:`Liste over valg som kan velges, om options sendes inn som array med objekter (denne vil ikke modifiseres ved endring innad i komponenten)`,type:`array`,default:[],previewDefault:[{value:`bfr`,label:`Frogner`},{value:`bgo`,label:`Gamle Oslo`},{value:`bgr`,label:`Grorud`},{value:`bxx`,label:`Andre bydeler`}],items:{type:`object`,properties:{value:{type:`string`,description:`Verdi som sendes ved valg`},label:{type:`string`,description:`Tekst som vises for valget`},prefix:{type:`string`,description:`Tekst som vises før valget`},description:{type:`string`,description:`Beskrivelse av valget`},disabled:{type:`boolean`,description:`Valget er deaktivert`},selected:{type:`boolean`,description:`Valget er valgt`},tagSkinColor:{type:[`blue`,`blue-dark`,`blue-light`,`green`,`red`,`yellow`,`beige`,`gray`,`grey`],description:`Farge på tag`}},required:[`value`]},category:`contents`},options:{name:`Valg`,type:`array`,description:`Liste over valg som kan velges, om options sendes inn som array med objekter`,default:[],items:{type:`object`,properties:{value:{type:`string`,description:`Verdi som sendes ved valg`},label:{type:`string`,description:`Tekst som vises for valget`},prefix:{type:`string`,description:`Tekst som vises før valget`},description:{type:`string`,description:`Beskrivelse av valget`},disabled:{type:`boolean`,description:`Valget er deaktivert`},selected:{type:`boolean`,description:`Valget er valgt`},tagSkinColor:{type:[`blue`,`blue-dark`,`blue-light`,`green`,`red`,`yellow`,`beige`,`gray`,`grey`],description:`Farge på tag`}},required:[`value`]},category:`contents`},inline:{name:`Inline`,type:`boolean`,required:!1,default:!1,description:`Angir om feltet skal flyte med teksten`,category:`ui`},useWrapper:{name:`Bruk wrapper`,type:`boolean`,required:!1,displayAsFalse:!0,default:!0,description:`Indikerer om skjemaelementet skal bruke en wrapper`,category:`ui`},hasFieldset:{name:`Bruk fieldset`,type:`boolean`,required:!1,default:null,description:`Bruk fieldset og legend i stedet for label. Utledes automatisk når feltet ikke har en input.`,category:`ui`},counter:{name:`Teller`,type:`boolean`,required:!1,default:null,description:`Viser teller under feltet. Slås på av seg selv når det finnes en grense å telle mot; sett til false for å skru den av.`,category:`ui`}},events:{change:{type:`Event`,description:`Returnerer valgt verdi som streng. Ved flervalg returneres kommaseparerte verdier.`},"value-change":{type:`CustomEvent`,description:`Returnerer valgt verdi. Ved enkeltvalg en streng, ved flervalg en <code>string[]</code>.`},search:{type:`CustomEvent`,description:`Returnerer søketeksten som streng i <code>event.detail</code> når brukeren skriver i søkefeltet`},toggleHelpText:{type:`CustomEvent`,description:`Returnerer <code>event.detail { isOpen: true }</code> eller <code>event.detail { isOpen: false }</code> når hjelpeteksten åpnes eller lukkes`}}},_=class extends s.t{constructor(){super(),this.value=``,this.options=[],this.defaultOptions=[],this.allowUserInput=!1,this.typeahead=!1,this.includeSearch=!1,this.searchPlaceholder=``,this.multiple=!1,this.maxlength=null,this.displayValueAs=g.props.displayValueAs.default,this.tagPlacement=null,this.isOpen=!1,this._options=[],this._value=[],this._isOptionsOpen=!1,this._userInfoMessage=``,this._addValueText=null,this._maxIsReached=!1,this._search=``,this._inputFocus=!1,this._internalValueSync=!1,this._optionsFromSlot=!1,this._lastSlotGeneration=0,this._suppressNextOpen=!1,this.inputRef=i.t(),this.triggerRef=i.t(),this.listboxRef=i.t(),this.optionsController=new c.t(this)}get _hasTextInput(){return this.typeahead||this.allowUserInput}get _selectionDescription(){if(!(!this.multiple||this._value.length===0))return`${this._value.length} valgt`}focusTrigger(){this._hasTextInput?this.inputRef.value?.focus():this.triggerRef.value?.focus()}parseValue(){return Array.isArray(this.value)?this.multiple?this.value:this.value.length>0?[this.value[0]]:[]:this.value&&this.multiple?this.value.split(`,`):this.value?[this.value]:[]}updateMaxReached(){this._maxIsReached=o.c(this._value.length,this.maxlength)}syncValueAndDispatch(e){let t=this._value,n=this.multiple?t.join(`,`):t[0]||``;if(n!==(Array.isArray(this.value)?this.value.join(`,`):String(this.value||``))&&(this._internalValueSync=!0,this.value=n),e?.join(`,`)!==t.join(`,`)){let e=this.multiple?[...t]:t[0]||``;this.onChange(e)}else t.length===0&&e&&e.length>0&&this.clearInputValue()}onChange(e){this.touched=!0,super.onChange(e)}valueChanged(){}};e.n([e.u({type:String,reflect:!0})],_.prototype,`value`,void 0),e.n([e.u({type:Array})],_.prototype,`options`,void 0),e.n([e.u({type:Array,attribute:`default-options`})],_.prototype,`defaultOptions`,void 0),e.n([e.u({type:Boolean,attribute:`allow-user-input`})],_.prototype,`allowUserInput`,void 0),e.n([e.u({type:Boolean})],_.prototype,`typeahead`,void 0),e.n([e.u({type:Boolean,attribute:`include-search`})],_.prototype,`includeSearch`,void 0),e.n([e.u({type:String,attribute:`search-placeholder`})],_.prototype,`searchPlaceholder`,void 0),e.n([e.u({type:Boolean})],_.prototype,`multiple`,void 0),e.n([e.u({type:Number})],_.prototype,`maxlength`,void 0),e.n([e.u({type:String,attribute:`display-value-as`})],_.prototype,`displayValueAs`,void 0),e.n([e.u({type:String,attribute:`tag-placement`})],_.prototype,`tagPlacement`,void 0),e.n([e.u({type:Boolean,attribute:`open`})],_.prototype,`isOpen`,void 0),e.n([e.l()],_.prototype,`_options`,void 0),e.n([e.l()],_.prototype,`_value`,void 0),e.n([e.l()],_.prototype,`_isOptionsOpen`,void 0),e.n([e.l()],_.prototype,`_userInfoMessage`,void 0),e.n([e.l()],_.prototype,`_addValueText`,void 0),e.n([e.l()],_.prototype,`_maxIsReached`,void 0),e.n([e.l()],_.prototype,`_search`,void 0),e.n([e.l()],_.prototype,`_inputFocus`,void 0);var v=class extends _{toggleValue(e){if(this.disabled)return;this.touched=!0,this._userInfoMessage=``,this._addValueText=null;let t=o.i(this.options,e)?.value||null,n=this._value.includes(e||t||``),r=!!t,i=this._options.find(t=>t.value===e)?.disabled||!1,a=!e?.trim(),s=!this.multiple,c=this.multiple,l=o.c(this._value.length,this.maxlength),u=!1,d=!0,f=``,p=``;i||(!r&&this.allowUserInput&&!a?(this.addNewUserValue(e),f=`valueAdded`,u=c):!r&&!this.allowUserInput?(s&&this._value[0]&&this.removeValue(this._value[0]),d=!1,u=!0,f=`noResults`):n?(this.removeValue(t),u=!0,s&&this._hasTextInput&&this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(this.inputRef.value.value=``)):a&&s?(this.removeAllSelected(),u=!0):s?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(t),u=!1):c&&!l?(this.setSelected(t),u=!0):c&&l?(f=`maxSelected`,d=!1,p=e):(s&&this.removeAllSelected(),f=`noValidValue`,d=!1,u=!0,p=e),this._isOptionsOpen=u,u||(s&&this._hasTextInput&&(this._suppressNextOpen=!0),window.setTimeout(()=>{this.focusTrigger()},0)),this._userInfoMessage=f,this._search=p||``,this.resetComboboxInput(d),c&&this.updateMaxReached())}setSelected(e){if(!this._value.includes(e)){if(this.multiple&&o.c(this._value.length,this.maxlength)){this._userInfoMessage=`maxSelected`;return}!this.multiple&&this.removeAllSelected(),this._value=e?[...this._value,e]:this._value,p.markOptionSelected(this._options,e),this.resetComboboxInput(!0)}}removeSelected(e){if(!e)return;this._value=this._value.filter(t=>t!==e);let t=o.i(this.options,e);t&&(p.markOptionDeselected(this.options,e),t.userAdded?(this._options=[...this._options.filter(t=>t.value!==e)],this.options=[...this.options.filter(t=>t.value!==e)]):this._options.some(t=>t.value===e)||(this._options=[...this._options,t]))}addAllOptions(){if(this.multiple){if(this.maxlength&&this._options.length>this.maxlength){this._userInfoMessage=`tooManySelected`;return}this._value=this._options.map(e=>e.value),p.markAllSelected(this._options),this.requestUpdate()}}removeAllSelected(){this._value=[],p.markAllDeselected(this._options),this._options=p.removeUserAddedOptions(this._options),this.requestUpdate()}addValue(){let e=this.inputRef.value?.value.trim()||``;if(this._search=e,e&&this._value.includes(e)){this.resetComboboxInput(!0),this._userInfoMessage=`alreadySelected`;return}this.toggleValue(e)}removeValue(e){this._value=this.multiple?this._value.filter(t=>t!==e):[],this.removeSelected(e)}addNewUserValue(e){if(!e||e.trim()===``)return;if(!this.multiple)this._value[0]&&this.removeSelected(this._value[0]),this._value=[e];else if(!o.i(this.options,e)){if(o.c(this._value.length,this.maxlength))return;this._value=[...this._value,e]}let t={value:e,label:e,userAdded:!0,selected:!0};this.options=[t,...this.options],this._options=[t,...this._options],this.resetComboboxInput(!0),this.multiple||(this._isOptionsOpen=!1,this._hasTextInput&&(this._suppressNextOpen=!0),window.setTimeout(()=>{this.focusTrigger()},0)),this.requestUpdate()}resetComboboxInput(e=!0){this._addValueText=null,this.inputRef.value&&this.inputRef.value.type!==`hidden`&&e&&(this._search=``,this.multiple?this.inputRef.value.value=``:(this.inputRef.value.value=this._value[0]?f(this._value[0],this.options,this.displayValueAs):``,this._userInfoMessage=``)),this._options=[...this.options]}removeLastValue(e){if(this._value.length===0)return;e.preventDefault();let t=this._value[this._value.length-1];t&&this.removeSelected(t),this.updateMaxReached()}},y=class extends v{handleInput(e){if(e.stopPropagation(),e.stopImmediatePropagation(),this.disabled)return;this.touched=!0;let t=e.target;if(this._search=t.value,this.checkForMatches(),this.typeahead){if(this._search){let{filtered:n,suggestion:r}=o.o(this.options,this._search);this._options=n,e.inputType!==`deleteContentBackward`&&r?.label&&this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(t.value=r.label,window.setTimeout(()=>t.setSelectionRange(this._search.length,t.value.length),0),t.selectionDirection=`backward`)}else this._options=[...this.options]}}handleFocus(){if(!this.disabled){if(this._suppressNextOpen){this._suppressNextOpen=!1,this._inputFocus=!0,this.requestUpdate();return}!this.multiple&&this._value[0]&&this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(this.inputRef.value.value=f(this._value[0],this.options,this.displayValueAs)),this._inputFocus=!0,this._search=``,this._options=[...this.options],this._isOptionsOpen=!0,this.onFocus(),this.requestUpdate()}}handleFocusOut(e){if(this.disabled||!this._isOptionsOpen)return;let t=e.relatedTarget;t?.closest(`pkt-combobox`)?.id!==this.id&&e.target?.getAttribute(`data-focusfix`)!==this.id&&t!==this.inputRef.value&&t!==this.triggerRef.value&&this.closeAndProcessInput()}closeAndProcessInput(){if(this._inputFocus=!1,this._addValueText=null,this._userInfoMessage=``,this._search=``,this.inputRef.value&&this.inputRef.value.type!==`hidden`){let e=this.inputRef.value.value;if(!this.multiple){if(!e)this._value[0]&&this.removeSelected(this._value[0]);else{let t=o.i(this.options,e);t&&t.value!==this._value[0]?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(t.value)):!t&&this.allowUserInput&&(this._value[0]&&this.removeSelected(this._value[0]),this.addNewUserValue(e))}}else if(e!==``){let{action:t,value:n}=u(e,this._value,this.options,this.allowUserInput,this.multiple);switch(t){case`addUserValue`:this.addNewUserValue(n);break;case`selectOption`:this.setSelected(n);break;case`removeValue`:this.removeValue(n)}}!this.multiple&&this._value[0]?this.inputRef.value.value=f(this._value[0],this.options,this.displayValueAs):this.inputRef.value.value=``}this._isOptionsOpen=!1,this.onBlur()}handleBlur(){this._inputFocus=!1,this.onBlur()}handleInputClick(e){if(this.disabled){e.preventDefault(),e.stopImmediatePropagation();return}this._hasTextInput?(this.inputRef.value?.focus(),this.requestUpdate()):(e.stopImmediatePropagation(),e.preventDefault(),this._isOptionsOpen=!this._isOptionsOpen,this._isOptionsOpen&&this.listboxRef.value?.focusFirstOrSelectedOption())}handlePlaceholderClick(e){this.disabled||(e.stopPropagation(),this._hasTextInput&&this.inputRef.value?(this.inputRef.value.focus(),this._inputFocus=!0,this.requestUpdate()):(this._isOptionsOpen=!this._isOptionsOpen,this.requestUpdate()))}handleSelectOnlyKeydown(e){if(!this.disabled)switch(e.key){case`Enter`:case` `:case`ArrowDown`:case`ArrowUp`:e.preventDefault(),this._isOptionsOpen?this._isOptionsOpen=!1:(this._isOptionsOpen=!0,this.listboxRef.value?.focusFirstOrSelectedOption());break;case`Escape`:this._isOptionsOpen&&=(e.preventDefault(),!1);break;case`Home`:case`End`:e.preventDefault(),this._isOptionsOpen||=!0,this.listboxRef.value?.focusFirstOrSelectedOption();break;case`ArrowLeft`:this.multiple&&this._value.length>0&&(e.preventDefault(),this.focusTag(this._value.length-1));break;case`Backspace`:case`Delete`:this.multiple&&this._value.length>0&&(e.preventDefault(),this.removeSelected(this._value[this._value.length-1]))}}handleOptionToggled(e){this.toggleValue(e.detail)}handleSearch(e){e.stopPropagation(),this._search=e.detail.toLowerCase(),this.checkForMatches()}handleInputKeydown(e){if(e.key===`Backspace`){let t=!this.inputRef.value?.value;!this._search&&t&&this.multiple&&this._value.length>0&&this.removeLastValue(e);return}if(e.key===`ArrowLeft`&&this.multiple&&this._value.length>0){let t=this.inputRef.value;if(t&&t.selectionStart===0&&!t.value){e.preventDefault(),this.focusTag(this._value.length-1);return}}let t=l(e.key,e.shiftKey,this.multiple);if(t&&!(e.key===`Tab`&&!this._isOptionsOpen)){if(t===`focusListbox`&&e.key===`Tab`&&!this.listboxRef.value?.querySelector(`[role="option"]:not([data-disabled]), [data-type="new-option"]`)){this.closeAndProcessInput();return}switch(e.preventDefault(),t){case`addValue`:this.addValue();break;case`focusListbox`:this.listboxRef.value?.focusFirstOrSelectedOption();break;case`closeOptions`:this._isOptionsOpen=!1}}}handleTagRemove(e){this.removeSelected(e),this._hasTextInput&&this.inputRef.value&&(this._inputFocus=!0,this.inputRef.value.focus(),this.requestUpdate())}getInsideTags(){return Array.from(this.querySelectorAll(`.pkt-combobox__input .pkt-combobox__tag-list pkt-tag`))}focusTag(e){let t=this.getInsideTags();t.forEach((t,n)=>{t.buttonTabindex=n===e?0:-1}),(t[e]?.querySelector(`button`))?.focus()}resetTagTabindices(){this.getInsideTags().forEach(e=>{e.buttonTabindex=-1})}handleTagKeydown(e,t){e.stopPropagation();let n=()=>{this.resetTagTabindices(),this._hasTextInput&&this.inputRef.value?this.inputRef.value.focus():this.triggerRef.value?.focus()};switch(e.key){case`ArrowLeft`:e.preventDefault(),t>0&&this.focusTag(t-1);break;case`ArrowRight`:e.preventDefault(),t<this._value.length-1?this.focusTag(t+1):n();break;case`Backspace`:case`Delete`:e.preventDefault();{let e=this._value[t],r=t>=this._value.length-1?t-1:t;this.removeSelected(e),r>=0?(this.requestUpdate(),this.updateComplete.then(()=>this.focusTag(r))):n()}break;case`Tab`:this.resetTagTabindices();break;case`Escape`:e.preventDefault(),n()}}checkForMatches(){let e=d(this.inputRef.value?.value||this._search||``,this._value,this.options,this.allowUserInput,this.multiple);if(e.shouldRemoveValue&&this.removeValue(this._value[0]),e.shouldResetInput){this.resetComboboxInput(!1);return}this._addValueText=e.addValueText,this._userInfoMessage=e.userInfoMessage}},b=class extends y{constructor(...e){super(...e),this.handleBodyClick=e=>{this._isOptionsOpen&&!this.contains(e.target)&&this.closeAndProcessInput()}}connectedCallback(){if(super.connectedCallback(),document?.body.addEventListener(`click`,this.handleBodyClick),this._options=[],this.defaultOptions&&this.defaultOptions.length){let e=this.options?.filter(e=>e.userAdded)||[];this.options=[...e,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if(this.optionsController?.nodes&&this.optionsController.nodes.length){let e=m.parseOptionsFromSlot(this.optionsController.nodes);e.length&&(this.options=[...e],this._options=[...e],this._optionsFromSlot=!0,this._lastSlotGeneration=this.optionsController.generation)}}willUpdate(e){if(this._optionsFromSlot&&this.optionsController){let e=this.optionsController.generation;if(e!==this._lastSlotGeneration){this._lastSlotGeneration=e;let t=m.parseOptionsFromSlot(this.optionsController.nodes),n=this._options.filter(e=>e.userAdded);this.options=[...n,...t]}}super.willUpdate(e)}disconnectedCallback(){super.disconnectedCallback(),document?.body.removeEventListener(`click`,this.handleBodyClick)}firstUpdated(e){this.defaultValue!==null&&!this.value&&(this.value=this.defaultValue),super.firstUpdated(e)}updated(e){e.has(`isOpen`)&&(this._isOptionsOpen=this.isOpen);let t=e.has(`value`),n=e.has(`_value`);if(t&&this._internalValueSync)this._internalValueSync=!1,n&&this.syncValueAndDispatch(e.get(`_value`));else if(t){let e=[...this._value],t=this.parseValue();t.join(`,`)!==this._value.join(`,`)&&(this._value=t,this.options.forEach(e=>e.selected=t.includes(e.value)),this._options.forEach(e=>e.selected=t.includes(e.value)),this._options=[...this._options]),this.updateMaxReached(),this.syncValueAndDispatch(e)}else n&&this.syncValueAndDispatch(e.get(`_value`));if(e.has(`defaultOptions`)&&this.defaultOptions.length){let e=(Array.isArray(this.options)?this.options:[]).filter(e=>e.userAdded)||[];this.options=[...e,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if(e.has(`options`)){let t=e.get(`options`)||this._options||[],n=h.mergeWithUserAdded(this.options,t);this._options=n,n.length>this.options.length&&(this.options=n);let r=h.syncOptionsWithValues(this._options,this._value);if(this._options=r.options,r.newValues.length>this._value.length){let e=[...this._value];this._value=r.newValues,this.syncValueAndDispatch(e)}}if(e.has(`_search`)&&this.dispatchEvent(new CustomEvent(`search`,{detail:this._search,bubbles:!1})),!this._isOptionsOpen&&this._hasTextInput&&this.inputRef.value&&this.inputRef.value.type!==`hidden`){let e=!this.multiple&&this._value[0]?f(this._value[0],this.options,this.displayValueAs):``;this.inputRef.value.value!==e&&(this.inputRef.value.value=e)}this.classList.add(`pkt-combobox-component`),this.classList.toggle(`pkt-combobox-component--fullwidth`,!!this.fullwidth),super.updated(e)}formResetCallback(){this.touched=!1;let e=this.defaultValue||(this.multiple,``);this.value=e,this._value=this.parseValue(),this._options=this._options.filter(e=>!e.userAdded).map(e=>({...e,selected:this._value.includes(e.value)})),this.options=this.options.filter(e=>!e.userAdded).map(e=>({...e,selected:this._value.includes(e.value)})),this._search=``,this._isOptionsOpen=!1,this._userInfoMessage=``,this._addValueText=null,this._inputFocus=!1,this.updateMaxReached(),this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(this.inputRef.value.value=``),this.internals.setFormValue(``),this.internals.ariaInvalid=`false`,this.requestUpdate()}attributeChangedCallback(e,t,n){if(e===`options`){this._options=Array.isArray(this.options)?[...this.options]:[];let e=h.syncOptionsWithValues(this._options,this._value);this._options=e.options,e.newValues.length>this._value.length&&(this._value=e.newValues),this._search=``}super.attributeChangedCallback(e,t,n)}render(){return e._`
|
|
1
|
+
const e=require("./element-DiFhBcIl.cjs"),t=require("./class-map-C33ixq7O.cjs"),n=require("./element-with-slot-CBK4zrdN.cjs");require("./icon-DIavy2cB.cjs");const r=require("./if-defined-Dc3xFDaM.cjs"),i=require("./ref-DZmN5Qgj.cjs");require("./tag-BS6dDPxY.cjs");const a=require("./repeat-DIa_g6WL.cjs"),o=require("./listbox-C5zTRNAO.cjs"),s=require("./input-element-DQY1Rpbp.cjs"),c=require("./pkt-options-controller-BhMNCWcc.cjs");require("./input-wrapper-mJZLVXy_.cjs");var l=(e,t,n)=>{switch(e){case`,`:return n?`addValue`:null;case`Enter`:return`addValue`;case`Tab`:case`ArrowDown`:return t?null:`focusListbox`;case`Escape`:return`closeOptions`;default:return null}},u=(e,t,n,r,i)=>{if(!e)return{action:`none`,value:null};let a=o.i(n,e);return!t.includes(e)&&!a?r?{action:`addUserValue`,value:e}:i?{action:`none`,value:null}:{action:`removeValue`,value:t[0]}:a&&!t.includes(a.value)?{action:`selectOption`,value:a.value}:{action:`none`,value:null}},d=(e,t,n,r,i)=>e.trim().toLowerCase()?{...o.s(e,t,n,r),shouldRemoveValue:!1,shouldResetInput:!1}:{addValueText:null,userInfoMessage:``,shouldRemoveValue:!i&&!!t[0],shouldResetInput:!0},f=(e,t,n)=>{let r=o.i(t,e);return n===`label`&&r?.label?r.label:e},p={markOptionSelected(e,t){if(t){for(let n of e)if(n.value===t){n.selected=!0;break}}},markOptionDeselected(e,t){if(t){for(let n of e)if(n.value===t){n.selected=!1;break}}},markAllSelected(e){for(let t of e)t.selected=!0},markAllDeselected(e){for(let t of e)t.selected=!1},removeUserAddedOptions(e){return e.filter(e=>!e.userAdded)}},m={parseOptionsFromSlot(e){let t=[];return e.forEach(e=>{if(!e.textContent&&!e.getAttribute(`value`))return;let n={value:e.getAttribute(`value`)||e.textContent||``,label:e.textContent||e.getAttribute(`value`)||``};e.getAttribute(`data-prefix`)&&(n.prefix=e.getAttribute(`data-prefix`)||void 0),e.getAttribute(`tagskincolor`)&&(n.tagSkinColor=e.getAttribute(`tagskincolor`)),e.getAttribute(`description`)&&(n.description=e.getAttribute(`description`)||void 0),n.fulltext=o.r(n),t.push(n)}),t}},h={syncOptionsWithValues(e,t){let n=[...t];return e.forEach(e=>{e.value&&!e.label&&(e.label=e.value),e.selected&&!n.includes(e.value)&&n.push(e.value),e.fulltext=o.r(e),e.selected=e.selected||n.includes(e.value)}),{options:e,newValues:n}},mergeWithUserAdded(e,t){return[...t.filter(e=>e?.userAdded&&e.selected).filter(t=>!(Array.isArray(e)?e:[]).some(e=>e.value===t.value)),...e]}},g={name:`pkt-combobox`,react:`PktCombobox`,"css-class":`pkt-combobox`,isElement:!0,isPureReact:!0,props:{name:{type:`string`,name:`Navn`,description:`Navn som brukes i skjema ved innsending`,category:`tech`},id:{type:`string`,name:`ID`,description:`Unik ID for feltet`,category:`tech`},label:{type:`string`,name:`Etikett/label`,description:`Tekst som vises over feltet`,category:`contents`},placeholder:{name:`Hint`,description:`Spesifiserer en kort hint som beskriver forventet verdi av feltet.`,type:`string`,category:`contents`,required:!1},multiple:{type:`boolean`,name:`Flervalg`,default:!1,description:`Mulighet for å velge flere valg`,category:`functionality`},tagPlacement:{attribute:`tag-placement`,type:[`inside`,`outside`],name:`Plassering av tags i flervalg`,description:`Plassering av valgte verdier i feltet ved flervalg`,category:`functionality`,showIf:{multiple:!0}},maxlength:{type:`number`,name:`Maks antall i flervalg`,description:`Maks antall valg dersom flervalg er aktivert`,category:`functionality`,showIf:{multiple:!0}},typeahead:{type:`boolean`,name:`Typeahead`,default:!1,description:`Mulighet for automatisk utfylling av feltet fra listen over valg`,category:`functionality`},includeSearch:{attribute:`include-search`,type:`boolean`,name:`Inkluder søk`,description:`Mulighet for å søke etter valg inni dropdown`,category:`functionality`},allowUserInput:{attribute:`allow-user-input`,type:`boolean`,name:`Brukervalgte verdier`,description:`Mulighet for å skrive inn egne verdier`,category:`functionality`},searchPlaceholder:{attribute:`search-placeholder`,type:`string`,name:`Søke-plassholder`,description:`Plassholdertekst for søkefeltet i dropdown`,category:`contents`,showIf:{includeSearch:!0}},displayValueAs:{attribute:`display-value-as`,type:[`label`,`value`,`prefixAndValue`],name:`Visning av valgt verdi`,description:`Hvordan valgt verdi vises i feltet`,default:`label`,category:`ui`},inputSize:{name:`Størrelse`,description:`Visuell størrelse via input-wrapper. small: kompakt wrapper og felt (42px). xsmall: samme wrapper som small, felt 36px.`,attribute:`input-size`,type:[`small`,`medium`,`xsmall`],default:`medium`,category:`ui`},value:{name:`Verdi`,type:`string`,description:`Valgt verdi. Streng ved enkelt valg, array av strenger ved flervalg.`,category:`tech`},helptext:{type:`string`,name:`Hjelpetekst`,description:`Hjelpetekst som vises over feltet`,category:`contents`},helptextDropdown:{type:`string`,name:`Utvidet hjelpetekst`,description:`Hjelpetekst som vises i en lukket boks man kan åpne`,category:`contents`},helptextDropdownButton:{type:`string`,name:`Knappetekst for hjelpetekst`,description:`Tekst som vises på knappen for å åpne/lukke utvidet hjelpetekst`,category:`contents`,default:`Les mer`},disabled:{type:`boolean`,name:`Deaktivert`,description:`Feltet er deaktivert`,category:`tech`},hasError:{type:`boolean`,name:`Feil`,description:`Feltet har en feil`,category:`ui`},errorMessage:{type:`string`,name:`Feilmelding`,description:`Tekst som vises under feltet ved feil`,category:`contents`},required:{type:`boolean`,name:`Påkrevd`,description:`Feltet må fylles ut`,category:`tech`},requiredTag:{type:`boolean`,name:`Påkrevd-merking`,description:`Viser en merking som indikerer at feltet er påkrevd`,category:`ui`},requiredText:{type:`string`,name:`Påkrevd-tekst`,description:`Tekst som vises i påkrevd-merkingen`,category:`contents`},optionalTag:{type:`boolean`,name:`Valgfritt-merking`,description:`Viser en merking som indikerer at feltet er valgfritt`,category:`ui`},optionalText:{type:`string`,name:`Valgfritt-tekst`,description:`Tekst som vises i valgfritt-merkingen`,category:`contents`},tagText:{type:`string`,name:`Tag-tekst`,description:`Tekst som vises i en tag ved siden av label`,category:`ui`},fullwidth:{type:`boolean`,name:`Full bredde`,description:`Skal feltet ta opp hele bredden?`,category:`ui`},defaultOptions:{attribute:`default-options`,name:`Initielle valg (default options)`,description:`Liste over valg som kan velges, om options sendes inn som array med objekter (denne vil ikke modifiseres ved endring innad i komponenten)`,type:`array`,default:[],previewDefault:[{value:`bfr`,label:`Frogner`},{value:`bgo`,label:`Gamle Oslo`},{value:`bgr`,label:`Grorud`},{value:`bxx`,label:`Andre bydeler`}],items:{type:`object`,properties:{value:{type:`string`,description:`Verdi som sendes ved valg`},label:{type:`string`,description:`Tekst som vises for valget`},prefix:{type:`string`,description:`Tekst som vises før valget`},description:{type:`string`,description:`Beskrivelse av valget`},disabled:{type:`boolean`,description:`Valget er deaktivert`},selected:{type:`boolean`,description:`Valget er valgt`},tagSkinColor:{type:[`blue`,`blue-dark`,`blue-light`,`green`,`red`,`yellow`,`beige`,`gray`,`grey`],description:`Farge på tag`}},required:[`value`]},category:`contents`},options:{name:`Valg`,type:`array`,description:`Liste over valg som kan velges, om options sendes inn som array med objekter`,default:[],items:{type:`object`,properties:{value:{type:`string`,description:`Verdi som sendes ved valg`},label:{type:`string`,description:`Tekst som vises for valget`},prefix:{type:`string`,description:`Tekst som vises før valget`},description:{type:`string`,description:`Beskrivelse av valget`},disabled:{type:`boolean`,description:`Valget er deaktivert`},selected:{type:`boolean`,description:`Valget er valgt`},tagSkinColor:{type:[`blue`,`blue-dark`,`blue-light`,`green`,`red`,`yellow`,`beige`,`gray`,`grey`],description:`Farge på tag`}},required:[`value`]},category:`contents`},inline:{name:`Inline`,type:`boolean`,required:!1,default:!1,description:`Angir om feltet skal flyte med teksten`,category:`ui`},useWrapper:{name:`Bruk wrapper`,type:`boolean`,required:!1,displayAsFalse:!0,default:!0,description:`Indikerer om skjemaelementet skal bruke en wrapper`,category:`ui`},hasFieldset:{name:`Bruk fieldset`,type:`boolean`,required:!1,default:null,description:`Bruk fieldset og legend i stedet for label. Utledes automatisk når feltet ikke har en input.`,category:`ui`},counter:{name:`Teller`,type:`boolean`,required:!1,default:null,description:`Viser teller under feltet. Slås på av seg selv når det finnes en grense å telle mot; sett til false for å skru den av.`,category:`ui`}},events:{change:{type:`Event`,description:`Returnerer valgt verdi som streng. Ved flervalg returneres kommaseparerte verdier.`},"value-change":{type:`CustomEvent`,description:`Returnerer valgt verdi. Ved enkeltvalg en streng, ved flervalg en <code>string[]</code>.`},search:{type:`CustomEvent`,description:`Returnerer søketeksten som streng i <code>event.detail</code> når brukeren skriver i søkefeltet`},toggleHelpText:{type:`CustomEvent`,description:`Returnerer <code>event.detail { isOpen: true }</code> eller <code>event.detail { isOpen: false }</code> når hjelpeteksten åpnes eller lukkes`}}},_=class extends s.t{constructor(){super(),this.value=``,this.options=[],this.defaultOptions=[],this.allowUserInput=!1,this.typeahead=!1,this.includeSearch=!1,this.searchPlaceholder=``,this.multiple=!1,this.maxlength=null,this.displayValueAs=g.props.displayValueAs.default,this.tagPlacement=null,this.isOpen=!1,this._options=[],this._value=[],this._isOptionsOpen=!1,this._userInfoMessage=``,this._addValueText=null,this._maxIsReached=!1,this._search=``,this._inputFocus=!1,this._internalValueSync=!1,this._optionsFromSlot=!1,this._lastSlotGeneration=0,this._suppressNextOpen=!1,this.inputRef=i.t(),this.triggerRef=i.t(),this.listboxRef=i.t(),this.optionsController=new c.t(this)}get _hasTextInput(){return this.typeahead||this.allowUserInput}get _selectionDescription(){if(!(!this.multiple||this._value.length===0))return`${this._value.length} valgt`}focusTrigger(){this._hasTextInput?this.inputRef.value?.focus():this.triggerRef.value?.focus()}parseValue(){return Array.isArray(this.value)?this.multiple?this.value:this.value.length>0?[this.value[0]]:[]:this.value&&this.multiple?this.value.split(`,`):this.value?[this.value]:[]}updateMaxReached(){this._maxIsReached=o.c(this._value.length,this.maxlength)}syncValueAndDispatch(e){let t=this._value,n=this.multiple?t.join(`,`):t[0]||``;if(n!==(Array.isArray(this.value)?this.value.join(`,`):String(this.value||``))&&(this._internalValueSync=!0,this.value=n),e?.join(`,`)!==t.join(`,`)){let e=this.multiple?[...t]:t[0]||``;this.onChange(e)}else t.length===0&&e&&e.length>0&&this.clearInputValue()}onChange(e){this.touched=!0,super.onChange(e)}valueChanged(){}};e.n([e.u({type:String,reflect:!0})],_.prototype,`value`,void 0),e.n([e.u({type:Array})],_.prototype,`options`,void 0),e.n([e.u({type:Array,attribute:`default-options`})],_.prototype,`defaultOptions`,void 0),e.n([e.u({type:Boolean,attribute:`allow-user-input`})],_.prototype,`allowUserInput`,void 0),e.n([e.u({type:Boolean})],_.prototype,`typeahead`,void 0),e.n([e.u({type:Boolean,attribute:`include-search`})],_.prototype,`includeSearch`,void 0),e.n([e.u({type:String,attribute:`search-placeholder`})],_.prototype,`searchPlaceholder`,void 0),e.n([e.u({type:Boolean})],_.prototype,`multiple`,void 0),e.n([e.u({type:Number})],_.prototype,`maxlength`,void 0),e.n([e.u({type:String,attribute:`display-value-as`})],_.prototype,`displayValueAs`,void 0),e.n([e.u({type:String,attribute:`tag-placement`})],_.prototype,`tagPlacement`,void 0),e.n([e.u({type:Boolean,attribute:`open`})],_.prototype,`isOpen`,void 0),e.n([e.l()],_.prototype,`_options`,void 0),e.n([e.l()],_.prototype,`_value`,void 0),e.n([e.l()],_.prototype,`_isOptionsOpen`,void 0),e.n([e.l()],_.prototype,`_userInfoMessage`,void 0),e.n([e.l()],_.prototype,`_addValueText`,void 0),e.n([e.l()],_.prototype,`_maxIsReached`,void 0),e.n([e.l()],_.prototype,`_search`,void 0),e.n([e.l()],_.prototype,`_inputFocus`,void 0);var v=class extends _{toggleValue(e){if(this.disabled)return;this.touched=!0,this._userInfoMessage=``,this._addValueText=null;let t=o.i(this.options,e)?.value||null,n=this._value.includes(e||t||``),r=!!t,i=this._options.find(t=>t.value===e)?.disabled||!1,a=!e?.trim(),s=!this.multiple,c=this.multiple,l=o.c(this._value.length,this.maxlength),u=!1,d=!0,f=``,p=``;i||(!r&&this.allowUserInput&&!a?(this.addNewUserValue(e),f=`valueAdded`,u=c):!r&&!this.allowUserInput?(s&&this._value[0]&&this.removeValue(this._value[0]),d=!1,u=!0,f=`noResults`):n?(this.removeValue(t),u=!0,s&&this._hasTextInput&&this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(this.inputRef.value.value=``)):a&&s?(this.removeAllSelected(),u=!0):s?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(t),u=!1):c&&!l?(this.setSelected(t),u=!0):c&&l?(f=`maxSelected`,d=!1,p=e):(s&&this.removeAllSelected(),f=`noValidValue`,d=!1,u=!0,p=e),this._isOptionsOpen=u,u||(s&&this._hasTextInput&&(this._suppressNextOpen=!0),window.setTimeout(()=>{this.focusTrigger()},0)),this._userInfoMessage=f,this._search=p||``,this.resetComboboxInput(d),c&&this.updateMaxReached())}setSelected(e){if(!this._value.includes(e)){if(this.multiple&&o.c(this._value.length,this.maxlength)){this._userInfoMessage=`maxSelected`;return}!this.multiple&&this.removeAllSelected(),this._value=e?[...this._value,e]:this._value,p.markOptionSelected(this._options,e),this.resetComboboxInput(!0)}}removeSelected(e){if(!e)return;this._value=this._value.filter(t=>t!==e);let t=o.i(this.options,e);t&&(p.markOptionDeselected(this.options,e),t.userAdded?(this._options=[...this._options.filter(t=>t.value!==e)],this.options=[...this.options.filter(t=>t.value!==e)]):this._options.some(t=>t.value===e)||(this._options=[...this._options,t]))}addAllOptions(){if(this.multiple){if(this.maxlength&&this._options.length>this.maxlength){this._userInfoMessage=`tooManySelected`;return}this._value=this._options.map(e=>e.value),p.markAllSelected(this._options),this.requestUpdate()}}removeAllSelected(){this._value=[],p.markAllDeselected(this._options),this._options=p.removeUserAddedOptions(this._options),this.requestUpdate()}addValue(){let e=this.inputRef.value?.value.trim()||``;if(this._search=e,e&&this._value.includes(e)){this.resetComboboxInput(!0),this._userInfoMessage=`alreadySelected`;return}this.toggleValue(e)}removeValue(e){this._value=this.multiple?this._value.filter(t=>t!==e):[],this.removeSelected(e)}addNewUserValue(e){if(!e||e.trim()===``)return;if(!this.multiple)this._value[0]&&this.removeSelected(this._value[0]),this._value=[e];else if(!o.i(this.options,e)){if(o.c(this._value.length,this.maxlength))return;this._value=[...this._value,e]}let t={value:e,label:e,userAdded:!0,selected:!0};this.options=[t,...this.options],this._options=[t,...this._options],this.resetComboboxInput(!0),this.multiple||(this._isOptionsOpen=!1,this._hasTextInput&&(this._suppressNextOpen=!0),window.setTimeout(()=>{this.focusTrigger()},0)),this.requestUpdate()}resetComboboxInput(e=!0){this._addValueText=null,this.inputRef.value&&this.inputRef.value.type!==`hidden`&&e&&(this._search=``,this.multiple?this.inputRef.value.value=``:(this.inputRef.value.value=this._value[0]?f(this._value[0],this.options,this.displayValueAs):``,this._userInfoMessage=``)),this._options=[...this.options]}removeLastValue(e){if(this._value.length===0)return;e.preventDefault();let t=this._value[this._value.length-1];t&&this.removeSelected(t),this.updateMaxReached()}},y=class extends v{handleInput(e){if(e.stopPropagation(),e.stopImmediatePropagation(),this.disabled)return;this.touched=!0;let t=e.target;if(this._search=t.value,this.checkForMatches(),this.typeahead){if(this._search){let{filtered:n,suggestion:r}=o.o(this.options,this._search);this._options=n,e.inputType!==`deleteContentBackward`&&r?.label&&this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(t.value=r.label,window.setTimeout(()=>t.setSelectionRange(this._search.length,t.value.length),0),t.selectionDirection=`backward`)}else this._options=[...this.options]}}handleFocus(){if(!this.disabled){if(this._suppressNextOpen){this._suppressNextOpen=!1,this._inputFocus=!0,this.requestUpdate();return}!this.multiple&&this._value[0]&&this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(this.inputRef.value.value=f(this._value[0],this.options,this.displayValueAs)),this._inputFocus=!0,this._search=``,this._options=[...this.options],this._isOptionsOpen=!0,this.onFocus(),this.requestUpdate()}}handleFocusOut(e){if(this.disabled||!this._isOptionsOpen)return;let t=e.relatedTarget;t?.closest(`pkt-combobox`)?.id!==this.id&&e.target?.getAttribute(`data-focusfix`)!==this.id&&t!==this.inputRef.value&&t!==this.triggerRef.value&&this.closeAndProcessInput()}closeAndProcessInput(){if(this._inputFocus=!1,this._addValueText=null,this._userInfoMessage=``,this._search=``,this.inputRef.value&&this.inputRef.value.type!==`hidden`){let e=this.inputRef.value.value;if(!this.multiple){if(!e)this._value[0]&&this.removeSelected(this._value[0]);else{let t=o.i(this.options,e);t&&t.value!==this._value[0]?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(t.value)):!t&&this.allowUserInput&&(this._value[0]&&this.removeSelected(this._value[0]),this.addNewUserValue(e))}}else if(e!==``){let{action:t,value:n}=u(e,this._value,this.options,this.allowUserInput,this.multiple);switch(t){case`addUserValue`:this.addNewUserValue(n);break;case`selectOption`:this.setSelected(n);break;case`removeValue`:this.removeValue(n)}}!this.multiple&&this._value[0]?this.inputRef.value.value=f(this._value[0],this.options,this.displayValueAs):this.inputRef.value.value=``}this._isOptionsOpen=!1,this.onBlur()}handleBlur(){this._inputFocus=!1,this.onBlur()}handleInputClick(e){if(this.disabled){e.preventDefault(),e.stopImmediatePropagation();return}this._hasTextInput?(this.inputRef.value?.focus(),this.requestUpdate()):(e.stopImmediatePropagation(),e.preventDefault(),this._isOptionsOpen=!this._isOptionsOpen,this._isOptionsOpen&&this.listboxRef.value?.focusFirstOrSelectedOption())}handlePlaceholderClick(e){this.disabled||(e.stopPropagation(),this._hasTextInput&&this.inputRef.value?(this.inputRef.value.focus(),this._inputFocus=!0,this.requestUpdate()):(this._isOptionsOpen=!this._isOptionsOpen,this.requestUpdate()))}handleSelectOnlyKeydown(e){if(!this.disabled)switch(e.key){case`Enter`:case` `:case`ArrowDown`:case`ArrowUp`:e.preventDefault(),this._isOptionsOpen?this._isOptionsOpen=!1:(this._isOptionsOpen=!0,this.listboxRef.value?.focusFirstOrSelectedOption());break;case`Escape`:this._isOptionsOpen&&=(e.preventDefault(),!1);break;case`Home`:case`End`:e.preventDefault(),this._isOptionsOpen||=!0,this.listboxRef.value?.focusFirstOrSelectedOption();break;case`ArrowLeft`:this.multiple&&this._value.length>0&&(e.preventDefault(),this.focusTag(this._value.length-1));break;case`Backspace`:case`Delete`:this.multiple&&this._value.length>0&&(e.preventDefault(),this.removeSelected(this._value[this._value.length-1]))}}handleOptionToggled(e){this.toggleValue(e.detail)}handleSearch(e){e.stopPropagation(),this._search=e.detail.toLowerCase(),this.checkForMatches()}handleInputKeydown(e){if(e.key===`Backspace`){let t=!this.inputRef.value?.value;!this._search&&t&&this.multiple&&this._value.length>0&&this.removeLastValue(e);return}if(e.key===`ArrowLeft`&&this.multiple&&this._value.length>0){let t=this.inputRef.value;if(t&&t.selectionStart===0&&!t.value){e.preventDefault(),this.focusTag(this._value.length-1);return}}let t=l(e.key,e.shiftKey,this.multiple);if(t&&!(e.key===`Tab`&&!this._isOptionsOpen)){if(t===`focusListbox`&&e.key===`Tab`&&!this.listboxRef.value?.querySelector(`[role="option"]:not([data-disabled]), [data-type="new-option"]`)){this.closeAndProcessInput();return}switch(e.preventDefault(),t){case`addValue`:this.addValue();break;case`focusListbox`:this.listboxRef.value?.focusFirstOrSelectedOption();break;case`closeOptions`:this._isOptionsOpen=!1}}}handleTagRemove(e){this.removeSelected(e),this._hasTextInput&&this.inputRef.value&&(this._inputFocus=!0,this.inputRef.value.focus(),this.requestUpdate())}getInsideTags(){return Array.from(this.querySelectorAll(`.pkt-combobox__input .pkt-combobox__tag-list pkt-tag`))}focusTag(e){let t=this.getInsideTags();t.forEach((t,n)=>{t.buttonTabindex=n===e?0:-1}),(t[e]?.querySelector(`button`))?.focus()}resetTagTabindices(){this.getInsideTags().forEach(e=>{e.buttonTabindex=-1})}handleTagKeydown(e,t){e.stopPropagation();let n=()=>{this.resetTagTabindices(),this._hasTextInput&&this.inputRef.value?this.inputRef.value.focus():this.triggerRef.value?.focus()};switch(e.key){case`ArrowLeft`:e.preventDefault(),t>0&&this.focusTag(t-1);break;case`ArrowRight`:e.preventDefault(),t<this._value.length-1?this.focusTag(t+1):n();break;case`Backspace`:case`Delete`:e.preventDefault();{let e=this._value[t],r=t>=this._value.length-1?t-1:t;this.removeSelected(e),r>=0?(this.requestUpdate(),this.updateComplete.then(()=>this.focusTag(r))):n()}break;case`Tab`:this.resetTagTabindices();break;case`Escape`:e.preventDefault(),n()}}checkForMatches(){let e=d(this.inputRef.value?.value||this._search||``,this._value,this.options,this.allowUserInput,this.multiple);if(e.shouldRemoveValue&&this.removeValue(this._value[0]),e.shouldResetInput){this.resetComboboxInput(!1);return}this._addValueText=e.addValueText,this._userInfoMessage=e.userInfoMessage}},b=class extends y{constructor(...e){super(...e),this.handleBodyClick=e=>{this._isOptionsOpen&&!this.contains(e.target)&&this.closeAndProcessInput()}}connectedCallback(){if(super.connectedCallback(),document?.body.addEventListener(`click`,this.handleBodyClick),this._options=[],this.defaultOptions&&this.defaultOptions.length){let e=this.options?.filter(e=>e.userAdded)||[];this.options=[...e,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if(this.optionsController?.nodes&&this.optionsController.nodes.length){let e=m.parseOptionsFromSlot(this.optionsController.nodes);e.length&&(this.options=[...e],this._options=[...e],this._optionsFromSlot=!0,this._lastSlotGeneration=this.optionsController.generation)}}willUpdate(e){if(this._optionsFromSlot&&this.optionsController){let e=this.optionsController.generation;if(e!==this._lastSlotGeneration){this._lastSlotGeneration=e;let t=m.parseOptionsFromSlot(this.optionsController.nodes),n=this._options.filter(e=>e.userAdded);this.options=[...n,...t]}}super.willUpdate(e)}disconnectedCallback(){super.disconnectedCallback(),document?.body.removeEventListener(`click`,this.handleBodyClick)}firstUpdated(e){this.defaultValue!==null&&!this.value&&(this.value=this.defaultValue),super.firstUpdated(e)}updated(e){e.has(`isOpen`)&&(this._isOptionsOpen=this.isOpen);let t=e.has(`value`),n=e.has(`_value`);if(t&&this._internalValueSync)this._internalValueSync=!1,n&&this.syncValueAndDispatch(e.get(`_value`));else if(t){let e=[...this._value],t=this.parseValue();t.join(`,`)!==this._value.join(`,`)&&(this._value=t,this.options.forEach(e=>e.selected=t.includes(e.value)),this._options.forEach(e=>e.selected=t.includes(e.value)),this._options=[...this._options]),this.updateMaxReached(),this.syncValueAndDispatch(e)}else n&&this.syncValueAndDispatch(e.get(`_value`));if(e.has(`defaultOptions`)&&this.defaultOptions.length){let e=(Array.isArray(this.options)?this.options:[]).filter(e=>e.userAdded)||[];this.options=[...e,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if(e.has(`options`)){let t=e.get(`options`)||this._options||[],n=h.mergeWithUserAdded(this.options,t);this._options=n,n.length>this.options.length&&(this.options=n);let r=h.syncOptionsWithValues(this._options,this._value);if(this._options=r.options,r.newValues.length>this._value.length){let e=[...this._value];this._value=r.newValues,this.syncValueAndDispatch(e)}}if(e.has(`_search`)&&this.dispatchEvent(new CustomEvent(`search`,{detail:this._search,bubbles:!1})),!this._isOptionsOpen&&this._hasTextInput&&this.inputRef.value&&this.inputRef.value.type!==`hidden`){let e=!this.multiple&&this._value[0]?f(this._value[0],this.options,this.displayValueAs):``;this.inputRef.value.value!==e&&(this.inputRef.value.value=e)}this.classList.add(`pkt-combobox-component`),this.classList.toggle(`pkt-combobox-component--fullwidth`,!!this.fullwidth),super.updated(e)}formResetCallback(){this.touched=!1;let e=this.defaultValue||(this.multiple,``);this.value=e,this._value=this.parseValue(),this._options=this._options.filter(e=>!e.userAdded).map(e=>({...e,selected:this._value.includes(e.value)})),this.options=this.options.filter(e=>!e.userAdded).map(e=>({...e,selected:this._value.includes(e.value)})),this._search=``,this._isOptionsOpen=!1,this._userInfoMessage=``,this._addValueText=null,this._inputFocus=!1,this.updateMaxReached(),this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(this.inputRef.value.value=``),this.internals.setFormValue(``),this.internals.ariaInvalid=`false`,this.requestUpdate()}attributeChangedCallback(e,t,n){if(e===`options`){this._options=Array.isArray(this.options)?[...this.options]:[];let e=h.syncOptionsWithValues(this._options,this._value);this._options=e.options,e.newValues.length>this._value.length&&(this._value=e.newValues),this._search=``}super.attributeChangedCallback(e,t,n)}render(){return e._`
|
|
2
2
|
<pkt-input-wrapper
|
|
3
3
|
.strings=${this.strings}
|
|
4
4
|
.size=${this.inputSize}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { _ as e, d as t, h as n, l as r, n as i, u 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 "./tag-
|
|
8
|
-
import { t as d } from "./repeat-
|
|
9
|
-
import { a as f, c as p, i as m, o as h, r as g, s as _ } from "./listbox-
|
|
10
|
-
import { t as v } from "./input-element-
|
|
11
|
-
import { t as y } from "./pkt-options-controller-
|
|
12
|
-
import "./input-wrapper-
|
|
1
|
+
import { _ as e, d as t, h as n, l as r, n as i, u as a } from "./element-WEzISABa.js";
|
|
2
|
+
import { t as o } from "./class-map-wh4Yi3oj.js";
|
|
3
|
+
import { n as s } from "./element-with-slot-BKYUx4gb.js";
|
|
4
|
+
import "./icon-DEtOSWRK.js";
|
|
5
|
+
import { t as c } from "./if-defined-BmnvvxtR.js";
|
|
6
|
+
import { n as l, t as u } from "./ref-OU8ryfP6.js";
|
|
7
|
+
import "./tag-Azkjhkeu.js";
|
|
8
|
+
import { t as d } from "./repeat-Dx2H127b.js";
|
|
9
|
+
import { a as f, c as p, i as m, o as h, r as g, s as _ } from "./listbox-C8ooO8qZ.js";
|
|
10
|
+
import { t as v } from "./input-element-IBypGOaV.js";
|
|
11
|
+
import { t as y } from "./pkt-options-controller-CuQ6SClv.js";
|
|
12
|
+
import "./input-wrapper-CQgAL1Br.js";
|
|
13
13
|
//#region ../../shared-utils/combobox/input-utils.ts
|
|
14
14
|
var b = (e, t, n) => {
|
|
15
15
|
switch (e) {
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
-
import { TAccordionSkin } from '../../shared-types';
|
|
2
|
+
import { IPktAccordionBase, TAccordionSkin } from '../../shared-types';
|
|
3
3
|
export type TPktAccordionSkin = TAccordionSkin;
|
|
4
|
-
export interface IPktAccordion {
|
|
5
|
-
compact?: boolean;
|
|
6
|
-
skin?: TPktAccordionSkin;
|
|
7
|
-
ariaLabelledBy?: string;
|
|
8
|
-
name?: string;
|
|
4
|
+
export interface IPktAccordion extends IPktAccordionBase {
|
|
9
5
|
}
|
|
10
6
|
export declare class PktAccordion extends LitElement implements IPktAccordion {
|
|
11
7
|
ariaLabelledBy: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PktElementWithSlot } from '../../base-elements/element-with-slot';
|
|
2
2
|
import { PropertyValues } from 'lit';
|
|
3
3
|
import { Ref } from 'lit/directives/ref.js';
|
|
4
|
+
import { IPktAccordionItemBase } from '../../shared-types';
|
|
4
5
|
import { TPktAccordionSkin } from './accordion';
|
|
5
6
|
/**
|
|
6
7
|
* @param toggleProps
|
|
@@ -8,14 +9,7 @@ import { TPktAccordionSkin } from './accordion';
|
|
|
8
9
|
* @description Send in an "isOpen" boolean and "onToggleClick" function
|
|
9
10
|
* to override the automatic toggling
|
|
10
11
|
*/
|
|
11
|
-
export interface IPktAccordionItem {
|
|
12
|
-
defaultOpen?: boolean;
|
|
13
|
-
id: string;
|
|
14
|
-
title: string;
|
|
15
|
-
skin?: TPktAccordionSkin;
|
|
16
|
-
compact?: boolean;
|
|
17
|
-
isOpen?: boolean;
|
|
18
|
-
name?: string | undefined;
|
|
12
|
+
export interface IPktAccordionItem extends IPktAccordionItemBase {
|
|
19
13
|
}
|
|
20
14
|
export declare class PktAccordionItem extends PktElementWithSlot implements IPktAccordionItem {
|
|
21
15
|
defaultOpen: boolean;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { PropertyValues } from 'lit';
|
|
2
2
|
import { PktElementWithSlot } from '../../base-elements/element-with-slot';
|
|
3
|
-
import { TAriaLive, TAlertSkin } from '../../shared-types';
|
|
3
|
+
import { TAriaLive, TAlertSkin, TAlertSize } from '../../shared-types';
|
|
4
|
+
import { IPktStringsProps } from '../../shared-strings';
|
|
4
5
|
export type { TAlertSkin };
|
|
5
|
-
export interface IPktAlert {
|
|
6
|
+
export interface IPktAlert extends IPktStringsProps<'alert' | 'generic'> {
|
|
6
7
|
skin?: TAlertSkin;
|
|
7
8
|
closeAlert?: boolean;
|
|
8
9
|
title?: string;
|
|
@@ -13,9 +14,9 @@ export interface IPktAlert {
|
|
|
13
14
|
*/
|
|
14
15
|
compact?: boolean;
|
|
15
16
|
role?: string;
|
|
16
|
-
size?:
|
|
17
|
+
size?: TAlertSize;
|
|
17
18
|
}
|
|
18
|
-
export declare class PktAlert extends PktElementWithSlot implements IPktAlert {
|
|
19
|
+
export declare class PktAlert extends PktElementWithSlot<IPktAlert> implements IPktAlert {
|
|
19
20
|
constructor();
|
|
20
21
|
compact: boolean;
|
|
21
22
|
title: string;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { PktElement } from '../../base-elements/element';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
text?: string;
|
|
5
|
-
ariaLabel?: string;
|
|
2
|
+
import { IPktBackLinkBase } from '../../shared-types';
|
|
3
|
+
export interface IPktBackLink extends IPktBackLinkBase {
|
|
6
4
|
}
|
|
7
5
|
export declare class PktBackLink extends PktElement<IPktBackLink> implements IPktBackLink {
|
|
8
6
|
href: string;
|
|
9
7
|
text: string;
|
|
10
|
-
|
|
8
|
+
/** @deprecated Bruk `strings={{ backlink: { label: '…' } }}` eller `setPktStrings()`. */
|
|
9
|
+
ariaLabel: string | null;
|
|
11
10
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
12
11
|
render(): import('lit-html').TemplateResult<1>;
|
|
13
12
|
}
|
|
@@ -2,7 +2,7 @@ import { BaseTestConfig } from '../../tests/test-framework';
|
|
|
2
2
|
export interface BacklinkTestConfig extends BaseTestConfig {
|
|
3
3
|
href?: string;
|
|
4
4
|
text?: string;
|
|
5
|
-
ariaLabel?: string;
|
|
5
|
+
ariaLabel?: string | null;
|
|
6
6
|
}
|
|
7
7
|
export declare const createBacklinkTest: (config?: BacklinkTestConfig) => Promise<{
|
|
8
8
|
container: HTMLElement;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { nothing } from 'lit';
|
|
2
2
|
import { PktElement } from '../../base-elements/element';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { IBreadcrumb, IPktBreadcrumbsBase } from '../../shared-types';
|
|
4
|
+
export type { IBreadcrumb };
|
|
5
|
+
/** @deprecated Use `IBreadcrumb`. */
|
|
6
|
+
export type IBreadcrumbItem = IBreadcrumb;
|
|
7
|
+
export interface IPktBreadcrumbs extends IPktBreadcrumbsBase {
|
|
6
8
|
}
|
|
7
|
-
export
|
|
8
|
-
breadcrumbs:
|
|
9
|
-
}
|
|
10
|
-
export declare class PktBreadcrumbs extends PktElement implements IPktBreadcrumbs {
|
|
11
|
-
breadcrumbs: IBreadcrumbItem[];
|
|
9
|
+
export declare class PktBreadcrumbs extends PktElement<IPktBreadcrumbs> implements IPktBreadcrumbs {
|
|
10
|
+
breadcrumbs: IBreadcrumb[];
|
|
12
11
|
private handleLinkClick;
|
|
13
12
|
render(): typeof nothing | import('lit-html').TemplateResult<1>;
|
|
14
13
|
}
|
|
@@ -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';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PropertyValues, TemplateResult } from 'lit';
|
|
2
2
|
import { PktElement } from '../../base-elements/element';
|
|
3
|
-
|
|
3
|
+
import { IPktStringsProps } from '../../shared-strings';
|
|
4
|
+
export declare class PktCalendar extends PktElement<IPktStringsProps<'dates' | 'calendar'>> {
|
|
4
5
|
selected: string | string[];
|
|
5
6
|
multiple: boolean;
|
|
6
7
|
maxMultiple: number;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Ref } from 'lit/directives/ref.js';
|
|
2
2
|
import { PktInputElement } from '../../base-elements/input-element';
|
|
3
3
|
import { IPktComboboxOption, TPktComboboxTagPlacement } from './combobox-types';
|
|
4
|
+
import { IPktStringsProps } from '../../shared-strings';
|
|
4
5
|
import { default as PktListbox } from '../listbox';
|
|
5
6
|
import { TComboboxMessageKey } from '../../shared-utils/combobox';
|
|
6
7
|
/**
|
|
7
8
|
* Base class for PktCombobox.
|
|
8
9
|
* Declares all reactive properties, state, refs, and simple helpers.
|
|
9
10
|
*/
|
|
10
|
-
export declare class ComboboxBase extends PktInputElement {
|
|
11
|
+
export declare class ComboboxBase extends PktInputElement<IPktStringsProps<'combobox' | 'listbox'>> {
|
|
11
12
|
constructor();
|
|
12
13
|
value: string | string[];
|
|
13
14
|
options: IPktComboboxOption[];
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { PropertyValues } from 'lit';
|
|
2
2
|
import { IPktComboboxOption, TPktComboboxTagPlacement } from './combobox-types';
|
|
3
3
|
import { ComboboxHandlers } from './combobox-handlers';
|
|
4
|
+
import { IPktStringsProps } from '../../shared-strings';
|
|
4
5
|
export type { IPktComboboxOption, TPktComboboxTagPlacement } from './combobox-types';
|
|
5
|
-
export interface IPktCombobox {
|
|
6
|
+
export interface IPktCombobox extends IPktStringsProps<'combobox' | 'listbox'> {
|
|
6
7
|
allowUserInput?: boolean;
|
|
7
8
|
typeahead?: boolean;
|
|
8
9
|
disabled?: boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PktElement } from '../../base-elements/element';
|
|
2
|
+
import { IPktStringsProps } from '../../shared-strings';
|
|
2
3
|
type TYear = `${number}${number}${number}${number}`;
|
|
3
4
|
type TMonth = `${number}${number}`;
|
|
4
5
|
type TDay = `${number}${number}`;
|
|
@@ -10,7 +11,7 @@ export type TISODate = `${TYear}-${TMonth}-${TDay}`;
|
|
|
10
11
|
* Følger denne unicode-standarden:
|
|
11
12
|
* https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
12
13
|
*/
|
|
13
|
-
export declare class PktDateTags extends PktElement {
|
|
14
|
+
export declare class PktDateTags extends PktElement<IPktStringsProps<'datepicker'>> {
|
|
14
15
|
dates: TISODate[];
|
|
15
16
|
dateformat: string;
|
|
16
17
|
className: string;
|
|
@@ -7,7 +7,8 @@ import { PktDatepickerSingle } from './datepicker-single';
|
|
|
7
7
|
import { PktDatepickerRange } from './datepicker-range';
|
|
8
8
|
import { PktDatepickerMultiple } from './datepicker-multiple';
|
|
9
9
|
import { ElementProps } from '../../types/typeUtils';
|
|
10
|
-
|
|
10
|
+
import { IPktStringsProps } from '../../shared-strings';
|
|
11
|
+
type Props = ElementProps<PktDatepicker, 'label' | 'dateformat' | 'multiple' | 'maxlength' | 'range' | 'showRangeLabels' | 'min' | 'max' | 'weeknumbers' | 'withcontrols' | 'excludedates' | 'excludeweekdays' | 'currentmonth' | 'calendarOpen' | 'timezone'> & IPktStringsProps<'generic' | 'datepicker' | 'dates' | 'calendar'>;
|
|
11
12
|
export declare class PktDatepicker extends PktInputElement<Props> {
|
|
12
13
|
/**
|
|
13
14
|
* Element attributes and properties
|
|
@@ -13,7 +13,8 @@ export declare abstract class PktFileUploadBase extends PktElement<IPktFileUploa
|
|
|
13
13
|
/** Expandable help text (dropdown) shown by `pkt-input-wrapper`. */
|
|
14
14
|
helptextDropdown: string;
|
|
15
15
|
/** Button label for expandable help text. */
|
|
16
|
-
|
|
16
|
+
/** @deprecated Bruk `strings={{ forms: { readMore: '…' } }}` eller `setPktStrings()`. */
|
|
17
|
+
helptextDropdownButton?: string;
|
|
17
18
|
/** Mark input as required in form strategy. */
|
|
18
19
|
required: boolean;
|
|
19
20
|
/** Allow selecting/dropping multiple files. */
|
|
@@ -60,7 +61,8 @@ export declare abstract class PktFileUploadBase extends PktElement<IPktFileUploa
|
|
|
60
61
|
/** Show "Må fylles ut" tag in the input wrapper. */
|
|
61
62
|
requiredTag: boolean;
|
|
62
63
|
/** Label text for the required tag. */
|
|
63
|
-
|
|
64
|
+
/** @deprecated Bruk `strings={{ forms: { required: '…' } }}` eller `setPktStrings()`. */
|
|
65
|
+
requiredText?: string;
|
|
64
66
|
/** Extra tag next to the label. */
|
|
65
67
|
tagText: string | null;
|
|
66
68
|
/** Trailing characters to keep when middle-truncating long filenames. Set to `0` to disable. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TemplateResult } from 'lit';
|
|
2
|
-
import { IFileItem, IFileTransfer, IFileValidateDetail, IFilesChangedDetail, ITransferCancelledDetail, TFilesChangedReason, TFileUploadItemRenderer, TFileValidator, TFileUploadStrategy, TTransferProgress } from '../../shared-types';
|
|
2
|
+
import { IFileItem, IFileTransfer, IFileValidateDetail, IFilesChangedDetail, IPktFileUploadBase, ITransferCancelledDetail, TFilesChangedReason, TFileUploadItemRenderer, TFileValidator, TFileUploadStrategy, TTransferProgress } from '../../shared-types';
|
|
3
3
|
export type TUploadStrategy = TFileUploadStrategy;
|
|
4
4
|
export type { TFileUploadItemRenderer, TFilesChangedReason, TFileValidator, TTransferProgress };
|
|
5
5
|
export type TFileValidateDetail = IFileValidateDetail;
|
|
@@ -32,49 +32,11 @@ export type TQueueItemOperation = {
|
|
|
32
32
|
renderContent?: (context: TQueueOperationContext) => TemplateResult | null;
|
|
33
33
|
renderHidden?: (context: TQueueOperationContext) => TemplateResult | null;
|
|
34
34
|
};
|
|
35
|
-
export interface IPktFileUpload {
|
|
36
|
-
id?: string;
|
|
35
|
+
export interface IPktFileUpload extends Omit<IPktFileUploadBase, 'extraOperations' | 'name'> {
|
|
37
36
|
name?: string;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
helptextDropdown?: string;
|
|
42
|
-
/** Button label for expandable help text. */
|
|
43
|
-
helptextDropdownButton?: string;
|
|
44
|
-
required?: boolean;
|
|
45
|
-
multiple?: boolean;
|
|
46
|
-
disabled?: boolean;
|
|
47
|
-
fullwidth?: boolean;
|
|
48
|
-
uploadStrategy?: TUploadStrategy;
|
|
49
|
-
itemRenderer?: TFileUploadItemRenderer;
|
|
37
|
+
/** Custom element id — required for `uploadStrategy="custom"`. */
|
|
38
|
+
id?: string;
|
|
39
|
+
/** HTML `accept` attribute on the native file input. */
|
|
50
40
|
accept?: string;
|
|
51
|
-
allowedFormats?: string[];
|
|
52
|
-
formatErrorMessage?: string;
|
|
53
|
-
maxFileSize?: string | number;
|
|
54
|
-
sizeErrorMessage?: string;
|
|
55
|
-
onFileValidation?: TFileValidator;
|
|
56
|
-
/** External error state (combined with internal validation errors). */
|
|
57
|
-
hasError?: boolean;
|
|
58
|
-
/** External error message shown under the component. */
|
|
59
|
-
errorMessage?: string;
|
|
60
|
-
/** Show "Valgfritt" tag in input-wrapper. */
|
|
61
|
-
optionalTag?: boolean;
|
|
62
|
-
/** Label text for the optional tag. */
|
|
63
|
-
optionalText?: string;
|
|
64
|
-
/** Show "Må fylles ut" tag in input-wrapper. */
|
|
65
|
-
requiredTag?: boolean;
|
|
66
|
-
/** Label text for the required tag. */
|
|
67
|
-
requiredText?: string;
|
|
68
|
-
/** Extra tag next to the label. */
|
|
69
|
-
tagText?: string | null;
|
|
70
|
-
/** Trailing characters to keep when truncating long filenames. */
|
|
71
|
-
truncateTail?: number;
|
|
72
|
-
/** Transfer states keyed by `fileId` (custom strategy progress/error/cancel rendering). */
|
|
73
|
-
transfers?: TFileTransfer[];
|
|
74
|
-
addCommentsEnabled?: boolean;
|
|
75
|
-
renameFilesEnabled?: boolean;
|
|
76
41
|
extraOperations?: TQueueItemOperation[];
|
|
77
|
-
enableImagePreview?: boolean;
|
|
78
|
-
value?: FileItem[];
|
|
79
|
-
defaultValue?: FileItem[];
|
|
80
42
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PktIconName } from '@oslokommune/punkt-assets/dist/icons/icon';
|
|
2
2
|
import { booleanishConverter, Booleanish, User as SharedUser, Representing as SharedRepresenting, UserMenuItem as SharedUserMenuItem, TInternalMenuItem as SharedTInternalMenuItem, TSlotMenuVariant, THeaderMenu, TLogOutButtonPlacement, THeaderPosition, THeaderScrollBehavior, THeaderFooterApi, THeaderMenuLocale, IPktHeaderGlobal as ISharedPktHeaderGlobal } from '../../shared-types';
|
|
3
|
+
import { IPktStringsProps } from '../../shared-strings';
|
|
3
4
|
export type { Booleanish, TSlotMenuVariant, THeaderMenu, TLogOutButtonPlacement, THeaderPosition, THeaderScrollBehavior, THeaderFooterApi, THeaderMenuLocale, };
|
|
4
5
|
/** Which header variant `<pkt-header>` renders. */
|
|
5
6
|
export type THeaderType = 'service' | 'global';
|
|
@@ -17,7 +18,7 @@ export declare const convertUserMenuItem: (item: UserMenuItem) => TInternalMenuI
|
|
|
17
18
|
/**
|
|
18
19
|
* Interface for the Header component props
|
|
19
20
|
*/
|
|
20
|
-
export interface IPktHeader {
|
|
21
|
+
export interface IPktHeader extends IPktStringsProps<'header'> {
|
|
21
22
|
/** Hide the Oslo logo */
|
|
22
23
|
hideLogo?: Booleanish;
|
|
23
24
|
/** Logo link URL */
|
|
@@ -73,7 +74,7 @@ export interface IPktHeader {
|
|
|
73
74
|
* `userMenu` icons as `PktIconName`, and adding the Lit-only `hasLogOut`
|
|
74
75
|
* signal.
|
|
75
76
|
*/
|
|
76
|
-
export interface IPktHeaderGlobal extends Omit<ISharedPktHeaderGlobal, 'showSearch' | 'showContact' | 'canChangeRepresentation' | 'userMenu'> {
|
|
77
|
+
export interface IPktHeaderGlobal extends Omit<ISharedPktHeaderGlobal, 'showSearch' | 'showContact' | 'canChangeRepresentation' | 'userMenu'>, IPktStringsProps<'header'> {
|
|
77
78
|
/** Show the search field. Default: true */
|
|
78
79
|
showSearch?: Booleanish;
|
|
79
80
|
/** Show the contact link (from the payload's `header.contact`). Default: true */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PktElementWithSlot } from '../../base-elements/element-with-slot';
|
|
2
|
-
|
|
2
|
+
import { IPktStringsProps } from '../../shared-strings';
|
|
3
|
+
export declare class PktHelptext extends PktElementWithSlot<IPktStringsProps<'forms'>> {
|
|
3
4
|
forId: string;
|
|
4
5
|
helptext: string;
|
|
5
6
|
helptextDropdown: string;
|
|
@@ -44,7 +44,7 @@ export type { TTagSkin, TTagType } from './tag';
|
|
|
44
44
|
export type { IPktTabs, IPktTabItem, TSkin as TTabItemSkin } from './tabs';
|
|
45
45
|
export type { IPktSelectOption, TSelectOption } from './select';
|
|
46
46
|
export type { IPktBackLink } from './backlink';
|
|
47
|
-
export type { IPktBreadcrumbs, IBreadcrumbItem } from './breadcrumbs';
|
|
47
|
+
export type { IPktBreadcrumbs, IBreadcrumb, IBreadcrumbItem } from './breadcrumbs';
|
|
48
48
|
export type { IPktLoader, TPktLoaderVariant } from './loader';
|
|
49
49
|
export type { IPktConsent } from './consent';
|
|
50
50
|
export type { IPktFooter, IPktFooterSimple, IPktFooterColumn, IPktFooterLink, } from './footer';
|
|
@@ -52,4 +52,4 @@ export type { FileItem, IPktFileUpload, TFileComment, TQueueItemOperation, TQueu
|
|
|
52
52
|
export type { IPktTimepicker } from './timepicker';
|
|
53
53
|
export type { IPktSearchInput, IPktSearchInputSuggestion, TPktSearchInputAppearance, TPktSearchInputMethod, } from './searchinput';
|
|
54
54
|
export { getPktStrings, nb as pktStringsNb, resetPktStrings, setPktStrings, subscribePktStrings, } from '../shared-strings';
|
|
55
|
-
export type { TPktStrings, TPktStringsNamespace, TPktStringsOverride } from '../shared-strings';
|
|
55
|
+
export type { TPktStrings, TPktStringsNamespace, TPktStringsOverride, IPktStringsProps } from '../shared-strings';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { PktElementWithSlot } from '../../base-elements/element-with-slot';
|
|
2
|
+
import { IPktStringsProps } from '../../shared-strings';
|
|
2
3
|
import { PropertyValues } from 'lit';
|
|
3
4
|
import { ElementProps } from '../../types/typeUtils';
|
|
4
5
|
import { Booleanish } from '../../shared-types';
|
|
5
6
|
import { FocusModalityController } from '../../controllers/focus-modality-controller';
|
|
6
7
|
type TCounterPosition = 'top' | 'bottom';
|
|
7
8
|
type TInputWrapperSize = 'small' | 'medium' | 'xsmall';
|
|
8
|
-
type Props = ElementProps<PktInputWrapper, 'forId' | 'label' | 'helptext' | 'helptextDropdown' | 'helptextDropdownButton' | 'counter' | 'counterCurrent' | 'counterMaxLength' | 'optionalTag' | 'optionalText' | 'requiredTag' | 'requiredText' | 'tagText' | 'hasError' | 'errorMessage' | 'disabled' | 'inline' | 'ariaDescribedby' | 'hasFieldset' | 'useWrapper' | 'role'>;
|
|
9
|
+
type Props = ElementProps<PktInputWrapper, 'forId' | 'label' | 'helptext' | 'helptextDropdown' | 'helptextDropdownButton' | 'counter' | 'counterCurrent' | 'counterMaxLength' | 'optionalTag' | 'optionalText' | 'requiredTag' | 'requiredText' | 'tagText' | 'hasError' | 'errorMessage' | 'disabled' | 'inline' | 'ariaDescribedby' | 'hasFieldset' | 'useWrapper' | 'role'> & IPktStringsProps<'forms' | 'validation'>;
|
|
9
10
|
export declare class PktInputWrapper extends PktElementWithSlot<Props> {
|
|
10
11
|
/**
|
|
11
12
|
* Element attributes
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { PropertyValues } from 'lit';
|
|
2
2
|
import { PktElement } from '../../base-elements/element';
|
|
3
3
|
import { IPktComboboxOption } from '../../shared-types/combobox';
|
|
4
|
+
import { IPktStringsProps } from '../../shared-strings';
|
|
4
5
|
declare global {
|
|
5
6
|
interface HTMLElementTagNameMap {
|
|
6
7
|
'pkt-listbox': PktListbox;
|
|
7
8
|
}
|
|
8
9
|
}
|
|
9
|
-
export interface IPktListbox {
|
|
10
|
+
export interface IPktListbox extends IPktStringsProps<'listbox'> {
|
|
10
11
|
options: IPktComboboxOption[];
|
|
11
12
|
isOpen: boolean;
|
|
12
13
|
disabled: boolean;
|
|
@@ -20,7 +21,7 @@ export interface IPktListbox {
|
|
|
20
21
|
maxLength: number;
|
|
21
22
|
userMessage: string | null;
|
|
22
23
|
}
|
|
23
|
-
export declare class PktListbox extends PktElement implements IPktListbox {
|
|
24
|
+
export declare class PktListbox extends PktElement<IPktListbox> implements IPktListbox {
|
|
24
25
|
id: string;
|
|
25
26
|
label: string | null;
|
|
26
27
|
options: IPktComboboxOption[];
|
|
@@ -3,9 +3,10 @@ import { PktElementWithSlot } from '../../base-elements/element-with-slot';
|
|
|
3
3
|
import { TPktSize } from '../../types/size';
|
|
4
4
|
import { IAriaAttributes, THTMLButtonType } from '../../shared-types';
|
|
5
5
|
import { PktIconName } from '@oslokommune/punkt-assets/dist/icons/icon';
|
|
6
|
+
import { IPktStringsProps } from '../../shared-strings';
|
|
6
7
|
export type TTagSkin = 'blue' | 'blue-dark' | 'blue-light' | 'green' | 'red' | 'yellow' | 'beige' | 'gray' | 'grey';
|
|
7
8
|
export type TTagType = THTMLButtonType;
|
|
8
|
-
export interface IPktTag {
|
|
9
|
+
export interface IPktTag extends IPktStringsProps<'tag'> {
|
|
9
10
|
closeTag?: boolean;
|
|
10
11
|
size?: TPktSize;
|
|
11
12
|
skin?: TTagSkin;
|
|
@@ -2,8 +2,9 @@ import { PropertyValues } from 'lit';
|
|
|
2
2
|
import { Ref } from 'lit/directives/ref.js';
|
|
3
3
|
import { PktInputElement } from '../../base-elements/input-element';
|
|
4
4
|
import { ElementProps } from '../../types/typeUtils';
|
|
5
|
+
import { IPktStringsProps } from '../../shared-strings';
|
|
5
6
|
import { TPktInputSize } from '../../shared-types/size';
|
|
6
|
-
type Props = ElementProps<PktTimepicker, 'value' | 'hidePicker' | 'stepArrows'>;
|
|
7
|
+
type Props = ElementProps<PktTimepicker, 'value' | 'hidePicker' | 'stepArrows'> & IPktStringsProps<'timepicker'>;
|
|
7
8
|
export interface IPktTimepicker {
|
|
8
9
|
value?: string;
|
|
9
10
|
min?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-DiFhBcIl.cjs");require("./button-CF3dNKeI.cjs");var t={i18n:{nb:{contentPresentation:{title:`Oslo kommune bruker informasjonskapsler`,description:[`For at nettstedet skal fungere og være trygt, bruker Oslo kommune informasjonskapsler. Noen er teknisk nødvendige, mens andre sikrer ulik funksjonalitet.`,`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.`],buttons:{accept:`Godta alle`,reject:`Kun nødvendige`,settings:`Innstillinger for informasjonskapsler`}},contentSettings:{title:`Innstillinger for informasjonskapsler`,description:[`Her kan du velge hvilke typer informasjonskapsler du vil tillate. Tillatelsen gjelder i 90 dager. Husk at nødvendige informasjonskapsler ikke kan velges bort.`,`Du kan når som helst endre innstillingene og finne mer informasjon nederst på nettstedet under «Innstillinger for informasjonskapsler» og «Personvern og informasjonskapsler».`],buttons:{back:`Tilbake`,save:`Lagre innstillinger`}}},en:{contentPresentation:{title:`Before you visit Oslo kommune ...`,description:[`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.`,`To read more about what we use cookies for, go to our privacy declaration which you will find at the bottom of our websites.`],buttons:{accept:`Yes, I accept`,reject:`Only necessary`,settings:`Go to settings`}},contentSettings:{title:`Her kan du aktivt velge mellom ulike informasjonskapsler`,description:[`For å lese mer om hva vi bruker informasjonskapsler til gå til vår personvernserklering som du finner på våre nettsider`],buttons:{back:`Back`,save:`Save settings`}}}},cookies:[{name:`statistics`,defaultValue:null,i18n:{nb:{title:`Statistikk og analyse`,description:`Jeg godtar at Oslo kommune bruker informasjonskapsler til å innhente data om statistikk og brukeradferd.`,buttons:{yes:`Ja`,no:`Nei`}},en:{title:`Statistics and analytics`,description:`Select your preference for statistics and analytics`,buttons:{yes:`Yes`,no:`No`}}}},{name:`survey`,defaultValue:null,i18n:{nb:{title:`Skriftlige tilbakemeldinger`,description:`Jeg godtar at Oslo kommune bruker informasjonskapsler til å vise responsfelt og registrere tilbakemeldinger.`,buttons:{yes:`Ja`,no:`Nei`}},en:{title:`Survey`,description:`Select your preference for survey`,buttons:{yes:`Yes`,no:`No`}}}},{name:`functional`,defaultValue:!0,i18n:{nb:{title:`Funksjonelle informasjonskapsler`,description:`Jeg godtar at Oslo kommune bruker informasjonskapsler for å gjøre ulike funksjoner på nettstedet mulige (for eksempel skjemaer og barnehagevelger).`,buttons:{yes:`Ja`,no:`Nei`}},en:{title:`Functional cookies`,description:`For the website to function optimally, we recommend that you accept these cookies`,buttons:{yes:`Yes`,no:`No`}}}}]},n=null;function r(){return n||(n=new Promise((e,t)=>{if(document.querySelector(`#oslo-consent-script`)){e();return}let n=document.createElement(`script`);n.src=`https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.js`,n.id=`oslo-consent-script`,n.onload=()=>e(),n.onerror=t,document.head.appendChild(n);let r=document.createElement(`link`);r.href=`https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.css`,r.type=`text/css`,r.rel=`stylesheet`,r.id=`oslo-consent-styles`,document.head.appendChild(r)}),n)}var i=e=>{if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}},a=e=>i(e.value).items.reduce((e,t)=>(e[t.name]=t.consent,e),{}),o=class extends e.t{constructor(...e){super(...e),this.devMode=!1,this.hotjarId=null,this.googleAnalyticsId=null,this.cookieDomain=null,this.cookieSecure=null,this.cookieExpiryDays=null,this.triggerType=`button`,this.triggerText=null,this.i18nLanguage=`nb`}connectedCallback(){super.connectedCallback();let e=this.i18nLanguage;this.triggerText=this.triggerText||t.i18n[e].contentPresentation.buttons.settings}disconnectedCallback(){super.disconnectedCallback(),this._cookieEventHandler&&window.__cookieEvents?.off(`CookieManager.setCookie`,this._cookieEventHandler)}returnJsonOrObject(e){return i(e)}emitCookieConsents(e){this.dispatchEvent(new CustomEvent(`toggle-consent`,{detail:a(e),bubbles:!0,cancelable:!1}))}async firstUpdated(e){window.cookieBanner_googleAnalyticsId=this.googleAnalyticsId,window.cookieBanner_hotjarId=this.hotjarId,this.cookieDomain&&(window.cookieBanner_cookieDomain=this.cookieDomain),this.cookieSecure&&(window.cookieBanner_cookieSecure=this.cookieSecure),this.cookieExpiryDays&&(window.cookieBanner_cookieExpiryDays=this.cookieExpiryDays),this.devMode&&(window.cookieBanner_devMode=this.devMode),await r(),this.triggerInit()}triggerInit(){window.document.dispatchEvent(new Event(`CookieBannerReady`,{bubbles:!0,cancelable:!0}));let e=window.cookieBanner,t=window.__cookieEvents;!e||!t||e.cookieConsent.validateConsentCookie().then(n=>{if(!n)return;let r=e.cookieConsent.getConsentCookie();window.setTimeout(()=>this.emitCookieConsents({value:r}),0),this._cookieEventHandler&&t.off(`CookieManager.setCookie`,this._cookieEventHandler),this._cookieEventHandler=e=>this.emitCookieConsents(e),t.on(`CookieManager.setCookie`,this._cookieEventHandler)})}openModal(e){e.preventDefault(),window.cookieBanner?.cookieConsent||this.triggerInit(),setTimeout(()=>window.cookieBanner?.openCookieModal())}render(){return this.triggerType===`link`?e._`<a href="#" class="pkt-link" aria-haspopup="dialog" @click=${this.openModal}
|
|
2
2
|
>${this.triggerText}</a
|
|
3
3
|
>`:this.triggerType===`footerlink`?e._`<a
|
|
4
4
|
href="#"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as e, d as t, n, t as r, u as i } from "./element-
|
|
2
|
-
import "./button-
|
|
1
|
+
import { _ as e, d as t, n, t as r, u as i } from "./element-WEzISABa.js";
|
|
2
|
+
import "./button-C1CQSASU.js";
|
|
3
3
|
//#region ../../shared-strings/consent.ts
|
|
4
4
|
var a = {
|
|
5
5
|
i18n: {
|