@campxdev/react-blueprint 0.1.0 → 0.1.1

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.
Files changed (35) hide show
  1. package/.storybook/preview.tsx +1 -1
  2. package/exports.ts +2 -1
  3. package/package.json +8 -7
  4. package/src/App.tsx +1 -0
  5. package/src/components/DropDownMenu/DropDownButton.tsx +3 -3
  6. package/src/components/DropDownMenu/DropDownIcon.tsx +3 -3
  7. package/src/components/DropDownMenu/DropDownMenu.stories.tsx +4 -4
  8. package/src/components/DropDownMenu/DropDownMenu.tsx +1 -2
  9. package/src/components/DropDownMenu/MenuItemButton.tsx +1 -3
  10. package/src/components/Input/Button/Button.stories.tsx +1 -1
  11. package/src/components/Input/Button/Button.tsx +1 -2
  12. package/src/components/Input/SingleSelect/SingleSelect.stories.tsx +10 -10
  13. package/src/components/Input/SingleSelect/SingleSelect.tsx +192 -2
  14. package/src/components/Input/Switch/Switch.stories.tsx +1 -1
  15. package/src/components/Input/Switch/Switch.tsx +1 -3
  16. package/src/components/Input/TextField/TextField.stories.tsx +1 -1
  17. package/src/components/Input/TextField/TextField.tsx +3 -3
  18. package/src/components/Layout/ComponentBackground/ComponentBackground.tsx +8 -7
  19. package/src/components/Layout/Header/AppHeader.stories.tsx +1 -1
  20. package/src/components/Layout/Header/HeaderActions/CogWheelMenu.tsx +1 -1
  21. package/src/components/Layout/Header/HeaderActions/UserBox.tsx +1 -1
  22. package/src/components/Typography/Typography.stories.tsx +1 -1
  23. package/src/components/Typography/Typography.tsx +1 -3
  24. package/src/components/export.ts +6 -0
  25. package/src/contexts/Providers.tsx +1 -1
  26. package/src/themes/MuiThemeProvider.tsx +4 -4
  27. package/src/themes/commonTheme.ts +11 -179
  28. package/src/themes/darkTheme.ts +1 -5
  29. package/src/themes/export.ts +5 -0
  30. package/src/themes/lightTheme.ts +1 -3
  31. package/src/themes/typography.stories.tsx +1 -1
  32. package/src/utils/campxAxios.ts +17 -0
  33. package/tsconfig.json +1 -0
  34. package/src/components/index.ts +0 -1
  35. package/src/themes/index.ts +0 -4
@@ -2,7 +2,7 @@ import { CssBaseline } from "@mui/material";
2
2
  import type { Preview } from "@storybook/react";
3
3
  import React from "react";
4
4
  import { BrowserRouter } from "react-router-dom";
5
- import ComponentBackground from "../src/components/Layout/ComponentBackground/ComponentBackground";
5
+ import { ComponentBackground } from "../src/components/Layout/ComponentBackground/ComponentBackground";
6
6
 
7
7
  const withThemeProvider = (Story) => (
8
8
  <ComponentBackground>
package/exports.ts CHANGED
@@ -1 +1,2 @@
1
- export * from "./src/components";
1
+ export * from "./src/components/export";
2
+ export * from "./src/themes/export";
package/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "@campxdev/react-blueprint",
3
- "version": "0.1.0",
4
- "main": "./exports.ts",
3
+ "version": "0.1.1",
5
4
  "publishConfig": {
6
5
  "access": "public"
7
6
  },
@@ -17,18 +16,19 @@
17
16
  "@types/node": "^16.7.13",
18
17
  "@types/react": "^18.0.0",
19
18
  "@types/react-dom": "^18.0.0",
19
+ "axios": "^1.7.2",
20
+ "js-cookie": "^3.0.5",
21
+ "pullstate": "^1.24.0",
20
22
  "react": "^18.3.1",
21
23
  "react-dom": "^18.3.1",
24
+ "react-router-dom": "^6.4.2",
22
25
  "react-scripts": "5.0.1",
23
26
  "typescript": "^4.4.2",
24
- "pullstate": "^1.24.0",
25
- "web-vitals": "^2.1.0",
26
- "react-router-dom": "^6.4.2"
27
+ "web-vitals": "^2.1.0"
27
28
  },
28
29
  "scripts": {
29
30
  "start": "react-scripts start",
30
- "build": "CI=false && react-scripts build",
31
- "prepublish": "npm run build",
31
+ "build": "react-scripts build",
32
32
  "test": "react-scripts test",
33
33
  "eject": "react-scripts eject",
34
34
  "storybook": "storybook dev -p 6006",
@@ -55,6 +55,7 @@
55
55
  },
