@the12company/ui 0.1.1 → 0.1.2
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 +163 -17
- package/dist/index.d.ts +25 -2
- package/dist/index.js +2312 -2252
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,37 +1,183 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @the12company/ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Capivara design system** — shared React components and design tokens for Vite and Next.js apps.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
One kit. Many products. Each app keeps its own brand color by overriding CSS variables.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
---
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
## What’s inside
|
|
10
|
+
|
|
11
|
+
| Layer | What you get |
|
|
12
|
+
| ----- | ------------ |
|
|
13
|
+
| **Tokens** | Colors, radius, sidebar, charts (`theme.css`) |
|
|
14
|
+
| **Utilities** | Shared classes like `bg-content-glass` |
|
|
15
|
+
| **Components** | Buttons, forms, dialogs, sidebar, chrome header, … |
|
|
16
|
+
| **Helpers** | `cn`, `useToast`, `useIsMobile` |
|
|
17
|
+
|
|
18
|
+
Lives in this monorepo at `packages/ui`. Published to npm as `@the12company/ui`.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Quick start (another app)
|
|
23
|
+
|
|
24
|
+
### 1. Install
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install @the12company/ui
|
|
13
28
|
```
|
|
14
29
|
|
|
30
|
+
Also install the **peer dependencies** for the components you use (React, Radix primitives, etc.). See `package.json` → `peerDependencies`.
|
|
31
|
+
|
|
32
|
+
### 2. Styles
|
|
33
|
+
|
|
34
|
+
In your global CSS:
|
|
35
|
+
|
|
15
36
|
```css
|
|
16
37
|
@import "@the12company/ui/tokens/theme.css";
|
|
38
|
+
@import "@the12company/ui/tokens/utilities.css";
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 3. Tailwind
|
|
42
|
+
|
|
43
|
+
Map semantic colors to the CSS variables (same pattern as this repo’s `tailwind.config.ts`), and include the package in `content` so classes aren’t purged:
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
content: [
|
|
47
|
+
"./src/**/*.{ts,tsx}",
|
|
48
|
+
"./node_modules/@the12company/ui/dist/**/*.{js,mjs}",
|
|
49
|
+
]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 4. Use components
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
import { Button, Card, AppChromeHeader } from "@the12company/ui";
|
|
56
|
+
|
|
57
|
+
export function Example() {
|
|
58
|
+
return (
|
|
59
|
+
<Card className="p-6">
|
|
60
|
+
<Button>Salvar</Button>
|
|
61
|
+
</Card>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Branding (your “main” color)
|
|
69
|
+
|
|
70
|
+
Components use **semantic** tokens (`bg-primary`, `text-destructive`, …) — never a hard-coded brand hex.
|
|
71
|
+
|
|
72
|
+
Override in your app:
|
|
73
|
+
|
|
74
|
+
```css
|
|
75
|
+
:root {
|
|
76
|
+
--primary: 160 84% 39%;
|
|
77
|
+
--primary-foreground: 0 0% 100%;
|
|
78
|
+
--ring: 160 84% 39%;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.dark {
|
|
82
|
+
--primary: 160 70% 45%;
|
|
83
|
+
--primary-foreground: 0 0% 100%;
|
|
84
|
+
}
|
|
17
85
|
```
|
|
18
86
|
|
|
19
|
-
|
|
87
|
+
Values are **HSL channels without `hsl()`** (e.g. `217 91% 50%`), matching Tailwind’s `hsl(var(--primary))` setup.
|
|
20
88
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
89
|
+
Neutral defaults live in `theme-contract.css`. This product’s palette is `theme.css`.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Layout chrome (structure only)
|
|
94
|
+
|
|
95
|
+
Floating glass header and sidebar shells — pass product UI as slots:
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
import {
|
|
99
|
+
AppChromeHeader,
|
|
100
|
+
AppChromeSidebar,
|
|
101
|
+
SidebarProvider,
|
|
102
|
+
SidebarTrigger,
|
|
103
|
+
} from "@the12company/ui";
|
|
104
|
+
|
|
105
|
+
<SidebarProvider>
|
|
106
|
+
<AppChromeSidebar
|
|
107
|
+
header={<YourBrand />}
|
|
108
|
+
footer={<YourAccountMenu />}
|
|
109
|
+
>
|
|
110
|
+
<YourNavLinks />
|
|
111
|
+
</AppChromeSidebar>
|
|
112
|
+
|
|
113
|
+
<AppChromeHeader
|
|
114
|
+
start={<SidebarTrigger />}
|
|
115
|
+
topBar={<YourTopBar />}
|
|
116
|
+
>
|
|
117
|
+
<YourFiltersOrTrialStrip />
|
|
118
|
+
</AppChromeHeader>
|
|
119
|
+
</SidebarProvider>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Primitives (`Sidebar`, `SidebarMenu`, `SidebarTrigger`, …) are also exported for custom layouts.
|
|
123
|
+
|
|
124
|
+
No routing or business logic inside the kit — only structure and look.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Developing in this repo
|
|
129
|
+
|
|
130
|
+
Day to day you **don’t need to publish**. Vite/TS resolve `@the12company/ui` to source.
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
import { Button } from "@the12company/ui";
|
|
134
|
+
// existing app paths still work:
|
|
135
|
+
import { Button } from "@/components/ui/button";
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Edit files under `packages/ui/src/`.
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Publishing a new version
|
|
143
|
+
|
|
144
|
+
Only needed when other repos should get updates.
|
|
145
|
+
|
|
146
|
+
1. Change code in `packages/ui/src/`
|
|
147
|
+
2. Bump `version` in `packages/ui/package.json` (e.g. `0.1.1` → `0.1.2`)
|
|
148
|
+
3. From the **repo root**:
|
|
24
149
|
|
|
25
150
|
```bash
|
|
26
151
|
npm run publish:ui
|
|
27
152
|
```
|
|
28
153
|
|
|
29
|
-
|
|
154
|
+
Requires `npm login` (or a local auth token). The GitHub `NPM_TOKEN` secret is optional if you only publish from your machine.
|
|
30
155
|
|
|
31
|
-
|
|
156
|
+
> Same version can’t be republished on npm — always bump first.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Package layout
|
|
32
161
|
|
|
33
|
-
```bash
|
|
34
|
-
npm install @the12company/ui
|
|
35
162
|
```
|
|
163
|
+
packages/ui/
|
|
164
|
+
├── src/
|
|
165
|
+
│ ├── components/ # UI primitives + AppChromeHeader
|
|
166
|
+
│ ├── hooks/ # useToast, useIsMobile
|
|
167
|
+
│ ├── lib/cn.ts
|
|
168
|
+
│ ├── tokens/
|
|
169
|
+
│ │ ├── theme.css # Capivara / QA brand
|
|
170
|
+
│ │ ├── theme-contract.css # token names + neutrals
|
|
171
|
+
│ │ └── utilities.css # bg-content-glass, …
|
|
172
|
+
│ └── index.ts
|
|
173
|
+
├── package.json
|
|
174
|
+
└── README.md
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Tips
|
|
36
180
|
|
|
37
|
-
|
|
181
|
+
- Prefer importing from `@the12company/ui` in new apps.
|
|
182
|
+
- Keep product pages, agents, and API logic **out** of this package.
|
|
183
|
+
- After adding a new shared component: export it from `src/index.ts`, bump version, publish.
|
package/dist/index.d.ts
CHANGED
|
@@ -127,6 +127,29 @@ type AppChromeHeaderProps = {
|
|
|
127
127
|
*/
|
|
128
128
|
declare function AppChromeHeader({ headerRef, className, start, topBar, children, }: AppChromeHeaderProps): React$1.JSX.Element;
|
|
129
129
|
|
|
130
|
+
type AppChromeSidebarProps = {
|
|
131
|
+
/** Brand / logo area at the top. */
|
|
132
|
+
header?: React$1.ReactNode;
|
|
133
|
+
/** Navigation (menus, links). */
|
|
134
|
+
children?: React$1.ReactNode;
|
|
135
|
+
/** Account / settings docked at the bottom. */
|
|
136
|
+
footer?: React$1.ReactNode;
|
|
137
|
+
/** Passed to underlying `Sidebar` (default `"icon"`). */
|
|
138
|
+
collapsible?: "offcanvas" | "icon" | "none";
|
|
139
|
+
className?: string;
|
|
140
|
+
contentClassName?: string;
|
|
141
|
+
/**
|
|
142
|
+
* On mobile / drawer mode, close the sheet when an in-app link is clicked.
|
|
143
|
+
* @default true
|
|
144
|
+
*/
|
|
145
|
+
closeOnNavigate?: boolean;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Structural app sidebar: header + scrollable nav + footer.
|
|
149
|
+
* Product nav items, brand, and account UI are passed as slots.
|
|
150
|
+
*/
|
|
151
|
+
declare function AppChromeSidebar({ header, children, footer, collapsible, className, contentClassName, closeOnNavigate, }: AppChromeSidebarProps): React$1.JSX.Element;
|
|
152
|
+
|
|
130
153
|
declare const AspectRatio: React$1.ForwardRefExoticComponent<AspectRatioPrimitive.AspectRatioProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
131
154
|
|
|
132
155
|
declare const Avatar: React$1.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarProps & React$1.RefAttributes<HTMLSpanElement>, "ref"> & React$1.RefAttributes<HTMLSpanElement>>;
|
|
@@ -621,7 +644,7 @@ declare const SheetClose: React$1.ForwardRefExoticComponent<DialogPrimitive.Dial
|
|
|
621
644
|
declare const SheetPortal: React$1.FC<DialogPrimitive.DialogPortalProps>;
|
|
622
645
|
declare const SheetOverlay: React$1.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
623
646
|
declare const sheetVariants: (props?: ({
|
|
624
|
-
side?: "top" | "bottom" | "
|
|
647
|
+
side?: "top" | "bottom" | "left" | "right" | null | undefined;
|
|
625
648
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
626
649
|
interface SheetContentProps extends React$1.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>, VariantProps<typeof sheetVariants> {
|
|
627
650
|
overlayClassName?: string;
|
|
@@ -773,4 +796,4 @@ declare const ToggleGroupItem: React$1.ForwardRefExoticComponent<Omit<ToggleGrou
|
|
|
773
796
|
size?: "default" | "sm" | "lg" | null | undefined;
|
|
774
797
|
} & class_variance_authority_types.ClassProp) | undefined) => string> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
775
798
|
|
|
776
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AppChromeHeader, type AppChromeHeaderProps, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, type ButtonProps, Calendar, type CalendarProps, Card, 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, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, 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, Dropdown, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, type InputProps, Label, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, 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, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Toaster$1 as SonnerToaster, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, type TableProps, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, type TextareaProps, Toast$1 as Toast, ToastAction, type ToastActionElement, ToastClose, ToastDescription, type ToastProps, ToastProvider, ToastTitle, ToastViewport, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cn, inputVariants, navigationMenuTriggerStyle, toast, toggleVariants, useFormField, useIsMobile, useSidebar, useToast };
|
|
799
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AppChromeHeader, type AppChromeHeaderProps, AppChromeSidebar, type AppChromeSidebarProps, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, type ButtonProps, Calendar, type CalendarProps, Card, 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, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, 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, Dropdown, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, type InputProps, Label, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, 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, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Toaster$1 as SonnerToaster, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, type TableProps, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, type TextareaProps, Toast$1 as Toast, ToastAction, type ToastActionElement, ToastClose, ToastDescription, type ToastProps, ToastProvider, ToastTitle, ToastViewport, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cn, inputVariants, navigationMenuTriggerStyle, toast, toggleVariants, useFormField, useIsMobile, useSidebar, useToast };
|