@florid-kit/components 4.1.4 → 4.1.6

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.
@@ -1,11 +1,11 @@
1
1
  import { i as p, m as c, a as h, x as f, t as m } from "../performance-mixin-D7YmSeqN.mjs";
2
2
  import { n as d } from "../property-S_Y9cb04.mjs";
3
- import { f as g } from "../css-C8WrrxT-.mjs";
3
+ import { f as b } from "../css-C8WrrxT-.mjs";
4
4
  import "./icon-button.mjs";
5
- var u = Object.defineProperty, b = Object.getOwnPropertyDescriptor, i = (a, o, s, n) => {
6
- for (var e = n > 1 ? void 0 : n ? b(o, s) : o, r = a.length - 1, l; r >= 0; r--)
7
- (l = a[r]) && (e = (n ? l(o, s, e) : l(e)) || e);
8
- return n && e && u(o, s, e), e;
5
+ var g = Object.defineProperty, u = Object.getOwnPropertyDescriptor, n = (a, i, s, o) => {
6
+ for (var e = o > 1 ? void 0 : o ? u(i, s) : i, r = a.length - 1, l; r >= 0; r--)
7
+ (l = a[r]) && (e = (o ? l(i, s, e) : l(e)) || e);
8
+ return o && e && g(i, s, e), e;
9
9
  };
10
10
  let y = 0, t = class extends c(h) {
11
11
  constructor() {
@@ -79,7 +79,7 @@ t.styles = p`
79
79
  }
80
80
 
81
81
  .header:focus-visible {
82
- ${g};
82
+ ${b};
83
83
  }
84
84
 
85
85
  :host([disabled]) .header {
@@ -140,13 +140,15 @@ t.styles = p`
140
140
  .panel {
141
141
  display: grid;
142
142
  grid-template-rows: 0fr;
143
- transition: grid-template-rows 220ms ease, opacity 220ms ease;
143
+ transition: grid-template-rows 220ms ease, opacity 220ms ease, visibility 220ms ease;
144
144
  opacity: 0;
145
+ visibility: hidden;
145
146
  }
146
147
 
147
148
  :host([expanded]) .panel {
148
149
  grid-template-rows: 1fr;
149
150
  opacity: 1;
151
+ visibility: visible;
150
152
  }
151
153
 
152
154
  .panel-inner {
@@ -169,16 +171,16 @@ t.styles = p`
169
171
  padding-bottom: var(--spacing-3-xl);
170
172
  }
171
173
  `;
172
- i([
174
+ n([
173
175
  d({ type: String })
174
176
  ], t.prototype, "label", 2);
175
- i([
177
+ n([
176
178
  d({ type: Boolean, reflect: !0 })
177
179
  ], t.prototype, "expanded", 2);
178
- i([
180
+ n([
179
181
  d({ type: Boolean, reflect: !0 })
180
182
  ], t.prototype, "disabled", 2);
181
- t = i([
183
+ t = n([
182
184
  m("o-accordion")
183
185
  ], t);
184
186
  export {
@@ -1,14 +1,14 @@
1
- import { m as p, a as b, i as u, x as o, E as l, t as f } from "../performance-mixin-D7YmSeqN.mjs";
1
+ import { m as p, a as b, i as u, x as r, E as l, t as f } from "../performance-mixin-D7YmSeqN.mjs";
2
2
  import { n as i } from "../property-S_Y9cb04.mjs";
3
3
  import { f as g } from "../css-C8WrrxT-.mjs";
4
4
  import { m as v } from "../element-internals-Dw7LndlH.mjs";
5
5
  import { i as m } from "../icons-registry.mjs";
6
6
  import { o as y } from "../unsafe-svg-BipL_msF.mjs";
7
- import "./icon-button.mjs";
8
- var x = Object.defineProperty, k = Object.getOwnPropertyDescriptor, r = (t, n, a, c) => {
9
- for (var s = c > 1 ? void 0 : c ? k(n, a) : n, d = t.length - 1, h; d >= 0; d--)
10
- (h = t[d]) && (s = (c ? h(n, a, s) : h(s)) || s);
11
- return c && s && x(n, a, s), s;
7
+ import "../icon-CAvOSN1L.mjs";
8
+ var x = Object.defineProperty, k = Object.getOwnPropertyDescriptor, o = (t, s, a, c) => {
9
+ for (var n = c > 1 ? void 0 : c ? k(s, a) : s, d = t.length - 1, h; d >= 0; d--)
10
+ (h = t[d]) && (n = (c ? h(s, a, n) : h(n)) || n);
11
+ return c && n && x(s, a, n), n;
12
12
  };
13
13
  const $ = p(v(b));
14
14
  let e = class extends $ {
@@ -19,11 +19,11 @@ let e = class extends $ {
19
19
  if (t instanceof KeyboardEvent && t.key !== "Enter" && t.key !== " ")
20
20
  return;
21
21
  this.selected = !this.selected;
22
- const n = { selected: this.selected }, a = new CustomEvent("selected", { detail: n, bubbles: !0, composed: !0, cancelable: !0 });
23
- this.dispatchEvent(a), a.defaultPrevented && t.preventDefault(), this.selected = n.selected;
22
+ const s = { selected: this.selected }, a = new CustomEvent("selected", { detail: s, bubbles: !0, composed: !0, cancelable: !0 });
23
+ this.dispatchEvent(a), a.defaultPrevented && t.preventDefault(), this.selected = s.selected;
24
24
  }
25
25
  crossIcon() {
26
- return o`<o-icon-button size="small" icon="occ-close-outlined" bgstyle="none-light"></o-icon-button>`;
26
+ return r`<o-icon size="small" icon="occ-close-outlined" bgstyle="none-light"></o-icon>`;
27
27
  }
28
28
  strikeThroughImg() {
29
29
  const t = m[this.strikethroughImgName].replace(
@@ -34,21 +34,21 @@ let e = class extends $ {
34
34
  }
35
35
  render() {
36
36
  const t = this.text;
37
- return o`${this.type === "link" ? o`
37
+ return r`${this.type === "link" ? r`
38
38
  <a role="button" tabindex="0" class="button" href=${this.href} ?disabled=${this.disabled} @click=${this.handleClick} @keydown=${this.handleClick}
39
39
  aria-label=${this.ariaLabel || l} aria-pressed=${this.selected}>
40
- ${t ? o`
41
- ${this.text ? o`<span class="text">${this.text}</span>` : l}
42
- ` : o`
40
+ ${t ? r`
41
+ ${this.text ? r`<span class="text">${this.text}</span>` : l}
42
+ ` : r`
43
43
  <span class="text"><slot></slot></span>`}
44
44
  ${this.selected ? this.crossIcon() : l}
45
45
  </a>
46
- ` : o`
46
+ ` : r`
47
47
  <button type="button" class="button" ?disabled=${this.disabled} @click=${this.handleClick}
48
48
  aria-label=${this.ariaLabel} aria-pressed=${this.selected}>
49
- ${t ? o`
50
- ${this.text ? o`<span class="text">${this.text}</span>` : l}
51
- ` : o`
49
+ ${t ? r`
50
+ ${this.text ? r`<span class="text">${this.text}</span>` : l}
51
+ ` : r`
52
52
  <span class="text"><slot></slot></span>`}
53
53
  ${this.selected ? this.crossIcon() : l}
54
54
  </button>
@@ -182,40 +182,35 @@ e.styles = u`
182
182
  stroke-width: 4px;
183
183
  stroke-linecap: round;
184
184
  }
185
-
186
- o-icon-button::part(icon-button) {
187
- padding-left: 0;
188
- padding-right: 0;
189
- }
190
185
  `;
191
- r([
186
+ o([
192
187
  i({ reflect: !0 })
193
188
  ], e.prototype, "name", 2);
194
- r([
189
+ o([
195
190
  i({ reflect: !0 })
196
191
  ], e.prototype, "value", 2);
197
- r([
192
+ o([
198
193
  i({ type: String, reflect: !0 })
199
194
  ], e.prototype, "type", 2);
200
- r([
195
+ o([
201
196
  i({ type: String, reflect: !0 })
202
197
  ], e.prototype, "href", 2);
203
- r([
198
+ o([
204
199
  i({ type: String, reflect: !0, attribute: "data-href" })
205
200
  ], e.prototype, "dataHref", 2);
206
- r([
201
+ o([
207
202
  i({ type: String })
208
203
  ], e.prototype, "text", 2);
209
- r([
204
+ o([
210
205
  i({ type: Boolean, reflect: !0 })
211
206
  ], e.prototype, "selected", 2);
212
- r([
207
+ o([
213
208
  i({ type: Boolean, reflect: !0 })
214
209
  ], e.prototype, "disabled", 2);
215
- r([
210
+ o([
216
211
  i({ type: Boolean, reflect: !0 })
217
212
  ], e.prototype, "fullwidth", 2);
218
- e = r([
213
+ e = o([
219
214
  f("o-filter-chip")
220
215
  ], e);
221
216
  export {
@@ -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.6";
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.6";
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.6",
4
4
  "main": "index.js",
5
5
  "module": "index.mjs",
6
6
  "typings": "index.d.ts",