@nexus-cross/design-system 1.0.6-beta.1 → 1.0.6
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/DESIGN.md +185 -0
- package/cursor-rules/nexus-project-setup.mdc +167 -145
- package/cursor-rules/nexus-ui-api.mdc +898 -311
- package/cursor-rules/nexus-ui-components.mdc +206 -91
- package/dist/accordion.js +7 -7
- package/dist/accordion.mjs +2 -2
- package/dist/alert.d.mts +17 -0
- package/dist/alert.d.ts +17 -0
- package/dist/alert.js +16 -0
- package/dist/alert.mjs +3 -0
- package/dist/avatar.js +4 -4
- package/dist/avatar.mjs +2 -2
- package/dist/badge.d.mts +18 -0
- package/dist/badge.d.ts +18 -0
- package/dist/badge.js +16 -0
- package/dist/badge.mjs +3 -0
- package/dist/breadcrumb.d.mts +15 -0
- package/dist/breadcrumb.d.ts +15 -0
- package/dist/breadcrumb.js +12 -0
- package/dist/breadcrumb.mjs +3 -0
- package/dist/button.js +4 -4
- package/dist/button.mjs +2 -2
- package/dist/carousel.js +8 -8
- package/dist/carousel.mjs +2 -2
- package/dist/checkbox.js +5 -5
- package/dist/checkbox.mjs +2 -2
- package/dist/chip.d.mts +1 -1
- package/dist/chip.d.ts +1 -1
- package/dist/chip.js +4 -4
- package/dist/chip.mjs +2 -2
- package/dist/chunks/{chunk-5TBXVD56.js → chunk-2MC7XJSE.js} +16 -6
- package/dist/chunks/chunk-2N2EPBO4.js +120 -0
- package/dist/chunks/{chunk-BEA727LO.mjs → chunk-2RPRCWKV.mjs} +57 -26
- package/dist/chunks/chunk-2T7RUYEK.js +392 -0
- package/dist/chunks/chunk-2UPGFY6E.mjs +76 -0
- package/dist/chunks/{chunk-5I2VRWWU.js → chunk-2ZXDXO4I.js} +32 -38
- package/dist/chunks/{chunk-RLP3U52D.mjs → chunk-33UFQJIO.mjs} +22 -40
- package/dist/chunks/{chunk-AOVU67NI.mjs → chunk-3HHJORN7.mjs} +23 -25
- package/dist/chunks/{chunk-TWHDXCKR.js → chunk-3PCNRCTB.js} +8 -8
- package/dist/chunks/chunk-3ZWN66YH.js +53 -0
- package/dist/chunks/chunk-4ENXP7WH.js +224 -0
- package/dist/chunks/{chunk-YEGPB7A7.js → chunk-5JHJNN2K.js} +4 -4
- package/dist/chunks/chunk-5PQ3UCKF.js +99 -0
- package/dist/chunks/chunk-6BWOKTVQ.mjs +87 -0
- package/dist/chunks/chunk-6DBRL6NA.mjs +81 -0
- package/dist/chunks/{chunk-C3E7CSKG.mjs → chunk-6FMDO6TT.mjs} +7 -8
- package/dist/chunks/{chunk-76CY4STF.js → chunk-7G65JBTN.js} +34 -66
- package/dist/chunks/{chunk-GMIGQ5VP.mjs → chunk-ADO7PDLY.mjs} +15 -35
- package/dist/chunks/chunk-B5O6W3Z4.mjs +73 -0
- package/dist/chunks/{chunk-6FHK6CBR.js → chunk-B6G5TJRO.js} +7 -8
- package/dist/chunks/chunk-BBLBTOP4.js +205 -0
- package/dist/chunks/chunk-BJM3NDT2.mjs +368 -0
- package/dist/chunks/{chunk-5XVEYVYA.js → chunk-BLGQHR3M.js} +5 -8
- package/dist/chunks/{chunk-LVTD2UQN.mjs → chunk-BPUQ2CO2.mjs} +2 -2
- package/dist/chunks/{chunk-AWBGWBFS.js → chunk-BSZ2LN6E.js} +21 -27
- package/dist/chunks/chunk-C2DSAJTL.js +109 -0
- package/dist/chunks/{chunk-KWPIEHD2.mjs → chunk-CA3SOLI3.mjs} +1 -1
- package/dist/chunks/{chunk-MPKRXMCJ.js → chunk-CSJDDREF.js} +7 -10
- package/dist/chunks/chunk-CUTMLBC3.mjs +86 -0
- package/dist/chunks/chunk-CV4GMFWP.js +174 -0
- package/dist/chunks/{chunk-SXLMI7CZ.mjs → chunk-CWMLTXOH.mjs} +162 -234
- package/dist/chunks/chunk-CZC76ZD5.js +10 -0
- package/dist/chunks/chunk-DICN6GKE.js +99 -0
- package/dist/chunks/{chunk-TLTEUIBY.js → chunk-DLFV7ZZV.js} +4 -4
- package/dist/chunks/chunk-DO6VK2QQ.mjs +108 -0
- package/dist/chunks/chunk-DYPPVXQF.js +143 -0
- package/dist/chunks/{chunk-3CHRUKSJ.mjs → chunk-EHAUUUWB.mjs} +3 -3
- package/dist/chunks/chunk-EJY7IVSK.mjs +31 -0
- package/dist/chunks/{chunk-G4XJG7XI.js → chunk-EVOOTSY5.js} +3 -10
- package/dist/chunks/chunk-FUIBYZZ4.mjs +98 -0
- package/dist/chunks/{chunk-OGUTGD4J.mjs → chunk-GN6X27QI.mjs} +80 -41
- package/dist/chunks/{chunk-VH5FF6DZ.mjs → chunk-GX6GSWX3.mjs} +7 -7
- package/dist/chunks/chunk-H2G5FMRN.mjs +75 -0
- package/dist/chunks/chunk-H2V7RHYV.mjs +120 -0
- package/dist/chunks/{chunk-DDMZSNTG.js → chunk-HFBTS42N.js} +168 -240
- package/dist/chunks/{chunk-C6H2UNOX.js → chunk-IE4DGLMH.js} +13 -21
- package/dist/chunks/{chunk-U76LT5GE.js → chunk-IOSIQLZL.js} +2 -2
- package/dist/chunks/{chunk-ZCMKIB5U.js → chunk-J5ZKGPBY.js} +33 -41
- package/dist/chunks/{chunk-JUZHWKGS.mjs → chunk-K2TBLM3F.mjs} +6 -12
- package/dist/chunks/{chunk-FHPHDK3O.mjs → chunk-LI7SFBUQ.mjs} +4 -4
- package/dist/chunks/{chunk-7OEK2KX3.mjs → chunk-LMMON5AU.mjs} +4 -4
- package/dist/chunks/{chunk-6DZVNFVY.js → chunk-LOQXCHKL.js} +4 -12
- package/dist/chunks/{chunk-377KBJQG.js → chunk-MA2VCCIY.js} +19 -22
- package/dist/chunks/chunk-MCKOWMLS.mjs +8 -0
- package/dist/chunks/chunk-MMCA33FW.mjs +85 -0
- package/dist/chunks/{chunk-TR5JBBEA.mjs → chunk-MRRKW5QN.mjs} +31 -39
- package/dist/chunks/{chunk-76K6KXCT.js → chunk-NFIPQZ4O.js} +1 -1
- package/dist/chunks/chunk-NZHK76R3.js +109 -0
- package/dist/chunks/{chunk-I7YJB2F5.js → chunk-OMN5YQCE.js} +3 -3
- package/dist/chunks/{chunk-B7UU3FSS.mjs → chunk-P2T72N62.mjs} +4 -7
- package/dist/chunks/chunk-P3DZKXG4.js +116 -0
- package/dist/chunks/chunk-P73MEU7N.mjs +150 -0
- package/dist/chunks/chunk-PDJTSQOC.js +59 -0
- package/dist/chunks/{chunk-RXVYL4AU.js → chunk-PEIEVKD5.js} +7 -13
- package/dist/chunks/chunk-PXBZEAZQ.mjs +5 -0
- package/dist/chunks/chunk-QRNHFOLG.js +7 -0
- package/dist/chunks/{chunk-IJG7J2VU.mjs → chunk-QZ4QR3XV.mjs} +30 -36
- package/dist/chunks/{chunk-6NTASYZO.js → chunk-RS3SBY3I.js} +61 -30
- package/dist/chunks/{chunk-AKIBUO5A.mjs → chunk-RX5UKRYK.mjs} +19 -26
- package/dist/chunks/chunk-S2GMEC43.js +109 -0
- package/dist/chunks/{chunk-WJ2OVQD3.mjs → chunk-SGNRVYYQ.mjs} +19 -25
- package/dist/chunks/{chunk-IB5UCYQY.mjs → chunk-SJMCPSVH.mjs} +15 -5
- package/dist/chunks/{chunk-TXYYBJBQ.js → chunk-SUIT4XKB.js} +81 -42
- package/dist/chunks/chunk-UKRU46PH.mjs +182 -0
- package/dist/chunks/{chunk-WNFJ4NJN.mjs → chunk-ULGYTBCT.mjs} +3 -11
- package/dist/chunks/{chunk-LBKBCI2K.mjs → chunk-VIGRCJAE.mjs} +3 -10
- package/dist/chunks/chunk-VVXQZ4XH.mjs +93 -0
- package/dist/chunks/{chunk-Z7OKV6NW.mjs → chunk-W4GG5A7K.mjs} +12 -20
- package/dist/chunks/chunk-WGGBE4ZD.mjs +201 -0
- package/dist/chunks/{chunk-WSWD5ZUJ.js → chunk-WKCXACMZ.js} +20 -27
- package/dist/chunks/{chunk-GSLIY6WW.js → chunk-X2SHTVZQ.js} +17 -37
- package/dist/chunks/chunk-X3CTJ7TD.js +108 -0
- package/dist/chunks/{chunk-U6KOUYWX.mjs → chunk-XG6QG65W.mjs} +7 -10
- package/dist/chunks/chunk-XGIJZ3NZ.js +160 -0
- package/dist/chunks/chunk-YB5ZKHVB.js +64 -0
- package/dist/chunks/{chunk-Q7H6LCNN.js → chunk-YCG4FZC3.js} +23 -25
- package/dist/chunks/{chunk-JZ3PWHKS.mjs → chunk-YLO4UKSC.mjs} +18 -21
- package/dist/chunks/chunk-YO5MSDPX.mjs +36 -0
- package/dist/chunks/{chunk-Q2TMXHPK.js → chunk-YZV6FWE7.js} +25 -43
- package/dist/chunks/chunk-ZI4LN2B2.js +96 -0
- package/dist/chunks/chunk-ZU4AWAFT.mjs +137 -0
- package/dist/chunks/chunk-ZWSIIGA3.mjs +58 -0
- package/dist/countdown.js +4 -4
- package/dist/countdown.mjs +2 -2
- package/dist/counter.js +2 -2
- package/dist/counter.mjs +1 -1
- package/dist/data-list.js +5 -5
- package/dist/data-list.mjs +4 -4
- package/dist/date-picker.d.mts +17 -0
- package/dist/date-picker.d.ts +17 -0
- package/dist/date-picker.js +12 -0
- package/dist/date-picker.mjs +3 -0
- package/dist/divider.js +4 -4
- package/dist/divider.mjs +2 -2
- package/dist/drawer.d.mts +1 -1
- package/dist/drawer.d.ts +1 -1
- package/dist/drawer.js +11 -11
- package/dist/drawer.mjs +2 -2
- package/dist/dropdown-menu.d.mts +30 -0
- package/dist/dropdown-menu.d.ts +30 -0
- package/dist/dropdown-menu.js +32 -0
- package/dist/dropdown-menu.mjs +3 -0
- package/dist/ellipsis.js +3 -3
- package/dist/ellipsis.mjs +2 -2
- package/dist/empty-state.d.mts +16 -0
- package/dist/empty-state.d.ts +16 -0
- package/dist/empty-state.js +16 -0
- package/dist/empty-state.mjs +3 -0
- package/dist/error-boundary.d.mts +1 -1
- package/dist/error-boundary.d.ts +1 -1
- package/dist/error-boundary.js +2 -2
- package/dist/error-boundary.mjs +1 -1
- package/dist/index.d.mts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +321 -200
- package/dist/index.mjs +48 -35
- package/dist/infinite-scroll.js +3 -3
- package/dist/infinite-scroll.mjs +2 -2
- package/dist/marquee.js +3 -3
- package/dist/marquee.mjs +2 -2
- package/dist/modal/index.js +13 -13
- package/dist/modal/index.mjs +4 -4
- package/dist/number-input.d.mts +5 -6
- package/dist/number-input.d.ts +5 -6
- package/dist/number-input.js +5 -5
- package/dist/number-input.mjs +2 -2
- package/dist/nx-image.d.mts +13 -0
- package/dist/nx-image.d.ts +13 -0
- package/dist/nx-image.js +12 -0
- package/dist/nx-image.mjs +3 -0
- package/dist/pagination.d.mts +1 -0
- package/dist/pagination.d.ts +1 -0
- package/dist/pagination.js +5 -5
- package/dist/pagination.mjs +2 -2
- package/dist/popover.d.mts +1 -1
- package/dist/popover.d.ts +1 -1
- package/dist/popover.js +8 -8
- package/dist/popover.mjs +2 -2
- package/dist/price-input.d.mts +36 -0
- package/dist/price-input.d.ts +36 -0
- package/dist/price-input.js +16 -0
- package/dist/price-input.mjs +3 -0
- package/dist/progress.d.mts +18 -0
- package/dist/progress.d.ts +18 -0
- package/dist/progress.js +16 -0
- package/dist/progress.mjs +3 -0
- package/dist/radio-group.js +6 -6
- package/dist/radio-group.mjs +2 -2
- package/dist/schemas/_all.json +2441 -470
- package/dist/schemas/accordion.json +14 -11
- package/dist/schemas/alert.json +49 -0
- package/dist/schemas/avatar.json +13 -7
- package/dist/schemas/badge.json +76 -0
- package/dist/schemas/breadcrumb.json +47 -0
- package/dist/schemas/button.json +27 -9
- package/dist/schemas/carousel.json +10 -4
- package/dist/schemas/carouselButton.json +20 -0
- package/dist/schemas/carouselDots.json +17 -0
- package/dist/schemas/carouselSlide.json +20 -0
- package/dist/schemas/checkBox.json +33 -8
- package/dist/schemas/chip.json +15 -6
- package/dist/schemas/clientOnly.json +19 -0
- package/dist/schemas/countdown.json +10 -7
- package/dist/schemas/counter.json +15 -9
- package/dist/schemas/dataList.json +10 -10
- package/dist/schemas/datePicker.json +56 -0
- package/dist/schemas/divider.json +8 -5
- package/dist/schemas/drawer.json +24 -2
- package/dist/schemas/drawerClose.json +24 -0
- package/dist/schemas/drawerContent.json +9 -6
- package/dist/schemas/drawerDescription.json +20 -0
- package/dist/schemas/drawerTitle.json +20 -0
- package/dist/schemas/drawerTrigger.json +24 -0
- package/dist/schemas/dropdownMenu.json +83 -0
- package/dist/schemas/ellipsis.json +17 -7
- package/dist/schemas/emptyState.json +44 -0
- package/dist/schemas/errorBoundary.json +22 -0
- package/dist/schemas/infiniteScroll.json +18 -9
- package/dist/schemas/marquee.json +12 -6
- package/dist/schemas/modalCall.json +81 -3
- package/dist/schemas/modalTemplate.json +67 -14
- package/dist/schemas/numberInput.json +64 -15
- package/dist/schemas/nxImage.json +56 -0
- package/dist/schemas/pagination.json +13 -6
- package/dist/schemas/popover.json +18 -9
- package/dist/schemas/priceInput.json +104 -0
- package/dist/schemas/progress.json +63 -0
- package/dist/schemas/radioGroup.json +19 -9
- package/dist/schemas/radioItem.json +12 -5
- package/dist/schemas/select.json +15 -9
- package/dist/schemas/selectItem.json +7 -4
- package/dist/schemas/skeleton.json +12 -6
- package/dist/schemas/slider.json +78 -0
- package/dist/schemas/spinner.json +11 -4
- package/dist/schemas/stepper.json +73 -0
- package/dist/schemas/switch.json +23 -5
- package/dist/schemas/tab.json +17 -14
- package/dist/schemas/table.json +75 -0
- package/dist/schemas/tableRow.json +32 -0
- package/dist/schemas/tagInput.json +70 -0
- package/dist/schemas/tdColumn.json +107 -0
- package/dist/schemas/textArea.json +72 -7
- package/dist/schemas/textInput.json +72 -10
- package/dist/schemas/themeProvider.json +65 -0
- package/dist/schemas/toastOptions.json +81 -0
- package/dist/schemas/toaster.json +76 -0
- package/dist/schemas/toggleGroup.json +88 -0
- package/dist/schemas/tooltip.json +12 -9
- package/dist/schemas/virtualGrid.json +22 -11
- package/dist/schemas/virtualList.json +14 -8
- package/dist/schemas.d.mts +1372 -81
- package/dist/schemas.d.ts +1372 -81
- package/dist/schemas.js +731 -273
- package/dist/schemas.mjs +704 -273
- package/dist/select.js +6 -6
- package/dist/select.mjs +2 -2
- package/dist/skeleton.js +3 -3
- package/dist/skeleton.mjs +2 -2
- package/dist/slider.d.mts +20 -0
- package/dist/slider.d.ts +20 -0
- package/dist/slider.js +16 -0
- package/dist/slider.mjs +3 -0
- package/dist/spinner.js +3 -3
- package/dist/spinner.mjs +2 -2
- package/dist/stepper.d.mts +20 -0
- package/dist/stepper.d.ts +20 -0
- package/dist/stepper.js +16 -0
- package/dist/stepper.mjs +3 -0
- package/dist/styles/layer.d.mts +3 -0
- package/dist/styles/layer.d.ts +3 -0
- package/dist/styles/layer.js +18 -0
- package/dist/styles/layer.mjs +16 -0
- package/dist/styles.css +3999 -2
- package/dist/styles.js +2 -5
- package/dist/styles.layered.css +4002 -0
- package/dist/styles.mjs +1 -4
- package/dist/switch.js +4 -4
- package/dist/switch.mjs +2 -2
- package/dist/tab.js +5 -5
- package/dist/tab.mjs +2 -2
- package/dist/table.d.mts +40 -25
- package/dist/table.d.ts +40 -25
- package/dist/table.js +9 -9
- package/dist/table.mjs +3 -3
- package/dist/tag-input.d.mts +21 -0
- package/dist/tag-input.d.ts +21 -0
- package/dist/tag-input.js +16 -0
- package/dist/tag-input.mjs +3 -0
- package/dist/text-area.d.mts +5 -1
- package/dist/text-area.d.ts +5 -1
- package/dist/text-area.js +4 -4
- package/dist/text-area.mjs +2 -2
- package/dist/text-input.d.mts +5 -1
- package/dist/text-input.d.ts +5 -1
- package/dist/text-input.js +4 -4
- package/dist/text-input.mjs +2 -2
- package/dist/toast.js +5 -5
- package/dist/toast.mjs +2 -2
- package/dist/toggle-group.d.mts +36 -0
- package/dist/toggle-group.d.ts +36 -0
- package/dist/toggle-group.js +16 -0
- package/dist/toggle-group.mjs +3 -0
- package/dist/tooltip.js +5 -5
- package/dist/tooltip.mjs +2 -2
- package/dist/utils/cn.d.mts +0 -10
- package/dist/utils/cn.d.ts +0 -10
- package/dist/utils/cn.js +2 -2
- package/dist/utils/cn.mjs +1 -1
- package/dist/virtual-scroll.js +4 -4
- package/dist/virtual-scroll.mjs +2 -2
- package/package.json +90 -19
- package/scripts/setup-cursor-rules.cjs +20 -6
- package/dist/chunks/chunk-7MT3QYE6.js +0 -92
- package/dist/chunks/chunk-FA2OPP3U.mjs +0 -140
- package/dist/chunks/chunk-FKZI2HTI.js +0 -104
- package/dist/chunks/chunk-GQP7IXH2.mjs +0 -251
- package/dist/chunks/chunk-NCQDOPBR.mjs +0 -86
- package/dist/chunks/chunk-NTN55ZIX.mjs +0 -113
- package/dist/chunks/chunk-Q7GQVAYY.js +0 -88
- package/dist/chunks/chunk-QJNQCLMV.js +0 -25
- package/dist/chunks/chunk-UDQXLI5Y.mjs +0 -81
- package/dist/chunks/chunk-UR6JOKVB.mjs +0 -65
- package/dist/chunks/chunk-WVIEIRK2.js +0 -136
- package/dist/chunks/chunk-XALPBGSC.mjs +0 -23
- package/dist/chunks/chunk-ZINDMFOI.js +0 -275
- package/dist/schemas/typography.json +0 -70
- package/dist/typography.d.mts +0 -19
- package/dist/typography.d.ts +0 -19
- package/dist/typography.js +0 -102
- package/dist/typography.mjs +0 -79
package/DESIGN.md
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# NEXUS Design System
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This document defines the visual identity and design principles for projects using `@nexus-cross/design-system`. AI agents should read this file to generate consistent, on-brand UI across the entire project.
|
|
6
|
+
|
|
7
|
+
## Visual Theme & Atmosphere
|
|
8
|
+
|
|
9
|
+
The interface prioritizes **clarity, density, and efficiency**. It targets professional data-driven applications — trading platforms, dashboards, and enterprise tools — where information density matters but readability must not be sacrificed.
|
|
10
|
+
|
|
11
|
+
Design philosophy:
|
|
12
|
+
- **Functional minimalism**: Every visual element serves a purpose. No decorative flourishes.
|
|
13
|
+
- **High contrast hierarchy**: Clear distinction between primary, secondary, and tertiary information.
|
|
14
|
+
- **Calm neutrals with intentional accent**: The UI stays quiet until interaction or status demands attention.
|
|
15
|
+
- **Dark-mode first**: Designed for prolonged screen use. Light mode is equally supported but dark mode is the primary context.
|
|
16
|
+
|
|
17
|
+
## Color Palette & Roles
|
|
18
|
+
|
|
19
|
+
### Background layers (depth ordering)
|
|
20
|
+
|
|
21
|
+
| Token | Role | Light | Dark |
|
|
22
|
+
|---|---|---|---|
|
|
23
|
+
| `bg-default` | Page-level background | `#FFFFFF` | `#1E232E` |
|
|
24
|
+
| `bg-subtle` | Recessed areas, sidebar backgrounds | `#F3F6F8` | `#161A21` |
|
|
25
|
+
| `bg-strong` | Maximum depth contrast | `#ECF0F2` | `#000000` |
|
|
26
|
+
|
|
27
|
+
### Surface layers (interactive containers)
|
|
28
|
+
|
|
29
|
+
| Token | Role | Light | Dark |
|
|
30
|
+
|---|---|---|---|
|
|
31
|
+
| `surface-default` | Cards, panels, modals | `#FFFFFF` | `#1E232E` |
|
|
32
|
+
| `surface-subtle` | Secondary panels, nested containers | `#F3F6F8` | `#252B39` |
|
|
33
|
+
| `surface-strong` | Emphasized containers, active sections | `#ECF0F2` | `#363B4C` |
|
|
34
|
+
| `surface-inverted` | High-contrast banners, tooltips | `#161A21` | `#F3F6F8` |
|
|
35
|
+
|
|
36
|
+
**Rule**: Always layer surfaces in order: `bg` → `surface-default` → `surface-subtle`. Never place `surface-subtle` directly on `bg-default` — use `surface-default` as an intermediate layer.
|
|
37
|
+
|
|
38
|
+
### Text hierarchy
|
|
39
|
+
|
|
40
|
+
| Token | Role | When to use |
|
|
41
|
+
|---|---|---|
|
|
42
|
+
| `text-highlight` | Maximum emphasis | Titles, critical numbers, hero stats |
|
|
43
|
+
| `text-primary` | Default readable text | Body text, labels, headings |
|
|
44
|
+
| `text-secondary` | Supporting information | Descriptions, helper text, timestamps |
|
|
45
|
+
| `text-tertiary` | De-emphasized content | Placeholders, disabled labels |
|
|
46
|
+
| `text-muted` | Lowest priority | Watermarks, footnotes |
|
|
47
|
+
|
|
48
|
+
**Rule**: Never use `text-muted` for any content the user needs to read. It exists only for decorative or supplementary text.
|
|
49
|
+
|
|
50
|
+
### Accent colors
|
|
51
|
+
|
|
52
|
+
| Token | Role |
|
|
53
|
+
|---|---|
|
|
54
|
+
| `accent-primary` (teal/green) | Primary CTA, links, active states, brand identity |
|
|
55
|
+
| `accent-secondary` (purple) | Secondary actions, premium features, alternate highlights |
|
|
56
|
+
|
|
57
|
+
**Rule**: Use `accent-primary` for the single most important action on screen. If there are multiple CTAs, only ONE gets `accent-primary` — the rest use `outline` or `ghost` variants.
|
|
58
|
+
|
|
59
|
+
### Status colors
|
|
60
|
+
|
|
61
|
+
| Token | Role | Usage context |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| `status-success` | Positive outcomes | Completed actions, profit, online status |
|
|
64
|
+
| `status-warning` | Caution needed | Expiring items, approaching limits |
|
|
65
|
+
| `status-danger` | Errors or destructive | Failed actions, losses, delete confirmations |
|
|
66
|
+
| `status-info` | Neutral information | Tips, update notices, general alerts |
|
|
67
|
+
|
|
68
|
+
**Rule**: Status colors should only appear in context — on alerts, badges, inline messages, or status indicators. Never use status colors for decorative purposes or general theming.
|
|
69
|
+
|
|
70
|
+
## Typography Rules
|
|
71
|
+
|
|
72
|
+
- **Font**: System font stack (inherits from the consuming project).
|
|
73
|
+
- **Scale**: 8 levels from `text-xs` (0.75rem) to `text-xl` (1.25rem) for body, plus heading scale `h7`–`h1` and display `sm`–`lg`.
|
|
74
|
+
- **Weight system**: Regular (400) for body, Medium (500) for labels, Semi-bold (600) for headings, Bold (700) for display and h1–h2.
|
|
75
|
+
- **Letter spacing**: `-0.01em` for body text (tighter for readability at small sizes), `0` for headings and labels.
|
|
76
|
+
- **Line height**: Built into each typography token — do not override.
|
|
77
|
+
|
|
78
|
+
**Rule**: Use typography tokens (`text-text-sm`, `text-heading-h4`, etc.) instead of raw Tailwind sizes. The tokens include coordinated font-size, font-weight, line-height, and letter-spacing.
|
|
79
|
+
|
|
80
|
+
## Spacing & Layout
|
|
81
|
+
|
|
82
|
+
### Spacing scale
|
|
83
|
+
|
|
84
|
+
- **Padding**: `none` (0), `2xs` (4px), `xs` (8px), `sm` (12px), `md` (16px), `lg` (24px), `xl` (32px), `2xl` (40px)
|
|
85
|
+
- **Gap**: `none` (0), `xs` (4px), `sm` (8px), `md` (16px), `lg` (24px), `xl` (32px)
|
|
86
|
+
|
|
87
|
+
### Control sizes
|
|
88
|
+
|
|
89
|
+
| Size | Height | Use case |
|
|
90
|
+
|---|---|---|
|
|
91
|
+
| `xs` | 24px | Compact tables, inline actions |
|
|
92
|
+
| `sm` | 32px | Secondary actions, filters |
|
|
93
|
+
| `md` | 40px | Default inputs, buttons |
|
|
94
|
+
| `lg` | 48px | Primary CTAs, prominent inputs |
|
|
95
|
+
|
|
96
|
+
### Border radius
|
|
97
|
+
|
|
98
|
+
| Token | Value | Use case |
|
|
99
|
+
|---|---|---|
|
|
100
|
+
| `corner-none` | 0px | Tables, full-width elements |
|
|
101
|
+
| `corner-sm` | 4px | Chips, badges, small elements |
|
|
102
|
+
| `corner-md` | 8px | Buttons, inputs, cards (default) |
|
|
103
|
+
| `corner-lg` | 12px | Modals, large cards |
|
|
104
|
+
| `corner-xl` | 16px | Hero sections, featured cards |
|
|
105
|
+
| `corner-full` | 9999px | Avatars, pills, circular buttons |
|
|
106
|
+
|
|
107
|
+
**Rule**: Be consistent within a feature. If a card uses `corner-md`, its internal buttons should also use `corner-md` or smaller — never larger than their container.
|
|
108
|
+
|
|
109
|
+
### Breakpoints
|
|
110
|
+
|
|
111
|
+
| Token | Value | Context |
|
|
112
|
+
|---|---|---|
|
|
113
|
+
| `screen-xs` | 320px | Small mobile |
|
|
114
|
+
| `screen-sm` | 640px | Mobile |
|
|
115
|
+
| `screen-md` | 768px | Tablet |
|
|
116
|
+
| `screen-lg` | 1024px | Desktop |
|
|
117
|
+
| `screen-xl` | 1280px | Wide desktop |
|
|
118
|
+
| `screen-2xl` | 1440px | Ultra-wide |
|
|
119
|
+
|
|
120
|
+
## Component Styling Principles
|
|
121
|
+
|
|
122
|
+
- **Buttons**: `corner-md` (8px) radius by default. Primary actions use `accent-primary` fill with white text. Ghost and outline variants for secondary actions.
|
|
123
|
+
- **Inputs**: `corner-md` radius, `border-default` border, `surface-default` background. Focus state uses `accent-primary` ring.
|
|
124
|
+
- **Cards/Panels**: `surface-default` background, `border-default` border (1px), `corner-md` or `corner-lg` radius. No drop shadows by default — use `shadow-sm` only on hover or elevated contexts.
|
|
125
|
+
- **Modals/Drawers**: `surface-default` background, `corner-lg` radius on visible corners. Overlay uses `opacity-overlay-dim` (0.5).
|
|
126
|
+
- **Chips/Tags**: `corner-sm` (4px) radius, compact padding. Use semantic variants (`accent`, `success`, `danger`) to convey meaning.
|
|
127
|
+
- **Tables**: No border-radius on the table itself. Use `surface-subtle` for alternating rows or header background. `border-default` for cell dividers.
|
|
128
|
+
|
|
129
|
+
## Elevation & Shadows
|
|
130
|
+
|
|
131
|
+
| Token | Value | Use case |
|
|
132
|
+
|---|---|---|
|
|
133
|
+
| `shadow-none` | `none` | Default state for most elements |
|
|
134
|
+
| `shadow-sm` | `0 1px 2px 0 rgb(0 0 0 / 0.12)` | Hover states, subtle lift |
|
|
135
|
+
| `shadow-md` | `0 1px 3px 0 rgb(0 0 0 / 0.12)` | Dropdown menus, popovers |
|
|
136
|
+
| `shadow-lg` | `0 2px 8px -1px rgb(0 0 0 / 0.12)` | Modals, drawers |
|
|
137
|
+
| `shadow-xl` | `0 4px 15px -3px rgb(0 0 0 / 0.12)` | Toast notifications |
|
|
138
|
+
|
|
139
|
+
**Rule**: Prefer borders over shadows for static elements. Shadows should imply interactivity or overlay behavior. A card sitting on a page uses a border, not a shadow.
|
|
140
|
+
|
|
141
|
+
## Animation & Motion
|
|
142
|
+
|
|
143
|
+
- **Transitions**: 150ms (fast), 200ms (normal), 300ms (slow). Use `cubic-bezier(0, 0, 0.2, 1)` (ease-out) for most transitions.
|
|
144
|
+
- **Enter animations**: 200ms with ease-out. Elements enter from the direction they were triggered (dropdown from top, drawer from side).
|
|
145
|
+
- **Exit animations**: 150ms with `cubic-bezier(0.4, 0, 1, 1)` (ease-in). Exits are faster than enters.
|
|
146
|
+
|
|
147
|
+
**Rule**: Only animate properties that benefit the user's understanding of state change (opacity, transform). Never animate color or background-color on large surfaces — it feels sluggish.
|
|
148
|
+
|
|
149
|
+
## Do's and Don'ts
|
|
150
|
+
|
|
151
|
+
### Colors
|
|
152
|
+
|
|
153
|
+
- **Do** use semantic token names (`bg-surface-default`, `text-text-primary`), not raw hex values.
|
|
154
|
+
- **Do** use `accent-primary` sparingly — one primary CTA per visible area.
|
|
155
|
+
- **Don't** use `status-danger` red for non-error purposes (e.g., decorative highlights).
|
|
156
|
+
- **Don't** mix `text-muted` with `bg-subtle` — the contrast ratio is too low for accessibility.
|
|
157
|
+
- **Don't** override dark mode colors manually. The token system handles light/dark switching automatically.
|
|
158
|
+
|
|
159
|
+
### Typography
|
|
160
|
+
|
|
161
|
+
- **Do** use the typography token scale. Every text element should map to a token.
|
|
162
|
+
- **Don't** use more than 3 different text sizes in a single card or section.
|
|
163
|
+
- **Don't** use `font-bold` (700) for body text. Bold is reserved for headings and display text.
|
|
164
|
+
|
|
165
|
+
### Layout
|
|
166
|
+
|
|
167
|
+
- **Do** use the spacing scale tokens for all padding, margin, and gap values.
|
|
168
|
+
- **Do** maintain consistent spacing within a component: if padding-x is `md`, padding-y should be `sm` or `md`, not `2xs`.
|
|
169
|
+
- **Don't** use arbitrary pixel values (e.g., `p-[13px]`). Snap to the nearest spacing token.
|
|
170
|
+
- **Don't** nest more than 3 surface layers deep. If you need more depth, reconsider the information architecture.
|
|
171
|
+
|
|
172
|
+
### Components
|
|
173
|
+
|
|
174
|
+
- **Do** use `@nexus-cross/design-system` components for any matching UI element. Never re-implement buttons, inputs, modals, etc.
|
|
175
|
+
- **Do** use `className` prop for style overrides. The `cn()` utility resolves prefix conflicts automatically.
|
|
176
|
+
- **Don't** use `!important` in className overrides — it's unnecessary and breaks the override system.
|
|
177
|
+
- **Don't** wrap design system components in extra `<div>` elements for styling. Use `className` directly.
|
|
178
|
+
- **Don't** import Radix UI, Headless UI, or similar libraries to build components that already exist in the design system.
|
|
179
|
+
|
|
180
|
+
### Interaction States
|
|
181
|
+
|
|
182
|
+
- **Do** provide visual feedback for all interactive elements: hover, focus, active, disabled.
|
|
183
|
+
- **Do** use `focus-visible` outlines (not `focus`) to avoid showing focus rings on click.
|
|
184
|
+
- **Don't** remove focus indicators entirely — they are required for keyboard accessibility.
|
|
185
|
+
- **Don't** use `opacity` below `0.4` for disabled states — it becomes invisible in some contexts.
|
|
@@ -1,108 +1,130 @@
|
|
|
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
|
-
|
|
19
|
-
- `bg-bg-default`, `text-text-primary`, `border-border-default` 등
|
|
20
|
-
- `#ffffff`, `#000000`, `rgb()` 등 직접 색상값 사용 금지
|
|
21
|
-
- 참고: `.cursor/rules/nexus-tokens.mdc`
|
|
18
|
+
Choose one of two CSS entry points depending on the project environment:
|
|
22
19
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
| Environment | import | Description |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| Tailwind v3 / Plain CSS / CSS Modules | `@nexus-cross/design-system/styles` | unlayered CSS |
|
|
23
|
+
| Tailwind v4 | `@nexus-cross/design-system/styles/layer` | wrapped in `@layer nexus` |
|
|
27
24
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
```tsx
|
|
26
|
+
// Tailwind v3, Plain CSS, CSS Modules
|
|
27
|
+
import '@nexus-cross/design-system/styles'
|
|
28
|
+
|
|
29
|
+
// Tailwind v4
|
|
30
|
+
import '@nexus-cross/design-system/styles/layer'
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
For Tailwind v4 projects, also declare layer order in `globals.css`:
|
|
34
|
+
```css
|
|
35
|
+
@layer base, nexus, components, utilities;
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Absolute Rules
|
|
39
|
+
|
|
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
|
+
|
|
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
|
+
|
|
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
|
|
34
56
|
|
|
35
|
-
## Figma MCP → NEXUS
|
|
57
|
+
## Figma MCP → NEXUS Conversion Workflow
|
|
36
58
|
|
|
37
|
-
**Figma MCP
|
|
38
|
-
Figma MCP
|
|
39
|
-
**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.**
|
|
40
62
|
|
|
41
|
-
###
|
|
63
|
+
### Mandatory 3-Step Workflow
|
|
42
64
|
|
|
43
|
-
**1
|
|
44
|
-
- `get_design_context
|
|
45
|
-
- `get_screenshot
|
|
46
|
-
-
|
|
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**
|
|
47
69
|
|
|
48
|
-
**2
|
|
49
|
-
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.**
|
|
50
72
|
|
|
51
73
|
```
|
|
52
|
-
MCP
|
|
53
|
-
- <button>
|
|
54
|
-
- <input type="text">
|
|
55
|
-
- <select>
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
-
|
|
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)
|
|
59
81
|
```
|
|
60
82
|
|
|
61
|
-
**3
|
|
62
|
-
|
|
83
|
+
**Step 3: NEXUS Code Generation**
|
|
84
|
+
Write code based on the mapping. Do NOT reference MCP output code at this stage.
|
|
63
85
|
|
|
64
|
-
###
|
|
86
|
+
### Component Conversion Table
|
|
65
87
|
|
|
66
|
-
| MCP
|
|
88
|
+
| MCP Output (Native HTML) | → NEXUS Component |
|
|
67
89
|
|---|---|
|
|
68
|
-
| `<button>`, `<a>`
|
|
69
|
-
| `<input type="text">` | `<TextInput>` (prefixIcon, suffixIcon
|
|
70
|
-
| `<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) |
|
|
71
93
|
| `<input type="number">` | `<NumberInput>` |
|
|
72
94
|
| `<select>` | `<Select>` + `<SelectItem>` |
|
|
73
95
|
| `<input type="checkbox">` | `<CheckBox>` |
|
|
74
96
|
| `<input type="radio">` | `<RadioGroup>` + `<RadioItem>` |
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
|
|
|
78
|
-
|
|
|
79
|
-
|
|
|
80
|
-
|
|
|
81
|
-
|
|
|
82
|
-
|
|
|
83
|
-
|
|
|
84
|
-
|
|
|
85
|
-
|
|
|
86
|
-
|
|
|
87
|
-
|
|
|
88
|
-
|
|
|
89
|
-
|
|
|
90
|
-
|
|
|
91
|
-
|
|
|
92
|
-
|
|
|
93
|
-
|
|
|
94
|
-
|
|
|
95
|
-
|
|
|
96
|
-
|
|
|
97
|
-
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
###
|
|
102
|
-
|
|
103
|
-
MCP
|
|
104
|
-
|
|
105
|
-
| 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 |
|
|
106
128
|
|---|---|
|
|
107
129
|
| `#FFFFFF`, `bg-white` | `bg-bg-default` |
|
|
108
130
|
| `#F3F6F8`, `bg-gray-50` | `bg-bg-subtle` |
|
|
@@ -117,59 +139,59 @@ MCP가 출력하는 색상값을 NEXUS 토큰으로 변환한다:
|
|
|
117
139
|
| `#FF9D00`, `bg-amber-*` | `bg-status-warning` |
|
|
118
140
|
| `#0095FF`, `bg-blue-*` | `bg-status-info` |
|
|
119
141
|
|
|
120
|
-
|
|
121
|
-
|
|
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.).**
|
|
122
144
|
|
|
123
|
-
### Button
|
|
145
|
+
### Button Variant Decision Criteria
|
|
124
146
|
|
|
125
|
-
|
|
147
|
+
Determine the variant based on visual style in Figma:
|
|
126
148
|
|
|
127
|
-
| Figma
|
|
149
|
+
| Figma Visual Characteristic | → variant |
|
|
128
150
|
|---|---|
|
|
129
|
-
|
|
|
130
|
-
|
|
|
131
|
-
|
|
|
132
|
-
|
|
|
133
|
-
|
|
|
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"` |
|
|
134
156
|
|
|
135
|
-
###
|
|
157
|
+
### Self-Verification Checklist
|
|
136
158
|
|
|
137
|
-
|
|
159
|
+
Verify the following before outputting code:
|
|
138
160
|
|
|
139
|
-
- [ ] `<button>`, `<input>`, `<select>`, `<textarea
|
|
140
|
-
- [ ] hex
|
|
141
|
-
- [ ] Tailwind
|
|
142
|
-
- [ ]
|
|
143
|
-
- [ ]
|
|
144
|
-
- [ ]
|
|
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?
|
|
145
167
|
|
|
146
|
-
|
|
168
|
+
**If any check fails, fix the code before outputting.**
|
|
147
169
|
|
|
148
170
|
```tsx
|
|
149
|
-
//
|
|
150
|
-
<button className="bg-[#09B498] text-white px-4 py-2 rounded-lg"
|
|
151
|
-
<input className="border border-[#C6D0DA] px-3 py-2 rounded" placeholder="
|
|
152
|
-
<div className="w-8 h-8 rounded-full bg-gray-200" /> {/*
|
|
153
|
-
<hr className="border-[#ECF0F2]" /> {/*
|
|
154
|
-
|
|
155
|
-
//
|
|
156
|
-
<Button variant="primary"
|
|
157
|
-
<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 />} />
|
|
158
180
|
<Avatar fallback="JD" size="sm" />
|
|
159
181
|
<Divider />
|
|
160
182
|
```
|
|
161
183
|
|
|
162
|
-
##
|
|
184
|
+
## Global Setup (Required at App Root)
|
|
163
185
|
|
|
164
|
-
|
|
186
|
+
The following components MUST be placed at the app root (layout.tsx or App.tsx).
|
|
165
187
|
|
|
166
|
-
|
|
|
167
|
-
|
|
168
|
-
| `<ModalContainer />` | `@nexus-cross/design-system/modal` | `modal()`
|
|
169
|
-
| `<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 |
|
|
170
192
|
|
|
171
193
|
```tsx
|
|
172
|
-
// layout.tsx
|
|
194
|
+
// layout.tsx or App.tsx
|
|
173
195
|
import { ModalContainer } from '@nexus-cross/design-system/modal';
|
|
174
196
|
import { Toaster } from '@nexus-cross/design-system';
|
|
175
197
|
|
|
@@ -184,87 +206,87 @@ export default function RootLayout({ children }) {
|
|
|
184
206
|
}
|
|
185
207
|
```
|
|
186
208
|
|
|
187
|
-
|
|
188
|
-
- Tooltip (
|
|
189
|
-
- 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
|
|
190
212
|
|
|
191
|
-
## Import
|
|
213
|
+
## Import Patterns
|
|
192
214
|
|
|
193
215
|
```tsx
|
|
194
|
-
//
|
|
216
|
+
// General components
|
|
195
217
|
import { Button, TextInput, TextArea, Select, Switch, Chip, Spinner, Divider } from '@nexus-cross/design-system';
|
|
196
218
|
|
|
197
|
-
//
|
|
219
|
+
// Overlay components
|
|
198
220
|
import { Tooltip, Popover, Drawer, Accordion } from '@nexus-cross/design-system';
|
|
199
221
|
|
|
200
|
-
//
|
|
222
|
+
// Toast
|
|
201
223
|
import { toast, Toaster } from '@nexus-cross/design-system';
|
|
202
224
|
|
|
203
|
-
//
|
|
225
|
+
// Modal system (separate subpath)
|
|
204
226
|
import { modal, useModal, ModalTemplate, ModalContainer } from '@nexus-cross/design-system/modal';
|
|
205
227
|
|
|
206
|
-
//
|
|
228
|
+
// Tokens (only when JS API is needed)
|
|
207
229
|
import { getTheme } from '@nexus-cross/tokens';
|
|
208
230
|
```
|
|
209
231
|
|
|
210
|
-
##
|
|
232
|
+
## Modal Writing Rules
|
|
211
233
|
|
|
212
|
-
|
|
234
|
+
Modal components **MUST be wrapped with `ModalTemplate`.** Do NOT create modals with plain `<div>`.
|
|
213
235
|
|
|
214
236
|
```tsx
|
|
215
|
-
//
|
|
237
|
+
// CORRECT modal
|
|
216
238
|
import { ModalTemplate } from '@nexus-cross/design-system/modal';
|
|
217
239
|
|
|
218
240
|
function MyModal({ close, resolve }: { close: () => void; resolve: (value: any) => void }) {
|
|
219
241
|
return (
|
|
220
|
-
<ModalTemplate title="
|
|
221
|
-
<p className="text-text-secondary"
|
|
222
|
-
<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>
|
|
223
245
|
</ModalTemplate>
|
|
224
246
|
);
|
|
225
247
|
}
|
|
226
248
|
|
|
227
|
-
//
|
|
249
|
+
// Call
|
|
228
250
|
const result = await modal({ component: MyModal });
|
|
229
251
|
```
|
|
230
252
|
|
|
231
253
|
```tsx
|
|
232
|
-
//
|
|
254
|
+
// WRONG modal — using div without ModalTemplate
|
|
233
255
|
function MyModal({ close }: { close: () => void }) {
|
|
234
256
|
return (
|
|
235
257
|
<div className="p-6 bg-white rounded-lg">
|
|
236
|
-
<h2
|
|
237
|
-
<p
|
|
258
|
+
<h2>Title</h2>
|
|
259
|
+
<p>Content</p>
|
|
238
260
|
</div>
|
|
239
261
|
);
|
|
240
262
|
}
|
|
241
263
|
```
|
|
242
264
|
|
|
243
|
-
##
|
|
265
|
+
## Toast Usage Rules
|
|
244
266
|
|
|
245
267
|
```tsx
|
|
246
268
|
import { toast } from '@nexus-cross/design-system';
|
|
247
269
|
|
|
248
|
-
toast('
|
|
249
|
-
toast.success('
|
|
250
|
-
toast.error('
|
|
251
|
-
toast.loading('
|
|
270
|
+
toast('Default message');
|
|
271
|
+
toast.success('Success!');
|
|
272
|
+
toast.error('An error occurred');
|
|
273
|
+
toast.loading('Processing...');
|
|
252
274
|
```
|
|
253
275
|
|
|
254
|
-
|
|
276
|
+
Calling `toast()` without `<Toaster />` at the root will display nothing.
|
|
255
277
|
|
|
256
|
-
##
|
|
278
|
+
## Token Usage Examples
|
|
257
279
|
|
|
258
280
|
```tsx
|
|
259
|
-
//
|
|
281
|
+
// CORRECT usage
|
|
260
282
|
<div className="bg-bg-default text-text-primary border border-border-default">
|
|
261
|
-
<Button variant="primary"
|
|
262
|
-
<TextInput placeholder="
|
|
283
|
+
<Button variant="primary">Confirm</Button>
|
|
284
|
+
<TextInput placeholder="Search..." />
|
|
263
285
|
</div>
|
|
264
286
|
|
|
265
|
-
//
|
|
287
|
+
// WRONG usage
|
|
266
288
|
<div className="bg-white text-gray-900 border border-gray-200">
|
|
267
|
-
<button className="bg-green-500 text-white px-4 py-2 rounded"
|
|
268
|
-
<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..." />
|
|
269
291
|
</div>
|
|
270
292
|
```
|