injast-core 1.0.78
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/LICENSE +15 -0
- package/README.md +127 -0
- package/dist/components/index.js +3187 -0
- package/dist/constants/index.js +138 -0
- package/dist/context/index.js +308 -0
- package/dist/fonts/IranYekan/Woff/IRANYekanXFaNum-Black.woff +0 -0
- package/dist/fonts/IranYekan/Woff/IRANYekanXFaNum-Bold.woff +0 -0
- package/dist/fonts/IranYekan/Woff/IRANYekanXFaNum-DemiBold.woff +0 -0
- package/dist/fonts/IranYekan/Woff/IRANYekanXFaNum-ExtraBlack.woff +0 -0
- package/dist/fonts/IranYekan/Woff/IRANYekanXFaNum-ExtraBold.woff +0 -0
- package/dist/fonts/IranYekan/Woff/IRANYekanXFaNum-Heavy.woff +0 -0
- package/dist/fonts/IranYekan/Woff/IRANYekanXFaNum-Light.woff +0 -0
- package/dist/fonts/IranYekan/Woff/IRANYekanXFaNum-Medium.woff +0 -0
- package/dist/fonts/IranYekan/Woff/IRANYekanXFaNum-Regular.woff +0 -0
- package/dist/fonts/IranYekan/Woff/IRANYekanXFaNum-Thin.woff +0 -0
- package/dist/fonts/IranYekan/Woff/IRANYekanXFaNum-UltraLight.woff +0 -0
- package/dist/fonts/IranYekan/Woff2/IRANYekanXFaNum-Black.woff2 +0 -0
- package/dist/fonts/IranYekan/Woff2/IRANYekanXFaNum-Bold.woff2 +0 -0
- package/dist/fonts/IranYekan/Woff2/IRANYekanXFaNum-DemiBold.woff2 +0 -0
- package/dist/fonts/IranYekan/Woff2/IRANYekanXFaNum-ExtraBlack.woff2 +0 -0
- package/dist/fonts/IranYekan/Woff2/IRANYekanXFaNum-ExtraBold.woff2 +0 -0
- package/dist/fonts/IranYekan/Woff2/IRANYekanXFaNum-Heavy.woff2 +0 -0
- package/dist/fonts/IranYekan/Woff2/IRANYekanXFaNum-Light.woff2 +0 -0
- package/dist/fonts/IranYekan/Woff2/IRANYekanXFaNum-Medium.woff2 +0 -0
- package/dist/fonts/IranYekan/Woff2/IRANYekanXFaNum-Regular.woff2 +0 -0
- package/dist/fonts/IranYekan/Woff2/IRANYekanXFaNum-Thin.woff2 +0 -0
- package/dist/fonts/IranYekan/Woff2/IRANYekanXFaNum-UltraLight.woff2 +0 -0
- package/dist/fonts/fonts.css +245 -0
- package/dist/hooks/index.js +107 -0
- package/dist/index.js +3831 -0
- package/dist/libs/index.js +142 -0
- package/dist/providers/index.js +305 -0
- package/dist/types/components/Accordion.d.ts +4 -0
- package/dist/types/components/AccordionDetails.d.ts +4 -0
- package/dist/types/components/AccordionSummary.d.ts +4 -0
- package/dist/types/components/Autocomplete.d.ts +3 -0
- package/dist/types/components/Box.d.ts +4 -0
- package/dist/types/components/Button.d.ts +9 -0
- package/dist/types/components/CardNumberInput.d.ts +13 -0
- package/dist/types/components/Checkbox.d.ts +11 -0
- package/dist/types/components/CircularProgress.d.ts +4 -0
- package/dist/types/components/Container.d.ts +4 -0
- package/dist/types/components/CounterBoxInput.d.ts +23 -0
- package/dist/types/components/DataGrid.d.ts +57 -0
- package/dist/types/components/Dialog.d.ts +4 -0
- package/dist/types/components/Divider.d.ts +4 -0
- package/dist/types/components/Drawer.d.ts +9 -0
- package/dist/types/components/Fab.d.ts +4 -0
- package/dist/types/components/FormControl.d.ts +4 -0
- package/dist/types/components/FormControlLabel.d.ts +4 -0
- package/dist/types/components/Grid.d.ts +4 -0
- package/dist/types/components/IconButton.d.ts +4 -0
- package/dist/types/components/Image.d.ts +12 -0
- package/dist/types/components/InputLabel.d.ts +4 -0
- package/dist/types/components/InputPhoneNumber.d.ts +15 -0
- package/dist/types/components/IosHiddenOtpInput.d.ts +6 -0
- package/dist/types/components/List.d.ts +4 -0
- package/dist/types/components/ListItem.d.ts +4 -0
- package/dist/types/components/Loading.d.ts +7 -0
- package/dist/types/components/LoadingModal.d.ts +6 -0
- package/dist/types/components/MenuItem.d.ts +4 -0
- package/dist/types/components/MobileDatePicker.d.ts +19 -0
- package/dist/types/components/Modal.d.ts +9 -0
- package/dist/types/components/MultiSelect.d.ts +14 -0
- package/dist/types/components/NumberInput.d.ts +19 -0
- package/dist/types/components/OtpInput.d.ts +16 -0
- package/dist/types/components/Pagination.d.ts +4 -0
- package/dist/types/components/ProgressBar.d.ts +10 -0
- package/dist/types/components/Radio.d.ts +4 -0
- package/dist/types/components/RadioGroup.d.ts +4 -0
- package/dist/types/components/Select.d.ts +4 -0
- package/dist/types/components/Skeleton.d.ts +4 -0
- package/dist/types/components/Slider.d.ts +4 -0
- package/dist/types/components/Step.d.ts +4 -0
- package/dist/types/components/StepConnector.d.ts +4 -0
- package/dist/types/components/StepContent.d.ts +4 -0
- package/dist/types/components/StepLabel.d.ts +4 -0
- package/dist/types/components/Stepper.d.ts +4 -0
- package/dist/types/components/SvgIcon.d.ts +8 -0
- package/dist/types/components/Tab.d.ts +12 -0
- package/dist/types/components/TextField.d.ts +9 -0
- package/dist/types/components/Toast.d.ts +20 -0
- package/dist/types/components/Toggle.d.ts +10 -0
- package/dist/types/components/Typography.d.ts +8 -0
- package/dist/types/components/WheelDatePicker.d.ts +37 -0
- package/dist/types/components/index.d.ts +53 -0
- package/dist/types/constants/colors.d.ts +2 -0
- package/dist/types/constants/index.d.ts +2 -0
- package/dist/types/constants/stepConnectorClasses.d.ts +2 -0
- package/dist/types/constants/typography.d.ts +82 -0
- package/dist/types/context/MessageHandler.d.ts +15 -0
- package/dist/types/context/index.d.ts +1 -0
- package/dist/types/hooks/index.d.ts +8 -0
- package/dist/types/hooks/useErrorHandler.d.ts +10 -0
- package/dist/types/hooks/useMessage.d.ts +2 -0
- package/dist/types/hooks/useWebOtpListener.d.ts +1 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.js +19 -0
- package/dist/types/libs/create-api-request.d.ts +10 -0
- package/dist/types/libs/create-logger.d.ts +9 -0
- package/dist/types/libs/create-sentry-instrument.d.ts +9 -0
- package/dist/types/libs/index.d.ts +10 -0
- package/dist/types/providers/SPAThemeProvider.d.ts +11 -0
- package/dist/types/providers/ThemeProvider.d.ts +9 -0
- package/dist/types/providers/index.d.ts +2 -0
- package/dist/types/stories/persian.d.ts +81 -0
- package/dist/types/types/axios.d.ts +8 -0
- package/dist/types/types/color.d.ts +38 -0
- package/dist/types/types/index.d.ts +7 -0
- package/dist/types/types/material-react-table-types.d.ts +2 -0
- package/dist/types/types/mui-types.d.ts +2 -0
- package/dist/types/types/services.d.ts +26 -0
- package/dist/types/types/typography.d.ts +62 -0
- package/dist/types/types/window.d.ts +135 -0
- package/dist/types/utils/checkUser.d.ts +1 -0
- package/dist/types/utils/convertRialToToman.d.ts +7 -0
- package/dist/types/utils/createQueryParams.d.ts +3 -0
- package/dist/types/utils/dateHelpers.d.ts +19 -0
- package/dist/types/utils/delay.d.ts +1 -0
- package/dist/types/utils/formatPersianNumber.d.ts +1 -0
- package/dist/types/utils/getClaims.d.ts +11 -0
- package/dist/types/utils/index.d.ts +17 -0
- package/dist/types/utils/injastStyled.d.ts +2 -0
- package/dist/types/utils/postToParent.d.ts +2 -0
- package/dist/types/utils/toLatinDigit.d.ts +1 -0
- package/dist/utils/index.js +256 -0
- package/package.json +159 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/libs/create-api-request.ts
|
|
4
|
+
import axios from "axios";
|
|
5
|
+
var createApiRequest = (baseConfig, onRequestFulfilled, onRequestRejected, onResponseFulfilled, onResponseRejected, disableAuthHeader) => {
|
|
6
|
+
const pathname = typeof window !== "undefined" ? window.location.pathname : "";
|
|
7
|
+
const isPanelClient = /^\/([^\/]+\/)?panel(\/|$)/.test(pathname);
|
|
8
|
+
if (!baseConfig) baseConfig = {};
|
|
9
|
+
const { redirect: defaultRedirect, ...axiosDefaults } = baseConfig;
|
|
10
|
+
const axiosInstance = axios.create({
|
|
11
|
+
...axiosDefaults,
|
|
12
|
+
withCredentials: axiosDefaults.withCredentials ?? true
|
|
13
|
+
});
|
|
14
|
+
axiosInstance.defaults.headers.common.Accept = "application/json";
|
|
15
|
+
axiosInstance.defaults.headers.common["Content-Type"] = "application/json";
|
|
16
|
+
if (typeof window !== "undefined" && !disableAuthHeader) {
|
|
17
|
+
if (isPanelClient) {
|
|
18
|
+
axiosInstance.defaults.headers.common.Authorization = localStorage.getItem("panel_auth_token");
|
|
19
|
+
} else {
|
|
20
|
+
axiosInstance.defaults.headers.common.Authorization = localStorage.getItem("auth_token");
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
axiosInstance.interceptors.request.use(
|
|
24
|
+
async (config) => {
|
|
25
|
+
if (onRequestFulfilled) config = onRequestFulfilled(config);
|
|
26
|
+
return config;
|
|
27
|
+
},
|
|
28
|
+
(error) => {
|
|
29
|
+
console.log("\u{1F680} ~ apiRequest.interceptors.request. error:", error);
|
|
30
|
+
return Promise.reject(error);
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
axiosInstance.interceptors.response.use(
|
|
34
|
+
async (response) => {
|
|
35
|
+
if (onResponseFulfilled) response = await onResponseFulfilled(response);
|
|
36
|
+
return response;
|
|
37
|
+
},
|
|
38
|
+
(error) => {
|
|
39
|
+
console.log(
|
|
40
|
+
"\u{1F680} ~ Axios original error in apiRequest.interceptors.response: ",
|
|
41
|
+
error
|
|
42
|
+
);
|
|
43
|
+
if (onResponseRejected) {
|
|
44
|
+
const e = onResponseRejected(error);
|
|
45
|
+
if (e) return Promise.reject(e);
|
|
46
|
+
}
|
|
47
|
+
if (error.status === 401) {
|
|
48
|
+
if (typeof window !== "undefined") {
|
|
49
|
+
const host = localStorage.getItem("host_app");
|
|
50
|
+
console.log("\u{1F680} ~ createApiRequest ~ host:", host);
|
|
51
|
+
console.log("client 401, redirect to auth");
|
|
52
|
+
if (host === "ios" || host === "ios_wrapper") {
|
|
53
|
+
console.log("logout ios");
|
|
54
|
+
window.webkit.messageHandlers.logout.postMessage("");
|
|
55
|
+
} else if (host === "android" || host === "android_wrapper") {
|
|
56
|
+
console.log("logout android");
|
|
57
|
+
window.injast_android_app.logout();
|
|
58
|
+
} else {
|
|
59
|
+
localStorage.clear();
|
|
60
|
+
const requestRedirect = error.config?.redirect ?? defaultRedirect;
|
|
61
|
+
let href = isPanelClient ? "/panel/auth/login" : "/auth/login";
|
|
62
|
+
if (requestRedirect) {
|
|
63
|
+
href += `?redirect=${requestRedirect}`;
|
|
64
|
+
}
|
|
65
|
+
window.location.href = href;
|
|
66
|
+
}
|
|
67
|
+
return;
|
|
68
|
+
} else {
|
|
69
|
+
console.log("401, throw 401 error");
|
|
70
|
+
const e = JSON.stringify({ message: "401" });
|
|
71
|
+
return Promise.reject(e);
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
error.response.data.error_status = error.status;
|
|
75
|
+
console.log(
|
|
76
|
+
"\u{1F680} ~ axios on response => error.response.data: ",
|
|
77
|
+
error?.response?.data
|
|
78
|
+
);
|
|
79
|
+
const errorString = JSON.stringify(error?.response?.data || "");
|
|
80
|
+
const e = new Error(errorString);
|
|
81
|
+
return Promise.reject(e);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
return axiosInstance;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
// src/libs/create-sentry-instrument.ts
|
|
89
|
+
import * as Sentry from "@sentry/react";
|
|
90
|
+
function initSentry({ dsn, appName, release, environment }) {
|
|
91
|
+
Sentry.init({
|
|
92
|
+
dsn,
|
|
93
|
+
environment,
|
|
94
|
+
release: `${appName}@${release ?? "dev"}`,
|
|
95
|
+
tracesSampleRate: 1
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// src/libs/create-logger.ts
|
|
100
|
+
function formatTimestamp() {
|
|
101
|
+
const date = /* @__PURE__ */ new Date();
|
|
102
|
+
const pad = (n) => n.toString().padStart(2, "0");
|
|
103
|
+
const year = date.getFullYear();
|
|
104
|
+
const month = pad(date.getMonth() + 1);
|
|
105
|
+
const day = pad(date.getDate());
|
|
106
|
+
const hours = pad(date.getHours());
|
|
107
|
+
const minutes = pad(date.getMinutes());
|
|
108
|
+
const seconds = pad(date.getSeconds());
|
|
109
|
+
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
110
|
+
}
|
|
111
|
+
function createLogger(options, message, ...optionalParams) {
|
|
112
|
+
if (!options.enabled) return;
|
|
113
|
+
const prefix = options.prefix ?? "[AppLog]";
|
|
114
|
+
const timestamp = options.timestamp ? `[${formatTimestamp()}]` : "";
|
|
115
|
+
const consoleParts = [prefix];
|
|
116
|
+
if (timestamp) consoleParts.push(timestamp + ":");
|
|
117
|
+
console.log(...consoleParts, message, ...optionalParams);
|
|
118
|
+
if (typeof window !== "undefined") {
|
|
119
|
+
if (window.webkit?.messageHandlers?.consoleLog) {
|
|
120
|
+
try {
|
|
121
|
+
const serialized = JSON.stringify({ message, optionalParams });
|
|
122
|
+
window.webkit.messageHandlers.consoleLog.postMessage(
|
|
123
|
+
`${prefix} ${timestamp} ${serialized}`
|
|
124
|
+
);
|
|
125
|
+
} catch (err) {
|
|
126
|
+
console.warn("Failed to post message to iOS webkit handler:", err);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
} else {
|
|
130
|
+
if (typeof process !== "undefined") {
|
|
131
|
+
const text = [prefix, timestamp, message, ...optionalParams].map(String).join(" ") + "\n";
|
|
132
|
+
process.stdout.write(text);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
export {
|
|
137
|
+
Sentry,
|
|
138
|
+
createApiRequest,
|
|
139
|
+
createApiRequest as createApiRequestV2,
|
|
140
|
+
createLogger,
|
|
141
|
+
initSentry
|
|
142
|
+
};
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/providers/ThemeProvider.tsx
|
|
4
|
+
import { ThemeProvider as MUIThemeProvider } from "@mui/material/styles";
|
|
5
|
+
import { CacheProvider } from "@emotion/react";
|
|
6
|
+
import createCache from "@emotion/cache";
|
|
7
|
+
import rtlPlugin from "stylis-plugin-rtl";
|
|
8
|
+
import { prefixer } from "stylis";
|
|
9
|
+
import { createTheme } from "@mui/material/styles";
|
|
10
|
+
|
|
11
|
+
// src/constants/colors.ts
|
|
12
|
+
var defaultColors = {
|
|
13
|
+
neutral: {
|
|
14
|
+
50: "#F8FAFD",
|
|
15
|
+
100: "#F4F6FA",
|
|
16
|
+
200: "#E8EAEE",
|
|
17
|
+
300: "#D6D9DF",
|
|
18
|
+
400: "#B1B7C2",
|
|
19
|
+
500: "#91969F",
|
|
20
|
+
600: "#6B7079",
|
|
21
|
+
700: "#4F545E",
|
|
22
|
+
800: "#363C46",
|
|
23
|
+
900: "#242933",
|
|
24
|
+
main: "#4F545E",
|
|
25
|
+
light: "#91969F",
|
|
26
|
+
dark: "#242933",
|
|
27
|
+
contrastText: "#fff"
|
|
28
|
+
},
|
|
29
|
+
success: {
|
|
30
|
+
dark: "#0B8922",
|
|
31
|
+
main: "#18AB33",
|
|
32
|
+
light: "#EAF9EC"
|
|
33
|
+
},
|
|
34
|
+
danger: {
|
|
35
|
+
dark: "#B9141F",
|
|
36
|
+
main: "#ED2C3A",
|
|
37
|
+
light: "#FEEAEC"
|
|
38
|
+
},
|
|
39
|
+
warning: {
|
|
40
|
+
dark: "#CB620A",
|
|
41
|
+
main: "#FD7E14",
|
|
42
|
+
light: "#FFEFE1"
|
|
43
|
+
},
|
|
44
|
+
info: {
|
|
45
|
+
dark: "#168EA1",
|
|
46
|
+
main: "#24ADC2",
|
|
47
|
+
light: "#E5F8FB"
|
|
48
|
+
},
|
|
49
|
+
yellow: {
|
|
50
|
+
100: "#FFF3CD",
|
|
51
|
+
200: "#FFDA6A",
|
|
52
|
+
300: "#FFC107",
|
|
53
|
+
400: "#DCA000",
|
|
54
|
+
dark: "#DCA000",
|
|
55
|
+
main: "#FFC107",
|
|
56
|
+
light: "#FFF3CD",
|
|
57
|
+
transparent: "#FFC1071A"
|
|
58
|
+
},
|
|
59
|
+
red: {
|
|
60
|
+
100: "#FDEAEB",
|
|
61
|
+
200: "#FF606F",
|
|
62
|
+
300: "#ED2C3A",
|
|
63
|
+
400: "#AC2633",
|
|
64
|
+
dark: "#AC2633",
|
|
65
|
+
main: "#ED2C3A",
|
|
66
|
+
light: "#FDEAEB",
|
|
67
|
+
transparent: "#ED2C3A1A"
|
|
68
|
+
},
|
|
69
|
+
indigo: {
|
|
70
|
+
100: "#EEE3FF",
|
|
71
|
+
200: "#8540F5",
|
|
72
|
+
300: "#6610F2",
|
|
73
|
+
400: "#3D0A91",
|
|
74
|
+
dark: "#3D0A91",
|
|
75
|
+
main: "#6610F2",
|
|
76
|
+
light: "#EEE3FF",
|
|
77
|
+
transparent: "#6610F21A"
|
|
78
|
+
},
|
|
79
|
+
cyan: {
|
|
80
|
+
100: "#E5F8FB",
|
|
81
|
+
200: "#6EDFF6",
|
|
82
|
+
300: "#0DCAF0",
|
|
83
|
+
400: "#24ADC2",
|
|
84
|
+
dark: "#24ADC2",
|
|
85
|
+
main: "#0DCAF0",
|
|
86
|
+
light: "#E5F8FB",
|
|
87
|
+
transparent: "#0DCAF01A"
|
|
88
|
+
},
|
|
89
|
+
pink: {
|
|
90
|
+
100: "#FDECF0",
|
|
91
|
+
200: "#FF6C88",
|
|
92
|
+
300: "#EF4465",
|
|
93
|
+
400: "#CC2C4B",
|
|
94
|
+
dark: "#CC2C4B",
|
|
95
|
+
main: "#EF4465",
|
|
96
|
+
light: "#FDECF0",
|
|
97
|
+
transparent: "#EF44651A"
|
|
98
|
+
},
|
|
99
|
+
orange: {
|
|
100
|
+
100: "#FFEFE1",
|
|
101
|
+
200: "#FD9843",
|
|
102
|
+
300: "#FD7E14",
|
|
103
|
+
400: "#A34A00",
|
|
104
|
+
dark: "#A34A00",
|
|
105
|
+
main: "#FD7E14",
|
|
106
|
+
light: "#FFEFE1",
|
|
107
|
+
transparent: "#FFC1071A"
|
|
108
|
+
},
|
|
109
|
+
magenta: {
|
|
110
|
+
100: "#FCE3EF",
|
|
111
|
+
200: "#DE5C9D",
|
|
112
|
+
300: "#D63384",
|
|
113
|
+
400: "#801F4F",
|
|
114
|
+
dark: "#801F4F",
|
|
115
|
+
main: "#D63384",
|
|
116
|
+
light: "#FCE3EF",
|
|
117
|
+
transparent: "#D633841A"
|
|
118
|
+
},
|
|
119
|
+
blue: {
|
|
120
|
+
100: "#E3F2FF",
|
|
121
|
+
200: "#5A9DFF",
|
|
122
|
+
300: "#0D6EFD",
|
|
123
|
+
400: "#084298",
|
|
124
|
+
dark: "#084298",
|
|
125
|
+
main: "#0D6EFD",
|
|
126
|
+
light: "#E3F2FF",
|
|
127
|
+
transparent: "#0D6EFD1A"
|
|
128
|
+
},
|
|
129
|
+
teal: {
|
|
130
|
+
100: "#E5FAF4",
|
|
131
|
+
200: "#79DFC1",
|
|
132
|
+
300: "#20C997",
|
|
133
|
+
400: "#179D76",
|
|
134
|
+
dark: "#179D76",
|
|
135
|
+
main: "#20C997",
|
|
136
|
+
light: "#E5FAF4",
|
|
137
|
+
transparent: "#20C9971A"
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
// src/constants/typography.ts
|
|
142
|
+
var uiTypography = {
|
|
143
|
+
display1: {
|
|
144
|
+
fontSize: "32px",
|
|
145
|
+
fontWeight: 700
|
|
146
|
+
},
|
|
147
|
+
display2: {
|
|
148
|
+
fontSize: "24px",
|
|
149
|
+
fontWeight: 700
|
|
150
|
+
},
|
|
151
|
+
display3: {
|
|
152
|
+
fontSize: "20px",
|
|
153
|
+
fontWeight: 700
|
|
154
|
+
},
|
|
155
|
+
h1: {
|
|
156
|
+
fontSize: "18px",
|
|
157
|
+
fontWeight: 500
|
|
158
|
+
},
|
|
159
|
+
h2: {
|
|
160
|
+
fontSize: "16px",
|
|
161
|
+
fontWeight: 500
|
|
162
|
+
},
|
|
163
|
+
h3: {
|
|
164
|
+
fontSize: "14px",
|
|
165
|
+
fontWeight: 500
|
|
166
|
+
},
|
|
167
|
+
title1: {
|
|
168
|
+
fontSize: "16px",
|
|
169
|
+
fontWeight: 500
|
|
170
|
+
},
|
|
171
|
+
title2: {
|
|
172
|
+
fontSize: "14px",
|
|
173
|
+
fontWeight: 500
|
|
174
|
+
},
|
|
175
|
+
title3: {
|
|
176
|
+
fontSize: "12px",
|
|
177
|
+
fontWeight: 500
|
|
178
|
+
},
|
|
179
|
+
title4: {
|
|
180
|
+
fontSize: "10px",
|
|
181
|
+
fontWeight: 500
|
|
182
|
+
},
|
|
183
|
+
input1: {
|
|
184
|
+
fontSize: "16px",
|
|
185
|
+
fontWeight: 500
|
|
186
|
+
},
|
|
187
|
+
input2: {
|
|
188
|
+
fontSize: "14px",
|
|
189
|
+
fontWeight: 500
|
|
190
|
+
},
|
|
191
|
+
input3: {
|
|
192
|
+
fontSize: "12px",
|
|
193
|
+
fontWeight: 500
|
|
194
|
+
},
|
|
195
|
+
button1: {
|
|
196
|
+
fontSize: "16px",
|
|
197
|
+
fontWeight: 700
|
|
198
|
+
},
|
|
199
|
+
button2: {
|
|
200
|
+
fontSize: "14px",
|
|
201
|
+
fontWeight: 700
|
|
202
|
+
},
|
|
203
|
+
button3: {
|
|
204
|
+
fontSize: "12px",
|
|
205
|
+
fontWeight: 700
|
|
206
|
+
},
|
|
207
|
+
body1: {
|
|
208
|
+
fontSize: "14px",
|
|
209
|
+
fontWeight: 500
|
|
210
|
+
},
|
|
211
|
+
body2: {
|
|
212
|
+
fontSize: "12px",
|
|
213
|
+
fontWeight: 500
|
|
214
|
+
},
|
|
215
|
+
label1: {
|
|
216
|
+
fontSize: "12px",
|
|
217
|
+
fontWeight: 400
|
|
218
|
+
},
|
|
219
|
+
label2: {
|
|
220
|
+
fontSize: "10px",
|
|
221
|
+
fontWeight: 400
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
// src/providers/ThemeProvider.tsx
|
|
226
|
+
import { jsx } from "react/jsx-runtime";
|
|
227
|
+
var ThemeProvider = ({
|
|
228
|
+
children,
|
|
229
|
+
appColors,
|
|
230
|
+
dir
|
|
231
|
+
}) => {
|
|
232
|
+
const cacheRtl = createCache({
|
|
233
|
+
key: "muirtl",
|
|
234
|
+
stylisPlugins: [prefixer, rtlPlugin]
|
|
235
|
+
});
|
|
236
|
+
const cacheLtr = createCache({
|
|
237
|
+
key: "muiltr",
|
|
238
|
+
stylisPlugins: [prefixer]
|
|
239
|
+
});
|
|
240
|
+
const themeOptions = {
|
|
241
|
+
// colorSchemes: {
|
|
242
|
+
// dark: false,
|
|
243
|
+
// },
|
|
244
|
+
palette: {
|
|
245
|
+
...appColors,
|
|
246
|
+
...defaultColors
|
|
247
|
+
},
|
|
248
|
+
typography: {
|
|
249
|
+
fontFamily: '"IRANYekanX", sans-serif',
|
|
250
|
+
...uiTypography
|
|
251
|
+
},
|
|
252
|
+
spacing: 4
|
|
253
|
+
};
|
|
254
|
+
const theme = createTheme(themeOptions);
|
|
255
|
+
return /* @__PURE__ */ jsx(CacheProvider, { value: dir === "rtl" ? cacheRtl : cacheLtr, children: /* @__PURE__ */ jsx(MUIThemeProvider, { theme, children }) });
|
|
256
|
+
};
|
|
257
|
+
var ThemeProvider_default = ThemeProvider;
|
|
258
|
+
|
|
259
|
+
// src/providers/SPAThemeProvider.tsx
|
|
260
|
+
import { ThemeProvider as MUIThemeProvider2 } from "@mui/material/styles";
|
|
261
|
+
import { createTheme as createTheme2 } from "@mui/material/styles";
|
|
262
|
+
import rtlPlugin2 from "stylis-plugin-rtl";
|
|
263
|
+
import { prefixer as prefixer2 } from "stylis";
|
|
264
|
+
import { CacheProvider as CacheProvider2 } from "@emotion/react";
|
|
265
|
+
import createCache2 from "@emotion/cache";
|
|
266
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
267
|
+
var SPAThemeProvider = ({
|
|
268
|
+
children,
|
|
269
|
+
appColors,
|
|
270
|
+
dir,
|
|
271
|
+
defaultColors: defaultColorsProp,
|
|
272
|
+
themeOptions
|
|
273
|
+
}) => {
|
|
274
|
+
const paletteDefaults = defaultColorsProp ?? defaultColors;
|
|
275
|
+
const theme = createTheme2({
|
|
276
|
+
direction: dir,
|
|
277
|
+
colorSchemes: {
|
|
278
|
+
dark: true
|
|
279
|
+
},
|
|
280
|
+
palette: {
|
|
281
|
+
...appColors,
|
|
282
|
+
...paletteDefaults
|
|
283
|
+
},
|
|
284
|
+
typography: {
|
|
285
|
+
fontFamily: '"IRANYekanXFaNum", sans-serif',
|
|
286
|
+
...uiTypography
|
|
287
|
+
},
|
|
288
|
+
spacing: 4,
|
|
289
|
+
...themeOptions
|
|
290
|
+
});
|
|
291
|
+
const cacheRtl = createCache2({
|
|
292
|
+
key: "muirtl",
|
|
293
|
+
stylisPlugins: [prefixer2, rtlPlugin2]
|
|
294
|
+
});
|
|
295
|
+
const cacheLtr = createCache2({
|
|
296
|
+
key: "muiltr",
|
|
297
|
+
stylisPlugins: [prefixer2]
|
|
298
|
+
});
|
|
299
|
+
return /* @__PURE__ */ jsx2(CacheProvider2, { value: dir === "rtl" ? cacheRtl : cacheLtr, children: /* @__PURE__ */ jsx2(MUIThemeProvider2, { theme, defaultMode: "light", children }) });
|
|
300
|
+
};
|
|
301
|
+
var SPAThemeProvider_default = SPAThemeProvider;
|
|
302
|
+
export {
|
|
303
|
+
SPAThemeProvider_default as SPAThemeProvider,
|
|
304
|
+
ThemeProvider_default as ThemeProvider
|
|
305
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { AutocompleteProps as MuiMuiAutocompleteProps } from "@mui/material";
|
|
2
|
+
declare const Autocomplete: <Value, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false>(props: MuiMuiAutocompleteProps<Value, Multiple, DisableClearable, FreeSolo>) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default Autocomplete;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { ButtonProps as MuiButtonProps } from "@mui/material";
|
|
3
|
+
interface ButtonProps extends MuiButtonProps {
|
|
4
|
+
buttonSize?: "L" | "M" | "S" | "XS";
|
|
5
|
+
loading?: boolean;
|
|
6
|
+
loadingColor?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const Button: FC<ButtonProps>;
|
|
9
|
+
export default Button;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface CardNumberInputProps {
|
|
3
|
+
value: string;
|
|
4
|
+
onChange: (value: string) => void;
|
|
5
|
+
error?: boolean;
|
|
6
|
+
helperText?: string;
|
|
7
|
+
hasClearButton?: boolean;
|
|
8
|
+
onReset?: () => void;
|
|
9
|
+
bankLogo?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const getPanNumber: (pan: string) => string;
|
|
12
|
+
declare const CardNumberInput: React.FC<CardNumberInputProps>;
|
|
13
|
+
export default CardNumberInput;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CheckboxProps as MuiCheckboxProps } from "@mui/material";
|
|
3
|
+
interface CheckboxProps extends MuiCheckboxProps {
|
|
4
|
+
iconSize?: number;
|
|
5
|
+
borderColor?: string;
|
|
6
|
+
checkedBorderColor?: string;
|
|
7
|
+
backgroundColor?: string;
|
|
8
|
+
tickColor?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const Checkbox: React.FC<CheckboxProps>;
|
|
11
|
+
export default Checkbox;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
type CounterBoxInputProps = {
|
|
3
|
+
min?: number;
|
|
4
|
+
max?: number;
|
|
5
|
+
step?: number;
|
|
6
|
+
defaultValue?: number;
|
|
7
|
+
value?: number;
|
|
8
|
+
onChange: (_value: number) => void;
|
|
9
|
+
unit?: string;
|
|
10
|
+
iconColor?: string;
|
|
11
|
+
iconBackgroundColor?: string;
|
|
12
|
+
error?: boolean;
|
|
13
|
+
helperText?: string;
|
|
14
|
+
fullWidth?: boolean;
|
|
15
|
+
allowFloat?: boolean;
|
|
16
|
+
minErrText?: string;
|
|
17
|
+
maxErrText?: string;
|
|
18
|
+
mb?: number;
|
|
19
|
+
disabledInput?: boolean;
|
|
20
|
+
maxAvailable?: number;
|
|
21
|
+
};
|
|
22
|
+
declare const CounterBoxInput: FC<CounterBoxInputProps>;
|
|
23
|
+
export default CounterBoxInput;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type MRT_ColumnDef, type MRT_RowData, type MRT_TableOptions, type MRT_TableInstance, type MRT_Row } from 'material-react-table';
|
|
2
|
+
import { MRT_Localization_FA } from 'material-react-table/locales/fa';
|
|
3
|
+
export type { MRT_ColumnDef, MRT_RowData, MRT_TableOptions, MRT_TableInstance, MRT_Row, };
|
|
4
|
+
/**
|
|
5
|
+
* DataGrid Props - Thin wrapper around Material React Table
|
|
6
|
+
*
|
|
7
|
+
* All MRT options can be passed directly. This component adds:
|
|
8
|
+
* - RTL support with sensible defaults
|
|
9
|
+
* - Persian localization by default
|
|
10
|
+
* - Automatic direction handling
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* // Basic usage
|
|
15
|
+
* <DataGrid columns={columns} data={data} />
|
|
16
|
+
*
|
|
17
|
+
* // With MRT options
|
|
18
|
+
* <DataGrid
|
|
19
|
+
* columns={columns}
|
|
20
|
+
* data={data}
|
|
21
|
+
* enableRowSelection
|
|
22
|
+
* enableSorting
|
|
23
|
+
* enableColumnFilters
|
|
24
|
+
* renderRowActions={({ row }) => <button>Edit</button>}
|
|
25
|
+
* initialState={{ density: 'compact' }}
|
|
26
|
+
* />
|
|
27
|
+
*
|
|
28
|
+
* // Full MRT API access
|
|
29
|
+
* <DataGrid
|
|
30
|
+
* columns={columns}
|
|
31
|
+
* data={data}
|
|
32
|
+
* enableExpanding
|
|
33
|
+
* enableColumnPinning
|
|
34
|
+
* muiTableContainerProps={{ sx: { maxHeight: '500px' }}}
|
|
35
|
+
* renderTopToolbar={({ table }) => <CustomToolbar table={table} />}
|
|
36
|
+
* />
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export interface DataGridProps<TData extends MRT_RowData> extends Omit<MRT_TableOptions<TData>, 'columns' | 'data' | 'localization'> {
|
|
40
|
+
/** Column definitions (required) */
|
|
41
|
+
columns: MRT_ColumnDef<TData>[];
|
|
42
|
+
/** Data array (required) */
|
|
43
|
+
data: TData[];
|
|
44
|
+
/** Localization - defaults to Persian (FA) */
|
|
45
|
+
localization?: Partial<typeof MRT_Localization_FA>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* DataGrid Component - RTL-first wrapper for Material React Table
|
|
49
|
+
*
|
|
50
|
+
* A fully dynamic data grid that exposes the complete MRT API while providing
|
|
51
|
+
* RTL support and Persian localization out of the box.
|
|
52
|
+
*
|
|
53
|
+
* All MRT props are supported - see https://www.material-react-table.com/docs/api/table-options
|
|
54
|
+
*/
|
|
55
|
+
export declare const DataGrid: <TData extends MRT_RowData>({ columns, data, localization, layoutMode, enableRowActions, initialState, displayColumnDefOptions, muiTablePaperProps, muiTableContainerProps, muiTableHeadCellProps, muiTableBodyCellProps, muiTableBodyRowProps, muiSelectCheckboxProps, ...mrtOptions }: DataGridProps<TData>) => import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
export { useMaterialReactTable } from 'material-react-table';
|
|
57
|
+
export default DataGrid;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DrawerProps as MuiDrawerProp } from "@mui/material";
|
|
2
|
+
import React, { FC } from "react";
|
|
3
|
+
interface DrawerProps {
|
|
4
|
+
isDrawerOpen: boolean;
|
|
5
|
+
onClose?: () => void;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
declare const Drawer: FC<DrawerProps & MuiDrawerProp>;
|
|
9
|
+
export default Drawer;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface ImageProps {
|
|
3
|
+
src: string;
|
|
4
|
+
width: number | string;
|
|
5
|
+
height: number | string;
|
|
6
|
+
alt?: string;
|
|
7
|
+
objectFit?: React.CSSProperties["objectFit"];
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
fallbackSrc?: string;
|
|
10
|
+
}
|
|
11
|
+
declare const Image: React.FC<ImageProps>;
|
|
12
|
+
export default Image;
|