@serhii.olishevskyi/docs 1.2.23 → 1.2.24

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
@@ -1539,15 +1539,15 @@ var init_TranslatableTooltipComponent = __esm({
1539
1539
  });
1540
1540
 
1541
1541
  // src/context/LocalizationProvider.tsx
1542
- var import_react12, import_react_i18next4, import_moment_with_locales, import_jsx_runtime13, DEFAULT_DATETIME_FORMATS, DEFAULT_DATE_FORMATS, DEFAULT_TIME_FORMATS, LocalizationContext, LocalizationProvider, useLocalization;
1542
+ var import_react11, import_react_i18next4, import_moment_with_locales, import_jsx_runtime12, DEFAULT_DATETIME_FORMATS, DEFAULT_DATE_FORMATS, DEFAULT_TIME_FORMATS, LocalizationContext, LocalizationProvider, useLocalization;
1543
1543
  var init_LocalizationProvider = __esm({
1544
1544
  "src/context/LocalizationProvider.tsx"() {
1545
1545
  "use strict";
1546
- import_react12 = require("react");
1546
+ import_react11 = require("react");
1547
1547
  import_react_i18next4 = require("react-i18next");
1548
1548
  import_moment_with_locales = __toESM(require("moment/min/moment-with-locales"));
1549
1549
  init_SupabaseProvider();
1550
- import_jsx_runtime13 = require("react/jsx-runtime");
1550
+ import_jsx_runtime12 = require("react/jsx-runtime");
1551
1551
  DEFAULT_DATETIME_FORMATS = {
1552
1552
  uk: "DD.MM.YYYY, HH:mm",
1553
1553
  de: "DD.MM.YYYY, HH:mm",
@@ -1572,14 +1572,14 @@ var init_LocalizationProvider = __esm({
1572
1572
  fr: "HH:mm:ss",
1573
1573
  it: "HH:mm:ss"
1574
1574
  };
1575
- LocalizationContext = (0, import_react12.createContext)(void 0);
1575
+ LocalizationContext = (0, import_react11.createContext)(void 0);
1576
1576
  LocalizationProvider = ({ children }) => {
1577
1577
  const supabase = useSupabase();
1578
1578
  const { i18n: i18n2 } = (0, import_react_i18next4.useTranslation)();
1579
- const [languages, setLanguages] = (0, import_react12.useState)([]);
1580
- const [isLoadingLangs, setIsLoadingLangs] = (0, import_react12.useState)(true);
1581
- const [languagesError, setLanguagesError] = (0, import_react12.useState)(null);
1582
- (0, import_react12.useEffect)(() => {
1579
+ const [languages, setLanguages] = (0, import_react11.useState)([]);
1580
+ const [isLoadingLangs, setIsLoadingLangs] = (0, import_react11.useState)(true);
1581
+ const [languagesError, setLanguagesError] = (0, import_react11.useState)(null);
1582
+ (0, import_react11.useEffect)(() => {
1583
1583
  let isMounted = true;
1584
1584
  const fetchLanguages = async () => {
1585
1585
  try {
@@ -1641,7 +1641,7 @@ var init_LocalizationProvider = __esm({
1641
1641
  const changeLanguage = async (lang) => {
1642
1642
  await i18n2.changeLanguage(lang);
1643
1643
  };
1644
- const value = (0, import_react12.useMemo)(
1644
+ const value = (0, import_react11.useMemo)(
1645
1645
  () => ({
1646
1646
  currentLang,
1647
1647
  languages,
@@ -1658,10 +1658,10 @@ var init_LocalizationProvider = __esm({
1658
1658
  }),
1659
1659
  [currentLang, languages, isLoadingLangs, languagesError]
1660
1660
  );
1661
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LocalizationContext.Provider, { value, children });
1661
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LocalizationContext.Provider, { value, children });
1662
1662
  };
1663
1663
  useLocalization = () => {
1664
- const context = (0, import_react12.useContext)(LocalizationContext);
1664
+ const context = (0, import_react11.useContext)(LocalizationContext);
1665
1665
  if (!context) {
1666
1666
  throw new Error("useLocalization must be used within a LocalizationProvider");
1667
1667
  }
@@ -1671,15 +1671,15 @@ var init_LocalizationProvider = __esm({
1671
1671
  });
1672
1672
 
1673
1673
  // src/context/ThemeProvider.tsx
1674
- var import_react13, import_material7, import_jsx_runtime14, DEFAULT_LIGHT_COLORS, DEFAULT_DARK_COLORS, INITIAL_THEME_CONFIG, buildMuiTheme, ThemeContext, THEME_STORAGE_KEY, THEME_MODE_STORAGE_KEY, ThemeProvider, useAppTheme;
1674
+ var import_react12, import_material6, import_jsx_runtime13, DEFAULT_LIGHT_COLORS, DEFAULT_DARK_COLORS, INITIAL_THEME_CONFIG, buildMuiTheme, ThemeContext, THEME_STORAGE_KEY, THEME_MODE_STORAGE_KEY, ThemeProvider, useAppTheme;
1675
1675
  var init_ThemeProvider = __esm({
1676
1676
  "src/context/ThemeProvider.tsx"() {
1677
1677
  "use strict";
1678
- import_react13 = require("react");
1679
- import_material7 = require("@mui/material");
1678
+ import_react12 = require("react");
1679
+ import_material6 = require("@mui/material");
1680
1680
  init_AuthProvider();
1681
1681
  init_SupabaseProvider();
1682
- import_jsx_runtime14 = require("react/jsx-runtime");
1682
+ import_jsx_runtime13 = require("react/jsx-runtime");
1683
1683
  DEFAULT_LIGHT_COLORS = {
1684
1684
  primary: "#1976d2",
1685
1685
  secondary: "#9c27b0",
@@ -1724,7 +1724,7 @@ var init_ThemeProvider = __esm({
1724
1724
  buildMuiTheme = (config) => {
1725
1725
  const currentMode = config.mode;
1726
1726
  const currentColors = config.colors?.[currentMode] || (currentMode === "light" ? DEFAULT_LIGHT_COLORS : DEFAULT_DARK_COLORS);
1727
- return (0, import_material7.createTheme)({
1727
+ return (0, import_material6.createTheme)({
1728
1728
  palette: {
1729
1729
  mode: currentMode,
1730
1730
  primary: {
@@ -1809,14 +1809,14 @@ var init_ThemeProvider = __esm({
1809
1809
  }
1810
1810
  });
1811
1811
  };
1812
- ThemeContext = (0, import_react13.createContext)(void 0);
1812
+ ThemeContext = (0, import_react12.createContext)(void 0);
1813
1813
  THEME_STORAGE_KEY = "docsua_custom_theme_config";
1814
1814
  THEME_MODE_STORAGE_KEY = "docsua_custom_theme_mode";
1815
1815
  ThemeProvider = ({ children }) => {
1816
1816
  const supabase = useSupabase();
1817
1817
  const { user, isAuthenticated, loading: isAuthLoading } = useAuth();
1818
1818
  const userId = user?.id;
1819
- const [themeConfig, setThemeConfig] = (0, import_react13.useState)(() => {
1819
+ const [themeConfig, setThemeConfig] = (0, import_react12.useState)(() => {
1820
1820
  const saved = localStorage.getItem(THEME_STORAGE_KEY);
1821
1821
  if (saved) {
1822
1822
  try {
@@ -1826,7 +1826,7 @@ var init_ThemeProvider = __esm({
1826
1826
  }
1827
1827
  return INITIAL_THEME_CONFIG;
1828
1828
  });
1829
- (0, import_react13.useEffect)(() => {
1829
+ (0, import_react12.useEffect)(() => {
1830
1830
  if (isAuthLoading) return;
1831
1831
  if (isAuthenticated && userId) {
1832
1832
  const fetchActiveTheme = async () => {
@@ -1860,7 +1860,7 @@ var init_ThemeProvider = __esm({
1860
1860
  localStorage.removeItem(THEME_MODE_STORAGE_KEY);
1861
1861
  }
1862
1862
  }, [isAuthenticated, isAuthLoading, userId]);
1863
- (0, import_react13.useEffect)(() => {
1863
+ (0, import_react12.useEffect)(() => {
1864
1864
  if (isAuthenticated) {
1865
1865
  localStorage.setItem(THEME_STORAGE_KEY, JSON.stringify(themeConfig));
1866
1866
  localStorage.setItem(THEME_MODE_STORAGE_KEY, themeConfig.mode);
@@ -1873,21 +1873,21 @@ var init_ThemeProvider = __esm({
1873
1873
  const toggleTheme = () => {
1874
1874
  setMode(mode === "light" ? "dark" : "light");
1875
1875
  };
1876
- const theme = (0, import_react13.useMemo)(() => buildMuiTheme(themeConfig), [themeConfig]);
1876
+ const theme = (0, import_react12.useMemo)(() => buildMuiTheme(themeConfig), [themeConfig]);
1877
1877
  const displayState = {
1878
- isMobile: (0, import_material7.useMediaQuery)(theme.breakpoints.down("sm")),
1879
- isTablet: (0, import_material7.useMediaQuery)(theme.breakpoints.between("sm", "md")),
1880
- isDesktop: (0, import_material7.useMediaQuery)(theme.breakpoints.between("md", "lg")),
1881
- isWideDesktop: (0, import_material7.useMediaQuery)(theme.breakpoints.between("lg", "xl")),
1882
- isSuperWideDesktop: (0, import_material7.useMediaQuery)(theme.breakpoints.up("xl"))
1878
+ isMobile: (0, import_material6.useMediaQuery)(theme.breakpoints.down("sm")),
1879
+ isTablet: (0, import_material6.useMediaQuery)(theme.breakpoints.between("sm", "md")),
1880
+ isDesktop: (0, import_material6.useMediaQuery)(theme.breakpoints.between("md", "lg")),
1881
+ isWideDesktop: (0, import_material6.useMediaQuery)(theme.breakpoints.between("lg", "xl")),
1882
+ isSuperWideDesktop: (0, import_material6.useMediaQuery)(theme.breakpoints.up("xl"))
1883
1883
  };
1884
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ThemeContext.Provider, { value: { mode, toggleTheme, setMode, theme, themeConfig, setThemeConfig, displayState }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material7.ThemeProvider, { theme, children: [
1885
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material7.CssBaseline, {}),
1884
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ThemeContext.Provider, { value: { mode, toggleTheme, setMode, theme, themeConfig, setThemeConfig, displayState }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_material6.ThemeProvider, { theme, children: [
1885
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_material6.CssBaseline, {}),
1886
1886
  children
1887
1887
  ] }) });
1888
1888
  };
1889
1889
  useAppTheme = () => {
1890
- const context = (0, import_react13.useContext)(ThemeContext);
1890
+ const context = (0, import_react12.useContext)(ThemeContext);
1891
1891
  if (!context) {
1892
1892
  throw new Error("useAppTheme should be used within the ThemeProvider");
1893
1893
  }
@@ -1897,63 +1897,63 @@ var init_ThemeProvider = __esm({
1897
1897
  });
1898
1898
 
1899
1899
  // src/context/BreadcrumbProvider.tsx
1900
- var import_react14, import_jsx_runtime15, BreadcrumbContext, BreadcrumbProvider, useBreadcrumb;
1900
+ var import_react13, import_jsx_runtime14, BreadcrumbContext, BreadcrumbProvider, useBreadcrumb;
1901
1901
  var init_BreadcrumbProvider = __esm({
1902
1902
  "src/context/BreadcrumbProvider.tsx"() {
1903
1903
  "use strict";
1904
- import_react14 = require("react");
1905
- import_jsx_runtime15 = require("react/jsx-runtime");
1906
- BreadcrumbContext = (0, import_react14.createContext)({
1904
+ import_react13 = require("react");
1905
+ import_jsx_runtime14 = require("react/jsx-runtime");
1906
+ BreadcrumbContext = (0, import_react13.createContext)({
1907
1907
  breadcrumbTitles: {},
1908
1908
  setBreadcrumbTitle: () => {
1909
1909
  }
1910
1910
  });
1911
1911
  BreadcrumbProvider = ({ children }) => {
1912
- const [breadcrumbTitles, setBreadcrumbTitles] = (0, import_react14.useState)({});
1912
+ const [breadcrumbTitles, setBreadcrumbTitles] = (0, import_react13.useState)({});
1913
1913
  const setBreadcrumbTitle = (path, title) => {
1914
1914
  setBreadcrumbTitles((prev) => {
1915
1915
  if (prev[path] === title) return prev;
1916
1916
  return { ...prev, [path]: title };
1917
1917
  });
1918
1918
  };
1919
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(BreadcrumbContext.Provider, { value: { breadcrumbTitles, setBreadcrumbTitle }, children });
1919
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(BreadcrumbContext.Provider, { value: { breadcrumbTitles, setBreadcrumbTitle }, children });
1920
1920
  };
1921
- useBreadcrumb = () => (0, import_react14.useContext)(BreadcrumbContext);
1921
+ useBreadcrumb = () => (0, import_react13.useContext)(BreadcrumbContext);
1922
1922
  }
1923
1923
  });
1924
1924
 
1925
1925
  // src/context/ToastProvider.tsx
1926
- var import_react15, import_material8, import_jsx_runtime16, ToastContext, ToastProvider, useToast;
1926
+ var import_react14, import_material7, import_jsx_runtime15, ToastContext, ToastProvider, useToast;
1927
1927
  var init_ToastProvider = __esm({
1928
1928
  "src/context/ToastProvider.tsx"() {
1929
1929
  "use strict";
1930
- import_react15 = require("react");
1931
- import_material8 = require("@mui/material");
1932
- import_jsx_runtime16 = require("react/jsx-runtime");
1933
- ToastContext = (0, import_react15.createContext)(void 0);
1930
+ import_react14 = require("react");
1931
+ import_material7 = require("@mui/material");
1932
+ import_jsx_runtime15 = require("react/jsx-runtime");
1933
+ ToastContext = (0, import_react14.createContext)(void 0);
1934
1934
  ToastProvider = ({ children }) => {
1935
- const [toast, setToast] = (0, import_react15.useState)(null);
1936
- const showToast = (0, import_react15.useCallback)((text, type = "info") => {
1935
+ const [toast, setToast] = (0, import_react14.useState)(null);
1936
+ const showToast = (0, import_react14.useCallback)((text, type = "info") => {
1937
1937
  setToast({ text, type });
1938
1938
  }, []);
1939
- const hideToast = (0, import_react15.useCallback)(() => {
1939
+ const hideToast = (0, import_react14.useCallback)(() => {
1940
1940
  setToast(null);
1941
1941
  }, []);
1942
- const contextValue = (0, import_react15.useMemo)(() => ({
1942
+ const contextValue = (0, import_react14.useMemo)(() => ({
1943
1943
  showToast,
1944
1944
  hideToast
1945
1945
  }), [showToast, hideToast]);
1946
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(ToastContext.Provider, { value: contextValue, children: [
1946
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(ToastContext.Provider, { value: contextValue, children: [
1947
1947
  children,
1948
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1949
- import_material8.Snackbar,
1948
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1949
+ import_material7.Snackbar,
1950
1950
  {
1951
1951
  open: Boolean(toast),
1952
1952
  autoHideDuration: 3500,
1953
1953
  onClose: hideToast,
1954
1954
  anchorOrigin: { vertical: "bottom", horizontal: "center" },
1955
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1956
- import_material8.Alert,
1955
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1956
+ import_material7.Alert,
1957
1957
  {
1958
1958
  severity: toast?.type || "info",
1959
1959
  variant: "filled",
@@ -1966,7 +1966,7 @@ var init_ToastProvider = __esm({
1966
1966
  ] });
1967
1967
  };
1968
1968
  useToast = () => {
1969
- const context = (0, import_react15.useContext)(ToastContext);
1969
+ const context = (0, import_react14.useContext)(ToastContext);
1970
1970
  if (!context) {
1971
1971
  throw new Error("useToast must be used within a ToastProvider");
1972
1972
  }
@@ -1976,27 +1976,27 @@ var init_ToastProvider = __esm({
1976
1976
  });
1977
1977
 
1978
1978
  // src/context/ConfirmationProvider.tsx
1979
- var import_react16, import_material9, import_icons_material, import_jsx_runtime17, ConfirmContext, SEVERITY_ICONS, ConfirmationProvider, useConfirmation;
1979
+ var import_react15, import_material8, import_icons_material, import_jsx_runtime16, ConfirmContext, SEVERITY_ICONS, ConfirmationProvider, useConfirmation;
1980
1980
  var init_ConfirmationProvider = __esm({
1981
1981
  "src/context/ConfirmationProvider.tsx"() {
1982
1982
  "use strict";
1983
- import_react16 = require("react");
1984
- import_material9 = require("@mui/material");
1983
+ import_react15 = require("react");
1984
+ import_material8 = require("@mui/material");
1985
1985
  import_icons_material = require("@mui/icons-material");
1986
1986
  init_TranslateText();
1987
- import_jsx_runtime17 = require("react/jsx-runtime");
1988
- ConfirmContext = (0, import_react16.createContext)(null);
1987
+ import_jsx_runtime16 = require("react/jsx-runtime");
1988
+ ConfirmContext = (0, import_react15.createContext)(null);
1989
1989
  SEVERITY_ICONS = {
1990
- error: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_icons_material.Error, { color: "error", sx: { fontSize: 40 } }),
1991
- warning: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_icons_material.WarningAmberOutlined, { color: "warning", sx: { fontSize: 40 } }),
1992
- info: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_icons_material.InfoOutlined, { color: "info", sx: { fontSize: 40 } }),
1993
- success: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_icons_material.CheckCircleOutlined, { color: "success", sx: { fontSize: 40 } })
1990
+ error: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons_material.Error, { color: "error", sx: { fontSize: 40 } }),
1991
+ warning: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons_material.WarningAmberOutlined, { color: "warning", sx: { fontSize: 40 } }),
1992
+ info: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons_material.InfoOutlined, { color: "info", sx: { fontSize: 40 } }),
1993
+ success: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons_material.CheckCircleOutlined, { color: "success", sx: { fontSize: 40 } })
1994
1994
  };
1995
1995
  ConfirmationProvider = ({ overrideNamespace, children }) => {
1996
- const [open, setOpen] = (0, import_react16.useState)(false);
1997
- const [options, setOptions] = (0, import_react16.useState)(null);
1998
- const [resolver, setResolver] = (0, import_react16.useState)(null);
1999
- const confirm = (0, import_react16.useCallback)((opts) => {
1996
+ const [open, setOpen] = (0, import_react15.useState)(false);
1997
+ const [options, setOptions] = (0, import_react15.useState)(null);
1998
+ const [resolver, setResolver] = (0, import_react15.useState)(null);
1999
+ const confirm = (0, import_react15.useCallback)((opts) => {
2000
2000
  setOptions(opts);
2001
2001
  setOpen(true);
2002
2002
  return new Promise((resolve) => {
@@ -2010,10 +2010,10 @@ var init_ConfirmationProvider = __esm({
2010
2010
  }
2011
2011
  };
2012
2012
  const severityType = options?.type || "info";
2013
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(ConfirmContext.Provider, { value: { confirm }, children: [
2013
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(ConfirmContext.Provider, { value: { confirm }, children: [
2014
2014
  children,
2015
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2016
- import_material9.Dialog,
2015
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
2016
+ import_material8.Dialog,
2017
2017
  {
2018
2018
  open,
2019
2019
  onClose: () => handleClose("cancel"),
@@ -2022,38 +2022,38 @@ var init_ConfirmationProvider = __esm({
2022
2022
  disableEnforceFocus: true,
2023
2023
  disableRestoreFocus: true,
2024
2024
  children: [
2025
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_material9.DialogTitle, { sx: { display: "flex", alignItems: "center", gap: 1.5, pb: 1 }, children: [
2025
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_material8.DialogTitle, { sx: { display: "flex", alignItems: "center", gap: 1.5, pb: 1 }, children: [
2026
2026
  SEVERITY_ICONS[severityType],
2027
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material9.Box, { component: "span", sx: { fontWeight: 600 }, children: options?.title || /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "confirmation-dialog", children: "Confirmation" }) })
2027
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material8.Box, { component: "span", sx: { fontWeight: 600 }, children: options?.title || /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "confirmation-dialog", children: "Confirmation" }) })
2028
2028
  ] }),
2029
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material9.DialogContent, { sx: { py: 2 }, dividers: true, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material9.DialogContentText, { color: "text.secondary", children: options?.message }) }),
2030
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_material9.DialogActions, { sx: { pt: 2, px: 2, justifyContent: "flex-end", gap: 1 }, children: [
2031
- (options?.showCancelButton ?? true) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2032
- import_material9.Button,
2029
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material8.DialogContent, { sx: { py: 2 }, dividers: true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material8.DialogContentText, { color: "text.secondary", children: options?.message }) }),
2030
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_material8.DialogActions, { sx: { pt: 2, px: 2, justifyContent: "flex-end", gap: 1 }, children: [
2031
+ (options?.showCancelButton ?? true) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2032
+ import_material8.Button,
2033
2033
  {
2034
2034
  onClick: () => handleClose("cancel"),
2035
2035
  color: "inherit",
2036
2036
  variant: "text",
2037
- children: options?.cancelText || /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "confirmation-dialog", children: "Cancel" })
2037
+ children: options?.cancelText || /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "confirmation-dialog", children: "Cancel" })
2038
2038
  }
2039
2039
  ),
2040
- options?.showNoButton && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2041
- import_material9.Button,
2040
+ options?.showNoButton && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2041
+ import_material8.Button,
2042
2042
  {
2043
2043
  onClick: () => handleClose("no"),
2044
2044
  color: "inherit",
2045
2045
  variant: "outlined",
2046
- children: options?.noText || /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "confirmation-dialog", children: "No" })
2046
+ children: options?.noText || /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "confirmation-dialog", children: "No" })
2047
2047
  }
2048
2048
  ),
2049
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2050
- import_material9.Button,
2049
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2050
+ import_material8.Button,
2051
2051
  {
2052
2052
  onClick: () => handleClose("yes"),
2053
2053
  color: options?.confirmColor || (severityType === "error" ? "error" : "primary"),
2054
2054
  variant: "contained",
2055
2055
  autoFocus: true,
2056
- children: options?.confirmText || /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "confirmation-dialog", children: "Yes" })
2056
+ children: options?.confirmText || /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "confirmation-dialog", children: "Yes" })
2057
2057
  }
2058
2058
  )
2059
2059
  ] })
@@ -2063,7 +2063,7 @@ var init_ConfirmationProvider = __esm({
2063
2063
  ] });
2064
2064
  };
2065
2065
  useConfirmation = () => {
2066
- const context = (0, import_react16.useContext)(ConfirmContext);
2066
+ const context = (0, import_react15.useContext)(ConfirmContext);
2067
2067
  if (!context) {
2068
2068
  throw new Error("useConfirm must be used within a ConfirmProvider");
2069
2069
  }
@@ -2073,23 +2073,23 @@ var init_ConfirmationProvider = __esm({
2073
2073
  });
2074
2074
 
2075
2075
  // src/context/AppSettingsProvider.tsx
2076
- var import_react17, import_jsx_runtime18, DEFAULT_SETTINGS, AppSettingsContext, AppSettingsProvider, useAppSettings;
2076
+ var import_react16, import_jsx_runtime17, DEFAULT_SETTINGS, AppSettingsContext, AppSettingsProvider, useAppSettings;
2077
2077
  var init_AppSettingsProvider = __esm({
2078
2078
  "src/context/AppSettingsProvider.tsx"() {
2079
2079
  "use strict";
2080
- import_react17 = require("react");
2080
+ import_react16 = require("react");
2081
2081
  init_SupabaseProvider();
2082
- import_jsx_runtime18 = require("react/jsx-runtime");
2082
+ import_jsx_runtime17 = require("react/jsx-runtime");
2083
2083
  DEFAULT_SETTINGS = {
2084
2084
  max_group_members: 100
2085
2085
  };
2086
- AppSettingsContext = (0, import_react17.createContext)(void 0);
2086
+ AppSettingsContext = (0, import_react16.createContext)(void 0);
2087
2087
  AppSettingsProvider = ({ children }) => {
2088
2088
  const supabase = useSupabase();
2089
- const [settings, setSettings] = (0, import_react17.useState)(DEFAULT_SETTINGS);
2090
- const [loading, setLoading] = (0, import_react17.useState)(true);
2091
- const [error, setError] = (0, import_react17.useState)(null);
2092
- const fetchSettings = (0, import_react17.useCallback)(async () => {
2089
+ const [settings, setSettings] = (0, import_react16.useState)(DEFAULT_SETTINGS);
2090
+ const [loading, setLoading] = (0, import_react16.useState)(true);
2091
+ const [error, setError] = (0, import_react16.useState)(null);
2092
+ const fetchSettings = (0, import_react16.useCallback)(async () => {
2093
2093
  try {
2094
2094
  setLoading(true);
2095
2095
  setError(null);
@@ -2109,16 +2109,16 @@ var init_AppSettingsProvider = __esm({
2109
2109
  setLoading(false);
2110
2110
  }
2111
2111
  }, []);
2112
- (0, import_react17.useEffect)(() => {
2112
+ (0, import_react16.useEffect)(() => {
2113
2113
  fetchSettings();
2114
2114
  }, [fetchSettings]);
2115
- const getSetting = (0, import_react17.useCallback)((key, defaultValue) => {
2115
+ const getSetting = (0, import_react16.useCallback)((key, defaultValue) => {
2116
2116
  if (key in settings && settings[key] !== null && settings[key] !== void 0) {
2117
2117
  return settings[key];
2118
2118
  }
2119
2119
  return defaultValue;
2120
2120
  }, [settings]);
2121
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2121
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2122
2122
  AppSettingsContext.Provider,
2123
2123
  {
2124
2124
  value: {
@@ -2133,7 +2133,7 @@ var init_AppSettingsProvider = __esm({
2133
2133
  );
2134
2134
  };
2135
2135
  useAppSettings = () => {
2136
- const context = (0, import_react17.useContext)(AppSettingsContext);
2136
+ const context = (0, import_react16.useContext)(AppSettingsContext);
2137
2137
  if (!context) {
2138
2138
  throw new Error("useAppSettings should be used within the AppSettingsProvider");
2139
2139
  }
@@ -2157,29 +2157,29 @@ var init_user_types = __esm({
2157
2157
  });
2158
2158
 
2159
2159
  // src/context/UserSettingsProvider.tsx
2160
- var import_react18, import_jsx_runtime19, UserSettingsContext, UserSettingsProvider, useUserSettings;
2160
+ var import_react17, import_jsx_runtime18, UserSettingsContext, UserSettingsProvider, useUserSettings;
2161
2161
  var init_UserSettingsProvider = __esm({
2162
2162
  "src/context/UserSettingsProvider.tsx"() {
2163
2163
  "use strict";
2164
- import_react18 = require("react");
2164
+ import_react17 = require("react");
2165
2165
  init_user_types();
2166
2166
  init_ThemeProvider();
2167
2167
  init_AuthProvider();
2168
2168
  init_SupabaseProvider();
2169
- import_jsx_runtime19 = require("react/jsx-runtime");
2170
- UserSettingsContext = (0, import_react18.createContext)(void 0);
2169
+ import_jsx_runtime18 = require("react/jsx-runtime");
2170
+ UserSettingsContext = (0, import_react17.createContext)(void 0);
2171
2171
  UserSettingsProvider = ({ children }) => {
2172
2172
  const supabase = useSupabase();
2173
2173
  const { user, isAuthenticated, loading: isAuthLoading } = useAuth();
2174
2174
  const userId = user?.id;
2175
- const [settings, setSettings] = (0, import_react18.useState)({
2175
+ const [settings, setSettings] = (0, import_react17.useState)({
2176
2176
  id: "",
2177
2177
  ...defaultUserSettings
2178
2178
  });
2179
- const [loading, setLoading] = (0, import_react18.useState)(true);
2180
- const [error, setError] = (0, import_react18.useState)(null);
2181
- const [activeChatUserId, setActiveChatUserId] = (0, import_react18.useState)(null);
2182
- const fetchSettings = (0, import_react18.useCallback)(async () => {
2179
+ const [loading, setLoading] = (0, import_react17.useState)(true);
2180
+ const [error, setError] = (0, import_react17.useState)(null);
2181
+ const [activeChatUserId, setActiveChatUserId] = (0, import_react17.useState)(null);
2182
+ const fetchSettings = (0, import_react17.useCallback)(async () => {
2183
2183
  if (isAuthLoading) return;
2184
2184
  if (!isAuthenticated || !userId) {
2185
2185
  setSettings({ id: "", ...defaultUserSettings });
@@ -2232,10 +2232,10 @@ var init_UserSettingsProvider = __esm({
2232
2232
  setLoading(false);
2233
2233
  }
2234
2234
  }, [isAuthenticated, isAuthLoading, userId]);
2235
- (0, import_react18.useEffect)(() => {
2235
+ (0, import_react17.useEffect)(() => {
2236
2236
  fetchSettings();
2237
2237
  }, [fetchSettings]);
2238
- const toggleSidebar = (0, import_react18.useCallback)(
2238
+ const toggleSidebar = (0, import_react17.useCallback)(
2239
2239
  async (open) => {
2240
2240
  const isExplicitBoolean = typeof open === "boolean";
2241
2241
  const nextState = isExplicitBoolean ? open : !settings.sidebar_open;
@@ -2251,7 +2251,7 @@ var init_UserSettingsProvider = __esm({
2251
2251
  },
2252
2252
  [settings.sidebar_open, userId]
2253
2253
  );
2254
- const toggleChat = (0, import_react18.useCallback)(
2254
+ const toggleChat = (0, import_react17.useCallback)(
2255
2255
  async (open) => {
2256
2256
  const isExplicitBoolean = typeof open === "boolean";
2257
2257
  const nextState = isExplicitBoolean ? open : !settings.chat_open;
@@ -2267,7 +2267,7 @@ var init_UserSettingsProvider = __esm({
2267
2267
  },
2268
2268
  [settings.chat_open, userId]
2269
2269
  );
2270
- const openChatWithUser = (0, import_react18.useCallback)(
2270
+ const openChatWithUser = (0, import_react17.useCallback)(
2271
2271
  async (targetUserId) => {
2272
2272
  setActiveChatUserId(targetUserId);
2273
2273
  if (!settings.chat_open) {
@@ -2276,7 +2276,7 @@ var init_UserSettingsProvider = __esm({
2276
2276
  },
2277
2277
  [settings.chat_open, toggleChat]
2278
2278
  );
2279
- const setLanguage = (0, import_react18.useCallback)(
2279
+ const setLanguage = (0, import_react17.useCallback)(
2280
2280
  async (newLanguage) => {
2281
2281
  const previousLanguage = settings.language;
2282
2282
  setSettings((prev) => ({ ...prev, language: newLanguage }));
@@ -2291,7 +2291,7 @@ var init_UserSettingsProvider = __esm({
2291
2291
  },
2292
2292
  [settings.language, userId]
2293
2293
  );
2294
- const setThemeMode = (0, import_react18.useCallback)(
2294
+ const setThemeMode = (0, import_react17.useCallback)(
2295
2295
  async (newMode) => {
2296
2296
  const previousMode = settings.theme_mode;
2297
2297
  setSettings((prev) => ({ ...prev, theme_mode: newMode }));
@@ -2307,7 +2307,7 @@ var init_UserSettingsProvider = __esm({
2307
2307
  },
2308
2308
  [settings.theme_mode, userId]
2309
2309
  );
2310
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2310
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2311
2311
  UserSettingsContext.Provider,
2312
2312
  {
2313
2313
  value: {
@@ -2327,7 +2327,7 @@ var init_UserSettingsProvider = __esm({
2327
2327
  );
2328
2328
  };
2329
2329
  useUserSettings = () => {
2330
- const context = (0, import_react18.useContext)(UserSettingsContext);
2330
+ const context = (0, import_react17.useContext)(UserSettingsContext);
2331
2331
  if (!context) {
2332
2332
  throw new Error("useUserSettings should be used within the UserSettingsProvider");
2333
2333
  }
@@ -2337,17 +2337,17 @@ var init_UserSettingsProvider = __esm({
2337
2337
  });
2338
2338
 
2339
2339
  // src/context/PublicThemeProvider.tsx
2340
- var import_react19, import_material10, import_jsx_runtime20, PublicThemeProvider;
2340
+ var import_react18, import_material9, import_jsx_runtime19, PublicThemeProvider;
2341
2341
  var init_PublicThemeProvider = __esm({
2342
2342
  "src/context/PublicThemeProvider.tsx"() {
2343
2343
  "use strict";
2344
- import_react19 = require("react");
2345
- import_material10 = require("@mui/material");
2344
+ import_react18 = require("react");
2345
+ import_material9 = require("@mui/material");
2346
2346
  init_ThemeProvider();
2347
- import_jsx_runtime20 = require("react/jsx-runtime");
2347
+ import_jsx_runtime19 = require("react/jsx-runtime");
2348
2348
  PublicThemeProvider = ({ children }) => {
2349
- const publicTheme = (0, import_react19.useMemo)(() => buildMuiTheme(INITIAL_THEME_CONFIG), []);
2350
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material10.ThemeProvider, { theme: publicTheme, children });
2349
+ const publicTheme = (0, import_react18.useMemo)(() => buildMuiTheme(INITIAL_THEME_CONFIG), []);
2350
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material9.ThemeProvider, { theme: publicTheme, children });
2351
2351
  };
2352
2352
  }
2353
2353
  });
@@ -2402,34 +2402,89 @@ var init_context = __esm({
2402
2402
  }
2403
2403
  });
2404
2404
 
2405
+ // src/UI/components/buttons/CopyClipboardButtonComponent.tsx
2406
+ var import_react23, import_material16, import_Check3, import_ContentCopy3, import_jsx_runtime26, CopyClipboardButtonComponent;
2407
+ var init_CopyClipboardButtonComponent = __esm({
2408
+ "src/UI/components/buttons/CopyClipboardButtonComponent.tsx"() {
2409
+ "use strict";
2410
+ import_react23 = require("react");
2411
+ import_material16 = require("@mui/material");
2412
+ import_Check3 = __toESM(require("@mui/icons-material/Check"));
2413
+ import_ContentCopy3 = __toESM(require("@mui/icons-material/ContentCopy"));
2414
+ init_TranslatableTooltipComponent();
2415
+ import_jsx_runtime26 = require("react/jsx-runtime");
2416
+ CopyClipboardButtonComponent = ({
2417
+ overrideNamespace,
2418
+ textToCopy,
2419
+ copyTooltipText = "Copy",
2420
+ copiedTooltipText = "Copied",
2421
+ namespace = "form_components",
2422
+ resetDelay = 2e3,
2423
+ onCopySuccess,
2424
+ size = "small",
2425
+ sx,
2426
+ ...iconButtonProps
2427
+ }) => {
2428
+ const [copied, setCopied] = (0, import_react23.useState)(false);
2429
+ const handleCopy = async (e) => {
2430
+ e.stopPropagation();
2431
+ if (!textToCopy) return;
2432
+ try {
2433
+ await navigator.clipboard.writeText(textToCopy);
2434
+ setCopied(true);
2435
+ if (onCopySuccess) {
2436
+ onCopySuccess(textToCopy);
2437
+ }
2438
+ setTimeout(() => {
2439
+ setCopied(false);
2440
+ }, resetDelay);
2441
+ } catch (error) {
2442
+ console.error("Failed to copy text to clipboard:", error);
2443
+ }
2444
+ };
2445
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TranslatableTooltipComponent, { title: copied ? copiedTooltipText : copyTooltipText, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2446
+ import_material16.IconButton,
2447
+ {
2448
+ size,
2449
+ onClick: handleCopy,
2450
+ disabled: !textToCopy || iconButtonProps.disabled,
2451
+ sx: { p: 0.25, ...sx },
2452
+ ...iconButtonProps,
2453
+ children: copied ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_Check3.default, { fontSize: size === "large" ? "medium" : "small", color: "success" }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_ContentCopy3.default, { fontSize: size === "large" ? "medium" : "small" })
2454
+ }
2455
+ ) }) });
2456
+ };
2457
+ }
2458
+ });
2459
+
2405
2460
  // src/UI/components/data.display/UserStatusChipComponent.tsx
2406
- var import_material11, import_InfoOutlined, import_jsx_runtime21, UserStatusChipComponent;
2461
+ var import_material18, import_InfoOutlined, import_jsx_runtime28, UserStatusChipComponent;
2407
2462
  var init_UserStatusChipComponent = __esm({
2408
2463
  "src/UI/components/data.display/UserStatusChipComponent.tsx"() {
2409
2464
  "use strict";
2410
- import_material11 = require("@mui/material");
2465
+ import_material18 = require("@mui/material");
2411
2466
  import_InfoOutlined = __toESM(require("@mui/icons-material/InfoOutlined"));
2412
2467
  init_context();
2413
- import_jsx_runtime21 = require("react/jsx-runtime");
2468
+ import_jsx_runtime28 = require("react/jsx-runtime");
2414
2469
  UserStatusChipComponent = ({ overrideNamespace, state }) => {
2415
2470
  const confirm = useConfirmation();
2416
2471
  const handleShowReason = async (e) => {
2417
2472
  e.stopPropagation();
2418
2473
  if (!state.locked_reason) return;
2419
2474
  await confirm({
2420
- title: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Lock Reason" }),
2475
+ title: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Lock Reason" }),
2421
2476
  message: state.locked_reason,
2422
2477
  type: "info",
2423
- confirmText: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "OK" }),
2478
+ confirmText: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "OK" }),
2424
2479
  showNoButton: false,
2425
2480
  showCancelButton: false
2426
2481
  });
2427
2482
  };
2428
2483
  if (state.profile_archived) {
2429
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2430
- import_material11.Chip,
2484
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2485
+ import_material18.Chip,
2431
2486
  {
2432
- label: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Archived" }),
2487
+ label: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Archived" }),
2433
2488
  color: "default",
2434
2489
  size: "small",
2435
2490
  variant: "filled"
@@ -2437,10 +2492,10 @@ var init_UserStatusChipComponent = __esm({
2437
2492
  );
2438
2493
  }
2439
2494
  if (state.profile_locked) {
2440
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2441
- import_material11.Chip,
2495
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2496
+ import_material18.Chip,
2442
2497
  {
2443
- label: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "System Locked" }),
2498
+ label: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "System Locked" }),
2444
2499
  color: "error",
2445
2500
  size: "small",
2446
2501
  variant: "filled"
@@ -2448,30 +2503,30 @@ var init_UserStatusChipComponent = __esm({
2448
2503
  );
2449
2504
  }
2450
2505
  if (state.excluded) {
2451
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2452
- import_material11.Chip,
2506
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2507
+ import_material18.Chip,
2453
2508
  {
2454
- label: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Excluded" }),
2509
+ label: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Excluded" }),
2455
2510
  size: "small"
2456
2511
  }
2457
2512
  );
2458
2513
  }
2459
2514
  if (state.locked) {
2460
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2461
- import_material11.Chip,
2515
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2516
+ import_material18.Chip,
2462
2517
  {
2463
- label: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Locked" }),
2518
+ label: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Locked" }),
2464
2519
  color: "error",
2465
2520
  size: "small",
2466
2521
  onDelete: state.locked_reason ? handleShowReason : void 0,
2467
- deleteIcon: state.locked_reason ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material11.IconButton, { size: "small", component: "span", sx: { p: 0.2 }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_InfoOutlined.default, { fontSize: "small" }) }) : void 0
2522
+ deleteIcon: state.locked_reason ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material18.IconButton, { size: "small", component: "span", sx: { p: 0.2 }, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_InfoOutlined.default, { fontSize: "small" }) }) : void 0
2468
2523
  }
2469
2524
  );
2470
2525
  }
2471
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2472
- import_material11.Chip,
2526
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2527
+ import_material18.Chip,
2473
2528
  {
2474
- label: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Active" }),
2529
+ label: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Active" }),
2475
2530
  color: "success",
2476
2531
  size: "small",
2477
2532
  variant: "outlined"
@@ -2482,38 +2537,38 @@ var init_UserStatusChipComponent = __esm({
2482
2537
  });
2483
2538
 
2484
2539
  // src/UI/components/data.display/UserRoleChipComponent.tsx
2485
- var import_material12, import_jsx_runtime22, UserRoleChipComponent;
2540
+ var import_material19, import_jsx_runtime29, UserRoleChipComponent;
2486
2541
  var init_UserRoleChipComponent = __esm({
2487
2542
  "src/UI/components/data.display/UserRoleChipComponent.tsx"() {
2488
2543
  "use strict";
2489
- import_material12 = require("@mui/material");
2544
+ import_material19 = require("@mui/material");
2490
2545
  init_context();
2491
- import_jsx_runtime22 = require("react/jsx-runtime");
2546
+ import_jsx_runtime29 = require("react/jsx-runtime");
2492
2547
  UserRoleChipComponent = ({ overrideNamespace, role }) => {
2493
2548
  switch (role) {
2494
2549
  case "superadmin":
2495
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2496
- import_material12.Chip,
2550
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2551
+ import_material19.Chip,
2497
2552
  {
2498
- label: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Superadministrator" }),
2553
+ label: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Superadministrator" }),
2499
2554
  color: "error",
2500
2555
  size: "small"
2501
2556
  }
2502
2557
  );
2503
2558
  case "admin":
2504
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2505
- import_material12.Chip,
2559
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2560
+ import_material19.Chip,
2506
2561
  {
2507
- label: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Administrator" }),
2562
+ label: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "Administrator" }),
2508
2563
  color: "primary",
2509
2564
  size: "small"
2510
2565
  }
2511
2566
  );
2512
2567
  default:
2513
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2514
- import_material12.Chip,
2568
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2569
+ import_material19.Chip,
2515
2570
  {
2516
- label: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "User" }),
2571
+ label: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "system_widgets", children: "User" }),
2517
2572
  variant: "outlined",
2518
2573
  size: "small"
2519
2574
  }
@@ -2523,73 +2578,18 @@ var init_UserRoleChipComponent = __esm({
2523
2578
  }
2524
2579
  });
2525
2580
 
2526
- // src/UI/components/buttons/CopyClipboardButtonComponent.tsx
2527
- var import_react20, import_material13, import_Check3, import_ContentCopy3, import_jsx_runtime23, CopyClipboardButtonComponent;
2528
- var init_CopyClipboardButtonComponent = __esm({
2529
- "src/UI/components/buttons/CopyClipboardButtonComponent.tsx"() {
2530
- "use strict";
2531
- import_react20 = require("react");
2532
- import_material13 = require("@mui/material");
2533
- import_Check3 = __toESM(require("@mui/icons-material/Check"));
2534
- import_ContentCopy3 = __toESM(require("@mui/icons-material/ContentCopy"));
2535
- init_TranslatableTooltipComponent();
2536
- import_jsx_runtime23 = require("react/jsx-runtime");
2537
- CopyClipboardButtonComponent = ({
2538
- overrideNamespace,
2539
- textToCopy,
2540
- copyTooltipText = "Copy",
2541
- copiedTooltipText = "Copied",
2542
- namespace = "form_components",
2543
- resetDelay = 2e3,
2544
- onCopySuccess,
2545
- size = "small",
2546
- sx,
2547
- ...iconButtonProps
2548
- }) => {
2549
- const [copied, setCopied] = (0, import_react20.useState)(false);
2550
- const handleCopy = async (e) => {
2551
- e.stopPropagation();
2552
- if (!textToCopy) return;
2553
- try {
2554
- await navigator.clipboard.writeText(textToCopy);
2555
- setCopied(true);
2556
- if (onCopySuccess) {
2557
- onCopySuccess(textToCopy);
2558
- }
2559
- setTimeout(() => {
2560
- setCopied(false);
2561
- }, resetDelay);
2562
- } catch (error) {
2563
- console.error("Failed to copy text to clipboard:", error);
2564
- }
2565
- };
2566
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TranslatableTooltipComponent, { title: copied ? copiedTooltipText : copyTooltipText, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2567
- import_material13.IconButton,
2568
- {
2569
- size,
2570
- onClick: handleCopy,
2571
- disabled: !textToCopy || iconButtonProps.disabled,
2572
- sx: { p: 0.25, ...sx },
2573
- ...iconButtonProps,
2574
- children: copied ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_Check3.default, { fontSize: size === "large" ? "medium" : "small", color: "success" }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_ContentCopy3.default, { fontSize: size === "large" ? "medium" : "small" })
2575
- }
2576
- ) }) });
2577
- };
2578
- }
2579
- });
2580
-
2581
2581
  // src/UI/components/data.display/UserPopoverComponent.tsx
2582
2582
  var UserPopoverComponent_exports = {};
2583
2583
  __export(UserPopoverComponent_exports, {
2584
2584
  UserPopoverComponent: () => UserPopoverComponent,
2585
2585
  default: () => UserPopoverComponent_default
2586
2586
  });
2587
- var import_react21, import_material14, import_icons_material2, import_jsx_runtime24, useUserStatus, UserPopoverComponent, UserPopoverComponent_default;
2587
+ var import_react25, import_material20, import_icons_material2, import_jsx_runtime30, useUserStatus, UserPopoverComponent, UserPopoverComponent_default;
2588
2588
  var init_UserPopoverComponent = __esm({
2589
2589
  "src/UI/components/data.display/UserPopoverComponent.tsx"() {
2590
2590
  "use strict";
2591
- import_react21 = require("react");
2592
- import_material14 = require("@mui/material");
2591
+ import_react25 = require("react");
2592
+ import_material20 = require("@mui/material");
2593
2593
  import_icons_material2 = require("@mui/icons-material");
2594
2594
  init_UserStatusChipComponent();
2595
2595
  init_UserRoleChipComponent();
@@ -2599,11 +2599,11 @@ var init_UserPopoverComponent = __esm({
2599
2599
  init_UserSettingsProvider();
2600
2600
  init_TranslatableTooltipComponent();
2601
2601
  init_session_service();
2602
- import_jsx_runtime24 = require("react/jsx-runtime");
2602
+ import_jsx_runtime30 = require("react/jsx-runtime");
2603
2603
  useUserStatus = (supabase, userId, open) => {
2604
- const [lastSeenAt, setLastSeenAt] = (0, import_react21.useState)(null);
2605
- const [loading, setLoading] = (0, import_react21.useState)(true);
2606
- (0, import_react21.useEffect)(() => {
2604
+ const [lastSeenAt, setLastSeenAt] = (0, import_react25.useState)(null);
2605
+ const [loading, setLoading] = (0, import_react25.useState)(true);
2606
+ (0, import_react25.useEffect)(() => {
2607
2607
  if (!userId || !open) {
2608
2608
  setLastSeenAt(null);
2609
2609
  setLoading(false);
@@ -2652,13 +2652,13 @@ var init_UserPopoverComponent = __esm({
2652
2652
  const { activeCompanyId, membership: currentMembership } = useAuth();
2653
2653
  const { openChatWithUser } = useUserSettings();
2654
2654
  const { formatDate, formatRelativeTime } = useLocalization();
2655
- const [profileData, setProfileData] = (0, import_react21.useState)(null);
2656
- const [membershipData, setMembershipData] = (0, import_react21.useState)(null);
2657
- const [avatarUrl, setAvatarUrl] = (0, import_react21.useState)(null);
2658
- const [coverUrl, setCoverUrl] = (0, import_react21.useState)(null);
2659
- const [loading, setLoading] = (0, import_react21.useState)(true);
2655
+ const [profileData, setProfileData] = (0, import_react25.useState)(null);
2656
+ const [membershipData, setMembershipData] = (0, import_react25.useState)(null);
2657
+ const [avatarUrl, setAvatarUrl] = (0, import_react25.useState)(null);
2658
+ const [coverUrl, setCoverUrl] = (0, import_react25.useState)(null);
2659
+ const [loading, setLoading] = (0, import_react25.useState)(true);
2660
2660
  const { lastSeenAt, isOnline } = useUserStatus(supabase, userId, open);
2661
- (0, import_react21.useEffect)(() => {
2661
+ (0, import_react25.useEffect)(() => {
2662
2662
  if (!open || !userId || !activeCompanyId) return;
2663
2663
  let isMounted = true;
2664
2664
  setLoading(true);
@@ -2704,7 +2704,7 @@ var init_UserPopoverComponent = __esm({
2704
2704
  }, [open, userId, currentMembership?.id, activeCompanyId]);
2705
2705
  const getStatusChip = () => {
2706
2706
  if (!profileData) return null;
2707
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(UserStatusChipComponent, { state: { profile_archived: profileData.archived, profile_locked: profileData.locked, excluded: membershipData?.excluded || false, locked: membershipData?.locked || false, locked_reason: membershipData?.locked_reason || "" } });
2707
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(UserStatusChipComponent, { state: { profile_archived: profileData.archived, profile_locked: profileData.locked, excluded: membershipData?.excluded || false, locked: membershipData?.locked || false, locked_reason: membershipData?.locked_reason || "" } });
2708
2708
  };
2709
2709
  const getStatusTypographyColor = (isOnline2, lastSeenAt2) => {
2710
2710
  if (isOnline2) return "success";
@@ -2725,8 +2725,8 @@ var init_UserPopoverComponent = __esm({
2725
2725
  return "inherit";
2726
2726
  };
2727
2727
  const canChat = currentMembership && membershipData && currentMembership.id !== membershipData.id;
2728
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2729
- import_material14.Popover,
2728
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
2729
+ import_material20.Popover,
2730
2730
  {
2731
2731
  open,
2732
2732
  anchorEl,
@@ -2744,9 +2744,9 @@ var init_UserPopoverComponent = __esm({
2744
2744
  }
2745
2745
  }
2746
2746
  },
2747
- children: loading ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Box, { sx: { display: "flex", justifyContent: "center", py: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.CircularProgress, { size: 28 }) }) : profileData ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Box, { sx: { display: "flex", flexDirection: "column" }, children: [
2748
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2749
- import_material14.Box,
2747
+ children: loading ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.Box, { sx: { display: "flex", justifyContent: "center", py: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.CircularProgress, { size: 28 }) }) : profileData ? /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Box, { sx: { display: "flex", flexDirection: "column" }, children: [
2748
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
2749
+ import_material20.Box,
2750
2750
  {
2751
2751
  sx: {
2752
2752
  position: "relative",
@@ -2755,8 +2755,8 @@ var init_UserPopoverComponent = __esm({
2755
2755
  bgcolor: "action.selected"
2756
2756
  },
2757
2757
  children: [
2758
- coverUrl && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2759
- import_material14.Box,
2758
+ coverUrl && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
2759
+ import_material20.Box,
2760
2760
  {
2761
2761
  component: "img",
2762
2762
  src: coverUrl,
@@ -2771,8 +2771,8 @@ var init_UserPopoverComponent = __esm({
2771
2771
  }
2772
2772
  }
2773
2773
  ),
2774
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2775
- import_material14.IconButton,
2774
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
2775
+ import_material20.IconButton,
2776
2776
  {
2777
2777
  size: "small",
2778
2778
  onClick: onClose,
@@ -2789,16 +2789,16 @@ var init_UserPopoverComponent = __esm({
2789
2789
  transform: "scale(1.1)"
2790
2790
  }
2791
2791
  },
2792
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons_material2.Close, { fontSize: "small" })
2792
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons_material2.Close, { fontSize: "small" })
2793
2793
  }
2794
2794
  )
2795
2795
  ]
2796
2796
  }
2797
2797
  ),
2798
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Box, { sx: { p: 2, pt: 0 }, children: [
2799
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Stack, { direction: "row", spacing: 1.5, sx: { alignItems: "flex-end", mt: "-18px", mb: 1 }, children: [
2800
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2801
- import_material14.Badge,
2798
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Box, { sx: { p: 2, pt: 0 }, children: [
2799
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Stack, { direction: "row", spacing: 1.5, sx: { alignItems: "flex-end", mt: "-18px", mb: 1 }, children: [
2800
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
2801
+ import_material20.Badge,
2802
2802
  {
2803
2803
  overlap: "circular",
2804
2804
  anchorOrigin: { vertical: "bottom", horizontal: "right" },
@@ -2834,8 +2834,8 @@ var init_UserPopoverComponent = __esm({
2834
2834
  }
2835
2835
  }
2836
2836
  },
2837
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2838
- import_material14.Avatar,
2837
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
2838
+ import_material20.Avatar,
2839
2839
  {
2840
2840
  src: avatarUrl || coverUrl || void 0,
2841
2841
  sx: {
@@ -2853,54 +2853,54 @@ var init_UserPopoverComponent = __esm({
2853
2853
  )
2854
2854
  }
2855
2855
  ),
2856
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Box, { sx: { overflow: "hidden", pb: 0.5 }, children: [
2857
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Typography, { variant: "subtitle1", sx: { fontWeight: 600, lineHeight: 1.2 }, noWrap: true, children: profileData.display_name || `${profileData.first_name || ""} ${profileData.last_name || ""}` }),
2858
- membershipData?.employee_post && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Typography, { variant: "body2", color: "text.secondary", noWrap: true, children: membershipData.employee_post })
2856
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Box, { sx: { overflow: "hidden", pb: 0.5 }, children: [
2857
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.Typography, { variant: "subtitle1", sx: { fontWeight: 600, lineHeight: 1.2 }, noWrap: true, children: profileData.display_name || `${profileData.first_name || ""} ${profileData.last_name || ""}` }),
2858
+ membershipData?.employee_post && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.Typography, { variant: "body2", color: "text.secondary", noWrap: true, children: membershipData.employee_post })
2859
2859
  ] })
2860
2860
  ] }),
2861
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Stack, { direction: "row", spacing: 1, sx: { my: 1, flexWrap: "wrap", gap: 0.5 }, children: [
2861
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Stack, { direction: "row", spacing: 1, sx: { my: 1, flexWrap: "wrap", gap: 0.5 }, children: [
2862
2862
  getStatusChip(),
2863
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(UserRoleChipComponent, { role: membershipData?.role || "user" })
2863
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(UserRoleChipComponent, { role: membershipData?.role || "user" })
2864
2864
  ] }),
2865
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Divider, { sx: { my: 1.5 } }),
2866
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Stack, { spacing: 1, sx: { fontSize: "0.875rem", mb: 1.5 }, children: [
2867
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2868
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons_material2.AccessTime, { fontSize: "small", color: getStatusIconColor(isOnline, lastSeenAt) }),
2869
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Typography, { variant: "body2", color: getStatusTypographyColor(isOnline, lastSeenAt), children: isOnline ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Online" }) : lastSeenAt ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
2870
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Last seen" }),
2865
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.Divider, { sx: { my: 1.5 } }),
2866
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Stack, { spacing: 1, sx: { fontSize: "0.875rem", mb: 1.5 }, children: [
2867
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2868
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons_material2.AccessTime, { fontSize: "small", color: getStatusIconColor(isOnline, lastSeenAt) }),
2869
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.Typography, { variant: "body2", color: getStatusTypographyColor(isOnline, lastSeenAt), children: isOnline ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Online" }) : lastSeenAt ? /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
2870
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Last seen" }),
2871
2871
  ":",
2872
2872
  " ",
2873
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("strong", { children: formatRelativeTime(lastSeenAt) })
2874
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Offline" }) })
2873
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("strong", { children: formatRelativeTime(lastSeenAt) })
2874
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Offline" }) })
2875
2875
  ] }),
2876
- profileData.email && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2877
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons_material2.Email, { fontSize: "small" }),
2878
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Typography, { variant: "body2", color: "text.primary", noWrap: true, sx: { flexGrow: 1 }, children: profileData.email }),
2879
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CopyClipboardButtonComponent, { textToCopy: profileData.email })
2876
+ profileData.email && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2877
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons_material2.Email, { fontSize: "small" }),
2878
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.Typography, { variant: "body2", color: "text.primary", noWrap: true, sx: { flexGrow: 1 }, children: profileData.email }),
2879
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CopyClipboardButtonComponent, { textToCopy: profileData.email })
2880
2880
  ] }),
2881
- membershipData?.employee_post && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2882
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons_material2.Work, { fontSize: "small" }),
2883
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Typography, { variant: "body2", color: "text.primary", noWrap: true, sx: { flexGrow: 1 }, children: membershipData.employee_post }),
2884
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CopyClipboardButtonComponent, { textToCopy: membershipData.employee_post })
2881
+ membershipData?.employee_post && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2882
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons_material2.Work, { fontSize: "small" }),
2883
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.Typography, { variant: "body2", color: "text.primary", noWrap: true, sx: { flexGrow: 1 }, children: membershipData.employee_post }),
2884
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CopyClipboardButtonComponent, { textToCopy: membershipData.employee_post })
2885
2885
  ] }),
2886
- profileData.phone && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2887
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons_material2.Phone, { fontSize: "small" }),
2888
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Typography, { variant: "body2", color: "text.primary", children: profileData.phone })
2886
+ profileData.phone && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2887
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons_material2.Phone, { fontSize: "small" }),
2888
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.Typography, { variant: "body2", color: "text.primary", children: profileData.phone })
2889
2889
  ] }),
2890
- profileData.birthday && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2891
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons_material2.Cake, { fontSize: "small" }),
2892
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Typography, { variant: "body2", color: "text.primary", children: formatDate(profileData.birthday) })
2890
+ profileData.birthday && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2891
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons_material2.Cake, { fontSize: "small" }),
2892
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.Typography, { variant: "body2", color: "text.primary", children: formatDate(profileData.birthday) })
2893
2893
  ] }),
2894
- membershipData?.created_at && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2895
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons_material2.CalendarToday, { fontSize: "small" }),
2896
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Typography, { variant: "body2", color: "text.primary", children: [
2897
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "In company from" }),
2894
+ membershipData?.created_at && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, color: "text.secondary", children: [
2895
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons_material2.CalendarToday, { fontSize: "small" }),
2896
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Typography, { variant: "body2", color: "text.primary", children: [
2897
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "In company from" }),
2898
2898
  ": ",
2899
2899
  formatDate(membershipData.created_at)
2900
2900
  ] })
2901
2901
  ] }),
2902
- profileData.description && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2903
- import_material14.Typography,
2902
+ profileData.description && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
2903
+ import_material20.Typography,
2904
2904
  {
2905
2905
  variant: "caption",
2906
2906
  color: "text.secondary",
@@ -2915,28 +2915,28 @@ var init_UserPopoverComponent = __esm({
2915
2915
  }
2916
2916
  )
2917
2917
  ] }),
2918
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Divider, { sx: { my: 1 } }),
2919
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Stack, { direction: "row", spacing: 1, sx: { justifyContent: "space-around", pt: 0.5 }, children: [
2920
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Send a notification" }), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.IconButton, { size: "small", color: "primary", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons_material2.NotificationsNone, { fontSize: "small" }) }) }),
2921
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Set a task" }), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.IconButton, { size: "small", color: "primary", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons_material2.AssignmentOutlined, { fontSize: "small" }) }) }),
2922
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Start a chat" }), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2923
- import_material14.IconButton,
2918
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.Divider, { sx: { my: 1 } }),
2919
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material20.Stack, { direction: "row", spacing: 1, sx: { justifyContent: "space-around", pt: 0.5 }, children: [
2920
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Send a notification" }), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.IconButton, { size: "small", color: "primary", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons_material2.NotificationsNone, { fontSize: "small" }) }) }),
2921
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Set a task" }), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.IconButton, { size: "small", color: "primary", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons_material2.AssignmentOutlined, { fontSize: "small" }) }) }),
2922
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Start a chat" }), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
2923
+ import_material20.IconButton,
2924
2924
  {
2925
2925
  size: "small",
2926
2926
  color: "primary",
2927
2927
  disabled: !canChat,
2928
2928
  onClick: () => membershipData && openChatWithUser(membershipData.id),
2929
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons_material2.ChatBubble, { fontSize: "small" })
2929
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons_material2.ChatBubble, { fontSize: "small" })
2930
2930
  }
2931
2931
  ) })
2932
2932
  ] })
2933
2933
  ] })
2934
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Box, { sx: { p: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2935
- import_material14.Typography,
2934
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material20.Box, { sx: { p: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
2935
+ import_material20.Typography,
2936
2936
  {
2937
2937
  color: "error",
2938
2938
  variant: "body2",
2939
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Failed to load user data" })
2939
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Failed to load user data" })
2940
2940
  }
2941
2941
  ) })
2942
2942
  }
@@ -2953,19 +2953,41 @@ __export(index_exports, {
2953
2953
  AppSettingsProvider: () => AppSettingsProvider,
2954
2954
  AuthProvider: () => AuthProvider,
2955
2955
  BreadcrumbProvider: () => BreadcrumbProvider,
2956
+ ButtonComponent: () => ButtonComponent,
2957
+ CheckboxComponent: () => CheckboxComponent,
2958
+ CollapsedContainerComponent: () => CollapsedContainerComponent,
2956
2959
  ConfirmationProvider: () => ConfirmationProvider,
2960
+ CopyClipboardButtonComponent: () => CopyClipboardButtonComponent,
2961
+ EmailInputComponent: () => EmailInputComponent,
2962
+ ErrorAlertComponent: () => ErrorAlertComponent,
2963
+ ExpandableNoteComponent: () => ExpandableNoteComponent,
2964
+ FilterContainerComponent: () => FilterContainerComponent,
2957
2965
  Hooks: () => Hooks,
2958
2966
  LocalizationProvider: () => LocalizationProvider,
2967
+ MyAvatarComponent: () => MyAvatarComponent,
2968
+ NumberInputComponent: () => NumberInputComponent,
2969
+ PageComponent: () => PageComponent,
2970
+ PageLinkComponent: () => PageLinkComponent,
2959
2971
  Providers: () => Providers,
2972
+ RefreshButtonComponent: () => RefreshButtonComponent,
2973
+ SearchComponent: () => SearchComponent,
2974
+ SelectComponent: () => SelectComponent,
2960
2975
  Services: () => Services,
2961
2976
  SupabaseProvider: () => SupabaseProvider,
2977
+ SwitchComponent: () => SwitchComponent,
2978
+ TextFieldComponent: () => TextFieldComponent,
2962
2979
  ThemeProvider: () => ThemeProvider,
2963
2980
  ToastProvider: () => ToastProvider,
2981
+ TranslatableTooltipComponent: () => TranslatableTooltipComponent,
2964
2982
  TranslateProvider: () => TranslateProvider,
2965
2983
  TranslateText: () => TranslateText,
2966
2984
  TranslationEditProvider: () => TranslationEditProvider,
2967
- UI: () => UI,
2985
+ UrlComponent: () => UrlComponent,
2986
+ UserAvatarComponent: () => UserAvatarComponent,
2987
+ UserPopoverComponent: () => UserPopoverComponent,
2988
+ UserRoleChipComponent: () => UserRoleChipComponent,
2968
2989
  UserSettingsProvider: () => UserSettingsProvider,
2990
+ UserStatusChipComponent: () => UserStatusChipComponent,
2969
2991
  Utils: () => Utils,
2970
2992
  defaultUserSettings: () => defaultUserSettings,
2971
2993
  initI18n: () => initI18n,
@@ -3417,248 +3439,54 @@ var NumberInputComponent = ({
3417
3439
  );
3418
3440
  };
3419
3441
 
3420
- // src/UI/components/inputs/UrlComponent.tsx
3442
+ // src/UI/components/inputs/EmailInputComponent.tsx
3421
3443
  var import_react10 = require("react");
3422
- var import_material6 = require("@mui/material");
3423
- var import_Link = __toESM(require("@mui/icons-material/Link"));
3424
- var import_Launch2 = __toESM(require("@mui/icons-material/Launch"));
3425
- var import_ContentCopy2 = __toESM(require("@mui/icons-material/ContentCopy"));
3426
- var import_Check2 = __toESM(require("@mui/icons-material/Check"));
3427
- var import_EditNote = __toESM(require("@mui/icons-material/EditNote"));
3428
- var import_Lock2 = __toESM(require("@mui/icons-material/Lock"));
3429
- init_TranslateText();
3430
3444
  var import_jsx_runtime11 = require("react/jsx-runtime");
3431
- function UrlComponent({
3432
- overrideNamespace,
3433
- label,
3434
- value,
3445
+ var EMAIL_REGEX = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
3446
+ var EmailInputComponent = ({
3447
+ value = "",
3435
3448
  onChange,
3436
- disabled = false,
3437
- readOnly = false,
3438
- required = false,
3439
- error = false,
3440
- helperText = "",
3441
- description = "",
3442
- fullWidth = true,
3443
- openInNewTab = true,
3444
- showLock = true,
3445
- lockTooltip = "Field is not editable",
3446
- sx
3447
- }) {
3448
- const [copied, setCopied] = (0, import_react10.useState)(false);
3449
- const [anchorEl, setAnchorEl] = (0, import_react10.useState)(null);
3450
- const isViewMode = disabled || readOnly;
3451
- const currentUrl = typeof value === "object" && value !== null ? value.url || "" : value || "";
3452
- const currentTitle = typeof value === "object" && value !== null ? value.title || "" : "";
3453
- const getFormattedUrl = (val) => {
3454
- if (!val) return "";
3455
- const trimmed = val.trim();
3456
- if (trimmed.match(/^[a-zA-Z]+:\/\//)) {
3457
- return trimmed;
3449
+ onBlur,
3450
+ error: externalError,
3451
+ helperText: externalHelperText,
3452
+ invalidEmailError = "Invalid email address",
3453
+ disableValidation = false,
3454
+ onValidationChange,
3455
+ ...props
3456
+ }) => {
3457
+ const [internalError, setInternalError] = (0, import_react10.useState)(null);
3458
+ const validateEmail = (val) => {
3459
+ if (disableValidation) return true;
3460
+ const stringVal = String(val ?? "").trim();
3461
+ if (!stringVal) {
3462
+ setInternalError(null);
3463
+ onValidationChange?.(true);
3464
+ return true;
3458
3465
  }
3459
- return `https://${trimmed}`;
3460
- };
3461
- const finalUrl = getFormattedUrl(currentUrl);
3462
- const targetAttribute = openInNewTab ? "_blank" : "_self";
3463
- const displayLabelText = currentTitle.trim() || currentUrl;
3464
- const handleUrlChange = (newUrl) => {
3465
- onChange?.({ url: newUrl, title: currentTitle });
3466
- };
3467
- const handleTitleChange = (newTitle) => {
3468
- onChange?.({ url: currentUrl, title: newTitle });
3469
- };
3470
- const handleCopy = (e) => {
3471
- e.stopPropagation();
3472
- if (!finalUrl) return;
3473
- navigator.clipboard.writeText(finalUrl);
3474
- setCopied(true);
3475
- setTimeout(() => setCopied(false), 2e3);
3466
+ const isValid = EMAIL_REGEX.test(stringVal);
3467
+ const errorMessage = isValid ? null : invalidEmailError;
3468
+ setInternalError(errorMessage);
3469
+ onValidationChange?.(isValid);
3470
+ return isValid;
3476
3471
  };
3477
- const handleOpenLink = (e) => {
3478
- e.stopPropagation();
3479
- if (finalUrl) {
3480
- window.open(finalUrl, targetAttribute, openInNewTab ? "noopener,noreferrer" : void 0);
3472
+ const handleChange = (e) => {
3473
+ const newValue = e.target.value;
3474
+ if (internalError) {
3475
+ validateEmail(newValue);
3481
3476
  }
3482
- };
3483
- const handleInputClick = (e) => {
3484
- if (isViewMode && finalUrl) {
3485
- handleOpenLink(e);
3477
+ if (onChange) {
3478
+ onChange(e);
3486
3479
  }
3487
3480
  };
3488
- const handleOpenTitleMenu = (e) => {
3489
- e.stopPropagation();
3490
- setAnchorEl(e.currentTarget);
3491
- };
3492
- const handleCloseTitleMenu = () => {
3493
- setAnchorEl(null);
3494
- };
3495
- const isTitlePopoverOpen = Boolean(anchorEl);
3496
- const displayHelperText = error ? helperText : description || helperText;
3497
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
3498
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3499
- import_material6.TextField,
3500
- {
3501
- label: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TranslateText, { overrideNamespace, children: label }),
3502
- type: isViewMode ? "text" : "url",
3503
- value: isViewMode ? displayLabelText : currentUrl,
3504
- onChange: (e) => handleUrlChange(e.target.value),
3505
- required,
3506
- error,
3507
- disabled,
3508
- margin: "dense",
3509
- helperText: displayHelperText,
3510
- fullWidth,
3511
- placeholder: "example.com",
3512
- sx: {
3513
- "& .MuiInputLabel-asterisk": {
3514
- color: "red",
3515
- fontSize: "1.5rem"
3516
- },
3517
- "& .MuiInputBase-input": {
3518
- color: isViewMode && finalUrl ? "primary.main" : void 0,
3519
- textDecoration: isViewMode && finalUrl ? "underline" : "none",
3520
- cursor: isViewMode && finalUrl ? "pointer" : void 0,
3521
- fontWeight: isViewMode && finalUrl ? 500 : void 0
3522
- },
3523
- ...sx
3524
- },
3525
- slotProps: {
3526
- htmlInput: {
3527
- readOnly,
3528
- onClick: handleInputClick
3529
- },
3530
- input: {
3531
- startAdornment: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material6.InputAdornment, { position: "start", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_Link.default, { fontSize: "small", color: isViewMode && finalUrl ? "primary" : "action" }) }),
3532
- endAdornment: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_material6.InputAdornment, { position: "end", sx: { gap: 0.5 }, children: [
3533
- !isViewMode && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material6.Tooltip, { title: currentTitle ? `Title: "${currentTitle}"` : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Set link title" }), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3534
- import_material6.IconButton,
3535
- {
3536
- size: "small",
3537
- onClick: handleOpenTitleMenu,
3538
- color: currentTitle ? "primary" : "default",
3539
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_EditNote.default, { fontSize: "small" })
3540
- }
3541
- ) }),
3542
- finalUrl && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material6.Tooltip, { title: copied ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Copied!" }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Copy link" }), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material6.IconButton, { size: "small", onClick: handleCopy, color: copied ? "success" : "default", children: copied ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_Check2.default, { fontSize: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_ContentCopy2.default, { fontSize: "small" }) }) }),
3543
- isViewMode && showLock && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material6.Tooltip, { title: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TranslateText, { overrideNamespace, children: lockTooltip }), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3544
- import_material6.IconButton,
3545
- {
3546
- size: "small",
3547
- disabled: true,
3548
- edge: "end",
3549
- "aria-label": "locked input",
3550
- sx: {
3551
- "&.Mui-disabled": {
3552
- color: "text.secondary"
3553
- }
3554
- },
3555
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_Lock2.default, { fontSize: "small" })
3556
- }
3557
- ) }),
3558
- finalUrl && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material6.Tooltip, { title: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Open link" }), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material6.IconButton, { size: "small", onClick: handleOpenLink, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_Launch2.default, { fontSize: "small", color: isViewMode ? "primary" : "action" }) }) })
3559
- ] })
3560
- }
3561
- }
3562
- }
3563
- ),
3564
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
3565
- import_material6.Popover,
3566
- {
3567
- open: isTitlePopoverOpen,
3568
- anchorEl,
3569
- onClose: handleCloseTitleMenu,
3570
- anchorOrigin: {
3571
- vertical: "bottom",
3572
- horizontal: "right"
3573
- },
3574
- transformOrigin: {
3575
- vertical: "top",
3576
- horizontal: "right"
3577
- },
3578
- slotProps: {
3579
- paper: { sx: { p: 2, width: 280 } }
3580
- },
3581
- children: [
3582
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material6.Typography, { variant: "subtitle2", sx: { mb: 1, fontWeight: "bold" }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Link Title (Anchor)" }) }),
3583
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_material6.Typography, { variant: "caption", color: "text.secondary", sx: { mb: 1.5, display: "block" }, children: [
3584
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Specify the text to display instead of the URL address" }),
3585
- ":"
3586
- ] }),
3587
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3588
- import_material6.TextField,
3589
- {
3590
- size: "small",
3591
- fullWidth: true,
3592
- placeholder: "e.g. Instruction",
3593
- value: currentTitle,
3594
- onChange: (e) => handleTitleChange(e.target.value),
3595
- autoFocus: true,
3596
- onKeyDown: (e) => {
3597
- if (e.key === "Enter") {
3598
- e.preventDefault();
3599
- handleCloseTitleMenu();
3600
- }
3601
- }
3602
- }
3603
- ),
3604
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material6.Box, { sx: { display: "flex", justifyContent: "flex-end", mt: 1.5 }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material6.Button, { size: "small", variant: "contained", onClick: handleCloseTitleMenu, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Done" }) }) })
3605
- ]
3606
- }
3607
- )
3608
- ] });
3609
- }
3610
-
3611
- // src/UI/index.ts
3612
- init_TranslatableTooltipComponent();
3613
-
3614
- // src/UI/components/inputs/EmailInputComponent.tsx
3615
- var import_react11 = require("react");
3616
- var import_jsx_runtime12 = require("react/jsx-runtime");
3617
- var EMAIL_REGEX = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
3618
- var EmailInputComponent = ({
3619
- value = "",
3620
- onChange,
3621
- onBlur,
3622
- error: externalError,
3623
- helperText: externalHelperText,
3624
- invalidEmailError = "Invalid email address",
3625
- disableValidation = false,
3626
- onValidationChange,
3627
- ...props
3628
- }) => {
3629
- const [internalError, setInternalError] = (0, import_react11.useState)(null);
3630
- const validateEmail = (val) => {
3631
- if (disableValidation) return true;
3632
- const stringVal = String(val ?? "").trim();
3633
- if (!stringVal) {
3634
- setInternalError(null);
3635
- onValidationChange?.(true);
3636
- return true;
3637
- }
3638
- const isValid = EMAIL_REGEX.test(stringVal);
3639
- const errorMessage = isValid ? null : invalidEmailError;
3640
- setInternalError(errorMessage);
3641
- onValidationChange?.(isValid);
3642
- return isValid;
3643
- };
3644
- const handleChange = (e) => {
3645
- const newValue = e.target.value;
3646
- if (internalError) {
3647
- validateEmail(newValue);
3648
- }
3649
- if (onChange) {
3650
- onChange(e);
3651
- }
3652
- };
3653
- const handleBlur = (e) => {
3654
- validateEmail(e.target.value);
3655
- if (onBlur) {
3656
- onBlur(e);
3657
- }
3481
+ const handleBlur = (e) => {
3482
+ validateEmail(e.target.value);
3483
+ if (onBlur) {
3484
+ onBlur(e);
3485
+ }
3658
3486
  };
3659
3487
  const hasError = Boolean(externalError || internalError);
3660
3488
  const displayHelperText = externalHelperText || internalError || void 0;
3661
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3489
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3662
3490
  TextFieldComponent,
3663
3491
  {
3664
3492
  type: "email",
@@ -3672,1275 +3500,1016 @@ var EmailInputComponent = ({
3672
3500
  );
3673
3501
  };
3674
3502
 
3675
- // src/UI/components/data.display/UserAvatarComponent.tsx
3676
- var import_react22 = require("react");
3677
- var import_material15 = require("@mui/material");
3503
+ // src/UI/components/inputs/SearchComponent.tsx
3504
+ var import_react20 = require("react");
3505
+ var import_react_i18next5 = require("react-i18next");
3506
+ var import_material10 = require("@mui/material");
3507
+ var import_Translate4 = __toESM(require("@mui/icons-material/Translate"));
3508
+ var import_Clear2 = __toESM(require("@mui/icons-material/Clear"));
3678
3509
  init_context();
3679
- var import_jsx_runtime25 = require("react/jsx-runtime");
3680
- var LazyUserPopover = (0, import_react22.lazy)(() => Promise.resolve().then(() => (init_UserPopoverComponent(), UserPopoverComponent_exports)));
3681
- var getInitials = (name) => {
3682
- if (!name) return "?";
3683
- const parts = name.trim().split(" ");
3684
- if (parts.length >= 2) {
3685
- return `${parts[0][0]}${parts[1][0]}`.toUpperCase();
3686
- }
3687
- return name[0].toUpperCase();
3688
- };
3689
- var UserAvatarComponent = ({
3690
- userId = "",
3691
- avatarUrl = "",
3692
- displayName = "",
3693
- employeePost = "",
3694
- size = 40,
3695
- disableBorder = false,
3696
- disableShadow = false,
3697
- disablePopover = false,
3698
- disableTooltip = false,
3699
- sx = {}
3700
- }) => {
3701
- const supabase = useSupabase();
3702
- const [anchorEl, setAnchorEl] = (0, import_react22.useState)(null);
3703
- const [hasInteracted, setHasInteracted] = (0, import_react22.useState)(false);
3704
- const [resolvedAvatarUrl, setResolvedAvatarUrl] = (0, import_react22.useState)(null);
3705
- const canShowPopover = !disablePopover && Boolean(userId);
3706
- (0, import_react22.useEffect)(() => {
3707
- let isMounted = true;
3708
- const resolveAvatar = async () => {
3709
- if (!avatarUrl) {
3710
- if (isMounted) setResolvedAvatarUrl(null);
3711
- return;
3712
- }
3713
- if (!avatarUrl.startsWith("http") && !avatarUrl.startsWith("data:")) {
3714
- try {
3715
- const { data } = await supabase.storage.from("user-media").createSignedUrl(avatarUrl, 3600);
3716
- if (isMounted) {
3717
- setResolvedAvatarUrl(data?.signedUrl || null);
3718
- }
3719
- } catch (err) {
3720
- console.error("Error resolving signed url for avatar:", err);
3721
- if (isMounted) setResolvedAvatarUrl(null);
3722
- }
3723
- } else {
3724
- if (isMounted) setResolvedAvatarUrl(avatarUrl);
3725
- }
3726
- };
3727
- resolveAvatar();
3510
+ init_translation_service();
3511
+ init_TranslationDialog();
3512
+ init_TranslatableTooltipComponent();
3513
+
3514
+ // src/hooks/useDebounce.ts
3515
+ var import_react19 = require("react");
3516
+ function useDebounce(value, delay = 500) {
3517
+ const [debouncedValue, setDebouncedValue] = (0, import_react19.useState)(value);
3518
+ (0, import_react19.useEffect)(() => {
3519
+ const timer = setTimeout(() => {
3520
+ setDebouncedValue(value);
3521
+ }, delay);
3728
3522
  return () => {
3729
- isMounted = false;
3523
+ clearTimeout(timer);
3730
3524
  };
3731
- }, [avatarUrl]);
3732
- const handleClick = (event) => {
3733
- event.stopPropagation();
3734
- event.preventDefault();
3735
- if (canShowPopover) {
3736
- setAnchorEl(event.currentTarget);
3737
- if (!hasInteracted) {
3738
- setHasInteracted(true);
3739
- }
3525
+ }, [value, delay]);
3526
+ return debouncedValue;
3527
+ }
3528
+
3529
+ // src/UI/components/inputs/SearchComponent.tsx
3530
+ var import_jsx_runtime20 = require("react/jsx-runtime");
3531
+ var SearchComponent = ({
3532
+ overrideNamespace,
3533
+ label = "",
3534
+ value = "",
3535
+ onChange,
3536
+ onClear,
3537
+ placeholderKey,
3538
+ clearTooltip = "Clear",
3539
+ debounceDelay = 500,
3540
+ onDebounceChange,
3541
+ slotProps,
3542
+ ...restProps
3543
+ }) => {
3544
+ const supabase = useSupabase();
3545
+ const namespace = useTranslationNamespace();
3546
+ const { t, i18n: i18n2 } = (0, import_react_i18next5.useTranslation)(namespace);
3547
+ const { isTranslationMode } = useTranslationEdit();
3548
+ const [isDialogOpen, setIsDialogOpen] = (0, import_react20.useState)(false);
3549
+ const [localValue, setLocalValue] = (0, import_react20.useState)(String(value ?? ""));
3550
+ const debouncedValue = useDebounce(localValue, debounceDelay);
3551
+ (0, import_react20.useEffect)(() => {
3552
+ setLocalValue(String(value ?? ""));
3553
+ }, [value]);
3554
+ (0, import_react20.useEffect)(() => {
3555
+ if (onDebounceChange) {
3556
+ onDebounceChange(debouncedValue);
3557
+ }
3558
+ if (onChange && debouncedValue !== String(value ?? "")) {
3559
+ const syntheticEvent = {
3560
+ target: { value: debouncedValue },
3561
+ currentTarget: { value: debouncedValue }
3562
+ };
3563
+ onChange(syntheticEvent);
3740
3564
  }
3565
+ }, [debouncedValue]);
3566
+ const hasValue = localValue.length > 0;
3567
+ const handleChange = (e) => {
3568
+ setLocalValue(e.target.value);
3741
3569
  };
3742
- const handleClose = (event) => {
3743
- if (event) {
3744
- event.stopPropagation();
3745
- event.preventDefault();
3570
+ const handleClear = (e) => {
3571
+ e.stopPropagation();
3572
+ setLocalValue("");
3573
+ if (onClear) {
3574
+ onClear();
3575
+ }
3576
+ if (onChange) {
3577
+ const syntheticEvent = {
3578
+ ...e,
3579
+ target: { ...e.target, value: "" },
3580
+ currentTarget: { ...e.currentTarget, value: "" }
3581
+ };
3582
+ onChange(syntheticEvent);
3746
3583
  }
3747
- setAnchorEl(null);
3748
3584
  };
3749
- const isPopoverOpen = Boolean(anchorEl);
3750
- const initials = getInitials(displayName || "");
3751
- const getTooltip = /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
3752
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material15.Typography, { component: "div", variant: "caption", children: displayName }),
3753
- displayName && employeePost && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material15.Typography, { component: "div", variant: "caption", children: employeePost })
3754
- ] });
3755
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
3756
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material15.Tooltip, { title: disableTooltip || isPopoverOpen ? "" : getTooltip, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3757
- import_material15.Avatar,
3758
- {
3759
- src: resolvedAvatarUrl || void 0,
3760
- alt: displayName || "User Avatar",
3761
- onClick: handleClick,
3762
- sx: {
3763
- width: size,
3764
- height: size,
3765
- fontSize: size * 0.4,
3766
- fontWeight: 600,
3767
- bgcolor: "primary.main",
3768
- color: "primary.contrastText",
3769
- cursor: canShowPopover ? "pointer" : void 0,
3770
- transition: "transform 0.2s ease, box-shadow 0.2s ease",
3771
- border: disableBorder ? "none" : "2px solid",
3772
- borderColor: "background.paper",
3773
- boxShadow: disableShadow ? "none" : 2,
3774
- "&:hover": {
3775
- transform: canShowPopover ? "scale(1.05)" : "none"
3776
- },
3777
- ...sx
3778
- },
3779
- children: !resolvedAvatarUrl && initials
3780
- }
3781
- ) }),
3782
- canShowPopover && hasInteracted && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react22.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3783
- LazyUserPopover,
3784
- {
3785
- userId,
3786
- anchorEl,
3787
- open: isPopoverOpen,
3788
- onClose: handleClose
3789
- }
3790
- ) })
3791
- ] });
3792
- };
3793
-
3794
- // src/UI/index.ts
3795
- init_CopyClipboardButtonComponent();
3796
- init_UserRoleChipComponent();
3797
- init_UserStatusChipComponent();
3798
- init_UserPopoverComponent();
3799
-
3800
- // src/UI/components/data.display/MyAvatarComponent.tsx
3801
- var import_react23 = require("react");
3802
- var import_material16 = require("@mui/material");
3803
- init_context();
3804
- var import_jsx_runtime26 = require("react/jsx-runtime");
3805
- var getInitials2 = (name) => {
3806
- if (!name) return "?";
3807
- const parts = name.trim().split(" ");
3808
- if (parts.length >= 2) {
3809
- return `${parts[0][0]}${parts[1][0]}`.toUpperCase();
3810
- }
3811
- return name[0].toUpperCase();
3812
- };
3813
- var MyAvatarComponent = ({
3814
- size = 40,
3815
- disableBorder = false,
3816
- disableShadow = false,
3817
- disablePopover = false,
3818
- sx = {}
3819
- }) => {
3820
- const { profile: userProfile, loading: isLoading } = useAuth();
3821
- const [anchorEl, setAnchorEl] = (0, import_react23.useState)(null);
3822
- const handlePopoverOpen = (event) => {
3823
- if (!disablePopover) {
3824
- setAnchorEl(event.currentTarget);
3585
+ const translatedPlaceholder = placeholderKey ? t(placeholderKey) : void 0;
3586
+ const handleSaveTranslations = async (newValues, contextHint) => {
3587
+ if (!placeholderKey) return;
3588
+ const upsertData = Object.entries(newValues).map(([langCode, text]) => ({
3589
+ lang_code: langCode,
3590
+ namespace,
3591
+ key: placeholderKey,
3592
+ value: text,
3593
+ context_hint: contextHint
3594
+ }));
3595
+ const { error } = await supabase.from("translations").upsert(upsertData, { onConflict: "lang_code,namespace,key" });
3596
+ if (error) {
3597
+ alert("\u041F\u043E\u043C\u0438\u043B\u043A\u0430 \u043F\u0456\u0434 \u0447\u0430\u0441 \u0437\u0431\u0435\u0440\u0435\u0436\u0435\u043D\u043D\u044F \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043D\u0438\u0445");
3598
+ throw error;
3825
3599
  }
3600
+ await translationService.incrementVersion(supabase, namespace, Object.keys(newValues));
3601
+ Object.entries(newValues).forEach(([langCode, text]) => {
3602
+ i18n2.addResource(langCode, namespace, placeholderKey, text);
3603
+ });
3826
3604
  };
3827
- const handlePopoverClose = () => {
3828
- setAnchorEl(null);
3605
+ const renderEndAdornment = () => {
3606
+ const rawInputProps = slotProps?.input;
3607
+ const isInputObject = typeof rawInputProps === "object" && rawInputProps !== null;
3608
+ const existingEndAdornment = isInputObject && "endAdornment" in rawInputProps ? rawInputProps.endAdornment : void 0;
3609
+ if (!hasValue && (!isTranslationMode || !placeholderKey)) {
3610
+ return existingEndAdornment;
3611
+ }
3612
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
3613
+ existingEndAdornment,
3614
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material10.InputAdornment, { position: "end", children: [
3615
+ hasValue && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TranslateText, { overrideNamespace, children: clearTooltip }), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3616
+ import_material10.IconButton,
3617
+ {
3618
+ size: "small",
3619
+ onClick: handleClear,
3620
+ edge: "end",
3621
+ "aria-label": "clear input",
3622
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_Clear2.default, { fontSize: "small" })
3623
+ }
3624
+ ) }),
3625
+ isTranslationMode && placeholderKey && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material10.Tooltip, { title: `Translate placeholder: "${placeholderKey}"`, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3626
+ import_material10.IconButton,
3627
+ {
3628
+ size: "small",
3629
+ onClick: (e) => {
3630
+ e.preventDefault();
3631
+ e.stopPropagation();
3632
+ setIsDialogOpen(true);
3633
+ },
3634
+ sx: {
3635
+ color: "#d97706",
3636
+ backgroundColor: "rgba(254, 243, 199, 0.6)",
3637
+ border: "1px dashed #f59e0b",
3638
+ p: "3px",
3639
+ ml: 0.5,
3640
+ "&:hover": {
3641
+ backgroundColor: "#fef08a"
3642
+ }
3643
+ },
3644
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_Translate4.default, { fontSize: "small" })
3645
+ }
3646
+ ) })
3647
+ ] })
3648
+ ] });
3829
3649
  };
3830
- const isPopoverOpen = Boolean(anchorEl);
3831
- if (isLoading) {
3832
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3833
- import_material16.Skeleton,
3834
- {
3835
- variant: "circular",
3836
- width: size,
3837
- height: size,
3838
- sx: { display: "inline-block", flexShrink: 0, ...sx }
3839
- }
3840
- );
3841
- }
3842
- const initials = getInitials2(userProfile?.display_name || "");
3843
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
3844
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3845
- import_material16.Avatar,
3650
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
3651
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3652
+ import_material10.TextField,
3846
3653
  {
3847
- src: userProfile?.avatar_url || void 0,
3848
- alt: userProfile?.display_name || "User Avatar",
3849
- onMouseEnter: handlePopoverOpen,
3850
- onMouseLeave: handlePopoverClose,
3851
- sx: {
3852
- width: size,
3853
- height: size,
3854
- fontSize: size * 0.4,
3855
- fontWeight: 600,
3856
- bgcolor: "primary.main",
3857
- color: "primary.contrastText",
3858
- cursor: disablePopover ? void 0 : "pointer",
3859
- transition: "transform 0.2s ease, box-shadow 0.2s ease",
3860
- border: disableBorder ? "none" : "2px solid",
3861
- borderColor: "background.paper",
3862
- boxShadow: disableShadow ? "none" : 2,
3863
- "&:hover": {
3864
- transform: disablePopover ? "none" : "scale(1.05)"
3865
- },
3866
- ...sx
3867
- },
3868
- children: !userProfile?.avatar_url && initials
3654
+ ...restProps,
3655
+ label: typeof label === "string" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TranslateText, { overrideNamespace, children: label }) : label,
3656
+ value: localValue,
3657
+ onChange: handleChange,
3658
+ placeholder: translatedPlaceholder,
3659
+ slotProps: {
3660
+ ...slotProps,
3661
+ input: {
3662
+ ...slotProps?.input,
3663
+ endAdornment: renderEndAdornment()
3664
+ }
3665
+ }
3869
3666
  }
3870
3667
  ),
3871
- !disablePopover && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3872
- import_material16.Popover,
3668
+ placeholderKey && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3669
+ TranslationDialog,
3873
3670
  {
3874
- id: `avatar-popover-${userProfile?.id}`,
3875
- open: isPopoverOpen,
3876
- anchorEl,
3877
- anchorOrigin: {
3878
- vertical: "bottom",
3879
- horizontal: "center"
3880
- },
3881
- transformOrigin: {
3882
- vertical: "top",
3883
- horizontal: "center"
3884
- },
3885
- onClose: handlePopoverClose,
3886
- disableRestoreFocus: true,
3887
- disableAutoFocus: true,
3888
- disableEnforceFocus: true,
3889
- sx: {
3890
- pointerEvents: "none",
3891
- mt: 1
3892
- },
3893
- slotProps: {
3894
- paper: {
3895
- sx: {
3896
- p: 1.5,
3897
- borderRadius: 2,
3898
- boxShadow: 3
3899
- }
3900
- }
3901
- },
3902
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_material16.Box, { sx: { display: "flex", flexDirection: "column", alignItems: "center", gap: 0.5 }, children: [
3903
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material16.Typography, { variant: "subtitle2", sx: { fontWeight: 600 }, children: userProfile?.display_name }),
3904
- userProfile?.email && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material16.Typography, { variant: "caption", color: "text.secondary", children: userProfile.email })
3905
- ] })
3671
+ open: isDialogOpen,
3672
+ onClose: () => setIsDialogOpen(false),
3673
+ translationKey: placeholderKey,
3674
+ namespace,
3675
+ onSave: handleSaveTranslations
3906
3676
  }
3907
3677
  )
3908
3678
  ] });
3909
3679
  };
3910
3680
 
3911
- // src/i18n/LanguageSelector.tsx
3912
- var import_react24 = require("react");
3913
- var import_react_i18next5 = require("react-i18next");
3914
- var import_material17 = require("@mui/material");
3915
- init_LocalizationProvider();
3916
- init_UserSettingsProvider();
3917
- init_SupabaseProvider();
3918
- var import_jsx_runtime27 = require("react/jsx-runtime");
3919
- var LanguageSelector = () => {
3920
- const supabase = useSupabase();
3921
- const { i18n: i18n2 } = (0, import_react_i18next5.useTranslation)();
3922
- const [languages, setLanguages] = (0, import_react24.useState)([]);
3923
- const [loading, setLoading] = (0, import_react24.useState)(true);
3924
- const { changeLanguage } = useLocalization();
3925
- const { settings: userSettings, setLanguage } = useUserSettings();
3926
- const [anchorEl, setAnchorEl] = (0, import_react24.useState)(null);
3927
- const open = Boolean(anchorEl);
3928
- (0, import_react24.useEffect)(() => {
3929
- const fetchLanguages = async () => {
3930
- try {
3931
- const { data, error } = await supabase.from("languages").select("code, name, svg_flag").eq("enabled", true);
3932
- if (error) throw error;
3933
- setLanguages(data || []);
3934
- if (userSettings.language) changeLanguage(userSettings.language);
3935
- } catch (err) {
3936
- console.error("\u041F\u043E\u043C\u0438\u043B\u043A\u0430 \u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F \u043C\u043E\u0432:", err);
3937
- } finally {
3938
- setLoading(false);
3681
+ // src/UI/components/inputs/SelectComponent.tsx
3682
+ var import_material11 = require("@mui/material");
3683
+ var import_Close = __toESM(require("@mui/icons-material/Close"));
3684
+ init_context();
3685
+ var import_jsx_runtime21 = require("react/jsx-runtime");
3686
+ var SelectComponent = ({
3687
+ overrideNamespace,
3688
+ label,
3689
+ value,
3690
+ options,
3691
+ onChange,
3692
+ id = "translated-select",
3693
+ fullWidth,
3694
+ size = "medium",
3695
+ multiple = false,
3696
+ withCheckboxes = false,
3697
+ clearable = true,
3698
+ maxSelect,
3699
+ disabled,
3700
+ maxDisplayedTags = 2,
3701
+ helperText,
3702
+ defaultValueOnClear,
3703
+ sx,
3704
+ ...restProps
3705
+ }) => {
3706
+ const labelId = `${id}-label`;
3707
+ const safeValue = multiple ? Array.isArray(value) ? value : [] : value ?? "";
3708
+ const selectedArray = multiple ? safeValue : [];
3709
+ const isLimitReached = Boolean(multiple && maxSelect && selectedArray.length >= maxSelect);
3710
+ const hasValue = multiple ? selectedArray.length > 0 : safeValue !== "" && safeValue !== null && safeValue !== void 0;
3711
+ const handleChange = (event, child) => {
3712
+ if (multiple && maxSelect) {
3713
+ const newValue = event.target.value;
3714
+ if (newValue.length > maxSelect) {
3715
+ return;
3939
3716
  }
3940
- };
3941
- fetchLanguages();
3942
- }, []);
3943
- const handleClick = (event) => {
3944
- setAnchorEl(event.currentTarget);
3945
- };
3946
- const handleClose = () => {
3947
- setAnchorEl(null);
3717
+ }
3718
+ onChange?.(event, child);
3948
3719
  };
3949
- const handleSelectLanguage = (langCode) => {
3950
- changeLanguage(langCode);
3951
- setLanguage(langCode);
3952
- handleClose();
3720
+ const handleClear = (e) => {
3721
+ e.stopPropagation();
3722
+ if (!onChange) return;
3723
+ const emptyValue = multiple ? [] : "";
3724
+ const targetValue = defaultValueOnClear !== void 0 ? defaultValueOnClear : emptyValue;
3725
+ const syntheticEvent = {
3726
+ target: {
3727
+ value: targetValue,
3728
+ name: restProps.name
3729
+ }
3730
+ };
3731
+ onChange(syntheticEvent, null);
3953
3732
  };
3954
- if (loading) {
3955
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material17.CircularProgress, { size: 20, color: "inherit", sx: { mx: 1 } });
3956
- }
3957
- const rawCurrentLang = i18n2.language || "uk";
3958
- const currentLangCode = rawCurrentLang.split("-")[0];
3959
- const currentLang = languages.find((l) => l.code === currentLangCode) || languages[0];
3960
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
3961
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material17.Tooltip, { title: currentLang ? currentLang.name : "\u041C\u043E\u0432\u0430", arrow: true, placement: "bottom", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3962
- import_material17.IconButton,
3963
- {
3964
- onClick: handleClick,
3965
- size: "small",
3966
- "aria-controls": open ? "language-menu" : void 0,
3967
- "aria-haspopup": "true",
3968
- "aria-expanded": open ? "true" : void 0,
3969
- sx: {
3970
- p: 1,
3971
- borderRadius: 2,
3972
- transition: "background-color 0.2s",
3973
- "&:hover": {
3974
- backgroundColor: "action.hover"
3975
- }
3976
- },
3977
- children: currentLang?.svg_flag && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3978
- import_material17.Box,
3979
- {
3980
- sx: {
3981
- width: 24,
3982
- height: 16,
3983
- borderRadius: "3px",
3984
- overflow: "hidden",
3985
- flexShrink: 0,
3986
- boxShadow: "0 0 2px rgba(0,0,0,0.3)",
3987
- display: "flex",
3988
- alignItems: "center",
3989
- justifyContent: "center",
3990
- "& svg": { width: "100%", height: "100%", display: "block", objectFit: "cover" }
3991
- },
3992
- dangerouslySetInnerHTML: { __html: currentLang.svg_flag }
3993
- }
3994
- )
3995
- }
3996
- ) }),
3997
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3998
- import_material17.Menu,
3999
- {
4000
- id: "language-menu",
4001
- anchorEl,
4002
- open,
4003
- onClose: handleClose,
4004
- slotProps: {
4005
- paper: {
4006
- elevation: 3,
4007
- sx: {
4008
- mt: 1,
4009
- minWidth: 150,
4010
- borderRadius: 2
4011
- }
4012
- }
4013
- },
4014
- transformOrigin: { horizontal: "right", vertical: "top" },
4015
- anchorOrigin: { horizontal: "right", vertical: "bottom" },
4016
- children: languages.map((lang) => {
4017
- const isSelected = lang.code === currentLangCode;
4018
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
4019
- import_material17.MenuItem,
4020
- {
4021
- selected: isSelected,
4022
- onClick: () => handleSelectLanguage(lang.code),
4023
- sx: {
4024
- display: "flex",
4025
- alignItems: "center",
4026
- gap: 1.5,
4027
- py: 1,
4028
- px: 2
4029
- },
4030
- children: [
4031
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4032
- import_material17.Box,
4033
- {
4034
- sx: {
4035
- width: 22,
4036
- height: 15,
4037
- borderRadius: "2px",
4038
- overflow: "hidden",
4039
- flexShrink: 0,
4040
- boxShadow: "0 0 1px rgba(0,0,0,0.4)",
4041
- "& svg": { width: "100%", height: "100%", display: "block" }
4042
- },
4043
- dangerouslySetInnerHTML: { __html: lang.svg_flag }
4044
- }
4045
- ),
4046
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material17.Typography, { variant: "body2", sx: { fontWeight: isSelected ? 600 : 400 }, children: lang.name })
4047
- ]
4048
- },
4049
- lang.code
4050
- );
4051
- })
4052
- }
4053
- )
4054
- ] });
4055
- };
4056
- var PublicLanguageSelector = () => {
4057
- const supabase = useSupabase();
4058
- const { i18n: i18n2 } = (0, import_react_i18next5.useTranslation)();
4059
- const { changeLanguage } = useLocalization();
4060
- const [languages, setLanguages] = (0, import_react24.useState)([]);
4061
- const [loading, setLoading] = (0, import_react24.useState)(true);
4062
- const [anchorEl, setAnchorEl] = (0, import_react24.useState)(null);
4063
- const open = Boolean(anchorEl);
4064
- (0, import_react24.useEffect)(() => {
4065
- const fetchLanguages = async () => {
4066
- try {
4067
- const { data, error } = await supabase.from("languages").select("code, name, svg_flag").eq("enabled", true);
4068
- if (error) throw error;
4069
- setLanguages(data || []);
4070
- } catch (err) {
4071
- console.error("\u041F\u043E\u043C\u0438\u043B\u043A\u0430 \u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F \u043C\u043E\u0432:", err);
4072
- } finally {
4073
- setLoading(false);
4074
- }
4075
- };
4076
- fetchLanguages();
4077
- }, []);
4078
- const handleClick = (event) => {
4079
- setAnchorEl(event.currentTarget);
4080
- };
4081
- const handleClose = () => {
4082
- setAnchorEl(null);
4083
- };
4084
- const handleSelectLanguage = (langCode) => {
4085
- changeLanguage(langCode);
4086
- handleClose();
3733
+ const renderValueHandler = (selected) => {
3734
+ if (!multiple) return void 0;
3735
+ const currentSelected = selected;
3736
+ if (currentSelected.length === 0) return null;
3737
+ const selectedOptions = options.filter((opt) => currentSelected.includes(opt.value));
3738
+ const visibleLabels = selectedOptions.slice(0, maxDisplayedTags).map((opt) => typeof opt.label === "string" ? opt.label : String(opt.value));
3739
+ const hiddenCount = selectedOptions.length - maxDisplayedTags;
3740
+ if (hiddenCount > 0) {
3741
+ return `${visibleLabels.join(", ")} (+${hiddenCount})`;
3742
+ }
3743
+ return visibleLabels.join(", ");
4087
3744
  };
4088
- if (loading) {
4089
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material17.CircularProgress, { size: 20, color: "inherit", sx: { mx: 1 } });
4090
- }
4091
- const rawCurrentLang = i18n2.language || "uk";
4092
- const currentLangCode = rawCurrentLang.split("-")[0];
4093
- const currentLang = languages.find((l) => l.code === currentLangCode) || languages[0];
4094
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
4095
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material17.Tooltip, { title: currentLang ? currentLang.name : "\u041C\u043E\u0432\u0430", arrow: true, placement: "bottom", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4096
- import_material17.IconButton,
4097
- {
4098
- onClick: handleClick,
4099
- size: "small",
4100
- "aria-controls": open ? "language-menu" : void 0,
4101
- "aria-haspopup": "true",
4102
- "aria-expanded": open ? "true" : void 0,
4103
- sx: {
4104
- p: 1,
4105
- borderRadius: 2,
4106
- transition: "background-color 0.2s",
4107
- "&:hover": {
4108
- backgroundColor: "action.hover"
4109
- }
4110
- },
4111
- children: currentLang?.svg_flag && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4112
- import_material17.Box,
3745
+ const isSmall = size === "small";
3746
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3747
+ import_material11.Tooltip,
3748
+ {
3749
+ title: multiple ? Array.isArray(value) ? options.filter((opt) => value.includes(opt.value)).map((opt) => typeof opt.label === "string" ? opt.label : String(opt.value)).join(", ") : "" : options.find((opt) => opt.value === value)?.label ?? String(value ?? ""),
3750
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material11.FormControl, { fullWidth, size, sx: { mt: 1 }, children: [
3751
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material11.InputLabel, { id: labelId, size: isSmall ? "small" : "medium", children: typeof label === "string" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranslateText, { overrideNamespace, children: label }) : label }),
3752
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3753
+ import_material11.Select,
4113
3754
  {
3755
+ labelId,
3756
+ id,
3757
+ value: safeValue,
3758
+ label: typeof label === "string" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TranslateText, { overrideNamespace, children: label }) : label,
3759
+ size,
3760
+ multiple,
3761
+ disabled,
3762
+ onChange: handleChange,
3763
+ renderValue: multiple ? renderValueHandler : void 0,
3764
+ ...restProps,
3765
+ endAdornment: clearable && hasValue && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material11.InputAdornment, { position: "end", sx: { mr: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3766
+ import_material11.IconButton,
3767
+ {
3768
+ size: "small",
3769
+ onClick: handleClear,
3770
+ "aria-label": "clear selection",
3771
+ edge: "end",
3772
+ sx: { p: 0.5 },
3773
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_Close.default, { fontSize: "small" })
3774
+ }
3775
+ ) }) : null,
4114
3776
  sx: {
4115
- width: 24,
4116
- height: 16,
4117
- borderRadius: "3px",
4118
- overflow: "hidden",
4119
- flexShrink: 0,
4120
- boxShadow: "0 0 2px rgba(0,0,0,0.3)",
4121
- display: "flex",
4122
- alignItems: "center",
4123
- justifyContent: "center",
4124
- "& svg": { width: "100%", height: "100%", display: "block", objectFit: "cover" }
4125
- },
4126
- dangerouslySetInnerHTML: { __html: currentLang.svg_flag }
4127
- }
4128
- )
4129
- }
4130
- ) }),
4131
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4132
- import_material17.Menu,
4133
- {
4134
- id: "language-menu",
4135
- anchorEl,
4136
- open,
4137
- onClose: handleClose,
4138
- slotProps: {
4139
- paper: {
4140
- elevation: 3,
4141
- sx: {
4142
- mt: 1,
4143
- minWidth: 150,
4144
- borderRadius: 2
4145
- }
4146
- }
4147
- },
4148
- transformOrigin: { horizontal: "right", vertical: "top" },
4149
- anchorOrigin: { horizontal: "right", vertical: "bottom" },
4150
- children: languages.map((lang) => {
4151
- const isSelected = lang.code === currentLangCode;
4152
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
4153
- import_material17.MenuItem,
4154
- {
4155
- selected: isSelected,
4156
- onClick: () => handleSelectLanguage(lang.code),
4157
- sx: {
3777
+ // 1. Задаем фиксированную высоту для всего контейнера инпута
3778
+ height: isSmall ? "40px" : "56px",
3779
+ minHeight: isSmall ? "40px" : "56px",
3780
+ // 2. Выравниваем внутренний класс текстового поля
3781
+ "& .MuiSelect-select": {
4158
3782
  display: "flex",
4159
3783
  alignItems: "center",
4160
- gap: 1.5,
4161
- py: 1,
4162
- px: 2
3784
+ boxSizing: "border-box",
3785
+ height: "100%",
3786
+ minHeight: "100% !important",
3787
+ py: 0,
3788
+ lineHeight: "normal",
3789
+ overflow: "hidden",
3790
+ textOverflow: "ellipsis",
3791
+ whiteSpace: "nowrap",
3792
+ paddingRight: clearable && hasValue ? "64px !important" : "32px !important"
4163
3793
  },
4164
- children: [
4165
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4166
- import_material17.Box,
4167
- {
4168
- sx: {
4169
- width: 22,
4170
- height: 15,
4171
- borderRadius: "2px",
4172
- overflow: "hidden",
4173
- flexShrink: 0,
4174
- boxShadow: "0 0 1px rgba(0,0,0,0.4)",
4175
- "& svg": { width: "100%", height: "100%", display: "block" }
4176
- },
4177
- dangerouslySetInnerHTML: { __html: lang.svg_flag }
4178
- }
4179
- ),
4180
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material17.Typography, { variant: "body2", sx: { fontWeight: isSelected ? 600 : 400 }, children: lang.name })
4181
- ]
3794
+ // 3. Корректируем иконку стрелки выпадающего списка
3795
+ "& .MuiSelect-icon": {
3796
+ top: "calc(50% - 12px)"
3797
+ },
3798
+ // 4. Корректируем расположение иконки очистки
3799
+ "& .MuiInputAdornment-root": {
3800
+ maxHeight: "100%",
3801
+ height: "100%",
3802
+ alignItems: "center"
3803
+ },
3804
+ ...sx
4182
3805
  },
4183
- lang.code
4184
- );
4185
- })
4186
- }
4187
- )
4188
- ] });
3806
+ children: options.map((option) => {
3807
+ const isSelected = multiple && selectedArray.includes(option.value);
3808
+ const isDisabled = Boolean(isLimitReached && !isSelected);
3809
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3810
+ import_material11.MenuItem,
3811
+ {
3812
+ value: option.value,
3813
+ disabled: isDisabled,
3814
+ children: [
3815
+ multiple && withCheckboxes && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material11.Checkbox, { checked: isSelected, size, disabled: isDisabled }),
3816
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3817
+ import_material11.ListItemText,
3818
+ {
3819
+ primary: option.isItalic ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("em", { children: option.label }) : option.label
3820
+ }
3821
+ )
3822
+ ]
3823
+ },
3824
+ String(option.value)
3825
+ );
3826
+ })
3827
+ }
3828
+ ),
3829
+ helperText && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material11.FormHelperText, { children: helperText })
3830
+ ] })
3831
+ }
3832
+ );
4189
3833
  };
