@oslokommune/punkt-elements 18.9.3 → 18.9.7
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-CsrLQXEA.cjs → accordion-BLMbI8SQ.cjs} +1 -1
- package/dist/{accordion-DoxhiwK-.js → accordion-Bwka5Mxo.js} +5 -5
- package/dist/{alert-DH3VqNqh.cjs → alert-Cfr6t5uz.cjs} +1 -1
- package/dist/{alert-DxAGxSX_.js → alert-DaXpwnzT.js} +6 -6
- package/dist/{async-directive-BSwJ8-GL.js → async-directive-C8UAk8Mv.js} +2 -2
- package/dist/{async-directive-CfPXShXu.cjs → async-directive-U0EE5r36.cjs} +1 -1
- package/dist/{backlink-CGc7r9CS.js → backlink-BjJwDjuP.js} +3 -3
- package/dist/{backlink-CDH824db.cjs → backlink-DM220m4q.cjs} +1 -1
- package/dist/{breadcrumbs-DRGhIXmN.js → breadcrumbs-B1pDtQy8.js} +2 -2
- package/dist/{breadcrumbs-B37tsIoh.cjs → breadcrumbs-BUmbj-hP.cjs} +1 -1
- package/dist/{button-D6QhHPWH.js → button-BUl8uWWh.js} +5 -5
- package/dist/{button-Cx6Xdp6t.cjs → button-CCR4eyt_.cjs} +1 -1
- package/dist/{calendar-CAwIY7x_.cjs → calendar-BuSfyUR9.cjs} +1 -1
- package/dist/{calendar-42o_q-jI.js → calendar-KUQ1dFeX.js} +3 -3
- package/dist/{card-cyZE94EO.js → card-27RxxKxW.js} +6 -6
- package/dist/{card-CB72gwBC.cjs → card-B-RKnu_C.cjs} +1 -1
- package/dist/{checkbox-BhyUp6l6.js → checkbox-CTf4GatI.js} +4 -4
- package/dist/{checkbox-DJfH-vTj.cjs → checkbox-DlzVGBum.cjs} +1 -1
- package/dist/{class-map-DupQbnhE.cjs → class-map-B0FX3YsK.cjs} +1 -1
- package/dist/{class-map-DSoj1J68.js → class-map-D5GHsely.js} +1 -1
- package/dist/combobox-CNCM-Psm.cjs +139 -0
- package/dist/{combobox-fzSaCPok.js → combobox-Dym_phvv.js} +67 -58
- package/dist/components/combobox/combobox.d.ts +1 -0
- package/dist/components/header/header-service.d.ts +1 -1
- package/dist/components/header/types.d.ts +1 -1
- package/dist/components/helptext/helptext-association.test.d.ts +0 -0
- package/dist/components/timepicker/timepicker.d.ts +1 -0
- package/dist/{consent-CsgKWDsR.js → consent-BeoP4rOa.js} +2 -2
- package/dist/{consent-DnE6IPEj.cjs → consent-Cle1hkPg.cjs} +1 -1
- package/dist/{datepicker-D6os8IVu.cjs → datepicker-BtEZMsWH.cjs} +1 -1
- package/dist/{datepicker-DMiZ3BBw.js → datepicker-Ct4dbs4e.js} +11 -11
- package/dist/{directive-helpers-2mcpDDv5.cjs → directive-helpers-BushnrQQ.cjs} +1 -1
- package/dist/{directive-helpers-ChEduoup.js → directive-helpers-DpyLJPJm.js} +1 -1
- package/dist/{element-D_mCyFeX.cjs → element-CewjrA4g.cjs} +1 -1
- package/dist/{element-J8nynuVk.js → element-CqC-sGuC.js} +11 -1
- package/dist/{element-with-slot-BOuXlWSY.js → element-with-slot-D_OKDlYo.js} +2 -2
- package/dist/{element-with-slot-C66Jck5e.cjs → element-with-slot-MCvSBwUv.cjs} +1 -1
- package/dist/{fileupload-Y4bDkaD9.cjs → fileupload-BVAgrofy.cjs} +3 -3
- package/dist/{fileupload-C5lxuood.js → fileupload-Dqf_94m2.js} +11 -11
- package/dist/{footer-ByAxlj9_.js → footer-Bf6RFuia.js} +4 -4
- package/dist/{footer-Ca3DM544.cjs → footer-XrX6LFHY.cjs} +1 -1
- package/dist/{header-CP332MCg.cjs → header-DMMt5FtF.cjs} +64 -50
- package/dist/{header-CCJeadiL.js → header-fkKhLsyE.js} +182 -167
- package/dist/{header-menu-CIuu8_UC.js → header-menu-CUHrJCvx.js} +4 -4
- package/dist/{header-menu-B9ABa0WW.cjs → header-menu-DYZsigfH.cjs} +1 -1
- package/dist/{heading-4ZHACOeL.cjs → heading-BDdX4JiM.cjs} +1 -1
- package/dist/{heading-BHWdVbvN.js → heading-ELXWxyTv.js} +2 -2
- package/dist/{helptext-BESB9Vlq.js → helptext-BQkrYsoV.js} +4 -4
- package/dist/{helptext-6HsH-I6a.cjs → helptext-DQe6GO75.cjs} +1 -1
- package/dist/{icon-DkVqRWbC.js → icon-B2v30QUk.js} +1 -1
- package/dist/{icon-BzxBkRyE.cjs → icon-Clz68-Kz.cjs} +1 -1
- package/dist/{if-defined-BILLSM7i.js → if-defined-BNXGXCwT.js} +1 -1
- package/dist/if-defined-CjRKmMQs.cjs +1 -0
- package/dist/{input-element-BWxgs8L-.js → input-element-BTzuDh4h.js} +2 -2
- package/dist/{input-element-PN5nWd1A.cjs → input-element-BdIWsDl-.cjs} +1 -1
- package/dist/{input-wrapper-D64Qn-QH.cjs → input-wrapper-BIrQijWT.cjs} +1 -1
- package/dist/{input-wrapper-Bg06k-cj.js → input-wrapper-CvFMiqIt.js} +6 -6
- package/dist/{link-Bk7aDZCC.cjs → link-1JEWpEDG.cjs} +1 -1
- package/dist/{link-C7fOEv66.js → link-BxKWhYsn.js} +4 -4
- package/dist/{linkcard-Bguo9oCv.js → linkcard-CICSZ7pK.js} +4 -4
- package/dist/{linkcard-rZpQuO1Z.cjs → linkcard-DXOkeQUy.cjs} +1 -1
- package/dist/{listbox-CrQboPG6.js → listbox-DcCrI15L.js} +4 -4
- package/dist/{listbox-kV4OO1Qa.cjs → listbox-DsYaWvLu.cjs} +1 -1
- package/dist/{loader-BAn68gBb.cjs → loader-BA__N62k.cjs} +1 -1
- package/dist/{loader-C3gwO0i3.js → loader-nIl61aTv.js} +4 -4
- package/dist/{messagebox-WH2HjT5I.cjs → messagebox-CdNMgTz4.cjs} +1 -1
- package/dist/{messagebox-DAE59dMX.js → messagebox-D0qxveug.js} +4 -4
- package/dist/{modal-DdC1_qT3.js → modal-D5tGq-nN.js} +5 -5
- package/dist/{modal-DZm_fn3K.cjs → modal-i3Qxv38H.cjs} +1 -1
- 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-DXAAVcBJ.cjs → pkt-options-controller-BClk341e.cjs} +1 -1
- package/dist/{pkt-options-controller-XcIgx_v1.js → pkt-options-controller-v2bPM9iU.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-D1x6MwdY.js → progressbar-4WyR4T72.js} +5 -5
- package/dist/{progressbar-DsE4-qaW.cjs → progressbar-CJFGbev-.cjs} +1 -1
- package/dist/{radiobutton-CnGhAnjp.cjs → radiobutton-BQRtv7PK.cjs} +1 -1
- package/dist/{radiobutton-DWdn1O48.js → radiobutton-D7308uCY.js} +4 -4
- package/dist/{ref-DNowxdYH.js → ref-37-yxmc4.js} +2 -2
- package/dist/{ref-AuNEkS5a.cjs → ref-HT6KRjxp.cjs} +1 -1
- package/dist/{repeat-B3ksuY2F.cjs → repeat-Ddge5HTp.cjs} +1 -1
- package/dist/{repeat-CZ1oMXnW.js → repeat-DntD73oB.js} +2 -2
- package/dist/{searchinput-vi7twt5b.cjs → searchinput-D1cJ73Ki.cjs} +1 -1
- package/dist/{searchinput-CmyWnNr6.js → searchinput-j4IvYRzj.js} +4 -4
- package/dist/{select-CM-CcWab.js → select-B4gbFOil.js} +7 -7
- package/dist/{select-D761TXmv.cjs → select-oIF7UVvV.cjs} +1 -1
- package/dist/shared-strings/nb.d.ts +10 -0
- package/dist/{tabs-hiTrWsXq.cjs → tabs-95BpwB6j.cjs} +1 -1
- package/dist/{tabs-kxsX1ZEf.js → tabs-DexV26qJ.js} +4 -4
- package/dist/{tag-CGlxtBOH.cjs → tag-CQEyjF32.cjs} +1 -1
- package/dist/{tag-bztxjcF0.js → tag-DoUC99hn.js} +5 -5
- package/dist/{textarea-D3SeDZ1r.js → textarea-DGSMKcqK.js} +9 -9
- package/dist/{textarea-4s_SiG0_.cjs → textarea-DNFX958g.cjs} +1 -1
- package/dist/{textinput-uDRbleIa.cjs → textinput-Bzkdo2mN.cjs} +1 -1
- package/dist/{textinput-Dje0Zcsa.js → textinput-DpLeElI_.js} +8 -8
- package/dist/{timepicker--CrfIU_7.js → timepicker-CCNQeX5Q.js} +36 -27
- package/dist/timepicker-DCzhlRuc.cjs +198 -0
- package/package.json +2 -2
- package/src/components/combobox/combobox.ts +12 -0
- package/src/components/fileupload/fileupload.ts +1 -3
- package/src/components/header/header-global.test.ts +8 -0
- package/src/components/header/header-global.ts +13 -2
- package/src/components/header/header-service.test.ts +54 -0
- package/src/components/header/header-service.ts +20 -7
- package/src/components/header/header-user-menu.ts +10 -8
- package/src/components/header/types.ts +3 -2
- package/src/components/helptext/helptext-association.test.ts +108 -0
- package/src/components/timepicker/timepicker.ts +11 -0
- package/dist/combobox-B9Qo7hbt.cjs +0 -137
- package/dist/if-defined-BbUZeoaQ.cjs +0 -1
- package/dist/timepicker-auQ5Y6Et.cjs +0 -196
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,40 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [18.10.0](https://github.com/oslokommune/punkt/compare/18.9.6...18.10.0) (2026-09-21)
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
Ingen
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
Ingen
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
Ingen
|
|
18
|
+
|
|
19
|
+
### Chores
|
|
20
|
+
Ingen
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [18.9.5](https://github.com/oslokommune/punkt/compare/18.9.4...18.9.5) (2026-09-18)
|
|
26
|
+
|
|
27
|
+
### ⚠ BREAKING CHANGES
|
|
28
|
+
Ingen
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
Ingen
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
Ingen
|
|
35
|
+
|
|
36
|
+
### Chores
|
|
37
|
+
Ingen
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
|
|
8
42
|
## [18.9.3](https://github.com/oslokommune/punkt/compare/18.9.2...18.9.3) (2026-09-17)
|
|
9
43
|
|
|
10
44
|
### ⚠ BREAKING CHANGES
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-CewjrA4g.cjs"),t=require("./class-map-B0FX3YsK.cjs"),n=require("./if-defined-CjRKmMQs.cjs"),r=require("./element-with-slot-MCvSBwUv.cjs"),i=require("./consume-Le4HztPo.cjs"),a=require("./ref-HT6KRjxp.cjs");var o=i.r(Symbol(`pkt-accordion-context`)),s=class extends e.c{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(){let r={"pkt-accordion":!0,"pkt-accordion--compact":this.compact,[`pkt-accordion--${this.skin}`]:this.skin};return e._`
|
|
2
2
|
<div
|
|
3
3
|
part="container"
|
|
4
4
|
class=${t.t(r)}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { _ as e, c as t, d as n, l as r, n as i, u as a } from "./element-
|
|
2
|
-
import { t as o } from "./class-map-
|
|
3
|
-
import { t as s } from "./if-defined-
|
|
4
|
-
import { r as c, t as l } from "./element-with-slot-
|
|
1
|
+
import { _ as e, c as t, d as n, l as r, n as i, u as a } from "./element-CqC-sGuC.js";
|
|
2
|
+
import { t as o } from "./class-map-D5GHsely.js";
|
|
3
|
+
import { t as s } from "./if-defined-BNXGXCwT.js";
|
|
4
|
+
import { r as c, t as l } from "./element-with-slot-D_OKDlYo.js";
|
|
5
5
|
import { n as u, r as d, t as f } from "./consume-BDnMAp2g.js";
|
|
6
|
-
import { n as p, t as m } from "./ref-
|
|
6
|
+
import { n as p, t as m } from "./ref-37-yxmc4.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-CewjrA4g.cjs"),t=require("./class-map-B0FX3YsK.cjs"),n=require("./if-defined-CjRKmMQs.cjs"),r=require("./format-B8meU8Tm.cjs"),i=require("./element-with-slot-MCvSBwUv.cjs"),a=require("./classutils-CbklAJDe.cjs"),o=require("./define-component-spec-DBNd2FJY.cjs");require("./icon-Clz68-Kz.cjs"),require("./button-CCR4eyt_.cjs");var s=[`off`,`polite`,`assertive`],c=[`info`,`success`,`warning`,`error`],l=[`medium`,`small`,`xsmall`],u=o.t({name:`pkt-alert`,react:`PktAlert`,"css-class":`pkt-alert`,"dark-mode":!0,isElement:!0,isPureReact:!0,events:{onClose:{reactOnly:!0,description:`React: Klikk-event for 'Lukk'-knappen`},close:{elementsOnly:!0,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:[...c],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:[...s],default:`polite`,category:`accessibility`},size:{name:`Størrelse`,description:`Endrer størrelsen på ulike elementer i alerten.`,type:[...l],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}}}),d=class extends i.t{constructor(){super(),this.compact=u.deprecated.compact.default,this.title=``,this.skin=u.props.skin.default,this.ariaLive=u.props.ariaLive.default,this.ariaLiveAttr=null,this.closeAlert=u.props.closeAlert.default,this.date=null,this.role=`status`,this._hostId=null,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}willUpdate(e){super.willUpdate(e);let t=this.getAttribute(`id`);t&&(this._hostId=t,this.removeAttribute(`id`))}attributeChangedCallback(e,t,n){e===`ariaLive`&&(this.ariaLiveAttr=n),super.attributeChangedCallback(e,t,n)}updated(e){super.updated(e),e.has(`ariaLive`)&&e.get(`ariaLive`)!==void 0&&(this.ariaLiveAttr=this.ariaLive),e.has(`_isClosed`)&&a.t(this,`pkt-hide`,this._isClosed)}render(){let a=this.size??(this.compact?`small`:`medium`),o={"pkt-alert":!0,[`pkt-alert--${a}`]:!0,[`pkt-alert--${this.skin}`]:!0,"pkt-hide":this._isClosed},s={"pkt-alert__grid":!0,"pkt-alert__noTitle":!this.title,"pkt-alert__noDate":!this.date};return e._`
|
|
2
2
|
<div
|
|
3
3
|
class=${t.t(o)}
|
|
4
4
|
id=${n.t(this._hostId||void 0)}
|
|
@@ -1,12 +1,12 @@
|
|
|
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 { t as s } from "./if-defined-
|
|
1
|
+
import { _ as e, d as t, h as n, l as r, n as i, u as a } from "./element-CqC-sGuC.js";
|
|
2
|
+
import { t as o } from "./class-map-D5GHsely.js";
|
|
3
|
+
import { t as s } from "./if-defined-BNXGXCwT.js";
|
|
4
4
|
import { t as c } from "./format-BTeSVkED.js";
|
|
5
|
-
import { r as l, t as u } from "./element-with-slot-
|
|
5
|
+
import { r as l, t as u } from "./element-with-slot-D_OKDlYo.js";
|
|
6
6
|
import { t as d } from "./classutils-DcYnSgfc.js";
|
|
7
7
|
import { t as f } from "./define-component-spec-BYOSeplU.js";
|
|
8
|
-
import "./icon-
|
|
9
|
-
import "./button-
|
|
8
|
+
import "./icon-B2v30QUk.js";
|
|
9
|
+
import "./button-BUl8uWWh.js";
|
|
10
10
|
//#region ../../shared-types/aria.ts
|
|
11
11
|
var p = [
|
|
12
12
|
"off",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { m as e, p as t } from "./element-
|
|
2
|
-
import { i as n } from "./directive-helpers-
|
|
1
|
+
import { m as e, p as t } from "./element-CqC-sGuC.js";
|
|
2
|
+
import { i as n } from "./directive-helpers-DpyLJPJm.js";
|
|
3
3
|
//#region ../../node_modules/lit-html/async-directive.js
|
|
4
4
|
var r = (e, t) => {
|
|
5
5
|
let n = e._$AN;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-CewjrA4g.cjs"),t=require("./directive-helpers-BushnrQQ.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.m.CHILD&&(t._$AP??=o,t._$AQ??=a)},c=class extends e.p{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,6 +1,6 @@
|
|
|
1
|
-
import { _ as e, d as t, n, t as r, u as i } from "./element-
|
|
2
|
-
import { t as a } from "./if-defined-
|
|
3
|
-
import "./icon-
|
|
1
|
+
import { _ as e, d as t, n, t as r, u as i } from "./element-CqC-sGuC.js";
|
|
2
|
+
import { t as a } from "./if-defined-BNXGXCwT.js";
|
|
3
|
+
import "./icon-B2v30QUk.js";
|
|
4
4
|
//#region src/components/backlink/backlink.ts
|
|
5
5
|
var o = class extends r {
|
|
6
6
|
constructor(...e) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-CewjrA4g.cjs"),t=require("./if-defined-CjRKmMQs.cjs");require("./icon-Clz68-Kz.cjs");var n=class extends e.t{constructor(...e){super(...e),this.href=``,this.text=`Forsiden`,this.ariaLabel=null}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._`<nav
|
|
2
2
|
class="pkt-back-link"
|
|
3
3
|
aria-label=${this.ariaLabel||this.pktStrings.get(`backlink`).label}
|
|
4
4
|
>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as e, d as t, h as n, n as r, t as i, u as a } from "./element-
|
|
2
|
-
import "./icon-
|
|
1
|
+
import { _ as e, d as t, h as n, n as r, t as i, u as a } from "./element-CqC-sGuC.js";
|
|
2
|
+
import "./icon-B2v30QUk.js";
|
|
3
3
|
//#region src/components/breadcrumbs/breadcrumbs.ts
|
|
4
4
|
var o = class extends i {
|
|
5
5
|
constructor(...e) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-CewjrA4g.cjs");require("./icon-Clz68-Kz.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.h;let t=this.breadcrumbs[this.breadcrumbs.length-2];return e._`
|
|
2
2
|
<nav class="pkt-breadcrumbs" aria-label=${this.pktStrings.get(`breadcrumbs`).ariaLabel}>
|
|
3
3
|
<ol class="pkt-breadcrumbs__list pkt-breadcrumbs--desktop">
|
|
4
4
|
${this.breadcrumbs.map((t,n)=>n===this.breadcrumbs.length-1?e._`
|
|
@@ -1,8 +1,8 @@
|
|
|
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 { t as s } from "./if-defined-
|
|
4
|
-
import { r as c, t as l } from "./element-with-slot-
|
|
5
|
-
import "./icon-
|
|
1
|
+
import { _ as e, d as t, h as n, l as r, n as i, u as a } from "./element-CqC-sGuC.js";
|
|
2
|
+
import { t as o } from "./class-map-D5GHsely.js";
|
|
3
|
+
import { t as s } from "./if-defined-BNXGXCwT.js";
|
|
4
|
+
import { r as c, t as l } from "./element-with-slot-D_OKDlYo.js";
|
|
5
|
+
import "./icon-B2v30QUk.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-CewjrA4g.cjs"),t=require("./class-map-B0FX3YsK.cjs"),n=require("./if-defined-CjRKmMQs.cjs"),r=require("./element-with-slot-MCvSBwUv.cjs");require("./icon-Clz68-Kz.cjs");var i=`https://punkt-cdn.oslo.kommune.no/latest/animations/`;typeof window<`u`&&(window.pktAnimationPath=window.pktAnimationPath||i);var a=class a extends r.t{constructor(...e){super(...e),this.iconName=`user`,this.secondIconName=`user`,this.size=`medium`,this.fullWidth=!1,this.fullWidthOnMobile=!1,this.skin=`primary`,this.variant=`label-only`,this.state=void 0,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`,`aria-label`,`tabindex`]}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,a={"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--isLoading":!!this.isLoading};return e._`
|
|
2
2
|
<button
|
|
3
3
|
class=${t.t(a)}
|
|
4
4
|
type=${this.type}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-CewjrA4g.cjs"),t=require("./class-map-B0FX3YsK.cjs");require("./icon-Clz68-Kz.cjs");const n=require("./converters-BJ9Fe0kW.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={multiple:!1,maxMultiple:0,range:!1,earliest:null,latest:null,weeknumbers:!1,withcontrols:!1};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.multiple,this.maxMultiple=s.maxMultiple,this.range=s.range,this.earliest=s.earliest,this.latest=s.latest,this.excludedates=[],this.excludeweekdays=[],this.weeknumbers=s.weeknumbers,this.withcontrols=s.withcontrols,this.currentmonth=null,this.today=null,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 calendarStrings(){let e=this.pktStrings.get(`dates`),t=this.pktStrings.get(`calendar`);return{daysShort:this.dayStrings??e.daysShort,days:this.dayStringsLong??e.days,months:this.monthStrings??e.months,week:this.weekString??e.week,prevMonth:this.prevMonthString??t.prevMonth,nextMonth:this.nextMonthString??t.nextMonth}}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._`
|
|
2
2
|
<div
|
|
3
3
|
class="pkt-calendar ${this.weeknumbers?`pkt-cal-weeknumbers`:``}"
|
|
4
4
|
@focusout=${this.closeEvent}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { _ as e, d as t, h as n, l as r, n as i, t as a, u as o } from "./element-
|
|
2
|
-
import { t as s } from "./class-map-
|
|
3
|
-
import "./icon-
|
|
1
|
+
import { _ as e, d as t, h as n, l as r, n as i, t as a, u as o } from "./element-CqC-sGuC.js";
|
|
2
|
+
import { t as s } from "./class-map-D5GHsely.js";
|
|
3
|
+
import "./icon-B2v30QUk.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-CkjLSYpa.js";
|
|
5
5
|
//#region ../../node_modules/date-fns/addDays.js
|
|
6
6
|
function x(e, t, n) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { _ as e, d as t, h as n, n as r, u as i } from "./element-
|
|
2
|
-
import { t as a } from "./class-map-
|
|
3
|
-
import { t as o } from "./if-defined-
|
|
4
|
-
import { r as s, t as c } from "./element-with-slot-
|
|
5
|
-
import "./icon-
|
|
6
|
-
import "./tag-
|
|
1
|
+
import { _ as e, d as t, h as n, n as r, u as i } from "./element-CqC-sGuC.js";
|
|
2
|
+
import { t as a } from "./class-map-D5GHsely.js";
|
|
3
|
+
import { t as o } from "./if-defined-BNXGXCwT.js";
|
|
4
|
+
import { r as s, t as c } from "./element-with-slot-D_OKDlYo.js";
|
|
5
|
+
import "./icon-B2v30QUk.js";
|
|
6
|
+
import "./tag-DoUC99hn.js";
|
|
7
7
|
//#region ../../shared-types/card.ts
|
|
8
8
|
var l = [
|
|
9
9
|
"outlined",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-CewjrA4g.cjs"),t=require("./class-map-B0FX3YsK.cjs"),n=require("./if-defined-CjRKmMQs.cjs"),r=require("./element-with-slot-MCvSBwUv.cjs");require("./icon-Clz68-Kz.cjs"),require("./tag-CQEyjF32.cjs");var i=[`outlined`,`outlined-beige`,`gray`,`blue`,`beige`,`green`],a={headingLevel:3,layout:`vertical`,skin:`outlined`,padding:`default`,tagPosition:`top`,openLinkInNewTab:!1,borderOnHover:!0,zoom:!1,imageShape:`square`,restrictImageHeight:!1},o=class extends r.t{constructor(...e){super(...e),this.ariaLabel=``,this.metaLead=null,this.borderOnHover=a.borderOnHover,this.zoom=a.zoom,this.imageAspect=null,this.restrictImageHeight=a.restrictImageHeight,this.clickCardLink=null,this.metaTrail=null,this.layout=a.layout,this.heading=``,this.headingLevel=a.headingLevel,this.image={src:``,alt:``},this.imageShape=a.imageShape,this.openLinkInNewTab=a.openLinkInNewTab,this.padding=a.padding,this.skin=a.skin,this.subheading=``,this.tagPosition=`top`,this.tags=[]}connectedCallback(){super.connectedCallback()}render(){let r={"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,"pkt-card--zoom":this.zoom},i=this.ariaLabel?.trim()||(this.heading?`${this.heading} lenkekort`:`lenkekort`),a=this.ariaLabel?.trim()||(this.heading?this.heading:`kort`);return e._`
|
|
2
2
|
<article
|
|
3
3
|
class=${t.t(r)}
|
|
4
4
|
aria-label=${n.t(this.clickCardLink?i:a)}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { _ as e, d as t, h as n, n as r, u 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 { _ as e, d as t, h as n, n as r, u as i } from "./element-CqC-sGuC.js";
|
|
2
|
+
import { t as a } from "./class-map-D5GHsely.js";
|
|
3
|
+
import { n as o, t as s } from "./ref-37-yxmc4.js";
|
|
4
|
+
import { t as c } from "./input-element-BTzuDh4h.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-CewjrA4g.cjs"),t=require("./class-map-B0FX3YsK.cjs"),n=require("./ref-HT6KRjxp.cjs"),r=require("./input-element-BdIWsDl-.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.requiredTag=!1}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){this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate===``||this.indeterminate===`true`||this.indeterminate===!0),super.firstUpdated(e)}willUpdate(e){super.willUpdate(e),e.has(`defaultChecked`)&&!this.checked&&(this.checked=this.defaultChecked)}updated(e){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=`pkt-tag pkt-tag--small pkt-tag--thin-text`,s=this.pktStrings.get(`forms`),c=()=>e._`
|
|
2
2
|
${this.tagText?e._`<span class=${o+` pkt-tag--gray`}>${this.tagText}</span>`:e.h}
|
|
3
3
|
${this.optionalTag?e._`<span class=${o+` pkt-tag--blue-light`}
|
|
4
4
|
>${this.optionalText??s.optional}</span
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./element-
|
|
1
|
+
const e=require("./element-CewjrA4g.cjs");var t=e.f(class extends e.p{constructor(t){if(super(t),t.type!==e.m.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.g}});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
const e=require("./element-CewjrA4g.cjs"),t=require("./class-map-B0FX3YsK.cjs"),n=require("./if-defined-CjRKmMQs.cjs"),r=require("./format-B8meU8Tm.cjs"),i=require("./element-with-slot-MCvSBwUv.cjs");require("./icon-Clz68-Kz.cjs");const a=require("./ref-HT6KRjxp.cjs");require("./tag-CQEyjF32.cjs");const o=require("./repeat-Ddge5HTp.cjs"),s=require("./listbox-DsYaWvLu.cjs"),c=require("./input-element-BdIWsDl-.cjs"),l=require("./pkt-options-controller-BClk341e.cjs"),u=require("./input-wrapper-BIrQijWT.cjs");var d=(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}},f=(e,t,n,r,i)=>{if(!e)return{action:`none`,value:null};let a=s.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}},p=(e,t,n,r,i)=>e.trim().toLowerCase()?{...s.c(e,t,n,r),shouldRemoveValue:!1,shouldResetInput:!1}:{addValueText:null,userInfoMessage:``,shouldRemoveValue:!i&&!!t[0],shouldResetInput:!0},m=(e,t,n)=>{let r=s.i(t,e);return n===`label`&&r?.label?r.label:e},h={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)}},g={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=s.r(n),t.push(n)}),t}},_={cloneOptions(e){return Array.isArray(e)?e.map(e=>({...e})):[]},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=s.r(e),e.selected=e.selected||n.includes(e.value)}),{options:e,newValues:n}},mergeWithUserAdded(e,t,n){return[...t.filter(e=>e?.userAdded&&n.includes(e.value)).filter(t=>!(Array.isArray(e)?e:[]).some(e=>e.value===t.value)),...e]}},v={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`},form:{name:`Skjema`,description:`ID-en til skjemaet feltet hører til, når feltet ligger utenfor skjemaet`,type:`string`,required:!1,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:{attribute:`helptextdropdown`,type:`string`,name:`Utvidet hjelpetekst`,description:`Hjelpetekst som vises i en lukket boks man kan åpne`,category:`contents`},helptextDropdownButton:{attribute:`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:{attribute:`haserror`,type:`boolean`,name:`Feil`,description:`Feltet har en feil`,category:`ui`},errorMessage:{attribute:`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:{attribute:`requiredtag`,type:`boolean`,name:`Påkrevd-merking`,description:`Viser en merking som indikerer at feltet er påkrevd`,category:`ui`},requiredText:{attribute:`requiredtext`,type:`string`,name:`Påkrevd-tekst`,description:`Tekst som vises i påkrevd-merkingen`,category:`contents`},optionalTag:{attribute:`optionaltag`,type:`boolean`,name:`Valgfritt-merking`,description:`Viser en merking som indikerer at feltet er valgfritt`,category:`ui`},optionalText:{attribute:`optionaltext`,type:`string`,name:`Valgfritt-tekst`,description:`Tekst som vises i valgfritt-merkingen`,category:`contents`},tagText:{attribute:`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:{attribute:`usewrapper`,name:`Bruk wrapper`,type:`boolean`,required:!1,displayAsFalse:!0,default:!0,description:`Indikerer om skjemaelementet skal bruke en wrapper`,category:`ui`},hasFieldset:{attribute:`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`},defaultValue:{attribute:`defaultvalue`,type:`string | string[]`,name:`Standardverdi`,description:`Verdien feltet får ved oppstart og ved nullstilling av skjemaet`,category:`functionality`}},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`}}},y=class extends c.t{constructor(){super(),this.value=``,this.options=[],this.defaultOptions=[],this.allowUserInput=!1,this.typeahead=!1,this.includeSearch=!1,this.searchPlaceholder=null,this.multiple=!1,this.maxlength=null,this.displayValueAs=v.props.displayValueAs.default,this.tagPlacement=null,this.isOpen=!1,this._options=[],this._value=[],this._isOptionsOpen=!1,this._userInfoMessage=``,this._messageValue=null,this._addValueText=null,this._maxIsReached=!1,this._search=``,this._inputFocus=!1,this._skipInputTab=!1,this._optionsFromSlot=!1,this._lastSlotGeneration=0,this._suppressNextOpen=!1,this.inputRef=a.t(),this.triggerRef=a.t(),this.listboxRef=a.t(),this._pendingDispatchFrom=null,this.optionsController=new l.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()}focusAfterCommit(){this._skipInputTab=!0;let e=this.inputRef.value;e&&e.type!==`hidden`&&e.setAttribute(`tabindex`,`-1`),this.triggerRef.value?.focus()}restoreInputTab(){this._skipInputTab=!1}parseValue(){return this.parseToValues(this.value)}parseToValues(e){return Array.isArray(e)?this.multiple?e:e.length>0?[e[0]]:[]:e&&this.multiple?e.split(`,`):e?[e]:[]}updateMaxReached(){this._maxIsReached=s.l(this._value.length,this.maxlength)}syncPublicValue(){let e=this.multiple?this._value.join(`,`):this._value[0]||``;e!==(Array.isArray(this.value)?this.value.join(`,`):String(this.value||``))&&(this.value=e)}dispatchValueChange(e){let t=this._value;if(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})],y.prototype,`value`,void 0),e.n([e.u({type:Array})],y.prototype,`options`,void 0),e.n([e.u({type:Array,attribute:`default-options`})],y.prototype,`defaultOptions`,void 0),e.n([e.u({type:Boolean,attribute:`allow-user-input`})],y.prototype,`allowUserInput`,void 0),e.n([e.u({type:Boolean})],y.prototype,`typeahead`,void 0),e.n([e.u({type:Boolean,attribute:`include-search`})],y.prototype,`includeSearch`,void 0),e.n([e.u({type:String,attribute:`search-placeholder`})],y.prototype,`searchPlaceholder`,void 0),e.n([e.u({type:Boolean})],y.prototype,`multiple`,void 0),e.n([e.u({type:Number})],y.prototype,`maxlength`,void 0),e.n([e.u({type:String,attribute:`display-value-as`})],y.prototype,`displayValueAs`,void 0),e.n([e.u({type:String,attribute:`tag-placement`})],y.prototype,`tagPlacement`,void 0),e.n([e.u({type:Boolean,attribute:`open`})],y.prototype,`isOpen`,void 0),e.n([e.l()],y.prototype,`_options`,void 0),e.n([e.l()],y.prototype,`_value`,void 0),e.n([e.l()],y.prototype,`_isOptionsOpen`,void 0),e.n([e.l()],y.prototype,`_userInfoMessage`,void 0),e.n([e.l()],y.prototype,`_messageValue`,void 0),e.n([e.l()],y.prototype,`_addValueText`,void 0),e.n([e.l()],y.prototype,`_maxIsReached`,void 0),e.n([e.l()],y.prototype,`_search`,void 0),e.n([e.l()],y.prototype,`_inputFocus`,void 0),e.n([e.l()],y.prototype,`_skipInputTab`,void 0);var b=class extends y{toggleValue(e){if(this.disabled)return;this.touched=!0,this._userInfoMessage=``,this._addValueText=null;let t=s.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(),o=!this.multiple,c=this.multiple,l=s.l(this._value.length,this.maxlength),u=!1,d=!0,f=``,p=null,h=``;i||(!r&&this.allowUserInput&&!a?(this.addNewUserValue(e),f=`valueAdded`,u=c):!r&&!this.allowUserInput?(o&&this._value[0]&&this.removeValue(this._value[0]),d=!1,u=!0,f=`noResults`):n?(this.removeValue(t),u=!0,o&&this._hasTextInput&&this.inputRef.value&&this.inputRef.value.type!==`hidden`&&(this.inputRef.value.value=``)):a&&o?(this.removeAllSelected(),u=!0):o?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(t),u=!1,f=`valueSelected`,p=this._hasTextInput?m(t||``,this.options,this.displayValueAs):s.s(s.i(this.options,t),this.displayValueAs)):c&&!l?(this.setSelected(t),u=!0):c&&l?(f=`maxSelected`,d=!1,h=e):(o&&this.removeAllSelected(),f=`noValidValue`,d=!1,u=!0,h=e),this._isOptionsOpen=u,u||window.setTimeout(()=>{this.focusAfterCommit()},0),this._search=h||``,this.resetComboboxInput(d),this._userInfoMessage=f,this._messageValue=p,c&&this.updateMaxReached())}setSelected(e){if(!this._value.includes(e)){if(this.multiple&&s.l(this._value.length,this.maxlength)){this._userInfoMessage=`maxSelected`;return}!this.multiple&&this.removeAllSelected(),this._value=e?[...this._value,e]:this._value,h.markOptionSelected(this._options,e),this.resetComboboxInput(!0)}}removeSelected(e){if(!e)return;this._value=this._value.filter(t=>t!==e);let t=s.i(this.options,e);t&&(h.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),h.markAllSelected(this._options),this.requestUpdate()}}removeAllSelected(){this._value=[],h.markAllDeselected(this._options),this._options=h.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(!s.i(this.options,e)){if(s.l(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,window.setTimeout(()=>{this.focusAfterCommit()},0)),this.requestUpdate()}refreshOptionsFromValue(){let e=_.cloneOptions(this.options);e.forEach(e=>e.selected=this._value.includes(e.value)),this._options=_.syncOptionsWithValues(e,this._value).options}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]?m(this._value[0],this.options,this.displayValueAs):``,this._userInfoMessage=``)),this.refreshOptionsFromValue()}removeLastValue(e){if(this._value.length===0)return;e.preventDefault();let t=this._value[this._value.length-1];t&&this.removeSelected(t),this.updateMaxReached()}},x=class extends b{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}=s.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.refreshOptionsFromValue()}}handleFocus(){if(!this.disabled){if(this._skipInputTab=!1,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=m(this._value[0],this.options,this.displayValueAs)),this._inputFocus=!0,this._search=``,this.refreshOptionsFromValue(),this._isOptionsOpen=!0,this.onFocus(),this.requestUpdate()}}handleCloseOptions(){this._isOptionsOpen=!1,this._hasTextInput&&(this._suppressNextOpen=!0),this.focusTrigger()}handleFocusOut(e){if(this.disabled||!this._isOptionsOpen)return;let t=e.relatedTarget;t?.closest(`pkt-combobox`)?.id===this.id||e.target?.classList?.contains(`pkt-combobox__value`)||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=s.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}=f(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=m(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=d(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=p(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}},S=class extends x{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=_.cloneOptions(this.options)}if(this.optionsController?.nodes&&this.optionsController.nodes.length){let e=g.parseOptionsFromSlot(this.optionsController.nodes);e.length&&(this.options=[...e],this._options=[...e],this._optionsFromSlot=!0,this._lastSlotGeneration=this.optionsController.generation)}}disconnectedCallback(){super.disconnectedCallback(),document?.body.removeEventListener(`click`,this.handleBodyClick)}firstUpdated(e){this.defaultValue!==null&&!this.value&&(this.value=this.defaultValue),super.firstUpdated(e)}willUpdate(e){if(this._optionsFromSlot&&this.optionsController){let e=this.optionsController.generation;if(e!==this._lastSlotGeneration){this._lastSlotGeneration=e;let t=g.parseOptionsFromSlot(this.optionsController.nodes),n=this._options.filter(e=>e.userAdded);this.options=[...n,...t]}}if(super.willUpdate(e),e.has(`isOpen`)&&(this._isOptionsOpen=this.isOpen),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=_.cloneOptions(this.options)}let t=e.has(`value`),n=e.has(`_value`);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=[...this._options]),this._pendingDispatchFrom??=e}else n&&(this._pendingDispatchFrom??=e.get(`_value`)??[]);if(e.has(`defaultValue`)&&this.defaultValue!=null&&!this._value.length){let e=this.parseToValues(this.defaultValue);e.length&&(this._pendingDispatchFrom??=[...this._value],this._value=e,this._options.forEach(t=>t.selected=e.includes(t.value)),this._options=[...this._options])}if(e.has(`options`)){let t=e.get(`options`)||this._options||[],n=_.mergeWithUserAdded(_.cloneOptions(this.options),t,this._value);this._options=n,n.length>this.options.length&&(this.options=n);let r=_.syncOptionsWithValues(this._options,this._value);this._options=r.options,r.newValues.length>this._value.length&&(this._pendingDispatchFrom??=[...this._value],this._value=r.newValues)}(t||n||e.has(`options`)||e.has(`defaultValue`))&&this.updateMaxReached(),this._pendingDispatchFrom&&this.syncPublicValue()}updated(e){if(this._pendingDispatchFrom){let e=this._pendingDispatchFrom;this._pendingDispatchFrom=null,this.dispatchValueChange(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]?m(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=_.cloneOptions(this.options);let e=_.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
|
+
<pkt-input-wrapper
|
|
3
|
+
.strings=${this.strings}
|
|
4
|
+
.size=${this.inputSize}
|
|
5
|
+
.label=${this.label}
|
|
6
|
+
.helptext=${this.helptext}
|
|
7
|
+
.helptextDropdown=${n.t(this.helptextDropdown)}
|
|
8
|
+
.helptextDropdownButton=${n.t(this.helptextDropdownButton)}
|
|
9
|
+
?fullwidth=${this.fullwidth}
|
|
10
|
+
?counter=${this.effectiveCounter(!!this.multiple&&this.maxlength!=null)}
|
|
11
|
+
.counterCurrent=${this._value.length}
|
|
12
|
+
.counterMaxLength=${this.maxlength??0}
|
|
13
|
+
?hasError=${this.hasError}
|
|
14
|
+
?inline=${this.inline}
|
|
15
|
+
?disabled=${this.disabled}
|
|
16
|
+
.errorMessage=${this.errorMessage}
|
|
17
|
+
?optionalTag=${this.optionalTag}
|
|
18
|
+
.optionalText=${this.optionalText}
|
|
19
|
+
?requiredTag=${this.requiredTag}
|
|
20
|
+
.requiredText=${this.requiredText}
|
|
21
|
+
.tagText=${this.tagText}
|
|
22
|
+
useWrapper=${this.useWrapper}
|
|
23
|
+
.forId=${this._hasTextInput?this.id+`-input`:this.id+`-combobox`}
|
|
24
|
+
?hasFieldset=${this.effectiveHasFieldset(!this._hasTextInput)}
|
|
25
|
+
class="pkt-combobox__wrapper"
|
|
26
|
+
@labelClick=${this.handleInputClick}
|
|
27
|
+
>
|
|
28
|
+
<div class="pkt-contents" slot="helptext">${i.r(this,`helptext`)}</div>
|
|
29
|
+
<div class="pkt-combobox" @focusout=${this.handleFocusOut}>
|
|
30
|
+
<div
|
|
31
|
+
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})}
|
|
32
|
+
id=${n.t(this._hasTextInput?void 0:`${this.id}-combobox`)}
|
|
33
|
+
role=${n.t(this._hasTextInput?void 0:`combobox`)}
|
|
34
|
+
aria-expanded=${n.t(this._hasTextInput?void 0:this._isOptionsOpen?`true`:`false`)}
|
|
35
|
+
aria-controls=${n.t(this._hasTextInput?void 0:`${this.id}-listbox`)}
|
|
36
|
+
aria-haspopup=${n.t(this._hasTextInput?void 0:`listbox`)}
|
|
37
|
+
aria-describedby=${n.t(this._hasTextInput?void 0:this._describedBy())}
|
|
38
|
+
aria-labelledby=${n.t(this._hasTextInput?void 0:`${this.id}-combobox-label`)}
|
|
39
|
+
aria-activedescendant=${n.t(!this._hasTextInput&&this._isOptionsOpen&&this._value[0]&&s.i(this.options,this._value[0])?`${this.id}-listbox-${s.a(this._options,this._value[0])}`:void 0)}
|
|
40
|
+
aria-description=${n.t(this._selectionDescription||void 0)}
|
|
41
|
+
tabindex=${this._hasTextInput||this.disabled?`-1`:`0`}
|
|
42
|
+
@click=${this.handleInputClick}
|
|
43
|
+
@keydown=${this._hasTextInput?e.h:this.handleSelectOnlyKeydown}
|
|
44
|
+
@blur=${this.restoreInputTab}
|
|
45
|
+
${a.n(this.triggerRef)}
|
|
46
|
+
>
|
|
47
|
+
${!this._hasTextInput&&this.placeholder&&(!this._value.length||this.multiple&&this.tagPlacement==`outside`)&&!this._inputFocus?e._`<span class="pkt-combobox__placeholder" @click=${this.handlePlaceholderClick}
|
|
48
|
+
>${this.placeholder}</span
|
|
49
|
+
>`:this.tagPlacement===`outside`?e.h:this.renderSingleOrMultipleValues()}
|
|
50
|
+
${this.renderInputField()}
|
|
51
|
+
<pkt-icon
|
|
52
|
+
class=${t.t({"pkt-combobox__arrow-icon":!0,"pkt-combobox__arrow-icon--open":this._isOptionsOpen})}
|
|
53
|
+
name="chevron-thin-down"
|
|
54
|
+
aria-hidden="true"
|
|
55
|
+
></pkt-icon>
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
<pkt-listbox
|
|
59
|
+
id="${this.id}-listbox"
|
|
60
|
+
.options=${this._options}
|
|
61
|
+
.isOpen=${this._isOptionsOpen}
|
|
62
|
+
.searchPlaceholder=${this.searchPlaceholder}
|
|
63
|
+
.label="Liste: ${this.label||``}"
|
|
64
|
+
?disabled=${this.disabled}
|
|
65
|
+
?include-search=${this.includeSearch}
|
|
66
|
+
?is-multi-select=${this.multiple}
|
|
67
|
+
?allow-user-input=${this.allowUserInput&&!this._maxIsReached}
|
|
68
|
+
?max-is-reached=${this._maxIsReached}
|
|
69
|
+
.customUserInput=${n.t(this._addValueText)}
|
|
70
|
+
.userMessage=${this._userInfoMessage?r.t(this.pktStrings.get(`combobox`)[this._userInfoMessage],{value:this._messageValue??``}):``}
|
|
71
|
+
@search=${this.handleSearch}
|
|
72
|
+
@option-toggle=${this.handleOptionToggled}
|
|
73
|
+
@select-all=${this.addAllOptions}
|
|
74
|
+
@close-options=${this.handleCloseOptions}
|
|
75
|
+
@tab-close=${()=>this.closeAndProcessInput()}
|
|
76
|
+
.searchValue=${this._search||null}
|
|
77
|
+
.maxLength=${this.maxlength||0}
|
|
78
|
+
${a.n(this.listboxRef)}
|
|
79
|
+
></pkt-listbox>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
${this.tagPlacement===`outside`&&this.multiple?e._`<div class="pkt-combobox__tags-outside">
|
|
83
|
+
${this.renderSingleOrMultipleValues()}
|
|
84
|
+
</div>`:e.h}
|
|
85
|
+
</pkt-input-wrapper>
|
|
86
|
+
`}_describedBy(){return u.r({id:this._hasTextInput?`${this.id}-input`:`${this.id}-combobox`,hasHelptext:!!this.helptext,ariaDescribedby:this.ariaDescribedby})}renderInputField(){return this.typeahead||this.allowUserInput?e._`
|
|
87
|
+
<div class="pkt-combobox__input-div combobox__input">
|
|
88
|
+
<input
|
|
89
|
+
type="text"
|
|
90
|
+
id="${this.id}-input"
|
|
91
|
+
name=${(this.name||this.id)+`-input`}
|
|
92
|
+
placeholder=${n.t(!this._value.length||this.multiple&&this.tagPlacement===`outside`?this.placeholder:void 0)}
|
|
93
|
+
@input=${this.handleInput}
|
|
94
|
+
@change=${e=>{e.stopPropagation(),e.stopImmediatePropagation()}}
|
|
95
|
+
tabindex=${n.t(this._skipInputTab?`-1`:void 0)}
|
|
96
|
+
@keydown=${this.handleInputKeydown}
|
|
97
|
+
@focus=${this.handleFocus}
|
|
98
|
+
@blur=${this.handleBlur}
|
|
99
|
+
autocomplete="off"
|
|
100
|
+
role="combobox"
|
|
101
|
+
aria-expanded=${this._isOptionsOpen?`true`:`false`}
|
|
102
|
+
aria-label=${n.t(this.label)}
|
|
103
|
+
aria-describedby=${n.t(this._describedBy())}
|
|
104
|
+
aria-autocomplete=${this.typeahead?`both`:this.allowUserInput?`list`:`none`}
|
|
105
|
+
aria-controls="${this.id}-listbox"
|
|
106
|
+
aria-activedescendant=${n.t(this._isOptionsOpen&&this._value[0]&&s.i(this.options,this._value[0])?`${this.id}-listbox-${s.a(this._options,this._value[0])}`:void 0)}
|
|
107
|
+
aria-description=${n.t(this._selectionDescription||void 0)}
|
|
108
|
+
${a.n(this.inputRef)}
|
|
109
|
+
/>
|
|
110
|
+
</div>
|
|
111
|
+
`:e._`
|
|
112
|
+
<input
|
|
113
|
+
type="hidden"
|
|
114
|
+
id="${this.id}-input"
|
|
115
|
+
name=${(this.name||this.id)+`-input`}
|
|
116
|
+
.value=${this._value.join(`,`)}
|
|
117
|
+
${a.n(this.inputRef)}
|
|
118
|
+
/>
|
|
119
|
+
`}renderSingleOrMultipleValues(){if(!this.multiple&&this._hasTextInput)return e.h;let t=!this.multiple,n=this.renderValueTag(s.i(this.options,this._value[0])),r=this.tagPlacement===`outside`,i=e._`
|
|
120
|
+
<ul role="list" class="pkt-combobox__tag-list">
|
|
121
|
+
${o.t(this._value,e=>e,(t,n)=>{let i=s.i(this.options,t),a=i?.tagSkinColor;return e._`
|
|
122
|
+
<li
|
|
123
|
+
role="listitem"
|
|
124
|
+
@click=${r?e.h:e=>e.stopPropagation()}
|
|
125
|
+
@mousedown=${r?e.h:e=>e.preventDefault()}
|
|
126
|
+
>
|
|
127
|
+
<pkt-tag
|
|
128
|
+
skin=${a||`blue-dark`}
|
|
129
|
+
?closeTag=${!this.disabled}
|
|
130
|
+
.buttonTabindex=${r?void 0:-1}
|
|
131
|
+
@close=${()=>this.handleTagRemove(t)}
|
|
132
|
+
@keydown=${r?e.h:e=>this.handleTagKeydown(e,n)}
|
|
133
|
+
>
|
|
134
|
+
${this.renderValueTag(i)}
|
|
135
|
+
</pkt-tag>
|
|
136
|
+
</li>
|
|
137
|
+
`})}
|
|
138
|
+
</ul>
|
|
139
|
+
`;return!t&&this._value.length===0?e.h:t?n:i}renderValueTag(t){if(!t)return``;switch(this.displayValueAs){case`prefixAndValue`:return e._`<span class="pkt-combobox__value">${t.prefix||``} ${t.value}</span>`;case`value`:return e._`<span class="pkt-combobox__value">${t.value}</span>`;default:return e._`<span class="pkt-combobox__value">${t.label||t.value}</span>`}}};try{e.d(`pkt-combobox`)(S)}catch{console.warn(`Forsøker å definere <pkt-combobox>, men den er allerede definert`)}var C=S;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return C}});
|