@shoper/phoenix_design_system 1.18.23-7 → 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.
Files changed (62) hide show
  1. package/build/cjs/packages/phoenix/src/components/form/search/search.js +3 -3
  2. package/build/cjs/packages/phoenix/src/components/modal/modal.js +2 -10
  3. package/build/cjs/packages/phoenix/src/components/modal/modal.js.map +1 -1
  4. package/build/cjs/packages/phoenix/src/components/sheet/sheet.js +2 -10
  5. package/build/cjs/packages/phoenix/src/components/sheet/sheet.js.map +1 -1
  6. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/{focus_trap_strategy.js → base_focus_trap_strategy.js} +4 -3
  7. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/{focus_trap_strategy.js.map → base_focus_trap_strategy.js.map} +1 -1
  8. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js +14 -0
  9. 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
  10. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js +3 -3
  11. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy/sentinel_focus_trap_strategy.js +29 -0
  12. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy/sentinel_focus_trap_strategy.js.map +1 -0
  13. 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
  14. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/{sentinel_focus_trap_strategy.js.map → toggler_focus_trap_strategy/toggler_focus_trap_strategy.js.map} +1 -1
  15. package/build/esm/packages/phoenix/src/components/form/search/search.d.ts +2 -1
  16. package/build/esm/packages/phoenix/src/components/form/search/search.js +3 -3
  17. package/build/esm/packages/phoenix/src/components/modal/modal.d.ts +0 -4
  18. package/build/esm/packages/phoenix/src/components/modal/modal.js +2 -10
  19. package/build/esm/packages/phoenix/src/components/modal/modal.js.map +1 -1
  20. package/build/esm/packages/phoenix/src/components/sheet/sheet.d.ts +0 -4
  21. package/build/esm/packages/phoenix/src/components/sheet/sheet.js +2 -10
  22. package/build/esm/packages/phoenix/src/components/sheet/sheet.js.map +1 -1
  23. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/focus_trap_controller.d.ts +3 -7
  24. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/{focus_trap_strategy.d.ts → base_focus_trap_strategy.d.ts} +3 -2
  25. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/{focus_trap_strategy.js → base_focus_trap_strategy.js} +4 -3
  26. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/{focus_trap_strategy.js.map → base_focus_trap_strategy.js.map} +1 -1
  27. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy_types.d.ts +8 -0
  28. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy_types.js +2 -0
  29. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/base_focus_trap_strategy_types.js.map +1 -0
  30. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.d.ts +6 -0
  31. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js +10 -0
  32. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy.js.map +1 -0
  33. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types.d.ts +3 -0
  34. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types.js +2 -0
  35. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy/cyclic_focus_trap_strategy_types.js.map +1 -0
  36. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.d.ts +3 -3
  37. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_constants.js +3 -3
  38. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy/sentinel_focus_trap_strategy.d.ts +7 -0
  39. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy/sentinel_focus_trap_strategy.js +25 -0
  40. 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
  41. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy/sentinel_focus_trap_strategy_types.d.ts +4 -0
  42. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy/sentinel_focus_trap_strategy_types.js +2 -0
  43. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy/sentinel_focus_trap_strategy_types.js.map +1 -0
  44. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/toggler_focus_trap_strategy/toggler_focus_trap_strategy.d.ts +8 -0
  45. 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
  46. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/{sentinel_focus_trap_strategy.js.map → toggler_focus_trap_strategy/toggler_focus_trap_strategy.js.map} +1 -1
  47. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/toggler_focus_trap_strategy/toggler_focus_trap_strategy_types.d.ts +4 -0
  48. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/toggler_focus_trap_strategy/toggler_focus_trap_strategy_types.js +2 -0
  49. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/toggler_focus_trap_strategy/toggler_focus_trap_strategy_types.js.map +1 -0
  50. package/package.json +1 -1
  51. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy.js +0 -24
  52. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy.js +0 -64
  53. package/build/cjs/packages/phoenix/src/controllers/focus_trap_controller/strategies/toggler_focus_trap_strategy.js.map +0 -1
  54. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy.d.ts +0 -18
  55. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/cyclic_focus_trap_strategy.js +0 -20
  56. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_types.d.ts +0 -15
  57. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_types.js +0 -2
  58. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/focus_trap_strategy_types.js.map +0 -1
  59. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy.d.ts +0 -29
  60. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/sentinel_focus_trap_strategy.js +0 -60
  61. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/toggler_focus_trap_strategy.d.ts +0 -20
  62. package/build/esm/packages/phoenix/src/controllers/focus_trap_controller/strategies/toggler_focus_trap_strategy.js.map +0 -1
