@campxdev/react-blueprint 0.1.26 → 0.1.28

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.
@@ -12,6 +12,7 @@ const config: StorybookConfig = {
12
12
  "@storybook/addon-interactions",
13
13
  "@storybook/addon-mdx-gfm",
14
14
  "storybook-dark-mode",
15
+ "@storybook/addon-designs",
15
16
  ],
16
17
 
17
18
  framework: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@campxdev/react-blueprint",
3
- "version": "0.1.26",
3
+ "version": "0.1.28",
4
4
  "main": "./export.ts",
5
5
  "private": false,
6
6
  "dependencies": {
@@ -10,6 +10,7 @@
10
10
  "@mui/material": "^5.14.11",
11
11
  "@mui/x-data-grid": "^7.5.1",
12
12
  "@storybook/addon-backgrounds": "^8.1.5",
13
+ "@storybook/addon-designs": "^8.0.2",
13
14
  "@testing-library/jest-dom": "^5.14.1",
14
15
  "@testing-library/react": "^13.0.0",
15
16
  "@testing-library/user-event": "^13.2.1",
package/src/App.tsx CHANGED
@@ -10,8 +10,7 @@ function App() {
10
10
  appsMenu={<AppsMenu apps={[]} />}
11
11
  clientLogo={""}
12
12
  fullName={""}
13
- userBoxActions={[]}
14
- />
13
+ userBoxActions={[]} navigationIcon={true} showActiveDevices={true} />
15
14
  </Providers>
16
15
  );
17
16
  }
