vviinn-widgets 2.0.0 → 2.2.1

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 (106) hide show
  1. package/dist/cjs/Handler-d1a8a86a.js +329 -0
  2. package/dist/cjs/{app-globals-de6924b5.js → app-globals-d0251be8.js} +1 -1
  3. package/dist/cjs/cropper-handler.cjs.entry.js +27 -0
  4. package/dist/cjs/customized-slots-14b77e4a.js +53 -0
  5. package/dist/cjs/{cropper-handler_28.cjs.entry.js → highlight-box_22.cjs.entry.js} +48 -437
  6. package/dist/{esm/Array-e81cf4a3.js → cjs/imageSearch.store-d9ed1a5b.js} +10009 -3391
  7. package/dist/cjs/{index-7adce49f.js → index-141137b2.js} +14 -362
  8. package/dist/cjs/{index-8a276115.js → index-a5e15a0c.js} +7 -1
  9. package/dist/cjs/loader.cjs.js +3 -3
  10. package/dist/cjs/vviinn-carousel_5.cjs.entry.js +1232 -0
  11. package/dist/cjs/vviinn-error.cjs.entry.js +19 -0
  12. package/dist/cjs/vviinn-preloader.cjs.entry.js +26 -0
  13. package/dist/cjs/vviinn-vps-button.cjs.entry.js +43 -0
  14. package/dist/cjs/vviinn-vps-widget.cjs.entry.js +97 -0
  15. package/dist/cjs/vviinn-widgets.cjs.js +3 -3
  16. package/dist/collection/collection-manifest.json +2 -0
  17. package/dist/collection/components/vviinn-carousel/vviinn-carousel.css +22 -18
  18. package/dist/collection/components/vviinn-carousel/vviinn-carousel.js +78 -68
  19. package/dist/collection/components/vviinn-icons/index.js +4 -0
  20. package/dist/collection/components/vviinn-product-card/render-helpers.js +4 -4
  21. package/dist/collection/components/vviinn-product-card/vviinn-product-card.css +5 -6
  22. package/dist/collection/components/vviinn-product-card/vviinn-product-card.js +26 -5
  23. package/dist/collection/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.css +238 -0
  24. package/dist/collection/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.js +200 -0
  25. package/dist/collection/components/vviinn-vpr-button/stories/kek.stories.js +18 -0
  26. package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.css +35 -0
  27. package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.js +149 -0
  28. package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-vidget.js +148 -28
  29. package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-widget.css +31 -8
  30. package/dist/esm/Handler-639a4cb3.js +308 -0
  31. package/dist/esm/{app-globals-0a626970.js → app-globals-b6113170.js} +1 -1
  32. package/dist/esm/cropper-handler.entry.js +23 -0
  33. package/dist/esm/customized-slots-a952fb80.js +50 -0
  34. package/dist/esm/{cropper-handler_28.entry.js → highlight-box_22.entry.js} +21 -404
  35. package/dist/{cjs/Array-cce2fde8.js → esm/imageSearch.store-4ca31230.js} +8705 -2137
  36. package/dist/esm/{index-e77e65ae.js → index-017f18de.js} +6 -2
  37. package/dist/esm/{index-0ccfcee5.js → index-3e85e294.js} +14 -362
  38. package/dist/esm/loader.js +3 -3
  39. package/dist/esm/vviinn-carousel_5.entry.js +1224 -0
  40. package/dist/esm/vviinn-error.entry.js +15 -0
  41. package/dist/esm/vviinn-preloader.entry.js +22 -0
  42. package/dist/esm/vviinn-vps-button.entry.js +39 -0
  43. package/dist/esm/vviinn-vps-widget.entry.js +93 -0
  44. package/dist/esm/vviinn-widgets.js +3 -3
  45. package/dist/types/campaign/Campaign.d.ts +1 -1
  46. package/dist/types/components/vviinn-carousel/vviinn-carousel.d.ts +13 -7
  47. package/dist/types/components/vviinn-icons/index.d.ts +2 -0
  48. package/dist/types/components/vviinn-product-card/render-helpers.d.ts +3 -2
  49. package/dist/types/components/vviinn-product-card/vviinn-product-card.d.ts +2 -0
  50. package/dist/types/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.d.ts +25 -0
  51. package/dist/types/components/vviinn-vpr-button/stories/kek.stories.d.ts +7 -0
  52. package/dist/types/components/vviinn-vpr-button/vviinn-vpr-button.d.ts +14 -0
  53. package/dist/types/components/vviinn-vpr-widget/vviinn-vpr-vidget.d.ts +36 -8
  54. package/dist/types/components.d.ts +62 -10
  55. package/dist/vviinn-widgets/p-0ed1ef7e.entry.js +1 -0
  56. package/dist/vviinn-widgets/{p-6c4fd1db.js → p-16e49514.js} +1 -1
  57. package/dist/vviinn-widgets/p-3da18d7f.js +1 -0
  58. package/dist/vviinn-widgets/p-62a1b042.entry.js +1 -0
  59. package/dist/vviinn-widgets/p-68900093.entry.js +1 -0
  60. package/dist/vviinn-widgets/p-6c4c240d.entry.js +1 -0
  61. package/dist/vviinn-widgets/p-95e53d99.entry.js +1 -0
  62. package/dist/vviinn-widgets/p-9fee20e7.entry.js +1 -0
  63. package/dist/vviinn-widgets/p-d7894eaf.js +1 -0
  64. package/dist/vviinn-widgets/p-db0be4cd.js +1 -0
  65. package/dist/vviinn-widgets/p-eb15116d.entry.js +1 -0
  66. package/dist/vviinn-widgets/{p-489aee23.js → p-f00fddbb.js} +1 -1
  67. package/dist/vviinn-widgets/p-f582db5c.js +1 -0
  68. package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -1
  69. package/package.json +3 -1
  70. package/www/build/p-0ed1ef7e.entry.js +1 -0
  71. package/www/build/{p-6c4fd1db.js → p-16e49514.js} +1 -1
  72. package/www/build/p-1cc0cdfd.js +1 -0
  73. package/www/build/p-3da18d7f.js +1 -0
  74. package/www/build/p-62a1b042.entry.js +1 -0
  75. package/www/build/p-68900093.entry.js +1 -0
  76. package/www/build/p-6c4c240d.entry.js +1 -0
  77. package/www/build/p-95e53d99.entry.js +1 -0
  78. package/www/build/p-9fee20e7.entry.js +1 -0
  79. package/www/build/p-a67898be.css +1 -0
  80. package/www/build/p-d7894eaf.js +1 -0
  81. package/www/build/p-db0be4cd.js +1 -0
  82. package/www/build/p-eb15116d.entry.js +1 -0
  83. package/www/build/{p-489aee23.js → p-f00fddbb.js} +1 -1
  84. package/www/build/p-f582db5c.js +1 -0
  85. package/www/build/vviinn-widgets.esm.js +1 -1
  86. package/www/index.html +177 -8
  87. package/dist/cjs/imageSearch.store-39fce56c.js +0 -6926
  88. package/dist/cjs/vviinn-carousel.cjs.entry.js +0 -222
  89. package/dist/cjs/vviinn-vpr-widget.cjs.entry.js +0 -106
  90. package/dist/esm/imageSearch.store-b887ff78.js +0 -6893
  91. package/dist/esm/vviinn-carousel.entry.js +0 -218
  92. package/dist/esm/vviinn-vpr-widget.entry.js +0 -102
  93. package/dist/vviinn-widgets/p-2bf74c28.js +0 -1
  94. package/dist/vviinn-widgets/p-3063e23a.js +0 -1
  95. package/dist/vviinn-widgets/p-9145c82e.entry.js +0 -1
  96. package/dist/vviinn-widgets/p-ddcac3f8.js +0 -1
  97. package/dist/vviinn-widgets/p-f05da9f1.entry.js +0 -1
  98. package/dist/vviinn-widgets/p-f12f823d.entry.js +0 -1
  99. package/www/build/p-2bf74c28.js +0 -1
  100. package/www/build/p-3063e23a.js +0 -1
  101. package/www/build/p-9145c82e.entry.js +0 -1
  102. package/www/build/p-cbae3071.js +0 -125
  103. package/www/build/p-ddcac3f8.js +0 -1
  104. package/www/build/p-e0153ae2.css +0 -6
  105. package/www/build/p-f05da9f1.entry.js +0 -1
  106. package/www/build/p-f12f823d.entry.js +0 -1