4190
3834
 
4191
- // src/UI/components/inputs/SearchComponent.tsx
4192
- var import_react26 = require("react");
4193
- var import_react_i18next6 = require("react-i18next");
4194
- var import_material18 = require("@mui/material");
4195
- var import_Translate4 = __toESM(require("@mui/icons-material/Translate"));
4196
- var import_Clear2 = __toESM(require("@mui/icons-material/Clear"));
4197
- init_context();
4198
- init_translation_service();
4199
- init_TranslationDialog();
4200
- init_TranslatableTooltipComponent();
4201
-
4202
- // src/hooks/useDebounce.ts
4203
- var import_react25 = require("react");
4204
- function useDebounce(value, delay = 500) {
4205
- const [debouncedValue, setDebouncedValue] = (0, import_react25.useState)(value);
4206
- (0, import_react25.useEffect)(() => {
4207
- const timer = setTimeout(() => {
4208
- setDebouncedValue(value);
4209
- }, delay);
4210
- return () => {
4211
- clearTimeout(timer);
4212
- };
4213
- }, [value, delay]);
4214
- return debouncedValue;
4215
- }
4216
-
4217
- // src/UI/components/inputs/SearchComponent.tsx
4218
- var import_jsx_runtime28 = require("react/jsx-runtime");
4219
- var SearchComponent = ({
4220
- overrideNamespace,
4221
- label = "",
4222
- value = "",
3835
+ // src/UI/components/inputs/CheckboxComponent.tsx
3836
+ var import_material12 = require("@mui/material");
3837
+ init_TranslateText();
3838
+ var import_jsx_runtime22 = require("react/jsx-runtime");
3839
+ var CheckboxComponent = ({
3840
+ checked = false,
4223
3841
  onChange,
4224
- onClear,
4225
- placeholderKey,
4226
- clearTooltip = "Clear",
4227
- debounceDelay = 500,
4228
- onDebounceChange,
4229
- slotProps,
4230
- ...restProps
3842
+ label,
3843
+ checkedLabel,
3844
+ uncheckedLabel,
3845
+ overrideNamespace,
3846
+ checkboxProps,
3847
+ ...props
4231
3848
  }) => {
4232
- const supabase = useSupabase();
4233
- const namespace = useTranslationNamespace();
4234
- const { t, i18n: i18n2 } = (0, import_react_i18next6.useTranslation)(namespace);
4235
- const { isTranslationMode } = useTranslationEdit();
4236
- const [isDialogOpen, setIsDialogOpen] = (0, import_react26.useState)(false);
4237
- const [localValue, setLocalValue] = (0, import_react26.useState)(String(value ?? ""));
4238
- const debouncedValue = useDebounce(localValue, debounceDelay);
4239
- (0, import_react26.useEffect)(() => {
4240
- setLocalValue(String(value ?? ""));
4241
- }, [value]);
4242
- (0, import_react26.useEffect)(() => {
4243
- if (onDebounceChange) {
4244
- onDebounceChange(debouncedValue);
4245
- }
4246
- if (onChange && debouncedValue !== String(value ?? "")) {
4247
- const syntheticEvent = {
4248
- target: { value: debouncedValue },
4249
- currentTarget: { value: debouncedValue }
4250
- };
4251
- onChange(syntheticEvent);
3849
+ const currentLabel = label ?? (checked ? checkedLabel : uncheckedLabel);
3850
+ const renderLabel = (node) => {
3851
+ if (typeof node === "string") {
3852
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TranslateText, { overrideNamespace, children: node });
4252
3853
  }
4253
- }, [debouncedValue]);
4254
- const hasValue = localValue.length > 0;
4255
- const handleChange = (e) => {
4256
- setLocalValue(e.target.value);
3854
+ return node;
4257
3855
  };
4258
- const handleClear = (e) => {
4259
- e.stopPropagation();
4260
- setLocalValue("");
4261
- if (onClear) {
4262
- onClear();
4263
- }
4264
- if (onChange) {
4265
- const syntheticEvent = {
4266
- ...e,
4267
- target: { ...e.target, value: "" },
4268
- currentTarget: { ...e.currentTarget, value: "" }
4269
- };
4270
- onChange(syntheticEvent);
3856
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material12.Box, { sx: { display: "inline-flex", alignItems: "center", gap: 0.5 }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3857
+ import_material12.FormControlLabel,
3858
+ {
3859
+ control: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3860
+ import_material12.Checkbox,
3861
+ {
3862
+ checked,
3863
+ onChange,
3864
+ ...checkboxProps
3865
+ }
3866
+ ),
3867
+ label: renderLabel(currentLabel),
3868
+ ...props
4271
3869
  }
4272
- };
4273
- const translatedPlaceholder = placeholderKey ? t(placeholderKey) : void 0;
4274
- const handleSaveTranslations = async (newValues, contextHint) => {
4275
- if (!placeholderKey) return;
4276
- const upsertData = Object.entries(newValues).map(([langCode, text]) => ({
4277
- lang_code: langCode,
4278
- namespace,
4279
- key: placeholderKey,
4280
- value: text,
4281
- context_hint: contextHint
4282
- }));
4283
- const { error } = await supabase.from("translations").upsert(upsertData, { onConflict: "lang_code,namespace,key" });
4284
- if (error) {
4285
- alert("\u041F\u043E\u043C\u0438\u043B\u043A\u0430 \u043F\u0456\u0434 \u0447\u0430\u0441 \u0437\u0431\u0435\u0440\u0435\u0436\u0435\u043D\u043D\u044F \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043D\u0438\u0445");
4286
- throw error;
3870
+ ) });
3871
+ };
3872
+
3873
+ // src/UI/components/inputs/SwitchComponent.tsx
3874
+ var import_material13 = require("@mui/material");
3875
+ init_TranslateText();
3876
+ var import_jsx_runtime23 = require("react/jsx-runtime");
3877
+ var SwitchComponent = ({
3878
+ checked = false,
3879
+ onChange,
3880
+ label,
3881
+ checkedLabel,
3882
+ uncheckedLabel,
3883
+ overrideNamespace,
3884
+ switchProps,
3885
+ ...props
3886
+ }) => {
3887
+ const currentLabel = label ?? (checked ? checkedLabel : uncheckedLabel);
3888
+ const renderLabel = (node) => {
3889
+ if (typeof node === "string") {
3890
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TranslateText, { overrideNamespace, children: node });
4287
3891
  }
4288
- await translationService.incrementVersion(supabase, namespace, Object.keys(newValues));
4289
- Object.entries(newValues).forEach(([langCode, text]) => {
4290
- i18n2.addResource(langCode, namespace, placeholderKey, text);
4291
- });
3892
+ return node;
4292
3893
  };
4293
- const renderEndAdornment = () => {
4294
- const rawInputProps = slotProps?.input;
4295
- const isInputObject = typeof rawInputProps === "object" && rawInputProps !== null;
4296
- const existingEndAdornment = isInputObject && "endAdornment" in rawInputProps ? rawInputProps.endAdornment : void 0;
4297
- if (!hasValue && (!isTranslationMode || !placeholderKey)) {
4298
- return existingEndAdornment;
3894
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material13.Box, { sx: { display: "inline-flex", alignItems: "center", gap: 0.5 }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3895
+ import_material13.FormControlLabel,
3896
+ {
3897
+ control: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3898
+ import_material13.Switch,
3899
+ {
3900
+ checked,
3901
+ onChange,
3902
+ ...switchProps
3903
+ }
3904
+ ),
3905
+ label: renderLabel(currentLabel),
3906
+ ...props
4299
3907
  }
4300
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
4301
- existingEndAdornment,
4302
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_material18.InputAdornment, { position: "end", children: [
4303
- hasValue && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TranslateText, { overrideNamespace, children: clearTooltip }), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4304
- import_material18.IconButton,
4305
- {
4306
- size: "small",
4307
- onClick: handleClear,
4308
- edge: "end",
4309
- "aria-label": "clear input",
4310
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_Clear2.default, { fontSize: "small" })
4311
- }
4312
- ) }),
4313
- isTranslationMode && placeholderKey && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material18.Tooltip, { title: `Translate placeholder: "${placeholderKey}"`, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4314
- import_material18.IconButton,
4315
- {
4316
- size: "small",
4317
- onClick: (e) => {
4318
- e.preventDefault();
4319
- e.stopPropagation();
4320
- setIsDialogOpen(true);
4321
- },
4322
- sx: {
4323
- color: "#d97706",
4324
- backgroundColor: "rgba(254, 243, 199, 0.6)",
4325
- border: "1px dashed #f59e0b",
4326
- p: "3px",
4327
- ml: 0.5,
4328
- "&:hover": {
4329
- backgroundColor: "#fef08a"
4330
- }
4331
- },
4332
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_Translate4.default, { fontSize: "small" })
4333
- }
4334
- ) })
4335
- ] })
4336
- ] });
3908
+ ) });
3909
+ };
3910
+
3911
+ // src/UI/components/inputs/UrlComponent.tsx
3912
+ var import_react21 = require("react");
3913
+ var import_material14 = require("@mui/material");
3914
+ var import_Link = __toESM(require("@mui/icons-material/Link"));
3915
+ var import_Launch2 = __toESM(require("@mui/icons-material/Launch"));
3916
+ var import_ContentCopy2 = __toESM(require("@mui/icons-material/ContentCopy"));
3917
+ var import_Check2 = __toESM(require("@mui/icons-material/Check"));
3918
+ var import_EditNote = __toESM(require("@mui/icons-material/EditNote"));
3919
+ var import_Lock2 = __toESM(require("@mui/icons-material/Lock"));
3920
+ init_TranslateText();
3921
+ var import_jsx_runtime24 = require("react/jsx-runtime");
3922
+ function UrlComponent({
3923
+ overrideNamespace,
3924
+ label,
3925
+ value,
3926
+ onChange,
3927
+ disabled = false,
3928
+ readOnly = false,
3929
+ required = false,
3930
+ error = false,
3931
+ helperText = "",
3932
+ description = "",
3933
+ fullWidth = true,
3934
+ openInNewTab = true,
3935
+ showLock = true,
3936
+ lockTooltip = "Field is not editable",
3937
+ sx
3938
+ }) {
3939
+ const [copied, setCopied] = (0, import_react21.useState)(false);
3940
+ const [anchorEl, setAnchorEl] = (0, import_react21.useState)(null);
3941
+ const isViewMode = disabled || readOnly;
3942
+ const currentUrl = typeof value === "object" && value !== null ? value.url || "" : value || "";
3943
+ const currentTitle = typeof value === "object" && value !== null ? value.title || "" : "";
3944
+ const getFormattedUrl = (val) => {
3945
+ if (!val) return "";
3946
+ const trimmed = val.trim();
3947
+ if (trimmed.match(/^[a-zA-Z]+:\/\//)) {
3948
+ return trimmed;
3949
+ }
3950
+ return `https://${trimmed}`;
3951
+ };
3952
+ const finalUrl = getFormattedUrl(currentUrl);
3953
+ const targetAttribute = openInNewTab ? "_blank" : "_self";
3954
+ const displayLabelText = currentTitle.trim() || currentUrl;
3955
+ const handleUrlChange = (newUrl) => {
3956
+ onChange?.({ url: newUrl, title: currentTitle });
3957
+ };
3958
+ const handleTitleChange = (newTitle) => {
3959
+ onChange?.({ url: currentUrl, title: newTitle });
3960
+ };
3961
+ const handleCopy = (e) => {
3962
+ e.stopPropagation();
3963
+ if (!finalUrl) return;
3964
+ navigator.clipboard.writeText(finalUrl);
3965
+ setCopied(true);
3966
+ setTimeout(() => setCopied(false), 2e3);
4337
3967
  };
4338
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
4339
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4340
- import_material18.TextField,
3968
+ const handleOpenLink = (e) => {
3969
+ e.stopPropagation();
3970
+ if (finalUrl) {
3971
+ window.open(finalUrl, targetAttribute, openInNewTab ? "noopener,noreferrer" : void 0);
3972
+ }
3973
+ };
3974
+ const handleInputClick = (e) => {
3975
+ if (isViewMode && finalUrl) {
3976
+ handleOpenLink(e);
3977
+ }
3978
+ };
3979
+ const handleOpenTitleMenu = (e) => {
3980
+ e.stopPropagation();
3981
+ setAnchorEl(e.currentTarget);
3982
+ };
3983
+ const handleCloseTitleMenu = () => {
3984
+ setAnchorEl(null);
3985
+ };
3986
+ const isTitlePopoverOpen = Boolean(anchorEl);
3987
+ const displayHelperText = error ? helperText : description || helperText;
3988
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
3989
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3990
+ import_material14.TextField,
4341
3991
  {
4342
- ...restProps,
4343
- label: typeof label === "string" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TranslateText, { overrideNamespace, children: label }) : label,
4344
- value: localValue,
4345
- onChange: handleChange,
4346
- placeholder: translatedPlaceholder,
3992
+ label: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace, children: label }),
3993
+ type: isViewMode ? "text" : "url",
3994
+ value: isViewMode ? displayLabelText : currentUrl,
3995
+ onChange: (e) => handleUrlChange(e.target.value),
3996
+ required,
3997
+ error,
3998
+ disabled,
3999
+ margin: "dense",
4000
+ helperText: displayHelperText,
4001
+ fullWidth,
4002
+ placeholder: "example.com",
4003
+ sx: {
4004
+ "& .MuiInputLabel-asterisk": {
4005
+ color: "red",
4006
+ fontSize: "1.5rem"
4007
+ },
4008
+ "& .MuiInputBase-input": {
4009
+ color: isViewMode && finalUrl ? "primary.main" : void 0,
4010
+ textDecoration: isViewMode && finalUrl ? "underline" : "none",
4011
+ cursor: isViewMode && finalUrl ? "pointer" : void 0,
4012
+ fontWeight: isViewMode && finalUrl ? 500 : void 0
4013
+ },
4014
+ ...sx
4015
+ },
4347
4016
  slotProps: {
4348
- ...slotProps,
4017
+ htmlInput: {
4018
+ readOnly,
4019
+ onClick: handleInputClick
4020
+ },
4349
4021
  input: {
4350
- ...slotProps?.input,
4351
- endAdornment: renderEndAdornment()
4022
+ startAdornment: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.InputAdornment, { position: "start", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_Link.default, { fontSize: "small", color: isViewMode && finalUrl ? "primary" : "action" }) }),
4023
+ endAdornment: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.InputAdornment, { position: "end", sx: { gap: 0.5 }, children: [
4024
+ !isViewMode && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Tooltip, { title: currentTitle ? `Title: "${currentTitle}"` : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Set link title" }), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4025
+ import_material14.IconButton,
4026
+ {
4027
+ size: "small",
4028
+ onClick: handleOpenTitleMenu,
4029
+ color: currentTitle ? "primary" : "default",
4030
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_EditNote.default, { fontSize: "small" })
4031
+ }
4032
+ ) }),
4033
+ finalUrl && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Tooltip, { title: copied ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Copied!" }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Copy link" }), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.IconButton, { size: "small", onClick: handleCopy, color: copied ? "success" : "default", children: copied ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_Check2.default, { fontSize: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_ContentCopy2.default, { fontSize: "small" }) }) }),
4034
+ isViewMode && showLock && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Tooltip, { title: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace, children: lockTooltip }), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4035
+ import_material14.IconButton,
4036
+ {
4037
+ size: "small",
4038
+ disabled: true,
4039
+ edge: "end",
4040
+ "aria-label": "locked input",
4041
+ sx: {
4042
+ "&.Mui-disabled": {
4043
+ color: "text.secondary"
4044
+ }
4045
+ },
4046
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_Lock2.default, { fontSize: "small" })
4047
+ }
4048
+ ) }),
4049
+ finalUrl && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Tooltip, { title: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Open link" }), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.IconButton, { size: "small", onClick: handleOpenLink, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_Launch2.default, { fontSize: "small", color: isViewMode ? "primary" : "action" }) }) })
4050
+ ] })
4352
4051
  }
