@odx/foundation 1.0.0-beta.83 → 1.0.0-beta.84
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/components/dropdown/dropdown.d.ts +1 -1
- package/dist/components/popover/popover-host.d.ts +3 -2
- package/dist/components/popover/popover-observer.d.ts +1 -2
- package/dist/components/select/select.d.ts +0 -1
- package/dist/components/tooltip/tooltip.d.ts +1 -1
- package/dist/components.js +32 -33
- package/package.json +1 -1
|
@@ -18,7 +18,7 @@ export declare class OdxDropdown extends PopoverHost {
|
|
|
18
18
|
get options(): PopoverPlacementOptions;
|
|
19
19
|
connectedCallback(): void;
|
|
20
20
|
mountPopover(referenceElement: HTMLElement | null): void;
|
|
21
|
-
unmountPopover(referenceElement: HTMLElement
|
|
21
|
+
unmountPopover(referenceElement: HTMLElement): void;
|
|
22
22
|
protected render(): TemplateResult;
|
|
23
23
|
protected willUpdate(props: PropertyValues<this>): void;
|
|
24
24
|
}
|
|
@@ -6,7 +6,8 @@ export declare abstract class PopoverHost extends PopoverHost_base {
|
|
|
6
6
|
#private;
|
|
7
7
|
static readonly styles: import('lit').CSSResult;
|
|
8
8
|
protected popoverElement: OdxPopover;
|
|
9
|
-
referenceElement: HTMLElement | null;
|
|
9
|
+
set referenceElement(value: HTMLElement | null);
|
|
10
|
+
get referenceElement(): HTMLElement | null;
|
|
10
11
|
anchor: string;
|
|
11
12
|
placement: Placement;
|
|
12
13
|
fpsLimit: number;
|
|
@@ -16,7 +17,7 @@ export declare abstract class PopoverHost extends PopoverHost_base {
|
|
|
16
17
|
disconnectedCallback(): void;
|
|
17
18
|
hasMountedPopover(element: HTMLElement): boolean;
|
|
18
19
|
mountPopover(referenceElement: HTMLElement | null): void;
|
|
19
|
-
unmountPopover(_referenceElement: HTMLElement
|
|
20
|
+
unmountPopover(_referenceElement: HTMLElement): void;
|
|
20
21
|
isPopoverOpen(): boolean;
|
|
21
22
|
showPopover(): Promise<void>;
|
|
22
23
|
hidePopover(): void;
|
|
@@ -2,11 +2,10 @@ import { PopoverHost } from './popover-host.js';
|
|
|
2
2
|
export declare class PopoverObserver {
|
|
3
3
|
#private;
|
|
4
4
|
readonly host: PopoverHost;
|
|
5
|
-
readonly root:
|
|
5
|
+
readonly root: Document;
|
|
6
6
|
constructor(host: PopoverHost);
|
|
7
7
|
hasMountedPopover(element: HTMLElement): boolean;
|
|
8
8
|
observe(): void;
|
|
9
9
|
disconnect(): void;
|
|
10
|
-
updateReferenceElements(): void;
|
|
11
10
|
}
|
|
12
11
|
//# sourceMappingURL=popover-observer.d.ts.map
|
|
@@ -10,7 +10,6 @@ declare global {
|
|
|
10
10
|
export declare class OdxSelect extends ListboxFormControl<OptionControl> {
|
|
11
11
|
#private;
|
|
12
12
|
protected options: OdxOption[];
|
|
13
|
-
protected readonly trigger: HTMLElement;
|
|
14
13
|
protected readonly dropdown: OdxDropdown;
|
|
15
14
|
maxVisibleSelectedOptions: number;
|
|
16
15
|
constructor();
|
|
@@ -29,7 +29,7 @@ export declare class OdxTooltip extends PopoverHost {
|
|
|
29
29
|
connectedCallback(): void;
|
|
30
30
|
onPopoverShow(): void;
|
|
31
31
|
onBeforePopoverHide(): void;
|
|
32
|
-
mountPopover(referenceElement: HTMLElement
|
|
32
|
+
mountPopover(referenceElement: HTMLElement): void;
|
|
33
33
|
unmountPopover(referenceElement: HTMLElement): void;
|
|
34
34
|
protected render(): TemplateResult;
|
|
35
35
|
protected willUpdate(props: PropertyValues<this>): void;
|
package/dist/components.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _ as __decorateClass } from './_virtual_class-decorator-runtime.js';
|
|
2
|
-
import { CustomElement, ExpandableItemManager, customElement, CanBeExpanded, InteractiveElement, getUniqueId, toAriaBooleanAttribute, Size, Variant, optionalAttr, InteractiveLink, getElementFromEvent, Shape, CanBeDisabled, optionalSlot, CheckboxFormControl, CheckboxGroupFormControl, SharedResizeObserver,
|
|
2
|
+
import { CustomElement, ExpandableItemManager, customElement, CanBeExpanded, InteractiveElement, getUniqueId, toAriaBooleanAttribute, Size, Variant, optionalAttr, InteractiveLink, getElementFromEvent, Shape, CanBeDisabled, optionalSlot, CheckboxFormControl, CheckboxGroupFormControl, SharedResizeObserver, Placement, waitForAnimations, PopoverPlacementOptions, computePopoverPlacement, getKeyInfo, FormControl, ActiveDescendantsController, getAssignedElement, parseDate, forwardEvent, OptionControl, toPx, RadioGroupFormControl, ListboxFormControl, IsDraggable, NumberFormControl, IS_DRAG_ACTIVE_ATTRIBUTE, DragController } from '@odx/foundation';
|
|
3
3
|
import { queryAssignedElements, property, query, state, queryAll } from 'lit/decorators.js';
|
|
4
4
|
import { html, isServer, unsafeCSS, css, nothing } from 'lit';
|
|
5
5
|
import { when } from 'lit/directives/when.js';
|
|
@@ -942,30 +942,28 @@ class PopoverObserver {
|
|
|
942
942
|
#mutationObserver;
|
|
943
943
|
constructor(host) {
|
|
944
944
|
this.host = host;
|
|
945
|
-
this.root =
|
|
946
|
-
this.#mutationObserver = new MutationObserver(async (mutations) => {
|
|
947
|
-
if (mutations.length === 0) return;
|
|
948
|
-
await 0;
|
|
949
|
-
this.updateReferenceElements();
|
|
950
|
-
});
|
|
945
|
+
this.root = host.ownerDocument ?? document;
|
|
951
946
|
}
|
|
952
947
|
hasMountedPopover(element) {
|
|
953
948
|
return this.#referenceElements.has(element);
|
|
954
949
|
}
|
|
955
950
|
observe() {
|
|
956
|
-
this.#mutationObserver
|
|
957
|
-
|
|
951
|
+
this.#mutationObserver ??= new MutationObserver((mutations) => {
|
|
952
|
+
if (mutations.length === 0) return;
|
|
953
|
+
this.#updateReferenceElements();
|
|
954
|
+
});
|
|
955
|
+
this.#mutationObserver.observe(this.root, { attributes: true, subtree: true, childList: true, attributeFilter: [popoverTargetAttribute] });
|
|
956
|
+
this.#updateReferenceElements();
|
|
958
957
|
}
|
|
959
958
|
disconnect() {
|
|
960
959
|
this.#mutationObserver?.disconnect();
|
|
961
960
|
}
|
|
962
|
-
updateReferenceElements() {
|
|
961
|
+
#updateReferenceElements() {
|
|
963
962
|
for (const element of Array.from(this.root.querySelectorAll(`[${popoverTargetAttribute}]`))) {
|
|
964
|
-
if (this.#referenceElements.has(element)) continue;
|
|
965
963
|
const popoverId = element.getAttribute(popoverTargetAttribute);
|
|
966
964
|
if (popoverId !== this.host.id) continue;
|
|
967
965
|
this.#referenceElements.set(element, popoverId);
|
|
968
|
-
this.host.mountPopover
|
|
966
|
+
this.host.mountPopover(element);
|
|
969
967
|
}
|
|
970
968
|
}
|
|
971
969
|
}
|
|
@@ -973,8 +971,8 @@ class PopoverObserver {
|
|
|
973
971
|
class PopoverHost extends CanBeDisabled(CustomElement) {
|
|
974
972
|
constructor() {
|
|
975
973
|
super();
|
|
974
|
+
this.#currentReferenceElement = null;
|
|
976
975
|
this.#openPopovers = /* @__PURE__ */ new WeakSet();
|
|
977
|
-
this.referenceElement = null;
|
|
978
976
|
this.anchor = "";
|
|
979
977
|
this.placement = Placement.BOTTOM;
|
|
980
978
|
this.fpsLimit = 60;
|
|
@@ -1002,9 +1000,17 @@ class PopoverHost extends CanBeDisabled(CustomElement) {
|
|
|
1002
1000
|
static {
|
|
1003
1001
|
this.styles = unsafeCSS(styles$Z);
|
|
1004
1002
|
}
|
|
1003
|
+
#currentReferenceElement;
|
|
1005
1004
|
#openPopovers;
|
|
1006
1005
|
#positionUpdater;
|
|
1007
1006
|
#observer;
|
|
1007
|
+
set referenceElement(value) {
|
|
1008
|
+
if (this.#currentReferenceElement === value) return;
|
|
1009
|
+
this.#currentReferenceElement = value;
|
|
1010
|
+
}
|
|
1011
|
+
get referenceElement() {
|
|
1012
|
+
return this.#currentReferenceElement;
|
|
1013
|
+
}
|
|
1008
1014
|
get options() {
|
|
1009
1015
|
return PopoverPlacementOptions({ arrowElement: this.popoverElement.arrowElement, placement: this.placement });
|
|
1010
1016
|
}
|
|
@@ -1017,7 +1023,7 @@ class PopoverHost extends CanBeDisabled(CustomElement) {
|
|
|
1017
1023
|
super.disconnectedCallback();
|
|
1018
1024
|
this.#disconnectObserver();
|
|
1019
1025
|
if (!this.referenceElement) return;
|
|
1020
|
-
this.unmountPopover
|
|
1026
|
+
this.unmountPopover(this.referenceElement);
|
|
1021
1027
|
this.hidePopover();
|
|
1022
1028
|
}
|
|
1023
1029
|
hasMountedPopover(element) {
|
|
@@ -1067,7 +1073,7 @@ class PopoverHost extends CanBeDisabled(CustomElement) {
|
|
|
1067
1073
|
updateReferenceElementFromEvent(event) {
|
|
1068
1074
|
const referenceElement = getElementFromEvent(event, (element) => this.hasMountedPopover(element));
|
|
1069
1075
|
if (!referenceElement) return;
|
|
1070
|
-
this.referenceElement =
|
|
1076
|
+
this.referenceElement = referenceElement;
|
|
1071
1077
|
}
|
|
1072
1078
|
willUpdate(props) {
|
|
1073
1079
|
super.willUpdate(props);
|
|
@@ -1094,7 +1100,7 @@ __decorateClass([
|
|
|
1094
1100
|
], PopoverHost.prototype, "popoverElement", 2);
|
|
1095
1101
|
__decorateClass([
|
|
1096
1102
|
property({ attribute: false })
|
|
1097
|
-
], PopoverHost.prototype, "referenceElement",
|
|
1103
|
+
], PopoverHost.prototype, "referenceElement", 1);
|
|
1098
1104
|
__decorateClass([
|
|
1099
1105
|
property({ reflect: true, useDefault: true })
|
|
1100
1106
|
], PopoverHost.prototype, "anchor", 2);
|
|
@@ -1141,14 +1147,14 @@ const _OdxDropdown = class _OdxDropdown extends PopoverHost {
|
|
|
1141
1147
|
this.id ||= getUniqueId("odx-dropdown");
|
|
1142
1148
|
}
|
|
1143
1149
|
mountPopover(referenceElement) {
|
|
1144
|
-
super.mountPopover
|
|
1150
|
+
super.mountPopover(referenceElement);
|
|
1145
1151
|
if (this.disabled || !referenceElement) return;
|
|
1146
1152
|
this.#updateAriaAttributes(referenceElement, this.id);
|
|
1147
1153
|
referenceElement.addEventListener("click", this.#handleClick);
|
|
1148
1154
|
referenceElement.addEventListener("keydown", this.#handleKeyboardEvent);
|
|
1149
1155
|
}
|
|
1150
1156
|
unmountPopover(referenceElement) {
|
|
1151
|
-
super.unmountPopover
|
|
1157
|
+
super.unmountPopover(referenceElement);
|
|
1152
1158
|
if (!referenceElement) return;
|
|
1153
1159
|
this.#updateAriaAttributes(referenceElement, null);
|
|
1154
1160
|
referenceElement.removeEventListener("click", this.#handleClick);
|
|
@@ -1168,7 +1174,9 @@ const _OdxDropdown = class _OdxDropdown extends PopoverHost {
|
|
|
1168
1174
|
}
|
|
1169
1175
|
if (props.has("disabled")) {
|
|
1170
1176
|
if (this.disabled) {
|
|
1171
|
-
|
|
1177
|
+
if (this.referenceElement) {
|
|
1178
|
+
this.unmountPopover(this.referenceElement);
|
|
1179
|
+
}
|
|
1172
1180
|
} else {
|
|
1173
1181
|
this.mountPopover(this.referenceElement);
|
|
1174
1182
|
}
|
|
@@ -2499,14 +2507,14 @@ class OdxMenu extends PopoverHost {
|
|
|
2499
2507
|
this.role ||= "menu";
|
|
2500
2508
|
}
|
|
2501
2509
|
mountPopover(referenceElement) {
|
|
2502
|
-
super.mountPopover
|
|
2510
|
+
super.mountPopover(referenceElement);
|
|
2503
2511
|
referenceElement?.addEventListener("click", this.#handleReferenceInteraction);
|
|
2504
2512
|
referenceElement?.addEventListener("keydown", this.#handleReferenceKeyDown);
|
|
2505
2513
|
}
|
|
2506
2514
|
unmountPopover(referenceElement) {
|
|
2507
2515
|
referenceElement.removeEventListener("keydown", this.#handleReferenceKeyDown);
|
|
2508
2516
|
referenceElement.removeEventListener("click", this.#handleReferenceInteraction);
|
|
2509
|
-
super.unmountPopover
|
|
2517
|
+
super.unmountPopover(referenceElement);
|
|
2510
2518
|
}
|
|
2511
2519
|
onBeforePopoverShow() {
|
|
2512
2520
|
this.#tabindexController.update({ elements: () => this.getItems() });
|
|
@@ -3292,7 +3300,7 @@ const _OdxSelect = class _OdxSelect extends ListboxFormControl {
|
|
|
3292
3300
|
)}
|
|
3293
3301
|
<odx-icon class="indicator" name="core::chevron-down"></odx-icon>
|
|
3294
3302
|
</div>
|
|
3295
|
-
<odx-dropdown part="dropdown" role="listbox" tabindex="-1" ?disabled=${this.disabled || this.readonly} match-reference-width
|
|
3303
|
+
<odx-dropdown part="dropdown" role="listbox" tabindex="-1" ?disabled=${this.disabled || this.readonly} match-reference-width>
|
|
3296
3304
|
<slot @slotchange=${this.#handleSlotChange}></slot>
|
|
3297
3305
|
</odx-dropdown>
|
|
3298
3306
|
`;
|
|
@@ -3328,9 +3336,6 @@ const _OdxSelect = class _OdxSelect extends ListboxFormControl {
|
|
|
3328
3336
|
__decorateClass([
|
|
3329
3337
|
queryAssignedElements({ selector: '[role="option"]', flatten: true })
|
|
3330
3338
|
], _OdxSelect.prototype, "options", 2);
|
|
3331
|
-
__decorateClass([
|
|
3332
|
-
query(".base", true)
|
|
3333
|
-
], _OdxSelect.prototype, "trigger", 2);
|
|
3334
3339
|
__decorateClass([
|
|
3335
3340
|
query(OdxDropdown.tagName, true)
|
|
3336
3341
|
], _OdxSelect.prototype, "dropdown", 2);
|
|
@@ -4346,28 +4351,22 @@ const _OdxTooltip = class _OdxTooltip extends PopoverHost {
|
|
|
4346
4351
|
clearTimeout(this.#timeout);
|
|
4347
4352
|
}
|
|
4348
4353
|
mountPopover(referenceElement) {
|
|
4349
|
-
super.mountPopover
|
|
4354
|
+
super.mountPopover(referenceElement);
|
|
4350
4355
|
if (!referenceElement) return;
|
|
4351
4356
|
this.#updateAriaAttributes(referenceElement, this.id);
|
|
4352
4357
|
if (this.popover === "manual") return;
|
|
4353
|
-
this.addEventListener("mouseleave", this.#handleMouseEvents);
|
|
4354
4358
|
referenceElement.addEventListener("mouseenter", this.#handleMouseEvents);
|
|
4355
4359
|
referenceElement.addEventListener("mouseleave", this.#handleReferenceMouseLeave);
|
|
4356
4360
|
referenceElement.addEventListener("keyup", this.#handleKeyboardFocus);
|
|
4357
4361
|
referenceElement.addEventListener("keydown", this.#handleKeyboardFocus);
|
|
4358
|
-
referenceElement.addEventListener("keyup", this.#handleKeyboardFocus);
|
|
4359
|
-
referenceElement.addEventListener("keydown", this.#handleKeyboardFocus);
|
|
4360
4362
|
}
|
|
4361
4363
|
unmountPopover(referenceElement) {
|
|
4362
|
-
super.unmountPopover
|
|
4364
|
+
super.unmountPopover(referenceElement);
|
|
4363
4365
|
this.#updateAriaAttributes(referenceElement, null);
|
|
4364
4366
|
referenceElement.removeEventListener("keyup", this.#handleKeyboardFocus);
|
|
4365
4367
|
referenceElement.removeEventListener("keydown", this.#handleKeyboardFocus);
|
|
4366
|
-
this.removeEventListener("mouseleave", this.#handleMouseEvents);
|
|
4367
4368
|
referenceElement.removeEventListener("mouseenter", this.#handleMouseEvents);
|
|
4368
4369
|
referenceElement.removeEventListener("mouseleave", this.#handleReferenceMouseLeave);
|
|
4369
|
-
referenceElement.removeEventListener("keyup", this.#handleKeyboardFocus);
|
|
4370
|
-
referenceElement.removeEventListener("keydown", this.#handleKeyboardFocus);
|
|
4371
4370
|
}
|
|
4372
4371
|
render() {
|
|
4373
4372
|
return html`
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@odx/foundation",
|
|
3
3
|
"description": "A library of Web Component building blocks for ODX",
|
|
4
|
-
"version": "1.0.0-beta.
|
|
4
|
+
"version": "1.0.0-beta.84",
|
|
5
5
|
"author": "Drägerwerk AG & Co.KGaA",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
7
7
|
"homepage": "https://odx.draeger.com",
|