@shoper/phoenix_design_system 1.11.14-5 → 1.11.14-7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/packages/phoenix/src/components/color_swatches/color_item/color_item.js +21 -29
- package/build/cjs/packages/phoenix/src/components/color_swatches/color_item/color_item.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/color_swatches/color_item/color_item_constants.js +0 -4
- package/build/cjs/packages/phoenix/src/components/color_swatches/color_item/color_item_constants.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches.js +121 -11
- package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches_constants.js +0 -2
- package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches_constants.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown.js +114 -37
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_content.js +12 -9
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_content.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_toggler.js +13 -24
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_toggler.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/input/input_control.js +16 -1
- package/build/cjs/packages/phoenix/src/components/form/input/input_control.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/select/select.js +4 -5
- package/build/cjs/packages/phoenix/src/components/form/select/select.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/messages/base_message.js +7 -45
- package/build/cjs/packages/phoenix/src/components/messages/base_message.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/messages/base_message_constants.js +0 -2
- package/build/cjs/packages/phoenix/src/components/messages/base_message_constants.js.map +1 -1
- package/build/cjs/packages/phoenix/src/controllers/keystrokes_controller/keystrokes_controller.js +13 -2
- package/build/cjs/packages/phoenix/src/controllers/keystrokes_controller/keystrokes_controller.js.map +1 -1
- package/build/cjs/packages/phoenix/src/index.js +5 -5
- package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item.d.ts +3 -6
- package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item.js +22 -30
- package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item_constants.js +1 -4
- package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item_constants.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.d.ts +11 -1
- package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.js +124 -14
- package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.js +1 -2
- package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown.d.ts +13 -4
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js +115 -38
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_content.d.ts +1 -2
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_content.js +12 -9
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_content.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.d.ts +1 -2
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js +14 -25
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/input/input_control.d.ts +3 -0
- package/build/esm/packages/phoenix/src/components/form/input/input_control.js +16 -1
- package/build/esm/packages/phoenix/src/components/form/input/input_control.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/select/select.js +4 -5
- package/build/esm/packages/phoenix/src/components/form/select/select.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/messages/base_message.d.ts +1 -3
- package/build/esm/packages/phoenix/src/components/messages/base_message.js +9 -47
- package/build/esm/packages/phoenix/src/components/messages/base_message.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/messages/base_message_constants.js +3 -4
- package/build/esm/packages/phoenix/src/components/messages/base_message_constants.js.map +1 -1
- package/build/esm/packages/phoenix/src/controllers/keystrokes_controller/keystrokes_controller.d.ts +2 -1
- package/build/esm/packages/phoenix/src/controllers/keystrokes_controller/keystrokes_controller.js +13 -2
- package/build/esm/packages/phoenix/src/controllers/keystrokes_controller/keystrokes_controller.js.map +1 -1
- package/build/esm/packages/phoenix/src/controllers/keystrokes_controller/keystrokes_controller_types.d.ts +1 -0
- package/build/esm/packages/phoenix/src/index.js +1 -1
- 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
|
-
|
|
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.
|
|
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;
|
|
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;"}
|
|
@@ -118,9 +118,12 @@ 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}"
|
|
122
121
|
?readonly="${this.readonly}"
|
|
123
122
|
?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'}"
|
|
124
127
|
@mousedown="${this._handleMouseDownEvent}"
|
|
125
128
|
@mouseup="${this._handleMouseUpEvent}"
|
|
126
129
|
@blur="${this._handleBlurEvent}"
|
|
@@ -182,6 +185,18 @@ tslib_es6.__decorate([
|
|
|
182
185
|
decorators.property({ type: String, attribute: 'valid-pattern' }),
|
|
183
186
|
tslib_es6.__metadata("design:type", String)
|
|
184
187
|
], 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);
|
|
185
200
|
exports.HInputControl = tslib_es6.__decorate([
|
|
186
201
|
phoenix_custom_element.phoenixCustomElement('h-input-control'),
|
|
187
202
|
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;"}
|
|
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;"}
|
|
@@ -247,9 +247,7 @@ 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
|
-
|
|
251
|
-
? $option.removeAttribute(this.multiple ? 'aria-checked' : 'aria-selected')
|
|
252
|
-
: $option.setAttribute(this.multiple ? 'aria-checked' : 'aria-selected', 'true');
|
|
250
|
+
$option.setAttribute(this.multiple ? 'aria-checked' : 'aria-selected', String($option.selected));
|
|
253
251
|
}
|
|
254
252
|
_removeHTMLOptions(optionsValues) {
|
|
255
253
|
this._$options = select_utils.SelectControlUtils.removeHTMLOptions(Array.from(this._$options.values()), optionsValues);
|
|
@@ -314,6 +312,7 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
314
312
|
name="${this.controlName}"
|
|
315
313
|
offset=${this.offset}
|
|
316
314
|
content-width="full"
|
|
315
|
+
prevent-focus-trap
|
|
317
316
|
>
|
|
318
317
|
<h-dropdown-toggler
|
|
319
318
|
${ref_js.ref(this._$dropdownToggler)}
|
|
@@ -323,7 +322,7 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
323
322
|
role="combobox"
|
|
324
323
|
aria-required="${this.required ? 'true' : 'false'}"
|
|
325
324
|
aria-activedescendant
|
|
326
|
-
|
|
325
|
+
aria-labelledby="${this.ariaLabelledby}"
|
|
327
326
|
>
|
|
328
327
|
${this.getSlot(select_constants.SELECT_SLOT_NAMES.toggler)}
|
|
329
328
|
</h-dropdown-toggler>
|
|
@@ -331,7 +330,7 @@ exports.HSelect = class HSelect extends phoenix_light_lit_element.PhoenixLightLi
|
|
|
331
330
|
<h-dropdown-content
|
|
332
331
|
class="${select_constants.SELECT_CSS_CLASSES.selectContent} ${this.error ? select_constants.SELECT_CSS_CLASSES.selectContentError : ''}"
|
|
333
332
|
${ref_js.ref(this._$dropdownContent)}
|
|
334
|
-
name
|
|
333
|
+
name="${this.controlName}"
|
|
335
334
|
@focusin="${this._manageSelectFocusAria}"
|
|
336
335
|
>
|
|
337
336
|
<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;"}
|
|
@@ -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,6 +18,7 @@ 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.tabindex = '0';
|
|
22
22
|
this._setupEventListeners = () => {
|
|
23
23
|
this.addEventListener('mouseenter', this.open);
|
|
24
24
|
this.addEventListener('mouseleave', this.close);
|
|
@@ -59,49 +59,11 @@ 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
|
-
};
|
|
88
62
|
this._clickOutsideController = new click_outside_controller.ClickOutsideController({
|
|
89
63
|
host: this,
|
|
90
64
|
container: this,
|
|
91
65
|
action: this.close
|
|
92
66
|
});
|
|
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
|
-
});
|
|
105
67
|
}
|
|
106
68
|
connectedCallback(messageComponentName = '') {
|
|
107
69
|
super.connectedCallback();
|
|
@@ -117,6 +79,7 @@ class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
|
117
79
|
elementToPosition: this._$messageContent,
|
|
118
80
|
offset: this.offset
|
|
119
81
|
});
|
|
82
|
+
this.setAttribute('tabindex', this.tabindex);
|
|
120
83
|
this._setupEventListeners();
|
|
121
84
|
}
|
|
122
85
|
static _appendMessagePortal() {
|
|
@@ -127,11 +90,6 @@ class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
|
127
90
|
$portalTarget.setAttribute(portal_constants.PORTAL_TARGET_NAME_PROP, base_message_constants.DEFAULT_MESSAGE_PORTAL_NAME);
|
|
128
91
|
document.body.appendChild($portalTarget);
|
|
129
92
|
}
|
|
130
|
-
_isBaseMessage($element) {
|
|
131
|
-
if (base_message_constants.MESSAGE_ELEMENTS.includes($element.localName))
|
|
132
|
-
return true;
|
|
133
|
-
return false;
|
|
134
|
-
}
|
|
135
93
|
}
|
|
136
94
|
tslib_es6.__decorate([
|
|
137
95
|
decorators.property({ type: Boolean, reflect: true }),
|
|
@@ -148,7 +106,11 @@ tslib_es6.__decorate([
|
|
|
148
106
|
tslib_es6.__decorate([
|
|
149
107
|
decorators.property({ type: String }),
|
|
150
108
|
tslib_es6.__metadata("design:type", Number)
|
|
151
|
-
], BaseMessage.prototype, "offset", void 0);
|
|
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);
|
|
152
114
|
|
|
153
115
|
exports.BaseMessage = BaseMessage;
|
|
154
116
|
//# 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;"}
|
|
@@ -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;
|
|
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;"}
|
package/build/cjs/packages/phoenix/src/controllers/keystrokes_controller/keystrokes_controller.js
CHANGED
|
@@ -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) {
|
|
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, '
|
|
467
|
+
Object.defineProperty(exports, 'HColorSwatches', {
|
|
468
468
|
enumerable: true,
|
|
469
469
|
get: function () {
|
|
470
|
-
return
|
|
470
|
+
return color_swatches.HColorSwatches;
|
|
471
471
|
}
|
|
472
472
|
});
|
|
473
|
-
Object.defineProperty(exports, '
|
|
473
|
+
Object.defineProperty(exports, 'HColorItem', {
|
|
474
474
|
enumerable: true,
|
|
475
475
|
get: function () {
|
|
476
|
-
return
|
|
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
|
|
12
|
-
constructor();
|
|
11
|
+
private _$colorSwatches;
|
|
13
12
|
connectedCallback(): void;
|
|
14
|
-
|
|
15
|
-
private
|
|
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 {
|
|
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.
|
|
16
|
-
|
|
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.
|
|
29
|
+
this._setupAriaAttributes();
|
|
30
|
+
this._setupClasses();
|
|
23
31
|
this.style.backgroundColor = this.setBgColor(this.disabled);
|
|
24
|
-
this.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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 };
|
package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item.js.map
CHANGED
|
@@ -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;"}
|
package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item_constants.js
CHANGED
|
@@ -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,
|
|
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;
|
|
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
|
|
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
|
}
|