4353
4052
  }
4354
4053
  }
4355
4054
  ),
4356
- placeholderKey && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4357
- TranslationDialog,
4055
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
4056
+ import_material14.Popover,
4358
4057
  {
4359
- open: isDialogOpen,
4360
- onClose: () => setIsDialogOpen(false),
4361
- translationKey: placeholderKey,
4362
- namespace,
4363
- onSave: handleSaveTranslations
4058
+ open: isTitlePopoverOpen,
4059
+ anchorEl,
4060
+ onClose: handleCloseTitleMenu,
4061
+ anchorOrigin: {
4062
+ vertical: "bottom",
4063
+ horizontal: "right"
4064
+ },
4065
+ transformOrigin: {
4066
+ vertical: "top",
4067
+ horizontal: "right"
4068
+ },
4069
+ slotProps: {
4070
+ paper: { sx: { p: 2, width: 280 } }
4071
+ },
4072
+ children: [
4073
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Typography, { variant: "subtitle2", sx: { mb: 1, fontWeight: "bold" }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Link Title (Anchor)" }) }),
4074
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material14.Typography, { variant: "caption", color: "text.secondary", sx: { mb: 1.5, display: "block" }, children: [
4075
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Specify the text to display instead of the URL address" }),
4076
+ ":"
4077
+ ] }),
4078
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4079
+ import_material14.TextField,
4080
+ {
4081
+ size: "small",
4082
+ fullWidth: true,
4083
+ placeholder: "e.g. Instruction",
4084
+ value: currentTitle,
4085
+ onChange: (e) => handleTitleChange(e.target.value),
4086
+ autoFocus: true,
4087
+ onKeyDown: (e) => {
4088
+ if (e.key === "Enter") {
4089
+ e.preventDefault();
4090
+ handleCloseTitleMenu();
4091
+ }
4092
+ }
4093
+ }
4094
+ ),
4095
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Box, { sx: { display: "flex", justifyContent: "flex-end", mt: 1.5 }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material14.Button, { size: "small", variant: "contained", onClick: handleCloseTitleMenu, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Done" }) }) })
4096
+ ]
4364
4097
  }
4365
4098
  )
