@oslokommune/punkt-elements 15.4.5 → 16.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/{card-CnPjrdre.js → card-CmfUyl_s.js} +1 -1
  3. package/dist/{card-5S2r9UD1.cjs → card-Db9QSEqh.cjs} +1 -1
  4. package/dist/{checkbox-D98_NjcU.cjs → checkbox-Cpyay9_l.cjs} +1 -1
  5. package/dist/{checkbox-BSz71IeT.js → checkbox-D6nltMuc.js} +1 -1
  6. package/dist/combobox-Bv37b6cI.cjs +135 -0
  7. package/dist/combobox-CoO8T-F-.js +818 -0
  8. package/dist/{datepicker-SEKblnRR.cjs → datepicker-CrvQ5Y5w.cjs} +1 -1
  9. package/dist/{datepicker-nnyTW0vf.js → datepicker-DbsIuC5Z.js} +2 -2
  10. package/dist/index.d.ts +157 -90
  11. package/dist/{input-element-Bkv6Yxld.js → input-element-BGNbdzy2.js} +1 -1
  12. package/dist/{input-element-DM0tY799.cjs → input-element-CSDVA3Y6.cjs} +1 -1
  13. package/dist/listbox-Dm2mKp6_.cjs +101 -0
  14. package/dist/listbox-OdkIn9_A.js +431 -0
  15. package/dist/pkt-card.cjs +1 -1
  16. package/dist/pkt-card.js +1 -1
  17. package/dist/pkt-checkbox.cjs +1 -1
  18. package/dist/pkt-checkbox.js +1 -1
  19. package/dist/pkt-combobox.cjs +1 -1
  20. package/dist/pkt-combobox.js +1 -1
  21. package/dist/pkt-datepicker.cjs +1 -1
  22. package/dist/pkt-datepicker.js +2 -2
  23. package/dist/pkt-header.cjs +1 -1
  24. package/dist/pkt-header.js +1 -1
  25. package/dist/pkt-index.cjs +1 -1
  26. package/dist/pkt-index.js +9 -9
  27. package/dist/pkt-listbox.cjs +1 -1
  28. package/dist/pkt-listbox.js +1 -1
  29. package/dist/pkt-options-controller-BogGk-6J.cjs +1 -0
  30. package/dist/{pkt-options-controller-BcGywCmf.js → pkt-options-controller-Z-bPox7n.js} +2 -2
  31. package/dist/pkt-radiobutton.cjs +1 -1
  32. package/dist/pkt-radiobutton.js +1 -1
  33. package/dist/pkt-select.cjs +1 -1
  34. package/dist/pkt-select.js +1 -1
  35. package/dist/pkt-tag.cjs +1 -1
  36. package/dist/pkt-tag.js +1 -1
  37. package/dist/pkt-textarea.cjs +1 -1
  38. package/dist/pkt-textarea.js +1 -1
  39. package/dist/pkt-textinput.cjs +1 -1
  40. package/dist/pkt-textinput.js +1 -1
  41. package/dist/{radiobutton-95wp024h.cjs → radiobutton-CNHCpKn0.cjs} +1 -1
  42. package/dist/{radiobutton-CTFAV5GU.js → radiobutton-DgC27mb0.js} +1 -1
  43. package/dist/{select-YLvYAQX6.js → select-7VuYtPZv.js} +2 -2
  44. package/dist/{select-CZ_Lx5W6.cjs → select-PWPy5gTB.cjs} +1 -1
  45. package/dist/{tag-68q0_Sn0.js → tag-DZPqFiem.js} +37 -33
  46. package/dist/tag-DmbgBCKu.cjs +27 -0
  47. package/dist/{textarea-CuTsE1WX.cjs → textarea-CO7Ikug5.cjs} +1 -1
  48. package/dist/{textarea-DhWH99qN.js → textarea-VpCEjVFx.js} +1 -1
  49. package/dist/{textinput-BCi9p0Du.js → textinput-C2AZ9ss2.js} +1 -1
  50. package/dist/{textinput-st4Vml5J.cjs → textinput-DRFZU3dA.cjs} +1 -1
  51. package/package.json +4 -4
  52. package/src/components/card/card.ts +1 -0
  53. package/src/components/combobox/combobox-base.ts +158 -0
  54. package/src/components/combobox/combobox-handlers.ts +419 -0
  55. package/src/components/combobox/combobox-types.ts +10 -0
  56. package/src/components/combobox/combobox-utils.ts +135 -0
  57. package/src/components/combobox/combobox-value.ts +248 -0
  58. package/src/components/combobox/combobox.accessibility.test.ts +243 -0
  59. package/src/components/combobox/{combobox.test.ts → combobox.core.test.ts} +104 -46
  60. package/src/components/combobox/combobox.interaction.test.ts +436 -0
  61. package/src/components/combobox/combobox.selection.test.ts +543 -0
  62. package/src/components/combobox/combobox.ts +260 -734
  63. package/src/components/listbox/index.ts +2 -0
  64. package/src/components/listbox/listbox.interaction.test.ts +580 -0
  65. package/src/components/listbox/listbox.test.ts +32 -6
  66. package/src/components/listbox/listbox.ts +109 -126
  67. package/src/components/tag/tag.ts +3 -0
  68. package/dist/combobox-C5YcNVSZ.cjs +0 -128
  69. package/dist/combobox-cer7PLSE.js +0 -533
  70. package/dist/listbox-C7NEa9SU.cjs +0 -96
  71. package/dist/listbox-Cykec1bj.js +0 -361
  72. package/dist/pkt-options-controller-BnTmkl3g.cjs +0 -1
  73. package/dist/tag-BnT5onW2.cjs +0 -26
