@oslokommune/punkt-elements 16.0.5 → 16.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 +17 -0
- package/dist/{accordionitem-CHXGzgLv.js → accordionitem-Cj74XruR.js} +31 -31
- package/dist/accordionitem-D7sWqDM_.cjs +34 -0
- package/dist/alert-C95U_RZ0.cjs +33 -0
- package/dist/{alert-BHSd2Vpj.js → alert-ca_hFi-u.js} +19 -20
- package/dist/async-directive-B158h3ba.cjs +5 -0
- package/dist/async-directive-CKx6pubI.js +65 -0
- package/dist/{button-CHUuxLQV.js → button-BRovt5nm.js} +10 -11
- package/dist/button-BXN_JPaH.cjs +27 -0
- package/dist/{card-Db9QSEqh.cjs → card-DfHo45CG.cjs} +11 -13
- package/dist/{card-CmfUyl_s.js → card-DvgCTN4B.js} +47 -51
- package/dist/{checkbox-D6nltMuc.js → checkbox-CbIUMIYt.js} +2 -2
- package/dist/{checkbox-Cpyay9_l.cjs → checkbox-mmn3v9ry.cjs} +1 -1
- package/dist/{combobox-TKTemUxN.js → combobox-CwW0md6G.js} +31 -31
- package/dist/combobox-TKL44xnV.cjs +135 -0
- package/dist/{consent-BQLkfN3d.cjs → consent-CIhFwuFO.cjs} +1 -1
- package/dist/{consent-knPF4PS_.js → consent-CgS1L1xF.js} +1 -1
- package/dist/{datepicker-CPNcXd-o.cjs → datepicker-oN9L0Wnm.cjs} +14 -14
- package/dist/{datepicker-MuQYeXhL.js → datepicker-qRWWzmbo.js} +51 -51
- package/dist/element-with-slot-1djk8KXi.js +240 -0
- package/dist/element-with-slot-yT8k1Z37.cjs +1 -0
- package/dist/helptext-B366oeR9.cjs +24 -0
- package/dist/{helptext-TFpeGJ1P.js → helptext-DepcDYFV.js} +32 -39
- package/dist/index.d.ts +39 -90
- package/dist/input-element-Xe9FTi2a.cjs +1 -0
- package/dist/{input-element-BGNbdzy2.js → input-element-n5U38pZ1.js} +8 -7
- package/dist/{input-wrapper-CaUY90qz.js → input-wrapper-B__6jW4U.js} +25 -28
- package/dist/{input-wrapper-JU4D2TGu.cjs → input-wrapper-BdFdJU-k.cjs} +7 -9
- package/dist/link-DLjXMpvi.cjs +7 -0
- package/dist/link-oGYvBLYL.js +53 -0
- package/dist/linkcard-BhVIc18n.js +54 -0
- package/dist/linkcard-C20WC6Nw.cjs +13 -0
- package/dist/{loader-BF9K1VCZ.js → loader-BHt9i5Xp.js} +12 -13
- package/dist/{loader-C1LI8Q4z.cjs → loader-DxAGCcNF.cjs} +2 -2
- package/dist/messagebox-B8LW0PSQ.cjs +13 -0
- package/dist/messagebox-DkspcMQg.js +69 -0
- package/dist/modal-Bfk_ncLQ.cjs +36 -0
- package/dist/{modal-CGHWsjk8.js → modal-p1rvuP8e.js} +26 -27
- package/dist/pkt-accordion.cjs +1 -1
- package/dist/pkt-accordion.js +2 -2
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +1 -1
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.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 +2 -2
- package/dist/pkt-header.cjs +16 -17
- package/dist/pkt-header.js +62 -69
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +22 -22
- 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-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-DIeKSpWv.cjs +1 -0
- package/dist/{pkt-options-controller-Z-bPox7n.js → pkt-options-controller-W4ITGQy9.js} +1 -1
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +2 -2
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.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 +2 -2
- 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/{progressbar-Bxh335uT.cjs → progressbar-CC9Qr82_.cjs} +1 -1
- package/dist/{progressbar-GSA4Md1u.js → progressbar-CcX-xiPI.js} +1 -1
- package/dist/{radiobutton-CNHCpKn0.cjs → radiobutton-BUDQYAH-.cjs} +1 -1
- package/dist/{radiobutton-DgC27mb0.js → radiobutton-RW3h0tJj.js} +2 -2
- package/dist/ref-DBGHvw2G.js +42 -0
- package/dist/ref-DahIePMT.cjs +5 -0
- package/dist/select-PuEeK4jQ.cjs +49 -0
- package/dist/{select-7VuYtPZv.js → select-iXKeM3yz.js} +37 -37
- package/dist/{tabitem-DQRzgAT4.js → tabitem-DZSzwag2.js} +30 -30
- package/dist/{tabitem-BKv4eN0a.cjs → tabitem-Jenus4Qd.cjs} +13 -13
- package/dist/{tag-DZPqFiem.js → tag-CIWBLpjv.js} +17 -18
- package/dist/tag-DeE1OpmF.cjs +27 -0
- package/dist/{textarea-VpCEjVFx.js → textarea-DR9lVDN-.js} +13 -13
- package/dist/{textarea-CO7Ikug5.cjs → textarea-DtiYQWjy.cjs} +7 -7
- package/dist/{textinput-C2AZ9ss2.js → textinput-0Bttvt9V.js} +22 -22
- package/dist/{textinput-DRFZU3dA.cjs → textinput-cKrjvbJW.cjs} +9 -9
- package/package.json +2 -2
- package/src/components/accordion/accordionitem.ts +4 -6
- package/src/components/alert/alert.ts +4 -8
- package/src/components/button/button.ts +4 -12
- package/src/components/card/card.ts +4 -19
- package/src/components/combobox/combobox-base.ts +0 -5
- package/src/components/combobox/combobox-utils.ts +1 -1
- package/src/components/combobox/combobox.ts +2 -1
- package/src/components/datepicker/datepicker.ts +2 -8
- package/src/components/header/header-service.ts +5 -19
- package/src/components/header/header.ts +4 -13
- package/src/components/helptext/helptext.test.ts +2 -12
- package/src/components/helptext/helptext.ts +5 -19
- package/src/components/input-wrapper/input-wrapper.test.ts +3 -3
- package/src/components/input-wrapper/input-wrapper.ts +5 -16
- package/src/components/link/link.ts +4 -12
- package/src/components/linkcard/linkcard.test.ts +2 -2
- package/src/components/linkcard/linkcard.ts +4 -13
- package/src/components/loader/loader.ts +4 -12
- package/src/components/messagebox/messagebox.ts +4 -9
- package/src/components/modal/modal.ts +4 -7
- package/src/components/select/select.ts +2 -5
- package/src/components/tabs/tabitem.ts +4 -7
- package/src/components/tabs/tabs.ts +4 -13
- package/src/components/tag/tag.ts +6 -12
- package/src/components/textarea/textarea.ts +2 -8
- package/src/components/textinput/textinput.ts +2 -8
- package/dist/accordionitem-To95GT6b.cjs +0 -34
- package/dist/alert-BDXWFRcf.cjs +0 -33
- package/dist/button-VWxZW89G.cjs +0 -27
- package/dist/combobox-DX2BLzIm.cjs +0 -135
- package/dist/helptext-BjW1WdOn.cjs +0 -24
- package/dist/input-element-CSDVA3Y6.cjs +0 -1
- package/dist/link-Bscfb6s9.js +0 -54
- package/dist/link-CDuv1jxx.cjs +0 -7
- package/dist/linkcard-3WUL0CpY.cjs +0 -13
- package/dist/linkcard-wNgRxJ-S.js +0 -55
- package/dist/messagebox-Dmot5szX.cjs +0 -13
- package/dist/messagebox-LBEzcr6B.js +0 -70
- package/dist/modal-S9MOKOaz.cjs +0 -37
- package/dist/pkt-options-controller-BogGk-6J.cjs +0 -1
- package/dist/pkt-slot-controller-D4nKlom5.cjs +0 -1
- package/dist/pkt-slot-controller-D7CrjM52.js +0 -95
- package/dist/ref-CxLwrCxt.cjs +0 -9
- package/dist/ref-Dma3n3i8.js +0 -102
- package/dist/select-PWPy5gTB.cjs +0 -49
- package/dist/tag-DmbgBCKu.cjs +0 -27
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { PktElementWithSlot } from '@/base-elements/element-with-slot'
|
|
2
|
+
import { slotContent } from '@/directives/slot-content'
|
|
3
3
|
import { html } from 'lit'
|
|
4
4
|
import { customElement, property } from 'lit/decorators.js'
|
|
5
5
|
import { consume } from '@lit/context'
|
|
@@ -20,7 +20,7 @@ export interface IPktTabItem {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
@customElement('pkt-tab-item')
|
|
23
|
-
export class PktTabItem extends
|
|
23
|
+
export class PktTabItem extends PktElementWithSlot<IPktTabItem> implements IPktTabItem {
|
|
24
24
|
@property({ type: Boolean, reflect: true }) active: boolean = false
|
|
25
25
|
@property({ type: String, reflect: true }) href: string = ''
|
|
26
26
|
@property({ type: String, reflect: true }) icon: string = ''
|
|
@@ -35,12 +35,9 @@ export class PktTabItem extends PktElement<IPktTabItem> implements IPktTabItem {
|
|
|
35
35
|
context?: TabsContext
|
|
36
36
|
|
|
37
37
|
elementRef: Ref<HTMLAnchorElement | HTMLButtonElement> = createRef()
|
|
38
|
-
defaultSlot: Ref<HTMLElement> = createRef()
|
|
39
|
-
slotController!: PktSlotController
|
|
40
38
|
|
|
41
39
|
constructor() {
|
|
42
40
|
super()
|
|
43
|
-
this.slotController = new PktSlotController(this, this.defaultSlot)
|
|
44
41
|
}
|
|
45
42
|
|
|
46
43
|
connectedCallback() {
|
|
@@ -74,7 +71,7 @@ export class PktTabItem extends PktElement<IPktTabItem> implements IPktTabItem {
|
|
|
74
71
|
|
|
75
72
|
const content = html`
|
|
76
73
|
${this.icon ? html`<pkt-icon name=${this.icon} class="pkt-icon--small"></pkt-icon>` : ''}
|
|
77
|
-
<span
|
|
74
|
+
<span>${slotContent(this)}</span>
|
|
78
75
|
${this.tag ? html`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>` : ''}
|
|
79
76
|
`
|
|
80
77
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { PktElementWithSlot } from '@/base-elements/element-with-slot'
|
|
2
|
+
import { slotContent } from '@/directives/slot-content'
|
|
3
3
|
import { html, PropertyValues } from 'lit'
|
|
4
4
|
import { customElement, property, state } from 'lit/decorators.js'
|
|
5
5
|
import { provide } from '@lit/context'
|
|
6
|
-
import { createRef, Ref, ref } from 'lit/directives/ref.js'
|
|
7
6
|
import { tabsContext, type TabsContext } from './tabs-context'
|
|
8
7
|
|
|
9
8
|
export interface IPktTabs {
|
|
@@ -12,7 +11,7 @@ export interface IPktTabs {
|
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
@customElement('pkt-tabs')
|
|
15
|
-
export class PktTabs extends
|
|
14
|
+
export class PktTabs extends PktElementWithSlot<IPktTabs> implements IPktTabs {
|
|
16
15
|
@property({ type: Boolean, reflect: true, attribute: 'arrow-nav' }) arrowNav: boolean = true
|
|
17
16
|
@property({ type: Boolean, reflect: true, attribute: 'disable-arrow-nav' })
|
|
18
17
|
disableArrowNav: boolean = false
|
|
@@ -24,14 +23,6 @@ export class PktTabs extends PktElement<IPktTabs> implements IPktTabs {
|
|
|
24
23
|
return this.arrowNav && !this.disableArrowNav
|
|
25
24
|
}
|
|
26
25
|
|
|
27
|
-
defaultSlot: Ref<HTMLElement> = createRef()
|
|
28
|
-
slotController!: PktSlotController
|
|
29
|
-
|
|
30
|
-
constructor() {
|
|
31
|
-
super()
|
|
32
|
-
this.slotController = new PktSlotController(this, this.defaultSlot)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
26
|
// Provide context to child tab items
|
|
36
27
|
@provide({ context: tabsContext })
|
|
37
28
|
@state()
|
|
@@ -94,7 +85,7 @@ export class PktTabs extends PktElement<IPktTabs> implements IPktTabs {
|
|
|
94
85
|
|
|
95
86
|
return html`
|
|
96
87
|
<div class="pkt-tabs">
|
|
97
|
-
<div class="pkt-tabs__list" role=${role}
|
|
88
|
+
<div class="pkt-tabs__list" role=${role}>${slotContent(this)}</div>
|
|
98
89
|
</div>
|
|
99
90
|
`
|
|
100
91
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { classMap } from 'lit/directives/class-map.js'
|
|
2
2
|
import { customElement, property, state } from 'lit/decorators.js'
|
|
3
3
|
import { html, PropertyValues } from 'lit'
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { ref } from 'lit/directives/ref.js'
|
|
7
|
-
import { Ref, createRef } from 'lit/directives/ref.js'
|
|
4
|
+
import { PktElementWithSlot } from '@/base-elements/element-with-slot'
|
|
5
|
+
import { slotContent } from '@/directives/slot-content'
|
|
8
6
|
import { TPktSize } from '@/types/size'
|
|
9
7
|
import specs from 'componentSpecs/tag.json'
|
|
10
8
|
|
|
@@ -36,13 +34,9 @@ export interface IPktTag {
|
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
@customElement('pkt-tag')
|
|
39
|
-
export class PktTag extends
|
|
40
|
-
slotController: PktSlotController
|
|
41
|
-
defaultSlot: Ref<HTMLElement> = createRef()
|
|
42
|
-
|
|
37
|
+
export class PktTag extends PktElementWithSlot<IPktTag> implements IPktTag {
|
|
43
38
|
constructor() {
|
|
44
39
|
super()
|
|
45
|
-
this.slotController = new PktSlotController(this, this.defaultSlot)
|
|
46
40
|
this._isClosed = false
|
|
47
41
|
}
|
|
48
42
|
|
|
@@ -73,7 +67,7 @@ export class PktTag extends PktElement<IPktTag> implements IPktTag {
|
|
|
73
67
|
super.firstUpdated(_changedProperties)
|
|
74
68
|
|
|
75
69
|
if (this.closeTag && !this.ariaLabel) {
|
|
76
|
-
const label = this.
|
|
70
|
+
const label = this.querySelector('button span, .pkt-tag > span')?.textContent?.trim()
|
|
77
71
|
if (label) {
|
|
78
72
|
this._ariaDescription = `Klikk for å fjerne ${label}`
|
|
79
73
|
}
|
|
@@ -129,7 +123,7 @@ export class PktTag extends PktElement<IPktTag> implements IPktTag {
|
|
|
129
123
|
name=${this.iconName}
|
|
130
124
|
aria-hidden="true"
|
|
131
125
|
></pkt-icon>`}
|
|
132
|
-
<span
|
|
126
|
+
<span>${slotContent(this)}</span>
|
|
133
127
|
<pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
|
|
134
128
|
</button>
|
|
135
129
|
`
|
|
@@ -142,7 +136,7 @@ export class PktTag extends PktElement<IPktTag> implements IPktTag {
|
|
|
142
136
|
name=${this.iconName}
|
|
143
137
|
aria-hidden="true"
|
|
144
138
|
></pkt-icon>`}
|
|
145
|
-
<span
|
|
139
|
+
<span>${slotContent(this)}</span>
|
|
146
140
|
</span>
|
|
147
141
|
`
|
|
148
142
|
}
|
|
@@ -5,7 +5,7 @@ import { Ref, createRef, ref } from 'lit/directives/ref.js'
|
|
|
5
5
|
import { classMap } from 'lit/directives/class-map.js'
|
|
6
6
|
import { live } from 'lit/directives/live.js'
|
|
7
7
|
import { PktInputElement } from '@/base-elements/input-element'
|
|
8
|
-
import {
|
|
8
|
+
import { slotContent } from '@/directives/slot-content'
|
|
9
9
|
|
|
10
10
|
import '@/components/input-wrapper'
|
|
11
11
|
import '@/components/icon'
|
|
@@ -16,7 +16,6 @@ type Props = ElementProps<PktTextarea, 'autocomplete' | 'rows'>
|
|
|
16
16
|
@customElement('pkt-textarea')
|
|
17
17
|
export class PktTextarea extends PktInputElement<Props> {
|
|
18
18
|
inputRef: Ref<HTMLTextAreaElement> = createRef()
|
|
19
|
-
private helptextSlot: Ref<HTMLElement> = createRef()
|
|
20
19
|
|
|
21
20
|
@property({ type: String, reflect: true }) value: string = ''
|
|
22
21
|
@property({ type: String }) autocomplete: string = 'off'
|
|
@@ -24,11 +23,6 @@ export class PktTextarea extends PktInputElement<Props> {
|
|
|
24
23
|
|
|
25
24
|
@state() counterCurrent = 0
|
|
26
25
|
|
|
27
|
-
constructor() {
|
|
28
|
-
super()
|
|
29
|
-
this.slotController = new PktSlotController(this, this.helptextSlot)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
26
|
attributeChangedCallback(name: string, _old: string | null, value: string | null): void {
|
|
33
27
|
if (name === 'value' && this.value !== _old) {
|
|
34
28
|
this.counterCurrent = value ? value.length : 0
|
|
@@ -83,7 +77,7 @@ export class PktTextarea extends PktInputElement<Props> {
|
|
|
83
77
|
.tagText=${this.tagText}
|
|
84
78
|
class="pkt-textarea"
|
|
85
79
|
>
|
|
86
|
-
<div class="pkt-contents"
|
|
80
|
+
<div class="pkt-contents" slot="helptext">${slotContent(this, 'helptext')}</div>
|
|
87
81
|
<textarea
|
|
88
82
|
${ref(this.inputRef)}
|
|
89
83
|
class=${inputClasses}
|
|
@@ -5,7 +5,7 @@ import { Ref, createRef, ref } from 'lit/directives/ref.js'
|
|
|
5
5
|
import { ElementProps } from '@/types/typeUtils'
|
|
6
6
|
import { classMap } from 'lit/directives/class-map.js'
|
|
7
7
|
import { PktInputElement } from '@/base-elements/input-element'
|
|
8
|
-
import {
|
|
8
|
+
import { slotContent } from '@/directives/slot-content'
|
|
9
9
|
|
|
10
10
|
import '@/components/input-wrapper'
|
|
11
11
|
import '@/components/icon'
|
|
@@ -25,7 +25,6 @@ type Props = ElementProps<
|
|
|
25
25
|
@customElement('pkt-textinput')
|
|
26
26
|
export class PktTextinput extends PktInputElement<Props> {
|
|
27
27
|
inputRef: Ref<HTMLTextAreaElement> = createRef()
|
|
28
|
-
private helptextSlot: Ref<HTMLElement> = createRef()
|
|
29
28
|
|
|
30
29
|
@property({ type: String, reflect: true }) value: string = ''
|
|
31
30
|
@property({ type: String }) type: string = 'text'
|
|
@@ -38,11 +37,6 @@ export class PktTextinput extends PktInputElement<Props> {
|
|
|
38
37
|
|
|
39
38
|
@state() counterCurrent = 0
|
|
40
39
|
|
|
41
|
-
constructor() {
|
|
42
|
-
super()
|
|
43
|
-
this.slotController = new PktSlotController(this, this.helptextSlot)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
40
|
attributeChangedCallback(name: string, _old: string | null, value: string | null): void {
|
|
47
41
|
if (name === 'value' && this.value !== _old) {
|
|
48
42
|
this.counterCurrent = value ? value.length : 0
|
|
@@ -101,7 +95,7 @@ export class PktTextinput extends PktInputElement<Props> {
|
|
|
101
95
|
.tagText=${this.tagText}
|
|
102
96
|
class="pkt-textinput"
|
|
103
97
|
>
|
|
104
|
-
<div class="pkt-contents"
|
|
98
|
+
<div class="pkt-contents" slot="helptext">${slotContent(this, 'helptext')}</div>
|
|
105
99
|
<div class="pkt-input__container">
|
|
106
100
|
${this.prefix ? html`<div class="pkt-input-prefix">${this.prefix}</div>` : nothing}
|
|
107
101
|
<input
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";const i=require("./element-CMTfByxQ.cjs"),u=require("./class-map-Bokp1SoS.cjs"),h=require("./pkt-slot-controller-D4nKlom5.cjs"),m=require("./ref-CxLwrCxt.cjs"),f=require("./if-defined-hKKmbsI8.cjs");var y=Object.defineProperty,k=Object.getOwnPropertyDescriptor,d=(s,t,o,r)=>{for(var e=r>1?void 0:r?k(t,o):t,c=s.length-1,a;c>=0;c--)(a=s[c])&&(e=(r?a(t,o,e):a(e))||e);return r&&e&&y(t,o,e),e};let l=class extends i.i{constructor(){super(...arguments),this.ariaLabelledBy="",this.compact=!1,this.skin="borderless",this.name=""}updated(t){t.has("skin")&&this.requestUpdate(),t.has("name")&&this.updateAccordionItemNames()}updateAccordionItemNames(){var t;if(this.name){const o=(t=this.renderRoot)==null?void 0:t.querySelector("slot");o&&o.assignedElements().forEach(e=>{e.tagName.toLowerCase()==="pkt-accordion-item"&&(e.hasAttribute("name")||e.setAttribute("name",this.name))})}}firstUpdated(){var o;const t=(o=this.renderRoot)==null?void 0:o.querySelector("slot");t&&t.addEventListener("slotchange",()=>{this.updateAccordionItemNames()})}render(){const t={"pkt-accordion":!0,"pkt-accordion--compact":this.compact,[`pkt-accordion--${this.skin}`]:this.skin};return i.b`
|
|
2
|
-
<div
|
|
3
|
-
part="container"
|
|
4
|
-
class=${u.e(t)}
|
|
5
|
-
data-testid="pkt-accordion"
|
|
6
|
-
aria-labelledby=${this.ariaLabelledBy}
|
|
7
|
-
>
|
|
8
|
-
<slot></slot>
|
|
9
|
-
</div>
|
|
10
|
-
`}};d([i.n({type:String,reflect:!0,attribute:"aria-labelledby"})],l.prototype,"ariaLabelledBy",2);d([i.n({type:Boolean,reflect:!0,attribute:"compact"})],l.prototype,"compact",2);d([i.n({type:String,reflect:!0,attribute:"skin"})],l.prototype,"skin",2);d([i.n({type:String,reflect:!0,attribute:"name"})],l.prototype,"name",2);l=d([i.t("pkt-accordion")],l);const _=l;var v=Object.defineProperty,b=Object.getOwnPropertyDescriptor,p=(s,t,o,r)=>{for(var e=r>1?void 0:r?b(t,o):t,c=s.length-1,a;c>=0;c--)(a=s[c])&&(e=(r?a(t,o,e):a(e))||e);return r&&e&&v(t,o,e),e};let n=class extends i.PktElement{constructor(){super(),this.defaultOpen=!1,this.title="",this.skin=void 0,this.compact=!1,this.isOpen=!1,this.name=void 0,this.accordionItemRef=m.e(),this.defaultSlot=m.e(),this.slotController=new h.PktSlotController(this,this.defaultSlot)}firstUpdated(s){this.defaultOpen&&(this.isOpen=!0)}render(){const s={"pkt-accordion-item":!0,"pkt-accordion-item--compact":this.compact,[`pkt-accordion-item--${this.skin}`]:!!this.skin};return i.b`
|
|
11
|
-
<details
|
|
12
|
-
class=${u.e(s)}
|
|
13
|
-
id=${this.id}
|
|
14
|
-
?open=${this.isOpen}
|
|
15
|
-
${m.n(this.accordionItemRef)}
|
|
16
|
-
name=${f.o(this.name)}
|
|
17
|
-
>
|
|
18
|
-
<summary class="pkt-accordion-item__title" id=${`pkt-accordion-item-summary-${this.id}`}>
|
|
19
|
-
${this.title}
|
|
20
|
-
<pkt-icon
|
|
21
|
-
name="chevron-thin-down"
|
|
22
|
-
class="pkt-accordion-item__icon"
|
|
23
|
-
aria-hidden="true"
|
|
24
|
-
></pkt-icon>
|
|
25
|
-
</summary>
|
|
26
|
-
<div
|
|
27
|
-
class="pkt-accordion-item__content"
|
|
28
|
-
id="pkt-accordion-item__content-${this.id}"
|
|
29
|
-
role="region"
|
|
30
|
-
>
|
|
31
|
-
<div class="pkt-accordion-item__content-inner" ${m.n(this.defaultSlot)}></div>
|
|
32
|
-
</div>
|
|
33
|
-
</details>
|
|
34
|
-
`}};p([i.n({type:Boolean})],n.prototype,"defaultOpen",2);p([i.n({type:String})],n.prototype,"title",2);p([i.n({type:String,reflect:!0})],n.prototype,"skin",2);p([i.n({type:Boolean,reflect:!0})],n.prototype,"compact",2);p([i.n({type:Boolean,reflect:!0})],n.prototype,"isOpen",2);p([i.n({type:String,reflect:!0})],n.prototype,"name",2);n=p([i.t("pkt-accordion-item")],n);const $=n;exports.PktAccordion=_;exports.PktAccordionItem_default=$;
|
package/dist/alert-BDXWFRcf.cjs
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";const c=require("./class-map-Bokp1SoS.cjs"),t=require("./element-CMTfByxQ.cjs"),d=require("./state-BNgpvY-A.cjs"),h=require("./pkt-slot-controller-D4nKlom5.cjs"),u=require("./ref-CxLwrCxt.cjs"),k=require("./classutils-BwNK82ZQ.cjs");require("./icon-Dj0oZZSa.cjs");require("./button-VWxZW89G.cjs");const v={skin:{default:"info"},ariaLive:{default:"polite"},compact:{default:!1},closeAlert:{default:!1}},a={props:v};var f=Object.defineProperty,_=Object.getOwnPropertyDescriptor,i=(o,e,s,l)=>{for(var r=l>1?void 0:l?_(e,s):e,p=o.length-1,n;p>=0;p--)(n=o[p])&&(r=(l?n(e,s,r):n(r))||r);return l&&r&&f(e,s,r),r};exports.PktAlert=class extends t.PktElement{constructor(){super(),this.defaultSlot=u.e(),this.compact=a.props.compact.default,this.title="",this.skin=a.props.skin.default,this.ariaLive=a.props.ariaLive.default,this["aria-live"]=null,this.closeAlert=a.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.slotController=new h.PktSlotController(this,this.defaultSlot),this._isClosed=!1}connectedCallback(){super.connectedCallback(),this["aria-live"]=this.getAttribute("aria-live")||this.ariaLive}attributeChangedCallback(e,s,l){e==="ariaLive"&&(this["aria-live"]=l),super.attributeChangedCallback(e,s,l)}updated(e){super.updated(e),e.has("ariaLive")&&(this["aria-live"]=this.ariaLive),e.has("_isClosed")&&k.updateClassAttribute(this,"pkt-hide",this._isClosed)}render(){const e={"pkt-alert":!0,"pkt-alert--compact":this.compact,[`pkt-alert--${this.skin}`]:this.skin,"pkt-hide":this._isClosed},s={"pkt-alert__grid":!0,"pkt-alert__noTitle":!this.title,"pkt-alert__noDate":!this.date};return t.b`
|
|
2
|
-
<div class=${c.e(e)} aria-live=${this["aria-live"]}>
|
|
3
|
-
<div class=${c.e(s)}>
|
|
4
|
-
<pkt-icon
|
|
5
|
-
class="pkt-alert__icon"
|
|
6
|
-
aria-hidden="true"
|
|
7
|
-
name=${this.skin==="info"?"alert-information":`alert-${this.skin}`}
|
|
8
|
-
></pkt-icon>
|
|
9
|
-
|
|
10
|
-
${this.closeAlert?t.b`
|
|
11
|
-
<div class="pkt-alert__close">
|
|
12
|
-
<pkt-button
|
|
13
|
-
tabindex="0"
|
|
14
|
-
aria-label="close"
|
|
15
|
-
size=${this.compact?"small":"medium"}
|
|
16
|
-
type="button"
|
|
17
|
-
skin="tertiary"
|
|
18
|
-
iconName="close"
|
|
19
|
-
variant="icon-only"
|
|
20
|
-
@click=${this.close}
|
|
21
|
-
>
|
|
22
|
-
<span class="sr-only">Lukk</span>
|
|
23
|
-
</pkt-button>
|
|
24
|
-
</div>
|
|
25
|
-
`:t.A}
|
|
26
|
-
${this.title?t.b`<div class="pkt-alert__title">${this.title}</div>`:t.A}
|
|
27
|
-
|
|
28
|
-
<div class="pkt-alert__text" ${u.n(this.defaultSlot)}></div>
|
|
29
|
-
|
|
30
|
-
${this.date?t.b`<div class="pkt-alert__date">Sist oppdatert: ${this.date}</div>`:t.A}
|
|
31
|
-
</div>
|
|
32
|
-
</div>
|
|
33
|
-
`}};i([t.n({type:Boolean,reflect:!1})],exports.PktAlert.prototype,"compact",2);i([t.n({type:String,reflect:!0})],exports.PktAlert.prototype,"title",2);i([t.n({type:String,reflect:!0})],exports.PktAlert.prototype,"skin",2);i([t.n({type:String})],exports.PktAlert.prototype,"ariaLive",2);i([t.n({type:String,reflect:!0})],exports.PktAlert.prototype,"aria-live",2);i([t.n({type:Boolean,reflect:!0})],exports.PktAlert.prototype,"closeAlert",2);i([t.n({type:String,reflect:!0})],exports.PktAlert.prototype,"date",2);i([t.n({type:String,reflect:!0})],exports.PktAlert.prototype,"role",2);i([d.r()],exports.PktAlert.prototype,"_isClosed",2);exports.PktAlert=i([t.t("pkt-alert")],exports.PktAlert);
|
package/dist/button-VWxZW89G.cjs
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("./element-CMTfByxQ.cjs"),h=require("./pkt-slot-controller-D4nKlom5.cjs"),u=require("./class-map-Bokp1SoS.cjs"),a=require("./if-defined-hKKmbsI8.cjs"),d=require("./ref-CxLwrCxt.cjs");require("./icon-Dj0oZZSa.cjs");var c=Object.defineProperty,b=Object.getOwnPropertyDescriptor,e=(r,i,o,n)=>{for(var s=n>1?void 0:n?b(i,o):i,l=r.length-1,p;l>=0;l--)(p=r[l])&&(s=(n?p(i,o,s):p(s))||s);return n&&s&&c(i,o,s),s};window.pktAnimationPath=window.pktAnimationPath||"https://punkt-cdn.oslo.kommune.no/latest/animations/";exports.PktButton=class extends t.PktElement{constructor(){super(),this.defaultSlot=d.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=window.pktAnimationPath,this.slotController=new h.PktSlotController(this,this.defaultSlot)}connectedCallback(){super.connectedCallback(),this.addEventListener("click",i=>{(this.disabled||this.hasAttribute("disabled")||this.isLoading)&&(i.preventDefault(),i.stopImmediatePropagation())},!0),this.addEventListener("keydown",i=>{(this.disabled||this.hasAttribute("disabled")||this.isLoading)&&(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),i.stopImmediatePropagation())},!0)}attributeChangedCallback(i,o,n){super.attributeChangedCallback(i,o,n),i==="disabled"&&n==="false"&&(this.disabled=!1),(i==="isloading"||i==="isLoading")&&n==="false"&&(this.isLoading=!1)}firstUpdated(i){super.firstUpdated(i),this.disabled==="false"&&(this.disabled=!1),this.isLoading==="false"&&(this.isLoading=!1)}render(){const i=this.form??this.getAttribute("form")??void 0,o={"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};return t.b`
|
|
2
|
-
<button
|
|
3
|
-
class=${u.e(o)}
|
|
4
|
-
type=${this.type}
|
|
5
|
-
?disabled=${!!this.disabled}
|
|
6
|
-
aria-busy=${a.o(this.isLoading?"true":void 0)}
|
|
7
|
-
aria-disabled=${a.o(this.disabled||this.isLoading?"true":void 0)}
|
|
8
|
-
form=${a.o(i)}
|
|
9
|
-
>
|
|
10
|
-
${this.isLoading?t.b`<pkt-icon
|
|
11
|
-
class="pkt-btn__icon pkt-btn__spinner"
|
|
12
|
-
name="spinner-blue"
|
|
13
|
-
path=${a.o(this.loadingAnimationPath)}
|
|
14
|
-
></pkt-icon>`:t.A}
|
|
15
|
-
${this.variant!=="label-only"?t.b`<pkt-icon
|
|
16
|
-
class="pkt-btn__icon pkt-icon"
|
|
17
|
-
name=${this.iconName}
|
|
18
|
-
path=${a.o(this.iconPath)}
|
|
19
|
-
></pkt-icon>`:t.A}
|
|
20
|
-
<span class="pkt-btn__text" ${d.n(this.defaultSlot)}></span>
|
|
21
|
-
${this.variant==="icons-right-and-left"?t.b`<pkt-icon
|
|
22
|
-
class="pkt-btn__icon"
|
|
23
|
-
name=${this.secondIconName}
|
|
24
|
-
path=${a.o(this.secondIconPath)}
|
|
25
|
-
></pkt-icon>`:t.A}
|
|
26
|
-
</button>
|
|
27
|
-
`}};e([t.n({type:String})],exports.PktButton.prototype,"iconName",2);e([t.n({type:String})],exports.PktButton.prototype,"secondIconName",2);e([t.n({type:String})],exports.PktButton.prototype,"iconPath",2);e([t.n({type:String})],exports.PktButton.prototype,"secondIconPath",2);e([t.n({type:String})],exports.PktButton.prototype,"mode",2);e([t.n({type:String})],exports.PktButton.prototype,"size",2);e([t.n({type:Boolean,attribute:"full-width"})],exports.PktButton.prototype,"fullWidth",2);e([t.n({type:Boolean,attribute:"full-width-on-mobile"})],exports.PktButton.prototype,"fullWidthOnMobile",2);e([t.n({type:String})],exports.PktButton.prototype,"color",2);e([t.n({type:String})],exports.PktButton.prototype,"skin",2);e([t.n({type:String})],exports.PktButton.prototype,"variant",2);e([t.n({type:String,reflect:!0})],exports.PktButton.prototype,"state",2);e([t.n({type:String,reflect:!0})],exports.PktButton.prototype,"type",2);e([t.n({type:String})],exports.PktButton.prototype,"form",2);e([t.n({type:Boolean,reflect:!0})],exports.PktButton.prototype,"isLoading",2);e([t.n({type:Boolean,reflect:!0})],exports.PktButton.prototype,"disabled",2);e([t.n({type:String})],exports.PktButton.prototype,"loadingAnimationPath",2);exports.PktButton=e([t.t("pkt-button")],exports.PktButton);
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";const o=require("./element-CMTfByxQ.cjs"),d=require("./if-defined-hKKmbsI8.cjs"),f=require("./ref-CxLwrCxt.cjs"),V=require("./class-map-Bokp1SoS.cjs"),T=require("./repeat-C-FJ2vfy.cjs"),u=require("./listbox-OAVh_U7u.cjs"),b=require("./state-BNgpvY-A.cjs"),w=require("./input-element-CSDVA3Y6.cjs"),R=require("./pkt-options-controller-BogGk-6J.cjs"),C=require("./pkt-slot-controller-D4nKlom5.cjs");require("./input-wrapper-JU4D2TGu.cjs");require("./icon-Dj0oZZSa.cjs");require("./tag-DmbgBCKu.cjs");const F=(a,t,e)=>{switch(a){case",":return e?"addValue":null;case"Enter":return"addValue";case"Tab":case"ArrowDown":return t?null:"focusListbox";case"Escape":return"closeOptions";default:return null}},M=(a,t,e,s,i)=>{if(!a)return{action:"none",value:null};const l=u.findOptionByValue(e,a);return!t.includes(a)&&!l?s?{action:"addUserValue",value:a}:i?{action:"none",value:null}:{action:"removeValue",value:t[0]}:l&&!t.includes(l.value)?{action:"selectOption",value:l.value}:{action:"none",value:null}},U=(a,t,e,s,i)=>a.trim().toLowerCase()?{...u.getSearchInfoMessage(a,t,e,s),shouldRemoveValue:!1,shouldResetInput:!1}:{addValueText:null,userInfoMessage:"",shouldRemoveValue:!i&&!!t[0],shouldResetInput:!0},O=(a,t,e)=>{const s=u.findOptionByValue(t,a);return e==="label"&&(s!=null&&s.label)?s.label:a},m={markOptionSelected(a,t){if(t){for(const e of a)if(e.value===t){e.selected=!0;break}}},markOptionDeselected(a,t){if(t){for(const e of a)if(e.value===t){e.selected=!1;break}}},markAllSelected(a){for(const t of a)t.selected=!0},markAllDeselected(a){for(const t of a)t.selected=!1},removeUserAddedOptions(a){return a.filter(t=>!t.userAdded)}},A={parseOptionsFromSlot(a){const t=[];return a.forEach(e=>{if(!e.textContent&&!e.getAttribute("value"))return;const s={value:e.getAttribute("value")||e.textContent||"",label:e.textContent||e.getAttribute("value")||""};e.getAttribute("data-prefix")&&(s.prefix=e.getAttribute("data-prefix")||void 0),e.getAttribute("tagskincolor")&&(s.tagSkinColor=e.getAttribute("tagskincolor")),e.getAttribute("description")&&(s.description=e.getAttribute("description")||void 0),s.fulltext=u.buildFulltext(s),t.push(s)}),t}},k={syncOptionsWithValues(a,t){const e=[...t];return a.forEach(s=>{s.value&&!s.label&&(s.label=s.value),s.selected&&!e.includes(s.value)&&e.push(s.value),s.fulltext=u.buildFulltext(s),s.selected=s.selected||e.includes(s.value)}),{options:a,newValues:e}},mergeWithUserAdded(a,t){return[...t.filter(i=>(i==null?void 0:i.userAdded)&&i.selected).filter(i=>!(Array.isArray(a)?a:[]).some(l=>l.value===i.value)),...a]}},D={displayValueAs:{default:"label"}},P={props:D};var q=Object.defineProperty,r=(a,t,e,s)=>{for(var i=void 0,l=a.length-1,n;l>=0;l--)(n=a[l])&&(i=n(t,e,i)||i);return i&&q(t,e,i),i};class h extends w.PktInputElement{constructor(){super(),this.helptextSlot=f.e(),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=P.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=f.e(),this.triggerRef=f.e(),this.listboxRef=f.e(),this.optionsController=new R.PktOptionsSlotController(this),this.slotController=new C.PktSlotController(this,this.helptextSlot),this.slotController.skipOptions=!0}get _hasTextInput(){return this.typeahead||this.allowUserInput}get _selectionDescription(){if(!(!this.multiple||this._value.length===0))return`${this._value.length} valgt`}focusTrigger(){var t,e;this._hasTextInput?(t=this.inputRef.value)==null||t.focus():(e=this.triggerRef.value)==null||e.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=u.isMaxSelectionReached(this._value.length,this.maxlength)}syncValueAndDispatch(t){const e=this._value,s=this.multiple?e.join(","):e[0]||"",i=Array.isArray(this.value)?this.value.join(","):String(this.value||"");if(s!==i&&(this._internalValueSync=!0,this.value=s),(t==null?void 0:t.join(","))!==e.join(",")){const l=this.multiple?[...e]:e[0]||"";this.onChange(l)}else e.length===0&&t&&t.length>0&&this.clearInputValue()}onChange(t){this.touched=!0,super.onChange(t)}valueChanged(){}}r([o.n({type:String,reflect:!0})],h.prototype,"value");r([o.n({type:Array})],h.prototype,"options");r([o.n({type:Array,attribute:"default-options"})],h.prototype,"defaultOptions");r([o.n({type:Boolean,attribute:"allow-user-input"})],h.prototype,"allowUserInput");r([o.n({type:Boolean})],h.prototype,"typeahead");r([o.n({type:Boolean,attribute:"include-search"})],h.prototype,"includeSearch");r([o.n({type:String,attribute:"search-placeholder"})],h.prototype,"searchPlaceholder");r([o.n({type:Boolean})],h.prototype,"multiple");r([o.n({type:Number})],h.prototype,"maxlength");r([o.n({type:String,attribute:"display-value-as"})],h.prototype,"displayValueAs");r([o.n({type:String,attribute:"tag-placement"})],h.prototype,"tagPlacement");r([o.n({type:Boolean,attribute:"open"})],h.prototype,"isOpen");r([b.r()],h.prototype,"_options");r([b.r()],h.prototype,"_value");r([b.r()],h.prototype,"_isOptionsOpen");r([b.r()],h.prototype,"_userInfoMessage");r([b.r()],h.prototype,"_addValueText");r([b.r()],h.prototype,"_maxIsReached");r([b.r()],h.prototype,"_search");r([b.r()],h.prototype,"_inputFocus");class B extends h{toggleValue(t){var $,I;if(this.disabled)return;this.touched=!0,this._userInfoMessage="",this._addValueText=null;const e=(($=u.findOptionByValue(this.options,t))==null?void 0:$.value)||null,s=this._value.includes(t||e||""),i=!!e,l=((I=this._options.find(S=>S.value===t))==null?void 0:I.disabled)||!1,n=!(t!=null&&t.trim()),p=!this.multiple,_=this.multiple,v=u.isMaxSelectionReached(this._value.length,this.maxlength);let c=!1,x=!0,g="",y="";l||(!i&&this.allowUserInput&&!n?(this.addNewUserValue(t),g="Ny verdi lagt til",c=_):!i&&!this.allowUserInput?(p&&this._value[0]&&this.removeValue(this._value[0]),x=!1,c=!0,g="Ingen treff i søket"):s?(this.removeValue(e),c=!0,p&&this._hasTextInput&&this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.value="")):n&&p?(this.removeAllSelected(),c=!0):p?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(e),c=!1):_&&!v?(this.setSelected(e),c=!0):_&&v?(g="Maks antall valg nådd",x=!1,y=t):(p&&this.removeAllSelected(),g="Ingen gyldig verdi valgt",x=!1,c=!0,y=t),this._isOptionsOpen=c,c||(p&&this._hasTextInput&&(this._suppressNextOpen=!0),window.setTimeout(()=>{this.focusTrigger()},0)),this._userInfoMessage=g,this._search=y||"",this.resetComboboxInput(x),_&&this.updateMaxReached())}setSelected(t){if(!this._value.includes(t)){if(this.multiple&&u.isMaxSelectionReached(this._value.length,this.maxlength)){this._userInfoMessage="Maks antall valg nådd";return}!this.multiple&&this.removeAllSelected(),this._value=t?[...this._value,t]:this._value,m.markOptionSelected(this._options,t),this.resetComboboxInput(!0)}}removeSelected(t){if(!t)return;this._value=this._value.filter(s=>s!==t);const e=u.findOptionByValue(this.options,t);e&&(m.markOptionDeselected(this.options,t),e.userAdded?(this._options=[...this._options.filter(s=>s.value!==t)],this.options=[...this.options.filter(s=>s.value!==t)]):this._options.some(s=>s.value===t)||(this._options=[...this._options,e]))}addAllOptions(){if(this.multiple){if(this.maxlength&&this._options.length>this.maxlength){this._userInfoMessage="For mange valgt";return}this._value=this._options.map(t=>t.value),m.markAllSelected(this._options),this.requestUpdate()}}removeAllSelected(){this._value=[],m.markAllDeselected(this._options),this._options=m.removeUserAddedOptions(this._options),this.requestUpdate()}addValue(){var e;const t=((e=this.inputRef.value)==null?void 0:e.value.trim())||"";if(this._search=t,t&&this._value.includes(t)){this.resetComboboxInput(!0),this._userInfoMessage="Verdien er allerede valgt";return}this.toggleValue(t)}removeValue(t){this._value=this.multiple?this._value.filter(e=>e!==t):[],this.removeSelected(t)}addNewUserValue(t){if(!t||t.trim()==="")return;if(!this.multiple)this._value[0]&&this.removeSelected(this._value[0]),this._value=[t];else if(!u.findOptionByValue(this.options,t)){if(u.isMaxSelectionReached(this._value.length,this.maxlength))return;this._value=[...this._value,t]}const e={value:t,label:t,userAdded:!0,selected:!0};this.options=[e,...this.options],this._options=[e,...this._options],this.resetComboboxInput(!0),this.multiple||(this._isOptionsOpen=!1,this._hasTextInput&&(this._suppressNextOpen=!0),window.setTimeout(()=>{this.focusTrigger()},0)),this.requestUpdate()}resetComboboxInput(t=!0){this._addValueText=null,this.inputRef.value&&this.inputRef.value.type!=="hidden"&&t&&(this._search="",this.multiple?this.inputRef.value.value="":(this.inputRef.value.value=this._value[0]?O(this._value[0],this.options,this.displayValueAs):"",this._userInfoMessage="")),this._options=[...this.options]}removeLastValue(t){if(this._value.length===0)return;t.preventDefault();const e=this._value[this._value.length-1];e&&this.removeSelected(e),this.updateMaxReached()}}class E extends B{handleInput(t){if(t.stopPropagation(),t.stopImmediatePropagation(),this.disabled)return;this.touched=!0;const e=t.target;if(this._search=e.value,this.checkForMatches(),this.typeahead)if(this._search){const{filtered:s,suggestion:i}=u.findTypeaheadMatches(this.options,this._search);this._options=s,t.inputType!=="deleteContentBackward"&&(i!=null&&i.label)&&this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(e.value=i.label,window.setTimeout(()=>e.setSelectionRange(this._search.length,e.value.length),0),e.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=O(this._value[0],this.options,this.displayValueAs)),this._inputFocus=!0,this._search="",this._options=[...this.options],this._isOptionsOpen=!0,this.onFocus(),this.requestUpdate()}}handleFocusOut(t){var i,l;if(this.disabled||!this._isOptionsOpen)return;const e=t.relatedTarget;((i=e==null?void 0:e.closest("pkt-combobox"))==null?void 0:i.id)===this.id||((l=t.target)==null?void 0:l.getAttribute("data-focusfix"))===this.id||e===this.inputRef.value||e===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"){const t=this.inputRef.value.value;if(this.multiple){if(t!==""){const{action:e,value:s}=M(t,this._value,this.options,this.allowUserInput,this.multiple);switch(e){case"addUserValue":this.addNewUserValue(s);break;case"selectOption":this.setSelected(s);break;case"removeValue":this.removeValue(s);break}}}else if(!t)this._value[0]&&this.removeSelected(this._value[0]);else{const e=u.findOptionByValue(this.options,t);e&&e.value!==this._value[0]?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(e.value)):!e&&this.allowUserInput&&(this._value[0]&&this.removeSelected(this._value[0]),this.addNewUserValue(t))}!this.multiple&&this._value[0]?this.inputRef.value.value=O(this._value[0],this.options,this.displayValueAs):this.inputRef.value.value=""}this._isOptionsOpen=!1,this.onBlur()}handleBlur(){this._inputFocus=!1,this.onBlur()}handleInputClick(t){var e,s;if(this.disabled){t.preventDefault(),t.stopImmediatePropagation();return}this._hasTextInput?((e=this.inputRef.value)==null||e.focus(),this.requestUpdate()):(t.stopImmediatePropagation(),t.preventDefault(),this._isOptionsOpen=!this._isOptionsOpen,this._isOptionsOpen&&((s=this.listboxRef.value)==null||s.focusFirstOrSelectedOption()))}handlePlaceholderClick(t){this.disabled||(t.stopPropagation(),this._hasTextInput&&this.inputRef.value?(this.inputRef.value.focus(),this._inputFocus=!0,this.requestUpdate()):(this._isOptionsOpen=!this._isOptionsOpen,this.requestUpdate()))}handleSelectOnlyKeydown(t){var e,s;if(!this.disabled)switch(t.key){case"Enter":case" ":case"ArrowDown":case"ArrowUp":t.preventDefault(),this._isOptionsOpen?this._isOptionsOpen=!1:(this._isOptionsOpen=!0,(e=this.listboxRef.value)==null||e.focusFirstOrSelectedOption());break;case"Escape":this._isOptionsOpen&&(t.preventDefault(),this._isOptionsOpen=!1);break;case"Home":case"End":t.preventDefault(),this._isOptionsOpen||(this._isOptionsOpen=!0),(s=this.listboxRef.value)==null||s.focusFirstOrSelectedOption();break;case"ArrowLeft":this.multiple&&this._value.length>0&&(t.preventDefault(),this.focusTag(this._value.length-1));break;case"Backspace":case"Delete":this.multiple&&this._value.length>0&&(t.preventDefault(),this.removeSelected(this._value[this._value.length-1]));break}}handleOptionToggled(t){this.toggleValue(t.detail)}handleSearch(t){t.stopPropagation(),this._search=t.detail.toLowerCase(),this.checkForMatches()}handleInputKeydown(t){var s,i,l;if(t.key==="Backspace"){const n=!((s=this.inputRef.value)!=null&&s.value);!this._search&&n&&this.multiple&&this._value.length>0&&this.removeLastValue(t);return}if(t.key==="ArrowLeft"&&this.multiple&&this._value.length>0){const n=this.inputRef.value;if(n&&n.selectionStart===0&&!n.value){t.preventDefault(),this.focusTag(this._value.length-1);return}}const e=F(t.key,t.shiftKey,this.multiple);if(e&&!(t.key==="Tab"&&!this._isOptionsOpen)){if(e==="focusListbox"&&t.key==="Tab"&&!((i=this.listboxRef.value)==null?void 0:i.querySelector('[role="option"]:not([data-disabled]), [data-type="new-option"]'))){this.closeAndProcessInput();return}switch(t.preventDefault(),e){case"addValue":this.addValue();break;case"focusListbox":(l=this.listboxRef.value)==null||l.focusFirstOrSelectedOption();break;case"closeOptions":this._isOptionsOpen=!1;break}}}handleTagRemove(t){this.removeSelected(t),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(t){var i;const e=this.getInsideTags();e.forEach((l,n)=>{l.buttonTabindex=n===t?0:-1});const s=(i=e[t])==null?void 0:i.querySelector("button");s==null||s.focus()}resetTagTabindices(){this.getInsideTags().forEach(e=>{e.buttonTabindex=-1})}handleTagKeydown(t,e){t.stopPropagation();const s=()=>{var i;this.resetTagTabindices(),this._hasTextInput&&this.inputRef.value?this.inputRef.value.focus():(i=this.triggerRef.value)==null||i.focus()};switch(t.key){case"ArrowLeft":t.preventDefault(),e>0&&this.focusTag(e-1);break;case"ArrowRight":t.preventDefault(),e<this._value.length-1?this.focusTag(e+1):s();break;case"Backspace":case"Delete":t.preventDefault();{const i=this._value[e],l=e>=this._value.length-1?e-1:e;this.removeSelected(i),l>=0?(this.requestUpdate(),this.updateComplete.then(()=>this.focusTag(l))):s()}break;case"Tab":this.resetTagTabindices();break;case"Escape":t.preventDefault(),s();break}}checkForMatches(){var s;const t=((s=this.inputRef.value)==null?void 0:s.value)||this._search||"",e=U(t,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}}var N=Object.getOwnPropertyDescriptor,L=(a,t,e,s)=>{for(var i=s>1?void 0:s?N(t,e):t,l=a.length-1,n;l>=0;l--)(n=a[l])&&(i=n(i)||i);return i};exports.PktCombobox=class extends E{constructor(){super(...arguments),this.handleBodyClick=t=>{this._isOptionsOpen&&!this.contains(t.target)&&this.closeAndProcessInput()}}connectedCallback(){var t,e;if(super.connectedCallback(),document==null||document.body.addEventListener("click",this.handleBodyClick),this._options=[],this.defaultOptions&&this.defaultOptions.length){const s=((t=this.options)==null?void 0:t.filter(i=>i.userAdded))||[];this.options=[...s,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if((e=this.optionsController)!=null&&e.nodes&&this.optionsController.nodes.length){const s=A.parseOptionsFromSlot(this.optionsController.nodes);s.length&&(this.options=[...s],this._options=[...s],this._optionsFromSlot=!0,this._lastSlotGeneration=this.optionsController.generation)}}willUpdate(t){if(this._optionsFromSlot&&this.optionsController){const e=this.optionsController.generation;if(e!==this._lastSlotGeneration){this._lastSlotGeneration=e;const s=A.parseOptionsFromSlot(this.optionsController.nodes),i=this._options.filter(l=>l.userAdded);this.options=[...i,...s]}}super.willUpdate(t)}disconnectedCallback(){super.disconnectedCallback(),document==null||document.body.removeEventListener("click",this.handleBodyClick)}firstUpdated(t){this.defaultValue!==null&&!this.value&&(this.value=this.defaultValue),super.firstUpdated(t)}updated(t){t.has("isOpen")&&(this._isOptionsOpen=this.isOpen);const e=t.has("value"),s=t.has("_value");if(e&&this._internalValueSync)this._internalValueSync=!1,s&&this.syncValueAndDispatch(t.get("_value"));else if(e){const l=[...this._value],n=this.parseValue();n.join(",")!==this._value.join(",")&&(this._value=n),this.updateMaxReached(),this.syncValueAndDispatch(l)}else s&&this.syncValueAndDispatch(t.get("_value"));if(t.has("defaultOptions")&&this.defaultOptions.length){const l=(Array.isArray(this.options)?this.options:[]).filter(n=>n.userAdded)||[];this.options=[...l,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if(t.has("options")){const l=t.get("options")||this._options||[],n=k.mergeWithUserAdded(this.options,l);this._options=n,n.length>this.options.length&&(this.options=n);const p=k.syncOptionsWithValues(this._options,this._value);if(this._options=p.options,p.newValues.length>this._value.length){const _=[...this._value];this._value=p.newValues,this.syncValueAndDispatch(_)}}if(t.has("_search")&&this.dispatchEvent(new CustomEvent("search",{detail:this._search,bubbles:!1})),!this._isOptionsOpen&&!this.multiple&&this._hasTextInput&&this.inputRef.value&&this.inputRef.value.type!=="hidden"){const l=this._value[0]?O(this._value[0],this.options,this.displayValueAs):"";this.inputRef.value.value!==l&&(this.inputRef.value.value=l)}super.updated(t)}formResetCallback(){this.touched=!1;const t=this.defaultValue||(this.multiple,"");this.value=t,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(t,e,s){if(t==="options"){this._options=Array.isArray(this.options)?[...this.options]:[];const i=k.syncOptionsWithValues(this._options,this._value);this._options=i.options,i.newValues.length>this._value.length&&(this._value=i.newValues),this._search=""}super.attributeChangedCallback(t,e,s)}render(){return o.b`
|
|
2
|
-
<pkt-input-wrapper
|
|
3
|
-
.label=${this.label}
|
|
4
|
-
.helptext=${this.helptext}
|
|
5
|
-
.helptextDropdown=${d.o(this.helptextDropdown)}
|
|
6
|
-
.helptextDropdownButton=${d.o(this.helptextDropdownButton)}
|
|
7
|
-
?fullwidth=${this.fullwidth}
|
|
8
|
-
?hasError=${this.hasError}
|
|
9
|
-
?inline=${this.inline}
|
|
10
|
-
?disabled=${this.disabled}
|
|
11
|
-
.errorMessage=${this.errorMessage}
|
|
12
|
-
?optionalTag=${this.optionalTag}
|
|
13
|
-
.optionalText=${this.optionalText}
|
|
14
|
-
?requiredTag=${this.requiredTag}
|
|
15
|
-
.requiredText=${this.requiredText}
|
|
16
|
-
.tagText=${this.tagText}
|
|
17
|
-
useWrapper=${this.useWrapper}
|
|
18
|
-
.forId=${this._hasTextInput?this.id+"-input":this.id+"-combobox"}
|
|
19
|
-
?hasFieldset=${!this._hasTextInput}
|
|
20
|
-
class="pkt-combobox__wrapper"
|
|
21
|
-
@labelClick=${this.handleInputClick}
|
|
22
|
-
>
|
|
23
|
-
<div class="pkt-contents" ${f.n(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
24
|
-
<div class="pkt-combobox" @focusout=${this.handleFocusOut}>
|
|
25
|
-
<div
|
|
26
|
-
class=${V.e({"pkt-combobox__input":!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})}
|
|
27
|
-
id=${d.o(this._hasTextInput?void 0:`${this.id}-combobox`)}
|
|
28
|
-
role=${d.o(this._hasTextInput?void 0:"combobox")}
|
|
29
|
-
aria-expanded=${d.o(this._hasTextInput?void 0:this._isOptionsOpen?"true":"false")}
|
|
30
|
-
aria-controls=${d.o(this._hasTextInput?void 0:`${this.id}-listbox`)}
|
|
31
|
-
aria-haspopup=${d.o(this._hasTextInput?void 0:"listbox")}
|
|
32
|
-
aria-labelledby=${d.o(this._hasTextInput?void 0:`${this.id}-combobox-label`)}
|
|
33
|
-
aria-activedescendant=${d.o(!this._hasTextInput&&this._value[0]&&u.findOptionByValue(this.options,this._value[0])?`${this.id}-listbox-${u.findOptionIndex(this._options,this._value[0])}`:void 0)}
|
|
34
|
-
aria-description=${d.o(this._selectionDescription||void 0)}
|
|
35
|
-
tabindex=${this._hasTextInput||this.disabled?"-1":"0"}
|
|
36
|
-
@click=${this.handleInputClick}
|
|
37
|
-
@keydown=${this._hasTextInput?o.A:this.handleSelectOnlyKeydown}
|
|
38
|
-
${f.n(this.triggerRef)}
|
|
39
|
-
>
|
|
40
|
-
${!this._hasTextInput&&this.placeholder&&(!this._value.length||this.multiple&&this.tagPlacement=="outside")&&!this._inputFocus?o.b`<span class="pkt-combobox__placeholder" @click=${this.handlePlaceholderClick}
|
|
41
|
-
>${this.placeholder}</span
|
|
42
|
-
>`:this.tagPlacement!=="outside"?this.renderSingleOrMultipleValues():o.A}
|
|
43
|
-
${this.renderInputField()}
|
|
44
|
-
<pkt-icon
|
|
45
|
-
class=${V.e({"pkt-combobox__arrow-icon":!0,"pkt-combobox__arrow-icon--open":this._isOptionsOpen})}
|
|
46
|
-
name="chevron-thin-down"
|
|
47
|
-
aria-hidden="true"
|
|
48
|
-
></pkt-icon>
|
|
49
|
-
</div>
|
|
50
|
-
|
|
51
|
-
<pkt-listbox
|
|
52
|
-
id="${this.id}-listbox"
|
|
53
|
-
.options=${this._options}
|
|
54
|
-
.isOpen=${this._isOptionsOpen}
|
|
55
|
-
.searchPlaceholder=${this.searchPlaceholder}
|
|
56
|
-
.label="Liste: ${this.label||""}"
|
|
57
|
-
?include-search=${this.includeSearch}
|
|
58
|
-
?is-multi-select=${this.multiple}
|
|
59
|
-
?allow-user-input=${this.allowUserInput&&!this._maxIsReached}
|
|
60
|
-
?max-is-reached=${this._maxIsReached}
|
|
61
|
-
.customUserInput=${d.o(this._addValueText)}
|
|
62
|
-
.userMessage=${this._userInfoMessage}
|
|
63
|
-
@search=${this.handleSearch}
|
|
64
|
-
@option-toggle=${this.handleOptionToggled}
|
|
65
|
-
@select-all=${this.addAllOptions}
|
|
66
|
-
@close-options=${()=>this._isOptionsOpen=!1}
|
|
67
|
-
@tab-close=${()=>this.closeAndProcessInput()}
|
|
68
|
-
.searchValue=${this._search||null}
|
|
69
|
-
.maxLength=${this.maxlength||0}
|
|
70
|
-
${f.n(this.listboxRef)}
|
|
71
|
-
></pkt-listbox>
|
|
72
|
-
</div>
|
|
73
|
-
|
|
74
|
-
${this.tagPlacement==="outside"&&this.multiple?o.b`<div class="pkt-combobox__tags-outside">
|
|
75
|
-
${this.renderSingleOrMultipleValues()}
|
|
76
|
-
</div>`:o.A}
|
|
77
|
-
</pkt-input-wrapper>
|
|
78
|
-
`}renderInputField(){return this.typeahead||this.allowUserInput?o.b`
|
|
79
|
-
<div class="pkt-combobox__input-div combobox__input">
|
|
80
|
-
<input
|
|
81
|
-
type="text"
|
|
82
|
-
id="${this.id}-input"
|
|
83
|
-
name=${(this.name||this.id)+"-input"}
|
|
84
|
-
placeholder=${d.o(!this._value.length||this.multiple&&this.tagPlacement==="outside"?this.placeholder:void 0)}
|
|
85
|
-
@input=${this.handleInput}
|
|
86
|
-
@change=${t=>{t.stopPropagation(),t.stopImmediatePropagation()}}
|
|
87
|
-
@keydown=${this.handleInputKeydown}
|
|
88
|
-
@focus=${this.handleFocus}
|
|
89
|
-
@blur=${this.handleBlur}
|
|
90
|
-
autocomplete="off"
|
|
91
|
-
role="combobox"
|
|
92
|
-
aria-expanded=${this._isOptionsOpen?"true":"false"}
|
|
93
|
-
aria-label=${d.o(this.label)}
|
|
94
|
-
aria-autocomplete=${this.typeahead?"both":this.allowUserInput?"list":"none"}
|
|
95
|
-
aria-controls="${this.id}-listbox"
|
|
96
|
-
aria-activedescendant=${d.o(this._value[0]&&u.findOptionByValue(this.options,this._value[0])?`${this.id}-listbox-${u.findOptionIndex(this._options,this._value[0])}`:void 0)}
|
|
97
|
-
aria-description=${d.o(this._selectionDescription||void 0)}
|
|
98
|
-
${f.n(this.inputRef)}
|
|
99
|
-
/>
|
|
100
|
-
</div>
|
|
101
|
-
`:o.b`
|
|
102
|
-
<input
|
|
103
|
-
type="hidden"
|
|
104
|
-
id="${this.id}-input"
|
|
105
|
-
name=${(this.name||this.id)+"-input"}
|
|
106
|
-
.value=${this._value.join(",")}
|
|
107
|
-
${f.n(this.inputRef)}
|
|
108
|
-
/>
|
|
109
|
-
`}renderSingleOrMultipleValues(){if(!this.multiple&&this._hasTextInput)return o.A;const t=!this.multiple,e=this.renderValueTag(u.findOptionByValue(this.options,this._value[0])),s=this.tagPlacement==="outside",i=o.b`
|
|
110
|
-
<ul role="list" class="pkt-combobox__tag-list">
|
|
111
|
-
${T.c(this._value,l=>l,(l,n)=>{const p=u.findOptionByValue(this.options,l),_=p==null?void 0:p.tagSkinColor;return o.b`
|
|
112
|
-
<li
|
|
113
|
-
role="listitem"
|
|
114
|
-
@click=${s?o.A:v=>v.stopPropagation()}
|
|
115
|
-
@mousedown=${s?o.A:v=>v.preventDefault()}
|
|
116
|
-
>
|
|
117
|
-
<pkt-tag
|
|
118
|
-
skin=${_||"blue-dark"}
|
|
119
|
-
?closeTag=${!this.disabled}
|
|
120
|
-
.buttonTabindex=${s?void 0:-1}
|
|
121
|
-
@close=${()=>this.handleTagRemove(l)}
|
|
122
|
-
@keydown=${s?o.A:v=>this.handleTagKeydown(v,n)}
|
|
123
|
-
>
|
|
124
|
-
${this.renderValueTag(p)}
|
|
125
|
-
</pkt-tag>
|
|
126
|
-
</li>
|
|
127
|
-
`})}
|
|
128
|
-
</ul>
|
|
129
|
-
`;return t?e:i}renderValueTag(t){if(!t)return"";switch(this.displayValueAs){case"prefixAndValue":return o.b`<span class="pkt-combobox__value" data-focusfix=${this.id}
|
|
130
|
-
>${t.prefix||""} ${t.value}</span
|
|
131
|
-
>`;case"value":return o.b`<span class="pkt-combobox__value" data-focusfix=${this.id}
|
|
132
|
-
>${t.value}</span
|
|
133
|
-
>`;case"label":default:return o.b`<span class="pkt-combobox__value" data-focusfix=${this.id}
|
|
134
|
-
>${t.label||t.value}</span
|
|
135
|
-
>`}}};exports.PktCombobox=L([o.t("pkt-combobox")],exports.PktCombobox);
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("./element-CMTfByxQ.cjs"),x=require("./ref-CxLwrCxt.cjs"),h=require("./icon-Dj0oZZSa.cjs"),u=require("./class-map-Bokp1SoS.cjs"),a=require("./state-BNgpvY-A.cjs"),c=require("./utils-byXsEz1u.cjs"),d=require("./input-wrapper-EoSAbU-U.cjs"),k=require("./pkt-slot-controller-D4nKlom5.cjs");var w=Object.defineProperty,_=Object.getOwnPropertyDescriptor,l=(o,p,r,n)=>{for(var e=n>1?void 0:n?_(p,r):p,s=o.length-1,i;s>=0;s--)(i=o[s])&&(e=(n?i(p,r,e):i(e))||e);return n&&e&&w(p,r,e),e};exports.PktHelptext=class extends t.PktElement{constructor(){super(),this.defaultSlot=x.e(),this.forId=c.uuidish(),this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=d.specs.props.helptextDropdownButton.default,this.isHelpTextOpen=!1,this.filledSlots=new Set,this.slotController=new k.PktSlotController(this,this.defaultSlot)}updateSlots(p){this.filledSlots=new Set(p)}render(){const p=()=>{const s=!this.isHelpTextOpen;this.isHelpTextOpen=s,this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!0,detail:{isOpen:s}}))},r=u.e({"pkt-inputwrapper__helptext-container":!0,"pkt-inputwrapper__has-helptext":this.helptext||this.helptextDropdown||this.filledSlots.size>0}),n=()=>this.helptextDropdown?t.b`<div class="pkt-inputwrapper__helptext-expandable">
|
|
2
|
-
<button
|
|
3
|
-
class="pkt-link pkt-link--icon-right pkt-btn pkt-btn--small pkt-btn--tertiary pkt-btn--icon-right"
|
|
4
|
-
type="button"
|
|
5
|
-
@click=${p}
|
|
6
|
-
>
|
|
7
|
-
<pkt-icon
|
|
8
|
-
class="pkt-btn__icon"
|
|
9
|
-
name="${this.isHelpTextOpen?"chevron-thin-up":"chevron-thin-down"}"
|
|
10
|
-
></pkt-icon>
|
|
11
|
-
<span class="pkt-btn__text">${h.o(this.helptextDropdownButton)}</span>
|
|
12
|
-
</button>
|
|
13
|
-
<div
|
|
14
|
-
class="${u.e({"pkt-inputwrapper__helptext":!0,"pkt-inputwrapper__helptext-expandable-open":this.isHelpTextOpen,"pkt-inputwrapper__helptext-expandable-closed":!this.isHelpTextOpen})}"
|
|
15
|
-
>
|
|
16
|
-
${h.o(this.helptextDropdown)}
|
|
17
|
-
</div>
|
|
18
|
-
</div>`:t.A,e=()=>t.b`<div class="${r}">
|
|
19
|
-
<div class="pkt-inputwrapper__helptext" id="${this.forId}-helptext">
|
|
20
|
-
<div class="pkt-contents" ${x.n(this.defaultSlot)} name="helptext"></div>
|
|
21
|
-
${this.helptext&&h.o(this.helptext)}
|
|
22
|
-
</div>
|
|
23
|
-
${n()}
|
|
24
|
-
</div>`;return t.b`${e()}`}};l([t.n({type:String,reflect:!0})],exports.PktHelptext.prototype,"forId",2);l([t.n({type:String})],exports.PktHelptext.prototype,"helptext",2);l([t.n({type:String})],exports.PktHelptext.prototype,"helptextDropdown",2);l([t.n({type:String})],exports.PktHelptext.prototype,"helptextDropdownButton",2);l([a.r()],exports.PktHelptext.prototype,"isHelpTextOpen",2);l([a.r()],exports.PktHelptext.prototype,"filledSlots",2);exports.PktHelptext=l([t.t("pkt-helptext")],exports.PktHelptext);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const r=require("./element-CMTfByxQ.cjs"),St=require("./utils-byXsEz1u.cjs"),Ft=require("./booleanish-BKVonob4.cjs"),Tt=require("./input-wrapper-EoSAbU-U.cjs");var lt={},ct;function xt(){return ct||(ct=1,(function(){(function(p){const a=new WeakMap,n=new WeakMap,f=new WeakMap,u=new WeakMap,b=new WeakMap,k=new WeakMap,A=new WeakMap,g=new WeakMap,C=new WeakMap,V=new WeakMap,S=new WeakMap,F=new WeakMap,z=new WeakMap,K=new WeakMap,x=new WeakMap,I={ariaAtomic:"aria-atomic",ariaAutoComplete:"aria-autocomplete",ariaBusy:"aria-busy",ariaChecked:"aria-checked",ariaColCount:"aria-colcount",ariaColIndex:"aria-colindex",ariaColIndexText:"aria-colindextext",ariaColSpan:"aria-colspan",ariaCurrent:"aria-current",ariaDescription:"aria-description",ariaDisabled:"aria-disabled",ariaExpanded:"aria-expanded",ariaHasPopup:"aria-haspopup",ariaHidden:"aria-hidden",ariaInvalid:"aria-invalid",ariaKeyShortcuts:"aria-keyshortcuts",ariaLabel:"aria-label",ariaLevel:"aria-level",ariaLive:"aria-live",ariaModal:"aria-modal",ariaMultiLine:"aria-multiline",ariaMultiSelectable:"aria-multiselectable",ariaOrientation:"aria-orientation",ariaPlaceholder:"aria-placeholder",ariaPosInSet:"aria-posinset",ariaPressed:"aria-pressed",ariaReadOnly:"aria-readonly",ariaRelevant:"aria-relevant",ariaRequired:"aria-required",ariaRoleDescription:"aria-roledescription",ariaRowCount:"aria-rowcount",ariaRowIndex:"aria-rowindex",ariaRowIndexText:"aria-rowindextext",ariaRowSpan:"aria-rowspan",ariaSelected:"aria-selected",ariaSetSize:"aria-setsize",ariaSort:"aria-sort",ariaValueMax:"aria-valuemax",ariaValueMin:"aria-valuemin",ariaValueNow:"aria-valuenow",ariaValueText:"aria-valuetext",role:"role"},ht=(e,t)=>{for(let i in I){t[i]=null;let s=null;const o=I[i];Object.defineProperty(t,i,{get(){return s},set(d){s=d,e.isConnected?M(e,o,d):V.set(e,t)}})}};function j(e){const t=u.get(e),{form:i}=t;Z(e,i,t),Y(e,t.labels)}const G=(e,t=!1)=>{const i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(d){return u.has(d)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let s=i.nextNode();const o=!t||e.disabled;for(;s;)s.formDisabledCallback&&o&&_(s,e.disabled),s=i.nextNode()},J={attributes:!0,attributeFilter:["disabled","name"]},R=O()?new MutationObserver(e=>{for(const t of e){const i=t.target;if(t.attributeName==="disabled"&&(i.constructor.formAssociated?_(i,i.hasAttribute("disabled")):i.localName==="fieldset"&&G(i)),t.attributeName==="name"&&i.constructor.formAssociated){const s=u.get(i),o=C.get(i);s.setFormValue(o)}}}):{};function P(e){e.forEach(t=>{const{addedNodes:i,removedNodes:s}=t,o=Array.from(i),d=Array.from(s);o.forEach(h=>{var y;if(u.has(h)&&h.constructor.formAssociated&&j(h),V.has(h)){const m=V.get(h);Object.keys(I).filter(v=>m[v]!==null).forEach(v=>{M(h,I[v],m[v])}),V.delete(h)}if(x.has(h)){const m=x.get(h);M(h,"internals-valid",m.validity.valid.toString()),M(h,"internals-invalid",(!m.validity.valid).toString()),M(h,"aria-invalid",(!m.validity.valid).toString()),x.delete(h)}if(h.localName==="form"){const m=g.get(h),E=document.createTreeWalker(h,NodeFilter.SHOW_ELEMENT,{acceptNode($){return u.has($)&&$.constructor.formAssociated&&!(m&&m.has($))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let v=E.nextNode();for(;v;)j(v),v=E.nextNode()}h.localName==="fieldset"&&((y=R.observe)===null||y===void 0||y.call(R,h,J),G(h,!0))}),d.forEach(h=>{const y=u.get(h);y&&f.get(y)&&Q(y),A.has(h)&&A.get(h).disconnect()})})}function ut(e){e.forEach(t=>{const{removedNodes:i}=t;i.forEach(s=>{const o=z.get(t.target);u.has(s)&&et(s),o.disconnect()})})}const ft=e=>{var t,i;const s=new MutationObserver(ut);!((t=window==null?void 0:window.ShadyDOM)===null||t===void 0)&&t.inUse&&e.mode&&e.host&&(e=e.host),(i=s.observe)===null||i===void 0||i.call(s,e,{childList:!0}),z.set(e,s)};O()&&new MutationObserver(P);const B={childList:!0,subtree:!0},M=(e,t,i)=>{e.getAttribute(t)!==i&&e.setAttribute(t,i)},_=(e,t)=>{e.toggleAttribute("internals-disabled",t),t?M(e,"aria-disabled","true"):e.removeAttribute("aria-disabled"),e.formDisabledCallback&&e.formDisabledCallback.apply(e,[t])},Q=e=>{f.get(e).forEach(i=>{i.remove()}),f.set(e,[])},X=(e,t)=>{const i=document.createElement("input");return i.type="hidden",i.name=e.getAttribute("name"),e.after(i),f.get(t).push(i),i},pt=(e,t)=>{var i;f.set(t,[]),(i=R.observe)===null||i===void 0||i.call(R,e,J)},Y=(e,t)=>{if(t.length){Array.from(t).forEach(s=>s.addEventListener("click",e.click.bind(e)));let i=t[0].id;t[0].id||(i=`${t[0].htmlFor}_Label`,t[0].id=i),M(e,"aria-labelledby",i)}},L=e=>{const t=Array.from(e.elements).filter(d=>!d.tagName.includes("-")&&d.validity).map(d=>d.validity.valid),i=g.get(e)||[],s=Array.from(i).filter(d=>d.isConnected).map(d=>u.get(d).validity.valid),o=[...t,...s].includes(!1);e.toggleAttribute("internals-invalid",o),e.toggleAttribute("internals-valid",!o)},mt=e=>{L(N(e.target))},yt=e=>{L(N(e.target))},gt=e=>{const t=["button[type=submit]","input[type=submit]","button:not([type])"].map(i=>`${i}:not([disabled])`).map(i=>`${i}:not([form])${e.id?`,${i}[form='${e.id}']`:""}`).join(",");e.addEventListener("click",i=>{if(i.target.closest(t)){const o=g.get(e);if(e.noValidate)return;o.size&&Array.from(o).reverse().map(y=>u.get(y).reportValidity()).includes(!1)&&i.preventDefault()}})},vt=e=>{const t=g.get(e.target);t&&t.size&&t.forEach(i=>{i.constructor.formAssociated&&i.formResetCallback&&i.formResetCallback.apply(i)})},Z=(e,t,i)=>{if(t){const s=g.get(t);if(s)s.add(e);else{const o=new Set;o.add(e),g.set(t,o),gt(t),t.addEventListener("reset",vt),t.addEventListener("input",mt),t.addEventListener("change",yt)}k.set(t,{ref:e,internals:i}),e.constructor.formAssociated&&e.formAssociatedCallback&&setTimeout(()=>{e.formAssociatedCallback.apply(e,[t])},0),L(t)}},N=e=>{let t=e.parentNode;return t&&t.tagName!=="FORM"&&(t=N(t)),t},w=(e,t,i=DOMException)=>{if(!e.constructor.formAssociated)throw new i(t)},tt=(e,t,i)=>{const s=g.get(e);return s&&s.size&&s.forEach(o=>{u.get(o)[i]()||(t=!1)}),t},et=e=>{if(e.constructor.formAssociated){const t=u.get(e),{labels:i,form:s}=t;Y(e,i),Z(e,s,t)}};function O(){return typeof MutationObserver<"u"}class bt{constructor(){this.badInput=!1,this.customError=!1,this.patternMismatch=!1,this.rangeOverflow=!1,this.rangeUnderflow=!1,this.stepMismatch=!1,this.tooLong=!1,this.tooShort=!1,this.typeMismatch=!1,this.valid=!0,this.valueMissing=!1,Object.seal(this)}}const wt=e=>(e.badInput=!1,e.customError=!1,e.patternMismatch=!1,e.rangeOverflow=!1,e.rangeUnderflow=!1,e.stepMismatch=!1,e.tooLong=!1,e.tooShort=!1,e.typeMismatch=!1,e.valid=!0,e.valueMissing=!1,e),Et=(e,t,i)=>(e.valid=Mt(t),Object.keys(t).forEach(s=>e[s]=t[s]),i&&L(i),e),Mt=e=>{let t=!0;for(let i in e)i!=="valid"&&e[i]!==!1&&(t=!1);return t},H=new WeakMap;function it(e,t){e.toggleAttribute(t,!0),e.part&&e.part.add(t)}class W extends Set{static get isPolyfilled(){return!0}constructor(t){if(super(),!t||!t.tagName||t.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");H.set(this,t)}add(t){if(!/^--/.test(t)||typeof t!="string")throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${t} must start with '--'.`);const i=super.add(t),s=H.get(this),o=`state${t}`;return s.isConnected?it(s,o):setTimeout(()=>{it(s,o)}),i}clear(){for(let[t]of this.entries())this.delete(t);super.clear()}delete(t){const i=super.delete(t),s=H.get(this);return s.isConnected?(s.toggleAttribute(`state${t}`,!1),s.part&&s.part.remove(`state${t}`)):setTimeout(()=>{s.toggleAttribute(`state${t}`,!1),s.part&&s.part.remove(`state${t}`)}),i}}function at(e,t,i,s){if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?s:i==="a"?s.call(e):s?s.value:t.get(e)}function kt(e,t,i,s,o){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,i),i}var T;class Vt{constructor(t){T.set(this,void 0),kt(this,T,t);for(let i=0;i<t.length;i++){let s=t[i];this[i]=s,s.hasAttribute("name")&&(this[s.getAttribute("name")]=s)}Object.freeze(this)}get length(){return at(this,T,"f").length}[(T=new WeakMap,Symbol.iterator)](){return at(this,T,"f")[Symbol.iterator]()}item(t){return this[t]==null?null:this[t]}namedItem(t){return this[t]==null?null:this[t]}}function At(){const e=HTMLFormElement.prototype.checkValidity;HTMLFormElement.prototype.checkValidity=i;const t=HTMLFormElement.prototype.reportValidity;HTMLFormElement.prototype.reportValidity=s;function i(...d){let h=e.apply(this,d);return tt(this,h,"checkValidity")}function s(...d){let h=t.apply(this,d);return tt(this,h,"reportValidity")}const{get:o}=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements");Object.defineProperty(HTMLFormElement.prototype,"elements",{get(...d){const h=o.call(this,...d),y=Array.from(g.get(this)||[]);if(y.length===0)return h;const m=Array.from(h).concat(y).sort((E,v)=>E.compareDocumentPosition?E.compareDocumentPosition(v)&2?1:-1:0);return new Vt(m)}})}class st{static get isPolyfilled(){return!0}constructor(t){if(!t||!t.tagName||t.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");const i=t.getRootNode(),s=new bt;this.states=new W(t),a.set(this,t),n.set(this,s),u.set(t,this),ht(t,this),pt(t,this),Object.seal(this),i instanceof DocumentFragment&&ft(i)}checkValidity(){const t=a.get(this);if(w(t,"Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const i=n.get(this);if(!i.valid){const s=new Event("invalid",{bubbles:!1,cancelable:!0,composed:!1});t.dispatchEvent(s)}return i.valid}get form(){const t=a.get(this);w(t,"Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.");let i;return t.constructor.formAssociated===!0&&(i=N(t)),i}get labels(){const t=a.get(this);w(t,"Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.");const i=t.getAttribute("id"),s=t.getRootNode();return s&&i?s.querySelectorAll(`[for="${i}"]`):[]}reportValidity(){const t=a.get(this);if(w(t,"Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const i=this.checkValidity(),s=F.get(this);if(s&&!t.constructor.formAssociated)throw new DOMException("Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.");return!i&&s&&(t.focus(),s.focus()),i}setFormValue(t){const i=a.get(this);if(w(i,"Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element."),Q(this),t!=null&&!(t instanceof FormData)){if(i.getAttribute("name")){const s=X(i,this);s.value=t}}else t!=null&&t instanceof FormData&&Array.from(t).reverse().forEach(([s,o])=>{if(typeof o=="string"){const d=X(i,this);d.name=s,d.value=o}});C.set(i,t)}setValidity(t,i,s){const o=a.get(this);if(w(o,"Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!t)throw new TypeError("Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.");F.set(this,s);const d=n.get(this),h={};for(const E in t)h[E]=t[E];Object.keys(h).length===0&&wt(d);const y=Object.assign(Object.assign({},d),h);delete y.valid;const{valid:m}=Et(d,y,this.form);if(!m&&!i)throw new DOMException("Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true.");b.set(this,m?"":i),o.isConnected?(o.toggleAttribute("internals-invalid",!m),o.toggleAttribute("internals-valid",m),M(o,"aria-invalid",`${!m}`)):x.set(o,this)}get shadowRoot(){const t=a.get(this),i=S.get(t);return i||null}get validationMessage(){const t=a.get(this);return w(t,"Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element."),b.get(this)}get validity(){const t=a.get(this);return w(t,"Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."),n.get(this)}get willValidate(){const t=a.get(this);return w(t,"Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element."),!(t.disabled||t.hasAttribute("disabled")||t.hasAttribute("readonly"))}}function Ct(){if(typeof window>"u"||!window.ElementInternals||!HTMLElement.prototype.attachInternals)return!1;class e extends HTMLElement{constructor(){super(),this.internals=this.attachInternals()}}const t=`element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g,"")}`;customElements.define(t,e);const i=new e;return["shadowRoot","form","willValidate","validity","validationMessage","labels","setFormValue","setValidity","checkValidity","reportValidity"].every(s=>s in i.internals)}let rt=!1,nt=!1;function q(e){nt||(nt=!0,window.CustomStateSet=W,e&&(HTMLElement.prototype.attachInternals=function(...t){const i=e.call(this,t);return i.states=new W(this),i}))}function ot(e=!0){if(!rt){if(rt=!0,typeof window<"u"&&(window.ElementInternals=st),typeof CustomElementRegistry<"u"){const t=CustomElementRegistry.prototype.define;CustomElementRegistry.prototype.define=function(i,s,o){if(s.formAssociated){const d=s.prototype.connectedCallback;s.prototype.connectedCallback=function(){K.has(this)||(K.set(this,!0),this.hasAttribute("disabled")&&_(this,!0)),d!=null&&d.apply(this),et(this)}}t.call(this,i,s,o)}}if(typeof HTMLElement<"u"&&(HTMLElement.prototype.attachInternals=function(){if(this.tagName){if(this.tagName.indexOf("-")===-1)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.")}else return{};if(u.has(this))throw new DOMException("DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");return new st(this)}),typeof Element<"u"){let t=function(...s){const o=i.apply(this,s);if(S.set(this,o),O()){const d=new MutationObserver(P);window.ShadyDOM?d.observe(this,B):d.observe(o,B),A.set(this,d)}return o};const i=Element.prototype.attachShadow;Element.prototype.attachShadow=t}O()&&typeof document<"u"&&new MutationObserver(P).observe(document.documentElement,B),typeof HTMLFormElement<"u"&&At(),(e||typeof window<"u"&&!window.CustomStateSet)&&q()}}return!!customElements.polyfillWrapFlushCallback||(Ct()?typeof window<"u"&&!window.CustomStateSet&&q(HTMLElement.prototype.attachInternals):ot(!1)),p.forceCustomStateSetPolyfill=q,p.forceElementInternalsPolyfill=ot,Object.defineProperty(p,"__esModule",{value:!0}),p})({})})()),lt}xt();var It=Object.defineProperty,c=(p,a,n,f)=>{for(var u=void 0,b=p.length-1,k;b>=0;b--)(k=p[b])&&(u=k(a,n,u)||u);return u&&It(a,n,u),u};const dt="on",U="--checked",D=",";class l extends r.PktElement{constructor(){super(),this.defaultValue=null,this.disabled=!1,this.readonly=!1,this.required=!1,this.max=null,this.maxlength=null,this.min=null,this.minlength=null,this.step=null,this.ariaDescribedBy=null,this.ariaLabelledby=null,this.name="",this.pattern=null,this.placeholder=null,this.id=St.uuidish(),this.counter=!1,this.hasError=!1,this.inline=!1,this.hasFieldset=!1,this.optionalTag=!1,this.requiredTag=!1,this.skipForwardTestid=!1,this.useWrapper=!0,this.fullwidth=!1,this.counterMaxLength=0,this.errorMessage="",this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=Tt.specs.props.helptextDropdownButton.default,this.label=null,this.optionalText=r.strings.forms.labels.optional,this.requiredText=r.strings.forms.labels.required,this.tagText=null,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(a){var n,f,u,b,k,A,g,C,V,S,F;if(!a){console.warn("manageValidity called without valid input element");return}this.required&&!this.value?this.internals.setValidity({valueMissing:!0},r.strings.forms.messages.required,a):(n=a.validity)!=null&&n.typeMismatch||(f=a.validity)!=null&&f.badInput?this.internals.setValidity({typeMismatch:!0},r.strings.forms.messages.invalid,a):(u=a.validity)!=null&&u.patternMismatch?this.internals.setValidity({patternMismatch:!0},r.strings.forms.messages.invalidPattern,a):(b=a.validity)!=null&&b.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},r.strings.forms.messages.tooShort,a):(k=a.validity)!=null&&k.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},r.strings.forms.messages.tooLong,a):(A=a.validity)!=null&&A.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},this.min?r.strings.forms.messages.rangeUnderflowMin.replace("{min}",(g=this.min)==null?void 0:g.toString()):r.strings.forms.messages.rangeUnderflow,a):(C=a.validity)!=null&&C.stepMismatch?this.internals.setValidity({stepMismatch:!0},r.strings.forms.messages.invalid,a):(V=a.validity)!=null&&V.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},this.max?r.strings.forms.messages.rangeOverflowMax.replace("{max}",(S=this.max)==null?void 0:S.toString()):r.strings.forms.messages.rangeOverflow,a):(F=a.validity)!=null&&F.customError?this.internals.setValidity({customError:!0},a.validationMessage,a):this.internals.setValidity({})}setFormValue(a){if(this.internals)if(Array.isArray(a)){const n=new FormData;a.forEach(f=>{n.append(this.name,f)}),this.internals.setFormValue(n)}else this.internals.setFormValue(a)}coordinateRadioGroup(){if(!this.form||!this.name||this.type!=="radio")return;const a=`pkt-radiobutton[name="${this.name}"], input[type=radio][name="${this.name}"]`;this.form.querySelectorAll(a).forEach(n=>{var f;if(n!==this&&n.getAttribute("name")===this.name&&n.getAttribute("value")!==this.value){const u=n;u.checked&&(u.checked=!1,u.internals&&(u.internals.setFormValue(null),(f=u.internals.states)==null||f.delete(U)))}})}valueChecked(a){if(!this.touched)return;const n=this.internals.form||this.closest("form"),f=n?new FormData(n):null;if(this.type==="radio"&&this.coordinateRadioGroup(),typeof a=="string"?(this.checked=a==="true",this.internals.ariaChecked=String(a==="true")):typeof a=="boolean"&&(this.checked=a,this.internals.ariaChecked=String(a)),this.checked){const u=(typeof this.value=="string"?this.value:"")||dt;this.internals.setFormValue(u),f&&f.append(this.name,u),this.internals.states.add(U)}else this.internals.setFormValue(null),f&&f.delete(this.name),this.internals.states.delete(U);this.dispatchChangeEvents(this.checked),this.internals.reportValidity()}valueChanged(a,n){(n!==this.value||n!==this._value)&&(typeof a=="string"?((this.multiple||this.range)&&a.includes(D)&&(a=a.split(D)),this.value=a,this._value=Array.isArray(a)?a:[a]):Array.isArray(a)?(this.value=this.multiple||this.range?a:a[0],this._value=a):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&n&&n.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(n==null?void 0:n.toString())&&this.onChange(this.value))}dispatchChangeEvents(a){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:a,bubbles:!0,composed:!0}))}clearInputValue(){const a=this.multiple||this.range?[]:"";this.value=a,this.setFormValue(a),this.dispatchChangeEvents(a)}onFocus(){this.dispatchEvent(new FocusEvent("focus",{bubbles:!0,composed:!0}))}onBlur(){this.dispatchEvent(new FocusEvent("blur",{bubbles:!0,composed:!0}))}onInput(){this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0}))}normalizeValue(a){return(this.range||this.multiple)&&typeof a=="string"&&a.includes(D)?a.split(D):!this.multiple&&!this.range&&Array.isArray(a)?a[0]||"":a}validate(){var a,n;(a=this.inputRef)!=null&&a.value&&this.manageValidity(this.inputRef.value),(n=this.inputRefTo)!=null&&n.value&&this.manageValidity(this.inputRefTo.value)}onChange(a){if(!this.touched){this.touched=!0,a&&this.setFormValue(a);return}if(typeof a!="string"&&!Array.isArray(a))return;const n=this.normalizeValue(a);this.setFormValue(n),this.validate(),this.dispatchChangeEvents(n)}formResetCallback(){var a;if(this.touched=!1,this._options&&this._options.length&&this._options.forEach(n=>{"selected"in n&&(n.selected=!1)}),this.checked!==void 0)this.checked=!1,this.internals.ariaChecked="false",this.internals.setFormValue(""),(a=this.inputRef)!=null&&a.value&&"checked"in this.inputRef.value&&(this.inputRef.value.checked=!1),this.valueChecked(this.checked);else{this.internals.setFormValue("");const n=this.defaultValue||(this.multiple||this.range?[]:"");this.value=n,this._value=Array.isArray(n)?n:[n],this.valueChanged(this.value,null)}this.internals.ariaInvalid="false"}updated(a){super.updated(a),a.has("dataTestid")&&this.dataTestid&&this.inputRef.value&&(this.skipForwardTestid?this.hasAttribute("data-testid")||this.setAttribute("data-testid",this.dataTestid):(this.inputRef.value.dataset.testid=this.dataTestid,this.removeAttribute("data-testid")))}firstUpdated(a){if(super.firstUpdated(a),!this.form){const n=this.internals.form||this.closest("form");this.form=n}if(this.value&&this.defaultValue===null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null),this.defaultChecked&&(this.internals.ariaChecked="true",this.checked=!0),this.required&&(this.internals.ariaRequired="true"),this.disabled&&(this.internals.ariaDisabled="true"),this.id&&!this.name&&(this.name=this.id),this.checked!==void 0){const n=this.checked===""||this.checked==="true"||this.checked===!0;this.internals.ariaChecked=String(n);const f=n?(typeof this.value=="string"?this.value:"")||dt:null;this.internals.setFormValue(f)}else this.setFormValue(this.value);this.inputRef&&this.inputRef.value&&(this.inputRef.value.setAttribute("form",""),this.manageValidity(this.inputRef.value)),this.inputRefTo&&this.inputRefTo.value&&(this.inputRefTo.value.setAttribute("form",""),this.manageValidity(this.inputRefTo.value))}}c([r.n({type:Boolean,reflect:!0})],l.prototype,"checked");c([r.n({type:Boolean})],l.prototype,"defaultChecked");c([r.n({type:Boolean})],l.prototype,"multiple");c([r.n({type:Boolean})],l.prototype,"range");c([r.n({type:String,reflect:!0})],l.prototype,"type");c([r.n()],l.prototype,"defaultValue");c([r.n({type:Boolean,reflect:!0})],l.prototype,"disabled");c([r.n({type:Boolean,reflect:!0})],l.prototype,"readonly");c([r.n({type:Boolean,reflect:!0})],l.prototype,"required");c([r.n({reflect:!0,converter:{fromAttribute:p=>p,toAttribute:p=>(p==null?void 0:p.toString())??null}})],l.prototype,"max");c([r.n({type:Number,reflect:!0})],l.prototype,"maxlength");c([r.n({reflect:!0,converter:{fromAttribute:p=>p,toAttribute:p=>(p==null?void 0:p.toString())??null}})],l.prototype,"min");c([r.n({type:Number,reflect:!0})],l.prototype,"minlength");c([r.n({type:Number,reflect:!0})],l.prototype,"step");c([r.n({type:String})],l.prototype,"ariaDescribedBy");c([r.n({type:String})],l.prototype,"ariaLabelledby");c([r.n({type:String,reflect:!0})],l.prototype,"name");c([r.n({type:String,reflect:!0})],l.prototype,"pattern");c([r.n({type:String,reflect:!0})],l.prototype,"placeholder");c([r.n({type:String,reflect:!0})],l.prototype,"id");c([r.n({type:Boolean})],l.prototype,"counter");c([r.n({type:Boolean})],l.prototype,"hasError");c([r.n({type:Boolean})],l.prototype,"inline");c([r.n({type:Boolean})],l.prototype,"hasFieldset");c([r.n({type:Boolean})],l.prototype,"optionalTag");c([r.n({type:Boolean})],l.prototype,"requiredTag");c([r.n({type:Boolean})],l.prototype,"skipForwardTestid");c([r.n({type:Boolean,reflect:!0,converter:Ft.booleanishConverter})],l.prototype,"useWrapper");c([r.n({type:Boolean,reflect:!0})],l.prototype,"fullwidth");c([r.n({type:Number})],l.prototype,"counterMaxLength");c([r.n({type:String})],l.prototype,"errorMessage");c([r.n({type:String})],l.prototype,"helptext");c([r.n({type:String})],l.prototype,"helptextDropdown");c([r.n({type:String,reflect:!1})],l.prototype,"helptextDropdownButton");c([r.n({type:String})],l.prototype,"label");c([r.n({type:String,reflect:!1})],l.prototype,"optionalText");c([r.n({type:String,reflect:!1})],l.prototype,"requiredText");c([r.n({type:String,reflect:!1})],l.prototype,"tagText");c([r.n({type:String,attribute:"data-testid"})],l.prototype,"dataTestid");exports.PktInputElement=l;
|