@campxdev/react-blueprint 1.1.6 → 1.1.7

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 (49) hide show
  1. package/.prettierrc +8 -0
  2. package/package.json +4 -1
  3. package/src/App.tsx +17 -38
  4. package/src/components/Assets/Icons/IconComponents/AcademicIcon.tsx +41 -0
  5. package/src/components/Assets/Icons/IconComponents/AccordionArrow.tsx +23 -0
  6. package/src/components/Assets/Icons/IconComponents/NoteIcon.tsx +41 -0
  7. package/src/components/Assets/Icons/Icons.tsx +65 -58
  8. package/src/components/Charts/BarChart/BarChart.tsx +33 -9
  9. package/src/components/Charts/LineChart/LineChart.tsx +10 -4
  10. package/src/components/Charts/PieChart/PieChart.tsx +3 -2
  11. package/src/components/Charts/TreeMap/TreeMap.tsx +1 -0
  12. package/src/components/Charts/export.ts +4 -0
  13. package/src/components/Charts/types/types.ts +12 -2
  14. package/src/components/DataDisplay/Accordion/Accordion.tsx +42 -46
  15. package/src/components/DataDisplay/AccordionGroup/AccordionGroup.tsx +30 -0
  16. package/src/components/DataDisplay/Avatar/Avatar.tsx +18 -29
  17. package/src/components/DataDisplay/Card/Card.tsx +29 -8
  18. package/src/components/DataDisplay/DataTable/DataTable.tsx +14 -6
  19. package/src/components/DataDisplay/export.ts +6 -5
  20. package/src/components/DataDisplay/styles.tsx +2 -3
  21. package/src/components/Feedback/Snackbar/Snackbar.tsx +6 -5
  22. package/src/components/Input/DatePicker/DatePicker.tsx +58 -0
  23. package/src/components/Input/FormActions/FormActions.tsx +49 -0
  24. package/src/components/Input/FormControlWrapper/FormControlWrapper.tsx +70 -0
  25. package/src/components/Input/IconButtons/IconButtons.tsx +4 -4
  26. package/src/components/Input/LabelWrapper/LabelWrapper.tsx +1 -1
  27. package/src/components/Input/SingleSelect/SingleSelect.tsx +43 -54
  28. package/src/components/Input/{Chips/Chips.tsx → Tags/Tags.tsx} +14 -14
  29. package/src/components/Input/TimePicker/TimePicker.tsx +39 -0
  30. package/src/components/Input/export.ts +13 -8
  31. package/src/components/Layout/PageContent/PageContent.tsx +16 -0
  32. package/src/components/Layout/PageHeader/PageHeader.tsx +46 -0
  33. package/src/components/Navigation/DropDownMenu/DropDownButton.tsx +5 -5
  34. package/src/components/Navigation/Sidebar/Components.tsx +97 -0
  35. package/src/components/Navigation/Sidebar/MenuItem.tsx +76 -104
  36. package/src/components/Navigation/Sidebar/Sidebar.tsx +150 -55
  37. package/src/components/Navigation/Sidebar/SubMenuItem.tsx +34 -0
  38. package/src/components/Navigation/Sidebar/interfaces.ts +35 -12
  39. package/src/components/Navigation/Sidebar/styles.tsx +2 -2
  40. package/src/components/Navigation/exports.ts +2 -0
  41. package/src/components/export.ts +1 -1
  42. package/src/stories/DataDisplay/AccordionGroup.stories.tsx +131 -0
  43. package/src/stories/Input/DatePicker.stories.tsx +138 -0
  44. package/src/stories/Input/{Chips.stories.tsx → Tags.stories.tsx} +17 -17
  45. package/src/stories/Input/TimePicker.stories.tsx +123 -0
  46. package/src/themes/commonTheme.ts +171 -155
  47. package/src/components/DataDisplay/Accordion/utils/StandardImageList.tsx +0 -70
  48. package/src/components/Navigation/Sidebar/DropdownItem.tsx +0 -34
  49. package/src/stories/DataDisplay/Accordion.stories.tsx +0 -62
