@ppg_pl/tinting 0.0.7 → 0.0.8

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 (41) hide show
  1. package/dist/cjs/modal-header_9.cjs.entry.js +47 -22
  2. package/dist/cjs/modal-header_9.cjs.entry.js.map +1 -1
  3. package/dist/collection/components/colorbox/index.js +18 -1
  4. package/dist/collection/components/colorbox/index.js.map +1 -1
  5. package/dist/collection/components/colorinfo/index.js +2 -9
  6. package/dist/collection/components/colorinfo/index.js.map +1 -1
  7. package/dist/collection/utils/index.js +17 -0
  8. package/dist/collection/utils/index.js.map +1 -1
  9. package/dist/components/index10.js +4934 -3605
  10. package/dist/components/index10.js.map +1 -1
  11. package/dist/components/index11.js +3989 -0
  12. package/dist/components/index11.js.map +1 -0
  13. package/dist/components/index4.js +2 -13
  14. package/dist/components/index4.js.map +1 -1
  15. package/dist/components/index6.js +28 -27
  16. package/dist/components/index6.js.map +1 -1
  17. package/dist/components/index7.js +9 -53
  18. package/dist/components/index7.js.map +1 -1
  19. package/dist/components/index8.js +56 -129
  20. package/dist/components/index8.js.map +1 -1
  21. package/dist/components/index9.js +124 -5283
  22. package/dist/components/index9.js.map +1 -1
  23. package/dist/components/my-backdrop.js +1 -1
  24. package/dist/components/my-colorbox.js +1 -1
  25. package/dist/components/my-colorinfo.js +1 -1
  26. package/dist/components/my-component.js +5 -5
  27. package/dist/components/my-modal.js +1 -1
  28. package/dist/components/my-slider.js +1 -1
  29. package/dist/esm/modal-header_9.entry.js +47 -22
  30. package/dist/esm/modal-header_9.entry.js.map +1 -1
  31. package/dist/tinting/{p-4ec5261b.entry.js → p-2730a042.entry.js} +3 -3
  32. package/dist/tinting/p-2730a042.entry.js.map +1 -0
  33. package/dist/tinting/tinting.esm.js +1 -1
  34. package/dist/types/components/colorbox/index.d.ts +3 -0
  35. package/dist/types/utils/index.d.ts +6 -0
  36. package/package.json +1 -1
  37. package/www/build/{p-4ec5261b.entry.js → p-2730a042.entry.js} +3 -3
  38. package/www/build/p-2730a042.entry.js.map +1 -0
  39. package/www/build/tinting.esm.js +1 -1
  40. package/dist/tinting/p-4ec5261b.entry.js.map +0 -1
  41. package/www/build/p-4ec5261b.entry.js.map +0 -1
@@ -1,16 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, getAssetPath } from '@stencil/core/internal/client';
2
-
3
- function debounce(func, wait) {
4
- let timeout;
5
- return function executedFunction(...args) {
6
- const later = () => {
7
- clearTimeout(timeout);
8
- func(...args);
9
- };
10
- clearTimeout(timeout);
11
- timeout = setTimeout(later, wait);
12
- };
13
- }
2
+ import { d as debounce } from './index6.js';
14
3
 
15
4
  const indexCss = "@import url(\"https://fonts.googleapis.com/css2?family=Figtree:ital,wght@0,300..900;1.sc-my-select,300..900&family=Poppins.sc-my-select:ital,wght@0.sc-my-select,100.sc-my-select;0.sc-my-select,200.sc-my-select;0.sc-my-select,300.sc-my-select;0.sc-my-select,400.sc-my-select;0.sc-my-select,500.sc-my-select;0.sc-my-select,600.sc-my-select;0.sc-my-select,700.sc-my-select;0.sc-my-select,800.sc-my-select;0.sc-my-select,900.sc-my-select;1.sc-my-select,100.sc-my-select;1.sc-my-select,200.sc-my-select;1.sc-my-select,300.sc-my-select;1.sc-my-select,400.sc-my-select;1.sc-my-select,500.sc-my-select;1.sc-my-select,600.sc-my-select;1.sc-my-select,700.sc-my-select;1.sc-my-select,800.sc-my-select;1.sc-my-select,900&display=swap\").sc-my-select; .tinting-wrapper.sc-my-select *.sc-my-select{font-family:\"Poppins\", sans-serif}.select.sc-my-select{position:relative;width:300px}@media (max-width: 768px){.select.sc-my-select{width:100%}}.select.sc-my-select .input-wrapper.sc-my-select{position:relative;display:flex;align-items:flex-start}.select.sc-my-select input.sc-my-select{font-size:16px;padding:16px;border-radius:27.35px;border:1px solid #dfdfdf;width:100%;color:#4c4c4c;box-sizing:border-box;padding-right:50px}.select.sc-my-select button.sc-my-select{position:absolute;right:10px;background:transparent;border:none;cursor:pointer;width:40px;height:100%;display:flex;align-items:center;justify-content:center}.select.sc-my-select button.sc-my-select img.sc-my-select{transition:transform 0.3s ease}.select.sc-my-select button.sc-my-select img.rotated.sc-my-select{transform:rotate(180deg)}.select.sc-my-select .dropdown.sc-my-select{position:absolute;top:100%;left:0;width:100%;background:white;border:1px solid #dfdfdf;border-radius:5px;max-height:200px;overflow-y:auto;z-index:1000;padding:0;margin:0}.select.sc-my-select .dropdown.sc-my-select li.sc-my-select{padding:0;margin:0;padding:10px;cursor:pointer;list-style:none;text-align:left}.select.sc-my-select .dropdown.sc-my-select li.sc-my-select:hover{background:#f5f5f5}.select.sc-my-select .dropdown.sc-my-select .no-results.sc-my-select{padding:10px;text-align:center;color:#999}@media (max-width: 768px){.select.sc-my-select .dropdown.sc-my-select{position:relative}}";
16
5
 
@@ -116,6 +105,6 @@ function defineCustomElement() {
116
105
  } });
117
106
  }
118
107
 
119
- export { MySelect as M, debounce as a, defineCustomElement as d };
108
+ export { MySelect as M, defineCustomElement as d };
120
109
 
121
110
  //# sourceMappingURL=index4.js.map
