@ppg_pl/pallete 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/README.md +11 -0
  2. package/dist/pallete/app-globals-0f993ce5.js +3 -0
  3. package/dist/pallete/css-shim-60f618b9.js +4 -0
  4. package/dist/pallete/dom-4eeb3fee.js +73 -0
  5. package/dist/pallete/index-1ac7471e.js +3059 -0
  6. package/dist/pallete/index.esm.js +1 -0
  7. package/dist/pallete/my-backdrop.entry.js +15 -0
  8. package/dist/pallete/my-colorbox.entry.js +40 -0
  9. package/dist/{components/my-colorinfo2.js → pallete/my-colorinfo.entry.js} +7 -35
  10. package/dist/{components/my-component.js → pallete/my-component.entry.js} +10 -72
  11. package/dist/pallete/my-loader.entry.js +15 -0
  12. package/dist/{components/my-modal2.js → pallete/my-modal.entry.js} +84 -76
  13. package/dist/pallete/my-search.entry.js +36 -0
  14. package/dist/pallete/my-slider.entry.js +11333 -0
  15. package/dist/pallete/pallete.css +3 -1
  16. package/dist/pallete/pallete.esm.js +129 -1
  17. package/dist/pallete/shadow-css-02866686.js +387 -0
  18. package/package.json +1 -1
  19. package/www/build/app-globals-0f993ce5.js +3 -0
  20. package/www/build/css-shim-60f618b9.js +4 -0
  21. package/www/build/dom-4eeb3fee.js +73 -0
  22. package/www/build/gtmUtils-dcdac4ce.js +5 -0
  23. package/www/build/index-1ac7471e.js +3059 -0
  24. package/www/build/index.esm.js +1 -0
  25. package/www/build/my-backdrop.entry.js +15 -0
  26. package/www/build/my-colorbox.entry.js +40 -0
  27. package/www/build/my-colorinfo.entry.js +36 -0
  28. package/www/build/my-component.entry.js +154 -0
  29. package/www/build/my-loader.entry.js +15 -0
  30. package/www/build/my-modal.entry.js +2459 -0
  31. package/www/build/my-search.entry.js +36 -0
  32. package/www/build/my-slider.entry.js +11333 -0
  33. package/www/build/pallete.css +3 -1
  34. package/www/build/pallete.esm.js +129 -1
  35. package/www/build/shadow-css-02866686.js +387 -0
  36. package/www/index.html +40 -2
  37. package/dist/cjs/index-029079e0.js +0 -1365
  38. package/dist/cjs/index.cjs.js +0 -2
  39. package/dist/cjs/loader.cjs.js +0 -21
  40. package/dist/cjs/my-backdrop_8.cjs.entry.js +0 -8109
  41. package/dist/cjs/pallete.cjs.js +0 -19
  42. package/dist/collection/collection-manifest.json +0 -19
  43. package/dist/collection/components/api/index.js +0 -19
  44. package/dist/collection/components/api/services.js +0 -81
  45. package/dist/collection/components/my-backdrop/my-backdrop.css +0 -21
  46. package/dist/collection/components/my-backdrop/my-backdrop.js +0 -13
  47. package/dist/collection/components/my-colorbox/my-colorbox.css +0 -60
  48. package/dist/collection/components/my-colorbox/my-colorbox.js +0 -145
  49. package/dist/collection/components/my-colorinfo/my-colorinfo.js +0 -197
  50. package/dist/collection/components/my-component/my-component.css +0 -6
  51. package/dist/collection/components/my-component/my-component.js +0 -107
  52. package/dist/collection/components/my-loader/my-loader.css +0 -85
  53. package/dist/collection/components/my-loader/my-loader.js +0 -18
  54. package/dist/collection/components/my-modal/assets/arrow_down.png +0 -0
  55. package/dist/collection/components/my-modal/assets/close.png +0 -0
  56. package/dist/collection/components/my-modal/my-modal.css +0 -323
  57. package/dist/collection/components/my-modal/my-modal.js +0 -430
  58. package/dist/collection/components/my-search/assets/search.svg +0 -15
  59. package/dist/collection/components/my-search/my-search.css +0 -43
  60. package/dist/collection/components/my-search/my-search.js +0 -113
  61. package/dist/collection/components/my-slider/index.js +0 -145
  62. package/dist/collection/components/my-slider/my-slider.css +0 -96
  63. package/dist/collection/gtmUtils.js +0 -3
  64. package/dist/collection/index.js +0 -1
  65. package/dist/collection/types.js +0 -1
  66. package/dist/components/index.js +0 -9
  67. package/dist/components/index2.js +0 -5458
  68. package/dist/components/my-backdrop.js +0 -6
  69. package/dist/components/my-backdrop2.js +0 -29
  70. package/dist/components/my-colorbox.js +0 -6
  71. package/dist/components/my-colorbox2.js +0 -61
  72. package/dist/components/my-colorinfo.js +0 -6
  73. package/dist/components/my-loader.js +0 -6
  74. package/dist/components/my-loader2.js +0 -29
  75. package/dist/components/my-modal.js +0 -6
  76. package/dist/components/my-search.js +0 -6
  77. package/dist/components/my-search2.js +0 -55
  78. package/dist/components/my-slider.js +0 -6
  79. package/dist/esm/index-faf4241e.js +0 -1337
  80. package/dist/esm/index.js +0 -1
  81. package/dist/esm/loader.js +0 -17
  82. package/dist/esm/my-backdrop_8.entry.js +0 -8098
  83. package/dist/esm/pallete.js +0 -17
  84. package/dist/esm/polyfills/core-js.js +0 -11
  85. package/dist/esm/polyfills/css-shim.js +0 -1
  86. package/dist/esm/polyfills/dom.js +0 -79
  87. package/dist/esm/polyfills/es5-html-element.js +0 -1
  88. package/dist/esm/polyfills/index.js +0 -34
  89. package/dist/esm/polyfills/system.js +0 -6
  90. package/dist/index.cjs.js +0 -1
  91. package/dist/index.js +0 -1
  92. package/dist/pallete/p-562ae52f.js +0 -2
  93. package/dist/pallete/p-e260bfb9.entry.js +0 -1
  94. package/www/build/p-562ae52f.js +0 -2
  95. package/www/build/p-b6a676fa.css +0 -11
  96. package/www/build/p-e260bfb9.entry.js +0 -1
  97. package/www/build/p-ef55983a.js +0 -129
  98. /package/dist/{components/gtmUtils.js → pallete/gtmUtils-dcdac4ce.js} +0 -0
