asma-ui-core 3.101.4 → 3.101.6
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/dist/asma-ui-core.css +1 -1
- package/dist/components/data-display/badge/StyledBadge.js +33 -29
- package/dist/components/inputs/slider/StyledSlider.js +156 -122
- package/dist/src/components/data-display/badge/StyledBadge.d.ts +6 -5
- package/dist/src/components/inputs/slider/StyledSlider.d.ts +12 -2
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { resolveSx as
|
|
2
|
-
import
|
|
3
|
-
import { useEffect as
|
|
4
|
-
import { jsx as
|
|
5
|
-
var
|
|
1
|
+
import { resolveSx as g } from "../../../helpers/sx.js";
|
|
2
|
+
import y from "clsx";
|
|
3
|
+
import { useEffect as Z, useRef as h } from "react";
|
|
4
|
+
import { jsx as _, jsxs as G } from "react/jsx-runtime";
|
|
5
|
+
var w = {
|
|
6
6
|
primary: {
|
|
7
7
|
backgroundColor: "var(--colors-badge-background)",
|
|
8
8
|
color: "var(--colors-badge-label)"
|
|
@@ -31,43 +31,47 @@ var _ = {
|
|
|
31
31
|
backgroundColor: "var(--colors-warning-700)",
|
|
32
32
|
color: "#fff"
|
|
33
33
|
}
|
|
34
|
-
},
|
|
34
|
+
}, H = {
|
|
35
35
|
"top-right": "top-0 right-0 translate-x-1/2 -translate-y-1/2 origin-[100%_0%]",
|
|
36
36
|
"top-left": "top-0 left-0 -translate-x-1/2 -translate-y-1/2 origin-[0%_0%]",
|
|
37
37
|
"bottom-right": "bottom-0 right-0 translate-x-1/2 translate-y-1/2 origin-[100%_100%]",
|
|
38
38
|
"bottom-left": "bottom-0 left-0 -translate-x-1/2 translate-y-1/2 origin-[0%_100%]"
|
|
39
|
-
},
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}, [
|
|
44
|
-
const x = e && typeof e == "object" && !Array.isArray(e) ? e : {},
|
|
39
|
+
}, S = "& .MuiBadge-badge", P = ({ color: i = "primary", dataTest: k, size: c = "medium", badgeContent: o, max: W, showZero: X, variant: j = "standard", purpose: A = "notification", statusMessage: d, invisible: C, anchorOrigin: f, children: p, className: u, sx: e, overlap: Y, classes: q, slots: F, slotProps: m, component: J, tabIndex: K, "aria-label": a, ...O }) => {
|
|
40
|
+
const n = h(null), l = typeof o == "number" ? o : void 0, b = h(l);
|
|
41
|
+
Z(() => {
|
|
42
|
+
l !== b.current && (b.current = l, n.current && (n.current.textContent = d ?? ""));
|
|
43
|
+
}, [l, d]);
|
|
44
|
+
const x = e && typeof e == "object" && !Array.isArray(e) ? e : {}, R = g(x[S]), B = g(Object.fromEntries(Object.entries(x).filter(([T]) => T !== S))), r = j === "dot", s = r && A !== "notification", t = p === void 0, v = !!C || !r && (o === 0 || o === void 0 || o === null), D = r ? null : typeof o == "number" && o > 99 ? "99+" : o, E = typeof o == "number" && o > 0 && o < 10, N = f?.vertical ?? "top", $ = f?.horizontal ?? "right", z = i === "primary" && !s ? {
|
|
45
45
|
borderColor: r ? "var(--colors-badge-border-dot)" : "var(--colors-badge-border-count)",
|
|
46
46
|
borderStyle: "solid",
|
|
47
47
|
borderWidth: r ? "var(--border-badge-dot)" : "var(--border-badge-count)"
|
|
48
|
-
} : {},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
} : {}, I = t && !v && a ? {
|
|
49
|
+
role: "img",
|
|
50
|
+
"aria-label": a
|
|
51
|
+
} : {}, L = !t && a ? { "aria-label": a } : {};
|
|
52
|
+
return /* @__PURE__ */ G("span", {
|
|
53
|
+
className: t ? y("inline-flex shrink-0 align-middle", u) : "relative inline-flex shrink-0 align-middle",
|
|
54
|
+
"data-testid": k,
|
|
55
|
+
style: B,
|
|
56
|
+
...L,
|
|
57
|
+
...I,
|
|
58
|
+
...O,
|
|
55
59
|
children: [
|
|
56
|
-
|
|
57
|
-
!
|
|
60
|
+
p,
|
|
61
|
+
!v && /* @__PURE__ */ _("span", {
|
|
58
62
|
"aria-hidden": "true",
|
|
59
|
-
className:
|
|
63
|
+
className: y("box-border flex items-center justify-center whitespace-nowrap font-roboto font-semibold", !t && "absolute z-[1]", !t && H[`${N}-${$}`], s ? "h-[8px] w-[8px] min-w-[8px] rounded-full p-0" : r ? "h-[12px] w-[12px] min-w-[12px] rounded-full p-0" : c === "small" ? "h-[16px] w-max min-w-[16px] rounded-[20px] px-[4px] text-[0.75rem]" : "h-[20px] min-w-[20px] rounded-[20px] px-[6px] text-sm leading-5", !r && c === "medium" && E && "w-[20px]", !t && u, m?.badge?.className),
|
|
60
64
|
style: {
|
|
61
|
-
...
|
|
62
|
-
...
|
|
63
|
-
...
|
|
64
|
-
...
|
|
65
|
+
...w[i] ?? w.default,
|
|
66
|
+
...s ? { backgroundColor: "var(--colors-gama-500)" } : {},
|
|
67
|
+
...z,
|
|
68
|
+
...R,
|
|
65
69
|
...m?.badge?.style
|
|
66
70
|
},
|
|
67
71
|
children: D
|
|
68
72
|
}),
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
ref:
|
|
73
|
+
/* @__PURE__ */ _("span", {
|
|
74
|
+
ref: n,
|
|
71
75
|
"aria-atomic": "true",
|
|
72
76
|
"aria-live": "polite",
|
|
73
77
|
className: "sr-only",
|
|
@@ -77,5 +81,5 @@ var _ = {
|
|
|
77
81
|
});
|
|
78
82
|
};
|
|
79
83
|
export {
|
|
80
|
-
|
|
84
|
+
P as StyledBadge
|
|
81
85
|
};
|
|
@@ -1,174 +1,208 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { PlusIcon as
|
|
3
|
-
import { RemoveIcon as
|
|
4
|
-
import { StyledButton as
|
|
5
|
-
import { HelperRow as
|
|
6
|
-
import { useHelperSlot as
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { cn as u } from "../../../helpers/cn.js";
|
|
2
|
+
import { PlusIcon as St } from "../../icons/plus-icon/PlusIcon.js";
|
|
3
|
+
import { RemoveIcon as At } from "../../icons/remove-icon/RemoveIcon.js";
|
|
4
|
+
import { StyledButton as rt } from "../button/StyledButton.js";
|
|
5
|
+
import { HelperRow as Tt } from "../../../helpers/HelperRow.js";
|
|
6
|
+
import { useHelperSlot as Vt } from "../../../helpers/useHelperSlot.js";
|
|
7
|
+
import { StyledInputField as Rt } from "../input-field/StyledInputField.js";
|
|
8
|
+
import { StyledSelectAutocomplete as Dt } from "../select-autocomplete/StyledSelectAutocomplete.js";
|
|
9
|
+
import M from "./StyledSlider.module.js";
|
|
10
|
+
import { useId as $t, useRef as nt, useState as ot } from "react";
|
|
11
|
+
import { jsx as c, jsxs as x } from "react/jsx-runtime";
|
|
12
|
+
var K = (i, r, a) => a === r ? 0 : Math.min(100, Math.max(0, (i - r) / (a - r) * 100)), Ct = (i) => Array.isArray(i) ? [i[0] ?? 0, i[1] ?? 0] : null, Ht = 10;
|
|
13
|
+
function Ut(i) {
|
|
14
|
+
return (i?.length ?? 0) > Ht;
|
|
15
|
+
}
|
|
16
|
+
function Bt({ dataTest: i, min: r = 0, max: a = 100, step: h = 1, value: T, defaultValue: at, disabled: s, size: X = "medium", orientation: Y = "horizontal", marks: V, name: q, className: ct, classes: p, slotProps: R, error: N, errorText: ut, helperText: B, reserveHelperText: it, fromLabel: D, toLabel: $, showButtons: G = !0, ariaLabel: g, ariaLabelledBy: C, onChange: P, onChangeCommitted: H, options: U, autocompleteClassName: st, autocompleteValue: dt, getOptionLabel: ft, isOptionEqualToValue: mt, onAutocompleteChange: ht }) {
|
|
17
|
+
const J = $t(), n = Y === "vertical", d = X === "small" ? 6 : 8, b = nt(null), v = nt(null), [pt, I] = ot(null), [bt, Q] = ot(at ?? r), y = pt ?? T ?? bt, o = Ct(y), f = o !== null, k = N ? ut ?? B : B, { show: z, role: gt } = Vt("StyledSlider", N, k, it);
|
|
18
|
+
if (U?.length && Ut(U)) return /* @__PURE__ */ c(Dt, {
|
|
19
|
+
dataTest: i,
|
|
20
|
+
disableClearable: !0,
|
|
21
|
+
className: u("min-w-[200px]", st),
|
|
22
|
+
size: "small",
|
|
23
|
+
disabled: s,
|
|
24
|
+
error: N,
|
|
25
|
+
helperText: z ? k : "",
|
|
26
|
+
options: U,
|
|
27
|
+
getOptionLabel: ft,
|
|
28
|
+
isOptionEqualToValue: mt,
|
|
29
|
+
value: dt,
|
|
30
|
+
onChange: ht,
|
|
31
|
+
renderInput: (t) => /* @__PURE__ */ c(Rt, {
|
|
32
|
+
dataTest: i,
|
|
33
|
+
...t,
|
|
34
|
+
name: q,
|
|
35
|
+
slotProps: {
|
|
36
|
+
...t.slotProps,
|
|
37
|
+
htmlInput: {
|
|
38
|
+
...t.slotProps.htmlInput,
|
|
39
|
+
...g ? { "aria-label": typeof g == "function" ? g(0) : g } : {},
|
|
40
|
+
...C ? { "aria-labelledby": C } : {}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
const _ = (V === !0 && Number.isFinite(h) && h > 0 && a > r ? Array.from({ length: Math.floor((a - r) / h) + 1 }, (t, l) => ({ value: r + h * l })) : Array.isArray(V) ? V : []).filter((t) => t.value >= r && t.value <= a), W = f ? Math.min(o[0], o[1]) : r, E = f ? Math.max(o[0], o[1]) : y, Z = (t) => f ? t >= W && t <= E : t <= E, vt = f ? Math.min(o[0], o[1]) <= r : y <= r, yt = f ? Math.max(o[0], o[1]) >= a : y >= a, F = f ? K(W, r, a) : 0, L = K(E, r, a) - F, wt = n ? {
|
|
46
|
+
bottom: `${F}%`,
|
|
47
|
+
height: `${L}%`
|
|
14
48
|
} : {
|
|
15
|
-
left: `${
|
|
16
|
-
width: `${
|
|
17
|
-
},
|
|
18
|
-
const
|
|
19
|
-
return
|
|
20
|
-
},
|
|
21
|
-
const
|
|
22
|
-
return Math.min(
|
|
23
|
-
},
|
|
24
|
-
if (
|
|
25
|
-
const
|
|
26
|
-
b.current = e,
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
if (
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
if (
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
b.current === null || t.pointerId !==
|
|
39
|
-
},
|
|
40
|
-
if (
|
|
49
|
+
left: `${F}%`,
|
|
50
|
+
width: `${L}%`
|
|
51
|
+
}, tt = (t) => {
|
|
52
|
+
const l = K(t, r, a);
|
|
53
|
+
return n ? { bottom: `${l}%` } : { left: `${l}%` };
|
|
54
|
+
}, O = (t) => {
|
|
55
|
+
const l = t.currentTarget.getBoundingClientRect(), e = n ? 1 - (t.clientY - (l.top + d)) / (l.height - d * 2) : (t.clientX - (l.left + d)) / (l.width - d * 2), m = r + Math.round(Math.min(1, Math.max(0, e)) * ((a - r) / h)) * h;
|
|
56
|
+
return Math.min(a, Math.max(r, m));
|
|
57
|
+
}, xt = (t) => f && Math.abs((o?.[1] ?? r) - t) < Math.abs((o?.[0] ?? r) - t) ? 1 : 0, Nt = (t) => {
|
|
58
|
+
if (s) return;
|
|
59
|
+
const l = O(t), e = xt(l);
|
|
60
|
+
b.current = e, v.current = t.pointerId, t.currentTarget.setPointerCapture(t.pointerId);
|
|
61
|
+
const m = S(l, e);
|
|
62
|
+
I(m), P?.(t, m, e);
|
|
63
|
+
}, Mt = (t) => {
|
|
64
|
+
if (s || b.current === null || t.pointerId !== v.current) return;
|
|
65
|
+
const l = b.current, e = S(O(t), l);
|
|
66
|
+
I(e), P?.(t, e, l);
|
|
67
|
+
}, Pt = (t) => {
|
|
68
|
+
if (s || b.current === null || t.pointerId !== v.current) return;
|
|
69
|
+
const l = b.current, e = S(O(t), l);
|
|
70
|
+
T === void 0 && Q(e), H?.(t, e), t.currentTarget.hasPointerCapture(t.pointerId) && t.currentTarget.releasePointerCapture(t.pointerId), I(null), b.current = null, v.current = null;
|
|
71
|
+
}, It = (t) => {
|
|
72
|
+
b.current === null || t.pointerId !== v.current || (I(null), b.current = null, v.current = null);
|
|
73
|
+
}, et = (t) => (l) => {
|
|
74
|
+
if (s) return;
|
|
41
75
|
const e = t === "increment" ? h || 1 : -(h || 1);
|
|
42
|
-
let
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
if (!
|
|
48
|
-
const e = [
|
|
49
|
-
return e[
|
|
50
|
-
},
|
|
51
|
-
const w =
|
|
52
|
-
|
|
53
|
-
},
|
|
76
|
+
let m = 0, w;
|
|
77
|
+
f ? (m = t === "increment" ? 1 : 0, w = t === "increment" ? Math.max(o[0], o[1]) : Math.min(o[0], o[1])) : w = y;
|
|
78
|
+
const lt = Math.min(a, Math.max(r, w + e));
|
|
79
|
+
A(P, l, lt, m), A(H, l, lt, m);
|
|
80
|
+
}, S = (t, l) => {
|
|
81
|
+
if (!f) return t;
|
|
82
|
+
const e = [o?.[0] ?? 0, o?.[1] ?? 0];
|
|
83
|
+
return e[l] = t, l === 0 && e[0] > e[1] && (e[0] = e[1]), l === 1 && e[1] < e[0] && (e[1] = e[0]), e;
|
|
84
|
+
}, A = (t, l, e, m) => {
|
|
85
|
+
const w = S(e, m);
|
|
86
|
+
T === void 0 && Q(w), t && t(l, w, m);
|
|
87
|
+
}, j = (t, l) => /* @__PURE__ */ c("input", {
|
|
54
88
|
type: "range",
|
|
55
|
-
"data-testid":
|
|
56
|
-
name:
|
|
57
|
-
min:
|
|
58
|
-
max:
|
|
89
|
+
"data-testid": f ? `${i}-thumb-${t}` : i,
|
|
90
|
+
name: q,
|
|
91
|
+
min: r,
|
|
92
|
+
max: a,
|
|
59
93
|
step: h,
|
|
60
|
-
value:
|
|
61
|
-
disabled:
|
|
62
|
-
"aria-orientation":
|
|
63
|
-
"aria-label": typeof
|
|
64
|
-
"aria-labelledby":
|
|
94
|
+
value: l,
|
|
95
|
+
disabled: s,
|
|
96
|
+
"aria-orientation": Y,
|
|
97
|
+
"aria-label": typeof g == "function" ? g(t) : g,
|
|
98
|
+
"aria-labelledby": C,
|
|
65
99
|
"aria-invalid": N ? !0 : void 0,
|
|
66
|
-
"aria-describedby":
|
|
67
|
-
className:
|
|
68
|
-
onChange: (e) =>
|
|
69
|
-
onKeyUp: (e) =>
|
|
100
|
+
"aria-describedby": z ? J : void 0,
|
|
101
|
+
className: u(M.SliderInput, n ? M.Vertical : M.Horizontal, !n && "z-0", X === "small" && M.Small, s && M.Disabled, p?.thumb, R?.thumb?.className),
|
|
102
|
+
onChange: (e) => A(P, e, Number(e.currentTarget.value), t),
|
|
103
|
+
onKeyUp: (e) => A(H, e, Number(e.currentTarget.value), t)
|
|
70
104
|
}, t);
|
|
71
|
-
return /* @__PURE__ */
|
|
72
|
-
className:
|
|
105
|
+
return /* @__PURE__ */ x("div", {
|
|
106
|
+
className: u("flex max-w-[600px] flex-col gap-3", n && "h-full"),
|
|
73
107
|
children: [
|
|
74
|
-
!
|
|
108
|
+
!n && (D ?? $) && /* @__PURE__ */ x("div", {
|
|
75
109
|
className: "grid w-full grid-cols-2 gap-4",
|
|
76
|
-
children: [!
|
|
110
|
+
children: [!n && D && /* @__PURE__ */ c("span", {
|
|
77
111
|
className: "min-w-0 break-words text-left font-normal text-delta-800",
|
|
78
|
-
children: T
|
|
79
|
-
}), !a && D && /* @__PURE__ */ i("span", {
|
|
80
|
-
className: "min-w-0 break-words text-right font-normal text-delta-800",
|
|
81
112
|
children: D
|
|
113
|
+
}), !n && $ && /* @__PURE__ */ c("span", {
|
|
114
|
+
className: "min-w-0 break-words text-right font-normal text-delta-800",
|
|
115
|
+
children: $
|
|
82
116
|
})]
|
|
83
117
|
}),
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
className:
|
|
118
|
+
/* @__PURE__ */ x("div", {
|
|
119
|
+
className: u("flex", !n && "w-full items-start gap-3", n && "h-full flex-col items-center"),
|
|
86
120
|
children: [
|
|
87
|
-
!
|
|
121
|
+
!n && G && /* @__PURE__ */ c(rt, {
|
|
88
122
|
dataTest: "slider-from-button",
|
|
89
123
|
"aria-label": "Decrease value",
|
|
90
124
|
className: "-mt-0.5 w-8",
|
|
91
125
|
variant: "outlined",
|
|
92
|
-
disabled:
|
|
93
|
-
startIcon: /* @__PURE__ */
|
|
126
|
+
disabled: s ?? vt,
|
|
127
|
+
startIcon: /* @__PURE__ */ c(At, {
|
|
94
128
|
width: 24,
|
|
95
129
|
height: 24
|
|
96
130
|
}),
|
|
97
|
-
onClick:
|
|
131
|
+
onClick: et("decrement")
|
|
98
132
|
}),
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
-
className:
|
|
101
|
-
children: [/* @__PURE__ */
|
|
102
|
-
className:
|
|
133
|
+
/* @__PURE__ */ x("div", {
|
|
134
|
+
className: u("relative flex", n ? "h-full w-8 flex-col items-center" : "mt-px w-full flex-col", p?.root, ct),
|
|
135
|
+
children: [/* @__PURE__ */ x("div", {
|
|
136
|
+
className: u("relative", n ? "h-full w-8" : "h-4 w-full", s ? "cursor-default" : "cursor-pointer"),
|
|
103
137
|
style: { touchAction: "none" },
|
|
104
|
-
onPointerDown:
|
|
105
|
-
onPointerMove:
|
|
106
|
-
onPointerUp:
|
|
107
|
-
onPointerCancel:
|
|
108
|
-
children: [/* @__PURE__ */
|
|
109
|
-
className:
|
|
110
|
-
style:
|
|
111
|
-
top:
|
|
112
|
-
bottom:
|
|
138
|
+
onPointerDown: Nt,
|
|
139
|
+
onPointerMove: Mt,
|
|
140
|
+
onPointerUp: Pt,
|
|
141
|
+
onPointerCancel: It,
|
|
142
|
+
children: [/* @__PURE__ */ x("div", {
|
|
143
|
+
className: u("absolute", n ? "left-1/2 w-1 -translate-x-1/2" : "top-[calc(50%+6px)] h-1 -translate-y-1/2"),
|
|
144
|
+
style: n ? {
|
|
145
|
+
top: d,
|
|
146
|
+
bottom: d
|
|
113
147
|
} : {
|
|
114
|
-
left:
|
|
115
|
-
right:
|
|
148
|
+
left: d,
|
|
149
|
+
right: d
|
|
116
150
|
},
|
|
117
151
|
children: [
|
|
118
|
-
/* @__PURE__ */
|
|
119
|
-
/* @__PURE__ */
|
|
120
|
-
className:
|
|
121
|
-
style:
|
|
152
|
+
/* @__PURE__ */ c("div", { className: u("absolute inset-0 rounded-full bg-delta-100", p?.rail, R?.rail?.className) }),
|
|
153
|
+
/* @__PURE__ */ c("div", {
|
|
154
|
+
className: u("absolute rounded-full", n ? "left-0 w-full" : "top-0 h-full", s ? "bg-delta-200" : "bg-gama-500", p?.track),
|
|
155
|
+
style: wt
|
|
122
156
|
}),
|
|
123
|
-
|
|
124
|
-
const
|
|
125
|
-
return /* @__PURE__ */
|
|
126
|
-
className:
|
|
127
|
-
style:
|
|
157
|
+
_.map((t) => {
|
|
158
|
+
const l = Z(t.value);
|
|
159
|
+
return /* @__PURE__ */ c("span", {
|
|
160
|
+
className: u("absolute z-10 box-border h-2 w-2 -translate-x-1/2 rounded-full border border-solid", n ? "left-1/2 translate-y-1/2" : "top-1/2 -translate-y-1/2", l ? u(s ? "border-delta-200 bg-delta-200" : "border-gama-500 bg-gama-500", p?.markActive) : u("border-delta-300 bg-white", p?.mark)),
|
|
161
|
+
style: tt(t.value)
|
|
128
162
|
}, t.value);
|
|
129
163
|
})
|
|
130
164
|
]
|
|
131
|
-
}),
|
|
132
|
-
}),
|
|
133
|
-
className:
|
|
134
|
-
style:
|
|
135
|
-
top:
|
|
136
|
-
bottom:
|
|
165
|
+
}), f ? [j(0, o[0]), j(1, o[1])] : j(0, y)]
|
|
166
|
+
}), _.some((t) => t.label != null) && /* @__PURE__ */ c("div", {
|
|
167
|
+
className: u(n ? "pointer-events-none absolute inset-x-0" : "relative mt-[14px] h-6"),
|
|
168
|
+
style: n ? {
|
|
169
|
+
top: d,
|
|
170
|
+
bottom: d
|
|
137
171
|
} : {
|
|
138
|
-
marginLeft:
|
|
139
|
-
marginRight:
|
|
172
|
+
marginLeft: d,
|
|
173
|
+
marginRight: d
|
|
140
174
|
},
|
|
141
|
-
children:
|
|
142
|
-
className:
|
|
143
|
-
style:
|
|
175
|
+
children: _.map((t) => t.label == null ? null : /* @__PURE__ */ c("span", {
|
|
176
|
+
className: u("absolute text-base font-semibold text-delta-700", n ? "left-[37px] translate-y-1/2" : "-translate-x-1/2", Z(t.value) && p?.markLabelActive, p?.markLabel, R?.markLabel?.className),
|
|
177
|
+
style: tt(t.value),
|
|
144
178
|
children: t.label
|
|
145
179
|
}, t.value))
|
|
146
180
|
})]
|
|
147
181
|
}),
|
|
148
|
-
!
|
|
182
|
+
!n && G && /* @__PURE__ */ c(rt, {
|
|
149
183
|
dataTest: "slider-to-button",
|
|
150
184
|
"aria-label": "Increase value",
|
|
151
185
|
className: "-mt-0.5 w-8",
|
|
152
186
|
variant: "outlined",
|
|
153
|
-
disabled:
|
|
154
|
-
startIcon: /* @__PURE__ */
|
|
187
|
+
disabled: s ?? yt,
|
|
188
|
+
startIcon: /* @__PURE__ */ c(St, {
|
|
155
189
|
width: 24,
|
|
156
190
|
height: 24
|
|
157
191
|
}),
|
|
158
|
-
onClick:
|
|
192
|
+
onClick: et("increment")
|
|
159
193
|
})
|
|
160
194
|
]
|
|
161
195
|
}),
|
|
162
|
-
|
|
163
|
-
id:
|
|
164
|
-
role:
|
|
196
|
+
z && /* @__PURE__ */ c(Tt, {
|
|
197
|
+
id: J,
|
|
198
|
+
role: gt,
|
|
165
199
|
error: N,
|
|
166
|
-
message:
|
|
200
|
+
message: k,
|
|
167
201
|
className: "m-0 items-center"
|
|
168
202
|
})
|
|
169
203
|
]
|
|
170
204
|
});
|
|
171
|
-
}
|
|
205
|
+
}
|
|
172
206
|
export {
|
|
173
|
-
|
|
207
|
+
Bt as StyledSlider
|
|
174
208
|
};
|
|
@@ -8,9 +8,10 @@ type StyledBadgePurpose = 'notification' | 'unread' | 'filter';
|
|
|
8
8
|
* `dot` = 12px lime circle with a stronger 2px border. Other colors and `small` are legacy app
|
|
9
9
|
* extensions with no matching Figma notification variant.
|
|
10
10
|
*
|
|
11
|
-
* Pass children to decorate them — the badge anchors to their corner. Pass none and
|
|
12
|
-
* a flow element (Figma `Size=Dot`, node 44267-214524), for a
|
|
13
|
-
* `className` then applies to the badge's own root so the
|
|
11
|
+
* Pass children to decorate them — the badge anchors to their corner. Pass none and the badge,
|
|
12
|
+
* count or dot, becomes a flow element (for the dot, Figma `Size=Dot`, node 44267-214524), for a
|
|
13
|
+
* table cell or a marker in a row, and `className` then applies to the badge's own root so the
|
|
14
|
+
* caller can place it.
|
|
14
15
|
*
|
|
15
16
|
* `purpose` selects Figma's `Parent`: the default notification dot, or the 8px solid primary dot
|
|
16
17
|
* that marks something unread or a filter as active.
|
|
@@ -26,7 +27,7 @@ interface BadgeProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'color'> {
|
|
|
26
27
|
showZero?: boolean;
|
|
27
28
|
/**
|
|
28
29
|
* @figmaProp Size = dot→"Dot" (12px) | standard→"Default" count badge
|
|
29
|
-
*
|
|
30
|
+
* With no children the badge renders in normal flow rather than anchored to a corner.
|
|
30
31
|
*/
|
|
31
32
|
variant?: 'standard' | 'dot';
|
|
32
33
|
/**
|
|
@@ -64,5 +65,5 @@ type StyledBadgeProps = BadgeProps & {
|
|
|
64
65
|
* The established styling API `sx={{ '& .MuiBadge-badge': {...} }}` is preserved by extracting that
|
|
65
66
|
* slot and applying `resolveSx` to the badge span (DEC-007 slot-sx). Signature unchanged (DEC-003).
|
|
66
67
|
*/
|
|
67
|
-
export declare const StyledBadge: ({ color, dataTest, size, badgeContent, max: _max, showZero: _showZero, variant, purpose, statusMessage, invisible, anchorOrigin, children, className, sx, overlap: _overlap, classes: _classes, slots: _slots, slotProps, component: _component, tabIndex: _tabIndex, ...props }: StyledBadgeProps) => JSX.Element;
|
|
68
|
+
export declare const StyledBadge: ({ color, dataTest, size, badgeContent, max: _max, showZero: _showZero, variant, purpose, statusMessage, invisible, anchorOrigin, children, className, sx, overlap: _overlap, classes: _classes, slots: _slots, slotProps, component: _component, tabIndex: _tabIndex, "aria-label": ariaLabel, ...props }: StyledBadgeProps) => JSX.Element;
|
|
68
69
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactNode, SyntheticEvent } from 'react';
|
|
2
|
+
import { AutocompleteChangeReason } from '../select-autocomplete';
|
|
2
3
|
export interface SliderMark {
|
|
3
4
|
value: number;
|
|
4
5
|
label?: ReactNode;
|
|
@@ -31,7 +32,7 @@ interface SliderSlotProps {
|
|
|
31
32
|
* DS slider: rail `delta-100` (4px), filled track + thumb + active dots `gama-500`, inactive dots
|
|
32
33
|
* white/`delta-300`, scale numbers Body Base SemiBold 16/24 `delta-700`. Disabled → `delta-200`.
|
|
33
34
|
*/
|
|
34
|
-
export interface StyledSliderProps {
|
|
35
|
+
export interface StyledSliderProps<T = unknown> {
|
|
35
36
|
dataTest: string;
|
|
36
37
|
min?: number;
|
|
37
38
|
max?: number;
|
|
@@ -60,6 +61,15 @@ export interface StyledSliderProps {
|
|
|
60
61
|
ariaLabelledBy?: string;
|
|
61
62
|
onChange?: (event: SyntheticEvent, value: SliderValue, activeThumb: number) => void;
|
|
62
63
|
onChangeCommitted?: (event: SyntheticEvent, value: SliderValue) => void;
|
|
64
|
+
/** Autocomplete options */
|
|
65
|
+
options?: readonly T[];
|
|
66
|
+
autocompleteClassName?: string;
|
|
67
|
+
autocompleteValue?: T | null;
|
|
68
|
+
getOptionLabel?: (option: T) => string;
|
|
69
|
+
isOptionEqualToValue?: (option: T, value: T) => boolean;
|
|
70
|
+
onAutocompleteChange?: (event: SyntheticEvent, value: T | null, reason: AutocompleteChangeReason, details?: {
|
|
71
|
+
option: T;
|
|
72
|
+
}) => void;
|
|
63
73
|
}
|
|
64
74
|
/**
|
|
65
75
|
* Native range-input slider (replaces MUI `Slider`). Single value uses one `<input type="range">`;
|
|
@@ -70,5 +80,5 @@ export interface StyledSliderProps {
|
|
|
70
80
|
* CI is the visual gate. Upgrade path: tune the 8px thumb inset if a diff shows misalignment.
|
|
71
81
|
* TASK-204.
|
|
72
82
|
*/
|
|
73
|
-
export declare
|
|
83
|
+
export declare function StyledSlider<T>({ dataTest, min, max, step, value, defaultValue, disabled, size, orientation, marks, name, className, classes, slotProps, error, errorText, helperText, reserveHelperText, fromLabel, toLabel, showButtons, ariaLabel, ariaLabelledBy, onChange, onChangeCommitted, options, autocompleteClassName, autocompleteValue, getOptionLabel, isOptionEqualToValue, onAutocompleteChange, }: StyledSliderProps<T>): JSX.Element;
|
|
74
84
|
export {};
|