@shoper/phoenix_design_system 1.11.14-7 → 1.11.14-8

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/color_swatches/color_item/color_item.js +29 -21
  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 +4 -0
  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 +11 -121
  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 +2 -0
  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 +37 -114
  10. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
  11. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_content.js +9 -12
  12. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_content.js.map +1 -1
  13. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_toggler.js +24 -13
  14. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_toggler.js.map +1 -1
  15. package/build/cjs/packages/phoenix/src/components/form/file_picker/file_picker.js +1 -1
  16. package/build/cjs/packages/phoenix/src/components/form/input/input_control.js +1 -16
  17. package/build/cjs/packages/phoenix/src/components/form/input/input_control.js.map +1 -1
  18. package/build/cjs/packages/phoenix/src/components/form/select/select.js +5 -4
  19. package/build/cjs/packages/phoenix/src/components/form/select/select.js.map +1 -1
  20. package/build/cjs/packages/phoenix/src/components/messages/base_message.js +45 -7
  21. package/build/cjs/packages/phoenix/src/components/messages/base_message.js.map +1 -1
  22. package/build/cjs/packages/phoenix/src/components/messages/base_message_constants.js +2 -0
  23. package/build/cjs/packages/phoenix/src/components/messages/base_message_constants.js.map +1 -1
  24. package/build/cjs/packages/phoenix/src/controllers/keystrokes_controller/keystrokes_controller.js +2 -13
  25. package/build/cjs/packages/phoenix/src/controllers/keystrokes_controller/keystrokes_controller.js.map +1 -1
  26. package/build/cjs/packages/phoenix/src/index.js +5 -5
  27. package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item.d.ts +6 -3
  28. package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item.js +30 -22
  29. package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item.js.map +1 -1
  30. package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item_constants.js +4 -1
  31. package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item_constants.js.map +1 -1
  32. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.d.ts +1 -11
  33. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.js +14 -124
  34. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.js.map +1 -1
  35. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.js +2 -1
  36. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.js.map +1 -1
  37. package/build/esm/packages/phoenix/src/components/dropdown/dropdown.d.ts +4 -13
  38. package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js +38 -115
  39. package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
  40. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_content.d.ts +2 -1
  41. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_content.js +9 -12
  42. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_content.js.map +1 -1
  43. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.d.ts +2 -1
  44. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js +25 -14
  45. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js.map +1 -1
  46. package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker.js +1 -1
  47. package/build/esm/packages/phoenix/src/components/form/input/input_control.d.ts +0 -3
  48. package/build/esm/packages/phoenix/src/components/form/input/input_control.js +1 -16
  49. package/build/esm/packages/phoenix/src/components/form/input/input_control.js.map +1 -1
  50. package/build/esm/packages/phoenix/src/components/form/select/select.js +5 -4
  51. package/build/esm/packages/phoenix/src/components/form/select/select.js.map +1 -1
  52. package/build/esm/packages/phoenix/src/components/messages/base_message.d.ts +3 -1
  53. package/build/esm/packages/phoenix/src/components/messages/base_message.js +47 -9
  54. package/build/esm/packages/phoenix/src/components/messages/base_message.js.map +1 -1
  55. package/build/esm/packages/phoenix/src/components/messages/base_message_constants.js +4 -3
  56. package/build/esm/packages/phoenix/src/components/messages/base_message_constants.js.map +1 -1
  57. package/build/esm/packages/phoenix/src/controllers/keystrokes_controller/keystrokes_controller.d.ts +1 -2
  58. package/build/esm/packages/phoenix/src/controllers/keystrokes_controller/keystrokes_controller.js +2 -13
  59. package/build/esm/packages/phoenix/src/controllers/keystrokes_controller/keystrokes_controller.js.map +1 -1
  60. package/build/esm/packages/phoenix/src/controllers/keystrokes_controller/keystrokes_controller_types.d.ts +0 -1
  61. package/build/esm/packages/phoenix/src/index.js +1 -1
  62. 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
