@cbrl/design 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +100 -2
- package/dist/components/alert-dialog.d.ts +14 -0
- package/dist/components/alert-dialog.js +82 -0
- package/dist/components/app-shell.d.ts +38 -0
- package/dist/components/app-shell.js +72 -0
- package/dist/components/auth-split-screen.d.ts +30 -0
- package/dist/components/auth-split-screen.js +45 -0
- package/dist/components/avatar.d.ts +11 -0
- package/dist/components/avatar.js +50 -0
- package/dist/components/badge.d.ts +9 -0
- package/dist/components/badge.js +27 -0
- package/dist/components/breadcrumb.d.ts +11 -0
- package/dist/components/breadcrumb.js +69 -0
- package/dist/components/button.d.ts +10 -0
- package/dist/components/button.js +47 -0
- package/dist/components/calendar.d.ts +7 -0
- package/dist/components/calendar.js +142 -0
- package/dist/components/card.d.ts +13 -0
- package/dist/components/card.js +57 -0
- package/dist/components/checkbox.d.ts +4 -0
- package/dist/components/checkbox.js +20 -0
- package/dist/components/collapsible.d.ts +5 -0
- package/dist/components/collapsible.js +23 -0
- package/dist/components/date-field.d.ts +31 -0
- package/dist/components/date-field.js +129 -0
- package/dist/components/dialog.d.ts +17 -0
- package/dist/components/dialog.js +95 -0
- package/dist/components/dropdown-menu.d.ts +29 -0
- package/dist/components/dropdown-menu.js +127 -0
- package/dist/components/empty-state.d.ts +32 -0
- package/dist/components/empty-state.js +61 -0
- package/dist/components/field.d.ts +25 -0
- package/dist/components/field.js +121 -0
- package/dist/components/highlighted-textarea.d.ts +6 -0
- package/dist/components/highlighted-textarea.js +68 -0
- package/dist/components/input-group.d.ts +8 -0
- package/dist/components/input-group.js +28 -0
- package/dist/components/input.d.ts +3 -0
- package/dist/components/input.js +13 -0
- package/dist/components/label.d.ts +4 -0
- package/dist/components/label.js +14 -0
- package/dist/components/list.d.ts +174 -0
- package/dist/components/list.js +281 -0
- package/dist/components/main.d.ts +10 -0
- package/dist/components/main.js +36 -0
- package/dist/components/pagination.d.ts +25 -0
- package/dist/components/pagination.js +104 -0
- package/dist/components/popover.d.ts +6 -0
- package/dist/components/popover.js +28 -0
- package/dist/components/radio-group.d.ts +5 -0
- package/dist/components/radio-group.js +27 -0
- package/dist/components/scroll-area.d.ts +5 -0
- package/dist/components/scroll-area.js +35 -0
- package/dist/components/select.d.ts +15 -0
- package/dist/components/select.js +95 -0
- package/dist/components/separator.d.ts +4 -0
- package/dist/components/separator.js +16 -0
- package/dist/components/setting-row.d.ts +8 -0
- package/dist/components/setting-row.js +36 -0
- package/dist/components/settings-section.d.ts +7 -0
- package/dist/components/settings-section.js +36 -0
- package/dist/components/sheet.d.ts +14 -0
- package/dist/components/sheet.js +89 -0
- package/dist/components/sidebar-core.d.ts +33 -0
- package/dist/components/sidebar-core.js +220 -0
- package/dist/components/sidebar-menu.d.ts +38 -0
- package/dist/components/sidebar-menu.js +168 -0
- package/dist/components/sidebar.d.ts +3 -0
- package/dist/components/skeleton.d.ts +2 -0
- package/dist/components/skeleton.js +11 -0
- package/dist/components/sonner.d.ts +3 -0
- package/dist/components/sonner.js +31 -0
- package/dist/components/stepper.d.ts +8 -0
- package/dist/components/stepper.js +58 -0
- package/dist/components/switch.d.ts +6 -0
- package/dist/components/switch.js +19 -0
- package/dist/components/table.d.ts +10 -0
- package/dist/components/table.js +65 -0
- package/dist/components/tabs.d.ts +7 -0
- package/dist/components/tabs.js +35 -0
- package/dist/components/textarea.d.ts +3 -0
- package/dist/components/textarea.js +12 -0
- package/dist/components/tooltip.d.ts +7 -0
- package/dist/components/tooltip.js +35 -0
- package/dist/components/typography.d.ts +9 -0
- package/dist/components/typography.js +45 -0
- package/dist/components/user-menu.d.ts +24 -0
- package/dist/components/user-menu.js +48 -0
- package/dist/globals.css +60 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +17 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +47 -0
- package/dist/lib/cn.d.ts +2 -0
- package/dist/lib/cn.js +7 -0
- package/dist/lib/css-vars.js +5 -0
- package/dist/lib/date.js +38 -0
- package/dist/lib/nav.d.ts +15 -0
- package/dist/lib/nav.js +11 -0
- package/dist/lib/toaster-theme.js +5 -0
- package/dist/shadcn.css +635 -0
- package/dist/tokens.css +160 -0
- package/package.json +85 -3
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Avatar, AvatarFallback, AvatarImage } from "./avatar.js";
|
|
3
|
+
import { Button } from "./button.js";
|
|
4
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "./dropdown-menu.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
// src/components/user-menu.tsx
|
|
8
|
+
function userMenuInitials(name, secondary) {
|
|
9
|
+
const source = name?.trim() || secondary?.trim() || "";
|
|
10
|
+
if (!source) return "?";
|
|
11
|
+
const parts = source.split(/[\s@.]+/).filter(Boolean);
|
|
12
|
+
return ((parts[0]?.[0] ?? "") + (parts[1]?.[0] ?? "")).toUpperCase() || "?";
|
|
13
|
+
}
|
|
14
|
+
function UserMenu({ name, secondary = null, avatarUrl = null, triggerLabel = "Account", trigger, align = "end", children }) {
|
|
15
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, {
|
|
16
|
+
modal: false,
|
|
17
|
+
children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
18
|
+
asChild: true,
|
|
19
|
+
children: trigger ?? /* @__PURE__ */ jsx(Button, {
|
|
20
|
+
variant: "ghost",
|
|
21
|
+
size: "icon-lg",
|
|
22
|
+
className: "rounded-full",
|
|
23
|
+
"aria-label": triggerLabel,
|
|
24
|
+
children: /* @__PURE__ */ jsxs(Avatar, {
|
|
25
|
+
size: "default",
|
|
26
|
+
children: [avatarUrl ? /* @__PURE__ */ jsx(AvatarImage, {
|
|
27
|
+
src: avatarUrl,
|
|
28
|
+
alt: name ?? secondary ?? ""
|
|
29
|
+
}) : null, /* @__PURE__ */ jsx(AvatarFallback, { children: userMenuInitials(name, secondary) })]
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
33
|
+
align,
|
|
34
|
+
className: "w-56",
|
|
35
|
+
children: [name || secondary ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(DropdownMenuLabel, {
|
|
36
|
+
className: "flex flex-col gap-1 font-normal",
|
|
37
|
+
children: [name ? /* @__PURE__ */ jsx("span", {
|
|
38
|
+
className: "text-sm font-medium",
|
|
39
|
+
children: name
|
|
40
|
+
}) : null, secondary ? /* @__PURE__ */ jsx("span", {
|
|
41
|
+
className: "text-muted-foreground truncate text-xs",
|
|
42
|
+
children: secondary
|
|
43
|
+
}) : null]
|
|
44
|
+
}), /* @__PURE__ */ jsx(DropdownMenuSeparator, {})] }) : null, children]
|
|
45
|
+
})]
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
export { UserMenu, userMenuInitials };
|
package/dist/globals.css
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
@import 'tailwindcss';
|
|
2
|
+
@import 'tw-animate-css';
|
|
3
|
+
@import './shadcn.css';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Faz o Tailwind escanear os componentes do design system. Sem isso, classes
|
|
7
|
+
* usadas só dentro de @cbrl/design (ex.: `bg-primary` no Button) não são
|
|
8
|
+
* geradas no CSS final dos apps consumidores — Tailwind v4 ignora
|
|
9
|
+
* node_modules/symlinks por padrão.
|
|
10
|
+
*/
|
|
11
|
+
@source './**/*.{js,ts,tsx}';
|
|
12
|
+
|
|
13
|
+
@custom-variant dark (&:is(.dark *));
|
|
14
|
+
|
|
15
|
+
@import './tokens.css';
|
|
16
|
+
|
|
17
|
+
@layer base {
|
|
18
|
+
* {
|
|
19
|
+
@apply border-border outline-ring/50;
|
|
20
|
+
}
|
|
21
|
+
body {
|
|
22
|
+
@apply bg-background text-foreground font-sans;
|
|
23
|
+
}
|
|
24
|
+
/*
|
|
25
|
+
* Restore cursor:pointer on interactive elements — Tailwind v4 preflight
|
|
26
|
+
* removed the UA default to match macOS native, but on web it's expected
|
|
27
|
+
* behavior and case-by-case `cursor-pointer` rots fast. Disabled buttons and
|
|
28
|
+
* aria-disabled triggers keep the inherited default so the surface looks
|
|
29
|
+
* inert.
|
|
30
|
+
*/
|
|
31
|
+
button:not(:disabled),
|
|
32
|
+
[role='button']:not([aria-disabled='true']) {
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
}
|
|
35
|
+
html {
|
|
36
|
+
/*
|
|
37
|
+
* Scrollbar sempre presente — evita layout shift entre páginas curtas e
|
|
38
|
+
* longas. (Movimentamos pro html porque o body recebe overflow:hidden
|
|
39
|
+
* quando overlays Radix abrem.)
|
|
40
|
+
*/
|
|
41
|
+
overflow-y: scroll;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/*
|
|
46
|
+
* Neutraliza o shift de 15px do react-remove-scroll (lib usada por
|
|
47
|
+
* Dialog/DropdownMenu/Sheet/Toaster do Radix).
|
|
48
|
+
*
|
|
49
|
+
* Ao abrir, o Radix injeta uma stylesheet com `body[data-scroll-locked] {
|
|
50
|
+
* margin-right: <scrollbar-width>px !important }` pra compensar a remoção do
|
|
51
|
+
* scrollbar do body. Como nossa scrollbar mora no html (regra acima), nunca
|
|
52
|
+
* há barra no body pra compensar — mas a heurística da lib (innerWidth -
|
|
53
|
+
* documentElement.clientWidth) lê 15px mesmo assim e shifta o conteúdo.
|
|
54
|
+
*
|
|
55
|
+
* O `!important` aqui não é estilo — é o único jeito CSS de derrotar o
|
|
56
|
+
* `!important` upstream da lib.
|
|
57
|
+
*/
|
|
58
|
+
html body[data-scroll-locked] {
|
|
59
|
+
margin-right: 0 !important;
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useIsMobile(): boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
// src/hooks/use-mobile.ts
|
|
3
|
+
const MOBILE_BREAKPOINT = 768;
|
|
4
|
+
function useIsMobile() {
|
|
5
|
+
const [isMobile, setIsMobile] = React.useState(void 0);
|
|
6
|
+
React.useEffect(() => {
|
|
7
|
+
const mql = window.matchMedia(`(max-width: 767px)`);
|
|
8
|
+
const onChange = () => {
|
|
9
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
10
|
+
};
|
|
11
|
+
mql.addEventListener("change", onChange);
|
|
12
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
13
|
+
return () => mql.removeEventListener("change", onChange);
|
|
14
|
+
}, []);
|
|
15
|
+
return !!isMobile;
|
|
16
|
+
}
|
|
17
|
+
export { useIsMobile };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { cn } from "./lib/cn.js";
|
|
2
|
+
import { NavItem, NavMatch, NavSection, hasActiveChild, isActive } from "./lib/nav.js";
|
|
3
|
+
import { AppShell, AppShellNavLink, AppShellProps } from "./components/app-shell.js";
|
|
4
|
+
import { UserMenu, UserMenuProps, userMenuInitials } from "./components/user-menu.js";
|
|
5
|
+
import { Calendar } from "./components/calendar.js";
|
|
6
|
+
import { Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarInput, SidebarInset, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar } from "./components/sidebar-core.js";
|
|
7
|
+
import { DateField, DateFieldProps } from "./components/date-field.js";
|
|
8
|
+
import { SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem } from "./components/sidebar-menu.js";
|
|
9
|
+
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger } from "./components/alert-dialog.js";
|
|
10
|
+
import { AuthSplitScreen, AuthSplitScreenProps } from "./components/auth-split-screen.js";
|
|
11
|
+
import { Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage } from "./components/avatar.js";
|
|
12
|
+
import { Badge, badgeVariants } from "./components/badge.js";
|
|
13
|
+
import { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from "./components/breadcrumb.js";
|
|
14
|
+
import { Button, buttonVariants } from "./components/button.js";
|
|
15
|
+
import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "./components/card.js";
|
|
16
|
+
import { Checkbox } from "./components/checkbox.js";
|
|
17
|
+
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from "./components/dialog.js";
|
|
18
|
+
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "./components/dropdown-menu.js";
|
|
19
|
+
import { EmptyState, EmptyStateProps } from "./components/empty-state.js";
|
|
20
|
+
import { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle } from "./components/field.js";
|
|
21
|
+
import { HighlightedTextarea } from "./components/highlighted-textarea.js";
|
|
22
|
+
import { Input } from "./components/input.js";
|
|
23
|
+
import { InputGroup, InputGroupAddon, InputGroupInput } from "./components/input-group.js";
|
|
24
|
+
import { Label } from "./components/label.js";
|
|
25
|
+
import { List, ListEmptyContent, ListFilterConfig, ListItem, ListItemActions, ListItemContent, ListItemDescription, ListItemDescriptor, ListItemLeading, ListItemMedia, ListItemMeta, ListItemTitle, ListItemTrailing, ListPaginationConfig, ListProps, ListSearchConfig, listItemVariants, listVariants } from "./components/list.js";
|
|
26
|
+
import { Main, mainVariants } from "./components/main.js";
|
|
27
|
+
import { Pagination, PaginationProps } from "./components/pagination.js";
|
|
28
|
+
import { RadioGroup, RadioGroupItem } from "./components/radio-group.js";
|
|
29
|
+
import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue } from "./components/select.js";
|
|
30
|
+
import { Skeleton } from "./components/skeleton.js";
|
|
31
|
+
import { Toaster } from "./components/sonner.js";
|
|
32
|
+
import { Stepper } from "./components/stepper.js";
|
|
33
|
+
import { Switch } from "./components/switch.js";
|
|
34
|
+
import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } from "./components/table.js";
|
|
35
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./components/tabs.js";
|
|
36
|
+
import { Textarea } from "./components/textarea.js";
|
|
37
|
+
import { Typography, typographyVariants } from "./components/typography.js";
|
|
38
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./components/collapsible.js";
|
|
39
|
+
import { Popover, PopoverContent, PopoverTrigger } from "./components/popover.js";
|
|
40
|
+
import { ScrollArea, ScrollBar } from "./components/scroll-area.js";
|
|
41
|
+
import { Separator } from "./components/separator.js";
|
|
42
|
+
import { SettingRow, SettingRowGroup } from "./components/setting-row.js";
|
|
43
|
+
import { SettingsSection } from "./components/settings-section.js";
|
|
44
|
+
import { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger } from "./components/sheet.js";
|
|
45
|
+
import "./components/sidebar.js";
|
|
46
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./components/tooltip.js";
|
|
47
|
+
import { useIsMobile } from "./hooks/use-mobile.js";
|
|
48
|
+
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AppShell, type AppShellNavLink, type AppShellProps, AuthSplitScreen, type AuthSplitScreenProps, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, DateField, type DateFieldProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, type EmptyStateProps, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, HighlightedTextarea, Input, InputGroup, InputGroupAddon, InputGroupInput, Label, List, type ListEmptyContent, type ListFilterConfig, ListItem, ListItemActions, ListItemContent, ListItemDescription, type ListItemDescriptor, ListItemLeading, ListItemMedia, ListItemMeta, ListItemTitle, ListItemTrailing, type ListPaginationConfig, type ListProps, type ListSearchConfig, Main, type NavItem, type NavMatch, type NavSection, Pagination, type PaginationProps, Popover, PopoverContent, PopoverTrigger, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, SettingRow, SettingRowGroup, SettingsSection, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, 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, Stepper, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Typography, UserMenu, type UserMenuProps, badgeVariants, buttonVariants, cn, hasActiveChild as hasActiveNavChild, isActive as isNavItemActive, listItemVariants, listVariants, mainVariants, typographyVariants, useIsMobile, useSidebar, userMenuInitials };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { cn } from "./lib/cn.js";
|
|
2
|
+
import { hasActiveChild, isActive } from "./lib/nav.js";
|
|
3
|
+
import { AppShell } from "./components/app-shell.js";
|
|
4
|
+
import { UserMenu, userMenuInitials } from "./components/user-menu.js";
|
|
5
|
+
import { Calendar } from "./components/calendar.js";
|
|
6
|
+
import { DateField } from "./components/date-field.js";
|
|
7
|
+
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger } from "./components/alert-dialog.js";
|
|
8
|
+
import { AuthSplitScreen } from "./components/auth-split-screen.js";
|
|
9
|
+
import { Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage } from "./components/avatar.js";
|
|
10
|
+
import { Badge, badgeVariants } from "./components/badge.js";
|
|
11
|
+
import { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from "./components/breadcrumb.js";
|
|
12
|
+
import { Button, buttonVariants } from "./components/button.js";
|
|
13
|
+
import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "./components/card.js";
|
|
14
|
+
import { Checkbox } from "./components/checkbox.js";
|
|
15
|
+
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from "./components/dialog.js";
|
|
16
|
+
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "./components/dropdown-menu.js";
|
|
17
|
+
import { EmptyState } from "./components/empty-state.js";
|
|
18
|
+
import { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle } from "./components/field.js";
|
|
19
|
+
import { HighlightedTextarea } from "./components/highlighted-textarea.js";
|
|
20
|
+
import { Input } from "./components/input.js";
|
|
21
|
+
import { InputGroup, InputGroupAddon, InputGroupInput } from "./components/input-group.js";
|
|
22
|
+
import { Label } from "./components/label.js";
|
|
23
|
+
import { List, ListItem, ListItemActions, ListItemContent, ListItemDescription, ListItemLeading, ListItemMedia, ListItemMeta, ListItemTitle, ListItemTrailing, listItemVariants, listVariants } from "./components/list.js";
|
|
24
|
+
import { Main, mainVariants } from "./components/main.js";
|
|
25
|
+
import { Pagination } from "./components/pagination.js";
|
|
26
|
+
import { RadioGroup, RadioGroupItem } from "./components/radio-group.js";
|
|
27
|
+
import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue } from "./components/select.js";
|
|
28
|
+
import { Skeleton } from "./components/skeleton.js";
|
|
29
|
+
import { Toaster } from "./components/sonner.js";
|
|
30
|
+
import { Stepper } from "./components/stepper.js";
|
|
31
|
+
import { Switch } from "./components/switch.js";
|
|
32
|
+
import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } from "./components/table.js";
|
|
33
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./components/tabs.js";
|
|
34
|
+
import { Textarea } from "./components/textarea.js";
|
|
35
|
+
import { Typography, typographyVariants } from "./components/typography.js";
|
|
36
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./components/collapsible.js";
|
|
37
|
+
import { Popover, PopoverContent, PopoverTrigger } from "./components/popover.js";
|
|
38
|
+
import { ScrollArea, ScrollBar } from "./components/scroll-area.js";
|
|
39
|
+
import { Separator } from "./components/separator.js";
|
|
40
|
+
import { SettingRow, SettingRowGroup } from "./components/setting-row.js";
|
|
41
|
+
import { SettingsSection } from "./components/settings-section.js";
|
|
42
|
+
import { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger } from "./components/sheet.js";
|
|
43
|
+
import { Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarInput, SidebarInset, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar } from "./components/sidebar-core.js";
|
|
44
|
+
import { SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem } from "./components/sidebar-menu.js";
|
|
45
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./components/tooltip.js";
|
|
46
|
+
import { useIsMobile } from "./hooks/use-mobile.js";
|
|
47
|
+
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AppShell, AuthSplitScreen, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, DateField, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, HighlightedTextarea, Input, InputGroup, InputGroupAddon, InputGroupInput, Label, List, ListItem, ListItemActions, ListItemContent, ListItemDescription, ListItemLeading, ListItemMedia, ListItemMeta, ListItemTitle, ListItemTrailing, Main, Pagination, Popover, PopoverContent, PopoverTrigger, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, SettingRow, SettingRowGroup, SettingsSection, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, 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, Stepper, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Typography, UserMenu, badgeVariants, buttonVariants, cn, hasActiveChild as hasActiveNavChild, isActive as isNavItemActive, listItemVariants, listVariants, mainVariants, typographyVariants, useIsMobile, useSidebar, userMenuInitials };
|
package/dist/lib/cn.d.ts
ADDED
package/dist/lib/cn.js
ADDED
package/dist/lib/date.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// src/lib/date.ts
|
|
2
|
+
const ISO_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
3
|
+
const BR_RE = /^\d{2}\/\d{2}\/\d{4}$/;
|
|
4
|
+
function isValidYmd(year, month, day) {
|
|
5
|
+
const dt = new Date(year, month - 1, day);
|
|
6
|
+
return dt.getFullYear() === year && dt.getMonth() === month - 1;
|
|
7
|
+
}
|
|
8
|
+
function isoToBrDate(iso) {
|
|
9
|
+
if (!ISO_RE.test(iso)) return "";
|
|
10
|
+
const year = iso.slice(0, 4);
|
|
11
|
+
const month = iso.slice(5, 7);
|
|
12
|
+
const day = iso.slice(8, 10);
|
|
13
|
+
return isValidYmd(+year, +month, +day) ? `${day}/${month}/${year}` : "";
|
|
14
|
+
}
|
|
15
|
+
function brDateToIso(br) {
|
|
16
|
+
if (!BR_RE.test(br)) return "";
|
|
17
|
+
const day = br.slice(0, 2);
|
|
18
|
+
const month = br.slice(3, 5);
|
|
19
|
+
const year = br.slice(6, 10);
|
|
20
|
+
return isValidYmd(+year, +month, +day) ? `${year}-${month}-${day}` : "";
|
|
21
|
+
}
|
|
22
|
+
function maskBrDate(value) {
|
|
23
|
+
const digits = value.replace(/\D/g, "").slice(0, 8);
|
|
24
|
+
if (digits.length <= 2) return digits;
|
|
25
|
+
if (digits.length <= 4) return `${digits.slice(0, 2)}/${digits.slice(2)}`;
|
|
26
|
+
return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4)}`;
|
|
27
|
+
}
|
|
28
|
+
function dateToIso(date) {
|
|
29
|
+
return `${String(date.getFullYear()).padStart(4, "0")}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
|
|
30
|
+
}
|
|
31
|
+
function isoToDate(iso) {
|
|
32
|
+
if (!ISO_RE.test(iso)) return void 0;
|
|
33
|
+
const year = +iso.slice(0, 4);
|
|
34
|
+
const month = +iso.slice(5, 7);
|
|
35
|
+
const day = +iso.slice(8, 10);
|
|
36
|
+
return isValidYmd(year, month, day) ? new Date(year, month - 1, day, 12) : void 0;
|
|
37
|
+
}
|
|
38
|
+
export { brDateToIso, dateToIso, isoToBrDate, isoToDate, maskBrDate };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LucideIcon } from "lucide-react";
|
|
2
|
+
export type NavMatch = 'exact' | 'prefix';
|
|
3
|
+
export type NavItem = {
|
|
4
|
+
href: string;
|
|
5
|
+
label: string;
|
|
6
|
+
icon: LucideIcon;
|
|
7
|
+
match: NavMatch;
|
|
8
|
+
children?: NavItem[];
|
|
9
|
+
};
|
|
10
|
+
export type NavSection = {
|
|
11
|
+
label: string;
|
|
12
|
+
items: NavItem[];
|
|
13
|
+
};
|
|
14
|
+
export declare function isActive(item: NavItem, pathname: string): boolean;
|
|
15
|
+
export declare function hasActiveChild(item: NavItem, pathname: string): boolean;
|
package/dist/lib/nav.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// src/lib/nav.ts
|
|
2
|
+
function isActive(item, pathname) {
|
|
3
|
+
const queryIndex = item.href.indexOf("?");
|
|
4
|
+
const path = queryIndex === -1 ? item.href : item.href.slice(0, queryIndex);
|
|
5
|
+
if (item.match === "exact") return pathname === path;
|
|
6
|
+
return pathname === path || pathname.startsWith(`${path}/`);
|
|
7
|
+
}
|
|
8
|
+
function hasActiveChild(item, pathname) {
|
|
9
|
+
return item.children?.some((c) => isActive(c, pathname)) ?? false;
|
|
10
|
+
}
|
|
11
|
+
export { hasActiveChild, isActive };
|