asma-ui-core 3.87.1 → 3.87.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.
|
@@ -7,7 +7,7 @@ import { useHelperSlot as Mt } from "../../../helpers/useHelperSlot.js";
|
|
|
7
7
|
import x from "./StyledSlider.module.js";
|
|
8
8
|
import { useId as Pt, useRef as et, useState as rt } from "react";
|
|
9
9
|
import { jsx as i, jsxs as y } from "react/jsx-runtime";
|
|
10
|
-
var j = (m, l, o) => o === l ? 0 : Math.min(100, Math.max(0, (m - l) / (o - l) * 100)), It = (m) => Array.isArray(m) ? [m[0] ?? 0, m[1] ?? 0] : null, Ut = ({ dataTest: m, min: l = 0, max: o = 100, step: h = 1, value: V, defaultValue: lt, disabled: u, size: B = "medium", orientation: F = "horizontal", marks: A, name: at, className: nt, classes: p, slotProps: R, error: N, errorText: ot, helperText: K, reserveHelperText: ct, fromLabel: T, toLabel: D, showButtons: X, ariaLabel: $, ariaLabelledBy: it, onChange: M, onChangeCommitted: k }) => {
|
|
10
|
+
var j = (m, l, o) => o === l ? 0 : Math.min(100, Math.max(0, (m - l) / (o - l) * 100)), It = (m) => Array.isArray(m) ? [m[0] ?? 0, m[1] ?? 0] : null, Ut = ({ dataTest: m, min: l = 0, max: o = 100, step: h = 1, value: V, defaultValue: lt, disabled: u, size: B = "medium", orientation: F = "horizontal", marks: A, name: at, className: nt, classes: p, slotProps: R, error: N, errorText: ot, helperText: K, reserveHelperText: ct, fromLabel: T, toLabel: D, showButtons: X = !0, ariaLabel: $, ariaLabelledBy: it, onChange: M, onChangeCommitted: k }) => {
|
|
11
11
|
const Y = Pt(), a = F === "vertical", s = B === "small" ? 6 : 8, b = et(null), g = et(null), [st, P] = rt(null), [ut, q] = rt(lt ?? l), v = st ?? V ?? ut, n = It(v), d = n !== null, E = N ? ot ?? K : K, { show: G, role: dt } = Mt("StyledSlider", N, E, ct), H = (A === !0 && Number.isFinite(h) && h > 0 && o > l ? Array.from({ length: Math.floor((o - l) / h) + 1 }, (t, r) => ({ value: l + h * r })) : Array.isArray(A) ? A : []).filter((t) => t.value >= l && t.value <= o), J = d ? Math.min(n[0], n[1]) : l, U = d ? Math.max(n[0], n[1]) : v, O = (t) => d ? t >= J && t <= U : t <= U, ft = d ? Math.min(n[0], n[1]) <= l : v <= l, ht = d ? Math.max(n[0], n[1]) >= o : v >= o, z = d ? j(J, l, o) : 0, Q = j(U, l, o) - z, mt = a ? {
|
|
12
12
|
bottom: `${z}%`,
|
|
13
13
|
height: `${Q}%`
|
|
@@ -70,34 +70,35 @@ var j = (m, l, o) => o === l ? 0 : Math.min(100, Math.max(0, (m - l) / (o - l) *
|
|
|
70
70
|
}, t);
|
|
71
71
|
return /* @__PURE__ */ y("div", {
|
|
72
72
|
className: c("flex max-w-[600px] flex-col gap-3", a && "h-full"),
|
|
73
|
-
children: [
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
!a &&
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
73
|
+
children: [
|
|
74
|
+
!a && (T ?? D) && /* @__PURE__ */ y("div", {
|
|
75
|
+
className: "grid w-full grid-cols-2 gap-4",
|
|
76
|
+
children: [!a && T && /* @__PURE__ */ i("span", {
|
|
77
|
+
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
|
+
children: D
|
|
82
|
+
})]
|
|
83
|
+
}),
|
|
84
|
+
/* @__PURE__ */ y("div", {
|
|
85
|
+
className: c("flex", !a && "w-full items-start gap-3", a && "h-full flex-col items-center"),
|
|
86
|
+
children: [
|
|
87
|
+
!a && X && /* @__PURE__ */ i(tt, {
|
|
88
|
+
dataTest: "slider-from-button",
|
|
89
|
+
"aria-label": "Decrease value",
|
|
90
|
+
className: "-mt-0.5 w-8",
|
|
91
|
+
variant: "outlined",
|
|
92
|
+
disabled: u ?? ft,
|
|
93
|
+
startIcon: /* @__PURE__ */ i(xt, {
|
|
94
|
+
width: 24,
|
|
95
|
+
height: 24
|
|
96
|
+
}),
|
|
97
|
+
onClick: Z("decrement")
|
|
94
98
|
}),
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
className: c("relative flex", a ? "h-full w-8 flex-col items-center" : "mt-px w-full flex-col", p?.root, nt),
|
|
99
|
-
children: [
|
|
100
|
-
/* @__PURE__ */ y("div", {
|
|
99
|
+
/* @__PURE__ */ y("div", {
|
|
100
|
+
className: c("relative flex", a ? "h-full w-8 flex-col items-center" : "mt-px w-full flex-col", p?.root, nt),
|
|
101
|
+
children: [/* @__PURE__ */ y("div", {
|
|
101
102
|
className: c("relative", a ? "h-full w-8" : "h-4 w-full", u ? "cursor-default" : "cursor-pointer"),
|
|
102
103
|
style: { touchAction: "none" },
|
|
103
104
|
onPointerDown: bt,
|
|
@@ -128,8 +129,7 @@ var j = (m, l, o) => o === l ? 0 : Math.min(100, Math.max(0, (m - l) / (o - l) *
|
|
|
128
129
|
})
|
|
129
130
|
]
|
|
130
131
|
}), d ? [_(0, n[0]), _(1, n[1])] : _(0, v)]
|
|
131
|
-
}),
|
|
132
|
-
H.some((t) => t.label != null) && /* @__PURE__ */ i("div", {
|
|
132
|
+
}), H.some((t) => t.label != null) && /* @__PURE__ */ i("div", {
|
|
133
133
|
className: c(a ? "pointer-events-none absolute inset-x-0" : "relative mt-[14px] h-6"),
|
|
134
134
|
style: a ? {
|
|
135
135
|
top: s,
|
|
@@ -143,30 +143,30 @@ var j = (m, l, o) => o === l ? 0 : Math.min(100, Math.max(0, (m - l) / (o - l) *
|
|
|
143
143
|
style: W(t.value),
|
|
144
144
|
children: t.label
|
|
145
145
|
}, t.value))
|
|
146
|
-
})
|
|
147
|
-
G && /* @__PURE__ */ i(Nt, {
|
|
148
|
-
id: Y,
|
|
149
|
-
role: dt,
|
|
150
|
-
error: N,
|
|
151
|
-
message: E,
|
|
152
|
-
className: "m-0 items-center"
|
|
153
|
-
})
|
|
154
|
-
]
|
|
155
|
-
}),
|
|
156
|
-
!a && X && /* @__PURE__ */ i(tt, {
|
|
157
|
-
dataTest: "slider-to-button",
|
|
158
|
-
"aria-label": "Increase value",
|
|
159
|
-
className: "-mt-0.5 w-8",
|
|
160
|
-
variant: "outlined",
|
|
161
|
-
disabled: u ?? ht,
|
|
162
|
-
startIcon: /* @__PURE__ */ i(yt, {
|
|
163
|
-
width: 24,
|
|
164
|
-
height: 24
|
|
146
|
+
})]
|
|
165
147
|
}),
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
148
|
+
!a && X && /* @__PURE__ */ i(tt, {
|
|
149
|
+
dataTest: "slider-to-button",
|
|
150
|
+
"aria-label": "Increase value",
|
|
151
|
+
className: "-mt-0.5 w-8",
|
|
152
|
+
variant: "outlined",
|
|
153
|
+
disabled: u ?? ht,
|
|
154
|
+
startIcon: /* @__PURE__ */ i(yt, {
|
|
155
|
+
width: 24,
|
|
156
|
+
height: 24
|
|
157
|
+
}),
|
|
158
|
+
onClick: Z("increment")
|
|
159
|
+
})
|
|
160
|
+
]
|
|
161
|
+
}),
|
|
162
|
+
G && /* @__PURE__ */ i(Nt, {
|
|
163
|
+
id: Y,
|
|
164
|
+
role: dt,
|
|
165
|
+
error: N,
|
|
166
|
+
message: E,
|
|
167
|
+
className: "m-0 items-center"
|
|
168
|
+
})
|
|
169
|
+
]
|
|
170
170
|
});
|
|
171
171
|
};
|
|
172
172
|
export {
|