@jumpgroup/jump-design-system 1.0.17 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/jump-card-ecommerce-showcase.cjs.entry.js +101 -0
- package/dist/cjs/jump-card-ecommerce-showcase.cjs.entry.js.map +1 -0
- package/dist/cjs/jump-design-system.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/jump-card-ecommerce-showcase/jump-card-ecommerce-showcase.css +281 -0
- package/dist/collection/components/jump-card-ecommerce-showcase/jump-card-ecommerce-showcase.js +440 -0
- package/dist/collection/components/jump-card-ecommerce-showcase/jump-card-ecommerce-showcase.js.map +1 -0
- package/dist/collection/components/jump-card-ecommerce-showcase/jump-card-ecommerce-showcase.stories.js +144 -0
- package/dist/collection/components/jump-card-ecommerce-showcase/jump-card-ecommerce-showcase.stories.js.map +1 -0
- package/dist/components/jump-card-ecommerce-showcase.d.ts +11 -0
- package/dist/components/jump-card-ecommerce-showcase.js +141 -0
- package/dist/components/jump-card-ecommerce-showcase.js.map +1 -0
- package/dist/esm/jump-card-ecommerce-showcase.entry.js +97 -0
- package/dist/esm/jump-card-ecommerce-showcase.entry.js.map +1 -0
- package/dist/esm/jump-design-system.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/jump-design-system/jump-design-system.esm.js +1 -1
- package/dist/jump-design-system/jump-design-system.esm.js.map +1 -1
- package/dist/jump-design-system/p-ef4cf4ec.entry.js +2 -0
- package/dist/jump-design-system/p-ef4cf4ec.entry.js.map +1 -0
- package/dist/jump-design-system-elements.json +110 -0
- package/dist/types/components/jump-card-ecommerce-showcase/jump-card-ecommerce-showcase.d.ts +49 -0
- package/dist/types/components/jump-card-ecommerce-showcase/jump-card-ecommerce-showcase.stories.d.ts +112 -0
- package/dist/types/components.d.ts +157 -0
- package/package.json +1 -1
package/dist/collection/components/jump-card-ecommerce-showcase/jump-card-ecommerce-showcase.js
ADDED
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
export class JumpCardEcommerceShowcase {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.hideDiscountIfLessThreshold = undefined;
|
|
5
|
+
this.badge = undefined;
|
|
6
|
+
this.link = undefined;
|
|
7
|
+
this.img = undefined;
|
|
8
|
+
this.imgAlt = undefined;
|
|
9
|
+
this.productName = undefined;
|
|
10
|
+
this.subtitle = undefined;
|
|
11
|
+
this.productId = undefined;
|
|
12
|
+
this.price = undefined;
|
|
13
|
+
this.salePrice = undefined;
|
|
14
|
+
this.currency = '€';
|
|
15
|
+
this.badgeColor = 'secondary';
|
|
16
|
+
this.outOfStock = false;
|
|
17
|
+
this.outOfStockText = undefined;
|
|
18
|
+
this.availableText = undefined;
|
|
19
|
+
this.imageObjectFit = 'cover';
|
|
20
|
+
this.priceFormatted = undefined;
|
|
21
|
+
this.salePriceFormatted = undefined;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Set the price of the product
|
|
25
|
+
* @param price
|
|
26
|
+
* @param salePrice
|
|
27
|
+
*/
|
|
28
|
+
async setPrice(price, salePrice) {
|
|
29
|
+
let shouldFormat = false;
|
|
30
|
+
if (price && price > 0) {
|
|
31
|
+
shouldFormat = true;
|
|
32
|
+
this.price = price;
|
|
33
|
+
}
|
|
34
|
+
if (salePrice && salePrice > 0) {
|
|
35
|
+
this.salePrice = salePrice;
|
|
36
|
+
}
|
|
37
|
+
if (shouldFormat) {
|
|
38
|
+
this.formatPrices();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/* ---------------------- @LIFECYCLE ------------------------- */
|
|
42
|
+
componentDidLoad() {
|
|
43
|
+
this.formatPrices();
|
|
44
|
+
}
|
|
45
|
+
/* ---------------------- @METHODS ------------------------- */
|
|
46
|
+
goToProduct() {
|
|
47
|
+
this.goToProductPage.emit({
|
|
48
|
+
productId: this.productId,
|
|
49
|
+
link: this.link,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
formatPrices() {
|
|
53
|
+
var _a;
|
|
54
|
+
let locale = (_a = document.documentElement.lang) !== null && _a !== void 0 ? _a : 'it-IT';
|
|
55
|
+
if (locale.length == 2) {
|
|
56
|
+
locale = `${locale}-${locale.toUpperCase()}`;
|
|
57
|
+
}
|
|
58
|
+
// Format price with 2 decimal digits and in locale
|
|
59
|
+
this.priceFormatted = this.price.toLocaleString(locale, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
60
|
+
this.salePriceFormatted = this.salePrice.toLocaleString(locale, {
|
|
61
|
+
minimumFractionDigits: 2,
|
|
62
|
+
maximumFractionDigits: 2,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
render() {
|
|
66
|
+
const backgroundClass = 'hasBackground';
|
|
67
|
+
const iconOnlyClass = '';
|
|
68
|
+
const hasImageOnHover = '';
|
|
69
|
+
const miniCard = '';
|
|
70
|
+
const verticalCardClass = 'is-vertical';
|
|
71
|
+
const enableZoomClass = '';
|
|
72
|
+
function calculateDiscount(price, salePrice) {
|
|
73
|
+
const discount = ((price - salePrice) / price) * 100;
|
|
74
|
+
return discount.toFixed(0);
|
|
75
|
+
}
|
|
76
|
+
;
|
|
77
|
+
return (h(Host, { style: { '--image-object-fit': this.imageObjectFit } }, h("div", { class: `Media ${iconOnlyClass} ${backgroundClass} ${miniCard}` }, this.badge ?
|
|
78
|
+
h("jump-badge", { class: `${backgroundClass} ${iconOnlyClass}`, variant: this.badgeColor, dimension: "small", label: this.badge }) : '', this.salePrice && (this.salePrice < this.price) && (this.hideDiscountIfLessThreshold === undefined || parseFloat(calculateDiscount(this.price, this.salePrice)) > this.hideDiscountIfLessThreshold) ?
|
|
79
|
+
h("div", { class: "DiscountBadge" }, "-", calculateDiscount(this.price, this.salePrice), "%") : null, h("a", { href: this.link }, h("figure", { class: `Images ${hasImageOnHover} ${enableZoomClass}` }, this.img && h("img", { class: "Images__Front", src: this.img, alt: this.imgAlt })))), h("div", { class: `Content ${backgroundClass} ${iconOnlyClass} ${miniCard} ${verticalCardClass}` }, h("div", { class: `Body ${backgroundClass} ${iconOnlyClass} ${miniCard} ${verticalCardClass}` }, h("div", { class: "Body__Top" }, h("div", { class: "Info" }, h("a", { href: this.link, class: "Product" }, this.productName), this.subtitle ? h("div", { class: "Subtitle", onClick: () => this.goToProduct() }, this.subtitle) : null), this.price ?
|
|
80
|
+
h("div", { class: `Price ${miniCard}` }, h("div", { class: `Price__Regular ${this.salePrice && this.salePrice < this.price ? 'sale' : ''}` }, this.currency, this.priceFormatted), this.salePrice && this.salePrice < this.price ?
|
|
81
|
+
h("div", { class: "Price__Sale" }, this.currency, this.salePriceFormatted)
|
|
82
|
+
: null)
|
|
83
|
+
: null, this.outOfStock ?
|
|
84
|
+
h("div", { class: "OutOfStock" }, this.outOfStockText ? this.outOfStockText : 'Esaurito') : h("div", { class: "AvailableStock" }, this.availableText ? this.availableText : 'Disponibile'))))));
|
|
85
|
+
}
|
|
86
|
+
static get is() { return "jump-card-ecommerce-showcase"; }
|
|
87
|
+
static get encapsulation() { return "shadow"; }
|
|
88
|
+
static get originalStyleUrls() {
|
|
89
|
+
return {
|
|
90
|
+
"$": ["jump-card-ecommerce-showcase.scss"]
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
static get styleUrls() {
|
|
94
|
+
return {
|
|
95
|
+
"$": ["jump-card-ecommerce-showcase.css"]
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
static get properties() {
|
|
99
|
+
return {
|
|
100
|
+
"hideDiscountIfLessThreshold": {
|
|
101
|
+
"type": "number",
|
|
102
|
+
"mutable": false,
|
|
103
|
+
"complexType": {
|
|
104
|
+
"original": "number",
|
|
105
|
+
"resolved": "number",
|
|
106
|
+
"references": {}
|
|
107
|
+
},
|
|
108
|
+
"required": false,
|
|
109
|
+
"optional": false,
|
|
110
|
+
"docs": {
|
|
111
|
+
"tags": [],
|
|
112
|
+
"text": "Indicates the threshold below which the discount will be hidden"
|
|
113
|
+
},
|
|
114
|
+
"attribute": "hide-discount-if-less-threshold",
|
|
115
|
+
"reflect": false,
|
|
116
|
+
"defaultValue": "undefined"
|
|
117
|
+
},
|
|
118
|
+
"badge": {
|
|
119
|
+
"type": "string",
|
|
120
|
+
"mutable": false,
|
|
121
|
+
"complexType": {
|
|
122
|
+
"original": "string",
|
|
123
|
+
"resolved": "string",
|
|
124
|
+
"references": {}
|
|
125
|
+
},
|
|
126
|
+
"required": false,
|
|
127
|
+
"optional": false,
|
|
128
|
+
"docs": {
|
|
129
|
+
"tags": [],
|
|
130
|
+
"text": "Indicates the badge of the card"
|
|
131
|
+
},
|
|
132
|
+
"attribute": "badge",
|
|
133
|
+
"reflect": false
|
|
134
|
+
},
|
|
135
|
+
"link": {
|
|
136
|
+
"type": "string",
|
|
137
|
+
"mutable": false,
|
|
138
|
+
"complexType": {
|
|
139
|
+
"original": "string",
|
|
140
|
+
"resolved": "string",
|
|
141
|
+
"references": {}
|
|
142
|
+
},
|
|
143
|
+
"required": false,
|
|
144
|
+
"optional": false,
|
|
145
|
+
"docs": {
|
|
146
|
+
"tags": [],
|
|
147
|
+
"text": "Indicates the link of the card"
|
|
148
|
+
},
|
|
149
|
+
"attribute": "link",
|
|
150
|
+
"reflect": false
|
|
151
|
+
},
|
|
152
|
+
"img": {
|
|
153
|
+
"type": "string",
|
|
154
|
+
"mutable": false,
|
|
155
|
+
"complexType": {
|
|
156
|
+
"original": "string",
|
|
157
|
+
"resolved": "string",
|
|
158
|
+
"references": {}
|
|
159
|
+
},
|
|
160
|
+
"required": false,
|
|
161
|
+
"optional": false,
|
|
162
|
+
"docs": {
|
|
163
|
+
"tags": [],
|
|
164
|
+
"text": "Indicates the image's src of the card"
|
|
165
|
+
},
|
|
166
|
+
"attribute": "img",
|
|
167
|
+
"reflect": false
|
|
168
|
+
},
|
|
169
|
+
"imgAlt": {
|
|
170
|
+
"type": "string",
|
|
171
|
+
"mutable": false,
|
|
172
|
+
"complexType": {
|
|
173
|
+
"original": "string",
|
|
174
|
+
"resolved": "string",
|
|
175
|
+
"references": {}
|
|
176
|
+
},
|
|
177
|
+
"required": false,
|
|
178
|
+
"optional": false,
|
|
179
|
+
"docs": {
|
|
180
|
+
"tags": [],
|
|
181
|
+
"text": "Indicates the img's alt of the card"
|
|
182
|
+
},
|
|
183
|
+
"attribute": "img-alt",
|
|
184
|
+
"reflect": false
|
|
185
|
+
},
|
|
186
|
+
"productName": {
|
|
187
|
+
"type": "string",
|
|
188
|
+
"mutable": false,
|
|
189
|
+
"complexType": {
|
|
190
|
+
"original": "string",
|
|
191
|
+
"resolved": "string",
|
|
192
|
+
"references": {}
|
|
193
|
+
},
|
|
194
|
+
"required": false,
|
|
195
|
+
"optional": false,
|
|
196
|
+
"docs": {
|
|
197
|
+
"tags": [],
|
|
198
|
+
"text": "Indicates the title of the card"
|
|
199
|
+
},
|
|
200
|
+
"attribute": "product-name",
|
|
201
|
+
"reflect": false
|
|
202
|
+
},
|
|
203
|
+
"subtitle": {
|
|
204
|
+
"type": "string",
|
|
205
|
+
"mutable": false,
|
|
206
|
+
"complexType": {
|
|
207
|
+
"original": "string",
|
|
208
|
+
"resolved": "string",
|
|
209
|
+
"references": {}
|
|
210
|
+
},
|
|
211
|
+
"required": false,
|
|
212
|
+
"optional": false,
|
|
213
|
+
"docs": {
|
|
214
|
+
"tags": [],
|
|
215
|
+
"text": "Indicates the subtitle of the card"
|
|
216
|
+
},
|
|
217
|
+
"attribute": "subtitle",
|
|
218
|
+
"reflect": false
|
|
219
|
+
},
|
|
220
|
+
"productId": {
|
|
221
|
+
"type": "string",
|
|
222
|
+
"mutable": false,
|
|
223
|
+
"complexType": {
|
|
224
|
+
"original": "string",
|
|
225
|
+
"resolved": "string",
|
|
226
|
+
"references": {}
|
|
227
|
+
},
|
|
228
|
+
"required": false,
|
|
229
|
+
"optional": false,
|
|
230
|
+
"docs": {
|
|
231
|
+
"tags": [],
|
|
232
|
+
"text": "Indicates the ID of the product, can be also a SKU"
|
|
233
|
+
},
|
|
234
|
+
"attribute": "product-id",
|
|
235
|
+
"reflect": false
|
|
236
|
+
},
|
|
237
|
+
"price": {
|
|
238
|
+
"type": "number",
|
|
239
|
+
"mutable": false,
|
|
240
|
+
"complexType": {
|
|
241
|
+
"original": "number",
|
|
242
|
+
"resolved": "number",
|
|
243
|
+
"references": {}
|
|
244
|
+
},
|
|
245
|
+
"required": false,
|
|
246
|
+
"optional": false,
|
|
247
|
+
"docs": {
|
|
248
|
+
"tags": [],
|
|
249
|
+
"text": "Indicates the price of the card"
|
|
250
|
+
},
|
|
251
|
+
"attribute": "price",
|
|
252
|
+
"reflect": false
|
|
253
|
+
},
|
|
254
|
+
"salePrice": {
|
|
255
|
+
"type": "number",
|
|
256
|
+
"mutable": false,
|
|
257
|
+
"complexType": {
|
|
258
|
+
"original": "number",
|
|
259
|
+
"resolved": "number",
|
|
260
|
+
"references": {}
|
|
261
|
+
},
|
|
262
|
+
"required": false,
|
|
263
|
+
"optional": false,
|
|
264
|
+
"docs": {
|
|
265
|
+
"tags": [],
|
|
266
|
+
"text": "Indicates the sale price of the card"
|
|
267
|
+
},
|
|
268
|
+
"attribute": "sale-price",
|
|
269
|
+
"reflect": false
|
|
270
|
+
},
|
|
271
|
+
"currency": {
|
|
272
|
+
"type": "string",
|
|
273
|
+
"mutable": false,
|
|
274
|
+
"complexType": {
|
|
275
|
+
"original": "string",
|
|
276
|
+
"resolved": "string",
|
|
277
|
+
"references": {}
|
|
278
|
+
},
|
|
279
|
+
"required": false,
|
|
280
|
+
"optional": false,
|
|
281
|
+
"docs": {
|
|
282
|
+
"tags": [],
|
|
283
|
+
"text": "Indicates the currency of the card"
|
|
284
|
+
},
|
|
285
|
+
"attribute": "currency",
|
|
286
|
+
"reflect": false,
|
|
287
|
+
"defaultValue": "'\u20AC'"
|
|
288
|
+
},
|
|
289
|
+
"badgeColor": {
|
|
290
|
+
"type": "string",
|
|
291
|
+
"mutable": false,
|
|
292
|
+
"complexType": {
|
|
293
|
+
"original": "'primary' | 'secondary' | 'neutral' | 'warning' | 'success' | 'danger'",
|
|
294
|
+
"resolved": "\"danger\" | \"neutral\" | \"primary\" | \"secondary\" | \"success\" | \"warning\"",
|
|
295
|
+
"references": {}
|
|
296
|
+
},
|
|
297
|
+
"required": false,
|
|
298
|
+
"optional": false,
|
|
299
|
+
"docs": {
|
|
300
|
+
"tags": [],
|
|
301
|
+
"text": "Indicates the variant of the button"
|
|
302
|
+
},
|
|
303
|
+
"attribute": "badge-color",
|
|
304
|
+
"reflect": false,
|
|
305
|
+
"defaultValue": "'secondary'"
|
|
306
|
+
},
|
|
307
|
+
"outOfStock": {
|
|
308
|
+
"type": "boolean",
|
|
309
|
+
"mutable": true,
|
|
310
|
+
"complexType": {
|
|
311
|
+
"original": "boolean",
|
|
312
|
+
"resolved": "boolean",
|
|
313
|
+
"references": {}
|
|
314
|
+
},
|
|
315
|
+
"required": false,
|
|
316
|
+
"optional": false,
|
|
317
|
+
"docs": {
|
|
318
|
+
"tags": [],
|
|
319
|
+
"text": "Indicates if the product is outOfStock"
|
|
320
|
+
},
|
|
321
|
+
"attribute": "out-of-stock",
|
|
322
|
+
"reflect": true,
|
|
323
|
+
"defaultValue": "false"
|
|
324
|
+
},
|
|
325
|
+
"outOfStockText": {
|
|
326
|
+
"type": "string",
|
|
327
|
+
"mutable": false,
|
|
328
|
+
"complexType": {
|
|
329
|
+
"original": "string",
|
|
330
|
+
"resolved": "string",
|
|
331
|
+
"references": {}
|
|
332
|
+
},
|
|
333
|
+
"required": false,
|
|
334
|
+
"optional": false,
|
|
335
|
+
"docs": {
|
|
336
|
+
"tags": [],
|
|
337
|
+
"text": "Indicates the outOfStockText of the product"
|
|
338
|
+
},
|
|
339
|
+
"attribute": "out-of-stock-text",
|
|
340
|
+
"reflect": false
|
|
341
|
+
},
|
|
342
|
+
"availableText": {
|
|
343
|
+
"type": "string",
|
|
344
|
+
"mutable": false,
|
|
345
|
+
"complexType": {
|
|
346
|
+
"original": "string",
|
|
347
|
+
"resolved": "string",
|
|
348
|
+
"references": {}
|
|
349
|
+
},
|
|
350
|
+
"required": false,
|
|
351
|
+
"optional": false,
|
|
352
|
+
"docs": {
|
|
353
|
+
"tags": [],
|
|
354
|
+
"text": ""
|
|
355
|
+
},
|
|
356
|
+
"attribute": "available-text",
|
|
357
|
+
"reflect": false
|
|
358
|
+
},
|
|
359
|
+
"imageObjectFit": {
|
|
360
|
+
"type": "string",
|
|
361
|
+
"mutable": false,
|
|
362
|
+
"complexType": {
|
|
363
|
+
"original": "'cover' | 'scale-down' | 'contain' | 'fill' | 'none'",
|
|
364
|
+
"resolved": "\"contain\" | \"cover\" | \"fill\" | \"none\" | \"scale-down\"",
|
|
365
|
+
"references": {}
|
|
366
|
+
},
|
|
367
|
+
"required": false,
|
|
368
|
+
"optional": false,
|
|
369
|
+
"docs": {
|
|
370
|
+
"tags": [],
|
|
371
|
+
"text": "Controlla il comportamento dell'object-fit delle immagini"
|
|
372
|
+
},
|
|
373
|
+
"attribute": "image-object-fit",
|
|
374
|
+
"reflect": false,
|
|
375
|
+
"defaultValue": "'cover'"
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
static get states() {
|
|
380
|
+
return {
|
|
381
|
+
"priceFormatted": {},
|
|
382
|
+
"salePriceFormatted": {}
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
static get events() {
|
|
386
|
+
return [{
|
|
387
|
+
"method": "goToProductPage",
|
|
388
|
+
"name": "jump-card-go-to-product-page",
|
|
389
|
+
"bubbles": true,
|
|
390
|
+
"cancelable": true,
|
|
391
|
+
"composed": true,
|
|
392
|
+
"docs": {
|
|
393
|
+
"tags": [],
|
|
394
|
+
"text": ""
|
|
395
|
+
},
|
|
396
|
+
"complexType": {
|
|
397
|
+
"original": "any",
|
|
398
|
+
"resolved": "any",
|
|
399
|
+
"references": {}
|
|
400
|
+
}
|
|
401
|
+
}];
|
|
402
|
+
}
|
|
403
|
+
static get methods() {
|
|
404
|
+
return {
|
|
405
|
+
"setPrice": {
|
|
406
|
+
"complexType": {
|
|
407
|
+
"signature": "(price: number, salePrice: number) => Promise<void>",
|
|
408
|
+
"parameters": [{
|
|
409
|
+
"name": "price",
|
|
410
|
+
"type": "number",
|
|
411
|
+
"docs": ""
|
|
412
|
+
}, {
|
|
413
|
+
"name": "salePrice",
|
|
414
|
+
"type": "number",
|
|
415
|
+
"docs": ""
|
|
416
|
+
}],
|
|
417
|
+
"references": {
|
|
418
|
+
"Promise": {
|
|
419
|
+
"location": "global",
|
|
420
|
+
"id": "global::Promise"
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
"return": "Promise<void>"
|
|
424
|
+
},
|
|
425
|
+
"docs": {
|
|
426
|
+
"text": "Set the price of the product",
|
|
427
|
+
"tags": [{
|
|
428
|
+
"name": "param",
|
|
429
|
+
"text": "price"
|
|
430
|
+
}, {
|
|
431
|
+
"name": "param",
|
|
432
|
+
"text": "salePrice"
|
|
433
|
+
}]
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
static get elementRef() { return "JumpCardEcommerceShowcase"; }
|
|
439
|
+
}
|
|
440
|
+
//# sourceMappingURL=jump-card-ecommerce-showcase.js.map
|
package/dist/collection/components/jump-card-ecommerce-showcase/jump-card-ecommerce-showcase.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jump-card-ecommerce-showcase.js","sourceRoot":"","sources":["../../../src/components/jump-card-ecommerce-showcase/jump-card-ecommerce-showcase.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAgB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAOtG,MAAM,OAAO,yBAAyB;;2CAQU,SAAS;;;;;;;;;;wBA8B5B,GAAG;0B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Aa;wCAAE,IAAI,CAAC,QAAQ;wCAAE,IAAI,CAAC,kBAAkB,CAAO;oCACvE,CAAC,CAAC,IAAI,CACJ;4BACN,CAAC,CAAC,IAAI;wBAEP,IAAI,CAAC,UAAU,CAAC,CAAC;4BAClB,WAAK,KAAK,EAAC,YAAY,IAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,UAAU,CAAO,CAAC,CAAC,CAAE,WAAK,KAAK,EAAC,gBAAgB,IAAE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,aAAa,CAAO,CAEjL,CACF,CAGF,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, Host, h, Prop, Event, EventEmitter, Element, State, Method } from '@stencil/core';\n\n@Component({\n tag: 'jump-card-ecommerce-showcase',\n styleUrl: 'jump-card-ecommerce-showcase.scss',\n shadow: true,\n})\nexport class JumpCardEcommerceShowcase {\n\n @Element() JumpCardEcommerceShowcase: HTMLElement;\n jumpQuantityEl;\n\n /* ---------------------- @PROPERTIES ------------------------- */\n\n /** Indicates the threshold below which the discount will be hidden */\n @Prop() hideDiscountIfLessThreshold: number = undefined;\n\n /** Indicates the badge of the card*/\n @Prop() badge: string;\n\n /** Indicates the link of the card*/\n @Prop() link: string;\n\n /** Indicates the image's src of the card*/\n @Prop() img: string;\n\n /** Indicates the img's alt of the card*/\n @Prop() imgAlt: string;\n\n /** Indicates the title of the card*/\n @Prop() productName: string;\n\n /** Indicates the subtitle of the card*/\n @Prop() subtitle: string;\n\n /** Indicates the ID of the product, can be also a SKU*/\n @Prop() productId: string;\n\n /** Indicates the price of the card */\n @Prop() price: number;\n\n /** Indicates the sale price of the card */\n @Prop() salePrice: number;\n\n /** Indicates the currency of the card */\n @Prop() currency: string = '€';\n\n /** Indicates the variant of the button */\n @Prop() badgeColor: 'primary' | 'secondary' | 'neutral' | 'warning' | 'success' | 'danger' = 'secondary';\n\n /** Indicates if the product is outOfStock */\n @Prop({ mutable: true, reflect: true }) outOfStock: boolean = false;\n\n /** Indicates the outOfStockText of the product*/\n @Prop() outOfStockText: string;\n\n @Prop() availableText: string;\n \n /** Controlla il comportamento dell'object-fit delle immagini */\n @Prop() imageObjectFit: 'cover' | 'scale-down' | 'contain' | 'fill' | 'none' = 'cover';\n\n \n\n\n /* ---------------------- @STATE ------------------------- */\n\n @State() priceFormatted: string;\n\n @State() salePriceFormatted: string;\n\n /* ---------------------- @EVENTS ------------------------- */\n\n @Event({ eventName: 'jump-card-go-to-product-page' }) goToProductPage: EventEmitter;\n\n /**\n * Set the price of the product\n * @param price\n * @param salePrice\n */\n @Method()\n async setPrice(price: number, salePrice: number) {\n let shouldFormat = false;\n if (price && price > 0) {\n shouldFormat = true;\n this.price = price;\n }\n\n if (salePrice && salePrice > 0) {\n this.salePrice = salePrice;\n }\n\n if (shouldFormat) {\n this.formatPrices();\n }\n }\n\n /* ---------------------- @LIFECYCLE ------------------------- */\n\n componentDidLoad() {\n this.formatPrices();\n }\n\n /* ---------------------- @METHODS ------------------------- */\n\n goToProduct(){\n this.goToProductPage.emit({\n productId: this.productId,\n link: this.link,\n });\n }\n\n formatPrices() {\n let locale = document.documentElement.lang ?? 'it-IT';\n if (locale.length == 2) {\n locale = `${locale}-${locale.toUpperCase()}`;\n }\n\n // Format price with 2 decimal digits and in locale\n this.priceFormatted = this.price.toLocaleString(locale, { minimumFractionDigits: 2, maximumFractionDigits: 2 });\n this.salePriceFormatted = this.salePrice.toLocaleString(locale, {\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n });\n }\n\n render() {\n const backgroundClass = 'hasBackground';\n const iconOnlyClass = '';\n\n const hasImageOnHover = '';\n const miniCard = '';\n const verticalCardClass = 'is-vertical';\n const enableZoomClass = '';\n\n function calculateDiscount(price: number, salePrice: number): string {\n const discount = ((price - salePrice) / price) * 100;\n return discount.toFixed(0);\n };\n\n return (\n <Host style={{'--image-object-fit': this.imageObjectFit}}>\n\n <div\n class={`Media ${iconOnlyClass} ${backgroundClass} ${miniCard}`}\n >\n {this.badge ?\n <jump-badge class={`${backgroundClass} ${iconOnlyClass}`} variant={this.badgeColor} dimension=\"small\"\n label={this.badge}></jump-badge> : ''}\n \n {this.salePrice && (this.salePrice < this.price) && (this.hideDiscountIfLessThreshold === undefined || parseFloat(calculateDiscount(this.price, this.salePrice)) > this.hideDiscountIfLessThreshold) ?\n <div class=\"DiscountBadge\">-{calculateDiscount(this.price, this.salePrice)}%</div> : null}\n\n <a href={this.link}>\n <figure class={`Images ${hasImageOnHover} ${enableZoomClass}`}>\n {this.img && <img class=\"Images__Front\" src={this.img} alt={this.imgAlt}></img> }\n \n </figure>\n </a>\n </div>\n\n <div class={`Content ${backgroundClass} ${iconOnlyClass} ${miniCard} ${verticalCardClass}`}>\n <div class={`Body ${backgroundClass} ${iconOnlyClass} ${miniCard} ${verticalCardClass}`}>\n <div class=\"Body__Top\">\n <div class=\"Info\">\n <a href={this.link} class=\"Product\">{this.productName}</a>\n {this.subtitle ? <div class=\"Subtitle\" onClick={() => this.goToProduct()}>{this.subtitle}</div> : null}\n </div>\n\n {this.price ?\n <div class={`Price ${miniCard}`}>\n <div class={`Price__Regular ${this.salePrice && this.salePrice < this.price ? 'sale' : ''}`}>\n {this.currency}{this.priceFormatted}\n </div>\n \n {this.salePrice && this.salePrice < this.price ?\n <div class=\"Price__Sale\">{this.currency}{this.salePriceFormatted}</div>\n : null}\n </div>\n : null}\n \n {this.outOfStock ?\n <div class=\"OutOfStock\">{this.outOfStockText ? this.outOfStockText : 'Esaurito'}</div> : <div class=\"AvailableStock\">{this.availableText ? this.availableText : 'Disponibile'}</div>}\n\n </div>\n </div>\n\n \n </div>\n </Host>\n );\n }\n\n}"]}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { generateAttributesFromArgs, formatHtml } from "../../utils/utils";
|
|
2
|
+
export default {
|
|
3
|
+
title: 'Components/CardEcommerce/CardShowcase',
|
|
4
|
+
tags: ['autodocs'],
|
|
5
|
+
argTypes: {
|
|
6
|
+
verticalCard: {
|
|
7
|
+
name: 'vertical-card',
|
|
8
|
+
description: 'Mostra la card in modalità verticale',
|
|
9
|
+
control: 'boolean',
|
|
10
|
+
defaultValue: false,
|
|
11
|
+
},
|
|
12
|
+
badge: {
|
|
13
|
+
name: 'badge',
|
|
14
|
+
description: 'Badge della card',
|
|
15
|
+
control: 'text',
|
|
16
|
+
},
|
|
17
|
+
link: {
|
|
18
|
+
name: 'link',
|
|
19
|
+
description: 'Link della card',
|
|
20
|
+
control: 'text',
|
|
21
|
+
},
|
|
22
|
+
img: {
|
|
23
|
+
name: 'img',
|
|
24
|
+
description: 'Url dell\'immagine da visualizzare, si attiva solo se non è presente video-src',
|
|
25
|
+
control: 'text',
|
|
26
|
+
defaultValue: 'https://content-management-files.canva.com/cdn-cgi/image/f=auto,q=70/2fdbd7ab-f378-4c63-8b21-c944ad2633fd/header_t-shirts2.jpg',
|
|
27
|
+
if: {
|
|
28
|
+
arg: 'videoSrc',
|
|
29
|
+
exists: false
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
imgAlt: {
|
|
33
|
+
name: 'img-alt',
|
|
34
|
+
description: 'Alt dell\'immagine da visualizzare, si attiva solo se è presente img',
|
|
35
|
+
control: 'text',
|
|
36
|
+
if: {
|
|
37
|
+
arg: 'img',
|
|
38
|
+
exists: true
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
hoverImg: {
|
|
42
|
+
name: 'hover-img',
|
|
43
|
+
description: 'Url dell\'immagine in hover da visualizzare, si attiva solo se non è presente videoSrc',
|
|
44
|
+
control: 'text',
|
|
45
|
+
defaultValue: 'https://ch.benetton.com/dw/image/v2/BBSF_PRD/on/demandware.static/-/Sites-ucb-master/default/dwf2799586/images/Full_Card_v/UCB-Bambino_24P_3096C10JA_0Z3_FS_Full_Card_v.jpg?sw=600&sh=800',
|
|
46
|
+
if: {
|
|
47
|
+
arg: 'videoSrc',
|
|
48
|
+
exists: false
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
productName: {
|
|
52
|
+
name: 'product-name',
|
|
53
|
+
description: 'Nome del prodotto',
|
|
54
|
+
control: 'text',
|
|
55
|
+
},
|
|
56
|
+
subtitle: {
|
|
57
|
+
name: 'subtitle',
|
|
58
|
+
description: 'Sottotitolo della card',
|
|
59
|
+
control: 'text',
|
|
60
|
+
},
|
|
61
|
+
productId: {
|
|
62
|
+
name: 'product-id',
|
|
63
|
+
description: 'ID del prodotto',
|
|
64
|
+
control: 'text',
|
|
65
|
+
},
|
|
66
|
+
price: {
|
|
67
|
+
name: 'price',
|
|
68
|
+
description: 'Prezzo del prodotto; Se la card è in versione Mini gli va passato il prezzo scontato',
|
|
69
|
+
control: 'number',
|
|
70
|
+
},
|
|
71
|
+
salePrice: {
|
|
72
|
+
name: 'sale-price',
|
|
73
|
+
description: 'Prezzo scontato del prodotto',
|
|
74
|
+
control: 'number',
|
|
75
|
+
},
|
|
76
|
+
hideDiscountIfLessThreshold: {
|
|
77
|
+
name: 'hide-discount-if-less-threshold',
|
|
78
|
+
description: 'Indicates the threshold below which the discount will be hidden',
|
|
79
|
+
control: 'number'
|
|
80
|
+
},
|
|
81
|
+
badgeColor: {
|
|
82
|
+
name: 'badge-color',
|
|
83
|
+
description: 'Colore del badge',
|
|
84
|
+
control: 'select',
|
|
85
|
+
options: [
|
|
86
|
+
'primary',
|
|
87
|
+
'secondary',
|
|
88
|
+
'neutral',
|
|
89
|
+
'warning',
|
|
90
|
+
'success',
|
|
91
|
+
'danger',
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
outOfStock: {
|
|
95
|
+
name: 'out-of-stock',
|
|
96
|
+
description: 'Indica se il prodotto è esaurito',
|
|
97
|
+
control: 'boolean',
|
|
98
|
+
defaultValue: false
|
|
99
|
+
},
|
|
100
|
+
outOfStockText: {
|
|
101
|
+
name: 'out-of-stock-text',
|
|
102
|
+
description: 'Testo da visualizzare se il prodotto è esaurito',
|
|
103
|
+
control: 'text',
|
|
104
|
+
},
|
|
105
|
+
availableText: {
|
|
106
|
+
name: 'available-text',
|
|
107
|
+
description: 'Testo da visualizzare se il prodotto è disponibile',
|
|
108
|
+
control: 'text',
|
|
109
|
+
},
|
|
110
|
+
imageObjectFit: {
|
|
111
|
+
name: 'image-object-fit',
|
|
112
|
+
description: 'Controlla il comportamento dell\'object-fit delle immagini',
|
|
113
|
+
control: 'select',
|
|
114
|
+
options: ['cover', 'scale-down', 'contain', 'fill', 'none'],
|
|
115
|
+
defaultValue: 'cover'
|
|
116
|
+
},
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
const Template = (args) => {
|
|
120
|
+
const attributes = generateAttributesFromArgs(args);
|
|
121
|
+
return formatHtml(`
|
|
122
|
+
<jump-card-ecommerce-showcase ${attributes}>
|
|
123
|
+
</jump-card-ecommerce-showcase>
|
|
124
|
+
`);
|
|
125
|
+
};
|
|
126
|
+
export const Card = Template.bind({});
|
|
127
|
+
Card.args = {
|
|
128
|
+
badge: 'In offerta',
|
|
129
|
+
link: '/prodotto',
|
|
130
|
+
img: 'https://images.pexels.com/photos/4066293/pexels-photo-4066293.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1',
|
|
131
|
+
imgAlt: 'Immagine',
|
|
132
|
+
productName: 'T-shirt',
|
|
133
|
+
subtitle: 'T-shirt da uomo',
|
|
134
|
+
productId: '1',
|
|
135
|
+
price: 15,
|
|
136
|
+
salePrice: 10,
|
|
137
|
+
hideDiscountIfLessThreshold: 10,
|
|
138
|
+
badgeColor: 'secondary',
|
|
139
|
+
currency: '€',
|
|
140
|
+
outOfStock: false,
|
|
141
|
+
outOfStockText: 'Esaurito',
|
|
142
|
+
availableText: 'Disponibile',
|
|
143
|
+
};
|
|
144
|
+
//# sourceMappingURL=jump-card-ecommerce-showcase.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jump-card-ecommerce-showcase.stories.js","sourceRoot":"","sources":["../../../src/components/jump-card-ecommerce-showcase/jump-card-ecommerce-showcase.stories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAE1E,eAAe;IACb,KAAK,EAAE,uCAAuC;IAC9C,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,QAAQ,EAAE;QACR,YAAY,EAAE;YACZ,IAAI,EAAE,eAAe;YACrB,WAAW,EAAE,sCAAsC;YACnD,OAAO,EAAE,SAAS;YAClB,YAAY,EAAE,KAAK;SACpB;QACD,KAAK,EAAE;YACL,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,kBAAkB;YAC/B,OAAO,EAAE,MAAM;SAChB;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,iBAAiB;YAC9B,OAAO,EAAE,MAAM;SAChB;QACD,GAAG,EAAE;YACH,IAAI,EAAE,KAAK;YACX,WAAW,EAAE,gFAAgF;YAC7F,OAAO,EAAE,MAAM;YACf,YAAY,EAAE,gIAAgI;YAC9I,EAAE,EAAC;gBACD,GAAG,EAAE,UAAU;gBACf,MAAM,EAAE,KAAK;aACd;SACF;QACD,MAAM,EAAE;YACN,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,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AI,EAAE,mBAAmB;YACzB,WAAW,EAAE,iDAAiD;YAC9D,OAAO,EAAE,MAAM;SAChB;QACD,aAAa,EAAE;YACb,IAAI,EAAE,gBAAgB;YACtB,WAAW,EAAE,oDAAoD;YACjE,OAAO,EAAE,MAAM;SAChB;QACD,cAAc,EAAE;YACd,IAAI,EAAE,kBAAkB;YACxB,WAAW,EAAE,4DAA4D;YACzE,OAAO,EAAE,QAAQ;YACjB,OAAO,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC;YAC3D,YAAY,EAAE,OAAO;SACtB;KACF;CACF,CAAC;AAEF,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,EAAE;IACxB,MAAM,UAAU,GAAG,0BAA0B,CAAC,IAAI,CAAC,CAAC;IACpD,OAAO,UAAU,CAAC;kCACc,UAAU;;GAEzC,CAAC,CAAC;AACL,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACtC,IAAI,CAAC,IAAI,GAAG;IACV,KAAK,EAAE,YAAY;IACnB,IAAI,EAAE,WAAW;IACjB,GAAG,EAAE,iHAAiH;IACtH,MAAM,EAAE,UAAU;IAClB,WAAW,EAAE,SAAS;IACtB,QAAQ,EAAE,iBAAiB;IAC3B,SAAS,EAAE,GAAG;IACd,KAAK,EAAE,EAAE;IACT,SAAS,EAAE,EAAE;IACb,2BAA2B,EAAE,EAAE;IAC/B,UAAU,EAAE,WAAW;IACvB,QAAQ,EAAE,GAAG;IACb,UAAU,EAAE,KAAK;IACjB,cAAc,EAAE,UAAU;IAC1B,aAAa,EAAE,aAAa;CAC7B,CAAC","sourcesContent":["import { generateAttributesFromArgs, formatHtml} from '../../utils/utils';\n\nexport default {\n title: 'Components/CardEcommerce/CardShowcase',\n tags: ['autodocs'],\n argTypes: {\n verticalCard: {\n name: 'vertical-card',\n description: 'Mostra la card in modalità verticale',\n control: 'boolean',\n defaultValue: false,\n },\n badge: {\n name: 'badge',\n description: 'Badge della card',\n control: 'text',\n },\n link: {\n name: 'link',\n description: 'Link della card',\n control: 'text',\n },\n img: {\n name: 'img',\n description: 'Url dell\\'immagine da visualizzare, si attiva solo se non è presente video-src',\n control: 'text',\n defaultValue: 'https://content-management-files.canva.com/cdn-cgi/image/f=auto,q=70/2fdbd7ab-f378-4c63-8b21-c944ad2633fd/header_t-shirts2.jpg',\n if:{\n arg: 'videoSrc',\n exists: false\n }\n },\n imgAlt: {\n name: 'img-alt',\n description: 'Alt dell\\'immagine da visualizzare, si attiva solo se è presente img',\n control: 'text',\n if:{\n arg: 'img',\n exists: true\n }\n },\n hoverImg: {\n name: 'hover-img',\n description: 'Url dell\\'immagine in hover da visualizzare, si attiva solo se non è presente videoSrc',\n control: 'text',\n defaultValue: 'https://ch.benetton.com/dw/image/v2/BBSF_PRD/on/demandware.static/-/Sites-ucb-master/default/dwf2799586/images/Full_Card_v/UCB-Bambino_24P_3096C10JA_0Z3_FS_Full_Card_v.jpg?sw=600&sh=800',\n if:{\n arg: 'videoSrc',\n exists: false\n }\n },\n \n \n productName: {\n name: 'product-name',\n description: 'Nome del prodotto',\n control: 'text',\n },\n subtitle: {\n name: 'subtitle',\n description: 'Sottotitolo della card',\n control: 'text',\n },\n productId: {\n name: 'product-id',\n description: 'ID del prodotto',\n control: 'text',\n },\n price: {\n name: 'price',\n description: 'Prezzo del prodotto; Se la card è in versione Mini gli va passato il prezzo scontato',\n control: 'number',\n },\n salePrice: {\n name: 'sale-price',\n description: 'Prezzo scontato del prodotto',\n control: 'number',\n },\n hideDiscountIfLessThreshold: {\n name: 'hide-discount-if-less-threshold',\n description: 'Indicates the threshold below which the discount will be hidden',\n control: 'number'\n },\n badgeColor: {\n name: 'badge-color',\n description: 'Colore del badge',\n control: 'select',\n options: [\n 'primary',\n 'secondary',\n 'neutral',\n 'warning',\n 'success',\n 'danger',\n ],\n },\n outOfStock: {\n name: 'out-of-stock',\n description: 'Indica se il prodotto è esaurito',\n control: 'boolean',\n defaultValue: false\n },\n outOfStockText: {\n name: 'out-of-stock-text',\n description: 'Testo da visualizzare se il prodotto è esaurito',\n control: 'text',\n },\n availableText: {\n name: 'available-text',\n description: 'Testo da visualizzare se il prodotto è disponibile',\n control: 'text',\n },\n imageObjectFit: {\n name: 'image-object-fit',\n description: 'Controlla il comportamento dell\\'object-fit delle immagini',\n control: 'select',\n options: ['cover', 'scale-down', 'contain', 'fill', 'none'],\n defaultValue: 'cover'\n },\n }\n};\n\nconst Template = (args) => {\n const attributes = generateAttributesFromArgs(args);\n return formatHtml(`\n <jump-card-ecommerce-showcase ${attributes}>\n </jump-card-ecommerce-showcase>\n `);\n}\n\nexport const Card = Template.bind({});\nCard.args = {\n badge: 'In offerta',\n link: '/prodotto',\n img: 'https://images.pexels.com/photos/4066293/pexels-photo-4066293.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1',\n imgAlt: 'Immagine',\n productName: 'T-shirt',\n subtitle: 'T-shirt da uomo',\n productId: '1',\n price: 15,\n salePrice: 10,\n hideDiscountIfLessThreshold: 10,\n badgeColor: 'secondary',\n currency: '€',\n outOfStock: false,\n outOfStockText: 'Esaurito',\n availableText: 'Disponibile',\n};"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface JumpCardEcommerceShowcase extends Components.JumpCardEcommerceShowcase, HTMLElement {}
|
|
4
|
+
export const JumpCardEcommerceShowcase: {
|
|
5
|
+
prototype: JumpCardEcommerceShowcase;
|
|
6
|
+
new (): JumpCardEcommerceShowcase;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|