ece-docs-components 1.0.5 → 1.0.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 (133) hide show
  1. package/dist/ThemeProvider.d.ts +12 -0
  2. package/dist/ThemeProvider.d.ts.map +1 -1
  3. package/dist/cjs/ThemeProvider.js +159 -0
  4. package/dist/cjs/ThemeProvider.js.map +1 -0
  5. package/dist/cjs/components/ActionButton.js +31 -0
  6. package/dist/cjs/components/ActionButton.js.map +1 -0
  7. package/dist/cjs/components/Alert.js +79 -0
  8. package/dist/cjs/components/Alert.js.map +1 -0
  9. package/dist/cjs/components/Breadcrumb.js +120 -0
  10. package/dist/cjs/components/Breadcrumb.js.map +1 -0
  11. package/dist/cjs/components/Button.js +109 -0
  12. package/dist/cjs/components/Button.js.map +1 -0
  13. package/dist/cjs/components/Card.js +45 -0
  14. package/dist/cjs/components/Card.js.map +1 -0
  15. package/dist/cjs/components/Checkbox.js +42 -0
  16. package/dist/cjs/components/Checkbox.js.map +1 -0
  17. package/dist/cjs/components/Concertina.js +153 -0
  18. package/dist/cjs/components/Concertina.js.map +1 -0
  19. package/dist/cjs/components/DefinitionBox.js +77 -0
  20. package/dist/cjs/components/DefinitionBox.js.map +1 -0
  21. package/dist/cjs/components/Header.js +177 -0
  22. package/dist/cjs/components/Header.js.map +1 -0
  23. package/dist/cjs/components/Input.js +77 -0
  24. package/dist/cjs/components/Input.js.map +1 -0
  25. package/dist/cjs/components/Modal.js +114 -0
  26. package/dist/cjs/components/Modal.js.map +1 -0
  27. package/dist/cjs/components/NoteBox.js +111 -0
  28. package/dist/cjs/components/NoteBox.js.map +1 -0
  29. package/dist/cjs/components/Progress.js +83 -0
  30. package/dist/cjs/components/Progress.js.map +1 -0
  31. package/dist/cjs/components/Radio.js +61 -0
  32. package/dist/cjs/components/Radio.js.map +1 -0
  33. package/dist/cjs/components/ReadBy.js +58 -0
  34. package/dist/cjs/components/ReadBy.js.map +1 -0
  35. package/dist/cjs/components/Select.js +96 -0
  36. package/dist/cjs/components/Select.js.map +1 -0
  37. package/dist/cjs/components/Sidebar.js +206 -0
  38. package/dist/cjs/components/Sidebar.js.map +1 -0
  39. package/dist/cjs/components/SimpleModal.js +40 -0
  40. package/dist/cjs/components/SimpleModal.js.map +1 -0
  41. package/dist/cjs/components/StatusBar.js +64 -0
  42. package/dist/cjs/components/StatusBar.js.map +1 -0
  43. package/dist/cjs/components/TableOfContents.js +62 -0
  44. package/dist/cjs/components/TableOfContents.js.map +1 -0
  45. package/dist/cjs/components/Tabs.js +97 -0
  46. package/dist/cjs/components/Tabs.js.map +1 -0
  47. package/dist/cjs/components/Toggle.js +60 -0
  48. package/dist/cjs/components/Toggle.js.map +1 -0
  49. package/dist/cjs/index.js +57 -0
  50. package/dist/cjs/index.js.map +1 -0
  51. package/dist/components/Button.d.ts.map +1 -1
  52. package/dist/esm/ThemeProvider.d.ts +117 -0
  53. package/dist/esm/ThemeProvider.js +137 -0
  54. package/dist/esm/ThemeProvider.js.map +1 -0
  55. package/dist/esm/components/ActionButton.d.ts +11 -0
  56. package/dist/esm/components/ActionButton.js +29 -0
  57. package/dist/esm/components/ActionButton.js.map +1 -0
  58. package/dist/esm/components/Alert.d.ts +11 -0
  59. package/dist/esm/components/Alert.js +77 -0
  60. package/dist/esm/components/Alert.js.map +1 -0
  61. package/dist/esm/components/Breadcrumb.d.ts +13 -0
  62. package/dist/esm/components/Breadcrumb.js +118 -0
  63. package/dist/esm/components/Breadcrumb.js.map +1 -0
  64. package/dist/esm/components/Button.d.ts +8 -0
  65. package/dist/esm/components/Button.js +107 -0
  66. package/dist/esm/components/Button.js.map +1 -0
  67. package/dist/esm/components/Card.d.ts +11 -0
  68. package/dist/esm/components/Card.js +43 -0
  69. package/dist/esm/components/Card.js.map +1 -0
  70. package/dist/esm/components/Checkbox.d.ts +8 -0
  71. package/dist/esm/components/Checkbox.js +40 -0
  72. package/dist/esm/components/Checkbox.js.map +1 -0
  73. package/dist/esm/components/Concertina.d.ts +10 -0
  74. package/dist/esm/components/Concertina.js +151 -0
  75. package/dist/esm/components/Concertina.js.map +1 -0
  76. package/dist/esm/components/DefinitionBox.d.ts +8 -0
  77. package/dist/esm/components/DefinitionBox.js +75 -0
  78. package/dist/esm/components/DefinitionBox.js.map +1 -0
  79. package/dist/esm/components/Header.d.ts +7 -0
  80. package/dist/esm/components/Header.js +175 -0
  81. package/dist/esm/components/Header.js.map +1 -0
  82. package/dist/esm/components/Input.d.ts +7 -0
  83. package/dist/esm/components/Input.js +75 -0
  84. package/dist/esm/components/Input.js.map +1 -0
  85. package/dist/esm/components/Modal.d.ts +20 -0
  86. package/dist/esm/components/Modal.js +112 -0
  87. package/dist/esm/components/Modal.js.map +1 -0
  88. package/dist/esm/components/NoteBox.d.ts +10 -0
  89. package/dist/esm/components/NoteBox.js +109 -0
  90. package/dist/esm/components/NoteBox.js.map +1 -0
  91. package/dist/esm/components/Progress.d.ts +15 -0
  92. package/dist/esm/components/Progress.js +80 -0
  93. package/dist/esm/components/Progress.js.map +1 -0
  94. package/dist/esm/components/Radio.d.ts +14 -0
  95. package/dist/esm/components/Radio.js +58 -0
  96. package/dist/esm/components/Radio.js.map +1 -0
  97. package/dist/esm/components/ReadBy.d.ts +6 -0
  98. package/dist/esm/components/ReadBy.js +56 -0
  99. package/dist/esm/components/ReadBy.js.map +1 -0
  100. package/dist/esm/components/Select.d.ts +19 -0
  101. package/dist/esm/components/Select.js +94 -0
  102. package/dist/esm/components/Select.js.map +1 -0
  103. package/dist/esm/components/Sidebar.d.ts +10 -0
  104. package/dist/esm/components/Sidebar.js +204 -0
  105. package/dist/esm/components/Sidebar.js.map +1 -0
  106. package/dist/esm/components/SimpleModal.d.ts +9 -0
  107. package/dist/esm/components/SimpleModal.js +38 -0
  108. package/dist/esm/components/SimpleModal.js.map +1 -0
  109. package/dist/esm/components/StatusBar.d.ts +9 -0
  110. package/dist/esm/components/StatusBar.js +62 -0
  111. package/dist/esm/components/StatusBar.js.map +1 -0
  112. package/dist/esm/components/TableOfContents.d.ts +11 -0
  113. package/dist/esm/components/TableOfContents.js +60 -0
  114. package/dist/esm/components/TableOfContents.js.map +1 -0
  115. package/dist/esm/components/Tabs.d.ts +12 -0
  116. package/dist/esm/components/Tabs.js +95 -0
  117. package/dist/esm/components/Tabs.js.map +1 -0
  118. package/dist/esm/components/Toggle.d.ts +8 -0
  119. package/dist/esm/components/Toggle.js +58 -0
  120. package/dist/esm/components/Toggle.js.map +1 -0
  121. package/dist/esm/components/index.d.ts +22 -0
  122. package/dist/esm/index.d.ts +25 -0
  123. package/dist/esm/index.js +26 -0
  124. package/dist/esm/index.js.map +1 -0
  125. package/dist/esm/theme-types.d.ts +39 -0
  126. package/dist/{index.esm.js → index.cjs} +270 -198
  127. package/dist/index.cjs.map +1 -0
  128. package/dist/index.d.ts +22 -1
  129. package/dist/index.d.ts.map +1 -1
  130. package/dist/index.js +224 -242
  131. package/dist/index.js.map +1 -1
  132. package/package.json +15 -13
  133. package/dist/index.esm.js.map +0 -1
