@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.
Files changed (63) hide show
  1. package/README.md +66 -99
  2. package/dist/blocks-charts.cjs +460 -0
  3. package/dist/blocks-charts.cjs.map +1 -0
  4. package/dist/blocks-charts.d.cts +64 -0
  5. package/dist/blocks-charts.d.ts +64 -0
  6. package/dist/blocks-charts.js +442 -0
  7. package/dist/blocks-charts.js.map +1 -0
  8. package/dist/blocks.cjs +8099 -0
  9. package/dist/blocks.cjs.map +1 -0
  10. package/dist/blocks.d.cts +3136 -0
  11. package/dist/blocks.d.ts +3136 -0
  12. package/dist/blocks.js +8330 -0
  13. package/dist/blocks.js.map +1 -0
  14. package/dist/chart.cjs +227 -0
  15. package/dist/chart.cjs.map +1 -0
  16. package/dist/chart.d.ts +66 -0
  17. package/dist/chart.js +184 -0
  18. package/dist/chart.js.map +1 -0
  19. package/dist/chunk-6BJ3OMUZ.js +3177 -0
  20. package/dist/chunk-6BJ3OMUZ.js.map +1 -0
  21. package/dist/chunk-7RXFHQL5.js +201 -0
  22. package/dist/chunk-7RXFHQL5.js.map +1 -0
  23. package/dist/chunk-MJC4A7I4.js +13 -0
  24. package/dist/chunk-MJC4A7I4.js.map +1 -0
  25. package/dist/chunk-QYFD7KIK.js +179 -0
  26. package/dist/chunk-QYFD7KIK.js.map +1 -0
  27. package/dist/code-block-BgEiLXpO.d.ts +111 -0
  28. package/dist/code-block-highlight.cjs +490 -0
  29. package/dist/code-block-highlight.cjs.map +1 -0
  30. package/dist/code-block-highlight.d.ts +28 -0
  31. package/dist/code-block-highlight.js +121 -0
  32. package/dist/code-block-highlight.js.map +1 -0
  33. package/dist/data-table-Dec6t8NO.d.ts +729 -0
  34. package/dist/data-table.cjs +3507 -2219
  35. package/dist/data-table.cjs.map +1 -1
  36. package/dist/data-table.d.ts +2 -1
  37. package/dist/data-table.js +1397 -246
  38. package/dist/data-table.js.map +1 -1
  39. package/dist/index.cjs +13232 -12876
  40. package/dist/index.cjs.map +1 -1
  41. package/dist/index.d.ts +2748 -5343
  42. package/dist/index.js +8273 -9760
  43. package/dist/index.js.map +1 -1
  44. package/dist/map.cjs +433 -0
  45. package/dist/map.cjs.map +1 -0
  46. package/dist/map.d.cts +294 -0
  47. package/dist/map.d.ts +294 -0
  48. package/dist/map.js +428 -0
  49. package/dist/map.js.map +1 -0
  50. package/dist/theme.css +1897 -0
  51. package/package.json +60 -24
  52. package/dist/chunk-OVIRTNT4.js +0 -2787
  53. package/dist/chunk-OVIRTNT4.js.map +0 -1
  54. package/dist/data-table-JX-vnL0F.d.ts +0 -464
  55. package/dist/sidebar.cjs +0 -108
  56. package/dist/sidebar.cjs.map +0 -1
  57. package/dist/sidebar.d.cts +0 -257
  58. package/dist/sidebar.d.ts +0 -257
  59. package/dist/sidebar.js +0 -70
  60. package/dist/sidebar.js.map +0 -1
  61. package/dist/styles.css +0 -1
  62. package/dist/tokens.css +0 -1
  63. 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` | `>=18` | yes |
19
+ | `react`, `react-dom` | `>=19` | yes |
20
20
  | `lucide-react` | `>=1.0.0` | yes — components render Lucide glyphs |
21
- | `react-router-dom` | `>=6` | **optional** — only for the `./sidebar` entry point |
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 `tailwind-merge` are regular dependencies, not
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
- Import the stylesheet once, at your app root:
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
- ```tsx
31
- import '@platned/ui/styles'
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, Modal, DataTable } from '@platned/ui'
47
+ import { Button, Input, Select, Dialog, DataTable } from '@platned/ui'
38
48
  ```
39
49
 
40
- ### Dark mode
41
-
42
- Add the `dark` class to `<html>`. Every component follows, because the tokens are CSS custom
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
- ```ts
46
- document.documentElement.classList.toggle('dark')
47
- ```
54
+ ### Next.js (App Router) and other React Server Components apps
48
55
 
49
- ### Tailwind users
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
- Consume the preset so your own utility classes resolve against the same tokens:
59
+ ```tsx
60
+ // app/companies/page.tsx: a Server Component
61
+ import { PageHeader } from '@platned/ui/blocks'
52
62
 
53
- ```js
54
- // tailwind.config.js
55
- module.exports = {
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
- Use the preset's unprefixed names — `bg-brand`, `text-default`, `border-default`. A class the
62
- preset does not define silently produces no CSS.
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
- On **Tailwind v3**, don't load `@platned/ui/styles` next to your own stylesheet. It is a second
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
- ```js
70
- // tailwind.config.js (Tailwind v3)
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
- ```tsx
78
- import '@platned/ui/tokens' // custom properties only: no preflight, no utilities, no fonts
80
+ ```ts
81
+ document.documentElement.classList.toggle('dark')
79
82
  ```
80
83
 
81
- On Tailwind v4, import `@platned/ui/styles` into a cascade layer between `base` and `utilities`.
82
-
83
- ### App sidebar
84
+ ### Blocks
84
85
 
85
- The collapsible nav rail is a separate entry point because it needs `react-router-dom`, which
86
- is an optional peer — importing the main bundle never pulls it in. It takes its nav as data and
87
- its brand and footer as slots.
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 { AppSidebar, SidebarUserCard } from '@platned/ui/sidebar'
91
-
92
- const [collapsed, setCollapsed] = useState(false)
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 UI component |
119
- | `@platned/ui/sidebar` | `AppSidebar`, `SidebarUserCard`, `NavTabs` — needs `react-router-dom` |
120
- | `@platned/ui/styles` | Pre-built stylesheet. Import once at the app root |
121
- | `@platned/ui/tokens` | Design tokens only, as CSS custom properties. For Tailwind v3 apps that scan the library in `content` |
122
- | `@platned/ui/tailwind-preset` | CJS Tailwind preset |
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
- Grouped as they are in the docs. Every component is exported from the package root — the
127
- folder layout is internal.
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
- **Feedback** — `InlineAlert`, `Banner`, `Toast`, `Toaster`, `EmptyState`, `ProgressBar`
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
- **AI & decorative** — `AIChatBar`, `AISuggestionChip`, `QuickActionsBar`, `AuroraBackdrop`
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