@cbrl/design 0.2.0 → 0.4.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.
@@ -33,6 +33,15 @@ export type AppShellProps = {
33
33
  collapsible?: React.ComponentProps<typeof Sidebar>['collapsible'];
34
34
  /** Accessible label for the nav landmark. Defaults to `Navegação principal`. */
35
35
  navLabel?: string;
36
+ /** Whether the sidebar starts expanded (uncontrolled). Defaults to `true`. */
37
+ defaultOpen?: boolean;
38
+ /**
39
+ * Expanded state, controlled by the app together with `onOpenChange` — e.g.
40
+ * to remember the user's choice across reloads (persistence is the app's).
41
+ */
42
+ open?: boolean;
43
+ /** Fired with the new expanded state on every toggle. */
44
+ onOpenChange?: (open: boolean) => void;
36
45
  children: React.ReactNode;
37
46
  };
38
- export declare function AppShell({ brand, sections, pathname, renderNavLink, footer, account, headerStart, headerEnd, collapsible, navLabel, children }: AppShellProps): React.JSX.Element;
47
+ export declare function AppShell({ brand, sections, pathname, renderNavLink, footer, account, headerStart, headerEnd, collapsible, navLabel, defaultOpen, open, onOpenChange, children }: AppShellProps): React.JSX.Element;
@@ -6,34 +6,39 @@ import { TooltipProvider } from "./tooltip.js";
6
6
  import "react";
7
7
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
8
  // src/components/app-shell.tsx