4366
4099
  ] });
4367
- };
4100
+ }
4368
4101
 
4369
- // src/UI/components/inputs/SelectComponent.tsx
4370
- var import_material19 = require("@mui/material");
4371
- var import_Close = __toESM(require("@mui/icons-material/Close"));
4102
+ // src/UI/components/buttons/ButtonComponent.tsx
4103
+ var import_react22 = require("react");
4104
+ var import_material15 = require("@mui/material");
4372
4105
  init_context();
4373
- var import_jsx_runtime29 = require("react/jsx-runtime");
4374
- var SelectComponent = ({
4375
- overrideNamespace,
4376
- label,
4377
- value,
4378
- options,
4379
- onChange,
4380
- id = "translated-select",
4381
- fullWidth,
4382
- size = "medium",
4383
- multiple = false,
4384
- withCheckboxes = false,
4385
- clearable = true,
4386
- maxSelect,
4387
- disabled,
4388
- maxDisplayedTags = 2,
4389
- helperText,
4390
- defaultValueOnClear,
4391
- sx,
4392
- ...restProps
4393
- }) => {
4394
- const labelId = `${id}-label`;
4395
- const safeValue = multiple ? Array.isArray(value) ? value : [] : value ?? "";
4396
- const selectedArray = multiple ? safeValue : [];
4397
- const isLimitReached = Boolean(multiple && maxSelect && selectedArray.length >= maxSelect);
4398
- const hasValue = multiple ? selectedArray.length > 0 : safeValue !== "" && safeValue !== null && safeValue !== void 0;
4399
- const handleChange = (event, child) => {
4400
- if (multiple && maxSelect) {
4401
- const newValue = event.target.value;
4402
- if (newValue.length > maxSelect) {
4403
- return;
4404
- }
4405
- }
4406
- onChange?.(event, child);
4407
- };
4408
- const handleClear = (e) => {
4409
- e.stopPropagation();
4410
- if (!onChange) return;
4411
- const emptyValue = multiple ? [] : "";
4412
- const targetValue = defaultValueOnClear !== void 0 ? defaultValueOnClear : emptyValue;
4413
- const syntheticEvent = {
4414
- target: {
4415
- value: targetValue,
4416
- name: restProps.name
4106
+ var import_jsx_runtime25 = require("react/jsx-runtime");
4107
+ var ButtonComponent = (0, import_react22.forwardRef)(
4108
+ ({ label, children, overrideNamespace, ...props }, ref) => {
4109
+ const renderContent = (content) => {
4110
+ if (typeof content === "string") {
4111
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TranslateText, { overrideNamespace, children: content });
4417
4112
  }
4113
+ return content;
4418
4114
  };
4419
- onChange(syntheticEvent, null);
4420
- };
4421
- const renderValueHandler = (selected) => {
4422
- if (!multiple) return void 0;
4423
- const currentSelected = selected;
4424
- if (currentSelected.length === 0) return null;
4425
- const selectedOptions = options.filter((opt) => currentSelected.includes(opt.value));
4426
- const visibleLabels = selectedOptions.slice(0, maxDisplayedTags).map((opt) => typeof opt.label === "string" ? opt.label : String(opt.value));
4427
- const hiddenCount = selectedOptions.length - maxDisplayedTags;
4428
- if (hiddenCount > 0) {
4429
- return `${visibleLabels.join(", ")} (+${hiddenCount})`;
4430
- }
4431
- return visibleLabels.join(", ");
4432
- };
4433
- const isSmall = size === "small";
4434
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4435
- import_material19.Tooltip,
4436
- {
4437
- title: multiple ? Array.isArray(value) ? options.filter((opt) => value.includes(opt.value)).map((opt) => typeof opt.label === "string" ? opt.label : String(opt.value)).join(", ") : "" : options.find((opt) => opt.value === value)?.label ?? String(value ?? ""),
4438
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_material19.FormControl, { fullWidth, size, sx: { mt: 1 }, children: [
4439
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material19.InputLabel, { id: labelId, size: isSmall ? "small" : "medium", children: typeof label === "string" ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TranslateText, { overrideNamespace, children: label }) : label }),
4440
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4441
- import_material19.Select,
4442
- {
4443
- labelId,
4444
- id,
4445
- value: safeValue,
4446
- label: typeof label === "string" ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TranslateText, { overrideNamespace, children: label }) : label,
4447
- size,
4448
- multiple,
4449
- disabled,
4450
- onChange: handleChange,
4451
- renderValue: multiple ? renderValueHandler : void 0,
4452
- ...restProps,
4453
- endAdornment: clearable && hasValue && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material19.InputAdornment, { position: "end", sx: { mr: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4454
- import_material19.IconButton,
4455
- {
4456
- size: "small",
4457
- onClick: handleClear,
4458
- "aria-label": "clear selection",
4459
- edge: "end",
4460
- sx: { p: 0.5 },
4461
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_Close.default, { fontSize: "small" })
4462
- }
4463
- ) }) : null,
4464
- sx: {
4465
- // 1. Задаем фиксированную высоту для всего контейнера инпута
4466
- height: isSmall ? "40px" : "56px",
4467
- minHeight: isSmall ? "40px" : "56px",
4468
- // 2. Выравниваем внутренний класс текстового поля
4469
- "& .MuiSelect-select": {
4470
- display: "flex",
4471
- alignItems: "center",
4472
- boxSizing: "border-box",
4473
- height: "100%",
4474
- minHeight: "100% !important",
4475
- py: 0,
4476
- lineHeight: "normal",
4477
- overflow: "hidden",
4478
- textOverflow: "ellipsis",
4479
- whiteSpace: "nowrap",
4480
- paddingRight: clearable && hasValue ? "64px !important" : "32px !important"
4481
- },
4482
- // 3. Корректируем иконку стрелки выпадающего списка
4483
- "& .MuiSelect-icon": {
4484
- top: "calc(50% - 12px)"
4485
- },
4486
- // 4. Корректируем расположение иконки очистки
4487
- "& .MuiInputAdornment-root": {
4488
- maxHeight: "100%",
4489
- height: "100%",
4490
- alignItems: "center"
4491
- },
4492
- ...sx
4493
- },
4494
- children: options.map((option) => {
4495
- const isSelected = multiple && selectedArray.includes(option.value);
4496
- const isDisabled = Boolean(isLimitReached && !isSelected);
4497
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4498
- import_material19.MenuItem,
4499
- {
4500
- value: option.value,
4501
- disabled: isDisabled,
4502
- children: [
4503
- multiple && withCheckboxes && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material19.Checkbox, { checked: isSelected, size, disabled: isDisabled }),
4504
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4505
- import_material19.ListItemText,
4506
- {
4507
- primary: option.isItalic ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("em", { children: option.label }) : option.label
4508
- }
4509
- )
4510
- ]
4511
- },
4512
- String(option.value)
4513
- );
4514
- })
4515
- }
4516
- ),
4517
- helperText && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material19.FormHelperText, { children: helperText })
4518
- ] })
4519
- }
4520
- );
4521
- };
4115
+ const contentToRender = label !== void 0 ? label : children;
4116
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material15.Button, { ref, ...props, children: renderContent(contentToRender) });
4117
+ }
4118
+ );
4119
+ ButtonComponent.displayName = "ButtonComponent";
4522
4120
 
