@odx/foundation 1.0.0-beta.50 → 1.0.0-beta.52
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.js +29 -42
- package/dist/i18n.js +1 -1
- package/dist/loader.js +4 -7
- package/dist/main.js +61 -165
- package/dist/types/components/accordion/accordion.d.ts +2 -2
- package/dist/types/components/area-header/area-header.d.ts +2 -2
- package/dist/types/components/avatar/avatar.d.ts +4 -4
- package/dist/types/components/badge/badge.d.ts +2 -2
- package/dist/types/components/button/button.d.ts +4 -4
- package/dist/types/components/checkbox-group/checkbox-group.d.ts +2 -2
- package/dist/types/components/chip/chip.d.ts +2 -2
- package/dist/types/components/circular-progress-bar/circular-progress-bar.d.ts +2 -2
- package/dist/types/components/dropdown/dropdown.d.ts +2 -2
- package/dist/types/components/headline/headline.d.ts +2 -2
- package/dist/types/components/inline-message/inline-message.d.ts +2 -2
- package/dist/types/components/kpi/kpi.d.ts +3 -3
- package/dist/types/components/logo/logo.d.ts +2 -2
- package/dist/types/components/main-menu/main-menu.d.ts +0 -1
- package/dist/types/components/modal/modal.d.ts +2 -2
- package/dist/types/components/navigation-item/navigation-item.d.ts +2 -2
- package/dist/types/components/page/page.d.ts +3 -3
- package/dist/types/components/progress-bar/progress-bar.d.ts +2 -2
- package/dist/types/components/radio-group/radio-group.d.ts +2 -2
- package/dist/types/components/search-bar/search-bar.d.ts +2 -2
- package/dist/types/components/separator/separator.d.ts +2 -2
- package/dist/types/components/skeleton/skeleton.d.ts +3 -3
- package/dist/types/components/slider/slider.models.d.ts +3 -3
- package/dist/types/components/stack/stack.d.ts +4 -4
- package/dist/types/components/status/status.d.ts +2 -2
- package/dist/types/components/text/text.d.ts +3 -3
- package/dist/types/components/title/title.d.ts +2 -2
- package/dist/types/components/toast/toast.d.ts +2 -2
- package/dist/types/components/tooltip/tooltip.d.ts +2 -2
- package/dist/types/lib/drag-drop/is-draggable.d.ts +1 -1
- package/dist/types/lib/interactive/interactive-element.d.ts +1 -1
- package/dist/types/lib/interactive/interactive-link.d.ts +1 -1
- package/dist/types/lib/main.d.ts +1 -2
- package/dist/types/lib/mixins/active-descendant.d.ts +1 -1
- package/dist/types/lib/mixins/can-be-disabled.d.ts +1 -1
- package/dist/types/lib/mixins/can-be-expanded.d.ts +1 -1
- package/dist/types/lib/mixins/can-be-selected.d.ts +2 -1
- package/dist/types/lib/mixins/form-control.d.ts +1 -1
- package/dist/types/lib/mixins/number-control.d.ts +1 -1
- package/dist/types/lib/mixins/with-loading-state.d.ts +1 -1
- package/dist/types/lib/models/shape.d.ts +2 -2
- package/dist/types/lib/models/size.d.ts +2 -2
- package/dist/types/lib/models/state.d.ts +2 -2
- package/dist/types/lib/models/variant.d.ts +2 -2
- package/dist/types/lib/popover/popover-observer.d.ts +1 -1
- package/dist/types/lib/popover/popover.models.d.ts +3 -3
- package/dist/types/lib/utils/dedupe-mixin.d.ts +1 -1
- package/dist/types/lib/utils/dom.d.ts +14 -1
- package/dist/types/lib/utils/keyboard.d.ts +14 -0
- package/dist/types/lib/utils/search-text-content.d.ts +2 -1
- package/dist/types/lib/utils/shared-intersection-observer.d.ts +0 -7
- package/dist/types/lib/utils/shared-resize-observer.d.ts +0 -7
- package/dist/types/lib/utils/types.d.ts +1 -2
- package/dist/types/loader/main.d.ts +1 -1
- package/dist/vendor-CUYBdPCu.js +1909 -0
- package/package.json +5 -6
- package/dist/types/lib/controllers/focus-trap.controller.d.ts +0 -14
- package/dist/types/lib/utils/keyboard-events.d.ts +0 -43
- package/dist/vendor-C_8wBEOn.js +0 -149
package/dist/components.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { CanBeExpanded, InteractiveElement, getUniqueId, toAriaBooleanAttribute, customElement, requestUpdateOnAriaChange, CustomElement, ExpandableItemManager, enumFrom, Size, Variant, optionalAttr, InteractiveLink, createIntersectionObserver, createMutationObserver, getElementFromEvent, Shape, CanBeDisabled, optionalSlot, CheckboxGroupFormControl, CheckboxFormControl, toggleAttribute, SharedResizeObserver, PopoverPlacement, PopoverHost,
|
|
1
|
+
import { CanBeExpanded, InteractiveElement, getUniqueId, toAriaBooleanAttribute, customElement, requestUpdateOnAriaChange, CustomElement, ExpandableItemManager, enumFrom, Size, Variant, optionalAttr, InteractiveLink, createIntersectionObserver, createMutationObserver, getElementFromEvent, Shape, CanBeDisabled, optionalSlot, CheckboxGroupFormControl, CheckboxFormControl, toggleAttribute, SharedResizeObserver, PopoverPlacement, PopoverHost, getKeyInfo, PopoverPlacementOptions, searchTextContent, FormControl, ActiveDescendantsController, getAssignedElement, parseDate, waitForAnimations, forwardEvent, CanBeSelected, WithLoadingState, OptionControl, toPx, RadioGroupFormControl, ListboxFormControl, IsDraggable, NumberControl, IS_DRAG_ACTIVE_ATTRIBUTE, DragController } from '@odx/foundation';
|
|
2
2
|
import { html, isServer, css, nothing } from 'lit';
|
|
3
3
|
import { property, queryAssignedElements, state, queryAll, query } from 'lit/decorators.js';
|
|
4
4
|
import { when } from 'lit/directives/when.js';
|
|
5
5
|
import { signal, computed, SignalWatcher } from '@lit-labs/preact-signals';
|
|
6
6
|
import { repeat } from 'lit/directives/repeat.js';
|
|
7
7
|
import { IsLocalized, setTranslation } from '@odx/foundation/i18n';
|
|
8
|
-
import { R as RovingTabindexController, r as round,
|
|
8
|
+
import { R as RovingTabindexController, r as round, e as debounce } from './vendor-CUYBdPCu.js';
|
|
9
9
|
import { createContext, consume, provide } from '@lit/context';
|
|
10
10
|
|
|
11
11
|
const styles$1d = ":host{display:block;margin-block:var(--odx-size-37)}:host([expanded])::part(indicator){--rotate: 180deg}";
|
|
@@ -799,7 +799,7 @@ OdxButtonGroup = __decorateClass$1a([
|
|
|
799
799
|
customElement("odx-button-group", [styles$10])
|
|
800
800
|
], OdxButtonGroup);
|
|
801
801
|
|
|
802
|
-
const styles$$ = ":host{--_card-padding: var(--odx-size-150);display:grid;grid-template-areas:\"image image\" \"avatar avatar\" \"title header-actions\" \"content content\" \"footer footer\";grid-template-columns:1fr auto;place-content:flex-start;border-radius:var(--odx-border-radius-md);background-color:var(--odx-color-background-
|
|
802
|
+
const styles$$ = ":host{--_card-padding: var(--odx-size-150);display:grid;grid-template-areas:\"image image\" \"avatar avatar\" \"title header-actions\" \"content content\" \"footer footer\";grid-template-columns:1fr auto;place-content:flex-start;border-radius:var(--odx-border-radius-md);background-color:var(--odx-color-background-level-1);padding:var(--_card-padding);max-width:100%;overflow:clip}.header,.title{display:flex;place-items:center;margin-block-end:var(--odx-size-50);min-block-size:var(--odx-size-225);overflow:hidden}.title{grid-area:title}.header{grid-area:header-actions}.avatar{display:flex;grid-area:avatar;place-items:flex-end;margin-block-start:calc(-1 * var(--odx-size-50))}.image{position:relative;grid-area:image;margin:calc(-1 * var(--_card-padding));margin-block-end:var(--odx-size-150)}.image:after{position:absolute;inset:0;transition:var(--odx-transition-default);opacity:0;background-color:var(--odx-color-background-transparent-hover);content:\"\";pointer-events:none;backdrop-filter:blur(var(--odx-elevation-blur))}:host::part(content){grid-area:content}:host::part(footer){grid-area:footer}[part=image-container]+[part=avatar-container]{block-size:0}slot[name=image]::slotted(*){max-block-size:100%;max-inline-size:100%;pointer-events:none;object-fit:cover;aspect-ratio:16 / 9;user-select:none}slot[name=avatar]::slotted(*){margin:0}:host(:hover){cursor:pointer}:host(:hover) .image:after{opacity:1}";
|
|
803
803
|
|
|
804
804
|
var __defProp$19 = Object.defineProperty;
|
|
805
805
|
var __getOwnPropDesc$19 = Object.getOwnPropertyDescriptor;
|
|
@@ -1169,8 +1169,7 @@ let OdxDropdown = class extends PopoverHost {
|
|
|
1169
1169
|
this.togglePopover();
|
|
1170
1170
|
});
|
|
1171
1171
|
__privateAdd$p(this, _handleKeyboardEvent$1, (event) => {
|
|
1172
|
-
|
|
1173
|
-
if (!actions.enter || event.defaultPrevented) return;
|
|
1172
|
+
if (!getKeyInfo(event).enter || event.defaultPrevented) return;
|
|
1174
1173
|
if (!this.isPopoverOpen()) {
|
|
1175
1174
|
event.stopImmediatePropagation();
|
|
1176
1175
|
}
|
|
@@ -1395,14 +1394,14 @@ let OdxAutocomplete = class extends CanBeDisabled(FormControl(CustomElement)) {
|
|
|
1395
1394
|
});
|
|
1396
1395
|
__privateAdd$n(this, _handleControlKeyboardEvent, (event) => {
|
|
1397
1396
|
if (!this.control) return;
|
|
1398
|
-
const
|
|
1399
|
-
if (
|
|
1397
|
+
const key = getKeyInfo(event);
|
|
1398
|
+
if (key.enter || key.start || key.end || key.down || key.up) {
|
|
1400
1399
|
event.preventDefault();
|
|
1401
1400
|
}
|
|
1402
|
-
if (
|
|
1401
|
+
if (key.space) {
|
|
1403
1402
|
event.stopImmediatePropagation();
|
|
1404
1403
|
}
|
|
1405
|
-
if (this.activeDescendants.activeItem &&
|
|
1404
|
+
if (this.activeDescendants.activeItem && key.enter) {
|
|
1406
1405
|
__privateMethod$e(this, _OdxAutocomplete_instances, handleControlValueChange_fn).call(this, this.activeDescendants.activeItem.getTextLabel());
|
|
1407
1406
|
}
|
|
1408
1407
|
});
|
|
@@ -1846,7 +1845,7 @@ OdxTitle = __decorateClass$V([
|
|
|
1846
1845
|
customElement("odx-title", [styles$Q])
|
|
1847
1846
|
], OdxTitle);
|
|
1848
1847
|
|
|
1849
|
-
const styles$P = "@layer base{:host{display:block;position:relative}.base{display:flex;
|
|
1848
|
+
const styles$P = "@layer base{:host{display:block;position:relative}.base{display:flex;position:relative;column-gap:var(--odx-size-150);place-items:center;z-index:1;background-color:var(--odx-color-background-level-1);padding-inline:var(--odx-size-150);block-size:var(--odx-size-300)}.background{position:absolute;inset:0;z-index:0;box-shadow:0 0 0 100vmax var(--odx-color-background-level-1);background-color:var(--odx-color-background-level-1);clip-path:inset(0 -100vmax)}odx-logo{flex:0 0 auto}::slotted(odx-title){width:max-content}::slotted(odx-main-menu-button){margin-inline-end:calc(-1 * var(--odx-size-75))}::slotted(odx-header-actions){margin-inline-start:auto}@media screen and (width <= 600px){odx-logo{display:none}}}";
|
|
1850
1849
|
|
|
1851
1850
|
var __defProp$U = Object.defineProperty;
|
|
1852
1851
|
var __getOwnPropDesc$U = Object.getOwnPropertyDescriptor;
|
|
@@ -2081,7 +2080,7 @@ OdxImage = __decorateClass$R([
|
|
|
2081
2080
|
customElement("odx-image", [styles$M])
|
|
2082
2081
|
], OdxImage);
|
|
2083
2082
|
|
|
2084
|
-
const styles$L = "@layer base{:host{--_color-background: var(--odx-color-background-
|
|
2083
|
+
const styles$L = "@layer base{:host{--_color-background: var(--odx-color-background-level-1);--_color-foreground: var(--odx-color-foreground-rest);--_color-stroke: var(--odx-color-separator);--_icon-size: var(--odx-size-150);display:flex;gap:var(--odx-size-75);align-items:flex-start;transition:var(--odx-transition-reduced);transition-property:background-color,color,display,opacity;background-color:var(--_color-background);padding:var(--odx-size-75);line-height:var(--odx-typography-line-height-base);color:var(--_color-foreground);transition-behavior:allow-discrete;@starting-style{opacity:0}}.icon{--size: var(--_icon-size)}.base{flex:1 1 auto;line-height:var(--odx-typography-line-height-base);font-size:var(--odx-typography-font-size-2)}.action{--_color-foreground: inherit;margin-block-start:calc(-1 * var(--odx-size-37));margin-inline-end:calc(-1 * var(--odx-size-37))}}@layer state{:host([hidden]){display:none;opacity:0}}@layer variant{:host([variant=\"accent\"]){--_color-background: var(--odx-color-background-accent-muted);--_color-stroke: var(--odx-palette-blue-60)}:host([variant=\"danger\"]){--_color-background: var(--odx-color-background-danger-muted);--_color-foreground: var(--odx-palette-red-90);--_color-stroke: var(--odx-palette-red-60)}:host([variant=\"warning\"]){--_color-background: var(--odx-color-background-warning-muted);--_color-stroke: var(--odx-palette-yellow-60)}:host([variant=\"success\"]){--_color-background: var(--odx-color-background-success-muted);--_color-stroke: var(--odx-palette-green-60)}:host([emphasized]){border-block-end:var(--odx-border-width-thick) solid var(--_color-stroke);padding-block-end:calc(var(--odx-size-75) - var(--odx-border-width-thick))}}";
|
|
2085
2084
|
|
|
2086
2085
|
var __defProp$Q = Object.defineProperty;
|
|
2087
2086
|
var __getOwnPropDesc$Q = Object.getOwnPropertyDescriptor;
|
|
@@ -2178,8 +2177,7 @@ let OdxInput = class extends FormControl(CustomElement) {
|
|
|
2178
2177
|
this.value = event.target.value;
|
|
2179
2178
|
});
|
|
2180
2179
|
__privateAdd$i(this, _handleKeyDown$2, (event) => {
|
|
2181
|
-
|
|
2182
|
-
if (!actions.escape) return;
|
|
2180
|
+
if (!getKeyInfo(event).escape) return;
|
|
2183
2181
|
event.preventDefault();
|
|
2184
2182
|
this.clear();
|
|
2185
2183
|
});
|
|
@@ -2772,22 +2770,15 @@ var __decorateClass$D = (decorators, target, key, kind) => {
|
|
|
2772
2770
|
var __accessCheck$d = (obj, member, msg) => member.has(obj) || __typeError$d("Cannot " + msg);
|
|
2773
2771
|
var __privateGet$b = (obj, member, getter) => (__accessCheck$d(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
2774
2772
|
var __privateAdd$d = (obj, member, value) => member.has(obj) ? __typeError$d("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
2775
|
-
var
|
|
2773
|
+
var _handleSlotChange$4;
|
|
2776
2774
|
let OdxMainMenu = class extends CustomElement {
|
|
2777
2775
|
constructor() {
|
|
2778
|
-
super();
|
|
2779
|
-
__privateAdd$d(this, _focusTrap, new FocusTrapController(this));
|
|
2776
|
+
super(...arguments);
|
|
2780
2777
|
__privateAdd$d(this, _handleSlotChange$4, () => {
|
|
2781
2778
|
for (const link of this.links) {
|
|
2782
2779
|
link.slot ||= "link-navigation";
|
|
2783
2780
|
}
|
|
2784
2781
|
});
|
|
2785
|
-
__privateAdd$d(this, _handleToggle, ({ newState }) => {
|
|
2786
|
-
__privateGet$b(this, _focusTrap).toggle(newState === "open");
|
|
2787
|
-
});
|
|
2788
|
-
if (!isServer) {
|
|
2789
|
-
this.addEventListener("toggle", __privateGet$b(this, _handleToggle));
|
|
2790
|
-
}
|
|
2791
2782
|
}
|
|
2792
2783
|
connectedCallback() {
|
|
2793
2784
|
super.connectedCallback();
|
|
@@ -2820,9 +2811,7 @@ let OdxMainMenu = class extends CustomElement {
|
|
|
2820
2811
|
`;
|
|
2821
2812
|
}
|
|
2822
2813
|
};
|
|
2823
|
-
_focusTrap = new WeakMap();
|
|
2824
2814
|
_handleSlotChange$4 = new WeakMap();
|
|
2825
|
-
_handleToggle = new WeakMap();
|
|
2826
2815
|
__decorateClass$D([
|
|
2827
2816
|
queryAssignedElements({ selector: "odx-link", flatten: true })
|
|
2828
2817
|
], OdxMainMenu.prototype, "links", 2);
|
|
@@ -2924,21 +2913,20 @@ let OdxMenu = class extends PopoverHost {
|
|
|
2924
2913
|
this.hidePopover();
|
|
2925
2914
|
});
|
|
2926
2915
|
__privateAdd$c(this, _handleKeyDown$1, (event) => {
|
|
2927
|
-
const
|
|
2928
|
-
if ((
|
|
2916
|
+
const key = getKeyInfo(event);
|
|
2917
|
+
if ((key.tab || key.backTab) && this.isPopoverOpen()) {
|
|
2929
2918
|
event?.preventDefault();
|
|
2930
2919
|
event.stopPropagation();
|
|
2931
2920
|
this.hidePopover();
|
|
2932
2921
|
return;
|
|
2933
2922
|
}
|
|
2934
|
-
if (!
|
|
2923
|
+
if (!key.enter && !key.space) return;
|
|
2935
2924
|
const [activeItem] = this.getItems().filter((item) => item.tabIndex === 0);
|
|
2936
2925
|
if (!activeItem) return;
|
|
2937
2926
|
activeItem.click();
|
|
2938
2927
|
});
|
|
2939
2928
|
__privateAdd$c(this, _handleReferenceKeyDown, (event) => {
|
|
2940
|
-
|
|
2941
|
-
if (!direction.down) return;
|
|
2929
|
+
if (!getKeyInfo(event).down) return;
|
|
2942
2930
|
this.showPopover();
|
|
2943
2931
|
});
|
|
2944
2932
|
}
|
|
@@ -2992,7 +2980,7 @@ OdxMenu = __decorateClass$A([
|
|
|
2992
2980
|
customElement("odx-menu", [styles$y])
|
|
2993
2981
|
], OdxMenu);
|
|
2994
2982
|
|
|
2995
|
-
const styles$x = "@layer base{:host{--max-inline-size: 640px;--margin-block-start: var(--odx-size-450);--_modal-transition: var(--odx-popover-transition, var(--odx-motion-duration-default));--_modal-transition-offset-x: 0;--_modal-transition-offset-y: calc(-1 * var(--_modal-offset));--_modal-outer-padding: var(--odx-breakpoint-spacing-150);display:contents;transition-property:display}:host,.base,.base::backdrop{transition:var(--odx-transition-default);transition-behavior:allow-discrete}.base,.base::backdrop{opacity:0}.base{transform:translateY(var(--odx-size-100));transition-property:opacity,display,overlay,transform,outline;margin-block-start:var(--margin-block-start);border:0;border-radius:var(--odx-border-radius-ml);box-shadow:var(--odx-shadow-level-2);background:transparent;padding:0;inline-size:min(var(--max-inline-size),100% - 2 * var(--_modal-outer-padding));overflow:unset;color:var(--odx-color-foreground-rest);&::backdrop{transition-property:opacity;background-color:var(--odx-color-backdrop);backdrop-filter:blur(var(--odx-elevation-blur))}}.inner{display:flex;flex-direction:column;border-radius:inherit;background-color:var(--odx-color-background-
|
|
2983
|
+
const styles$x = "@layer base{:host{--max-inline-size: 640px;--margin-block-start: var(--odx-size-450);--_modal-transition: var(--odx-popover-transition, var(--odx-motion-duration-default));--_modal-transition-offset-x: 0;--_modal-transition-offset-y: calc(-1 * var(--_modal-offset));--_modal-outer-padding: var(--odx-breakpoint-spacing-150);display:contents;transition-property:display}:host,.base,.base::backdrop{transition:var(--odx-transition-default);transition-behavior:allow-discrete}.base,.base::backdrop{opacity:0}.base{transform:translateY(var(--odx-size-100));transition-property:opacity,display,overlay,transform,outline;margin-block-start:var(--margin-block-start);border:0;border-radius:var(--odx-border-radius-ml);box-shadow:var(--odx-shadow-level-2);background:transparent;padding:0;inline-size:min(var(--max-inline-size),100% - 2 * var(--_modal-outer-padding));overflow:unset;color:var(--odx-color-foreground-rest);&::backdrop{transition-property:opacity;background-color:var(--odx-color-backdrop);backdrop-filter:blur(var(--odx-elevation-blur))}}.inner{display:flex;flex-direction:column;border-radius:inherit;background-color:var(--odx-color-background-level-1);padding:var(--odx-spacing-50) var(--odx-breakpoint-spacing-150);max-block-size:calc(100dvh - 2 * var(--_modal-outer-padding))}.header,.footer{min-block-size:var(--odx-size-300)}.header{padding-inline-end:var(--odx-size-300)}.content{padding:var(--odx-size-75) 0}.dismiss-action{position:absolute;inset-block-start:var(--odx-spacing-50);inset-inline-end:var(--odx-breakpoint-spacing-150)}}@layer state{:host(:not([open])){display:none}.base:focus-visible{outline-color:var(--odx-focus-ring-color)}.base[open]{transform:translate(0);&,&::backdrop{opacity:1;@starting-style{opacity:0}}@starting-style{transform:translateY(var(--odx-size-100))}}}";
|
|
2996
2984
|
|
|
2997
2985
|
var __defProp$z = Object.defineProperty;
|
|
2998
2986
|
var __getOwnPropDesc$z = Object.getOwnPropertyDescriptor;
|
|
@@ -3037,8 +3025,7 @@ let OdxModal = class extends CustomElement {
|
|
|
3037
3025
|
this.showRequested = false;
|
|
3038
3026
|
this.open = false;
|
|
3039
3027
|
__privateAdd$b(this, _handleKeyDown, (event) => {
|
|
3040
|
-
|
|
3041
|
-
if (!actions.escape) return;
|
|
3028
|
+
if (!getKeyInfo(event).escape) return;
|
|
3042
3029
|
event.preventDefault();
|
|
3043
3030
|
this.dismiss();
|
|
3044
3031
|
});
|
|
@@ -3170,7 +3157,7 @@ OdxNavigationItem = __decorateClass$y([
|
|
|
3170
3157
|
customElement("odx-navigation-item", [styles$w])
|
|
3171
3158
|
], OdxNavigationItem);
|
|
3172
3159
|
|
|
3173
|
-
const styles$v = ":host{--_color-background: var(--odx-
|
|
3160
|
+
const styles$v = ":host{--_color-background: var(--odx-color-background-transparent);--_color-foreground: inherit;display:inline-flex;gap:var(--odx-size-75);place-items:center;transition:var(--odx-transition-reduced);transition-property:background-color,color,outline-color;outline:var(--odx-focus-ring-outline);outline-offset:var(--odx-outline-offset-focus);border-radius:var(--odx-border-radius-controls);background-color:var(--_color-background);cursor:pointer;padding:var(--odx-size-37) var(--odx-size-75);color:var(--_color-foreground);user-select:none}odx-checkbox{margin:0}:host(:hover){--_color-background: var(--odx-color-background-transparent-hover)}:host([odx-active]),:host(:active){--_color-background: var(--odx-color-background-transparent-pressed)}:host([selected]){--_color-background: var(--odx-color-background-transparent-selected)}:host([selected]:hover){--_color-background: var(--odx-color-background-transparent-selected-hover)}:host([disabled]){--_color-background: var(--odx-color-background-disabled-rest);--_color-foreground: var(--odx-color-foreground-disabled-rest);cursor:not-allowed;pointer-events:none}:host([selected][disabled]){--_color-background: var(--odx-color-background-disabled-selected);--_color-foreground: var(--odx-color-foreground-disabled-selected)}:host([selected][odx-active]),:host([selected]:active){--_color-background: var(--odx-color-background-transparent-selected-hover)}:host(:focus-visible){outline-color:var(--odx-focus-ring-color)}";
|
|
3174
3161
|
|
|
3175
3162
|
var __defProp$x = Object.defineProperty;
|
|
3176
3163
|
var __getOwnPropDesc$x = Object.getOwnPropertyDescriptor;
|
|
@@ -3199,7 +3186,7 @@ OdxOption = __decorateClass$x([
|
|
|
3199
3186
|
customElement("odx-option", [styles$v])
|
|
3200
3187
|
], OdxOption);
|
|
3201
3188
|
|
|
3202
|
-
const styles$u = ":host{display:grid;grid-template-areas:\"navigation header sidebar\" \"navigation content sidebar\" \"footer footer footer\";grid-template-rows:minmax(0,auto) minmax(0,1fr) minmax(0,auto);grid-template-columns:minmax(0,auto) minmax(0,100%) minmax(0,auto);justify-content:start;padding-inline:var(--odx-size-75);inline-size:100%;max-inline-size:var(--max-inline-size)}.header,.navigation,.sidebar{position:sticky;inset-block-start:var(--scroll-margin-block-start);z-index:98;background-color:var(--odx-color-background-
|
|
3189
|
+
const styles$u = ":host{display:grid;grid-template-areas:\"navigation header sidebar\" \"navigation content sidebar\" \"footer footer footer\";grid-template-rows:minmax(0,auto) minmax(0,1fr) minmax(0,auto);grid-template-columns:minmax(0,auto) minmax(0,100%) minmax(0,auto);justify-content:start;padding-inline:var(--odx-size-75);inline-size:100%;max-inline-size:var(--max-inline-size)}.header,.navigation,.sidebar{position:sticky;inset-block-start:var(--scroll-margin-block-start);z-index:98;background-color:var(--odx-color-background-base)}.navigation,.sidebar{--_size: calc(100dvh - var(--scroll-margin-block-start));inset-block-end:0;max-block-size:var(--_size);overflow:auto}.content{display:flex;flex-direction:column;grid-area:content;margin-block-end:var(--odx-size-150)}.footer{grid-area:footer}.header{grid-area:header}.navigation{grid-area:navigation;padding-inline-end:var(--odx-size-75)}.sidebar{grid-area:sidebar;padding-inline-start:var(--odx-size-75)}";
|
|
3203
3190
|
|
|
3204
3191
|
var __defProp$w = Object.defineProperty;
|
|
3205
3192
|
var __getOwnPropDesc$w = Object.getOwnPropertyDescriptor;
|
|
@@ -3228,7 +3215,7 @@ OdxPageLayout = __decorateClass$w([
|
|
|
3228
3215
|
customElement("odx-page-layout", [styles$u])
|
|
3229
3216
|
], OdxPageLayout);
|
|
3230
3217
|
|
|
3231
|
-
const styles$t = "@layer base{:host{--max-inline-size: var(--odx-page-max-inline-size, 100%);--scroll-margin-block-start: calc(var(--header-size, 0px) + var(--subheader-size, 0px));display:grid;grid-template-areas:\"header\" \"subheader\" \"content\" \"footer\";grid-template-rows:minmax(0,auto) minmax(0,auto) minmax(0,1fr) minmax(0,auto);grid-template-columns:100%;min-block-size:100dvh}.header,.subheader{position:sticky;z-index:99}.subheader,.content{background-color:var(--odx-color-background-
|
|
3218
|
+
const styles$t = "@layer base{:host{--max-inline-size: var(--odx-page-max-inline-size, 100%);--scroll-margin-block-start: calc(var(--header-size, 0px) + var(--subheader-size, 0px));display:grid;grid-template-areas:\"header\" \"subheader\" \"content\" \"footer\";grid-template-rows:minmax(0,auto) minmax(0,auto) minmax(0,1fr) minmax(0,auto);grid-template-columns:100%;min-block-size:100dvh}.header,.subheader{position:sticky;z-index:99}.subheader,.content{background-color:var(--odx-color-background-base);padding-inline:var(--odx-size-75);inline-size:100%;max-inline-size:var(--max-inline-size)}.header{inset-block-start:0;grid-area:header}.subheader{inset-block-start:var(--header-size, 0);grid-area:subheader}.content{grid-area:content;block-size:100%}.footer{grid-area:footer}::slotted(odx-page-layout){min-block-size:100%}}@layer variant{:host([alignment=\"center\"]){.subheader,.content{margin-inline:auto}}:host([layout=\"narrow\"]){--max-inline-size: var(--odx-page-max-inline-size-narrow)}:host([layout=\"wide\"]){--max-inline-size: var(--odx-page-max-inline-size-wide)}}";
|
|
3232
3219
|
|
|
3233
3220
|
var __defProp$v = Object.defineProperty;
|
|
3234
3221
|
var __getOwnPropDesc$v = Object.getOwnPropertyDescriptor;
|
|
@@ -4147,18 +4134,18 @@ let OdxSlider = class extends CustomElement {
|
|
|
4147
4134
|
});
|
|
4148
4135
|
this.context = sliderContext.defaultValue;
|
|
4149
4136
|
__privateAdd$6(this, _handleKeyboardEvent, (event) => {
|
|
4150
|
-
const
|
|
4137
|
+
const key = getKeyInfo(event);
|
|
4151
4138
|
const target = event.target;
|
|
4152
|
-
if (target.localName !== OdxSliderHandle.selector ||
|
|
4139
|
+
if (target.localName !== OdxSliderHandle.selector || key.tab || key.backTab || target.disabled) return;
|
|
4153
4140
|
event.preventDefault();
|
|
4154
4141
|
event.stopPropagation();
|
|
4155
|
-
if (
|
|
4142
|
+
if (key.left || key.down) {
|
|
4156
4143
|
target.value -= this.step;
|
|
4157
|
-
} else if (
|
|
4144
|
+
} else if (key.right || key.up) {
|
|
4158
4145
|
target.value += this.step;
|
|
4159
|
-
} else if (
|
|
4146
|
+
} else if (key.start) {
|
|
4160
4147
|
target.value = this.context.min;
|
|
4161
|
-
} else if (
|
|
4148
|
+
} else if (key.end) {
|
|
4162
4149
|
target.value = this.context.max;
|
|
4163
4150
|
}
|
|
4164
4151
|
});
|
|
@@ -4972,7 +4959,7 @@ OdxToast = __decorateClass$5([
|
|
|
4972
4959
|
customElement("odx-toast", [styles$4])
|
|
4973
4960
|
], OdxToast);
|
|
4974
4961
|
|
|
4975
|
-
const styles$3 = ":host{--_border-radius: var(--odx-border-radius-sm);--_color-background: transparent;--_color-stroke: var(--odx-color-stroke-control-rest);--_color-foreground: var(--odx-color-foreground-rest);--_size: var(--odx-size-225);--_padding-inline: var(--odx-size-75);display:inline-flex;position:relative;place-items:center;transition:var(--odx-transition-default);transition-property:color,background-color,border-color,outline-color;margin:var(--odx-size-37);outline:var(--odx-focus-ring-outline);outline-offset:var(--odx-focus-ring-offset);
|
|
4962
|
+
const styles$3 = ":host{--_border-radius: var(--odx-border-radius-sm);--_color-background: transparent;--_color-stroke: var(--odx-color-stroke-control-rest);--_color-foreground: var(--odx-color-foreground-rest);--_size: var(--odx-size-225);--_padding-inline: var(--odx-size-75);display:inline-flex;position:relative;place-items:center;transition:var(--odx-transition-default);transition-property:color,background-color,border-color,outline-color;margin:var(--odx-size-37);outline:var(--odx-focus-ring-outline);outline-offset:var(--odx-focus-ring-offset);border:var(--odx-border-width-thin) solid var(--_color-stroke);border-radius:var(--odx-border-radius-controls);background-color:var(--_color-background);cursor:pointer;padding-inline:var(--_padding-inline);block-size:var(--_size);color:var(--_color-foreground);font-weight:var(--odx-typography-font-weight-medium);user-select:none}:host::part(label){display:inline-block}:host(:hover){--_color-background: var(--odx-color-background-control-hover);--_color-stroke: var(--odx-color-stroke-control-hover)}:host(:focus-visible){outline-color:var(--odx-focus-ring-color)}:host([pressed]){--_color-background: var(--odx-color-background-control-selected);--_color-foreground: var(--odx-color-foreground-inverse-static);--_color-stroke: var(--odx-color-stroke-control-selected)}:host([pressed]:not(:is([readonly],[disabled])):hover){--_color-background: var(--odx-color-background-control-selected-hover)}:host([disabled]){--_color-background: var(--odx-color-background-disabled-rest);--_color-foreground: var(--odx-color-foreground-disabled-rest);--_color-stroke: var(--odx-color-disabled-stroke);cursor:not-allowed}:host([readonly]){--_color-background: var(--odx-color-background-control-readonly);--_color-foreground: var(--odx-color-selection-control-foreground-readonly);--_color-stroke: var(--odx-color-stroke-control-readonly);cursor:default}:host([pressed][disabled]){--_color-background: var(--odx-color-background-disabled-selected);--_color-foreground: var(--odx-color-foreground-disabled-selected)}";
|
|
4976
4963
|
|
|
4977
4964
|
var __defProp$4 = Object.defineProperty;
|
|
4978
4965
|
var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
|
package/dist/i18n.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { signal, effect, computed, SignalWatcher } from '@lit-labs/preact-signals';
|
|
2
2
|
import { parseDate, dedupeMixin } from '@odx/foundation';
|
|
3
3
|
import { property } from 'lit/decorators.js';
|
|
4
|
-
import {
|
|
4
|
+
import { g as flattenObject } from './vendor-CUYBdPCu.js';
|
|
5
5
|
|
|
6
6
|
const I18nConfig = (config) => ({
|
|
7
7
|
defaultLocale: () => navigator.language,
|
package/dist/loader.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
async function defineCustomElements() {
|
|
1
|
+
(async function defineCustomElements() {
|
|
2
2
|
const { OdxPopover } = await import('@odx/foundation');
|
|
3
3
|
const components = Object.values(await import('@odx/foundation/components'));
|
|
4
4
|
for (const entry of [OdxPopover, ...components]) {
|
|
5
|
-
if (typeof entry !== "function" || !("define" in entry)) continue;
|
|
6
|
-
entry.define
|
|
5
|
+
if (typeof entry !== "function" || !("define" in entry) || typeof entry.define !== "function") continue;
|
|
6
|
+
entry.define();
|
|
7
7
|
}
|
|
8
|
-
}
|
|
9
|
-
defineCustomElements();
|
|
10
|
-
|
|
11
|
-
export { defineCustomElements };
|
|
8
|
+
})();
|
package/dist/main.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { LitElement, html, unsafeCSS, isServer, nothing } from 'lit';
|
|
2
2
|
import { property, queryAssignedElements, query, state } from 'lit/decorators.js';
|
|
3
|
-
import { u as uniqBy, r as round, R as RovingTabindexController, m as minBy } from './vendor-
|
|
4
|
-
export { p as enumFrom } from './vendor-
|
|
5
|
-
import { createFocusTrap } from 'focus-trap';
|
|
6
|
-
import { arrow, flip, computePosition, offset, shift, size, hide, autoUpdate } from '@floating-ui/dom';
|
|
3
|
+
import { u as uniqBy, r as round, R as RovingTabindexController, m as minBy, c as computePosition, o as offset, s as shift, f as flip, a as size, b as arrow, h as hide, d as autoUpdate, t as throttle } from './vendor-CUYBdPCu.js';
|
|
4
|
+
export { p as enumFrom } from './vendor-CUYBdPCu.js';
|
|
7
5
|
import { when } from 'lit/directives/when.js';
|
|
6
|
+
import { createIntersectionObserver as createIntersectionObserver$1, createResizeObserver as createResizeObserver$1 } from '@odx/foundation';
|
|
8
7
|
export { computed, effect } from '@lit-labs/preact-signals';
|
|
9
8
|
|
|
10
9
|
const Shape = {
|
|
@@ -40,17 +39,15 @@ const Variant = {
|
|
|
40
39
|
const customElementStyles = "@layer reset,base,variant,state;@layer reset{:is(*){box-sizing:border-box;scrollbar-width:thin}:not(:defined){display:none}:before,:after{box-sizing:border-box}[popover]{outline:none;border:none}img,picture,video,canvas,svg{display:block;margin:0;max-width:100%}input,button,textarea,select{margin:0;font:inherit}p,h1,h2,h3,h4,h5,h6{overflow-wrap:break-word;margin:0}p{text-wrap:pretty}h1,h2,h3,h4,h5,h6{text-wrap:balance}}@layer base{odx-stack{display:block}.odx-stack{&.odx-stack-horizontal{flex-flow:row}&.odx-stack-wrap{flex-flow:column wrap}&.odx-stack-horizontal.odx-stack-wrap{flex-flow:row wrap}--flow: column;display:flex;flex-flow:var(--flow);max-inline-size:100%;align-items:stretch;justify-content:flex-start;gap:var(--odx-size-75);text-align:start}}@layer base{.odx-align-start{align-items:flex-start}.odx-align-center{align-items:center}.odx-align-end{align-items:end}.odx-justify-start{justify-content:flex-start}.odx-justify-end{justify-content:flex-end}.odx-justify-center{justify-content:center}.odx-justify-space-between{justify-content:space-between}.odx-justify-space-around{justify-content:space-around}.odx-justify-space-evenly{justify-content:space-evenly}}@layer base{.odx-gap-none{gap:0}.odx-gap-xs{gap:var(--odx-size-25)}.odx-gap-sm{gap:var(--odx-size-50)}.odx-gap-md{gap:var(--odx-size-75)}.odx-gap-lg{gap:var(--odx-size-150)}.odx-gap-xl{gap:var(--odx-size-225)}}@layer base{odx-icon{transition:var(--odx-transition-default);transition-property:transform}[odxPreventTextOverflow]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}odx-list-item:has(:is([odx-button],odx-list-item::part(control)):not([disabled]):active){--_color-background-pressed: var(--_color-background-hover)}[odx-button]:has(odx-icon:only-child),[odx-button]:has(odx-avatar:only-child){--_min-inline-size: 0}[indicator-position=start] odx-accordion-item::part(indicator){--rotate: -90deg;order:-1}[indicator-position=start] odx-accordion-item[expanded]::part(indicator){--rotate: 0}odx-input:has([slot=suffix])::part(base){padding-inline-end:var(--odx-size-px)}}@layer reset{:host{border:none;border-color:transparent;outline:none}}";
|
|
41
40
|
|
|
42
41
|
function mergeStyleSheets(...stylesheets) {
|
|
43
|
-
const mergedStyles =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
mergedStyles.push(typeof styles === "string" ? unsafeCSS(styles) : styles);
|
|
47
|
-
}
|
|
42
|
+
const mergedStyles = stylesheets.filter(Boolean).map((styles) => {
|
|
43
|
+
return typeof styles === "string" ? unsafeCSS(styles) : styles;
|
|
44
|
+
});
|
|
48
45
|
return uniqBy(mergedStyles.flat(3), String);
|
|
49
46
|
}
|
|
50
47
|
function customElement(selector, styles = []) {
|
|
51
48
|
return (target) => {
|
|
52
49
|
target.selector = selector;
|
|
53
|
-
target.styles = mergeStyleSheets(customElementStyles, target.styles, ...styles);
|
|
50
|
+
target.styles = mergeStyleSheets(customElementStyles, target.styles ?? "", ...styles);
|
|
54
51
|
target.define = () => {
|
|
55
52
|
if (customElements.get(selector)) return;
|
|
56
53
|
customElements.define(selector, target);
|
|
@@ -99,6 +96,13 @@ function parseDate(value) {
|
|
|
99
96
|
}
|
|
100
97
|
return Number.isNaN(date.getTime()) ? null : date;
|
|
101
98
|
}
|
|
99
|
+
function createIntersectionObserver(callback, options) {
|
|
100
|
+
try {
|
|
101
|
+
return new IntersectionObserver(callback, options);
|
|
102
|
+
} catch {
|
|
103
|
+
return { root: null, rootMargin: "", thresholds: [], takeRecords: () => [], observe: () => void 0, disconnect: () => void 0, unobserve: () => void 0 };
|
|
104
|
+
}
|
|
105
|
+
}
|
|
102
106
|
function createMutationObserver(callback) {
|
|
103
107
|
try {
|
|
104
108
|
return new MutationObserver(callback);
|
|
@@ -106,6 +110,13 @@ function createMutationObserver(callback) {
|
|
|
106
110
|
return { takeRecords: () => [], observe: () => void 0, disconnect: () => void 0 };
|
|
107
111
|
}
|
|
108
112
|
}
|
|
113
|
+
function createResizeObserver(callback) {
|
|
114
|
+
try {
|
|
115
|
+
return new ResizeObserver(callback);
|
|
116
|
+
} catch {
|
|
117
|
+
return { observe: () => void 0, disconnect: () => void 0, unobserve: () => void 0 };
|
|
118
|
+
}
|
|
119
|
+
}
|
|
109
120
|
function findClosestDocument(node) {
|
|
110
121
|
let parent = node.parentNode;
|
|
111
122
|
while (parent && parent.nodeType !== Node.DOCUMENT_FRAGMENT_NODE && parent.nodeType !== Node.DOCUMENT_NODE) {
|
|
@@ -151,15 +162,6 @@ function fromAriaBooleanAttribute(value) {
|
|
|
151
162
|
function toPx(value) {
|
|
152
163
|
return Number.isNaN(Number(value)) ? null : `${round(Number(value), 2)}px`;
|
|
153
164
|
}
|
|
154
|
-
function limit(fn, fpsLimit = 60) {
|
|
155
|
-
let lastUpdate = 0;
|
|
156
|
-
return (...args) => {
|
|
157
|
-
const now = performance.now();
|
|
158
|
-
if (now - lastUpdate < 1e3 / fpsLimit) return;
|
|
159
|
-
lastUpdate = now;
|
|
160
|
-
fn(...args);
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
165
|
function getAssignedElement(root, options) {
|
|
164
166
|
const { slot, selector } = options ?? {};
|
|
165
167
|
const slotSelector = `slot${slot ? `[name=${slot}]` : ":not([name])"}`;
|
|
@@ -298,44 +300,20 @@ const FormControl = dedupeMixin((superClass) => {
|
|
|
298
300
|
return FormControlElement;
|
|
299
301
|
});
|
|
300
302
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
ARROW_DOWN: "ArrowDown",
|
|
304
|
-
ARROW_LEFT: "ArrowLeft",
|
|
305
|
-
ARROW_RIGHT: "ArrowRight",
|
|
306
|
-
ENTER: "Enter",
|
|
307
|
-
ESCAPE: "Escape",
|
|
308
|
-
SPACE: " ",
|
|
309
|
-
TAB: "Tab",
|
|
310
|
-
BACKSPACE: "Backspace",
|
|
311
|
-
DELETE: "Delete",
|
|
312
|
-
END: "End",
|
|
313
|
-
HOME: "Home",
|
|
314
|
-
PAGE_UP: "PageUp",
|
|
315
|
-
PAGE_DOWN: "PageDown",
|
|
316
|
-
SHIFT: "Shift",
|
|
317
|
-
CONTROL: "Control",
|
|
318
|
-
ALT: "Alt",
|
|
319
|
-
META: "Meta"
|
|
320
|
-
};
|
|
321
|
-
function getKeyboardEventInfo(event) {
|
|
322
|
-
const { key } = event;
|
|
323
|
-
const up = key === KeyboardKey.ARROW_UP;
|
|
324
|
-
const right = key === KeyboardKey.ARROW_RIGHT;
|
|
325
|
-
const down = key === KeyboardKey.ARROW_DOWN;
|
|
326
|
-
const left = key === KeyboardKey.ARROW_LEFT;
|
|
303
|
+
function getKeyInfo(event) {
|
|
304
|
+
const { key, shiftKey } = event;
|
|
327
305
|
return {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
306
|
+
up: key === "ArrowUp",
|
|
307
|
+
right: key === "ArrowRight",
|
|
308
|
+
down: key === "ArrowDown",
|
|
309
|
+
left: key === "ArrowLeft",
|
|
310
|
+
enter: key === "Enter",
|
|
311
|
+
escape: key === "Escape",
|
|
312
|
+
space: key === "Space",
|
|
313
|
+
tab: !shiftKey && key === "Tab",
|
|
314
|
+
backTab: shiftKey && key === "Tab",
|
|
315
|
+
start: key === "Home",
|
|
316
|
+
end: key === "End"
|
|
339
317
|
};
|
|
340
318
|
}
|
|
341
319
|
|
|
@@ -361,8 +339,8 @@ class CheckboxFormControl extends FormControl(CustomElement) {
|
|
|
361
339
|
this.toggle(void 0, true);
|
|
362
340
|
};
|
|
363
341
|
this.#handleKeyboardEvent = (event) => {
|
|
364
|
-
const
|
|
365
|
-
if (!
|
|
342
|
+
const key = getKeyInfo(event);
|
|
343
|
+
if (!key.enter && !key.space) return;
|
|
366
344
|
const { localName } = event.target;
|
|
367
345
|
event.preventDefault();
|
|
368
346
|
if (event.type === "keydown" || LINK_SELECTORS.has(localName)) return;
|
|
@@ -578,16 +556,16 @@ class ActiveDescendantsController {
|
|
|
578
556
|
this.#options.onChange?.(previousActiveItem, activeItem, previousActiveItem === void 0 && !!activeItem);
|
|
579
557
|
}
|
|
580
558
|
#handleKeyboardEvent = (event) => {
|
|
581
|
-
const
|
|
582
|
-
if (!
|
|
559
|
+
const key = getKeyInfo(event);
|
|
560
|
+
if (!key.up && !key.down && !key.start && !key.end) return;
|
|
583
561
|
event.preventDefault();
|
|
584
|
-
if (
|
|
562
|
+
if (key.down) {
|
|
585
563
|
this.next();
|
|
586
|
-
} else if (
|
|
564
|
+
} else if (key.up) {
|
|
587
565
|
this.previous();
|
|
588
|
-
} else if (
|
|
566
|
+
} else if (key.start) {
|
|
589
567
|
this.first();
|
|
590
|
-
} else if (
|
|
568
|
+
} else if (key.end) {
|
|
591
569
|
this.last();
|
|
592
570
|
}
|
|
593
571
|
};
|
|
@@ -729,8 +707,8 @@ class ListboxFormControl extends FormControl(CustomElement) {
|
|
|
729
707
|
if (event.target !== this) return;
|
|
730
708
|
const activeOption = this.activeDescendants.activeItem;
|
|
731
709
|
if (!activeOption) return;
|
|
732
|
-
const
|
|
733
|
-
if (!
|
|
710
|
+
const key = getKeyInfo(event);
|
|
711
|
+
if (!key.enter && !key.space) return;
|
|
734
712
|
if (this.multiple) {
|
|
735
713
|
event.stopPropagation();
|
|
736
714
|
event.stopImmediatePropagation();
|
|
@@ -959,55 +937,6 @@ class ExpandableItemManager {
|
|
|
959
937
|
};
|
|
960
938
|
}
|
|
961
939
|
|
|
962
|
-
const FocusTrapControllerOptions = (options) => ({
|
|
963
|
-
escapeDeactivates: false,
|
|
964
|
-
tabbableOptions: { getShadowRoot: true },
|
|
965
|
-
...options
|
|
966
|
-
});
|
|
967
|
-
class FocusTrapController {
|
|
968
|
-
#host;
|
|
969
|
-
#options;
|
|
970
|
-
#focusTrap;
|
|
971
|
-
constructor(host, options) {
|
|
972
|
-
this.#host = host;
|
|
973
|
-
this.#options = FocusTrapControllerOptions(options);
|
|
974
|
-
this.#host.addController(this);
|
|
975
|
-
}
|
|
976
|
-
async activate() {
|
|
977
|
-
await this.#host.updateComplete;
|
|
978
|
-
this.#focusTrap?.activate();
|
|
979
|
-
}
|
|
980
|
-
async deactivate() {
|
|
981
|
-
await this.#host.updateComplete;
|
|
982
|
-
this.#focusTrap?.deactivate();
|
|
983
|
-
}
|
|
984
|
-
async toggle(state) {
|
|
985
|
-
if (state ?? !this.#focusTrap?.active) {
|
|
986
|
-
return this.activate();
|
|
987
|
-
}
|
|
988
|
-
return this.deactivate();
|
|
989
|
-
}
|
|
990
|
-
async hostConnected() {
|
|
991
|
-
await this.#host.updateComplete;
|
|
992
|
-
this.#focusTrap ??= createFocusTrap(this.#host, {
|
|
993
|
-
...this.#options,
|
|
994
|
-
checkCanFocusTrap: this.#checkCanFocusTrap.bind(this),
|
|
995
|
-
checkCanReturnFocus: this.#checkCanReturnFocus.bind(this)
|
|
996
|
-
});
|
|
997
|
-
}
|
|
998
|
-
hostDisconnected() {
|
|
999
|
-
this.deactivate();
|
|
1000
|
-
}
|
|
1001
|
-
async #checkCanFocusTrap(containers) {
|
|
1002
|
-
await waitForAnimations(this.#host);
|
|
1003
|
-
await this.#options.checkCanFocusTrap?.(containers);
|
|
1004
|
-
}
|
|
1005
|
-
async #checkCanReturnFocus(trigger) {
|
|
1006
|
-
await waitForAnimations(this.#host);
|
|
1007
|
-
await this.#options.checkCanReturnFocus?.(trigger);
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
940
|
var __defProp$8 = Object.defineProperty;
|
|
1012
941
|
var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
|
|
1013
942
|
var __decorateClass$8 = (decorators, target, key, kind) => {
|
|
@@ -1586,7 +1515,7 @@ class PopoverHost extends CanBeDisabled(CustomElement) {
|
|
|
1586
1515
|
this.#positionUpdater = autoUpdate(
|
|
1587
1516
|
this.referenceElement,
|
|
1588
1517
|
this,
|
|
1589
|
-
|
|
1518
|
+
throttle(() => this.referenceElement && computePopoverPlacement(this.referenceElement, this, this.options), 1e3 / 30),
|
|
1590
1519
|
{ animationFrame: true }
|
|
1591
1520
|
);
|
|
1592
1521
|
}
|
|
@@ -1702,79 +1631,46 @@ function searchTextContent(options) {
|
|
|
1702
1631
|
return ranges;
|
|
1703
1632
|
}
|
|
1704
1633
|
|
|
1705
|
-
function createIntersectionObserver(callback, options) {
|
|
1706
|
-
try {
|
|
1707
|
-
return new IntersectionObserver(callback, options);
|
|
1708
|
-
} catch {
|
|
1709
|
-
return { root: null, rootMargin: "", thresholds: [], takeRecords: () => [], observe: () => void 0, disconnect: () => void 0, unobserve: () => void 0 };
|
|
1710
|
-
}
|
|
1711
|
-
}
|
|
1712
1634
|
class SharedIntersectionObserverInstance {
|
|
1713
1635
|
#observer;
|
|
1714
1636
|
#handlers = /* @__PURE__ */ new WeakMap();
|
|
1715
|
-
#updateLog = /* @__PURE__ */ new WeakMap();
|
|
1716
1637
|
observe(target, handler, options = { fpsLimit: 60 }) {
|
|
1717
|
-
this.#observer ??= createIntersectionObserver(this.#handleIntersection);
|
|
1718
1638
|
this.unobserve(target);
|
|
1719
|
-
this.#handlers.set(target,
|
|
1639
|
+
this.#handlers.set(target, throttle(handler, 1e3 / options.fpsLimit));
|
|
1640
|
+
this.#observer ??= createIntersectionObserver$1((entries) => {
|
|
1641
|
+
if (!this.#observer) return;
|
|
1642
|
+
for (const entry of entries) {
|
|
1643
|
+
this.#handlers.get(entry.target)?.([entry], this.#observer);
|
|
1644
|
+
}
|
|
1645
|
+
});
|
|
1720
1646
|
this.#observer.observe(target);
|
|
1721
1647
|
}
|
|
1722
1648
|
unobserve(target) {
|
|
1723
1649
|
this.#observer?.unobserve(target);
|
|
1724
1650
|
this.#handlers.delete(target);
|
|
1725
1651
|
}
|
|
1726
|
-
#handleIntersection = (entries) => {
|
|
1727
|
-
if (!this.#observer) return;
|
|
1728
|
-
for (const entry of entries) {
|
|
1729
|
-
const [handler, fpsLimit] = this.#handlers.get(entry.target) ?? [];
|
|
1730
|
-
if (typeof handler !== "function" || !this.#shouldUpdate(entry.target, fpsLimit)) continue;
|
|
1731
|
-
handler?.([entry], this.#observer);
|
|
1732
|
-
this.#updateLog.set(entry.target, performance.now());
|
|
1733
|
-
}
|
|
1734
|
-
};
|
|
1735
|
-
#shouldUpdate(target, fpsLimit) {
|
|
1736
|
-
if (!target.isConnected || typeof fpsLimit !== "number" || fpsLimit < 1) return false;
|
|
1737
|
-
return performance.now() - (this.#updateLog.get(target) ?? 0) >= 1e3 / fpsLimit;
|
|
1738
|
-
}
|
|
1739
1652
|
}
|
|
1740
1653
|
const SharedIntersectionObserver = new SharedIntersectionObserverInstance();
|
|
1741
1654
|
|
|
1742
|
-
function createResizeObserver(callback) {
|
|
1743
|
-
try {
|
|
1744
|
-
return new ResizeObserver(callback);
|
|
1745
|
-
} catch {
|
|
1746
|
-
return { observe: () => void 0, disconnect: () => void 0, unobserve: () => void 0 };
|
|
1747
|
-
}
|
|
1748
|
-
}
|
|
1749
1655
|
class SharedResizeObserverInstance {
|
|
1750
1656
|
#observer;
|
|
1751
1657
|
#handlers = /* @__PURE__ */ new WeakMap();
|
|
1752
|
-
#updateLog = /* @__PURE__ */ new WeakMap();
|
|
1753
1658
|
observe(target, handler, options = { fpsLimit: 30 }) {
|
|
1754
1659
|
this.unobserve(target);
|
|
1755
|
-
|
|
1756
|
-
this.#observer ??= createResizeObserver(
|
|
1757
|
-
|
|
1758
|
-
|
|
1660
|
+
this.#handlers.set(target, throttle(handler, 1e3 / options.fpsLimit));
|
|
1661
|
+
this.#observer ??= createResizeObserver$1((entries) => {
|
|
1662
|
+
if (!this.#observer) return;
|
|
1663
|
+
for (const entry of entries) {
|
|
1664
|
+
this.#handlers.get(entry.target)?.([entry], this.#observer);
|
|
1665
|
+
}
|
|
1666
|
+
});
|
|
1667
|
+
this.#observer.observe(target, options);
|
|
1759
1668
|
}
|
|
1760
1669
|
unobserve(target) {
|
|
1761
1670
|
this.#observer?.unobserve(target);
|
|
1762
1671
|
this.#handlers.delete(target);
|
|
1763
1672
|
}
|
|
1764
|
-
#handleResize = (entries) => {
|
|
1765
|
-
if (!this.#observer) return;
|
|
1766
|
-
for (const entry of entries) {
|
|
1767
|
-
const [handler, fpsLimit] = this.#handlers.get(entry.target) ?? [];
|
|
1768
|
-
if (typeof handler !== "function" || !this.#shouldUpdate(entry.target, fpsLimit ?? 60)) continue;
|
|
1769
|
-
handler?.([entry], this.#observer);
|
|
1770
|
-
this.#updateLog.set(entry.target, performance.now());
|
|
1771
|
-
}
|
|
1772
|
-
};
|
|
1773
|
-
#shouldUpdate(target, fpsLimit) {
|
|
1774
|
-
if (!target.isConnected || fpsLimit < 1) return false;
|
|
1775
|
-
return performance.now() - (this.#updateLog.get(target) ?? 0) >= 1e3 / fpsLimit;
|
|
1776
|
-
}
|
|
1777
1673
|
}
|
|
1778
1674
|
const SharedResizeObserver = new SharedResizeObserverInstance();
|
|
1779
1675
|
|
|
1780
|
-
export { ActiveDescendant, ActiveDescendantsController, ActiveDescendantsControllerOptions, CanBeDisabled, CanBeExpanded, CanBeSelected, CheckboxFormControl, CheckboxGroupFormControl, CustomElement, DragController, DragControllerOptions, ExpandableItemManager, ExpandableItemManagerOptions,
|
|
1676
|
+
export { ActiveDescendant, ActiveDescendantsController, ActiveDescendantsControllerOptions, CanBeDisabled, CanBeExpanded, CanBeSelected, CheckboxFormControl, CheckboxGroupFormControl, CustomElement, DragController, DragControllerOptions, ExpandableItemManager, ExpandableItemManagerOptions, FormControl, IS_DRAG_ACTIVE_ATTRIBUTE, InteractiveElement, InteractiveLink, IsDraggable, ListboxFormControl, NumberControl, OdxPopover, OptionControl, PopoverHost, PopoverPlacement, PopoverPlacementOptions, PopoverSide, RadioGroupFormControl, Shape, SharedIntersectionObserver, SharedResizeObserver, Size, State, Variant, WithLoadingState, clearUniqueIdCache, createIntersectionObserver, createMutationObserver, createResizeObserver, customElement, dedupeMixin, findClosestDocument, forwardEvent, fromAriaBooleanAttribute, getAssignedElement, getElementFromEvent, getKeyInfo, getUniqueId, isDraggableElement, optionalAttr, optionalSlot, parseDate, requestUpdateOnAriaChange, searchTextContent, toAriaBooleanAttribute, toPx, toggleAttribute, waitForAnimations };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { CustomElement,
|
|
1
|
+
import { CustomElement, EnumValues } from '../../lib/main.js';
|
|
2
2
|
import { OdxAccordionItem } from '../accordion-item/accordion-item.js';
|
|
3
3
|
declare global {
|
|
4
4
|
interface HTMLElementTagNameMap {
|
|
5
5
|
'odx-accordion': OdxAccordion;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
export type AccordionIndicatorPosition =
|
|
8
|
+
export type AccordionIndicatorPosition = EnumValues<typeof AccordionIndicatorPosition>;
|
|
9
9
|
export declare const AccordionIndicatorPosition: {
|
|
10
10
|
readonly start: "start";
|
|
11
11
|
readonly end: "end";
|