vviinn-widgets 2.76.0 → 2.76.2

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 (79) hide show
  1. package/dist/cjs/{index-85c223b1.js → index-21cf53a2.js} +1 -1
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/{package-46b840db.js → package-6ed71104.js} +1 -1
  4. package/dist/cjs/search-filters_18.cjs.entry.js +6 -6
  5. package/dist/cjs/{search.store-a688362f.js → search.store-ba1e2ead.js} +2 -1
  6. package/dist/cjs/vviinn-carousel_8.cjs.entry.js +74 -36
  7. package/dist/cjs/vviinn-preloader.cjs.entry.js +1 -1
  8. package/dist/cjs/vviinn-vpr-button.cjs.entry.js +1 -1
  9. package/dist/cjs/vviinn-vps-button.cjs.entry.js +1 -1
  10. package/dist/cjs/vviinn-vps-widget.cjs.entry.js +5 -5
  11. package/dist/cjs/vviinn-widgets.cjs.js +1 -1
  12. package/dist/collection/components/vviinn-filters/helpers/subFilterSelection.js +4 -1
  13. package/dist/collection/components/vviinn-filters/vviinn-extended-filters.js +18 -17
  14. package/dist/collection/components/vviinn-filters/vviinn-filters.css +179 -105
  15. package/dist/collection/components/vviinn-filters/vviinn-filters.js +34 -12
  16. package/dist/collection/components/vviinn-icons/icons/CheckFilterIcon.js +2 -0
  17. package/dist/collection/components/vviinn-icons/icons/CloseFilterIcon.js +2 -0
  18. package/dist/collection/components/vviinn-icons/icons/FiltersIcon.js +1 -1
  19. package/dist/collection/components/vviinn-icons/icons/SquareFilterIcon.js +2 -0
  20. package/dist/collection/components/vviinn-icons/icons/StarsIcon.js +2 -0
  21. package/dist/collection/components/vviinn-icons/index.js +4 -0
  22. package/dist/collection/components/vviinn-image-view/vviinn-detected-object/vviinn-detected-object.css +0 -23
  23. package/dist/collection/components/vviinn-price-range/vviinn-price-range.css +12 -33
  24. package/dist/collection/components/vviinn-product-card/vviinn-energy-label/vviinn-energy-label.css +0 -23
  25. package/dist/collection/components/vviinn-results/vviinn-results.css +0 -23
  26. package/dist/collection/components/vviinn-slider/vviinn-slider.css +0 -23
  27. package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.css +0 -23
  28. package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.js +2 -2
  29. package/dist/collection/store/search.store.js +2 -1
  30. package/dist/esm/{index-80d9da2f.js → index-9e9b32a2.js} +1 -1
  31. package/dist/esm/loader.js +1 -1
  32. package/dist/esm/{package-a9dace8c.js → package-eda9cc4a.js} +1 -1
  33. package/dist/esm/search-filters_18.entry.js +6 -6
  34. package/dist/esm/{search.store-9acff206.js → search.store-8fe25d80.js} +2 -1
  35. package/dist/esm/vviinn-carousel_8.entry.js +74 -36
  36. package/dist/esm/vviinn-preloader.entry.js +1 -1
  37. package/dist/esm/vviinn-vpr-button.entry.js +1 -1
  38. package/dist/esm/vviinn-vps-button.entry.js +1 -1
  39. package/dist/esm/vviinn-vps-widget.entry.js +5 -5
  40. package/dist/esm/vviinn-widgets.js +1 -1
  41. package/dist/types/components/vviinn-filters/helpers/index.d.ts +1 -0
  42. package/dist/types/components/vviinn-filters/vviinn-filters.d.ts +1 -0
  43. package/dist/types/components/vviinn-icons/icons/CheckFilterIcon.d.ts +1 -0
  44. package/dist/types/components/vviinn-icons/icons/CloseFilterIcon.d.ts +1 -0
  45. package/dist/types/components/vviinn-icons/icons/SquareFilterIcon.d.ts +1 -0
  46. package/dist/types/components/vviinn-icons/icons/StarsIcon.d.ts +1 -0
  47. package/dist/types/components/vviinn-icons/index.d.ts +4 -0
  48. package/dist/types/components/vviinn-vps-widget/vviinn-vps-widget.d.ts +1 -1
  49. package/{www/build/p-dee78ef6.js → dist/vviinn-widgets/p-03e84ad1.js} +1 -1
  50. package/dist/vviinn-widgets/{p-400dac78.entry.js → p-102be3be.entry.js} +1 -1
  51. package/dist/vviinn-widgets/p-188e1517.entry.js +1 -0
  52. package/dist/vviinn-widgets/p-626495b2.js +1 -0
  53. package/dist/vviinn-widgets/{p-17d6fab0.entry.js → p-7361c2b2.entry.js} +1 -1
  54. package/dist/vviinn-widgets/p-8cb71261.entry.js +1 -0
  55. package/dist/vviinn-widgets/{p-ddf609ee.js → p-9447314b.js} +1 -1
  56. package/dist/vviinn-widgets/{p-7bd909df.entry.js → p-a24ae98f.entry.js} +1 -1
  57. package/dist/vviinn-widgets/p-bfd6c12b.entry.js +11 -0
  58. package/dist/vviinn-widgets/vviinn-widgets.css +1 -1
  59. package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -1
  60. package/package.json +1 -1
  61. package/{dist/vviinn-widgets/p-dee78ef6.js → www/build/p-03e84ad1.js} +1 -1
  62. package/www/build/{p-400dac78.entry.js → p-102be3be.entry.js} +1 -1
  63. package/www/build/p-188e1517.entry.js +1 -0
  64. package/www/build/p-626495b2.js +1 -0
  65. package/www/build/{p-17d6fab0.entry.js → p-7361c2b2.entry.js} +1 -1
  66. package/www/build/p-8cb71261.entry.js +1 -0
  67. package/www/build/{p-ddf609ee.js → p-9447314b.js} +1 -1
  68. package/www/build/{p-7bd909df.entry.js → p-a24ae98f.entry.js} +1 -1
  69. package/www/build/p-bfd6c12b.entry.js +11 -0
  70. package/www/build/vviinn-widgets.css +1 -1
  71. package/www/build/vviinn-widgets.esm.js +1 -1
  72. package/dist/vviinn-widgets/p-a08bc9bb.js +0 -1
  73. package/dist/vviinn-widgets/p-c724c8bd.entry.js +0 -1
  74. package/dist/vviinn-widgets/p-f05a5179.entry.js +0 -11
  75. package/dist/vviinn-widgets/p-f45afcaa.entry.js +0 -1
  76. package/www/build/p-a08bc9bb.js +0 -1
  77. package/www/build/p-c724c8bd.entry.js +0 -1
  78. package/www/build/p-f05a5179.entry.js +0 -11
  79. package/www/build/p-f45afcaa.entry.js +0 -1