4523
- // src/UI/components/data.display/ExpandableNoteComponent.tsx
4524
- var import_react27 = require("react");
4525
- var import_material20 = require("@mui/material");
4121
+ // src/UI/index.ts
4122
+ init_CopyClipboardButtonComponent();
4123
+
4124
+ // src/UI/components/buttons/RefreshButtonComponent.tsx
4125
+ var import_react24 = require("react");
4126
+ var import_material17 = require("@mui/material");
4127
+ var import_Refresh = __toESM(require("@mui/icons-material/Refresh"));
4526
4128
  init_context();
4527
- var import_jsx_runtime30 = require("react/jsx-runtime");
4528
- var ExpandableNoteComponent = ({
4129
+ init_TranslatableTooltipComponent();
4130
+ var import_jsx_runtime27 = require("react/jsx-runtime");
4131
+ var AnimatedRefreshIcon = (0, import_material17.styled)(import_Refresh.default, {
4132
+ shouldForwardProp: (prop) => prop !== "isSpinning"
4133
+ })(({ isSpinning }) => ({
4134
+ animation: isSpinning ? "spin 1s linear infinite" : "none",
4135
+ "@keyframes spin": {
4136
+ "0%": {
4137
+ transform: "rotate(0deg)"
4138
+ },
4139
+ "100%": {
4140
+ transform: "rotate(360deg)"
4141
+ }
4142
+ }
4143
+ }));
4144
+ var RefreshButtonComponent = ({
4529
4145
  overrideNamespace,
4530
- text,
4531
- maxLength = 100,
4532
- label,
4533
- sx,
4534
- ...restProps
4146
+ size = "small",
4147
+ onClick,
4148
+ disabled = false,
4149
+ fullWidth = false,
4150
+ loading: externalLoading,
4151
+ tooltip,
4152
+ mobileViewOnly,
4153
+ disableMobileView,
4154
+ hideTooltipOnMobile,
4155
+ hideTooltipOnDesktop
4535
4156
  }) => {
4536
- const [isExpanded, setIsExpanded] = (0, import_react27.useState)(false);
4537
- if (!text) return null;
4538
- const isLong = text.length > maxLength;
4539
- const displayedText = isExpanded || !isLong ? text : `${text.slice(0, maxLength).trim()}...`;
4540
- const toggleExpand = (e) => {
4541
- e.stopPropagation();
4542
- setIsExpanded((prev) => !prev);
4157
+ const { displayState } = useAppTheme();
4158
+ const [internalLoading, setInternalLoading] = (0, import_react24.useState)(false);
4159
+ const isLoading = externalLoading !== void 0 ? externalLoading : internalLoading;
4160
+ const handleClick = async (event) => {
4161
+ if (!onClick || isLoading || disabled) return;
4162
+ try {
4163
+ setInternalLoading(true);
4164
+ await onClick(event);
4165
+ } finally {
4166
+ setInternalLoading(false);
4167
+ }
4543
4168
  };
4544
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
4545
- import_material20.Typography,
4169
+ const renderIcon = () => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(AnimatedRefreshIcon, { fontSize: size, isSpinning: isLoading });
4170
+ if (displayState.isMobile && !disableMobileView || mobileViewOnly) {
4171
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TranslatableTooltipComponent, { title: hideTooltipOnMobile ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, {}) : tooltip || /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Refresh" }), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4172
+ import_material17.Fab,
4173
+ {
4174
+ size,
4175
+ color: "inherit",
4176
+ onClick: handleClick,
4177
+ disabled: disabled || isLoading,
4178
+ "aria-label": "refresh",
4179
+ children: renderIcon()
4180
+ }
4181
+ ) }) });
4182
+ }
4183
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TranslatableTooltipComponent, { title: hideTooltipOnDesktop ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, {}) : tooltip || /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Refresh" }), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4184
+ import_material17.Button,
4546
4185
  {
4547
- variant: "caption",
4548
- sx: {
4549
- color: "text.secondary",
4550
- fontStyle: "italic",
4551
- display: "inline-block",
4552
- ...sx
4553
- },
4554
- ...restProps,
4555
- children: [
4556
- label !== void 0 ? label : /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
4557
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Note" }),
4558
- ": "
4559
- ] }),
4560
- " ",
4561
- displayedText,
4562
- " ",
4563
- isLong && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4564
- import_material20.Link,
4565
- {
4566
- component: "button",
4567
- type: "button",
4568
- variant: "caption",
4569
- underline: "hover",
4570
- onClick: toggleExpand,
4571
- sx: {
4572
- fontStyle: "normal",
4573
- fontWeight: "bold",
4574
- ml: 0.5,
4575
- cursor: "pointer",
4576
- verticalAlign: "baseline"
4577
- },
4578
- children: isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "less" }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
4579
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "more" }),
4580
- "..."
4581
- ] })
4582
- }
4583
- )
4584
- ]
4186
+ variant: "contained",
4187
+ color: "inherit",
4188
+ size,
4189
+ onClick: handleClick,
4190
+ disabled: disabled || isLoading,
4191
+ fullWidth,
4192
+ startIcon: renderIcon(),
4193
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Refresh" })
4585
4194
  }
