@variocube/app-ui 1.14.5 → 1.16.0
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/esm/AppShell/AppShell.js +12 -12
- package/esm/AppShell/AppShell.js.map +1 -1
- package/esm/AppShell/index.js.map +1 -1
- package/esm/Input/ActionsMenu.js +1 -1
- package/esm/Input/ActionsMenu.js.map +1 -1
- package/esm/Input/EmailSenderField.js +3 -3
- package/esm/Input/EmailSenderField.js.map +1 -1
- package/esm/Input/Selector.js +2 -2
- package/esm/Input/Selector.js.map +1 -1
- package/esm/Paging/Paging.d.ts +1 -1
- package/esm/Paging/Paging.js +5 -5
- package/esm/Paging/Paging.js.map +1 -1
- package/esm/Paging/index.d.ts +2 -1
- package/esm/Paging/index.js.map +1 -1
- package/esm/VCThemeProvider/JetbrainsMonoFont.js +8 -8
- package/esm/VCThemeProvider/JetbrainsMonoFont.js.map +1 -1
- package/esm/VCThemeProvider/RobotoFont.js +8 -8
- package/esm/VCThemeProvider/RobotoFont.js.map +1 -1
- package/esm/VCThemeProvider/ThemeModeSwitcher.js +5 -5
- package/esm/VCThemeProvider/ThemeModeSwitcher.js.map +1 -1
- package/esm/VCThemeProvider/VCThemeProvider.d.ts +1 -1
- package/esm/VCThemeProvider/VCThemeProvider.js +21 -21
- package/esm/VCThemeProvider/VCThemeProvider.js.map +1 -1
- package/esm/audit/AuditChanges.js +9 -5
- package/esm/audit/AuditChanges.js.map +1 -1
- package/esm/audit/AuditTimeline.js +1 -1
- package/esm/audit/AuditTimeline.js.map +1 -1
- package/esm/audit/AuditTimelineItem.js +3 -3
- package/esm/audit/AuditTimelineItem.js.map +1 -1
- package/esm/audit/index.d.ts +1 -1
- package/esm/audit/index.js +1 -1
- package/esm/audit/index.js.map +1 -1
- package/esm/breadcrumbs.d.ts +2 -2
- package/esm/breadcrumbs.js +3 -3
- package/esm/breadcrumbs.js.map +1 -1
- package/esm/code/CodeBlock.d.ts +1 -1
- package/esm/code/CodeBlock.js +1 -1
- package/esm/code/CodeBlock.js.map +1 -1
- package/esm/confirm/ConfirmButton.js.map +1 -1
- package/esm/confirm/ConfirmDialog.js +1 -1
- package/esm/confirm/ConfirmDialog.js.map +1 -1
- package/esm/confirm/ConfirmMenuItem.js +1 -1
- package/esm/confirm/ConfirmMenuItem.js.map +1 -1
- package/esm/container/ContainerLayout.d.ts +1 -1
- package/esm/container/ContainerLayout.js +5 -5
- package/esm/container/ContainerLayout.js.map +1 -1
- package/esm/container/ContainerSettingsContext.d.ts +2 -2
- package/esm/container/ContainerSettingsContext.js +6 -6
- package/esm/container/ContainerSettingsContext.js.map +1 -1
- package/esm/container/ContainerWidthControl.js +2 -2
- package/esm/container/ContainerWidthControl.js.map +1 -1
- package/esm/container/index.d.ts +1 -1
- package/esm/container/index.js +1 -1
- package/esm/container/index.js.map +1 -1
- package/esm/content-table/ContentTable.d.ts +1 -1
- package/esm/content-table/ContentTable.js +26 -19
- package/esm/content-table/ContentTable.js.map +1 -1
- package/esm/content-table/UndrawEmpty.js.map +1 -1
- package/esm/content-table/index.js.map +1 -1
- package/esm/country/country-select.js.map +1 -1
- package/esm/country/index.d.ts +3 -3
- package/esm/country/index.js +3 -3
- package/esm/country/index.js.map +1 -1
- package/esm/country/locale-select.js +1 -1
- package/esm/country/locale-select.js.map +1 -1
- package/esm/country/locales.js +1 -1
- package/esm/country/locales.js.map +1 -1
- package/esm/country/phone-prefix-select.js +1 -1
- package/esm/country/phone-prefix-select.js.map +1 -1
- package/esm/cube/accessibility.js +2 -1
- package/esm/cube/accessibility.js.map +1 -1
- package/esm/data-table/DataTableColumnSettings.d.ts +1 -1
- package/esm/data-table/DataTableColumnSettings.js +2 -2
- package/esm/data-table/DataTableColumnSettings.js.map +1 -1
- package/esm/data-table/DataTableHeader.js +1 -1
- package/esm/data-table/DataTableHeader.js.map +1 -1
- package/esm/data-table/DataTableToolbar.js +1 -1
- package/esm/data-table/DataTableToolbar.js.map +1 -1
- package/esm/data-table/index.d.ts +4 -4
- package/esm/data-table/index.js +4 -4
- package/esm/data-table/index.js.map +1 -1
- package/esm/data-table/useDataTableColumnStorage.d.ts +9 -1
- package/esm/data-table/useDataTableColumnStorage.js +12 -5
- package/esm/data-table/useDataTableColumnStorage.js.map +1 -1
- package/esm/data-table/useDataTableStorage.d.ts +31 -6
- package/esm/data-table/useDataTableStorage.js +25 -5
- package/esm/data-table/useDataTableStorage.js.map +1 -1
- package/esm/date-pickers/PlainAdapterCommon.d.ts +1 -1
- package/esm/date-pickers/PlainAdapterCommon.js.map +1 -1
- package/esm/date-pickers/PlainDateAdapter.js.map +1 -1
- package/esm/date-pickers/PlainDatePicker.js +1 -1
- package/esm/date-pickers/PlainDatePicker.js.map +1 -1
- package/esm/date-pickers/PlainDatePicker.spec.js +2 -2
- package/esm/date-pickers/PlainDatePicker.spec.js.map +1 -1
- package/esm/date-pickers/PlainDateTimeAdapter.js.map +1 -1
- package/esm/date-pickers/PlainDateTimePicker.js +2 -2
- package/esm/date-pickers/PlainDateTimePicker.js.map +1 -1
- package/esm/date-pickers/PlainDateTimePicker.spec.js +2 -2
- package/esm/date-pickers/PlainDateTimePicker.spec.js.map +1 -1
- package/esm/date-pickers/PlainTimeAdapter.js.map +1 -1
- package/esm/date-pickers/PlainTimePicker.js +2 -2
- package/esm/date-pickers/PlainTimePicker.js.map +1 -1
- package/esm/date-pickers/PlainTimePicker.spec.js +2 -2
- package/esm/date-pickers/PlainTimePicker.spec.js.map +1 -1
- package/esm/date-pickers/TemporalAdapter.d.ts +1 -1
- package/esm/date-pickers/TemporalAdapter.js +1 -1
- package/esm/date-pickers/TemporalAdapter.js.map +1 -1
- package/esm/date-pickers/TimezoneSelect.js +348 -348
- package/esm/date-pickers/TimezoneSelect.js.map +1 -1
- package/esm/date-pickers/getFormatString.js.map +1 -1
- package/esm/date-pickers/index.d.ts +2 -1
- package/esm/date-pickers/index.js +1 -1
- package/esm/date-pickers/index.js.map +1 -1
- package/esm/date-pickers/parse.js.map +1 -1
- package/esm/date-pickers/timeframe-picker.js +7 -7
- package/esm/date-pickers/timeframe-picker.js.map +1 -1
- package/esm/date-pickers/useLocale.js.map +1 -1
- package/esm/date-pickers/useRenderInput.js +5 -3
- package/esm/date-pickers/useRenderInput.js.map +1 -1
- package/esm/fetch.d.ts +2 -3
- package/esm/fetch.js +4 -4
- package/esm/fetch.js.map +1 -1
- package/esm/formats/CompactFormat.js +1 -1
- package/esm/formats/CompactFormat.js.map +1 -1
- package/esm/formats/CompactFormat.spec.js +1 -1
- package/esm/formats/CompactFormat.spec.js.map +1 -1
- package/esm/formats/CurrencyFormat.js +1 -1
- package/esm/formats/CurrencyFormat.js.map +1 -1
- package/esm/formats/CurrencyFormat.spec.js +1 -1
- package/esm/formats/CurrencyFormat.spec.js.map +1 -1
- package/esm/formats/DecimalFormat.js +1 -1
- package/esm/formats/DecimalFormat.js.map +1 -1
- package/esm/formats/DecimalFormat.spec.js +1 -1
- package/esm/formats/DecimalFormat.spec.js.map +1 -1
- package/esm/formats/DurationFormat.js +2 -2
- package/esm/formats/DurationFormat.js.map +1 -1
- package/esm/formats/DurationFormat.spec.js +2 -2
- package/esm/formats/DurationFormat.spec.js.map +1 -1
- package/esm/formats/TemporalFormat.spec.js +2 -2
- package/esm/formats/TemporalFormat.spec.js.map +1 -1
- package/esm/formats/TemporalRangeFormat.js +1 -1
- package/esm/formats/TemporalRangeFormat.js.map +1 -1
- package/esm/formats/TemporalRangeFormat.spec.js +2 -2
- package/esm/formats/TemporalRangeFormat.spec.js.map +1 -1
- package/esm/formats/useDateTimeFormat.js +5 -2
- package/esm/formats/useDateTimeFormat.js.map +1 -1
- package/esm/formats/useNumberFormat.js +1 -1
- package/esm/formats/useNumberFormat.js.map +1 -1
- package/esm/formats/useRelativeTimeFormat.js +4 -2
- package/esm/formats/useRelativeTimeFormat.js.map +1 -1
- package/esm/forms/SearchForm.js +1 -1
- package/esm/forms/SearchForm.js.map +1 -1
- package/esm/getNavigatorLanguages.js.map +1 -1
- package/esm/getSupportedFormatLocale.js.map +1 -1
- package/esm/help/HelpDrawer.js +12 -8
- package/esm/help/HelpDrawer.js.map +1 -1
- package/esm/help/index.d.ts +1 -1
- package/esm/help/index.js +1 -1
- package/esm/help/index.js.map +1 -1
- package/esm/icons.d.ts +13 -13
- package/esm/icons.js +13 -13
- package/esm/icons.js.map +1 -1
- package/esm/layout/ErrorBoundary.js +36 -36
- package/esm/layout/ErrorBoundary.js.map +1 -1
- package/esm/layout/NotFound.js +6 -6
- package/esm/layout/NotFound.js.map +1 -1
- package/esm/layout/NotFoundSvg.js.map +1 -1
- package/esm/layout/UserNav.js +18 -18
- package/esm/layout/UserNav.js.map +1 -1
- package/esm/layout/index.d.ts +2 -2
- package/esm/layout/index.js +2 -2
- package/esm/layout/index.js.map +1 -1
- package/esm/logo/Logo.js +2 -2
- package/esm/logo/Logo.js.map +1 -1
- package/esm/logo/VCAppLogo.js +1 -1
- package/esm/logo/VCAppLogo.js.map +1 -1
- package/esm/logo/index.d.ts +3 -3
- package/esm/logo/index.js +3 -3
- package/esm/logo/index.js.map +1 -1
- package/esm/splash/index.js +2 -2
- package/esm/splash/index.js.map +1 -1
- package/esm/storage/MemoryStorage.d.ts +6 -4
- package/esm/storage/MemoryStorage.js +13 -4
- package/esm/storage/MemoryStorage.js.map +1 -1
- package/esm/storage/index.d.ts +2 -1
- package/esm/storage/index.js +1 -1
- package/esm/storage/index.js.map +1 -1
- package/esm/storage/storage.d.ts +6 -4
- package/esm/storage/storage.js +35 -15
- package/esm/storage/storage.js.map +1 -1
- package/esm/storage/types.d.ts +6 -0
- package/esm/storage/types.js +2 -0
- package/esm/storage/types.js.map +1 -0
- package/esm/storage/useStorage.d.ts +10 -1
- package/esm/storage/useStorage.js +18 -6
- package/esm/storage/useStorage.js.map +1 -1
- package/esm/tabs/Tabs.d.ts +2 -2
- package/esm/tabs/Tabs.js +15 -15
- package/esm/tabs/Tabs.js.map +1 -1
- package/esm/tabs/index.js.map +1 -1
- package/esm/temporal/index.d.ts +1 -1
- package/esm/temporal/index.js +1 -1
- package/esm/temporal/index.js.map +1 -1
- package/esm/temporal/parse.js.map +1 -1
- package/esm/temporal/polyfill.d.ts +1 -1
- package/esm/temporal/polyfill.js +3 -3
- package/esm/temporal/polyfill.js.map +1 -1
- package/esm/utils/defined.js.map +1 -1
- package/esm/utils/index.d.ts +1 -1
- package/esm/utils/index.js +1 -1
- package/esm/utils/index.js.map +1 -1
- package/esm/utils/useFlag.js.map +1 -1
- package/esm/utils/useIsMounted.js.map +1 -1
- package/package.json +8 -9
- package/src/AppShell/AppShell.tsx +147 -140
- package/src/AppShell/index.tsx +1 -1
- package/src/Input/ActionsMenu.tsx +70 -73
- package/src/Input/EmailSenderField.tsx +59 -52
- package/src/Input/Selector.tsx +15 -15
- package/src/LanguageSwitcher/index.ts +1 -1
- package/src/Paging/Paging.ts +56 -57
- package/src/Paging/index.ts +2 -1
- package/src/VCThemeProvider/JetbrainsMonoFont.tsx +52 -42
- package/src/VCThemeProvider/RobotoFont.tsx +47 -39
- package/src/VCThemeProvider/ThemeModeSwitcher.tsx +17 -17
- package/src/VCThemeProvider/VCThemeProvider.tsx +149 -145
- package/src/audit/AuditChanges.tsx +18 -12
- package/src/audit/AuditTimeline.tsx +16 -17
- package/src/audit/AuditTimelineItem.tsx +58 -61
- package/src/audit/index.ts +2 -2
- package/src/audit/types.ts +27 -28
- package/src/breadcrumbs.tsx +11 -15
- package/src/code/CodeBlock.tsx +10 -10
- package/src/confirm/ConfirmButton.tsx +56 -56
- package/src/confirm/ConfirmDialog.tsx +54 -54
- package/src/confirm/ConfirmMenuItem.tsx +51 -53
- package/src/container/ContainerLayout.tsx +7 -8
- package/src/container/ContainerSettingsContext.tsx +49 -46
- package/src/container/ContainerWidthControl.tsx +11 -9
- package/src/container/index.ts +8 -3
- package/src/content-table/ContentTable.tsx +235 -197
- package/src/content-table/UndrawEmpty.tsx +281 -281
- package/src/content-table/index.ts +1 -1
- package/src/country/country-select.tsx +0 -1
- package/src/country/index.ts +3 -3
- package/src/country/locale-select.tsx +36 -36
- package/src/country/locales.ts +185 -187
- package/src/country/phone-prefix-select.tsx +4 -5
- package/src/cube/accessibility.tsx +2 -1
- package/src/data-table/DataTableColumnSettings.tsx +181 -181
- package/src/data-table/DataTableHeader.tsx +6 -6
- package/src/data-table/DataTableToolbar.tsx +6 -6
- package/src/data-table/index.tsx +4 -4
- package/src/data-table/useDataTableColumnStorage.ts +30 -19
- package/src/data-table/useDataTableStorage.spec.ts +108 -0
- package/src/data-table/useDataTableStorage.ts +91 -36
- package/src/date-pickers/PlainAdapterCommon.ts +118 -120
- package/src/date-pickers/PlainDateAdapter.spec.ts +44 -46
- package/src/date-pickers/PlainDateAdapter.ts +130 -132
- package/src/date-pickers/PlainDatePicker.spec.tsx +17 -18
- package/src/date-pickers/PlainDatePicker.tsx +33 -36
- package/src/date-pickers/PlainDateTimeAdapter.spec.ts +44 -46
- package/src/date-pickers/PlainDateTimeAdapter.ts +141 -134
- package/src/date-pickers/PlainDateTimePicker.spec.tsx +17 -18
- package/src/date-pickers/PlainDateTimePicker.tsx +35 -36
- package/src/date-pickers/PlainTimeAdapter.ts +219 -221
- package/src/date-pickers/PlainTimePicker.spec.tsx +17 -18
- package/src/date-pickers/PlainTimePicker.tsx +35 -34
- package/src/date-pickers/TemporalAdapter.ts +110 -111
- package/src/date-pickers/TimezoneSelect.tsx +375 -375
- package/src/date-pickers/getFormatString.ts +29 -29
- package/src/date-pickers/index.ts +6 -5
- package/src/date-pickers/parse.spec.ts +37 -40
- package/src/date-pickers/parse.ts +44 -47
- package/src/date-pickers/timeframe-picker.tsx +16 -17
- package/src/date-pickers/useLocale.ts +1 -1
- package/src/date-pickers/useRenderInput.tsx +24 -15
- package/src/fetch.ts +4 -5
- package/src/formats/CompactFormat.spec.tsx +18 -20
- package/src/formats/CompactFormat.tsx +30 -30
- package/src/formats/CurrencyFormat.spec.tsx +18 -20
- package/src/formats/CurrencyFormat.tsx +52 -52
- package/src/formats/DecimalFormat.spec.tsx +18 -20
- package/src/formats/DecimalFormat.tsx +47 -47
- package/src/formats/DurationFormat.spec.tsx +48 -49
- package/src/formats/DurationFormat.tsx +51 -51
- package/src/formats/TemporalFormat.spec.tsx +93 -95
- package/src/formats/TemporalRangeFormat.spec.tsx +143 -144
- package/src/formats/TemporalRangeFormat.tsx +54 -54
- package/src/formats/types.ts +1 -3
- package/src/formats/useDateTimeFormat.ts +5 -2
- package/src/formats/useNumberFormat.ts +3 -3
- package/src/formats/useRelativeTimeFormat.ts +5 -3
- package/src/forms/SearchForm.tsx +37 -38
- package/src/getNavigatorLanguages.ts +4 -5
- package/src/getSupportedFormatLocale.ts +10 -10
- package/src/help/HelpDrawer.tsx +76 -55
- package/src/help/index.ts +3 -3
- package/src/icons.ts +21 -21
- package/src/layout/ErrorBoundary.tsx +226 -215
- package/src/layout/NotFound.tsx +36 -39
- package/src/layout/NotFoundSvg.tsx +193 -169
- package/src/layout/UserNav.tsx +98 -98
- package/src/layout/index.ts +3 -3
- package/src/logo/Logo.tsx +6 -7
- package/src/logo/VCAppLogo.tsx +22 -20
- package/src/logo/index.tsx +3 -3
- package/src/splash/index.tsx +25 -25
- package/src/storage/MemoryStorage.ts +22 -15
- package/src/storage/index.ts +2 -1
- package/src/storage/storage.spec.ts +184 -0
- package/src/storage/storage.ts +37 -15
- package/src/storage/types.ts +6 -0
- package/src/storage/useStorage.ts +21 -6
- package/src/tabs/Tabs.tsx +172 -170
- package/src/tabs/index.ts +1 -1
- package/src/temporal/index.ts +1 -1
- package/src/temporal/parse.ts +1 -2
- package/src/temporal/polyfill.ts +11 -11
- package/src/utils/defined.ts +2 -3
- package/src/utils/index.ts +1 -1
- package/src/utils/useFlag.ts +5 -5
- package/src/utils/useIsMounted.ts +9 -9
|
@@ -1,91 +1,92 @@
|
|
|
1
1
|
import {AppBar, Box, Breakpoint, Drawer, IconButton, useMediaQuery, useTheme} from "@mui/material";
|
|
2
2
|
import React, {PropsWithChildren, useEffect} from "react";
|
|
3
|
-
import {useFlag} from "../utils";
|
|
4
3
|
import {MenuIcon} from "../icons";
|
|
5
4
|
import {LayoutProvider} from "../layout";
|
|
6
5
|
import {VCAppLogo} from "../logo/VCAppLogo";
|
|
6
|
+
import {useFlag} from "../utils";
|
|
7
7
|
|
|
8
8
|
interface AppShellProps {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
appName: string;
|
|
10
|
+
sideNav?: JSX.Element | null | undefined;
|
|
11
|
+
sideNavWidth?: number;
|
|
12
|
+
sideNavFixed?: Breakpoint;
|
|
13
|
+
topNav?: JSX.Element | null | undefined;
|
|
14
|
+
footer?: JSX.Element | null | undefined;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export function AppShell(props: PropsWithChildren<AppShellProps>) {
|
|
18
|
+
const {
|
|
19
|
+
children,
|
|
20
|
+
appName,
|
|
21
|
+
sideNav,
|
|
22
|
+
sideNavWidth = 200,
|
|
23
|
+
topNav,
|
|
24
|
+
sideNavFixed = "md",
|
|
25
|
+
footer,
|
|
26
|
+
} = props;
|
|
18
27
|
|
|
19
|
-
|
|
20
|
-
children,
|
|
21
|
-
appName,
|
|
22
|
-
sideNav,
|
|
23
|
-
sideNavWidth = 200,
|
|
24
|
-
topNav,
|
|
25
|
-
sideNavFixed = "md",
|
|
26
|
-
footer,
|
|
27
|
-
} = props;
|
|
28
|
-
|
|
29
|
-
const [drawerOpen, setDrawerOpen, clearDrawerOpen, toggleDrawerOpen] = useFlag(false);
|
|
28
|
+
const [drawerOpen, setDrawerOpen, clearDrawerOpen, toggleDrawerOpen] = useFlag(false);
|
|
30
29
|
|
|
31
|
-
|
|
30
|
+
const theme = useTheme();
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
const drawerPermanent = useMediaQuery(theme.breakpoints.up(sideNavFixed));
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (drawerPermanent) {
|
|
35
|
+
setDrawerOpen();
|
|
36
|
+
}
|
|
37
|
+
}, [drawerPermanent]);
|
|
39
38
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
39
|
+
return (
|
|
40
|
+
<LayoutProvider appName={appName}>
|
|
41
|
+
<Box
|
|
42
|
+
sx={{
|
|
43
|
+
display: "flex",
|
|
44
|
+
flexFlow: "column nowrap",
|
|
45
|
+
"@media screen": {
|
|
46
|
+
height: "100vh",
|
|
47
|
+
overflowY: "scroll",
|
|
48
|
+
},
|
|
49
|
+
"@media print": {
|
|
50
|
+
padding: 0,
|
|
51
|
+
margin: 0,
|
|
52
|
+
},
|
|
53
|
+
}}
|
|
54
|
+
>
|
|
55
|
+
<AppBar
|
|
56
|
+
elevation={0}
|
|
57
|
+
position="static"
|
|
58
|
+
color="inherit"
|
|
59
|
+
sx={{
|
|
60
|
+
borderBottom: 1,
|
|
61
|
+
borderColor: "divider",
|
|
62
|
+
backgroundColor: "paper.elevation1",
|
|
63
|
+
color: "text.primary",
|
|
64
|
+
displayPrint: "none",
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
<Box
|
|
68
|
+
sx={{
|
|
69
|
+
position: "relative",
|
|
70
|
+
display: "flex",
|
|
71
|
+
flexFlow: "row nowrap",
|
|
72
|
+
justifyContent: "space-between",
|
|
73
|
+
alignItems: "center",
|
|
74
|
+
px: 2,
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
77
|
+
{!drawerPermanent && (
|
|
78
|
+
<IconButton
|
|
79
|
+
edge="start"
|
|
80
|
+
sx={{marginRight: 1}}
|
|
81
|
+
color="inherit"
|
|
82
|
+
aria-label="menu"
|
|
83
|
+
onClick={toggleDrawerOpen}
|
|
84
|
+
disabled={!sideNav}
|
|
85
|
+
size="large"
|
|
86
|
+
>
|
|
87
|
+
<MenuIcon />
|
|
88
|
+
</IconButton>
|
|
89
|
+
)}
|
|
89
90
|
<VCAppLogo
|
|
90
91
|
appName={drawerPermanent ? appName : undefined}
|
|
91
92
|
sx={{
|
|
@@ -94,72 +95,78 @@ export function AppShell(props: PropsWithChildren<AppShellProps>) {
|
|
|
94
95
|
position: "absolute",
|
|
95
96
|
top: "50%",
|
|
96
97
|
left: "50%",
|
|
97
|
-
transform: "translate(-50%, -50%)"
|
|
98
|
-
})
|
|
98
|
+
transform: "translate(-50%, -50%)",
|
|
99
|
+
}),
|
|
99
100
|
}}
|
|
100
101
|
/>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
102
|
+
{topNav}
|
|
103
|
+
{!topNav && <Box />}
|
|
104
|
+
</Box>
|
|
105
|
+
</AppBar>
|
|
106
|
+
<Box
|
|
107
|
+
sx={{
|
|
108
|
+
flex: "1 1 auto",
|
|
109
|
+
display: "flex",
|
|
110
|
+
flexFlow: "row nowrap",
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
{sideNav && (
|
|
114
|
+
<Drawer
|
|
115
|
+
variant={!drawerPermanent ? "temporary" : "permanent"}
|
|
116
|
+
sx={{
|
|
117
|
+
displayPrint: "none",
|
|
118
|
+
[`& .MuiDrawer-paper`]: {
|
|
119
|
+
position: "relative",
|
|
120
|
+
whiteSpace: "nowrap",
|
|
121
|
+
overflowX: "hidden",
|
|
122
|
+
width: sideNavWidth,
|
|
123
|
+
boxSizing: "border-box",
|
|
124
|
+
},
|
|
125
|
+
["& .MuiPaper-elevation0"]: {
|
|
126
|
+
backgroundColor: "paper.elevation1",
|
|
127
|
+
},
|
|
128
|
+
}}
|
|
129
|
+
open={drawerOpen}
|
|
130
|
+
onClick={!drawerPermanent ? clearDrawerOpen : undefined}
|
|
131
|
+
onClose={clearDrawerOpen}
|
|
132
|
+
>
|
|
133
|
+
{!drawerPermanent && (
|
|
134
|
+
<VCAppLogo
|
|
135
|
+
appName={appName}
|
|
136
|
+
sx={{
|
|
137
|
+
px: 2,
|
|
138
|
+
py: 1,
|
|
139
|
+
}}
|
|
140
|
+
/>
|
|
141
|
+
)}
|
|
142
|
+
{sideNav}
|
|
143
|
+
</Drawer>
|
|
144
|
+
)}
|
|
145
|
+
<Box
|
|
146
|
+
sx={{
|
|
147
|
+
py: 4,
|
|
148
|
+
flex: 1,
|
|
149
|
+
maxWidth: "100%",
|
|
150
|
+
"@media print": {padding: 0, margin: 0},
|
|
151
|
+
}}
|
|
152
|
+
>
|
|
153
|
+
{children}
|
|
154
|
+
</Box>
|
|
155
|
+
</Box>
|
|
156
|
+
{footer && (
|
|
157
|
+
<Box
|
|
158
|
+
sx={{
|
|
159
|
+
borderTop: 1,
|
|
160
|
+
borderColor: "divider",
|
|
161
|
+
backgroundColor: theme.palette.background.paper,
|
|
162
|
+
color: "text.primary",
|
|
163
|
+
displayPrint: "none",
|
|
164
|
+
}}
|
|
165
|
+
>
|
|
166
|
+
{footer}
|
|
167
|
+
</Box>
|
|
168
|
+
)}
|
|
169
|
+
</Box>
|
|
170
|
+
</LayoutProvider>
|
|
171
|
+
);
|
|
165
172
|
}
|
package/src/AppShell/index.tsx
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {AppShell} from "./AppShell";
|
|
1
|
+
export { AppShell } from "./AppShell";
|
|
@@ -1,102 +1,99 @@
|
|
|
1
|
+
import {ExpandMore} from "@mui/icons-material";
|
|
1
2
|
import {Button, ButtonGroup, ButtonPropsSizeOverrides, Menu, MenuItem} from "@mui/material";
|
|
3
|
+
import {OverridableStringUnion} from "@mui/types";
|
|
2
4
|
import * as React from "react";
|
|
3
5
|
import {PropsWithChildren, useState} from "react";
|
|
4
|
-
import {OverridableStringUnion} from "@mui/types";
|
|
5
|
-
import {ExpandMore} from "@mui/icons-material";
|
|
6
6
|
|
|
7
7
|
export interface ActionMenuItem {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
label: string;
|
|
9
|
+
onClick: () => void;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export interface ActionsMenuProps {
|
|
13
|
-
|
|
13
|
+
actions: ActionMenuItem[];
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export function ActionsMenu(props: ActionsMenuProps) {
|
|
17
|
-
|
|
17
|
+
const {actions} = props;
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
if (actions.length == 0) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
if (actions.length == 1) {
|
|
24
|
+
return <SimpleButton label={actions[0].label} onClick={actions[0].onClick} />;
|
|
25
|
+
}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
return (
|
|
28
|
+
<PushButtonWithMenu label={actions[0].label} onClick={actions[0].onClick}>
|
|
29
|
+
{actions.slice(1).map((action, index) => (
|
|
30
|
+
<MenuItem key={index} onClick={action.onClick}>{action.label}</MenuItem>
|
|
31
|
+
))}
|
|
32
|
+
</PushButtonWithMenu>
|
|
33
|
+
);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
37
36
|
interface SimpleButtonProps {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
label: string;
|
|
38
|
+
onClick: () => void;
|
|
39
|
+
primary?: boolean;
|
|
40
|
+
size?: OverridableStringUnion<"small" | "medium" | "large", ButtonPropsSizeOverrides>;
|
|
41
|
+
loading?: boolean;
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
function SimpleButton({label, onClick, primary, size, loading}: SimpleButtonProps) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
45
|
+
return (
|
|
46
|
+
<Button
|
|
47
|
+
color={primary ? "primary" : undefined}
|
|
48
|
+
variant={primary ? "contained" : "outlined"}
|
|
49
|
+
size={size}
|
|
50
|
+
disabled={loading}
|
|
51
|
+
onClick={onClick}
|
|
52
|
+
>
|
|
53
|
+
{label}
|
|
54
|
+
</Button>
|
|
55
|
+
);
|
|
57
56
|
}
|
|
58
57
|
|
|
59
58
|
interface PushButtonWithMenuProps extends PropsWithChildren<any> {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
label: string;
|
|
60
|
+
onClick: () => void;
|
|
61
|
+
disabled?: boolean;
|
|
62
|
+
size?: "small" | "medium" | "large";
|
|
64
63
|
}
|
|
65
64
|
|
|
66
65
|
function PushButtonWithMenu(props: PushButtonWithMenuProps) {
|
|
67
|
-
|
|
66
|
+
const {label, onClick, disabled, size, children} = props;
|
|
68
67
|
|
|
69
|
-
|
|
68
|
+
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
|
70
69
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
70
|
+
return (
|
|
71
|
+
<React.Fragment>
|
|
72
|
+
<ButtonGroup size={size}>
|
|
73
|
+
<Button variant="outlined" disabled={disabled} onClick={onClick}>{label}</Button>
|
|
74
|
+
<Button
|
|
75
|
+
variant="outlined"
|
|
76
|
+
disabled={disabled}
|
|
77
|
+
size="small"
|
|
78
|
+
onClick={(e) => setAnchorEl(e.currentTarget)}
|
|
79
|
+
>
|
|
80
|
+
<ExpandMore />
|
|
81
|
+
</Button>
|
|
82
|
+
</ButtonGroup>
|
|
83
|
+
{children
|
|
84
|
+
&& (
|
|
85
|
+
<Menu
|
|
86
|
+
open={Boolean(anchorEl)}
|
|
87
|
+
anchorEl={anchorEl}
|
|
88
|
+
onClose={() => setAnchorEl(null)}
|
|
89
|
+
keepMounted
|
|
90
|
+
onClick={() => setAnchorEl(null)}
|
|
91
|
+
anchorOrigin={{vertical: "bottom", horizontal: "center"}}
|
|
92
|
+
transformOrigin={{vertical: "top", horizontal: "center"}}
|
|
93
|
+
>
|
|
94
|
+
{children}
|
|
95
|
+
</Menu>
|
|
96
|
+
)}
|
|
97
|
+
</React.Fragment>
|
|
98
|
+
);
|
|
100
99
|
}
|
|
101
|
-
|
|
102
|
-
|
|
@@ -1,64 +1,71 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {TextField, TextFieldProps} from "./TextField";
|
|
3
2
|
import {useState} from "react";
|
|
3
|
+
import {TextField, TextFieldProps} from "./TextField";
|
|
4
4
|
|
|
5
5
|
export type EmailSenderFieldProps = Omit<TextFieldProps, "onChange"> & {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
6
|
+
onChange?: (value: string, e: React.ChangeEvent<HTMLInputElement>) => any;
|
|
7
|
+
updateValidity?: (valid: boolean) => void;
|
|
8
|
+
};
|
|
9
9
|
|
|
10
|
-
export function EmailSenderField(
|
|
11
|
-
|
|
10
|
+
export function EmailSenderField(
|
|
11
|
+
{onChange, validate, onBlur, helperText, select, SelectProps, error, updateValidity, ...props}:
|
|
12
|
+
EmailSenderFieldProps,
|
|
13
|
+
) {
|
|
14
|
+
const [valid, setValid] = useState<boolean>(false);
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
16
|
+
async function validateEmailSender(value: string) {
|
|
17
|
+
let valid = false;
|
|
18
|
+
if (isEmail(value)) {
|
|
19
|
+
const response = await fetch(
|
|
20
|
+
"https://28pdqh9qy3.execute-api.eu-west-1.amazonaws.com/dev/validate-email-sender",
|
|
21
|
+
{
|
|
22
|
+
method: "POST",
|
|
23
|
+
body: JSON.stringify({
|
|
24
|
+
"email": value,
|
|
25
|
+
}),
|
|
26
|
+
},
|
|
27
|
+
);
|
|
28
|
+
if (response.ok) {
|
|
29
|
+
const json = await response.json();
|
|
30
|
+
valid = json.valid;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
setValid(valid);
|
|
34
|
+
if (updateValidity) {
|
|
35
|
+
updateValidity(valid);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
32
38
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
function handleChange(value: string, e: React.ChangeEvent<HTMLInputElement>) {
|
|
40
|
+
if (onChange) {
|
|
41
|
+
onChange(value, e);
|
|
42
|
+
}
|
|
43
|
+
validateEmailSender(value);
|
|
44
|
+
}
|
|
39
45
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
function handleBlur(e: React.FocusEvent<HTMLInputElement>) {
|
|
47
|
+
const value = e.currentTarget?.value || e.target.value;
|
|
48
|
+
if (onBlur) {
|
|
49
|
+
onBlur(e);
|
|
50
|
+
}
|
|
51
|
+
validateEmailSender(value);
|
|
52
|
+
}
|
|
47
53
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
return (
|
|
55
|
+
<TextField
|
|
56
|
+
{...props}
|
|
57
|
+
onChange={handleChange}
|
|
58
|
+
onBlur={handleBlur}
|
|
59
|
+
error={error || !valid}
|
|
60
|
+
/>
|
|
61
|
+
);
|
|
56
62
|
}
|
|
57
63
|
|
|
58
64
|
export function isEmail(email: string): boolean {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
if (!email) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
const re =
|
|
69
|
+
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
70
|
+
return re.test(email.toLowerCase());
|
|
71
|
+
}
|
package/src/Input/Selector.tsx
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import React, {PropsWithChildren} from "react";
|
|
2
1
|
import {MenuItem} from "@mui/material";
|
|
2
|
+
import React, {PropsWithChildren} from "react";
|
|
3
3
|
import {TextField, TextFieldProps} from "./TextField";
|
|
4
4
|
|
|
5
5
|
type SelectorProps = TextFieldProps & {
|
|
6
|
-
|
|
7
|
-
}
|
|
6
|
+
options: { label: string; value: string }[];
|
|
7
|
+
};
|
|
8
8
|
|
|
9
9
|
export const Selector = ({fullWidth = true, options, ...props}: PropsWithChildren<SelectorProps>) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
10
|
+
return (
|
|
11
|
+
<TextField
|
|
12
|
+
{...props}
|
|
13
|
+
select
|
|
14
|
+
fullWidth={fullWidth}
|
|
15
|
+
>
|
|
16
|
+
{options.map((o, i) => (
|
|
17
|
+
<MenuItem key={"select-item-" + o.value + "-" + i} value={o.value}>{o.label}</MenuItem>
|
|
18
|
+
))}
|
|
19
|
+
</TextField>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./LanguageSwitcher";
|
|
1
|
+
export * from "./LanguageSwitcher";
|