@odx/foundation 1.0.0-beta.83 → 1.0.0-beta.85
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 -3
- 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 +33 -38
- 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,8 +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;
|
|
10
|
-
|
|
9
|
+
set referenceElement(value: HTMLElement | null);
|
|
10
|
+
get referenceElement(): HTMLElement | null;
|
|
11
11
|
placement: Placement;
|
|
12
12
|
fpsLimit: number;
|
|
13
13
|
get options(): PopoverPlacementOptions;
|
|
@@ -16,7 +16,7 @@ export declare abstract class PopoverHost extends PopoverHost_base {
|
|
|
16
16
|
disconnectedCallback(): void;
|
|
17
17
|
hasMountedPopover(element: HTMLElement): boolean;
|
|
18
18
|
mountPopover(referenceElement: HTMLElement | null): void;
|
|
19
|
-
unmountPopover(_referenceElement: HTMLElement
|
|
19
|
+
unmountPopover(_referenceElement: HTMLElement): void;
|
|
20
20
|
isPopoverOpen(): boolean;
|
|
21
21
|
showPopover(): Promise<void>;
|
|
22
22
|
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';
|
|
@@ -197,7 +197,7 @@ const _OdxActionButton = class _OdxActionButton extends OdxButton {
|
|
|
197
197
|
${when(
|
|
198
198
|
!this.replaceContent && this.statusMessage,
|
|
199
199
|
(statusMessage) => html`
|
|
200
|
-
<odx-tooltip
|
|
200
|
+
<odx-tooltip placement="top" .popover=${"manual"} .show=${this.isStatusMessageShown} timeout=${this.statusMessageTimeout}>
|
|
201
201
|
<odx-text size="sm" strong>${statusMessage}</odx-text>
|
|
202
202
|
</odx-tooltip>
|
|
203
203
|
`
|
|
@@ -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,9 +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
|
-
this.anchor = "";
|
|
979
976
|
this.placement = Placement.BOTTOM;
|
|
980
977
|
this.fpsLimit = 60;
|
|
981
978
|
this.#handleToggle = async (event) => {
|
|
@@ -1002,9 +999,17 @@ class PopoverHost extends CanBeDisabled(CustomElement) {
|
|
|
1002
999
|
static {
|
|
1003
1000
|
this.styles = unsafeCSS(styles$Z);
|
|
1004
1001
|
}
|
|
1002
|
+
#currentReferenceElement;
|
|
1005
1003
|
#openPopovers;
|
|
1006
1004
|
#positionUpdater;
|
|
1007
1005
|
#observer;
|
|
1006
|
+
set referenceElement(value) {
|
|
1007
|
+
if (this.#currentReferenceElement === value) return;
|
|
1008
|
+
this.#currentReferenceElement = value;
|
|
1009
|
+
}
|
|
1010
|
+
get referenceElement() {
|
|
1011
|
+
return this.#currentReferenceElement;
|
|
1012
|
+
}
|
|
1008
1013
|
get options() {
|
|
1009
1014
|
return PopoverPlacementOptions({ arrowElement: this.popoverElement.arrowElement, placement: this.placement });
|
|
1010
1015
|
}
|
|
@@ -1017,7 +1022,7 @@ class PopoverHost extends CanBeDisabled(CustomElement) {
|
|
|
1017
1022
|
super.disconnectedCallback();
|
|
1018
1023
|
this.#disconnectObserver();
|
|
1019
1024
|
if (!this.referenceElement) return;
|
|
1020
|
-
this.unmountPopover
|
|
1025
|
+
this.unmountPopover(this.referenceElement);
|
|
1021
1026
|
this.hidePopover();
|
|
1022
1027
|
}
|
|
1023
1028
|
hasMountedPopover(element) {
|
|
@@ -1067,7 +1072,7 @@ class PopoverHost extends CanBeDisabled(CustomElement) {
|
|
|
1067
1072
|
updateReferenceElementFromEvent(event) {
|
|
1068
1073
|
const referenceElement = getElementFromEvent(event, (element) => this.hasMountedPopover(element));
|
|
1069
1074
|
if (!referenceElement) return;
|
|
1070
|
-
this.referenceElement =
|
|
1075
|
+
this.referenceElement = referenceElement;
|
|
1071
1076
|
}
|
|
1072
1077
|
willUpdate(props) {
|
|
1073
1078
|
super.willUpdate(props);
|
|
@@ -1094,10 +1099,7 @@ __decorateClass([
|
|
|
1094
1099
|
], PopoverHost.prototype, "popoverElement", 2);
|
|
1095
1100
|
__decorateClass([
|
|
1096
1101
|
property({ attribute: false })
|
|
1097
|
-
], PopoverHost.prototype, "referenceElement",
|
|
1098
|
-
__decorateClass([
|
|
1099
|
-
property({ reflect: true, useDefault: true })
|
|
1100
|
-
], PopoverHost.prototype, "anchor", 2);
|
|
1102
|
+
], PopoverHost.prototype, "referenceElement", 1);
|
|
1101
1103
|
__decorateClass([
|
|
1102
1104
|
property({ reflect: true, useDefault: true })
|
|
1103
1105
|
], PopoverHost.prototype, "placement", 2);
|
|
@@ -1141,14 +1143,14 @@ const _OdxDropdown = class _OdxDropdown extends PopoverHost {
|
|
|
1141
1143
|
this.id ||= getUniqueId("odx-dropdown");
|
|
1142
1144
|
}
|
|
1143
1145
|
mountPopover(referenceElement) {
|
|
1144
|
-
super.mountPopover
|
|
1146
|
+
super.mountPopover(referenceElement);
|
|
1145
1147
|
if (this.disabled || !referenceElement) return;
|
|
1146
1148
|
this.#updateAriaAttributes(referenceElement, this.id);
|
|
1147
1149
|
referenceElement.addEventListener("click", this.#handleClick);
|
|
1148
1150
|
referenceElement.addEventListener("keydown", this.#handleKeyboardEvent);
|
|
1149
1151
|
}
|
|
1150
1152
|
unmountPopover(referenceElement) {
|
|
1151
|
-
super.unmountPopover
|
|
1153
|
+
super.unmountPopover(referenceElement);
|
|
1152
1154
|
if (!referenceElement) return;
|
|
1153
1155
|
this.#updateAriaAttributes(referenceElement, null);
|
|
1154
1156
|
referenceElement.removeEventListener("click", this.#handleClick);
|
|
@@ -1168,7 +1170,9 @@ const _OdxDropdown = class _OdxDropdown extends PopoverHost {
|
|
|
1168
1170
|
}
|
|
1169
1171
|
if (props.has("disabled")) {
|
|
1170
1172
|
if (this.disabled) {
|
|
1171
|
-
|
|
1173
|
+
if (this.referenceElement) {
|
|
1174
|
+
this.unmountPopover(this.referenceElement);
|
|
1175
|
+
}
|
|
1172
1176
|
} else {
|
|
1173
1177
|
this.mountPopover(this.referenceElement);
|
|
1174
1178
|
}
|
|
@@ -2499,14 +2503,14 @@ class OdxMenu extends PopoverHost {
|
|
|
2499
2503
|
this.role ||= "menu";
|
|
2500
2504
|
}
|
|
2501
2505
|
mountPopover(referenceElement) {
|
|
2502
|
-
super.mountPopover
|
|
2506
|
+
super.mountPopover(referenceElement);
|
|
2503
2507
|
referenceElement?.addEventListener("click", this.#handleReferenceInteraction);
|
|
2504
2508
|
referenceElement?.addEventListener("keydown", this.#handleReferenceKeyDown);
|
|
2505
2509
|
}
|
|
2506
2510
|
unmountPopover(referenceElement) {
|
|
2507
2511
|
referenceElement.removeEventListener("keydown", this.#handleReferenceKeyDown);
|
|
2508
2512
|
referenceElement.removeEventListener("click", this.#handleReferenceInteraction);
|
|
2509
|
-
super.unmountPopover
|
|
2513
|
+
super.unmountPopover(referenceElement);
|
|
2510
2514
|
}
|
|
2511
2515
|
onBeforePopoverShow() {
|
|
2512
2516
|
this.#tabindexController.update({ elements: () => this.getItems() });
|
|
@@ -3292,7 +3296,7 @@ const _OdxSelect = class _OdxSelect extends ListboxFormControl {
|
|
|
3292
3296
|
)}
|
|
3293
3297
|
<odx-icon class="indicator" name="core::chevron-down"></odx-icon>
|
|
3294
3298
|
</div>
|
|
3295
|
-
<odx-dropdown part="dropdown" role="listbox" tabindex="-1" ?disabled=${this.disabled || this.readonly} match-reference-width
|
|
3299
|
+
<odx-dropdown part="dropdown" role="listbox" tabindex="-1" ?disabled=${this.disabled || this.readonly} match-reference-width>
|
|
3296
3300
|
<slot @slotchange=${this.#handleSlotChange}></slot>
|
|
3297
3301
|
</odx-dropdown>
|
|
3298
3302
|
`;
|
|
@@ -3328,9 +3332,6 @@ const _OdxSelect = class _OdxSelect extends ListboxFormControl {
|
|
|
3328
3332
|
__decorateClass([
|
|
3329
3333
|
queryAssignedElements({ selector: '[role="option"]', flatten: true })
|
|
3330
3334
|
], _OdxSelect.prototype, "options", 2);
|
|
3331
|
-
__decorateClass([
|
|
3332
|
-
query(".base", true)
|
|
3333
|
-
], _OdxSelect.prototype, "trigger", 2);
|
|
3334
3335
|
__decorateClass([
|
|
3335
3336
|
query(OdxDropdown.tagName, true)
|
|
3336
3337
|
], _OdxSelect.prototype, "dropdown", 2);
|
|
@@ -4346,28 +4347,22 @@ const _OdxTooltip = class _OdxTooltip extends PopoverHost {
|
|
|
4346
4347
|
clearTimeout(this.#timeout);
|
|
4347
4348
|
}
|
|
4348
4349
|
mountPopover(referenceElement) {
|
|
4349
|
-
super.mountPopover
|
|
4350
|
+
super.mountPopover(referenceElement);
|
|
4350
4351
|
if (!referenceElement) return;
|
|
4351
4352
|
this.#updateAriaAttributes(referenceElement, this.id);
|
|
4352
4353
|
if (this.popover === "manual") return;
|
|
4353
|
-
this.addEventListener("mouseleave", this.#handleMouseEvents);
|
|
4354
4354
|
referenceElement.addEventListener("mouseenter", this.#handleMouseEvents);
|
|
4355
4355
|
referenceElement.addEventListener("mouseleave", this.#handleReferenceMouseLeave);
|
|
4356
4356
|
referenceElement.addEventListener("keyup", this.#handleKeyboardFocus);
|
|
4357
4357
|
referenceElement.addEventListener("keydown", this.#handleKeyboardFocus);
|
|
4358
|
-
referenceElement.addEventListener("keyup", this.#handleKeyboardFocus);
|
|
4359
|
-
referenceElement.addEventListener("keydown", this.#handleKeyboardFocus);
|
|
4360
4358
|
}
|
|
4361
4359
|
unmountPopover(referenceElement) {
|
|
4362
|
-
super.unmountPopover
|
|
4360
|
+
super.unmountPopover(referenceElement);
|
|
4363
4361
|
this.#updateAriaAttributes(referenceElement, null);
|
|
4364
4362
|
referenceElement.removeEventListener("keyup", this.#handleKeyboardFocus);
|
|
4365
4363
|
referenceElement.removeEventListener("keydown", this.#handleKeyboardFocus);
|
|
4366
|
-
this.removeEventListener("mouseleave", this.#handleMouseEvents);
|
|
4367
4364
|
referenceElement.removeEventListener("mouseenter", this.#handleMouseEvents);
|
|
4368
4365
|
referenceElement.removeEventListener("mouseleave", this.#handleReferenceMouseLeave);
|
|
4369
|
-
referenceElement.removeEventListener("keyup", this.#handleKeyboardFocus);
|
|
4370
|
-
referenceElement.removeEventListener("keydown", this.#handleKeyboardFocus);
|
|
4371
4366
|
}
|
|
4372
4367
|
render() {
|
|
4373
4368
|
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.85",
|
|
5
5
|
"author": "Drägerwerk AG & Co.KGaA",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
7
7
|
"homepage": "https://odx.draeger.com",
|