@shoper/phoenix_design_system 1.13.0 → 1.14.1-0

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 (57) hide show
  1. package/build/cjs/packages/phoenix/src/components/color_swatches/color_item/color_item.js +21 -29
  2. package/build/cjs/packages/phoenix/src/components/color_swatches/color_item/color_item.js.map +1 -1
  3. package/build/cjs/packages/phoenix/src/components/color_swatches/color_item/color_item_constants.js +0 -4
  4. package/build/cjs/packages/phoenix/src/components/color_swatches/color_item/color_item_constants.js.map +1 -1
  5. package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches.js +121 -11
  6. package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches.js.map +1 -1
  7. package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches_constants.js +0 -2
  8. package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches_constants.js.map +1 -1
  9. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown.js +114 -37
  10. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
  11. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_close.js +4 -4
  12. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_content.js +12 -9
  13. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_content.js.map +1 -1
  14. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_toggler.js +13 -24
  15. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_toggler.js.map +1 -1
  16. package/build/cjs/packages/phoenix/src/components/form/select/select.js +3 -4
  17. package/build/cjs/packages/phoenix/src/components/form/select/select.js.map +1 -1
  18. package/build/cjs/packages/phoenix/src/components/messages/base_message.js +16 -47
  19. package/build/cjs/packages/phoenix/src/components/messages/base_message.js.map +1 -1
  20. package/build/cjs/packages/phoenix/src/components/messages/base_message_constants.js +0 -2
  21. package/build/cjs/packages/phoenix/src/components/messages/base_message_constants.js.map +1 -1
  22. package/build/cjs/packages/phoenix/src/controllers/keystrokes_controller/keystrokes_controller.js +13 -2
  23. package/build/cjs/packages/phoenix/src/controllers/keystrokes_controller/keystrokes_controller.js.map +1 -1
  24. package/build/cjs/packages/phoenix/src/index.js +5 -5
  25. package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item.d.ts +3 -6
  26. package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item.js +22 -30
  27. package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item.js.map +1 -1
  28. package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item_constants.js +1 -4
  29. package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item_constants.js.map +1 -1
  30. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.d.ts +11 -1
  31. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.js +124 -14
  32. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.js.map +1 -1
  33. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.js +1 -2
  34. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.js.map +1 -1
  35. package/build/esm/packages/phoenix/src/components/dropdown/dropdown.d.ts +13 -4
  36. package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js +115 -38
  37. package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
  38. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_close.js +4 -4
  39. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_content.d.ts +1 -2
  40. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_content.js +12 -9
  41. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_content.js.map +1 -1
  42. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.d.ts +1 -2
  43. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js +14 -25
  44. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js.map +1 -1
  45. package/build/esm/packages/phoenix/src/components/form/select/select.js +3 -4
  46. package/build/esm/packages/phoenix/src/components/form/select/select.js.map +1 -1
  47. package/build/esm/packages/phoenix/src/components/messages/base_message.d.ts +2 -3
  48. package/build/esm/packages/phoenix/src/components/messages/base_message.js +18 -49
  49. package/build/esm/packages/phoenix/src/components/messages/base_message.js.map +1 -1
  50. package/build/esm/packages/phoenix/src/components/messages/base_message_constants.js +3 -4
  51. package/build/esm/packages/phoenix/src/components/messages/base_message_constants.js.map +1 -1
  52. package/build/esm/packages/phoenix/src/controllers/keystrokes_controller/keystrokes_controller.d.ts +2 -1
  53. package/build/esm/packages/phoenix/src/controllers/keystrokes_controller/keystrokes_controller.js +13 -2
  54. package/build/esm/packages/phoenix/src/controllers/keystrokes_controller/keystrokes_controller.js.map +1 -1
  55. package/build/esm/packages/phoenix/src/controllers/keystrokes_controller/keystrokes_controller_types.d.ts +1 -0
  56. package/build/esm/packages/phoenix/src/index.js +1 -1
  57. package/package.json +1 -1
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tslib_es6 = require('../../../../../external/tslib/tslib.es6.js');
6
6
  var decorators = require('lit/decorators');
