@local-civics/mgmt-ui 0.1.74 → 0.1.75
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/index.d.ts +7 -23
- package/dist/index.js +11 -68
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -70
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
-
import { createStyles,
|
|
4
|
-
import { IconSwitchHorizontal, IconLogout, IconHome2, IconGauge, IconCategory2, IconAlbum, IconLambda,
|
|
3
|
+
import { createStyles, Group, Avatar, Text, Box, Badge as Badge$1, ThemeIcon, Collapse, Navbar as Navbar$1, Center, Image, Code, Burger, ScrollArea, UnstyledButton, Card, Modal, Loader, SimpleGrid, Tabs as Tabs$1, Button, Menu, ActionIcon, Title, Grid, Table as Table$h, Container, Stack as Stack$3, LoadingOverlay, Select, Autocomplete, Drawer, Divider, TextInput, Tooltip, Paper, Overlay, Anchor, Progress, Checkbox, createEmotionCache, MantineProvider, AppShell } from '@mantine/core';
|
|
4
|
+
import { IconChevronRight, IconChevronLeft, IconSwitchHorizontal, IconLogout, IconHome2, IconGauge, IconCategory2, IconAlbum, IconLambda, IconBuilding, IconBatteryEco, IconBooks, IconBackpack, IconChevronDown, IconClipboardCopy, IconTableExport, IconArrowLeft, IconPlaylistAdd, IconCheck, IconTrash, IconDownload, IconX, IconCloudUpload, IconInfoCircle, IconColorSwatch, IconPointer, IconBadge, IconCopy, IconHistory, IconLego, IconNews, IconTools, IconPodium, IconAffiliate, IconGrowth, IconBrandInstagram, IconBrandLinkedin, IconBrandFacebook } from '@tabler/icons';
|
|
5
5
|
import { Link } from 'react-router-dom';
|
|
6
6
|
import { NotificationsProvider } from '@mantine/notifications';
|
|
7
7
|
export { showNotification, updateNotification } from '@mantine/notifications';
|
|
@@ -14,65 +14,6 @@ import { Chart } from 'react-charts';
|
|
|
14
14
|
import AvatarInit from 'avatar-initials';
|
|
15
15
|
import { useUncontrolled } from '@mantine/hooks';
|
|
16
16
|
|
|
17
|
-
const useStyles$p = createStyles((theme) => ({
|
|
18
|
-
link: {
|
|
19
|
-
width: 50,
|
|
20
|
-
height: 50,
|
|
21
|
-
borderRadius: theme.radius.md,
|
|
22
|
-
display: "flex",
|
|
23
|
-
alignItems: "center",
|
|
24
|
-
justifyContent: "center",
|
|
25
|
-
color: theme.colorScheme === "dark" ? theme.colors.dark[0] : theme.colors.gray[7],
|
|
26
|
-
"&:hover": {
|
|
27
|
-
backgroundColor: theme.colorScheme === "dark" ? theme.colors.dark[5] : theme.colors.gray[0]
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
active: {
|
|
31
|
-
"&, &:hover": {
|
|
32
|
-
backgroundColor: theme.fn.variant({ variant: "light", color: theme.primaryColor }).background,
|
|
33
|
-
color: theme.fn.variant({ variant: "light", color: theme.primaryColor }).color
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}));
|
|
37
|
-
const data$1 = [
|
|
38
|
-
{ icon: IconHome2, label: "Home", href: "/home" },
|
|
39
|
-
{ icon: IconGauge, label: "Dashboard", href: "/dashboard" },
|
|
40
|
-
{ icon: IconCategory2, label: "Classes", href: "/classes" },
|
|
41
|
-
{ icon: IconAlbum, label: "Badges", href: "/badges" },
|
|
42
|
-
{ icon: IconLambda, label: "Lessons", href: "/lessons" }
|
|
43
|
-
];
|
|
44
|
-
const NavbarLink = ({ icon: Icon, label, active, onClick }) => {
|
|
45
|
-
const { classes, cx } = useStyles$p();
|
|
46
|
-
return /* @__PURE__ */ React.createElement(Tooltip, { label, position: "right", transitionDuration: 0 }, /* @__PURE__ */ React.createElement(UnstyledButton, { onClick, className: cx(classes.link, { [classes.active]: active }) }, /* @__PURE__ */ React.createElement(Icon, { stroke: 1.5 })));
|
|
47
|
-
};
|
|
48
|
-
const Navbar = (props) => {
|
|
49
|
-
const links = data$1.map((link) => /* @__PURE__ */ React.createElement(
|
|
50
|
-
NavbarLink,
|
|
51
|
-
{
|
|
52
|
-
key: link.label,
|
|
53
|
-
label: link.label,
|
|
54
|
-
icon: link.icon,
|
|
55
|
-
active: link.label === props.active,
|
|
56
|
-
onClick: () => props.navigate(link.href)
|
|
57
|
-
}
|
|
58
|
-
));
|
|
59
|
-
return /* @__PURE__ */ React.createElement(Navbar$1, { width: { base: 80 }, p: "md" }, /* @__PURE__ */ React.createElement(Center, null, /* @__PURE__ */ React.createElement(Avatar, { color: "blue", radius: "sm" }, /* @__PURE__ */ React.createElement("div", { style: { width: 15, marginLeft: "auto", marginRight: "auto" } }, /* @__PURE__ */ React.createElement(Image, { fit: "contain", src: "https://cdn.localcivics.io/brand/l.png" })))), /* @__PURE__ */ React.createElement(Navbar$1.Section, { grow: true, mt: 50 }, /* @__PURE__ */ React.createElement(Stack$3, { justify: "center", spacing: 0 }, links)), /* @__PURE__ */ React.createElement(Navbar$1.Section, null, /* @__PURE__ */ React.createElement(Stack$3, { justify: "center", spacing: 0 }, /* @__PURE__ */ React.createElement(
|
|
60
|
-
NavbarLink,
|
|
61
|
-
{
|
|
62
|
-
icon: IconSwitchHorizontal,
|
|
63
|
-
label: "Switch accounts",
|
|
64
|
-
onClick: props.onSwitchAccounts
|
|
65
|
-
}
|
|
66
|
-
), /* @__PURE__ */ React.createElement(
|
|
67
|
-
NavbarLink,
|
|
68
|
-
{
|
|
69
|
-
icon: IconLogout,
|
|
70
|
-
label: "Logout",
|
|
71
|
-
onClick: props.onLogout
|
|
72
|
-
}
|
|
73
|
-
))));
|
|
74
|
-
};
|
|
75
|
-
|
|
76
17
|
var __defProp$9 = Object.defineProperty;
|
|
77
18
|
var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
|
|
78
19
|
var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
|
|
@@ -333,7 +274,7 @@ const data = [
|
|
|
333
274
|
]
|
|
334
275
|
}
|
|
335
276
|
];
|
|
336
|
-
function
|
|
277
|
+
function Navbar(props) {
|
|
337
278
|
const { classes, cx } = useStyles$m();
|
|
338
279
|
const [burgerOpen, setBurgerOpen] = React.useState(false);
|
|
339
280
|
const toggle = () => setBurgerOpen(!burgerOpen);
|
|
@@ -2836,17 +2777,17 @@ var __spreadValues = (a, b) => {
|
|
|
2836
2777
|
return a;
|
|
2837
2778
|
};
|
|
2838
2779
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
2839
|
-
const useStyles = createStyles((theme) => ({
|
|
2780
|
+
const useStyles = createStyles((theme, props) => ({
|
|
2840
2781
|
footer: {
|
|
2841
2782
|
paddingTop: theme.spacing.md,
|
|
2842
2783
|
paddingBottom: theme.spacing.md,
|
|
2843
|
-
paddingLeft: theme.spacing.md,
|
|
2784
|
+
paddingLeft: props.navbar ? theme.spacing.md : 0,
|
|
2844
2785
|
backgroundColor: theme.colorScheme === "dark" ? theme.colors.dark[6] : theme.colors.gray[0],
|
|
2845
2786
|
borderTop: `1px solid ${theme.colorScheme === "dark" ? theme.colors.dark[5] : theme.colors.gray[2]}`,
|
|
2846
2787
|
[theme.fn.largerThan("sm")]: {
|
|
2847
2788
|
paddingTop: theme.spacing.xl * 2,
|
|
2848
2789
|
paddingBottom: theme.spacing.xl * 2,
|
|
2849
|
-
paddingLeft: theme.spacing.xl * 13
|
|
2790
|
+
paddingLeft: props.navbar ? theme.spacing.xl * 13 : 0
|
|
2850
2791
|
}
|
|
2851
2792
|
},
|
|
2852
2793
|
logo: {
|
|
@@ -2918,14 +2859,14 @@ const useStyles = createStyles((theme) => ({
|
|
|
2918
2859
|
}
|
|
2919
2860
|
}));
|
|
2920
2861
|
const App = (props) => {
|
|
2921
|
-
const { classes } = useStyles();
|
|
2862
|
+
const { classes } = useStyles(props);
|
|
2922
2863
|
const account = useAccount(props.account, props.accounts, props.onAccountChange);
|
|
2923
2864
|
return /* @__PURE__ */ React.createElement(
|
|
2924
2865
|
AppShell,
|
|
2925
2866
|
{
|
|
2926
2867
|
padding: "xs",
|
|
2927
|
-
navbar: /* @__PURE__ */ React.createElement(
|
|
2928
|
-
|
|
2868
|
+
navbar: props.navbar && /* @__PURE__ */ React.createElement(
|
|
2869
|
+
Navbar,
|
|
2929
2870
|
__spreadProps(__spreadValues({}, props.navbar.props), {
|
|
2930
2871
|
onSwitchAccounts: account.accounts && account.accounts.length > 1 ? () => account.setChangeModalOpen(true) : void 0
|
|
2931
2872
|
})
|
|
@@ -2972,7 +2913,7 @@ const App = (props) => {
|
|
|
2972
2913
|
})
|
|
2973
2914
|
},
|
|
2974
2915
|
/* @__PURE__ */ React.createElement("div", { style: { position: "relative" } }, (props.loading || account.opened) && /* @__PURE__ */ React.createElement(Center, { style: { height: 400 } }, /* @__PURE__ */ React.createElement(Loader, null)), !props.loading && !account.opened && props.page),
|
|
2975
|
-
/* @__PURE__ */ React.createElement(
|
|
2916
|
+
!!account.accounts && !!account.account && /* @__PURE__ */ React.createElement(
|
|
2976
2917
|
SwitchAccount,
|
|
2977
2918
|
{
|
|
2978
2919
|
opened: account.opened,
|
|
@@ -3001,6 +2942,9 @@ const useAccount = (account, accounts, onAccountChange) => {
|
|
|
3001
2942
|
setChangeModalOpen,
|
|
3002
2943
|
onAccountChange: (account2) => {
|
|
3003
2944
|
setLoading(true);
|
|
2945
|
+
if (!onAccountChange) {
|
|
2946
|
+
return;
|
|
2947
|
+
}
|
|
3004
2948
|
onAccountChange(account2).then(() => {
|
|
3005
2949
|
setActive(account2);
|
|
3006
2950
|
setLoading(false);
|
|
@@ -3010,5 +2954,5 @@ const useAccount = (account, accounts, onAccountChange) => {
|
|
|
3010
2954
|
};
|
|
3011
2955
|
};
|
|
3012
2956
|
|
|
3013
|
-
export { AdminProvider, App, Badge, Badges, Class, Classes, Dashboard, Home, Lesson, Lessons, Navbar,
|
|
2957
|
+
export { AdminProvider, App, Badge, Badges, Class, Classes, Dashboard, Home, Lesson, Lessons, Navbar, Organization, People, StartAnonymousLesson, Student, SwitchAccount, TrialHome, TrialRegistration };
|
|
3014
2958
|
//# sourceMappingURL=index.mjs.map
|