@ppg_pl/tinting 0.0.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/LICENSE +21 -0
- package/README.md +81 -0
- package/dist/cjs/index-0a139db0.js +1667 -0
- package/dist/cjs/index-0a139db0.js.map +1 -0
- package/dist/cjs/index.cjs.js +4 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +24 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/cjs/modal-header_10.cjs.entry.js +12313 -0
- package/dist/cjs/modal-header_10.cjs.entry.js.map +1 -0
- package/dist/cjs/tinting.cjs.js +28 -0
- package/dist/cjs/tinting.cjs.js.map +1 -0
- package/dist/collection/collection-manifest.json +21 -0
- package/dist/collection/components/api/index.js +23 -0
- package/dist/collection/components/api/index.js.map +1 -0
- package/dist/collection/components/api/services.js +96 -0
- package/dist/collection/components/api/services.js.map +1 -0
- package/dist/collection/components/backdrop/index.css +14 -0
- package/dist/collection/components/backdrop/index.js +17 -0
- package/dist/collection/components/backdrop/index.js.map +1 -0
- package/dist/collection/components/colorbox/index.css +53 -0
- package/dist/collection/components/colorbox/index.js +182 -0
- package/dist/collection/components/colorbox/index.js.map +1 -0
- package/dist/collection/components/colorinfo/index.js +239 -0
- package/dist/collection/components/colorinfo/index.js.map +1 -0
- package/dist/collection/components/component/index.css +6 -0
- package/dist/collection/components/component/index.js +220 -0
- package/dist/collection/components/component/index.js.map +1 -0
- package/dist/collection/components/header/assets/close.png +0 -0
- package/dist/collection/components/header/index.css +180 -0
- package/dist/collection/components/header/index.js +334 -0
- package/dist/collection/components/header/index.js.map +1 -0
- package/dist/collection/components/loader/index.css +85 -0
- package/dist/collection/components/loader/index.js +19 -0
- package/dist/collection/components/loader/index.js.map +1 -0
- package/dist/collection/components/modal/__mocks__/index.js +759 -0
- package/dist/collection/components/modal/__mocks__/index.js.map +1 -0
- package/dist/collection/components/modal/assets/arrow_down.png +0 -0
- package/dist/collection/components/modal/index.css +386 -0
- package/dist/collection/components/modal/index.js +646 -0
- package/dist/collection/components/modal/index.js.map +1 -0
- package/dist/collection/components/search/assets/search.svg +15 -0
- package/dist/collection/components/search/index.css +38 -0
- package/dist/collection/components/search/index.js +178 -0
- package/dist/collection/components/search/index.js.map +1 -0
- package/dist/collection/components/select/assets/chevron-down.webp +0 -0
- package/dist/collection/components/select/assets/chevron.png +0 -0
- package/dist/collection/components/select/index.css +77 -0
- package/dist/collection/components/select/index.js +231 -0
- package/dist/collection/components/select/index.js.map +1 -0
- package/dist/collection/components/slider/index.css +89 -0
- package/dist/collection/components/slider/index.js +145 -0
- package/dist/collection/components/slider/index.js.map +1 -0
- package/dist/collection/gtmUtils.js +4 -0
- package/dist/collection/gtmUtils.js.map +1 -0
- package/dist/collection/index.js +2 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/types.js +2 -0
- package/dist/collection/types.js.map +1 -0
- package/dist/collection/utils/index.js +12 -0
- package/dist/collection/utils/index.js.map +1 -0
- package/dist/components/gtmUtils.js +7 -0
- package/dist/components/gtmUtils.js.map +1 -0
- package/dist/components/index.d.ts +27 -0
- package/dist/components/index.js +3 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index10.js +31 -0
- package/dist/components/index10.js.map +1 -0
- package/dist/components/index11.js +3949 -0
- package/dist/components/index11.js.map +1 -0
- package/dist/components/index2.js +2726 -0
- package/dist/components/index2.js.map +1 -0
- package/dist/components/index3.js +87 -0
- package/dist/components/index3.js.map +1 -0
- package/dist/components/index4.js +121 -0
- package/dist/components/index4.js.map +1 -0
- package/dist/components/index5.js +26 -0
- package/dist/components/index5.js.map +1 -0
- package/dist/components/index6.js +31 -0
- package/dist/components/index6.js.map +1 -0
- package/dist/components/index7.js +75 -0
- package/dist/components/index7.js.map +1 -0
- package/dist/components/index8.js +87 -0
- package/dist/components/index8.js.map +1 -0
- package/dist/components/index9.js +5306 -0
- package/dist/components/index9.js.map +1 -0
- package/dist/components/modal-header.d.ts +11 -0
- package/dist/components/modal-header.js +8 -0
- package/dist/components/modal-header.js.map +1 -0
- package/dist/components/my-backdrop.d.ts +11 -0
- package/dist/components/my-backdrop.js +8 -0
- package/dist/components/my-backdrop.js.map +1 -0
- package/dist/components/my-colorbox.d.ts +11 -0
- package/dist/components/my-colorbox.js +8 -0
- package/dist/components/my-colorbox.js.map +1 -0
- package/dist/components/my-colorinfo.d.ts +11 -0
- package/dist/components/my-colorinfo.js +8 -0
- package/dist/components/my-colorinfo.js.map +1 -0
- package/dist/components/my-component.d.ts +11 -0
- package/dist/components/my-component.js +254 -0
- package/dist/components/my-component.js.map +1 -0
- package/dist/components/my-loader.d.ts +11 -0
- package/dist/components/my-loader.js +8 -0
- package/dist/components/my-loader.js.map +1 -0
- package/dist/components/my-modal.d.ts +11 -0
- package/dist/components/my-modal.js +8 -0
- package/dist/components/my-modal.js.map +1 -0
- package/dist/components/my-search.d.ts +11 -0
- package/dist/components/my-search.js +8 -0
- package/dist/components/my-search.js.map +1 -0
- package/dist/components/my-select.d.ts +11 -0
- package/dist/components/my-select.js +8 -0
- package/dist/components/my-select.js.map +1 -0
- package/dist/components/my-slider.d.ts +11 -0
- package/dist/components/my-slider.js +8 -0
- package/dist/components/my-slider.js.map +1 -0
- package/dist/esm/index-f3be6531.js +1638 -0
- package/dist/esm/index-f3be6531.js.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +20 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/modal-header_10.entry.js +12300 -0
- package/dist/esm/modal-header_10.entry.js.map +1 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/tinting.js +23 -0
- package/dist/esm/tinting.js.map +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/tinting/assets/arrow_down.png +0 -0
- package/dist/tinting/assets/chevron-down.webp +0 -0
- package/dist/tinting/assets/chevron.png +0 -0
- package/dist/tinting/assets/close.png +0 -0
- package/dist/tinting/assets/search.svg +15 -0
- package/dist/tinting/index.esm.js +2 -0
- package/dist/tinting/index.esm.js.map +1 -0
- package/dist/tinting/p-06cd865b.entry.js +15 -0
- package/dist/tinting/p-06cd865b.entry.js.map +1 -0
- package/dist/tinting/p-b135c76f.js +3 -0
- package/dist/tinting/p-b135c76f.js.map +1 -0
- package/dist/tinting/tinting.css +1 -0
- package/dist/tinting/tinting.esm.js +2 -0
- package/dist/tinting/tinting.esm.js.map +1 -0
- package/dist/types/components/api/index.d.ts +7 -0
- package/dist/types/components/api/services.d.ts +9 -0
- package/dist/types/components/backdrop/index.d.ts +3 -0
- package/dist/types/components/colorbox/index.d.ts +15 -0
- package/dist/types/components/colorinfo/index.d.ts +19 -0
- package/dist/types/components/component/index.d.ts +18 -0
- package/dist/types/components/header/index.d.ts +35 -0
- package/dist/types/components/loader/index.d.ts +3 -0
- package/dist/types/components/modal/__mocks__/index.d.ts +415 -0
- package/dist/types/components/modal/index.d.ts +77 -0
- package/dist/types/components/search/index.d.ts +15 -0
- package/dist/types/components/select/index.d.ts +31 -0
- package/dist/types/components/slider/index.d.ts +15 -0
- package/dist/types/components.d.ts +289 -0
- package/dist/types/gtmUtils.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1637 -0
- package/dist/types/types.d.ts +68 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +21 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +11 -0
- package/package.json +69 -0
- package/www/build/assets/arrow_down.png +0 -0
- package/www/build/assets/chevron-down.webp +0 -0
- package/www/build/assets/chevron.png +0 -0
- package/www/build/assets/close.png +0 -0
- package/www/build/assets/fonts/Galatea-Regular.eot +0 -0
- package/www/build/assets/fonts/Galatea-Regular.ttf +0 -0
- package/www/build/assets/fonts/Galatea-Regular.woff +0 -0
- package/www/build/assets/fonts/Galatea-Regular.woff2 +0 -0
- package/www/build/assets/search.svg +15 -0
- package/www/build/index.esm.js +2 -0
- package/www/build/index.esm.js.map +1 -0
- package/www/build/p-06cd865b.entry.js +15 -0
- package/www/build/p-06cd865b.entry.js.map +1 -0
- package/www/build/p-a4907f5e.css +4 -0
- package/www/build/p-b135c76f.js +3 -0
- package/www/build/p-b135c76f.js.map +1 -0
- package/www/build/p-e2322b6c.js +163 -0
- package/www/build/tinting.css +1 -0
- package/www/build/tinting.esm.js +2 -0
- package/www/build/tinting.esm.js.map +1 -0
- package/www/build/tinting.js +33 -0
- package/www/host.config.json +15 -0
- package/www/index.html +31 -0
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import { h, getAssetPath } from '@stencil/core';
|
|
2
|
+
import { fetchColorFamilies } from '../api/services';
|
|
3
|
+
export class ModalHeader {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.handleClose = () => {
|
|
6
|
+
this.closeModal.emit();
|
|
7
|
+
};
|
|
8
|
+
this.handleLogoClick = () => {
|
|
9
|
+
this.onLogoClick.emit();
|
|
10
|
+
};
|
|
11
|
+
this.handleReset = () => {
|
|
12
|
+
this.onResetCategory.emit();
|
|
13
|
+
};
|
|
14
|
+
this.modalName = undefined;
|
|
15
|
+
this.modalLogo = undefined;
|
|
16
|
+
this.modalDescription = undefined;
|
|
17
|
+
this.selectedColorFamily = undefined;
|
|
18
|
+
this.shop = undefined;
|
|
19
|
+
this.productName = undefined;
|
|
20
|
+
this.isMobile = undefined;
|
|
21
|
+
this.closeImage = 'close.png';
|
|
22
|
+
this.productSamples = [];
|
|
23
|
+
this.colorFamilies = [];
|
|
24
|
+
}
|
|
25
|
+
handleSampleSelect(event) {
|
|
26
|
+
this.sampleSelected.emit(event.detail);
|
|
27
|
+
}
|
|
28
|
+
sortColorFamiliesByHex(families) {
|
|
29
|
+
return [...families].sort((a, b) => {
|
|
30
|
+
// Convert hex to RGB for proper color sorting
|
|
31
|
+
const hexToRgb = (hex) => {
|
|
32
|
+
const r = parseInt(hex.substring(1, 3), 16);
|
|
33
|
+
const g = parseInt(hex.substring(3, 5), 16);
|
|
34
|
+
const b = parseInt(hex.substring(5, 7), 16);
|
|
35
|
+
return r * 0.299 + g * 0.587 + b * 0.114; // Convert to grayscale for sorting
|
|
36
|
+
};
|
|
37
|
+
return hexToRgb(a.color) - hexToRgb(b.color);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
async fetchColorFamilies() {
|
|
41
|
+
try {
|
|
42
|
+
const request = await fetchColorFamilies();
|
|
43
|
+
this.colorFamilies = this.sortColorFamiliesByHex(request);
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
console.error('Error fetching color families:', error);
|
|
47
|
+
this.colorFamilies = [];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Adjusts the brightness of a hexadecimal color
|
|
52
|
+
* @param hex The hexadecimal color code
|
|
53
|
+
* @param percent The percentage to adjust brightness by
|
|
54
|
+
* @returns RGB color string
|
|
55
|
+
*/
|
|
56
|
+
adjustBrightness(hex, percent) {
|
|
57
|
+
let r = parseInt(hex.substring(1, 3), 16);
|
|
58
|
+
let g = parseInt(hex.substring(3, 5), 16);
|
|
59
|
+
let b = parseInt(hex.substring(5, 7), 16);
|
|
60
|
+
r = Math.min(255, Math.max(0, r + r * percent));
|
|
61
|
+
g = Math.min(255, Math.max(0, g + g * percent));
|
|
62
|
+
b = Math.min(255, Math.max(0, b + b * percent));
|
|
63
|
+
return `rgb(${Math.round(r)}, ${Math.round(g)}, ${Math.round(b)})`;
|
|
64
|
+
}
|
|
65
|
+
getGradientFromHex(hex) {
|
|
66
|
+
const lighter = this.adjustBrightness(hex, 0.6); // 30% lighter
|
|
67
|
+
const darker = this.adjustBrightness(hex, -0.6); // 30% darker
|
|
68
|
+
return `linear-gradient(270deg, ${lighter} 0%, ${darker} 100%)`;
|
|
69
|
+
}
|
|
70
|
+
selectColorFamily(colorFamily) {
|
|
71
|
+
// Toggle selection: if clicking the same color family, deselect it
|
|
72
|
+
this.selectedColorFamily = this.selectedColorFamily === colorFamily ? null : colorFamily;
|
|
73
|
+
this.colorFamilySelected.emit(colorFamily);
|
|
74
|
+
}
|
|
75
|
+
componentWillLoad() {
|
|
76
|
+
this.fetchColorFamilies();
|
|
77
|
+
}
|
|
78
|
+
render() {
|
|
79
|
+
return (h("div", { class: "my-modal__header" }, h("div", { class: "image-wrapper" }, this.modalLogo && (h("div", { class: "modal-header__logo", onClick: this.handleLogoClick }, h("img", { src: this.modalLogo, alt: "modal-logo" })))), this.modalName && h("p", { class: "my-modal__see-more big" }, this.modalName), this.modalDescription && h("p", { class: "my-modal__see-more" }, this.modalDescription), h("div", { class: "search-wrapper" }, h("div", { class: "color-families" }, this.colorFamilies.map(family => (h("div", { class: `color-family ${this.selectedColorFamily === family.value ? 'active' : ''}`, onClick: () => this.selectColorFamily(family.value) }, h("div", { style: { backgroundImage: this.getGradientFromHex(family.color) } }), family.text)))), h("div", { class: "search-container" }, h("div", { class: "filters" }, h("my-search", { shopname: this.shop, productname: this.productName, isMobile: this.isMobile }), h("my-select", { onOnReset: () => this.handleReset(), onSelectValue: event => this.handleSampleSelect(event), options: this.productSamples, placeholder: "Wybierz wzornik" }), ' '), h("button", { class: "my-modal__close", onClick: this.handleClose }, h("img", { src: getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" }))))));
|
|
80
|
+
}
|
|
81
|
+
static get is() { return "modal-header"; }
|
|
82
|
+
static get originalStyleUrls() {
|
|
83
|
+
return {
|
|
84
|
+
"$": ["index.scss"]
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
static get styleUrls() {
|
|
88
|
+
return {
|
|
89
|
+
"$": ["index.css"]
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
static get assetsDirs() { return ["assets"]; }
|
|
93
|
+
static get properties() {
|
|
94
|
+
return {
|
|
95
|
+
"modalName": {
|
|
96
|
+
"type": "string",
|
|
97
|
+
"mutable": false,
|
|
98
|
+
"complexType": {
|
|
99
|
+
"original": "string | null",
|
|
100
|
+
"resolved": "null | string",
|
|
101
|
+
"references": {}
|
|
102
|
+
},
|
|
103
|
+
"required": false,
|
|
104
|
+
"optional": false,
|
|
105
|
+
"docs": {
|
|
106
|
+
"tags": [],
|
|
107
|
+
"text": ""
|
|
108
|
+
},
|
|
109
|
+
"attribute": "modal-name",
|
|
110
|
+
"reflect": false
|
|
111
|
+
},
|
|
112
|
+
"modalLogo": {
|
|
113
|
+
"type": "string",
|
|
114
|
+
"mutable": false,
|
|
115
|
+
"complexType": {
|
|
116
|
+
"original": "string | null",
|
|
117
|
+
"resolved": "null | string",
|
|
118
|
+
"references": {}
|
|
119
|
+
},
|
|
120
|
+
"required": false,
|
|
121
|
+
"optional": false,
|
|
122
|
+
"docs": {
|
|
123
|
+
"tags": [],
|
|
124
|
+
"text": ""
|
|
125
|
+
},
|
|
126
|
+
"attribute": "modal-logo",
|
|
127
|
+
"reflect": false
|
|
128
|
+
},
|
|
129
|
+
"modalDescription": {
|
|
130
|
+
"type": "string",
|
|
131
|
+
"mutable": false,
|
|
132
|
+
"complexType": {
|
|
133
|
+
"original": "string",
|
|
134
|
+
"resolved": "string",
|
|
135
|
+
"references": {}
|
|
136
|
+
},
|
|
137
|
+
"required": false,
|
|
138
|
+
"optional": false,
|
|
139
|
+
"docs": {
|
|
140
|
+
"tags": [],
|
|
141
|
+
"text": ""
|
|
142
|
+
},
|
|
143
|
+
"attribute": "modal-description",
|
|
144
|
+
"reflect": false
|
|
145
|
+
},
|
|
146
|
+
"selectedColorFamily": {
|
|
147
|
+
"type": "string",
|
|
148
|
+
"mutable": false,
|
|
149
|
+
"complexType": {
|
|
150
|
+
"original": "string | null",
|
|
151
|
+
"resolved": "null | string",
|
|
152
|
+
"references": {}
|
|
153
|
+
},
|
|
154
|
+
"required": false,
|
|
155
|
+
"optional": false,
|
|
156
|
+
"docs": {
|
|
157
|
+
"tags": [],
|
|
158
|
+
"text": ""
|
|
159
|
+
},
|
|
160
|
+
"attribute": "selected-color-family",
|
|
161
|
+
"reflect": false
|
|
162
|
+
},
|
|
163
|
+
"shop": {
|
|
164
|
+
"type": "string",
|
|
165
|
+
"mutable": false,
|
|
166
|
+
"complexType": {
|
|
167
|
+
"original": "string",
|
|
168
|
+
"resolved": "string",
|
|
169
|
+
"references": {}
|
|
170
|
+
},
|
|
171
|
+
"required": false,
|
|
172
|
+
"optional": false,
|
|
173
|
+
"docs": {
|
|
174
|
+
"tags": [],
|
|
175
|
+
"text": ""
|
|
176
|
+
},
|
|
177
|
+
"attribute": "shop",
|
|
178
|
+
"reflect": false
|
|
179
|
+
},
|
|
180
|
+
"productName": {
|
|
181
|
+
"type": "string",
|
|
182
|
+
"mutable": false,
|
|
183
|
+
"complexType": {
|
|
184
|
+
"original": "string",
|
|
185
|
+
"resolved": "string",
|
|
186
|
+
"references": {}
|
|
187
|
+
},
|
|
188
|
+
"required": false,
|
|
189
|
+
"optional": false,
|
|
190
|
+
"docs": {
|
|
191
|
+
"tags": [],
|
|
192
|
+
"text": ""
|
|
193
|
+
},
|
|
194
|
+
"attribute": "product-name",
|
|
195
|
+
"reflect": false
|
|
196
|
+
},
|
|
197
|
+
"isMobile": {
|
|
198
|
+
"type": "boolean",
|
|
199
|
+
"mutable": false,
|
|
200
|
+
"complexType": {
|
|
201
|
+
"original": "boolean",
|
|
202
|
+
"resolved": "boolean",
|
|
203
|
+
"references": {}
|
|
204
|
+
},
|
|
205
|
+
"required": false,
|
|
206
|
+
"optional": false,
|
|
207
|
+
"docs": {
|
|
208
|
+
"tags": [],
|
|
209
|
+
"text": ""
|
|
210
|
+
},
|
|
211
|
+
"attribute": "is-mobile",
|
|
212
|
+
"reflect": false
|
|
213
|
+
},
|
|
214
|
+
"closeImage": {
|
|
215
|
+
"type": "string",
|
|
216
|
+
"mutable": false,
|
|
217
|
+
"complexType": {
|
|
218
|
+
"original": "string",
|
|
219
|
+
"resolved": "string",
|
|
220
|
+
"references": {}
|
|
221
|
+
},
|
|
222
|
+
"required": false,
|
|
223
|
+
"optional": false,
|
|
224
|
+
"docs": {
|
|
225
|
+
"tags": [],
|
|
226
|
+
"text": ""
|
|
227
|
+
},
|
|
228
|
+
"attribute": "close-image",
|
|
229
|
+
"reflect": false,
|
|
230
|
+
"defaultValue": "'close.png'"
|
|
231
|
+
},
|
|
232
|
+
"productSamples": {
|
|
233
|
+
"type": "unknown",
|
|
234
|
+
"mutable": false,
|
|
235
|
+
"complexType": {
|
|
236
|
+
"original": "any[]",
|
|
237
|
+
"resolved": "any[]",
|
|
238
|
+
"references": {}
|
|
239
|
+
},
|
|
240
|
+
"required": false,
|
|
241
|
+
"optional": false,
|
|
242
|
+
"docs": {
|
|
243
|
+
"tags": [],
|
|
244
|
+
"text": ""
|
|
245
|
+
},
|
|
246
|
+
"defaultValue": "[]"
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
static get states() {
|
|
251
|
+
return {
|
|
252
|
+
"colorFamilies": {}
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
static get events() {
|
|
256
|
+
return [{
|
|
257
|
+
"method": "sampleSelected",
|
|
258
|
+
"name": "sampleSelected",
|
|
259
|
+
"bubbles": true,
|
|
260
|
+
"cancelable": true,
|
|
261
|
+
"composed": true,
|
|
262
|
+
"docs": {
|
|
263
|
+
"tags": [],
|
|
264
|
+
"text": ""
|
|
265
|
+
},
|
|
266
|
+
"complexType": {
|
|
267
|
+
"original": "number",
|
|
268
|
+
"resolved": "number",
|
|
269
|
+
"references": {}
|
|
270
|
+
}
|
|
271
|
+
}, {
|
|
272
|
+
"method": "colorFamilySelected",
|
|
273
|
+
"name": "colorFamilySelected",
|
|
274
|
+
"bubbles": true,
|
|
275
|
+
"cancelable": true,
|
|
276
|
+
"composed": true,
|
|
277
|
+
"docs": {
|
|
278
|
+
"tags": [],
|
|
279
|
+
"text": ""
|
|
280
|
+
},
|
|
281
|
+
"complexType": {
|
|
282
|
+
"original": "string",
|
|
283
|
+
"resolved": "string",
|
|
284
|
+
"references": {}
|
|
285
|
+
}
|
|
286
|
+
}, {
|
|
287
|
+
"method": "closeModal",
|
|
288
|
+
"name": "closeModal",
|
|
289
|
+
"bubbles": true,
|
|
290
|
+
"cancelable": true,
|
|
291
|
+
"composed": true,
|
|
292
|
+
"docs": {
|
|
293
|
+
"tags": [],
|
|
294
|
+
"text": ""
|
|
295
|
+
},
|
|
296
|
+
"complexType": {
|
|
297
|
+
"original": "any",
|
|
298
|
+
"resolved": "any",
|
|
299
|
+
"references": {}
|
|
300
|
+
}
|
|
301
|
+
}, {
|
|
302
|
+
"method": "onLogoClick",
|
|
303
|
+
"name": "onLogoClick",
|
|
304
|
+
"bubbles": true,
|
|
305
|
+
"cancelable": true,
|
|
306
|
+
"composed": true,
|
|
307
|
+
"docs": {
|
|
308
|
+
"tags": [],
|
|
309
|
+
"text": ""
|
|
310
|
+
},
|
|
311
|
+
"complexType": {
|
|
312
|
+
"original": "void",
|
|
313
|
+
"resolved": "void",
|
|
314
|
+
"references": {}
|
|
315
|
+
}
|
|
316
|
+
}, {
|
|
317
|
+
"method": "onResetCategory",
|
|
318
|
+
"name": "onResetCategory",
|
|
319
|
+
"bubbles": true,
|
|
320
|
+
"cancelable": true,
|
|
321
|
+
"composed": true,
|
|
322
|
+
"docs": {
|
|
323
|
+
"tags": [],
|
|
324
|
+
"text": ""
|
|
325
|
+
},
|
|
326
|
+
"complexType": {
|
|
327
|
+
"original": "void",
|
|
328
|
+
"resolved": "void",
|
|
329
|
+
"references": {}
|
|
330
|
+
}
|
|
331
|
+
}];
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
//# sourceMappingURL=index.js.map
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G,CACjE,CACL,CACF,CACF,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, Event, EventEmitter, h, getAssetPath, State } from '@stencil/core';\nimport { fetchColorFamilies } from '../api/services';\n\n@Component({\n tag: 'modal-header',\n styleUrl: 'index.scss',\n shadow: false,\n assetsDirs: ['assets'],\n})\nexport class ModalHeader {\n @Prop() modalName: string | null;\n @Prop() modalLogo: string | null;\n @Prop() modalDescription: string;\n @Prop() selectedColorFamily: string | null;\n @Prop() shop: string;\n @Prop() productName: string;\n @Prop() isMobile: boolean;\n @Event() sampleSelected: EventEmitter<number>;\n @Event() colorFamilySelected: EventEmitter<string>;\n @Prop() closeImage = 'close.png';\n @Prop() productSamples: any[] = [];\n @Event() closeModal: EventEmitter;\n @Event() onLogoClick: EventEmitter<void>;\n @Event() onResetCategory: EventEmitter<void>;\n @State() colorFamilies: any[] = [];\n\n handleClose = () => {\n this.closeModal.emit();\n };\n\n handleLogoClick = () => {\n this.onLogoClick.emit();\n };\n\n handleReset = () => {\n this.onResetCategory.emit();\n };\n\n private handleSampleSelect(event: CustomEvent) {\n this.sampleSelected.emit(event.detail);\n }\n\n private sortColorFamiliesByHex(families: any[]) {\n return [...families].sort((a, b) => {\n // Convert hex to RGB for proper color sorting\n const hexToRgb = (hex: string) => {\n const r = parseInt(hex.substring(1, 3), 16);\n const g = parseInt(hex.substring(3, 5), 16);\n const b = parseInt(hex.substring(5, 7), 16);\n return r * 0.299 + g * 0.587 + b * 0.114; // Convert to grayscale for sorting\n };\n return hexToRgb(a.color) - hexToRgb(b.color);\n });\n }\n\n private async fetchColorFamilies() {\n try {\n const request = await fetchColorFamilies();\n this.colorFamilies = this.sortColorFamiliesByHex(request);\n } catch (error: any) {\n console.error('Error fetching color families:', error as any);\n this.colorFamilies = [];\n }\n }\n\n /**\n * Adjusts the brightness of a hexadecimal color\n * @param hex The hexadecimal color code\n * @param percent The percentage to adjust brightness by\n * @returns RGB color string\n */\n private adjustBrightness(hex: string, percent: number): string {\n let r: number = parseInt(hex.substring(1, 3), 16);\n let g: number = parseInt(hex.substring(3, 5), 16);\n let b: number = parseInt(hex.substring(5, 7), 16);\n\n r = Math.min(255, Math.max(0, r + r * percent));\n g = Math.min(255, Math.max(0, g + g * percent));\n b = Math.min(255, Math.max(0, b + b * percent));\n\n return `rgb(${Math.round(r)}, ${Math.round(g)}, ${Math.round(b)})`;\n }\n\n private getGradientFromHex(hex: string) {\n const lighter = this.adjustBrightness(hex, 0.6); // 30% lighter\n const darker = this.adjustBrightness(hex, -0.6); // 30% darker\n\n return `linear-gradient(270deg, ${lighter} 0%, ${darker} 100%)`;\n }\n\n private selectColorFamily(colorFamily: string) {\n // Toggle selection: if clicking the same color family, deselect it\n this.selectedColorFamily = this.selectedColorFamily === colorFamily ? null : colorFamily;\n this.colorFamilySelected.emit(colorFamily);\n }\n\n componentWillLoad() {\n this.fetchColorFamilies();\n }\n\n render() {\n return (\n <div class=\"my-modal__header\">\n <div class=\"image-wrapper\">\n {this.modalLogo && (\n <div class=\"modal-header__logo\" onClick={this.handleLogoClick}>\n <img src={this.modalLogo} alt=\"modal-logo\" />\n </div>\n )}\n </div>\n {this.modalName && <p class=\"my-modal__see-more big\">{this.modalName}</p>}\n {this.modalDescription && <p class=\"my-modal__see-more\">{this.modalDescription}</p>}\n <div class=\"search-wrapper\">\n <div class=\"color-families\">\n {this.colorFamilies.map(family => (\n <div class={`color-family ${this.selectedColorFamily === family.value ? 'active' : ''}`} onClick={() => this.selectColorFamily(family.value)}>\n <div style={{ backgroundImage: this.getGradientFromHex(family.color) }} />\n {family.text}\n </div>\n ))}\n </div>\n <div class=\"search-container\">\n <div class=\"filters\">\n <my-search shopname={this.shop} productname={this.productName} isMobile={this.isMobile}></my-search>\n <my-select\n onOnReset={() => this.handleReset()}\n onSelectValue={event => this.handleSampleSelect(event)}\n options={this.productSamples}\n placeholder=\"Wybierz wzornik\"\n ></my-select>{' '}\n </div>\n <button class=\"my-modal__close\" onClick={this.handleClose}>\n <img src={getAssetPath(`./assets/${this.closeImage}`)} alt=\"closebtn\" />\n </button>\n </div>\n </div>\n </div>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: center;
|
|
4
|
+
align-items: center;
|
|
5
|
+
height: 190px;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.item {
|
|
10
|
+
width: 20px;
|
|
11
|
+
height: 20px;
|
|
12
|
+
margin: 3px;
|
|
13
|
+
list-style-type: none;
|
|
14
|
+
transition: 0.5s all ease;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.item:nth-child(1) {
|
|
18
|
+
animation: right-1 1s infinite alternate;
|
|
19
|
+
background-color: #b8cf40;
|
|
20
|
+
animation-delay: 20ms;
|
|
21
|
+
}
|
|
22
|
+
@keyframes right-1 {
|
|
23
|
+
0% {
|
|
24
|
+
transform: translateY(-18px);
|
|
25
|
+
}
|
|
26
|
+
100% {
|
|
27
|
+
transform: translateY(18px);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.item:nth-child(2) {
|
|
32
|
+
animation: right-2 1s infinite alternate;
|
|
33
|
+
background-color: #ee4b5e;
|
|
34
|
+
animation-delay: 40ms;
|
|
35
|
+
}
|
|
36
|
+
@keyframes right-2 {
|
|
37
|
+
0% {
|
|
38
|
+
transform: translateY(-21px);
|
|
39
|
+
}
|
|
40
|
+
100% {
|
|
41
|
+
transform: translateY(21px);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.item:nth-child(3) {
|
|
46
|
+
animation: right-3 1s infinite alternate;
|
|
47
|
+
background-color: #ea0f47;
|
|
48
|
+
animation-delay: 60ms;
|
|
49
|
+
}
|
|
50
|
+
@keyframes right-3 {
|
|
51
|
+
0% {
|
|
52
|
+
transform: translateY(-24px);
|
|
53
|
+
}
|
|
54
|
+
100% {
|
|
55
|
+
transform: translateY(24px);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.item:nth-child(4) {
|
|
60
|
+
animation: right-4 1s infinite alternate;
|
|
61
|
+
background-color: #d42840;
|
|
62
|
+
animation-delay: 80ms;
|
|
63
|
+
}
|
|
64
|
+
@keyframes right-4 {
|
|
65
|
+
0% {
|
|
66
|
+
transform: translateY(-27px);
|
|
67
|
+
}
|
|
68
|
+
100% {
|
|
69
|
+
transform: translateY(27px);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.item:nth-child(5) {
|
|
74
|
+
animation: right-5 1s infinite alternate;
|
|
75
|
+
background-color: #8b2850;
|
|
76
|
+
animation-delay: 100ms;
|
|
77
|
+
}
|
|
78
|
+
@keyframes right-5 {
|
|
79
|
+
0% {
|
|
80
|
+
transform: translateY(-30px);
|
|
81
|
+
}
|
|
82
|
+
100% {
|
|
83
|
+
transform: translateY(30px);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { h } from '@stencil/core';
|
|
2
|
+
export class MyLoader {
|
|
3
|
+
render() {
|
|
4
|
+
return (h("div", { class: "container" }, h("div", { class: "item" }), h("div", { class: "item" }), h("div", { class: "item" }), h("div", { class: "item" }), h("div", { class: "item" })));
|
|
5
|
+
}
|
|
6
|
+
static get is() { return "my-loader"; }
|
|
7
|
+
static get encapsulation() { return "scoped"; }
|
|
8
|
+
static get originalStyleUrls() {
|
|
9
|
+
return {
|
|
10
|
+
"$": ["index.scss"]
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
static get styleUrls() {
|
|
14
|
+
return {
|
|
15
|
+
"$": ["index.css"]
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/loader/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAO7C,MAAM,OAAO,QAAQ;EACnB,MAAM;IACJ,OAAO,CACL,WAAK,KAAK,EAAC,WAAW;MACpB,WAAK,KAAK,EAAC,MAAM,GAAO;MACxB,WAAK,KAAK,EAAC,MAAM,GAAO;MACxB,WAAK,KAAK,EAAC,MAAM,GAAO;MACxB,WAAK,KAAK,EAAC,MAAM,GAAO;MACxB,WAAK,KAAK,EAAC,MAAM,GAAO,CACpB,CACP,CAAC;EACJ,CAAC;;;;;;;;;CACF","sourcesContent":["import { Component, h } from '@stencil/core';\n\n@Component({\n tag: 'my-loader',\n styleUrl: 'index.scss',\n scoped: true,\n})\nexport class MyLoader {\n render() {\n return (\n <div class=\"container\">\n <div class=\"item\"></div>\n <div class=\"item\"></div>\n <div class=\"item\"></div>\n <div class=\"item\"></div>\n <div class=\"item\"></div>\n </div>\n );\n }\n}\n"]}
|