@platned/ui 0.10.4 → 1.1.0
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 +66 -99
- package/dist/blocks-charts.cjs +460 -0
- package/dist/blocks-charts.cjs.map +1 -0
- package/dist/blocks-charts.d.cts +64 -0
- package/dist/blocks-charts.d.ts +64 -0
- package/dist/blocks-charts.js +442 -0
- package/dist/blocks-charts.js.map +1 -0
- package/dist/blocks.cjs +8099 -0
- package/dist/blocks.cjs.map +1 -0
- package/dist/blocks.d.cts +3136 -0
- package/dist/blocks.d.ts +3136 -0
- package/dist/blocks.js +8330 -0
- package/dist/blocks.js.map +1 -0
- package/dist/chart.cjs +227 -0
- package/dist/chart.cjs.map +1 -0
- package/dist/chart.d.ts +66 -0
- package/dist/chart.js +184 -0
- package/dist/chart.js.map +1 -0
- package/dist/chunk-6BJ3OMUZ.js +3177 -0
- package/dist/chunk-6BJ3OMUZ.js.map +1 -0
- package/dist/chunk-7RXFHQL5.js +201 -0
- package/dist/chunk-7RXFHQL5.js.map +1 -0
- package/dist/chunk-MJC4A7I4.js +13 -0
- package/dist/chunk-MJC4A7I4.js.map +1 -0
- package/dist/chunk-QYFD7KIK.js +179 -0
- package/dist/chunk-QYFD7KIK.js.map +1 -0
- package/dist/code-block-BgEiLXpO.d.ts +111 -0
- package/dist/code-block-highlight.cjs +490 -0
- package/dist/code-block-highlight.cjs.map +1 -0
- package/dist/code-block-highlight.d.ts +28 -0
- package/dist/code-block-highlight.js +121 -0
- package/dist/code-block-highlight.js.map +1 -0
- package/dist/data-table-Dec6t8NO.d.ts +729 -0
- package/dist/data-table.cjs +3507 -2219
- package/dist/data-table.cjs.map +1 -1
- package/dist/data-table.d.ts +2 -1
- package/dist/data-table.js +1397 -246
- package/dist/data-table.js.map +1 -1
- package/dist/index.cjs +13232 -12876
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2748 -5343
- package/dist/index.js +8273 -9760
- package/dist/index.js.map +1 -1
- package/dist/map.cjs +433 -0
- package/dist/map.cjs.map +1 -0
- package/dist/map.d.cts +294 -0
- package/dist/map.d.ts +294 -0
- package/dist/map.js +428 -0
- package/dist/map.js.map +1 -0
- package/dist/theme.css +1897 -0
- package/package.json +60 -24
- package/dist/chunk-OVIRTNT4.js +0 -2787
- package/dist/chunk-OVIRTNT4.js.map +0 -1
- package/dist/data-table-JX-vnL0F.d.ts +0 -464
- package/dist/sidebar.cjs +0 -108
- package/dist/sidebar.cjs.map +0 -1
- package/dist/sidebar.d.cts +0 -257
- package/dist/sidebar.d.ts +0 -257
- package/dist/sidebar.js +0 -70
- package/dist/sidebar.js.map +0 -1
- package/dist/styles.css +0 -1
- package/dist/tokens.css +0 -1
- package/tailwind-preset.cjs +0 -446
package/README.md
CHANGED
|
@@ -16,144 +16,111 @@ Peer dependencies:
|
|
|
16
16
|
|
|
17
17
|
| Package | Range | Required |
|
|
18
18
|
|---|---|---|
|
|
19
|
-
| `react`, `react-dom` | `>=
|
|
19
|
+
| `react`, `react-dom` | `>=19` | yes |
|
|
20
20
|
| `lucide-react` | `>=1.0.0` | yes — components render Lucide glyphs |
|
|
21
|
-
| `
|
|
21
|
+
| `tailwindcss` | `>=4.0.0` | yes — the app compiles the components' classes |
|
|
22
|
+
| `shiki` | `>=3` | **optional**: only for `./code-block-highlight` |
|
|
23
|
+
| `leaflet` | `>=1.9` | **optional**: only for `./map` |
|
|
22
24
|
|
|
23
|
-
`radix-ui`, `@tanstack/react-table`, `clsx` and `
|
|
24
|
-
peers. They are implementation details.
|
|
25
|
+
`radix-ui`, `@tanstack/react-table`, `recharts`, `clsx`, `tailwind-merge` and `tw-animate-css` are regular
|
|
26
|
+
dependencies, not peers. They are implementation details.
|
|
25
27
|
|
|
26
28
|
## Usage
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
The library is styled with **Tailwind CSS v4**, so your app runs Tailwind v4 too. Import the
|
|
31
|
+
theme once in your main stylesheet, after Tailwind:
|
|
29
32
|
|
|
30
|
-
```
|
|
31
|
-
|
|
33
|
+
```css
|
|
34
|
+
/* app.css */
|
|
35
|
+
@import 'tailwindcss';
|
|
36
|
+
@import '@platned/ui/theme.css';
|
|
32
37
|
```
|
|
33
38
|
|
|
39
|
+
The theme brings the design tokens (light and dark), maps them onto Tailwind's theme, adds the
|
|
40
|
+
Platned utilities, and points Tailwind at the built components (`@source`), so their classes are
|
|
41
|
+
generated into your one stylesheet: one preflight, one copy of every utility, no layer ordering
|
|
42
|
+
to manage. Load Roboto and Roboto Mono yourself (Google Fonts or Fontsource).
|
|
43
|
+
|
|
34
44
|
Then import components:
|
|
35
45
|
|
|
36
46
|
```tsx
|
|
37
|
-
import { Button, Input, Select,
|
|
47
|
+
import { Button, Input, Select, Dialog, DataTable } from '@platned/ui'
|
|
38
48
|
```
|
|
39
49
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
properties rather than compiled values.
|
|
50
|
+
Your own classes use the same names as the components: the theme roles (`bg-primary`,
|
|
51
|
+
`text-muted-foreground`, `border-border`, `ring-ring/50`) and Tailwind's stock type, spacing,
|
|
52
|
+
radius and shadow scales (`text-sm`, `p-4`, `rounded-md`, `shadow-xs`).
|
|
44
53
|
|
|
45
|
-
|
|
46
|
-
document.documentElement.classList.toggle('dark')
|
|
47
|
-
```
|
|
54
|
+
### Next.js (App Router) and other React Server Components apps
|
|
48
55
|
|
|
49
|
-
|
|
56
|
+
Every built file starts with `"use client"`, so a server page or layout can render components and
|
|
57
|
+
blocks directly, as long as it passes serializable props (strings, numbers, arrays, plain objects):
|
|
50
58
|
|
|
51
|
-
|
|
59
|
+
```tsx
|
|
60
|
+
// app/companies/page.tsx: a Server Component
|
|
61
|
+
import { PageHeader } from '@platned/ui/blocks'
|
|
52
62
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
presets: [require('@platned/ui/tailwind-preset')],
|
|
57
|
-
content: ['./src/**/*.{ts,tsx}'],
|
|
63
|
+
export default async function Page() {
|
|
64
|
+
const count = await countCompanies()
|
|
65
|
+
return <PageHeader title="Companies" meta={[`${count} companies`]} />
|
|
58
66
|
}
|
|
59
67
|
```
|
|
60
68
|
|
|
61
|
-
|
|
62
|
-
|
|
69
|
+
Props that take a function (`linkComponent`, `icons`, `can`, `onAction`, render overrides) can't
|
|
70
|
+
cross from a server component, so set those blocks up in a client component. The helpers (`cn`,
|
|
71
|
+
`linkAdapter`, `chartColor`, `toast`) are client code too: call them from client components.
|
|
72
|
+
Mount one `<TooltipProvider>` (a `SidebarProvider` includes one) and one `<Toaster />` near the
|
|
73
|
+
root.
|
|
63
74
|
|
|
64
|
-
|
|
65
|
-
compiled Tailwind sheet, with its own preflight and its own copy of every utility. v3 has no
|
|
66
|
-
cascade layers, so its rules re-order your classes by load order. Instead, scan the library in
|
|
67
|
-
`content` and import only the tokens:
|
|
75
|
+
### Dark mode
|
|
68
76
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
module.exports = {
|
|
72
|
-
presets: [require('@platned/ui/tailwind-preset')],
|
|
73
|
-
content: ['./src/**/*.{ts,tsx}', './node_modules/@platned/ui/dist/**/*.js'],
|
|
74
|
-
}
|
|
75
|
-
```
|
|
77
|
+
Add the `dark` class to `<html>`. Every component follows, because the tokens are CSS custom
|
|
78
|
+
properties rather than compiled values, and the theme's `dark:` variant uses the same class.
|
|
76
79
|
|
|
77
|
-
```
|
|
78
|
-
|
|
80
|
+
```ts
|
|
81
|
+
document.documentElement.classList.toggle('dark')
|
|
79
82
|
```
|
|
80
83
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
### App sidebar
|
|
84
|
+
### Blocks
|
|
84
85
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
Blocks are whole compositions that render from data: you pass the JSON and they choose the
|
|
87
|
+
components. They are their own entry point, so their heavier dependencies stay out of the main
|
|
88
|
+
bundle.
|
|
88
89
|
|
|
89
90
|
```tsx
|
|
90
|
-
import {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
<AppSidebar
|
|
95
|
-
groups={[
|
|
96
|
-
{ items: [
|
|
97
|
-
{ to: '/dashboard', label: 'Dashboard', icon: <LayoutGridIcon />, end: true },
|
|
98
|
-
{ to: '/entities', label: 'Entities', icon: <LayersIcon />, indicator: true },
|
|
99
|
-
] },
|
|
100
|
-
{ title: 'Review', items: [
|
|
101
|
-
{ to: '/queue', label: 'Review queue', icon: <ClipboardListIcon /> },
|
|
102
|
-
] },
|
|
103
|
-
]}
|
|
104
|
-
collapsed={collapsed}
|
|
105
|
-
onToggle={() => setCollapsed(c => !c)}
|
|
106
|
-
brand={({ collapsed }) => (collapsed ? <Mark /> : <Logo />)}
|
|
107
|
-
footerNav={[{ to: '/settings', label: 'Settings', icon: <SettingsIcon /> }]}
|
|
108
|
-
footer={
|
|
109
|
-
<SidebarUserCard name={user.name} role={user.role} collapsed={collapsed} onLogout={signOut} />
|
|
110
|
-
}
|
|
111
|
-
/>
|
|
91
|
+
import { AppShell, Form, StatCards } from '@platned/ui/blocks'
|
|
92
|
+
|
|
93
|
+
<StatCards stats={[{ label: 'Revenue', value: 48200, format: { type: 'currency' }, change: 12.5 }]} />
|
|
112
94
|
```
|
|
113
95
|
|
|
114
96
|
## Package entries
|
|
115
97
|
|
|
116
98
|
| Import | Contents |
|
|
117
99
|
|---|---|
|
|
118
|
-
| `@platned/ui` | Every
|
|
119
|
-
| `@platned/ui/
|
|
120
|
-
| `@platned/ui/
|
|
121
|
-
| `@platned/ui/
|
|
122
|
-
| `@platned/ui/
|
|
100
|
+
| `@platned/ui` | Every component |
|
|
101
|
+
| `@platned/ui/blocks` | The blocks: `AppShell`, `SettingsDialog`, `Form`, `StatCards`, `ChartCard`, `Dashboard`, `TableCard`, `Kanban`, `DataGrid`, `RecordPage` / `PageHeader` / `DetailSections`, `ListDetail`, `ConfirmDialog`, `PersonCard`… |
|
|
102
|
+
| `@platned/ui/data-table` | `DataTable`, on its own so TanStack Table loads only where it is used |
|
|
103
|
+
| `@platned/ui/chart` | `ChartContainer` and its parts, over Recharts (installs with the package) |
|
|
104
|
+
| `@platned/ui/map` | `MapCard`, over Leaflet (an optional peer) |
|
|
105
|
+
| `@platned/ui/code-block-highlight` | Syntax highlighting for `CodeBlock`, over Shiki (an optional peer) |
|
|
106
|
+
| `@platned/ui/theme.css` | The theme for a Tailwind v4 app: tokens, theme mapping, utilities and `@source`. Import once after `@import 'tailwindcss'` |
|
|
123
107
|
|
|
124
108
|
## Components
|
|
125
109
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
**Forms & inputs** — `Button`, `IconButton`, `ButtonGroup`, `Input`, `Textarea`,
|
|
130
|
-
`PasswordInput`, `InputGroup`, `SearchInput`, `InputOTP`, `Select`, `Combobox`, `Command`,
|
|
131
|
-
`DatePicker`, `Calendar`, `Checkbox`, `Switch`, `Toggle`, `ToggleGroup`, `RadioGroup`,
|
|
132
|
-
`SegmentedControl`, `MultiSelectCard`, `Slider`, `Stepper`, `FileDropZone`, `Label`,
|
|
133
|
-
`Field` and parts, `ControlSizeProvider`
|
|
134
|
-
|
|
135
|
-
**Data display** — `Badge`, `StatusBadge`, `StatusDot`, `StatusChip`, `TagPill`, `CountBadge`,
|
|
136
|
-
`RoleBadge`, `UserStatusPill`, `TrailChip`, `CheckIndicator`, `EntityIconBadge`, `DataTable`
|
|
137
|
-
and cell parts, `Table` and parts, `ListRow`, `FileRow`, `ScoredRow`, `NumberedList`,
|
|
138
|
-
`IconTextRow`, `ChecklistRow`, `StepsList`, `DetailItem`, `DetailGrid`, `CheckedGroupList`,
|
|
139
|
-
`StatTile`, `StatNumber`, `ScoreValue`, `TileGrid`, `Avatar`, `AvatarGroup`, `AvatarBlock`
|
|
140
|
-
|
|
141
|
-
**Data visualisation** — `Sparkline`, `MiniBarChart`, `BarChart`, `DonutChart`, `RadialGauge`,
|
|
142
|
-
`ChartLegend`, `LegendDot`, `TrendLabel`
|
|
143
|
-
|
|
144
|
-
**Layout & containers** — `Card` and parts, `AspectRatio`, `ScrollArea`, `Carousel`,
|
|
145
|
-
`Resizable`, `Accordion`, `Collapsible`, `Separator`, `Kbd`, `Skeleton`, `Spinner`,
|
|
146
|
-
`WidgetHeader`, `WidgetTitle`, `WidgetFooter`
|
|
147
|
-
|
|
148
|
-
**Page chrome** — `PageHeading`, `PageToolbar`, `FilterBar`, `Tabs`, `EyebrowLabel`, `NavItem`,
|
|
149
|
-
`Breadcrumb`, `NavigationMenu`, `Pagination`
|
|
150
|
-
|
|
151
|
-
**Overlays** — `Modal`, `Drawer`, `ConfirmDialog`, `NoteConfirmModal`, `BlockedModal`,
|
|
152
|
-
`DropdownMenu`, `ContextMenu`, `Menubar`, `Popover`, `HoverCard`, `Tooltip`, `Portal`
|
|
110
|
+
One docs page per component, and every component is exported from the package root (the folder
|
|
111
|
+
layout is internal):
|
|
153
112
|
|
|
154
|
-
|
|
113
|
+
Accordion, Alert, Alert Dialog, Aspect Ratio, Attachment, Avatar, Badge, Breadcrumb, Bubble,
|
|
114
|
+
Button, Button Group, Calendar, Card, Carousel, Chart, Checkbox, Code Block, Collapsible,
|
|
115
|
+
Combobox, Command, Context Menu, Data Table, Date Picker, Dialog, Direction, Drawer, Dropdown
|
|
116
|
+
Menu, Empty, Field, Hover Card, Input, Input Group, Input OTP, Item, Kbd, Label, Marker, Menubar,
|
|
117
|
+
Message, Message Scroller, Native Select, Navigation Menu, Pagination, Popover, Progress,
|
|
118
|
+
Questionnaire, Radio Group, Resizable, Scroll Area, Select, Separator, Sheet, Sidebar, Skeleton,
|
|
119
|
+
Slider, Sonner, Spinner, Switch, Table, Tabs, Textarea, Toggle, Toggle Group, Tooltip, Trace,
|
|
120
|
+
Typography.
|
|
155
121
|
|
|
156
|
-
|
|
122
|
+
Two helpers come with them: `cn`, which joins class names and lets a `className` you pass win
|
|
123
|
+
over the component's own, and `PortalContainerProvider`, which sets where floating panels mount.
|
|
157
124
|
|
|
158
125
|
Icons are **not** re-exported. Import them from `lucide-react` at the call site.
|
|
159
126
|
|