@campxdev/react-blueprint 1.2.4 → 1.2.5

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/package.json +1 -1
  2. package/src/App.tsx +11 -21
  3. package/src/components/Assets/Icons/IconComponents/CampxFullLogoIcon.tsx +46 -40
  4. package/src/components/Assets/Icons/IconComponents/CampxIcon.tsx +14 -12
  5. package/src/components/Assets/Icons/IconComponents/CheckedCheckBoxIcon.tsx +13 -32
  6. package/src/components/Assets/Icons/IconComponents/Comfortable.tsx +21 -0
  7. package/src/components/Assets/Icons/IconComponents/CompactIcon.tsx +23 -0
  8. package/src/components/Assets/Icons/IconComponents/ConfigureIcon.tsx +35 -0
  9. package/src/components/Assets/Icons/IconComponents/FilterViewIcon.tsx +32 -0
  10. package/src/components/Assets/Icons/IconComponents/StandardIcon.tsx +22 -0
  11. package/src/components/Assets/Icons/IconComponents/UncheckCheckBoxIcon.tsx +10 -16
  12. package/src/components/Assets/Icons/IconComponents/VisibiityOffIcon.tsx +6 -13
  13. package/src/components/Assets/Icons/IconComponents/VisibilityIcon.tsx +14 -19
  14. package/src/components/Assets/Icons/Icons.tsx +10 -0
  15. package/src/components/DataDisplay/Card/Card.tsx +3 -0
  16. package/src/components/DataDisplay/SidePanel/SidePanel.tsx +1 -1
  17. package/src/components/DataDisplay/SidePanel/styles.tsx +1 -1
  18. package/src/components/Input/SingleCheckBox/SIngleCheckBox.tsx +10 -2
  19. package/src/components/Navigation/Breadcrumbs/Breadcrumbs.tsx +4 -4
  20. package/src/components/Navigation/DropDownMenu/DropDownMenu.tsx +41 -8
  21. package/src/components/Navigation/ManageFilters/ManageFilters.tsx +112 -0
  22. package/src/components/Navigation/Sidebar/Components.tsx +40 -2
  23. package/src/components/Navigation/Sidebar/MenuItem.tsx +21 -9
  24. package/src/components/Navigation/Sidebar/Sidebar.tsx +26 -12
  25. package/src/components/Navigation/Sidebar/SubMenuItem.tsx +5 -1
  26. package/src/components/Navigation/Sidebar/interfaces.ts +2 -0
  27. package/src/components/Navigation/Sidebar/styles.tsx +18 -18
  28. package/src/components/Navigation/TableColumnFilters/TableColumnFilters.tsx +108 -0
  29. package/src/components/Navigation/TableDensityFilter/TableDensityFilter.tsx +104 -0
  30. package/src/components/Navigation/export.ts +3 -0
  31. package/src/stories/Input/Password.stories.tsx +1 -4
  32. package/src/stories/Navigation/ColumnFilters.stories.tsx +82 -0
  33. package/src/stories/Navigation/ManageFilters.stories.tsx +117 -0
  34. package/src/stories/Navigation/TableDensityFilter.stories.tsx +45 -0
  35. package/src/themes/commonTheme.ts +16 -3
