@potenlab/ui 0.1.1 → 0.1.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.
Files changed (2) hide show
  1. package/README.md +361 -0
  2. package/package.json +1 -3
package/README.md ADDED
@@ -0,0 +1,361 @@
1
+ # @potenlab/ui
2
+
3
+ Potenlab's shared React UI component library built with Tailwind CSS 4, Radix UI, and TypeScript.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@potenlab/ui.svg)](https://www.npmjs.com/package/@potenlab/ui)
6
+ [![license](https://img.shields.io/npm/l/@potenlab/ui.svg)](https://github.com/potenlab/potenlab-library/blob/main/LICENSE)
7
+
8
+ [Storybook](https://potenlab-library.vercel.app) | [npm](https://www.npmjs.com/package/@potenlab/ui)
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ # npm
14
+ npm install @potenlab/ui
15
+
16
+ # bun
17
+ bun add @potenlab/ui
18
+
19
+ # pnpm
20
+ pnpm add @potenlab/ui
21
+
22
+ # yarn
23
+ yarn add @potenlab/ui
24
+ ```
25
+
26
+ ### Peer Dependencies
27
+
28
+ ```bash
29
+ npm install react react-dom tailwindcss
30
+ ```
31
+
32
+ Optional peer dependencies (install only if you use components that need them):
33
+
34
+ ```bash
35
+ # For DataTable component
36
+ npm install @tanstack/react-table
37
+
38
+ # For theme switching
39
+ npm install next-themes
40
+ ```
41
+
42
+ ## Setup
43
+
44
+ ### 1. Import the global stylesheet
45
+
46
+ Add the Potenlab design tokens and styles to your app's CSS entry point:
47
+
48
+ ```css
49
+ @import "tailwindcss";
50
+ @import "tw-animate-css";
51
+ @import "@potenlab/ui/dist/styles/globals.css";
52
+
53
+ /* Enable Tailwind to scan library component classes */
54
+ @source "../node_modules/@potenlab/ui/dist";
55
+ ```
56
+
57
+ ### 2. Import and use components
58
+
59
+ ```tsx
60
+ import { Button, Card, CardContent, DashboardLayout } from "@potenlab/ui";
61
+
62
+ export default function App() {
63
+ return (
64
+ <DashboardLayout sidebar={<MySidebar />}>
65
+ <Card>
66
+ <CardContent>
67
+ <Button>Click me</Button>
68
+ </CardContent>
69
+ </Card>
70
+ </DashboardLayout>
71
+ );
72
+ }
73
+ ```
74
+
75
+ ## Components
76
+
77
+ ### UI Primitives
78
+
79
+ Built on [Radix UI](https://www.radix-ui.com/) with Tailwind CSS styling.
80
+
81
+ | Component | Description |
82
+ |-----------|-------------|
83
+ | `Accordion` | Collapsible content sections |
84
+ | `AlertDialog` | Modal confirmation dialogs |
85
+ | `Avatar` | User profile images with fallback |
86
+ | `Badge` | Status labels and tags |
87
+ | `Button` | Clickable actions with variants |
88
+ | `Card` | Content containers (`Card`, `CardHeader`, `CardTitle`, `CardContent`, `CardFooter`) |
89
+ | `Checkbox` | Toggle checkboxes |
90
+ | `Dialog` | Modal overlays |
91
+ | `DropdownMenu` | Context menus and action menus |
92
+ | `Input` | Text input fields |
93
+ | `Label` | Form labels |
94
+ | `Select` | Dropdown selectors |
95
+ | `Separator` | Visual dividers |
96
+ | `Sheet` | Slide-out panels |
97
+ | `Sidebar` | Application sidebar primitives |
98
+ | `Skeleton` | Loading placeholders |
99
+ | `Sonner` | Toast notifications |
100
+ | `Switch` | Toggle switches |
101
+ | `Table` | Data tables (`Table`, `TableHeader`, `TableBody`, `TableRow`, `TableCell`) |
102
+ | `Tabs` | Tab navigation |
103
+ | `Tooltip` | Hover information |
104
+
105
+ ### Common Components
106
+
107
+ Higher-level components for building admin dashboards and CRUD interfaces.
108
+
109
+ | Component | Description |
110
+ |-----------|-------------|
111
+ | `PageHeader` | Page title with subtitle, badge count, and action button |
112
+ | `SearchBar` | Controlled search input with placeholder |
113
+ | `TabNavigation` | Tab switcher with controlled/uncontrolled modes |
114
+ | `PaginationControls` | Full pagination with page size selector and page jump |
115
+ | `FormField` | Labeled form input or select field |
116
+ | `LabeledSwitch` | Toggle switch with label |
117
+ | `DataTable` | Feature-rich table built on TanStack React Table |
118
+ | `DataTableColumnHeader` | Sortable column header for DataTable |
119
+ | `DataTablePagination` | Pagination integrated with DataTable |
120
+ | `DataTableToolbar` | Search and filter toolbar for DataTable |
121
+ | `DataTableRowActions` | Row action dropdown menu |
122
+
123
+ ### Layout Components
124
+
125
+ | Component | Description |
126
+ |-----------|-------------|
127
+ | `DashboardLayout` | Full dashboard wrapper with sidebar slot and main content area |
128
+ | `ContentLayout` | Content area with sidebar offset padding |
129
+
130
+ ## Import Paths
131
+
132
+ The library supports tree-shaking with multiple entry points:
133
+
134
+ ```tsx
135
+ // Import everything
136
+ import { Button, Card, DashboardLayout } from "@potenlab/ui";
137
+
138
+ // Import only UI primitives
139
+ import { Button, Card } from "@potenlab/ui/components/ui";
140
+
141
+ // Import only common components
142
+ import { DataTable, PageHeader } from "@potenlab/ui/components/common";
143
+
144
+ // Import only layouts
145
+ import { DashboardLayout, ContentLayout } from "@potenlab/ui/components/layouts";
146
+
147
+ // Import hooks
148
+ import { useIsMobile } from "@potenlab/ui/hooks";
149
+
150
+ // Import utilities
151
+ import { cn } from "@potenlab/ui/lib";
152
+ ```
153
+
154
+ ## Design Tokens
155
+
156
+ The library includes a complete design token system via `globals.css`:
157
+
158
+ ### Brand Colors
159
+
160
+ | Token | Value | Usage |
161
+ |-------|-------|-------|
162
+ | `primary` | `#509594` | Primary brand color |
163
+ | `primary-hover` | `#3F7A79` | Hover state |
164
+ | `primary-active` | `#357070` | Active/pressed state |
165
+ | `primary-light` | `#B9D5D4` | Light variant |
166
+
167
+ ### Surface & Background
168
+
169
+ | Token | Value | Usage |
170
+ |-------|-------|-------|
171
+ | `surface` | `#FFFFFF` | Card and panel backgrounds |
172
+ | `background` | `#FCFCFC` | Page background |
173
+ | `border` | `#E2E8F0` | Borders and dividers |
174
+ | `table-header` | `#F9FAFC` | Table header background |
175
+
176
+ ### Text Colors
177
+
178
+ | Token | Value | Usage |
179
+ |-------|-------|-------|
180
+ | `foreground` | `#000000` | Primary text |
181
+ | `subtitle` | `#9DA0A8` | Secondary/subtitle text |
182
+ | `muted-fg` | `#5A5E6A` | Muted text |
183
+ | `placeholder` | `#A0AEC0` | Input placeholders |
184
+ | `table-cell` | `#3B3F4A` | Table cell text |
185
+
186
+ ### Font Families
187
+
188
+ | Token | Value |
189
+ |-------|-------|
190
+ | `font-pretendard` | Pretendard Variable, system fallbacks |
191
+ | `font-inter` | Inter, Noto Sans KR, system fallbacks |
192
+ | `font-mono` | JetBrains Mono, Fira Code, system fallbacks |
193
+
194
+ ## Usage Examples
195
+
196
+ ### DashboardLayout with Sidebar
197
+
198
+ ```tsx
199
+ import { DashboardLayout, Accordion, AccordionItem, AccordionTrigger, AccordionContent, cn } from "@potenlab/ui";
200
+ import type { SidebarNavItem } from "@potenlab/ui";
201
+
202
+ const NAV_ITEMS: SidebarNavItem[] = [
203
+ { label: "Home", icon: Home, href: "/", isAccordion: false },
204
+ {
205
+ label: "Users",
206
+ isAccordion: true,
207
+ children: [{ label: "User Management", href: "/users", icon: UserRound }],
208
+ },
209
+ ];
210
+
211
+ function AppSidebar() {
212
+ return (
213
+ <aside className="fixed left-0 top-0 z-40 flex h-screen w-[300px] flex-col bg-white border-r border-border">
214
+ <div className="border-b border-border py-5 px-4">
215
+ <h2 className="text-2xl font-semibold">ADMIN</h2>
216
+ </div>
217
+ <nav className="flex-1 overflow-y-auto px-4 py-2">
218
+ <Accordion type="multiple" className="w-full">
219
+ {/* Render NAV_ITEMS */}
220
+ </Accordion>
221
+ </nav>
222
+ </aside>
223
+ );
224
+ }
225
+
226
+ export default function Layout({ children }) {
227
+ return (
228
+ <DashboardLayout sidebar={<AppSidebar />}>
229
+ {children}
230
+ </DashboardLayout>
231
+ );
232
+ }
233
+ ```
234
+
235
+ ### DataTable
236
+
237
+ ```tsx
238
+ import { DataTable, DataTableColumnHeader } from "@potenlab/ui";
239
+ import type { ColumnDef } from "@tanstack/react-table";
240
+
241
+ interface User {
242
+ id: string;
243
+ name: string;
244
+ email: string;
245
+ }
246
+
247
+ const columns: ColumnDef<User>[] = [
248
+ {
249
+ accessorKey: "name",
250
+ header: ({ column }) => <DataTableColumnHeader column={column} title="Name" />,
251
+ },
252
+ {
253
+ accessorKey: "email",
254
+ header: ({ column }) => <DataTableColumnHeader column={column} title="Email" />,
255
+ },
256
+ ];
257
+
258
+ export function UserTable({ users }: { users: User[] }) {
259
+ return (
260
+ <DataTable
261
+ columns={columns}
262
+ data={users}
263
+ enableSorting
264
+ enablePagination
265
+ onRowClick={(row) => console.log(row)}
266
+ />
267
+ );
268
+ }
269
+ ```
270
+
271
+ ### PageHeader with Search and Tabs
272
+
273
+ ```tsx
274
+ import { PageHeader, SearchBar, TabNavigation } from "@potenlab/ui";
275
+ import { Plus } from "lucide-react";
276
+
277
+ export function UserListHeader() {
278
+ const [search, setSearch] = useState("");
279
+ const tabs = [
280
+ { value: "all", label: "All Users" },
281
+ { value: "active", label: "Active" },
282
+ { value: "inactive", label: "Inactive" },
283
+ ];
284
+
285
+ return (
286
+ <>
287
+ <PageHeader
288
+ title="Users"
289
+ subtitle="User Management"
290
+ badgeCount={150}
291
+ badgeSuffix="users"
292
+ actionLabel="Add User"
293
+ actionIcon={Plus}
294
+ onAction={() => console.log("add user")}
295
+ />
296
+ <TabNavigation tabs={tabs} defaultValue="all" />
297
+ <SearchBar value={search} onChange={setSearch} placeholder="Search users..." />
298
+ </>
299
+ );
300
+ }
301
+ ```
302
+
303
+ ## Types
304
+
305
+ ```tsx
306
+ import type { SidebarNavItem, SidebarSubItem } from "@potenlab/ui";
307
+ ```
308
+
309
+ | Type | Description |
310
+ |------|-------------|
311
+ | `SidebarNavItem` | Navigation item with `label`, `icon?`, `href?`, `isAccordion`, `children?` |
312
+ | `SidebarSubItem` | Sub-navigation item with `label`, `href`, `icon?` |
313
+
314
+ ## Development
315
+
316
+ ```bash
317
+ # Install dependencies
318
+ bun install
319
+
320
+ # Start Storybook (development)
321
+ bun run storybook
322
+
323
+ # Build the library
324
+ bun run build
325
+
326
+ # Type check
327
+ bun run typecheck
328
+ ```
329
+
330
+ ### Release
331
+
332
+ ```bash
333
+ # Patch release (0.1.x)
334
+ bun run release:patch
335
+
336
+ # Minor release (0.x.0)
337
+ bun run release:minor
338
+
339
+ # Major release (x.0.0)
340
+ bun run release:major
341
+ ```
342
+
343
+ ## Project Structure
344
+
345
+ ```
346
+ src/
347
+ components/
348
+ ui/ # Radix UI primitives with Tailwind styling
349
+ common/ # Higher-level reusable components
350
+ layouts/ # Dashboard and content layout wrappers
351
+ hooks/ # Custom React hooks
352
+ lib/ # Utility functions (cn, formatNumber)
353
+ types/ # Shared TypeScript types
354
+ styles/ # Global CSS with design tokens
355
+ template/ # Next.js reference app using @potenlab/ui
356
+ .storybook/ # Storybook configuration
357
+ ```
358
+
359
+ ## License
360
+
361
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@potenlab/ui",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Potenlab shared UI component library",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -125,8 +125,6 @@
125
125
  },
126
126
  "devDependencies": {
127
127
  "@storybook/addon-a11y": "^10.2.14",
128
- "@storybook/addon-essentials": "^8.6.14",
129
- "@storybook/blocks": "^8.6.14",
130
128
  "@storybook/react": "^10.2.14",
131
129
  "@storybook/react-vite": "^10.2.14",
132
130
  "@tailwindcss/vite": "^4",