@cbrl/design 0.8.0 → 0.9.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 +53 -0
- package/dist/components/container.d.ts +19 -0
- package/dist/components/container.js +46 -0
- package/dist/components/dialog.d.ts +6 -2
- package/dist/components/dialog.js +4 -4
- package/dist/components/page-header.d.ts +24 -0
- package/dist/components/page-header.js +42 -0
- package/dist/components/sheet.d.ts +3 -1
- package/dist/components/sheet.js +2 -2
- package/dist/components/theme-toggle.d.ts +22 -0
- package/dist/components/theme-toggle.js +60 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -181,6 +181,59 @@ import { ChevronDown } from 'lucide-react'
|
|
|
181
181
|
</ButtonGroup>
|
|
182
182
|
```
|
|
183
183
|
|
|
184
|
+
### Page layout
|
|
185
|
+
|
|
186
|
+
`Container` centers content and caps its width; `gutter` adds the horizontal
|
|
187
|
+
padding (vertical spacing stays with the caller). Use `asChild` to render a
|
|
188
|
+
semantic element.
|
|
189
|
+
|
|
190
|
+
| `size` | max width | | `gutter` | padding |
|
|
191
|
+
| ------- | ---------------- | --- | -------- | ------------------------ |
|
|
192
|
+
| `prose` | 840px | | `none` | — (default) |
|
|
193
|
+
| `sm` | 1120px | | `sm` | `px-6` |
|
|
194
|
+
| `md` | 1200px (default) | | `md` | `px-6 sm:px-10 lg:px-14` |
|
|
195
|
+
| `lg` | 1280px | | | |
|
|
196
|
+
| `xl` | 1600px | | | |
|
|
197
|
+
|
|
198
|
+
```tsx
|
|
199
|
+
import { Container, PageHeader, PageHeaderSkeleton, Button } from '@cbrl/design'
|
|
200
|
+
|
|
201
|
+
<Container asChild size="xl" className="px-4 py-5 md:px-6 md:py-8">
|
|
202
|
+
<main>
|
|
203
|
+
<PageHeader
|
|
204
|
+
title="Imóveis"
|
|
205
|
+
description="Gerencie seus imóveis."
|
|
206
|
+
actions={<Button>Novo imóvel</Button>}
|
|
207
|
+
className="mb-6 md:mb-8"
|
|
208
|
+
/>
|
|
209
|
+
</main>
|
|
210
|
+
</Container>
|
|
211
|
+
|
|
212
|
+
// loading.tsx
|
|
213
|
+
<PageHeaderSkeleton titleWidth="w-32" descriptionWidth={null} />
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Theme toggle
|
|
217
|
+
|
|
218
|
+
`ThemeToggle` flips light/dark through `next-themes` (mount `ThemeProvider`).
|
|
219
|
+
`variant="icon"` (default) is a ghost sun/moon button; `variant="text"` is a mono
|
|
220
|
+
uppercase label. Labels default to pt-BR and are overridable via `labels`.
|
|
221
|
+
|
|
222
|
+
```tsx
|
|
223
|
+
<ThemeToggle
|
|
224
|
+
variant="text"
|
|
225
|
+
labels={{
|
|
226
|
+
light: 'light',
|
|
227
|
+
dark: 'dark',
|
|
228
|
+
switchToLight: 'Switch to light theme',
|
|
229
|
+
switchToDark: 'Switch to dark theme',
|
|
230
|
+
}}
|
|
231
|
+
/>
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
`SheetContent`, `DialogContent` and `DialogFooter` take `closeLabel` to localize
|
|
235
|
+
their built-in close button (default `"Close"`).
|
|
236
|
+
|
|
184
237
|
### App shell
|
|
185
238
|
|
|
186
239
|
`AppShell` renders the whole authenticated layout (collapsible sidebar with brand,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
/**
|
|
4
|
+
* Horizontal page container: centers content, caps its width and (optionally)
|
|
5
|
+
* applies the horizontal gutter. Vertical spacing is the caller's job.
|
|
6
|
+
*
|
|
7
|
+
* Widths: `prose` 840px · `sm` 1120px · `md` 1200px · `lg` 1280px · `xl` 1600px.
|
|
8
|
+
* Gutters: `none` · `sm` (px-6) · `md` (px-6 → sm:px-10 → lg:px-14).
|
|
9
|
+
*/
|
|
10
|
+
declare const containerVariants: (props?: ({
|
|
11
|
+
size?: "sm" | "lg" | "prose" | "md" | "xl" | null | undefined;
|
|
12
|
+
gutter?: "sm" | "md" | "none" | null | undefined;
|
|
13
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
14
|
+
type ContainerProps = React.ComponentProps<'div'> & VariantProps<typeof containerVariants> & {
|
|
15
|
+
/** Render the single child (e.g. `<main>`, `<section>`) with the container classes. */
|
|
16
|
+
asChild?: boolean;
|
|
17
|
+
};
|
|
18
|
+
declare function Container({ className, size, gutter, asChild, ...props }: ContainerProps): React.JSX.Element;
|
|
19
|
+
export { Container, type ContainerProps, containerVariants };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { Slot } from "radix-ui";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
// src/components/container.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Horizontal page container: centers content, caps its width and (optionally)
|
|
9
|
+
* applies the horizontal gutter. Vertical spacing is the caller's job.
|
|
10
|
+
*
|
|
11
|
+
* Widths: `prose` 840px · `sm` 1120px · `md` 1200px · `lg` 1280px · `xl` 1600px.
|
|
12
|
+
* Gutters: `none` · `sm` (px-6) · `md` (px-6 → sm:px-10 → lg:px-14).
|
|
13
|
+
*/
|
|
14
|
+
const containerVariants = cva("mx-auto w-full", {
|
|
15
|
+
variants: {
|
|
16
|
+
size: {
|
|
17
|
+
prose: "max-w-[840px]",
|
|
18
|
+
sm: "max-w-[1120px]",
|
|
19
|
+
md: "max-w-[1200px]",
|
|
20
|
+
lg: "max-w-[1280px]",
|
|
21
|
+
xl: "max-w-[1600px]"
|
|
22
|
+
},
|
|
23
|
+
gutter: {
|
|
24
|
+
none: "",
|
|
25
|
+
sm: "px-6",
|
|
26
|
+
md: "px-6 sm:px-10 lg:px-14"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: {
|
|
30
|
+
size: "md",
|
|
31
|
+
gutter: "none"
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
function Container({ className, size, gutter, asChild = false, ...props }) {
|
|
35
|
+
const Comp = asChild ? Slot.Root : "div";
|
|
36
|
+
return /* @__PURE__ */ jsx(Comp, {
|
|
37
|
+
"data-slot": "container",
|
|
38
|
+
"data-size": size ?? "md",
|
|
39
|
+
className: cn(containerVariants({
|
|
40
|
+
size,
|
|
41
|
+
gutter
|
|
42
|
+
}), className),
|
|
43
|
+
...props
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export { Container, containerVariants };
|
|
@@ -5,11 +5,15 @@ declare function DialogTrigger({ ...props }: React.ComponentProps<typeof Dialog$
|
|
|
5
5
|
declare function DialogPortal({ ...props }: React.ComponentProps<typeof Dialog$1.Portal>): React.JSX.Element;
|
|
6
6
|
declare function DialogClose({ ...props }: React.ComponentProps<typeof Dialog$1.Close>): React.JSX.Element;
|
|
7
7
|
declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof Dialog$1.Overlay>): React.JSX.Element;
|
|
8
|
-
declare function DialogContent({ className, children, showCloseButton, ...props }: React.ComponentProps<typeof Dialog$1.Content> & {
|
|
8
|
+
declare function DialogContent({ className, children, showCloseButton, closeLabel, ...props }: React.ComponentProps<typeof Dialog$1.Content> & {
|
|
9
|
+
/** Accessible label of the built-in close button. */
|
|
10
|
+
closeLabel?: string;
|
|
9
11
|
showCloseButton?: boolean;
|
|
10
12
|
}): React.JSX.Element;
|
|
11
13
|
declare function DialogHeader({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
12
|
-
declare function DialogFooter({ className, showCloseButton, children, ...props }: React.ComponentProps<'div'> & {
|
|
14
|
+
declare function DialogFooter({ className, showCloseButton, closeLabel, children, ...props }: React.ComponentProps<'div'> & {
|
|
15
|
+
/** Text of the footer close button. */
|
|
16
|
+
closeLabel?: string;
|
|
13
17
|
showCloseButton?: boolean;
|
|
14
18
|
}): React.JSX.Element;
|
|
15
19
|
declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof Dialog$1.Title>): React.JSX.Element;
|
|
@@ -37,7 +37,7 @@ function DialogOverlay({ className, ...props }) {
|
|
|
37
37
|
...props
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
function DialogContent({ className, children, showCloseButton = true, ...props }) {
|
|
40
|
+
function DialogContent({ className, children, showCloseButton = true, closeLabel = "Close", ...props }) {
|
|
41
41
|
return /* @__PURE__ */ jsxs(DialogPortal, { children: [/* @__PURE__ */ jsx(DialogOverlay, {}), /* @__PURE__ */ jsxs(Dialog$1.Content, {
|
|
42
42
|
"data-slot": "dialog-content",
|
|
43
43
|
className: cn("bg-popover text-popover-foreground ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl p-4 text-sm ring-1 duration-100 outline-none sm:max-w-sm", className),
|
|
@@ -51,7 +51,7 @@ function DialogContent({ className, children, showCloseButton = true, ...props }
|
|
|
51
51
|
size: "icon-sm",
|
|
52
52
|
children: [/* @__PURE__ */ jsx(XIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
53
53
|
className: "sr-only",
|
|
54
|
-
children:
|
|
54
|
+
children: closeLabel
|
|
55
55
|
})]
|
|
56
56
|
})
|
|
57
57
|
})]
|
|
@@ -64,7 +64,7 @@ function DialogHeader({ className, ...props }) {
|
|
|
64
64
|
...props
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
function DialogFooter({ className, showCloseButton = false, children, ...props }) {
|
|
67
|
+
function DialogFooter({ className, showCloseButton = false, closeLabel = "Close", children, ...props }) {
|
|
68
68
|
return /* @__PURE__ */ jsxs("div", {
|
|
69
69
|
"data-slot": "dialog-footer",
|
|
70
70
|
className: cn("bg-muted/50 -mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t p-4 sm:flex-row sm:justify-end", className),
|
|
@@ -73,7 +73,7 @@ function DialogFooter({ className, showCloseButton = false, children, ...props }
|
|
|
73
73
|
asChild: true,
|
|
74
74
|
children: /* @__PURE__ */ jsx(Button, {
|
|
75
75
|
variant: "outline",
|
|
76
|
-
children:
|
|
76
|
+
children: closeLabel
|
|
77
77
|
})
|
|
78
78
|
})]
|
|
79
79
|
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
type PageHeaderProps = Omit<React.ComponentProps<'div'>, 'title'> & {
|
|
3
|
+
/** Page title, rendered as the page's `<h1>`. */
|
|
4
|
+
title: React.ReactNode;
|
|
5
|
+
/** Optional supporting copy under the title. */
|
|
6
|
+
description?: React.ReactNode;
|
|
7
|
+
/** Optional trailing actions (buttons, menus), aligned to the end of the row. */
|
|
8
|
+
actions?: React.ReactNode;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Title row of an app page: `<h1>` + optional description on the start side,
|
|
12
|
+
* optional actions on the end side (wrapping below on narrow screens).
|
|
13
|
+
* Outer spacing is the caller's job — pass it via `className`.
|
|
14
|
+
*/
|
|
15
|
+
declare function PageHeader({ title, description, actions, className, ...props }: PageHeaderProps): React.JSX.Element;
|
|
16
|
+
type PageHeaderSkeletonProps = React.ComponentProps<'div'> & {
|
|
17
|
+
/** Width class of the title bar. */
|
|
18
|
+
titleWidth?: string;
|
|
19
|
+
/** Width class of the description bar; `null` hides it. */
|
|
20
|
+
descriptionWidth?: string | null;
|
|
21
|
+
};
|
|
22
|
+
/** Loading placeholder whose dimensions mirror `PageHeader` (title + description). */
|
|
23
|
+
declare function PageHeaderSkeleton({ titleWidth, descriptionWidth, className, ...props }: PageHeaderSkeletonProps): React.JSX.Element;
|
|
24
|
+
export { PageHeader, type PageHeaderProps, PageHeaderSkeleton, type PageHeaderSkeletonProps };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { Skeleton } from "./skeleton.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
// src/components/page-header.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Title row of an app page: `<h1>` + optional description on the start side,
|
|
8
|
+
* optional actions on the end side (wrapping below on narrow screens).
|
|
9
|
+
* Outer spacing is the caller's job — pass it via `className`.
|
|
10
|
+
*/
|
|
11
|
+
function PageHeader({ title, description, actions, className, ...props }) {
|
|
12
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
13
|
+
"data-slot": "page-header",
|
|
14
|
+
className: cn("flex flex-wrap items-center justify-between gap-2", className),
|
|
15
|
+
...props,
|
|
16
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
17
|
+
className: "min-w-0 flex-1",
|
|
18
|
+
children: [/* @__PURE__ */ jsx("h1", {
|
|
19
|
+
className: "text-xl font-semibold tracking-tight md:text-2xl",
|
|
20
|
+
children: title
|
|
21
|
+
}), description ? /* @__PURE__ */ jsx("p", {
|
|
22
|
+
"data-slot": "page-header-description",
|
|
23
|
+
className: "text-muted-foreground mt-1 text-sm md:text-base",
|
|
24
|
+
children: description
|
|
25
|
+
}) : null]
|
|
26
|
+
}), actions ? /* @__PURE__ */ jsx("div", {
|
|
27
|
+
"data-slot": "page-header-actions",
|
|
28
|
+
className: "flex flex-wrap items-center gap-2",
|
|
29
|
+
children: actions
|
|
30
|
+
}) : null]
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/** Loading placeholder whose dimensions mirror `PageHeader` (title + description). */
|
|
34
|
+
function PageHeaderSkeleton({ titleWidth = "w-40", descriptionWidth = "w-64", className, ...props }) {
|
|
35
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
36
|
+
"data-slot": "page-header-skeleton",
|
|
37
|
+
className,
|
|
38
|
+
...props,
|
|
39
|
+
children: [/* @__PURE__ */ jsx(Skeleton, { className: cn("h-6 md:h-7", titleWidth) }), descriptionWidth ? /* @__PURE__ */ jsx(Skeleton, { className: cn("mt-1 h-4 md:h-5", descriptionWidth) }) : null]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export { PageHeader, PageHeaderSkeleton };
|
|
@@ -3,7 +3,9 @@ import { Dialog } from "radix-ui";
|
|
|
3
3
|
declare function Sheet({ ...props }: React.ComponentProps<typeof Dialog.Root>): React.JSX.Element;
|
|
4
4
|
declare function SheetTrigger({ ...props }: React.ComponentProps<typeof Dialog.Trigger>): React.JSX.Element;
|
|
5
5
|
declare function SheetClose({ ...props }: React.ComponentProps<typeof Dialog.Close>): React.JSX.Element;
|
|
6
|
-
declare function SheetContent({ className, children, side, showCloseButton, ...props }: React.ComponentProps<typeof Dialog.Content> & {
|
|
6
|
+
declare function SheetContent({ className, children, side, showCloseButton, closeLabel, ...props }: React.ComponentProps<typeof Dialog.Content> & {
|
|
7
|
+
/** Accessible label of the built-in close button. */
|
|
8
|
+
closeLabel?: string;
|
|
7
9
|
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
8
10
|
showCloseButton?: boolean;
|
|
9
11
|
}): React.JSX.Element;
|
package/dist/components/sheet.js
CHANGED
|
@@ -37,7 +37,7 @@ function SheetOverlay({ className, ...props }) {
|
|
|
37
37
|
...props
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
function SheetContent({ className, children, side = "right", showCloseButton = true, ...props }) {
|
|
40
|
+
function SheetContent({ className, children, side = "right", showCloseButton = true, closeLabel = "Close", ...props }) {
|
|
41
41
|
return /* @__PURE__ */ jsxs(SheetPortal, { children: [/* @__PURE__ */ jsx(SheetOverlay, {}), /* @__PURE__ */ jsxs(Dialog.Content, {
|
|
42
42
|
"data-slot": "sheet-content",
|
|
43
43
|
"data-side": side,
|
|
@@ -52,7 +52,7 @@ function SheetContent({ className, children, side = "right", showCloseButton = t
|
|
|
52
52
|
size: "icon-sm",
|
|
53
53
|
children: [/* @__PURE__ */ jsx(XIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
54
54
|
className: "sr-only",
|
|
55
|
-
children:
|
|
55
|
+
children: closeLabel
|
|
56
56
|
})]
|
|
57
57
|
})
|
|
58
58
|
})]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
type ThemeToggleLabels = {
|
|
3
|
+
/** Visible name of the light theme (`text` variant). */
|
|
4
|
+
light?: string;
|
|
5
|
+
/** Visible name of the dark theme (`text` variant). */
|
|
6
|
+
dark?: string;
|
|
7
|
+
/** Accessible label of the button when it switches to light. */
|
|
8
|
+
switchToLight?: string;
|
|
9
|
+
/** Accessible label of the button when it switches to dark. */
|
|
10
|
+
switchToDark?: string;
|
|
11
|
+
};
|
|
12
|
+
type ThemeToggleProps = Omit<React.ComponentProps<'button'>, 'children' | 'onClick'> & {
|
|
13
|
+
/** `icon`: ghost icon button (sun/moon). `text`: mono uppercase label + glyph. */
|
|
14
|
+
variant?: 'icon' | 'text';
|
|
15
|
+
labels?: ThemeToggleLabels;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Light/dark toggle wired to `next-themes` (mount the DS `ThemeProvider`).
|
|
19
|
+
* Renders a neutral placeholder until hydrated so SSR markup never mismatches.
|
|
20
|
+
*/
|
|
21
|
+
declare function ThemeToggle({ variant, labels, className, ...props }: ThemeToggleProps): React.JSX.Element;
|
|
22
|
+
export { ThemeToggle, type ThemeToggleLabels, type ThemeToggleProps };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { Button } from "./button.js";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { MoonIcon, SunIcon } from "lucide-react";
|
|
7
|
+
import { useTheme } from "next-themes";
|
|
8
|
+
// src/components/theme-toggle.tsx
|
|
9
|
+
const defaultLabels = {
|
|
10
|
+
light: "claro",
|
|
11
|
+
dark: "escuro",
|
|
12
|
+
switchToLight: "Mudar para o tema claro",
|
|
13
|
+
switchToDark: "Mudar para o tema escuro"
|
|
14
|
+
};
|
|
15
|
+
function useMounted() {
|
|
16
|
+
return React.useSyncExternalStore(() => () => {}, () => true, () => false);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Light/dark toggle wired to `next-themes` (mount the DS `ThemeProvider`).
|
|
20
|
+
* Renders a neutral placeholder until hydrated so SSR markup never mismatches.
|
|
21
|
+
*/
|
|
22
|
+
function ThemeToggle({ variant = "icon", labels, className, ...props }) {
|
|
23
|
+
const { resolvedTheme, setTheme } = useTheme();
|
|
24
|
+
const mounted = useMounted();
|
|
25
|
+
const l = {
|
|
26
|
+
...defaultLabels,
|
|
27
|
+
...labels
|
|
28
|
+
};
|
|
29
|
+
const isDark = mounted && resolvedTheme === "dark";
|
|
30
|
+
const next = isDark ? "light" : "dark";
|
|
31
|
+
const label = isDark ? l.switchToLight : l.switchToDark;
|
|
32
|
+
if (variant === "text") {
|
|
33
|
+
let text = "— — —";
|
|
34
|
+
if (mounted) text = isDark ? `${l.light} ☀` : `${l.dark} ☾`;
|
|
35
|
+
return /* @__PURE__ */ jsx("button", {
|
|
36
|
+
type: "button",
|
|
37
|
+
"data-slot": "theme-toggle",
|
|
38
|
+
"aria-label": label,
|
|
39
|
+
onClick: () => setTheme(next),
|
|
40
|
+
className: cn("text-muted-foreground hover:text-foreground focus-visible:text-foreground font-mono text-[0.7rem] tracking-[0.12em] uppercase transition-colors focus-visible:outline-none", className),
|
|
41
|
+
...props,
|
|
42
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
43
|
+
className: "inline-block min-w-[3.5rem] text-right tabular-nums",
|
|
44
|
+
children: text
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
49
|
+
type: "button",
|
|
50
|
+
variant: "ghost",
|
|
51
|
+
size: "icon",
|
|
52
|
+
"data-slot": "theme-toggle",
|
|
53
|
+
"aria-label": label,
|
|
54
|
+
onClick: () => setTheme(next),
|
|
55
|
+
className,
|
|
56
|
+
...props,
|
|
57
|
+
children: isDark ? /* @__PURE__ */ jsx(SunIcon, {}) : /* @__PURE__ */ jsx(MoonIcon, {})
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
export { ThemeToggle };
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { Button, buttonVariants } from "./components/button.js";
|
|
|
16
16
|
import { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants } from "./components/button-group.js";
|
|
17
17
|
import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "./components/card.js";
|
|
18
18
|
import { Checkbox } from "./components/checkbox.js";
|
|
19
|
+
import { Container, ContainerProps, containerVariants } from "./components/container.js";
|
|
19
20
|
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from "./components/dialog.js";
|
|
20
21
|
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "./components/dropdown-menu.js";
|
|
21
22
|
import { EmptyState, EmptyStateProps } from "./components/empty-state.js";
|
|
@@ -29,6 +30,7 @@ import { InputGroup, InputGroupAddon, InputGroupInput } from "./components/input
|
|
|
29
30
|
import { Label } from "./components/label.js";
|
|
30
31
|
import { List, ListEmptyContent, ListFilterConfig, ListItem, ListItemActions, ListItemContent, ListItemDescription, ListItemDescriptor, ListItemLeading, ListItemMedia, ListItemMeta, ListItemTitle, ListItemTrailing, ListPaginationConfig, ListProps, ListSearchConfig, listItemVariants, listVariants } from "./components/list.js";
|
|
31
32
|
import { Main, mainVariants } from "./components/main.js";
|
|
33
|
+
import { PageHeader, PageHeaderProps, PageHeaderSkeleton, PageHeaderSkeletonProps } from "./components/page-header.js";
|
|
32
34
|
import { Pagination, PaginationProps } from "./components/pagination.js";
|
|
33
35
|
import { RadioGroup, RadioGroupItem } from "./components/radio-group.js";
|
|
34
36
|
import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue } from "./components/select.js";
|
|
@@ -41,6 +43,7 @@ import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, Tabl
|
|
|
41
43
|
import { Tabs, TabsContent, TabsCount, TabsList, TabsTrigger, tabsListVariants } from "./components/tabs.js";
|
|
42
44
|
import { Textarea } from "./components/textarea.js";
|
|
43
45
|
import { ThemeProvider } from "./components/theme-provider.js";
|
|
46
|
+
import { ThemeToggle, ThemeToggleLabels, ThemeToggleProps } from "./components/theme-toggle.js";
|
|
44
47
|
import { Typography, typographyVariants } from "./components/typography.js";
|
|
45
48
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./components/collapsible.js";
|
|
46
49
|
import { Popover, PopoverContent, PopoverTrigger } from "./components/popover.js";
|
|
@@ -56,4 +59,4 @@ import { ElementSize, useElementSize } from "./hooks/use-element-size.js";
|
|
|
56
59
|
import { HashSection, useHashSection } from "./hooks/use-hash-section.js";
|
|
57
60
|
import { useIsMobile } from "./hooks/use-mobile.js";
|
|
58
61
|
import { ScrollStripEdges, useScrollStrip } from "./hooks/use-scroll-strip.js";
|
|
59
|
-
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, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, 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, type ElementSize, EmptyState, type EmptyStateProps, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, GoogleIcon, type HashSection, 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, type ScrollStripEdges, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, SettingRow, SettingRowGroup, SettingsDialog, type SettingsDialogProps, type SettingsDialogSection, 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, StatusDot, type StatusDotProps, Stepper, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsCount, TabsList, TabsTrigger, Textarea, ThemeProvider, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Typography, UserMenu, type UserMenuProps, WhatsappIcon, badgeVariants, buttonGroupVariants, buttonVariants, cn, hasActiveChild as hasActiveNavChild, initials, isActive as isNavItemActive, listItemVariants, listVariants, mainVariants, statusDotVariants, tabsListVariants, typographyVariants, useElementSize, useHashSection, useIsMobile, useScrollStrip, useSidebar, userMenuInitials };
|
|
62
|
+
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, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Calendar, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Container, type ContainerProps, 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, type ElementSize, EmptyState, type EmptyStateProps, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, GoogleIcon, type HashSection, 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, PageHeader, type PageHeaderProps, PageHeaderSkeleton, type PageHeaderSkeletonProps, Pagination, type PaginationProps, Popover, PopoverContent, PopoverTrigger, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, type ScrollStripEdges, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, SettingRow, SettingRowGroup, SettingsDialog, type SettingsDialogProps, type SettingsDialogSection, 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, StatusDot, type StatusDotProps, Stepper, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsCount, TabsList, TabsTrigger, Textarea, ThemeProvider, ThemeToggle, type ThemeToggleLabels, type ThemeToggleProps, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Typography, UserMenu, type UserMenuProps, WhatsappIcon, badgeVariants, buttonGroupVariants, buttonVariants, cn, containerVariants, hasActiveChild as hasActiveNavChild, initials, isActive as isNavItemActive, listItemVariants, listVariants, mainVariants, statusDotVariants, tabsListVariants, typographyVariants, useElementSize, useHashSection, useIsMobile, useScrollStrip, useSidebar, userMenuInitials };
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import { Button, buttonVariants } from "./components/button.js";
|
|
|
14
14
|
import { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants } from "./components/button-group.js";
|
|
15
15
|
import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "./components/card.js";
|
|
16
16
|
import { Checkbox } from "./components/checkbox.js";
|
|
17
|
+
import { Container, containerVariants } from "./components/container.js";
|
|
17
18
|
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from "./components/dialog.js";
|
|
18
19
|
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "./components/dropdown-menu.js";
|
|
19
20
|
import { EmptyState } from "./components/empty-state.js";
|
|
@@ -26,6 +27,7 @@ import { InputGroup, InputGroupAddon, InputGroupInput } from "./components/input
|
|
|
26
27
|
import { Label } from "./components/label.js";
|
|
27
28
|
import { List, ListItem, ListItemActions, ListItemContent, ListItemDescription, ListItemLeading, ListItemMedia, ListItemMeta, ListItemTitle, ListItemTrailing, listItemVariants, listVariants } from "./components/list.js";
|
|
28
29
|
import { Main, mainVariants } from "./components/main.js";
|
|
30
|
+
import { PageHeader, PageHeaderSkeleton } from "./components/page-header.js";
|
|
29
31
|
import { Pagination } from "./components/pagination.js";
|
|
30
32
|
import { RadioGroup, RadioGroupItem } from "./components/radio-group.js";
|
|
31
33
|
import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue } from "./components/select.js";
|
|
@@ -38,6 +40,7 @@ import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, Tabl
|
|
|
38
40
|
import { Tabs, TabsContent, TabsCount, TabsList, TabsTrigger, tabsListVariants } from "./components/tabs.js";
|
|
39
41
|
import { Textarea } from "./components/textarea.js";
|
|
40
42
|
import { ThemeProvider } from "./components/theme-provider.js";
|
|
43
|
+
import { ThemeToggle } from "./components/theme-toggle.js";
|
|
41
44
|
import { Typography, typographyVariants } from "./components/typography.js";
|
|
42
45
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./components/collapsible.js";
|
|
43
46
|
import { Popover, PopoverContent, PopoverTrigger } from "./components/popover.js";
|
|
@@ -54,4 +57,4 @@ import { useElementSize } from "./hooks/use-element-size.js";
|
|
|
54
57
|
import { useHashSection } from "./hooks/use-hash-section.js";
|
|
55
58
|
import { useIsMobile } from "./hooks/use-mobile.js";
|
|
56
59
|
import { useScrollStrip } from "./hooks/use-scroll-strip.js";
|
|
57
|
-
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, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, 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, SettingsDialog, 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, StatusDot, Stepper, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsCount, TabsList, TabsTrigger, Textarea, ThemeProvider, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Typography, UserMenu, WhatsappIcon, badgeVariants, buttonGroupVariants, buttonVariants, cn, hasActiveChild as hasActiveNavChild, initials, isActive as isNavItemActive, listItemVariants, listVariants, mainVariants, statusDotVariants, tabsListVariants, typographyVariants, useElementSize, useHashSection, useIsMobile, useScrollStrip, useSidebar, userMenuInitials };
|
|
60
|
+
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, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Calendar, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Container, 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, PageHeader, PageHeaderSkeleton, Pagination, Popover, PopoverContent, PopoverTrigger, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, SettingRow, SettingRowGroup, SettingsDialog, 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, StatusDot, Stepper, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsCount, TabsList, TabsTrigger, Textarea, ThemeProvider, ThemeToggle, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Typography, UserMenu, WhatsappIcon, badgeVariants, buttonGroupVariants, buttonVariants, cn, containerVariants, hasActiveChild as hasActiveNavChild, initials, isActive as isNavItemActive, listItemVariants, listVariants, mainVariants, statusDotVariants, tabsListVariants, typographyVariants, useElementSize, useHashSection, useIsMobile, useScrollStrip, useSidebar, userMenuInitials };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cbrl/design",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.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",
|