7
- var utilities = require('@dreamcommerce/utilities');
7
+ require('@dreamcommerce/utilities');
8
8
  var phoenix_light_lit_element = require('../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
9
9
  var phoenix_custom_element = require('../../core/decorators/phoenix_custom_element.js');
10
10
  var btn_controller = require('../../controllers/btn_controller/btn_controller.js');
@@ -16,6 +16,17 @@ exports.HDropdownToggler = class HDropdownToggler extends phoenix_light_lit_elem
16
16
  constructor() {
17
17
  super();
18
18
  this.name = '';
19
+ this._setupTogglerAria = () => {
20
+ this._$dropdown = this.closest(dropdown_constants.DROPDOWN_CONTAINER_NAME);
21
+ if (this._$dropdown.isOpened)
22
+ this._toggleElementAriaController = new toggle_element_aria_controller.ToggleElementAriaController({
23
+ host: this,
24
+ initialAriaExpandedValue: this._$dropdown.isOpened()
25
+ });
26
+ this.setAttribute('aria-haspopup', 'true');
27
+ if (this._$dropdown.id)
28
+ this.setAttribute('aria-controls', this._$dropdown.id);
29
+ };
19
30
  this._dispatchToggleDropdownEventWithKeyboard = (ev) => {
20
31
  ev.stopImmediatePropagation();
21
32
  this._dispatchToggleDropdownEvent(ev);
@@ -29,18 +40,6 @@ exports.HDropdownToggler = class HDropdownToggler extends phoenix_light_lit_elem
29
40
  ev.preventDefault();
30
41
  this.emitCustomEvent(dropdown_constants.DROPDOWN_EVENTS.toggle);
31
42
  };
32
- this._handleFocusToOpenedDropdown = async (ev) => {
33
- if (ev.target !== this)
34
- return;
35
- const isOpened = this._$dropdown.isOpened();
36
- if (!isOpened)
37
- return;
38
- const $dropdownContent = document.querySelector(`${dropdown_constants.DROPDOWN_CONTENT_NAME}[name="${this.name}"]`);
39
- if (!$dropdownContent)
40
- return;
41
- ev.preventDefault();
42
- utilities.UiDomUtils.setFocusToFirstFocusableElementInContainer($dropdownContent);
43
- };
44
43
  this.slot = this.hasAttribute('slot') ? this.slot : 'toggler';
45
44
  this.className = `${dropdown_constants.DROPDOWN_CSS_CLASSES.toggler} ${this.className}`;
46
45
  }
@@ -48,13 +47,7 @@ exports.HDropdownToggler = class HDropdownToggler extends phoenix_light_lit_elem
48
47
  var _a;
49
48
  super.connectedCallback();
50
49
  this._btnController = new btn_controller.BtnController(this, this._dispatchToggleDropdownEventWithKeyboard);
51
- this._$dropdown = this.closest(dropdown_constants.DROPDOWN_CONTAINER_NAME);
52
- if (this._$dropdown.isOpened)
53
- this._toggleElementAriaController = new toggle_element_aria_controller.ToggleElementAriaController({
54
- host: this,
55
- initialAriaExpandedValue: this._$dropdown.isOpened()
56
- });
57
- document.addEventListener('keydown', this._handleFocusToOpenedDropdown);
50
+ this._setupTogglerAria();
58
51
  const hasToggleOnHover = (_a = this._$dropdown) === null || _a === void 0 ? void 0 : _a.hasAttribute(dropdown_constants.DROPDOWN_TOGGLE_ON_HOVER_ATTRIBUTE_NAME);
59
52
  if (hasToggleOnHover) {
60
53
  this.addEventListener('click', this._dispatchToggleDropdownEventOnMobile);
@@ -62,10 +55,6 @@ exports.HDropdownToggler = class HDropdownToggler extends phoenix_light_lit_elem
62
55
  }
63
56
  this.addEventListener('click', this._dispatchToggleDropdownEvent);
64
57
  }
