@hybridcore/ui 1.5.79 → 1.5.82

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,122 +1,95 @@
1
- import { jsxs as c, jsx as o, Fragment as p } from "react/jsx-runtime";
2
- import { List as y, Box as j, Divider as P, ListItem as z, ListItemText as A, Typography as B, Button as u, TablePagination as F } from "@mui/material";
3
- import G from "lodash";
4
- import { useState as g } from "react";
5
- import { Container as M } from "../container/index.js";
6
- const U = [5, 10, 25, 50];
7
- function K({
8
- title: f,
9
- data: l = [],
10
- payload: n,
11
- totalCount: v,
12
- onChange: s,
13
- onItemClick: t,
14
- sx: w
15
- }) {
16
- const [m, h] = g(0), [b, L] = g(5), [R, x] = g([]), a = (n == null ? void 0 : n.pageNumber) !== void 0 ? n.pageNumber : m, i = (n == null ? void 0 : n.rows) !== void 0 ? n.rows : b, T = (e, r) => {
17
- h(r), s && s({ ...n, pageNumber: r, rows: i });
18
- }, _ = (e) => {
19
- const r = parseInt(e.target.value, 10);
20
- L(r), h(0), s && s({ ...n, pageNumber: 0, rows: r });
21
- }, D = (e) => (r) => {
22
- r.stopPropagation(), x((d) => [...d, e]);
23
- }, N = (e) => (r) => {
24
- r.stopPropagation(), x((d) => d.filter((O) => O !== e));
25
- }, S = s ? v || 0 : l.length, E = s ? l : l.slice(a * i, (a + 1) * i);
26
- return /* @__PURE__ */ c(
27
- M,
28
- {
29
- title: f,
30
- headerSx: {
31
- py: 2,
32
- px: 3
33
- },
34
- contentSx: {
35
- p: "0px !important",
36
- display: "flex",
37
- flexDirection: "column",
38
- flex: 1,
39
- overflow: "hidden"
40
- },
41
- sx: {
42
- display: "flex",
43
- flexDirection: "column",
44
- height: "100%",
45
- ...w
46
- },
47
- children: [
48
- /* @__PURE__ */ o(y, { disablePadding: !0, sx: { flex: 1, overflowY: "auto" }, children: E.map((e, r) => /* @__PURE__ */ c(j, { children: [
49
- r === 0 && /* @__PURE__ */ o(P, { component: "li" }),
50
- /* @__PURE__ */ o(
51
- z,
52
- {
53
- onClick: () => t == null ? void 0 : t(e),
54
- sx: {
55
- cursor: t ? "pointer" : "default",
56
- "&:hover": t ? { backgroundColor: "action.hover" } : void 0
57
- },
58
- children: /* @__PURE__ */ o(
59
- A,
1
+ import { jsxs as i, jsx as n, Fragment as a } from "react/jsx-runtime";
2
+ import { Box as f, Divider as s, ListItem as w, ListItemIcon as T, ListItemText as R, Typography as _, Button as c, TablePagination as b } from "@mui/material";
3
+ import I from "lodash";
4
+ import { usePaginatedListLogic as O } from "./logic.js";
5
+ import { PaginatedListRoot as k, PaginatedListHeader as D, PaginatedListContent as E, PaginatedListList as S, PaginatedListPagination as j } from "./styled.js";
6
+ const z = [5, 10, 25, 50];
7
+ function M(l) {
8
+ const {
9
+ title: t,
10
+ displayData: p,
11
+ count: g,
12
+ page: h,
13
+ rowsPerPage: P,
14
+ expanded: L,
15
+ handleChangePage: x,
16
+ handleChangeRowsPerPage: m,
17
+ readMore: u,
18
+ showLess: y,
19
+ onItemClick: o,
20
+ ownerState: r,
21
+ sx: v,
22
+ other: C
23
+ } = O(l);
24
+ return /* @__PURE__ */ i(k, { ownerState: r, sx: v, elevation: 4, ...C, children: [
25
+ t && /* @__PURE__ */ n(D, { title: t, ownerState: r }),
26
+ /* @__PURE__ */ i(E, { ownerState: r, children: [
27
+ /* @__PURE__ */ n(S, { disablePadding: !0, ownerState: r, children: p.map((e, d) => /* @__PURE__ */ i(f, { children: [
28
+ d === 0 && /* @__PURE__ */ n(s, { component: "li" }),
29
+ /* @__PURE__ */ i(
30
+ w,
31
+ {
32
+ onClick: () => o == null ? void 0 : o(e),
33
+ sx: {
34
+ cursor: o ? "pointer" : "default",
35
+ "&:hover": o ? { backgroundColor: "action.hover" } : void 0
36
+ },
37
+ children: [
38
+ e.icon && /* @__PURE__ */ n(T, { children: e.icon }),
39
+ /* @__PURE__ */ n(
40
+ R,
60
41
  {
61
42
  primary: e.title,
62
43
  secondaryTypographyProps: {
63
44
  component: "div"
64
45
  },
65
- secondary: /* @__PURE__ */ o(p, { children: /* @__PURE__ */ o(B, { variant: "body2", children: R.includes(e.id) ? /* @__PURE__ */ c(p, { children: [
46
+ secondary: /* @__PURE__ */ n(a, { children: /* @__PURE__ */ n(_, { variant: "body2", children: L.includes(e.id) ? /* @__PURE__ */ i(a, { children: [
66
47
  e.description,
67
- /* @__PURE__ */ o(
68
- u,
48
+ /* @__PURE__ */ n(
49
+ c,
69
50
  {
70
51
  variant: "text",
71
52
  size: "small",
72
53
  sx: { py: 0, px: 1 },
73
- onClick: N(e.id),
54
+ onClick: y(e.id),
74
55
  children: "show less"
75
56
  }
76
57
  )
77
- ] }) : /* @__PURE__ */ c(p, { children: [
78
- G.truncate(e.description, { length: 100 }),
79
- e.description && e.description.length > 100 && /* @__PURE__ */ o(
80
- u,
58
+ ] }) : /* @__PURE__ */ i(a, { children: [
59
+ I.truncate(e.description, { length: 100 }),
60
+ e.description && e.description.length > 100 && /* @__PURE__ */ n(
61
+ c,
81
62
  {
82
63
  variant: "text",
83
64
  size: "small",
84
65
  sx: { py: 0, px: 1 },
85
- onClick: D(e.id),
66
+ onClick: u(e.id),
86
67
  children: "read more"
87
68
  }
88
69
  )
89
70
  ] }) }) })
90
71
  }
91
72
  )
92
- }
93
- ),
94
- /* @__PURE__ */ o(P, { component: "li" })
95
- ] }, e.id || r)) }),
96
- /* @__PURE__ */ o(
97
- "div",
98
- {
99
- style: {
100
- borderTop: "1px solid lightgray"
101
- },
102
- children: /* @__PURE__ */ o(
103
- F,
104
- {
105
- component: "div",
106
- count: S,
107
- page: a,
108
- rowsPerPage: i,
109
- rowsPerPageOptions: U,
110
- onPageChange: T,
111
- onRowsPerPageChange: _
112
- }
113
- )
73
+ ]
114
74
  }
115
- )
116
- ]
117
- }
118
- );
75
+ ),
76
+ /* @__PURE__ */ n(s, { component: "li" })
77
+ ] }, e.id || d)) }),
78
+ /* @__PURE__ */ n(j, { ownerState: r, children: /* @__PURE__ */ n(
79
+ b,
80
+ {
81
+ component: "div",
82
+ count: g,
83
+ page: h,
84
+ rowsPerPage: P,
85
+ rowsPerPageOptions: z,
86
+ onPageChange: x,
87
+ onRowsPerPageChange: m
88
+ }
89
+ ) })
90
+ ] })
91
+ ] });
119
92
  }
120
93
  export {
121
- K as PaginatedList
94
+ M as PaginatedList
122
95
  };
@@ -0,0 +1,45 @@
1
+ import { useThemeProps as D } from "@mui/material";
2
+ import { useState as g } from "react";
3
+ const _ = (l) => {
4
+ const i = D({ props: l, name: "MuiPaginatedList" }), {
5
+ title: u,
6
+ data: a = [],
7
+ payload: e,
8
+ totalCount: m,
9
+ onChange: t,
10
+ onItemClick: w,
11
+ sx: d,
12
+ ...h
13
+ } = i, [L, p] = g(0), [f, C] = g(5), [b, P] = g([]), r = (e == null ? void 0 : e.pageNumber) !== void 0 ? e.pageNumber : L, n = (e == null ? void 0 : e.rows) !== void 0 ? e.rows : f, v = (s, o) => {
14
+ p(o), t && t({ ...e, pageNumber: o, rows: n });
15
+ }, x = (s) => {
16
+ const o = parseInt(s.target.value, 10);
17
+ C(o), p(0), t && t({ ...e, pageNumber: 0, rows: o });
18
+ }, N = (s) => (o) => {
19
+ o.stopPropagation(), P((c) => [...c, s]);
20
+ }, R = (s) => (o) => {
21
+ o.stopPropagation(), P((c) => c.filter((k) => k !== s));
22
+ }, I = t ? m || 0 : a.length, M = t ? a : a.slice(r * n, (r + 1) * n), S = {
23
+ ...i
24
+ };
25
+ return {
26
+ title: u,
27
+ data: a,
28
+ displayData: M,
29
+ count: I,
30
+ page: r,
31
+ rowsPerPage: n,
32
+ expanded: b,
33
+ handleChangePage: v,
34
+ handleChangeRowsPerPage: x,
35
+ readMore: N,
36
+ showLess: R,
37
+ onItemClick: w,
38
+ ownerState: S,
39
+ sx: d,
40
+ other: h
41
+ };
42
+ };
43
+ export {
44
+ _ as usePaginatedListLogic
45
+ };
@@ -0,0 +1,49 @@
1
+ import { styled as t, Card as e, CardHeader as a, CardContent as n, List as o } from "@mui/material";
2
+ const s = t(e, {
3
+ name: "MuiPaginatedList",
4
+ slot: "Root"
5
+ })(() => ({
6
+ display: "flex",
7
+ flexDirection: "column",
8
+ height: "100%"
9
+ })), r = t(a, {
10
+ name: "MuiPaginatedList",
11
+ slot: "Header"
12
+ })(({ theme: i }) => ({
13
+ padding: i.spacing(3),
14
+ paddingBottom: i.spacing(2),
15
+ "& .MuiCardHeader-title": {
16
+ fontSize: "1rem",
17
+ fontWeight: 500
18
+ },
19
+ "& .MuiCardHeader-subheader": {
20
+ fontSize: ".875rem"
21
+ }
22
+ })), l = t(n, {
23
+ name: "MuiPaginatedList",
24
+ slot: "Content"
25
+ })(() => ({
26
+ padding: "0px !important",
27
+ display: "flex",
28
+ flexDirection: "column",
29
+ flex: 1,
30
+ overflow: "hidden"
31
+ })), g = t(o, {
32
+ name: "MuiPaginatedList",
33
+ slot: "List"
34
+ })(() => ({
35
+ flex: 1,
36
+ overflowY: "auto"
37
+ })), p = t("div", {
38
+ name: "MuiPaginatedList",
39
+ slot: "Pagination"
40
+ })(({ theme: i }) => ({
41
+ borderTop: `1px solid ${i.palette.divider}`
42
+ }));
43
+ export {
44
+ l as PaginatedListContent,
45
+ r as PaginatedListHeader,
46
+ g as PaginatedListList,
47
+ p as PaginatedListPagination,
48
+ s as PaginatedListRoot
49
+ };
@@ -0,0 +1,80 @@
1
+ import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
+ import { ArrowRight as d } from "@mui/icons-material";
3
+ import { Box as l, Typography as n } from "@mui/material";
4
+ import p from "lodash";
5
+ import x from "react";
6
+ import b from "../instance-variable-list/variable.js";
7
+ import { useProfileCardLogic as u } from "./logic.js";
8
+ import { ProfileCardRoot as v, ProfileCardImage as P, ProfileCardHierarchy as C, ProfileCardVariables as I } from "./styled.js";
9
+ function A(s) {
10
+ const {
11
+ instance: r,
12
+ imageUrl: h,
13
+ templateHierarchy: m,
14
+ propertyNames: c,
15
+ ownerState: a,
16
+ sx: f,
17
+ templateIconUrl: g,
18
+ other: y
19
+ } = u(s);
20
+ return console.log(c, 26), /* @__PURE__ */ i(v, { ownerState: a, sx: f, ...y, children: [
21
+ /* @__PURE__ */ e(l, { mb: 2, children: /* @__PURE__ */ e(
22
+ P,
23
+ {
24
+ src: h || "https://picsum.photos/600/400",
25
+ alt: "Profile",
26
+ ownerState: a
27
+ }
28
+ ) }),
29
+ /* @__PURE__ */ i(l, { display: "flex", alignItems: "center", mb: 1, children: [
30
+ /* @__PURE__ */ e("img", { src: g, alt: "Template Icon" }),
31
+ /* @__PURE__ */ e(n, { variant: "h5", component: "h2", gutterBottom: !0, children: r.title })
32
+ ] }),
33
+ r.description && /* @__PURE__ */ e(n, { variant: "body1", paragraph: !0, children: r.description }),
34
+ /* @__PURE__ */ i(C, { ownerState: a, children: [
35
+ m.map((t, o) => /* @__PURE__ */ i(l, { display: "inline", alignItems: "center", children: [
36
+ o > 0 && /* @__PURE__ */ e(
37
+ d,
38
+ {
39
+ sx: { height: 20, verticalAlign: "middle" },
40
+ color: "disabled"
41
+ }
42
+ ),
43
+ /* @__PURE__ */ e(n, { variant: "caption", color: "text.secondary", children: t.name })
44
+ ] }, t.id || o)),
45
+ /* @__PURE__ */ i(l, { display: "inline", alignItems: "center", children: [
46
+ m.length > 0 && /* @__PURE__ */ e(
47
+ d,
48
+ {
49
+ sx: { height: 20, verticalAlign: "middle" },
50
+ color: "disabled"
51
+ }
52
+ ),
53
+ /* @__PURE__ */ e(
54
+ n,
55
+ {
56
+ variant: "caption",
57
+ color: "text.secondary",
58
+ fontWeight: "bold",
59
+ children: r.template.name
60
+ }
61
+ )
62
+ ] })
63
+ ] }),
64
+ /* @__PURE__ */ e(I, { ownerState: a, children: p.keys(r.variables).map((t, o) => /* @__PURE__ */ e(
65
+ b,
66
+ {
67
+ type: t,
68
+ data: p.get(r.variables, t),
69
+ hashPrefix: `${r.template.type}-${r.template.templateKey}-`,
70
+ properties: c
71
+ },
72
+ o
73
+ )) })
74
+ ] });
75
+ }
76
+ const V = x.memo(A);
77
+ export {
78
+ A as ProfileCard,
79
+ V as default
80
+ };
@@ -0,0 +1,33 @@
1
+ import { useThemeProps as g } from "@mui/material";
2
+ import { useMemo as n } from "react";
3
+ import { getTemplateHierarchy as M } from "../../utils/ontology.js";
4
+ const $ = (c) => {
5
+ const a = g({ props: c, name: "MuiProfileCard" }), { instance: t, templates: e, sx: m, ...i } = a, l = t.profileImageUrl, o = e.get(t.template.id), f = o == null ? void 0 : o.icon, h = n(() => {
6
+ const r = e.get(t.template.id);
7
+ return r ? M(e, r) : [];
8
+ }, [e, t.template.id]), u = n(() => {
9
+ const r = /* @__PURE__ */ new Map();
10
+ return e && e.forEach((s) => {
11
+ s.properties.forEach((p) => {
12
+ const d = `${s.type}-${s.templateKey}-${p.propertyId}`;
13
+ r.set(d, p.name);
14
+ });
15
+ }), r;
16
+ }, [e]), y = {
17
+ ...a
18
+ };
19
+ return {
20
+ instance: t,
21
+ templates: e,
22
+ imageUrl: l,
23
+ templateHierarchy: h,
24
+ propertyNames: u,
25
+ ownerState: y,
26
+ sx: m,
27
+ templateIconUrl: f,
28
+ other: i
29
+ };
30
+ };
31
+ export {
32
+ $ as useProfileCardLogic
33
+ };
@@ -0,0 +1,43 @@
1
+ import { styled as e, Container as i, Box as a } from "@mui/material";
2
+ const d = e(i, {
3
+ name: "MuiProfileCard",
4
+ slot: "Root",
5
+ overridesResolver: (r, o) => o.root
6
+ })(({ theme: r }) => ({
7
+ display: "flex",
8
+ flexDirection: "column",
9
+ alignItems: "center",
10
+ padding: r.spacing(3),
11
+ borderRadius: r.shape.borderRadius * 2,
12
+ boxShadow: r.shadows[1],
13
+ backgroundColor: r.palette.background.paper
14
+ })), l = e("img", {
15
+ name: "MuiProfileCard",
16
+ slot: "Image",
17
+ overridesResolver: (r, o) => o.image
18
+ })(({ theme: r }) => ({
19
+ maxWidth: 200,
20
+ borderRadius: "100%",
21
+ height: 200,
22
+ marginBottom: r.spacing(2)
23
+ })), t = e(a, {
24
+ name: "MuiProfileCard",
25
+ slot: "Hierarchy",
26
+ overridesResolver: (r, o) => o.hierarchy
27
+ })(({ theme: r }) => ({
28
+ marginLeft: 0,
29
+ marginBottom: r.spacing(2),
30
+ textAlign: "left"
31
+ })), n = e(a, {
32
+ name: "MuiProfileCard",
33
+ slot: "Variables",
34
+ overridesResolver: (r, o) => o.variables
35
+ })(({ theme: r }) => ({
36
+ paddingTop: r.spacing(2)
37
+ }));
38
+ export {
39
+ t as ProfileCardHierarchy,
40
+ l as ProfileCardImage,
41
+ d as ProfileCardRoot,
42
+ n as ProfileCardVariables
43
+ };