@shoper/phoenix_design_system 1.17.6-0 → 1.17.6-1

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.
Files changed (38) hide show
  1. package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches.js +13 -27
  2. package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches.js.map +1 -1
  3. package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches_constants.js +3 -1
  4. package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches_constants.js.map +1 -1
  5. package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_toggler.js +1 -1
  6. package/build/cjs/packages/phoenix/src/components/toggle/toggle_button.js +14 -7
  7. package/build/cjs/packages/phoenix/src/components/toggle/toggle_button.js.map +1 -1
  8. package/build/cjs/packages/phoenix/src/index.js +0 -14
  9. package/build/cjs/packages/phoenix/src/index.js.map +1 -1
  10. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.d.ts +1 -2
  11. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.js +14 -28
  12. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.js.map +1 -1
  13. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.d.ts +1 -0
  14. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.js +3 -2
  15. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.js.map +1 -1
  16. package/build/esm/packages/phoenix/src/components/dropdown/dropdown_toggler.js +1 -1
  17. package/build/esm/packages/phoenix/src/components/toggle/toggle_button.d.ts +1 -0
  18. package/build/esm/packages/phoenix/src/components/toggle/toggle_button.js +14 -7
  19. package/build/esm/packages/phoenix/src/components/toggle/toggle_button.js.map +1 -1
  20. package/build/esm/packages/phoenix/src/index.d.ts +0 -2
  21. package/build/esm/packages/phoenix/src/index.js +0 -2
  22. package/build/esm/packages/phoenix/src/index.js.map +1 -1
  23. package/package.json +4 -4
  24. package/build/cjs/packages/phoenix/src/components/show-more/show_more.js +0 -117
  25. package/build/cjs/packages/phoenix/src/components/show-more/show_more.js.map +0 -1
  26. package/build/cjs/packages/phoenix/src/components/show-more/show_more_button.js +0 -29
  27. package/build/cjs/packages/phoenix/src/components/show-more/show_more_button.js.map +0 -1
  28. package/build/cjs/packages/phoenix/src/components/show-more/show_more_constants.js +0 -17
  29. package/build/cjs/packages/phoenix/src/components/show-more/show_more_constants.js.map +0 -1
  30. package/build/esm/packages/phoenix/src/components/show-more/show_more.d.ts +0 -21
  31. package/build/esm/packages/phoenix/src/components/show-more/show_more.js +0 -115
  32. package/build/esm/packages/phoenix/src/components/show-more/show_more.js.map +0 -1
  33. package/build/esm/packages/phoenix/src/components/show-more/show_more_button.d.ts +0 -7
  34. package/build/esm/packages/phoenix/src/components/show-more/show_more_button.js +0 -27
  35. package/build/esm/packages/phoenix/src/components/show-more/show_more_button.js.map +0 -1
  36. package/build/esm/packages/phoenix/src/components/show-more/show_more_constants.d.ts +0 -8
  37. package/build/esm/packages/phoenix/src/components/show-more/show_more_constants.js +0 -11
  38. package/build/esm/packages/phoenix/src/components/show-more/show_more_constants.js.map +0 -1
@@ -12,13 +12,11 @@ var keystrokes_controller = require('../../controllers/keystrokes_controller/key
12
12
  require('lit-html');
13
13
  var color_swatches_constants = require('./color_swatches_constants.js');
14
14
  var color_item_constants = require('./color_item/color_item_constants.js');
15
- var color_item = require('./color_item/color_item.js');
16
15
 
17
16
  exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.PhoenixLightLitElement {
18
17
  constructor() {
19
18
  super(...arguments);
20
19
  this.multiple = false;
21
- this.devVisualSubcategories = false;
22
20
  this.selectedColors = [];
23
21
  this.showMoreBtnText = 'Pokaż wszystkie kolory';
24
22
  this._setupEvents = () => {
@@ -142,10 +140,8 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
142
140
  this._$colorSwatchesChildren = [...this.children];
143
141
  this._setupEvents();
144
142
  this._addCssClasses();
145
- if (!this.devVisualSubcategories) {
146
- this.numberOfVisibleColors && this._hideItems(this.numberOfVisibleColors);
147
- this._showAllItemsEvent();
148
- }
143
+ this.numberOfVisibleColors && this._hideItems(this.numberOfVisibleColors);
144
+ this._showAllItemsEvent();
149
145
  this.selectedColors = [...this.querySelectorAll('h-color-item[selected]')];
150
146
  this._$colors = [...this.querySelectorAll('h-color-item')];
151
147
  }
@@ -158,7 +154,7 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
158
154
  return;
159
155
  this._$colorSwatchesChildren.forEach(($colorSwatchesChild, index) => {
160
156
  if (index > numberOfVisibleColors - 1) {
161
- $colorSwatchesChild.setAttribute('hidden', '');
157
+ $colorSwatchesChild.setAttribute(color_swatches_constants.COLOR_SWATCHES_HIDDEN_ATTRIBUTE, '');
162
158
  }
163
159
  });
164
160
  }
@@ -168,9 +164,9 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
168
164
  if (!this._$colorSwatchesChildren)
169
165
  return;
170
166
  this._$colorSwatchesChildren.forEach(($colorSwatchesChild) => {
171
- $colorSwatchesChild.removeAttribute('hidden');
167
+ $colorSwatchesChild.removeAttribute(color_swatches_constants.COLOR_SWATCHES_HIDDEN_ATTRIBUTE);
172
168
  });
173
- (_a = this.querySelector('h-color-swatches-show-more')) === null || _a === void 0 ? void 0 : _a.setAttribute('hidden', '');
169
+ (_a = this.querySelector('h-color-swatches-show-more')) === null || _a === void 0 ? void 0 : _a.setAttribute(color_swatches_constants.COLOR_SWATCHES_HIDDEN_ATTRIBUTE, '');
174
170
  });