- require('@dreamcommerce/utilities');
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
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,17 +16,6 @@ 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
- };
30
19
  this._dispatchToggleDropdownEventWithKeyboard = (ev) => {
31
20
  ev.stopImmediatePropagation();
32
21
  this._dispatchToggleDropdownEvent(ev);
@@ -40,6 +29,18 @@ exports.HDropdownToggler = class HDropdownToggler extends phoenix_light_lit_elem
40
29
  ev.preventDefault();
41
30
  this.emitCustomEvent(dropdown_constants.DROPDOWN_EVENTS.toggle);
42
31
  };
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
+ };
43
44
  this.slot = this.hasAttribute('slot') ? this.slot : 'toggler';
44
45
  this.className = `${dropdown_constants.DROPDOWN_CSS_CLASSES.toggler} ${this.className}`;
45
46
  }
@@ -47,7 +48,13 @@ exports.HDropdownToggler = class HDropdownToggler extends phoenix_light_lit_elem
47
48
  var _a;
48
49
  super.connectedCallback();
49
50
  this._btnController = new btn_controller.BtnController(this, this._dispatchToggleDropdownEventWithKeyboard);
50
- this._setupTogglerAria();
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);
51
58
  const hasToggleOnHover = (_a = this._$dropdown) === null || _a === void 0 ? void 0 : _a.hasAttribute(dropdown_constants.DROPDOWN_TOGGLE_ON_HOVER_ATTRIBUTE_NAME);
52
59
  if (hasToggleOnHover) {
53
60
  this.addEventListener('click', this._dispatchToggleDropdownEventOnMobile);
@@ -55,6 +62,10 @@ exports.HDropdownToggler = class HDropdownToggler extends phoenix_light_lit_elem
55
62
  }
56
63
  this.addEventListener('click', this._dispatchToggleDropdownEvent);
57
64
  }
65
+ disconnectedCallback() {
66
+ super.disconnectedCallback();
67
+ document.removeEventListener('keydown', this._handleFocusToOpenedDropdown);
68
+ }
58
69
  };