@@ -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._mobileFocusTrapController = new focus_trap_controller.FocusTrapController(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._mobileFocusTrapController.activate();
379
+ this.mobileFocusTrapController.activate();
380
380
  };
381
381
  this._deactivateMobileDialog = () => {
382
382
  this.removeAttribute('role');
383
383
  this.removeAttribute('aria-modal');
384
- this._mobileFocusTrapController.deactivate();
384
+ this.mobileFocusTrapController.deactivate();
385
385
  };
386
386
  this._setupAriaAttributes = () => {
387
387
  var _a;
@@ -6,7 +6,6 @@ var tslib_es6 = require('../../../../../external/tslib/tslib.es6.js');
6
6
  var phoenix_light_lit_element = require('../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
7
7
  var phoenix_custom_element = require('../../core/decorators/phoenix_custom_element.js');
8
8
  var decorators_js = require('@lit/reactive-element/decorators.js');
9
- require('@lit/reactive-element');
10
9
  var litHtml = require('lit-html');
11
10
  var ref_js = require('lit-html/directives/ref.js');
12
11
  var portal_constants = require('../portal/portal_constants.js');
@@ -27,8 +26,6 @@ exports.HModal = HModal_1 = class HModal extends phoenix_light_lit_element.Phoen
27
26
  this.noAutofocus = false;
28
27
  this._focusedToggler = null;
29
28
  this._contentRef = ref_js.createRef();
30
- this._focusSentinelStart = ref_js.createRef();
31
- this._focusSentinelEnd = ref_js.createRef();
32
29
  this._propsChangeStrategies = {
33
30
  [modal_constants.MODAL_OPENED_PROP]: {
34
31
  true: () => {
@@ -136,10 +133,6 @@ exports.HModal = HModal_1 = class HModal extends phoenix_light_lit_element.Phoen
136
133
  document.removeEventListener(modal_constants.MODAL_EVENTS.close, this._handleCloseFromCloseComponent);
137
134
  document.removeEventListener('keydown', this._bindCloseOnEsc);
138
135
  }
139
- firstUpdated(props) {
140
- super.firstUpdated(props);
141
- this._focusTrapController.strategy.setSentinels(this._focusSentinelStart.value, this._focusSentinelEnd.value);
142
- }
143
136
  updated(changedProps) {
144
137
  if (changedProps.has(modal_constants.MODAL_OPENED_PROP)) {
145
138
  this._propsChangeStrategies[modal_constants.MODAL_OPENED_PROP][String(this[modal_constants.MODAL_OPENED_PROP])]();
@@ -163,7 +156,6 @@ exports.HModal = HModal_1 = class HModal extends phoenix_light_lit_element.Phoen
163
156
  setTimeout(() => {
164
157
  var _a;
165
158
  (_a = this._contentRef.value) === null || _a === void 0 ? void 0 : _a.classList.remove(`modal_show-${this.transition}-start`, `modal_show-${this.transition}-end`);
166
- this._focusTrapController.strategy.focusFirst();
167
159
  resolve();
168
160
  }, transitionDuration);
169
161
  });
@@ -191,11 +183,11 @@ exports.HModal = HModal_1 = class HModal extends phoenix_light_lit_element.Phoen
191
183
  return litHtml.html `
192
184
  <h-portal ?disabled="${!this.opened}" to="${modal_constants.MODALS_PORTAL_NAME}" hidden>
193
185
  <div class="modal-wrapper ${this.class}">
194
- <div tabindex="0" ${ref_js.ref(this._focusSentinelStart)}></div>
186
+ <div tabindex="0"></div>
195
187
  <div ${ref_js.ref(this._contentRef)} class="modal" role="dialog" aria-label="${this.modalLabel}">
196
188
  <div class="modal__container">${this.getSlot('header')} ${this.getSlot('body')} ${this.getSlot('footer')}</div>
197
189
  </div>
198
- <div tabindex="0" ${ref_js.ref(this._focusSentinelEnd)}></div>
190
+ <div tabindex="0"></div>
199
191
  </div>
200
192
  </h-portal>
201
193
  `;
@@ -1 +1 @@
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;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;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;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
+ {"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;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;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;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;"}
@@ -6,7 +6,6 @@ var tslib_es6 = require('../../../../../external/tslib/tslib.es6.js');
6
6
  var phoenix_light_lit_element = require('../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
7
7
  var phoenix_custom_element = require('../../core/decorators/phoenix_custom_element.js');
8
8
  var decorators_js = require('@lit/reactive-element/decorators.js');
9
- require('@lit/reactive-element');
10
9
  var litHtml = require('lit-html');
11
10
  var ref_js = require('lit-html/directives/ref.js');
12
11
  var portal_constants = require('../portal/portal_constants.js');
@@ -26,8 +25,6 @@ exports.HSheet = HSheet_1 = class HSheet extends phoenix_light_lit_element.Phoen
26
25
  this.sheetLabel = '';
27
26
  this._focusedToggler = null;
28
27
  this._contentRef = ref_js.createRef();
29
- this._focusSentinelStart = ref_js.createRef();
30
- this._focusSentinelEnd = ref_js.createRef();
31
28
  this._propsChangeStrategies = {
32
29
  [sheet_constants.SHEET_OPENED_PROP]: {
33
30
  true: () => {
@@ -134,10 +131,6 @@ exports.HSheet = HSheet_1 = class HSheet extends phoenix_light_lit_element.Phoen
134
131
  document.removeEventListener(sheet_constants.SHEET_EVENTS.close, this._handleCloseFromCloseComponent);
135
132
  document.removeEventListener('keydown', this._bindCloseOnEsc);
136
133
  }
137
- firstUpdated(props) {
138
- super.firstUpdated(props);
139
- this._focusTrapController.strategy.setSentinels(this._focusSentinelStart.value, this._focusSentinelEnd.value);
140
- }
141
134
  updated(changedProps) {
142
135
  if (changedProps.has(sheet_constants.SHEET_OPENED_PROP)) {
143
136
  this._propsChangeStrategies[sheet_constants.SHEET_OPENED_PROP][String(this[sheet_constants.SHEET_OPENED_PROP])]();
@@ -158,7 +151,6 @@ exports.HSheet = HSheet_1 = class HSheet extends phoenix_light_lit_element.Phoen
158
151
  setTimeout(() => {
159
152
  var _a;
160
153
  (_a = this._contentRef.value) === null || _a === void 0 ? void 0 : _a.classList.remove(`sheet_show-${this.transition}-start`, `sheet_show-${this.transition}-end`);
161
- this._focusTrapController.strategy.focusFirst();
162
154
  resolve();
163
155
  }, transitionDuration);
164
156
  });
@@ -184,11 +176,11 @@ exports.HSheet = HSheet_1 = class HSheet extends phoenix_light_lit_element.Phoen
184
176
  return litHtml.html `
185
177
  <h-portal ?disabled="${!this.opened}" to="${sheet_constants.SHEETS_PORTAL_NAME}" hidden>
186
178
  <div class="sheet-wrapper ${this.class}">
187
- <div tabindex="0" ${ref_js.ref(this._focusSentinelStart)}></div>
179
+ <div tabindex="0"></div>
188
180
  <div ${ref_js.ref(this._contentRef)} class="sheet" role="dialog" aria-label="${this.sheetLabel}">
189
181
  <div class="sheet__container">${this.getSlot('header')} ${this.getSlot('body')} ${this.getSlot('footer')}</div>
190
182
  </div>
191
- <div tabindex="0" ${ref_js.ref(this._focusSentinelEnd)}></div>
183
+ <div tabindex="0"></div>
192
184
  </div>
193
185
  </h-portal>
194
186
  `;
@@ -1 +1 @@
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;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;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;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
+ {"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;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;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;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;"}
@@ -4,10 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var utilities = require('@dreamcommerce/utilities');
6
6
 
7
- class FocusTrapStrategy {
7
+ class BaseFocusTrapStrategy {
8
8
  constructor(getContainer) {
9
9
  this.getContainer = getContainer;
10
10
  this.active = false;
11
+ this.noAutofocus = false;
11
12
  this._handleKeyDown = (ev) => {
12
13
  if (!this.active || ev.code !== 'Tab')
13
14
  return;
@@ -61,5 +62,5 @@ class FocusTrapStrategy {
61
62
  }
62
63
  }
63
64
 
64
- exports.FocusTrapStrategy = FocusTrapStrategy;
65
- //# sourceMappingURL=focus_trap_strategy.js.map
65
+ exports.BaseFocusTrapStrategy = BaseFocusTrapStrategy;
66
+ //# sourceMappingURL=base_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;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
+ {"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;"}
@@ -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;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',
@@ -0,0 +1,29 @@
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
@@ -0,0 +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;"}
@@ -2,20 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var tslib_es6 = require('../../../../../../external/tslib/tslib.es6.js');
6
- var focus_trap_strategy = require('./focus_trap_strategy.js');
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,+CAAmD;AAC3E;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
+ {"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
- private _mobileFocusTrapController;
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._mobileFocusTrapController = new FocusTrapController(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._mobileFocusTrapController.activate();
375
+ this.mobileFocusTrapController.activate();
376
376
  };
377
377
  this._deactivateMobileDialog = () => {
378
378
  this.removeAttribute('role');
379
379
  this.removeAttribute('aria-modal');
380
- this._mobileFocusTrapController.deactivate();
380
+ this.mobileFocusTrapController.deactivate();
381
381
  };
382
382
  this._setupAriaAttributes = () => {
383
383
  var _a;
@@ -1,6 +1,5 @@
1
1
  import { TemplateResult } from 'lit-html';
2
2
  import { PhoenixLightLitElement } from "../../core/phoenix_light_lit_element/phoenix_light_lit_element";
3
- import { PropertyValues } from '@lit/reactive-element';
4
3
  export declare class HModal extends PhoenixLightLitElement {
5
4
  opened: boolean;
6
5
  class: string;
@@ -9,8 +8,6 @@ export declare class HModal extends PhoenixLightLitElement {
9
8
  noAutofocus: boolean;
10
9
  private _focusedToggler;
11
10
  private _contentRef;
12
- private _focusSentinelStart;
13
- private _focusSentinelEnd;
14
11
  private _propsChangeStrategies;
15
12
  private static openModals;
16
13
  private _backdropController;
@@ -20,7 +17,6 @@ export declare class HModal extends PhoenixLightLitElement {
20
17
  constructor();
21
18
  connectedCallback(): void;
22
19
  disconnectedCallback(): void;
23
- firstUpdated(props: PropertyValues): void;
24
20
  updated(changedProps: Map<string, any>): void;
25
21
  private _handleCloseFromCloseComponent;
26
22
  private _bindCloseOnEsc;
@@ -2,7 +2,6 @@ import { __decorate, __metadata } from '../../../../../external/tslib/tslib.es6.
2
2
  import { PhoenixLightLitElement } from '../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
3
3
  import { phoenixCustomElement } from '../../core/decorators/phoenix_custom_element.js';
4
4
  import { property } from '@lit/reactive-element/decorators.js';
5
- import '@lit/reactive-element';
6
5
  import { html } from 'lit-html';
7
6
  import { createRef, ref } from 'lit-html/directives/ref.js';
8
7
  import { PORTAL_TARGET_COMPONENT_NAME, PORTAL_TARGET_NAME_PROP } from '../portal/portal_constants.js';
@@ -23,8 +22,6 @@ let HModal = HModal_1 = class HModal extends PhoenixLightLitElement {
23
22
  this.noAutofocus = false;
24
23
  this._focusedToggler = null;
25
24
  this._contentRef = createRef();
26
- this._focusSentinelStart = createRef();
27
- this._focusSentinelEnd = createRef();
28
25
  this._propsChangeStrategies = {
29
26
  [MODAL_OPENED_PROP]: {
30
27
  true: () => {
@@ -132,10 +129,6 @@ let HModal = HModal_1 = class HModal extends PhoenixLightLitElement {
132
129
  document.removeEventListener(MODAL_EVENTS.close, this._handleCloseFromCloseComponent);
133
130
  document.removeEventListener('keydown', this._bindCloseOnEsc);
134
131
  }
135
- firstUpdated(props) {
136
- super.firstUpdated(props);
137
- this._focusTrapController.strategy.setSentinels(this._focusSentinelStart.value, this._focusSentinelEnd.value);
138
- }
139
132
  updated(changedProps) {
140
133
  if (changedProps.has(MODAL_OPENED_PROP)) {
141
134
  this._propsChangeStrategies[MODAL_OPENED_PROP][String(this[MODAL_OPENED_PROP])]();
@@ -159,7 +152,6 @@ let HModal = HModal_1 = class HModal extends PhoenixLightLitElement {
159
152
  setTimeout(() => {
160
153
  var _a;
161
154
  (_a = this._contentRef.value) === null || _a === void 0 ? void 0 : _a.classList.remove(`modal_show-${this.transition}-start`, `modal_show-${this.transition}-end`);
162
- this._focusTrapController.strategy.focusFirst();
163
155
  resolve();
164
156
  }, transitionDuration);
165
157
  });
@@ -187,11 +179,11 @@ let HModal = HModal_1 = class HModal extends PhoenixLightLitElement {
187
179
  return html `
188
180
  <h-portal ?disabled="${!this.opened}" to="${MODALS_PORTAL_NAME}" hidden>
189
181
  <div class="modal-wrapper ${this.class}">
190
- <div tabindex="0" ${ref(this._focusSentinelStart)}></div>
182
+ <div tabindex="0"></div>
191
183
  <div ${ref(this._contentRef)} class="modal" role="dialog" aria-label="${this.modalLabel}">
192
184
  <div class="modal__container">${this.getSlot('header')} ${this.getSlot('body')} ${this.getSlot('footer')}</div>
193
185
  </div>
194
- <div tabindex="0" ${ref(this._focusSentinelEnd)}></div>
186
+ <div tabindex="0"></div>
195
187
  </div>
196
188
  </h-portal>
197
189
  `;
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;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;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;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;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
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;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;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;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;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,5 @@
1
1
  import { TemplateResult } from 'lit-html';
2
2
  import { PhoenixLightLitElement } from "../../core/phoenix_light_lit_element/phoenix_light_lit_element";
3
- import { PropertyValues } from '@lit/reactive-element';
4
3
  export declare class HSheet extends PhoenixLightLitElement {
5
4
  opened: boolean;
6
5
  class: string;
@@ -8,8 +7,6 @@ export declare class HSheet extends PhoenixLightLitElement {
8
7
  sheetLabel: string;
9
8
  private _focusedToggler;
10
9
  private _contentRef;
11
- private _focusSentinelStart;
12
- private _focusSentinelEnd;
13
10
  private _propsChangeStrategies;
14
11
  private static openSheets;
15
12
  private _backdropController;
@@ -19,7 +16,6 @@ export declare class HSheet extends PhoenixLightLitElement {
19
16
  constructor();
20
17
  connectedCallback(): void;
21
18
  disconnectedCallback(): void;
22
- firstUpdated(props: PropertyValues): void;
23
19
  updated(changedProps: Map<string, any>): void;
24
20
  private _handleCloseFromCloseComponent;
25
21
  private _bindCloseOnEsc;
@@ -2,7 +2,6 @@ import { __decorate, __metadata } from '../../../../../external/tslib/tslib.es6.
2
2
  import { PhoenixLightLitElement } from '../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
3
3
  import { phoenixCustomElement } from '../../core/decorators/phoenix_custom_element.js';
4
4
  import { property } from '@lit/reactive-element/decorators.js';
5
- import '@lit/reactive-element';
6
5
  import { html } from 'lit-html';
7
6
  import { createRef, ref } from 'lit-html/directives/ref.js';
8
7
  import { PORTAL_TARGET_COMPONENT_NAME, PORTAL_TARGET_NAME_PROP } from '../portal/portal_constants.js';
@@ -22,8 +21,6 @@ let HSheet = HSheet_1 = class HSheet extends PhoenixLightLitElement {
22
21
  this.sheetLabel = '';
23
22
  this._focusedToggler = null;
24
23
  this._contentRef = createRef();
25
- this._focusSentinelStart = createRef();
26
- this._focusSentinelEnd = createRef();
27
24
  this._propsChangeStrategies = {
28
25
  [SHEET_OPENED_PROP]: {
29
26
  true: () => {
@@ -130,10 +127,6 @@ let HSheet = HSheet_1 = class HSheet extends PhoenixLightLitElement {
130
127
  document.removeEventListener(SHEET_EVENTS.close, this._handleCloseFromCloseComponent);
131
128
  document.removeEventListener('keydown', this._bindCloseOnEsc);
132
129
  }
133
- firstUpdated(props) {
134
- super.firstUpdated(props);
135
- this._focusTrapController.strategy.setSentinels(this._focusSentinelStart.value, this._focusSentinelEnd.value);
136
- }
137
130
  updated(changedProps) {
138
131
  if (changedProps.has(SHEET_OPENED_PROP)) {
139
132
  this._propsChangeStrategies[SHEET_OPENED_PROP][String(this[SHEET_OPENED_PROP])]();
@@ -154,7 +147,6 @@ let HSheet = HSheet_1 = class HSheet extends PhoenixLightLitElement {
154
147
  setTimeout(() => {
155
148
  var _a;
156
149
  (_a = this._contentRef.value) === null || _a === void 0 ? void 0 : _a.classList.remove(`sheet_show-${this.transition}-start`, `sheet_show-${this.transition}-end`);
157
- this._focusTrapController.strategy.focusFirst();
158
150
  resolve();
159
151
  }, transitionDuration);
160
152
  });
@@ -180,11 +172,11 @@ let HSheet = HSheet_1 = class HSheet extends PhoenixLightLitElement {
180
172
  return html `
181
173
  <h-portal ?disabled="${!this.opened}" to="${SHEETS_PORTAL_NAME}" hidden>
182
174
  <div class="sheet-wrapper ${this.class}">
183
- <div tabindex="0" ${ref(this._focusSentinelStart)}></div>
175
+ <div tabindex="0"></div>
184
176
  <div ${ref(this._contentRef)} class="sheet" role="dialog" aria-label="${this.sheetLabel}">
185
177
  <div class="sheet__container">${this.getSlot('header')} ${this.getSlot('body')} ${this.getSlot('footer')}</div>
186
178
  </div>
187
- <div tabindex="0" ${ref(this._focusSentinelEnd)}></div>
179
+ <div tabindex="0"></div>
188
180
  </div>
189
181
  </h-portal>
190
182
  `;
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;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;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;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;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,uCAAuC,4CAAgD;AACvF;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;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;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -1,17 +1,13 @@
1
1
  import { ReactiveController, ReactiveControllerHost } from 'lit';
2
- import type { SentinelFocusTrapStrategy } from './strategies/sentinel_focus_trap_strategy';
3
- import type { CyclicFocusTrapStrategy } from './strategies/cyclic_focus_trap_strategy';
4
- import type { TogglerFocusTrapStrategy } from './strategies/toggler_focus_trap_strategy';
5
- import type { TFocusTrapProps, TSentinelFocusTrapProps, TCyclicFocusTrapProps } from './focus_trap_controller_types';
6
- declare type StrategyFor<T extends TFocusTrapProps> = T extends TSentinelFocusTrapProps ? SentinelFocusTrapStrategy : T extends TCyclicFocusTrapProps ? CyclicFocusTrapStrategy : TogglerFocusTrapStrategy;
2
+ import type { TFocusTrapProps } from './focus_trap_controller_types';
3
+ import { IBaseFocusTrapStrategy } from './strategies/base_focus_trap_strategy_types';
7
4
  export declare class FocusTrapController<TProps extends TFocusTrapProps = TFocusTrapProps> implements ReactiveController {
8
5
  #private;
9
6
  constructor(host: ReactiveControllerHost, { mode, ...strategyProps }: TProps);
10
- get strategy(): StrategyFor<TProps>;
7
+ get strategy(): IBaseFocusTrapStrategy;
11
8
  hostConnected(): void;
12
9
  hostDisconnected(): void;
13
10
  activate(): void;
14
11
  deactivate(): void;
15
12
  getFocusableElements(container: HTMLElement): HTMLElement[];
16
13
  }
17
- export {};
@@ -1,7 +1,8 @@
1
- import { IFocusTrapStrategy } from './focus_trap_strategy_types';
2
- export declare abstract class FocusTrapStrategy implements IFocusTrapStrategy {
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
+ noAutofocus: boolean;
5
6
  constructor(getContainer: () => HTMLElement | undefined);
6
7
  attach(): void;
7
8
  detach(): void;
@@ -1,9 +1,10 @@
1
1
  import { UiDomUtils } from '@dreamcommerce/utilities';
2
2
 
3
- class FocusTrapStrategy {
3
+ class BaseFocusTrapStrategy {
4
4
  constructor(getContainer) {
5
5
  this.getContainer = getContainer;
6
6
  this.active = false;
7
+ this.noAutofocus = false;
7
8
  this._handleKeyDown = (ev) => {
8
9
  if (!this.active || ev.code !== 'Tab')
9
10
  return;
@@ -57,5 +58,5 @@ class FocusTrapStrategy {
57
58
  }
58
59
  }
59
60
 
60
- export { FocusTrapStrategy };
61
- //# sourceMappingURL=focus_trap_strategy.js.map
61
+ export { BaseFocusTrapStrategy };
62
+ //# sourceMappingURL=base_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;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
+ {"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;"}
@@ -0,0 +1,8 @@
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
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=base_focus_trap_strategy_types.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,3 @@
1
+ export declare type TCyclicFocusTrapStrategyProps = {
2
+ getContainer: () => HTMLElement | undefined;
3
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=cyclic_focus_trap_strategy_types.js.map
@@ -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,4 @@
1
+ export declare type TSentinelFocusTrapStrategyProps = {
2
+ getContainer: () => HTMLElement | undefined;
3
+ noAutofocus?: boolean;
4
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sentinel_focus_trap_strategy_types.js.map
@@ -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 '../../../../../../external/tslib/tslib.es6.js';
2
- import { FocusTrapStrategy } from './focus_trap_strategy.js';
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,+CAAmD;AAClH;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
+ {"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,4 @@
1
+ export declare type TTogglerFocusTrapStrategyProps = {
2
+ getContainer: () => HTMLElement | undefined;
3
+ getToggler: () => HTMLElement | null | undefined;
4
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=toggler_focus_trap_strategy_types.js.map
@@ -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
@@ -2,7 +2,7 @@
2
2
  "name": "@shoper/phoenix_design_system",
3
3
  "packageManager": "yarn@3.2.0",
4
4
  "sideEffects": false,
5
- "version": "1.18.23-7",
5
+ "version": "1.18.23-9",
6
6
  "description": "phoenix design system",
7
7
  "author": "zefirek",
8
8
  "license": "MIT",
@@ -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,64 +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('@dreamcommerce/utilities');
7
- var focus_trap_strategy = require('./focus_trap_strategy.js');
8
-
9
- var _SentinelFocusTrapStrategy_sentinelStart, _SentinelFocusTrapStrategy_sentinelEnd;
10
- /**
11
- * Sentinel mode focus trap.
12
- *
13
- * Uses two inert bookend elements (sentinelStart / sentinelEnd) to detect when focus
14
- * escapes the container and cycle it back. Appropriate for modal dialogs and sheets where
15
- * background content is marked `inert`, giving the browser an extra safety net.
16
- *
17
- * Reacts on `keyup` so that the browser's native focus movement has already completed
18
- * before we redirect it.
19
- */
20
- class SentinelFocusTrapStrategy extends focus_trap_strategy.FocusTrapStrategy {
21
- constructor({ getContainer, noAutofocus = false }) {
22
- super(getContainer);
23
- _SentinelFocusTrapStrategy_sentinelStart.set(this, void 0);
24
- _SentinelFocusTrapStrategy_sentinelEnd.set(this, void 0);
25
- this.noAutofocus = noAutofocus;
26
- }
27
- /** Call once in firstUpdated with the two bookend sentinel elements. */
28
- setSentinels(start, end) {
29
- tslib_es6.__classPrivateFieldSet(this, _SentinelFocusTrapStrategy_sentinelStart, start, "f");
30
- tslib_es6.__classPrivateFieldSet(this, _SentinelFocusTrapStrategy_sentinelEnd, end, "f");
31
- }
32
- /**
33
- * Move focus to the first real interactive element after the open transition
34
- * completes (skips sentinelStart at index 0).
35
- */
36
- focusFirst() {
37
- if (this.noAutofocus)
38
- return;
39
- requestAnimationFrame(() => {
40
- const container = this.getContainer();
41
- if (!container)
42
- return;
43
- const focusableElements = this.getFocusableElements(container);
44
- if (focusableElements.length > 0) {
45
- focusableElements.length > 1 ? focusableElements[1].focus() : focusableElements[0].focus();
46
- }
47
- });
48
- }
49
- activate() {
50
- this.active = true;
51
- if (!this.noAutofocus) {
52
- const scrollY = window.scrollY;
53
- setTimeout(() => {
54
- var _a;
55
- (_a = tslib_es6.__classPrivateFieldGet(this, _SentinelFocusTrapStrategy_sentinelStart, "f")) === null || _a === void 0 ? void 0 : _a.focus();
56
- window.scrollTo(0, scrollY);
57
- }, 0);
58
- }
59
- }
60
- }
61
- _SentinelFocusTrapStrategy_sentinelStart = new WeakMap(), _SentinelFocusTrapStrategy_sentinelEnd = new WeakMap();
62
-
63
- exports.SentinelFocusTrapStrategy = SentinelFocusTrapStrategy;
64
- //# 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,wBAAwB,+CAAmD;AAC3E;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,18 +0,0 @@
1
- import { FocusTrapStrategy } from './focus_trap_strategy';
2
- import { ICyclicFocusTrapStrategy } 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 ICyclicFocusTrapStrategy {
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,15 +0,0 @@
1
- export interface IFocusTrapStrategy {
2
- attach(): void;
3
- detach(): void;
4
- activate(): void;
5
- deactivate(): void;
6
- getFocusableElements(container: HTMLElement): HTMLElement[];
7
- }
8
- export interface ICyclicFocusTrapStrategy extends IFocusTrapStrategy {
9
- }
10
- export interface ITogglerFocusTrapStrategy extends IFocusTrapStrategy {
11
- }
12
- export interface ISentinelFocusTrapStrategy extends IFocusTrapStrategy {
13
- setSentinels(start: HTMLElement, end: HTMLElement): void;
14
- focusFirst(): void;
15
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=focus_trap_strategy_types.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,29 +0,0 @@
1
- import { FocusTrapStrategy } from './focus_trap_strategy';
2
- import { ISentinelFocusTrapStrategy } 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
- * Uses two inert bookend elements (sentinelStart / sentinelEnd) to detect when focus
11
- * escapes the container and cycle it back. Appropriate for modal dialogs and sheets where
12
- * background content is marked `inert`, giving the browser an extra safety net.
13
- *
14
- * Reacts on `keyup` so that the browser's native focus movement has already completed
15
- * before we redirect it.
16
- */
17
- export declare class SentinelFocusTrapStrategy extends FocusTrapStrategy implements ISentinelFocusTrapStrategy {
18
- #private;
19
- noAutofocus: boolean;
20
- constructor({ getContainer, noAutofocus }: TSentinelFocusTrapStrategyProps);
21
- /** Call once in firstUpdated with the two bookend sentinel elements. */
22
- setSentinels(start: HTMLElement, end: HTMLElement): void;
23
- /**
24
- * Move focus to the first real interactive element after the open transition
25
- * completes (skips sentinelStart at index 0).
26
- */
27
- focusFirst(): void;
28
- activate(): void;
29
- }
@@ -1,60 +0,0 @@
1
- import { __classPrivateFieldSet, __classPrivateFieldGet } from '../../../../../../external/tslib/tslib.es6.js';
2
- import '@dreamcommerce/utilities';
3
- import { FocusTrapStrategy } from './focus_trap_strategy.js';
4
-
5
- var _SentinelFocusTrapStrategy_sentinelStart, _SentinelFocusTrapStrategy_sentinelEnd;
6
- /**
7
- * Sentinel mode focus trap.
8
- *
9
- * Uses two inert bookend elements (sentinelStart / sentinelEnd) to detect when focus
10
- * escapes the container and cycle it back. Appropriate for modal dialogs and sheets where
11
- * background content is marked `inert`, giving the browser an extra safety net.
12
- *
13
- * Reacts on `keyup` so that the browser's native focus movement has already completed
14
- * before we redirect it.
15
- */
16
- class SentinelFocusTrapStrategy extends FocusTrapStrategy {
17
- constructor({ getContainer, noAutofocus = false }) {
18
- super(getContainer);
19
- _SentinelFocusTrapStrategy_sentinelStart.set(this, void 0);
20
- _SentinelFocusTrapStrategy_sentinelEnd.set(this, void 0);
21
- this.noAutofocus = noAutofocus;
22
- }
23
- /** Call once in firstUpdated with the two bookend sentinel elements. */
24
- setSentinels(start, end) {
25
- __classPrivateFieldSet(this, _SentinelFocusTrapStrategy_sentinelStart, start, "f");
26
- __classPrivateFieldSet(this, _SentinelFocusTrapStrategy_sentinelEnd, end, "f");
27
- }
28
- /**
29
- * Move focus to the first real interactive element after the open transition
30
- * completes (skips sentinelStart at index 0).
31
- */
32
- focusFirst() {
33
- if (this.noAutofocus)
34
- return;
35
- requestAnimationFrame(() => {
36
- const container = this.getContainer();
37
- if (!container)
38
- return;
39
- const focusableElements = this.getFocusableElements(container);
40
- if (focusableElements.length > 0) {
41
- focusableElements.length > 1 ? focusableElements[1].focus() : focusableElements[0].focus();
42
- }
43
- });
44
- }
45
- activate() {
46
- this.active = true;
47
- if (!this.noAutofocus) {
48
- const scrollY = window.scrollY;
49
- setTimeout(() => {
50
- var _a;
51
- (_a = __classPrivateFieldGet(this, _SentinelFocusTrapStrategy_sentinelStart, "f")) === null || _a === void 0 ? void 0 : _a.focus();
52
- window.scrollTo(0, scrollY);
53
- }, 0);
54
- }
55
- }
56
- }
57
- _SentinelFocusTrapStrategy_sentinelStart = new WeakMap(), _SentinelFocusTrapStrategy_sentinelEnd = new WeakMap();
58
-
59
- export { SentinelFocusTrapStrategy };
60
- //# sourceMappingURL=sentinel_focus_trap_strategy.js.map
@@ -1,20 +0,0 @@
1
- import { FocusTrapStrategy } from './focus_trap_strategy';
2
- import { ITogglerFocusTrapStrategy } 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 ITogglerFocusTrapStrategy {
17
- #private;
18
- constructor({ getContainer, getToggler }: TTogglerFocusTrapStrategyProps);
19
- protected _handleKeyDown: (ev: KeyboardEvent) => void;
20
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,+DAA+D,+CAAmD;AAClH;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;"}