@shoper/phoenix_design_system 1.11.11-2 → 1.11.11-20
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/form/search/search.js +89 -267
- package/build/cjs/packages/phoenix/src/components/form/search/search.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.js +0 -5
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/history/search_history.js +9 -21
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/history/search_history.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js +1 -12
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/message/search_message.js +1 -8
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/message/search_message.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_producer_content.js +4 -9
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_producer_content.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_product_content.js +4 -9
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_product_content.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_results.js +4 -11
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_results.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_suggestion_content.js +5 -12
- package/build/cjs/packages/phoenix/src/components/form/search/subcomponents/results/search_suggestion_content.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/messages/base_message.js +9 -3
- package/build/cjs/packages/phoenix/src/components/messages/base_message.js.map +1 -1
- package/build/cjs/packages/phoenix/src/index.js +17 -17
- 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/form/search/search.d.ts +5 -23
- package/build/esm/packages/phoenix/src/components/form/search/search.js +90 -268
- package/build/esm/packages/phoenix/src/components/form/search/search.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/search_types.d.ts +0 -4
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.d.ts +1 -2
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.js +0 -5
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/buttons/search_clear.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/history/search_history.d.ts +2 -2
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/history/search_history.js +9 -21
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/history/search_history.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.d.ts +0 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js +2 -13
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/input/search_input.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/message/search_message.d.ts +0 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/message/search_message.js +1 -8
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/message/search_message.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_producer_content.d.ts +1 -2
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_producer_content.js +4 -9
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_producer_content.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_product_content.d.ts +1 -2
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_product_content.js +4 -9
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_product_content.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_results.d.ts +1 -2
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_results.js +4 -11
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_results.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_suggestion_content.d.ts +1 -2
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_suggestion_content.js +5 -12
- package/build/esm/packages/phoenix/src/components/form/search/subcomponents/results/search_suggestion_content.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/messages/base_message.d.ts +1 -0
- package/build/esm/packages/phoenix/src/components/messages/base_message.js +9 -3
- package/build/esm/packages/phoenix/src/components/messages/base_message.js.map +1 -1
- package/build/esm/packages/phoenix/src/index.js +3 -3
- package/package.json +2 -2
|
@@ -7,47 +7,40 @@ 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
9
|
var phoenix_custom_element = require('../../../core/decorators/phoenix_custom_element.js');
|
|
10
|
-
var btn_controller = require('../../../controllers/btn_controller/btn_controller.js');
|
|
11
10
|
var color_item_constants = require('./color_item_constants.js');
|
|
12
11
|
|
|
13
12
|
exports.HColorItem = class HColorItem extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
14
13
|
constructor() {
|
|
15
|
-
super();
|
|
14
|
+
super(...arguments);
|
|
16
15
|
this.disabled = false;
|
|
17
16
|
this.selected = false;
|
|
18
17
|
this.unclickable = false;
|
|
19
|
-
this.
|
|
20
|
-
|
|
18
|
+
this._$colorSwatches = null;
|
|
19
|
+
this._setupAriaAttributes = () => {
|
|
20
|
+
var _a;
|
|
21
|
+
this._$colorSwatches = this.closest('h-color-swatches');
|
|
22
|
+
this.setAttribute('role', ((_a = this._$colorSwatches) === null || _a === void 0 ? void 0 : _a.multiple) ? 'checkbox' : 'radio');
|
|
23
|
+
this.setAttribute('aria-label', this.label ? this.label : this.color);
|
|
24
|
+
};
|
|
25
|
+
this._setupClasses = () => {
|
|
26
|
+
this.classList.add(color_item_constants.COLOR_ITEM_CSS_CLASSES.colorItem);
|
|
27
|
+
if (this.size)
|
|
28
|
+
this.classList.add(color_item_constants.COLOR_ITEM_CSS_CLASSES[this.size]);
|
|
21
29
|
};
|
|
22
|
-
this._btnController = new btn_controller.BtnController(this, this._dispatchClickedEvent);
|
|
23
30
|
}
|
|
24
31
|
connectedCallback() {
|
|
25
32
|
super.connectedCallback();
|
|
26
|
-
this.
|
|
33
|
+
this._setupAriaAttributes();
|
|
34
|
+
this._setupClasses();
|
|
27
35
|
this.style.backgroundColor = this.setBgColor(this.disabled);
|
|
28
|
-
this.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
36
|
+
if (this.unclickable) {
|
|
37
|
+
this.removeAttribute('tabindex');
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
this.setAttribute('tabindex', '0');
|
|
41
|
+
}
|
|
32
42
|
if (!this.value)
|
|
33
43
|
this.value = this.color;
|
|
34
|
-
if (this.size)
|
|
35
|
-
this.classList.add(color_item_constants.COLOR_ITEM_CSS_CLASSES[this.size]);
|
|
36
|
-
}
|
|
37
|
-
attributeChangedCallback(name, value, newValue) {
|
|
38
|
-
super.attributeChangedCallback(name, value, newValue);
|
|
39
|
-
switch (name) {
|
|
40
|
-
case color_item_constants.COLOR_ITEM_SELECTED_ATTRIBUTE: {
|
|
41
|
-
this._syncAriaPressed();
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
_syncAriaPressed() {
|
|
47
|
-
this.selected ? this.setAttribute('aria-pressed', '') : this.removeAttribute('aria-pressed');
|
|
48
|
-
}
|
|
49
|
-
setupEvents() {
|
|
50
|
-
!this.unclickable && this.addEventListener('click', this._dispatchClickedEvent);
|
|
51
44
|
}
|
|
52
45
|
setBgColor(itemIsDisabled) {
|
|
53
46
|
return itemIsDisabled ? utilities.ColorUtils.hexToRgba(this.color, 0.5) : this.color;
|
|
@@ -82,7 +75,6 @@ tslib_es6.__decorate([
|
|
|
82
75
|
tslib_es6.__metadata("design:type", Boolean)
|
|
83
76
|
], exports.HColorItem.prototype, "unclickable", void 0);
|
|
84
77
|
exports.HColorItem = tslib_es6.__decorate([
|
|
85
|
-
phoenix_custom_element.phoenixCustomElement('h-color-item')
|
|
86
|
-
tslib_es6.__metadata("design:paramtypes", [])
|
|
78
|
+
phoenix_custom_element.phoenixCustomElement('h-color-item')
|
|
87
79
|
], exports.HColorItem);
|
|
88
80
|
//# sourceMappingURL=color_item.js.map
|
package/build/cjs/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;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;
|
|
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;"}
|
package/build/cjs/packages/phoenix/src/components/color_swatches/color_item/color_item_constants.js
CHANGED
|
@@ -3,9 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const colorItemBaseCssClass = 'color-item';
|
|
6
|
-
const COLOR_ITEM_EVENT_NAMES = {
|
|
7
|
-
selected: 'colorItemSelected'
|
|
8
|
-
};
|
|
9
6
|
const COLOR_ITEM_SIZES = {
|
|
10
7
|
s: 's',
|
|
11
8
|
xs: 'xs'
|
|
@@ -18,7 +15,6 @@ const COLOR_ITEM_CSS_CLASSES = {
|
|
|
18
15
|
const COLOR_ITEM_SELECTED_ATTRIBUTE = 'selected';
|
|
19
16
|
|
|
20
17
|
exports.COLOR_ITEM_CSS_CLASSES = COLOR_ITEM_CSS_CLASSES;
|
|
21
|
-
exports.COLOR_ITEM_EVENT_NAMES = COLOR_ITEM_EVENT_NAMES;
|
|
22
18
|
exports.COLOR_ITEM_SELECTED_ATTRIBUTE = COLOR_ITEM_SELECTED_ATTRIBUTE;
|
|
23
19
|
exports.COLOR_ITEM_SIZES = COLOR_ITEM_SIZES;
|
|
24
20
|
//# 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;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;"}
|
|
@@ -8,6 +8,7 @@ var decorators = require('lit/decorators');
|
|
|
8
8
|
var utilities = require('@dreamcommerce/utilities');
|
|
9
9
|
var phoenix_light_lit_element = require('../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
|
|
10
10
|
var phoenix_custom_element = require('../../core/decorators/phoenix_custom_element.js');
|
|
11
|
+
var keystrokes_controller = require('../../controllers/keystrokes_controller/keystrokes_controller.js');
|
|
11
12
|
require('lit-html');
|
|
12
13
|
var color_swatches_constants = require('./color_swatches_constants.js');
|
|
13
14
|
var color_item_constants = require('./color_item/color_item_constants.js');
|
|
@@ -18,8 +19,87 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
|
|
|
18
19
|
this.multiple = false;
|
|
19
20
|
this.selectedColors = [];
|
|
20
21
|
this.showMoreBtnText = 'Pokaż wszystkie kolory';
|
|
21
|
-
this.
|
|
22
|
-
|
|
22
|
+
this._setupEvents = () => {
|
|
23
|
+
if (this.getAttribute('role') === 'group') {
|
|
24
|
+
this._setupCheckboxGroupEvents();
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
this._setupRadioGroupEvents();
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
this._setupCheckboxGroupEvents = () => {
|
|
31
|
+
this._setupColorClickEvents();
|
|
32
|
+
};
|
|
33
|
+
this._setupRadioGroupEvents = () => {
|
|
34
|
+
document.body.addEventListener('keydown', this._focusOnSelectedColor);
|
|
35
|
+
this.addEventListener('keydown', this._handleTabNavigation);
|
|
36
|
+
this.addEventListener('keyup', this._handleRadioNavigation);
|
|
37
|
+
this._setupColorClickEvents();
|
|
38
|
+
};
|
|
39
|
+
this._setupColorClickEvents = () => {
|
|
40
|
+
if (!this._$colorSwatchesChildren)
|
|
41
|
+
return;
|
|
42
|
+
this._$colorSwatchesChildren.forEach(($colorItem) => {
|
|
43
|
+
$colorItem.addEventListener('click', this._handleColorClicked);
|
|
44
|
+
new keystrokes_controller.KeystrokesController({
|
|
45
|
+
host: this,
|
|
46
|
+
keys: [' '],
|
|
47
|
+
callback: this._handleColorClicked,
|
|
48
|
+
target: $colorItem
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
this._handleColorClicked = (ev) => {
|
|
53
|
+
ev.preventDefault();
|
|
54
|
+
const $colorItem = ev.target;
|
|
55
|
+
if ($colorItem.unclickable)
|
|
56
|
+
return;
|
|
57
|
+
this._toggleColorItem($colorItem);
|
|
58
|
+
this._dispatchColorChangeEvent($colorItem);
|
|
59
|
+
};
|
|
60
|
+
this._handleTabNavigation = (ev) => {
|
|
61
|
+
if (ev.key !== 'Tab')
|
|
62
|
+
return;
|
|
63
|
+
ev.preventDefault();
|
|
64
|
+
if (ev.shiftKey) {
|
|
65
|
+
const $firstFocusableColor = utilities.UiDomUtils.getFocusableElement(this);
|
|
66
|
+
utilities.UiDomUtils.getPreviousFocusableElement($firstFocusableColor).focus();
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const $LastFocusableColor = utilities.UiDomUtils.getLastFocusableElement(this);
|
|
70
|
+
utilities.UiDomUtils.getNextFocusableElement($LastFocusableColor).focus();
|
|
71
|
+
};
|
|
72
|
+
this._handleRadioNavigation = (ev) => {
|
|
73
|
+
const changeToNextKeys = ['ArrowDown', 'ArrowRight'];
|
|
74
|
+
const changeToPreviousKeys = ['ArrowUp', 'ArrowLeft'];
|
|
75
|
+
if (!changeToNextKeys.includes(ev.key) && !changeToPreviousKeys.includes(ev.key))
|
|
76
|
+
return;
|
|
77
|
+
ev.preventDefault();
|
|
78
|
+
if (changeToNextKeys.includes(ev.key)) {
|
|
79
|
+
this._handleChangeToNextColorItem(ev);
|
|
80
|
+
}
|
|
81
|
+
if (changeToPreviousKeys.includes(ev.key)) {
|
|
82
|
+
this._handleChangeToPreviousColorItem(ev);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
this._focusOnSelectedColor = (ev) => {
|
|
86
|
+
if (ev.key !== 'Tab' || this.multiple)
|
|
87
|
+
return;
|
|
88
|
+
if (ev.shiftKey) {
|
|
89
|
+
const $previousFocusableElement = utilities.UiDomUtils.getPreviousFocusableElement(document.activeElement);
|
|
90
|
+
if (this.contains($previousFocusableElement) && this.selectedColors.length > 0) {
|
|
91
|
+
ev.preventDefault();
|
|
92
|
+
this.selectedColors[0].focus();
|
|
93
|
+
}
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const $nextFocusableElement = utilities.UiDomUtils.getNextFocusableElement(document.activeElement);
|
|
97
|
+
if (this.contains($nextFocusableElement) && this.selectedColors.length > 0) {
|
|
98
|
+
ev.preventDefault();
|
|
99
|
+
this.selectedColors[0].focus();
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
this._handleColorChange = ($colorItem) => {
|
|
23
103
|
this._toggleColorItem($colorItem);
|
|
24
104
|
this._dispatchColorChangeEvent($colorItem);
|
|
25
105
|
};
|
|
@@ -56,6 +136,8 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
|
|
|
56
136
|
}
|
|
57
137
|
connectedCallback() {
|
|
58
138
|
super.connectedCallback();
|
|
139
|
+
this.setAttribute('role', this.multiple ? 'group' : 'radiogroup');
|
|
140
|
+
this._$colorSwatchesChildren = [...this.children];
|
|
59
141
|
this._setupEvents();
|
|
60
142
|
this._addCssClasses();
|
|
61
143
|
this.numberOfVisibleColors && this._hideItems(this.numberOfVisibleColors);
|
|
@@ -68,11 +150,9 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
|
|
|
68
150
|
this.classList.add(color_swatches_constants.COLOR_SWATCHES_CSS_CLASSES.colorSwatches);
|
|
69
151
|
}
|
|
70
152
|
_hideItems(numberOfVisibleColors) {
|
|
71
|
-
var _a;
|
|
72
|
-
this._$colorSwatchesChildren = (_a = document.querySelector(color_swatches_constants.COLOR_SWATCHES_TAG_NAME)) === null || _a === void 0 ? void 0 : _a.children;
|
|
73
153
|
if (!this._$colorSwatchesChildren)
|
|
74
154
|
return;
|
|
75
|
-
|
|
155
|
+
this._$colorSwatchesChildren.forEach(($colorSwatchesChild, index) => {
|
|
76
156
|
if (index > numberOfVisibleColors - 1) {
|
|
77
157
|
$colorSwatchesChild.setAttribute(color_swatches_constants.COLOR_SWATCHES_HIDDEN_ATTRIBUTE, '');
|
|
78
158
|
}
|
|
@@ -83,17 +163,40 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
|
|
|
83
163
|
var _a;
|
|
84
164
|
if (!this._$colorSwatchesChildren)
|
|
85
165
|
return;
|
|
86
|
-
|
|
166
|
+
this._$colorSwatchesChildren.forEach(($colorSwatchesChild) => {
|
|
87
167
|
$colorSwatchesChild.removeAttribute(color_swatches_constants.COLOR_SWATCHES_HIDDEN_ATTRIBUTE);
|
|
88
168
|
});
|
|
89
169
|
(_a = this.querySelector('h-color-swatches-show-more')) === null || _a === void 0 ? void 0 : _a.setAttribute(color_swatches_constants.COLOR_SWATCHES_HIDDEN_ATTRIBUTE, '');
|
|
90
170
|
});
|
|
91
171
|
}
|
|
92
|
-
|
|
93
|
-
|
|
172
|
+
_handleChangeToNextColorItem({ target }) {
|
|
173
|
+
const $colorItem = target;
|
|
174
|
+
const $nextFocusableElement = utilities.UiDomUtils.getNextFocusableElement($colorItem);
|
|
175
|
+
let $nextColorItem;
|
|
176
|
+
if (!this.contains($nextFocusableElement)) {
|
|
177
|
+
$nextColorItem = utilities.UiDomUtils.getFocusableElement(this);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
$nextColorItem = $nextFocusableElement;
|
|
181
|
+
}
|
|
182
|
+
$nextColorItem.focus();
|
|
183
|
+
this._handleColorChange($nextColorItem);
|
|
184
|
+
}
|
|
185
|
+
_handleChangeToPreviousColorItem({ target }) {
|
|
186
|
+
const $colorItem = target;
|
|
187
|
+
const $previousFocusableElement = utilities.UiDomUtils.getPreviousFocusableElement($colorItem);
|
|
188
|
+
let $previousColorItem;
|
|
189
|
+
if (!this.contains($previousFocusableElement)) {
|
|
190
|
+
$previousColorItem = utilities.UiDomUtils.getLastFocusableElement(this);
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
$previousColorItem = $previousFocusableElement;
|
|
194
|
+
}
|
|
195
|
+
$previousColorItem.focus();
|
|
196
|
+
this._handleColorChange($previousColorItem);
|
|
94
197
|
}
|
|
95
198
|
_toggleColorItem($colorItem) {
|
|
96
|
-
this.multiple ? this._handleColorClickedForMultipleMode($colorItem) : this.
|
|
199
|
+
this.multiple ? this._handleColorClickedForMultipleMode($colorItem) : this._handleColorChangeForSingleMode($colorItem);
|
|
97
200
|
}
|
|
98
201
|
_handleColorClickedForMultipleMode($colorItem) {
|
|
99
202
|
!this._isColorAlreadyExistInArray($colorItem)
|
|
@@ -101,17 +204,20 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
|
|
|
101
204
|
: this._removeExistingColorFromArray($colorItem);
|
|
102
205
|
this._toggleSelectedAttribute($colorItem);
|
|
103
206
|
}
|
|
104
|
-
|
|
207
|
+
_handleColorChangeForSingleMode($colorItem) {
|
|
105
208
|
const $previouslySelected = this.selectedColors[0];
|
|
106
209
|
this._toggleSelectedAttribute($colorItem);
|
|
107
|
-
if ($previouslySelected && $previouslySelected !== $colorItem)
|
|
210
|
+
if ($previouslySelected && $previouslySelected !== $colorItem) {
|
|
108
211
|
$previouslySelected.removeAttribute(color_item_constants.COLOR_ITEM_SELECTED_ATTRIBUTE);
|
|
212
|
+
$previouslySelected.setAttribute('aria-checked', 'false');
|
|
213
|
+
}
|
|
109
214
|
this.selectedColors = $previouslySelected === $colorItem ? [] : [$colorItem];
|
|
110
215
|
}
|
|
111
216
|
_toggleSelectedAttribute($colorItem) {
|
|
112
217
|
$colorItem.hasAttribute(color_item_constants.COLOR_ITEM_SELECTED_ATTRIBUTE)
|
|
113
218
|
? $colorItem.removeAttribute(color_item_constants.COLOR_ITEM_SELECTED_ATTRIBUTE)
|
|
114
219
|
: $colorItem.setAttribute(color_item_constants.COLOR_ITEM_SELECTED_ATTRIBUTE, '');
|
|
220
|
+
$colorItem.setAttribute('aria-checked', 'true');
|
|
115
221
|
}
|
|
116
222
|
_isColorAlreadyExistInArray($colorItem) {
|
|
117
223
|
return this.selectedColors.includes($colorItem);
|
|
@@ -120,6 +226,10 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
|
|
|
120
226
|
const indexOfAlreadyExistingColor = this.selectedColors.indexOf($colorItem);
|
|
121
227
|
this.selectedColors.splice(indexOfAlreadyExistingColor, 1);
|
|
122
228
|
}
|
|
229
|
+
disconnectedCallback() {
|
|
230
|
+
super.disconnectedCallback();
|
|
231
|
+
document.body.removeEventListener('keydown', this._focusOnSelectedColor);
|
|
232
|
+
}
|
|
123
233
|
render() {
|
|
124
234
|
return lit.html `
|
|
125
235
|
${this.getSlot('default')}
|
|
@@ -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;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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/cjs/packages/phoenix/src/components/color_swatches/color_swatches_constants.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const colorSwatchesBaseCssClass = 'color-swatches';
|
|
6
|
-
const COLOR_SWATCHES_TAG_NAME = 'h-color-swatches';
|
|
7
6
|
const COLOR_ITEM_TAG_NAME = 'h-color-item';
|
|
8
7
|
const COLOR_SWATCHES_CSS_CLASSES = {
|
|
9
8
|
colorSwatches: colorSwatchesBaseCssClass,
|
|
@@ -20,5 +19,4 @@ exports.COLOR_ITEM_TAG_NAME = COLOR_ITEM_TAG_NAME;
|
|
|
20
19
|
exports.COLOR_SWATCHES_CSS_CLASSES = COLOR_SWATCHES_CSS_CLASSES;
|
|
21
20
|
exports.COLOR_SWATCHES_EVENT_NAMES = COLOR_SWATCHES_EVENT_NAMES;
|
|
22
21
|
exports.COLOR_SWATCHES_HIDDEN_ATTRIBUTE = COLOR_SWATCHES_HIDDEN_ATTRIBUTE;
|
|
23
|
-
exports.COLOR_SWATCHES_TAG_NAME = COLOR_SWATCHES_TAG_NAME;
|
|
24
22
|
//# sourceMappingURL=color_swatches_constants.js.map
|
package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches_constants.js.map
CHANGED
|
@@ -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;
|
|
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;"}
|