wcz-test 4.2.0 → 4.2.2

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 (2) hide show
  1. package/dist/index.js +11 -631
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { AppBar, Autocomplete, Avatar, Box, Button, CardHeader, Checkbox, Chip, Collapse, CssBaseline, Dialog, DialogActions, DialogContent, DialogTitle, Divider, Fab, FormControl, FormControlLabel, FormHelperText, FormLabel, IconButton, ImageListItem, ImageListItemBar, InitColorSchemeScript, LinearProgress, Link, List, ListItem, ListItemButton, ListItemIcon, ListItemText, ListSubheader, Menu, Paper, Radio, RadioGroup, Slider, Stack, Switch, Tab, TextField, Toolbar, Tooltip, Typography, createTheme, darken, lighten, useColorScheme, useEventCallback, useMediaQuery, useTheme } from "@mui/material";
2
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
1
+ import { Autocomplete, Box, Button, CardHeader, Checkbox, Chip, CssBaseline, Dialog, DialogActions, DialogContent, DialogTitle, Divider, Fab, FormControl, FormControlLabel, FormHelperText, FormLabel, IconButton, ImageListItem, ImageListItemBar, InitColorSchemeScript, LinearProgress, Link, List, ListItemButton, ListItemIcon, ListItemText, Menu, Paper, Radio, RadioGroup, Slider, Stack, Switch, Tab, TextField, Tooltip, Typography, createTheme, darken, lighten, useEventCallback, useTheme } from "@mui/material";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import * as React$1 from "react";
4
- import React, { Fragment as Fragment$1, createContext, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
4
+ import React, { Fragment, createContext, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
5
5
  import CloudUpload from "@mui/icons-material/CloudUpload";
6
6
  import { useDropzone } from "react-dropzone";
7
7
  import { initReactI18next, useTranslation, useTranslation as useTranslation$1 } from "react-i18next";
@@ -13,7 +13,7 @@ import { useIsFetching, useIsMutating, useMutation, useQuery, useQueryClient } f
13
13
  import saveAs from "file-saver";
14
14
  import { Upload } from "tus-js-client";
15
15
  import { uuidv7, uuidv7 as uuidv7$1 } from "uuidv7";
16
- import { createLink, useNavigate, useRouter, useRouterState } from "@tanstack/react-router";
16
+ import { createLink, useRouterState } from "@tanstack/react-router";
17
17
  import axios from "axios";
18
18
  import AttachFile from "@mui/icons-material/AttachFile";
19
19
  import Image from "@mui/icons-material/Image";
@@ -21,13 +21,7 @@ import SmartDisplay from "@mui/icons-material/SmartDisplay";
21
21
  import Close from "@mui/icons-material/Close";
22
22
  import Edit from "@mui/icons-material/Edit";
23
23
  import { GridActionsCellItem } from "@mui/x-data-grid-premium";
24
- import { ThemeProvider, styled, useTheme as useTheme$1, useThemeProps } from "@mui/material/styles";
25
- import Typography$1 from "@mui/material/Typography";
26
- import Paper$1 from "@mui/material/Paper";
27
- import Popper from "@mui/material/Popper";
28
- import List$1 from "@mui/material/List";
29
- import ListItem$1 from "@mui/material/ListItem";
30
- import Divider$1 from "@mui/material/Divider";
24
+ import { ThemeProvider, styled, useThemeProps } from "@mui/material/styles";
31
25
  import dayjs from "dayjs";
32
26
  import weekOfYearPlugin from "dayjs/plugin/weekOfYear.js";
33
27
  import customParseFormatPlugin from "dayjs/plugin/customParseFormat.js";
@@ -41,28 +35,7 @@ import { getCookie } from "@tanstack/react-start/server";
41
35
  import i18n, { t, default as i18next_default } from "i18next";
42
36
  import LanguageDetector from "i18next-browser-languagedetector";
43
37
  import HttpBackend from "i18next-http-backend";
44
- import Menu$1 from "@mui/icons-material/Menu";
45
- import MenuOpen from "@mui/icons-material/MenuOpen";
46
38
  import useLocalStorageState, { default as useLocalStorageState$1 } from "use-local-storage-state";
47
- import Box$1 from "@mui/material/Box";
48
- import Drawer from "@mui/material/Drawer";
49
- import ListSubheader$1 from "@mui/material/ListSubheader";
50
- import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
51
- import Avatar$1 from "@mui/material/Avatar";
52
- import ListItemButton$1 from "@mui/material/ListItemButton";
53
- import ListItemIcon$1 from "@mui/material/ListItemIcon";
54
- import ListItemText$1 from "@mui/material/ListItemText";
55
- import AccountCircle from "@mui/icons-material/AccountCircle";
56
- import ArrowBack from "@mui/icons-material/ArrowBack";
57
- import Brightness4 from "@mui/icons-material/Brightness4";
58
- import ChevronRight from "@mui/icons-material/ChevronRight";
59
- import DarkMode from "@mui/icons-material/DarkMode";
60
- import LightMode from "@mui/icons-material/LightMode";
61
- import Login from "@mui/icons-material/Login";
62
- import Logout from "@mui/icons-material/Logout";
63
- import SettingsBrightness from "@mui/icons-material/SettingsBrightness";
64
- import Translate from "@mui/icons-material/Translate";
65
- import "keycloak-js";
66
39
  import { csCZ, enUS } from "@mui/material/locale";
67
40
  import { createFormHook, createFormHookContexts } from "@tanstack/react-form";
68
41
  import { DatePicker, DateTimePicker } from "@mui/x-date-pickers-pro";
@@ -360,31 +333,6 @@ function useDialogs() {
360
333
 
361
334
  //#endregion
362
335
  //#region src/components/core/AppTitle.tsx
363
- const AppTitle = () => {
364
- const title = useAppTitle();
365
- return /* @__PURE__ */ jsxs(Stack, {
366
- direction: "row",
367
- alignItems: "center",
368
- spacing: 2,
369
- flexGrow: 1,
370
- children: [
371
- /* @__PURE__ */ jsx("img", {
372
- src: "/favicon-32x32.png",
373
- alt: "app-logo",
374
- loading: "lazy"
375
- }),
376
- /* @__PURE__ */ jsx(Typography, {
377
- variant: "h6",
378
- children: title
379
- }),
380
- import.meta.env.DEV && /* @__PURE__ */ jsx(Chip, {
381
- size: "small",
382
- label: "TEST",
383
- color: "info"
384
- })
385
- ]
386
- });
387
- };
388
336
  const useAppTitle = () => {
389
337
  return useRouterState({ select: (s) => s.matches[0] }).meta?.find((meta) => meta?.title)?.title;
390
338
  };
@@ -752,7 +700,7 @@ const GridFileViewerItem = ({ meta, size, itemBar }) => {
752
700
  default: return download(meta);
753
701
  }
754
702
  };
755
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(ImageListItem, {
703
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(ImageListItem, {
756
704
  sx: {
757
705
  width: size ?? IMAGE_SIZE,
758
706
  height: size ?? IMAGE_SIZE
@@ -826,7 +774,7 @@ const ListFileViewerItem = ({ meta }) => {
826
774
  default: return /* @__PURE__ */ jsx(AttachFile, {});
827
775
  }
828
776
  };
829
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(ListItemButton, {
777
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(ListItemButton, {
830
778
  onClick,
831
779
  children: [
832
780
  /* @__PURE__ */ jsx(ListItemIcon, { children: icon() }),
@@ -1305,7 +1253,7 @@ var require_react_is_development = /* @__PURE__ */ __commonJS({ "node_modules/pr
1305
1253
  var ContextProvider = REACT_PROVIDER_TYPE;
1306
1254
  var Element = REACT_ELEMENT_TYPE;
1307
1255
  var ForwardRef = REACT_FORWARD_REF_TYPE;
1308
- var Fragment$2 = REACT_FRAGMENT_TYPE;
1256
+ var Fragment$1 = REACT_FRAGMENT_TYPE;
1309
1257
  var Lazy = REACT_LAZY_TYPE;
1310
1258
  var Memo = REACT_MEMO_TYPE;
1311
1259
  var Portal = REACT_PORTAL_TYPE;
@@ -1362,7 +1310,7 @@ var require_react_is_development = /* @__PURE__ */ __commonJS({ "node_modules/pr
1362
1310
  exports.ContextProvider = ContextProvider;
1363
1311
  exports.Element = Element;
1364
1312
  exports.ForwardRef = ForwardRef;
1365
- exports.Fragment = Fragment$2;
1313
+ exports.Fragment = Fragment$1;
1366
1314
  exports.Lazy = Lazy;
1367
1315
  exports.Memo = Memo;
1368
1316
  exports.Portal = Portal;
@@ -2753,522 +2701,6 @@ const setSSRLanguage = createIsomorphicFn().server(async () => {
2753
2701
  //#region src/contexts/LayoutContext.ts
2754
2702
  const LayoutContext = createContext(null);
2755
2703
 
2756
- //#endregion
2757
- //#region src/components/core/navigation/NavigationListItem.tsx
2758
- const ICON_SIZE = 34;
2759
- const StyledNavButton = styled(ListItemButton$1)(({ theme }) => ({
2760
- borderRadius: 8,
2761
- "&.Mui-selected": {
2762
- "& .MuiListItemIcon-root, & .MuiTypography-root, & .MuiSvgIcon-root": { color: (theme.vars ?? theme).palette.primary.dark },
2763
- "& .MuiAvatar-root": { backgroundColor: (theme.vars ?? theme).palette.primary.dark },
2764
- "& .MuiTouchRipple-child": { backgroundColor: (theme.vars ?? theme).palette.primary.dark }
2765
- },
2766
- "& .MuiSvgIcon-root": { color: (theme.vars ?? theme).palette.action.active },
2767
- "& .MuiAvatar-root": { backgroundColor: (theme.vars ?? theme).palette.action.active }
2768
- }));
2769
- const StyledRouterButton = styled(RouterListItemButton)(({ theme }) => ({
2770
- borderRadius: 8,
2771
- "&.Mui-selected": {
2772
- "& .MuiListItemIcon-root, & .MuiTypography-root, & .MuiSvgIcon-root": { color: (theme.vars ?? theme).palette.primary.dark },
2773
- "& .MuiAvatar-root": { backgroundColor: (theme.vars ?? theme).palette.primary.dark },
2774
- "& .MuiTouchRipple-child": { backgroundColor: (theme.vars ?? theme).palette.primary.dark }
2775
- },
2776
- "& .MuiSvgIcon-root": { color: (theme.vars ?? theme).palette.action.active },
2777
- "& .MuiAvatar-root": { backgroundColor: (theme.vars ?? theme).palette.action.active }
2778
- }));
2779
- const IconOrAvatar = ({ item, collapsed }) => {
2780
- if (item.icon || collapsed) return /* @__PURE__ */ jsxs(Box$1, {
2781
- sx: collapsed ? {
2782
- position: "absolute",
2783
- left: "50%",
2784
- top: "calc(50% - 6px)",
2785
- transform: "translate(-50%, -50%)"
2786
- } : {},
2787
- children: [/* @__PURE__ */ jsxs(ListItemIcon$1, {
2788
- sx: {
2789
- display: "flex",
2790
- alignItems: "center",
2791
- justifyContent: "center",
2792
- minWidth: ICON_SIZE
2793
- },
2794
- children: [item.icon ?? null, !item.icon && collapsed ? /* @__PURE__ */ jsx(Avatar$1, {
2795
- sx: {
2796
- width: ICON_SIZE - 7,
2797
- height: ICON_SIZE - 7,
2798
- fontSize: 12
2799
- },
2800
- children: item.title
2801
- }) : null]
2802
- }), collapsed ? /* @__PURE__ */ jsx(Typography$1, {
2803
- variant: "caption",
2804
- sx: {
2805
- position: "absolute",
2806
- bottom: -18,
2807
- left: "50%",
2808
- transform: "translateX(-50%)",
2809
- fontSize: 10,
2810
- fontWeight: 500,
2811
- textAlign: "center",
2812
- whiteSpace: "nowrap",
2813
- overflow: "hidden",
2814
- textOverflow: "ellipsis",
2815
- maxWidth: MINI_WIDTH - 28
2816
- },
2817
- children: item.title
2818
- }) : null]
2819
- });
2820
- return null;
2821
- };
2822
- const MiniPopover = ({ open, anchorEl, children }) => /* @__PURE__ */ jsx(Popper, {
2823
- open,
2824
- anchorEl,
2825
- placement: "right-start",
2826
- modifiers: [
2827
- {
2828
- name: "offset",
2829
- options: { offset: [6, 0] }
2830
- },
2831
- {
2832
- name: "preventOverflow",
2833
- options: { padding: 8 }
2834
- },
2835
- {
2836
- name: "flip",
2837
- options: { fallbackPlacements: ["right-end", "left-start"] }
2838
- }
2839
- ],
2840
- children: /* @__PURE__ */ jsx(Paper$1, {
2841
- sx: {
2842
- pt: .5,
2843
- pb: .5,
2844
- maxHeight: "min(calc(100vh - 100px), 560px)",
2845
- overflowY: "auto",
2846
- overscrollBehavior: "contain"
2847
- },
2848
- children
2849
- })
2850
- });
2851
- const NavigationListItem = ({ item, isOpen, selected, disabled, collapsed, isSidebarFullyExpanded = true, isSidebarFullyCollapsed, onClick, renderNested }) => {
2852
- const [hoveredPopoverItem, setHoveredPopoverItem] = useState(null);
2853
- const [anchorElement, setAnchorElement] = useState(null);
2854
- const chevronSx = useMemo(() => {
2855
- if (collapsed && isSidebarFullyCollapsed && item.children) return {
2856
- fontSize: 18,
2857
- position: "absolute",
2858
- top: "41.5%",
2859
- right: "2px",
2860
- transform: "translateY(-50%) rotate(-90deg)"
2861
- };
2862
- if (!collapsed && isSidebarFullyExpanded && item.children) return {
2863
- ml: .5,
2864
- transform: `rotate(${isOpen ? 0 : -90}deg)`
2865
- };
2866
- return { display: "none" };
2867
- }, [
2868
- collapsed,
2869
- isSidebarFullyExpanded,
2870
- isSidebarFullyCollapsed,
2871
- isOpen,
2872
- item.children
2873
- ]);
2874
- const shouldJustExpand = item.children && !collapsed;
2875
- const buttonProps = {
2876
- selected,
2877
- disabled,
2878
- sx: {
2879
- px: 1.4,
2880
- height: collapsed ? 60 : 48
2881
- }
2882
- };
2883
- const buttonContent = /* @__PURE__ */ jsxs(Fragment, { children: [
2884
- /* @__PURE__ */ jsx(IconOrAvatar, {
2885
- item,
2886
- collapsed
2887
- }),
2888
- !collapsed && /* @__PURE__ */ jsx(ListItemText$1, {
2889
- primary: item.title,
2890
- slotProps: { primary: {
2891
- noWrap: true,
2892
- title: item.title
2893
- } },
2894
- sx: {
2895
- ml: 1.2,
2896
- flex: 1,
2897
- minWidth: 0,
2898
- "& .MuiTypography-root": {
2899
- whiteSpace: "nowrap",
2900
- overflow: "hidden",
2901
- textOverflow: "ellipsis"
2902
- }
2903
- }
2904
- }),
2905
- item.children ? /* @__PURE__ */ jsx(ExpandMoreIcon, { sx: chevronSx }) : null
2906
- ] });
2907
- const listItem = /* @__PURE__ */ jsxs(ListItem$1, {
2908
- ...item.children && collapsed ? {
2909
- onMouseEnter: (event) => {
2910
- setAnchorElement(event.currentTarget);
2911
- setHoveredPopoverItem(item.title);
2912
- },
2913
- onMouseLeave: () => {
2914
- setHoveredPopoverItem(null);
2915
- }
2916
- } : {},
2917
- sx: {
2918
- py: 0,
2919
- px: 1,
2920
- overflowX: "hidden"
2921
- },
2922
- children: [shouldJustExpand ? /* @__PURE__ */ jsx(StyledNavButton, {
2923
- ...buttonProps,
2924
- onClick: () => onClick?.(item),
2925
- children: buttonContent
2926
- }) : /* @__PURE__ */ jsx(StyledRouterButton, {
2927
- ...buttonProps,
2928
- to: item.to,
2929
- href: item.href,
2930
- params: item.params,
2931
- search: item.search,
2932
- children: buttonContent
2933
- }), item.children && collapsed ? /* @__PURE__ */ jsx(MiniPopover, {
2934
- open: item.title === hoveredPopoverItem,
2935
- anchorEl: anchorElement,
2936
- children: renderNested?.(item.children)
2937
- }) : null]
2938
- });
2939
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [listItem, item.children && !collapsed ? /* @__PURE__ */ jsx(Collapse, {
2940
- in: isOpen,
2941
- timeout: "auto",
2942
- unmountOnExit: true,
2943
- children: renderNested?.(item.children)
2944
- }) : null] }, item.to);
2945
- };
2946
-
2947
- //#endregion
2948
- //#region src/components/core/navigation/NavigationList.tsx
2949
- const isPageItem = (item) => !("kind" in item);
2950
- const isDivider = (item) => "kind" in item && item.kind === "divider";
2951
- const isHeader = (item) => "kind" in item && item.kind === "header";
2952
- const NavigationList = ({ subNavigation, depth = 0, collapsed, isPopover, isSidebarFullyExpanded = true, isSidebarFullyCollapsed, expandedWidth, renderItem, activePath, onNavigate }) => {
2953
- const [openKeys, setOpenKeys] = useState([]);
2954
- useEffect(() => {
2955
- if (collapsed) setOpenKeys([]);
2956
- }, [collapsed]);
2957
- const toggleKey = (key) => setOpenKeys((previous) => previous.includes(key) ? previous.filter((k$1) => k$1 !== key) : [...previous, key]);
2958
- const renderNested = (children) => /* @__PURE__ */ jsx(NavigationList, {
2959
- subNavigation: children,
2960
- depth: depth + 1,
2961
- isPopover: collapsed,
2962
- expandedWidth,
2963
- activePath,
2964
- onNavigate
2965
- });
2966
- const filteredNavigation = subNavigation.filter((nav) => !nav.hidden);
2967
- return /* @__PURE__ */ jsx(List$1, {
2968
- sx: {
2969
- padding: 0,
2970
- mt: isPopover && depth === 1 ? .5 : 0,
2971
- mb: depth === 0 && !isPopover ? 4 : .5,
2972
- pl: (isPopover ? 1 : 2) * (isPopover ? depth - 1 : depth),
2973
- minWidth: isPopover && depth === 1 ? EXPANDED_WIDTH : "auto",
2974
- width: collapsed ? MINI_WIDTH : "auto"
2975
- },
2976
- children: filteredNavigation.map((navItem, index) => {
2977
- if (isHeader(navItem)) return /* @__PURE__ */ jsx(ListSubheader$1, {
2978
- sx: {
2979
- fontSize: 12,
2980
- fontWeight: "700",
2981
- height: collapsed ? 0 : 40,
2982
- px: 2,
2983
- minWidth: expandedWidth,
2984
- overflow: "hidden",
2985
- textOverflow: "ellipsis",
2986
- whiteSpace: "nowrap",
2987
- zIndex: 2,
2988
- bgcolor: "transparent",
2989
- position: "static"
2990
- },
2991
- children: navItem.title
2992
- }, `subheader-${depth}-${index}`);
2993
- if (isDivider(navItem)) {
2994
- const nextItem = filteredNavigation[index + 1];
2995
- return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Divider$1, { sx: {
2996
- mx: 1,
2997
- mt: 1,
2998
- mb: isHeader(nextItem) && !collapsed ? 0 : 1
2999
- } }) }, `divider-${depth}-${index}`);
3000
- }
3001
- if (!isPageItem(navItem)) return null;
3002
- const key = `item-${depth}-${index}`;
3003
- const uniqueItemKey = `${depth}-${index}-${navItem.title}`;
3004
- if (renderItem) return /* @__PURE__ */ jsx(Fragment$1, { children: renderItem(navItem, { collapsed: !!collapsed }) }, key);
3005
- return /* @__PURE__ */ jsx(NavigationListItem, {
3006
- item: navItem,
3007
- isOpen: openKeys.includes(uniqueItemKey),
3008
- selected: activePath === navItem.to,
3009
- collapsed,
3010
- isSidebarFullyExpanded,
3011
- isSidebarFullyCollapsed,
3012
- onClick: navItem.children && !collapsed ? () => toggleKey(uniqueItemKey) : void 0,
3013
- renderNested
3014
- }, key);
3015
- })
3016
- });
3017
- };
3018
-
3019
- //#endregion
3020
- //#region src/components/core/navigation/NavigationRail.tsx
3021
- const MINI_WIDTH = 84;
3022
- const EXPANDED_WIDTH = 320;
3023
- const TOOLBAR_HEIGHT = 65;
3024
- const NavigationRail = ({ navigation, expanded, setExpanded }) => {
3025
- const navigate = useNavigate();
3026
- const routerState = useRouterState();
3027
- const theme = useTheme$1();
3028
- const showPermanent = useMediaQuery(theme.breakpoints.up("sm"));
3029
- const drawerContent = (collapsed) => /* @__PURE__ */ jsx(Box$1, {
3030
- component: "nav",
3031
- sx: {
3032
- height: "100%",
3033
- display: "flex",
3034
- flexDirection: "column",
3035
- justifyContent: "space-between",
3036
- overflow: "auto",
3037
- scrollbarGutter: collapsed ? "stable" : "auto",
3038
- overflowX: "hidden",
3039
- pt: navigation[0] && isHeader(navigation[0]) && !collapsed ? 0 : 2
3040
- },
3041
- children: /* @__PURE__ */ jsx(NavigationList, {
3042
- subNavigation: navigation,
3043
- collapsed,
3044
- isSidebarFullyExpanded: expanded,
3045
- isSidebarFullyCollapsed: !expanded,
3046
- expandedWidth: EXPANDED_WIDTH,
3047
- activePath: routerState.location.pathname,
3048
- onNavigate: navigate
3049
- })
3050
- });
3051
- if (showPermanent) return /* @__PURE__ */ jsx(Drawer, {
3052
- variant: "permanent",
3053
- sx: {
3054
- width: expanded ? EXPANDED_WIDTH : MINI_WIDTH,
3055
- ["& .MuiDrawer-paper"]: {
3056
- position: "absolute",
3057
- top: `${TOOLBAR_HEIGHT}px`,
3058
- height: `calc(100% - ${TOOLBAR_HEIGHT}px)`,
3059
- width: expanded ? EXPANDED_WIDTH : MINI_WIDTH
3060
- }
3061
- },
3062
- children: drawerContent(!expanded)
3063
- });
3064
- return /* @__PURE__ */ jsx(Drawer, {
3065
- open: expanded,
3066
- onClose: () => setExpanded(false),
3067
- children: drawerContent(!expanded)
3068
- });
3069
- };
3070
-
3071
- //#endregion
3072
- //#region src/auth-test/keycloak.ts
3073
- const keycloakConfig = {
3074
- url: import.meta.env.VITE_KEYCLOAK_URL,
3075
- realm: import.meta.env.VITE_KEYCLOAK_REALM,
3076
- clientId: import.meta.env.VITE_KEYCLOAK_CLIENT_ID,
3077
- idpHint: import.meta.env.VITE_KEYCLOAK_IDP_HINT,
3078
- confidentialClientId: import.meta.env.VITE_KEYCLOAK_CONFIDENTIAL_CLIENT_ID,
3079
- confidentialClientSecret: import.meta.env.VITE_KEYCLOAK_CONFIDENTIAL_CLIENT_SECRET
3080
- };
3081
- function useKeycloak() {
3082
- return useRouter().options.context.keycloak;
3083
- }
3084
-
3085
- //#endregion
3086
- //#region src/components/core/ToolbarAccount.tsx
3087
- const ToolbarAccount = () => {
3088
- const [anchorElement, setAnchorElement] = useState();
3089
- const [tab, setTab] = useState("settings");
3090
- const open = Boolean(anchorElement);
3091
- const { t: t$2, i18n: i18n$1 } = useTranslation$1();
3092
- const { mode, setMode } = useColorScheme();
3093
- const changeLanguage = (newLanguage) => () => {
3094
- i18n$1.changeLanguage(newLanguage).finally(() => closeMenu());
3095
- };
3096
- const changeMode = (newMode) => () => {
3097
- setMode(newMode);
3098
- closeMenu();
3099
- };
3100
- const keycloak = useKeycloak();
3101
- const user = keycloak.user;
3102
- const getModeText = () => {
3103
- switch (mode) {
3104
- case "light": return t$2("Layout.Light");
3105
- case "dark": return t$2("Layout.Dark");
3106
- default: return t$2("Layout.System");
3107
- }
3108
- };
3109
- const usernameInitials = () => {
3110
- if (!user?.name) return "";
3111
- const splittedName = user.name.split(" ");
3112
- return `${splittedName[0][0]}${splittedName.length > 1 ? splittedName[1][0] : ""}`;
3113
- };
3114
- const openMenu = (event) => setAnchorElement(event.currentTarget);
3115
- const closeMenu = () => {
3116
- setAnchorElement(void 0);
3117
- setTimeout(() => setTab("settings"), 300);
3118
- };
3119
- const changeTab = (newTab) => () => setTab(newTab);
3120
- const settings = /* @__PURE__ */ jsxs(List, {
3121
- component: "nav",
3122
- subheader: /* @__PURE__ */ jsx(ListSubheader, {
3123
- sx: { backgroundColor: "transparent" },
3124
- children: t$2("Layout.Settings")
3125
- }),
3126
- children: [/* @__PURE__ */ jsxs(ListItemButton, {
3127
- onClick: changeTab("theme"),
3128
- sx: { py: .3 },
3129
- children: [
3130
- /* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Brightness4, {}) }),
3131
- /* @__PURE__ */ jsx(ListItemText, {
3132
- primary: t$2("Layout.Appearance"),
3133
- secondary: getModeText()
3134
- }),
3135
- /* @__PURE__ */ jsx(ChevronRight, {})
3136
- ]
3137
- }), /* @__PURE__ */ jsxs(ListItemButton, {
3138
- onClick: changeTab("language"),
3139
- sx: { py: .3 },
3140
- children: [
3141
- /* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Translate, {}) }),
3142
- /* @__PURE__ */ jsx(ListItemText, {
3143
- primary: t$2("Layout.Language"),
3144
- secondary: i18n$1.resolvedLanguage === "en" ? "English" : "Čeština"
3145
- }),
3146
- /* @__PURE__ */ jsx(ChevronRight, {})
3147
- ]
3148
- })]
3149
- });
3150
- const theme = /* @__PURE__ */ jsxs(List, {
3151
- subheader: /* @__PURE__ */ jsxs(ListSubheader, {
3152
- onClick: changeTab("settings"),
3153
- sx: {
3154
- backgroundColor: "transparent",
3155
- display: "flex",
3156
- alignItems: "center",
3157
- px: 1,
3158
- cursor: "pointer"
3159
- },
3160
- children: [
3161
- /* @__PURE__ */ jsx(IconButton, {
3162
- size: "small",
3163
- sx: { mr: .5 },
3164
- children: /* @__PURE__ */ jsx(ArrowBack, { fontSize: "small" })
3165
- }),
3166
- " ",
3167
- t$2("Layout.Appearance")
3168
- ]
3169
- }),
3170
- children: [
3171
- /* @__PURE__ */ jsxs(ListItemButton, {
3172
- onClick: changeMode("light"),
3173
- disabled: mode === "light",
3174
- children: [/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(LightMode, {}) }), /* @__PURE__ */ jsx(ListItemText, { primary: t$2("Layout.Light") })]
3175
- }),
3176
- /* @__PURE__ */ jsxs(ListItemButton, {
3177
- onClick: changeMode("dark"),
3178
- disabled: mode === "dark",
3179
- children: [/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(DarkMode, {}) }), /* @__PURE__ */ jsx(ListItemText, { primary: t$2("Layout.Dark") })]
3180
- }),
3181
- /* @__PURE__ */ jsxs(ListItemButton, {
3182
- onClick: changeMode("system"),
3183
- disabled: mode === "system",
3184
- children: [/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(SettingsBrightness, {}) }), /* @__PURE__ */ jsx(ListItemText, { primary: t$2("Layout.System") })]
3185
- })
3186
- ]
3187
- });
3188
- const language = /* @__PURE__ */ jsxs(List, {
3189
- subheader: /* @__PURE__ */ jsxs(ListSubheader, {
3190
- onClick: changeTab("settings"),
3191
- sx: {
3192
- backgroundColor: "transparent",
3193
- display: "flex",
3194
- alignItems: "center",
3195
- px: 1,
3196
- cursor: "pointer"
3197
- },
3198
- children: [
3199
- /* @__PURE__ */ jsx(IconButton, {
3200
- size: "small",
3201
- sx: { mr: .5 },
3202
- children: /* @__PURE__ */ jsx(ArrowBack, { fontSize: "small" })
3203
- }),
3204
- " ",
3205
- t$2("Layout.Language")
3206
- ]
3207
- }),
3208
- children: [/* @__PURE__ */ jsx(ListItemButton, {
3209
- onClick: changeLanguage("en"),
3210
- disabled: i18n$1.resolvedLanguage === "en",
3211
- children: /* @__PURE__ */ jsx(ListItemText, { primary: "English" })
3212
- }), /* @__PURE__ */ jsx(ListItemButton, {
3213
- onClick: changeLanguage("cs"),
3214
- disabled: i18n$1.resolvedLanguage === "cs",
3215
- children: /* @__PURE__ */ jsx(ListItemText, { primary: "Čeština" })
3216
- })]
3217
- });
3218
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(IconButton, {
3219
- size: "small",
3220
- edge: "end",
3221
- onClick: openMenu,
3222
- children: user?.name ? /* @__PURE__ */ jsx(Avatar, {
3223
- sx: {
3224
- width: {
3225
- xs: 32,
3226
- sm: 40
3227
- },
3228
- height: {
3229
- xs: 32,
3230
- sm: 40
3231
- },
3232
- bgcolor: "primary.main"
3233
- },
3234
- children: /* @__PURE__ */ jsx(Typography, {
3235
- variant: "subtitle2",
3236
- sx: {
3237
- fontWeight: "bold",
3238
- lineHeight: 0
3239
- },
3240
- children: usernameInitials()
3241
- })
3242
- }) : /* @__PURE__ */ jsx(AccountCircle, { fontSize: "large" })
3243
- }), /* @__PURE__ */ jsx(Menu, {
3244
- anchorEl: anchorElement,
3245
- open,
3246
- onClose: closeMenu,
3247
- children: /* @__PURE__ */ jsxs(Box, {
3248
- sx: { width: 240 },
3249
- children: [
3250
- /* @__PURE__ */ jsx(List, { children: user?.name ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ListItem, { children: /* @__PURE__ */ jsx(ListItemText, {
3251
- primary: user.name,
3252
- secondary: /* @__PURE__ */ jsxs("span", { children: [
3253
- /* @__PURE__ */ jsx("span", { children: user.employeeId }),
3254
- /* @__PURE__ */ jsx("br", {}),
3255
- /* @__PURE__ */ jsx("span", { children: user.department })
3256
- ] })
3257
- }) }), /* @__PURE__ */ jsxs(ListItemButton, {
3258
- onClick: () => keycloak.logout(),
3259
- children: [/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Logout, { color: "error" }) }), /* @__PURE__ */ jsx(ListItemText, { primary: t$2("Layout.Logout") })]
3260
- })] }) : /* @__PURE__ */ jsxs(ListItemButton, {
3261
- onClick: () => keycloak.login(),
3262
- children: [/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Login, { color: "success" }) }), /* @__PURE__ */ jsx(ListItemText, { primary: t$2("Layout.LogIn") })]
3263
- }) }),
3264
- tab === "settings" && settings,
3265
- tab === "theme" && theme,
3266
- tab === "language" && language
3267
- ]
3268
- })
3269
- })] });
3270
- };
3271
-
3272
2704
  //#endregion
