@shoper/phoenix_design_system 1.18.23-13 → 1.18.23-14

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.
Files changed (81) hide show
  1. package/build/cjs/packages/phoenix/src/components/accordion/accordion_content.js +6 -15
  2. package/build/cjs/packages/phoenix/src/components/accordion/accordion_content.js.map +1 -1
  3. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown.js +3 -51
  4. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
  5. package/build/cjs/packages/phoenix/src/components/form/search/search.js +8 -55
  6. package/build/cjs/packages/phoenix/src/components/form/search/search.js.map +1 -1
  7. package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js +22 -51
  8. package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js.map +1 -1
  9. package/build/cjs/packages/phoenix/src/components/form/select/select.js +0 -6
  10. package/build/cjs/packages/phoenix/src/components/form/select/select.js.map +1 -1
  11. package/build/cjs/packages/phoenix/src/components/modal/modal.js +11 -39
  12. package/build/cjs/packages/phoenix/src/components/modal/modal.js.map +1 -1
  13. package/build/cjs/packages/phoenix/src/components/sheet/sheet.js +10 -33
  14. package/build/cjs/packages/phoenix/src/components/sheet/sheet.js.map +1 -1
  15. package/build/esm/packages/phoenix/src/components/accordion/accordion_content.d.ts +0 -1
  16. package/build/esm/packages/phoenix/src/components/accordion/accordion_content.js +6 -15
  17. package/build/esm/packages/phoenix/src/components/accordion/accordion_content.js.map +1 -1
  18. package/build/esm/packages/phoenix/src/components/dropdown/dropdown.d.ts +0 -6
  19. package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js +3 -51
  20. package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
  21. package/build/esm/packages/phoenix/src/components/form/search/search.d.ts +0 -6
  22. package/build/esm/packages/phoenix/src/components/form/search/search.js +8 -55
  23. package/build/esm/packages/phoenix/src/components/form/search/search.js.map +1 -1
  24. package/build/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.d.ts +0 -1
  25. package/build/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js +22 -51
  26. package/build/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js.map +1 -1
  27. package/build/esm/packages/phoenix/src/components/form/select/select.d.ts +0 -1
  28. package/build/esm/packages/phoenix/src/components/form/select/select.js +0 -6
  29. package/build/esm/packages/phoenix/src/components/form/select/select.js.map +1 -1
  30. package/build/esm/packages/phoenix/src/components/modal/modal.d.ts +0 -2
  31. package/build/esm/packages/phoenix/src/components/modal/modal.js +11 -39
  32. package/build/esm/packages/phoenix/src/components/modal/modal.js.map +1 -1
  33. package/build/esm/packages/phoenix/src/components/sheet/sheet.d.ts +0 -2
  34. package/build/esm/packages/phoenix/src/components/sheet/sheet.js +10 -33
  35. package/build/esm/packages/phoenix/src/components/sheet/sheet.js.map +1 -1
  36. package/package.json +1 -1
  37. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.js +0 -47
  38. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.js.map +0 -1
  39. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.js +0 -66
  40. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.js.map +0 -1
  41. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js +0 -14
  42. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js.map +0 -1
  43. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js +0 -12
  44. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js.map +0 -1
  45. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy/sentinel_focus_trap_strategy.js +0 -29
  46. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy/sentinel_focus_trap_strategy.js.map +0 -1
  47. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/toggler_focus_trap_strategy/toggler_focus_trap_strategy.js +0 -60
  48. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/toggler_focus_trap_strategy/toggler_focus_trap_strategy.js.map +0 -1
  49. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.d.ts +0 -13
  50. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.js +0 -43
  51. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.js.map +0 -1
  52. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller_types.d.ts +0 -14
  53. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller_types.js +0 -5
  54. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller_types.js.map +0 -1
  55. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.d.ts +0 -14
  56. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.js +0 -62
  57. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy.js.map +0 -1
  58. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy_types.d.ts +0 -8
  59. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy_types.js +0 -2
  60. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy_types.js.map +0 -1
  61. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.d.ts +0 -6
  62. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js +0 -10
  63. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js.map +0 -1
  64. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types.d.ts +0 -3
  65. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types.js +0 -2
  66. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types.js.map +0 -1
  67. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.d.ts +0 -5
  68. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js +0 -8
  69. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js.map +0 -1
  70. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy/sentinel_focus_trap_strategy.d.ts +0 -7
  71. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy/sentinel_focus_trap_strategy.js +0 -25
  72. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy/sentinel_focus_trap_strategy.js.map +0 -1
  73. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy/sentinel_focus_trap_strategy_types.d.ts +0 -4
  74. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy/sentinel_focus_trap_strategy_types.js +0 -2
  75. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy/sentinel_focus_trap_strategy_types.js.map +0 -1
  76. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/toggler_focus_trap_strategy/toggler_focus_trap_strategy.d.ts +0 -11
  77. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/toggler_focus_trap_strategy/toggler_focus_trap_strategy.js +0 -56
  78. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/toggler_focus_trap_strategy/toggler_focus_trap_strategy.js.map +0 -1
  79. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/toggler_focus_trap_strategy/toggler_focus_trap_strategy_types.d.ts +0 -4
  80. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/toggler_focus_trap_strategy/toggler_focus_trap_strategy_types.js +0 -2
  81. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/toggler_focus_trap_strategy/toggler_focus_trap_strategy_types.js.map +0 -1