175
171
  }
176
172
  _handleChangeToNextColorItem({ target }) {
@@ -184,9 +180,7 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
184
180
  $nextColorItem = $nextFocusableElement;
185
181
  }
186
182
  $nextColorItem.focus();
187
- if ($nextColorItem instanceof color_item.HColorItem) {
188
- this._handleColorChange($nextColorItem);
189
- }
183
+ this._handleColorChange($nextColorItem);
190
184
  }
191
185
  _handleChangeToPreviousColorItem({ target }) {
192
186
  const $colorItem = target;
@@ -199,9 +193,7 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
199
193
  $previousColorItem = $previousFocusableElement;
200
194
  }
201
195
  $previousColorItem.focus();
202
- if ($previousColorItem instanceof color_item.HColorItem) {
203
- this._handleColorChange($previousColorItem);
204
- }
196
+ this._handleColorChange($previousColorItem);
205
197
  }
206
198
  _toggleColorItem($colorItem) {
207
199
  this.multiple ? this._handleColorClickedForMultipleMode($colorItem) : this._handleColorChangeForSingleMode($colorItem);
@@ -239,24 +231,18 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
239
231
  document.body.removeEventListener('keydown', this._focusOnSelectedColor);
240
232
  }
241
233
  render() {
242
- if (!this.devVisualSubcategories) {
243
- return lit.html `
244
- ${this.getSlot('default')}
245
- ${this._$colors.length > this.numberOfVisibleColors
246
- ? lit.html `<h-color-swatches-show-more>${this.showMoreBtnText}</h-color-swatches-show-more>`
247
- : lit.nothing}
248
- `;
249
- }
234
+ return lit.html `
235
+ ${this.getSlot('default')}
236
+ ${this._$colors.length > this.numberOfVisibleColors
237
+ ? lit.html `<h-color-swatches-show-more>${this.showMoreBtnText}</h-color-swatches-show-more>`
238
+ : lit.nothing}
239
+ `;
250
240
  }
251
241
  };
252
242
  tslib_es6.__decorate([
253
243
  decorators.property({ type: Boolean }),
254
244
  tslib_es6.__metadata("design:type", Boolean)
255
245
  ], exports.HColorSwatches.prototype, "multiple", void 0);