@@ -0,0 +1,131 @@
1
+ import ImageList from '@mui/material/ImageList';
2
+ import ImageListItem from '@mui/material/ImageListItem';
3
+ import { Meta, StoryObj } from '@storybook/react/*';
4
+ import { AccordionGroup } from '../../components/DataDisplay/AccordionGroup/AccordionGroup';
5
+
6
+ const StandardImageList = () => {
7
+ return (
8
+ <ImageList sx={{ width: 500, height: 450 }} cols={3} rowHeight={164}>
9
+ {itemData.map((item) => (
10
+ <ImageListItem key={item.img}>
11
+ <img
12
+ srcSet={`${item.img}?w=164&h=164&fit=crop&auto=format&dpr=2 2x`}
13
+ src={`${item.img}?w=164&h=164&fit=crop&auto=format`}
14
+ alt={item.title}
15
+ loading="lazy"
16
+ />
17
+ </ImageListItem>
18
+ ))}
19
+ </ImageList>
20
+ );
21
+ };
22
+
23
+ const itemData = [
24
+ {
25
+ img: 'https://images.unsplash.com/photo-1551963831-b3b1ca40c98e',
26
+ title: 'Breakfast',
27
+ },
28
+ {
29
+ img: 'https://images.unsplash.com/photo-1551782450-a2132b4ba21d',
30
+ title: 'Burger',
31
+ },
32
+ {
33
+ img: 'https://images.unsplash.com/photo-1522770179533-24471fcdba45',
34
+ title: 'Camera',
35
+ },
36
+ {
37
+ img: 'https://images.unsplash.com/photo-1444418776041-9c7e33cc5a9c',
38
+ title: 'Coffee',
39
+ },
40
+ {
41
+ img: 'https://images.unsplash.com/photo-1533827432537-70133748f5c8',
42
+ title: 'Hats',
43
+ },
44
+ {
45
+ img: 'https://images.unsplash.com/photo-1558642452-9d2a7deb7f62',
46
+ title: 'Honey',
47
+ },
48
+ {
49
+ img: 'https://images.unsplash.com/photo-1516802273409-68526ee1bdd6',
50
+ title: 'Basketball',
51
+ },
52
+ {
53
+ img: 'https://images.unsplash.com/photo-1518756131217-31eb79b20e8f',
54
+ title: 'Fern',
55
+ },
56
+ {
57
+ img: 'https://images.unsplash.com/photo-1597645587822-e99fa5d45d25',
58
+ title: 'Mushrooms',
59
+ },
60
+ {
61
+ img: 'https://images.unsplash.com/photo-1567306301408-9b74779a11af',
62
+ title: 'Tomato basil',
63
+ },
64
+ {
65
+ img: 'https://images.unsplash.com/photo-1471357674240-e1a485acb3e1',
66
+ title: 'Sea star',
67
+ },
68
+ {
69
+ img: 'https://images.unsplash.com/photo-1589118949245-7d38baf380d6',
70
+ title: 'Bike',
71
+ },
72
+ ];
73
+
74
+ const meta: Meta<typeof AccordionGroup> = {
75
+ title: 'DataDisplay/Accordion',
76
+ component: AccordionGroup,
77
+ };
78
+
79
+ export default meta;
80
+
81
+ type Story = StoryObj<typeof AccordionGroup>;
82
+
83
+ const primaryData = [
84
+ {
85
+ title: 'Accordion 1',
86
+ content:
87
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.',
88
+ },
89
+ {
90
+ title: 'Accordion 2',
91
+ content:
92
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.',
93
+ },
94
+ {
95
+ title: 'Accordion 3',
96
+ content:
97
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.',
98
+ },
99
+ {
100
+ title: 'Accordion 4',
101
+ content:
102
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.',
103
+ },
104
+ ];
105
+
106
+ const SecondaryData = [
107
+ {
108
+ title: 'Accordion 1',
109
+ content: <StandardImageList />,
110
+ },
111
+ {
112
+ title: 'Accordion 2',
113
+ content: <StandardImageList />,
114
+ },
115
+ {
116
+ title: 'Accordion 3',
117
+ content: <StandardImageList />,
118
+ },
119
+ {
120
+ title: 'Accordion 4',
121
+ content: <StandardImageList />,
122
+ },
123
+ ];
124
+
125
+ export const Primary: Story = {
126
+ args: { data: primaryData },
127
+ };
128
+
129
+ export const Secondary: Story = {
130
+ args: { data: SecondaryData },
131
+ };
@@ -0,0 +1,138 @@
1
+ import { LocalizationProvider } from '@mui/x-date-pickers';
2
+ import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3';
3
+ import { Meta, StoryObj } from '@storybook/react/*';
4
+ import { add } from 'date-fns';
5
+ import { Icons } from '../../components/Assets/Icons/Icons';
6
+ import { DatePicker } from '../../components/Input/DatePicker/DatePicker';
7
+
8
+ const meta: Meta<typeof DatePicker> = {
9
+ title: 'Input/DatePicker',
10
+ component: DatePicker,
11
+ decorators: [
12
+ (Story) => (
13
+ <LocalizationProvider dateAdapter={AdapterDateFns}>
14
+ <Story />
15
+ </LocalizationProvider>
16
+ ),
17
+ ],
18
+ };
19
+
20
+ export default meta;
21
+
22
+ type Story = StoryObj<typeof DatePicker>;
23
+
24
+ export const Primary: Story = {
25
+ args: { label: 'Date Picker', name: 'date-picker', required: true },
26
+ };
27
+
28
+ export const Secondary: Story = {
29
+ args: { ...Primary.args, label: 'Date Picker (Full Month Text)', format: 'dd MMMM yyyy' },
30
+ };
31
+
32
+ export const Tertiary: Story = {
33
+ args: { ...Primary.args, label: 'Just Month Year', format: 'MMMM yyyy', views: ['month', 'year'] },
34
+ };
35
+
36
+ export const Quaternary: Story = {
37
+ args: { ...Primary.args, label: 'Just Year', format: 'yyyy', views: ['year'] },
38
+ };
39
+
40
+ export const WithShortcuts: Story = {
41
+ args: {
42
+ ...Primary.args,
43
+ label: 'With Shortcuts',
44
+ required: false,
45
+ shortcutsItems: [
46
+ { label: 'Today', getValue: () => new Date() },
47
+ { label: 'Tomorrow', getValue: () => add(new Date(), { days: 1 }) },
48
+ { label: 'Yesterday', getValue: () => add(new Date(), { days: -1 }) },
49
+ {
50
+ label: 'Independence Day',
51
+ getValue: () => {
52
+ const currentYear = new Date().getFullYear();
53
+ return new Date(currentYear, 6, 15);
54
+ },
55
+ },
56
+ {
57
+ label: 'Christmas',
58
+ getValue: () => {
59
+ const currentYear = new Date().getFullYear();
60
+ return new Date(currentYear, 11, 25);
61
+ },
62
+ },
63
+ ],
64
+ },
65
+ };
66
+
67
+ export const WithDefaultValue: Story = {
68
+ args: { ...Primary.args, label: 'With Default Value', required: false, value: new Date('2024/9/15') },
69
+ };
70
+
71
+ export const WithMinMaxDate: Story = {
72
+ args: {
73
+ ...Primary.args,
74
+ label: 'With Min and Max Date',
75
+ required: false,
76
+ minDate: new Date('2024/8/15'),
77
+ maxDate: new Date('2024/10/9'),
78
+ },
79
+ };
80
+
81
+ export const WithCustomIcon: Story = {
82
+ args: { ...Primary.args, label: 'With Custom Icon', required: false, openPickerIcon: Icons.CareerIcon },
83
+ };
84
+
85
+ export const WithPlaceHolderHelperText: Story = {
86
+ args: {
87
+ ...Primary.args,
88
+ label: 'With Place Holder, Helper Text',
89
+ required: false,
90
+ placeholder: 'CampX date',
91
+ helperText: 'Mandatory field',
92
+ },
93
+ };
94
+
95
+ export const DisablePast: Story = {
96
+ args: { ...Primary.args, label: 'Disable Past Dates', required: false, disablePast: true },
97
+ };
98
+
99
+ export const DisableFuture: Story = {
100
+ args: { ...Primary.args, label: 'Disable Future Dates', required: false, disableFuture: true },
101
+ };
102
+
103
+ export const DisableSpecificDate: Story = {
104
+ args: {
105
+ ...Primary.args,
106
+ label: 'Disable Specific Dates',
107
+ required: false,
108
+ shouldDisableDate: (date: Date) => {
109
+ return date.getDay() === 0 || date.getDay() === 6;
110
+ },
111
+ },
112
+ };
113
+
114
+ export const DisableSpecificMonth: Story = {
115
+ args: {
116
+ ...Primary.args,
117
+ label: 'Disable Specific Month (February)',
118
+ required: false,
119
+ shouldDisableMonth: (date: Date) => {
120
+ return date.getMonth() === 1;
121
+ },
122
+ },
123
+ };
124
+
125
+ export const DisableSpecificYear: Story = {
126
+ args: {
127
+ ...Primary.args,
128
+ label: 'Disable Specific Year (2022)',
129
+ required: false,
130
+ shouldDisableYear: (date: Date) => {
131
+ return date.getFullYear() === 2022;
132
+ },
133
+ },
134
+ };
135
+
136
+ export const ReadOnly = {
137
+ args: { ...Primary.args, label: 'Read Only', required: false, disabled: true, value: new Date('2024/9/15') },
138
+ };
@@ -1,40 +1,40 @@
1
1
  // Import React and other necessary elements