65
- disconnectedCallback() {
66
- super.disconnectedCallback();
67
- document.removeEventListener('keydown', this._handleFocusToOpenedDropdown);
68
- }
69
58
  };
70
59
  tslib_es6.__decorate([
71
60
  decorators.property({ type: String, reflect: true }),
@@ -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;"}
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;"}
@@ -233,9 +233,7 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
233
233
  select_utils.SelectControlUtils.appendHTMLOption($option, $list, position);
234
234
  }
235
235
  updateOptionAriaAttribute($option) {
236
- !$option.selected
237
- ? $option.removeAttribute(this.multiple ? 'aria-checked' : 'aria-selected')
238
- : $option.setAttribute(this.multiple ? 'aria-checked' : 'aria-selected', 'true');
236
+ $option.setAttribute(this.multiple ? 'aria-checked' : 'aria-selected', String($option.selected));
239
237
  }
240
238
  _removeHTMLOptions(optionsValues) {
241
239
  this._$options = select_utils.SelectControlUtils.removeHTMLOptions(Array.from(this._$options.values()), optionsValues);
@@ -300,13 +298,14 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
300
298
  name="${this.controlName}"
301
299
  offset=${this.offset}
302
300
  content-width="full"
301
+ prevent-focus-trap
303
302
  >
304
303
  <h-dropdown-toggler name=${this.controlName}> ${this.getSlot(select_constants.SELECT_SLOT_NAMES.toggler)} </h-dropdown-toggler>
305
304
 
306
305
  <h-dropdown-content
307
306
  class="${select_constants.SELECT_CSS_CLASSES.selectContent} ${this.error ? select_constants.SELECT_CSS_CLASSES.selectContentError : ''}"
308
307
  ${ref_js.ref(this._$dropdownContent)}
309
- name=${this.controlName}
308
+ name="${this.controlName}"
310
309
  >
311
310
  <h-select-close-btn class="${select_constants.SELECT_CSS_CLASSES.selectCloseMobileButton}" @close=${this._closeSelect}></h-select-close-btn>
312
311
 
@@ -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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,+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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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 decorators = require('lit/decorators');
7
7
  var utilities = require('@dreamcommerce/utilities');
8
8
  var phoenix_light_lit_element = require('../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
9
- var keystrokes_controller = require('../../controllers/keystrokes_controller/keystrokes_controller.js');
10
9
  var portal_constants = require('../portal/portal_constants.js');
11
10
  var click_outside_controller = require('../../controllers/click_outside_controller/click_outside_controller.js');
12
11
  var relative_position_controller = require('../../controllers/relative_position_controller/relative_position_controller.js');
@@ -19,10 +18,15 @@ class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
19
18
  this.portalTarget = base_message_constants.DEFAULT_MESSAGE_PORTAL_NAME;
20
19
  this.direction = utilities.DIRECTIONS.topCenter;
21
20
  this.offset = base_message_constants.DEFAULT_MESSAGE_OFFSET;
21
+ this.mouseonly = false;
22
+ this.tabindex = '0';
22
23
  this._setupEventListeners = () => {
23
24
  this.addEventListener('mouseenter', this.open);
24
25
  this.addEventListener('mouseleave', this.close);
25
- this.addEventListener('focus', this.open);
26
+ if (!this.mouseonly) {
27
+ this.addEventListener('focusin', this.open);
28
+ this.addEventListener('focusout', this.close);
29
+ }
26
30
  };
27
31
  this._positionMessage = () => {
28
32
  requestAnimationFrame(() => {
@@ -58,49 +62,11 @@ class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
58
62
  });
59
63
  }, this._shouldDelayClosing ? base_message_constants.MESSAGE_CLOSE_DELAY_IN_MS : 0);
60
64
  };
61
- this._handleFocusWithinMessage = (ev) => {
62
- var _a;
63
- if (((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.closest(`.${this._messageComponentName}`)) !== this)
64
- this.close();
65
- if (!document.activeElement || ev.shiftKey)
66
- return;
67
- const $focusableElements = utilities.UiDomUtils.getFocusableElements(this);
68
- const activeElementIndex = $focusableElements.indexOf(document.activeElement);
69
- const isLastFocusableChild = activeElementIndex === $focusableElements.length - 1;
70
- if (!isLastFocusableChild)
71
- return;
72
- this.close();
73
- };
74
- this._handleReverseTab = () => {
75
- const $focusableElements = utilities.UiDomUtils.getFocusableElements(document.body);
76
- const activeElement = document.activeElement;
77
- const indexOfCurrentlyFocusedElement = $focusableElements.indexOf(activeElement);
78
- const $previousElement = $focusableElements[indexOfCurrentlyFocusedElement - 1];
79
- const $previousElementMessageParent = $previousElement === null || $previousElement === void 0 ? void 0 : $previousElement.closest(`h-${this._messageComponentName}`);
80
- if ($previousElementMessageParent === this)
81
- return;
82
- if ($previousElementMessageParent)
83
- $previousElementMessageParent.open();
84
- if (this._isBaseMessage(activeElement))
85
- activeElement.close();
86
- };
87
65
  this._clickOutsideController = new click_outside_controller.ClickOutsideController({
88
66
  host: this,
89
67
  container: this,
90
68
  action: this.close
91
69
  });
92
- new keystrokes_controller.KeystrokesController({
93
- host: this,
94
- keys: ['tab'],
95
- target: this,
96
- callback: this._handleFocusWithinMessage
97
- });
98
- new keystrokes_controller.KeystrokesController({
99
- host: this,
100
- keys: [['shift', 'tab']],
101
- target: document.body,
102
- callback: this._handleReverseTab
103
- });
104
70
  }
105
71
  connectedCallback(messageComponentName = '') {
106
72
  super.connectedCallback();
@@ -116,7 +82,7 @@ class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
116
82
  elementToPosition: this._$messageContent,
117
83
  offset: this.offset
118
84
  });
