@shoper/phoenix_design_system 1.17.3-4 → 1.17.3-6

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 (65) hide show
  1. package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches.js +23 -3
  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/color_swatches/show-more/show_more.js +37 -0
  6. package/build/cjs/packages/phoenix/src/components/color_swatches/show-more/show_more.js.map +1 -0
  7. package/build/cjs/packages/phoenix/src/components/color_swatches/show-more/show_more_constants.js +8 -0
  8. package/build/cjs/packages/phoenix/src/components/color_swatches/show-more/show_more_constants.js.map +1 -0
  9. package/build/cjs/packages/phoenix/src/components/messages/base_message.js +47 -0
  10. package/build/cjs/packages/phoenix/src/components/messages/base_message.js.map +1 -1
  11. package/build/cjs/packages/phoenix/src/components/messages/base_message_constants.js +6 -1
  12. package/build/cjs/packages/phoenix/src/components/messages/base_message_constants.js.map +1 -1
  13. package/build/cjs/packages/phoenix/src/components/messages/hints/hint.js +0 -10
  14. package/build/cjs/packages/phoenix/src/components/messages/hints/hint.js.map +1 -1
  15. package/build/cjs/packages/phoenix/src/components/messages/tooltips/tooltip.js +0 -10
  16. package/build/cjs/packages/phoenix/src/components/messages/tooltips/tooltip.js.map +1 -1
  17. package/build/cjs/packages/phoenix/src/components/portal/portal_constants.js +2 -0
  18. package/build/cjs/packages/phoenix/src/components/portal/portal_constants.js.map +1 -1
  19. package/build/cjs/packages/phoenix/src/index.js +7 -14
  20. package/build/cjs/packages/phoenix/src/index.js.map +1 -1
  21. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.d.ts +4 -0
  22. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.js +24 -4
  23. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.js.map +1 -1
  24. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.d.ts +1 -0
  25. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.js +3 -2
  26. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.js.map +1 -1
  27. package/build/esm/packages/phoenix/src/components/color_swatches/show-more/show_more.d.ts +9 -0
  28. package/build/esm/packages/phoenix/src/components/color_swatches/show-more/show_more.js +35 -0
  29. package/build/esm/packages/phoenix/src/components/color_swatches/show-more/show_more.js.map +1 -0
  30. package/build/esm/packages/phoenix/src/components/color_swatches/show-more/show_more_constants.d.ts +1 -0
  31. package/build/esm/packages/phoenix/src/components/color_swatches/show-more/show_more_constants.js +4 -0
  32. package/build/esm/packages/phoenix/src/components/color_swatches/show-more/show_more_constants.js.map +1 -0
  33. package/build/esm/packages/phoenix/src/components/messages/base_message.d.ts +9 -0
  34. package/build/esm/packages/phoenix/src/components/messages/base_message.js +49 -2
  35. package/build/esm/packages/phoenix/src/components/messages/base_message.js.map +1 -1
  36. package/build/esm/packages/phoenix/src/components/messages/base_message_constants.d.ts +2 -0
  37. package/build/esm/packages/phoenix/src/components/messages/base_message_constants.js +5 -2
  38. package/build/esm/packages/phoenix/src/components/messages/base_message_constants.js.map +1 -1
  39. package/build/esm/packages/phoenix/src/components/messages/hints/hint.d.ts +0 -2
  40. package/build/esm/packages/phoenix/src/components/messages/hints/hint.js +0 -10
  41. package/build/esm/packages/phoenix/src/components/messages/hints/hint.js.map +1 -1
  42. package/build/esm/packages/phoenix/src/components/messages/tooltips/tooltip.d.ts +0 -2
  43. package/build/esm/packages/phoenix/src/components/messages/tooltips/tooltip.js +0 -10
  44. package/build/esm/packages/phoenix/src/components/messages/tooltips/tooltip.js.map +1 -1
  45. package/build/esm/packages/phoenix/src/components/portal/portal_constants.js +2 -1
  46. package/build/esm/packages/phoenix/src/components/portal/portal_constants.js.map +1 -1
  47. package/build/esm/packages/phoenix/src/index.d.ts +1 -2
  48. package/build/esm/packages/phoenix/src/index.js +1 -2
  49. package/build/esm/packages/phoenix/src/index.js.map +1 -1
  50. package/package.json +5 -5
  51. package/build/cjs/packages/phoenix/src/components/show-more/show_more.js +0 -121
  52. package/build/cjs/packages/phoenix/src/components/show-more/show_more.js.map +0 -1
  53. package/build/cjs/packages/phoenix/src/components/show-more/show_more_button.js +0 -29
  54. package/build/cjs/packages/phoenix/src/components/show-more/show_more_button.js.map +0 -1
  55. package/build/cjs/packages/phoenix/src/components/show-more/show_more_constants.js +0 -15
  56. package/build/cjs/packages/phoenix/src/components/show-more/show_more_constants.js.map +0 -1
  57. package/build/esm/packages/phoenix/src/components/show-more/show_more.d.ts +0 -22
  58. package/build/esm/packages/phoenix/src/components/show-more/show_more.js +0 -119
  59. package/build/esm/packages/phoenix/src/components/show-more/show_more.js.map +0 -1
  60. package/build/esm/packages/phoenix/src/components/show-more/show_more_button.d.ts +0 -7
  61. package/build/esm/packages/phoenix/src/components/show-more/show_more_button.js +0 -27
  62. package/build/esm/packages/phoenix/src/components/show-more/show_more_button.js.map +0 -1
  63. package/build/esm/packages/phoenix/src/components/show-more/show_more_constants.d.ts +0 -7
  64. package/build/esm/packages/phoenix/src/components/show-more/show_more_constants.js +0 -10
  65. package/build/esm/packages/phoenix/src/components/show-more/show_more_constants.js.map +0 -1
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tslib_es6 = require('../../../../../external/tslib/tslib.es6.js');
6
- require('lit');
6
+ var lit = require('lit');
7
7
  var decorators = require('lit/decorators');