4586
- );
4195
+ ) });
4587
4196
  };
4588
4197
 
4589
- // src/UI/widgets/page/PageLinkWidget.tsx
4590
- var import_icons_material3 = require("@mui/icons-material");
4198
+ // src/UI/index.ts
4199
+ init_TranslatableTooltipComponent();
4200
+
4201
+ // src/UI/components/data.display/UserAvatarComponent.tsx
4202
+ var import_react26 = require("react");
4591
4203
  var import_material21 = require("@mui/material");
4592
- var import_react28 = __toESM(require("react"));
4593
- var import_react_router_dom = require("react-router-dom");
4594
4204
  init_context();
4595
4205
  var import_jsx_runtime31 = require("react/jsx-runtime");
4596
- var PageLinkWidget = ({
4597
- overrideNamespace,
4598
- title,
4599
- subheader,
4600
- description,
4601
- icon,
4602
- links,
4603
- actionButtonText,
4604
- onActionButtonClick,
4605
- bgcolor
4606
- }) => {
4607
- const navigate = (0, import_react_router_dom.useNavigate)();
4608
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4609
- import_material21.Card,
4610
- {
4611
- sx: (theme) => ({
4612
- height: "100%",
4613
- display: "flex",
4614
- flexDirection: "column",
4615
- boxShadow: 3,
4616
- bgcolor,
4617
- color: bgcolor ? typeof bgcolor === "string" && bgcolor.includes(".") ? theme.palette.getContrastText(
4618
- bgcolor.split(".").reduce((acc, key) => acc[key], theme.palette)
4619
- ) : typeof bgcolor === "function" ? theme.palette.getContrastText(bgcolor(theme)) : theme.palette.getContrastText(bgcolor) : "text.primary"
4620
- }),
4621
- children: [
4622
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4623
- import_material21.CardHeader,
4624
- {
4625
- avatar: icon ? import_react28.default.cloneElement(icon, {
4626
- sx: { color: bgcolor ? "inherit" : "primary", ...icon.props.sx }
4627
- }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_icons_material3.Settings, { color: bgcolor ? "inherit" : "primary" }),
4628
- title: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material21.Typography, { variant: "h6", component: "div", color: "inherit", children: typeof title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TranslateText, { overrideNamespace, children: title }) : title }),
4629
- subheader: subheader && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material21.Typography, { variant: "body2", sx: { opacity: 0.8, color: "inherit" }, children: typeof subheader === "string" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TranslateText, { overrideNamespace, children: subheader }) : subheader })
4630
- }
4631
- ),
4632
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material21.Divider, { sx: { borderColor: "inherit", opacity: 0.2 } }),
4633
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_material21.CardContent, { sx: { flexGrow: 1 }, children: [
4634
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material21.Typography, { variant: "body2", sx: { opacity: 0.85, color: "inherit" }, children: typeof description === "string" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TranslateText, { overrideNamespace, children: description }) : description }),
4635
- links && links.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material21.List, { dense: true, disablePadding: true, children: links.filter((f) => !f.hidden).map((link, index) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4636
- import_material21.ListItem,
4637
- {
4638
- disablePadding: true,
4639
- sx: {
4640
- mt: 1,
4641
- // Запрещаем ListItem менять цвет фона при наведении
4642
- "&:hover": {
4643
- backgroundColor: "transparent"
4644
- }
4645
- },
4646
- children: [
4647
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4648
- import_material21.ListItemIcon,
4649
- {
4650
- sx: { minWidth: 30, cursor: "pointer", color: "inherit" },
4651
- onClick: () => {
4652
- if (link?.href) navigate(link.href);
4653
- },
4654
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_icons_material3.ArrowRight, { fontSize: "small", color: "inherit" })
4655
- }
4656
- ),
4657
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material21.ListItemText, { children: link.onClick ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4658
- import_material21.Button,
4659
- {
4660
- size: "small",
4661
- variant: "text",
4662
- color: bgcolor ? "inherit" : "primary",
4663
- onClick: link.onClick,
4664
- sx: {
4665
- fontWeight: 500,
4666
- textTransform: "none",
4667
- // Отключает автоматические заглавные буквы (UPPERCASE)
4668
- padding: 0,
4669
- minWidth: "auto",
4670
- justifyContent: "flex-start",
4671
- textAlign: "left",
4672
- transition: "opacity 0.2s ease-in-out",
4673
- "&:hover": {
4674
- opacity: 0.75,
4675
- backgroundColor: "transparent",
4676
- // Убирает стандартную серую подложку при ховере кнопки
4677
- textDecoration: "underline"
4678
- // Эффект подчеркивания, как у ссылки
4679
- }
4680
- },
4681
- children: typeof link.text === "string" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TranslateText, { overrideNamespace, children: link.text }) : link.text
4682
- }
4683
- ) : link.href ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4684
- import_material21.Link,
4685
- {
4686
- component: import_react_router_dom.Link,
4687
- to: link.href,
4688
- target: link.external ? "_blank" : "_self",
4689
- rel: link.external ? "noopener noreferrer" : "",
4690
- underline: "hover",
4691
- color: bgcolor ? "inherit" : "primary",
4692
- sx: {
4693
- fontWeight: 500,
4694
- display: "inline-block",
4695
- transition: "opacity 0.2s ease-in-out",
4696
- "&:hover": {
4697
- opacity: 0.75,
4698
- backgroundColor: "transparent"
4699
- }
4700
- },
4701
- children: typeof link.text === "string" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TranslateText, { overrideNamespace, children: link.text }) : link.text
4702
- }
4703
- ) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material21.Typography, { variant: "body2", sx: { fontWeight: 500, color: "inherit" }, children: typeof link.text === "string" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TranslateText, { overrideNamespace, children: link.text }) : link.text }) })
4704
- ]
4705
- },
4706
- index
4707
- )) })
4708
- ] }),
4709
- actionButtonText && onActionButtonClick && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material21.CardActions, { sx: { justifyContent: "flex-end", padding: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material21.Button, { size: "small", variant: "contained", onClick: onActionButtonClick, children: typeof actionButtonText === "string" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TranslateText, { overrideNamespace, children: actionButtonText }) : actionButtonText }) })
4710
- ]
4711
- }
4712
- );
4206
+ var LazyUserPopover = (0, import_react26.lazy)(() => Promise.resolve().then(() => (init_UserPopoverComponent(), UserPopoverComponent_exports)));
4207
+ var getInitials = (name) => {
4208
+ if (!name) return "?";
4209
+ const parts = name.trim().split(" ");
4210
+ if (parts.length >= 2) {
4211
+ return `${parts[0][0]}${parts[1][0]}`.toUpperCase();
4212
+ }
4213
+ return name[0].toUpperCase();
4713
4214
  };
4714
-
4715
- // src/UI/components/inputs/SwitchComponent.tsx
4716
- var import_material22 = require("@mui/material");
4717
- init_TranslateText();
4718
- var import_jsx_runtime32 = require("react/jsx-runtime");
4719
- var SwitchComponent = ({
4720
- checked = false,
4721
- onChange,
4722
- label,
4723
- checkedLabel,
4724
- uncheckedLabel,
4725
- overrideNamespace,
4726
- switchProps,
4727
- ...props
4215
+ var UserAvatarComponent = ({
4216
+ userId = "",
4217
+ avatarUrl = "",
4218
+ displayName = "",
4219
+ employeePost = "",
4220
+ size = 40,
4221
+ disableBorder = false,
4222
+ disableShadow = false,
4223
+ disablePopover = false,
4224
+ disableTooltip = false,
4225
+ sx = {}
4728
4226
  }) => {
4729
- const currentLabel = label ?? (checked ? checkedLabel : uncheckedLabel);
4730
- const renderLabel = (node) => {
4731
- if (typeof node === "string") {
4732
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TranslateText, { overrideNamespace, children: node });
4227
+ const supabase = useSupabase();
4228
+ const [anchorEl, setAnchorEl] = (0, import_react26.useState)(null);
4229
+ const [hasInteracted, setHasInteracted] = (0, import_react26.useState)(false);
4230
+ const [resolvedAvatarUrl, setResolvedAvatarUrl] = (0, import_react26.useState)(null);
4231
+ const canShowPopover = !disablePopover && Boolean(userId);
4232
+ (0, import_react26.useEffect)(() => {
4233
+ let isMounted = true;
4234
+ const resolveAvatar = async () => {
4235
+ if (!avatarUrl) {
4236
+ if (isMounted) setResolvedAvatarUrl(null);
4237
+ return;
4238
+ }
4239
+ if (!avatarUrl.startsWith("http") && !avatarUrl.startsWith("data:")) {
4240
+ try {
4241
+ const { data } = await supabase.storage.from("user-media").createSignedUrl(avatarUrl, 3600);
4242
+ if (isMounted) {
4243
+ setResolvedAvatarUrl(data?.signedUrl || null);
4244
+ }
4245
+ } catch (err) {
4246
+ console.error("Error resolving signed url for avatar:", err);
4247
+ if (isMounted) setResolvedAvatarUrl(null);
4248
+ }
4249
+ } else {
4250
+ if (isMounted) setResolvedAvatarUrl(avatarUrl);
4251
+ }
4252
+ };
4253
+ resolveAvatar();
4254
+ return () => {
4255
+ isMounted = false;
4256
+ };
4257
+ }, [avatarUrl]);
4258
+ const handleClick = (event) => {
4259
+ event.stopPropagation();
4260
+ event.preventDefault();
4261
+ if (canShowPopover) {
4262
+ setAnchorEl(event.currentTarget);
4263
+ if (!hasInteracted) {
4264
+ setHasInteracted(true);
4265
+ }
4733
4266
  }
4734
- return node;
4735
4267
  };
4736
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_material22.Box, { sx: { display: "inline-flex", alignItems: "center", gap: 0.5 }, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4737
- import_material22.FormControlLabel,
4738
- {
4739
- control: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4740
- import_material22.Switch,
4741
- {
4742
- checked,
4743
- onChange,
4744
- ...switchProps
4745
- }
4746
- ),
4747
- label: renderLabel(currentLabel),
4748
- ...props
4749
- }
4750
- ) });
4751
- };
4752
-
4753
- // src/UI/components/inputs/CheckboxComponent.tsx
4754
- var import_material23 = require("@mui/material");
4755
- init_TranslateText();
4756
- var import_jsx_runtime33 = require("react/jsx-runtime");
4757
- var CheckboxComponent = ({
4758
- checked = false,
4759
- onChange,
4760
- label,
4761
- checkedLabel,
4762
- uncheckedLabel,
4763
- overrideNamespace,
4764
- checkboxProps,
4765
- ...props
4766
- }) => {
4767
- const currentLabel = label ?? (checked ? checkedLabel : uncheckedLabel);
4768
- const renderLabel = (node) => {
4769
- if (typeof node === "string") {
4770
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TranslateText, { overrideNamespace, children: node });
4268
+ const handleClose = (event) => {
4269
+ if (event) {
4270
+ event.stopPropagation();
4271
+ event.preventDefault();
4771
4272
  }
4772
- return node;
4273
+ setAnchorEl(null);
4773
4274
  };
4774
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material23.Box, { sx: { display: "inline-flex", alignItems: "center", gap: 0.5 }, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4775
- import_material23.FormControlLabel,
4776
- {
4777
- control: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4778
- import_material23.Checkbox,
4779
- {
4780
- checked,
4781
- onChange,
4782
- ...checkboxProps
4783
- }
4784
- ),
4785
- label: renderLabel(currentLabel),
4786
- ...props
4787
- }
4788
- ) });
4275
+ const isPopoverOpen = Boolean(anchorEl);
4276
+ const initials = getInitials(displayName || "");
4277
+ const getTooltip = /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
4278
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material21.Typography, { component: "div", variant: "caption", children: displayName }),
4279
+ displayName && employeePost && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material21.Typography, { component: "div", variant: "caption", children: employeePost })
4280
+ ] });
4281
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
4282
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material21.Tooltip, { title: disableTooltip || isPopoverOpen ? "" : getTooltip, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4283
+ import_material21.Avatar,
4284
+ {
4285
+ src: resolvedAvatarUrl || void 0,
4286
+ alt: displayName || "User Avatar",
4287
+ onClick: handleClick,
4288
+ sx: {
4289
+ width: size,
4290
+ height: size,
4291
+ fontSize: size * 0.4,
4292
+ fontWeight: 600,
4293
+ bgcolor: "primary.main",
4294
+ color: "primary.contrastText",
4295
+ cursor: canShowPopover ? "pointer" : void 0,
4296
+ transition: "transform 0.2s ease, box-shadow 0.2s ease",
4297
+ border: disableBorder ? "none" : "2px solid",
4298
+ borderColor: "background.paper",
4299
+ boxShadow: disableShadow ? "none" : 2,
4300
+ "&:hover": {
4301
+ transform: canShowPopover ? "scale(1.05)" : "none"
4302
+ },
4303
+ ...sx
4304
+ },
4305
+ children: !resolvedAvatarUrl && initials
4306
+ }
4307
+ ) }),
4308
+ canShowPopover && hasInteracted && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react26.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4309
+ LazyUserPopover,
4310
+ {
4311
+ userId,
4312
+ anchorEl,
4313
+ open: isPopoverOpen,
4314
+ onClose: handleClose
4315
+ }
4316
+ ) })
4317
+ ] });
4789
4318
  };
4790
4319
 
4791
- // src/UI/widgets/page/CollapsedWidgetContainer.tsx
4792
- var import_icons_material4 = require("@mui/icons-material");
4793
- var import_material24 = require("@mui/material");
4794
- var import_react29 = require("react");
4320
+ // src/UI/index.ts
4321
+ init_UserPopoverComponent();
4322
+ init_UserRoleChipComponent();
4323
+ init_UserStatusChipComponent();
4324
+
4325
+ // src/UI/components/data.display/MyAvatarComponent.tsx
4326
+ var import_react27 = require("react");
4327
+ var import_material22 = require("@mui/material");
4795
4328
  init_context();
4796
- var import_jsx_runtime34 = require("react/jsx-runtime");
4797
- var ExpandMore = (0, import_material24.styled)((props) => {
4798
- const { expand, ...other } = props;
4799
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material24.IconButton, { size: "small", ...other, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_icons_material4.ExpandMore, {}) });
4800
- })(({ theme, expand }) => ({
4801
- transform: !expand ? "rotate(0deg)" : "rotate(180deg)",
4802
- transition: theme.transitions.create("transform", {
4803
- duration: theme.transitions.duration.shortest
4804
- }),
4805
- backgroundColor: expand ? theme.palette.primary.main : "transparent",
4806
- color: expand ? theme.palette.common.white : theme.palette.text.secondary,
4807
- border: `1px solid ${expand ? theme.palette.primary.main : theme.palette.divider}`,
4808
- "&:hover": {
4809
- backgroundColor: expand ? theme.palette.primary.dark : theme.palette.action.hover
4329
+ var import_jsx_runtime32 = require("react/jsx-runtime");
4330
+ var getInitials2 = (name) => {
4331
+ if (!name) return "?";
4332
+ const parts = name.trim().split(" ");
4333
+ if (parts.length >= 2) {
4334
+ return `${parts[0][0]}${parts[1][0]}`.toUpperCase();
4810
4335
  }
4811
- }));
4812
- var CollapsedWidgetContainer = (props) => {
4813
- const { displayState } = useAppTheme();
4814
- const [expanded, setExpanded] = (0, import_react29.useState)(props.expanded === void 0 ? false : props.expanded);
4815
- const handleExpandClick = () => {
4816
- setExpanded(!expanded);
4817
- props.onExpanded && props.onExpanded(!expanded);
4336
+ return name[0].toUpperCase();
4337
+ };
4338
+ var MyAvatarComponent = ({
4339
+ size = 40,
4340
+ disableBorder = false,
4341
+ disableShadow = false,
4342
+ disablePopover = false,
4343
+ sx = {}
4344
+ }) => {
4345
+ const { profile: userProfile, loading: isLoading } = useAuth();
4346
+ const [anchorEl, setAnchorEl] = (0, import_react27.useState)(null);
4347
+ const handlePopoverOpen = (event) => {
4348
+ if (!disablePopover) {
4349
+ setAnchorEl(event.currentTarget);
4350
+ }
4818
4351
  };
4819
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_material24.Card, { sx: { width: "100%", overflow: "hidden", mb: 2, boxShadow: displayState.isMobile ? "none" : props.disableShadow ? "none" : "0 20px 25px -5px rgb(0 0 0 / 0.1)", borderRadius: displayState.isMobile ? 0 : 1 }, children: [
4820
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
4821
- import_material24.Box,
4352
+ const handlePopoverClose = () => {
4353
+ setAnchorEl(null);
4354
+ };
4355
+ const isPopoverOpen = Boolean(anchorEl);
4356
+ if (isLoading) {
4357
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4358
+ import_material22.Skeleton,
4822
4359
  {
4823
- onClick: () => handleExpandClick(),
4360
+ variant: "circular",
4361
+ width: size,
4362
+ height: size,
4363
+ sx: { display: "inline-block", flexShrink: 0, ...sx }
4364
+ }
4365
+ );
4366
+ }
4367
+ const initials = getInitials2(userProfile?.display_name || "");
4368
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
4369
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4370
+ import_material22.Avatar,
4371
+ {
4372
+ src: userProfile?.avatar_url || void 0,
4373
+ alt: userProfile?.display_name || "User Avatar",
4374
+ onMouseEnter: handlePopoverOpen,
4375
+ onMouseLeave: handlePopoverClose,
4824
4376
  sx: {
4825
- cursor: "pointer",
4826
- "&:hover": { bgcolor: "rgba(0,0,0,0.02)" },
4827
- display: "flex",
4828
- alignItems: "center",
4829
- pr: 2
4377
+ width: size,
4378
+ height: size,
4379
+ fontSize: size * 0.4,
4380
+ fontWeight: 600,
4381
+ bgcolor: "primary.main",
4382
+ color: "primary.contrastText",
4383
+ cursor: disablePopover ? void 0 : "pointer",
4384
+ transition: "transform 0.2s ease, box-shadow 0.2s ease",
4385
+ border: disableBorder ? "none" : "2px solid",
4386
+ borderColor: "background.paper",
4387
+ boxShadow: disableShadow ? "none" : 2,
4388
+ "&:hover": {
4389
+ transform: disablePopover ? "none" : "scale(1.05)"
4390
+ },
4391
+ ...sx
4830
4392
  },
4831
- children: [
4832
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4833
- import_material24.CardHeader,
4834
- {
4835
- sx: { flexGrow: 1 },
4836
- avatar: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material24.Avatar, { sx: { bgcolor: "primary.main" }, children: props.icon }),
4837
- title: typeof props.title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material24.Typography, { variant: "subtitle1", sx: { fontWeight: "700" }, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TranslateText, { overrideNamespace: props.overrideNamespace, children: props.title }) }) : props.title,
4838
- subheader: typeof props.subtitle === "string" ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TranslateText, { overrideNamespace: props.overrideNamespace, children: props.subtitle }) : props.subtitle
4839
- }
4840
- ),
4841
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material24.Tooltip, { title: expanded ? "Show Less" : "Show More", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material24.Box, { sx: { ml: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4842
- ExpandMore,
4843
- {
4844
- expand: expanded,
4845
- onClick: handleExpandClick,
4846
- "aria-expanded": expanded
4847
- }
4848
- ) }) })
4849
- ]
4393
+ children: !userProfile?.avatar_url && initials
4850
4394
  }
