@reopt-ai/opt-ui 1.4.1

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.
Files changed (64) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/COMPONENT_CATALOG.md +3000 -0
  3. package/LICENSE +21 -0
  4. package/README.md +244 -0
  5. package/dist/chunk-3GWWZKX7.js +38 -0
  6. package/dist/chunk-AFF2HPE5.cjs +5008 -0
  7. package/dist/chunk-ELWICXYY.js +4745 -0
  8. package/dist/chunk-N4NDU5ET.cjs +4745 -0
  9. package/dist/chunk-ONE3C5RV.cjs +38 -0
  10. package/dist/chunk-QWBHD54V.js +3218 -0
  11. package/dist/chunk-RBM2RNC2.js +5008 -0
  12. package/dist/chunk-X5WCXJAF.cjs +3218 -0
  13. package/dist/core/index.cjs +324 -0
  14. package/dist/core/index.d.cts +5 -0
  15. package/dist/core/index.d.ts +5 -0
  16. package/dist/core/index.js +324 -0
  17. package/dist/docs/01-getting-started.md +129 -0
  18. package/dist/docs/02-components/01-core.md +1841 -0
  19. package/dist/docs/02-components/02-visuals.md +11 -0
  20. package/dist/docs/02-components/03-shells.md +1361 -0
  21. package/dist/docs/02-components/04-surfaces.md +11 -0
  22. package/dist/docs/02-components/index.md +106 -0
  23. package/dist/docs/03-recipes/01-forms.md +471 -0
  24. package/dist/docs/03-recipes/02-dashboards.md +397 -0
  25. package/dist/docs/03-recipes/03-layouts.md +424 -0
  26. package/dist/docs/04-theming.md +232 -0
  27. package/dist/docs/05-migration/01-breaking-changes.md +117 -0
  28. package/dist/docs/05-migration/02-formstore.md +336 -0
  29. package/dist/docs/06-troubleshooting.md +119 -0
  30. package/dist/docs/index.md +71 -0
  31. package/dist/id-registry.cjs +1875 -0
  32. package/dist/id-registry.d.cts +27 -0
  33. package/dist/id-registry.d.ts +27 -0
  34. package/dist/id-registry.js +1875 -0
  35. package/dist/id-registry.json +3799 -0
  36. package/dist/index-BZ_lBlO1.d.ts +474 -0
  37. package/dist/index-BuvxoWHf.d.cts +474 -0
  38. package/dist/index-DlAcuvQp.d.cts +1686 -0
  39. package/dist/index-Slu5hOj1.d.ts +1686 -0
  40. package/dist/index.cjs +9959 -0
  41. package/dist/index.d.cts +2351 -0
  42. package/dist/index.d.ts +2351 -0
  43. package/dist/index.js +9959 -0
  44. package/dist/meta.cjs +6898 -0
  45. package/dist/meta.d.cts +36 -0
  46. package/dist/meta.d.ts +36 -0
  47. package/dist/meta.js +6869 -0
  48. package/dist/shells/index.cjs +65 -0
  49. package/dist/shells/index.d.cts +5 -0
  50. package/dist/shells/index.d.ts +5 -0
  51. package/dist/shells/index.js +65 -0
  52. package/dist/tailwind.css +401 -0
  53. package/dist/theme/presets/default.css +355 -0
  54. package/dist/theme/presets/minimal.css +354 -0
  55. package/dist/theme/presets/mono-dark.css +354 -0
  56. package/dist/theme/presets/natural.css +181 -0
  57. package/dist/theme/presets/pro.css +354 -0
  58. package/dist/types-D4-0lwaE.d.cts +298 -0
  59. package/dist/types-D4-0lwaE.d.ts +298 -0
  60. package/dist/visuals/index.cjs +4 -0
  61. package/dist/visuals/index.d.cts +1 -0
  62. package/dist/visuals/index.d.ts +1 -0
  63. package/dist/visuals/index.js +4 -0
  64. package/package.json +165 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) reopt Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,244 @@
