asma-ui-core 3.21.0 → 3.21.1

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,4 +1,4 @@
1
- import { cn as C } from "../../../helpers/cn.js";
1
+ import { cn as v } from "../../../helpers/cn.js";
2
2
  import { ChevronDownIcon as re } from "../../icons/chevron-down-icon/ChevronDownIcon.js";
3
3
  import { CloseIcon as le } from "../../icons/close-icon/CloseIcon.js";
4
4
  import { CheckIcon as oe } from "../../icons/check-icon/CheckIcon.js";
@@ -7,32 +7,32 @@ import { StyledChip as ne } from "../../data-display/chip/StyledChip.js";
7
7
  import { StyledCheckbox as H } from "../checkbox/base-ui/StyledCheckbox.js";
8
8
  import B from "./StyledSelectAutocomplete.module.js";
9
9
  import D from "clsx";
10
- import { createElement as v, useLayoutEffect as se, useRef as ce, useState as z } from "react";
10
+ import { createElement as C, useLayoutEffect as se, useRef as ce, useState as z } from "react";
11
11
  import { Autocomplete as ie, Paper as de } from "@mui/material";
12
12
  import { jsx as l, jsxs as T } from "react/jsx-runtime";
13
- function Ne({ dataTest: i, autoHeight: m, getOptionLabel: d, wrapperClassName: W, multiple: n, allowSelectAll: _, selectAllLabel: N, className: F, defaultValue: w, isOptionEqualToValue: p, ListboxProps: M, onChange: G, options: f, popupIcon: K, readOnly: h, renderOption: L, renderTags: O, sx: U, value: x, ...V }) {
14
- const [k, E] = z("auto"), g = ce(null), o = n === !0 && _ === !0 && !h, A = x !== void 0, b = (e) => Array.isArray(e) ? e : [], [J, Q] = z(() => b(w));
13
+ function Me({ dataTest: i, autoHeight: m, getOptionLabel: d, wrapperClassName: W, multiple: n, allowSelectAll: _, selectAllLabel: M, className: F, defaultValue: N, isOptionEqualToValue: p, ListboxProps: k, onChange: G, options: h, popupIcon: K, readOnly: f, renderOption: L, renderTags: O, sx: U, value: x, ...V }) {
14
+ const [A, E] = z("auto"), g = ce(null), o = n === !0 && _ === !0 && !f, w = x !== void 0, b = (e) => Array.isArray(e) ? e : [], [J, Q] = z(() => b(N));
15
15
  se(() => {
16
16
  if (!m) return;
17
17
  const e = g.current?.getBoundingClientRect().height ?? 0, t = g.current?.getBoundingClientRect().top ?? 0, r = window.innerHeight - t - e - 40;
18
18
  E(r > 0 ? r : "auto");
19
19
  }, [m]);
20
20
  const y = m ? {
21
- style: { maxHeight: k === "auto" ? "auto" : `${k}px` },
22
- ...M
23
- } : M, s = (e) => typeof e == "object" && e !== null && "label" in e ? e.label : String(e), X = (e) => typeof e == "object" && e !== null && "disabled" in e && !!e.disabled, I = {
21
+ style: { maxHeight: A === "auto" ? "auto" : `${A}px` },
22
+ ...k
23
+ } : k, s = (e) => typeof e == "object" && e !== null && "label" in e ? e.label : String(e), X = (e) => typeof e == "object" && e !== null && "disabled" in e && !!e.disabled, I = {
24
24
  padding: 0,
25
25
  "& .MuiAutocomplete-option": { paddingLeft: n ? "12px !important" : "6px !important" }
26
- }, Y = y?.sx ? [I, y.sx] : I, $ = o ? b(A ? x : J) : [], c = o ? f.filter((e) => !X(e)) : f, Z = (e, t) => {
26
+ }, Y = y?.sx ? [I, y.sx] : I, $ = o ? b(w ? x : J) : [], c = o ? h.filter((e) => !X(e)) : h, Z = (e, t) => {
27
27
  const r = typeof e == "object" && e !== null;
28
28
  return r !== (typeof t == "object" && t !== null) || !r && typeof e != typeof t ? !1 : p ? p(e, t) : e === t;
29
29
  }, j = o ? c.filter((e) => $.some((t) => Z(e, t))).length : 0, R = o && c.length > 0 && j === c.length, q = o && j > 0 && !R, P = (e, t, r, a) => {
30
- o && !A && Q(b(t)), G?.(e, t, r, a);
30
+ o && !w && Q(b(t)), G?.(e, t, r, a);
31
31
  }, ee = (e, t) => {
32
32
  P(e, t ? [...c] : [], t ? "selectOption" : "clear", void 0);
33
33
  }, te = (e, t) => e.map((r, a) => {
34
34
  const u = t({ index: a }), S = d?.(r) ?? s(r);
35
- return /* @__PURE__ */ v(ne, {
35
+ return /* @__PURE__ */ C(ne, {
36
36
  ...u,
37
37
  key: `selected-chip-${S}-${a}`,
38
38
  dataTest: `selected-chip-${S}`,
@@ -41,12 +41,12 @@ function Ne({ dataTest: i, autoHeight: m, getOptionLabel: d, wrapperClassName: W
41
41
  });
42
42
  });
43
43
  return /* @__PURE__ */ l("div", {
44
- className: C(B.styledSelectAutocompleteWrapper, W),
44
+ className: v(B.styledSelectAutocompleteWrapper, W),
45
45
  ref: g,
46
46
  children: /* @__PURE__ */ l(ie, {
47
47
  ...V,
48
48
  multiple: n,
49
- defaultValue: o ? void 0 : w,
49
+ defaultValue: o ? void 0 : N,
50
50
  getOptionLabel: d,
51
51
  isOptionEqualToValue: p,
52
52
  ListboxProps: {
@@ -55,9 +55,9 @@ function Ne({ dataTest: i, autoHeight: m, getOptionLabel: d, wrapperClassName: W
55
55
  },
56
56
  className: D("!text-sm", F),
57
57
  onChange: P,
58
- options: f,
58
+ options: h,
59
59
  renderTags: O ?? (n ? te : void 0),
60
- popupIcon: h ? null : K ?? n ? /* @__PURE__ */ l(ae, {
60
+ popupIcon: f ? null : K ?? n ? /* @__PURE__ */ l(ae, {
61
61
  width: 24,
62
62
  height: 24
63
63
  }) : /* @__PURE__ */ l(re, {
@@ -65,7 +65,7 @@ function Ne({ dataTest: i, autoHeight: m, getOptionLabel: d, wrapperClassName: W
65
65
  height: 24,
66
66
  className: D(B["select-custom-icon"])
67
67
  }),
68
- readOnly: h,
68
+ readOnly: f,
69
69
  "data-testid": i,
70
70
  value: o ? $ : x,
71
71
  PaperComponent: ({ children: e }) => /* @__PURE__ */ T(de, {
@@ -75,9 +75,12 @@ function Ne({ dataTest: i, autoHeight: m, getOptionLabel: d, wrapperClassName: W
75
75
  marginTop: "0px !important",
76
76
  "& .MuiAutocomplete-option.Mui-focused": { background: "var(--colors-delta-50) !important" },
77
77
  "& li[aria-selected=true]": { background: "var(--colors-gama-50) !important" },
78
- "& li[aria-selected=true].MuiAutocomplete-option.Mui-focused": { background: "var(--colors-gama-50) !important" }
78
+ "& li[aria-selected=true].MuiAutocomplete-option.Mui-focused": { background: "var(--colors-gama-50) !important" },
79
+ "&:has([data-select-all-header]:hover) .MuiAutocomplete-option.Mui-focused": { background: "transparent !important" },
80
+ "&:has([data-select-all-header]:hover) li[aria-selected=true].MuiAutocomplete-option.Mui-focused": { background: "var(--colors-gama-50) !important" }
79
81
  },
80
82
  children: [o && c.length > 0 && /* @__PURE__ */ T("div", {
83
+ "data-select-all-header": !0,
81
84
  className: "flex items-center gap-x-[10px] border-[1px] border-b border-solid border-delta-200 bg-delta-50 py-2 pl-3 text-xs",
82
85
  onMouseDown: (t) => t.preventDefault(),
83
86
  role: "presentation",
@@ -88,19 +91,19 @@ function Ne({ dataTest: i, autoHeight: m, getOptionLabel: d, wrapperClassName: W
88
91
  indeterminate: q,
89
92
  hideWrapper: !0,
90
93
  onChange: ee,
91
- "aria-label": N ?? "Select all"
94
+ "aria-label": M ?? "Select all"
92
95
  }), /* @__PURE__ */ l("span", {
93
96
  className: "truncate text-[10px] font-semibold uppercase text-delta-600",
94
- children: N ?? "Select all"
97
+ children: M ?? "Select all"
95
98
  })]
96
99
  }), e]
97
100
  }),
98
101
  renderOption: L ?? ((e, t, { selected: r }) => {
99
102
  const a = e, u = e.id ?? s(t);
100
- return n ? /* @__PURE__ */ v("li", {
103
+ return n ? /* @__PURE__ */ C("li", {
101
104
  ...a,
102
105
  key: u,
103
- className: C(e.className, "flex items-center gap-x-[10px] border-0 border-b border-solid border-delta-200")
106
+ className: v(e.className, "flex items-center gap-x-[10px] border-0 border-b border-solid border-delta-200")
104
107
  }, /* @__PURE__ */ l(H, {
105
108
  dataTest: `${i}-${s(t)}-checkbox`,
106
109
  checked: r,
@@ -109,10 +112,10 @@ function Ne({ dataTest: i, autoHeight: m, getOptionLabel: d, wrapperClassName: W
109
112
  }), /* @__PURE__ */ l("span", {
110
113
  className: "flex-1 truncate py-2 text-sm text-delta-700",
111
114
  children: d?.(t) ?? s(t)
112
- })) : /* @__PURE__ */ v("li", {
115
+ })) : /* @__PURE__ */ C("li", {
113
116
  ...a,
114
117
  key: u,
115
- className: C(e.className, "flex items-center gap-x-1")
118
+ className: v(e.className, "flex items-center gap-x-1")
116
119
  }, /* @__PURE__ */ l("span", {
117
120
  className: "w-5",
118
121
  children: r && /* @__PURE__ */ l(oe, {
@@ -147,5 +150,5 @@ function Ne({ dataTest: i, autoHeight: m, getOptionLabel: d, wrapperClassName: W
147
150
  });
148
151
  }
149
152
  export {
150
- Ne as StyledSelectAutocomplete
153
+ Me as StyledSelectAutocomplete
151
154
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.21.0",
6
+ "version": "3.21.1",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",