@florid-kit/components 3.1.0 → 3.1.2
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/button.d.ts +1 -1
- package/components/icon-button.mjs +65 -46
- package/components/side-panel.mjs +56 -12
- package/package.json +1 -1
package/components/button.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { LitElement } from 'lit';
|
|
|
2
2
|
import { FormSubmitter, FormSubmitterType } from '../controllers/form-submitter';
|
|
3
3
|
|
|
4
4
|
declare const buttonBaseClass: import('../behaviors/mixin').MixinReturn<import('../behaviors/mixin').MixinReturn<typeof LitElement, import('../behaviors/element-internals.js').WithElementInternals>>;
|
|
5
|
-
type ButtonVariant = "primary" | "secondary" | "ghost" | "tertiary";
|
|
5
|
+
type ButtonVariant = "primary" | "secondary" | "ghost" | "tertiary" | "link";
|
|
6
6
|
export declare const variants: string[];
|
|
7
7
|
export declare class OccitaneButton extends buttonBaseClass implements FormSubmitter {
|
|
8
8
|
static readonly formAssociated = true;
|
|
@@ -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 {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { E as p, i as C, a as
|
|
1
|
+
import { E as p, i as C, a as x, m as S, x as h, t as B } from "../performance-mixin-D7YmSeqN.mjs";
|
|
2
2
|
import { n as r } from "../property-S_Y9cb04.mjs";
|
|
3
|
-
import { f as
|
|
3
|
+
import { f as w } from "../css-C8WrrxT-.mjs";
|
|
4
4
|
import { i as E, m as P } from "../element-internals-Dw7LndlH.mjs";
|
|
5
5
|
import { e as $, o as _, a as I } from "../icons-registry.mjs";
|
|
6
|
-
import { g as
|
|
7
|
-
import { o as
|
|
6
|
+
import { g as z } from "../svg-utils-DOL__czZ.mjs";
|
|
7
|
+
import { o as F } from "../unsafe-svg-C3uTocNg.mjs";
|
|
8
8
|
import "./icon-button.mjs";
|
|
9
9
|
import { i as O, t as L, e as R } from "../directive-oAbCiebi.mjs";
|
|
10
10
|
import { f as q } from "../directive-helpers-BHuwIghp.mjs";
|
|
@@ -226,7 +226,7 @@ var U = Object.defineProperty, W = Object.getOwnPropertyDescriptor, c = (e, t, o
|
|
|
226
226
|
(a = e[s]) && (n = (i ? a(t, o, n) : a(n)) || n);
|
|
227
227
|
return i && n && U(t, o, n), n;
|
|
228
228
|
};
|
|
229
|
-
let l = class extends S(
|
|
229
|
+
let l = class extends S(x) {
|
|
230
230
|
constructor() {
|
|
231
231
|
super(...arguments), this.open = !1, this.showHeader = !0, this.showFooter = !1, this.showHeaderStartIcon = !1, this.headerTitle = "", this.headerTitleClassName = "panel-title", this.labelDialog = "", this.labelAriaDialogPanel = "", this.addToBagProductCount = "", this.closeButtonLabel = "Close the modal", this.goBackButtonLabel = "Go back to", this.firstButtonLabel = "Close", this.firstButtonVariant = "primary", this.firstButtonProps = {}, this.onFirstButtonClickClose = !1, this.secondButtonLabel = "", this.secondButtonVariant = "secondary", this.secondButtonProps = {}, this.onSecondButtonClickClose = !1, this.stickyFooter = !1, this.disablePortal = !1, this.zIndex = 99, this.initialized = !1, this.showDetail = !1, this.isHidingDetail = !1, this.previousFocusedElement = null, this.previousFocusedSelector = null, this._hideTimeout = null, this._onOpenDetail = async (e) => {
|
|
232
232
|
var o, i;
|
|
@@ -658,7 +658,7 @@ l.styles = C`
|
|
|
658
658
|
|
|
659
659
|
.panel:focus-visible,
|
|
660
660
|
.close-btn:focus-visible {
|
|
661
|
-
${
|
|
661
|
+
${w}
|
|
662
662
|
}
|
|
663
663
|
|
|
664
664
|
[role="document"] {
|
|
@@ -762,7 +762,7 @@ l.styles = C`
|
|
|
762
762
|
l.focusablesSelector = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"]), o-icon-button, o-button';
|
|
763
763
|
l.focusablesCustomElementsSelector = "o-icon-button, o-button";
|
|
764
764
|
l.shadowRootOptions = {
|
|
765
|
-
...
|
|
765
|
+
...x.shadowRootOptions,
|
|
766
766
|
// This helps send focus into the first focusable in shadow when host is focused
|
|
767
767
|
delegatesFocus: !0
|
|
768
768
|
};
|
|
@@ -849,7 +849,7 @@ var G = Object.defineProperty, Q = Object.getOwnPropertyDescriptor, u = (e, t, o
|
|
|
849
849
|
(a = e[s]) && (n = (i ? a(t, o, n) : a(n)) || n);
|
|
850
850
|
return i && n && G(t, o, n), n;
|
|
851
851
|
};
|
|
852
|
-
const J = S(P(
|
|
852
|
+
const J = S(P(x)), lt = ["primary", "secondary", "ghost", "tertiary", "link"];
|
|
853
853
|
let d = class extends J {
|
|
854
854
|
constructor() {
|
|
855
855
|
super(...arguments), this.type = "submit", this.value = "", this.variant = "primary", this.text = "", this.textsecond = "", this.fullwidth = !1, this.disabled = !1, this.startIconModel = "", this.endIconModel = "", this.startIcon = !1, this.endIcon = !1, this.panelTarget = "", this.href = "", this.target = "", this.underlined = !1, this.withbadge = !1, this.hideRoleButton = !1, this.describedBy = null, this.ariaExpanded = null;
|
|
@@ -887,8 +887,8 @@ let d = class extends J {
|
|
|
887
887
|
if (!t) return p;
|
|
888
888
|
const o = I[t] ?? "";
|
|
889
889
|
if (!o) return p;
|
|
890
|
-
const i =
|
|
891
|
-
return h`<span class="${e === "start" ? "icon-start" : "icon-end"}">${
|
|
890
|
+
const i = z(o);
|
|
891
|
+
return h`<span class="${e === "start" ? "icon-start" : "icon-end"}">${F(i)}</span>`;
|
|
892
892
|
}
|
|
893
893
|
renderButton() {
|
|
894
894
|
const e = this.text || this.textsecond;
|
|
@@ -943,7 +943,7 @@ d.styles = C`
|
|
|
943
943
|
}
|
|
944
944
|
|
|
945
945
|
:host(.a--tabfocus) .button {
|
|
946
|
-
${
|
|
946
|
+
${w};
|
|
947
947
|
}
|
|
948
948
|
|
|
949
949
|
:host([fullwidth]) {
|
|
@@ -1000,6 +1000,50 @@ d.styles = C`
|
|
|
1000
1000
|
--button-endicon-svg-width: 8px;
|
|
1001
1001
|
}
|
|
1002
1002
|
|
|
1003
|
+
:host([variant="link"]) {
|
|
1004
|
+
--button-bg: transparent;
|
|
1005
|
+
--button-bg-hover: transparent;
|
|
1006
|
+
--button-bg-pressed: transparent;
|
|
1007
|
+
--button-text: var(--color-content-action-secondary);
|
|
1008
|
+
--button-text-hover: var(--color-content-action-secondary);
|
|
1009
|
+
--button-border: transparent;
|
|
1010
|
+
--button-border-width: 0;
|
|
1011
|
+
--button-padding: 0;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
:host([variant="link"]) .button {
|
|
1015
|
+
background-color: transparent;
|
|
1016
|
+
min-width: auto;
|
|
1017
|
+
min-height: auto;
|
|
1018
|
+
width: auto;
|
|
1019
|
+
border: 0;
|
|
1020
|
+
padding: 0;
|
|
1021
|
+
position: relative;
|
|
1022
|
+
color: var(--color-content-action-secondary);
|
|
1023
|
+
font-size: var(--font-size-200);
|
|
1024
|
+
font-weight: var(--font-weight-400);
|
|
1025
|
+
line-height: var(--line-height-240);
|
|
1026
|
+
letter-spacing: var(--letter-spacing-400);
|
|
1027
|
+
font-family: var(--font-family-loccitane-serif);
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
:host([variant="link"]) .button::after {
|
|
1031
|
+
content: "";
|
|
1032
|
+
position: absolute;
|
|
1033
|
+
left: 0;
|
|
1034
|
+
bottom: 0;
|
|
1035
|
+
width: 100%;
|
|
1036
|
+
opacity: 1;
|
|
1037
|
+
height: 1px;
|
|
1038
|
+
background-color: currentColor;
|
|
1039
|
+
transition: opacity 0.3s ease, height 0.3s ease;
|
|
1040
|
+
pointer-events: none;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
:host([variant="link"]) .button:hover::after {
|
|
1044
|
+
opacity: 0;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1003
1047
|
:host([disabled]),
|
|
1004
1048
|
:host([aria-disabled="true"]),
|
|
1005
1049
|
:host([aria-disabled="true"]:hover) {
|
|
@@ -1050,7 +1094,7 @@ d.styles = C`
|
|
|
1050
1094
|
}
|
|
1051
1095
|
|
|
1052
1096
|
.button:focus-visible {
|
|
1053
|
-
${
|
|
1097
|
+
${w};
|
|
1054
1098
|
}
|
|
1055
1099
|
|
|
1056
1100
|
span.text + span.text::before {
|