@@ -0,0 +1 @@
1
+ export * from ".//DataTable/DataTable";
@@ -10,6 +10,12 @@ export default {
10
10
  title: "Input/Button",
11
11
  component: Button,
12
12
  tags: ["autodocs"],
13
+ parameters: {
14
+ design: {
15
+ type: "figma",
16
+ url: "https://www.figma.com/design/S5t9x8kNHEuzBGv6305qLf/Srikanth-PlayGround?node-id=2-20", // Replace with your actual Figma link
17
+ },
18
+ },
13
19
  argTypes: {
14
20
  variant: {
15
21
  control: "select",
@@ -0,0 +1,5 @@
1
+ export * from "./Button/Button";
2
+ export * from "./SearchBar/SearchBar";
3
+ export * from "./SingleSelect/SingleSelect";
4
+ export * from "./Switch/Switch";
5
+ export * from "./TextField/TextField";
@@ -109,6 +109,9 @@ export const WithActions: Story = {
109
109
  clientLogo: "https://via.placeholder.com/150",
110
110
  fullName: "John Doe",
111
111
  designation: "Head of the Department",
112
+ avatar:false,
113
+ navigationIcon:false,
114
+ showActiveDevices:false,
112
115
  appsMenu: (
113
116
  <AppsMenu
114
117
  apps={[
@@ -26,6 +26,9 @@ export interface AppHeaderProps {
26
26
  imageSx?: any;
27
27
  headerSx?: any;
28
28
  profileSx?: any;
29
+ avatar?: any;
30
+ navigationIcon:any;
31
+ showActiveDevices: any;
29
32
  }
30
33
 
31
34
  export const AppHeader = ({
@@ -42,6 +45,9 @@ export const AppHeader = ({
42
45
  headerSx = {},
43
46
  profileSx = {},
44
47
  imageSx = {},
48
+ avatar={},
49
+ navigationIcon={},
50
+ showActiveDevices={},
45
51
  }: AppHeaderProps) => {
46
52
  return (
47
53
  <StyledHeader sx={headerSx}>
@@ -55,14 +61,18 @@ export const AppHeader = ({
55
61
  customHeaderActions
56
62
  ) : (
57
63
  <HeaderActions
58
- cogWheelMenu={cogWheelMenu}
59
- fullName={fullName ?? ""}
60
- designation={designation}
61
- userBoxActions={userBoxActions}
62
- profileUrl={profileUrl ?? ""}
63
- actions={actions}
64
- profileSx={profileSx}
65
- />
64
+ cogWheelMenu={cogWheelMenu}
65
+ fullName={fullName ?? ""}
66
+ designation={designation}
67
+ userBoxActions={userBoxActions}
68
+ profileUrl={profileUrl ?? ""}
69
+ actions={actions}
70
+ profileSx={profileSx}
71
+ avatar={avatar}
72
+ navigationIcon={navigationIcon}
73
+ showActiveDevices={showActiveDevices}
74
+ />
75
+
66
76
  )}
67
77
  </StyledActionBox>
68
78
  </StyledContainer>
@@ -1,3 +1,5 @@
1
+ // HeaderActions.tsx
2
+
1
3
  import { Divider, Stack } from "@mui/material";
2
4
  import { ReactNode } from "react";
3
5
  import CogWheelMenu from "./CogWheelMenu";
@@ -5,26 +7,32 @@ import UserBox from "./UserBox";
5
7
 
6
8
  export interface HeaderActionsProps {
7
9
  cogWheelMenu: ReactNode[];
8
- fullName: string;
10
+ fullName?: string;
9
11
  designation?: string;
10
- userBoxActions: {
12
+ userBoxActions?: {
11
13
  label: ReactNode;
12
14
  icon?: ReactNode;
13
15
  onClick: any;
14
16
  }[];
15
- profileUrl: string | undefined;
17
+ profileUrl?: string;
16
18
  actions?: ReactNode[];
17
- profileSx?: any; // Making HelpButton prop optional
19
+ profileSx?: any;
20
+ avatar?: any;
21
+ navigationIcon:any;
22
+ showActiveDevices: any;
18
23
  }
19
24
 
20
25
  const HeaderActions = ({
21
26
  cogWheelMenu,
22
27
  fullName,
23
28
  designation,
24
- userBoxActions,
29
+ userBoxActions = [],
25
30
  profileUrl = "",
26
31
  actions = [],
27
32
  profileSx = {},
33
+ avatar={},
34
+ navigationIcon={},
35
+ showActiveDevices={},
28
36
  }: HeaderActionsProps) => {
29
37
  return (
30
38
  <Stack direction="row" gap={1} alignItems="center">
@@ -45,13 +53,19 @@ const HeaderActions = ({
45
53
  {cogWheelMenu?.length ? <CogWheelMenu menu={cogWheelMenu} /> : null}
46
54
 
47
55
  {/* Render UserBox */}
48
- <UserBox
49
- fullName={fullName}
50
- designation={designation}
51
- actions={userBoxActions}
52
- profileUrl={profileUrl}
53
- profileSx={profileSx}
54
- />
56
+ {fullName && (
57
+ <UserBox
58
+ fullName={fullName}
59
+ designation={designation}
60
+ actions={userBoxActions}
61
+ profileUrl={profileUrl}
62
+ profileSx={profileSx}
63
+ avatar={avatar}
64
+ navigationIcon={navigationIcon}
65
+ showActiveDevices={showActiveDevices}
66
+ />
67
+ )}
68
+
55
69
  </Stack>
56
70
  );
57
71
  };
@@ -4,20 +4,6 @@ import { DropdownMenu } from "../../../Navigation/DropDownMenu/DropDownMenu";
4
4
  import { DropdownMenuItem } from "../../../Navigation/DropDownMenu/DropdownMenuItem";
5
5
  import { Icons } from "../../../export";
6
6
  import { StyledAvatar, StyledTypography } from "../styles/styles";
7
- // import {
8
- // activeDevices,
9
- // changePassword,
10
- // logoutIcon,
11
- // profile,
12
- // } from '../../../../assets/images'
13
-
14
- // import logout from '../../../../utils/logout'
15
- // import ActiveDevices from '../../../ActiveDevices'
16
- // import ChangePassword from '../../../ChangePassword'
17
- // import DropDownButton from '../../../DropDownButton/DropDownButton'
18
- // import { IMenuItemProps } from '../../../DropDownButton/DropdownMenuItem'
19
- // import MyProfile from '../../../MyProfile/MyProfile'
20
- // import { StyledAvatar } from '../styles'
21
7
 
22
8
  const getStartingLetters = (text: string) => {
23
9
  if (!text) return "";
@@ -33,6 +19,9 @@ export default function UserBox({
33
19
  actions,
34
20
  profileUrl,
35
21
  profileSx = {},
22
+ avatar = true, // Make avatar optional, default to true
23
+ navigationIcon = true, // Make navigationIcon optional, default to true
24
+ showActiveDevices = true, // Make active devices optional, default to true
36
25
  }: {
37
26
  fullName: string;
38
27
  designation?: string;
@@ -44,6 +33,9 @@ export default function UserBox({
44
33
 
45
34
  profileUrl?: string;
46
35
  profileSx?: any;
36
+ avatar?: boolean; // Define avatar as optional
37
+ navigationIcon?: boolean; // Define navigationIcon as optional
38
+ showActiveDevices?: boolean; // Define active devices as optional
47
39
  }) {
48
40
  const theme = useTheme();
49
41
 
@@ -70,31 +62,35 @@ export default function UserBox({
70
62
  alignItems={"center"}
71
63
  justifyContent={"space-between"}
72
64
  >
73
- <Stack direction={"row"} gap={1}>
74
- <StyledAvatar src={profileUrl ?? ""} sx={profileSx}>
75
- {getStartingLetters(fullName)}
76
- </StyledAvatar>
77
- <Stack direction={"row"} justifyContent={"space-between"}>
78
- <Stack>
79
- <Typography variant="subtitle3">{fullName}</Typography>
80
- <Typography variant="caption">{designation}</Typography>
65
+ {avatar && (
66
+ <Stack direction={"row"} gap={1}>
67
+ <StyledAvatar src={profileUrl ?? ""} sx={profileSx}>
68
+ {getStartingLetters(fullName)}
69
+ </StyledAvatar>
70
+ <Stack direction={"row"} justifyContent={"space-between"}>
71
+ <Stack>
72
+ <Typography variant="subtitle3">{fullName}</Typography>
73
+ <Typography variant="caption">{designation}</Typography>
74
+ </Stack>
81
75
  </Stack>
82
76
  </Stack>
83
- </Stack>
84
- <Icons.NavigationIcon />
77
+ )}
78
+ {navigationIcon && <Icons.NavigationIcon />}
85
79
  </Stack>
86
80
  </Stack>
87
81
  }
88
82
  onClick={() => alert("Action 1 clicked")}
89
83
  />,
90
- <DropdownMenuItem
91
- label={
92
- <Stack gap={0.5}>
93
- <Typography variant="subtitle3">Active Devices</Typography>
94
- </Stack>
95
- }
96
- onClick={() => alert("Action 1 clicked")}
97
- />,
84
+ showActiveDevices && (
85
+ <DropdownMenuItem
86
+ label={
87
+ <Stack gap={0.5}>
88
+ <Typography variant="subtitle3">Active Devices</Typography>
89
+ </Stack>
90
+ }
91
+ onClick={() => alert("Action 1 clicked")}
92
+ />
93
+ ),
98
94
  <DropdownMenuItem
99
95
  label={
100
96
  <Stack
@@ -104,7 +100,6 @@ export default function UserBox({
104
100
  width={"100%"}
105
101
  >
106
102
  <Typography variant="subtitle3">Logout</Typography>
107
-
108
103
  <Icons.LogoutIcon hoverColor={theme.palette.highlight.main} />
109
104
  </Stack>
110
105
  }
@@ -1,8 +1,6 @@
1
+ export * from "./DataDisplay/export";
1
2
  export * from "./Icons/export";
2
- export * from "./Input/Button/Button";
3
- export * from "./Input/SingleSelect/SingleSelect";
4
- export * from "./Input/Switch/Switch";
5
- export * from "./Input/TextField/TextField";
3
+ export * from "./Input/export";
6
4
  export * from "./Layout/Header/AppHeader";
7
5
  export * from "./Layout/Header/AppLogo";
8
6
  export * from "./Layout/Header/AppsMenu";