@nexus-cross/design-system 1.0.12 → 1.0.14

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.
@@ -0,0 +1,80 @@
1
+ # NEXUS Design System — Rules for AI Assistants
2
+
3
+ ## Tech Stack
4
+
5
+ - **Design Tokens**: `@nexus-cross/tokens` (CSS variable based)
6
+ - **UI Components**: `@nexus-cross/design-system` (React, CVA + Plain CSS)
7
+ - **Styling**: Tailwind CSS v4 + NEXUS semantic tokens
8
+
9
+ ## Absolute Rules
10
+
11
+ 1. **색상은 반드시 NEXUS 토큰 사용.** hex, rgb, 기본 Tailwind 색상 (`bg-blue-500` 등) 금지.
12
+ - 배경: `bg-bg-*`, `bg-surface-*`
13
+ - 텍스트: `text-text-*`
14
+ - 아이콘: `text-icon-*`
15
+ - 테두리: `border-border-*`
16
+ - 액센트: `bg-accent-*`
17
+ - 상태: `bg-status-*`
18
+
19
+ 2. **UI 컴포넌트는 `@nexus-cross/design-system`에서 import.** 직접 구현 금지.
20
+ - `<button>` → `<Button>`, `<input>` → `<TextInput>`, `<select>` → `<Select>` 등
21
+ - Radix UI, Headless UI 등 직접 import 금지 (design-system이 내부적으로 사용)
22
+
23
+ 3. **Figma MCP 코드 그대로 사용 금지.** MCP 출력은 "디자인 의도 파악용"으로만 참고.
24
+ - Step 1: MCP로 구조 파악 → Step 2: NEXUS 컴포넌트 매핑 → Step 3: NEXUS 코드 작성
25
+
26
+ 4. **`className` 오버라이드 시 `!important` 금지.** `cn()` 유틸이 프리픽스 충돌 자동 해소.
27
+
28
+ ## Component Import
29
+
30
+ ```tsx
31
+ import { Button, TextInput, TextArea, Select, Switch, Chip, Spinner, Divider } from '@nexus-cross/design-system';
32
+ import { Tooltip, Popover, Drawer, Accordion } from '@nexus-cross/design-system';
33
+ import { toast, Toaster } from '@nexus-cross/design-system';
34
+ import { modal, useModal, ModalTemplate, ModalContainer } from '@nexus-cross/design-system/modal';
35
+ import { NumberInput, numberInputBind } from '@nexus-cross/design-system';
36
+ import { Avatar, Tab, ToggleGroup } from '@nexus-cross/design-system';
37
+ import { cn } from '@nexus-cross/design-system';
38
+ ```
39
+
40
+ ## CSS Setup
41
+
42
+ ### Tailwind v4
43
+ ```css
44
+ @import 'tailwindcss';
45
+ @import '@nexus-cross/tokens/company.css';
46
+ /* Next.js Turbopack only: */
47
+ @import '@nexus-cross/design-system/styles.css';
48
+ ```
49
+
50
+ ### Next.js Turbopack
51
+ ```js
52
+ // next.config.mjs
53
+ const nextConfig = {
54
+ transpilePackages: ['@nexus-cross/design-system', '@nexus-cross/tokens'],
55
+ }
56
+ ```
57
+
58
+ ## Token Path Convention
59
+
60
+ 모든 디자인 토큰은 5-segment 형식: `color.semantic.{namespace}.{slot}.{state}`
61
+
62
+ ```
63
+ # CORRECT
64
+ color.semantic.domain-market.bullish.base
65
+ color.semantic.domain-market.bullish-bg.hover
66
+
67
+ # WRONG (6+ segments)
68
+ color.semantic.domain-market.trend.bullish.base
69
+ ```
70
+
71
+ ## Detailed References
72
+
73
+ 상세 API, 토큰 목록, 컴포넌트 매핑 가이드는 아래 파일 참조:
74
+
75
+ - **토큰 전체 목록**: `.cursor/rules/nexus-tokens.mdc`
76
+ - **도메인 토큰**: `.cursor/rules/nexus-domains.mdc`
77
+ - **컴포넌트 매핑 가이드**: `.cursor/rules/nexus-ui-components.mdc`
78
+ - **컴포넌트 API (props)**: `.cursor/rules/nexus-ui-api.mdc`
79
+ - **프로젝트 셋업 상세**: `.cursor/rules/nexus-project-setup.mdc`
80
+ - **토큰 5-segment 규칙**: `.cursor/rules/token-path-5segment.mdc`
@@ -41,10 +41,38 @@ var stepperVariants = classVarianceAuthority.cva("nexus-stepper", {
41
41
  size: "md"
42
42
  }
43
43
  });
