@cbrl/design 0.0.0-stage → 0.2.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 +124 -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/icons/brand-icon.d.ts +6 -0
- package/dist/components/icons/brand-icon.js +13 -0
- package/dist/components/icons/google-icon.d.ts +7 -0
- package/dist/components/icons/google-icon.js +33 -0
- package/dist/components/icons/whatsapp-icon.d.ts +7 -0
- package/dist/components/icons/whatsapp-icon.js +18 -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/theme-provider.d.ts +15 -0
- package/dist/components/theme-provider.js +22 -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 +27 -0
- package/dist/components/user-menu.js +49 -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 +53 -0
- package/dist/index.js +51 -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/initials.d.ts +8 -0
- package/dist/lib/initials.js +15 -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,45 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
// src/components/typography.tsx
|
|
6
|
+
const typographyVariants = cva("", {
|
|
7
|
+
variants: { variant: {
|
|
8
|
+
h1: "scroll-m-20 text-4xl font-extrabold tracking-tight text-balance",
|
|
9
|
+
h2: "scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0",
|
|
10
|
+
h3: "scroll-m-20 text-2xl font-semibold tracking-tight",
|
|
11
|
+
h4: "scroll-m-20 text-xl font-semibold tracking-tight",
|
|
12
|
+
pageTitle: "text-2xl font-semibold tracking-tight",
|
|
13
|
+
p: "leading-7 [&:not(:first-child)]:mt-6",
|
|
14
|
+
blockquote: "mt-6 border-l-2 pl-6 italic",
|
|
15
|
+
lead: "text-muted-foreground text-xl",
|
|
16
|
+
large: "text-lg font-semibold",
|
|
17
|
+
small: "text-sm leading-none font-medium",
|
|
18
|
+
muted: "text-muted-foreground text-sm",
|
|
19
|
+
code: "bg-muted relative rounded px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold"
|
|
20
|
+
} },
|
|
21
|
+
defaultVariants: { variant: "p" }
|
|
22
|
+
});
|
|
23
|
+
const DEFAULT_TAG = {
|
|
24
|
+
h1: "h1",
|
|
25
|
+
h2: "h2",
|
|
26
|
+
h3: "h3",
|
|
27
|
+
h4: "h4",
|
|
28
|
+
pageTitle: "h1",
|
|
29
|
+
p: "p",
|
|
30
|
+
blockquote: "blockquote",
|
|
31
|
+
lead: "p",
|
|
32
|
+
large: "div",
|
|
33
|
+
small: "small",
|
|
34
|
+
muted: "p",
|
|
35
|
+
code: "code"
|
|
36
|
+
};
|
|
37
|
+
function Typography({ variant, as, className, ...props }) {
|
|
38
|
+
const Comp = as ?? DEFAULT_TAG[variant ?? "p"];
|
|
39
|
+
return /* @__PURE__ */ jsx(Comp, {
|
|
40
|
+
"data-slot": "typography",
|
|
41
|
+
className: cn(typographyVariants({ variant }), className),
|
|
42
|
+
...props
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
export { Typography, typographyVariants };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DropdownMenuContent } from "./dropdown-menu.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use {@link initials}; this alias will be removed in the next minor.
|
|
5
|
+
*/
|
|
6
|
+
export declare function userMenuInitials(name: string | null, secondary: string | null): string;
|
|
7
|
+
export type UserMenuProps = {
|
|
8
|
+
/** Primary identity line (display name). */
|
|
9
|
+
name: string | null;
|
|
10
|
+
/** Secondary identity line (email / handle). */
|
|
11
|
+
secondary?: string | null;
|
|
12
|
+
/** Avatar image; falls back to initials when absent. */
|
|
13
|
+
avatarUrl?: string | null;
|
|
14
|
+
/** Accessible label for the avatar trigger (localize per app). */
|
|
15
|
+
triggerLabel?: string;
|
|
16
|
+
/** Custom trigger. When given, it replaces the default compact avatar button
|
|
17
|
+
* (e.g. a wide sidebar-footer button showing avatar + name + email + chevron).
|
|
18
|
+
* It is wrapped in `DropdownMenuTrigger asChild`, so it must forward props and
|
|
19
|
+
* ref to a single focusable element. Defaults to the compact avatar button. */
|
|
20
|
+
trigger?: React.ReactNode;
|
|
21
|
+
/** Dropdown alignment relative to the trigger. */
|
|
22
|
+
align?: React.ComponentProps<typeof DropdownMenuContent>['align'];
|
|
23
|
+
/** Account actions (`DropdownMenuItem`…) under the identity header. Sign-out
|
|
24
|
+
* and any links are wired by the consumer — this component is presentation. */
|
|
25
|
+
children: React.ReactNode;
|
|
26
|
+
};
|
|
27
|
+
export declare function UserMenu({ name, secondary, avatarUrl, triggerLabel, trigger, align, children }: UserMenuProps): React.JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { initials } from "../lib/initials.js";
|
|
3
|
+
import { Avatar, AvatarFallback, AvatarImage } from "./avatar.js";
|
|
4
|
+
import { Button } from "./button.js";
|
|
5
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "./dropdown-menu.js";
|
|
6
|
+
import "react";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
// src/components/user-menu.tsx
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Use {@link initials}; this alias will be removed in the next minor.
|
|
11
|
+
*/
|
|
12
|
+
function userMenuInitials(name, secondary) {
|
|
13
|
+
return initials(name, secondary);
|
|
14
|
+
}
|
|
15
|
+
function UserMenu({ name, secondary = null, avatarUrl = null, triggerLabel = "Account", trigger, align = "end", children }) {
|
|
16
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, {
|
|
17
|
+
modal: false,
|
|
18
|
+
children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
19
|
+
asChild: true,
|
|
20
|
+
children: trigger ?? /* @__PURE__ */ jsx(Button, {
|
|
21
|
+
variant: "ghost",
|
|
22
|
+
size: "icon-lg",
|
|
23
|
+
className: "rounded-full",
|
|
24
|
+
"aria-label": triggerLabel,
|
|
25
|
+
children: /* @__PURE__ */ jsxs(Avatar, {
|
|
26
|
+
size: "default",
|
|
27
|
+
children: [avatarUrl ? /* @__PURE__ */ jsx(AvatarImage, {
|
|
28
|
+
src: avatarUrl,
|
|
29
|
+
alt: name ?? secondary ?? ""
|
|
30
|
+
}) : null, /* @__PURE__ */ jsx(AvatarFallback, { children: initials(name, secondary) })]
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
34
|
+
align,
|
|
35
|
+
className: "w-56",
|
|
36
|
+
children: [name || secondary ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(DropdownMenuLabel, {
|
|
37
|
+
className: "flex flex-col gap-1 font-normal",
|
|
38
|
+
children: [name ? /* @__PURE__ */ jsx("span", {
|
|
39
|
+
className: "text-sm font-medium",
|
|
40
|
+
children: name
|
|
41
|
+
}) : null, secondary ? /* @__PURE__ */ jsx("span", {
|
|
42
|
+
className: "text-muted-foreground truncate text-xs",
|
|
43
|
+
children: secondary
|
|
44
|
+
}) : null]
|
|
45
|
+
}), /* @__PURE__ */ jsx(DropdownMenuSeparator, {})] }) : null, children]
|
|
46
|
+
})]
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
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,53 @@
|
|
|
1
|
+
import { cn } from "./lib/cn.js";
|
|
2
|
+
import { initials } from "./lib/initials.js";
|
|
3
|
+
import { NavItem, NavMatch, NavSection, hasActiveChild, isActive } from "./lib/nav.js";
|
|
4
|
+
import { AppShell, AppShellNavLink, AppShellProps } from "./components/app-shell.js";
|
|
5
|
+
import { UserMenu, UserMenuProps, userMenuInitials } from "./components/user-menu.js";
|
|
6
|
+
import { Calendar } from "./components/calendar.js";
|
|
7
|
+
import { Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarInput, SidebarInset, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar } from "./components/sidebar-core.js";
|
|
8
|
+
import { DateField, DateFieldProps } from "./components/date-field.js";
|
|
9
|
+
import { SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem } from "./components/sidebar-menu.js";
|
|
10
|
+
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger } from "./components/alert-dialog.js";
|
|
11
|
+
import { AuthSplitScreen, AuthSplitScreenProps } from "./components/auth-split-screen.js";
|
|
12
|
+
import { Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage } from "./components/avatar.js";
|
|
13
|
+
import { Badge, badgeVariants } from "./components/badge.js";
|
|
14
|
+
import { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from "./components/breadcrumb.js";
|
|
15
|
+
import { Button, buttonVariants } from "./components/button.js";
|
|
16
|
+
import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "./components/card.js";
|
|
17
|
+
import { Checkbox } from "./components/checkbox.js";
|
|
18
|
+
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from "./components/dialog.js";
|
|
19
|
+
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "./components/dropdown-menu.js";
|
|
20
|
+
import { EmptyState, EmptyStateProps } from "./components/empty-state.js";
|
|
21
|
+
import { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle } from "./components/field.js";
|
|
22
|
+
import { HighlightedTextarea } from "./components/highlighted-textarea.js";
|
|
23
|
+
import { BrandIconProps } from "./components/icons/brand-icon.js";
|
|
24
|
+
import { GoogleIcon } from "./components/icons/google-icon.js";
|
|
25
|
+
import { WhatsappIcon } from "./components/icons/whatsapp-icon.js";
|
|
26
|
+
import { Input } from "./components/input.js";
|
|
27
|
+
import { InputGroup, InputGroupAddon, InputGroupInput } from "./components/input-group.js";
|
|
28
|
+
import { Label } from "./components/label.js";
|
|
29
|
+
import { List, ListEmptyContent, ListFilterConfig, ListItem, ListItemActions, ListItemContent, ListItemDescription, ListItemDescriptor, ListItemLeading, ListItemMedia, ListItemMeta, ListItemTitle, ListItemTrailing, ListPaginationConfig, ListProps, ListSearchConfig, listItemVariants, listVariants } from "./components/list.js";
|
|
30
|
+
import { Main, mainVariants } from "./components/main.js";
|
|
31
|
+
import { Pagination, PaginationProps } from "./components/pagination.js";
|
|
32
|
+
import { RadioGroup, RadioGroupItem } from "./components/radio-group.js";
|
|
33
|
+
import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue } from "./components/select.js";
|
|
34
|
+
import { Skeleton } from "./components/skeleton.js";
|
|
35
|
+
import { Toaster } from "./components/sonner.js";
|
|
36
|
+
import { Stepper } from "./components/stepper.js";
|
|
37
|
+
import { Switch } from "./components/switch.js";
|
|
38
|
+
import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } from "./components/table.js";
|
|
39
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./components/tabs.js";
|
|
40
|
+
import { Textarea } from "./components/textarea.js";
|
|
41
|
+
import { ThemeProvider } from "./components/theme-provider.js";
|
|
42
|
+
import { Typography, typographyVariants } from "./components/typography.js";
|
|
43
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./components/collapsible.js";
|
|
44
|
+
import { Popover, PopoverContent, PopoverTrigger } from "./components/popover.js";
|
|
45
|
+
import { ScrollArea, ScrollBar } from "./components/scroll-area.js";
|
|
46
|
+
import { Separator } from "./components/separator.js";
|
|
47
|
+
import { SettingRow, SettingRowGroup } from "./components/setting-row.js";
|
|
48
|
+
import { SettingsSection } from "./components/settings-section.js";
|
|
49
|
+
import { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger } from "./components/sheet.js";
|
|
50
|
+
import "./components/sidebar.js";
|
|
51
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./components/tooltip.js";
|
|
52
|
+
import { useIsMobile } from "./hooks/use-mobile.js";
|
|
53
|
+
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, type BrandIconProps, 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, GoogleIcon, 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, ThemeProvider, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Typography, UserMenu, type UserMenuProps, WhatsappIcon, badgeVariants, buttonVariants, cn, hasActiveChild as hasActiveNavChild, initials, isActive as isNavItemActive, listItemVariants, listVariants, mainVariants, typographyVariants, useIsMobile, useSidebar, userMenuInitials };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { cn } from "./lib/cn.js";
|
|
2
|
+
import { initials } from "./lib/initials.js";
|
|
3
|
+
import { hasActiveChild, isActive } from "./lib/nav.js";
|
|
4
|
+
import { AppShell } from "./components/app-shell.js";
|
|
5
|
+
import { UserMenu, userMenuInitials } from "./components/user-menu.js";
|
|
6
|
+
import { Calendar } from "./components/calendar.js";
|
|
7
|
+
import { DateField } from "./components/date-field.js";
|
|
8
|
+
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger } from "./components/alert-dialog.js";
|
|
9
|
+
import { AuthSplitScreen } from "./components/auth-split-screen.js";
|
|
10
|
+
import { Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage } from "./components/avatar.js";
|
|
11
|
+
import { Badge, badgeVariants } from "./components/badge.js";
|
|
12
|
+
import { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from "./components/breadcrumb.js";
|
|
13
|
+
import { Button, buttonVariants } from "./components/button.js";
|
|
14
|
+
import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "./components/card.js";
|
|
15
|
+
import { Checkbox } from "./components/checkbox.js";
|
|
16
|
+
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from "./components/dialog.js";
|
|
17
|
+
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "./components/dropdown-menu.js";
|
|
18
|
+
import { EmptyState } from "./components/empty-state.js";
|
|
19
|
+
import { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle } from "./components/field.js";
|
|
20
|
+
import { HighlightedTextarea } from "./components/highlighted-textarea.js";
|
|
21
|
+
import { GoogleIcon } from "./components/icons/google-icon.js";
|
|
22
|
+
import { WhatsappIcon } from "./components/icons/whatsapp-icon.js";
|
|
23
|
+
import { Input } from "./components/input.js";
|
|
24
|
+
import { InputGroup, InputGroupAddon, InputGroupInput } from "./components/input-group.js";
|
|
25
|
+
import { Label } from "./components/label.js";
|
|
26
|
+
import { List, ListItem, ListItemActions, ListItemContent, ListItemDescription, ListItemLeading, ListItemMedia, ListItemMeta, ListItemTitle, ListItemTrailing, listItemVariants, listVariants } from "./components/list.js";
|
|
27
|
+
import { Main, mainVariants } from "./components/main.js";
|
|
28
|
+
import { Pagination } from "./components/pagination.js";
|
|
29
|
+
import { RadioGroup, RadioGroupItem } from "./components/radio-group.js";
|
|
30
|
+
import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue } from "./components/select.js";
|
|
31
|
+
import { Skeleton } from "./components/skeleton.js";
|
|
32
|
+
import { Toaster } from "./components/sonner.js";
|
|
33
|
+
import { Stepper } from "./components/stepper.js";
|
|
34
|
+
import { Switch } from "./components/switch.js";
|
|
35
|
+
import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } from "./components/table.js";
|
|
36
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./components/tabs.js";
|
|
37
|
+
import { Textarea } from "./components/textarea.js";
|
|
38
|
+
import { ThemeProvider } from "./components/theme-provider.js";
|
|
39
|
+
import { Typography, typographyVariants } from "./components/typography.js";
|
|
40
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./components/collapsible.js";
|
|
41
|
+
import { Popover, PopoverContent, PopoverTrigger } from "./components/popover.js";
|
|
42
|
+
import { ScrollArea, ScrollBar } from "./components/scroll-area.js";
|
|
43
|
+
import { Separator } from "./components/separator.js";
|
|
44
|
+
import { SettingRow, SettingRowGroup } from "./components/setting-row.js";
|
|
45
|
+
import { SettingsSection } from "./components/settings-section.js";
|
|
46
|
+
import { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger } from "./components/sheet.js";
|
|
47
|
+
import { Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarInput, SidebarInset, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar } from "./components/sidebar-core.js";
|
|
48
|
+
import { SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem } from "./components/sidebar-menu.js";
|
|
49
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./components/tooltip.js";
|
|
50
|
+
import { useIsMobile } from "./hooks/use-mobile.js";
|
|
51
|
+
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, GoogleIcon, 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, ThemeProvider, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Typography, UserMenu, WhatsappIcon, badgeVariants, buttonVariants, cn, hasActiveChild as hasActiveNavChild, initials, 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,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Up-to-two-letter uppercase initials for an avatar fallback, from the first
|
|
3
|
+
* non-blank of `primary` (display name) and `fallback` (email, handle…). Two
|
|
4
|
+
* or more words give the first letter of the first two (`'Ada Lovelace'` →
|
|
5
|
+
* `'AL'`); a single word gives its first two characters (`'ada@example.com'`
|
|
6
|
+
* → `'AD'`). Returns `'?'` when both are blank.
|
|
7
|
+
*/
|
|
8
|
+
export declare function initials(primary: string | null | undefined, fallback?: string | null): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/lib/initials.ts
|
|
2
|
+
/**
|
|
3
|
+
* Up-to-two-letter uppercase initials for an avatar fallback, from the first
|
|
4
|
+
* non-blank of `primary` (display name) and `fallback` (email, handle…). Two
|
|
5
|
+
* or more words give the first letter of the first two (`'Ada Lovelace'` →
|
|
6
|
+
* `'AL'`); a single word gives its first two characters (`'ada@example.com'`
|
|
7
|
+
* → `'AD'`). Returns `'?'` when both are blank.
|
|
8
|
+
*/
|
|
9
|
+
function initials(primary, fallback) {
|
|
10
|
+
const source = primary?.trim() || fallback?.trim() || "";
|
|
11
|
+
if (!source) return "?";
|
|
12
|
+
const [first, second] = source.split(/\s+/).map((word) => Array.from(word));
|
|
13
|
+
return (first && second ? [first[0], second[0]] : Array.from(source).slice(0, 2)).join("").toUpperCase();
|
|
14
|
+
}
|
|
15
|
+
export { initials };
|
|
@@ -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 };
|