@boriaui/react 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +80 -2
- package/dist/components/alert-dialog.d.ts +29 -0
- package/dist/components/alert-dialog.js +62 -0
- package/dist/components/alert.d.ts +12 -0
- package/dist/components/alert.js +35 -0
- package/dist/components/autosize-textarea.d.ts +26 -0
- package/dist/components/autosize-textarea.js +66 -0
- package/dist/components/avatar.d.ts +9 -0
- package/dist/components/avatar.js +30 -0
- package/dist/components/badge.d.ts +16 -0
- package/dist/components/badge.js +24 -0
- package/dist/components/breadcrumb.d.ts +29 -0
- package/dist/components/breadcrumb.js +64 -0
- package/dist/components/button.d.ts +15 -0
- package/dist/components/button.js +45 -0
- package/dist/components/calendar.d.ts +25 -0
- package/dist/components/calendar.js +109 -0
- package/dist/components/card.d.ts +11 -0
- package/dist/components/card.js +44 -0
- package/dist/components/checkbox.d.ts +20 -0
- package/dist/components/checkbox.js +29 -0
- package/dist/components/collapsible.d.ts +9 -0
- package/dist/components/collapsible.js +12 -0
- package/dist/components/command.d.ts +89 -0
- package/dist/components/command.js +79 -0
- package/dist/components/context-menu.d.ts +36 -0
- package/dist/components/context-menu.js +136 -0
- package/dist/components/dialog.d.ts +31 -0
- package/dist/components/dialog.js +58 -0
- package/dist/components/dropdown-menu.d.ts +33 -0
- package/dist/components/dropdown-menu.js +85 -0
- package/dist/components/empty.d.ts +35 -0
- package/dist/components/empty.js +61 -0
- package/dist/components/field.d.ts +64 -0
- package/dist/components/field.js +121 -0
- package/dist/components/hover-card.d.ts +9 -0
- package/dist/components/hover-card.js +25 -0
- package/dist/components/input-group.d.ts +42 -0
- package/dist/components/input-group.js +83 -0
- package/dist/components/input.d.ts +6 -0
- package/dist/components/input.js +17 -0
- package/dist/components/item.d.ts +61 -0
- package/dist/components/item.js +118 -0
- package/dist/components/kbd.d.ts +13 -0
- package/dist/components/kbd.js +21 -0
- package/dist/components/label.d.ts +7 -0
- package/dist/components/label.js +18 -0
- package/dist/components/popover.d.ts +10 -0
- package/dist/components/popover.js +23 -0
- package/dist/components/radio-group.d.ts +14 -0
- package/dist/components/radio-group.js +39 -0
- package/dist/components/resizable.d.ts +34 -0
- package/dist/components/resizable.js +25 -0
- package/dist/components/scroll-area.d.ts +11 -0
- package/dist/components/scroll-area.js +35 -0
- package/dist/components/select.d.ts +16 -0
- package/dist/components/select.js +77 -0
- package/dist/components/separator.d.ts +7 -0
- package/dist/components/separator.js +20 -0
- package/dist/components/sheet.d.ts +34 -0
- package/dist/components/sheet.js +68 -0
- package/dist/components/sidebar.d.ts +72 -0
- package/dist/components/sidebar.js +382 -0
- package/dist/components/skeleton.d.ts +9 -0
- package/dist/components/skeleton.js +13 -0
- package/dist/components/spinner.d.ts +9 -0
- package/dist/components/spinner.js +16 -0
- package/dist/components/switch.d.ts +28 -0
- package/dist/components/switch.js +31 -0
- package/dist/components/tabs.d.ts +10 -0
- package/dist/components/tabs.js +31 -0
- package/dist/components/textarea.d.ts +6 -0
- package/dist/components/textarea.js +16 -0
- package/dist/components/toaster.d.ts +10 -0
- package/dist/components/toaster.js +19 -0
- package/dist/components/toggle-group.d.ts +16 -0
- package/dist/components/toggle-group.js +43 -0
- package/dist/components/toggle.d.ts +16 -0
- package/dist/components/toggle.js +40 -0
- package/dist/components/tooltip.d.ts +10 -0
- package/dist/components/tooltip.js +22 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/use-media-query.d.ts +8 -0
- package/dist/hooks/use-media-query.js +20 -0
- package/dist/hooks/use-mobile.d.ts +4 -0
- package/dist/hooks/use-mobile.js +20 -0
- package/dist/lib/index.d.ts +3 -0
- package/dist/lib/index.js +4 -0
- package/dist/lib/keyboard-guards.d.ts +11 -0
- package/dist/lib/keyboard-guards.js +21 -0
- package/dist/lib/utils.d.ts +6 -0
- package/dist/lib/utils.js +10 -0
- package/dist/theme/index.d.ts +3 -0
- package/dist/theme/index.js +4 -0
- package/dist/theme/theme-options.d.ts +16 -0
- package/dist/theme/theme-options.js +25 -0
- package/dist/theme/theme-provider.d.ts +50 -0
- package/dist/theme/theme-provider.js +94 -0
- package/package.json +122 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Burhan Aghazada
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,81 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @boriaui/react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React primitives for [Boria UI](https://boriaui.vercel.app): accessible components styled with Tailwind CSS v4 and semantic CSS tokens.
|
|
4
|
+
|
|
5
|
+
> 0.x — APIs may still change between minor versions.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm add @boriaui/react @boriaui/tokens tailwindcss
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Peer dependencies: `react` and `react-dom` 19. Some components need optional peers; install them only if you use the component:
|
|
14
|
+
|
|
15
|
+
| Component | Optional peers |
|
|
16
|
+
|---|---|
|
|
17
|
+
| `calendar` | `react-day-picker`, `date-fns` |
|
|
18
|
+
| `command` | `cmdk` |
|
|
19
|
+
| `resizable` | `react-resizable-panels` |
|
|
20
|
+
| `toaster` | `sonner` |
|
|
21
|
+
|
|
22
|
+
## CSS setup
|
|
23
|
+
|
|
24
|
+
```css
|
|
25
|
+
/* app.css */
|
|
26
|
+
@import "tailwindcss";
|
|
27
|
+
@import "@boriaui/tokens";
|
|
28
|
+
|
|
29
|
+
/* Let Tailwind see the classes used by Boria UI components. */
|
|
30
|
+
@source "../node_modules/@boriaui/react/dist";
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Adjust the `@source` path so it points from your stylesheet to `node_modules`.
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
Each component has its own subpath (there is no root barrel):
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import { Button } from "@boriaui/react/button";
|
|
41
|
+
import { Dialog, DialogContent, DialogTitle, DialogTrigger } from "@boriaui/react/dialog";
|
|
42
|
+
import { ThemeProvider, useTheme } from "@boriaui/react/theme";
|
|
43
|
+
import { cn } from "@boriaui/react/lib";
|
|
44
|
+
|
|
45
|
+
export function App() {
|
|
46
|
+
return (
|
|
47
|
+
<ThemeProvider defaultTheme="system">
|
|
48
|
+
<Dialog>
|
|
49
|
+
<DialogTrigger asChild>
|
|
50
|
+
<Button variant="outline">Open</Button>
|
|
51
|
+
</DialogTrigger>
|
|
52
|
+
<DialogContent>
|
|
53
|
+
<DialogTitle>Hello</DialogTitle>
|
|
54
|
+
</DialogContent>
|
|
55
|
+
</Dialog>
|
|
56
|
+
</ThemeProvider>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`ThemeProvider` toggles the `dark` class on `<html>` and persists the choice (to `localStorage` by default; pass `storage` to change it).
|
|
62
|
+
|
|
63
|
+
## Theming
|
|
64
|
+
|
|
65
|
+
Components use only semantic tokens (`bg-primary`, `text-muted-foreground`, `rounded-md`). Override the CSS variables to theme your app:
|
|
66
|
+
|
|
67
|
+
```css
|
|
68
|
+
:root {
|
|
69
|
+
--primary: oklch(0.55 0.2 260);
|
|
70
|
+
--radius: 0.5rem;
|
|
71
|
+
}
|
|
72
|
+
.dark {
|
|
73
|
+
--primary: oklch(0.7 0.15 260);
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
See [`@boriaui/tokens`](../tokens/README.md) for the full token list.
|
|
78
|
+
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
MIT
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
|
|
3
|
+
|
|
4
|
+
//#region src/components/alert-dialog.d.ts
|
|
5
|
+
declare const AlertDialog: React.FC<AlertDialogPrimitive.AlertDialogProps>;
|
|
6
|
+
declare const AlertDialogTrigger: React.ForwardRefExoticComponent<AlertDialogPrimitive.AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
declare const AlertDialogPortal: React.FC<AlertDialogPrimitive.AlertDialogPortalProps>;
|
|
8
|
+
declare const AlertDialogOverlay: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
declare const AlertDialogContent: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
declare const AlertDialogHeader: {
|
|
11
|
+
({
|
|
12
|
+
className,
|
|
13
|
+
...props
|
|
14
|
+
}: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
15
|
+
displayName: string;
|
|
16
|
+
};
|
|
17
|
+
declare const AlertDialogFooter: {
|
|
18
|
+
({
|
|
19
|
+
className,
|
|
20
|
+
...props
|
|
21
|
+
}: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
22
|
+
displayName: string;
|
|
23
|
+
};
|
|
24
|
+
declare const AlertDialogTitle: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
25
|
+
declare const AlertDialogDescription: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
26
|
+
declare const AlertDialogAction: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogActionProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
27
|
+
declare const AlertDialogCancel: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogCancelProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
5
|
+
import { buttonVariants } from "./button.js";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
|
|
10
|
+
//#region src/components/alert-dialog.tsx
|
|
11
|
+
const AlertDialog = AlertDialogPrimitive.Root;
|
|
12
|
+
const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
|
|
13
|
+
const AlertDialogPortal = AlertDialogPrimitive.Portal;
|
|
14
|
+
const AlertDialogOverlay = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(AlertDialogPrimitive.Overlay, {
|
|
15
|
+
className: cn("fixed inset-0 z-50 bg-overlay data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className),
|
|
16
|
+
...props,
|
|
17
|
+
ref
|
|
18
|
+
}));
|
|
19
|
+
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
|
|
20
|
+
const AlertDialogContent = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsxs(AlertDialogPortal, { children: [/* @__PURE__ */ jsx(AlertDialogOverlay, {}), /* @__PURE__ */ jsx(AlertDialogPrimitive.Content, {
|
|
21
|
+
ref,
|
|
22
|
+
className: cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg", className),
|
|
23
|
+
...props
|
|
24
|
+
})] }));
|
|
25
|
+
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
|
|
26
|
+
const AlertDialogHeader = ({ className,...props }) => /* @__PURE__ */ jsx("div", {
|
|
27
|
+
className: cn("flex flex-col space-y-2 text-center sm:text-left", className),
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
AlertDialogHeader.displayName = "AlertDialogHeader";
|
|
31
|
+
const AlertDialogFooter = ({ className,...props }) => /* @__PURE__ */ jsx("div", {
|
|
32
|
+
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
33
|
+
...props
|
|
34
|
+
});
|
|
35
|
+
AlertDialogFooter.displayName = "AlertDialogFooter";
|
|
36
|
+
const AlertDialogTitle = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(AlertDialogPrimitive.Title, {
|
|
37
|
+
ref,
|
|
38
|
+
className: cn("text-lg font-semibold", className),
|
|
39
|
+
...props
|
|
40
|
+
}));
|
|
41
|
+
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
|
|
42
|
+
const AlertDialogDescription = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(AlertDialogPrimitive.Description, {
|
|
43
|
+
ref,
|
|
44
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
45
|
+
...props
|
|
46
|
+
}));
|
|
47
|
+
AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
|
|
48
|
+
const AlertDialogAction = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(AlertDialogPrimitive.Action, {
|
|
49
|
+
ref,
|
|
50
|
+
className: cn(buttonVariants(), className),
|
|
51
|
+
...props
|
|
52
|
+
}));
|
|
53
|
+
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
|
|
54
|
+
const AlertDialogCancel = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(AlertDialogPrimitive.Cancel, {
|
|
55
|
+
ref,
|
|
56
|
+
className: cn(buttonVariants({ variant: "outline" }), "mt-2 sm:mt-0", className),
|
|
57
|
+
...props
|
|
58
|
+
}));
|
|
59
|
+
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
import * as class_variance_authority_types0 from "class-variance-authority/types";
|
|
4
|
+
|
|
5
|
+
//#region src/components/alert.d.ts
|
|
6
|
+
declare const Alert: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
7
|
+
variant?: "default" | "destructive" | null | undefined;
|
|
8
|
+
} & class_variance_authority_types0.ClassProp) | undefined) => string> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
declare const AlertTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
10
|
+
declare const AlertDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { Alert, AlertDescription, AlertTitle };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/components/alert.tsx
|
|
7
|
+
const alertVariants = cva("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7", {
|
|
8
|
+
variants: { variant: {
|
|
9
|
+
default: "bg-background text-foreground",
|
|
10
|
+
destructive: "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"
|
|
11
|
+
} },
|
|
12
|
+
defaultVariants: { variant: "default" }
|
|
13
|
+
});
|
|
14
|
+
const Alert = React.forwardRef(({ className, variant,...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
15
|
+
ref,
|
|
16
|
+
role: "alert",
|
|
17
|
+
className: cn(alertVariants({ variant }), className),
|
|
18
|
+
...props
|
|
19
|
+
}));
|
|
20
|
+
Alert.displayName = "Alert";
|
|
21
|
+
const AlertTitle = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("h5", {
|
|
22
|
+
ref,
|
|
23
|
+
className: cn("mb-1 font-medium leading-none tracking-tight", className),
|
|
24
|
+
...props
|
|
25
|
+
}));
|
|
26
|
+
AlertTitle.displayName = "AlertTitle";
|
|
27
|
+
const AlertDescription = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
28
|
+
ref,
|
|
29
|
+
className: cn("text-sm [&_p]:leading-relaxed", className),
|
|
30
|
+
...props
|
|
31
|
+
}));
|
|
32
|
+
AlertDescription.displayName = "AlertDescription";
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { Alert, AlertDescription, AlertTitle };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/autosize-textarea.d.ts
|
|
4
|
+
interface UseAutosizeTextAreaProps {
|
|
5
|
+
textAreaRef: React.MutableRefObject<HTMLTextAreaElement | null>;
|
|
6
|
+
minHeight?: number;
|
|
7
|
+
maxHeight?: number;
|
|
8
|
+
triggerAutoSize: string;
|
|
9
|
+
}
|
|
10
|
+
declare const useAutosizeTextArea: ({
|
|
11
|
+
textAreaRef,
|
|
12
|
+
triggerAutoSize,
|
|
13
|
+
maxHeight,
|
|
14
|
+
minHeight
|
|
15
|
+
}: UseAutosizeTextAreaProps) => void;
|
|
16
|
+
type AutosizeTextAreaRef = {
|
|
17
|
+
textArea: HTMLTextAreaElement;
|
|
18
|
+
maxHeight: number;
|
|
19
|
+
minHeight: number;
|
|
20
|
+
};
|
|
21
|
+
declare const AutosizeTextarea: React.ForwardRefExoticComponent<{
|
|
22
|
+
maxHeight?: number;
|
|
23
|
+
minHeight?: number;
|
|
24
|
+
} & React.TextareaHTMLAttributes<HTMLTextAreaElement> & React.RefAttributes<AutosizeTextAreaRef>>;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { AutosizeTextAreaRef, AutosizeTextarea, useAutosizeTextArea };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { useImperativeHandle } from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/components/autosize-textarea.tsx
|
|
10
|
+
const useAutosizeTextArea = ({ textAreaRef, triggerAutoSize, maxHeight = Number.MAX_SAFE_INTEGER, minHeight = 0 }) => {
|
|
11
|
+
const [init, setInit] = React.useState(true);
|
|
12
|
+
React.useEffect(() => {
|
|
13
|
+
const offsetBorder = 6;
|
|
14
|
+
const textAreaElement = textAreaRef.current;
|
|
15
|
+
if (textAreaElement) {
|
|
16
|
+
if (init) {
|
|
17
|
+
textAreaElement.style.minHeight = `${minHeight + offsetBorder}px`;
|
|
18
|
+
if (maxHeight > minHeight) textAreaElement.style.maxHeight = `${maxHeight}px`;
|
|
19
|
+
setInit(false);
|
|
20
|
+
}
|
|
21
|
+
textAreaElement.style.height = `${minHeight + offsetBorder}px`;
|
|
22
|
+
const scrollHeight = textAreaElement.scrollHeight;
|
|
23
|
+
if (scrollHeight > maxHeight) textAreaElement.style.height = `${maxHeight}px`;
|
|
24
|
+
else textAreaElement.style.height = `${scrollHeight + offsetBorder}px`;
|
|
25
|
+
}
|
|
26
|
+
}, [
|
|
27
|
+
textAreaRef,
|
|
28
|
+
triggerAutoSize,
|
|
29
|
+
init,
|
|
30
|
+
maxHeight,
|
|
31
|
+
minHeight
|
|
32
|
+
]);
|
|
33
|
+
};
|
|
34
|
+
const AutosizeTextarea = React.forwardRef(({ maxHeight = Number.MAX_SAFE_INTEGER, minHeight = 52, className, onChange, value,...props }, ref) => {
|
|
35
|
+
const textAreaRef = React.useRef(null);
|
|
36
|
+
const [triggerAutoSize, setTriggerAutoSize] = React.useState("");
|
|
37
|
+
useAutosizeTextArea({
|
|
38
|
+
textAreaRef,
|
|
39
|
+
triggerAutoSize,
|
|
40
|
+
maxHeight,
|
|
41
|
+
minHeight
|
|
42
|
+
});
|
|
43
|
+
useImperativeHandle(ref, () => ({
|
|
44
|
+
textArea: textAreaRef.current,
|
|
45
|
+
focus: () => textAreaRef?.current?.focus(),
|
|
46
|
+
maxHeight,
|
|
47
|
+
minHeight
|
|
48
|
+
}));
|
|
49
|
+
React.useEffect(() => {
|
|
50
|
+
setTriggerAutoSize(value);
|
|
51
|
+
}, [props?.defaultValue, value]);
|
|
52
|
+
return /* @__PURE__ */ jsx("textarea", {
|
|
53
|
+
...props,
|
|
54
|
+
value,
|
|
55
|
+
ref: textAreaRef,
|
|
56
|
+
className: cn("flex w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
57
|
+
onChange: (e) => {
|
|
58
|
+
setTriggerAutoSize(e.target.value);
|
|
59
|
+
onChange?.(e);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
AutosizeTextarea.displayName = "AutosizeTextarea";
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
export { AutosizeTextarea, useAutosizeTextArea };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
3
|
+
|
|
4
|
+
//#region src/components/avatar.d.ts
|
|
5
|
+
declare const Avatar: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
6
|
+
declare const AvatarImage: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarImageProps & React.RefAttributes<HTMLImageElement>, "ref"> & React.RefAttributes<HTMLImageElement>>;
|
|
7
|
+
declare const AvatarFallback: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { Avatar, AvatarFallback, AvatarImage };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
8
|
+
|
|
9
|
+
//#region src/components/avatar.tsx
|
|
10
|
+
const Avatar = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(AvatarPrimitive.Root, {
|
|
11
|
+
ref,
|
|
12
|
+
className: cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full", className),
|
|
13
|
+
...props
|
|
14
|
+
}));
|
|
15
|
+
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
16
|
+
const AvatarImage = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(AvatarPrimitive.Image, {
|
|
17
|
+
ref,
|
|
18
|
+
className: cn("aspect-square h-full w-full", className),
|
|
19
|
+
...props
|
|
20
|
+
}));
|
|
21
|
+
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
22
|
+
const AvatarFallback = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(AvatarPrimitive.Fallback, {
|
|
23
|
+
ref,
|
|
24
|
+
className: cn("flex h-full w-full items-center justify-center rounded-full bg-muted", className),
|
|
25
|
+
...props
|
|
26
|
+
}));
|
|
27
|
+
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
export { Avatar, AvatarFallback, AvatarImage };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
import * as class_variance_authority_types1 from "class-variance-authority/types";
|
|
4
|
+
|
|
5
|
+
//#region src/components/badge.d.ts
|
|
6
|
+
declare const badgeVariants: (props?: ({
|
|
7
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | null | undefined;
|
|
8
|
+
} & class_variance_authority_types1.ClassProp) | undefined) => string;
|
|
9
|
+
interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {}
|
|
10
|
+
declare function Badge({
|
|
11
|
+
className,
|
|
12
|
+
variant,
|
|
13
|
+
...props
|
|
14
|
+
}: BadgeProps): React.JSX.Element;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { Badge, BadgeProps, badgeVariants };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/components/badge.tsx
|
|
7
|
+
const badgeVariants = cva("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2", {
|
|
8
|
+
variants: { variant: {
|
|
9
|
+
default: "border-transparent bg-primary text-primary-foreground shadow-sm hover:bg-primary/80",
|
|
10
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
11
|
+
destructive: "border-transparent bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/80",
|
|
12
|
+
outline: "text-foreground"
|
|
13
|
+
} },
|
|
14
|
+
defaultVariants: { variant: "default" }
|
|
15
|
+
});
|
|
16
|
+
function Badge({ className, variant,...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsx("div", {
|
|
18
|
+
className: cn(badgeVariants({ variant }), className),
|
|
19
|
+
...props
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/breadcrumb.d.ts
|
|
4
|
+
declare const Breadcrumb: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & {
|
|
5
|
+
separator?: React.ReactNode;
|
|
6
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
7
|
+
declare const BreadcrumbList: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, "ref"> & React.RefAttributes<HTMLOListElement>>;
|
|
8
|
+
declare const BreadcrumbItem: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
9
|
+
declare const BreadcrumbLink: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & {
|
|
10
|
+
asChild?: boolean;
|
|
11
|
+
} & React.RefAttributes<HTMLAnchorElement>>;
|
|
12
|
+
declare const BreadcrumbPage: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
13
|
+
declare const BreadcrumbSeparator: {
|
|
14
|
+
({
|
|
15
|
+
children,
|
|
16
|
+
className,
|
|
17
|
+
...props
|
|
18
|
+
}: React.ComponentProps<"li">): React.JSX.Element;
|
|
19
|
+
displayName: string;
|
|
20
|
+
};
|
|
21
|
+
declare const BreadcrumbEllipsis: {
|
|
22
|
+
({
|
|
23
|
+
className,
|
|
24
|
+
...props
|
|
25
|
+
}: React.ComponentProps<"span">): React.JSX.Element;
|
|
26
|
+
displayName: string;
|
|
27
|
+
};
|
|
28
|
+
//#endregion
|
|
29
|
+
export { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { ChevronRight, MoreHorizontal } from "lucide-react";
|
|
6
|
+
|
|
7
|
+
//#region src/components/breadcrumb.tsx
|
|
8
|
+
const Breadcrumb = React.forwardRef(({ ...props }, ref) => /* @__PURE__ */ jsx("nav", {
|
|
9
|
+
ref,
|
|
10
|
+
"aria-label": "breadcrumb",
|
|
11
|
+
...props
|
|
12
|
+
}));
|
|
13
|
+
Breadcrumb.displayName = "Breadcrumb";
|
|
14
|
+
const BreadcrumbList = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("ol", {
|
|
15
|
+
ref,
|
|
16
|
+
className: cn("flex flex-wrap items-center gap-1.5 wrap-break-word text-sm text-muted-foreground sm:gap-2.5", className),
|
|
17
|
+
...props
|
|
18
|
+
}));
|
|
19
|
+
BreadcrumbList.displayName = "BreadcrumbList";
|
|
20
|
+
const BreadcrumbItem = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("li", {
|
|
21
|
+
ref,
|
|
22
|
+
className: cn("inline-flex items-center gap-1.5", className),
|
|
23
|
+
...props
|
|
24
|
+
}));
|
|
25
|
+
BreadcrumbItem.displayName = "BreadcrumbItem";
|
|
26
|
+
const BreadcrumbLink = React.forwardRef(({ asChild, className,...props }, ref) => {
|
|
27
|
+
return /* @__PURE__ */ jsx(asChild ? Slot : "a", {
|
|
28
|
+
ref,
|
|
29
|
+
className: cn("transition-colors hover:text-foreground", className),
|
|
30
|
+
...props
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
BreadcrumbLink.displayName = "BreadcrumbLink";
|
|
34
|
+
const BreadcrumbPage = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("span", {
|
|
35
|
+
ref,
|
|
36
|
+
role: "link",
|
|
37
|
+
"aria-disabled": "true",
|
|
38
|
+
"aria-current": "page",
|
|
39
|
+
className: cn("font-normal text-foreground", className),
|
|
40
|
+
...props
|
|
41
|
+
}));
|
|
42
|
+
BreadcrumbPage.displayName = "BreadcrumbPage";
|
|
43
|
+
const BreadcrumbSeparator = ({ children, className,...props }) => /* @__PURE__ */ jsx("li", {
|
|
44
|
+
role: "presentation",
|
|
45
|
+
"aria-hidden": "true",
|
|
46
|
+
className: cn("[&>svg]:w-3.5 [&>svg]:h-3.5", className),
|
|
47
|
+
...props,
|
|
48
|
+
children: children ?? /* @__PURE__ */ jsx(ChevronRight, {})
|
|
49
|
+
});
|
|
50
|
+
BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
|
|
51
|
+
const BreadcrumbEllipsis = ({ className,...props }) => /* @__PURE__ */ jsxs("span", {
|
|
52
|
+
role: "presentation",
|
|
53
|
+
"aria-hidden": "true",
|
|
54
|
+
className: cn("flex h-9 w-9 items-center justify-center", className),
|
|
55
|
+
...props,
|
|
56
|
+
children: [/* @__PURE__ */ jsx(MoreHorizontal, { className: "h-4 w-4" }), /* @__PURE__ */ jsx("span", {
|
|
57
|
+
className: "sr-only",
|
|
58
|
+
children: "More"
|
|
59
|
+
})]
|
|
60
|
+
});
|
|
61
|
+
BreadcrumbEllipsis.displayName = "BreadcrumbElipssis";
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
export { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
import * as class_variance_authority_types0 from "class-variance-authority/types";
|
|
4
|
+
|
|
5
|
+
//#region src/components/button.d.ts
|
|
6
|
+
declare const buttonVariants: (props?: ({
|
|
7
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
|
|
8
|
+
size?: "default" | "sm" | "lg" | "icon" | "xl" | null | undefined;
|
|
9
|
+
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
10
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
11
|
+
asChild?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { Button, ButtonProps, buttonVariants };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/components/button.tsx
|
|
8
|
+
const buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", {
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: "bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",
|
|
12
|
+
destructive: "bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90",
|
|
13
|
+
outline: "border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",
|
|
14
|
+
secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
|
15
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
16
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
17
|
+
},
|
|
18
|
+
size: {
|
|
19
|
+
default: "h-9 px-4 py-2",
|
|
20
|
+
sm: "h-8 rounded-md px-3 text-xs",
|
|
21
|
+
lg: "h-10 rounded-md px-8",
|
|
22
|
+
icon: "h-9 w-9",
|
|
23
|
+
xl: "h-12 rounded-lg px-6"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: {
|
|
27
|
+
variant: "default",
|
|
28
|
+
size: "default"
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const Button = React.forwardRef(({ className, variant, size, asChild = false,...props }, ref) => {
|
|
32
|
+
return /* @__PURE__ */ jsx(asChild ? Slot : "button", {
|
|
33
|
+
className: cn(buttonVariants({
|
|
34
|
+
variant,
|
|
35
|
+
size,
|
|
36
|
+
className
|
|
37
|
+
})),
|
|
38
|
+
ref,
|
|
39
|
+
...props
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
Button.displayName = "Button";
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Button } from "./button.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { DayButton, DayPicker } from "react-day-picker";
|
|
4
|
+
|
|
5
|
+
//#region src/components/calendar.d.ts
|
|
6
|
+
declare function Calendar({
|
|
7
|
+
className,
|
|
8
|
+
classNames,
|
|
9
|
+
showOutsideDays,
|
|
10
|
+
captionLayout,
|
|
11
|
+
buttonVariant,
|
|
12
|
+
formatters,
|
|
13
|
+
components,
|
|
14
|
+
...props
|
|
15
|
+
}: React.ComponentProps<typeof DayPicker> & {
|
|
16
|
+
buttonVariant?: React.ComponentProps<typeof Button>["variant"];
|
|
17
|
+
}): React.JSX.Element;
|
|
18
|
+
declare function CalendarDayButton({
|
|
19
|
+
className,
|
|
20
|
+
day,
|
|
21
|
+
modifiers,
|
|
22
|
+
...props
|
|
23
|
+
}: React.ComponentProps<typeof DayButton>): React.JSX.Element;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { Calendar, CalendarDayButton };
|