wcz-test 2.14.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -42,7 +42,7 @@ var require_react_is_production_min = __commonJS({
42
42
  var p = b ? Symbol.for("react.suspense") : 60113;
43
43
  var q = b ? Symbol.for("react.suspense_list") : 60120;
44
44
  var r = b ? Symbol.for("react.memo") : 60115;
45
- var t = b ? Symbol.for("react.lazy") : 60116;
45
+ var t2 = b ? Symbol.for("react.lazy") : 60116;
46
46
  var v = b ? Symbol.for("react.block") : 60121;
47
47
  var w = b ? Symbol.for("react.fundamental") : 60117;
48
48
  var x = b ? Symbol.for("react.responder") : 60118;
@@ -64,7 +64,7 @@ var require_react_is_production_min = __commonJS({
64
64
  switch (a = a && a.$$typeof, a) {
65
65
  case k:
66
66
  case n:
67
- case t:
67
+ case t2:
68
68
  case r:
69
69
  case h:
70
70
  return a;
@@ -87,7 +87,7 @@ var require_react_is_production_min = __commonJS({
87
87
  exports.Element = c;
88
88
  exports.ForwardRef = n;
89
89
  exports.Fragment = e;
90
- exports.Lazy = t;
90
+ exports.Lazy = t2;
91
91
  exports.Memo = r;
92
92
  exports.Portal = d;
93
93
  exports.Profiler = g;
@@ -113,7 +113,7 @@ var require_react_is_production_min = __commonJS({
113
113
  return z2(a) === e;
114
114
  };
115
115
  exports.isLazy = function(a) {
116
- return z2(a) === t;
116
+ return z2(a) === t2;
117
117
  };
118
118
  exports.isMemo = function(a) {
119
119
  return z2(a) === r;
@@ -131,7 +131,7 @@ var require_react_is_production_min = __commonJS({
131
131
  return z2(a) === p;
132
132
  };
133
133
  exports.isValidElementType = function(a) {
134
- return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === typeof a && null !== a && (a.$$typeof === t || a.$$typeof === r || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
134
+ return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === typeof a && null !== a && (a.$$typeof === t2 || a.$$typeof === r || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
135
135
  };
136
136
  exports.typeOf = z2;
137
137
  }
@@ -1063,9 +1063,45 @@ var PageContainer = (props) => {
1063
1063
  );
1064
1064
  };
1065
1065
 
1066
+ // src/components/file/Dropzone.tsx
1067
+ import CloudUpload from "@mui/icons-material/CloudUpload";
1068
+ import { Paper, Typography as Typography2, useTheme } from "@mui/material";
1069
+ import { useDropzone } from "react-dropzone";
1070
+ import { useTranslation } from "react-i18next";
1071
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
1072
+ var baseStyle = {
1073
+ flex: 1,
1074
+ display: "flex",
1075
+ flexDirection: "column",
1076
+ alignItems: "center",
1077
+ padding: "20px",
1078
+ borderWidth: 2,
1079
+ borderRadius: 2,
1080
+ borderStyle: "dashed",
1081
+ outline: "none",
1082
+ transition: "border .24s ease-in-out",
1083
+ cursor: "pointer"
1084
+ };
1085
+ var Dropzone = ({ sx, ...props }) => {
1086
+ const { getRootProps, getInputProps, isFocused, isDragAccept, isDragReject } = useDropzone(props);
1087
+ const { t: t2 } = useTranslation();
1088
+ const theme = useTheme();
1089
+ const style = {
1090
+ ...baseStyle,
1091
+ ...isFocused ? { borderColor: theme.palette.primary.main } : {},
1092
+ ...isDragAccept ? { borderColor: theme.palette.success.main } : {},
1093
+ ...isDragReject ? { borderColor: theme.palette.error.main } : {}
1094
+ };
1095
+ return /* @__PURE__ */ jsxs2(Paper, { variant: "outlined", ...getRootProps({ style }), sx, children: [
1096
+ /* @__PURE__ */ jsx3("input", { ...getInputProps(), style: { display: "none" } }),
1097
+ /* @__PURE__ */ jsx3(CloudUpload, {}),
1098
+ /* @__PURE__ */ jsx3(Typography2, { children: t2("Layout.File.DragSomeFilesHereOrClickToSelectThem") })
1099
+ ] });
1100
+ };
1101
+
1066
1102
  // src/components/data-grid/ChipInputCell.tsx
1067
1103
  import { Chip, Stack as Stack2 } from "@mui/material";
1068
- import { jsx as jsx3 } from "react/jsx-runtime";
1104
+ import { jsx as jsx4 } from "react/jsx-runtime";
1069
1105
  var isArray = (value) => Array.isArray(value);
1070
1106
  var ChipInputCell = ({ params, slotProps, getLabel }) => {
1071
1107
  if (!params.value) return null;
@@ -1074,107 +1110,107 @@ var ChipInputCell = ({ params, slotProps, getLabel }) => {
1074
1110
  return value;
1075
1111
  };
1076
1112
  if (isArray(params.value))
1077
- return /* @__PURE__ */ jsx3(Stack2, { direction: "row", alignItems: "center", gap: 1, sx: { overflowX: "auto", height: "100%", width: params.colDef.computedWidth }, children: params.value.map(
1078
- (value, index) => /* @__PURE__ */ jsx3(Chip, { label: getLabelValue(value), ...slotProps }, `${index + 1}-chip-input-cell`)
1113
+ return /* @__PURE__ */ jsx4(Stack2, { direction: "row", alignItems: "center", gap: 1, sx: { overflowX: "auto", height: "100%", width: params.colDef.computedWidth }, children: params.value.map(
1114
+ (value, index) => /* @__PURE__ */ jsx4(Chip, { label: getLabelValue(value), ...slotProps }, `${index + 1}-chip-input-cell`)
1079
1115
  ) });
1080
- return /* @__PURE__ */ jsx3(Chip, { label: getLabelValue(params.value), ...slotProps });
1116
+ return /* @__PURE__ */ jsx4(Chip, { label: getLabelValue(params.value), ...slotProps });
1081
1117
  };
1082
1118
 
1083
1119
  // src/components/data-grid/EditableColumnHeader.tsx
1084
- import { Edit } from "@mui/icons-material";
1085
- import { jsx as jsx4 } from "react/jsx-runtime";
1120
+ import Edit from "@mui/icons-material/Edit";
1121
+ import { jsx as jsx5 } from "react/jsx-runtime";
1086
1122
  var EditableColumnHeader = ({ colDef }) => {
1087
- return /* @__PURE__ */ jsx4(TypographyWithIcon, { endIcon: /* @__PURE__ */ jsx4(Edit, { color: "disabled", fontSize: "small" }), variant: "body2", className: "MuiDataGrid-columnHeaderTitle", children: colDef.headerName });
1123
+ return /* @__PURE__ */ jsx5(TypographyWithIcon, { endIcon: /* @__PURE__ */ jsx5(Edit, { color: "disabled", fontSize: "small" }), variant: "body2", className: "MuiDataGrid-columnHeaderTitle", children: colDef.headerName });
1088
1124
  };
1089
1125
 
1090
1126
  // src/components/router/RouterButton.tsx
1091
1127
  import { Button } from "@mui/material";
1092
1128
  import { createLink } from "@tanstack/react-router";
1093
1129
  import React from "react";
1094
- import { jsx as jsx5 } from "react/jsx-runtime";
1130
+ import { jsx as jsx6 } from "react/jsx-runtime";
1095
1131
  var Component = React.forwardRef(function ButtonComponent(props, reference) {
1096
- return /* @__PURE__ */ jsx5(Button, { ref: reference, component: "a", ...props });
1132
+ return /* @__PURE__ */ jsx6(Button, { ref: reference, component: "a", ...props });
1097
1133
  });
1098
1134
  var CreatedComponent = createLink(Component);
1099
1135
  var RouterButton = (props) => {
1100
- return /* @__PURE__ */ jsx5(CreatedComponent, { preload: "intent", ...props });
1136
+ return /* @__PURE__ */ jsx6(CreatedComponent, { preload: "intent", ...props });
1101
1137
  };
1102
1138
 
1103
1139
  // src/components/router/RouterGridActionsCellItem.tsx
1104
1140
  import { GridActionsCellItem } from "@mui/x-data-grid-premium";
1105
1141
  import { createLink as createLink2 } from "@tanstack/react-router";
1106
1142
  import React2 from "react";
1107
- import { jsx as jsx6 } from "react/jsx-runtime";
1143
+ import { jsx as jsx7 } from "react/jsx-runtime";
1108
1144
  var Component2 = React2.forwardRef(
1109
1145
  function GridActionsCellItemComponent(props, reference) {
1110
- return /* @__PURE__ */ jsx6(GridActionsCellItem, { ref: reference, component: "a", ...props });
1146
+ return /* @__PURE__ */ jsx7(GridActionsCellItem, { ref: reference, component: "a", ...props });
1111
1147
  }
1112
1148
  );
1113
1149
  var CreatedComponent2 = createLink2(Component2);
1114
1150
  var RouterGridActionsCellItem = (props) => {
1115
- return /* @__PURE__ */ jsx6(CreatedComponent2, { preload: "intent", ...props });
1151
+ return /* @__PURE__ */ jsx7(CreatedComponent2, { preload: "intent", ...props });
1116
1152
  };
1117
1153
 
1118
1154
  // src/components/router/RouterIconButton.tsx
1119
1155
  import { IconButton } from "@mui/material";
1120
1156
  import { createLink as createLink3 } from "@tanstack/react-router";
1121
1157
  import React3 from "react";
1122
- import { jsx as jsx7 } from "react/jsx-runtime";
1158
+ import { jsx as jsx8 } from "react/jsx-runtime";
1123
1159
  var Component3 = React3.forwardRef(function IconButtonComponent(props, reference) {
1124
- return /* @__PURE__ */ jsx7(IconButton, { ref: reference, component: "a", ...props });
1160
+ return /* @__PURE__ */ jsx8(IconButton, { ref: reference, component: "a", ...props });
1125
1161
  });
1126
1162
  var CreatedComponent3 = createLink3(Component3);
1127
1163
  var RouterIconButton = (props) => {
1128
- return /* @__PURE__ */ jsx7(CreatedComponent3, { preload: "intent", ...props });
1164
+ return /* @__PURE__ */ jsx8(CreatedComponent3, { preload: "intent", ...props });
1129
1165
  };
1130
1166
 
1131
1167
  // src/components/router/RouterLink.tsx
1132
1168
  import { Link } from "@mui/material";
1133
1169
  import { createLink as createLink4 } from "@tanstack/react-router";
1134
1170
  import React4 from "react";
1135
- import { jsx as jsx8 } from "react/jsx-runtime";
1171
+ import { jsx as jsx9 } from "react/jsx-runtime";
1136
1172
  var Component4 = React4.forwardRef(function LinkComponent(props, reference) {
1137
- return /* @__PURE__ */ jsx8(Link, { ref: reference, ...props });
1173
+ return /* @__PURE__ */ jsx9(Link, { ref: reference, ...props });
1138
1174
  });
1139
1175
  var CreatedComponent4 = createLink4(Component4);
1140
1176
  var RouterLink = (props) => {
1141
- return /* @__PURE__ */ jsx8(CreatedComponent4, { preload: "intent", ...props });
1177
+ return /* @__PURE__ */ jsx9(CreatedComponent4, { preload: "intent", ...props });
1142
1178
  };
1143
1179
 
1144
1180
  // src/components/router/RouterTab.tsx
1145
1181
  import { Tab } from "@mui/material";
1146
1182
  import { createLink as createLink5 } from "@tanstack/react-router";
1147
1183
  import React5 from "react";
1148
- import { jsx as jsx9 } from "react/jsx-runtime";
1184
+ import { jsx as jsx10 } from "react/jsx-runtime";
1149
1185
  var Component5 = React5.forwardRef(function TabComponent(props, reference) {
1150
- return /* @__PURE__ */ jsx9(Tab, { ref: reference, component: "a", ...props });
1186
+ return /* @__PURE__ */ jsx10(Tab, { ref: reference, component: "a", ...props });
1151
1187
  });
1152
1188
  var CreatedComponent5 = createLink5(Component5);
1153
1189
  var RouterTab = (props) => {
1154
- return /* @__PURE__ */ jsx9(CreatedComponent5, { preload: "intent", ...props });
1190
+ return /* @__PURE__ */ jsx10(CreatedComponent5, { preload: "intent", ...props });
1155
1191
  };
1156
1192
 
1157
1193
  // src/components/router/RouterNotFound.tsx
1158
- import { Box, Divider, Typography as Typography2 } from "@mui/material";
1159
- import { useTranslation } from "react-i18next";
1160
- import { jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
1194
+ import { Box, Divider, Typography as Typography3 } from "@mui/material";
1195
+ import { useTranslation as useTranslation2 } from "react-i18next";
1196
+ import { jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
1161
1197
  function RouterNotFound() {
1162
- const { t } = useTranslation();
1163
- return /* @__PURE__ */ jsx10(Box, { height: "100vh", display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", textAlign: "center", px: 2, children: /* @__PURE__ */ jsxs2(Box, { display: "flex", alignItems: "center", mb: 4, children: [
1164
- /* @__PURE__ */ jsx10(Typography2, { variant: "h3", component: "span", fontWeight: 500, sx: { lineHeight: 1 }, children: "404" }),
1165
- /* @__PURE__ */ jsx10(Divider, { orientation: "vertical", flexItem: true, sx: { mx: 3 } }),
1166
- /* @__PURE__ */ jsx10(Typography2, { variant: "h5", component: "span", children: t("Layout.ThisPageCouldNotBeFound") })
1198
+ const { t: t2 } = useTranslation2();
1199
+ return /* @__PURE__ */ jsx11(Box, { height: "100vh", display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", textAlign: "center", px: 2, children: /* @__PURE__ */ jsxs3(Box, { display: "flex", alignItems: "center", mb: 4, children: [
1200
+ /* @__PURE__ */ jsx11(Typography3, { variant: "h3", component: "span", fontWeight: 500, sx: { lineHeight: 1 }, children: "404" }),
1201
+ /* @__PURE__ */ jsx11(Divider, { orientation: "vertical", flexItem: true, sx: { mx: 3 } }),
1202
+ /* @__PURE__ */ jsx11(Typography3, { variant: "h5", component: "span", children: t2("Layout.ThisPageCouldNotBeFound") })
1167
1203
  ] }) });
1168
1204
  }
1169
1205
 
1170
1206
  // src/components/router/RouterError.tsx
1171
- import { Box as Box2, Divider as Divider2, Typography as Typography3 } from "@mui/material";
1172
- import { jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
1207
+ import { Box as Box2, Divider as Divider2, Typography as Typography4 } from "@mui/material";
1208
+ import { jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
1173
1209
  var RouterError = ({ error }) => {
1174
- return /* @__PURE__ */ jsx11(Box2, { height: "100vh", display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", textAlign: "center", px: 2, children: /* @__PURE__ */ jsxs3(Box2, { display: "flex", alignItems: "center", mb: 4, children: [
1175
- /* @__PURE__ */ jsx11(Typography3, { variant: "h3", component: "span", fontWeight: 500, sx: { lineHeight: 1 }, children: error.name || "500" }),
1176
- /* @__PURE__ */ jsx11(Divider2, { orientation: "vertical", flexItem: true, sx: { mx: 3 } }),
1177
- /* @__PURE__ */ jsx11(Typography3, { variant: "h5", component: "span", children: error.message })
1210
+ return /* @__PURE__ */ jsx12(Box2, { height: "100vh", display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", textAlign: "center", px: 2, children: /* @__PURE__ */ jsxs4(Box2, { display: "flex", alignItems: "center", mb: 4, children: [
1211
+ /* @__PURE__ */ jsx12(Typography4, { variant: "h3", component: "span", fontWeight: 500, sx: { lineHeight: 1 }, children: error.name || "500" }),
1212
+ /* @__PURE__ */ jsx12(Divider2, { orientation: "vertical", flexItem: true, sx: { mx: 3 } }),
1213
+ /* @__PURE__ */ jsx12(Typography4, { variant: "h5", component: "span", children: error.message })
1178
1214
  ] }) });
1179
1215
  };
1180
1216
 
@@ -1185,8 +1221,8 @@ import { LinearProgress, useMediaQuery } from "@mui/material";
1185
1221
  function _extends() {
1186
1222
  return _extends = Object.assign ? Object.assign.bind() : function(n) {
1187
1223
  for (var e = 1; e < arguments.length; e++) {
1188
- var t = arguments[e];
1189
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
1224
+ var t2 = arguments[e];
1225
+ for (var r in t2) ({}).hasOwnProperty.call(t2, r) && (n[r] = t2[r]);
1190
1226
  }
1191
1227
  return n;
1192
1228
  }, _extends.apply(null, arguments);
@@ -1195,12 +1231,12 @@ function _extends() {
1195
1231
  // node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
1196
1232
  function _objectWithoutPropertiesLoose(r, e) {
1197
1233
  if (null == r) return {};
1198
- var t = {};
1234
+ var t2 = {};
1199
1235
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
1200
1236
  if (-1 !== e.indexOf(n)) continue;
1201
- t[n] = r[n];
1237
+ t2[n] = r[n];
1202
1238
  }
1203
- return t;
1239
+ return t2;
1204
1240
  }
1205
1241
 
1206
1242
  // node_modules/@mui/x-date-pickers/esm/LocalizationProvider/LocalizationProvider.js
@@ -1209,17 +1245,18 @@ import * as React6 from "react";
1209
1245
  import { useThemeProps } from "@mui/material/styles";
1210
1246
  import { jsx as _jsx } from "react/jsx-runtime";
1211
1247
  var _excluded = ["localeText"];
1212
- var MuiPickersAdapterContext = /* @__PURE__ */ React6.createContext(null);
1213
- if (process.env.NODE_ENV !== "production") MuiPickersAdapterContext.displayName = "MuiPickersAdapterContext";
1248
+ var PickerAdapterContext = /* @__PURE__ */ React6.createContext(null);
1249
+ if (process.env.NODE_ENV !== "production") PickerAdapterContext.displayName = "PickerAdapterContext";
1214
1250
  var LocalizationProvider = function LocalizationProvider2(inProps) {
1215
1251
  const {
1216
1252
  localeText: inLocaleText
1217
1253
  } = inProps, otherInProps = _objectWithoutPropertiesLoose(inProps, _excluded);
1218
1254
  const {
1219
- utils: parentUtils,
1255
+ adapter: parentAdapter,
1220
1256
  localeText: parentLocaleText
1221
- } = React6.useContext(MuiPickersAdapterContext) ?? {
1257
+ } = React6.useContext(PickerAdapterContext) ?? {
1222
1258
  utils: void 0,
1259
+ adapter: void 0,
1223
1260
  localeText: void 0
1224
1261
  };
1225
1262
  const props = useThemeProps({
@@ -1237,41 +1274,42 @@ var LocalizationProvider = function LocalizationProvider2(inProps) {
1237
1274
  localeText: themeLocaleText
1238
1275
  } = props;
1239
1276
  const localeText = React6.useMemo(() => _extends({}, themeLocaleText, parentLocaleText, inLocaleText), [themeLocaleText, parentLocaleText, inLocaleText]);
1240
- const utils = React6.useMemo(() => {
1277
+ const adapter = React6.useMemo(() => {
1241
1278
  if (!DateAdapter) {
1242
- if (parentUtils) {
1243
- return parentUtils;
1279
+ if (parentAdapter) {
1280
+ return parentAdapter;
1244
1281
  }
1245
1282
  return null;
1246
1283
  }
1247
- const adapter = new DateAdapter({
1284
+ const dateAdapter = new DateAdapter({
1248
1285
  locale: adapterLocale,
1249
1286
  formats: dateFormats,
1250
1287
  instance: dateLibInstance
1251
1288
  });
1252
- if (!adapter.isMUIAdapter) {
1289
+ if (!dateAdapter.isMUIAdapter) {
1253
1290
  throw new Error(["MUI X: The date adapter should be imported from `@mui/x-date-pickers` or `@mui/x-date-pickers-pro`, not from `@date-io`", "For example, `import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'` instead of `import AdapterDayjs from '@date-io/dayjs'`", "More information on the installation documentation: https://mui.com/x/react-date-pickers/quickstart/#installation"].join(`
1254
1291
  `));
1255
1292
  }
1256
- return adapter;
1257
- }, [DateAdapter, adapterLocale, dateFormats, dateLibInstance, parentUtils]);
1293
+ return dateAdapter;
1294
+ }, [DateAdapter, adapterLocale, dateFormats, dateLibInstance, parentAdapter]);
1258
1295
  const defaultDates = React6.useMemo(() => {
1259
- if (!utils) {
1296
+ if (!adapter) {
1260
1297
  return null;
1261
1298
  }
1262
1299
  return {
1263
- minDate: utils.date("1900-01-01T00:00:00.000"),
1264
- maxDate: utils.date("2099-12-31T00:00:00.000")
1300
+ minDate: adapter.date("1900-01-01T00:00:00.000"),
1301
+ maxDate: adapter.date("2099-12-31T00:00:00.000")
1265
1302
  };
1266
- }, [utils]);
1303
+ }, [adapter]);
1267
1304
  const contextValue = React6.useMemo(() => {
1268
1305
  return {
1269
- utils,
1306
+ utils: adapter,
1307
+ adapter,
1270
1308
  defaultDates,
1271
1309
  localeText
1272
1310
  };
1273
- }, [defaultDates, utils, localeText]);
1274
- return /* @__PURE__ */ _jsx(MuiPickersAdapterContext.Provider, {
1311
+ }, [defaultDates, adapter, localeText]);
1312
+ return /* @__PURE__ */ _jsx(PickerAdapterContext.Provider, {
1275
1313
  value: contextValue,
1276
1314
  children
1277
1315
  });
@@ -1630,10 +1668,10 @@ var AdapterDayjs = class {
1630
1668
  };
1631
1669
  this.expandFormat = (format) => {
1632
1670
  const localeFormats = this.getLocaleFormats();
1633
- const t = (formatBis) => formatBis.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (_, a, b) => a || b.slice(1));
1671
+ const t2 = (formatBis) => formatBis.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (_, a, b) => a || b.slice(1));
1634
1672
  return format.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (_, a, b) => {
1635
1673
  const B = b && b.toUpperCase();
1636
- return a || localeFormats[b] || t(localeFormats[B]);
1674
+ return a || localeFormats[b] || t2(localeFormats[B]);
1637
1675
  });
1638
1676
  };
1639
1677
  this.isValid = (value) => {
@@ -1840,17 +1878,11 @@ import { useRouterState } from "@tanstack/react-router";
1840
1878
  import { DashboardLayout } from "@toolpad/core/DashboardLayout";
1841
1879
  import { TanStackRouterAppProvider } from "@toolpad/core/tanstack-router";
1842
1880
  import { NotificationsProvider } from "@toolpad/core/useNotifications";
1843
- import i18n from "i18next";
1844
- import LanguageDetector from "i18next-browser-languagedetector";
1845
- import HttpBackend from "i18next-http-backend";
1846
- import { initReactI18next, useTranslation as useTranslation5 } from "react-i18next";
1847
- import { z } from "zod";
1848
- import { zodI18nMap } from "zod-i18n-map";
1849
- import zodCsTranslations from "zod-i18n-map/locales/cs/zod.json";
1850
- import zodEnTranslations from "zod-i18n-map/locales/en/zod.json";
1881
+ import { useState as useState2 } from "react";
1882
+ import { I18nextProvider, useTranslation as useTranslation5 } from "react-i18next";
1851
1883
 
1852
1884
  // src/components/core/AppTitle.tsx
1853
- import { Stack as Stack3, Typography as Typography4 } from "@mui/material";
1885
+ import { Chip as Chip2, Stack as Stack3, Typography as Typography5 } from "@mui/material";
1854
1886
 
1855
1887
  // src/contexts/LayoutContext.ts
1856
1888
  import { createContext as createContext2, useContext as useContext2 } from "react";
@@ -1858,65 +1890,55 @@ var LayoutContext = createContext2({});
1858
1890
  var useLayout = () => useContext2(LayoutContext);
1859
1891
 
1860
1892
  // src/components/core/AppTitle.tsx
1861
- import { jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
1893
+ import { jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
1862
1894
  var AppTitle = () => {
1863
1895
  const { appTitle } = useLayout();
1864
- return /* @__PURE__ */ jsxs4(Stack3, { direction: "row", alignItems: "center", spacing: 2, children: [
1865
- /* @__PURE__ */ jsx12("img", { src: "/favicon-32x32.png", alt: "app-logo", loading: "lazy" }),
1866
- /* @__PURE__ */ jsx12(Typography4, { variant: "h6", children: appTitle })
1896
+ return /* @__PURE__ */ jsxs5(Stack3, { direction: "row", alignItems: "center", spacing: 2, children: [
1897
+ /* @__PURE__ */ jsx13("img", { src: "/favicon-32x32.png", alt: "app-logo", loading: "lazy" }),
1898
+ /* @__PURE__ */ jsx13(Typography5, { variant: "h6", children: appTitle }),
1899
+ import.meta.env.DEV && /* @__PURE__ */ jsx13(Chip2, { size: "small", label: "BETA", color: "info" })
1867
1900
  ] });
1868
1901
  };
1869
1902
 
1870
- // src/components/core/DevelopmentBanner.tsx
1871
- import { Close } from "@mui/icons-material";
1872
- import { Fade, Grid, IconButton as IconButton2, Paper, Typography as Typography5 } from "@mui/material";
1873
- import { useState } from "react";
1874
- import { useTranslation as useTranslation2 } from "react-i18next";
1875
- import { jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
1876
- var DevelopmentBanner = ({ hasNavigationRoutes }) => {
1877
- const { t } = useTranslation2();
1878
- const [bannerOpen, setBannerOpen] = useState(true);
1879
- const closeBanner = () => setBannerOpen(false);
1880
- return /* @__PURE__ */ jsx13(Fade, { appear: false, in: bannerOpen, children: /* @__PURE__ */ jsx13(Paper, { square: true, elevation: 3, tabIndex: -1, sx: {
1881
- position: "fixed",
1882
- bottom: 0,
1883
- left: { xs: 0, sm: hasNavigationRoutes ? 83.3 : 0 },
1884
- right: 0,
1885
- m: 0,
1886
- p: 2,
1887
- borderWidth: 0,
1888
- borderTopWidth: 1
1889
- }, children: /* @__PURE__ */ jsxs5(Grid, { container: true, justifyContent: "space-between", alignItems: "center", children: [
1890
- /* @__PURE__ */ jsxs5(Grid, { size: 10, children: [
1891
- /* @__PURE__ */ jsx13(Typography5, { fontWeight: "bold", children: t("Layout.DevelopmentDialogTitle") }),
1892
- /* @__PURE__ */ jsx13(Typography5, { variant: "body2", children: t("Layout.DevelopmentDialogContent") })
1893
- ] }),
1894
- /* @__PURE__ */ jsx13(Grid, { size: 2, sx: { p: 1, textAlign: "right" }, children: /* @__PURE__ */ jsx13(IconButton2, { size: "small", onClick: closeBanner, children: /* @__PURE__ */ jsx13(Close, {}) }) })
1895
- ] }) }) });
1903
+ // src/components/core/ToolbarAccount.tsx
1904
+ import AccountCircle from "@mui/icons-material/AccountCircle";
1905
+ import ArrowBack from "@mui/icons-material/ArrowBack";
1906
+ import Brightness4 from "@mui/icons-material/Brightness4";
1907
+ import ChevronRight from "@mui/icons-material/ChevronRight";
1908
+ import DarkMode from "@mui/icons-material/DarkMode";
1909
+ import LightMode from "@mui/icons-material/LightMode";
1910
+ import Login from "@mui/icons-material/Login";
1911
+ import Logout from "@mui/icons-material/Logout";
1912
+ import SettingsBrightness from "@mui/icons-material/SettingsBrightness";
1913
+ import Translate from "@mui/icons-material/Translate";
1914
+ import { Avatar, Box as Box3, IconButton as IconButton2, List, ListItem, ListItemButton, ListItemIcon, ListItemText, ListSubheader, Menu, Typography as Typography6, useColorScheme } from "@mui/material";
1915
+ import { Fragment, useState } from "react";
1916
+ import { useTranslation as useTranslation3 } from "react-i18next";
1917
+
1918
+ // src/auth-test/keycloak.ts
1919
+ import { useRouter } from "@tanstack/react-router";
1920
+ import Keycloak from "keycloak-js";
1921
+ var keycloakConfig = {
1922
+ url: import.meta.env.VITE_KEYCLOAK_URL,
1923
+ realm: import.meta.env.VITE_KEYCLOAK_REALM,
1924
+ clientId: import.meta.env.VITE_KEYCLOAK_CLIENT_ID,
1925
+ idpHint: import.meta.env.VITE_KEYCLOAK_IDP_HINT,
1926
+ confidentialClientId: import.meta.env.VITE_KEYCLOAK_CONFIDENTIAL_CLIENT_ID,
1927
+ confidentialClientSecret: import.meta.env.VITE_KEYCLOAK_CONFIDENTIAL_CLIENT_SECRET
1896
1928
  };
1929
+ function useKeycloak() {
1930
+ const routerContext = useRouter();
1931
+ const keycloak = routerContext.options.context.keycloak;
1932
+ return keycloak;
1933
+ }
1897
1934
 
1898
1935
  // src/components/core/ToolbarAccount.tsx
1899
- import { AccountCircle, ArrowBack, Brightness4, ChevronRight, DarkMode, LightMode, Login, Logout, SettingsBrightness, Translate } from "@mui/icons-material";
1900
- import { Avatar, Box as Box3, IconButton as IconButton3, List, ListItem, ListItemButton, ListItemIcon, ListItemText, ListSubheader, Menu, Typography as Typography6, useColorScheme } from "@mui/material";
1901
- import { Fragment, useState as useState2 } from "react";
1902
- import { useTranslation as useTranslation3 } from "react-i18next";
1903
1936
  import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
1904
- var user = {
1905
- name: "Dalibor Homola",
1906
- employeeId: "C2503017",
1907
- department: "MD0L50",
1908
- login: () => {
1909
- console.log("Login");
1910
- },
1911
- logout: () => {
1912
- console.log("Logout");
1913
- }
1914
- };
1915
1937
  var ToolbarAccount = () => {
1916
- const [anchorElement, setAnchorElement] = useState2();
1917
- const [tab, setTab] = useState2("settings");
1938
+ const [anchorElement, setAnchorElement] = useState();
1939
+ const [tab, setTab] = useState("settings");
1918
1940
  const open = Boolean(anchorElement);
1919
- const { t, i18n: i18n2 } = useTranslation3();
1941
+ const { t: t2, i18n: i18n2 } = useTranslation3();
1920
1942
  const { mode, setMode } = useColorScheme();
1921
1943
  const changeLanguage = (newLanguage) => () => {
1922
1944
  i18n2.changeLanguage(newLanguage).finally(() => closeMenu());
@@ -1925,20 +1947,23 @@ var ToolbarAccount = () => {
1925
1947
  setMode(newMode);
1926
1948
  closeMenu();
1927
1949
  };
1950
+ const keycloak = useKeycloak();
1951
+ const user = keycloak.user;
1928
1952
  const getModeText = () => {
1929
1953
  switch (mode) {
1930
1954
  case "light": {
1931
- return t("Layout.Light");
1955
+ return t2("Layout.Light");
1932
1956
  }
1933
1957
  case "dark": {
1934
- return t("Layout.Dark");
1958
+ return t2("Layout.Dark");
1935
1959
  }
1936
1960
  default: {
1937
- return t("Layout.System");
1961
+ return t2("Layout.System");
1938
1962
  }
1939
1963
  }
1940
1964
  };
1941
1965
  const usernameInitials = () => {
1966
+ if (!user?.name) return "";
1942
1967
  const splittedName = user.name.split(" ");
1943
1968
  return `${splittedName[0][0]}${splittedName.length > 1 ? splittedName[1][0] : ""}`;
1944
1969
  };
@@ -1947,63 +1972,61 @@ var ToolbarAccount = () => {
1947
1972
  setAnchorElement(void 0);
1948
1973
  setTimeout(() => setTab("settings"), 300);
1949
1974
  };
1950
- const login = () => user.login();
1951
- const logout = () => user.logout();
1952
1975
  const changeTab = (newTab) => () => setTab(newTab);
1953
- const settings = /* @__PURE__ */ jsxs6(List, { component: "nav", subheader: /* @__PURE__ */ jsx14(ListSubheader, { sx: { backgroundColor: "transparent" }, children: t("Layout.Settings") }), children: [
1976
+ const settings = /* @__PURE__ */ jsxs6(List, { component: "nav", subheader: /* @__PURE__ */ jsx14(ListSubheader, { sx: { backgroundColor: "transparent" }, children: t2("Layout.Settings") }), children: [
1954
1977
  /* @__PURE__ */ jsxs6(ListItemButton, { onClick: changeTab("theme"), sx: { py: 0.3 }, children: [
1955
1978
  /* @__PURE__ */ jsx14(ListItemIcon, { children: /* @__PURE__ */ jsx14(Brightness4, {}) }),
1956
- /* @__PURE__ */ jsx14(ListItemText, { primary: t("Layout.Appearance"), secondary: getModeText() }),
1979
+ /* @__PURE__ */ jsx14(ListItemText, { primary: t2("Layout.Appearance"), secondary: getModeText() }),
1957
1980
  /* @__PURE__ */ jsx14(ChevronRight, {})
1958
1981
  ] }),
1959
1982
  /* @__PURE__ */ jsxs6(ListItemButton, { onClick: changeTab("language"), sx: { py: 0.3 }, children: [
1960
1983
  /* @__PURE__ */ jsx14(ListItemIcon, { children: /* @__PURE__ */ jsx14(Translate, {}) }),
1961
- /* @__PURE__ */ jsx14(ListItemText, { primary: t("Layout.Language"), secondary: i18n2.resolvedLanguage === "en" ? "English" : "\u010Ce\u0161tina" }),
1984
+ /* @__PURE__ */ jsx14(ListItemText, { primary: t2("Layout.Language"), secondary: i18n2.resolvedLanguage === "en" ? "English" : "\u010Ce\u0161tina" }),
1962
1985
  /* @__PURE__ */ jsx14(ChevronRight, {})
1963
1986
  ] })
1964
1987
  ] });
1965
1988
  const theme = /* @__PURE__ */ jsxs6(List, { subheader: /* @__PURE__ */ jsxs6(ListSubheader, { onClick: changeTab("settings"), sx: { backgroundColor: "transparent", display: "flex", alignItems: "center", px: 1, cursor: "pointer" }, children: [
1966
- /* @__PURE__ */ jsx14(IconButton3, { size: "small", sx: { mr: 0.5 }, children: /* @__PURE__ */ jsx14(ArrowBack, { fontSize: "small" }) }),
1989
+ /* @__PURE__ */ jsx14(IconButton2, { size: "small", sx: { mr: 0.5 }, children: /* @__PURE__ */ jsx14(ArrowBack, { fontSize: "small" }) }),
1967
1990
  " ",
1968
- t("Layout.Appearance")
1991
+ t2("Layout.Appearance")
1969
1992
  ] }), children: [
1970
1993
  /* @__PURE__ */ jsxs6(ListItemButton, { onClick: changeMode("light"), disabled: mode === "light", children: [
1971
1994
  /* @__PURE__ */ jsx14(ListItemIcon, { children: /* @__PURE__ */ jsx14(LightMode, {}) }),
1972
- /* @__PURE__ */ jsx14(ListItemText, { primary: t("Layout.Light") })
1995
+ /* @__PURE__ */ jsx14(ListItemText, { primary: t2("Layout.Light") })
1973
1996
  ] }),
1974
1997
  /* @__PURE__ */ jsxs6(ListItemButton, { onClick: changeMode("dark"), disabled: mode === "dark", children: [
1975
1998
  /* @__PURE__ */ jsx14(ListItemIcon, { children: /* @__PURE__ */ jsx14(DarkMode, {}) }),
1976
- /* @__PURE__ */ jsx14(ListItemText, { primary: t("Layout.Dark") })
1999
+ /* @__PURE__ */ jsx14(ListItemText, { primary: t2("Layout.Dark") })
1977
2000
  ] }),
1978
2001
  /* @__PURE__ */ jsxs6(ListItemButton, { onClick: changeMode("system"), disabled: mode === "system", children: [
1979
2002
  /* @__PURE__ */ jsx14(ListItemIcon, { children: /* @__PURE__ */ jsx14(SettingsBrightness, {}) }),
1980
- /* @__PURE__ */ jsx14(ListItemText, { primary: t("Layout.System") })
2003
+ /* @__PURE__ */ jsx14(ListItemText, { primary: t2("Layout.System") })
1981
2004
  ] })
1982
2005
  ] });
1983
2006
  const language = /* @__PURE__ */ jsxs6(List, { subheader: /* @__PURE__ */ jsxs6(ListSubheader, { onClick: changeTab("settings"), sx: { backgroundColor: "transparent", display: "flex", alignItems: "center", px: 1, cursor: "pointer" }, children: [
1984
- /* @__PURE__ */ jsx14(IconButton3, { size: "small", sx: { mr: 0.5 }, children: /* @__PURE__ */ jsx14(ArrowBack, { fontSize: "small" }) }),
2007
+ /* @__PURE__ */ jsx14(IconButton2, { size: "small", sx: { mr: 0.5 }, children: /* @__PURE__ */ jsx14(ArrowBack, { fontSize: "small" }) }),
1985
2008
  " ",
1986
- t("Layout.Language")
2009
+ t2("Layout.Language")
1987
2010
  ] }), children: [
1988
2011
  /* @__PURE__ */ jsx14(ListItemButton, { onClick: changeLanguage("en"), disabled: i18n2.resolvedLanguage === "en", children: /* @__PURE__ */ jsx14(ListItemText, { primary: "English" }) }),
1989
2012
  /* @__PURE__ */ jsx14(ListItemButton, { onClick: changeLanguage("cs"), disabled: i18n2.resolvedLanguage === "cs", children: /* @__PURE__ */ jsx14(ListItemText, { primary: "\u010Ce\u0161tina" }) })
1990
2013
  ] });
1991
2014
  return /* @__PURE__ */ jsxs6(Fragment, { children: [
1992
- /* @__PURE__ */ jsx14(IconButton3, { size: "small", onClick: openMenu, children: user.name ? /* @__PURE__ */ jsx14(Avatar, { sx: { width: { xs: 32, sm: 40 }, height: { xs: 32, sm: 40 }, bgcolor: "primary.main" }, children: /* @__PURE__ */ jsx14(Typography6, { variant: "subtitle2", sx: { fontWeight: "bold", lineHeight: 0 }, children: usernameInitials() }) }) : /* @__PURE__ */ jsx14(AccountCircle, {}) }),
2015
+ /* @__PURE__ */ jsx14(IconButton2, { size: "small", onClick: openMenu, children: user?.name ? /* @__PURE__ */ jsx14(Avatar, { sx: { width: { xs: 32, sm: 40 }, height: { xs: 32, sm: 40 }, bgcolor: "primary.main" }, children: /* @__PURE__ */ jsx14(Typography6, { variant: "subtitle2", sx: { fontWeight: "bold", lineHeight: 0 }, children: usernameInitials() }) }) : /* @__PURE__ */ jsx14(AccountCircle, {}) }),
1993
2016
  /* @__PURE__ */ jsx14(Menu, { anchorEl: anchorElement, open, onClose: closeMenu, children: /* @__PURE__ */ jsxs6(Box3, { sx: { width: 240 }, children: [
1994
- /* @__PURE__ */ jsx14(List, { children: user.name ? /* @__PURE__ */ jsxs6(Fragment, { children: [
2017
+ /* @__PURE__ */ jsx14(List, { children: user?.name ? /* @__PURE__ */ jsxs6(Fragment, { children: [
1995
2018
  /* @__PURE__ */ jsx14(ListItem, { children: /* @__PURE__ */ jsx14(ListItemText, { primary: user.name, secondary: /* @__PURE__ */ jsxs6("span", { children: [
1996
2019
  /* @__PURE__ */ jsx14("span", { children: user.employeeId }),
1997
2020
  /* @__PURE__ */ jsx14("br", {}),
1998
2021
  /* @__PURE__ */ jsx14("span", { children: user.department })
1999
2022
  ] }) }) }),
2000
- /* @__PURE__ */ jsxs6(ListItemButton, { onClick: logout, children: [
2023
+ /* @__PURE__ */ jsxs6(ListItemButton, { onClick: () => keycloak.logout(), children: [
2001
2024
  /* @__PURE__ */ jsx14(ListItemIcon, { children: /* @__PURE__ */ jsx14(Logout, { color: "error" }) }),
2002
- /* @__PURE__ */ jsx14(ListItemText, { primary: t("Layout.Logout") })
2025
+ /* @__PURE__ */ jsx14(ListItemText, { primary: t2("Layout.Logout") })
2003
2026
  ] })
2004
- ] }) : /* @__PURE__ */ jsxs6(ListItemButton, { onClick: login, children: [
2027
+ ] }) : /* @__PURE__ */ jsxs6(ListItemButton, { onClick: () => keycloak.login(), children: [
2005
2028
  /* @__PURE__ */ jsx14(ListItemIcon, { children: /* @__PURE__ */ jsx14(Login, { color: "success" }) }),
2006
- /* @__PURE__ */ jsx14(ListItemText, { primary: t("Layout.LogIn") })
2029
+ /* @__PURE__ */ jsx14(ListItemText, { primary: t2("Layout.LogIn") })
2007
2030
  ] }) }),
2008
2031
  tab === "settings" && settings,
2009
2032
  tab === "theme" && theme,
@@ -2070,11 +2093,6 @@ var useGetTheme = (theme) => {
2070
2093
  };
2071
2094
  }
2072
2095
  },
2073
- MuiTextField: {
2074
- defaultProps: {
2075
- fullWidth: true
2076
- }
2077
- },
2078
2096
  MuiTableContainer: {
2079
2097
  styleOverrides: {
2080
2098
  root: ({ theme: theme2 }) => ({
@@ -2100,16 +2118,6 @@ var useGetTheme = (theme) => {
2100
2118
  })
2101
2119
  }
2102
2120
  },
2103
- MuiDialog: {
2104
- defaultProps: {
2105
- fullWidth: true
2106
- }
2107
- },
2108
- MuiContainer: {
2109
- defaultProps: {
2110
- maxWidth: false
2111
- }
2112
- },
2113
2121
  ...theme?.components
2114
2122
  }
2115
2123
  },
@@ -2119,38 +2127,54 @@ var useGetTheme = (theme) => {
2119
2127
  );
2120
2128
  };
2121
2129
 
2122
- // src/providers/LayoutProvider.tsx
2123
- import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
2130
+ // src/utils/i18n.ts
2131
+ import i18n from "i18next";
2132
+ import { initReactI18next } from "react-i18next";
2133
+ import HttpBackend from "i18next-http-backend";
2134
+ import LanguageDetector from "i18next-browser-languagedetector";
2135
+ import { z } from "zod";
2136
+ import { zodI18nMap } from "zod-i18n-map";
2137
+ import zodCsTranslations from "zod-i18n-map/locales/cs/zod.json";
2138
+ import zodEnTranslations from "zod-i18n-map/locales/en/zod.json";
2139
+ import { default as default2 } from "i18next";
2124
2140
  i18n.use(HttpBackend).use(LanguageDetector).use(initReactI18next).init({
2125
2141
  fallbackLng: "en",
2126
2142
  interpolation: {
2127
2143
  escapeValue: false
2144
+ },
2145
+ react: {
2146
+ useSuspense: false
2128
2147
  }
2129
2148
  });
2130
2149
  i18n.addResourceBundle("en", "zod", zodEnTranslations);
2131
2150
  i18n.addResourceBundle("cs", "zod", zodCsTranslations);
2132
2151
  z.setErrorMap(zodI18nMap);
2152
+
2153
+ // src/providers/LayoutProvider.tsx
2154
+ import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
2133
2155
  var LayoutProvider = (props) => {
2134
2156
  const rootRouterState = useRouterState({ select: (s) => s.matches[0] });
2135
2157
  const theme = useGetTheme(props.theme);
2136
- const { t, i18n: i18n2 } = useTranslation5();
2158
+ const { t: t2 } = useTranslation5();
2137
2159
  const isFetching = !!useIsFetching();
2138
2160
  const isMutating = !!useIsMutating();
2139
2161
  const isLargeScreen = useMediaQuery(theme.breakpoints.up("sm"));
2140
- const user2 = { name: "Dalibor", department: "MD0L50", employeeId: "C2503017", company: "", category: "" };
2141
- const navigation = props.getNavigation ? props.getNavigation({ user: user2, t }) : [];
2162
+ const [user, setUser] = useState2({ employeeId: "", name: "Unknown", department: "", company: "", category: "" });
2163
+ const navigation = props.getNavigation?.({ user, t: t2 });
2142
2164
  const appTitle = rootRouterState.meta?.find((meta) => meta?.title)?.title;
2143
2165
  if (!appTitle)
2144
2166
  throw new Error("Title is not defined in the RootRoute head.");
2145
- return /* @__PURE__ */ jsx15(LocalizationProvider, { dateAdapter: AdapterDayjs, adapterLocale: i18n2.resolvedLanguage, children: /* @__PURE__ */ jsx15(TanStackRouterAppProvider, { navigation, theme, localeText: {
2146
- confirm: t("Layout.Confirm"),
2147
- cancel: t("Layout.Cancel"),
2148
- alert: t("Layout.Alert")
2149
- }, children: /* @__PURE__ */ jsx15(NotificationsProvider, { slotProps: { snackbar: { anchorOrigin: { vertical: isLargeScreen ? "top" : "bottom", horizontal: "center" } } }, children: /* @__PURE__ */ jsx15(LayoutContext.Provider, { value: { appTitle }, children: /* @__PURE__ */ jsxs7(
2167
+ return /* @__PURE__ */ jsx15(I18nextProvider, { i18n: default2, children: /* @__PURE__ */ jsx15(LocalizationProvider, { dateAdapter: AdapterDayjs, adapterLocale: default2.resolvedLanguage, children: /* @__PURE__ */ jsx15(TanStackRouterAppProvider, { navigation, theme, localeText: {
2168
+ confirm: t2("Layout.Dialog.Confirm"),
2169
+ cancel: t2("Layout.Dialog.Cancel"),
2170
+ alert: t2("Layout.Dialog.Alert")
2171
+ }, children: /* @__PURE__ */ jsx15(NotificationsProvider, { slotProps: { snackbar: { anchorOrigin: { vertical: isLargeScreen ? "top" : "bottom", horizontal: "center" } } }, children: /* @__PURE__ */ jsx15(LayoutContext.Provider, { value: { appTitle, user: { get: user, set: setUser } }, children: /* @__PURE__ */ jsxs7(
2150
2172
  DashboardLayout,
2151
2173
  {
2152
- defaultSidebarCollapsed: true,
2153
- hideNavigation: navigation.length === 0,
2174
+ defaultSidebarCollapsed: props.defaultSidebarCollapsed ?? true,
2175
+ disableCollapsibleSidebar: props.disableCollapsibleSidebar,
2176
+ sidebarExpandedWidth: props.sidebarExpandedWidth,
2177
+ hideNavigation: navigation?.length === 0,
2154
2178
  slots: {
2155
2179
  toolbarActions: () => null,
2156
2180
  toolbarAccount: ToolbarAccount,
@@ -2158,31 +2182,33 @@ var LayoutProvider = (props) => {
2158
2182
  },
2159
2183
  children: [
2160
2184
  props.children,
2161
- /* @__PURE__ */ jsx15(DevelopmentBanner, { hasNavigationRoutes: navigation.length > 0 }),
2162
2185
  (isFetching || isMutating) && /* @__PURE__ */ jsx15(LinearProgress, { sx: { position: "fixed", top: { xs: 56, sm: 64 }, left: 0, right: 0 } })
2163
2186
  ]
2164
2187
  }
2165
- ) }) }) }) });
2188
+ ) }) }) }) }) });
2166
2189
  };
2167
2190
 
2168
2191
  // src/index.ts
2169
- import { uuidv7 } from "uuidv7";
2192
+ import { uuidv7 as uuidv72 } from "uuidv7";
2170
2193
 
2171
2194
  // src/utils/ClientUtils.ts
2172
- import { useQueryClient } from "@tanstack/react-query";
2173
2195
  import axios from "axios";
2174
2196
  var Platform = class {
2175
- static isAndroid = /android/i.test(navigator.userAgent);
2176
- static isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent);
2177
- static isWindows = /windows/i.test(navigator.userAgent);
2178
- static isMacOS = /Macintosh|MacIntel|MacPPC|Mac68K/.test(navigator.userAgent);
2179
- };
2180
- var getContrastTextColor = (color) => {
2181
- const r = Number.parseInt(color.slice(1, 3), 16);
2182
- const g = Number.parseInt(color.slice(3, 5), 16);
2183
- const b = Number.parseInt(color.slice(5, 7), 16);
2184
- const yiq = (r * 299 + g * 587 + b * 114) / 1e3;
2185
- return yiq >= 128 ? "black" : "white";
2197
+ static get isAndroid() {
2198
+ return /android/i.test(this.userAgent);
2199
+ }
2200
+ static get isIOS() {
2201
+ return /iPad|iPhone|iPod/.test(this.userAgent);
2202
+ }
2203
+ static get isWindows() {
2204
+ return /windows/i.test(this.userAgent);
2205
+ }
2206
+ static get isMacOS() {
2207
+ return /Macintosh|MacIntel|MacPPC|Mac68K/.test(this.userAgent);
2208
+ }
2209
+ static get userAgent() {
2210
+ return typeof navigator === "undefined" ? "" : navigator.userAgent;
2211
+ }
2186
2212
  };
2187
2213
  var rootRouteHead = ({ title }) => () => ({
2188
2214
  meta: [
@@ -2202,9 +2228,6 @@ var rootRouteHead = ({ title }) => () => ({
2202
2228
  ]
2203
2229
  });
2204
2230
  var wczApiClient = axios.create();
2205
- wczApiClient.interceptors.request.use(async (config) => {
2206
- return config;
2207
- });
2208
2231
 
2209
2232
  // src/hooks/FormHooks.ts
2210
2233
  import { createFormHook, createFormHookContexts } from "@tanstack/react-form";
@@ -2510,12 +2533,14 @@ import { useDialogs } from "@toolpad/core/useDialogs";
2510
2533
  import { useNotifications } from "@toolpad/core/useNotifications";
2511
2534
  import { useLocalStorageState } from "@toolpad/core/useLocalStorageState";
2512
2535
  import { useTranslation as useTranslation6 } from "react-i18next";
2536
+ import { t } from "i18next";
2513
2537
 
2514
2538
  // src/hooks/FileHooks.ts
2515
- import { useMutation, useQuery, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
2539
+ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
2516
2540
  import saveAs from "file-saver";
2517
2541
  import { useState as useState3 } from "react";
2518
2542
  import { Upload as TusUpload } from "tus-js-client";
2543
+ import { uuidv7 } from "uuidv7";
2519
2544
  var BASE_URL = import.meta.env.VITE_FILE_API_BASE_URL;
2520
2545
  var QUERY_KEY = "Files";
2521
2546
  var HOUR = 1e3 * 60 * 60;
@@ -2597,7 +2622,7 @@ var useOpenFile = (options) => {
2597
2622
  };
2598
2623
  var useUpdateFileMeta = (options) => {
2599
2624
  const { appTitle } = useLayout();
2600
- const queryClient = useQueryClient2();
2625
+ const queryClient = useQueryClient();
2601
2626
  return useMutation({
2602
2627
  ...options,
2603
2628
  mutationFn: (meta) => wczApiClient.request({
@@ -2610,7 +2635,7 @@ var useUpdateFileMeta = (options) => {
2610
2635
  };
2611
2636
  var useDeleteFile = (options) => {
2612
2637
  const { appTitle } = useLayout();
2613
- const queryClient = useQueryClient2();
2638
+ const queryClient = useQueryClient();
2614
2639
  return useMutation({
2615
2640
  ...options,
2616
2641
  mutationFn: (meta) => wczApiClient.request({
@@ -2622,7 +2647,7 @@ var useDeleteFile = (options) => {
2622
2647
  };
2623
2648
  var useDeleteFiles = (options) => {
2624
2649
  const { appTitle } = useLayout();
2625
- const queryClient = useQueryClient2();
2650
+ const queryClient = useQueryClient();
2626
2651
  return useMutation({
2627
2652
  ...options,
2628
2653
  mutationFn: (subId) => wczApiClient.request({
@@ -2634,32 +2659,39 @@ var useDeleteFiles = (options) => {
2634
2659
  };
2635
2660
  var useUploadFile = ({ subId, onSuccess, onError }) => {
2636
2661
  const { appTitle } = useLayout();
2637
- const [uploadProgress, setUploadProgress] = useState3(0);
2638
- const queryClient = useQueryClient2();
2662
+ const [progress, setProgress] = useState3(0);
2663
+ const queryClient = useQueryClient();
2639
2664
  const mutate = async (file) => {
2640
2665
  if (!subId) throw new Error("subId is required for file upload");
2666
+ const metadata = {
2667
+ id: uuidv7(),
2668
+ appName: appTitle,
2669
+ subId,
2670
+ fileName: file.name
2671
+ };
2641
2672
  const upload = new TusUpload(file, {
2642
2673
  endpoint: `${BASE_URL}/v1/upload`,
2643
2674
  chunkSize: 1048576,
2644
2675
  // 1 MB
2645
2676
  metadata: {
2646
- appName: appTitle,
2647
- subId,
2648
- filename: file.name,
2649
- filetype: file.type
2677
+ id: metadata.id,
2678
+ appName: metadata.appName,
2679
+ subId: metadata.subId,
2680
+ fileName: metadata.fileName,
2681
+ fileExtension: file.type
2650
2682
  },
2651
2683
  //headers: { "Authorization": `Bearer ${await getToken()}` }, //TODO: implement token retrieval
2652
2684
  onError: (error) => {
2653
- setUploadProgress(0);
2685
+ setProgress(0);
2654
2686
  onError?.(error);
2655
2687
  },
2656
2688
  onProgress: (bytesUploaded, bytesTotal) => {
2657
- setUploadProgress(bytesUploaded / bytesTotal * 100);
2689
+ setProgress(bytesUploaded / bytesTotal * 100);
2658
2690
  },
2659
2691
  onSuccess: () => {
2660
- setUploadProgress(0);
2692
+ setProgress(0);
2661
2693
  queryClient.invalidateQueries({ queryKey: [QUERY_KEY, "meta"], exact: false });
2662
- onSuccess?.(file);
2694
+ onSuccess?.(metadata);
2663
2695
  }
2664
2696
  });
2665
2697
  const previousUploads = await upload.findPreviousUploads();
@@ -2668,10 +2700,48 @@ var useUploadFile = ({ subId, onSuccess, onError }) => {
2668
2700
  }
2669
2701
  upload.start();
2670
2702
  };
2671
- return { mutate, uploadProgress };
2703
+ return { mutate, progress };
2672
2704
  };
2705
+ function useOptimisticFileMutation(subId, options) {
2706
+ const [uploadedFileIds, setUploadedFileIds] = useState3([]);
2707
+ const [deletedFileIds, setDeletedFileIds] = useState3([]);
2708
+ const { data } = useGetFileMetas(subId, options);
2709
+ const { mutate: deleteAttachment } = useDeleteFile();
2710
+ function addFile(meta) {
2711
+ setUploadedFileIds((previous) => [...previous, meta.id]);
2712
+ }
2713
+ function removeFile(meta) {
2714
+ const added = uploadedFileIds.includes(meta.id);
2715
+ if (added) {
2716
+ setUploadedFileIds((previous) => previous.filter((file) => file !== meta.id));
2717
+ } else {
2718
+ setDeletedFileIds((previous) => [...previous, meta.id]);
2719
+ }
2720
+ }
2721
+ function save() {
2722
+ for (const id of deletedFileIds) {
2723
+ const meta = data.find((meta2) => meta2.id === id);
2724
+ if (!meta) continue;
2725
+ deleteAttachment(meta);
2726
+ }
2727
+ }
2728
+ function undo() {
2729
+ for (const id of uploadedFileIds) {
2730
+ const meta = data.find((meta2) => meta2.id === id);
2731
+ if (!meta) continue;
2732
+ deleteAttachment(meta);
2733
+ }
2734
+ }
2735
+ return {
2736
+ addFile,
2737
+ removeFile,
2738
+ save,
2739
+ undo
2740
+ };
2741
+ }
2673
2742
  export {
2674
2743
  ChipInputCell,
2744
+ Dropzone,
2675
2745
  EditableColumnHeader,
2676
2746
  LayoutProvider,
2677
2747
  PageContainer,
@@ -2685,8 +2755,8 @@ export {
2685
2755
  RouterNotFound,
2686
2756
  RouterTab,
2687
2757
  TypographyWithIcon,
2688
- getContrastTextColor,
2689
2758
  rootRouteHead,
2759
+ t,
2690
2760
  useDeleteFile,
2691
2761
  useDeleteFiles,
2692
2762
  useDialogs,
@@ -2700,10 +2770,11 @@ export {
2700
2770
  useLocalStorageState,
2701
2771
  useNotifications,
2702
2772
  useOpenFile,
2773
+ useOptimisticFileMutation,
2703
2774
  useTranslation6 as useTranslation,
2704
2775
  useUpdateFileMeta,
2705
2776
  useUploadFile,
2706
- uuidv7,
2777
+ uuidv72 as uuidv7,
2707
2778
  wczApiClient,
2708
2779
  withLayoutForm
2709
2780
  };