@@ -0,0 +1,108 @@
1
+ import { KeyboardArrowDown } from '@mui/icons-material';
2
+ import { MenuListProps, MenuProps, Typography, useTheme } from '@mui/material';
3
+ import { GridColDef } from '@mui/x-data-grid';
4
+ import { useState } from 'react';
5
+ import { Button, Icons, SearchBar, SingleCheckBox } from '../../export';
6
+ import { DropdownMenu } from '../export';
7
+
8
+ export type TableColumnFiltersProps = {
9
+ columns: GridColDef[];
10
+ menuProps?: Omit<MenuProps, 'open'>;
11
+ menuListProps?: MenuListProps;
12
+ onChange: (values: string[]) => void;
13
+ };
14
+
15
+ export const TableColumnFilters = ({
16
+ columns,
17
+ onChange,
18
+ ...props
19
+ }: TableColumnFiltersProps) => {
20
+ const [values, setValues] = useState<GridColDef[]>([]);
21
+ const [search, setSearch] = useState<string>('');
22
+ const theme = useTheme();
23
+
24
+ const filteredOptions = columns.filter((option) =>
25
+ option.field.toLowerCase().includes(search.toLowerCase()),
26
+ );
27
+
28
+ const handleCheckboxChange = (column: GridColDef, checked: boolean) => {
29
+ const updatedValues = checked
30
+ ? [...values, column]
31
+ : values.filter((v) => v.field !== column.field);
32
+ setValues(updatedValues);
33
+ onChange(updatedValues.map((v) => v.field));
34
+ };
35
+ return (
36
+ <>
37
+ <DropdownMenu
38
+ menuListProps={{
39
+ sx: {
40
+ padding: '12px',
41
+ width: '250px',
42
+ },
43
+ ...props.menuListProps,
44
+ }}
45
+ anchor={({ open }: { open: (e: any) => void }) => (
46
+ <Button
47
+ onClick={open}
48
+ sx={{
49
+ gap: '1px',
50
+ borderRadius: '20px',
51
+ }}
52
+ variant="contained"
53
+ endIcon={<KeyboardArrowDown />}
54
+ >
55
+ Columns
56
+ </Button>
57
+ )}
58
+ menuProps={{ ...props.menuProps }}
59
+ menuHeader={
60
+ <SearchBar
61
+ fullWidth
62
+ size="small"
63
+ placeholder="Search"
64
+ onSearch={(value) => {
65
+ setSearch(value);
66
+ }}
67
+ />
68
+ }
69
+ menuListContainerSx={{
70
+ margin: '10px 2px 0px 0px',
71
+ gap: 1,
72
+ maxHeight: '350px',
73
+ }}
74
+ menu={filteredOptions.map((item, index) => (
75
+ <SingleCheckBox
76
+ key={index}
77
+ formControlLabelProps={{
78
+ labelPlacement: 'start',
79
+ sx: {
80
+ display: 'flex',
81
+ justifyContent: 'space-between',
82
+ marginLeft: '0px',
83
+ },
84
+ }}
85
+ icon={<Icons.VisibilityIcon />}
86
+ checkedIcon={<Icons.VisibilityOffIcon />}
87
+ checked={values.includes(item)}
88
+ label={
89
+ <Typography
90
+ color={
91
+ values.includes(item)
92
+ ? theme.palette.text.tertiary
93
+ : theme.palette.text.primary
94
+ }
95
+ variant="subtitle3"
96
+ >
97
+ {item.headerName}
98
+ </Typography>
99
+ }
100
+ onChange={(e) => {
101
+ handleCheckboxChange(item, e.target.checked);
102
+ }}
103
+ />
104
+ ))}
105
+ />
106
+ </>
107
+ );
108
+ };
@@ -0,0 +1,104 @@
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 {
5
+ Button,
6
+ DropDownIcon,
7
+ DropdownMenu,
8
+ Icons,
9
+ Typography,
10
+ } from '../../export';
11
+
12
+ export type TableDensityFilterProps = {
13
+ menuProps?: Omit<MenuProps, 'open'>;
14
+ menuListProps?: MenuListProps;
15
+ onChange: (value: GridDensity) => void;
16
+ };
17
+
18
+ export const TableDensityFilter = ({
19
+ onChange,
20
+ ...props
21
+ }: TableDensityFilterProps) => {
22
+ const [density, setDensity] = useState<GridDensity>('standard');
23
+
24
+ const gridDensity: GridDensity[] = ['compact', 'standard', 'comfortable'];
25
+
26
+ const theme = useTheme();
27
+
28
+ const getIcon = (type: GridDensity, color?: string, size?: number) => {
29
+ switch (type) {
30
+ case 'standard':
31
+ return <Icons.StandardIcon size={size} color={color} />;
32
+ case 'compact':
33
+ return <Icons.CompactIcon size={size} color={color} />;
34
+ case 'comfortable':
35
+ return <Icons.ComfortableIcon size={size} color={color} />;
36
+ }
37
+ };
38
+
39
+ const handleClick = (value: GridDensity, close: () => void) => {
40
+ setDensity(value);
41
+ onChange(value);
42
+ close();
43
+ };
44
+
45
+ return (
46
+ <DropdownMenu
47
+ menuListProps={{
48
+ sx: {
49
+ width: '220px',
50
+ padding: '12px',
51
+ maxHeight: '350px',
52
+ },
53
+ ...props.menuListProps,
54
+ }}
55
+ anchor={({ open }: { open: (e: any) => void }) => (
56
+ <DropDownIcon
57
+ icon={{
58
+ icon: (
59
+ <FilterAnchorContainer>{getIcon(density)}</FilterAnchorContainer>
60
+ ),
61
+ }}
62
+ handleClick={open}
63
+ />
64
+ )}
65
+ menuProps={{
66
+ ...props.menuProps,
67
+ }}
68
+ menuHeader={
69
+ <Typography color={theme.palette.text.secondary} variant="label1">
70
+ Row Density
71
+ </Typography>
72
+ }
73
+ menuListContainerSx={{
74
+ margin: '10px 2px 0px 0px',
75
+ gap: 1,
76
+ }}
77
+ menu={({ close }) =>
78
+ gridDensity.map((item) => (
79
+ <Button
80
+ sx={{
81
+ gap: '5px',
82
+ justifyContent: 'flex-start',
83
+ }}
84
+ onClick={() => handleClick(item, close)}
85
+ variant="text"
86
+ >
87
+ {getIcon(item, theme.palette.secondary.light, 20)}
88
+ <Typography variant="label2">{item}</Typography>
89
+ </Button>
90
+ ))
91
+ }
92
+ />
93
+ );
94
+ };
95
+
96
+ const FilterAnchorContainer = styled(Box)(({ theme }) => ({
97
+ height: '40px',
98
+ width: '40px',
99
+ backgroundColor: theme.palette.secondary.main,
100
+ borderRadius: '5px',
101
+ display: 'flex',
102
+ alignItems: 'center',
103
+ justifyContent: 'center',
104
+ }));
@@ -6,8 +6,11 @@ export * from './DropDownMenu/DropDownButton';
6
6
  export * from './DropDownMenu/DropDownIcon';
