injast-core 1.0.78 → 1.0.80
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 +21 -1
- package/guidelines/Guidelines.md +55 -0
- package/guidelines/components/buttons.md +43 -0
- package/guidelines/components/data-display.md +43 -0
- package/guidelines/components/date-inputs.md +45 -0
- package/guidelines/components/feedback.md +47 -0
- package/guidelines/components/forms.md +68 -0
- package/guidelines/components/layout.md +36 -0
- package/guidelines/components/overview.md +60 -0
- package/guidelines/foundations/color.md +51 -0
- package/guidelines/foundations/spacing.md +34 -0
- package/guidelines/foundations/typography.md +33 -0
- package/guidelines/setup.md +89 -0
- package/package.json +14 -7
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ npm install injast-core
|
|
|
11
11
|
Peer requirements:
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
npm install react@^
|
|
14
|
+
npm install react@^18.2.0 react-dom@^18.2.0
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
The package is published as ESM and is intended for modern React bundlers such as Vite, Next.js, and similar tooling.
|
|
@@ -122,6 +122,26 @@ import "injast-core/fonts.css";
|
|
|
122
122
|
|
|
123
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
124
|
|
|
125
|
+
## Figma Make
|
|
126
|
+
|
|
127
|
+
Figma Make users should select the public npm package named `injast-core`. Do not use `@alimohammadiwork/injast-core` or `@make-kits/injast-core-make-kit` for the public package path.
|
|
128
|
+
|
|
129
|
+
If the package selector ranks unrelated `core` packages when searching `injast-core`, search for:
|
|
130
|
+
|
|
131
|
+
```text
|
|
132
|
+
injast
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Then select `injast-core` from the public unscoped package results.
|
|
136
|
+
|
|
137
|
+
For Make kits, start with the included guidelines:
|
|
138
|
+
|
|
139
|
+
```text
|
|
140
|
+
guidelines/Guidelines.md
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
The guidelines route Make to setup instructions, foundations, component selection rules, and focused component usage notes. In a Vite/React Make file, use `SPAThemeProvider`, import `injast-core/fonts.css` once, and prefer Injast components over raw HTML controls.
|
|
144
|
+
|
|
125
145
|
## License
|
|
126
146
|
|
|
127
147
|
ISC
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Injast Core Design System Guidelines
|
|
2
|
+
|
|
3
|
+
## Product Character
|
|
4
|
+
|
|
5
|
+
Injast Core is an RTL-first React and Material UI design system for Persian product interfaces. Build calm, practical application screens with clear hierarchy, compact spacing, and predictable form and data workflows.
|
|
6
|
+
|
|
7
|
+
- Use `injast-core` components before raw HTML or direct Material UI components.
|
|
8
|
+
- Use RTL by default unless the user explicitly asks for LTR.
|
|
9
|
+
- Use Persian-friendly labels and layout direction when content is Persian.
|
|
10
|
+
- Keep layouts dense enough for operational use, but preserve breathing room around forms, dialogs, tables, and decision points.
|
|
11
|
+
- Use brand color for primary actions and active states, not large decorative backgrounds.
|
|
12
|
+
|
|
13
|
+
## Reading Order
|
|
14
|
+
|
|
15
|
+
Always read these files before writing app code with this package:
|
|
16
|
+
|
|
17
|
+
1. `guidelines/Guidelines.md`
|
|
18
|
+
2. `guidelines/setup.md`
|
|
19
|
+
3. `guidelines/foundations/color.md`
|
|
20
|
+
4. `guidelines/foundations/typography.md`
|
|
21
|
+
5. `guidelines/foundations/spacing.md`
|
|
22
|
+
6. `guidelines/components/overview.md`
|
|
23
|
+
|
|
24
|
+
Read focused component files before using those component groups:
|
|
25
|
+
|
|
26
|
+
- `guidelines/components/buttons.md`
|
|
27
|
+
- `guidelines/components/forms.md`
|
|
28
|
+
- `guidelines/components/feedback.md`
|
|
29
|
+
- `guidelines/components/layout.md`
|
|
30
|
+
- `guidelines/components/data-display.md`
|
|
31
|
+
- `guidelines/components/date-inputs.md`
|
|
32
|
+
|
|
33
|
+
## Package Rules
|
|
34
|
+
|
|
35
|
+
- Install and import the public package as `injast-core`.
|
|
36
|
+
- In Figma Make package search, use `injast` if exact `injast-core` search ranks unrelated `core` packages first.
|
|
37
|
+
- Do not import `@alimohammadiwork/injast-core`; that scoped package is not this package.
|
|
38
|
+
- Do not use `@make-kits/injast-core-make-kit` for the public npm package path.
|
|
39
|
+
- For Figma Make and Vite React apps, use `SPAThemeProvider`.
|
|
40
|
+
- Import `injast-core/fonts.css` once near the app root.
|
|
41
|
+
- Use named imports from `injast-core` for common usage; use subpath imports for focused entrypoints.
|
|
42
|
+
|
|
43
|
+
## Component Rules
|
|
44
|
+
|
|
45
|
+
- Use `Button` for actions, not raw `<button>`.
|
|
46
|
+
- Use `TextField`, `NumberInput`, `CardNumberInput`, `OtpInput`, `Select`, `MultiSelect`, `Checkbox`, `RadioGroup`, and `Toggle` for input.
|
|
47
|
+
- Use `Modal` for focused tasks; use `Toast` for brief status feedback.
|
|
48
|
+
- Use `DataGrid` for tabular operational data.
|
|
49
|
+
- Use `Box`, `Container`, and `Grid` for layout.
|
|
50
|
+
- Use `defaultColors` and theme palette values instead of hardcoded colors when possible.
|
|
51
|
+
- Do not guess unsupported component props. Use Material UI props plus the documented Injast-specific props.
|
|
52
|
+
|
|
53
|
+
## Output Expectations
|
|
54
|
+
|
|
55
|
+
Generated screens should look like production product UI, not a marketing page. Prefer direct task surfaces, clear forms, data tables, status feedback, and navigation patterns that users can scan and operate repeatedly.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Buttons
|
|
2
|
+
|
|
3
|
+
## Button
|
|
4
|
+
|
|
5
|
+
Use `Button` for every visible action. It wraps Material UI `Button` and accepts Material UI button props plus Injast-specific sizing and loading props.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Button } from "injast-core";
|
|
9
|
+
|
|
10
|
+
<Button variant="contained" color="primary" buttonSize="M">
|
|
11
|
+
ثبت
|
|
12
|
+
</Button>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Props
|
|
16
|
+
|
|
17
|
+
| Prop | Type | Default | Notes |
|
|
18
|
+
|---|---|---|---|
|
|
19
|
+
| `buttonSize` | `"L" | "M" | "S" | "XS"` | `"M"` | Controls height, radius, and font size |
|
|
20
|
+
| `loading` | `boolean` | `false` | Replaces content with spinner and disables click |
|
|
21
|
+
| `loadingColor` | `string` | `neutral.50` | Spinner color |
|
|
22
|
+
| Material UI `ButtonProps` | varies | - | Use `variant`, `color`, `disabled`, `startIcon`, `endIcon`, `fullWidth` |
|
|
23
|
+
|
|
24
|
+
## Sizing
|
|
25
|
+
|
|
26
|
+
| Size | Height | Use for |
|
|
27
|
+
|---|---:|---|
|
|
28
|
+
| `L` | 56px | High-emphasis primary actions |
|
|
29
|
+
| `M` | 48px | Default form and page actions |
|
|
30
|
+
| `S` | 40px | Dense toolbars or secondary actions |
|
|
31
|
+
| `XS` | 32px | Compact inline actions |
|
|
32
|
+
|
|
33
|
+
## Variant Rules
|
|
34
|
+
|
|
35
|
+
- Use `variant="contained"` and `color="primary"` for the main action.
|
|
36
|
+
- Use `variant="outlined"` for secondary actions.
|
|
37
|
+
- Use `variant="text"` only for low-emphasis actions.
|
|
38
|
+
- Keep one primary contained action per focused region.
|
|
39
|
+
- Use `loading` instead of manually swapping button text.
|
|
40
|
+
|
|
41
|
+
## IconButton and Fab
|
|
42
|
+
|
|
43
|
+
Use `IconButton` for compact icon-only controls and pair it with a visible label nearby or a tooltip when possible. Use `Fab` only for a single prominent floating action.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Data Display
|
|
2
|
+
|
|
3
|
+
## DataGrid
|
|
4
|
+
|
|
5
|
+
Use `DataGrid` for tabular data. It wraps Material React Table with RTL and Persian localization defaults.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { DataGrid, type MRT_ColumnDef } from "injast-core";
|
|
9
|
+
|
|
10
|
+
type Row = { id: string; name: string; status: string };
|
|
11
|
+
|
|
12
|
+
const columns: MRT_ColumnDef<Row>[] = [
|
|
13
|
+
{ accessorKey: "name", header: "نام" },
|
|
14
|
+
{ accessorKey: "status", header: "وضعیت" },
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
<DataGrid columns={columns} data={rows} enableSorting />;
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Rules:
|
|
21
|
+
|
|
22
|
+
- Define stable `columns` outside render or memoize them.
|
|
23
|
+
- Use compact density for operational pages.
|
|
24
|
+
- Use built-in MRT options for sorting, filtering, selection, row actions, and pagination.
|
|
25
|
+
- Keep row actions concise and aligned.
|
|
26
|
+
|
|
27
|
+
## Typography
|
|
28
|
+
|
|
29
|
+
Use `Typography` for labels, headings, metadata, and body text. Match text scale to context; do not use display styles inside dense cards or tables.
|
|
30
|
+
|
|
31
|
+
## Image
|
|
32
|
+
|
|
33
|
+
Use `Image` for image content. Always provide useful `alt` text unless the image is decorative.
|
|
34
|
+
|
|
35
|
+
## Pagination and Divider
|
|
36
|
+
|
|
37
|
+
Use `Pagination` when data is split across pages. Use `Divider` to separate adjacent content groups, not as a substitute for spacing.
|
|
38
|
+
|
|
39
|
+
## Empty and Loading States
|
|
40
|
+
|
|
41
|
+
- Use `Skeleton` when data is loading.
|
|
42
|
+
- Use a concise empty state with one primary recovery action when no data exists.
|
|
43
|
+
- Use `ProgressBar` for determinate progress.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Date Inputs
|
|
2
|
+
|
|
3
|
+
## MobileDatePicker
|
|
4
|
+
|
|
5
|
+
Use `MobileDatePicker` for Persian calendar date entry in mobile-first or responsive forms.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<MobileDatePicker
|
|
9
|
+
label="تاریخ"
|
|
10
|
+
value={date}
|
|
11
|
+
onChange={setDate}
|
|
12
|
+
minDate="1403/01/01"
|
|
13
|
+
maxDate="1403/12/29"
|
|
14
|
+
/>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Rules:
|
|
18
|
+
|
|
19
|
+
- `onChange` receives the selected date converted to Gregorian format.
|
|
20
|
+
- Use `label`, `placeholder`, `error`, and `helperText` for form clarity.
|
|
21
|
+
- Pass `disabled` when the date cannot be edited.
|
|
22
|
+
- Ensure the app build supports CSS imports from npm packages.
|
|
23
|
+
|
|
24
|
+
## WheelDatePicker
|
|
25
|
+
|
|
26
|
+
Use `WheelDatePicker` when a drawer-style date picker is more appropriate than the modal calendar.
|
|
27
|
+
|
|
28
|
+
Rules:
|
|
29
|
+
|
|
30
|
+
- Prefer it for touch-heavy flows.
|
|
31
|
+
- Keep surrounding form actions clear: cancel and confirm.
|
|
32
|
+
- Use the `onChange` format expected by the receiving form state.
|
|
33
|
+
|
|
34
|
+
## Date Utilities
|
|
35
|
+
|
|
36
|
+
Use utility functions from `injast-core/utils` for conversion and display:
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
import {
|
|
40
|
+
gregorianToJalali,
|
|
41
|
+
jalaliToGregorian,
|
|
42
|
+
shortDateFormat,
|
|
43
|
+
longDateFormat,
|
|
44
|
+
} from "injast-core";
|
|
45
|
+
```
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Feedback
|
|
2
|
+
|
|
3
|
+
## Toast
|
|
4
|
+
|
|
5
|
+
Use `Toast` for brief status feedback. Do not use it for long instructions or complex decisions.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<Toast
|
|
9
|
+
open={open}
|
|
10
|
+
duration={4000}
|
|
11
|
+
handleClose={() => setOpen(false)}
|
|
12
|
+
message={{ severity: "success", text: "با موفقیت ثبت شد" }}
|
|
13
|
+
/>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Valid severity values:
|
|
17
|
+
|
|
18
|
+
- `success`
|
|
19
|
+
- `info`
|
|
20
|
+
- `warning`
|
|
21
|
+
- `error`
|
|
22
|
+
|
|
23
|
+
## Modal and Dialog
|
|
24
|
+
|
|
25
|
+
Use `Modal` for focused tasks, confirmations, and compact forms. Keep modal content short and actionable.
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
<Modal open={open} onClose={handleClose} width={420}>
|
|
29
|
+
<Typography variant="h2">حذف مورد</Typography>
|
|
30
|
+
<Typography variant="body1">آیا مطمئن هستید؟</Typography>
|
|
31
|
+
<Button variant="contained" color="primary">تایید</Button>
|
|
32
|
+
</Modal>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Rules:
|
|
36
|
+
|
|
37
|
+
- Always provide a visible close or cancel path.
|
|
38
|
+
- Keep destructive confirmation actions explicit.
|
|
39
|
+
- Avoid putting full pages inside modals.
|
|
40
|
+
|
|
41
|
+
## Loading and Progress
|
|
42
|
+
|
|
43
|
+
- Use `Loading` for full-area loading.
|
|
44
|
+
- Use `LoadingModal` when a blocking process is running.
|
|
45
|
+
- Use `CircularProgress` inside small controls.
|
|
46
|
+
- Use `Skeleton` for content placeholders.
|
|
47
|
+
- Use `ProgressBar` when progress has a known percentage or status.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Forms
|
|
2
|
+
|
|
3
|
+
## General Rules
|
|
4
|
+
|
|
5
|
+
- Use controlled components for form values.
|
|
6
|
+
- Use `TextField` instead of raw `<input>`.
|
|
7
|
+
- Put labels on every input unless the context is visually obvious.
|
|
8
|
+
- Use `error` and `helperText` for validation messages.
|
|
9
|
+
- Use 48px control height for default forms.
|
|
10
|
+
- Use RTL layout for Persian forms.
|
|
11
|
+
|
|
12
|
+
## TextField
|
|
13
|
+
|
|
14
|
+
`TextField` accepts Material UI `TextFieldProps` plus:
|
|
15
|
+
|
|
16
|
+
| Prop | Type | Purpose |
|
|
17
|
+
|---|---|---|
|
|
18
|
+
| `startAdornment` | `ReactNode` | Icon or prefix inside the input |
|
|
19
|
+
| `endAdornment` | `ReactNode` | Icon or suffix inside the input |
|
|
20
|
+
| `height` | `number` | Explicit field height |
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
<TextField
|
|
24
|
+
label="نام"
|
|
25
|
+
value={name}
|
|
26
|
+
onChange={(event) => setName(event.target.value)}
|
|
27
|
+
height={48}
|
|
28
|
+
/>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Select and MultiSelect
|
|
32
|
+
|
|
33
|
+
Use `Select` for a single value and `MultiSelect` for multiple values.
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
<MultiSelect
|
|
37
|
+
label="دسته بندی"
|
|
38
|
+
value={selected}
|
|
39
|
+
onChange={setSelected}
|
|
40
|
+
options={[
|
|
41
|
+
{ label: "فعال", value: "active" },
|
|
42
|
+
{ label: "غیرفعال", value: "inactive" },
|
|
43
|
+
]}
|
|
44
|
+
/>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Boolean Inputs
|
|
48
|
+
|
|
49
|
+
- Use `Checkbox` for independent form choices.
|
|
50
|
+
- Use `RadioGroup` when the user must choose one option from a short list.
|
|
51
|
+
- Use `Toggle` for settings that take effect as on/off state.
|
|
52
|
+
|
|
53
|
+
## Numeric Inputs
|
|
54
|
+
|
|
55
|
+
Use `NumberInput` for formatted numeric entry. Use `fungible` when decimals are allowed.
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
<NumberInput
|
|
59
|
+
label="مبلغ"
|
|
60
|
+
value={amount}
|
|
61
|
+
onChange={setAmount}
|
|
62
|
+
unit="تومان"
|
|
63
|
+
/>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Use `CardNumberInput` for bank card numbers; it returns the cleaned digits to `onChange`.
|
|
67
|
+
|
|
68
|
+
Use `OtpInput` for verification codes, not a normal text field.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Layout and Navigation
|
|
2
|
+
|
|
3
|
+
## Layout Primitives
|
|
4
|
+
|
|
5
|
+
Use `Box`, `Container`, and `Grid` for page structure.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<Container maxWidth="lg">
|
|
9
|
+
<Box display="grid" gap={4}>
|
|
10
|
+
{children}
|
|
11
|
+
</Box>
|
|
12
|
+
</Container>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Rules:
|
|
16
|
+
|
|
17
|
+
- Use `gap`, `p`, `px`, `py`, `m`, and `mx` from MUI spacing.
|
|
18
|
+
- Use `Container` to constrain broad pages.
|
|
19
|
+
- Use `Grid` for responsive multi-column layouts.
|
|
20
|
+
- Avoid raw CSS layout unless component props are not enough.
|
|
21
|
+
|
|
22
|
+
## Lists
|
|
23
|
+
|
|
24
|
+
Use `List` and `ListItem` for vertical collections. Keep each row's main label, metadata, and action placement consistent.
|
|
25
|
+
|
|
26
|
+
## Accordion
|
|
27
|
+
|
|
28
|
+
Use `Accordion`, `AccordionSummary`, and `AccordionDetails` for optional details, filters, and FAQ-like disclosure. Do not hide primary required fields in an accordion.
|
|
29
|
+
|
|
30
|
+
## Tabs
|
|
31
|
+
|
|
32
|
+
Use `Tab` when switching between closely related panels at the same hierarchy level. Do not use tabs as primary app navigation.
|
|
33
|
+
|
|
34
|
+
## Stepper
|
|
35
|
+
|
|
36
|
+
Use `Stepper` and related step components for multi-step flows such as onboarding, checkout, or profile completion. Keep the active step clear and provide Back/Next actions with `Button`.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Component Catalog
|
|
2
|
+
|
|
3
|
+
Always prefer Injast Core components over raw HTML and direct Material UI primitives. Read the focused guideline file before using a component group.
|
|
4
|
+
|
|
5
|
+
## Actions
|
|
6
|
+
|
|
7
|
+
| Component | Also known as | Purpose | Guidelines |
|
|
8
|
+
|---|---|---|---|
|
|
9
|
+
| `Button` | CTA, action button | Text actions, submit, navigation, commands | `buttons.md` |
|
|
10
|
+
| `IconButton` | icon action | Compact icon-only actions | `buttons.md` |
|
|
11
|
+
| `Fab` | floating action | Prominent floating action | `buttons.md` |
|
|
12
|
+
|
|
13
|
+
## Forms
|
|
14
|
+
|
|
15
|
+
| Component | Also known as | Purpose | Guidelines |
|
|
16
|
+
|---|---|---|---|
|
|
17
|
+
| `TextField` | text input | General text entry | `forms.md` |
|
|
18
|
+
| `NumberInput` | numeric input | Controlled formatted number entry | `forms.md` |
|
|
19
|
+
| `CardNumberInput` | bank card input | Iranian bank card number entry | `forms.md` |
|
|
20
|
+
| `OtpInput` | verification code | One-time password entry | `forms.md` |
|
|
21
|
+
| `InputPhoneNumber` | phone input | Iranian phone number entry | `forms.md` |
|
|
22
|
+
| `Select` | dropdown | Single selection | `forms.md` |
|
|
23
|
+
| `MultiSelect` | tag select | Multiple selection with removable chips | `forms.md` |
|
|
24
|
+
| `Checkbox` | boolean check | Independent yes/no selection | `forms.md` |
|
|
25
|
+
| `Radio`, `RadioGroup` | radio buttons | One choice from a short list | `forms.md` |
|
|
26
|
+
| `Toggle` | switch | On/off setting | `forms.md` |
|
|
27
|
+
|
|
28
|
+
## Feedback
|
|
29
|
+
|
|
30
|
+
| Component | Also known as | Purpose | Guidelines |
|
|
31
|
+
|---|---|---|---|
|
|
32
|
+
| `Toast` | snackbar, alert | Brief status feedback | `feedback.md` |
|
|
33
|
+
| `Modal`, `Dialog` | dialog, overlay | Focused task or confirmation | `feedback.md` |
|
|
34
|
+
| `Loading`, `LoadingModal`, `CircularProgress`, `Skeleton`, `ProgressBar` | progress | Loading and progress states | `feedback.md` |
|
|
35
|
+
|
|
36
|
+
## Layout and Navigation
|
|
37
|
+
|
|
38
|
+
| Component | Also known as | Purpose | Guidelines |
|
|
39
|
+
|---|---|---|---|
|
|
40
|
+
| `Box`, `Container`, `Grid` | layout primitives | Spacing and page structure | `layout.md` |
|
|
41
|
+
| `List`, `ListItem` | list | Vertical repeated items | `layout.md` |
|
|
42
|
+
| `Accordion`, `AccordionSummary`, `AccordionDetails` | disclosure | Collapsible sections | `layout.md` |
|
|
43
|
+
| `Tab` | tabs | Switch between related panels | `layout.md` |
|
|
44
|
+
| `Stepper`, `Step`, `StepLabel`, `StepContent`, `StepConnector` | step flow | Multi-step workflows | `layout.md` |
|
|
45
|
+
|
|
46
|
+
## Data and Media
|
|
47
|
+
|
|
48
|
+
| Component | Also known as | Purpose | Guidelines |
|
|
49
|
+
|---|---|---|---|
|
|
50
|
+
| `DataGrid` | table, grid | Tabular operational data | `data-display.md` |
|
|
51
|
+
| `Typography` | text | Text hierarchy | `data-display.md` |
|
|
52
|
+
| `Image` | image | Image rendering with fallback behavior | `data-display.md` |
|
|
53
|
+
| `Divider`, `Pagination` | separator, pager | Data and content structure | `data-display.md` |
|
|
54
|
+
|
|
55
|
+
## Date Inputs
|
|
56
|
+
|
|
57
|
+
| Component | Also known as | Purpose | Guidelines |
|
|
58
|
+
|---|---|---|---|
|
|
59
|
+
| `MobileDatePicker` | Jalali date picker | Mobile-friendly Persian calendar date entry | `date-inputs.md` |
|
|
60
|
+
| `WheelDatePicker` | wheel date picker | Drawer-based date selection | `date-inputs.md` |
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Color
|
|
2
|
+
|
|
3
|
+
## Palette
|
|
4
|
+
|
|
5
|
+
Use `defaultColors` from `injast-core/constants` or `injast-core` for semantic colors:
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { defaultColors } from "injast-core";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Core palette groups:
|
|
12
|
+
|
|
13
|
+
| Group | Use for |
|
|
14
|
+
|---|---|
|
|
15
|
+
| `neutral` | Text, borders, surfaces, low-emphasis UI |
|
|
16
|
+
| `success` | Positive status and success feedback |
|
|
17
|
+
| `danger` | Error and destructive status |
|
|
18
|
+
| `warning` | Caution and warning status |
|
|
19
|
+
| `info` | Informational status |
|
|
20
|
+
| `teal` | Preferred Injast brand accent |
|
|
21
|
+
| `blue`, `cyan`, `indigo`, `pink`, `orange`, `magenta`, `yellow`, `red` | Secondary accents and charts |
|
|
22
|
+
|
|
23
|
+
## Rules
|
|
24
|
+
|
|
25
|
+
- Use `primary` for the main action or active state.
|
|
26
|
+
- Use `secondary` for supporting actions and neutral controls.
|
|
27
|
+
- Use `neutral.50` to `neutral.200` for quiet surfaces and separators.
|
|
28
|
+
- Use `danger`, `warning`, `info`, and `success` only for their matching status.
|
|
29
|
+
- Avoid large saturated backgrounds. Keep strong colors for small highlights, badges, icons, and buttons.
|
|
30
|
+
- Prefer theme palette references in `sx` when possible, for example `color: "neutral.700"`.
|
|
31
|
+
|
|
32
|
+
## App Colors
|
|
33
|
+
|
|
34
|
+
Every provider requires `appColors.primary` and `appColors.secondary`:
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
const appColors = {
|
|
38
|
+
primary: {
|
|
39
|
+
main: "#1DBF98",
|
|
40
|
+
light: "#1DBF98",
|
|
41
|
+
dark: "#179D76",
|
|
42
|
+
contrastText: "#ffffff",
|
|
43
|
+
},
|
|
44
|
+
secondary: {
|
|
45
|
+
main: "#4F545E",
|
|
46
|
+
light: "#91969F",
|
|
47
|
+
dark: "#242933",
|
|
48
|
+
contrastText: "#ffffff",
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Spacing, Radius, and Density
|
|
2
|
+
|
|
3
|
+
## Base Spacing
|
|
4
|
+
|
|
5
|
+
The theme sets Material UI spacing to 4px increments.
|
|
6
|
+
|
|
7
|
+
| Value | Pixel equivalent |
|
|
8
|
+
|---:|---:|
|
|
9
|
+
| `1` | 4px |
|
|
10
|
+
| `2` | 8px |
|
|
11
|
+
| `3` | 12px |
|
|
12
|
+
| `4` | 16px |
|
|
13
|
+
| `6` | 24px |
|
|
14
|
+
| `8` | 32px |
|
|
15
|
+
|
|
16
|
+
Use `sx` spacing props such as `p`, `px`, `py`, `m`, `gap`, `rowGap`, and `columnGap`.
|
|
17
|
+
|
|
18
|
+
## Component Sizing
|
|
19
|
+
|
|
20
|
+
- Default form controls and medium buttons are 48px tall.
|
|
21
|
+
- Large buttons are 56px tall.
|
|
22
|
+
- Small buttons and dense controls are 40px tall.
|
|
23
|
+
- Extra small buttons are 32px tall.
|
|
24
|
+
- Standard field radius is 8px.
|
|
25
|
+
- Button radius is 8px or 12px depending on size.
|
|
26
|
+
- Modal paper radius is 12px.
|
|
27
|
+
|
|
28
|
+
## Layout Rules
|
|
29
|
+
|
|
30
|
+
- Use `Box`, `Container`, and `Grid` for spacing and layout.
|
|
31
|
+
- Use 16px to 24px gaps between major sections.
|
|
32
|
+
- Use 8px to 12px gaps inside compact controls and field groups.
|
|
33
|
+
- Keep repeated cards and table rows stable in height.
|
|
34
|
+
- Avoid nested cards unless the inner card is a true repeated item or modal content.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Typography
|
|
2
|
+
|
|
3
|
+
## Fonts
|
|
4
|
+
|
|
5
|
+
Load `injast-core/fonts.css` once. The theme uses:
|
|
6
|
+
|
|
7
|
+
- `IRANYekanX` for standard Persian UI text
|
|
8
|
+
- `IRANYekanXFaNum` where Persian numerals are preferred
|
|
9
|
+
|
|
10
|
+
## Scale
|
|
11
|
+
|
|
12
|
+
Use the theme typography scale through components. Important roles:
|
|
13
|
+
|
|
14
|
+
| Role | Size | Weight | Use for |
|
|
15
|
+
|---|---:|---:|---|
|
|
16
|
+
| `display1` | 32px | 700 | Rare page-level display headings |
|
|
17
|
+
| `display2` | 24px | 700 | Page headings |
|
|
18
|
+
| `display3` | 20px | 700 | Section headings |
|
|
19
|
+
| `h1` | 18px | 500 | Dense page title |
|
|
20
|
+
| `h2` | 16px | 500 | Panel heading |
|
|
21
|
+
| `h3` | 14px | 500 | Small heading |
|
|
22
|
+
| `body1` | 14px | 500 | Default body text |
|
|
23
|
+
| `body2` | 12px | 500 | Secondary text |
|
|
24
|
+
| `label1` | 12px | 400 | Captions and field metadata |
|
|
25
|
+
| `label2` | 10px | 400 | Compact labels only |
|
|
26
|
+
|
|
27
|
+
## Rules
|
|
28
|
+
|
|
29
|
+
- Use `Typography` from `injast-core` for text hierarchy.
|
|
30
|
+
- Do not use oversized hero text inside app screens.
|
|
31
|
+
- Use concise labels in buttons and form controls.
|
|
32
|
+
- Keep numeric content readable; use Persian number formatting utilities when appropriate.
|
|
33
|
+
- Do not set negative letter spacing.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Setup
|
|
2
|
+
|
|
3
|
+
## Install
|
|
4
|
+
|
|
5
|
+
Use the public npm package:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install injast-core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
For Figma Make package selection, search for:
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
injast
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Then select the public unscoped package `injast-core`. If exact search for `injast-core` returns unrelated `core` packages first, use `injast` as the search term. Do not search for or install `@alimohammadiwork/injast-core` or `@make-kits/injast-core-make-kit` for this public package path.
|
|
18
|
+
|
|
19
|
+
## Required Imports
|
|
20
|
+
|
|
21
|
+
Import the font stylesheet once near the app root:
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import "injast-core/fonts.css";
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
For Vite, React SPA, and Figma Make, wrap the app with `SPAThemeProvider`:
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { SPAThemeProvider, coreFaIR, defaultColors } from "injast-core";
|
|
31
|
+
import "injast-core/fonts.css";
|
|
32
|
+
|
|
33
|
+
const appColors = {
|
|
34
|
+
primary: {
|
|
35
|
+
main: "#1DBF98",
|
|
36
|
+
light: "#1DBF98",
|
|
37
|
+
dark: "#179D76",
|
|
38
|
+
contrastText: "#ffffff",
|
|
39
|
+
},
|
|
40
|
+
secondary: {
|
|
41
|
+
main: "#4F545E",
|
|
42
|
+
light: "#91969F",
|
|
43
|
+
dark: "#242933",
|
|
44
|
+
contrastText: "#ffffff",
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export function AppProviders({ children }: { children: React.ReactNode }) {
|
|
49
|
+
return (
|
|
50
|
+
<SPAThemeProvider
|
|
51
|
+
dir="rtl"
|
|
52
|
+
appColors={appColors}
|
|
53
|
+
themeOptions={{ ...coreFaIR }}
|
|
54
|
+
>
|
|
55
|
+
{children}
|
|
56
|
+
</SPAThemeProvider>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Use `ThemeProvider` only when a project specifically needs the alternate provider API:
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
import { ThemeProvider } from "injast-core";
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Import Patterns
|
|
68
|
+
|
|
69
|
+
Root imports are preferred for common components:
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
import { Button, TextField, Modal, Toast, defaultColors } from "injast-core";
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Subpath imports are valid for focused files:
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
import { Button, TextField } from "injast-core/components";
|
|
79
|
+
import { defaultColors } from "injast-core/constants";
|
|
80
|
+
import { createApiRequest } from "injast-core/libs";
|
|
81
|
+
import { formatPersianNumber } from "injast-core/utils";
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Build Assumptions
|
|
85
|
+
|
|
86
|
+
- The package is ESM and Vite-compatible.
|
|
87
|
+
- React 18 is the default target for Figma Make. React 19 is also allowed by the package peer dependency range for non-Figma consumers.
|
|
88
|
+
- CSS imports from dependencies must be allowed because `MobileDatePicker` imports `react-multi-date-picker` CSS.
|
|
89
|
+
- Do not add custom Tailwind setup for Injast Core. Styling comes from Material UI theme, component `sx` props, and package CSS.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "injast-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.80",
|
|
4
4
|
"description": "Reusable Injast React and Material UI components, providers, hooks, utilities, and design tokens.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"types": "dist/types/index.d.ts",
|
|
9
9
|
"files": [
|
|
10
10
|
"dist",
|
|
11
|
+
"guidelines",
|
|
11
12
|
"README.md",
|
|
12
13
|
"LICENSE"
|
|
13
14
|
],
|
|
@@ -93,8 +94,14 @@
|
|
|
93
94
|
"access": "public"
|
|
94
95
|
},
|
|
95
96
|
"keywords": [
|
|
97
|
+
"injast-core",
|
|
96
98
|
"injast",
|
|
97
99
|
"react",
|
|
100
|
+
"react-18",
|
|
101
|
+
"vite",
|
|
102
|
+
"figma-make",
|
|
103
|
+
"make-kit",
|
|
104
|
+
"design-system-package",
|
|
98
105
|
"material-ui",
|
|
99
106
|
"mui",
|
|
100
107
|
"components",
|
|
@@ -126,8 +133,8 @@
|
|
|
126
133
|
"stylis-plugin-rtl": "^2.1.1"
|
|
127
134
|
},
|
|
128
135
|
"peerDependencies": {
|
|
129
|
-
"react": "^19.0.0",
|
|
130
|
-
"react-dom": "^19.0.0"
|
|
136
|
+
"react": "^18.2.0 || ^19.0.0",
|
|
137
|
+
"react-dom": "^18.2.0 || ^19.0.0"
|
|
131
138
|
},
|
|
132
139
|
"devDependencies": {
|
|
133
140
|
"@chromatic-com/storybook": "^5.0.0",
|
|
@@ -139,13 +146,13 @@
|
|
|
139
146
|
"@types/jalaali-js": "^1.1.3",
|
|
140
147
|
"@types/lodash": "^4.17.14",
|
|
141
148
|
"@types/node": "^22.10.7",
|
|
142
|
-
"@types/react": "^
|
|
143
|
-
"@types/react-dom": "^
|
|
149
|
+
"@types/react": "^18.3.12",
|
|
150
|
+
"@types/react-dom": "^18.3.1",
|
|
144
151
|
"@types/stylis": "^4.2.7",
|
|
145
152
|
"eslint": "^9",
|
|
146
153
|
"eslint-plugin-storybook": "^10.2.3",
|
|
147
|
-
"react": "^
|
|
148
|
-
"react-dom": "^
|
|
154
|
+
"react": "^18.2.0",
|
|
155
|
+
"react-dom": "^18.2.0",
|
|
149
156
|
"storybook": "^10.2.3",
|
|
150
157
|
"typescript": "^5.7.3",
|
|
151
158
|
"vite": "^6.0.0",
|