@shoper/phoenix_design_system 1.15.11 → 1.15.13-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown.js +9 -2
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_toggler.js +23 -5
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_toggler.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/radio/radio_control.js +5 -0
- package/build/cjs/packages/phoenix/src/components/form/radio/radio_control.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/select/components/search/select_search.js +31 -0
- package/build/cjs/packages/phoenix/src/components/form/select/components/search/select_search.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/select/components/select_options.js +1 -2
- package/build/cjs/packages/phoenix/src/components/form/select/components/select_options.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller.js +98 -0
- package/build/cjs/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/form/select/select.js +78 -19
- package/build/cjs/packages/phoenix/src/components/form/select/select.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/modal/modal.js +3 -1
- package/build/cjs/packages/phoenix/src/components/modal/modal.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/slider/slider.js +39 -0
- package/build/cjs/packages/phoenix/src/components/slider/slider.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/slider/slider_constants.js +11 -0
- package/build/cjs/packages/phoenix/src/components/slider/slider_constants.js.map +1 -0
- package/build/cjs/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js +76 -30
- package/build/cjs/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown.d.ts +1 -0
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js +9 -2
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.d.ts +3 -0
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js +23 -5
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/radio/radio_control.d.ts +1 -0
- package/build/esm/packages/phoenix/src/components/form/radio/radio_control.js +5 -0
- package/build/esm/packages/phoenix/src/components/form/radio/radio_control.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/select/components/search/select_search.d.ts +4 -0
- package/build/esm/packages/phoenix/src/components/form/select/components/search/select_search.js +31 -0
- package/build/esm/packages/phoenix/src/components/form/select/components/search/select_search.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/select/components/select_options.js +1 -2
- package/build/esm/packages/phoenix/src/components/form/select/components/select_options.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller.d.ts +15 -0
- package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller.js +94 -0
- package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller_types.d.ts +8 -0
- package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller_types.js +3 -0
- package/build/esm/packages/phoenix/src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller_types.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/form/select/select.d.ts +14 -5
- package/build/esm/packages/phoenix/src/components/form/select/select.js +78 -19
- package/build/esm/packages/phoenix/src/components/form/select/select.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/modal/modal.js +3 -1
- package/build/esm/packages/phoenix/src/components/modal/modal.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/slider/slider.d.ts +5 -0
- package/build/esm/packages/phoenix/src/components/slider/slider.js +40 -1
- package/build/esm/packages/phoenix/src/components/slider/slider.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/slider/slider_constants.d.ts +4 -0
- package/build/esm/packages/phoenix/src/components/slider/slider_constants.js +7 -0
- package/build/esm/packages/phoenix/src/components/slider/slider_constants.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/slider/slider_types.d.ts +3 -0
- package/build/esm/packages/phoenix/src/components/slider/slider_types.js +2 -0
- package/build/esm/packages/phoenix/src/components/slider/slider_types.js.map +1 -1
- package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_controller_types.d.ts +6 -2
- package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_controller_types.js +1 -0
- package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_controller_types.js.map +1 -1
- package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.d.ts +8 -3
- package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js +76 -30
- package/build/esm/packages/phoenix/src/controllers/list_box_controller/list_box_keyboard_controller.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from '../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import 'lit';
|
|
3
|
+
import { UiDomUtils } from '@dreamcommerce/utilities';
|
|
4
|
+
|
|
5
|
+
var _SelectTogglerKeyboardController_host, _SelectTogglerKeyboardController__$toggler, _SelectTogglerKeyboardController_currentOptionIndex, _SelectTogglerKeyboardController__$options;
|
|
6
|
+
class SelectTogglerKeyboardController {
|
|
7
|
+
constructor({ host, $toggler, $list, listItemSelector = '[role="option"]', }) {
|
|
8
|
+
_SelectTogglerKeyboardController_host.set(this, void 0);
|
|
9
|
+
_SelectTogglerKeyboardController__$toggler.set(this, void 0);
|
|
10
|
+
_SelectTogglerKeyboardController_currentOptionIndex.set(this, void 0);
|
|
11
|
+
_SelectTogglerKeyboardController__$options.set(this, void 0);
|
|
12
|
+
this._handleKeyboardNavigation = (ev) => {
|
|
13
|
+
const arrowKeys = ['ArrowUp', 'ArrowDown'];
|
|
14
|
+
if (arrowKeys.includes(ev.key)) {
|
|
15
|
+
this._openSelect(ev);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (ev.key === 'Home') {
|
|
19
|
+
this._openSelectAndGoToFirstElement(ev);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (ev.key === 'End') {
|
|
23
|
+
this._openSelectAndGoToLastElement(ev);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (ev.altKey || ev.shiftKey)
|
|
27
|
+
return;
|
|
28
|
+
const isAWriteableCharacter = ev.key.length === 1;
|
|
29
|
+
if (isAWriteableCharacter)
|
|
30
|
+
this._openSelectAndGoToMatchedElement(ev);
|
|
31
|
+
};
|
|
32
|
+
this._openSelect = (event) => {
|
|
33
|
+
var _a;
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
(_a = __classPrivateFieldGet(this, _SelectTogglerKeyboardController_host, "f").$dropdown.value) === null || _a === void 0 ? void 0 : _a.show();
|
|
36
|
+
};
|
|
37
|
+
this._openSelectAndGoToFirstElement = async (event) => {
|
|
38
|
+
var _a;
|
|
39
|
+
event.preventDefault();
|
|
40
|
+
await ((_a = __classPrivateFieldGet(this, _SelectTogglerKeyboardController_host, "f").$dropdown.value) === null || _a === void 0 ? void 0 : _a.show());
|
|
41
|
+
const $firstOption = this._getAvailableOptions()[0];
|
|
42
|
+
if ($firstOption)
|
|
43
|
+
this._navigate($firstOption);
|
|
44
|
+
};
|
|
45
|
+
this._openSelectAndGoToLastElement = async (event) => {
|
|
46
|
+
var _a;
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
await ((_a = __classPrivateFieldGet(this, _SelectTogglerKeyboardController_host, "f").$dropdown.value) === null || _a === void 0 ? void 0 : _a.show());
|
|
49
|
+
const $availableOptions = this._getAvailableOptions();
|
|
50
|
+
const $lastOption = $availableOptions[$availableOptions.length - 1];
|
|
51
|
+
if ($lastOption)
|
|
52
|
+
this._navigate($lastOption);
|
|
53
|
+
};
|
|
54
|
+
this._openSelectAndGoToMatchedElement = async (event) => {
|
|
55
|
+
var _a;
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
await ((_a = __classPrivateFieldGet(this, _SelectTogglerKeyboardController_host, "f").$dropdown.value) === null || _a === void 0 ? void 0 : _a.show());
|
|
58
|
+
const $matchedOption = this._getAvailableOptions().find(($option) => { var _a; return (_a = $option.innerText) === null || _a === void 0 ? void 0 : _a.toLowerCase().startsWith(event.key.toLowerCase()); });
|
|
59
|
+
if ($matchedOption)
|
|
60
|
+
this._navigate($matchedOption);
|
|
61
|
+
};
|
|
62
|
+
this._getAvailableOptions = () => {
|
|
63
|
+
return __classPrivateFieldGet(this, _SelectTogglerKeyboardController__$options, "f").filter(($option) => {
|
|
64
|
+
return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
this._findSelectedIndex = () => {
|
|
68
|
+
const selectedOptionIndex = this._getAvailableOptions().findIndex(($option) => $option.selected);
|
|
69
|
+
return selectedOptionIndex !== -1 ? selectedOptionIndex : 0;
|
|
70
|
+
};
|
|
71
|
+
this._navigate = ($newOption) => {
|
|
72
|
+
const $selectedOption = __classPrivateFieldGet(this, _SelectTogglerKeyboardController__$options, "f")[this._findSelectedIndex()];
|
|
73
|
+
UiDomUtils.makeUnnavigable($selectedOption);
|
|
74
|
+
const newOptionIndex = this._getAvailableOptions().findIndex(($option) => $newOption.value === $option.value);
|
|
75
|
+
__classPrivateFieldGet(this, _SelectTogglerKeyboardController_host, "f").listBoxController.currentOptionIndex = newOptionIndex;
|
|
76
|
+
UiDomUtils.makeNavigable($newOption);
|
|
77
|
+
$newOption.focus();
|
|
78
|
+
};
|
|
79
|
+
__classPrivateFieldSet(this, _SelectTogglerKeyboardController_host, host, "f");
|
|
80
|
+
__classPrivateFieldSet(this, _SelectTogglerKeyboardController__$toggler, $toggler, "f");
|
|
81
|
+
__classPrivateFieldSet(this, _SelectTogglerKeyboardController__$options, Array.from($list.querySelectorAll(listItemSelector)), "f");
|
|
82
|
+
__classPrivateFieldGet(this, _SelectTogglerKeyboardController_host, "f").addController(this);
|
|
83
|
+
}
|
|
84
|
+
hostConnected() {
|
|
85
|
+
__classPrivateFieldGet(this, _SelectTogglerKeyboardController__$toggler, "f").addEventListener('keydown', this._handleKeyboardNavigation);
|
|
86
|
+
}
|
|
87
|
+
hostDisconnected() {
|
|
88
|
+
__classPrivateFieldGet(this, _SelectTogglerKeyboardController__$toggler, "f").removeEventListener('keydown', this._handleKeyboardNavigation);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
_SelectTogglerKeyboardController_host = new WeakMap(), _SelectTogglerKeyboardController__$toggler = new WeakMap(), _SelectTogglerKeyboardController_currentOptionIndex = new WeakMap(), _SelectTogglerKeyboardController__$options = new WeakMap();
|
|
92
|
+
|
|
93
|
+
export { SelectTogglerKeyboardController };
|
|
94
|
+
//# sourceMappingURL=select_toggler_keyboard_controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,+DAA+D,qDAAyD;AACxH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactiveControllerHost } from 'lit';
|
|
2
|
+
import { HSelect } from "../../select";
|
|
3
|
+
export declare type TSelectTogglerKeyboardControllerConstructorOptions = {
|
|
4
|
+
host: ReactiveControllerHost & HSelect;
|
|
5
|
+
$toggler: HTMLElement;
|
|
6
|
+
$list: HTMLElement;
|
|
7
|
+
listItemSelector?: string;
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select_toggler_keyboard_controller_types.js","sourceRoot":"","sources":["../../../../../../../../../../src/components/form/select/controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller_types.ts"],"names":[],"mappings":"AAAA,OAAuC,KAAK,CAAC;AAC7C,OAAwB,4CAA4C,CAAC"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { PropertyValues, TemplateResult } from 'lit';
|
|
2
|
+
import { HDropdown } from "../../dropdown/dropdown";
|
|
3
|
+
import { HDropdownToggler } from "../../dropdown/dropdown_toggler";
|
|
2
4
|
import { HOption } from "./components/option/select_option";
|
|
5
|
+
import { HSelectSearch } from "./components/search/select_search";
|
|
6
|
+
import { ListBoxKeyboardController } from "../../../controllers/list_box_controller/list_box_keyboard_controller";
|
|
3
7
|
import { PhoenixLightLitElement } from "../../../core/phoenix_light_lit_element/phoenix_light_lit_element";
|
|
4
8
|
import { SelectOption } from "./model/select_option";
|
|
5
9
|
import type { TSelectType } from "./select_types";
|
|
@@ -18,7 +22,8 @@ export declare class HSelect extends PhoenixLightLitElement {
|
|
|
18
22
|
required: boolean;
|
|
19
23
|
optionsList?: TSelectOption[];
|
|
20
24
|
noDeselect: boolean;
|
|
21
|
-
|
|
25
|
+
assistiveTitleId: string;
|
|
26
|
+
private _selectOptionsId;
|
|
22
27
|
get selectedIndex(): number;
|
|
23
28
|
set selectedIndex(index: number);
|
|
24
29
|
get selectedOptions(): (HOption | undefined)[];
|
|
@@ -28,15 +33,18 @@ export declare class HSelect extends PhoenixLightLitElement {
|
|
|
28
33
|
private _searchValue;
|
|
29
34
|
private _selectController;
|
|
30
35
|
private _$options;
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
$dropdown: import("lit-html/directives/ref.js").Ref<HDropdown>;
|
|
37
|
+
$search: import("lit-html/directives/ref.js").Ref<HSelectSearch>;
|
|
33
38
|
private _$optionsList;
|
|
34
39
|
private _$dropdownContent;
|
|
35
|
-
|
|
40
|
+
$dropdownToggler: import("lit-html/directives/ref.js").Ref<HDropdownToggler>;
|
|
36
41
|
private _selectContext;
|
|
37
|
-
|
|
42
|
+
listBoxController: ListBoxKeyboardController;
|
|
43
|
+
private _selectTogglerKeyboardController;
|
|
38
44
|
private _optionsObserver;
|
|
45
|
+
private _selectedOptionsAriaObserver;
|
|
39
46
|
private $placeholder;
|
|
47
|
+
private $searchLabel;
|
|
40
48
|
constructor();
|
|
41
49
|
updated(changedProperties: PropertyValues): void;
|
|
42
50
|
private _focusElementAfterSelectOpened;
|
|
@@ -47,6 +55,7 @@ export declare class HSelect extends PhoenixLightLitElement {
|
|
|
47
55
|
private _setupEvents;
|
|
48
56
|
private _handleOptionDeselect;
|
|
49
57
|
private _updateOptionsView;
|
|
58
|
+
private _updateLabelAria;
|
|
50
59
|
private _appendNewHTMLOption;
|
|
51
60
|
updateOptionAriaAttribute($option: HOption): void;
|
|
52
61
|
private _removeHTMLOptions;
|
|
@@ -14,6 +14,7 @@ import { observe } from '../../../directives/observable_directive.js';
|
|
|
14
14
|
import { HSelectToggler } from './components/toggler/select_toggler.js';
|
|
15
15
|
import { createRef, ref } from 'lit-html/directives/ref.js';
|
|
16
16
|
import { ContextProviderController } from '../../../core/context/context_provider_controller.js';
|
|
17
|
+
import v4 from '../../../../../../external/uuid/dist/esm-browser/v4.js';
|
|
17
18
|
import { HDropdownContent } from '../../dropdown/dropdown_content.js';
|
|
18
19
|
import { HDropdownToggler } from '../../dropdown/dropdown_toggler.js';
|
|
19
20
|
import { HDropdown } from '../../dropdown/dropdown.js';
|
|
@@ -25,6 +26,7 @@ import { SelectControlUtils } from './select_utils.js';
|
|
|
25
26
|
import { SelectController } from './controllers/select_controller.js';
|
|
26
27
|
import { SelectOptionMapper } from './model/select_option_mapper.js';
|
|
27
28
|
import { repeat } from 'lit/directives/repeat';
|
|
29
|
+
import { SelectTogglerKeyboardController } from './controllers/select_toggler_keyboard_controller/select_toggler_keyboard_controller.js';
|
|
28
30
|
|
|
29
31
|
let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
30
32
|
constructor() {
|
|
@@ -36,14 +38,15 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
|
36
38
|
this.searchDisabled = false;
|
|
37
39
|
this.type = SELECT_TYPES.select;
|
|
38
40
|
this.noDeselect = false;
|
|
39
|
-
this.
|
|
41
|
+
this.assistiveTitleId = '';
|
|
42
|
+
this._selectOptionsId = v4();
|
|
40
43
|
this._searchValue = '';
|
|
41
44
|
this._$options = new Map();
|
|
42
|
-
this
|
|
43
|
-
this
|
|
45
|
+
this.$dropdown = createRef();
|
|
46
|
+
this.$search = createRef();
|
|
44
47
|
this._$optionsList = createRef();
|
|
45
48
|
this._$dropdownContent = createRef();
|
|
46
|
-
this
|
|
49
|
+
this.$dropdownToggler = createRef();
|
|
47
50
|
this._selectContext = new ContextProviderController(this);
|
|
48
51
|
this._updateOptions = () => {
|
|
49
52
|
const $options = this._getOptions();
|
|
@@ -101,6 +104,18 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
|
101
104
|
this.updateOptionAriaAttribute($option);
|
|
102
105
|
});
|
|
103
106
|
};
|
|
107
|
+
this._updateLabelAria = (options) => {
|
|
108
|
+
var _a, _b;
|
|
109
|
+
if (!this.$searchLabel)
|
|
110
|
+
return;
|
|
111
|
+
(_a = this.$searchLabel.querySelector(`[id="value-label"]`)) === null || _a === void 0 ? void 0 : _a.remove();
|
|
112
|
+
this.$searchLabel.innerHTML = `
|
|
113
|
+
${(_b = this.$searchLabel) === null || _b === void 0 ? void 0 : _b.innerHTML}
|
|
114
|
+
<span id="value-label" class="sr-only">
|
|
115
|
+
${options.reduce((totalSelectedContent, currentOption) => (totalSelectedContent += currentOption.content), '')}
|
|
116
|
+
</span>
|
|
117
|
+
`;
|
|
118
|
+
};
|
|
104
119
|
this._handleOptionClicked = ({ detail }) => {
|
|
105
120
|
if (!(detail === null || detail === void 0 ? void 0 : detail.$option))
|
|
106
121
|
return;
|
|
@@ -116,10 +131,15 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
|
116
131
|
});
|
|
117
132
|
};
|
|
118
133
|
this._handleDropdownHidden = () => {
|
|
119
|
-
var _a;
|
|
134
|
+
var _a, _b, _c;
|
|
120
135
|
this._searchValue = '';
|
|
121
136
|
this.opened = false;
|
|
122
|
-
(_a = this
|
|
137
|
+
(_a = this.$dropdownToggler.value) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-activedescendant', '');
|
|
138
|
+
const isBodyActive = document.activeElement === document.body;
|
|
139
|
+
const isInnerElementActive = (_b = this._$dropdownContent.value) === null || _b === void 0 ? void 0 : _b.contains(document.activeElement);
|
|
140
|
+
if (isInnerElementActive || isBodyActive) {
|
|
141
|
+
(_c = this.$dropdownToggler.value) === null || _c === void 0 ? void 0 : _c.focus();
|
|
142
|
+
}
|
|
123
143
|
};
|
|
124
144
|
this._manageSelectFocusAria = (ev) => {
|
|
125
145
|
var _a;
|
|
@@ -128,14 +148,14 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
|
128
148
|
return;
|
|
129
149
|
const optionId = $target.id;
|
|
130
150
|
if (optionId) {
|
|
131
|
-
(_a = this
|
|
151
|
+
(_a = this.$dropdownToggler.value) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-activedescendant', optionId);
|
|
132
152
|
}
|
|
133
153
|
};
|
|
134
154
|
this._closeSelect = () => {
|
|
135
155
|
var _a;
|
|
136
156
|
if (!this.opened)
|
|
137
157
|
return;
|
|
138
|
-
(_a = this
|
|
158
|
+
(_a = this.$dropdown.value) === null || _a === void 0 ? void 0 : _a.hide();
|
|
139
159
|
};
|
|
140
160
|
this._clearOptions = () => {
|
|
141
161
|
this._selectController.deselectAll();
|
|
@@ -179,6 +199,7 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
|
179
199
|
return Array.from(this._$options.values());
|
|
180
200
|
}
|
|
181
201
|
updated(changedProperties) {
|
|
202
|
+
var _a, _b;
|
|
182
203
|
super.updated(changedProperties);
|
|
183
204
|
if (changedProperties.has('opened')) {
|
|
184
205
|
if (this.opened) {
|
|
@@ -192,28 +213,52 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
|
192
213
|
if (changedProperties.has('optionsList')) {
|
|
193
214
|
this._updateOptions();
|
|
194
215
|
}
|
|
195
|
-
if (this._$optionsList.value
|
|
196
|
-
this.
|
|
216
|
+
if (this._$optionsList.value) {
|
|
217
|
+
(_a = this.listBoxController) === null || _a === void 0 ? void 0 : _a.hostDisconnected();
|
|
218
|
+
this.listBoxController = new ListBoxKeyboardController({
|
|
197
219
|
host: this,
|
|
198
220
|
$list: this._$optionsList.value
|
|
199
221
|
});
|
|
222
|
+
}
|
|
223
|
+
if (this.listBoxController) {
|
|
224
|
+
this.listBoxController.calculateSelectedOptionIndex();
|
|
225
|
+
}
|
|
226
|
+
if (this._$optionsList.value && this.$dropdownToggler.value) {
|
|
227
|
+
(_b = this._selectTogglerKeyboardController) === null || _b === void 0 ? void 0 : _b.hostDisconnected();
|
|
228
|
+
this._selectTogglerKeyboardController = new SelectTogglerKeyboardController({
|
|
229
|
+
host: this,
|
|
230
|
+
$toggler: this.$dropdownToggler.value,
|
|
231
|
+
$list: this._$optionsList.value
|
|
232
|
+
});
|
|
233
|
+
}
|
|
200
234
|
}
|
|
201
235
|
_focusElementAfterSelectOpened() {
|
|
202
|
-
var _a
|
|
203
|
-
const $searchInput = (_a = this
|
|
204
|
-
$
|
|
236
|
+
var _a;
|
|
237
|
+
const $searchInput = (_a = this.$search.value) === null || _a === void 0 ? void 0 : _a.querySelector('[role="search"]');
|
|
238
|
+
const $options = this._$optionsList.value ? [...this._$optionsList.value.querySelectorAll('h-option')] : [];
|
|
239
|
+
const $firstOption = $options.find(($option) => {
|
|
240
|
+
return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.getAttribute('hidden');
|
|
241
|
+
});
|
|
242
|
+
const $selectedOption = this.selectedOptions[0];
|
|
243
|
+
const $optionToFocus = $selectedOption || $firstOption;
|
|
244
|
+
$searchInput ? $searchInput.focus() : $optionToFocus === null || $optionToFocus === void 0 ? void 0 : $optionToFocus.focus();
|
|
205
245
|
}
|
|
206
246
|
connectedCallback() {
|
|
247
|
+
var _a;
|
|
207
248
|
super.connectedCallback();
|
|
208
249
|
this.classList.add(SELECT_CSS_CLASSES.select);
|
|
209
250
|
if (!this.searchDisabled) {
|
|
210
251
|
this.classList.add(SELECT_CSS_CLASSES.selectWithSearch);
|
|
211
252
|
}
|
|
253
|
+
this.$searchLabel = document.querySelector(`[id="${this.assistiveTitleId}"]`);
|
|
254
|
+
(_a = this.$searchLabel) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-hidden', 'true');
|
|
212
255
|
this._selectController = this.multiple ? new MultiSelectController({ host: this }) : new SelectController({ host: this });
|
|
213
256
|
this._selectContext.provide(SELECT_CONTEXTS.selectedOptions$, this._selectController.selectedOptions$);
|
|
214
257
|
this._selectContext.provide(SELECT_CONTEXTS.isMultiselect, this.multiple);
|
|
215
258
|
this._optionsObserver = new Observer((selectedOptions) => this._updateOptionsView(selectedOptions));
|
|
216
259
|
this._selectController.options$.subscribe(this._optionsObserver);
|
|
260
|
+
this._selectedOptionsAriaObserver = new Observer((selectedOptions) => this._updateLabelAria(selectedOptions));
|
|
261
|
+
this._selectController.selectedOptions$.subscribe(this._selectedOptionsAriaObserver);
|
|
217
262
|
this._updateOptions();
|
|
218
263
|
this._setupEvents();
|
|
219
264
|
}
|
|
@@ -243,6 +288,10 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
|
243
288
|
SelectControlUtils.appendHTMLOption($option, $list, position);
|
|
244
289
|
}
|
|
245
290
|
updateOptionAriaAttribute($option) {
|
|
291
|
+
if (!this.multiple) {
|
|
292
|
+
const $options = this._$optionsList.value ? [...this._$optionsList.value.querySelectorAll('h-option')] : [];
|
|
293
|
+
$options.forEach(($option) => ($option.removeAttribute('aria-selected')));
|
|
294
|
+
}
|
|
246
295
|
$option.setAttribute(this.multiple ? 'aria-checked' : 'aria-selected', String($option.selected));
|
|
247
296
|
}
|
|
248
297
|
_removeHTMLOptions(optionsValues) {
|
|
@@ -252,6 +301,12 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
|
252
301
|
const option = this._selectController.getOption(value);
|
|
253
302
|
if (!option)
|
|
254
303
|
return;
|
|
304
|
+
const $selectedOption = this._$options.get(option.value);
|
|
305
|
+
const $selectedOptionLink = $selectedOption === null || $selectedOption === void 0 ? void 0 : $selectedOption.querySelector('a');
|
|
306
|
+
if ($selectedOptionLink) {
|
|
307
|
+
$selectedOptionLink.click();
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
255
310
|
this.noDeselect ? this._selectController.select(option) : this._selectController.toggle(option);
|
|
256
311
|
if (!this.multiple)
|
|
257
312
|
this._closeSelect();
|
|
@@ -302,23 +357,25 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
|
302
357
|
const isSearchEnabled = !this.searchDisabled && options.length > MIN_NUMBER_OF_OPTIONS_TO_SHOW_SEARCH;
|
|
303
358
|
return html `
|
|
304
359
|
<h-dropdown
|
|
305
|
-
${ref(this
|
|
360
|
+
${ref(this.$dropdown)}
|
|
306
361
|
@showed=${() => (this.opened = true)}
|
|
307
362
|
@hidden=${this._handleDropdownHidden}
|
|
308
363
|
name="${this.controlName}"
|
|
309
364
|
offset=${this.offset}
|
|
310
365
|
content-width="full"
|
|
311
366
|
prevent-focus-trap
|
|
367
|
+
no-autofocus
|
|
312
368
|
>
|
|
313
369
|
<h-dropdown-toggler
|
|
314
|
-
${ref(this
|
|
370
|
+
${ref(this.$dropdownToggler)}
|
|
315
371
|
name="${this.controlName}"
|
|
316
372
|
validation-container
|
|
317
373
|
aria-haspopup="listbox"
|
|
318
374
|
role="combobox"
|
|
319
375
|
aria-required="${this.required ? 'true' : 'false'}"
|
|
320
376
|
aria-activedescendant
|
|
321
|
-
|
|
377
|
+
role="combobox"
|
|
378
|
+
aria-controls="${this._selectOptionsId}"
|
|
322
379
|
>
|
|
323
380
|
${this.getSlot(SELECT_SLOT_NAMES.toggler)}
|
|
324
381
|
</h-dropdown-toggler>
|
|
@@ -336,7 +393,7 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
|
336
393
|
${isSearchEnabled
|
|
337
394
|
? html ` <h-select-search
|
|
338
395
|
class=${SELECT_CSS_CLASSES.selectSearch}
|
|
339
|
-
${ref(this
|
|
396
|
+
${ref(this.$search)}
|
|
340
397
|
.value=${this._searchValue}
|
|
341
398
|
@search=${this._handleSearch}
|
|
342
399
|
></h-select-search>`
|
|
@@ -344,6 +401,8 @@ let HSelect = class HSelect extends PhoenixLightLitElement {
|
|
|
344
401
|
|
|
345
402
|
<h-options
|
|
346
403
|
class="${SELECT_CSS_CLASSES.selectOptions} ${this._searchNoResult() ? SELECT_CSS_CLASSES.selectOptionsEmpty : ''}"
|
|
404
|
+
aria-labelledby="${this.assistiveTitleId}"
|
|
405
|
+
id="${this._selectOptionsId}"
|
|
347
406
|
${ref(this._$optionsList)}
|
|
348
407
|
@optionClicked=${this._handleOptionClicked}
|
|
349
408
|
@optionUpdated=${this._handleOptionUpdated}
|
|
@@ -435,9 +494,9 @@ __decorate([
|
|
|
435
494
|
__metadata("design:type", Boolean)
|
|
436
495
|
], HSelect.prototype, "noDeselect", void 0);
|
|
437
496
|
__decorate([
|
|
438
|
-
property({ type: String, attribute: '
|
|
497
|
+
property({ type: String, attribute: 'assistive-title-id' }),
|
|
439
498
|
__metadata("design:type", String)
|
|
440
|
-
], HSelect.prototype, "
|
|
499
|
+
], HSelect.prototype, "assistiveTitleId", void 0);
|
|
441
500
|
__decorate([
|
|
442
501
|
state(),
|
|
443
502
|
__metadata("design:type", String)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,eAAe,wDAA4D;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -112,7 +112,9 @@ let HModal = HModal_1 = class HModal extends PhoenixLightLitElement {
|
|
|
112
112
|
};
|
|
113
113
|
this._addInertToBodyChildrenElements = () => {
|
|
114
114
|
[...document.body.children].forEach((child) => {
|
|
115
|
-
|
|
115
|
+
const isPortalTarget = child.tagName === PORTAL_TARGET_COMPONENT_NAME.toUpperCase();
|
|
116
|
+
const isAriaLiveContainer = child.hasAttribute('aria-live');
|
|
117
|
+
if (!isPortalTarget && !isAriaLiveContainer) {
|
|
116
118
|
child.setAttribute('inert', '');
|
|
117
119
|
}
|
|
118
120
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,4CAAgD;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -7,6 +7,11 @@ export declare class HSlider extends PhoenixLightLitElement {
|
|
|
7
7
|
set sliderSettings(newSettingsObject: ISliderOptions);
|
|
8
8
|
private _settings;
|
|
9
9
|
private _slider;
|
|
10
|
+
private _$focusableElements;
|
|
10
11
|
connectedCallback(): void;
|
|
12
|
+
private _showFocusableNodes;
|
|
13
|
+
private _hideFocusableNodes;
|
|
14
|
+
private _handleFocusableNodes;
|
|
11
15
|
getSlider(): ISlider | null;
|
|
16
|
+
disconnectedCallback(): void;
|
|
12
17
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { __decorate, __metadata } from '../../../../../external/tslib/tslib.es6.js';
|
|
2
2
|
import { property } from 'lit/decorators';
|
|
3
|
-
import { JsonUtils } from '@dreamcommerce/utilities';
|
|
3
|
+
import { JsonUtils, UiDomUtils } 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
6
|
import { Splide } from '../../../../../external/@splidejs/splide/dist/js/splide.esm.js';
|
|
7
|
+
import { SLIDER_HANDLE_FOCUSABLE_NODES_OPTIONS } from './slider_constants.js';
|
|
7
8
|
|
|
8
9
|
let HSlider = class HSlider extends PhoenixLightLitElement {
|
|
9
10
|
constructor() {
|
|
@@ -17,6 +18,20 @@ let HSlider = class HSlider extends PhoenixLightLitElement {
|
|
|
17
18
|
focus: 'center'
|
|
18
19
|
};
|
|
19
20
|
this._slider = null;
|
|
21
|
+
this._$focusableElements = [];
|
|
22
|
+
this._showFocusableNodes = (slideComponent) => {
|
|
23
|
+
this._handleFocusableNodes(slideComponent, SLIDER_HANDLE_FOCUSABLE_NODES_OPTIONS.show);
|
|
24
|
+
};
|
|
25
|
+
this._hideFocusableNodes = (slideComponent) => {
|
|
26
|
+
this._handleFocusableNodes(slideComponent, SLIDER_HANDLE_FOCUSABLE_NODES_OPTIONS.hide);
|
|
27
|
+
};
|
|
28
|
+
this._handleFocusableNodes = ({ slide }, action) => {
|
|
29
|
+
const $focusableSlideChildren = this._$focusableElements.filter(($focusableElement) => slide.contains($focusableElement));
|
|
30
|
+
if ($focusableSlideChildren.length === 0)
|
|
31
|
+
return;
|
|
32
|
+
const newTabindex = action === SLIDER_HANDLE_FOCUSABLE_NODES_OPTIONS.show ? '0' : '-1';
|
|
33
|
+
$focusableSlideChildren.forEach(($element) => $element.setAttribute('tabindex', newTabindex));
|
|
34
|
+
};
|
|
20
35
|
}
|
|
21
36
|
get sliderSettings() {
|
|
22
37
|
return this._settings;
|
|
@@ -36,10 +51,34 @@ let HSlider = class HSlider extends PhoenixLightLitElement {
|
|
|
36
51
|
if (this._settings.mountOnConnectedCallback) {
|
|
37
52
|
this._slider.mount();
|
|
38
53
|
}
|
|
54
|
+
this._slider.on('visible', this._showFocusableNodes);
|
|
55
|
+
this._slider.on('hidden', this._hideFocusableNodes);
|
|
56
|
+
const mutationObserver = new MutationObserver((mutationList) => {
|
|
57
|
+
for (const mutation of mutationList) {
|
|
58
|
+
if (mutation.type !== "childList")
|
|
59
|
+
return;
|
|
60
|
+
const $target = mutation.target;
|
|
61
|
+
const isFocusable = UiDomUtils.isFocusable($target);
|
|
62
|
+
const hasBeenEncountered = this._$focusableElements.some(($focusableElement) => $focusableElement === $target);
|
|
63
|
+
if (!isFocusable || hasBeenEncountered)
|
|
64
|
+
return;
|
|
65
|
+
this._$focusableElements.push($target);
|
|
66
|
+
if ($target.closest('[aria-hidden="true"]')) {
|
|
67
|
+
$target.setAttribute('tabindex', '-1');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
mutationObserver.observe(this, { attributes: true, childList: true, subtree: true });
|
|
39
72
|
}
|
|
40
73
|
getSlider() {
|
|
41
74
|
return this._slider;
|
|
42
75
|
}
|
|
76
|
+
disconnectedCallback() {
|
|
77
|
+
var _a, _b;
|
|
78
|
+
super.disconnectedCallback();
|
|
79
|
+
(_a = this._slider) === null || _a === void 0 ? void 0 : _a.off('visible');
|
|
80
|
+
(_b = this._slider) === null || _b === void 0 ? void 0 : _b.off('hidden');
|
|
81
|
+
}
|
|
43
82
|
};
|
|
44
83
|
__decorate([
|
|
45
84
|
property({ reflect: true }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;AACA;AACA;AACA;AACA,uBAAuB,gEAAoE;AAC3F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,4CAAgD;AACvF;AACA;AACA;AACA;AACA,uBAAuB,gEAAoE;AAC3F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Options, Splide } from '@splidejs/splide';
|
|
2
|
+
import { SLIDER_HANDLE_FOCUSABLE_NODES_OPTIONS } from './slider_constants';
|
|
3
|
+
import { Any } from 'ts-toolbelt';
|
|
2
4
|
export interface ISlider extends Splide {
|
|
3
5
|
}
|
|
4
6
|
export interface ISliderOptions extends Options {
|
|
5
7
|
mountOnConnectedCallback: boolean;
|
|
6
8
|
}
|
|
9
|
+
export declare type THandleNodesOption = typeof SLIDER_HANDLE_FOCUSABLE_NODES_OPTIONS[Any.Keys<typeof SLIDER_HANDLE_FOCUSABLE_NODES_OPTIONS>];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slider_types.js","sourceRoot":"","sources":["../../../../../../../src/components/slider/slider_types.ts"],"names":[],"mappings":"AAAA,OAAgC,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"slider_types.js","sourceRoot":"","sources":["../../../../../../../src/components/slider/slider_types.ts"],"names":[],"mappings":"AAAA,OAAgC,kBAAkB,CAAC;AACnD,OAAsD,oBAAoB,CAAC;AAC3E,OAAoB,aAAa,CAAC"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { Any } from 'ts-toolbelt';
|
|
2
|
-
import { ReactiveControllerHost } from 'lit';
|
|
2
|
+
import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
3
3
|
import { LIST_BOX_KEYBOARD_NAVIGATION_DIRECTIONS } from "./list_box_controller_constants";
|
|
4
|
+
import { HSelect } from "../../components/form/select/select";
|
|
4
5
|
export declare type TListBoxKeyboardNavigationDirection = Any.Keys<typeof LIST_BOX_KEYBOARD_NAVIGATION_DIRECTIONS>;
|
|
5
6
|
export declare type TListBoxKeyboardControllerConstructorOptions = {
|
|
6
|
-
host: ReactiveControllerHost &
|
|
7
|
+
host: ReactiveControllerHost & HSelect;
|
|
7
8
|
$list: HTMLElement;
|
|
8
9
|
listItemSelector?: string;
|
|
9
10
|
orientation?: TListBoxKeyboardNavigationDirection;
|
|
10
11
|
};
|
|
12
|
+
export interface IListboxController extends ReactiveController {
|
|
13
|
+
calculateSelectedOptionIndex(): void;
|
|
14
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list_box_controller_types.js","sourceRoot":"","sources":["../../../../../../../src/controllers/list_box_controller/list_box_controller_types.ts"],"names":[],"mappings":"AAAA,OAAoB,aAAa,CAAC;AAClC,
|
|
1
|
+
{"version":3,"file":"list_box_controller_types.js","sourceRoot":"","sources":["../../../../../../../src/controllers/list_box_controller/list_box_controller_types.ts"],"names":[],"mappings":"AAAA,OAAoB,aAAa,CAAC;AAClC,OAA2D,KAAK,CAAC;AACjE,OAAwD,4EAA4E,CAAC;AACrI,OAAwB,4CAA4C,CAAC"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare class ListBoxKeyboardController implements ReactiveController {
|
|
1
|
+
import { IListboxController, TListBoxKeyboardControllerConstructorOptions } from "./list_box_controller_types";
|
|
2
|
+
export declare class ListBoxKeyboardController implements IListboxController {
|
|
4
3
|
#private;
|
|
4
|
+
currentOptionIndex: number | undefined;
|
|
5
5
|
constructor({ host, $list, listItemSelector, orientation }: TListBoxKeyboardControllerConstructorOptions);
|
|
6
6
|
hostConnected(): void;
|
|
7
|
+
private _handleKeyboardNavigation;
|
|
7
8
|
private _handleArrowNavigation;
|
|
9
|
+
private _findCurrentIndex;
|
|
10
|
+
private _handleWriteableCharacter;
|
|
11
|
+
calculateSelectedOptionIndex: () => void;
|
|
8
12
|
private _getPrevOptionIndex;
|
|
9
13
|
private _getNextOptionIndex;
|
|
14
|
+
hostDisconnected(): void;
|
|
10
15
|
}
|