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
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Injast
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# Injast Core
|
|
2
|
+
|
|
3
|
+
Reusable React components, Material UI theme providers, hooks, utilities, and design tokens used by Injast applications.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install injast-core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Peer requirements:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install react@^19 react-dom@^19
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The package is published as ESM and is intended for modern React bundlers such as Vite, Next.js, and similar tooling.
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
Root imports are supported:
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { Button, TextField, ThemeProvider, coreFaIR } from "injast-core";
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Subpath imports are also available when you want a narrower entrypoint:
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { Button, TextField } from "injast-core/components";
|
|
31
|
+
import { ThemeProvider, SPAThemeProvider } from "injast-core/providers";
|
|
32
|
+
import { createApiRequest } from "injast-core/libs";
|
|
33
|
+
import { convertRialToToman, formatPersianNumber } from "injast-core/utils";
|
|
34
|
+
import { defaultColors } from "injast-core/constants";
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Theme Providers
|
|
38
|
+
|
|
39
|
+
For React single-page applications:
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
import { SPAThemeProvider, coreFaIR } from "injast-core";
|
|
43
|
+
|
|
44
|
+
const appColors = {
|
|
45
|
+
primary: {
|
|
46
|
+
main: "#1DBF98",
|
|
47
|
+
light: "#1DBF98",
|
|
48
|
+
dark: "#1DBF98",
|
|
49
|
+
contrastText: "#ffffff",
|
|
50
|
+
},
|
|
51
|
+
secondary: {
|
|
52
|
+
main: "#4F545E",
|
|
53
|
+
light: "#4F545E",
|
|
54
|
+
dark: "#4F545E",
|
|
55
|
+
contrastText: "#ffffff",
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export function AppProviders({ children }: { children: React.ReactNode }) {
|
|
60
|
+
return (
|
|
61
|
+
<SPAThemeProvider
|
|
62
|
+
dir="rtl"
|
|
63
|
+
appColors={appColors}
|
|
64
|
+
themeOptions={{ ...coreFaIR }}
|
|
65
|
+
>
|
|
66
|
+
{children}
|
|
67
|
+
</SPAThemeProvider>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
For Next.js client layouts or app providers:
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
"use client";
|
|
76
|
+
|
|
77
|
+
import { ThemeProvider } from "injast-core";
|
|
78
|
+
|
|
79
|
+
const appColors = {
|
|
80
|
+
primary: {
|
|
81
|
+
main: "#1DBF98",
|
|
82
|
+
light: "#1DBF98",
|
|
83
|
+
dark: "#1DBF98",
|
|
84
|
+
contrastText: "#ffffff",
|
|
85
|
+
},
|
|
86
|
+
secondary: {
|
|
87
|
+
main: "#4F545E",
|
|
88
|
+
light: "#4F545E",
|
|
89
|
+
dark: "#4F545E",
|
|
90
|
+
contrastText: "#ffffff",
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export function Providers({ children }: { children: React.ReactNode }) {
|
|
95
|
+
return (
|
|
96
|
+
<ThemeProvider dir="rtl" appColors={appColors}>
|
|
97
|
+
{children}
|
|
98
|
+
</ThemeProvider>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Components
|
|
104
|
+
|
|
105
|
+
`injast-core/components` exports wrappers and custom components including `Button`, `TextField`, `Select`, `Modal`, `Toast`, `MobileDatePicker`, `WheelDatePicker`, `DataGrid`, `MultiSelect`, `OtpInput`, `NumberInput`, `CardNumberInput`, and common Material UI layout primitives.
|
|
106
|
+
|
|
107
|
+
Most wrapper components accept the corresponding Material UI component props, with additional Injast-specific props where documented in Storybook stories.
|
|
108
|
+
|
|
109
|
+
## Utilities and Hooks
|
|
110
|
+
|
|
111
|
+
Useful utilities are exported from `injast-core/utils`, including date conversion helpers, Persian number formatting, query string creation, iframe messaging, and `coreFaIR` for MUI Persian locale configuration.
|
|
112
|
+
|
|
113
|
+
Hooks are exported from `injast-core/hooks`, including shared Material UI hooks and Injast-specific helpers such as `useErrorHandler`, `useMessage`, and `useWebOtpListener`.
|
|
114
|
+
|
|
115
|
+
## Fonts and Date Picker CSS
|
|
116
|
+
|
|
117
|
+
The theme uses the `IRANYekanX` and `IRANYekanXFaNum` font families. You can load the bundled font stylesheet once in your app:
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
import "injast-core/fonts.css";
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
`MobileDatePicker` imports the required `react-multi-date-picker` mobile layout stylesheet from its dependency. Ensure your bundler supports CSS imports from JavaScript modules.
|
|
124
|
+
|
|
125
|
+
## License
|
|
126
|
+
|
|
127
|
+
ISC
|