4851
4395
  ),
4852
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_material24.Collapse, { in: expanded, timeout: "auto", children: [
4853
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material24.Divider, { variant: "middle" }),
4854
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material24.CardContent, { children: props.children })
4855
- ] })
4396
+ !disablePopover && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4397
+ import_material22.Popover,
4398
+ {
4399
+ id: `avatar-popover-${userProfile?.id}`,
4400
+ open: isPopoverOpen,
4401
+ anchorEl,
4402
+ anchorOrigin: {
4403
+ vertical: "bottom",
4404
+ horizontal: "center"
4405
+ },
4406
+ transformOrigin: {
4407
+ vertical: "top",
4408
+ horizontal: "center"
4409
+ },
4410
+ onClose: handlePopoverClose,
4411
+ disableRestoreFocus: true,
4412
+ disableAutoFocus: true,
4413
+ disableEnforceFocus: true,
4414
+ sx: {
4415
+ pointerEvents: "none",
4416
+ mt: 1
4417
+ },
4418
+ slotProps: {
4419
+ paper: {
4420
+ sx: {
4421
+ p: 1.5,
4422
+ borderRadius: 2,
4423
+ boxShadow: 3
4424
+ }
4425
+ }
4426
+ },
4427
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_material22.Box, { sx: { display: "flex", flexDirection: "column", alignItems: "center", gap: 0.5 }, children: [
4428
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_material22.Typography, { variant: "subtitle2", sx: { fontWeight: 600 }, children: userProfile?.display_name }),
4429
+ userProfile?.email && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_material22.Typography, { variant: "caption", color: "text.secondary", children: userProfile.email })
4430
+ ] })
4431
+ }
4432
+ )
4856
4433
  ] });
4857
4434
  };
4858
4435
 
4859
- // src/UI/components/buttons/RefreshButtonComponent.tsx
4860
- var import_react30 = require("react");
4861
- var import_material25 = require("@mui/material");
4862
- var import_Refresh = __toESM(require("@mui/icons-material/Refresh"));
4436
+ // src/UI/components/data.display/ExpandableNoteComponent.tsx
4437
+ var import_react28 = require("react");
4438
+ var import_material23 = require("@mui/material");
4863
4439
  init_context();
4864
- init_TranslatableTooltipComponent();
4865
- var import_jsx_runtime35 = require("react/jsx-runtime");
4866
- var AnimatedRefreshIcon = (0, import_material25.styled)(import_Refresh.default, {
4867
- shouldForwardProp: (prop) => prop !== "isSpinning"
4868
- })(({ isSpinning }) => ({
4869
- animation: isSpinning ? "spin 1s linear infinite" : "none",
4870
- "@keyframes spin": {
4871
- "0%": {
4872
- transform: "rotate(0deg)"
4873
- },
4874
- "100%": {
4875
- transform: "rotate(360deg)"
4876
- }
4877
- }
4878
- }));
4879
- var RefreshButtonComponent = ({
4440
+ var import_jsx_runtime33 = require("react/jsx-runtime");
4441
+ var ExpandableNoteComponent = ({
4880
4442
  overrideNamespace,
4881
- size = "small",
4882
- onClick,
4883
- disabled = false,
4884
- fullWidth = false,
4885
- loading: externalLoading,
4886
- tooltip,
4887
- mobileViewOnly,
4888
- disableMobileView,
4889
- hideTooltipOnMobile,
4890
- hideTooltipOnDesktop
4443
+ text,
4444
+ maxLength = 100,
4445
+ label,
4446
+ sx,
4447
+ ...restProps
4891
4448
  }) => {
4892
- const { displayState } = useAppTheme();
4893
- const [internalLoading, setInternalLoading] = (0, import_react30.useState)(false);
4894
- const isLoading = externalLoading !== void 0 ? externalLoading : internalLoading;
4895
- const handleClick = async (event) => {
4896
- if (!onClick || isLoading || disabled) return;
4897
- try {
4898
- setInternalLoading(true);
4899
- await onClick(event);
4900
- } finally {
4901
- setInternalLoading(false);
4902
- }
4449
+ const [isExpanded, setIsExpanded] = (0, import_react28.useState)(false);
4450
+ if (!text) return null;
4451
+ const isLong = text.length > maxLength;
4452
+ const displayedText = isExpanded || !isLong ? text : `${text.slice(0, maxLength).trim()}...`;
4453
+ const toggleExpand = (e) => {
4454
+ e.stopPropagation();
4455
+ setIsExpanded((prev) => !prev);
4903
4456
  };
4904
- const renderIcon = () => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(AnimatedRefreshIcon, { fontSize: size, isSpinning: isLoading });
4905
- if (displayState.isMobile && !disableMobileView || mobileViewOnly) {
4906
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslatableTooltipComponent, { title: hideTooltipOnMobile ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, {}) : tooltip || /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Refresh" }), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4907
- import_material25.Fab,
4908
- {
4909
- size,
4910
- color: "inherit",
4911
- onClick: handleClick,
4912
- disabled: disabled || isLoading,
4913
- "aria-label": "refresh",
4914
- children: renderIcon()
4915
- }
4916
- ) }) });
4917
- }
4918
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslatableTooltipComponent, { title: hideTooltipOnDesktop ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, {}) : tooltip || /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Refresh" }), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4919
- import_material25.Button,
4457
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4458
+ import_material23.Typography,
4920
4459
  {
4921
- variant: "contained",
4922
- color: "inherit",
4923
- size,
4924
- onClick: handleClick,
4925
- disabled: disabled || isLoading,
4926
- fullWidth,
4927
- startIcon: renderIcon(),
4928
- children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Refresh" })
4460
+ variant: "caption",
4461
+ sx: {
4462
+ color: "text.secondary",
4463
+ fontStyle: "italic",
4464
+ display: "inline-block",
4465
+ ...sx
4466
+ },
4467
+ ...restProps,
4468
+ children: [
4469
+ label !== void 0 ? label : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
4470
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Note" }),
4471
+ ": "
4472
+ ] }),
4473
+ " ",
4474
+ displayedText,
4475
+ " ",
4476
+ isLong && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4477
+ import_material23.Link,
4478
+ {
4479
+ component: "button",
4480
+ type: "button",
4481
+ variant: "caption",
4482
+ underline: "hover",
4483
+ onClick: toggleExpand,
4484
+ sx: {
4485
+ fontStyle: "normal",
4486
+ fontWeight: "bold",
4487
+ ml: 0.5,
4488
+ cursor: "pointer",
4489
+ verticalAlign: "baseline"
4490
+ },
4491
+ children: isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "less" }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
4492
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "more" }),
4493
+ "..."
4494
+ ] })
4495
+ }
4496
+ )
4497
+ ]
4929
4498
  }
4930
- ) });
4499
+ );
4931
4500
  };
4932
4501
 
4933
- // src/UI/widgets/misc/ErrorAlertWidget.tsx
4934
- var import_material26 = require("@mui/material");
4502
+ // src/UI/components/data.display/ErrorAlertComponent.tsx
4503
+ var import_material24 = require("@mui/material");
4935
4504
  var import_Replay = __toESM(require("@mui/icons-material/Replay"));
4936
4505
  init_context();
4937
- var import_jsx_runtime36 = require("react/jsx-runtime");
4506
+ var import_jsx_runtime34 = require("react/jsx-runtime");
4938
4507
  var ErrorIllustration = ({ size = 64 }) => {
4939
- const theme = (0, import_material26.useTheme)();
4508
+ const theme = (0, import_material24.useTheme)();
4940
4509
  const mainColor = theme.palette.error.main;
4941
4510
  const lightColor = theme.palette.error.light;
4942
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4943
- import_material26.Box,
4511
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4512
+ import_material24.Box,
4944
4513
  {
4945
4514
  sx: {
4946
4515
  display: "flex",
@@ -4948,7 +4517,7 @@ var ErrorIllustration = ({ size = 64 }) => {
4948
4517
  justifyContent: "center",
4949
4518
  flexShrink: 0
4950
4519
  },
4951
- children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
4520
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
4952
4521
  "svg",
4953
4522
  {
4954
4523
  width: size,
@@ -4957,7 +4526,7 @@ var ErrorIllustration = ({ size = 64 }) => {
4957
4526
  fill: "none",
4958
4527
  xmlns: "http://www.w3.org/2000/svg",
4959
4528
  children: [
4960
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
4529
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
4961
4530
  "circle",
4962
4531
  {
4963
4532
  cx: "50",
@@ -4966,7 +4535,7 @@ var ErrorIllustration = ({ size = 64 }) => {
4966
4535
  fill: lightColor,
4967
4536
  fillOpacity: "0.25",
4968
4537
  children: [
4969
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4538
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4970
4539
  "animate",
4971
4540
  {
4972
4541
  attributeName: "r",
@@ -4975,7 +4544,7 @@ var ErrorIllustration = ({ size = 64 }) => {
4975
4544
  repeatCount: "indefinite"
4976
4545
  }
4977
4546
  ),
4978
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4547
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4979
4548
  "animate",
4980
4549
  {
4981
4550
  attributeName: "fill-opacity",
@@ -4987,8 +4556,8 @@ var ErrorIllustration = ({ size = 64 }) => {
4987
4556
  ]
4988
4557
  }
4989
4558
  ),
4990
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("circle", { cx: "50", cy: "50", r: "34", fill: lightColor, fillOpacity: "0.35" }),
4991
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4559
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("circle", { cx: "50", cy: "50", r: "34", fill: lightColor, fillOpacity: "0.35" }),
4560
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4992
4561
  "path",
4993
4562
  {
4994
4563
  d: "M50 20L80 72H20L50 20Z",
@@ -4998,7 +4567,7 @@ var ErrorIllustration = ({ size = 64 }) => {
4998
4567
  strokeLinejoin: "round"
4999
4568
  }
5000
4569
  ),
5001
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4570
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
5002
4571
  "path",
5003
4572
  {
5004
4573
  d: "M50 36V54",
@@ -5007,17 +4576,17 @@ var ErrorIllustration = ({ size = 64 }) => {
5007
4576
  strokeLinecap: "round"
5008
4577
  }
5009
4578
  ),
5010
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("circle", { cx: "50", cy: "62", r: "2.5", fill: "#FFFFFF" }),
5011
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("circle", { cx: "16", cy: "30", r: "3", fill: mainColor, opacity: "0.4" }),
5012
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("circle", { cx: "84", cy: "30", r: "2", fill: mainColor, opacity: "0.6" }),
5013
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("circle", { cx: "88", cy: "68", r: "3", fill: mainColor, opacity: "0.3" })
4579
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("circle", { cx: "50", cy: "62", r: "2.5", fill: "#FFFFFF" }),
4580
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("circle", { cx: "16", cy: "30", r: "3", fill: mainColor, opacity: "0.4" }),
4581
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("circle", { cx: "84", cy: "30", r: "2", fill: mainColor, opacity: "0.6" }),
4582
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("circle", { cx: "88", cy: "68", r: "3", fill: mainColor, opacity: "0.3" })
5014
4583
  ]
5015
4584
  }
5016
4585
  )
5017
4586
  }
5018
4587
  );
5019
4588
  };
5020
- var ErrorAlertWidget = ({
4589
+ var ErrorAlertComponent = ({
5021
4590
  overrideNamespace,
5022
4591
  title = "An error occurred",
5023
4592
  message,
@@ -5025,8 +4594,8 @@ var ErrorAlertWidget = ({
5025
4594
  retryText = "Retry",
5026
4595
  isRetrying = false
5027
4596
  }) => {
5028
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
5029
- import_material26.Alert,
4597
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4598
+ import_material24.Alert,
5030
4599
  {
5031
4600
  severity: "error",
5032
4601
  icon: false,
@@ -5043,8 +4612,8 @@ var ErrorAlertWidget = ({
5043
4612
  p: 0
5044
4613
  }
5045
4614
  },
5046
- children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
5047
- import_material26.Box,
4615
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
4616
+ import_material24.Box,
5048
4617
  {
5049
4618
  sx: {
5050
4619
  display: "flex",
@@ -5053,34 +4622,34 @@ var ErrorAlertWidget = ({
5053
4622
  gap: 2
5054
4623
  },
5055
4624
  children: [
5056
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ErrorIllustration, { size: 68 }),
5057
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_material26.Box, { sx: { flexGrow: 1 }, children: [
5058
- typeof title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
5059
- import_material26.Typography,
4625
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ErrorIllustration, { size: 68 }),
4626
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_material24.Box, { sx: { flexGrow: 1 }, children: [
4627
+ typeof title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4628
+ import_material24.Typography,
5060
4629
  {
5061
4630
  variant: "subtitle1",
5062
4631
  sx: { fontWeight: 600, color: "error.main", mb: 0.5 },
5063
- children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TranslateText, { overrideNamespace, children: title })
4632
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TranslateText, { overrideNamespace, children: title })
5064
4633
  }
5065
4634
  ) : title,
5066
- typeof message === "string" ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_material26.Typography, { variant: "body2", color: "text.secondary", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TranslateText, { overrideNamespace, children: message }) }) : message
4635
+ typeof message === "string" ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material24.Typography, { variant: "body2", color: "text.secondary", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TranslateText, { overrideNamespace, children: message }) }) : message
5067
4636
  ] }),
5068
- onRetry && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
5069
- import_material26.Box,
4637
+ onRetry && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4638
+ import_material24.Box,
5070
4639
  {
5071
4640
  sx: {
5072
4641
  alignSelf: { xs: "flex-end", sm: "center" },
5073
4642
  mt: { xs: 1, sm: 0 }
5074
4643
  },
5075
- children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
5076
- import_material26.Button,
4644
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4645
+ import_material24.Button,
5077
4646
  {
5078
4647
  variant: "outlined",
5079
4648
  color: "error",
5080
4649
  size: "small",
5081
4650
  disabled: isRetrying,
5082
4651
  onClick: onRetry,
5083
- startIcon: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4652
+ startIcon: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
5084
4653
  import_Replay.default,
5085
4654
  {
5086
4655
  sx: {
@@ -5112,34 +4681,15 @@ var ErrorAlertWidget = ({
5112
4681
  );
5113
4682
  };
5114
4683
 
5115
- // src/UI/components/buttons/ButtonComponent.tsx
5116
- var import_react31 = require("react");
5117
- var import_material27 = require("@mui/material");
5118
- init_context();
5119
- var import_jsx_runtime37 = require("react/jsx-runtime");
5120
- var ButtonComponent = (0, import_react31.forwardRef)(
5121
- ({ label, children, overrideNamespace, ...props }, ref) => {
5122
- const renderContent = (content) => {
5123
- if (typeof content === "string") {
5124
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TranslateText, { overrideNamespace, children: content });
5125
- }
5126
- return content;
5127
- };
5128
- const contentToRender = label !== void 0 ? label : children;
5129
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material27.Button, { ref, ...props, children: renderContent(contentToRender) });
5130
- }
5131
- );
5132
- ButtonComponent.displayName = "ButtonComponent";
5133
-
5134
4684
  // src/UI/components/layout/PageComponent.tsx
5135
- var import_react32 = __toESM(require("react"));
5136
- var import_material28 = require("@mui/material");
4685
+ var import_react29 = __toESM(require("react"));
4686
+ var import_material25 = require("@mui/material");
5137
4687
  var import_MoreVert = __toESM(require("@mui/icons-material/MoreVert"));
5138
4688
  var import_KeyboardArrowDown = __toESM(require("@mui/icons-material/KeyboardArrowDown"));
5139
- var import_icons_material5 = require("@mui/icons-material");
4689
+ var import_icons_material3 = require("@mui/icons-material");
5140
4690
  init_context();
5141
4691
  init_TranslatableTooltipComponent();
5142
- var import_jsx_runtime38 = require("react/jsx-runtime");
4692
+ var import_jsx_runtime35 = require("react/jsx-runtime");
5143
4693
  var getTruncateStyles = (mode = "truncate") => {
5144
4694
  switch (mode) {
5145
4695
  case "truncate":
@@ -5167,10 +4717,10 @@ var PageHeader = ({
5167
4717
  forceMobileView,
5168
4718
  sx = []
5169
4719
  }) => {
5170
- const theme = (0, import_material28.useTheme)();
5171
- const mediaIsMobile = (0, import_material28.useMediaQuery)(theme.breakpoints.down(mobileBreakpoint));
4720
+ const theme = (0, import_material25.useTheme)();
4721
+ const mediaIsMobile = (0, import_material25.useMediaQuery)(theme.breakpoints.down(mobileBreakpoint));
5172
4722
  const isMobile = forceMobileView ?? mediaIsMobile;
5173
- const [anchorEl, setAnchorEl] = (0, import_react32.useState)(null);
4723
+ const [anchorEl, setAnchorEl] = (0, import_react29.useState)(null);
5174
4724
  const isMenuOpen = Boolean(anchorEl);
5175
4725
  const handleOpenMenu = (e) => setAnchorEl(e.currentTarget);
5176
4726
  const handleCloseMenu = () => setAnchorEl(null);
@@ -5180,8 +4730,8 @@ var PageHeader = ({
5180
4730
  };
5181
4731
  const hasSecondaryActions = secondaryActions.length > 0;
5182
4732
  const hasActions = Boolean(primaryAction || hasSecondaryActions || refreshAction);
5183
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
5184
- import_material28.Box,
4733
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
4734
+ import_material25.Box,
5185
4735
  {
5186
4736
  sx: [
5187
4737
  {
@@ -5199,9 +4749,9 @@ var PageHeader = ({
5199
4749
  ...Array.isArray(sx) ? sx : [sx]
5200
4750
  ],
5201
4751
  children: [
5202
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_material28.Box, { sx: { display: "flex", alignItems: "center", gap: { xs: 1.5, sm: 2 }, minWidth: 0, flex: 1 }, children: [
5203
- icon && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
5204
- import_material28.Box,
4752
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_material25.Box, { sx: { display: "flex", alignItems: "center", gap: { xs: 1.5, sm: 2 }, minWidth: 0, flex: 1 }, children: [
4753
+ icon && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4754
+ import_material25.Box,
5205
4755
  {
5206
4756
  sx: {
5207
4757
  display: "flex",
@@ -5220,10 +4770,10 @@ var PageHeader = ({
5220
4770
  children: icon
5221
4771
  }
5222
4772
  ),
5223
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_material28.Box, { sx: { minWidth: 0, flex: 1 }, children: [
5224
- tag && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.Box, { sx: { mb: 0.5, display: "flex", alignItems: "center" }, children: tag }),
5225
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.Tooltip, { title: titleTruncateMode === "truncate" ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TranslateText, { children: title }) : void 0, arrow: true, placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
5226
- import_material28.Typography,
4773
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_material25.Box, { sx: { minWidth: 0, flex: 1 }, children: [
4774
+ tag && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.Box, { sx: { mb: 0.5, display: "flex", alignItems: "center" }, children: tag }),
4775
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.Tooltip, { title: titleTruncateMode === "truncate" ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslateText, { children: title }) : void 0, arrow: true, placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4776
+ import_material25.Typography,
5227
4777
  {
5228
4778
  variant: "h5",
5229
4779
  component: "h1",
@@ -5234,11 +4784,11 @@ var PageHeader = ({
5234
4784
  lineHeight: 1.3,
5235
4785
  ...getTruncateStyles(titleTruncateMode)
5236
4786
  },
5237
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TranslateText, { children: title })
4787
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslateText, { children: title })
5238
4788
  }
5239
4789
  ) }),
5240
- subtitle && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.Tooltip, { title: subtitleTruncateMode === "truncate" ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TranslateText, { children: subtitle }) : void 0, arrow: true, placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
5241
- import_material28.Typography,
4790
+ subtitle && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.Tooltip, { title: subtitleTruncateMode === "truncate" ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslateText, { children: subtitle }) : void 0, arrow: true, placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4791
+ import_material25.Typography,
5242
4792
  {
5243
4793
  variant: "body2",
5244
4794
  sx: {
@@ -5248,24 +4798,24 @@ var PageHeader = ({
5248
4798
  lineHeight: 1.4,
5249
4799
  ...getTruncateStyles(subtitleTruncateMode)
5250
4800
  },
5251
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TranslateText, { children: subtitle })
4801
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslateText, { children: subtitle })
5252
4802
  }
5253
4803
  ) })
5254
4804
  ] })
5255
4805
  ] }),
5256
- hasActions && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.Box, { sx: { flexShrink: 0, display: "flex", alignItems: "center", gap: 1 }, children: isMobile ? (
4806
+ hasActions && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.Box, { sx: { flexShrink: 0, display: "flex", alignItems: "center", gap: 1 }, children: isMobile ? (
5257
4807
  /* MOBILE: IconButton with MoreVertIcon showing ALL actions inside Menu */
5258
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
5259
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Actions" }), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
5260
- import_material28.IconButton,
4808
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
4809
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Actions" }), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4810
+ import_material25.IconButton,
5261
4811
  {
5262
4812
  onClick: handleOpenMenu,
5263
4813
  sx: { border: "1px solid", borderColor: "divider", borderRadius: 2, p: 1 },
5264
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_MoreVert.default, {})
4814
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_MoreVert.default, {})
5265
4815
  }
5266
4816
  ) }),
5267
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
5268
- import_material28.Menu,
4817
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
4818
+ import_material25.Menu,
5269
4819
  {
5270
4820
  anchorEl,
5271
4821
  open: isMenuOpen,
@@ -5274,9 +4824,9 @@ var PageHeader = ({
5274
4824
  anchorOrigin: { horizontal: "right", vertical: "bottom" },
5275
4825
  slotProps: { paper: { elevation: 4, sx: { minWidth: 200, borderRadius: 2, mt: 1, p: 0.5 } } },
5276
4826
  children: [
5277
- primaryAction && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
5278
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
5279
- import_material28.MenuItem,
4827
+ primaryAction && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
4828
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
4829
+ import_material25.MenuItem,
5280
4830
  {
5281
4831
  onClick: () => handleMenuAction(primaryAction.onClick),
5282
4832
  disabled: primaryAction.disabled,
@@ -5289,32 +4839,32 @@ var PageHeader = ({
5289
4839
  px: 1.5
5290
4840
  },
5291
4841
  children: [
5292
- primaryAction.icon && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.ListItemIcon, { sx: { color: "inherit", minWidth: 32 }, children: primaryAction.icon }),
5293
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.ListItemText, { primary: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TranslateText, { children: primaryAction.label }), slotProps: { primary: { sx: { fontWeight: 700, fontSize: "0.9rem" } } } })
4842
+ primaryAction.icon && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.ListItemIcon, { sx: { color: "inherit", minWidth: 32 }, children: primaryAction.icon }),
4843
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.ListItemText, { primary: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslateText, { children: primaryAction.label }), slotProps: { primary: { sx: { fontWeight: 700, fontSize: "0.9rem" } } } })
5294
4844
  ]
5295
4845
  }
5296
4846
  ),
5297
- hasSecondaryActions && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.Divider, { sx: { my: 0.75 } })
4847
+ hasSecondaryActions && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.Divider, { sx: { my: 0.75 } })
5298
4848
  ] }),
5299
- secondaryActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_react32.default.Fragment, { children: [
5300
- action.divider && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.Divider, { sx: { my: 0.5 } }),
5301
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
5302
- import_material28.MenuItem,
4849
+ secondaryActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react29.default.Fragment, { children: [
4850
+ action.divider && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.Divider, { sx: { my: 0.5 } }),
4851
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
4852
+ import_material25.MenuItem,
5303
4853
  {
5304
4854
  onClick: () => handleMenuAction(action.onClick),
5305
4855
  disabled: action.disabled,
5306
4856
  sx: { borderRadius: 1, py: 1, px: 1.5, color: action.color ? `${action.color}.main` : "text.primary" },
5307
4857
  children: [
5308
- action.icon && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.ListItemIcon, { sx: { color: action.color ? `${action.color}.main` : "text.secondary", minWidth: 32 }, children: action.icon }),
5309
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.ListItemText, { primary: action.label, slotProps: { primary: { sx: { fontSize: "0.875rem" } } } })
4858
+ action.icon && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.ListItemIcon, { sx: { color: action.color ? `${action.color}.main` : "text.secondary", minWidth: 32 }, children: action.icon }),
4859
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.ListItemText, { primary: action.label, slotProps: { primary: { sx: { fontSize: "0.875rem" } } } })
5310
4860
  ]
5311
4861
  }
