@shoper/phoenix_design_system 1.18.23-8 → 1.18.23-9
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/build/cjs/packages/phoenix/src/components/form/search/search.js +3 -3
- package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/{focus_trap_strategy.js → base_focus_trap_strategy.js} +3 -3
- package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js +14 -0
- package/build/{esm/packages/phoenix/src/controllers/focus_trap_controller/strategies → cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy}/cyclic_focus_trap_strategy.js.map +1 -1
- package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js +3 -3
- package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/{sentinel_focus_trap_strategy.js → sentinel_focus_trap_strategy/sentinel_focus_trap_strategy.js} +5 -12
- package/build/{esm/packages/phoenix/src/controllers/focus_trap_controller/strategies → cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy}/sentinel_focus_trap_strategy.js.map +1 -1
- package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/{toggler_focus_trap_strategy.js → toggler_focus_trap_strategy/toggler_focus_trap_strategy.js} +3 -12
- package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/{toggler_focus_trap_strategy.js.map → toggler_focus_trap_strategy/toggler_focus_trap_strategy.js.map} +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/search.d.ts +2 -1
- package/build/esm/packages/phoenix/src/components/form/search/search.js +3 -3
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.d.ts +2 -2
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/{focus_trap_strategy.d.ts → base_focus_trap_strategy.d.ts} +2 -2
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/{focus_trap_strategy.js → base_focus_trap_strategy.js} +3 -3
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/{focus_trap_strategy_types.d.ts → base_focus_trap_strategy_types.d.ts} +1 -1
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy_types.js +2 -0
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy_types.js.map +1 -0
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.d.ts +6 -0
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js +10 -0
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js.map +1 -0
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types.d.ts +3 -0
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types.js +2 -0
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types.js.map +1 -0
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.d.ts +3 -3
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js +3 -3
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy/sentinel_focus_trap_strategy.d.ts +7 -0
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy/sentinel_focus_trap_strategy.js +25 -0
- package/build/{cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy.js.map → esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy/sentinel_focus_trap_strategy.js.map} +1 -1
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy/sentinel_focus_trap_strategy_types.d.ts +4 -0
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy/sentinel_focus_trap_strategy_types.js +2 -0
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy/sentinel_focus_trap_strategy_types.js.map +1 -0
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/toggler_focus_trap_strategy/toggler_focus_trap_strategy.d.ts +8 -0
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/{toggler_focus_trap_strategy.js → toggler_focus_trap_strategy/toggler_focus_trap_strategy.js} +3 -12
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/{toggler_focus_trap_strategy.js.map → toggler_focus_trap_strategy/toggler_focus_trap_strategy.js.map} +1 -1
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/toggler_focus_trap_strategy/toggler_focus_trap_strategy_types.d.ts +4 -0
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/toggler_focus_trap_strategy/toggler_focus_trap_strategy_types.js +2 -0
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/toggler_focus_trap_strategy/toggler_focus_trap_strategy_types.js.map +1 -0
- package/package.json +1 -1
- package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy.js +0 -24
- package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy.js.map +0 -1
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy.d.ts +0 -18
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy.js +0 -20
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_types.js +0 -2
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_types.js.map +0 -1
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy.d.ts +0 -17
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy.js +0 -32
- package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/toggler_focus_trap_strategy.d.ts +0 -20
- /package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/{focus_trap_strategy.js.map → base_focus_trap_strategy.js.map} +0 -0
- /package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/{focus_trap_strategy.js.map → base_focus_trap_strategy.js.map} +0 -0
|
@@ -34,7 +34,7 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
34
34
|
this._id = v4['default']();
|
|
35
35
|
this._openSearchButtonAriaLabelId = `${this._id}-open-search-button-aria-label`;
|
|
36
36
|
this._searchContentContainerId = v4['default']();
|
|
37
|
-
this.
|
|
37
|
+
this.mobileFocusTrapController = new focus_trap_controller.FocusTrapController(this, {
|
|
38
38
|
mode: 'cyclic',
|
|
39
39
|
getContainer: () => this
|
|
40
40
|
});
|
|
@@ -376,12 +376,12 @@ exports.HSearch = class HSearch extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
376
376
|
this._mobileDialogOpener = document.activeElement;
|
|
377
377
|
this.setAttribute('role', 'dialog');
|
|
378
378
|
this.setAttribute('aria-modal', 'true');
|
|
379
|
-
this.
|
|
379
|
+
this.mobileFocusTrapController.activate();
|
|
380
380
|
};
|
|
381
381
|
this._deactivateMobileDialog = () => {
|
|
382
382
|
this.removeAttribute('role');
|
|
383
383
|
this.removeAttribute('aria-modal');
|
|
384
|
-
this.
|
|
384
|
+
this.mobileFocusTrapController.deactivate();
|
|
385
385
|
};
|
|
386
386
|
this._setupAriaAttributes = () => {
|
|
387
387
|
var _a;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var utilities = require('@dreamcommerce/utilities');
|
|
6
6
|
|
|
7
|
-
class
|
|
7
|
+
class BaseFocusTrapStrategy {
|
|
8
8
|
constructor(getContainer) {
|
|
9
9
|
this.getContainer = getContainer;
|
|
10
10
|
this.active = false;
|
|
@@ -62,5 +62,5 @@ class FocusTrapStrategy {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
exports.
|
|
66
|
-
//# sourceMappingURL=
|
|
65
|
+
exports.BaseFocusTrapStrategy = BaseFocusTrapStrategy;
|
|
66
|
+
//# sourceMappingURL=base_focus_trap_strategy.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var base_focus_trap_strategy = require('../base_focus_trap_strategy.js');
|
|
6
|
+
|
|
7
|
+
class CyclicFocusTrapStrategy extends base_focus_trap_strategy.BaseFocusTrapStrategy {
|
|
8
|
+
constructor({ getContainer }) {
|
|
9
|
+
super(getContainer);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
exports.CyclicFocusTrapStrategy = CyclicFocusTrapStrategy;
|
|
14
|
+
//# sourceMappingURL=cyclic_focus_trap_strategy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var cyclic_focus_trap_strategy = require('./cyclic_focus_trap_strategy.js');
|
|
6
|
-
var toggler_focus_trap_strategy = require('./toggler_focus_trap_strategy.js');
|
|
7
|
-
var sentinel_focus_trap_strategy = require('./sentinel_focus_trap_strategy.js');
|
|
5
|
+
var cyclic_focus_trap_strategy = require('./cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js');
|
|
6
|
+
var toggler_focus_trap_strategy = require('./toggler_focus_trap_strategy/toggler_focus_trap_strategy.js');
|
|
7
|
+
var sentinel_focus_trap_strategy = require('./sentinel_focus_trap_strategy/sentinel_focus_trap_strategy.js');
|
|
8
8
|
|
|
9
9
|
const FOCUS_TRAP_STRATEGY_TYPES = {
|
|
10
10
|
cyclic: 'cyclic',
|
|
@@ -2,16 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var base_focus_trap_strategy = require('../base_focus_trap_strategy.js');
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
* Sentinel mode focus trap.
|
|
9
|
-
*
|
|
10
|
-
* Traps focus within the container using `keydown` interception. On `activate()`,
|
|
11
|
-
* automatically moves focus to the first focusable element inside the container.
|
|
12
|
-
* Appropriate for modal dialogs and sheets where background content is marked `inert`.
|
|
13
|
-
*/
|
|
14
|
-
class SentinelFocusTrapStrategy extends focus_trap_strategy.FocusTrapStrategy {
|
|
7
|
+
class SentinelFocusTrapStrategy extends base_focus_trap_strategy.BaseFocusTrapStrategy {
|
|
15
8
|
constructor({ getContainer, noAutofocus = false }) {
|
|
16
9
|
super(getContainer);
|
|
17
10
|
this.noAutofocus = noAutofocus;
|
|
@@ -24,9 +17,9 @@ class SentinelFocusTrapStrategy extends focus_trap_strategy.FocusTrapStrategy {
|
|
|
24
17
|
if (!container)
|
|
25
18
|
return;
|
|
26
19
|
const focusableElements = this.getFocusableElements(container);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
const shouldSkipStartSentinel = focusableElements.length > 1;
|
|
21
|
+
const $firstFocusableContentElement = shouldSkipStartSentinel ? focusableElements[1] : focusableElements[0];
|
|
22
|
+
$firstFocusableContentElement === null || $firstFocusableContentElement === void 0 ? void 0 : $firstFocusableContentElement.focus();
|
|
30
23
|
});
|
|
31
24
|
}
|
|
32
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -2,20 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var tslib_es6 = require('
|
|
6
|
-
var
|
|
5
|
+
var tslib_es6 = require('../../../../../../../external/tslib/tslib.es6.js');
|
|
6
|
+
var base_focus_trap_strategy = require('../base_focus_trap_strategy.js');
|
|
7
7
|
|
|
8
8
|
var _TogglerFocusTrapStrategy_getToggler;
|
|
9
|
-
|
|
10
|
-
* Toggler mode focus trap.
|
|
11
|
-
*
|
|
12
|
-
* Focus cycles: toggler → content[0] → … → content[last] → toggler (and reverse).
|
|
13
|
-
* Uses `keydown` + `preventDefault` so the browser never moves focus on its own.
|
|
14
|
-
*
|
|
15
|
-
* Suitable for dropdowns where the toggler button should stay in the Tab cycle
|
|
16
|
-
* alongside the dropdown content.
|
|
17
|
-
*/
|
|
18
|
-
class TogglerFocusTrapStrategy extends focus_trap_strategy.FocusTrapStrategy {
|
|
9
|
+
class TogglerFocusTrapStrategy extends base_focus_trap_strategy.BaseFocusTrapStrategy {
|
|
19
10
|
constructor({ getContainer, getToggler }) {
|
|
20
11
|
super(getContainer);
|
|
21
12
|
_TogglerFocusTrapStrategy_getToggler.set(this, void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,kDAAsD;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TemplateResult } from 'lit';
|
|
2
2
|
import { PhoenixLightLitElement } from "../../../core/phoenix_light_lit_element/phoenix_light_lit_element";
|
|
3
3
|
import type { TSearchDisplayMode, TSearchSettings } from "./search_types";
|
|
4
|
+
import { FocusTrapController } from "../../../controllers/focus_trap_controller/focus_trap_controller";
|
|
4
5
|
export declare class HSearch extends PhoenixLightLitElement {
|
|
5
6
|
settings: TSearchSettings;
|
|
6
7
|
view: string;
|
|
@@ -21,7 +22,7 @@ export declare class HSearch extends PhoenixLightLitElement {
|
|
|
21
22
|
private _id;
|
|
22
23
|
private _openSearchButtonAriaLabelId;
|
|
23
24
|
private _searchContentContainerId;
|
|
24
|
-
|
|
25
|
+
mobileFocusTrapController: FocusTrapController;
|
|
25
26
|
private _searchResultsRef;
|
|
26
27
|
private _searchHistoryRef;
|
|
27
28
|
private _searchMessageRef;
|
|
@@ -30,7 +30,7 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
30
30
|
this._id = v4();
|
|
31
31
|
this._openSearchButtonAriaLabelId = `${this._id}-open-search-button-aria-label`;
|
|
32
32
|
this._searchContentContainerId = v4();
|
|
33
|
-
this.
|
|
33
|
+
this.mobileFocusTrapController = new FocusTrapController(this, {
|
|
34
34
|
mode: 'cyclic',
|
|
35
35
|
getContainer: () => this
|
|
36
36
|
});
|
|
@@ -372,12 +372,12 @@ let HSearch = class HSearch extends PhoenixLightLitElement {
|
|
|
372
372
|
this._mobileDialogOpener = document.activeElement;
|
|
373
373
|
this.setAttribute('role', 'dialog');
|
|
374
374
|
this.setAttribute('aria-modal', 'true');
|
|
375
|
-
this.
|
|
375
|
+
this.mobileFocusTrapController.activate();
|
|
376
376
|
};
|
|
377
377
|
this._deactivateMobileDialog = () => {
|
|
378
378
|
this.removeAttribute('role');
|
|
379
379
|
this.removeAttribute('aria-modal');
|
|
380
|
-
this.
|
|
380
|
+
this.mobileFocusTrapController.deactivate();
|
|
381
381
|
};
|
|
382
382
|
this._setupAriaAttributes = () => {
|
|
383
383
|
var _a;
|
package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
2
|
import type { TFocusTrapProps } from './focus_trap_controller_types';
|
|
3
|
-
import {
|
|
3
|
+
import { IBaseFocusTrapStrategy } from './strategies/base_focus_trap_strategy_types';
|
|
4
4
|
export declare class FocusTrapController<TProps extends TFocusTrapProps = TFocusTrapProps> implements ReactiveController {
|
|
5
5
|
#private;
|
|
6
6
|
constructor(host: ReactiveControllerHost, { mode, ...strategyProps }: TProps);
|
|
7
|
-
get strategy():
|
|
7
|
+
get strategy(): IBaseFocusTrapStrategy;
|
|
8
8
|
hostConnected(): void;
|
|
9
9
|
hostDisconnected(): void;
|
|
10
10
|
activate(): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare abstract class
|
|
1
|
+
import { IBaseFocusTrapStrategy } from './base_focus_trap_strategy_types';
|
|
2
|
+
export declare abstract class BaseFocusTrapStrategy implements IBaseFocusTrapStrategy {
|
|
3
3
|
protected readonly getContainer: () => HTMLElement | undefined;
|
|
4
4
|
protected active: boolean;
|
|
5
5
|
noAutofocus: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UiDomUtils } from '@dreamcommerce/utilities';
|
|
2
2
|
|
|
3
|
-
class
|
|
3
|
+
class BaseFocusTrapStrategy {
|
|
4
4
|
constructor(getContainer) {
|
|
5
5
|
this.getContainer = getContainer;
|
|
6
6
|
this.active = false;
|
|
@@ -58,5 +58,5 @@ class FocusTrapStrategy {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
export {
|
|
62
|
-
//# sourceMappingURL=
|
|
61
|
+
export { BaseFocusTrapStrategy };
|
|
62
|
+
//# sourceMappingURL=base_focus_trap_strategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base_focus_trap_strategy_types.js","sourceRoot":"","sources":["../../../../../../../../src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy_types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseFocusTrapStrategy } from '../base_focus_trap_strategy';
|
|
2
|
+
import { IBaseFocusTrapStrategy } from '../base_focus_trap_strategy_types';
|
|
3
|
+
import { TCyclicFocusTrapStrategyProps } from './cyclic_focus_trap_strategy_types';
|
|
4
|
+
export declare class CyclicFocusTrapStrategy extends BaseFocusTrapStrategy implements IBaseFocusTrapStrategy {
|
|
5
|
+
constructor({ getContainer }: TCyclicFocusTrapStrategyProps);
|
|
6
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseFocusTrapStrategy } from '../base_focus_trap_strategy.js';
|
|
2
|
+
|
|
3
|
+
class CyclicFocusTrapStrategy extends BaseFocusTrapStrategy {
|
|
4
|
+
constructor({ getContainer }) {
|
|
5
|
+
super(getContainer);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { CyclicFocusTrapStrategy };
|
|
10
|
+
//# sourceMappingURL=cyclic_focus_trap_strategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cyclic_focus_trap_strategy_types.js","sourceRoot":"","sources":["../../../../../../../../../src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CyclicFocusTrapStrategy } from './cyclic_focus_trap_strategy';
|
|
2
|
-
import { TogglerFocusTrapStrategy } from './toggler_focus_trap_strategy';
|
|
3
|
-
import { SentinelFocusTrapStrategy } from './sentinel_focus_trap_strategy';
|
|
1
|
+
import { CyclicFocusTrapStrategy } from './cyclic_focus_trap_strategy/cyclic_focus_trap_strategy';
|
|
2
|
+
import { TogglerFocusTrapStrategy } from './toggler_focus_trap_strategy/toggler_focus_trap_strategy';
|
|
3
|
+
import { SentinelFocusTrapStrategy } from './sentinel_focus_trap_strategy/sentinel_focus_trap_strategy';
|
|
4
4
|
export declare const FOCUS_TRAP_STRATEGY_TYPES: {
|
|
5
5
|
readonly cyclic: "cyclic";
|
|
6
6
|
readonly toggler: "toggler";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CyclicFocusTrapStrategy } from './cyclic_focus_trap_strategy.js';
|
|
2
|
-
import { TogglerFocusTrapStrategy } from './toggler_focus_trap_strategy.js';
|
|
3
|
-
import { SentinelFocusTrapStrategy } from './sentinel_focus_trap_strategy.js';
|
|
1
|
+
import { CyclicFocusTrapStrategy } from './cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js';
|
|
2
|
+
import { TogglerFocusTrapStrategy } from './toggler_focus_trap_strategy/toggler_focus_trap_strategy.js';
|
|
3
|
+
import { SentinelFocusTrapStrategy } from './sentinel_focus_trap_strategy/sentinel_focus_trap_strategy.js';
|
|
4
4
|
|
|
5
5
|
const FOCUS_TRAP_STRATEGY_TYPES = {
|
|
6
6
|
cyclic: 'cyclic',
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BaseFocusTrapStrategy } from '../base_focus_trap_strategy';
|
|
2
|
+
import { IBaseFocusTrapStrategy } from '../base_focus_trap_strategy_types';
|
|
3
|
+
import { TSentinelFocusTrapStrategyProps } from './sentinel_focus_trap_strategy_types';
|
|
4
|
+
export declare class SentinelFocusTrapStrategy extends BaseFocusTrapStrategy implements IBaseFocusTrapStrategy {
|
|
5
|
+
constructor({ getContainer, noAutofocus }: TSentinelFocusTrapStrategyProps);
|
|
6
|
+
activate(): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BaseFocusTrapStrategy } from '../base_focus_trap_strategy.js';
|
|
2
|
+
|
|
3
|
+
class SentinelFocusTrapStrategy extends BaseFocusTrapStrategy {
|
|
4
|
+
constructor({ getContainer, noAutofocus = false }) {
|
|
5
|
+
super(getContainer);
|
|
6
|
+
this.noAutofocus = noAutofocus;
|
|
7
|
+
}
|
|
8
|
+
activate() {
|
|
9
|
+
this.active = true;
|
|
10
|
+
if (!this.noAutofocus) {
|
|
11
|
+
requestAnimationFrame(() => {
|
|
12
|
+
const container = this.getContainer();
|
|
13
|
+
if (!container)
|
|
14
|
+
return;
|
|
15
|
+
const focusableElements = this.getFocusableElements(container);
|
|
16
|
+
const shouldSkipStartSentinel = focusableElements.length > 1;
|
|
17
|
+
const $firstFocusableContentElement = shouldSkipStartSentinel ? focusableElements[1] : focusableElements[0];
|
|
18
|
+
$firstFocusableContentElement === null || $firstFocusableContentElement === void 0 ? void 0 : $firstFocusableContentElement.focus();
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { SentinelFocusTrapStrategy };
|
|
25
|
+
//# sourceMappingURL=sentinel_focus_trap_strategy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentinel_focus_trap_strategy_types.js","sourceRoot":"","sources":["../../../../../../../../../src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy/sentinel_focus_trap_strategy_types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseFocusTrapStrategy } from '../base_focus_trap_strategy';
|
|
2
|
+
import { IBaseFocusTrapStrategy } from '../base_focus_trap_strategy_types';
|
|
3
|
+
import { TTogglerFocusTrapStrategyProps } from './toggler_focus_trap_strategy_types';
|
|
4
|
+
export declare class TogglerFocusTrapStrategy extends BaseFocusTrapStrategy implements IBaseFocusTrapStrategy {
|
|
5
|
+
#private;
|
|
6
|
+
constructor({ getContainer, getToggler }: TTogglerFocusTrapStrategyProps);
|
|
7
|
+
protected _handleKeyDown: (ev: KeyboardEvent) => void;
|
|
8
|
+
}
|
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
import { __classPrivateFieldGet, __classPrivateFieldSet } from '
|
|
2
|
-
import {
|
|
1
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { BaseFocusTrapStrategy } from '../base_focus_trap_strategy.js';
|
|
3
3
|
|
|
4
4
|
var _TogglerFocusTrapStrategy_getToggler;
|
|
5
|
-
|
|
6
|
-
* Toggler mode focus trap.
|
|
7
|
-
*
|
|
8
|
-
* Focus cycles: toggler → content[0] → … → content[last] → toggler (and reverse).
|
|
9
|
-
* Uses `keydown` + `preventDefault` so the browser never moves focus on its own.
|
|
10
|
-
*
|
|
11
|
-
* Suitable for dropdowns where the toggler button should stay in the Tab cycle
|
|
12
|
-
* alongside the dropdown content.
|
|
13
|
-
*/
|
|
14
|
-
class TogglerFocusTrapStrategy extends FocusTrapStrategy {
|
|
5
|
+
class TogglerFocusTrapStrategy extends BaseFocusTrapStrategy {
|
|
15
6
|
constructor({ getContainer, getToggler }) {
|
|
16
7
|
super(getContainer);
|
|
17
8
|
_TogglerFocusTrapStrategy_getToggler.set(this, void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,+DAA+D
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,+DAA+D,kDAAsD;AACrH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggler_focus_trap_strategy_types.js","sourceRoot":"","sources":["../../../../../../../../../src/controllers/focus_trap_controller/strategies/toggler_focus_trap_strategy/toggler_focus_trap_strategy_types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var focus_trap_strategy = require('./focus_trap_strategy.js');
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Cyclic keydown focus trap.
|
|
9
|
-
*
|
|
10
|
-
* No sentinel DOM elements. Tab past the last focusable element wraps to the first;
|
|
11
|
-
* Shift+Tab past the first wraps to the last. Uses `keydown` + `preventDefault` so the
|
|
12
|
-
* browser never moves focus outside the container.
|
|
13
|
-
*
|
|
14
|
-
* Suitable when the host is not portaled and `inert` is not applied to background content
|
|
15
|
-
* (e.g. a full-screen search overlay on mobile).
|
|
16
|
-
*/
|
|
17
|
-
class CyclicFocusTrapStrategy extends focus_trap_strategy.FocusTrapStrategy {
|
|
18
|
-
constructor({ getContainer }) {
|
|
19
|
-
super(getContainer);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
exports.CyclicFocusTrapStrategy = CyclicFocusTrapStrategy;
|
|
24
|
-
//# sourceMappingURL=cyclic_focus_trap_strategy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { FocusTrapStrategy } from './focus_trap_strategy';
|
|
2
|
-
import { IFocusTrapStrategy } from './focus_trap_strategy_types';
|
|
3
|
-
export declare type TCyclicFocusTrapStrategyProps = {
|
|
4
|
-
getContainer: () => HTMLElement | undefined;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Cyclic keydown focus trap.
|
|
8
|
-
*
|
|
9
|
-
* No sentinel DOM elements. Tab past the last focusable element wraps to the first;
|
|
10
|
-
* Shift+Tab past the first wraps to the last. Uses `keydown` + `preventDefault` so the
|
|
11
|
-
* browser never moves focus outside the container.
|
|
12
|
-
*
|
|
13
|
-
* Suitable when the host is not portaled and `inert` is not applied to background content
|
|
14
|
-
* (e.g. a full-screen search overlay on mobile).
|
|
15
|
-
*/
|
|
16
|
-
export declare class CyclicFocusTrapStrategy extends FocusTrapStrategy implements IFocusTrapStrategy {
|
|
17
|
-
constructor({ getContainer }: TCyclicFocusTrapStrategyProps);
|
|
18
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { FocusTrapStrategy } from './focus_trap_strategy.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Cyclic keydown focus trap.
|
|
5
|
-
*
|
|
6
|
-
* No sentinel DOM elements. Tab past the last focusable element wraps to the first;
|
|
7
|
-
* Shift+Tab past the first wraps to the last. Uses `keydown` + `preventDefault` so the
|
|
8
|
-
* browser never moves focus outside the container.
|
|
9
|
-
*
|
|
10
|
-
* Suitable when the host is not portaled and `inert` is not applied to background content
|
|
11
|
-
* (e.g. a full-screen search overlay on mobile).
|
|
12
|
-
*/
|
|
13
|
-
class CyclicFocusTrapStrategy extends FocusTrapStrategy {
|
|
14
|
-
constructor({ getContainer }) {
|
|
15
|
-
super(getContainer);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export { CyclicFocusTrapStrategy };
|
|
20
|
-
//# sourceMappingURL=cyclic_focus_trap_strategy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"focus_trap_strategy_types.js","sourceRoot":"","sources":["../../../../../../../../src/controllers/focus_trap_controller/strategies/focus_trap_strategy_types.ts"],"names":[],"mappings":""}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { FocusTrapStrategy } from './focus_trap_strategy';
|
|
2
|
-
import { IFocusTrapStrategy } from './focus_trap_strategy_types';
|
|
3
|
-
export declare type TSentinelFocusTrapStrategyProps = {
|
|
4
|
-
getContainer: () => HTMLElement | undefined;
|
|
5
|
-
noAutofocus?: boolean;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Sentinel mode focus trap.
|
|
9
|
-
*
|
|
10
|
-
* Traps focus within the container using `keydown` interception. On `activate()`,
|
|
11
|
-
* automatically moves focus to the first focusable element inside the container.
|
|
12
|
-
* Appropriate for modal dialogs and sheets where background content is marked `inert`.
|
|
13
|
-
*/
|
|
14
|
-
export declare class SentinelFocusTrapStrategy extends FocusTrapStrategy implements IFocusTrapStrategy {
|
|
15
|
-
constructor({ getContainer, noAutofocus }: TSentinelFocusTrapStrategyProps);
|
|
16
|
-
activate(): void;
|
|
17
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { FocusTrapStrategy } from './focus_trap_strategy.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Sentinel mode focus trap.
|
|
5
|
-
*
|
|
6
|
-
* Traps focus within the container using `keydown` interception. On `activate()`,
|
|
7
|
-
* automatically moves focus to the first focusable element inside the container.
|
|
8
|
-
* Appropriate for modal dialogs and sheets where background content is marked `inert`.
|
|
9
|
-
*/
|
|
10
|
-
class SentinelFocusTrapStrategy extends FocusTrapStrategy {
|
|
11
|
-
constructor({ getContainer, noAutofocus = false }) {
|
|
12
|
-
super(getContainer);
|
|
13
|
-
this.noAutofocus = noAutofocus;
|
|
14
|
-
}
|
|
15
|
-
activate() {
|
|
16
|
-
this.active = true;
|
|
17
|
-
if (!this.noAutofocus) {
|
|
18
|
-
requestAnimationFrame(() => {
|
|
19
|
-
const container = this.getContainer();
|
|
20
|
-
if (!container)
|
|
21
|
-
return;
|
|
22
|
-
const focusableElements = this.getFocusableElements(container);
|
|
23
|
-
if (focusableElements.length > 0) {
|
|
24
|
-
focusableElements.length > 1 ? focusableElements[1].focus() : focusableElements[0].focus();
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export { SentinelFocusTrapStrategy };
|
|
32
|
-
//# sourceMappingURL=sentinel_focus_trap_strategy.js.map
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { FocusTrapStrategy } from './focus_trap_strategy';
|
|
2
|
-
import { IFocusTrapStrategy } from './focus_trap_strategy_types';
|
|
3
|
-
export declare type TTogglerFocusTrapStrategyProps = {
|
|
4
|
-
getContainer: () => HTMLElement | undefined;
|
|
5
|
-
getToggler: () => HTMLElement | null | undefined;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Toggler mode focus trap.
|
|
9
|
-
*
|
|
10
|
-
* Focus cycles: toggler → content[0] → … → content[last] → toggler (and reverse).
|
|
11
|
-
* Uses `keydown` + `preventDefault` so the browser never moves focus on its own.
|
|
12
|
-
*
|
|
13
|
-
* Suitable for dropdowns where the toggler button should stay in the Tab cycle
|
|
14
|
-
* alongside the dropdown content.
|
|
15
|
-
*/
|
|
16
|
-
export declare class TogglerFocusTrapStrategy extends FocusTrapStrategy implements IFocusTrapStrategy {
|
|
17
|
-
#private;
|
|
18
|
-
constructor({ getContainer, getToggler }: TTogglerFocusTrapStrategyProps);
|
|
19
|
-
protected _handleKeyDown: (ev: KeyboardEvent) => void;
|
|
20
|
-
}
|
|
File without changes
|