@oslokommune/punkt-elements 16.8.2 → 16.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/dist/accordion.d.ts +1 -1
- package/dist/alert.d.ts +1 -1
- package/dist/backlink.d.ts +1 -1
- package/dist/base-elements/element-with-slot.d.ts +21 -0
- package/dist/base-elements/element.d.ts +32 -0
- package/dist/base-elements/input-element.d.ts +173 -0
- package/dist/base-elements/options-input-element.d.ts +73 -0
- package/dist/breadcrumbs.d.ts +1 -1
- package/dist/button.d.ts +1 -1
- package/dist/calendar.d.ts +1 -1
- package/dist/card.d.ts +1 -1
- package/dist/checkbox.d.ts +1 -1
- package/dist/combobox.d.ts +1 -1
- package/dist/components/accordion/accordion.d.ts +20 -0
- package/dist/components/accordion/accordion.test.d.ts +0 -0
- package/dist/components/accordion/accordionitem.d.ts +32 -0
- package/dist/components/accordion/index.d.ts +5 -0
- package/dist/components/alert/alert.d.ts +30 -0
- package/dist/components/alert/alert.test.d.ts +13 -0
- package/dist/components/alert/index.d.ts +3 -0
- package/dist/components/backlink/backlink.d.ts +14 -0
- package/dist/components/backlink/backlink.test.d.ts +10 -0
- package/dist/components/backlink/index.d.ts +4 -0
- package/dist/components/breadcrumbs/breadcrumbs.d.ts +15 -0
- package/dist/components/breadcrumbs/breadcrumbs.test.d.ts +0 -0
- package/dist/components/breadcrumbs/index.d.ts +2 -0
- package/dist/components/button/button.d.ts +53 -0
- package/dist/components/button/button.test.d.ts +22 -0
- package/dist/components/button/index.d.ts +4 -0
- package/dist/components/calendar/calendar.accessibility.test.d.ts +16 -0
- package/dist/components/calendar/calendar.constraints.test.d.ts +0 -0
- package/dist/components/calendar/calendar.core.test.d.ts +0 -0
- package/dist/components/calendar/calendar.d.ts +97 -0
- package/dist/components/calendar/calendar.interaction.test.d.ts +0 -0
- package/dist/components/calendar/calendar.selection.test.d.ts +0 -0
- package/dist/components/calendar/index.d.ts +3 -0
- package/dist/components/card/card.d.ts +64 -0
- package/dist/components/card/card.test.d.ts +22 -0
- package/dist/components/card/index.d.ts +3 -0
- package/dist/components/checkbox/checkbox.d.ts +32 -0
- package/dist/components/checkbox/checkbox.test.d.ts +24 -0
- package/dist/components/checkbox/index.d.ts +3 -0
- package/dist/components/combobox/combobox-base.d.ts +74 -0
- package/dist/components/combobox/combobox-handlers.d.ts +28 -0
- package/dist/components/combobox/combobox-types.d.ts +5 -0
- package/dist/components/combobox/combobox-utils.d.ts +41 -0
- package/dist/components/combobox/combobox-value.d.ts +17 -0
- package/dist/components/combobox/combobox.accessibility.test.d.ts +0 -0
- package/dist/components/combobox/combobox.core.test.d.ts +0 -0
- package/dist/components/combobox/combobox.d.ts +61 -0
- package/dist/components/combobox/combobox.interaction.test.d.ts +0 -0
- package/dist/components/combobox/combobox.selection.test.d.ts +0 -0
- package/dist/components/combobox/index.d.ts +4 -0
- package/dist/components/consent/consent.d.ts +46 -0
- package/dist/components/consent/consent.test.d.ts +16 -0
- package/dist/components/consent/index.d.ts +4 -0
- package/dist/components/consent/strings.d.ts +85 -0
- package/dist/components/datepicker/date-tags.d.ts +20 -0
- package/dist/components/datepicker/date-tags.test.d.ts +12 -0
- package/dist/components/datepicker/datepicker-base.d.ts +39 -0
- package/dist/components/datepicker/datepicker-multiple.d.ts +10 -0
- package/dist/components/datepicker/datepicker-popup.d.ts +34 -0
- package/dist/components/datepicker/datepicker-popup.test.d.ts +4 -0
- package/dist/components/datepicker/datepicker-range.d.ts +12 -0
- package/dist/components/datepicker/datepicker-single.d.ts +8 -0
- package/dist/components/datepicker/datepicker-types.d.ts +6 -0
- package/dist/components/datepicker/datepicker-utils.d.ts +77 -0
- package/dist/components/datepicker/datepicker-utils.test.d.ts +1 -0
- package/dist/components/datepicker/datepicker.accessibility.test.d.ts +0 -0
- package/dist/components/datepicker/datepicker.core.test.d.ts +0 -0
- package/dist/components/datepicker/datepicker.d.ts +83 -0
- package/dist/components/datepicker/datepicker.input.test.d.ts +0 -0
- package/dist/components/datepicker/datepicker.selection.test.d.ts +0 -0
- package/dist/components/datepicker/datepicker.validation.test.d.ts +0 -0
- package/dist/components/datepicker/index.d.ts +6 -0
- package/dist/components/header/header-service.d.ts +86 -0
- package/dist/components/header/header-service.test.d.ts +18 -0
- package/dist/components/header/header-user-menu.d.ts +29 -0
- package/dist/components/header/header-utils.d.ts +6 -0
- package/dist/components/header/header.d.ts +52 -0
- package/dist/components/header/index.d.ts +5 -0
- package/dist/components/header/types.d.ts +59 -0
- package/dist/components/heading/heading.d.ts +28 -0
- package/dist/components/heading/heading.test.d.ts +0 -0
- package/dist/components/heading/index.d.ts +4 -0
- package/dist/components/helptext/helptext.d.ts +9 -0
- package/dist/components/helptext/helptext.test.d.ts +0 -0
- package/dist/components/helptext/index.d.ts +3 -0
- package/dist/components/icon/icon.d.ts +22 -0
- package/dist/components/icon/icon.test.d.ts +10 -0
- package/dist/components/icon/index.d.ts +3 -0
- package/dist/components/index.d.ts +45 -0
- package/dist/components/input-wrapper/index.d.ts +3 -0
- package/dist/components/input-wrapper/input-wrapper.d.ts +39 -0
- package/dist/components/input-wrapper/input-wrapper.test.d.ts +31 -0
- package/dist/components/link/index.d.ts +3 -0
- package/dist/components/link/link.d.ts +12 -0
- package/dist/components/link/link.test.d.ts +15 -0
- package/dist/components/linkcard/index.d.ts +4 -0
- package/dist/components/linkcard/linkcard.d.ts +19 -0
- package/dist/components/linkcard/linkcard.test.d.ts +9 -0
- package/dist/components/listbox/index.d.ts +4 -0
- package/dist/components/listbox/listbox.d.ts +64 -0
- package/dist/components/listbox/listbox.interaction.test.d.ts +10 -0
- package/dist/components/listbox/listbox.test.d.ts +10 -0
- package/dist/components/loader/index.d.ts +4 -0
- package/dist/components/loader/loader.d.ts +53 -0
- package/dist/components/loader/loader.test.d.ts +8 -0
- package/dist/components/messagebox/index.d.ts +4 -0
- package/dist/components/messagebox/messagebox.d.ts +21 -0
- package/dist/components/messagebox/messagebox.test.d.ts +8 -0
- package/dist/components/modal/index.d.ts +3 -0
- package/dist/components/modal/modal.d.ts +41 -0
- package/dist/components/progressbar/index.d.ts +4 -0
- package/dist/components/progressbar/progressbar.d.ts +49 -0
- package/dist/components/progressbar/progressbar.test.d.ts +8 -0
- package/dist/components/radiobutton/index.d.ts +3 -0
- package/dist/components/radiobutton/radiobutton.d.ts +24 -0
- package/dist/components/radiobutton/radiobutton.test.d.ts +28 -0
- package/dist/components/select/index.d.ts +4 -0
- package/dist/components/select/select.d.ts +48 -0
- package/dist/components/select/select.test.d.ts +21 -0
- package/dist/components/tabs/index.d.ts +5 -0
- package/dist/components/tabs/tabitem.d.ts +33 -0
- package/dist/components/tabs/tabs-context.d.ts +21 -0
- package/dist/components/tabs/tabs.d.ts +23 -0
- package/dist/components/tabs/tabs.test.d.ts +0 -0
- package/dist/components/tag/index.d.ts +4 -0
- package/dist/components/tag/tag.d.ts +44 -0
- package/dist/components/tag/tag.test.d.ts +8 -0
- package/dist/components/textarea/index.d.ts +3 -0
- package/dist/components/textarea/textarea.d.ts +16 -0
- package/dist/components/textarea/textarea.test.d.ts +27 -0
- package/dist/components/textinput/index.d.ts +3 -0
- package/dist/components/textinput/textinput.d.ts +21 -0
- package/dist/components/textinput/textinput.test.d.ts +32 -0
- package/dist/components/timepicker/index.d.ts +2 -0
- package/dist/components/timepicker/timepicker.d.ts +94 -0
- package/dist/components/timepicker/timepicker.test.d.ts +22 -0
- package/dist/consent.d.ts +1 -1
- package/dist/controllers/pkt-options-controller.d.ts +21 -0
- package/dist/controllers/pkt-slot-utils.d.ts +3 -0
- package/dist/datepicker.d.ts +1 -1
- package/dist/directives/slot-content.d.ts +128 -0
- package/dist/directives/slot-content.test.d.ts +0 -0
- package/dist/docs/backlink.d.ts +4 -0
- package/dist/docs/components/accordion.d.ts +5 -0
- package/dist/docs/components/alert.d.ts +7 -0
- package/dist/docs/components/backlink.d.ts +4 -0
- package/dist/docs/components/breadcrumbs.d.ts +8 -0
- package/dist/docs/components/button.d.ts +11 -0
- package/dist/docs/components/calendar.d.ts +4 -0
- package/dist/docs/components/card.d.ts +27 -0
- package/dist/docs/components/checkbox.d.ts +8 -0
- package/dist/docs/components/combobox.d.ts +11 -0
- package/dist/docs/components/comboboxdemo.d.ts +4 -0
- package/dist/docs/components/consent.d.ts +4 -0
- package/dist/docs/components/datepicker.d.ts +4 -0
- package/dist/docs/components/datepickermultiple.d.ts +4 -0
- package/dist/docs/components/form.d.ts +9 -0
- package/dist/docs/components/header-full.d.ts +23 -0
- package/dist/docs/components/header.d.ts +18 -0
- package/dist/docs/components/heading.d.ts +12 -0
- package/dist/docs/components/icon.d.ts +4 -0
- package/dist/docs/components/input-wrapper.d.ts +4 -0
- package/dist/docs/components/link.d.ts +4 -0
- package/dist/docs/components/linkcard.d.ts +4 -0
- package/dist/docs/components/loader.d.ts +4 -0
- package/dist/docs/components/messagebox.d.ts +4 -0
- package/dist/docs/components/modal.d.ts +14 -0
- package/dist/docs/components/progressbar.d.ts +9 -0
- package/dist/docs/components/radiobutton.d.ts +12 -0
- package/dist/docs/components/select.d.ts +10 -0
- package/dist/docs/components/slots.d.ts +35 -0
- package/dist/docs/components/tabs.d.ts +31 -0
- package/dist/docs/components/tag.d.ts +4 -0
- package/dist/docs/components/textarea.d.ts +4 -0
- package/dist/docs/components/textinput.d.ts +4 -0
- package/dist/docs/components/timepicker.d.ts +4 -0
- package/dist/docs/header.d.ts +14 -0
- package/dist/docs/punkt-docs.d.ts +12 -0
- package/dist/header.d.ts +1 -1
- package/dist/heading.d.ts +1 -1
- package/dist/helpers/converters.d.ts +9 -0
- package/dist/helptext.d.ts +1 -1
- package/dist/icon.d.ts +1 -1
- package/dist/index.d.ts +2 -1971
- package/dist/input-wrapper.d.ts +1 -1
- package/dist/link.d.ts +1 -1
- package/dist/linkcard.d.ts +1 -1
- package/dist/listbox.d.ts +1 -1
- package/dist/loader.d.ts +1 -1
- package/dist/messagebox.d.ts +1 -1
- package/dist/modal.d.ts +1 -1
- package/dist/progressbar.d.ts +1 -1
- package/dist/radiobutton.d.ts +1 -1
- package/dist/select.d.ts +1 -1
- package/dist/shared-types/aria.d.ts +65 -0
- package/dist/shared-types/booleanish.d.ts +13 -0
- package/dist/shared-types/calendar.d.ts +41 -0
- package/dist/shared-types/combobox.d.ts +34 -0
- package/dist/shared-types/datepicker.d.ts +46 -0
- package/dist/shared-types/form.d.ts +16 -0
- package/dist/shared-types/header.d.ts +88 -0
- package/dist/shared-types/heading.d.ts +9 -0
- package/dist/shared-types/index.d.ts +17 -0
- package/dist/shared-types/layout.d.ts +26 -0
- package/dist/shared-types/progressbar.d.ts +5 -0
- package/dist/shared-types/size.d.ts +18 -0
- package/dist/shared-types/skin.d.ts +24 -0
- package/dist/shared-types/timepicker.d.ts +20 -0
- package/dist/shared-utils/calendar/calendar-grid.d.ts +16 -0
- package/dist/shared-utils/calendar/date-validation.d.ts +22 -0
- package/dist/shared-utils/calendar/index.d.ts +10 -0
- package/dist/shared-utils/calendar/keyboard-navigation.d.ts +16 -0
- package/dist/shared-utils/calendar/selection-manager.d.ts +30 -0
- package/dist/shared-utils/combobox/index.d.ts +10 -0
- package/dist/shared-utils/combobox/input-utils.d.ts +38 -0
- package/dist/shared-utils/combobox/keyboard-navigation.d.ts +39 -0
- package/dist/shared-utils/combobox/option-utils.d.ts +50 -0
- package/dist/shared-utils/combobox/selection-manager.d.ts +71 -0
- package/dist/shared-utils/combobox/typeahead.d.ts +24 -0
- package/dist/shared-utils/date-utils.d.ts +138 -0
- package/dist/shared-utils/datepicker-utils.d.ts +73 -0
- package/dist/shared-utils/device-utils.d.ts +10 -0
- package/dist/shared-utils/timepicker/index.d.ts +6 -0
- package/dist/shared-utils/timepicker/options.d.ts +19 -0
- package/dist/shared-utils/timepicker/stepper.d.ts +20 -0
- package/dist/shared-utils/timepicker/time-utils.d.ts +19 -0
- package/dist/shared-utils/utils.d.ts +16 -0
- package/dist/shared-utils/value-utils.d.ts +17 -0
- package/dist/tabs.d.ts +1 -1
- package/dist/tag.d.ts +1 -1
- package/dist/tests/component-registry.d.ts +64 -0
- package/dist/tests/test-framework.d.ts +29 -0
- package/dist/textarea.d.ts +1 -1
- package/dist/textinput.d.ts +1 -1
- package/dist/timepicker.d.ts +1 -1
- package/dist/translations/no.json.d.ts +93 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/size.d.ts +1 -0
- package/dist/types/typeUtils.d.ts +6 -0
- package/dist/utils/classutils.d.ts +12 -0
- package/package.json +3 -3
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { PropertyValues, TemplateResult } from 'lit';
|
|
2
|
+
import { PktElement } from '../../base-elements/element';
|
|
3
|
+
export declare class PktCalendar extends PktElement {
|
|
4
|
+
selected: string | string[];
|
|
5
|
+
multiple: boolean;
|
|
6
|
+
maxMultiple: number;
|
|
7
|
+
range: boolean;
|
|
8
|
+
earliest: string | null;
|
|
9
|
+
latest: string | null;
|
|
10
|
+
excludedates: Date[];
|
|
11
|
+
excludeweekdays: string[];
|
|
12
|
+
weeknumbers: boolean;
|
|
13
|
+
withcontrols: boolean;
|
|
14
|
+
currentmonth: Date | null;
|
|
15
|
+
today: string | null;
|
|
16
|
+
dayStrings: string[];
|
|
17
|
+
dayStringsLong: string[];
|
|
18
|
+
monthStrings: string[];
|
|
19
|
+
weekString: string;
|
|
20
|
+
prevMonthString: string;
|
|
21
|
+
nextMonthString: string;
|
|
22
|
+
private _selected;
|
|
23
|
+
private inRange;
|
|
24
|
+
private rangeHovered;
|
|
25
|
+
private get todayDate();
|
|
26
|
+
private year;
|
|
27
|
+
private month;
|
|
28
|
+
private week;
|
|
29
|
+
private currentmonthtouched;
|
|
30
|
+
private focusedDate;
|
|
31
|
+
private selectableDates;
|
|
32
|
+
private tabIndexSet;
|
|
33
|
+
/**
|
|
34
|
+
* Lifecycle methods
|
|
35
|
+
*/
|
|
36
|
+
protected firstUpdated(_changedProperties: PropertyValues): void;
|
|
37
|
+
disconnectedCallback(): void;
|
|
38
|
+
updated(changedProperties: PropertyValues): void;
|
|
39
|
+
/**
|
|
40
|
+
* Date and selection management
|
|
41
|
+
*/
|
|
42
|
+
private convertSelected;
|
|
43
|
+
private setCurrentMonth;
|
|
44
|
+
/**
|
|
45
|
+
* Keyboard navigation
|
|
46
|
+
*/
|
|
47
|
+
private handleKeydown;
|
|
48
|
+
private handleArrowKey;
|
|
49
|
+
/**
|
|
50
|
+
* Rendering methods
|
|
51
|
+
*/
|
|
52
|
+
render(): TemplateResult<1>;
|
|
53
|
+
private renderMonthNavButton;
|
|
54
|
+
private renderDayNames;
|
|
55
|
+
private renderMonthNav;
|
|
56
|
+
private getDayViewData;
|
|
57
|
+
private getDateConstraints;
|
|
58
|
+
private isDayDisabled;
|
|
59
|
+
private calculateTabIndex;
|
|
60
|
+
private getDayCellClasses;
|
|
61
|
+
private getDayButtonClasses;
|
|
62
|
+
private handleDayFocus;
|
|
63
|
+
private renderDayView;
|
|
64
|
+
private renderEmptyDayCell;
|
|
65
|
+
private renderWeekRow;
|
|
66
|
+
private renderCalendarBody;
|
|
67
|
+
/**
|
|
68
|
+
* Date validation
|
|
69
|
+
*/
|
|
70
|
+
private isExcluded;
|
|
71
|
+
/**
|
|
72
|
+
* Month navigation
|
|
73
|
+
*/
|
|
74
|
+
isPrevMonthAllowed(): boolean;
|
|
75
|
+
private prevMonth;
|
|
76
|
+
isNextMonthAllowed(): boolean;
|
|
77
|
+
private nextMonth;
|
|
78
|
+
private changeMonth;
|
|
79
|
+
/**
|
|
80
|
+
* Date selection logic
|
|
81
|
+
*/
|
|
82
|
+
private emptySelected;
|
|
83
|
+
private normalizeSelected;
|
|
84
|
+
addToSelected(selectedDate: Date): void;
|
|
85
|
+
removeFromSelected(selectedDate: Date): void;
|
|
86
|
+
toggleSelected(selectedDate: Date): void;
|
|
87
|
+
private isRangeAllowed;
|
|
88
|
+
private handleRangeSelect;
|
|
89
|
+
private handleRangeHover;
|
|
90
|
+
handleDateSelect(selectedDate: Date | null): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Focus management and event handlers
|
|
93
|
+
*/
|
|
94
|
+
focusOnCurrentDate(): void;
|
|
95
|
+
closeEvent(e: FocusEvent): void;
|
|
96
|
+
close(): void;
|
|
97
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { IPktTag } from '../tag';
|
|
2
|
+
import { PktElementWithSlot } from '../../base-elements/element-with-slot';
|
|
3
|
+
import { IPktHeading } from '../heading';
|
|
4
|
+
import { IAriaAttributes, TCardSkin, TLayout } from '../../shared-types';
|
|
5
|
+
export type { TCardSkin, TLayout };
|
|
6
|
+
export type TCardPadding = 'none' | 'default';
|
|
7
|
+
export type TCardImageShape = 'square' | 'round';
|
|
8
|
+
export type TCardTagPosition = 'top' | 'bottom';
|
|
9
|
+
export interface IPktCard {
|
|
10
|
+
ariaLabel?: IAriaAttributes['aria-label'];
|
|
11
|
+
metaLead?: string | null;
|
|
12
|
+
metaTrail?: string | null;
|
|
13
|
+
layout?: TLayout;
|
|
14
|
+
heading?: string;
|
|
15
|
+
headingLevel?: IPktHeading['level'];
|
|
16
|
+
image?: {
|
|
17
|
+
src: string;
|
|
18
|
+
alt: string;
|
|
19
|
+
};
|
|
20
|
+
imageShape?: TCardImageShape;
|
|
21
|
+
clickCardLink?: string | null;
|
|
22
|
+
openLinkInNewTab?: boolean | null;
|
|
23
|
+
borderOnHover?: boolean | null;
|
|
24
|
+
padding?: TCardPadding;
|
|
25
|
+
skin?: TCardSkin;
|
|
26
|
+
subheading?: string;
|
|
27
|
+
tagPosition?: TCardTagPosition;
|
|
28
|
+
tags?: (Omit<IPktTag, 'closeTag'> & {
|
|
29
|
+
text: string;
|
|
30
|
+
})[];
|
|
31
|
+
}
|
|
32
|
+
export declare class PktCard extends PktElementWithSlot implements IPktCard {
|
|
33
|
+
ariaLabel: string;
|
|
34
|
+
metaLead: string | null;
|
|
35
|
+
borderOnHover: boolean;
|
|
36
|
+
clickCardLink: IPktCard['clickCardLink'];
|
|
37
|
+
metaTrail: string | null;
|
|
38
|
+
layout: TLayout;
|
|
39
|
+
heading: string;
|
|
40
|
+
headinglevel: IPktHeading['level'];
|
|
41
|
+
image: {
|
|
42
|
+
src: string;
|
|
43
|
+
alt: string;
|
|
44
|
+
};
|
|
45
|
+
imageShape: TCardImageShape;
|
|
46
|
+
openLinkInNewTab: boolean;
|
|
47
|
+
padding: TCardPadding;
|
|
48
|
+
skin: TCardSkin;
|
|
49
|
+
subheading: string;
|
|
50
|
+
tagPosition: 'top' | 'bottom';
|
|
51
|
+
tags: (Omit<IPktTag, 'closeTag'> & {
|
|
52
|
+
text: string;
|
|
53
|
+
})[];
|
|
54
|
+
connectedCallback(): void;
|
|
55
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
56
|
+
renderImage(): import('lit-html').TemplateResult<1>;
|
|
57
|
+
renderHeading(): import('lit-html').TemplateResult<1>;
|
|
58
|
+
renderLinkHeading(): import('lit-html').TemplateResult<1>;
|
|
59
|
+
renderSubheading(): import('lit-html').TemplateResult<1>;
|
|
60
|
+
renderHeader(): import('lit-html').TemplateResult<1>;
|
|
61
|
+
renderTags(): import('lit-html').TemplateResult<1>;
|
|
62
|
+
renderSlot(): import('lit-html').TemplateResult<1>;
|
|
63
|
+
renderMetadata(): import('lit-html').TemplateResult<1>;
|
|
64
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BaseTestConfig } from '../../tests/test-framework';
|
|
2
|
+
export interface CardTestConfig extends BaseTestConfig {
|
|
3
|
+
skin?: string;
|
|
4
|
+
layout?: string;
|
|
5
|
+
padding?: string;
|
|
6
|
+
borderOnHover?: boolean;
|
|
7
|
+
heading?: string;
|
|
8
|
+
subheading?: string;
|
|
9
|
+
headingLevel?: number;
|
|
10
|
+
href?: string;
|
|
11
|
+
linkText?: string;
|
|
12
|
+
image?: string;
|
|
13
|
+
imageAlt?: string;
|
|
14
|
+
tags?: string;
|
|
15
|
+
metaPrefix?: string;
|
|
16
|
+
metaLabel?: string;
|
|
17
|
+
metaDate?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const createCardTest: (config?: CardTestConfig) => Promise<{
|
|
20
|
+
container: HTMLElement;
|
|
21
|
+
card: import('./card').PktCard;
|
|
22
|
+
}>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { PktInputElement } from '../../base-elements/input-element';
|
|
2
|
+
import { Ref } from 'lit/directives/ref.js';
|
|
3
|
+
import { PropertyValues } from 'lit';
|
|
4
|
+
import { ElementProps } from '../../types/typeUtils';
|
|
5
|
+
type Props = ElementProps<PktCheckbox, 'checkHelptext' | 'defaultChecked' | 'hasTile' | 'isSwitch' | 'labelPosition' | 'hideLabel' | 'tagText' | 'optionalTag' | 'optionalText' | 'requiredTag' | 'requiredText'>;
|
|
6
|
+
export declare class PktCheckbox extends PktInputElement<Props> {
|
|
7
|
+
inputRef: Ref<HTMLInputElement>;
|
|
8
|
+
value: string;
|
|
9
|
+
checkHelptext: string | null;
|
|
10
|
+
defaultChecked: boolean;
|
|
11
|
+
hasTile: boolean;
|
|
12
|
+
isSwitch: boolean;
|
|
13
|
+
labelPosition: 'right' | 'left';
|
|
14
|
+
hideLabel: boolean;
|
|
15
|
+
checked: boolean | string | null;
|
|
16
|
+
indeterminate: boolean | 'true' | 'false' | '';
|
|
17
|
+
type: string;
|
|
18
|
+
tagText: string | null;
|
|
19
|
+
optionalTag: boolean;
|
|
20
|
+
optionalText: string;
|
|
21
|
+
requiredTag: boolean;
|
|
22
|
+
requiredText: string;
|
|
23
|
+
connectedCallback(): void;
|
|
24
|
+
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
25
|
+
protected firstUpdated(_changedProperties: PropertyValues): void;
|
|
26
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
27
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
28
|
+
private handleClick;
|
|
29
|
+
private handleChange;
|
|
30
|
+
private toggleChecked;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseTestConfig } from '../../tests/test-framework';
|
|
2
|
+
export interface CheckboxTestConfig extends BaseTestConfig {
|
|
3
|
+
id?: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
checked?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
required?: boolean;
|
|
9
|
+
value?: string;
|
|
10
|
+
checkHelptext?: string;
|
|
11
|
+
hasTile?: boolean;
|
|
12
|
+
hasError?: boolean;
|
|
13
|
+
errorMessage?: string;
|
|
14
|
+
optionalTag?: boolean;
|
|
15
|
+
requiredTag?: boolean;
|
|
16
|
+
tagText?: string;
|
|
17
|
+
labelPosition?: string;
|
|
18
|
+
hideLabel?: boolean;
|
|
19
|
+
isSwitch?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare const createCheckboxTest: (config?: CheckboxTestConfig) => Promise<{
|
|
22
|
+
container: HTMLElement;
|
|
23
|
+
checkbox: import('./checkbox').PktCheckbox;
|
|
24
|
+
}>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Ref } from 'lit/directives/ref.js';
|
|
2
|
+
import { PktInputElement } from '../../base-elements/input-element';
|
|
3
|
+
import { IPktComboboxOption, TPktComboboxTagPlacement } from './combobox-types';
|
|
4
|
+
import { default as PktListbox } from '../listbox';
|
|
5
|
+
/**
|
|
6
|
+
* Base class for PktCombobox.
|
|
7
|
+
* Declares all reactive properties, state, refs, and simple helpers.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ComboboxBase extends PktInputElement {
|
|
10
|
+
constructor();
|
|
11
|
+
value: string | string[];
|
|
12
|
+
options: IPktComboboxOption[];
|
|
13
|
+
defaultOptions: IPktComboboxOption[];
|
|
14
|
+
allowUserInput: boolean;
|
|
15
|
+
typeahead: boolean;
|
|
16
|
+
includeSearch: boolean;
|
|
17
|
+
searchPlaceholder: string;
|
|
18
|
+
multiple: boolean;
|
|
19
|
+
maxlength: number | null;
|
|
20
|
+
displayValueAs: string;
|
|
21
|
+
tagPlacement: TPktComboboxTagPlacement | null;
|
|
22
|
+
isOpen: boolean;
|
|
23
|
+
_options: IPktComboboxOption[];
|
|
24
|
+
protected _value: string[];
|
|
25
|
+
protected _isOptionsOpen: boolean;
|
|
26
|
+
protected _userInfoMessage: string;
|
|
27
|
+
protected _addValueText: string | null;
|
|
28
|
+
protected _maxIsReached: boolean;
|
|
29
|
+
protected _search: string;
|
|
30
|
+
protected _inputFocus: boolean;
|
|
31
|
+
protected _internalValueSync: boolean;
|
|
32
|
+
protected _optionsFromSlot: boolean;
|
|
33
|
+
protected _lastSlotGeneration: number;
|
|
34
|
+
/** When true, the next handleFocus call will not reopen the dropdown. */
|
|
35
|
+
protected _suppressNextOpen: boolean;
|
|
36
|
+
protected readonly inputRef: Ref<HTMLInputElement>;
|
|
37
|
+
protected readonly triggerRef: Ref<HTMLDivElement>;
|
|
38
|
+
protected readonly listboxRef: Ref<PktListbox>;
|
|
39
|
+
protected get _hasTextInput(): boolean;
|
|
40
|
+
protected get _selectionDescription(): string | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Focuses the appropriate trigger element after closing the listbox.
|
|
43
|
+
* Select-only: the combobox input div. Editable: the text input.
|
|
44
|
+
*/
|
|
45
|
+
protected focusTrigger(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Parses the value prop into an internal string array.
|
|
48
|
+
*/
|
|
49
|
+
protected parseValue(): string[];
|
|
50
|
+
/**
|
|
51
|
+
* Updates the _maxIsReached state flag.
|
|
52
|
+
*/
|
|
53
|
+
protected updateMaxReached(): void;
|
|
54
|
+
/**
|
|
55
|
+
* Syncs the public value property from internal _value state and dispatches
|
|
56
|
+
* events if the value content changed. Always sets this.value as a string
|
|
57
|
+
* to prevent array→string reflect cascades.
|
|
58
|
+
*/
|
|
59
|
+
protected syncValueAndDispatch(oldInternal: string[]): void;
|
|
60
|
+
/**
|
|
61
|
+
* Override onChange to skip the base class touched guard.
|
|
62
|
+
* The base class returns early on the first call (setting touched = true but not
|
|
63
|
+
* dispatching events). Combobox needs consistent event dispatch regardless of
|
|
64
|
+
* touched state.
|
|
65
|
+
*/
|
|
66
|
+
protected onChange(value: string | string[]): void;
|
|
67
|
+
/**
|
|
68
|
+
* No-op override of the base class valueChanged.
|
|
69
|
+
* The base class version sets both this.value AND this._value, which creates
|
|
70
|
+
* an infinite _value → valueChanged → value → parseValue → _value loop.
|
|
71
|
+
* Combobox handles value sync and event dispatch in syncValueAndDispatch() instead.
|
|
72
|
+
*/
|
|
73
|
+
protected valueChanged(): void;
|
|
74
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ComboboxValue } from './combobox-value';
|
|
2
|
+
/**
|
|
3
|
+
* Event handler layer for PktCombobox.
|
|
4
|
+
* Handles user interactions: input, focus, keyboard, clicks, tags.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ComboboxHandlers extends ComboboxValue {
|
|
7
|
+
protected handleInput(e: InputEvent): void;
|
|
8
|
+
protected handleFocus(): void;
|
|
9
|
+
protected handleFocusOut(e: FocusEvent): void;
|
|
10
|
+
/**
|
|
11
|
+
* Shared close logic used by both focusout and outside-click handlers.
|
|
12
|
+
* Processes any pending input value, then closes the dropdown.
|
|
13
|
+
*/
|
|
14
|
+
protected closeAndProcessInput(): void;
|
|
15
|
+
protected handleBlur(): void;
|
|
16
|
+
protected handleInputClick(e: MouseEvent): void;
|
|
17
|
+
protected handlePlaceholderClick(e: MouseEvent): void;
|
|
18
|
+
protected handleSelectOnlyKeydown(e: KeyboardEvent): void;
|
|
19
|
+
protected handleOptionToggled(e: CustomEvent): void;
|
|
20
|
+
protected handleSearch(e: CustomEvent): void;
|
|
21
|
+
protected handleInputKeydown(e: KeyboardEvent): void;
|
|
22
|
+
protected handleTagRemove(value: string | null): void;
|
|
23
|
+
protected getInsideTags(): HTMLElement[];
|
|
24
|
+
protected focusTag(index: number): void;
|
|
25
|
+
protected resetTagTabindices(): void;
|
|
26
|
+
protected handleTagKeydown(e: KeyboardEvent, index: number): void;
|
|
27
|
+
protected checkForMatches(): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for the combobox component family.
|
|
3
|
+
* Re-exports from shared-types for backward compatibility.
|
|
4
|
+
*/
|
|
5
|
+
export type { IPktComboboxOption, TPktComboboxTagSkin, TPktComboboxDisplayValue, TPktComboboxTagPlacement, } from '../../shared-types/combobox';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { IPktComboboxOption } from '../../shared-types/combobox';
|
|
2
|
+
/**
|
|
3
|
+
* Lit-specific utility functions for PktCombobox component.
|
|
4
|
+
*
|
|
5
|
+
* Framework-agnostic functions live in shared-utils/combobox/.
|
|
6
|
+
* Only Lit-specific functions (using Ref, in-place mutation) stay here.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* In-place option mutation helpers that preserve referential identity
|
|
10
|
+
* between this._options and this.options in the Lit component.
|
|
11
|
+
*/
|
|
12
|
+
export declare const selectionMutators: {
|
|
13
|
+
markOptionSelected(options: IPktComboboxOption[], value: string | null): void;
|
|
14
|
+
markOptionDeselected(options: IPktComboboxOption[], value: string | null): void;
|
|
15
|
+
markAllSelected(options: IPktComboboxOption[]): void;
|
|
16
|
+
markAllDeselected(options: IPktComboboxOption[]): void;
|
|
17
|
+
removeUserAddedOptions(options: IPktComboboxOption[]): IPktComboboxOption[];
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Parses option elements from slot controller nodes into IPktComboboxOption[].
|
|
21
|
+
*/
|
|
22
|
+
export declare const slotUtils: {
|
|
23
|
+
parseOptionsFromSlot(nodes: Element[]): IPktComboboxOption[];
|
|
24
|
+
};
|
|
25
|
+
export declare const optionStateUtils: {
|
|
26
|
+
/**
|
|
27
|
+
* Ensures options have labels and fulltext set.
|
|
28
|
+
* Also syncs selected state with current values.
|
|
29
|
+
*
|
|
30
|
+
* IMPORTANT: Mutates options in place to preserve referential identity
|
|
31
|
+
* between this._options and this.options in the Lit component.
|
|
32
|
+
*/
|
|
33
|
+
syncOptionsWithValues(options: IPktComboboxOption[], values: string[]): {
|
|
34
|
+
options: IPktComboboxOption[];
|
|
35
|
+
newValues: string[];
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Merges user-added options with new options, preserving user additions.
|
|
39
|
+
*/
|
|
40
|
+
mergeWithUserAdded(newOptions: IPktComboboxOption[], previousOptions: IPktComboboxOption[]): IPktComboboxOption[];
|
|
41
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ComboboxBase } from './combobox-base';
|
|
2
|
+
/**
|
|
3
|
+
* Value management layer for PktCombobox.
|
|
4
|
+
* Handles selection, deselection, user-added values, and input reset.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ComboboxValue extends ComboboxBase {
|
|
7
|
+
toggleValue(value: string | null): void;
|
|
8
|
+
protected setSelected(value: string | null): void;
|
|
9
|
+
protected removeSelected(value: string | null): void;
|
|
10
|
+
protected addAllOptions(): void;
|
|
11
|
+
protected removeAllSelected(): void;
|
|
12
|
+
protected addValue(): void;
|
|
13
|
+
protected removeValue(value: string | null): void;
|
|
14
|
+
protected addNewUserValue(value: string | null): void;
|
|
15
|
+
protected resetComboboxInput(shouldResetInput?: boolean): void;
|
|
16
|
+
protected removeLastValue(e: Event): void;
|
|
17
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { PropertyValues } from 'lit';
|
|
2
|
+
import { IPktComboboxOption, TPktComboboxTagPlacement } from './combobox-types';
|
|
3
|
+
import { ComboboxHandlers } from './combobox-handlers';
|
|
4
|
+
export type { IPktComboboxOption, TPktComboboxTagPlacement } from './combobox-types';
|
|
5
|
+
export interface IPktCombobox {
|
|
6
|
+
allowUserInput?: boolean;
|
|
7
|
+
typeahead?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
displayValueAs?: string;
|
|
10
|
+
errorMessage?: string;
|
|
11
|
+
fullwidth?: boolean;
|
|
12
|
+
hasError?: boolean;
|
|
13
|
+
helptext?: string | null;
|
|
14
|
+
helptextDropdown?: string | null;
|
|
15
|
+
helptextDropdownButton?: string | null;
|
|
16
|
+
id?: string;
|
|
17
|
+
includeSearch?: boolean;
|
|
18
|
+
label?: string | null;
|
|
19
|
+
maxlength?: number | null;
|
|
20
|
+
minlength?: number | null;
|
|
21
|
+
multiple?: boolean;
|
|
22
|
+
name?: string;
|
|
23
|
+
optionalTag?: boolean;
|
|
24
|
+
optionalText?: string;
|
|
25
|
+
options?: IPktComboboxOption[];
|
|
26
|
+
defaultOptions?: IPktComboboxOption[];
|
|
27
|
+
placeholder?: string | null;
|
|
28
|
+
requiredTag?: boolean;
|
|
29
|
+
requiredText?: string;
|
|
30
|
+
searchPlaceholder?: string;
|
|
31
|
+
tagPlacement?: TPktComboboxTagPlacement | null;
|
|
32
|
+
tagText?: string | null;
|
|
33
|
+
value?: string | string[];
|
|
34
|
+
isOpen?: boolean;
|
|
35
|
+
}
|
|
36
|
+
declare global {
|
|
37
|
+
interface HTMLElementTagNameMap {
|
|
38
|
+
'pkt-combobox': PktCombobox & HTMLSelectElement;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export declare class PktCombobox extends ComboboxHandlers implements IPktCombobox {
|
|
42
|
+
private handleBodyClick;
|
|
43
|
+
connectedCallback(): void;
|
|
44
|
+
protected willUpdate(changedProperties: Map<PropertyKey, unknown>): void;
|
|
45
|
+
disconnectedCallback(): void;
|
|
46
|
+
firstUpdated(changedProperties: PropertyValues): void;
|
|
47
|
+
updated(changedProperties: PropertyValues): void;
|
|
48
|
+
/**
|
|
49
|
+
* Override form reset to properly restore combobox state.
|
|
50
|
+
* The base class deselects all options and sets value/defaultValue, but
|
|
51
|
+
* combobox needs to re-sync _options with the restored values and clean up
|
|
52
|
+
* user-added options and UI state.
|
|
53
|
+
*/
|
|
54
|
+
protected formResetCallback(): void;
|
|
55
|
+
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
56
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
57
|
+
private renderInputField;
|
|
58
|
+
private renderSingleOrMultipleValues;
|
|
59
|
+
private renderValueTag;
|
|
60
|
+
}
|
|
61
|
+
export default PktCombobox;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { PropertyValues } from 'lit';
|
|
2
|
+
import { PktElement } from '../../base-elements/element';
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
cookieBanner_devMode?: boolean;
|
|
6
|
+
cookieBanner_cookieDomain?: string | null;
|
|
7
|
+
cookieBanner_cookieSecure?: string | null;
|
|
8
|
+
cookieBanner_cookieExpiryDays?: string | null;
|
|
9
|
+
cookieBanner_googleAnalyticsId?: string | null;
|
|
10
|
+
cookieBanner_hotjarId?: string | null;
|
|
11
|
+
cookieBanner?: any;
|
|
12
|
+
__cookieEvents?: any;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export interface IPktConsent {
|
|
16
|
+
devMode?: boolean;
|
|
17
|
+
cookieDomain?: string | null;
|
|
18
|
+
cookieSecure?: string | null;
|
|
19
|
+
cookieExpiryDays?: string | null;
|
|
20
|
+
hotjarId?: string | null;
|
|
21
|
+
googleAnalyticsId?: string | null;
|
|
22
|
+
i18nLanguage?: string;
|
|
23
|
+
triggerType?: 'button' | 'link' | 'footerlink' | 'icon' | null;
|
|
24
|
+
triggerText?: string | null;
|
|
25
|
+
}
|
|
26
|
+
export declare class PktConsent extends PktElement<IPktConsent> implements IPktConsent {
|
|
27
|
+
private _cookieEventHandler?;
|
|
28
|
+
devMode: boolean;
|
|
29
|
+
hotjarId: string | null;
|
|
30
|
+
googleAnalyticsId: string | null;
|
|
31
|
+
cookieDomain: string | null;
|
|
32
|
+
cookieSecure: string | null;
|
|
33
|
+
cookieExpiryDays: string | null;
|
|
34
|
+
triggerType: 'button' | 'link' | 'footerlink' | 'icon' | null;
|
|
35
|
+
triggerText: string | null;
|
|
36
|
+
i18nLanguage: string;
|
|
37
|
+
constructor();
|
|
38
|
+
connectedCallback(): void;
|
|
39
|
+
disconnectedCallback(): void;
|
|
40
|
+
returnJsonOrObject(obj: any): any;
|
|
41
|
+
emitCookieConsents(consent: any): void;
|
|
42
|
+
protected firstUpdated(_changedProperties: PropertyValues): Promise<void>;
|
|
43
|
+
triggerInit(): void;
|
|
44
|
+
openModal(e: Event): void;
|
|
45
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
46
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseTestConfig } from '../../tests/test-framework';
|
|
2
|
+
export interface ConsentTestConfig extends BaseTestConfig {
|
|
3
|
+
devMode?: boolean;
|
|
4
|
+
googleAnalyticsId?: string;
|
|
5
|
+
hotjarId?: string;
|
|
6
|
+
cookieDomain?: string;
|
|
7
|
+
cookieSecure?: string;
|
|
8
|
+
cookieExpiryDays?: string;
|
|
9
|
+
triggerType?: string;
|
|
10
|
+
triggerText?: string;
|
|
11
|
+
i18nLanguage?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const createConsentTest: (config?: ConsentTestConfig) => Promise<{
|
|
14
|
+
container: HTMLElement;
|
|
15
|
+
consent: import('./consent').PktConsent;
|
|
16
|
+
}>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export declare const consentStrings: {
|
|
2
|
+
i18n: {
|
|
3
|
+
nb: {
|
|
4
|
+
contentPresentation: {
|
|
5
|
+
title: string;
|
|
6
|
+
description: string[];
|
|
7
|
+
buttons: {
|
|
8
|
+
accept: string;
|
|
9
|
+
reject: string;
|
|
10
|
+
settings: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
contentSettings: {
|
|
14
|
+
title: string;
|
|
15
|
+
description: string[];
|
|
16
|
+
buttons: {
|
|
17
|
+
back: string;
|
|
18
|
+
save: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
en: {
|
|
23
|
+
contentPresentation: {
|
|
24
|
+
title: string;
|
|
25
|
+
description: string[];
|
|
26
|
+
buttons: {
|
|
27
|
+
accept: string;
|
|
28
|
+
reject: string;
|
|
29
|
+
settings: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
contentSettings: {
|
|
33
|
+
title: string;
|
|
34
|
+
description: string[];
|
|
35
|
+
buttons: {
|
|
36
|
+
back: string;
|
|
37
|
+
save: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
cookies: ({
|
|
43
|
+
name: string;
|
|
44
|
+
defaultValue: null;
|
|
45
|
+
i18n: {
|
|
46
|
+
nb: {
|
|
47
|
+
title: string;
|
|
48
|
+
description: string;
|
|
49
|
+
buttons: {
|
|
50
|
+
yes: string;
|
|
51
|
+
no: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
en: {
|
|
55
|
+
title: string;
|
|
56
|
+
description: string;
|
|
57
|
+
buttons: {
|
|
58
|
+
yes: string;
|
|
59
|
+
no: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
} | {
|
|
64
|
+
name: string;
|
|
65
|
+
defaultValue: boolean;
|
|
66
|
+
i18n: {
|
|
67
|
+
nb: {
|
|
68
|
+
title: string;
|
|
69
|
+
description: string;
|
|
70
|
+
buttons: {
|
|
71
|
+
yes: string;
|
|
72
|
+
no: string;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
en: {
|
|
76
|
+
title: string;
|
|
77
|
+
description: string;
|
|
78
|
+
buttons: {
|
|
79
|
+
yes: string;
|
|
80
|
+
no: string;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
})[];
|
|
85
|
+
};
|