@shoper/phoenix_design_system 0.22.5-0 → 0.22.5-10

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 (41) hide show
  1. package/build/cjs/packages/phoenix/src/components/color_swatches/color_item/color_item.js +70 -0
  2. package/build/cjs/packages/phoenix/src/components/color_swatches/color_item/color_item.js.map +1 -0
  3. package/build/cjs/packages/phoenix/src/components/color_swatches/color_item/color_item_constants.js +12 -0
  4. package/build/cjs/packages/phoenix/src/components/color_swatches/color_item/color_item_constants.js.map +1 -0
  5. package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches.js +127 -0
  6. package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches.js.map +1 -0
  7. package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches_constants.js +20 -0
  8. package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches_constants.js.map +1 -0
  9. package/build/cjs/packages/phoenix/src/components/color_swatches/show-more/show_more.js +38 -0
  10. package/build/cjs/packages/phoenix/src/components/color_swatches/show-more/show_more.js.map +1 -0
  11. package/build/cjs/packages/phoenix/src/components/color_swatches/show-more/show_more_constants.js +14 -0
  12. package/build/cjs/packages/phoenix/src/components/color_swatches/show-more/show_more_constants.js.map +1 -0
  13. package/build/cjs/packages/phoenix/src/components/form/color_swatches/color_swatches_control.js +45 -0
  14. package/build/cjs/packages/phoenix/src/components/form/color_swatches/color_swatches_control.js.map +1 -0
  15. package/build/cjs/packages/phoenix/src/index.js +28 -0
  16. package/build/cjs/packages/phoenix/src/index.js.map +1 -1
  17. package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item.js +65 -62
  18. package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item.js.map +1 -1
  19. package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item_constants.js +7 -5
  20. package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item_constants.js.map +1 -1
  21. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.d.ts +10 -2
  22. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.js +122 -80
  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 +2 -0
  25. package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.js +14 -10
  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/color_swatches_types.d.ts +1 -1
  28. package/build/esm/packages/phoenix/src/components/color_swatches/show-more/show_more.d.ts +9 -0
  29. package/build/esm/packages/phoenix/src/components/color_swatches/show-more/show_more.js +36 -0
  30. package/build/esm/packages/phoenix/src/components/color_swatches/show-more/show_more.js.map +1 -0
  31. package/build/esm/packages/phoenix/src/components/color_swatches/show-more/show_more_constants.d.ts +5 -0
  32. package/build/esm/packages/phoenix/src/components/color_swatches/show-more/show_more_constants.js +8 -0
  33. package/build/esm/packages/phoenix/src/components/color_swatches/show-more/show_more_constants.js.map +1 -0
  34. package/build/esm/packages/phoenix/src/components/form/color_swatches/color_swatches_control.d.ts +5 -0
  35. package/build/esm/packages/phoenix/src/components/form/color_swatches/color_swatches_control.js +41 -17
  36. package/build/esm/packages/phoenix/src/components/form/color_swatches/color_swatches_control.js.map +1 -1
  37. package/build/esm/packages/phoenix/src/components/groups/toggle_button_group/toggle_button.d.ts +1 -1
  38. package/build/esm/packages/phoenix/src/index.d.ts +4 -0
  39. package/build/esm/packages/phoenix/src/index.js +4 -0
  40. package/build/esm/packages/phoenix/src/index.js.map +1 -1
  41. package/package.json +1 -1