7
7
  export * from './DropDownMenu/DropDownMenu';
8
8
  export * from './DropDownMenu/DropdownMenuItem';
9
+ export * from './ManageFilters/ManageFilters';
9
10
  export * from './PreviewFiles/PreviewFiles';
10
11
  export * from './Sidebar/Sidebar';
11
12
  export * from './Stepper/Stepper';
13
+ export * from './TableColumnFilters/TableColumnFilters';
14
+ export * from './TableDensityFilter/TableDensityFilter';
12
15
  export * from './TabsContainer/TabsContainer';
13
16
  export * from './UploadDialog/UploadDialog';
@@ -1,8 +1,5 @@
1
1
  import { Meta } from '@storybook/react';
2
- import {
3
- PasswordField,
4
- PasswordFieldProps,
5
- } from '../../components/Input/PasswordField/PasswordField';
2
+ import { PasswordField, PasswordFieldProps } from '../../components/export';
6
3
 
7
4
  export default {
8
5
  title: 'Input/PasswordField',
@@ -0,0 +1,82 @@
1
+ import { Meta, StoryFn } from '@storybook/react';
2
+ import { useState } from 'react';
3
+ import {
4
+ TableColumnFilters,
5
+ TableColumnFiltersProps,
6
+ } from '../../components/export';
7
+
8
+ const meta: Meta<typeof TableColumnFilters> = {
9
+ title: 'Navigation/ColumnFilters',
10
+ component: TableColumnFilters,
11
+ argTypes: {
12
+ columns: {
13
+ control: { type: 'object' },
14
+ description: 'Array of filter options with labels and values.',
15
+ },
16
+ onChange: {
17
+ action: 'changed',
18
+ description: 'Callback when the selected values change.',
19
+ },
20
+ menuProps: {
21
+ control: { type: 'object' },
22
+ description: 'Props to customize the MUI Menu component.',
23
+ },
24
+ menuListProps: {
25
+ control: { type: 'object' },
26
+ description: 'Props to customize the MUI MenuList component.',
27
+ },
28
+ },
29
+ parameters: {
30
+ controls: { expanded: true },
31
+ },
32
+ };
33
+
34
+ export default meta;
35
+
36
+ const Template: StoryFn<TableColumnFiltersProps> = (args) => {
37
+ const [selectedValues, setSelectedValues] = useState<string[]>([]);
38
+
39
+ const handleOnChange = (values: string[]) => {
40
+ setSelectedValues(values);
41
+ args.onChange(values);
42
+ };
43
+
44
+ return (
45
+ <>
46
+ <TableColumnFilters {...args} onChange={handleOnChange} />
47
+ <div>
48
+ {selectedValues.length > 0 ? (
49
+ <ul>{selectedValues.map((value) => value)}</ul>
50
+ ) : (
51
+ <p>No values selected.</p>
52
+ )}
53
+ </div>
54
+ </>
55
+ );
56
+ };
57
+
58
+ export const Default = Template.bind({});
59
+ Default.args = {
60
+ columns: [
61
+ { field: 'id', headerName: 'ID', width: 90 },
62
+ {
63
+ field: 'firstName',
64
+ headerName: 'First name',
65
+ width: 150,
66
+ editable: true,
67
+ },
68
+ {
69
+ field: 'lastName',
70
+ headerName: 'Last name',
71
+ width: 150,
72
+ editable: true,
73
+ },
74
+ {
75
+ field: 'age',
76
+ headerName: 'Age',
77
+ type: 'number',
78
+ width: 110,
79
+ editable: true,
80
+ },
81
+ ],
82
+ };
@@ -0,0 +1,117 @@
1
+ import { Meta, StoryFn } from '@storybook/react';
2
+ import { ReactNode, useState } from 'react';
3
+ import {
4
+ ManageFilters,
5
+ ManageFiltersProps,
6
+ SingleSelect,
7
+ TextField,
8
+ } from '../../components/export';
9
+ import { RadioGroup } from '../../components/Input/RadioGroup/RadioGroup';
10
+
11
+ const meta: Meta<typeof ManageFilters> = {
12
+ title: 'Navigation/ManageFilters',
13
+ component: ManageFilters,
14
+ argTypes: {
15
+ options: {
16
+ control: { type: 'object' },
17
+ description: 'Array of filter options with labels and values.',
18
+ },
19
+ onChange: {
20
+ action: 'changed',
21
+ description: 'Callback when the selected values change.',
22
+ },
23
+ menuProps: {
24
+ control: { type: 'object' },
25
+ description: 'Props to customize the MUI Menu component.',
26
+ },
27
+ menuListProps: {
28
+ control: { type: 'object' },
29
+ description: 'Props to customize the MUI MenuList component.',
30
+ },
31
+ },
32
+ parameters: {
33
+ controls: { expanded: true },
34
+ },
35
+ };
36
+
37
+ export default meta;
38
+
39
+ const Template: StoryFn<ManageFiltersProps> = (args) => {
40
+ const [selectedValues, setSelectedValues] = useState<ReactNode[]>([]);
41
+
42
+ const handleOnChange = (values: ReactNode[]) => {
43
+ setSelectedValues(values);
44
+ args.onChange(values);
45
+ };
46
+
47
+ return (
48
+ <>
49
+ <ManageFilters {...args} onChange={handleOnChange} />
50
+ <div>
51
+ {selectedValues.length > 0 ? (
52
+ <ul>{selectedValues.map((value, index) => value)}</ul>
53
+ ) : (
54
+ <p>No values selected.</p>
55
+ )}
56
+ </div>
57
+ </>
58
+ );
59
+ };
60
+
61
+ export const Default = Template.bind({});
62
+ Default.args = {
63
+ options: [
64
+ {
65
+ label: 'Option 1',
66
+ value: (
67
+ <SingleSelect
68
+ useCampxAxios={false}
69
+ onChange={() => {}}
70
+ options={[
71
+ {
72
+ label: 'done',
73
+ value: 'done',
74
+ },
75
+ {
76
+ label: 'processing',
77
+ value: 'processing',
78
+ },
79
+ {
80
+ label: 'onHold',
81
+ value: 'onHold',
82
+ },
83
+ ]}
84
+ />
85
+ ),
86
+ },
87
+ {
88
+ label: 'text Filed',
89
+ value: <TextField sx={{ width: '250px' }} />,
90
+ },
91
+ {
92
+ label: 'Radio Group',
93
+ value: (
94
+ <RadioGroup
95
+ options={[
96
+ {
97
+ label: 'done',
98
+ value: 'done',
99
+ },
100
+ {
101
+ label: 'processing',
102
+ value: 'processing',
103
+ },
104
+ {
105
+ label: 'onHold',
106
+ value: 'onHold',
107
+ },
108
+ ]}
109
+ label={''}
110
+ required={false}
111
+ name={''}
112
+ disabled={false}
113
+ />
114
+ ),
115
+ },
116
+ ],
117
+ };
@@ -0,0 +1,45 @@
1
+ import { GridDensity } from '@mui/x-data-grid';
2
+ import { Meta, StoryFn } from '@storybook/react';
3
+ import {
4
+ TableDensityFilter,
5
+ TableDensityFilterProps,
6
+ } from '../../components/export';
7
+
8
+ const meta: Meta<typeof TableDensityFilter> = {
9
+ title: 'Navigation/TableDensityFilter',
10
+ component: TableDensityFilter,
11
+ argTypes: {
12
+ onChange: {
13
+ action: 'changed',
14
+ description: 'Callback when the selected values change.',
15
+ },
16
+ menuProps: {
17
+ control: { type: 'object' },
18
+ description: 'Props to customize the MUI Menu component.',
19
+ },
20
+ menuListProps: {
21
+ control: { type: 'object' },
22
+ description: 'Props to customize the MUI MenuList component.',
23
+ },
24
+ },
25
+ parameters: {
26
+ controls: { expanded: true },
27
+ },
28
+ };
29
+
30
+ export default meta;
31
+
32
+ const Template: StoryFn<TableDensityFilterProps> = (args) => {
33
+ const handleOnChange = (value: GridDensity) => {
34
+ args.onChange(value);
35
+ };
36
+
37
+ return (
38
+ <>
39
+ <TableDensityFilter {...args} onChange={handleOnChange} />
40
+ </>
41
+ );
42
+ };
43
+
44
+ export const Default = Template.bind({});
45
+ Default.args = {};
@@ -143,6 +143,19 @@ export const getCommonTheme = (mode: Theme) => {
143
143
  },
144
144
  },
