@florid-kit/components 3.1.0 → 3.1.1
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/components/icon-button.mjs +65 -46
- package/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
import { n
|
|
3
|
-
import { o as
|
|
4
|
-
import { r as
|
|
5
|
-
import { c as
|
|
6
|
-
import { f
|
|
7
|
-
var $ = Object.defineProperty,
|
|
8
|
-
for (var r =
|
|
9
|
-
(h = t[l]) && (r = (
|
|
10
|
-
return
|
|
1
|
+
import { i as u, m as p, E as g, x as a, a as d, t as v } from "../performance-mixin-D7YmSeqN.mjs";
|
|
2
|
+
import { n } from "../property-S_Y9cb04.mjs";
|
|
3
|
+
import { o as m } from "../if-defined-j0wE2gL4.mjs";
|
|
4
|
+
import { r as b, o as y } from "../icons-registry.mjs";
|
|
5
|
+
import { c as x } from "../svg-utils-DOL__czZ.mjs";
|
|
6
|
+
import { f, i as w, s as k } from "../css-C8WrrxT-.mjs";
|
|
7
|
+
var $ = Object.defineProperty, S = Object.getOwnPropertyDescriptor, i = (t, s, e, c) => {
|
|
8
|
+
for (var r = c > 1 ? void 0 : c ? S(s, e) : s, l = t.length - 1, h; l >= 0; l--)
|
|
9
|
+
(h = t[l]) && (r = (c ? h(s, e, r) : h(r)) || r);
|
|
10
|
+
return c && r && $(s, e, r), r;
|
|
11
11
|
};
|
|
12
|
-
const
|
|
12
|
+
const z = (t) => t.startsWith("occ-");
|
|
13
13
|
let o = class extends p(d) {
|
|
14
14
|
constructor() {
|
|
15
15
|
super(...arguments), this.bgstyle = "background-light", this.size = "medium", this.status = "empty", this.type = "button", this.strokewidth = "1", this.icon = "", this.disabled = !1, this.highlight = !1, this.showSrLabel = !1, this.srLabel = "";
|
|
@@ -20,18 +20,18 @@ let o = class extends p(d) {
|
|
|
20
20
|
}
|
|
21
21
|
_syncOccSubscription() {
|
|
22
22
|
const t = this.icon;
|
|
23
|
-
if (!t || !
|
|
23
|
+
if (!t || !z(t)) {
|
|
24
24
|
this._clearOccSubscription();
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
const { svg: s } =
|
|
27
|
+
const { svg: s } = b(t, { size: this.size, bgstyle: this.bgstyle });
|
|
28
28
|
if (s) {
|
|
29
29
|
this._clearOccSubscription();
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
-
this._unsubOcc || (this._unsubOcc =
|
|
33
|
-
const { svg:
|
|
34
|
-
|
|
32
|
+
this._unsubOcc || (this._unsubOcc = y(() => {
|
|
33
|
+
const { svg: e } = b(t, { size: this.size, bgstyle: this.bgstyle });
|
|
34
|
+
e && (this._clearOccSubscription(), this.requestUpdate());
|
|
35
35
|
}));
|
|
36
36
|
}
|
|
37
37
|
connectedCallback() {
|
|
@@ -45,10 +45,10 @@ let o = class extends p(d) {
|
|
|
45
45
|
}
|
|
46
46
|
render() {
|
|
47
47
|
if (!this.icon)
|
|
48
|
-
return
|
|
49
|
-
const t =
|
|
50
|
-
if (!t) return
|
|
51
|
-
const s = `icon-${this.icon}`,
|
|
48
|
+
return g;
|
|
49
|
+
const t = x(this.icon, this.size, this.bgstyle);
|
|
50
|
+
if (!t) return g;
|
|
51
|
+
const s = `icon-${this.icon}`, e = this.showSrLabel ? a`<span class="sr-only">${this.srLabel}</span>` : null, c = this.showSrLabel ? "" : "icon";
|
|
52
52
|
return a`
|
|
53
53
|
${this.type === "span" ? a`
|
|
54
54
|
<span part="icon-button" class="icon icon-button ${this.size} ${this.bgstyle} ${this.status} ${s} ${this.highlight ? "highlight" : ""}" ?disabled="${this.disabled}">
|
|
@@ -57,20 +57,20 @@ let o = class extends p(d) {
|
|
|
57
57
|
` : a`
|
|
58
58
|
<button
|
|
59
59
|
type="button"
|
|
60
|
-
aria-label=${
|
|
61
|
-
aria-describedby=${this.getAttribute("aria-describedby") ||
|
|
60
|
+
aria-label=${m(c)}
|
|
61
|
+
aria-describedby=${this.getAttribute("aria-describedby") || g}
|
|
62
62
|
part="icon-button"
|
|
63
63
|
class="icon-button ${this.size} ${this.bgstyle} ${this.status} ${s} ${this.highlight ? "highlight" : ""}"
|
|
64
64
|
?disabled="${this.disabled}"
|
|
65
65
|
>
|
|
66
66
|
${t}
|
|
67
|
-
${
|
|
67
|
+
${e}
|
|
68
68
|
</button>
|
|
69
69
|
`}
|
|
70
70
|
`;
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
|
-
o.styles =
|
|
73
|
+
o.styles = u`
|
|
74
74
|
:host {
|
|
75
75
|
display: inline-flex;
|
|
76
76
|
justify-content: center;
|
|
@@ -78,6 +78,25 @@ o.styles = g`
|
|
|
78
78
|
outline: none !important;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
/*
|
|
82
|
+
* Reserve the host's footprint while the (code-split) SVG loads, so the
|
|
83
|
+
* host doesn't collapse to 0×0 and shift surrounding content (CLS).
|
|
84
|
+
* Values mirror the rendered .icon-button sizes below.
|
|
85
|
+
*/
|
|
86
|
+
:host([size="xsmall"]) { min-width: 20px; min-height: 20px; }
|
|
87
|
+
:host([size="small"]) { min-width: 32px; min-height: 32px; }
|
|
88
|
+
:host([size="medium"]) { min-width: 40px; min-height: 40px; }
|
|
89
|
+
:host([size="large"]) { min-width: 40px; min-height: 40px; }
|
|
90
|
+
|
|
91
|
+
:host([bgstyle="none-light"][size="xsmall"]),
|
|
92
|
+
:host([bgstyle="none-contrast"][size="xsmall"]) { min-width: 8px; min-height: 8px; }
|
|
93
|
+
:host([bgstyle="none-light"][size="small"]),
|
|
94
|
+
:host([bgstyle="none-contrast"][size="small"]) { min-width: 12px; min-height: 12px; }
|
|
95
|
+
:host([bgstyle="none-light"][size="medium"]),
|
|
96
|
+
:host([bgstyle="none-contrast"][size="medium"]) { min-width: 16px; min-height: 16px; }
|
|
97
|
+
:host([bgstyle="none-light"][size="large"]),
|
|
98
|
+
:host([bgstyle="none-contrast"][size="large"]) { min-width: 24px; min-height: 24px; }
|
|
99
|
+
|
|
81
100
|
.icon-button {
|
|
82
101
|
display: flex;
|
|
83
102
|
justify-content: center;
|
|
@@ -276,7 +295,7 @@ o.styles = g`
|
|
|
276
295
|
}
|
|
277
296
|
|
|
278
297
|
.icon-button:focus-visible {
|
|
279
|
-
${
|
|
298
|
+
${f}
|
|
280
299
|
}
|
|
281
300
|
|
|
282
301
|
:host(.go-to-top) .icon-button:focus-visible {
|
|
@@ -303,37 +322,37 @@ o.styles = g`
|
|
|
303
322
|
${k}
|
|
304
323
|
}
|
|
305
324
|
`;
|
|
306
|
-
|
|
307
|
-
|
|
325
|
+
i([
|
|
326
|
+
n({ type: String, reflect: !0 })
|
|
308
327
|
], o.prototype, "bgstyle", 2);
|
|
309
|
-
|
|
310
|
-
|
|
328
|
+
i([
|
|
329
|
+
n({ type: String, reflect: !0 })
|
|
311
330
|
], o.prototype, "size", 2);
|
|
312
|
-
|
|
313
|
-
|
|
331
|
+
i([
|
|
332
|
+
n({ type: String, reflect: !0 })
|
|
314
333
|
], o.prototype, "status", 2);
|
|
315
|
-
|
|
316
|
-
|
|
334
|
+
i([
|
|
335
|
+
n({ type: String, reflect: !0 })
|
|
317
336
|
], o.prototype, "type", 2);
|
|
318
|
-
|
|
319
|
-
|
|
337
|
+
i([
|
|
338
|
+
n({ type: String })
|
|
320
339
|
], o.prototype, "strokewidth", 2);
|
|
321
|
-
|
|
322
|
-
|
|
340
|
+
i([
|
|
341
|
+
n({ type: String })
|
|
323
342
|
], o.prototype, "icon", 2);
|
|
324
|
-
|
|
325
|
-
|
|
343
|
+
i([
|
|
344
|
+
n({ type: Boolean, reflect: !0 })
|
|
326
345
|
], o.prototype, "disabled", 2);
|
|
327
|
-
|
|
328
|
-
|
|
346
|
+
i([
|
|
347
|
+
n({ type: Boolean, reflect: !0 })
|
|
329
348
|
], o.prototype, "highlight", 2);
|
|
330
|
-
|
|
331
|
-
|
|
349
|
+
i([
|
|
350
|
+
n({ type: Boolean })
|
|
332
351
|
], o.prototype, "showSrLabel", 2);
|
|
333
|
-
|
|
334
|
-
|
|
352
|
+
i([
|
|
353
|
+
n({ type: String })
|
|
335
354
|
], o.prototype, "srLabel", 2);
|
|
336
|
-
o =
|
|
355
|
+
o = i([
|
|
337
356
|
v("o-icon-button")
|
|
338
357
|
], o);
|
|
339
358
|
export {
|