@cbrl/design 0.1.0 → 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/README.md CHANGED
@@ -25,9 +25,19 @@ this package.
25
25
  }
26
26
  ```
27
27
 
28
- Mount `next-themes`' `ThemeProvider` and `<Toaster />` in the root layout if you
29
- use dark mode or toasts. `next-themes` is a peer dependency so the app and the
30
- toaster share one theme state.
28
+ Mount `ThemeProvider` (a client wrapper over `next-themes`, same props) and
29
+ `<Toaster />` in the root layout if you use dark mode or toasts. `next-themes`
30
+ is a peer dependency so the app and the toaster share one theme state.
31
+
32
+ ```tsx
33
+ // src/app/layout.tsx
34
+ import { ThemeProvider, Toaster } from '@cbrl/design'
35
+
36
+ ;<ThemeProvider attribute="class" defaultTheme="system" enableSystem disableTransitionOnChange>
37
+ {children}
38
+ <Toaster />
39
+ </ThemeProvider>
40
+ ```
31
41
 
32
42
  ## Usage
33
43
 
@@ -38,6 +48,20 @@ import { Button, Input, Label } from '@cbrl/design'
38
48
  Every client component ships with its `'use client'` directive, so the package
39
49
  works from Server Components; the barrel itself is server-safe.
40
50
 
51
+ ### Icons and helpers
52
+
53
+ `WhatsappIcon` (`currentColor`) and `GoogleIcon` (multicolor "G") are
54
+ decorative by default; pass `title` to give them an accessible name. Size them
55
+ with a class (`className="size-4"`).
56
+
57
+ `initials(primary, fallback?)` derives avatar-fallback initials: the first
58
+ letters of the first two words, or the first two characters of a single word,
59
+ or `'?'`.
60
+
61
+ ```tsx
62
+ <AvatarFallback>{initials(user.name, user.email)}</AvatarFallback>
63
+ ```
64
+
41
65
  ### App shell
42
66
 
43
67
  `AppShell` renders the whole authenticated layout (collapsible sidebar with brand,
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { VariantProps } from "class-variance-authority";
3
3
  declare const badgeVariants: (props?: ({
4
- variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | "link" | null | undefined;
4
+ variant?: "default" | "secondary" | "destructive" | "outline" | "ghost" | "link" | null | undefined;
5
5
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
6
  declare function Badge({ className, variant, asChild, ...props }: React.ComponentProps<'span'> & VariantProps<typeof badgeVariants> & {
7
7
  asChild?: boolean;
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { VariantProps } from "class-variance-authority";
3
3
  declare const buttonVariants: (props?: ({
4
- variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | "link" | null | undefined;
4
+ variant?: "default" | "secondary" | "destructive" | "outline" | "ghost" | "link" | null | undefined;
5
5
  size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
6
6
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
7
  declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ /** Props shared by the brand icons: any `<svg>` prop plus an optional `title`. */
3
+ export type BrandIconProps = Omit<React.ComponentProps<'svg'>, 'children'> & {
4
+ /** Accessible name. Without it the icon is decorative (`aria-hidden`). */
5
+ title?: string;
6
+ };
@@ -0,0 +1,13 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ // src/components/icons/brand-icon.tsx
3
+ function BrandIcon({ title, viewBox, children, ...props }) {
4
+ return /* @__PURE__ */ jsxs("svg", {
5
+ xmlns: "http://www.w3.org/2000/svg",
6
+ viewBox,
7
+ focusable: "false",
8
+ ...title ? { role: "img" } : { "aria-hidden": true },
9
+ ...props,
10
+ children: [title ? /* @__PURE__ */ jsx("title", { children: title }) : null, children]
11
+ });
12
+ }
13
+ export { BrandIcon };
@@ -0,0 +1,7 @@
1
+ import { BrandIconProps } from "./brand-icon.js";
2
+ /**
3
+ * Multicolor Google "G" for "Continue with Google" buttons, sized by the
4
+ * caller. Decorative unless a `title` is given.
5
+ */
6
+ declare function GoogleIcon(props: BrandIconProps): import("react").JSX.Element;
7
+ export { GoogleIcon };
@@ -0,0 +1,33 @@
1
+ import { BrandIcon } from "./brand-icon.js";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ // src/components/icons/google-icon.tsx
4
+ /**
5
+ * Multicolor Google "G" for "Continue with Google" buttons, sized by the
6
+ * caller. Decorative unless a `title` is given.
7
+ */
8
+ function GoogleIcon(props) {
9
+ return /* @__PURE__ */ jsxs(BrandIcon, {
10
+ "data-slot": "google-icon",
11
+ viewBox: "0 0 18 18",
12
+ ...props,
13
+ children: [
14
+ /* @__PURE__ */ jsx("path", {
15
+ fill: "#4285F4",
16
+ d: "M17.64 9.205c0-.639-.057-1.252-.164-1.841H9v3.481h4.844a4.14 4.14 0 0 1-1.796 2.716v2.258h2.908c1.702-1.567 2.684-3.875 2.684-6.614Z"
17
+ }),
18
+ /* @__PURE__ */ jsx("path", {
19
+ fill: "#34A853",
20
+ d: "M9 18c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.837.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711H.957v2.332A8.997 8.997 0 0 0 9 18Z"
21
+ }),
22
+ /* @__PURE__ */ jsx("path", {
23
+ fill: "#FBBC05",
24
+ d: "M3.964 10.71A5.41 5.41 0 0 1 3.682 9c0-.593.102-1.17.282-1.71V4.958H.957A8.996 8.996 0 0 0 0 9c0 1.452.348 2.827.957 4.042l3.007-2.332Z"
25
+ }),
26
+ /* @__PURE__ */ jsx("path", {
27
+ fill: "#EA4335",
28
+ d: "M9 3.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C13.463.891 11.426 0 9 0A8.997 8.997 0 0 0 .957 4.958L3.964 7.29C4.672 5.163 6.656 3.58 9 3.58Z"
29
+ })
30
+ ]
31
+ });
32
+ }
33
+ export { GoogleIcon };
@@ -0,0 +1,7 @@
1
+ import { BrandIconProps } from "./brand-icon.js";
2
+ /**
3
+ * WhatsApp glyph in `currentColor`, sized by the caller (`className="size-4"`).
4
+ * Decorative unless a `title` is given.
5
+ */
6
+ declare function WhatsappIcon(props: BrandIconProps): import("react").JSX.Element;
7
+ export { WhatsappIcon };
@@ -0,0 +1,18 @@
1
+ import { BrandIcon } from "./brand-icon.js";
2
+ import { jsx } from "react/jsx-runtime";
3
+ // src/components/icons/whatsapp-icon.tsx
4
+ const PATH = "M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.297-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 0 1-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 0 1-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 0 1 2.893 6.994c-.003 5.45-4.437 9.885-9.885 9.885m8.413-18.297A11.815 11.815 0 0 0 12.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 0 0 5.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 0 0-3.48-8.413Z";
5
+ /**
6
+ * WhatsApp glyph in `currentColor`, sized by the caller (`className="size-4"`).
7
+ * Decorative unless a `title` is given.
8
+ */
9
+ function WhatsappIcon(props) {
10
+ return /* @__PURE__ */ jsx(BrandIcon, {
11
+ "data-slot": "whatsapp-icon",
12
+ viewBox: "0 0 24 24",
13
+ fill: "currentColor",
14
+ ...props,
15
+ children: /* @__PURE__ */ jsx("path", { d: PATH })
16
+ });
17
+ }
18
+ export { WhatsappIcon };
@@ -0,0 +1,15 @@
1
+ import * as React from "react";
2
+ import { ThemeProvider as ThemeProvider$1 } from "next-themes";
3
+ /**
4
+ * Client boundary around `next-themes`' provider, so a Server Component root
5
+ * layout can mount it. Props are passed through unchanged.
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * <ThemeProvider attribute="class" defaultTheme="system" enableSystem disableTransitionOnChange>
10
+ * {children}
11
+ * </ThemeProvider>
12
+ * ```
13
+ */
14
+ declare function ThemeProvider({ children, ...props }: React.ComponentProps<typeof ThemeProvider$1>): React.JSX.Element;
15
+ export { ThemeProvider };
@@ -0,0 +1,22 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { ThemeProvider as ThemeProvider$1 } from "next-themes";
4
+ // src/components/theme-provider.tsx
5
+ /**
6
+ * Client boundary around `next-themes`' provider, so a Server Component root
7
+ * layout can mount it. Props are passed through unchanged.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * <ThemeProvider attribute="class" defaultTheme="system" enableSystem disableTransitionOnChange>
12
+ * {children}
13
+ * </ThemeProvider>
14
+ * ```
15
+ */
16
+ function ThemeProvider({ children, ...props }) {
17
+ return /* @__PURE__ */ jsx(ThemeProvider$1, {
18
+ ...props,
19
+ children
20
+ });
21
+ }
22
+ export { ThemeProvider };
@@ -1,5 +1,8 @@
1
1
  import { DropdownMenuContent } from "./dropdown-menu.js";
