@florid-kit/components 4.1.4 → 4.1.5

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.
@@ -7,6 +7,8 @@ export declare class MiniTile extends MiniTile_base {
7
7
  volume: string;
8
8
  perLiter: string;
9
9
  mainPrice: string;
10
+ salesPercentage: string;
11
+ oldPrice: string;
10
12
  imageUrl: string;
11
13
  altImage: string;
12
14
  fullwidth: boolean;
@@ -19,6 +21,7 @@ export declare class MiniTile extends MiniTile_base {
19
21
  private onClick;
20
22
  private onClickIcons;
21
23
  get icons(): import('lit').TemplateResult<1>;
24
+ get discountInfo(): "" | import('lit').TemplateResult<1>;
22
25
  static styles: import('lit').CSSResult;
23
26
  render(): import('lit').TemplateResult<1>;
24
27
  }
@@ -1,27 +1,27 @@
1
- import { m as d, a as f, x as t, i as g } from "../performance-mixin-D7YmSeqN.mjs";
1
+ import { m as d, a as g, x as t, i as f } from "../performance-mixin-D7YmSeqN.mjs";
2
2
  import { n as e } from "../property-S_Y9cb04.mjs";
3
3
  import "./icon-button.mjs";
4
4
  import "./tag.mjs";
5
- var u = Object.defineProperty, o = (p, r, s, l) => {
6
- for (var a = void 0, n = p.length - 1, h; n >= 0; n--)
7
- (h = p[n]) && (a = h(r, s, a) || a);
8
- return a && u(r, s, a), a;
5
+ var u = Object.defineProperty, o = (p, a, s, l) => {
6
+ for (var n = void 0, r = p.length - 1, h; r >= 0; r--)
7
+ (h = p[r]) && (n = h(a, s, n) || n);
8
+ return n && u(a, s, n), n;
9
9
  };
10
- const c = class c extends d(f) {
10
+ const c = class c extends d(g) {
11
11
  constructor() {
12
- super(...arguments), this.type = "cart | chevron", this.titleProduct = "", this.volume = "", this.perLiter = "", this.mainPrice = "", this.imageUrl = "https://placehold.co/56x70", this.altImage = "", this.fullwidth = !1, this.tagText = "", this.outOfStock = !1, this.productUrl = "", this.highlight = !1;
12
+ super(...arguments), this.type = "cart | chevron", this.titleProduct = "", this.volume = "", this.perLiter = "", this.mainPrice = "", this.salesPercentage = "", this.oldPrice = "", this.imageUrl = "https://placehold.co/56x70", this.altImage = "", this.fullwidth = !1, this.tagText = "", this.outOfStock = !1, this.productUrl = "", this.highlight = !1;
13
13
  }
14
- onClick(r) {
15
- var l, a, n;
16
- const s = r.target;
17
- (l = s == null ? void 0 : s.classList) != null && l.contains("add-to-bag") || (a = s == null ? void 0 : s.classList) != null && a.contains("js-availability-notify-details-cart") || ((n = this.onClickTile) == null || n.call(this), this.dispatchEvent(
14
+ onClick(a) {
15
+ var l, n, r;
16
+ const s = a.target;
17
+ (l = s == null ? void 0 : s.classList) != null && l.contains("add-to-bag") || (n = s == null ? void 0 : s.classList) != null && n.contains("js-availability-notify-details-cart") || ((r = this.onClickTile) == null || r.call(this), this.dispatchEvent(
18
18
  new CustomEvent("tile-click", { bubbles: !0, composed: !0 })
19
19
  ));
20
20
  }
21
- onClickIcons(r) {
21
+ onClickIcons(a) {
22
22
  var s;
23
23
  (s = this.onClickIcon) == null || s.call(this), this.dispatchEvent(
24
- new CustomEvent("tile-icon-click", { bubbles: !0, composed: !0, detail: { event: r } })
24
+ new CustomEvent("tile-icon-click", { bubbles: !0, composed: !0, detail: { event: a } })
25
25
  );
26
26
  }
27
27
  get icons() {
@@ -53,6 +53,19 @@ const c = class c extends d(f) {
53
53
  ></o-icon-button>
54
54
  `;
55
55
  }
56
+ get discountInfo() {
57
+ if (this.type !== "cart" || !this.oldPrice || this.oldPrice.trim() === this.mainPrice.trim())
58
+ return "";
59
+ const a = (window.Resources || {}).CART_OLD_PRICE;
60
+ return t`
61
+ <span class="discount-info">
62
+ ${this.salesPercentage ? t`<o-tag bgstyle="background-emphasis">${this.salesPercentage}</o-tag>` : ""}
63
+ <s class="old-price">
64
+ ${a ? t`<span class="visually-hidden">${a}</span>` : ""}${this.oldPrice}
65
+ </s>
66
+ </span>
67
+ `;
68
+ }
56
69
  render() {
57
70
  return "productUrl" in this.dataset && this.dataset.productUrl && (this.productUrl = this.dataset.productUrl), this.type !== "chevron" && this.productUrl !== "" ? t`
58
71
  <div class="tile fullpointer ${this.fullwidth ? "fullwidth" : ""}">
@@ -66,6 +79,7 @@ const c = class c extends d(f) {
66
79
  >${this.tagText}</o-tag
67
80
  >` : this.tagText ? t`<o-tag bgstyle="background-emphasis">${this.tagText}</o-tag>` : ""}
68
81
  ${this.titleProduct ? t`<span class="title">${this.titleProduct}</span>` : ""}
82
+ ${this.discountInfo}
69
83
  <span class="details">
70
84
  ${this.volume ? t`<span class="volume-info">${this.volume}</span>` : ""}
71
85
  ${this.type === "cart" && this.mainPrice ? t`<span class="main-price">${this.mainPrice}</span>` : ""}
@@ -88,6 +102,7 @@ const c = class c extends d(f) {
88
102
  >${this.tagText}</o-tag
89
103
  >` : this.tagText ? t`<o-tag bgstyle="background-emphasis">${this.tagText}</o-tag>` : ""}
90
104
  ${this.titleProduct ? t`<div class="title">${this.titleProduct}</div>` : ""}
105
+ ${this.discountInfo}
91
106
  <div class="details">
92
107
  ${this.volume ? t`<span class="volume-info">${this.volume}</span>` : ""}
93
108
  ${this.type === "cart" && this.mainPrice ? t`<span class="main-price">${this.mainPrice}</span>` : ""}
@@ -99,7 +114,7 @@ const c = class c extends d(f) {
99
114
  `;
100
115
  }
101
116
  };
102
- c.styles = g`
117
+ c.styles = f`
103
118
  :host {
104
119
  display: block;
105
120
  max-width: 100%;
@@ -120,7 +135,7 @@ c.styles = g`
120
135
  background: var(--color-container-bg-white);
121
136
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
122
137
  font-family: var(--font-family-loccitane-sans);
123
- height: 78px;
138
+ min-height: 78px;
124
139
  width: 368px;
125
140
  max-width: 368px;
126
141
  padding: var(--spacing-2-xs) var(--spacing-s) var(--spacing-2-xs)
@@ -169,7 +184,8 @@ c.styles = g`
169
184
  -webkit-box-orient: vertical;
170
185
  }
171
186
 
172
- .info .title + .details {
187
+ .info .title + .details,
188
+ .info .discount-info + .details {
173
189
  padding-top: var(--spacing-s);
174
190
  overflow: hidden;
175
191
  text-overflow: ellipsis;
@@ -204,6 +220,47 @@ c.styles = g`
204
220
  display: flex;
205
221
  }
206
222
 
223
+ .info .title + .discount-info {
224
+ padding-top: var(--spacing-s);
225
+ }
226
+
227
+ .info .discount-info {
228
+ display: flex;
229
+ align-items: center;
230
+ column-gap: var(--spacing-xs);
231
+ }
232
+
233
+ .info .discount-info + .details {
234
+ padding-top: var(--spacing-xs);
235
+ }
236
+
237
+ .info .discount-info o-tag {
238
+ margin-bottom: 0;
239
+ }
240
+
241
+ .old-price {
242
+ color: var(--color-content-description);
243
+ font-family: var(--font-family-loccitane-sans);
244
+ font-size: var(--font-size-100);
245
+ font-weight: var(--font-weight-400);
246
+ line-height: var(--line-height-160);
247
+ letter-spacing: var(--letter-spacing-000);
248
+ text-decoration-line: line-through;
249
+ white-space: nowrap;
250
+ }
251
+
252
+ .visually-hidden {
253
+ position: absolute;
254
+ width: 1px;
255
+ height: 1px;
256
+ padding: 0;
257
+ margin: -1px;
258
+ overflow: hidden;
259
+ clip: rect(0, 0, 0, 0);
260
+ white-space: nowrap;
261
+ border: 0;
262
+ }
263
+
207
264
  .main-price {
208
265
  font-family: var(--font-family-loccitane-sans);
209
266
  color: var(--colors-noir-des-terres-500);
@@ -239,6 +296,12 @@ o([
239
296
  o([
240
297
  e({ type: String })
241
298
  ], i.prototype, "mainPrice");
299
+ o([
300
+ e({ type: String })
301
+ ], i.prototype, "salesPercentage");
302
+ o([
303
+ e({ type: String })
304
+ ], i.prototype, "oldPrice");
242
305
  o([
243
306
  e({ type: String })
244
307
  ], i.prototype, "imageUrl");
package/index.mjs CHANGED
@@ -39,4 +39,4 @@ import "./components/search-input-dropdown.mjs";
39
39
  import "./components/option-tile.mjs";
40
40
  import "./components/option-tile-group.mjs";
41
41
  import "./components/content-push.mjs";
42
- globalThis.__FLORID_KIT__ = "4.1.4";
42
+ globalThis.__FLORID_KIT__ = "4.1.5";
package/loader.mjs CHANGED
@@ -4,7 +4,7 @@ import "./components/link.mjs";
4
4
  import "./components/header-simplify.mjs";
5
5
  import "./components/breadcrumb.mjs";
6
6
  import "./components/breadcrumbs.mjs";
7
- globalThis.__FLORID_KIT__ = "4.1.4";
7
+ globalThis.__FLORID_KIT__ = "4.1.5";
8
8
  const i = {
9
9
  "o-accordion": () => import("./components/accordion.mjs"),
10
10
  "o-accordion-group": () => import("./components/accordion-group.mjs"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@florid-kit/components",
3
- "version": "4.1.4",
3
+ "version": "4.1.5",
4
4
  "main": "index.js",
5
5
  "module": "index.mjs",
6
6
  "typings": "index.d.ts",