@nethru/ui 1.0.22 → 1.0.24

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.
@@ -0,0 +1,56 @@
1
+ import { Chip, Stack, Link } from "@mui/material";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ export default function ReferenceChipList({
4
+ references,
5
+ onClick,
6
+ chipStyles,
7
+ chipProps,
8
+ sx,
9
+ ...props
10
+ }) {
11
+ return /*#__PURE__*/_jsx(Stack, {
12
+ direction: "row",
13
+ gap: 0.5,
14
+ sx: {
15
+ flexWrap: 'wrap',
16
+ ...sx
17
+ },
18
+ ...props,
19
+ children: references.map((reference, index) => {
20
+ return reference.href ? /*#__PURE__*/_jsx(Link, {
21
+ href: reference.href,
22
+ underline: "none",
23
+ onClick: event => onClick(reference.id, event),
24
+ children: /*#__PURE__*/_jsx(ReferenceChip, {
25
+ name: reference.name,
26
+ sx: chipStyles,
27
+ ...chipProps
28
+ })
29
+ }, index) : /*#__PURE__*/_jsx(ReferenceChip, {
30
+ name: reference.name,
31
+ onClick: event => onClick(reference.id, event),
32
+ sx: {
33
+ cursor: 'default',
34
+ ...chipStyles
35
+ },
36
+ ...chipProps
37
+ }, index);
38
+ })
39
+ });
40
+ }
41
+ function ReferenceChip({
42
+ name,
43
+ sx,
44
+ ...props
45
+ }) {
46
+ return /*#__PURE__*/_jsx(Chip, {
47
+ variant: "outlined",
48
+ label: name,
49
+ size: "small",
50
+ sx: {
51
+ fontSize: '13px',
52
+ ...sx
53
+ },
54
+ ...props
55
+ });
56
+ }
package/dist/index.js CHANGED
@@ -18,6 +18,7 @@ export { default as ListItemDivider } from "./ListItemDivider";
18
18
  export { default as ListItemGrid } from "./ListItemGrid";
19
19
  export { default as ListItemText } from "./ListItemText";
20
20
  export { default as MainHeader } from "./MainHeader";
21
+ export { default as ReferenceChipList } from "./ReferenceChipList";
21
22
  export { default as SearchTextField } from "./SearchTextField";
22
23
  export { default as Section } from "./Section";
23
24
  export { default as Select } from "./Select";
@@ -91,7 +91,7 @@ function updateActiveItems(draft, menu, href) {
91
91
  function updateActiveSection(sections) {
92
92
  if (!sections) return;
93
93
  for (let section of sections) {
94
- if (section.href === href) {
94
+ if (href.indexOf(section.href) === 0) {
95
95
  draft.activeSecondaryItem = section.id;
96
96
  return true;
97
97
  }
@@ -104,7 +104,7 @@ function updateActiveItems(draft, menu, href) {
104
104
  function updateActiveSubmenuItems(id, submenu) {
105
105
  if (!submenu) return;
106
106
  for (let item of submenu) {
107
- if (item.href === href) {
107
+ if (href.indexOf(item.href) === 0) {
108
108
  if (!(id in draft.menuTrees)) draft.menuTrees[id] = emptyState();
109
109
  draft.activeSecondaryItem = item.id;
110
110
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nethru/ui",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "/dist"
@@ -25,7 +25,7 @@
25
25
  "immer": "^10.0.3",
26
26
  "react": "^18.2.0",
27
27
  "react-dom": "^18.2.0",
28
- "react-router-dom": "^6.20.0",
28
+ "react-router-dom": "^6.20.1",
29
29
  "react-scripts": "5.0.1"
30
30
  },
31
31
  "scripts": {