@@ -1 +1 @@
1
- {"file":"index4.js","mappings":";;SAAgB,QAAQ,CAAC,IAA8B,EAAE,IAAY;EACnE,IAAI,OAAsC,CAAC;EAE3C,OAAO,SAAS,gBAAgB,CAAC,GAAG,IAAW;IAC7C,MAAM,KAAK,GAAG;MACZ,YAAY,CAAC,OAAO,CAAC,CAAC;MACtB,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;KACf,CAAC;IAEF,YAAY,CAAC,OAAO,CAAC,CAAC;IACtB,OAAO,GAAG,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;GACnC,CAAC;AACJ;;ACZA,MAAM,QAAQ,GAAG,wrEAAwrE;;MCU5rE,QAAQ;;;;;;;IAgBX,kBAAa,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;IAErD,oBAAe,GAAG,QAAQ,CA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AAC,EAAE,GAAG,EAAC,eAAe,EAAC,KAAK,EAAE,IAAI,CAAC,YAAY,GAAG,SAAS,GAAG,EAAE,GAAI,CACjH,CACL,EAEL,IAAI,CAAC,YAAY,KAChB,UAAI,KAAK,EAAC,UAAU,IACjB,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,IAC9B,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,KAC7B,UAAI,KAAK,EAAE,MAAM,CAAC,EAAE,KAAK,IAAI,GAAG,gBAAgB,GAAG,EAAE,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,YAAY,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,IAC5H,MAAM,CAAC,IAAI,CACT,CACN,CAAC,KAEF,UAAI,KAAK,EAAC,YAAY,uBAAsB,CAC7C,CACE,CACN,CACG,EACN;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/utils/index.ts","./src/components/select/index.scss?tag=my-select&encapsulation=scoped","./src/components/select/index.tsx"],"sourcesContent":["export function debounce(func: (...args: any[]) => void, wait: number) {\n let timeout: ReturnType<typeof setTimeout>;\n\n return function executedFunction(...args: any[]) {\n const later = () => {\n clearTimeout(timeout);\n func(...args);\n };\n\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n };\n}\n","@import '../../global/app.scss';\n\n.select {\n position: relative;\n width: 300px;\n\n @media (max-width: $small) {\n width: 100%;\n }\n\n .input-wrapper {\n position: relative;\n display: flex;\n align-items: flex-start;\n }\n\n input {\n font-size: 16px;\n padding: 16px;\n border-radius: 27.35px;\n border: 1px solid #dfdfdf;\n width: 100%;\n color: #4c4c4c;\n box-sizing: border-box;\n padding-right: 50px;\n }\n\n button {\n position: absolute;\n right: 10px;\n background: transparent;\n border: none;\n cursor: pointer;\n width: 40px;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n\n img {\n transition: transform 0.3s ease;\n\n &.rotated {\n transform: rotate(180deg);\n }\n }\n }\n\n .dropdown {\n position: absolute;\n top: 100%;\n left: 0;\n width: 100%;\n background: white;\n border: 1px solid #dfdfdf;\n border-radius: 5px;\n max-height: 200px;\n overflow-y: auto;\n z-index: 1000;\n padding: 0;\n margin: 0;\n\n li {\n padding: 0;\n margin: 0;\n padding: 10px;\n cursor: pointer;\n list-style: none;\n text-align: left;\n &:hover {\n background: #f5f5f5;\n }\n }\n\n .no-results {\n padding: 10px;\n text-align: center;\n color: #999;\n }\n @media (max-width: $small) {\n position: relative;\n }\n }\n}\n","import { Component, Prop, h, State, Event, EventEmitter, Listen, Watch, Element } from '@stencil/core';\nimport { getAssetPath } from '@stencil/core';\nimport { debounce } from '../../utils';\n\n@Component({\n tag: 'my-select',\n styleUrl: 'index.scss',\n assetsDirs: ['assets'],\n scoped: true,\n})\nexport class MySelect {\n @Element() el: HTMLElement;\n\n @Prop() options: any[] = []; // List of selectable options\n @Prop() placeholder: string = 'Select an option'; // Placeholder text\n @Prop() isMobile: boolean = false;\n @Prop() searchIcon: string = 'chevron.png'; // Search icon asset\n\n @State() searchText: string = '';\n @State() filteredOptions: any[] = [];\n @State() showDropdown: boolean = false;\n @State() selectedValue: string | null = null;\n @Event() onReset: EventEmitter<void>;\n @Event() selectValue: EventEmitter<{ key: string; value: number | null }>; // Emits selected value\n @Event() inputValueChange: EventEmitter<string>; // Emits input changes for filtering\n\n private defaultOption = { name: this.placeholder, id: null };\n\n private debouncedSearch = debounce((value: string) => {\n const optionsWithDefault = [this.defaultOption, ...this.options];\n this.filteredOptions = optionsWithDefault.filter(option => option.name.toLowerCase().includes(value.toLowerCase()));\n this.inputValueChange.emit(value);\n }, 300);\n\n private reset() {\n this.onReset.emit();\n }\n\n componentWillLoad() {\n this.filteredOptions = [this.defaultOption, ...this.options];\n }\n\n componentDidLoad() {\n document.addEventListener('click', this.handleClickOutside);\n }\n\n disconnectedCallback() {\n document.removeEventListener('click', this.handleClickOutside);\n }\n\n private handleClickOutside = (event: MouseEvent) => {\n if (!this.el.contains(event.target as Node)) {\n this.showDropdown = false;\n }\n };\n\n private handleInput(event: Event) {\n const value = (event.target as HTMLInputElement).value;\n this.searchText = value;\n this.showDropdown = true;\n this.debouncedSearch(value);\n }\n\n private selectOption(option: { key: string; value: number | null }) {\n if (option.value === null) {\n this.selectedValue = null;\n this.searchText = '';\n this.reset();\n } else {\n this.selectedValue = option.key;\n this.searchText = option.key;\n this.selectValue.emit(option);\n }\n this.showDropdown = false;\n }\n\n private toggleDropdown() {\n this.showDropdown = !this.showDropdown;\n }\n\n @Watch('options')\n updateOptions(newOptions: any[]) {\n this.filteredOptions = [this.defaultOption, ...newOptions];\n }\n\n @Listen('clearSearchText', { target: 'document' })\n clearSearchTextHandler() {\n this.searchText = '';\n this.selectedValue = null;\n this.reset();\n }\n\n render() {\n return (\n <div class=\"select\">\n <div class=\"input-wrapper\">\n <input type=\"text\" placeholder={this.placeholder} value={this.searchText} onInput={this.handleInput.bind(this)} onFocus={() => (this.showDropdown = true)} />\n <button onClick={() => this.toggleDropdown()}>\n <img src={getAssetPath(`./assets/${this.searchIcon}`)} alt=\"dropdown icon\" class={this.showDropdown ? 'rotated' : ''} />\n </button>\n </div>\n\n {this.showDropdown && (\n <ul class=\"dropdown\">\n {this.filteredOptions.length > 0 ? (\n this.filteredOptions.map(option => (\n <li class={option.id === null ? 'default-option' : ''} onClick={() => this.selectOption({ key: option.name, value: option.id })}>\n {option.name}\n </li>\n ))\n ) : (\n <li class=\"no-results\">No results found</li>\n )}\n </ul>\n )}\n </div>\n );\n }\n}\n"],"version":3}
1
+ {"file":"index4.js","mappings":";;;AAAA,MAAM,QAAQ,GAAG,wrEAAwrE;;MCU5rE,QAAQ;;;;;;;IAgBX,kBAAa,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;IAErD,oBAAe,GAAG,QAAQ,CAAC,CAAC,KAA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AG,EAAC,eAAe,EAAC,KAAK,EAAE,IAAI,CAAC,YAAY,GAAG,SAAS,GAAG,EAAE,GAAI,CACjH,CACL,EAEL,IAAI,CAAC,YAAY,KAChB,UAAI,KAAK,EAAC,UAAU,IACjB,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,IAC9B,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,KAC7B,UAAI,KAAK,EAAE,MAAM,CAAC,EAAE,KAAK,IAAI,GAAG,gBAAgB,GAAG,EAAE,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,YAAY,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,IAC5H,MAAM,CAAC,IAAI,CACT,CACN,CAAC,KAEF,UAAI,KAAK,EAAC,YAAY,uBAAsB,CAC7C,CACE,CACN,CACG,EACN;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/select/index.scss?tag=my-select&encapsulation=scoped","./src/components/select/index.tsx"],"sourcesContent":["@import '../../global/app.scss';\n\n.select {\n position: relative;\n width: 300px;\n\n @media (max-width: $small) {\n width: 100%;\n }\n\n .input-wrapper {\n position: relative;\n display: flex;\n align-items: flex-start;\n }\n\n input {\n font-size: 16px;\n padding: 16px;\n border-radius: 27.35px;\n border: 1px solid #dfdfdf;\n width: 100%;\n color: #4c4c4c;\n box-sizing: border-box;\n padding-right: 50px;\n }\n\n button {\n position: absolute;\n right: 10px;\n background: transparent;\n border: none;\n cursor: pointer;\n width: 40px;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n\n img {\n transition: transform 0.3s ease;\n\n &.rotated {\n transform: rotate(180deg);\n }\n }\n }\n\n .dropdown {\n position: absolute;\n top: 100%;\n left: 0;\n width: 100%;\n background: white;\n border: 1px solid #dfdfdf;\n border-radius: 5px;\n max-height: 200px;\n overflow-y: auto;\n z-index: 1000;\n padding: 0;\n margin: 0;\n\n li {\n padding: 0;\n margin: 0;\n padding: 10px;\n cursor: pointer;\n list-style: none;\n text-align: left;\n &:hover {\n background: #f5f5f5;\n }\n }\n\n .no-results {\n padding: 10px;\n text-align: center;\n color: #999;\n }\n @media (max-width: $small) {\n position: relative;\n }\n }\n}\n","import { Component, Prop, h, State, Event, EventEmitter, Listen, Watch, Element } from '@stencil/core';\nimport { getAssetPath } from '@stencil/core';\nimport { debounce } from '../../utils';\n\n@Component({\n tag: 'my-select',\n styleUrl: 'index.scss',\n assetsDirs: ['assets'],\n scoped: true,\n})\nexport class MySelect {\n @Element() el: HTMLElement;\n\n @Prop() options: any[] = []; // List of selectable options\n @Prop() placeholder: string = 'Select an option'; // Placeholder text\n @Prop() isMobile: boolean = false;\n @Prop() searchIcon: string = 'chevron.png'; // Search icon asset\n\n @State() searchText: string = '';\n @State() filteredOptions: any[] = [];\n @State() showDropdown: boolean = false;\n @State() selectedValue: string | null = null;\n @Event() onReset: EventEmitter<void>;\n @Event() selectValue: EventEmitter<{ key: string; value: number | null }>; // Emits selected value\n @Event() inputValueChange: EventEmitter<string>; // Emits input changes for filtering\n\n private defaultOption = { name: this.placeholder, id: null };\n\n private debouncedSearch = debounce((value: string) => {\n const optionsWithDefault = [this.defaultOption, ...this.options];\n this.filteredOptions = optionsWithDefault.filter(option => option.name.toLowerCase().includes(value.toLowerCase()));\n this.inputValueChange.emit(value);\n }, 300);\n\n private reset() {\n this.onReset.emit();\n }\n\n componentWillLoad() {\n this.filteredOptions = [this.defaultOption, ...this.options];\n }\n\n componentDidLoad() {\n document.addEventListener('click', this.handleClickOutside);\n }\n\n disconnectedCallback() {\n document.removeEventListener('click', this.handleClickOutside);\n }\n\n private handleClickOutside = (event: MouseEvent) => {\n if (!this.el.contains(event.target as Node)) {\n this.showDropdown = false;\n }\n };\n\n private handleInput(event: Event) {\n const value = (event.target as HTMLInputElement).value;\n this.searchText = value;\n this.showDropdown = true;\n this.debouncedSearch(value);\n }\n\n private selectOption(option: { key: string; value: number | null }) {\n if (option.value === null) {\n this.selectedValue = null;\n this.searchText = '';\n this.reset();\n } else {\n this.selectedValue = option.key;\n this.searchText = option.key;\n this.selectValue.emit(option);\n }\n this.showDropdown = false;\n }\n\n private toggleDropdown() {\n this.showDropdown = !this.showDropdown;\n }\n\n @Watch('options')\n updateOptions(newOptions: any[]) {\n this.filteredOptions = [this.defaultOption, ...newOptions];\n }\n\n @Listen('clearSearchText', { target: 'document' })\n clearSearchTextHandler() {\n this.searchText = '';\n this.selectedValue = null;\n this.reset();\n }\n\n render() {\n return (\n <div class=\"select\">\n <div class=\"input-wrapper\">\n <input type=\"text\" placeholder={this.placeholder} value={this.searchText} onInput={this.handleInput.bind(this)} onFocus={() => (this.showDropdown = true)} />\n <button onClick={() => this.toggleDropdown()}>\n <img src={getAssetPath(`./assets/${this.searchIcon}`)} alt=\"dropdown icon\" class={this.showDropdown ? 'rotated' : ''} />\n </button>\n </div>\n\n {this.showDropdown && (\n <ul class=\"dropdown\">\n {this.filteredOptions.length > 0 ? (\n this.filteredOptions.map(option => (\n <li class={option.id === null ? 'default-option' : ''} onClick={() => this.selectOption({ key: option.name, value: option.id })}>\n {option.name}\n </li>\n ))\n ) : (\n <li class=\"no-results\">No results found</li>\n )}\n </ul>\n )}\n </div>\n );\n }\n}\n"],"version":3}
@@ -1,31 +1,32 @@
1
- import { proxyCustomElement, HTMLElement } from '@stencil/core/internal/client';
2
-
3
- const indexCss = "@import url(\"https://fonts.googleapis.com/css2?family=Figtree:ital,wght@0,300..900;1,300..900&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap\"); .tinting-wrapper *{font-family:\"Poppins\", sans-serif}my-backdrop{width:100%;height:100%;background-color:rgba(0, 0, 0, 0.7);position:fixed;z-index:100;left:0;top:0}";
4
-
5
- const MyBackdrop = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
6
- constructor() {
7
- super();
8
- this.__registerHost();
9
- }
10
- render() {
11
- return null;
12
- }
13
- static get style() { return indexCss; }
14
- }, [0, "my-backdrop"]);
15
- function defineCustomElement() {
16
- if (typeof customElements === "undefined") {
17
- return;
18
- }
19
- const components = ["my-backdrop"];
20
- components.forEach(tagName => { switch (tagName) {
21
- case "my-backdrop":
22
- if (!customElements.get(tagName)) {
23
- customElements.define(tagName, MyBackdrop);
24
- }
25
- break;
26
- } });
1
+ /**
2
+ * Returns true when a hex color is so light it is hard to distinguish from a
3
+ * white background (e.g. NCS S 0300-N #fafaf8). Uses perceived luminance.
4
+ * Accepts values with or without a leading '#', in 3- or 6-digit form.
5
+ */
6
+ function isVeryLightColor(hex) {
7
+ var _a;
8
+ const cleaned = (_a = hex === null || hex === void 0 ? void 0 : hex.replace('#', '')) !== null && _a !== void 0 ? _a : '';
9
+ if (cleaned.length !== 6 && cleaned.length !== 3)
10
+ return false;
11
+ const short = cleaned.length === 3;
12
+ const r = parseInt(short ? cleaned[0] + cleaned[0] : cleaned.slice(0, 2), 16) / 255;
13
+ const g = parseInt(short ? cleaned[1] + cleaned[1] : cleaned.slice(2, 4), 16) / 255;
14
+ const b = parseInt(short ? cleaned[2] + cleaned[2] : cleaned.slice(4, 6), 16) / 255;
15
+ const luminance = 0.299 * r + 0.587 * g + 0.114 * b;
16
+ return luminance > 0.96;
17
+ }
18
+ function debounce(func, wait) {
19
+ let timeout;
20
+ return function executedFunction(...args) {
21
+ const later = () => {
22
+ clearTimeout(timeout);
23
+ func(...args);
24
+ };
25
+ clearTimeout(timeout);
26
+ timeout = setTimeout(later, wait);
27
+ };
27
28
  }
28
29
 
29
- export { MyBackdrop as M, defineCustomElement as d };
30
+ export { debounce as d, isVeryLightColor as i };
30
31
 
31
32
  //# sourceMappingURL=index6.js.map
@@ -1 +1 @@
1
- {"file":"index6.js","mappings":";;AAAA,MAAM,QAAQ,GAAG,6ZAA6Z;;MCMja,UAAU;;;;;EACrB,MAAM;IACJ,OAAO,IAAI,CAAC;GACb;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/backdrop/index.scss?tag=my-backdrop","./src/components/backdrop/index.tsx"],"sourcesContent":["@import '../../global/app.scss';\n\nmy-backdrop {\n width: 100%;\n height: 100%;\n background-color: $backdrop_black;\n position: fixed;\n z-index: 100;\n left: 0;\n top: 0;\n}\n","import { Component } from '@stencil/core';\n\n@Component({\n tag: 'my-backdrop',\n styleUrl: 'index.scss',\n})\nexport class MyBackdrop {\n render() {\n return null;\n }\n}\n"],"version":3}
1
+ {"file":"index6.js","mappings":"AAAA;;;;;SAKgB,gBAAgB,CAAC,GAA8B;;EAC7D,MAAM,OAAO,GAAG,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,mCAAI,EAAE,CAAC;EAC5C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;IAAE,OAAO,KAAK,CAAC;EAC/D,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC;EACnC,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC;EACpF,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC;EACpF,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC;EACpF,MAAM,SAAS,GAAG,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;EACpD,OAAO,SAAS,GAAG,IAAI,CAAC;AAC1B,CAAC;SAEe,QAAQ,CAAC,IAA8B,EAAE,IAAY;EACnE,IAAI,OAAsC,CAAC;EAE3C,OAAO,SAAS,gBAAgB,CAAC,GAAG,IAAW;IAC7C,MAAM,KAAK,GAAG;MACZ,YAAY,CAAC,OAAO,CAAC,CAAC;MACtB,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;KACf,CAAC;IAEF,YAAY,CAAC,OAAO,CAAC,CAAC;IACtB,OAAO,GAAG,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;GACnC,CAAC;AACJ;;;;","names":[],"sources":["./src/utils/index.ts"],"sourcesContent":["/**\n * Returns true when a hex color is so light it is hard to distinguish from a\n * white background (e.g. NCS S 0300-N ≈ #fafaf8). Uses perceived luminance.\n * Accepts values with or without a leading '#', in 3- or 6-digit form.\n */\nexport function isVeryLightColor(hex: string | null | undefined): boolean {\n const cleaned = hex?.replace('#', '') ?? '';\n if (cleaned.length !== 6 && cleaned.length !== 3) return false;\n const short = cleaned.length === 3;\n const r = parseInt(short ? cleaned[0] + cleaned[0] : cleaned.slice(0, 2), 16) / 255;\n const g = parseInt(short ? cleaned[1] + cleaned[1] : cleaned.slice(2, 4), 16) / 255;\n const b = parseInt(short ? cleaned[2] + cleaned[2] : cleaned.slice(4, 6), 16) / 255;\n const luminance = 0.299 * r + 0.587 * g + 0.114 * b;\n return luminance > 0.96;\n}\n\nexport function debounce(func: (...args: any[]) => void, wait: number) {\n let timeout: ReturnType<typeof setTimeout>;\n\n return function executedFunction(...args: any[]) {\n const later = () => {\n clearTimeout(timeout);\n func(...args);\n };\n\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n };\n}\n"],"version":3}
@@ -1,75 +1,31 @@
1
- import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
- import { s as setDataLayer } from './gtmUtils.js';
3
- import { a as APIURL, b as accessToken } from './index5.js';
1
+ import { proxyCustomElement, HTMLElement } from '@stencil/core/internal/client';
4
2
 
