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.
- package/dist/ThemeProvider.d.ts +12 -0
- package/dist/ThemeProvider.d.ts.map +1 -1
- package/dist/cjs/ThemeProvider.js +159 -0
- package/dist/cjs/ThemeProvider.js.map +1 -0
- package/dist/cjs/components/ActionButton.js +31 -0
- package/dist/cjs/components/ActionButton.js.map +1 -0
- package/dist/cjs/components/Alert.js +79 -0
- package/dist/cjs/components/Alert.js.map +1 -0
- package/dist/cjs/components/Breadcrumb.js +120 -0
- package/dist/cjs/components/Breadcrumb.js.map +1 -0
- package/dist/cjs/components/Button.js +109 -0
- package/dist/cjs/components/Button.js.map +1 -0
- package/dist/cjs/components/Card.js +45 -0
- package/dist/cjs/components/Card.js.map +1 -0
- package/dist/cjs/components/Checkbox.js +42 -0
- package/dist/cjs/components/Checkbox.js.map +1 -0
- package/dist/cjs/components/Concertina.js +153 -0
- package/dist/cjs/components/Concertina.js.map +1 -0
- package/dist/cjs/components/DefinitionBox.js +77 -0
- package/dist/cjs/components/DefinitionBox.js.map +1 -0
- package/dist/cjs/components/Header.js +177 -0
- package/dist/cjs/components/Header.js.map +1 -0
- package/dist/cjs/components/Input.js +77 -0
- package/dist/cjs/components/Input.js.map +1 -0
- package/dist/cjs/components/Modal.js +114 -0
- package/dist/cjs/components/Modal.js.map +1 -0
- package/dist/cjs/components/NoteBox.js +111 -0
- package/dist/cjs/components/NoteBox.js.map +1 -0
- package/dist/cjs/components/Progress.js +83 -0
- package/dist/cjs/components/Progress.js.map +1 -0
- package/dist/cjs/components/Radio.js +61 -0
- package/dist/cjs/components/Radio.js.map +1 -0
- package/dist/cjs/components/ReadBy.js +58 -0
- package/dist/cjs/components/ReadBy.js.map +1 -0
- package/dist/cjs/components/Select.js +96 -0
- package/dist/cjs/components/Select.js.map +1 -0
- package/dist/cjs/components/Sidebar.js +206 -0
- package/dist/cjs/components/Sidebar.js.map +1 -0
- package/dist/cjs/components/SimpleModal.js +40 -0
- package/dist/cjs/components/SimpleModal.js.map +1 -0
- package/dist/cjs/components/StatusBar.js +64 -0
- package/dist/cjs/components/StatusBar.js.map +1 -0
- package/dist/cjs/components/TableOfContents.js +62 -0
- package/dist/cjs/components/TableOfContents.js.map +1 -0
- package/dist/cjs/components/Tabs.js +97 -0
- package/dist/cjs/components/Tabs.js.map +1 -0
- package/dist/cjs/components/Toggle.js +60 -0
- package/dist/cjs/components/Toggle.js.map +1 -0
- package/dist/cjs/index.js +57 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/components/Button.d.ts.map +1 -1
- package/dist/esm/ThemeProvider.d.ts +117 -0
- package/dist/esm/ThemeProvider.js +137 -0
- package/dist/esm/ThemeProvider.js.map +1 -0
- package/dist/esm/components/ActionButton.d.ts +11 -0
- package/dist/esm/components/ActionButton.js +29 -0
- package/dist/esm/components/ActionButton.js.map +1 -0
- package/dist/esm/components/Alert.d.ts +11 -0
- package/dist/esm/components/Alert.js +77 -0
- package/dist/esm/components/Alert.js.map +1 -0
- package/dist/esm/components/Breadcrumb.d.ts +13 -0
- package/dist/esm/components/Breadcrumb.js +118 -0
- package/dist/esm/components/Breadcrumb.js.map +1 -0
- package/dist/esm/components/Button.d.ts +8 -0
- package/dist/esm/components/Button.js +107 -0
- package/dist/esm/components/Button.js.map +1 -0
- package/dist/esm/components/Card.d.ts +11 -0
- package/dist/esm/components/Card.js +43 -0
- package/dist/esm/components/Card.js.map +1 -0
- package/dist/esm/components/Checkbox.d.ts +8 -0
- package/dist/esm/components/Checkbox.js +40 -0
- package/dist/esm/components/Checkbox.js.map +1 -0
- package/dist/esm/components/Concertina.d.ts +10 -0
- package/dist/esm/components/Concertina.js +151 -0
- package/dist/esm/components/Concertina.js.map +1 -0
- package/dist/esm/components/DefinitionBox.d.ts +8 -0
- package/dist/esm/components/DefinitionBox.js +75 -0
- package/dist/esm/components/DefinitionBox.js.map +1 -0
- package/dist/esm/components/Header.d.ts +7 -0
- package/dist/esm/components/Header.js +175 -0
- package/dist/esm/components/Header.js.map +1 -0
- package/dist/esm/components/Input.d.ts +7 -0
- package/dist/esm/components/Input.js +75 -0
- package/dist/esm/components/Input.js.map +1 -0
- package/dist/esm/components/Modal.d.ts +20 -0
- package/dist/esm/components/Modal.js +112 -0
- package/dist/esm/components/Modal.js.map +1 -0
- package/dist/esm/components/NoteBox.d.ts +10 -0
- package/dist/esm/components/NoteBox.js +109 -0
- package/dist/esm/components/NoteBox.js.map +1 -0
- package/dist/esm/components/Progress.d.ts +15 -0
- package/dist/esm/components/Progress.js +80 -0
- package/dist/esm/components/Progress.js.map +1 -0
- package/dist/esm/components/Radio.d.ts +14 -0
- package/dist/esm/components/Radio.js +58 -0
- package/dist/esm/components/Radio.js.map +1 -0
- package/dist/esm/components/ReadBy.d.ts +6 -0
- package/dist/esm/components/ReadBy.js +56 -0
- package/dist/esm/components/ReadBy.js.map +1 -0
- package/dist/esm/components/Select.d.ts +19 -0
- package/dist/esm/components/Select.js +94 -0
- package/dist/esm/components/Select.js.map +1 -0
- package/dist/esm/components/Sidebar.d.ts +10 -0
- package/dist/esm/components/Sidebar.js +204 -0
- package/dist/esm/components/Sidebar.js.map +1 -0
- package/dist/esm/components/SimpleModal.d.ts +9 -0
- package/dist/esm/components/SimpleModal.js +38 -0
- package/dist/esm/components/SimpleModal.js.map +1 -0
- package/dist/esm/components/StatusBar.d.ts +9 -0
- package/dist/esm/components/StatusBar.js +62 -0
- package/dist/esm/components/StatusBar.js.map +1 -0
- package/dist/esm/components/TableOfContents.d.ts +11 -0
- package/dist/esm/components/TableOfContents.js +60 -0
- package/dist/esm/components/TableOfContents.js.map +1 -0
- package/dist/esm/components/Tabs.d.ts +12 -0
- package/dist/esm/components/Tabs.js +95 -0
- package/dist/esm/components/Tabs.js.map +1 -0
- package/dist/esm/components/Toggle.d.ts +8 -0
- package/dist/esm/components/Toggle.js +58 -0
- package/dist/esm/components/Toggle.js.map +1 -0
- package/dist/esm/components/index.d.ts +22 -0
- package/dist/esm/index.d.ts +25 -0
- package/dist/esm/index.js +26 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/theme-types.d.ts +39 -0
- package/dist/{index.esm.js → index.cjs} +270 -198
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +22 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +224 -242
- package/dist/index.js.map +1 -1
- package/package.json +15 -13
- package/dist/index.esm.js.map +0 -1
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var material = require('@mui/material');
|
|
7
|
+
var ThemeProvider = require('../ThemeProvider.js');
|
|
8
|
+
var iconsMaterial = require('@mui/icons-material');
|
|
9
|
+
|
|
10
|
+
const SidebarContainer = material.styled(material.Box)(({ theme, isOpen }) => ({
|
|
11
|
+
height: '100vh',
|
|
12
|
+
position: 'sticky',
|
|
13
|
+
top: 0,
|
|
14
|
+
backgroundColor: '#fff',
|
|
15
|
+
borderRight: `1px solid ${theme.palette.dark.main}1A`,
|
|
16
|
+
flexShrink: 0,
|
|
17
|
+
transition: 'all 0.3s ease-in-out',
|
|
18
|
+
width: isOpen ? '288px' : '64px',
|
|
19
|
+
zIndex: 50,
|
|
20
|
+
[theme.breakpoints.down('md')]: {
|
|
21
|
+
position: 'fixed',
|
|
22
|
+
left: isOpen ? 0 : '-288px',
|
|
23
|
+
width: '288px',
|
|
24
|
+
},
|
|
25
|
+
[theme.breakpoints.up('sm')]: {
|
|
26
|
+
width: isOpen ? '288px' : '80px',
|
|
27
|
+
},
|
|
28
|
+
}));
|
|
29
|
+
const ToggleButton = material.styled(material.IconButton)(({ theme }) => ({
|
|
30
|
+
width: 40,
|
|
31
|
+
height: 40,
|
|
32
|
+
borderRadius: theme.shape.borderRadius,
|
|
33
|
+
backgroundColor: '#4D3019',
|
|
34
|
+
color: '#fff',
|
|
35
|
+
'&:hover': {
|
|
36
|
+
backgroundColor: '#3d2614',
|
|
37
|
+
},
|
|
38
|
+
}));
|
|
39
|
+
const MenuItemButton = material.styled(material.ListItemButton)(({ theme, isActive, isOpen }) => ({
|
|
40
|
+
borderRadius: theme.shape.borderRadius,
|
|
41
|
+
padding: isOpen ? '10px 8px' : '12px 0',
|
|
42
|
+
justifyContent: isOpen ? 'flex-start' : 'center',
|
|
43
|
+
gap: isOpen ? theme.spacing(1) : 0,
|
|
44
|
+
'&:hover': {
|
|
45
|
+
backgroundColor: `${theme.palette.dark.main}0D`,
|
|
46
|
+
},
|
|
47
|
+
...(isActive && {
|
|
48
|
+
backgroundColor: `${theme.palette.dark.main}1A`,
|
|
49
|
+
}),
|
|
50
|
+
}));
|
|
51
|
+
const IconWrapper = material.styled(material.Box)(({ theme, isOpen }) => ({
|
|
52
|
+
width: isOpen ? 32 : 40,
|
|
53
|
+
height: isOpen ? 32 : 40,
|
|
54
|
+
borderRadius: theme.shape.borderRadius,
|
|
55
|
+
display: 'flex',
|
|
56
|
+
alignItems: 'center',
|
|
57
|
+
justifyContent: 'center',
|
|
58
|
+
flexShrink: 0,
|
|
59
|
+
backgroundColor: theme.palette.custom?.iconColor || theme.palette.accent.main,
|
|
60
|
+
}));
|
|
61
|
+
const Sidebar = ({ isOpen, onToggle, centreName = "Centre name goes here \n across two lines", activePage = 'dashboard', onPageChange }) => {
|
|
62
|
+
const { theme } = ThemeProvider.useTheme();
|
|
63
|
+
const [expandedItems, setExpandedItems] = React.useState([]);
|
|
64
|
+
const [expandedSubItems, setExpandedSubItems] = React.useState([]);
|
|
65
|
+
const handlePageClick = (pageId) => {
|
|
66
|
+
if (onPageChange) {
|
|
67
|
+
onPageChange(pageId);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const menuItems = [
|
|
71
|
+
{
|
|
72
|
+
id: 'dashboard',
|
|
73
|
+
label: 'Dashboard',
|
|
74
|
+
icon: jsxRuntime.jsx(iconsMaterial.HomeRounded, { sx: { fontSize: 20, color: "#4D3019" } }),
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: 'policies',
|
|
78
|
+
label: 'Policies',
|
|
79
|
+
icon: jsxRuntime.jsx(iconsMaterial.TextSnippetRounded, { sx: { fontSize: 20, color: "#4D3019" } }),
|
|
80
|
+
hasChildren: true,
|
|
81
|
+
children: [
|
|
82
|
+
{ id: 'legislation', label: 'Legislation' },
|
|
83
|
+
{ id: 'service-assurances', label: 'Service Assurances / Compliance Checklist' },
|
|
84
|
+
{
|
|
85
|
+
id: 'governance',
|
|
86
|
+
label: 'Governance, Management, and Administration',
|
|
87
|
+
hasChildren: true,
|
|
88
|
+
children: [
|
|
89
|
+
'Philosophy and Values',
|
|
90
|
+
'Te Tiriti o Waitangi – policy options',
|
|
91
|
+
'Self-Review and Internal Evaluation',
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
id: 'curriculum',
|
|
96
|
+
label: 'Curriculum and Learning V1',
|
|
97
|
+
hasChildren: true,
|
|
98
|
+
children: [],
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
id: 'support',
|
|
104
|
+
label: 'Support',
|
|
105
|
+
icon: jsxRuntime.jsx(iconsMaterial.HelpOutlineRounded, { sx: { fontSize: 20, color: "#4D3019" } }),
|
|
106
|
+
},
|
|
107
|
+
];
|
|
108
|
+
const toggleItem = (itemId) => {
|
|
109
|
+
if (!isOpen) {
|
|
110
|
+
onToggle();
|
|
111
|
+
setExpandedItems([itemId]);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
setExpandedItems((prev) => prev.includes(itemId) ? prev.filter((id) => id !== itemId) : [...prev, itemId]);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
const toggleSubItem = (subItemId) => {
|
|
118
|
+
setExpandedSubItems((prev) => prev.includes(subItemId) ? prev.filter((id) => id !== subItemId) : [...prev, subItemId]);
|
|
119
|
+
};
|
|
120
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isOpen && (jsxRuntime.jsx(material.Box, { sx: {
|
|
121
|
+
position: 'fixed',
|
|
122
|
+
inset: 0,
|
|
123
|
+
bgcolor: 'rgba(0, 0, 0, 0.5)',
|
|
124
|
+
zIndex: 40,
|
|
125
|
+
display: { xs: 'block', md: 'none' },
|
|
126
|
+
}, onClick: onToggle })), jsxRuntime.jsx(SidebarContainer, { isOpen: isOpen, children: jsxRuntime.jsxs(material.Box, { sx: { display: 'flex', flexDirection: 'column', height: '100%' }, children: [isOpen && (jsxRuntime.jsxs(material.Box, { sx: {
|
|
127
|
+
px: 2,
|
|
128
|
+
py: 3,
|
|
129
|
+
borderBottom: `1px solid ${theme.palette.dark.main}1A`,
|
|
130
|
+
flexShrink: 0,
|
|
131
|
+
position: 'relative',
|
|
132
|
+
}, children: [jsxRuntime.jsx(material.Typography, { variant: "h6", sx: {
|
|
133
|
+
fontSize: '18px',
|
|
134
|
+
fontWeight: 700,
|
|
135
|
+
color: '#4D3019',
|
|
136
|
+
lineHeight: 1.3,
|
|
137
|
+
whiteSpace: 'pre-line',
|
|
138
|
+
pr: 7,
|
|
139
|
+
}, children: centreName }), jsxRuntime.jsx(ToggleButton, { onClick: onToggle, sx: { position: 'absolute', top: 24, right: 16 }, "aria-label": "Collapse sidebar", children: jsxRuntime.jsx(iconsMaterial.ChevronLeftRounded, { sx: { fontSize: 20 } }) })] })), !isOpen && (jsxRuntime.jsx(material.Box, { sx: {
|
|
140
|
+
px: 1,
|
|
141
|
+
py: 3,
|
|
142
|
+
borderBottom: `1px solid ${theme.palette.dark.main}1A`,
|
|
143
|
+
display: 'flex',
|
|
144
|
+
justifyContent: 'center',
|
|
145
|
+
}, children: jsxRuntime.jsx(ToggleButton, { onClick: onToggle, "aria-label": "Expand sidebar", children: jsxRuntime.jsx(iconsMaterial.ChevronRightRounded, { sx: { fontSize: 20 } }) }) })), jsxRuntime.jsx(material.Box, { sx: {
|
|
146
|
+
flex: 1,
|
|
147
|
+
overflowY: 'auto',
|
|
148
|
+
px: isOpen ? 1.5 : 1,
|
|
149
|
+
py: 3,
|
|
150
|
+
}, children: jsxRuntime.jsx(material.List, { sx: { p: 0 }, children: menuItems.map((item) => (jsxRuntime.jsxs(material.Box, { sx: { mb: 1 }, children: [jsxRuntime.jsxs(MenuItemButton, { isOpen: isOpen, isActive: activePage === item.id, onClick: () => {
|
|
151
|
+
if (item.hasChildren) {
|
|
152
|
+
toggleItem(item.id);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
if (!isOpen) {
|
|
156
|
+
onToggle();
|
|
157
|
+
}
|
|
158
|
+
handlePageClick(item.id);
|
|
159
|
+
}
|
|
160
|
+
}, title: !isOpen ? item.label : undefined, children: [jsxRuntime.jsx(IconWrapper, { isOpen: isOpen, children: item.icon }), isOpen && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(material.ListItemText, { primary: item.label, primaryTypographyProps: {
|
|
161
|
+
fontSize: '1rem',
|
|
162
|
+
fontWeight: 600,
|
|
163
|
+
}, sx: { flex: 1 } }), item.hasChildren && (jsxRuntime.jsx(material.Box, { children: expandedItems.includes(item.id) ? (jsxRuntime.jsx(iconsMaterial.ExpandLessRounded, { sx: { fontSize: 20, color: "#4D3019" } })) : (jsxRuntime.jsx(iconsMaterial.ExpandMoreRounded, { sx: { fontSize: 20, color: "#4D3019" } })) }))] }))] }), item.hasChildren && expandedItems.includes(item.id) && item.children && isOpen && (jsxRuntime.jsx(material.Collapse, { in: true, timeout: "auto", children: jsxRuntime.jsx(material.List, { sx: { p: 0, mt: 0.5 }, children: item.children.map((subItem) => (jsxRuntime.jsxs(material.Box, { children: [jsxRuntime.jsxs(material.Box, { sx: { display: 'flex', alignItems: 'stretch' }, children: [jsxRuntime.jsx(material.ListItemButton, { onClick: () => handlePageClick(subItem.id), sx: {
|
|
164
|
+
flex: 1,
|
|
165
|
+
pl: 8,
|
|
166
|
+
py: 1.25,
|
|
167
|
+
borderRadius: `${theme.shape.borderRadius}px 0 0 ${theme.shape.borderRadius}px`,
|
|
168
|
+
'&:hover': {
|
|
169
|
+
backgroundColor: `${theme.palette.dark.main}0D`,
|
|
170
|
+
},
|
|
171
|
+
...(activePage === subItem.id && {
|
|
172
|
+
backgroundColor: `${theme.palette.dark.main}1A`,
|
|
173
|
+
}),
|
|
174
|
+
}, children: jsxRuntime.jsx(material.ListItemText, { primary: subItem.label, primaryTypographyProps: {
|
|
175
|
+
fontSize: '0.875rem',
|
|
176
|
+
} }) }), subItem.hasChildren && subItem.children && subItem.children.length > 0 && (jsxRuntime.jsx(material.IconButton, { onClick: () => toggleSubItem(subItem.id), sx: {
|
|
177
|
+
px: 1,
|
|
178
|
+
borderRadius: `0 ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px 0`,
|
|
179
|
+
'&:hover': {
|
|
180
|
+
backgroundColor: `${theme.palette.dark.main}0D`,
|
|
181
|
+
},
|
|
182
|
+
}, children: jsxRuntime.jsx(iconsMaterial.ChevronRightRounded, { sx: {
|
|
183
|
+
fontSize: 16,
|
|
184
|
+
color: '#4D3019',
|
|
185
|
+
transition: 'transform 0.2s',
|
|
186
|
+
transform: expandedSubItems.includes(subItem.id) ? 'rotate(90deg)' : 'rotate(0deg)',
|
|
187
|
+
} }) }))] }), subItem.hasChildren && expandedSubItems.includes(subItem.id) && subItem.children && (jsxRuntime.jsx(material.Collapse, { in: true, timeout: "auto", children: jsxRuntime.jsx(material.List, { sx: { p: 0, mt: 0.5 }, children: subItem.children.map((nestedItem, index) => {
|
|
188
|
+
const nestedPageId = `${subItem.id}-${index}`;
|
|
189
|
+
return (jsxRuntime.jsx(material.ListItemButton, { onClick: () => handlePageClick(nestedPageId), sx: {
|
|
190
|
+
pl: 10,
|
|
191
|
+
py: 1,
|
|
192
|
+
borderRadius: theme.shape.borderRadius,
|
|
193
|
+
'&:hover': {
|
|
194
|
+
backgroundColor: `${theme.palette.dark.main}0D`,
|
|
195
|
+
},
|
|
196
|
+
...(activePage === nestedPageId && {
|
|
197
|
+
backgroundColor: `${theme.palette.dark.main}1A`,
|
|
198
|
+
}),
|
|
199
|
+
}, children: jsxRuntime.jsx(material.ListItemText, { primary: nestedItem, primaryTypographyProps: {
|
|
200
|
+
fontSize: '0.875rem',
|
|
201
|
+
} }) }, index));
|
|
202
|
+
}) }) }))] }, subItem.id))) }) }))] }, item.id))) }) })] }) })] }));
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
exports.Sidebar = Sidebar;
|
|
206
|
+
//# 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;;"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var material = require('@mui/material');
|
|
6
|
+
var ThemeProvider = require('../ThemeProvider.js');
|
|
7
|
+
var iconsMaterial = require('@mui/icons-material');
|
|
8
|
+
|
|
9
|
+
const StyledDialog = material.styled(material.Dialog)(({ theme }) => ({
|
|
10
|
+
'& .MuiDialog-paper': {
|
|
11
|
+
borderRadius: (typeof theme.shape.borderRadius === 'string'
|
|
12
|
+
? parseInt(theme.shape.borderRadius, 10)
|
|
13
|
+
: theme.shape.borderRadius || 4) * 2,
|
|
14
|
+
maxWidth: '448px',
|
|
15
|
+
width: '100%',
|
|
16
|
+
},
|
|
17
|
+
}));
|
|
18
|
+
const StyledDialogTitle = material.styled(material.DialogTitle)(({ theme }) => ({
|
|
19
|
+
display: 'flex',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
justifyContent: 'space-between',
|
|
22
|
+
padding: theme.spacing(3),
|
|
23
|
+
borderBottom: `1px solid ${theme.palette.divider}`,
|
|
24
|
+
fontSize: '1.125rem',
|
|
25
|
+
fontWeight: 600,
|
|
26
|
+
color: theme.palette.dark.main,
|
|
27
|
+
}));
|
|
28
|
+
const CloseButton = material.styled(material.IconButton)(({ theme }) => ({
|
|
29
|
+
padding: theme.spacing(0.5),
|
|
30
|
+
'&:hover': {
|
|
31
|
+
backgroundColor: `${theme.palette.dark.main}0D`,
|
|
32
|
+
},
|
|
33
|
+
}));
|
|
34
|
+
const SimpleModal = ({ isOpen, onClose, title, children, }) => {
|
|
35
|
+
const { theme } = ThemeProvider.useTheme();
|
|
36
|
+
return (jsxRuntime.jsxs(StyledDialog, { open: isOpen, onClose: onClose, maxWidth: "sm", fullWidth: true, children: [jsxRuntime.jsxs(StyledDialogTitle, { children: [title, jsxRuntime.jsx(CloseButton, { onClick: onClose, "aria-label": "Close", children: jsxRuntime.jsx(iconsMaterial.CloseRounded, { sx: { fontSize: 20, color: theme.palette.dark.main } }) })] }), jsxRuntime.jsx(material.DialogContent, { sx: { p: 3 }, children: children })] }));
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
exports.SimpleModal = SimpleModal;
|
|
40
|
+
//# sourceMappingURL=SimpleModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimpleModal.js","sources":["../../../../src/components/SimpleModal.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { Dialog, DialogTitle, DialogContent, IconButton, styled } from '@mui/material';\nimport { useTheme } from '../ThemeProvider';\nimport { CloseRounded } from '@mui/icons-material';\n\ninterface SimpleModalProps {\n isOpen: boolean;\n onClose: () => void;\n title: string;\n children: React.ReactNode;\n}\n\nconst StyledDialog = styled(Dialog)(({ theme }) => ({\n '& .MuiDialog-paper': {\n borderRadius: (typeof theme.shape.borderRadius === 'string'\n ? parseInt(theme.shape.borderRadius, 10)\n : theme.shape.borderRadius || 4) * 2,\n maxWidth: '448px',\n width: '100%',\n },\n}));\n\nconst StyledDialogTitle = styled(DialogTitle)(({ theme }) => ({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n padding: theme.spacing(3),\n borderBottom: `1px solid ${theme.palette.divider}`,\n fontSize: '1.125rem',\n fontWeight: 600,\n color: theme.palette.dark.main,\n}));\n\nconst CloseButton = styled(IconButton)(({ theme }) => ({\n padding: theme.spacing(0.5),\n '&:hover': {\n backgroundColor: `${theme.palette.dark.main}0D`,\n },\n}));\n\nexport const SimpleModal: React.FC<SimpleModalProps> = ({\n isOpen,\n onClose,\n title,\n children,\n}) => {\n const { theme } = useTheme();\n\n return (\n <StyledDialog \n open={isOpen} \n onClose={onClose}\n maxWidth=\"sm\"\n fullWidth\n >\n <StyledDialogTitle>\n {title}\n <CloseButton onClick={onClose} aria-label=\"Close\">\n <CloseRounded sx={{fontSize:20, color:theme.palette.dark.main}} />\n </CloseButton>\n </StyledDialogTitle>\n\n <DialogContent sx={{ p: 3 }}>\n {children}\n </DialogContent>\n </StyledDialog>\n );\n};"],"names":[],"mappings":";;;;;;;;AAcA;AACE;;;;AAIE;AACA;AACD;AACF;AAED;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACD;AAED;AACE;AACA;;AAEC;AACF;AAEM;AAML;AAEA;AAmBF;;"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var material = require('@mui/material');
|
|
6
|
+
var Button = require('./Button.js');
|
|
7
|
+
var iconsMaterial = require('@mui/icons-material');
|
|
8
|
+
|
|
9
|
+
const StatusBarContainer = material.styled(material.Box)(({ theme }) => ({
|
|
10
|
+
width: '100%',
|
|
11
|
+
backgroundColor: '#F5C98E',
|
|
12
|
+
padding: theme.spacing(1.5, 3),
|
|
13
|
+
display: 'flex',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
justifyContent: 'space-between',
|
|
16
|
+
gap: theme.spacing(3),
|
|
17
|
+
flexDirection: 'row',
|
|
18
|
+
[theme.breakpoints.down('sm')]: {
|
|
19
|
+
flexDirection: 'column',
|
|
20
|
+
padding: theme.spacing(1.25, 2),
|
|
21
|
+
},
|
|
22
|
+
}));
|
|
23
|
+
const ContentWrapper = material.styled(material.Box)(({ theme }) => ({
|
|
24
|
+
display: 'flex',
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
gap: theme.spacing(1.5),
|
|
27
|
+
flex: 1,
|
|
28
|
+
minWidth: 0,
|
|
29
|
+
justifyContent: 'flex-start',
|
|
30
|
+
[theme.breakpoints.down('sm')]: {
|
|
31
|
+
justifyContent: 'center',
|
|
32
|
+
gap: theme.spacing(1),
|
|
33
|
+
},
|
|
34
|
+
}));
|
|
35
|
+
const NextButton = material.styled(material.IconButton)(({ theme }) => ({
|
|
36
|
+
width: 40,
|
|
37
|
+
height: 40,
|
|
38
|
+
border: `2px solid rgba(77, 48, 25, 0.25)`,
|
|
39
|
+
backgroundColor: '#fff',
|
|
40
|
+
'&:hover': {
|
|
41
|
+
backgroundColor: '#4D3019',
|
|
42
|
+
color: '#fff',
|
|
43
|
+
},
|
|
44
|
+
[theme.breakpoints.down('sm')]: {
|
|
45
|
+
width: 36,
|
|
46
|
+
height: 36,
|
|
47
|
+
},
|
|
48
|
+
}));
|
|
49
|
+
const StatusBar = ({ itemCount, variant = 'actionstarted', onTailorClick, onNextClick }) => {
|
|
50
|
+
const message = `There are ${itemCount} items that need attention.`;
|
|
51
|
+
return (jsxRuntime.jsxs(StatusBarContainer, { children: [jsxRuntime.jsxs(ContentWrapper, { children: [jsxRuntime.jsx(iconsMaterial.PieChartRounded, { sx: {
|
|
52
|
+
fontSize: 24,
|
|
53
|
+
color: "#4D3019",
|
|
54
|
+
flexShrink: 0,
|
|
55
|
+
} }), jsxRuntime.jsx(material.Typography, { sx: {
|
|
56
|
+
fontSize: { xs: '14px', sm: '15px', md: '16px' },
|
|
57
|
+
color: '#4D3019',
|
|
58
|
+
wordBreak: 'break-word',
|
|
59
|
+
textAlign: { xs: 'center', sm: 'left' },
|
|
60
|
+
}, children: variant === 'actionstarted' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(material.Box, { component: "span", sx: { fontWeight: 700 }, children: "Incomplete." }), " ", message] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(material.Box, { component: "span", sx: { fontWeight: 700 }, children: "Not started." }), " ", message] })) })] }), variant === 'actionstarted' ? (jsxRuntime.jsx(material.Box, { sx: { display: 'flex', gap: 1.5, flexShrink: 0 }, children: jsxRuntime.jsx(NextButton, { onClick: onNextClick, "aria-label": "Next", children: jsxRuntime.jsx(iconsMaterial.ChevronRightRounded, { sx: { fontSize: 20 } }) }) })) : (jsxRuntime.jsx(material.Box, { sx: { flexShrink: 0 }, children: jsxRuntime.jsx(Button.Button, { variant: "outline", size: "sm", onClick: onTailorClick, children: "Tailor policies" }) }))] }));
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
exports.StatusBar = StatusBar;
|
|
64
|
+
//# sourceMappingURL=StatusBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatusBar.js","sources":["../../../../src/components/StatusBar.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { Box, Typography, IconButton, styled } from '@mui/material';\nimport { Button } from './Button';\nimport { ChevronRightRounded, PieChartRounded } from '@mui/icons-material';\n\ninterface StatusBarProps {\n itemCount: number;\n variant: 'actionstarted' | 'noaction';\n onTailorClick?: () => void;\n onNextClick?: () => void;\n}\n\nconst StatusBarContainer = styled(Box)(({ theme }) => ({\n width: '100%',\n backgroundColor: '#F5C98E',\n padding: theme.spacing(1.5, 3),\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n gap: theme.spacing(3),\n flexDirection: 'row',\n [theme.breakpoints.down('sm')]: {\n flexDirection: 'column',\n padding: theme.spacing(1.25, 2),\n },\n}));\n\nconst ContentWrapper = styled(Box)(({ theme }) => ({\n display: 'flex',\n alignItems: 'center',\n gap: theme.spacing(1.5),\n flex: 1,\n minWidth: 0,\n justifyContent: 'flex-start',\n [theme.breakpoints.down('sm')]: {\n justifyContent: 'center',\n gap: theme.spacing(1),\n },\n}));\n\nconst NextButton = styled(IconButton)(({ theme }) => ({\n width: 40,\n height: 40,\n border: `2px solid rgba(77, 48, 25, 0.25)`,\n backgroundColor: '#fff',\n '&:hover': {\n backgroundColor: '#4D3019',\n color: '#fff',\n },\n [theme.breakpoints.down('sm')]: {\n width: 36,\n height: 36,\n },\n}));\n\nexport const StatusBar: React.FC<StatusBarProps> = ({\n itemCount,\n variant = 'actionstarted',\n onTailorClick,\n onNextClick\n}) => {\n const message = `There are ${itemCount} items that need attention.`;\n\n return (\n <StatusBarContainer>\n <ContentWrapper>\n <PieChartRounded \n sx={{\n fontSize: 24,\n color:\"#4D3019\",\n flexShrink: 0 ,\n }}\n />\n <Typography\n sx={{\n fontSize: { xs: '14px', sm: '15px', md: '16px' },\n color: '#4D3019',\n wordBreak: 'break-word',\n textAlign: { xs: 'center', sm: 'left' },\n }}\n >\n {variant === 'actionstarted' ? (\n <>\n <Box component=\"span\" sx={{ fontWeight: 700 }}>Incomplete.</Box> {message}\n </>\n ) : (\n <>\n <Box component=\"span\" sx={{ fontWeight: 700 }}>Not started.</Box> {message}\n </>\n )}\n </Typography>\n </ContentWrapper>\n {variant === 'actionstarted' ? (\n <Box sx={{ display: 'flex', gap: 1.5, flexShrink: 0 }}>\n <NextButton\n onClick={onNextClick}\n aria-label=\"Next\"\n >\n <ChevronRightRounded sx={{fontSize:20}} />\n </NextButton>\n </Box>\n ) : (\n <Box sx={{ flexShrink: 0 }}>\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={onTailorClick}\n >\n Tailor policies\n </Button>\n </Box>\n )}\n </StatusBarContainer>\n );\n};"],"names":[],"mappings":";;;;;;;;AAcA;AACE;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEE;;AAED;AACF;AAED;AACE;AACA;AACA;AACA;AACA;AACA;;AAEE;AACA;AACD;AACF;AAED;AACE;AACA;AACA;AACA;AACA;AACE;AACA;AACD;;AAEC;AACA;AACD;AACF;AAEM;AAML;;AAOU;AACA;AACA;AACH;AAIG;AACA;AACA;;AAED;AAmCX;;"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var material = require('@mui/material');
|
|
6
|
+
|
|
7
|
+
const Container = material.styled(material.Box)(({ theme }) => ({
|
|
8
|
+
width: '100%',
|
|
9
|
+
[theme.breakpoints.up('md')]: {
|
|
10
|
+
position: 'sticky',
|
|
11
|
+
right: 0,
|
|
12
|
+
top: 0,
|
|
13
|
+
width: '224px',
|
|
14
|
+
float: 'right',
|
|
15
|
+
marginLeft: theme.spacing(1.5),
|
|
16
|
+
marginBottom: 0,
|
|
17
|
+
},
|
|
18
|
+
[theme.breakpoints.up('lg')]: {
|
|
19
|
+
width: '256px',
|
|
20
|
+
marginLeft: theme.spacing(2),
|
|
21
|
+
},
|
|
22
|
+
marginBottom: theme.spacing(2),
|
|
23
|
+
}));
|
|
24
|
+
const ContentBox = material.styled(material.Box)(({ theme }) => ({
|
|
25
|
+
backgroundColor: '#FEFDF7',
|
|
26
|
+
borderRadius: (typeof theme.shape.borderRadius === 'string'
|
|
27
|
+
? parseInt(theme.shape.borderRadius, 10)
|
|
28
|
+
: theme.shape.borderRadius || 4) * 2,
|
|
29
|
+
padding: theme.spacing(2.5),
|
|
30
|
+
boxShadow: '0 1px 3px 0 rgba(0, 0, 0, 0.1)',
|
|
31
|
+
[theme.breakpoints.up('md')]: {
|
|
32
|
+
padding: theme.spacing(3),
|
|
33
|
+
},
|
|
34
|
+
}));
|
|
35
|
+
const NavLink = material.styled(material.Link)(({ theme, isActive }) => ({
|
|
36
|
+
display: 'block',
|
|
37
|
+
padding: theme.spacing(1, 2),
|
|
38
|
+
fontSize: '0.875rem',
|
|
39
|
+
textDecoration: 'none',
|
|
40
|
+
color: '#4D3019',
|
|
41
|
+
transition: 'background-color 0.2s',
|
|
42
|
+
borderLeft: isActive ? '4px solid #FFC365' : '4px solid transparent',
|
|
43
|
+
backgroundColor: isActive ? '#FFEDD1' : 'transparent',
|
|
44
|
+
fontWeight: isActive ? 700 : 400,
|
|
45
|
+
'&:hover': {
|
|
46
|
+
backgroundColor: '#FFEDD1',
|
|
47
|
+
},
|
|
48
|
+
}));
|
|
49
|
+
const TableOfContents = ({ sections, activeSection = 'current-section', }) => {
|
|
50
|
+
return (jsxRuntime.jsx(Container, { children: jsxRuntime.jsxs(ContentBox, { children: [jsxRuntime.jsx(material.Typography, { variant: "h6", sx: {
|
|
51
|
+
color: '#4D3019',
|
|
52
|
+
fontWeight: 600,
|
|
53
|
+
fontSize: '16px',
|
|
54
|
+
mb: 3,
|
|
55
|
+
}, children: "In this policy" }), jsxRuntime.jsx(material.Box, { component: "nav", sx: { display: 'flex', flexDirection: 'column', gap: 0.25 }, children: sections.map((section) => {
|
|
56
|
+
const isActive = section.id === activeSection;
|
|
57
|
+
return (jsxRuntime.jsx(NavLink, { href: `#${section.id}`, isActive: isActive, children: section.title }, section.id));
|
|
58
|
+
}) })] }) }));
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
exports.TableOfContents = TableOfContents;
|
|
62
|
+
//# sourceMappingURL=TableOfContents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableOfContents.js","sources":["../../../../src/components/TableOfContents.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { Box, Typography, Link, styled } from '@mui/material';\n\ninterface Section {\n id: string;\n title: string;\n}\n\ninterface TableOfContentsProps {\n sections: Section[];\n activeSection?: string;\n}\n\nconst Container = styled(Box)(({ theme }) => ({\n width: '100%',\n [theme.breakpoints.up('md')]: {\n position: 'sticky',\n right: 0,\n top: 0,\n width: '224px',\n float: 'right',\n marginLeft: theme.spacing(1.5),\n marginBottom: 0,\n },\n [theme.breakpoints.up('lg')]: {\n width: '256px',\n marginLeft: theme.spacing(2),\n },\n marginBottom: theme.spacing(2),\n}));\n\nconst ContentBox = styled(Box)(({ theme }) => ({\n backgroundColor: '#FEFDF7',\n borderRadius: (typeof theme.shape.borderRadius === 'string'\n ? parseInt(theme.shape.borderRadius, 10)\n : theme.shape.borderRadius || 4) * 2,\n padding: theme.spacing(2.5),\n boxShadow: '0 1px 3px 0 rgba(0, 0, 0, 0.1)',\n [theme.breakpoints.up('md')]: {\n padding: theme.spacing(3),\n },\n}));\n\nconst NavLink = styled(Link)<{ isActive: boolean }>(({ theme, isActive }) => ({\n display: 'block',\n padding: theme.spacing(1, 2),\n fontSize: '0.875rem',\n textDecoration: 'none',\n color: '#4D3019',\n transition: 'background-color 0.2s',\n borderLeft: isActive ? '4px solid #FFC365' : '4px solid transparent',\n backgroundColor: isActive ? '#FFEDD1' : 'transparent',\n fontWeight: isActive ? 700 : 400,\n '&:hover': {\n backgroundColor: '#FFEDD1',\n },\n}));\n\nexport const TableOfContents: React.FC<TableOfContentsProps> = ({\n sections,\n activeSection = 'current-section',\n}) => {\n return (\n <Container>\n <ContentBox>\n <Typography\n variant=\"h6\"\n sx={{\n color: '#4D3019',\n fontWeight: 600,\n fontSize: '16px',\n mb: 3,\n }}\n >\n In this policy\n </Typography>\n <Box component=\"nav\" sx={{ display: 'flex', flexDirection: 'column', gap: 0.25 }}>\n {sections.map((section) => {\n const isActive = section.id === activeSection;\n return (\n <NavLink\n key={section.id}\n href={`#${section.id}`}\n isActive={isActive}\n >\n {section.title}\n </NavLink>\n );\n })}\n </Box>\n </ContentBox>\n </Container>\n );\n};"],"names":[],"mappings":";;;;;;AAeA;AACE;;AAEE;AACA;AACA;AACA;AACA;AACA;AACA;AACD;;AAEC;AACA;AACD;AACD;AACD;AAED;AACE;;;;AAIA;AACA;;AAEE;AACD;AACF;AAED;AACE;;AAEA;AACA;AACA;AACA;;;;AAIA;AACE;AACD;AACF;AAEM;AAIL;AAMU;AACA;AACA;AACA;AACD;AAMC;;AAUF;AAKV;;"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var material = require('@mui/material');
|
|
7
|
+
var iconsMaterial = require('@mui/icons-material');
|
|
8
|
+
|
|
9
|
+
const TabsContainer = material.styled(material.Box)({
|
|
10
|
+
display: 'none',
|
|
11
|
+
'@media (min-width: 900px)': {
|
|
12
|
+
display: 'block',
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
const TabButtonsWrapper = material.styled(material.Box)({
|
|
16
|
+
display: 'flex',
|
|
17
|
+
gap: '4px',
|
|
18
|
+
backgroundColor: '#FDFCEE',
|
|
19
|
+
});
|
|
20
|
+
const TabButton = material.styled(material.Button)(({ theme, isActive }) => ({
|
|
21
|
+
padding: theme.spacing(2, 3),
|
|
22
|
+
fontSize: '16px',
|
|
23
|
+
fontWeight: 500,
|
|
24
|
+
textTransform: 'none',
|
|
25
|
+
color: isActive ? '#4D3019' : '#826E5C',
|
|
26
|
+
backgroundColor: isActive ? theme.palette.custom?.tabBackgroundColor || theme.palette.accent.main : 'transparent',
|
|
27
|
+
borderRadius: 0,
|
|
28
|
+
position: 'relative',
|
|
29
|
+
minWidth: 'auto',
|
|
30
|
+
'&:hover': {
|
|
31
|
+
backgroundColor: isActive ? theme.palette.custom?.tabBackgroundColor || theme.palette.accent.main : 'rgba(77, 48, 25, 0.05)',
|
|
32
|
+
color: '#4D3019',
|
|
33
|
+
},
|
|
34
|
+
'&::after': isActive ? {
|
|
35
|
+
content: '""',
|
|
36
|
+
position: 'absolute',
|
|
37
|
+
bottom: 0,
|
|
38
|
+
left: 0,
|
|
39
|
+
right: 0,
|
|
40
|
+
height: '4px',
|
|
41
|
+
backgroundColor: theme.palette.primary.main,
|
|
42
|
+
} : {},
|
|
43
|
+
}));
|
|
44
|
+
const TabContent = material.styled(material.Box)(({ theme }) => ({
|
|
45
|
+
padding: theme.spacing(3),
|
|
46
|
+
color: '#4D3019',
|
|
47
|
+
backgroundColor: theme.palette.custom?.tabBackgroundColor || theme.palette.accent.main,
|
|
48
|
+
}));
|
|
49
|
+
const MobileContainer = material.styled(material.Box)({
|
|
50
|
+
backgroundColor: '#FDFCEE',
|
|
51
|
+
'@media (min-width: 900px)': {
|
|
52
|
+
display: 'none',
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
const MobileTabButton = material.styled(material.Button)(({ theme, isExpanded }) => ({
|
|
56
|
+
width: '100%',
|
|
57
|
+
display: 'flex',
|
|
58
|
+
alignItems: 'center',
|
|
59
|
+
justifyContent: 'space-between',
|
|
60
|
+
padding: theme.spacing(2, 2),
|
|
61
|
+
textAlign: 'left',
|
|
62
|
+
textTransform: 'none',
|
|
63
|
+
borderRadius: 0,
|
|
64
|
+
backgroundColor: isExpanded ? theme.palette.custom?.tabBackgroundColor || theme.palette.accent.main : 'transparent',
|
|
65
|
+
'&:hover': {
|
|
66
|
+
backgroundColor: isExpanded ? theme.palette.custom?.tabBackgroundColor || theme.palette.accent.main : 'rgba(77, 48, 25, 0.05)',
|
|
67
|
+
},
|
|
68
|
+
}));
|
|
69
|
+
const MobileTabContent = material.styled(material.Box)(({ theme }) => ({
|
|
70
|
+
padding: theme.spacing(2, 2, 3, 2),
|
|
71
|
+
color: '#4D3019',
|
|
72
|
+
backgroundColor: theme.palette.custom?.tabBackgroundColor || theme.palette.accent.main,
|
|
73
|
+
}));
|
|
74
|
+
const Tabs = ({ tabs, defaultTab }) => {
|
|
75
|
+
const [activeTab, setActiveTab] = React.useState(defaultTab || tabs[0]?.id);
|
|
76
|
+
const [mobileExpandedTab, setMobileExpandedTab] = React.useState(null);
|
|
77
|
+
const activeTabContent = tabs.find(tab => tab.id === activeTab)?.content;
|
|
78
|
+
const handleMobileTabClick = (tabId) => {
|
|
79
|
+
setActiveTab(tabId);
|
|
80
|
+
setMobileExpandedTab(mobileExpandedTab === tabId ? null : tabId);
|
|
81
|
+
};
|
|
82
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(TabsContainer, { children: [jsxRuntime.jsx(TabButtonsWrapper, { children: tabs.map((tab) => (jsxRuntime.jsx(TabButton, { onClick: () => setActiveTab(tab.id), isActive: activeTab === tab.id, children: tab.label }, tab.id))) }), jsxRuntime.jsx(TabContent, { children: activeTabContent })] }), jsxRuntime.jsx(MobileContainer, { children: tabs.map((tab, index) => (jsxRuntime.jsxs(material.Box, { sx: {
|
|
83
|
+
borderTop: index !== 0 ? '2px solid #e5e7eb' : 'none',
|
|
84
|
+
}, children: [jsxRuntime.jsxs(MobileTabButton, { onClick: () => handleMobileTabClick(tab.id), isExpanded: mobileExpandedTab === tab.id, children: [jsxRuntime.jsx(material.Box, { component: "span", sx: {
|
|
85
|
+
fontSize: '16px',
|
|
86
|
+
fontWeight: 500,
|
|
87
|
+
color: activeTab === tab.id ? '#4D3019' : '#826E5C',
|
|
88
|
+
}, children: tab.label }), jsxRuntime.jsx(iconsMaterial.ExpandMoreRounded, { sx: {
|
|
89
|
+
fontSize: 20,
|
|
90
|
+
color: activeTab === tab.id ? '#4D3019' : '#826E5C',
|
|
91
|
+
transform: mobileExpandedTab === tab.id ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
92
|
+
transition: 'transform 0.2s',
|
|
93
|
+
} })] }), jsxRuntime.jsx(material.Collapse, { in: mobileExpandedTab === tab.id, children: jsxRuntime.jsx(MobileTabContent, { children: tab.content }) })] }, tab.id))) })] }));
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
exports.Tabs = Tabs;
|
|
97
|
+
//# sourceMappingURL=Tabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tabs.js","sources":["../../../../src/components/Tabs.tsx"],"sourcesContent":["'use client';\n\nimport React, { useState } from 'react';\nimport { Box, Button, Collapse, styled } from '@mui/material';\nimport { ExpandMoreRounded } from '@mui/icons-material';\n\ninterface Tab {\n id: string;\n label: string;\n content: React.ReactNode;\n}\n\ninterface TabsProps {\n tabs: Tab[];\n defaultTab?: string;\n}\n\nconst TabsContainer = styled(Box)({\n display: 'none',\n '@media (min-width: 900px)': {\n display: 'block',\n },\n});\n\nconst TabButtonsWrapper = styled(Box)({\n display: 'flex',\n gap: '4px',\n backgroundColor: '#FDFCEE',\n});\n\nconst TabButton = styled(Button)<{ isActive: boolean }>(({ theme, isActive }) => ({\n padding: theme.spacing(2, 3),\n fontSize: '16px',\n fontWeight: 500,\n textTransform: 'none',\n color: isActive ? '#4D3019' : '#826E5C',\n backgroundColor: isActive ? theme.palette.custom?.tabBackgroundColor || theme.palette.accent.main : 'transparent',\n borderRadius: 0,\n position: 'relative',\n minWidth: 'auto',\n '&:hover': {\n backgroundColor: isActive ? theme.palette.custom?.tabBackgroundColor || theme.palette.accent.main : 'rgba(77, 48, 25, 0.05)',\n color: '#4D3019',\n },\n '&::after': isActive ? {\n content: '\"\"',\n position: 'absolute',\n bottom: 0,\n left: 0,\n right: 0,\n height: '4px',\n backgroundColor: theme.palette.primary.main,\n } : {},\n}));\n\nconst TabContent = styled(Box)(({ theme }) => ({\n padding: theme.spacing(3),\n color: '#4D3019',\n backgroundColor: theme.palette.custom?.tabBackgroundColor || theme.palette.accent.main,\n}));\n\nconst MobileContainer = styled(Box)({\n backgroundColor: '#FDFCEE',\n '@media (min-width: 900px)': {\n display: 'none',\n },\n});\n\nconst MobileTabButton = styled(Button)<{ isExpanded: boolean }>(({ theme, isExpanded }) => ({\n width: '100%',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n padding: theme.spacing(2, 2),\n textAlign: 'left',\n textTransform: 'none',\n borderRadius: 0,\n backgroundColor: isExpanded ? theme.palette.custom?.tabBackgroundColor || theme.palette.accent.main : 'transparent',\n '&:hover': {\n backgroundColor: isExpanded ? theme.palette.custom?.tabBackgroundColor || theme.palette.accent.main : 'rgba(77, 48, 25, 0.05)',\n },\n}));\n\nconst MobileTabContent = styled(Box)(({ theme }) => ({\n padding: theme.spacing(2, 2, 3, 2),\n color: '#4D3019',\n backgroundColor: theme.palette.custom?.tabBackgroundColor || theme.palette.accent.main,\n}));\n\nexport const Tabs: React.FC<TabsProps> = ({ tabs, defaultTab }) => {\n const [activeTab, setActiveTab] = useState(defaultTab || tabs[0]?.id);\n const [mobileExpandedTab, setMobileExpandedTab] = useState<string | null>(null);\n\n const activeTabContent = tabs.find(tab => tab.id === activeTab)?.content;\n\n const handleMobileTabClick = (tabId: string) => {\n setActiveTab(tabId);\n setMobileExpandedTab(mobileExpandedTab === tabId ? null : tabId);\n };\n\n return (\n <>\n {/* Desktop View */}\n <TabsContainer>\n <TabButtonsWrapper>\n {tabs.map((tab) => (\n <TabButton\n key={tab.id}\n onClick={() => setActiveTab(tab.id)}\n isActive={activeTab === tab.id}\n >\n {tab.label}\n </TabButton>\n ))}\n </TabButtonsWrapper>\n <TabContent>\n {activeTabContent}\n </TabContent>\n </TabsContainer>\n\n {/* Mobile View - Accordion */}\n <MobileContainer>\n {tabs.map((tab, index) => (\n <Box\n key={tab.id}\n sx={{\n borderTop: index !== 0 ? '2px solid #e5e7eb' : 'none',\n }}\n >\n <MobileTabButton\n onClick={() => handleMobileTabClick(tab.id)}\n isExpanded={mobileExpandedTab === tab.id}\n >\n <Box\n component=\"span\"\n sx={{\n fontSize: '16px',\n fontWeight: 500,\n color: activeTab === tab.id ? '#4D3019' : '#826E5C',\n }}\n >\n {tab.label}\n </Box>\n <ExpandMoreRounded\n sx={{\n fontSize: 20,\n color: activeTab === tab.id ? '#4D3019' : '#826E5C',\n transform: mobileExpandedTab === tab.id ? 'rotate(180deg)' : 'rotate(0deg)',\n transition: 'transform 0.2s',\n }}\n />\n </MobileTabButton>\n <Collapse in={mobileExpandedTab === tab.id}>\n <MobileTabContent>\n {tab.content}\n </MobileTabContent>\n </Collapse>\n </Box>\n ))}\n </MobileContainer>\n </>\n );\n};"],"names":[],"mappings":";;;;;;;;AAiBA;AACE;AACA;AACE;AACD;AACF;AAED;AACE;AACA;AACA;AACD;AAED;;AAEE;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEE;AACD;AACD;AACE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEH;AAED;AACE;AACA;AACA;AACD;AAED;AACE;AACA;AACE;AACD;AACF;AAED;AACE;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEC;AACF;AAED;AACE;AACA;AACA;AACD;AAEM;AACL;;AAGA;AAEA;;AAEE;AACF;AAEA;;AA2BW;AASK;AACA;AACA;;AAOA;AACA;AACA;AACA;AACD;AAajB;;"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var material = require('@mui/material');
|
|
7
|
+
|
|
8
|
+
const ToggleButton = material.styled(material.Box)(({ theme }) => ({
|
|
9
|
+
display: 'inline-flex',
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
gap: theme.spacing(1.5),
|
|
12
|
+
padding: theme.spacing(0.75, 1.5),
|
|
13
|
+
borderRadius: (typeof theme.shape.borderRadius === 'string'
|
|
14
|
+
? parseInt(theme.shape.borderRadius, 10)
|
|
15
|
+
: theme.shape.borderRadius || 4) * 2,
|
|
16
|
+
backgroundColor: '#fff',
|
|
17
|
+
border: `1px solid ${theme.palette.dark.main}33`,
|
|
18
|
+
cursor: 'pointer',
|
|
19
|
+
transition: 'border-color 0.2s',
|
|
20
|
+
'&:hover': {
|
|
21
|
+
borderColor: `${theme.palette.dark.main}4D`,
|
|
22
|
+
},
|
|
23
|
+
}));
|
|
24
|
+
const ToggleTrack = material.styled(material.Box)(({ theme, isChecked }) => ({
|
|
25
|
+
position: 'relative',
|
|
26
|
+
width: '56px',
|
|
27
|
+
height: '32px',
|
|
28
|
+
borderRadius: '9999px',
|
|
29
|
+
backgroundColor: isChecked ? theme.palette.secondary.main : '#e5e7eb',
|
|
30
|
+
transition: 'background-color 0.2s',
|
|
31
|
+
}));
|
|
32
|
+
const ToggleThumb = material.styled(material.Box)(({ isChecked }) => ({
|
|
33
|
+
position: 'absolute',
|
|
34
|
+
top: '4px',
|
|
35
|
+
width: '24px',
|
|
36
|
+
height: '24px',
|
|
37
|
+
backgroundColor: '#fff',
|
|
38
|
+
borderRadius: '9999px',
|
|
39
|
+
transition: 'transform 0.2s',
|
|
40
|
+
transform: isChecked ? 'translateX(28px)' : 'translateX(4px)',
|
|
41
|
+
}));
|
|
42
|
+
const Toggle = ({ label = 'Admin view', checked = false, onChange, }) => {
|
|
43
|
+
const [isChecked, setIsChecked] = React.useState(checked);
|
|
44
|
+
const handleToggle = () => {
|
|
45
|
+
const newValue = !isChecked;
|
|
46
|
+
setIsChecked(newValue);
|
|
47
|
+
onChange?.(newValue);
|
|
48
|
+
};
|
|
49
|
+
React.useEffect(() => {
|
|
50
|
+
setIsChecked(checked);
|
|
51
|
+
}, [checked]);
|
|
52
|
+
return (jsxRuntime.jsxs(ToggleButton, { onClick: handleToggle, children: [jsxRuntime.jsx(ToggleTrack, { isChecked: isChecked, children: jsxRuntime.jsx(ToggleThumb, { isChecked: isChecked }) }), jsxRuntime.jsx(material.Typography, { sx: {
|
|
53
|
+
color: '#4D3019',
|
|
54
|
+
fontWeight: 500,
|
|
55
|
+
fontSize: '0.875rem',
|
|
56
|
+
}, children: label })] }));
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
exports.Toggle = Toggle;
|
|
60
|
+
//# sourceMappingURL=Toggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toggle.js","sources":["../../../../src/components/Toggle.tsx"],"sourcesContent":["'use client';\n\nimport React, { useState } from 'react';\nimport { Box, Typography, styled } from '@mui/material';\n\ninterface ToggleProps {\n label?: string;\n checked?: boolean;\n onChange?: (checked: boolean) => void;\n}\n\nconst ToggleButton = styled(Box)(({ theme }) => ({\n display: 'inline-flex',\n alignItems: 'center',\n gap: theme.spacing(1.5),\n padding: theme.spacing(0.75, 1.5),\n borderRadius: (typeof theme.shape.borderRadius === 'string'\n ? parseInt(theme.shape.borderRadius, 10)\n : theme.shape.borderRadius || 4) * 2,\n backgroundColor: '#fff',\n border: `1px solid ${theme.palette.dark.main}33`,\n cursor: 'pointer',\n transition: 'border-color 0.2s',\n '&:hover': {\n borderColor: `${theme.palette.dark.main}4D`,\n },\n}));\n\nconst ToggleTrack = styled(Box)<{ isChecked: boolean }>(({ theme, isChecked }) => ({\n position: 'relative',\n width: '56px',\n height: '32px',\n borderRadius: '9999px',\n backgroundColor: isChecked ? theme.palette.secondary.main : '#e5e7eb',\n transition: 'background-color 0.2s',\n}));\n\nconst ToggleThumb = styled(Box)<{ isChecked: boolean }>(({ isChecked }) => ({\n position: 'absolute',\n top: '4px',\n width: '24px',\n height: '24px',\n backgroundColor: '#fff',\n borderRadius: '9999px',\n transition: 'transform 0.2s',\n transform: isChecked ? 'translateX(28px)' : 'translateX(4px)',\n}));\n\nexport const Toggle: React.FC<ToggleProps> = ({\n label = 'Admin view',\n checked = false,\n onChange,\n}) => {\n const [isChecked, setIsChecked] = useState(checked);\n\n const handleToggle = () => {\n const newValue = !isChecked;\n setIsChecked(newValue);\n onChange?.(newValue);\n };\n\n React.useEffect(() => {\n setIsChecked(checked);\n }, [checked]);\n\n return (\n <ToggleButton onClick={handleToggle}>\n <ToggleTrack isChecked={isChecked}>\n <ToggleThumb isChecked={isChecked} />\n </ToggleTrack>\n <Typography\n sx={{\n color: '#4D3019',\n fontWeight: 500,\n fontSize: '0.875rem',\n }}\n >\n {label}\n </Typography>\n </ToggleButton>\n );\n};"],"names":[],"mappings":";;;;;;;AAWA;AACE;AACA;AACA;;;;;AAKA;;AAEA;AACA;AACA;;AAEC;AACF;AAED;AACE;AACA;AACA;AACA;AACA;AACA;AACD;AAED;AACE;AACA;AACA;AACA;AACA;AACA;AACA;;AAED;AAEM;;;AAQH;;AAEA;AACF;AAEA;;AAEA;AAEA;AAOQ;AACA;AACA;AACD;AAMT;;"}
|