2
- import { Meta } from "@storybook/react";
3
- import { Chips } from "../../components/Input/Chips/Chips";
2
+ import { Meta } from '@storybook/react';
3
+ import { Tags } from '../../components/Input/Tags/Tags';
4
4
 
5
- const sampleChips = [
5
+ const sampleTags = [
6
6
  {
7
- label: "Chip1",
7
+ label: 'Tag1',
8
8
  value: 1,
9
9
  },
10
10
  {
11
- label: "Chip2",
11
+ label: 'Tag2',
12
12
  value: 2,
13
13
  },
14
14
  {
15
- label: "Chip3",
15
+ label: 'Tag3',
16
16
  value: 3,
17
17
  },
18
18
  ];
19
19
 
20
20
  // Define the default export with Meta type including the component type
21
21
  export default {
22
- title: "Input/Chips",
23
- component: Chips,
24
- tags: ["autodocs"],
22
+ title: 'Input/Tags',
23
+ component: Tags,
24
+ tags: ['autodocs'],
25
25
  argTypes: {},
26
- } as Meta<typeof Chips>;
26
+ } as Meta<typeof Tags>;
27
27
 
28
28
  // Define stories directly as objects with render function
29
29
  export const Default = {
30
- render: () => <Chips chips={sampleChips} />,
30
+ render: () => <Tags tags={sampleTags} />,
31
31
  args: {},
32
32
  };
