@florid-kit/components 3.1.3 → 3.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.
@@ -0,0 +1,276 @@
1
+ import { i as p, m as d, a as u, E as a, x as m, t as v } from "./performance-mixin-D7YmSeqN.mjs";
2
+ import { n } from "./property-S_Y9cb04.mjs";
3
+ import { r as g, o as b } from "./icons-registry.mjs";
4
+ import { c as x } from "./svg-utils-DOL__czZ.mjs";
5
+ var y = Object.defineProperty, f = Object.getOwnPropertyDescriptor, e = (t, s, c, h) => {
6
+ for (var o = h > 1 ? void 0 : h ? f(s, c) : s, l = t.length - 1, r; l >= 0; l--)
7
+ (r = t[l]) && (o = (h ? r(s, c, o) : r(o)) || o);
8
+ return h && o && y(s, c, o), o;
9
+ };
10
+ const w = (t) => t.startsWith("occ-");
11
+ let i = class extends d(u) {
12
+ constructor() {
13
+ super(...arguments), this.bgstyle = "none-light", this.size = "medium", this.status = "empty", this.strokewidth = "1", this.icon = "", this.label = "";
14
+ }
15
+ _clearOccSubscription() {
16
+ var t;
17
+ (t = this._unsubOcc) == null || t.call(this), this._unsubOcc = void 0;
18
+ }
19
+ _syncOccSubscription() {
20
+ const t = this.icon;
21
+ if (!t || !w(t)) {
22
+ this._clearOccSubscription();
23
+ return;
24
+ }
25
+ const { svg: s } = g(t, { size: this.size, bgstyle: this.bgstyle });
26
+ if (s) {
27
+ this._clearOccSubscription();
28
+ return;
29
+ }
30
+ this._unsubOcc || (this._unsubOcc = b(() => {
31
+ const { svg: c } = g(t, { size: this.size, bgstyle: this.bgstyle });
32
+ c && (this._clearOccSubscription(), this.requestUpdate());
33
+ }));
34
+ }
35
+ _syncHostA11y() {
36
+ this.label ? (this.setAttribute("role", "img"), this.setAttribute("aria-label", this.label), this.removeAttribute("aria-hidden")) : (this.setAttribute("aria-hidden", "true"), this.removeAttribute("role"), this.removeAttribute("aria-label"));
37
+ }
38
+ connectedCallback() {
39
+ super.connectedCallback(), this._syncOccSubscription();
40
+ }
41
+ disconnectedCallback() {
42
+ this._clearOccSubscription(), super.disconnectedCallback();
43
+ }
44
+ updated(t) {
45
+ super.updated(t), this.style.setProperty("--icon-stroke-width", this.strokewidth), t.has("icon") && this._syncOccSubscription(), t.has("label") && this._syncHostA11y();
46
+ }
47
+ render() {
48
+ if (!this.icon)
49
+ return a;
50
+ const t = x(this.icon, this.size, this.bgstyle);
51
+ if (!t) return a;
52
+ const s = `icon-${this.icon}`;
53
+ return m`
54
+ <span
55
+ part="icon"
56
+ class="icon ${this.size} ${this.bgstyle} ${this.status} ${s}"
57
+ >
58
+ ${t}
59
+ </span>
60
+ `;
61
+ }
62
+ };
63
+ i.styles = p`
64
+ :host {
65
+ display: inline-flex;
66
+ justify-content: center;
67
+ align-items: center;
68
+ }
69
+
70
+ /*
71
+ * Reserve the host's footprint while the (code-split) SVG loads, so the
72
+ * host doesn't collapse to 0×0 and shift surrounding content (CLS).
73
+ * Values mirror the rendered .icon sizes below.
74
+ */
75
+ :host([size="xsmall"]) { min-width: 20px; min-height: 20px; }
76
+ :host([size="small"]) { min-width: 32px; min-height: 32px; }
77
+ :host([size="medium"]) { min-width: 40px; min-height: 40px; }
78
+ :host([size="large"]) { min-width: 40px; min-height: 40px; }
79
+
80
+ :host([bgstyle="none-light"][size="xsmall"]),
81
+ :host([bgstyle="none-contrast"][size="xsmall"]),
82
+ :host([bgstyle="ghost-light"][size="xsmall"]),
83
+ :host([bgstyle="ghost-contrast"][size="xsmall"]) { min-width: 8px; min-height: 8px; }
84
+ :host([bgstyle="none-light"][size="small"]),
85
+ :host([bgstyle="none-contrast"][size="small"]),
86
+ :host([bgstyle="ghost-light"][size="small"]),
87
+ :host([bgstyle="ghost-contrast"][size="small"]) { min-width: 12px; min-height: 12px; }
88
+ :host([bgstyle="none-light"][size="medium"]),
89
+ :host([bgstyle="none-contrast"][size="medium"]),
90
+ :host([bgstyle="ghost-light"][size="medium"]),
91
+ :host([bgstyle="ghost-contrast"][size="medium"]) { min-width: 16px; min-height: 16px; }
92
+ :host([bgstyle="none-light"][size="large"]),
93
+ :host([bgstyle="none-contrast"][size="large"]),
94
+ :host([bgstyle="ghost-light"][size="large"]),
95
+ :host([bgstyle="ghost-contrast"][size="large"]) { min-width: 24px; min-height: 24px; }
96
+
97
+ .icon {
98
+ display: flex;
99
+ justify-content: center;
100
+ align-items: center;
101
+ width: 32px;
102
+ height: 32px;
103
+ border-radius: var(--radius-full);
104
+ position: relative;
105
+ }
106
+
107
+ .icon.icon-wishlist svg path {
108
+ stroke: var(--color-content-action-secondary);
109
+ stroke-width: var(--icon-stroke-width, 1);
110
+ }
111
+
112
+ .icon.filled svg {
113
+ fill: var(--color-content-action-secondary);
114
+ }
115
+
116
+ .icon.xsmall {
117
+ width: 20px;
118
+ height: 20px;
119
+ }
120
+
121
+ .icon.xsmall:not(.icon-wishlist) svg {
122
+ width: 8px;
123
+ height: 8px;
124
+ }
125
+
126
+ .icon.small {
127
+ width: 32px;
128
+ height: 32px;
129
+ }
130
+
131
+ .icon.small:not(.icon-wishlist) svg {
132
+ width: 16px;
133
+ height: 16px;
134
+ }
135
+
136
+ .icon.medium {
137
+ width: 40px;
138
+ height: 40px;
139
+ }
140
+
141
+ .icon.medium:not(.icon-wishlist) svg {
142
+ width: 16px;
143
+ height: 16px;
144
+ }
145
+
146
+ .icon.large {
147
+ width: 40px;
148
+ height: 40px;
149
+ }
150
+
151
+ .icon.large:not(.icon-wishlist) svg {
152
+ width: 24px;
153
+ height: 24px;
154
+ }
155
+
156
+ /* No background — icon sizes itself to the glyph */
157
+ .icon.none-light, .icon.none-contrast,
158
+ .icon.ghost-light, .icon.ghost-contrast {
159
+ background-color: transparent;
160
+ width: auto;
161
+ height: auto;
162
+ }
163
+
164
+ .icon.none-light.xsmall svg,
165
+ .icon.none-contrast.xsmall svg,
166
+ .icon.ghost-light.xsmall svg,
167
+ .icon.ghost-contrast.xsmall svg {
168
+ width: 8px;
169
+ height: 8px;
170
+ }
171
+
172
+ .icon.none-light.small svg,
173
+ .icon.none-contrast.small svg,
174
+ .icon.ghost-light.small svg,
175
+ .icon.ghost-contrast.small svg {
176
+ width: 12px;
177
+ height: 12px;
178
+ }
179
+
180
+ .icon.none-light.medium svg,
181
+ .icon.none-contrast.medium svg,
182
+ .icon.ghost-light.medium svg,
183
+ .icon.ghost-contrast.medium svg {
184
+ width: 16px;
185
+ height: 16px;
186
+ }
187
+
188
+ .icon.none-light.large svg,
189
+ .icon.none-contrast.large svg,
190
+ .icon.ghost-light.large svg,
191
+ .icon.ghost-contrast.large svg {
192
+ width: 24px;
193
+ height: 24px;
194
+ }
195
+
196
+ .icon.none-light svg path,
197
+ .icon.ghost-light svg path {
198
+ stroke: none;
199
+ fill: var(--color-content-action-primary);
200
+ }
201
+
202
+ .icon.icon-wishlist.none-light svg path,
203
+ .icon.icon-wishlist.ghost-light svg path {
204
+ stroke: var(--color-content-action-primary);
205
+ }
206
+
207
+ .icon.none-light.icon-wishlist svg path,
208
+ .icon.ghost-light.icon-wishlist svg path {
209
+ fill: none;
210
+ }
211
+
212
+ :host([status="filled"]) .icon.none-light.icon-wishlist svg path,
213
+ :host([status="filled"]) .icon.ghost-light.icon-wishlist svg path {
214
+ fill: var(--color-content-action-primary);
215
+ }
216
+
217
+ /* Rounded coloured background (replaces .m-icon-colored-rounded) */
218
+ .icon.background-light {
219
+ background-color: var(--color-alpha-light-strong);
220
+ }
221
+
222
+ .icon.background-contrast {
223
+ background-color: var(--color-container-action-tertiary-default);
224
+ }
225
+
226
+ /* Status / feedback colours */
227
+ .icon.icon-success,
228
+ .icon.icon-error,
229
+ .icon.icon-info {
230
+ background-color: transparent;
231
+ width: auto;
232
+ height: auto;
233
+ }
234
+
235
+ .icon.icon-success svg path,
236
+ .icon.icon-error svg path,
237
+ .icon.icon-info svg path {
238
+ stroke: var(--color-content-action-primary);
239
+ }
240
+
241
+ .icon.icon-success svg path {
242
+ fill: var(--color-content-success);
243
+ }
244
+
245
+ .icon.icon-error svg path {
246
+ fill: var(--color-content-error);
247
+ }
248
+
249
+ .icon.icon-info svg path {
250
+ fill: var(--color-content-info);
251
+ }
252
+ `;
253
+ e([
254
+ n({ type: String, reflect: !0 })
255
+ ], i.prototype, "bgstyle", 2);
256
+ e([
257
+ n({ type: String, reflect: !0 })
258
+ ], i.prototype, "size", 2);
259
+ e([
260
+ n({ type: String, reflect: !0 })
261
+ ], i.prototype, "status", 2);
262
+ e([
263
+ n({ type: String })
264
+ ], i.prototype, "strokewidth", 2);
265
+ e([
266
+ n({ type: String })
267
+ ], i.prototype, "icon", 2);
268
+ e([
269
+ n({ type: String })
270
+ ], i.prototype, "label", 2);
271
+ i = e([
272
+ v("o-icon")
273
+ ], i);
274
+ export {
275
+ i as OccitaneIcon
276
+ };
package/index.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import "./components/side-panel.mjs";
2
2
  import "./components/wishlist-button.mjs";
3
3
  import "./components/icon-button.mjs";
4
+ import "./icon-CAvOSN1L.mjs";
4
5
  import "./components/link.mjs";
5
6
  import "./components/rating.mjs";
6
7
  import "./components/thumbnail-navigation.mjs";
package/loader.mjs CHANGED
@@ -15,6 +15,7 @@ const i = {
15
15
  "o-dropdown-variant": () => import("./components/dropdown-variant.mjs"),
16
16
  "o-feedback-message": () => import("./components/feedback-message.mjs"),
17
17
  "o-filter-chip": () => import("./components/filter-chip.mjs"),
18
+ "o-icon": () => import("./icon-CAvOSN1L.mjs"),
18
19
  "o-input": () => import("./components/input.mjs"),
19
20
  "o-medium-tile": () => import("./components/mediumtile.mjs"),
20
21
  "mini-tile": () => import("./components/minitile.mjs"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@florid-kit/components",
3
- "version": "3.1.3",
3
+ "version": "3.1.5",
4
4
  "main": "index.js",
5
5
  "module": "index.mjs",
6
6
  "typings": "index.d.ts",