init commit
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# @collabry/components
|
||||
|
||||
React + Tailwind CSS component library for the Collabry UI, built on [shadcn/ui](https://ui.shadcn.com) (Radix UI, cmdk, Sonner), with a Storybook catalogue.
|
||||
React 19 + Tailwind CSS component library for the Collabry UI, built on [shadcn/ui](https://ui.shadcn.com) (Radix UI, cmdk, Sonner), with a Storybook catalogue.
|
||||
|
||||
```sh
|
||||
npm install
|
||||
@@ -25,32 +25,69 @@ import '@fontsource/lato/900.css';
|
||||
</ThemeProvider>;
|
||||
```
|
||||
|
||||
`react`, `react-dom` are peer dependencies; `radix-ui`, `cmdk`, `sonner`, `class-variance-authority`, `lucide-react`, `clsx` and `tailwind-merge` are installed with the package.
|
||||
`react` and `react-dom` (19) are peer dependencies; `radix-ui`, `cmdk`, `sonner`, `class-variance-authority`, `lucide-react`, `clsx` and `tailwind-merge` come with the package.
|
||||
|
||||
Dialogs, menus and popovers portal into the nearest `ThemeProvider` element, so they keep its theme, accent and tint.
|
||||
|
||||
## Composition
|
||||
|
||||
Components are small parts you assemble, like shadcn/ui. They don't take data objects or config props; each part renders one element, takes `className` and `ref`, and has a `data-slot` (`card-title`, `nav-item`, …) to target it from outside. Parts that are often links or headings accept `asChild`. The design (spacing, colors, states) lives in the parts; structure and data live in your code.
|
||||
|
||||
```tsx
|
||||
<CardFrame>
|
||||
<Card asChild>
|
||||
<section aria-labelledby="h-tasks">
|
||||
<CardHeader>
|
||||
<CardTitle id="h-tasks">
|
||||
Meine Aufgaben <CountBadge>6</CountBadge>
|
||||
</CardTitle>
|
||||
<CardAction>…</CardAction>
|
||||
</CardHeader>
|
||||
<TaskTable aria-label="Meine Aufgaben">
|
||||
<TaskRow done={task.status === 'done'}>
|
||||
<TaskCell>
|
||||
<TaskCheckbox checked={…} onCheckedChange={…} aria-label="…" />
|
||||
</TaskCell>
|
||||
<TaskCell>
|
||||
<TaskTitle>{task.title}</TaskTitle>
|
||||
<TaskMeta>…</TaskMeta>
|
||||
</TaskCell>
|
||||
…
|
||||
</TaskRow>
|
||||
</TaskTable>
|
||||
</section>
|
||||
</Card>
|
||||
</CardFrame>
|
||||
```
|
||||
|
||||
Conventions:
|
||||
|
||||
- State flows down through context where it's shared: `Field` wires label, control and messages (`id`, `aria-describedby`, `aria-invalid`); `Sidebar` tells its parts whether it's collapsed; `TaskTable` sets the column grid of its rows.
|
||||
- Overlays use the Radix pattern: `Dialog` + `DialogTrigger` + `DialogContent`, `Menu` + `MenuTrigger` + `MenuContent`, `Popover` + `PopoverTrigger` + `PopoverContent`. Controlled (`open` / `onOpenChange`) or not.
|
||||
- Text the user sees is German by default (labels like "Schließen"); pass your own children or `aria-label` to change it.
|
||||
- The stories are the reference compositions; `src/stories/examples.tsx` holds the bigger ones (notification panel, account menu).
|
||||
|
||||
## Structure
|
||||
|
||||
- `src/styles/tokens.css`: design tokens (`--cl-*`) for dark and light, with accent and tint derived via `color-mix`
|
||||
- `src/styles/index.css`: Tailwind v4 theme mapping tokens to utilities (`bg-surface`, `text-fg-muted`, `border-line`, …)
|
||||
- `src/components/ui/`: shadcn/ui primitives (`components.json`), restyled to the Collabry tokens. Accessibility, focus and keyboard handling come from Radix / cmdk.
|
||||
- `src/components/<Name>/<Name>.tsx` + `<Name>.stories.tsx`: Collabry components composed from `ui/`
|
||||
- `src/stories/`: introduction, token overview and sample data from the design
|
||||
- `src/styles/index.css`: Tailwind v4 theme mapping tokens to utilities (`bg-surface`, `text-fg-muted`, `border-line`, …) and to shadcn's token names
|
||||
- `src/components/ui/`: shadcn/ui primitives (`components.json`), restyled to the Collabry tokens
|
||||
- `src/components/<Name>/<Name>.tsx` + `<Name>.stories.tsx`: Collabry parts built from `ui/`
|
||||
|
||||
## Components
|
||||
|
||||
| Area | Components |
|
||||
| Area | Parts |
|
||||
| --- | --- |
|
||||
| Grundlagen | `ThemeProvider`, `Button`, `ButtonLink`, `Card`, `CardHeader`, `CardFooter`, `PageHeader`, `EmptyState`, `Spinner`, `Logo` |
|
||||
| Formulare | `Field`, `Input`, `PasswordInput`, `Textarea`, `Select`, `Checkbox`, `TaskCheckbox`, `SegmentedControl` |
|
||||
| Anzeige | `StatusBadge`, `CountBadge`, `RoleBadge`, `Swatch`, `Kbd`, `Avatar`, `AvatarStack`, `ProgressBar`, `StatusProgress` |
|
||||
| Overlays | `Menu`, `Dialog`, `Drawer`, `Toast`, `Toaster`, `toast()`, `CommandPalette`, `SearchTrigger`, `NotificationPanel`, `NotificationItem` |
|
||||
| Navigation | `Sidebar`, `NavItem`, `UserMenu`, `MobileHeader`, `MobileTabBar`, `SettingsNav` |
|
||||
| Aufgaben | `TaskTable`, `TaskRow`, `TaskSectionHeader`, `PriorityLabel`, `DeadlineItem`, `DateTile`, `CommentItem`, `CommentComposer` |
|
||||
| Gruppen | `GroupCard`, `GroupRow`, `NewGroupTile`, `InviteBanner` |
|
||||
| Kalender | `CalendarMonth`, `CalendarToolbar`, `CalendarLegend`, `GroupFilterChip`, `DayEventItem` |
|
||||
| Einstellungen | `SettingsSection`, `SettingsRow`, `ThemePicker`, `ColorSchemePicker`, `SaveStatus` |
|
||||
| Anmeldung | `AuthBrandPanel`, `FeatureItem`, `PasswordRules` |
|
||||
| Foundations | `ThemeProvider`, `Button`, `CardFrame`, `Card`, `CardHeader`, `CardHeading`, `CardTitle`, `CardDescription`, `CardAction`, `CardFooter`, `PageHeader`, `PageHeading`, `PageEyebrow`, `PageTitle`, `PageDescription`, `PageActions`, `Empty*`, `SectionLabel`, `MetaSeparator`, `Spinner`, `Logo` |
|
||||
| Forms | `Field`, `FieldHeader`, `FieldLabel`, `FieldNote`, `FieldDescription`, `FieldError`, `Input`, `InputGroup`, `InputGroupAddon`, `InputGroupButton`, `PasswordInput`, `Textarea`, `Select`, `SelectOption`, `Checkbox`, `TaskCheckbox`, `SegmentedControl`, `SegmentedControlItem`, `SegmentedControlCount` |
|
||||
| Display | `StatusBadge`, `CountBadge`, `RoleBadge`, `Swatch`, `Kbd`, `KbdGroup`, `IndicatorDot`, `Avatar`, `AvatarImage`, `AvatarFallback`, `PersonAvatar`, `AvatarGroup`, `ProgressBar`, `StatusProgress`, `StatusBar`, `StatusLegend` |
|
||||
| Overlays | `Dialog*`, `AlertDialog*`, `Drawer*`, `Menu*`, `Popover*`, `Command*`, `SearchTrigger`, `Toast`, `ToastAction`, `ToastClose`, `Toaster`, `toast()`, `Notification*` |
|
||||
| Navigation | `Sidebar`, `SidebarHeader`, `SidebarLogo`, `SidebarActions`, `SidebarButton`, `SidebarToggle`, `SidebarNav`, `NavItem`, `NavItemLabel`, `SidebarFooter`, `SidebarUserButton`, `SidebarUserName`, `MobileHeader*`, `MobileTabBar`, `MobileTab` |
|
||||
| Tasks | `TaskTable`, `TaskTableHeader`, `TaskTableHead`, `TaskRow`, `TaskCell`, `TaskOpenButton`, `TaskTitle`, `TaskMeta`, `TaskCommentCount`, `TaskAssignee`, `TaskDue`, `TaskTableEmpty`, `TaskSection*`, `PriorityLabel`, `Deadline*`, `DateTile`, `Comment*` |
|
||||
| Groups | `GroupRow*`, `GroupCard*`, `NewGroupTile*`, `InviteBanner*` |
|
||||
| Calendar | `CalendarGrid`, `CalendarWeekday`, `CalendarDay*`, `CalendarChip`, `CalendarMarker`, `CalendarLegend*`, `CalendarToolbar`, `CalendarNav`, `CalendarRangeLabel`, `FilterChip`, `FilterChipSwatch`, `DayEvent*` |
|
||||
| Settings | `SettingsNav*`, `SettingsSection*`, `SettingsRow*`, `ThemePicker`, `ThemeOption`, `ThemePreview`, `ThemeOptionLabel`, `ColorSchemePicker`, `ColorSchemeOption`, `SaveStatus` |
|
||||
| Auth | `AuthBrandPanel`, `AuthBrandContent`, `AuthHeadline`, `Feature*`, `PasswordRules`, `PasswordRule`, `passwordRules()` |
|
||||
|
||||
## Adding shadcn/ui components
|
||||
|
||||
|
||||
Reference in New Issue
Block a user