@@ -0,0 +1,70 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var tslib_es6 = require('../../../../../../external/tslib/tslib.es6.js');
6
+ var decorators = require('lit/decorators');
7
+ var phoenix_light_lit_element = require('../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
8
+ var phoenix_custom_element = require('../../../core/decorators/phoenix_custom_element.js');
9
+ var btn_controller = require('../../../controllers/btn_controller.js');
10
+ var color_swatches_constants = require('../color_swatches_constants.js');
11
+ var color_item_constants = require('./color_item_constants.js');
12
+
13
+ exports.HColorItem = class HColorItem extends phoenix_light_lit_element.PhoenixLightLitElement {
14
+ constructor() {
15
+ super();
16
+ this.disabled = false;
17
+ this.selected = false;
18
+ this._dispatchClickedEvent = () => {
19
+ this.dispatchEvent(new Event(color_item_constants.COLOR_ITEM_EVENT_NAMES.selected, {
20
+ bubbles: true
21
+ }));
22
+ };
23
+ this._btnController = new btn_controller.BtnController(this, this._dispatchClickedEvent);
24
+ }
25
+ connectedCallback() {
26
+ super.connectedCallback();
27
+ this.setupEvents();
28
+ this.style.backgroundColor = this.color;
29
+ this._syncAriaPressed();
30
+ this.setAttribute('aria-label', this.label ? this.label : this.color);
31
+ this.disabled && this.removeAttribute('tabindex');
32
+ this.classList.add(color_swatches_constants.COLOR_SWATCHES_CSS_CLASSES.colorItem);
33
+ }
34
+ attributeChangedCallback(name, value, newValue) {
35
+ super.attributeChangedCallback(name, value, newValue);
36
+ switch (name) {
37
+ case color_item_constants.COLOR_ITEM_SELECTED_ATTRIBUTE: {
38
+ this._syncAriaPressed();
39
+ break;
40
+ }
41
+ }
42
+ }
43
+ _syncAriaPressed() {
44
+ this.selected ? this.setAttribute('aria-pressed', '') : this.removeAttribute('aria-pressed');
45
+ }
46
+ setupEvents() {
47
+ !this.disabled && this.addEventListener('click', this._dispatchClickedEvent);
48
+ }
49
+ };
50
+ tslib_es6.__decorate([
51
+ decorators.property({ type: String }),
52
+ tslib_es6.__metadata("design:type", String)
53
+ ], exports.HColorItem.prototype, "color", void 0);
54
+ tslib_es6.__decorate([
55
+ decorators.property({ type: String }),
56
+ tslib_es6.__metadata("design:type", String)
57
+ ], exports.HColorItem.prototype, "label", void 0);
58
+ tslib_es6.__decorate([
59
+ decorators.property({ type: Boolean, attribute: true }),
60
+ tslib_es6.__metadata("design:type", Boolean)
61
+ ], exports.HColorItem.prototype, "disabled", void 0);
62
+ tslib_es6.__decorate([
63
+ decorators.property({ type: Boolean, attribute: true }),
64
+ tslib_es6.__metadata("design:type", Boolean)
65
+ ], exports.HColorItem.prototype, "selected", void 0);
66
+ exports.HColorItem = tslib_es6.__decorate([
67
+ phoenix_custom_element.phoenixCustomElement('h-color-item'),
68
+ tslib_es6.__metadata("design:paramtypes", [])
69
+ ], exports.HColorItem);
70
+ //# sourceMappingURL=color_item.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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,12 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const COLOR_ITEM_EVENT_NAMES = {
6
+ selected: 'colorItemSelected'
7
+ };
8
+ const COLOR_ITEM_SELECTED_ATTRIBUTE = 'selected';
9
+
10
+ exports.COLOR_ITEM_EVENT_NAMES = COLOR_ITEM_EVENT_NAMES;
11
+ exports.COLOR_ITEM_SELECTED_ATTRIBUTE = COLOR_ITEM_SELECTED_ATTRIBUTE;
12
+ //# sourceMappingURL=color_item_constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -0,0 +1,127 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var tslib_es6 = require('../../../../../external/tslib/tslib.es6.js');
6
+ var decorators = require('lit/decorators');
7
+ var phoenix_light_lit_element = require('../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
8
+ var phoenix_custom_element = require('../../core/decorators/phoenix_custom_element.js');
9
+ var color_swatches_constants = require('./color_swatches_constants.js');
10
+ var color_item_constants = require('./color_item/color_item_constants.js');
11
+ var show_more_constants = require('./show-more/show_more_constants.js');
12
+
13
+ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.PhoenixLightLitElement {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.inline = true;
17
+ this.multiple = false;
18
+ this.selectedColors = [];
19
+ this._handleColorClicked = ({ target }) => {
20
+ const $colorItem = target;
21
+ this.multiple ? this._handleColorClickedForMultipleMode($colorItem) : this._handleColorClickedForSingleMode($colorItem);
22
+ };
23
+ this._dispatchColorSelectEvent = () => {
24
+ const detail = {
25
+ colors: this._setColorsDispatchValue(this.selectedColors)
26
+ };
27
+ this.dispatchEvent(new CustomEvent(color_swatches_constants.COLOR_SWATCHES_EVENT_NAMES.selected, {
28
+ bubbles: true,
29
+ detail
30
+ }));
31
+ };
32
+ }
33
+ connectedCallback() {
34
+ super.connectedCallback();
35
+ this._setupEvents();
36
+ this._addCssClasses();
37
+ this._hideItems(this.itemsToShow);
38
+ this._showAllItemsEvent();
39
+ }
40
+ _addCssClasses() {
41
+ this.querySelectorAll('h-color-item').forEach(($colorItem) => $colorItem.classList.add(color_swatches_constants.COLOR_SWATCHES_CSS_CLASSES.colorSwatchesItem));
42
+ this.classList.add(color_swatches_constants.COLOR_SWATCHES_CSS_CLASSES.colorSwatches);
43
+ }
44
+ _hideItems(itemsToShow) {
45
+ this.querySelectorAll('h-color-item').forEach(($colorItem, index) => {
46
+ if (index > itemsToShow - 1) {
47
+ $colorItem.setAttribute(color_swatches_constants.COLOR_SWATCHES_HIDDEN_ATTRIBUTE, '');
48
+ this.showMoreButton = true;
49
+ }
50
+ });
51
+ }
52
+ _showAllItemsEvent() {
53
+ document.addEventListener(show_more_constants.SHOW_MORE_EVENT_NAMES.showMore, () => {
54
+ this.querySelectorAll('h-color-item').forEach(($colorItem) => {
55
+ $colorItem.removeAttribute(color_swatches_constants.COLOR_SWATCHES_HIDDEN_ATTRIBUTE);
56
+ });
57
+ });
58
+ }
59
+ _setupEvents() {
60
+ this.addEventListener(color_item_constants.COLOR_ITEM_EVENT_NAMES.selected, this._handleColorClicked);
61
+ }
62
+ _handleColorClickedForMultipleMode($colorItem) {
63
+ !this._isColorAlreadyExistInArray($colorItem)
64
+ ? (this.selectedColors = [...this.selectedColors, $colorItem])
65
+ : this._removeExistingColorFromArray($colorItem);
66
+ this._toggleSelectedAttribute($colorItem);
67
+ this._dispatchColorSelectEvent();
68
+ }
69
+ _handleColorClickedForSingleMode($colorItem) {
70
+ const $previouslySelected = this.selectedColors[0];
71
+ this._toggleSelectedAttribute($colorItem);
72
+ if ($previouslySelected && $previouslySelected !== $colorItem)
73
+ $previouslySelected.removeAttribute(color_item_constants.COLOR_ITEM_SELECTED_ATTRIBUTE);
74
+ $previouslySelected === $colorItem ? (this.selectedColors = []) : (this.selectedColors = [$colorItem]);
75
+ this._dispatchColorSelectEvent();
76
+ }
77
+ _toggleSelectedAttribute($colorItem) {
78
+ $colorItem.hasAttribute(color_item_constants.COLOR_ITEM_SELECTED_ATTRIBUTE)
79
+ ? $colorItem.removeAttribute(color_item_constants.COLOR_ITEM_SELECTED_ATTRIBUTE)
80
+ : $colorItem.setAttribute(color_item_constants.COLOR_ITEM_SELECTED_ATTRIBUTE, '');
81
+ }
82
+ _isColorAlreadyExistInArray($colorItem) {
83
+ return this.selectedColors.includes($colorItem);
84
+ }
85
+ _removeExistingColorFromArray($colorItem) {
86
+ const indexOfAlreadyExistingColor = this.selectedColors.indexOf($colorItem);
87
+ this.selectedColors.splice(indexOfAlreadyExistingColor, 1);
88
+ }
89
+ _setColorsDispatchValue(selectedColors) {
90
+ if (this.selectedColors.length > 1)
91
+ return this._getOnlyColorValues(selectedColors);
92
+ if (this.selectedColors.length === 1)
93
+ return selectedColors[0].color;
94
+ return '';
95
+ }
96
+ _getOnlyColorValues(selectedColors) {
97
+ return selectedColors.map((selectedColor) => selectedColor.color);
98
+ }
99
+ };
100
+ tslib_es6.__decorate([
101
+ decorators.property({ type: Boolean }),
102
+ tslib_es6.__metadata("design:type", Object)
103
+ ], exports.HColorSwatches.prototype, "inline", void 0);
104
+ tslib_es6.__decorate([
105
+ decorators.property({ type: Boolean }),
106
+ tslib_es6.__metadata("design:type", Object)
107
+ ], exports.HColorSwatches.prototype, "multiple", void 0);
108
+ tslib_es6.__decorate([
109
+ decorators.property({ type: Number }),
110
+ tslib_es6.__metadata("design:type", Number)
111
+ ], exports.HColorSwatches.prototype, "itemsToShow", void 0);
112
+ tslib_es6.__decorate([
113
+ decorators.property({ type: String }),
114
+ tslib_es6.__metadata("design:type", String)
115
+ ], exports.HColorSwatches.prototype, "showMoreButtonText", void 0);
116
+ tslib_es6.__decorate([
117
+ decorators.state(),
118
+ tslib_es6.__metadata("design:type", Array)
119
+ ], exports.HColorSwatches.prototype, "selectedColors", void 0);
120
+ tslib_es6.__decorate([
121
+ decorators.state(),
122
+ tslib_es6.__metadata("design:type", Boolean)
123
+ ], exports.HColorSwatches.prototype, "showMoreButton", void 0);
124
+ exports.HColorSwatches = tslib_es6.__decorate([
125
+ phoenix_custom_element.phoenixCustomElement('h-color-swatches')
126
+ ], exports.HColorSwatches);
127
+ //# sourceMappingURL=color_swatches.js.map
@@ -0,0 +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;"}
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const baseCssClass = 'color-swatches';
6
+ const COLOR_SWATCHES_CSS_CLASSES = {
7
+ colorItem: 'color-item',
8
+ colorSwatches: baseCssClass,
9
+ colorSwatchesItem: `${baseCssClass}__color-item`,
10
+ colorSwatchesShowMoreButton: `${baseCssClass}__show-more`
11
+ };
12
+ const COLOR_SWATCHES_EVENT_NAMES = {
13
+ selected: 'colorSwatchesSelected'
14
+ };
15
+ const COLOR_SWATCHES_HIDDEN_ATTRIBUTE = 'hidden';
16
+
17
+ exports.COLOR_SWATCHES_CSS_CLASSES = COLOR_SWATCHES_CSS_CLASSES;
18
+ exports.COLOR_SWATCHES_EVENT_NAMES = COLOR_SWATCHES_EVENT_NAMES;
19
+ exports.COLOR_SWATCHES_HIDDEN_ATTRIBUTE = COLOR_SWATCHES_HIDDEN_ATTRIBUTE;
20
+ //# sourceMappingURL=color_swatches_constants.js.map
@@ -0,0 +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;"}
@@ -0,0 +1,38 @@
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.js');
9
+ var show_more_constants = require('./show_more_constants.js');
10
+
11
+ exports.HShowMoreColorItems = class HShowMoreColorItems extends phoenix_light_lit_element.PhoenixLightLitElement {
12
+ constructor() {
13
+ super();
14
+ this._dispatchClickedEvent = () => {
15
+ this.dispatchEvent(new CustomEvent(show_more_constants.SHOW_MORE_EVENT_NAMES.showMore, {
16
+ bubbles: true
17
+ }));
18
+ this._hideButton();
19
+ };
20
+ this._btnController = new btn_controller.BtnController(this, this._dispatchClickedEvent);
21
+ }
22
+ connectedCallback() {
23
+ super.connectedCallback();
24
+ this.setupEvents();
25
+ this.classList.add(show_more_constants.SHOW_MORE_CSS_CLASS);
26
+ }
27
+ _hideButton() {
28
+ this.setAttribute(show_more_constants.SHOW_MORE_HIDDEN_ATTRIBUTE, '');
29
+ }
30
+ setupEvents() {
31
+ this.addEventListener('click', this._dispatchClickedEvent);
32
+ }
33
+ };
34
+ exports.HShowMoreColorItems = tslib_es6.__decorate([
35
+ phoenix_custom_element.phoenixCustomElement('h-color-swatches-show-more'),
36
+ tslib_es6.__metadata("design:paramtypes", [])
37
+ ], exports.HShowMoreColorItems);
38
+ //# 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;AACA;"}
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const SHOW_MORE_CSS_CLASS = 'show-more';
6
+ const SHOW_MORE_HIDDEN_ATTRIBUTE = 'hidden';
7
+ const SHOW_MORE_EVENT_NAMES = {
8
+ showMore: 'showMoreColorItems'
9
+ };
10
+
11
+ exports.SHOW_MORE_CSS_CLASS = SHOW_MORE_CSS_CLASS;
12
+ exports.SHOW_MORE_EVENT_NAMES = SHOW_MORE_EVENT_NAMES;
13
+ exports.SHOW_MORE_HIDDEN_ATTRIBUTE = SHOW_MORE_HIDDEN_ATTRIBUTE;
14
+ //# 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;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var tslib_es6 = require('../../../../../../external/tslib/tslib.es6.js');
6
+ var lit = require('lit');
7
+ var decorators = require('lit/decorators');
8
+ var phoenix_light_lit_element = require('../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
9
+ var phoenix_custom_element = require('../../../core/decorators/phoenix_custom_element.js');
10
+ var color_swatches_constants = require('../../color_swatches/color_swatches_constants.js');
11
+
12
+ exports.HColorSwatchesControl = class HColorSwatchesControl extends phoenix_light_lit_element.PhoenixLightLitElement {
13
+ connectedCallback() {
14
+ super.connectedCallback();
15
+ this._setupEvents();
16
+ }
17
+ _setupEvents() {
18
+ this.addEventListener(color_swatches_constants.COLOR_SWATCHES_EVENT_NAMES.selected, (event) => {
19
+ this.selectedColors = event.detail.colors;
20
+ });
21
+ }
22
+ render() {
23
+ return lit.html `
24
+ <h-input hidden="true">
25
+ <h-input-control value="${this.selectedColors}"></h-input-control>
26
+ </h-input>
27
+ `;
28
+ }
29
+ };
30
+ tslib_es6.__decorate([
31
+ decorators.property({ type: String }),
32
+ tslib_es6.__metadata("design:type", String)
33
+ ], exports.HColorSwatchesControl.prototype, "name", void 0);
34
+ tslib_es6.__decorate([
35
+ decorators.property({ type: Boolean }),
36
+ tslib_es6.__metadata("design:type", Boolean)
37
+ ], exports.HColorSwatchesControl.prototype, "error", void 0);
38
+ tslib_es6.__decorate([
39
+ decorators.state(),
40
+ tslib_es6.__metadata("design:type", Object)
41
+ ], exports.HColorSwatchesControl.prototype, "selectedColors", void 0);
42
+ exports.HColorSwatchesControl = tslib_es6.__decorate([
43
+ phoenix_custom_element.phoenixCustomElement('h-color-swatches-control')
44
+ ], exports.HColorSwatchesControl);
45
+ //# sourceMappingURL=color_swatches_control.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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -60,6 +60,10 @@ var toggle_button_group = require('./components/groups/toggle_button_group/toggl
60
60
  var toggle_button = require('./components/groups/toggle_button_group/toggle_button.js');
61
61
  var click_outside_controller_messages = require('./controllers/click_outside_controller/click_outside_controller_messages.js');
62
62
  var backdrop = require('./components/backdrop/backdrop.js');
63
+ var color_swatches_control = require('./components/form/color_swatches/color_swatches_control.js');
64
+ var color_item = require('./components/color_swatches/color_item/color_item.js');
65
+ var color_swatches = require('./components/color_swatches/color_swatches.js');
66
+ var show_more = require('./components/color_swatches/show-more/show_more.js');
63
67
  var visibility_controller = require('./controllers/visibility_controller/visibility_controller.js');
64
68
  var slider = require('./components/slider/slider.js');
65
69
  var tab = require('./components/tabs/tab/tab.js');
@@ -342,6 +346,30 @@ Object.defineProperty(exports, 'HBackdrop', {
342
346
  return backdrop.HBackdrop;
343
347
  }
344
348
  });