3273
2705
  //#region node_modules/@mui/x-data-grid/esm/utils/getGridLocalization.js
3274
2706
  const getGridLocalization = (gridTranslations) => ({ components: { MuiDataGrid: { defaultProps: { localeText: gridTranslations } } } });
@@ -3772,7 +3204,7 @@ const useGetTheme = (theme) => {
3772
3204
 
3773
3205
  //#endregion
3774
3206
  //#region src/components/core/Layout.tsx
3775
- const DrawerHeader = styled("div")(({ theme }) => ({
3207
+ styled("div")(({ theme }) => ({
3776
3208
  display: "flex",
3777
3209
  alignItems: "center",
3778
3210
  justifyContent: "flex-end",
@@ -3789,59 +3221,7 @@ const Layout = (props) => {
3789
3221
  children: [
3790
3222
  /* @__PURE__ */ jsx(InitColorSchemeScript, {}),
3791
3223
  /* @__PURE__ */ jsx(CssBaseline, {}),
3792
- /* @__PURE__ */ jsxs(Box, {
3793
- sx: {
3794
- display: "flex",
3795
- height: "100dvh",
3796
- maxHeight: "100dvh",
3797
- overflow: "hidden",
3798
- width: "100%"
3799
- },
3800
- children: [
3801
- /* @__PURE__ */ jsx(AppBar, {
3802
- color: "transparent",
3803
- position: "fixed",
3804
- sx: {
3805
- borderBottom: "1px solid",
3806
- borderColor: theme.vars?.palette.divider,
3807
- boxShadow: "none"
3808
- },
3809
- children: /* @__PURE__ */ jsxs(Toolbar, { children: [
3810
- props.navigation && /* @__PURE__ */ jsx(IconButton, {
3811
- onClick: () => setNavigationOpen((previous) => !previous),
3812
- sx: { marginRight: 2 },
3813
- children: navigationOpen ? /* @__PURE__ */ jsx(MenuOpen, {}) : /* @__PURE__ */ jsx(Menu$1, {})
3814
- }),
3815
- /* @__PURE__ */ jsx(AppTitle, {}),
3816
- /* @__PURE__ */ jsx(ToolbarAccount, {})
3817
- ] })
3818
- }),
3819
- props.navigation && /* @__PURE__ */ jsx(NavigationRail, {
3820
- navigation: props.navigation,
3821
- expanded: navigationOpen ?? false,
3822
- setExpanded: setNavigationOpen
3823
- }),
3824
- /* @__PURE__ */ jsxs(Box, {
3825
- component: "main",
3826
- sx: {
3827
- flexGrow: 1,
3828
- display: "flex",
3829
- flexDirection: "column",
3830
- minWidth: 0,
3831
- height: "100%",
3832
- overflow: "hidden"
3833
- },
3834
- children: [/* @__PURE__ */ jsx(DrawerHeader, {}), /* @__PURE__ */ jsx(Box, {
3835
- sx: {
3836
- flex: 1,
3837
- overflow: "auto",
3838
- position: "relative"
3839
- },
3840
- children: props.children
3841
- })]
3842
- })
3843
- ]
3844
- }),
3224
+ props.children,
3845
3225
  (isFetching || isMutating) && /* @__PURE__ */ jsx(LinearProgress, { sx: {
3846
3226
  position: "fixed",
3847
3227
  top: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wcz-test",
3
3
  "displayName": "WCZ Layout",
4
- "version": "4.2.0",
4
+ "version": "4.2.2",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "type": "module",