@florid-kit/components 3.2.5 → 3.2.7

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
- for (var o = a > 1 ? void 0 : a ? y(r, l) : r, c = i.length - 1, p; c >= 0; c--)
7
- (p = i[c]) && (o = (a ? p(r, l, o) : p(o)) || o);
8
- return a && o && g(r, l, o), o;
6
+ var m = Object.defineProperty, y = Object.getOwnPropertyDescriptor, t = (i, o, l, a) => {
7
+ for (var r = a > 1 ? void 0 : a ? y(o, l) : o, c = i.length - 1, p; c >= 0; c--)
8
+ (p = i[c]) && (r = (a ? p(o, l, r) : p(r)) || r);
9
+ return a && r && m(o, l, r), r;
9
10
  };
10
11
  let e = class extends f(d) {
11
12
  constructor() {
@@ -15,7 +16,7 @@ let e = class extends f(d) {
15
16
  (!this.href || this.href === "#") && i.preventDefault();
16
17
  }
17
18
  render() {
18
- const i = !!this.href, r = s`
19
+ const i = !!this.href, o = s`
19
20
  ${this.startIcon ? s`
20
21
  <o-icon-button
21
22
  class="link-start-icon"
@@ -55,14 +56,18 @@ let e = class extends f(d) {
55
56
  target="${u(this.target || void 0)}"
56
57
  @click="${this._handleClick}"
57
58
  >
58
- ${r}
59
+ ${o}
59
60
  </a>
60
- ` : s`<span class="link-wrapper">${r}</span>`;
61
+ ` : s`<span class="link-wrapper">${o}</span>`;
61
62
  }
62
63
  };
63
64
  e.styles = h`
64
65
  :host {
65
66
  cursor: pointer;
67
+ /* The host is not the focus target: only the inner <a> is. Without
68
+ * this the UA paints its own solid ring on the host as well, which
69
+ * reads as a double focus ring. Same guard as o-icon-button. */
70
+ outline: none !important;
66
71
  }
67
72
 
68
73
  :host([template="standard"]) .link-wrapper {
@@ -129,6 +134,10 @@ e.styles = h`
129
134
  color: inherit;
130
135
  }
131
136
 
137
+ .link-wrapper:focus-visible {
138
+ ${g};
139
+ }
140
+
132
141
  .link-text {
133
142
  display: inline;
134
143
  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,85 @@
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
+ import { i as u } from "../css-C8WrrxT-.mjs";
3
4
  import "./icon-button.mjs";
4
5
  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;
6
+ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, e = (n, o, l, r) => {
7
+ for (var s = r > 1 ? void 0 : r ? y(o, l) : o, c = n.length - 1, p; c >= 0; c--)
8
+ (p = n[c]) && (s = (r ? p(o, l, s) : p(s)) || s);
9
+ return r && s && v(o, l, s), s;
9
10
  };
10
- let t = class extends h(d) {
11
+ let t = class extends f(d) {
11
12
  constructor() {
12
13
  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
14
  }
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(
15
+ onClick(n) {
16
+ var l, r, s;
17
+ const o = n.target;
18
+ (l = o == null ? void 0 : o.classList) != null && l.contains("add-to-bag") || (r = o == null ? void 0 : o.classList) != null && r.contains("js-availability-notify-details-routine") || ((s = this.onClickTile) == null || s.call(this), this.dispatchEvent(
18
19
  new CustomEvent("tile-click", { bubbles: !0, composed: !0 })
19
20
  ));
20
21
  }
21
22
  onClickIcons() {
22
- var r;
23
- (r = this.onClickIcon) == null || r.call(this), this.dispatchEvent(
23
+ var n;
24
+ (n = this.onClickIcon) == null || n.call(this), this.dispatchEvent(
24
25
  new CustomEvent("tile-icon-click", { bubbles: !0, composed: !0 })
25
26
  );
26
27
  }
28
+ // Accessible name for the add-to-bag / notify-me button, same shape as minitile's.
29
+ get iconLabel() {
30
+ const n = window.Resources || {};
31
+ return [this.type === "notifyme" ? n.NOSTOCK : n.ADD_TO_CART, this.titleProduct, this.volume].filter(Boolean).join(" - ");
32
+ }
33
+ // Accessible name for the tile action, same shape as minitile's title.
34
+ get tileLabel() {
35
+ return [
36
+ (window.Resources || {}).VIEW_PRODUCT,
37
+ this.titleProduct,
38
+ this.volume,
39
+ this.mainPrice
40
+ ].filter(Boolean).join(" - ");
41
+ }
27
42
  get icons() {
28
- return this.hideIcon ? "" : n`
43
+ return this.hideIcon ? "" : a`
29
44
  <o-icon-button
30
45
  @click=${this.onClickIcons}
31
46
  icon=${this.type === "notifyme" ? "notifyme" : "cart"}
32
47
  size="small"
33
48
  bgstyle="background-contrast"
34
- type="span"
49
+ type="button"
35
50
  status="empty"
36
51
  strokewidth="0"
37
52
  class=${this.type === "notifyme" ? "js-availability-notify-details-routine" : "add-to-bag"}
53
+ title="${this.iconLabel}"
54
+ srlabel="${this.iconLabel}"
55
+ ?showsrlabel=${!0}
38
56
  ></o-icon-button>
39
57
  `;
40
58
  }
41
59
  render() {
42
- return n`
43
- <button
44
- type="button"
60
+ return a`
61
+ <div
45
62
  class="tile fullpointer ${this.fullwidth ? "fullwidth" : ""} ${this.current ? "current" : ""}"
46
- @click=${this.onClick}
47
63
  >
48
- ${this.imageUrl ? n`<img src="${this.imageUrl}" alt="${this.altImage || ""}" />` : ""}
64
+ <button
65
+ type="button"
66
+ class="tile-action"
67
+ @click=${this.onClick}
68
+ title="${this.tileLabel}"
69
+ ></button>
70
+ ${this.imageUrl ? a`<img src="${this.imageUrl}" alt="${this.altImage || ""}" />` : ""}
49
71
  <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"
72
+ ${this.tagText ? a`<o-tag bgstyle="background-emphasis">${this.tagText}</o-tag>` : ""}
73
+ ${this.outOfStock ? a`<o-tag type="nostock" role="status" aria-live="polite"
52
74
  >${this.outOfStockText}</o-tag
53
75
  >` : ""}
54
76
  <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>` : ""}
77
+ ${this.titleProduct ? a`<div class="title">${this.titleProduct}</div>` : ""}
78
+ ${this.volume ? a`<span class="volume-info">${this.volume}</span>` : ""}
57
79
  </div>
58
- ${this.descriptionProduct ? n`<div class="description">${this.descriptionProduct}</div>` : ""}
80
+ ${this.descriptionProduct ? a`<div class="description">${this.descriptionProduct}</div>` : ""}
59
81
  <div class="details">
60
- ${this.salesPercentage && this.oldPrice ? n`<div class="discount-info">
82
+ ${this.salesPercentage && this.oldPrice ? a`<div class="discount-info">
61
83
  <o-tag bgstyle="background-emphasis"
62
84
  >${this.salesPercentage}</o-tag
63
85
  >
@@ -65,24 +87,28 @@ let t = class extends h(d) {
65
87
  </div>` : ""}
66
88
  <div class="price-details">
67
89
  <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>` : ""}
90
+ ${this.mainPrice ? a`<span class="main-price">${this.mainPrice}</span>` : ""}
91
+ ${this.perLiter ? a`<span class="per-liter">${this.perLiter}</span>` : ""}
70
92
  </div>
71
93
  ${this.icons}
72
94
  </div>
73
95
  </div>
74
96
  </div>
75
- </button>
97
+ </div>
76
98
  `;
77
99
  }
78
100
  };
79
- t.styles = f`
101
+ t.styles = h`
80
102
  :host {
81
103
  display: block;
82
104
  max-width: 100%;
105
+ /* The host is not the focus target: only .tile-action is. Without this the
106
+ * UA paints its own ring on the host too, which reads as a double ring. */
107
+ outline: none !important;
83
108
  }
84
109
 
85
110
  .tile {
111
+ position: relative;
86
112
  display: flex;
87
113
  column-gap: var(--spacing-l);
88
114
  align-items: flex-start;
@@ -244,6 +270,44 @@ t.styles = f`
244
270
  .fullpointer {
245
271
  cursor: pointer;
246
272
  }
273
+
274
+ /*
275
+ * The tile action used to be a <button> wrapping the whole tile, which made
276
+ * the add-to-bag button a nested interactive element: invalid HTML, and
277
+ * unreachable by keyboard. It is now a transparent overlay sibling, so the
278
+ * whole tile stays clickable while the CTA gets its own tab stop.
279
+ */
280
+ .tile-action {
281
+ position: absolute;
282
+ inset: 0;
283
+ width: 100%;
284
+ height: 100%;
285
+ margin: 0;
286
+ padding: 0;
287
+ border: 0 none;
288
+ background: none;
289
+ appearance: none;
290
+ -webkit-appearance: none;
291
+ cursor: pointer;
292
+ border-radius: inherit;
293
+ font: inherit;
294
+ color: inherit;
295
+ }
296
+
297
+ /*
298
+ * Brand focus ring instead of the UA's solid one. The overlay is inset: 0,
299
+ * so an outward offset would be clipped by the tile: use the inner variant
300
+ * to keep the dashes inside the card.
301
+ */
302
+ .tile-action:focus-visible {
303
+ ${u};
304
+ }
305
+
306
+ /* Keep the CTA above the overlay so pointer events still reach it. */
307
+ .info o-icon-button {
308
+ position: relative;
309
+ z-index: 1;
310
+ }
247
311
  `;
248
312
  e([
249
313
  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.7";
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.7";
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.7",
4
4
  "main": "index.js",
5
5
  "module": "index.mjs",
6
6
  "typings": "index.d.ts",