injast-core 1.0.80 → 1.0.82
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 +20 -0
- package/guidelines/Guidelines.md +64 -23
- package/guidelines/components/buttons.md +41 -12
- package/guidelines/components/data-display.md +39 -1
- package/guidelines/components/date-inputs.md +47 -6
- package/guidelines/components/feedback.md +84 -4
- package/guidelines/components/forms.md +172 -7
- package/guidelines/components/layout.md +108 -6
- package/guidelines/components/overview.md +23 -4
- package/guidelines/foundations/color.md +46 -23
- package/guidelines/foundations/icons.md +72 -0
- package/guidelines/foundations/spacing.md +85 -25
- package/guidelines/foundations/typography.md +41 -18
- package/guidelines/runtime.md +141 -0
- package/guidelines/setup.md +166 -11
- package/guidelines/types.md +60 -0
- package/package.json +2 -1
- package/skills/injast-app-builder/SKILL.md +49 -0
- package/skills/injast-app-builder/agents/openai.yaml +4 -0
package/README.md
CHANGED
|
@@ -142,6 +142,26 @@ guidelines/Guidelines.md
|
|
|
142
142
|
|
|
143
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
144
|
|
|
145
|
+
For Figma-driven implementation, use the Figma MCP flow before coding. The local MCP endpoint is:
|
|
146
|
+
|
|
147
|
+
```text
|
|
148
|
+
http://127.0.0.1:3845/mcp
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Fetch structured design context and a screenshot for the exact node, then translate the design into Injast Core components, RTL layout, Persian copy, and the project guidelines.
|
|
152
|
+
|
|
153
|
+
Generated mobile app screens should follow the Gold reference app at `/Users/ali/Documents/Gold`: centered `max-width: 520px` shell, wired navigation and overlay behavior, Injast Core inputs, drawer-based pre-invoices, and no mobile OS/app status bar chrome.
|
|
154
|
+
|
|
155
|
+
## Codex Skill
|
|
156
|
+
|
|
157
|
+
The package ships a Codex skill for Injast app generation:
|
|
158
|
+
|
|
159
|
+
```text
|
|
160
|
+
skills/injast-app-builder
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
After installing the package, consumers can point Codex at `node_modules/injast-core/skills/injast-app-builder` or copy that folder into their Codex skills directory if their Codex setup does not auto-discover package-bundled skills.
|
|
164
|
+
|
|
145
165
|
## License
|
|
146
166
|
|
|
147
167
|
ISC
|
package/guidelines/Guidelines.md
CHANGED
|
@@ -2,24 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
## Product Character
|
|
4
4
|
|
|
5
|
-
Injast Core is an RTL-first React and Material UI design system for Persian product interfaces.
|
|
5
|
+
Injast Core is an RTL-first React and Material UI design system for Persian product interfaces. Generated screens should feel like focused product UI: mobile-first, operational, compact, wired together, and easy to scan repeatedly.
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
- Keep
|
|
11
|
-
- Use brand color for primary actions and active states
|
|
7
|
+
- Build Persian and RTL experiences by default.
|
|
8
|
+
- Prefer task screens, forms, tables, status feedback, and flows over marketing pages.
|
|
9
|
+
- Treat `/Users/ali/Documents/Gold` as the canonical reference for mobile app shell structure, component composition, wired flows, and drawer behavior.
|
|
10
|
+
- Keep the main app canvas constrained to `max-width: 520px` with `margin-inline: auto` unless a data-heavy desktop layout clearly needs more width.
|
|
11
|
+
- Use brand color for primary actions and active states only. Do not use strong colors as large decorative backgrounds.
|
|
12
|
+
- Use measured density: compact controls, clear labels, and enough spacing around decisions and errors.
|
|
12
13
|
|
|
13
14
|
## Reading Order
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
Make must read these files before writing app code with this package:
|
|
16
17
|
|
|
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/
|
|
18
|
+
1. `guidelines/Guidelines.md` - product character, routing, and hard rules.
|
|
19
|
+
2. `guidelines/setup.md` - package install, CSS imports, providers, viewport, and icon package.
|
|
20
|
+
3. `guidelines/foundations/color.md` - app colors, semantic palette, and status colors.
|
|
21
|
+
4. `guidelines/foundations/typography.md` - theme typography variants and usage.
|
|
22
|
+
5. `guidelines/foundations/spacing.md` - 4px spacing scale, page shell, padding, gaps, and sizing.
|
|
23
|
+
6. `guidelines/foundations/icons.md` - Iconsax import, sizing, placement, and color rules.
|
|
24
|
+
7. `guidelines/components/overview.md` - component catalog and selection rules.
|
|
25
|
+
8. `guidelines/runtime.md` - hooks, utilities, API helpers, logging, Sentry, and app integration helpers.
|
|
26
|
+
9. `guidelines/types.md` - exported TypeScript types and when to use them.
|
|
23
27
|
|
|
24
28
|
Read focused component files before using those component groups:
|
|
25
29
|
|
|
@@ -30,6 +34,10 @@ Read focused component files before using those component groups:
|
|
|
30
34
|
- `guidelines/components/data-display.md`
|
|
31
35
|
- `guidelines/components/date-inputs.md`
|
|
32
36
|
|
|
37
|
+
Composition and app-shell rules live in `guidelines/components/layout.md`.
|
|
38
|
+
Runtime integration rules live in `guidelines/runtime.md`.
|
|
39
|
+
Type import rules live in `guidelines/types.md`.
|
|
40
|
+
|
|
33
41
|
## Package Rules
|
|
34
42
|
|
|
35
43
|
- Install and import the public package as `injast-core`.
|
|
@@ -37,19 +45,52 @@ Read focused component files before using those component groups:
|
|
|
37
45
|
- Do not import `@alimohammadiwork/injast-core`; that scoped package is not this package.
|
|
38
46
|
- Do not use `@make-kits/injast-core-make-kit` for the public npm package path.
|
|
39
47
|
- For Figma Make and Vite React apps, use `SPAThemeProvider`.
|
|
48
|
+
- For Next.js app providers, use `ThemeProvider`.
|
|
49
|
+
- Wrap generated app content with `MessageProvider` when toast/status feedback is needed.
|
|
40
50
|
- Import `injast-core/fonts.css` once near the app root.
|
|
41
|
-
- Use
|
|
51
|
+
- Use `coreFaIR` in SPA/Figma Make theme options for Persian Material UI localization.
|
|
52
|
+
- Use named imports from `injast-core` for common usage; use subpath imports only for focused entrypoints.
|
|
53
|
+
|
|
54
|
+
## Figma MCP Workflow
|
|
55
|
+
|
|
56
|
+
For Figma-driven implementation, use the Figma MCP server before writing app code. The local MCP endpoint is:
|
|
57
|
+
|
|
58
|
+
```text
|
|
59
|
+
http://127.0.0.1:3845/mcp
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Rules:
|
|
63
|
+
|
|
64
|
+
- Fetch design context for the exact frame or node first.
|
|
65
|
+
- Fetch a screenshot for the same frame or variant before implementation.
|
|
66
|
+
- Use metadata to narrow the request when the initial design context is too large.
|
|
67
|
+
- Translate Figma output into Injast Core, RTL, Persian, and Gold-style app conventions. Do not copy generic generated React or Tailwind structure as final code.
|
|
68
|
+
- If Figma includes mobile OS chrome or an app status bar, omit it from implementation.
|
|
69
|
+
|
|
70
|
+
## Hard UI Rules
|
|
71
|
+
|
|
72
|
+
- Use Injast Core components before raw HTML or direct Material UI primitives.
|
|
73
|
+
- Do not use raw `<button>`, `<input>`, `<select>`, checkbox, radio, dialog, table, or image elements when an Injast component exists.
|
|
74
|
+
- All visible inputs must come from Injast Core, such as `TextField`, `NumberInput`, `InputPhoneNumber`, `CardNumberInput`, `OtpInput`, `Select`, `MultiSelect`, `Autocomplete`, `Checkbox`, `Radio`, `Toggle`, `Slider`, or `CounterBoxInput`.
|
|
75
|
+
- Do not use direct Material UI input primitives in generated app code when an Injast input exists.
|
|
76
|
+
- Use RTL by default: provider `dir="rtl"`, Persian labels, right-aligned reading flow, and logical CSS properties such as `marginInline` or `px`.
|
|
77
|
+
- Keep the primary app surface centered with `maxWidth: 520` or CSS `max-width: 520px; margin-inline: auto;`.
|
|
78
|
+
- Do not guess unsupported component props. Use Material UI props plus documented Injast-specific props.
|
|
79
|
+
- Use `iconsax-react` for all generated app icons. Do not use Lucide, Heroicons, Font Awesome, inline SVGs, emoji icons, or `@mui/icons-material` in generated screens.
|
|
80
|
+
- Keep icon sizes consistent: 20px for input adornments, 24px for standard actions, 28px for status icons.
|
|
81
|
+
- Use `defaultColors`, `appColors`, and theme palette values instead of hardcoded colors where possible.
|
|
82
|
+
- Keep all controls reachable on mobile. Do not rely on hover-only actions for required workflows.
|
|
83
|
+
- Do not create nested cards unless the inner card is a repeated item, modal content, or a genuinely separate framed tool.
|
|
84
|
+
- Do not implement mobile OS status bars or decorative app status bars, even when the design file includes them.
|
|
85
|
+
- Generated apps must be wired flows, not a set of disconnected static screens. Navigation actions, drawer/modal triggers, submit buttons, close buttons, and confirmation actions should update local state or route to the next screen.
|
|
42
86
|
|
|
43
|
-
##
|
|
87
|
+
## Overlay and Drawer Rules
|
|
44
88
|
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
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.
|
|
89
|
+
- Pre-invoices (`پیشفاکتور`) are drawer or bottom-sheet overlays, not independent pages.
|
|
90
|
+
- Drawers should feel like drawers: fixed overlay, backdrop, centered `maxWidth: 520` sheet, visible close path, and entrance/exit motion from the drawer edge.
|
|
91
|
+
- When a drawer is open, dim, blur, or subtly scale the underlying page when it helps communicate layering.
|
|
92
|
+
- Keep modal content compact and centered inside the 520px app shell. Do not put full pages inside modals.
|
|
52
93
|
|
|
53
94
|
## Output Expectations
|
|
54
95
|
|
|
55
|
-
Generated screens should look like production product UI
|
|
96
|
+
Generated screens should look like production Persian product UI. Favor concise copy, clear hierarchy, stable control sizes, predictable forms, visible validation, compact data displays, wired actions, and direct recovery actions for empty or error states.
|
|
@@ -5,9 +5,10 @@
|
|
|
5
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
6
|
|
|
7
7
|
```tsx
|
|
8
|
+
import { Add } from "iconsax-react";
|
|
8
9
|
import { Button } from "injast-core";
|
|
9
10
|
|
|
10
|
-
<Button variant="contained" color="primary" buttonSize="M">
|
|
11
|
+
<Button variant="contained" color="primary" buttonSize="M" startIcon={<Add size={24} />}>
|
|
11
12
|
ثبت
|
|
12
13
|
</Button>
|
|
13
14
|
```
|
|
@@ -19,25 +20,53 @@ import { Button } from "injast-core";
|
|
|
19
20
|
| `buttonSize` | `"L" | "M" | "S" | "XS"` | `"M"` | Controls height, radius, and font size |
|
|
20
21
|
| `loading` | `boolean` | `false` | Replaces content with spinner and disables click |
|
|
21
22
|
| `loadingColor` | `string` | `neutral.50` | Spinner color |
|
|
22
|
-
| Material UI `ButtonProps` | varies | - | Use `variant`, `color`, `disabled`, `startIcon`, `endIcon`, `fullWidth` |
|
|
23
|
+
| Material UI `ButtonProps` | varies | - | Use `variant`, `color`, `disabled`, `startIcon`, `endIcon`, `fullWidth`, `onClick`, `type` |
|
|
23
24
|
|
|
24
25
|
## Sizing
|
|
25
26
|
|
|
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 |
|
|
27
|
+
| Size | Height | Radius | Font | Use for |
|
|
28
|
+
|---|---:|---:|---:|---|
|
|
29
|
+
| `L` | 56px | 12px | 16px / 700 | High-emphasis primary actions |
|
|
30
|
+
| `M` | 48px | 12px | 16px / 700 | Default form and page actions |
|
|
31
|
+
| `S` | 40px | 8px | 14px / 700 | Dense toolbars or secondary actions |
|
|
32
|
+
| `XS` | 32px | 8px | 12px / 700 | Compact inline actions and modal secondary actions |
|
|
33
|
+
|
|
34
|
+
Button content uses an 8px icon/text gap. Icons in normal buttons should be 20px to 24px. Large FAB-like actions can use 28px icons.
|
|
32
35
|
|
|
33
36
|
## Variant Rules
|
|
34
37
|
|
|
35
38
|
- Use `variant="contained"` and `color="primary"` for the main action.
|
|
36
39
|
- Use `variant="outlined"` for secondary actions.
|
|
37
|
-
- Use `variant="text"` only for low-emphasis actions.
|
|
40
|
+
- Use `variant="text"` only for low-emphasis actions, inline navigation, or cancel links.
|
|
38
41
|
- Keep one primary contained action per focused region.
|
|
39
|
-
- Use `
|
|
42
|
+
- Use `fullWidth` for mobile bottom actions and one-column forms.
|
|
43
|
+
- Use `loading` instead of manually swapping button text or adding a separate spinner.
|
|
44
|
+
- Do not add custom elevation or ripple behavior; the component disables elevation and ripple for a quiet product feel.
|
|
45
|
+
|
|
46
|
+
## Action Layout
|
|
47
|
+
|
|
48
|
+
- In RTL modals and drawers, place the primary action at the end of the row when actions are horizontal.
|
|
49
|
+
- Use `gap: 2` between adjacent buttons.
|
|
50
|
+
- Use a fixed bottom action area for long mobile forms when the submit action must stay visible.
|
|
51
|
+
- Use `buttonSize="M"` for the main bottom action and `buttonSize="XS"` or `S` for compact modal footer actions.
|
|
52
|
+
|
|
53
|
+
## IconButton
|
|
54
|
+
|
|
55
|
+
Use `IconButton` for compact icon-only controls such as close, remove, edit, calendar, search, and increment/decrement.
|
|
56
|
+
|
|
57
|
+
Rules:
|
|
58
|
+
|
|
59
|
+
- Use Iconsax icons only.
|
|
60
|
+
- Give unfamiliar icon-only actions a tooltip or visible adjacent label when context is not obvious.
|
|
61
|
+
- Keep common icon-only targets 40px to 48px. Compact inline controls can be 32px.
|
|
62
|
+
- Do not use text inside `IconButton`.
|
|
63
|
+
|
|
64
|
+
## Fab
|
|
65
|
+
|
|
66
|
+
Use `Fab` only for a single prominent floating action in a screen. Do not place multiple FABs in the same view.
|
|
40
67
|
|
|
41
|
-
|
|
68
|
+
Sizing:
|
|
42
69
|
|
|
43
|
-
|
|
70
|
+
- Small FAB: 20px icon.
|
|
71
|
+
- Default FAB: 24px icon.
|
|
72
|
+
- Large FAB: 28px icon.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## DataGrid
|
|
4
4
|
|
|
5
|
-
Use `DataGrid` for tabular data. It wraps
|
|
5
|
+
Use `DataGrid` for tabular operational data. It wraps `material-react-table` with RTL and Persian localization defaults.
|
|
6
6
|
|
|
7
7
|
```tsx
|
|
8
8
|
import { DataGrid, type MRT_ColumnDef } from "injast-core";
|
|
@@ -17,27 +17,65 @@ const columns: MRT_ColumnDef<Row>[] = [
|
|
|
17
17
|
<DataGrid columns={columns} data={rows} enableSorting />;
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
+
Default behavior and sizing:
|
|
21
|
+
|
|
22
|
+
| Setting | Default |
|
|
23
|
+
|---|---|
|
|
24
|
+
| Direction | RTL wrapper |
|
|
25
|
+
| Localization | Persian Material React Table localization |
|
|
26
|
+
| Layout mode | `grid` |
|
|
27
|
+
| Density | `compact` |
|
|
28
|
+
| Paper radius | 12px |
|
|
29
|
+
| Table container max height | `calc(100vh - 300px)` |
|
|
30
|
+
| Header background | `neutral.100` equivalent |
|
|
31
|
+
| Header font | 16px / 500 |
|
|
32
|
+
| Body cell font | 14px |
|
|
33
|
+
| Row action minimum width | 160px |
|
|
34
|
+
|
|
20
35
|
Rules:
|
|
21
36
|
|
|
22
37
|
- Define stable `columns` outside render or memoize them.
|
|
23
38
|
- Use compact density for operational pages.
|
|
24
39
|
- Use built-in MRT options for sorting, filtering, selection, row actions, and pagination.
|
|
25
40
|
- Keep row actions concise and aligned.
|
|
41
|
+
- Use right alignment for Persian text, center alignment for small status columns, and left or LTR alignment for Latin IDs when necessary.
|
|
42
|
+
- Avoid placing wide `DataGrid` tables inside the 520px mobile shell unless horizontal scrolling is intentional.
|
|
26
43
|
|
|
27
44
|
## Typography
|
|
28
45
|
|
|
29
46
|
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
47
|
|
|
48
|
+
Rules:
|
|
49
|
+
|
|
50
|
+
- Use `body1` for primary row/card text.
|
|
51
|
+
- Use `body2` or `label1` for metadata.
|
|
52
|
+
- Use `h2` or `h3` for section titles inside dense app screens.
|
|
53
|
+
|
|
31
54
|
## Image
|
|
32
55
|
|
|
33
56
|
Use `Image` for image content. Always provide useful `alt` text unless the image is decorative.
|
|
34
57
|
|
|
58
|
+
Sizing:
|
|
59
|
+
|
|
60
|
+
- `src` is required.
|
|
61
|
+
- Pass explicit `width` and `height`.
|
|
62
|
+
- Default `objectFit` is `cover`.
|
|
63
|
+
- Use `contain` for logos, receipts, cards, and documents that must not crop.
|
|
64
|
+
- `fallbackSrc` exists in the prop type but current runtime fallback handling is not active; do not rely on it for critical broken-image recovery.
|
|
65
|
+
- Use `style` only for image-specific CSS such as border radius or filter, not for page layout.
|
|
66
|
+
|
|
35
67
|
## Pagination and Divider
|
|
36
68
|
|
|
37
69
|
Use `Pagination` when data is split across pages. Use `Divider` to separate adjacent content groups, not as a substitute for spacing.
|
|
38
70
|
|
|
71
|
+
Rules:
|
|
72
|
+
|
|
73
|
+
- Keep pagination close to the data it controls.
|
|
74
|
+
- Do not use dividers between every small form field; use gaps first.
|
|
75
|
+
|
|
39
76
|
## Empty and Loading States
|
|
40
77
|
|
|
41
78
|
- Use `Skeleton` when data is loading.
|
|
42
79
|
- Use a concise empty state with one primary recovery action when no data exists.
|
|
43
80
|
- Use `ProgressBar` for determinate progress.
|
|
81
|
+
- Keep empty state copy short and Persian when the app content is Persian.
|
|
@@ -14,22 +14,57 @@ Use `MobileDatePicker` for Persian calendar date entry in mobile-first or respon
|
|
|
14
14
|
/>
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
Behavior and sizing:
|
|
18
|
+
|
|
19
|
+
| Property | Default or rule |
|
|
20
|
+
|---|---|
|
|
21
|
+
| Width | `100%` |
|
|
22
|
+
| Field height | 48px |
|
|
23
|
+
| Field radius | 8px through `TextField` |
|
|
24
|
+
| Calendar icon | Iconsax `Calendar`, 20px |
|
|
25
|
+
| Date shown to user | Jalali |
|
|
26
|
+
| `onChange` value | Gregorian string |
|
|
27
|
+
| Modal radius | 12px |
|
|
28
|
+
| Modal action buttons | `buttonSize="XS"` |
|
|
29
|
+
|
|
17
30
|
Rules:
|
|
18
31
|
|
|
19
|
-
- `onChange` receives the selected date converted to Gregorian format.
|
|
20
32
|
- Use `label`, `placeholder`, `error`, and `helperText` for form clarity.
|
|
21
33
|
- Pass `disabled` when the date cannot be edited.
|
|
22
|
-
-
|
|
34
|
+
- Use `minDate` and `maxDate` when the business flow has valid ranges.
|
|
35
|
+
- Use `textFieldSxProps` only for field-level `sx` overrides that cannot be expressed through layout wrappers.
|
|
36
|
+
- Ensure the app build supports CSS imports from npm packages. `MobileDatePicker` uses `react-multi-date-picker`, `react-date-object`, and the Persian calendar/locale internally.
|
|
37
|
+
- Keep date fields full width in the 520px mobile shell.
|
|
23
38
|
|
|
24
39
|
## WheelDatePicker
|
|
25
40
|
|
|
26
|
-
Use `WheelDatePicker` when a drawer-style date picker is more appropriate than the modal calendar.
|
|
41
|
+
Use `WheelDatePicker` when a drawer-style date picker is more appropriate than the modal calendar, especially for touch-heavy flows.
|
|
42
|
+
|
|
43
|
+
Behavior and sizing:
|
|
44
|
+
|
|
45
|
+
| Property | Default or rule |
|
|
46
|
+
|---|---|
|
|
47
|
+
| Field height | 48px |
|
|
48
|
+
| Field radius | 8px |
|
|
49
|
+
| Drawer max width | 520px |
|
|
50
|
+
| Drawer horizontal alignment | centered with `mx: "auto"` |
|
|
51
|
+
| Drawer body padding | `px: 3.5`, `py: 6` |
|
|
52
|
+
| Wheel item height | 44px |
|
|
53
|
+
| Visible wheel items | 3 |
|
|
54
|
+
| Confirm action | full-width contained button |
|
|
55
|
+
| Default format | Unix seconds unless `dateFormat` is set |
|
|
27
56
|
|
|
28
57
|
Rules:
|
|
29
58
|
|
|
30
|
-
- Prefer it for
|
|
31
|
-
- Keep surrounding form actions clear: cancel and confirm.
|
|
32
|
-
- Use
|
|
59
|
+
- Prefer it for mobile bottom-sheet selection.
|
|
60
|
+
- Keep surrounding form actions clear: cancel/close and confirm.
|
|
61
|
+
- Use `title` for the drawer/input label and `placeholder` for empty display text.
|
|
62
|
+
- Use `dateFormat="jalali"` when the form state should store Jalali text.
|
|
63
|
+
- Use `dateFormat="gregorian"` when the form state should store a Gregorian date string.
|
|
64
|
+
- Use `valueFormat` when the incoming `value` format differs from the desired `onChange` format.
|
|
65
|
+
- Use `onChangeDateFormat` when the emitted value format must differ from the incoming `value`.
|
|
66
|
+
- Use `defaultDate` as the initial date when `value` is empty.
|
|
67
|
+
- Use `minDate` and `maxDate` with Unix seconds when the selectable range is constrained.
|
|
33
68
|
|
|
34
69
|
## Date Utilities
|
|
35
70
|
|
|
@@ -43,3 +78,9 @@ import {
|
|
|
43
78
|
longDateFormat,
|
|
44
79
|
} from "injast-core";
|
|
45
80
|
```
|
|
81
|
+
|
|
82
|
+
Rules:
|
|
83
|
+
|
|
84
|
+
- Do not hand-roll Jalali/Gregorian conversions.
|
|
85
|
+
- Keep storage format explicit in component state and API payloads.
|
|
86
|
+
- Display dates in Persian/Jalali format for Persian users unless the product requirement says otherwise.
|
|
@@ -20,23 +20,81 @@ Valid severity values:
|
|
|
20
20
|
- `warning`
|
|
21
21
|
- `error`
|
|
22
22
|
|
|
23
|
+
Toast sizing and style:
|
|
24
|
+
|
|
25
|
+
| Property | Default or rule |
|
|
26
|
+
|---|---|
|
|
27
|
+
| Width | `90%` |
|
|
28
|
+
| Alert max width | 450px |
|
|
29
|
+
| Wide minimum width | 350px |
|
|
30
|
+
| Radius | 8px |
|
|
31
|
+
| Horizontal padding | `px: 3.5` (14px) |
|
|
32
|
+
| Vertical padding | `py: 4` (16px) |
|
|
33
|
+
| Status icon | 28px Iconsax `Bold` |
|
|
34
|
+
| Default duration | 4000ms through `MessageProvider` |
|
|
35
|
+
|
|
36
|
+
Rules:
|
|
37
|
+
|
|
38
|
+
- Prefer `MessageProvider` and `useMessage` for app-level feedback.
|
|
39
|
+
- Match icon, text, border, and background to severity.
|
|
40
|
+
- Keep toast copy short and actionable.
|
|
41
|
+
- In 520px app shells, keep toasts visually aligned to the centered app surface.
|
|
42
|
+
- Use `anchorOrigin` to change placement; default is top-left.
|
|
43
|
+
- Use `isWide` only for messages that need a wider minimum width.
|
|
44
|
+
- `handleClose` should close the toast and should be safe to call from click or timeout.
|
|
45
|
+
|
|
23
46
|
## Modal and Dialog
|
|
24
47
|
|
|
25
48
|
Use `Modal` for focused tasks, confirmations, and compact forms. Keep modal content short and actionable.
|
|
26
49
|
|
|
27
50
|
```tsx
|
|
28
51
|
<Modal open={open} onClose={handleClose} width={420}>
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
52
|
+
<Box display="grid" gap={4}>
|
|
53
|
+
<Typography variant="h2">حذف مورد</Typography>
|
|
54
|
+
<Typography variant="body1">آیا مطمئن هستید؟</Typography>
|
|
55
|
+
<Box display="flex" gap={2} justifyContent="end">
|
|
56
|
+
<Button variant="outlined" buttonSize="XS">لغو</Button>
|
|
57
|
+
<Button variant="contained" color="primary" buttonSize="XS">تایید</Button>
|
|
58
|
+
</Box>
|
|
59
|
+
</Box>
|
|
32
60
|
</Modal>
|
|
33
61
|
```
|
|
34
62
|
|
|
63
|
+
Modal sizing and style:
|
|
64
|
+
|
|
65
|
+
- Paper radius: 12px.
|
|
66
|
+
- Paper margin: 8px on small screens.
|
|
67
|
+
- Backdrop: dark translucent blur.
|
|
68
|
+
- Use explicit `width` for compact dialogs, usually 320px to 420px.
|
|
69
|
+
- Keep modal paper and content visually centered inside the 520px app shell.
|
|
70
|
+
- Use `gap: 4` inside modal content.
|
|
71
|
+
|
|
35
72
|
Rules:
|
|
36
73
|
|
|
37
|
-
- Always provide a visible close or
|
|
74
|
+
- Always provide a visible close, cancel, or back path.
|
|
38
75
|
- Keep destructive confirmation actions explicit.
|
|
39
76
|
- Avoid putting full pages inside modals.
|
|
77
|
+
- Do not nest cards inside modal content unless they are repeated selectable items.
|
|
78
|
+
|
|
79
|
+
## Drawers
|
|
80
|
+
|
|
81
|
+
Use drawers for bottom-sheet-like mobile tasks such as date selection, filters, and short pickers.
|
|
82
|
+
|
|
83
|
+
Pre-invoices (`پیشفاکتور`) must be drawers or bottom sheets. Do not build pre-invoices as independent pages.
|
|
84
|
+
|
|
85
|
+
Rules:
|
|
86
|
+
|
|
87
|
+
- Control visibility with `isDrawerOpen`.
|
|
88
|
+
- Use `onClose` for backdrop, escape, and close-button behavior.
|
|
89
|
+
- Default `anchor` is bottom; use `anchor="right"` for RTL side navigation drawers.
|
|
90
|
+
- Align drawer content to the 520px app shell when possible.
|
|
91
|
+
- Use `maxWidth: 520` and `mx: "auto"` for drawer roots or content wrappers.
|
|
92
|
+
- Use `px: 3.5`, `py: 6` for drawer body padding.
|
|
93
|
+
- Put the title and close icon in the header row.
|
|
94
|
+
- Use a full-width contained button for the main confirm action.
|
|
95
|
+
- Make drawer layering clear with a backdrop and fixed overlay behavior.
|
|
96
|
+
- Animate bottom drawers from `translateY(100%)` to `translateY(0)` and animate the backdrop opacity so the UI does not feel like a sudden page swap.
|
|
97
|
+
- When useful, dim, blur, or subtly scale the underlying page while the drawer is open.
|
|
40
98
|
|
|
41
99
|
## Loading and Progress
|
|
42
100
|
|
|
@@ -45,3 +103,25 @@ Rules:
|
|
|
45
103
|
- Use `CircularProgress` inside small controls.
|
|
46
104
|
- Use `Skeleton` for content placeholders.
|
|
47
105
|
- Use `ProgressBar` when progress has a known percentage or status.
|
|
106
|
+
|
|
107
|
+
Sizing:
|
|
108
|
+
|
|
109
|
+
- `LoadingModal` content is 150px wide with `gap: 4`.
|
|
110
|
+
- `LoadingModal` opens with `isOpen`.
|
|
111
|
+
- Default progress bar height is 20px.
|
|
112
|
+
- Button loading spinner uses 24px.
|
|
113
|
+
|
|
114
|
+
ProgressBar props:
|
|
115
|
+
|
|
116
|
+
- `progress` is the determinate percentage value.
|
|
117
|
+
- `color` controls the filled bar color.
|
|
118
|
+
- `height` defaults to 20px.
|
|
119
|
+
- Use `disablePercentage` when the label would be redundant or cramped.
|
|
120
|
+
- Use `isRtl` when the filled direction should visually flip for RTL progress.
|
|
121
|
+
|
|
122
|
+
## Empty and Error States
|
|
123
|
+
|
|
124
|
+
- Keep empty states concise.
|
|
125
|
+
- Provide one primary recovery action when the user can fix the state.
|
|
126
|
+
- Use `danger` colors only for real errors and destructive decisions.
|
|
127
|
+
- Use `warning` for reversible risk or caution, not validation failure.
|