5
- const indexCss = "@import url(\"https://fonts.googleapis.com/css2?family=Figtree:ital,wght@0,300..900;1,300..900&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap\"); .tinting-wrapper *{font-family:\"Poppins\", sans-serif}.my-color-box{width:125px;height:125px;display:block;margin-bottom:5px;cursor:pointer;display:flex;flex-direction:column;justify-content:flex-end;position:relative}@media (max-width: 1024px){.my-color-box{width:65px;height:65px}}.my-color-box .color-name{width:100%;background-color:#fff;padding:15px 0px 10px;border-top-left-radius:15px;border-top-right-radius:15px;opacity:0;transition:0.3s opacity ease-in-out;font-size:10px;color:#232323;text-transform:lowercase}.my-color-box.active .color-name{opacity:1}.my-color-box.categoryactive{width:120px;height:115px}.my-color-box.categoryactive .color-name{opacity:1}@media (max-width: 1024px){.my-color-box.categoryactive{width:72px;height:72px}}.my-color-box:hover .color-name{opacity:1}";
3
+ const indexCss = "@import url(\"https://fonts.googleapis.com/css2?family=Figtree:ital,wght@0,300..900;1,300..900&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap\"); .tinting-wrapper *{font-family:\"Poppins\", sans-serif}my-backdrop{width:100%;height:100%;background-color:rgba(0, 0, 0, 0.7);position:fixed;z-index:100;left:0;top:0}";
6
4
 
