wcz-layout 6.1.2 → 6.2.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.
Files changed (32) hide show
  1. package/dist/src/components/Dialog.js +6 -3
  2. package/dist/src/components/Dialog.js.map +1 -1
  3. package/dist/src/contexts/LayoutContext.d.ts +8 -0
  4. package/dist/src/contexts/LayoutContext.js +2 -2
  5. package/dist/src/contexts/LayoutContext.js.map +1 -1
  6. package/dist/src/contexts/LayoutLocalizationProvider.d.ts +2 -0
  7. package/dist/src/contexts/LayoutLocalizationProvider.js +15 -0
  8. package/dist/src/contexts/LayoutLocalizationProvider.js.map +1 -0
  9. package/dist/src/hooks/UseDialog.d.ts +14 -0
  10. package/dist/src/hooks/UseDialog.js +7 -0
  11. package/dist/src/hooks/UseDialog.js.map +1 -0
  12. package/dist/src/hooks/UseSnackbar.d.ts +1 -0
  13. package/dist/src/hooks/UseSnackbar.js +5 -2
  14. package/dist/src/hooks/UseSnackbar.js.map +1 -1
  15. package/dist/src/models/KeycloakExtendedConfig.js.map +1 -1
  16. package/dist/src/utils/Helpers.d.ts +1 -0
  17. package/dist/src/utils/Helpers.js +7 -0
  18. package/dist/src/utils/Helpers.js.map +1 -1
  19. package/dist/tsconfig.tsbuildinfo +1 -1
  20. package/package.json +1 -1
  21. package/src/contexts/LayoutContext.tsx +11 -2
  22. package/src/hooks/UseSnackbar.tsx +5 -2
  23. package/src/utils/Helpers.ts +9 -1
  24. package/dist/src/components/Button.d.ts +0 -3
  25. package/dist/src/components/Button.js +0 -9
  26. package/dist/src/components/Button.js.map +0 -1
  27. package/dist/src/next/Fetches.d.ts +0 -5
  28. package/dist/src/next/Fetches.js +0 -61
  29. package/dist/src/next/Fetches.js.map +0 -1
  30. package/dist/src/utils/Translations.d.ts +0 -40
  31. package/dist/src/utils/Translations.js +0 -41
  32. package/dist/src/utils/Translations.js.map +0 -1
@@ -1,16 +1,19 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Close } from "@mui/icons-material";
3
- import { AppBar, DialogActions, DialogContent, DialogTitle, Grid, IconButton, Dialog as MaterialDialog, Toolbar, Typography, useMediaQuery } from "@mui/material";
3
+ import { AppBar, Dialog as MaterialDialog, DialogActions, DialogContent, DialogTitle, Grid, IconButton, LinearProgress, Toolbar, Typography, useMediaQuery } from "@mui/material";
4
4
  import { useTheme } from "@mui/material/styles";
5
+ import { useIsFetching, useIsMutating } from "@tanstack/react-query";
5
6
  import { Fragment } from "react";
6
7
  import { LayoutSnackbar } from "./LayoutSnackbar";
7
8
  export const Dialog = ({ open, onClose, title, subtitle, children, color, maxWidth, actions, disablePadding, disableAutoClose }) => {
8
9
  const theme = useTheme();
9
10
  const fullScreen = useMediaQuery(theme.breakpoints.down("sm"));
11
+ const isFetching = !!useIsFetching();
12
+ const isMutating = !!useIsMutating();
10
13
  return (_jsxs(MaterialDialog, { open: open, onClose: disableAutoClose ? undefined : onClose, fullScreen: fullScreen, fullWidth: true, maxWidth: maxWidth, children: [fullScreen ?
11
- _jsx(Fragment, { children: _jsx(AppBar, { sx: { position: "relative", bgcolor: `${color}.main` }, children: _jsxs(Toolbar, { children: [_jsxs(Typography, { sx: { flex: 1 }, variant: "h6", children: [title, subtitle && _jsx(Typography, { variant: "body2", sx: { opacity: 0.5 }, children: subtitle })] }), _jsx(IconButton, { edge: "start", onClick: onClose, children: _jsx(Close, { sx: { color: `${color}.contrastText` } }) })] }) }) })
14
+ _jsxs(Fragment, { children: [_jsx(AppBar, { sx: { position: "relative", bgcolor: `${color}.main` }, children: _jsxs(Toolbar, { children: [_jsxs(Typography, { sx: { flex: 1 }, variant: "h6", children: [title, subtitle && _jsx(Typography, { variant: "body2", sx: { opacity: 0.5 }, children: subtitle })] }), _jsx(IconButton, { edge: "start", onClick: onClose, children: _jsx(Close, { sx: { color: `${color}.contrastText` } }) })] }) }), (isFetching || isMutating) && _jsx(LinearProgress, { color: color === "default" ? undefined : color })] })
12
15
  :
13
- _jsx(Fragment, { children: _jsxs(Grid, { container: true, justifyContent: "space-between", sx: { bgcolor: `${color}.main`, color: `${color}.contrastText` }, children: [_jsx(Grid, { item: true, xs: true, children: _jsxs(DialogTitle, { children: [title, subtitle && _jsx(Typography, { variant: "body2", sx: { opacity: 0.5 }, children: subtitle })] }) }), _jsx(Grid, { item: true, xs: 2, sx: { p: 1, textAlign: "right" }, children: _jsx(IconButton, { onClick: onClose, children: _jsx(Close, { fontSize: "small", sx: { color: `${color}.contrastText` } }) }) })] }) }), disablePadding ? children : _jsx(DialogContent, { children: children }), actions &&
16
+ _jsxs(Fragment, { children: [_jsxs(Grid, { container: true, justifyContent: "space-between", sx: { bgcolor: `${color}.main`, color: `${color}.contrastText` }, children: [_jsx(Grid, { item: true, xs: true, children: _jsxs(DialogTitle, { children: [title, subtitle && _jsx(Typography, { variant: "body2", sx: { opacity: 0.5 }, children: subtitle })] }) }), _jsx(Grid, { item: true, xs: 2, sx: { p: 1, textAlign: "right" }, children: _jsx(IconButton, { onClick: onClose, children: _jsx(Close, { fontSize: "small", sx: { color: `${color}.contrastText` } }) }) })] }), (isFetching || isMutating) && _jsx(LinearProgress, { color: color === "default" ? undefined : color })] }), disablePadding ? children : _jsx(DialogContent, { children: children }), actions &&
14
17
  _jsx(DialogActions, { children: actions.map(action => action) }), _jsx(LayoutSnackbar, {})] }));
15
18
  };
