@carefully-built/ui 0.1.15
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 +148 -0
- package/dist/index.d.mts +1351 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3489 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +70 -0
package/README.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# @carefully-built/ui
|
|
2
|
+
|
|
3
|
+
Reusable React UI primitives and data-display components for Carefully Built SaaS apps.
|
|
4
|
+
|
|
5
|
+
This package is the shared UI foundation for dashboards, admin tools, multi-tenant CRUD apps, and internal SaaS workflows. It contains components that are generic enough to reuse across projects, while leaving app-specific Convex, WorkOS, and domain logic in the application or in separate packages.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bun add @carefully-built/ui
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Until the package is published to npm, consume it from the local tarball or GitHub repo.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { SmartTable, useTableSorting, type Column } from '@carefully-built/ui';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
This package assumes your app provides Tailwind-compatible design tokens such as `bg-card`, `text-muted-foreground`, `border`, and `ring`.
|
|
22
|
+
|
|
23
|
+
## Styling And Theming
|
|
24
|
+
|
|
25
|
+
Components keep their default style when styling props are omitted. For app-specific theme differences, pass `className`, focused slot props such as `contentClassName`, or `classes` objects instead of copying primitives into the app.
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import { ResponsiveSheet, SaasErrorPage } from '@carefully-built/ui';
|
|
29
|
+
|
|
30
|
+
<ResponsiveSheet
|
|
31
|
+
open={open}
|
|
32
|
+
onOpenChange={setOpen}
|
|
33
|
+
title="Edit resource"
|
|
34
|
+
contentClassName="sm:max-w-xl"
|
|
35
|
+
classes={{
|
|
36
|
+
body: 'gap-4',
|
|
37
|
+
footer: 'border-t',
|
|
38
|
+
}}
|
|
39
|
+
/>;
|
|
40
|
+
|
|
41
|
+
<SaasErrorPage
|
|
42
|
+
error={error}
|
|
43
|
+
reset={reset}
|
|
44
|
+
source="app-error-boundary"
|
|
45
|
+
classes={{
|
|
46
|
+
content: 'max-w-lg',
|
|
47
|
+
title: 'text-2xl',
|
|
48
|
+
}}
|
|
49
|
+
/>;
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Components
|
|
53
|
+
|
|
54
|
+
### Primitives
|
|
55
|
+
|
|
56
|
+
- `Button`: shared button variants and sizes, including icon-only buttons.
|
|
57
|
+
- `Card`, `CardHeader`, `CardTitle`, `CardDescription`, `CardContent`, `CardFooter`: compact card building blocks for repeated items and panels.
|
|
58
|
+
- `Input`: styled text input primitive.
|
|
59
|
+
- `Textarea`: styled textarea primitive.
|
|
60
|
+
- `Label`: accessible Radix label primitive.
|
|
61
|
+
- `Table`, `TableHeader`, `TableBody`, `TableRow`, `TableCell`, and related table primitives.
|
|
62
|
+
- `Pagination`: page navigation control for list and table views.
|
|
63
|
+
- `Skeleton`: loading placeholder primitive.
|
|
64
|
+
- `Tooltip`, `TooltipProvider`, `TooltipTrigger`, `TooltipContent`: Radix tooltip wrappers.
|
|
65
|
+
- `DisplayDate`: consistent date display for table/list values.
|
|
66
|
+
- `KeyboardKeycap`, `ShortcutModifierKeycap`: small keyboard shortcut keycap UI.
|
|
67
|
+
|
|
68
|
+
### Overlays
|
|
69
|
+
|
|
70
|
+
- `Sheet`, `SheetContent`, `SheetHeader`, `SheetTitle`, `SheetDescription`: desktop side-sheet primitives.
|
|
71
|
+
- `Drawer`, `DrawerContent`, `DrawerHeader`, `DrawerTitle`, `DrawerDescription`: mobile drawer primitives.
|
|
72
|
+
- `ResponsiveSheet`: switches between desktop sheet and mobile drawer, with optional footer actions.
|
|
73
|
+
- `DesktopConfirmShortcutHint`: visual hint for the desktop confirm shortcut.
|
|
74
|
+
- `useDesktopConfirmShortcut`: handles Cmd/Ctrl+Enter confirmation in open sheets.
|
|
75
|
+
- `useDesktopShortcutModifierLabel`: resolves the platform-specific modifier label.
|
|
76
|
+
- `SaasErrorPage` and `SaasNotFoundPage`: default application error and 404 states for Next.js app routes.
|
|
77
|
+
|
|
78
|
+
### Search
|
|
79
|
+
|
|
80
|
+
- `SearchableSelect`: searchable single-select dropdown for compact filters and form controls.
|
|
81
|
+
- `getSearchableSelectPosition`: helper for positioning searchable select popovers.
|
|
82
|
+
|
|
83
|
+
### Smart Table
|
|
84
|
+
|
|
85
|
+
- `SmartTable`: responsive data table with desktop and mobile renderers.
|
|
86
|
+
- `SmartTableActions`: standard view/edit/delete action buttons.
|
|
87
|
+
- `TruncatedContent`: expandable/truncated cell content for long text.
|
|
88
|
+
- `useTableSorting`: sortable table state and sorting helper hook.
|
|
89
|
+
- `Column`, `SmartTableProps`, `PaginationConfig`, `ActionHandlers`, `ActionType`: table typing helpers.
|
|
90
|
+
- Component doc: [SmartTable](./docs/smart-table.md).
|
|
91
|
+
|
|
92
|
+
### Table Toolbar
|
|
93
|
+
|
|
94
|
+
- `TableToolbar`: reusable toolbar with search, filter sheet, draft/apply behavior, active filter count, and clear-all support.
|
|
95
|
+
- `SearchInput`: search field with leading search icon and clear button.
|
|
96
|
+
- `FilterDropdown`: searchable select dropdown for simple enum filters.
|
|
97
|
+
- `CustomTableToolbarFilter`: extension point for app-specific filters such as association pickers.
|
|
98
|
+
- `FilterConfig`, `FilterOption`, `TableToolbarProps`: toolbar typing helpers.
|
|
99
|
+
- Component doc: [TableToolbar](./docs/table-toolbar.md).
|
|
100
|
+
|
|
101
|
+
### Component Docs
|
|
102
|
+
|
|
103
|
+
- [SmartTable](./docs/smart-table.md)
|
|
104
|
+
- [TableToolbar](./docs/table-toolbar.md)
|
|
105
|
+
- [ResponsiveSheet](./docs/responsive-sheet.md)
|
|
106
|
+
|
|
107
|
+
### Utilities
|
|
108
|
+
|
|
109
|
+
- `cn`: Tailwind class merge helper.
|
|
110
|
+
- `formatDisplayDate`: date formatting utility.
|
|
111
|
+
- `buildSearchText`, `rankBySearch`, `fuzzyIncludes`: reusable fuzzy search helpers.
|
|
112
|
+
- `useMediaQuery`, `useIsMobile`: responsive media-query hooks.
|
|
113
|
+
|
|
114
|
+
## Peer Dependencies
|
|
115
|
+
|
|
116
|
+
The consuming app must provide:
|
|
117
|
+
|
|
118
|
+
- `react`
|
|
119
|
+
- `react-dom`
|
|
120
|
+
- `lucide-react`
|
|
121
|
+
- `radix-ui`
|
|
122
|
+
- `vaul`
|
|
123
|
+
- `class-variance-authority`
|
|
124
|
+
- `clsx`
|
|
125
|
+
- `tailwind-merge`
|
|
126
|
+
|
|
127
|
+
The consuming app also needs Tailwind CSS styles and design tokens compatible with the class names used by these components.
|
|
128
|
+
|
|
129
|
+
## Publish Checklist
|
|
130
|
+
|
|
131
|
+
Before publishing:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
bun install
|
|
135
|
+
bun run check
|
|
136
|
+
cd packages/ui
|
|
137
|
+
npm publish --dry-run --access public
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Then publish with:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
npm publish --access public
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Keep This Updated
|
|
147
|
+
|
|
148
|
+
Whenever a reusable component is added, moved, renamed, or removed, update this README in the same PR/commit. Treat this file as the package catalog so future apps can quickly see what already exists before rebuilding it.
|