@florid-kit/components 2.6.17 → 3.0.0

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.
Files changed (70) hide show
  1. package/assets/icons/icons-occ.d.ts +315 -0
  2. package/assets/icons/icons.d.ts +12 -84
  3. package/assets/icons/svg-utils.d.ts +13 -0
  4. package/behaviors/performance-mixin.d.ts +0 -23
  5. package/behaviors/performance-reporter.d.ts +1 -0
  6. package/components/accordion-group.mjs +61 -0
  7. package/components/accordion.mjs +185 -0
  8. package/components/arch-image.mjs +135 -0
  9. package/components/badge.mjs +75 -0
  10. package/components/breadcrumb.mjs +83 -0
  11. package/components/breadcrumbs.mjs +35 -0
  12. package/components/button.d.ts +3 -0
  13. package/components/button.mjs +12 -0
  14. package/components/checkbox.mjs +188 -0
  15. package/components/chip.mjs +158 -0
  16. package/components/chipset.mjs +44 -0
  17. package/components/dots.mjs +60 -0
  18. package/components/dropdown-variant.d.ts +1 -0
  19. package/components/dropdown-variant.mjs +446 -0
  20. package/components/dropdown.d.ts +1 -0
  21. package/components/dropdown.mjs +303 -0
  22. package/components/feedback-message.mjs +136 -0
  23. package/components/filter-chip.mjs +215 -0
  24. package/components/footer-simplify.mjs +178 -0
  25. package/components/header-simplify.mjs +234 -0
  26. package/components/icon-button.d.ts +5 -0
  27. package/components/icon-button.mjs +340 -0
  28. package/components/input.mjs +298 -0
  29. package/components/link.mjs +172 -0
  30. package/components/mediumtile.mjs +307 -0
  31. package/components/minitile.mjs +234 -0
  32. package/components/option-tile-group.mjs +105 -0
  33. package/components/option-tile.mjs +413 -0
  34. package/components/popin.mjs +412 -0
  35. package/components/radio.mjs +165 -0
  36. package/components/rating.mjs +81 -0
  37. package/components/reassurance.mjs +163 -0
  38. package/components/search-input-dropdown.mjs +314 -0
  39. package/components/search-input.mjs +107 -0
  40. package/components/side-panel.mjs +1206 -0
  41. package/components/tab.mjs +140 -0
  42. package/components/tablist.mjs +44 -0
  43. package/components/tag.mjs +86 -0
  44. package/components/textarea.mjs +269 -0
  45. package/components/thumbnail-navigation.mjs +232 -0
  46. package/components/toast.mjs +191 -0
  47. package/components/tooltip.mjs +125 -0
  48. package/components/wishlist-button.mjs +132 -0
  49. package/css-C8WrrxT-.mjs +41 -0
  50. package/css.d.ts +1 -0
  51. package/directive-helpers-BHuwIghp.mjs +11 -0
  52. package/directive-oAbCiebi.mjs +27 -0
  53. package/element-internals-Dw7LndlH.mjs +19 -0
  54. package/icons-Pdn_6YtT.mjs +104 -0
  55. package/icons-occ.mjs +834 -0
  56. package/if-defined-j0wE2gL4.mjs +10 -0
  57. package/index.mjs +41 -9712
  58. package/live-C_TUoYRm.mjs +30 -0
  59. package/loader.d.ts +3 -0
  60. package/loader.mjs +78 -0
  61. package/logo-CEgaTL93.mjs +4 -0
  62. package/package.json +19 -1
  63. package/performance-mixin-D7YmSeqN.mjs +628 -0
  64. package/performance-reporter-B7ZOqnDk.mjs +89 -0
  65. package/property-S_Y9cb04.mjs +36 -0
  66. package/query-NJDNu0-P.mjs +25 -0
  67. package/state-DjMxXomO.mjs +12 -0
  68. package/svg-utils-CRDBD8ES.mjs +47 -0
  69. package/unsafe-svg-C3uTocNg.mjs +34 -0
  70. package/index.js +0 -5748
