@formant/aesthetics 0.0.3 → 0.0.6
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 +43 -153
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1071 -57
- package/dist/index.js.map +1 -1
- package/package.json +17 -16
- package/styles/globals.css +81 -125
- package/dist/safelist.css +0 -1377
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @formant/aesthetics
|
|
2
2
|
|
|
3
|
-
Formant design system — themed React components built on shadcn/ui
|
|
3
|
+
Formant design system — themed React components built on shadcn/ui and Radix UI.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@formant/aesthetics)
|
|
6
6
|
|
|
@@ -12,81 +12,42 @@ npm install @formant/aesthetics
|
|
|
12
12
|
|
|
13
13
|
Peer dependencies required:
|
|
14
14
|
```bash
|
|
15
|
-
npm install react react-dom
|
|
15
|
+
npm install react react-dom
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
##
|
|
18
|
+
## Quick Start
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
### 1. Wrap your app with FormantAesthetics
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
```css
|
|
25
|
-
@import "tailwindcss";
|
|
26
|
-
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@300;400;500&display=swap');
|
|
27
|
-
|
|
28
|
-
/* CRITICAL: This tells Tailwind to scan the compiled library for classes.
|
|
29
|
-
Path is relative to this CSS file. */
|
|
30
|
-
@source "../../node_modules/@formant/aesthetics/dist/**/*.js";
|
|
31
|
-
|
|
32
|
-
@theme inline {
|
|
33
|
-
--font-heading: 'Space Grotesk', sans-serif;
|
|
34
|
-
--font-sans: 'Inter', sans-serif;
|
|
35
|
-
--font-mono: 'JetBrains Mono', monospace;
|
|
36
|
-
--color-background: var(--background);
|
|
37
|
-
--color-foreground: var(--foreground);
|
|
38
|
-
--color-card: var(--card);
|
|
39
|
-
--color-card-foreground: var(--card-foreground);
|
|
40
|
-
--color-primary: var(--primary);
|
|
41
|
-
--color-primary-foreground: var(--primary-foreground);
|
|
42
|
-
/* ... (see full theme in styles/globals.css) */
|
|
43
|
-
--radius-sm: calc(var(--radius) * 0.6);
|
|
44
|
-
--radius-md: calc(var(--radius) * 0.8);
|
|
45
|
-
--radius-lg: var(--radius);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
:root {
|
|
49
|
-
/* Formant Dark Theme (Slate Mist) */
|
|
50
|
-
--background: #202428;
|
|
51
|
-
--foreground: #F2F3F4;
|
|
52
|
-
--card: #0A0F11;
|
|
53
|
-
--primary: #ACC3B3;
|
|
54
|
-
--primary-foreground: #0A0F11;
|
|
55
|
-
--muted: #202428;
|
|
56
|
-
--muted-foreground: #A3ABA9;
|
|
57
|
-
--border: rgba(163, 171, 169, 0.1);
|
|
58
|
-
--input: rgba(163, 171, 169, 0.2);
|
|
59
|
-
--ring: #ACC3B3;
|
|
60
|
-
--radius: 0.25rem;
|
|
61
|
-
}
|
|
22
|
+
```tsx
|
|
23
|
+
import { FormantAesthetics } from "@formant/aesthetics";
|
|
62
24
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
font-family: 'Inter', sans-serif;
|
|
70
|
-
}
|
|
71
|
-
h1, h2, h3, h4, h5, h6 {
|
|
72
|
-
font-family: 'Space Grotesk', sans-serif;
|
|
73
|
-
letter-spacing: -0.02em;
|
|
74
|
-
}
|
|
25
|
+
function App() {
|
|
26
|
+
return (
|
|
27
|
+
<FormantAesthetics>
|
|
28
|
+
<YourApp />
|
|
29
|
+
</FormantAesthetics>
|
|
30
|
+
);
|
|
75
31
|
}
|
|
76
32
|
```
|
|
77
33
|
|
|
78
|
-
|
|
34
|
+
The `FormantAesthetics` component automatically injects all necessary CSS including:
|
|
35
|
+
- Google Fonts (Inter, Space Grotesk, JetBrains Mono)
|
|
36
|
+
- CSS variables for the Formant dark theme
|
|
37
|
+
- All utility classes used by components
|
|
38
|
+
|
|
39
|
+
### 2. Use Components
|
|
79
40
|
|
|
80
41
|
```tsx
|
|
81
42
|
import { Button, Card, CardHeader, CardTitle, Badge } from "@formant/aesthetics";
|
|
82
43
|
|
|
83
|
-
function
|
|
44
|
+
function MyComponent() {
|
|
84
45
|
return (
|
|
85
46
|
<div className="min-h-screen bg-background text-foreground p-8">
|
|
86
47
|
<Card>
|
|
87
48
|
<CardHeader>
|
|
88
49
|
<CardTitle>Hello @formant/aesthetics</CardTitle>
|
|
89
|
-
<Badge>v0.0.
|
|
50
|
+
<Badge>v0.0.3</Badge>
|
|
90
51
|
</CardHeader>
|
|
91
52
|
<div className="p-6 space-y-4">
|
|
92
53
|
<Button>Default</Button>
|
|
@@ -97,117 +58,37 @@ function App() {
|
|
|
97
58
|
</div>
|
|
98
59
|
);
|
|
99
60
|
}
|
|
100
|
-
|
|
101
|
-
export default App;
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### 3. `main.tsx`
|
|
105
|
-
|
|
106
|
-
```tsx
|
|
107
|
-
import { StrictMode } from 'react'
|
|
108
|
-
import { createRoot } from 'react-dom/client'
|
|
109
|
-
import './index.css'
|
|
110
|
-
import App from './App'
|
|
111
|
-
|
|
112
|
-
createRoot(document.getElementById('root')!).render(
|
|
113
|
-
<StrictMode>
|
|
114
|
-
<App />
|
|
115
|
-
</StrictMode>,
|
|
116
|
-
)
|
|
117
61
|
```
|
|
118
62
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
1. **`@source` path must be relative to the CSS file** — from `src/index.css`, go up 2 levels to `node_modules/`
|
|
122
|
-
2. **Theme variables live in `:root`** — Tailwind needs them at build time to generate classes like `bg-background`
|
|
123
|
-
3. **No runtime CSS injection needed** — the theme is baked into your CSS, components just use the variables
|
|
63
|
+
That's it! No build step or CSS configuration required. The `FormantAesthetics` component handles everything.
|
|
124
64
|
|
|
125
|
-
##
|
|
65
|
+
## Optional: Import Global Styles
|
|
126
66
|
|
|
127
|
-
If you
|
|
67
|
+
If you prefer to include styles in your own CSS pipeline, you can import the base theme:
|
|
128
68
|
|
|
129
69
|
```css
|
|
130
|
-
@import "tailwindcss";
|
|
131
70
|
@import "@formant/aesthetics/styles";
|
|
132
|
-
|
|
133
|
-
/* Customize specific variables */
|
|
134
|
-
@theme inline {
|
|
135
|
-
--color-primary: #your-color;
|
|
136
|
-
}
|
|
137
71
|
```
|
|
138
72
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
### 1. Import components
|
|
73
|
+
Then use the `ThemeProvider` directly instead of `FormantAesthetics`:
|
|
142
74
|
|
|
143
75
|
```tsx
|
|
144
|
-
import {
|
|
76
|
+
import { ThemeProvider } from "@formant/aesthetics";
|
|
145
77
|
|
|
146
78
|
function App() {
|
|
147
79
|
return (
|
|
148
|
-
<
|
|
149
|
-
<
|
|
150
|
-
|
|
151
|
-
</CardHeader>
|
|
152
|
-
<Button>Click me</Button>
|
|
153
|
-
</Card>
|
|
80
|
+
<ThemeProvider>
|
|
81
|
+
<YourApp />
|
|
82
|
+
</ThemeProvider>
|
|
154
83
|
);
|
|
155
84
|
}
|
|
156
85
|
```
|
|
157
86
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
In your `index.css` (or `globals.css`):
|
|
161
|
-
|
|
162
|
-
```css
|
|
163
|
-
@import "tailwindcss";
|
|
164
|
-
|
|
165
|
-
/* Tell Tailwind to scan the compiled library for classes */
|
|
166
|
-
@source "../../node_modules/@formant/aesthetics/dist/**/*.js";
|
|
167
|
-
|
|
168
|
-
/* Formant theme variables */
|
|
169
|
-
@theme inline {
|
|
170
|
-
--color-background: var(--background);
|
|
171
|
-
--color-foreground: var(--foreground);
|
|
172
|
-
--color-card: var(--card);
|
|
173
|
-
--color-primary: var(--primary);
|
|
174
|
-
/* ... other theme vars ... */
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
:root {
|
|
178
|
-
/* Formant Dark Theme (Slate Mist) */
|
|
179
|
-
--background: #202428;
|
|
180
|
-
--foreground: #F2F3F4;
|
|
181
|
-
--card: #0A0F11;
|
|
182
|
-
--primary: #ACC3B3;
|
|
183
|
-
/* ... etc ... */
|
|
184
|
-
}
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
### 3. Import the canonical theme (optional)
|
|
188
|
-
|
|
189
|
-
For the complete Formant theme including fonts and all CSS variables:
|
|
190
|
-
|
|
191
|
-
```css
|
|
192
|
-
@import "@formant/aesthetics/styles";
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
Then customize as needed:
|
|
196
|
-
|
|
197
|
-
```css
|
|
198
|
-
@import "@formant/aesthetics/styles";
|
|
199
|
-
|
|
200
|
-
@theme inline {
|
|
201
|
-
/* Override specific variables */
|
|
202
|
-
--color-primary: #your-color;
|
|
203
|
-
}
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
## What's included
|
|
87
|
+
## What's Included
|
|
207
88
|
|
|
208
89
|
- **40+ shadcn/ui components** — Accordion, Alert, Badge, Button, Card, Dialog, Dropdown, Form, Input, Select, Table, Tabs, Toast, etc.
|
|
209
|
-
- **Formant brand components** — `FormantLogo`, `FormantLogoWithText`
|
|
210
|
-
- **Theme provider** — `ThemeProvider` from next-themes (dark/light mode
|
|
90
|
+
- **Formant brand components** — `FormantLogo`, `FormantLogoWithText`, `AIChat`, `KnowledgeGraph`
|
|
91
|
+
- **Theme provider** — `ThemeProvider` from next-themes (dark/light mode)
|
|
211
92
|
- **Charts** — Recharts components (BarChart, LineChart, PieChart, etc.)
|
|
212
93
|
- **Utilities** — `cn()` for class merging
|
|
213
94
|
|
|
@@ -230,11 +111,20 @@ npm run typecheck
|
|
|
230
111
|
## Architecture
|
|
231
112
|
|
|
232
113
|
- **Source**: TypeScript React components in `components/`
|
|
233
|
-
- **Build**: tsup compiles to `dist/index.js` + `dist/index.d.ts`
|
|
234
|
-
- **Styling**:
|
|
114
|
+
- **Build**: `tsup` compiles to `dist/index.js` + `dist/index.d.ts`
|
|
115
|
+
- **Styling**: Static CSS injected by `FormantAesthetics` component — no external CSS build step required
|
|
235
116
|
- **Distribution**: Published to npm as `@formant/aesthetics`
|
|
236
117
|
|
|
237
|
-
|
|
118
|
+
## Migration from Tailwind
|
|
119
|
+
|
|
120
|
+
If you were previously using the Tailwind version of @formant/aesthetics:
|
|
121
|
+
|
|
122
|
+
1. Remove Tailwind CSS from your project
|
|
123
|
+
2. Remove `@tailwindcss/postcss` from your PostCSS config
|
|
124
|
+
3. Remove the safelist copy script from your `postinstall`
|
|
125
|
+
4. Wrap your app with `FormantAesthetics` instead of importing CSS files
|
|
126
|
+
|
|
127
|
+
All component props and APIs remain exactly the same.
|
|
238
128
|
|
|
239
129
|
## License
|
|
240
130
|
|
package/dist/index.d.ts
CHANGED
|
@@ -443,10 +443,12 @@ declare function FormantLogoWithText({ logoSize, text, variant, orientation, gap
|
|
|
443
443
|
|
|
444
444
|
declare function ThemeProvider({ children, ...props }: React$1.ComponentProps<typeof ThemeProvider$1>): react_jsx_runtime.JSX.Element;
|
|
445
445
|
|
|
446
|
+
declare const FORMANT_FONTS = "https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@300;400;500&display=swap";
|
|
447
|
+
declare const FORMANT_COMPLETE_CSS: string;
|
|
446
448
|
declare function FormantAesthetics({ children }: {
|
|
447
449
|
children: React$1.ReactNode;
|
|
448
450
|
}): react_jsx_runtime.JSX.Element;
|
|
449
451
|
|
|
450
452
|
declare function cn(...inputs: ClassValue[]): string;
|
|
451
453
|
|
|
452
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, type CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, type ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuItem, ContextMenuLabel, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FormantAesthetics, FormantLogo, type FormantLogoProps, FormantLogoWithText, type FormantLogoWithTextProps, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Label, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Skeleton, Slider, Toaster as Sonner, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeProvider, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cn, navigationMenuTriggerStyle, toggleVariants };
|
|
454
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, type CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, type ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuItem, ContextMenuLabel, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FORMANT_COMPLETE_CSS, FORMANT_FONTS, FormantAesthetics, FormantLogo, type FormantLogoProps, FormantLogoWithText, type FormantLogoWithTextProps, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Label, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Skeleton, Slider, Toaster as Sonner, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeProvider, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cn, navigationMenuTriggerStyle, toggleVariants };
|