@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.
- package/build/cjs/packages/phoenix/src/components/color_swatches/color_item/color_item.js +29 -21
- 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 +4 -0
- 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 +11 -121
- 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 +2 -0
- 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 +37 -114
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_content.js +9 -12
- 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 +24 -13
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_toggler.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file_picker.js +1 -1
- package/build/cjs/packages/phoenix/src/components/form/input/input_control.js +1 -16
- 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 +5 -4
- 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 +45 -7
- 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 +2 -0
- 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 +2 -13
- 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 +6 -3
- package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item.js +30 -22
- 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 +4 -1
- 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 +1 -11
- package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.js +14 -124
- 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 +2 -1
- 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 +4 -13
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js +38 -115
- 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 +2 -1
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_content.js +9 -12
- 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 +2 -1
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js +25 -14
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker.js +1 -1
- package/build/esm/packages/phoenix/src/components/form/input/input_control.d.ts +0 -3
- package/build/esm/packages/phoenix/src/components/form/input/input_control.js +1 -16
- 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 +5 -4
- 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 +3 -1
- package/build/esm/packages/phoenix/src/components/messages/base_message.js +47 -9
- 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 +4 -3
- 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 +1 -2
- package/build/esm/packages/phoenix/src/controllers/keystrokes_controller/keystrokes_controller.js +2 -13
- 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 +0 -1
- package/build/esm/packages/phoenix/src/index.js +1 -1
- package/package.json +1 -1
|
@@ -7,40 +7,47 @@ 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');
|
|
10
11
|
var color_item_constants = require('./color_item_constants.js');
|
|
11
12
|
|
|
12
13
|
exports.HColorItem = class HColorItem extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
13
14
|
constructor() {
|
|
14
|
-
super(
|
|
15
|
+
super();
|
|
15
16
|
this.disabled = false;
|
|
16
17
|
this.selected = false;
|
|
17
18
|
this.unclickable = false;
|
|
18
|
-
this.
|
|
19
|
-
|
|
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]);
|
|
19
|
+
this._dispatchClickedEvent = () => {
|
|
20
|
+
this.emitEvent(color_item_constants.COLOR_ITEM_EVENT_NAMES.selected);
|
|
29
21
|
};
|
|
22
|
+
this._btnController = new btn_controller.BtnController(this, this._dispatchClickedEvent);
|
|
30
23
|
}
|
|
31
24
|
connectedCallback() {
|
|
32
25
|
super.connectedCallback();
|
|
33
|
-
this.
|
|
34
|
-
this._setupClasses();
|
|
26
|
+
this.setupEvents();
|
|
35
27
|
this.style.backgroundColor = this.setBgColor(this.disabled);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
this.setAttribute('tabindex', '0');
|
|
41
|
-
}
|
|
28
|
+
this._syncAriaPressed();
|
|
29
|
+
this.setAttribute('aria-label', this.label ? this.label : this.color);
|
|
30
|
+
this.unclickable && this.removeAttribute('tabindex');
|
|
31
|
+
this.classList.add(color_item_constants.COLOR_ITEM_CSS_CLASSES.colorItem);
|
|
42
32
|
if (!this.value)
|
|
43
33
|
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);
|
|
44
51
|
}
|
|
45
52
|
setBgColor(itemIsDisabled) {
|
|
46
53
|
return itemIsDisabled ? utilities.ColorUtils.hexToRgba(this.color, 0.5) : this.color;
|
|
@@ -75,6 +82,7 @@ tslib_es6.__decorate([
|
|
|
75
82
|
tslib_es6.__metadata("design:type", Boolean)
|
|
76
83
|
], exports.HColorItem.prototype, "unclickable", void 0);
|
|
77
84
|
exports.HColorItem = tslib_es6.__decorate([
|
|
78
|
-
phoenix_custom_element.phoenixCustomElement('h-color-item')
|
|
85
|
+
phoenix_custom_element.phoenixCustomElement('h-color-item'),
|
|
86
|
+
tslib_es6.__metadata("design:paramtypes", [])
|
|
79
87
|
], exports.HColorItem);
|
|
80
88
|
//# 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;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,6 +3,9 @@
|
|
|
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
|
+
};
|
|
6
9
|
const COLOR_ITEM_SIZES = {
|
|
7
10
|
s: 's',
|
|
8
11
|
xs: 'xs'
|
|
@@ -15,6 +18,7 @@ const COLOR_ITEM_CSS_CLASSES = {
|
|
|
15
18
|
const COLOR_ITEM_SELECTED_ATTRIBUTE = 'selected';
|
|
16
19
|
|
|
17
20
|
exports.COLOR_ITEM_CSS_CLASSES = COLOR_ITEM_CSS_CLASSES;
|
|
21
|
+
exports.COLOR_ITEM_EVENT_NAMES = COLOR_ITEM_EVENT_NAMES;
|
|
18
22
|
exports.COLOR_ITEM_SELECTED_ATTRIBUTE = COLOR_ITEM_SELECTED_ATTRIBUTE;
|
|
19
23
|
exports.COLOR_ITEM_SIZES = COLOR_ITEM_SIZES;
|
|
20
24
|
//# 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;AACA;AACA;AACA;AACA;"}
|
|
@@ -8,7 +8,6 @@ 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');
|
|
12
11
|
require('lit-html');
|
|
13
12
|
var color_swatches_constants = require('./color_swatches_constants.js');
|
|
14
13
|
var color_item_constants = require('./color_item/color_item_constants.js');
|
|
@@ -19,87 +18,8 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
|
|
|
19
18
|
this.multiple = false;
|
|
20
19
|
this.selectedColors = [];
|
|
21
20
|
this.showMoreBtnText = 'Pokaż wszystkie kolory';
|
|
22
|
-
this.
|
|
23
|
-
|
|
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) => {
|
|
21
|
+
this._handleColorClicked = ({ target }) => {
|
|
22
|
+
const $colorItem = target;
|
|
103
23
|
this._toggleColorItem($colorItem);
|
|
104
24
|
this._dispatchColorChangeEvent($colorItem);
|
|
105
25
|
};
|
|
@@ -136,8 +56,6 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
|
|
|
136
56
|
}
|
|
137
57
|
connectedCallback() {
|
|
138
58
|
super.connectedCallback();
|
|
139
|
-
this.setAttribute('role', this.multiple ? 'group' : 'radiogroup');
|
|
140
|
-
this._$colorSwatchesChildren = [...this.children];
|
|
141
59
|
this._setupEvents();
|
|
142
60
|
this._addCssClasses();
|
|
143
61
|
this.numberOfVisibleColors && this._hideItems(this.numberOfVisibleColors);
|
|
@@ -150,9 +68,11 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
|
|
|
150
68
|
this.classList.add(color_swatches_constants.COLOR_SWATCHES_CSS_CLASSES.colorSwatches);
|
|
151
69
|
}
|
|
152
70
|
_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;
|
|
153
73
|
if (!this._$colorSwatchesChildren)
|
|
154
74
|
return;
|
|
155
|
-
this._$colorSwatchesChildren.forEach(($colorSwatchesChild, index) => {
|
|
75
|
+
Array.from(this._$colorSwatchesChildren).forEach(($colorSwatchesChild, index) => {
|
|
156
76
|
if (index > numberOfVisibleColors - 1) {
|
|
157
77
|
$colorSwatchesChild.setAttribute(color_swatches_constants.COLOR_SWATCHES_HIDDEN_ATTRIBUTE, '');
|
|
158
78
|
}
|
|
@@ -163,40 +83,17 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
|
|
|
163
83
|
var _a;
|
|
164
84
|
if (!this._$colorSwatchesChildren)
|
|
165
85
|
return;
|
|
166
|
-
this._$colorSwatchesChildren.forEach(($colorSwatchesChild) => {
|
|
86
|
+
Array.from(this._$colorSwatchesChildren).forEach(($colorSwatchesChild) => {
|
|
167
87
|
$colorSwatchesChild.removeAttribute(color_swatches_constants.COLOR_SWATCHES_HIDDEN_ATTRIBUTE);
|
|
168
88
|
});
|
|
169
89
|
(_a = this.querySelector('h-color-swatches-show-more')) === null || _a === void 0 ? void 0 : _a.setAttribute(color_swatches_constants.COLOR_SWATCHES_HIDDEN_ATTRIBUTE, '');
|
|
170
90
|
});
|
|
171
91
|
}
|
|
172
|
-
|
|
173
|
-
|
|
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);
|
|
92
|
+
_setupEvents() {
|
|
93
|
+
this.addEventListener(color_item_constants.COLOR_ITEM_EVENT_NAMES.selected, this._handleColorClicked);
|
|
197
94
|
}
|
|
198
95
|
_toggleColorItem($colorItem) {
|
|
199
|
-
this.multiple ? this._handleColorClickedForMultipleMode($colorItem) : this.
|
|
96
|
+
this.multiple ? this._handleColorClickedForMultipleMode($colorItem) : this._handleColorClickedForSingleMode($colorItem);
|
|
200
97
|
}
|
|
201
98
|
_handleColorClickedForMultipleMode($colorItem) {
|
|
202
99
|
!this._isColorAlreadyExistInArray($colorItem)
|
|
@@ -204,20 +101,17 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
|
|
|
204
101
|
: this._removeExistingColorFromArray($colorItem);
|
|
205
102
|
this._toggleSelectedAttribute($colorItem);
|
|
206
103
|
}
|
|
207
|
-
|
|
104
|
+
_handleColorClickedForSingleMode($colorItem) {
|
|
208
105
|
const $previouslySelected = this.selectedColors[0];
|
|
209
106
|
this._toggleSelectedAttribute($colorItem);
|
|
210
|
-
if ($previouslySelected && $previouslySelected !== $colorItem)
|
|
107
|
+
if ($previouslySelected && $previouslySelected !== $colorItem)
|
|
211
108
|
$previouslySelected.removeAttribute(color_item_constants.COLOR_ITEM_SELECTED_ATTRIBUTE);
|
|
212
|
-
$previouslySelected.setAttribute('aria-checked', 'false');
|
|
213
|
-
}
|
|
214
109
|
this.selectedColors = $previouslySelected === $colorItem ? [] : [$colorItem];
|
|
215
110
|
}
|
|
216
111
|
_toggleSelectedAttribute($colorItem) {
|
|
217
112
|
$colorItem.hasAttribute(color_item_constants.COLOR_ITEM_SELECTED_ATTRIBUTE)
|
|
218
113
|
? $colorItem.removeAttribute(color_item_constants.COLOR_ITEM_SELECTED_ATTRIBUTE)
|
|
219
114
|
: $colorItem.setAttribute(color_item_constants.COLOR_ITEM_SELECTED_ATTRIBUTE, '');
|
|
220
|
-
$colorItem.setAttribute('aria-checked', 'true');
|
|
221
115
|
}
|
|
222
116
|
_isColorAlreadyExistInArray($colorItem) {
|
|
223
117
|
return this.selectedColors.includes($colorItem);
|
|
@@ -226,10 +120,6 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
|
|
|
226
120
|
const indexOfAlreadyExistingColor = this.selectedColors.indexOf($colorItem);
|
|
227
121
|
this.selectedColors.splice(indexOfAlreadyExistingColor, 1);
|
|
228
122
|
}
|
|
229
|
-
disconnectedCallback() {
|
|
230
|
-
super.disconnectedCallback();
|
|
231
|
-
document.body.removeEventListener('keydown', this._focusOnSelectedColor);
|
|
232
|
-
}
|
|
233
123
|
render() {
|
|
234
124
|
return lit.html `
|
|
235
125
|
${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;"}
|
package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches_constants.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
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';
|
|
6
7
|
const COLOR_ITEM_TAG_NAME = 'h-color-item';
|
|
7
8
|
const COLOR_SWATCHES_CSS_CLASSES = {
|
|
8
9
|
colorSwatches: colorSwatchesBaseCssClass,
|
|
@@ -19,4 +20,5 @@ exports.COLOR_ITEM_TAG_NAME = COLOR_ITEM_TAG_NAME;
|
|
|
19
20
|
exports.COLOR_SWATCHES_CSS_CLASSES = COLOR_SWATCHES_CSS_CLASSES;
|
|
20
21
|
exports.COLOR_SWATCHES_EVENT_NAMES = COLOR_SWATCHES_EVENT_NAMES;
|
|
21
22
|
exports.COLOR_SWATCHES_HIDDEN_ATTRIBUTE = COLOR_SWATCHES_HIDDEN_ATTRIBUTE;
|
|
23
|
+
exports.COLOR_SWATCHES_TAG_NAME = COLOR_SWATCHES_TAG_NAME;
|
|
22
24
|
//# 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;AACA;AACA;"}
|
|
@@ -12,7 +12,6 @@ var litHtml = require('lit-html');
|
|
|
12
12
|
var global_constants = require('../../global_constants.js');
|
|
13
13
|
var dropdown_constants = require('./dropdown_constants.js');
|
|
14
14
|
var relative_position_controller_constants = require('../../controllers/relative_position_controller/relative_position_controller_constants.js');
|
|
15
|
-
var v4 = require('../../../../../external/uuid/dist/esm-browser/v4.js');
|
|
16
15
|
var portal_constants = require('../portal/portal_constants.js');
|
|
17
16
|
var backdrop_controller = require('../backdrop/controller/backdrop_controller.js');
|
|
18
17
|
var click_outside_controller = require('../../controllers/click_outside_controller/click_outside_controller.js');
|
|
@@ -30,8 +29,6 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
|
|
|
30
29
|
this.transition = 'direction';
|
|
31
30
|
this.offset = 0;
|
|
32
31
|
this.portalTarget = dropdown_constants.DEFAULT_DROPDOWN_PORTAL_NAME;
|
|
33
|
-
this.id = v4['default']();
|
|
34
|
-
this.preventFocusTrap = false;
|
|
35
32
|
this._backdropController = new backdrop_controller.BackdropController();
|
|
36
33
|
this._handleClickOutside = async (target) => {
|
|
37
34
|
var _a, _b;
|
|
@@ -48,7 +45,7 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
|
|
|
48
45
|
return;
|
|
49
46
|
}
|
|
50
47
|
await this.show();
|
|
51
|
-
|
|
48
|
+
utilities.UiDomUtils.setFocusToFirstFocusableElementInContainer(this.$dropdownContent);
|
|
52
49
|
};
|
|
53
50
|
this.show = async () => {
|
|
54
51
|
if (this.opened)
|
|
@@ -139,32 +136,44 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
|
|
|
139
136
|
return;
|
|
140
137
|
await this.hide();
|
|
141
138
|
};
|
|
142
|
-
this.
|
|
143
|
-
|
|
144
|
-
if (
|
|
145
|
-
return;
|
|
146
|
-
const $target = ev.target;
|
|
147
|
-
if (((_a = this.$dropdownContent) === null || _a === void 0 ? void 0 : _a.contains($target)) && this.preventFocusTrap) {
|
|
148
|
-
this._handleFocusOnNextElementAfterDropdown(ev);
|
|
139
|
+
this._handleForwardFocus = async (ev) => {
|
|
140
|
+
// if (!this.opened) this._handleFocusOnNextElement(ev);
|
|
141
|
+
if (!this.opened || ev.shiftKey)
|
|
149
142
|
return;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
143
|
+
const $focusableElementsWithinDropdownContent = utilities.UiDomUtils.getFocusableElements(this.$dropdownContent).filter((element) => element.closest(dropdown_constants.DROPDOWN_CONTENT_NAME) === this.$dropdownContent);
|
|
144
|
+
const doesNotHaveFocusableElementsInsideContent = $focusableElementsWithinDropdownContent.length <= 0 && this.opened;
|
|
145
|
+
const indexOfCurrentlyFocusedElement = $focusableElementsWithinDropdownContent.indexOf(document.activeElement);
|
|
146
|
+
const isActiveElementLastFocusableElement = indexOfCurrentlyFocusedElement === $focusableElementsWithinDropdownContent.length - 1;
|
|
147
|
+
if (doesNotHaveFocusableElementsInsideContent || isActiveElementLastFocusableElement)
|
|
148
|
+
this._handleFocusOnNextElement(ev);
|
|
149
|
+
};
|
|
150
|
+
this._handleFocusOnNextElement = async (ev) => {
|
|
151
|
+
var _a;
|
|
152
|
+
ev.preventDefault();
|
|
153
|
+
const $focusableElements = utilities.UiDomUtils.getFocusableElements(document.body);
|
|
154
|
+
const indexOfDropdownToggler = $focusableElements.indexOf(this.$dropdownToggler);
|
|
155
|
+
const $nextElementToFocus = (_a = $focusableElements[indexOfDropdownToggler + 1]) !== null && _a !== void 0 ? _a : $focusableElements[0];
|
|
156
|
+
await this._hideDropdownsSequentially();
|
|
157
|
+
await this.hide();
|
|
158
|
+
this._focusOnNextElementAfterToggler($nextElementToFocus);
|
|
159
|
+
};
|
|
160
|
+
this._focusOnNextElementAfterToggler = ($elementToFocus) => {
|
|
161
|
+
var _a;
|
|
162
|
+
const isTogglerLastChildOfPreviousDropdown = ($elementToFocus === null || $elementToFocus === void 0 ? void 0 : $elementToFocus.closest(dropdown_constants.DROPDOWN_CONTENT_NAME)) === this.$dropdownContent;
|
|
163
|
+
if (isTogglerLastChildOfPreviousDropdown) {
|
|
164
|
+
(_a = this.$dropdownToggler) === null || _a === void 0 ? void 0 : _a.focus();
|
|
153
165
|
return;
|
|
154
166
|
}
|
|
155
|
-
|
|
167
|
+
$elementToFocus === null || $elementToFocus === void 0 ? void 0 : $elementToFocus.focus();
|
|
156
168
|
};
|
|
157
|
-
this.
|
|
158
|
-
|
|
169
|
+
this._handleBackwardFocus = async (ev) => {
|
|
170
|
+
var _a;
|
|
171
|
+
const $firstFocusableElement = this.$dropdownContent && utilities.UiDomUtils.getFocusableElement(this.$dropdownContent);
|
|
172
|
+
if (document.activeElement !== $firstFocusableElement)
|
|
159
173
|
return;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
this._handleFocusFromTogglerBackwards(ev, $target);
|
|
166
|
-
this._handleFocusFromSentinelStartBackwards(ev, $target);
|
|
167
|
-
}
|
|
174
|
+
ev.preventDefault();
|
|
175
|
+
(_a = this.$dropdownToggler) === null || _a === void 0 ? void 0 : _a.focus();
|
|
176
|
+
await this._hideDropdownsSequentially();
|
|
168
177
|
};
|
|
169
178
|
this._hoverToggle = async (ev) => {
|
|
170
179
|
if (window.innerWidth < global_constants.BREAKPOINTS.xs)
|
|
@@ -176,19 +185,12 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
|
|
|
176
185
|
const isHoveredWithinDropdown = this._isHoveredWithinDropdown(ev.target);
|
|
177
186
|
if (isHoveredWithinDropdown && !this.opened) {
|
|
178
187
|
await this.show();
|
|
179
|
-
|
|
188
|
+
utilities.UiDomUtils.setFocusToFirstFocusableElementInContainer(this.$dropdownContent);
|
|
180
189
|
return;
|
|
181
190
|
}
|
|
182
191
|
if (!isHoveredWithinDropdown && this.opened)
|
|
183
192
|
await this._hideDropdownsSequentially();
|
|
184
193
|
};
|
|
185
|
-
this._focusOnFirstContentElement = () => {
|
|
186
|
-
if (!this.$dropdownContent)
|
|
187
|
-
return;
|
|
188
|
-
const $firstFocusableElement = this._getTrulyFocusableElements(this.$dropdownContent)[0];
|
|
189
|
-
if ($firstFocusableElement)
|
|
190
|
-
$firstFocusableElement.focus();
|
|
191
|
-
};
|
|
192
194
|
this.isOpened = () => this.opened;
|
|
193
195
|
this._positionDropdownContent = () => {
|
|
194
196
|
if (this.contentWidth === dropdown_constants.DROPDOWN_CONTENT_WIDTH.full)
|
|
@@ -214,14 +216,13 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
|
|
|
214
216
|
host: this,
|
|
215
217
|
target: document.body,
|
|
216
218
|
keys: ['tab'],
|
|
217
|
-
callback: this.
|
|
219
|
+
callback: this._handleForwardFocus
|
|
218
220
|
});
|
|
219
221
|
new keystrokes_controller.KeystrokesController({
|
|
220
222
|
host: this,
|
|
221
223
|
target: document.body,
|
|
222
224
|
keys: [['shift', 'tab']],
|
|
223
|
-
callback: this.
|
|
224
|
-
containerSelectors: ['h-dropdown', 'h-dropdown-content']
|
|
225
|
+
callback: this._handleBackwardFocus
|
|
225
226
|
});
|
|
226
227
|
}
|
|
227
228
|
async connectedCallback() {
|
|
@@ -297,74 +298,6 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
|
|
|
297
298
|
(_b = this.$dropdownContent) === null || _b === void 0 ? void 0 : _b.classList.add(global_constants.SCROLLABLE_CLASS_NAME);
|
|
298
299
|
}
|
|
299
300
|
}
|
|
300
|
-
_handleFocusOnNextElementAfterDropdown(ev) {
|
|
301
|
-
ev.preventDefault();
|
|
302
|
-
this.hide();
|
|
303
|
-
utilities.UiDomUtils.getNextFocusableElement(this.$dropdownToggler || this).focus();
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
_handleFocusFromTogglerForwards(ev) {
|
|
307
|
-
if (!this.$dropdownContent)
|
|
308
|
-
return;
|
|
309
|
-
const trulyFocusableElements = this._getTrulyFocusableElements(this.$dropdownContent);
|
|
310
|
-
if (trulyFocusableElements.length === 0)
|
|
311
|
-
return;
|
|
312
|
-
ev.preventDefault();
|
|
313
|
-
trulyFocusableElements[0].focus();
|
|
314
|
-
}
|
|
315
|
-
_handleFocusFromSentinelEndForwards(ev, $target) {
|
|
316
|
-
var _a;
|
|
317
|
-
if (!this.$dropdownContent)
|
|
318
|
-
return;
|
|
319
|
-
const trulyFocusableElements = this._getTrulyFocusableElements(this.$dropdownContent);
|
|
320
|
-
const $lastFocusableElement = trulyFocusableElements.slice(-1)[0];
|
|
321
|
-
if ($target !== $lastFocusableElement)
|
|
322
|
-
return;
|
|
323
|
-
ev.preventDefault();
|
|
324
|
-
(_a = this.$dropdownToggler) === null || _a === void 0 ? void 0 : _a.focus();
|
|
325
|
-
}
|
|
326
|
-
_handleDefaultFocusFromDropdownBackwards(ev) {
|
|
327
|
-
ev.preventDefault();
|
|
328
|
-
this.hide();
|
|
329
|
-
utilities.UiDomUtils.getPreviousFocusableElement(this.$dropdownToggler || this).focus();
|
|
330
|
-
}
|
|
331
|
-
_handleFocusFromTogglerBackwards(ev, $target) {
|
|
332
|
-
var _a;
|
|
333
|
-
if ($target !== this.$dropdownToggler && !((_a = this.$dropdownToggler) === null || _a === void 0 ? void 0 : _a.contains($target)) || !this.$dropdownContent)
|
|
334
|
-
return;
|
|
335
|
-
ev.preventDefault();
|
|
336
|
-
const trulyFocusableElements = this._getTrulyFocusableElements(this.$dropdownContent);
|
|
337
|
-
if (trulyFocusableElements.length === 0)
|
|
338
|
-
return;
|
|
339
|
-
const $lastFocusableElement = trulyFocusableElements.slice(-1)[0];
|
|
340
|
-
$lastFocusableElement.focus();
|
|
341
|
-
}
|
|
342
|
-
_handleFocusFromSentinelStartBackwards(ev, $target) {
|
|
343
|
-
var _a;
|
|
344
|
-
if (!this.$dropdownContent)
|
|
345
|
-
return;
|
|
346
|
-
const $firstFocusableElement = this._getTrulyFocusableElements(this.$dropdownContent)[0];
|
|
347
|
-
if ($target !== $firstFocusableElement)
|
|
348
|
-
return;
|
|
349
|
-
ev.preventDefault();
|
|
350
|
-
(_a = this.$dropdownToggler) === null || _a === void 0 ? void 0 : _a.focus();
|
|
351
|
-
}
|
|
352
|
-
_getTrulyFocusableElements($container) {
|
|
353
|
-
const focusableElements = utilities.UiDomUtils.getFocusableElements($container);
|
|
354
|
-
return focusableElements.filter(($el) => this._isElementTrulyFocusable($el));
|
|
355
|
-
}
|
|
356
|
-
_isElementTrulyFocusable($el) {
|
|
357
|
-
const style = window.getComputedStyle($el);
|
|
358
|
-
if (style.display === 'none' || style.visibility === 'hidden') {
|
|
359
|
-
return false;
|
|
360
|
-
}
|
|
361
|
-
if ($el.nodeName === 'H-PORTAL')
|
|
362
|
-
return true;
|
|
363
|
-
const $parent = $el.parentElement;
|
|
364
|
-
if (!$parent)
|
|
365
|
-
return true;
|
|
366
|
-
return this._isElementTrulyFocusable($parent);
|
|
367
|
-
}
|
|
368
301
|
_isHoveredWithinDropdown(element) {
|
|
369
302
|
var _a;
|
|
370
303
|
if (element === this)
|
|
@@ -388,8 +321,6 @@ exports.HDropdown = HDropdown_1 = class HDropdown extends phoenix_light_lit_elem
|
|
|
388
321
|
return;
|
|
389
322
|
if (!this._hasScrollableClassInitially)
|
|
390
323
|
this._hasScrollableClassInitially = this.$dropdownContent.classList.contains(global_constants.SCROLLABLE_CLASS_NAME);
|
|
391
|
-
if (!this.preventFocusTrap)
|
|
392
|
-
this.$dropdownContent.setAttribute('aria-modal', 'true');
|
|
393
324
|
}
|
|
394
325
|
_getDropdownContentWidth() {
|
|
395
326
|
const isMobileResolution = document.documentElement.clientWidth < global_constants.BREAKPOINTS.xs;
|
|
@@ -458,14 +389,6 @@ tslib_es6.__decorate([
|
|
|
458
389
|
decorators_js.property({ type: String, attribute: 'mobile-position' }),
|
|
459
390
|
tslib_es6.__metadata("design:type", String)
|
|
460
391
|
], exports.HDropdown.prototype, "mobilePosition", void 0);
|
|
461
|
-
tslib_es6.__decorate([
|
|
462
|
-
decorators_js.property({ type: String, attribute: 'id', reflect: true }),
|
|
463
|
-
tslib_es6.__metadata("design:type", Object)
|
|
464
|
-
], exports.HDropdown.prototype, "id", void 0);
|
|
465
|
-
tslib_es6.__decorate([
|
|
466
|
-
decorators_js.property({ type: Boolean, attribute: 'prevent-focus-trap' }),
|
|
467
|
-
tslib_es6.__metadata("design:type", Object)
|
|
468
|
-
], exports.HDropdown.prototype, "preventFocusTrap", void 0);
|
|
469
392
|
exports.HDropdown = HDropdown_1 = tslib_es6.__decorate([
|
|
470
393
|
phoenix_custom_element.phoenixCustomElement('h-dropdown'),
|
|
471
394
|
tslib_es6.__metadata("design:paramtypes", [])
|
|
@@ -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
|
|
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,uBAAuB,4CAAgD;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var tslib_es6 = require('../../../../../external/tslib/tslib.es6.js');
|
|
6
|
+
var lit = require('lit');
|
|
6
7
|
var decorators = require('lit/decorators');
|
|
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 dropdown_constants = require('./dropdown_constants.js');
|
|
@@ -13,22 +13,19 @@ exports.HDropdownContent = class HDropdownContent extends phoenix_light_lit_elem
|
|
|
13
13
|
constructor() {
|
|
14
14
|
super();
|
|
15
15
|
this.name = '';
|
|
16
|
-
this._setupRole = () => {
|
|
17
|
-
const $focusableElements = utilities.UiDomUtils.getFocusableElements(this);
|
|
18
|
-
const role = $focusableElements.length < 2 ? 'dialog' : 'menu';
|
|
19
|
-
this.setAttribute('role', role);
|
|
20
|
-
if (role === 'menu') {
|
|
21
|
-
Array.from(this.children).forEach((element) => {
|
|
22
|
-
element.setAttribute('role', 'menuitem');
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
16
|
this.slot = this.hasAttribute('slot') ? this.slot : 'content';
|
|
27
17
|
}
|
|
28
18
|
connectedCallback() {
|
|
29
19
|
super.connectedCallback();
|
|
30
20
|
this.classList.add(dropdown_constants.DROPDOWN_CSS_CLASSES.content);
|
|
31
|
-
this.
|
|
21
|
+
this.setAttribute('role', 'menu');
|
|
22
|
+
Array.from(this.children).forEach((element) => {
|
|
23
|
+
element.setAttribute('role', 'menuitem');
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
render() {
|
|
27
|
+
super.render();
|
|
28
|
+
return lit.html ` <div role="dialog">${this.getSlot('content')}</div> `;
|
|
32
29
|
}
|
|
33
30
|
};
|
|
34
31
|
tslib_es6.__decorate([
|
|
@@ -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;
|
|
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;"}
|