@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,48 @@
|
|
|
1
|
+
import { PropertyValues } from 'lit';
|
|
2
|
+
import { Ref } from 'lit/directives/ref.js';
|
|
3
|
+
import { PktOptionsInputElement } from '../../base-elements/options-input-element';
|
|
4
|
+
export type TSelectOption = {
|
|
5
|
+
value: string;
|
|
6
|
+
label: string;
|
|
7
|
+
selected?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
hidden?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export interface IPktSelect {
|
|
12
|
+
options: TSelectOption[];
|
|
13
|
+
value: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Pkt Select is a wrapper for the native select element using the pkt-input-wrapper component.
|
|
17
|
+
*
|
|
18
|
+
* The component will prioritize options passed as a prop over options passed as children if both are provided.
|
|
19
|
+
* This is to allow for dynamic options that might change in the case of both children/slot and props are provided.
|
|
20
|
+
*
|
|
21
|
+
* @slot (default) - Options to be rendered as children
|
|
22
|
+
* @prop {TSelectOption[]} options - Options to be rendered as children
|
|
23
|
+
*
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
declare global {
|
|
27
|
+
interface HTMLElementTagNameMap {
|
|
28
|
+
'pkt-select': PktSelect & HTMLSelectElement;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export declare class PktSelect extends PktOptionsInputElement<{}, TSelectOption> implements IPktSelect {
|
|
32
|
+
inputRef: Ref<HTMLSelectElement>;
|
|
33
|
+
value: string;
|
|
34
|
+
selectedIndex: number | null;
|
|
35
|
+
selectedOptions: HTMLCollectionOf<HTMLOptionElement> | undefined;
|
|
36
|
+
constructor();
|
|
37
|
+
connectedCallback(): void;
|
|
38
|
+
add(item: HTMLOptionElement, before?: HTMLOptionElement | number): void;
|
|
39
|
+
remove(item?: number): void;
|
|
40
|
+
item(index: number): HTMLOptionElement | null | undefined;
|
|
41
|
+
namedItem(name: string): HTMLOptionElement | null | undefined;
|
|
42
|
+
showPicker(): void;
|
|
43
|
+
attributeChangedCallback(name: string, _old: string, value: string): void;
|
|
44
|
+
update(changedProperties: PropertyValues): void;
|
|
45
|
+
protected firstUpdated(_changedProperties: PropertyValues): void;
|
|
46
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
47
|
+
private returnNumberOrNull;
|
|
48
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseTestConfig } from '../../tests/test-framework';
|
|
2
|
+
import { IPktSelect } from './select';
|
|
3
|
+
export interface SelectTestConfig extends Partial<IPktSelect>, BaseTestConfig {
|
|
4
|
+
id?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
hasError?: boolean;
|
|
9
|
+
errorMessage?: string;
|
|
10
|
+
helptext?: string;
|
|
11
|
+
fullwidth?: boolean;
|
|
12
|
+
ariaLabelledby?: string | null;
|
|
13
|
+
ariaDescribedBy?: string | null;
|
|
14
|
+
counter?: boolean;
|
|
15
|
+
inline?: boolean;
|
|
16
|
+
useWrapper?: boolean | string;
|
|
17
|
+
}
|
|
18
|
+
export declare const createSelectTest: (config?: SelectTestConfig) => Promise<{
|
|
19
|
+
container: HTMLElement;
|
|
20
|
+
select: import('./select').PktSelect;
|
|
21
|
+
}>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { PktElementWithSlot } from '../../base-elements/element-with-slot';
|
|
2
|
+
import { Ref } from 'lit/directives/ref.js';
|
|
3
|
+
import { TabsContext } from './tabs-context';
|
|
4
|
+
export type TSkin = 'blue' | 'green' | 'red' | 'beige' | 'yellow' | 'grey' | 'gray' | 'blue-light';
|
|
5
|
+
export interface IPktTabItem {
|
|
6
|
+
active?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
href?: string;
|
|
9
|
+
icon?: string;
|
|
10
|
+
controls?: string;
|
|
11
|
+
tag?: string;
|
|
12
|
+
tagSkin?: TSkin;
|
|
13
|
+
index?: number;
|
|
14
|
+
}
|
|
15
|
+
export declare class PktTabItem extends PktElementWithSlot<IPktTabItem> implements IPktTabItem {
|
|
16
|
+
active: boolean;
|
|
17
|
+
disabled: boolean;
|
|
18
|
+
href: string;
|
|
19
|
+
icon: string;
|
|
20
|
+
controls: string;
|
|
21
|
+
tag: string;
|
|
22
|
+
tagSkin: TSkin;
|
|
23
|
+
index: number;
|
|
24
|
+
context?: TabsContext;
|
|
25
|
+
elementRef: Ref<HTMLAnchorElement | HTMLButtonElement>;
|
|
26
|
+
constructor();
|
|
27
|
+
connectedCallback(): void;
|
|
28
|
+
updated(): void;
|
|
29
|
+
private handleClick;
|
|
30
|
+
private handleKeyDown;
|
|
31
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
32
|
+
}
|
|
33
|
+
export default PktTabItem;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface TabsContext {
|
|
2
|
+
/**
|
|
3
|
+
* Whether arrow navigation is enabled (computed from arrowNav && !disableArrowNav)
|
|
4
|
+
*/
|
|
5
|
+
useArrowNav: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Register a tab item with the parent tabs container
|
|
8
|
+
*/
|
|
9
|
+
registerTab: (element: HTMLElement, index: number, disabled?: boolean) => void;
|
|
10
|
+
/**
|
|
11
|
+
* Handle click event from a tab item
|
|
12
|
+
*/
|
|
13
|
+
handleClick: (index: number) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Handle keyboard event from a tab item
|
|
16
|
+
*/
|
|
17
|
+
handleKeyUp: (event: KeyboardEvent, index: number) => void;
|
|
18
|
+
}
|
|
19
|
+
export declare const tabsContext: {
|
|
20
|
+
__context__: TabsContext;
|
|
21
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { PktElementWithSlot } from '../../base-elements/element-with-slot';
|
|
2
|
+
import { PropertyValues } from 'lit';
|
|
3
|
+
export interface IPktTabs {
|
|
4
|
+
arrowNav?: boolean;
|
|
5
|
+
disableArrowNav?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare class PktTabs extends PktElementWithSlot<IPktTabs> implements IPktTabs {
|
|
8
|
+
arrowNav: boolean;
|
|
9
|
+
disableArrowNav: boolean;
|
|
10
|
+
private tabRefs;
|
|
11
|
+
private disabledMap;
|
|
12
|
+
private tabCount;
|
|
13
|
+
private get useArrowNav();
|
|
14
|
+
private context;
|
|
15
|
+
updated(changedProperties: PropertyValues): void;
|
|
16
|
+
private registerTab;
|
|
17
|
+
private isTabDisabled;
|
|
18
|
+
private findEnabledIndex;
|
|
19
|
+
private handleClick;
|
|
20
|
+
private handleKeyUp;
|
|
21
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
22
|
+
}
|
|
23
|
+
export default PktTabs;
|
|
File without changes
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { PropertyValues } from 'lit';
|
|
2
|
+
import { PktElementWithSlot } from '../../base-elements/element-with-slot';
|
|
3
|
+
import { TPktSize } from '../../types/size';
|
|
4
|
+
import { IAriaAttributes, THTMLButtonType } from '../../shared-types';
|
|
5
|
+
import { PktIconName } from '@oslokommune/punkt-assets/dist/icons/icon';
|
|
6
|
+
export type TTagSkin = 'blue' | 'blue-dark' | 'blue-light' | 'green' | 'red' | 'yellow' | 'beige' | 'gray' | 'grey';
|
|
7
|
+
export type TTagType = THTMLButtonType;
|
|
8
|
+
export interface IPktTag {
|
|
9
|
+
closeTag?: boolean;
|
|
10
|
+
size?: TPktSize;
|
|
11
|
+
skin?: TTagSkin;
|
|
12
|
+
textStyle?: string | null;
|
|
13
|
+
iconName?: PktIconName;
|
|
14
|
+
type?: TTagType;
|
|
15
|
+
ariaLabel?: IAriaAttributes['aria-label'] | null;
|
|
16
|
+
}
|
|
17
|
+
export declare class PktTag extends PktElementWithSlot<IPktTag> implements IPktTag {
|
|
18
|
+
constructor();
|
|
19
|
+
/**
|
|
20
|
+
* Element attributes
|
|
21
|
+
*/
|
|
22
|
+
closeTag: boolean;
|
|
23
|
+
size: TPktSize;
|
|
24
|
+
skin: TTagSkin;
|
|
25
|
+
textStyle: string | null;
|
|
26
|
+
iconName: string | undefined;
|
|
27
|
+
type: TTagType;
|
|
28
|
+
ariaLabel: string | null;
|
|
29
|
+
buttonTabindex: number | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Element state
|
|
32
|
+
*/
|
|
33
|
+
_isClosed: boolean;
|
|
34
|
+
_ariaDescription: string | null;
|
|
35
|
+
/**
|
|
36
|
+
* Lifecycle
|
|
37
|
+
*/
|
|
38
|
+
protected firstUpdated(_changedProperties: PropertyValues): void;
|
|
39
|
+
/**
|
|
40
|
+
* Element functions
|
|
41
|
+
*/
|
|
42
|
+
private close;
|
|
43
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
44
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseTestConfig } from '../../tests/test-framework';
|
|
2
|
+
import { IPktTag } from './tag';
|
|
3
|
+
export interface TagTestConfig extends Partial<IPktTag>, BaseTestConfig {
|
|
4
|
+
}
|
|
5
|
+
export declare const createTagTest: (config?: TagTestConfig) => Promise<{
|
|
6
|
+
container: HTMLElement;
|
|
7
|
+
tag: import('./tag').PktTag;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PropertyValues } from 'lit';
|
|
2
|
+
import { Ref } from 'lit/directives/ref.js';
|
|
3
|
+
import { PktInputElement } from '../../base-elements/input-element';
|
|
4
|
+
import { ElementProps } from '../../types/typeUtils';
|
|
5
|
+
type Props = ElementProps<PktTextarea, 'autocomplete' | 'rows'>;
|
|
6
|
+
export declare class PktTextarea extends PktInputElement<Props> {
|
|
7
|
+
inputRef: Ref<HTMLTextAreaElement>;
|
|
8
|
+
value: string;
|
|
9
|
+
autocomplete: string;
|
|
10
|
+
rows: number | null;
|
|
11
|
+
counterCurrent: number;
|
|
12
|
+
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
13
|
+
updated(changedProperties: PropertyValues): void;
|
|
14
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BaseTestConfig } from '../../tests/test-framework';
|
|
2
|
+
export interface TextareaTestConfig extends BaseTestConfig {
|
|
3
|
+
value?: string;
|
|
4
|
+
autocomplete?: string;
|
|
5
|
+
rows?: number | null;
|
|
6
|
+
id?: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
readonly?: boolean;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
placeholder?: string | null;
|
|
13
|
+
maxlength?: number | null;
|
|
14
|
+
minlength?: number | null;
|
|
15
|
+
hasError?: boolean;
|
|
16
|
+
errorMessage?: string;
|
|
17
|
+
helptext?: string;
|
|
18
|
+
fullwidth?: boolean;
|
|
19
|
+
counter?: boolean;
|
|
20
|
+
inline?: boolean;
|
|
21
|
+
ariaLabelledby?: string | null;
|
|
22
|
+
ariaDescribedBy?: string | null;
|
|
23
|
+
}
|
|
24
|
+
export declare const createTextareaTest: (config?: TextareaTestConfig) => Promise<{
|
|
25
|
+
container: HTMLElement;
|
|
26
|
+
textarea: import('./textarea').PktTextarea;
|
|
27
|
+
}>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PropertyValues } from 'lit';
|
|
2
|
+
import { Ref } from 'lit/directives/ref.js';
|
|
3
|
+
import { ElementProps } from '../../types/typeUtils';
|
|
4
|
+
import { PktInputElement } from '../../base-elements/input-element';
|
|
5
|
+
type Props = ElementProps<PktTextinput, 'value' | 'type' | 'size' | 'autocomplete' | 'iconNameRight' | 'prefix' | 'suffix' | 'omitSearchIcon'>;
|
|
6
|
+
export declare class PktTextinput extends PktInputElement<Props> {
|
|
7
|
+
inputRef: Ref<HTMLTextAreaElement>;
|
|
8
|
+
value: string;
|
|
9
|
+
type: string;
|
|
10
|
+
size: number | null;
|
|
11
|
+
autocomplete: string | null;
|
|
12
|
+
iconNameRight: string | null;
|
|
13
|
+
prefix: string | null;
|
|
14
|
+
suffix: string | null;
|
|
15
|
+
omitSearchIcon: boolean;
|
|
16
|
+
counterCurrent: number;
|
|
17
|
+
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
18
|
+
updated(changedProperties: PropertyValues): void;
|
|
19
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BaseTestConfig } from '../../tests/test-framework';
|
|
2
|
+
export interface TextinputTestConfig extends BaseTestConfig {
|
|
3
|
+
type?: string;
|
|
4
|
+
value?: string;
|
|
5
|
+
autocomplete?: string | null;
|
|
6
|
+
iconNameRight?: string | null;
|
|
7
|
+
prefix?: string | null;
|
|
8
|
+
suffix?: string | null;
|
|
9
|
+
size?: number | null;
|
|
10
|
+
omitSearchIcon?: boolean;
|
|
11
|
+
id?: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
readonly?: boolean;
|
|
16
|
+
required?: boolean;
|
|
17
|
+
placeholder?: string | null;
|
|
18
|
+
maxlength?: number | null;
|
|
19
|
+
minlength?: number | null;
|
|
20
|
+
hasError?: boolean;
|
|
21
|
+
errorMessage?: string;
|
|
22
|
+
helptext?: string;
|
|
23
|
+
fullwidth?: boolean;
|
|
24
|
+
counter?: boolean;
|
|
25
|
+
inline?: boolean;
|
|
26
|
+
ariaLabelledby?: string | null;
|
|
27
|
+
ariaDescribedBy?: string | null;
|
|
28
|
+
}
|
|
29
|
+
export declare const createTextinputTest: (config?: TextinputTestConfig) => Promise<{
|
|
30
|
+
container: HTMLElement;
|
|
31
|
+
textinput: import('./textinput').PktTextinput;
|
|
32
|
+
}>;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { PropertyValues } from 'lit';
|
|
2
|
+
import { Ref } from 'lit/directives/ref.js';
|
|
3
|
+
import { PktInputElement } from '../../base-elements/input-element';
|
|
4
|
+
import { ElementProps } from '../../types/typeUtils';
|
|
5
|
+
type Props = ElementProps<PktTimepicker, 'value' | 'hidePicker' | 'stepArrows'>;
|
|
6
|
+
export interface IPktTimepicker {
|
|
7
|
+
value?: string;
|
|
8
|
+
min?: string;
|
|
9
|
+
max?: string;
|
|
10
|
+
step?: number;
|
|
11
|
+
name?: string;
|
|
12
|
+
id?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
hidePicker?: boolean;
|
|
16
|
+
stepArrows?: boolean;
|
|
17
|
+
fullwidth?: boolean;
|
|
18
|
+
label?: string | null;
|
|
19
|
+
helptext?: string;
|
|
20
|
+
helptextDropdown?: string;
|
|
21
|
+
helptextDropdownButton?: string | null;
|
|
22
|
+
hasError?: boolean;
|
|
23
|
+
errorMessage?: string;
|
|
24
|
+
requiredTag?: boolean;
|
|
25
|
+
requiredText?: string;
|
|
26
|
+
optionalTag?: boolean;
|
|
27
|
+
optionalText?: string;
|
|
28
|
+
tagText?: string | null;
|
|
29
|
+
inline?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare class PktTimepicker extends PktInputElement<Props> {
|
|
32
|
+
hiddenInputRef: Ref<HTMLInputElement>;
|
|
33
|
+
hoursInputRef: Ref<HTMLInputElement>;
|
|
34
|
+
minutesInputRef: Ref<HTMLInputElement>;
|
|
35
|
+
buttonRef: Ref<HTMLButtonElement>;
|
|
36
|
+
/**
|
|
37
|
+
* Exposes hiddenInputRef as inputRef so the base class validate() method
|
|
38
|
+
* triggers our manageValidity override automatically after every onChange call.
|
|
39
|
+
* The hidden input itself is never used for reporting — see manageValidity below.
|
|
40
|
+
*/
|
|
41
|
+
get inputRef(): Ref<HTMLInputElement>;
|
|
42
|
+
/**
|
|
43
|
+
* Overrides the base class manageValidity to solve a focusability problem:
|
|
44
|
+
* the browser requires the third argument to setValidity (the "anchor") to be
|
|
45
|
+
* a visible, focusable element — it focuses that element when navigating to an
|
|
46
|
+
* invalid field. Our hidden input[type=time] cannot receive focus, so passing it
|
|
47
|
+
* as the anchor would silently fail with "form control is not focusable".
|
|
48
|
+
*/
|
|
49
|
+
protected manageValidity(_input?: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement): void;
|
|
50
|
+
value: string;
|
|
51
|
+
hidePicker: boolean;
|
|
52
|
+
stepArrows: boolean;
|
|
53
|
+
private _hours;
|
|
54
|
+
private _minutes;
|
|
55
|
+
private _isOpen;
|
|
56
|
+
private _hoursDigitCount;
|
|
57
|
+
private _hoursFirstDigit;
|
|
58
|
+
private _minutesDigitCount;
|
|
59
|
+
private _minutesFirstDigit;
|
|
60
|
+
private _hasFocus;
|
|
61
|
+
private _setAriaInvalid;
|
|
62
|
+
private _outsideClickHandler;
|
|
63
|
+
private _handleComponentFocusIn;
|
|
64
|
+
private _handleComponentFocusOut;
|
|
65
|
+
connectedCallback(): void;
|
|
66
|
+
disconnectedCallback(): void;
|
|
67
|
+
protected willUpdate(changedProperties: PropertyValues): void;
|
|
68
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
69
|
+
protected formResetCallback(): void;
|
|
70
|
+
private _isValidStep;
|
|
71
|
+
private _syncDisplayFromValue;
|
|
72
|
+
private _syncValueFromDisplay;
|
|
73
|
+
private get _minuteStep();
|
|
74
|
+
private get _hourOptions();
|
|
75
|
+
private get _minuteOptions();
|
|
76
|
+
private _openPopup;
|
|
77
|
+
private _closePopup;
|
|
78
|
+
private _togglePopup;
|
|
79
|
+
private _scrollToSelected;
|
|
80
|
+
private _focusSelectedOrFirst;
|
|
81
|
+
private _handleHoursKeydown;
|
|
82
|
+
private _handleHoursBlur;
|
|
83
|
+
private _handleMinutesKeydown;
|
|
84
|
+
private _handleMinutesBlur;
|
|
85
|
+
private _handleOptionClick;
|
|
86
|
+
private _focusOptionAndSync;
|
|
87
|
+
private _handlePopupKeydown;
|
|
88
|
+
private _stepTime;
|
|
89
|
+
private _renderOption;
|
|
90
|
+
private _renderPopup;
|
|
91
|
+
private _renderContainer;
|
|
92
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
93
|
+
}
|
|
94
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BaseTestConfig } from '../../tests/test-framework';
|
|
2
|
+
export interface TimepickerTestConfig extends BaseTestConfig {
|
|
3
|
+
value?: string;
|
|
4
|
+
min?: string;
|
|
5
|
+
max?: string;
|
|
6
|
+
step?: number;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
required?: boolean;
|
|
9
|
+
label?: string;
|
|
10
|
+
'hide-picker'?: boolean;
|
|
11
|
+
'step-arrows'?: boolean;
|
|
12
|
+
fullwidth?: boolean;
|
|
13
|
+
hasError?: boolean;
|
|
14
|
+
errorMessage?: string;
|
|
15
|
+
helptext?: string;
|
|
16
|
+
id?: string;
|
|
17
|
+
name?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const createTimepickerTest: (config?: TimepickerTestConfig) => Promise<{
|
|
20
|
+
container: HTMLElement;
|
|
21
|
+
timepicker: import('./timepicker').PktTimepicker;
|
|
22
|
+
}>;
|
package/dist/consent.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LitElement, ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
type TOption = {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
selected?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare class PktOptionsSlotController implements ReactiveController {
|
|
9
|
+
host: LitElement & ReactiveControllerHost;
|
|
10
|
+
nodes: Element[];
|
|
11
|
+
options: TOption[];
|
|
12
|
+
generation: number;
|
|
13
|
+
observer: MutationObserver;
|
|
14
|
+
constructor(host: LitElement & ReactiveControllerHost);
|
|
15
|
+
hostConnected(): void;
|
|
16
|
+
hostDisconnected(): void;
|
|
17
|
+
private addNode;
|
|
18
|
+
private createOptions;
|
|
19
|
+
private handleMutations;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
package/dist/datepicker.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { AsyncDirective, PartInfo } from 'lit/async-directive.js';
|
|
3
|
+
import { ChildPart } from 'lit/directive.js';
|
|
4
|
+
/**
|
|
5
|
+
* Returns the SlotManager for a host, creating one if it doesn't exist.
|
|
6
|
+
* Call this in connectedCallback() to eagerly collect children before Lit renders.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getSlotManager(host: LitElement): SlotManager;
|
|
9
|
+
/**
|
|
10
|
+
* Per-host singleton that manages node collection and observation.
|
|
11
|
+
* Scans host children, categorizes them by slot attribute, and notifies
|
|
12
|
+
* registered directives when children change.
|
|
13
|
+
*
|
|
14
|
+
* IMPORTANT: collectNodes() must be called BEFORE Lit's first render
|
|
15
|
+
* (typically in connectedCallback via PktElement.hasSlotContent or getSlotManager).
|
|
16
|
+
* Lit's first render clears host children, so collecting during render is too late.
|
|
17
|
+
*/
|
|
18
|
+
export declare class SlotManager {
|
|
19
|
+
private host;
|
|
20
|
+
private observer;
|
|
21
|
+
private nodesBySlot;
|
|
22
|
+
private directives;
|
|
23
|
+
private observing;
|
|
24
|
+
private trackedNodes;
|
|
25
|
+
generation: number;
|
|
26
|
+
private initialCollectionDone;
|
|
27
|
+
private processingMutations;
|
|
28
|
+
private placeholderToNode;
|
|
29
|
+
private nodeToPlaceholder;
|
|
30
|
+
private static PLACEHOLDER_PREFIX;
|
|
31
|
+
constructor(host: LitElement);
|
|
32
|
+
/**
|
|
33
|
+
* Collect original children BEFORE Lit's first render.
|
|
34
|
+
* Must be called in connectedCallback or earlier.
|
|
35
|
+
* Safe to call multiple times — only the first call scans.
|
|
36
|
+
*/
|
|
37
|
+
collectNodes(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Register a directive instance and start observing for dynamic changes.
|
|
40
|
+
*/
|
|
41
|
+
addDirective(d: SlotContentDirective): void;
|
|
42
|
+
/**
|
|
43
|
+
* Unregister a directive instance. Stops observing if no directives remain.
|
|
44
|
+
*/
|
|
45
|
+
removeDirective(d: SlotContentDirective): void;
|
|
46
|
+
/**
|
|
47
|
+
* Returns nodes matching the given slot name.
|
|
48
|
+
*/
|
|
49
|
+
getNodes(slotName?: string): Node[];
|
|
50
|
+
/**
|
|
51
|
+
* Returns whether the given slot has any content.
|
|
52
|
+
*/
|
|
53
|
+
hasContent(slotName?: string): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Ensure a placeholder comment exists for a node that is about to be distributed.
|
|
56
|
+
* Called by the directive before Lit moves the node to the target position.
|
|
57
|
+
* The placeholder stays between Lit's ChildPart markers so that when the parent
|
|
58
|
+
* template conditionally removes the content, the MutationObserver can detect
|
|
59
|
+
* the placeholder removal and clean up the real node.
|
|
60
|
+
*/
|
|
61
|
+
ensurePlaceholder(node: Node): void;
|
|
62
|
+
/**
|
|
63
|
+
* Start MutationObserver for dynamic child changes.
|
|
64
|
+
* Deferred via setTimeout to avoid catching Lit's first render mutations.
|
|
65
|
+
*/
|
|
66
|
+
private startObserving;
|
|
67
|
+
private stopObserving;
|
|
68
|
+
/**
|
|
69
|
+
* Handle MutationObserver mutations incrementally.
|
|
70
|
+
* Only processes nodes that are NOT already part of Lit's rendered template.
|
|
71
|
+
*
|
|
72
|
+
* Uses a guard flag to prevent recursive handling: when notifyDirectives()
|
|
73
|
+
* causes setValue() to move nodes (e.g., from host into a ChildPart container),
|
|
74
|
+
* that move triggers another mutation which must be ignored.
|
|
75
|
+
*/
|
|
76
|
+
private handleMutations;
|
|
77
|
+
/**
|
|
78
|
+
* Determines if a node is user-provided content (not Lit's rendered template).
|
|
79
|
+
* Lit's rendered content includes comment markers and elements created by the template.
|
|
80
|
+
*/
|
|
81
|
+
private isUserContent;
|
|
82
|
+
private removeFromSlots;
|
|
83
|
+
private notifyDirectives;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* AsyncDirective that renders slot content at its position in a Lit template.
|
|
87
|
+
*
|
|
88
|
+
* Usage:
|
|
89
|
+
* html`<div>${slotContent(this)}</div>` // default slot
|
|
90
|
+
* html`<div>${slotContent(this, 'helptext')}</div>` // named slot
|
|
91
|
+
*/
|
|
92
|
+
declare class SlotContentDirective extends AsyncDirective {
|
|
93
|
+
private manager;
|
|
94
|
+
private slotName;
|
|
95
|
+
private lastGeneration;
|
|
96
|
+
constructor(partInfo: PartInfo);
|
|
97
|
+
render(_host: LitElement, _slotName?: string): unknown;
|
|
98
|
+
update(_part: ChildPart, [host, slotName]: [LitElement, string?]): unknown;
|
|
99
|
+
/**
|
|
100
|
+
* Called by SlotManager when child mutations are detected.
|
|
101
|
+
* Uses setValue() to push an async update to Lit.
|
|
102
|
+
*/
|
|
103
|
+
handleNodesChanged(): void;
|
|
104
|
+
/**
|
|
105
|
+
* Insert placeholders for nodes that are still direct children of the host.
|
|
106
|
+
* Must be called before Lit moves them to the target position.
|
|
107
|
+
*/
|
|
108
|
+
private ensurePlaceholders;
|
|
109
|
+
disconnected(): void;
|
|
110
|
+
reconnected(): void;
|
|
111
|
+
private getNodesOrNoChange;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Directive that distributes Light DOM children into Lit template positions,
|
|
115
|
+
* functioning like Shadow DOM slots but without a shadow root.
|
|
116
|
+
*
|
|
117
|
+
* @param host - The component instance (typically `this`)
|
|
118
|
+
* @param slotName - Optional slot name. Omit for the default slot.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* // Default slot
|
|
122
|
+
* html`<div class="content">${slotContent(this)}</div>`
|
|
123
|
+
*
|
|
124
|
+
* // Named slot
|
|
125
|
+
* html`<div class="help">${slotContent(this, 'helptext')}</div>`
|
|
126
|
+
*/
|
|
127
|
+
export declare const slotContent: (_host: LitElement, _slotName?: string | undefined) => import('lit-html/directive.js').DirectiveResult<typeof SlotContentDirective>;
|
|
128
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PktElement } from '../../base-elements/element';
|
|
2
|
+
export declare class Breadcrumbs extends PktElement {
|
|
3
|
+
private lastNavigated;
|
|
4
|
+
private breadcrumbs;
|
|
5
|
+
private shortBreadcrumbs;
|
|
6
|
+
private handleNavigate;
|
|
7
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
8
|
+
}
|