@@ -1,430 +0,0 @@
1
- import { Component, Method, Element, Prop, Event, h, State, getAssetPath, Listen, Watch } from '@stencil/core';
2
- import { ApiService } from '../api';
3
- import { setDataLayer } from '../../gtmUtils';
4
- import { fetchCategoryColorsQuery, fetchColorByNumber, fetchProductColorsQuery } from '../api/services';
5
- export class MyModal {
6
- constructor() {
7
- this.boxDesktopWidth = 130;
8
- this.boxMobileWidth = 85;
9
- this.desktopPadding = 75;
10
- this.mobilePadding = 35;
11
- this.mediumBreakpoint = 1024;
12
- this.closeImage = 'close.png';
13
- this.arrowDown = 'arrow_down.png';
14
- this.chunksNum = 12;
15
- this.data = null;
16
- this.preloader = false;
17
- this.loading = false;
18
- this.colors = null;
19
- this.currentColor = null;
20
- this.currentIndex = null;
21
- this.infoBoxWidth = null;
22
- this.boxWidth = this.boxDesktopWidth; // box width with gap
23
- this.padding = this.desktopPadding;
24
- this.isMobile = false;
25
- this.showRange = false;
26
- this.colorCategories = null;
27
- this.selectedCategory = null;
28
- this.page = 1;
29
- this.clearInterval = () => {
30
- this.colorTimerInterval && clearInterval(this.colorTimerInterval);
31
- this.colorTimerInterval = undefined;
32
- };
33
- this.colorTimer = () => {
34
- if (this.currentColor && this.currentColor.id) {
35
- this.colorTimerInterval = setInterval(() => {
36
- var _a, _b;
37
- ((_a = this.currentColor) === null || _a === void 0 ? void 0 : _a.name) &&
38
- setDataLayer({
39
- event: 'ColorTimer',
40
- shop: this.shop,
41
- product: this.product,
42
- color: (_b = this.currentColor) === null || _b === void 0 ? void 0 : _b.name,
43
- timer: '10',
44
- });
45
- }, 10000);
46
- }
47
- else {
48
- this.clearInterval();
49
- }
50
- };
51
- this.chunks = (xs, y = []) => {
52
- return xs.length === 0 ? y : this.chunks(xs.slice(this.chunksNum), y.concat([xs.slice(0, this.chunksNum)]));
53
- };
54
- this.calculateBoxCount = () => {
55
- var _a;
56
- const modalWidth = this.modalEl.children && this.modalEl.children[0] && ((_a = this.modalEl.children[0]) === null || _a === void 0 ? void 0 : _a.clientWidth) - this.padding;
57
- const boxWidth = this.boxWidth;
58
- const calc = Math.floor(modalWidth / boxWidth);
59
- const boxesCount = calc;
60
- if (!this.preloader)
61
- this.chunksNum = boxesCount;
62
- };
63
- this.displayForMobile = () => {
64
- if (window.innerWidth < this.mediumBreakpoint) {
65
- this.boxWidth = this.boxMobileWidth;
66
- this.padding = this.mobilePadding;
67
- this.isMobile = true;
68
- }
69
- else {
70
- this.isMobile = false;
71
- this.boxWidth = this.boxDesktopWidth;
72
- this.padding = this.desktopPadding;
73
- }
74
- };
75
- this.fetchProductData = async () => {
76
- try {
77
- const response = await ApiService.getData(`products?populate[0]=modalLogo&populate[1]=images&populate[2]=shops&populate[3]=categories&filters[name][$contains]=${this.product}`);
78
- if (response) {
79
- if (response.data[0].attributes.shops.data.find((shop) => shop.attributes.name === this.shop).id) {
80
- this.data = Object.assign(Object.assign({}, response.data[0].attributes), { id: response.data[0].id });
81
- }
82
- }
83
- }
84
- catch (error) {
85
- console.error(error);
86
- }
87
- finally {
88
- this.preloader = false;
89
- }
90
- };
91
- // TODO:
92
- this.fetchProductColors = async (id, page) => {
93
- this.loading = true;
94
- try {
95
- const response = await ApiService.getData(`colors?${fetchProductColorsQuery(id, page)}`);
96
- if (response) {
97
- this.colors = {
98
- list: response &&
99
- response.data &&
100
- response.data.map((item) => (Object.assign({ id: item.id }, item.attributes))),
101
- pagination: response.meta.pagination,
102
- };
103
- }
104
- }
105
- catch (error) {
106
- console.error(error);
107
- }
108
- finally {
109
- this.loading = false;
110
- }
111
- };
112
- this.fetchCategoryColors = async (color) => {
113
- this.loading = true;
114
- try {
115
- const response = await ApiService.getData(`colors?${fetchCategoryColorsQuery(color)}`);
116
- if (response) {
117
- this.colors = {
118
- list: response &&
119
- response.data &&
120
- response.data.map((item) => (Object.assign({ id: item.id }, item.attributes))),
121
- pagination: response.meta.pagination,
122
- };
123
- }
124
- }
125
- catch (error) {
126
- console.error(error);
127
- }
128
- finally {
129
- this.loading = false;
130
- }
131
- };
132
- // private onIntersection = async (entries: any) => {
133
- // console.log(entries[0]);
134
- // if (entries[0].intersectionRatio === 0) {
135
- // console.log('d');
136
- // }
137
- // };
138
- // private handleObserve = () => {
139
- // console.log(this.modalEl.shadowRoot);
140
- // const boxesList: any = (this.modalEl as any).querySelector('.my-modal__wrapper');
141
- // console.log(boxesList);
142
- // if (boxesList) {
143
- // this.observer = new IntersectionObserver(this.onIntersection);
144
- // this.observer.observe(boxesList);
145
- // }
146
- // };
147
- this.onPage = (page) => {
148
- this.data && this.fetchProductColors(String(this.data.id), page);
149
- this.page = page;
150
- this.currentColor = null;
151
- this.currentIndex = null;
152
- };
153
- this.handleCategoryClick = (color) => {
154
- if (this.selectedCategory && color && this.selectedCategory.id === color.id && !this.showRange) {
155
- this.data && this.fetchProductColors(String(this.data.id));
156
- this.selectedCategory = null;
157
- }
158
- else {
159
- color && this.fetchCategoryColors(color);
160
- this.selectedCategory = color;
161
- }
162
- this.currentColor = null;
163
- };
164
- }
165
- setInfoBoxWidth(newValue) {
166
- this.infoBoxWidth = newValue * this.boxWidth;
167
- }
168
- watchPropHandler(newValue) {
169
- if (newValue.categories.data.length > 0) {
170
- this.showRange = true;
171
- this.handleCategoryClick(newValue.categories.data[0]);
172
- }
173
- else {
174
- this.fetchProductColors(String(newValue.id));
175
- }
176
- }
177
- async open() {
178
- this.modalEl.style.display = 'block';
179
- }
180
- closeModalHandler() {
181
- this.close.emit();
182
- }
183
- closeInfoBoxHandler() {
184
- this.currentColor = null;
185
- this.currentIndex = null;
186
- }
187
- handleResize() {
188
- this.calculateBoxCount();
189
- this.displayForMobile();
190
- }
191
- async searchColorsHandler(event) {
192
- var _a;
193
- // if search is empty set to first category to not showing whole product colors
194
- if (event.detail === '') {
195
- this.handleCategoryClick((_a = this.data) === null || _a === void 0 ? void 0 : _a.categories.data[0]);
196
- }
197
- try {
198
- if (this.data && this.data.id && event.detail !== '') {
199
- this.selectedCategory = null;
200
- const response = await ApiService.getData(`colors?${fetchColorByNumber(Number(this.data.id), event.detail)}`);
201
- if (response) {
202
- this.colors = {
203
- list: response &&
204
- response.data &&
205
- response.data.map((item) => (Object.assign({ id: item.id }, item.attributes))),
206
- pagination: response.meta.pagination,
207
- };
208
- }
209
- }
210
- }
211
- catch (error) {
212
- console.error(error);
213
- }
214
- }
215
- componentWillLoad() {
216
- this.preloader = true;
217
- this.fetchProductData();
218
- }
219
- componentWillRender() {
220
- this.displayForMobile();
221
- this.calculateBoxCount();
222
- this.colorTimer();
223
- }
224
- render() {
225
- var _a, _b, _c, _d, _e, _f, _g;
226
- return (h("div", { class: `my-modal` },
227
- this.preloader && (h("div", { class: 'loader' },
228
- h("my-loader", null))),
229
- !this.preloader && (h("button", { class: "my-modal__close", onClick: () => this.closeModalHandler() },
230
- h("img", { src: getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" }))),
231
- !this.preloader && this.data && this.data.modalLogo && h("img", { src: `${(_d = (_c = (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a.modalLogo) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.attributes) === null || _d === void 0 ? void 0 : _d.url}`, alt: "modal-logo" }),
232
- !this.preloader && (h("p", { class: "my-modal__see-more" }, (_e = this.data) === null || _e === void 0 ? void 0 : _e.modalDescription)),
233
- this.showRange && (h("div", { class: 'categories' },
234
- this.data && h("my-search", { productId: Number((_f = this.data) === null || _f === void 0 ? void 0 : _f.id), isMobile: this.isMobile }),
235
- h("div", { class: 'categories__container', style: { maxWidth: `${this.infoBoxWidth}px` } }, (_g = this.data) === null || _g === void 0 ? void 0 : _g.categories.data.map((c) => {
236
- var _a;
237
- return (h("my-colorbox", { key: c.id, onClick: () => this.handleCategoryClick(c), color: c.attributes.hex, name: c.attributes.name, shop: this.shop, product: this.product, isCategoryActive: ((_a = this.selectedCategory) === null || _a === void 0 ? void 0 : _a.id) === c.id }));
238
- })),
239
- this.isMobile && (h("div", { class: 'categories__slide-information', style: { width: `${this.infoBoxWidth}px` } },
240
- h("span", null, "Przewi\u0144 w lewo"),
241
- h("span", null, "Przewi\u0144 w prawo"))))),
242
- h("div", { class: 'my-modal__wrapper' },
243
- this.loading && h("my-loader", null),
244
- !this.loading && this.colors && (h("div", { class: 'container_boxes' },
245
- this.colors.list.length > 0 ? (this.chunks(this.colors.list).map((color, index) => {
246
- var _a;
247
- return (h("div", { key: index, class: "boxes" },
248
- h("div", { class: "boxes__list" }, color.map((c) => {
249
- var _a;
250
- return (h("my-colorbox", { key: c.id, onClick: () => {
251
- var _a, _b, _c;
252
- return [
253
- ((_a = this.currentColor) === null || _a === void 0 ? void 0 : _a.id) ? (((_b = this.currentColor) === null || _b === void 0 ? void 0 : _b.id) === c.id ? (this.currentColor = null) : (this.currentColor = c)) : (this.currentColor = c),
254
- (this.currentIndex = index),
255
- setDataLayer({
256
- event: 'ColorClick',
257
- shop: this.shop,
258
- product: this.product,
259
- color: c.name,
260
- }),
261
- ((_c = this.currentColor) === null || _c === void 0 ? void 0 : _c.id) && this.clearInterval(),
262
- ];
263
- }, color: c.hex, name: c.name, isActive: ((_a = this.currentColor) === null || _a === void 0 ? void 0 : _a.id) === c.id, shop: this.shop, product: this.product }));
264
- })),
265
- ((_a = this.currentColor) === null || _a === void 0 ? void 0 : _a.id) && index === this.currentIndex && (h("my-colorinfo", { currentColor: this.currentColor, shop: this.shop, product: this.product, data: this.data, isMobile: this.isMobile, infoBoxWidth: this.infoBoxWidth }))));
266
- })) : (h("p", null, "Brak wynik\u00F3w")),
267
- this.colors.pagination.pageCount > 1 && (h("div", { class: 'pagination' }, Array.from({ length: this.colors.pagination.pageCount }).map((page, i) => (h("span", { class: i + 1 === this.page ? 'current' : '', onClick: e => {
268
- e.preventDefault();
269
- this.onPage(i + 1);
270
- }, key: `#${i + 1 + page}` }, i + 1))))))))));
271
- }
272
- static get is() { return "my-modal"; }
273
- static get originalStyleUrls() { return {
274
- "$": ["my-modal.scss"]
275
- }; }
276
- static get styleUrls() { return {
277
- "$": ["my-modal.css"]
278
- }; }
279
- static get assetsDirs() { return ["assets"]; }
280
- static get properties() { return {
281
- "shop": {
282
- "type": "string",
283
- "mutable": false,
284
- "complexType": {
285
- "original": "string",
286
- "resolved": "string",
287
- "references": {}
288
- },
289
- "required": false,
290
- "optional": false,
291
- "docs": {
292
- "tags": [],
293
- "text": ""
294
- },
295
- "attribute": "shop",
296
- "reflect": false
297
- },
298
- "product": {
299
- "type": "string",
300
- "mutable": false,
301
- "complexType": {
302
- "original": "string",
303
- "resolved": "string",
304
- "references": {}
305
- },
306
- "required": false,
307
- "optional": false,
308
- "docs": {
309
- "tags": [],
310
- "text": ""
311
- },
312
- "attribute": "product",
313
- "reflect": false
314
- },
315
- "closeImage": {
316
- "type": "string",
317
- "mutable": false,
318
- "complexType": {
319
- "original": "string",
320
- "resolved": "string",
321
- "references": {}
322
- },
323
- "required": false,
324
- "optional": false,
325
- "docs": {
326
- "tags": [],
327
- "text": ""
328
- },
329
- "attribute": "close-image",
330
- "reflect": false,
331
- "defaultValue": "'close.png'"
332
- },
333
- "arrowDown": {
334
- "type": "string",
335
- "mutable": false,
336
- "complexType": {
337
- "original": "string",
338
- "resolved": "string",
339
- "references": {}
340
- },
341
- "required": false,
342
- "optional": false,
343
- "docs": {
344
- "tags": [],
345
- "text": ""
346
- },
347
- "attribute": "arrow-down",
348
- "reflect": false,
349
- "defaultValue": "'arrow_down.png'"
350
- }
351
- }; }
352
- static get states() { return {
353
- "chunksNum": {},
354
- "data": {},
355
- "preloader": {},
356
- "loading": {},
357
- "colors": {},
358
- "currentColor": {},
359
- "currentIndex": {},
360
- "infoBoxWidth": {},
361
- "boxWidth": {},
362
- "padding": {},
363
- "isMobile": {},
364
- "showRange": {},
365
- "colorCategories": {},
366
- "selectedCategory": {},
367
- "page": {}
368
- }; }
369
- static get events() { return [{
370
- "method": "close",
371
- "name": "close",
372
- "bubbles": true,
373
- "cancelable": true,
374
- "composed": true,
375
- "docs": {
376
- "tags": [],
377
- "text": ""
378
- },
379
- "complexType": {
380
- "original": "any",
381
- "resolved": "any",
382
- "references": {}
383
- }
384
- }]; }
385
- static get methods() { return {
386
- "open": {
387
- "complexType": {
388
- "signature": "() => Promise<void>",
389
- "parameters": [],
390
- "references": {
391
- "Promise": {
392
- "location": "global"
393
- }
394
- },
395
- "return": "Promise<void>"
396
- },
397
- "docs": {
398
- "text": "",
399
- "tags": []
400
- }
401
- }
402
- }; }
403
- static get elementRef() { return "modalEl"; }
404
- static get watchers() { return [{
405
- "propName": "chunksNum",
406
- "methodName": "setInfoBoxWidth"
407
- }, {
408
- "propName": "data",
409
- "methodName": "watchPropHandler"
410
- }]; }
411
- static get listeners() { return [{
412
- "name": "closeInfoBox",
413
- "method": "closeInfoBoxHandler",
414
- "target": undefined,
415
- "capture": false,
416
- "passive": false
417
- }, {
418
- "name": "resize",
419
- "method": "handleResize",
420
- "target": "window",
421
- "capture": false,
422
- "passive": true
423
- }, {
424
- "name": "searchColors",
425
- "method": "searchColorsHandler",
426
- "target": undefined,
427
- "capture": false,
428
- "passive": false
429
- }]; }
430
- }
@@ -1,15 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <svg width="21px" height="21px" viewBox="0 0 21 21" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
- <title>search (1)</title>
4
- <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
5
- <g id="E_TT-Copy" transform="translate(-670.000000, -275.000000)" fill="#000000" fill-rule="nonzero">
6
- <g id="Group-11" transform="translate(240.477268, 115.000000)">
7
- <g id="Group-18" transform="translate(38.010142, 143.000000)">
8
- <g id="search-(1)" transform="translate(392.266523, 17.349138)">
9
- <path d="M8.04938507,16.0918365 C9.8370154,16.0918798 11.5735099,15.4954541 12.9838185,14.3969873 L18.3044575,19.7176263 C18.7019302,20.1014916 19.3352777,20.0904844 19.719143,19.6930117 C20.0936046,19.3052895 20.0936046,18.6906196 19.719143,18.3029407 L14.3985041,12.9823018 C17.12426,9.47351771 16.4895258,4.41943508 12.9807417,1.69367909 C9.47195764,-1.03207689 4.41791834,-0.397342671 1.69216235,3.11144142 C-1.03359363,6.62022552 -0.398859411,11.6743081 3.10992468,14.4000641 C4.5225301,15.4974475 6.26058468,16.0927465 8.04938507,16.0918365 Z M3.77430035,3.77274027 C6.13538859,1.4116087 9.96346822,1.41156536 12.3245998,3.7726536 C14.6857314,6.13374184 14.6857747,9.96182148 12.3246865,12.3229531 C9.96359823,14.6840846 6.1355186,14.684128 3.77438702,12.3230397 C3.77434368,12.3229964 3.77434368,12.3229964 3.77430035,12.3229531 C1.41321211,9.97906898 1.39930143,6.16494336 3.7431855,3.80385512 C3.75354267,3.79345461 3.76389984,3.78309744 3.77430035,3.77274027 Z" id="Shape"></path>
10
- </g>
11
- </g>
12
- </g>
13
- </g>
14
- </g>
15
- </svg>
@@ -1,43 +0,0 @@
1
- html {
2
- font-size: 62.5%;
3
- }
4
-
5
- body {
6
- font-size: 1.5rem;
7
- }
8
-
9
- * {
10
- font-family: "Galatea", sans-serif;
11
- }
12
-
13
- .search {
14
- position: relative;
15
- width: 400px;
16
- }
17
- @media (max-width: 768px) {
18
- .search {
19
- width: 100%;
20
- }
21
- }
22
- .search input {
23
- margin-bottom: 12px;
24
- font-size: 1.6rem;
25
- padding: 19px;
26
- border-radius: 27.35px;
27
- border: 1px solid #dfdfdf;
28
- width: 100%;
29
- }
30
- .search button {
31
- position: absolute;
32
- border: none;
33
- background-color: transparent;
34
- right: -20px;
35
- top: 0;
36
- width: 50px;
37
- height: calc(100% - 12px);
38
- display: flex;
39
- flex-direction: column;
40
- align-items: center;
41
- justify-content: center;
42
- cursor: pointer;
43
- }
@@ -1,113 +0,0 @@
1
- import { Component, Prop, h, State, getAssetPath, Event, Watch } from '@stencil/core';
2
- export class MySearch {
3
- constructor() {
4
- this.searchIcon = 'search.svg';
5
- this.searchText = null;
6
- this.fetchColorsByName = (text) => {
7
- this.searchColors.emit(text);
8
- };
9
- }
10
- onInputChangeValue(event) {
11
- const value = event.target.value;
12
- this.searchColors.emit(value);
13
- this.searchText = value;
14
- }
15
- fetchColorsByNameHandle(newValue) {
16
- this.fetchColorsByName(newValue);
17
- }
18
- render() {
19
- return (h("div", { class: 'search' },
20
- h("input", { placeholder: this.isMobile ? 'Wyszukaj kolor' : 'Wyszukaj kolor po nazwie bądź numerze', value: this.searchText || '', type: "text", onInput: this.onInputChangeValue.bind(this) }),
21
- h("button", { onClick: () => {
22
- this.searchText && this.fetchColorsByName(this.searchText);
23
- this.searchText = '';
24
- } },
25
- h("img", { src: getAssetPath(`./assets/${this.searchIcon}`), alt: "arrow_down" }))));
26
- }
27
- static get is() { return "my-search"; }
28
- static get encapsulation() { return "scoped"; }
29
- static get originalStyleUrls() { return {
30
- "$": ["my-search.scss"]
31
- }; }
32
- static get styleUrls() { return {
33
- "$": ["my-search.css"]
34
- }; }
35
- static get assetsDirs() { return ["assets"]; }
36
- static get properties() { return {
37
- "productId": {
38
- "type": "number",
39
- "mutable": false,
40
- "complexType": {
41
- "original": "number",
42
- "resolved": "number",
43
- "references": {}
44
- },
45
- "required": false,
46
- "optional": false,
47
- "docs": {
48
- "tags": [],
49
- "text": ""
50
- },
51
- "attribute": "product-id",
52
- "reflect": false
53
- },
54
- "isMobile": {
55
- "type": "boolean",
56
- "mutable": false,
57
- "complexType": {
58
- "original": "boolean",
59
- "resolved": "boolean",
60
- "references": {}
61
- },
62
- "required": false,
63
- "optional": false,
64
- "docs": {
65
- "tags": [],
66
- "text": ""
67
- },
68
- "attribute": "is-mobile",
69
- "reflect": false
70
- },
71
- "searchIcon": {
72
- "type": "string",
73
- "mutable": false,
74
- "complexType": {
75
- "original": "string",
76
- "resolved": "string",
77
- "references": {}
78
- },
79
- "required": false,
80
- "optional": false,
81
- "docs": {
82
- "tags": [],
83
- "text": ""
84
- },
85
- "attribute": "search-icon",
86
- "reflect": false,
87
- "defaultValue": "'search.svg'"
88
- }
89
- }; }
90
- static get states() { return {
91
- "searchText": {}
92
- }; }
93
- static get events() { return [{
94
- "method": "searchColors",
95
- "name": "searchColors",
96
- "bubbles": true,
97
- "cancelable": true,
98
- "composed": true,
99
- "docs": {
100
- "tags": [],
101
- "text": ""
102
- },
103
- "complexType": {
104
- "original": "any",
105
- "resolved": "any",
106
- "references": {}
107
- }
108
- }]; }
109
- static get watchers() { return [{
110
- "propName": "searchText",
111
- "methodName": "fetchColorsByNameHandle"
112
- }]; }
113
- }