@shoper/phoenix_design_system 0.22.5-7 → 0.22.5-9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/packages/phoenix/src/components/color_swatches/color_item/color_item.js +1 -1
- package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches.js +62 -15
- package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches_constants.js +5 -2
- package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches_constants.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/color_swatches/color_swatches_control.js +45 -0
- package/build/cjs/packages/phoenix/src/components/form/color_swatches/color_swatches_control.js.map +1 -0
- package/build/cjs/packages/phoenix/src/index.js +7 -0
- package/build/cjs/packages/phoenix/src/index.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item.js +1 -1
- package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.d.ts +12 -2
- package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.js +62 -15
- package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.d.ts +2 -0
- package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.js +5 -3
- package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_types.d.ts +1 -1
- package/build/esm/packages/phoenix/src/components/form/color_swatches/color_swatches_control.d.ts +5 -0
- package/build/esm/packages/phoenix/src/components/form/color_swatches/color_swatches_control.js +41 -17
- package/build/esm/packages/phoenix/src/components/form/color_swatches/color_swatches_control.js.map +1 -1
- package/build/esm/packages/phoenix/src/index.d.ts +1 -0
- package/build/esm/packages/phoenix/src/index.js +1 -0
- package/build/esm/packages/phoenix/src/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -7,8 +7,8 @@ var decorators = require('lit/decorators');
|
|
|
7
7
|
var phoenix_light_lit_element = require('../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
|
|
8
8
|
var phoenix_custom_element = require('../../../core/decorators/phoenix_custom_element.js');
|
|
9
9
|
var btn_controller = require('../../../controllers/btn_controller.js');
|
|
10
|
-
var color_item_constants = require('./color_item_constants.js');
|
|
11
10
|
var color_swatches_constants = require('../color_swatches_constants.js');
|
|
11
|
+
var color_item_constants = require('./color_item_constants.js');
|
|
12
12
|
|
|
13
13
|
exports.HColorItem = class HColorItem extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
14
14
|
constructor() {
|
|
@@ -3,11 +3,12 @@
|
|
|
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 phoenix_light_lit_element = require('../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
|
|
8
9
|
var phoenix_custom_element = require('../../core/decorators/phoenix_custom_element.js');
|
|
9
|
-
var color_item_constants = require('./color_item/color_item_constants.js');
|
|
10
10
|
var color_swatches_constants = require('./color_swatches_constants.js');
|
|
11
|
+
var color_item_constants = require('./color_item/color_item_constants.js');
|
|
11
12
|
|
|
12
13
|
exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
13
14
|
constructor() {
|
|
@@ -21,7 +22,7 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
|
|
|
21
22
|
};
|
|
22
23
|
this._dispatchColorSelectEvent = () => {
|
|
23
24
|
const detail = {
|
|
24
|
-
colors: this.
|
|
25
|
+
colors: this._setColorsDispatchValue(this.selectedColors)
|
|
25
26
|
};
|
|
26
27
|
this.dispatchEvent(new CustomEvent(color_swatches_constants.COLOR_SWATCHES_EVENT_NAMES.selected, {
|
|
27
28
|
bubbles: true,
|
|
@@ -33,39 +34,73 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
|
|
|
33
34
|
super.connectedCallback();
|
|
34
35
|
this._setupEvents();
|
|
35
36
|
this._addCssClasses();
|
|
37
|
+
this._hideItems(this.itemsToShow);
|
|
36
38
|
}
|
|
37
39
|
_addCssClasses() {
|
|
38
40
|
this.querySelectorAll('h-color-item').forEach(($colorItem) => $colorItem.classList.add(color_swatches_constants.COLOR_SWATCHES_CSS_CLASSES.colorSwatchesItem));
|
|
39
41
|
this.classList.add(color_swatches_constants.COLOR_SWATCHES_CSS_CLASSES.colorSwatches);
|
|
40
42
|
}
|
|
43
|
+
_hideItems(itemsToShow) {
|
|
44
|
+
this.querySelectorAll('h-color-item').forEach(($colorItem, index) => {
|
|
45
|
+
if (index > itemsToShow - 1) {
|
|
46
|
+
$colorItem.setAttribute(color_swatches_constants.COLOR_SWATCHES_HIDDEN_ATTRIBUTE, '');
|
|
47
|
+
this.showMoreButton = true;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
_showAllItemsAndHideButton() {
|
|
52
|
+
var _a;
|
|
53
|
+
this.querySelectorAll('h-color-item').forEach(($colorItem) => {
|
|
54
|
+
$colorItem.removeAttribute(color_swatches_constants.COLOR_SWATCHES_HIDDEN_ATTRIBUTE);
|
|
55
|
+
});
|
|
56
|
+
(_a = this.querySelector(`.${color_swatches_constants.COLOR_SWATCHES_CSS_CLASSES.colorSwatchesShowMoreButton}`)) === null || _a === void 0 ? void 0 : _a.setAttribute(color_swatches_constants.COLOR_SWATCHES_HIDDEN_ATTRIBUTE, '');
|
|
57
|
+
}
|
|
41
58
|
_setupEvents() {
|
|
42
59
|
this.addEventListener(color_item_constants.COLOR_ITEM_EVENT_NAMES.selected, this._handleColorClicked);
|
|
43
60
|
}
|
|
44
61
|
_handleColorClickedForMultipleMode($colorItem) {
|
|
45
|
-
|
|
46
|
-
this.selectedColors = [...this.selectedColors, $colorItem]
|
|
47
|
-
|
|
48
|
-
$colorItem
|
|
49
|
-
? $colorItem.removeAttribute(color_item_constants.COLOR_ITEM_SELECTED_ATTRIBUTE)
|
|
50
|
-
: $colorItem.setAttribute(color_item_constants.COLOR_ITEM_SELECTED_ATTRIBUTE, '');
|
|
62
|
+
!this._isColorAlreadyExistInArray($colorItem)
|
|
63
|
+
? (this.selectedColors = [...this.selectedColors, $colorItem])
|
|
64
|
+
: this._removeExistingColorFromArray($colorItem);
|
|
65
|
+
this._toggleSelectedAttribute($colorItem);
|
|
51
66
|
this._dispatchColorSelectEvent();
|
|
52
67
|
}
|
|
53
68
|
_handleColorClickedForSingleMode($colorItem) {
|
|
54
69
|
const $previouslySelected = this.selectedColors[0];
|
|
55
|
-
$colorItem
|
|
56
|
-
? $colorItem.removeAttribute(color_item_constants.COLOR_ITEM_SELECTED_ATTRIBUTE)
|
|
57
|
-
: $colorItem.setAttribute(color_item_constants.COLOR_ITEM_SELECTED_ATTRIBUTE, '');
|
|
70
|
+
this._toggleSelectedAttribute($colorItem);
|
|
58
71
|
if ($previouslySelected && $previouslySelected !== $colorItem)
|
|
59
72
|
$previouslySelected.removeAttribute(color_item_constants.COLOR_ITEM_SELECTED_ATTRIBUTE);
|
|
60
|
-
this.selectedColors = [$colorItem];
|
|
73
|
+
$previouslySelected === $colorItem ? (this.selectedColors = []) : (this.selectedColors = [$colorItem]);
|
|
61
74
|
this._dispatchColorSelectEvent();
|
|
62
75
|
}
|
|
63
|
-
|
|
64
|
-
|
|
76
|
+
_toggleSelectedAttribute($colorItem) {
|
|
77
|
+
$colorItem.hasAttribute(color_item_constants.COLOR_ITEM_SELECTED_ATTRIBUTE)
|
|
78
|
+
? $colorItem.removeAttribute(color_item_constants.COLOR_ITEM_SELECTED_ATTRIBUTE)
|
|
79
|
+
: $colorItem.setAttribute(color_item_constants.COLOR_ITEM_SELECTED_ATTRIBUTE, '');
|
|
80
|
+
}
|
|
81
|
+
_isColorAlreadyExistInArray($colorItem) {
|
|
82
|
+
return this.selectedColors.includes($colorItem);
|
|
83
|
+
}
|
|
84
|
+
_removeExistingColorFromArray($colorItem) {
|
|
85
|
+
const indexOfAlreadyExistingColor = this.selectedColors.indexOf($colorItem);
|
|
86
|
+
this.selectedColors.splice(indexOfAlreadyExistingColor, 1);
|
|
87
|
+
}
|
|
88
|
+
_setColorsDispatchValue(selectedColors) {
|
|
89
|
+
if (this.selectedColors.length > 1)
|
|
90
|
+
return this._getOnlyColorValues(selectedColors);
|
|
91
|
+
if (this.selectedColors.length === 1)
|
|
92
|
+
return selectedColors[0].color;
|
|
93
|
+
return '';
|
|
65
94
|
}
|
|
66
|
-
|
|
95
|
+
_getOnlyColorValues(selectedColors) {
|
|
67
96
|
return selectedColors.map((selectedColor) => selectedColor.color);
|
|
68
97
|
}
|
|
98
|
+
render() {
|
|
99
|
+
return lit.html `${this.showMoreButton &&
|
|
100
|
+
lit.html `<button class="${color_swatches_constants.COLOR_SWATCHES_CSS_CLASSES.colorSwatchesShowMoreButton}" @click="${this._showAllItemsAndHideButton}">
|
|
101
|
+
${this.showMoreButtonText}
|
|
102
|
+
</button>`}`;
|
|
103
|
+
}
|
|
69
104
|
};
|
|
70
105
|
tslib_es6.__decorate([
|
|
71
106
|
decorators.property({ type: Boolean }),
|
|
@@ -75,10 +110,22 @@ tslib_es6.__decorate([
|
|
|
75
110
|
decorators.property({ type: Boolean }),
|
|
76
111
|
tslib_es6.__metadata("design:type", Object)
|
|
77
112
|
], exports.HColorSwatches.prototype, "multiple", void 0);
|
|
113
|
+
tslib_es6.__decorate([
|
|
114
|
+
decorators.property({ type: Number }),
|
|
115
|
+
tslib_es6.__metadata("design:type", Number)
|
|
116
|
+
], exports.HColorSwatches.prototype, "itemsToShow", void 0);
|
|
117
|
+
tslib_es6.__decorate([
|
|
118
|
+
decorators.property({ type: String }),
|
|
119
|
+
tslib_es6.__metadata("design:type", String)
|
|
120
|
+
], exports.HColorSwatches.prototype, "showMoreButtonText", void 0);
|
|
78
121
|
tslib_es6.__decorate([
|
|
79
122
|
decorators.state(),
|
|
80
123
|
tslib_es6.__metadata("design:type", Array)
|
|
81
124
|
], exports.HColorSwatches.prototype, "selectedColors", void 0);
|
|
125
|
+
tslib_es6.__decorate([
|
|
126
|
+
decorators.state(),
|
|
127
|
+
tslib_es6.__metadata("design:type", Boolean)
|
|
128
|
+
], exports.HColorSwatches.prototype, "showMoreButton", void 0);
|
|
82
129
|
exports.HColorSwatches = tslib_es6.__decorate([
|
|
83
130
|
phoenix_custom_element.phoenixCustomElement('h-color-swatches')
|
|
84
131
|
], 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;"}
|
|
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;"}
|
package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches_constants.js
CHANGED
|
@@ -6,12 +6,15 @@ const baseCssClass = 'color-swatches';
|
|
|
6
6
|
const COLOR_SWATCHES_CSS_CLASSES = {
|
|
7
7
|
colorItem: 'color-item',
|
|
8
8
|
colorSwatches: baseCssClass,
|
|
9
|
-
colorSwatchesItem: `${baseCssClass}__color-item
|
|
9
|
+
colorSwatchesItem: `${baseCssClass}__color-item`,
|
|
10
|
+
colorSwatchesShowMoreButton: `${baseCssClass}__show-more`
|
|
10
11
|
};
|
|
11
12
|
const COLOR_SWATCHES_EVENT_NAMES = {
|
|
12
13
|
selected: 'colorSwatchesSelected'
|
|
13
|
-
};
|
|
14
|
+
};
|
|
15
|
+
const COLOR_SWATCHES_HIDDEN_ATTRIBUTE = 'hidden';
|
|
14
16
|
|
|
15
17
|
exports.COLOR_SWATCHES_CSS_CLASSES = COLOR_SWATCHES_CSS_CLASSES;
|
|
16
18
|
exports.COLOR_SWATCHES_EVENT_NAMES = COLOR_SWATCHES_EVENT_NAMES;
|
|
19
|
+
exports.COLOR_SWATCHES_HIDDEN_ATTRIBUTE = COLOR_SWATCHES_HIDDEN_ATTRIBUTE;
|
|
17
20
|
//# sourceMappingURL=color_swatches_constants.js.map
|
package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches_constants.js.map
CHANGED
|
@@ -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;AACA;"}
|
package/build/cjs/packages/phoenix/src/components/form/color_swatches/color_swatches_control.js
ADDED
|
@@ -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
|
package/build/cjs/packages/phoenix/src/components/form/color_swatches/color_swatches_control.js.map
ADDED
|
@@ -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,7 @@ 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');
|
|
63
64
|
var color_item = require('./components/color_swatches/color_item/color_item.js');
|
|
64
65
|
var color_swatches = require('./components/color_swatches/color_swatches.js');
|
|
65
66
|
var visibility_controller = require('./controllers/visibility_controller/visibility_controller.js');
|
|
@@ -344,6 +345,12 @@ Object.defineProperty(exports, 'HBackdrop', {
|
|
|
344
345
|
return backdrop.HBackdrop;
|
|
345
346
|
}
|
|
346
347
|
});
|
|
348
|
+
Object.defineProperty(exports, 'HColorSwatchesControl', {
|
|
349
|
+
enumerable: true,
|
|
350
|
+
get: function () {
|
|
351
|
+
return color_swatches_control.HColorSwatchesControl;
|
|
352
|
+
}
|
|
353
|
+
});
|
|
347
354
|
Object.defineProperty(exports, 'HColorItem', {
|
|
348
355
|
enumerable: true,
|
|
349
356
|
get: function () {
|
|
@@ -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;"}
|
|
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;"}
|
|
@@ -3,8 +3,8 @@ import { property } from 'lit/decorators';
|
|
|
3
3
|
import { PhoenixLightLitElement } from '../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
|
|
4
4
|
import { phoenixCustomElement } from '../../../core/decorators/phoenix_custom_element.js';
|
|
5
5
|
import { BtnController } from '../../../controllers/btn_controller.js';
|
|
6
|
-
import { COLOR_ITEM_EVENT_NAMES, COLOR_ITEM_SELECTED_ATTRIBUTE } from './color_item_constants.js';
|
|
7
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
8
|
|
|
9
9
|
let HColorItem = class HColorItem extends PhoenixLightLitElement {
|
|
10
10
|
constructor() {
|
|
@@ -1,16 +1,26 @@
|
|
|
1
|
+
import { TemplateResult } from 'lit';
|
|
1
2
|
import { HColorItem } from "./color_item/color_item";
|
|
2
3
|
import { PhoenixLightLitElement } from "../../core/phoenix_light_lit_element/phoenix_light_lit_element";
|
|
3
4
|
export declare class HColorSwatches extends PhoenixLightLitElement {
|
|
4
5
|
inline: boolean;
|
|
5
6
|
multiple: boolean;
|
|
7
|
+
itemsToShow: number;
|
|
8
|
+
showMoreButtonText: string;
|
|
6
9
|
selectedColors: HColorItem[];
|
|
10
|
+
showMoreButton: boolean;
|
|
7
11
|
connectedCallback(): void;
|
|
8
12
|
private _addCssClasses;
|
|
13
|
+
private _hideItems;
|
|
14
|
+
private _showAllItemsAndHideButton;
|
|
9
15
|
private _setupEvents;
|
|
10
16
|
private _handleColorClicked;
|
|
11
17
|
private _handleColorClickedForMultipleMode;
|
|
12
18
|
private _handleColorClickedForSingleMode;
|
|
13
|
-
private
|
|
19
|
+
private _toggleSelectedAttribute;
|
|
20
|
+
private _isColorAlreadyExistInArray;
|
|
21
|
+
private _removeExistingColorFromArray;
|
|
14
22
|
private _dispatchColorSelectEvent;
|
|
15
|
-
private
|
|
23
|
+
private _setColorsDispatchValue;
|
|
24
|
+
private _getOnlyColorValues;
|
|
25
|
+
protected render(): TemplateResult;
|
|
16
26
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { __decorate, __metadata } from '../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { html } from 'lit';
|
|
2
3
|
import { property, state } from 'lit/decorators';
|
|
3
4
|
import { PhoenixLightLitElement } from '../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
|
|
4
5
|
import { phoenixCustomElement } from '../../core/decorators/phoenix_custom_element.js';
|
|
6
|
+
import { COLOR_SWATCHES_EVENT_NAMES, COLOR_SWATCHES_CSS_CLASSES, COLOR_SWATCHES_HIDDEN_ATTRIBUTE } from './color_swatches_constants.js';
|
|
5
7
|
import { COLOR_ITEM_EVENT_NAMES, COLOR_ITEM_SELECTED_ATTRIBUTE } from './color_item/color_item_constants.js';
|
|
6
|
-
import { COLOR_SWATCHES_EVENT_NAMES, COLOR_SWATCHES_CSS_CLASSES } from './color_swatches_constants.js';
|
|
7
8
|
|
|
8
9
|
let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
|
|
9
10
|
constructor() {
|
|
@@ -17,7 +18,7 @@ let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
|
|
|
17
18
|
};
|
|
18
19
|
this._dispatchColorSelectEvent = () => {
|
|
19
20
|
const detail = {
|
|
20
|
-
colors: this.
|
|
21
|
+
colors: this._setColorsDispatchValue(this.selectedColors)
|
|
21
22
|
};
|
|
22
23
|
this.dispatchEvent(new CustomEvent(COLOR_SWATCHES_EVENT_NAMES.selected, {
|
|
23
24
|
bubbles: true,
|
|
@@ -29,39 +30,73 @@ let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
|
|
|
29
30
|
super.connectedCallback();
|
|
30
31
|
this._setupEvents();
|
|
31
32
|
this._addCssClasses();
|
|
33
|
+
this._hideItems(this.itemsToShow);
|
|
32
34
|
}
|
|
33
35
|
_addCssClasses() {
|
|
34
36
|
this.querySelectorAll('h-color-item').forEach(($colorItem) => $colorItem.classList.add(COLOR_SWATCHES_CSS_CLASSES.colorSwatchesItem));
|
|
35
37
|
this.classList.add(COLOR_SWATCHES_CSS_CLASSES.colorSwatches);
|
|
36
38
|
}
|
|
39
|
+
_hideItems(itemsToShow) {
|
|
40
|
+
this.querySelectorAll('h-color-item').forEach(($colorItem, index) => {
|
|
41
|
+
if (index > itemsToShow - 1) {
|
|
42
|
+
$colorItem.setAttribute(COLOR_SWATCHES_HIDDEN_ATTRIBUTE, '');
|
|
43
|
+
this.showMoreButton = true;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
_showAllItemsAndHideButton() {
|
|
48
|
+
var _a;
|
|
49
|
+
this.querySelectorAll('h-color-item').forEach(($colorItem) => {
|
|
50
|
+
$colorItem.removeAttribute(COLOR_SWATCHES_HIDDEN_ATTRIBUTE);
|
|
51
|
+
});
|
|
52
|
+
(_a = this.querySelector(`.${COLOR_SWATCHES_CSS_CLASSES.colorSwatchesShowMoreButton}`)) === null || _a === void 0 ? void 0 : _a.setAttribute(COLOR_SWATCHES_HIDDEN_ATTRIBUTE, '');
|
|
53
|
+
}
|
|
37
54
|
_setupEvents() {
|
|
38
55
|
this.addEventListener(COLOR_ITEM_EVENT_NAMES.selected, this._handleColorClicked);
|
|
39
56
|
}
|
|
40
57
|
_handleColorClickedForMultipleMode($colorItem) {
|
|
41
|
-
|
|
42
|
-
this.selectedColors = [...this.selectedColors, $colorItem]
|
|
43
|
-
|
|
44
|
-
$colorItem
|
|
45
|
-
? $colorItem.removeAttribute(COLOR_ITEM_SELECTED_ATTRIBUTE)
|
|
46
|
-
: $colorItem.setAttribute(COLOR_ITEM_SELECTED_ATTRIBUTE, '');
|
|
58
|
+
!this._isColorAlreadyExistInArray($colorItem)
|
|
59
|
+
? (this.selectedColors = [...this.selectedColors, $colorItem])
|
|
60
|
+
: this._removeExistingColorFromArray($colorItem);
|
|
61
|
+
this._toggleSelectedAttribute($colorItem);
|
|
47
62
|
this._dispatchColorSelectEvent();
|
|
48
63
|
}
|
|
49
64
|
_handleColorClickedForSingleMode($colorItem) {
|
|
50
65
|
const $previouslySelected = this.selectedColors[0];
|
|
51
|
-
$colorItem
|
|
52
|
-
? $colorItem.removeAttribute(COLOR_ITEM_SELECTED_ATTRIBUTE)
|
|
53
|
-
: $colorItem.setAttribute(COLOR_ITEM_SELECTED_ATTRIBUTE, '');
|
|
66
|
+
this._toggleSelectedAttribute($colorItem);
|
|
54
67
|
if ($previouslySelected && $previouslySelected !== $colorItem)
|
|
55
68
|
$previouslySelected.removeAttribute(COLOR_ITEM_SELECTED_ATTRIBUTE);
|
|
56
|
-
this.selectedColors = [$colorItem];
|
|
69
|
+
$previouslySelected === $colorItem ? (this.selectedColors = []) : (this.selectedColors = [$colorItem]);
|
|
57
70
|
this._dispatchColorSelectEvent();
|
|
58
71
|
}
|
|
59
|
-
|
|
60
|
-
|
|
72
|
+
_toggleSelectedAttribute($colorItem) {
|
|
73
|
+
$colorItem.hasAttribute(COLOR_ITEM_SELECTED_ATTRIBUTE)
|
|
74
|
+
? $colorItem.removeAttribute(COLOR_ITEM_SELECTED_ATTRIBUTE)
|
|
75
|
+
: $colorItem.setAttribute(COLOR_ITEM_SELECTED_ATTRIBUTE, '');
|
|
76
|
+
}
|
|
77
|
+
_isColorAlreadyExistInArray($colorItem) {
|
|
78
|
+
return this.selectedColors.includes($colorItem);
|
|
79
|
+
}
|
|
80
|
+
_removeExistingColorFromArray($colorItem) {
|
|
81
|
+
const indexOfAlreadyExistingColor = this.selectedColors.indexOf($colorItem);
|
|
82
|
+
this.selectedColors.splice(indexOfAlreadyExistingColor, 1);
|
|
61
83
|
}
|
|
62
|
-
|
|
84
|
+
_setColorsDispatchValue(selectedColors) {
|
|
85
|
+
if (this.selectedColors.length > 1)
|
|
86
|
+
return this._getOnlyColorValues(selectedColors);
|
|
87
|
+
if (this.selectedColors.length === 1)
|
|
88
|
+
return selectedColors[0].color;
|
|
89
|
+
return '';
|
|
90
|
+
}
|
|
91
|
+
_getOnlyColorValues(selectedColors) {
|
|
63
92
|
return selectedColors.map((selectedColor) => selectedColor.color);
|
|
64
93
|
}
|
|
94
|
+
render() {
|
|
95
|
+
return html `${this.showMoreButton &&
|
|
96
|
+
html `<button class="${COLOR_SWATCHES_CSS_CLASSES.colorSwatchesShowMoreButton}" @click="${this._showAllItemsAndHideButton}">
|
|
97
|
+
${this.showMoreButtonText}
|
|
98
|
+
</button>`}`;
|
|
99
|
+
}
|
|
65
100
|
};
|
|
66
101
|
__decorate([
|
|
67
102
|
property({ type: Boolean }),
|
|
@@ -71,10 +106,22 @@ __decorate([
|
|
|
71
106
|
property({ type: Boolean }),
|
|
72
107
|
__metadata("design:type", Object)
|
|
73
108
|
], HColorSwatches.prototype, "multiple", void 0);
|
|
109
|
+
__decorate([
|
|
110
|
+
property({ type: Number }),
|
|
111
|
+
__metadata("design:type", Number)
|
|
112
|
+
], HColorSwatches.prototype, "itemsToShow", void 0);
|
|
113
|
+
__decorate([
|
|
114
|
+
property({ type: String }),
|
|
115
|
+
__metadata("design:type", String)
|
|
116
|
+
], HColorSwatches.prototype, "showMoreButtonText", void 0);
|
|
74
117
|
__decorate([
|
|
75
118
|
state(),
|
|
76
119
|
__metadata("design:type", Array)
|
|
77
120
|
], HColorSwatches.prototype, "selectedColors", void 0);
|
|
121
|
+
__decorate([
|
|
122
|
+
state(),
|
|
123
|
+
__metadata("design:type", Boolean)
|
|
124
|
+
], HColorSwatches.prototype, "showMoreButton", void 0);
|
|
78
125
|
HColorSwatches = __decorate([
|
|
79
126
|
phoenixCustomElement('h-color-swatches')
|
|
80
127
|
], 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;"}
|
|
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;"}
|
package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.d.ts
CHANGED
|
@@ -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";
|
package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.js
CHANGED
|
@@ -2,11 +2,13 @@ const baseCssClass = 'color-swatches';
|
|
|
2
2
|
const COLOR_SWATCHES_CSS_CLASSES = {
|
|
3
3
|
colorItem: 'color-item',
|
|
4
4
|
colorSwatches: baseCssClass,
|
|
5
|
-
colorSwatchesItem: `${baseCssClass}__color-item
|
|
5
|
+
colorSwatchesItem: `${baseCssClass}__color-item`,
|
|
6
|
+
colorSwatchesShowMoreButton: `${baseCssClass}__show-more`
|
|
6
7
|
};
|
|
7
8
|
const COLOR_SWATCHES_EVENT_NAMES = {
|
|
8
9
|
selected: 'colorSwatchesSelected'
|
|
9
|
-
};
|
|
10
|
+
};
|
|
11
|
+
const COLOR_SWATCHES_HIDDEN_ATTRIBUTE = 'hidden';
|
|
10
12
|
|
|
11
|
-
export { COLOR_SWATCHES_CSS_CLASSES, COLOR_SWATCHES_EVENT_NAMES };
|
|
13
|
+
export { COLOR_SWATCHES_CSS_CLASSES, COLOR_SWATCHES_EVENT_NAMES, COLOR_SWATCHES_HIDDEN_ATTRIBUTE };
|
|
12
14
|
//# sourceMappingURL=color_swatches_constants.js.map
|
package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;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;"}
|
package/build/esm/packages/phoenix/src/components/form/color_swatches/color_swatches_control.d.ts
CHANGED
|
@@ -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
|
}
|
package/build/esm/packages/phoenix/src/components/form/color_swatches/color_swatches_control.js
CHANGED
|
@@ -1,19 +1,43 @@
|
|
|
1
|
-
import { __decorate, __metadata } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
package/build/esm/packages/phoenix/src/components/form/color_swatches/color_swatches_control.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":
|
|
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;"}
|
|
@@ -65,6 +65,7 @@ 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';
|
|
68
69
|
export { HColorSwatches } from './components/color_swatches/color_swatches';
|
|
69
70
|
export { HColorItem } from './components/color_swatches/color_item/color_item';
|
|
70
71
|
export { VisibilityController } from './controllers/visibility_controller/visibility_controller';
|
|
@@ -56,6 +56,7 @@ 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';
|
|
59
60
|
export { HColorItem } from './components/color_swatches/color_item/color_item.js';
|
|
60
61
|
export { HColorSwatches } from './components/color_swatches/color_swatches.js';
|
|
61
62
|
export { VisibilityController } from './controllers/visibility_controller/visibility_controller.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;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;"}
|