@aaas-pro/library 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/README.md +107 -2
- package/dist/components/address-picker.d.ts +18 -0
- package/dist/components/address-picker.js +46 -0
- package/dist/components/card-date-filter.d.ts +12 -0
- package/dist/components/card-date-filter.js +95 -0
- package/dist/components/date-time-picker.d.ts +12 -0
- package/dist/components/date-time-picker.js +96 -0
- package/dist/components/detail-dialog.d.ts +48 -0
- package/dist/components/detail-dialog.js +97 -0
- package/dist/components/document-links.d.ts +13 -0
- package/dist/components/document-links.js +19 -0
- package/dist/components/draft-row-actions.d.ts +14 -0
- package/dist/components/draft-row-actions.js +70 -0
- package/dist/components/error-boundary.d.ts +14 -0
- package/dist/components/error-boundary.js +35 -0
- package/dist/components/glow-card.d.ts +13 -0
- package/dist/components/glow-card.js +48 -0
- package/dist/components/org-picker.d.ts +17 -0
- package/dist/components/org-picker.js +56 -0
- package/dist/components/overflow-row-actions.d.ts +29 -0
- package/dist/components/overflow-row-actions.js +135 -0
- package/dist/components/page-header.d.ts +21 -0
- package/dist/components/page-header.js +21 -0
- package/dist/components/permission-button.d.ts +4 -0
- package/dist/components/permission-button.js +17 -0
- package/dist/components/permission-context.d.ts +12 -0
- package/dist/components/permission-context.js +17 -0
- package/dist/components/person-picker.d.ts +20 -0
- package/dist/components/person-picker.js +38 -0
- package/dist/components/process-flow-bar.d.ts +15 -0
- package/dist/components/process-flow-bar.js +19 -0
- package/dist/components/product-picker.d.ts +19 -0
- package/dist/components/product-picker.js +155 -0
- package/dist/components/ref-doc-picker.d.ts +24 -0
- package/dist/components/ref-doc-picker.js +139 -0
- package/dist/components/scroll-to-top.d.ts +1 -0
- package/dist/components/scroll-to-top.js +20 -0
- package/dist/components/state-view.d.ts +26 -0
- package/dist/components/state-view.js +75 -0
- package/dist/components/theme-switcher.d.ts +27 -0
- package/dist/components/theme-switcher.js +77 -0
- package/dist/components/time-filter.d.ts +7 -0
- package/dist/components/time-filter.js +65 -0
- package/dist/components/ui/accordion.d.ts +7 -0
- package/dist/components/ui/accordion.js +64 -0
- package/dist/components/ui/alert-dialog.d.ts +15 -0
- package/dist/components/ui/alert-dialog.js +160 -0
- package/dist/components/ui/alert.d.ts +12 -0
- package/dist/components/ui/alert.js +66 -0
- package/dist/components/ui/aspect-ratio.d.ts +3 -0
- package/dist/components/ui/aspect-ratio.js +10 -0
- package/dist/components/ui/avatar.d.ts +6 -0
- package/dist/components/ui/avatar.js +53 -0
- package/dist/components/ui/badge.d.ts +12 -0
- package/dist/components/ui/badge.js +44 -0
- package/dist/components/ui/breadcrumb.d.ts +11 -0
- package/dist/components/ui/breadcrumb.js +103 -0
- package/dist/components/ui/button-group.d.ts +14 -0
- package/dist/components/ui/button-group.js +76 -0
- package/dist/components/ui/button.d.ts +20 -0
- package/dist/components/ui/button.js +93 -0
- package/dist/components/ui/calendar.d.ts +73 -0
- package/dist/components/ui/calendar.js +103 -0
- package/dist/components/ui/card.d.ts +9 -0
- package/dist/components/ui/card.js +90 -0
- package/dist/components/ui/carousel.d.ts +14 -0
- package/dist/components/ui/carousel.js +200 -0
- package/dist/components/ui/chart.d.ts +43 -0
- package/dist/components/ui/chart.js +252 -0
- package/dist/components/ui/checkbox.d.ts +4 -0
- package/dist/components/ui/checkbox.js +31 -0
- package/dist/components/ui/collapsible.d.ts +5 -0
- package/dist/components/ui/collapsible.js +34 -0
- package/dist/components/ui/command.d.ts +18 -0
- package/dist/components/ui/command.js +170 -0
- package/dist/components/ui/context-menu.d.ts +26 -0
- package/dist/components/ui/context-menu.js +237 -0
- package/dist/components/ui/dialog.d.ts +17 -0
- package/dist/components/ui/dialog.js +139 -0
- package/dist/components/ui/drawer.d.ts +13 -0
- package/dist/components/ui/drawer.js +129 -0
- package/dist/components/ui/dropdown-menu.d.ts +26 -0
- package/dist/components/ui/dropdown-menu.js +245 -0
- package/dist/components/ui/empty.d.ts +14 -0
- package/dist/components/ui/empty.js +102 -0
- package/dist/components/ui/field.d.ts +27 -0
- package/dist/components/ui/field.js +229 -0
- package/dist/components/ui/form.d.ts +26 -0
- package/dist/components/ui/form.js +118 -0
- package/dist/components/ui/hover-card.d.ts +6 -0
- package/dist/components/ui/hover-card.js +39 -0
- package/dist/components/ui/input-group.d.ts +22 -0
- package/dist/components/ui/input-group.js +156 -0
- package/dist/components/ui/input-otp.d.ts +11 -0
- package/dist/components/ui/input-otp.js +66 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/input.js +21 -0
- package/dist/components/ui/item.d.ts +29 -0
- package/dist/components/ui/item.js +187 -0
- package/dist/components/ui/kbd.d.ts +3 -0
- package/dist/components/ui/kbd.js +31 -0
- package/dist/components/ui/label.d.ts +4 -0
- package/dist/components/ui/label.js +22 -0
- package/dist/components/ui/menubar.d.ts +26 -0
- package/dist/components/ui/menubar.js +252 -0
- package/dist/components/ui/navigation-menu.d.ts +17 -0
- package/dist/components/ui/navigation-menu.js +170 -0
- package/dist/components/ui/pagination.d.ts +13 -0
- package/dist/components/ui/pagination.js +118 -0
- package/dist/components/ui/popover.d.ts +8 -0
- package/dist/components/ui/popover.js +47 -0
- package/dist/components/ui/progress.d.ts +4 -0
- package/dist/components/ui/progress.js +34 -0
- package/dist/components/ui/radio-group.d.ts +5 -0
- package/dist/components/ui/radio-group.js +45 -0
- package/dist/components/ui/resizable.d.ts +7 -0
- package/dist/components/ui/resizable.js +49 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/scroll-area.js +60 -0
- package/dist/components/ui/select.d.ts +17 -0
- package/dist/components/ui/select.js +215 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/separator.js +26 -0
- package/dist/components/ui/sheet.d.ts +13 -0
- package/dist/components/ui/sheet.js +127 -0
- package/dist/components/ui/sidebar.d.ts +72 -0
- package/dist/components/ui/sidebar.js +656 -0
- package/dist/components/ui/skeleton.d.ts +2 -0
- package/dist/components/ui/skeleton.js +15 -0
- package/dist/components/ui/slider.d.ts +4 -0
- package/dist/components/ui/slider.js +63 -0
- package/dist/components/ui/sonner.d.ts +4 -0
- package/dist/components/ui/sonner.js +34 -0
- package/dist/components/ui/spinner.d.ts +2 -0
- package/dist/components/ui/spinner.js +17 -0
- package/dist/components/ui/switch.d.ts +4 -0
- package/dist/components/ui/switch.js +31 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/table.js +114 -0
- package/dist/components/ui/tabs.d.ts +7 -0
- package/dist/components/ui/tabs.js +67 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/textarea.js +18 -0
- package/dist/components/ui/toggle-group.d.ts +9 -0
- package/dist/components/ui/toggle-group.js +68 -0
- package/dist/components/ui/toggle.d.ts +12 -0
- package/dist/components/ui/toggle.js +43 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/components/ui/tooltip.js +56 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +18 -0
- package/dist/icons/index.d.ts +57 -0
- package/dist/icons/index.js +115 -0
- package/dist/icons/paths.d.ts +556 -0
- package/dist/icons/paths.js +231 -0
- package/dist/index.d.ts +68 -0
- package/dist/index.js +399 -0
- package/dist/internal/selection-base.d.ts +37 -0
- package/dist/internal/selection-base.js +40 -0
- package/dist/lib/class-names.d.ts +6 -0
- package/dist/lib/class-names.js +159 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.js +7 -0
- package/dist/lib/variants.d.ts +21 -0
- package/dist/lib/variants.js +21 -0
- package/dist/primitives/accordion.d.ts +29 -0
- package/dist/primitives/accordion.js +49 -0
- package/dist/primitives/alert-dialog.d.ts +10 -0
- package/dist/primitives/alert-dialog.js +22 -0
- package/dist/primitives/aspect-ratio.d.ts +4 -0
- package/dist/primitives/aspect-ratio.js +7 -0
- package/dist/primitives/avatar.d.ts +8 -0
- package/dist/primitives/avatar.js +45 -0
- package/dist/primitives/carousel.d.ts +22 -0
- package/dist/primitives/carousel.js +78 -0
- package/dist/primitives/chart.d.ts +71 -0
- package/dist/primitives/chart.js +125 -0
- package/dist/primitives/checkbox.d.ts +13 -0
- package/dist/primitives/checkbox.js +24 -0
- package/dist/primitives/collapsible.d.ts +14 -0
- package/dist/primitives/collapsible.js +29 -0
- package/dist/primitives/command.d.ts +43 -0
- package/dist/primitives/command.js +98 -0
- package/dist/primitives/context-menu.d.ts +24 -0
- package/dist/primitives/context-menu.js +19 -0
- package/dist/primitives/core.d.ts +25 -0
- package/dist/primitives/core.js +89 -0
- package/dist/primitives/dialog.d.ts +7 -0
- package/dist/primitives/dialog.js +15 -0
- package/dist/primitives/drawer.d.ts +30 -0
- package/dist/primitives/drawer.js +39 -0
- package/dist/primitives/dropdown-menu.d.ts +24 -0
- package/dist/primitives/dropdown-menu.js +19 -0
- package/dist/primitives/form.d.ts +154 -0
- package/dist/primitives/form.js +139 -0
- package/dist/primitives/hover-card.d.ts +4 -0
- package/dist/primitives/hover-card.js +8 -0
- package/dist/primitives/input-otp.d.ts +21 -0
- package/dist/primitives/input-otp.js +78 -0
- package/dist/primitives/label.d.ts +2 -0
- package/dist/primitives/label.js +7 -0
- package/dist/primitives/layer.d.ts +84 -0
- package/dist/primitives/layer.js +300 -0
- package/dist/primitives/menu.d.ts +56 -0
- package/dist/primitives/menu.js +126 -0
- package/dist/primitives/menubar.d.ts +91 -0
- package/dist/primitives/menubar.js +44 -0
- package/dist/primitives/navigation-menu.d.ts +32 -0
- package/dist/primitives/navigation-menu.js +121 -0
- package/dist/primitives/popover.d.ts +4 -0
- package/dist/primitives/popover.js +12 -0
- package/dist/primitives/progress.d.ts +7 -0
- package/dist/primitives/progress.js +13 -0
- package/dist/primitives/radio-group.d.ts +18 -0
- package/dist/primitives/radio-group.js +36 -0
- package/dist/primitives/resizable.d.ts +19 -0
- package/dist/primitives/resizable.js +91 -0
- package/dist/primitives/scroll-area.d.ts +12 -0
- package/dist/primitives/scroll-area.js +26 -0
- package/dist/primitives/select.d.ts +42 -0
- package/dist/primitives/select.js +167 -0
- package/dist/primitives/separator.d.ts +5 -0
- package/dist/primitives/separator.js +7 -0
- package/dist/primitives/slider.d.ts +25 -0
- package/dist/primitives/slider.js +98 -0
- package/dist/primitives/slot.d.ts +1 -0
- package/dist/primitives/slot.js +4 -0
- package/dist/primitives/switch.d.ts +11 -0
- package/dist/primitives/switch.js +22 -0
- package/dist/primitives/tabs.d.ts +23 -0
- package/dist/primitives/tabs.js +38 -0
- package/dist/primitives/toast.d.ts +55 -0
- package/dist/primitives/toast.js +86 -0
- package/dist/primitives/toggle-group.d.ts +24 -0
- package/dist/primitives/toggle-group.js +33 -0
- package/dist/primitives/toggle.d.ts +7 -0
- package/dist/primitives/toggle.js +13 -0
- package/dist/primitives/tooltip.d.ts +7 -0
- package/dist/primitives/tooltip.js +10 -0
- package/dist/style-entry.d.ts +1 -0
- package/dist/style-entry.js +1 -0
- package/dist/styles.css +7016 -0
- package/dist/styles.js +1 -0
- package/dist/theme/index.d.ts +110 -0
- package/dist/theme/index.js +199 -0
- package/licenses/Lucide.txt +15 -0
- package/package.json +67 -4
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from "../../lib/variants.js";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
import { Separator } from "./separator.js";
|
|
5
|
+
import { Slot } from "../../primitives/core.js";
|
|
6
|
+
const buttonGroupVariants = cva(
|
|
7
|
+
"flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
orientation: {
|
|
11
|
+
horizontal: "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",
|
|
12
|
+
vertical: "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
orientation: "horizontal"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
function ButtonGroup({
|
|
21
|
+
className,
|
|
22
|
+
orientation,
|
|
23
|
+
...props
|
|
24
|
+
}) {
|
|
25
|
+
return /* @__PURE__ */ jsx(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
role: "group",
|
|
29
|
+
"data-slot": "button-group",
|
|
30
|
+
"data-orientation": orientation,
|
|
31
|
+
className: cn(buttonGroupVariants({ orientation }), className),
|
|
32
|
+
...props
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
function ButtonGroupText({
|
|
37
|
+
className,
|
|
38
|
+
asChild = false,
|
|
39
|
+
...props
|
|
40
|
+
}) {
|
|
41
|
+
const Comp = asChild ? Slot : "div";
|
|
42
|
+
return /* @__PURE__ */ jsx(
|
|
43
|
+
Comp,
|
|
44
|
+
{
|
|
45
|
+
className: cn(
|
|
46
|
+
"bg-muted flex items-center gap-2 rounded-md border px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
47
|
+
className
|
|
48
|
+
),
|
|
49
|
+
...props
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
function ButtonGroupSeparator({
|
|
54
|
+
className,
|
|
55
|
+
orientation = "vertical",
|
|
56
|
+
...props
|
|
57
|
+
}) {
|
|
58
|
+
return /* @__PURE__ */ jsx(
|
|
59
|
+
Separator,
|
|
60
|
+
{
|
|
61
|
+
"data-slot": "button-group-separator",
|
|
62
|
+
orientation,
|
|
63
|
+
className: cn(
|
|
64
|
+
"bg-input relative !m-0 self-stretch data-[orientation=vertical]:h-auto",
|
|
65
|
+
className
|
|
66
|
+
),
|
|
67
|
+
...props
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
ButtonGroup,
|
|
73
|
+
ButtonGroupSeparator,
|
|
74
|
+
ButtonGroupText,
|
|
75
|
+
buttonGroupVariants
|
|
76
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type VariantProps } from '../../lib/variants';
|
|
3
|
+
import { type PermissionProps } from '../permission-context';
|
|
4
|
+
export type ButtonColor = 'default' | 'primary' | 'success' | 'warning' | 'danger';
|
|
5
|
+
export type ButtonProps = Omit<React.ComponentProps<'button'>, 'color'> & VariantProps<typeof buttonVariants> & PermissionProps & {
|
|
6
|
+
asChild?: boolean;
|
|
7
|
+
/** 不传时:destructive 使用 danger,其余使用 primary。 */
|
|
8
|
+
color?: ButtonColor;
|
|
9
|
+
/** 加载时显示指示图标,同时禁用交互。asChild 时仅设置 aria-busy 和禁用标记。 */
|
|
10
|
+
loading?: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare const buttonVariants: (props?: ({
|
|
13
|
+
variant?: "link" | "outline" | "default" | "destructive" | "secondary" | "ghost" | null | undefined;
|
|
14
|
+
size?: "default" | "icon" | "sm" | "lg" | "icon-sm" | "icon-lg" | null | undefined;
|
|
15
|
+
} & {
|
|
16
|
+
class?: import("../../lib/class-names").ClassValue;
|
|
17
|
+
className?: import("../../lib/class-names").ClassValue;
|
|
18
|
+
}) | undefined) => string;
|
|
19
|
+
declare function Button({ className, variant, size, asChild, color, loading, disabled, children, style, permissionAction, permissionResource, permissionCommand, ...props }: ButtonProps): React.JSX.Element | null;
|
|
20
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from "../../lib/variants.js";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
import { Loader2 } from "../../icons/index.js";
|
|
5
|
+
import { usePermissionCheck } from "../permission-context.js";
|
|
6
|
+
import { Slot } from "../../primitives/core.js";
|
|
7
|
+
const buttonVariants = cva(
|
|
8
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium select-none transition-[color,background-color,border-color,box-shadow,transform] duration-150 ease-[var(--ease-standard)] active:not-disabled:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:ring-ring/20 focus-visible:ring-2 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
default: "bg-primary text-primary-foreground shadow-[inset_0_1px_0_rgb(255_255_255/0.14),0_1px_2px_color-mix(in_srgb,var(--button-tone)_30%,transparent)] hover:shadow-[inset_0_1px_0_rgb(255_255_255/0.14),0_4px_12px_-4px_color-mix(in_srgb,var(--button-tone)_55%,transparent)] active:shadow-[inset_0_1px_2px_rgb(0_0_0/0.12)]",
|
|
13
|
+
destructive: "bg-destructive text-white shadow-[inset_0_1px_0_rgb(255_255_255/0.14),0_1px_2px_color-mix(in_srgb,var(--button-tone)_30%,transparent)] hover:shadow-[inset_0_1px_0_rgb(255_255_255/0.14),0_4px_12px_-4px_color-mix(in_srgb,var(--button-tone)_55%,transparent)] active:shadow-[inset_0_1px_2px_rgb(0_0_0/0.12)] focus-visible:ring-destructive/30 dark:bg-destructive/60",
|
|
14
|
+
outline: "border bg-card shadow-xs hover:bg-[color-mix(in_srgb,var(--button-tone)_6%,var(--card))] dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
15
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_srgb,var(--primary)_22%,var(--card))]",
|
|
16
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
17
|
+
link: "text-primary underline-offset-4 hover:underline active:translate-y-0"
|
|
18
|
+
},
|
|
19
|
+
size: {
|
|
20
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
21
|
+
sm: "h-8 gap-1.5 px-3 text-[13px] has-[>svg]:px-2.5",
|
|
22
|
+
lg: "h-10 px-6 has-[>svg]:px-4",
|
|
23
|
+
icon: "size-9",
|
|
24
|
+
"icon-sm": "size-8",
|
|
25
|
+
"icon-lg": "size-10"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
defaultVariants: {
|
|
29
|
+
variant: "default",
|
|
30
|
+
size: "default"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
function Button({
|
|
35
|
+
className,
|
|
36
|
+
variant = "default",
|
|
37
|
+
size = "default",
|
|
38
|
+
asChild = false,
|
|
39
|
+
color,
|
|
40
|
+
loading = false,
|
|
41
|
+
disabled,
|
|
42
|
+
children,
|
|
43
|
+
style,
|
|
44
|
+
permissionAction,
|
|
45
|
+
permissionResource,
|
|
46
|
+
permissionCommand,
|
|
47
|
+
...props
|
|
48
|
+
}) {
|
|
49
|
+
const permitted = usePermissionCheck({ permissionAction, permissionResource, permissionCommand });
|
|
50
|
+
const Comp = asChild ? Slot : "button";
|
|
51
|
+
const resolvedColor = color ?? (variant === "destructive" ? "danger" : "primary");
|
|
52
|
+
const tones = { default: "var(--foreground)", primary: "var(--primary)", success: "var(--success)", warning: "var(--warning)", danger: "var(--destructive)" };
|
|
53
|
+
if (!permitted()) return null;
|
|
54
|
+
return /* @__PURE__ */ jsx(
|
|
55
|
+
Comp,
|
|
56
|
+
{
|
|
57
|
+
"data-slot": "button",
|
|
58
|
+
"data-variant": variant,
|
|
59
|
+
"data-size": size,
|
|
60
|
+
"data-color": resolvedColor,
|
|
61
|
+
disabled: disabled || loading,
|
|
62
|
+
"aria-busy": loading || void 0,
|
|
63
|
+
style: { "--button-tone": tones[resolvedColor], ...style },
|
|
64
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
65
|
+
...props,
|
|
66
|
+
"aria-disabled": disabled || loading ? true : props["aria-disabled"],
|
|
67
|
+
onClickCapture: (event) => {
|
|
68
|
+
if (disabled || loading || !permitted()) {
|
|
69
|
+
event.preventDefault();
|
|
70
|
+
event.stopPropagation();
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
props.onClickCapture?.(event);
|
|
74
|
+
},
|
|
75
|
+
onClick: (event) => {
|
|
76
|
+
if (disabled || loading || !permitted()) {
|
|
77
|
+
event.preventDefault();
|
|
78
|
+
event.stopPropagation();
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
props.onClick?.(event);
|
|
82
|
+
},
|
|
83
|
+
children: asChild ? children : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
84
|
+
loading && /* @__PURE__ */ jsx(Loader2, { "aria-hidden": true, className: "size-4 animate-spin" }),
|
|
85
|
+
children
|
|
86
|
+
] })
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
export {
|
|
91
|
+
Button,
|
|
92
|
+
buttonVariants
|
|
93
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Button } from './button';
|
|
3
|
+
export type DateRange = {
|
|
4
|
+
from: Date | undefined;
|
|
5
|
+
to?: Date;
|
|
6
|
+
};
|
|
7
|
+
export type DateMatcher = boolean | Date | Date[] | ((date: Date) => boolean) | {
|
|
8
|
+
before?: Date;
|
|
9
|
+
after?: Date;
|
|
10
|
+
from?: Date;
|
|
11
|
+
to?: Date;
|
|
12
|
+
dayOfWeek?: number[];
|
|
13
|
+
};
|
|
14
|
+
type Selection = {
|
|
15
|
+
mode?: undefined;
|
|
16
|
+
selected?: never;
|
|
17
|
+
onSelect?: never;
|
|
18
|
+
} | {
|
|
19
|
+
mode: 'single';
|
|
20
|
+
selected?: Date;
|
|
21
|
+
onSelect?: (date: Date | undefined) => void;
|
|
22
|
+
} | {
|
|
23
|
+
mode: 'multiple';
|
|
24
|
+
selected?: Date[];
|
|
25
|
+
onSelect?: (dates: Date[] | undefined) => void;
|
|
26
|
+
} | {
|
|
27
|
+
mode: 'range';
|
|
28
|
+
selected?: DateRange;
|
|
29
|
+
onSelect?: (range: DateRange | undefined) => void;
|
|
30
|
+
};
|
|
31
|
+
interface CalendarBaseProps extends Omit<React.ComponentProps<'div'>, 'onSelect' | 'hidden'> {
|
|
32
|
+
month?: Date;
|
|
33
|
+
defaultMonth?: Date;
|
|
34
|
+
onMonthChange?: (month: Date) => void;
|
|
35
|
+
numberOfMonths?: number;
|
|
36
|
+
showOutsideDays?: boolean;
|
|
37
|
+
disabled?: DateMatcher | DateMatcher[];
|
|
38
|
+
hidden?: DateMatcher | DateMatcher[];
|
|
39
|
+
required?: boolean;
|
|
40
|
+
min?: number;
|
|
41
|
+
max?: number;
|
|
42
|
+
excludeDisabled?: boolean;
|
|
43
|
+
startMonth?: Date;
|
|
44
|
+
endMonth?: Date;
|
|
45
|
+
weekStartsOn?: number;
|
|
46
|
+
locale?: string | {
|
|
47
|
+
code?: string;
|
|
48
|
+
options?: {
|
|
49
|
+
weekStartsOn?: number;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
captionLayout?: 'label' | 'dropdown';
|
|
53
|
+
buttonVariant?: React.ComponentProps<typeof Button>['variant'];
|
|
54
|
+
classNames?: Partial<Record<'root' | 'months' | 'month' | 'day' | 'selected' | 'range_middle' | 'outside' | 'disabled', string>>;
|
|
55
|
+
formatters?: {
|
|
56
|
+
formatMonthDropdown?: (date: Date) => string;
|
|
57
|
+
formatCaption?: (date: Date) => string;
|
|
58
|
+
};
|
|
59
|
+
components?: {
|
|
60
|
+
DayButton?: React.ComponentType<CalendarDayButtonProps>;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export type CalendarProps = CalendarBaseProps & Selection;
|
|
64
|
+
export interface CalendarDayButtonProps extends React.ComponentProps<typeof Button> {
|
|
65
|
+
day: {
|
|
66
|
+
date: Date;
|
|
67
|
+
displayMonth: Date;
|
|
68
|
+
};
|
|
69
|
+
modifiers: Record<string, boolean>;
|
|
70
|
+
}
|
|
71
|
+
export declare function CalendarDayButton({ day, modifiers, className, ...props }: CalendarDayButtonProps): React.JSX.Element;
|
|
72
|
+
export declare function Calendar({ month, defaultMonth, onMonthChange, numberOfMonths, showOutsideDays, disabled, hidden, required, min, max, excludeDisabled, startMonth, endMonth, weekStartsOn, locale, captionLayout, buttonVariant, classNames, formatters, components, mode, selected, onSelect, className, ref, ...props }: CalendarProps): React.JSX.Element;
|
|
73
|
+
export {};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { ChevronLeftIcon, ChevronRightIcon } from "../../icons/index.js";
|
|
4
|
+
import { useControllable, useMergedRef } from "../../primitives/core.js";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
import { Button } from "./button.js";
|
|
7
|
+
const stamp = (date) => new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime();
|
|
8
|
+
const same = (a, b) => !!a && !!b && stamp(a) === stamp(b);
|
|
9
|
+
const shiftDay = (date, amount) => new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
|
|
10
|
+
const monthStart = (date) => new Date(date.getFullYear(), date.getMonth(), 1);
|
|
11
|
+
const shiftMonth = (date, amount) => new Date(date.getFullYear(), date.getMonth() + amount, 1);
|
|
12
|
+
const shiftFocusMonth = (date, amount) => {
|
|
13
|
+
const first = shiftMonth(date, amount);
|
|
14
|
+
const lastDay = new Date(first.getFullYear(), first.getMonth() + 1, 0).getDate();
|
|
15
|
+
return new Date(first.getFullYear(), first.getMonth(), Math.min(date.getDate(), lastDay));
|
|
16
|
+
};
|
|
17
|
+
function matches(date, matcher) {
|
|
18
|
+
if (Array.isArray(matcher)) return matcher.some((item) => matches(date, item));
|
|
19
|
+
if (typeof matcher === "boolean") return matcher;
|
|
20
|
+
if (typeof matcher === "function") return matcher(date);
|
|
21
|
+
if (matcher instanceof Date) return same(date, matcher);
|
|
22
|
+
if (!matcher) return false;
|
|
23
|
+
return !!matcher.before && stamp(date) < stamp(matcher.before) || !!matcher.after && stamp(date) > stamp(matcher.after) || !!matcher.from && !!matcher.to && stamp(date) >= stamp(matcher.from) && stamp(date) <= stamp(matcher.to) || !!matcher.dayOfWeek?.includes(date.getDay());
|
|
24
|
+
}
|
|
25
|
+
function CalendarDayButton({ day, modifiers, className, ...props }) {
|
|
26
|
+
return /* @__PURE__ */ jsx(Button, { ...props, type: "button", variant: "ghost", size: "icon", "data-day": day.date.toLocaleDateString(), "data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle, "data-range-start": modifiers.range_start, "data-range-end": modifiers.range_end, "data-range-middle": modifiers.range_middle, className: cn("size-8 rounded-md font-normal data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-accent", className) });
|
|
27
|
+
}
|
|
28
|
+
function Calendar({ month, defaultMonth, onMonthChange, numberOfMonths = 1, showOutsideDays = true, disabled, hidden, required = false, min = 0, max, excludeDisabled = false, startMonth, endMonth, weekStartsOn, locale = "zh-CN", captionLayout = "label", buttonVariant = "ghost", classNames = {}, formatters, components, mode, selected, onSelect, className, ref, ...props }) {
|
|
29
|
+
const initial = defaultMonth ?? (selected instanceof Date ? selected : mode === "range" ? selected?.from : void 0) ?? /* @__PURE__ */ new Date();
|
|
30
|
+
const [current, setMonth] = useControllable(month, monthStart(initial), onMonthChange), [focusDate, setFocusDate] = React.useState(initial);
|
|
31
|
+
const root = React.useRef(null), language = typeof locale === "string" ? locale : locale.code ?? "zh-CN";
|
|
32
|
+
const merged = useMergedRef(ref, root);
|
|
33
|
+
const weekStart = ((weekStartsOn ?? (typeof locale === "object" ? locale.options?.weekStartsOn : void 0) ?? 1) % 7 + 7) % 7, months = Math.max(1, Math.floor(numberOfMonths));
|
|
34
|
+
const unavailable = (date) => matches(date, disabled) || !!startMonth && stamp(date) < stamp(monthStart(startMonth)) || !!endMonth && stamp(date) >= stamp(shiftMonth(endMonth, 1));
|
|
35
|
+
const unfocusable = (date) => unavailable(date) || matches(date, hidden);
|
|
36
|
+
const choose = (date) => {
|
|
37
|
+
if (unavailable(date)) return;
|
|
38
|
+
if (mode === "single") onSelect?.(!required && same(selected, date) ? void 0 : date);
|
|
39
|
+
if (mode === "multiple") {
|
|
40
|
+
const list = selected ?? [], found = list.some((item) => same(item, date));
|
|
41
|
+
if (found && list.length <= Math.max(min, required ? 1 : 0) || !found && max !== void 0 && list.length >= max) return;
|
|
42
|
+
onSelect?.(found ? list.filter((item) => !same(item, date)) : [...list, date]);
|
|
43
|
+
}
|
|
44
|
+
if (mode === "range") {
|
|
45
|
+
const range = selected, change = onSelect;
|
|
46
|
+
if (!range?.from || range.to) change?.({ from: date });
|
|
47
|
+
else {
|
|
48
|
+
const from = stamp(date) < stamp(range.from) ? date : range.from, to = stamp(date) < stamp(range.from) ? range.from : date, count = Math.round((stamp(to) - stamp(from)) / 864e5);
|
|
49
|
+
if (count < min || max !== void 0 && count > max) return;
|
|
50
|
+
if (excludeDisabled && Array.from({ length: count + 1 }, (_, i) => shiftDay(from, i)).some(unavailable)) {
|
|
51
|
+
change?.({ from: date });
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
change?.({ from, to });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const navigate = (date, event) => {
|
|
59
|
+
const delta = { ArrowLeft: -1, ArrowRight: 1, ArrowUp: -7, ArrowDown: 7 };
|
|
60
|
+
let next = delta[event.key] !== void 0 ? shiftDay(date, delta[event.key]) : event.key === "Home" ? shiftDay(date, -((date.getDay() - weekStart + 7) % 7)) : event.key === "End" ? shiftDay(date, 6 - (date.getDay() - weekStart + 7) % 7) : event.key === "PageUp" || event.key === "PageDown" ? shiftFocusMonth(date, (event.key === "PageDown" ? 1 : -1) * (event.shiftKey ? 12 : 1)) : null;
|
|
61
|
+
if (!next) return;
|
|
62
|
+
event.preventDefault();
|
|
63
|
+
const direction = ["ArrowLeft", "ArrowUp", "Home", "PageUp"].includes(event.key) ? -1 : 1;
|
|
64
|
+
for (let i = 0; unfocusable(next) && i < 366; i++) next = shiftDay(next, direction);
|
|
65
|
+
if (unfocusable(next)) return;
|
|
66
|
+
setFocusDate(next);
|
|
67
|
+
if (stamp(next) < stamp(monthStart(current)) || stamp(next) >= stamp(shiftMonth(current, months))) setMonth(monthStart(next));
|
|
68
|
+
const target = next;
|
|
69
|
+
requestAnimationFrame(() => root.current?.querySelector(`button[data-date="${stamp(target)}"]`)?.focus());
|
|
70
|
+
};
|
|
71
|
+
React.useEffect(() => {
|
|
72
|
+
if (stamp(focusDate) >= stamp(monthStart(current)) && stamp(focusDate) < stamp(shiftMonth(current, months)) && !unfocusable(focusDate)) return;
|
|
73
|
+
let next = monthStart(current);
|
|
74
|
+
for (let i = 0; unfocusable(next) && i < 366; i++) next = shiftDay(next, 1);
|
|
75
|
+
if (!unfocusable(next) && stamp(next) < stamp(shiftMonth(current, months))) setFocusDate(next);
|
|
76
|
+
}, [current.getTime(), months, disabled, hidden, startMonth, endMonth]);
|
|
77
|
+
const Day = components?.DayButton ?? CalendarDayButton;
|
|
78
|
+
return /* @__PURE__ */ jsx("div", { ...props, ref: merged, "data-slot": "calendar", className: cn("w-fit bg-background p-3 text-sm", classNames.root, className), children: /* @__PURE__ */ jsx("div", { className: cn("flex flex-wrap gap-6", classNames.months), children: Array.from({ length: months }, (_, index) => {
|
|
79
|
+
const shown = shiftMonth(current, index), start = shiftDay(shown, -((shown.getDay() - weekStart + 7) % 7)), range = mode === "range" ? selected : void 0;
|
|
80
|
+
return /* @__PURE__ */ jsxs("section", { className: classNames.month, "aria-label": shown.toLocaleDateString(language, { year: "numeric", month: "long" }), children: [
|
|
81
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-3 flex items-center justify-between gap-2", children: [
|
|
82
|
+
/* @__PURE__ */ jsx(Button, { type: "button", size: "icon", variant: buttonVariant, "aria-label": "上个月", disabled: !!startMonth && stamp(current) <= stamp(monthStart(startMonth)), onClick: () => setMonth(shiftMonth(current, -1)), children: /* @__PURE__ */ jsx(ChevronLeftIcon, { className: "size-4" }) }),
|
|
83
|
+
captionLayout === "label" ? /* @__PURE__ */ jsx("strong", { children: formatters?.formatCaption?.(shown) ?? shown.toLocaleDateString(language, { year: "numeric", month: "long" }) }) : /* @__PURE__ */ jsxs("div", { className: "flex gap-1", children: [
|
|
84
|
+
/* @__PURE__ */ jsx("select", { "aria-label": "年份", value: shown.getFullYear(), onChange: (event) => setMonth(new Date(Number(event.target.value), shown.getMonth() - index, 1)), children: Array.from({ length: Math.max(1, (endMonth?.getFullYear() ?? shown.getFullYear() + 10) - (startMonth?.getFullYear() ?? shown.getFullYear() - 100) + 1) }, (_2, i) => (startMonth?.getFullYear() ?? shown.getFullYear() - 100) + i).map((year) => /* @__PURE__ */ jsx("option", { children: year }, year)) }),
|
|
85
|
+
/* @__PURE__ */ jsx("select", { "aria-label": "月份", value: shown.getMonth(), onChange: (event) => setMonth(new Date(shown.getFullYear(), Number(event.target.value) - index, 1)), children: Array.from({ length: 12 }, (_2, i) => /* @__PURE__ */ jsx("option", { value: i, children: formatters?.formatMonthDropdown?.(new Date(2026, i, 1)) ?? `${i + 1}月` }, i)) })
|
|
86
|
+
] }),
|
|
87
|
+
/* @__PURE__ */ jsx(Button, { type: "button", size: "icon", variant: buttonVariant, "aria-label": "下个月", disabled: !!endMonth && stamp(shiftMonth(current, months - 1)) >= stamp(monthStart(endMonth)), onClick: () => setMonth(shiftMonth(current, 1)), children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "size-4" }) })
|
|
88
|
+
] }),
|
|
89
|
+
/* @__PURE__ */ jsxs("table", { role: "grid", className: "border-collapse", "aria-label": "选择日期", children: [
|
|
90
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: Array.from({ length: 7 }, (_2, i) => /* @__PURE__ */ jsx("th", { className: "size-8 font-normal text-muted-foreground", children: shiftDay(new Date(2026, 0, 4), weekStart + i).toLocaleDateString(language, { weekday: "short" }) }, i)) }) }),
|
|
91
|
+
/* @__PURE__ */ jsx("tbody", { children: Array.from({ length: 6 }, (_2, week) => /* @__PURE__ */ jsx("tr", { children: Array.from({ length: 7 }, (_3, column) => {
|
|
92
|
+
const date = shiftDay(start, week * 7 + column), outside = date.getMonth() !== shown.getMonth(), rangeStart = same(range?.from, date), rangeEnd = same(range?.to, date), middle = !!range?.from && !!range.to && stamp(date) > stamp(range.from) && stamp(date) < stamp(range.to), isSelected = mode === "single" ? same(selected, date) : mode === "multiple" ? selected?.some((item) => same(item, date)) ?? false : rangeStart || rangeEnd || middle;
|
|
93
|
+
const modifiers = { selected: isSelected, range_start: rangeStart, range_end: rangeEnd, range_middle: middle, outside, today: same(/* @__PURE__ */ new Date(), date), focused: same(focusDate, date), disabled: unavailable(date) };
|
|
94
|
+
return /* @__PURE__ */ jsx("td", { className: cn("p-0.5 text-center", middle && "bg-accent", classNames.day), "aria-selected": isSelected, children: outside && !showOutsideDays || matches(date, hidden) ? /* @__PURE__ */ jsx("span", { className: "inline-block size-8" }) : /* @__PURE__ */ jsx(Day, { day: { date, displayMonth: shown }, modifiers, "data-date": stamp(date), tabIndex: !outside && same(focusDate, date) ? 0 : -1, disabled: modifiers.disabled, "aria-label": date.toLocaleDateString(language, { year: "numeric", month: "long", day: "numeric", weekday: "long" }), "aria-pressed": isSelected, className: cn(outside && "text-muted-foreground", outside && classNames.outside, modifiers.disabled && classNames.disabled, isSelected && classNames.selected, middle && classNames.range_middle), onFocus: () => setFocusDate(date), onKeyDown: (event) => navigate(date, event), onClick: () => choose(date), children: date.getDate() }) }, column);
|
|
95
|
+
}) }, week)) })
|
|
96
|
+
] })
|
|
97
|
+
] }, stamp(shown));
|
|
98
|
+
}) }) });
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
Calendar,
|
|
102
|
+
CalendarDayButton
|
|
103
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare function Card({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
3
|
+
declare function CardHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
4
|
+
declare function CardTitle({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
5
|
+
declare function CardDescription({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
6
|
+
declare function CardAction({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
7
|
+
declare function CardContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
8
|
+
declare function CardFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
9
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
function Card({ className, ...props }) {
|
|
4
|
+
return /* @__PURE__ */ jsx(
|
|
5
|
+
"div",
|
|
6
|
+
{
|
|
7
|
+
"data-slot": "card",
|
|
8
|
+
className: cn(
|
|
9
|
+
"bg-card text-card-foreground flex flex-col rounded-xl border border-border py-5 shadow-xs transition-[box-shadow,border-color,transform] duration-200 ease-[var(--ease-standard)] data-[interactive=true]:cursor-pointer data-[interactive=true]:hover:-translate-y-0.5 data-[interactive=true]:hover:border-[color-mix(in_srgb,var(--primary)_35%,var(--border))] data-[interactive=true]:hover:shadow-md",
|
|
10
|
+
className
|
|
11
|
+
),
|
|
12
|
+
...props
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
function CardHeader({ className, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
18
|
+
"div",
|
|
19
|
+
{
|
|
20
|
+
"data-slot": "card-header",
|
|
21
|
+
className: cn(
|
|
22
|
+
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1 px-5 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-4",
|
|
23
|
+
className
|
|
24
|
+
),
|
|
25
|
+
...props
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
function CardTitle({ className, ...props }) {
|
|
30
|
+
return /* @__PURE__ */ jsx(
|
|
31
|
+
"div",
|
|
32
|
+
{
|
|
33
|
+
"data-slot": "card-title",
|
|
34
|
+
className: cn("text-base leading-6 font-semibold", className),
|
|
35
|
+
...props
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
function CardDescription({ className, ...props }) {
|
|
40
|
+
return /* @__PURE__ */ jsx(
|
|
41
|
+
"div",
|
|
42
|
+
{
|
|
43
|
+
"data-slot": "card-description",
|
|
44
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
45
|
+
...props
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
function CardAction({ className, ...props }) {
|
|
50
|
+
return /* @__PURE__ */ jsx(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
"data-slot": "card-action",
|
|
54
|
+
className: cn(
|
|
55
|
+
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
56
|
+
className
|
|
57
|
+
),
|
|
58
|
+
...props
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
function CardContent({ className, ...props }) {
|
|
63
|
+
return /* @__PURE__ */ jsx(
|
|
64
|
+
"div",
|
|
65
|
+
{
|
|
66
|
+
"data-slot": "card-content",
|
|
67
|
+
className: cn("px-5", className),
|
|
68
|
+
...props
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
function CardFooter({ className, ...props }) {
|
|
73
|
+
return /* @__PURE__ */ jsx(
|
|
74
|
+
"div",
|
|
75
|
+
{
|
|
76
|
+
"data-slot": "card-footer",
|
|
77
|
+
className: cn("flex items-center gap-2 px-5 [.border-t]:pt-4", className),
|
|
78
|
+
...props
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
export {
|
|
83
|
+
Card,
|
|
84
|
+
CardAction,
|
|
85
|
+
CardContent,
|
|
86
|
+
CardDescription,
|
|
87
|
+
CardFooter,
|
|
88
|
+
CardHeader,
|
|
89
|
+
CardTitle
|
|
90
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type CarouselApi, type CarouselOptions } from "../../primitives/carousel";
|
|
3
|
+
import { Button } from "./button";
|
|
4
|
+
type CarouselProps = {
|
|
5
|
+
opts?: CarouselOptions;
|
|
6
|
+
orientation?: "horizontal" | "vertical";
|
|
7
|
+
setApi?: (api: CarouselApi) => void;
|
|
8
|
+
};
|
|
9
|
+
declare function Carousel({ orientation, opts, setApi, className, children, ...props }: React.ComponentProps<"div"> & CarouselProps): React.JSX.Element;
|
|
10
|
+
declare function CarouselContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
11
|
+
declare function CarouselItem({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
12
|
+
declare function CarouselPrevious({ className, variant, size, ...props }: React.ComponentProps<typeof Button>): React.JSX.Element;
|
|
13
|
+
declare function CarouselNext({ className, variant, size, ...props }: React.ComponentProps<typeof Button>): React.JSX.Element;
|
|
14
|
+
export { type CarouselApi, Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext, };
|