8
8
  var utilities = require('@dreamcommerce/utilities');
9
9
  var phoenix_light_lit_element = require('../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
@@ -18,6 +18,7 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
18
18
  super(...arguments);
19
19
  this.multiple = false;
20
20
  this.selectedColors = [];
21
+ this.showMoreBtnText = 'Pokaż wszystkie kolory';
21
22
  this._setupEvents = () => {
22
23
  if (this.getAttribute('role') === 'group') {
23
24
  this._setupCheckboxGroupEvents();
@@ -139,6 +140,7 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
139
140
  this._$colorSwatchesChildren = [...this.children];
140
141
  this._setupEvents();
141
142
  this._addCssClasses();
143
+ this.numberOfVisibleColors && this._hideItems(this.numberOfVisibleColors);
142
144
  this._showAllItemsEvent();
143
145
  this.selectedColors = [...this.querySelectorAll('h-color-item[selected]')];
144
146
  this._$colors = [...this.querySelectorAll('h-color-item')];
@@ -152,17 +154,19 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
152
154
  return;
153
155
  this._$colorSwatchesChildren.forEach(($colorSwatchesChild, index) => {
154
156
  if (index > numberOfVisibleColors - 1) {
155
- $colorSwatchesChild.setAttribute('hidden', '');
157
+ $colorSwatchesChild.setAttribute(color_swatches_constants.COLOR_SWATCHES_HIDDEN_ATTRIBUTE, '');
156
158
  }
157
159
  });
158
160
  }
159
161
  _showAllItemsEvent() {
160
162
  this.addEventListener(color_swatches_constants.COLOR_SWATCHES_EVENT_NAMES.showMore, () => {
163
+ var _a;
161
164
  if (!this._$colorSwatchesChildren)
162
165
  return;
163
166
  this._$colorSwatchesChildren.forEach(($colorSwatchesChild) => {
164
- $colorSwatchesChild.removeAttribute('hidden');
167
+ $colorSwatchesChild.removeAttribute(color_swatches_constants.COLOR_SWATCHES_HIDDEN_ATTRIBUTE);
165
168
  });
169
+ (_a = this.querySelector('h-color-swatches-show-more')) === null || _a === void 0 ? void 0 : _a.setAttribute(color_swatches_constants.COLOR_SWATCHES_HIDDEN_ATTRIBUTE, '');
166
170
  });
167
171
  }
168
172
  _handleChangeToNextColorItem({ target }) {
@@ -226,15 +230,31 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
226
230
  super.disconnectedCallback();
227
231
  document.body.removeEventListener('keydown', this._focusOnSelectedColor);
228
232
  }
233
+ render() {
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
+ `;
240
+ }
229
241
  };
230
242
  tslib_es6.__decorate([
231
243
  decorators.property({ type: Boolean }),
232
244
  tslib_es6.__metadata("design:type", Boolean)
233
245
  ], exports.HColorSwatches.prototype, "multiple", void 0);
246
+ tslib_es6.__decorate([
247
+ decorators.property({ type: Number, attribute: 'number-of-visible-colors' }),
248
+ tslib_es6.__metadata("design:type", Number)
249
+ ], exports.HColorSwatches.prototype, "numberOfVisibleColors", void 0);
234
250
  tslib_es6.__decorate([
235
251
  decorators.property(),
236
252
  tslib_es6.__metadata("design:type", Array)
237
253
  ], exports.HColorSwatches.prototype, "selectedColors", void 0);
254
+ tslib_es6.__decorate([
255
+ decorators.property({ type: String, attribute: 'show-more-btn-text' }),
256
+ tslib_es6.__metadata("design:type", Object)
257
+ ], exports.HColorSwatches.prototype, "showMoreBtnText", void 0);
238
258
  exports.HColorSwatches = tslib_es6.__decorate([
239
259
  phoenix_custom_element.phoenixCustomElement('h-color-swatches')
240
260
  ], exports.HColorSwatches);
@@ -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;"}
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;"}
@@ -0,0 +1,37 @@
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 color_swatches_constants = require('../color_swatches_constants.js');
10
+ var show_more_constants = require('./show_more_constants.js');
11
+
12
+ exports.HColorSwatchesShowMore = class HColorSwatchesShowMore extends phoenix_light_lit_element.PhoenixLightLitElement {
13
+ constructor() {
14
+ super();
15
+ this._dispatchClickedEvent = () => {
16
+ this.emitCustomEvent(color_swatches_constants.COLOR_SWATCHES_EVENT_NAMES.showMore);
17
+ };
18
+ this._btnController = new btn_controller.BtnController(this, this._dispatchClickedEvent);
19
+ }
20
+ connectedCallback() {
21
+ super.connectedCallback();
22
+ this.setupEvents();
23
+ this._addCssClasses();
24
+ this.classList.add(show_more_constants.SHOW_MORE_CSS_CLASS);
25
+ }
26
+ _addCssClasses() {
27
+ this.classList.add(show_more_constants.SHOW_MORE_CSS_CLASS);
28
+ }
29
+ setupEvents() {
30
+ this.addEventListener('click', this._dispatchClickedEvent);
31
+ }
32
+ };
33
+ exports.HColorSwatchesShowMore = tslib_es6.__decorate([
34
+ phoenix_custom_element.phoenixCustomElement('h-color-swatches-show-more'),
35
+ tslib_es6.__metadata("design:paramtypes", [])
36
+ ], exports.HColorSwatchesShowMore);
37
+ //# sourceMappingURL=show_more.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,+CAAmD;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const SHOW_MORE_CSS_CLASS = 'color-swatches-show-more';
6
+
7
+ exports.SHOW_MORE_CSS_CLASS = SHOW_MORE_CSS_CLASS;
8
+ //# sourceMappingURL=show_more_constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -3,13 +3,16 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tslib_es6 = require('../../../../../external/tslib/tslib.es6.js');
6
+ var lit = require('lit');
6
7
  var decorators = require('lit/decorators');
7
8
  var utilities = require('@dreamcommerce/utilities');
8
9
  var phoenix_light_lit_element = require('../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
10
+ var v4 = require('../../../../../external/uuid/dist/esm-browser/v4.js');
9
11
  var portal_constants = require('../portal/portal_constants.js');
10
12
  var click_outside_controller = require('../../controllers/click_outside_controller/click_outside_controller.js');
11
13
  var relative_position_controller = require('../../controllers/relative_position_controller/relative_position_controller.js');
12
14
  var base_message_constants = require('./base_message_constants.js');
15
+ var ref = require('lit/directives/ref');
13
16
 
14
17
  class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
15
18
  constructor() {
@@ -20,9 +23,22 @@ class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
20
23
  this.offset = base_message_constants.DEFAULT_MESSAGE_OFFSET;
21
24
  this.mouseonly = false;
22
25
  this.tabindex = '-1';
26
+ this._messageId = v4['default']();
27
+ this._tooltipRef = ref.createRef();
28
+ this._handleChildrenAriaAttributes = () => {
29
+ [...this.children].forEach((child) => {
30
+ if (base_message_constants.LIST_OF_MESSAGE_CHILDREN.includes(child.tagName.toLowerCase()) || this._tooltipRef.value === child)
31
+ return;
32
+ child.setAttribute('aria-describedby', `${child.getAttribute('aria-describedby') || ''} ${this._messageId}`);
33
+ });
34
+ };
23
35
  this._setupEventListeners = () => {
36
+ var _a, _b;
24
37
  this.addEventListener('mouseenter', this.open);
25
38
  this.addEventListener('mouseleave', this.close);
39
+ this.addEventListener('keydown', this._closeFromKeyboard);
40
+ (_a = this._$baseMessageContent) === null || _a === void 0 ? void 0 : _a.addEventListener('mouseenter', this.open);
41
+ (_b = this._$baseMessageContent) === null || _b === void 0 ? void 0 : _b.addEventListener('mouseleave', this.close);
26
42
  if (!this.mouseonly) {
27
43
  this.addEventListener('focusin', this.open);
28
44
  this.addEventListener('focusout', this.close);
@@ -43,6 +59,13 @@ class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
43
59
  this.opened = true;
44
60
  }, base_message_constants.MESSAGE_SHOW_DELAY_IN_MS);
45
61
  };
62
+ this._closeFromKeyboard = (ev) => {
63
+ if (ev.key !== 'Escape' || !this.opened)
64
+ return;
65
+ ev.preventDefault();
66
+ ev.stopPropagation();
67
+ this.close();
68
+ };
46
69
  this.close = () => {
47
70
  this._shouldDelayClosing = Date.now() - this._tooltipOpenTime > base_message_constants.MESSAGE_TIME_TO_DELAY_CLOSING_IN_MS;
48
71
  clearTimeout(this._openTimeout);
@@ -83,8 +106,14 @@ class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
83
106
  offset: this.offset
84
107
  });
85
108
  this.setAttribute('tabindex', this.tabindex);
109
+ if (!this._$baseMessageContent)
110
+ this._$baseMessageContent = [...this.children].find((child) => base_message_constants.MESSAGE_CONTENT_ELEMENTS.includes(child.tagName.toLowerCase()));
86
111
  this._setupEventListeners();
87
112
  }
113
+ firstUpdated(props) {
114
+ super.firstUpdated(props);
115
+ this._handleChildrenAriaAttributes();
116
+ }
88
117
  static _appendMessagePortal() {
89
118
  const $messagePortalTarget = document.querySelector(`[name="${base_message_constants.DEFAULT_MESSAGE_PORTAL_NAME}"]`);
90
119
  if ($messagePortalTarget)
@@ -93,6 +122,24 @@ class BaseMessage extends phoenix_light_lit_element.PhoenixLightLitElement {
93
122
  $portalTarget.setAttribute(portal_constants.PORTAL_TARGET_NAME_PROP, base_message_constants.DEFAULT_MESSAGE_PORTAL_NAME);
94
123
  document.body.appendChild($portalTarget);
95
124
  }
125
+ disconnectedCallback() {
126
+ var _a, _b;
127
+ super.disconnectedCallback();
128
+ (_a = this._$baseMessageContent) === null || _a === void 0 ? void 0 : _a.removeEventListener('mouseenter', this.open);
129
+ (_b = this._$baseMessageContent) === null || _b === void 0 ? void 0 : _b.removeEventListener('mouseleave', this.close);
130
+ }
131
+ render() {
132
+ var _a;
133
+ super.render();
134
+ return lit.html `
135
+ <span ${ref.ref(this._tooltipRef)} id="${this._messageId}" class="${base_message_constants.SCREEN_READER_ONLY_CLASS_NAME}" role="tooltip">
136
+ ${utilities.DomUtils.stripHTMLTags(((_a = this._$baseMessageContent) === null || _a === void 0 ? void 0 : _a.innerHTML) || '')}
137
+ </span>
138
+ <h-portal ?disabled="${!this.opened}" @open="${this._positionMessage}" to="${this.portalTarget}" hidden>
139
+ ${this.getSlot(base_message_constants.MESSAGE_CONTENT_SLOT_NAME)}
140
+ </h-portal>
141
+ `;
142
+ }
96
143
  }
97
144
  tslib_es6.__decorate([
98
145
  decorators.property({ type: Boolean, reflect: true }),
@@ -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;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA,iBAAiB,qDAAyD;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -2,6 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var portal_constants = require('../portal/portal_constants.js');
5
6
  var hint_constants = require('./hints/hint_constants.js');
6
7
  var tooltip_constants = require('./tooltips/tooltip_constants.js');
7
8
 
@@ -10,16 +11,20 @@ const MESSAGE_CONTENT_SLOT_NAME = 'message-content';
10
11
  const MESSAGE_REMOVED_CLASS_NAME = `removed`;
11
12
  const DEFAULT_MESSAGE_OFFSET = 10;
12
13
  const MESSAGE_CONTENT_ELEMENTS = [tooltip_constants.TOOLTIP_CONTENT_ELEMENT_NAME, hint_constants.HINT_CONTENT_ELEMENT_NAME];
14
+ const LIST_OF_MESSAGE_CHILDREN = [...MESSAGE_CONTENT_ELEMENTS, portal_constants.PORTAL_COMPONENT_NAME];
13
15
  const MESSAGE_SHOW_DELAY_IN_MS = 100;
14
16
  const MESSAGE_TIME_TO_DELAY_CLOSING_IN_MS = 500;
15
- const MESSAGE_CLOSE_DELAY_IN_MS = 500;
17
+ const MESSAGE_CLOSE_DELAY_IN_MS = 500;
18
+ const SCREEN_READER_ONLY_CLASS_NAME = 'sr-only';
16
19
 
17
20
  exports.DEFAULT_MESSAGE_OFFSET = DEFAULT_MESSAGE_OFFSET;
18
21
  exports.DEFAULT_MESSAGE_PORTAL_NAME = DEFAULT_MESSAGE_PORTAL_NAME;
22
+ exports.LIST_OF_MESSAGE_CHILDREN = LIST_OF_MESSAGE_CHILDREN;
19
23
  exports.MESSAGE_CLOSE_DELAY_IN_MS = MESSAGE_CLOSE_DELAY_IN_MS;
20
24
  exports.MESSAGE_CONTENT_ELEMENTS = MESSAGE_CONTENT_ELEMENTS;
21
25
  exports.MESSAGE_CONTENT_SLOT_NAME = MESSAGE_CONTENT_SLOT_NAME;
22
26
  exports.MESSAGE_REMOVED_CLASS_NAME = MESSAGE_REMOVED_CLASS_NAME;
23
27
  exports.MESSAGE_SHOW_DELAY_IN_MS = MESSAGE_SHOW_DELAY_IN_MS;
24
28
  exports.MESSAGE_TIME_TO_DELAY_CLOSING_IN_MS = MESSAGE_TIME_TO_DELAY_CLOSING_IN_MS;
29
+ exports.SCREEN_READER_ONLY_CLASS_NAME = SCREEN_READER_ONLY_CLASS_NAME;
25
30
  //# sourceMappingURL=base_message_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;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;"}
@@ -4,9 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tslib_es6 = require('../../../../../../external/tslib/tslib.es6.js');
6
6
  var phoenix_custom_element = require('../../../core/decorators/phoenix_custom_element.js');
7
- var litHtml = require('lit-html');
8
7
  var hint_constants = require('./hint_constants.js');
9
- var base_message_constants = require('../base_message_constants.js');
10
8
  var base_message = require('../base_message.js');
11
9
 
12
10
  exports.HHint = class HHint extends base_message.BaseMessage {
@@ -18,14 +16,6 @@ exports.HHint = class HHint extends base_message.BaseMessage {
18
16
  super.connectedCallback(hint_constants.HINT_CLASS_NAME);
19
17
  this.classList.add(hint_constants.HINT_CLASS_NAME);
20
18
  }
21
- render() {
22
- super.render();
23
- return litHtml.html `
24
- <h-portal ?disabled="${!this.opened}" @open="${this._positionMessage}" to="${this.portalTarget}" hidden>
25
- ${this.getSlot(base_message_constants.MESSAGE_CONTENT_SLOT_NAME)}
26
- </h-portal>
27
- `;
28
- }
29
19
  };
30
20
  exports.HHint = tslib_es6.__decorate([
31
21
  phoenix_custom_element.phoenixCustomElement(hint_constants.HINT_ELEMENT_NAME),
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,+CAAmD;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,+CAAmD;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -4,9 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tslib_es6 = require('../../../../../../external/tslib/tslib.es6.js');
6
6
  var phoenix_custom_element = require('../../../core/decorators/phoenix_custom_element.js');
7
- var litHtml = require('lit-html');
8
7
  var tooltip_constants = require('./tooltip_constants.js');
9
- var base_message_constants = require('../base_message_constants.js');
10
8
  var base_message = require('../base_message.js');
11
9
 
12
10
  exports.HTooltip = class HTooltip extends base_message.BaseMessage {
@@ -14,14 +12,6 @@ exports.HTooltip = class HTooltip extends base_message.BaseMessage {
14
12
  super.connectedCallback(tooltip_constants.TOOLTIP_CLASS_NAME);
15
13
  this.classList.add(tooltip_constants.TOOLTIP_CLASS_NAME);
16
14
  }
17
- render() {
18
- super.render();
19
- return litHtml.html `
20
- <h-portal ?disabled="${!this.opened}" @open="${this._positionMessage}" to="${this.portalTarget}" hidden>
21
- ${this.getSlot(base_message_constants.MESSAGE_CONTENT_SLOT_NAME)}
22
- </h-portal>
23
- `;
24
- }
25
15
  };
26
16
  exports.HTooltip = tslib_es6.__decorate([
27
17
  phoenix_custom_element.phoenixCustomElement(tooltip_constants.TOOLTIP_ELEMENT_NAME)
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,+CAAmD;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,+CAAmD;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -7,9 +7,11 @@ const PORTAL_EVENTS = {
7
7
  close: 'close'
8
8
  };
9
9
  const PORTAL_TARGET_NAME_PROP = 'name';
10
+ const PORTAL_COMPONENT_NAME = 'h-portal';
10
11
  const PORTAL_TARGET_COMPONENT_NAME = 'h-portal-target';
11
12
  const PORTAL_TARGET_ATTRIBUTE_NAME = 'portal-target';
12
13
 
14
+ exports.PORTAL_COMPONENT_NAME = PORTAL_COMPONENT_NAME;
13
15
  exports.PORTAL_EVENTS = PORTAL_EVENTS;
14
16
  exports.PORTAL_TARGET_ATTRIBUTE_NAME = PORTAL_TARGET_ATTRIBUTE_NAME;
15
17
  exports.PORTAL_TARGET_COMPONENT_NAME = PORTAL_TARGET_COMPONENT_NAME;
@@ -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;"}
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;"}
@@ -86,6 +86,7 @@ var color_swatches_control_constants = require('./components/form/color_swatches
86
86
  var color_swatches = require('./components/color_swatches/color_swatches.js');
87
87
  var color_item = require('./components/color_swatches/color_item/color_item.js');
88
88
  var color_swatches_control = require('./components/form/color_swatches_control/color_swatches_control.js');
89
+ var show_more = require('./components/color_swatches/show-more/show_more.js');
89
90
  var visibility_controller = require('./controllers/visibility_controller/visibility_controller.js');
90
91
  var slider = require('./components/slider/slider.js');
91
92
  var scroller = require('./components/scroller/scroller.js');
@@ -125,8 +126,6 @@ var toggle = require('./components/toggle/toggle.js');
125
126
  var toggle_button$1 = require('./components/toggle/toggle_button.js');
126
127
  var navigator_share = require('./components/navigator/navigator_share/navigator_share.js');
127
128
  var navigator_controller = require('./components/navigator/navigator_controller/navigator_controller.js');
128
- var show_more_button = require('./components/show-more/show_more_button.js');
129
- var show_more = require('./components/show-more/show_more.js');
130
129
 
131
130
 
132
131
 
@@ -529,6 +528,12 @@ Object.defineProperty(exports, 'HColorSwatchesControl', {
529
528
  return color_swatches_control.HColorSwatchesControl;
530
529
  }
531
530
  });
531
+ Object.defineProperty(exports, 'HColorSwatchesShowMore', {
532
+ enumerable: true,
533
+ get: function () {
534
+ return show_more.HColorSwatchesShowMore;
535
+ }
536
+ });
532
537
  exports.VisibilityController = visibility_controller.VisibilityController;
533
538
  Object.defineProperty(exports, 'HSlider', {
534
539
  enumerable: true,
@@ -750,16 +755,4 @@ Object.defineProperty(exports, 'NavigatorController', {
750
755
  return navigator_controller.NavigatorController;
751
756
  }
752
757
  });
753
- Object.defineProperty(exports, 'HShowMoreButton', {
754
- enumerable: true,
755
- get: function () {
756
- return show_more_button.HShowMoreButton;
757
- }
758
- });
759
- Object.defineProperty(exports, 'HShowMore', {
760
- enumerable: true,
761
- get: function () {
762
- return show_more.HShowMore;
763
- }
764
- });
765
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;"}
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;"}
@@ -1,8 +1,11 @@
1
1
  import { HColorItem } from "./color_item/color_item";
2
2
  import { PhoenixLightLitElement } from "../../core/phoenix_light_lit_element/phoenix_light_lit_element";
3
+ import { TemplateResult } from 'lit-html';
3
4
  export declare class HColorSwatches extends PhoenixLightLitElement {
4
5
  multiple: boolean;
6
+ numberOfVisibleColors: number;
5
7
  selectedColors: HColorItem[];
8
+ showMoreBtnText: string;
6
9
  private _$colors;
7
10
  private _$colorSwatchesChildren;
8
11
  selectColors($colors: HColorItem[] | HColorItem): void;
@@ -30,4 +33,5 @@ export declare class HColorSwatches extends PhoenixLightLitElement {
30
33
  private _removeExistingColorFromArray;
31
34
  private _dispatchColorChangeEvent;
32
35
  disconnectedCallback(): void;
36
+ protected render(): TemplateResult;
33
37
  }
@@ -1,12 +1,12 @@
1
1
  import { __decorate, __metadata } from '../../../../../external/tslib/tslib.es6.js';
2
- import 'lit';
2
+ import { html, nothing } from 'lit';
3
3
  import { property } from 'lit/decorators';
4
4
  import { UiDomUtils, ArrayUtils } from '@dreamcommerce/utilities';
5
5
  import { PhoenixLightLitElement } from '../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
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
11
 
12
12
  let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
@@ -14,6 +14,7 @@ let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
14
14
  super(...arguments);
15
15
  this.multiple = false;
16
16
  this.selectedColors = [];
17
+ this.showMoreBtnText = 'Pokaż wszystkie kolory';
17
18
  this._setupEvents = () => {
18
19
  if (this.getAttribute('role') === 'group') {
19
20
  this._setupCheckboxGroupEvents();
@@ -135,6 +136,7 @@ let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
135
136
  this._$colorSwatchesChildren = [...this.children];
136
137
  this._setupEvents();
137
138
  this._addCssClasses();
139
+ this.numberOfVisibleColors && this._hideItems(this.numberOfVisibleColors);
138
140
  this._showAllItemsEvent();
139
141
  this.selectedColors = [...this.querySelectorAll('h-color-item[selected]')];
140
142
  this._$colors = [...this.querySelectorAll('h-color-item')];
@@ -148,17 +150,19 @@ let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
148
150
  return;
149
151
  this._$colorSwatchesChildren.forEach(($colorSwatchesChild, index) => {
150
152
  if (index > numberOfVisibleColors - 1) {
151
- $colorSwatchesChild.setAttribute('hidden', '');
153
+ $colorSwatchesChild.setAttribute(COLOR_SWATCHES_HIDDEN_ATTRIBUTE, '');
152
154
  }
153
155
  });
154
156
  }
155
157
  _showAllItemsEvent() {
156
158
  this.addEventListener(COLOR_SWATCHES_EVENT_NAMES.showMore, () => {
159
+ var _a;
157
160
  if (!this._$colorSwatchesChildren)
158
161
  return;
159
162
  this._$colorSwatchesChildren.forEach(($colorSwatchesChild) => {
160
- $colorSwatchesChild.removeAttribute('hidden');
163
+ $colorSwatchesChild.removeAttribute(COLOR_SWATCHES_HIDDEN_ATTRIBUTE);
161
164
  });
165
+ (_a = this.querySelector('h-color-swatches-show-more')) === null || _a === void 0 ? void 0 : _a.setAttribute(COLOR_SWATCHES_HIDDEN_ATTRIBUTE, '');
162
166
  });
163
167
  }
164
168
  _handleChangeToNextColorItem({ target }) {
@@ -222,15 +226,31 @@ let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
222
226
  super.disconnectedCallback();
223
227
  document.body.removeEventListener('keydown', this._focusOnSelectedColor);
224
228
  }
229
+ render() {
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
+ `;
236
+ }
225
237
  };
226
238
  __decorate([
227
239
  property({ type: Boolean }),
228
240
  __metadata("design:type", Boolean)
229
241
  ], HColorSwatches.prototype, "multiple", void 0);
242
+ __decorate([
243
+ property({ type: Number, attribute: 'number-of-visible-colors' }),
244
+ __metadata("design:type", Number)
245
+ ], HColorSwatches.prototype, "numberOfVisibleColors", void 0);
230
246
  __decorate([
231
247
  property(),
232
248
  __metadata("design:type", Array)
233
249
  ], HColorSwatches.prototype, "selectedColors", void 0);
250
+ __decorate([
251
+ property({ type: String, attribute: 'show-more-btn-text' }),
252
+ __metadata("design:type", Object)
253
+ ], HColorSwatches.prototype, "showMoreBtnText", void 0);
234
254
  HColorSwatches = __decorate([
235
255
  phoenixCustomElement('h-color-swatches')
236
256
  ], HColorSwatches);
@@ -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;"}
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;"}
@@ -0,0 +1,9 @@
1
+ import { PhoenixLightLitElement } from "../../../core/phoenix_light_lit_element/phoenix_light_lit_element";
2
+ export declare class HColorSwatchesShowMore extends PhoenixLightLitElement {
3
+ private _btnController;
4
+ constructor();
5
+ connectedCallback(): void;
6
+ private _addCssClasses;
7
+ private setupEvents;
8
+ private _dispatchClickedEvent;
9
+ }
@@ -0,0 +1,35 @@
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 { COLOR_SWATCHES_EVENT_NAMES } from '../color_swatches_constants.js';
6
+ import { SHOW_MORE_CSS_CLASS } from './show_more_constants.js';
7
+
8
+ let HColorSwatchesShowMore = class HColorSwatchesShowMore extends PhoenixLightLitElement {
9
+ constructor() {
10
+ super();
11
+ this._dispatchClickedEvent = () => {
12
+ this.emitCustomEvent(COLOR_SWATCHES_EVENT_NAMES.showMore);
13
+ };
14
+ this._btnController = new BtnController(this, this._dispatchClickedEvent);
15
+ }
16
+ connectedCallback() {
17
+ super.connectedCallback();
18
+ this.setupEvents();
19
+ this._addCssClasses();
20
+ this.classList.add(SHOW_MORE_CSS_CLASS);
21
+ }
22
+ _addCssClasses() {
23
+ this.classList.add(SHOW_MORE_CSS_CLASS);
24
+ }
25
+ setupEvents() {
26
+ this.addEventListener('click', this._dispatchClickedEvent);
27
+ }
28
+ };
29
+ HColorSwatchesShowMore = __decorate([
30
+ phoenixCustomElement('h-color-swatches-show-more'),
31
+ __metadata("design:paramtypes", [])
32
+ ], HColorSwatchesShowMore);
33
+
34
+ export { HColorSwatchesShowMore };
35
+ //# sourceMappingURL=show_more.js.map
@@ -0,0 +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;"}
@@ -0,0 +1 @@
1
+ export declare const SHOW_MORE_CSS_CLASS = "color-swatches-show-more";