56
56
  "devDependencies": {
57
57
  "@babel/plugin-proposal-private-property-in-object": "^7.21.11",
58
+ "@types/js-cookie": "^3.0.5",
58
59
  "@chromatic-com/storybook": "^1.4.0",
59
60
  "@storybook/addon-essentials": "^8.1.1",
60
61
  "@storybook/addon-interactions": "^8.1.1",
package/src/App.tsx CHANGED
@@ -5,6 +5,7 @@ function App() {
5
5
  return (
6
6
  <Providers>
7
7
  {/* <AppHeader clientLogo={""} fullName={""} userBoxActions={[]} /> */}
8
+ <></>
8
9
  </Providers>
9
10
  );
10
11
  }
@@ -2,7 +2,7 @@ import { KeyboardArrowDown } from "@mui/icons-material";
2
2
  import { ButtonProps, CircularProgress } from "@mui/material";
3
3
  import { StyledDropDownButton } from "./styles";
4
4
 
5
- export default function DropDownButton({
5
+ export const DropDownButton = ({
6
6
  button,
7
7
  handleClick,
8
8
  loading,
@@ -13,7 +13,7 @@ export default function DropDownButton({
13
13
  buttonProps?: ButtonProps;
14
14
  };
15
15
  handleClick: any;
16
- }) {
16
+ }) => {
17
17
  return (
18
18
  <StyledDropDownButton
19
19
  onClick={handleClick}
@@ -27,4 +27,4 @@ export default function DropDownButton({
27
27
  {button?.label}
28
28
  </StyledDropDownButton>
29
29
  );
30
- }
30
+ };
@@ -8,7 +8,7 @@ const defaultIcon = {
8
8
  outlined: true,
9
9
  };
10
10
 
11
- export default function DropDownIcon({
11
+ export const DropDownIcon = ({
12
12
  icon = defaultIcon,
13
13
  handleClick,
14
14
  }: {
@@ -18,7 +18,7 @@ export default function DropDownIcon({
18
18
  outlined?: boolean;
19
19
  };
20
20
  handleClick: any;
21
- }) {
21
+ }) => {
22
22
  return (
23
23
  <StyledIconButton
24
24
  outlined={icon?.outlined ?? false}
@@ -28,4 +28,4 @@ export default function DropDownIcon({
28
28
  {icon.icon}
29
29
  </StyledIconButton>
30
30
  );
31
- }
31
+ };
@@ -2,10 +2,10 @@ import MoreVertIcon from "@mui/icons-material/MoreVert";
2
2
  import { IconButton } from "@mui/material";
3
3
  import { Meta, StoryObj } from "@storybook/react";
4
4
  import { HelpIcon } from "../../assets/images/icons";
5
- import DropDownButton from "./DropDownButton";
6
- import DropDownIcon from "./DropDownIcon";
7
- import DropDownMenu, { DropDownMenuProps } from "./DropDownMenu";
8
- import MenuItemButton from "./MenuItemButton";
5
+ import { DropDownButton } from "./DropDownButton";
6
+ import { DropDownIcon } from "./DropDownIcon";
7
+ import { DropDownMenu, DropDownMenuProps } from "./DropDownMenu";
8
+ import { MenuItemButton } from "./MenuItemButton";
9
9
 
10
10
  // Define the default export with Meta type including the component type
11
11
  const meta: Meta<typeof DropDownMenu> = {
@@ -8,7 +8,7 @@ export interface DropDownMenuProps {
8
8
  menuListProps?: MenuListProps;
9
9
  }
10
10
 
11
- const DropDownMenu = ({
11
+ export const DropDownMenu = ({
12
12
  menuProps,
13
13
  menu = [],
14
14
  menuListProps,
@@ -62,4 +62,3 @@ const DropDownMenu = ({
62
62
  </>
63
63
  );
64
64
  };
65
- export default DropDownMenu;
@@ -8,7 +8,7 @@ export type MenuItemButtonProps = {
8
8
  onClick: () => void;
9
9
  };
10
10
 
11
- const MenuItemButton = ({
11
+ export const MenuItemButton = ({
12
12
  icon,
13
13
  label,
14
14
  onClick,
@@ -25,5 +25,3 @@ const MenuItemButton = ({
25
25
  </StyledMenuItem>
26
26
  );
27
27
  };
28
-
29
- export default MenuItemButton;
@@ -3,7 +3,7 @@ import { Meta } from "@storybook/react";
3
3
 
4
4
  // Make sure your TextField import is correct
5
5
 
6
- import Button, { ButtonProps } from "./Button";
6
+ import { Button, ButtonProps } from "./Button";
7
7
 
8
8
  // Define the default export with Meta type including the component type
9
9
  export default {
@@ -5,7 +5,6 @@ import {
5
5
 
6
6
  export type ButtonProps = {} & MuiButtonProps;
7
7
 
8
- const Button = (props: ButtonProps) => {
8
+ export const Button = (props: ButtonProps) => {
9
9
  return <MuiButton {...props} />;
10
10
  };
11
- export default Button;
@@ -2,8 +2,8 @@
2
2
  import { Meta } from "@storybook/react";
3
3
 
4
4
  // Make sure your TextField import is correct
5
- import { TextFieldProps } from "@mui/material";
6
- import SingleSelect from "./SingleSelect";
5
+
6
+ import { SingleSelect, SingleSelectProps } from "./SingleSelect";
7
7
 
8
8
  // Define the default export with Meta type including the component type
9
9
  export default {
@@ -15,41 +15,41 @@ export default {
15
15
 
16
16
  // Define stories directly as objects with render function
17
17
  export const Primary = {
18
- render: (args: TextFieldProps) => <SingleSelect {...args} />,
18
+ render: (args: SingleSelectProps) => <SingleSelect {...args} />,
19
19
  args: {},
20
20
  };
21
21
 
22
22
  export const Disabled = {
23
- render: (args: TextFieldProps) => <SingleSelect {...args} />,
23
+ render: (args: SingleSelectProps) => <SingleSelect {...args} />,
24
24
  args: {},
25
25
  };
26
26
 
27
27
  export const WithValue = {
28
- render: (args: TextFieldProps) => <SingleSelect {...args} />,
28
+ render: (args: SingleSelectProps) => <SingleSelect {...args} />,
29
29
  args: {},
30
30
  };
31
31
 
32
32
  export const InputWithPlaceholder = {
33
- render: (args: TextFieldProps) => <SingleSelect {...args} />,
33
+ render: (args: SingleSelectProps) => <SingleSelect {...args} />,
34
34
  args: {},
35
35
  };
36
36
 
37
37
  export const ErrorInput = {
38
- render: (args: TextFieldProps) => <SingleSelect {...args} />,
38
+ render: (args: SingleSelectProps) => <SingleSelect {...args} />,
39
39
  args: {},
40
40
  };
41
41
 
42
42
  export const SuccessInput = {
43
- render: (args: TextFieldProps) => <SingleSelect {...args} />,
43
+ render: (args: SingleSelectProps) => <SingleSelect {...args} />,
44
44
  args: {},
45
45
  };
46
46
 
47
47
  export const WarningInput = {
48
- render: (args: TextFieldProps) => <SingleSelect {...args} />,
48
+ render: (args: SingleSelectProps) => <SingleSelect {...args} />,
49
49
  args: {},
50
50
  };
51
51
 
52
52
  export const PassowrdInput = {
53
- render: (args: TextFieldProps) => <SingleSelect {...args} />,
53
+ render: (args: SingleSelectProps) => <SingleSelect {...args} />,
54
54
  args: {},
55
55
  };
@@ -1,4 +1,194 @@
1
- const SingleSelect = () => {
2
- return <></>;
1
+ import {
2
+ CircularProgress,
3
+ Autocomplete as MuiAutocomplete,
4
+ TextField,
5
+ } from "@mui/material";
6
+ import axios from "axios";
7
+ import { useReducer } from "react";
8
+ import { campxAxios } from "../../../utils/campxAxios";
9
+
10
+ function sleep(duration: number): Promise<void> {
11
+ return new Promise<void>((resolve) => {
12
+ setTimeout(() => {
13
+ resolve();
14
+ }, duration);
15
+ });
16
+ }
17
+
18
+ const topFilms = [
19
+ { label: "The Shawshank Redemption", value: 1994 },
20
+ { label: "The Godfather", value: 1972 },
21
+ { label: "The Godfather: Part II", value: 1974 },
22
+ { label: "The Dark Knight", value: 2008 },
23
+ { label: "12 Angry Men", value: 1957 },
24
+ { label: "Schindler's List", value: 1993 },
25
+ { label: "Pulp Fiction", value: 1994 },
26
+ {
27
+ label: "The Lord of the Rings: The Return of the King",
28
+ value: 2003,
29
+ },
30
+ { label: "The Good, the Bad and the Ugly", value: 1966 },
31
+ { label: "Fight Club", value: 1999 },
32
+ {
33
+ label: "The Lord of the Rings: The Fellowship of the Ring",
34
+ value: 2001,
35
+ },
36
+ {
37
+ label: "Star Wars: Episode V - The Empire Strikes Back",
38
+ value: 1980,
39
+ },
40
+ { label: "Forrest Gump", value: 1994 },
41
+ { label: "Inception", value: 2010 },
42
+ {
43
+ label: "The Lord of the Rings: The Two Towers",
44
+ value: 2002,
45
+ },
46
+ { label: "One Flew Over the Cuckoo's Nest", value: 1975 },
47
+ { label: "Goodfellas", value: 1990 },
48
+ { label: "The Matrix", value: 1999 },
49
+ { label: "Seven Samurai", value: 1954 },
50
+ {
51
+ label: "Star Wars: Episode IV - A New Hope",
52
+ value: 1977,
53
+ },
54
+ { label: "City of God", value: 2002 },
55
+ { label: "Se7en", value: 1995 },
56
+ { label: "The Silence of the Lambs", value: 1991 },
57
+ { label: "It's a Wonderful Life", value: 1946 },
58
+ { label: "Life Is Beautiful", value: 1997 },
59
+ { label: "The Usual Suspects", value: 1995 },
60
+ { label: "Léon: The Professional", value: 1994 },
61
+ { label: "Spirited Away", value: 2001 },
62
+ { label: "Saving Private Ryan", value: 1998 },
63
+ { label: "Once Upon a Time in the West", value: 1968 },
64
+ { label: "American History X", value: 1998 },
65
+ { label: "Interstellar", value: 2014 },
66
+ ];
67
+
68
+ export interface SingleSelectProps {
69
+ options?: { label: string; subLabel?: string; value: any }[];
70
+ optionsApiEndPoint?: string;
71
+ useCampxAxios: boolean;
72
+ }
73
+
74
+ enum SingleSelectActionsTypes {
75
+ OPEN = "open",
76
+ CLOSE = "close",
77
+ LOAD_INTERNAL_OPTIONS_START = "load_internal_options_start",
78
+ LOAD_INTERNAL_OPTIONS_END = "load_internal_options_end",
79
+ SET_NETWORK_ERROR = "set_network_error",
80
+ SET_INTERNAL_OPTIONS = "set_internal_options",
81
+ }
82
+ const singleSelectReducer = (
83
+ state: any,
84
+ {
85
+ actionType,
86
+ stateChanges,
87
+ }: { actionType: SingleSelectActionsTypes; stateChanges?: any }
88
+ ) => {
89
+ switch (actionType) {
90
+ case SingleSelectActionsTypes.OPEN: {
91
+ return { ...state, open: true };
92
+ }
93
+ case SingleSelectActionsTypes.CLOSE: {
94
+ return { ...state, open: false };
95
+ }
96
+ case SingleSelectActionsTypes.LOAD_INTERNAL_OPTIONS_START: {
97
+ return { ...state, loadingInternalOptions: true };
98
+ }
99
+ case SingleSelectActionsTypes.LOAD_INTERNAL_OPTIONS_END: {
100
+ return { ...state, loadingInternalOptions: false };
101
+ }
102
+ case SingleSelectActionsTypes.SET_NETWORK_ERROR: {
103
+ return { ...state, ...stateChanges };
104
+ }
105
+ default:
106
+ return { ...state, ...stateChanges };
107
+ }
3
108
  };
109
+
110
+ export const SingleSelect = ({
111
+ options,
112
+ optionsApiEndPoint,
113
+ useCampxAxios = true,
114
+ }: SingleSelectProps) => {
115
+ const [state, dispatch] = useReducer(singleSelectReducer, {
116
+ open: false,
117
+ loadingInternalOptions: false,
118
+ internalOptions: options ?? topFilms,
119
+ });
120
+ const { open, loadingInternalOptions, internalOptions } = state;
121
+
122
+ const internalAxios = useCampxAxios ? campxAxios : axios;
123
+
124
+ const handleOpen = async () => {
125
+ dispatch({
126
+ actionType: SingleSelectActionsTypes.OPEN,
127
+ });
128
+ if (optionsApiEndPoint) {
129
+ try {
130
+ dispatch({
131
+ actionType: SingleSelectActionsTypes.LOAD_INTERNAL_OPTIONS_START,
132
+ });
133
+ const options = await internalAxios
134
+ .get(optionsApiEndPoint, {
135
+ params: {
136
+ limit: 10,
137
+ offset: 0,
138
+ skip: 0,
139
+ },
140
+ })
141
+ .then((res) => res.data);
142
+ dispatch({
143
+ actionType: SingleSelectActionsTypes.SET_INTERNAL_OPTIONS,
144
+ stateChanges: {
145
+ options,
146
+ loadingInternalOptions: false,
147
+ },
148
+ });
149
+ } catch (e) {
150
+ dispatch({
151
+ actionType: SingleSelectActionsTypes.SET_NETWORK_ERROR,
152
+ stateChanges: {
153
+ error: e,
154
+ },
155
+ });
156
+ dispatch({
157
+ actionType: SingleSelectActionsTypes.LOAD_INTERNAL_OPTIONS_END,
158
+ });
159
+ }
160
+ }
161
+ };
162
+
163
+ return (
164
+ <MuiAutocomplete
165
+ open={open}
166
+ renderInput={(params) => (
167
+ <TextField
168
+ {...params}
169
+ label="Asynchronous"
170
+ InputProps={{
171
+ ...params.InputProps,
172
+ endAdornment: (
173
+ <>
174
+ {loadingInternalOptions ? (
175
+ <CircularProgress color="inherit" size={20} />
176
+ ) : null}
177
+ {params.InputProps.endAdornment}
178
+ </>
179
+ ),
180
+ }}
181
+ />
182
+ )}
183
+ onOpen={handleOpen}
184
+ onClose={() => {
185
+ dispatch({
186
+ actionType: SingleSelectActionsTypes.CLOSE,
187
+ });
188
+ }}
189
+ options={internalOptions}
190
+ />
191
+ );
192
+ };
193
+
4
194
  export default SingleSelect;
@@ -3,7 +3,7 @@ import { Meta } from "@storybook/react";
3
3
 
4
4
  // Make sure your TextField import is correct
5
5
 
6
- import Switch, { SwitchProps } from "./Switch";
6
+ import { Switch, SwitchProps } from "./Switch";
7
7
 
8
8
  // Define the default export with Meta type including the component type
9
9
  export default {
@@ -4,8 +4,6 @@ import {
4
4
  } from "@mui/material";
5
5
 
6
6
  export type SwitchProps = {} & MuiSwitchProps;
7
- const Switch = (props: SwitchProps) => {
7
+ export const Switch = (props: SwitchProps) => {
8
8
  return <MuiSwitch {...props} />;
9
9
  };
10
-
11
- export default Switch;
@@ -2,7 +2,7 @@
2
2
  import { Meta } from "@storybook/react";
3
3
 
4
4
  // Make sure your TextField import is correct
5
- import TextField, { TextFieldProps } from "./TextField";
5
+ import { TextField, TextFieldProps } from "./TextField";
6
6
 
7
7
  // Define the default export with Meta type including the component type
8
8
  export default {
@@ -10,7 +10,7 @@ export type TextFieldProps = {
10
10
  containerProps?: StackProps;
11
11
  } & MuiTextFieldProps;
12
12
 
13
- export default function TextField({
13
+ export const TextField = ({
14
14
  name,
15
15
  label,
16
16
  value,
@@ -18,7 +18,7 @@ export default function TextField({
18
18
  required = false,
19
19
  containerProps,
20
20
  ...rest
21
- }: TextFieldProps) {
21
+ }: TextFieldProps) => {
22
22
  return (
23
23
  <Stack margin="15px 20px" {...containerProps}>
24
24
  <Label label={label} required={required} name={name} />
@@ -32,4 +32,4 @@ export default function TextField({
32
32
  />
33
33
  </Stack>
34
34
  );
35
- }
35
+ };
@@ -6,9 +6,9 @@ import {
6
6
  ToggleButtonGroup,
7
7
  } from "@mui/material";
8
8
  import { ReactNode, useState } from "react";
9
- import { darkTheme, lightTheme } from "../../../themes";
10
- import MuiThemeProvider from "../../../themes/MuiThemeProvider";
11
- import Typography from "../../Typography/Typography";
9
+ import { MuiThemeProvider } from "../../../themes/MuiThemeProvider";
10
+ import { darkTheme, lightTheme } from "../../../themes/export";
11
+ import { Typography } from "../../Typography/Typography";
12
12
  import { DefaultBackground } from "./DefaultBackground";
13
13
  import { PaperBackground } from "./PaperBackground";
14
14
 
@@ -22,7 +22,7 @@ export type ComponentBackgroundProps = {
22
22
  sx?: SxProps;
23
23
  };
24
24
 
25
- const BackgroundComponent = ({
25
+ export const BackgroundComponent = ({
26
26
  children,
27
27
  backgroundType,
28
28
  sx,
@@ -41,7 +41,10 @@ const BackgroundComponent = ({
41
41
  }
42
42
  };
43
43
 
44
- const ComponentBackground = ({ children, sx }: ComponentBackgroundProps) => {
44
+ export const ComponentBackground = ({
45
+ children,
46
+ sx,
47
+ }: ComponentBackgroundProps) => {
45
48
  const [darkMode, setDarkMode] = useState(false);
46
49
  const [backgroundType, setBackgroundType] =
47
50
  useState<ComponentBackgroundTypes>(ComponentBackgroundTypes.DEFAULT);
@@ -78,5 +81,3 @@ const ComponentBackground = ({ children, sx }: ComponentBackgroundProps) => {
78
81
  </MuiThemeProvider>
79
82
  );
80
83
  };
81
-
82
- export default ComponentBackground;
@@ -1,7 +1,7 @@
1
1
  import { IconButton } from "@mui/material";
2
2
  import { Meta, StoryObj } from "@storybook/react";
3
3
  import { CareerIcon, ExamResultIcon } from "../../../assets/images/icons";
4
- import MenuItemButton from "../../DropDownMenu/MenuItemButton";
4
+ import { MenuItemButton } from "../../DropDownMenu/MenuItemButton";
5
5
  import AppHeader, { AppHeaderProps } from "./AppHeader";
6
6
  import AppsMenu from "./AppsMenu";
7
7
 
@@ -1,7 +1,7 @@
1
1
  import { Divider, IconButton } from "@mui/material";
2
2
  import { ReactNode } from "react";
3
3
  import { ClogWheelIcon } from "../../../../assets/images/icons";
4
- import DropDownMenu from "../../../DropDownMenu/DropDownMenu";
4
+ import { DropDownMenu } from "../../../DropDownMenu/DropDownMenu";
5
5
  // import { clogWheel } from "../../../../assets/images";
6
6
  // import DropDownButton from "../../../DropDownButton/DropDownButton";
7
7
 
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from "react";
2
- import DropDownMenu from "../../../DropDownMenu/DropDownMenu";
2
+ import { DropDownMenu } from "../../../DropDownMenu/DropDownMenu";
3
3
  import { StyledAvatar } from "../styles/styles";
4
4
  // import {
5
5
  // activeDevices,
@@ -3,7 +3,7 @@ import { Meta } from "@storybook/react";
3
3
 
4
4
  // Make sure your childrenField import is correct
5
5
 
6
- import Typography, { TypographyProps } from "./Typography";
6
+ import { Typography, TypographyProps } from "./Typography";
7
7
 
8
8
  // Define the default export with Meta type including the component type
9
9
  export default {
@@ -5,8 +5,6 @@ import {
5
5
 
6
6
  export type TypographyProps = {} & MuiTypographyProps;
7
7
 
8
- const Typography = ({ variant, children }: TypographyProps) => {
8
+ export const Typography = ({ variant, children }: TypographyProps) => {
9
9
  return <MuiTypography variant={variant}>{children}</MuiTypography>;
10
10
  };
11
-
12
- export default Typography;
@@ -0,0 +1,6 @@
1
+ export * from "./DropDownMenu/DropDownButton";
2
+ export * from "./DropDownMenu/DropDownMenu";
3
+ export * from "./Input/Button/Button";
4
+ export * from "./Input/SingleSelect/SingleSelect";
5
+ export * from "./Input/Switch/Switch";
6
+ export * from "./Input/TextField/TextField";
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from "react";
2
- import MuiThemeProvider from "../themes/MuiThemeProvider";
2
+ import { MuiThemeProvider } from "../themes/MuiThemeProvider";
3
3
 
4
4
  export default function Providers({ children }: { children: ReactNode }) {
5
5
  return <MuiThemeProvider>{children}</MuiThemeProvider>;
@@ -1,18 +1,18 @@
1
1
  import { CssBaseline, ThemeProvider } from "@mui/material";
2
2
  import { ReactNode } from "react";
3
- import lightTheme from "./lightTheme";
3
+ import { lightTheme } from "./lightTheme";
4
4
 
5
- export default function MuiThemeProvider({
5
+ export const MuiThemeProvider = ({
6
6
  children,
7
7
  theme,
8
8
  }: {
9
9
  children: ReactNode;
10
10
  theme?: any;
11
- }) {
11
+ }) => {
12
12
  return (
13
13
  <ThemeProvider theme={theme ?? lightTheme}>
14
14
  <CssBaseline />
15
15
  {children}
16
16
  </ThemeProvider>
17
17
  );
18
- }
18
+ };
@@ -11,185 +11,6 @@ declare module "@mui/material/Typography" {
11
11
  }
12
12
  }
13
13
 
14
- // typography: {
15
- // fontFamily: ["Heebo", "Poppins", "sans-serif"].join(","),
16
- // },
17
- // components: {
18
- // MuiIconButton: {
19
- // defaultProps: {
20
- // disableRipple: true,
21
- // disableFocusRipple: true,
22
- // disableTouchRipple: true,
23
- // },
24
- // styleOverrides: {
25
- // root: {
26
- // borderRadius: "10px",
27
- // },
28
- // },
29
- // },
30
- // MuiButtonBase: {
31
- // defaultProps: {},
32
- // styleOverrides: {
33
- // root: {},
34
- // },
35
- // },
36
- // MuiButton: {
37
- // defaultProps: {},
38
- // styleOverrides: {
39
- // root: {
40
- // textTransform: "none",
41
- // padding: "5px 30px ",
42
- // maxHeight: "40px ",
43
- // borderRadius: "5px ",
44
- // boxShadow: "none ",
45
- // fontSize: "14px ",
46
- // fontFamily: "Poppins",
47
- // fontWeight: 600,
48
- // "&:hover": {
49
- // boxShadow: "none ",
50
- // "@media (hover: none )": {
51
- // boxShadow: "none ",
52
- // },
53
- // },
54
- // "&$focusVisible": {
55
- // boxShadow: "none",
56
- // },
57
- // "&:active": {
58
- // boxShadow: "none",
59
- // },
60
- // "&$disabled": { boxShadow: "none" },
61
- // },
62
- // },
63
- // },
64
- // MuiLink: {
65
- // defaultProps: {
66
- // underline: "none",
67
- // },
68
- // },
69
- // MuiTextField: {
70
- // defaultProps: {
71
- // variant: "outlined",
72
- // color: "primary",
73
- // fullWidth: true,
74
- // },
75
- // styleOverrides: {
76
- // root: {
77
- // "& label": {
78
- // display: "none",
79
- // },
80
- // "& legend": {
81
- // "& span": {
82
- // display: "none",
83
- // },
84
- // },
85
- // minWidth: "350px",
86
- // },
87
- // },
88
- // },
89
- // MuiInputBase: {
90
- // styleOverrides: {
91
- // root: {
92
- // fontSize: "16px !important",
93
- // fontFamily: "Heebo !important",
94
- // fontWeight: 300,
95
- // color: "#FFFFFF",
96
- // "&.Mui-disabled": {
97
- // backgroundColor: "#F8F8F8",
98
- // color: "#a0a0a0",
99
- // },
100
- // },
101
- // },
102
- // },
103
- // MuiOutlinedInput: {
104
- // styleOverrides: {
105
- // root: {
106
- // "& label": {
107
- // display: "none",
108
- // },
109
- // "& legend": {
110
- // "& span": {
111
- // display: "none",
112
- // },
113
- // },
114
- // "&.Mui-disabled": {
115
- // backgroundColor: "#f0f0f0",
116
- // },
117
- // maxHeight: "40px",
118
- // maxWidth: "400px",
119
- // },
120
- // },
121
- // },
122
- // MuiFormLabel: {
123
- // styleOverrides: {
124
- // root: {
125
- // fontSize: "14px",
126
- // color: "#959595",
127
- // },
128
- // },
129
- // },
130
- // MuiTypography: {
131
- // styleOverrides: {
132
- // h6: {
133
- // fontSize: "24px",
134
- // fontWeight: 800,
135
- // fontFamily: "Poppins",
136
- // color: LightColorTokens.text.primary,
137
- // },
138
- // subtitle1: {
139
- // fontSize: "18px",
140
- // fontWeight: 600,
141
- // fontFamily: "Poppins",
142
- // color: LightColorTokens.text.primary,
143
- // },
144
- // subtitle2: {
145
- // fontSize: "16px",
146
- // fontWeight: 600,
147
- // fontFamily: "Poppins",
148
- // color: LightColorTokens.text.primary,
149
- // },
150
- // subtitle3: {
151
- // fontSize: "14px",
152
- // fontWeight: 400,
153
- // fontFamily: "Poppins",
154
- // color: LightColorTokens.text.primary,
155
- // },
156
- // body1: {
157
- // fontSize: "16px",
158
- // fontWeight: 600,
159
- // fontFamily: "Heebo",
160
- // color: LightColorTokens.text.primary,
161
- // },
162
- // body2: {
163
- // fontSize: "14px",
164
- // fontWeight: 400,
165
- // fontFamily: "Heebo",
166
- // color: LightColorTokens.text.primary,
167
- // },
168
- // caption: {
169
- // fontSize: "12px",
170
- // fontWeight: 400,
171
- // fontFamily: "Heebo",
172
- // color: LightColorTokens.text.primary,
173
- // },
174
- // label1: {
175
- // fontSize: "14px",
176
- // fontWeight: 300,
177
- // fontFamily: "Heebo",
178
- // color: LightColorTokens.text.secondary,
179
- // },
180
- // label2: {
181
- // fontSize: "14px",
182
- // fontWeight: 300,
183
- // fontFamily: "Poppins",
184
- // color: LightColorTokens.text.secondary,
185
- // },
186
- // } as TypographyOptions,
187
- // },
188
- // MuiCssBaseline: {
189
- // styleOverrides: customCssBaseline,
190
- // },
191
- // } as Components,
192
- // };
193
14
  export enum Theme {
194
15
  LIGHT = "light",
195
16
  DARK = "dark",
@@ -343,6 +164,17 @@ export const getCommonTheme = (mode: Theme) => {
343
164
  },
344
165
  },
345
166
  },
167
+ MuiAutocomplete: {
168
+ styleOverrides: {
169
+ root: {
170
+ "& .MuiOutlinedInput-root .MuiAutocomplete-input": {
171
+ padding: 0,
172
+ maxHeight: "40px",
173
+ maxWidth: "400px",
174
+ },
175
+ },
176
+ },
177
+ },
346
178
  MuiOutlinedInput: {
347
179
  styleOverrides: {
348
180
  root: {
@@ -2,9 +2,7 @@ import { createTheme } from "@mui/material/styles";
2
2
  import { DarkColorTokens } from "./colorTokens";
3
3
  import { getCommonTheme, Theme } from "./commonTheme";
4
4
 
5
- const darkThemeColors = {};
6
-
7
- const darkTheme = createTheme({
5
+ export const darkTheme = createTheme({
8
6
  palette: {
9
7
  mode: "dark",
10
8
  primary: DarkColorTokens.primary,
@@ -20,5 +18,3 @@ const darkTheme = createTheme({
20
18
  },
21
19
  ...getCommonTheme(Theme.DARK),
22
20
  });
23
-
24
- export default darkTheme;
@@ -0,0 +1,5 @@
1
+ import { darkTheme } from "./darkTheme";
2
+ import { lightTheme } from "./lightTheme";
3
+
4
+ export * from "./MuiThemeProvider";
5
+ export { darkTheme, lightTheme };
@@ -2,7 +2,7 @@ import { createTheme } from "@mui/material/styles";
2
2
  import { LightColorTokens } from "./colorTokens";
3
3
  import { Theme, getCommonTheme } from "./commonTheme";
4
4
 
5
- const lightTheme = createTheme({
5
+ export const lightTheme = createTheme({
6
6
  palette: {
7
7
  mode: "light",
8
8
  primary: LightColorTokens.primary,
@@ -18,5 +18,3 @@ const lightTheme = createTheme({
18
18
  },
19
19
  ...getCommonTheme(Theme.LIGHT),
20
20
  });
21
-
22
- export default lightTheme;
@@ -1,6 +1,6 @@
1
1
  // src/stories/Typography.stories.jsx
2
2
  import { Stack } from "@mui/material";
3
- import Typography from "../components/Typography/Typography";
3
+ import { Typography } from "../components/Typography/Typography";
4
4
  // Update path as necessary
5
5
 
6
6
  export default {
@@ -0,0 +1,17 @@
1
+ import axios from "axios";
2
+ import Cookies from "js-cookie";
3
+
4
+ const tenantCode = window.location.pathname.split("/")[1] ?? "campx";
5
+ const institutionCode = window.location.pathname.split("/")[2] ?? "campx";
6
+ const sessionKey = Cookies.get("campx_session_key");
7
+ const isProduction = process.env.NODE_ENV === "production";
8
+
9
+ export const campxAxios = axios.create({
10
+ baseURL: process.env.REACT_APP_API_HOST,
11
+ withCredentials: true,
12
+ headers: {
13
+ "x-tenant-id": tenantCode,
14
+ ...(!isProduction && sessionKey ? { campx_session_key: sessionKey } : {}),
15
+ "x-institution-id": institutionCode,
16
+ },
17
+ });
package/tsconfig.json CHANGED
@@ -18,6 +18,7 @@
18
18
  "resolveJsonModule": true,
19
19
  "isolatedModules": true,
20
20
  "noEmit": true,
21
+ "types": ["node"],
21
22
  "jsx": "react-jsx"
22
23
  },
23
24
  "include": [
@@ -1 +0,0 @@
1
- export { default as ActionButton } from "./Input/Button/Button";
@@ -1,4 +0,0 @@
1
- import lightTheme from "./lightTheme";
2
- import darkTheme from "./darkTheme";
3
-
4
- export { lightTheme, darkTheme };