256
- tslib_es6.__decorate([
257
- decorators.property({ type: Boolean, attribute: 'dev-visual-subcategories' }),
258
- tslib_es6.__metadata("design:type", Boolean)
259
- ], exports.HColorSwatches.prototype, "devVisualSubcategories", void 0);
260
246
  tslib_es6.__decorate([
261
247
  decorators.property({ type: Number, attribute: 'number-of-visible-colors' }),
262
248
  tslib_es6.__metadata("design:type", Number)
@@ -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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -12,9 +12,11 @@ const COLOR_SWATCHES_EVENT_NAMES = {
12
12
  change: 'change',
13
13
  markDisabledItems: 'markDisabledItems',
14
14
  showMore: 'showMore'
15
- };
15
+ };
16
+ const COLOR_SWATCHES_HIDDEN_ATTRIBUTE = 'hidden';
16
17
 
17
18
  exports.COLOR_ITEM_TAG_NAME = COLOR_ITEM_TAG_NAME;
18
19
  exports.COLOR_SWATCHES_CSS_CLASSES = COLOR_SWATCHES_CSS_CLASSES;
19
20
  exports.COLOR_SWATCHES_EVENT_NAMES = COLOR_SWATCHES_EVENT_NAMES;
21
+ exports.COLOR_SWATCHES_HIDDEN_ATTRIBUTE = COLOR_SWATCHES_HIDDEN_ATTRIBUTE;
20
22
  //# sourceMappingURL=color_swatches_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;"}
@@ -15,7 +15,7 @@ exports.HDropdownToggler = class HDropdownToggler extends phoenix_light_lit_elem
15
15
  constructor() {
16
16
  super();
17
17
  this.name = '';
18
- this.ariaHasPopup = 'menu';
18
+ this.ariaHasPopup = 'dialog';
19
19
  this.ariaControls = '';
20
20
  this.role = 'button';
21
21
  this._setupTogglerAria = () => {
@@ -16,17 +16,22 @@ exports.HToggleBtn = class HToggleBtn extends phoenix_light_lit_element.PhoenixL
16
16
  constructor() {
17
17
  super();
18
18
  this.action = toggle_constants.TOGGLE_ACTIONS.collapse;
19
- this._visibility = {
20
- collapse: (isOpened) => {
21
- isOpened ? this._visibilityController.show() : this._visibilityController.hide();
22
- },
23
- expand: (isOpened) => {
24
- isOpened ? this._visibilityController.hide() : this._visibilityController.show();
19
+ this._handleVisibilityChange = (isOpened) => {
20
+ var _a;
21
+ const shouldFocus = this === document.activeElement;
22
+ isOpened ? this._visibilityController.hide() : this._visibilityController.show();
23
+ if (shouldFocus) {
24
+ const $collapseToggleBtn = (_a = this.parentElement) === null || _a === void 0 ? void 0 : _a.querySelector(`[action="${toggle_constants.TOGGLE_ACTIONS.collapse}"]`);
25
+ $collapseToggleBtn === null || $collapseToggleBtn === void 0 ? void 0 : $collapseToggleBtn.focus();
25
26
  }
26
27
  };
27
28
  this._dispatchToggleEvent = () => {
28
29
  this.emitCustomEvent(toggle_constants.TOGGLE_BUTTON_EVENTS.toggle);
29
30
  };
31
+ this._visibility = {
32
+ collapse: this._handleVisibilityChange,
33
+ expand: this._handleVisibilityChange
34
+ };
30
35
  this._btnController = new btn_controller.BtnController(this, this._dispatchToggleEvent);
31
36
  this._visibilityController = new visibility_controller.VisibilityController(this);
32
37
  }
@@ -38,10 +43,12 @@ exports.HToggleBtn = class HToggleBtn extends phoenix_light_lit_element.PhoenixL
38
43
  this._visibility[this.action](isOpened);
39
44
  });
40
45
  this._opened$.subscribe(this._openedObserver);
46
+ this.setAttribute('aria-expanded', this.action === toggle_constants.TOGGLE_ACTIONS.collapse ? 'true' : 'false');
41
47
  this.addEventListener('click', this._dispatchToggleEvent);
42
48
  }
43
49
  disconnectedCallback() {
44
- this._opened$.unsubscribe(this._openedObserver);
50
+ super.disconnectedCallback();
51
+ this._openedObserver && this._opened$.unsubscribe(this._openedObserver);
45
52
  }
46
53
  };
47
54
  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;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;"}
@@ -83,7 +83,6 @@ var toggle_button = require('./components/groups/toggle_button_group/toggle_butt
83
83
  var click_outside_controller_messages = require('./controllers/click_outside_controller/click_outside_controller_messages.js');
84
84
  var backdrop = require('./components/backdrop/backdrop.js');
85
85
  var color_swatches_control_constants = require('./components/form/color_swatches_control/color_swatches_control_constants.js');
86
- var show_more_button = require('./components/show-more/show_more_button.js');
87
86
  var color_swatches = require('./components/color_swatches/color_swatches.js');
88
87
  var color_item = require('./components/color_swatches/color_item/color_item.js');
89
88
  var color_swatches_control = require('./components/form/color_swatches_control/color_swatches_control.js');
@@ -127,7 +126,6 @@ var toggle = require('./components/toggle/toggle.js');
127
126
  var toggle_button$1 = require('./components/toggle/toggle_button.js');
128
127
  var navigator_share = require('./components/navigator/navigator_share/navigator_share.js');
129
128
  var navigator_controller = require('./components/navigator/navigator_controller/navigator_controller.js');
130
- var show_more$1 = require('./components/show-more/show_more.js');
131
129
 
132
130
 
133
131
 
@@ -512,12 +510,6 @@ Object.defineProperty(exports, 'HBackdrop', {
512
510
  }
513
511
  });
514
512
  exports.COLOR_SWATCHES_CONTROL_EVENT_NAMES = color_swatches_control_constants.COLOR_SWATCHES_CONTROL_EVENT_NAMES;
515
- Object.defineProperty(exports, 'HShowMoreButton', {
516
- enumerable: true,
517
- get: function () {
518
- return show_more_button.HShowMoreButton;
519
- }
520
- });
521
513
  Object.defineProperty(exports, 'HColorSwatches', {
522
514
  enumerable: true,
523
515
  get: function () {
@@ -763,10 +755,4 @@ Object.defineProperty(exports, 'NavigatorController', {
763
755
  return navigator_controller.NavigatorController;
764
756
  }
765
757
  });
766
- Object.defineProperty(exports, 'HShowMore', {
767
- enumerable: true,
768
- get: function () {
769
- return show_more$1.HShowMore;
770
- }
771
- });
772
758
  //# sourceMappingURL=index.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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,7 +3,6 @@ import { PhoenixLightLitElement } from "../../core/phoenix_light_lit_element/pho
3
3
  import { TemplateResult } from 'lit-html';
4
4
  export declare class HColorSwatches extends PhoenixLightLitElement {
5
5
  multiple: boolean;
6
- devVisualSubcategories: boolean;
7
6
  numberOfVisibleColors: number;
8
7
  selectedColors: HColorItem[];
9
8
  showMoreBtnText: string;
@@ -34,5 +33,5 @@ export declare class HColorSwatches extends PhoenixLightLitElement {
34
33
  private _removeExistingColorFromArray;
35
34
  private _dispatchColorChangeEvent;
36
35
  disconnectedCallback(): void;
37
- protected render(): TemplateResult | void;
36
+ protected render(): TemplateResult;
38
37
  }
@@ -6,15 +6,13 @@ import { PhoenixLightLitElement } from '../../core/phoenix_light_lit_element/pho
6
6
  import { phoenixCustomElement } from '../../core/decorators/phoenix_custom_element.js';
7
7
  import { KeystrokesController } from '../../controllers/keystrokes_controller/keystrokes_controller.js';
8
8
  import 'lit-html';
9
- import { COLOR_SWATCHES_EVENT_NAMES, COLOR_ITEM_TAG_NAME, COLOR_SWATCHES_CSS_CLASSES } from './color_swatches_constants.js';
9
+ import { COLOR_SWATCHES_EVENT_NAMES, COLOR_ITEM_TAG_NAME, COLOR_SWATCHES_CSS_CLASSES, COLOR_SWATCHES_HIDDEN_ATTRIBUTE } from './color_swatches_constants.js';
10
10
  import { COLOR_ITEM_SELECTED_ATTRIBUTE } from './color_item/color_item_constants.js';
11
- import { HColorItem } from './color_item/color_item.js';
12
11
 
13
12
  let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
14
13
  constructor() {
15
14
  super(...arguments);
16
15
  this.multiple = false;
17
- this.devVisualSubcategories = false;
18
16
  this.selectedColors = [];
19
17
  this.showMoreBtnText = 'Pokaż wszystkie kolory';
20
18
  this._setupEvents = () => {
@@ -138,10 +136,8 @@ let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
138
136
  this._$colorSwatchesChildren = [...this.children];
139
137
  this._setupEvents();
140
138
  this._addCssClasses();
141
- if (!this.devVisualSubcategories) {
142
- this.numberOfVisibleColors && this._hideItems(this.numberOfVisibleColors);
143
- this._showAllItemsEvent();
144
- }
139
+ this.numberOfVisibleColors && this._hideItems(this.numberOfVisibleColors);
140
+ this._showAllItemsEvent();
145
141
  this.selectedColors = [...this.querySelectorAll('h-color-item[selected]')];
146
142
  this._$colors = [...this.querySelectorAll('h-color-item')];
147
143
  }
@@ -154,7 +150,7 @@ let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
154
150
  return;
155
151
  this._$colorSwatchesChildren.forEach(($colorSwatchesChild, index) => {
156
152
  if (index > numberOfVisibleColors - 1) {
157
- $colorSwatchesChild.setAttribute('hidden', '');
153
+ $colorSwatchesChild.setAttribute(COLOR_SWATCHES_HIDDEN_ATTRIBUTE, '');
158
154
  }
159
155
  });
160
156
  }
@@ -164,9 +160,9 @@ let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
164
160
  if (!this._$colorSwatchesChildren)
165
161
  return;
166
162
  this._$colorSwatchesChildren.forEach(($colorSwatchesChild) => {
167
- $colorSwatchesChild.removeAttribute('hidden');
163
+ $colorSwatchesChild.removeAttribute(COLOR_SWATCHES_HIDDEN_ATTRIBUTE);
168
164
  });
169
- (_a = this.querySelector('h-color-swatches-show-more')) === null || _a === void 0 ? void 0 : _a.setAttribute('hidden', '');
165
+ (_a = this.querySelector('h-color-swatches-show-more')) === null || _a === void 0 ? void 0 : _a.setAttribute(COLOR_SWATCHES_HIDDEN_ATTRIBUTE, '');
170
166
  });
171
167
  }
172
168
  _handleChangeToNextColorItem({ target }) {
@@ -180,9 +176,7 @@ let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
180
176
  $nextColorItem = $nextFocusableElement;
181
177
  }
182
178
  $nextColorItem.focus();
183
- if ($nextColorItem instanceof HColorItem) {
184
- this._handleColorChange($nextColorItem);
185
- }
179
+ this._handleColorChange($nextColorItem);
186
180
  }