@@ -10,8 +10,11 @@ export const subFilterSelection = (filters, { column: selectedColumn }, filterVa
10
10
  pushObject.values.splice(valueIndex, 1);
11
11
  else
12
12
  pushObject.values.push(value);
13
- if (index === -1)
13
+ if (index === -1) {
14
14
  filters = [...filters, pushObject];
15
+ if (document.getElementById("filters-footer"))
16
+ document.getElementById("filters-footer").scrollLeft = 0;
17
+ }
15
18
  else {
16
19
  filters[index] = pushObject;
17
20
  if (filters[index].values.length === 0) {
@@ -1,5 +1,5 @@
1
1
  import { Host, h, } from "@stencil/core";
2
- import { FiltersIcon, NewCloseIcon } from "../vviinn-icons";
2
+ import { FiltersIcon, NewCloseIcon, SquareFilterIcon, CheckFilterIcon, } from "../vviinn-icons";
3
3
  import { getFilterOptions, subFilterSelection } from "./helpers";
4
4
  import i18next from "i18next";
5
5
  import { resources } from "../../locale";
@@ -66,12 +66,12 @@ export class VviinnExtendedFilters {
66
66
  this.emitRequestFiltersMore([...this.requestFilters]);
67
67
  }
68
68
  showActiveOnModalSubButton(requestFilters, filterValue) {
69
- let className = "";
69
+ let className = false;
70
70
  requestFilters.forEach((filter) => {
71
71
  if (filter.values.some((value) => value === filterValue ||
72
72
  value === filterValue.interval ||
73
73
  value === filterValue.value)) {
74
- className = "active";
74
+ className = true;
75
75
  }
76
76
  });
77
77
  return className;
@@ -109,30 +109,31 @@ export class VviinnExtendedFilters {
109
109
  this.showMore = false;
110
110
  }
111
111
  render() {
112
- let moreFiltersOptionCount = 0;
113
- this.filters.forEach((filter) => {
114
- moreFiltersOptionCount += getFilterOptions(filter).length;
115
- });
116
- return (h(Host, { part: "filters" }, SlotSkeleton("filters"), this.filters.length > 0 && (h("button", { class: "filters-more-button", onClick: () => (this.showMore = true) }, h(FiltersIcon, null))), h("div", { class: `filters-modal ${this.showMore ? "open" : ""}` }, h("div", { class: "filters-modal-wrapper" }, h("div", { class: "filters-modal-header" }, h("slot", { name: "vviinn-extended-filters-title" }, h("span", null, i18next.t("filters.modal.title"))), moreFiltersOptionCount > 0 ? `(${moreFiltersOptionCount})` : "", h("button", { class: "filters-modal-close", onClick: () => {
112
+ return (h(Host, { part: "filters" }, SlotSkeleton("filters"), this.filters.length > 0 && (h("button", { class: "filters-more-button", onClick: () => (this.showMore = true) }, h(FiltersIcon, null))), h("div", { class: `filters-modal ${this.showMore ? "open" : ""}` }, h("div", { class: "filters-modal-wrapper" }, h("div", { class: "filters-modal-header" }, h("slot", { name: "vviinn-extended-filters-title" }, h("span", null, i18next.t("filters.modal.title"))), h("button", { class: "filters-modal-close", onClick: () => {
117
113
  this.showMore = false;
118
114
  this.requestFilters = [];
119
- } }, h(NewCloseIcon, null))), h("ul", { class: "filters-modal-list" }, this.filters
120
- .filter((filter) => filter.column !== "color")
121
- .map((mainFilter) => {
122
- var _a, _b;
115
+ } }, h(NewCloseIcon, null))), h("ul", { class: "filters-modal-list" }, this.filters.map((mainFilter) => {
116
+ var _a, _b, _c;
123
117
  const column = mainFilter.column;
124
118
  const filterOptions = getFilterOptions(mainFilter);
125
- return (h("li", null, h("button", { onClick: () => this.handleMoreOptionsMainClick(mainFilter.column), class: "filters-modal-main-button" }, mainFilter.label, filterOptions.length > 0
126
- ? ` (${filterOptions.length})`
127
- : ""), column === "price" &&
128
- this.selectedMoreOptions.includes(mainFilter.column) ? (h("vviinn-price-range", { histogram: filterOptions, priceChangeHandler: this.priceChangeHandler, selectedInterval: ((_b = (_a = this.requestFilters.find((f) => f.column === "price")) === null || _a === void 0 ? void 0 : _a.values[0]) !== null && _b !== void 0 ? _b : {}) })) : (h("ul", { class: `filters-modal-sub-list ${column === "color_confirmed"
119
+ const requestFilter = this.requestFilters.find(({ column }) => column === column);
120
+ const addedOptions = [];
121
+ (_a = requestFilter === null || requestFilter === void 0 ? void 0 : requestFilter.values) === null || _a === void 0 ? void 0 : _a.forEach((value) => {
122
+ const index = filterOptions.findIndex((f) => f.value.value === value || f.value === value);
123
+ if (index > -1) {
124
+ addedOptions.push(h("span", null, filterOptions[index].label));
125
+ }
126
+ });
127
+ return (h("li", null, h("div", { class: "filters-modal-main-button-wrapper" }, h("button", { onClick: () => this.handleMoreOptionsMainClick(mainFilter.column), class: "filters-modal-main-button" }, mainFilter.label), addedOptions.length > 0 && (h("div", { class: "filters-modal-main-button-added-options" }, addedOptions))), column === "price" &&
128
+ this.selectedMoreOptions.includes(mainFilter.column) ? (h("vviinn-price-range", { histogram: filterOptions, priceChangeHandler: this.priceChangeHandler, selectedInterval: ((_c = (_b = this.requestFilters.find(({ column }) => column === "price")) === null || _b === void 0 ? void 0 : _b.values[0]) !== null && _c !== void 0 ? _c : {}) })) : (h("ul", { class: `filters-modal-sub-list ${column === "color_confirmed"
129
129
  ? "filters-modal-sub-list-inline"
130
130
  : ""} ${this.selectedMoreOptions.includes(mainFilter.column)
131
131
  ? "open"
132
132
  : ""}` }, filterOptions &&
133
133
  filterOptions.map(({ value, label, active }) => {
134
134
  const hexCode = value.hexCode;
135
- return (h("li", null, h("button", { onClick: () => this.handleSubFilterSelection(value, mainFilter), class: `filters-more-modal-button ${hexCode ? "filters-sub-button-color" : ""} ${this.showActiveOnModalSubButton(this.requestFilters, value)}`, style: { backgroundColor: hexCode }, disabled: !active }, h("span", null, label))));
135
+ const selected = this.showActiveOnModalSubButton(this.requestFilters, value);
136
+ return (h("li", null, h("button", { onClick: () => this.handleSubFilterSelection(value, mainFilter), class: `filters-more-modal-button ${hexCode ? "filters-sub-button-color" : ""} ${selected ? "active" : ""}`, style: { backgroundColor: hexCode }, disabled: !active }, h("span", null, h("span", null, label), selected ? (h(CheckFilterIcon, null)) : (h(SquareFilterIcon, null))))));
136
137
  })))));
137
138
  })), h("div", { class: "filters-modal-actions" }, h("button", { class: "filters-modal-apply", onClick: () => (this.showMore = false), disabled: this.requestFilters.length === 0 }, h("slot", { name: "vviinn-extended-filters-apply" }, i18next.t("filters.modal.apply"))), h("button", { class: "filters-modal-reset", onClick: () => this.resetModal() }, h("slot", { name: "vviinn-extended-filters-reset" }, i18next.t("filters.modal.resetFilters"))))))));
138
139
  }
@@ -5,32 +5,9 @@
5
5
  --color-icons-system: #2f8edf;
6
6
  --product-card-width-system: 130px;
7
7
  --spacer: 8px;
8
-
9
- /*FIXME-36773: Majid should remove these variable and use the new names*/
10
- --surface-color-surface-01: #f4f4f4;
11
- --text-color-text-primary: #161616;
12
- --font-family: Inter, system-ui, sans-serif;
13
- --font-size-body: 14px;
14
8
  --font-weight-regular: 400;
15
- --line-height-body: 20px;
16
9
  --letter-spacing-default: 0px;
17
- --background-color-background: #fff;
18
- --border-color-border-01: #f4f4f4;
19
- --gray-100: #161616;
20
- --gray-10: #f4f4f4;
21
- --gray-70: #525252;
22
10
  --radius-radius-md: 8px;
23
- --button-color-button-primary: #000;
24
- --text-color-text-inverse: #fff;
25
- --text-color-text-secondary: #525252;
26
- --button-color-button-disabled: #e0e0e0;
27
- --text-color-text-disabled: rgba(22, 22, 22, 0.25);
28
- --surface-color-surface-accent: #e0e0e0;
29
- --border-color-border-02: #c6c6c6;
30
- --surface-color-surface-active: #161616;
31
- --surface-color-surface-inactive: #e0e0e0;
32
- --stroke-color-stroke-01: #f4f4f4;
33
- --chip-color-badge-primary: #161616;
34
11
 
35
12
  /* New Styles */
36
13
  --font-family-base: Inter, system-ui, sans-serif;
@@ -235,6 +212,9 @@
235
212
 
236
213
  :host {
237
214
  display: block;
215
+
216
+ font-family: var(--font-family-base);
217
+ font-style: normal;
238
218
  }
239
219
 
240
220
  .filters-footer {
@@ -244,7 +224,8 @@
244
224
  .filters-modal-list,
245
225
  .sub-filters-wrapper,
246
226
  .main-filters-list,
247
- .filters-modal-sub-list {
227
+ .filters-modal-sub-list,
228
+ .selected-filters-wrapper {
248
229
  list-style: none;
249
230
  margin: 0;
250
231
  padding: 0;
@@ -255,89 +236,104 @@
255
236
  }
256
237
 
257
238
  .main-filters-list {
258
- padding: 2px;
259
- gap: 10px;
239
+ padding: var(--spacing-25);
240
+ gap: var(--spacing-25);
260
241
  border-radius: 8px;
261
- background: var(--surface-color-surface-01);
242
+ background: var(--surface-bg-color-01);
262
243
  display: inline-flex;
263
244
  }
264
245
 
265
246
  .filters-modal-main-button,
266
247
  .filters-sub-button,
267
248
  .filters-main-button,
268
- .filters-modal-close {
249
+ .filters-modal-close,
250
+ .filters-sub-button-selected {
269
251
  cursor: pointer;
270
252
  border: none;
271
253
  }
272
254
 
273
255
  .filters-sub-button,
274
256
  .filters-main-button {
275
- font-family: var(--font-family);
276
257
  font-size: var(--font-size-body);
277
- font-style: normal;
278
- font-weight: var(--font-weight-regular);
258
+
259
+ font-weight: var(--font-weight-400);
279
260
  line-height: var(--line-height-body);
280
- letter-spacing: var(--letter-spacing-default);
261
+ letter-spacing: var(--letter-spacing-body);
281
262
 
282
263
  display: flex;
283
264
  justify-content: center;
284
265
  align-items: center;
285
- gap: 10px;
286
266
 
287
267
  border-radius: 6px;
288
268
  }
289
269
 
290
270
  .filters-main-button {
291
- color: var(--text-color-text-primary);
292
-
293
- padding: 10px 16px;
294
- flex: 1 0 0;
295
-
296
- background: var(--surface-color-surface-01);
297
- }
298
- .filters-main-button:hover {
299
- color: var(--text-color-text-secondary);
271
+ padding: var(--spacing-100) 18px;
272
+ color: var(--color-text-helper);
273
+ background: none;
300
274
  }
301
275
 
302
- .filters-main-button.active {
303
- background: var(--background-color-background);
276
+ .filters-main-button.active,
277
+ .filters-main-button:hover {
278
+ background: var(--surface-bg-color-02);
279
+ color: var(--color-text-primary);
304
280
  }
305
281
 
306
282
  .filters-footer {
307
- margin: 16px 0;
283
+ padding: 16px 0;
308
284
  }
285
+
309
286
  .sub-filters-wrapper {
310
- gap: 12px;
287
+ gap: var(--spacing-100);
288
+ display: flex;
289
+ }
290
+ .selected-filters-wrapper {
291
+ margin-top: 16px;
292
+ padding-top: 16px;
293
+ border-top: 1px solid var(--surface-bg-color-01);
294
+ gap: var(--spacing-100);
311
295
  display: flex;
312
296
  }
297
+
313
298
  .filters-sub-button {
314
- color: #000;
299
+ color: var(--color-text-primary);
300
+ background: var(--surface-bg-color-01);
301
+ padding: var(--spacing-100);
302
+ gap: var(--spacing-25);
303
+ }
315
304
 
316
- padding: 10px;
305
+ .filters-sub-button > span,
306
+ .filters-sub-button-selected > span {
307
+ display: inline-flex;
308
+ justify-content: center;
309
+ align-items: center;
310
+ gap: var(--spacing-25);
311
+ white-space: nowrap;
312
+ }
317
313
 
318
- border: 1px solid var(--border-color-border-01);
319
- background: var(--background-color-background);
314
+ .filters-sub-button-selected > span > span {
315
+ padding: 2px;
320
316
  }
317
+
321
318
  .filters-sub-button:hover {
322
- color: var(--text-color-text-secondary);
319
+ background: var(--surface-bg-color-01);
320
+ box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
323
321
  }
324
322
 
325
- .filters-sub-button.active {
326
- border-color: #000;
327
- }
328
323
  .filters-sub-button:disabled {
329
324
  cursor: not-allowed;
330
- background: var(--button-color-button-disabled);
331
- color: var(--text-color-text-disabled, rgba(22, 22, 22, 0.25));
325
+ background: var(--surface-bg-color-disabled);
326
+ color: var(--color-text-disabled);
332
327
  }
328
+
333
329
  .filters-more-button {
334
330
  display: flex;
335
- padding: 10px;
336
- align-items: flex-start;
337
- gap: 10px;
331
+ padding: var(--spacing-100);
332
+ gap: var(--spacing-50);
333
+ border-radius: var(--border-radius-100);
338
334
 
339
- border-radius: 8px;
340
- background: var(--surface-color-surface-01);
335
+ align-items: flex-start;
336
+ background: var(--button-bg-color-secondary);
341
337
  border: none;
342
338
  cursor: pointer;
343
339
  }
@@ -384,15 +380,15 @@
384
380
  position: relative;
385
381
  padding: 20px 0;
386
382
 
387
- color: var(--gray-100);
383
+ color: var(--color-text-primary);
388
384
  text-align: center;
389
- font-family: var(--font-family);
390
- font-size: 16px;
391
- font-style: normal;
392
- font-weight: 500;
393
- line-height: 24px;
394
385
 
395
- border-bottom: 1px solid var(--gray-10);
386
+ font-size: var(--font-size-headline);
387
+ font-weight: var(--font-weight-500);
388
+ line-height: var(--line-height-headline);
389
+ letter-spacing: var(--letter-spacing-headline);
390
+
391
+ border-bottom: 1px solid var(--color-border-01);
396
392
 
397
393
  display: flex;
398
394
  justify-content: center;
@@ -408,29 +404,36 @@
408
404
  .filters-modal-list > li {
409
405
  padding-right: 24px;
410
406
  }
407
+ .filters-modal-main-button-wrapper {
408
+ border-bottom: 1px solid var(--color-border-01);
409
+ padding: 20px 0;
410
+ }
411
411
  .filters-modal-main-button {
412
- border-bottom: 1px solid var(--gray-10);
413
412
  width: 100%;
414
413
  background: none;
415
414
  text-align: left;
416
- padding: 20px 0;
415
+ padding: 0;
417
416
 
418
- color: var(--gray-70);
419
- font-family: var(--font-family);
420
- font-size: 18px;
421
- font-style: normal;
422
- font-weight: 500;
423
- line-height: 24px;
417
+ color: var(--color-text-primary);
418
+
419
+ font-size: var(--font-size-label-large);
420
+ font-weight: var(--font-weight-500);
421
+ line-height: var(--line-height-label-large);
422
+ letter-spacing: var(--letter-spacing-label-large);
424
423
  }
425
424
 
426
425
  .filters-modal-sub-list {
427
426
  display: none;
427
+ margin: 0 -4px;
428
+ }
429
+ .filters-modal-sub-list > li {
430
+ display: inline-block;
431
+ margin: 0 4px;
428
432
  }
429
433
  .filters-modal-sub-list-inline {
430
434
  margin: 0 -6px;
431
435
  }
432
436
  .filters-modal-sub-list-inline > li {
433
- display: inline-block;
434
437
  margin: 0 6px;
435
438
  }
436
439
 
@@ -452,53 +455,72 @@
452
455
 
453
456
  .filters-more-modal-button {
454
457
  background: none;
455
- display: block;
456
458
  border: none;
457
459
  cursor: pointer;
458
- }
459
460
 
461
+ display: flex;
462
+ padding: var(--spacing-100);
463
+ align-items: center;
464
+ gap: var(--spacing-25);
465
+
466
+ border-radius: var(--border-radius-100);
467
+ background: var(--surface-bg-color-01);
468
+
469
+ color: var(--color-text-primary);
470
+ }
460
471
  .filters-more-modal-button.active {
461
- color: var(--color-primary-system);
472
+ background: var(--surface-bg-color-inverse);
473
+ color: var(--color-text-inverse);
474
+ }
475
+ .filters-more-modal-button > span {
476
+ display: flex;
477
+ align-items: center;
478
+ justify-content: center;
479
+ gap: var(--spacing-25);
480
+ }
481
+ .filters-more-modal-button > span > span {
482
+ padding: 2px;
462
483
  }
463
484
  .filters-more-modal-button:disabled {
464
485
  cursor: not-allowed;
465
- color: var(--text-color-text-disabled, rgba(22, 22, 22, 0.25));
486
+ opacity: 0.5;
466
487
  }
467
488
 
468
489
  .filters-modal-actions {
469
- border-top: 1px solid var(--gray-10);
470
- padding: 24px;
490
+ border-top: 1px solid var(--color-border-01);
491
+ padding: var(--spacing-250);
471
492
  z-index: 10;
472
493
  background: #ffffff;
473
494
  border-radius: 0px 0px 0px 32px;
474
495
  }
475
496
 
476
497
  .filters-modal-apply {
477
- color: var(--text-color-text-inverse);
478
- text-align: center;
479
- font-family: var(--font-family);
480
- font-size: 16px;
481
- font-style: normal;
482
- font-weight: 500;
483
- line-height: 24px;
498
+ cursor: pointer;
499
+ width: 100%;
500
+ border: none;
484
501
 
485
502
  display: flex;
486
- width: 100%;
487
- padding: 12px;
503
+ padding: var(--spacing-150);
488
504
  justify-content: center;
489
505
  align-items: center;
490
- gap: 10px;
506
+ gap: var(--spacing-50);
507
+ align-self: stretch;
491
508
 
492
- border-radius: var(--radius-radius-md);
493
- background: var(--button-color-button-primary);
509
+ color: var(--color-text-inverse);
510
+ text-align: center;
494
511
 
495
- cursor: pointer;
496
- border: none;
512
+ border-radius: var(--border-radius-150);
513
+ background: var(--button-bg-color-primary);
514
+
515
+ font-size: var(--font-size-label-large);
516
+ font-weight: var(--font-weight-500);
517
+ line-height: var(--line-height-label-large);
518
+ letter-spacing: var(--letter-spacing-label-large);
497
519
  }
498
520
 
499
521
  .filters-modal-apply:disabled {
500
- background: var(--button-color-button-disabled);
501
- color: var(--text-color-text-disabled);
522
+ background: var(--button-bg-color-disabled);
523
+ color: var(--color-text-disabled);
502
524
  }
503
525
 
504
526
  .filters-modal-reset {
@@ -510,21 +532,55 @@
510
532
  width: 100%;
511
533
  margin-top: 20px;
512
534
 
513
- color: var(--text-color-text-secondary);
535
+ color: var(--color-text-secondary);
514
536
  text-align: center;
515
- font-family: var(--font-family);
537
+
538
+ font-size: var(--font-size-label);
539
+ font-weight: var(--font-weight-500);
540
+ line-height: var(--line-height-label);
541
+ letter-spacing: var(--letter-spacing-label);
542
+ }
543
+
544
+ .selected-filters-wrapper > li {
545
+ border-radius: var(--border-radius-100);
546
+ background: var(--surface-bg-color-inverse);
547
+ display: flex;
548
+ align-items: center;
549
+ justify-content: center;
550
+ padding: var(--spacing-100);
551
+ cursor: pointer;
552
+ }
553
+ .filters-sub-button-selected {
554
+ display: flex;
555
+ align-items: center;
556
+ gap: var(--spacing-25);
557
+ background: var(--surface-bg-color-inverse);
558
+ border-radius: var(--border-radius-100);
559
+
560
+ color: var(--color-text-inverse);
561
+ text-overflow: ellipsis;
562
+
516
563
  font-size: var(--font-size-body);
517
- font-style: normal;
518
- font-weight: var(--font-weight-regular);
564
+ font-weight: var(--font-weight-400);
519
565
  line-height: var(--line-height-body);
520
- letter-spacing: var(--letter-spacing-default);
566
+ letter-spacing: var(--letter-spacing-body);
521
567
  }
568
+
522
569
  .filters-sub-button-color {
523
570
  width: 40px;
524
571
  height: 40px;
525
- border: 2px solid var(--border-color-border-01);
572
+ border: 2px solid var(--color-border-01);
526
573
  border-radius: 20px;
527
574
  }
575
+ .filters-sub-button-color:disabled {
576
+ opacity: 0.25;
577
+ }
578
+ .filters-sub-button-selected.filters-sub-button-color {
579
+ width: 24px;
580
+ height: 24px;
581
+ border: none;
582
+ }
583
+
528
584
  .filters-sub-button-color > span {
529
585
  display: none;
530
586
  }
@@ -536,3 +592,21 @@
536
592
  .filters-sub-button-color:first-child.active {
537
593
  margin-left: 2px;
538
594
  }
595
+
596
+ .filters-modal-main-button-added-options {
597
+ color: var(--color-text-secondary);
598
+ text-overflow: ellipsis;
599
+
600
+ font-size: var(--font-size-body);
601
+ font-weight: var(--font-weight-400);
602
+ line-height: var(--line-height-body);
603
+ letter-spacing: var(--letter-spacing-body);
604
+ }
605
+
606
+ .filters-modal-main-button-added-options > span::after {
607
+ content: ", ";
608
+ }
609
+
610
+ .filters-modal-main-button-added-options > span:last-child::after {
611
+ content: "";
612
+ }
@@ -1,5 +1,6 @@
1
1
  import { Host, h, } from "@stencil/core";
2
- import { getFilterOptions, subFilterSelection } from "./helpers";
2
+ import { getFilterOptions, subFilterSelection, } from "./helpers";
3
+ import { StarsIcon, CheckFilterIcon, CloseFilterIcon } from "../vviinn-icons";
3
4
  /**
4
5
  * @part filters - Wrapper itself.
5
6
  */
@@ -15,6 +16,9 @@ export class VviinnFilters {
15
16
  };
16
17
  this.handleSetFilters = ({ detail, }) => {
17
18
  this.filters = detail;
19
+ if (this.selectedFilter) {
20
+ this.selectedFilter = this.filters.find((f) => f.column === this.selectedFilter.column);
21
+ }
18
22
  if (!detail.some(({ column }) => { var _a; return column === ((_a = this.selectedFilter) === null || _a === void 0 ? void 0 : _a.column); })) {
19
23
  this.selectedFilter = undefined;
20
24
  }
@@ -40,6 +44,7 @@ export class VviinnFilters {
40
44
  this.vviinnFiltersChanged.emit({ filters: requestFilters, el: this.el });
41
45
  }
42
46
  handleSubFilterSelection(filterValue, seletedFilter) {
47
+ this.filtersFooter.scrollLeft = 0;
43
48
  this.requestFilters = subFilterSelection(this.requestFilters, seletedFilter, filterValue);
44
49
  this.emitRequestFiltersMore([...this.requestFilters]);
45
50
  }
@@ -48,17 +53,17 @@ export class VviinnFilters {
48
53
  return "";
49
54
  return this.selectedFilter.column === column ? "active" : "";
50
55
  }
51
- showActiveOnSubButton(requestFilters, filterValue) {
52
- if (!this.selectedFilter || !requestFilters)
53
- return "";
54
- const mainFilter = requestFilters.find((filter) => filter.column === this.selectedFilter.column);
56
+ showActiveOnSubButton(requestFilters, filterValue, selectedFilter) {
57
+ if (!selectedFilter || !requestFilters)
58
+ return false;
59
+ const mainFilter = requestFilters.find(({ column }) => column === selectedFilter.column);
55
60
  if (!mainFilter)
56
61
  return "";
57
62
  return mainFilter.values.some((value) => value === filterValue ||
58
63
  value === filterValue.interval ||
59
64
  value === filterValue.value)
60
- ? "active"
61
- : "";
65
+ ? true
66
+ : false;
62
67
  }
63
68
  filtersStringWatcher() {
64
69
  if (this.filtersString === "")
@@ -83,16 +88,33 @@ export class VviinnFilters {
83
88
  var _a, _b, _c;
84
89
  const { column } = (_a = this.selectedFilter) !== null && _a !== void 0 ? _a : {};
85
90
  const selectedFilterOptions = getFilterOptions(this.selectedFilter);
86
- const filters = this.filters.filter((filter) => filter.isPrimary && filter.column !== "color");
91
+ const filters = this.filters.filter((filter) => filter.isPrimary);
87
92
  if (filters.length === 0)
88
93
  return h(Host, null);
94
+ const RenderButton = (value, label, active, selectedFilter, isSelected = false) => {
95
+ const hexCode = value.hexCode;
96
+ return (h("li", { onClick: () => active ? this.handleSubFilterSelection(value, selectedFilter) : null }, h("button", { class: `filters-sub-button${isSelected ? "-selected" : ""} ${hexCode ? "filters-sub-button-color" : ""}`, style: { backgroundColor: hexCode }, disabled: !active }, h("span", null, !isSelected ? label : h("span", null, label), " ", !isSelected ? h(StarsIcon, null) : h(CheckFilterIcon, null))), isSelected && hexCode && h(CloseFilterIcon, null)));
97
+ };
98
+ let selectedButtons = [];
99
+ this.filters.forEach((filter) => {
100
+ if (!("values" in filter))
101
+ return;
102
+ filter.values.forEach(({ value, label, active }) => {
103
+ if (this.showActiveOnSubButton(this.requestFilters, value, filter) &&
104
+ active) {
105
+ selectedButtons.push(RenderButton(value, label, active, filter, true));
106
+ }
107
+ });
108
+ });
89
109
  return (h(Host, { part: "filters" }, h("div", { class: "main-filters-wrapper" }, h("ul", { class: "main-filters-list" }, filters.map((filter) => {
90
110
  return (h("li", null, h("button", { class: `filters-main-button ${this.showActiveOnMainButton(filter)}`, onClick: () => this.handleMainFilterSelection(filter) }, filter.label)));
91
- }))), this.selectedFilter !== undefined && (h("div", { class: "filters-footer" }, column === "price" ? (h("vviinn-price-range", { histogram: selectedFilterOptions, priceChangeHandler: this.priceChangeHandler, selectedInterval: ((_c = (_b = this.requestFilters.find((f) => f.column === "price")) === null || _b === void 0 ? void 0 : _b.values[0]) !== null && _c !== void 0 ? _c : {}) })) : (h("ul", { class: "sub-filters-wrapper" }, selectedFilterOptions &&
111
+ }))), this.selectedFilter !== undefined && (h("div", { class: "filters-footer", ref: (el) => (this.filtersFooter = el) }, column === "price" ? (h("vviinn-price-range", { histogram: selectedFilterOptions, priceChangeHandler: this.priceChangeHandler, selectedInterval: ((_c = (_b = this.requestFilters.find(({ column }) => column === "price")) === null || _b === void 0 ? void 0 : _b.values[0]) !== null && _c !== void 0 ? _c : {}) })) : (h("ul", { class: "sub-filters-wrapper" }, selectedFilterOptions &&
92
112
  selectedFilterOptions.map(({ value, label, active }) => {
93
- const hexCode = value.hexCode;
94
- return (h("li", null, h("button", { onClick: () => this.handleSubFilterSelection(value, this.selectedFilter), class: `filters-sub-button ${hexCode ? "filters-sub-button-color" : ""} ${this.showActiveOnSubButton(this.requestFilters, value)}`, style: { backgroundColor: hexCode }, disabled: !active }, h("span", null, label))));
95
- })))))));
113
+ if (this.showActiveOnSubButton(this.requestFilters, value, this.selectedFilter)) {
114
+ return null;
115
+ }
116
+ return RenderButton(value, label, active, this.selectedFilter);
117
+ }))), selectedButtons.length > 0 && (h("ul", { class: "selected-filters-wrapper" }, selectedButtons))))));
96
118
  }
97
119
  static get is() { return "vviinn-filters"; }
98
120
  static get encapsulation() { return "shadow"; }
@@ -0,0 +1,2 @@
1
+ import { h } from "@stencil/core";
2
+ export const CheckFilterIcon = () => (h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none" }, h("rect", { x: "2", y: "2", width: "20", height: "20", rx: "4", fill: "white" }), h("path", { d: "M10.8765 13.5061L16.1943 8.30769C16.4041 8.10256 16.6526 8 16.9398 8C17.2269 8 17.4754 8.10256 17.6852 8.30769C17.8951 8.51282 18 8.75574 18 9.03644C18 9.31714 17.8951 9.56005 17.6852 9.76518L11.622 15.6923C11.4121 15.8974 11.1637 16 10.8765 16C10.5894 16 10.3409 15.8974 10.131 15.6923L7.31476 12.9393C7.10492 12.7341 7 12.4912 7 12.2105C7 11.9298 7.10492 11.6869 7.31476 11.4818C7.5246 11.2767 7.77309 11.1741 8.06024 11.1741C8.34739 11.1741 8.59588 11.2767 8.80572 11.4818L10.8765 13.5061Z", fill: "#161616" })));
@@ -0,0 +1,2 @@
1
+ import { h } from "@stencil/core";
2
+ export const CloseFilterIcon = () => (h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none" }, h("path", { d: "M12 13.4L7.09999 18.3C6.91665 18.4834 6.68332 18.575 6.39999 18.575C6.11665 18.575 5.88332 18.4834 5.69999 18.3C5.51665 18.1167 5.42499 17.8834 5.42499 17.6C5.42499 17.3167 5.51665 17.0834 5.69999 16.9L10.6 12L5.69999 7.10005C5.51665 6.91672 5.42499 6.68338 5.42499 6.40005C5.42499 6.11672 5.51665 5.88338 5.69999 5.70005C5.88332 5.51672 6.11665 5.42505 6.39999 5.42505C6.68332 5.42505 6.91665 5.51672 7.09999 5.70005L12 10.6L16.9 5.70005C17.0833 5.51672 17.3167 5.42505 17.6 5.42505C17.8833 5.42505 18.1167 5.51672 18.3 5.70005C18.4833 5.88338 18.575 6.11672 18.575 6.40005C18.575 6.68338 18.4833 6.91672 18.3 7.10005L13.4 12L18.3 16.9C18.4833 17.0834 18.575 17.3167 18.575 17.6C18.575 17.8834 18.4833 18.1167 18.3 18.3C18.1167 18.4834 17.8833 18.575 17.6 18.575C17.3167 18.575 17.0833 18.4834 16.9 18.3L12 13.4Z", fill: "#8D8D8D" })));
@@ -1,2 +1,2 @@
1
1
  import { h } from "@stencil/core";
2
- export const FiltersIcon = () => (h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none" }, h("path", { d: "M3.66522 19.275C3.40867 19.275 3.19362 19.1862 3.02007 19.0086C2.84653 18.8311 2.75977 18.6142 2.75977 18.358C2.75977 18.1017 2.84653 17.8863 3.02007 17.7118C3.19362 17.5372 3.40867 17.45 3.66522 17.45H8.34022C8.59322 17.45 8.80972 17.5378 8.98974 17.7135C9.16976 17.8892 9.25977 18.107 9.25977 18.3667C9.25977 18.6229 9.16976 18.8384 8.98974 19.013C8.80972 19.1877 8.59322 19.275 8.34022 19.275H3.66522ZM3.66522 6.54995C3.40867 6.54995 3.19362 6.46209 3.02007 6.28638C2.84653 6.11066 2.75977 5.89293 2.75977 5.63318C2.75977 5.37696 2.84653 5.16154 3.02007 4.9869C3.19362 4.81225 3.40867 4.72493 3.66522 4.72493H12.4902C12.7432 4.72493 12.9597 4.81371 13.1397 4.99128C13.3198 5.16884 13.4098 5.38573 13.4098 5.64195C13.4098 5.89817 13.3198 6.11356 13.1397 6.28813C12.9597 6.46268 12.7432 6.54995 12.4902 6.54995H3.66522ZM11.5084 21.325C11.2549 21.325 11.0386 21.2366 10.8592 21.0599C10.6799 20.8832 10.5902 20.665 10.5902 20.4054V16.2804C10.5902 16.0239 10.6804 15.8088 10.8606 15.6353C11.0409 15.4617 11.2578 15.375 11.5112 15.375C11.7646 15.375 11.9786 15.4617 12.1533 15.6353C12.3279 15.8088 12.4152 16.0239 12.4152 16.2804V17.45H20.3348C20.5913 17.45 20.8064 17.5378 20.9799 17.7135C21.1535 17.8892 21.2402 18.107 21.2402 18.3667C21.2402 18.6229 21.1535 18.8384 20.9799 19.013C20.8064 19.1877 20.5913 19.275 20.3348 19.275H12.4152V20.4054C12.4152 20.665 12.3283 20.8832 12.1545 21.0599C11.9807 21.2366 11.7653 21.325 11.5084 21.325ZM8.33879 14.9554C8.08539 14.9554 7.87137 14.8686 7.69672 14.6951C7.52208 14.5215 7.43477 14.3065 7.43477 14.05V12.9054H3.66522C3.40867 12.9054 3.19362 12.8185 3.02007 12.6447C2.84653 12.4709 2.75977 12.2555 2.75977 11.9986C2.75977 11.7416 2.84653 11.5267 3.02007 11.3538C3.19362 11.1809 3.40867 11.0945 3.66522 11.0945H7.43477V9.89995C7.43477 9.6434 7.52167 9.42836 7.69549 9.25483C7.86929 9.08128 8.08467 8.9945 8.34162 8.9945C8.59503 8.9945 8.81141 9.08128 8.99074 9.25483C9.17009 9.42836 9.25977 9.6434 9.25977 9.89995V14.05C9.25977 14.3065 9.16962 14.5215 8.98934 14.6951C8.80906 14.8686 8.59221 14.9554 8.33879 14.9554ZM11.5098 12.9054C11.2568 12.9054 11.0403 12.8185 10.8602 12.6447C10.6802 12.4709 10.5902 12.2555 10.5902 11.9986C10.5902 11.7416 10.6802 11.5267 10.8602 11.3538C11.0403 11.1809 11.2568 11.0945 11.5098 11.0945H20.3348C20.5913 11.0945 20.8064 11.1814 20.9799 11.3552C21.1535 11.529 21.2402 11.7444 21.2402 12.0014C21.2402 12.2583 21.1535 12.4732 20.9799 12.6461C20.8064 12.819 20.5913 12.9054 20.3348 12.9054H11.5098ZM15.6584 8.62495C15.405 8.62495 15.1886 8.53818 15.0092 8.36463C14.8299 8.19109 14.7402 7.97605 14.7402 7.7195V3.5945C14.7402 3.3349 14.8304 3.11674 15.0106 2.94003C15.1909 2.76329 15.4078 2.67493 15.6612 2.67493C15.9146 2.67493 16.1286 2.76329 16.3033 2.94003C16.4779 3.11674 16.5652 3.3349 16.5652 3.5945V4.72493H20.3348C20.5913 4.72493 20.8064 4.81371 20.9799 4.99128C21.1535 5.16884 21.2402 5.38573 21.2402 5.64195C21.2402 5.89817 21.1535 6.11356 20.9799 6.28813C20.8064 6.46268 20.5913 6.54995 20.3348 6.54995H16.5652V7.7195C16.5652 7.97605 16.4783 8.19109 16.3045 8.36463C16.1307 8.53818 15.9153 8.62495 15.6584 8.62495Z", fill: "#525252" })));
2
+ export const FiltersIcon = () => (h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none" }, h("path", { d: "M12 21C11.7167 21 11.4792 20.9042 11.2875 20.7125C11.0958 20.5208 11 20.2833 11 20V16C11 15.7167 11.0958 15.4792 11.2875 15.2875C11.4792 15.0958 11.7167 15 12 15C12.2833 15 12.5208 15.0958 12.7125 15.2875C12.9042 15.4792 13 15.7167 13 16V17H20C20.2833 17 20.5208 17.0958 20.7125 17.2875C20.9042 17.4792 21 17.7167 21 18C21 18.2833 20.9042 18.5208 20.7125 18.7125C20.5208 18.9042 20.2833 19 20 19H13V20C13 20.2833 12.9042 20.5208 12.7125 20.7125C12.5208 20.9042 12.2833 21 12 21ZM4 19C3.71667 19 3.47917 18.9042 3.2875 18.7125C3.09583 18.5208 3 18.2833 3 18C3 17.7167 3.09583 17.4792 3.2875 17.2875C3.47917 17.0958 3.71667 17 4 17H8C8.28333 17 8.52083 17.0958 8.7125 17.2875C8.90417 17.4792 9 17.7167 9 18C9 18.2833 8.90417 18.5208 8.7125 18.7125C8.52083 18.9042 8.28333 19 8 19H4ZM8 15C7.71667 15 7.47917 14.9042 7.2875 14.7125C7.09583 14.5208 7 14.2833 7 14V13H4C3.71667 13 3.47917 12.9042 3.2875 12.7125C3.09583 12.5208 3 12.2833 3 12C3 11.7167 3.09583 11.4792 3.2875 11.2875C3.47917 11.0958 3.71667 11 4 11H7V10C7 9.71667 7.09583 9.47917 7.2875 9.2875C7.47917 9.09583 7.71667 9 8 9C8.28333 9 8.52083 9.09583 8.7125 9.2875C8.90417 9.47917 9 9.71667 9 10V14C9 14.2833 8.90417 14.5208 8.7125 14.7125C8.52083 14.9042 8.28333 15 8 15ZM12 13C11.7167 13 11.4792 12.9042 11.2875 12.7125C11.0958 12.5208 11 12.2833 11 12C11 11.7167 11.0958 11.4792 11.2875 11.2875C11.4792 11.0958 11.7167 11 12 11H20C20.2833 11 20.5208 11.0958 20.7125 11.2875C20.9042 11.4792 21 11.7167 21 12C21 12.2833 20.9042 12.5208 20.7125 12.7125C20.5208 12.9042 20.2833 13 20 13H12ZM16 9C15.7167 9 15.4792 8.90417 15.2875 8.7125C15.0958 8.52083 15 8.28333 15 8V4C15 3.71667 15.0958 3.47917 15.2875 3.2875C15.4792 3.09583 15.7167 3 16 3C16.2833 3 16.5208 3.09583 16.7125 3.2875C16.9042 3.47917 17 3.71667 17 4V5H20C20.2833 5 20.5208 5.09583 20.7125 5.2875C20.9042 5.47917 21 5.71667 21 6C21 6.28333 20.9042 6.52083 20.7125 6.7125C20.5208 6.90417 20.2833 7 20 7H17V8C17 8.28333 16.9042 8.52083 16.7125 8.7125C16.5208 8.90417 16.2833 9 16 9ZM4 7C3.71667 7 3.47917 6.90417 3.2875 6.7125C3.09583 6.52083 3 6.28333 3 6C3 5.71667 3.09583 5.47917 3.2875 5.2875C3.47917 5.09583 3.71667 5 4 5H12C12.2833 5 12.5208 5.09583 12.7125 5.2875C12.9042 5.47917 13 5.71667 13 6C13 6.28333 12.9042 6.52083 12.7125 6.7125C12.5208 6.90417 12.2833 7 12 7H4Z", fill: "#161616" })));
@@ -0,0 +1,2 @@
1
+ import { h } from "@stencil/core";
2
+ export const SquareFilterIcon = () => (h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none" }, h("rect", { x: "3", y: "3", width: "18", height: "18", rx: "3", fill: "white", stroke: "#E0E0E0", "stroke-width": "2" })));