wcz-test 4.8.0 → 4.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -975,67 +975,36 @@ var require_prop_types = __commonJS({
975
975
  // src/components/core/TypographyWithIcon.tsx
976
976
  import { Stack, Typography } from "@mui/material";
977
977
  import { jsx, jsxs } from "react/jsx-runtime";
978
- var stackSxProps = [
979
- "margin",
980
- "marginTop",
981
- "marginRight",
982
- "marginBottom",
983
- "marginLeft",
984
- "m",
985
- "mt",
986
- "mr",
987
- "mb",
988
- "ml",
989
- "mx",
990
- "my",
991
- "padding",
992
- "paddingTop",
993
- "paddingRight",
994
- "paddingBottom",
995
- "paddingLeft",
996
- "p",
997
- "pt",
998
- "pr",
999
- "pb",
1000
- "pl",
1001
- "px",
1002
- "py",
1003
- "flexGrow",
1004
- "flexShrink",
1005
- "flexBasis",
1006
- "flexDirection",
1007
- "alignItems",
1008
- "justifyContent",
1009
- "position",
1010
- "zIndex",
1011
- "top",
1012
- "right",
1013
- "bottom",
1014
- "left",
1015
- "gridGap",
1016
- "gridColumnGap",
1017
- "gridRowGap",
1018
- "gridColumn",
1019
- "gridRow",
1020
- "gridAutoFlow",
1021
- "gap",
1022
- "columnGap",
1023
- "rowGap"
1024
- ];
1025
- var TypographyWithIcon = ({ startIcon, endIcon, children, sx, gutterBottom, ...props }) => {
1026
- const sxCopy = { ...sx };
1027
- const stackStyles = {};
1028
- for (const current of stackSxProps) {
1029
- if (sxCopy[current]) {
1030
- stackStyles[current] = sxCopy[current];
1031
- delete sxCopy[current];
978
+ var TypographyWithIcon = ({ startIcon, endIcon, children, sx, ...props }) => {
979
+ const iconSx = {
980
+ display: "inline-flex",
981
+ alignItems: "center",
982
+ justifyContent: "center",
983
+ flexShrink: 0,
984
+ lineHeight: 0,
985
+ "& > svg": {
986
+ display: "block"
1032
987
  }
1033
- }
1034
- return /* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "center", gap: 1, sx: stackStyles, mb: gutterBottom ? 0.7 : void 0, children: [
1035
- startIcon,
1036
- /* @__PURE__ */ jsx(Typography, { ...props, sx: sxCopy, children }),
1037
- endIcon
1038
- ] });
988
+ };
989
+ return /* @__PURE__ */ jsxs(
990
+ Typography,
991
+ {
992
+ component: "span",
993
+ sx: {
994
+ display: "inline-flex",
995
+ alignItems: "center",
996
+ verticalAlign: "middle",
997
+ ...sx
998
+ },
999
+ gap: 1,
1000
+ ...props,
1001
+ children: [
1002
+ startIcon && /* @__PURE__ */ jsx(Stack, { component: "span", sx: iconSx, children: startIcon }),
1003
+ /* @__PURE__ */ jsx(Stack, { component: "span", sx: { display: "inline", lineHeight: "inherit" }, children }),
1004
+ endIcon && /* @__PURE__ */ jsx(Stack, { component: "span", sx: iconSx, children: endIcon })
1005
+ ]
1006
+ }
1007
+ );
1039
1008
  };
1040
1009
 
1041
1010
  // src/components/core/Fullscreen.tsx
@@ -1247,7 +1216,7 @@ var rootRouteHead = ({ title }) => () => ({
1247
1216
  { rel: "apple-touch-icon", sizes: "180x180", href: "/apple-touch-icon.png" },
1248
1217
  { rel: "icon", type: "image/png", sizes: "32x32", href: "/favicon-32x32.png" },
1249
1218
  { rel: "icon", type: "image/png", sizes: "16x16", href: "/favicon-16x16.png" },
1250
- { rel: "manifest", href: "/manifest" },
1219
+ { rel: "manifest", href: "/manifest.json" },
1251
1220
  { rel: "icon", href: "/favicon.ico" }
1252
1221
  ]
1253
1222
  });
@@ -2566,10 +2535,9 @@ var AdapterDayjs = class {
2566
2535
  };