187
181
  _handleChangeToPreviousColorItem({ target }) {
188
182
  const $colorItem = target;
@@ -195,9 +189,7 @@ let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
195
189
  $previousColorItem = $previousFocusableElement;
196
190
  }
197
191
  $previousColorItem.focus();
198
- if ($previousColorItem instanceof HColorItem) {
199
- this._handleColorChange($previousColorItem);
200
- }
192
+ this._handleColorChange($previousColorItem);
201
193
  }
202
194
  _toggleColorItem($colorItem) {
203
195
  this.multiple ? this._handleColorClickedForMultipleMode($colorItem) : this._handleColorChangeForSingleMode($colorItem);
@@ -235,24 +227,18 @@ let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
235
227
  document.body.removeEventListener('keydown', this._focusOnSelectedColor);
236
228
  }
237
229
  render() {
238
- if (!this.devVisualSubcategories) {
239
- return html `
240
- ${this.getSlot('default')}
241
- ${this._$colors.length > this.numberOfVisibleColors
242
- ? html `<h-color-swatches-show-more>${this.showMoreBtnText}</h-color-swatches-show-more>`
243
- : nothing}
244
- `;
245
- }
230
+ return html `
231
+ ${this.getSlot('default')}
232
+ ${this._$colors.length > this.numberOfVisibleColors
233
+ ? html `<h-color-swatches-show-more>${this.showMoreBtnText}</h-color-swatches-show-more>`
234
+ : nothing}
235
+ `;
246
236
  }
247
237
  };
248
238
  __decorate([
249
239
  property({ type: Boolean }),
250
240
  __metadata("design:type", Boolean)
251
241
  ], HColorSwatches.prototype, "multiple", void 0);
