@odx/foundation 1.0.0-alpha.6 → 1.0.0-alpha.7
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/README.md +7 -7
- package/dist/cdk.js +345 -0
- package/dist/components/accordion/accordion-header.component.d.ts +1 -1
- package/dist/components/button/base-button.d.ts +1 -1
- package/dist/components/button/button.component.d.ts +1 -1
- package/dist/components/button-group/button-group.component.d.ts +1 -1
- package/dist/components/card/card.component.d.ts +1 -1
- package/dist/components/chip/chip.component.d.ts +1 -1
- package/dist/components/dropdown/dropdown.component.d.ts +2 -2
- package/dist/components/format/format-date.component.d.ts +1 -1
- package/dist/components/format/format-number.component.d.ts +1 -1
- package/dist/components/format/format.component.d.ts +2 -2
- package/dist/components/format/relative-time.component.d.ts +1 -1
- package/dist/components/input/input.component.d.ts +1 -1
- package/dist/components/link/base-link.d.ts +1 -1
- package/dist/components/loading-overlay/loading-overlay.component.d.ts +1 -1
- package/dist/components/menu/menu.component.d.ts +2 -2
- package/dist/components/slider/slider-handle.component.d.ts +2 -2
- package/dist/components/slider/slider.component.d.ts +1 -1
- package/dist/components/spinbox/spinbox.component.d.ts +1 -1
- package/dist/components/tooltip/tooltip.element.d.ts +2 -2
- package/dist/components.js +4284 -0
- package/dist/i18n/lib/translate.d.ts +5 -1
- package/dist/i18n.js +140 -0
- package/dist/main.js +1448 -0
- package/dist/vendor.js +3660 -0
- package/package.json +13 -22
- package/dist/cdk/drag-drop/drag.controller.js +0 -90
- package/dist/cdk/drag-drop/is-draggable.js +0 -42
- package/dist/cdk/main.js +0 -5
- package/dist/cdk/popover/popover-host.mixin.css.js +0 -3
- package/dist/cdk/popover/popover-host.mixin.js +0 -115
- package/dist/cdk/popover/popover.component.css.js +0 -3
- package/dist/cdk/popover/popover.component.js +0 -38
- package/dist/cdk/popover/popover.models.js +0 -32
- package/dist/cdk/popover/popover.utils.js +0 -48
- package/dist/components/accordion/accordion-header.component.css.js +0 -3
- package/dist/components/accordion/accordion-header.component.js +0 -69
- package/dist/components/accordion/accordion-panel.component.css.js +0 -3
- package/dist/components/accordion/accordion-panel.component.js +0 -29
- package/dist/components/accordion/accordion.component.css.js +0 -3
- package/dist/components/accordion/accordion.component.js +0 -83
- package/dist/components/area-header/area-header.component.css.js +0 -3
- package/dist/components/area-header/area-header.component.js +0 -37
- package/dist/components/area-header/area-header.models.js +0 -11
- package/dist/components/avatar/avatar.component.css.js +0 -3
- package/dist/components/avatar/avatar.component.js +0 -31
- package/dist/components/avatar/avatar.models.js +0 -12
- package/dist/components/avatar-group/avatar-group.component.css.js +0 -3
- package/dist/components/avatar-group/avatar-group.component.js +0 -31
- package/dist/components/badge/badge.component.css.js +0 -3
- package/dist/components/badge/badge.component.js +0 -32
- package/dist/components/badge/badge.models.js +0 -10
- package/dist/components/breadcrumbs/breadcrumbs-item.component.css.js +0 -3
- package/dist/components/breadcrumbs/breadcrumbs-item.component.js +0 -56
- package/dist/components/breadcrumbs/breadcrumbs.component.css.js +0 -3
- package/dist/components/breadcrumbs/breadcrumbs.component.js +0 -88
- package/dist/components/button/base-button.css.js +0 -3
- package/dist/components/button/base-button.js +0 -72
- package/dist/components/button/button.component.css.js +0 -3
- package/dist/components/button/button.component.js +0 -66
- package/dist/components/button/button.models.js +0 -16
- package/dist/components/button-group/button-group.component.css.js +0 -3
- package/dist/components/button-group/button-group.component.js +0 -47
- package/dist/components/card/card.component.css.js +0 -3
- package/dist/components/card/card.component.js +0 -30
- package/dist/components/checkbox/checkbox.component.css.js +0 -3
- package/dist/components/checkbox/checkbox.component.js +0 -57
- package/dist/components/checkbox-group/checkbox-group.component.css.js +0 -3
- package/dist/components/checkbox-group/checkbox-group.component.js +0 -54
- package/dist/components/checkbox-group/checkbox-group.models.js +0 -5
- package/dist/components/chip/chip.component.css.js +0 -3
- package/dist/components/chip/chip.component.js +0 -94
- package/dist/components/chip/chip.models.js +0 -10
- package/dist/components/circular-progress-bar/circular-progress-bar.component.css.js +0 -3
- package/dist/components/circular-progress-bar/circular-progress-bar.component.js +0 -123
- package/dist/components/circular-progress-bar/circular-progress-bar.models.js +0 -7
- package/dist/components/content-box/content-box.component.css.js +0 -3
- package/dist/components/content-box/content-box.component.js +0 -26
- package/dist/components/dropdown/dropdown.component.css.js +0 -3
- package/dist/components/dropdown/dropdown.component.js +0 -121
- package/dist/components/dropdown/dropdown.models.js +0 -8
- package/dist/components/form-field/form-field.element.css.js +0 -3
- package/dist/components/form-field/form-field.element.js +0 -62
- package/dist/components/format/format-bytes.component.js +0 -46
- package/dist/components/format/format-date.component.js +0 -36
- package/dist/components/format/format-number.component.js +0 -59
- package/dist/components/format/format.component.js +0 -34
- package/dist/components/format/relative-time.component.js +0 -80
- package/dist/components/header/header-actions.component.css.js +0 -3
- package/dist/components/header/header-actions.component.js +0 -22
- package/dist/components/header/header.component.css.js +0 -3
- package/dist/components/header/header.component.js +0 -58
- package/dist/components/headline/headline.component.css.js +0 -3
- package/dist/components/headline/headline.component.js +0 -31
- package/dist/components/headline/headline.models.js +0 -8
- package/dist/components/icon-button/icon-button.component.js +0 -34
- package/dist/components/inline-message/inline-message.component.css.js +0 -3
- package/dist/components/inline-message/inline-message.component.js +0 -39
- package/dist/components/inline-message/inline-message.models.js +0 -9
- package/dist/components/input/input.component.css.js +0 -3
- package/dist/components/input/input.component.js +0 -72
- package/dist/components/input/input.models.js +0 -7
- package/dist/components/line-clamp/line-clamp.component.css.js +0 -3
- package/dist/components/line-clamp/line-clamp.component.js +0 -37
- package/dist/components/link/base-link.js +0 -70
- package/dist/components/link/link.component.css.js +0 -3
- package/dist/components/link/link.component.js +0 -33
- package/dist/components/list/list-item.component.css.js +0 -3
- package/dist/components/list/list-item.component.js +0 -33
- package/dist/components/list/list.component.css.js +0 -3
- package/dist/components/list/list.component.js +0 -25
- package/dist/components/loading-overlay/loading-overlay.component.css.js +0 -3
- package/dist/components/loading-overlay/loading-overlay.component.js +0 -78
- package/dist/components/loading-spinner/loading-spinner.component.css.js +0 -3
- package/dist/components/loading-spinner/loading-spinner.component.js +0 -58
- package/dist/components/logo/logo.component.css.js +0 -3
- package/dist/components/logo/logo.component.js +0 -38
- package/dist/components/logo/logo.models.js +0 -9
- package/dist/components/main-menu/main-menu-button.component.js +0 -38
- package/dist/components/main-menu/main-menu-link.component.css.js +0 -3
- package/dist/components/main-menu/main-menu-link.component.js +0 -20
- package/dist/components/main-menu/main-menu-subtitle.component.js +0 -29
- package/dist/components/main-menu/main-menu-title.component.js +0 -29
- package/dist/components/main-menu/main-menu.component.css.js +0 -3
- package/dist/components/main-menu/main-menu.component.js +0 -82
- package/dist/components/main.js +0 -102
- package/dist/components/menu/menu-label.component.css.js +0 -3
- package/dist/components/menu/menu-label.component.js +0 -18
- package/dist/components/menu/menu.component.css.js +0 -3
- package/dist/components/menu/menu.component.js +0 -111
- package/dist/components/menu-item/menu-item.component.css.js +0 -3
- package/dist/components/menu-item/menu-item.component.js +0 -45
- package/dist/components/navigation-item/navigation-item.component.css.js +0 -3
- package/dist/components/navigation-item/navigation-item.component.js +0 -43
- package/dist/components/navigation-item/navigation-item.models.js +0 -6
- package/dist/components/option/option.component.css.js +0 -3
- package/dist/components/option/option.component.js +0 -37
- package/dist/components/page/page.component.css.js +0 -3
- package/dist/components/page/page.component.js +0 -53
- package/dist/components/page/page.models.js +0 -9
- package/dist/components/page-layout/page-layout.component.css.js +0 -3
- package/dist/components/page-layout/page-layout.component.js +0 -28
- package/dist/components/progress-bar/progress-bar.component.css.js +0 -3
- package/dist/components/progress-bar/progress-bar.component.js +0 -89
- package/dist/components/progress-bar/progress-bar.models.js +0 -7
- package/dist/components/radio-button/radio-button.component.css.js +0 -3
- package/dist/components/radio-button/radio-button.component.js +0 -39
- package/dist/components/radio-group/radio-group.component.css.js +0 -3
- package/dist/components/radio-group/radio-group.component.js +0 -24
- package/dist/components/radio-group/radio-group.models.js +0 -5
- package/dist/components/rail-navigation/rail-navigation.component.css.js +0 -3
- package/dist/components/rail-navigation/rail-navigation.component.js +0 -65
- package/dist/components/search-bar/search-bar.component.css.js +0 -3
- package/dist/components/search-bar/search-bar.component.js +0 -100
- package/dist/components/search-bar/search-bar.events.js +0 -7
- package/dist/components/search-bar/search-bar.models.js +0 -6
- package/dist/components/select/select.component.css.js +0 -3
- package/dist/components/select/select.component.js +0 -101
- package/dist/components/separator/separator.component.css.js +0 -3
- package/dist/components/separator/separator.component.js +0 -49
- package/dist/components/skeleton/skeleton.component.css.js +0 -3
- package/dist/components/skeleton/skeleton.component.js +0 -32
- package/dist/components/slider/slider-handle.component.css.js +0 -3
- package/dist/components/slider/slider-handle.component.js +0 -168
- package/dist/components/slider/slider-marks.component.css.js +0 -3
- package/dist/components/slider/slider-marks.component.js +0 -61
- package/dist/components/slider/slider.component.css.js +0 -3
- package/dist/components/slider/slider.component.js +0 -119
- package/dist/components/slider/slider.models.js +0 -17
- package/dist/components/spacer/spacer.component.css.js +0 -3
- package/dist/components/spacer/spacer.component.js +0 -39
- package/dist/components/spinbox/spinbox.component.css.js +0 -3
- package/dist/components/spinbox/spinbox.component.js +0 -94
- package/dist/components/stack/stack.component.css.js +0 -3
- package/dist/components/stack/stack.component.js +0 -45
- package/dist/components/stack/stack.models.js +0 -23
- package/dist/components/switch/switch.component.css.js +0 -3
- package/dist/components/switch/switch.component.js +0 -36
- package/dist/components/table/table-body.element.css.js +0 -3
- package/dist/components/table/table-body.element.js +0 -26
- package/dist/components/table/table-cell.element.css.js +0 -3
- package/dist/components/table/table-cell.element.js +0 -26
- package/dist/components/table/table-checkbox-cell.element.css.js +0 -3
- package/dist/components/table/table-checkbox-cell.element.js +0 -66
- package/dist/components/table/table-header-cell.element.css.js +0 -3
- package/dist/components/table/table-header-cell.element.js +0 -40
- package/dist/components/table/table-header.element.css.js +0 -3
- package/dist/components/table/table-header.element.js +0 -52
- package/dist/components/table/table-row.element.css.js +0 -3
- package/dist/components/table/table-row.element.js +0 -111
- package/dist/components/table/table.element.css.js +0 -3
- package/dist/components/table/table.element.js +0 -97
- package/dist/components/text/text.component.css.js +0 -3
- package/dist/components/text/text.component.js +0 -34
- package/dist/components/text/text.models.js +0 -13
- package/dist/components/title/title.component.css.js +0 -3
- package/dist/components/title/title.component.js +0 -31
- package/dist/components/title/title.models.js +0 -10
- package/dist/components/toast/toast.element.css.js +0 -3
- package/dist/components/toast/toast.element.js +0 -31
- package/dist/components/toast/toast.models.js +0 -5
- package/dist/components/toggle-button/toggle-button.component.css.js +0 -3
- package/dist/components/toggle-button/toggle-button.component.js +0 -52
- package/dist/components/tooltip/tooltip.element.css.js +0 -3
- package/dist/components/tooltip/tooltip.element.js +0 -120
- package/dist/components/tooltip/tooltip.models.js +0 -10
- package/dist/components/visually-hidden/visually-hidden.component.css.js +0 -3
- package/dist/components/visually-hidden/visually-hidden.component.js +0 -22
- package/dist/i18n/lib/config.js +0 -16
- package/dist/i18n/lib/format.js +0 -55
- package/dist/i18n/lib/is-localized.mixin.js +0 -41
- package/dist/i18n/lib/localization.js +0 -28
- package/dist/i18n/lib/translate.js +0 -18
- package/dist/i18n/main.js +0 -5
- package/dist/lib/controllers/focus-trap.controller.js +0 -55
- package/dist/lib/custom-element.css.js +0 -3
- package/dist/lib/custom-element.js +0 -27
- package/dist/lib/decorators/request-update-on-aria-change.js +0 -15
- package/dist/lib/directives/aria-boolean-attr.js +0 -9
- package/dist/lib/directives/optional-attr.js +0 -8
- package/dist/lib/directives/optional-slot.js +0 -14
- package/dist/lib/directives/slot-fallback.js +0 -16
- package/dist/lib/external/roving-tabindex.js +0 -386
- package/dist/lib/facade/checkbox-form-control.js +0 -78
- package/dist/lib/facade/checkbox-group-form-control.js +0 -109
- package/dist/lib/facade/option-control.js +0 -49
- package/dist/lib/facade/radio-group-form-control.js +0 -87
- package/dist/lib/facade/select-form-control.js +0 -108
- package/dist/lib/main.js +0 -30
- package/dist/lib/mixins/can-be-disabled.js +0 -60
- package/dist/lib/mixins/can-be-readonly.js +0 -33
- package/dist/lib/mixins/can-be-required.js +0 -33
- package/dist/lib/mixins/can-be-validated.js +0 -32
- package/dist/lib/mixins/dedupe-mixin.js +0 -23
- package/dist/lib/mixins/form-control.js +0 -61
- package/dist/lib/mixins/number-control.js +0 -63
- package/dist/lib/mixins/with-aria-controls.js +0 -43
- package/dist/lib/mixins/with-loading-state.js +0 -33
- package/dist/lib/utils/date.js +0 -10
- package/dist/lib/utils/dom.js +0 -48
- package/dist/lib/utils/get-unique-id.js +0 -15
- package/dist/lib/utils/keyboard-events.js +0 -42
- package/dist/lib/utils/object.js +0 -7
- package/dist/lib/utils/shared-intersection-observer.js +0 -37
- package/dist/lib/utils/shared-resize-observer.js +0 -38
- package/dist/lib/utils/string.js +0 -7
- /package/dist/{lib/main.css → styles.css} +0 -0
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { SignalWatcher, computed } from '@lit-labs/signals';
|
|
2
|
-
import { dedupeMixin } from '@odx/foundation';
|
|
3
|
-
import { property } from 'lit/decorators.js';
|
|
4
|
-
import { formatDate, formatNumber, formatList, formatRelativeTime } from './format.js';
|
|
5
|
-
import { getLocale } from './localization.js';
|
|
6
|
-
|
|
7
|
-
var __defProp = Object.defineProperty;
|
|
8
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
9
|
-
var result = void 0 ;
|
|
10
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
11
|
-
if (decorator = decorators[i])
|
|
12
|
-
result = (decorator(target, key, result) ) || result;
|
|
13
|
-
if (result) __defProp(target, key, result);
|
|
14
|
-
return result;
|
|
15
|
-
};
|
|
16
|
-
const IsLocalized = dedupeMixin((superClass) => {
|
|
17
|
-
class IsLocalizedElement extends SignalWatcher(superClass) {
|
|
18
|
-
constructor() {
|
|
19
|
-
super(...arguments);
|
|
20
|
-
this.locale = computed(() => getLocale(this.lang));
|
|
21
|
-
}
|
|
22
|
-
formatDate(...[input, options]) {
|
|
23
|
-
return formatDate(input, { ...options, locale: options?.locale ?? this.locale.get() });
|
|
24
|
-
}
|
|
25
|
-
formatNumber(...[input, options]) {
|
|
26
|
-
return formatNumber(input, { ...options, locale: options?.locale ?? this.locale.get() });
|
|
27
|
-
}
|
|
28
|
-
formatList(...[input, options]) {
|
|
29
|
-
return formatList(input, { ...options, locale: options?.locale ?? this.locale.get() });
|
|
30
|
-
}
|
|
31
|
-
formatRelativeTime(...[input, options]) {
|
|
32
|
-
return formatRelativeTime(input, { ...options, locale: options?.locale ?? this.locale.get() });
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
__decorateClass([
|
|
36
|
-
property()
|
|
37
|
-
], IsLocalizedElement.prototype, "lang");
|
|
38
|
-
return IsLocalizedElement;
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
export { IsLocalized };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { signal } from '@lit-labs/signals';
|
|
2
|
-
import { createMutationObserver } from '@odx/foundation';
|
|
3
|
-
import { getI18nOptions } from './config.js';
|
|
4
|
-
|
|
5
|
-
const activeLocale = signal(null, { equals: (t, t2) => t?.toString() === t2?.toString() });
|
|
6
|
-
function watchLocaleChanges(root = document.documentElement) {
|
|
7
|
-
const updateLocale = () => activeLocale.set(getLocale(root.lang));
|
|
8
|
-
const observer = createMutationObserver(updateLocale);
|
|
9
|
-
observer.observe(root, { attributes: true, attributeFilter: ["lang"] });
|
|
10
|
-
updateLocale();
|
|
11
|
-
}
|
|
12
|
-
function setLocale(locale) {
|
|
13
|
-
if (locale === null) {
|
|
14
|
-
document.documentElement.lang = getI18nOptions().defaultLocale().toString();
|
|
15
|
-
} else {
|
|
16
|
-
document.documentElement.lang = getLocale(locale).toString();
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
function getLocale(locale) {
|
|
20
|
-
const fallbackLocale = activeLocale.get() || getI18nOptions().defaultLocale();
|
|
21
|
-
try {
|
|
22
|
-
return new Intl.Locale(locale || fallbackLocale);
|
|
23
|
-
} catch {
|
|
24
|
-
return new Intl.Locale(fallbackLocale);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export { getLocale, setLocale, watchLocaleChanges };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { signal, computed } from '@lit-labs/signals';
|
|
2
|
-
import { interpolate } from '@odx/foundation';
|
|
3
|
-
import { getLocale } from './localization.js';
|
|
4
|
-
|
|
5
|
-
const translations = signal({});
|
|
6
|
-
function setTranslation(locale, translation) {
|
|
7
|
-
const { language } = getLocale(locale);
|
|
8
|
-
translations.set({ ...translations.get(), [language]: { ...translations.get()[language], ...translation } });
|
|
9
|
-
}
|
|
10
|
-
function translate(key, context, locale) {
|
|
11
|
-
return computed(() => {
|
|
12
|
-
const translation = translations.get()[getLocale(locale).language];
|
|
13
|
-
if (typeof translation?.[key] !== "string") return key;
|
|
14
|
-
return interpolate(translation[key], { ...translation, ...context });
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { setTranslation, translate };
|
package/dist/i18n/main.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { getI18nOptions, setI18nOptions } from './lib/config.js';
|
|
2
|
-
export { formatDate, formatList, formatNumber, formatRelativeTime } from './lib/format.js';
|
|
3
|
-
export { IsLocalized } from './lib/is-localized.mixin.js';
|
|
4
|
-
export { getLocale, setLocale, watchLocaleChanges } from './lib/localization.js';
|
|
5
|
-
export { setTranslation, translate } from './lib/translate.js';
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { createFocusTrap } from 'focus-trap';
|
|
2
|
-
import { isServer } from 'lit';
|
|
3
|
-
import { waitForAnimations } from '../utils/dom.js';
|
|
4
|
-
import { createOptions } from '../utils/object.js';
|
|
5
|
-
|
|
6
|
-
const FocusTrapControllerOptions = createOptions({
|
|
7
|
-
escapeDeactivates: false,
|
|
8
|
-
tabbableOptions: { getShadowRoot: true }
|
|
9
|
-
});
|
|
10
|
-
class FocusTrapController {
|
|
11
|
-
#host;
|
|
12
|
-
#options;
|
|
13
|
-
#focusTrap;
|
|
14
|
-
constructor(host, options) {
|
|
15
|
-
this.#host = host;
|
|
16
|
-
this.#options = FocusTrapControllerOptions(options);
|
|
17
|
-
this.#host.addController(this);
|
|
18
|
-
}
|
|
19
|
-
async activate() {
|
|
20
|
-
await this.#host.updateComplete;
|
|
21
|
-
this.#focusTrap?.activate();
|
|
22
|
-
}
|
|
23
|
-
async deactivate() {
|
|
24
|
-
await this.#host.updateComplete;
|
|
25
|
-
this.#focusTrap?.deactivate();
|
|
26
|
-
}
|
|
27
|
-
async toggle(state) {
|
|
28
|
-
if (state ?? !this.#focusTrap?.active) {
|
|
29
|
-
return this.activate();
|
|
30
|
-
}
|
|
31
|
-
return this.deactivate();
|
|
32
|
-
}
|
|
33
|
-
async hostConnected() {
|
|
34
|
-
if (isServer) return;
|
|
35
|
-
await this.#host.updateComplete;
|
|
36
|
-
this.#focusTrap ??= createFocusTrap(this.#host, {
|
|
37
|
-
...this.#options,
|
|
38
|
-
checkCanFocusTrap: this.#checkCanFocusTrap.bind(this),
|
|
39
|
-
checkCanReturnFocus: this.#checkCanReturnFocus.bind(this)
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
hostDisconnected() {
|
|
43
|
-
this.deactivate();
|
|
44
|
-
}
|
|
45
|
-
async #checkCanFocusTrap(containers) {
|
|
46
|
-
await waitForAnimations(this.#host);
|
|
47
|
-
await this.#options.checkCanFocusTrap?.(containers);
|
|
48
|
-
}
|
|
49
|
-
async #checkCanReturnFocus(trigger) {
|
|
50
|
-
await waitForAnimations(this.#host);
|
|
51
|
-
await this.#options.checkCanReturnFocus?.(trigger);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export { FocusTrapController };
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const customElementStyles = "@layer reset,base,variant,state,theme,override;@layer reset{:where(*,*:before,*:after){box-sizing:border-box}body{line-height:1.5;-webkit-font-smoothing:antialiased}img,picture,video,canvas,svg{display:block;max-width:100%;margin:0}input,button,textarea,select{font:inherit;margin:0}p,h1,h2,h3,h4,h5,h6{overflow-wrap:break-word;margin:0}p{text-wrap:pretty;margin:0}h1,h2,h3,h4,h5,h6{text-wrap:balance;margin:0}#root,#__next{isolation:isolate;margin:0}}@layer base{*{scrollbar-color:var(--odx-color-neutral-rest) var(--odx-palette-transparent)}:where(*:not(body)){scrollbar-width:thin}}@layer base{h1,h2,h3,h4,h5,h6{display:block;font-family:var(--odx-typography-font-family-brand);font-size:var(--_font-size);font-weight:var(--odx-typography-font-weight-semibold);line-height:var(--_line-height);color:inherit}h6{--_font-size: var(--odx-breakpoint-font-size-heading-6);--_line-height: var(--odx-breakpoint-line-height-heading-6)}h5{--_font-size: var(--odx-breakpoint-font-size-heading-5);--_line-height: var(--odx-breakpoint-line-height-heading-5)}h4{--_font-size: var(--odx-breakpoint-font-size-heading-4);--_line-height: var(--odx-breakpoint-line-height-heading-4)}h3{--_font-size: var(--odx-breakpoint-font-size-heading-3);--_line-height: var(--odx-breakpoint-line-height-heading-3)}h2{--_font-size: var(--odx-breakpoint-font-size-heading-2);--_line-height: var(--odx-breakpoint-line-height-heading-2)}h1{--_font-size: var(--odx-breakpoint-font-size-heading-1);--_line-height: var(--odx-breakpoint-line-height-heading-1)}[odxPreventTextOverflow]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}}@layer reset{:where(:host){box-sizing:border-box;border:none;color:inherit;outline:none}}";
|
|
2
|
-
|
|
3
|
-
export { customElementStyles as default };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { LitElement, html, unsafeCSS, CSSResult } from 'lit';
|
|
2
|
-
import customElementStyles from './custom-element.css.js';
|
|
3
|
-
|
|
4
|
-
function toCSSResult(value) {
|
|
5
|
-
return value instanceof CSSResult || value instanceof CSSStyleSheet ? value : unsafeCSS(value);
|
|
6
|
-
}
|
|
7
|
-
function customElement(selector, styles = []) {
|
|
8
|
-
if (selector && globalThis.customElements.get(selector)) return () => void 0;
|
|
9
|
-
const preparedStyles = [customElementStyles, styles].map(toCSSResult);
|
|
10
|
-
return (target) => {
|
|
11
|
-
target.styles = target.styles ? [target.styles, preparedStyles].flat() : preparedStyles;
|
|
12
|
-
if (selector) {
|
|
13
|
-
target.selector = selector;
|
|
14
|
-
customElements.define(target.selector, target);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
class CustomElement extends LitElement {
|
|
19
|
-
render() {
|
|
20
|
-
return html`<slot></slot>`;
|
|
21
|
-
}
|
|
22
|
-
emit(event, eventInit) {
|
|
23
|
-
return !this.dispatchEvent(new CustomEvent(event, { bubbles: true, composed: true, cancelable: true, ...eventInit }));
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export { CustomElement, customElement };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
function ariaPropertyToAttribute(property) {
|
|
2
|
-
return property.replace("aria", "aria-").replace(/Elements?/g, "").toLowerCase();
|
|
3
|
-
}
|
|
4
|
-
function requestUpdateOnAriaChange(ariaProperties) {
|
|
5
|
-
return (ctor) => {
|
|
6
|
-
for (const ariaProperty of ariaProperties) {
|
|
7
|
-
ctor.createProperty(ariaProperty, {
|
|
8
|
-
attribute: ariaPropertyToAttribute(ariaProperty),
|
|
9
|
-
reflect: true
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export { requestUpdateOnAriaChange };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
function toAriaBooleanAttribute(value, removeOnFalse = true) {
|
|
2
|
-
if (removeOnFalse && value === false) return null;
|
|
3
|
-
return String(value);
|
|
4
|
-
}
|
|
5
|
-
function fromAriaBooleanAttribute(value) {
|
|
6
|
-
return value === "true";
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export { fromAriaBooleanAttribute, toAriaBooleanAttribute };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { html, nothing } from 'lit';
|
|
2
|
-
|
|
3
|
-
function optionalSlot(host, slotName) {
|
|
4
|
-
if (host.querySelector(`[slot="${slotName}"]`)) {
|
|
5
|
-
return html`
|
|
6
|
-
<div class="${slotName}" part="${slotName}-container">
|
|
7
|
-
<slot name="${slotName}" @slotchange="${() => host.requestUpdate()}"></slot>
|
|
8
|
-
</div>
|
|
9
|
-
`;
|
|
10
|
-
}
|
|
11
|
-
return nothing;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export { optionalSlot };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { directive, Directive } from 'lit/directive.js';
|
|
2
|
-
import { toggleAttribute } from '../utils/dom.js';
|
|
3
|
-
|
|
4
|
-
class SlotFallbackDirective extends Directive {
|
|
5
|
-
update({ options, element }) {
|
|
6
|
-
const host = options?.host;
|
|
7
|
-
if (!host || !(element instanceof HTMLSlotElement)) return;
|
|
8
|
-
const attributeName = ["empty-slot", element.name].filter(Boolean).join("-");
|
|
9
|
-
toggleAttribute(host, attributeName, !host.textContent?.trim() && element.assignedElements().length === 0);
|
|
10
|
-
}
|
|
11
|
-
render() {
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
const emptySlotFallbackFix = directive(SlotFallbackDirective);
|
|
15
|
-
|
|
16
|
-
export { emptySlotFallbackFix };
|
|
@@ -1,386 +0,0 @@
|
|
|
1
|
-
function ensureMethod(value, type, fallback) {
|
|
2
|
-
if (typeof value === type) {
|
|
3
|
-
return () => value;
|
|
4
|
-
} else if (typeof value === "function") {
|
|
5
|
-
return value;
|
|
6
|
-
}
|
|
7
|
-
return fallback;
|
|
8
|
-
}
|
|
9
|
-
class FocusGroupController {
|
|
10
|
-
constructor(host, { hostDelegatesFocus, direction, elementEnterAction, elements, focusInIndex, isFocusableElement, listenerScope } = {
|
|
11
|
-
elements: () => []
|
|
12
|
-
}) {
|
|
13
|
-
this._currentIndex = -1;
|
|
14
|
-
this.prevIndex = -1;
|
|
15
|
-
this._direction = () => "both";
|
|
16
|
-
this.directionLength = 5;
|
|
17
|
-
this.hostDelegatesFocus = false;
|
|
18
|
-
this.elementEnterAction = (_el) => {
|
|
19
|
-
return;
|
|
20
|
-
};
|
|
21
|
-
this._focused = false;
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
23
|
-
this._focusInIndex = (_elements) => 0;
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
25
|
-
this.isFocusableElement = (_el) => true;
|
|
26
|
-
this._listenerScope = () => this.host;
|
|
27
|
-
// When elements are virtualized, the delta between the first element
|
|
28
|
-
// and the first rendered element.
|
|
29
|
-
this.offset = 0;
|
|
30
|
-
this.recentlyConnected = false;
|
|
31
|
-
this.handleFocusin = (event) => {
|
|
32
|
-
if (!this.isEventWithinListenerScope(event)) return;
|
|
33
|
-
const path = event.composedPath();
|
|
34
|
-
let targetIndex = -1;
|
|
35
|
-
path.find((el) => {
|
|
36
|
-
targetIndex = this.elements.indexOf(el);
|
|
37
|
-
return targetIndex !== -1;
|
|
38
|
-
});
|
|
39
|
-
this.prevIndex = this.currentIndex;
|
|
40
|
-
this.currentIndex = targetIndex > -1 ? targetIndex : this.currentIndex;
|
|
41
|
-
if (this.isRelatedTargetOrContainAnElement(event)) {
|
|
42
|
-
this.hostContainsFocus();
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* handleClick - Finds the element that was clicked and sets the tabindex to 0
|
|
47
|
-
* @returns void
|
|
48
|
-
*/
|
|
49
|
-
this.handleClick = () => {
|
|
50
|
-
const elements = this.elements;
|
|
51
|
-
if (!elements.length) return;
|
|
52
|
-
let focusElement = elements[this.currentIndex];
|
|
53
|
-
if (this.currentIndex < 0) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
if (!focusElement || !this.isFocusableElement(focusElement)) {
|
|
57
|
-
this.setCurrentIndexCircularly(1);
|
|
58
|
-
focusElement = elements[this.currentIndex];
|
|
59
|
-
}
|
|
60
|
-
if (focusElement && this.isFocusableElement(focusElement)) {
|
|
61
|
-
elements[this.prevIndex]?.setAttribute("tabindex", "-1");
|
|
62
|
-
focusElement.setAttribute("tabindex", "0");
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
this.handleFocusout = (event) => {
|
|
66
|
-
if (this.isRelatedTargetOrContainAnElement(event)) {
|
|
67
|
-
this.hostNoLongerContainsFocus();
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
this.handleKeydown = (event) => {
|
|
71
|
-
if (!this.acceptsEventKey(event.key) || event.defaultPrevented) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
let diff = 0;
|
|
75
|
-
this.prevIndex = this.currentIndex;
|
|
76
|
-
switch (event.key) {
|
|
77
|
-
case "ArrowRight":
|
|
78
|
-
diff += 1;
|
|
79
|
-
break;
|
|
80
|
-
case "ArrowDown":
|
|
81
|
-
diff += this.direction === "grid" ? this.directionLength : 1;
|
|
82
|
-
break;
|
|
83
|
-
case "ArrowLeft":
|
|
84
|
-
diff -= 1;
|
|
85
|
-
break;
|
|
86
|
-
case "ArrowUp":
|
|
87
|
-
diff -= this.direction === "grid" ? this.directionLength : 1;
|
|
88
|
-
break;
|
|
89
|
-
case "End":
|
|
90
|
-
this.currentIndex = 0;
|
|
91
|
-
diff -= 1;
|
|
92
|
-
break;
|
|
93
|
-
case "Home":
|
|
94
|
-
this.currentIndex = this.elements.length - 1;
|
|
95
|
-
diff += 1;
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
event.preventDefault();
|
|
99
|
-
if (this.direction === "grid" && this.currentIndex + diff < 0) {
|
|
100
|
-
this.currentIndex = 0;
|
|
101
|
-
} else if (this.direction === "grid" && this.currentIndex + diff > this.elements.length - 1) {
|
|
102
|
-
this.currentIndex = this.elements.length - 1;
|
|
103
|
-
} else {
|
|
104
|
-
this.setCurrentIndexCircularly(diff);
|
|
105
|
-
}
|
|
106
|
-
this.elementEnterAction(this.elements[this.currentIndex]);
|
|
107
|
-
this.focus();
|
|
108
|
-
};
|
|
109
|
-
this.mutationObserver = new MutationObserver(() => {
|
|
110
|
-
this.handleItemMutation();
|
|
111
|
-
});
|
|
112
|
-
this.hostDelegatesFocus = hostDelegatesFocus || false;
|
|
113
|
-
this.host = host;
|
|
114
|
-
this.host.addController(this);
|
|
115
|
-
this._elements = elements;
|
|
116
|
-
this.isFocusableElement = isFocusableElement || this.isFocusableElement;
|
|
117
|
-
this._direction = ensureMethod(direction, "string", this._direction);
|
|
118
|
-
this.elementEnterAction = elementEnterAction || this.elementEnterAction;
|
|
119
|
-
this._focusInIndex = ensureMethod(focusInIndex, "number", this._focusInIndex);
|
|
120
|
-
this._listenerScope = ensureMethod(listenerScope, "object", this._listenerScope);
|
|
121
|
-
}
|
|
122
|
-
get currentIndex() {
|
|
123
|
-
if (this._currentIndex === -1) {
|
|
124
|
-
this._currentIndex = this.focusInIndex;
|
|
125
|
-
}
|
|
126
|
-
return this._currentIndex - this.offset;
|
|
127
|
-
}
|
|
128
|
-
set currentIndex(currentIndex) {
|
|
129
|
-
this._currentIndex = currentIndex + this.offset;
|
|
130
|
-
}
|
|
131
|
-
get direction() {
|
|
132
|
-
return this._direction();
|
|
133
|
-
}
|
|
134
|
-
get elements() {
|
|
135
|
-
if (!this.cachedElements) {
|
|
136
|
-
this.cachedElements = this._elements();
|
|
137
|
-
}
|
|
138
|
-
return this.cachedElements;
|
|
139
|
-
}
|
|
140
|
-
set focused(focused) {
|
|
141
|
-
if (focused === this.focused) return;
|
|
142
|
-
this._focused = focused;
|
|
143
|
-
}
|
|
144
|
-
get focused() {
|
|
145
|
-
return this._focused;
|
|
146
|
-
}
|
|
147
|
-
get focusInElement() {
|
|
148
|
-
return this.elements[this.focusInIndex];
|
|
149
|
-
}
|
|
150
|
-
get focusInIndex() {
|
|
151
|
-
return this._focusInIndex(this.elements);
|
|
152
|
-
}
|
|
153
|
-
isEventWithinListenerScope(event) {
|
|
154
|
-
if (this._listenerScope() === this.host) return true;
|
|
155
|
-
return event.composedPath().includes(this._listenerScope());
|
|
156
|
-
}
|
|
157
|
-
/* In handleItemMutation() method the first if condition is checking if the element is not focused or if the element's children's length is not decreasing then it means no element has been deleted and we must return.
|
|
158
|
-
Then we are checking if the deleted element was the focused one before the deletion if so then we need to proceed else we casn return;
|
|
159
|
-
*/
|
|
160
|
-
handleItemMutation() {
|
|
161
|
-
if (this._currentIndex == -1 || this.elements.length <= this._elements().length) return;
|
|
162
|
-
const focusedElement = this.elements[this.currentIndex];
|
|
163
|
-
this.clearElementCache();
|
|
164
|
-
if (this.elements.includes(focusedElement)) return;
|
|
165
|
-
const moveToNextElement = this.currentIndex !== this.elements.length;
|
|
166
|
-
const diff = moveToNextElement ? 1 : -1;
|
|
167
|
-
if (moveToNextElement) {
|
|
168
|
-
this.setCurrentIndexCircularly(-1);
|
|
169
|
-
}
|
|
170
|
-
this.setCurrentIndexCircularly(diff);
|
|
171
|
-
this.focus();
|
|
172
|
-
}
|
|
173
|
-
update({ elements } = { elements: () => [] }) {
|
|
174
|
-
this.unmanage();
|
|
175
|
-
this._elements = elements;
|
|
176
|
-
this.clearElementCache();
|
|
177
|
-
this.manage();
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* resets the focusedItem to initial item
|
|
181
|
-
*/
|
|
182
|
-
reset() {
|
|
183
|
-
const elements = this.elements;
|
|
184
|
-
if (!elements.length) return;
|
|
185
|
-
this.setCurrentIndexCircularly(this.focusInIndex - this.currentIndex);
|
|
186
|
-
let focusElement = elements[this.currentIndex];
|
|
187
|
-
if (this.currentIndex < 0) {
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
if (!focusElement || !this.isFocusableElement(focusElement)) {
|
|
191
|
-
this.setCurrentIndexCircularly(1);
|
|
192
|
-
focusElement = elements[this.currentIndex];
|
|
193
|
-
}
|
|
194
|
-
if (focusElement && this.isFocusableElement(focusElement)) {
|
|
195
|
-
elements[this.prevIndex]?.setAttribute("tabindex", "-1");
|
|
196
|
-
focusElement.setAttribute("tabindex", "0");
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
focusOnItem(item, options) {
|
|
200
|
-
if (item && this.isFocusableElement(item) && this.elements.indexOf(item)) {
|
|
201
|
-
const diff = this.elements.indexOf(item) - this.currentIndex;
|
|
202
|
-
this.setCurrentIndexCircularly(diff);
|
|
203
|
-
this.elements[this.prevIndex]?.setAttribute("tabindex", "-1");
|
|
204
|
-
}
|
|
205
|
-
this.focus(options);
|
|
206
|
-
}
|
|
207
|
-
focus(options) {
|
|
208
|
-
const elements = this.elements;
|
|
209
|
-
if (!elements.length) return;
|
|
210
|
-
let focusElement = elements[this.currentIndex];
|
|
211
|
-
if (!focusElement || !this.isFocusableElement(focusElement)) {
|
|
212
|
-
this.setCurrentIndexCircularly(1);
|
|
213
|
-
focusElement = elements[this.currentIndex];
|
|
214
|
-
}
|
|
215
|
-
if (focusElement && this.isFocusableElement(focusElement)) {
|
|
216
|
-
if (!this.hostDelegatesFocus || elements[this.prevIndex] !== focusElement) {
|
|
217
|
-
elements[this.prevIndex]?.setAttribute("tabindex", "-1");
|
|
218
|
-
}
|
|
219
|
-
focusElement.tabIndex = 0;
|
|
220
|
-
focusElement.focus(options);
|
|
221
|
-
if (this.hostDelegatesFocus && !this.focused) {
|
|
222
|
-
this.hostContainsFocus();
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
clearElementCache(offset = 0) {
|
|
227
|
-
this.mutationObserver.disconnect();
|
|
228
|
-
delete this.cachedElements;
|
|
229
|
-
this.offset = offset;
|
|
230
|
-
requestAnimationFrame(() => {
|
|
231
|
-
this.elements.forEach((element) => {
|
|
232
|
-
this.mutationObserver.observe(element, {
|
|
233
|
-
attributes: true
|
|
234
|
-
});
|
|
235
|
-
});
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
setCurrentIndexCircularly(diff) {
|
|
239
|
-
const { length } = this.elements;
|
|
240
|
-
let steps = length;
|
|
241
|
-
this.prevIndex = this.currentIndex;
|
|
242
|
-
let nextIndex = (length + this.currentIndex + diff) % length;
|
|
243
|
-
while (
|
|
244
|
-
// don't cycle the elements more than once
|
|
245
|
-
steps && this.elements[nextIndex] && // @ts-ignore
|
|
246
|
-
!this.isFocusableElement(this.elements[nextIndex])
|
|
247
|
-
) {
|
|
248
|
-
nextIndex = (length + nextIndex + diff) % length;
|
|
249
|
-
steps -= 1;
|
|
250
|
-
}
|
|
251
|
-
this.currentIndex = nextIndex;
|
|
252
|
-
}
|
|
253
|
-
hostContainsFocus() {
|
|
254
|
-
this.host.addEventListener("focusout", this.handleFocusout);
|
|
255
|
-
this.host.addEventListener("keydown", this.handleKeydown);
|
|
256
|
-
this.focused = true;
|
|
257
|
-
}
|
|
258
|
-
hostNoLongerContainsFocus() {
|
|
259
|
-
this.host.addEventListener("focusin", this.handleFocusin);
|
|
260
|
-
this.host.removeEventListener("focusout", this.handleFocusout);
|
|
261
|
-
this.host.removeEventListener("keydown", this.handleKeydown);
|
|
262
|
-
this.focused = false;
|
|
263
|
-
}
|
|
264
|
-
isRelatedTargetOrContainAnElement(event) {
|
|
265
|
-
const relatedTarget = event.relatedTarget;
|
|
266
|
-
const isRelatedTargetAnElement = this.elements.includes(relatedTarget);
|
|
267
|
-
const isRelatedTargetContainedWithinElements = this.elements.some((el) => el.contains(relatedTarget));
|
|
268
|
-
return !(isRelatedTargetAnElement || isRelatedTargetContainedWithinElements);
|
|
269
|
-
}
|
|
270
|
-
acceptsEventKey(key) {
|
|
271
|
-
if (key === "End" || key === "Home") {
|
|
272
|
-
return true;
|
|
273
|
-
}
|
|
274
|
-
switch (this.direction) {
|
|
275
|
-
case "horizontal":
|
|
276
|
-
return key === "ArrowLeft" || key === "ArrowRight";
|
|
277
|
-
case "vertical":
|
|
278
|
-
return key === "ArrowUp" || key === "ArrowDown";
|
|
279
|
-
case "both":
|
|
280
|
-
case "grid":
|
|
281
|
-
return key.startsWith("Arrow");
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
manage() {
|
|
285
|
-
this.addEventListeners();
|
|
286
|
-
}
|
|
287
|
-
unmanage() {
|
|
288
|
-
this.removeEventListeners();
|
|
289
|
-
}
|
|
290
|
-
addEventListeners() {
|
|
291
|
-
this.host.addEventListener("focusin", this.handleFocusin);
|
|
292
|
-
this.host.addEventListener("click", this.handleClick);
|
|
293
|
-
}
|
|
294
|
-
removeEventListeners() {
|
|
295
|
-
this.host.removeEventListener("focusin", this.handleFocusin);
|
|
296
|
-
this.host.removeEventListener("focusout", this.handleFocusout);
|
|
297
|
-
this.host.removeEventListener("keydown", this.handleKeydown);
|
|
298
|
-
this.host.removeEventListener("click", this.handleClick);
|
|
299
|
-
}
|
|
300
|
-
hostConnected() {
|
|
301
|
-
this.recentlyConnected = true;
|
|
302
|
-
this.addEventListeners();
|
|
303
|
-
}
|
|
304
|
-
hostDisconnected() {
|
|
305
|
-
this.mutationObserver.disconnect();
|
|
306
|
-
this.removeEventListeners();
|
|
307
|
-
}
|
|
308
|
-
hostUpdated() {
|
|
309
|
-
if (this.recentlyConnected) {
|
|
310
|
-
this.recentlyConnected = false;
|
|
311
|
-
this.elements.forEach((element) => {
|
|
312
|
-
this.mutationObserver.observe(element, {
|
|
313
|
-
attributes: true
|
|
314
|
-
});
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
class RovingTabindexController extends FocusGroupController {
|
|
320
|
-
constructor() {
|
|
321
|
-
super(...arguments);
|
|
322
|
-
this.managed = true;
|
|
323
|
-
this.manageIndexesAnimationFrame = 0;
|
|
324
|
-
}
|
|
325
|
-
set focused(focused) {
|
|
326
|
-
if (focused === this.focused) return;
|
|
327
|
-
super.focused = focused;
|
|
328
|
-
this.manageTabindexes();
|
|
329
|
-
}
|
|
330
|
-
get focused() {
|
|
331
|
-
return super.focused;
|
|
332
|
-
}
|
|
333
|
-
clearElementCache(offset = 0) {
|
|
334
|
-
cancelAnimationFrame(this.manageIndexesAnimationFrame);
|
|
335
|
-
super.clearElementCache(offset);
|
|
336
|
-
if (!this.managed) return;
|
|
337
|
-
this.manageIndexesAnimationFrame = requestAnimationFrame(() => this.manageTabindexes());
|
|
338
|
-
}
|
|
339
|
-
manageTabindexes() {
|
|
340
|
-
if (this.focused && !this.hostDelegatesFocus) {
|
|
341
|
-
this.updateTabindexes(() => ({ tabIndex: -1 }));
|
|
342
|
-
} else {
|
|
343
|
-
this.updateTabindexes((el) => {
|
|
344
|
-
return {
|
|
345
|
-
removeTabIndex: el.contains(this.focusInElement) && el !== this.focusInElement,
|
|
346
|
-
tabIndex: el === this.focusInElement ? 0 : -1
|
|
347
|
-
};
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
updateTabindexes(getTabIndex) {
|
|
352
|
-
this.elements.forEach((el) => {
|
|
353
|
-
const { tabIndex, removeTabIndex } = getTabIndex(el);
|
|
354
|
-
if (!removeTabIndex) {
|
|
355
|
-
if (this.focused) {
|
|
356
|
-
if (el !== this.elements[this.currentIndex]) {
|
|
357
|
-
el.tabIndex = tabIndex;
|
|
358
|
-
}
|
|
359
|
-
} else {
|
|
360
|
-
el.tabIndex = tabIndex;
|
|
361
|
-
}
|
|
362
|
-
return;
|
|
363
|
-
}
|
|
364
|
-
const updatable = el;
|
|
365
|
-
if (updatable.requestUpdate) updatable.requestUpdate();
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
manage() {
|
|
369
|
-
this.managed = true;
|
|
370
|
-
this.manageTabindexes();
|
|
371
|
-
super.manage();
|
|
372
|
-
}
|
|
373
|
-
unmanage() {
|
|
374
|
-
this.managed = false;
|
|
375
|
-
this.updateTabindexes(() => ({ tabIndex: 0 }));
|
|
376
|
-
super.unmanage();
|
|
377
|
-
}
|
|
378
|
-
hostUpdated() {
|
|
379
|
-
super.hostUpdated();
|
|
380
|
-
if (!this.host.hasUpdated) {
|
|
381
|
-
this.manageTabindexes();
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
export { FocusGroupController, RovingTabindexController };
|