asma-ui-core 3.81.2 → 3.81.4

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,20 +1,20 @@
1
- import { cn as m } from "../../helpers/cn.js";
1
+ import { cn as x } from "../../helpers/cn.js";
2
2
  import e from "./StyledCheckbox.module.js";
3
- import L, { useEffect as C, useRef as f } from "react";
4
- import { jsx as o, jsxs as k } from "react/jsx-runtime";
5
- var E = (t) => /* @__PURE__ */ k("svg", {
3
+ import P, { useEffect as v, useRef as b } from "react";
4
+ import { Fragment as $, jsx as t, jsxs as l } from "react/jsx-runtime";
5
+ var y = (r) => /* @__PURE__ */ l("svg", {
6
6
  viewBox: "0 0 24 24",
7
7
  width: "100%",
8
8
  height: "100%",
9
9
  fill: "none",
10
- ...t,
11
- children: [/* @__PURE__ */ o("title", { children: "Indeterminate icon" }), /* @__PURE__ */ o("path", {
10
+ ...r,
11
+ children: [/* @__PURE__ */ t("title", { children: "Indeterminate icon" }), /* @__PURE__ */ t("path", {
12
12
  d: "M6 12H18",
13
13
  stroke: "currentColor",
14
- strokeWidth: t.strokeWidth ?? 3,
14
+ strokeWidth: r.strokeWidth ?? 3,
15
15
  strokeLinecap: "round"
16
16
  })]
17
- }), H = (t) => /* @__PURE__ */ k("svg", {
17
+ }), B = (r) => /* @__PURE__ */ l("svg", {
18
18
  viewBox: "0 0 24 24",
19
19
  width: "100%",
20
20
  height: "100%",
@@ -23,56 +23,62 @@ var E = (t) => /* @__PURE__ */ k("svg", {
23
23
  strokeWidth: 2,
24
24
  strokeLinecap: "round",
25
25
  strokeLinejoin: "round",
26
- ...t,
27
- children: [/* @__PURE__ */ o("title", { children: "Check icon" }), /* @__PURE__ */ o("path", { d: "M4 12l5 5L20 6" })]
28
- }), M = ({ dataTest: t, size: l = "medium", disabled: d, readOnly: c, indeterminate: n = !1, checked: h, disableRipple: x, hideWrapper: v, className: b, onChange: g, ...I }) => {
29
- const a = !!v, s = !x && !a && !d && !c, p = f(null), u = f(null);
30
- C(() => {
31
- p.current && (p.current.indeterminate = n);
26
+ ...r,
27
+ children: [/* @__PURE__ */ t("title", { children: "Check icon" }), /* @__PURE__ */ t("path", { d: "M4 12l5 5L20 6" })]
28
+ }), _ = ({ dataTest: r, size: d = "medium", disabled: h, readOnly: a, indeterminate: n = !1, checked: p, disableRipple: g, hideWrapper: I, className: N, onChange: R, decorative: w, ...W }) => {
29
+ const c = !!I, s = !g && !c && !h && !a, u = b(null), m = b(null);
30
+ v(() => {
31
+ u.current && (u.current.indeterminate = n);
32
32
  }, [n]);
33
- const R = m(e.CheckboxWrapper, !a && e[`size-${l}`], a && e.HideWrapper, n && e.Indeterminate, c && e.ReadOnly, s && e.CheckboxHover, b), w = m(e.Checkbox, e[`size-${l}`], n && e.Indeterminate), N = n ? E : H, W = L.useCallback((r) => {
34
- if (r.stopPropagation(), !s) return;
33
+ const k = x(e.CheckboxWrapper, !c && e[`size-${d}`], c && e.HideWrapper, n && e.Indeterminate, a && e.ReadOnly, s && e.CheckboxHover, N), L = x(e.Checkbox, e[`size-${d}`], n && e.Indeterminate), E = n ? y : B, H = P.useCallback((o) => {
34
+ if (o.stopPropagation(), !s) return;
35
35
  const i = document.createElement("span");
36
- i.className = e.CheckboxRipple ?? "", i.addEventListener("animationend", () => i.remove(), { once: !0 }), u.current?.appendChild(i);
36
+ i.className = e.CheckboxRipple ?? "", i.addEventListener("animationend", () => i.remove(), { once: !0 }), m.current?.appendChild(i);
37
37
  }, [s]);
38
- return C(() => {
39
- const r = u.current;
40
- return () => r?.replaceChildren();
41
- }, []), /* @__PURE__ */ k("label", {
42
- className: R,
43
- "data-test": t,
44
- onPointerDown: W,
45
- "data-checked": h && !n ? "" : void 0,
46
- "data-unchecked": !h && !n ? "" : void 0,
38
+ v(() => {
39
+ const o = m.current;
40
+ return () => o?.replaceChildren();
41
+ }, []);
42
+ const j = (o) => {
43
+ a || R?.(o, o.target.checked);
44
+ }, C = {
45
+ "data-checked": p && !n ? "" : void 0,
46
+ "data-unchecked": !p && !n ? "" : void 0,
47
47
  "data-indeterminate": n ? "" : void 0,
48
- "data-disabled": d ? "" : void 0,
49
- children: [
50
- /* @__PURE__ */ o("input", {
51
- ref: p,
52
- type: "checkbox",
53
- className: "sr-only",
54
- checked: h,
55
- disabled: d,
56
- readOnly: c,
57
- onChange: (r) => {
58
- c || g?.(r, r.target.checked);
59
- },
60
- ...I
61
- }),
62
- !a && s && /* @__PURE__ */ o("span", {
63
- ref: u,
64
- className: e.CheckboxRippleContainer
65
- }),
66
- /* @__PURE__ */ o("span", {
67
- className: w,
68
- children: /* @__PURE__ */ o("span", {
69
- className: e.Indicator,
70
- children: /* @__PURE__ */ o(N, { strokeWidth: l === "small" ? 3 : 2 })
71
- })
72
- })
73
- ]
48
+ "data-disabled": h ? "" : void 0
49
+ }, f = /* @__PURE__ */ l($, { children: [!c && s && /* @__PURE__ */ t("span", {
50
+ ref: m,
51
+ className: e.CheckboxRippleContainer
52
+ }), /* @__PURE__ */ t("span", {
53
+ className: L,
54
+ children: /* @__PURE__ */ t("span", {
55
+ className: e.Indicator,
56
+ children: /* @__PURE__ */ t(E, { strokeWidth: d === "small" ? 3 : 2 })
57
+ })
58
+ })] });
59
+ return w ? /* @__PURE__ */ t("span", {
60
+ "aria-hidden": "true",
61
+ className: k,
62
+ "data-test": r,
63
+ ...C,
64
+ children: f
65
+ }) : /* @__PURE__ */ l("label", {
66
+ className: k,
67
+ "data-test": r,
68
+ onPointerDown: H,
69
+ ...C,
70
+ children: [/* @__PURE__ */ t("input", {
71
+ ref: u,
72
+ type: "checkbox",
73
+ className: "sr-only",
74
+ checked: p,
75
+ disabled: h,
76
+ readOnly: a,
77
+ onChange: j,
78
+ ...W
79
+ }), f]
74
80
  });
75
81
  };
76
82
  export {
77
- M as StyledCheckbox
83
+ _ as StyledCheckbox
78
84
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.81.2",
6
+ "version": "3.81.4",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",