@ppg_pl/pallete 2.0.17 → 2.0.19

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 (49) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/my-backdrop_8.cjs.entry.js +112 -46
  3. package/dist/cjs/my-backdrop_8.cjs.entry.js.map +1 -1
  4. package/dist/cjs/pallete.cjs.js +1 -1
  5. package/dist/collection/components/api/index.js +3 -3
  6. package/dist/collection/components/api/index.js.map +1 -1
  7. package/dist/collection/components/api/services.js +17 -0
  8. package/dist/collection/components/api/services.js.map +1 -1
  9. package/dist/collection/components/my-component/my-component.js +19 -1
  10. package/dist/collection/components/my-component/my-component.js.map +1 -1
  11. package/dist/collection/components/my-modal/my-modal.css +58 -14
  12. package/dist/collection/components/my-modal/my-modal.js +106 -35
  13. package/dist/collection/components/my-modal/my-modal.js.map +1 -1
  14. package/dist/collection/components/my-search/my-search.css +2 -2
  15. package/dist/collection/components/my-search/my-search.js +1 -1
  16. package/dist/collection/components/my-search/my-search.js.map +1 -1
  17. package/dist/collection/utils/index.js +12 -0
  18. package/dist/collection/utils/index.js.map +1 -0
  19. package/dist/components/index2.js +3 -3
  20. package/dist/components/index2.js.map +1 -1
  21. package/dist/components/my-component.js +3 -1
  22. package/dist/components/my-component.js.map +1 -1
  23. package/dist/components/my-modal2.js +107 -40
  24. package/dist/components/my-modal2.js.map +1 -1
  25. package/dist/components/my-search2.js +2 -2
  26. package/dist/components/my-search2.js.map +1 -1
  27. package/dist/esm/loader.js +1 -1
  28. package/dist/esm/my-backdrop_8.entry.js +112 -46
  29. package/dist/esm/my-backdrop_8.entry.js.map +1 -1
  30. package/dist/esm/pallete.js +1 -1
  31. package/dist/pallete/p-a3b655d5.entry.js +2 -0
  32. package/dist/pallete/p-a3b655d5.entry.js.map +1 -0
  33. package/dist/pallete/pallete.esm.js +1 -1
  34. package/dist/pallete/pallete.esm.js.map +1 -1
  35. package/dist/types/components/api/services.d.ts +1 -0
  36. package/dist/types/components/my-component/my-component.d.ts +1 -0
  37. package/dist/types/components/my-modal/my-modal.d.ts +8 -2
  38. package/dist/types/components.d.ts +4 -0
  39. package/dist/types/utils/index.d.ts +1 -0
  40. package/package.json +1 -1
  41. package/www/build/p-a3b655d5.entry.js +2 -0
  42. package/www/build/p-a3b655d5.entry.js.map +1 -0
  43. package/www/build/pallete.esm.js +1 -1
  44. package/www/build/pallete.esm.js.map +1 -1
  45. package/www/index.html +3 -1
  46. package/dist/pallete/p-33dd0805.entry.js +0 -2
  47. package/dist/pallete/p-33dd0805.entry.js.map +0 -1
  48. package/www/build/p-33dd0805.entry.js +0 -2
  49. package/www/build/p-33dd0805.entry.js.map +0 -1
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["my-backdrop_8.cjs",[[2,"my-component",{"shop":[1],"product":[1],"baselink":[1],"show":[32],"readyToClose":[32],"open":[64],"close":[64]},[[0,"readyToCLose","setReadyToCloseHandler"],[0,"close","closeModalHandler"]]],[0,"my-modal",{"shop":[1],"product":[1],"baselink":[1],"closeImage":[1,"close-image"],"arrowDown":[1,"arrow-down"],"chunksNum":[32],"data":[32],"preloader":[32],"loading":[32],"colors":[32],"currentColor":[32],"currentIndex":[32],"infoBoxWidth":[32],"boxWidth":[32],"padding":[32],"isMobile":[32],"showRange":[32],"colorCategories":[32],"selectedCategory":[32],"page":[32],"open":[64]},[[0,"closeInfoBox","closeInfoBoxHandler"],[9,"resize","handleResize"],[0,"searchColors","searchColorsHandler"]]],[0,"my-backdrop"],[0,"my-colorinfo",{"currentColor":[16],"shop":[1],"product":[1],"baselink":[1],"data":[16],"isMobile":[4,"is-mobile"],"infoBoxWidth":[2,"info-box-width"],"closeImage":[1,"close-image"]}],[0,"my-colorbox",{"color":[1],"name":[1],"shop":[1],"product":[1],"isActive":[4,"is-active"],"isCategoryActive":[4,"is-category-active"],"isImageInsteadHex":[16]}],[2,"my-loader"],[2,"my-search",{"productId":[2,"product-id"],"isMobile":[4,"is-mobile"],"searchIcon":[1,"search-icon"],"searchText":[32]},[[4,"clearSearchText","clearSearchTextHandler"]]],[0,"my-slider",{"slides":[16],"shop":[1],"product":[1],"color":[1]}]]]], options);
17
+ return index.bootstrapLazy([["my-backdrop_8.cjs",[[2,"my-component",{"shop":[1],"product":[1],"baselink":[1],"colorname":[1],"show":[32],"readyToClose":[32],"open":[64],"close":[64]},[[0,"readyToCLose","setReadyToCloseHandler"],[0,"close","closeModalHandler"]]],[0,"my-modal",{"shop":[1],"product":[1],"baselink":[1],"selectedcolor":[1],"closeImage":[1,"close-image"],"arrowDown":[1,"arrow-down"],"chunksNum":[32],"data":[32],"preloader":[32],"loading":[32],"colors":[32],"currentColor":[32],"currentIndex":[32],"infoBoxWidth":[32],"boxWidth":[32],"padding":[32],"isMobile":[32],"showRange":[32],"colorCategories":[32],"selectedCategory":[32],"page":[32],"colorIsSelected":[32],"open":[64]},[[0,"closeInfoBox","closeInfoBoxHandler"],[9,"resize","handleResize"],[0,"searchColors","searchColorsHandler"]]],[0,"my-backdrop"],[0,"my-colorinfo",{"currentColor":[16],"shop":[1],"product":[1],"baselink":[1],"data":[16],"isMobile":[4,"is-mobile"],"infoBoxWidth":[2,"info-box-width"],"closeImage":[1,"close-image"]}],[0,"my-colorbox",{"color":[1],"name":[1],"shop":[1],"product":[1],"isActive":[4,"is-active"],"isCategoryActive":[4,"is-category-active"],"isImageInsteadHex":[16]}],[2,"my-loader"],[2,"my-search",{"productId":[2,"product-id"],"isMobile":[4,"is-mobile"],"searchIcon":[1,"search-icon"],"searchText":[32]},[[4,"clearSearchText","clearSearchTextHandler"]]],[0,"my-slider",{"slides":[16],"shop":[1],"product":[1],"color":[1]}]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -21,8 +21,8 @@ const setDataLayer = (obj) => {
21
21
  };
22
22
 
23
23
  // DEV/
24
- // export const APIURL = 'http://57.128.200.45:8055';
25
- // export const accessToken = '_baZ127gfvFIFmZ5umrrTBUUm6D7ve6p';
24
+ // export const APIURL = 'http://localhost:8055';
25
+ // export const accessToken = 'iGAWx696CkipbZDOESC8CBn3BF7xPaei';
26
26
  // PROD
27
27
  const APIURL = 'https://color-selector.pl'; //'https://pallete-colors-backend.herokuapp.com';
28
28
  const accessToken = '8uZQSXi0wCxiY0UR8wp_Pe2gY86wVErp'; //'_baZ127gfvFIFmZ5umrrTBUUm6D7ve6p'
@@ -35,7 +35,7 @@ class API {
35
35
  'Authorization': `Bearer ${accessToken}`,
36
36
  'Content-Type': 'application/json',
37
37
  },
38
- mode: 'no-cors',
38
+ // mode: 'no-cors',
39
39
  });
40
40
  const response = await request.json();
41
41
  return response;
@@ -276,6 +276,7 @@ const MyModalBundle = class {
276
276
  this.shop = undefined;
277
277
  this.product = undefined;
278
278
  this.baselink = undefined;
279
+ this.colorname = undefined;
279
280
  this.show = false;
280
281
  this.readyToClose = false;
281
282
  }
@@ -295,7 +296,7 @@ const MyModalBundle = class {
295
296
  render() {
296
297
  let content = null;
297
298
  if (this.show) {
298
- content = [index$1.h("my-backdrop", null), index$1.h("my-modal", { shop: this.shop, product: this.product, baselink: this.baselink })];
299
+ content = [index$1.h("my-backdrop", null), index$1.h("my-modal", { shop: this.shop, product: this.product, baselink: this.baselink, selectedcolor: this.colorname })];
299
300
  }
300
301
  return (index$1.h("div", { onClick: () => {
301
302
  if (this.readyToClose) {
@@ -2667,24 +2668,37 @@ const fetchCategoryColorsQuery = (id, page) => lib.stringify({
2667
2668
  }, {
2668
2669
  encodeValuesOnly: true,
2669
2670
  });
2670
- const fetchColorByNumber = (id, colorNumber) => lib.stringify({
2671
- fields: ['*', 'Category.*'].join(','),
2671
+ const fetchColorByName = (id, colorName) => lib.stringify({
2672
+ fields: ['*'].join(','),
2672
2673
  filter: {
2673
- Category: {
2674
- Category_id: {
2674
+ products: {
2675
+ Product_id: {
2675
2676
  _eq: id,
2676
2677
  },
2677
2678
  },
2678
- number: {
2679
- _contains: colorNumber,
2679
+ name: {
2680
+ _icontains: colorName,
2680
2681
  },
2681
2682
  },
2682
2683
  meta: '*',
2684
+ limit: 100,
2683
2685
  }, {
2684
2686
  encodeValuesOnly: true,
2685
2687
  });
2686
2688
 
2687
- const myModalCss = ".pallete-wrapper *{font-family:\"Galatea\", sans-serif}.my-modal{box-shadow:1px 1px 1px #ccc;background-color:#fff;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);max-width:1555px;width:90%;z-index:1000;text-align:center;padding:35px 40px;max-height:calc(100vh - 100px);overflow-y:auto}@media (max-width: 1024px){.my-modal{padding:80px 20px 20px}}.my-modal::-webkit-scrollbar{display:none}.my-modal .loader{display:flex;flex-direction:column;align-items:center;justify-content:center;height:300px}.my-modal>img{max-width:300px;object-fit:cover}@media (max-width: 768px){.my-modal>img{max-width:200px}}.my-modal__close{position:absolute;right:20px;top:20px;background:transparent;border:none}.my-modal__close>img{width:45px;height:45px;object-fit:cover;cursor:pointer}@media (max-width: 1024px){.my-modal__close{top:65px}}.my-modal__see-more{font-size:22px;margin-bottom:27px;display:flex;justify-content:center;align-items:center}@media (max-width: 1024px){.my-modal__see-more{font-size:18px}}.my-modal__see-more img{width:45px;height:45px}@media (max-width: 1024px){.my-modal__see-more img{display:none}}.my-modal__wrapper{display:flex;flex-direction:column;position:relative}.my-modal__wrapper .boxes{display:flex;flex-direction:column;flex-wrap:wrap}.my-modal__wrapper .boxes__list{display:flex;flex-wrap:wrap;gap:5px 5px}@media (max-width: 1024px){.my-modal__wrapper .boxes__list{justify-content:center}}.my-modal__wrapper .boxes__box-content{width:100%;margin-bottom:5px;height:500px;text-align:left;display:flex;flex-direction:row;justify-content:space-between;position:relative}.my-modal__wrapper .boxes__box-content .closebtn{position:absolute;right:10px;top:10px;width:53px;height:53px;cursor:pointer;object-fit:cover;z-index:9999}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content{flex-direction:column-reverse;height:auto}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content{margin:0 auto}}.my-modal__wrapper .boxes__box-content__info{width:40%;padding:50px 40px;position:relative}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__info{width:100%;padding:15px;min-height:100px}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info{min-height:auto}}.my-modal__wrapper .boxes__box-content__info h2{font-size:35px;font-weight:normal;margin-bottom:30px;color:#232323}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info h2{font-size:16px;text-align:center;margin-bottom:15px;margin-top:5px}}.my-modal__wrapper .boxes__box-content__info h4{margin-top:0px;margin-bottom:15px;font-size:16px;color:#4c4c4c}.my-modal__wrapper .boxes__box-content__info .divider{border:1px solid #4c4c4c;opacity:0.2;margin-bottom:20px}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info .divider{margin:10px 0px;display:none}}.my-modal__wrapper .boxes__box-content__info__value{display:flex;flex-direction:row;justify-content:flex-start}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__info__value{justify-content:flex-start}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info__value{flex-direction:column}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info__value-image{margin:0 auto;margin-bottom:10px}}.my-modal__wrapper .boxes__box-content__info__value-image img{width:114px;object-fit:cover}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__info__value-image img{width:75px}}.my-modal__wrapper .boxes__box-content__info__value-product{color:#232323;margin-left:10px}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__info__value-product h2{font-size:26px;margin:0;margin-right:10px}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info__value-product h2{font-size:16px}}.my-modal__wrapper .boxes__box-content__info__value-product p{font-size:20px;margin-top:0px;margin-bottom:0px}.my-modal__wrapper .boxes__box-content__info__value-product p:last-of-type{margin-bottom:20px}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__info__value-product p:last-of-type{margin-bottom:0}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info__value-product p{font-size:10px}}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__info__value-product>div{display:flex;justify-content:flex-start;align-items:center}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info__value-product>div{flex-direction:column}}.my-modal__wrapper .boxes__box-content__slider{width:60%;min-width:60%;max-width:60%;position:relative}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__slider{width:100%;display:block;min-width:100%;max-width:100%}}.my-modal__wrapper .boxes__box-content__slider .color-big-image{width:100%;height:100%;object-fit:cover}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__slider .color-big-image{height:300px}}.my-modal__wrapper .boxes__box-content__white *{color:#fff}.my-modal__wrapper .boxes__box-content__white h2{color:#fff}.my-modal__wrapper .pagination{margin:10px 0px;font-size:16px;display:flex;flex-direction:row;align-items:center;justify-content:center}.my-modal__wrapper .pagination>span{margin:0 3px;cursor:pointer;min-width:20px;padding:5px;box-shadow:1px 1px 1px #ccc}.my-modal__wrapper .pagination .current{background-color:wheat}.my-modal .categories{padding-bottom:20px;margin-bottom:20px;border-bottom:1px solid #dfdfdf;display:flex;flex-direction:column;align-items:flex-start}.my-modal .categories__container{display:flex;flex-wrap:nowrap;gap:5px 5px;overflow-x:auto;width:100%}@media (max-width: 1024px){.my-modal .categories__container{padding-bottom:5px}}.my-modal .categories__slide-information{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.my-modal .categories__slide-information span{color:#4c4c4c;font-size:16px;font-weight:normal}.my-modal .categories__slide-information span:first-of-type{margin-left:7px}.my-modal .categories__slide-information span:last-of-type{margin-right:7px}.my-modal .button,.my-modal a{background-color:#fff;font-size:16px;box-shadow:0px 10px 20px rgba(0, 0, 0, 0.1);border-radius:22px;padding:10px 35px;color:#232323;text-decoration:none;display:block;text-align:center;transition:all 0.7s ease-in-out;border:none;cursor:pointer}.my-modal .button:hover,.my-modal a:hover{color:#fff;background-color:#232323}.my-modal .button.brown,.my-modal a.brown{background-color:#3c2114;color:#fff}.my-modal .button.brown:hover,.my-modal a.brown:hover{color:#fff;background-color:#232323}.my-modal .button.inverse,.my-modal a.inverse{background-color:#232323;color:#fff}.my-modal .button.inverse:hover,.my-modal a.inverse:hover{color:#232323;background-color:#fff}@media (max-width: 1024px){.my-modal .button,.my-modal a{max-width:150px;font-size:13px;padding:12px 25px}}@media (max-width: 768px){.my-modal .button,.my-modal a{margin:0 auto}}.my-modal>.button{margin:10px auto}";
2689
+ function debounce$1(func, wait) {
2690
+ let timeout;
2691
+ return function executedFunction(...args) {
2692
+ const later = () => {
2693
+ clearTimeout(timeout);
2694
+ func(...args);
2695
+ };
2696
+ clearTimeout(timeout);
2697
+ timeout = setTimeout(later, wait);
2698
+ };
2699
+ }
2700
+
2701
+ const myModalCss = ".pallete-wrapper *{font-family:\"Galatea\", sans-serif}.my-modal{box-shadow:1px 1px 1px #ccc;background-color:#fff;position:fixed;top:20px;left:50%;transform:translateX(-50%);max-width:1555px;width:90%;z-index:1000;text-align:center;padding:35px 40px;max-height:calc(100vh - 100px);overflow-y:auto;min-height:50vh}@media (max-width: 1024px){.my-modal{padding:40px 20px 20px}}.my-modal::-webkit-scrollbar{display:none}.my-modal .loader{display:flex;flex-direction:column;align-items:center;justify-content:center;height:300px}.my-modal__header{display:flex;align-items:center;justify-content:space-between;align-items:flex-end;margin-bottom:16px}@media (max-width: 1024px){.my-modal__header{flex-direction:column;margin-bottom:12px;align-items:center;display:block}}@media (max-width: 768px){.my-modal__header .image-wrapper{margin-bottom:12px}}.my-modal__header .image-wrapper>img{max-width:300px;object-fit:cover}@media (max-width: 768px){.my-modal__header .image-wrapper>img{max-width:200px}}.my-modal__header .search-wrapper{display:flex;gap:55px;align-items:flex-start}@media (max-width: 1024px){.my-modal__header .search-wrapper{justify-content:center;width:92%}}@media (max-width: 1024px){.my-modal__header .search-wrapper .sc-my-search-h{width:100%;margin:0 auto}}.my-modal__header .search-wrapper .my-modal__close{background:transparent;border:none;margin-top:-20px}.my-modal__header .search-wrapper .my-modal__close>img{width:45px;height:45px;object-fit:cover;cursor:pointer}@media (max-width: 1024px){.my-modal__header .search-wrapper .my-modal__close{margin-top:0px;position:absolute;right:10px;top:10px}}.my-modal__see-more{font-size:16px;display:flex;justify-content:center;align-items:center;font-weight:300;color:#575757;margin-top:12px;margin-bottom:0px}@media (max-width: 1024px){.my-modal__see-more{font-size:18px}}.my-modal__see-more img{width:45px;height:45px}@media (max-width: 1024px){.my-modal__see-more img{display:none}}.my-modal__wrapper{display:flex;flex-direction:column;position:relative}.my-modal__wrapper .boxes{display:flex;flex-direction:column;flex-wrap:wrap}.my-modal__wrapper .boxes__list{display:flex;flex-wrap:wrap;gap:5px 5px}@media (max-width: 1024px){.my-modal__wrapper .boxes__list{justify-content:center}}.my-modal__wrapper .boxes__box-content{width:100%;margin-bottom:5px;height:500px;text-align:left;display:flex;flex-direction:row;justify-content:space-between;position:relative}.my-modal__wrapper .boxes__box-content .closebtn{position:absolute;right:10px;top:10px;width:53px;height:53px;cursor:pointer;object-fit:cover;z-index:9999}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content{flex-direction:column-reverse;height:auto}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content{margin:0 auto}}.my-modal__wrapper .boxes__box-content__info{width:40%;padding:50px 40px;position:relative}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__info{width:100%;padding:15px;min-height:100px}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info{min-height:auto}}.my-modal__wrapper .boxes__box-content__info h2{font-size:35px;font-weight:normal;margin-bottom:30px;color:#232323}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info h2{font-size:16px;text-align:center;margin-bottom:15px;margin-top:5px}}.my-modal__wrapper .boxes__box-content__info h4{margin-top:0px;margin-bottom:15px;font-size:16px;color:#4c4c4c}.my-modal__wrapper .boxes__box-content__info .divider{border:1px solid #4c4c4c;opacity:0.2;margin-bottom:20px}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info .divider{margin:10px 0px;display:none}}.my-modal__wrapper .boxes__box-content__info__value{display:flex;flex-direction:row;justify-content:flex-start}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__info__value{justify-content:flex-start}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info__value{flex-direction:column}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info__value-image{margin:0 auto;margin-bottom:10px}}.my-modal__wrapper .boxes__box-content__info__value-image img{width:114px;object-fit:cover}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__info__value-image img{width:75px}}.my-modal__wrapper .boxes__box-content__info__value-product{color:#232323;margin-left:10px}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__info__value-product h2{font-size:26px;margin:0;margin-right:10px}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info__value-product h2{font-size:16px}}.my-modal__wrapper .boxes__box-content__info__value-product p{font-size:20px;margin-top:0px;margin-bottom:0px}.my-modal__wrapper .boxes__box-content__info__value-product p:last-of-type{margin-bottom:20px}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__info__value-product p:last-of-type{margin-bottom:0}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info__value-product p{font-size:10px}}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__info__value-product>div{display:flex;justify-content:flex-start;align-items:center}}@media (max-width: 768px){.my-modal__wrapper .boxes__box-content__info__value-product>div{flex-direction:column}}.my-modal__wrapper .boxes__box-content__slider{width:60%;min-width:60%;max-width:60%;position:relative}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__slider{width:100%;display:block;min-width:100%;max-width:100%}}.my-modal__wrapper .boxes__box-content__slider .color-big-image{width:100%;height:100%;object-fit:cover}@media (max-width: 1024px){.my-modal__wrapper .boxes__box-content__slider .color-big-image{height:300px}}.my-modal__wrapper .boxes__box-content__white *{color:#fff}.my-modal__wrapper .boxes__box-content__white h2{color:#fff}.my-modal__wrapper .pagination{margin:10px 0px;font-size:16px;display:flex;flex-direction:row;align-items:center;justify-content:center}.my-modal__wrapper .pagination>span{margin:0 3px;cursor:pointer;min-width:20px;padding:5px;box-shadow:1px 1px 1px #ccc}.my-modal__wrapper .pagination .current{background-color:wheat}.my-modal .categories{padding-bottom:20px;margin-bottom:20px;border-bottom:1px solid #dfdfdf;display:flex;flex-direction:column;align-items:flex-start}.my-modal .categories__container{display:flex;flex-wrap:nowrap;gap:5px 5px;overflow-x:auto;width:100%}@media (max-width: 1024px){.my-modal .categories__container{padding-bottom:5px}}.my-modal .categories__slide-information{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.my-modal .categories__slide-information span{color:#4c4c4c;font-size:16px;font-weight:normal}.my-modal .categories__slide-information span:first-of-type{margin-left:7px}.my-modal .categories__slide-information span:last-of-type{margin-right:7px}.my-modal .button,.my-modal a{background-color:#fff;font-size:16px;box-shadow:0px 10px 20px rgba(0, 0, 0, 0.1);border-radius:22px;padding:10px 35px;color:#232323;text-decoration:none;display:block;text-align:center;transition:all 0.7s ease-in-out;border:none;cursor:pointer}.my-modal .button:hover,.my-modal a:hover{color:#fff;background-color:#232323}.my-modal .button.brown,.my-modal a.brown{background-color:#3c2114;color:#fff}.my-modal .button.brown:hover,.my-modal a.brown:hover{color:#fff;background-color:#232323}.my-modal .button.inverse,.my-modal a.inverse{background-color:#232323;color:#fff}.my-modal .button.inverse:hover,.my-modal a.inverse:hover{color:#232323;background-color:#fff}@media (max-width: 1024px){.my-modal .button,.my-modal a{max-width:150px;font-size:13px;padding:12px 25px}}@media (max-width: 768px){.my-modal .button,.my-modal a{margin:0 auto}}.my-modal>.button{margin:10px auto}";
2688
2702
 
2689
2703
  const MyModal = class {
2690
2704
  constructor(hostRef) {
@@ -2807,6 +2821,48 @@ const MyModal = class {
2807
2821
  this.loading = false;
2808
2822
  }
2809
2823
  };
2824
+ this.handleCategoryClick = (color) => {
2825
+ if (this.selectedCategory && color && this.selectedCategory === color && !this.showRange) {
2826
+ this.data && this.fetchProductColors(String(this.data.id));
2827
+ this.selectedCategory = null;
2828
+ }
2829
+ else {
2830
+ color && this.fetchCategoryColors(color);
2831
+ this.selectedCategory = color;
2832
+ }
2833
+ this.currentColor = null;
2834
+ this.clearSearchText.emit();
2835
+ };
2836
+ // async searchColorsHandler(event: CustomEvent) {
2837
+ // this.loading = true;
2838
+ // this.currentColor = null;
2839
+ // // if search is empty set to first category to not showing whole product colors
2840
+ // if (event.detail === '') {
2841
+ // this.handleCategoryClick(this.selectedCategory);
2842
+ // this.loading = true;
2843
+ // }
2844
+ // try {
2845
+ // if (this.data && this.data.id && event.detail !== '') {
2846
+ // const response = await ApiService.getData(`items/Color?${fetchColorByNumber(Number(this.selectedCategory), event.detail)}`);
2847
+ // if (response) {
2848
+ // this.colors = {
2849
+ // list:
2850
+ // (response &&
2851
+ // response.data &&
2852
+ // response.data.map((item: Color) => ({
2853
+ // ...item,
2854
+ // }))) ||
2855
+ // [],
2856
+ // pagination: response.meta,
2857
+ // };
2858
+ // }
2859
+ // }
2860
+ // } catch (error) {
2861
+ // console.error(error);
2862
+ // } finally {
2863
+ // this.loading = false;
2864
+ // }
2865
+ // }
2810
2866
  this.onPage = (page) => {
2811
2867
  if (this.data) {
2812
2868
  if (this.selectedCategory) {
@@ -2820,21 +2876,10 @@ const MyModal = class {
2820
2876
  this.currentColor = null;
2821
2877
  this.currentIndex = null;
2822
2878
  };
2823
- this.handleCategoryClick = (color) => {
2824
- if (this.selectedCategory && color && this.selectedCategory === color && !this.showRange) {
2825
- this.data && this.fetchProductColors(String(this.data.id));
2826
- this.selectedCategory = null;
2827
- }
2828
- else {
2829
- color && this.fetchCategoryColors(color);
2830
- this.selectedCategory = color;
2831
- }
2832
- this.currentColor = null;
2833
- this.clearSearchText.emit();
2834
- };
2835
2879
  this.shop = undefined;
2836
2880
  this.product = undefined;
2837
2881
  this.baselink = undefined;
2882
+ this.selectedcolor = undefined;
2838
2883
  this.closeImage = 'close.png';
2839
2884
  this.arrowDown = 'arrow_down.png';
2840
2885
  this.chunksNum = 12;
@@ -2852,6 +2897,8 @@ const MyModal = class {
2852
2897
  this.colorCategories = null;
2853
2898
  this.selectedCategory = null;
2854
2899
  this.page = 1;
2900
+ this.colorIsSelected = false;
2901
+ this.debouncedSearchColorsHandler = debounce$1(this.searchColor.bind(this), 300);
2855
2902
  }
2856
2903
  setInfoBoxWidth(newValue) {
2857
2904
  this.infoBoxWidth = newValue * this.boxWidth;
@@ -2882,33 +2929,54 @@ const MyModal = class {
2882
2929
  this.calculateBoxCount();
2883
2930
  this.displayForMobile();
2884
2931
  }
2885
- async searchColorsHandler(event) {
2886
- this.loading = true;
2887
- this.currentColor = null;
2888
- // if search is empty set to first category to not showing whole product colors
2932
+ async searchColor(event) {
2933
+ var _a, _b;
2889
2934
  if (event.detail === '') {
2890
- this.handleCategoryClick(this.selectedCategory);
2935
+ this.fetchProductData();
2891
2936
  this.loading = true;
2892
2937
  }
2893
- try {
2894
- if (this.data && this.data.id && event.detail !== '') {
2895
- const response = await ApiService.getData(`items/Color?${fetchColorByNumber(Number(this.selectedCategory), event.detail)}`);
2938
+ else {
2939
+ if (!((_a = this.data) === null || _a === void 0 ? void 0 : _a.id)) {
2940
+ return;
2941
+ }
2942
+ try {
2943
+ const response = await ApiService.getData(`items/Color?${fetchColorByName((_b = this.data) === null || _b === void 0 ? void 0 : _b.id, event.detail)}`);
2896
2944
  if (response) {
2897
2945
  this.colors = {
2898
- list: (response &&
2946
+ list: response &&
2899
2947
  response.data &&
2900
- response.data.map((item) => (Object.assign({}, item)))) ||
2901
- [],
2948
+ response.data.map((item) => (Object.assign({}, item))),
2902
2949
  pagination: response.meta,
2903
2950
  };
2904
2951
  }
2905
2952
  }
2953
+ catch (error) {
2954
+ console.error(error);
2955
+ }
2956
+ finally {
2957
+ this.loading = false;
2958
+ }
2906
2959
  }
2907
- catch (error) {
2908
- console.error(error);
2909
- }
2910
- finally {
2911
- this.loading = false;
2960
+ }
2961
+ searchColorsHandler(event) {
2962
+ this.loading = true;
2963
+ this.currentColor = null;
2964
+ this.debouncedSearchColorsHandler(event);
2965
+ }
2966
+ openSeletedColor() {
2967
+ var _a, _b, _c;
2968
+ if (!((_a = this.colors) === null || _a === void 0 ? void 0 : _a.list) || !this.selectedcolor)
2969
+ return;
2970
+ if (!this.colorIsSelected) {
2971
+ const result = this.chunks(this.colors.list)
2972
+ .map((innerArray, arrayIndex) => {
2973
+ const foundColor = innerArray.find(color => { var _a, _b; return color.name.trim() === ((_b = (_a = this.selectedcolor) === null || _a === void 0 ? void 0 : _a.trim()) === null || _b === void 0 ? void 0 : _b.toUpperCase()); });
2974
+ return foundColor ? { color: foundColor, index: arrayIndex } : null;
2975
+ })
2976
+ .filter(item => item !== null);
2977
+ this.currentColor = (_b = result[0]) === null || _b === void 0 ? void 0 : _b.color;
2978
+ this.currentIndex = (_c = result[0]) === null || _c === void 0 ? void 0 : _c.index;
2979
+ this.colorIsSelected = true;
2912
2980
  }
2913
2981
  }
2914
2982
  componentWillLoad() {
@@ -2919,13 +2987,11 @@ const MyModal = class {
2919
2987
  this.displayForMobile();
2920
2988
  this.calculateBoxCount();
2921
2989
  this.colorTimer();
2990
+ this.openSeletedColor();
2922
2991
  }
2923
2992
  render() {
2924
- var _a, _b, _c, _d;
2925
- return (index$1.h("div", { class: `my-modal`, onMouseEnter: () => this.handleReadyToClose(false), onMouseLeave: () => this.handleReadyToClose(true) }, this.preloader && (index$1.h("div", { class: 'loader' }, index$1.h("my-loader", null))), !this.preloader && (index$1.h("button", { class: "my-modal__close", onClick: () => this.closeModalHandler() }, index$1.h("img", { src: index$1.getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" }))), !this.preloader && this.data && this.data.modalLogo && index$1.h("img", { src: `${APIURL}/assets/${(_a = this.data) === null || _a === void 0 ? void 0 : _a.modalLogo}?access_token=${accessToken}`, alt: "modal-logo" }), !this.preloader && this.data && (index$1.h("p", { class: "my-modal__see-more" }, (_b = this.data) === null || _b === void 0 ? void 0 : _b.modalDescription)), this.showRange && (index$1.h("div", { class: 'categories' }, this.data && index$1.h("my-search", { productId: Number((_c = this.data) === null || _c === void 0 ? void 0 : _c.id), isMobile: this.isMobile }), index$1.h("div", { class: 'categories__container', style: { maxWidth: `${this.infoBoxWidth}px` } }, (_d = this.data) === null || _d === void 0 ? void 0 : _d.Category.map((c) => (index$1.h("my-colorbox", { key: c.id, onClick: () => this.handleCategoryClick(c.Category_id.id), color: c.Category_id.hex, name: c.Category_id.category_name, shop: this.shop, product: this.product, isCategoryActive: this.selectedCategory === c.Category_id.id, isImageInsteadHex: {
2926
- isImageInsteadHex: (c === null || c === void 0 ? void 0 : c.imageInsteadHex) || false,
2927
- bigImage: (c === null || c === void 0 ? void 0 : c.bigImage) || '',
2928
- } })))), this.isMobile && (index$1.h("div", { class: 'categories__slide-information', style: { width: `${this.infoBoxWidth}px` } }, index$1.h("span", null, "Przewi\u0144 w lewo"), index$1.h("span", null, "Przewi\u0144 w prawo"))))), index$1.h("div", { class: 'my-modal__wrapper' }, this.loading && index$1.h("my-loader", null), !this.loading && this.colors && (index$1.h("div", { class: 'container_boxes' }, this.colors.list.length > 0 ? (this.chunks(this.colors.list).map((color, index) => {
2993
+ var _a, _b, _c;
2994
+ return (index$1.h("div", { class: `my-modal`, onMouseEnter: () => this.handleReadyToClose(false), onMouseLeave: () => this.handleReadyToClose(true) }, this.preloader && (index$1.h("div", { class: 'loader' }, index$1.h("my-loader", null))), !this.preloader && this.data && (index$1.h("div", { class: `my-modal__header` }, index$1.h("div", { class: "image-wrapper" }, index$1.h("img", { src: `${APIURL}/assets/${(_a = this.data) === null || _a === void 0 ? void 0 : _a.modalLogo}?access_token=${accessToken}`, alt: "modal-logo" }), !this.preloader && this.data && (index$1.h("p", { class: "my-modal__see-more" }, (_b = this.data) === null || _b === void 0 ? void 0 : _b.modalDescription))), index$1.h("div", { class: "search-wrapper" }, !this.preloader && index$1.h("my-search", { productId: Number((_c = this.data) === null || _c === void 0 ? void 0 : _c.id), isMobile: this.isMobile }), !this.preloader && (index$1.h("button", { class: "my-modal__close", onClick: () => this.closeModalHandler() }, index$1.h("img", { src: index$1.getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" })))))), index$1.h("div", { class: 'my-modal__wrapper' }, this.loading && index$1.h("my-loader", null), !this.loading && this.colors && (index$1.h("div", { class: 'container_boxes' }, this.colors.list.length > 0 ? (this.chunks(this.colors.list).map((color, index) => {
2929
2995
  var _a;
2930
2996
  return (index$1.h("div", { key: index, class: "boxes" }, index$1.h("div", { class: "boxes__list" }, color.map((c) => {
2931
2997
  var _a;
@@ -2961,7 +3027,7 @@ const MyModal = class {
2961
3027
  };
2962
3028
  MyModal.style = myModalCss;
2963
3029
 
2964
- const mySearchCss = ".pallete-wrapper.sc-my-search *.sc-my-search{font-family:\"Galatea\", sans-serif}.search.sc-my-search{position:relative;width:400px}@media (max-width: 768px){.search.sc-my-search{width:100%}}.search.sc-my-search input.sc-my-search{margin-bottom:12px;font-size:16px;padding:19px;border-radius:27.35px;border:1px solid #dfdfdf;width:100%}.search.sc-my-search button.sc-my-search{position:absolute;border:none;background-color:transparent;right:-20px;top:0;width:50px;height:calc(100% - 12px);display:flex;flex-direction:column;align-items:center;justify-content:center;cursor:pointer}";
3030
+ const mySearchCss = ".pallete-wrapper.sc-my-search *.sc-my-search{font-family:\"Galatea\", sans-serif}.search.sc-my-search{position:relative;width:400px}@media (max-width: 768px){.search.sc-my-search{width:100%}}.search.sc-my-search input.sc-my-search{font-size:16px;padding:19px;border-radius:27.35px;border:1px solid #dfdfdf;width:100%;color:#4c4c4c}.search.sc-my-search button.sc-my-search{position:absolute;border:none;background-color:transparent;right:-20px;top:0;width:50px;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;cursor:pointer}";
2965
3031
 
2966
3032
  function debounce(func, wait) {
2967
3033
  let timeout;
@@ -3001,7 +3067,7 @@ const MySearch = class {
3001
3067
  this.searchText = null;
3002
3068
  }
3003
3069
  render() {
3004
- return (index$1.h("div", { class: 'search' }, index$1.h("input", { placeholder: this.isMobile ? 'Wyszukaj kolor' : 'Wyszukaj kolor po nazwie bądź numerze', value: this.searchText || '', type: "text", onInput: this.onInputChangeValue.bind(this) }), index$1.h("button", { onClick: () => {
3070
+ return (index$1.h("div", { class: 'search' }, index$1.h("input", { placeholder: this.isMobile ? 'Wyszukaj kolor' : 'Wyszukaj kolor po nazwie', value: this.searchText || '', type: "text", onInput: this.onInputChangeValue.bind(this) }), index$1.h("button", { onClick: () => {
3005
3071
  this.searchText && this.fetchColorsByName(this.searchText);
3006
3072
  this.searchText = '';
3007
3073
  } }, index$1.h("img", { src: index$1.getAssetPath(`./assets/${this.searchIcon}`), alt: "arrow_down" }))));