@@ -1,47 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var tslib_es6 = require('../../../../../external/tslib/tslib.es6.js');
6
- require('lit');
7
- var sentinel_focus_trap_strategy = require('./strategies/sentinel_focus_trap_strategy/sentinel_focus_trap_strategy.js');
8
- var cyclic_focus_trap_strategy = require('./strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js');
9
- var toggler_focus_trap_strategy = require('./strategies/toggler_focus_trap_strategy/toggler_focus_trap_strategy.js');
10
- var focus_trap_strategy_constants = require('./strategies/focus_trap_strategy_constants.js');
11
-
12
- var _a, _FocusTrapController_strategy, _FocusTrapController_createStrategy;
13
- class FocusTrapController {
14
- constructor(host, props) {
15
- _FocusTrapController_strategy.set(this, void 0);
16
- tslib_es6.__classPrivateFieldSet(this, _FocusTrapController_strategy, tslib_es6.__classPrivateFieldGet(FocusTrapController, _a, "m", _FocusTrapController_createStrategy).call(FocusTrapController, props), "f");
17
- host.addController(this);
18
- }
19
- get strategy() {
20
- return tslib_es6.__classPrivateFieldGet(this, _FocusTrapController_strategy, "f");
21
- }
22
- hostConnected() {
23
- tslib_es6.__classPrivateFieldGet(this, _FocusTrapController_strategy, "f").attach();
24
- }
25
- hostDisconnected() {
26
- tslib_es6.__classPrivateFieldGet(this, _FocusTrapController_strategy, "f").detach();
27
- }
28
- activate() {
29
- tslib_es6.__classPrivateFieldGet(this, _FocusTrapController_strategy, "f").activate();
30
- }
31
- deactivate() {
32
- tslib_es6.__classPrivateFieldGet(this, _FocusTrapController_strategy, "f").deactivate();
33
- }
34
- getFocusableElements(container) {
35
- return tslib_es6.__classPrivateFieldGet(this, _FocusTrapController_strategy, "f").getFocusableElements(container);
36
- }
37
- }
38
- _a = FocusTrapController, _FocusTrapController_strategy = new WeakMap(), _FocusTrapController_createStrategy = function _FocusTrapController_createStrategy(props) {
39
- switch (props.mode) {
40
- case focus_trap_strategy_constants.FOCUS_TRAP_STRATEGY_TYPES.sentinel: return new sentinel_focus_trap_strategy.SentinelFocusTrapStrategy(props);
41
- case focus_trap_strategy_constants.FOCUS_TRAP_STRATEGY_TYPES.cyclic: return new cyclic_focus_trap_strategy.CyclicFocusTrapStrategy(props);
42
- case focus_trap_strategy_constants.FOCUS_TRAP_STRATEGY_TYPES.toggler: return new toggler_focus_trap_strategy.TogglerFocusTrapStrategy(props);
43
- }
44
- };
45
-
46
- exports.FocusTrapController = FocusTrapController;
47
- //# sourceMappingURL=focus_trap_controller.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;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,66 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var utilities = require('@dreamcommerce/utilities');
6
-
7
- class BaseFocusTrapStrategy {
8
- constructor(getContainer) {
9
- this.getContainer = getContainer;
10
- this.active = false;
11
- this.noAutofocus = false;
12
- this._handleKeyDown = (ev) => {
13
- if (!this.active || ev.code !== 'Tab')
14
- return;
15
- const container = this.getContainer();
16
- if (!container)
17
- return;
18
- const focusableElements = this.getFocusableElements(container);
19
- if (focusableElements.length === 0)
20
- return;
21
- const $target = ev.target;
22
- if (ev.shiftKey) {
23
- if ($target === focusableElements[0]) {
24
- ev.preventDefault();
25
- focusableElements[focusableElements.length - 1].focus();
26
- }
27
- }
28
- else {
29
- if ($target === focusableElements[focusableElements.length - 1]) {
30
- ev.preventDefault();
31
- focusableElements[0].focus();
32
- }
33
- }
34
- };
35
- }
36
- attach() {
37
- document.addEventListener('keydown', this._handleKeyDown);
38
- }
39
- detach() {
40
- document.removeEventListener('keydown', this._handleKeyDown);
41
- }
42
- activate() {
43
- this.active = true;
44
- }
45
- deactivate() {
46
- this.active = false;
47
- }
48
- getFocusableElements(container) {
49
- return utilities.UiDomUtils.getFocusableElements(container).filter(($el) => this._isElementTrulyFocusable($el));
50
- }
51
- _isElementTrulyFocusable($el) {
52
- const style = window.getComputedStyle($el);
53
- if (style.display === 'none' || style.visibility === 'hidden') {
54
- return false;
55
- }
56
- if ($el.nodeName === 'H-PORTAL')
57
- return true;
58
- const $parent = $el.parentElement;
59
- if (!$parent)
60
- return true;
61
- return this._isElementTrulyFocusable($parent);
62
- }
63
- }
64
-
65
- exports.BaseFocusTrapStrategy = BaseFocusTrapStrategy;
66
- //# sourceMappingURL=base_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;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,14 +0,0 @@
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 +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;"}
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const FOCUS_TRAP_STRATEGY_TYPES = {
6
- cyclic: 'cyclic',
7
- toggler: 'toggler',
8
- sentinel: 'sentinel',
9
- };
10
-
11
- exports.FOCUS_TRAP_STRATEGY_TYPES = FOCUS_TRAP_STRATEGY_TYPES;
12
- //# sourceMappingURL=focus_trap_strategy_constants.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;"}
@@ -1,29 +0,0 @@
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 SentinelFocusTrapStrategy extends base_focus_trap_strategy.BaseFocusTrapStrategy {
8
- constructor({ getContainer, noAutofocus = false }) {
9
- super(getContainer);
10
- this.noAutofocus = noAutofocus;
11
- }
12
- activate() {
13
- this.active = true;
14
- if (!this.noAutofocus) {
15
- requestAnimationFrame(() => {
16
- const container = this.getContainer();
17
- if (!container)
18
- return;
19
- const focusableElements = this.getFocusableElements(container);
20
- const shouldSkipStartSentinel = focusableElements.length > 1;
21
- const $firstFocusableContentElement = shouldSkipStartSentinel ? focusableElements[1] : focusableElements[0];
22
- $firstFocusableContentElement === null || $firstFocusableContentElement === void 0 ? void 0 : $firstFocusableContentElement.focus();
23
- });
24
- }
25
- }
26
- }
27
-
28
- exports.SentinelFocusTrapStrategy = SentinelFocusTrapStrategy;
29
- //# sourceMappingURL=sentinel_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;"}
@@ -1,60 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var tslib_es6 = require('../../../../../../../external/tslib/tslib.es6.js');
6
- var base_focus_trap_strategy = require('../base_focus_trap_strategy.js');
7
-
8
- var _TogglerFocusTrapStrategy_getToggler;
9
- class TogglerFocusTrapStrategy extends base_focus_trap_strategy.BaseFocusTrapStrategy {
10
- constructor({ getContainer, getToggler }) {
11
- super(getContainer);
12
- _TogglerFocusTrapStrategy_getToggler.set(this, void 0);
13
- this._handleKeyDown = (ev) => {
14
- var _a;
15
- if (!this.active || ev.code !== 'Tab')
16
- return;
17
- const container = this.getContainer();
18
- const toggler = (_a = tslib_es6.__classPrivateFieldGet(this, _TogglerFocusTrapStrategy_getToggler, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
19
- if (!container || !toggler)
20
- return;
21
- const $target = ev.target;
22
- const focusableElements = this.getFocusableElements(container);
23
- if (ev.shiftKey) {
24
- if (toggler.contains($target))
25
- return this._focusLastContentElement(ev, focusableElements);
26
- if ($target === focusableElements[0])
27
- return this._returnToToggler(ev, toggler);
28
- }
29
- else {
30
- if (toggler.contains($target))
31
- return this._focusFirstContentElement(ev, focusableElements);
32
- if ($target === focusableElements[focusableElements.length - 1])
33
- return this._returnToToggler(ev, toggler);
34
- }
35
- };
36
- tslib_es6.__classPrivateFieldSet(this, _TogglerFocusTrapStrategy_getToggler, getToggler, "f");
37
- }
38
- _focusLastContentElement(ev, focusableElements) {
39
- const last = focusableElements[focusableElements.length - 1];
40
- if (!last)
41
- return;
42
- ev.preventDefault();
43
- last.focus();
44
- }
45
- _focusFirstContentElement(ev, focusableElements) {
46
- const first = focusableElements[0];
47
- if (!first)
48
- return;
49
- ev.preventDefault();
50
- first.focus();
51
- }
52
- _returnToToggler(ev, toggler) {
53
- ev.preventDefault();
54
- toggler.focus();
55
- }
56
- }
57
- _TogglerFocusTrapStrategy_getToggler = new WeakMap();
58
-
59
- exports.TogglerFocusTrapStrategy = TogglerFocusTrapStrategy;
60
- //# sourceMappingURL=toggler_focus_trap_strategy.js.map
@@ -1 +0,0 @@
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;"}
@@ -1,13 +0,0 @@
1
- import { ReactiveController, ReactiveControllerHost } from 'lit';
2
- import type { TFocusTrapProps } from './focus_trap_controller_types';
3
- import { IBaseFocusTrapStrategy } from './strategies/base_focus_trap_strategy_types';
4
- export declare class FocusTrapController implements ReactiveController {
5
- #private;
6
- constructor(host: ReactiveControllerHost, props: TFocusTrapProps);
7
- get strategy(): IBaseFocusTrapStrategy;
8
- hostConnected(): void;
9
- hostDisconnected(): void;
10
- activate(): void;
11
- deactivate(): void;
12
- getFocusableElements(container: HTMLElement): HTMLElement[];
13
- }
@@ -1,43 +0,0 @@
1
- import { __classPrivateFieldSet, __classPrivateFieldGet } from '../../../../../external/tslib/tslib.es6.js';
2
- import 'lit';
3
- import { SentinelFocusTrapStrategy } from './strategies/sentinel_focus_trap_strategy/sentinel_focus_trap_strategy.js';
4
- import { CyclicFocusTrapStrategy } from './strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js';
5
- import { TogglerFocusTrapStrategy } from './strategies/toggler_focus_trap_strategy/toggler_focus_trap_strategy.js';
6
- import { FOCUS_TRAP_STRATEGY_TYPES } from './strategies/focus_trap_strategy_constants.js';
7
-
8
- var _a, _FocusTrapController_strategy, _FocusTrapController_createStrategy;
9
- class FocusTrapController {
10
- constructor(host, props) {
11
- _FocusTrapController_strategy.set(this, void 0);
12
- __classPrivateFieldSet(this, _FocusTrapController_strategy, __classPrivateFieldGet(FocusTrapController, _a, "m", _FocusTrapController_createStrategy).call(FocusTrapController, props), "f");
13
- host.addController(this);
14
- }
15
- get strategy() {
16
- return __classPrivateFieldGet(this, _FocusTrapController_strategy, "f");
17
- }
18
- hostConnected() {
19
- __classPrivateFieldGet(this, _FocusTrapController_strategy, "f").attach();
20
- }
21
- hostDisconnected() {
22
- __classPrivateFieldGet(this, _FocusTrapController_strategy, "f").detach();
23
- }
24
- activate() {
25
- __classPrivateFieldGet(this, _FocusTrapController_strategy, "f").activate();
26
- }
27
- deactivate() {
28
- __classPrivateFieldGet(this, _FocusTrapController_strategy, "f").deactivate();
29
- }
30
- getFocusableElements(container) {
31
- return __classPrivateFieldGet(this, _FocusTrapController_strategy, "f").getFocusableElements(container);
32
- }
33
- }
34
- _a = FocusTrapController, _FocusTrapController_strategy = new WeakMap(), _FocusTrapController_createStrategy = function _FocusTrapController_createStrategy(props) {
35
- switch (props.mode) {
36
- case FOCUS_TRAP_STRATEGY_TYPES.sentinel: return new SentinelFocusTrapStrategy(props);
37
- case FOCUS_TRAP_STRATEGY_TYPES.cyclic: return new CyclicFocusTrapStrategy(props);
38
- case FOCUS_TRAP_STRATEGY_TYPES.toggler: return new TogglerFocusTrapStrategy(props);
39
- }
40
- };
41
-
42
- export { FocusTrapController };
43
- //# sourceMappingURL=focus_trap_controller.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,+DAA+D,4CAAgD;AAC/G;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,14 +0,0 @@
1
- import { TCyclicFocusTrapStrategyProps } from "./strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types";
2
- import { FOCUS_TRAP_STRATEGY_TYPES } from "./strategies/focus_trap_strategy_constants";
3
- import { TSentinelFocusTrapStrategyProps } from "./strategies/sentinel_focus_trap_strategy/sentinel_focus_trap_strategy_types";
4
- import { TTogglerFocusTrapStrategyProps } from "./strategies/toggler_focus_trap_strategy/toggler_focus_trap_strategy_types";
5
- export declare type TSentinelFocusTrapProps = TSentinelFocusTrapStrategyProps & {
6
- mode: typeof FOCUS_TRAP_STRATEGY_TYPES.sentinel;
7
- };
8
- export declare type TCyclicFocusTrapProps = TCyclicFocusTrapStrategyProps & {
9
- mode: typeof FOCUS_TRAP_STRATEGY_TYPES.cyclic;
10
- };
11
- export declare type TTogglerFocusTrapProps = TTogglerFocusTrapStrategyProps & {
12
- mode: typeof FOCUS_TRAP_STRATEGY_TYPES.toggler;
13
- };
14
- export declare type TFocusTrapProps = TSentinelFocusTrapProps | TCyclicFocusTrapProps | TTogglerFocusTrapProps;
@@ -1,5 +0,0 @@
1
- import "./strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types";
2
- import "./strategies/focus_trap_strategy_constants";
3
- import "./strategies/sentinel_focus_trap_strategy/sentinel_focus_trap_strategy_types";
4
- import "./strategies/toggler_focus_trap_strategy/toggler_focus_trap_strategy_types";
5
- //# sourceMappingURL=focus_trap_controller_types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"focus_trap_controller_types.js","sourceRoot":"","sources":["../../../../../../../src/controllers/focus_trap_controller/focus_trap_controller_types.ts"],"names":[],"mappings":"AAAA,OAA8C,0EAA0E,CAAC;AACzH,OAA0C,4CAA4C,CAAC;AACvF,OAAgD,8EAA8E,CAAC;AAC/H,OAA+C,4EAA4E,CAAC"}
@@ -1,14 +0,0 @@
1
- import { IBaseFocusTrapStrategy } from './base_focus_trap_strategy_types';
2
- export declare abstract class BaseFocusTrapStrategy implements IBaseFocusTrapStrategy {
3
- protected readonly getContainer: () => HTMLElement | undefined;
4
- protected active: boolean;
5
- noAutofocus: boolean;
6
- constructor(getContainer: () => HTMLElement | undefined);
7
- attach(): void;
8
- detach(): void;
9
- activate(): void;
10
- deactivate(): void;
11
- getFocusableElements(container: HTMLElement): HTMLElement[];
12
- protected _handleKeyDown: (ev: KeyboardEvent) => void;
13
- private _isElementTrulyFocusable;
14
- }
@@ -1,62 +0,0 @@
1
- import { UiDomUtils } from '@dreamcommerce/utilities';
2
-
3
- class BaseFocusTrapStrategy {
4
- constructor(getContainer) {
5
- this.getContainer = getContainer;
6
- this.active = false;
7
- this.noAutofocus = false;
8
- this._handleKeyDown = (ev) => {
9
- if (!this.active || ev.code !== 'Tab')
10
- return;
11
- const container = this.getContainer();
12
- if (!container)
13
- return;
14
- const focusableElements = this.getFocusableElements(container);
15
- if (focusableElements.length === 0)
16
- return;
17
- const $target = ev.target;
18
- if (ev.shiftKey) {
19
- if ($target === focusableElements[0]) {
20
- ev.preventDefault();
21
- focusableElements[focusableElements.length - 1].focus();
22
- }
23
- }
24
- else {
25
- if ($target === focusableElements[focusableElements.length - 1]) {
26
- ev.preventDefault();
27
- focusableElements[0].focus();
28
- }
29
- }
30
- };
31
- }
32
- attach() {
33
- document.addEventListener('keydown', this._handleKeyDown);
34
- }
35
- detach() {
36
- document.removeEventListener('keydown', this._handleKeyDown);
37
- }
38
- activate() {
39
- this.active = true;
40
- }
41
- deactivate() {
42
- this.active = false;
43
- }
44
- getFocusableElements(container) {
45
- return UiDomUtils.getFocusableElements(container).filter(($el) => this._isElementTrulyFocusable($el));
46
- }
47
- _isElementTrulyFocusable($el) {
48
- const style = window.getComputedStyle($el);
49
- if (style.display === 'none' || style.visibility === 'hidden') {
50
- return false;
51
- }
52
- if ($el.nodeName === 'H-PORTAL')
53
- return true;
54
- const $parent = $el.parentElement;
55
- if (!$parent)
56
- return true;
57
- return this._isElementTrulyFocusable($parent);
58
- }
59
- }
60
-
61
- export { BaseFocusTrapStrategy };
62
- //# sourceMappingURL=base_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;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,8 +0,0 @@
1
- export interface IBaseFocusTrapStrategy {
2
- noAutofocus: boolean;
3
- attach(): void;
4
- detach(): void;
5
- activate(): void;
6
- deactivate(): void;
7
- getFocusableElements(container: HTMLElement): HTMLElement[];
8
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=base_focus_trap_strategy_types.js.map
@@ -1 +0,0 @@
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":""}
@@ -1,6 +0,0 @@
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
- }
@@ -1,10 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -1,3 +0,0 @@
1
- export declare type TCyclicFocusTrapStrategyProps = {
2
- getContainer: () => HTMLElement | undefined;
3
- };
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=cyclic_focus_trap_strategy_types.js.map
@@ -1 +0,0 @@
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,5 +0,0 @@
1
- export declare const FOCUS_TRAP_STRATEGY_TYPES: {
2
- readonly cyclic: "cyclic";
3
- readonly toggler: "toggler";
4
- readonly sentinel: "sentinel";
5
- };
@@ -1,8 +0,0 @@
1
- const FOCUS_TRAP_STRATEGY_TYPES = {
2
- cyclic: 'cyclic',
3
- toggler: 'toggler',
4
- sentinel: 'sentinel',
5
- };
6
-
7
- export { FOCUS_TRAP_STRATEGY_TYPES };
8
- //# sourceMappingURL=focus_trap_strategy_constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -1,7 +0,0 @@
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
- }
@@ -1,25 +0,0 @@
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 +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;"}
@@ -1,4 +0,0 @@
1
- export declare type TSentinelFocusTrapStrategyProps = {
2
- getContainer: () => HTMLElement | undefined;
3
- noAutofocus?: boolean;
4
- };
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=sentinel_focus_trap_strategy_types.js.map
@@ -1 +0,0 @@
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":""}
@@ -1,11 +0,0 @@
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
- private _focusLastContentElement;
9
- private _focusFirstContentElement;
10
- private _returnToToggler;
11
- }
@@ -1,56 +0,0 @@
1
- import { __classPrivateFieldGet, __classPrivateFieldSet } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import { BaseFocusTrapStrategy } from '../base_focus_trap_strategy.js';
3
-
4
- var _TogglerFocusTrapStrategy_getToggler;
5
- class TogglerFocusTrapStrategy extends BaseFocusTrapStrategy {
6
- constructor({ getContainer, getToggler }) {
7
- super(getContainer);
8
- _TogglerFocusTrapStrategy_getToggler.set(this, void 0);
9
- this._handleKeyDown = (ev) => {
10
- var _a;
11
- if (!this.active || ev.code !== 'Tab')
12
- return;
13
- const container = this.getContainer();
14
- const toggler = (_a = __classPrivateFieldGet(this, _TogglerFocusTrapStrategy_getToggler, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
15
- if (!container || !toggler)
16
- return;
17
- const $target = ev.target;
18
- const focusableElements = this.getFocusableElements(container);
19
- if (ev.shiftKey) {
20
- if (toggler.contains($target))
21
- return this._focusLastContentElement(ev, focusableElements);
22
- if ($target === focusableElements[0])
23
- return this._returnToToggler(ev, toggler);
24
- }
25
- else {
26
- if (toggler.contains($target))
27
- return this._focusFirstContentElement(ev, focusableElements);
28
- if ($target === focusableElements[focusableElements.length - 1])
29
- return this._returnToToggler(ev, toggler);
30
- }
31
- };
32
- __classPrivateFieldSet(this, _TogglerFocusTrapStrategy_getToggler, getToggler, "f");
33
- }
34
- _focusLastContentElement(ev, focusableElements) {
35
- const last = focusableElements[focusableElements.length - 1];
36
- if (!last)
37
- return;
38
- ev.preventDefault();
39
- last.focus();
40
- }
41
- _focusFirstContentElement(ev, focusableElements) {
42
- const first = focusableElements[0];
43
- if (!first)
44
- return;
45
- ev.preventDefault();
46
- first.focus();
47
- }
48
- _returnToToggler(ev, toggler) {
49
- ev.preventDefault();
50
- toggler.focus();
51
- }
52
- }
53
- _TogglerFocusTrapStrategy_getToggler = new WeakMap();
54
-
55
- export { TogglerFocusTrapStrategy };
56
- //# sourceMappingURL=toggler_focus_trap_strategy.js.map
@@ -1 +0,0 @@
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;"}