7
- const MyColorBox = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
5
+ const MyBackdrop = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
8
6
  constructor() {
9
7
  super();
10
8
  this.__registerHost();
11
- this.colorCheck = () => {
12
- this.checkTimeout = setTimeout(() => {
13
- setDataLayer({
14
- event: 'ColorCheck',
15
- shop: this.shop,
16
- product: this.product,
17
- color: this.name,
18
- });
19
- }, 2000);
20
- };
21
- this.colorUnCheck = () => {
22
- if (this.checkTimeout)
23
- clearTimeout(this.checkTimeout);
24
- this.checkTimeout = undefined;
25
- };
26
- this.darkenColor = (color) => {
27
- const red = parseInt(color[1] + color[2], 16) - 20;
28
- const green = parseInt(color[3] + color[4], 16) - 20;
29
- const blue = parseInt(color[5] + color[6], 16) - 20;
30
- return `rgb(${red},${green},${blue})`;
31
- };
32
- this.color = undefined;
33
- this.name = undefined;
34
- this.shop = undefined;
35
- this.product = undefined;
36
- this.isActive = undefined;
37
- this.isCategoryActive = undefined;
38
- this.isImageInsteadHex = undefined;
39
9
  }
40
10
  render() {
41
- var _a, _b, _c;
42
- return (h("div", { onMouseEnter: () => this.colorCheck(), onMouseLeave: () => this.colorUnCheck(), class: `my-color-box ${this.isActive ? 'active' : ''} ${this.isCategoryActive ? 'categoryactive' : ''}`, style: {
43
- backgroundSize: ((_a = this.isImageInsteadHex) === null || _a === void 0 ? void 0 : _a.isImageInsteadHex) ? 'cover' : '',
44
- backgroundImage: ((_b = this.isImageInsteadHex) === null || _b === void 0 ? void 0 : _b.isImageInsteadHex) ? `url(${APIURL}/assets/${this.isImageInsteadHex.bigImage}?access_token=${accessToken})` : '',
45
- background: ((_c = this.isImageInsteadHex) === null || _c === void 0 ? void 0 : _c.isImageInsteadHex) ? this.isImageInsteadHex.bigImage : this.color,
46
- border: this.isCategoryActive ? `5px solid ${this.darkenColor(this.color)}` : '',
47
- } }, h("div", { class: "color-name" }, this.name)));
11
+ return null;
48
12
  }
49
13
  static get style() { return indexCss; }
50
- }, [0, "my-colorbox", {
51
- "color": [1],
52
- "name": [1],
53
- "shop": [1],
54
- "product": [1],
55
- "isActive": [4, "is-active"],
56
- "isCategoryActive": [4, "is-category-active"],
57
- "isImageInsteadHex": [16]
58
- }]);
14
+ }, [0, "my-backdrop"]);
59
15
  function defineCustomElement() {
60
16
  if (typeof customElements === "undefined") {
61
17
  return;
62
18
  }
63
- const components = ["my-colorbox"];
19
+ const components = ["my-backdrop"];
64
20
  components.forEach(tagName => { switch (tagName) {
65
- case "my-colorbox":
21
+ case "my-backdrop":
66
22
  if (!customElements.get(tagName)) {
67
- customElements.define(tagName, MyColorBox);
23
+ customElements.define(tagName, MyBackdrop);
68
24
  }
69
25
  break;
70
26
  } });
71
27
  }
72
28
 
73
- export { MyColorBox as M, defineCustomElement as d };
29
+ export { MyBackdrop as M, defineCustomElement as d };
74
30
 
75
31
  //# sourceMappingURL=index7.js.map
@@ -1 +1 @@
1
- {"file":"index7.js","mappings":";;;;AAAA,MAAM,QAAQ,GAAG,+gCAA+gC;;MCSnhC,UAAU;;;;IAWrB,eAAU,GAAG;MACX,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC;QAC7B,YAAY,CAAC;UACX,KAAK,EAAE,YAAY;UACnB,IAAI,EAAE,IAAI,CAAC,IAAI;UACf,OAAO,EAAE,IAAI,CAAC,OAAO;UACrB,KAAK,EAAE,IAAI,CAAC,IAAI;SACjB,CAAC,CAAC;OACJ,EAAE,IAAI,CAAC,CAAC;KACV,CAAC;IAEF,iBAAY,GAAG;MACb,IAAI,IAAI,CAAC,YAAY;QAAE,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;MACvD,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;KAC/B,CAAC;IAEF,gBAAW,GAAG,CAAC,KAAa;MAC1B,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC;MACnD,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC;MACrD,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC;MACpD,OAAO,OAAO,GAAG,IAAI,KAAK,IAAI,IAAI,GAAG,CAAC;KACvC,CAAC;;;;;;;;;EAEF,MAAM;;IACJ,QACE,WACE,YAAY,EAAE,MAAM,IAAI,CAAC,UAAU,EAAE,EACrC,YAAY,EAAE,MAAM,IAAI,CAAC,YAAY,EAAE,EACvC,KAAK,EAAE,gBAAgB,IAAI,CAAC,QAAQ,GAAG,QAAQ,GAAG,EAAE,IAAI,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,GAAG,EAAE,EAAE,EACvG,KAAK,EAAE;QACL,cAAc,EAAE,CAAA,MAAA,IAAI,CAAC,iBAAiB,0CAAE,iBAAiB,IAAG,OAAO,GAAG,EAAE;QACxE,eAAe,EAAE,CAAA,MAAA,IAAI,CAAC,iBAAiB,0CAAE,iBAAiB,IAAG,OAAO,MAAM,WAAW,IAAI,CAAC,iBAAiB,CAAC,QAAQ,iBAAiB,WAAW,GAAG,GAAG,EAAE;QACxJ,UAAU,EAAE,CAAA,MAAA,IAAI,CAAC,iBAAiB,0CAAE,iBAAiB,IAAG,IAAI,CAAC,iBAAiB,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK;QACpG,MAAM,EAAE,IAAI,CAAC,gBAAgB,GAAG,aAAa,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE;OACjF,IAED,WAAK,KAAK,EAAC,YAAY,IAAE,IAAI,CAAC,IAAI,CAAO,CACrC,EACN;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/colorbox/index.scss?tag=my-colorbox","./src/components/colorbox/index.tsx"],"sourcesContent":["@import '../../global/app.scss';\n\n.my-color-box {\n width: 125px;\n height: 125px;\n display: block;\n margin-bottom: 5px;\n cursor: pointer;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n position: relative;\n\n @media (max-width: $medium) {\n width: 65px;\n height: 65px;\n }\n .color-name {\n width: 100%;\n background-color: $white;\n padding: 15px 0px 10px;\n border-top-left-radius: 15px;\n border-top-right-radius: 15px;\n opacity: 0;\n transition: 0.3s opacity ease-in-out;\n font-size: 10px;\n color: $black;\n text-transform: lowercase;\n }\n &.active {\n .color-name {\n opacity: 1;\n }\n }\n\n &.categoryactive {\n width: 120px;\n height: 115px;\n .color-name {\n opacity: 1;\n }\n\n @media (max-width: $medium) {\n width: 72px;\n height: 72px;\n }\n }\n &:hover {\n .color-name {\n opacity: 1;\n }\n }\n}\n","import { Component, Prop, h } from '@stencil/core';\nimport { setDataLayer } from '../../gtmUtils';\nimport { ColorBoxyIsImageInsteadHex } from '../../types';\nimport { APIURL, accessToken } from '../api';\n\n@Component({\n tag: 'my-colorbox',\n styleUrl: 'index.scss',\n})\nexport class MyColorBox {\n private checkTimeout: ReturnType<typeof setTimeout> | undefined;\n\n @Prop() color: string;\n @Prop() name: string;\n @Prop() shop: string;\n @Prop() product: string;\n @Prop() isActive?: boolean;\n @Prop() isCategoryActive?: boolean;\n @Prop() isImageInsteadHex?: ColorBoxyIsImageInsteadHex;\n\n colorCheck = () => {\n this.checkTimeout = setTimeout(() => {\n setDataLayer({\n event: 'ColorCheck',\n shop: this.shop,\n product: this.product,\n color: this.name,\n });\n }, 2000);\n };\n\n colorUnCheck = () => {\n if (this.checkTimeout) clearTimeout(this.checkTimeout);\n this.checkTimeout = undefined;\n };\n\n darkenColor = (color: string) => {\n const red = parseInt(color[1] + color[2], 16) - 20;\n const green = parseInt(color[3] + color[4], 16) - 20;\n const blue = parseInt(color[5] + color[6], 16) - 20;\n return `rgb(${red},${green},${blue})`;\n };\n\n render() {\n return (\n <div\n onMouseEnter={() => this.colorCheck()}\n onMouseLeave={() => this.colorUnCheck()}\n class={`my-color-box ${this.isActive ? 'active' : ''} ${this.isCategoryActive ? 'categoryactive' : ''}`}\n style={{\n backgroundSize: this.isImageInsteadHex?.isImageInsteadHex ? 'cover' : '',\n backgroundImage: this.isImageInsteadHex?.isImageInsteadHex ? `url(${APIURL}/assets/${this.isImageInsteadHex.bigImage}?access_token=${accessToken})` : '',\n background: this.isImageInsteadHex?.isImageInsteadHex ? this.isImageInsteadHex.bigImage : this.color,\n border: this.isCategoryActive ? `5px solid ${this.darkenColor(this.color)}` : '',\n }}\n >\n <div class=\"color-name\">{this.name}</div>\n </div>\n );\n }\n}\n"],"version":3}
1
+ {"file":"index7.js","mappings":";;AAAA,MAAM,QAAQ,GAAG,6ZAA6Z;;MCMja,UAAU;;;;;EACrB,MAAM;IACJ,OAAO,IAAI,CAAC;GACb;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/backdrop/index.scss?tag=my-backdrop","./src/components/backdrop/index.tsx"],"sourcesContent":["@import '../../global/app.scss';\n\nmy-backdrop {\n width: 100%;\n height: 100%;\n background-color: $backdrop_black;\n position: fixed;\n z-index: 100;\n left: 0;\n top: 0;\n}\n","import { Component } from '@stencil/core';\n\n@Component({\n tag: 'my-backdrop',\n styleUrl: 'index.scss',\n})\nexport class MyBackdrop {\n render() {\n return null;\n }\n}\n"],"version":3}
@@ -1,165 +1,92 @@
1
- import { proxyCustomElement, HTMLElement, createEvent, h, getAssetPath } from '@stencil/core/internal/client';
1
+ import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
2
  import { s as setDataLayer } from './gtmUtils.js';