59
70
  tslib_es6.__decorate([
60
71
  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;"}
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;"}
@@ -98,7 +98,7 @@ exports.HFilePicker = class HFilePicker extends phoenix_light_lit_element.Phoeni
98
98
  label-text="${this.labelText}"
99
99
  label-icon-name="${ifDefined_js.ifDefined(this.labelIconName)}"
100
100
  aria-required="${this.required ? 'true' : 'false'}"
101
- focus-priority
101
+ validation-container
102
102
  />`
103
103
  : lit.nothing}
104
104
  ${((_b = this._file) === null || _b === void 0 ? void 0 : _b.name)
@@ -118,12 +118,9 @@ exports.HInputControl = class HInputControl extends phoenix_light_lit_element.Ph
118
118
  .value="${ifDefined_js.ifDefined(this.value)}"
119
119
  placeholder="${ifDefined_js.ifDefined(this.placeholder)}"
120
120
  ?disabled="${this.disabled}"
121
+ ?required="${this.required}"
121
122
  ?readonly="${this.readonly}"
122
123
  ?hidden="${this.hidden}"
123
- ?autofocus="${this.autofocus}"
124
- aria-required="${this.required ? 'true' : 'false'}"
125
- aria-describedby="${this.ariaDescribedBy}"
126
- aria-invalid="${this.error ? 'true' : 'false'}"
127
124
  @mousedown="${this._handleMouseDownEvent}"
128
125
  @mouseup="${this._handleMouseUpEvent}"
129
126
  @blur="${this._handleBlurEvent}"
@@ -185,18 +182,6 @@ tslib_es6.__decorate([
185
182
  decorators.property({ type: String, attribute: 'valid-pattern' }),
186
183
  tslib_es6.__metadata("design:type", String)
187
184
  ], exports.HInputControl.prototype, "validPattern", void 0);
188
- tslib_es6.__decorate([
189
- decorators.property({ type: Boolean }),
190
- tslib_es6.__metadata("design:type", Boolean)
191
- ], exports.HInputControl.prototype, "autofocus", void 0);
192
- tslib_es6.__decorate([
193
- decorators.property({ type: String, attribute: 'aria-describedby' }),
194
- tslib_es6.__metadata("design:type", String)
195
- ], exports.HInputControl.prototype, "ariaDescribedBy", void 0);
196
- tslib_es6.__decorate([
197
- decorators.property({ type: Boolean }),
198
- tslib_es6.__metadata("design:type", Boolean)
199
- ], exports.HInputControl.prototype, "error", void 0);
200
185
  exports.HInputControl = tslib_es6.__decorate([
201
186
  phoenix_custom_element.phoenixCustomElement('h-input-control'),
202
187
  tslib_es6.__metadata("design:paramtypes", [])
@@ -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;"}
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;"}
@@ -247,7 +247,9 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
247
247
  select_utils.SelectControlUtils.appendHTMLOption($option, $list, position);
248
248
  }
249
249
  updateOptionAriaAttribute($option) {
250
- $option.setAttribute(this.multiple ? 'aria-checked' : 'aria-selected', String($option.selected));
250
+ !$option.selected
251
+ ? $option.removeAttribute(this.multiple ? 'aria-checked' : 'aria-selected')
252
+ : $option.setAttribute(this.multiple ? 'aria-checked' : 'aria-selected', 'true');
251
253
  }
252
254
  _removeHTMLOptions(optionsValues) {
253
255
  this._$options = select_utils.SelectControlUtils.removeHTMLOptions(Array.from(this._$options.values()), optionsValues);
@@ -312,12 +314,11 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
312
314
  name="${this.controlName}"
313
315
  offset=${this.offset}
314
316
  content-width="full"
315
- prevent-focus-trap
316
317
  >
317
318
  <h-dropdown-toggler
318
319
  ${ref_js.ref(this._$dropdownToggler)}
319
320
  name="${this.controlName}"
320
- focus-priority
321
+ validation-container
321
322
  aria-haspopup="listbox"
322
323
  role="combobox"
323
324
  aria-required="${this.required ? 'true' : 'false'}"
@@ -330,7 +331,7 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
330
331
  <h-dropdown-content
331
332
  class="${select_constants.SELECT_CSS_CLASSES.selectContent} ${this.error ? select_constants.SELECT_CSS_CLASSES.selectContentError : ''}"
332
333
  ${ref_js.ref(this._$dropdownContent)}
333
- name="${this.controlName}"
334
+ name=${this.controlName}
334
335
  @focusin="${this._manageSelectFocusAria}"
335
336
  >
336
337
  <h-select-close-btn class="${select_constants.SELECT_CSS_CLASSES.selectCloseMobileButton}" @close=${this._closeSelect}></h-select-close-btn>
@@ -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;AACA;AACA;AACA;AACA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,6 +6,7 @@ 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');
9
10
  var portal_constants = require('../portal/portal_constants.js');
10
11
  var click_outside_controller = require('../../controllers/click_outside_controller/click_outside_controller.js');
11
12
  var relative_position_controller = require('../../controllers/relative_position_controller/relative_position_controller.js');
@@ -18,7 +19,6 @@ class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
18
19
  this.portalTarget = base_message_constants.DEFAULT_MESSAGE_PORTAL_NAME;
19
20
  this.direction = utilities.DIRECTIONS.topCenter;
20
21
  this.offset = base_message_constants.DEFAULT_MESSAGE_OFFSET;
21
- this.tabindex = '0';
22
22
  this._setupEventListeners = () => {
23
23
  this.addEventListener('mouseenter', this.open);
24
24
  this.addEventListener('mouseleave', this.close);
@@ -59,11 +59,49 @@ class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
59
59
  });
60
60
  }, this._shouldDelayClosing ? base_message_constants.MESSAGE_CLOSE_DELAY_IN_MS : 0);
61
61
  };
62
+ this._handleFocusWithinMessage = (ev) => {
63
+ var _a;
64
+ if (((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.closest(`.${this._messageComponentName}`)) !== this)
65
+ this.close();
66
+ if (!document.activeElement || ev.shiftKey)
67
+ return;
68
+ const $focusableElements = utilities.UiDomUtils.getFocusableElements(this);
69
+ const activeElementIndex = $focusableElements.indexOf(document.activeElement);
70
+ const isLastFocusableChild = activeElementIndex === $focusableElements.length - 1;
71
+ if (!isLastFocusableChild)
72
+ return;
73
+ this.close();
74
+ };
75
+ this._handleReverseTab = () => {
76
+ const $focusableElements = utilities.UiDomUtils.getFocusableElements(document.body);
77
+ const activeElement = document.activeElement;
78
+ const indexOfCurrentlyFocusedElement = $focusableElements.indexOf(activeElement);
79
+ const $previousElement = $focusableElements[indexOfCurrentlyFocusedElement - 1];
80
+ const $previousElementMessageParent = $previousElement === null || $previousElement === void 0 ? void 0 : $previousElement.closest(`h-${this._messageComponentName}`);
81
+ if ($previousElementMessageParent === this)
82
+ return;
83
+ if ($previousElementMessageParent)
84
+ $previousElementMessageParent.open();
85
+ if (this._isBaseMessage(activeElement))
86
+ activeElement.close();
87
+ };
62
88
  this._clickOutsideController = new click_outside_controller.ClickOutsideController({
63
89
  host: this,
64
90
  container: this,
65
91
  action: this.close
66
92
  });
93
+ new keystrokes_controller.KeystrokesController({
94
+ host: this,
95
+ keys: ['tab'],
96
+ target: this,
97
+ callback: this._handleFocusWithinMessage
98
+ });
99
+ new keystrokes_controller.KeystrokesController({
100
+ host: this,
101
+ keys: [['shift', 'tab']],
102
+ target: document.body,
103
+ callback: this._handleReverseTab
104
+ });
67
105
  }
68
106
  connectedCallback(messageComponentName = '') {
69
107
  super.connectedCallback();
@@ -79,7 +117,6 @@ class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
79
117
  elementToPosition: this._$messageContent,
80
118
  offset: this.offset
81
119
  });
82
- this.setAttribute('tabindex', this.tabindex);
83
120
  this._setupEventListeners();
84
121
  }
85
122
  static _appendMessagePortal() {
@@ -90,6 +127,11 @@ class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
90
127
  $portalTarget.setAttribute(portal_constants.PORTAL_TARGET_NAME_PROP, base_message_constants.DEFAULT_MESSAGE_PORTAL_NAME);
91
128
  document.body.appendChild($portalTarget);
92
129
  }
130
+ _isBaseMessage($element) {
131
+ if (base_message_constants.MESSAGE_ELEMENTS.includes($element.localName))
132
+ return true;
133
+ return false;
134
+ }
93
135
  }
94
136
  tslib_es6.__decorate([
95
137
  decorators.property({ type: Boolean, reflect: true }),
@@ -106,11 +148,7 @@ tslib_es6.__decorate([
106
148
  tslib_es6.__decorate([
107
149
  decorators.property({ type: String }),
108
150
  tslib_es6.__metadata("design:type", Number)
109
- ], BaseMessage.prototype, "offset", void 0);
110
- tslib_es6.__decorate([
111
- decorators.property({ type: String }),
112
- tslib_es6.__metadata("design:type", String)
113
- ], BaseMessage.prototype, "tabindex", void 0);
151
+ ], BaseMessage.prototype, "offset", void 0);
114
152
 
115
153
  exports.BaseMessage = BaseMessage;
116
154
  //# 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;"}
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;"}
@@ -9,6 +9,7 @@ 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];
12
13
  const MESSAGE_CONTENT_ELEMENTS = [tooltip_constants.TOOLTIP_CONTENT_ELEMENT_NAME, hint_constants.HINT_CONTENT_ELEMENT_NAME];
13
14
  const MESSAGE_SHOW_DELAY_IN_MS = 100;
14
15
  const MESSAGE_TIME_TO_DELAY_CLOSING_IN_MS = 500;
@@ -19,6 +20,7 @@ exports.DEFAULT_MESSAGE_PORTAL_NAME = DEFAULT_MESSAGE_PORTAL_NAME;
19
20
  exports.MESSAGE_CLOSE_DELAY_IN_MS = MESSAGE_CLOSE_DELAY_IN_MS;
20
21
  exports.MESSAGE_CONTENT_ELEMENTS = MESSAGE_CONTENT_ELEMENTS;
21
22
  exports.MESSAGE_CONTENT_SLOT_NAME = MESSAGE_CONTENT_SLOT_NAME;
23
+ exports.MESSAGE_ELEMENTS = MESSAGE_ELEMENTS;
22
24
  exports.MESSAGE_REMOVED_CLASS_NAME = MESSAGE_REMOVED_CLASS_NAME;
23
25
  exports.MESSAGE_SHOW_DELAY_IN_MS = MESSAGE_SHOW_DELAY_IN_MS;
24
26
  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;"}
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;"}
@@ -7,21 +7,11 @@ require('lit');
7
7
 
8
8
  var _KeystrokesController_host, _KeystrokesController_target;
9
9
  class KeystrokesController {
10
- constructor({ host, keys, callback, target, containerSelectors }) {
10
+ constructor({ host, keys, callback, target }) {
11
11
  _KeystrokesController_host.set(this, void 0);
12
12
  _KeystrokesController_target.set(this, void 0);
13
13
  this._buffer = [];
14
- this._clearBuffer = (ev) => {
15
- if (!this._containerSelectors) {
16
- this._buffer = [];
17
- return;
18
- }
19
- const $newFocusedElement = ev.relatedTarget;
20
- if ($newFocusedElement) {
21
- const isNewFocusedElementAChild = !!this._containerSelectors.find((containerSelector) => !!$newFocusedElement.closest(containerSelector));
22
- if (isNewFocusedElementAChild)
23
- return;
24
- }
14
+ this._clearBuffer = () => {
25
15
  this._buffer = [];
26
16
  };
27
17
  this._saveKey = (ev) => {
@@ -89,7 +79,6 @@ class KeystrokesController {
89
79
  tslib_es6.__classPrivateFieldSet(this, _KeystrokesController_target, target, "f");
90
80
  this._keys = keys;
91
81
  this._callback = callback;
92
- this._containerSelectors = containerSelectors;
93
82
  tslib_es6.__classPrivateFieldGet(this, _KeystrokesController_host, "f").addController(this);
94
83
  }
95
84
  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;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;"}
@@ -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_swatches = require('./components/color_swatches/color_swatches.js');
80
79
  var color_item = require('./components/color_swatches/color_item/color_item.js');
80
+ var color_swatches = require('./components/color_swatches/color_swatches.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, 'HColorSwatches', {
467
+ Object.defineProperty(exports, 'HColorItem', {
468
468
  enumerable: true,
469
469
  get: function () {
470
- return color_swatches.HColorSwatches;
470
+ return color_item.HColorItem;
471
471
  }
472
472
  });
473
- Object.defineProperty(exports, 'HColorItem', {
473
+ Object.defineProperty(exports, 'HColorSwatches', {
474
474
  enumerable: true,
475
475
  get: function () {
476
- return color_item.HColorItem;
476
+ return color_swatches.HColorSwatches;
477
477
  }
478
478
  });
479
479
  Object.defineProperty(exports, 'HColorSwatchesControl', {
@@ -8,9 +8,12 @@ export declare class HColorItem extends PhoenixLightLitElement {
8
8
  selected: boolean;
9
9
  size?: TColorItemSize;
10
10
  unclickable: boolean;
11
- private _$colorSwatches;
11
+ private _btnController;
12
+ constructor();
12
13
  connectedCallback(): void;
13
- private _setupAriaAttributes;
14
- private _setupClasses;
14
+ attributeChangedCallback(name: string, value: string | null, newValue: string | null): void;
15
+ private _syncAriaPressed;
16
+ private setupEvents;
15
17
  private setBgColor;
18
+ private _dispatchClickedEvent;
16
19
  }
@@ -3,40 +3,47 @@ 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 { COLOR_ITEM_CSS_CLASSES } from './color_item_constants.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';
7
8
 
8
9
  let HColorItem = class HColorItem extends PhoenixLightLitElement {
9
10
  constructor() {
10
- super(...arguments);
11
+ super();
11
12
  this.disabled = false;
12
13
  this.selected = false;
13
14
  this.unclickable = false;
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]);
15
+ this._dispatchClickedEvent = () => {
16
+ this.emitEvent(COLOR_ITEM_EVENT_NAMES.selected);
25
17
  };
18
+ this._btnController = new BtnController(this, this._dispatchClickedEvent);
26
19
  }
27
20
  connectedCallback() {
28
21
  super.connectedCallback();
29
- this._setupAriaAttributes();
30
- this._setupClasses();
22
+ this.setupEvents();
31
23
  this.style.backgroundColor = this.setBgColor(this.disabled);
32
- if (this.unclickable) {
33
- this.removeAttribute('tabindex');
34
- }
35
- else {
36
- this.setAttribute('tabindex', '0');
37
- }
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);
38
28
  if (!this.value)
39
29
  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);
40
47
  }
41
48
  setBgColor(itemIsDisabled) {
42
49
  return itemIsDisabled ? ColorUtils.hexToRgba(this.color, 0.5) : this.color;
@@ -71,7 +78,8 @@ __decorate([
71
78
  __metadata("design:type", Boolean)
72
79
  ], HColorItem.prototype, "unclickable", void 0);
73
80
  HColorItem = __decorate([
74
- phoenixCustomElement('h-color-item')
81
+ phoenixCustomElement('h-color-item'),
82
+ __metadata("design:paramtypes", [])
75
83
  ], HColorItem);
76
84
 
77
85
  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;"}
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,4 +1,7 @@
1
1
  const colorItemBaseCssClass = 'color-item';
2
+ const COLOR_ITEM_EVENT_NAMES = {
3
+ selected: 'colorItemSelected'
4
+ };
2
5
  const COLOR_ITEM_SIZES = {
3
6
  s: 's',
4
7
  xs: 'xs'
@@ -10,5 +13,5 @@ const COLOR_ITEM_CSS_CLASSES = {
10
13
  };
11
14
  const COLOR_ITEM_SELECTED_ATTRIBUTE = 'selected';
12
15
 
13
- export { COLOR_ITEM_CSS_CLASSES, COLOR_ITEM_SELECTED_ATTRIBUTE, COLOR_ITEM_SIZES };
16
+ export { COLOR_ITEM_CSS_CLASSES, COLOR_ITEM_EVENT_NAMES, COLOR_ITEM_SELECTED_ATTRIBUTE, COLOR_ITEM_SIZES };
14
17
  //# 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;"}
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;"}
@@ -15,23 +15,13 @@ 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;
21
18
  private _handleColorClicked;
22
- private _handleTabNavigation;
23
- private _handleRadioNavigation;
24
- private _focusOnSelectedColor;
25
- private _handleChangeToNextColorItem;
26
- private _handleChangeToPreviousColorItem;
27
- private _handleColorChange;
28
19
  private _toggleColorItem;
29
20
  private _handleColorClickedForMultipleMode;
30
- private _handleColorChangeForSingleMode;
21
+ private _handleColorClickedForSingleMode;
31
22
  private _toggleSelectedAttribute;
32
23
  private _isColorAlreadyExistInArray;
33
24
  private _removeExistingColorFromArray;
34
25
  private _dispatchColorChangeEvent;
35
- disconnectedCallback(): void;
36
26
  protected render(): TemplateResult;
37
27
  }