@@ -0,0 +1,446 @@
1
+ import { i as m, m as y, a as w, x as p, t as x } from "../performance-mixin-D7YmSeqN.mjs";
2
+ import { n as c } from "../property-S_Y9cb04.mjs";
3
+ import { r as f } from "../state-DjMxXomO.mjs";
4
+ import { o as _, i as k } from "../icons-Pdn_6YtT.mjs";
5
+ import { o as $ } from "../unsafe-svg-C3uTocNg.mjs";
6
+ import { o as l } from "../if-defined-j0wE2gL4.mjs";
7
+ var I = Object.defineProperty, O = Object.getOwnPropertyDescriptor, a = (e, i, o, t) => {
8
+ for (var n = t > 1 ? void 0 : t ? O(i, o) : i, s = e.length - 1, d; s >= 0; s--)
9
+ (d = e[s]) && (n = (t ? d(i, o, n) : d(n)) || n);
10
+ return t && n && I(i, o, n), n;
11
+ };
12
+ let r = class extends y(w) {
13
+ constructor() {
14
+ super(...arguments), this.options = [], this.value = "", this.name = "", this.additionaltext = "+X variant(s)", this.disabled = !1, this.width = "100%", this.open = !1, this.activeIndex = -1, this.menuWidth = "", this._sent = /* @__PURE__ */ new Set(), this._pendingByKey = /* @__PURE__ */ new Map(), this._handleOutsideClick = (e) => {
15
+ this.contains(e.target) || (this.open = !1, this.activeIndex = -1, this._stopObserveVisibleItems());
16
+ };
17
+ }
18
+ _getKey(e, i, o) {
19
+ return (i == null ? void 0 : i.productId) ?? e.value ?? String(o);
20
+ }
21
+ _scheduleFlush() {
22
+ this._flushTimer || (this._flushTimer = window.setTimeout(() => {
23
+ this._flushTimer = void 0, this._flushPending();
24
+ }, 80));
25
+ }
26
+ _flushPending() {
27
+ if (!this.open || this._pendingByKey.size === 0) return;
28
+ const e = Array.from(this._pendingByKey.values());
29
+ this._pendingByKey.clear(), this.dispatchEvent(
30
+ new CustomEvent("event-tracking", {
31
+ detail: {
32
+ products: e
33
+ },
34
+ bubbles: !0,
35
+ composed: !0
36
+ })
37
+ );
38
+ }
39
+ _emitTrackingEvent(e, i) {
40
+ const o = e == null ? void 0 : e.dataproduct;
41
+ if (!o) return;
42
+ let t;
43
+ try {
44
+ t = JSON.parse(o);
45
+ } catch (n) {
46
+ console.warn("Invalid dataproduct JSON:", o, n);
47
+ return;
48
+ }
49
+ this.dispatchEvent(
50
+ new CustomEvent("event-tracking", {
51
+ detail: {
52
+ product: t
53
+ },
54
+ bubbles: !0,
55
+ composed: !0
56
+ })
57
+ );
58
+ }
59
+ connectedCallback() {
60
+ super.connectedCallback(), document.addEventListener("click", this._handleOutsideClick), this._unsubOcc = _(() => this.requestUpdate());
61
+ }
62
+ disconnectedCallback() {
63
+ var e;
64
+ document.removeEventListener("click", this._handleOutsideClick), (e = this._unsubOcc) == null || e.call(this), super.disconnectedCallback();
65
+ }
66
+ _startObserveVisibleItems() {
67
+ var i;
68
+ this._stopObserveVisibleItems();
69
+ const e = (i = this.renderRoot) == null ? void 0 : i.querySelector("#dropdown-listbox");
70
+ e && (this._io = new IntersectionObserver(
71
+ (o) => {
72
+ if (this.open)
73
+ for (const t of o) {
74
+ if (!t.isIntersecting) continue;
75
+ const n = t.target, s = n.dataset.index;
76
+ if (!s) continue;
77
+ const d = Number(s), h = this.options[d];
78
+ if (!h || h.disabled) continue;
79
+ const u = h.dataproduct ?? n.dataset.product;
80
+ if (!u) continue;
81
+ let v;
82
+ try {
83
+ v = JSON.parse(u);
84
+ } catch (g) {
85
+ console.warn("Invalid dataproduct JSON:", u, g);
86
+ continue;
87
+ }
88
+ const b = this._getKey(h, v, d);
89
+ this._sent.has(b) || (this._sent.add(b), this._pendingByKey.set(b, v), this._scheduleFlush());
90
+ }
91
+ },
92
+ {
93
+ root: e,
94
+ threshold: 0.75
95
+ }
96
+ ), e.querySelectorAll("li[role='option']").forEach((o) => {
97
+ var t;
98
+ return (t = this._io) == null ? void 0 : t.observe(o);
99
+ }));
100
+ }
101
+ _stopObserveVisibleItems() {
102
+ var e;
103
+ this._flushPending(), this._flushTimer && (clearTimeout(this._flushTimer), this._flushTimer = void 0), (e = this._io) == null || e.disconnect(), this._io = void 0;
104
+ }
105
+ toggle() {
106
+ var e;
107
+ if (!this.disabled) {
108
+ if (this.open = !this.open, this.activeIndex = this.open ? this.options.findIndex((i) => i.value === this.value) : -1, this.open && this.width === "auto") {
109
+ const i = (e = this.renderRoot) == null ? void 0 : e.querySelector("button");
110
+ i && (this.menuWidth = `${i.getBoundingClientRect().width}px`);
111
+ }
112
+ this.open ? this.updateComplete.then(() => {
113
+ this._focusActiveOption(), this._startObserveVisibleItems();
114
+ }) : this._stopObserveVisibleItems();
115
+ }
116
+ }
117
+ _focusActiveOption() {
118
+ var i;
119
+ const e = (i = this.renderRoot) == null ? void 0 : i.querySelector(`#option-${this.activeIndex}`);
120
+ e == null || e.focus();
121
+ }
122
+ selectOption(e) {
123
+ this.value = e.value, this.dispatchEvent(new CustomEvent("change", {
124
+ detail: { value: this.value, url: e.url }
125
+ })), this.open = !1, this.activeIndex = -1;
126
+ }
127
+ handleKeydown(e) {
128
+ if (this.disabled) {
129
+ e.preventDefault();
130
+ return;
131
+ }
132
+ if (!this.open) {
133
+ (e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), this.open = !0, this.activeIndex = this.options.findIndex((i) => i.value === this.value), this.updateComplete.then(() => this._focusActiveOption()));
134
+ return;
135
+ }
136
+ switch (e.key) {
137
+ case "ArrowDown":
138
+ e.preventDefault(), this.activeIndex = (this.activeIndex + 1) % this.options.length, this.updateComplete.then(() => this._focusActiveOption());
139
+ break;
140
+ case "ArrowUp":
141
+ e.preventDefault(), this.activeIndex = (this.activeIndex - 1 + this.options.length) % this.options.length, this.updateComplete.then(() => this._focusActiveOption());
142
+ break;
143
+ case "Home":
144
+ e.preventDefault(), this.activeIndex = 0, this.updateComplete.then(() => this._focusActiveOption());
145
+ break;
146
+ case "End":
147
+ e.preventDefault(), this.activeIndex = this.options.length - 1, this.updateComplete.then(() => this._focusActiveOption());
148
+ break;
149
+ case "Enter":
150
+ e.preventDefault(), this.activeIndex >= 0 && this.selectOption(this.options[this.activeIndex]);
151
+ break;
152
+ case "Escape":
153
+ e.preventDefault(), this.open = !1, this.activeIndex = -1;
154
+ break;
155
+ }
156
+ }
157
+ updated() {
158
+ this.options.length > 0 && (this.options.some((i) => i.value === this.value) || (this.value = this.options[0].value));
159
+ }
160
+ render() {
161
+ const e = k["occ-check-outlined"] ?? "", i = e ? e.replace(
162
+ "<svg",
163
+ '<svg aria-hidden="true" focusable="false" part="svg"'
164
+ ) : "", o = this.options.find((t) => t.value === this.value);
165
+ return p`
166
+ <button
167
+ role="combobox"
168
+ aria-haspopup="listbox"
169
+ aria-controls="dropdown-listbox"
170
+ aria-expanded="${this.open}"
171
+ aria-disabled="${this.disabled ? "true" : "false"}"
172
+ aria-labelledby="dropdown-label"
173
+ @click=${this.toggle}
174
+ @keydown=${this.handleKeydown}
175
+ style=${`width: ${this.width};`}
176
+ ?disabled=${this.disabled}
177
+ class="btn-dropdown"
178
+ >
179
+ <img alt="${l(o == null ? void 0 : o.label)}" src="${l(o == null ? void 0 : o.imgurl)}" />
180
+ <span id="dropdown-label" class="label">
181
+ ${o ? o.label : "Select an option"}
182
+ </span>
183
+ <div class="right">
184
+ <span class="additional-text">${this.additionaltext}</span>
185
+ <span class="arrow">
186
+ <o-icon-button
187
+ icon="${this.open ? "occ-triangle-up" : "occ-triangle-down"}"
188
+ size="medium"
189
+ bgstyle="none-contrast"
190
+ type="span">
191
+ </o-icon-button>
192
+ </span>
193
+ </div>
194
+ </button>
195
+
196
+ ${this.open ? p`
197
+ <ul
198
+ id="dropdown-listbox"
199
+ role="listbox"
200
+ aria-activedescendant="${this.activeIndex >= 0 ? "option-" + this.activeIndex : ""}"
201
+ style=${`width: ${this.width};`}
202
+ >
203
+ ${this.options.map(
204
+ (t, n) => p`
205
+ <li
206
+ id="option-${n}"
207
+ role="option"
208
+ data-index="${n}"
209
+ data-product="${l(t.dataproduct)}"
210
+ aria-selected="${t.value === this.value}"
211
+ aria-disabled="${t.disabled ? "true" : "false"}"
212
+ tabindex="${n === this.activeIndex ? "0" : "-1"}"
213
+ class="${n === this.activeIndex ? "active" : ""} ${t.disabled ? "disabled" : ""}"
214
+ @click=${(s) => {
215
+ this._emitTrackingEvent(t, n), this.selectOption(t);
216
+ }}
217
+ >
218
+
219
+ <a href="${l(t.url)}">
220
+ <img alt="${l(t.label)}" src="${l(t.imgurl)}" />
221
+ <span class="label">${t.label}</span>
222
+ <div class="right">
223
+ <span class="additional-text">${l(t.additionaltext)}</span>
224
+ ${t.value === this.value && !t.additionaltext ? p`
225
+ <span class="check">${$(i)}</span>` : null}
226
+ </div>
227
+ </a>
228
+ </li>
229
+ `
230
+ )}
231
+ </ul>` : null}
232
+
233
+ <input type="hidden" name="${this.name}" .value="${this.value}" />
234
+ `;
235
+ }
236
+ };
237
+ r.styles = m`
238
+ :host {
239
+ display: inline-block;
240
+ position: relative;
241
+ width: 100%;
242
+ }
243
+
244
+ .btn-dropdown {
245
+ display: flex;
246
+ gap: var(--spacing-l);
247
+ width: 100%;
248
+ height: 50px;
249
+ color: var(--color-content-body);
250
+ align-items: center;
251
+ background-color: var(--color-container-bg-default);
252
+ cursor: pointer;
253
+ border-radius: var(--radius-m);
254
+ border: var(--border-m) solid var(--color-border-secondary);
255
+ padding: 0;
256
+ overflow: hidden;
257
+ }
258
+
259
+ .btn-dropdown:disabled {
260
+ background-color: var(--color-container-disabled);
261
+ pointer-events: none;
262
+ }
263
+
264
+ .btn-dropdown:disabled .label {
265
+ color: var(--color-content-disabled);
266
+ }
267
+
268
+ .btn-dropdown img {
269
+ width: 40px;
270
+ height: 50px;
271
+ }
272
+
273
+ .btn-dropdown .right {
274
+ display: flex;
275
+ align-items: center;
276
+ gap: var(--spacing-l);
277
+ }
278
+
279
+ .btn-dropdown .arrow {
280
+ margin-top: auto;
281
+ margin-bottom: auto;
282
+ margin-right: var(--spacing-l);
283
+ }
284
+
285
+ .btn-dropdown:hover {
286
+ border: var(--border-m) solid var(--color-border-primary);
287
+ }
288
+
289
+ .btn-dropdown[aria-expanded="true"] {
290
+ border: var(--border-l) solid var(--color-border-primary);
291
+ }
292
+
293
+ .label {
294
+ flex: 1;
295
+ text-align: start;
296
+ font-family: var(--font-family-loccitane-sans);
297
+ font-weight: var(--font-weight-500);
298
+ font-size: var(--font-size-100);
299
+ line-height: var(--line-height-160);
300
+ letter-spacing: var(--letter-spacing-400);
301
+ text-transform: uppercase;
302
+ color: var(--color-content-body);
303
+ }
304
+
305
+ ul {
306
+ list-style: none;
307
+ margin: 4px 0 0 0;
308
+ padding: 0;
309
+ border: var(--border-m) solid var(--color-border-secondary);
310
+ position: absolute;
311
+ background: white;
312
+ height: auto;
313
+ overflow-y: auto;
314
+ z-index: 1000;
315
+ border-radius: var(--radius-200);
316
+ background-color: var(--color-container-action-secondary-default);
317
+ max-height: calc(5 * 40px);
318
+ }
319
+
320
+ li {
321
+ display: flex;
322
+ justify-content: space-between;
323
+ align-items: center;
324
+ cursor: pointer;
325
+ border-bottom: var(--border-s) solid var(--color-border-secondary);
326
+ gap: var(--spacing-l);
327
+ padding-right: var(--spacing-l);
328
+ }
329
+
330
+ li a {
331
+ display: flex;
332
+ width: 100%;
333
+ gap: var(--spacing-l);
334
+ align-items: center;
335
+ text-decoration: none;
336
+ }
337
+
338
+ li a:active {
339
+ color: inherit;
340
+ text-decoration: none;
341
+ }
342
+
343
+ li a img {
344
+ width: 40px;
345
+ height: 50px;
346
+ }
347
+
348
+ li.disabled {
349
+ background-color: var(--color-container-disabled);
350
+ }
351
+
352
+ li.disabled .label {
353
+ color: var(--color-content-disabled);
354
+ }
355
+
356
+ li:hover:not(.disabled) {
357
+ background-color: var(--color-container-action-secondary-hover);
358
+ }
359
+
360
+ li:active:not(.disabled) {
361
+ background-color: var(--color-container-action-secondary-pressed);
362
+ }
363
+
364
+ li[aria-selected="true"] {
365
+ background-color: var(--color-container-action-tertiary-default);
366
+ }
367
+
368
+ li[aria-selected="true"]:hover {
369
+ background-color: var(--color-container-action-tertiary-hover);
370
+ }
371
+
372
+ li[aria-selected="true"]:active {
373
+ background-color: var(--color-container-action-tertiary-pressed);
374
+ }
375
+
376
+ li[aria-selected="true"].disabled {
377
+ background-color: var(--color-container-disabled);
378
+ }
379
+
380
+ li:last-child {
381
+ border-bottom: none;
382
+ }
383
+
384
+ li span {
385
+ font-family: var(--font-family-loccitane-sans);
386
+ font-weight: var(--font-weight-400);
387
+ font-size: var(--font-size-150);
388
+ line-height: var(--line-height-200);
389
+ letter-spacing: var(--letter-spacing-000);
390
+ height: auto;
391
+ }
392
+
393
+ .additional-text {
394
+ font-family: var(--font-family-loccitane-sans);
395
+ font-weight: var(--font-weight-400);
396
+ font-size: var(--font-size-100);
397
+ line-height: var(--line-height-160);
398
+ letter-spacing: var(--letter-spacing-400);
399
+ text-decoration: none;
400
+ color: var(--color-content-description);
401
+ }
402
+
403
+ .check {
404
+ margin-left: var(--spacing-100);
405
+ width: 12px;
406
+ height: auto;
407
+ color: var(--color-content-action-secondary);
408
+ }
409
+
410
+ input[type="hidden"] {
411
+ display: none;
412
+ }
413
+ `;
414
+ a([
415
+ c({ type: Array, reflect: !0 })
416
+ ], r.prototype, "options", 2);
417
+ a([
418
+ c({ type: String, reflect: !0 })
419
+ ], r.prototype, "value", 2);
420
+ a([
421
+ c({ type: String, reflect: !0 })
422
+ ], r.prototype, "name", 2);
423
+ a([
424
+ c({ type: String, reflect: !0 })
425
+ ], r.prototype, "additionaltext", 2);
426
+ a([
427
+ c({ type: Boolean, reflect: !0 })
428
+ ], r.prototype, "disabled", 2);
429
+ a([
430
+ c({ type: String, reflect: !0 })
431
+ ], r.prototype, "width", 2);
432
+ a([
433
+ f()
434
+ ], r.prototype, "open", 2);
435
+ a([
436
+ f()
437
+ ], r.prototype, "activeIndex", 2);
438
+ a([
439
+ f()
440
+ ], r.prototype, "menuWidth", 2);
441
+ r = a([
442
+ x("o-dropdown-variant")
443
+ ], r);
444
+ export {
445
+ r as OccitaneDropdownVariant
446
+ };
@@ -16,6 +16,7 @@ export declare class OccitaneDropdown extends OccitaneDropdown_base {
16
16
  open: boolean;
17
17
  activeIndex: number;
18
18
  menuWidth: string;
19
+ private _unsubOcc?;
19
20
  connectedCallback(): void;
20
21
  disconnectedCallback(): void;
21
22
  _handleOutsideClick: (e: MouseEvent) => void;