@campxdev/react-blueprint 1.1.3 → 1.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@campxdev/react-blueprint",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "main": "./export.ts",
5
5
  "private": false,
6
6
  "dependencies": {
@@ -8,7 +8,7 @@ export const ArrowBackIcon = ({ size = 16 }) => {
8
8
  <svg
9
9
  width={size}
10
10
  height={size}
11
- viewBox={`0 0 ${size} ${size}`}
11
+ viewBox="0 0 16 17"
12
12
  xmlns="http://www.w3.org/2000/svg"
13
13
  >
14
14
  <path
@@ -8,7 +8,7 @@ export const CollapseIcon = ({ size = 16 }) => {
8
8
  <svg
9
9
  width={size}
10
10
  height={size}
11
- viewBox={`0 0 ${size} ${size}`}
11
+ viewBox="0 0 16 16"
12
12
  xmlns="http://www.w3.org/2000/svg"
13
13
  >
14
14
  <path
@@ -8,7 +8,7 @@ export const ExpandIcon = ({ size = 16 }) => {
8
8
  <svg
9
9
  width={size}
10
10
  height={size}
11
- viewBox={`0 0 ${size} ${size}`}
11
+ viewBox="0 0 16 16"
12
12
  xmlns="http://www.w3.org/2000/svg"
13
13
  >
14
14
  <path
@@ -0,0 +1,29 @@
1
+ import { useTheme } from "@mui/material";
2
+
3
+ export const RedoIcon = ({ size = 16 }) => {
4
+ const theme = useTheme();
5
+ const color = theme.palette.text.primary;
6
+
7
+ return (
8
+ <svg
9
+ width={size}
10
+ height={size}
11
+ viewBox={`0 0 20 20`}
12
+ fill="none"
13
+ xmlns="http://www.w3.org/2000/svg"
14
+ >
15
+ <path
16
+ d="M12.612 4.01719H5.94531C5.75303 4.01719 5.56862 4.09357 5.43266 4.22954C5.2967 4.3655 5.22031 4.54991 5.22031 4.74219C5.22031 4.93447 5.2967 5.11888 5.43266 5.25484C5.56862 5.3908 5.75303 5.46719 5.94531 5.46719H12.612C13.5248 5.46719 14.4002 5.82979 15.0456 6.47523C15.691 7.12067 16.0536 7.99607 16.0536 8.90885C16.0536 9.82164 15.691 10.697 15.0456 11.3425C14.4002 11.9879 13.5248 12.3505 12.612 12.3505H3.44531C3.25303 12.3505 3.06862 12.4269 2.93266 12.5629C2.7967 12.6988 2.72031 12.8832 2.72031 13.0755C2.72031 13.2678 2.7967 13.4522 2.93266 13.5882C3.06862 13.7241 3.25303 13.8005 3.44531 13.8005H12.612C13.9093 13.8005 15.1535 13.2851 16.0709 12.3678C16.9883 11.4504 17.5036 10.2062 17.5036 8.90885C17.5036 7.6115 16.9883 6.36729 16.0709 5.44992C15.1535 4.53256 13.9093 4.01719 12.612 4.01719Z"
17
+ fill={color}
18
+ stroke="#323167"
19
+ stroke-width="0.2"
20
+ />
21
+ <path
22
+ d="M5.35888 10.2672C5.26348 10.2668 5.16895 10.2854 5.08082 10.3219C4.99263 10.3584 4.91261 10.4122 4.84543 10.48C4.84537 10.4801 4.84531 10.4801 4.84524 10.4802L2.71227 12.6131L2.71185 12.6136C2.57712 12.7499 2.50156 12.9339 2.50156 13.1255C2.50156 13.3172 2.57712 13.5012 2.71185 13.6375L2.71227 13.6379L4.845 15.7706C4.91172 15.8396 4.99146 15.8946 5.07961 15.9325C5.16804 15.9706 5.26317 15.9906 5.35943 15.9915C5.4557 15.9924 5.55117 15.9741 5.64029 15.9377C5.7294 15.9013 5.81038 15.8475 5.87848 15.7794C5.94659 15.7114 6.00046 15.6305 6.03695 15.5414C6.07345 15.4523 6.09184 15.3569 6.09105 15.2606C6.09026 15.1643 6.0703 15.0692 6.03235 14.9807C5.99451 14.8925 5.93953 14.8127 5.87061 14.7459L4.25024 13.1255L5.87119 11.5046L5.87161 11.5042C6.00634 11.3678 6.0819 11.1839 6.0819 10.9922C6.0819 10.8005 6.00634 10.6166 5.87161 10.4802L5.87155 10.4802C5.80445 10.4124 5.72452 10.3586 5.63643 10.3221C5.54846 10.2856 5.45412 10.2669 5.35888 10.2672ZM5.35888 10.2672C5.35902 10.2672 5.35916 10.2672 5.35931 10.2672L5.35881 10.3672L5.35846 10.2672C5.3586 10.2672 5.35874 10.2672 5.35888 10.2672Z"
23
+ fill={color}
24
+ stroke="#323167"
25
+ stroke-width="0.2"
26
+ />
27
+ </svg>
28
+ );
29
+ };
@@ -40,6 +40,7 @@ import { InfoFilledIcon } from "./IconComponents/InfoFilledIcon";
40
40
  import { PeoplexIcon } from "./IconComponents/PeoplexIcon";
41
41
  import { ProductFeaturesIcon } from "./IconComponents/ProductFeaturesIcon";
42
42
  import { ProfileIcon } from "./IconComponents/ProfileIcon";
43
+ import { RedoIcon } from "./IconComponents/RedoIcon";
43
44
  import { RightIcon } from "./IconComponents/RightIcon";
44
45
  import { SaveIcon } from "./IconComponents/SaveIcon";
45
46
  import { SearchIcon } from "./IconComponents/SearchIcon";
@@ -52,6 +53,7 @@ import { UnCheckedRadioIcon } from "./IconComponents/UncheckedRadioIcon";
52
53
  import { WarningFilledIcon } from "./IconComponents/WarningFilledIcon";
53
54
 
54
55
  export const Icons = {
56
+ RedoIcon,
55
57
  ArrowBackIcon,
56
58
  CollapseIcon,
57
59
  ExpandIcon,
@@ -5,6 +5,14 @@ import {
5
5
 
6
6
  export type TypographyProps = {} & MuiTypographyProps;
7
7
 
8
- export const Typography = ({ variant, children }: TypographyProps) => {
9
- return <MuiTypography variant={variant}>{children}</MuiTypography>;
8
+ export const Typography = ({
9
+ variant,
10
+ children,
11
+ ...props
12
+ }: TypographyProps) => {
13
+ return (
14
+ <MuiTypography variant={variant} {...props}>
15
+ {children}
16
+ </MuiTypography>
17
+ );
10
18
  };
@@ -0,0 +1,34 @@
1
+ import { useMatch, useResolvedPath } from "react-router-dom";
2
+ import { Typography } from "../../export";
3
+ import { DropdownMenuItem } from "./interfaces";
4
+ import { createSidebarStyles } from "./styles";
5
+
6
+ export const SidebarDropdownItem = ({
7
+ dropdownItem,
8
+ collapsed,
9
+ index,
10
+ }: {
11
+ dropdownItem: DropdownMenuItem;
12
+ collapsed: boolean;
13
+ index: number;
14
+ }) => {
15
+ const { name, path, permissionKey } = dropdownItem;
16
+
17
+ let resolved = useResolvedPath(path);
18
+ let match = useMatch({ path: resolved.pathname, end: false });
19
+
20
+ const { StyledListItem, StyledLinkButton, StyledListItemButton } =
21
+ createSidebarStyles(collapsed);
22
+
23
+ return (
24
+ <StyledListItem key={index} disablePadding className="listItem">
25
+ <StyledLinkButton to={path} match={match}>
26
+ {!collapsed && (
27
+ <StyledListItemButton collapsed={collapsed}>
28
+ <Typography variant="button1">{name}</Typography>
29
+ </StyledListItemButton>
30
+ )}
31
+ </StyledLinkButton>
32
+ </StyledListItem>
33
+ );
34
+ };
@@ -3,6 +3,7 @@ import { motion } from "framer-motion";
3
3
  import { useState } from "react";
4
4
  import { useMatch, useResolvedPath } from "react-router-dom";
5
5
  import { Icons, Tooltip, Typography } from "../../export";
6
+ import { SidebarDropdownItem } from "./DropdownItem";
6
7
  import { MenuItemProps } from "./interfaces";
7
8
  import { createSidebarStyles } from "./styles";
8
9
 
@@ -10,13 +11,11 @@ export const SideBarMenuItem = ({
10
11
  menuItem,
11
12
  index,
12
13
  collapsed,
13
- isDropdownMenuItem = false,
14
14
  newMenuClickHandler,
15
15
  }: {
16
16
  menuItem: MenuItemProps;
17
17
  index: number;
18
18
  collapsed: boolean;
19
- isDropdownMenuItem?: boolean;
20
19
  newMenuClickHandler: (newMenu: MenuItemProps[], newMenuTitle: string) => void;
21
20
  }) => {
22
21
  const {
@@ -28,7 +27,8 @@ export const SideBarMenuItem = ({
28
27
  HoverIcon,
29
28
  } = createSidebarStyles(collapsed);
30
29
 
31
- const { path, icon: Icon, name, menu: newMenu, dropdownMenu } = menuItem;
30
+ const { name, path, icon: Icon, menu: newMenu, dropdownMenu } = menuItem;
31
+
32
32
  let resolved = useResolvedPath(path);
33
33
  let match = useMatch({ path: resolved.pathname, end: false });
34
34
 
@@ -61,7 +61,7 @@ export const SideBarMenuItem = ({
61
61
  <Typography variant="button1">{name}</Typography>
62
62
  </Stack>
63
63
  <HoverIcon display={"flex"} className="hoverIcon">
64
- <Icons.ClogWheelIcon />
64
+ <Icons.RedoIcon size={18} />
65
65
  </HoverIcon>
66
66
  </Stack>
67
67
  </StyledListItemButton>
@@ -94,9 +94,7 @@ export const SideBarMenuItem = ({
94
94
  const DefaultTile = () => {
95
95
  return (
96
96
  <StyledListItemButton collapsed={collapsed}>
97
- {!isDropdownMenuItem && (
98
- <StyledListItemIcon collapsed={collapsed}>{Icon}</StyledListItemIcon>
99
- )}
97
+ <StyledListItemIcon collapsed={collapsed}>{Icon}</StyledListItemIcon>
100
98
  <Typography variant="button1">{name}</Typography>
101
99
  </StyledListItemButton>
102
100
  );
@@ -132,13 +130,10 @@ export const SideBarMenuItem = ({
132
130
  {expanded && dropdownMenu && dropdownMenu.length > 0 && (
133
131
  <Stack>
134
132
  {dropdownMenu?.map((item: any, index: number) => (
135
- <SideBarMenuItem
136
- menuItem={item}
137
- index={index}
138
- key={index}
133
+ <SidebarDropdownItem
134
+ dropdownItem={item}
139
135
  collapsed={collapsed}
140
- isDropdownMenuItem={true}
141
- newMenuClickHandler={newMenuClickHandler}
136
+ index={index}
142
137
  />
143
138
  ))}
144
139
  </Stack>
@@ -62,7 +62,7 @@ export const Sidebar = ({
62
62
  StyledMenuBar,
63
63
  StyledCollapsibleSection,
64
64
  StyledMenuHeaderButton,
65
- } = useMemo(() => createSidebarStyles(collapsed), [collapsed, currentMenu]);
65
+ } = useMemo(() => createSidebarStyles(collapsed), [collapsed]);
66
66
 
67
67
  return (
68
68
  <motion.div
@@ -6,7 +6,13 @@ export interface MenuItemProps {
6
6
  icon: ReactElement;
7
7
  permissionKey?: string;
8
8
  menu?: MenuItemProps[];
9
- dropdownMenu?: MenuItemProps[];
9
+ dropdownMenu?: DropdownMenuItem[];
10
+ }
11
+
12
+ export interface DropdownMenuItem {
13
+ name: string;
14
+ path: string;
15
+ permissionKey?: string;
10
16
  }
11
17
 
12
18
  export interface MenuHistory {