@florid-kit/components 3.2.5 → 3.2.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,12 @@
1
1
  import { i as h, m as f, a as d, x as s, t as v } from "../performance-mixin-D7YmSeqN.mjs";
2
2
  import { n } from "../property-S_Y9cb04.mjs";
3
3
  import { o as u } from "../if-defined-j0wE2gL4.mjs";
4
+ import { f as g } from "../css-C8WrrxT-.mjs";
4
5
  import "./icon-button.mjs";
5
- var g = Object.defineProperty, y = Object.getOwnPropertyDescriptor, t = (i, r, l, a) => {
6
+ var m = Object.defineProperty, y = Object.getOwnPropertyDescriptor, t = (i, r, l, a) => {
6
7
  for (var o = a > 1 ? void 0 : a ? y(r, l) : r, c = i.length - 1, p; c >= 0; c--)
7
8
  (p = i[c]) && (o = (a ? p(r, l, o) : p(o)) || o);
8
- return a && o && g(r, l, o), o;
9
+ return a && o && m(r, l, o), o;
9
10
  };
10
11
  let e = class extends f(d) {
11
12
  constructor() {
@@ -129,6 +130,10 @@ e.styles = h`
129
130
  color: inherit;
130
131
  }
131
132
 
133
+ .link-wrapper:focus-visible {
134
+ ${g};
135
+ }
136
+
132
137
  .link-text {
133
138
  display: inline;
134
139
  text-decoration: underline;
@@ -22,6 +22,8 @@ export declare class MediumTile extends MediumTile_base {
22
22
  onClickIcon?: () => void;
23
23
  private onClick;
24
24
  private onClickIcons;
25
+ get iconLabel(): string;
26
+ get tileLabel(): string;
25
27
  get icons(): "" | import('lit').TemplateResult<1>;
26
28
  static styles: import('lit').CSSResult;
27
29
  render(): import('lit').TemplateResult<1>;
@@ -1,63 +1,84 @@
1
- import { i as f, m as h, a as d, x as n, t as g } from "../performance-mixin-D7YmSeqN.mjs";
1
+ import { i as h, m as f, a as d, x as a, t as g } from "../performance-mixin-D7YmSeqN.mjs";
2
2
  import { n as i } from "../property-S_Y9cb04.mjs";
3
3
  import "./icon-button.mjs";
4
4
  import "./tag.mjs";
5
- var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, e = (r, o, l, s) => {
6
- for (var a = s > 1 ? void 0 : s ? y(o, l) : o, c = r.length - 1, p; c >= 0; c--)
7
- (p = r[c]) && (a = (s ? p(o, l, a) : p(a)) || a);
8
- return s && a && v(o, l, a), a;
5
+ var u = Object.defineProperty, v = Object.getOwnPropertyDescriptor, e = (n, o, l, s) => {
6
+ for (var r = s > 1 ? void 0 : s ? v(o, l) : o, c = n.length - 1, p; c >= 0; c--)
7
+ (p = n[c]) && (r = (s ? p(o, l, r) : p(r)) || r);
8
+ return s && r && u(o, l, r), r;
9
9
  };
10
- let t = class extends h(d) {
10
+ let t = class extends f(d) {
11
11
  constructor() {
12
12
  super(...arguments), this.type = "cart | notifyme", this.titleProduct = "", this.descriptionProduct = "", this.volume = "", this.perLiter = "", this.mainPrice = "", this.salesPercentage = "", this.oldPrice = "", this.imageUrl = "https://placehold.co/112x140", this.outOfStock = !1, this.outOfStockText = "Out of stock", this.altImage = "", this.fullwidth = !1, this.current = !1, this.hideIcon = !1, this.tagText = "";
13
13
  }
14
- onClick(r) {
15
- var l, s, a;
16
- const o = r.target;
17
- (l = o == null ? void 0 : o.classList) != null && l.contains("add-to-bag") || (s = o == null ? void 0 : o.classList) != null && s.contains("js-availability-notify-details-routine") || ((a = this.onClickTile) == null || a.call(this), this.dispatchEvent(
14
+ onClick(n) {
15
+ var l, s, r;
16
+ const o = n.target;
17
+ (l = o == null ? void 0 : o.classList) != null && l.contains("add-to-bag") || (s = o == null ? void 0 : o.classList) != null && s.contains("js-availability-notify-details-routine") || ((r = this.onClickTile) == null || r.call(this), this.dispatchEvent(
18
18
  new CustomEvent("tile-click", { bubbles: !0, composed: !0 })
19
19
  ));
20
20
  }
21
21
  onClickIcons() {
22
- var r;
23
- (r = this.onClickIcon) == null || r.call(this), this.dispatchEvent(
22
+ var n;
23
+ (n = this.onClickIcon) == null || n.call(this), this.dispatchEvent(
24
24
  new CustomEvent("tile-icon-click", { bubbles: !0, composed: !0 })
25
25
  );
26
26
  }
27
+ // Accessible name for the add-to-bag / notify-me button, same shape as minitile's.
28
+ get iconLabel() {
29
+ const n = window.Resources || {};
30
+ return [this.type === "notifyme" ? n.NOSTOCK : n.ADD_TO_CART, this.titleProduct, this.volume].filter(Boolean).join(" - ");
31
+ }
32
+ // Accessible name for the tile action, same shape as minitile's title.
33
+ get tileLabel() {
34
+ return [
35
+ (window.Resources || {}).VIEW_PRODUCT,
36
+ this.titleProduct,
37
+ this.volume,
38
+ this.mainPrice
39
+ ].filter(Boolean).join(" - ");
40
+ }
27
41
  get icons() {
28
- return this.hideIcon ? "" : n`
42
+ return this.hideIcon ? "" : a`
29
43
  <o-icon-button
30
44
  @click=${this.onClickIcons}
31
45
  icon=${this.type === "notifyme" ? "notifyme" : "cart"}
32
46
  size="small"
33
47
  bgstyle="background-contrast"
34
- type="span"
48
+ type="button"
35
49
  status="empty"
36
50
  strokewidth="0"
37
51
  class=${this.type === "notifyme" ? "js-availability-notify-details-routine" : "add-to-bag"}
52
+ title="${this.iconLabel}"
53
+ srlabel="${this.iconLabel}"
54
+ ?showsrlabel=${!0}
38
55
  ></o-icon-button>
39
56
  `;
40
57
  }
41
58
  render() {
42
- return n`
43
- <button
44
- type="button"
59
+ return a`
60
+ <div
45
61
  class="tile fullpointer ${this.fullwidth ? "fullwidth" : ""} ${this.current ? "current" : ""}"
46
- @click=${this.onClick}
47
62
  >
48
- ${this.imageUrl ? n`<img src="${this.imageUrl}" alt="${this.altImage || ""}" />` : ""}
63
+ <button
64
+ type="button"
65
+ class="tile-action"
66
+ @click=${this.onClick}
67
+ title="${this.tileLabel}"
68
+ ></button>
69
+ ${this.imageUrl ? a`<img src="${this.imageUrl}" alt="${this.altImage || ""}" />` : ""}
49
70
  <div class="info">
50
- ${this.tagText ? n`<o-tag bgstyle="background-emphasis">${this.tagText}</o-tag>` : ""}
51
- ${this.outOfStock ? n`<o-tag type="nostock" role="status" aria-live="polite"
71
+ ${this.tagText ? a`<o-tag bgstyle="background-emphasis">${this.tagText}</o-tag>` : ""}
72
+ ${this.outOfStock ? a`<o-tag type="nostock" role="status" aria-live="polite"
52
73
  >${this.outOfStockText}</o-tag
53
74
  >` : ""}
54
75
  <div class="title-volume">
55
- ${this.titleProduct ? n`<div class="title">${this.titleProduct}</div>` : ""}
56
- ${this.volume ? n`<span class="volume-info">${this.volume}</span>` : ""}
76
+ ${this.titleProduct ? a`<div class="title">${this.titleProduct}</div>` : ""}
77
+ ${this.volume ? a`<span class="volume-info">${this.volume}</span>` : ""}
57
78
  </div>
58
- ${this.descriptionProduct ? n`<div class="description">${this.descriptionProduct}</div>` : ""}
79
+ ${this.descriptionProduct ? a`<div class="description">${this.descriptionProduct}</div>` : ""}
59
80
  <div class="details">
60
- ${this.salesPercentage && this.oldPrice ? n`<div class="discount-info">
81
+ ${this.salesPercentage && this.oldPrice ? a`<div class="discount-info">
61
82
  <o-tag bgstyle="background-emphasis"
62
83
  >${this.salesPercentage}</o-tag
63
84
  >
@@ -65,24 +86,25 @@ let t = class extends h(d) {
65
86
  </div>` : ""}
66
87
  <div class="price-details">
67
88
  <div class="price-info">
68
- ${this.mainPrice ? n`<span class="main-price">${this.mainPrice}</span>` : ""}
69
- ${this.perLiter ? n`<span class="per-liter">${this.perLiter}</span>` : ""}
89
+ ${this.mainPrice ? a`<span class="main-price">${this.mainPrice}</span>` : ""}
90
+ ${this.perLiter ? a`<span class="per-liter">${this.perLiter}</span>` : ""}
70
91
  </div>
71
92
  ${this.icons}
72
93
  </div>
73
94
  </div>
74
95
  </div>
75
- </button>
96
+ </div>
76
97
  `;
77
98
  }
78
99
  };
79
- t.styles = f`
100
+ t.styles = h`
80
101
  :host {
81
102
  display: block;
82
103
  max-width: 100%;
83
104
  }
84
105
 
85
106
  .tile {
107
+ position: relative;
86
108
  display: flex;
87
109
  column-gap: var(--spacing-l);
88
110
  align-items: flex-start;
@@ -244,6 +266,35 @@ t.styles = f`
244
266
  .fullpointer {
245
267
  cursor: pointer;
246
268
  }
269
+
270
+ /*
271
+ * The tile action used to be a <button> wrapping the whole tile, which made
272
+ * the add-to-bag button a nested interactive element: invalid HTML, and
273
+ * unreachable by keyboard. It is now a transparent overlay sibling, so the
274
+ * whole tile stays clickable while the CTA gets its own tab stop.
275
+ */
276
+ .tile-action {
277
+ position: absolute;
278
+ inset: 0;
279
+ width: 100%;
280
+ height: 100%;
281
+ margin: 0;
282
+ padding: 0;
283
+ border: 0 none;
284
+ background: none;
285
+ appearance: none;
286
+ -webkit-appearance: none;
287
+ cursor: pointer;
288
+ border-radius: inherit;
289
+ font: inherit;
290
+ color: inherit;
291
+ }
292
+
293
+ /* Keep the CTA above the overlay so pointer events still reach it. */
294
+ .info o-icon-button {
295
+ position: relative;
296
+ z-index: 1;
297
+ }
247
298
  `;
248
299
  e([
249
300
  i({ type: String })
package/index.mjs CHANGED
@@ -38,4 +38,4 @@ import "./components/search-input.mjs";
38
38
  import "./components/search-input-dropdown.mjs";
39
39
  import "./components/option-tile.mjs";
40
40
  import "./components/option-tile-group.mjs";
41
- globalThis.__FLORID_KIT__ = "3.2.5";
41
+ globalThis.__FLORID_KIT__ = "3.2.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__ = "3.2.5";
7
+ globalThis.__FLORID_KIT__ = "3.2.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": "3.2.5",
3
+ "version": "3.2.6",
4
4
  "main": "index.js",
5
5
  "module": "index.mjs",
6
6
  "typings": "index.d.ts",