@campxdev/react-blueprint 1.2.18 → 1.2.20

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 (43) hide show
  1. package/.storybook/preview.tsx +1 -1
  2. package/export.ts +1 -1
  3. package/package.json +14 -14
  4. package/src/App.tsx +82 -47
  5. package/src/components/Assets/Icons/IconComponents/ColumnsIcon.tsx +31 -0
  6. package/src/components/Assets/Icons/IconComponents/Comfortable.tsx +4 -4
  7. package/src/components/Assets/Icons/IconComponents/CompactIcon.tsx +6 -6
  8. package/src/components/Assets/Icons/IconComponents/CompletedStateIcon.tsx +3 -3
  9. package/src/components/Assets/Icons/IconComponents/FilterIcon.tsx +27 -60
  10. package/src/components/Assets/Icons/IconComponents/InfoFilledIcon.tsx +6 -18
  11. package/src/components/Assets/Icons/IconComponents/SearchIcon.tsx +1 -1
  12. package/src/components/Assets/Icons/IconComponents/StandardIcon.tsx +5 -5
  13. package/src/components/Assets/Icons/IconComponents/ViewsIcon.tsx +35 -0
  14. package/src/components/Assets/Icons/Icons.tsx +4 -2
  15. package/src/components/Charts/TreeMap/TreeMap.tsx +1 -6
  16. package/src/components/DataDisplay/EditableDataTable/EditableDataTable.tsx +48 -1
  17. package/src/components/Layout/AppHeader/AppHeader.tsx +1 -0
  18. package/src/components/Layout/PageHeader/PageHeader.tsx +160 -44
  19. package/src/components/Layout/PageHeader/components/Anchors.tsx +84 -0
  20. package/src/components/Layout/PageHeader/components/DensitySelector/DensitySelector.tsx +96 -0
  21. package/src/components/{Navigation/TableColumnFilters/TableColumnFilters.tsx → Layout/PageHeader/components/TableColumnsSelector/TableColumnsSelector.tsx} +20 -19
  22. package/src/components/Layout/export.ts +2 -0
  23. package/src/components/Navigation/Breadcrumbs/Breadcrumbs.tsx +16 -7
  24. package/src/components/Navigation/Stepper/Stepper.tsx +3 -1
  25. package/src/components/Navigation/Stepper/StepperComponents.tsx +20 -6
  26. package/src/components/Navigation/export.ts +1 -2
  27. package/src/hooks/usePageHeader.ts +5 -4
  28. package/src/index.tsx +1 -1
  29. package/src/redux/export.ts +2 -0
  30. package/src/{state/filters/filtersSlice.ts → redux/slices/pageHeaderSlice.ts} +8 -14
  31. package/src/{state → redux}/store.ts +2 -2
  32. package/src/stories/Assets/Icons.stories.tsx +13 -4
  33. package/src/stories/Navigation/ColumnFilters.stories.tsx +6 -6
  34. package/src/stories/Navigation/{TableDensityFilter.stories.tsx → DensitySelector.stories.tsx} +6 -9
  35. package/src/themes/colorTokens/colorPalette.tsx +2 -0
  36. package/src/themes/colorTokens/darkColorTokens.tsx +1 -0
  37. package/src/themes/colorTokens/lightColorTokens.ts +1 -0
  38. package/src/themes/commonTheme.ts +15 -2
  39. package/tsconfig.json +1 -1
  40. package/types/theme.d.ts +1 -0
  41. package/src/components/Assets/Icons/IconComponents/FilterViewIcon.tsx +0 -32
  42. package/src/components/Navigation/TableDensityFilter/TableDensityFilter.tsx +0 -115
  43. package/src/state/export.ts +0 -2
@@ -1,32 +1,26 @@
1
1
  import { GridColumnVisibilityModel, GridDensity } from '@mui/x-data-grid';
2
2
  import { createSlice } from '@reduxjs/toolkit';
3
3
 
