@platned/ui 0.3.0 → 0.6.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 +116 -16
- package/dist/index.cjs +7302 -1633
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2211 -219
- package/dist/index.d.ts +2211 -219
- package/dist/index.js +7232 -1539
- package/dist/index.js.map +1 -1
- package/dist/sidebar.cjs +1380 -197
- package/dist/sidebar.cjs.map +1 -1
- package/dist/sidebar.d.cts +106 -7
- package/dist/sidebar.d.ts +106 -7
- package/dist/sidebar.js +1410 -211
- package/dist/sidebar.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +27 -4
- package/tailwind-preset.cjs +109 -0
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# @platned/ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React + TypeScript component library used across Platned products, with design tokens
|
|
4
|
+
generated from Figma.
|
|
4
5
|
|
|
5
6
|
## Install
|
|
6
7
|
|
|
@@ -8,44 +9,143 @@ Platned Design System — React component library used across Platned products.
|
|
|
8
9
|
npm install @platned/ui
|
|
9
10
|
```
|
|
10
11
|
|
|
12
|
+
Peer dependencies:
|
|
13
|
+
|
|
14
|
+
| Package | Range | Required |
|
|
15
|
+
|---|---|---|
|
|
16
|
+
| `react`, `react-dom` | `>=18` | yes |
|
|
17
|
+
| `react-icons` | `>=5.4.0` | yes — components render Lucide glyphs from `react-icons/lu` |
|
|
18
|
+
| `react-router-dom` | `>=6` | **optional** — only for the `./sidebar` entry point |
|
|
19
|
+
|
|
20
|
+
`clsx`, `tailwind-merge`, `@floating-ui/react` and `tabbable` are regular dependencies, not
|
|
21
|
+
peers. They are implementation details.
|
|
22
|
+
|
|
11
23
|
## Usage
|
|
12
24
|
|
|
25
|
+
Import the stylesheet once, at your app root:
|
|
26
|
+
|
|
13
27
|
```tsx
|
|
14
|
-
// Import styles once at your app root
|
|
15
28
|
import '@platned/ui/styles'
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Then import components:
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
import { Button, Input, Select, Modal, DataTable } from '@platned/ui'
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Dark mode
|
|
16
38
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
39
|
+
Add the `dark` class to `<html>`. Every component follows, because the tokens are CSS custom
|
|
40
|
+
properties rather than compiled values.
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
document.documentElement.classList.toggle('dark')
|
|
20
44
|
```
|
|
21
45
|
|
|
22
|
-
|
|
46
|
+
### Tailwind users
|
|
23
47
|
|
|
24
|
-
|
|
48
|
+
Consume the preset so your own utility classes resolve against the same tokens:
|
|
25
49
|
|
|
26
50
|
```js
|
|
27
51
|
// tailwind.config.js
|
|
28
52
|
module.exports = {
|
|
29
53
|
presets: [require('@platned/ui/tailwind-preset')],
|
|
54
|
+
content: ['./src/**/*.{ts,tsx}'],
|
|
30
55
|
}
|
|
31
56
|
```
|
|
32
57
|
|
|
33
|
-
|
|
58
|
+
Use the preset's unprefixed names — `bg-brand`, `text-default`, `border-default`. A class the
|
|
59
|
+
preset does not define silently produces no CSS.
|
|
60
|
+
|
|
61
|
+
### App sidebar
|
|
34
62
|
|
|
35
|
-
The
|
|
63
|
+
The collapsible nav rail is a separate entry point because it needs `react-router-dom`, which
|
|
64
|
+
is an optional peer — importing the main bundle never pulls it in. It takes its nav as data and
|
|
65
|
+
its brand and footer as slots.
|
|
36
66
|
|
|
37
67
|
```tsx
|
|
38
|
-
import { AppSidebar } from '@platned/ui/sidebar'
|
|
68
|
+
import { AppSidebar, SidebarUserCard } from '@platned/ui/sidebar'
|
|
69
|
+
|
|
70
|
+
const [collapsed, setCollapsed] = useState(false)
|
|
39
71
|
|
|
40
72
|
<AppSidebar
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
73
|
+
groups={[
|
|
74
|
+
{ items: [
|
|
75
|
+
{ to: '/dashboard', label: 'Dashboard', icon: <LuLayoutGrid />, end: true },
|
|
76
|
+
{ to: '/entities', label: 'Entities', icon: <LuLayers />, indicator: true },
|
|
77
|
+
] },
|
|
78
|
+
{ title: 'Review', items: [
|
|
79
|
+
{ to: '/queue', label: 'Review queue', icon: <LuClipboardList /> },
|
|
80
|
+
] },
|
|
81
|
+
]}
|
|
82
|
+
collapsed={collapsed}
|
|
83
|
+
onToggle={() => setCollapsed(c => !c)}
|
|
84
|
+
brand={({ collapsed }) => (collapsed ? <Mark /> : <Logo />)}
|
|
85
|
+
footerNav={[{ to: '/settings', label: 'Settings', icon: <LuSettings /> }]}
|
|
86
|
+
footer={
|
|
87
|
+
<SidebarUserCard name={user.name} role={user.role} collapsed={collapsed} onLogout={signOut} />
|
|
88
|
+
}
|
|
46
89
|
/>
|
|
47
90
|
```
|
|
48
91
|
|
|
92
|
+
## Package entries
|
|
93
|
+
|
|
94
|
+
| Import | Contents |
|
|
95
|
+
|---|---|
|
|
96
|
+
| `@platned/ui` | Every UI component |
|
|
97
|
+
| `@platned/ui/sidebar` | `AppSidebar`, `SidebarUserCard`, `NavTabs` — needs `react-router-dom` |
|
|
98
|
+
| `@platned/ui/styles` | Pre-built stylesheet. Import once at the app root |
|
|
99
|
+
| `@platned/ui/tailwind-preset` | CJS Tailwind preset |
|
|
100
|
+
|
|
101
|
+
## Components
|
|
102
|
+
|
|
103
|
+
Grouped as they are in the docs. Every component is exported from the package root — the
|
|
104
|
+
folder layout is internal.
|
|
105
|
+
|
|
106
|
+
**Forms & inputs** — `Button`, `IconButton`, `ButtonGroup`, `Input`, `Textarea`,
|
|
107
|
+
`PasswordInput`, `InputGroup`, `SearchInput`, `InputOTP`, `Select`, `Combobox`, `Command`,
|
|
108
|
+
`DatePicker`, `Calendar`, `Checkbox`, `Switch`, `Toggle`, `ToggleGroup`, `RadioGroup`,
|
|
109
|
+
`SegmentedControl`, `MultiSelectCard`, `Slider`, `Stepper`, `FileDropZone`, `Label`,
|
|
110
|
+
`Field` and parts, `ControlSizeProvider`
|
|
111
|
+
|
|
112
|
+
**Data display** — `Badge`, `StatusBadge`, `StatusDot`, `StatusChip`, `TagPill`, `CountBadge`,
|
|
113
|
+
`RoleBadge`, `UserStatusPill`, `TrailChip`, `CheckIndicator`, `EntityIconBadge`, `DataTable`
|
|
114
|
+
and cell parts, `Table` and parts, `ListRow`, `FileRow`, `ScoredRow`, `NumberedList`,
|
|
115
|
+
`IconTextRow`, `ChecklistRow`, `StepsList`, `DetailItem`, `DetailGrid`, `CheckedGroupList`,
|
|
116
|
+
`StatTile`, `StatNumber`, `ScoreValue`, `TileGrid`, `Avatar`, `AvatarGroup`, `AvatarBlock`
|
|
117
|
+
|
|
118
|
+
**Data visualisation** — `Sparkline`, `MiniBarChart`, `BarChart`, `DonutChart`, `RadialGauge`,
|
|
119
|
+
`ChartLegend`, `LegendDot`, `TrendLabel`
|
|
120
|
+
|
|
121
|
+
**Layout & containers** — `Card` and parts, `AspectRatio`, `ScrollArea`, `Carousel`,
|
|
122
|
+
`Resizable`, `Accordion`, `Collapsible`, `Separator`, `Kbd`, `Skeleton`, `Spinner`,
|
|
123
|
+
`WidgetHeader`, `WidgetTitle`, `WidgetFooter`
|
|
124
|
+
|
|
125
|
+
**Page chrome** — `PageHeading`, `PageToolbar`, `FilterBar`, `Tabs`, `EyebrowLabel`, `NavItem`,
|
|
126
|
+
`Breadcrumb`, `NavigationMenu`, `Pagination`
|
|
127
|
+
|
|
128
|
+
**Overlays** — `Modal`, `Drawer`, `ConfirmDialog`, `NoteConfirmModal`, `BlockedModal`,
|
|
129
|
+
`DropdownMenu`, `ContextMenu`, `Menubar`, `Popover`, `HoverCard`, `Tooltip`, `Portal`
|
|
130
|
+
|
|
131
|
+
**Feedback** — `InlineAlert`, `Banner`, `Toast`, `Toaster`, `EmptyState`, `ProgressBar`
|
|
132
|
+
|
|
133
|
+
**AI & decorative** — `AIChatBar`, `AISuggestionChip`, `QuickActionsBar`, `AuroraBackdrop`
|
|
134
|
+
|
|
135
|
+
Icons are **not** re-exported. Import them from `react-icons/lu` at the call site.
|
|
136
|
+
|
|
137
|
+
## Documentation
|
|
138
|
+
|
|
139
|
+
Run the docs site locally:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
npm run docs # localhost:5173
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Every component page carries its examples, its keyboard contract and its props table. See
|
|
146
|
+
[CHANGELOG.md](CHANGELOG.md) for the release history — 0.3.0, 0.4.0 and 0.5.0 each carry
|
|
147
|
+
breaking renames with migration tables.
|
|
148
|
+
|
|
49
149
|
## Contributing
|
|
50
150
|
|
|
51
|
-
See [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
151
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md).
|