44
- var CheckIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { className, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2.5", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3.5 8.5l3 3 6-6", strokeLinecap: "round", strokeLinejoin: "round" }) });
44
+ var CheckIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx(
45
+ "svg",
46
+ {
47
+ className,
48
+ viewBox: "0 0 14 14",
49
+ fill: "none",
50
+ stroke: "currentColor",
51
+ strokeWidth: "2",
52
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2.5 7.5l3 3 6-6", strokeLinecap: "round", strokeLinejoin: "round" })
53
+ }
54
+ );
45
55
  var Stepper = React__namespace.forwardRef(
46
- ({ className, orientation, size, steps, current = 0, status = "process", ...props }, ref) => {
56
+ ({
57
+ className,
58
+ orientation,
59
+ size,
60
+ steps,
61
+ current = 0,
62
+ status = "process",
63
+ ...props
64
+ }, ref) => {
47
65
  const isHorizontal = orientation !== "vertical";
66
+ const prevCurrentRef = React__namespace.useRef(current);
67
+ const [animatingIdx, setAnimatingIdx] = React__namespace.useState(null);
68
+ React__namespace.useEffect(() => {
69
+ if (prevCurrentRef.current !== current) {
70
+ setAnimatingIdx(current);
71
+ prevCurrentRef.current = current;
72
+ const timer = setTimeout(() => setAnimatingIdx(null), 600);
73
+ return () => clearTimeout(timer);
74
+ }
75
+ }, [current]);
48
76
  return /* @__PURE__ */ jsxRuntime.jsx(
49
77
  "div",
50
78
  {
@@ -56,12 +84,15 @@ var Stepper = React__namespace.forwardRef(
56
84
  const state = i < current ? "completed" : i === current ? status === "error" ? "error" : "active" : "pending";
57
85
  const isFirst = i === 0;
58
86
  const isLast = i === steps.length - 1;
59
- const prevCompleted = i <= current;
60
- const nextCompleted = i < current;
87
+ const isAnimating = animatingIdx === i;
61
88
  return /* @__PURE__ */ jsxRuntime.jsxs(
62
89
  "div",
63
90
  {
64
- className: chunkCZC76ZD5_js.cn("nexus-stepper__step", `nexus-stepper__step--${state}`),
91
+ className: chunkCZC76ZD5_js.cn(
92
+ "nexus-stepper__step",
93
+ `nexus-stepper__step--${state}`,
94
+ isAnimating && "nexus-stepper__step--animating"
95
+ ),
65
96
  children: [
66
97
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nexus-stepper__indicator-wrap", children: isHorizontal ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
67
98
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -69,8 +100,7 @@ var Stepper = React__namespace.forwardRef(
69
100
  {
70
101
  className: chunkCZC76ZD5_js.cn(
71
102
  "nexus-stepper__connector",
72
- isFirst && "nexus-stepper__connector--hidden",
73
- prevCompleted && "nexus-stepper__connector--completed"
103
+ isFirst && "nexus-stepper__connector--hidden"
74
104
  )
75
105
  }
76
106
  ),
@@ -80,14 +110,14 @@ var Stepper = React__namespace.forwardRef(
80
110
  {
81
111
  className: chunkCZC76ZD5_js.cn(
82
112
  "nexus-stepper__connector",
83
- isLast && "nexus-stepper__connector--hidden",
84
- nextCompleted && "nexus-stepper__connector--completed"
113
+ isLast && "nexus-stepper__connector--hidden"
85
114
  )
86
115
  }
87
116
  )
88
117
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
89
- !isFirst && /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkCZC76ZD5_js.cn("nexus-stepper__connector", prevCompleted && "nexus-stepper__connector--completed") }),
90
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nexus-stepper__indicator", children: state === "completed" ? /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, { className: "nexus-stepper__check" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: i + 1 }) })
118
+ !isFirst && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nexus-stepper__connector" }),
119
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nexus-stepper__indicator", children: state === "completed" ? /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, { className: "nexus-stepper__check" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: i + 1 }) }),
120
+ !isLast && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nexus-stepper__connector" })
91
121
  ] }) }),
92
122
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nexus-stepper__content", children: [
93
123
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nexus-stepper__label", children: step.label }),
@@ -31,7 +31,8 @@ var toggleGroupVariants = classVarianceAuthority.cva("nexus-toggle-group", {
31
31
  variants: {
32
32
  variant: {
33
33
  default: "nexus-toggle-group--default",
34
- outline: "nexus-toggle-group--outline"
34
+ primary: "nexus-toggle-group--primary",
35
+ secondary: "nexus-toggle-group--secondary"
35
36
  },
36
37
  size: {
37
38
  sm: "nexus-toggle-group--sm",
@@ -45,7 +46,7 @@ var toggleGroupVariants = classVarianceAuthority.cva("nexus-toggle-group", {
45
46
  }
46
47
  });
47
48
  var ToggleGroup = React__namespace.forwardRef(
48
- ({ className, variant, size, items, disabled, required, ...props }, ref) => {
49
+ ({ className, variant, size, items, disabled, required = true, ...props }, ref) => {
49
50
  const rootRef = React__namespace.useRef(null);
50
51
  const [animated, setAnimated] = React__namespace.useState(false);
51
52
  const [pos, setPos] = React__namespace.useState(null);
@@ -62,10 +63,9 @@ var ToggleGroup = React__namespace.forwardRef(
62
63
  React__namespace.useEffect(() => {
63
64
  if (currentValue !== void 0) setTrackedValue(currentValue);
64
65
  }, [currentValue]);
65
- const isDefault = variant !== "outline";
66
66
  React__namespace.useLayoutEffect(() => {
67
67
  const root = rootRef.current;
68
- if (!root || !isDefault) return;
68
+ if (!root) return;
69
69
  const activeVal = Array.isArray(trackedValue) ? trackedValue[0] : trackedValue;
70
70
  if (!activeVal) {
71
71
  setPos(null);
@@ -89,7 +89,7 @@ var ToggleGroup = React__namespace.forwardRef(
89
89
  x: elRect.left - rootRect.left,
90
90
  y: elRect.top - rootRect.top
91
91
  });
92
- }, [trackedValue, items, isDefault]);
92
+ }, [trackedValue, items]);
93
93
  React__namespace.useEffect(() => {
94
94
  const frame = requestAnimationFrame(() => {
95
95
  requestAnimationFrame(() => setAnimated(true));
@@ -141,7 +141,7 @@ var ToggleGroup = React__namespace.forwardRef(
141
141
  disabled,
142
142
  ...rootProps,
143
143
  children: [
144
- isDefault && /* @__PURE__ */ jsxRuntime.jsx(
144
+ /* @__PURE__ */ jsxRuntime.jsx(
145
145
  "span",
146
146
  {
147
147
  className: chunkCZC76ZD5_js.cn(
@@ -157,7 +157,7 @@ var ToggleGroup = React__namespace.forwardRef(
157
157
  {
158
158
  value: item.value,
159
159
  disabled: item.disabled,
160
- className: "nexus-toggle-group__item",
160
+ className: chunkCZC76ZD5_js.cn("nexus-toggle-group__item", item.className),
161
161
  children: [
162
162
  item.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nexus-toggle-group__icon", children: item.icon }),
163
163
  item.label && /* @__PURE__ */ jsxRuntime.jsx("span", { children: item.label })