16
19
  //# sourceMappingURL=Dialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../src/components/Dialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAc,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,IAAI,cAAc,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9K,OAAO,EAAE,QAAQ,EAAE,MAAM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,cACL,MAAC,IAAI,IAAC,SAAS,QAAC,cAAc,EAAC,eAAe,EAAC,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,KAAK,OAAO,EAAE,KAAK,EAAE,GAAG,KAAK,eAAe,EAAE,aAC3G,KAAC,IAAI,IAAC,IAAI,QAAC,EAAE,kBACT,MAAC,WAAW,eACP,KAAK,EACL,QAAQ,IAAI,KAAC,UAAU,IAAC,OAAO,EAAC,OAAO,EAAC,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,YAAG,QAAQ,GAAc,IAC5E,GACX,EAEP,KAAC,IAAI,IAAC,IAAI,QAAC,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,YAC9C,KAAC,UAAU,IAAC,OAAO,EAAE,OAAO,YACxB,KAAC,KAAK,IAAC,QAAQ,EAAC,OAAO,EAAC,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,KAAK,eAAe,EAAE,GAAI,GACzD,GACV,IACJ,GACA,EAGd,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAC,aAAa,cAAE,QAAQ,GAAiB,EAErE,OAAO;gBACJ,KAAC,aAAa,cACT,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,GAClB,EAGpB,KAAC,cAAc,KAAG,IACL,CACpB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { Close } from \"@mui/icons-material\";\r\nimport { AppBar, Breakpoint, DialogActions, DialogContent, DialogTitle, Grid, IconButton, Dialog as MaterialDialog, Toolbar, Typography, useMediaQuery } from \"@mui/material\";\r\nimport { useTheme } from \"@mui/material/styles\";\r\nimport { Fragment, ReactNode } from \"react\";\r\nimport { LayoutSnackbar } from \"./LayoutSnackbar\";\r\n\r\ninterface DialogProps {\r\n children?: ReactNode,\r\n title: string | ReactNode;\r\n subtitle?: string | ReactNode;\r\n open: boolean;\r\n onClose: () => void;\r\n color?: \"success\" | \"info\" | \"warning\" | \"error\" | \"primary\" | \"secondary\" | \"inherit\" | \"default\";\r\n maxWidth?: Breakpoint;\r\n actions?: ReactNode[];\r\n disablePadding?: boolean;\r\n disableAutoClose?: boolean;\r\n}\r\n\r\nexport const Dialog: React.FC<DialogProps> = ({ open, onClose, title, subtitle, children, color, maxWidth, actions, disablePadding, disableAutoClose }) => {\r\n const theme = useTheme();\r\n const fullScreen = useMediaQuery(theme.breakpoints.down(\"sm\"));\r\n\r\n return (\r\n <MaterialDialog open={open} onClose={disableAutoClose ? undefined : onClose} fullScreen={fullScreen} fullWidth maxWidth={maxWidth}>\r\n {fullScreen ?\r\n <Fragment>\r\n <AppBar sx={{ position: \"relative\", bgcolor: `${color}.main` }}>\r\n <Toolbar>\r\n <Typography sx={{ flex: 1 }} variant=\"h6\">\r\n {title}\r\n {subtitle && <Typography variant=\"body2\" sx={{ opacity: 0.5 }}>{subtitle}</Typography>}\r\n </Typography>\r\n <IconButton edge=\"start\" onClick={onClose}>\r\n <Close sx={{ color: `${color}.contrastText` }} />\r\n </IconButton>\r\n </Toolbar>\r\n </AppBar>\r\n </Fragment>\r\n :\r\n <Fragment>\r\n <Grid container justifyContent=\"space-between\" sx={{ bgcolor: `${color}.main`, color: `${color}.contrastText` }}>\r\n <Grid item xs>\r\n <DialogTitle>\r\n {title}\r\n {subtitle && <Typography variant=\"body2\" sx={{ opacity: 0.5 }}>{subtitle}</Typography>}\r\n </DialogTitle>\r\n </Grid>\r\n\r\n <Grid item xs={2} sx={{ p: 1, textAlign: \"right\" }}>\r\n <IconButton onClick={onClose}>\r\n <Close fontSize=\"small\" sx={{ color: `${color}.contrastText` }} />\r\n </IconButton>\r\n </Grid>\r\n </Grid>\r\n </Fragment>\r\n }\r\n\r\n {disablePadding ? children : <DialogContent>{children}</DialogContent>}\r\n\r\n {actions &&\r\n <DialogActions>\r\n {actions.map(action => action)}\r\n </DialogActions>\r\n }\r\n\r\n <LayoutSnack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B,KAAC,KAAK,IAAC,QAAQ,EAAC,OAAO,EAAC,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,KAAK,eAAe,EAAE,GAAI,GACzD,GACV,IACJ,EACN,CAAC,UAAU,IAAI,UAAU,CAAC,IAAI,KAAC,cAAc,IAAC,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,GAAI,IAC1F,EAGd,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAC,aAAa,cAAE,QAAQ,GAAiB,EAErE,OAAO;gBACJ,KAAC,aAAa,cACT,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,GAClB,EAGpB,KAAC,cAAc,KAAG,IACL,CACpB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { Close } from \"@mui/icons-material\";\r\nimport { AppBar, Breakpoint, Dialog as MaterialDialog, DialogActions, DialogContent, DialogTitle, Grid, IconButton, LinearProgress, Toolbar, Typography, useMediaQuery } from \"@mui/material\";\r\nimport { useTheme } from \"@mui/material/styles\";\r\nimport { useIsFetching, useIsMutating } from \"@tanstack/react-query\";\r\nimport { Fragment, ReactNode } from \"react\";\r\nimport { LayoutSnackbar } from \"./LayoutSnackbar\";\r\n\r\ninterface DialogProps {\r\n children?: ReactNode,\r\n title: string | ReactNode;\r\n subtitle?: string | ReactNode;\r\n open: boolean;\r\n onClose: () => void;\r\n color?: \"success\" | \"info\" | \"warning\" | \"error\" | \"primary\" | \"secondary\" | \"inherit\" | \"default\";\r\n maxWidth?: Breakpoint;\r\n actions?: ReactNode[];\r\n disablePadding?: boolean;\r\n disableAutoClose?: boolean;\r\n}\r\n\r\nexport const Dialog: React.FC<DialogProps> = ({ open, onClose, title, subtitle, children, color, maxWidth, actions, disablePadding, disableAutoClose }) => {\r\n const theme = useTheme();\r\n const fullScreen = useMediaQuery(theme.breakpoints.down(\"sm\"));\r\n const isFetching = !!useIsFetching();\r\n const isMutating = !!useIsMutating();\r\n\r\n return (\r\n <MaterialDialog open={open} onClose={disableAutoClose ? undefined : onClose} fullScreen={fullScreen} fullWidth maxWidth={maxWidth}>\r\n {fullScreen ?\r\n <Fragment>\r\n <AppBar sx={{ position: \"relative\", bgcolor: `${color}.main` }}>\r\n <Toolbar>\r\n <Typography sx={{ flex: 1 }} variant=\"h6\">\r\n {title}\r\n {subtitle && <Typography variant=\"body2\" sx={{ opacity: 0.5 }}>{subtitle}</Typography>}\r\n </Typography>\r\n <IconButton edge=\"start\" onClick={onClose}>\r\n <Close sx={{ color: `${color}.contrastText` }} />\r\n </IconButton>\r\n </Toolbar>\r\n </AppBar>\r\n {(isFetching || isMutating) && <LinearProgress color={color === \"default\" ? undefined : color} />}\r\n </Fragment>\r\n :\r\n <Fragment>\r\n <Grid container justifyContent=\"space-between\" sx={{ bgcolor: `${color}.main`, color: `${color}.contrastText` }}>\r\n <Grid item xs>\r\n <DialogTitle>\r\n {title}\r\n {subtitle && <Typography variant=\"body2\" sx={{ opacity: 0.5 }}>{subtitle}</Typography>}\r\n </DialogTitle>\r\n </Grid>\r\n\r\n <Grid item xs={2} sx={{ p: 1, textAlign: \"right\" }}>\r\n <IconButton onClick={onClose}>\r\n <Close fontSize=\"small\" sx={{ color: `${color}.contrastText` }} />\r\n </IconButton>\r\n </Grid>\r\n </Grid>\r\n {(isFetching || isMutating) && <LinearProgress color={color === \"default\" ? undefined : color} />}\r\n </Fragment>\r\n }\r\n\r\n {disablePadding ? children : <DialogContent>{children}</DialogContent>}\r\n\r\n {actions &&\r\n <DialogActions>\r\n {actions.map(action => action)}\r\n </DialogActions>\r\n }\r\n\r\n <LayoutSnackbar />\r\n </MaterialDialog>\r\n );\r\n};\r\n"]}
