@oslokommune/punkt-elements 12.31.2 → 12.32.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/dist/{alert-BDxxRqgi.cjs → alert-D5G5UJuo.cjs} +1 -1
- package/dist/{alert-D0S57u0r.js → alert-gERpVuB7.js} +6 -6
- package/dist/alert.d.ts +32 -0
- package/dist/{backlink-CzpB-ih9.js → backlink-DdNgqA56.js} +2 -2
- package/dist/{backlink-Dn4DfWVR.cjs → backlink-Q2HTG9jm.cjs} +1 -1
- package/dist/backlink.d.ts +32 -0
- package/dist/{button-Beo3c7cx.cjs → button-BPyZeW73.cjs} +1 -1
- package/dist/{button-9NwGr-OS.js → button-rArIL0-j.js} +3 -3
- package/dist/button.d.ts +32 -0
- package/dist/{calendar-BbZNxsKY.js → calendar-1ryAEdX3.js} +4 -4
- package/dist/{calendar-CxBo98iI.cjs → calendar-2DqPLXdD.cjs} +1 -1
- package/dist/calendar.d.ts +32 -0
- package/dist/{card-DQfNKnKl.js → card-BbMBpvJt.js} +7 -7
- package/dist/{card-C63x_nll.cjs → card-ZX09f_ka.cjs} +1 -1
- package/dist/card.d.ts +32 -0
- package/dist/{checkbox-9Zjy_NU7.cjs → checkbox-BnDG6wIO.cjs} +1 -1
- package/dist/{checkbox-CzDpR6_8.js → checkbox-Ceui2TLp.js} +4 -4
- package/dist/checkbox.d.ts +32 -0
- package/dist/{class-map-DWtqmIRS.js → class-map-ChuDQU5C.js} +1 -1
- package/dist/{class-map-Dj5mbCUg.cjs → class-map-D4rXyUxT.cjs} +1 -1
- package/dist/combobox-DH-YlbNh.cjs +115 -0
- package/dist/combobox-DbO6I0GT.js +694 -0
- package/dist/combobox.d.ts +47 -0
- package/dist/{datepicker-CYUvRGhE.js → datepicker-8MOgQsyL.js} +144 -196
- package/dist/datepicker-BRH-59Q9.cjs +153 -0
- package/dist/datepicker.d.ts +32 -0
- package/dist/directive-helpers-D7XIyCQ_.js +45 -0
- package/dist/directive-helpers-mGjAtADc.cjs +5 -0
- package/dist/{element-CzFXQBoS.cjs → element-BBo3JZk5.cjs} +1 -1
- package/dist/{element-C7XjZtLU.js → element-G8JoS0Lj.js} +6 -0
- package/dist/{helptext-B9kxDc2b.cjs → helptext-B4Uc-d56.cjs} +2 -2
- package/dist/{helptext-CqnoPodd.js → helptext-Y4cSgTkd.js} +10 -10
- package/dist/helptext.d.ts +32 -0
- package/dist/{icon-BEUgV9Wo.js → icon-BJnwW0eh.js} +1 -1
- package/dist/{icon-BOKusjAA.cjs → icon-BTUCDPN5.cjs} +1 -1
- package/dist/icon.d.ts +32 -0
- package/dist/{if-defined-CpIkv1A4.cjs → if-defined-C1ZDVzYn.cjs} +1 -1
- package/dist/{if-defined-eRX4e5zO.js → if-defined-rCqT8Od1.js} +1 -1
- package/dist/index.d.ts +208 -14
- package/dist/input-element-AhnBdCb8.cjs +1 -0
- package/dist/{input-element-BK8UkQli.js → input-element-DM2uSYaW.js} +22 -19
- package/dist/input-wrapper-BdZxmQyO.cjs +52 -0
- package/dist/input-wrapper-DQmYzhcy.js +185 -0
- package/dist/input-wrapper.d.ts +32 -0
- package/dist/{link-D3U0Jkz8.js → link-C3lW3z8X.js} +5 -5
- package/dist/{link-1iq0Pmuf.cjs → link-DOVlsg2S.cjs} +1 -1
- package/dist/link.d.ts +32 -0
- package/dist/{linkcard-CRpo3tiw.js → linkcard-CvqqyHVW.js} +4 -4
- package/dist/{linkcard-2WzDJPZz.cjs → linkcard-DDD92XfD.cjs} +1 -1
- package/dist/linkcard.d.ts +32 -0
- package/dist/listbox-BTVnrHWv.cjs +95 -0
- package/dist/listbox-DX-Euxdm.js +360 -0
- package/dist/listbox.d.ts +47 -0
- package/dist/{loader-B1edLWTg.js → loader-BudoV0yd.js} +6 -6
- package/dist/{loader-DI74pe25.cjs → loader-Csq0Yd1k.cjs} +1 -1
- package/dist/loader.d.ts +32 -0
- package/dist/{messagebox-DQpEMkS2.cjs → messagebox-8GwnNqb0.cjs} +1 -1
- package/dist/{messagebox-KP-8-tA9.js → messagebox-D6uexEhg.js} +6 -6
- package/dist/messagebox.d.ts +32 -0
- package/dist/{modal-ytIJwfr3.cjs → modal-CLixB4Dz.cjs} +1 -1
- package/dist/{modal-kPX8nO_L.js → modal-DnYn2Rlg.js} +6 -6
- package/dist/modal.d.ts +32 -0
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +1 -1
- package/dist/pkt-backlink.cjs +1 -1
- package/dist/pkt-backlink.js +1 -1
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +1 -1
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +1 -1
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +1 -1
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +1 -1
- package/dist/pkt-combobox.cjs +1 -0
- package/dist/pkt-combobox.js +6 -0
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-icon.cjs +1 -1
- package/dist/pkt-icon.js +1 -1
- package/dist/pkt-index.cjs +3 -3
- package/dist/pkt-index.js +45 -43
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +1 -1
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +1 -1
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +1 -1
- package/dist/pkt-listbox.cjs +1 -0
- package/dist/pkt-listbox.js +6 -0
- 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-BtU1zEtG.cjs +1 -0
- package/dist/pkt-options-controller-CZplGTgu.js +38 -0
- 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-slot-controller-CqNvEpFd.cjs +1 -0
- package/dist/{pkt-slot-controller-Clbye6cM.js → pkt-slot-controller-D1DakVrU.js} +17 -7
- 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-B6A9UVXS.cjs → progressbar-BW_icNId.cjs} +1 -1
- package/dist/{progressbar-D0nxLqHu.js → progressbar-czvExwTL.js} +5 -5
- package/dist/progressbar.d.ts +32 -0
- package/dist/{radiobutton-BWyQgR_x.cjs → radiobutton-BeSuCrbp.cjs} +1 -1
- package/dist/{radiobutton-DLWjvLBO.js → radiobutton-DKo27Stm.js} +5 -5
- package/dist/radiobutton.d.ts +32 -0
- package/dist/ref-DsoUUoPU.cjs +9 -0
- package/dist/ref-cRTOoM4R.js +102 -0
- package/dist/repeat-CArTw6-s.js +61 -0
- package/dist/repeat-kruY8poV.cjs +5 -0
- package/dist/select-DxHhPEgD.js +118 -0
- package/dist/select-lvFnhEVg.cjs +49 -0
- package/dist/select.d.ts +32 -0
- package/dist/{state-HNj0_316.cjs → state-BILlRnrD.cjs} +1 -1
- package/dist/{state-CDQk0DFQ.js → state-gfUuUqVg.js} +1 -1
- package/dist/{tag-CmFcSdOV.js → tag-CWx1XsGR.js} +7 -7
- package/dist/{tag-BeLSOjNh.cjs → tag-DThwKsrg.cjs} +1 -1
- package/dist/tag.d.ts +32 -0
- package/dist/{textarea-BPqWCymU.js → textarea-BNNDbxxO.js} +18 -17
- package/dist/{textarea-VG-UTMLP.cjs → textarea-CDsLbogK.cjs} +6 -6
- package/dist/textarea.d.ts +32 -0
- package/dist/{textinput-CEP7QA3E.cjs → textinput-C3C088Ki.cjs} +5 -4
- package/dist/{textinput-VD74aGzx.js → textinput-M8I4dfoP.js} +25 -24
- package/dist/textinput.d.ts +32 -0
- package/package.json +3 -3
- package/src/components/combobox/combobox.ts +873 -0
- package/src/components/combobox/countrycodes.json +927 -0
- package/src/components/combobox/index.ts +6 -0
- package/src/components/datepicker/datepicker.ts +2 -0
- package/src/components/helptext/helptext.ts +1 -1
- package/src/components/index.ts +7 -0
- package/src/components/input-wrapper/input-wrapper.ts +42 -34
- package/src/components/listbox/index.ts +4 -0
- package/src/components/listbox/listbox.ts +474 -0
- package/src/components/select/select.ts +7 -0
- package/src/components/textinput/textinput.ts +3 -2
- package/dist/datepicker-FuAL0uNU.cjs +0 -155
- package/dist/input-element-Dtyuf6s8.cjs +0 -1
- package/dist/input-wrapper-Bo2_t6pA.cjs +0 -50
- package/dist/input-wrapper-DaZZq8c0.js +0 -172
- package/dist/pkt-slot-controller-Oc32unDk.cjs +0 -1
- package/dist/ref-2anvRHT4.cjs +0 -13
- package/dist/ref-DbOSDQbk.js +0 -143
- package/dist/select-CzuxXKll.js +0 -150
- package/dist/select-DZL6aa2s.cjs +0 -48
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
+
import { nothing } from 'lit';
|
|
2
3
|
import { PktIconName } from '@oslokommune/punkt-assets/dist/icons/icon';
|
|
3
4
|
import { PropertyValues } from 'lit';
|
|
4
5
|
import { ReactiveController } from 'lit';
|
|
@@ -93,6 +94,47 @@ export declare interface IPktButton {
|
|
|
93
94
|
disabled?: boolean;
|
|
94
95
|
}
|
|
95
96
|
|
|
97
|
+
export declare interface IPktCombobox {
|
|
98
|
+
allowUserInput?: boolean;
|
|
99
|
+
typeahead?: boolean;
|
|
100
|
+
disabled?: boolean;
|
|
101
|
+
displayValueAs?: string;
|
|
102
|
+
errorMessage?: string;
|
|
103
|
+
fullwidth?: boolean;
|
|
104
|
+
hasError?: boolean;
|
|
105
|
+
helptext?: string | null;
|
|
106
|
+
helptextDropdown?: string | null;
|
|
107
|
+
helptextDropdownButton?: string | null;
|
|
108
|
+
id?: string;
|
|
109
|
+
includeSearch?: boolean;
|
|
110
|
+
label?: string | null;
|
|
111
|
+
maxlength?: number | null;
|
|
112
|
+
minlength?: number | null;
|
|
113
|
+
multiple?: boolean;
|
|
114
|
+
name?: string;
|
|
115
|
+
optionalTag?: boolean;
|
|
116
|
+
optionalText?: string;
|
|
117
|
+
options?: IPktComboboxOption[];
|
|
118
|
+
placeholder?: string | null;
|
|
119
|
+
requiredTag?: boolean;
|
|
120
|
+
requiredText?: string;
|
|
121
|
+
searchPlaceholder?: string;
|
|
122
|
+
tagPlacement?: TPktComboboxTagPlacement | null;
|
|
123
|
+
value?: string | string[];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export declare interface IPktComboboxOption {
|
|
127
|
+
description?: string;
|
|
128
|
+
disabled?: boolean;
|
|
129
|
+
fulltext?: string;
|
|
130
|
+
label?: string;
|
|
131
|
+
prefix?: string;
|
|
132
|
+
selected?: boolean;
|
|
133
|
+
tagSkinColor?: TTagSkin;
|
|
134
|
+
userAdded?: boolean;
|
|
135
|
+
value: string;
|
|
136
|
+
}
|
|
137
|
+
|
|
96
138
|
declare interface IPktLinkCard {
|
|
97
139
|
title?: string;
|
|
98
140
|
href?: string;
|
|
@@ -102,6 +144,21 @@ declare interface IPktLinkCard {
|
|
|
102
144
|
skin?: TLinkCardSkin;
|
|
103
145
|
}
|
|
104
146
|
|
|
147
|
+
declare interface IPktListbox {
|
|
148
|
+
options: IPktComboboxOption[];
|
|
149
|
+
isOpen: boolean;
|
|
150
|
+
disabled: boolean;
|
|
151
|
+
includeSearch: boolean;
|
|
152
|
+
isMultiSelect: boolean;
|
|
153
|
+
allowUserInput: boolean;
|
|
154
|
+
maxIsReached: boolean;
|
|
155
|
+
customUserInput: string | null;
|
|
156
|
+
searchPlaceholder: string | null;
|
|
157
|
+
searchValue: string | null;
|
|
158
|
+
maxLength: number;
|
|
159
|
+
userMessage: string | null;
|
|
160
|
+
}
|
|
161
|
+
|
|
105
162
|
export declare interface IPktLoader {
|
|
106
163
|
/**
|
|
107
164
|
* The `delay` prop controls how much time the loading should be given before the loader is displayed.
|
|
@@ -343,6 +400,67 @@ export declare class PktCheckbox extends PktInputElement {
|
|
|
343
400
|
private toggleChecked;
|
|
344
401
|
}
|
|
345
402
|
|
|
403
|
+
export declare class PktCombobox extends PktInputElement implements IPktCombobox {
|
|
404
|
+
private helptextSlot;
|
|
405
|
+
constructor();
|
|
406
|
+
value: string | string[];
|
|
407
|
+
options: IPktComboboxOption[];
|
|
408
|
+
allowUserInput: boolean;
|
|
409
|
+
typeahead: boolean;
|
|
410
|
+
includeSearch: boolean;
|
|
411
|
+
searchPlaceholder: string;
|
|
412
|
+
multiple: boolean;
|
|
413
|
+
maxlength: number | null;
|
|
414
|
+
displayValueAs: string;
|
|
415
|
+
tagPlacement: TPktComboboxTagPlacement | null;
|
|
416
|
+
private _options;
|
|
417
|
+
private _isOptionsOpen;
|
|
418
|
+
private _value;
|
|
419
|
+
private _userInfoMessage;
|
|
420
|
+
private _addValueText;
|
|
421
|
+
private _maxIsReached;
|
|
422
|
+
private _search;
|
|
423
|
+
private _inputFocus;
|
|
424
|
+
private _editingSingleValue;
|
|
425
|
+
inputRef: Ref<HTMLInputElement>;
|
|
426
|
+
arrowRef: Ref<HTMLButtonElement>;
|
|
427
|
+
listboxRef: Ref<PktListbox>;
|
|
428
|
+
focusRef: Ref<HTMLElement>;
|
|
429
|
+
optionTagRef: Ref<HTMLElement>;
|
|
430
|
+
connectedCallback(): void;
|
|
431
|
+
updated(changedProperties: PropertyValues): void;
|
|
432
|
+
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
433
|
+
render(): TemplateResult<1>;
|
|
434
|
+
renderInputField(): TemplateResult<1>;
|
|
435
|
+
renderSingleOrMultipleValues(): unknown;
|
|
436
|
+
renderValueTag(option: IPktComboboxOption | null): "" | TemplateResult<1>;
|
|
437
|
+
handleInput(e: InputEvent): void;
|
|
438
|
+
private handleFocus;
|
|
439
|
+
private handleFocusOut;
|
|
440
|
+
private handleBlur;
|
|
441
|
+
private handleInputClick;
|
|
442
|
+
private handleArrowClick;
|
|
443
|
+
private handleOptionToggled;
|
|
444
|
+
private handleSearch;
|
|
445
|
+
private handleInputKeydown;
|
|
446
|
+
private handleTagRemove;
|
|
447
|
+
private blurInput;
|
|
448
|
+
private checkForMatches;
|
|
449
|
+
private findValueInOptions;
|
|
450
|
+
private findIndexInOptions;
|
|
451
|
+
private isMaxItemsReached;
|
|
452
|
+
toggleValue(value: string | null): void;
|
|
453
|
+
private setSelected;
|
|
454
|
+
private removeSelected;
|
|
455
|
+
private addAllOptions;
|
|
456
|
+
private removeAllSelected;
|
|
457
|
+
private addValue;
|
|
458
|
+
private removeValue;
|
|
459
|
+
private addNewUserValue;
|
|
460
|
+
private resetComboboxInput;
|
|
461
|
+
private removeLastValue;
|
|
462
|
+
}
|
|
463
|
+
|
|
346
464
|
export declare class PktComponent extends PktElement {
|
|
347
465
|
/**
|
|
348
466
|
* Element attributes => props
|
|
@@ -524,6 +642,7 @@ declare class PktInputElement<T = {}> extends PktElement<Props_2 & T> {
|
|
|
524
642
|
counter: boolean;
|
|
525
643
|
hasError: boolean;
|
|
526
644
|
inline: boolean;
|
|
645
|
+
hasFieldset: boolean;
|
|
527
646
|
optionalTag: boolean;
|
|
528
647
|
requiredTag: boolean;
|
|
529
648
|
skipForwardTestid: boolean;
|
|
@@ -569,6 +688,8 @@ export declare class PktInputWrapper extends PktElement<Props_4> {
|
|
|
569
688
|
counter: boolean;
|
|
570
689
|
counterCurrent: number;
|
|
571
690
|
counterMaxLength: number;
|
|
691
|
+
counterError: string | null;
|
|
692
|
+
counterPosition: TCounterPosition;
|
|
572
693
|
optionalTag: boolean;
|
|
573
694
|
optionalText: string;
|
|
574
695
|
requiredTag: boolean;
|
|
@@ -581,10 +702,11 @@ export declare class PktInputWrapper extends PktElement<Props_4> {
|
|
|
581
702
|
hasFieldset: boolean;
|
|
582
703
|
useWrapper: boolean;
|
|
583
704
|
role: string | null;
|
|
584
|
-
updateSlots(): void;
|
|
705
|
+
updateSlots(filledSlots: Set<string | null | undefined>): void;
|
|
585
706
|
protected updated(changedProperties: PropertyValues): void;
|
|
586
707
|
render(): TemplateResult<1>;
|
|
587
708
|
private toggleDropdown;
|
|
709
|
+
private handleLabelClick;
|
|
588
710
|
}
|
|
589
711
|
|
|
590
712
|
export declare class PktLink extends PktElement {
|
|
@@ -614,6 +736,51 @@ export declare class PktLinkCard extends PktElement implements IPktLinkCard {
|
|
|
614
736
|
render(): TemplateResult<1>;
|
|
615
737
|
}
|
|
616
738
|
|
|
739
|
+
declare class PktListbox extends PktElement implements IPktListbox {
|
|
740
|
+
id: string;
|
|
741
|
+
label: string | null;
|
|
742
|
+
options: IPktComboboxOption[];
|
|
743
|
+
isOpen: boolean;
|
|
744
|
+
disabled: boolean;
|
|
745
|
+
includeSearch: boolean;
|
|
746
|
+
isMultiSelect: boolean;
|
|
747
|
+
allowUserInput: boolean;
|
|
748
|
+
maxIsReached: boolean;
|
|
749
|
+
customUserInput: string | null;
|
|
750
|
+
searchPlaceholder: string | null;
|
|
751
|
+
searchValue: string | null;
|
|
752
|
+
maxLength: number;
|
|
753
|
+
userMessage: string | null;
|
|
754
|
+
private _selectedOptions;
|
|
755
|
+
private _filteredOptions;
|
|
756
|
+
connectedCallback(): void;
|
|
757
|
+
updated(changedProperties: PropertyValues): void;
|
|
758
|
+
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
759
|
+
render(): TemplateResult<1>;
|
|
760
|
+
renderCheckboxOrCheckIcon(option: IPktComboboxOption, index: number): TemplateResult<1> | typeof nothing;
|
|
761
|
+
renderList(): TemplateResult<1>;
|
|
762
|
+
renderNewOptionBanner(): TemplateResult<1> | typeof nothing;
|
|
763
|
+
renderMaximumReachedBanner(): TemplateResult<1> | typeof nothing;
|
|
764
|
+
renderUserMessage(): TemplateResult<1> | typeof nothing;
|
|
765
|
+
renderSearch(): TemplateResult<1> | typeof nothing;
|
|
766
|
+
handleSearchInput(e: InputEvent): void;
|
|
767
|
+
handleSearchKeydown(e: KeyboardEvent): void;
|
|
768
|
+
handleOptionKeydown(e: KeyboardEvent): void;
|
|
769
|
+
focusAndScrollIntoView(el: HTMLElement): void;
|
|
770
|
+
focusNextOption(target: HTMLElement): void;
|
|
771
|
+
focusPreviousOption(target: HTMLElement): void;
|
|
772
|
+
focusFirstOption(): void;
|
|
773
|
+
focusLastOption(): void;
|
|
774
|
+
focusFirstOrSelectedOption(): void;
|
|
775
|
+
toggleOption(option: IPktComboboxOption | HTMLElement): void;
|
|
776
|
+
selectAll(): void;
|
|
777
|
+
closeOptions(): void;
|
|
778
|
+
filterOptions(): void;
|
|
779
|
+
isLetterOrSpace(char: string): boolean;
|
|
780
|
+
handleTypeAhead(char: string): void;
|
|
781
|
+
getOptionElements(): HTMLElement[];
|
|
782
|
+
}
|
|
783
|
+
|
|
617
784
|
export declare class PktLoader extends PktElement implements IPktLoader {
|
|
618
785
|
defaultSlot: Ref<HTMLElement>;
|
|
619
786
|
constructor();
|
|
@@ -713,17 +880,6 @@ declare class PktRadioButton extends PktInputElement {
|
|
|
713
880
|
export { PktRadioButton }
|
|
714
881
|
export { PktRadioButton as PktRadiobutton }
|
|
715
882
|
|
|
716
|
-
/**
|
|
717
|
-
* Pkt Select is a wrapper for the native select element using the pkt-input-wrapper component.
|
|
718
|
-
*
|
|
719
|
-
* The component will prioritize options passed as a prop over options passed as children if both are provided.
|
|
720
|
-
* This is to allow for dynamic options that might change in the case of both children/slot and props are provided.
|
|
721
|
-
*
|
|
722
|
-
* @slot (default) - Options to be rendered as children
|
|
723
|
-
* @prop {TSelectOption[]} options - Options to be rendered as children
|
|
724
|
-
*
|
|
725
|
-
*
|
|
726
|
-
*/
|
|
727
883
|
export declare class PktSelect extends PktInputElement implements IPktSelect {
|
|
728
884
|
private inputRef;
|
|
729
885
|
private helptextSlot;
|
|
@@ -743,6 +899,7 @@ declare class PktSlotController implements ReactiveController {
|
|
|
743
899
|
nodes: Element[];
|
|
744
900
|
slots: Ref<HTMLElement>[];
|
|
745
901
|
observer: MutationObserver;
|
|
902
|
+
contentObserver: MutationObserver;
|
|
746
903
|
filledSlots: Set<string | null | undefined>;
|
|
747
904
|
skipOptions: boolean;
|
|
748
905
|
private updatingSlots;
|
|
@@ -753,6 +910,7 @@ declare class PktSlotController implements ReactiveController {
|
|
|
753
910
|
private updateNodes;
|
|
754
911
|
private updateSlots;
|
|
755
912
|
private handleMutations;
|
|
913
|
+
private handleSlotMutations;
|
|
756
914
|
}
|
|
757
915
|
|
|
758
916
|
export declare class PktTag extends PktElement implements IPktTag {
|
|
@@ -804,7 +962,7 @@ export declare class PktTextinput extends PktInputElement<Props_5> {
|
|
|
804
962
|
value: string;
|
|
805
963
|
type: string;
|
|
806
964
|
size: number | null;
|
|
807
|
-
autocomplete: string;
|
|
965
|
+
autocomplete: string | null;
|
|
808
966
|
iconNameRight: string | null;
|
|
809
967
|
prefix: string | null;
|
|
810
968
|
suffix: string | null;
|
|
@@ -818,7 +976,7 @@ export declare class PktTextinput extends PktInputElement<Props_5> {
|
|
|
818
976
|
|
|
819
977
|
declare type Props = ElementProps<PktElement, 'strings' | 'role'>;
|
|
820
978
|
|
|
821
|
-
declare type Props_2 = ElementProps<PktInputElement, 'defaultValue' | 'disabled' | 'readonly' | 'required' | 'max' | 'maxlength' | 'min' | 'minlength' | 'ariaDescribedBy' | 'ariaLabelledby' | 'name' | 'pattern' | 'placeholder' | 'id' | 'counter' | 'hasError' | 'inline' | 'optionalTag' | 'requiredTag' | 'skipForwardTestid' | 'useWrapper' | 'fullwidth' | 'counterMaxLength' | 'errorMessage' | 'helptext' | 'helptextDropdown' | 'helptextDropdownButton' | 'label' | 'optionalText' | 'requiredText' | 'dataTestid'>;
|
|
979
|
+
declare type Props_2 = ElementProps<PktInputElement, 'defaultValue' | 'disabled' | 'readonly' | 'required' | 'max' | 'maxlength' | 'min' | 'minlength' | 'ariaDescribedBy' | 'ariaLabelledby' | 'name' | 'pattern' | 'placeholder' | 'id' | 'counter' | 'hasError' | 'hasFieldset' | 'inline' | 'optionalTag' | 'requiredTag' | 'skipForwardTestid' | 'useWrapper' | 'fullwidth' | 'counterMaxLength' | 'errorMessage' | 'helptext' | 'helptextDropdown' | 'helptextDropdownButton' | 'label' | 'optionalText' | 'requiredText' | 'dataTestid'>;
|
|
822
980
|
|
|
823
981
|
declare type Props_3 = ElementProps<PktIcon, 'path' | 'name'>;
|
|
824
982
|
|
|
@@ -862,6 +1020,8 @@ declare type TAriaSort = 'none' | 'ascending' | 'descending' | 'other';
|
|
|
862
1020
|
|
|
863
1021
|
declare type TCardSkin = 'outlined' | 'gray' | 'beige' | 'green' | 'blue';
|
|
864
1022
|
|
|
1023
|
+
declare type TCounterPosition = 'top' | 'bottom';
|
|
1024
|
+
|
|
865
1025
|
declare type TDirection = 'portrait' | 'landscape';
|
|
866
1026
|
|
|
867
1027
|
declare type TLinkCardSkin = 'normal' | 'blue' | 'beige' | 'green' | 'gray' | 'beige-outline' | 'gray-outline';
|
|
@@ -882,6 +1042,8 @@ export declare type TPktButtonType = 'button' | 'submit' | 'reset';
|
|
|
882
1042
|
|
|
883
1043
|
export declare type TPktButtonVariant = 'label-only' | 'icon-left' | 'icon-right' | 'icon-only' | 'icons-right-and-left';
|
|
884
1044
|
|
|
1045
|
+
export declare type TPktComboboxTagPlacement = 'inside' | 'outside';
|
|
1046
|
+
|
|
885
1047
|
export declare type TPktLoaderVariant = 'blue' | 'rainbow' | 'shapes';
|
|
886
1048
|
|
|
887
1049
|
declare type TPktSize = 'small' | 'medium' | 'large';
|
|
@@ -910,6 +1072,31 @@ export declare type TTagType = 'button' | 'reset' | 'submit';
|
|
|
910
1072
|
export { }
|
|
911
1073
|
|
|
912
1074
|
|
|
1075
|
+
/**
|
|
1076
|
+
* Pkt Select is a wrapper for the native select element using the pkt-input-wrapper component.
|
|
1077
|
+
*
|
|
1078
|
+
* The component will prioritize options passed as a prop over options passed as children if both are provided.
|
|
1079
|
+
* This is to allow for dynamic options that might change in the case of both children/slot and props are provided.
|
|
1080
|
+
*
|
|
1081
|
+
* @slot (default) - Options to be rendered as children
|
|
1082
|
+
* @prop {TSelectOption[]} options - Options to be rendered as children
|
|
1083
|
+
*
|
|
1084
|
+
*
|
|
1085
|
+
*/
|
|
1086
|
+
declare global {
|
|
1087
|
+
interface HTMLElementTagNameMap {
|
|
1088
|
+
'pkt-select': PktSelect & HTMLSelectElement;
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
|
|
1093
|
+
declare global {
|
|
1094
|
+
interface HTMLElementTagNameMap {
|
|
1095
|
+
'pkt-combobox': PktCombobox & HTMLSelectElement;
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
|
|
913
1100
|
declare global {
|
|
914
1101
|
interface HTMLElementTagNameMap {
|
|
915
1102
|
'pkt-icon': PktIcon;
|
|
@@ -917,6 +1104,13 @@ declare global {
|
|
|
917
1104
|
}
|
|
918
1105
|
|
|
919
1106
|
|
|
1107
|
+
declare global {
|
|
1108
|
+
interface HTMLElementTagNameMap {
|
|
1109
|
+
'pkt-listbox': PktListbox;
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
|
|
920
1114
|
declare global {
|
|
921
1115
|
interface Window {
|
|
922
1116
|
pktTz: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("./element-BBo3JZk5.cjs"),f=require("./state-BILlRnrD.cjs"),c=require("./stringutils-CkVRq4jP.cjs"),y=require("./input-wrapper-jPnKsfEC.cjs");var m=Object.defineProperty,s=(o,t,r,n)=>{for(var a=void 0,l=o.length-1,h;l>=0;l--)(h=o[l])&&(a=h(t,r,a)||a);return a&&m(t,r,a),a};class i extends e.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.ariaDescribedBy=null,this.ariaLabelledby=null,this.name="",this.pattern=null,this.placeholder=null,this.id=c.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=y.specs.props.helptextDropdownButton.default,this.label=null,this.optionalText=e.translations.forms.labels.optional,this.requiredText=e.translations.forms.labels.required,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(t){var r,n,a,l,h,u,p,d;t&&(this.required&&!this.value?this.internals.setValidity({valueMissing:!0},e.translations.forms.messages.required,t):(r=t.validity)!=null&&r.typeMismatch||(n=t.validity)!=null&&n.badInput?this.internals.setValidity({typeMismatch:!0},e.translations.forms.messages.invalid,t):(a=t.validity)!=null&&a.patternMismatch?this.internals.setValidity({patternMismatch:!0},e.translations.forms.messages.invalidPattern,t):(l=t.validity)!=null&&l.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},e.translations.forms.messages.tooShort,t):(h=t.validity)!=null&&h.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},e.translations.forms.messages.tooLong,t):(u=t.validity)!=null&&u.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},e.translations.forms.messages.rangeUnderflow,t):(p=t.validity)!=null&&p.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},e.translations.forms.messages.rangeOverflow,t):(d=t.validity)!=null&&d.customError?this.internals.setValidity({customError:!0},t.validationMessage,t):this.internals.setValidity({}))}setFormValue(t){if(this.internals)if(Array.isArray(t)){const r=new FormData;t.forEach(n=>{r.append(this.name,n)}),this.internals.setFormValue(r)}else this.internals.setFormValue(t)}valueChecked(t){if(!this.touched)return;const r=this.internals.form||this.closest("form");r&&r.querySelectorAll(`pkt-radiobutton[name=${this.name}], input[type=radio][name=${this.name}]`).forEach(n=>{const a=n;a.name===this.name&&a.value!==this.value&&a.checked&&(a.checked=!1)}),typeof t=="string"?(this.checked=t==="true",this.internals.ariaChecked=t==="true"):typeof t=="boolean"&&(this.checked=t,this.internals.ariaChecked=t),this.checked?(this.internals.setFormValue(this.value||"on",this.value||"on"),this.internals.states.add("--checked")):(this.internals.setFormValue("",""),this.internals.states.delete("--checked")),this.dispatchEvent(new Event("change")),this.dispatchEvent(new CustomEvent("value-change",{detail:this.checked,bubbles:!0,composed:!0})),this.internals.reportValidity()}valueChanged(t,r){(r!==this.value||r!==this._value)&&(typeof t=="string"?((this.multiple||this.range)&&t.includes(",")&&(t=t.split(",")),this.value=t,this._value=Array.isArray(t)?t:[t]):Array.isArray(t)?(this.value=this.multiple||this.range?t:t[0],this._value=t):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&r&&r.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(r==null?void 0:r.toString())&&this.onChange(this.value),this.updateComplete.then(()=>this.requestUpdate()))}clearInputValue(){const t=this.multiple||this.range?[]:"";this.value=t,this.internals.setFormValue(t),this.dispatchEvent(new Event("change")),this.dispatchEvent(new CustomEvent("value-change",{detail:t,bubbles:!0,composed:!0}))}onFocus(){this.dispatchEvent(new FocusEvent("focus"))}onBlur(){this.dispatchEvent(new FocusEvent("blur"))}onInput(){this.dispatchEvent(new InputEvent("input"))}onChange(t){if(!this.touched){this.touched=!0,t&&this.setFormValue(t);return}typeof t!="string"&&!Array.isArray(t)||((this.range||this.multiple)&&!Array.isArray(t)&&t.includes(",")&&(t=t.split(",")),!this.multiple&&!this.range&&Array.isArray(t)&&(t=t[0]),this.setFormValue(t),this.manageValidity(this.inputRef.value),this.inputRefTo&&this.manageValidity(this.inputRefTo.value),this.dispatchEvent(new Event("change")),this.dispatchEvent(new CustomEvent("value-change",{detail:t,bubbles:!0,composed:!0})),this.internals.reportValidity())}updated(t){super.updated(t),t.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(t){if(super.firstUpdated(t),this.value&&this.defaultValue!==null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null),this.defaultChecked&&(this.internals.ariaChecked=!0,this.checked=!0),this.required&&(this.internals.ariaRequired=!0),this.disabled&&(this.internals.ariaDisabled=!0),this.id&&!this.name&&(this.name=this.id),this.checked!==void 0){const r=this.checked===""||this.checked==="true"||this.checked===!0;this.internals.ariaChecked=r,this.internals.setFormValue(r?this.value||"on":"",r?this.value||"on":"")}else this.internals.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))}}s([e.n()],i.prototype,"defaultValue");s([e.n({type:Boolean,reflect:!0})],i.prototype,"disabled");s([e.n({type:Boolean,reflect:!0})],i.prototype,"readonly");s([e.n({type:Boolean,reflect:!0})],i.prototype,"required");s([e.n({type:Number,reflect:!0})],i.prototype,"max");s([e.n({type:Number,reflect:!0})],i.prototype,"maxlength");s([e.n({type:Number,reflect:!0})],i.prototype,"min");s([e.n({type:Number,reflect:!0})],i.prototype,"minlength");s([e.n({type:String})],i.prototype,"ariaDescribedBy");s([e.n({type:String})],i.prototype,"ariaLabelledby");s([e.n({type:String,reflect:!0})],i.prototype,"name");s([e.n({type:String,reflect:!0})],i.prototype,"pattern");s([e.n({type:String,reflect:!0})],i.prototype,"placeholder");s([e.n({type:String,reflect:!0})],i.prototype,"id");s([e.n({type:Boolean})],i.prototype,"counter");s([e.n({type:Boolean})],i.prototype,"hasError");s([e.n({type:Boolean})],i.prototype,"inline");s([e.n({type:Boolean})],i.prototype,"hasFieldset");s([e.n({type:Boolean})],i.prototype,"optionalTag");s([e.n({type:Boolean})],i.prototype,"requiredTag");s([e.n({type:Boolean})],i.prototype,"skipForwardTestid");s([e.n({type:Boolean,reflect:!1})],i.prototype,"useWrapper");s([e.n({type:Boolean,reflect:!0})],i.prototype,"fullwidth");s([e.n({type:Number})],i.prototype,"counterMaxLength");s([e.n({type:String})],i.prototype,"errorMessage");s([e.n({type:String})],i.prototype,"helptext");s([e.n({type:String})],i.prototype,"helptextDropdown");s([e.n({type:String,reflect:!1})],i.prototype,"helptextDropdownButton");s([e.n({type:String})],i.prototype,"label");s([e.n({type:String,reflect:!1})],i.prototype,"optionalText");s([e.n({type:String,reflect:!1})],i.prototype,"requiredText");s([e.n({type:String,attribute:"data-testid"})],i.prototype,"dataTestid");s([f.r()],i.prototype,"touched");exports.PktInputElement=i;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { n as s, P as y, t as
|
|
2
|
-
import { r as c } from "./state-
|
|
1
|
+
import { n as s, P as y, t as l } from "./element-G8JoS0Lj.js";
|
|
2
|
+
import { r as c } from "./state-gfUuUqVg.js";
|
|
3
3
|
import { u as m } from "./stringutils-DJjRa8dG.js";
|
|
4
4
|
import { s as g } from "./input-wrapper-Bw9tARAD.js";
|
|
5
|
-
var v = Object.defineProperty, e = (p, t, r,
|
|
5
|
+
var v = Object.defineProperty, e = (p, t, r, n) => {
|
|
6
6
|
for (var a = void 0, h = p.length - 1, o; h >= 0; h--)
|
|
7
7
|
(o = p[h]) && (a = o(t, r, a) || a);
|
|
8
8
|
return a && v(t, r, a), a;
|
|
9
9
|
};
|
|
10
10
|
class i extends y {
|
|
11
11
|
constructor() {
|
|
12
|
-
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.ariaDescribedBy = null, this.ariaLabelledby = null, this.name = "", this.pattern = null, this.placeholder = null, this.id = m(), this.counter = !1, this.hasError = !1, this.inline = !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 = g.props.helptextDropdownButton.default, this.label = null, this.optionalText =
|
|
12
|
+
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.ariaDescribedBy = null, this.ariaLabelledby = null, this.name = "", this.pattern = null, this.placeholder = null, this.id = m(), 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 = g.props.helptextDropdownButton.default, this.label = null, this.optionalText = l.forms.labels.optional, this.requiredText = l.forms.labels.required, this.dataTestid = "", this.touched = !1, this.internals = this.attachInternals();
|
|
13
13
|
}
|
|
14
14
|
static get formAssociated() {
|
|
15
15
|
return !0;
|
|
16
16
|
}
|
|
17
17
|
manageValidity(t) {
|
|
18
|
-
var r,
|
|
19
|
-
t && (this.required && !this.value ? this.internals.setValidity({ valueMissing: !0 },
|
|
18
|
+
var r, n, a, h, o, u, d, f;
|
|
19
|
+
t && (this.required && !this.value ? this.internals.setValidity({ valueMissing: !0 }, l.forms.messages.required, t) : (r = t.validity) != null && r.typeMismatch || (n = t.validity) != null && n.badInput ? this.internals.setValidity({ typeMismatch: !0 }, l.forms.messages.invalid, t) : (a = t.validity) != null && a.patternMismatch ? this.internals.setValidity(
|
|
20
20
|
{ patternMismatch: !0 },
|
|
21
|
-
|
|
21
|
+
l.forms.messages.invalidPattern,
|
|
22
22
|
t
|
|
23
|
-
) : (h = t.validity) != null && h.tooShort || this.minlength && this.minlength > 0 && this.value.length < this.minlength ? this.internals.setValidity({ tooShort: !0 },
|
|
23
|
+
) : (h = t.validity) != null && h.tooShort || this.minlength && this.minlength > 0 && this.value.length < this.minlength ? this.internals.setValidity({ tooShort: !0 }, l.forms.messages.tooShort, t) : (o = t.validity) != null && o.tooLong || this.maxlength && this.maxlength > 0 && this.value.length > this.maxlength ? this.internals.setValidity({ tooLong: !0 }, l.forms.messages.tooLong, t) : (u = t.validity) != null && u.rangeUnderflow ? this.internals.setValidity(
|
|
24
24
|
{ rangeUnderflow: !0 },
|
|
25
|
-
|
|
25
|
+
l.forms.messages.rangeUnderflow,
|
|
26
26
|
t
|
|
27
27
|
) : (d = t.validity) != null && d.rangeOverflow ? this.internals.setValidity(
|
|
28
28
|
{ rangeOverflow: !0 },
|
|
29
|
-
|
|
29
|
+
l.forms.messages.rangeOverflow,
|
|
30
30
|
t
|
|
31
31
|
) : (f = t.validity) != null && f.customError ? this.internals.setValidity({ customError: !0 }, t.validationMessage, t) : this.internals.setValidity({}));
|
|
32
32
|
}
|
|
@@ -34,8 +34,8 @@ class i extends y {
|
|
|
34
34
|
if (this.internals)
|
|
35
35
|
if (Array.isArray(t)) {
|
|
36
36
|
const r = new FormData();
|
|
37
|
-
t.forEach((
|
|
38
|
-
r.append(this.name,
|
|
37
|
+
t.forEach((n) => {
|
|
38
|
+
r.append(this.name, n);
|
|
39
39
|
}), this.internals.setFormValue(r);
|
|
40
40
|
} else
|
|
41
41
|
this.internals.setFormValue(t);
|
|
@@ -47,8 +47,8 @@ class i extends y {
|
|
|
47
47
|
const r = this.internals.form || this.closest("form");
|
|
48
48
|
r && r.querySelectorAll(
|
|
49
49
|
`pkt-radiobutton[name=${this.name}], input[type=radio][name=${this.name}]`
|
|
50
|
-
).forEach((
|
|
51
|
-
const a =
|
|
50
|
+
).forEach((n) => {
|
|
51
|
+
const a = n;
|
|
52
52
|
a.name === this.name && a.value !== this.value && a.checked && (a.checked = !1);
|
|
53
53
|
}), typeof t == "string" ? (this.checked = t === "true", this.internals.ariaChecked = t === "true") : typeof t == "boolean" && (this.checked = t, this.internals.ariaChecked = t), this.checked ? (this.internals.setFormValue(this.value || "on", this.value || "on"), this.internals.states.add("--checked")) : (this.internals.setFormValue("", ""), this.internals.states.delete("--checked")), this.dispatchEvent(new Event("change")), this.dispatchEvent(
|
|
54
54
|
new CustomEvent("value-change", {
|
|
@@ -59,7 +59,7 @@ class i extends y {
|
|
|
59
59
|
), this.internals.reportValidity();
|
|
60
60
|
}
|
|
61
61
|
valueChanged(t, r) {
|
|
62
|
-
(r !== this.value || r !== this._value) && (typeof t == "string" ? ((this.multiple || this.range) && t.includes(",") && (t = t.split(",")), this.value = t, this._value = Array.isArray(t) ? t : [t]) : Array.isArray(t) ? (this.value = t, this._value = t) : (this.value = "", this._value = []), (!this.value || this.value.length === 0) && r && r.length !== 0 ? this.clearInputValue() : this.value && this.value.toString() !== (r == null ? void 0 : r.toString()) && this.onChange(this.value), this.updateComplete.then(() => this.requestUpdate()));
|
|
62
|
+
(r !== this.value || r !== this._value) && (typeof t == "string" ? ((this.multiple || this.range) && t.includes(",") && (t = t.split(",")), this.value = t, this._value = Array.isArray(t) ? t : [t]) : Array.isArray(t) ? (this.value = this.multiple || this.range ? t : t[0], this._value = t) : (this.value = "", this._value = []), (!this.value || this.value.length === 0) && r && r.length !== 0 ? this.clearInputValue() : this.value && this.value.toString() !== (r == null ? void 0 : r.toString()) && this.onChange(this.value), this.updateComplete.then(() => this.requestUpdate()));
|
|
63
63
|
}
|
|
64
64
|
// When input goes from content to no content
|
|
65
65
|
clearInputValue() {
|
|
@@ -164,6 +164,9 @@ e([
|
|
|
164
164
|
e([
|
|
165
165
|
s({ type: Boolean })
|
|
166
166
|
], i.prototype, "inline");
|
|
167
|
+
e([
|
|
168
|
+
s({ type: Boolean })
|
|
169
|
+
], i.prototype, "hasFieldset");
|
|
167
170
|
e([
|
|
168
171
|
s({ type: Boolean })
|
|
169
172
|
], i.prototype, "optionalTag");
|
|
@@ -174,7 +177,7 @@ e([
|
|
|
174
177
|
s({ type: Boolean })
|
|
175
178
|
], i.prototype, "skipForwardTestid");
|
|
176
179
|
e([
|
|
177
|
-
s({ type: Boolean })
|
|
180
|
+
s({ type: Boolean, reflect: !1 })
|
|
178
181
|
], i.prototype, "useWrapper");
|
|
179
182
|
e([
|
|
180
183
|
s({ type: Boolean, reflect: !0 })
|
|
@@ -192,16 +195,16 @@ e([
|
|
|
192
195
|
s({ type: String })
|
|
193
196
|
], i.prototype, "helptextDropdown");
|
|
194
197
|
e([
|
|
195
|
-
s({ type: String })
|
|
198
|
+
s({ type: String, reflect: !1 })
|
|
196
199
|
], i.prototype, "helptextDropdownButton");
|
|
197
200
|
e([
|
|
198
201
|
s({ type: String })
|
|
199
202
|
], i.prototype, "label");
|
|
200
203
|
e([
|
|
201
|
-
s({ type: String })
|
|
204
|
+
s({ type: String, reflect: !1 })
|
|
202
205
|
], i.prototype, "optionalText");
|
|
203
206
|
e([
|
|
204
|
-
s({ type: String })
|
|
207
|
+
s({ type: String, reflect: !1 })
|
|
205
208
|
], i.prototype, "requiredText");
|
|
206
209
|
e([
|
|
207
210
|
s({ type: String, attribute: "data-testid" })
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";const t=require("./element-BBo3JZk5.cjs"),b=require("./pkt-slot-controller-CqNvEpFd.cjs"),a=require("./ref-DsoUUoPU.cjs"),y=require("./icon-BTUCDPN5.cjs"),c=require("./class-map-D4rXyUxT.cjs"),f=require("./state-BILlRnrD.cjs"),$=require("./stringutils-CkVRq4jP.cjs"),p=require("./input-wrapper-jPnKsfEC.cjs");require("./helptext-B4Uc-d56.cjs");var I=Object.defineProperty,P=Object.getOwnPropertyDescriptor,e=(u,r,i,o)=>{for(var s=o>1?void 0:o?P(r,i):r,n=u.length-1,l;n>=0;n--)(l=u[n])&&(s=(o?l(r,i,s):l(s))||s);return o&&s&&I(r,i,s),s};exports.PktInputWrapper=class extends t.PktElement{constructor(){super(),this.defaultSlot=a.e(),this.helptextSlot=a.e(),this.hasHelptextSlot=!0,this.forId=$.uuidish(),this.label="",this.helptext=null,this.helptextDropdown=null,this.helptextDropdownButton=null,this.counter=p.specs.props.counter.default,this.counterCurrent=0,this.counterMaxLength=0,this.counterError=null,this.counterPosition="bottom",this.optionalTag=p.specs.props.optionalTag.default,this.optionalText=p.specs.props.optionalText.default,this.requiredTag=p.specs.props.requiredTag.default,this.requiredText=p.specs.props.requiredText.default,this.hasError=p.specs.props.hasError.default,this.errorMessage="",this.disabled=p.specs.props.disabled.default,this.inline=p.specs.props.inline.default,this.ariaDescribedby=void 0,this.hasFieldset=p.specs.props.hasFieldset.default,this.useWrapper=p.specs.props.useWrapper.default,this.role="group",this.slotController=new b.PktSlotController(this,this.defaultSlot,this.helptextSlot)}updateSlots(r){this.hasHelptextSlot=r.has("helptext"),this.requestUpdate()}updated(r){super.updated(r)}render(){const r={"pkt-inputwrapper":!0,"pkt-inputwrapper--error":this.hasError,"pkt-inputwrapper--disabled":this.disabled,"pkt-inputwrapper--inline":this.inline},i={"pkt-tag":!0,"pkt-tag--small":!0,"pkt-tag--thin-text":!0,"pkt-tag--blue-light":this.optionalTag,"pkt-tag--beige":!this.optionalTag&&this.requiredTag},o=this.ariaDescribedby?this.ariaDescribedby:this.helptext?`${this.forId}-helptext`:t.E,s=()=>this.optionalTag||this.requiredTag?t.x`<span class=${c.e(i)}
|
|
2
|
+
>${this.optionalTag?this.optionalText:this.requiredTag?this.requiredText:t.E}</span
|
|
3
|
+
>`:t.E,n=()=>this.useWrapper?this.hasFieldset?t.x`<legend
|
|
4
|
+
class="pkt-inputwrapper__legend"
|
|
5
|
+
id="${this.forId}-label"
|
|
6
|
+
@click=${this.handleLabelClick}
|
|
7
|
+
>
|
|
8
|
+
${this.label} ${s()}
|
|
9
|
+
</legend>`:t.x`<label
|
|
10
|
+
class="pkt-inputwrapper__label"
|
|
11
|
+
for="${this.forId}"
|
|
12
|
+
aria-describedby="${o}"
|
|
13
|
+
id="${this.forId}-label"
|
|
14
|
+
@click=${this.handleLabelClick}
|
|
15
|
+
>${this.label}${s()}</label
|
|
16
|
+
>`:t.x`<label
|
|
17
|
+
for="${this.forId}"
|
|
18
|
+
class="pkt-sr-only"
|
|
19
|
+
aria-describedby="${o}"
|
|
20
|
+
id="${this.forId}-label"
|
|
21
|
+
>
|
|
22
|
+
${this.label}
|
|
23
|
+
</label>`,l=()=>!this.helptext&&!this.hasHelptextSlot&&!this.helptextDropdown?t.E:t.x`
|
|
24
|
+
<pkt-helptext
|
|
25
|
+
.forId=${this.forId}
|
|
26
|
+
.helptext=${this.helptext}
|
|
27
|
+
.helptextDropdown=${this.helptextDropdown}
|
|
28
|
+
.helptextDropdownButton=${this.helptextDropdownButton||p.specs.props.helptextDropdownButton.default}
|
|
29
|
+
@toggleHelpText=${g=>{this.toggleDropdown(g)}}
|
|
30
|
+
${a.n(this.helptextSlot)}
|
|
31
|
+
name="helptext"
|
|
32
|
+
></pkt-helptext>
|
|
33
|
+
`,h=()=>this.counter?t.x`<div class="pkt-input__counter" aria-live="polite" aria-atomic="true">
|
|
34
|
+
${this.counterError?this.counterError:t.E} ${this.counterCurrent||0}
|
|
35
|
+
${this.counterMaxLength?`/${this.counterMaxLength}`:t.E}
|
|
36
|
+
</div>`:t.E,k=()=>this.hasError&&this.errorMessage?t.x`<div
|
|
37
|
+
role="alert"
|
|
38
|
+
class="pkt-alert pkt-alert--error pkt-alert--compact"
|
|
39
|
+
aria-live="assertive"
|
|
40
|
+
aria-atomic="true"
|
|
41
|
+
id="${this.forId}-error"
|
|
42
|
+
>
|
|
43
|
+
<pkt-icon name="alert-error" class="pkt-alert__icon"></pkt-icon>
|
|
44
|
+
<div class="pkt-alert__text">${y.o(this.errorMessage)}</div>
|
|
45
|
+
</div>`:t.E,d=()=>t.x`
|
|
46
|
+
${n()} ${l()}
|
|
47
|
+
${this.counterPosition==="top"?h():t.E}
|
|
48
|
+
<div class="pkt-contents" ${a.n(this.defaultSlot)}></div>
|
|
49
|
+
${this.counterPosition==="bottom"?h():t.E} ${k()}
|
|
50
|
+
`,x=()=>this.hasFieldset?t.x`<fieldset class="pkt-inputwrapper__fieldset" aria-describedby="${o}">
|
|
51
|
+
${d()}
|
|
52
|
+
</fieldset>`:t.x`<div class="pkt-inputwrapper__fieldset">${d()}</div>`;return t.x`<div class=${c.e(r)}>${x()}</div> `}toggleDropdown(r){this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!1,detail:{isOpen:r.detail.isOpen}}))}handleLabelClick(r){this.disabled&&(r.preventDefault(),r.stopImmediatePropagation()),this.dispatchEvent(new CustomEvent("labelClick",{bubbles:!0,composed:!0,detail:"label clicked"}))}};e([f.r()],exports.PktInputWrapper.prototype,"hasHelptextSlot",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"forId",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"label",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"helptext",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"helptextDropdown",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"helptextDropdownButton",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"counter",2);e([t.n({type:Number})],exports.PktInputWrapper.prototype,"counterCurrent",2);e([t.n({type:Number})],exports.PktInputWrapper.prototype,"counterMaxLength",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"counterError",2);e([t.n({type:String,reflect:!1})],exports.PktInputWrapper.prototype,"counterPosition",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"optionalTag",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"optionalText",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"requiredTag",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"requiredText",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"hasError",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"errorMessage",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"disabled",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"inline",2);e([t.n({type:String})],exports.PktInputWrapper.prototype,"ariaDescribedby",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"hasFieldset",2);e([t.n({type:Boolean})],exports.PktInputWrapper.prototype,"useWrapper",2);e([t.n({type:String,reflect:!0})],exports.PktInputWrapper.prototype,"role",2);exports.PktInputWrapper=e([t.t("pkt-input-wrapper")],exports.PktInputWrapper);
|