asma-ui-core 3.81.1 → 3.81.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.
@@ -1,11 +1,11 @@
1
1
  import { cn as u } from "../../../helpers/cn.js";
2
2
  import { HelperRow as ft } from "../../../helpers/HelperRow.js";
3
- import { useHelperSlot as ht } from "../../../helpers/useHelperSlot.js";
3
+ import { useHelperSlot as pt } from "../../../helpers/useHelperSlot.js";
4
4
  import y from "./StyledSlider.module.js";
5
- import { useId as pt, useRef as O, useState as Q } from "react";
5
+ import { useId as ht, useRef as O, useState as Q } from "react";
6
6
  import { jsx as b, jsxs as H } from "react/jsx-runtime";
7
- var U = (i, l, o) => o === l ? 0 : Math.min(100, Math.max(0, (i - l) / (o - l) * 100)), mt = (i) => Array.isArray(i) ? [i[0] ?? 0, i[1] ?? 0] : null, wt = ({ dataTest: i, min: l = 0, max: o = 100, step: h = 1, value: w, defaultValue: W, disabled: p, size: z = "medium", orientation: C = "horizontal", marks: M, name: Z, className: k, classes: s, slotProps: x, error: v, errorText: tt, helperText: L, reserveHelperText: et, ariaLabel: S, ariaLabelledBy: rt, onChange: A, onChangeCommitted: _ }) => {
8
- const j = pt(), n = C === "vertical", a = z === "small" ? 6 : 8, d = O(null), g = O(null), [lt, N] = Q(null), [nt, F] = Q(W ?? l), I = lt ?? w ?? nt, c = mt(I), f = c !== null, B = v ? tt ?? L : L, { show: K, role: ot } = ht("StyledSlider", v, B, et), V = (M === !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(M) ? M : []).filter((t) => t.value >= l && t.value <= o), X = f ? Math.min(c[0], c[1]) : l, R = f ? Math.max(c[0], c[1]) : I, Y = (t) => f ? t >= X && t <= R : t <= R, $ = f ? U(X, l, o) : 0, q = U(R, l, o) - $, at = n ? {
7
+ var U = (i, l, o) => o === l ? 0 : Math.min(100, Math.max(0, (i - l) / (o - l) * 100)), mt = (i) => Array.isArray(i) ? [i[0] ?? 0, i[1] ?? 0] : null, wt = ({ dataTest: i, min: l = 0, max: o = 100, step: h = 1, value: w, defaultValue: W, disabled: s, size: z = "medium", orientation: C = "horizontal", marks: M, name: Z, className: k, classes: d, slotProps: x, error: v, errorText: tt, helperText: L, reserveHelperText: et, ariaLabel: S, ariaLabelledBy: rt, onChange: A, onChangeCommitted: _ }) => {
8
+ const j = ht(), n = C === "vertical", a = z === "small" ? 6 : 8, f = O(null), g = O(null), [lt, N] = Q(null), [nt, F] = Q(W ?? l), I = lt ?? w ?? nt, c = mt(I), p = c !== null, B = v ? tt ?? L : L, { show: K, role: ot } = pt("StyledSlider", v, B, et), V = (M === !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(M) ? M : []).filter((t) => t.value >= l && t.value <= o), X = p ? Math.min(c[0], c[1]) : l, R = p ? Math.max(c[0], c[1]) : I, Y = (t) => p ? t >= X && t <= R : t <= R, $ = p ? U(X, l, o) : 0, q = U(R, l, o) - $, at = n ? {
9
9
  bottom: `${$}%`,
10
10
  height: `${q}%`
11
11
  } : {
@@ -17,24 +17,24 @@ var U = (i, l, o) => o === l ? 0 : Math.min(100, Math.max(0, (i - l) / (o - l) *
17
17
  }, T = (t) => {
18
18
  const r = t.currentTarget.getBoundingClientRect(), e = n ? 1 - (t.clientY - (r.top + a)) / (r.height - a * 2) : (t.clientX - (r.left + a)) / (r.width - a * 2), m = l + Math.round(Math.min(1, Math.max(0, e)) * ((o - l) / h)) * h;
19
19
  return Math.min(o, Math.max(l, m));
20
- }, ct = (t) => f && Math.abs((c?.[1] ?? l) - t) < Math.abs((c?.[0] ?? l) - t) ? 1 : 0, ut = (t) => {
21
- if (p) return;
20
+ }, ct = (t) => p && Math.abs((c?.[1] ?? l) - t) < Math.abs((c?.[0] ?? l) - t) ? 1 : 0, ut = (t) => {
21
+ if (s) return;
22
22
  const r = T(t), e = ct(r);
23
- d.current = e, g.current = t.pointerId, t.currentTarget.setPointerCapture(t.pointerId);
23
+ f.current = e, g.current = t.pointerId, t.currentTarget.setPointerCapture(t.pointerId);
24
24
  const m = P(r, e);
25
25
  N(m), A?.(t, m, e);
26
26
  }, it = (t) => {
27
- if (p || d.current === null || t.pointerId !== g.current) return;
28
- const r = d.current, e = P(T(t), r);
27
+ if (s || f.current === null || t.pointerId !== g.current) return;
28
+ const r = f.current, e = P(T(t), r);
29
29
  N(e), A?.(t, e, r);
30
30
  }, st = (t) => {
31
- if (p || d.current === null || t.pointerId !== g.current) return;
32
- const r = d.current, e = P(T(t), r);
33
- w === void 0 && F(e), _?.(t, e), t.currentTarget.hasPointerCapture(t.pointerId) && t.currentTarget.releasePointerCapture(t.pointerId), N(null), d.current = null, g.current = null;
31
+ if (s || f.current === null || t.pointerId !== g.current) return;
32
+ const r = f.current, e = P(T(t), r);
33
+ w === void 0 && F(e), _?.(t, e), t.currentTarget.hasPointerCapture(t.pointerId) && t.currentTarget.releasePointerCapture(t.pointerId), N(null), f.current = null, g.current = null;
34
34
  }, dt = (t) => {
35
- d.current === null || t.pointerId !== g.current || (N(null), d.current = null, g.current = null);
35
+ f.current === null || t.pointerId !== g.current || (N(null), f.current = null, g.current = null);
36
36
  }, P = (t, r) => {
37
- if (!f) return t;
37
+ if (!p) return t;
38
38
  const e = [c?.[0] ?? 0, c?.[1] ?? 0];
39
39
  return e[r] = t, r === 0 && e[0] > e[1] && (e[0] = e[1]), r === 1 && e[1] < e[0] && (e[1] = e[0]), e;
40
40
  }, G = (t, r, e, m) => {
@@ -42,27 +42,27 @@ var U = (i, l, o) => o === l ? 0 : Math.min(100, Math.max(0, (i - l) / (o - l) *
42
42
  w === void 0 && F(J), t && t(r, J, m);
43
43
  }, D = (t, r) => /* @__PURE__ */ b("input", {
44
44
  type: "range",
45
- "data-testid": f ? `${i}-thumb-${t}` : i,
45
+ "data-testid": p ? `${i}-thumb-${t}` : i,
46
46
  name: Z,
47
47
  min: l,
48
48
  max: o,
49
49
  step: h,
50
50
  value: r,
51
- disabled: p,
51
+ disabled: s,
52
52
  "aria-orientation": C,
53
53
  "aria-label": typeof S == "function" ? S(t) : S,
54
54
  "aria-labelledby": rt,
55
55
  "aria-invalid": v ? !0 : void 0,
56
56
  "aria-describedby": K ? j : void 0,
57
- className: u(y.SliderInput, n ? y.Vertical : y.Horizontal, !n && "z-0", z === "small" && y.Small, p && y.Disabled, s?.thumb, x?.thumb?.className),
57
+ className: u(y.SliderInput, n ? y.Vertical : y.Horizontal, !n && "z-0", z === "small" && y.Small, s && y.Disabled, d?.thumb, x?.thumb?.className),
58
58
  onChange: (e) => G(A, e, Number(e.currentTarget.value), t),
59
59
  onKeyUp: (e) => G(_, e, Number(e.currentTarget.value), t)
60
60
  }, t);
61
61
  return /* @__PURE__ */ H("div", {
62
- className: u("relative flex", n ? "h-full w-8 flex-col items-center" : "mt-px w-full flex-col", s?.root, k),
62
+ className: u("relative flex", n ? "h-full w-8 flex-col items-center" : "mt-px w-full flex-col", d?.root, k),
63
63
  children: [
64
64
  /* @__PURE__ */ H("div", {
65
- className: u("relative", n ? "h-full w-8" : "h-4 w-full"),
65
+ className: u("relative", n ? "h-full w-8" : "h-4 w-full", s ? "cursor-default" : "cursor-pointer"),
66
66
  style: { touchAction: "none" },
67
67
  onPointerDown: ut,
68
68
  onPointerMove: it,
@@ -78,20 +78,20 @@ var U = (i, l, o) => o === l ? 0 : Math.min(100, Math.max(0, (i - l) / (o - l) *
78
78
  right: a
79
79
  },
80
80
  children: [
81
- /* @__PURE__ */ b("div", { className: u("absolute inset-0 rounded-full bg-delta-100", s?.rail, x?.rail?.className) }),
81
+ /* @__PURE__ */ b("div", { className: u("absolute inset-0 rounded-full bg-delta-100", d?.rail, x?.rail?.className) }),
82
82
  /* @__PURE__ */ b("div", {
83
- className: u("absolute rounded-full", n ? "left-0 w-full" : "top-0 h-full", p ? "bg-delta-200" : "bg-gama-500", s?.track),
83
+ className: u("absolute rounded-full", n ? "left-0 w-full" : "top-0 h-full", s ? "bg-delta-200" : "bg-gama-500", d?.track),
84
84
  style: at
85
85
  }),
86
86
  V.map((t) => {
87
87
  const r = Y(t.value);
88
88
  return /* @__PURE__ */ b("span", {
89
- 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", r ? u(p ? "border-delta-200 bg-delta-200" : "border-gama-500 bg-gama-500", s?.markActive) : u("border-delta-300 bg-white", s?.mark)),
89
+ 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", r ? u(s ? "border-delta-200 bg-delta-200" : "border-gama-500 bg-gama-500", d?.markActive) : u("border-delta-300 bg-white", d?.mark)),
90
90
  style: E(t.value)
91
91
  }, t.value);
92
92
  })
93
93
  ]
94
- }), f ? [D(0, c[0]), D(1, c[1])] : D(0, I)]
94
+ }), p ? [D(0, c[0]), D(1, c[1])] : D(0, I)]
95
95
  }),
96
96
  V.some((t) => t.label != null) && /* @__PURE__ */ b("div", {
97
97
  className: u(n ? "pointer-events-none absolute inset-x-0" : "relative mt-[14px] h-6"),
@@ -103,7 +103,7 @@ var U = (i, l, o) => o === l ? 0 : Math.min(100, Math.max(0, (i - l) / (o - l) *
103
103
  marginRight: a
104
104
  },
105
105
  children: V.map((t) => t.label == null ? null : /* @__PURE__ */ b("span", {
106
- className: u("absolute text-base font-semibold text-delta-700", n ? "left-[37px] translate-y-1/2" : "-translate-x-1/2", Y(t.value) && s?.markLabelActive, s?.markLabel, x?.markLabel?.className),
106
+ className: u("absolute text-base font-semibold text-delta-700", n ? "left-[37px] translate-y-1/2" : "-translate-x-1/2", Y(t.value) && d?.markLabelActive, d?.markLabel, x?.markLabel?.className),
107
107
  style: E(t.value),
108
108
  children: t.label
109
109
  }, t.value))
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.81.1",
6
+ "version": "3.81.2",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",