@hybridcore/ui 1.5.7 → 1.5.8

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,31 +1,34 @@
1
- import { jsxs as c, Fragment as d, jsx as t } from "react/jsx-runtime";
2
- import p from "react";
3
- import { SimpleTreeView as C } from "@mui/x-tree-view";
4
- import F from "./item/index.js";
5
- import u from "lodash";
6
- import { Box as L, Divider as _ } from "@mui/material";
7
- import { SearchInput as j } from "../search-input/index.js";
8
- import { flattenNestedTemplates as z } from "../../utils/ontology.js";
9
- import { ArrowDropDown as A, ArrowRight as B } from "@mui/icons-material";
1
+ import { jsxs as d, Fragment as p, jsx as t } from "react/jsx-runtime";
2
+ import u from "react";
3
+ import { SimpleTreeView as B } from "@mui/x-tree-view";
4
+ import C from "./item/index.js";
5
+ import a from "lodash";
6
+ import { Box as F, Divider as L } from "@mui/material";
7
+ import { SearchInput as _ } from "../search-input/index.js";
8
+ import { flattenNestedTemplates as j } from "../../utils/ontology.js";
9
+ import { ArrowDropDown as y, ArrowRight as z } from "@mui/icons-material";
10
10
  const H = ({
11
- data: r,
12
- idKey: a = "id",
13
- selected: s,
11
+ data: i,
12
+ idKey: s = "id",
13
+ selected: m,
14
14
  expanded: f,
15
- disabled: m,
15
+ disabled: c,
16
16
  disableSearch: h,
17
17
  onChange: S,
18
18
  onExpansionToggle: x
19
19
  }) => {
20
- const [o, i] = p.useState(""), b = z(r), w = p.useMemo(() => o.length > 0 ? b.filter(
21
- (e) => e.name.toLowerCase().includes(o)
22
- ) : r, [o, r]);
23
- let l = null;
20
+ const [r, o] = u.useState(""), b = j(i), w = u.useMemo(() => r.length > 0 ? a.uniqBy(
21
+ b.filter(
22
+ (e) => e.name.toLowerCase().includes(r)
23
+ ),
24
+ (e) => e.id
25
+ ) : i, [r, i]);
26
+ let n = null;
24
27
  const I = 500;
25
- return /* @__PURE__ */ c(d, { children: [
26
- !h && /* @__PURE__ */ c(d, { children: [
27
- /* @__PURE__ */ t(L, { px: 1, pt: 0.75, children: /* @__PURE__ */ t(
28
- j,
28
+ return /* @__PURE__ */ d(p, { children: [
29
+ !h && /* @__PURE__ */ d(p, { children: [
30
+ /* @__PURE__ */ t(F, { px: 1, pt: 0.75, children: /* @__PURE__ */ t(
31
+ _,
29
32
  {
30
33
  fullWidth: !0,
31
34
  disableLabel: !0,
@@ -38,40 +41,40 @@ const H = ({
38
41
  },
39
42
  iconSize: "small",
40
43
  onChange: (e) => {
41
- l && clearTimeout(l), l = setTimeout(() => i(e.toLowerCase()), I);
44
+ n && clearTimeout(n), n = setTimeout(() => o(e.toLowerCase()), I);
42
45
  },
43
46
  onSubmit: (e) => {
44
- i(e || "");
47
+ o(e || "");
45
48
  }
46
49
  }
47
50
  ) }),
48
- /* @__PURE__ */ t(_, { sx: { mt: 1.75 } })
51
+ /* @__PURE__ */ t(L, { sx: { mt: 1.75 } })
49
52
  ] }),
50
53
  /* @__PURE__ */ t(
51
- C,
54
+ B,
52
55
  {
53
56
  "aria-label": "tree view filter",
54
57
  disableSelection: !0,
55
58
  defaultExpandedItems: f,
56
59
  slots: {
57
- collapseIcon: () => /* @__PURE__ */ t(A, {}),
58
- expandIcon: () => /* @__PURE__ */ t(B, {})
60
+ collapseIcon: () => /* @__PURE__ */ t(y, {}),
61
+ expandIcon: () => /* @__PURE__ */ t(z, {})
59
62
  },
60
63
  onItemExpansionToggle: x,
61
64
  children: w.map((e, g) => {
62
- const n = String(e[a]), T = u.includes(s, n), D = u.includes(m, n);
65
+ const l = String(e[s]), T = a.includes(m, l), D = a.includes(c, l);
63
66
  return /* @__PURE__ */ t(
64
- F,
67
+ C,
65
68
  {
66
- id: n,
67
- idKey: a,
69
+ id: l,
70
+ idKey: s,
68
71
  name: e.name,
69
72
  checked: T,
70
73
  disabled: D,
71
- disabledIds: m,
72
- children: e.children,
74
+ disabledIds: c,
75
+ children: r ? [] : e.children,
73
76
  onChange: S,
74
- defaultSelected: s
77
+ defaultSelected: m
75
78
  },
76
79
  g
77
80
  );
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hybridcore/ui",
3
3
  "description": "Hybrid Core UI Library",
4
- "version": "1.5.7",
4
+ "version": "1.5.8",
5
5
  "author": "Hybrid Core",
6
6
  "license": "ISC",
7
7
  "type": "module",