349
+ Object.defineProperty(exports, 'HColorSwatchesControl', {
350
+ enumerable: true,
351
+ get: function () {
352
+ return color_swatches_control.HColorSwatchesControl;
353
+ }
354
+ });
355
+ Object.defineProperty(exports, 'HColorItem', {
356
+ enumerable: true,
357
+ get: function () {
358
+ return color_item.HColorItem;
359
+ }
360
+ });
361
+ Object.defineProperty(exports, 'HColorSwatches', {
362
+ enumerable: true,
363
+ get: function () {
364
+ return color_swatches.HColorSwatches;
365
+ }
366
+ });
367
+ Object.defineProperty(exports, 'HShowMoreColorItems', {
368
+ enumerable: true,
369
+ get: function () {
370
+ return show_more.HShowMoreColorItems;
371
+ }
372
+ });
345
373
  exports.VisibilityController = visibility_controller.VisibilityController;
346
374
  Object.defineProperty(exports, 'HSlider', {
347
375
  enumerable: true,
@@ -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;"}
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;"}
@@ -1,65 +1,68 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import { phoenixCustomElement } from '@phoenixRoot/core/decorators/phoenix_custom_element';
3
- import { PhoenixLightLitElement } from '@phoenixRoot/core/phoenix_light_lit_element/phoenix_light_lit_element';
1
+ import { __decorate, __metadata } from '../../../../../../external/tslib/tslib.es6.js';
4
2
  import { property } from 'lit/decorators';
5
- import { COLOR_ITEM_EVENT_NAMES, COLOR_ITEM_SELECTED_ATTRIBUTE } from '@phoenixRoot/components/color_swatches/color_item/color_item_constants';
6
- import { BtnController } from '@phoenixRoot/controllers/btn_controller';
7
- import { COLOR_SWATCHES_CSS_CLASSES } from '@phoenixRoot/components/color_swatches/color_swatches_constants';
8
- let HColorItem = class HColorItem extends PhoenixLightLitElement {
9
- constructor() {
10
- super();
11
- this.disabled = false;
12
- this.selected = false;
13
- this._dispatchClickedEvent = () => {
14
- this.dispatchEvent(new Event(COLOR_ITEM_EVENT_NAMES.selected, {
15
- bubbles: true
16
- }));
17
- };
18
- this._btnController = new BtnController(this, this._dispatchClickedEvent);
19
- }
20
- connectedCallback() {
21
- super.connectedCallback();
22
- this.setupEvents();
23
- this.innerHTML = this.color;
24
- this._syncAriaPressed();
25
- this.setAttribute('aria-label', this.label ? this.label : this.color);
26
- this.classList.add(COLOR_SWATCHES_CSS_CLASSES.colorItem);
27
- }
28
- attributeChangedCallback(name, value, newValue) {
29
- super.attributeChangedCallback(name, value, newValue);
30
- switch (name) {
31
- case COLOR_ITEM_SELECTED_ATTRIBUTE: {
32
- this._syncAriaPressed();
33
- break;
34
- }
35
- }
36
- }
37
- _syncAriaPressed() {
38
- this.selected ? this.setAttribute('aria-pressed', '') : this.removeAttribute('aria-pressed');
39
- }
40
- setupEvents() {
41
- this.addEventListener('click', this._dispatchClickedEvent);
42
- }
43
- };
44
- __decorate([
45
- property({ type: String }),
46
- __metadata("design:type", String)
47
- ], HColorItem.prototype, "color", void 0);
48
- __decorate([
49
- property({ type: String }),
50
- __metadata("design:type", String)
51
- ], HColorItem.prototype, "label", void 0);
52
- __decorate([
53
- property({ type: Boolean, attribute: true }),
54
- __metadata("design:type", Boolean)
55
- ], HColorItem.prototype, "disabled", void 0);
56
- __decorate([
57
- property({ type: Boolean, attribute: true }),
58
- __metadata("design:type", Boolean)
59
- ], HColorItem.prototype, "selected", void 0);
60
- HColorItem = __decorate([
61
- phoenixCustomElement('h-color-item'),
62
- __metadata("design:paramtypes", [])
3
+ import { PhoenixLightLitElement } from '../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
4
+ import { phoenixCustomElement } from '../../../core/decorators/phoenix_custom_element.js';
5
+ import { BtnController } from '../../../controllers/btn_controller.js';
6
+ import { COLOR_SWATCHES_CSS_CLASSES } from '../color_swatches_constants.js';
7
+ import { COLOR_ITEM_EVENT_NAMES, COLOR_ITEM_SELECTED_ATTRIBUTE } from './color_item_constants.js';
8
+
9
+ let HColorItem = class HColorItem extends PhoenixLightLitElement {
10
+ constructor() {
11
+ super();
12
+ this.disabled = false;
13
+ this.selected = false;
14
+ this._dispatchClickedEvent = () => {
15
+ this.dispatchEvent(new Event(COLOR_ITEM_EVENT_NAMES.selected, {
16
+ bubbles: true
17
+ }));
18
+ };
19
+ this._btnController = new BtnController(this, this._dispatchClickedEvent);
20
+ }
21
+ connectedCallback() {
22
+ super.connectedCallback();
23
+ this.setupEvents();
24
+ this.style.backgroundColor = this.color;
25
+ this._syncAriaPressed();
26
+ this.setAttribute('aria-label', this.label ? this.label : this.color);
27
+ this.disabled && this.removeAttribute('tabindex');
28
+ this.classList.add(COLOR_SWATCHES_CSS_CLASSES.colorItem);
29
+ }
30
+ attributeChangedCallback(name, value, newValue) {
31
+ super.attributeChangedCallback(name, value, newValue);
32
+ switch (name) {
33
+ case COLOR_ITEM_SELECTED_ATTRIBUTE: {
34
+ this._syncAriaPressed();
35
+ break;
36
+ }
37
+ }
38
+ }
39
+ _syncAriaPressed() {
40
+ this.selected ? this.setAttribute('aria-pressed', '') : this.removeAttribute('aria-pressed');
41
+ }
42
+ setupEvents() {
43
+ !this.disabled && this.addEventListener('click', this._dispatchClickedEvent);
44
+ }
45
+ };
46
+ __decorate([
47
+ property({ type: String }),
48
+ __metadata("design:type", String)
49
+ ], HColorItem.prototype, "color", void 0);
50
+ __decorate([
51
+ property({ type: String }),
52
+ __metadata("design:type", String)
53
+ ], HColorItem.prototype, "label", void 0);
54
+ __decorate([
55
+ property({ type: Boolean, attribute: true }),
56
+ __metadata("design:type", Boolean)
57
+ ], HColorItem.prototype, "disabled", void 0);
58
+ __decorate([
59
+ property({ type: Boolean, attribute: true }),
60
+ __metadata("design:type", Boolean)
61
+ ], HColorItem.prototype, "selected", void 0);
62
+ HColorItem = __decorate([
63
+ phoenixCustomElement('h-color-item'),
64
+ __metadata("design:paramtypes", [])
63
65
  ], HColorItem);
66
+
64
67
  export { HColorItem };
65
- //# sourceMappingURL=color_item.js.map
68
+ //# sourceMappingURL=color_item.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"color_item.js","sourceRoot":"","sources":["../../../../../../../../src/components/color_swatches/color_item/color_item.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qDAAqD,CAAC;AAC3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,uEAAuE,CAAC;AAC/G,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,MAAM,wEAAwE,CAAC;AAC/I,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACxE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iEAAiE,CAAC;AAG7G,IAAa,UAAU,GAAvB,MAAa,UAAW,SAAQ,sBAAsB;IAelD;QACI,KAAK,EAAE,CAAC;QARL,aAAQ,GAAY,KAAK,CAAC;QAG1B,aAAQ,GAAY,KAAK,CAAC;QA2CzB,0BAAqB,GAAG,GAAS,EAAE;YACvC,IAAI,CAAC,aAAa,CACd,IAAI,KAAK,CAAC,sBAAsB,CAAC,QAAQ,EAAE;gBACvC,OAAO,EAAE,IAAI;aAChB,CAAC,CACL,CAAC;QACN,CAAC,CAAC;QA1CE,IAAI,CAAC,cAAc,GAAG,IAAI,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;IAC9E,CAAC;IAEM,iBAAiB;QACpB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAE1B,IAAI,CAAC,WAAW,EAAE,CAAC;QAEnB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC;QAE5B,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAExB,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAEtE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,0BAA0B,CAAC,SAAS,CAAC,CAAC;IAC7D,CAAC;IAEM,wBAAwB,CAAC,IAAY,EAAE,KAAoB,EAAE,QAAuB;QACvF,KAAK,CAAC,wBAAwB,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QAEtD,QAAQ,IAAI,EAAE;YACV,KAAK,6BAA6B,CAAC,CAAC;gBAChC,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBACxB,MAAM;aACT;SACJ;IACL,CAAC;IAEO,gBAAgB;QACpB,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;IACjG,CAAC;IAEO,WAAW;QACf,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;IAC/D,CAAC;CASJ,CAAA;AA3DG;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yCACN;AAGrB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yCACL;AAGtB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;;4CACZ;AAGjC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;;4CACZ;AAXxB,UAAU;IADtB,oBAAoB,CAAC,cAAc,CAAC;;GACxB,UAAU,CA6DtB;SA7DY,UAAU"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -1,5 +1,7 @@
1
- export const COLOR_ITEM_EVENT_NAMES = {
2
- selected: 'colorItemSelected'
3
- };
4
- export const COLOR_ITEM_SELECTED_ATTRIBUTE = 'selected';
5
- //# sourceMappingURL=color_item_constants.js.map
1
+ const COLOR_ITEM_EVENT_NAMES = {
2
+ selected: 'colorItemSelected'
3
+ };
4
+ const COLOR_ITEM_SELECTED_ATTRIBUTE = 'selected';
5
+
6
+ export { COLOR_ITEM_EVENT_NAMES, COLOR_ITEM_SELECTED_ATTRIBUTE };
7
+ //# sourceMappingURL=color_item_constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"color_item_constants.js","sourceRoot":"","sources":["../../../../../../../../src/components/color_swatches/color_item/color_item_constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG;IAClC,QAAQ,EAAE,mBAAmB;CACvB,CAAC;AAEX,MAAM,CAAC,MAAM,6BAA6B,GAAG,UAAU,CAAC"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;"}
@@ -3,14 +3,22 @@ import { PhoenixLightLitElement } from "../../core/phoenix_light_lit_element/pho
3
3
  export declare class HColorSwatches extends PhoenixLightLitElement {
4
4
  inline: boolean;
5
5
  multiple: boolean;
6
+ itemsToShow: number;
7
+ showMoreButtonText: string;
6
8
  selectedColors: HColorItem[];
9
+ showMoreButton: boolean;
7
10
  connectedCallback(): void;
8
11
  private _addCssClasses;
12
+ private _hideItems;
13
+ private _showAllItemsEvent;
9
14
  private _setupEvents;
10
15
  private _handleColorClicked;
11
16
  private _handleColorClickedForMultipleMode;
12
17
  private _handleColorClickedForSingleMode;
13
- private _isColorAlreadyAdded;
18
+ private _toggleSelectedAttribute;
19
+ private _isColorAlreadyExistInArray;
20
+ private _removeExistingColorFromArray;
14
21
  private _dispatchColorSelectEvent;
15
- private _getColorValuesOnly;
22
+ private _setColorsDispatchValue;
23
+ private _getOnlyColorValues;
16
24
  }
@@ -1,83 +1,125 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import { COLOR_ITEM_EVENT_NAMES, COLOR_ITEM_SELECTED_ATTRIBUTE } from '@phoenixRoot/components/color_swatches/color_item/color_item_constants';
3
- import { COLOR_SWATCHES_CSS_CLASSES, COLOR_SWATCHES_EVENT_NAMES } from '@phoenixRoot/components/color_swatches/color_swatches_constants';
1
+ import { __decorate, __metadata } from '../../../../../external/tslib/tslib.es6.js';
4
2
  import { property, state } from 'lit/decorators';
5
- import '@phoenixRoot/components/color_swatches/color_item/color_item';
6
- import './color_swatches_types';
7
- import { PhoenixLightLitElement } from '@phoenixRoot/core/phoenix_light_lit_element/phoenix_light_lit_element';
8
- import { phoenixCustomElement } from '@phoenixRoot/core/decorators/phoenix_custom_element';
9
- let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
10
- constructor() {
11
- super(...arguments);
12
- this.inline = true;
13
- this.multiple = false;
14
- this.selectedColors = [];
15
- this._handleColorClicked = ({ target }) => {
16
- const $colorItem = target;
17
- this.multiple ? this._handleColorClickedForMultipleMode($colorItem) : this._handleColorClickedForSingleMode($colorItem);
18
- };
19
- this._dispatchColorSelectEvent = () => {
20
- const detail = {
21
- colors: this.selectedColors.length > 1 ? this._getColorValuesOnly(this.selectedColors) : this.selectedColors[0].color
22
- };
23
- this.dispatchEvent(new CustomEvent(COLOR_SWATCHES_EVENT_NAMES.selected, {
24
- bubbles: true,
25
- detail
26
- }));
27
- };
28
- }
29
- connectedCallback() {
30
- super.connectedCallback();
31
- this._setupEvents();
32
- this._addCssClasses();
33
- }
34
- _addCssClasses() {
35
- this.querySelectorAll('h-color-item').forEach(($colorItem) => $colorItem.classList.add(COLOR_SWATCHES_CSS_CLASSES.colorSwatchesItem));
36
- this.classList.add(COLOR_SWATCHES_CSS_CLASSES.colorSwatches);
37
- }
38
- _setupEvents() {
39
- this.addEventListener(COLOR_ITEM_EVENT_NAMES.selected, this._handleColorClicked);
40
- }
41
- _handleColorClickedForMultipleMode($colorItem) {
42
- if (!this._isColorAlreadyAdded($colorItem)) {
43
- this.selectedColors = [...this.selectedColors, $colorItem];
44
- }
45
- $colorItem.hasAttribute(COLOR_ITEM_SELECTED_ATTRIBUTE)
46
- ? $colorItem.removeAttribute(COLOR_ITEM_SELECTED_ATTRIBUTE)
47
- : $colorItem.setAttribute(COLOR_ITEM_SELECTED_ATTRIBUTE, '');
48
- this._dispatchColorSelectEvent();
49
- }
50
- _handleColorClickedForSingleMode($colorItem) {
51
- const $previouslySelected = this.selectedColors[0];
52
- $colorItem.hasAttribute(COLOR_ITEM_SELECTED_ATTRIBUTE)
53
- ? $colorItem.removeAttribute(COLOR_ITEM_SELECTED_ATTRIBUTE)
54
- : $colorItem.setAttribute(COLOR_ITEM_SELECTED_ATTRIBUTE, '');
55
- if ($previouslySelected && $previouslySelected !== $colorItem)
56
- $previouslySelected.removeAttribute(COLOR_ITEM_SELECTED_ATTRIBUTE);
57
- this.selectedColors = [$colorItem];
58
- this._dispatchColorSelectEvent();
59
- }
60
- _isColorAlreadyAdded($colorItem) {
61
- return this.selectedColors.filter((selectedColor) => selectedColor.color === $colorItem.color).length > 0;
62
- }
63
- _getColorValuesOnly(selectedColors) {
64
- return selectedColors.map((selectedColor) => selectedColor.color);
65
- }
66
- };
67
- __decorate([
68
- property({ type: Boolean }),
69
- __metadata("design:type", Object)
70
- ], HColorSwatches.prototype, "inline", void 0);
71
- __decorate([
72
- property({ type: Boolean }),
73
- __metadata("design:type", Object)
74
- ], HColorSwatches.prototype, "multiple", void 0);
75
- __decorate([
76
- state(),
77
- __metadata("design:type", Array)
78
- ], HColorSwatches.prototype, "selectedColors", void 0);
79
- HColorSwatches = __decorate([
80
- phoenixCustomElement('h-color-swatches')
3
+ import { PhoenixLightLitElement } from '../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
4
+ import { phoenixCustomElement } from '../../core/decorators/phoenix_custom_element.js';
5
+ import { COLOR_SWATCHES_EVENT_NAMES, COLOR_SWATCHES_CSS_CLASSES, COLOR_SWATCHES_HIDDEN_ATTRIBUTE } from './color_swatches_constants.js';
6
+ import { COLOR_ITEM_EVENT_NAMES, COLOR_ITEM_SELECTED_ATTRIBUTE } from './color_item/color_item_constants.js';
7
+ import { SHOW_MORE_EVENT_NAMES } from './show-more/show_more_constants.js';
8
+
9
+ let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.inline = true;
13
+ this.multiple = false;
14
+ this.selectedColors = [];
15
+ this._handleColorClicked = ({ target }) => {
16
+ const $colorItem = target;
17
+ this.multiple ? this._handleColorClickedForMultipleMode($colorItem) : this._handleColorClickedForSingleMode($colorItem);
18
+ };
19
+ this._dispatchColorSelectEvent = () => {
20
+ const detail = {
21
+ colors: this._setColorsDispatchValue(this.selectedColors)
22
+ };
23
+ this.dispatchEvent(new CustomEvent(COLOR_SWATCHES_EVENT_NAMES.selected, {
24
+ bubbles: true,
25
+ detail
26
+ }));
27
+ };
28
+ }
29
+ connectedCallback() {
30
+ super.connectedCallback();
31
+ this._setupEvents();
32
+ this._addCssClasses();
33
+ this._hideItems(this.itemsToShow);
34
+ this._showAllItemsEvent();
35
+ }
36
+ _addCssClasses() {
37
+ this.querySelectorAll('h-color-item').forEach(($colorItem) => $colorItem.classList.add(COLOR_SWATCHES_CSS_CLASSES.colorSwatchesItem));
38
+ this.classList.add(COLOR_SWATCHES_CSS_CLASSES.colorSwatches);
39
+ }
40
+ _hideItems(itemsToShow) {
41
+ this.querySelectorAll('h-color-item').forEach(($colorItem, index) => {
42
+ if (index > itemsToShow - 1) {
43
+ $colorItem.setAttribute(COLOR_SWATCHES_HIDDEN_ATTRIBUTE, '');
44
+ this.showMoreButton = true;
45
+ }
46
+ });
47
+ }
48
+ _showAllItemsEvent() {
49
+ document.addEventListener(SHOW_MORE_EVENT_NAMES.showMore, () => {
50
+ this.querySelectorAll('h-color-item').forEach(($colorItem) => {
51
+ $colorItem.removeAttribute(COLOR_SWATCHES_HIDDEN_ATTRIBUTE);
52
+ });
53
+ });
54
+ }
55
+ _setupEvents() {
56
+ this.addEventListener(COLOR_ITEM_EVENT_NAMES.selected, this._handleColorClicked);
57
+ }
58
+ _handleColorClickedForMultipleMode($colorItem) {
59
+ !this._isColorAlreadyExistInArray($colorItem)
60
+ ? (this.selectedColors = [...this.selectedColors, $colorItem])
61
+ : this._removeExistingColorFromArray($colorItem);
62
+ this._toggleSelectedAttribute($colorItem);
63
+ this._dispatchColorSelectEvent();
64
+ }
65
+ _handleColorClickedForSingleMode($colorItem) {
66
+ const $previouslySelected = this.selectedColors[0];
67
+ this._toggleSelectedAttribute($colorItem);
68
+ if ($previouslySelected && $previouslySelected !== $colorItem)
69
+ $previouslySelected.removeAttribute(COLOR_ITEM_SELECTED_ATTRIBUTE);
70
+ $previouslySelected === $colorItem ? (this.selectedColors = []) : (this.selectedColors = [$colorItem]);
71
+ this._dispatchColorSelectEvent();
72
+ }
73
+ _toggleSelectedAttribute($colorItem) {
74
+ $colorItem.hasAttribute(COLOR_ITEM_SELECTED_ATTRIBUTE)
75
+ ? $colorItem.removeAttribute(COLOR_ITEM_SELECTED_ATTRIBUTE)
76
+ : $colorItem.setAttribute(COLOR_ITEM_SELECTED_ATTRIBUTE, '');
77
+ }
78
+ _isColorAlreadyExistInArray($colorItem) {
79
+ return this.selectedColors.includes($colorItem);
80
+ }
81
+ _removeExistingColorFromArray($colorItem) {
82
+ const indexOfAlreadyExistingColor = this.selectedColors.indexOf($colorItem);
83
+ this.selectedColors.splice(indexOfAlreadyExistingColor, 1);
84
+ }
85
+ _setColorsDispatchValue(selectedColors) {
86
+ if (this.selectedColors.length > 1)
87
+ return this._getOnlyColorValues(selectedColors);
88
+ if (this.selectedColors.length === 1)
89
+ return selectedColors[0].color;
90
+ return '';
91
+ }
92
+ _getOnlyColorValues(selectedColors) {
93
+ return selectedColors.map((selectedColor) => selectedColor.color);
94
+ }
95
+ };
96
+ __decorate([
97
+ property({ type: Boolean }),
98
+ __metadata("design:type", Object)
99
+ ], HColorSwatches.prototype, "inline", void 0);
100
+ __decorate([
101
+ property({ type: Boolean }),
102
+ __metadata("design:type", Object)
103
+ ], HColorSwatches.prototype, "multiple", void 0);
104
+ __decorate([
105
+ property({ type: Number }),
106
+ __metadata("design:type", Number)
107
+ ], HColorSwatches.prototype, "itemsToShow", void 0);
108
+ __decorate([
109
+ property({ type: String }),
110
+ __metadata("design:type", String)
111
+ ], HColorSwatches.prototype, "showMoreButtonText", void 0);
112
+ __decorate([
113
+ state(),
114
+ __metadata("design:type", Array)
115
+ ], HColorSwatches.prototype, "selectedColors", void 0);
116
+ __decorate([
117
+ state(),
118
+ __metadata("design:type", Boolean)
119
+ ], HColorSwatches.prototype, "showMoreButton", void 0);
120
+ HColorSwatches = __decorate([
121
+ phoenixCustomElement('h-color-swatches')
81
122
  ], HColorSwatches);
123
+
82
124
  export { HColorSwatches };
83
- //# sourceMappingURL=color_swatches.js.map
125
+ //# sourceMappingURL=color_swatches.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"color_swatches.js","sourceRoot":"","sources":["../../../../../../../src/components/color_swatches/color_swatches.ts"],"names":[],"mappings":"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"}
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;"}
@@ -2,7 +2,9 @@ export declare const COLOR_SWATCHES_CSS_CLASSES: {
2
2
  readonly colorItem: "color-item";
3
3
  readonly colorSwatches: "color-swatches";
4
4
  readonly colorSwatchesItem: "color-swatches__color-item";
5
+ readonly colorSwatchesShowMoreButton: "color-swatches__show-more";
5
6
  };
6
7
  export declare const COLOR_SWATCHES_EVENT_NAMES: {
7
8
  readonly selected: "colorSwatchesSelected";
8
9
  };
10
+ export declare const COLOR_SWATCHES_HIDDEN_ATTRIBUTE = "hidden";
@@ -1,10 +1,14 @@
1
- const baseCssClass = 'color-swatches';
2
- export const COLOR_SWATCHES_CSS_CLASSES = {
3
- colorItem: 'color-item',
4
- colorSwatches: baseCssClass,
5
- colorSwatchesItem: `${baseCssClass}__color-item`
6
- };
7
- export const COLOR_SWATCHES_EVENT_NAMES = {
8
- selected: 'colorSwatchesSelected'
9
- };
10
- //# sourceMappingURL=color_swatches_constants.js.map
1
+ const baseCssClass = 'color-swatches';
2
+ const COLOR_SWATCHES_CSS_CLASSES = {
3
+ colorItem: 'color-item',
4
+ colorSwatches: baseCssClass,
5
+ colorSwatchesItem: `${baseCssClass}__color-item`,
6
+ colorSwatchesShowMoreButton: `${baseCssClass}__show-more`
7
+ };
8
+ const COLOR_SWATCHES_EVENT_NAMES = {
9
+ selected: 'colorSwatchesSelected'
10
+ };
11
+ const COLOR_SWATCHES_HIDDEN_ATTRIBUTE = 'hidden';
12
+
13
+ export { COLOR_SWATCHES_CSS_CLASSES, COLOR_SWATCHES_EVENT_NAMES, COLOR_SWATCHES_HIDDEN_ATTRIBUTE };
14
+ //# sourceMappingURL=color_swatches_constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"color_swatches_constants.js","sourceRoot":"","sources":["../../../../../../../src/components/color_swatches/color_swatches_constants.ts"],"names":[],"mappings":"AAAA,MAAM,YAAY,GAAG,gBAAgB,CAAC;AAEtC,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACtC,SAAS,EAAE,YAAY;IACvB,aAAa,EAAE,YAAY;IAC3B,iBAAiB,EAAE,GAAG,YAAY,cAAc;CAC1C,CAAC;AAEX,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACtC,QAAQ,EAAE,uBAAuB;CAC3B,CAAC"}
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,3 +1,3 @@
1
1
  export interface IColorSelectValue {
2
- colors: string | string[];
2
+ colors: string | string[] | undefined;
3
3
  }
@@ -0,0 +1,9 @@
1
+ import { PhoenixLightLitElement } from "../../../core/phoenix_light_lit_element/phoenix_light_lit_element";
2
+ export declare class HShowMoreColorItems extends PhoenixLightLitElement {
3
+ private _btnController;
4
+ constructor();
5
+ connectedCallback(): void;
6
+ private _hideButton;
7
+ private setupEvents;
8
+ private _dispatchClickedEvent;
9
+ }
@@ -0,0 +1,36 @@
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.js';
5
+ import { SHOW_MORE_EVENT_NAMES, SHOW_MORE_CSS_CLASS, SHOW_MORE_HIDDEN_ATTRIBUTE } from './show_more_constants.js';
6
+
7
+ let HShowMoreColorItems = class HShowMoreColorItems extends PhoenixLightLitElement {
8
+ constructor() {
9
+ super();
10
+ this._dispatchClickedEvent = () => {
11
+ this.dispatchEvent(new CustomEvent(SHOW_MORE_EVENT_NAMES.showMore, {
12
+ bubbles: true
13
+ }));
14
+ this._hideButton();
15
+ };
16
+ this._btnController = new BtnController(this, this._dispatchClickedEvent);
17
+ }
18
+ connectedCallback() {
19
+ super.connectedCallback();
20
+ this.setupEvents();
21
+ this.classList.add(SHOW_MORE_CSS_CLASS);
22
+ }
23
+ _hideButton() {
24
+ this.setAttribute(SHOW_MORE_HIDDEN_ATTRIBUTE, '');
25
+ }
26
+ setupEvents() {
27
+ this.addEventListener('click', this._dispatchClickedEvent);
28
+ }
29
+ };
30
+ HShowMoreColorItems = __decorate([
31
+ phoenixCustomElement('h-color-swatches-show-more'),
32
+ __metadata("design:paramtypes", [])
33
+ ], HShowMoreColorItems);
34
+
35
+ export { HShowMoreColorItems };
36
+ //# 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;AACA;"}
@@ -0,0 +1,5 @@
1
+ export declare const SHOW_MORE_CSS_CLASS = "show-more";
2
+ export declare const SHOW_MORE_HIDDEN_ATTRIBUTE = "hidden";
3
+ export declare const SHOW_MORE_EVENT_NAMES: {
4
+ readonly showMore: "showMoreColorItems";
5
+ };
@@ -0,0 +1,8 @@
1
+ const SHOW_MORE_CSS_CLASS = 'show-more';
2
+ const SHOW_MORE_HIDDEN_ATTRIBUTE = 'hidden';
3
+ const SHOW_MORE_EVENT_NAMES = {
4
+ showMore: 'showMoreColorItems'
5
+ };
6
+
7
+ export { SHOW_MORE_CSS_CLASS, SHOW_MORE_EVENT_NAMES, SHOW_MORE_HIDDEN_ATTRIBUTE };
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;"}
@@ -1,5 +1,10 @@
1
+ import { TemplateResult } from 'lit';
1
2
  import { PhoenixLightLitElement } from "../../../core/phoenix_light_lit_element/phoenix_light_lit_element";
2
3
  export declare class HColorSwatchesControl extends PhoenixLightLitElement {
3
4
  name: string;
4
5
  error: boolean;
6
+ selectedColors: string | string[];
7
+ connectedCallback(): void;
8
+ private _setupEvents;
9
+ protected render(): TemplateResult;
5
10
  }
@@ -1,19 +1,43 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import { phoenixCustomElement } from '@phoenixRoot/core/decorators/phoenix_custom_element';
3
- import { PhoenixLightLitElement } from '@phoenixRoot/core/phoenix_light_lit_element/phoenix_light_lit_element';
4
- import { property } from 'lit/decorators';
5
- let HColorSwatchesControl = class HColorSwatchesControl extends PhoenixLightLitElement {
6
- };
7
- __decorate([
8
- property({ type: String }),
9
- __metadata("design:type", String)
10
- ], HColorSwatchesControl.prototype, "name", void 0);
11
- __decorate([
12
- property({ type: Boolean }),
13
- __metadata("design:type", Boolean)
14
- ], HColorSwatchesControl.prototype, "error", void 0);
15
- HColorSwatchesControl = __decorate([
16
- phoenixCustomElement('h-color-swatches-control')
1
+ import { __decorate, __metadata } from '../../../../../../external/tslib/tslib.es6.js';
2
+ import { html } from 'lit';
3
+ import { property, state } from 'lit/decorators';
4
+ import { PhoenixLightLitElement } from '../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
5
+ import { phoenixCustomElement } from '../../../core/decorators/phoenix_custom_element.js';
6
+ import { COLOR_SWATCHES_EVENT_NAMES } from '../../color_swatches/color_swatches_constants.js';
7
+
8
+ let HColorSwatchesControl = class HColorSwatchesControl extends PhoenixLightLitElement {
9
+ connectedCallback() {
10
+ super.connectedCallback();
11
+ this._setupEvents();
12
+ }
13
+ _setupEvents() {
14
+ this.addEventListener(COLOR_SWATCHES_EVENT_NAMES.selected, (event) => {
15
+ this.selectedColors = event.detail.colors;
16
+ });
17
+ }
18
+ render() {
19
+ return html `
20
+ <h-input hidden="true">
21
+ <h-input-control value="${this.selectedColors}"></h-input-control>
22
+ </h-input>
23
+ `;
24
+ }
25
+ };
26
+ __decorate([
27
+ property({ type: String }),
28
+ __metadata("design:type", String)
29
+ ], HColorSwatchesControl.prototype, "name", void 0);
30
+ __decorate([
31
+ property({ type: Boolean }),
32
+ __metadata("design:type", Boolean)
33
+ ], HColorSwatchesControl.prototype, "error", void 0);
34
+ __decorate([
35
+ state(),
36
+ __metadata("design:type", Object)
37
+ ], HColorSwatchesControl.prototype, "selectedColors", void 0);
38
+ HColorSwatchesControl = __decorate([
39
+ phoenixCustomElement('h-color-swatches-control')
17
40
  ], HColorSwatchesControl);
41
+
18
42
  export { HColorSwatchesControl };
19
- //# sourceMappingURL=color_swatches_control.js.map
43
+ //# sourceMappingURL=color_swatches_control.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"color_swatches_control.js","sourceRoot":"","sources":["../../../../../../../../src/components/form/color_swatches/color_swatches_control.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qDAAqD,CAAC;AAC3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,uEAAuE,CAAC;AAC/G,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C,IAAa,qBAAqB,GAAlC,MAAa,qBAAsB,SAAQ,sBAAsB;CAMhE,CAAA;AAJG;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDACP;AAGpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;oDACN;AALb,qBAAqB;IADjC,oBAAoB,CAAC,0BAA0B,CAAC;GACpC,qBAAqB,CAMjC;SANY,qBAAqB"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -1,5 +1,5 @@
1
- import { PropertyValues } from 'lit';
2
1
  import { PhoenixLightLitElement } from "../../../core/phoenix_light_lit_element/phoenix_light_lit_element";
2
+ import { PropertyValues } from 'lit';
3
3
  export declare class HToggleButton extends PhoenixLightLitElement {
4
4
  toggledOn: boolean;
5
5
  willUpdate(propertyValues: PropertyValues): void;
@@ -65,6 +65,10 @@ export { RelativePositionController } from './controllers/relative_position_cont
65
65
  export { ToggleElementAriaController } from './controllers/toggle_element_aria_controller/toggle_element_aria_controller';
66
66
  export { HBackdrop } from './components/backdrop/backdrop';
67
67
  export { BackdropController } from "./components/backdrop/controller/backdrop_controller";
68
+ export { HColorSwatchesControl } from './components/form/color_swatches/color_swatches_control';
69
+ export { HColorSwatches } from './components/color_swatches/color_swatches';
70
+ export { HColorItem } from './components/color_swatches/color_item/color_item';
71
+ export { HShowMoreColorItems } from './components/color_swatches/show-more/show_more';
68
72
  export { VisibilityController } from './controllers/visibility_controller/visibility_controller';
69
73
  export * from './controllers/visibility_controller/visibility_controller_types';
70
74
  export { HSlider } from './components/slider/slider';
@@ -56,6 +56,10 @@ export { HToggleButtonGroup } from './components/groups/toggle_button_group/togg
56
56
  export { HToggleButton } from './components/groups/toggle_button_group/toggle_button.js';
57
57
  export { CLICK_OUTSIDE_CONTROLLER_MESSAGES } from './controllers/click_outside_controller/click_outside_controller_messages.js';
58
58
  export { HBackdrop } from './components/backdrop/backdrop.js';
59
+ export { HColorSwatchesControl } from './components/form/color_swatches/color_swatches_control.js';
60
+ export { HColorItem } from './components/color_swatches/color_item/color_item.js';
61
+ export { HColorSwatches } from './components/color_swatches/color_swatches.js';
62
+ export { HShowMoreColorItems } from './components/color_swatches/show-more/show_more.js';
59
63
  export { VisibilityController } from './controllers/visibility_controller/visibility_controller.js';
60
64
  export { HSlider } from './components/slider/slider.js';
61
65
  export { HTab } from './components/tabs/tab/tab.js';
@@ -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;"}
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;"}
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": "0.22.5-0",
5
+ "version": "0.22.5-10",
6
6
  "description": "phoenix design system",
7
7
  "author": "zefirek",
8
8
  "license": "MIT",