@shoper/phoenix_design_system 1.18.25-0 → 1.18.25-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/packages/phoenix/src/components/accordion/accordion_content.js +16 -101
- package/build/cjs/packages/phoenix/src/components/accordion/accordion_content.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches.js +41 -0
- package/build/cjs/packages/phoenix/src/components/color_swatches/color_swatches.js.map +1 -1
- package/build/cjs/packages/phoenix/src/index.js +7 -7
- package/build/esm/packages/phoenix/src/components/accordion/accordion_content.d.ts +0 -4
- package/build/esm/packages/phoenix/src/components/accordion/accordion_content.js +16 -101
- package/build/esm/packages/phoenix/src/components/accordion/accordion_content.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.d.ts +5 -0
- package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.js +41 -0
- package/build/esm/packages/phoenix/src/components/color_swatches/color_swatches.js.map +1 -1
- package/build/esm/packages/phoenix/src/index.js +1 -1
- package/package.json +1 -1
|
@@ -13,18 +13,14 @@ var accordion_constants = require('./accordion_constants.js');
|
|
|
13
13
|
var transition_controller = require('../../controllers/transition_controller/transition_controller.js');
|
|
14
14
|
|
|
15
15
|
const RESIZE_DEBOUNCE_MS = 150;
|
|
16
|
-
const MUTATION_DEBOUNCE_MS = 100;
|
|
17
16
|
exports.HAccordionContent = class HAccordionContent extends phoenix_light_lit_element.PhoenixLightLitElement {
|
|
18
17
|
constructor() {
|
|
19
18
|
super();
|
|
20
19
|
this.transitionName = 'accordion-toggle';
|
|
21
|
-
this.isDevAccordionOptimizationFlagEnabled = false;
|
|
22
20
|
this.isDevAccordionHeightFixFlagEnabled = false;
|
|
23
21
|
this._resizeObserver = null;
|
|
24
22
|
this._isTransitioning = false;
|
|
25
23
|
this._resizeDebounceTimer = null;
|
|
26
|
-
this._mutationDebounceTimer = null;
|
|
27
|
-
this._mutationObserver = null;
|
|
28
24
|
this._handleResizeObserver = () => {
|
|
29
25
|
if (this._isTransitioning || this.hidden || this.style.height === '0px')
|
|
30
26
|
return;
|
|
@@ -63,62 +59,27 @@ exports.HAccordionContent = class HAccordionContent extends phoenix_light_lit_el
|
|
|
63
59
|
this._originalHeight = `${height}px`;
|
|
64
60
|
}
|
|
65
61
|
};
|
|
66
|
-
this._handleMutation = () => {
|
|
67
|
-
if (this._mutationDebounceTimer !== null) {
|
|
68
|
-
window.clearTimeout(this._mutationDebounceTimer);
|
|
69
|
-
}
|
|
70
|
-
this._mutationDebounceTimer = window.setTimeout(() => {
|
|
71
|
-
requestAnimationFrame(() => {
|
|
72
|
-
this.style.height = 'auto';
|
|
73
|
-
requestAnimationFrame(() => {
|
|
74
|
-
this._setOriginalHeightValue(this.getBoundingClientRect().height);
|
|
75
|
-
if (this.hidden) {
|
|
76
|
-
this.style.height = '0px';
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
this.style.height = this._originalHeight;
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
}, MUTATION_DEBOUNCE_MS);
|
|
84
|
-
};
|
|
85
62
|
this._expand = () => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
this._isTransitioning = true;
|
|
89
|
-
}
|
|
90
|
-
this._setHeight(this._originalHeight);
|
|
63
|
+
this._setOriginalHeightValue(this.scrollHeight);
|
|
64
|
+
this._isTransitioning = true;
|
|
91
65
|
};
|
|
92
66
|
this._handleTransitionEnd = (e) => {
|
|
93
67
|
if (e.propertyName !== 'height' || e.target !== this) {
|
|
94
68
|
return;
|
|
95
69
|
}
|
|
96
|
-
|
|
97
|
-
this._isTransitioning = false;
|
|
98
|
-
}
|
|
70
|
+
this._isTransitioning = false;
|
|
99
71
|
if (!this.hidden && this.style.height !== '0px') {
|
|
100
72
|
this.style.height = 'auto';
|
|
101
73
|
}
|
|
102
74
|
};
|
|
103
75
|
this._collapse = () => {
|
|
104
|
-
|
|
105
|
-
this._isTransitioning = true;
|
|
106
|
-
}
|
|
76
|
+
this._isTransitioning = true;
|
|
107
77
|
const currentHeight = this.getBoundingClientRect().height;
|
|
108
78
|
this._setHeight(`${currentHeight}px`);
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
requestAnimationFrame(() => {
|
|
117
|
-
requestAnimationFrame(() => {
|
|
118
|
-
this._setHeight('0px');
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
}
|
|
79
|
+
void this.offsetHeight;
|
|
80
|
+
requestAnimationFrame(() => {
|
|
81
|
+
this._setHeight('0px');
|
|
82
|
+
});
|
|
122
83
|
};
|
|
123
84
|
this.setAttribute('role', 'region');
|
|
124
85
|
this._boundHandleTransitionEnd = this._handleTransitionEnd.bind(this);
|
|
@@ -129,13 +90,8 @@ exports.HAccordionContent = class HAccordionContent extends phoenix_light_lit_el
|
|
|
129
90
|
this._contextConsumer = new context_consumer_controller.ContextConsumerController(this);
|
|
130
91
|
this._transitionController = new transition_controller.TransitionController(this, this.transitionName);
|
|
131
92
|
this._subscribeObserver();
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
this._resizeObserver.observe(this);
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
window.addEventListener('resize', this._handleResize, { passive: true });
|
|
138
|
-
}
|
|
93
|
+
this._resizeObserver = new ResizeObserver(this._handleResizeObserver);
|
|
94
|
+
this._resizeObserver.observe(this);
|
|
139
95
|
this.addEventListener('transitionend', this._boundHandleTransitionEnd);
|
|
140
96
|
if (this.isDevAccordionHeightFixFlagEnabled) {
|
|
141
97
|
this._setupImageLoadListeners();
|
|
@@ -143,13 +99,8 @@ exports.HAccordionContent = class HAccordionContent extends phoenix_light_lit_el
|
|
|
143
99
|
}
|
|
144
100
|
firstUpdated(props) {
|
|
145
101
|
super.firstUpdated(props);
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
this.style.height = this.hidden ? '0px' : this._originalHeight;
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
this._setStylingOptions();
|
|
152
|
-
}
|
|
102
|
+
this._updateOriginalHeight();
|
|
103
|
+
this.style.height = this.hidden ? '0px' : this._originalHeight;
|
|
153
104
|
}
|
|
154
105
|
_setupImageLoadListeners() {
|
|
155
106
|
const images = this.querySelectorAll('img');
|
|
@@ -161,24 +112,8 @@ exports.HAccordionContent = class HAccordionContent extends phoenix_light_lit_el
|
|
|
161
112
|
});
|
|
162
113
|
}
|
|
163
114
|
_handleImageLoad() {
|
|
164
|
-
if (this.
|
|
165
|
-
|
|
166
|
-
this._setOriginalHeightValue(this.scrollHeight);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
requestAnimationFrame(() => {
|
|
171
|
-
this.style.height = 'auto';
|
|
172
|
-
requestAnimationFrame(() => {
|
|
173
|
-
this._setOriginalHeightValue(this.getBoundingClientRect().height);
|
|
174
|
-
if (this.hidden) {
|
|
175
|
-
this.style.height = '0px';
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
this.style.height = this._originalHeight;
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
});
|
|
115
|
+
if (!this._isTransitioning) {
|
|
116
|
+
this._setOriginalHeightValue(this.scrollHeight);
|
|
182
117
|
}
|
|
183
118
|
}
|
|
184
119
|
async _subscribeObserver() {
|
|
@@ -188,10 +123,6 @@ exports.HAccordionContent = class HAccordionContent extends phoenix_light_lit_el
|
|
|
188
123
|
accordionProps.opened ? this._transitionController.show(this._expand) : this._transitionController.hide(this._collapse);
|
|
189
124
|
});
|
|
190
125
|
this._accordionGroupProps.subscribe(this._accordionGroupPropsObserver);
|
|
191
|
-
if (!this.isDevAccordionOptimizationFlagEnabled) {
|
|
192
|
-
this._mutationObserver = new MutationObserver(this._handleMutation);
|
|
193
|
-
this._mutationObserver.observe(this, { childList: true, subtree: true });
|
|
194
|
-
}
|
|
195
126
|
}
|
|
196
127
|
_setHeight(height) {
|
|
197
128
|
this.style.height = height;
|
|
@@ -201,22 +132,10 @@ exports.HAccordionContent = class HAccordionContent extends phoenix_light_lit_el
|
|
|
201
132
|
this.setAttribute('labelledby', regionId);
|
|
202
133
|
}
|
|
203
134
|
disconnectedCallback() {
|
|
204
|
-
var _a, _b
|
|
135
|
+
var _a, _b;
|
|
205
136
|
super.disconnectedCallback();
|
|
206
137
|
(_a = this._accordionGroupProps) === null || _a === void 0 ? void 0 : _a.unsubscribe(this._accordionGroupPropsObserver);
|
|
207
|
-
|
|
208
|
-
(_b = this._resizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
(_c = this._mutationObserver) === null || _c === void 0 ? void 0 : _c.disconnect();
|
|
212
|
-
window.removeEventListener('resize', this._handleResize);
|
|
213
|
-
if (this._resizeDebounceTimer !== null) {
|
|
214
|
-
window.cancelAnimationFrame(this._resizeDebounceTimer);
|
|
215
|
-
}
|
|
216
|
-
if (this._mutationDebounceTimer !== null) {
|
|
217
|
-
window.clearTimeout(this._mutationDebounceTimer);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
138
|
+
(_b = this._resizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
220
139
|
if (this.isDevAccordionHeightFixFlagEnabled) {
|
|
221
140
|
const images = this.querySelectorAll('img');
|
|
222
141
|
images.forEach((img) => {
|
|
@@ -232,10 +151,6 @@ tslib_es6.__decorate([
|
|
|
232
151
|
decorators.property(),
|
|
233
152
|
tslib_es6.__metadata("design:type", Object)
|
|
234
153
|
], exports.HAccordionContent.prototype, "transitionName", void 0);
|
|
235
|
-
tslib_es6.__decorate([
|
|
236
|
-
decorators.property({ type: Boolean, attribute: 'is-dev-accordion-optimization-flag-enabled' }),
|
|
237
|
-
tslib_es6.__metadata("design:type", Boolean)
|
|
238
|
-
], exports.HAccordionContent.prototype, "isDevAccordionOptimizationFlagEnabled", void 0);
|
|
239
154
|
tslib_es6.__decorate([
|
|
240
155
|
decorators.property({ type: Boolean, attribute: 'dev_accordion_height_fix' }),
|
|
241
156
|
tslib_es6.__metadata("design:type", Boolean)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var tslib_es6 = require('../../../../../external/tslib/tslib.es6.js');
|
|
6
|
+
var lit = require('lit');
|
|
6
7
|
var decorators = require('lit/decorators');
|
|
7
8
|
var utilities = require('@dreamcommerce/utilities');
|
|
8
9
|
var phoenix_light_lit_element = require('../../core/phoenix_light_lit_element/phoenix_light_lit_element.js');
|
|
9
10
|
var phoenix_custom_element = require('../../core/decorators/phoenix_custom_element.js');
|
|
10
11
|
var keystrokes_controller = require('../../controllers/keystrokes_controller/keystrokes_controller.js');
|
|
12
|
+
require('lit-html');
|
|
11
13
|
var color_swatches_constants = require('./color_swatches_constants.js');
|
|
12
14
|
var color_item_constants = require('./color_item/color_item_constants.js');
|
|
13
15
|
var color_item = require('./color_item/color_item.js');
|
|
@@ -16,6 +18,7 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
|
|
|
16
18
|
constructor() {
|
|
17
19
|
super(...arguments);
|
|
18
20
|
this.multiple = false;
|
|
21
|
+
this.devVisualSubcategories = false;
|
|
19
22
|
this.selectedColors = [];
|
|
20
23
|
this.showMoreBtnText = 'Pokaż wszystkie kolory';
|
|
21
24
|
this._setupEvents = () => {
|
|
@@ -139,6 +142,10 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
|
|
|
139
142
|
this._$colorSwatchesChildren = [...this.children];
|
|
140
143
|
this._setupEvents();
|
|
141
144
|
this._addCssClasses();
|
|
145
|
+
if (!this.devVisualSubcategories) {
|
|
146
|
+
this.numberOfVisibleColors && this._hideItems(this.numberOfVisibleColors);
|
|
147
|
+
this._showAllItemsEvent();
|
|
148
|
+
}
|
|
142
149
|
this.selectedColors = [...this.querySelectorAll('h-color-item[selected]')];
|
|
143
150
|
this._$colors = [...this.querySelectorAll('h-color-item')];
|
|
144
151
|
}
|
|
@@ -146,6 +153,26 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
|
|
|
146
153
|
this.querySelectorAll(color_swatches_constants.COLOR_ITEM_TAG_NAME).forEach(($colorItem) => $colorItem.classList.add(color_swatches_constants.COLOR_SWATCHES_CSS_CLASSES.colorSwatchesItem));
|
|
147
154
|
this.classList.add(color_swatches_constants.COLOR_SWATCHES_CSS_CLASSES.colorSwatches);
|
|
148
155
|
}
|
|
156
|
+
_hideItems(numberOfVisibleColors) {
|
|
157
|
+
if (!this._$colorSwatchesChildren)
|
|
158
|
+
return;
|
|
159
|
+
this._$colorSwatchesChildren.forEach(($colorSwatchesChild, index) => {
|
|
160
|
+
if (index > numberOfVisibleColors - 1) {
|
|
161
|
+
$colorSwatchesChild.setAttribute('hidden', '');
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
_showAllItemsEvent() {
|
|
166
|
+
this.addEventListener(color_swatches_constants.COLOR_SWATCHES_EVENT_NAMES.showMore, () => {
|
|
167
|
+
var _a;
|
|
168
|
+
if (!this._$colorSwatchesChildren)
|
|
169
|
+
return;
|
|
170
|
+
this._$colorSwatchesChildren.forEach(($colorSwatchesChild) => {
|
|
171
|
+
$colorSwatchesChild.removeAttribute('hidden');
|
|
172
|
+
});
|
|
173
|
+
(_a = this.querySelector('h-color-swatches-show-more')) === null || _a === void 0 ? void 0 : _a.setAttribute('hidden', '');
|
|
174
|
+
});
|
|
175
|
+
}
|
|
149
176
|
_handleChangeToNextColorItem({ target }) {
|
|
150
177
|
const $colorItem = target;
|
|
151
178
|
const $nextFocusableElement = utilities.UiDomUtils.getNextFocusableElement($colorItem);
|
|
@@ -211,11 +238,25 @@ exports.HColorSwatches = class HColorSwatches extends phoenix_light_lit_element.
|
|
|
211
238
|
super.disconnectedCallback();
|
|
212
239
|
document.body.removeEventListener('keydown', this._focusOnSelectedColor);
|
|
213
240
|
}
|
|
241
|
+
render() {
|
|
242
|
+
if (!this.devVisualSubcategories) {
|
|
243
|
+
return lit.html `
|
|
244
|
+
${this.getSlot('default')}
|
|
245
|
+
${this._$colors.length > this.numberOfVisibleColors
|
|
246
|
+
? lit.html `<h-color-swatches-show-more>${this.showMoreBtnText}</h-color-swatches-show-more>`
|
|
247
|
+
: lit.nothing}
|
|
248
|
+
`;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
214
251
|
};
|
|
215
252
|
tslib_es6.__decorate([
|
|
216
253
|
decorators.property({ type: Boolean }),
|
|
217
254
|
tslib_es6.__metadata("design:type", Boolean)
|
|
218
255
|
], exports.HColorSwatches.prototype, "multiple", void 0);
|
|
256
|
+
tslib_es6.__decorate([
|
|
257
|
+
decorators.property({ type: Boolean, attribute: 'dev-visual-subcategories' }),
|
|
258
|
+
tslib_es6.__metadata("design:type", Boolean)
|
|
259
|
+
], exports.HColorSwatches.prototype, "devVisualSubcategories", void 0);
|
|
219
260
|
tslib_es6.__decorate([
|
|
220
261
|
decorators.property({ type: Number, attribute: 'number-of-visible-colors' }),
|
|
221
262
|
tslib_es6.__metadata("design:type", Number)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,4CAAgD;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -87,6 +87,7 @@ var toggle_button = require('./components/groups/toggle_button_group/toggle_butt
|
|
|
87
87
|
var click_outside_controller_messages = require('./controllers/click_outside_controller/click_outside_controller_messages.js');
|
|
88
88
|
var backdrop = require('./components/backdrop/backdrop.js');
|
|
89
89
|
var color_swatches_control_constants = require('./components/form/color_swatches_control/color_swatches_control_constants.js');
|
|
90
|
+
var show_more_button = require('./components/show-more/show_more_button.js');
|
|
90
91
|
var color_swatches = require('./components/color_swatches/color_swatches.js');
|
|
91
92
|
var color_item = require('./components/color_swatches/color_item/color_item.js');
|
|
92
93
|
var color_swatches_control = require('./components/form/color_swatches_control/color_swatches_control.js');
|
|
@@ -132,7 +133,6 @@ var toggle = require('./components/toggle/toggle.js');
|
|
|
132
133
|
var toggle_button$1 = require('./components/toggle/toggle_button.js');
|
|
133
134
|
var navigator_share = require('./components/navigator/navigator_share/navigator_share.js');
|
|
134
135
|
var navigator_controller = require('./components/navigator/navigator_controller/navigator_controller.js');
|
|
135
|
-
var show_more_button = require('./components/show-more/show_more_button.js');
|
|
136
136
|
var show_more$1 = require('./components/show-more/show_more.js');
|
|
137
137
|
|
|
138
138
|
|
|
@@ -522,6 +522,12 @@ Object.defineProperty(exports, 'HBackdrop', {
|
|
|
522
522
|
}
|
|
523
523
|
});
|
|
524
524
|
exports.COLOR_SWATCHES_CONTROL_EVENT_NAMES = color_swatches_control_constants.COLOR_SWATCHES_CONTROL_EVENT_NAMES;
|
|
525
|
+
Object.defineProperty(exports, 'HShowMoreButton', {
|
|
526
|
+
enumerable: true,
|
|
527
|
+
get: function () {
|
|
528
|
+
return show_more_button.HShowMoreButton;
|
|
529
|
+
}
|
|
530
|
+
});
|
|
525
531
|
Object.defineProperty(exports, 'HColorSwatches', {
|
|
526
532
|
enumerable: true,
|
|
527
533
|
get: function () {
|
|
@@ -779,12 +785,6 @@ Object.defineProperty(exports, 'NavigatorController', {
|
|
|
779
785
|
return navigator_controller.NavigatorController;
|
|
780
786
|
}
|
|
781
787
|
});
|
|
782
|
-
Object.defineProperty(exports, 'HShowMoreButton', {
|
|
783
|
-
enumerable: true,
|
|
784
|
-
get: function () {
|
|
785
|
-
return show_more_button.HShowMoreButton;
|
|
786
|
-
}
|
|
787
|
-
});
|
|
788
788
|
Object.defineProperty(exports, 'HShowMore', {
|
|
789
789
|
enumerable: true,
|
|
790
790
|
get: function () {
|
|
@@ -2,7 +2,6 @@ import { PhoenixLightLitElement } from "../../core/phoenix_light_lit_element/pho
|
|
|
2
2
|
import { PropertyValues } from 'lit';
|
|
3
3
|
export declare class HAccordionContent extends PhoenixLightLitElement {
|
|
4
4
|
transitionName: string;
|
|
5
|
-
isDevAccordionOptimizationFlagEnabled: boolean;
|
|
6
5
|
isDevAccordionHeightFixFlagEnabled: boolean;
|
|
7
6
|
private _transitionController;
|
|
8
7
|
private _contextConsumer;
|
|
@@ -12,8 +11,6 @@ export declare class HAccordionContent extends PhoenixLightLitElement {
|
|
|
12
11
|
private _resizeObserver;
|
|
13
12
|
private _isTransitioning;
|
|
14
13
|
private _resizeDebounceTimer;
|
|
15
|
-
private _mutationDebounceTimer;
|
|
16
|
-
private _mutationObserver;
|
|
17
14
|
private _boundHandleTransitionEnd;
|
|
18
15
|
private _boundHandleImageLoad;
|
|
19
16
|
constructor();
|
|
@@ -24,7 +21,6 @@ export declare class HAccordionContent extends PhoenixLightLitElement {
|
|
|
24
21
|
private _handleResize;
|
|
25
22
|
private _setStylingOptions;
|
|
26
23
|
private _setOriginalHeightValue;
|
|
27
|
-
private _handleMutation;
|
|
28
24
|
private _setupImageLoadListeners;
|
|
29
25
|
private _handleImageLoad;
|
|
30
26
|
private _subscribeObserver;
|
|
@@ -9,18 +9,14 @@ import { ACCORDION_CONTEXTS } from './accordion_constants.js';
|
|
|
9
9
|
import { TransitionController } from '../../controllers/transition_controller/transition_controller.js';
|
|
10
10
|
|
|
11
11
|
const RESIZE_DEBOUNCE_MS = 150;
|
|
12
|
-
const MUTATION_DEBOUNCE_MS = 100;
|
|
13
12
|
let HAccordionContent = class HAccordionContent extends PhoenixLightLitElement {
|
|
14
13
|
constructor() {
|
|
15
14
|
super();
|
|
16
15
|
this.transitionName = 'accordion-toggle';
|
|
17
|
-
this.isDevAccordionOptimizationFlagEnabled = false;
|
|
18
16
|
this.isDevAccordionHeightFixFlagEnabled = false;
|
|
19
17
|
this._resizeObserver = null;
|
|
20
18
|
this._isTransitioning = false;
|
|
21
19
|
this._resizeDebounceTimer = null;
|
|
22
|
-
this._mutationDebounceTimer = null;
|
|
23
|
-
this._mutationObserver = null;
|
|
24
20
|
this._handleResizeObserver = () => {
|
|
25
21
|
if (this._isTransitioning || this.hidden || this.style.height === '0px')
|
|
26
22
|
return;
|
|
@@ -59,62 +55,27 @@ let HAccordionContent = class HAccordionContent extends PhoenixLightLitElement {
|
|
|
59
55
|
this._originalHeight = `${height}px`;
|
|
60
56
|
}
|
|
61
57
|
};
|
|
62
|
-
this._handleMutation = () => {
|
|
63
|
-
if (this._mutationDebounceTimer !== null) {
|
|
64
|
-
window.clearTimeout(this._mutationDebounceTimer);
|
|
65
|
-
}
|
|
66
|
-
this._mutationDebounceTimer = window.setTimeout(() => {
|
|
67
|
-
requestAnimationFrame(() => {
|
|
68
|
-
this.style.height = 'auto';
|
|
69
|
-
requestAnimationFrame(() => {
|
|
70
|
-
this._setOriginalHeightValue(this.getBoundingClientRect().height);
|
|
71
|
-
if (this.hidden) {
|
|
72
|
-
this.style.height = '0px';
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
this.style.height = this._originalHeight;
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
}, MUTATION_DEBOUNCE_MS);
|
|
80
|
-
};
|
|
81
58
|
this._expand = () => {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
this._isTransitioning = true;
|
|
85
|
-
}
|
|
86
|
-
this._setHeight(this._originalHeight);
|
|
59
|
+
this._setOriginalHeightValue(this.scrollHeight);
|
|
60
|
+
this._isTransitioning = true;
|
|
87
61
|
};
|
|
88
62
|
this._handleTransitionEnd = (e) => {
|
|
89
63
|
if (e.propertyName !== 'height' || e.target !== this) {
|
|
90
64
|
return;
|
|
91
65
|
}
|
|
92
|
-
|
|
93
|
-
this._isTransitioning = false;
|
|
94
|
-
}
|
|
66
|
+
this._isTransitioning = false;
|
|
95
67
|
if (!this.hidden && this.style.height !== '0px') {
|
|
96
68
|
this.style.height = 'auto';
|
|
97
69
|
}
|
|
98
70
|
};
|
|
99
71
|
this._collapse = () => {
|
|
100
|
-
|
|
101
|
-
this._isTransitioning = true;
|
|
102
|
-
}
|
|
72
|
+
this._isTransitioning = true;
|
|
103
73
|
const currentHeight = this.getBoundingClientRect().height;
|
|
104
74
|
this._setHeight(`${currentHeight}px`);
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
requestAnimationFrame(() => {
|
|
113
|
-
requestAnimationFrame(() => {
|
|
114
|
-
this._setHeight('0px');
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
}
|
|
75
|
+
void this.offsetHeight;
|
|
76
|
+
requestAnimationFrame(() => {
|
|
77
|
+
this._setHeight('0px');
|
|
78
|
+
});
|
|
118
79
|
};
|
|
119
80
|
this.setAttribute('role', 'region');
|
|
120
81
|
this._boundHandleTransitionEnd = this._handleTransitionEnd.bind(this);
|
|
@@ -125,13 +86,8 @@ let HAccordionContent = class HAccordionContent extends PhoenixLightLitElement {
|
|
|
125
86
|
this._contextConsumer = new ContextConsumerController(this);
|
|
126
87
|
this._transitionController = new TransitionController(this, this.transitionName);
|
|
127
88
|
this._subscribeObserver();
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
this._resizeObserver.observe(this);
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
window.addEventListener('resize', this._handleResize, { passive: true });
|
|
134
|
-
}
|
|
89
|
+
this._resizeObserver = new ResizeObserver(this._handleResizeObserver);
|
|
90
|
+
this._resizeObserver.observe(this);
|
|
135
91
|
this.addEventListener('transitionend', this._boundHandleTransitionEnd);
|
|
136
92
|
if (this.isDevAccordionHeightFixFlagEnabled) {
|
|
137
93
|
this._setupImageLoadListeners();
|
|
@@ -139,13 +95,8 @@ let HAccordionContent = class HAccordionContent extends PhoenixLightLitElement {
|
|
|
139
95
|
}
|
|
140
96
|
firstUpdated(props) {
|
|
141
97
|
super.firstUpdated(props);
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
this.style.height = this.hidden ? '0px' : this._originalHeight;
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
this._setStylingOptions();
|
|
148
|
-
}
|
|
98
|
+
this._updateOriginalHeight();
|
|
99
|
+
this.style.height = this.hidden ? '0px' : this._originalHeight;
|
|
149
100
|
}
|
|
150
101
|
_setupImageLoadListeners() {
|
|
151
102
|
const images = this.querySelectorAll('img');
|
|
@@ -157,24 +108,8 @@ let HAccordionContent = class HAccordionContent extends PhoenixLightLitElement {
|
|
|
157
108
|
});
|
|
158
109
|
}
|
|
159
110
|
_handleImageLoad() {
|
|
160
|
-
if (this.
|
|
161
|
-
|
|
162
|
-
this._setOriginalHeightValue(this.scrollHeight);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
requestAnimationFrame(() => {
|
|
167
|
-
this.style.height = 'auto';
|
|
168
|
-
requestAnimationFrame(() => {
|
|
169
|
-
this._setOriginalHeightValue(this.getBoundingClientRect().height);
|
|
170
|
-
if (this.hidden) {
|
|
171
|
-
this.style.height = '0px';
|
|
172
|
-
}
|
|
173
|
-
else {
|
|
174
|
-
this.style.height = this._originalHeight;
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
});
|
|
111
|
+
if (!this._isTransitioning) {
|
|
112
|
+
this._setOriginalHeightValue(this.scrollHeight);
|
|
178
113
|
}
|
|
179
114
|
}
|
|
180
115
|
async _subscribeObserver() {
|
|
@@ -184,10 +119,6 @@ let HAccordionContent = class HAccordionContent extends PhoenixLightLitElement {
|
|
|
184
119
|
accordionProps.opened ? this._transitionController.show(this._expand) : this._transitionController.hide(this._collapse);
|
|
185
120
|
});
|
|
186
121
|
this._accordionGroupProps.subscribe(this._accordionGroupPropsObserver);
|
|
187
|
-
if (!this.isDevAccordionOptimizationFlagEnabled) {
|
|
188
|
-
this._mutationObserver = new MutationObserver(this._handleMutation);
|
|
189
|
-
this._mutationObserver.observe(this, { childList: true, subtree: true });
|
|
190
|
-
}
|
|
191
122
|
}
|
|
192
123
|
_setHeight(height) {
|
|
193
124
|
this.style.height = height;
|
|
@@ -197,22 +128,10 @@ let HAccordionContent = class HAccordionContent extends PhoenixLightLitElement {
|
|
|
197
128
|
this.setAttribute('labelledby', regionId);
|
|
198
129
|
}
|
|
199
130
|
disconnectedCallback() {
|
|
200
|
-
var _a, _b
|
|
131
|
+
var _a, _b;
|
|
201
132
|
super.disconnectedCallback();
|
|
202
133
|
(_a = this._accordionGroupProps) === null || _a === void 0 ? void 0 : _a.unsubscribe(this._accordionGroupPropsObserver);
|
|
203
|
-
|
|
204
|
-
(_b = this._resizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
205
|
-
}
|
|
206
|
-
else {
|
|
207
|
-
(_c = this._mutationObserver) === null || _c === void 0 ? void 0 : _c.disconnect();
|
|
208
|
-
window.removeEventListener('resize', this._handleResize);
|
|
209
|
-
if (this._resizeDebounceTimer !== null) {
|
|
210
|
-
window.cancelAnimationFrame(this._resizeDebounceTimer);
|
|
211
|
-
}
|
|
212
|
-
if (this._mutationDebounceTimer !== null) {
|
|
213
|
-
window.clearTimeout(this._mutationDebounceTimer);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
134
|
+
(_b = this._resizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
216
135
|
if (this.isDevAccordionHeightFixFlagEnabled) {
|
|
217
136
|
const images = this.querySelectorAll('img');
|
|
218
137
|
images.forEach((img) => {
|
|
@@ -228,10 +147,6 @@ __decorate([
|
|
|
228
147
|
property(),
|
|
229
148
|
__metadata("design:type", Object)
|
|
230
149
|
], HAccordionContent.prototype, "transitionName", void 0);
|
|
231
|
-
__decorate([
|
|
232
|
-
property({ type: Boolean, attribute: 'is-dev-accordion-optimization-flag-enabled' }),
|
|
233
|
-
__metadata("design:type", Boolean)
|
|
234
|
-
], HAccordionContent.prototype, "isDevAccordionOptimizationFlagEnabled", void 0);
|
|
235
150
|
__decorate([
|
|
236
151
|
property({ type: Boolean, attribute: 'dev_accordion_height_fix' }),
|
|
237
152
|
__metadata("design:type", Boolean)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { HColorItem } from "./color_item/color_item";
|
|
2
2
|
import { PhoenixLightLitElement } from "../../core/phoenix_light_lit_element/phoenix_light_lit_element";
|
|
3
|
+
import { TemplateResult } from 'lit-html';
|
|
3
4
|
export declare class HColorSwatches extends PhoenixLightLitElement {
|
|
4
5
|
multiple: boolean;
|
|
6
|
+
devVisualSubcategories: boolean;
|
|
5
7
|
numberOfVisibleColors: number;
|
|
6
8
|
selectedColors: HColorItem[];
|
|
7
9
|
showMoreBtnText: string;
|
|
@@ -11,6 +13,8 @@ export declare class HColorSwatches extends PhoenixLightLitElement {
|
|
|
11
13
|
clearAllColors(): void;
|
|
12
14
|
connectedCallback(): void;
|
|
13
15
|
private _addCssClasses;
|
|
16
|
+
private _hideItems;
|
|
17
|
+
private _showAllItemsEvent;
|
|
14
18
|
private _setupEvents;
|
|
15
19
|
private _setupCheckboxGroupEvents;
|
|
16
20
|
private _setupRadioGroupEvents;
|
|
@@ -30,4 +34,5 @@ export declare class HColorSwatches extends PhoenixLightLitElement {
|
|
|
30
34
|
private _removeExistingColorFromArray;
|
|
31
35
|
private _dispatchColorChangeEvent;
|
|
32
36
|
disconnectedCallback(): void;
|
|
37
|
+
protected render(): TemplateResult | void;
|
|
33
38
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { __decorate, __metadata } from '../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { html, nothing } from 'lit';
|
|
2
3
|
import { property } from 'lit/decorators';
|
|
3
4
|
import { UiDomUtils, ArrayUtils } from '@dreamcommerce/utilities';
|
|
4
5
|
import { PhoenixLightLitElement } from '../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
|
|
5
6
|
import { phoenixCustomElement } from '../../core/decorators/phoenix_custom_element.js';
|
|
6
7
|
import { KeystrokesController } from '../../controllers/keystrokes_controller/keystrokes_controller.js';
|
|
8
|
+
import 'lit-html';
|
|
7
9
|
import { COLOR_SWATCHES_EVENT_NAMES, COLOR_ITEM_TAG_NAME, COLOR_SWATCHES_CSS_CLASSES } from './color_swatches_constants.js';
|
|
8
10
|
import { COLOR_ITEM_SELECTED_ATTRIBUTE } from './color_item/color_item_constants.js';
|
|
9
11
|
import { HColorItem } from './color_item/color_item.js';
|
|
@@ -12,6 +14,7 @@ let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
|
|
|
12
14
|
constructor() {
|
|
13
15
|
super(...arguments);
|
|
14
16
|
this.multiple = false;
|
|
17
|
+
this.devVisualSubcategories = false;
|
|
15
18
|
this.selectedColors = [];
|
|
16
19
|
this.showMoreBtnText = 'Pokaż wszystkie kolory';
|
|
17
20
|
this._setupEvents = () => {
|
|
@@ -135,6 +138,10 @@ let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
|
|
|
135
138
|
this._$colorSwatchesChildren = [...this.children];
|
|
136
139
|
this._setupEvents();
|
|
137
140
|
this._addCssClasses();
|
|
141
|
+
if (!this.devVisualSubcategories) {
|
|
142
|
+
this.numberOfVisibleColors && this._hideItems(this.numberOfVisibleColors);
|
|
143
|
+
this._showAllItemsEvent();
|
|
144
|
+
}
|
|
138
145
|
this.selectedColors = [...this.querySelectorAll('h-color-item[selected]')];
|
|
139
146
|
this._$colors = [...this.querySelectorAll('h-color-item')];
|
|
140
147
|
}
|
|
@@ -142,6 +149,26 @@ let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
|
|
|
142
149
|
this.querySelectorAll(COLOR_ITEM_TAG_NAME).forEach(($colorItem) => $colorItem.classList.add(COLOR_SWATCHES_CSS_CLASSES.colorSwatchesItem));
|
|
143
150
|
this.classList.add(COLOR_SWATCHES_CSS_CLASSES.colorSwatches);
|
|
144
151
|
}
|
|
152
|
+
_hideItems(numberOfVisibleColors) {
|
|
153
|
+
if (!this._$colorSwatchesChildren)
|
|
154
|
+
return;
|
|
155
|
+
this._$colorSwatchesChildren.forEach(($colorSwatchesChild, index) => {
|
|
156
|
+
if (index > numberOfVisibleColors - 1) {
|
|
157
|
+
$colorSwatchesChild.setAttribute('hidden', '');
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
_showAllItemsEvent() {
|
|
162
|
+
this.addEventListener(COLOR_SWATCHES_EVENT_NAMES.showMore, () => {
|
|
163
|
+
var _a;
|
|
164
|
+
if (!this._$colorSwatchesChildren)
|
|
165
|
+
return;
|
|
166
|
+
this._$colorSwatchesChildren.forEach(($colorSwatchesChild) => {
|
|
167
|
+
$colorSwatchesChild.removeAttribute('hidden');
|
|
168
|
+
});
|
|
169
|
+
(_a = this.querySelector('h-color-swatches-show-more')) === null || _a === void 0 ? void 0 : _a.setAttribute('hidden', '');
|
|
170
|
+
});
|
|
171
|
+
}
|
|
145
172
|
_handleChangeToNextColorItem({ target }) {
|
|
146
173
|
const $colorItem = target;
|
|
147
174
|
const $nextFocusableElement = UiDomUtils.getNextFocusableElement($colorItem);
|
|
@@ -207,11 +234,25 @@ let HColorSwatches = class HColorSwatches extends PhoenixLightLitElement {
|
|
|
207
234
|
super.disconnectedCallback();
|
|
208
235
|
document.body.removeEventListener('keydown', this._focusOnSelectedColor);
|
|
209
236
|
}
|
|
237
|
+
render() {
|
|
238
|
+
if (!this.devVisualSubcategories) {
|
|
239
|
+
return html `
|
|
240
|
+
${this.getSlot('default')}
|
|
241
|
+
${this._$colors.length > this.numberOfVisibleColors
|
|
242
|
+
? html `<h-color-swatches-show-more>${this.showMoreBtnText}</h-color-swatches-show-more>`
|
|
243
|
+
: nothing}
|
|
244
|
+
`;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
210
247
|
};
|
|
211
248
|
__decorate([
|
|
212
249
|
property({ type: Boolean }),
|
|
213
250
|
__metadata("design:type", Boolean)
|
|
214
251
|
], HColorSwatches.prototype, "multiple", void 0);
|
|
252
|
+
__decorate([
|
|
253
|
+
property({ type: Boolean, attribute: 'dev-visual-subcategories' }),
|
|
254
|
+
__metadata("design:type", Boolean)
|
|
255
|
+
], HColorSwatches.prototype, "devVisualSubcategories", void 0);
|
|
215
256
|
__decorate([
|
|
216
257
|
property({ type: Number, attribute: 'number-of-visible-colors' }),
|
|
217
258
|
__metadata("design:type", Number)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,4CAAgD;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -83,6 +83,7 @@ export { HToggleButton } from './components/groups/toggle_button_group/toggle_bu
|
|
|
83
83
|
export { CLICK_OUTSIDE_CONTROLLER_MESSAGES } from './controllers/click_outside_controller/click_outside_controller_messages.js';
|
|
84
84
|
export { HBackdrop } from './components/backdrop/backdrop.js';
|
|
85
85
|
export { COLOR_SWATCHES_CONTROL_EVENT_NAMES } from './components/form/color_swatches_control/color_swatches_control_constants.js';
|
|
86
|
+
export { HShowMoreButton } from './components/show-more/show_more_button.js';
|
|
86
87
|
export { HColorSwatches } from './components/color_swatches/color_swatches.js';
|
|
87
88
|
export { HColorItem } from './components/color_swatches/color_item/color_item.js';
|
|
88
89
|
export { HColorSwatchesControl } from './components/form/color_swatches_control/color_swatches_control.js';
|
|
@@ -128,6 +129,5 @@ export { HToggle } from './components/toggle/toggle.js';
|
|
|
128
129
|
export { HToggleBtn } from './components/toggle/toggle_button.js';
|
|
129
130
|
export { NavigatorShare } from './components/navigator/navigator_share/navigator_share.js';
|
|
130
131
|
export { NavigatorController } from './components/navigator/navigator_controller/navigator_controller.js';
|
|
131
|
-
export { HShowMoreButton } from './components/show-more/show_more_button.js';
|
|
132
132
|
export { HShowMore } from './components/show-more/show_more.js';
|
|
133
133
|
//# sourceMappingURL=index.js.map
|