145
145
  },
146
+ MuiBadge: {
147
+ styleOverrides: {
148
+ dot: {
149
+ width: '4px',
150
+ height: '4px',
151
+ borderRadius: '10px',
152
+ backgroundColor: ColorTokens.tertiary.main,
153
+ margin: '3px',
154
+ minWidth: '4px',
155
+ },
156
+ },
157
+ },
158
+
146
159
  MuiChip: {
147
160
  styleOverrides: {
148
161
  root: {
@@ -163,9 +176,10 @@ export const getCommonTheme = (mode: Theme) => {
163
176
  styleOverrides: {
164
177
  root: {
165
178
  boxShadow: 'none',
166
-
179
+ backgroundColor: ColorTokens.surface.paperBackground,
167
180
  border: `1px solid ${ColorTokens.border.primary}`,
168
181
  borderRadius: '8px',
182
+ backgroundImage: 'none',
169
183
  },
170
184
  },
171
185
  },
@@ -199,8 +213,7 @@ export const getCommonTheme = (mode: Theme) => {
199
213
  paper: {
200
214
  borderRadius: '5px',
201
215
  border: `1px solid ${ColorTokens.secondary.main}`,
202
- marginTop: '10px',
203
- boxShadow: `0px 5px 15px ${ColorTokens.secondary.main}`,
216
+ boxShadow: '0px',
204
217
  '&::-webkit-scrollbar': {
205
218
  width: '0.5em',
206
219
  height: '0.5em',