@@ -10,6 +10,13 @@ declare module "moment" {
10
10
  formatDateTime(): string;
11
11
  }
12
12
  }
13
+ declare global {
14
+ interface Error {
15
+ innerException?: string;
16
+ status?: number;
17
+ traceIdentifier?: string;
18
+ }
19
+ }
13
20
  export interface GetRoutesParams {
14
21
  user: User;
15
22
  t: TFunction<"translation", undefined>;
@@ -20,6 +27,7 @@ interface LayoutContextInterface {
20
27
  t: TFunction<"translation", undefined>;
21
28
  i18n: i18n;
22
29
  snackbar: (snackbar: Snackbar) => void;
30
+ notification: (notification: Snackbar) => void;
23
31
  }
24
32
  export declare const LayoutContext: import("react").Context<LayoutContextInterface>;
25
33
  interface LayoutProviderProps {
@@ -40,14 +40,14 @@ export const LayoutContext = createContext({});
40
40
  export const LayoutProvider = ({ getRoutes, appVersion, colors }) => {
41
41
  const { t, i18n } = useTranslation();
42
42
  const user = useUser();
43
- const { snackbar, setSnackbar, displaySnackbar, notifications, setNotifications } = useSnackbar();
43
+ const { snackbar, setSnackbar, displaySnackbar, notification, notifications, setNotifications } = useSnackbar();
44
44
  if (moment.locale() !== i18n.resolvedLanguage) {
45
45
  moment.locale(i18n.resolvedLanguage);
46
46
  }
47
47
  const routes = getRoutes({ user, i18n, t });
48
48
  const router = createBrowserRouter([
49
49
  {
50
- element: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(LayoutContext.Provider, { value: { user, t, i18n, snackbar: displaySnackbar }, children: _jsxs(Layout, { routes: routes, appVersion: appVersion, colors: colors, user: user, notifications: notifications, setNotifications: setNotifications, children: [_jsx(Outlet, {}), _jsx(LayoutSnackbar, { snackbar: snackbar, setSnackbar: setSnackbar })] }) }) }),
50
+ element: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(LayoutContext.Provider, { value: { user, t, i18n, snackbar: displaySnackbar, notification }, children: _jsxs(Layout, { routes: routes, appVersion: appVersion, colors: colors, user: user, notifications: notifications, setNotifications: setNotifications, children: [_jsx(Outlet, {}), _jsx(LayoutSnackbar, { snackbar: snackbar, setSnackbar: setSnackbar })] }) }) }),
51
51
  children: routes,
52
52
  errorElement: _jsx(ErrorPage, {})
53
53
  },
@@ -1 +1 @@
1
- {"version":3,"file":"LayoutContext.js","sourceRoot":"","sources":["../../../src/contexts/Lay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KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,eAAe,EAAE,YACvE,MAAC,MAAM,IACH,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,aAElC,KAAC,MAAM,KAAG,EACV,KAAC,cAAc,IAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,GAAI,IAC3D,GACY,GACP;YAC1B,QAAQ,EAAE,MAAM;YAChB,YAAY,EAAE,KAAC,SAAS,KAAG;SAC9B;KACJ,CAAC,CAAC;IAEH,OAAO,KAAC,cAAc,IAAC,MAAM,EAAE,MAAM,GAAI,CAAC;AAC9C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC","sourcesContent":["import { QueryClient, QueryClientProvider } from \"@tanstack/react-query\";\r\nimport i18next, { TFunction, i18n } from \"i18next\";\r\nimport LanguageDetector from \"i18next-browser-languagedetector\";\r\nimport I18NextHttpBackend from \"i18next-http-backend\";\r\nimport moment from \"moment\";\r\nimport \"moment/locale/cs\";\r\nimport { createContext, useContext } from \"react\";\r\nimport { initReactI18next, useTranslation } from \"react-i18next\";\r\nimport { Outlet, RouterProvider, createBrowserRouter } from \"react-router-dom\";\r\nimport { z } from \"zod\";\r\nimport { zodI18nMap } from \"zod-i18n-map\";\r\nimport zodCsTranslations from \"zod-i18n-map/locales/cs/zod.json\";\r\nimport zodEnTranslations from \"zod-i18n-map/locales/en/zod.json\";\r\nimport { Layout } from \"../components/Layout\";\r\nimport { ErrorPage } from \"../components/layout/ErrorPage\";\r\nimport { LayoutSnackbar } from \"../components/layout/LayoutSnackbar\";\r\nimport { useSnackbar } from \"../hooks/UseSnackbar\";\r\nimport { useUser } from \"../hooks/UseUser\";\r\nimport { LayoutPaletteColorOptions } from \"../models/LayoutPaletteColorOptions\";\r\nimport { LayoutRoute } from \"../models/LayoutRoute\";\r\nimport { Snackbar } from \"../models/Snackbar\";\r\nimport { User } from \"../models/User\";\r\n\r\nconst queryClient = new QueryClient();\r\n\r\ni18next\r\n .use(initReactI18next)\r\n .use(LanguageDetector)\r\n .use(I18NextHttpBackend)\r\n .init({ fallbackLng: \"en\" });\r\n\r\ni18next.addResourceBundle(\"en\", \"zod\", zodEnTranslations);\r\ni18next.addResourceBundle(\"cs\", \"zod\", zodCsTranslations);\r\n\r\nz.setErrorMap(zodI18nMap);\r\n\r\ndeclare module \"moment\" {\r\n interface Moment {\r\n formatDate(): string;\r\n formatDateTime(): string;\r\n }\r\n}\r\n\r\nmoment.fn.formatDate = function (): string {\r\n if (!this.isValid()) return \"\";\r\n return this.format(\"YYYY-MM-DD\");\r\n};\r\n\r\nmoment.fn.formatDateTime = function (): string {\r\n if (!this.isValid()) return \"\";\r\n return this.format(\"YYYY-MM-DD HH:mm\");\r\n};\r\n\r\nexport interface GetRoutesParams {\r\n user: User;\r\n t: TFunction<\"translation\", undefined>;\r\n i18n: i18n;\r\n}\r\n\r\ninterface LayoutContextInterface {\r\n user: User;\r\n t: TFunction<\"translation\", undefined>;\r\n i18n: i18n;\r\n snackbar: (snackbar: Snackbar) => void;\r\n}\r\n\r\nexport const LayoutContext = createContext({} as LayoutContextInterface);\r\n\r\ninterface LayoutProviderProps {\r\n getRoutes: (params: GetRoutesParams) => LayoutRoute[];\r\n appVersion: string;\r\n colors: LayoutPaletteColorOptions;\r\n}\r\n\r\nexport const LayoutProvider: React.FC<LayoutProviderProps> = ({ getRoutes, appVersion, colors }) => {\r\n const { t, i18n } = useTranslation();\r\n const user = useUser();\r\n const { snackbar, setSnackbar, displaySnackbar, notifications, setNotifications } = useSnackbar();\r\n\r\n if (moment.locale() !== i18n.resolvedLanguage) {\r\n moment.locale(i18n.resolvedLanguage);\r\n }\r\n\r\n const routes: LayoutRoute[] = getRoutes({ user, i18n, t });\r\n\r\n const router = createBrowserRouter([\r\n {\r\n element:\r\n <QueryClientProvider client={queryClient}>\r\n <LayoutContext.Provider value={{ user, t, i18n, snackbar: displaySnackbar }}>\r\n <Layout\r\n routes={routes}\r\n appVersion={appVersion}\r\n colors={colors}\r\n user={user}\r\n notifications={notifications}\r\n setNotifications={setNotifications}\r\n >\r\n <Outlet />\r\n <LayoutSnackbar snackbar={snackbar} setSnackbar={setSnackbar} />\r\n </Layout>\r\n </LayoutContext.Provider>\r\n </QueryClientProvider>,\r\n children: routes,\r\n errorElement: <ErrorPage />\r\n },\r\n ]);\r\n\r\n return <RouterProvider router={router} />;\r\n};\r\n\r\nexport const useLayout = () => useContext(LayoutContext);"]}
1
+ {"version":3,"file":"LayoutContext.js","sourceRoot":"","sources":["../../../src/contexts/LayoutContext.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,OAA4B,MAAM,SAAS,CAAC;AACnD,OAAO,gBAAgB,MAAM,kCAAkC,CAAC;AAChE,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,iBAAiB,MAAM,kCAAkC,CAAC;AACjE,OAAO,iBAAiB,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OA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";\r\nimport LanguageDetector from \"i18next-browser-languagedetector\";\r\nimport I18NextHttpBackend from \"i18next-http-backend\";\r\nimport moment from \"moment\";\r\nimport \"moment/locale/cs\";\r\nimport { createContext, useContext } from \"react\";\r\nimport { initReactI18next, useTranslation } from \"react-i18next\";\r\nimport { Outlet, RouterProvider, createBrowserRouter } from \"react-router-dom\";\r\nimport { z } from \"zod\";\r\nimport { zodI18nMap } from \"zod-i18n-map\";\r\nimport zodCsTranslations from \"zod-i18n-map/locales/cs/zod.json\";\r\nimport zodEnTranslations from \"zod-i18n-map/locales/en/zod.json\";\r\nimport { Layout } from \"../components/Layout\";\r\nimport { ErrorPage } from \"../components/layout/ErrorPage\";\r\nimport { LayoutSnackbar } from \"../components/layout/LayoutSnackbar\";\r\nimport { useSnackbar } from \"../hooks/UseSnackbar\";\r\nimport { useUser } from \"../hooks/UseUser\";\r\nimport { LayoutPaletteColorOptions } from \"../models/LayoutPaletteColorOptions\";\r\nimport { LayoutRoute } from \"../models/LayoutRoute\";\r\nimport { Snackbar } from \"../models/Snackbar\";\r\nimport { User } from \"../models/User\";\r\n\r\nconst queryClient = new QueryClient();\r\n\r\ni18next\r\n .use(initReactI18next)\r\n .use(LanguageDetector)\r\n .use(I18NextHttpBackend)\r\n .init({ fallbackLng: \"en\" });\r\n\r\ni18next.addResourceBundle(\"en\", \"zod\", zodEnTranslations);\r\ni18next.addResourceBundle(\"cs\", \"zod\", zodCsTranslations);\r\n\r\nz.setErrorMap(zodI18nMap);\r\n\r\ndeclare module \"moment\" {\r\n interface Moment {\r\n formatDate(): string;\r\n formatDateTime(): string;\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface Error {\r\n innerException?: string;\r\n status?: number;\r\n traceIdentifier?: string;\r\n }\r\n}\r\n\r\nmoment.fn.formatDate = function (): string {\r\n if (!this.isValid()) return \"\";\r\n return this.format(\"YYYY-MM-DD\");\r\n};\r\n\r\nmoment.fn.formatDateTime = function (): string {\r\n if (!this.isValid()) return \"\";\r\n return this.format(\"YYYY-MM-DD HH:mm\");\r\n};\r\n\r\nexport interface GetRoutesParams {\r\n user: User;\r\n t: TFunction<\"translation\", undefined>;\r\n i18n: i18n;\r\n}\r\n\r\ninterface LayoutContextInterface {\r\n user: User;\r\n t: TFunction<\"translation\", undefined>;\r\n i18n: i18n;\r\n snackbar: (snackbar: Snackbar) => void;\r\n notification: (notification: Snackbar) => void;\r\n}\r\n\r\nexport const LayoutContext = createContext({} as LayoutContextInterface);\r\n\r\ninterface LayoutProviderProps {\r\n getRoutes: (params: GetRoutesParams) => LayoutRoute[];\r\n appVersion: string;\r\n colors: LayoutPaletteColorOptions;\r\n}\r\n\r\nexport const LayoutProvider: React.FC<LayoutProviderProps> = ({ getRoutes, appVersion, colors }) => {\r\n const { t, i18n } = useTranslation();\r\n const user = useUser();\r\n const { snackbar, setSnackbar, displaySnackbar, notification, notifications, setNotifications } = useSnackbar();\r\n\r\n if (moment.locale() !== i18n.resolvedLanguage) {\r\n moment.locale(i18n.resolvedLanguage);\r\n }\r\n\r\n const routes: LayoutRoute[] = getRoutes({ user, i18n, t });\r\n\r\n const router = createBrowserRouter([\r\n {\r\n element:\r\n <QueryClientProvider client={queryClient}>\r\n <LayoutContext.Provider value={{ user, t, i18n, snackbar: displaySnackbar, notification }}>\r\n <Layout\r\n routes={routes}\r\n appVersion={appVersion}\r\n colors={colors}\r\n user={user}\r\n notifications={notifications}\r\n setNotifications={setNotifications}\r\n >\r\n <Outlet />\r\n <LayoutSnackbar snackbar={snackbar} setSnackbar={setSnackbar} />\r\n </Layout>\r\n </LayoutContext.Provider>\r\n </QueryClientProvider>,\r\n children: routes,\r\n errorElement: <ErrorPage />\r\n },\r\n ]);\r\n\r\n return <RouterProvider router={router} />;\r\n};\r\n\r\nexport const useLayout = () => useContext(LayoutContext);"]}
@@ -0,0 +1,2 @@
1
+ import "moment/locale/cs";
2
+ export declare const LayoutLocalizationProvider: React.FC;
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { LocalizationProvider } from "@mui/x-date-pickers-pro";
3
+ import { AdapterMoment } from "@mui/x-date-pickers-pro/AdapterMoment";
4
+ import moment from "moment";
5
+ import "moment/locale/cs";
6
+ import { Outlet } from "react-router-dom";
7
+ import { useLayout } from "./LayoutContext";
8
+ export const LayoutLocalizationProvider = () => {
9
+ const { i18n } = useLayout();
10
+ if (moment.locale() !== i18n.resolvedLanguage) {
11
+ moment.locale(i18n.resolvedLanguage);
12
+ }
13
+ return (_jsx(LocalizationProvider, { dateAdapter: AdapterMoment, adapterLocale: i18n.resolvedLanguage, children: _jsx(Outlet, {}) }));
14
+ };
15
+ //# sourceMappingURL=LayoutLocalizationProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LayoutLocalizationProvider.js","sourceRoot":"","sources":["../../../src/contexts/LayoutLocalizationProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,CAAC,MAAM,0BAA0B,GAAa,GAAG,EAAE;IACrD,MAAM,EAAE,IAAI,EAAE,GAAG,SAAS,EAAE,CAAC;IAE7B,IAAI,MAAM,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC5C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACzC,CAAC;IAED,OAAO,CACH,KAAC,oBAAoB,IAAC,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,IAAI,CAAC,gBAAgB,YAClF,KAAC,MAAM,KAAG,GACS,CAC1B,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { LocalizationProvider } from \"@mui/x-date-pickers-pro\";\r\nimport { AdapterMoment } from \"@mui/x-date-pickers-pro/AdapterMoment\";\r\nimport moment from \"moment\";\r\nimport \"moment/locale/cs\";\r\nimport { Outlet } from \"react-router-dom\";\r\nimport { useLayout } from \"./LayoutContext\";\r\n\r\nexport const LayoutLocalizationProvider: React.FC = () => {\r\n const { i18n } = useLayout();\r\n\r\n if (moment.locale() !== i18n.resolvedLanguage) {\r\n moment.locale(i18n.resolvedLanguage);\r\n }\r\n\r\n return (\r\n <LocalizationProvider dateAdapter={AdapterMoment} adapterLocale={i18n.resolvedLanguage}>\r\n <Outlet />\r\n </LocalizationProvider>\r\n );\r\n};"]}
@@ -0,0 +1,14 @@
1
+ import { Breakpoint } from "@mui/material";
2
+ import { ReactNode } from "react";
3
+ interface UseDialogProps {
4
+ open: boolean;
5
+ onClose: () => void;
6
+ title: string | ReactNode;
7
+ color?: "success" | "info" | "warning" | "error" | "primary" | "secondary" | "inherit" | "default";
8
+ maxWidth?: Breakpoint;
9
+ }
10
+ interface LayoutDialogProps {
11
+ children?: ReactNode;
12
+ }
13
+ export declare const useDialog: ({ open, onClose, title, color, maxWidth }: UseDialogProps) => React.FC<LayoutDialogProps>;
14
+ export {};
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { LayoutDialog } from "../components/layout/LayoutDialog";
3
+ export const useDialog = ({ open, onClose, title, color, maxWidth }) => {
4
+ const Dialog = ({ children }) => (_jsx(LayoutDialog, { open: open, onClose: onClose, title: title, color: color, maxWidth: maxWidth, children: children }));
5
+ return Dialog;
6
+ };
7
+ //# sourceMappingURL=UseDialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UseDialog.js","sourceRoot":"","sources":["../../../src/hooks/UseDialog.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAcjE,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAkB,EAA+B,EAAE;IAEhH,MAAM,MAAM,GAAgC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAC1D,KAAC,YAAY,IAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,YACrF,QAAQ,GACE,CAClB,CAAC;IAEF,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC","sourcesContent":["import { Breakpoint } from \"@mui/material\";\r\nimport { ReactNode } from \"react\";\r\nimport { LayoutDialog } from \"../components/layout/LayoutDialog\";\r\n\r\ninterface UseDialogProps {\r\n open: boolean;\r\n onClose: () => void;\r\n title: string | ReactNode;\r\n color?: \"success\" | \"info\" | \"warning\" | \"error\" | \"primary\" | \"secondary\" | \"inherit\" | \"default\";\r\n maxWidth?: Breakpoint;\r\n}\r\n\r\ninterface LayoutDialogProps {\r\n children?: ReactNode;\r\n}\r\n\r\nexport const useDialog = ({ open, onClose, title, color, maxWidth }: UseDialogProps): React.FC<LayoutDialogProps> => {\r\n\r\n const Dialog: React.FC<LayoutDialogProps> = ({ children }) => (\r\n <LayoutDialog open={open} onClose={onClose} title={title} color={color} maxWidth={maxWidth}>\r\n {children}\r\n </LayoutDialog>\r\n );\r\n\r\n return Dialog;\r\n};"]}
@@ -4,6 +4,7 @@ export declare const useSnackbar: () => {
4
4
  snackbar: Snackbar;
5
5
  setSnackbar: import("react").Dispatch<import("react").SetStateAction<Snackbar>>;
6
6
  displaySnackbar: (newSnackbar: Snackbar) => void;
7
+ notification: (notification: Snackbar) => void;
7
8
  notifications: Notification[] | undefined;
8
9
  setNotifications: import("react").Dispatch<import("react").SetStateAction<Notification[] | undefined>>;
9
10
  };
@@ -6,15 +6,18 @@ export const useSnackbar = () => {
6
6
  const [notifications, setNotifications] = useLocalStorageState("notifications");
7
7
  const displaySnackbar = (newSnackbar) => {
8
8
  setSnackbar(newSnackbar);
9
+ notification(newSnackbar);
10
+ };
11
+ const notification = (notification) => {
9
12
  setNotifications(oldNotifications => {
10
13
  let newNotifications = [];
11
14
  if (oldNotifications) {
12
15
  newNotifications = oldNotifications;
13
16
  }
14
- newNotifications.unshift({ ...newSnackbar, dateTime: moment().format("YYYY-MM-DD HH:mm:ss.SSS"), isRead: false });
17
+ newNotifications.unshift({ ...notification, dateTime: moment().format("YYYY-MM-DD HH:mm:ss.SSS"), isRead: false });
15
18
  return newNotifications.slice(0, 10);
16
19
  });
17
20
  };
18
- return { snackbar, setSnackbar, displaySnackbar, notifications, setNotifications };
21
+ return { snackbar, setSnackbar, displaySnackbar, notification, notifications, setNotifications };
19
22
  };
20
23
  //# sourceMappingURL=UseSnackbar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UseSnackbar.js","sourceRoot":"","sources":["../../../src/hooks/UseSnackbar.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAI3D,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE;IAC5B,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAW,EAAc,CAAC,CAAC;IACnE,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,oBAAoB,CAAiB,eAAe,CAAC,CAAC;IAEhG,MAAM,eAAe,GAAG,CAAC,WAAqB,EAAE,EAAE;QAC9C,WAAW,CAAC,WAAW,CAAC,CAAC;QAEzB,gBAAgB,CAAC,gBAAgB,CAAC,EAAE;YAChC,IAAI,gBAAgB,GAAmB,EAAE,CAAC;YAC1C,IAAI,gBAAgB,EAAE,CAAC;gBACnB,gBAAgB,GAAG,gBAAgB,CAAC;YACxC,CAAC;YACD,gBAAgB,CAAC,OAAO,CAAC,EAAE,GAAG,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,MAAM,CAAC,yBAAyB,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;YAClH,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;IAEF,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,gBAAgB,EAAE,CAAC;AACvF,CAAC,CAAC","sourcesContent":["import moment from \"moment\";\r\nimport { useState } from \"react\";\r\nimport useLocalStorageState from \"use-local-storage-state\";\r\nimport { Snackbar } from \"../models/Snackbar\";\r\nimport Notification from \"../models/Notification\";\r\n\r\nexport const useSnackbar = () => {\r\n const [snackbar, setSnackbar] = useState<Snackbar>({} as Snackbar);\r\n const [notifications, setNotifications] = useLocalStorageState<Notification[]>(\"notifications\");\r\n\r\n const displaySnackbar = (newSnackbar: Snackbar) => {\r\n setSnackbar(newSnackbar);\r\n\r\n setNotifications(oldNotifications => {\r\n let newNotifications: Notification[] = [];\r\n if (oldNotifications) {\r\n newNotifications = oldNotifications;\r\n }\r\n newNotifications.unshift({ ...newSnackbar, dateTime: moment().format(\"YYYY-MM-DD HH:mm:ss.SSS\"), isRead: false });\r\n return newNotifications.slice(0, 10);\r\n });\r\n };\r\n\r\n return { snackbar, setSnackbar, displaySnackbar, notifications, setNotifications };\r\n};"]}
1
+ {"version":3,"file":"UseSnackbar.js","sourceRoot":"","sources":["../../../src/hooks/UseSnackbar.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAI3D,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE;IAC5B,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAW,EAAc,CAAC,CAAC;IACnE,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,oBAAoB,CAAiB,eAAe,CAAC,CAAC;IAEhG,MAAM,eAAe,GAAG,CAAC,WAAqB,EAAE,EAAE;QAC9C,WAAW,CAAC,WAAW,CAAC,CAAC;QACzB,YAAY,CAAC,WAAW,CAAC,CAAC;IAC9B,CAAC,CAAC;IAEF,MAAM,YAAY,GAAG,CAAC,YAAsB,EAAE,EAAE;QAC5C,gBAAgB,CAAC,gBAAgB,CAAC,EAAE;YAChC,IAAI,gBAAgB,GAAmB,EAAE,CAAC;YAC1C,IAAI,gBAAgB,EAAE,CAAC;gBACnB,gBAAgB,GAAG,gBAAgB,CAAC;YACxC,CAAC;YACD,gBAAgB,CAAC,OAAO,CAAC,EAAE,GAAG,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,MAAM,CAAC,yBAAyB,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;YACnH,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;IAEF,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,CAAC;AACrG,CAAC,CAAC","sourcesContent":["import moment from \"moment\";\r\nimport { useState } from \"react\";\r\nimport useLocalStorageState from \"use-local-storage-state\";\r\nimport { Snackbar } from \"../models/Snackbar\";\r\nimport Notification from \"../models/Notification\";\r\n\r\nexport const useSnackbar = () => {\r\n const [snackbar, setSnackbar] = useState<Snackbar>({} as Snackbar);\r\n const [notifications, setNotifications] = useLocalStorageState<Notification[]>(\"notifications\");\r\n\r\n const displaySnackbar = (newSnackbar: Snackbar) => {\r\n setSnackbar(newSnackbar);\r\n notification(newSnackbar);\r\n };\r\n\r\n const notification = (notification: Snackbar) => {\r\n setNotifications(oldNotifications => {\r\n let newNotifications: Notification[] = [];\r\n if (oldNotifications) {\r\n newNotifications = oldNotifications;\r\n }\r\n newNotifications.unshift({ ...notification, dateTime: moment().format(\"YYYY-MM-DD HH:mm:ss.SSS\"), isRead: false });\r\n return newNotifications.slice(0, 10);\r\n });\r\n };\r\n\r\n return { snackbar, setSnackbar, displaySnackbar, notification, notifications, setNotifications };\r\n};"]}
@@ -1 +1 @@
1
- {"version":3,"file":"KeycloakExtendedConfig.js","sourceRoot":"","sources":["../../../src/models/KeycloakExtendedConfig.ts"],"names":[],"mappings":"","sourcesContent":["export default interface KeycloakExtendedConfig {\n autoLogin?: boolean,\n confidential?: Confidential,\n realm: string,\n \"auth-server-url\": string,\n idpHint?: string\n}\n\nexport interface Confidential {\n client: string,\n secret: string\n}"]}
1
+ {"version":3,"file":"KeycloakExtendedConfig.js","sourceRoot":"","sources":["../../../src/models/KeycloakExtendedConfig.ts"],"names":[],"mappings":"","sourcesContent":["export default interface KeycloakExtendedConfig {\r\n autoLogin?: boolean,\r\n confidential?: Confidential,\r\n realm: string,\r\n \"auth-server-url\": string,\r\n idpHint?: string\r\n}\r\n\r\nexport interface Confidential {\r\n client: string,\r\n secret: string\r\n}"]}
@@ -8,3 +8,4 @@ export declare class Platform {
8
8
  static readonly isWindows: boolean;
9
9
  static readonly isMacOS: boolean;
10
10
  }
11
+ export declare const getContrastTextColor: (color: string) => "black" | "white";
@@ -14,4 +14,11 @@ Platform.isAndroid = /android/i.test(navigator.userAgent);
14
14
  Platform.isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent);
15
15
  Platform.isWindows = /windows/i.test(navigator.userAgent);
16
16
  Platform.isMacOS = /Macintosh|MacIntel|MacPPC|Mac68K/.test(navigator.userAgent);
17
+ export const getContrastTextColor = (color) => {
18
+ const r = parseInt(color.substring(1, 3), 16);
19
+ const g = parseInt(color.substring(3, 5), 16);
20
+ const b = parseInt(color.substring(5, 7), 16);
21
+ const yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;
22
+ return (yiq >= 128) ? "black" : "white";
23
+ };
17
24
  //# sourceMappingURL=Helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Helpers.js","sourceRoot":"","sources":["../../../src/utils/Helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,QAAQ,CAAC;AAI3C,MAAM,CAAC,MAAM,WAAW,GAAgB,CAAC,GAAG,EAAE;IAC1C,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;QAAE,OAAO,WAAW,CAAC;SAC9D,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,aAAa,CAAC;;QAChE,OAAO,YAAY,CAAC;AAC7B,CAAC,CAAC,EAAE,CAAC;AAEL,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB,MAAM,OAAO,QAAQ;;AACD,kBAAS,GAAG,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AACjD,cAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AACrD,kBAAS,GAAG,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AACjD,gBAAO,GAAG,kCAAkC,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC","sourcesContent":["import { uuidv7 as newGuid } from \"uuidv7\";\r\n\r\ntype Environment = \"development\" | \"production\" | \"localhost\";\r\n\r\nexport const environment: Environment = (() => {\r\n if (window.location.href.includes(\"localhost\")) return \"localhost\";\r\n else if (window.location.href.includes(\".dev\")) return \"development\";\r\n else return \"production\";\r\n})();\r\n\r\nexport { newGuid };\r\n\r\nexport class Platform {\r\n static readonly isAndroid = /android/i.test(navigator.userAgent);\r\n static readonly isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent);\r\n static readonly isWindows = /windows/i.test(navigator.userAgent);\r\n static readonly isMacOS = /Macintosh|MacIntel|MacPPC|Mac68K/.test(navigator.userAgent);\r\n}"]}
1
+ {"version":3,"file":"Helpers.js","sourceRoot":"","sources":["../../../src/utils/Helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,QAAQ,CAAC;AAI3C,MAAM,CAAC,MAAM,WAAW,GAAgB,CAAC,GAAG,EAAE;IAC1C,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;QAAE,OAAO,WAAW,CAAC;SAC9D,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,aAAa,CAAC;;QAChE,OAAO,YAAY,CAAC;AAC7B,CAAC,CAAC,EAAE,CAAC;AAEL,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB,MAAM,OAAO,QAAQ;;AACD,kBAAS,GAAG,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AACjD,cAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AACrD,kBAAS,GAAG,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AACjD,gBAAO,GAAG,kCAAkC,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AAG3F,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAa,EAAE,EAAE;IAClD,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC9C,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC9C,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC9C,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;IACvD,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;AAC5C,CAAC,CAAC","sourcesContent":["import { uuidv7 as newGuid } from \"uuidv7\";\r\n\r\ntype Environment = \"development\" | \"production\" | \"localhost\";\r\n\r\nexport const environment: Environment = (() => {\r\n if (window.location.href.includes(\"localhost\")) return \"localhost\";\r\n else if (window.location.href.includes(\".dev\")) return \"development\";\r\n else return \"production\";\r\n})();\r\n\r\nexport { newGuid };\r\n\r\nexport class Platform {\r\n static readonly isAndroid = /android/i.test(navigator.userAgent);\r\n static readonly isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent);\r\n static readonly isWindows = /windows/i.test(navigator.userAgent);\r\n static readonly isMacOS = /Macintosh|MacIntel|MacPPC|Mac68K/.test(navigator.userAgent);\r\n}\r\n\r\nexport const getContrastTextColor = (color: string) => {\r\n const r = parseInt(color.substring(1, 3), 16);\r\n const g = parseInt(color.substring(3, 5), 16);\r\n const b = parseInt(color.substring(5, 7), 16);\r\n const yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;\r\n return (yiq >= 128) ? \"black\" : \"white\";\r\n};"]}