5312
4862
  )
5313
4863
  ] }, action.id)),
5314
- refreshAction && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
5315
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.Divider, { sx: { my: 0.5 } }),
5316
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
5317
- import_material28.MenuItem,
4864
+ refreshAction && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
4865
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.Divider, { sx: { my: 0.5 } }),
4866
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
4867
+ import_material25.MenuItem,
5318
4868
  {
5319
4869
  onClick: () => handleMenuAction(refreshAction.onClick),
5320
4870
  disabled: refreshAction.disabled,
@@ -5326,8 +4876,8 @@ var PageHeader = ({
5326
4876
  px: 1.5
5327
4877
  },
5328
4878
  children: [
5329
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.ListItemIcon, { sx: { color: "inherit", minWidth: 32 }, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_icons_material5.Refresh, {}) }),
5330
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.ListItemText, { primary: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Refresh" }), slotProps: { primary: { sx: { fontWeight: 700, fontSize: "0.9rem" } } } })
4879
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.ListItemIcon, { sx: { color: "inherit", minWidth: 32 }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_icons_material3.Refresh, {}) }),
4880
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.ListItemText, { primary: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Refresh" }), slotProps: { primary: { sx: { fontWeight: 700, fontSize: "0.9rem" } } } })
5331
4881
  ]
5332
4882
  }
5333
4883
  )
@@ -5338,10 +4888,10 @@ var PageHeader = ({
5338
4888
  ] })
5339
4889
  ) : (
5340
4890
  /* DESKTOP: Primary Action Button + Secondary Actions Dropdown Button */
5341
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_material28.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
5342
- (primaryAction || refreshAction) && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_material28.Stack, { direction: "row", spacing: 2, children: [
5343
- primaryAction && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
5344
- import_material28.Button,
4891
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_material25.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
4892
+ (primaryAction || refreshAction) && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_material25.Stack, { direction: "row", spacing: 2, children: [
4893
+ primaryAction && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4894
+ import_material25.Button,
5345
4895
  {
5346
4896
  variant: primaryAction.variant || "contained",
5347
4897
  color: primaryAction.color || "primary",
@@ -5349,32 +4899,32 @@ var PageHeader = ({
5349
4899
  disabled: primaryAction.disabled,
5350
4900
  startIcon: primaryAction.icon,
5351
4901
  sx: { borderRadius: 2, textTransform: "none", fontWeight: 600, px: 2, py: 0.85 },
5352
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TranslateText, { children: primaryAction.label })
4902
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslateText, { children: primaryAction.label })
5353
4903
  }
5354
4904
  ),
5355
- refreshAction && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Refresh" }), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
5356
- import_material28.Fab,
4905
+ refreshAction && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslatableTooltipComponent, { title: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Refresh" }), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4906
+ import_material25.Fab,
5357
4907
  {
5358
4908
  color: "default",
5359
4909
  onClick: refreshAction.onClick,
5360
4910
  disabled: refreshAction.disabled,
5361
4911
  "aria-label": "refresh",
5362
4912
  size: "small",
5363
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_icons_material5.Refresh, {})
4913
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_icons_material3.Refresh, {})
5364
4914
  }
5365
4915
  ) })
5366
4916
  ] }),
5367
- hasSecondaryActions && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
5368
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
5369
- import_material28.IconButton,
4917
+ hasSecondaryActions && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
4918
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4919
+ import_material25.IconButton,
5370
4920
  {
5371
4921
  onClick: handleOpenMenu,
5372
4922
  sx: { border: "1px solid", borderColor: "divider", borderRadius: 2, p: 1 },
5373
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_KeyboardArrowDown.default, {})
4923
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_KeyboardArrowDown.default, {})
5374
4924
  }
5375
4925
  ),
5376
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
5377
- import_material28.Menu,
4926
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4927
+ import_material25.Menu,
5378
4928
  {
5379
4929
  anchorEl,
5380
4930
  open: isMenuOpen,
@@ -5382,17 +4932,17 @@ var PageHeader = ({
5382
4932
  transformOrigin: { horizontal: "right", vertical: "top" },
5383
4933
  anchorOrigin: { horizontal: "right", vertical: "bottom" },
5384
4934
  slotProps: { paper: { elevation: 4, sx: { minWidth: 180, borderRadius: 2, mt: 1, p: 0.5 } } },
5385
- children: secondaryActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_react32.default.Fragment, { children: [
5386
- action.divider && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.Divider, { sx: { my: 0.5 } }),
5387
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
5388
- import_material28.MenuItem,
4935
+ children: secondaryActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react29.default.Fragment, { children: [
4936
+ action.divider && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.Divider, { sx: { my: 0.5 } }),
4937
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
4938
+ import_material25.MenuItem,
5389
4939
  {
5390
4940
  onClick: () => handleMenuAction(action.onClick),
5391
4941
  disabled: action.disabled,
5392
4942
  sx: { borderRadius: 1, py: 0.85, color: action.color ? `${action.color}.main` : "text.primary" },
5393
4943
  children: [
5394
- action.icon && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.ListItemIcon, { sx: { color: action.color ? `${action.color}.main` : "text.secondary", minWidth: 32 }, children: action.icon }),
5395
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.ListItemText, { primary: action.label, slotProps: { primary: { sx: { fontSize: "0.875rem" } } } })
4944
+ action.icon && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.ListItemIcon, { sx: { color: action.color ? `${action.color}.main` : "text.secondary", minWidth: 32 }, children: action.icon }),
4945
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material25.ListItemText, { primary: action.label, slotProps: { primary: { sx: { fontSize: "0.875rem" } } } })
5396
4946
  ]
5397
4947
  }
5398
4948
  )
@@ -5402,14 +4952,14 @@ var PageHeader = ({
5402
4952
  ] })
5403
4953
  ] })
5404
4954
  ) }),
5405
- customFragment && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children: customFragment })
4955
+ customFragment && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children: customFragment })
5406
4956
  ]
5407
4957
  }
5408
4958
  );
5409
4959
  };
5410
4960
  var PageContainer = ({ children }) => {
5411
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
5412
- import_material28.Box,
4961
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4962
+ import_material25.Box,
5413
4963
  {
5414
4964
  sx: {
5415
4965
  width: "100%",
@@ -5425,8 +4975,8 @@ var PageComponent = ({
5425
4975
  header,
5426
4976
  children
5427
4977
  }) => {
5428
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
5429
- import_material28.Box,
4978
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4979
+ import_material25.Box,
5430
4980
  {
5431
4981
  sx: {
5432
4982
  //pt: 2,
@@ -5435,120 +4985,231 @@ var PageComponent = ({
5435
4985
  overflowY: "auto",
5436
4986
  boxSizing: "border-box"
5437
4987
  },
5438
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(PageContainer, { children: [
5439
- header && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PageHeader, { ...header }),
4988
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(PageContainer, { children: [
4989
+ header && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PageHeader, { ...header }),
5440
4990
  children
5441
4991
  ] })
5442
4992
  }
5443
4993
  );
5444
4994
  };
5445
4995
 
5446
- // src/UI/widgets/page/FilterContainerWidget.tsx
5447
- var import_react33 = __toESM(require("react"));
5448
- var import_material29 = require("@mui/material");
5449
- var import_jsx_runtime39 = (
4996
+ // src/UI/components/layout/FilterContainerComponent.tsx
4997
+ var import_react30 = __toESM(require("react"));
4998
+ var import_material26 = require("@mui/material");
4999
+ var import_jsx_runtime36 = (
5450
5000
  /* Автоматическая обертка каждого дочернего элемента в Grid size */
5451
5001
  require("react/jsx-runtime")
5452
5002
  );
5453
- var widthToGridColumns = (width) => {
5454
- switch (width) {
5455
- case "25%":
5456
- return 3;
5457
- case "33%":
5458
- return 4;
5459
- case "50%":
5460
- return 6;
5461
- case "66%":
5462
- return 8;
5463
- case "75%":
5464
- return 9;
5465
- case "100%":
5466
- default:
5467
- return 12;
5468
- }
5469
- };
5470
- var createGridSize = (desktopWidth, mobileWidth = "100%") => {
5471
- return {
5472
- xs: widthToGridColumns(mobileWidth),
5473
- md: widthToGridColumns(desktopWidth)
5474
- };
5475
- };
5476
- var FilterSection = ({
5477
- width = "100%",
5478
- mobileWidth = "100%",
5479
- itemWidth = "50%",
5480
- itemMobileWidth = "100%",
5481
- children
5482
- }) => {
5483
- const sectionGridSize = createGridSize(width, mobileWidth);
5484
- const itemGridSize = createGridSize(itemWidth, itemMobileWidth);
5485
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material29.Grid, { size: sectionGridSize, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material29.Grid, { container: true, spacing: 2, sx: { alignItems: "center" }, children: import_react33.default.Children.map(children, (child) => {
5486
- if (!child) return null;
5487
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material29.Grid, { size: itemGridSize, children: child });
5488
- }) }) });
5489
- };
5490
- var FilterContainerWidget = ({
5003
+ var FilterContainerComponent = ({
5491
5004
  sections,
5492
5005
  children,
5493
5006
  sx
5494
5007
  }) => {
5495
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
5496
- import_material29.Paper,
5008
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
5009
+ import_material26.Paper,
5497
5010
  {
5498
5011
  variant: "outlined",
5499
5012
  sx: [
5500
5013
  { p: 2, mb: 3 },
5501
5014
  ...Array.isArray(sx) ? sx : [sx]
5502
5015
  ],
5503
- children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material29.Grid, { container: true, spacing: 2, sx: { alignItems: "center" }, children: sections ? sections.map((sec, idx) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react33.default.Fragment, { children: sec }, idx)) : children })
5016
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_material26.Grid, { container: true, spacing: 2, sx: { alignItems: "center" }, children: sections ? sections.map((sec, idx) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react30.default.Fragment, { children: sec }, idx)) : children })
5504
5017
  }
5505
5018
  );
5506
5019
  };
5507
5020
 
5508
- // src/UI/index.ts
5509
- var UI = {
5510
- Inputs: {
5511
- TextField: TextFieldComponent,
5512
- NumberField: NumberInputComponent,
5513
- EmailField: EmailInputComponent,
5514
- Search: SearchComponent,
5515
- Select: SelectComponent,
5516
- Checkbox: CheckboxComponent,
5517
- Switch: SwitchComponent,
5518
- Url: UrlComponent
5519
- },
5520
- Buttons: {
5521
- Button: ButtonComponent,
5522
- CopyClipboardButton: CopyClipboardButtonComponent,
5523
- RefreshButton: RefreshButtonComponent
5524
- },
5525
- DataDisplay: {
5526
- TranslatableTooltip: TranslatableTooltipComponent,
5527
- UserAvatar: UserAvatarComponent,
5528
- UserPopover: UserPopoverComponent_default,
5529
- UserRoleChip: UserRoleChipComponent,
5530
- UserStatusChip: UserStatusChipComponent,
5531
- MyAvatar: MyAvatarComponent,
5532
- ExpandableNote: ExpandableNoteComponent
5533
- },
5534
- Layout: {
5535
- Page: PageComponent
5536
- },
5537
- Widgets: {
5538
- Locales: {
5539
- ProtectedLanguageSelector: LanguageSelector,
5540
- PublicLanguageSelector
5541
- },
5542
- Pages: {
5543
- PageLinkWidget,
5544
- CollapsedWidgetContainer,
5545
- FilterContainerWidget,
5546
- FilterSection
5547
- },
5548
- Misc: {
5549
- ErrorAlertWidget
5021
+ // src/UI/components/layout/PageLinkComponent.tsx
5022
+ var import_icons_material4 = require("@mui/icons-material");
5023
+ var import_material27 = require("@mui/material");
5024
+ var import_react31 = __toESM(require("react"));
5025
+ var import_react_router_dom = require("react-router-dom");
5026
+ init_context();
5027
+ var import_jsx_runtime37 = require("react/jsx-runtime");
5028
+ var PageLinkComponent = ({
5029
+ overrideNamespace,
5030
+ title,
5031
+ subheader,
5032
+ description,
5033
+ icon,
5034
+ links,
5035
+ actionButtonText,
5036
+ onActionButtonClick,
5037
+ bgcolor
5038
+ }) => {
5039
+ const navigate = (0, import_react_router_dom.useNavigate)();
5040
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
5041
+ import_material27.Card,
5042
+ {
5043
+ sx: (theme) => ({
5044
+ height: "100%",
5045
+ display: "flex",
5046
+ flexDirection: "column",
5047
+ boxShadow: 3,
5048
+ bgcolor,
5049
+ color: bgcolor ? typeof bgcolor === "string" && bgcolor.includes(".") ? theme.palette.getContrastText(
5050
+ bgcolor.split(".").reduce((acc, key) => acc[key], theme.palette)
5051
+ ) : typeof bgcolor === "function" ? theme.palette.getContrastText(bgcolor(theme)) : theme.palette.getContrastText(bgcolor) : "text.primary"
5052
+ }),
5053
+ children: [
5054
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5055
+ import_material27.CardHeader,
5056
+ {
5057
+ avatar: icon ? import_react31.default.cloneElement(icon, {
5058
+ sx: { color: bgcolor ? "inherit" : "primary", ...icon.props.sx }
5059
+ }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_icons_material4.Settings, { color: bgcolor ? "inherit" : "primary" }),
5060
+ title: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material27.Typography, { variant: "h6", component: "div", color: "inherit", children: typeof title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TranslateText, { overrideNamespace, children: title }) : title }),
5061
+ subheader: subheader && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material27.Typography, { variant: "body2", sx: { opacity: 0.8, color: "inherit" }, children: typeof subheader === "string" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TranslateText, { overrideNamespace, children: subheader }) : subheader })
5062
+ }
5063
+ ),
5064
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material27.Divider, { sx: { borderColor: "inherit", opacity: 0.2 } }),
5065
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_material27.CardContent, { sx: { flexGrow: 1 }, children: [
5066
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material27.Typography, { variant: "body2", sx: { opacity: 0.85, color: "inherit" }, children: typeof description === "string" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TranslateText, { overrideNamespace, children: description }) : description }),
5067
+ links && links.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material27.List, { dense: true, disablePadding: true, children: links.filter((f) => !f.hidden).map((link, index) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
5068
+ import_material27.ListItem,
5069
+ {
5070
+ disablePadding: true,
5071
+ sx: {
5072
+ mt: 1,
5073
+ // Запрещаем ListItem менять цвет фона при наведении
5074
+ "&:hover": {
5075
+ backgroundColor: "transparent"
5076
+ }
5077
+ },
5078
+ children: [
5079
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5080
+ import_material27.ListItemIcon,
5081
+ {
5082
+ sx: { minWidth: 30, cursor: "pointer", color: "inherit" },
5083
+ onClick: () => {
5084
+ if (link?.href) navigate(link.href);
5085
+ },
5086
+ children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_icons_material4.ArrowRight, { fontSize: "small", color: "inherit" })
5087
+ }
5088
+ ),
5089
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material27.ListItemText, { children: link.onClick ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5090
+ import_material27.Button,
5091
+ {
5092
+ size: "small",
5093
+ variant: "text",
5094
+ color: bgcolor ? "inherit" : "primary",
5095
+ onClick: link.onClick,
5096
+ sx: {
5097
+ fontWeight: 500,
5098
+ textTransform: "none",
5099
+ // Отключает автоматические заглавные буквы (UPPERCASE)
5100
+ padding: 0,
5101
+ minWidth: "auto",
5102
+ justifyContent: "flex-start",
5103
+ textAlign: "left",
5104
+ transition: "opacity 0.2s ease-in-out",
5105
+ "&:hover": {
5106
+ opacity: 0.75,
5107
+ backgroundColor: "transparent",
5108
+ // Убирает стандартную серую подложку при ховере кнопки
5109
+ textDecoration: "underline"
5110
+ // Эффект подчеркивания, как у ссылки
5111
+ }
5112
+ },
5113
+ children: typeof link.text === "string" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TranslateText, { overrideNamespace, children: link.text }) : link.text
5114
+ }
5115
+ ) : link.href ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5116
+ import_material27.Link,
5117
+ {
5118
+ component: import_react_router_dom.Link,
5119
+ to: link.href,
5120
+ target: link.external ? "_blank" : "_self",
5121
+ rel: link.external ? "noopener noreferrer" : "",
5122
+ underline: "hover",
5123
+ color: bgcolor ? "inherit" : "primary",
5124
+ sx: {
5125
+ fontWeight: 500,
5126
+ display: "inline-block",
5127
+ transition: "opacity 0.2s ease-in-out",
5128
+ "&:hover": {
5129
+ opacity: 0.75,
5130
+ backgroundColor: "transparent"
5131
+ }
5132
+ },
5133
+ children: typeof link.text === "string" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TranslateText, { overrideNamespace, children: link.text }) : link.text
5134
+ }
5135
+ ) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material27.Typography, { variant: "body2", sx: { fontWeight: 500, color: "inherit" }, children: typeof link.text === "string" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TranslateText, { overrideNamespace, children: link.text }) : link.text }) })
5136
+ ]
5137
+ },
5138
+ index
5139
+ )) })
5140
+ ] }),
5141
+ actionButtonText && onActionButtonClick && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material27.CardActions, { sx: { justifyContent: "flex-end", padding: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material27.Button, { size: "small", variant: "contained", onClick: onActionButtonClick, children: typeof actionButtonText === "string" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TranslateText, { overrideNamespace, children: actionButtonText }) : actionButtonText }) })
5142
+ ]
5550
5143
  }
5144
+ );
5145
+ };
5146
+
5147
+ // src/UI/components/layout/CollapsedContainerComponent.tsx
5148
+ var import_icons_material5 = require("@mui/icons-material");
5149
+ var import_material28 = require("@mui/material");
5150
+ var import_react32 = require("react");
5151
+ init_context();
5152
+ var import_jsx_runtime38 = require("react/jsx-runtime");
5153
+ var ExpandMore = (0, import_material28.styled)((props) => {
5154
+ const { expand, ...other } = props;
5155
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.IconButton, { size: "small", ...other, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_icons_material5.ExpandMore, {}) });
5156
+ })(({ theme, expand }) => ({
5157
+ transform: !expand ? "rotate(0deg)" : "rotate(180deg)",
5158
+ transition: theme.transitions.create("transform", {
5159
+ duration: theme.transitions.duration.shortest
5160
+ }),
5161
+ backgroundColor: expand ? theme.palette.primary.main : "transparent",
5162
+ color: expand ? theme.palette.common.white : theme.palette.text.secondary,
5163
+ border: `1px solid ${expand ? theme.palette.primary.main : theme.palette.divider}`,
5164
+ "&:hover": {
5165
+ backgroundColor: expand ? theme.palette.primary.dark : theme.palette.action.hover
5551
5166
  }
5167
+ }));
5168
+ var CollapsedContainerComponent = (props) => {
5169
+ const { displayState } = useAppTheme();
5170
+ const [expanded, setExpanded] = (0, import_react32.useState)(props.expanded === void 0 ? false : props.expanded);
5171
+ const handleExpandClick = () => {
5172
+ setExpanded(!expanded);
5173
+ props.onExpanded && props.onExpanded(!expanded);
5174
+ };
5175
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_material28.Card, { sx: { width: "100%", overflow: "hidden", mb: 2, boxShadow: displayState.isMobile ? "none" : props.disableShadow ? "none" : "0 20px 25px -5px rgb(0 0 0 / 0.1)", borderRadius: displayState.isMobile ? 0 : 1 }, children: [
5176
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
5177
+ import_material28.Box,
5178
+ {
5179
+ onClick: () => handleExpandClick(),
5180
+ sx: {
5181
+ cursor: "pointer",
5182
+ "&:hover": { bgcolor: "rgba(0,0,0,0.02)" },
5183
+ display: "flex",
5184
+ alignItems: "center",
5185
+ pr: 2
5186
+ },
5187
+ children: [
5188
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
5189
+ import_material28.CardHeader,
5190
+ {
5191
+ sx: { flexGrow: 1 },
5192
+ avatar: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.Avatar, { sx: { bgcolor: "primary.main" }, children: props.icon }),
5193
+ title: typeof props.title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.Typography, { variant: "subtitle1", sx: { fontWeight: "700" }, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TranslateText, { overrideNamespace: props.overrideNamespace, children: props.title }) }) : props.title,
5194
+ subheader: typeof props.subtitle === "string" ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TranslateText, { overrideNamespace: props.overrideNamespace, children: props.subtitle }) : props.subtitle
5195
+ }
5196
+ ),
5197
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.Tooltip, { title: expanded ? "Show Less" : "Show More", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.Box, { sx: { ml: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
5198
+ ExpandMore,
5199
+ {
5200
+ expand: expanded,
5201
+ onClick: handleExpandClick,
5202
+ "aria-expanded": expanded
5203
+ }
5204
+ ) }) })
5205
+ ]
5206
+ }
5207
+ ),
5208
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_material28.Collapse, { in: expanded, timeout: "auto", children: [
5209
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.Divider, { variant: "middle" }),
5210
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material28.CardContent, { children: props.children })
5211
+ ] })
5212
+ ] });
5552
5213
  };
5553
5214
 
5554
5215
  // src/types/index.ts
@@ -5574,16 +5235,16 @@ var Services = {
5574
5235
  };
5575
5236
 
5576
5237
  // src/hooks/useUserStatus.ts
5577
- var import_react34 = require("react");
5238
+ var import_react33 = require("react");
5578
5239
  init_deviceId();
5579
5240
  init_context();
5580
5241
  var ONLINE_THRESHOLD_MINUTES = 2;
5581
5242
  var AWAY_THRESHOLD_MINUTES = 15;
5582
5243
  var useUserStatus2 = (userId, initialLastSeenAt, currentAuthUserId) => {
5583
5244
  const supabase = useSupabase();
5584
- const [status, setStatus] = (0, import_react34.useState)("offline");
5585
- const [lastSeen, setLastSeen] = (0, import_react34.useState)(initialLastSeenAt ?? null);
5586
- const lastSeenRef = (0, import_react34.useRef)(initialLastSeenAt ?? null);
5245
+ const [status, setStatus] = (0, import_react33.useState)("offline");
5246
+ const [lastSeen, setLastSeen] = (0, import_react33.useState)(initialLastSeenAt ?? null);
5247
+ const lastSeenRef = (0, import_react33.useRef)(initialLastSeenAt ?? null);
5587
5248
  lastSeenRef.current = lastSeen;
5588
5249
  const calculateStatus = (isOnline, lastSeenIso) => {
5589
5250
  if (isOnline) return "online";
@@ -5599,7 +5260,7 @@ var useUserStatus2 = (userId, initialLastSeenAt, currentAuthUserId) => {
5599
5260
  }
5600
5261
  return "offline";
5601
5262
  };
5602
- (0, import_react34.useEffect)(() => {
5263
+ (0, import_react33.useEffect)(() => {
5603
5264
  if (!userId) return;
5604
5265
  let isMounted = true;
5605
5266
  const isSelf = currentAuthUserId && userId === currentAuthUserId;
@@ -5704,19 +5365,41 @@ var Utils = {
5704
5365
  AppSettingsProvider,
5705
5366
  AuthProvider,
5706
5367
  BreadcrumbProvider,
5368
+ ButtonComponent,
5369
+ CheckboxComponent,
5370
+ CollapsedContainerComponent,
5707
5371
  ConfirmationProvider,
5372
+ CopyClipboardButtonComponent,
5373
+ EmailInputComponent,
5374
+ ErrorAlertComponent,
5375
+ ExpandableNoteComponent,
5376
+ FilterContainerComponent,
5708
5377
  Hooks,
5709
5378
  LocalizationProvider,
5379
+ MyAvatarComponent,
5380
+ NumberInputComponent,
5381
+ PageComponent,
5382
+ PageLinkComponent,
5710
5383
  Providers,
5384
+ RefreshButtonComponent,
5385
+ SearchComponent,
5386
+ SelectComponent,
5711
5387
  Services,
5712
5388
  SupabaseProvider,
5389
+ SwitchComponent,
5390
+ TextFieldComponent,
5713
5391
  ThemeProvider,
5714
5392
  ToastProvider,
5393
+ TranslatableTooltipComponent,
5715
5394
  TranslateProvider,
5716
5395
  TranslateText,
5717
5396
  TranslationEditProvider,
5718
- UI,
5397
+ UrlComponent,
5398
+ UserAvatarComponent,
5399
+ UserPopoverComponent,
5400
+ UserRoleChipComponent,
5719
5401
  UserSettingsProvider,
5402
+ UserStatusChipComponent,
5720
5403
  Utils,
5721
5404
  defaultUserSettings,
5722
5405
  initI18n,