@serhii.olishevskyi/docs 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -0
- package/dist/index.d.mts +136 -60
- package/dist/index.d.ts +136 -60
- package/dist/index.js +467 -191
- package/dist/index.mjs +433 -149
- package/package.json +9 -6
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/UI/components/inputs/
|
|
1
|
+
// src/UI/components/inputs/TextFieldComponent.tsx
|
|
2
2
|
import { useState as useState5 } from "react";
|
|
3
3
|
import {
|
|
4
4
|
TextField as TextField2,
|
|
@@ -13,8 +13,8 @@ import CheckIcon from "@mui/icons-material/Check";
|
|
|
13
13
|
import ClearIcon from "@mui/icons-material/Clear";
|
|
14
14
|
import TranslateIcon3 from "@mui/icons-material/Translate";
|
|
15
15
|
|
|
16
|
-
// src/UI/components/
|
|
17
|
-
import { Tooltip } from "@mui/material";
|
|
16
|
+
// src/UI/components/data.display/TranslatableTooltipComponent.tsx
|
|
17
|
+
import { Tooltip as Tooltip2 } from "@mui/material";
|
|
18
18
|
|
|
19
19
|
// src/context/TranslationEditProvider.tsx
|
|
20
20
|
import { createContext as createContext3, useContext as useContext3, useState as useState2, useEffect as useEffect2, useCallback as useCallback2 } from "react";
|
|
@@ -2527,39 +2527,33 @@ var useTranslationEdit = () => {
|
|
|
2527
2527
|
return context;
|
|
2528
2528
|
};
|
|
2529
2529
|
|
|
2530
|
-
// src/
|
|
2531
|
-
import {
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
...props
|
|
2537
|
-
}) => {
|
|
2538
|
-
const { isTranslationMode } = useTranslationEdit();
|
|
2539
|
-
return /* @__PURE__ */ jsx4(
|
|
2540
|
-
Tooltip,
|
|
2541
|
-
{
|
|
2542
|
-
title,
|
|
2543
|
-
slotProps: {
|
|
2544
|
-
popper: {
|
|
2545
|
-
sx: isTranslationMode ? {
|
|
2546
|
-
pointerEvents: "auto",
|
|
2547
|
-
// Разрешаем клики внутри тултипа
|
|
2548
|
-
"& .MuiTooltip-tooltip": {
|
|
2549
|
-
pointerEvents: "auto"
|
|
2550
|
-
}
|
|
2551
|
-
} : void 0
|
|
2552
|
-
}
|
|
2553
|
-
},
|
|
2554
|
-
leaveDelay: isTranslationMode ? 1e3 : 100,
|
|
2555
|
-
...props,
|
|
2556
|
-
children: disableSpan ? children : /* @__PURE__ */ jsx4("span", { children })
|
|
2557
|
-
}
|
|
2558
|
-
);
|
|
2559
|
-
};
|
|
2530
|
+
// src/i18n/TranslateText.tsx
|
|
2531
|
+
import { useState as useState4, useRef as useRef2, useEffect as useEffect4 } from "react";
|
|
2532
|
+
import { useTranslation } from "react-i18next";
|
|
2533
|
+
import { Box as Box2, Popper, Paper as Paper2, MenuList, MenuItem, ListItemIcon, ListItemText } from "@mui/material";
|
|
2534
|
+
import TranslateIcon2 from "@mui/icons-material/Translate";
|
|
2535
|
+
import LaunchIcon from "@mui/icons-material/Launch";
|
|
2560
2536
|
|
|
2561
|
-
// src/
|
|
2562
|
-
import {
|
|
2537
|
+
// src/i18n/TranslationDialog.tsx
|
|
2538
|
+
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
2539
|
+
import {
|
|
2540
|
+
Dialog,
|
|
2541
|
+
DialogTitle,
|
|
2542
|
+
DialogContent,
|
|
2543
|
+
DialogActions,
|
|
2544
|
+
Button,
|
|
2545
|
+
TextField,
|
|
2546
|
+
Box,
|
|
2547
|
+
Typography,
|
|
2548
|
+
CircularProgress,
|
|
2549
|
+
IconButton,
|
|
2550
|
+
Tooltip,
|
|
2551
|
+
Paper,
|
|
2552
|
+
Alert
|
|
2553
|
+
} from "@mui/material";
|
|
2554
|
+
import AutoFixHighIcon from "@mui/icons-material/AutoFixHigh";
|
|
2555
|
+
import TranslateIcon from "@mui/icons-material/Translate";
|
|
2556
|
+
import LightbulbIcon from "@mui/icons-material/Lightbulb";
|
|
2563
2557
|
|
|
2564
2558
|
// src/services/translation.service.ts
|
|
2565
2559
|
var translationService = {
|
|
@@ -2620,38 +2614,10 @@ ${params.contextHint ? `Context Hint: "${params.contextHint}"` : ""}`;
|
|
|
2620
2614
|
}
|
|
2621
2615
|
};
|
|
2622
2616
|
|
|
2623
|
-
// src/i18n/TranslateText.tsx
|
|
2624
|
-
import { useState as useState4, useRef as useRef2, useEffect as useEffect4 } from "react";
|
|
2625
|
-
import { useTranslation } from "react-i18next";
|
|
2626
|
-
import { Box as Box2, Popper, Paper as Paper2, MenuList, MenuItem, ListItemIcon, ListItemText } from "@mui/material";
|
|
2627
|
-
import TranslateIcon2 from "@mui/icons-material/Translate";
|
|
2628
|
-
import LaunchIcon from "@mui/icons-material/Launch";
|
|
2629
|
-
|
|
2630
|
-
// src/i18n/TranslationDialog.tsx
|
|
2631
|
-
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
2632
|
-
import {
|
|
2633
|
-
Dialog,
|
|
2634
|
-
DialogTitle,
|
|
2635
|
-
DialogContent,
|
|
2636
|
-
DialogActions,
|
|
2637
|
-
Button,
|
|
2638
|
-
TextField,
|
|
2639
|
-
Box,
|
|
2640
|
-
Typography,
|
|
2641
|
-
CircularProgress,
|
|
2642
|
-
IconButton,
|
|
2643
|
-
Tooltip as Tooltip2,
|
|
2644
|
-
Paper,
|
|
2645
|
-
Alert
|
|
2646
|
-
} from "@mui/material";
|
|
2647
|
-
import AutoFixHighIcon from "@mui/icons-material/AutoFixHigh";
|
|
2648
|
-
import TranslateIcon from "@mui/icons-material/Translate";
|
|
2649
|
-
import LightbulbIcon from "@mui/icons-material/Lightbulb";
|
|
2650
|
-
|
|
2651
2617
|
// src/context/AIProvider.tsx
|
|
2652
2618
|
import { createContext as createContext4, useContext as useContext4, useMemo as useMemo2 } from "react";
|
|
2653
2619
|
import { GoogleGenAI } from "@google/genai";
|
|
2654
|
-
import { jsx as
|
|
2620
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
2655
2621
|
var AIContext = createContext4(null);
|
|
2656
2622
|
var AIProvider = ({
|
|
2657
2623
|
children,
|
|
@@ -2734,7 +2700,7 @@ var AIProvider = ({
|
|
|
2734
2700
|
}
|
|
2735
2701
|
};
|
|
2736
2702
|
}, [apiKey, provider, modelName]);
|
|
2737
|
-
return /* @__PURE__ */
|
|
2703
|
+
return /* @__PURE__ */ jsx4(AIContext.Provider, { value: contextValue, children });
|
|
2738
2704
|
};
|
|
2739
2705
|
var useAI = () => {
|
|
2740
2706
|
const context = useContext4(AIContext);
|
|
@@ -2745,7 +2711,7 @@ var useAI = () => {
|
|
|
2745
2711
|
};
|
|
2746
2712
|
|
|
2747
2713
|
// src/i18n/TranslationDialog.tsx
|
|
2748
|
-
import { jsx as
|
|
2714
|
+
import { jsx as jsx5, jsxs } from "react/jsx-runtime";
|
|
2749
2715
|
var TranslationDialog = ({
|
|
2750
2716
|
open,
|
|
2751
2717
|
onClose,
|
|
@@ -2881,14 +2847,14 @@ var TranslationDialog = ({
|
|
|
2881
2847
|
] })
|
|
2882
2848
|
] })
|
|
2883
2849
|
] }),
|
|
2884
|
-
!loading && /* @__PURE__ */
|
|
2850
|
+
!loading && /* @__PURE__ */ jsx5(
|
|
2885
2851
|
Button,
|
|
2886
2852
|
{
|
|
2887
2853
|
type: "button",
|
|
2888
2854
|
size: "small",
|
|
2889
2855
|
variant: "outlined",
|
|
2890
2856
|
color: "secondary",
|
|
2891
|
-
startIcon: isTranslatingAll ? /* @__PURE__ */
|
|
2857
|
+
startIcon: isTranslatingAll ? /* @__PURE__ */ jsx5(CircularProgress, { size: 16, color: "inherit" }) : /* @__PURE__ */ jsx5(TranslateIcon, { fontSize: "small" }),
|
|
2892
2858
|
onClick: handleTranslateAll,
|
|
2893
2859
|
disabled: isBusy,
|
|
2894
2860
|
sx: { flexShrink: 0, ml: 2, whiteSpace: "nowrap" },
|
|
@@ -2897,14 +2863,14 @@ var TranslationDialog = ({
|
|
|
2897
2863
|
)
|
|
2898
2864
|
] }),
|
|
2899
2865
|
/* @__PURE__ */ jsxs(DialogContent, { dividers: true, sx: { pt: 2 }, children: [
|
|
2900
|
-
error && /* @__PURE__ */
|
|
2901
|
-
loading ? /* @__PURE__ */
|
|
2866
|
+
error && /* @__PURE__ */ jsx5(Alert, { severity: "error", onClose: () => setError(null), sx: { mb: 2 }, children: error }),
|
|
2867
|
+
loading ? /* @__PURE__ */ jsx5(Box, { sx: { display: "flex", justifyContent: "center", py: 4 }, children: /* @__PURE__ */ jsx5(CircularProgress, {}) }) : /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", flexDirection: "column", gap: 2.5 }, children: [
|
|
2902
2868
|
/* @__PURE__ */ jsxs(Paper, { variant: "outlined", sx: { p: 2, bgcolor: "action.hover", borderRadius: 2 }, children: [
|
|
2903
2869
|
/* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 1, mb: 1 }, children: [
|
|
2904
|
-
/* @__PURE__ */
|
|
2905
|
-
/* @__PURE__ */
|
|
2870
|
+
/* @__PURE__ */ jsx5(LightbulbIcon, { color: "warning", fontSize: "small" }),
|
|
2871
|
+
/* @__PURE__ */ jsx5(Typography, { variant: "subtitle2", sx: { fontWeight: 600 }, children: "Context Hint / Clarification" })
|
|
2906
2872
|
] }),
|
|
2907
|
-
/* @__PURE__ */
|
|
2873
|
+
/* @__PURE__ */ jsx5(
|
|
2908
2874
|
TextField,
|
|
2909
2875
|
{
|
|
2910
2876
|
fullWidth: true,
|
|
@@ -2920,7 +2886,7 @@ var TranslationDialog = ({
|
|
|
2920
2886
|
)
|
|
2921
2887
|
] }),
|
|
2922
2888
|
languages.map((lang) => /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 2 }, children: [
|
|
2923
|
-
/* @__PURE__ */
|
|
2889
|
+
/* @__PURE__ */ jsx5(
|
|
2924
2890
|
Box,
|
|
2925
2891
|
{
|
|
2926
2892
|
sx: {
|
|
@@ -2935,7 +2901,7 @@ var TranslationDialog = ({
|
|
|
2935
2901
|
dangerouslySetInnerHTML: { __html: lang.svg_flag }
|
|
2936
2902
|
}
|
|
2937
2903
|
),
|
|
2938
|
-
/* @__PURE__ */
|
|
2904
|
+
/* @__PURE__ */ jsx5(
|
|
2939
2905
|
TextField,
|
|
2940
2906
|
{
|
|
2941
2907
|
fullWidth: true,
|
|
@@ -2947,22 +2913,22 @@ var TranslationDialog = ({
|
|
|
2947
2913
|
disabled: isBusy
|
|
2948
2914
|
}
|
|
2949
2915
|
),
|
|
2950
|
-
/* @__PURE__ */
|
|
2916
|
+
/* @__PURE__ */ jsx5(Tooltip, { title: "Translate with context hint", children: /* @__PURE__ */ jsx5("span", { children: /* @__PURE__ */ jsx5(
|
|
2951
2917
|
IconButton,
|
|
2952
2918
|
{
|
|
2953
2919
|
type: "button",
|
|
2954
2920
|
color: "primary",
|
|
2955
2921
|
disabled: isBusy,
|
|
2956
2922
|
onClick: (e) => handleAutoTranslate(e, lang.code),
|
|
2957
|
-
children: translatingCode === lang.code ? /* @__PURE__ */
|
|
2923
|
+
children: translatingCode === lang.code ? /* @__PURE__ */ jsx5(CircularProgress, { size: 20, color: "inherit" }) : /* @__PURE__ */ jsx5(AutoFixHighIcon, { fontSize: "small" })
|
|
2958
2924
|
}
|
|
2959
2925
|
) }) })
|
|
2960
2926
|
] }, lang.code))
|
|
2961
2927
|
] })
|
|
2962
2928
|
] }),
|
|
2963
2929
|
/* @__PURE__ */ jsxs(DialogActions, { sx: { px: 3, py: 2 }, children: [
|
|
2964
|
-
/* @__PURE__ */
|
|
2965
|
-
/* @__PURE__ */
|
|
2930
|
+
/* @__PURE__ */ jsx5(Button, { onClick: onClose, disabled: isBusy, color: "inherit", type: "button", children: "Cancel" }),
|
|
2931
|
+
/* @__PURE__ */ jsx5(
|
|
2966
2932
|
Button,
|
|
2967
2933
|
{
|
|
2968
2934
|
onClick: handleSaveAll,
|
|
@@ -2980,13 +2946,13 @@ var TranslationDialog = ({
|
|
|
2980
2946
|
|
|
2981
2947
|
// src/context/TranslateProvider.tsx
|
|
2982
2948
|
import { createContext as createContext5, useContext as useContext5 } from "react";
|
|
2983
|
-
import { jsx as
|
|
2949
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
2984
2950
|
var TranslationNamespaceContext = createContext5({
|
|
2985
2951
|
namespace: "common"
|
|
2986
2952
|
// значение по умолчанию
|
|
2987
2953
|
});
|
|
2988
2954
|
var TranslateProvider = ({ namespace, children }) => {
|
|
2989
|
-
return /* @__PURE__ */
|
|
2955
|
+
return /* @__PURE__ */ jsx6(TranslationNamespaceContext.Provider, { value: { namespace }, children });
|
|
2990
2956
|
};
|
|
2991
2957
|
var useTranslationNamespace = (overrideNamespace) => {
|
|
2992
2958
|
const context = useContext5(TranslationNamespaceContext);
|
|
@@ -2994,12 +2960,13 @@ var useTranslationNamespace = (overrideNamespace) => {
|
|
|
2994
2960
|
};
|
|
2995
2961
|
|
|
2996
2962
|
// src/i18n/TranslateText.tsx
|
|
2997
|
-
import { Fragment, jsx as
|
|
2963
|
+
import { Fragment, jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2998
2964
|
var TranslateText = ({
|
|
2965
|
+
overrideNamespace,
|
|
2999
2966
|
children,
|
|
3000
2967
|
values
|
|
3001
2968
|
}) => {
|
|
3002
|
-
const namespace = useTranslationNamespace();
|
|
2969
|
+
const namespace = useTranslationNamespace(overrideNamespace);
|
|
3003
2970
|
const { t: t2, i18n } = useTranslation(namespace);
|
|
3004
2971
|
const { isTranslationMode, canEdit } = useTranslationEdit();
|
|
3005
2972
|
const supabase = useSupabase();
|
|
@@ -3013,7 +2980,7 @@ var TranslateText = ({
|
|
|
3013
2980
|
};
|
|
3014
2981
|
}, []);
|
|
3015
2982
|
if (!canEdit || !isTranslationMode) {
|
|
3016
|
-
return /* @__PURE__ */
|
|
2983
|
+
return /* @__PURE__ */ jsx7(Fragment, { children: translatedValue });
|
|
3017
2984
|
}
|
|
3018
2985
|
const handleSaveTranslations = async (newValues, contextHint) => {
|
|
3019
2986
|
const upsertData = Object.entries(newValues).map(([langCode, text]) => ({
|
|
@@ -3056,7 +3023,7 @@ var TranslateText = ({
|
|
|
3056
3023
|
};
|
|
3057
3024
|
const open = Boolean(anchorEl);
|
|
3058
3025
|
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
3059
|
-
/* @__PURE__ */
|
|
3026
|
+
/* @__PURE__ */ jsx7(
|
|
3060
3027
|
Box2,
|
|
3061
3028
|
{
|
|
3062
3029
|
component: "span",
|
|
@@ -3087,14 +3054,14 @@ var TranslateText = ({
|
|
|
3087
3054
|
children: translatedValue
|
|
3088
3055
|
}
|
|
3089
3056
|
),
|
|
3090
|
-
/* @__PURE__ */
|
|
3057
|
+
/* @__PURE__ */ jsx7(
|
|
3091
3058
|
Popper,
|
|
3092
3059
|
{
|
|
3093
3060
|
open,
|
|
3094
3061
|
anchorEl,
|
|
3095
3062
|
placement: "bottom-start",
|
|
3096
3063
|
style: { zIndex: 1300 },
|
|
3097
|
-
children: /* @__PURE__ */
|
|
3064
|
+
children: /* @__PURE__ */ jsx7(
|
|
3098
3065
|
Paper2,
|
|
3099
3066
|
{
|
|
3100
3067
|
elevation: 4,
|
|
@@ -3110,8 +3077,8 @@ var TranslateText = ({
|
|
|
3110
3077
|
},
|
|
3111
3078
|
children: /* @__PURE__ */ jsxs2(MenuList, { dense: true, sx: { py: 0.5 }, children: [
|
|
3112
3079
|
/* @__PURE__ */ jsxs2(MenuItem, { onClick: handleOpenDialog, sx: { py: 0.8, px: 1.5 }, children: [
|
|
3113
|
-
/* @__PURE__ */
|
|
3114
|
-
/* @__PURE__ */
|
|
3080
|
+
/* @__PURE__ */ jsx7(ListItemIcon, { sx: { minWidth: "28px !important" }, children: /* @__PURE__ */ jsx7(TranslateIcon2, { fontSize: "small", sx: { color: "#d97706" } }) }),
|
|
3081
|
+
/* @__PURE__ */ jsx7(
|
|
3115
3082
|
ListItemText,
|
|
3116
3083
|
{
|
|
3117
3084
|
primary: "Localization",
|
|
@@ -3128,8 +3095,8 @@ var TranslateText = ({
|
|
|
3128
3095
|
)
|
|
3129
3096
|
] }),
|
|
3130
3097
|
/* @__PURE__ */ jsxs2(MenuItem, { onClick: handleLaunchAction, sx: { py: 0.8, px: 1.5 }, children: [
|
|
3131
|
-
/* @__PURE__ */
|
|
3132
|
-
/* @__PURE__ */
|
|
3098
|
+
/* @__PURE__ */ jsx7(ListItemIcon, { sx: { minWidth: "28px !important" }, children: /* @__PURE__ */ jsx7(LaunchIcon, { fontSize: "small", color: "secondary" }) }),
|
|
3099
|
+
/* @__PURE__ */ jsx7(
|
|
3133
3100
|
ListItemText,
|
|
3134
3101
|
{
|
|
3135
3102
|
primary: "Launch action",
|
|
@@ -3150,7 +3117,7 @@ var TranslateText = ({
|
|
|
3150
3117
|
)
|
|
3151
3118
|
}
|
|
3152
3119
|
),
|
|
3153
|
-
/* @__PURE__ */
|
|
3120
|
+
/* @__PURE__ */ jsx7("span", { style: { display: "inline" }, onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx7(
|
|
3154
3121
|
TranslationDialog,
|
|
3155
3122
|
{
|
|
3156
3123
|
open: isDialogOpen,
|
|
@@ -3163,9 +3130,44 @@ var TranslateText = ({
|
|
|
3163
3130
|
] });
|
|
3164
3131
|
};
|
|
3165
3132
|
|
|
3166
|
-
// src/UI/components/
|
|
3133
|
+
// src/UI/components/data.display/TranslatableTooltipComponent.tsx
|
|
3134
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
3135
|
+
var TranslatableTooltipComponent = ({
|
|
3136
|
+
overrideNamespace,
|
|
3137
|
+
title,
|
|
3138
|
+
disableSpan,
|
|
3139
|
+
children,
|
|
3140
|
+
...props
|
|
3141
|
+
}) => {
|
|
3142
|
+
const { isTranslationMode } = useTranslationEdit();
|
|
3143
|
+
return /* @__PURE__ */ jsx8(
|
|
3144
|
+
Tooltip2,
|
|
3145
|
+
{
|
|
3146
|
+
title: typeof title === "string" ? /* @__PURE__ */ jsx8(TranslateText, { overrideNamespace, children: title }) : title,
|
|
3147
|
+
slotProps: {
|
|
3148
|
+
popper: {
|
|
3149
|
+
sx: isTranslationMode ? {
|
|
3150
|
+
pointerEvents: "auto",
|
|
3151
|
+
// Разрешаем клики внутри тултипа
|
|
3152
|
+
"& .MuiTooltip-tooltip": {
|
|
3153
|
+
pointerEvents: "auto"
|
|
3154
|
+
}
|
|
3155
|
+
} : void 0
|
|
3156
|
+
}
|
|
3157
|
+
},
|
|
3158
|
+
leaveDelay: isTranslationMode ? 1e3 : 100,
|
|
3159
|
+
...props,
|
|
3160
|
+
children: disableSpan ? children : /* @__PURE__ */ jsx8("span", { children })
|
|
3161
|
+
}
|
|
3162
|
+
);
|
|
3163
|
+
};
|
|
3164
|
+
|
|
3165
|
+
// src/UI/components/inputs/TextFieldComponent.tsx
|
|
3166
|
+
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
3167
3167
|
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
3168
|
-
var
|
|
3168
|
+
var TextFieldComponent = ({
|
|
3169
|
+
overrideNamespace,
|
|
3170
|
+
label,
|
|
3169
3171
|
value = "",
|
|
3170
3172
|
onChange,
|
|
3171
3173
|
disabled = false,
|
|
@@ -3235,6 +3237,7 @@ var TextfieldComponent = ({
|
|
|
3235
3237
|
/* @__PURE__ */ jsx9(
|
|
3236
3238
|
TextField2,
|
|
3237
3239
|
{
|
|
3240
|
+
label: typeof label === "string" ? /* @__PURE__ */ jsx9(TranslateText, { overrideNamespace, children: label }) : label,
|
|
3238
3241
|
value,
|
|
3239
3242
|
onChange,
|
|
3240
3243
|
disabled,
|
|
@@ -3257,7 +3260,7 @@ var TextfieldComponent = ({
|
|
|
3257
3260
|
...slotProps?.input || {},
|
|
3258
3261
|
readOnly: isReadOnly,
|
|
3259
3262
|
endAdornment: /* @__PURE__ */ jsxs3(InputAdornment, { position: "end", sx: { gap: 0.5 }, children: [
|
|
3260
|
-
hasValue && !isLocked && !disableClearButton && /* @__PURE__ */ jsx9(
|
|
3263
|
+
hasValue && !isLocked && !disableClearButton && /* @__PURE__ */ jsx9(TranslatableTooltipComponent, { title: /* @__PURE__ */ jsx9(TranslateText, { overrideNamespace, children: clearTooltip }), children: /* @__PURE__ */ jsx9(
|
|
3261
3264
|
IconButton2,
|
|
3262
3265
|
{
|
|
3263
3266
|
size: "small",
|
|
@@ -3267,7 +3270,7 @@ var TextfieldComponent = ({
|
|
|
3267
3270
|
children: /* @__PURE__ */ jsx9(ClearIcon, { fontSize: "small" })
|
|
3268
3271
|
}
|
|
3269
3272
|
) }),
|
|
3270
|
-
hasValue && /* @__PURE__ */ jsx9(
|
|
3273
|
+
hasValue && /* @__PURE__ */ jsx9(TranslatableTooltipComponent, { title: /* @__PURE__ */ jsx9(TranslateText, { overrideNamespace, children: copied ? copiedTooltip : copyTooltip }), children: /* @__PURE__ */ jsx9(
|
|
3271
3274
|
IconButton2,
|
|
3272
3275
|
{
|
|
3273
3276
|
size: "small",
|
|
@@ -3317,7 +3320,7 @@ var TextfieldComponent = ({
|
|
|
3317
3320
|
)
|
|
3318
3321
|
}
|
|
3319
3322
|
) }),
|
|
3320
|
-
isLocked && showLock && /* @__PURE__ */ jsx9(
|
|
3323
|
+
isLocked && showLock && /* @__PURE__ */ jsx9(TranslatableTooltipComponent, { title: /* @__PURE__ */ jsx9(TranslateText, { overrideNamespace, children: lockTooltip }), children: /* @__PURE__ */ jsx9(
|
|
3321
3324
|
IconButton2,
|
|
3322
3325
|
{
|
|
3323
3326
|
size: "small",
|
|
@@ -3379,6 +3382,7 @@ import AddIcon from "@mui/icons-material/Add";
|
|
|
3379
3382
|
import RemoveIcon from "@mui/icons-material/Remove";
|
|
3380
3383
|
import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
3381
3384
|
var NumberInputComponent = ({
|
|
3385
|
+
overrideNamespace,
|
|
3382
3386
|
value,
|
|
3383
3387
|
onChange,
|
|
3384
3388
|
allowNegative = true,
|
|
@@ -3512,9 +3516,10 @@ var NumberInputComponent = ({
|
|
|
3512
3516
|
const isDecrementDisabled = disabled || effectiveMin !== void 0 && !isNaN(currentNumeric) && currentNumeric <= effectiveMin;
|
|
3513
3517
|
const isIncrementDisabled = disabled || maxValue !== void 0 && !isNaN(currentNumeric) && currentNumeric >= maxValue;
|
|
3514
3518
|
return /* @__PURE__ */ jsx10(
|
|
3515
|
-
|
|
3519
|
+
TextFieldComponent,
|
|
3516
3520
|
{
|
|
3517
3521
|
...props,
|
|
3522
|
+
overrideNamespace,
|
|
3518
3523
|
type: "text",
|
|
3519
3524
|
disabled,
|
|
3520
3525
|
value: formatDisplayValue(inputValue),
|
|
@@ -3576,11 +3581,276 @@ var NumberInputComponent = ({
|
|
|
3576
3581
|
);
|
|
3577
3582
|
};
|
|
3578
3583
|
|
|
3584
|
+
// src/UI/components/inputs/UrlComponent.tsx
|
|
3585
|
+
import { useState as useState7 } from "react";
|
|
3586
|
+
import {
|
|
3587
|
+
TextField as TextField3,
|
|
3588
|
+
InputAdornment as InputAdornment3,
|
|
3589
|
+
IconButton as IconButton4,
|
|
3590
|
+
Tooltip as Tooltip4,
|
|
3591
|
+
Popover,
|
|
3592
|
+
Box as Box5,
|
|
3593
|
+
Typography as Typography2,
|
|
3594
|
+
Button as Button2
|
|
3595
|
+
} from "@mui/material";
|
|
3596
|
+
import LinkIcon from "@mui/icons-material/Link";
|
|
3597
|
+
import LaunchIcon2 from "@mui/icons-material/Launch";
|
|
3598
|
+
import ContentCopyIcon2 from "@mui/icons-material/ContentCopy";
|
|
3599
|
+
import CheckIcon2 from "@mui/icons-material/Check";
|
|
3600
|
+
import EditNoteIcon from "@mui/icons-material/EditNote";
|
|
3601
|
+
import LockIcon2 from "@mui/icons-material/Lock";
|
|
3602
|
+
import { Fragment as Fragment4, jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3603
|
+
function UrlComponent({
|
|
3604
|
+
overrideNamespace,
|
|
3605
|
+
label,
|
|
3606
|
+
value,
|
|
3607
|
+
onChange,
|
|
3608
|
+
disabled = false,
|
|
3609
|
+
readOnly = false,
|
|
3610
|
+
required = false,
|
|
3611
|
+
error = false,
|
|
3612
|
+
helperText = "",
|
|
3613
|
+
description = "",
|
|
3614
|
+
fullWidth = true,
|
|
3615
|
+
openInNewTab = true,
|
|
3616
|
+
showLock = true,
|
|
3617
|
+
lockTooltip = "Field is not editable",
|
|
3618
|
+
sx
|
|
3619
|
+
}) {
|
|
3620
|
+
const [copied, setCopied] = useState7(false);
|
|
3621
|
+
const [anchorEl, setAnchorEl] = useState7(null);
|
|
3622
|
+
const isViewMode = disabled || readOnly;
|
|
3623
|
+
const currentUrl = typeof value === "object" && value !== null ? value.url || "" : value || "";
|
|
3624
|
+
const currentTitle = typeof value === "object" && value !== null ? value.title || "" : "";
|
|
3625
|
+
const getFormattedUrl = (val) => {
|
|
3626
|
+
if (!val) return "";
|
|
3627
|
+
const trimmed = val.trim();
|
|
3628
|
+
if (trimmed.match(/^[a-zA-Z]+:\/\//)) {
|
|
3629
|
+
return trimmed;
|
|
3630
|
+
}
|
|
3631
|
+
return `https://${trimmed}`;
|
|
3632
|
+
};
|
|
3633
|
+
const finalUrl = getFormattedUrl(currentUrl);
|
|
3634
|
+
const targetAttribute = openInNewTab ? "_blank" : "_self";
|
|
3635
|
+
const displayLabelText = currentTitle.trim() || currentUrl;
|
|
3636
|
+
const handleUrlChange = (newUrl) => {
|
|
3637
|
+
onChange?.({ url: newUrl, title: currentTitle });
|
|
3638
|
+
};
|
|
3639
|
+
const handleTitleChange = (newTitle) => {
|
|
3640
|
+
onChange?.({ url: currentUrl, title: newTitle });
|
|
3641
|
+
};
|
|
3642
|
+
const handleCopy = (e) => {
|
|
3643
|
+
e.stopPropagation();
|
|
3644
|
+
if (!finalUrl) return;
|
|
3645
|
+
navigator.clipboard.writeText(finalUrl);
|
|
3646
|
+
setCopied(true);
|
|
3647
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
3648
|
+
};
|
|
3649
|
+
const handleOpenLink = (e) => {
|
|
3650
|
+
e.stopPropagation();
|
|
3651
|
+
if (finalUrl) {
|
|
3652
|
+
window.open(finalUrl, targetAttribute, openInNewTab ? "noopener,noreferrer" : void 0);
|
|
3653
|
+
}
|
|
3654
|
+
};
|
|
3655
|
+
const handleInputClick = (e) => {
|
|
3656
|
+
if (isViewMode && finalUrl) {
|
|
3657
|
+
handleOpenLink(e);
|
|
3658
|
+
}
|
|
3659
|
+
};
|
|
3660
|
+
const handleOpenTitleMenu = (e) => {
|
|
3661
|
+
e.stopPropagation();
|
|
3662
|
+
setAnchorEl(e.currentTarget);
|
|
3663
|
+
};
|
|
3664
|
+
const handleCloseTitleMenu = () => {
|
|
3665
|
+
setAnchorEl(null);
|
|
3666
|
+
};
|
|
3667
|
+
const isTitlePopoverOpen = Boolean(anchorEl);
|
|
3668
|
+
const displayHelperText = error ? helperText : description || helperText;
|
|
3669
|
+
return /* @__PURE__ */ jsxs5(Fragment4, { children: [
|
|
3670
|
+
/* @__PURE__ */ jsx11(
|
|
3671
|
+
TextField3,
|
|
3672
|
+
{
|
|
3673
|
+
label: /* @__PURE__ */ jsx11(TranslateText, { overrideNamespace, children: label }),
|
|
3674
|
+
type: isViewMode ? "text" : "url",
|
|
3675
|
+
value: isViewMode ? displayLabelText : currentUrl,
|
|
3676
|
+
onChange: (e) => handleUrlChange(e.target.value),
|
|
3677
|
+
required,
|
|
3678
|
+
error,
|
|
3679
|
+
disabled,
|
|
3680
|
+
margin: "dense",
|
|
3681
|
+
helperText: displayHelperText,
|
|
3682
|
+
fullWidth,
|
|
3683
|
+
placeholder: "example.com",
|
|
3684
|
+
sx: {
|
|
3685
|
+
"& .MuiInputLabel-asterisk": {
|
|
3686
|
+
color: "red",
|
|
3687
|
+
fontSize: "1.5rem"
|
|
3688
|
+
},
|
|
3689
|
+
"& .MuiInputBase-input": {
|
|
3690
|
+
color: isViewMode && finalUrl ? "primary.main" : void 0,
|
|
3691
|
+
textDecoration: isViewMode && finalUrl ? "underline" : "none",
|
|
3692
|
+
cursor: isViewMode && finalUrl ? "pointer" : void 0,
|
|
3693
|
+
fontWeight: isViewMode && finalUrl ? 500 : void 0
|
|
3694
|
+
},
|
|
3695
|
+
...sx
|
|
3696
|
+
},
|
|
3697
|
+
slotProps: {
|
|
3698
|
+
htmlInput: {
|
|
3699
|
+
readOnly,
|
|
3700
|
+
onClick: handleInputClick
|
|
3701
|
+
},
|
|
3702
|
+
input: {
|
|
3703
|
+
startAdornment: /* @__PURE__ */ jsx11(InputAdornment3, { position: "start", children: /* @__PURE__ */ jsx11(LinkIcon, { fontSize: "small", color: isViewMode && finalUrl ? "primary" : "action" }) }),
|
|
3704
|
+
endAdornment: /* @__PURE__ */ jsxs5(InputAdornment3, { position: "end", sx: { gap: 0.5 }, children: [
|
|
3705
|
+
!isViewMode && /* @__PURE__ */ jsx11(Tooltip4, { title: currentTitle ? `Title: "${currentTitle}"` : /* @__PURE__ */ jsx11(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Set link title" }), children: /* @__PURE__ */ jsx11(
|
|
3706
|
+
IconButton4,
|
|
3707
|
+
{
|
|
3708
|
+
size: "small",
|
|
3709
|
+
onClick: handleOpenTitleMenu,
|
|
3710
|
+
color: currentTitle ? "primary" : "default",
|
|
3711
|
+
children: /* @__PURE__ */ jsx11(EditNoteIcon, { fontSize: "small" })
|
|
3712
|
+
}
|
|
3713
|
+
) }),
|
|
3714
|
+
finalUrl && /* @__PURE__ */ jsx11(Tooltip4, { title: copied ? /* @__PURE__ */ jsx11(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Copied!" }) : /* @__PURE__ */ jsx11(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Copy link" }), children: /* @__PURE__ */ jsx11(IconButton4, { size: "small", onClick: handleCopy, color: copied ? "success" : "default", children: copied ? /* @__PURE__ */ jsx11(CheckIcon2, { fontSize: "small" }) : /* @__PURE__ */ jsx11(ContentCopyIcon2, { fontSize: "small" }) }) }),
|
|
3715
|
+
isViewMode && showLock && /* @__PURE__ */ jsx11(Tooltip4, { title: /* @__PURE__ */ jsx11(TranslateText, { overrideNamespace, children: lockTooltip }), children: /* @__PURE__ */ jsx11(
|
|
3716
|
+
IconButton4,
|
|
3717
|
+
{
|
|
3718
|
+
size: "small",
|
|
3719
|
+
disabled: true,
|
|
3720
|
+
edge: "end",
|
|
3721
|
+
"aria-label": "locked input",
|
|
3722
|
+
sx: {
|
|
3723
|
+
"&.Mui-disabled": {
|
|
3724
|
+
color: "text.secondary"
|
|
3725
|
+
}
|
|
3726
|
+
},
|
|
3727
|
+
children: /* @__PURE__ */ jsx11(LockIcon2, { fontSize: "small" })
|
|
3728
|
+
}
|
|
3729
|
+
) }),
|
|
3730
|
+
finalUrl && /* @__PURE__ */ jsx11(Tooltip4, { title: /* @__PURE__ */ jsx11(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Open link" }), children: /* @__PURE__ */ jsx11(IconButton4, { size: "small", onClick: handleOpenLink, children: /* @__PURE__ */ jsx11(LaunchIcon2, { fontSize: "small", color: isViewMode ? "primary" : "action" }) }) })
|
|
3731
|
+
] })
|
|
3732
|
+
}
|
|
3733
|
+
}
|
|
3734
|
+
}
|
|
3735
|
+
),
|
|
3736
|
+
/* @__PURE__ */ jsxs5(
|
|
3737
|
+
Popover,
|
|
3738
|
+
{
|
|
3739
|
+
open: isTitlePopoverOpen,
|
|
3740
|
+
anchorEl,
|
|
3741
|
+
onClose: handleCloseTitleMenu,
|
|
3742
|
+
anchorOrigin: {
|
|
3743
|
+
vertical: "bottom",
|
|
3744
|
+
horizontal: "right"
|
|
3745
|
+
},
|
|
3746
|
+
transformOrigin: {
|
|
3747
|
+
vertical: "top",
|
|
3748
|
+
horizontal: "right"
|
|
3749
|
+
},
|
|
3750
|
+
slotProps: {
|
|
3751
|
+
paper: { sx: { p: 2, width: 280 } }
|
|
3752
|
+
},
|
|
3753
|
+
children: [
|
|
3754
|
+
/* @__PURE__ */ jsx11(Typography2, { variant: "subtitle2", sx: { mb: 1, fontWeight: "bold" }, children: /* @__PURE__ */ jsx11(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Link Title (Anchor)" }) }),
|
|
3755
|
+
/* @__PURE__ */ jsxs5(Typography2, { variant: "caption", color: "text.secondary", sx: { mb: 1.5, display: "block" }, children: [
|
|
3756
|
+
/* @__PURE__ */ jsx11(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Specify the text to display instead of the URL address" }),
|
|
3757
|
+
":"
|
|
3758
|
+
] }),
|
|
3759
|
+
/* @__PURE__ */ jsx11(
|
|
3760
|
+
TextField3,
|
|
3761
|
+
{
|
|
3762
|
+
size: "small",
|
|
3763
|
+
fullWidth: true,
|
|
3764
|
+
placeholder: "e.g. Instruction",
|
|
3765
|
+
value: currentTitle,
|
|
3766
|
+
onChange: (e) => handleTitleChange(e.target.value),
|
|
3767
|
+
autoFocus: true,
|
|
3768
|
+
onKeyDown: (e) => {
|
|
3769
|
+
if (e.key === "Enter") {
|
|
3770
|
+
e.preventDefault();
|
|
3771
|
+
handleCloseTitleMenu();
|
|
3772
|
+
}
|
|
3773
|
+
}
|
|
3774
|
+
}
|
|
3775
|
+
),
|
|
3776
|
+
/* @__PURE__ */ jsx11(Box5, { sx: { display: "flex", justifyContent: "flex-end", mt: 1.5 }, children: /* @__PURE__ */ jsx11(Button2, { size: "small", variant: "contained", onClick: handleCloseTitleMenu, children: /* @__PURE__ */ jsx11(TranslateText, { overrideNamespace: overrideNamespace || "form_components", children: "Done" }) }) })
|
|
3777
|
+
]
|
|
3778
|
+
}
|
|
3779
|
+
)
|
|
3780
|
+
] });
|
|
3781
|
+
}
|
|
3782
|
+
|
|
3783
|
+
// src/UI/components/inputs/EmailInputComponent.tsx
|
|
3784
|
+
import { useState as useState8 } from "react";
|
|
3785
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
3786
|
+
var EMAIL_REGEX = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
3787
|
+
var EmailInputComponent = ({
|
|
3788
|
+
value = "",
|
|
3789
|
+
onChange,
|
|
3790
|
+
onBlur,
|
|
3791
|
+
error: externalError,
|
|
3792
|
+
helperText: externalHelperText,
|
|
3793
|
+
invalidEmailError = "Invalid email address",
|
|
3794
|
+
disableValidation = false,
|
|
3795
|
+
onValidationChange,
|
|
3796
|
+
...props
|
|
3797
|
+
}) => {
|
|
3798
|
+
const [internalError, setInternalError] = useState8(null);
|
|
3799
|
+
const validateEmail = (val) => {
|
|
3800
|
+
if (disableValidation) return true;
|
|
3801
|
+
const stringVal = String(val ?? "").trim();
|
|
3802
|
+
if (!stringVal) {
|
|
3803
|
+
setInternalError(null);
|
|
3804
|
+
onValidationChange?.(true);
|
|
3805
|
+
return true;
|
|
3806
|
+
}
|
|
3807
|
+
const isValid = EMAIL_REGEX.test(stringVal);
|
|
3808
|
+
const errorMessage = isValid ? null : invalidEmailError;
|
|
3809
|
+
setInternalError(errorMessage);
|
|
3810
|
+
onValidationChange?.(isValid);
|
|
3811
|
+
return isValid;
|
|
3812
|
+
};
|
|
3813
|
+
const handleChange = (e) => {
|
|
3814
|
+
const newValue = e.target.value;
|
|
3815
|
+
if (internalError) {
|
|
3816
|
+
validateEmail(newValue);
|
|
3817
|
+
}
|
|
3818
|
+
if (onChange) {
|
|
3819
|
+
onChange(e);
|
|
3820
|
+
}
|
|
3821
|
+
};
|
|
3822
|
+
const handleBlur = (e) => {
|
|
3823
|
+
validateEmail(e.target.value);
|
|
3824
|
+
if (onBlur) {
|
|
3825
|
+
onBlur(e);
|
|
3826
|
+
}
|
|
3827
|
+
};
|
|
3828
|
+
const hasError = Boolean(externalError || internalError);
|
|
3829
|
+
const displayHelperText = externalHelperText || internalError || void 0;
|
|
3830
|
+
return /* @__PURE__ */ jsx12(
|
|
3831
|
+
TextFieldComponent,
|
|
3832
|
+
{
|
|
3833
|
+
type: "email",
|
|
3834
|
+
value,
|
|
3835
|
+
onChange: handleChange,
|
|
3836
|
+
onBlur: handleBlur,
|
|
3837
|
+
error: hasError,
|
|
3838
|
+
helperText: displayHelperText,
|
|
3839
|
+
...props
|
|
3840
|
+
}
|
|
3841
|
+
);
|
|
3842
|
+
};
|
|
3843
|
+
|
|
3579
3844
|
// src/UI/index.ts
|
|
3580
|
-
var
|
|
3845
|
+
var UI = {
|
|
3581
3846
|
Inputs: {
|
|
3582
|
-
TextField:
|
|
3583
|
-
NumberField: NumberInputComponent
|
|
3847
|
+
TextField: TextFieldComponent,
|
|
3848
|
+
NumberField: NumberInputComponent,
|
|
3849
|
+
EmailField: EmailInputComponent,
|
|
3850
|
+
Url: UrlComponent
|
|
3851
|
+
},
|
|
3852
|
+
DataDisplay: {
|
|
3853
|
+
TranslatableTooltip: TranslatableTooltipComponent
|
|
3584
3854
|
}
|
|
3585
3855
|
/*Layout: {
|
|
3586
3856
|
Row: FormRow,
|
|
@@ -3588,10 +3858,10 @@ var CardForm = {
|
|
|
3588
3858
|
};
|
|
3589
3859
|
|
|
3590
3860
|
// src/context/LocalizationProvider.tsx
|
|
3591
|
-
import { createContext as createContext6, useContext as useContext6, useMemo as useMemo4, useEffect as useEffect6, useState as
|
|
3861
|
+
import { createContext as createContext6, useContext as useContext6, useMemo as useMemo4, useEffect as useEffect6, useState as useState9 } from "react";
|
|
3592
3862
|
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
3593
3863
|
import moment from "moment/min/moment-with-locales";
|
|
3594
|
-
import { jsx as
|
|
3864
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
3595
3865
|
var DEFAULT_DATETIME_FORMATS = {
|
|
3596
3866
|
uk: "DD.MM.YYYY, HH:mm",
|
|
3597
3867
|
de: "DD.MM.YYYY, HH:mm",
|
|
@@ -3620,9 +3890,9 @@ var LocalizationContext = createContext6(void 0);
|
|
|
3620
3890
|
var LocalizationProvider = ({ children }) => {
|
|
3621
3891
|
const supabase = useSupabase();
|
|
3622
3892
|
const { i18n } = useTranslation3();
|
|
3623
|
-
const [languages, setLanguages] =
|
|
3624
|
-
const [isLoadingLangs, setIsLoadingLangs] =
|
|
3625
|
-
const [languagesError, setLanguagesError] =
|
|
3893
|
+
const [languages, setLanguages] = useState9([]);
|
|
3894
|
+
const [isLoadingLangs, setIsLoadingLangs] = useState9(true);
|
|
3895
|
+
const [languagesError, setLanguagesError] = useState9(null);
|
|
3626
3896
|
useEffect6(() => {
|
|
3627
3897
|
let isMounted = true;
|
|
3628
3898
|
const fetchLanguages = async () => {
|
|
@@ -3702,7 +3972,7 @@ var LocalizationProvider = ({ children }) => {
|
|
|
3702
3972
|
}),
|
|
3703
3973
|
[currentLang, languages, isLoadingLangs, languagesError]
|
|
3704
3974
|
);
|
|
3705
|
-
return /* @__PURE__ */
|
|
3975
|
+
return /* @__PURE__ */ jsx13(LocalizationContext.Provider, { value, children });
|
|
3706
3976
|
};
|
|
3707
3977
|
var useLocalization = () => {
|
|
3708
3978
|
const context = useContext6(LocalizationContext);
|
|
@@ -3713,9 +3983,9 @@ var useLocalization = () => {
|
|
|
3713
3983
|
};
|
|
3714
3984
|
|
|
3715
3985
|
// src/context/ThemeProvider.tsx
|
|
3716
|
-
import { createContext as createContext7, useContext as useContext7, useMemo as useMemo5, useState as
|
|
3986
|
+
import { createContext as createContext7, useContext as useContext7, useMemo as useMemo5, useState as useState10, useEffect as useEffect7 } from "react";
|
|
3717
3987
|
import { createTheme, ThemeProvider as MuiThemeProvider, CssBaseline, useMediaQuery } from "@mui/material";
|
|
3718
|
-
import { jsx as
|
|
3988
|
+
import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3719
3989
|
var DEFAULT_LIGHT_COLORS = {
|
|
3720
3990
|
primary: "#1976d2",
|
|
3721
3991
|
secondary: "#9c27b0",
|
|
@@ -3852,7 +4122,7 @@ var ThemeProvider = ({ children }) => {
|
|
|
3852
4122
|
const supabase = useSupabase();
|
|
3853
4123
|
const { user, isAuthenticated, loading: isAuthLoading } = useAuth();
|
|
3854
4124
|
const userId = user?.id;
|
|
3855
|
-
const [themeConfig, setThemeConfig] =
|
|
4125
|
+
const [themeConfig, setThemeConfig] = useState10(() => {
|
|
3856
4126
|
const saved = localStorage.getItem(THEME_STORAGE_KEY);
|
|
3857
4127
|
if (saved) {
|
|
3858
4128
|
try {
|
|
@@ -3917,8 +4187,8 @@ var ThemeProvider = ({ children }) => {
|
|
|
3917
4187
|
isWideDesktop: useMediaQuery(theme.breakpoints.between("lg", "xl")),
|
|
3918
4188
|
isSuperWideDesktop: useMediaQuery(theme.breakpoints.up("xl"))
|
|
3919
4189
|
};
|
|
3920
|
-
return /* @__PURE__ */
|
|
3921
|
-
/* @__PURE__ */
|
|
4190
|
+
return /* @__PURE__ */ jsx14(ThemeContext.Provider, { value: { mode, toggleTheme, setMode, theme, themeConfig, setThemeConfig, displayState }, children: /* @__PURE__ */ jsxs6(MuiThemeProvider, { theme, children: [
|
|
4191
|
+
/* @__PURE__ */ jsx14(CssBaseline, {}),
|
|
3922
4192
|
children
|
|
3923
4193
|
] }) });
|
|
3924
4194
|
};
|
|
@@ -3931,32 +4201,32 @@ var useAppTheme = () => {
|
|
|
3931
4201
|
};
|
|
3932
4202
|
|
|
3933
4203
|
// src/context/BreadcrumbProvider.tsx
|
|
3934
|
-
import { createContext as createContext8, useContext as useContext8, useState as
|
|
3935
|
-
import { jsx as
|
|
4204
|
+
import { createContext as createContext8, useContext as useContext8, useState as useState11 } from "react";
|
|
4205
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
3936
4206
|
var BreadcrumbContext = createContext8({
|
|
3937
4207
|
breadcrumbTitles: {},
|
|
3938
4208
|
setBreadcrumbTitle: () => {
|
|
3939
4209
|
}
|
|
3940
4210
|
});
|
|
3941
4211
|
var BreadcrumbProvider = ({ children }) => {
|
|
3942
|
-
const [breadcrumbTitles, setBreadcrumbTitles] =
|
|
4212
|
+
const [breadcrumbTitles, setBreadcrumbTitles] = useState11({});
|
|
3943
4213
|
const setBreadcrumbTitle = (path, title) => {
|
|
3944
4214
|
setBreadcrumbTitles((prev) => {
|
|
3945
4215
|
if (prev[path] === title) return prev;
|
|
3946
4216
|
return { ...prev, [path]: title };
|
|
3947
4217
|
});
|
|
3948
4218
|
};
|
|
3949
|
-
return /* @__PURE__ */
|
|
4219
|
+
return /* @__PURE__ */ jsx15(BreadcrumbContext.Provider, { value: { breadcrumbTitles, setBreadcrumbTitle }, children });
|
|
3950
4220
|
};
|
|
3951
4221
|
var useBreadcrumb = () => useContext8(BreadcrumbContext);
|
|
3952
4222
|
|
|
3953
4223
|
// src/context/ToastProvider.tsx
|
|
3954
|
-
import { createContext as createContext9, useContext as useContext9, useState as
|
|
4224
|
+
import { createContext as createContext9, useContext as useContext9, useState as useState12, useCallback as useCallback4, useMemo as useMemo6 } from "react";
|
|
3955
4225
|
import { Snackbar, Alert as Alert2 } from "@mui/material";
|
|
3956
|
-
import { jsx as
|
|
4226
|
+
import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3957
4227
|
var ToastContext = createContext9(void 0);
|
|
3958
4228
|
var ToastProvider = ({ children }) => {
|
|
3959
|
-
const [toast, setToast] =
|
|
4229
|
+
const [toast, setToast] = useState12(null);
|
|
3960
4230
|
const showToast = useCallback4((text, type = "info") => {
|
|
3961
4231
|
setToast({ text, type });
|
|
3962
4232
|
}, []);
|
|
@@ -3967,16 +4237,16 @@ var ToastProvider = ({ children }) => {
|
|
|
3967
4237
|
showToast,
|
|
3968
4238
|
hideToast
|
|
3969
4239
|
}), [showToast, hideToast]);
|
|
3970
|
-
return /* @__PURE__ */
|
|
4240
|
+
return /* @__PURE__ */ jsxs7(ToastContext.Provider, { value: contextValue, children: [
|
|
3971
4241
|
children,
|
|
3972
|
-
/* @__PURE__ */
|
|
4242
|
+
/* @__PURE__ */ jsx16(
|
|
3973
4243
|
Snackbar,
|
|
3974
4244
|
{
|
|
3975
4245
|
open: Boolean(toast),
|
|
3976
4246
|
autoHideDuration: 3500,
|
|
3977
4247
|
onClose: hideToast,
|
|
3978
4248
|
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
3979
|
-
children: /* @__PURE__ */
|
|
4249
|
+
children: /* @__PURE__ */ jsx16(
|
|
3980
4250
|
Alert2,
|
|
3981
4251
|
{
|
|
3982
4252
|
severity: toast?.type || "info",
|
|
@@ -3998,15 +4268,15 @@ var useToast = () => {
|
|
|
3998
4268
|
};
|
|
3999
4269
|
|
|
4000
4270
|
// src/context/ConfirmationProvider.tsx
|
|
4001
|
-
import { createContext as createContext10, useContext as useContext10, useState as
|
|
4271
|
+
import { createContext as createContext10, useContext as useContext10, useState as useState13, useCallback as useCallback5 } from "react";
|
|
4002
4272
|
import {
|
|
4003
|
-
Button as
|
|
4273
|
+
Button as Button3,
|
|
4004
4274
|
Dialog as Dialog2,
|
|
4005
4275
|
DialogActions as DialogActions2,
|
|
4006
4276
|
DialogContent as DialogContent2,
|
|
4007
4277
|
DialogContentText,
|
|
4008
4278
|
DialogTitle as DialogTitle2,
|
|
4009
|
-
Box as
|
|
4279
|
+
Box as Box6
|
|
4010
4280
|
} from "@mui/material";
|
|
4011
4281
|
import {
|
|
4012
4282
|
Error as ErrorIcon,
|
|
@@ -4014,18 +4284,18 @@ import {
|
|
|
4014
4284
|
InfoOutlined as InfoIcon,
|
|
4015
4285
|
CheckCircleOutlined as SuccessIcon
|
|
4016
4286
|
} from "@mui/icons-material";
|
|
4017
|
-
import { jsx as
|
|
4287
|
+
import { jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
4018
4288
|
var ConfirmContext = createContext10(null);
|
|
4019
4289
|
var SEVERITY_ICONS = {
|
|
4020
|
-
error: /* @__PURE__ */
|
|
4021
|
-
warning: /* @__PURE__ */
|
|
4022
|
-
info: /* @__PURE__ */
|
|
4023
|
-
success: /* @__PURE__ */
|
|
4290
|
+
error: /* @__PURE__ */ jsx17(ErrorIcon, { color: "error", sx: { fontSize: 40 } }),
|
|
4291
|
+
warning: /* @__PURE__ */ jsx17(WarningIcon, { color: "warning", sx: { fontSize: 40 } }),
|
|
4292
|
+
info: /* @__PURE__ */ jsx17(InfoIcon, { color: "info", sx: { fontSize: 40 } }),
|
|
4293
|
+
success: /* @__PURE__ */ jsx17(SuccessIcon, { color: "success", sx: { fontSize: 40 } })
|
|
4024
4294
|
};
|
|
4025
4295
|
var ConfirmationProvider = ({ children }) => {
|
|
4026
|
-
const [open, setOpen] =
|
|
4027
|
-
const [options, setOptions] =
|
|
4028
|
-
const [resolver, setResolver] =
|
|
4296
|
+
const [open, setOpen] = useState13(false);
|
|
4297
|
+
const [options, setOptions] = useState13(null);
|
|
4298
|
+
const [resolver, setResolver] = useState13(null);
|
|
4029
4299
|
const confirm = useCallback5((opts) => {
|
|
4030
4300
|
setOptions(opts);
|
|
4031
4301
|
setOpen(true);
|
|
@@ -4040,9 +4310,9 @@ var ConfirmationProvider = ({ children }) => {
|
|
|
4040
4310
|
}
|
|
4041
4311
|
};
|
|
4042
4312
|
const severityType = options?.type || "info";
|
|
4043
|
-
return /* @__PURE__ */
|
|
4313
|
+
return /* @__PURE__ */ jsxs8(ConfirmContext.Provider, { value: { confirm }, children: [
|
|
4044
4314
|
children,
|
|
4045
|
-
/* @__PURE__ */
|
|
4315
|
+
/* @__PURE__ */ jsxs8(
|
|
4046
4316
|
Dialog2,
|
|
4047
4317
|
{
|
|
4048
4318
|
open,
|
|
@@ -4052,38 +4322,38 @@ var ConfirmationProvider = ({ children }) => {
|
|
|
4052
4322
|
disableEnforceFocus: true,
|
|
4053
4323
|
disableRestoreFocus: true,
|
|
4054
4324
|
children: [
|
|
4055
|
-
/* @__PURE__ */
|
|
4325
|
+
/* @__PURE__ */ jsxs8(DialogTitle2, { sx: { display: "flex", alignItems: "center", gap: 1.5, pb: 1 }, children: [
|
|
4056
4326
|
SEVERITY_ICONS[severityType],
|
|
4057
|
-
/* @__PURE__ */
|
|
4327
|
+
/* @__PURE__ */ jsx17(Box6, { component: "span", sx: { fontWeight: 600 }, children: options?.title || /* @__PURE__ */ jsx17(TranslateText, { children: "Confirmation" }) })
|
|
4058
4328
|
] }),
|
|
4059
|
-
/* @__PURE__ */
|
|
4060
|
-
/* @__PURE__ */
|
|
4061
|
-
(options?.showCancelButton ?? true) && /* @__PURE__ */
|
|
4062
|
-
|
|
4329
|
+
/* @__PURE__ */ jsx17(DialogContent2, { sx: { py: 2 }, dividers: true, children: /* @__PURE__ */ jsx17(DialogContentText, { color: "text.secondary", children: options?.message }) }),
|
|
4330
|
+
/* @__PURE__ */ jsxs8(DialogActions2, { sx: { pt: 2, px: 2, justifyContent: "flex-end", gap: 1 }, children: [
|
|
4331
|
+
(options?.showCancelButton ?? true) && /* @__PURE__ */ jsx17(
|
|
4332
|
+
Button3,
|
|
4063
4333
|
{
|
|
4064
4334
|
onClick: () => handleClose("cancel"),
|
|
4065
4335
|
color: "inherit",
|
|
4066
4336
|
variant: "text",
|
|
4067
|
-
children: options?.cancelText || /* @__PURE__ */
|
|
4337
|
+
children: options?.cancelText || /* @__PURE__ */ jsx17(TranslateText, { children: "Cancel" })
|
|
4068
4338
|
}
|
|
4069
4339
|
),
|
|
4070
|
-
options?.showNoButton && /* @__PURE__ */
|
|
4071
|
-
|
|
4340
|
+
options?.showNoButton && /* @__PURE__ */ jsx17(
|
|
4341
|
+
Button3,
|
|
4072
4342
|
{
|
|
4073
4343
|
onClick: () => handleClose("no"),
|
|
4074
4344
|
color: "inherit",
|
|
4075
4345
|
variant: "outlined",
|
|
4076
|
-
children: options?.noText || /* @__PURE__ */
|
|
4346
|
+
children: options?.noText || /* @__PURE__ */ jsx17(TranslateText, { children: "No" })
|
|
4077
4347
|
}
|
|
4078
4348
|
),
|
|
4079
|
-
/* @__PURE__ */
|
|
4080
|
-
|
|
4349
|
+
/* @__PURE__ */ jsx17(
|
|
4350
|
+
Button3,
|
|
4081
4351
|
{
|
|
4082
4352
|
onClick: () => handleClose("yes"),
|
|
4083
4353
|
color: options?.confirmColor || (severityType === "error" ? "error" : "primary"),
|
|
4084
4354
|
variant: "contained",
|
|
4085
4355
|
autoFocus: true,
|
|
4086
|
-
children: options?.confirmText || /* @__PURE__ */
|
|
4356
|
+
children: options?.confirmText || /* @__PURE__ */ jsx17(TranslateText, { children: "Yes" })
|
|
4087
4357
|
}
|
|
4088
4358
|
)
|
|
4089
4359
|
] })
|
|
@@ -4099,18 +4369,32 @@ var useConfirmation = () => {
|
|
|
4099
4369
|
}
|
|
4100
4370
|
return context.confirm;
|
|
4101
4371
|
};
|
|
4372
|
+
|
|
4373
|
+
// src/context/index.ts
|
|
4374
|
+
var Providers = {
|
|
4375
|
+
Supabase: SupabaseProvider,
|
|
4376
|
+
Translate: TranslateProvider,
|
|
4377
|
+
TranslationEdit: TranslationEditProvider,
|
|
4378
|
+
Localization: LocalizationProvider,
|
|
4379
|
+
Theme: ThemeProvider,
|
|
4380
|
+
Breadcrumb: BreadcrumbProvider,
|
|
4381
|
+
Toast: ToastProvider,
|
|
4382
|
+
Confirmation: ConfirmationProvider,
|
|
4383
|
+
AI: AIProvider
|
|
4384
|
+
};
|
|
4102
4385
|
export {
|
|
4103
4386
|
AIProvider,
|
|
4104
4387
|
BreadcrumbProvider,
|
|
4105
|
-
CardForm,
|
|
4106
4388
|
ConfirmationProvider,
|
|
4107
4389
|
LocalizationProvider,
|
|
4390
|
+
Providers,
|
|
4108
4391
|
SupabaseProvider,
|
|
4109
4392
|
ThemeProvider,
|
|
4110
4393
|
ToastProvider,
|
|
4111
4394
|
TranslateProvider,
|
|
4112
4395
|
TranslateText,
|
|
4113
4396
|
TranslationEditProvider,
|
|
4397
|
+
UI,
|
|
4114
4398
|
useAI,
|
|
4115
4399
|
useAppTheme,
|
|
4116
4400
|
useBreadcrumb,
|