art-bd-ui 1.0.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 +1 -0
- package/dist/cjs/components/buttons/button/button.js +43 -0
- package/dist/cjs/components/buttons/icon-button/icon-button.js +33 -0
- package/dist/cjs/components/buttons/toggle/toggle.js +34 -0
- package/dist/cjs/components/buttons/toggle-group/toggle-group.js +31 -0
- package/dist/cjs/components/forms/checkbox/checkbox.js +52 -0
- package/dist/cjs/components/forms/input/input.js +38 -0
- package/dist/cjs/components/forms/label/label.js +38 -0
- package/dist/cjs/components/forms/radio/radio.js +22 -0
- package/dist/cjs/components/forms/select/select.js +72 -0
- package/dist/cjs/components/forms/switch/switch.js +51 -0
- package/dist/cjs/components/forms/textarea/textarea.js +37 -0
- package/dist/cjs/components/layout/box/box.js +19 -0
- package/dist/cjs/components/layout/flex/flex.js +14 -0
- package/dist/cjs/components/layout/grid/grid.js +14 -0
- package/dist/cjs/components/media/aspect-ratio/aspect-ratio.js +31 -0
- package/dist/cjs/components/media/avatar/avatar.js +27 -0
- package/dist/cjs/components/media/icon/icon.js +27 -0
- package/dist/cjs/components/popovers/dialog/dialog.js +69 -0
- package/dist/cjs/components/popovers/drawer/drawer.js +82 -0
- package/dist/cjs/components/popovers/popover/popover.js +66 -0
- package/dist/cjs/components/popovers/sheet/sheet.js +94 -0
- package/dist/cjs/components/popovers/toast/toast.js +75 -0
- package/dist/cjs/components/popovers/tooltip/tooltip.js +45 -0
- package/dist/cjs/components/typography/heading/heading.js +55 -0
- package/dist/cjs/components/typography/text/text.js +57 -0
- package/dist/cjs/components/ui/alert/alert.js +34 -0
- package/dist/cjs/components/ui/badge/badge.js +31 -0
- package/dist/cjs/components/ui/button/button.js +42 -0
- package/dist/cjs/components/ui/calendar/calendar.js +24 -0
- package/dist/cjs/components/ui/command/command.js +83 -0
- package/dist/cjs/components/ui/data-table/components/cell.js +24 -0
- package/dist/cjs/components/ui/data-table/components/column-group.js +45 -0
- package/dist/cjs/components/ui/data-table/components/table-body.js +47 -0
- package/dist/cjs/components/ui/data-table/components/table-fallback.js +28 -0
- package/dist/cjs/components/ui/data-table/components/table-head.js +56 -0
- package/dist/cjs/components/ui/data-table/components/table-placeholder.js +18 -0
- package/dist/cjs/components/ui/data-table/data-table.js +97 -0
- package/dist/cjs/components/ui/data-table/hooks/contextHooks.js +75 -0
- package/dist/cjs/components/ui/data-table/hooks/useStickyColumns.js +98 -0
- package/dist/cjs/components/ui/data-table/utils.js +26 -0
- package/dist/cjs/components/ui/date-picker/date-picker.js +15 -0
- package/dist/cjs/components/ui/dropdown-menu/dropdown-menu.js +100 -0
- package/dist/cjs/components/ui/icon/icon.js +27 -0
- package/dist/cjs/components/ui/link/link.js +32 -0
- package/dist/cjs/components/ui/pagination/pagination.js +51 -0
- package/dist/cjs/components/ui/progress/progress.js +13 -0
- package/dist/cjs/components/ui/sidebar/sidebar.js +331 -0
- package/dist/cjs/components/ui/table/components/cell.js +30 -0
- package/dist/cjs/components/ui/table/components/row.js +25 -0
- package/dist/cjs/components/ui/table/components/table-body.js +13 -0
- package/dist/cjs/components/ui/table/components/table-caption.js +13 -0
- package/dist/cjs/components/ui/table/components/table-footer.js +13 -0
- package/dist/cjs/components/ui/table/components/table-head.js +30 -0
- package/dist/cjs/components/ui/table/components/table-header.js +13 -0
- package/dist/cjs/components/ui/table/table.js +36 -0
- package/dist/cjs/components/ui/tabs/tabs.js +47 -0
- package/dist/cjs/components/utility/empty-state/empty-state.js +29 -0
- package/dist/cjs/components/utility/separator/separator.js +14 -0
- package/dist/cjs/components/utility/skeleton/skeleton.js +13 -0
- package/dist/cjs/components/utility/status-controller/status-controller.js +12 -0
- package/dist/cjs/hooks/use-mobile.js +21 -0
- package/dist/cjs/hooks/useControlled.js +19 -0
- package/dist/cjs/hooks/useFirstMountState.js +16 -0
- package/dist/cjs/hooks/useForkRef.js +23 -0
- package/dist/cjs/hooks/useLatest.js +12 -0
- package/dist/cjs/hooks/usePrevious.js +14 -0
- package/dist/cjs/hooks/useScrollState.js +39 -0
- package/dist/cjs/hooks/useStateRef.js +12 -0
- package/dist/cjs/hooks/useUpdateEffect.js +17 -0
- package/dist/cjs/index.js +237 -0
- package/dist/cjs/lib/utils.js +16 -0
- package/dist/cjs/styles/responsive.js +84 -0
- package/dist/cjs/styles/typography.js +25 -0
- package/dist/cjs/utils/addIf.js +5 -0
- package/dist/cjs/utils/chain.js +30 -0
- package/dist/cjs/utils/getBoundingRect.js +19 -0
- package/dist/cjs/utils/mergeProps.js +42 -0
- package/dist/cjs/utils/mergeRefs.js +18 -0
- package/dist/cjs/utils/toggle.js +16 -0
- package/dist/esm/components/buttons/button/button.js +40 -0
- package/dist/esm/components/buttons/icon-button/icon-button.js +31 -0
- package/dist/esm/components/buttons/toggle/toggle.js +31 -0
- package/dist/esm/components/buttons/toggle-group/toggle-group.js +28 -0
- package/dist/esm/components/forms/checkbox/checkbox.js +50 -0
- package/dist/esm/components/forms/input/input.js +36 -0
- package/dist/esm/components/forms/label/label.js +36 -0
- package/dist/esm/components/forms/radio/radio.js +19 -0
- package/dist/esm/components/forms/select/select.js +61 -0
- package/dist/esm/components/forms/switch/switch.js +49 -0
- package/dist/esm/components/forms/textarea/textarea.js +35 -0
- package/dist/esm/components/layout/box/box.js +17 -0
- package/dist/esm/components/layout/flex/flex.js +12 -0
- package/dist/esm/components/layout/grid/grid.js +12 -0
- package/dist/esm/components/media/aspect-ratio/aspect-ratio.js +10 -0
- package/dist/esm/components/media/avatar/avatar.js +23 -0
- package/dist/esm/components/media/icon/icon.js +25 -0
- package/dist/esm/components/popovers/dialog/dialog.js +60 -0
- package/dist/esm/components/popovers/drawer/drawer.js +74 -0
- package/dist/esm/components/popovers/popover/popover.js +61 -0
- package/dist/esm/components/popovers/sheet/sheet.js +86 -0
- package/dist/esm/components/popovers/toast/toast.js +67 -0
- package/dist/esm/components/popovers/tooltip/tooltip.js +40 -0
- package/dist/esm/components/typography/heading/heading.js +53 -0
- package/dist/esm/components/typography/text/text.js +55 -0
- package/dist/esm/components/ui/alert/alert.js +30 -0
- package/dist/esm/components/ui/badge/badge.js +28 -0
- package/dist/esm/components/ui/button/button.js +40 -0
- package/dist/esm/components/ui/calendar/calendar.js +22 -0
- package/dist/esm/components/ui/command/command.js +73 -0
- package/dist/esm/components/ui/data-table/components/cell.js +22 -0
- package/dist/esm/components/ui/data-table/components/column-group.js +43 -0
- package/dist/esm/components/ui/data-table/components/table-body.js +45 -0
- package/dist/esm/components/ui/data-table/components/table-fallback.js +26 -0
- package/dist/esm/components/ui/data-table/components/table-head.js +54 -0
- package/dist/esm/components/ui/data-table/components/table-placeholder.js +16 -0
- package/dist/esm/components/ui/data-table/data-table.js +95 -0
- package/dist/esm/components/ui/data-table/hooks/contextHooks.js +60 -0
- package/dist/esm/components/ui/data-table/hooks/useStickyColumns.js +96 -0
- package/dist/esm/components/ui/data-table/utils.js +22 -0
- package/dist/esm/components/ui/date-picker/date-picker.js +13 -0
- package/dist/esm/components/ui/dropdown-menu/dropdown-menu.js +84 -0
- package/dist/esm/components/ui/icon/icon.js +25 -0
- package/dist/esm/components/ui/link/link.js +30 -0
- package/dist/esm/components/ui/pagination/pagination.js +43 -0
- package/dist/esm/components/ui/progress/progress.js +11 -0
- package/dist/esm/components/ui/sidebar/sidebar.js +306 -0
- package/dist/esm/components/ui/table/components/cell.js +28 -0
- package/dist/esm/components/ui/table/components/row.js +23 -0
- package/dist/esm/components/ui/table/components/table-body.js +11 -0
- package/dist/esm/components/ui/table/components/table-caption.js +11 -0
- package/dist/esm/components/ui/table/components/table-footer.js +11 -0
- package/dist/esm/components/ui/table/components/table-head.js +28 -0
- package/dist/esm/components/ui/table/components/table-header.js +11 -0
- package/dist/esm/components/ui/table/table.js +26 -0
- package/dist/esm/components/ui/tabs/tabs.js +23 -0
- package/dist/esm/components/utility/empty-state/empty-state.js +27 -0
- package/dist/esm/components/utility/separator/separator.js +12 -0
- package/dist/esm/components/utility/skeleton/skeleton.js +11 -0
- package/dist/esm/components/utility/status-controller/status-controller.js +10 -0
- package/dist/esm/hooks/use-mobile.js +19 -0
- package/dist/esm/hooks/useControlled.js +17 -0
- package/dist/esm/hooks/useFirstMountState.js +14 -0
- package/dist/esm/hooks/useForkRef.js +21 -0
- package/dist/esm/hooks/useLatest.js +10 -0
- package/dist/esm/hooks/usePrevious.js +12 -0
- package/dist/esm/hooks/useScrollState.js +37 -0
- package/dist/esm/hooks/useStateRef.js +10 -0
- package/dist/esm/hooks/useUpdateEffect.js +15 -0
- package/dist/esm/index.js +63 -0
- package/dist/esm/lib/utils.js +13 -0
- package/dist/esm/styles/responsive.js +81 -0
- package/dist/esm/styles/typography.js +21 -0
- package/dist/esm/utils/addIf.js +3 -0
- package/dist/esm/utils/chain.js +28 -0
- package/dist/esm/utils/getBoundingRect.js +16 -0
- package/dist/esm/utils/mergeProps.js +40 -0
- package/dist/esm/utils/mergeRefs.js +15 -0
- package/dist/esm/utils/toggle.js +14 -0
- package/dist/styles.css +1 -0
- package/dist/types/index.d.ts +1418 -0
- package/package.json +114 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { __rest } from 'tslib';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
5
|
+
import { forwardRefWithGeneric, cn } from '../../../lib/utils.js';
|
|
6
|
+
|
|
7
|
+
const linkVariants = cva([
|
|
8
|
+
"text-primary whitespace-nowrap text-sm font-medium underline-offset-4",
|
|
9
|
+
// Focus Styling
|
|
10
|
+
"outline-none focus-visible:underline",
|
|
11
|
+
], {
|
|
12
|
+
variants: {
|
|
13
|
+
underline: {
|
|
14
|
+
hover: "hover:underline",
|
|
15
|
+
always: "underline",
|
|
16
|
+
none: "no-underline",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
defaultVariants: {
|
|
20
|
+
underline: "hover",
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
const Link = forwardRefWithGeneric(function Link(_a, ref) {
|
|
24
|
+
var { underline, tagName, as, className, children } = _a, props = __rest(_a, ["underline", "tagName", "as", "className", "children"]);
|
|
25
|
+
const TagName = tagName || "a";
|
|
26
|
+
const Container = as || Slot;
|
|
27
|
+
return (jsx(Container, Object.assign({ ref: ref, asChild: true, "data-slot": "icon", className: cn(linkVariants({ underline }), className) }, props, { children: jsx(TagName, { children: children }) })));
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export { Link };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { __rest } from 'tslib';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { cn } from '../../../lib/utils.js';
|
|
4
|
+
import { Button } from '../../buttons/button/button.js';
|
|
5
|
+
import { Icon } from '../../media/icon/icon.js';
|
|
6
|
+
|
|
7
|
+
const Pagination = (_a) => {
|
|
8
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
9
|
+
return (jsx("nav", Object.assign({ role: "navigation", "aria-label": "pagination", "data-slot": "pagination", className: cn("mx-auto flex w-full justify-center", className) }, props)));
|
|
10
|
+
};
|
|
11
|
+
Pagination.displayName = "Pagination";
|
|
12
|
+
const PaginationContent = (_a) => {
|
|
13
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
14
|
+
return jsx("ul", Object.assign({ "data-slot": "pagination-content", className: cn("flex flex-row items-center gap-1", className) }, props));
|
|
15
|
+
};
|
|
16
|
+
PaginationContent.displayName = "PaginationContent";
|
|
17
|
+
const PaginationItem = (_a) => {
|
|
18
|
+
var props = __rest(_a, []);
|
|
19
|
+
return jsx("li", Object.assign({ "data-slot": "pagination-item" }, props));
|
|
20
|
+
};
|
|
21
|
+
PaginationItem.displayName = "PaginationItem";
|
|
22
|
+
const PaginationLink = (_a) => {
|
|
23
|
+
var { isActive, size = "icon" } = _a, props = __rest(_a, ["isActive", "size"]);
|
|
24
|
+
return (jsx(Button, { asChild: true, variant: isActive ? "outline" : "ghost", size: size, children: jsx("a", Object.assign({ "aria-current": isActive ? "page" : undefined, "data-slot": "pagination-link", "data-active": isActive }, props)) }));
|
|
25
|
+
};
|
|
26
|
+
PaginationLink.displayName = "PaginationLink";
|
|
27
|
+
const PaginationPrevious = (_a) => {
|
|
28
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
29
|
+
return (jsxs(PaginationLink, Object.assign({ "aria-label": "Go to previous page", size: "default", className: cn("gap-1 px-2.5 sm:pl-2.5", className) }, props, { children: [jsx(Icon, { name: "chevron-left" }), jsx("span", { className: "hidden sm:block", children: "Previous" })] })));
|
|
30
|
+
};
|
|
31
|
+
PaginationPrevious.displayName = "PaginationPrevious";
|
|
32
|
+
const PaginationNext = (_a) => {
|
|
33
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
34
|
+
return (jsxs(PaginationLink, Object.assign({ "aria-label": "Go to next page", size: "default", className: cn("gap-1 px-2.5 sm:pr-2.5", className) }, props, { children: [jsx("span", { className: "hidden sm:block", children: "Next" }), jsx(Icon, { name: "chevron-right" })] })));
|
|
35
|
+
};
|
|
36
|
+
PaginationNext.displayName = "PaginationNext";
|
|
37
|
+
const PaginationEllipsis = (_a) => {
|
|
38
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
39
|
+
return (jsxs("span", Object.assign({ "aria-hidden": true, "data-slot": "pagination-ellipsis", className: cn("flex size-9 items-center justify-center", className) }, props, { children: [jsx(Icon, { name: "more-horizontal", className: "size-4" }), jsx("span", { className: "sr-only", children: "More pages" })] })));
|
|
40
|
+
};
|
|
41
|
+
PaginationEllipsis.displayName = "PaginationEllipsis";
|
|
42
|
+
|
|
43
|
+
export { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { __rest } from 'tslib';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Root, Indicator } from '@radix-ui/react-progress';
|
|
4
|
+
import { cn } from '../../../lib/utils.js';
|
|
5
|
+
|
|
6
|
+
const Progress = (_a) => {
|
|
7
|
+
var { className, value } = _a, props = __rest(_a, ["className", "value"]);
|
|
8
|
+
return (jsx(Root, Object.assign({ "data-slot": "progress", className: cn("bg-primary/20 relative h-2 w-full overflow-hidden rounded-full", className) }, props, { children: jsx(Indicator, { "data-slot": "progress-indicator", className: "bg-primary h-full w-full flex-1 transition-all", style: { transform: `translateX(-${100 - (value || 0)}%)` } }) })));
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { Progress };
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { __rest } from 'tslib';
|
|
3
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
5
|
+
import { cva } from 'class-variance-authority';
|
|
6
|
+
import { createContext, useMemo, useState, useCallback, useEffect, useContext } from 'react';
|
|
7
|
+
import { useIsMobile } from '../../../hooks/use-mobile.js';
|
|
8
|
+
import { cn } from '../../../lib/utils.js';
|
|
9
|
+
import { Icon } from '../../media/icon/icon.js';
|
|
10
|
+
import { Button } from '../../buttons/button/button.js';
|
|
11
|
+
import { Input } from '../../forms/input/input.js';
|
|
12
|
+
import { Separator } from '../../utility/separator/separator.js';
|
|
13
|
+
import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetDescription } from '../../popovers/sheet/sheet.js';
|
|
14
|
+
import { Skeleton } from '../../utility/skeleton/skeleton.js';
|
|
15
|
+
import { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from '../../popovers/tooltip/tooltip.js';
|
|
16
|
+
|
|
17
|
+
const SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
18
|
+
const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
19
|
+
const SIDEBAR_WIDTH = "16rem";
|
|
20
|
+
const SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
21
|
+
const SIDEBAR_WIDTH_ICON = "3rem";
|
|
22
|
+
const SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
23
|
+
const SidebarContext = createContext(null);
|
|
24
|
+
function useSidebar() {
|
|
25
|
+
const context = useContext(SidebarContext);
|
|
26
|
+
if (!context) {
|
|
27
|
+
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
28
|
+
}
|
|
29
|
+
return context;
|
|
30
|
+
}
|
|
31
|
+
function SidebarProvider(_a) {
|
|
32
|
+
var { defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children } = _a, props = __rest(_a, ["defaultOpen", "open", "onOpenChange", "className", "style", "children"]);
|
|
33
|
+
const isMobile = useIsMobile();
|
|
34
|
+
const [openMobile, setOpenMobile] = useState(false);
|
|
35
|
+
// This is the internal state of the sidebar.
|
|
36
|
+
// We use openProp and setOpenProp for control from outside the component.
|
|
37
|
+
const [_open, _setOpen] = useState(defaultOpen);
|
|
38
|
+
const open = openProp !== null && openProp !== void 0 ? openProp : _open;
|
|
39
|
+
const setOpen = useCallback((value) => {
|
|
40
|
+
const openState = typeof value === "function" ? value(open) : value;
|
|
41
|
+
if (setOpenProp) {
|
|
42
|
+
setOpenProp(openState);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
_setOpen(openState);
|
|
46
|
+
}
|
|
47
|
+
// This sets the cookie to keep the sidebar state.
|
|
48
|
+
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
49
|
+
}, [setOpenProp, open]);
|
|
50
|
+
// Helper to toggle the sidebar.
|
|
51
|
+
const toggleSidebar = useCallback(() => {
|
|
52
|
+
return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
|
|
53
|
+
}, [isMobile, setOpen, setOpenMobile]);
|
|
54
|
+
// Adds a keyboard shortcut to toggle the sidebar.
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
const handleKeyDown = (event) => {
|
|
57
|
+
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
toggleSidebar();
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
63
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
64
|
+
}, [toggleSidebar]);
|
|
65
|
+
// We add a state so that we can do data-state="expanded" or "collapsed".
|
|
66
|
+
// This makes it easier to style the sidebar with Tailwind classes.
|
|
67
|
+
const state = open ? "expanded" : "collapsed";
|
|
68
|
+
const contextValue = useMemo(() => ({
|
|
69
|
+
state,
|
|
70
|
+
open,
|
|
71
|
+
setOpen,
|
|
72
|
+
isMobile,
|
|
73
|
+
openMobile,
|
|
74
|
+
setOpenMobile,
|
|
75
|
+
toggleSidebar,
|
|
76
|
+
}), [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]);
|
|
77
|
+
return (jsx(SidebarContext.Provider, { value: contextValue, children: jsx(TooltipProvider, { delayDuration: 0, children: jsx("div", Object.assign({ "data-slot": "sidebar-wrapper", style: Object.assign({ "--sidebar-width": SIDEBAR_WIDTH, "--sidebar-width-icon": SIDEBAR_WIDTH_ICON }, style), className: cn("group/sidebar-wrapper flex min-h-svh w-full", "has-data-[variant=inset]:bg-sidebar", className) }, props, { children: children })) }) }));
|
|
78
|
+
}
|
|
79
|
+
function Sidebar(_a) {
|
|
80
|
+
var { side = "left", variant = "sidebar", collapsible = "offcanvas", className, children } = _a, props = __rest(_a, ["side", "variant", "collapsible", "className", "children"]);
|
|
81
|
+
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
82
|
+
if (collapsible === "none") {
|
|
83
|
+
return (jsx("div", Object.assign({ "data-slot": "sidebar", className: cn("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col", className) }, props, { children: children })));
|
|
84
|
+
}
|
|
85
|
+
if (isMobile) {
|
|
86
|
+
return (jsx(Sheet, Object.assign({ open: openMobile, onOpenChange: setOpenMobile }, props, { children: jsxs(SheetContent, { "data-sidebar": "sidebar", "data-slot": "sidebar", "data-mobile": "true", className: cn("bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0", "[&>button]:hidden"), style: {
|
|
87
|
+
"--sidebar-width": SIDEBAR_WIDTH_MOBILE,
|
|
88
|
+
}, side: side, children: [jsxs(SheetHeader, { className: "sr-only", children: [jsx(SheetTitle, { children: "Sidebar" }), jsx(SheetDescription, { children: "Displays the mobile sidebar." })] }), jsx("div", { className: "flex h-full w-full flex-col", children: children })] }) })));
|
|
89
|
+
}
|
|
90
|
+
return (jsxs("div", { className: "group peer text-sidebar-foreground hidden md:block", "data-state": state, "data-collapsible": state === "collapsed" ? collapsible : "", "data-variant": variant, "data-side": side, "data-slot": "sidebar", children: [jsx("div", { "data-slot": "sidebar-gap", className: cn(
|
|
91
|
+
// Base styles
|
|
92
|
+
"relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear",
|
|
93
|
+
// Collapsible styles
|
|
94
|
+
"group-data-[collapsible=offcanvas]:w-0", "group-data-[side=right]:rotate-180",
|
|
95
|
+
// Variant-specific styles
|
|
96
|
+
variant === "floating" || variant === "inset"
|
|
97
|
+
? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]"
|
|
98
|
+
: "group-data-[collapsible=icon]:w-(--sidebar-width-icon)") }), jsx("div", Object.assign({ "data-slot": "sidebar-container", className: cn(
|
|
99
|
+
// Base styles
|
|
100
|
+
"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",
|
|
101
|
+
// Side-specific styles
|
|
102
|
+
side === "left"
|
|
103
|
+
? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]"
|
|
104
|
+
: "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
|
|
105
|
+
// Variant-specific styles
|
|
106
|
+
variant === "floating" || variant === "inset"
|
|
107
|
+
? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]"
|
|
108
|
+
: "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l", className) }, props, { children: jsx("div", { "data-sidebar": "sidebar", "data-slot": "sidebar-inner", className: cn("bg-sidebar flex h-full w-full flex-col", "group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm"), children: children }) }))] }));
|
|
109
|
+
}
|
|
110
|
+
function SidebarTrigger(_a) {
|
|
111
|
+
var { className, onClick } = _a, props = __rest(_a, ["className", "onClick"]);
|
|
112
|
+
const { toggleSidebar } = useSidebar();
|
|
113
|
+
return (jsxs(Button, Object.assign({ "data-sidebar": "trigger", "data-slot": "sidebar-trigger", variant: "ghost", size: "icon", className: cn("size-7", className), onClick: (event) => {
|
|
114
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
115
|
+
toggleSidebar();
|
|
116
|
+
} }, props, { children: [jsx(Icon, { name: "panel-left" }), jsx("span", { className: "sr-only", children: "Toggle Sidebar" })] })));
|
|
117
|
+
}
|
|
118
|
+
function SidebarRail(_a) {
|
|
119
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
120
|
+
const { toggleSidebar } = useSidebar();
|
|
121
|
+
return (jsx("button", Object.assign({ "data-sidebar": "rail", "data-slot": "sidebar-rail", "aria-label": "Toggle Sidebar", tabIndex: -1, onClick: toggleSidebar, title: "Toggle Sidebar", className: cn(
|
|
122
|
+
// Base styles
|
|
123
|
+
"absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear", "after:absolute after:inset-y-0 after:left-1/2 after:w-[2px]",
|
|
124
|
+
// Side-specific styles
|
|
125
|
+
"group-data-[side=left]:-right-4 group-data-[side=right]:left-0",
|
|
126
|
+
// Cursor styles
|
|
127
|
+
"in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize", "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
|
|
128
|
+
// Hover and collapsible styles
|
|
129
|
+
"hover:after:bg-sidebar-border", "hover:group-data-[collapsible=offcanvas]:bg-sidebar", "group-data-[collapsible=offcanvas]:translate-x-0", "group-data-[collapsible=offcanvas]:after:left-full", "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2", "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2", "sm:flex", className) }, props)));
|
|
130
|
+
}
|
|
131
|
+
function SidebarInset(_a) {
|
|
132
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
133
|
+
return (jsx("main", Object.assign({ "data-slot": "sidebar-inset", className: cn(
|
|
134
|
+
// Base styles
|
|
135
|
+
"bg-background relative flex w-full flex-1 flex-col",
|
|
136
|
+
// Inset variant styles
|
|
137
|
+
"md:peer-data-[variant=inset]:m-2", "md:peer-data-[variant=inset]:ml-0", "md:peer-data-[variant=inset]:rounded-xl", "md:peer-data-[variant=inset]:shadow-sm", "md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2", className) }, props)));
|
|
138
|
+
}
|
|
139
|
+
function SidebarInput(_a) {
|
|
140
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
141
|
+
return (jsx(Input, Object.assign({ "data-slot": "sidebar-input", "data-sidebar": "input", className: cn("bg-background h-8 w-full shadow-none", className) }, props)));
|
|
142
|
+
}
|
|
143
|
+
function SidebarHeader(_a) {
|
|
144
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
145
|
+
return (jsx("div", Object.assign({ "data-slot": "sidebar-header", "data-sidebar": "header", className: cn("flex flex-col gap-2 p-2", className) }, props)));
|
|
146
|
+
}
|
|
147
|
+
function SidebarFooter(_a) {
|
|
148
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
149
|
+
return (jsx("div", Object.assign({ "data-slot": "sidebar-footer", "data-sidebar": "footer", className: cn("flex flex-col gap-2 p-2", className) }, props)));
|
|
150
|
+
}
|
|
151
|
+
function SidebarSeparator(_a) {
|
|
152
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
153
|
+
return (jsx(Separator, Object.assign({ "data-slot": "sidebar-separator", "data-sidebar": "separator", className: cn("bg-sidebar-border mx-2 w-auto", className) }, props)));
|
|
154
|
+
}
|
|
155
|
+
function SidebarContent(_a) {
|
|
156
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
157
|
+
return (jsx("div", Object.assign({ "data-slot": "sidebar-content", "data-sidebar": "content", className: cn("flex min-h-0 flex-1 flex-col gap-2 overflow-auto", "group-data-[collapsible=icon]:overflow-hidden", className) }, props)));
|
|
158
|
+
}
|
|
159
|
+
function SidebarGroup(_a) {
|
|
160
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
161
|
+
return (jsx("div", Object.assign({ "data-slot": "sidebar-group", "data-sidebar": "group", className: cn("relative flex w-full min-w-0 flex-col p-2", className) }, props)));
|
|
162
|
+
}
|
|
163
|
+
function SidebarGroupLabel(_a) {
|
|
164
|
+
var { className, asChild = false } = _a, props = __rest(_a, ["className", "asChild"]);
|
|
165
|
+
const Comp = asChild ? Slot : "div";
|
|
166
|
+
return (jsx(Comp, Object.assign({ "data-slot": "sidebar-group-label", "data-sidebar": "group-label", className: cn(
|
|
167
|
+
// Base styles
|
|
168
|
+
"text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium", "outline-hidden transition-[margin,opacity] duration-200 ease-linear", "focus-visible:ring-2",
|
|
169
|
+
// Icon styles
|
|
170
|
+
"[&>svg]:size-4 [&>svg]:shrink-0",
|
|
171
|
+
// Collapsible styles
|
|
172
|
+
"group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0", className) }, props)));
|
|
173
|
+
}
|
|
174
|
+
function SidebarGroupAction(_a) {
|
|
175
|
+
var { className, asChild = false } = _a, props = __rest(_a, ["className", "asChild"]);
|
|
176
|
+
const Comp = asChild ? Slot : "button";
|
|
177
|
+
return (jsx(Comp, Object.assign({ "data-slot": "sidebar-group-action", "data-sidebar": "group-action", className: cn(
|
|
178
|
+
// Base styles
|
|
179
|
+
"text-sidebar-foreground ring-sidebar-ring absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0", "outline-hidden transition-transform focus-visible:ring-2",
|
|
180
|
+
// Hover styles
|
|
181
|
+
"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
182
|
+
// Icon styles
|
|
183
|
+
"[&>svg]:size-4 [&>svg]:shrink-0",
|
|
184
|
+
// Mobile hit area
|
|
185
|
+
"after:absolute after:-inset-2 md:after:hidden",
|
|
186
|
+
// Collapsible styles
|
|
187
|
+
"group-data-[collapsible=icon]:hidden", className) }, props)));
|
|
188
|
+
}
|
|
189
|
+
function SidebarGroupContent(_a) {
|
|
190
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
191
|
+
return (jsx("div", Object.assign({ "data-slot": "sidebar-group-content", "data-sidebar": "group-content", className: cn("w-full text-sm", className) }, props)));
|
|
192
|
+
}
|
|
193
|
+
function SidebarMenu(_a) {
|
|
194
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
195
|
+
return (jsx("ul", Object.assign({ "data-slot": "sidebar-menu", "data-sidebar": "menu", className: cn("flex w-full min-w-0 flex-col gap-1", className) }, props)));
|
|
196
|
+
}
|
|
197
|
+
function SidebarMenuItem(_a) {
|
|
198
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
199
|
+
return (jsx("li", Object.assign({ "data-slot": "sidebar-menu-item", "data-sidebar": "menu-item", className: cn("group/menu-item relative", className) }, props)));
|
|
200
|
+
}
|
|
201
|
+
function SidebarMenuAction(_a) {
|
|
202
|
+
var { className, asChild = false, showOnHover = false } = _a, props = __rest(_a, ["className", "asChild", "showOnHover"]);
|
|
203
|
+
const Comp = asChild ? Slot : "button";
|
|
204
|
+
return (jsx(Comp, Object.assign({ "data-slot": "sidebar-menu-action", "data-sidebar": "menu-action", className: cn(
|
|
205
|
+
// Base styles
|
|
206
|
+
"text-sidebar-foreground ring-sidebar-ring absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0", "outline-hidden transition-transform focus-visible:ring-2",
|
|
207
|
+
// Hover styles
|
|
208
|
+
"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground", "peer-hover/menu-button:text-sidebar-accent-foreground",
|
|
209
|
+
// Icon styles
|
|
210
|
+
"[&>svg]:size-4 [&>svg]:shrink-0",
|
|
211
|
+
// Mobile hit area
|
|
212
|
+
"after:absolute after:-inset-2 md:after:hidden",
|
|
213
|
+
// Size-specific styles
|
|
214
|
+
"peer-data-[size=sm]/menu-button:top-1", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5",
|
|
215
|
+
// Collapsible styles
|
|
216
|
+
"group-data-[collapsible=icon]:hidden",
|
|
217
|
+
// Hover visibility
|
|
218
|
+
showOnHover &&
|
|
219
|
+
cn("peer-data-[active=true]/menu-button:text-sidebar-accent-foreground", "group-focus-within/menu-item:opacity-100", "group-hover/menu-item:opacity-100", "data-[state=open]:opacity-100", "md:opacity-0"), className) }, props)));
|
|
220
|
+
}
|
|
221
|
+
function SidebarMenuBadge(_a) {
|
|
222
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
223
|
+
return (jsx("div", Object.assign({ "data-slot": "sidebar-menu-badge", "data-sidebar": "menu-badge", className: cn(
|
|
224
|
+
// Base styles
|
|
225
|
+
"text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium", "tabular-nums select-none",
|
|
226
|
+
// Hover and active states
|
|
227
|
+
"peer-hover/menu-button:text-sidebar-accent-foreground", "peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
|
|
228
|
+
// Size-specific styles
|
|
229
|
+
"peer-data-[size=sm]/menu-button:top-1", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5",
|
|
230
|
+
// Collapsible styles
|
|
231
|
+
"group-data-[collapsible=icon]:hidden", className) }, props)));
|
|
232
|
+
}
|
|
233
|
+
function SidebarMenuSkeleton(_a) {
|
|
234
|
+
var { className, showIcon = false } = _a, props = __rest(_a, ["className", "showIcon"]);
|
|
235
|
+
const width = useMemo(() => {
|
|
236
|
+
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
237
|
+
}, []);
|
|
238
|
+
return (jsxs("div", Object.assign({ "data-slot": "sidebar-menu-skeleton", "data-sidebar": "menu-skeleton", className: cn("flex h-8 items-center gap-2 rounded-md px-2", className) }, props, { children: [showIcon && jsx(Skeleton, { className: "size-4 rounded-md", "data-sidebar": "menu-skeleton-icon" }), jsx(Skeleton, { className: "h-4 max-w-(--skeleton-width) flex-1", "data-sidebar": "menu-skeleton-text", style: {
|
|
239
|
+
"--skeleton-width": width,
|
|
240
|
+
} })] })));
|
|
241
|
+
}
|
|
242
|
+
function SidebarMenuSub(_a) {
|
|
243
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
244
|
+
return (jsx("ul", Object.assign({ "data-slot": "sidebar-menu-sub", "data-sidebar": "menu-sub", className: cn(
|
|
245
|
+
// Base styles
|
|
246
|
+
"border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5",
|
|
247
|
+
// Collapsible styles
|
|
248
|
+
"group-data-[collapsible=icon]:hidden", className) }, props)));
|
|
249
|
+
}
|
|
250
|
+
function SidebarMenuSubItem(_a) {
|
|
251
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
252
|
+
return (jsx("li", Object.assign({ "data-slot": "sidebar-menu-sub-item", "data-sidebar": "menu-sub-item", className: cn("group/menu-sub-item relative", className) }, props)));
|
|
253
|
+
}
|
|
254
|
+
function SidebarMenuSubButton(_a) {
|
|
255
|
+
var { asChild = false, size = "md", isActive = false, className } = _a, props = __rest(_a, ["asChild", "size", "isActive", "className"]);
|
|
256
|
+
const Comp = asChild ? Slot : "a";
|
|
257
|
+
return (jsx(Comp, Object.assign({ "data-slot": "sidebar-menu-sub-button", "data-sidebar": "menu-sub-button", "data-size": size, "data-active": isActive, className: cn(
|
|
258
|
+
// Base styles
|
|
259
|
+
"text-sidebar-foreground ring-sidebar-ring flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2", "outline-hidden focus-visible:ring-2",
|
|
260
|
+
// Hover and active states
|
|
261
|
+
"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground", "active:bg-sidebar-accent active:text-sidebar-accent-foreground", "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
|
|
262
|
+
// Icon styles
|
|
263
|
+
"[&>svg]:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0",
|
|
264
|
+
// Text styles
|
|
265
|
+
"[&>span:last-child]:truncate",
|
|
266
|
+
// Size-specific styles
|
|
267
|
+
size === "sm" && "text-xs", size === "md" && "text-sm",
|
|
268
|
+
// Disabled states
|
|
269
|
+
"disabled:pointer-events-none disabled:opacity-50", "aria-disabled:pointer-events-none aria-disabled:opacity-50",
|
|
270
|
+
// Collapsible styles
|
|
271
|
+
"group-data-[collapsible=icon]:hidden", className) }, props)));
|
|
272
|
+
}
|
|
273
|
+
const sidebarMenuButtonVariants = cva("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0", {
|
|
274
|
+
variants: {
|
|
275
|
+
variant: {
|
|
276
|
+
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
277
|
+
outline: cn("bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))]", "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"),
|
|
278
|
+
},
|
|
279
|
+
size: {
|
|
280
|
+
default: "h-8 text-sm",
|
|
281
|
+
sm: "h-7 text-xs",
|
|
282
|
+
lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!",
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
defaultVariants: {
|
|
286
|
+
variant: "default",
|
|
287
|
+
size: "default",
|
|
288
|
+
},
|
|
289
|
+
});
|
|
290
|
+
function SidebarMenuButton(_a) {
|
|
291
|
+
var { asChild = false, isActive = false, variant = "default", size = "default", tooltip, className } = _a, props = __rest(_a, ["asChild", "isActive", "variant", "size", "tooltip", "className"]);
|
|
292
|
+
const Comp = asChild ? Slot : "button";
|
|
293
|
+
const { isMobile, state } = useSidebar();
|
|
294
|
+
const button = (jsx(Comp, Object.assign({ "data-slot": "sidebar-menu-button", "data-sidebar": "menu-button", "data-size": size, "data-active": isActive, className: cn(sidebarMenuButtonVariants({ variant, size }), className) }, props)));
|
|
295
|
+
if (!tooltip) {
|
|
296
|
+
return button;
|
|
297
|
+
}
|
|
298
|
+
if (typeof tooltip === "string") {
|
|
299
|
+
tooltip = {
|
|
300
|
+
children: tooltip,
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
return (jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: button }), jsx(TooltipContent, Object.assign({ side: "right", align: "center", hidden: state !== "collapsed" || isMobile }, tooltip))] }));
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { __rest } from 'tslib';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { cn } from '../../../../lib/utils.js';
|
|
5
|
+
|
|
6
|
+
const cellVariants = cva("p-2 bg-inherit align-middle whitespace-nowrap [&>[role=checkbox]]:translate-y-[2px]", {
|
|
7
|
+
variants: {
|
|
8
|
+
align: {
|
|
9
|
+
left: "text-left",
|
|
10
|
+
center: "text-center",
|
|
11
|
+
right: "text-right",
|
|
12
|
+
},
|
|
13
|
+
sticky: {
|
|
14
|
+
left: "sticky z-[2]",
|
|
15
|
+
right: "sticky z-[2]",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
align: "left",
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
const TableCell = (_a) => {
|
|
23
|
+
var { className, align, sticky } = _a, props = __rest(_a, ["className", "align", "sticky"]);
|
|
24
|
+
return (jsx("td", Object.assign({ "data-slot": "table-cell", "data-sticky": sticky, className: cn(cellVariants({ align, sticky }), className) }, props)));
|
|
25
|
+
};
|
|
26
|
+
TableCell.displayName = "TableCell";
|
|
27
|
+
|
|
28
|
+
export { TableCell };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { __rest } from 'tslib';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { cn } from '../../../../lib/utils.js';
|
|
5
|
+
|
|
6
|
+
const rowVariants = cva("bg-white hover:bg-muted border-b transition-colors", {
|
|
7
|
+
variants: {
|
|
8
|
+
selected: {
|
|
9
|
+
true: "bg-muted",
|
|
10
|
+
false: "",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: {
|
|
14
|
+
selected: false,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
const TableRow = (_a) => {
|
|
18
|
+
var { className, selected } = _a, props = __rest(_a, ["className", "selected"]);
|
|
19
|
+
return (jsx("tr", Object.assign({ "data-slot": "table-row", "data-selected": selected ? "selected" : undefined, className: cn(rowVariants({ selected }), className) }, props)));
|
|
20
|
+
};
|
|
21
|
+
TableRow.displayName = "TableRow";
|
|
22
|
+
|
|
23
|
+
export { TableRow };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { __rest } from 'tslib';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { cn } from '../../../../lib/utils.js';
|
|
4
|
+
|
|
5
|
+
const TableBody = (_a) => {
|
|
6
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
7
|
+
return jsx("tbody", Object.assign({ "data-slot": "table-body", className: cn("[&_tr:last-child]:border-0", className) }, props));
|
|
8
|
+
};
|
|
9
|
+
TableBody.displayName = "TableBody";
|
|
10
|
+
|
|
11
|
+
export { TableBody };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { __rest } from 'tslib';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { cn } from '../../../../lib/utils.js';
|
|
4
|
+
|
|
5
|
+
const TableCaption = (_a) => {
|
|
6
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
7
|
+
return (jsx("caption", Object.assign({ "data-slot": "table-caption", className: cn("text-muted-foreground mt-4 text-sm", className) }, props)));
|
|
8
|
+
};
|
|
9
|
+
TableCaption.displayName = "TableCaption";
|
|
10
|
+
|
|
11
|
+
export { TableCaption };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { __rest } from 'tslib';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { cn } from '../../../../lib/utils.js';
|
|
4
|
+
|
|
5
|
+
const TableFooter = (_a) => {
|
|
6
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
7
|
+
return (jsx("tfoot", Object.assign({ "data-slot": "table-footer", className: cn("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0", className) }, props)));
|
|
8
|
+
};
|
|
9
|
+
TableFooter.displayName = "TableFooter";
|
|
10
|
+
|
|
11
|
+
export { TableFooter };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { __rest } from 'tslib';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { cn } from '../../../../lib/utils.js';
|
|
5
|
+
|
|
6
|
+
const cellVariants = cva("text-foreground h-10 px-2 text-left align-middle font-semibold whitespace-nowrap bg-white [&>[role=checkbox]]:translate-y-[2px]", {
|
|
7
|
+
variants: {
|
|
8
|
+
align: {
|
|
9
|
+
left: "text-left",
|
|
10
|
+
center: "text-center",
|
|
11
|
+
right: "text-right",
|
|
12
|
+
},
|
|
13
|
+
sticky: {
|
|
14
|
+
left: "sticky z-[4]!",
|
|
15
|
+
right: "sticky z-[4]!",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
align: "left",
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
const TableHead = (_a) => {
|
|
23
|
+
var { className, sticky } = _a, props = __rest(_a, ["className", "sticky"]);
|
|
24
|
+
return (jsx("th", Object.assign({ "data-slot": "table-head", "data-sticky": sticky, className: cn(cellVariants({ sticky }), className) }, props)));
|
|
25
|
+
};
|
|
26
|
+
TableHead.displayName = "TableHead";
|
|
27
|
+
|
|
28
|
+
export { TableHead };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { __rest } from 'tslib';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { cn } from '../../../../lib/utils.js';
|
|
4
|
+
|
|
5
|
+
const TableHeader = (_a) => {
|
|
6
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
7
|
+
return jsx("thead", Object.assign({ "data-slot": "table-header", className: cn("[&_tr]:border-b", className) }, props));
|
|
8
|
+
};
|
|
9
|
+
TableHeader.displayName = "TableHeader";
|
|
10
|
+
|
|
11
|
+
export { TableHeader };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { __rest } from 'tslib';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
export { TableCell } from './components/cell.js';
|
|
4
|
+
export { TableRow } from './components/row.js';
|
|
5
|
+
export { TableHead } from './components/table-head.js';
|
|
6
|
+
export { TableHeader } from './components/table-header.js';
|
|
7
|
+
export { TableBody } from './components/table-body.js';
|
|
8
|
+
export { TableFooter } from './components/table-footer.js';
|
|
9
|
+
export { TableCaption } from './components/table-caption.js';
|
|
10
|
+
import { cn } from '../../../lib/utils.js';
|
|
11
|
+
|
|
12
|
+
const Table = (_a) => {
|
|
13
|
+
var { className, stickyHeader, grid } = _a, props = __rest(_a, ["className", "stickyHeader", "grid"]);
|
|
14
|
+
return (jsx("table", Object.assign({ "data-slot": "table", className: cn("w-full table-fixed caption-bottom text-sm", {
|
|
15
|
+
"[&_th]:sticky [&_th]:top-0 [&_th]:z-3": stickyHeader,
|
|
16
|
+
"[&_td]:border-r [&_td]:border-slate-200 [&_th]:border-r [&_th]:border-slate-200": grid,
|
|
17
|
+
}, className) }, props)));
|
|
18
|
+
};
|
|
19
|
+
Table.displayName = "Table";
|
|
20
|
+
const TableContainer = (_a) => {
|
|
21
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
22
|
+
return jsx("div", Object.assign({ "data-slot": "table-container", className: cn("relative w-full overflow-auto", className) }, props));
|
|
23
|
+
};
|
|
24
|
+
TableContainer.displayName = "TableContainer";
|
|
25
|
+
|
|
26
|
+
export { Table, TableContainer };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { __rest } from 'tslib';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
4
|
+
import { cn } from '../../../lib/utils.js';
|
|
5
|
+
|
|
6
|
+
function Tabs(_a) {
|
|
7
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
8
|
+
return jsx(TabsPrimitive.Root, Object.assign({ "data-slot": "tabs", className: cn("flex flex-col gap-2", className) }, props));
|
|
9
|
+
}
|
|
10
|
+
function TabsList(_a) {
|
|
11
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
12
|
+
return (jsx(TabsPrimitive.List, Object.assign({ "data-slot": "tabs-list", className: cn("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]", className) }, props)));
|
|
13
|
+
}
|
|
14
|
+
function TabsTrigger(_a) {
|
|
15
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
16
|
+
return (jsx(TabsPrimitive.Trigger, Object.assign({ "data-slot": "tabs-trigger", className: cn("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className) }, props)));
|
|
17
|
+
}
|
|
18
|
+
function TabsContent(_a) {
|
|
19
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
20
|
+
return jsx(TabsPrimitive.Content, Object.assign({ "data-slot": "tabs-content", className: cn("flex-1 outline-none", className) }, props));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { Tabs, TabsContent, TabsList, TabsTrigger };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { Heading } from '../../typography/heading/heading.js';
|
|
4
|
+
import { Text } from '../../typography/text/text.js';
|
|
5
|
+
import { Button } from '../../buttons/button/button.js';
|
|
6
|
+
import { Flex } from '../../layout/flex/flex.js';
|
|
7
|
+
|
|
8
|
+
const EmptyStateBase = forwardRef((props, ref) => {
|
|
9
|
+
return jsx(Flex, Object.assign({ ref: ref, direction: "col", justify: "center", align: "center", gap: 8 }, props));
|
|
10
|
+
});
|
|
11
|
+
const Image = (props) => jsx(Flex, Object.assign({ align: "center", justify: "center" }, props));
|
|
12
|
+
const Title = (props) => jsx(Heading, Object.assign({ level: 6, color: "primary" }, props));
|
|
13
|
+
const Description = (props) => jsx(Text, Object.assign({ type: "body", color: "primary" }, props));
|
|
14
|
+
const Action = (props) => jsx(Button, Object.assign({ variant: "default", size: "default" }, props));
|
|
15
|
+
const EmptyState = Object.assign(EmptyStateBase, {
|
|
16
|
+
Image,
|
|
17
|
+
Title,
|
|
18
|
+
Description,
|
|
19
|
+
Action,
|
|
20
|
+
});
|
|
21
|
+
Image.displayName = "EmptyState.Image";
|
|
22
|
+
Title.displayName = "EmptyState.Title";
|
|
23
|
+
Description.displayName = "EmptyState.Description";
|
|
24
|
+
Action.displayName = "EmptyState.Action";
|
|
25
|
+
EmptyState.displayName = "EmptyState";
|
|
26
|
+
|
|
27
|
+
export { EmptyState };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { __rest } from 'tslib';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Root } from '@radix-ui/react-separator';
|
|
4
|
+
import { cn } from '../../../lib/utils.js';
|
|
5
|
+
|
|
6
|
+
const Separator = (_a) => {
|
|
7
|
+
var { className, orientation = "horizontal", decorative = true } = _a, props = __rest(_a, ["className", "orientation", "decorative"]);
|
|
8
|
+
return (jsx(Root, Object.assign({ "data-slot": "separator-root", decorative: decorative, orientation: orientation, className: cn("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px", className) }, props)));
|
|
9
|
+
};
|
|
10
|
+
Separator.displayName = "Separator";
|
|
11
|
+
|
|
12
|
+
export { Separator };
|