2567
2536
 
2568
2537
  // src/providers/LayoutProvider.tsx
2569
- import { useEffect as useEffect6 } from "react";
2538
+ import { useEffect as useEffect6, useEffectEvent } from "react";
2570
2539
  import { useTranslation as useTranslation7 } from "react-i18next";
2571
2540
  import * as z from "zod";
2572
- import { cs, en } from "zod/locales";
2573
2541
 
2574
2542
  // src/components/core/Layout.tsx
2575
2543
  import Menu3 from "@mui/icons-material/Menu";
@@ -2942,38 +2910,27 @@ import Translate from "@mui/icons-material/Translate";
2942
2910
  import { Avatar as Avatar2, Box as Box8, IconButton as IconButton4, List as List4, ListItem as ListItem2, ListItemButton as ListItemButton5, ListItemIcon as ListItemIcon4, ListItemText as ListItemText4, ListSubheader as ListSubheader2, Menu as Menu2, Typography as Typography7, useColorScheme } from "@mui/material";
2943
2911
  import { Fragment as Fragment6, useState as useState8 } from "react";
2944
2912
  import { useTranslation as useTranslation5 } from "react-i18next";
2913
+ import Done from "@mui/icons-material/Done";
2945
2914
  import { jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
2915
+ var capitalize = (value) => value && value.charAt(0).toUpperCase() + value.slice(1);
2946
2916
  var ToolbarAccount = () => {
2947
2917
  const [anchorElement, setAnchorElement] = useState8();
2948
2918
  const [tab, setTab] = useState8("settings");
2949
2919
  const open = Boolean(anchorElement);
2950
2920
  const { t: t2, i18n } = useTranslation5();
2951
2921
  const { mode, setMode } = useColorScheme();
2952
- const changeLanguage = (newLanguage) => () => {
2953
- i18n.changeLanguage(newLanguage).finally(() => closeMenu());
2954
- };
2955
- const changeMode = (newMode) => () => {
2956
- setMode(newMode);
2957
- closeMenu();
2958
- };
2922
+ const supportedLanguages = (Array.isArray(i18n.options.supportedLngs) ? i18n.options.supportedLngs : []).filter((lng) => lng !== "cimode");
2923
+ const languageDisplayNames = new Intl.DisplayNames([i18n.language], { type: "language" });
2924
+ const colorModes = [
2925
+ { mode: "light", icon: LightMode, label: t2("Layout.Light") },
2926
+ { mode: "dark", icon: DarkMode, label: t2("Layout.Dark") },
2927
+ { mode: "system", icon: SettingsBrightness, label: t2("Layout.System") }
2928
+ ];
2959
2929
  const user = {
2960
2930
  name: "Dalibor Homola",
2961
2931
  employeeId: "C2503017",
2962
2932
  department: "IT"
2963
2933
  };
2964
- const getModeText = () => {
2965
- switch (mode) {
2966
- case "light": {
2967
- return t2("Layout.Light");
2968
- }
2969
- case "dark": {
2970
- return t2("Layout.Dark");
2971
- }
2972
- default: {
2973
- return t2("Layout.System");
2974
- }
2975
- }
2976
- };
2977
2934
  const usernameInitials = () => {
2978
2935
  if (!user.name) return "";
2979
2936
  const splittedName = user.name.split(" ");
@@ -2988,41 +2945,52 @@ var ToolbarAccount = () => {
2988
2945
  const settings = /* @__PURE__ */ jsxs13(List4, { component: "nav", subheader: /* @__PURE__ */ jsx24(ListSubheader2, { sx: { backgroundColor: "transparent" }, children: t2("Layout.Settings") }), children: [
2989
2946
  /* @__PURE__ */ jsxs13(ListItemButton5, { onClick: changeTab("theme"), sx: { py: 0.3 }, children: [
2990
2947
  /* @__PURE__ */ jsx24(ListItemIcon4, { children: /* @__PURE__ */ jsx24(Brightness4, {}) }),
2991
- /* @__PURE__ */ jsx24(ListItemText4, { primary: t2("Layout.Appearance"), secondary: getModeText() }),
2948
+ /* @__PURE__ */ jsx24(ListItemText4, { primary: t2("Layout.Appearance"), secondary: colorModes.find((m) => m.mode === mode)?.label }),
2992
2949
  /* @__PURE__ */ jsx24(ChevronRight, {})
2993
2950
  ] }),
2994
2951
  /* @__PURE__ */ jsxs13(ListItemButton5, { onClick: changeTab("language"), sx: { py: 0.3 }, children: [
2995
2952
  /* @__PURE__ */ jsx24(ListItemIcon4, { children: /* @__PURE__ */ jsx24(Translate, {}) }),
2996
- /* @__PURE__ */ jsx24(ListItemText4, { primary: t2("Layout.Language"), secondary: i18n.resolvedLanguage === "en" ? "English" : "\u010Ce\u0161tina" }),
2953
+ /* @__PURE__ */ jsx24(ListItemText4, { primary: t2("Layout.Language"), secondary: capitalize(languageDisplayNames.of(i18n.language)) }),
2997
2954
  /* @__PURE__ */ jsx24(ChevronRight, {})
2998
2955
  ] })
2999
2956
  ] });
3000
- const theme = /* @__PURE__ */ jsxs13(List4, { subheader: /* @__PURE__ */ jsxs13(ListSubheader2, { onClick: changeTab("settings"), sx: { backgroundColor: "transparent", display: "flex", alignItems: "center", px: 1, cursor: "pointer" }, children: [
2957
+ const theme = /* @__PURE__ */ jsx24(List4, { subheader: /* @__PURE__ */ jsxs13(ListSubheader2, { onClick: changeTab("settings"), sx: { backgroundColor: "transparent", display: "flex", alignItems: "center", px: 1, cursor: "pointer" }, children: [
3001
2958
  /* @__PURE__ */ jsx24(IconButton4, { size: "small", sx: { mr: 0.5 }, children: /* @__PURE__ */ jsx24(ArrowBack, { fontSize: "small" }) }),
3002
2959
  " ",
3003
2960
  t2("Layout.Appearance")
3004
- ] }), children: [
3005
- /* @__PURE__ */ jsxs13(ListItemButton5, { onClick: changeMode("light"), disabled: mode === "light", children: [
3006
- /* @__PURE__ */ jsx24(ListItemIcon4, { children: /* @__PURE__ */ jsx24(LightMode, {}) }),
3007
- /* @__PURE__ */ jsx24(ListItemText4, { primary: t2("Layout.Light") })
3008
- ] }),
3009
- /* @__PURE__ */ jsxs13(ListItemButton5, { onClick: changeMode("dark"), disabled: mode === "dark", children: [
3010
- /* @__PURE__ */ jsx24(ListItemIcon4, { children: /* @__PURE__ */ jsx24(DarkMode, {}) }),
3011
- /* @__PURE__ */ jsx24(ListItemText4, { primary: t2("Layout.Dark") })
3012
- ] }),
3013
- /* @__PURE__ */ jsxs13(ListItemButton5, { onClick: changeMode("system"), disabled: mode === "system", children: [
3014
- /* @__PURE__ */ jsx24(ListItemIcon4, { children: /* @__PURE__ */ jsx24(SettingsBrightness, {}) }),
3015
- /* @__PURE__ */ jsx24(ListItemText4, { primary: t2("Layout.System") })
3016
- ] })
3017
- ] });
3018
- const language = /* @__PURE__ */ jsxs13(List4, { subheader: /* @__PURE__ */ jsxs13(ListSubheader2, { onClick: changeTab("settings"), sx: { backgroundColor: "transparent", display: "flex", alignItems: "center", px: 1, cursor: "pointer" }, children: [
2961
+ ] }), children: colorModes.map(({ mode: modeValue, icon: Icon, label }) => /* @__PURE__ */ jsxs13(
2962
+ ListItemButton5,
2963
+ {
2964
+ onClick: () => {
2965
+ setMode(modeValue);
2966
+ closeMenu();
2967
+ },
2968
+ selected: mode === modeValue,
2969
+ children: [
2970
+ /* @__PURE__ */ jsx24(ListItemIcon4, { children: /* @__PURE__ */ jsx24(Icon, {}) }),
2971
+ /* @__PURE__ */ jsx24(ListItemText4, { primary: label })
2972
+ ]
2973
+ },
2974
+ modeValue
2975
+ )) });
2976
+ const language = /* @__PURE__ */ jsx24(List4, { subheader: /* @__PURE__ */ jsxs13(ListSubheader2, { onClick: changeTab("settings"), sx: { backgroundColor: "transparent", display: "flex", alignItems: "center", px: 1, cursor: "pointer" }, children: [
3019
2977
  /* @__PURE__ */ jsx24(IconButton4, { size: "small", sx: { mr: 0.5 }, children: /* @__PURE__ */ jsx24(ArrowBack, { fontSize: "small" }) }),
3020
2978
  " ",
3021
2979
  t2("Layout.Language")
3022
- ] }), children: [
3023
- /* @__PURE__ */ jsx24(ListItemButton5, { onClick: changeLanguage("en"), disabled: i18n.resolvedLanguage === "en", children: /* @__PURE__ */ jsx24(ListItemText4, { primary: "English" }) }),
3024
- /* @__PURE__ */ jsx24(ListItemButton5, { onClick: changeLanguage("cs"), disabled: i18n.resolvedLanguage === "cs", children: /* @__PURE__ */ jsx24(ListItemText4, { primary: "\u010Ce\u0161tina" }) })
3025
- ] });
2980
+ ] }), children: supportedLanguages.map(
2981
+ (languageCode) => /* @__PURE__ */ jsxs13(
2982
+ ListItemButton5,
2983
+ {
2984
+ onClick: () => i18n.changeLanguage(languageCode).finally(() => closeMenu()),
2985
+ selected: i18n.resolvedLanguage === languageCode,
2986
+ children: [
2987
+ /* @__PURE__ */ jsx24(ListItemIcon4, { children: i18n.resolvedLanguage === languageCode && /* @__PURE__ */ jsx24(Done, {}) }),
2988
+ /* @__PURE__ */ jsx24(ListItemText4, { primary: capitalize(languageDisplayNames.of(languageCode)) })
2989
+ ]
2990
+ },
2991
+ languageCode
2992
+ )
2993
+ ) });
3026
2994
  return /* @__PURE__ */ jsxs13(Fragment6, { children: [
3027
2995
  /* @__PURE__ */ jsx24(IconButton4, { size: "small", edge: "end", onClick: openMenu, children: user.name ? /* @__PURE__ */ jsx24(Avatar2, { sx: { width: { xs: 32, sm: 40 }, height: { xs: 32, sm: 40 }, bgcolor: "primary.main" }, children: /* @__PURE__ */ jsx24(Typography7, { variant: "subtitle2", sx: { fontWeight: "bold", lineHeight: 0 }, children: usernameInitials() }) }) : /* @__PURE__ */ jsx24(AccountCircle, { fontSize: "large" }) }),
3028
2996
  /* @__PURE__ */ jsx24(Menu2, { anchorEl: anchorElement, open, onClose: closeMenu, children: /* @__PURE__ */ jsxs13(Box8, { sx: { width: 240 }, children: [
@@ -3963,14 +3931,14 @@ import { jsx as jsx27 } from "react/jsx-runtime";
3963
3931
  var LayoutProvider = ({ navigation, theme, children }) => {
3964
3932
  const { i18n } = useTranslation7();
3965
3933
  const createdTheme = useGetTheme(theme);
3934
+ const languageChangedHandler = useEffectEvent(() => {
3935
+ z.config(z.core.locales[i18n.resolvedLanguage]());
3936
+ });
3966
3937
  useEffect6(() => {
3967
- const handler = () => {
3968
- z.config(i18n.resolvedLanguage === "cs" ? cs() : en());
3969
- };
3970
- handler();
3971
- i18n.on("languageChanged", handler);
3938
+ languageChangedHandler();
3939
+ i18n.on("languageChanged", languageChangedHandler);
3972
3940
  return () => {
3973
- i18n.off("languageChanged", handler);
3941
+ i18n.off("languageChanged", languageChangedHandler);
3974
3942
  };
3975
3943
  }, []);
3976
3944
  return /* @__PURE__ */ jsx27(ThemeProvider, { theme: createdTheme, children: /* @__PURE__ */ jsx27(LocalizationProvider, { dateAdapter: AdapterDayjs, adapterLocale: i18n.resolvedLanguage, children: /* @__PURE__ */ jsx27(DialogsProvider, { children: /* @__PURE__ */ jsx27(Layout, { navigation, children }) }) }) });