9
- function AppShell({ brand, sections, pathname, renderNavLink, footer, account, headerStart, headerEnd, collapsible = "icon", navLabel = "Navegação principal", children }) {
9
+ function AppShell({ brand, sections, pathname, renderNavLink, footer, account, headerStart, headerEnd, collapsible = "icon", navLabel = "Navegação principal", defaultOpen = true, open, onOpenChange, children }) {
10
10
  return /* @__PURE__ */ jsx(TooltipProvider, {
11
11
  delayDuration: 0,
12
- children: /* @__PURE__ */ jsxs(SidebarProvider, { children: [/* @__PURE__ */ jsxs(Sidebar, {
13
- collapsible,
14
- children: [
15
- /* @__PURE__ */ jsx(SidebarHeader, { children: /* @__PURE__ */ jsx("div", {
16
- className: "flex items-center gap-2 px-2 py-1.5",
17
- children: brand
18
- }) }),
19
- /* @__PURE__ */ jsx(SidebarContent, { children: /* @__PURE__ */ jsx(ShellNav, {
20
- sections,
21
- pathname,
22
- renderNavLink,
23
- navLabel
24
- }) }),
25
- footer ? /* @__PURE__ */ jsx(SidebarFooter, { children: footer }) : null,
26
- /* @__PURE__ */ jsx(SidebarRail, {})
27
- ]
28
- }), /* @__PURE__ */ jsxs(SidebarInset, { children: [/* @__PURE__ */ jsx(ShellHeader, {
29
- account,
30
- headerStart,
31
- headerEnd
32
- }), /* @__PURE__ */ jsx("div", {
33
- "data-slot": "app-scroll",
34
- className: "min-h-0 flex-1 overflow-y-auto overscroll-contain",
35
- children
36
- })] })] })
12
+ children: /* @__PURE__ */ jsxs(SidebarProvider, {
13
+ defaultOpen,
14
+ open,
15
+ onOpenChange,
16
+ children: [/* @__PURE__ */ jsxs(Sidebar, {
17
+ collapsible,
18
+ children: [
19
+ /* @__PURE__ */ jsx(SidebarHeader, { children: /* @__PURE__ */ jsx("div", {
20
+ className: "flex items-center gap-2 px-2 py-1.5",
21
+ children: brand
22
+ }) }),
23
+ /* @__PURE__ */ jsx(SidebarContent, { children: /* @__PURE__ */ jsx(ShellNav, {
24
+ sections,
25
+ pathname,
26
+ renderNavLink,
27
+ navLabel
28
+ }) }),
29
+ footer ? /* @__PURE__ */ jsx(SidebarFooter, { children: footer }) : null,
30
+ /* @__PURE__ */ jsx(SidebarRail, {})
31
+ ]
32
+ }), /* @__PURE__ */ jsxs(SidebarInset, { children: [/* @__PURE__ */ jsx(ShellHeader, {
33
+ account,
34
+ headerStart,
35
+ headerEnd
36
+ }), /* @__PURE__ */ jsx("div", {
37
+ "data-slot": "app-scroll",
38
+ className: "min-h-0 flex-1 overflow-y-auto overscroll-contain",
39
+ children
40
+ })] })]
41
+ })
37
42
  });
38
43
  }
39
44
  function ShellHeader({ account, headerStart, headerEnd }) {
@@ -23,15 +23,15 @@ function Calendar({ className, classNames, showOutsideDays = true, captionLayout
23
23
  root: cn("w-fit", defaultClassNames.root),
24
24
  months: cn("relative flex flex-col gap-4 md:flex-row", defaultClassNames.months),
25
25
  month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
26
- nav: cn("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1", defaultClassNames.nav),
27
- button_previous: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_previous),
28
- button_next: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_next),
26
+ nav: cn("pointer-events-none absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1", defaultClassNames.nav),
27
+ button_previous: cn(buttonVariants({ variant: buttonVariant }), "pointer-events-auto size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_previous),
28
+ button_next: cn(buttonVariants({ variant: buttonVariant }), "pointer-events-auto size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_next),
29
29
  month_caption: cn("flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)", defaultClassNames.month_caption),
30
30
  dropdowns: cn("flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium", defaultClassNames.dropdowns),
31
31
  dropdown_root: cn("relative", defaultClassNames.dropdown_root),
32
32
  dropdown: defaultClassNames.dropdown,
33
33
  caption_label: cn("font-medium select-none", captionLayout === "label" ? "text-sm" : "[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pr-1 pl-2 text-sm [&>svg]:size-3.5", defaultClassNames.caption_label),
34
- table: "w-full border-collapse",
34
+ month_grid: cn("w-full border-collapse", defaultClassNames.month_grid),
35
35
  weekdays: cn("flex", defaultClassNames.weekdays),
36
36
  weekday: cn("text-muted-foreground flex-1 rounded-md text-[0.8rem] font-normal select-none", defaultClassNames.weekday),
37
37
  week: cn("mt-2 flex w-full", defaultClassNames.week),
@@ -258,7 +258,7 @@ function List({ items, getKey, renderItem, linkComponent, loading = false, loadi
258
258
  onClick: descriptor.onClick,
259
259
  "data-slot": "list-item",
260
260
  "data-interactive": true,
261
- className: interactiveClass,
261
+ className: cn(interactiveClass, "w-full text-left"),
262
262
  children: inner
263
263
  });
264
264
  else row = /* @__PURE__ */ jsx("div", {
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { VariantProps } from "class-variance-authority";
3
3
  declare const typographyVariants: (props?: ({
4
- variant?: "blockquote" | "code" | "h1" | "h2" | "h3" | "h4" | "p" | "small" | "pageTitle" | "lead" | "large" | "muted" | null | undefined;
4
+ variant?: "h1" | "h2" | "h3" | "h4" | "pageTitle" | "p" | "blockquote" | "lead" | "large" | "small" | "muted" | "code" | null | undefined;
5
5
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
6
  declare function Typography({ variant, as, className, ...props }: VariantProps<typeof typographyVariants> & {
7
7
  as?: React.ElementType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cbrl/design",
3
- "version": "0.2.0",
3
+ "version": "0.4.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",
@@ -37,11 +37,11 @@
37
37
  "dependencies": {
38
38
  "class-variance-authority": "^0.7.1",
39
39
  "clsx": "^2.1.1",
40
- "lucide-react": "^1.14.0",
40
+ "lucide-react": "^1.77.0",
41
41
  "radix-ui": "^1.4.3",
42
- "react-day-picker": "^9.14.0",
42
+ "react-day-picker": "^10.0.2",
43
43
  "sonner": "^2.0.7",
44
- "tailwind-merge": "^3.6.0",
44
+ "tailwind-merge": "^3.7.1",
45
45
  "tw-animate-css": "^1.4.0"
46
46
  },
47
47
  "peerDependencies": {
@@ -52,16 +52,16 @@
52
52
  },
53
53
  "devDependencies": {
54
54
  "@arethetypeswrong/cli": "^0.18.5",
55
- "@testing-library/jest-dom": "^6.9.1",
55
+ "@testing-library/jest-dom": "^7.0.1",
56
56
  "@testing-library/react": "^16.3.2",
57
- "@testing-library/user-event": "^14.6.1",
58
- "@types/node": "^25.6.2",
57
+ "@testing-library/user-event": "^14.6.13",
58
+ "@types/node": "^26.6.6",
59
59
  "@types/react": "^19.2.14",
60
60
  "@types/react-dom": "^19.2.3",
61
61
  "@vitejs/plugin-react": "^6.0.2",
62
- "@vitest/coverage-v8": "^4.1.6",
62
+ "@vitest/coverage-v8": "^5.1.1",
63
63
  "eslint": "^9.39.4",
64
- "jsdom": "^29.1.1",
64
+ "jsdom": "^31.0.1",
65
65
  "next-themes": "^0.4.6",
66
66
  "publint": "^0.3.25",
67
67
  "react": "^19.2.6",
@@ -69,11 +69,11 @@
69
69
  "shadcn": "^4.7.0",
70
70
  "tailwindcss": "^4.3.0",
71
71
  "tsdown": "^0.23.7",
72
- "typescript": "^5.9.3",
73
- "vitest": "^4.1.6",
74
- "@cbrl/testing": "0.2.0",
75
- "@cbrl/tsconfig": "0.1.0",
76
- "@cbrl/eslint-config": "0.2.0"
72
+ "typescript": "^6.0.3",
73
+ "vitest": "^5.1.1",
74
+ "@cbrl/eslint-config": "0.3.0",
75
+ "@cbrl/testing": "0.4.0",
76
+ "@cbrl/tsconfig": "0.1.1"
77
77
  },
78
78
  "publishConfig": {
79
79
  "access": "public"