@@ -1,10 +1,10 @@
1
- import { Component, Host, h, Prop, Event, Element, State } from "@stencil/core";
1
+ import { Component, Host, h, Prop, Event, Element, State, } from "@stencil/core";
2
2
  import { pipe } from "fp-ts/lib/function";
3
3
  import { getAnalyticsModule } from "../../analytics/GeneralAnalytics";
4
4
  import { state } from "../../store/store";
5
5
  import * as O from "fp-ts/lib/Option";
6
6
  import { imageSearchState } from "../../store/imageSearch.store";
7
- import { Linked, Price, ResponsiveImage, Image } from "./render-helpers";
7
+ import { Linked, Price, ResponsiveImage, Image, } from "./render-helpers";
8
8
  /**
9
9
  * @part brand - product brand.
10
10
  * @part currency - currency sign. Renders after price-amount.
@@ -65,13 +65,19 @@ export class VviinnProductCard {
65
65
  width: this.imageWidth,
66
66
  height: this.imageWidth * this.imageRatio,
67
67
  src: this.image,
68
- title: this.productTitle
68
+ title: this.productTitle,
69
+ lazy: false,
69
70
  };
70
- return this.responsive ? ResponsiveImage(props) : Image(props);
71
+ return this.responsive
72
+ ? ResponsiveImage(props, () => this.kek())
73
+ : Image(props, () => this.kek());
74
+ }
75
+ kek() {
76
+ this.productImageLoaded.emit(this.productId);
71
77
  }
72
78
  render() {
73
79
  var _a, _b, _c;
74
- return (h(Host, { exportparts: "brand, currency, deeplink, image, type, image-link, price-amount, price-container, price-outdated, price-prefix, price-regular, price-sale, title", class: { dimmed: this.dimmedBackground } },
80
+ return (h(Host, { part: "product-card", class: { dimmed: this.dimmedBackground }, exportparts: "brand, currency, deeplink, image, image-link, price-amount, price-container, price-outdated, price-prefix, price-regular, price-sale, title" },
75
81
  h(Linked, { deeplink: this.deeplink, part: "image-link" }, this.renderImage()),
76
82
  h(Linked, { deeplink: this.deeplink, part: "deeplink" },
77
83
  h("span", { class: "title", part: "title" }, this.productTitle)),
@@ -399,6 +405,21 @@ export class VviinnProductCard {
399
405
  "resolved": "string",
400
406
  "references": {}
401
407
  }
408
+ }, {
409
+ "method": "productImageLoaded",
410
+ "name": "productImageLoaded",
411
+ "bubbles": true,
412
+ "cancelable": true,
413
+ "composed": true,
414
+ "docs": {
415
+ "tags": [],
416
+ "text": ""
417
+ },
418
+ "complexType": {
419
+ "original": "string",
420
+ "resolved": "string",
421
+ "references": {}
422
+ }
402
423
  }]; }
403
424
  static get elementRef() { return "el"; }
404
425
  }
@@ -0,0 +1,238 @@
1
+ :host {
2
+ --vviinn-carousel-columns: 0;
3
+ box-sizing: border-box;
4
+ display: block;
5
+ display: flex;
6
+ height: 100vh;
7
+ left: 0;
8
+ position: fixed;
9
+ top: 0;
10
+ transition: background 0.1s ease-in-out;
11
+ width: 100vw;
12
+ }
13
+
14
+ :host(.open) {
15
+ background: rgba(0, 0, 0, 0.2);
16
+ }
17
+
18
+ :host(.bottom) {
19
+ flex-direction: column;
20
+ justify-content: end;
21
+ }
22
+
23
+ :host(.right) {
24
+ flex-direction: row;
25
+ justify-content: flex-end;
26
+ }
27
+
28
+ header {
29
+ position: relative;
30
+ text-align: center;
31
+ padding: 32px;
32
+ }
33
+
34
+ header.contains-source-img {
35
+ display: grid;
36
+ justify-items: center;
37
+ grid-gap: 12px;
38
+ }
39
+
40
+ img.source-image {
41
+ width: 64px;
42
+ height: 64px;
43
+ border-radius: 50%;
44
+ box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.15);
45
+ padding: 8px;
46
+ }
47
+
48
+ :host(.right) header {
49
+ box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.1);
50
+ }
51
+
52
+ main {
53
+ padding: 0 24px;
54
+ }
55
+
56
+ :host(.right) main {
57
+ overflow: auto;
58
+ }
59
+
60
+ .sidebar {
61
+ background: white;
62
+ box-sizing: border-box;
63
+ display: flex;
64
+ flex-direction: column;
65
+ }
66
+
67
+ :host(.bottom.idle) .sidebar,
68
+ :host(.bottom.closed) .sidebar {
69
+ transform: translateY(100%);
70
+ }
71
+
72
+ :host(.bottom.closed) .sidebar {
73
+ -webkit-animation-name: slideOutFromBottom;
74
+ animation-name: slideOutFromBottom;
75
+ -webkit-animation-duration: 0.5s;
76
+ animation-duration: 0.5s;
77
+ -webkit-animation-fill-mode: forwards;
78
+ animation-fill-mode: forwards;
79
+ }
80
+
81
+ :host(.bottom.open) .sidebar {
82
+ -webkit-animation-name: slideInFromBottom;
83
+ animation-name: slideInFromBottom;
84
+ -webkit-animation-duration: 0.5s;
85
+ animation-duration: 0.5s;
86
+ -webkit-animation-fill-mode: forwards;
87
+ animation-fill-mode: forwards;
88
+ }
89
+
90
+ :host(.right.idle) .sidebar {
91
+ transform: translateX(100%);
92
+ }
93
+
94
+ :host(.right.closed) .sidebar {
95
+ -webkit-animation-name: slideOutFromRight;
96
+ animation-name: slideOutFromRight;
97
+ -webkit-animation-duration: 0.5s;
98
+ animation-duration: 0.5s;
99
+ -webkit-animation-fill-mode: forwards;
100
+ animation-fill-mode: forwards;
101
+ }
102
+
103
+ :host(.right.open) .sidebar {
104
+ -webkit-animation-name: slideInFromRight;
105
+ animation-name: slideInFromRight;
106
+ -webkit-animation-duration: 0.5s;
107
+ animation-duration: 0.5s;
108
+ -webkit-animation-fill-mode: forwards;
109
+ animation-fill-mode: forwards;
110
+ }
111
+
112
+ :host(.right) .sidebar {
113
+ max-width: 480px;
114
+ }
115
+
116
+ :host(.right) vviinn-vpr-widget::part(recommendations-grid) {
117
+ display: grid;
118
+ grid-template-columns: repeat(2, 1fr);
119
+ grid-gap: 24px;
120
+ }
121
+
122
+ :host(.right) vviinn-vpr-widget {
123
+ overflow: auto;
124
+ }
125
+
126
+ :host(.right) vviinn-vpr-widget::part(image) {
127
+ border: none;
128
+ }
129
+
130
+ .title {
131
+ font-style: normal;
132
+ font-weight: 500;
133
+ font-size: 28px;
134
+ line-height: 40px;
135
+ text-align: center;
136
+ color: #000000;
137
+ }
138
+
139
+ vviinn-vpr-widget::part(title),
140
+ vviinn-vpr-widget::part(brand),
141
+ vviinn-vpr-widget::part(type) {
142
+ text-align: left;
143
+ }
144
+
145
+ vviinn-vpr-widget::part(price-container) {
146
+ align-self: start;
147
+ }
148
+
149
+ .close-sidebar {
150
+ background: transparent;
151
+ border: none;
152
+ cursor: pointer;
153
+ margin: 0;
154
+ padding: 0;
155
+ position: absolute;
156
+ right: 24px;
157
+ top: 24px;
158
+ }
159
+
160
+ @-webkit-keyframes slideInFromBottom {
161
+ from {
162
+ transform: translateY(100%);
163
+ }
164
+
165
+ to {
166
+ transform: translateY(0);
167
+ }
168
+ }
169
+
170
+ @keyframes slideInFromBottom {
171
+ from {
172
+ transform: translateY(100%);
173
+ }
174
+
175
+ to {
176
+ transform: translateY(0);
177
+ }
178
+ }
179
+
180
+ @-webkit-keyframes slideOutFromBottom {
181
+ from {
182
+ transform: translateY(0);
183
+ }
184
+
185
+ to {
186
+ transform: translateY(100%);
187
+ }
188
+ }
189
+
190
+ @keyframes slideOutFromBottom {
191
+ from {
192
+ transform: translateY(0);
193
+ }
194
+
195
+ to {
196
+ transform: translateY(100%);
197
+ }
198
+ }
199
+
200
+ @-webkit-keyframes slideInFromRight {
201
+ from {
202
+ transform: translateX(100%);
203
+ }
204
+
205
+ to {
206
+ transform: translateX(0);
207
+ }
208
+ }
209
+
210
+ @keyframes slideInFromRight {
211
+ from {
212
+ transform: translateX(100%);
213
+ }
214
+
215
+ to {
216
+ transform: translateX(0);
217
+ }
218
+ }
219
+
220
+ @-webkit-keyframes slideOutFromRight {
221
+ from {
222
+ transform: translateX(0);
223
+ }
224
+
225
+ to {
226
+ transform: translateX(100%);
227
+ }
228
+ }
229
+
230
+ @keyframes slideOutFromRight {
231
+ from {
232
+ transform: translateX(0);
233
+ }
234
+
235
+ to {
236
+ transform: translateX(100%);
237
+ }
238
+ }
@@ -0,0 +1,200 @@
1
+ import { Component, Host, h, Prop, State, Listen, Element, Event, } from "@stencil/core";
2
+ import { CrossIcon } from "../../vviinn-icons";
3
+ export class RecommendationsSidebar {
4
+ constructor() {
5
+ this.position = "bottom";
6
+ this.sourceImage = null;
7
+ this.widgetScrollbar = false;
8
+ this.state = "idle";
9
+ }
10
+ bodyClickListener(event) {
11
+ const { clientX, clientY } = event;
12
+ const sidebarRect = this.getSidebarRectangle();
13
+ if (!sidebarRect)
14
+ return;
15
+ const inLeftBound = clientX >= sidebarRect.left;
16
+ const inRightBound = clientX <= sidebarRect.right;
17
+ const inTopBound = clientY >= sidebarRect.top;
18
+ const inBottomBound = clientY <= sidebarRect.bottom;
19
+ const inBound = inLeftBound && inRightBound && inTopBound && inBottomBound;
20
+ if (!inBound) {
21
+ this.state = "closed";
22
+ }
23
+ }
24
+ getClassMap() {
25
+ return {
26
+ [this.position]: true,
27
+ [this.state]: true,
28
+ };
29
+ }
30
+ getSidebarRectangle() {
31
+ var _a;
32
+ return (_a = this.el.shadowRoot.querySelector("aside")) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
33
+ }
34
+ render() {
35
+ return (h(Host, { class: this.getClassMap() },
36
+ h("aside", { class: "sidebar", part: "body", onAnimationEnd: (e) => this.handleAnimationEnd(e) },
37
+ h("header", { class: { "contains-source-img": this.isSourceImageValid() }, part: "sidebar-header" },
38
+ this.isSourceImageValid() ? this.renderSourceImage() : null,
39
+ h("span", { class: "title", part: "title" }, this.sidebarTitle),
40
+ h("button", { class: "close-sidebar", onClick: () => (this.state = "closed") },
41
+ h(CrossIcon, null))),
42
+ h("main", { part: "sidebar-content" },
43
+ h("vviinn-vpr-widget", { exportparts: "brand, currency, deeplink, image, image-link, price-amount, price-container, price-outdated, price-prefix, price-regular, price-sale, title: product-title", token: this.token, productId: this.productId, imageWidth: 300, blockTitle: "", mode: this.position === "bottom" ? "continuity" : "grid", useCarousel: this.position === "bottom", onRecommendationsLoaded: () => (this.state = "open"), showScroll: this.widgetScrollbar })))));
44
+ }
45
+ renderSourceImage() {
46
+ return (h("img", { class: "source-image", part: "source-image", src: this.sourceImage }));
47
+ }
48
+ isSourceImageValid() {
49
+ var _a;
50
+ return ((_a = this.sourceImage) === null || _a === void 0 ? void 0 : _a.length) > 0;
51
+ }
52
+ handleAnimationEnd({ animationName }) {
53
+ const isClosingAnimation = animationName.includes("slideOut");
54
+ if (!isClosingAnimation)
55
+ return;
56
+ this.modalClosed.emit();
57
+ }
58
+ static get is() { return "vviinn-recommendations-sidebar"; }
59
+ static get encapsulation() { return "shadow"; }
60
+ static get originalStyleUrls() { return {
61
+ "$": ["recommendations-sidebar.css"]
62
+ }; }
63
+ static get styleUrls() { return {
64
+ "$": ["recommendations-sidebar.css"]
65
+ }; }
66
+ static get properties() { return {
67
+ "sidebarTitle": {
68
+ "type": "string",
69
+ "mutable": false,
70
+ "complexType": {
71
+ "original": "string",
72
+ "resolved": "string",
73
+ "references": {}
74
+ },
75
+ "required": false,
76
+ "optional": false,
77
+ "docs": {
78
+ "tags": [],
79
+ "text": ""
80
+ },
81
+ "attribute": "sidebar-title",
82
+ "reflect": false
83
+ },
84
+ "token": {
85
+ "type": "string",
86
+ "mutable": false,
87
+ "complexType": {
88
+ "original": "string",
89
+ "resolved": "string",
90
+ "references": {}
91
+ },
92
+ "required": false,
93
+ "optional": false,
94
+ "docs": {
95
+ "tags": [],
96
+ "text": ""
97
+ },
98
+ "attribute": "token",
99
+ "reflect": false
100
+ },
101
+ "productId": {
102
+ "type": "string",
103
+ "mutable": false,
104
+ "complexType": {
105
+ "original": "string",
106
+ "resolved": "string",
107
+ "references": {}
108
+ },
109
+ "required": false,
110
+ "optional": false,
111
+ "docs": {
112
+ "tags": [],
113
+ "text": ""
114
+ },
115
+ "attribute": "product-id",
116
+ "reflect": false
117
+ },
118
+ "position": {
119
+ "type": "string",
120
+ "mutable": false,
121
+ "complexType": {
122
+ "original": "\"bottom\" | \"right\"",
123
+ "resolved": "\"bottom\" | \"right\"",
124
+ "references": {}
125
+ },
126
+ "required": false,
127
+ "optional": false,
128
+ "docs": {
129
+ "tags": [],
130
+ "text": ""
131
+ },
132
+ "attribute": "position",
133
+ "reflect": false,
134
+ "defaultValue": "\"bottom\""
135
+ },
136
+ "sourceImage": {
137
+ "type": "string",
138
+ "mutable": false,
139
+ "complexType": {
140
+ "original": "string | null",
141
+ "resolved": "string",
142
+ "references": {}
143
+ },
144
+ "required": false,
145
+ "optional": false,
146
+ "docs": {
147
+ "tags": [],
148
+ "text": ""
149
+ },
150
+ "attribute": "source-image",
151
+ "reflect": false,
152
+ "defaultValue": "null"
153
+ },
154
+ "widgetScrollbar": {
155
+ "type": "boolean",
156
+ "mutable": false,
157
+ "complexType": {
158
+ "original": "boolean",
159
+ "resolved": "boolean",
160
+ "references": {}
161
+ },
162
+ "required": false,
163
+ "optional": false,
164
+ "docs": {
165
+ "tags": [],
166
+ "text": ""
167
+ },
168
+ "attribute": "widget-scrollbar",
169
+ "reflect": false,
170
+ "defaultValue": "false"
171
+ }
172
+ }; }
173
+ static get states() { return {
174
+ "state": {}
175
+ }; }
176
+ static get events() { return [{
177
+ "method": "modalClosed",
178
+ "name": "modalClosed",
179
+ "bubbles": true,
180
+ "cancelable": true,
181
+ "composed": true,
182
+ "docs": {
183
+ "tags": [],
184
+ "text": ""
185
+ },
186
+ "complexType": {
187
+ "original": "void",
188
+ "resolved": "void",
189
+ "references": {}
190
+ }
191
+ }]; }
192
+ static get elementRef() { return "el"; }
193
+ static get listeners() { return [{
194
+ "name": "click",
195
+ "method": "bodyClickListener",
196
+ "target": "body",
197
+ "capture": false,
198
+ "passive": false
199
+ }]; }
200
+ }
@@ -0,0 +1,18 @@
1
+ import { withDesign } from "storybook-addon-designs";
2
+ export default {
3
+ title: "Widgets/Visual Recommendation Button",
4
+ component: "vviinn-vpr-button",
5
+ decorators: [withDesign],
6
+ };
7
+ const Template = (args) => `<vviinn-vpr-button token="${args.token}" product-id="${args.productId}"></vviinn-vpr-button>`;
8
+ export const Default = Template.bind({});
9
+ Default.args = {
10
+ token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOjgzLCJqdGkiOiI3ZTg2Y2I1YS00ZTFjLTRhYjctYjU2My1lN2FjMTYzZTYyZDIiLCJzY29wZXMiOlsidnByIiwidnBzIiwidnBjIl19.SbaQnBkvoXer3GPCWUthFQStFKLHZNMBfj4Qu44WHM8nzaIt48I74yVy4gVbX29vtd6jIkDPdakqEXRXmAxOCtv7_nsd4iBs1yMegfOWW5g8f10PKfZqmWJcfhwKIEElnUMFmP6rXpogntZ7iFfeTBbiRNzQPhkaa7jUjgQkCC4",
11
+ productId: "4114460310",
12
+ };
13
+ Default.parameters = {
14
+ design: {
15
+ type: "figma",
16
+ url: "https://www.figma.com/file/YR5ZK1s4z9ZRUXytB8uVuj/Widgets?node-id=591%3A3859",
17
+ },
18
+ };
@@ -0,0 +1,35 @@
1
+ :host {
2
+ display: block;
3
+ }
4
+
5
+ .open-button {
6
+ align-items: center;
7
+ background: rgba(255, 255, 255, 0.8);
8
+ border-radius: 50%;
9
+ border: none;
10
+ box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.15);
11
+ box-sizing: border-box;
12
+ cursor: pointer;
13
+ display: grid;
14
+ height: 40px;
15
+ justify-items: center;
16
+ padding: 0;
17
+ width: 40px;
18
+ transition: all 0.25s ease-in-out;
19
+ }
20
+
21
+ .open-button:hover {
22
+ box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.25);
23
+ }
24
+
25
+ .open-button:focus {
26
+ border: 2px solid rgba(15, 98, 254, 0.5);
27
+ outline: none;
28
+ }
29
+
30
+ .open-button:active {
31
+ background: #F4F4F4;
32
+ outline: none;
33
+ }
34
+
35
+
@@ -0,0 +1,149 @@
1
+ import { Component, Host, h, Prop } from "@stencil/core";
2
+ import { VisualSearchIcon } from "../vviinn-icons";
3
+ /**
4
+ *
5
+ * @part button - clickable button element
6
+ */
7
+ export class VviinnVprButton {
8
+ constructor() {
9
+ this.position = "bottom";
10
+ this.sourceImage = null;
11
+ this.sidebarTitle = "Visually similar products";
12
+ this.modalScrollbar = false;
13
+ }
14
+ render() {
15
+ return (h(Host, null,
16
+ h("button", { class: "open-button", part: "button", onClick: () => this.handleClick() },
17
+ h("slot", null,
18
+ h(VisualSearchIcon, null)))));
19
+ }
20
+ handleClick() {
21
+ const sidebar = document.createElement("vviinn-recommendations-sidebar");
22
+ sidebar.sidebarTitle = this.sidebarTitle;
23
+ sidebar.productId = this.productId;
24
+ sidebar.token = this.token;
25
+ sidebar.position = this.position;
26
+ sidebar.sourceImage = this.sourceImage;
27
+ sidebar.widgetScrollbar = this.modalScrollbar;
28
+ sidebar.addEventListener("modalClosed", () => {
29
+ document.body.removeChild(sidebar);
30
+ });
31
+ document.body.append(sidebar);
32
+ }
33
+ static get is() { return "vviinn-vpr-button"; }
34
+ static get encapsulation() { return "shadow"; }
35
+ static get originalStyleUrls() { return {
36
+ "$": ["vviinn-vpr-button.css"]
37
+ }; }
38
+ static get styleUrls() { return {
39
+ "$": ["vviinn-vpr-button.css"]
40
+ }; }
41
+ static get properties() { return {
42
+ "token": {
43
+ "type": "string",
44
+ "mutable": false,
45
+ "complexType": {
46
+ "original": "string",
47
+ "resolved": "string",
48
+ "references": {}
49
+ },
50
+ "required": false,
51
+ "optional": false,
52
+ "docs": {
53
+ "tags": [],
54
+ "text": ""
55
+ },
56
+ "attribute": "token",
57
+ "reflect": false
58
+ },
59
+ "productId": {
60
+ "type": "string",
61
+ "mutable": false,
62
+ "complexType": {
63
+ "original": "string",
64
+ "resolved": "string",
65
+ "references": {}
66
+ },
67
+ "required": false,
68
+ "optional": false,
69
+ "docs": {
70
+ "tags": [],
71
+ "text": ""
72
+ },
73
+ "attribute": "product-id",
74
+ "reflect": false
75
+ },
76
+ "position": {
77
+ "type": "string",
78
+ "mutable": false,
79
+ "complexType": {
80
+ "original": "\"bottom\" | \"right\"",
81
+ "resolved": "\"bottom\" | \"right\"",
82
+ "references": {}
83
+ },
84
+ "required": false,
85
+ "optional": false,
86
+ "docs": {
87
+ "tags": [],
88
+ "text": ""
89
+ },
90
+ "attribute": "position",
91
+ "reflect": false,
92
+ "defaultValue": "\"bottom\""
93
+ },
94
+ "sourceImage": {
95
+ "type": "string",
96
+ "mutable": false,
97
+ "complexType": {
98
+ "original": "string | null",
99
+ "resolved": "string",
100
+ "references": {}
101
+ },
102
+ "required": false,
103
+ "optional": false,
104
+ "docs": {
105
+ "tags": [],
106
+ "text": ""
107
+ },
108
+ "attribute": "source-image",
109
+ "reflect": false,
110
+ "defaultValue": "null"
111
+ },
112
+ "sidebarTitle": {
113
+ "type": "string",
114
+ "mutable": false,
115
+ "complexType": {
116
+ "original": "string",
117
+ "resolved": "string",
118
+ "references": {}
119
+ },
120
+ "required": false,
121
+ "optional": false,
122
+ "docs": {
123
+ "tags": [],
124
+ "text": ""
125
+ },
126
+ "attribute": "sidebar-title",
127
+ "reflect": false,
128
+ "defaultValue": "\"Visually similar products\""
129
+ },
130
+ "modalScrollbar": {
131
+ "type": "boolean",
132
+ "mutable": false,
133
+ "complexType": {
134
+ "original": "boolean",
135
+ "resolved": "boolean",
136
+ "references": {}
137
+ },
138
+ "required": false,
139
+ "optional": false,
140
+ "docs": {
141
+ "tags": [],
142
+ "text": ""
143
+ },
144
+ "attribute": "modal-scrollbar",
145
+ "reflect": false,
146
+ "defaultValue": "false"
147
+ }
148
+ }; }
149
+ }