3
+ import { i as isVeryLightColor } from './index6.js';
3
4
  import { a as APIURL, b as accessToken } from './index5.js';
4
- import { d as defineCustomElement$1 } from './index9.js';
5
5
 
6
- const MyColorInfo = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
6
+ const indexCss = "@import url(\"https://fonts.googleapis.com/css2?family=Figtree:ital,wght@0,300..900;1,300..900&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap\"); .tinting-wrapper *{font-family:\"Poppins\", sans-serif}.my-color-box{width:125px;height:125px;display:block;margin-bottom:5px;cursor:pointer;display:flex;flex-direction:column;justify-content:flex-end;position:relative}@media (max-width: 1024px){.my-color-box{width:65px;height:65px}}.my-color-box .color-name{width:100%;background-color:#fff;padding:15px 0px 10px;border-top-left-radius:15px;border-top-right-radius:15px;opacity:0;transition:0.3s opacity ease-in-out;font-size:10px;color:#232323;text-transform:lowercase}.my-color-box.active .color-name{opacity:1}.my-color-box.categoryactive{width:120px;height:115px}.my-color-box.categoryactive .color-name{opacity:1}@media (max-width: 1024px){.my-color-box.categoryactive{width:72px;height:72px}}.my-color-box:hover .color-name{opacity:1}";
7
+
8
+ const MyColorBox = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
7
9
  constructor() {
8
10
  super();
9
11
  this.__registerHost();
10
- this.onCurrentColor = createEvent(this, "onCurrentColor", 7);
11
- this.addToBasket = createEvent(this, "addToBasket", 7);
12
- this.closeInfoBox = createEvent(this, "closeInfoBox", 7);
13
- this.loadingTimeout = null;
14
- this.successTimeout = null;
15
- this.goToProduct = () => {
16
- var _a;
17
- this.onCurrentColor.emit(this.currentColor);
18
- this.currentColor &&
12
+ this.colorCheck = () => {
13
+ this.checkTimeout = setTimeout(() => {
19
14
  setDataLayer({
20
- event: 'GoToProduct',
15
+ event: 'ColorCheck',
21
16
  shop: this.shop,
22
17
  product: this.product,
23
- color: (_a = this.currentColor) === null || _a === void 0 ? void 0 : _a.name,
18
+ color: this.name,
24
19
  });
25
- this.closeInfoBox.emit();
26
- };
27
- this.onCloseButtonClick = () => {
28
- this.closeInfoBox.emit();
29
- };
30
- this.getHref = () => {
31
- var _a, _b, _c, _d;
32
- if (this.baselink) {
33
- return `${this.baselink}/${(_b = (_a = this === null || this === void 0 ? void 0 : this.currentColor.links) === null || _a === void 0 ? void 0 : _a.find((link) => (link === null || link === void 0 ? void 0 : link.shop) === this.shop)) === null || _b === void 0 ? void 0 : _b.path}`;
34
- }
35
- return (_d = (_c = this === null || this === void 0 ? void 0 : this.currentColor.links) === null || _c === void 0 ? void 0 : _c.find((link) => (link === null || link === void 0 ? void 0 : link.shop) === this.shop)) === null || _d === void 0 ? void 0 : _d.path;
36
- };
37
- this.renderSliderOrImage = () => {
38
- var _a;
39
- if (this.currentColor.imageInsteadHex) {
40
- return h("img", { class: 'color-big-image', src: `${APIURL}/assets/${this.currentColor.bigImage}?access_token=${accessToken}`, alt: "color-image" });
41
- }
42
- else {
43
- return h("my-slider", { color: this.currentColor.name, shop: this.shop, product: this.product, slides: (_a = this.data) === null || _a === void 0 ? void 0 : _a.images });
44
- }
20
+ }, 2000);
45
21
  };
46
- this.capitalizeFirstLetter = (string) => {
47
- return string.charAt(0).toUpperCase() + string.slice(1).toLocaleLowerCase();
22
+ this.colorUnCheck = () => {
23
+ if (this.checkTimeout)
24
+ clearTimeout(this.checkTimeout);
25
+ this.checkTimeout = undefined;
48
26
  };
49
- this.isVeryLightBackground = () => {
50
- var _a, _b;
51
- if (this.currentColor.imageInsteadHex)
52
- return true;
53
- const hex = (_b = (_a = this.currentColor.hex) === null || _a === void 0 ? void 0 : _a.replace('#', '')) !== null && _b !== void 0 ? _b : '';
54
- if (hex.length !== 6 && hex.length !== 3)
55
- return false;
56
- const r = parseInt(hex.length === 3 ? hex[0] + hex[0] : hex.slice(0, 2), 16) / 255;
57
- const g = parseInt(hex.length === 3 ? hex[1] + hex[1] : hex.slice(2, 4), 16) / 255;
58
- const b = parseInt(hex.length === 3 ? hex[2] + hex[2] : hex.slice(4, 6), 16) / 255;
59
- const luminance = 0.299 * r + 0.587 * g + 0.114 * b;
60
- return luminance > 0.96;
27
+ this.darkenColor = (color) => {
28
+ const red = parseInt(color[1] + color[2], 16) - 20;
29
+ const green = parseInt(color[3] + color[4], 16) - 20;
30
+ const blue = parseInt(color[5] + color[6], 16) - 20;
31
+ return `rgb(${red},${green},${blue})`;
61
32
  };
62
- this.getButtonClass = () => {
63
- if (this.currentColor.imageInsteadHex)
64
- return 'brown';
65
- return this.isVeryLightBackground() ? 'inverse' : '';
33
+ this.isLightSwatch = () => { var _a; return !((_a = this.isImageInsteadHex) === null || _a === void 0 ? void 0 : _a.isImageInsteadHex) && isVeryLightColor(this.color); };
34
+ // Active category keeps its 5px solid border (all active swatches share it, so
35
+ // alignment is consistent). In the normal grid we use an inset box-shadow
36
+ // instead of a border so light swatches gain a visible edge without changing
37
+ // their box size and skewing the grid.
38
+ this.getBorder = () => {
39
+ if (!this.isCategoryActive)
40
+ return '';
41
+ return `5px solid ${this.isLightSwatch() ? '#d9d9d9' : this.darkenColor(this.color)}`;
66
42
  };
67
- this.handleAddToBasket = () => {
68
- var _a;
69
- if (!((_a = this.availableTesters) === null || _a === void 0 ? void 0 : _a.id_product_attribute))
70
- return;
71
- if (this.basketStatus !== 'idle')
72
- return;
73
- this.clearBasketTimeouts();
74
- this.basketStatus = 'loading';
75
- this.addToBasket.emit({
76
- id: this.availableTesters.id_product_attribute,
77
- });
78
- this.loadingTimeout = setTimeout(() => {
79
- this.basketStatus = 'success';
80
- this.successTimeout = setTimeout(() => {
81
- this.basketStatus = 'idle';
82
- }, 2500);
83
- }, 900);
43
+ this.getBoxShadow = () => {
44
+ if (this.isCategoryActive)
45
+ return '';
46
+ return this.isLightSwatch() ? 'inset 0 0 0 1px #d9d9d9' : '';
84
47
  };
85
- this.currentColor = undefined;
48
+ this.color = undefined;
49
+ this.name = undefined;
86
50
  this.shop = undefined;
87
51
  this.product = undefined;
88
- this.baselink = undefined;
89
- this.availableTesters = undefined;
90
- this.price = undefined;
91
- this.data = null;
92
- this.isMobile = false;
93
- this.infoBoxWidth = undefined;
94
- this.closeImage = 'close.png';
95
- this.basketStatus = 'idle';
96
- }
97
- onColorChange(newColor, oldColor) {
98
- if ((newColor === null || newColor === void 0 ? void 0 : newColor.name) === (oldColor === null || oldColor === void 0 ? void 0 : oldColor.name))
99
- return;
100
- this.resetBasketStatus();
101
- }
102
- disconnectedCallback() {
103
- this.clearBasketTimeouts();
104
- }
105
- clearBasketTimeouts() {
106
- if (this.loadingTimeout) {
107
- clearTimeout(this.loadingTimeout);
108
- this.loadingTimeout = null;
109
- }
110
- if (this.successTimeout) {
111
- clearTimeout(this.successTimeout);
112
- this.successTimeout = null;
113
- }
114
- }
115
- resetBasketStatus() {
116
- this.clearBasketTimeouts();
117
- this.basketStatus = 'idle';
52
+ this.isActive = undefined;
53
+ this.isCategoryActive = undefined;
54
+ this.isImageInsteadHex = undefined;
118
55
  }
119
56
  render() {
120
- var _a;
121
- return (h("div", { class: `boxes__box-content ${this.currentColor.textWhite ? 'boxes__box-content__white' : ''}`, style: {
122
- background: this.currentColor.imageInsteadHex ? 'white' : this.currentColor.hex,
123
- maxWidth: `${this.infoBoxWidth && this.infoBoxWidth - 4}px`,
124
- } }, this.isMobile && h("img", { class: 'closebtn', onClick: this.onCloseButtonClick, src: getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" }), h("div", { class: "boxes__box-content__info", style: {
125
- maxWidth: this.isMobile ? `${this.infoBoxWidth && this.infoBoxWidth - 35}px` : ``,
126
- } }, !this.isMobile && h("img", { class: 'closebtn', onClick: this.onCloseButtonClick, src: getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" }), h("h2", null, this.currentColor.name), !this.isMobile && h("h4", null, this.currentColor.number), h("div", { class: "boxes__box-content__info__value" }, h("div", { class: "divider" }), h("div", { class: "boxes__box-content__info__tester" }, h("div", { class: "divider" }), h("div", { class: "tester-text" }, h("h2", null, "Zamow tester"), h("p", null, "Sprawdz go na swojej scianie.")), h("div", { class: "tester-buy" }, h("div", { class: "price" }, this.price ? `${this.price} zl` : ''), this.isMobile && h("div", { class: 'divider' }), this.basketStatus !== 'success' && (h("button", { class: `button fit ${this.getButtonClass()} ${!this.availableTesters ? 'disabled' : ''} ${this.basketStatus === 'loading' ? 'is-loading' : ''}`, onClick: this.handleAddToBasket, disabled: !this.availableTesters || this.basketStatus === 'loading' }, h("span", { class: "button-content" }, h("span", { class: "shape-icon", "aria-hidden": "true" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "15", height: "16", viewBox: "0 0 15 16" }, h("path", { class: "shape-icon__path", transform: "translate(0.0867462 0)", d: "M13.246571 12.763281L11.931726 4.961875C11.801879 4.1936703 11.13567 3.6319427 10.35657 3.63375L9.7429771 3.63375L9.7429771 3.1025C9.7429771 1.3890365 8.35394 0 6.6404767 0C4.9270134 0 3.537977 1.3890365 3.537977 3.1025L3.537977 3.63375L2.9217269 3.63375C2.1426277 3.6319427 1.4764187 4.1936703 1.3465706 4.961875L0.034383144 12.763281C-0.086738147 13.483807 0.11555123 14.221112 0.58740741 14.778946C1.0592636 15.336781 1.7528107 15.658594 2.4834456 15.658594L10.797508 15.658594C11.528143 15.658594 12.22169 15.336781 12.693546 14.778946C13.165402 14.221112 13.367692 13.483807 13.246571 12.763281L13.246571 12.763281ZM4.3348517 3.0892186C4.3348517 1.8158572 5.3671155 0.78359371 6.6404767 0.78359371C7.9138384 0.78359371 8.9461021 1.8158572 8.9461021 3.0892186L8.9461021 3.6204686L4.3348517 3.6204686L4.3348517 3.0892186ZM12.08579 14.264063C11.765244 14.643165 11.293964 14.86172 10.797508 14.86172L2.4834456 14.86172C1.9871488 14.862442 1.5158025 14.644215 1.195269 14.265309C0.87473541 13.886404 0.73765546 13.385406 0.82063317 12.896093L2.1248519 5.092031C2.1891608 4.703371 2.5278175 4.4200282 2.9217269 4.4252396L3.5353208 4.4252396L3.5353208 5.5834374C3.5353208 5.8034883 3.7137072 5.9818749 3.9337583 5.9818749C4.1538091 5.9818749 4.3321958 5.8034883 4.3321958 5.5834374L4.3321958 4.4252396L8.9461021 4.4252396L8.9461021 5.5834374C8.9461021 5.8034883 9.1244888 5.9818749 9.3445396 5.9818749C9.5645905 5.9818749 9.7429771 5.8034883 9.7429771 5.5834374L9.7429771 4.4252396L10.359227 4.4252396C10.753137 4.4200282 11.091793 4.703371 11.156102 5.092031L12.46032 12.896093C12.542204 13.384947 12.40527 13.885097 12.08579 14.264063L12.08579 14.264063Z" }))), !this.availableTesters ? 'Tester obecnie niedostepny' : 'Dodaj do koszyka'), this.basketStatus === 'loading' && (h("span", { class: "spinner", "aria-hidden": "true" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24" }, h("path", { d: "M12 2 A10 10 0 1 1 2 12", fill: "none", stroke: "currentColor", "stroke-width": "2.5", "stroke-linecap": "round" })))))), this.basketStatus === 'success' && (h("div", { class: `basket-status basket-status--success ${this.getButtonClass()}`, role: "status", "aria-live": "polite" }, h("span", { class: "check-icon", "aria-hidden": "true" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24" }, h("path", { d: "M5 12.5l4.5 4.5L19 7.5", fill: "none", stroke: "currentColor", "stroke-width": "2.5", "stroke-linecap": "round", "stroke-linejoin": "round" }))), h("span", null, h("strong", null, "Dodano"), " do koszyka"))))), h("div", { class: "boxes__box-content__info__value-product" }, this.currentColor && ((_a = this.currentColor.links) === null || _a === void 0 ? void 0 : _a.find((link) => (link === null || link === void 0 ? void 0 : link.shop) === this.shop)) && (h("a", { onClick: this.goToProduct, href: this.getHref(), class: `button ${this.getButtonClass()}` }, "wybierz kolor"))))), h("div", { class: "boxes__box-content__slider" }, this.renderSliderOrImage())));
57
+ var _a, _b, _c;
58
+ return (h("div", { onMouseEnter: () => this.colorCheck(), onMouseLeave: () => this.colorUnCheck(), class: `my-color-box ${this.isActive ? 'active' : ''} ${this.isCategoryActive ? 'categoryactive' : ''}`, style: {
59
+ backgroundSize: ((_a = this.isImageInsteadHex) === null || _a === void 0 ? void 0 : _a.isImageInsteadHex) ? 'cover' : '',
60
+ backgroundImage: ((_b = this.isImageInsteadHex) === null || _b === void 0 ? void 0 : _b.isImageInsteadHex) ? `url(${APIURL}/assets/${this.isImageInsteadHex.bigImage}?access_token=${accessToken})` : '',
61
+ background: ((_c = this.isImageInsteadHex) === null || _c === void 0 ? void 0 : _c.isImageInsteadHex) ? this.isImageInsteadHex.bigImage : this.color,
62
+ border: this.getBorder(),
63
+ boxShadow: this.getBoxShadow(),
64
+ } }, h("div", { class: "color-name" }, this.name)));
127
65
  }
128
- static get watchers() { return {
129
- "currentColor": ["onColorChange"]
130
- }; }
131
- }, [0, "my-colorinfo", {
132
- "currentColor": [16],
66
+ static get style() { return indexCss; }
67
+ }, [0, "my-colorbox", {
68
+ "color": [1],
69
+ "name": [1],
133
70
  "shop": [1],
134
71
  "product": [1],
135
- "baselink": [1],
136
- "availableTesters": [16],
137
- "price": [2],
138
- "data": [16],
139
- "isMobile": [4, "is-mobile"],
140
- "infoBoxWidth": [2, "info-box-width"],
141
- "closeImage": [1, "close-image"],
142
- "basketStatus": [32]
72
+ "isActive": [4, "is-active"],
73
+ "isCategoryActive": [4, "is-category-active"],
74
+ "isImageInsteadHex": [16]
143
75
  }]);
144
76
  function defineCustomElement() {
145
77
  if (typeof customElements === "undefined") {
146
78
  return;
147
79
  }
148
- const components = ["my-colorinfo", "my-slider"];
80
+ const components = ["my-colorbox"];
149
81
  components.forEach(tagName => { switch (tagName) {
150
- case "my-colorinfo":
151
- if (!customElements.get(tagName)) {
152
- customElements.define(tagName, MyColorInfo);
153
- }
154
- break;
155
- case "my-slider":
82
+ case "my-colorbox":
156
83
  if (!customElements.get(tagName)) {
157
- defineCustomElement$1();
84
+ customElements.define(tagName, MyColorBox);
158
85
  }
159
86
  break;
160
87
  } });
161
88
  }
162
89
 
163
- export { MyColorInfo as M, defineCustomElement as d };
90
+ export { MyColorBox as M, defineCustomElement as d };
164
91
 
165
92
  //# sourceMappingURL=index8.js.map
@@ -1 +1 @@
1
- {"file":"index8.js","mappings":";;;;;MAQa,WAAW;;;;;;;IAYd,mBAAc,GAAyC,IAAI,CAAC;IAC5D,mBAAc,GAAyC,IAAI,CAAC;IAiCpE,gBAAW,GAAG;;MACZ,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;MAC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,IAAI,CAAC,cAAc,EAAE,EAAE,oBAExF,CACL,CACG,CACF,CACF,EACN,WAAK,KAAK,EAAC,4BAA4B,IAAE,IAAI,CAAC,mBAAmB,EAAE,CAAO,CACtE,EACN;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/colorinfo/index.tsx"],"sourcesContent":["import { Component, Prop, State, Watch, h, getAssetPath, Event, EventEmitter } from '@stencil/core';\nimport { setDataLayer } from '../../gtmUtils';\nimport { AvailableTester, Color, Link, Product } from '../../types';\nimport { APIURL, accessToken } from '../api';\n\n@Component({\n tag: 'my-colorinfo',\n})\nexport class MyColorInfo {\n @Prop() currentColor: Color;\n @Prop() shop: string;\n @Prop() product: string;\n @Prop() baselink: string;\n @Prop() availableTesters: AvailableTester | null;\n @Prop() price: number | null;\n @Prop() data: Product | null = null;\n @Prop() isMobile: boolean = false;\n @Prop() infoBoxWidth: number | null;\n @Prop() closeImage = 'close.png';\n @State() basketStatus: 'idle' | 'loading' | 'success' = 'idle';\n private loadingTimeout: ReturnType<typeof setTimeout> | null = null;\n private successTimeout: ReturnType<typeof setTimeout> | null = null;\n @Event({ bubbles: true, composed: true }) onCurrentColor: EventEmitter<Color>;\n @Event({ bubbles: true, composed: true }) addToBasket: EventEmitter<{ id: number }>;\n\n @Event() closeInfoBox: EventEmitter;\n\n @Watch('currentColor')\n onColorChange(newColor: Color, oldColor: Color) {\n if (newColor?.name === oldColor?.name) return;\n this.resetBasketStatus();\n }\n\n disconnectedCallback() {\n this.clearBasketTimeouts();\n }\n\n private clearBasketTimeouts() {\n if (this.loadingTimeout) {\n clearTimeout(this.loadingTimeout);\n this.loadingTimeout = null;\n }\n\n if (this.successTimeout) {\n clearTimeout(this.successTimeout);\n this.successTimeout = null;\n }\n }\n\n private resetBasketStatus() {\n this.clearBasketTimeouts();\n this.basketStatus = 'idle';\n }\n\n goToProduct = () => {\n this.onCurrentColor.emit(this.currentColor);\n this.currentColor &&\n setDataLayer({\n event: 'GoToProduct',\n shop: this.shop,\n product: this.product,\n color: this.currentColor?.name,\n });\n\n this.closeInfoBox.emit();\n };\n\n onCloseButtonClick = () => {\n this.closeInfoBox.emit();\n };\n\n getHref = () => {\n if (this.baselink) {\n return `${this.baselink}/${this?.currentColor.links?.find((link: Link) => link?.shop === this.shop)?.path}`;\n }\n return this?.currentColor.links?.find((link: Link) => link?.shop === this.shop)?.path;\n };\n\n renderSliderOrImage = () => {\n if (this.currentColor.imageInsteadHex) {\n return <img class={'color-big-image'} src={`${APIURL}/assets/${this.currentColor.bigImage}?access_token=${accessToken}`} alt=\"color-image\" />;\n } else {\n return <my-slider color={this.currentColor.name} shop={this.shop} product={this.product} slides={this.data?.images}></my-slider>;\n }\n };\n\n capitalizeFirstLetter = (string: string) => {\n return string.charAt(0).toUpperCase() + string.slice(1).toLocaleLowerCase();\n };\n\n isVeryLightBackground = (): boolean => {\n if (this.currentColor.imageInsteadHex) return true;\n const hex = this.currentColor.hex?.replace('#', '') ?? '';\n if (hex.length !== 6 && hex.length !== 3) return false;\n const r = parseInt(hex.length === 3 ? hex[0] + hex[0] : hex.slice(0, 2), 16) / 255;\n const g = parseInt(hex.length === 3 ? hex[1] + hex[1] : hex.slice(2, 4), 16) / 255;\n const b = parseInt(hex.length === 3 ? hex[2] + hex[2] : hex.slice(4, 6), 16) / 255;\n const luminance = 0.299 * r + 0.587 * g + 0.114 * b;\n return luminance > 0.96;\n };\n\n getButtonClass = () => {\n if (this.currentColor.imageInsteadHex) return 'brown';\n return this.isVeryLightBackground() ? 'inverse' : '';\n };\n\n handleAddToBasket = () => {\n if (!this.availableTesters?.id_product_attribute) return;\n if (this.basketStatus !== 'idle') return;\n\n this.clearBasketTimeouts();\n this.basketStatus = 'loading';\n this.addToBasket.emit({\n id: this.availableTesters.id_product_attribute,\n });\n\n this.loadingTimeout = setTimeout(() => {\n this.basketStatus = 'success';\n this.successTimeout = setTimeout(() => {\n this.basketStatus = 'idle';\n }, 2500);\n }, 900);\n };\n\n render() {\n return (\n <div\n class={`boxes__box-content ${this.currentColor.textWhite ? 'boxes__box-content__white' : ''}`}\n style={{\n background: this.currentColor.imageInsteadHex ? 'white' : this.currentColor.hex,\n maxWidth: `${this.infoBoxWidth && this.infoBoxWidth - 4}px`,\n }}\n >\n {this.isMobile && <img class={'closebtn'} onClick={this.onCloseButtonClick} src={getAssetPath(`./assets/${this.closeImage}`)} alt=\"closebtn\" />}\n <div\n class=\"boxes__box-content__info\"\n style={{\n maxWidth: this.isMobile ? `${this.infoBoxWidth && this.infoBoxWidth - 35}px` : ``,\n }}\n >\n {!this.isMobile && <img class={'closebtn'} onClick={this.onCloseButtonClick} src={getAssetPath(`./assets/${this.closeImage}`)} alt=\"closebtn\" />}\n <h2>{this.currentColor.name}</h2>\n {!this.isMobile && <h4>{this.currentColor.number}</h4>}\n\n <div class=\"boxes__box-content__info__value\">\n <div class=\"divider\"></div>\n <div class=\"boxes__box-content__info__tester\">\n <div class=\"divider\"></div>\n <div class=\"tester-text\">\n <h2>Zamow tester</h2>\n <p>Sprawdz go na swojej scianie.</p>\n </div>\n <div class=\"tester-buy\">\n <div class=\"price\">{this.price ? `${this.price} zl` : ''}</div>\n {this.isMobile && <div class={'divider'}></div>}\n {this.basketStatus !== 'success' && (\n <button\n class={`button fit ${this.getButtonClass()} ${!this.availableTesters ? 'disabled' : ''} ${\n this.basketStatus === 'loading' ? 'is-loading' : ''\n }`}\n onClick={this.handleAddToBasket}\n disabled={!this.availableTesters || this.basketStatus === 'loading'}\n >\n <span class=\"button-content\">\n <span class=\"shape-icon\" aria-hidden=\"true\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"15\" height=\"16\" viewBox=\"0 0 15 16\">\n <path\n class=\"shape-icon__path\"\n transform=\"translate(0.0867462 0)\"\n d=\"M13.246571 12.763281L11.931726 4.961875C11.801879 4.1936703 11.13567 3.6319427 10.35657 3.63375L9.7429771 3.63375L9.7429771 3.1025C9.7429771 1.3890365 8.35394 0 6.6404767 0C4.9270134 0 3.537977 1.3890365 3.537977 3.1025L3.537977 3.63375L2.9217269 3.63375C2.1426277 3.6319427 1.4764187 4.1936703 1.3465706 4.961875L0.034383144 12.763281C-0.086738147 13.483807 0.11555123 14.221112 0.58740741 14.778946C1.0592636 15.336781 1.7528107 15.658594 2.4834456 15.658594L10.797508 15.658594C11.528143 15.658594 12.22169 15.336781 12.693546 14.778946C13.165402 14.221112 13.367692 13.483807 13.246571 12.763281L13.246571 12.763281ZM4.3348517 3.0892186C4.3348517 1.8158572 5.3671155 0.78359371 6.6404767 0.78359371C7.9138384 0.78359371 8.9461021 1.8158572 8.9461021 3.0892186L8.9461021 3.6204686L4.3348517 3.6204686L4.3348517 3.0892186ZM12.08579 14.264063C11.765244 14.643165 11.293964 14.86172 10.797508 14.86172L2.4834456 14.86172C1.9871488 14.862442 1.5158025 14.644215 1.195269 14.265309C0.87473541 13.886404 0.73765546 13.385406 0.82063317 12.896093L2.1248519 5.092031C2.1891608 4.703371 2.5278175 4.4200282 2.9217269 4.4252396L3.5353208 4.4252396L3.5353208 5.5834374C3.5353208 5.8034883 3.7137072 5.9818749 3.9337583 5.9818749C4.1538091 5.9818749 4.3321958 5.8034883 4.3321958 5.5834374L4.3321958 4.4252396L8.9461021 4.4252396L8.9461021 5.5834374C8.9461021 5.8034883 9.1244888 5.9818749 9.3445396 5.9818749C9.5645905 5.9818749 9.7429771 5.8034883 9.7429771 5.5834374L9.7429771 4.4252396L10.359227 4.4252396C10.753137 4.4200282 11.091793 4.703371 11.156102 5.092031L12.46032 12.896093C12.542204 13.384947 12.40527 13.885097 12.08579 14.264063L12.08579 14.264063Z\"\n />\n </svg>\n </span>\n {!this.availableTesters ? 'Tester obecnie niedostepny' : 'Dodaj do koszyka'}\n </span>\n {this.basketStatus === 'loading' && (\n <span class=\"spinner\" aria-hidden=\"true\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\">\n <path d=\"M12 2 A10 10 0 1 1 2 12\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" />\n </svg>\n </span>\n )}\n </button>\n )}\n {this.basketStatus === 'success' && (\n <div class={`basket-status basket-status--success ${this.getButtonClass()}`} role=\"status\" aria-live=\"polite\">\n <span class=\"check-icon\" aria-hidden=\"true\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\">\n <path d=\"M5 12.5l4.5 4.5L19 7.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />\n </svg>\n </span>\n <span>\n <strong>Dodano</strong> do koszyka\n </span>\n </div>\n )}\n </div>\n </div>\n <div class=\"boxes__box-content__info__value-product\">\n {this.currentColor && this.currentColor.links?.find((link: Link) => link?.shop === this.shop) && (\n <a onClick={this.goToProduct} href={this.getHref()} class={`button ${this.getButtonClass()}`}>\n wybierz kolor\n </a>\n )}\n </div>\n </div>\n </div>\n <div class=\"boxes__box-content__slider\">{this.renderSliderOrImage()}</div>\n </div>\n );\n }\n}\n"],"version":3}
1
+ {"file":"index8.js","mappings":";;;;;AAAA,MAAM,QAAQ,GAAG,+gCAA+gC;;MCUnhC,UAAU;;;;IAWrB,eAAU,GAAG;MACX,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC;QAC7B,YAAY,CAAC;UACX,KAAK,EAAE,YAAY;UACnB,IAAI,EAAE,IAAI,CAAC,IAAI;UACf,OAAO,EAAE,IAAI,CAAC,OAAO;UACrB,KAAK,EAAE,IAAI,CAAC,IAAI;SACjB,CAAC,CAAC;OACJ,EAAE,IAAI,CAAC,CAAC;KACV,CAAC;IAEF,iBAAY,GAAG;MACb,IAAI,IAAI,CAAC,YAAY;QAAE,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;MACvD,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;KAC/B,CAAC;IAEF,gBAAW,GAAG,CAAC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AG,EAAE,EAAE,EACvG,KAAK,EAAE;QACL,cAAc,EAAE,CAAA,MAAA,IAAI,CAAC,iBAAiB,0CAAE,iBAAiB,IAAG,OAAO,GAAG,EAAE;QACxE,eAAe,EAAE,CAAA,MAAA,IAAI,CAAC,iBAAiB,0CAAE,iBAAiB,IAAG,OAAO,MAAM,WAAW,IAAI,CAAC,iBAAiB,CAAC,QAAQ,iBAAiB,WAAW,GAAG,GAAG,EAAE;QACxJ,UAAU,EAAE,CAAA,MAAA,IAAI,CAAC,iBAAiB,0CAAE,iBAAiB,IAAG,IAAI,CAAC,iBAAiB,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK;QACpG,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE;QACxB,SAAS,EAAE,IAAI,CAAC,YAAY,EAAE;OAC/B,IAED,WAAK,KAAK,EAAC,YAAY,IAAE,IAAI,CAAC,IAAI,CAAO,CACrC,EACN;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/colorbox/index.scss?tag=my-colorbox","./src/components/colorbox/index.tsx"],"sourcesContent":["@import '../../global/app.scss';\n\n.my-color-box {\n width: 125px;\n height: 125px;\n display: block;\n margin-bottom: 5px;\n cursor: pointer;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n position: relative;\n\n @media (max-width: $medium) {\n width: 65px;\n height: 65px;\n }\n .color-name {\n width: 100%;\n background-color: $white;\n padding: 15px 0px 10px;\n border-top-left-radius: 15px;\n border-top-right-radius: 15px;\n opacity: 0;\n transition: 0.3s opacity ease-in-out;\n font-size: 10px;\n color: $black;\n text-transform: lowercase;\n }\n &.active {\n .color-name {\n opacity: 1;\n }\n }\n\n &.categoryactive {\n width: 120px;\n height: 115px;\n .color-name {\n opacity: 1;\n }\n\n @media (max-width: $medium) {\n width: 72px;\n height: 72px;\n }\n }\n &:hover {\n .color-name {\n opacity: 1;\n }\n }\n}\n","import { Component, Prop, h } from '@stencil/core';\nimport { setDataLayer } from '../../gtmUtils';\nimport { ColorBoxyIsImageInsteadHex } from '../../types';\nimport { isVeryLightColor } from '../../utils';\nimport { APIURL, accessToken } from '../api';\n\n@Component({\n tag: 'my-colorbox',\n styleUrl: 'index.scss',\n})\nexport class MyColorBox {\n private checkTimeout: ReturnType<typeof setTimeout> | undefined;\n\n @Prop() color: string;\n @Prop() name: string;\n @Prop() shop: string;\n @Prop() product: string;\n @Prop() isActive?: boolean;\n @Prop() isCategoryActive?: boolean;\n @Prop() isImageInsteadHex?: ColorBoxyIsImageInsteadHex;\n\n colorCheck = () => {\n this.checkTimeout = setTimeout(() => {\n setDataLayer({\n event: 'ColorCheck',\n shop: this.shop,\n product: this.product,\n color: this.name,\n });\n }, 2000);\n };\n\n colorUnCheck = () => {\n if (this.checkTimeout) clearTimeout(this.checkTimeout);\n this.checkTimeout = undefined;\n };\n\n darkenColor = (color: string) => {\n const red = parseInt(color[1] + color[2], 16) - 20;\n const green = parseInt(color[3] + color[4], 16) - 20;\n const blue = parseInt(color[5] + color[6], 16) - 20;\n return `rgb(${red},${green},${blue})`;\n };\n\n private isLightSwatch = () => !this.isImageInsteadHex?.isImageInsteadHex && isVeryLightColor(this.color);\n\n // Active category keeps its 5px solid border (all active swatches share it, so\n // alignment is consistent). In the normal grid we use an inset box-shadow\n // instead of a border so light swatches gain a visible edge without changing\n // their box size and skewing the grid.\n private getBorder = () => {\n if (!this.isCategoryActive) return '';\n return `5px solid ${this.isLightSwatch() ? '#d9d9d9' : this.darkenColor(this.color)}`;\n };\n\n private getBoxShadow = () => {\n if (this.isCategoryActive) return '';\n return this.isLightSwatch() ? 'inset 0 0 0 1px #d9d9d9' : '';\n };\n\n render() {\n return (\n <div\n onMouseEnter={() => this.colorCheck()}\n onMouseLeave={() => this.colorUnCheck()}\n class={`my-color-box ${this.isActive ? 'active' : ''} ${this.isCategoryActive ? 'categoryactive' : ''}`}\n style={{\n backgroundSize: this.isImageInsteadHex?.isImageInsteadHex ? 'cover' : '',\n backgroundImage: this.isImageInsteadHex?.isImageInsteadHex ? `url(${APIURL}/assets/${this.isImageInsteadHex.bigImage}?access_token=${accessToken})` : '',\n background: this.isImageInsteadHex?.isImageInsteadHex ? this.isImageInsteadHex.bigImage : this.color,\n border: this.getBorder(),\n boxShadow: this.getBoxShadow(),\n }}\n >\n <div class=\"color-name\">{this.name}</div>\n </div>\n );\n }\n}\n"],"version":3}