252
- __decorate([
253
- property({ type: Boolean, attribute: 'dev-visual-subcategories' }),
254
- __metadata("design:type", Boolean)
255
- ], HColorSwatches.prototype, "devVisualSubcategories", void 0);
256
242
  __decorate([
257
243
  property({ type: Number, attribute: 'number-of-visible-colors' }),
258
244
  __metadata("design:type", Number)
@@ -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;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;"}
@@ -9,3 +9,4 @@ export declare const COLOR_SWATCHES_EVENT_NAMES: {
9
9
  readonly markDisabledItems: "markDisabledItems";
10
10
  readonly showMore: "showMore";
11
11
  };
12
+ export declare const COLOR_SWATCHES_HIDDEN_ATTRIBUTE = "hidden";
@@ -8,7 +8,8 @@ const COLOR_SWATCHES_EVENT_NAMES = {
8
8
  change: 'change',
9
9
  markDisabledItems: 'markDisabledItems',
10
10
  showMore: 'showMore'
11
- };
11
+ };
12
+ const COLOR_SWATCHES_HIDDEN_ATTRIBUTE = 'hidden';
12
13
 
13
- export { COLOR_ITEM_TAG_NAME, COLOR_SWATCHES_CSS_CLASSES, COLOR_SWATCHES_EVENT_NAMES };
14
+ export { COLOR_ITEM_TAG_NAME, COLOR_SWATCHES_CSS_CLASSES, COLOR_SWATCHES_EVENT_NAMES, COLOR_SWATCHES_HIDDEN_ATTRIBUTE };
14
15
  //# sourceMappingURL=color_swatches_constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -11,7 +11,7 @@ let HDropdownToggler = class HDropdownToggler extends PhoenixLightLitElement {
11
11
  constructor() {
12
12
  super();
13
13
  this.name = '';
14
- this.ariaHasPopup = 'menu';
14
+ this.ariaHasPopup = 'dialog';
15
15
  this.ariaControls = '';
16
16
  this.role = 'button';
17
17
  this._setupTogglerAria = () => {
@@ -8,6 +8,7 @@ export declare class HToggleBtn extends PhoenixLightLitElement {
8
8
  action: "collapse";
9
9
  private _visibility;
10
10
  constructor();
11
+ private _handleVisibilityChange;
11
12
  connectedCallback(): Promise<void>;
12
13
  disconnectedCallback(): void;
13
14
  private _dispatchToggleEvent;
@@ -12,17 +12,22 @@ let HToggleBtn = class HToggleBtn extends PhoenixLightLitElement {
12
12
  constructor() {
13
13
  super();
14
14
  this.action = TOGGLE_ACTIONS.collapse;
15
- this._visibility = {
16
- collapse: (isOpened) => {
17
- isOpened ? this._visibilityController.show() : this._visibilityController.hide();
18
- },
19
- expand: (isOpened) => {
20
- isOpened ? this._visibilityController.hide() : this._visibilityController.show();
15
+ this._handleVisibilityChange = (isOpened) => {
16
+ var _a;
17
+ const shouldFocus = this === document.activeElement;
18
+ isOpened ? this._visibilityController.hide() : this._visibilityController.show();
19
+ if (shouldFocus) {
20
+ const $collapseToggleBtn = (_a = this.parentElement) === null || _a === void 0 ? void 0 : _a.querySelector(`[action="${TOGGLE_ACTIONS.collapse}"]`);
21
+ $collapseToggleBtn === null || $collapseToggleBtn === void 0 ? void 0 : $collapseToggleBtn.focus();
21
22
  }
22
23
  };
23
24
  this._dispatchToggleEvent = () => {
24
25
  this.emitCustomEvent(TOGGLE_BUTTON_EVENTS.toggle);
25
26
  };
27
+ this._visibility = {
28
+ collapse: this._handleVisibilityChange,
29
+ expand: this._handleVisibilityChange
30
+ };
26
31
  this._btnController = new BtnController(this, this._dispatchToggleEvent);
27
32
  this._visibilityController = new VisibilityController(this);
28
33
  }
@@ -34,10 +39,12 @@ let HToggleBtn = class HToggleBtn extends PhoenixLightLitElement {
34
39
  this._visibility[this.action](isOpened);
35
40
  });
36
41
  this._opened$.subscribe(this._openedObserver);
42
+ this.setAttribute('aria-expanded', this.action === TOGGLE_ACTIONS.collapse ? 'true' : 'false');
37
43
  this.addEventListener('click', this._dispatchToggleEvent);
38
44
  }
39
45
  disconnectedCallback() {
40
- this._opened$.unsubscribe(this._openedObserver);
46
+ super.disconnectedCallback();
47
+ this._openedObserver && this._opened$.unsubscribe(this._openedObserver);
41
48
  }
42
49
  };
43
50
  __decorate([
@@ -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;"}
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;"}
@@ -140,6 +140,4 @@ export * from './components/toggle/toggle_types';
140
140
  export * from './components/toggle/toggle_constants';
141
141
  export { NavigatorShare } from './components/navigator/navigator_share/navigator_share';
142
142
  export { NavigatorController } from './components/navigator/navigator_controller/navigator_controller';
143
- export { HShowMore } from './components/show-more/show_more';
144
- export { HShowMoreButton } from './components/show-more/show_more_button';
145
143
  export { phoenixCustomElement } from './core/decorators/phoenix_custom_element';
@@ -79,7 +79,6 @@ export { HToggleButton } from './components/groups/toggle_button_group/toggle_bu
79
79
  export { CLICK_OUTSIDE_CONTROLLER_MESSAGES } from './controllers/click_outside_controller/click_outside_controller_messages.js';
80
80
  export { HBackdrop } from './components/backdrop/backdrop.js';
81
81
  export { COLOR_SWATCHES_CONTROL_EVENT_NAMES } from './components/form/color_swatches_control/color_swatches_control_constants.js';
82
- export { HShowMoreButton } from './components/show-more/show_more_button.js';
83
82
  export { HColorSwatches } from './components/color_swatches/color_swatches.js';
84
83
  export { HColorItem } from './components/color_swatches/color_item/color_item.js';
85
84
  export { HColorSwatchesControl } from './components/form/color_swatches_control/color_swatches_control.js';
@@ -123,5 +122,4 @@ export { HToggle } from './components/toggle/toggle.js';
123
122
  export { HToggleBtn } from './components/toggle/toggle_button.js';
124
123
  export { NavigatorShare } from './components/navigator/navigator_share/navigator_share.js';
125
124
  export { NavigatorController } from './components/navigator/navigator_controller/navigator_controller.js';
126
- export { HShowMore } from './components/show-more/show_more.js';
127
125
  //# sourceMappingURL=index.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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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.17.6-0",
5
+ "version": "1.17.6-1",
6
6
  "description": "phoenix design system",
7
7
  "author": "zefirek",
8
8
  "license": "MIT",
@@ -27,15 +27,15 @@
27
27
  },
28
28
  "peerDependencies": {
29
29
  "@dreamcommerce/utilities": "^1.0.0",
30
- "@splidejs/splide": "4.0.7",
31
- "@splidejs/splide-extension-auto-scroll": "0.5.3"
30
+ "@splidejs/splide": "^4.0.7",
31
+ "@splidejs/splide-extension-auto-scroll": "^0.5.3"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@dreamcommerce/utilities": "^1.20.1-0",
35
35
  "@shoper/jest_config": "^0.0.0",
36
36
  "@shoper/tsconfig": "^0.0.0",
37
37
  "@splidejs/splide": "4.0.7",
38
- "@splidejs/splide-extension-auto-scroll": "0.5.3",
38
+ "@splidejs/splide-extension-auto-scroll": "^0.5.3",
39
39
  "@storybook/web-components": "6.5.7",
40
40
  "lit": "2.4.0"
41
41
  },
@@ -1,117 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var tslib_es6 = require('../../../../../external/tslib/tslib.es6.js');
6
- require('lit');
7
- var decorators = require('lit/decorators');
8
- var utilities = require('@dreamcommerce/utilities');
9
- var phoenix_light_lit_element = require('../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
10
- var phoenix_custom_element = require('../../core/decorators/phoenix_custom_element.js');
11
- var global_constants = require('../../global_constants.js');
12
- var relative_position_controller_constants = require('../../controllers/relative_position_controller/relative_position_controller_constants.js');
13
- var throttle = require('../../../../../external/lodash/throttle.js');
14
- var show_more_constants = require('./show_more_constants.js');
15
-
16
- exports.HShowMore = class HShowMore extends phoenix_light_lit_element.PhoenixLightLitElement {
17
- constructor() {
18
- super(...arguments);
19
- this._$showMoreButton = null;
20
- this._showMore = () => {
21
- this._showAllItems();
22
- this._hideButton();
23
- this._focusNextItem();
24
- };
25
- this._onResize = throttle['default'](() => {
26
- if (window.innerWidth > global_constants.BREAKPOINTS.xs) {
27
- this._showAllItems();
28
- this._hideButton();
29
- window.removeEventListener('resize', this._onResize);
30
- }
31
- }, relative_position_controller_constants.DEFAULT_THROTTLE_WAIT_TIME);
32
- }
33
- connectedCallback() {
34
- super.connectedCallback();
35
- this._$showMoreButton = this.querySelector('h-show-more-button');
36
- this._$items = [...this.querySelectorAll(`[${show_more_constants.SHOW_MORE_ITEM_ATTRIBUTE}]`)];
37
- this.classList.add(show_more_constants.SHOW_MORE_CSS_CLASSES.showMore);
38
- this._updateComponentVisibility();
39
- this._setupListeners();
40
- }
41
- updated(_changedProperties) {
42
- super.updated(_changedProperties);
43
- if (_changedProperties.has('showAll')) {
44
- this._showAllItems();
45
- this._hideButton();
46
- }
47
- }
48
- disconnectedCallback() {
49
- super.disconnectedCallback();
50
- window.removeEventListener('resize', this._onResize);
51
- }
52
- _updateComponentVisibility() {
53
- const hasOverflowItems = this._$items.length > this.count;
54
- const isMobileView = window.innerWidth <= global_constants.BREAKPOINTS.xs;
55
- const shouldBeActive = (!this.mobileOnly || isMobileView) && hasOverflowItems;
56
- if (shouldBeActive) {
57
- this._hideExcessItems();
58
- this._showButton();
59
- }
60
- else {
61
- this._hideButton();
62
- }
63
- }
64
- _hideExcessItems() {
65
- this._$items.forEach(($item, index) => {
66
- $item.removeAttribute('hidden');
67
- if (index >= this.count)
68
- $item.setAttribute('hidden', '');
69
- });
70
- }
71
- _showAllItems() {
72
- this._$items.forEach(($item) => $item.removeAttribute('hidden'));
73
- }
74
- _hideButton() {
75
- var _a;
76
- (_a = this._$showMoreButton) === null || _a === void 0 ? void 0 : _a.setAttribute('hidden', '');
77
- }
78
- _showButton() {
79
- var _a;
80
- (_a = this._$showMoreButton) === null || _a === void 0 ? void 0 : _a.removeAttribute('hidden');
81
- }
82
- _setupListeners() {
83
- this.addEventListener(show_more_constants.SHOW_MORE_EVENT_NAMES.showMore, this._showMore);
84
- if (this.mobileOnly && window.innerWidth <= global_constants.BREAKPOINTS.xs) {
85
- window.addEventListener('resize', this._onResize);
86
- }
87
- }
88
- _focusNextItem() {
89
- const $nextItem = this._$items[this.count];
90
- if (!$nextItem)
91
- return;
92
- const $firstFocusableElement = utilities.UiDomUtils.getFocusableElement($nextItem);
93
- if ($firstFocusableElement) {
94
- $firstFocusableElement.focus();
95
- return;
96
- }
97
- if (!$nextItem.getAttribute('tabindex'))
98
- $nextItem.setAttribute('tabindex', '-1');
99
- $nextItem.focus();
100
- }
101
- };
102
- tslib_es6.__decorate([
103
- decorators.property({ type: Number }),
104
- tslib_es6.__metadata("design:type", Number)
105
- ], exports.HShowMore.prototype, "count", void 0);
106
- tslib_es6.__decorate([
107
- decorators.property({ type: Boolean, attribute: 'mobile-only' }),
108
- tslib_es6.__metadata("design:type", Boolean)
109
- ], exports.HShowMore.prototype, "mobileOnly", void 0);
110
- tslib_es6.__decorate([
111
- decorators.property({ type: Boolean, attribute: 'show-all' }),
112
- tslib_es6.__metadata("design:type", Boolean)
113
- ], exports.HShowMore.prototype, "showAll", void 0);
114
- exports.HShowMore = tslib_es6.__decorate([
115
- phoenix_custom_element.phoenixCustomElement('h-show-more')
116
- ], exports.HShowMore);
117
- //# sourceMappingURL=show_more.js.map
@@ -1 +0,0 @@
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,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;"}
@@ -1,29 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var tslib_es6 = require('../../../../../external/tslib/tslib.es6.js');
6
- var phoenix_light_lit_element = require('../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
7
- var phoenix_custom_element = require('../../core/decorators/phoenix_custom_element.js');
8
- var btn_controller = require('../../controllers/btn_controller/btn_controller.js');
9
- var show_more_constants = require('./show_more_constants.js');
10
-
11
- exports.HShowMoreButton = class HShowMoreButton extends phoenix_light_lit_element.PhoenixLightLitElement {
12
- constructor() {
13
- super();
14
- this._dispatchClickedEvent = () => {
15
- this.emitCustomEvent(show_more_constants.SHOW_MORE_EVENT_NAMES.showMore);
16
- };
17
- this._btnController = new btn_controller.BtnController(this, this._dispatchClickedEvent);
18
- }
19
- connectedCallback() {
20
- super.connectedCallback();
21
- this.addEventListener('click', this._dispatchClickedEvent);
22
- this.classList.add(show_more_constants.SHOW_MORE_CSS_CLASSES.showMoreButton);
23
- }
24
- };
25
- exports.HShowMoreButton = tslib_es6.__decorate([
26
- phoenix_custom_element.phoenixCustomElement('h-show-more-button'),
27
- tslib_es6.__metadata("design:paramtypes", [])
28
- ], exports.HShowMoreButton);
29
- //# sourceMappingURL=show_more_button.js.map
@@ -1 +0,0 @@
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;"}
@@ -1,17 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const SHOW_MORE_CSS_CLASSES = {
6
- showMore: 'show-more',
7
- showMoreButton: 'show-more__button'
8
- };
9
- const SHOW_MORE_EVENT_NAMES = {
10
- showMore: 'showMore'
11
- };
12
- const SHOW_MORE_ITEM_ATTRIBUTE = 'show-more-item';
13
-
14
- exports.SHOW_MORE_CSS_CLASSES = SHOW_MORE_CSS_CLASSES;
15
- exports.SHOW_MORE_EVENT_NAMES = SHOW_MORE_EVENT_NAMES;
16
- exports.SHOW_MORE_ITEM_ATTRIBUTE = SHOW_MORE_ITEM_ATTRIBUTE;
17
- //# sourceMappingURL=show_more_constants.js.map
@@ -1 +0,0 @@
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;"}
@@ -1,21 +0,0 @@
1
- import { PhoenixLightLitElement } from "../../core/phoenix_light_lit_element/phoenix_light_lit_element";
2
- import { PropertyValues } from 'lit';
3
- export declare class HShowMore extends PhoenixLightLitElement {
4
- count: number;
5
- mobileOnly: boolean;
6
- showAll: boolean;
7
- private _$showMoreButton;
8
- private _$items;
9
- connectedCallback(): void;
10
- protected updated(_changedProperties: PropertyValues): void;
11
- disconnectedCallback(): void;
12
- private _updateComponentVisibility;
13
- private _hideExcessItems;
14
- private _showAllItems;
15
- private _hideButton;
16
- private _showButton;
17
- private _setupListeners;
18
- private _showMore;
19
- private _focusNextItem;
20
- private _onResize;
21
- }
@@ -1,115 +0,0 @@
1
- import { __decorate, __metadata } from '../../../../../external/tslib/tslib.es6.js';
2
- import 'lit';
3
- import { property } from 'lit/decorators';
4
- import { UiDomUtils } from '@dreamcommerce/utilities';
5
- import { PhoenixLightLitElement } from '../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
6
- import { phoenixCustomElement } from '../../core/decorators/phoenix_custom_element.js';
7
- import { BREAKPOINTS } from '../../global_constants.js';
8
- import { DEFAULT_THROTTLE_WAIT_TIME } from '../../controllers/relative_position_controller/relative_position_controller_constants.js';
9
- import throttle_1 from '../../../../../external/lodash/throttle.js';
10
- import { SHOW_MORE_ITEM_ATTRIBUTE, SHOW_MORE_CSS_CLASSES, SHOW_MORE_EVENT_NAMES } from './show_more_constants.js';
11
-
12
- let HShowMore = class HShowMore extends PhoenixLightLitElement {
13
- constructor() {
14
- super(...arguments);
15
- this._$showMoreButton = null;
16
- this._showMore = () => {
17
- this._showAllItems();
18
- this._hideButton();
19
- this._focusNextItem();
20
- };
21
- this._onResize = throttle_1(() => {
22
- if (window.innerWidth > BREAKPOINTS.xs) {
23
- this._showAllItems();
24
- this._hideButton();
25
- window.removeEventListener('resize', this._onResize);
26
- }
27
- }, DEFAULT_THROTTLE_WAIT_TIME);
28
- }
29
- connectedCallback() {
30
- super.connectedCallback();
31
- this._$showMoreButton = this.querySelector('h-show-more-button');
32
- this._$items = [...this.querySelectorAll(`[${SHOW_MORE_ITEM_ATTRIBUTE}]`)];
33
- this.classList.add(SHOW_MORE_CSS_CLASSES.showMore);
34
- this._updateComponentVisibility();
35
- this._setupListeners();
36
- }
37
- updated(_changedProperties) {
38
- super.updated(_changedProperties);
39
- if (_changedProperties.has('showAll')) {
40
- this._showAllItems();
41
- this._hideButton();
42
- }
43
- }
44
- disconnectedCallback() {
45
- super.disconnectedCallback();
46
- window.removeEventListener('resize', this._onResize);
47
- }
48
- _updateComponentVisibility() {
49
- const hasOverflowItems = this._$items.length > this.count;
50
- const isMobileView = window.innerWidth <= BREAKPOINTS.xs;
51
- const shouldBeActive = (!this.mobileOnly || isMobileView) && hasOverflowItems;
52
- if (shouldBeActive) {
53
- this._hideExcessItems();
54
- this._showButton();
55
- }
56
- else {
57
- this._hideButton();
58
- }
59
- }
60
- _hideExcessItems() {
61
- this._$items.forEach(($item, index) => {
62
- $item.removeAttribute('hidden');
63
- if (index >= this.count)
64
- $item.setAttribute('hidden', '');
65
- });
66
- }
67
- _showAllItems() {
68
- this._$items.forEach(($item) => $item.removeAttribute('hidden'));
69
- }
70
- _hideButton() {
71
- var _a;
72
- (_a = this._$showMoreButton) === null || _a === void 0 ? void 0 : _a.setAttribute('hidden', '');
73
- }
74
- _showButton() {
75
- var _a;
76
- (_a = this._$showMoreButton) === null || _a === void 0 ? void 0 : _a.removeAttribute('hidden');
77
- }
78
- _setupListeners() {
79
- this.addEventListener(SHOW_MORE_EVENT_NAMES.showMore, this._showMore);
80
- if (this.mobileOnly && window.innerWidth <= BREAKPOINTS.xs) {
81
- window.addEventListener('resize', this._onResize);
82
- }
83
- }
84
- _focusNextItem() {
85
- const $nextItem = this._$items[this.count];
86
- if (!$nextItem)
87
- return;
88
- const $firstFocusableElement = UiDomUtils.getFocusableElement($nextItem);
89
- if ($firstFocusableElement) {
90
- $firstFocusableElement.focus();
91
- return;
92
- }
93
- if (!$nextItem.getAttribute('tabindex'))
94
- $nextItem.setAttribute('tabindex', '-1');
95
- $nextItem.focus();
96
- }
97
- };
98
- __decorate([
99
- property({ type: Number }),
100
- __metadata("design:type", Number)
101
- ], HShowMore.prototype, "count", void 0);
102
- __decorate([
103
- property({ type: Boolean, attribute: 'mobile-only' }),
104
- __metadata("design:type", Boolean)
105
- ], HShowMore.prototype, "mobileOnly", void 0);
106
- __decorate([
107
- property({ type: Boolean, attribute: 'show-all' }),
108
- __metadata("design:type", Boolean)
109
- ], HShowMore.prototype, "showAll", void 0);
110
- HShowMore = __decorate([
111
- phoenixCustomElement('h-show-more')
112
- ], HShowMore);
113
-
114
- export { HShowMore };
115
- //# sourceMappingURL=show_more.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;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;"}
@@ -1,7 +0,0 @@
1
- import { PhoenixLightLitElement } from "../../core/phoenix_light_lit_element/phoenix_light_lit_element";
2
- export declare class HShowMoreButton extends PhoenixLightLitElement {
3
- private _btnController;
4
- constructor();
5
- connectedCallback(): void;
6
- private _dispatchClickedEvent;
7
- }
@@ -1,27 +0,0 @@
1
- import { __decorate, __metadata } from '../../../../../external/tslib/tslib.es6.js';
2
- import { PhoenixLightLitElement } from '../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
3
- import { phoenixCustomElement } from '../../core/decorators/phoenix_custom_element.js';
4
- import { BtnController } from '../../controllers/btn_controller/btn_controller.js';
5
- import { SHOW_MORE_EVENT_NAMES, SHOW_MORE_CSS_CLASSES } from './show_more_constants.js';
6
-
7
- let HShowMoreButton = class HShowMoreButton extends PhoenixLightLitElement {
8
- constructor() {
9
- super();
10
- this._dispatchClickedEvent = () => {
11
- this.emitCustomEvent(SHOW_MORE_EVENT_NAMES.showMore);
12
- };
13
- this._btnController = new BtnController(this, this._dispatchClickedEvent);
14
- }
15
- connectedCallback() {
16
- super.connectedCallback();
17
- this.addEventListener('click', this._dispatchClickedEvent);
18
- this.classList.add(SHOW_MORE_CSS_CLASSES.showMoreButton);
19
- }
20
- };
21
- HShowMoreButton = __decorate([
22
- phoenixCustomElement('h-show-more-button'),
23
- __metadata("design:paramtypes", [])
24
- ], HShowMoreButton);
25
-
26
- export { HShowMoreButton };
27
- //# sourceMappingURL=show_more_button.js.map
@@ -1 +0,0 @@
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;"}
@@ -1,8 +0,0 @@
1
- export declare const SHOW_MORE_CSS_CLASSES: {
2
- readonly showMore: "show-more";
3
- readonly showMoreButton: "show-more__button";
4
- };
5
- export declare const SHOW_MORE_EVENT_NAMES: {
6
- readonly showMore: "showMore";
7
- };
8
- export declare const SHOW_MORE_ITEM_ATTRIBUTE = "show-more-item";
@@ -1,11 +0,0 @@
1
- const SHOW_MORE_CSS_CLASSES = {
2
- showMore: 'show-more',
3
- showMoreButton: 'show-more__button'
4
- };
5
- const SHOW_MORE_EVENT_NAMES = {
6
- showMore: 'showMore'
7
- };
8
- const SHOW_MORE_ITEM_ATTRIBUTE = 'show-more-item';
9
-
10
- export { SHOW_MORE_CSS_CLASSES, SHOW_MORE_EVENT_NAMES, SHOW_MORE_ITEM_ATTRIBUTE };
11
- //# sourceMappingURL=show_more_constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}