1
+ # @reopt-ai/opt-ui
2
+
3
+ 접근성 우선 UI 컴포넌트 라이브러리. opt-ui-primitives 기반 Core, 비즈니스 Shells, Surface/block layout primitives를 제공합니다. 페이지 템플릿 Surface는 `@reopt-ai/opt-cli` registry로 설치하며, 차트와 데이터 시각화 컴포넌트는 `@reopt-ai/opt-charts`로 분리되었습니다.
4
+
5
+ ## 설치
6
+
7
+ ```bash
8
+ bun add @reopt-ai/opt-ui
9
+ ```
10
+
11
+ ### Peer Dependencies
12
+
13
+ | 패키지 | 필수 |
14
+ | ------------------- | ---- |
15
+ | `react` ^19.0.0 | Yes |
16
+ | `react-dom` ^19.0.0 | Yes |
17
+
18
+ ### Optional Peer Dependencies
19
+
20
+ | 패키지 | 용도 |
21
+ | ---------------------------- | --------------------------------- |
22
+ | `next` >=16.0.0 | `SidebarNav`, `RouteFocusManager` |
23
+ | `@codemirror/view` | `SqlEditor` |
24
+ | `@codemirror/state` | `SqlEditor` |
25
+ | `@codemirror/lang-sql` | `SqlEditor` |
26
+ | `@codemirror/theme-one-dark` | `SqlEditor` |
27
+
28
+ ## 컴포넌트 계층
29
+
30
+ ```
31
+ Core (55) → Shells (79) → Blocks via opt-cli
32
+ primitives 비즈니스 조합 페이지 템플릿 설치
33
+
34
+ opt-charts (21) → 데이터 시각화와 chart-specific shells
35
+ ```
36
+
37
+ ### Core (55개)
38
+
39
+ 접근성 프리미티브 + Tailwind 스타일. 단일 책임 primitive 컴포넌트.
40
+
41
+ Button, Badge, Input, Textarea, Switch, Checkbox, CheckboxGroup, RadioGroup, Radio, Select, Combobox, Dialog, Disclosure, Accordion, Tabs, Menu, Menubar, Toolbar, Tooltip, Form (FormInput, FormTextarea, FormSelect, FormSwitch), Popover, DropdownMenu, Drawer, NumberInput, OtpField, Kbd, StatCard, Avatar, AvatarGroup, Progress, CircularProgress, Spinner, Alert, Skeleton, Separator, Breadcrumb, EmptyState, Card, DateRangePicker, TagInput, Toggle, ColorPicker, IconPicker, StepBuilder, ConditionBuilder, CompositeZone, SurfaceLayout, createSurface, PageHeader, ScrollArea, Container, Section, Resizable (PanelGroup/Panel/Handle), Logo
42
+
43
+ ### Charts / Visuals
44
+
45
+ 차트 컴포넌트는 `@reopt-ai/opt-charts`에서 직접 import합니다. `@reopt-ai/opt-ui/visuals`는 기존 소비자를 위한 deprecated compatibility re-export입니다.
46
+
47
+ ChartContainer, ChartTooltip, ChartLegend, LineChart, BarChart, AreaChart, Sparkline, PieChart, ScatterChart, ComparisonChart, GaugeChart, FunnelChart, RetentionHeatmap, SankeyChart
48
+
49
+ ### Shells (79개)
50
+
51
+ Core 조합 + 비즈니스 로직.
52
+
53
+ 대표 컴포넌트:
54
+
55
+ CommandPalette, CommandPaletteTrigger, DashboardGrid, SearchCombobox, StatusSelect, AppMenubar, SidebarNav, EditorToolbar, ContentTabs, FaqAccordion, SettingsForm, AuthForm, DynamicFieldForm, FileUploadForm, WizardForm, DeploymentTimeline, ProjectSwitcher, EnvPanel, BranchSelect, DomainTable, DataTable, NotificationToast, TaskList, ActivityFeed, FilterBar, QuickActions, TeamMemberList, EventIcon, ConnectionIndicator, FloatingActionBar, TemplatePicker, CodeSnippetViewer, PropertyExplorer, QueryResultsTable, AlertBuilder, SqlEditor, EventMetaEditor, WidgetGrid, ReportBuilder, SegmentBuilder, InsightsPanel, TimeRangeSelector, ExportButton, LoadingOverlay, SummaryRow, ComparisonSelector, ThemeSwitcher, PromptTemplate, Sidebar, AppShell, DesignGuidePanel
56
+
57
+ 전체 목록은 `COMPONENT_CATALOG.md` 또는 generated docs의 `02-components/03-shells.md`를 기준으로 확인합니다.
58
+
59
+ ### Surface / Block templates
60
+
61
+ Shells 조합 페이지 템플릿은 runtime export가 아니라 copy-paste block registry로 제공합니다. 템플릿 내부에서는 `SurfaceLayout`/`createSurface`로 구조적 일관성을 유지합니다.
62
+
63
+ > 전체 Surface 레지스트리는 `npx @reopt-ai/opt-cli surface add <slug>` 으로
64
+ > 프로젝트에 설치합니다.
65
+
66
+ ## 사용법
67
+
68
+ ```tsx
69
+ // 전체 패키지에서 import
70
+ import { Button, Badge, Input } from "@reopt-ai/opt-ui";
71
+ import { DataTable, FilterBar } from "@reopt-ai/opt-ui";
72
+ import { LineChart, BarChart } from "@reopt-ai/opt-charts";
73
+
74
+ // 또는 계층별 서브패스로 import
75
+ import { Button, Badge } from "@reopt-ai/opt-ui/core";
76
+ import { LineChart, BarChart } from "@reopt-ai/opt-charts/visuals";
77
+ import { DataTable, FilterBar } from "@reopt-ai/opt-ui/shells";
78
+ ```
79
+
80
+ ### 기본 예시
81
+
82
+ ```tsx
83
+ import {
84
+ Card,
85
+ CardHeader,
86
+ CardTitle,
87
+ CardContent,
88
+ Button,
89
+ Badge,
90
+ } from "@reopt-ai/opt-ui";
91
+
92
+ function MyComponent() {
93
+ return (
94
+ <Card>
95
+ <CardHeader>
96
+ <CardTitle>Dashboard</CardTitle>
97
+ </CardHeader>
98
+ <CardContent>
99
+ <Badge variant="success">Active</Badge>
100
+ <Button onClick={() => console.log("clicked")}>Action</Button>
101
+ </CardContent>
102
+ </Card>
103
+ );
104
+ }
105
+ ```
106
+
107
+ ### 차트 예시
108
+
109
+ ```tsx
110
+ import { LineChart, ChartContainer } from "@reopt-ai/opt-charts";
111
+
112
+ const data = [
113
+ { name: "Jan", revenue: 4000, users: 2400 },
114
+ { name: "Feb", revenue: 3000, users: 1398 },
115
+ ];
116
+
117
+ const series = [
118
+ { dataKey: "revenue", name: "Revenue", color: "#8884d8" },
119
+ { dataKey: "users", name: "Users", color: "#82ca9d" },
120
+ ];
121
+
122
+ <ChartContainer height={300}>
123
+ <LineChart data={data} series={series} />
124
+ </ChartContainer>;
125
+ ```
126
+
127
+ ### Block template 설치
128
+
129
+ ```bash
130
+ npx @reopt-ai/opt-cli surface add data-explorer
131
+ ```
132
+
133
+ ## 테마 프리셋
134
+
135
+ 5개 시그니처 프리셋 CSS를 제공합니다. 각 프리셋은 `[data-theme]` 셀렉터 기반 CSS 변수를 정의합니다.
136
+
137
+ ```css
138
+ /* 원하는 프리셋을 import */
139
+ @import "@reopt-ai/opt-ui/theme/presets/default.css";
140
+ @import "@reopt-ai/opt-ui/theme/presets/minimal.css";
141
+ @import "@reopt-ai/opt-ui/theme/presets/natural.css";
142
+ @import "@reopt-ai/opt-ui/theme/presets/pro.css";
143
+ @import "@reopt-ai/opt-ui/theme/presets/mono-dark.css";
144
+ ```
145
+
146
+ | 프리셋 | 특징 |
147
+ | ----------- | -------------------------------------------- |
148
+ | `default` | 뉴트럴 블루 계열, 범용 |
149
+ | `minimal` | 모노톤, 미니멀, 샤프 엣지 |
150
+ | `natural` | Playfair Display + Lora, force-light |
151
+ | `pro` | Geist Mono 헤딩, 네온 블루, 고밀도 |
152
+ | `mono-dark` | OLED 친화 블랙, 네온 시안, 신택스 하이라이트 |
153
+
154
+ 이전 버전의 `corporate`/`playful` 프리셋은 제거되었습니다. localStorage에 남은 값은 `default`로 자동 마이그레이션됩니다. 기존 시각적 톤을 유지하려면 `OptThemeProvider`의 generated 모드 또는 ThemeBuilder로 직접 시드를 정의해 재현할 수 있습니다.
155
+
156
+ `OptThemeProvider`와 `ThemeSwitcher`로 런타임 프리셋 + 라이트/다크 모드 전환을 지원합니다.
157
+
158
+ ## 디자인 토큰
159
+
160
+ CSS 변수 기반 시맨틱 토큰 — `dark:` 프리픽스 없이 자동 전환:
161
+
162
+ | 토큰 | 용도 |
163
+ | -------------------- | -------------- |
164
+ | `OPT_INPUT` | 입력 필드 |
165
+ | `OPT_FOCUS_VISIBLE` | 포커스 링 |
166
+ | `OPT_SURFACE` | 카드/패널 배경 |
167
+ | `OPT_BORDER` | 테두리 |
168
+ | `OPT_TEXT_PRIMARY` | 주요 텍스트 |
169
+ | `OPT_TEXT_SECONDARY` | 보조 텍스트 |
170
+
171
+ ### 시맨틱 스페이싱
172
+
173
+ | CSS 변수 | Tailwind | 값 |
174
+ | --------------------- | ------------- | ------------- |
175
+ | `--opt-space-section` | `gap-section` | 1.5rem (24px) |
176
+ | `--opt-space-group` | `gap-group` | 1rem (16px) |
177
+ | `--opt-space-element` | `gap-element` | 0.5rem (8px) |
178
+
179
+ Surface 루트는 반드시 `SurfaceLayout`을 사용하여 일관된 스페이싱을 유지합니다.
180
+
181
+ ## 접근성
182
+
183
+ - opt-ui-primitives 기반 ARIA 역할/상태 관리
184
+ - 모든 인터랙티브 요소에 포커스 링
185
+ - Roving tabindex (CompositeZone, DataTable, SidebarNav)
186
+ - Focus trap (Dialog)
187
+ - Spatial Navigation 엔진 (SpatialNavProvider)
188
+ - 키보드: Tab, Arrow, Enter, Space, Escape
189
+
190
+ ## 빌드
191
+
192
+ ```bash
193
+ # 빌드만
194
+ bun run build
195
+
196
+ # 타입 체크
197
+ bun run typecheck
198
+
199
+ # 린트
200
+ bun run lint
201
+ ```
202
+
203
+ ## 배포
204
+
205
+ 이 패키지는 npmjs.org에 public으로 배포됩니다. 유지보수자 배포는 직접
206
+ `npm publish` 또는 `bun run release*`를 사용하지 않고 `design-publish`
207
+ 워크플로우만 사용합니다.
208
+
209
+ ```text
210
+ /design-publish opt-ui
211
+ ```
212
+
213
+ - npm registry publish 권한과 2FA 또는 automation token이 필요합니다.
214
+ - Surface 또는 registry 입력이 바뀌면 `@reopt-ai/opt-cli`와 함께 배포합니다.
215
+ - `@reopt-ai/opt-ui-primitives`는 런타임 의존성이므로 publish-safe 버전으로 함께 검증합니다.
216
+ - CI는 publish snapshot과 generated artifact(`registry.json`,
217
+ `COMPONENT_CATALOG.md`) freshness를 확인합니다.
218
+
219
+ ## 테스트
220
+
221
+ ```bash
222
+ bun run test
223
+ bun run validate:test-coverage
224
+ bun run test:coverage
225
+ ```
226
+
227
+ `bun run test`는 Vitest 실행 후 `scripts/validate-test-coverage.ts`를 이어서 실행합니다. 이 검증은 `src/*/_meta.ts`의 158개 ComponentMeta가 모두 `testDescribe`를 갖고, 해당 이름의 `describe(...)` 블록이 테스트 파일에 존재하는지 확인합니다.
228
+
229
+ ## Design Decisions
230
+
231
+ - **Layer metaphor**: Core → Shells는 opt-ui가 맡고, 페이지 템플릿 Surface는 opt-cli block registry로 설치
232
+ - **SurfaceLayout 강제**: block template은 반드시 `SurfaceLayout` 또는 `createSurface`를 사용하여 구조적 일관성 보장
233
+ - **Subpath exports**: `./core`, `./visuals`, `./shells` — 필요한 계층만 import 가능
234
+ - **Dual format**: ESM + CJS — 모든 번들러/런타임 호환
235
+ - **Source maps**: 디버깅을 위한 소스맵 포함
236
+ - **Tree-shakeable**: `splitting: true` + ESM — 사용하는 컴포넌트만 번들에 포함
237
+ - **"use client" 배너**: 모든 빌드 출력에 `"use client"` 지시문 자동 주입
238
+ - **External all**: 런타임 의존성 전부 external — 모노레포 앱에서 중복 번들 방지
239
+ - **Optional heavy deps**: CodeMirror, Next.js는 optional peer — 사용하지 않으면 설치 불필요
240
+ - **CSS variable theming**: 5개 프리셋 × light/dark compound themes, `dark:` 없이 CSS 변수로 자동 전환
241
+
242
+ ## License
243
+
244
+ MIT
@@ -0,0 +1,38 @@
1
+ "use client";
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __spreadValues = (a, b) => {
10
+ for (var prop in b || (b = {}))
11
+ if (__hasOwnProp.call(b, prop))
12
+ __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols)
14
+ for (var prop of __getOwnPropSymbols(b)) {
15
+ if (__propIsEnum.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ }
18
+ return a;
19
+ };
20
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
+ var __objRest = (source, exclude) => {
22
+ var target = {};
23
+ for (var prop in source)
24
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
25
+ target[prop] = source[prop];
26
+ if (source != null && __getOwnPropSymbols)
27
+ for (var prop of __getOwnPropSymbols(source)) {
28
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
29
+ target[prop] = source[prop];
30
+ }
31
+ return target;
32
+ };
33
+
34
+ export {
35
+ __spreadValues,
36
+ __spreadProps,
37
+ __objRest
38
+ };