2
2
  import * as React from "react";
3
+ /**
4
+ * @deprecated Use {@link initials}; this alias will be removed in the next minor.
5
+ */
3
6
  export declare function userMenuInitials(name: string | null, secondary: string | null): string;
4
7
  export type UserMenuProps = {
5
8
  /** Primary identity line (display name). */
@@ -1,15 +1,16 @@
1
1
  "use client";
2
+ import { initials } from "../lib/initials.js";
2
3
  import { Avatar, AvatarFallback, AvatarImage } from "./avatar.js";
3
4
  import { Button } from "./button.js";
4
5
  import { DropdownMenu, DropdownMenuContent, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "./dropdown-menu.js";
5
6
  import "react";
6
7
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
8
  // src/components/user-menu.tsx
9
+ /**
10
+ * @deprecated Use {@link initials}; this alias will be removed in the next minor.
11
+ */
8
12
  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
+ return initials(name, secondary);
13
14
  }
14
15
  function UserMenu({ name, secondary = null, avatarUrl = null, triggerLabel = "Account", trigger, align = "end", children }) {
15
16
  return /* @__PURE__ */ jsxs(DropdownMenu, {
@@ -26,7 +27,7 @@ function UserMenu({ name, secondary = null, avatarUrl = null, triggerLabel = "Ac
26
27
  children: [avatarUrl ? /* @__PURE__ */ jsx(AvatarImage, {
27
28
  src: avatarUrl,
28
29
  alt: name ?? secondary ?? ""
29
- }) : null, /* @__PURE__ */ jsx(AvatarFallback, { children: userMenuInitials(name, secondary) })]
30
+ }) : null, /* @__PURE__ */ jsx(AvatarFallback, { children: initials(name, secondary) })]
30
31
  })
31
32
  })