119
- this.setAttribute('tabindex', '0');
85
+ this.setAttribute('tabindex', this.tabindex);
120
86
  this._setupEventListeners();
121
87
  }
122
88
  static _appendMessagePortal() {
@@ -127,11 +93,6 @@ class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
127
93
  $portalTarget.setAttribute(portal_constants.PORTAL_TARGET_NAME_PROP, base_message_constants.DEFAULT_MESSAGE_PORTAL_NAME);
128
94
  document.body.appendChild($portalTarget);
129
95
  }
130
- _isBaseMessage($element) {
131
- if (base_message_constants.MESSAGE_ELEMENTS.includes($element.localName))
132
- return true;
133
- return false;
134
- }
135
96
  }
136
97
  tslib_es6.__decorate([
137
98
  decorators.property({ type: Boolean, reflect: true }),
@@ -148,7 +109,15 @@ tslib_es6.__decorate([
148
109
  tslib_es6.__decorate([
149
110
  decorators.property({ type: String }),
150
111
  tslib_es6.__metadata("design:type", Number)
151
- ], BaseMessage.prototype, "offset", void 0);
112
+ ], BaseMessage.prototype, "offset", void 0);
113
+ tslib_es6.__decorate([
114
+ decorators.property({ type: Boolean }),
115
+ tslib_es6.__metadata("design:type", Boolean)
116
+ ], BaseMessage.prototype, "mouseonly", void 0);
117
+ tslib_es6.__decorate([
118
+ decorators.property({ type: String }),
119
+ tslib_es6.__metadata("design:type", String)
120
+ ], BaseMessage.prototype, "tabindex", void 0);
152
121
 
153
122
  exports.BaseMessage = BaseMessage;
154
123
  //# sourceMappingURL=base_message.js.map
@@ -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;"}
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;"}
@@ -9,7 +9,6 @@ const DEFAULT_MESSAGE_PORTAL_NAME = 'message-portal';
9
9
  const MESSAGE_CONTENT_SLOT_NAME = 'message-content';
10
10
  const MESSAGE_REMOVED_CLASS_NAME = `removed`;
11
11
  const DEFAULT_MESSAGE_OFFSET = 10;
12
- const MESSAGE_ELEMENTS = [tooltip_constants.TOOLTIP_ELEMENT_NAME, hint_constants.HINT_ELEMENT_NAME];
13
12
  const MESSAGE_CONTENT_ELEMENTS = [tooltip_constants.TOOLTIP_CONTENT_ELEMENT_NAME, hint_constants.HINT_CONTENT_ELEMENT_NAME];
14
13
  const MESSAGE_SHOW_DELAY_IN_MS = 100;
15
14
  const MESSAGE_TIME_TO_DELAY_CLOSING_IN_MS = 500;
@@ -20,7 +19,6 @@ exports.DEFAULT_MESSAGE_PORTAL_NAME = DEFAULT_MESSAGE_PORTAL_NAME;
20
19
  exports.MESSAGE_CLOSE_DELAY_IN_MS = MESSAGE_CLOSE_DELAY_IN_MS;
21
20
  exports.MESSAGE_CONTENT_ELEMENTS = MESSAGE_CONTENT_ELEMENTS;
22
21
  exports.MESSAGE_CONTENT_SLOT_NAME = MESSAGE_CONTENT_SLOT_NAME;
23
- exports.MESSAGE_ELEMENTS = MESSAGE_ELEMENTS;
24
22
  exports.MESSAGE_REMOVED_CLASS_NAME = MESSAGE_REMOVED_CLASS_NAME;
25
23
  exports.MESSAGE_SHOW_DELAY_IN_MS = MESSAGE_SHOW_DELAY_IN_MS;
26
24
  exports.MESSAGE_TIME_TO_DELAY_CLOSING_IN_MS = MESSAGE_TIME_TO_DELAY_CLOSING_IN_MS;
@@ -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;"}
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;"}
@@ -7,11 +7,21 @@ require('lit');
7
7
 
8
8
  var _KeystrokesController_host, _KeystrokesController_target;
9
9
  class KeystrokesController {
10
- constructor({ host, keys, callback, target }) {
10
+ constructor({ host, keys, callback, target, containerSelectors }) {
11
11
  _KeystrokesController_host.set(this, void 0);
12
12
  _KeystrokesController_target.set(this, void 0);
13
13
  this._buffer = [];
14
- this._clearBuffer = () => {
14
+ this._clearBuffer = (ev) => {
15
+ if (!this._containerSelectors) {
16
+ this._buffer = [];
17
+ return;
18
+ }
19
+ const $newFocusedElement = ev.relatedTarget;
20
+ if ($newFocusedElement instanceof HTMLElement) {
21
+ const isNewFocusedElementAChild = !!this._containerSelectors.find((containerSelector) => !!$newFocusedElement.closest(containerSelector));
22
+ if (isNewFocusedElementAChild)
23
+ return;
24
+ }
15
25
  this._buffer = [];
16
26
  };
17
27
  this._saveKey = (ev) => {
@@ -79,6 +89,7 @@ class KeystrokesController {
79
89
  tslib_es6.__classPrivateFieldSet(this, _KeystrokesController_target, target, "f");
80
90
  this._keys = keys;
81
91
  this._callback = callback;
92
+ this._containerSelectors = containerSelectors;
82
93
  tslib_es6.__classPrivateFieldGet(this, _KeystrokesController_host, "f").addController(this);
83
94
  }
84
95
  hostConnected() {
@@ -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;"}
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;"}
@@ -76,8 +76,8 @@ var toggle_button = require('./components/groups/toggle_button_group/toggle_butt
76
76
  var click_outside_controller_messages = require('./controllers/click_outside_controller/click_outside_controller_messages.js');
77
77
  var backdrop = require('./components/backdrop/backdrop.js');
78
78
  var color_swatches_control_constants = require('./components/form/color_swatches_control/color_swatches_control_constants.js');
79
- var color_item = require('./components/color_swatches/color_item/color_item.js');
80
79
  var color_swatches = require('./components/color_swatches/color_swatches.js');
80
+ var color_item = require('./components/color_swatches/color_item/color_item.js');
81
81
  var color_swatches_control = require('./components/form/color_swatches_control/color_swatches_control.js');
82
82
  var show_more = require('./components/color_swatches/show-more/show_more.js');
83
83
  var visibility_controller = require('./controllers/visibility_controller/visibility_controller.js');
@@ -464,16 +464,16 @@ Object.defineProperty(exports, 'HBackdrop', {
464
464
  }
465
465
  });
466
466
  exports.COLOR_SWATCHES_CONTROL_EVENT_NAMES = color_swatches_control_constants.COLOR_SWATCHES_CONTROL_EVENT_NAMES;
467
- Object.defineProperty(exports, 'HColorItem', {
467
+ Object.defineProperty(exports, 'HColorSwatches', {
468
468
  enumerable: true,
469
469
  get: function () {
470
- return color_item.HColorItem;
470
+ return color_swatches.HColorSwatches;
471
471
  }
472
472
  });
473
- Object.defineProperty(exports, 'HColorSwatches', {
473
+ Object.defineProperty(exports, 'HColorItem', {
474
474
  enumerable: true,
475
475
  get: function () {
476
- return color_swatches.HColorSwatches;
476
+ return color_item.HColorItem;
477
477
  }
478
478
  });
479
479
  Object.defineProperty(exports, 'HColorSwatchesControl', {
@@ -8,12 +8,9 @@ export declare class HColorItem extends PhoenixLightLitElement {
8
8
  selected: boolean;
9
9
  size?: TColorItemSize;
10
10
  unclickable: boolean;
11
- private _btnController;
12
- constructor();
11
+ private _$colorSwatches;
13
12
  connectedCallback(): void;
14
- attributeChangedCallback(name: string, value: string | null, newValue: string | null): void;
15
- private _syncAriaPressed;
16
- private setupEvents;
13
+ private _setupAriaAttributes;
14
+ private _setupClasses;
17
15
  private setBgColor;
18
- private _dispatchClickedEvent;
19
16
  }
@@ -3,47 +3,40 @@ import { property } from 'lit/decorators';
3
3
  import { ColorUtils } from '@dreamcommerce/utilities';
4
4
  import { PhoenixLightLitElement } from '../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
5
5
  import { phoenixCustomElement } from '../../../core/decorators/phoenix_custom_element.js';
6
- import { BtnController } from '../../../controllers/btn_controller/btn_controller.js';
7
- import { COLOR_ITEM_EVENT_NAMES, COLOR_ITEM_CSS_CLASSES, COLOR_ITEM_SELECTED_ATTRIBUTE } from './color_item_constants.js';
6
+ import { COLOR_ITEM_CSS_CLASSES } from './color_item_constants.js';
8
7
 
9
8
  let HColorItem = class HColorItem extends PhoenixLightLitElement {
10
9
  constructor() {
11
- super();
10
+ super(...arguments);
12
11
  this.disabled = false;
13
12
  this.selected = false;
14
13
  this.unclickable = false;
15
- this._dispatchClickedEvent = () => {
16
- this.emitEvent(COLOR_ITEM_EVENT_NAMES.selected);
14
+ this._$colorSwatches = null;
15
+ this._setupAriaAttributes = () => {
16
+ var _a;
17
+ this._$colorSwatches = this.closest('h-color-swatches');
18
+ this.setAttribute('role', ((_a = this._$colorSwatches) === null || _a === void 0 ? void 0 : _a.multiple) ? 'checkbox' : 'radio');
19
+ this.setAttribute('aria-label', this.label ? this.label : this.color);
20
+ };
21
+ this._setupClasses = () => {
22
+ this.classList.add(COLOR_ITEM_CSS_CLASSES.colorItem);
23
+ if (this.size)
24
+ this.classList.add(COLOR_ITEM_CSS_CLASSES[this.size]);
17
25
  };
18
- this._btnController = new BtnController(this, this._dispatchClickedEvent);
19
26
  }
20
27
  connectedCallback() {
21
28
  super.connectedCallback();
22
- this.setupEvents();
29
+ this._setupAriaAttributes();
30
+ this._setupClasses();
23
31
  this.style.backgroundColor = this.setBgColor(this.disabled);
24
- this._syncAriaPressed();
25
- this.setAttribute('aria-label', this.label ? this.label : this.color);
26
- this.unclickable && this.removeAttribute('tabindex');
27
- this.classList.add(COLOR_ITEM_CSS_CLASSES.colorItem);
32
+ if (this.unclickable) {
33
+ this.removeAttribute('tabindex');
34
+ }
35
+ else {
36
+ this.setAttribute('tabindex', '0');
37
+ }
28
38
  if (!this.value)
29
39
  this.value = this.color;
30
- if (this.size)
31
- this.classList.add(COLOR_ITEM_CSS_CLASSES[this.size]);
32
- }
33
- attributeChangedCallback(name, value, newValue) {
34
- super.attributeChangedCallback(name, value, newValue);
35
- switch (name) {
36
- case COLOR_ITEM_SELECTED_ATTRIBUTE: {
37
- this._syncAriaPressed();
38
- break;
39
- }
40
- }
41
- }
42
- _syncAriaPressed() {
43
- this.selected ? this.setAttribute('aria-pressed', '') : this.removeAttribute('aria-pressed');
44
- }
45
- setupEvents() {
46
- !this.unclickable && this.addEventListener('click', this._dispatchClickedEvent);
47
40
  }
48
41
  setBgColor(itemIsDisabled) {
49
42
  return itemIsDisabled ? ColorUtils.hexToRgba(this.color, 0.5) : this.color;
@@ -78,8 +71,7 @@ __decorate([
78
71
  __metadata("design:type", Boolean)
79
72
  ], HColorItem.prototype, "unclickable", void 0);
80
73
  HColorItem = __decorate([
81
- phoenixCustomElement('h-color-item'),
82
- __metadata("design:paramtypes", [])
74
+ phoenixCustomElement('h-color-item')
83
75
  ], HColorItem);
84
76
 
85
77
  export { HColorItem };
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,7 +1,4 @@
1
1
  const colorItemBaseCssClass = 'color-item';
2
- const COLOR_ITEM_EVENT_NAMES = {
3
- selected: 'colorItemSelected'
4
- };
5
2
  const COLOR_ITEM_SIZES = {
6
3
  s: 's',
7
4
  xs: 'xs'
@@ -13,5 +10,5 @@ const COLOR_ITEM_CSS_CLASSES = {
13
10
  };
14
11
  const COLOR_ITEM_SELECTED_ATTRIBUTE = 'selected';
15
12
 
16
- export { COLOR_ITEM_CSS_CLASSES, COLOR_ITEM_EVENT_NAMES, COLOR_ITEM_SELECTED_ATTRIBUTE, COLOR_ITEM_SIZES };
13
+ export { COLOR_ITEM_CSS_CLASSES, COLOR_ITEM_SELECTED_ATTRIBUTE, COLOR_ITEM_SIZES };
17
14
  //# sourceMappingURL=color_item_constants.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;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -15,13 +15,23 @@ export declare class HColorSwatches extends PhoenixLightLitElement {
15
15
  private _hideItems;
16
16
  private _showAllItemsEvent;
17
17
  private _setupEvents;
18
+ private _setupCheckboxGroupEvents;
19
+ private _setupRadioGroupEvents;
20
+ private _setupColorClickEvents;
18
21
  private _handleColorClicked;
22
+ private _handleTabNavigation;
23
+ private _handleRadioNavigation;
24
+ private _focusOnSelectedColor;
25
+ private _handleChangeToNextColorItem;
26
+ private _handleChangeToPreviousColorItem;
27
+ private _handleColorChange;
19
28
  private _toggleColorItem;
20
29
  private _handleColorClickedForMultipleMode;
21
- private _handleColorClickedForSingleMode;
30
+ private _handleColorChangeForSingleMode;
22
31
  private _toggleSelectedAttribute;
23
32
  private _isColorAlreadyExistInArray;
24
33
  private _removeExistingColorFromArray;
25
34
  private _dispatchColorChangeEvent;
35
+ disconnectedCallback(): void;
26
36
  protected render(): TemplateResult;
27
37
  }