@pol-studios/ui 1.0.0 → 1.0.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.
- package/README.md +351 -0
- package/dist/auth/index.js +1 -1
- package/dist/components/chat-agent/index.js +1 -1
- package/dist/components/index.js +543 -648
- package/dist/feedback/index.js +1 -1
- package/dist/navbar/index.js +3 -3
- package/package.json +12 -18
package/README.md
ADDED
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
# @pol-studios/ui
|
|
2
|
+
|
|
3
|
+
> UI components for POL applications
|
|
4
|
+
|
|
5
|
+
A comprehensive Radix-UI based component library following shadcn/ui patterns. Includes 50+ primitives, complex components, charts, forms, navigation, and data display components.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @pol-studios/ui
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Peer Dependencies
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add react react-dom @pol-studios/auth @pol-studios/db @pol-studios/filters @pol-studios/hooks @pol-studios/utils
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Optional Dependencies
|
|
20
|
+
Some components require additional packages:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# For date picker
|
|
24
|
+
pnpm add react-day-picker
|
|
25
|
+
|
|
26
|
+
# For command palette
|
|
27
|
+
pnpm add cmdk
|
|
28
|
+
|
|
29
|
+
# For mobile drawer
|
|
30
|
+
pnpm add vaul
|
|
31
|
+
|
|
32
|
+
# For resizable panels
|
|
33
|
+
pnpm add react-resizable-panels
|
|
34
|
+
|
|
35
|
+
# For carousel
|
|
36
|
+
pnpm add embla-carousel-react
|
|
37
|
+
|
|
38
|
+
# For charts
|
|
39
|
+
pnpm add recharts
|
|
40
|
+
|
|
41
|
+
# For theme support
|
|
42
|
+
pnpm add next-themes
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Quick Start
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
import { Button, Card, CardHeader, CardTitle, CardContent } from "@pol-studios/ui";
|
|
49
|
+
|
|
50
|
+
function MyComponent() {
|
|
51
|
+
return (
|
|
52
|
+
<Card>
|
|
53
|
+
<CardHeader>
|
|
54
|
+
<CardTitle>Welcome</CardTitle>
|
|
55
|
+
</CardHeader>
|
|
56
|
+
<CardContent>
|
|
57
|
+
<Button variant="default">Click me</Button>
|
|
58
|
+
</CardContent>
|
|
59
|
+
</Card>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Subpath Exports
|
|
65
|
+
|
|
66
|
+
| Path | Description |
|
|
67
|
+
|------|-------------|
|
|
68
|
+
| `@pol-studios/ui` | Primitives (shadcn components) |
|
|
69
|
+
| `@pol-studios/ui/primitives` | Base shadcn/ui components |
|
|
70
|
+
| `@pol-studios/ui/components` | Complex application components |
|
|
71
|
+
| `@pol-studios/ui/forms` | Form components (MultiForm, FileDropzone) |
|
|
72
|
+
| `@pol-studios/ui/nav` | Navigation components |
|
|
73
|
+
| `@pol-studios/ui/navbar` | Navbar and menu components |
|
|
74
|
+
| `@pol-studios/ui/data` | Data display (DataTable, EntityTable) |
|
|
75
|
+
| `@pol-studios/ui/feedback` | Feedback components (Toast, Spinner, Alert) |
|
|
76
|
+
| `@pol-studios/ui/auth` | Authentication forms |
|
|
77
|
+
| `@pol-studios/ui/providers` | Context providers |
|
|
78
|
+
| `@pol-studios/ui/contexts` | React contexts |
|
|
79
|
+
| `@pol-studios/ui/hooks` | UI-specific hooks |
|
|
80
|
+
| `@pol-studios/ui/cards` | Card components |
|
|
81
|
+
| `@pol-studios/ui/charts` | Chart components (Recharts-based) |
|
|
82
|
+
| `@pol-studios/ui/adapters` | Router and data adapters |
|
|
83
|
+
| `@pol-studios/ui/types` | TypeScript types |
|
|
84
|
+
| `@pol-studios/ui/file` | File upload components |
|
|
85
|
+
| `@pol-studios/ui/crud` | CRUD operation components |
|
|
86
|
+
| `@pol-studios/ui/components/chat-agent` | Chat/AI agent components |
|
|
87
|
+
| `@pol-studios/ui/styles/globals.css` | Global CSS styles |
|
|
88
|
+
|
|
89
|
+
## API Reference
|
|
90
|
+
|
|
91
|
+
### Primitives (shadcn/ui)
|
|
92
|
+
|
|
93
|
+
Base components built on Radix UI.
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
import {
|
|
97
|
+
// Layout
|
|
98
|
+
Card, CardHeader, CardTitle, CardContent, CardFooter,
|
|
99
|
+
Separator, ScrollArea, Collapsible, Tabs,
|
|
100
|
+
|
|
101
|
+
// Forms
|
|
102
|
+
Button, Input, Textarea, Checkbox, Switch, Slider,
|
|
103
|
+
Select, RadioGroup, Label, Form,
|
|
104
|
+
|
|
105
|
+
// Overlays
|
|
106
|
+
Dialog, Sheet, Popover, Tooltip, DropdownMenu,
|
|
107
|
+
AlertDialog, ContextMenu, HoverCard,
|
|
108
|
+
|
|
109
|
+
// Feedback
|
|
110
|
+
Alert, Badge, Progress, Skeleton, Spinner,
|
|
111
|
+
Toast, Toaster,
|
|
112
|
+
|
|
113
|
+
// Navigation
|
|
114
|
+
Breadcrumb, NavigationMenu, Menubar, Pagination,
|
|
115
|
+
|
|
116
|
+
// Data Display
|
|
117
|
+
Table, Avatar, Accordion, Carousel,
|
|
118
|
+
} from "@pol-studios/ui";
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Components
|
|
122
|
+
|
|
123
|
+
Complex application components.
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
import {
|
|
127
|
+
// Forms
|
|
128
|
+
Input, Select, Checkbox, SearchInput, DatePicker, DateRangePicker,
|
|
129
|
+
InputWithTagging, OptionalInput,
|
|
130
|
+
|
|
131
|
+
// Display
|
|
132
|
+
Modal, Drawer, SideSheet, Tooltip, Dropdown, Menu,
|
|
133
|
+
Heading, Text, Icon, Skeleton, Spinner,
|
|
134
|
+
|
|
135
|
+
// Tables
|
|
136
|
+
Table, TableHead, TableRow, TableCell, Pagination,
|
|
137
|
+
DataTable, EntityTableView, EntityTableWithPagination,
|
|
138
|
+
|
|
139
|
+
// Utility
|
|
140
|
+
AttachmentUploader, SortableList, EntityDropdown,
|
|
141
|
+
NotificationIcon, SavingIndicator, OfflineBanner,
|
|
142
|
+
|
|
143
|
+
// SDK Components
|
|
144
|
+
AddUserDropdown, PatternDropdown,
|
|
145
|
+
} from "@pol-studios/ui/components";
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Data Display
|
|
149
|
+
|
|
150
|
+
```tsx
|
|
151
|
+
import { DataTable, EntityTableView } from "@pol-studios/ui/data";
|
|
152
|
+
|
|
153
|
+
<DataTable
|
|
154
|
+
data={items}
|
|
155
|
+
columns={[
|
|
156
|
+
{ key: "name", header: "Name" },
|
|
157
|
+
{ key: "status", header: "Status", badge: true },
|
|
158
|
+
]}
|
|
159
|
+
actions={[
|
|
160
|
+
{ label: "Edit", onClick: handleEdit },
|
|
161
|
+
]}
|
|
162
|
+
/>
|
|
163
|
+
|
|
164
|
+
<EntityTableView
|
|
165
|
+
columns={tableColumns}
|
|
166
|
+
data={entities}
|
|
167
|
+
onRowClick={handleRowClick}
|
|
168
|
+
/>
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Charts
|
|
172
|
+
|
|
173
|
+
Recharts-based chart components.
|
|
174
|
+
|
|
175
|
+
```tsx
|
|
176
|
+
import {
|
|
177
|
+
CircleChartCard,
|
|
178
|
+
ChartGenerator,
|
|
179
|
+
RechartsBarChart,
|
|
180
|
+
RechartsPieChart,
|
|
181
|
+
RechartsLineChart,
|
|
182
|
+
RechartsAreaChart,
|
|
183
|
+
processFieldData,
|
|
184
|
+
formatNumber,
|
|
185
|
+
} from "@pol-studios/ui/charts";
|
|
186
|
+
|
|
187
|
+
<CircleChartCard
|
|
188
|
+
title="Distribution"
|
|
189
|
+
data={chartData}
|
|
190
|
+
config={chartConfig}
|
|
191
|
+
/>
|
|
192
|
+
|
|
193
|
+
<ChartGenerator
|
|
194
|
+
data={rawData}
|
|
195
|
+
type="bar"
|
|
196
|
+
config={generatorConfig}
|
|
197
|
+
/>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Navigation
|
|
201
|
+
|
|
202
|
+
```tsx
|
|
203
|
+
import {
|
|
204
|
+
BottomNav,
|
|
205
|
+
MenuToggle,
|
|
206
|
+
UserProfileName,
|
|
207
|
+
UserProfilePicture,
|
|
208
|
+
PageHeader,
|
|
209
|
+
} from "@pol-studios/ui/nav";
|
|
210
|
+
|
|
211
|
+
<PageHeader
|
|
212
|
+
title="Dashboard"
|
|
213
|
+
breadcrumbs={[{ label: "Home", href: "/" }]}
|
|
214
|
+
/>
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Forms
|
|
218
|
+
|
|
219
|
+
```tsx
|
|
220
|
+
import { MultiForm, MultiStepForm, FileDropzone } from "@pol-studios/ui/forms";
|
|
221
|
+
|
|
222
|
+
<MultiStepForm
|
|
223
|
+
steps={[
|
|
224
|
+
{ title: "Basic Info", component: BasicInfoStep },
|
|
225
|
+
{ title: "Details", component: DetailsStep },
|
|
226
|
+
]}
|
|
227
|
+
onComplete={handleSubmit}
|
|
228
|
+
/>
|
|
229
|
+
|
|
230
|
+
<FileDropzone
|
|
231
|
+
accept={{ "image/*": [".png", ".jpg"] }}
|
|
232
|
+
onDrop={handleFiles}
|
|
233
|
+
/>
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Authentication
|
|
237
|
+
|
|
238
|
+
```tsx
|
|
239
|
+
import {
|
|
240
|
+
LoginForm,
|
|
241
|
+
SignUpForm,
|
|
242
|
+
ForgotPasswordForm,
|
|
243
|
+
UpdatePasswordForm,
|
|
244
|
+
} from "@pol-studios/ui/auth";
|
|
245
|
+
|
|
246
|
+
<LoginForm
|
|
247
|
+
onSubmit={handleLogin}
|
|
248
|
+
onForgotPassword={handleForgotPassword}
|
|
249
|
+
/>
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Providers
|
|
253
|
+
|
|
254
|
+
```tsx
|
|
255
|
+
import {
|
|
256
|
+
PolComponentsProvider,
|
|
257
|
+
NavContextProvider,
|
|
258
|
+
AlertProvider,
|
|
259
|
+
} from "@pol-studios/ui/providers";
|
|
260
|
+
|
|
261
|
+
<PolComponentsProvider config={appConfig}>
|
|
262
|
+
<NavContextProvider>
|
|
263
|
+
<App />
|
|
264
|
+
</NavContextProvider>
|
|
265
|
+
</PolComponentsProvider>
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### Hooks
|
|
269
|
+
|
|
270
|
+
```tsx
|
|
271
|
+
import {
|
|
272
|
+
useAlert,
|
|
273
|
+
useNavigate,
|
|
274
|
+
usePolNavigate,
|
|
275
|
+
useMultistepForm,
|
|
276
|
+
useKeyboardShortcuts,
|
|
277
|
+
useAutoHeight,
|
|
278
|
+
useControlledState,
|
|
279
|
+
} from "@pol-studios/ui/hooks";
|
|
280
|
+
|
|
281
|
+
const { showAlert, hideAlert } = useAlert();
|
|
282
|
+
const navigate = useNavigate();
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Adapters
|
|
286
|
+
|
|
287
|
+
```tsx
|
|
288
|
+
import {
|
|
289
|
+
createTanStackRouterAdapter,
|
|
290
|
+
createSupabaseDataAdapter,
|
|
291
|
+
createPolDbHooksAuthAdapter,
|
|
292
|
+
} from "@pol-studios/ui/adapters";
|
|
293
|
+
|
|
294
|
+
const routerAdapter = createTanStackRouterAdapter(router);
|
|
295
|
+
const dataAdapter = createSupabaseDataAdapter(supabase);
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
## Styling
|
|
299
|
+
|
|
300
|
+
Import global styles in your app:
|
|
301
|
+
|
|
302
|
+
```tsx
|
|
303
|
+
import "@pol-studios/ui/styles/globals.css";
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
Uses Tailwind CSS with the following dependencies:
|
|
307
|
+
- `tailwindcss` - Utility-first CSS
|
|
308
|
+
- `tailwindcss-animate` - Animation utilities
|
|
309
|
+
- `class-variance-authority` - Variant management
|
|
310
|
+
|
|
311
|
+
## TypeScript Types
|
|
312
|
+
|
|
313
|
+
```tsx
|
|
314
|
+
import type {
|
|
315
|
+
// Component props
|
|
316
|
+
ModalProps,
|
|
317
|
+
TooltipProps,
|
|
318
|
+
DataTableProps,
|
|
319
|
+
ChartConfig,
|
|
320
|
+
|
|
321
|
+
// Data types
|
|
322
|
+
DataItem,
|
|
323
|
+
BadgeVariant,
|
|
324
|
+
LayoutVariant,
|
|
325
|
+
|
|
326
|
+
// Table types
|
|
327
|
+
EntityTableColumn,
|
|
328
|
+
ColumnConfigItem,
|
|
329
|
+
|
|
330
|
+
// Chart types
|
|
331
|
+
ChartType,
|
|
332
|
+
ChartDataType,
|
|
333
|
+
TimeSeriesData,
|
|
334
|
+
|
|
335
|
+
// Provider types
|
|
336
|
+
PolComponentsConfig,
|
|
337
|
+
NavContextValue,
|
|
338
|
+
} from "@pol-studios/ui";
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
## Related Packages
|
|
342
|
+
|
|
343
|
+
- [@pol-studios/hooks](../hooks) - Custom React hooks
|
|
344
|
+
- [@pol-studios/utils](../utils) - Utility functions
|
|
345
|
+
- [@pol-studios/filters](../filters) - Filter components
|
|
346
|
+
- [@pol-studios/db](../db) - Database utilities
|
|
347
|
+
- [@pol-studios/auth](../auth) - Authentication
|
|
348
|
+
|
|
349
|
+
## License
|
|
350
|
+
|
|
351
|
+
UNLICENSED
|
package/dist/auth/index.js
CHANGED
|
@@ -475,7 +475,7 @@ function UpdatePasswordForm({
|
|
|
475
475
|
var UpdatePasswordForm_default = UpdatePasswordForm;
|
|
476
476
|
|
|
477
477
|
// src/auth/AuthRouteWithLicense.tsx
|
|
478
|
-
import { useSetupAuth } from "@pol-studios/auth";
|
|
478
|
+
import { useSetupAuth } from "@pol-studios/db/auth";
|
|
479
479
|
import { isUsable } from "@pol-studios/utils/types";
|
|
480
480
|
import { Suspense } from "react";
|
|
481
481
|
|
|
@@ -1168,7 +1168,7 @@ var Modal = ({
|
|
|
1168
1168
|
|
|
1169
1169
|
// src/components/chat-agent/useChatAgent.ts
|
|
1170
1170
|
import { useState as useState4, useCallback as useCallback3, useRef as useRef2, useEffect as useEffect3 } from "react";
|
|
1171
|
-
import { useSetupAuth } from "@pol-studios/auth";
|
|
1171
|
+
import { useSetupAuth } from "@pol-studios/db/auth";
|
|
1172
1172
|
import { getSupabaseUrl, useSupabase } from "@pol-studios/db";
|
|
1173
1173
|
var initialState = {
|
|
1174
1174
|
messages: [],
|