@@ -0,0 +1,80 @@
1
+ "use client";
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import React__default from 'react';
4
+ import { styled, LinearProgress, Box, Typography } from '@mui/material';
5
+ import { useTheme } from '../ThemeProvider.js';
6
+
7
+ const StyledLinearProgress = styled(LinearProgress)(({ theme }) => ({
8
+ height: 10,
9
+ borderRadius: 9999,
10
+ backgroundColor: `${theme.palette.dark.main}1A`,
11
+ '& .MuiLinearProgress-bar': {
12
+ borderRadius: 9999,
13
+ backgroundColor: theme.palette.primary.main,
14
+ transition: 'transform 0.3s ease-out',
15
+ },
16
+ }));
17
+ const Progress = ({ current, total, showLabel = true, className = '' }) => {
18
+ const percentage = Math.min(Math.max((current / total) * 100, 0), 100);
19
+ return (jsxs(Box, { className: className, children: [showLabel && (jsxs(Box, { sx: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 1 }, children: [jsxs(Typography, { variant: "body2", fontWeight: 500, children: ["Step ", current, " of ", total] }), jsxs(Typography, { variant: "body2", fontWeight: 500, children: [Math.round(percentage), "%"] })] })), jsx(StyledLinearProgress, { variant: "determinate", value: percentage })] }));
20
+ };
21
+ const StepNumber = styled(Box)(({ theme, isActive, isCompleted }) => ({
22
+ width: 40,
23
+ height: 40,
24
+ borderRadius: '50%',
25
+ display: 'flex',
26
+ alignItems: 'center',
27
+ justifyContent: 'center',
28
+ fontWeight: 600,
29
+ fontSize: '0.875rem',
30
+ transition: 'all 0.2s',
31
+ backgroundColor: isCompleted || isActive
32
+ ? theme.palette.primary.main
33
+ : `${theme.palette.dark.main}1A`,
34
+ color: isCompleted || isActive
35
+ ? (theme.palette.custom?.stepIndicatorTextColor || theme.palette.dark.main)
36
+ : `${theme.palette.dark.main}99`,
37
+ boxShadow: isActive ? `0 0 0 4px ${theme.palette.primary.main}33` : 'none',
38
+ [theme.breakpoints.down('sm')]: {
39
+ width: 32,
40
+ height: 32,
41
+ fontSize: '0.75rem',
42
+ },
43
+ }));
44
+ const StepLine = styled(Box)(({ theme, isCompleted }) => ({
45
+ flex: 1,
46
+ height: 4,
47
+ borderRadius: 2,
48
+ margin: '0 8px',
49
+ minWidth: '1rem',
50
+ transition: 'background-color 0.2s',
51
+ backgroundColor: isCompleted ? theme.palette.primary.main : `${theme.palette.dark.main}1A`,
52
+ [theme.breakpoints.down('sm')]: {
53
+ height: 2,
54
+ margin: '0 4px',
55
+ },
56
+ }));
57
+ const StepIndicator = ({ steps, currentStep, className = '' }) => {
58
+ const { theme } = useTheme();
59
+ return (jsx(Box, { className: className, sx: {
60
+ display: 'flex',
61
+ alignItems: 'center',
62
+ justifyContent: 'space-between',
63
+ overflowX: 'auto',
64
+ pb: 1,
65
+ }, children: steps.map((step, index) => {
66
+ const stepNumber = index + 1;
67
+ const isActive = stepNumber === currentStep;
68
+ const isCompleted = stepNumber < currentStep;
69
+ return (jsxs(React__default.Fragment, { children: [jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', alignItems: 'center', flexShrink: 0 }, children: [jsx(StepNumber, { isActive: isActive, isCompleted: isCompleted, children: stepNumber }), jsx(Typography, { sx: {
70
+ mt: { xs: 0.5, sm: 1 },
71
+ fontSize: { xs: '10px', sm: '12px' },
72
+ fontWeight: 500,
73
+ whiteSpace: 'nowrap',
74
+ color: isActive ? theme.palette.primary.main : `${theme.palette.dark.main}99`,
75
+ }, children: step })] }), index < steps.length - 1 && (jsx(StepLine, { isCompleted: isCompleted }))] }, index));
76
+ }) }));
77
+ };
78
+
79
+ export { Progress, StepIndicator };
80
+ //# sourceMappingURL=Progress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Progress.js","sources":["../../../../src/components/Progress.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { Box, Typography, LinearProgress, styled } from '@mui/material';\nimport { useTheme } from '../ThemeProvider';\n\ninterface ProgressProps {\n current: number;\n total: number;\n showLabel?: boolean;\n className?: string;\n}\n\nconst StyledLinearProgress = styled(LinearProgress)(({ theme }) => ({\n height: 10,\n borderRadius: 9999,\n backgroundColor: `${theme.palette.dark.main}1A`,\n '& .MuiLinearProgress-bar': {\n borderRadius: 9999,\n backgroundColor: theme.palette.primary.main,\n transition: 'transform 0.3s ease-out',\n },\n}));\n\nexport const Progress: React.FC<ProgressProps> = ({\n current,\n total,\n showLabel = true,\n className = ''\n}) => {\n const percentage = Math.min(Math.max((current / total) * 100, 0), 100);\n\n return (\n <Box className={className}>\n {showLabel && (\n <Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 1 }}>\n <Typography variant=\"body2\" fontWeight={500}>\n Step {current} of {total}\n </Typography>\n <Typography variant=\"body2\" fontWeight={500}>\n {Math.round(percentage)}%\n </Typography>\n </Box>\n )}\n <StyledLinearProgress variant=\"determinate\" value={percentage} />\n </Box>\n );\n};\n\ninterface StepIndicatorProps {\n steps: string[];\n currentStep: number;\n className?: string;\n}\n\nconst StepNumber = styled(Box)<{ isActive: boolean; isCompleted: boolean }>(\n ({ theme, isActive, isCompleted }) => ({\n width: 40,\n height: 40,\n borderRadius: '50%',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n fontWeight: 600,\n fontSize: '0.875rem',\n transition: 'all 0.2s',\n backgroundColor: isCompleted || isActive \n ? theme.palette.primary.main \n : `${theme.palette.dark.main}1A`,\n color: isCompleted || isActive \n ? (theme.palette.custom?.stepIndicatorTextColor || theme.palette.dark.main)\n : `${theme.palette.dark.main}99`,\n boxShadow: isActive ? `0 0 0 4px ${theme.palette.primary.main}33` : 'none',\n [theme.breakpoints.down('sm')]: {\n width: 32,\n height: 32,\n fontSize: '0.75rem',\n },\n })\n);\n\nconst StepLine = styled(Box)<{ isCompleted: boolean }>(({ theme, isCompleted }) => ({\n flex: 1,\n height: 4,\n borderRadius: 2,\n margin: '0 8px',\n minWidth: '1rem',\n transition: 'background-color 0.2s',\n backgroundColor: isCompleted ? theme.palette.primary.main : `${theme.palette.dark.main}1A`,\n [theme.breakpoints.down('sm')]: {\n height: 2,\n margin: '0 4px',\n },\n}));\n\nexport const StepIndicator: React.FC<StepIndicatorProps> = ({\n steps,\n currentStep,\n className = ''\n}) => {\n const { theme } = useTheme();\n\n return (\n <Box \n className={className}\n sx={{ \n display: 'flex', \n alignItems: 'center', \n justifyContent: 'space-between',\n overflowX: 'auto',\n pb: 1,\n }}\n >\n {steps.map((step, index) => {\n const stepNumber = index + 1;\n const isActive = stepNumber === currentStep;\n const isCompleted = stepNumber < currentStep;\n\n return (\n <React.Fragment key={index}>\n <Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center', flexShrink: 0 }}>\n <StepNumber isActive={isActive} isCompleted={isCompleted}>\n {stepNumber}\n </StepNumber>\n <Typography\n sx={{\n mt: { xs: 0.5, sm: 1 },\n fontSize: { xs: '10px', sm: '12px' },\n fontWeight: 500,\n whiteSpace: 'nowrap',\n color: isActive ? theme.palette.primary.main : `${theme.palette.dark.main}99`,\n }}\n >\n {step}\n </Typography>\n </Box>\n {index < steps.length - 1 && (\n <StepLine isCompleted={isCompleted} />\n )}\n </React.Fragment>\n );\n })}\n </Box>\n );\n};"],"names":[],"mappings":";;;;;;AAaA;AACE;AACA;;AAEA;AACE;AACA;AACA;AACD;AACF;AAEM;;AAQL;AAeF;AAQA;AAEI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEE;;;AAGA;;AAEF;;AAEE;AACA;AACA;AACD;AACF;AAGH;AACE;AACA;AACA;AACA;AACA;AACA;;;AAGE;AACA;AACD;AACF;AAEM;AAKL;;AAMM;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;;;;AAYU;AACA;;;;AAelB;;"}
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ interface RadioProps extends React.InputHTMLAttributes<HTMLInputElement> {
3
+ label: string;
4
+ description?: string;
5
+ }
6
+ export declare const Radio: React.FC<RadioProps>;
7
+ interface RadioGroupProps {
8
+ label?: string;
9
+ error?: string;
10
+ children: React.ReactNode;
11
+ className?: string;
12
+ }
13
+ export declare const RadioGroup: React.FC<RadioGroupProps>;
14
+ export {};
@@ -0,0 +1,58 @@
1
+ "use client";
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { styled, FormControlLabel, Box, Typography, FormControl, FormLabel, FormHelperText } from '@mui/material';
4
+ import { useTheme } from '../ThemeProvider.js';
5
+
6
+ const CustomRadioIcon = styled('span')(({ theme, checked }) => ({
7
+ width: 20,
8
+ height: 20,
9
+ borderRadius: '50%',
10
+ border: checked ? `5px solid ${theme.palette.secondary.main}` : `2px solid ${theme.palette.dark.main}4D`,
11
+ transition: 'all 0.2s',
12
+ backgroundColor: 'transparent',
13
+ display: 'flex',
14
+ alignItems: 'center',
15
+ justifyContent: 'center',
16
+ }));
17
+ const Radio = ({ label, description, className = '', id, checked, ...props }) => {
18
+ const radioId = id || `radio-${Math.random().toString(36).substr(2, 9)}`;
19
+ const { theme } = useTheme();
20
+ return (jsx(FormControlLabel, { className: className, control: jsxs(Box, { sx: { display: 'flex', alignItems: 'center', height: 24, mr: 1.5 }, children: [jsx("input", { id: radioId, type: "radio", style: { display: 'none' }, checked: checked, ...props }), jsx(CustomRadioIcon, { checked: checked, onClick: (e) => {
21
+ const input = document.getElementById(radioId);
22
+ if (input && !props.disabled) {
23
+ input.click();
24
+ }
25
+ }, sx: {
26
+ cursor: props.disabled ? 'not-allowed' : 'pointer',
27
+ opacity: props.disabled ? 0.5 : 1,
28
+ } })] }), label: jsxs(Box, { sx: { ml: 0 }, children: [jsx(Typography, { component: "label", htmlFor: radioId, sx: {
29
+ fontSize: '1rem',
30
+ fontWeight: 500,
31
+ color: theme.palette.dark.main,
32
+ cursor: props.disabled ? 'not-allowed' : 'pointer',
33
+ opacity: props.disabled ? 0.5 : 1,
34
+ }, children: label }), description && (jsx(Typography, { variant: "body2", sx: {
35
+ fontSize: '0.875rem',
36
+ color: `${theme.palette.dark.main}99`,
37
+ mt: 0.25,
38
+ }, children: description }))] }), sx: { alignItems: 'flex-start', ml: 0 } }));
39
+ };
40
+ const RadioGroup = ({ label, error, children, className = '' }) => {
41
+ const { theme } = useTheme();
42
+ return (jsxs(FormControl, { component: "fieldset", className: className, error: !!error, fullWidth: true, children: [label && (jsx(FormLabel, { component: "legend", sx: {
43
+ fontSize: '0.875rem',
44
+ fontWeight: 500,
45
+ color: theme.palette.dark.main,
46
+ mb: 1.5,
47
+ '&.Mui-focused': {
48
+ color: theme.palette.dark.main,
49
+ },
50
+ }, children: label })), jsx(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 1.5 }, children: children }), error && (jsx(FormHelperText, { sx: {
51
+ mt: 1,
52
+ fontSize: '0.875rem',
53
+ color: theme.palette.accent.main,
54
+ }, children: error }))] }));
55
+ };
56
+
57
+ export { Radio, RadioGroup };
58
+ //# sourceMappingURL=Radio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Radio.js","sources":["../../../../src/components/Radio.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { Box, FormControl, FormLabel, FormHelperText, FormControlLabel, styled, Typography } from '@mui/material';\nimport { useTheme } from '../ThemeProvider';\n\ninterface RadioProps extends React.InputHTMLAttributes<HTMLInputElement> {\n label: string;\n description?: string;\n}\n\nconst CustomRadioIcon = styled('span')<{ checked?: boolean }>(({ theme, checked }) => ({\n width: 20,\n height: 20,\n borderRadius: '50%',\n border: checked ? `5px solid ${theme.palette.secondary.main}` : `2px solid ${theme.palette.dark.main}4D`,\n transition: 'all 0.2s',\n backgroundColor: 'transparent',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n}));\n\nexport const Radio: React.FC<RadioProps> = ({\n label,\n description,\n className = '',\n id,\n checked,\n ...props\n}) => {\n const radioId = id || `radio-${Math.random().toString(36).substr(2, 9)}`;\n const { theme } = useTheme();\n\n return (\n <FormControlLabel\n className={className}\n control={\n <Box sx={{ display: 'flex', alignItems: 'center', height: 24, mr: 1.5 }}>\n <input\n id={radioId}\n type=\"radio\"\n style={{ display: 'none' }}\n checked={checked}\n {...props}\n />\n <CustomRadioIcon \n checked={checked}\n onClick={(e) => {\n const input = document.getElementById(radioId) as HTMLInputElement;\n if (input && !props.disabled) {\n input.click();\n }\n }}\n sx={{\n cursor: props.disabled ? 'not-allowed' : 'pointer',\n opacity: props.disabled ? 0.5 : 1,\n }}\n />\n </Box>\n }\n label={\n <Box sx={{ ml: 0 }}>\n <Typography\n component=\"label\"\n htmlFor={radioId}\n sx={{\n fontSize: '1rem',\n fontWeight: 500,\n color: theme.palette.dark.main,\n cursor: props.disabled ? 'not-allowed' : 'pointer',\n opacity: props.disabled ? 0.5 : 1,\n }}\n >\n {label}\n </Typography>\n {description && (\n <Typography\n variant=\"body2\"\n sx={{\n fontSize: '0.875rem',\n color: `${theme.palette.dark.main}99`,\n mt: 0.25,\n }}\n >\n {description}\n </Typography>\n )}\n </Box>\n }\n sx={{ alignItems: 'flex-start', ml: 0 }}\n />\n );\n};\n\ninterface RadioGroupProps {\n label?: string;\n error?: string;\n children: React.ReactNode;\n className?: string;\n}\n\nexport const RadioGroup: React.FC<RadioGroupProps> = ({\n label,\n error,\n children,\n className = ''\n}) => {\n const { theme } = useTheme();\n\n return (\n <FormControl component=\"fieldset\" className={className} error={!!error} fullWidth>\n {label && (\n <FormLabel\n component=\"legend\"\n sx={{\n fontSize: '0.875rem',\n fontWeight: 500,\n color: theme.palette.dark.main,\n mb: 1.5,\n '&.Mui-focused': {\n color: theme.palette.dark.main,\n },\n }}\n >\n {label}\n </FormLabel>\n )}\n <Box sx={{ display: 'flex', flexDirection: 'column', gap: 1.5 }}>\n {children}\n </Box>\n {error && (\n <FormHelperText\n sx={{\n mt: 1,\n fontSize: '0.875rem',\n color: theme.palette.accent.main,\n }}\n >\n {error}\n </FormHelperText>\n )}\n </FormControl>\n );\n};"],"names":[],"mappings":";;;;;AAWA;AACE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACD;;;AAWC;AAEA;;AAgBY;;;;;;;AAiBA;AACA;AACA;;;AAGD;AAQG;;AAEA;AACD;AAUf;AASO;AAML;AAEA;AAMU;AACA;AACA;AACA;AACA;AACE;AACD;AACF;AAWC;AACA;AACA;AACD;AAOX;;"}
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface ReadByProps {
3
+ names: string[];
4
+ }
5
+ export declare const ReadBy: React.FC<ReadByProps>;
6
+ export {};
@@ -0,0 +1,56 @@
1
+ "use client";
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { useState } from 'react';
4
+ import { styled, Box, IconButton, Typography } from '@mui/material';
5
+ import { useTheme } from '../ThemeProvider.js';
6
+ import { ExpandLessRounded, ExpandMoreRounded } from '@mui/icons-material';
7
+
8
+ const ReadByContainer = styled(Box)(({ theme }) => ({
9
+ display: 'flex',
10
+ flexDirection: 'row',
11
+ alignItems: 'flex-start',
12
+ gap: theme.spacing(2),
13
+ padding: theme.spacing(2),
14
+ borderLeft: `4px solid ${theme.palette.primary.main}`,
15
+ borderRadius: '0 8px 8px 0',
16
+ backgroundColor: theme.palette.custom?.readByBackgroundColor || theme.palette.accent.main,
17
+ [theme.breakpoints.down('sm')]: {
18
+ flexDirection: 'column',
19
+ padding: theme.spacing(1.5),
20
+ },
21
+ }));
22
+ const ExpandButton = styled(IconButton)(({ theme }) => ({
23
+ width: 32,
24
+ height: 32,
25
+ backgroundColor: '#4d3019',
26
+ color: '#fff',
27
+ flexShrink: 0,
28
+ '&:hover': {
29
+ backgroundColor: '#4d3019',
30
+ opacity: 0.8,
31
+ },
32
+ [theme.breakpoints.down('sm')]: {
33
+ alignSelf: 'flex-end',
34
+ },
35
+ }));
36
+ const ReadBy = ({ names }) => {
37
+ const { theme } = useTheme();
38
+ const [isExpanded, setIsExpanded] = useState(false);
39
+ const displayText = isExpanded
40
+ ? names.join(', ')
41
+ : names.length > 5
42
+ ? `${names.slice(0, 5).join(', ')}...`
43
+ : names.join(', ');
44
+ return (jsxs(ReadByContainer, { children: [jsxs(Box, { sx: { flex: 1, minWidth: 0, wordBreak: 'break-word' }, children: [jsx(Typography, { component: "span", sx: {
45
+ fontSize: { xs: '13px', sm: '14px' },
46
+ fontWeight: 700,
47
+ color: theme.palette.dark.main,
48
+ }, children: "Read by:" }), jsx(Typography, { component: "span", sx: {
49
+ fontSize: { xs: '13px', sm: '14px' },
50
+ color: theme.palette.dark.main,
51
+ ml: 1,
52
+ }, children: displayText })] }), names.length > 5 && (jsx(ExpandButton, { onClick: () => setIsExpanded(!isExpanded), "aria-label": isExpanded ? 'Collapse' : 'Expand', size: "small", children: isExpanded ? (jsx(ExpandLessRounded, { sx: { fontSize: 16 } })) : (jsx(ExpandMoreRounded, { sx: { fontSize: 16 } })) }))] }));
53
+ };
54
+
55
+ export { ReadBy };
56
+ //# sourceMappingURL=ReadBy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReadBy.js","sources":["../../../../src/components/ReadBy.tsx"],"sourcesContent":["'use client';\n\nimport React, { useState } from 'react';\nimport { Box, IconButton, Typography, styled } from '@mui/material';\nimport { useTheme } from '../ThemeProvider';\nimport { ExpandLessRounded, ExpandMoreRounded } from '@mui/icons-material';\n\ninterface ReadByProps {\n names: string[];\n}\n\nconst ReadByContainer = styled(Box)(({ theme }) => ({\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'flex-start',\n gap: theme.spacing(2),\n padding: theme.spacing(2),\n borderLeft: `4px solid ${theme.palette.primary.main}`,\n borderRadius: '0 8px 8px 0',\n backgroundColor: theme.palette.custom?.readByBackgroundColor || theme.palette.accent.main,\n [theme.breakpoints.down('sm')]: {\n flexDirection: 'column',\n padding: theme.spacing(1.5),\n },\n}));\n\nconst ExpandButton = styled(IconButton)(({ theme }) => ({\n width: 32,\n height: 32,\n backgroundColor: '#4d3019',\n color: '#fff',\n flexShrink: 0,\n '&:hover': {\n backgroundColor: '#4d3019',\n opacity: 0.8,\n },\n [theme.breakpoints.down('sm')]: {\n alignSelf: 'flex-end',\n },\n}));\n\nexport const ReadBy: React.FC<ReadByProps> = ({ names }) => {\n const { theme } = useTheme();\n const [isExpanded, setIsExpanded] = useState(false);\n\n const displayText = isExpanded\n ? names.join(', ')\n : names.length > 5\n ? `${names.slice(0, 5).join(', ')}...`\n : names.join(', ');\n\n return (\n <ReadByContainer>\n <Box sx={{ flex: 1, minWidth: 0, wordBreak: 'break-word' }}>\n <Typography\n component=\"span\"\n sx={{\n fontSize: { xs: '13px', sm: '14px' },\n fontWeight: 700,\n color: theme.palette.dark.main,\n }}\n >\n Read by:\n </Typography>\n <Typography\n component=\"span\"\n sx={{\n fontSize: { xs: '13px', sm: '14px' },\n color: theme.palette.dark.main,\n ml: 1,\n }}\n >\n {displayText}\n </Typography>\n </Box>\n {names.length > 5 && (\n <ExpandButton\n onClick={() => setIsExpanded(!isExpanded)}\n aria-label={isExpanded ? 'Collapse' : 'Expand'}\n size=\"small\"\n >\n {isExpanded ? (\n <ExpandLessRounded sx={{fontSize: 16}} />\n ) : (\n <ExpandMoreRounded sx={{fontSize: 16}} />\n )}\n </ExpandButton>\n )}\n </ReadByContainer>\n );\n};"],"names":[],"mappings":";;;;;;;AAWA;AACE;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEE;AACA;AACD;AACF;AAED;AACE;AACA;AACA;AACA;AACA;AACA;AACE;AACA;AACD;;AAEC;AACD;AACF;;AAGC;;;AAIE;AACA;AACE;AACA;AAEJ;;AAOU;AACA;;;AASA;AACA;AACD;AAoBX;;"}
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ interface SelectProps {
3
+ label?: string;
4
+ error?: string;
5
+ helperText?: string;
6
+ fullWidth?: boolean;
7
+ options: {
8
+ value: string;
9
+ label: string;
10
+ }[];
11
+ value?: string;
12
+ onChange?: (event: React.ChangeEvent<HTMLSelectElement>) => void;
13
+ disabled?: boolean;
14
+ className?: string;
15
+ id?: string;
16
+ name?: string;
17
+ }
18
+ export declare const Select: React.FC<SelectProps>;
19
+ export {};
@@ -0,0 +1,94 @@
1
+ "use client";
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { styled, Select as Select$1, InputLabel, FormControl, MenuItem, FormHelperText } from '@mui/material';
4
+ import { useTheme } from '../ThemeProvider.js';
5
+ import { ExpandMoreRounded } from '@mui/icons-material';
6
+
7
+ const StyledSelect = styled(Select$1)(({ theme, error }) => ({
8
+ backgroundColor: theme.palette.light.main,
9
+ borderRadius: (typeof theme.shape.borderRadius === 'string'
10
+ ? parseInt(theme.shape.borderRadius, 10)
11
+ : theme.shape.borderRadius || 4) * 2,
12
+ fontSize: '1rem',
13
+ color: theme.palette.dark.main,
14
+ '& .MuiOutlinedInput-notchedOutline': {
15
+ borderColor: error ? theme.palette.accent.main : `${theme.palette.dark.main}33`,
16
+ },
17
+ '&:hover .MuiOutlinedInput-notchedOutline': {
18
+ borderColor: error ? theme.palette.accent.main : theme.palette.primary.main,
19
+ },
20
+ '&.Mui-focused .MuiOutlinedInput-notchedOutline': {
21
+ borderWidth: 2,
22
+ borderColor: error ? theme.palette.accent.main : theme.palette.primary.main,
23
+ },
24
+ '&.Mui-disabled': {
25
+ backgroundColor: `${theme.palette.dark.main}0D`,
26
+ '& .MuiSelect-select': {
27
+ color: `${theme.palette.dark.main}80`,
28
+ cursor: 'not-allowed',
29
+ },
30
+ },
31
+ '& .MuiSelect-icon': {
32
+ color: `${theme.palette.dark.main}66`,
33
+ },
34
+ }));
35
+ const StyledInputLabel = styled(InputLabel)(({ theme }) => ({
36
+ fontSize: '0.875rem',
37
+ fontWeight: 500,
38
+ color: theme.palette.dark.main,
39
+ position: 'relative',
40
+ transform: 'none',
41
+ marginBottom: theme.spacing(0.75),
42
+ '&.Mui-focused': {
43
+ color: theme.palette.dark.main,
44
+ },
45
+ }));
46
+ const Select = ({ label, error, helperText, fullWidth = false, options, className = '', id, value, onChange, disabled, name, }) => {
47
+ const { theme } = useTheme();
48
+ const selectId = id || `select-${Math.random().toString(36).substr(2, 9)}`;
49
+ const handleChange = (event) => {
50
+ if (onChange) {
51
+ // Create a synthetic event that matches React.ChangeEvent<HTMLSelectElement>
52
+ const syntheticEvent = {
53
+ target: {
54
+ value: event.target.value,
55
+ name: name || '',
56
+ },
57
+ currentTarget: event.currentTarget,
58
+ };
59
+ onChange(syntheticEvent);
60
+ }
61
+ };
62
+ return (jsxs(FormControl, { fullWidth: fullWidth, error: !!error, className: className, children: [label && (jsx(StyledInputLabel, { htmlFor: selectId, shrink: false, children: label })), jsx(StyledSelect, { id: selectId, name: name, value: value || '', onChange: handleChange, disabled: disabled, error: !!error, IconComponent: ExpandMoreRounded, MenuProps: {
63
+ PaperProps: {
64
+ sx: {
65
+ mt: 1,
66
+ borderRadius: 2,
67
+ boxShadow: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)',
68
+ },
69
+ },
70
+ }, children: options.map((option) => (jsx(MenuItem, { value: option.value, sx: {
71
+ fontSize: '1rem',
72
+ color: theme.palette.dark.main,
73
+ '&:hover': {
74
+ backgroundColor: `${theme.palette.primary.main}1A`,
75
+ },
76
+ '&.Mui-selected': {
77
+ backgroundColor: `${theme.palette.primary.main}26`,
78
+ '&:hover': {
79
+ backgroundColor: `${theme.palette.primary.main}33`,
80
+ },
81
+ },
82
+ }, children: option.label }, option.value))) }), error && (jsx(FormHelperText, { sx: {
83
+ mt: 0.75,
84
+ fontSize: '0.875rem',
85
+ color: theme.palette.accent.main,
86
+ }, children: error })), helperText && !error && (jsx(FormHelperText, { sx: {
87
+ mt: 0.75,
88
+ fontSize: '0.875rem',
89
+ color: `${theme.palette.dark.main}99`,
90
+ }, children: helperText }))] }));
91
+ };
92
+
93
+ export { Select };
94
+ //# sourceMappingURL=Select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Select.js","sources":["../../../../src/components/Select.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { FormControl, InputLabel, Select as MuiSelect, MenuItem, FormHelperText, styled } from '@mui/material';\nimport { useTheme } from '../ThemeProvider';\nimport { ExpandMoreRounded } from '@mui/icons-material';\n\ninterface SelectProps {\n label?: string;\n error?: string;\n helperText?: string;\n fullWidth?: boolean;\n options: { value: string; label: string }[];\n value?: string;\n onChange?: (event: React.ChangeEvent<HTMLSelectElement>) => void;\n disabled?: boolean;\n className?: string;\n id?: string;\n name?: string;\n}\n\nconst StyledSelect = styled(MuiSelect)(({ theme, error }) => ({\n backgroundColor: theme.palette.light.main,\n borderRadius: (typeof theme.shape.borderRadius === 'string'\n ? parseInt(theme.shape.borderRadius, 10)\n : theme.shape.borderRadius || 4) * 2,\n fontSize: '1rem',\n color: theme.palette.dark.main,\n '& .MuiOutlinedInput-notchedOutline': {\n borderColor: error ? theme.palette.accent.main : `${theme.palette.dark.main}33`,\n },\n '&:hover .MuiOutlinedInput-notchedOutline': {\n borderColor: error ? theme.palette.accent.main : theme.palette.primary.main,\n },\n '&.Mui-focused .MuiOutlinedInput-notchedOutline': {\n borderWidth: 2,\n borderColor: error ? theme.palette.accent.main : theme.palette.primary.main,\n },\n '&.Mui-disabled': {\n backgroundColor: `${theme.palette.dark.main}0D`,\n '& .MuiSelect-select': {\n color: `${theme.palette.dark.main}80`,\n cursor: 'not-allowed',\n },\n },\n '& .MuiSelect-icon': {\n color: `${theme.palette.dark.main}66`,\n },\n}));\n\nconst StyledInputLabel = styled(InputLabel)(({ theme }) => ({\n fontSize: '0.875rem',\n fontWeight: 500,\n color: theme.palette.dark.main,\n position: 'relative',\n transform: 'none',\n marginBottom: theme.spacing(0.75),\n '&.Mui-focused': {\n color: theme.palette.dark.main,\n },\n}));\n\nexport const Select: React.FC<SelectProps> = ({\n label,\n error,\n helperText,\n fullWidth = false,\n options,\n className = '',\n id,\n value,\n onChange,\n disabled,\n name,\n}) => {\n const { theme } = useTheme();\n const selectId = id || `select-${Math.random().toString(36).substr(2, 9)}`;\n\n const handleChange = (event: any) => {\n if (onChange) {\n // Create a synthetic event that matches React.ChangeEvent<HTMLSelectElement>\n const syntheticEvent = {\n target: {\n value: event.target.value,\n name: name || '',\n },\n currentTarget: event.currentTarget,\n } as React.ChangeEvent<HTMLSelectElement>;\n onChange(syntheticEvent);\n }\n };\n\n return (\n <FormControl \n fullWidth={fullWidth} \n error={!!error}\n className={className}\n >\n {label && (\n <StyledInputLabel htmlFor={selectId} shrink={false}>\n {label}\n </StyledInputLabel>\n )}\n <StyledSelect\n id={selectId}\n name={name}\n value={value || ''}\n onChange={handleChange}\n disabled={disabled}\n error={!!error}\n IconComponent={ExpandMoreRounded}\n MenuProps={{\n PaperProps: {\n sx: {\n mt: 1,\n borderRadius: 2,\n boxShadow: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)',\n },\n },\n }}\n >\n {options.map((option) => (\n <MenuItem \n key={option.value} \n value={option.value}\n sx={{\n fontSize: '1rem',\n color: theme.palette.dark.main,\n '&:hover': {\n backgroundColor: `${theme.palette.primary.main}1A`,\n },\n '&.Mui-selected': {\n backgroundColor: `${theme.palette.primary.main}26`,\n '&:hover': {\n backgroundColor: `${theme.palette.primary.main}33`,\n },\n },\n }}\n >\n {option.label}\n </MenuItem>\n ))}\n </StyledSelect>\n {error && (\n <FormHelperText\n sx={{\n mt: 0.75,\n fontSize: '0.875rem',\n color: theme.palette.accent.main,\n }}\n >\n {error}\n </FormHelperText>\n )}\n {helperText && !error && (\n <FormHelperText\n sx={{\n mt: 0.75,\n fontSize: '0.875rem',\n color: `${theme.palette.dark.main}99`,\n }}\n >\n {helperText}\n </FormHelperText>\n )}\n </FormControl>\n );\n};"],"names":[],"mappings":";;;;;;AAqBA;AACE;;;;AAIA;AACA;AACA;;AAEC;AACD;;AAEC;AACD;AACE;;AAED;AACD;;AAEE;;AAEE;AACD;AACF;AACD;;AAEC;AACF;AAED;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACE;AACD;AACF;AAEM;AAaL;;AAGA;;;AAGI;AACE;AACE;;AAED;;;;;AAKP;AAEA;AAoBQ;AACE;AACE;AACA;AACA;AACD;AACF;;AAQG;AACA;AACA;;AAEC;AACD;;AAEE;;AAEC;AACF;AACF;AASD;AACA;AACA;AACD;AAQC;AACA;;AAED;AAOX;;"}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ interface SidebarProps {
3
+ isOpen: boolean;
4
+ onToggle: () => void;
5
+ centreName?: string;
6
+ activePage?: string;
7
+ onPageChange?: (pageId: string) => void;
8
+ }
9
+ export declare const Sidebar: React.FC<SidebarProps>;
10
+ export {};
@@ -0,0 +1,204 @@
1
+ "use client";
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import { useState } from 'react';
4
+ import { styled, Box, IconButton, ListItemButton, Typography, List, ListItemText, Collapse } from '@mui/material';
5
+ import { useTheme } from '../ThemeProvider.js';
6
+ import { HomeRounded, TextSnippetRounded, HelpOutlineRounded, ChevronLeftRounded, ChevronRightRounded, ExpandLessRounded, ExpandMoreRounded } from '@mui/icons-material';
7
+
8
+ const SidebarContainer = styled(Box)(({ theme, isOpen }) => ({
9
+ height: '100vh',
10
+ position: 'sticky',
11
+ top: 0,
12
+ backgroundColor: '#fff',
13
+ borderRight: `1px solid ${theme.palette.dark.main}1A`,
14
+ flexShrink: 0,
15
+ transition: 'all 0.3s ease-in-out',
16
+ width: isOpen ? '288px' : '64px',
17
+ zIndex: 50,
18
+ [theme.breakpoints.down('md')]: {
19
+ position: 'fixed',
20
+ left: isOpen ? 0 : '-288px',
21
+ width: '288px',
22
+ },
23
+ [theme.breakpoints.up('sm')]: {
24
+ width: isOpen ? '288px' : '80px',
25
+ },
26
+ }));
27
+ const ToggleButton = styled(IconButton)(({ theme }) => ({
28
+ width: 40,
29
+ height: 40,
30
+ borderRadius: theme.shape.borderRadius,
31
+ backgroundColor: '#4D3019',
32
+ color: '#fff',
33
+ '&:hover': {
34
+ backgroundColor: '#3d2614',
35
+ },
36
+ }));
37
+ const MenuItemButton = styled(ListItemButton)(({ theme, isActive, isOpen }) => ({
38
+ borderRadius: theme.shape.borderRadius,
39
+ padding: isOpen ? '10px 8px' : '12px 0',
40
+ justifyContent: isOpen ? 'flex-start' : 'center',
41
+ gap: isOpen ? theme.spacing(1) : 0,
42
+ '&:hover': {
43
+ backgroundColor: `${theme.palette.dark.main}0D`,
44
+ },
45
+ ...(isActive && {
46
+ backgroundColor: `${theme.palette.dark.main}1A`,
47
+ }),
48
+ }));
49
+ const IconWrapper = styled(Box)(({ theme, isOpen }) => ({
50
+ width: isOpen ? 32 : 40,
51
+ height: isOpen ? 32 : 40,
52
+ borderRadius: theme.shape.borderRadius,
53
+ display: 'flex',
54
+ alignItems: 'center',
55
+ justifyContent: 'center',
56
+ flexShrink: 0,
57
+ backgroundColor: theme.palette.custom?.iconColor || theme.palette.accent.main,
58
+ }));
59
+ const Sidebar = ({ isOpen, onToggle, centreName = "Centre name goes here \n across two lines", activePage = 'dashboard', onPageChange }) => {
60
+ const { theme } = useTheme();
61
+ const [expandedItems, setExpandedItems] = useState([]);
62
+ const [expandedSubItems, setExpandedSubItems] = useState([]);
63
+ const handlePageClick = (pageId) => {
64
+ if (onPageChange) {
65
+ onPageChange(pageId);
66
+ }
67
+ };
68
+ const menuItems = [
69
+ {
70
+ id: 'dashboard',
71
+ label: 'Dashboard',
72
+ icon: jsx(HomeRounded, { sx: { fontSize: 20, color: "#4D3019" } }),
73
+ },
74
+ {
75
+ id: 'policies',
76
+ label: 'Policies',
77
+ icon: jsx(TextSnippetRounded, { sx: { fontSize: 20, color: "#4D3019" } }),
78
+ hasChildren: true,
79
+ children: [
80
+ { id: 'legislation', label: 'Legislation' },
81
+ { id: 'service-assurances', label: 'Service Assurances / Compliance Checklist' },
82
+ {
83
+ id: 'governance',
84
+ label: 'Governance, Management, and Administration',
85
+ hasChildren: true,
86
+ children: [
87
+ 'Philosophy and Values',
88
+ 'Te Tiriti o Waitangi – policy options',
89
+ 'Self-Review and Internal Evaluation',
90
+ ],
91
+ },
92
+ {
93
+ id: 'curriculum',
94
+ label: 'Curriculum and Learning V1',
95
+ hasChildren: true,
96
+ children: [],
97
+ },
98
+ ],
99
+ },
100
+ {
101
+ id: 'support',
102
+ label: 'Support',
103
+ icon: jsx(HelpOutlineRounded, { sx: { fontSize: 20, color: "#4D3019" } }),
104
+ },
105
+ ];
106
+ const toggleItem = (itemId) => {
107
+ if (!isOpen) {
108
+ onToggle();
109
+ setExpandedItems([itemId]);
110
+ }
111
+ else {
112
+ setExpandedItems((prev) => prev.includes(itemId) ? prev.filter((id) => id !== itemId) : [...prev, itemId]);
113
+ }
114
+ };
115
+ const toggleSubItem = (subItemId) => {
116
+ setExpandedSubItems((prev) => prev.includes(subItemId) ? prev.filter((id) => id !== subItemId) : [...prev, subItemId]);
117
+ };
118
+ return (jsxs(Fragment, { children: [isOpen && (jsx(Box, { sx: {
119
+ position: 'fixed',
120
+ inset: 0,
121
+ bgcolor: 'rgba(0, 0, 0, 0.5)',
122
+ zIndex: 40,
123
+ display: { xs: 'block', md: 'none' },
124
+ }, onClick: onToggle })), jsx(SidebarContainer, { isOpen: isOpen, children: jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', height: '100%' }, children: [isOpen && (jsxs(Box, { sx: {
125
+ px: 2,
126
+ py: 3,
127
+ borderBottom: `1px solid ${theme.palette.dark.main}1A`,
128
+ flexShrink: 0,
129
+ position: 'relative',
130
+ }, children: [jsx(Typography, { variant: "h6", sx: {
131
+ fontSize: '18px',
132
+ fontWeight: 700,
133
+ color: '#4D3019',
134
+ lineHeight: 1.3,
135
+ whiteSpace: 'pre-line',
136
+ pr: 7,
137
+ }, children: centreName }), jsx(ToggleButton, { onClick: onToggle, sx: { position: 'absolute', top: 24, right: 16 }, "aria-label": "Collapse sidebar", children: jsx(ChevronLeftRounded, { sx: { fontSize: 20 } }) })] })), !isOpen && (jsx(Box, { sx: {
138
+ px: 1,
139
+ py: 3,
140
+ borderBottom: `1px solid ${theme.palette.dark.main}1A`,
141
+ display: 'flex',
142
+ justifyContent: 'center',
143
+ }, children: jsx(ToggleButton, { onClick: onToggle, "aria-label": "Expand sidebar", children: jsx(ChevronRightRounded, { sx: { fontSize: 20 } }) }) })), jsx(Box, { sx: {
144
+ flex: 1,
145
+ overflowY: 'auto',
146
+ px: isOpen ? 1.5 : 1,
147
+ py: 3,
148
+ }, children: jsx(List, { sx: { p: 0 }, children: menuItems.map((item) => (jsxs(Box, { sx: { mb: 1 }, children: [jsxs(MenuItemButton, { isOpen: isOpen, isActive: activePage === item.id, onClick: () => {
149
+ if (item.hasChildren) {
150
+ toggleItem(item.id);
151
+ }
152
+ else {
153
+ if (!isOpen) {
154
+ onToggle();
155
+ }
156
+ handlePageClick(item.id);
157
+ }
158
+ }, title: !isOpen ? item.label : undefined, children: [jsx(IconWrapper, { isOpen: isOpen, children: item.icon }), isOpen && (jsxs(Fragment, { children: [jsx(ListItemText, { primary: item.label, primaryTypographyProps: {
159
+ fontSize: '1rem',
160
+ fontWeight: 600,
161
+ }, sx: { flex: 1 } }), item.hasChildren && (jsx(Box, { children: expandedItems.includes(item.id) ? (jsx(ExpandLessRounded, { sx: { fontSize: 20, color: "#4D3019" } })) : (jsx(ExpandMoreRounded, { sx: { fontSize: 20, color: "#4D3019" } })) }))] }))] }), item.hasChildren && expandedItems.includes(item.id) && item.children && isOpen && (jsx(Collapse, { in: true, timeout: "auto", children: jsx(List, { sx: { p: 0, mt: 0.5 }, children: item.children.map((subItem) => (jsxs(Box, { children: [jsxs(Box, { sx: { display: 'flex', alignItems: 'stretch' }, children: [jsx(ListItemButton, { onClick: () => handlePageClick(subItem.id), sx: {
162
+ flex: 1,
163
+ pl: 8,
164
+ py: 1.25,
165
+ borderRadius: `${theme.shape.borderRadius}px 0 0 ${theme.shape.borderRadius}px`,
166
+ '&:hover': {
167
+ backgroundColor: `${theme.palette.dark.main}0D`,
168
+ },
169
+ ...(activePage === subItem.id && {
170
+ backgroundColor: `${theme.palette.dark.main}1A`,
171
+ }),
172
+ }, children: jsx(ListItemText, { primary: subItem.label, primaryTypographyProps: {
173
+ fontSize: '0.875rem',
174
+ } }) }), subItem.hasChildren && subItem.children && subItem.children.length > 0 && (jsx(IconButton, { onClick: () => toggleSubItem(subItem.id), sx: {
175
+ px: 1,
176
+ borderRadius: `0 ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px 0`,
177
+ '&:hover': {
178
+ backgroundColor: `${theme.palette.dark.main}0D`,
179
+ },
180
+ }, children: jsx(ChevronRightRounded, { sx: {
181
+ fontSize: 16,
182
+ color: '#4D3019',
183
+ transition: 'transform 0.2s',
184
+ transform: expandedSubItems.includes(subItem.id) ? 'rotate(90deg)' : 'rotate(0deg)',
185
+ } }) }))] }), subItem.hasChildren && expandedSubItems.includes(subItem.id) && subItem.children && (jsx(Collapse, { in: true, timeout: "auto", children: jsx(List, { sx: { p: 0, mt: 0.5 }, children: subItem.children.map((nestedItem, index) => {
186
+ const nestedPageId = `${subItem.id}-${index}`;
187
+ return (jsx(ListItemButton, { onClick: () => handlePageClick(nestedPageId), sx: {
188
+ pl: 10,
189
+ py: 1,
190
+ borderRadius: theme.shape.borderRadius,
191
+ '&:hover': {
192
+ backgroundColor: `${theme.palette.dark.main}0D`,
193
+ },
194
+ ...(activePage === nestedPageId && {
195
+ backgroundColor: `${theme.palette.dark.main}1A`,
196
+ }),
197
+ }, children: jsx(ListItemText, { primary: nestedItem, primaryTypographyProps: {
198
+ fontSize: '0.875rem',
199
+ } }) }, index));
200
+ }) }) }))] }, subItem.id))) }) }))] }, item.id))) }) })] }) })] }));
201
+ };
202
+
203
+ export { Sidebar };
204
+ //# sourceMappingURL=Sidebar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sidebar.js","sources":["../../../../src/components/Sidebar.tsx"],"sourcesContent":["'use client';\n\nimport React, { useState } from 'react';\nimport { Box, IconButton, Typography, List, ListItemButton, ListItemText, Collapse, styled } from '@mui/material';\nimport { useTheme } from '../ThemeProvider';\nimport { ChevronLeftRounded, ChevronRightRounded, ExpandLessRounded, ExpandMoreRounded, HelpOutlineRounded, HomeRounded, TextSnippetRounded } from '@mui/icons-material';\n\ninterface SidebarProps {\n isOpen: boolean;\n onToggle: () => void;\n centreName?: string;\n activePage?: string;\n onPageChange?: (pageId: string) => void;\n}\n\ninterface MenuItem {\n id: string;\n label: string;\n icon: React.ReactNode;\n hasChildren?: boolean;\n children?: SubMenuItem[];\n}\n\ninterface SubMenuItem {\n id: string;\n label: string;\n hasChildren?: boolean;\n children?: string[];\n}\n\nconst SidebarContainer = styled(Box)<{ isOpen: boolean }>(({ theme, isOpen }) => ({\n height: '100vh',\n position: 'sticky',\n top: 0,\n backgroundColor: '#fff',\n borderRight: `1px solid ${theme.palette.dark.main}1A`,\n flexShrink: 0,\n transition: 'all 0.3s ease-in-out',\n width: isOpen ? '288px' : '64px',\n zIndex: 50,\n [theme.breakpoints.down('md')]: {\n position: 'fixed',\n left: isOpen ? 0 : '-288px',\n width: '288px',\n },\n [theme.breakpoints.up('sm')]: {\n width: isOpen ? '288px' : '80px',\n },\n}));\n\nconst ToggleButton = styled(IconButton)(({ theme }) => ({\n width: 40,\n height: 40,\n borderRadius: theme.shape.borderRadius,\n backgroundColor: '#4D3019',\n color: '#fff',\n '&:hover': {\n backgroundColor: '#3d2614',\n },\n}));\n\nconst MenuItemButton = styled(ListItemButton)<{ isActive?: boolean; isOpen: boolean }>(({ theme, isActive, isOpen }) => ({\n borderRadius: theme.shape.borderRadius,\n padding: isOpen ? '10px 8px' : '12px 0',\n justifyContent: isOpen ? 'flex-start' : 'center',\n gap: isOpen ? theme.spacing(1) : 0,\n '&:hover': {\n backgroundColor: `${theme.palette.dark.main}0D`,\n },\n ...(isActive && {\n backgroundColor: `${theme.palette.dark.main}1A`,\n }),\n}));\n\nconst IconWrapper = styled(Box)<{ isOpen: boolean }>(({ theme, isOpen }) => ({\n width: isOpen ? 32 : 40,\n height: isOpen ? 32 : 40,\n borderRadius: theme.shape.borderRadius,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n flexShrink: 0,\n backgroundColor: theme.palette.custom?.iconColor || theme.palette.accent.main,\n}));\n\nexport const Sidebar: React.FC<SidebarProps> = ({\n isOpen,\n onToggle,\n centreName = \"Centre name goes here \\n across two lines\",\n activePage = 'dashboard',\n onPageChange\n}) => {\n const { theme } = useTheme();\n const [expandedItems, setExpandedItems] = useState<string[]>([]);\n const [expandedSubItems, setExpandedSubItems] = useState<string[]>([]);\n\n const handlePageClick = (pageId: string) => {\n if (onPageChange) {\n onPageChange(pageId);\n }\n };\n\n const menuItems: MenuItem[] = [\n {\n id: 'dashboard',\n label: 'Dashboard',\n icon: <HomeRounded sx={{fontSize: 20, color:\"#4D3019\"}} />,\n },\n {\n id: 'policies',\n label: 'Policies',\n icon: <TextSnippetRounded sx={{fontSize: 20, color:\"#4D3019\"}} />,\n hasChildren: true,\n children: [\n { id: 'legislation', label: 'Legislation' },\n { id: 'service-assurances', label: 'Service Assurances / Compliance Checklist' },\n {\n id: 'governance',\n label: 'Governance, Management, and Administration',\n hasChildren: true,\n children: [\n 'Philosophy and Values',\n 'Te Tiriti o Waitangi – policy options',\n 'Self-Review and Internal Evaluation',\n ],\n },\n {\n id: 'curriculum',\n label: 'Curriculum and Learning V1',\n hasChildren: true,\n children: [],\n },\n ],\n },\n {\n id: 'support',\n label: 'Support',\n icon: <HelpOutlineRounded sx={{fontSize: 20, color:\"#4D3019\"}} />,\n },\n ];\n\n const toggleItem = (itemId: string) => {\n if (!isOpen) {\n onToggle();\n setExpandedItems([itemId]);\n } else {\n setExpandedItems((prev) =>\n prev.includes(itemId) ? prev.filter((id) => id !== itemId) : [...prev, itemId]\n );\n }\n };\n\n const toggleSubItem = (subItemId: string) => {\n setExpandedSubItems((prev) =>\n prev.includes(subItemId) ? prev.filter((id) => id !== subItemId) : [...prev, subItemId]\n );\n };\n\n return (\n <>\n {isOpen && (\n <Box\n sx={{\n position: 'fixed',\n inset: 0,\n bgcolor: 'rgba(0, 0, 0, 0.5)',\n zIndex: 40,\n display: { xs: 'block', md: 'none' },\n }}\n onClick={onToggle}\n />\n )}\n <SidebarContainer isOpen={isOpen}>\n <Box sx={{ display: 'flex', flexDirection: 'column', height: '100%' }}>\n {isOpen && (\n <Box\n sx={{\n px: 2,\n py: 3,\n borderBottom: `1px solid ${theme.palette.dark.main}1A`,\n flexShrink: 0,\n position: 'relative',\n }}\n >\n <Typography\n variant=\"h6\"\n sx={{\n fontSize: '18px',\n fontWeight: 700,\n color: '#4D3019',\n lineHeight: 1.3,\n whiteSpace: 'pre-line',\n pr: 7,\n }}\n >\n {centreName}\n </Typography>\n\n <ToggleButton\n onClick={onToggle}\n sx={{ position: 'absolute', top: 24, right: 16 }}\n aria-label=\"Collapse sidebar\"\n >\n <ChevronLeftRounded sx={{fontSize: 20}} />\n </ToggleButton>\n </Box>\n )}\n\n {!isOpen && (\n <Box\n sx={{\n px: 1,\n py: 3,\n borderBottom: `1px solid ${theme.palette.dark.main}1A`,\n display: 'flex',\n justifyContent: 'center',\n }}\n >\n <ToggleButton onClick={onToggle} aria-label=\"Expand sidebar\">\n <ChevronRightRounded sx={{fontSize: 20}} />\n </ToggleButton>\n </Box>\n )}\n\n <Box\n sx={{\n flex: 1,\n overflowY: 'auto',\n px: isOpen ? 1.5 : 1,\n py: 3,\n }}\n >\n <List sx={{ p: 0 }}>\n {menuItems.map((item) => (\n <Box key={item.id} sx={{ mb: 1 }}>\n <MenuItemButton\n isOpen={isOpen}\n isActive={activePage === item.id}\n onClick={() => {\n if (item.hasChildren) {\n toggleItem(item.id);\n } else {\n if (!isOpen) {\n onToggle();\n }\n handlePageClick(item.id);\n }\n }}\n title={!isOpen ? item.label : undefined}\n >\n <IconWrapper isOpen={isOpen}>{item.icon}</IconWrapper>\n {isOpen && (\n <>\n <ListItemText\n primary={item.label}\n primaryTypographyProps={{\n fontSize: '1rem',\n fontWeight: 600,\n }}\n sx={{ flex: 1 }}\n />\n {item.hasChildren && (\n <Box>\n {expandedItems.includes(item.id) ? (\n <ExpandLessRounded sx={{fontSize: 20, color:\"#4D3019\"}} />\n ) : (\n <ExpandMoreRounded sx={{fontSize: 20, color:\"#4D3019\"}} />\n )}\n </Box>\n )}\n </>\n )}\n </MenuItemButton>\n\n {item.hasChildren && expandedItems.includes(item.id) && item.children && isOpen && (\n <Collapse in={true} timeout=\"auto\">\n <List sx={{ p: 0, mt: 0.5 }}>\n {item.children.map((subItem) => (\n <Box key={subItem.id}>\n <Box sx={{ display: 'flex', alignItems: 'stretch' }}>\n <ListItemButton\n onClick={() => handlePageClick(subItem.id)}\n sx={{\n flex: 1,\n pl: 8,\n py: 1.25,\n borderRadius: `${theme.shape.borderRadius}px 0 0 ${theme.shape.borderRadius}px`,\n '&:hover': {\n backgroundColor: `${theme.palette.dark.main}0D`,\n },\n ...(activePage === subItem.id && {\n backgroundColor: `${theme.palette.dark.main}1A`,\n }),\n }}\n >\n <ListItemText\n primary={subItem.label}\n primaryTypographyProps={{\n fontSize: '0.875rem',\n }}\n />\n </ListItemButton>\n {subItem.hasChildren && subItem.children && subItem.children.length > 0 && (\n <IconButton\n onClick={() => toggleSubItem(subItem.id)}\n sx={{\n px: 1,\n borderRadius: `0 ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px 0`,\n '&:hover': {\n backgroundColor: `${theme.palette.dark.main}0D`,\n },\n }}\n >\n <ChevronRightRounded\n sx={{\n fontSize: 16,\n color: '#4D3019',\n transition: 'transform 0.2s',\n transform: expandedSubItems.includes(subItem.id) ? 'rotate(90deg)' : 'rotate(0deg)',\n }}\n />\n </IconButton>\n )}\n </Box>\n\n {subItem.hasChildren && expandedSubItems.includes(subItem.id) && subItem.children && (\n <Collapse in={true} timeout=\"auto\">\n <List sx={{ p: 0, mt: 0.5 }}>\n {subItem.children.map((nestedItem, index) => {\n const nestedPageId = `${subItem.id}-${index}`;\n return (\n <ListItemButton\n key={index}\n onClick={() => handlePageClick(nestedPageId)}\n sx={{\n pl: 10,\n py: 1,\n borderRadius: theme.shape.borderRadius,\n '&:hover': {\n backgroundColor: `${theme.palette.dark.main}0D`,\n },\n ...(activePage === nestedPageId && {\n backgroundColor: `${theme.palette.dark.main}1A`,\n }),\n }}\n >\n <ListItemText\n primary={nestedItem}\n primaryTypographyProps={{\n fontSize: '0.875rem',\n }}\n />\n </ListItemButton>\n );\n })}\n </List>\n </Collapse>\n )}\n </Box>\n ))}\n </List>\n </Collapse>\n )}\n </Box>\n ))}\n </List>\n </Box>\n </Box>\n </SidebarContainer>\n </>\n );\n};"],"names":[],"mappings":";;;;;;;AA8BA;AACE;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEE;;AAEA;AACD;;;AAGA;AACF;AAED;AACE;AACA;AACA;AACA;AACA;AACA;AACE;AACD;AACF;AAED;AACE;;;AAGA;AACA;;AAEC;;;;AAIF;AAED;;;AAGE;AACA;AACA;AACA;AACA;AACA;AACD;;AASC;;;AAIA;;;;AAIA;AAEA;AACE;AACE;AACA;AACA;AACD;AACD;AACE;AACA;AACA;AACA;AACA;AACE;AACA;AACA;AACE;AACA;AACA;AACA;;;;AAIC;AACF;AACD;AACE;AACA;AACA;AACA;AACD;AACF;AACF;AACD;AACE;AACA;AACA;AACD;;AAGH;;AAEI;AACA;;;AAEA;;AAIJ;AAEA;AACE;AAGF;;AAOU;AACA;AACA;AACA;;AAED;AASK;AACA;;AAEA;AACA;;AAME;AACA;AACA;AACA;AACA;AACA;;AAmBF;AACA;;AAEA;AACA;AACD;AAUD;AACA;;AAEA;;AAUQ;AACE;;;;AAGE;;AAEF;;AAEJ;AASQ;AACA;AACD;AAyBO;AACA;AACA;AACA;AACA;;AAEC;AACD;;;;AAQE;AACD;AAOC;AACA;AACA;;AAEC;AACF;AAIG;AACA;AACA;AACA;;;AAYF;AAKM;AACA;AACA;AACA;;AAEC;AACD;;;;AAQE;AACD;;AAqB3C;;"}