@shoper/phoenix_design_system 0.23.0 → 0.24.0
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 +70 -0
- package/build/cjs/packages/phoenix/src/components/color_swatches/color_item/color_item.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/color_swatches/color_item/color_item_constants.js +12 -0
- package/build/cjs/packages/phoenix/src/components/color_swatches/color_item/color_item_constants.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches.js +115 -0
- package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches_constants.js +22 -0
- package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches_constants.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/color_swatches/show-more/show_more.js +38 -0
- package/build/cjs/packages/phoenix/src/components/color_swatches/show-more/show_more.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/color_swatches/show-more/show_more_constants.js +12 -0
- package/build/cjs/packages/phoenix/src/components/color_swatches/show-more/show_more_constants.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/form/color_swatches_control/color_swatches_control.js +73 -0
- package/build/cjs/packages/phoenix/src/components/form/color_swatches_control/color_swatches_control.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/form/color_swatches_control/color_swatches_control_constants.js +13 -0
- package/build/cjs/packages/phoenix/src/components/form/color_swatches_control/color_swatches_control_constants.js.map +1 -0
- package/build/cjs/packages/phoenix/src/index.js +28 -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.d.ts +14 -0
- package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item.js +68 -0
- package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item_constants.d.ts +4 -0
- package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item_constants.js +7 -0
- package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item_constants.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item_types.d.ts +5 -0
- package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item_types.js +2 -0
- package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item_types.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.d.ts +21 -0
- package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.js +113 -0
- package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.d.ts +11 -0
- package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.js +15 -0
- package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_types.d.ts +3 -0
- package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_types.js +2 -0
- package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_types.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/color_swatches/show-more/show_more.d.ts +9 -0
- package/build/esm/packages/phoenix/src/components/color_swatches/show-more/show_more.js +36 -0
- package/build/esm/packages/phoenix/src/components/color_swatches/show-more/show_more.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/color_swatches/show-more/show_more_constants.d.ts +4 -0
- package/build/esm/packages/phoenix/src/components/color_swatches/show-more/show_more_constants.js +7 -0
- package/build/esm/packages/phoenix/src/components/color_swatches/show-more/show_more_constants.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/form/color_swatches_control/color_swatches_control.d.ts +14 -0
- package/build/esm/packages/phoenix/src/components/form/color_swatches_control/color_swatches_control.js +71 -0
- package/build/esm/packages/phoenix/src/components/form/color_swatches_control/color_swatches_control.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/form/color_swatches_control/color_swatches_control_constants.d.ts +5 -0
- package/build/esm/packages/phoenix/src/components/form/color_swatches_control/color_swatches_control_constants.js +9 -0
- package/build/esm/packages/phoenix/src/components/form/color_swatches_control/color_swatches_control_constants.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/groups/toggle_button_group/toggle_button.d.ts +1 -1
- package/build/esm/packages/phoenix/src/index.d.ts +4 -0
- package/build/esm/packages/phoenix/src/index.js +4 -0
- package/build/esm/packages/phoenix/src/index.js.map +1 -1
- 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;"}
|
package/build/cjs/packages/phoenix/src/components/color_swatches/color_item/color_item_constants.js
ADDED
|
@@ -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,115 @@
|
|
|
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.multiple = false;
|
|
17
|
+
this.selectedColors = [];
|
|
18
|
+
this._handleColorClicked = ({ target }) => {
|
|
19
|
+
const $colorItem = target;
|
|
20
|
+
this.multiple ? this._handleColorClickedForMultipleMode($colorItem) : this._handleColorClickedForSingleMode($colorItem);
|
|
21
|
+
};
|
|
22
|
+
this._dispatchColorSelectEvent = () => {
|
|
23
|
+
const detail = {
|
|
24
|
+
colors: this._setColorsDispatchValue(this.selectedColors)
|
|
25
|
+
};
|
|
26
|
+
this.dispatchEvent(new CustomEvent(color_swatches_constants.COLOR_SWATCHES_EVENT_NAMES.selected, {
|
|
27
|
+
bubbles: true,
|
|
28
|
+
detail
|
|
29
|
+
}));
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
connectedCallback() {
|
|
33
|
+
super.connectedCallback();
|
|
34
|
+
this._setupEvents();
|
|
35
|
+
this._addCssClasses();
|
|
36
|
+
this.numberOfVisibleColors && this._hideItems(this.numberOfVisibleColors);
|
|
37
|
+
this._showAllItemsEvent();
|
|
38
|
+
}
|
|
39
|
+
_addCssClasses() {
|
|
40
|
+
this.querySelectorAll(color_swatches_constants.COLOR_ITEM_TAG_NAME).forEach(($colorItem) => $colorItem.classList.add(color_swatches_constants.COLOR_SWATCHES_CSS_CLASSES.colorSwatchesItem));
|
|
41
|
+
this.classList.add(color_swatches_constants.COLOR_SWATCHES_CSS_CLASSES.colorSwatches);
|
|
42
|
+
}
|
|
43
|
+
_hideItems(numberOfVisibleColors) {
|
|
44
|
+
this.querySelectorAll(color_swatches_constants.COLOR_ITEM_TAG_NAME).forEach(($colorItem, index) => {
|
|
45
|
+
if (index > numberOfVisibleColors - 1) {
|
|
46
|
+
$colorItem.setAttribute(color_swatches_constants.COLOR_SWATCHES_HIDDEN_ATTRIBUTE, '');
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
_showAllItemsEvent() {
|
|
51
|
+
this.addEventListener(show_more_constants.SHOW_MORE_EVENT_NAMES.showMore, () => {
|
|
52
|
+
var _a;
|
|
53
|
+
this.querySelectorAll(color_swatches_constants.COLOR_ITEM_TAG_NAME).forEach(($colorItem) => {
|
|
54
|
+
$colorItem.removeAttribute(color_swatches_constants.COLOR_SWATCHES_HIDDEN_ATTRIBUTE);
|
|
55
|
+
});
|
|
56
|
+
(_a = this.querySelector('h-color-swatches-show-more')) === null || _a === void 0 ? void 0 : _a.setAttribute(color_swatches_constants.COLOR_SWATCHES_HIDDEN_ATTRIBUTE, '');
|
|
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
|
+
this.selectedColors = $previouslySelected === $colorItem ? [] : [$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, "multiple", void 0);
|
|
104
|
+
tslib_es6.__decorate([
|
|
105
|
+
decorators.property({ type: Number, attribute: 'number-of-visible-colors' }),
|
|
106
|
+
tslib_es6.__metadata("design:type", Number)
|
|
107
|
+
], exports.HColorSwatches.prototype, "numberOfVisibleColors", void 0);
|
|
108
|
+
tslib_es6.__decorate([
|
|
109
|
+
decorators.state(),
|
|
110
|
+
tslib_es6.__metadata("design:type", Array)
|
|
111
|
+
], exports.HColorSwatches.prototype, "selectedColors", void 0);
|
|
112
|
+
exports.HColorSwatches = tslib_es6.__decorate([
|
|
113
|
+
phoenix_custom_element.phoenixCustomElement('h-color-swatches')
|
|
114
|
+
], exports.HColorSwatches);
|
|
115
|
+
//# 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;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const baseCssClass = 'color-swatches';
|
|
6
|
+
const COLOR_ITEM_TAG_NAME = 'h-color-item';
|
|
7
|
+
const COLOR_SWATCHES_CSS_CLASSES = {
|
|
8
|
+
colorItem: 'color-item',
|
|
9
|
+
colorSwatches: baseCssClass,
|
|
10
|
+
colorSwatchesItem: `${baseCssClass}__color-item`,
|
|
11
|
+
colorSwatchesItems: `${baseCssClass}__color-items`
|
|
12
|
+
};
|
|
13
|
+
const COLOR_SWATCHES_EVENT_NAMES = {
|
|
14
|
+
selected: 'colorSwatchesSelected'
|
|
15
|
+
};
|
|
16
|
+
const COLOR_SWATCHES_HIDDEN_ATTRIBUTE = 'hidden';
|
|
17
|
+
|
|
18
|
+
exports.COLOR_ITEM_TAG_NAME = COLOR_ITEM_TAG_NAME;
|
|
19
|
+
exports.COLOR_SWATCHES_CSS_CLASSES = COLOR_SWATCHES_CSS_CLASSES;
|
|
20
|
+
exports.COLOR_SWATCHES_EVENT_NAMES = COLOR_SWATCHES_EVENT_NAMES;
|
|
21
|
+
exports.COLOR_SWATCHES_HIDDEN_ATTRIBUTE = COLOR_SWATCHES_HIDDEN_ATTRIBUTE;
|
|
22
|
+
//# sourceMappingURL=color_swatches_constants.js.map
|
package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches_constants.js.map
ADDED
|
@@ -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;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.HColorSwatchesShowMore = class HColorSwatchesShowMore 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
|
+
};
|
|
19
|
+
this._btnController = new btn_controller.BtnController(this, this._dispatchClickedEvent);
|
|
20
|
+
}
|
|
21
|
+
connectedCallback() {
|
|
22
|
+
super.connectedCallback();
|
|
23
|
+
this.setupEvents();
|
|
24
|
+
this._addCssClasses();
|
|
25
|
+
this.classList.add(show_more_constants.SHOW_MORE_CSS_CLASS);
|
|
26
|
+
}
|
|
27
|
+
_addCssClasses() {
|
|
28
|
+
this.classList.add(show_more_constants.SHOW_MORE_CSS_CLASS);
|
|
29
|
+
}
|
|
30
|
+
setupEvents() {
|
|
31
|
+
this.addEventListener('click', this._dispatchClickedEvent);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
exports.HColorSwatchesShowMore = tslib_es6.__decorate([
|
|
35
|
+
phoenix_custom_element.phoenixCustomElement('h-color-swatches-show-more'),
|
|
36
|
+
tslib_es6.__metadata("design:paramtypes", [])
|
|
37
|
+
], exports.HColorSwatchesShowMore);
|
|
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;"}
|
package/build/cjs/packages/phoenix/src/components/color_swatches/show-more/show_more_constants.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const SHOW_MORE_CSS_CLASS = 'color-swatches-show-more';
|
|
6
|
+
const SHOW_MORE_EVENT_NAMES = {
|
|
7
|
+
showMore: 'colorSwatchesShowMore'
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
exports.SHOW_MORE_CSS_CLASS = SHOW_MORE_CSS_CLASS;
|
|
11
|
+
exports.SHOW_MORE_EVENT_NAMES = SHOW_MORE_EVENT_NAMES;
|
|
12
|
+
//# 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;"}
|
|
@@ -0,0 +1,73 @@
|
|
|
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 input_constants = require('../input/input_constants.js');
|
|
11
|
+
var index = require('../../../../external/classnames/index.js');
|
|
12
|
+
var color_swatches_control_constants = require('./color_swatches_control_constants.js');
|
|
13
|
+
var color_swatches_constants = require('../../color_swatches/color_swatches_constants.js');
|
|
14
|
+
|
|
15
|
+
exports.HColorSwatchesControl = class HColorSwatchesControl extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
16
|
+
connectedCallback() {
|
|
17
|
+
super.connectedCallback();
|
|
18
|
+
this._setupEvents();
|
|
19
|
+
this.classList.add(color_swatches_control_constants.COLOR_SWATCHES_CONTROL_CSS_CLASSES.colorSwatchesControl);
|
|
20
|
+
const cssClasses = index['default']({
|
|
21
|
+
[color_swatches_control_constants.COLOR_SWATCHES_CONTROL_CSS_CLASSES.colorSwatchesControlDisabled]: this.disabled,
|
|
22
|
+
[color_swatches_control_constants.COLOR_SWATCHES_CONTROL_CSS_CLASSES.colorSwatchesControlError]: this.error
|
|
23
|
+
});
|
|
24
|
+
if (cssClasses)
|
|
25
|
+
this.classList.add(cssClasses);
|
|
26
|
+
}
|
|
27
|
+
_setupEvents() {
|
|
28
|
+
this.addEventListener(color_swatches_constants.COLOR_SWATCHES_EVENT_NAMES.selected, (event) => {
|
|
29
|
+
const eventValue = event.detail.colors;
|
|
30
|
+
this.selectedColors = Array.isArray(eventValue) ? this._serializeArrayOfColors(eventValue) : eventValue;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
_serializeArrayOfColors(colors) {
|
|
34
|
+
return colors.reduce((colorPrev, colorCurr) => {
|
|
35
|
+
return colorPrev ? `${colorPrev}, ${colorCurr}` : colorCurr;
|
|
36
|
+
}, '');
|
|
37
|
+
}
|
|
38
|
+
render() {
|
|
39
|
+
return lit.html `
|
|
40
|
+
<h-input controlName="${this.name}">
|
|
41
|
+
<h-input-control type="${input_constants.INPUT_CONTROL_TYPES.hidden}" value="${this.selectedColors}"></h-input-control>
|
|
42
|
+
</h-input>
|
|
43
|
+
`;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
tslib_es6.__decorate([
|
|
47
|
+
decorators.property({ type: String, attribute: 'control-id' }),
|
|
48
|
+
tslib_es6.__metadata("design:type", String)
|
|
49
|
+
], exports.HColorSwatchesControl.prototype, "controlId", void 0);
|
|
50
|
+
tslib_es6.__decorate([
|
|
51
|
+
decorators.property({ type: String }),
|
|
52
|
+
tslib_es6.__metadata("design:type", String)
|
|
53
|
+
], exports.HColorSwatchesControl.prototype, "name", void 0);
|
|
54
|
+
tslib_es6.__decorate([
|
|
55
|
+
decorators.property({ type: Boolean }),
|
|
56
|
+
tslib_es6.__metadata("design:type", Boolean)
|
|
57
|
+
], exports.HColorSwatchesControl.prototype, "disabled", void 0);
|
|
58
|
+
tslib_es6.__decorate([
|
|
59
|
+
decorators.property({ type: Boolean }),
|
|
60
|
+
tslib_es6.__metadata("design:type", Boolean)
|
|
61
|
+
], exports.HColorSwatchesControl.prototype, "required", void 0);
|
|
62
|
+
tslib_es6.__decorate([
|
|
63
|
+
decorators.property({ type: Boolean }),
|
|
64
|
+
tslib_es6.__metadata("design:type", Boolean)
|
|
65
|
+
], exports.HColorSwatchesControl.prototype, "error", void 0);
|
|
66
|
+
tslib_es6.__decorate([
|
|
67
|
+
decorators.state(),
|
|
68
|
+
tslib_es6.__metadata("design:type", Object)
|
|
69
|
+
], exports.HColorSwatchesControl.prototype, "selectedColors", void 0);
|
|
70
|
+
exports.HColorSwatchesControl = tslib_es6.__decorate([
|
|
71
|
+
phoenix_custom_element.phoenixCustomElement('h-color-swatches-control')
|
|
72
|
+
], exports.HColorSwatchesControl);
|
|
73
|
+
//# 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,oBAAoB,0CAA8C;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const baseColorSwatchesControlClass = 'color-swatches-control';
|
|
6
|
+
const COLOR_SWATCHES_CONTROL_CSS_CLASSES = {
|
|
7
|
+
colorSwatchesControl: baseColorSwatchesControlClass,
|
|
8
|
+
colorSwatchesControlDisabled: `${baseColorSwatchesControlClass}_disabled`,
|
|
9
|
+
colorSwatchesControlError: `${baseColorSwatchesControlClass}_error`
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
exports.COLOR_SWATCHES_CONTROL_CSS_CLASSES = COLOR_SWATCHES_CONTROL_CSS_CLASSES;
|
|
13
|
+
//# sourceMappingURL=color_swatches_control_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;"}
|
|
@@ -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_control/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');
|
|
@@ -346,6 +350,30 @@ Object.defineProperty(exports, 'HBackdrop', {
|
|
|
346
350
|
return backdrop.HBackdrop;
|
|
347
351
|
}
|
|
348
352
|
});
|
|
353
|
+
Object.defineProperty(exports, 'HColorSwatchesControl', {
|
|
354
|
+
enumerable: true,
|
|
355
|
+
get: function () {
|
|
356
|
+
return color_swatches_control.HColorSwatchesControl;
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
Object.defineProperty(exports, 'HColorItem', {
|
|
360
|
+
enumerable: true,
|
|
361
|
+
get: function () {
|
|
362
|
+
return color_item.HColorItem;
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
Object.defineProperty(exports, 'HColorSwatches', {
|
|
366
|
+
enumerable: true,
|
|
367
|
+
get: function () {
|
|
368
|
+
return color_swatches.HColorSwatches;
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
Object.defineProperty(exports, 'HColorSwatchesShowMore', {
|
|
372
|
+
enumerable: true,
|
|
373
|
+
get: function () {
|
|
374
|
+
return show_more.HColorSwatchesShowMore;
|
|
375
|
+
}
|
|
376
|
+
});
|
|
349
377
|
exports.VisibilityController = visibility_controller.VisibilityController;
|
|
350
378
|
Object.defineProperty(exports, 'HSlider', {
|
|
351
379
|
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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PhoenixLightLitElement } from "../../../core/phoenix_light_lit_element/phoenix_light_lit_element";
|
|
2
|
+
export declare class HColorItem extends PhoenixLightLitElement {
|
|
3
|
+
color: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
selected: boolean;
|
|
7
|
+
private _btnController;
|
|
8
|
+
constructor();
|
|
9
|
+
connectedCallback(): void;
|
|
10
|
+
attributeChangedCallback(name: string, value: string | null, newValue: string | null): void;
|
|
11
|
+
private _syncAriaPressed;
|
|
12
|
+
private setupEvents;
|
|
13
|
+
private _dispatchClickedEvent;
|
|
14
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { __decorate, __metadata } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { property } from 'lit/decorators';
|
|
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", [])
|
|
65
|
+
], HColorItem);
|
|
66
|
+
|
|
67
|
+
export { HColorItem };
|
|
68
|
+
//# sourceMappingURL=color_item.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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;"}
|
package/build/esm/packages/phoenix/src/components/color_swatches/color_item/color_item_types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color_item_types.js","sourceRoot":"","sources":["../../../../../../../../src/components/color_swatches/color_item/color_item_types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { HColorItem } from "./color_item/color_item";
|
|
2
|
+
import { PhoenixLightLitElement } from "../../core/phoenix_light_lit_element/phoenix_light_lit_element";
|
|
3
|
+
export declare class HColorSwatches extends PhoenixLightLitElement {
|
|
4
|
+
multiple: boolean;
|
|
5
|
+
numberOfVisibleColors: number;
|
|
6
|
+
selectedColors: HColorItem[];
|
|
7
|
+
connectedCallback(): void;
|
|
8
|
+
private _addCssClasses;
|
|
9
|
+
private _hideItems;
|
|
10
|
+
private _showAllItemsEvent;
|
|
11
|
+
private _setupEvents;
|
|
12
|
+
private _handleColorClicked;
|
|
13
|
+
private _handleColorClickedForMultipleMode;
|
|
14
|
+
private _handleColorClickedForSingleMode;
|
|
15
|
+
private _toggleSelectedAttribute;
|
|
16
|
+
private _isColorAlreadyExistInArray;
|
|
17
|
+
private _removeExistingColorFromArray;
|
|
18
|
+
private _dispatchColorSelectEvent;
|
|
19
|
+
private _setColorsDispatchValue;
|
|
20
|
+
private _getOnlyColorValues;
|
|
21
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { __decorate, __metadata } from '../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { property, state } from 'lit/decorators';
|
|
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_ITEM_TAG_NAME, 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.multiple = false;
|
|
13
|
+
this.selectedColors = [];
|
|
14
|
+
this._handleColorClicked = ({ target }) => {
|
|
15
|
+
const $colorItem = target;
|
|
16
|
+
this.multiple ? this._handleColorClickedForMultipleMode($colorItem) : this._handleColorClickedForSingleMode($colorItem);
|
|
17
|
+
};
|
|
18
|
+
this._dispatchColorSelectEvent = () => {
|
|
19
|
+
const detail = {
|
|
20
|
+
colors: this._setColorsDispatchValue(this.selectedColors)
|
|
21
|
+
};
|
|
22
|
+
this.dispatchEvent(new CustomEvent(COLOR_SWATCHES_EVENT_NAMES.selected, {
|
|
23
|
+
bubbles: true,
|
|
24
|
+
detail
|
|
25
|
+
}));
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
connectedCallback() {
|
|
29
|
+
super.connectedCallback();
|
|
30
|
+
this._setupEvents();
|
|
31
|
+
this._addCssClasses();
|
|
32
|
+
this.numberOfVisibleColors && this._hideItems(this.numberOfVisibleColors);
|
|
33
|
+
this._showAllItemsEvent();
|
|
34
|
+
}
|
|
35
|
+
_addCssClasses() {
|
|
36
|
+
this.querySelectorAll(COLOR_ITEM_TAG_NAME).forEach(($colorItem) => $colorItem.classList.add(COLOR_SWATCHES_CSS_CLASSES.colorSwatchesItem));
|
|
37
|
+
this.classList.add(COLOR_SWATCHES_CSS_CLASSES.colorSwatches);
|
|
38
|
+
}
|
|
39
|
+
_hideItems(numberOfVisibleColors) {
|
|
40
|
+
this.querySelectorAll(COLOR_ITEM_TAG_NAME).forEach(($colorItem, index) => {
|
|
41
|
+
if (index > numberOfVisibleColors - 1) {
|
|
42
|
+
$colorItem.setAttribute(COLOR_SWATCHES_HIDDEN_ATTRIBUTE, '');
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
_showAllItemsEvent() {
|
|
47
|
+
this.addEventListener(SHOW_MORE_EVENT_NAMES.showMore, () => {
|
|
48
|
+
var _a;
|
|
49
|
+
this.querySelectorAll(COLOR_ITEM_TAG_NAME).forEach(($colorItem) => {
|
|
50
|
+
$colorItem.removeAttribute(COLOR_SWATCHES_HIDDEN_ATTRIBUTE);
|
|
51
|
+
});
|
|
52
|
+
(_a = this.querySelector('h-color-swatches-show-more')) === null || _a === void 0 ? void 0 : _a.setAttribute(COLOR_SWATCHES_HIDDEN_ATTRIBUTE, '');
|
|
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
|
+
this.selectedColors = $previouslySelected === $colorItem ? [] : [$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, "multiple", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
property({ type: Number, attribute: 'number-of-visible-colors' }),
|
|
102
|
+
__metadata("design:type", Number)
|
|
103
|
+
], HColorSwatches.prototype, "numberOfVisibleColors", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
state(),
|
|
106
|
+
__metadata("design:type", Array)
|
|
107
|
+
], HColorSwatches.prototype, "selectedColors", void 0);
|
|
108
|
+
HColorSwatches = __decorate([
|
|
109
|
+
phoenixCustomElement('h-color-swatches')
|
|
110
|
+
], HColorSwatches);
|
|
111
|
+
|
|
112
|
+
export { HColorSwatches };
|
|
113
|
+
//# sourceMappingURL=color_swatches.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const COLOR_ITEM_TAG_NAME = "h-color-item";
|
|
2
|
+
export declare const COLOR_SWATCHES_CSS_CLASSES: {
|
|
3
|
+
readonly colorItem: "color-item";
|
|
4
|
+
readonly colorSwatches: "color-swatches";
|
|
5
|
+
readonly colorSwatchesItem: "color-swatches__color-item";
|
|
6
|
+
readonly colorSwatchesItems: "color-swatches__color-items";
|
|
7
|
+
};
|
|
8
|
+
export declare const COLOR_SWATCHES_EVENT_NAMES: {
|
|
9
|
+
readonly selected: "colorSwatchesSelected";
|
|
10
|
+
};
|
|
11
|
+
export declare const COLOR_SWATCHES_HIDDEN_ATTRIBUTE = "hidden";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const baseCssClass = 'color-swatches';
|
|
2
|
+
const COLOR_ITEM_TAG_NAME = 'h-color-item';
|
|
3
|
+
const COLOR_SWATCHES_CSS_CLASSES = {
|
|
4
|
+
colorItem: 'color-item',
|
|
5
|
+
colorSwatches: baseCssClass,
|
|
6
|
+
colorSwatchesItem: `${baseCssClass}__color-item`,
|
|
7
|
+
colorSwatchesItems: `${baseCssClass}__color-items`
|
|
8
|
+
};
|
|
9
|
+
const COLOR_SWATCHES_EVENT_NAMES = {
|
|
10
|
+
selected: 'colorSwatchesSelected'
|
|
11
|
+
};
|
|
12
|
+
const COLOR_SWATCHES_HIDDEN_ATTRIBUTE = 'hidden';
|
|
13
|
+
|
|
14
|
+
export { COLOR_ITEM_TAG_NAME, COLOR_SWATCHES_CSS_CLASSES, COLOR_SWATCHES_EVENT_NAMES, COLOR_SWATCHES_HIDDEN_ATTRIBUTE };
|
|
15
|
+
//# sourceMappingURL=color_swatches_constants.js.map
|
package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches_constants.js.map
ADDED
|
@@ -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;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color_swatches_types.js","sourceRoot":"","sources":["../../../../../../../src/components/color_swatches/color_swatches_types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PhoenixLightLitElement } from "../../../core/phoenix_light_lit_element/phoenix_light_lit_element";
|
|
2
|
+
export declare class HColorSwatchesShowMore extends PhoenixLightLitElement {
|
|
3
|
+
private _btnController;
|
|
4
|
+
constructor();
|
|
5
|
+
connectedCallback(): void;
|
|
6
|
+
private _addCssClasses;
|
|
7
|
+
private setupEvents;
|
|
8
|
+
private _dispatchClickedEvent;
|
|
9
|
+
}
|
|
@@ -0,0 +1,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 } from './show_more_constants.js';
|
|
6
|
+
|
|
7
|
+
let HColorSwatchesShowMore = class HColorSwatchesShowMore extends PhoenixLightLitElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
this._dispatchClickedEvent = () => {
|
|
11
|
+
this.dispatchEvent(new CustomEvent(SHOW_MORE_EVENT_NAMES.showMore, {
|
|
12
|
+
bubbles: true
|
|
13
|
+
}));
|
|
14
|
+
};
|
|
15
|
+
this._btnController = new BtnController(this, this._dispatchClickedEvent);
|
|
16
|
+
}
|
|
17
|
+
connectedCallback() {
|
|
18
|
+
super.connectedCallback();
|
|
19
|
+
this.setupEvents();
|
|
20
|
+
this._addCssClasses();
|
|
21
|
+
this.classList.add(SHOW_MORE_CSS_CLASS);
|
|
22
|
+
}
|
|
23
|
+
_addCssClasses() {
|
|
24
|
+
this.classList.add(SHOW_MORE_CSS_CLASS);
|
|
25
|
+
}
|
|
26
|
+
setupEvents() {
|
|
27
|
+
this.addEventListener('click', this._dispatchClickedEvent);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
HColorSwatchesShowMore = __decorate([
|
|
31
|
+
phoenixCustomElement('h-color-swatches-show-more'),
|
|
32
|
+
__metadata("design:paramtypes", [])
|
|
33
|
+
], HColorSwatchesShowMore);
|
|
34
|
+
|
|
35
|
+
export { HColorSwatchesShowMore };
|
|
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 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TemplateResult } from 'lit';
|
|
2
|
+
import { PhoenixLightLitElement } from "../../../core/phoenix_light_lit_element/phoenix_light_lit_element";
|
|
3
|
+
export declare class HColorSwatchesControl extends PhoenixLightLitElement {
|
|
4
|
+
controlId: string;
|
|
5
|
+
name: string;
|
|
6
|
+
disabled: boolean;
|
|
7
|
+
required: boolean;
|
|
8
|
+
error: boolean;
|
|
9
|
+
selectedColors: string | undefined;
|
|
10
|
+
connectedCallback(): void;
|
|
11
|
+
private _setupEvents;
|
|
12
|
+
private _serializeArrayOfColors;
|
|
13
|
+
protected render(): TemplateResult;
|
|
14
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
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 { INPUT_CONTROL_TYPES } from '../input/input_constants.js';
|
|
7
|
+
import classnames from '../../../../external/classnames/index.js';
|
|
8
|
+
import { COLOR_SWATCHES_CONTROL_CSS_CLASSES } from './color_swatches_control_constants.js';
|
|
9
|
+
import { COLOR_SWATCHES_EVENT_NAMES } from '../../color_swatches/color_swatches_constants.js';
|
|
10
|
+
|
|
11
|
+
let HColorSwatchesControl = class HColorSwatchesControl extends PhoenixLightLitElement {
|
|
12
|
+
connectedCallback() {
|
|
13
|
+
super.connectedCallback();
|
|
14
|
+
this._setupEvents();
|
|
15
|
+
this.classList.add(COLOR_SWATCHES_CONTROL_CSS_CLASSES.colorSwatchesControl);
|
|
16
|
+
const cssClasses = classnames({
|
|
17
|
+
[COLOR_SWATCHES_CONTROL_CSS_CLASSES.colorSwatchesControlDisabled]: this.disabled,
|
|
18
|
+
[COLOR_SWATCHES_CONTROL_CSS_CLASSES.colorSwatchesControlError]: this.error
|
|
19
|
+
});
|
|
20
|
+
if (cssClasses)
|
|
21
|
+
this.classList.add(cssClasses);
|
|
22
|
+
}
|
|
23
|
+
_setupEvents() {
|
|
24
|
+
this.addEventListener(COLOR_SWATCHES_EVENT_NAMES.selected, (event) => {
|
|
25
|
+
const eventValue = event.detail.colors;
|
|
26
|
+
this.selectedColors = Array.isArray(eventValue) ? this._serializeArrayOfColors(eventValue) : eventValue;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
_serializeArrayOfColors(colors) {
|
|
30
|
+
return colors.reduce((colorPrev, colorCurr) => {
|
|
31
|
+
return colorPrev ? `${colorPrev}, ${colorCurr}` : colorCurr;
|
|
32
|
+
}, '');
|
|
33
|
+
}
|
|
34
|
+
render() {
|
|
35
|
+
return html `
|
|
36
|
+
<h-input controlName="${this.name}">
|
|
37
|
+
<h-input-control type="${INPUT_CONTROL_TYPES.hidden}" value="${this.selectedColors}"></h-input-control>
|
|
38
|
+
</h-input>
|
|
39
|
+
`;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
__decorate([
|
|
43
|
+
property({ type: String, attribute: 'control-id' }),
|
|
44
|
+
__metadata("design:type", String)
|
|
45
|
+
], HColorSwatchesControl.prototype, "controlId", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
property({ type: String }),
|
|
48
|
+
__metadata("design:type", String)
|
|
49
|
+
], HColorSwatchesControl.prototype, "name", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
property({ type: Boolean }),
|
|
52
|
+
__metadata("design:type", Boolean)
|
|
53
|
+
], HColorSwatchesControl.prototype, "disabled", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
property({ type: Boolean }),
|
|
56
|
+
__metadata("design:type", Boolean)
|
|
57
|
+
], HColorSwatchesControl.prototype, "required", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
property({ type: Boolean }),
|
|
60
|
+
__metadata("design:type", Boolean)
|
|
61
|
+
], HColorSwatchesControl.prototype, "error", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
state(),
|
|
64
|
+
__metadata("design:type", Object)
|
|
65
|
+
], HColorSwatchesControl.prototype, "selectedColors", void 0);
|
|
66
|
+
HColorSwatchesControl = __decorate([
|
|
67
|
+
phoenixCustomElement('h-color-swatches-control')
|
|
68
|
+
], HColorSwatchesControl);
|
|
69
|
+
|
|
70
|
+
export { HColorSwatchesControl };
|
|
71
|
+
//# sourceMappingURL=color_swatches_control.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,uBAAuB,0CAA8C;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,9 @@
|
|
|
1
|
+
const baseColorSwatchesControlClass = 'color-swatches-control';
|
|
2
|
+
const COLOR_SWATCHES_CONTROL_CSS_CLASSES = {
|
|
3
|
+
colorSwatchesControl: baseColorSwatchesControlClass,
|
|
4
|
+
colorSwatchesControlDisabled: `${baseColorSwatchesControlClass}_disabled`,
|
|
5
|
+
colorSwatchesControlError: `${baseColorSwatchesControlClass}_error`
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export { COLOR_SWATCHES_CONTROL_CSS_CLASSES };
|
|
9
|
+
//# sourceMappingURL=color_swatches_control_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;"}
|
package/build/esm/packages/phoenix/src/components/groups/toggle_button_group/toggle_button.d.ts
CHANGED
|
@@ -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_control/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 { HColorSwatchesShowMore } 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_control/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 { HColorSwatchesShowMore } 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;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;"}
|