@shoper/phoenix_design_system 1.15.3-26 → 1.15.3-28

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.
@@ -21,9 +21,7 @@ class ListBoxKeyboardController {
21
21
  this._handleArrowNavigation(ev);
22
22
  return;
23
23
  }
24
- if (ev.key.length === 1) {
25
- this._handleWriteableCharacter(ev);
26
- }
24
+ this._handleWriteableCharacter(ev);
27
25
  };
28
26
  this._handleArrowNavigation = (event) => {
29
27
  event.preventDefault();
@@ -31,11 +29,10 @@ class ListBoxKeyboardController {
31
29
  const $availableOptions = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").filter(($option) => {
32
30
  return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
33
31
  });
34
- const prevOptionIndex = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f");
32
+ const prevOptionIndex = this._findCurrentIndex();
35
33
  let newOptionIndex = key === 'ArrowDown' || key === 'ArrowRight' ? this._getNextOptionIndex() : this._getPrevOptionIndex();
36
34
  if (newOptionIndex === undefined) {
37
- const selectedOptionIndex = $availableOptions.findIndex(($option) => $option.selected);
38
- newOptionIndex = selectedOptionIndex !== -1 ? selectedOptionIndex : 0;
35
+ newOptionIndex = this._findCurrentIndex();
39
36
  }
40
37
  if (newOptionIndex === tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f"))
41
38
  return;
@@ -50,6 +47,13 @@ class ListBoxKeyboardController {
50
47
  $focusedOption.focus();
51
48
  }
52
49
  };
50
+ this._findCurrentIndex = () => {
51
+ const $availableOptions = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").filter(($option) => {
52
+ return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
53
+ });
54
+ const selectedOptionIndex = $availableOptions.findIndex(($option) => $option.selected);
55
+ return selectedOptionIndex !== -1 ? selectedOptionIndex : 0;
56
+ };
53
57
  this._handleWriteableCharacter = (ev) => {
54
58
  var _a;
55
59
  const $searchInput = (_a = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_host, "f").$search.value) === null || _a === void 0 ? void 0 : _a.querySelector('[role="search"]');
@@ -92,6 +96,8 @@ class ListBoxKeyboardController {
92
96
  const $availableOptions = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").filter(($option) => {
93
97
  return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
94
98
  });
