@nexus-cross/design-system 1.0.1 → 1.0.2
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/cursor-rules/nexus-project-setup.mdc +150 -150
- package/cursor-rules/nexus-ui-api.mdc +659 -316
- package/cursor-rules/nexus-ui-components.mdc +162 -96
- package/dist/chunks/chunk-55IEEVNR.js +7 -0
- package/dist/chunks/{chunk-5JHN4FCY.mjs → chunk-K2TBLM3F.mjs} +1 -4
- package/dist/chunks/{chunk-MTX7GD3H.js → chunk-PEIEVKD5.js} +1 -4
- package/dist/chunks/chunk-XMG7ZEYY.mjs +5 -0
- package/dist/data-list.js +2 -2
- package/dist/data-list.mjs +1 -1
- package/dist/error-boundary.d.mts +1 -1
- package/dist/error-boundary.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/dist/schemas/_all.json +480 -480
- package/dist/schemas/accordion.json +12 -12
- package/dist/schemas/avatar.json +9 -9
- package/dist/schemas/button.json +13 -13
- package/dist/schemas/carousel.json +6 -6
- package/dist/schemas/carouselButton.json +3 -3
- package/dist/schemas/carouselDots.json +2 -2
- package/dist/schemas/carouselSlide.json +3 -3
- package/dist/schemas/checkBox.json +15 -15
- package/dist/schemas/chip.json +9 -9
- package/dist/schemas/clientOnly.json +3 -3
- package/dist/schemas/countdown.json +8 -8
- package/dist/schemas/counter.json +11 -11
- package/dist/schemas/dataList.json +10 -10
- package/dist/schemas/divider.json +6 -6
- package/dist/schemas/drawer.json +8 -8
- package/dist/schemas/drawerClose.json +4 -4
- package/dist/schemas/drawerContent.json +7 -7
- package/dist/schemas/drawerDescription.json +3 -3
- package/dist/schemas/drawerTitle.json +3 -3
- package/dist/schemas/drawerTrigger.json +4 -4
- package/dist/schemas/ellipsis.json +9 -9
- package/dist/schemas/errorBoundary.json +4 -4
- package/dist/schemas/infiniteScroll.json +12 -12
- package/dist/schemas/marquee.json +8 -8
- package/dist/schemas/modalCall.json +20 -20
- package/dist/schemas/modalTemplate.json +26 -26
- package/dist/schemas/numberInput.json +19 -19
- package/dist/schemas/pagination.json +8 -8
- package/dist/schemas/popover.json +12 -12
- package/dist/schemas/radioGroup.json +12 -12
- package/dist/schemas/radioItem.json +7 -7
- package/dist/schemas/select.json +11 -11
- package/dist/schemas/selectItem.json +5 -5
- package/dist/schemas/skeleton.json +8 -8
- package/dist/schemas/spinner.json +6 -6
- package/dist/schemas/switch.json +10 -10
- package/dist/schemas/tab.json +15 -15
- package/dist/schemas/table.json +14 -14
- package/dist/schemas/tableRow.json +5 -5
- package/dist/schemas/tdColumn.json +17 -17
- package/dist/schemas/textArea.json +18 -18
- package/dist/schemas/textInput.json +25 -25
- package/dist/schemas/themeProvider.json +10 -10
- package/dist/schemas/toastOptions.json +17 -17
- package/dist/schemas/toaster.json +12 -12
- package/dist/schemas/tooltip.json +10 -10
- package/dist/schemas/virtualGrid.json +11 -11
- package/dist/schemas/virtualList.json +10 -10
- package/dist/schemas.js +475 -475
- package/dist/schemas.mjs +475 -475
- package/dist/styles/layer.js +2 -2
- package/dist/styles/layer.mjs +1 -1
- package/dist/styles.css +28 -15
- package/dist/styles.js +2 -2
- package/dist/styles.layered.css +28 -15
- package/dist/styles.mjs +1 -1
- package/package.json +8 -6
- package/scripts/setup-cursor-rules.cjs +6 -6
- package/dist/chunks/chunk-GMGG4VZM.mjs +0 -5
- package/dist/chunks/chunk-N75GAGAG.js +0 -7
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "NEXUS Design System
|
|
2
|
+
description: "NEXUS Design System project setup — tech stack and mandatory rules for this project"
|
|
3
3
|
alwaysApply: true
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# NEXUS Design System
|
|
6
|
+
# NEXUS Design System Project Setup
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
This project uses NEXUS Design System. All generated code MUST follow the rules below.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Tech Stack
|
|
11
11
|
|
|
12
|
-
-
|
|
13
|
-
- **UI
|
|
14
|
-
-
|
|
12
|
+
- **Design Tokens**: `@nexus-cross/tokens` (CSS variable based)
|
|
13
|
+
- **UI Components**: `@nexus-cross/design-system` (React, CVA + Plain CSS)
|
|
14
|
+
- **Styling**: Tailwind CSS v4 + NEXUS semantic tokens
|
|
15
15
|
|
|
16
|
-
##
|
|
16
|
+
## Design System CSS Setup
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
Choose one of two CSS entry points depending on the project environment:
|
|
19
19
|
|
|
20
|
-
|
|
|
20
|
+
| Environment | import | Description |
|
|
21
21
|
|---|---|---|
|
|
22
22
|
| Tailwind v3 / Plain CSS / CSS Modules | `@nexus-cross/design-system/styles` | unlayered CSS |
|
|
23
|
-
| Tailwind v4 | `@nexus-cross/design-system/styles/layer` | `@layer nexus
|
|
23
|
+
| Tailwind v4 | `@nexus-cross/design-system/styles/layer` | wrapped in `@layer nexus` |
|
|
24
24
|
|
|
25
25
|
```tsx
|
|
26
26
|
// Tailwind v3, Plain CSS, CSS Modules
|
|
@@ -30,101 +30,101 @@ import '@nexus-cross/design-system/styles'
|
|
|
30
30
|
import '@nexus-cross/design-system/styles/layer'
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
Tailwind v4
|
|
33
|
+
For Tailwind v4 projects, also declare layer order in `globals.css`:
|
|
34
34
|
```css
|
|
35
35
|
@layer base, nexus, components, utilities;
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
##
|
|
38
|
+
## Absolute Rules
|
|
39
39
|
|
|
40
|
-
1.
|
|
41
|
-
- `bg-bg-default`, `text-text-primary`, `border-border-default
|
|
42
|
-
- `#ffffff`, `#000000`, `rgb()`
|
|
43
|
-
-
|
|
40
|
+
1. **Always use NEXUS tokens for colors.** Hardcoding is prohibited.
|
|
41
|
+
- `bg-bg-default`, `text-text-primary`, `border-border-default`, etc.
|
|
42
|
+
- Direct color values like `#ffffff`, `#000000`, `rgb()` are prohibited
|
|
43
|
+
- Reference: `.cursor/rules/nexus-tokens.mdc`
|
|
44
44
|
|
|
45
|
-
2. **UI
|
|
46
|
-
- `<Button>`, `<TextInput>`, `<Modal>`, `<Toast
|
|
47
|
-
- Radix UI, Headless UI
|
|
48
|
-
-
|
|
45
|
+
2. **Always import UI components from `@nexus-cross/design-system`.** Direct implementation is prohibited.
|
|
46
|
+
- `<Button>`, `<TextInput>`, `<Modal>`, `<Toast>`, etc.
|
|
47
|
+
- Do NOT import Radix UI, Headless UI, etc. to build equivalent components
|
|
48
|
+
- Reference: `.cursor/rules/nexus-ui-components.mdc`, `.cursor/rules/nexus-ui-api.mdc`
|
|
49
49
|
|
|
50
|
-
3. **
|
|
51
|
-
- NEXUS
|
|
52
|
-
- Figma
|
|
53
|
-
- Figma
|
|
54
|
-
-
|
|
55
|
-
-
|
|
50
|
+
3. **When implementing Figma designs:**
|
|
51
|
+
- Actively use NEXUS tokens and shared UI, while **faithfully** implementing the Figma design
|
|
52
|
+
- Map Figma color values to the closest NEXUS token
|
|
53
|
+
- Implement Figma UI elements (buttons, inputs, etc.) using `@nexus-cross/design-system` components
|
|
54
|
+
- If shared UI style differs from Figma, override with `className` to match Figma
|
|
55
|
+
- Only use Tailwind utilities for custom styles not present in Figma
|
|
56
56
|
|
|
57
|
-
## Figma MCP → NEXUS
|
|
57
|
+
## Figma MCP → NEXUS Conversion Workflow
|
|
58
58
|
|
|
59
|
-
**Figma MCP
|
|
60
|
-
Figma MCP
|
|
61
|
-
**MCP
|
|
59
|
+
**NEVER use Figma MCP tool output (get_design_context, get_code, etc.) as-is.**
|
|
60
|
+
Figma MCP outputs vanilla HTML + Tailwind, but this project uses `@nexus-cross/design-system`.
|
|
61
|
+
**MCP output is only a "reference for understanding design intent", not final code.**
|
|
62
62
|
|
|
63
|
-
###
|
|
63
|
+
### Mandatory 3-Step Workflow
|
|
64
64
|
|
|
65
|
-
**1
|
|
66
|
-
- `get_design_context
|
|
67
|
-
- `get_screenshot
|
|
68
|
-
-
|
|
65
|
+
**Step 1: Design Analysis (MCP call)**
|
|
66
|
+
- Use `get_design_context` to understand structure and layout
|
|
67
|
+
- Use `get_screenshot` for visual reference
|
|
68
|
+
- Code output from MCP at this stage is **read-only — do not use it**
|
|
69
69
|
|
|
70
|
-
**2
|
|
71
|
-
MCP
|
|
70
|
+
**Step 2: Component Mapping (MUST be done before writing code)**
|
|
71
|
+
Map each element from MCP output to a NEXUS component. **Complete this mapping before writing a single line of code.**
|
|
72
72
|
|
|
73
73
|
```
|
|
74
|
-
MCP
|
|
75
|
-
- <button>
|
|
76
|
-
- <input type="text">
|
|
77
|
-
- <select>
|
|
78
|
-
-
|
|
79
|
-
-
|
|
80
|
-
-
|
|
74
|
+
MCP Output Analysis:
|
|
75
|
+
- 2 <button> found → Button (primary, ghost)
|
|
76
|
+
- 1 <input type="text"> → TextInput
|
|
77
|
+
- 1 <select> → Select + SelectItem
|
|
78
|
+
- Color #09B498 → bg-accent-primary (NEXUS token)
|
|
79
|
+
- Color #1E232E → text-text-primary (NEXUS token)
|
|
80
|
+
- Spacing 16px → var(--spacing-padding-md)
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
**3
|
|
84
|
-
|
|
83
|
+
**Step 3: NEXUS Code Generation**
|
|
84
|
+
Write code based on the mapping. Do NOT reference MCP output code at this stage.
|
|
85
85
|
|
|
86
|
-
###
|
|
86
|
+
### Component Conversion Table
|
|
87
87
|
|
|
88
|
-
| MCP
|
|
88
|
+
| MCP Output (Native HTML) | → NEXUS Component |
|
|
89
89
|
|---|---|
|
|
90
|
-
| `<button>`, `<a>`
|
|
91
|
-
| `<input type="text">` | `<TextInput>` (prefixIcon, suffixIcon
|
|
92
|
-
| `<textarea>` | `<TextArea>` (showCount, maxLength
|
|
90
|
+
| `<button>`, `<a>` button style | `<Button>` (specify variant, size) |
|
|
91
|
+
| `<input type="text">` | `<TextInput>` (prefixIcon, suffixIcon supported) |
|
|
92
|
+
| `<textarea>` | `<TextArea>` (showCount, maxLength supported) |
|
|
93
93
|
| `<input type="number">` | `<NumberInput>` |
|
|
94
94
|
| `<select>` | `<Select>` + `<SelectItem>` |
|
|
95
95
|
| `<input type="checkbox">` | `<CheckBox>` |
|
|
96
96
|
| `<input type="radio">` | `<RadioGroup>` + `<RadioItem>` |
|
|
97
|
-
|
|
|
98
|
-
|
|
|
99
|
-
|
|
|
100
|
-
|
|
|
101
|
-
|
|
|
102
|
-
|
|
|
103
|
-
|
|
|
104
|
-
|
|
|
105
|
-
|
|
|
106
|
-
|
|
|
107
|
-
|
|
|
108
|
-
|
|
|
109
|
-
|
|
|
110
|
-
|
|
|
111
|
-
|
|
|
112
|
-
|
|
|
113
|
-
|
|
|
114
|
-
|
|
|
115
|
-
|
|
|
116
|
-
|
|
|
117
|
-
|
|
|
118
|
-
|
|
|
119
|
-
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
###
|
|
124
|
-
|
|
125
|
-
MCP
|
|
126
|
-
|
|
127
|
-
| MCP
|
|
97
|
+
| Toggle/Switch UI | `<Switch>` |
|
|
98
|
+
| Tab UI | `<Tab>` (configured via items array) |
|
|
99
|
+
| Chip/Tag/Filter/Badge | `<Chip>` (variant, onClose supported) |
|
|
100
|
+
| Avatar/Profile image | `<Avatar>` (fallback, shape supported) |
|
|
101
|
+
| Divider/`<hr>` | `<Divider>` (specify orientation, variant) |
|
|
102
|
+
| Dropdown menu | `<Select>` or `<Popover>` |
|
|
103
|
+
| Tooltip | `<Tooltip>` |
|
|
104
|
+
| Accordion/Collapsible | `<Accordion>` |
|
|
105
|
+
| Carousel/Slider | `<Carousel>` + `<CarouselSlide>` |
|
|
106
|
+
| Pagination | `<Pagination>` |
|
|
107
|
+
| Modal/Dialog | `modal()` + `<ModalTemplate>` |
|
|
108
|
+
| Toast/Notification | `toast()` |
|
|
109
|
+
| Drawer/Bottom sheet | `<Drawer>` |
|
|
110
|
+
| Loading spinner | `<Spinner>` |
|
|
111
|
+
| Skeleton loader | `<Skeleton>` |
|
|
112
|
+
| Data list | `<DataList>` |
|
|
113
|
+
| Table | `<Table>` + `<TableRow>` + `<TdColumn>` |
|
|
114
|
+
| Number count animation | `<Counter>` |
|
|
115
|
+
| Countdown timer | `<Countdown>` |
|
|
116
|
+
| Text ellipsis | `<Ellipsis>` |
|
|
117
|
+
| Scrolling text | `<Marquee>` |
|
|
118
|
+
| Infinite scroll list | `<InfiniteScroll>` |
|
|
119
|
+
| Large list (virtual scroll) | `<VirtualList>` / `<VirtualGrid>` |
|
|
120
|
+
|
|
121
|
+
**Using native HTML instead of the replacements above is a rule violation.**
|
|
122
|
+
|
|
123
|
+
### Color Conversion Table
|
|
124
|
+
|
|
125
|
+
Convert MCP output colors to NEXUS tokens:
|
|
126
|
+
|
|
127
|
+
| MCP Output Color | → NEXUS Token |
|
|
128
128
|
|---|---|
|
|
129
129
|
| `#FFFFFF`, `bg-white` | `bg-bg-default` |
|
|
130
130
|
| `#F3F6F8`, `bg-gray-50` | `bg-bg-subtle` |
|
|
@@ -139,59 +139,59 @@ MCP가 출력하는 색상값을 NEXUS 토큰으로 변환한다:
|
|
|
139
139
|
| `#FF9D00`, `bg-amber-*` | `bg-status-warning` |
|
|
140
140
|
| `#0095FF`, `bg-blue-*` | `bg-status-info` |
|
|
141
141
|
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
For colors not exactly matching above, choose the closest NEXUS token.
|
|
143
|
+
**Under no circumstances use hex values or default Tailwind colors (bg-blue-500, etc.).**
|
|
144
144
|
|
|
145
|
-
### Button
|
|
145
|
+
### Button Variant Decision Criteria
|
|
146
146
|
|
|
147
|
-
|
|
147
|
+
Determine the variant based on visual style in Figma:
|
|
148
148
|
|
|
149
|
-
| Figma
|
|
149
|
+
| Figma Visual Characteristic | → variant |
|
|
150
150
|
|---|---|
|
|
151
|
-
|
|
|
152
|
-
|
|
|
153
|
-
|
|
|
154
|
-
|
|
|
155
|
-
|
|
|
151
|
+
| Filled accent color background (green/teal) | `variant="primary"` |
|
|
152
|
+
| Filled gray/neutral background | `variant="secondary"` |
|
|
153
|
+
| Border only, transparent background | `variant="outline"` |
|
|
154
|
+
| No background/border, text only | `variant="ghost"` |
|
|
155
|
+
| Red/danger indicator | `variant="danger"` |
|
|
156
156
|
|
|
157
|
-
###
|
|
157
|
+
### Self-Verification Checklist
|
|
158
158
|
|
|
159
|
-
|
|
159
|
+
Verify the following before outputting code:
|
|
160
160
|
|
|
161
|
-
- [ ] `<button>`, `<input>`, `<select>`, `<textarea
|
|
162
|
-
- [ ] hex
|
|
163
|
-
- [ ] Tailwind
|
|
164
|
-
- [ ]
|
|
165
|
-
- [ ]
|
|
166
|
-
- [ ]
|
|
161
|
+
- [ ] No native HTML form elements (`<button>`, `<input>`, `<select>`, `<textarea>`, etc.)?
|
|
162
|
+
- [ ] No hex color values (`#...`)?
|
|
163
|
+
- [ ] No default Tailwind colors (`bg-blue-500`, `text-gray-900`, etc.)?
|
|
164
|
+
- [ ] All imports from `@nexus-cross/design-system`?
|
|
165
|
+
- [ ] Modals wrapped with `ModalTemplate`?
|
|
166
|
+
- [ ] No hardcoded px values for spacing/sizing?
|
|
167
167
|
|
|
168
|
-
|
|
168
|
+
**If any check fails, fix the code before outputting.**
|
|
169
169
|
|
|
170
170
|
```tsx
|
|
171
|
-
//
|
|
172
|
-
<button className="bg-[#09B498] text-white px-4 py-2 rounded-lg"
|
|
173
|
-
<input className="border border-[#C6D0DA] px-3 py-2 rounded" placeholder="
|
|
174
|
-
<div className="w-8 h-8 rounded-full bg-gray-200" /> {/*
|
|
175
|
-
<hr className="border-[#ECF0F2]" /> {/*
|
|
176
|
-
|
|
177
|
-
//
|
|
178
|
-
<Button variant="primary"
|
|
179
|
-
<TextInput placeholder="
|
|
171
|
+
// WRONG — Using Figma MCP code as-is (prohibited)
|
|
172
|
+
<button className="bg-[#09B498] text-white px-4 py-2 rounded-lg">Confirm</button>
|
|
173
|
+
<input className="border border-[#C6D0DA] px-3 py-2 rounded" placeholder="Search" />
|
|
174
|
+
<div className="w-8 h-8 rounded-full bg-gray-200" /> {/* avatar */}
|
|
175
|
+
<hr className="border-[#ECF0F2]" /> {/* divider */}
|
|
176
|
+
|
|
177
|
+
// CORRECT — Replace with NEXUS components (required)
|
|
178
|
+
<Button variant="primary">Confirm</Button>
|
|
179
|
+
<TextInput placeholder="Search" prefixIcon={<SearchIcon />} />
|
|
180
180
|
<Avatar fallback="JD" size="sm" />
|
|
181
181
|
<Divider />
|
|
182
182
|
```
|
|
183
183
|
|
|
184
|
-
##
|
|
184
|
+
## Global Setup (Required at App Root)
|
|
185
185
|
|
|
186
|
-
|
|
186
|
+
The following components MUST be placed at the app root (layout.tsx or App.tsx).
|
|
187
187
|
|
|
188
|
-
|
|
|
189
|
-
|
|
190
|
-
| `<ModalContainer />` | `@nexus-cross/design-system/modal` | `modal()`
|
|
191
|
-
| `<Toaster />` | `@nexus-cross/design-system` | `toast()`
|
|
188
|
+
| Component | import | Required When | Description |
|
|
189
|
+
|---|---|---|---|
|
|
190
|
+
| `<ModalContainer />` | `@nexus-cross/design-system/modal` | Using `modal()` or `useModal()` | Modal rendering container |
|
|
191
|
+
| `<Toaster />` | `@nexus-cross/design-system` | Using `toast()` | Toast notification renderer |
|
|
192
192
|
|
|
193
193
|
```tsx
|
|
194
|
-
// layout.tsx
|
|
194
|
+
// layout.tsx or App.tsx
|
|
195
195
|
import { ModalContainer } from '@nexus-cross/design-system/modal';
|
|
196
196
|
import { Toaster } from '@nexus-cross/design-system';
|
|
197
197
|
|
|
@@ -206,87 +206,87 @@ export default function RootLayout({ children }) {
|
|
|
206
206
|
}
|
|
207
207
|
```
|
|
208
208
|
|
|
209
|
-
|
|
210
|
-
- Tooltip (
|
|
211
|
-
- Popover, Drawer, Select, Accordion
|
|
209
|
+
**Components that do NOT need global setup** (usable directly without Provider):
|
|
210
|
+
- Tooltip (Provider built-in)
|
|
211
|
+
- Popover, Drawer, Select, Accordion, and all other components
|
|
212
212
|
|
|
213
|
-
## Import
|
|
213
|
+
## Import Patterns
|
|
214
214
|
|
|
215
215
|
```tsx
|
|
216
|
-
//
|
|
216
|
+
// General components
|
|
217
217
|
import { Button, TextInput, TextArea, Select, Switch, Chip, Spinner, Divider } from '@nexus-cross/design-system';
|
|
218
218
|
|
|
219
|
-
//
|
|
219
|
+
// Overlay components
|
|
220
220
|
import { Tooltip, Popover, Drawer, Accordion } from '@nexus-cross/design-system';
|
|
221
221
|
|
|
222
|
-
//
|
|
222
|
+
// Toast
|
|
223
223
|
import { toast, Toaster } from '@nexus-cross/design-system';
|
|
224
224
|
|
|
225
|
-
//
|
|
225
|
+
// Modal system (separate subpath)
|
|
226
226
|
import { modal, useModal, ModalTemplate, ModalContainer } from '@nexus-cross/design-system/modal';
|
|
227
227
|
|
|
228
|
-
//
|
|
228
|
+
// Tokens (only when JS API is needed)
|
|
229
229
|
import { getTheme } from '@nexus-cross/tokens';
|
|
230
230
|
```
|
|
231
231
|
|
|
232
|
-
##
|
|
232
|
+
## Modal Writing Rules
|
|
233
233
|
|
|
234
|
-
|
|
234
|
+
Modal components **MUST be wrapped with `ModalTemplate`.** Do NOT create modals with plain `<div>`.
|
|
235
235
|
|
|
236
236
|
```tsx
|
|
237
|
-
//
|
|
237
|
+
// CORRECT modal
|
|
238
238
|
import { ModalTemplate } from '@nexus-cross/design-system/modal';
|
|
239
239
|
|
|
240
240
|
function MyModal({ close, resolve }: { close: () => void; resolve: (value: any) => void }) {
|
|
241
241
|
return (
|
|
242
|
-
<ModalTemplate title="
|
|
243
|
-
<p className="text-text-secondary"
|
|
244
|
-
<Button onClick={() => resolve({ confirmed: true })}
|
|
242
|
+
<ModalTemplate title="Title" close={close}>
|
|
243
|
+
<p className="text-text-secondary">Content</p>
|
|
244
|
+
<Button onClick={() => resolve({ confirmed: true })}>Confirm</Button>
|
|
245
245
|
</ModalTemplate>
|
|
246
246
|
);
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
//
|
|
249
|
+
// Call
|
|
250
250
|
const result = await modal({ component: MyModal });
|
|
251
251
|
```
|
|
252
252
|
|
|
253
253
|
```tsx
|
|
254
|
-
//
|
|
254
|
+
// WRONG modal — using div without ModalTemplate
|
|
255
255
|
function MyModal({ close }: { close: () => void }) {
|
|
256
256
|
return (
|
|
257
257
|
<div className="p-6 bg-white rounded-lg">
|
|
258
|
-
<h2
|
|
259
|
-
<p
|
|
258
|
+
<h2>Title</h2>
|
|
259
|
+
<p>Content</p>
|
|
260
260
|
</div>
|
|
261
261
|
);
|
|
262
262
|
}
|
|
263
263
|
```
|
|
264
264
|
|
|
265
|
-
##
|
|
265
|
+
## Toast Usage Rules
|
|
266
266
|
|
|
267
267
|
```tsx
|
|
268
268
|
import { toast } from '@nexus-cross/design-system';
|
|
269
269
|
|
|
270
|
-
toast('
|
|
271
|
-
toast.success('
|
|
272
|
-
toast.error('
|
|
273
|
-
toast.loading('
|
|
270
|
+
toast('Default message');
|
|
271
|
+
toast.success('Success!');
|
|
272
|
+
toast.error('An error occurred');
|
|
273
|
+
toast.loading('Processing...');
|
|
274
274
|
```
|
|
275
275
|
|
|
276
|
-
|
|
276
|
+
Calling `toast()` without `<Toaster />` at the root will display nothing.
|
|
277
277
|
|
|
278
|
-
##
|
|
278
|
+
## Token Usage Examples
|
|
279
279
|
|
|
280
280
|
```tsx
|
|
281
|
-
//
|
|
281
|
+
// CORRECT usage
|
|
282
282
|
<div className="bg-bg-default text-text-primary border border-border-default">
|
|
283
|
-
<Button variant="primary"
|
|
284
|
-
<TextInput placeholder="
|
|
283
|
+
<Button variant="primary">Confirm</Button>
|
|
284
|
+
<TextInput placeholder="Search..." />
|
|
285
285
|
</div>
|
|
286
286
|
|
|
287
|
-
//
|
|
287
|
+
// WRONG usage
|
|
288
288
|
<div className="bg-white text-gray-900 border border-gray-200">
|
|
289
|
-
<button className="bg-green-500 text-white px-4 py-2 rounded"
|
|
290
|
-
<input className="border border-gray-300 px-3 py-2" placeholder="
|
|
289
|
+
<button className="bg-green-500 text-white px-4 py-2 rounded">Confirm</button>
|
|
290
|
+
<input className="border border-gray-300 px-3 py-2" placeholder="Search..." />
|
|
291
291
|
</div>
|
|
292
292
|
```
|