32
33
  }), /* @__PURE__ */ jsxs(DropdownMenuContent, {
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { cn } from "./lib/cn.js";
2
+ import { initials } from "./lib/initials.js";
2
3
  import { NavItem, NavMatch, NavSection, hasActiveChild, isActive } from "./lib/nav.js";
3
4
  import { AppShell, AppShellNavLink, AppShellProps } from "./components/app-shell.js";
4
5
  import { UserMenu, UserMenuProps, userMenuInitials } from "./components/user-menu.js";
@@ -19,6 +20,9 @@ import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMe
19
20
  import { EmptyState, EmptyStateProps } from "./components/empty-state.js";
20
21
  import { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle } from "./components/field.js";
21
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";
22
26
  import { Input } from "./components/input.js";
23
27
  import { InputGroup, InputGroupAddon, InputGroupInput } from "./components/input-group.js";
24
28
  import { Label } from "./components/label.js";
@@ -34,6 +38,7 @@ import { Switch } from "./components/switch.js";
34
38
  import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } from "./components/table.js";
35
39
  import { Tabs, TabsContent, TabsList, TabsTrigger } from "./components/tabs.js";
36
40
  import { Textarea } from "./components/textarea.js";
41
+ import { ThemeProvider } from "./components/theme-provider.js";
37
42
  import { Typography, typographyVariants } from "./components/typography.js";
38
43
  import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./components/collapsible.js";
39
44
  import { Popover, PopoverContent, PopoverTrigger } from "./components/popover.js";
@@ -45,4 +50,4 @@ import { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHe
45
50
  import "./components/sidebar.js";
46
51
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./components/tooltip.js";
47
52
  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 };
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 CHANGED
@@ -1,4 +1,5 @@
1
1
  import { cn } from "./lib/cn.js";
2
+ import { initials } from "./lib/initials.js";
2
3
  import { hasActiveChild, isActive } from "./lib/nav.js";
3
4
  import { AppShell } from "./components/app-shell.js";
4
5
  import { UserMenu, userMenuInitials } from "./components/user-menu.js";
@@ -17,6 +18,8 @@ import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMe
17
18
  import { EmptyState } from "./components/empty-state.js";
18
19
  import { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle } from "./components/field.js";
19
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";
20
23
  import { Input } from "./components/input.js";
21
24
  import { InputGroup, InputGroupAddon, InputGroupInput } from "./components/input-group.js";
22
25
  import { Label } from "./components/label.js";
@@ -32,6 +35,7 @@ import { Switch } from "./components/switch.js";
32
35
  import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } from "./components/table.js";
33
36
  import { Tabs, TabsContent, TabsList, TabsTrigger } from "./components/tabs.js";
34
37
  import { Textarea } from "./components/textarea.js";
38
+ import { ThemeProvider } from "./components/theme-provider.js";
35
39
  import { Typography, typographyVariants } from "./components/typography.js";
36
40
  import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./components/collapsible.js";
37
41
  import { Popover, PopoverContent, PopoverTrigger } from "./components/popover.js";
@@ -44,4 +48,4 @@ import { Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarInput, Si
44
48
  import { SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem } from "./components/sidebar-menu.js";
45
49
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./components/tooltip.js";
46
50
  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 };
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 };
@@ -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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cbrl/design",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Design system on Radix + Tailwind v4: shadcn-style components, layout shells and design tokens with an overridable brand accent.",
5
5
  "license": "MIT",
6
6
  "author": "Kayron Cabral",
@@ -71,9 +71,9 @@
71
71
  "tsdown": "^0.23.7",
72
72
  "typescript": "^5.9.3",
73
73
  "vitest": "^4.1.6",
74
- "@cbrl/eslint-config": "0.1.0",
74
+ "@cbrl/testing": "0.2.0",
75
75
  "@cbrl/tsconfig": "0.1.0",
76
- "@cbrl/testing": "0.1.0"
76
+ "@cbrl/eslint-config": "0.2.0"
77
77
  },
78
78
  "publishConfig": {
79
79
  "access": "public"