99
+ if (!!$availableOptions[tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") - 1])
100
+ return tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") - 1;
95
101
  // bo ktoś wpisał coś w searcha i index obecnie wybranej opcji jest inny
96
102
  const newIndexOfCurrentlySelectedOption = $availableOptions.findIndex(($option) => $option.selected);
97
103
  if (newIndexOfCurrentlySelectedOption)
@@ -104,14 +110,15 @@ class ListBoxKeyboardController {
104
110
  const $availableOptions = tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").filter(($option) => {
105
111
  return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
106
112
  });
107
- // bo ktoś wpisał coś w searcha i index obecnie wybranej opcji jest inny
108
- const newIndexOfCurrentlySelectedOption = $availableOptions.findIndex(($option) => $option.selected);
109
- if (newIndexOfCurrentlySelectedOption)
110
- return newIndexOfCurrentlySelectedOption + 1;
111
113
  if (tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") === $availableOptions.length - 1)
112
114
  return tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f");
113
- if (tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") > $availableOptions.length - 1)
114
- return $availableOptions.length - 1;
115
+ if (tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") > $availableOptions.length - 1) {
116
+ // bo ktoś wpisał coś w searcha i index obecnie wybranej opcji jest inny
117
+ const newIndexOfCurrentlySelectedOption = $availableOptions.findIndex(($option) => $option.selected);
118
+ if (newIndexOfCurrentlySelectedOption)
119
+ return newIndexOfCurrentlySelectedOption + 1;
120
+ return 0;
121
+ }
115
122
  return tslib_es6.__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") + 1;
116
123
  }
117
124
  hostDisconnected() {
@@ -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;"}
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;"}
@@ -5,6 +5,7 @@ export declare class ListBoxKeyboardController implements IListboxController {
5
5
  hostConnected(): void;
6
6
  private _handleKeyboardNavigation;
7
7
  private _handleArrowNavigation;
8
+ private _findCurrentIndex;
8
9
  private _handleWriteableCharacter;
9
10
  calculateSelectedOptionIndex: () => void;
10
11
  private _getPrevOptionIndex;
@@ -17,9 +17,7 @@ class ListBoxKeyboardController {
17
17
  this._handleArrowNavigation(ev);
18
18
  return;
19
19
  }
20
- if (ev.key.length === 1) {
21
- this._handleWriteableCharacter(ev);
22
- }
20
+ this._handleWriteableCharacter(ev);
23
21
  };
24
22
  this._handleArrowNavigation = (event) => {
25
23
  event.preventDefault();
@@ -27,11 +25,10 @@ class ListBoxKeyboardController {
27
25
  const $availableOptions = __classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").filter(($option) => {
28
26
  return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
29
27
  });
30
- const prevOptionIndex = __classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f");
28
+ const prevOptionIndex = this._findCurrentIndex();
31
29
  let newOptionIndex = key === 'ArrowDown' || key === 'ArrowRight' ? this._getNextOptionIndex() : this._getPrevOptionIndex();
32
30
  if (newOptionIndex === undefined) {
33
- const selectedOptionIndex = $availableOptions.findIndex(($option) => $option.selected);
34
- newOptionIndex = selectedOptionIndex !== -1 ? selectedOptionIndex : 0;
31
+ newOptionIndex = this._findCurrentIndex();
35
32
  }
36
33
  if (newOptionIndex === __classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f"))
37
34
  return;
@@ -46,6 +43,13 @@ class ListBoxKeyboardController {
46
43
  $focusedOption.focus();
47
44
  }
48
45
  };
46
+ this._findCurrentIndex = () => {
47
+ const $availableOptions = __classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").filter(($option) => {
48
+ return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
49
+ });
50
+ const selectedOptionIndex = $availableOptions.findIndex(($option) => $option.selected);
51
+ return selectedOptionIndex !== -1 ? selectedOptionIndex : 0;
52
+ };
49
53
  this._handleWriteableCharacter = (ev) => {
50
54
  var _a;
51
55
  const $searchInput = (_a = __classPrivateFieldGet(this, _ListBoxKeyboardController_host, "f").$search.value) === null || _a === void 0 ? void 0 : _a.querySelector('[role="search"]');
@@ -88,6 +92,8 @@ class ListBoxKeyboardController {
88
92
  const $availableOptions = __classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").filter(($option) => {
89
93
  return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
90
94
  });
95
+ if (!!$availableOptions[__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") - 1])
96
+ return __classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") - 1;
91
97
  // bo ktoś wpisał coś w searcha i index obecnie wybranej opcji jest inny
92
98
  const newIndexOfCurrentlySelectedOption = $availableOptions.findIndex(($option) => $option.selected);
93
99
  if (newIndexOfCurrentlySelectedOption)
@@ -100,14 +106,15 @@ class ListBoxKeyboardController {
100
106
  const $availableOptions = __classPrivateFieldGet(this, _ListBoxKeyboardController__$options, "f").filter(($option) => {
101
107
  return !$option.getAttribute('inactive') && !$option.getAttribute('disabled') && !$option.hidden;
102
108
  });
103
- // bo ktoś wpisał coś w searcha i index obecnie wybranej opcji jest inny
104
- const newIndexOfCurrentlySelectedOption = $availableOptions.findIndex(($option) => $option.selected);
105
- if (newIndexOfCurrentlySelectedOption)
106
- return newIndexOfCurrentlySelectedOption + 1;
107
109
  if (__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") === $availableOptions.length - 1)
108
110
  return __classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f");
109
- if (__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") > $availableOptions.length - 1)
110
- return $availableOptions.length - 1;
111
+ if (__classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") > $availableOptions.length - 1) {
112
+ // bo ktoś wpisał coś w searcha i index obecnie wybranej opcji jest inny
113
+ const newIndexOfCurrentlySelectedOption = $availableOptions.findIndex(($option) => $option.selected);
114
+ if (newIndexOfCurrentlySelectedOption)
115
+ return newIndexOfCurrentlySelectedOption + 1;
116
+ return 0;
117
+ }
111
118
  return __classPrivateFieldGet(this, _ListBoxKeyboardController_currentOptionIndex, "f") + 1;
112
119
  }
113
120
  hostDisconnected() {
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,+DAA+D,4CAAgD;AAC/G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,+DAA+D,4CAAgD;AAC/G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@shoper/phoenix_design_system",
3
3
  "packageManager": "yarn@3.2.0",
4
4
  "sideEffects": false,
5
- "version": "1.15.3-26",
5
+ "version": "1.15.3-28",
6
6
  "description": "phoenix design system",
7
7
  "author": "zefirek",
8
8
  "license": "MIT",