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
|
@@ -4,10 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
- Use controlled components for form values.
|
|
6
6
|
- Use `TextField` instead of raw `<input>`.
|
|
7
|
-
-
|
|
7
|
+
- Use Injast Core inputs for every generated field. Choose `TextField`, `NumberInput`, `InputPhoneNumber`, `CardNumberInput`, `OtpInput`, `Select`, `MultiSelect`, `Autocomplete`, `Checkbox`, `Radio`, `Toggle`, `Slider`, or `CounterBoxInput` before direct Material UI or raw HTML controls.
|
|
8
|
+
- Do not import direct Material UI input primitives in generated app code when an Injast input exists.
|
|
9
|
+
- Put labels on every input unless the surrounding context makes the value unmistakable.
|
|
8
10
|
- Use `error` and `helperText` for validation messages.
|
|
9
11
|
- Use 48px control height for default forms.
|
|
10
12
|
- Use RTL layout for Persian forms.
|
|
13
|
+
- Use `gap: 3` to `gap: 4` between related fields.
|
|
14
|
+
- Use `gap: 1` to `gap: 2` between field labels/helper copy and the field.
|
|
15
|
+
- Do not place required fields inside collapsed accordions.
|
|
11
16
|
|
|
12
17
|
## TextField
|
|
13
18
|
|
|
@@ -20,17 +25,62 @@
|
|
|
20
25
|
| `height` | `number` | Explicit field height |
|
|
21
26
|
|
|
22
27
|
```tsx
|
|
28
|
+
import { SearchNormal1 } from "iconsax-react";
|
|
29
|
+
import { TextField, defaultColors } from "injast-core";
|
|
30
|
+
|
|
23
31
|
<TextField
|
|
24
32
|
label="نام"
|
|
25
33
|
value={name}
|
|
26
34
|
onChange={(event) => setName(event.target.value)}
|
|
27
35
|
height={48}
|
|
36
|
+
startAdornment={<SearchNormal1 size={20} color={defaultColors.neutral.main} />}
|
|
37
|
+
/>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Sizing:
|
|
41
|
+
|
|
42
|
+
- Default height: 48px.
|
|
43
|
+
- Radius: 8px.
|
|
44
|
+
- Input adornment icon: 20px.
|
|
45
|
+
- Use `fullWidth` in mobile forms and 520px app shells.
|
|
46
|
+
- Use `dir="ltr"` only for Latin codes, OTP, card numbers, phone-like numeric values, or technical identifiers.
|
|
47
|
+
|
|
48
|
+
## Form Wrappers
|
|
49
|
+
|
|
50
|
+
Use `FormControl`, `InputLabel`, `MenuItem`, and `FormControlLabel` when composing Material UI-compatible form groups.
|
|
51
|
+
|
|
52
|
+
Rules:
|
|
53
|
+
|
|
54
|
+
- Use `FormControl` to bind labels, helper text, and selection controls into one accessible group.
|
|
55
|
+
- Use `InputLabel` with `Select`, `MultiSelect`, or custom field groups that need a floating label.
|
|
56
|
+
- Use `MenuItem` only inside `Select` or menu-like option lists.
|
|
57
|
+
- Use `FormControlLabel` for `Checkbox`, `Radio`, and `Toggle` labels.
|
|
58
|
+
- In RTL forms, use `labelPlacement="start"` when the visual layout needs the control on the trailing side, as in drawer radio lists.
|
|
59
|
+
|
|
60
|
+
## Autocomplete
|
|
61
|
+
|
|
62
|
+
Use `Autocomplete` when users choose from a longer list, need search-as-you-type, or may need multiple searchable selections.
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
<Autocomplete
|
|
66
|
+
options={options}
|
|
67
|
+
getOptionLabel={(option) => option.label}
|
|
68
|
+
renderInput={(params) => (
|
|
69
|
+
<TextField {...params} label="دسته بندی" height={48} fullWidth />
|
|
70
|
+
)}
|
|
28
71
|
/>
|
|
29
72
|
```
|
|
30
73
|
|
|
74
|
+
Rules:
|
|
75
|
+
|
|
76
|
+
- Render the input with Injast `TextField`.
|
|
77
|
+
- Keep the field 48px tall unless the surrounding UI is intentionally dense.
|
|
78
|
+
- Use `multiple` only when selected values are naturally a set.
|
|
79
|
+
- Prefer `Select` for short static lists and `Autocomplete` for longer or searchable lists.
|
|
80
|
+
|
|
31
81
|
## Select and MultiSelect
|
|
32
82
|
|
|
33
|
-
Use `Select` for
|
|
83
|
+
Use `Select` for one value and `MultiSelect` for multiple values.
|
|
34
84
|
|
|
35
85
|
```tsx
|
|
36
86
|
<MultiSelect
|
|
@@ -44,15 +94,74 @@ Use `Select` for a single value and `MultiSelect` for multiple values.
|
|
|
44
94
|
/>
|
|
45
95
|
```
|
|
46
96
|
|
|
97
|
+
Rules:
|
|
98
|
+
|
|
99
|
+
- Use 48px height and 8px radius.
|
|
100
|
+
- `MultiSelect` default `minWidth` is `13rem`; override only when the layout needs a tighter or full-width control.
|
|
101
|
+
- MultiSelect chips use a neutral surface, pill radius, `px: 3`, `py: 1.5`, and compact 18px remove icons.
|
|
102
|
+
- Keep option labels short enough to scan in Persian.
|
|
103
|
+
|
|
47
104
|
## Boolean Inputs
|
|
48
105
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
106
|
+
Use `Checkbox` for independent form choices. The default checkbox icon is 24px with 4px corner radius.
|
|
107
|
+
|
|
108
|
+
Checkbox customization props:
|
|
109
|
+
|
|
110
|
+
| Prop | Use for |
|
|
111
|
+
|---|---|
|
|
112
|
+
| `iconSize` | Custom checkbox square size; default is 24px |
|
|
113
|
+
| `borderColor` | Unchecked border color override |
|
|
114
|
+
| `checkedBorderColor` | Checked border color fallback when theme primary is not available |
|
|
115
|
+
| `backgroundColor` | Checked square background override |
|
|
116
|
+
| `tickColor` | Checkmark color fallback when theme primary is not available |
|
|
117
|
+
|
|
118
|
+
Prefer theme primary and neutral colors before custom checkbox colors.
|
|
119
|
+
|
|
120
|
+
Use `RadioGroup` when the user must choose one option from a short list. Keep radio labels short and avoid more than 5 options before considering a select.
|
|
121
|
+
|
|
122
|
+
Use `Toggle` for settings that take effect as an on/off state.
|
|
123
|
+
|
|
124
|
+
Toggle sizing:
|
|
125
|
+
|
|
126
|
+
| Size | Track |
|
|
127
|
+
|---|---:|
|
|
128
|
+
| `small` | 48px by 26px |
|
|
129
|
+
| `medium` | 59px by 32px |
|
|
130
|
+
|
|
131
|
+
Toggle props:
|
|
132
|
+
|
|
133
|
+
- Use `checked` for controlled on/off state.
|
|
134
|
+
- Use `onChange` to update the controlled value.
|
|
135
|
+
- Use `disabled` when the setting cannot currently change.
|
|
136
|
+
- Use custom `color` only when the theme primary color is not appropriate.
|
|
137
|
+
|
|
138
|
+
## Slider
|
|
139
|
+
|
|
140
|
+
Use `Slider` for bounded numeric ranges where dragging is faster than typing.
|
|
141
|
+
|
|
142
|
+
Rules:
|
|
143
|
+
|
|
144
|
+
- Always provide `min`, `max`, and `step` when the domain is known.
|
|
145
|
+
- Show the current value in nearby text when precision matters.
|
|
146
|
+
- Use `NumberInput` instead when users need exact manual numeric entry.
|
|
147
|
+
- Keep horizontal sliders at least 240px wide on mobile.
|
|
148
|
+
|
|
149
|
+
## Phone Input
|
|
150
|
+
|
|
151
|
+
Use `InputPhoneNumber` for Iranian phone numbers instead of a normal `TextField`.
|
|
152
|
+
|
|
153
|
+
Rules:
|
|
154
|
+
|
|
155
|
+
- It normalizes Persian and Arabic numerals to ASCII digits.
|
|
156
|
+
- It accepts `+98`, `0098`, `98`, and 10-digit mobile numbers that start with `9`, then normalizes to a leading `0`.
|
|
157
|
+
- Default `maxDigitLength` is 11.
|
|
158
|
+
- Use `dir="rtl"` by default; use `dir="ltr"` only when the surrounding form needs Latin number alignment.
|
|
159
|
+
- Pass `inputRef` when parent logic needs focus control.
|
|
160
|
+
- Use `onBlur` for touched/validation behavior.
|
|
52
161
|
|
|
53
162
|
## Numeric Inputs
|
|
54
163
|
|
|
55
|
-
Use `NumberInput` for formatted numeric entry.
|
|
164
|
+
Use `NumberInput` for formatted numeric entry.
|
|
56
165
|
|
|
57
166
|
```tsx
|
|
58
167
|
<NumberInput
|
|
@@ -63,6 +172,62 @@ Use `NumberInput` for formatted numeric entry. Use `fungible` when decimals are
|
|
|
63
172
|
/>
|
|
64
173
|
```
|
|
65
174
|
|
|
66
|
-
|
|
175
|
+
Rules:
|
|
176
|
+
|
|
177
|
+
- Use `fungible` when decimals are allowed.
|
|
178
|
+
- `NumberInput` returns the cleaned numeric string to `onChange`.
|
|
179
|
+
- Use `unit` for currency or measurement labels.
|
|
180
|
+
- Use `hasClearButton` only when reset is a useful action.
|
|
181
|
+
- Pair `hasClearButton` with `onReset`.
|
|
182
|
+
- Use `maxLength` and `minLength` when the numeric identifier has length rules.
|
|
183
|
+
- Do not use `type="number"` raw inputs for Persian numeric forms.
|
|
184
|
+
|
|
185
|
+
## Card and OTP Inputs
|
|
186
|
+
|
|
187
|
+
Use `CardNumberInput` for Iranian bank card numbers. It displays groups with dashes and returns cleaned digits to `onChange`.
|
|
188
|
+
|
|
189
|
+
Rules:
|
|
190
|
+
|
|
191
|
+
- Use `bankLogo` for a 20px bank logo at the start of the field when detected.
|
|
192
|
+
- Use `hasClearButton` only when users often need to reset the field.
|
|
193
|
+
- Pair `hasClearButton` with `onReset`.
|
|
194
|
+
- Keep the visible field RTL context-friendly, but the card number itself behaves as numeric input.
|
|
67
195
|
|
|
68
196
|
Use `OtpInput` for verification codes, not a normal text field.
|
|
197
|
+
|
|
198
|
+
OTP sizing:
|
|
199
|
+
|
|
200
|
+
- Default cell: 54px by 54px.
|
|
201
|
+
- Cell radius: 8px.
|
|
202
|
+
- Cell padding: 8px vertical.
|
|
203
|
+
- Direction: LTR.
|
|
204
|
+
- Text alignment: center.
|
|
205
|
+
- Use 4 or 6 cells depending on the verification flow.
|
|
206
|
+
- Use `focusedBorderColor` to customize the focused cell border.
|
|
207
|
+
- Use `backgroundColor` for a custom cell background only when the product surface requires it.
|
|
208
|
+
- Use the `error` prop to show danger-colored cell borders.
|
|
209
|
+
|
|
210
|
+
Use `IosHiddenOtpInput` only as an invisible iOS one-time-code autofill bridge beside a visible `OtpInput`. It renders a 1px hidden input, focuses on iOS, normalizes Persian/Arabic digits to Latin digits, and calls `onOtpChange`.
|
|
211
|
+
|
|
212
|
+
Rules:
|
|
213
|
+
|
|
214
|
+
- Do not use `IosHiddenOtpInput` as the visible OTP UI.
|
|
215
|
+
- Keep the visible code cells in `OtpInput`.
|
|
216
|
+
- Use it only on client-side screens where `navigator.userAgent` and `document` are available.
|
|
217
|
+
|
|
218
|
+
## CounterBoxInput
|
|
219
|
+
|
|
220
|
+
Use `CounterBoxInput` for stepper-like numeric changes where increment and decrement actions are central to the workflow.
|
|
221
|
+
|
|
222
|
+
Rules:
|
|
223
|
+
|
|
224
|
+
- Default field height is 48px.
|
|
225
|
+
- Plus/minus controls are 32px square.
|
|
226
|
+
- Keep the unit visible when the number depends on currency, inventory, or quantity.
|
|
227
|
+
- Set `min`, `max`, and `step` explicitly when business rules exist.
|
|
228
|
+
- Use `allowFloat` for decimal steps.
|
|
229
|
+
- `defaultValue` is kept for API compatibility; prefer controlled `value`.
|
|
230
|
+
- Use `disabledInput` when the field should only change through plus/minus controls.
|
|
231
|
+
- Use `iconColor` and `iconBackgroundColor` sparingly; prefer neutral defaults.
|
|
232
|
+
- Use `minErrText`, `maxErrText`, and `maxAvailable` for domain-specific bounds.
|
|
233
|
+
- Use `mb` only to reserve vertical space when helper/error text is shown.
|
|
@@ -1,8 +1,48 @@
|
|
|
1
1
|
# Layout and Navigation
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## App Shell
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Most generated Injast screens should be mobile-first and centered:
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Box } from "injast-core";
|
|
9
|
+
|
|
10
|
+
<Box
|
|
11
|
+
sx={{
|
|
12
|
+
maxWidth: 520,
|
|
13
|
+
mx: "auto",
|
|
14
|
+
minHeight: "100dvh",
|
|
15
|
+
bgcolor: "neutral.50",
|
|
16
|
+
}}
|
|
17
|
+
>
|
|
18
|
+
{children}
|
|
19
|
+
</Box>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Equivalent CSS:
|
|
23
|
+
|
|
24
|
+
```css
|
|
25
|
+
max-width: 520px;
|
|
26
|
+
margin-inline: auto;
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Use this shell for authentication, onboarding, profile, checkout, settings, forms, and mobile operational flows.
|
|
30
|
+
|
|
31
|
+
Use a wider layout only for desktop-first dashboards, large tables, chart-heavy analytics, or split-pane workflows. Even then, keep forms and drawers constrained to readable widths.
|
|
32
|
+
|
|
33
|
+
## Page Composition
|
|
34
|
+
|
|
35
|
+
- Use `Box`, `Container`, and `Grid` for structure.
|
|
36
|
+
- Use page padding inside the shell: `px: 4`, `py: 4` to `py: 6`.
|
|
37
|
+
- Use `display="grid"` or `display="flex"` with `gap`, not stacked arbitrary margins.
|
|
38
|
+
- Use `gap: 4` to `gap: 6` between major sections.
|
|
39
|
+
- Use `gap: 3` to `gap: 4` inside field groups and card content.
|
|
40
|
+
- Keep a hint of the next section visible on the first viewport when building long mobile flows.
|
|
41
|
+
- Do not create landing-page heroes for app/tool requests.
|
|
42
|
+
- Do not implement mobile OS status bars or decorative app status bars, even when present in Figma frames.
|
|
43
|
+
- Wire screens into flows. Back, home, receipt/history, submit, confirm, close, and selection actions should navigate or update local state instead of acting as static placeholders.
|
|
44
|
+
|
|
45
|
+
## Layout Primitives
|
|
6
46
|
|
|
7
47
|
```tsx
|
|
8
48
|
<Container maxWidth="lg">
|
|
@@ -14,23 +54,85 @@ Use `Box`, `Container`, and `Grid` for page structure.
|
|
|
14
54
|
|
|
15
55
|
Rules:
|
|
16
56
|
|
|
17
|
-
- Use `
|
|
18
|
-
- Use `
|
|
57
|
+
- Use `Container` to constrain broad desktop pages.
|
|
58
|
+
- Use `Box` for app shells, stacks, rows, and framed repeated items.
|
|
19
59
|
- Use `Grid` for responsive multi-column layouts.
|
|
60
|
+
- Use MUI spacing props: `gap`, `p`, `px`, `py`, `m`, `mx`, `my`.
|
|
20
61
|
- Avoid raw CSS layout unless component props are not enough.
|
|
21
62
|
|
|
63
|
+
## Fixed Bottom Actions
|
|
64
|
+
|
|
65
|
+
For mobile forms with a clear final action, use a bottom action band:
|
|
66
|
+
|
|
67
|
+
- Shell width remains 520px max and centered.
|
|
68
|
+
- Use `position: "sticky"` or `position: "fixed"` only when the action must stay visible.
|
|
69
|
+
- Use `px: 4`, `py: 3`, neutral/white background, and a subtle top border.
|
|
70
|
+
- Use a full-width `Button buttonSize="M"` for the primary action.
|
|
71
|
+
- Ensure the scroll content has bottom padding so fields are not hidden behind the action band.
|
|
72
|
+
|
|
73
|
+
## Sticky App Regions
|
|
74
|
+
|
|
75
|
+
For chat, assistant, or app-like flows, use a sticky header and sticky bottom input/action area inside the 520px shell.
|
|
76
|
+
|
|
77
|
+
Header rules:
|
|
78
|
+
|
|
79
|
+
- Height: 56px.
|
|
80
|
+
- Background: `neutral.100` or the page canvas color.
|
|
81
|
+
- Padding: `p: 4` (16px) unless the header is extremely dense.
|
|
82
|
+
- Use Iconsax 20px icons for back, home, menu, and disclosure controls.
|
|
83
|
+
- Use 32px to 40px icon button targets with 12px radius for compact header controls.
|
|
84
|
+
- Truncate long titles with `overflow: "hidden"`, `textOverflow: "ellipsis"`, and `whiteSpace: "nowrap"`.
|
|
85
|
+
|
|
86
|
+
Bottom input/action rules:
|
|
87
|
+
|
|
88
|
+
- Use `position: "sticky"` or a sticky `.input-area` at `bottom: 0`.
|
|
89
|
+
- Use `p: "10px 16px"`, `gap: "8px"`, and `bgcolor: "neutral.100"`.
|
|
90
|
+
- Keep the message/input field container at 12px radius.
|
|
91
|
+
- Use a 48px square submit/send `Button` when the input sits beside the action.
|
|
92
|
+
- Keep the scrollable content area as `flex: 1` with `overflowY: "auto"`.
|
|
93
|
+
|
|
94
|
+
Chat bubble rules:
|
|
95
|
+
|
|
96
|
+
- Use `gap: "8px"` and `mb: "8px"` between message rows.
|
|
97
|
+
- Message bubble max width should leave avatar/action space, for example `maxWidth: "calc(100% - 70px)"`.
|
|
98
|
+
- Bubble padding can use `p: "8px 18px"`.
|
|
99
|
+
- Bubble radius should be 12px, with one corner squared to show sender direction when useful.
|
|
100
|
+
- User messages can use `primary.main` with `primary.contrastText`; bot/system messages should use white or neutral surfaces with `neutral.700` text.
|
|
101
|
+
|
|
22
102
|
## Lists
|
|
23
103
|
|
|
24
104
|
Use `List` and `ListItem` for vertical collections. Keep each row's main label, metadata, and action placement consistent.
|
|
25
105
|
|
|
106
|
+
Rules:
|
|
107
|
+
|
|
108
|
+
- Keep row actions on the trailing side in RTL.
|
|
109
|
+
- Use icons only when they speed recognition.
|
|
110
|
+
- Use stable row heights for repeated lists.
|
|
111
|
+
|
|
26
112
|
## Accordion
|
|
27
113
|
|
|
28
|
-
Use `Accordion`, `AccordionSummary`, and `AccordionDetails` for optional details, filters, and FAQ-like disclosure.
|
|
114
|
+
Use `Accordion`, `AccordionSummary`, and `AccordionDetails` for optional details, filters, and FAQ-like disclosure.
|
|
115
|
+
|
|
116
|
+
Do not hide required primary fields or blocking errors inside an accordion.
|
|
29
117
|
|
|
30
118
|
## Tabs
|
|
31
119
|
|
|
32
120
|
Use `Tab` when switching between closely related panels at the same hierarchy level. Do not use tabs as primary app navigation.
|
|
33
121
|
|
|
122
|
+
Tab rules:
|
|
123
|
+
|
|
124
|
+
- Pass `tabs` as `{ label, value }[]`.
|
|
125
|
+
- Use `activeTab` for a controlled initial/active value.
|
|
126
|
+
- `onChange` receives the selected tab value.
|
|
127
|
+
- Default `fontSize` is 14px; reduce only for dense segmented controls.
|
|
128
|
+
- Tab height is 48px with 12px radius and an active underline.
|
|
129
|
+
|
|
34
130
|
## Stepper
|
|
35
131
|
|
|
36
|
-
Use `Stepper` and related step components for multi-step flows such as onboarding, checkout, or profile completion.
|
|
132
|
+
Use `Stepper` and related step components for multi-step flows such as onboarding, checkout, or profile completion.
|
|
133
|
+
|
|
134
|
+
Rules:
|
|
135
|
+
|
|
136
|
+
- Keep the active step clear.
|
|
137
|
+
- Provide Back/Next actions with `Button`.
|
|
138
|
+
- Keep step content width readable; 400px to 520px works well for form flows.
|
|
@@ -2,28 +2,46 @@
|
|
|
2
2
|
|
|
3
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
4
|
|
|
5
|
+
## Selection Rules
|
|
6
|
+
|
|
7
|
+
- Use root imports from `injast-core` for normal Make output.
|
|
8
|
+
- Use `iconsax-react` for all generated app icons.
|
|
9
|
+
- Use `Box`, `Container`, and `Grid` for layout instead of raw layout elements when possible.
|
|
10
|
+
- Use `Typography` for visible text that participates in hierarchy.
|
|
11
|
+
- Use `Button`, `IconButton`, and `Fab` for actions.
|
|
12
|
+
- Use Injast form components for all inputs.
|
|
13
|
+
- Use `Toast`, `Modal`, `Dialog`, `Loading`, and `Skeleton` for feedback.
|
|
14
|
+
- Use `DataGrid` for tables and operational records.
|
|
15
|
+
- Do not guess custom props. If a component is an MUI wrapper, use the matching Material UI props plus documented Injast-specific props.
|
|
16
|
+
|
|
5
17
|
## Actions
|
|
6
18
|
|
|
7
19
|
| Component | Also known as | Purpose | Guidelines |
|
|
8
20
|
|---|---|---|---|
|
|
9
21
|
| `Button` | CTA, action button | Text actions, submit, navigation, commands | `buttons.md` |
|
|
10
|
-
| `IconButton` | icon action | Compact icon-only actions | `buttons.md` |
|
|
22
|
+
| `IconButton` | icon action | Compact icon-only actions | `buttons.md`, `../foundations/icons.md` |
|
|
11
23
|
| `Fab` | floating action | Prominent floating action | `buttons.md` |
|
|
24
|
+
| `SvgIcon` | masked SVG asset | Legacy/custom SVG mask rendering | `../foundations/icons.md` |
|
|
12
25
|
|
|
13
26
|
## Forms
|
|
14
27
|
|
|
15
28
|
| Component | Also known as | Purpose | Guidelines |
|
|
16
29
|
|---|---|---|---|
|
|
17
30
|
| `TextField` | text input | General text entry | `forms.md` |
|
|
31
|
+
| `Autocomplete` | searchable select, combobox | Search and select from longer option sets | `forms.md` |
|
|
18
32
|
| `NumberInput` | numeric input | Controlled formatted number entry | `forms.md` |
|
|
19
33
|
| `CardNumberInput` | bank card input | Iranian bank card number entry | `forms.md` |
|
|
20
34
|
| `OtpInput` | verification code | One-time password entry | `forms.md` |
|
|
35
|
+
| `IosHiddenOtpInput` | hidden iOS OTP helper | iOS one-time-code autofill bridge | `forms.md` |
|
|
21
36
|
| `InputPhoneNumber` | phone input | Iranian phone number entry | `forms.md` |
|
|
37
|
+
| `FormControl`, `InputLabel`, `MenuItem`, `FormControlLabel` | form wrappers | MUI-compatible form composition helpers | `forms.md` |
|
|
22
38
|
| `Select` | dropdown | Single selection | `forms.md` |
|
|
23
39
|
| `MultiSelect` | tag select | Multiple selection with removable chips | `forms.md` |
|
|
24
40
|
| `Checkbox` | boolean check | Independent yes/no selection | `forms.md` |
|
|
25
41
|
| `Radio`, `RadioGroup` | radio buttons | One choice from a short list | `forms.md` |
|
|
26
42
|
| `Toggle` | switch | On/off setting | `forms.md` |
|
|
43
|
+
| `Slider` | range input | Numeric range or stepped value selection | `forms.md` |
|
|
44
|
+
| `CounterBoxInput` | stepper number input | Quantity or amount with plus/minus controls | `forms.md` |
|
|
27
45
|
|
|
28
46
|
## Feedback
|
|
29
47
|
|
|
@@ -31,13 +49,14 @@ Always prefer Injast Core components over raw HTML and direct Material UI primit
|
|
|
31
49
|
|---|---|---|---|
|
|
32
50
|
| `Toast` | snackbar, alert | Brief status feedback | `feedback.md` |
|
|
33
51
|
| `Modal`, `Dialog` | dialog, overlay | Focused task or confirmation | `feedback.md` |
|
|
52
|
+
| `Drawer` | bottom sheet, side drawer | Mobile picker, filters, navigation drawer | `feedback.md`, `layout.md` |
|
|
34
53
|
| `Loading`, `LoadingModal`, `CircularProgress`, `Skeleton`, `ProgressBar` | progress | Loading and progress states | `feedback.md` |
|
|
35
54
|
|
|
36
55
|
## Layout and Navigation
|
|
37
56
|
|
|
38
57
|
| Component | Also known as | Purpose | Guidelines |
|
|
39
58
|
|---|---|---|---|
|
|
40
|
-
| `Box`, `Container`, `Grid` | layout primitives | Spacing and page structure | `layout.md` |
|
|
59
|
+
| `Box`, `Container`, `Grid` | layout primitives | Spacing, shell, and page structure | `layout.md` |
|
|
41
60
|
| `List`, `ListItem` | list | Vertical repeated items | `layout.md` |
|
|
42
61
|
| `Accordion`, `AccordionSummary`, `AccordionDetails` | disclosure | Collapsible sections | `layout.md` |
|
|
43
62
|
| `Tab` | tabs | Switch between related panels | `layout.md` |
|
|
@@ -48,8 +67,8 @@ Always prefer Injast Core components over raw HTML and direct Material UI primit
|
|
|
48
67
|
| Component | Also known as | Purpose | Guidelines |
|
|
49
68
|
|---|---|---|---|
|
|
50
69
|
| `DataGrid` | table, grid | Tabular operational data | `data-display.md` |
|
|
51
|
-
| `Typography` | text | Text hierarchy | `data-display.md` |
|
|
52
|
-
| `Image` | image | Image rendering with
|
|
70
|
+
| `Typography` | text | Text hierarchy | `data-display.md`, `../foundations/typography.md` |
|
|
71
|
+
| `Image` | image | Image rendering with object-fit behavior | `data-display.md` |
|
|
53
72
|
| `Divider`, `Pagination` | separator, pager | Data and content structure | `data-display.md` |
|
|
54
73
|
|
|
55
74
|
## Date Inputs
|
|
@@ -1,37 +1,22 @@
|
|
|
1
1
|
# Color
|
|
2
2
|
|
|
3
|
-
## Palette
|
|
3
|
+
## Palette Source
|
|
4
4
|
|
|
5
|
-
Use `defaultColors` from `injast-core
|
|
5
|
+
Use `defaultColors` from `injast-core` or `injast-core/constants` for semantic color decisions:
|
|
6
6
|
|
|
7
7
|
```tsx
|
|
8
8
|
import { defaultColors } from "injast-core";
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
The active Material UI theme combines `appColors` with `defaultColors`. Prefer theme palette references in `sx`:
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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"`.
|
|
13
|
+
```tsx
|
|
14
|
+
<Box sx={{ bgcolor: "neutral.50", color: "neutral.900" }} />
|
|
15
|
+
```
|
|
31
16
|
|
|
32
|
-
## App Colors
|
|
17
|
+
## Required App Colors
|
|
33
18
|
|
|
34
|
-
Every
|
|
19
|
+
Every `ThemeProvider` and `SPAThemeProvider` requires `appColors.primary` and `appColors.secondary`.
|
|
35
20
|
|
|
36
21
|
```tsx
|
|
37
22
|
const appColors = {
|
|
@@ -49,3 +34,41 @@ const appColors = {
|
|
|
49
34
|
},
|
|
50
35
|
};
|
|
51
36
|
```
|
|
37
|
+
|
|
38
|
+
Use `primary` for the main action, active states, selected dates, selected tabs, and focused highlights. Use `secondary` for supporting neutral actions only when the UI needs a formal secondary brand color.
|
|
39
|
+
|
|
40
|
+
## Core Palette Groups
|
|
41
|
+
|
|
42
|
+
| Group | Key values | Use for |
|
|
43
|
+
|---|---|---|
|
|
44
|
+
| `neutral` | `50` to `900`, `main`, `light`, `dark` | Text, surfaces, borders, disabled UI, low-emphasis controls |
|
|
45
|
+
| `success` | `light`, `main`, `dark` | Successful completion, positive status, confirmation feedback |
|
|
46
|
+
| `danger` | `light`, `main`, `dark` | Errors, destructive actions, failed validation |
|
|
47
|
+
| `warning` | `light`, `main`, `dark` | Caution, pending risk, warning feedback |
|
|
48
|
+
| `info` | `light`, `main`, `dark` | Neutral information and helper status |
|
|
49
|
+
| `teal` | `100` to `400`, `transparent` | Preferred Injast accent and brand-adjacent highlights |
|
|
50
|
+
| `blue`, `cyan`, `indigo`, `pink`, `orange`, `magenta`, `yellow`, `red` | `100` to `400`, `transparent` | Charts, badges, secondary visual differentiation |
|
|
51
|
+
|
|
52
|
+
## Surface Rules
|
|
53
|
+
|
|
54
|
+
- Use `neutral.50` for the page canvas in mobile app shells.
|
|
55
|
+
- Use white or `neutral.100` for contained sections and cards.
|
|
56
|
+
- Use `neutral.200` and `neutral.300` for separators, field borders, and low-emphasis dividers.
|
|
57
|
+
- Use `neutral.700` to `neutral.900` for primary text.
|
|
58
|
+
- Use `neutral.500` to `neutral.600` for secondary labels, helper text, and icon-only inactive states.
|
|
59
|
+
- Do not use `primary.main`, `danger.main`, `warning.main`, or other saturated colors as large page backgrounds.
|
|
60
|
+
|
|
61
|
+
## Status Rules
|
|
62
|
+
|
|
63
|
+
- Success feedback: `success.light` background, `success.main` icon/text/border.
|
|
64
|
+
- Error feedback: `danger.light` background, `danger.main` icon/text/border.
|
|
65
|
+
- Warning feedback: `warning.light` background, `warning.main` icon/text/border.
|
|
66
|
+
- Info feedback: `info.light` background, `info.main` icon/text/border.
|
|
67
|
+
- Destructive actions should be explicit and should not look like the normal primary action.
|
|
68
|
+
|
|
69
|
+
## Hard Rules
|
|
70
|
+
|
|
71
|
+
- Do not invent new semantic names such as `brand`, `accent`, or `surface` unless a local app defines them.
|
|
72
|
+
- Do not hardcode colors when a `defaultColors` or theme palette value exists.
|
|
73
|
+
- Do not create one-note pages dominated by teal, purple, blue, or orange. Keep most UI neutral and use color as signal.
|
|
74
|
+
- Keep icons and text color paired with their status. Example: warning copy uses `warning.main`, not `primary.main`.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Icons
|
|
2
|
+
|
|
3
|
+
## Icon Package
|
|
4
|
+
|
|
5
|
+
Use `iconsax-react` for all generated app icons:
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Add, Calendar, CloseCircle, SearchNormal1, TickCircle } from "iconsax-react";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Do not use Lucide, Heroicons, Font Awesome, inline SVGs, emoji icons, or `@mui/icons-material` in generated screens.
|
|
12
|
+
|
|
13
|
+
Brand marks, bot avatars, uploaded media, and product illustrations can use `Image` or project image assets. Functional UI icons such as close, send, search, calendar, menu, status, back, home, and add/remove should use `iconsax-react`.
|
|
14
|
+
|
|
15
|
+
Use `SvgIcon` only for existing custom SVG mask assets that must be recolored and do not exist in Iconsax. Prefer Iconsax first for app controls.
|
|
16
|
+
|
|
17
|
+
`SvgIcon` props:
|
|
18
|
+
|
|
19
|
+
- `src`: path to the SVG mask asset.
|
|
20
|
+
- `color`: mask color; default is black.
|
|
21
|
+
- `size`: square width/height; default is 24px.
|
|
22
|
+
|
|
23
|
+
## Sizes
|
|
24
|
+
|
|
25
|
+
| Context | Size |
|
|
26
|
+
|---|---:|
|
|
27
|
+
| Input adornment | 20px |
|
|
28
|
+
| Compact chip/remove icon | 18px |
|
|
29
|
+
| Small inline action | 20px |
|
|
30
|
+
| Standard button/action icon | 24px |
|
|
31
|
+
| Toast/status icon | 28px |
|
|
32
|
+
| Large FAB icon | 28px |
|
|
33
|
+
|
|
34
|
+
## Color
|
|
35
|
+
|
|
36
|
+
- Use `defaultColors.neutral.main` or `neutral.600` for inactive utility icons.
|
|
37
|
+
- Use `defaultColors.neutral.dark` or `neutral.800` for high-emphasis icons.
|
|
38
|
+
- Use `primary.main` for selected, focused, and primary action icons.
|
|
39
|
+
- Use matching status colors for status icons: `success.main`, `danger.main`, `warning.main`, and `info.main`.
|
|
40
|
+
- Disabled icons use `neutral.300` or `neutral.400`.
|
|
41
|
+
|
|
42
|
+
## Variants
|
|
43
|
+
|
|
44
|
+
- Use the default Iconsax variant for normal UI controls.
|
|
45
|
+
- Use `variant="Bold"` for status icons in `Toast`-like feedback and high-certainty states.
|
|
46
|
+
- Do not mix icon styles inside one toolbar or button group.
|
|
47
|
+
|
|
48
|
+
## RTL Placement
|
|
49
|
+
|
|
50
|
+
- Put leading icons in `startIcon` for actions that visually begin with an icon.
|
|
51
|
+
- Put trailing icons in `endIcon` for navigation, disclosure, and calendar/date affordances.
|
|
52
|
+
- Use logical spacing with `gap: 2`; do not use left/right margins unless an existing component requires it.
|
|
53
|
+
- Icons that imply direction should match RTL flow. In RTL, forward movement normally points left and back movement points right.
|
|
54
|
+
|
|
55
|
+
## Examples
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
import { Calendar, SearchNormal1 } from "iconsax-react";
|
|
59
|
+
import { TextField, defaultColors } from "injast-core";
|
|
60
|
+
|
|
61
|
+
<TextField
|
|
62
|
+
label="جستجو"
|
|
63
|
+
height={48}
|
|
64
|
+
startAdornment={<SearchNormal1 size={20} color={defaultColors.neutral.main} />}
|
|
65
|
+
/>
|
|
66
|
+
|
|
67
|
+
<TextField
|
|
68
|
+
label="تاریخ"
|
|
69
|
+
height={48}
|
|
70
|
+
endAdornment={<Calendar size={20} color={defaultColors.neutral.dark} />}
|
|
71
|
+
/>
|
|
72
|
+
```
|