33
33
 
34
- export const ClickableChip = {
34
+ export const ClickableTag = {
35
35
  render: () => (
36
- <Chips
37
- chips={sampleChips}
36
+ <Tags
37
+ tags={sampleTags}
38
38
  onClick={(clickedChip) => {
39
39
  console.log(clickedChip);
40
40
  }}
@@ -42,10 +42,10 @@ export const ClickableChip = {
42
42
  ),
43
43
  };
44
44
 
45
- export const DeletableChip = {
45
+ export const DeletableTag = {
46
46
  render: () => (
47
- <Chips
48
- chips={sampleChips}
47
+ <Tags
48
+ tags={sampleTags}
49
49
  onDelete={(deletedChip) => {
50
50
  console.log(deletedChip);
51
51
  }}
@@ -0,0 +1,123 @@
1
+ import { LocalizationProvider } from '@mui/x-date-pickers';
2
+ import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3';
3
+ import { Meta, StoryObj } from '@storybook/react/*';
4
+ import { add, isWithinInterval, startOfDay } from 'date-fns';
5
+ import { TimePicker } from '../../components/Input/TimePicker/TimePicker';
6
+
7
+ const meta: Meta<typeof TimePicker> = {
8
+ title: 'Input/TimePicker',
9
+ component: TimePicker,
10
+ decorators: [
11
+ (Story) => (
12
+ <LocalizationProvider dateAdapter={AdapterDateFns}>
13
+ <Story />
14
+ </LocalizationProvider>
15
+ ),
16
+ ],
17
+ };
18
+
19
+ export default meta;
20
+
21
+ type Story = StoryObj<typeof TimePicker>;
22
+
23
+ export const Primary: Story = {
24
+ args: { label: 'Time Picker (Hours Minutes Meridian)', name: 'time-picker', required: true },
25
+ };
26
+
27
+ export const Secondary: Story = {
28
+ args: {
29
+ ...Primary.args,
30
+ label: 'Time Picker (Hours Minutes Seconds Meridian)',
31
+ format: 'HH:mm:ss a',
32
+ views: ['hours', 'minutes', 'seconds'],
33
+ },
34
+ };
35
+
36
+ export const Tertiary: Story = {
37
+ args: {
38
+ ...Primary.args,
39
+ label: 'Time Picker (Hours Minutes - 24hr Format)',
40
+ format: 'HH:mm',
41
+ ampm: false,
42
+ },
43
+ };
44
+
45
+ export const Quaternary: Story = {
46
+ args: {
47
+ ...Primary.args,
48
+ label: 'Time Picker (Hours Minutes Seconds - 24hr Format)',
49
+ format: 'HH:mm:ss',
50
+ ampm: false,
51
+ views: ['hours', 'minutes', 'seconds'],
52
+ },
53
+ };
54
+
55
+ export const WithDefaultValue: Story = {
56
+ args: { ...Primary.args, label: 'With Default Value', required: false, value: new Date('2024/9/15 15:30') },
57
+ };
58
+
59
+ export const WithPlaceHolderHelperText: Story = {
60
+ args: {
61
+ ...Primary.args,
62
+ label: 'With Placeholder & Helper Text',
63
+ required: false,
64
+ placeholder: 'Select Time',
65
+ helperText: 'Mandatory field',
66
+ },
67
+ };
68
+
69
+ export const WithDifferentTimeSteps: Story = {
70
+ args: { ...Primary.args, label: 'With Time Steps', required: false, timeSteps: { hours: 2, minutes: 15 } },
71
+ };
72
+
73
+ export const DisablePast: Story = {
74
+ args: { ...Primary.args, label: 'Disable Past', format: 'HH:mm', ampm: false, required: false, disablePast: true },
75
+ };
76
+
77
+ export const DisableFuture: Story = {
78
+ args: { ...Primary.args, label: 'Disable Future', format: 'HH:mm', ampm: false, required: false, disableFuture: true },
79
+ };
80
+
81
+ export const MinimumTime: Story = {
82
+ args: {
83
+ ...Primary.args,
84
+ label: 'With Minimum Time (9AM)',
85
+ format: 'HH:mm',
86
+ ampm: false,
87
+ required: false,
88
+ minTime: new Date('2024/9/15 09:00'),
89
+ },
90
+ };
91
+
92
+ export const MaximumTime: Story = {
93
+ args: {
94
+ ...Primary.args,
95
+ label: 'With Maximum Time (5PM)',
96
+ format: 'HH:mm',
97
+ ampm: false,
98
+ required: false,
99
+ maxTime: new Date('2024/9/15 17:00'),
100
+ },
101
+ };
102
+
103
+ export const DisableSpecificTime: Story = {
104
+ args: {
105
+ ...Primary.args,
106
+ label: 'Disable Specific Time (12AM - 9AM)',
107
+ ampm: false,
108
+ required: false,
109
+ shouldDisableTime: (time: Date, clockType: 'hours' | 'minutes' | 'seconds') => {
110
+ if (clockType === 'hours') {
111
+ const today = startOfDay(new Date());
112
+ const startTime = today;
113
+ const endTime = add(today, { hours: 8 });
114
+ return isWithinInterval(time, { start: startTime, end: endTime });
115
+ }
116
+ return false;
117
+ },
118
+ },
119
+ };
120
+
121
+ export const ReadOnly: Story = {
122
+ args: { ...Primary.args, label: 'Read Only', required: false, disabled: true, value: new Date('2024/9/15 15:30') },
123
+ };