@@ -1,4 +1,4 @@
1
- "use strict";const l=require("./element-CMTfByxQ.cjs"),I=require("./state-BNgpvY-A.cjs"),u=require("./calendar-DjbO2g5L.cjs"),A=require("./input-element-DM0tY799.cjs"),o=require("./ref-CxLwrCxt.cjs");require("./icon-Dj0oZZSa.cjs");require("./input-wrapper-JU4D2TGu.cjs");const m=require("./class-map-Bokp1SoS.cjs"),M=require("./repeat-C-FJ2vfy.cjs");require("./tag-BnT5onW2.cjs");const O=require("./utils-byXsEz1u.cjs"),g=require("./if-defined-hKKmbsI8.cjs"),F=require("./pkt-slot-controller-D4nKlom5.cjs"),B={calendar:{buttonAltText:"Åpne kalender"}},j={calendar:{buttonAltText:"Åpne kalender"},generic:{from:"Fra",to:"Til"}};var q=Object.defineProperty,L=Object.getOwnPropertyDescriptor,b=(s,e,t,a)=>{for(var i=a>1?void 0:a?L(e,t):e,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(a?n(e,t,i):n(i))||i);return a&&i&&q(e,t,i),i};exports.PktDateTags=class extends l.PktElement{constructor(){super(...arguments),this.dates=[],this.dateformat="dd.MM.yyyy",this.className="pkt-datepicker__tags",this.idBase=O.uuidish()}render(){return this.classes={"pkt-date-tags":!0,[this.className]:!0},l.b`
1
+ "use strict";const l=require("./element-CMTfByxQ.cjs"),I=require("./state-BNgpvY-A.cjs"),u=require("./calendar-DjbO2g5L.cjs"),A=require("./input-element-CSDVA3Y6.cjs"),o=require("./ref-CxLwrCxt.cjs");require("./icon-Dj0oZZSa.cjs");require("./input-wrapper-JU4D2TGu.cjs");const m=require("./class-map-Bokp1SoS.cjs"),M=require("./repeat-C-FJ2vfy.cjs");require("./tag-DmbgBCKu.cjs");const O=require("./utils-byXsEz1u.cjs"),g=require("./if-defined-hKKmbsI8.cjs"),F=require("./pkt-slot-controller-D4nKlom5.cjs"),B={calendar:{buttonAltText:"Åpne kalender"}},j={calendar:{buttonAltText:"Åpne kalender"},generic:{from:"Fra",to:"Til"}};var q=Object.defineProperty,L=Object.getOwnPropertyDescriptor,b=(s,e,t,a)=>{for(var i=a>1?void 0:a?L(e,t):e,r=s.length-1,n;r>=0;r--)(n=s[r])&&(i=(a?n(e,t,i):n(i))||i);return a&&i&&q(e,t,i),i};exports.PktDateTags=class extends l.PktElement{constructor(){super(...arguments),this.dates=[],this.dateformat="dd.MM.yyyy",this.className="pkt-datepicker__tags",this.idBase=O.uuidish()}render(){return this.classes={"pkt-date-tags":!0,[this.className]:!0},l.b`
2
2
  <div class=${m.e(this.classes)} aria-live="polite">
3
3
  ${Array.isArray(this.dates)&&this.dates[0]?M.c(u.sortDateStrings((this.dates??[]).filter(Boolean)),e=>e,e=>{var t;return l.b` <pkt-tag
4
4
  id=${this.idBase+e+"-tag"}
@@ -1,13 +1,13 @@
1
1
  import { P as L, A as D, b as h, n as r, t as x } from "./element-CV9utnHJ.js";
2
2
  import { r as z } from "./state-l4hGZdFJ.js";
3
3
  import { s as H, f as N, a as Q, i as X, n as k, b as j, c as W, v as P, d as Y, p as Z, e as G } from "./calendar-DTnx3DDH.js";
4
- import { P as ee } from "./input-element-Bkv6Yxld.js";
4
+ import { P as ee } from "./input-element-BGNbdzy2.js";
5
5
  import { e as f, n as v } from "./ref-Dma3n3i8.js";
6
6
  import "./icon-D0IQAVwS.js";
7
7
  import "./input-wrapper-CaUY90qz.js";
8
8
  import { e as $ } from "./class-map-3ADKve8g.js";
9
9
  import { c as te } from "./repeat-DnlRNf63.js";
10
- import "./tag-68q0_Sn0.js";
10
+ import "./tag-DZPqFiem.js";
11
11
  import { u as se, s as ie } from "./utils-DznhwRXm.js";
12
12
  import { o as g } from "./if-defined-rXcLNTzN.js";
13
13
  import { P as ae } from "./pkt-slot-controller-D7CrjM52.js";
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import { Booleanish } from '../../../../../shared-types';
2
2
  import { Booleanish as Booleanish_2 } from '../../../../shared-types';
3
3
  import { IAriaAttributes } from '../../../../../shared-types';
4
4
  import { IDatepickerStrings } from '../../../../../shared-types/datepicker';
5
+ import { IPktComboboxOption } from '../../../../../shared-types/combobox';
5
6
  import { LitElement } from 'lit';
6
- import { nothing } from 'lit';
7
7
  import { PktIconName } from '@oslokommune/punkt-assets/dist/icons/icon';
8
8
  import { PropertyValues } from 'lit';
9
9
  import { ReactiveController } from 'lit';
@@ -25,11 +25,129 @@ import { THeadingWeight } from '../../../../../shared-types';
25
25
  import { THTMLButtonType } from '../../../../../shared-types';
26
26
  import { TLayout } from '../../../../../shared-types';
27
27
  import { TMessageboxSkin } from '../../../../../shared-types';
28
+ import { TPktComboboxTagPlacement } from '../../../../../shared-types/combobox';
28
29
  import { TLogOutButtonPlacement as TPktHeaderLogOutButtonPlacement } from '../../../../../shared-types';
29
30
  import { TSlotMenuVariant } from '../../../../../shared-types';
30
31
  import { User } from '../../../../../shared-types';
31
32
  import { UserMenuItem } from '../../../../../shared-types';
32
33
 
34
+ /**
35
+ * Base class for PktCombobox.
36
+ * Declares all reactive properties, state, refs, and simple helpers.
37
+ */
38
+ declare class ComboboxBase extends PktInputElement {
39
+ protected readonly helptextSlot: Ref<HTMLElement>;
40
+ constructor();
41
+ value: string | string[];
42
+ options: IPktComboboxOption[];
43
+ defaultOptions: IPktComboboxOption[];
44
+ allowUserInput: boolean;
45
+ typeahead: boolean;
46
+ includeSearch: boolean;
47
+ searchPlaceholder: string;
48
+ multiple: boolean;
49
+ maxlength: number | null;
50
+ displayValueAs: string;
51
+ tagPlacement: TPktComboboxTagPlacement | null;
52
+ isOpen: boolean;
53
+ _options: IPktComboboxOption[];
54
+ protected _value: string[];
55
+ protected _isOptionsOpen: boolean;
56
+ protected _userInfoMessage: string;
57
+ protected _addValueText: string | null;
58
+ protected _maxIsReached: boolean;
59
+ protected _search: string;
60
+ protected _inputFocus: boolean;
61
+ protected _internalValueSync: boolean;
62
+ protected _optionsFromSlot: boolean;
63
+ protected _lastSlotGeneration: number;
64
+ /** When true, the next handleFocus call will not reopen the dropdown. */
65
+ protected _suppressNextOpen: boolean;
66
+ protected readonly inputRef: Ref<HTMLInputElement>;
67
+ protected readonly triggerRef: Ref<HTMLDivElement>;
68
+ protected readonly listboxRef: Ref<PktListbox>;
69
+ protected get _hasTextInput(): boolean;
70
+ protected get _selectionDescription(): string | undefined;
71
+ /**
72
+ * Focuses the appropriate trigger element after closing the listbox.
73
+ * Select-only: the combobox input div. Editable: the text input.
74
+ */
75
+ protected focusTrigger(): void;
76
+ /**
77
+ * Parses the value prop into an internal string array.
78
+ */
79
+ protected parseValue(): string[];
80
+ /**
81
+ * Updates the _maxIsReached state flag.
82
+ */
83
+ protected updateMaxReached(): void;
84
+ /**
85
+ * Syncs the public value property from internal _value state and dispatches
86
+ * events if the value content changed. Always sets this.value as a string
87
+ * to prevent array→string reflect cascades.
88
+ */
89
+ protected syncValueAndDispatch(oldInternal: string[]): void;
90
+ /**
91
+ * Override onChange to skip the base class touched guard.
92
+ * The base class returns early on the first call (setting touched = true but not
93
+ * dispatching events). Combobox needs consistent event dispatch regardless of
94
+ * touched state.
95
+ */
96
+ protected onChange(value: string | string[]): void;
97
+ /**
98
+ * No-op override of the base class valueChanged.
99
+ * The base class version sets both this.value AND this._value, which creates
100
+ * an infinite _value → valueChanged → value → parseValue → _value loop.
101
+ * Combobox handles value sync and event dispatch in syncValueAndDispatch() instead.
102
+ */
103
+ protected valueChanged(): void;
104
+ }
105
+
106
+ /**
107
+ * Event handler layer for PktCombobox.
108
+ * Handles user interactions: input, focus, keyboard, clicks, tags.
109
+ */
110
+ declare class ComboboxHandlers extends ComboboxValue {
111
+ protected handleInput(e: InputEvent): void;
112
+ protected handleFocus(): void;
113
+ protected handleFocusOut(e: FocusEvent): void;
114
+ /**
115
+ * Shared close logic used by both focusout and outside-click handlers.
116
+ * Processes any pending input value, then closes the dropdown.
117
+ */
118
+ protected closeAndProcessInput(): void;
119
+ protected handleBlur(): void;
120
+ protected handleInputClick(e: MouseEvent): void;
121
+ protected handlePlaceholderClick(e: MouseEvent): void;
122
+ protected handleSelectOnlyKeydown(e: KeyboardEvent): void;
123
+ protected handleOptionToggled(e: CustomEvent): void;
124
+ protected handleSearch(e: CustomEvent): void;
125
+ protected handleInputKeydown(e: KeyboardEvent): void;
126
+ protected handleTagRemove(value: string | null): void;
127
+ protected getInsideTags(): HTMLElement[];
128
+ protected focusTag(index: number): void;
129
+ protected resetTagTabindices(): void;
130
+ protected handleTagKeydown(e: KeyboardEvent, index: number): void;
131
+ protected checkForMatches(): void;
132
+ }
133
+
134
+ /**
135
+ * Value management layer for PktCombobox.
136
+ * Handles selection, deselection, user-added values, and input reset.
137
+ */
138
+ declare class ComboboxValue extends ComboboxBase {
139
+ toggleValue(value: string | null): void;
140
+ protected setSelected(value: string | null): void;
141
+ protected removeSelected(value: string | null): void;
142
+ protected addAllOptions(): void;
143
+ protected removeAllSelected(): void;
144
+ protected addValue(): void;
145
+ protected removeValue(value: string | null): void;
146
+ protected addNewUserValue(value: string | null): void;
147
+ protected resetComboboxInput(shouldResetInput?: boolean): void;
148
+ protected removeLastValue(e: Event): void;
149
+ }
150
+
33
151
  /**
34
152
  * We define all props as optional. Native HTML attributes are optional by default,
35
153
  * but the TS definition require either null or value. This way we can support showing a value as optional
@@ -149,19 +267,10 @@ export declare interface IPktCombobox {
149
267
  tagPlacement?: TPktComboboxTagPlacement | null;
150
268
  tagText?: string | null;
151
269
  value?: string | string[];
270
+ isOpen?: boolean;
152
271
  }
153
272
 
154
- export declare interface IPktComboboxOption {
155
- description?: string;
156
- disabled?: boolean;
157
- fulltext?: string;
158
- label?: string;
159
- prefix?: string;
160
- selected?: boolean;
161
- tagSkinColor?: TTagSkin;
162
- userAdded?: boolean;
163
- value: string;
164
- }
273
+ export { IPktComboboxOption }
165
274
 
166
275
  export declare interface IPktConsent {
167
276
  devMode?: boolean;
@@ -609,67 +718,25 @@ export declare class PktCheckbox extends PktInputElement<Props_3> {
609
718
  private toggleChecked;
610
719
  }
611
720
 
612
- export declare class PktCombobox extends PktInputElement implements IPktCombobox {
613
- private helptextSlot;
614
- constructor();
615
- value: string | string[];
616
- options: IPktComboboxOption[];
617
- defaultOptions: IPktComboboxOption[];
618
- allowUserInput: boolean;
619
- typeahead: boolean;
620
- includeSearch: boolean;
621
- searchPlaceholder: string;
622
- multiple: boolean;
623
- maxlength: number | null;
624
- displayValueAs: string;
625
- tagPlacement: TPktComboboxTagPlacement | null;
626
- _options: IPktComboboxOption[];
627
- _value: string[];
628
- private _isOptionsOpen;
629
- private _userInfoMessage;
630
- private _addValueText;
631
- private _maxIsReached;
632
- private _search;
633
- private _inputFocus;
634
- private _editingSingleValue;
635
- inputRef: Ref<HTMLInputElement>;
636
- arrowRef: Ref<HTMLButtonElement>;
637
- listboxRef: Ref<PktListbox>;
638
- focusRef: Ref<HTMLElement>;
639
- optionTagRef: Ref<HTMLElement>;
721
+ export declare class PktCombobox extends ComboboxHandlers implements IPktCombobox {
722
+ private handleBodyClick;
640
723
  connectedCallback(): void;
724
+ protected willUpdate(changedProperties: Map<PropertyKey, unknown>): void;
725
+ disconnectedCallback(): void;
726
+ firstUpdated(changedProperties: PropertyValues): void;
641
727
  updated(changedProperties: PropertyValues): void;
728
+ /**
729
+ * Override form reset to properly restore combobox state.
730
+ * The base class deselects all options and sets value/defaultValue, but
731
+ * combobox needs to re-sync _options with the restored values and clean up
732
+ * user-added options and UI state.
733
+ */
734
+ protected formResetCallback(): void;
642
735
  attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
643
736
  render(): TemplateResult<1>;
644
- renderInputField(): TemplateResult<1>;
645
- renderSingleOrMultipleValues(): unknown;
646
- renderValueTag(option: IPktComboboxOption | null): "" | TemplateResult<1>;
647
- handleInput(e: InputEvent): void;
648
- private handleFocus;
649
- private handleFocusOut;
650
- private handleBlur;
651
- private handleInputClick;
652
- private handlePlaceholderClick;
653
- private handleArrowClick;
654
- private handleOptionToggled;
655
- private handleSearch;
656
- private handleInputKeydown;
657
- private handleTagRemove;
658
- private blurInput;
659
- private checkForMatches;
660
- private findValueInOptions;
661
- private findIndexInOptions;
662
- private isMaxItemsReached;
663
- toggleValue(value: string | null): void;
664
- private setSelected;
665
- private removeSelected;
666
- private addAllOptions;
667
- private removeAllSelected;
668
- private addValue;
669
- private removeValue;
670
- private addNewUserValue;
671
- private resetComboboxInput;
672
- private removeLastValue;
737
+ private renderInputField;
738
+ private renderSingleOrMultipleValues;
739
+ private renderValueTag;
673
740
  }
674
741
 
675
742
  export declare class PktConsent extends PktElement<IPktConsent> implements IPktConsent {
@@ -1325,33 +1392,31 @@ declare class PktListbox extends PktElement implements IPktListbox {
1325
1392
  maxLength: number;
1326
1393
  userMessage: string | null;
1327
1394
  private _selectedOptions;
1395
+ private typeahead;
1328
1396
  private _filteredOptions;
1329
1397
  connectedCallback(): void;
1398
+ disconnectedCallback(): void;
1330
1399
  updated(changedProperties: PropertyValues): void;
1331
1400
  attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
1401
+ private get _hasOptions();
1332
1402
  render(): TemplateResult<1>;
1333
- renderCheckboxOrCheckIcon(option: IPktComboboxOption, index: number): typeof nothing | TemplateResult<1>;
1334
- renderList(): TemplateResult<1>;
1335
- renderNewOptionBanner(): typeof nothing | TemplateResult<1>;
1336
- renderMaximumReachedBanner(): typeof nothing | TemplateResult<1>;
1337
- renderUserMessage(): typeof nothing | TemplateResult<1>;
1338
- renderSearch(): typeof nothing | TemplateResult<1>;
1339
- handleSearchInput(e: InputEvent): void;
1340
- handleSearchKeydown(e: KeyboardEvent): void;
1341
- handleOptionKeydown(e: KeyboardEvent): void;
1342
- focusAndScrollIntoView(el: HTMLElement): void;
1343
- focusNextOption(target: HTMLElement): void;
1344
- focusPreviousOption(target: HTMLElement): void;
1345
- focusFirstOption(): void;
1346
- focusLastOption(): void;
1403
+ private renderCheckboxOrCheckIcon;
1404
+ private renderEmptyMessage;
1405
+ private renderList;
1406
+ private renderNewOptionBanner;
1407
+ private renderMaximumReachedBanner;
1408
+ private renderUserMessage;
1409
+ private renderSearch;
1410
+ private handleSearchInput;
1411
+ private handleSearchKeydown;
1412
+ private handleOptionKeydown;
1347
1413
  focusFirstOrSelectedOption(): void;
1348
- toggleOption(option: IPktComboboxOption | HTMLElement): void;
1349
- selectAll(): void;
1350
- closeOptions(): void;
1414
+ private toggleOption;
1415
+ private selectAll;
1416
+ private closeOptions;
1417
+ private tabClose;
1351
1418
  filterOptions(): void;
1352
- isLetterOrSpace(char: string): boolean;
1353
- handleTypeAhead(char: string): void;
1354
- getOptionElements(): HTMLElement[];
1419
+ private handleTypeAhead;
1355
1420
  }
1356
1421
 
1357
1422
  export declare class PktLoader extends PktElement implements IPktLoader {
@@ -1483,6 +1548,7 @@ declare class PktOptionsSlotController implements ReactiveController {
1483
1548
  host: LitElement & ReactiveControllerHost;
1484
1549
  nodes: Element[];
1485
1550
  options: TOption[];
1551
+ generation: number;
1486
1552
  observer: MutationObserver;
1487
1553
  constructor(host: LitElement & ReactiveControllerHost);
1488
1554
  hostConnected(): void;
@@ -1658,6 +1724,7 @@ export declare class PktTag extends PktElement<IPktTag> implements IPktTag {
1658
1724
  iconName: string | undefined;
1659
1725
  type: TTagType;
1660
1726
  ariaLabel: string | null;
1727
+ buttonTabindex: number | undefined;
1661
1728
  /**
1662
1729
  * Element state
1663
1730
  */
@@ -1789,7 +1856,7 @@ export declare type TPktButtonType = THTMLButtonType;
1789
1856
 
1790
1857
  export declare type TPktButtonVariant = 'label-only' | 'icon-left' | 'icon-right' | 'icon-only' | 'icons-right-and-left';
1791
1858
 
1792
- export declare type TPktComboboxTagPlacement = 'inside' | 'outside';
1859
+ export { TPktComboboxTagPlacement }
1793
1860
 
1794
1861
  export { TPktHeaderLogOutButtonPlacement }
1795
1862
 
@@ -692,7 +692,7 @@ class c extends Ft {
692
692
  const r = this.internals.form || this.closest("form");
693
693
  this.form = r;
694
694
  }
695
- 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) {
695
+ 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) {
696
696
  const r = this.checked === "" || this.checked === "true" || this.checked === !0;
697
697
  this.internals.ariaChecked = String(r);
698
698
  const f = r ? (typeof this.value == "string" ? this.value : "") || ht : null;
@@ -1 +1 @@
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;
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;
@@ -0,0 +1,101 @@
1
+ "use strict";const n=require("./element-CMTfByxQ.cjs"),m=require("./state-BNgpvY-A.cjs"),p=require("./if-defined-hKKmbsI8.cjs"),g=require("./repeat-C-FJ2vfy.cjs"),f=require("./class-map-Bokp1SoS.cjs"),y=require("./utils-byXsEz1u.cjs"),v=(s,e)=>e&&(s.find(t=>t.value===e)||s.find(t=>t.label===e))||null,O=(s,e)=>{if(!e)return-1;const t=s.findIndex(a=>a.value===e);return t>=0?t:s.findIndex(a=>a.label===e)},_=(s,e)=>{if(!e)return[...s];const t=e.toLowerCase();return s.filter(a=>(a.fulltext||a.value+(a.label||"")+(a.prefix||"")).toLowerCase().includes(t))},w=s=>s.value+(s.label||"")+(s.prefix||""),L=(s,e)=>e!==null&&s>=e,S=(s,e)=>{if(!e)return{filtered:[...s],suggestion:null};const t=e.toLowerCase(),a=s.filter(o=>{var l;return(l=o.fulltext)==null?void 0:l.toLowerCase().includes(t)}),i=a.find(o=>{var l;return!o.selected&&((l=o.label)==null?void 0:l.toLowerCase().startsWith(t))})||null;return{filtered:a,suggestion:i}},$=(s,e,t,a)=>{if(!s.trim())return{addValueText:null,userInfoMessage:""};const i=s.trim().toLowerCase(),o=e.find(u=>u.toLowerCase()===i),l=t.filter(u=>{var d;return((d=u.label)==null?void 0:d.toLowerCase().includes(i))||u.value.toLowerCase().includes(i)}),k=l.find(u=>{var d;return((d=u.label)==null?void 0:d.toLowerCase())===i||u.value.toLowerCase()===i});return(l.length===0||!k)&&a?{addValueText:s,userInfoMessage:""}:l.length===0&&!a?{addValueText:null,userInfoMessage:"Ingen treff i søket"}:o?{addValueText:null,userInfoMessage:"Verdien er allerede valgt"}:{addValueText:null,userInfoMessage:""}},I=s=>/^[\p{L} ]$/u.test(s),C=(s=500)=>{let e="",t;return{append:o=>(e+=o.toLowerCase(),t!==void 0&&clearTimeout(t),t=setTimeout(()=>{e=""},s),e),reset:()=>{e="",t!==void 0&&(clearTimeout(t),t=void 0)},getBuffer:()=>e}},M=(s,e)=>{const t=e.toLowerCase();return s.findIndex(a=>{var i;return(i=a.textContent)==null?void 0:i.trim().toLowerCase().startsWith(t)})},c=s=>{s.scrollIntoView({block:"nearest"}),window.setTimeout(()=>s.focus(),0)},h=s=>Array.from(s.querySelectorAll('[role="option"]:not([data-disabled])')||[]),E=s=>{const e=s.nextElementSibling;e&&c(e)},P=(s,e,t)=>{const a=s.previousElementSibling;if(s.dataset.index==="0"&&t){const i=e.querySelector('[role="searchbox"]');i&&c(i)}else a&&c(a)},b=s=>{const e=h(s);e[0]&&c(e[0])},x=s=>{const e=h(s),t=e[e.length-1];t&&c(t)},T=(s,e)=>{if(e.disabled)return;const t=h(s);if(e.allowUserInput&&e.customUserInput){const i=s.querySelector('[data-type="new-option"]');if(i){c(i);return}}const a=t.find(i=>i.dataset.selected==="true");if(a){c(a);return}if(e.includeSearch&&!(document.activeElement instanceof HTMLInputElement)){const i=s.querySelector('[role="searchbox"]');if(i){window.setTimeout(()=>i.focus(),0);return}}t[0]&&c(t[0])};var U=Object.defineProperty,A=Object.getOwnPropertyDescriptor,r=(s,e,t,a)=>{for(var i=a>1?void 0:a?A(e,t):e,o=s.length-1,l;o>=0;o--)(l=s[o])&&(i=(a?l(e,t,i):l(i))||i);return a&&i&&U(e,t,i),i};exports.PktListbox=class extends n.PktElement{constructor(){super(...arguments),this.id=y.uuidish(),this.label=null,this.options=[],this.isOpen=!1,this.disabled=!1,this.includeSearch=!1,this.isMultiSelect=!1,this.allowUserInput=!1,this.maxIsReached=!1,this.customUserInput=null,this.searchPlaceholder=null,this.searchValue=null,this.maxLength=0,this.userMessage=null,this._selectedOptions=0,this.typeahead=C(),this._filteredOptions=[]}connectedCallback(){super.connectedCallback(),this.includeSearch&&!this.searchValue&&(this.searchValue=""),this.options.length>0&&this.filterOptions(),this.setAttribute("tabindex","-1"),this.addEventListener("focus",this.focusFirstOrSelectedOption)}disconnectedCallback(){super.disconnectedCallback(),this.typeahead.reset()}updated(e){(e.has("options")||e.has("searchValue"))&&this.filterOptions(),super.updated(e)}attributeChangedCallback(e,t,a){(e==="options"||e==="search-value")&&this.filterOptions(),super.attributeChangedCallback(e,t,a)}get _hasOptions(){return this._filteredOptions.length>0||this.options.length>0}render(){return n.b`
2
+ <div
3
+ class=${f.e({"pkt-listbox":!0,"pkt-listbox__open":this.isOpen,"pkt-txt-16-light":!0})}
4
+ role=${p.o(this._hasOptions?"listbox":void 0)}
5
+ aria-multiselectable=${p.o(this._hasOptions&&this.isMultiSelect?"true":void 0)}
6
+ aria-label=${p.o(this._hasOptions?this.label??void 0:void 0)}
7
+ >
8
+ <div class="pkt-listbox__banners">
9
+ ${this.renderSearch()} ${this.renderMaximumReachedBanner()} ${this.renderUserMessage()}
10
+ ${this.renderEmptyMessage()} ${this.renderNewOptionBanner()}
11
+ </div>
12
+ <ul class="pkt-listbox__options" role="presentation">
13
+ ${this.renderList()}
14
+ </ul>
15
+ </div>
16
+ <div aria-live="polite" class="pkt-visually-hidden">${this.userMessage}</div>
17
+ `}renderCheckboxOrCheckIcon(e,t){return this.isMultiSelect?n.b`
18
+ <input
19
+ class="pkt-input-check__input-checkbox"
20
+ type="checkbox"
21
+ role="presentation"
22
+ tabindex="-1"
23
+ value=${e.value}
24
+ .checked=${e.selected}
25
+ aria-labelledby=${this.id+"-option-label-"+t}
26
+ ?disabled=${this.disabled||e.disabled||this.maxIsReached&&!e.selected}
27
+ />
28
+ `:e.selected?n.b`<pkt-icon name="check-big"></pkt-icon>`:n.A}renderEmptyMessage(){return this.options.length>0||this._filteredOptions.length>0||this.userMessage?n.A:n.b`<div class="pkt-listbox__banner pkt-listbox__banner--empty">
29
+ <pkt-icon class="pkt-listbox__banner-icon" name="exclamation-mark-circle" size="large"></pkt-icon>
30
+ Tom liste
31
+ </div>`}renderList(){return n.b`
32
+ ${g.c(this._filteredOptions,e=>e.value,(e,t)=>n.b`
33
+ <li
34
+ @click=${()=>{this.toggleOption(e)}}
35
+ aria-selected=${e.selected?"true":"false"}
36
+ @keydown=${this.handleOptionKeydown}
37
+ class=${f.e({"pkt-listbox__option":!0,"pkt-listbox__option--selected":!!(!this.isMultiSelect&&e.selected),"pkt-listbox__option--checkBox":this.isMultiSelect})}
38
+ tabindex="${this.disabled||e.disabled?"-1":"0"}"
39
+ data-index=${t}
40
+ data-value=${e.value}
41
+ data-selected=${e.selected?"true":"false"}
42
+ ?data-disabled=${this.disabled||e.disabled||this.maxIsReached&&!e.selected}
43
+ aria-disabled=${this.disabled||e.disabled||this.maxIsReached&&!e.selected?"true":"false"}
44
+ role="option"
45
+ id=${`${this.id}-${t}`}
46
+ >
47
+ ${this.renderCheckboxOrCheckIcon(e,t)}
48
+ <span class="pkt-listbox__option-label" id=${this.id+"-option-label-"+t}>
49
+ ${e.prefix?n.b`<span class="pkt-listbox__option-prefix">${e.prefix}</span>`:n.A}
50
+ ${e.label||e.value}
51
+ </span>
52
+ ${e.description?n.b`<span class="pkt-listbox__option-description pkt-txt-14-light"
53
+ >${e.description}</span
54
+ >`:n.A}
55
+ </li>
56
+ `)}
57
+ `}renderNewOptionBanner(){return this.allowUserInput&&this.customUserInput?n.b`
58
+ <div
59
+ class="pkt-listbox__banner pkt-listbox__banner--new-option pkt-listbox__option"
60
+ data-type="new-option"
61
+ data-value=${this.customUserInput}
62
+ data-selected="false"
63
+ tabindex="0"
64
+ @click=${()=>this.toggleOption({value:this.customUserInput||""})}
65
+ @keydown=${this.handleOptionKeydown}
66
+ >
67
+ <pkt-icon class="pkt-listbox__banner-icon" name="plus-sign" size="large"></pkt-icon>
68
+ Legg til "${this.customUserInput}"
69
+ </div>
70
+ `:n.A}renderMaximumReachedBanner(){return this._selectedOptions=this.options.filter(e=>e.selected).length,this.isMultiSelect&&this._selectedOptions>0&&this.maxLength>0?n.b`
71
+ <div class="pkt-listbox__banner pkt-listbox__banner--maximum-reached">
72
+ ${this._selectedOptions} av maks ${this.maxLength} mulige er valgt.
73
+ </div>
74
+ `:n.A}renderUserMessage(){return this.userMessage?n.b`<div class="pkt-listbox__banner pkt-listbox__banner--user-message">
75
+ <pkt-icon
76
+ class="pkt-listbox__banner-icon"
77
+ name="exclamation-mark-circle"
78
+ size="large"
79
+ ></pkt-icon>
80
+ ${this.userMessage}
81
+ </div>`:n.A}renderSearch(){return this.includeSearch?n.b`
82
+ <div class="pkt-listbox__search">
83
+ <span class="pkt-listbox__search-icon">
84
+ <pkt-icon name="magnifying-glass-small" size="large"></pkt-icon>
85
+ </span>
86
+ <input
87
+ class="pkt-txt-16-light"
88
+ type="text"
89
+ aria-label="Søk i listen"
90
+ form=""
91
+ placeholder=${this.searchPlaceholder||n.strings.forms.search.placeholder}
92
+ @input=${this.handleSearchInput}
93
+ @keydown=${this.handleSearchKeydown}
94
+ .value=${this.searchValue}
95
+ data-type="searchbox"
96
+ ?disabled=${this.disabled}
97
+ ?readonly=${this.disabled}
98
+ role="searchbox"
99
+ />
100
+ </div>
101
+ `:n.A}handleSearchInput(e){this.searchValue=e.target.value,this.dispatchEvent(new CustomEvent("search",{detail:this.searchValue,bubbles:!1}))}handleSearchKeydown(e){switch(e.key){case"Enter":e.preventDefault();break;case"ArrowUp":case"Escape":this.closeOptions(),e.preventDefault();break;case"ArrowDown":this.focusFirstOrSelectedOption();break;case"Tab":this.tabClose();break}}handleOptionKeydown(e){const t=e.currentTarget,a=t.dataset.value,i=t.dataset.type,o=t.dataset.selected==="true";if(!(!h(this).length&&(!this.customUserInput||!this.allowUserInput&&this.customUserInput)&&i!=="new-option"&&i!=="searchbox"))switch(e.key){case" ":case"Enter":this.toggleOption(t),e.preventDefault();break;case"Backspace":a&&(o?this.toggleOption(t):this.closeOptions()),e.preventDefault();break;case"Escape":this.closeOptions(),e.preventDefault();break;case"Tab":this.tabClose();break;case"ArrowDown":e.altKey?x(this):i==="searchbox"||i==="new-option"?b(this):E(t),e.preventDefault();break;case"ArrowUp":if(e.altKey)b(this);else if(t.dataset.index==="0"&&this.includeSearch){const l=this.querySelector('[role="searchbox"]');l&&l.focus()}else if(t.dataset.index==="0"&&this.customUserInput){const l=this.querySelector('[data-type="new-option"]');l&&l.focus()}else P(t,this,this.includeSearch);e.preventDefault();break;case"Home":b(this),e.preventDefault();break;case"End":x(this),e.preventDefault();break;default:(e.metaKey||e.ctrlKey)&&e.key==="a"&&(this.selectAll(),e.preventDefault()),I(e.key)&&(this.handleTypeAhead(e.key),e.preventDefault());break}}focusFirstOrSelectedOption(){T(this,{disabled:this.disabled,allowUserInput:this.allowUserInput,customUserInput:this.customUserInput,includeSearch:this.includeSearch})}toggleOption(e){const t=e instanceof HTMLElement?e.dataset.disabled:e.disabled;if(this.disabled||t)return;const a=e instanceof HTMLElement?e.dataset.value:e.value;this.dispatchEvent(new CustomEvent("option-toggle",{detail:a,bubbles:!1}))}selectAll(){this.dispatchEvent(new CustomEvent("select-all",{bubbles:!1}))}closeOptions(){this.dispatchEvent(new CustomEvent("close-options",{bubbles:!1}))}tabClose(){this.dispatchEvent(new CustomEvent("tab-close",{bubbles:!1}))}filterOptions(){this._filteredOptions=_(this.options,this.searchValue)}handleTypeAhead(e){const t=this.typeahead.append(e),a=h(this),i=M(a,t);i>=0&&c(a[i])}};r([n.n({type:String})],exports.PktListbox.prototype,"id",2);r([n.n({type:String})],exports.PktListbox.prototype,"label",2);r([n.n({type:Array})],exports.PktListbox.prototype,"options",2);r([n.n({type:Boolean,reflect:!0,attribute:"is-open"})],exports.PktListbox.prototype,"isOpen",2);r([n.n({type:Boolean})],exports.PktListbox.prototype,"disabled",2);r([n.n({type:Boolean,attribute:"include-search"})],exports.PktListbox.prototype,"includeSearch",2);r([n.n({type:Boolean,attribute:"is-multi-select"})],exports.PktListbox.prototype,"isMultiSelect",2);r([n.n({type:Boolean,attribute:"allow-user-input"})],exports.PktListbox.prototype,"allowUserInput",2);r([n.n({type:Boolean,attribute:"max-is-reached"})],exports.PktListbox.prototype,"maxIsReached",2);r([n.n({type:String,attribute:"custom-user-input"})],exports.PktListbox.prototype,"customUserInput",2);r([n.n({type:String,attribute:"search-placeholder"})],exports.PktListbox.prototype,"searchPlaceholder",2);r([n.n({type:String,attribute:"search-value"})],exports.PktListbox.prototype,"searchValue",2);r([n.n({type:Number,attribute:"max-length"})],exports.PktListbox.prototype,"maxLength",2);r([n.n({type:String,attribute:"user-message"})],exports.PktListbox.prototype,"userMessage",2);r([m.r()],exports.PktListbox.prototype,"_filteredOptions",2);exports.PktListbox=r([n.t("pkt-listbox")],exports.PktListbox);exports.buildFulltext=w;exports.findOptionByValue=v;exports.findOptionIndex=O;exports.findTypeaheadMatches=S;exports.getSearchInfoMessage=$;exports.isMaxSelectionReached=L;