4
- export type FilterState = {
4
+ export type PageHeaderState = {
5
5
  [uniqueId: string]: {
6
6
  density: GridDensity;
7
7
  columnVisibilityModel: GridColumnVisibilityModel;
8
8
  };
9
9
  };
10
10
 
11
- const initialState: FilterState = {};
11
+ const initialState: PageHeaderState = {};
12
12
 
13
- const filtersSlice = createSlice({
14
- name: 'filters',
13
+ const pageHeaderSlice = createSlice({
14
+ name: 'pageHeader',
15
15
  initialState,
16
16
  reducers: {
17
17
  setColumnVisibilityModel: (state, action) => {
18
18
  const { uniqueId, columnVisibilityModel } = action.payload;
19
- if (!state[uniqueId]) {
20
- state[uniqueId] = { density: 'standard', columnVisibilityModel: {} };
21
- }
22
- state[uniqueId].columnVisibilityModel = columnVisibilityModel;
19
+ state[uniqueId] = { ...state[uniqueId], columnVisibilityModel };
23
20
  },
24
21
  setDensity: (state, action) => {
25
22
  const { uniqueId, density } = action.payload;
26
- if (!state[uniqueId]) {
27
- state[uniqueId] = { density: 'standard', columnVisibilityModel: {} };
28
- }
29
- state[uniqueId].density = density;
23
+ state[uniqueId] = { ...state[uniqueId], density };
30
24
  },
31
25
  resetStateForUniqueId: (state, action) => {
32
26
  const { uniqueId } = action.payload;
@@ -36,6 +30,6 @@ const filtersSlice = createSlice({
36
30
  });
37
31
 
38
32
  export const { setColumnVisibilityModel, setDensity, resetStateForUniqueId } =
39
- filtersSlice.actions;
33
+ pageHeaderSlice.actions;
40
34
 
41
- export default filtersSlice.reducer;
35
+ export default pageHeaderSlice.reducer;
@@ -1,9 +1,9 @@
1
1
  import { configureStore } from '@reduxjs/toolkit';
2
- import filtersSlice from './filters/filtersSlice';
2
+ import pageHeaderSlice from './slices/pageHeaderSlice';
3
3
 
4
4
  export const store = configureStore({
5
5
  reducer: {
6
- filters: filtersSlice,
6
+ pageHeaderSlice,
7
7
  },
8
8
  });
9
9
 
@@ -1,13 +1,22 @@
1
1
  // Import React and other necessary elements
2
2
  import { Stack } from '@mui/material';
3
3
  import { Meta, StoryObj } from '@storybook/react/*';
4
- import { Icons } from '../../components/Assets/Icons/Icons';
4
+
5
+ import { Icons, Typography } from '../../components/export';
5
6
 
6
7
  const IconsStory = () => {
7
8
  return (
8
- <Stack gap={2} direction={'row'}>
9
- {Object.values(Icons).map((Icon) => (
10
- <Icon />
9
+ <Stack gap={2} direction={'column'}>
10
+ {Object.entries(Icons).map(([key, Icon], index) => (
11
+ <Stack
12
+ direction="row"
13
+ alignItems="center"
14
+ gap={4}
15
+ justifyContent="space-between"
16
+ >
17
+ <Typography>{key}</Typography>
18
+ <Icon />
19
+ </Stack>
11
20
  ))}
12
21
  </Stack>
13
22
  );
@@ -2,13 +2,13 @@ import { GridColumnVisibilityModel } from '@mui/x-data-grid';
2
2
  import { Meta, StoryFn } from '@storybook/react';
3
3
  import { useState } from 'react';
4
4
  import {
5
- TableColumnFilters,
6
- TableColumnFiltersProps,
5
+ TableColumnsSelector,
6
+ TableColumnsSelectorProps,
7
7
  } from '../../components/export';
8
8
 
9
- const meta: Meta<typeof TableColumnFilters> = {
9
+ const meta: Meta<typeof TableColumnsSelector> = {
10
10
  title: 'Navigation/ColumnFilters',
11
- component: TableColumnFilters,
11
+ component: TableColumnsSelector,
12
12
  argTypes: {
13
13
  columns: {
14
14
  control: { type: 'object' },
@@ -30,7 +30,7 @@ const meta: Meta<typeof TableColumnFilters> = {
30
30
 
31
31
  export default meta;
32
32
 
33
- const Template: StoryFn<TableColumnFiltersProps> = (args) => {
33
+ const Template: StoryFn<TableColumnsSelectorProps> = (args) => {
34
34
  const [selectedValues, setSelectedValues] =
35
35
  useState<GridColumnVisibilityModel>();
36
36
 
@@ -40,7 +40,7 @@ const Template: StoryFn<TableColumnFiltersProps> = (args) => {
40
40
 
41
41
  return (
42
42
  <>
43
- <TableColumnFilters {...args} />
43
+ <TableColumnsSelector {...args} />
44
44
  </>
45
45
  );
46
46
  };
@@ -1,13 +1,10 @@
1
1
  import { GridDensity } from '@mui/x-data-grid';
2
2
  import { Meta, StoryFn } from '@storybook/react';
3
- import {
4
- TableDensityFilter,
5
- TableDensityFilterProps,
6
- } from '../../components/export';
3
+ import { DensitySelector, DensitySelectorProps } from '../../components/export';
7
4
 
8
- const meta: Meta<typeof TableDensityFilter> = {
9
- title: 'Navigation/TableDensityFilter',
10
- component: TableDensityFilter,
5
+ const meta: Meta<typeof DensitySelector> = {
6
+ title: 'Layout/TableDensityFilter',
7
+ component: DensitySelector,
11
8
  argTypes: {
12
9
  menuProps: {
13
10
  control: { type: 'object' },
@@ -25,12 +22,12 @@ const meta: Meta<typeof TableDensityFilter> = {
25
22
 
26
23
  export default meta;
27
24
 
28
- const Template: StoryFn<TableDensityFilterProps> = (args) => {
25
+ const Template: StoryFn<DensitySelectorProps> = (args) => {
29
26
  const handleOnChange = (value: GridDensity) => {};
30
27
 
31
28
  return (
32
29
  <>
33
- <TableDensityFilter {...args} />
30
+ <DensitySelector {...args} />
34
31
  </>
35
32
  );
36
33
  };
@@ -15,12 +15,14 @@ export const ColorPalette = {
15
15
  Crimson: '#D4483E',
16
16
  },
17
17
  GreyColors: {
18
+ White30: '#FFFFFF4D',
18
19
  White50: '#FFFFFF80',
19
20
  White70: '#FFFFFFB3',
20
21
  White: '#FFFFFF',
21
22
  Grey100: '#F2F2F2',
22
23
  Grey200: '#CECECE',
23
24
  Grey500: '#333333',
25
+ Black30: '#1212124D',
24
26
  Black50: '#12121280',
25
27
  Black70: '#121212B3',
26
28
  Black: '#121212',
@@ -27,6 +27,7 @@ export const DarkColorTokens = {
27
27
  },
28
28
  border: {
29
29
  primary: ColorPalette.GreyColors.Grey500,
30
+ secondary: ColorPalette.GreyColors.White30,
30
31
  },
31
32
  highlight: {
32
33
  highlightGreen: ColorPalette.UtilityColors.Green,
@@ -27,6 +27,7 @@ export const LightColorTokens = {
27
27
  },
28
28
  border: {
29
29
  primary: ColorPalette.GreyColors.Grey200,
30
+ secondary: ColorPalette.GreyColors.Black30,
30
31
  },
31
32
  highlight: {
32
33
  highlightGreen: ColorPalette.UtilityColors.Green,
@@ -59,6 +59,11 @@ export const getCommonTheme = (mode: Theme) => {
59
59
  styleOverrides: {
60
60
  root: {
61
61
  marginLeft: '2px',
62
+ padding: '0px',
63
+ fontSize: '14px',
64
+ },
65
+ label: {
66
+ lineHeight: '1',
62
67
  },
63
68
  },
64
69
  },
@@ -75,7 +80,10 @@ export const getCommonTheme = (mode: Theme) => {
75
80
  MuiAlert: {
76
81
  styleOverrides: {
77
82
  root: {
78
- width: '400px',
83
+ display: 'flex',
84
+ minWidth: '400px',
85
+ width: 'fit-content',
86
+ maxWidth: '100%',
79
87
  fontFamily: 'Poppins',
80
88
  fontWeight: 500,
81
89
  fontSize: '14px',
@@ -104,6 +112,7 @@ export const getCommonTheme = (mode: Theme) => {
104
112
  styleOverrides: {
105
113
  root: {
106
114
  borderRadius: '10px',
115
+ // padding: '0px',
107
116
  },
108
117
  },
109
118
  },
@@ -172,6 +181,7 @@ export const getCommonTheme = (mode: Theme) => {
172
181
  },
173
182
  },
174
183
  },
184
+
175
185
  MuiCard: {
176
186
  styleOverrides: {
177
187
  root: {
@@ -211,6 +221,7 @@ export const getCommonTheme = (mode: Theme) => {
211
221
  },
212
222
  },
213
223
  paper: {
224
+ marginTop: '8px',
214
225
  borderRadius: '5px',
215
226
  border: `1px solid ${ColorTokens.secondary.main}`,
216
227
  boxShadow: '0px',
@@ -299,8 +310,10 @@ export const getCommonTheme = (mode: Theme) => {
299
310
  '& input:-webkit-autofill': {
300
311
  height: '7px',
301
312
  },
313
+ fieldset: {
314
+ top: '0px',
315
+ },
302
316
  minWidth: '200px',
303
- margin: '2px 0px',
304
317
  },
305
318
  },
306
319
  },
package/tsconfig.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "compilerOptions": {
3
3
  "target": "es5",
4
4
  "lib": ["dom", "dom.iterable", "esnext"],
5
- "allowJs": true,
5
+ "allowJs": false,
6
6
  "skipLibCheck": true,
7
7
  "esModuleInterop": true,
8
8
  "allowSyntheticDefaultImports": true,
package/types/theme.d.ts CHANGED
@@ -32,6 +32,7 @@ declare module '@mui/material/styles' {
32
32
  };
33
33
  border: {
34
34
  primary: string;
35
+ secondary: string;
35
36
  };
36
37
  highlight: {
37
38
  highlightGreen: string;
@@ -1,32 +0,0 @@
1
- import { useTheme } from '@mui/material';
2
-
3
- export const FilterViewIcon = ({ size = 16 }) => {
4
- const theme = useTheme();
5
-
6
- return (
7
- <svg
8
- width={size}
9
- height={size}
10
- viewBox="0 0 16 16"
11
- fill="none"
12
- xmlns="http://www.w3.org/2000/svg"
13
- style={{
14
- fill: theme.palette.primary.main,
15
- stroke: theme.palette.primary.main,
16
- }}
17
- >
18
- <path
19
- d="M14.0008 5.16602H2.00022C1.86789 5.16504 1.74127 5.112 1.64775 5.01838C1.55423 4.92476 1.50133 4.79808 1.50049 4.66575C1.50147 4.53351 1.55443 4.40697 1.64794 4.31346C1.74144 4.21996 1.86799 4.16699 2.00022 4.16602H14.0002C14.1325 4.16699 14.259 4.21996 14.3525 4.31346C14.446 4.40697 14.499 4.53351 14.5 4.66575C14.4991 4.79799 14.4463 4.92458 14.3529 5.01819C14.2595 5.1118 14.133 5.1649 14.0008 5.16602Z"
20
- strokeWidth="0.4"
21
- />
22
- <path
23
- d="M12.0002 8.5H4.00022C3.86789 8.49902 3.74127 8.44598 3.64775 8.35236C3.55423 8.25874 3.50133 8.13206 3.50049 7.99973C3.50147 7.8675 3.55443 7.74096 3.64794 7.64745C3.74144 7.55394 3.86799 7.50098 4.00022 7.5H12.0002C12.1326 7.50084 12.2592 7.55374 12.3529 7.64726C12.4465 7.74078 12.4995 7.86741 12.5005 7.99973C12.4997 8.13215 12.4467 8.25891 12.353 8.35255C12.2594 8.44618 12.1326 8.49916 12.0002 8.5Z"
24
- strokeWidth="0.4"
25
- />
26
- <path
27
- d="M9.33339 11.834H6.66673C6.5344 11.833 6.40778 11.78 6.31425 11.6863C6.22073 11.5927 6.16783 11.466 6.16699 11.3337C6.16797 11.2015 6.22093 11.0749 6.31444 10.9814C6.40795 10.8879 6.53449 10.835 6.66673 10.834H9.33339C9.46572 10.8348 9.5924 10.8877 9.68602 10.9812C9.77964 11.0748 9.83268 11.2014 9.83366 11.3337C9.83282 11.4661 9.77984 11.5929 9.68621 11.6865C9.59257 11.7802 9.46581 11.8331 9.33339 11.834Z"
28
- strokeWidth="0.4"
29
- />
30
- </svg>
31
- );
32
- };
@@ -1,115 +0,0 @@
1
- import { Box, MenuListProps, MenuProps, styled, useTheme } from '@mui/material';
2
- import { GridDensity } from '@mui/x-data-grid';
3
- import { useState } from 'react';
4
- import { useDispatch } from 'react-redux';
5
- import { setDensity } from '../../../state/export';
6
- import {
7
- Button,
8
- DropDownIcon,
9
- DropdownMenu,
10
- Icons,
11
- Typography,
12
- } from '../../export';
13
-
14
- export type TableDensityFilterProps = {
15
- menuProps?: Omit<MenuProps, 'open'>;
16
- menuListProps?: MenuListProps;
17
- uniqueId: string;
18
- };
19
-
20
- export const TableDensityFilter = ({
21
- uniqueId,
22
- ...props
23
- }: TableDensityFilterProps) => {
24
- const dispatch = useDispatch();
25
-
26
- const [density, setGridDensity] = useState<GridDensity>('standard');
27
-
28
- const gridDensity: GridDensity[] = ['compact', 'standard', 'comfortable'];
29
-
30
- const theme = useTheme();
31
-
32
- const getIcon = (type: GridDensity, color?: string, size?: number) => {
33
- switch (type) {
34
- case 'standard':
35
- return <Icons.StandardIcon size={size} color={color} />;
36
- case 'compact':
37
- return <Icons.CompactIcon size={size} color={color} />;
38
- case 'comfortable':
39
- return <Icons.ComfortableIcon size={size} color={color} />;
40
- }
41
- };
42
-
43
- const handleClick = (value: GridDensity, close: () => void) => {
44
- setGridDensity(value);
45
- if (uniqueId) {
46
- dispatch(
47
- setDensity({
48
- uniqueId: uniqueId,
49
- density: value,
50
- }),
51
- );
52
- }
53
- close();
54
- };
55
-
56
- return (
57
- <DropdownMenu
58
- menuListProps={{
59
- sx: {
60
- width: '220px',
61
- padding: '12px',
62
- maxHeight: '350px',
63
- },
64
- ...props.menuListProps,
65
- }}
66
- anchor={({ open }: { open: (e: any) => void }) => (
67
- <DropDownIcon
68
- icon={{
69
- icon: (
70
- <FilterAnchorContainer>{getIcon(density)}</FilterAnchorContainer>
71
- ),
72
- }}
73
- handleClick={open}
74
- />
75
- )}
76
- menuProps={{
77
- ...props.menuProps,
78
- }}
79
- menuHeader={
80
- <Typography color={theme.palette.text.secondary} variant="label1">
81
- Row Density
82
- </Typography>
83
- }
84
- menuListContainerSx={{
85
- margin: '10px 2px 0px 0px',
86
- gap: 1,
87
- }}
88
- menu={({ close }) =>
89
- gridDensity.map((item) => (
90
- <Button
91
- sx={{
92
- gap: '5px',
93
- justifyContent: 'flex-start',
94
- }}
95
- onClick={() => handleClick(item, close)}
96
- variant="text"
97
- >
98
- {getIcon(item, theme.palette.secondary.light, 20)}
99
- <Typography variant="label2">{item}</Typography>
100
- </Button>
101
- ))
102
- }
103
- />
104
- );
105
- };
106
-
107
- const FilterAnchorContainer = styled(Box)(({ theme }) => ({
108
- height: '40px',
109
- width: '40px',
110
- backgroundColor: theme.palette.secondary.main,
111
- borderRadius: '5px',
112
- display: 'flex',
113
- alignItems: 'center',
114
- justifyContent: 'center',
115
- }));
@@ -1,2 +0,0 @@
1
- export * from './filters/filtersSlice';
2
- export * from './store';