@oslokommune/punkt-elements 17.0.9 → 17.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/{accordion-DEUHQ4JD.js → accordion-DZq8Dnvh.js} +5 -5
- package/dist/{accordion-CbXDxOho.cjs → accordion-DlNfuooe.cjs} +1 -1
- package/dist/{alert-CbtVGrHD.js → alert-CbN5Bfdd.js} +5 -5
- package/dist/{alert-CkUnbPdA.cjs → alert-D7YR5Ru2.cjs} +1 -1
- package/dist/{async-directive-HLXOyE4A.cjs → async-directive-Cj6po9Zy.cjs} +1 -1
- package/dist/{async-directive-Cw_7VW_-.js → async-directive-DaiMzAU4.js} +2 -2
- package/dist/{backlink-DDGlLzk9.cjs → backlink-CxSKQSoA.cjs} +1 -1
- package/dist/{backlink-wMNLuQ0X.js → backlink-eAD8xH5b.js} +3 -3
- package/dist/base-elements/input-element.d.ts +9 -4
- package/dist/booleanish-BF8l4scU.cjs +1 -0
- package/dist/{booleanish-MfutDT_4.js → booleanish-OQJTYSrw.js} +8 -1
- package/dist/{breadcrumbs-CVTLNNsL.js → breadcrumbs-CJP75InB.js} +2 -2
- package/dist/{breadcrumbs-D3tfWqvC.cjs → breadcrumbs-CYKfjd4Q.cjs} +1 -1
- package/dist/{button-Cod17rKo.js → button-D_M6dpeU.js} +5 -5
- package/dist/{button-gvDXtBMC.cjs → button-o0BRKpis.cjs} +1 -1
- package/dist/{calendar-BVXW8DqC.cjs → calendar-7_ii5p5b.cjs} +1 -1
- package/dist/{calendar-CjC4qlh6.js → calendar-BCUnpa_x.js} +3 -3
- package/dist/{card-sydjK3Bb.cjs → card-Cf_jOdya.cjs} +1 -1
- package/dist/{card-sDOe54um.js → card-KB9C2f1R.js} +7 -7
- package/dist/{checkbox-DJDphhqz.js → checkbox-C2eVUk13.js} +4 -4
- package/dist/{checkbox-8uxbeU30.cjs → checkbox-Ch23npOC.cjs} +1 -1
- package/dist/{class-map-CAQCRB1W.js → class-map-BRV7-mcj.js} +1 -1
- package/dist/{class-map-CCZN5uS3.cjs → class-map-DzzW3MwB.cjs} +1 -1
- package/dist/combobox-Db1fB0K7.cjs +139 -0
- package/dist/{combobox-CzZIf5hd.js → combobox-dSWHF8Ii.js} +50 -14
- package/dist/components/fileupload/fileupload.d.ts +2 -0
- package/dist/components/input-wrapper/tri-state.test.d.ts +0 -0
- package/dist/components/input-wrapper/wrapper-parity.test.d.ts +1 -0
- package/dist/components/select/select.test.d.ts +2 -2
- package/dist/components/textarea/textarea.d.ts +2 -1
- package/dist/components/textarea/textarea.test.d.ts +2 -2
- package/dist/components/textinput/textinput.test.d.ts +2 -2
- package/dist/{consent--Nw43WFU.cjs → consent-C57oumuq.cjs} +1 -1
- package/dist/{consent-B2hSTCGC.js → consent-CibGBVvV.js} +2 -2
- package/dist/{datepicker-DrB54Rhc.cjs → datepicker-Ci6Oj0YL.cjs} +6 -7
- package/dist/{datepicker-BMuplkDE.js → datepicker-D9Qr98VO.js} +39 -16
- package/dist/{directive-helpers-DIF5DwN4.js → directive-helpers-BXtu2yHt.js} +1 -1
- package/dist/{directive-helpers-BshFvt7A.cjs → directive-helpers-CEtfS19L.cjs} +1 -1
- package/dist/docs/components/verifisering.d.ts +15 -0
- package/dist/{element-BoJrqauR.js → element-8RsANDBG.js} +2 -1
- package/dist/{element-DJzurxgt.cjs → element-DCm4GU7z.cjs} +1 -1
- package/dist/{element-with-slot-mXLg8gg8.js → element-with-slot-DFNWwYys.js} +2 -2
- package/dist/{element-with-slot-BY7Jc-q8.cjs → element-with-slot-N79a3tub.cjs} +1 -1
- package/dist/{fileupload-D4gQN64T.js → fileupload-D008usH2.js} +11 -8
- package/dist/{fileupload-CGKUJrlj.cjs → fileupload-DtAujY-k.cjs} +2 -2
- package/dist/{footer-BIrJeRuZ.js → footer-05rSMBWl.js} +5 -5
- package/dist/{footer-Ber-jqM1.cjs → footer-DmBOxk43.cjs} +1 -1
- package/dist/{header-BFk1an4z.cjs → header-Dd8_GxXA.cjs} +1 -1
- package/dist/{header-Deg_LGJo.js → header-iug8KwEF.js} +12 -12
- package/dist/{header-menu-GFtJKM4j.js → header-menu-CcXQsag0.js} +5 -5
- package/dist/{header-menu-BHqK4QA6.cjs → header-menu-DEMDRByb.cjs} +1 -1
- package/dist/{heading-DyJpBFT2.cjs → heading-DbLmrGyU.cjs} +1 -1
- package/dist/{heading-CD0PhL8g.js → heading-V-gyod7_.js} +2 -2
- package/dist/{helptext-C_brWCIT.js → helptext-BFGNgeqw.js} +8 -5
- package/dist/{helptext-Cq5rNaAC.cjs → helptext-CpaW9Zwl.cjs} +4 -1
- package/dist/{icon-DGFEIlco.js → icon-8ZKcRaGi.js} +1 -1
- package/dist/{icon-B8PVq2O6.cjs → icon-BlJZpl2L.cjs} +1 -1
- package/dist/{if-defined-D0bnetLJ.js → if-defined-DfH9X3nd.js} +1 -1
- package/dist/if-defined-h7sbeYue.cjs +1 -0
- package/dist/{input-element-B0qLbEdF.cjs → input-element-CmFzbxiZ.cjs} +1 -1
- package/dist/{input-element-C0RnXi-J.js → input-element-DPXwOJeT.js} +147 -123
- package/dist/input-wrapper-CohL8Onb.cjs +54 -0
- package/dist/input-wrapper-CrJMQj_L.js +122 -0
- package/dist/{input-wrapper-BweP6t3O.js → input-wrapper-D-fPaTbY.js} +2 -2
- package/dist/{input-wrapper-wh3fWIhk.cjs → input-wrapper-D5PR0rJn.cjs} +1 -1
- package/dist/{link-Geze7498.cjs → link-BQXhsaBM.cjs} +1 -1
- package/dist/{link-FmkQvSQL.js → link-C-0YV0XX.js} +4 -4
- package/dist/{linkcard-6LCXRTR-.cjs → linkcard-BN34yjcT.cjs} +1 -1
- package/dist/{linkcard-BKdT0zU_.js → linkcard-DGHxt0ef.js} +4 -4
- package/dist/{listbox-LdyWPu7W.js → listbox-CMLqAc5-.js} +4 -4
- package/dist/{listbox-89wMuQVK.cjs → listbox-CgjhUALC.cjs} +1 -1
- package/dist/{loader-BA-i8CaQ.js → loader-CxcWuAB7.js} +4 -4
- package/dist/{loader-CgW4Vst3.cjs → loader-DFWbjQV5.cjs} +1 -1
- package/dist/{messagebox-VD5oEZ19.cjs → messagebox-D0kz1ic4.cjs} +1 -1
- package/dist/{messagebox-fiaAyHLG.js → messagebox-DvlF8XbD.js} +4 -4
- package/dist/{modal-CPnFteYS.cjs → modal-BQcORqnQ.cjs} +1 -1
- package/dist/{modal-xNK_wpHk.js → modal-C9pamgry.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-CPrfqepu.cjs → pkt-options-controller-DeyC9FDP.cjs} +1 -1
- package/dist/{pkt-options-controller-DMxYwnnj.js → pkt-options-controller-sblvLBnq.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-mtjtbpCO.js → progressbar-DtmVoP1j.js} +4 -4
- package/dist/{progressbar-BN5y20CC.cjs → progressbar-fnJJsQkh.cjs} +1 -1
- package/dist/{radiobutton-DjWBoSHv.cjs → radiobutton-CGT4kJSf.cjs} +1 -1
- package/dist/{radiobutton-C6htwDrT.js → radiobutton-DZHVyjoe.js} +4 -4
- package/dist/{ref-DO7TzO4O.cjs → ref-CYXJQuCZ.cjs} +1 -1
- package/dist/{ref-WGS0u7i2.js → ref-CkGzlsAX.js} +2 -2
- package/dist/{repeat-DRnLAg0O.cjs → repeat-C_7HwdFQ.cjs} +1 -1
- package/dist/{repeat-BH0cL82q.js → repeat-CwZAKBjZ.js} +2 -2
- package/dist/{searchinput-DGjeN1YI.cjs → searchinput-1CESdZO9.cjs} +1 -1
- package/dist/{searchinput-CfUVfpqL.js → searchinput-Dw1LAHgD.js} +4 -4
- package/dist/{select-CsBXXbLP.js → select-Cb8RH7lk.js} +24 -20
- package/dist/select-Duav6lVT.cjs +49 -0
- package/dist/shared-types/booleanish.d.ts +11 -0
- package/dist/shared-types/index.d.ts +1 -1
- package/dist/shared-utils/forms/described-by.d.ts +24 -0
- package/dist/{tabs-q62MK_-r.cjs → tabs-A665GUTo.cjs} +1 -1
- package/dist/{tabs-BqrKLCjd.js → tabs-BV4w4QfM.js} +4 -4
- package/dist/{tag-XE-VRxT2.cjs → tag-DaRo48qb.cjs} +1 -1
- package/dist/{tag-BTiTXyf5.js → tag-rb23IBFT.js} +5 -5
- package/dist/textarea-bLTy-JGg.cjs +49 -0
- package/dist/{textarea-Cm392CEI.js → textarea-nyH0_IkD.js} +35 -28
- package/dist/{textinput-TSPcBcih.js → textinput-B5Gk13OB.js} +30 -25
- package/dist/{textinput-DqJbTglM.cjs → textinput-D3bL7BTc.cjs} +10 -10
- package/dist/{timepicker-DWbgTDKq.js → timepicker-BH9yjtLA.js} +18 -11
- package/dist/{timepicker-CqFYMV8q.cjs → timepicker-lv-CQ8of.cjs} +5 -2
- package/dist/translations/no.json.d.ts +2 -1
- package/package.json +2 -2
- package/src/components/combobox/combobox.core.test.ts +2 -2
- package/src/components/combobox/combobox.ts +7 -1
- package/src/components/datepicker/datepicker-single.ts +1 -1
- package/src/components/datepicker/datepicker.ts +5 -3
- package/src/components/fileupload/fileupload.ts +6 -1
- package/src/components/helptext/helptext.ts +3 -0
- package/src/components/input-wrapper/input-wrapper.test.ts +3 -3
- package/src/components/input-wrapper/input-wrapper.ts +31 -29
- package/src/components/input-wrapper/tri-state.test.ts +91 -0
- package/src/components/input-wrapper/wrapper-parity.test.ts +141 -0
- package/src/components/select/select.test.ts +8 -7
- package/src/components/select/select.ts +13 -5
- package/src/components/textarea/textarea.test.ts +6 -6
- package/src/components/textarea/textarea.ts +20 -11
- package/src/components/textinput/textinput.test.ts +6 -6
- package/src/components/textinput/textinput.ts +17 -11
- package/src/components/timepicker/timepicker.ts +12 -5
- package/dist/booleanish-B9Kf0nES.cjs +0 -1
- package/dist/combobox-BH9lym0-.cjs +0 -136
- package/dist/if-defined-DrwbxQOj.cjs +0 -1
- package/dist/input-wrapper-DPkkiG7S.cjs +0 -57
- package/dist/input-wrapper-fWV5P4MN.js +0 -126
- package/dist/select-CZvAW7W2.cjs +0 -50
- package/dist/textarea-sTcZxOIB.cjs +0 -47
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,24 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [17.1.0](https://github.com/oslokommune/punkt/compare/17.0.10...17.1.0) (2026-08-24)
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
Ingen
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
* Opprydding i stiler og tilgjengelighet for skjemaelementer (#3602).
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
Ingen
|
|
19
|
+
|
|
20
|
+
### Chores
|
|
21
|
+
Ingen
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
|
|
8
26
|
## [17.0.9](https://github.com/oslokommune/punkt/compare/17.0.8...17.0.9) (2026-08-18)
|
|
9
27
|
|
|
10
28
|
### ⚠ BREAKING CHANGES
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as e, i as t, n, o as r, p as i, s as a } from "./element-
|
|
2
|
-
import { t as o } from "./class-map-
|
|
3
|
-
import { n as s, t as c } from "./element-with-slot-
|
|
4
|
-
import { t as l } from "./if-defined-
|
|
1
|
+
import { a as e, i as t, n, o as r, p as i, s as a } from "./element-8RsANDBG.js";
|
|
2
|
+
import { t as o } from "./class-map-BRV7-mcj.js";
|
|
3
|
+
import { n as s, t as c } from "./element-with-slot-DFNWwYys.js";
|
|
4
|
+
import { t as l } from "./if-defined-DfH9X3nd.js";
|
|
5
5
|
import { n as u, r as d, t as f } from "./consume-BiOhrhEy.js";
|
|
6
|
-
import { n as p, t as m } from "./ref-
|
|
6
|
+
import { n as p, t as m } from "./ref-CkGzlsAX.js";
|
|
7
7
|
//#region src/components/accordion/accordion-context.ts
|
|
8
8
|
var h = d(Symbol("pkt-accordion-context")), g = class extends t {
|
|
9
9
|
constructor(...e) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-DCm4GU7z.cjs"),t=require("./class-map-DzzW3MwB.cjs"),n=require("./element-with-slot-N79a3tub.cjs"),r=require("./if-defined-h7sbeYue.cjs"),i=require("./consume-DKf5SmP9.cjs"),a=require("./ref-CYXJQuCZ.cjs");var o=i.r(Symbol(`pkt-accordion-context`)),s=class extends e.i{constructor(...e){super(...e),this.ariaLabelledBy=``,this.compact=!1,this.skin=`borderless`,this.name=``,this.context={skin:this.skin}}willUpdate(e){e.has(`skin`)&&(this.context={...this.context,skin:this.skin})}updated(e){e.has(`name`)&&this.updateAccordionItemNames()}updateAccordionItemNames(){if(this.name){let e=this.renderRoot?.querySelector(`slot`);e&&e.assignedElements().forEach(e=>{e.tagName.toLowerCase()===`pkt-accordion-item`&&(e.hasAttribute(`name`)||e.setAttribute(`name`,this.name))})}}firstUpdated(){let e=this.renderRoot?.querySelector(`slot`);e&&e.addEventListener(`slotchange`,()=>{this.updateAccordionItemNames()})}render(){return e.p`
|
|
2
2
|
<div
|
|
3
3
|
part="container"
|
|
4
4
|
class=${t.t({"pkt-accordion":!0,"pkt-accordion--compact":this.compact,[`pkt-accordion--${this.skin}`]:this.skin})}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as e, d as t, n, o as r, p as i, s as a } from "./element-
|
|
2
|
-
import { t as o } from "./class-map-
|
|
3
|
-
import { n as s, t as c } from "./element-with-slot-
|
|
1
|
+
import { a as e, d as t, n, o as r, p as i, s as a } from "./element-8RsANDBG.js";
|
|
2
|
+
import { t as o } from "./class-map-BRV7-mcj.js";
|
|
3
|
+
import { n as s, t as c } from "./element-with-slot-DFNWwYys.js";
|
|
4
4
|
import { t as l } from "./classutils-DcYnSgfc.js";
|
|
5
|
-
import "./icon-
|
|
6
|
-
import "./button-
|
|
5
|
+
import "./icon-8ZKcRaGi.js";
|
|
6
|
+
import "./button-D_M6dpeU.js";
|
|
7
7
|
var u = {
|
|
8
8
|
name: "pkt-alert",
|
|
9
9
|
react: "PktAlert",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-DCm4GU7z.cjs"),t=require("./class-map-DzzW3MwB.cjs"),n=require("./element-with-slot-N79a3tub.cjs"),r=require("./classutils-CbklAJDe.cjs");require("./icon-BlJZpl2L.cjs"),require("./button-o0BRKpis.cjs");var i={name:`pkt-alert`,react:`PktAlert`,"css-class":`pkt-alert`,"dark-mode":!0,isElement:!0,isPureReact:!0,events:{onClose:{description:`React: Klikk-event for 'Lukk'-knappen`},close:{description:`Vue: Klikk-event for 'Lukk'-knappen`}},props:{title:{name:`Tittel`,description:`Tittelen som vises øverst i på meldingen`,type:`string`,category:`contents`},skin:{name:`Utseende`,description:`Hvordan type melding er dette?`,type:[`info`,`success`,`warning`,`error`],default:`info`,category:`ui`},date:{name:`Sist oppdatert`,description:`Dato som vises nederst i på meldingen`,type:`string`,category:`contents`},ariaLive:{name:`aria-live`,description:`Hvordan skal skjermleseren lese opp meldingen?`,type:[`off`,`polite`,`assertive`],default:`polite`,category:`accessibility`},size:{name:`Størrelse`,description:`Endrer størrelsen på ulike elementer i alerten.`,type:[`medium`,`small`,`xsmall`],default:`medium`,category:`ui`},closeAlert:{name:`Vis 'Lukk'-knapp`,description:`Viser 'Lukk'-knappen`,type:`boolean`,default:!1,category:`ui`}},slots:{default:{description:`Innholdet i meldingen`}},deprecated:{compact:{name:`Kompakt (deprecated)`,description:`Bruk size i stedet; uten eksplisitt size gir compact størrelsen 'small'.`,type:`boolean`,category:`ui`,default:!1}}},a=class extends n.t{constructor(){super(),this.compact=i.deprecated.compact.default,this.title=``,this.skin=i.props.skin.default,this.ariaLive=i.props.ariaLive.default,this.ariaLiveAttr=null,this.closeAlert=i.props.closeAlert.default,this.date=null,this.role=`status`,this._isClosed=!1,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent(`close`,{detail:{origin:e},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`on-close`,{detail:{origin:e},bubbles:!0,composed:!0}))},this._isClosed=!1}connectedCallback(){super.connectedCallback(),this.ariaLiveAttr=this.getAttribute(`aria-live`)||this.ariaLive}attributeChangedCallback(e,t,n){e===`ariaLive`&&(this.ariaLiveAttr=n),super.attributeChangedCallback(e,t,n)}updated(e){super.updated(e),e.has(`ariaLive`)&&(this.ariaLiveAttr=this.ariaLive),e.has(`_isClosed`)&&r.t(this,`pkt-hide`,this._isClosed)}render(){let r=this.size??(this.compact?`small`:`medium`),i={"pkt-alert":!0,[`pkt-alert--${r}`]:!0,[`pkt-alert--${this.skin}`]:!0,"pkt-hide":this._isClosed},a={"pkt-alert__grid":!0,"pkt-alert__noTitle":!this.title,"pkt-alert__noDate":!this.date};return e.p`
|
|
2
2
|
<div class=${t.t(i)} aria-live=${this.ariaLiveAttr}>
|
|
3
3
|
<div class=${t.t(a)}>
|
|
4
4
|
<pkt-icon
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-DCm4GU7z.cjs"),t=require("./directive-helpers-CEtfS19L.cjs");var n=(e,t)=>{let r=e._$AN;if(r===void 0)return!1;for(let e of r)e._$AO?.(t,!1),n(e,t);return!0},r=e=>{let t,n;do{if((t=e._$AM)===void 0)break;n=t._$AN,n.delete(e),e=t}while(n?.size===0)},i=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(n===void 0)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),s(t)}};function a(e){this._$AN===void 0?this._$AM=e:(r(this),this._$AM=e,i(this))}function o(e,t=!1,i=0){let a=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(t)if(Array.isArray(a))for(let e=i;e<a.length;e++)n(a[e],!1),r(a[e]);else a!=null&&(n(a,!1),r(a));else n(this,e)}var s=t=>{t.type==e.u.CHILD&&(t._$AP??=o,t._$AQ??=a)},c=class extends e.l{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),i(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(n(this,e),r(this))}setValue(e){if(t.i(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return c}});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as e, u as t } from "./element-
|
|
2
|
-
import { i as n } from "./directive-helpers-
|
|
1
|
+
import { l as e, u as t } from "./element-8RsANDBG.js";
|
|
2
|
+
import { i as n } from "./directive-helpers-BXtu2yHt.js";
|
|
3
3
|
//#region node_modules/lit/node_modules/lit-html/async-directive.js
|
|
4
4
|
var r = (e, t) => {
|
|
5
5
|
let n = e._$AN;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-DCm4GU7z.cjs");require("./icon-BlJZpl2L.cjs");const t=require("./if-defined-h7sbeYue.cjs");var n=class extends e.t{constructor(...e){super(...e),this.href=``,this.text=`Forsiden`,this.ariaLabel=``}attributeChangedCallback(e,t,n){e===`arialabel`&&this.removeAttribute(`arialabel`),e===`href`&&this.removeAttribute(`href`),e===`text`&&this.removeAttribute(`text`),super.attributeChangedCallback(e,t,n)}render(){return e.p`<nav
|
|
2
2
|
class="pkt-back-link"
|
|
3
3
|
aria-label=${this.ariaLabel||`Gå tilbake til forrige side`}
|
|
4
4
|
>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as e, o as t, p as n, s as r, t as i } from "./element-
|
|
2
|
-
import "./icon-
|
|
3
|
-
import { t as a } from "./if-defined-
|
|
1
|
+
import { n as e, o as t, p as n, s as r, t as i } from "./element-8RsANDBG.js";
|
|
2
|
+
import "./icon-8ZKcRaGi.js";
|
|
3
|
+
import { t as a } from "./if-defined-DfH9X3nd.js";
|
|
4
4
|
//#region src/components/backlink/backlink.ts
|
|
5
5
|
var o = class extends i {
|
|
6
6
|
constructor(...e) {
|
|
@@ -13,7 +13,7 @@ export interface PktInputOption {
|
|
|
13
13
|
disabled?: boolean;
|
|
14
14
|
hidden?: boolean;
|
|
15
15
|
}
|
|
16
|
-
type Props = ElementProps<PktInputElement, 'defaultValue' | 'disabled' | 'readonly' | 'required' | 'max' | 'maxlength' | 'min' | 'minlength' | '
|
|
16
|
+
type Props = ElementProps<PktInputElement, 'defaultValue' | 'disabled' | 'readonly' | 'required' | 'max' | 'maxlength' | 'min' | 'minlength' | 'ariaDescribedby' | 'ariaLabelledby' | 'name' | 'pattern' | 'placeholder' | 'id' | 'counter' | 'hasError' | 'hasFieldset' | 'inline' | 'optionalTag' | 'requiredTag' | 'skipForwardTestid' | 'useWrapper' | 'fullwidth' | 'counterMaxLength' | 'errorMessage' | 'helptext' | 'helptextDropdown' | 'helptextDropdownButton' | 'label' | 'optionalText' | 'requiredText' | 'tagText' | 'inputSize' | 'dataTestid'>;
|
|
17
17
|
/**
|
|
18
18
|
* Base class for all Punkt input elements
|
|
19
19
|
* @extends PktElementWithSlot
|
|
@@ -38,16 +38,19 @@ export declare class PktInputElement<T = {}, TOption extends PktInputOption = Pk
|
|
|
38
38
|
min: string | number | null;
|
|
39
39
|
minlength: number | null;
|
|
40
40
|
step: number | null;
|
|
41
|
-
|
|
41
|
+
ariaDescribedby: string | null;
|
|
42
|
+
/** @deprecated Bruk `ariaDescribedby` — samme skrivemåte som i React. */
|
|
43
|
+
get ariaDescribedBy(): string | null;
|
|
44
|
+
set ariaDescribedBy(value: string | null);
|
|
42
45
|
ariaLabelledby: string | null;
|
|
43
46
|
name: string;
|
|
44
47
|
pattern: string | null;
|
|
45
48
|
placeholder: string | null;
|
|
46
49
|
id: string;
|
|
47
|
-
counter: boolean;
|
|
50
|
+
counter: boolean | null;
|
|
48
51
|
hasError: boolean;
|
|
49
52
|
inline: boolean;
|
|
50
|
-
hasFieldset: boolean;
|
|
53
|
+
hasFieldset: boolean | null;
|
|
51
54
|
optionalTag: boolean;
|
|
52
55
|
requiredTag: boolean;
|
|
53
56
|
skipForwardTestid: boolean;
|
|
@@ -64,6 +67,8 @@ export declare class PktInputElement<T = {}, TOption extends PktInputOption = Pk
|
|
|
64
67
|
tagText: string | null;
|
|
65
68
|
inputSize: 'small' | 'medium' | 'xsmall';
|
|
66
69
|
dataTestid: string;
|
|
70
|
+
protected effectiveCounter(derived: boolean): boolean;
|
|
71
|
+
protected effectiveHasFieldset(derived: boolean): boolean;
|
|
67
72
|
touched: boolean;
|
|
68
73
|
private _initialized;
|
|
69
74
|
constructor();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={fromAttribute(e){return e==null?!1:e===``||e===`true`||e===!0?!0:e===`false`||e===!1?!1:!!e},toAttribute(e){return e?`true`:`false`}},t={fromAttribute(e){return e==null?null:e===``||e===`true`||e===!0?!0:e===`false`||e===!1?!1:!!e},toAttribute(e){return e==null?null:e?`true`:`false`}};Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return e}});
|
|
@@ -6,6 +6,13 @@ var e = {
|
|
|
6
6
|
toAttribute(e) {
|
|
7
7
|
return e ? "true" : "false";
|
|
8
8
|
}
|
|
9
|
+
}, t = {
|
|
10
|
+
fromAttribute(e) {
|
|
11
|
+
return e == null ? null : e === "" || e === "true" || e === !0 ? !0 : e === "false" || e === !1 ? !1 : !!e;
|
|
12
|
+
},
|
|
13
|
+
toAttribute(e) {
|
|
14
|
+
return e == null ? null : e ? "true" : "false";
|
|
15
|
+
}
|
|
9
16
|
};
|
|
10
17
|
//#endregion
|
|
11
|
-
export { e as t };
|
|
18
|
+
export { t as n, e as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as e, n as t, o as n, p as r, s as i, t as a } from "./element-
|
|
2
|
-
import "./icon-
|
|
1
|
+
import { d as e, n as t, o as n, p as r, s as i, t as a } from "./element-8RsANDBG.js";
|
|
2
|
+
import "./icon-8ZKcRaGi.js";
|
|
3
3
|
//#region src/components/breadcrumbs/breadcrumbs.ts
|
|
4
4
|
var o = class extends a {
|
|
5
5
|
constructor(...e) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-DCm4GU7z.cjs");require("./icon-BlJZpl2L.cjs");var t=class extends e.t{constructor(...e){super(...e),this.breadcrumbs=[]}handleLinkClick(e,t,n){let r=new CustomEvent(`navigate`,{detail:{item:t,index:n,originalEvent:e},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(r)||e.preventDefault()}render(){if(!this.breadcrumbs||this.breadcrumbs.length===0)return e.d;let t=this.breadcrumbs[this.breadcrumbs.length-2];return e.p`
|
|
2
2
|
<nav class="pkt-breadcrumbs" aria-label="brødsmulemeny">
|
|
3
3
|
<ol class="pkt-breadcrumbs__list pkt-breadcrumbs--desktop">
|
|
4
4
|
${this.breadcrumbs.map((t,n)=>n===this.breadcrumbs.length-1?e.p`
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as e, d as t, n, o as r, p as i, s as a } from "./element-
|
|
2
|
-
import { t as o } from "./class-map-
|
|
3
|
-
import { n as s, t as c } from "./element-with-slot-
|
|
4
|
-
import "./icon-
|
|
5
|
-
import { t as l } from "./if-defined-
|
|
1
|
+
import { a as e, d as t, n, o as r, p as i, s as a } from "./element-8RsANDBG.js";
|
|
2
|
+
import { t as o } from "./class-map-BRV7-mcj.js";
|
|
3
|
+
import { n as s, t as c } from "./element-with-slot-DFNWwYys.js";
|
|
4
|
+
import "./icon-8ZKcRaGi.js";
|
|
5
|
+
import { t as l } from "./if-defined-DfH9X3nd.js";
|
|
6
6
|
//#region src/components/button/button.ts
|
|
7
7
|
var u = "https://punkt-cdn.oslo.kommune.no/latest/animations/";
|
|
8
8
|
typeof window < "u" && (window.pktAnimationPath = window.pktAnimationPath || u);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-DCm4GU7z.cjs"),t=require("./class-map-DzzW3MwB.cjs"),n=require("./element-with-slot-N79a3tub.cjs");require("./icon-BlJZpl2L.cjs");const r=require("./if-defined-h7sbeYue.cjs");var i=`https://punkt-cdn.oslo.kommune.no/latest/animations/`;typeof window<`u`&&(window.pktAnimationPath=window.pktAnimationPath||i);var a=class a extends n.t{constructor(...e){super(...e),this.iconName=`user`,this.secondIconName=`user`,this.mode=`light`,this.size=`medium`,this.fullWidth=!1,this.fullWidthOnMobile=!1,this.skin=`primary`,this.variant=`label-only`,this.state=`normal`,this.type=`button`,this.form=void 0,this.isLoading=!1,this.disabled=!1,this.loadingAnimationPath=typeof window<`u`?window.pktAnimationPath:i,this.relocatedAria={}}connectedCallback(){super.connectedCallback(),this.addEventListener(`click`,e=>{(this.disabled||this.hasAttribute(`disabled`)||this.isLoading)&&(e.preventDefault(),e.stopImmediatePropagation())},!0),this.addEventListener(`keydown`,e=>{(this.disabled||this.hasAttribute(`disabled`)||this.isLoading)&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopImmediatePropagation())},!0)}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),e===`disabled`&&n===`false`&&(this.disabled=!1),(e===`isloading`||e===`isLoading`)&&n===`false`&&(this.isLoading=!1)}static{this.relocatedAriaAttributes=[`aria-haspopup`,`aria-expanded`,`aria-controls`]}willUpdate(e){super.willUpdate(e);let t=!1,n={...this.relocatedAria};for(let e of a.relocatedAriaAttributes){let r=this.getAttribute(e);r!==null&&(n[e]=r,this.removeAttribute(e),t=!0)}t&&(this.relocatedAria=n)}firstUpdated(e){super.firstUpdated(e),this.disabled===`false`&&(this.disabled=!1),this.isLoading===`false`&&(this.isLoading=!1)}render(){let i=this.form??this.getAttribute(`form`)??void 0;return e.p`
|
|
2
2
|
<button
|
|
3
3
|
class=${t.t({"pkt-btn":!0,[`pkt-btn--${this.size}`]:!!this.size,[`pkt-btn--${this.skin}`]:!!this.skin,[`pkt-btn--${this.variant}`]:!!this.variant,[`pkt-btn--${this.color}`]:!!this.color,[`pkt-btn--${this.state}`]:!!this.state,"pkt-btn--full":!!this.fullWidth,"pkt-btn--full-small":!!this.fullWidthOnMobile,"pkt-btn--disabled":!!this.disabled,"pkt-btn--isLoading":!!this.isLoading})}
|
|
4
4
|
type=${this.type}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-DCm4GU7z.cjs"),t=require("./class-map-DzzW3MwB.cjs");require("./icon-BlJZpl2L.cjs");const n=require("./converters-Cd0fPEly.cjs");function r(e,t,r){let i=n.y(e,r?.in);return isNaN(t)?n.b(r?.in||e,NaN):(t&&i.setDate(i.getDate()+t),i)}function i(e,t){let[r,i]=n.v(e,t.start,t.end);return{start:r,end:i}}function a(e,t){let{start:r,end:a}=i(t?.in,e),o=+r>+a,s=o?+r:+a,c=o?a:r;c.setHours(0,0,0,0);let l=t?.step??1;if(!l)return[];l<0&&(l=-l,o=!o);let u=[];for(;+c<=s;)u.push(n.b(r,c)),c.setDate(c.getDate()+l),c.setHours(0,0,0,0);return o?u.reverse():u}function o(e,t){let r=n.y(e,t?.in).getDay();return r===0?7:r}var s={name:`pkt-calendar`,react:`PktCalendar`,"css-class":`pkt-calendar`,isElement:!0,isPureReact:!0,props:{id:{type:`string`,name:`ID`,description:`Unik identifikasjon for kalenderen`},currentmonth:{type:`date`,name:`Gjeldende måned`,converter:`stringToDate`,description:`Måneden som vises i kalenderen`},selected:{type:`array`,name:`Valgte datoer`,converter:`csvToArray`,reflect:!0,items:{type:`date`},description:`Liste over valgte datoer`},excludeweekdays:{type:`array`,name:`Utelat ukedager`,converter:`csvToArray`,items:{type:`string`},description:`Liste over ukedager (1-7) som skal ekskluderes`},excludedates:{type:`array`,name:`Utelat datoer`,converter:`stringsToDate`,items:{type:`date`},description:`Liste over spesifikke datoer som skal ekskluderes`},earliest:{type:`date`,name:`Tidligst tillatte dato`,converter:`stringToDate`,default:null,description:`Tidligste dato som kan velges`},latest:{type:`date`,name:`Senest tillatte dato`,converter:`stringToDate`,default:null,description:`Seneste dato som kan velges`},weeknumbers:{type:`boolean`,name:`Vis ukenummer`,reflect:!0,default:!1,description:`Vis ukenummer i kalenderen`},withcontrols:{type:`boolean`,name:`Med velgere for måned/år`,reflect:!0,default:!1,description:`Vis navigasjonskontroller for måned og år`},multiple:{type:`boolean`,name:`Flervalg`,reflect:!0,default:!1,description:`Tillat valg av flere datoer`},maxMultiple:{attribute:`max-multiple`,type:`number`,name:`Maks antall i flervalg`,default:4,description:`Maksimalt antall datoer som kan velges`},today:{type:`string`,name:`Dagens dato (overstyring)`,description:`ISO-datostreng som overstyrer dagens dato. Nyttig for snapshot-tester.`},range:{type:`boolean`,name:`Datotidsrom (fra og til)`,reflect:!0,default:!1,description:`Tillat valg av datotidsrom`},dayStrings:{attribute:`day-strings`,type:`array`,name:`Korte dagsnavn`,items:{type:`string`},description:`Korte dagsnavn for kalenderoverskriften`},dayStringsLong:{attribute:`day-strings-long`,type:`array`,name:`Fulle dagsnavn`,items:{type:`string`},description:`Fulle dagsnavn for tilgjengelighetsetiketter`},monthStrings:{attribute:`month-strings`,type:`array`,name:`Månedsnavn`,items:{type:`string`},description:`Månedsnavn for kalendernavigasjonen`},weekString:{attribute:`week-string`,type:`string`,name:`Ukenummer-etikett`,description:`Etikett for ukenummerkolonnen`},prevMonthString:{attribute:`prev-month-string`,type:`string`,name:`Forrige måned-etikett`,description:`Tilgjengelighetsetikett for forrige måned-knappen`},nextMonthString:{attribute:`next-month-string`,type:`string`,name:`Neste måned-etikett`,description:`Tilgjengelighetsetikett for neste måned-knappen`}},events:{"date-selected":{description:`Returnerer en liste med valgte datoer i ISO-format`},close:{description:`Utløses når kalenderen ber om å lukkes (Escape-tast eller fokus forlater)`}}};function c(e,t){let r=(t.excludedates??[]).map(e=>typeof e==`string`?e:n.a(e));return!n.l(e,t.earliest,t.latest,r,t.excludeweekdays??[])}function l(e,t,n,r){return!!(c(e,n)||!t&&r.multiple&&r.maxMultiple>0&&r.selectedCount>=r.maxMultiple)}function u(e,t,r){let i=n.p(e,t,0);return!(r&&n.d(r)>i)}function d(e,t,r){let i=n.p(t===11?e+1:e,t===11?0:t+1,1);return!(r&&n.d(r)<i)}function f(e,t){let r=n.p(e,t,1),i=n.p(e,t+1,0),a=(r.getDay()+6)%7,o=i.getDate();return{firstDayOfMonth:r,lastDayOfMonth:i,startingDay:a,numDays:o,numRows:Math.ceil((o+a)/7),numDaysPrevMonth:n.p(e,t,0).getDate(),initialWeek:n._(r)}}function p(e,t,n,r){let{startingDay:i,numDays:a}=r;return e===0&&t<i?`prev-month`:n>a?`next-month`:`current-month`}function m(e,t,n,r){let{startingDay:i,numDaysPrevMonth:a,numDays:o}=r;return e===`prev-month`?a-(i-t-1):e===`next-month`?n-o:n}function h(e){return typeof e==`string`&&(e=e.split(`,`)),e.length===1&&e[0]===``?[]:e.map(e=>n.m(e))}function g(e,t){let r=a({start:e,end:t}),i={};if(Array.isArray(r)&&r.length)for(let a=0;a<r.length;a++){let o=r[a],s=o>e&&o<t;i[n.a(o)]=s}return i}function _(e,t,n,r){if(t.length!==1)return!0;let i=a({start:t[0],end:e});if(!Array.isArray(i)||!i.length)return!0;for(let a=0;a<i.length;a++){for(let r of n??[])if(r>t[0]&&r<e)return!1;if((r??[]).includes(o(i[a]).toString()))return!1}return!0}function v(e,t){let r=n.a(e);return t.includes(r)?t:[...t,r]}function y(e,t){let r=n.a(e),i=t.indexOf(r);if(i===-1)return t;if(t.length===1)return[];let a=[...t];return a.splice(i,1),a}function b(e,t,r){let i=n.a(e);return t.includes(i)?y(e,t):r>0&&t.length>=r?t:v(e,t)}function x(e,t,r){let i=n.a(e),a=h(t);return t.includes(i)?t.indexOf(i)===0?[]:y(e,t):t.length>1||t.length===1&&(!_(e,a,r.excludedates,r.excludeweekdays)||a[0]>e)?[i]:v(e,t)}var S={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7};function C(e){let t=e.nodeName;return t===`INPUT`||t===`SELECT`||t===`BUTTON`&&!e.dataset?.date}function w(e,t,i){let a=r(e,t);if(!a)return null;let o=i(`button[data-date="${n.a(a)}"]`);for(;o instanceof HTMLButtonElement&&o.dataset.disabled;)if(a=r(a,t),o=i(`button[data-date="${n.a(a)}"]`),!o)return null;return a}function T(e){return S[e]??null}var E=class extends e.t{constructor(...e){super(...e),this.selected=[],this.multiple=s.props.multiple.default,this.maxMultiple=s.props.maxMultiple.default,this.range=s.props.range.default,this.earliest=s.props.earliest.default,this.latest=s.props.latest.default,this.excludedates=[],this.excludeweekdays=[],this.weeknumbers=s.props.weeknumbers.default,this.withcontrols=s.props.withcontrols.default,this.currentmonth=null,this.today=null,this.dayStrings=this.strings.dates.daysShort,this.dayStringsLong=this.strings.dates.days,this.monthStrings=this.strings.dates.months,this.weekString=this.strings.dates.week,this.prevMonthString=this.strings.dates.prevMonth,this.nextMonthString=this.strings.dates.nextMonth,this._selected=[],this.inRange={},this.rangeHovered=null,this.year=0,this.month=0,this.week=0,this.currentmonthtouched=!1,this.focusedDate=null,this.selectableDates=[],this.tabIndexSet=0}get todayDate(){return this.today?n.m(this.today):n.g()}firstUpdated(e){this.addEventListener(`keydown`,this.handleKeydown)}disconnectedCallback(){this.removeEventListener(`keydown`,this.handleKeydown),super.disconnectedCallback()}updated(e){super.updated(e),e.has(`selected`)&&this.convertSelected()}convertSelected(){typeof this.selected==`string`&&(this.selected=this.selected.split(`,`)),this.selected.length===1&&this.selected[0]===``&&(this.selected=[]),this._selected=h(this.selected),this.range&&this.selected.length===2&&(this.inRange=g(this._selected[0],this._selected[1])),this.setCurrentMonth()}setCurrentMonth(){if(this.currentmonth===null&&!this.currentmonthtouched&&(this.currentmonthtouched=!0),this.selected.length&&this.selected[0]!==``){let e=n.m(this.selected[this.selected.length-1]);this.currentmonth=isNaN(e.getTime())?n.f(this.todayDate):e}else this.currentmonth===null&&(this.currentmonth=n.f(this.todayDate));(!this.currentmonth||isNaN(this.currentmonth.getTime()))&&(this.currentmonth=n.f(this.todayDate)),this.year=this.currentmonth.getFullYear(),this.month=this.currentmonth.getMonth()}handleKeydown(e){let t=T(e.key);t!==null&&this.handleArrowKey(e,t)}handleArrowKey(e,t){let r=e.target;if(C(r))return;if(e.preventDefault(),!this.focusedDate){this.focusOnCurrentDate();return}let i=w(this.focusedDate?n.d(this.focusedDate):n.p(this.year,this.month,1),t,this.querySelector.bind(this));if(i){let e=this.querySelector(`button[data-date="${n.a(i)}"]`);e instanceof HTMLButtonElement&&!e.dataset.disabled&&(this.focusedDate=n.a(i),e.focus())}}render(){return e.p`
|
|
2
2
|
<div
|
|
3
3
|
class="pkt-calendar ${this.weeknumbers?`pkt-cal-weeknumbers`:``}"
|
|
4
4
|
@focusout=${this.closeEvent}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as e, d as t, n, o as r, p as i, s as a, t as o } from "./element-
|
|
2
|
-
import { t as s } from "./class-map-
|
|
3
|
-
import "./icon-
|
|
1
|
+
import { a as e, d as t, n, o as r, p as i, s as a, t as o } from "./element-8RsANDBG.js";
|
|
2
|
+
import { t as s } from "./class-map-BRV7-mcj.js";
|
|
3
|
+
import "./icon-8ZKcRaGi.js";
|
|
4
4
|
import { _ as c, a as l, b as u, d, f, g as p, l as m, m as h, o as g, p as _, t as v, v as y, y as b } from "./converters-BBfsEJV5.js";
|
|
5
5
|
//#region ../../node_modules/date-fns/addDays.js
|
|
6
6
|
function x(e, t, n) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-DCm4GU7z.cjs"),t=require("./class-map-DzzW3MwB.cjs"),n=require("./element-with-slot-N79a3tub.cjs");require("./icon-BlJZpl2L.cjs");const r=require("./if-defined-h7sbeYue.cjs");require("./tag-DaRo48qb.cjs"),require("./heading-DbLmrGyU.cjs");var i={name:`pkt-card`,react:`PktCard`,"css-class":`pkt-card`,isElement:!0,isPureReact:!0,"dark-mode":!0,props:{heading:{type:`string`,name:`Overskrift`,description:`Tittel på card`,category:`contents`},headingLevel:{type:[1,2,3,4,5,6],name:`Overskriftsnivå`,description:`Nivået på headingen. Brukes for tilgjengelighet.`,default:3,category:`accessibility`},subheading:{type:`string`,name:`Undertittel`,description:`Undertittel på card`,category:`contents`},layout:{type:[`vertical`,`horizontal`],name:`Layout`,description:`Horisontal eller vertikal layout. Ved horisontal layout vil bildet være plassert til venstre for teksten på desktop, og over teksten på mobil.`,default:`vertical`,category:`ui`},skin:{type:[`outlined`,`outlined-beige`,`gray`,`blue`,`beige`,`green`],name:`Utseende`,description:`Fargen på card. Velg mellom outlined, outlined-beige, gray, blue, beige og green. Ved padding=none er det ikke mulighet for outlined-skin. Card med kombinasjonen av propsene padding=none + layout=vertical vil alltid være transparante.`,default:`outlined`,category:`ui`},padding:{type:[`none`,`default`],name:`Padding`,description:`Padding rundt card. Ved "none" strekker innholdet i card seg ut til kantene, og dette er derfor ikke mulig å kombinere med outlined skin.`,default:`default`,category:`ui`},metaLead:{type:`string`,name:`Forfatter eller annen metadata`,description:`Undertekst med fet skriftvekt`,default:!1,category:`contents`},metaTrail:{type:`string`,name:`Dato eller annen metadata`,description:`Undertekst med normal skriftvekt`,default:!1,category:`contents`},tagPosition:{type:[`top`,`bottom`],name:`Tagplassering`,description:`Plassering av tags i card`,default:`top`,category:`ui`},clickCardLink:{type:`string`,name:`Lenke for klikkbart card`,description:`Href sendes inn som streng for å gjøre card klikkbart. Ved bruk MÅ heading sendes inn da denne vil brukes som lenketekst i klikkbart card.`,category:`contents`},openLinkInNewTab:{type:`boolean`,name:`Åpne i ny fane`,description:`Velg denne dersom du ønsker at lenken i card skal åpnes i ny fane.`,default:!1,category:`tech`},borderOnHover:{type:`boolean`,name:`Hover border for klikkbart card`,description:`Vi anbefaler hoverborder på klikkbart card. Kan slås av ved behov.`,default:!0,category:`ui`},image:{type:`object`,name:`Bilde`,description:`Bildet på card. Tar inn et objekt av typen {src: string, alt: string}.`,properties:{src:{type:`string`,description:`Stien til bildet`,required:!0},alt:{type:`string`,description:`Tekst til skjermleser. Skal kun sendes inn for bilder som ikke er dekorative`,required:!1}},category:`contents`},imageShape:{type:[`square`,`round`],name:`Bildeform`,description:`Valg for om bildet skal ha rektangulær eller rund form.`,default:`square`,category:`contents`},tags:{type:`array`,description:`Liste av tags på card. Tar inn et array med objekter med følgende stringproperties: skin, iconName, ariaLabel, text`,name:`Tags`,items:{type:`object`,name:`Tag`,properties:{skin:{type:[`blue`,`green`,`red`,`yellow`],description:`Farge på tag`},iconName:{type:`icon`,description:`Id på ikonet du ønsker å bruke til tag`},ariaLabel:{type:`string`,description:`Tekst for aria-label`},text:{type:`string`,description:`Tekst på tag`,required:!0}}},category:`contents`},ariaLabel:{type:`string`,name:`Aria-label for card`,description:`Tekst til skjermleser for aria-label på card. Settes automatisk til headingen, eller subheadingen der heading ikke eksisterer. Ved bruk av klikkbart card må heading alltid sendes inn da denne brukes som lenketekst.`,category:`accessibility`}},slots:{default:{description:`Innholdet i card`}}},a=class extends n.t{constructor(...e){super(...e),this.ariaLabel=``,this.metaLead=null,this.borderOnHover=!0,this.clickCardLink=null,this.metaTrail=null,this.layout=i.props.layout.default,this.heading=``,this.headinglevel=3,this.image={src:``,alt:``},this.imageShape=`square`,this.openLinkInNewTab=!1,this.padding=i.props.padding.default,this.skin=i.props.skin.default,this.subheading=``,this.tagPosition=`top`,this.tags=[]}connectedCallback(){super.connectedCallback()}render(){let n={"pkt-card":!0,[`pkt-card--${this.skin}`]:this.skin,[`pkt-card--${this.layout}`]:this.layout,[`pkt-card--padding-${this.padding}`]:this.padding,"pkt-card--border-on-hover":this.borderOnHover},i=this.ariaLabel?.trim()||(this.heading?`${this.heading} lenkekort`:`lenkekort`),a=this.ariaLabel?.trim()||(this.heading?this.heading:`kort`);return e.p`
|
|
2
2
|
<article
|
|
3
3
|
class=${t.t(n)}
|
|
4
4
|
aria-label=${r.t(this.clickCardLink?i:a)}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { d as e, n as t, o as n, p as r, s as i } from "./element-
|
|
2
|
-
import { t as a } from "./class-map-
|
|
3
|
-
import { n as o, t as s } from "./element-with-slot-
|
|
4
|
-
import "./icon-
|
|
5
|
-
import { t as c } from "./if-defined-
|
|
6
|
-
import "./tag-
|
|
7
|
-
import "./heading-
|
|
1
|
+
import { d as e, n as t, o as n, p as r, s as i } from "./element-8RsANDBG.js";
|
|
2
|
+
import { t as a } from "./class-map-BRV7-mcj.js";
|
|
3
|
+
import { n as o, t as s } from "./element-with-slot-DFNWwYys.js";
|
|
4
|
+
import "./icon-8ZKcRaGi.js";
|
|
5
|
+
import { t as c } from "./if-defined-DfH9X3nd.js";
|
|
6
|
+
import "./tag-rb23IBFT.js";
|
|
7
|
+
import "./heading-V-gyod7_.js";
|
|
8
8
|
var l = {
|
|
9
9
|
name: "pkt-card",
|
|
10
10
|
react: "PktCard",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { d as e, n as t, o as n, p as r, s as i } from "./element-
|
|
2
|
-
import { t as a } from "./class-map-
|
|
3
|
-
import { n as o, t as s } from "./ref-
|
|
4
|
-
import { t as c } from "./input-element-
|
|
1
|
+
import { d as e, n as t, o as n, p as r, s as i } from "./element-8RsANDBG.js";
|
|
2
|
+
import { t as a } from "./class-map-BRV7-mcj.js";
|
|
3
|
+
import { n as o, t as s } from "./ref-CkGzlsAX.js";
|
|
4
|
+
import { t as c } from "./input-element-DPXwOJeT.js";
|
|
5
5
|
//#region src/components/checkbox/checkbox.ts
|
|
6
6
|
var l = class extends c {
|
|
7
7
|
constructor(...e) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-DCm4GU7z.cjs"),t=require("./class-map-DzzW3MwB.cjs"),n=require("./ref-CYXJQuCZ.cjs"),r=require("./input-element-CmFzbxiZ.cjs");var i=class extends r.t{constructor(...e){super(...e),this.inputRef=n.t(),this.value=``,this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.isSwitch=!1,this.labelPosition=`right`,this.hideLabel=!1,this.checked=null,this.indeterminate=!1,this.type=`checkbox`,this.tagText=null,this.optionalTag=!1,this.optionalText=`Valgfritt`,this.requiredTag=!1,this.requiredText=`Må fylles ut`}connectedCallback(){super.connectedCallback()}attributeChangedCallback(e,t,n){e===`defaultChecked`&&!this.checked&&(this.checked=this.defaultChecked),e===`checked`&&(this.checked=this.checked===``||this.checked===`true`||this.checked===!0,this.inputRef.value&&(this.inputRef.value.checked=this.checked)),e===`indeterminate`&&(this.indeterminate=this.indeterminate===``||this.indeterminate===`true`||this.indeterminate===!0,this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate)),super.attributeChangedCallback(e,t,n)}firstUpdated(e){e.has(`defaultChecked`)&&!this.checked&&(this.checked=this.defaultChecked),this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate===``||this.indeterminate===`true`||this.indeterminate===!0),super.firstUpdated(e)}updated(e){e.has(`defaultChecked`)&&!this.checked&&(this.checked=this.defaultChecked),e.has(`checked`)&&this.inputRef.value&&(this.inputRef.value.checked=this.checked===``||this.checked===`true`||this.checked===!0),e.has(`indeterminate`)&&this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate===``||this.indeterminate===`true`||this.indeterminate===!0),super.updated(e)}render(){let r=t.t({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),i=t.t({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),a=t.t({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.disabled,"pkt-input-check__input-label--left":this.labelPosition===`left`,"pkt-input-check__input-label--right":this.labelPosition===`right`,"pkt-sr-only":this.hideLabel}),o=()=>e.p`
|
|
2
2
|
${this.tagText?e.p`<span class=${`pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--gray`}>${this.tagText}</span>`:e.d}
|
|
3
3
|
${this.optionalTag?e.p`<span class=${`pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--blue-light`}>${this.optionalText}</span>`:e.d}
|
|
4
4
|
${this.requiredTag?e.p`<span class=${`pkt-tag pkt-tag--small pkt-tag--thin-text pkt-tag--beige`}>${this.requiredText}</span>`:e.d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-DCm4GU7z.cjs");var t=e.c(class extends e.l{constructor(t){if(super(t),t.type!==e.u.ATTRIBUTE||t.name!==`class`||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return` `+Object.keys(e).filter(t=>e[t]).join(` `)+` `}update(t,[n]){if(this.st===void 0){this.st=new Set,t.strings!==void 0&&(this.nt=new Set(t.strings.join(` `).split(/\s/).filter(e=>e!==``)));for(let e in n)n[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(n)}let r=t.element.classList;for(let e of this.st)e in n||(r.remove(e),this.st.delete(e));for(let e in n){let t=!!n[e];t===this.st.has(e)||this.nt?.has(e)||(t?(r.add(e),this.st.add(e)):(r.remove(e),this.st.delete(e)))}return e.f}});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
const e=require("./element-DCm4GU7z.cjs"),t=require("./class-map-DzzW3MwB.cjs"),n=require("./element-with-slot-N79a3tub.cjs");require("./icon-BlJZpl2L.cjs");const r=require("./if-defined-h7sbeYue.cjs"),i=require("./ref-CYXJQuCZ.cjs");require("./tag-DaRo48qb.cjs");const a=require("./repeat-C_7HwdFQ.cjs"),o=require("./listbox-CgjhUALC.cjs"),s=require("./input-element-CmFzbxiZ.cjs"),c=require("./pkt-options-controller-DeyC9FDP.cjs");require("./input-wrapper-CohL8Onb.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.o({type:String,reflect:!0})],_.prototype,`value`,void 0),e.n([e.o({type:Array})],_.prototype,`options`,void 0),e.n([e.o({type:Array,attribute:`default-options`})],_.prototype,`defaultOptions`,void 0),e.n([e.o({type:Boolean,attribute:`allow-user-input`})],_.prototype,`allowUserInput`,void 0),e.n([e.o({type:Boolean})],_.prototype,`typeahead`,void 0),e.n([e.o({type:Boolean,attribute:`include-search`})],_.prototype,`includeSearch`,void 0),e.n([e.o({type:String,attribute:`search-placeholder`})],_.prototype,`searchPlaceholder`,void 0),e.n([e.o({type:Boolean})],_.prototype,`multiple`,void 0),e.n([e.o({type:Number})],_.prototype,`maxlength`,void 0),e.n([e.o({type:String,attribute:`display-value-as`})],_.prototype,`displayValueAs`,void 0),e.n([e.o({type:String,attribute:`tag-placement`})],_.prototype,`tagPlacement`,void 0),e.n([e.o({type:Boolean,attribute:`open`})],_.prototype,`isOpen`,void 0),e.n([e.a()],_.prototype,`_options`,void 0),e.n([e.a()],_.prototype,`_value`,void 0),e.n([e.a()],_.prototype,`_isOptionsOpen`,void 0),e.n([e.a()],_.prototype,`_userInfoMessage`,void 0),e.n([e.a()],_.prototype,`_addValueText`,void 0),e.n([e.a()],_.prototype,`_maxIsReached`,void 0),e.n([e.a()],_.prototype,`_search`,void 0),e.n([e.a()],_.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=`Ny verdi lagt til`,u=c):!r&&!this.allowUserInput?(s&&this._value[0]&&this.removeValue(this._value[0]),d=!1,u=!0,f=`Ingen treff i søket`):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=`Maks antall valg nådd`,d=!1,p=e):(s&&this.removeAllSelected(),f=`Ingen gyldig verdi valgt`,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=`Maks antall valg nådd`;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=`For mange valgt`;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=`Verdien er allerede valgt`;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);break}}!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]));break}}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;break}}}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();break}}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.p`
|
|
2
|
+
<pkt-input-wrapper
|
|
3
|
+
.size=${this.inputSize}
|
|
4
|
+
.label=${this.label}
|
|
5
|
+
.helptext=${this.helptext}
|
|
6
|
+
.helptextDropdown=${r.t(this.helptextDropdown)}
|
|
7
|
+
.helptextDropdownButton=${r.t(this.helptextDropdownButton)}
|
|
8
|
+
?fullwidth=${this.fullwidth}
|
|
9
|
+
?counter=${this.effectiveCounter(!!this.multiple&&this.maxlength!=null)}
|
|
10
|
+
.counterCurrent=${this._value.length}
|
|
11
|
+
.counterMaxLength=${this.maxlength??0}
|
|
12
|
+
?hasError=${this.hasError}
|
|
13
|
+
?inline=${this.inline}
|
|
14
|
+
?disabled=${this.disabled}
|
|
15
|
+
.errorMessage=${this.errorMessage}
|
|
16
|
+
?optionalTag=${this.optionalTag}
|
|
17
|
+
.optionalText=${this.optionalText}
|
|
18
|
+
?requiredTag=${this.requiredTag}
|
|
19
|
+
.requiredText=${this.requiredText}
|
|
20
|
+
.tagText=${this.tagText}
|
|
21
|
+
useWrapper=${this.useWrapper}
|
|
22
|
+
.forId=${this._hasTextInput?this.id+`-input`:this.id+`-combobox`}
|
|
23
|
+
?hasFieldset=${this.effectiveHasFieldset(!this._hasTextInput)}
|
|
24
|
+
class="pkt-combobox__wrapper"
|
|
25
|
+
@labelClick=${this.handleInputClick}
|
|
26
|
+
>
|
|
27
|
+
<div class="pkt-contents" slot="helptext">${n.n(this,`helptext`)}</div>
|
|
28
|
+
<div class="pkt-combobox" @focusout=${this.handleFocusOut}>
|
|
29
|
+
<div
|
|
30
|
+
class=${t.t({"pkt-combobox__input":!0,[`pkt-combobox__input--${this.inputSize}`]:!0,"pkt-combobox__input--fullwidth":this.fullwidth,"pkt-combobox__input--open":this._isOptionsOpen,"pkt-combobox__input--error":this.hasError,"pkt-combobox__input--disabled":this.disabled})}
|
|
31
|
+
id=${r.t(this._hasTextInput?void 0:`${this.id}-combobox`)}
|
|
32
|
+
role=${r.t(this._hasTextInput?void 0:`combobox`)}
|
|
33
|
+
aria-expanded=${r.t(this._hasTextInput?void 0:this._isOptionsOpen?`true`:`false`)}
|
|
34
|
+
aria-controls=${r.t(this._hasTextInput?void 0:`${this.id}-listbox`)}
|
|
35
|
+
aria-haspopup=${r.t(this._hasTextInput?void 0:`listbox`)}
|
|
36
|
+
aria-labelledby=${r.t(this._hasTextInput?void 0:`${this.id}-combobox-label`)}
|
|
37
|
+
aria-activedescendant=${r.t(!this._hasTextInput&&this._value[0]&&o.i(this.options,this._value[0])?`${this.id}-listbox-${o.a(this._options,this._value[0])}`:void 0)}
|
|
38
|
+
aria-description=${r.t(this._selectionDescription||void 0)}
|
|
39
|
+
tabindex=${this._hasTextInput||this.disabled?`-1`:`0`}
|
|
40
|
+
@click=${this.handleInputClick}
|
|
41
|
+
@keydown=${this._hasTextInput?e.d:this.handleSelectOnlyKeydown}
|
|
42
|
+
${i.n(this.triggerRef)}
|
|
43
|
+
>
|
|
44
|
+
${!this._hasTextInput&&this.placeholder&&(!this._value.length||this.multiple&&this.tagPlacement==`outside`)&&!this._inputFocus?e.p`<span class="pkt-combobox__placeholder" @click=${this.handlePlaceholderClick}
|
|
45
|
+
>${this.placeholder}</span
|
|
46
|
+
>`:this.tagPlacement===`outside`?e.d:this.renderSingleOrMultipleValues()}
|
|
47
|
+
${this.renderInputField()}
|
|
48
|
+
<pkt-icon
|
|
49
|
+
class=${t.t({"pkt-combobox__arrow-icon":!0,"pkt-combobox__arrow-icon--open":this._isOptionsOpen})}
|
|
50
|
+
name="chevron-thin-down"
|
|
51
|
+
aria-hidden="true"
|
|
52
|
+
></pkt-icon>
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
<pkt-listbox
|
|
56
|
+
id="${this.id}-listbox"
|
|
57
|
+
.options=${this._options}
|
|
58
|
+
.isOpen=${this._isOptionsOpen}
|
|
59
|
+
.searchPlaceholder=${this.searchPlaceholder}
|
|
60
|
+
.label="Liste: ${this.label||``}"
|
|
61
|
+
?include-search=${this.includeSearch}
|
|
62
|
+
?is-multi-select=${this.multiple}
|
|
63
|
+
?allow-user-input=${this.allowUserInput&&!this._maxIsReached}
|
|
64
|
+
?max-is-reached=${this._maxIsReached}
|
|
65
|
+
.customUserInput=${r.t(this._addValueText)}
|
|
66
|
+
.userMessage=${this._userInfoMessage}
|
|
67
|
+
@search=${this.handleSearch}
|
|
68
|
+
@option-toggle=${this.handleOptionToggled}
|
|
69
|
+
@select-all=${this.addAllOptions}
|
|
70
|
+
@close-options=${()=>this._isOptionsOpen=!1}
|
|
71
|
+
@tab-close=${()=>this.closeAndProcessInput()}
|
|
72
|
+
.searchValue=${this._search||null}
|
|
73
|
+
.maxLength=${this.maxlength||0}
|
|
74
|
+
${i.n(this.listboxRef)}
|
|
75
|
+
></pkt-listbox>
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
${this.tagPlacement===`outside`&&this.multiple?e.p`<div class="pkt-combobox__tags-outside">
|
|
79
|
+
${this.renderSingleOrMultipleValues()}
|
|
80
|
+
</div>`:e.d}
|
|
81
|
+
</pkt-input-wrapper>
|
|
82
|
+
`}renderInputField(){return this.typeahead||this.allowUserInput?e.p`
|
|
83
|
+
<div class="pkt-combobox__input-div combobox__input">
|
|
84
|
+
<input
|
|
85
|
+
type="text"
|
|
86
|
+
id="${this.id}-input"
|
|
87
|
+
name=${(this.name||this.id)+`-input`}
|
|
88
|
+
placeholder=${r.t(!this._value.length||this.multiple&&this.tagPlacement===`outside`?this.placeholder:void 0)}
|
|
89
|
+
@input=${this.handleInput}
|
|
90
|
+
@change=${e=>{e.stopPropagation(),e.stopImmediatePropagation()}}
|
|
91
|
+
@keydown=${this.handleInputKeydown}
|
|
92
|
+
@focus=${this.handleFocus}
|
|
93
|
+
@blur=${this.handleBlur}
|
|
94
|
+
autocomplete="off"
|
|
95
|
+
role="combobox"
|
|
96
|
+
aria-expanded=${this._isOptionsOpen?`true`:`false`}
|
|
97
|
+
aria-label=${r.t(this.label)}
|
|
98
|
+
aria-autocomplete=${this.typeahead?`both`:this.allowUserInput?`list`:`none`}
|
|
99
|
+
aria-controls="${this.id}-listbox"
|
|
100
|
+
aria-activedescendant=${r.t(this._value[0]&&o.i(this.options,this._value[0])?`${this.id}-listbox-${o.a(this._options,this._value[0])}`:void 0)}
|
|
101
|
+
aria-description=${r.t(this._selectionDescription||void 0)}
|
|
102
|
+
${i.n(this.inputRef)}
|
|
103
|
+
/>
|
|
104
|
+
</div>
|
|
105
|
+
`:e.p`
|
|
106
|
+
<input
|
|
107
|
+
type="hidden"
|
|
108
|
+
id="${this.id}-input"
|
|
109
|
+
name=${(this.name||this.id)+`-input`}
|
|
110
|
+
.value=${this._value.join(`,`)}
|
|
111
|
+
${i.n(this.inputRef)}
|
|
112
|
+
/>
|
|
113
|
+
`}renderSingleOrMultipleValues(){if(!this.multiple&&this._hasTextInput)return e.d;let t=!this.multiple,n=this.renderValueTag(o.i(this.options,this._value[0])),r=this.tagPlacement===`outside`,i=e.p`
|
|
114
|
+
<ul role="list" class="pkt-combobox__tag-list">
|
|
115
|
+
${a.t(this._value,e=>e,(t,n)=>{let i=o.i(this.options,t),a=i?.tagSkinColor;return e.p`
|
|
116
|
+
<li
|
|
117
|
+
role="listitem"
|
|
118
|
+
@click=${r?e.d:e=>e.stopPropagation()}
|
|
119
|
+
@mousedown=${r?e.d:e=>e.preventDefault()}
|
|
120
|
+
>
|
|
121
|
+
<pkt-tag
|
|
122
|
+
skin=${a||`blue-dark`}
|
|
123
|
+
?closeTag=${!this.disabled}
|
|
124
|
+
.buttonTabindex=${r?void 0:-1}
|
|
125
|
+
@close=${()=>this.handleTagRemove(t)}
|
|
126
|
+
@keydown=${r?e.d:e=>this.handleTagKeydown(e,n)}
|
|
127
|
+
>
|
|
128
|
+
${this.renderValueTag(i)}
|
|
129
|
+
</pkt-tag>
|
|
130
|
+
</li>
|
|
131
|
+
`})}
|
|
132
|
+
</ul>
|
|
133
|
+
`;return t?n:i}renderValueTag(t){if(!t)return``;switch(this.displayValueAs){case`prefixAndValue`:return e.p`<span class="pkt-combobox__value" data-focusfix=${this.id}
|
|
134
|
+
>${t.prefix||``} ${t.value}</span
|
|
135
|
+
>`;case`value`:return e.p`<span class="pkt-combobox__value" data-focusfix=${this.id}
|
|
136
|
+
>${t.value}</span
|
|
137
|
+
>`;default:return e.p`<span class="pkt-combobox__value" data-focusfix=${this.id}
|
|
138
|
+
>${t.label||t.value}</span
|
|
139
|
+
>`}}};try{e.s(`pkt-combobox`)(b)}catch{console.warn(`Forsøker å definere <pkt-combobox>, men den er allerede definert`)}var x=b;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return x}});
|