@variocube/app-ui 1.15.0 → 1.16.1
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/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 +30 -7
- 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/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 +32 -7
- 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,51 +1,59 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
createTheme,
|
|
3
|
+
CssBaseline,
|
|
4
|
+
decomposeColor,
|
|
5
|
+
PaletteMode,
|
|
6
|
+
ThemeOptions,
|
|
7
|
+
ThemeProvider,
|
|
8
|
+
useMediaQuery,
|
|
9
|
+
} from "@mui/material";
|
|
5
10
|
import deepmerge from "deepmerge";
|
|
6
|
-
import {
|
|
11
|
+
import React, {createContext, PropsWithChildren, useCallback, useContext, useMemo} from "react";
|
|
12
|
+
import {useStorage} from "../storage";
|
|
13
|
+
import {JetbrainsMonoFont} from "./JetbrainsMonoFont";
|
|
14
|
+
import {RobotoFont} from "./RobotoFont";
|
|
7
15
|
|
|
8
16
|
const DEFAULT_PRIMARY = "#ff6a00";
|
|
9
17
|
const DEFAULT_SECONDARY = "#009dd8";
|
|
10
18
|
|
|
11
19
|
const SUCCESS = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
20
|
+
light: "#429945",
|
|
21
|
+
dark: "#58cc5c",
|
|
22
|
+
};
|
|
15
23
|
|
|
16
24
|
const WARNING = {
|
|
17
|
-
|
|
18
|
-
|
|
25
|
+
light: "#ccaa00",
|
|
26
|
+
dark: "#e6bf00",
|
|
19
27
|
};
|
|
20
28
|
|
|
21
29
|
const ERROR = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
30
|
+
light: "#aa0000",
|
|
31
|
+
dark: "#e62e2e",
|
|
32
|
+
};
|
|
25
33
|
|
|
26
34
|
const INFO = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
35
|
+
light: "#082480",
|
|
36
|
+
dark: "#294fcc",
|
|
37
|
+
};
|
|
30
38
|
|
|
31
39
|
const BACKGROUND = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
40
|
+
light: "#fffaf7",
|
|
41
|
+
dark: "#15161a",
|
|
42
|
+
};
|
|
35
43
|
|
|
36
44
|
const PAPER = {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
45
|
+
light: "#ffffff",
|
|
46
|
+
dark: "#282b33",
|
|
47
|
+
};
|
|
40
48
|
|
|
41
49
|
const TEXT = {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
50
|
+
light: "#282b33",
|
|
51
|
+
dark: "#fdfaf7",
|
|
52
|
+
};
|
|
45
53
|
|
|
46
54
|
interface ThemeContextValue {
|
|
47
|
-
|
|
48
|
-
|
|
55
|
+
mode: PaletteMode;
|
|
56
|
+
setMode: (mode: PaletteMode) => any;
|
|
49
57
|
customLogo?: CustomLogo;
|
|
50
58
|
}
|
|
51
59
|
|
|
@@ -56,8 +64,8 @@ export interface CustomLogo {
|
|
|
56
64
|
}
|
|
57
65
|
|
|
58
66
|
const ThemeContext = createContext<ThemeContextValue>({
|
|
59
|
-
|
|
60
|
-
|
|
67
|
+
mode: "light",
|
|
68
|
+
setMode: () => void 0,
|
|
61
69
|
});
|
|
62
70
|
|
|
63
71
|
export interface Branding {
|
|
@@ -71,113 +79,110 @@ export interface Branding {
|
|
|
71
79
|
}
|
|
72
80
|
|
|
73
81
|
export interface VCThemeProviderProps {
|
|
74
|
-
|
|
82
|
+
branding?: Branding;
|
|
75
83
|
}
|
|
76
84
|
|
|
77
|
-
export function VCThemeProvider({
|
|
85
|
+
export function VCThemeProvider({branding, children}: PropsWithChildren<VCThemeProviderProps>) {
|
|
86
|
+
// Determine default mode based on user preference
|
|
87
|
+
const userPrefersDark = useMediaQuery("(prefers-color-scheme: dark)");
|
|
88
|
+
const defaultMode = useMemo(() => userPrefersDark ? "dark" : "light", [userPrefersDark]);
|
|
78
89
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const defaultMode = useMemo(() => userPrefersDark ? "dark" : "light", [userPrefersDark]);
|
|
90
|
+
// Allow overriding the default mode
|
|
91
|
+
const [modeOverride, setModeOverride] = useStorage<PaletteMode | null>("variocube-palette-mode", null);
|
|
82
92
|
|
|
83
|
-
|
|
84
|
-
|
|
93
|
+
// Select actual mode to use
|
|
94
|
+
const mode = useMemo(() => modeOverride ?? defaultMode, [modeOverride, defaultMode]);
|
|
85
95
|
|
|
86
|
-
|
|
87
|
-
|
|
96
|
+
// Allows setting the mode override. Clears the storage item if the default mode is set.
|
|
97
|
+
const setMode = useCallback((newMode: PaletteMode) => {
|
|
98
|
+
setModeOverride(newMode != defaultMode ? newMode : null);
|
|
99
|
+
}, [defaultMode]);
|
|
88
100
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}, [defaultMode]);
|
|
93
|
-
|
|
94
|
-
const {
|
|
95
|
-
colorPrimary,
|
|
96
|
-
colorSecondary,
|
|
101
|
+
const {
|
|
102
|
+
colorPrimary,
|
|
103
|
+
colorSecondary,
|
|
97
104
|
logoLightUrl,
|
|
98
105
|
logoDarkUrl,
|
|
99
106
|
logoPaddingX,
|
|
100
107
|
logoPaddingY,
|
|
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
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
return createTheme(deepmerge(themeOptions, branding?.muiThemeOptions || {}));
|
|
180
|
-
}, [mode, branding]);
|
|
108
|
+
} = branding ?? {};
|
|
109
|
+
|
|
110
|
+
const theme = useMemo(() => {
|
|
111
|
+
const themeOptions: ThemeOptions = {
|
|
112
|
+
palette: {
|
|
113
|
+
mode,
|
|
114
|
+
primary: {
|
|
115
|
+
main: sanitizeColor(colorPrimary, DEFAULT_PRIMARY),
|
|
116
|
+
},
|
|
117
|
+
secondary: {
|
|
118
|
+
main: sanitizeColor(colorSecondary, DEFAULT_SECONDARY),
|
|
119
|
+
},
|
|
120
|
+
success: {
|
|
121
|
+
main: SUCCESS[mode],
|
|
122
|
+
},
|
|
123
|
+
warning: {
|
|
124
|
+
main: WARNING[mode],
|
|
125
|
+
},
|
|
126
|
+
error: {
|
|
127
|
+
main: ERROR[mode],
|
|
128
|
+
},
|
|
129
|
+
info: {
|
|
130
|
+
main: INFO[mode],
|
|
131
|
+
},
|
|
132
|
+
text: {
|
|
133
|
+
primary: TEXT[mode],
|
|
134
|
+
},
|
|
135
|
+
background: {
|
|
136
|
+
default: BACKGROUND[mode],
|
|
137
|
+
paper: PAPER[mode],
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
typography: {
|
|
141
|
+
h1: {
|
|
142
|
+
fontSize: 46,
|
|
143
|
+
fontWeight: 300,
|
|
144
|
+
},
|
|
145
|
+
h2: {
|
|
146
|
+
fontSize: 29,
|
|
147
|
+
fontWeight: 500,
|
|
148
|
+
},
|
|
149
|
+
h3: {
|
|
150
|
+
fontSize: 24,
|
|
151
|
+
fontWeight: 500,
|
|
152
|
+
},
|
|
153
|
+
h4: {
|
|
154
|
+
fontSize: 20,
|
|
155
|
+
fontWeight: 500,
|
|
156
|
+
},
|
|
157
|
+
h5: {
|
|
158
|
+
fontSize: 18,
|
|
159
|
+
fontWeight: 500,
|
|
160
|
+
},
|
|
161
|
+
h6: {
|
|
162
|
+
fontSize: 18,
|
|
163
|
+
fontWeight: 500,
|
|
164
|
+
},
|
|
165
|
+
overline: {
|
|
166
|
+
fontWeight: 500,
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
components: {
|
|
170
|
+
MuiLink: {
|
|
171
|
+
defaultProps: {
|
|
172
|
+
underline: "hover",
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
MuiPaper: {
|
|
176
|
+
styleOverrides: {
|
|
177
|
+
root: {
|
|
178
|
+
backgroundImage: "unset",
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
return createTheme(deepmerge(themeOptions, branding?.muiThemeOptions || {}));
|
|
185
|
+
}, [mode, branding]);
|
|
181
186
|
|
|
182
187
|
const customLogo = useMemo(() => {
|
|
183
188
|
const logoUrl = mode == "light" ? (logoLightUrl || logoDarkUrl) : (logoDarkUrl || logoLightUrl);
|
|
@@ -185,21 +190,21 @@ export function VCThemeProvider({ branding, children }: PropsWithChildren<VCThem
|
|
|
185
190
|
return {
|
|
186
191
|
url: logoUrl,
|
|
187
192
|
paddingX: logoPaddingX,
|
|
188
|
-
paddingY: logoPaddingY
|
|
189
|
-
}
|
|
193
|
+
paddingY: logoPaddingY,
|
|
194
|
+
};
|
|
190
195
|
}
|
|
191
196
|
}, [logoLightUrl, logoDarkUrl, mode, logoPaddingX, logoPaddingY]);
|
|
192
197
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
198
|
+
return (
|
|
199
|
+
<ThemeProvider theme={theme}>
|
|
200
|
+
<ThemeContext.Provider value={{mode, setMode, customLogo}}>
|
|
201
|
+
<CssBaseline />
|
|
202
|
+
<RobotoFont />
|
|
203
|
+
<JetbrainsMonoFont />
|
|
204
|
+
{children}
|
|
205
|
+
</ThemeContext.Provider>
|
|
206
|
+
</ThemeProvider>
|
|
207
|
+
);
|
|
203
208
|
}
|
|
204
209
|
|
|
205
210
|
function sanitizeColor(color: string | undefined, fallback: string) {
|
|
@@ -208,19 +213,18 @@ function sanitizeColor(color: string | undefined, fallback: string) {
|
|
|
208
213
|
decomposeColor(color);
|
|
209
214
|
return color;
|
|
210
215
|
}
|
|
211
|
-
}
|
|
212
|
-
catch (error) {
|
|
216
|
+
} catch (error) {
|
|
213
217
|
}
|
|
214
218
|
return fallback;
|
|
215
219
|
}
|
|
216
220
|
|
|
217
221
|
export function usePaletteMode() {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
+
const value = useContext(ThemeContext);
|
|
223
|
+
if (!value) {
|
|
224
|
+
throw new Error("Could not find theme context. Are you missing a VCThemeProvider in your component tree?");
|
|
225
|
+
}
|
|
222
226
|
const {mode, setMode} = value;
|
|
223
|
-
|
|
227
|
+
return {mode, setMode};
|
|
224
228
|
}
|
|
225
229
|
|
|
226
230
|
export function useCustomLogo() {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {Add, ChangeCircleOutlined, Remove} from "@mui/icons-material";
|
|
2
2
|
import {Box, Chip, List, ListItem, ListItemIcon, ListItemText, Stack} from "@mui/material";
|
|
3
3
|
import React, {Fragment} from "react";
|
|
4
|
-
import {AppAuditLogEntry, JsonPatch, JsonPatchItem} from "./types";
|
|
5
4
|
import {Code} from "../code/Code";
|
|
6
5
|
import {CodeBlock} from "../code/CodeBlock";
|
|
7
6
|
import {Json} from "../code/Json";
|
|
7
|
+
import {AppAuditLogEntry, JsonPatch, JsonPatchItem} from "./types";
|
|
8
8
|
|
|
9
9
|
export function AuditChanges({data, patch}: Pick<AppAuditLogEntry, "data" | "patch">) {
|
|
10
10
|
return (
|
|
11
11
|
<Stack spacing={2}>
|
|
12
12
|
{patch && <AuditPatch patch={patch} />}
|
|
13
|
-
{data && <AuditData data={data}/>}
|
|
13
|
+
{data && <AuditData data={data} />}
|
|
14
14
|
</Stack>
|
|
15
15
|
);
|
|
16
16
|
}
|
|
@@ -25,7 +25,7 @@ export function AuditPatch({patch}: { patch: JsonPatch }) {
|
|
|
25
25
|
icon={getIcon(item.op)}
|
|
26
26
|
label={item.path}
|
|
27
27
|
sx={{
|
|
28
|
-
fontFamily: "Jetbrains Mono"
|
|
28
|
+
fontFamily: "Jetbrains Mono",
|
|
29
29
|
}}
|
|
30
30
|
/>
|
|
31
31
|
</ListItemIcon>
|
|
@@ -35,18 +35,18 @@ export function AuditPatch({patch}: { patch: JsonPatch }) {
|
|
|
35
35
|
{item.op == "replace" && (
|
|
36
36
|
<Fragment>
|
|
37
37
|
<Box sx={{color: "success"}}>
|
|
38
|
-
<Value value={item.value}/>
|
|
38
|
+
<Value value={item.value} />
|
|
39
39
|
</Box>
|
|
40
40
|
<Box color="error">
|
|
41
41
|
<s>
|
|
42
|
-
<Value value={item.fromValue}/>
|
|
42
|
+
<Value value={item.fromValue} />
|
|
43
43
|
</s>
|
|
44
44
|
</Box>
|
|
45
45
|
</Fragment>
|
|
46
46
|
)}
|
|
47
47
|
{item.op == "add" && (
|
|
48
48
|
<div>
|
|
49
|
-
<Value value={item.value}/>
|
|
49
|
+
<Value value={item.value} />
|
|
50
50
|
</div>
|
|
51
51
|
)}
|
|
52
52
|
</Box>
|
|
@@ -58,18 +58,24 @@ export function AuditPatch({patch}: { patch: JsonPatch }) {
|
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
export function AuditData({data}: {data: any}) {
|
|
61
|
+
export function AuditData({data}: { data: any }) {
|
|
62
62
|
return (
|
|
63
|
-
<CodeBlock
|
|
63
|
+
<CodeBlock>
|
|
64
|
+
<Json data={data} />
|
|
65
|
+
</CodeBlock>
|
|
64
66
|
);
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
function getIcon(op: JsonPatchItem["op"]) {
|
|
68
70
|
switch (op) {
|
|
69
|
-
case "add":
|
|
70
|
-
|
|
71
|
-
case "
|
|
72
|
-
|
|
71
|
+
case "add":
|
|
72
|
+
return <Add />;
|
|
73
|
+
case "remove":
|
|
74
|
+
return <Remove />;
|
|
75
|
+
case "replace":
|
|
76
|
+
return <ChangeCircleOutlined />;
|
|
77
|
+
default:
|
|
78
|
+
return;
|
|
73
79
|
}
|
|
74
80
|
}
|
|
75
81
|
|
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import React, {PropsWithChildren} from "react";
|
|
2
1
|
import {Timeline} from "@mui/lab";
|
|
2
|
+
import React, {PropsWithChildren} from "react";
|
|
3
3
|
import {AuditTimelineItemSkeleton} from "./AuditTimelineItem";
|
|
4
4
|
|
|
5
5
|
interface AuditTimelineProps {
|
|
6
|
-
|
|
6
|
+
loading?: boolean;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export function AuditTimeline({loading, children}: PropsWithChildren<AuditTimelineProps>) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
if (loading) {
|
|
11
|
+
return (
|
|
12
|
+
<Timeline>
|
|
13
|
+
<AuditTimelineItemSkeleton />
|
|
14
|
+
<AuditTimelineItemSkeleton />
|
|
15
|
+
<AuditTimelineItemSkeleton />
|
|
16
|
+
</Timeline>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
return (
|
|
20
|
+
<Timeline>
|
|
21
|
+
{children}
|
|
22
|
+
</Timeline>
|
|
23
|
+
);
|
|
24
24
|
}
|
|
25
|
-
|
|
@@ -1,75 +1,72 @@
|
|
|
1
|
-
import React, {ReactNode} from "react";
|
|
2
1
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
TimelineConnector,
|
|
3
|
+
TimelineContent,
|
|
4
|
+
TimelineDot,
|
|
5
|
+
TimelineItem,
|
|
6
|
+
TimelineOppositeContent,
|
|
7
|
+
TimelineSeparator,
|
|
9
8
|
} from "@mui/lab";
|
|
10
9
|
import {Box, Skeleton, Stack, Typography, useMediaQuery, useTheme} from "@mui/material";
|
|
10
|
+
import React, {ReactNode} from "react";
|
|
11
11
|
|
|
12
12
|
export interface AuditTimelineItemProps {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
created: ReactNode;
|
|
14
|
+
actor: ReactNode;
|
|
15
|
+
connector?: boolean;
|
|
16
|
+
message: ReactNode;
|
|
17
|
+
changes: ReactNode;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export function AuditTimelineItem(props: AuditTimelineItemProps) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
const {
|
|
22
|
+
created,
|
|
23
|
+
actor,
|
|
24
|
+
connector = true,
|
|
25
|
+
message,
|
|
26
|
+
changes,
|
|
27
|
+
} = props;
|
|
28
|
+
const theme = useTheme();
|
|
29
|
+
const sm = useMediaQuery(theme.breakpoints.down("sm"));
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
const createdAndActor = (
|
|
32
|
+
<Stack spacing={1}>
|
|
33
|
+
<Box color="text.secondary">{created}</Box>
|
|
34
|
+
<Box color="text.primary">{actor}</Box>
|
|
35
|
+
</Stack>
|
|
36
|
+
);
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
</TimelineContent>
|
|
61
|
-
</TimelineItem>
|
|
62
|
-
)
|
|
38
|
+
return (
|
|
39
|
+
<TimelineItem>
|
|
40
|
+
{sm
|
|
41
|
+
? <TimelineOppositeContent sx={{flex: 0, padding: 0}} />
|
|
42
|
+
: <TimelineOppositeContent>{createdAndActor}</TimelineOppositeContent>}
|
|
43
|
+
<TimelineSeparator>
|
|
44
|
+
<TimelineDot />
|
|
45
|
+
{connector && <TimelineConnector />}
|
|
46
|
+
</TimelineSeparator>
|
|
47
|
+
<TimelineContent>
|
|
48
|
+
<Stack spacing={1}>
|
|
49
|
+
<Typography variant="h6" sx={{transform: "translateY(-1px)"}}>
|
|
50
|
+
{message}
|
|
51
|
+
</Typography>
|
|
52
|
+
{sm && createdAndActor}
|
|
53
|
+
<Typography variant="body2">
|
|
54
|
+
{changes}
|
|
55
|
+
</Typography>
|
|
56
|
+
</Stack>
|
|
57
|
+
</TimelineContent>
|
|
58
|
+
</TimelineItem>
|
|
59
|
+
);
|
|
63
60
|
}
|
|
64
61
|
|
|
65
62
|
export function AuditTimelineItemSkeleton() {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
63
|
+
return (
|
|
64
|
+
<AuditTimelineItem
|
|
65
|
+
connector
|
|
66
|
+
created={<Skeleton />}
|
|
67
|
+
actor={<Skeleton />}
|
|
68
|
+
message={<Skeleton />}
|
|
69
|
+
changes={<Skeleton variant="rounded" height="150px" />}
|
|
70
|
+
/>
|
|
71
|
+
);
|
|
75
72
|
}
|
package/src/audit/index.ts
CHANGED