@gouno/ui 0.3.2
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/CHANGELOG.md +120 -0
- package/LICENSE +21 -0
- package/README.md +144 -0
- package/dist/base.css +239 -0
- package/dist/bootstrap.js +22 -0
- package/dist/components/primitives/alert-dialog.d.ts +18 -0
- package/dist/components/primitives/alert-dialog.js +43 -0
- package/dist/components/primitives/alert.d.ts +9 -0
- package/dist/components/primitives/alert.js +25 -0
- package/dist/components/primitives/avatar.d.ts +14 -0
- package/dist/components/primitives/avatar.js +42 -0
- package/dist/components/primitives/badge.d.ts +9 -0
- package/dist/components/primitives/badge.js +25 -0
- package/dist/components/primitives/button.d.ts +10 -0
- package/dist/components/primitives/button.js +36 -0
- package/dist/components/primitives/checkbox.d.ts +4 -0
- package/dist/components/primitives/checkbox.js +10 -0
- package/dist/components/primitives/dialog.d.ts +20 -0
- package/dist/components/primitives/dialog.js +37 -0
- package/dist/components/primitives/dropdown-menu.d.ts +25 -0
- package/dist/components/primitives/dropdown-menu.js +51 -0
- package/dist/components/primitives/empty.d.ts +11 -0
- package/dist/components/primitives/empty.js +33 -0
- package/dist/components/primitives/field.d.ts +24 -0
- package/dist/components/primitives/field.js +75 -0
- package/dist/components/primitives/input.d.ts +3 -0
- package/dist/components/primitives/input.js +7 -0
- package/dist/components/primitives/label.d.ts +4 -0
- package/dist/components/primitives/label.js +8 -0
- package/dist/components/primitives/popover.d.ts +16 -0
- package/dist/components/primitives/popover.js +31 -0
- package/dist/components/primitives/radio-group.d.ts +5 -0
- package/dist/components/primitives/radio-group.js +13 -0
- package/dist/components/primitives/select.d.ts +15 -0
- package/dist/components/primitives/select.js +38 -0
- package/dist/components/primitives/separator.d.ts +4 -0
- package/dist/components/primitives/separator.js +8 -0
- package/dist/components/primitives/sheet.d.ts +17 -0
- package/dist/components/primitives/sheet.js +41 -0
- package/dist/components/primitives/skeleton.d.ts +2 -0
- package/dist/components/primitives/skeleton.js +6 -0
- package/dist/components/primitives/switch.d.ts +6 -0
- package/dist/components/primitives/switch.js +8 -0
- package/dist/components/primitives/table.d.ts +28 -0
- package/dist/components/primitives/table.js +44 -0
- package/dist/components/primitives/tabs.d.ts +11 -0
- package/dist/components/primitives/tabs.js +30 -0
- package/dist/components/primitives/textarea.d.ts +3 -0
- package/dist/components/primitives/textarea.js +7 -0
- package/dist/components/primitives/tooltip.d.ts +13 -0
- package/dist/components/primitives/tooltip.js +24 -0
- package/dist/core/affix.d.ts +14 -0
- package/dist/core/affix.js +29 -0
- package/dist/core/alert.d.ts +54 -0
- package/dist/core/alert.js +56 -0
- package/dist/core/anchor.d.ts +16 -0
- package/dist/core/anchor.js +31 -0
- package/dist/core/app.d.ts +5 -0
- package/dist/core/app.js +5 -0
- package/dist/core/aspect-ratio.d.ts +6 -0
- package/dist/core/aspect-ratio.js +6 -0
- package/dist/core/autocomplete.d.ts +24 -0
- package/dist/core/autocomplete.js +139 -0
- package/dist/core/avatar.d.ts +26 -0
- package/dist/core/avatar.js +20 -0
- package/dist/core/badge.d.ts +16 -0
- package/dist/core/badge.js +22 -0
- package/dist/core/breadcrumb.d.ts +55 -0
- package/dist/core/breadcrumb.js +69 -0
- package/dist/core/button.d.ts +49 -0
- package/dist/core/button.js +66 -0
- package/dist/core/calendar.d.ts +48 -0
- package/dist/core/calendar.js +179 -0
- package/dist/core/card.d.ts +30 -0
- package/dist/core/card.js +12 -0
- package/dist/core/carousel.d.ts +49 -0
- package/dist/core/carousel.js +166 -0
- package/dist/core/cascader.d.ts +19 -0
- package/dist/core/cascader.js +45 -0
- package/dist/core/code-block.d.ts +16 -0
- package/dist/core/code-block.js +47 -0
- package/dist/core/collapse.d.ts +49 -0
- package/dist/core/collapse.js +96 -0
- package/dist/core/color-picker.d.ts +9 -0
- package/dist/core/color-picker.js +8 -0
- package/dist/core/config-provider.d.ts +10 -0
- package/dist/core/config-provider.js +14 -0
- package/dist/core/control-types.d.ts +2 -0
- package/dist/core/control-types.js +7 -0
- package/dist/core/date-picker.d.ts +13 -0
- package/dist/core/date-picker.js +14 -0
- package/dist/core/date-range-picker.d.ts +26 -0
- package/dist/core/date-range-picker.js +10 -0
- package/dist/core/descriptions.d.ts +41 -0
- package/dist/core/descriptions.js +133 -0
- package/dist/core/drawer.d.ts +9 -0
- package/dist/core/drawer.js +58 -0
- package/dist/core/empty.d.ts +8 -0
- package/dist/core/empty.js +5 -0
- package/dist/core/feedback.d.ts +5 -0
- package/dist/core/feedback.js +5 -0
- package/dist/core/field.d.ts +15 -0
- package/dist/core/field.js +19 -0
- package/dist/core/float-button.d.ts +13 -0
- package/dist/core/float-button.js +22 -0
- package/dist/core/form.d.ts +19 -0
- package/dist/core/form.js +56 -0
- package/dist/core/icon-button.d.ts +7 -0
- package/dist/core/icon-button.js +4 -0
- package/dist/core/icon.d.ts +17 -0
- package/dist/core/icon.js +35 -0
- package/dist/core/image.d.ts +76 -0
- package/dist/core/image.js +189 -0
- package/dist/core/index.d.ts +79 -0
- package/dist/core/index.js +77 -0
- package/dist/core/input-number.d.ts +24 -0
- package/dist/core/input-number.js +70 -0
- package/dist/core/input-otp.d.ts +14 -0
- package/dist/core/input-otp.js +76 -0
- package/dist/core/input.d.ts +14 -0
- package/dist/core/input.js +51 -0
- package/dist/core/kbd.d.ts +8 -0
- package/dist/core/kbd.js +11 -0
- package/dist/core/layout-primitives.d.ts +11 -0
- package/dist/core/layout-primitives.js +8 -0
- package/dist/core/layout.d.ts +71 -0
- package/dist/core/layout.js +119 -0
- package/dist/core/list.d.ts +37 -0
- package/dist/core/list.js +35 -0
- package/dist/core/locale.d.ts +48 -0
- package/dist/core/locale.js +32 -0
- package/dist/core/mentions.d.ts +10 -0
- package/dist/core/mentions.js +112 -0
- package/dist/core/menu.d.ts +79 -0
- package/dist/core/menu.js +265 -0
- package/dist/core/message.d.ts +16 -0
- package/dist/core/message.js +36 -0
- package/dist/core/modal.d.ts +40 -0
- package/dist/core/modal.js +67 -0
- package/dist/core/notification.d.ts +15 -0
- package/dist/core/notification.js +39 -0
- package/dist/core/page-layout.d.ts +6 -0
- package/dist/core/page-layout.js +7 -0
- package/dist/core/pagination.d.ts +28 -0
- package/dist/core/pagination.js +69 -0
- package/dist/core/popconfirm.d.ts +13 -0
- package/dist/core/popconfirm.js +42 -0
- package/dist/core/progress.d.ts +6 -0
- package/dist/core/progress.js +8 -0
- package/dist/core/public-props.d.ts +82 -0
- package/dist/core/public-props.js +1 -0
- package/dist/core/qrcode.d.ts +14 -0
- package/dist/core/qrcode.js +17 -0
- package/dist/core/rate.d.ts +11 -0
- package/dist/core/rate.js +48 -0
- package/dist/core/result.d.ts +12 -0
- package/dist/core/result.js +19 -0
- package/dist/core/segmented.d.ts +29 -0
- package/dist/core/segmented.js +38 -0
- package/dist/core/select.d.ts +27 -0
- package/dist/core/select.js +143 -0
- package/dist/core/selection-controls.d.ts +12 -0
- package/dist/core/selection-controls.js +23 -0
- package/dist/core/separator.d.ts +24 -0
- package/dist/core/separator.js +17 -0
- package/dist/core/slider.d.ts +2 -0
- package/dist/core/slider.js +6 -0
- package/dist/core/spin.d.ts +7 -0
- package/dist/core/spin.js +7 -0
- package/dist/core/spinner.d.ts +3 -0
- package/dist/core/spinner.js +6 -0
- package/dist/core/splitter.d.ts +44 -0
- package/dist/core/splitter.js +208 -0
- package/dist/core/statistic.d.ts +12 -0
- package/dist/core/statistic.js +6 -0
- package/dist/core/steps.d.ts +54 -0
- package/dist/core/steps.js +106 -0
- package/dist/core/tabs.d.ts +40 -0
- package/dist/core/tabs.js +80 -0
- package/dist/core/tag.d.ts +19 -0
- package/dist/core/tag.js +29 -0
- package/dist/core/textarea.d.ts +8 -0
- package/dist/core/textarea.js +14 -0
- package/dist/core/time-picker.d.ts +9 -0
- package/dist/core/time-picker.js +8 -0
- package/dist/core/timeline.d.ts +37 -0
- package/dist/core/timeline.js +48 -0
- package/dist/core/tour.d.ts +18 -0
- package/dist/core/tour.js +51 -0
- package/dist/core/transfer.d.ts +16 -0
- package/dist/core/transfer.js +46 -0
- package/dist/core/tree-select.d.ts +19 -0
- package/dist/core/tree-select.js +19 -0
- package/dist/core/tree.d.ts +89 -0
- package/dist/core/tree.js +386 -0
- package/dist/core/typography.d.ts +20 -0
- package/dist/core/typography.js +12 -0
- package/dist/core/upload.d.ts +20 -0
- package/dist/core/upload.js +72 -0
- package/dist/core/watermark.d.ts +10 -0
- package/dist/core/watermark.js +21 -0
- package/dist/fonts/inter-LICENSE +93 -0
- package/dist/fonts/inter-latin-wght-normal.woff2 +0 -0
- package/dist/fonts/jetbrains-mono-LICENSE +93 -0
- package/dist/fonts/jetbrains-mono-latin-400-normal.woff2 +0 -0
- package/dist/gouno/app-shell.d.ts +22 -0
- package/dist/gouno/app-shell.js +27 -0
- package/dist/gouno/index.d.ts +4 -0
- package/dist/gouno/index.js +4 -0
- package/dist/gouno/page-container.d.ts +4 -0
- package/dist/gouno/page-container.js +6 -0
- package/dist/gouno/page-header.d.ts +8 -0
- package/dist/gouno/page-header.js +6 -0
- package/dist/hooks/use-overlay-body.d.ts +6 -0
- package/dist/hooks/use-overlay-body.js +18 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +5 -0
- package/dist/patterns/bulk-action-bar.d.ts +8 -0
- package/dist/patterns/bulk-action-bar.js +7 -0
- package/dist/patterns/index.d.ts +5 -0
- package/dist/patterns/index.js +5 -0
- package/dist/theme/index.d.ts +2 -0
- package/dist/theme/index.js +2 -0
- package/dist/theme/provider.d.ts +22 -0
- package/dist/theme/provider.js +76 -0
- package/dist/theme/theme-toggle.d.ts +6 -0
- package/dist/theme/theme-toggle.js +10 -0
- package/dist/tokens.css +164 -0
- package/package.json +111 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Select as SelectPrimitive } from "radix-ui";
|
|
3
|
+
declare function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>): React.JSX.Element;
|
|
4
|
+
declare function SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>): React.JSX.Element;
|
|
5
|
+
declare function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>): React.JSX.Element;
|
|
6
|
+
declare function SelectTrigger({ className, size, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
|
|
7
|
+
size?: "sm" | "default";
|
|
8
|
+
}): React.JSX.Element;
|
|
9
|
+
declare function SelectContent({ className, children, position, align, ...props }: React.ComponentProps<typeof SelectPrimitive.Content>): React.JSX.Element;
|
|
10
|
+
declare function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>): React.JSX.Element;
|
|
11
|
+
declare function SelectItem({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>): React.JSX.Element;
|
|
12
|
+
declare function SelectSeparator({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Separator>): React.JSX.Element;
|
|
13
|
+
declare function SelectScrollUpButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>): React.JSX.Element;
|
|
14
|
+
declare function SelectScrollDownButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>): React.JSX.Element;
|
|
15
|
+
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
|
|
5
|
+
import { Select as SelectPrimitive } from "radix-ui";
|
|
6
|
+
function Select({ ...props }) {
|
|
7
|
+
return _jsx(SelectPrimitive.Root, { "data-slot": "select", ...props });
|
|
8
|
+
}
|
|
9
|
+
function SelectGroup({ ...props }) {
|
|
10
|
+
return _jsx(SelectPrimitive.Group, { "data-slot": "select-group", ...props });
|
|
11
|
+
}
|
|
12
|
+
function SelectValue({ ...props }) {
|
|
13
|
+
return _jsx(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
|
|
14
|
+
}
|
|
15
|
+
function SelectTrigger({ className, size = "default", children, ...props }) {
|
|
16
|
+
return (_jsxs(SelectPrimitive.Trigger, { "data-slot": "select-trigger", "data-size": size, className: cn("flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground", className), ...props, children: [children, _jsx(SelectPrimitive.Icon, { asChild: true, children: _jsx(ChevronDownIcon, { className: "size-4 opacity-50" }) })] }));
|
|
17
|
+
}
|
|
18
|
+
function SelectContent({ className, children, position = "item-aligned", align = "center", ...props }) {
|
|
19
|
+
return (_jsx(SelectPrimitive.Portal, { children: _jsxs(SelectPrimitive.Content, { "data-slot": "select-content", className: cn("relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-overlay data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95", position === "popper" &&
|
|
20
|
+
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className), position: position, align: align, ...props, children: [_jsx(SelectScrollUpButton, {}), _jsx(SelectPrimitive.Viewport, { className: cn("p-1", position === "popper" &&
|
|
21
|
+
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"), children: children }), _jsx(SelectScrollDownButton, {})] }) }));
|
|
22
|
+
}
|
|
23
|
+
function SelectLabel({ className, ...props }) {
|
|
24
|
+
return (_jsx(SelectPrimitive.Label, { "data-slot": "select-label", className: cn("px-2 py-1.5 text-xs text-muted-foreground", className), ...props }));
|
|
25
|
+
}
|
|
26
|
+
function SelectItem({ className, children, ...props }) {
|
|
27
|
+
return (_jsxs(SelectPrimitive.Item, { "data-slot": "select-item", className: cn("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className), ...props, children: [_jsx("span", { "data-slot": "select-item-indicator", className: "absolute right-2 flex size-3.5 items-center justify-center", children: _jsx(SelectPrimitive.ItemIndicator, { children: _jsx(CheckIcon, { className: "size-4" }) }) }), _jsx(SelectPrimitive.ItemText, { children: children })] }));
|
|
28
|
+
}
|
|
29
|
+
function SelectSeparator({ className, ...props }) {
|
|
30
|
+
return (_jsx(SelectPrimitive.Separator, { "data-slot": "select-separator", className: cn("pointer-events-none -mx-1 my-1 h-px bg-border", className), ...props }));
|
|
31
|
+
}
|
|
32
|
+
function SelectScrollUpButton({ className, ...props }) {
|
|
33
|
+
return (_jsx(SelectPrimitive.ScrollUpButton, { "data-slot": "select-scroll-up-button", className: cn("flex cursor-default items-center justify-center py-1", className), ...props, children: _jsx(ChevronUpIcon, { className: "size-4" }) }));
|
|
34
|
+
}
|
|
35
|
+
function SelectScrollDownButton({ className, ...props }) {
|
|
36
|
+
return (_jsx(SelectPrimitive.ScrollDownButton, { "data-slot": "select-scroll-down-button", className: cn("flex cursor-default items-center justify-center py-1", className), ...props, children: _jsx(ChevronDownIcon, { className: "size-4" }) }));
|
|
37
|
+
}
|
|
38
|
+
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
import { Separator as SeparatorPrimitive } from "radix-ui";
|
|
5
|
+
function Separator({ className, orientation = "horizontal", decorative = true, ...props }) {
|
|
6
|
+
return (_jsx(SeparatorPrimitive.Root, { "data-slot": "separator", decorative: decorative, orientation: orientation, className: cn("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px", className), ...props }));
|
|
7
|
+
}
|
|
8
|
+
export { Separator };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Dialog as SheetPrimitive } from "radix-ui";
|
|
3
|
+
declare function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>): React.JSX.Element;
|
|
4
|
+
declare function SheetTrigger({ ...props }: React.ComponentProps<typeof SheetPrimitive.Trigger>): React.JSX.Element;
|
|
5
|
+
declare function SheetClose({ ...props }: React.ComponentProps<typeof SheetPrimitive.Close>): React.JSX.Element;
|
|
6
|
+
declare function SheetContent({ className, children, side, showCloseButton, mask, zIndex, maskStyle, ...props }: React.ComponentProps<typeof SheetPrimitive.Content> & {
|
|
7
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
8
|
+
showCloseButton?: boolean;
|
|
9
|
+
mask?: boolean;
|
|
10
|
+
zIndex?: number;
|
|
11
|
+
maskStyle?: React.CSSProperties;
|
|
12
|
+
}): React.JSX.Element;
|
|
13
|
+
declare function SheetHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
14
|
+
declare function SheetFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
15
|
+
declare function SheetTitle({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Title>): React.JSX.Element;
|
|
16
|
+
declare function SheetDescription({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Description>): React.JSX.Element;
|
|
17
|
+
export { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription, };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
import { XIcon } from "lucide-react";
|
|
6
|
+
import { Dialog as SheetPrimitive } from "radix-ui";
|
|
7
|
+
function Sheet({ ...props }) {
|
|
8
|
+
return _jsx(SheetPrimitive.Root, { "data-slot": "sheet", ...props });
|
|
9
|
+
}
|
|
10
|
+
function SheetTrigger({ ...props }) {
|
|
11
|
+
return _jsx(SheetPrimitive.Trigger, { "data-slot": "sheet-trigger", ...props });
|
|
12
|
+
}
|
|
13
|
+
function SheetClose({ ...props }) {
|
|
14
|
+
return _jsx(SheetPrimitive.Close, { "data-slot": "sheet-close", ...props });
|
|
15
|
+
}
|
|
16
|
+
function SheetPortal({ ...props }) {
|
|
17
|
+
return _jsx(SheetPrimitive.Portal, { "data-slot": "sheet-portal", ...props });
|
|
18
|
+
}
|
|
19
|
+
function SheetOverlay({ className, ...props }) {
|
|
20
|
+
return (_jsx(SheetPrimitive.Overlay, { "data-slot": "sheet-overlay", className: cn("fixed inset-0 z-50 bg-overlay data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0", className), ...props }));
|
|
21
|
+
}
|
|
22
|
+
function SheetContent({ className, children, side = "right", showCloseButton = true, mask = true, zIndex, maskStyle, ...props }) {
|
|
23
|
+
return (_jsxs(SheetPortal, { children: [mask && _jsx(SheetOverlay, { style: { zIndex, ...maskStyle } }), _jsxs(SheetPrimitive.Content, { "data-slot": "sheet-content", "data-side": side, className: cn("fixed z-50 flex flex-col gap-4 bg-popover shadow-modal transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-150 data-[state=open]:animate-in data-[state=open]:duration-150", side === "right" &&
|
|
24
|
+
"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm", side === "left" &&
|
|
25
|
+
"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm", side === "top" &&
|
|
26
|
+
"inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top", side === "bottom" &&
|
|
27
|
+
"inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom", className), ...props, children: [children, showCloseButton && (_jsxs(SheetPrimitive.Close, { className: "absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary", children: [_jsx(XIcon, { className: "size-4" }), _jsx("span", { className: "sr-only", children: "Close" })] }))] })] }));
|
|
28
|
+
}
|
|
29
|
+
function SheetHeader({ className, ...props }) {
|
|
30
|
+
return (_jsx("div", { "data-slot": "sheet-header", className: cn("flex flex-col gap-1.5 p-4", className), ...props }));
|
|
31
|
+
}
|
|
32
|
+
function SheetFooter({ className, ...props }) {
|
|
33
|
+
return (_jsx("div", { "data-slot": "sheet-footer", className: cn("mt-auto flex flex-col gap-2 p-4", className), ...props }));
|
|
34
|
+
}
|
|
35
|
+
function SheetTitle({ className, ...props }) {
|
|
36
|
+
return (_jsx(SheetPrimitive.Title, { "data-slot": "sheet-title", className: cn("font-semibold text-foreground", className), ...props }));
|
|
37
|
+
}
|
|
38
|
+
function SheetDescription({ className, ...props }) {
|
|
39
|
+
return (_jsx(SheetPrimitive.Description, { "data-slot": "sheet-description", className: cn("text-sm text-muted-foreground", className), ...props }));
|
|
40
|
+
}
|
|
41
|
+
export { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription, };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
function Skeleton({ className, ...props }) {
|
|
4
|
+
return (_jsx("div", { "data-slot": "skeleton", className: cn("animate-pulse rounded-md bg-accent", className), ...props }));
|
|
5
|
+
}
|
|
6
|
+
export { Skeleton };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Switch as SwitchPrimitive } from "radix-ui";
|
|
3
|
+
declare function Switch({ className, size, ...props }: React.ComponentProps<typeof SwitchPrimitive.Root> & {
|
|
4
|
+
size?: "sm" | "default";
|
|
5
|
+
}): React.JSX.Element;
|
|
6
|
+
export { Switch };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
import { Switch as SwitchPrimitive } from "radix-ui";
|
|
5
|
+
function Switch({ className, size = "default", ...props }) {
|
|
6
|
+
return (_jsx(SwitchPrimitive.Root, { "data-slot": "switch", "data-size": size, className: cn("peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input", className), ...props, children: _jsx(SwitchPrimitive.Thumb, { "data-slot": "switch-thumb", className: cn("pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0") }) }));
|
|
7
|
+
}
|
|
8
|
+
export { Switch };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type TableDensity = "default" | "compact" | "touch";
|
|
3
|
+
export type CaptionSide = "top" | "bottom";
|
|
4
|
+
export interface TableProps extends React.ComponentProps<"table"> {
|
|
5
|
+
density?: TableDensity;
|
|
6
|
+
bordered?: boolean;
|
|
7
|
+
fixed?: boolean;
|
|
8
|
+
stickyHeader?: boolean;
|
|
9
|
+
containerClassName?: string;
|
|
10
|
+
}
|
|
11
|
+
export type TableHeaderProps = React.ComponentProps<"thead">;
|
|
12
|
+
export type TableBodyProps = React.ComponentProps<"tbody">;
|
|
13
|
+
export type TableFooterProps = React.ComponentProps<"tfoot">;
|
|
14
|
+
export type TableRowProps = React.ComponentProps<"tr">;
|
|
15
|
+
export type TableHeadProps = React.ComponentProps<"th">;
|
|
16
|
+
export type TableCellProps = React.ComponentProps<"td">;
|
|
17
|
+
export interface TableCaptionProps extends React.ComponentProps<"caption"> {
|
|
18
|
+
captionSide?: CaptionSide;
|
|
19
|
+
}
|
|
20
|
+
declare function Table({ density, bordered, fixed, stickyHeader, containerClassName, className, ...props }: TableProps): React.JSX.Element;
|
|
21
|
+
declare function TableHeader({ className, ...props }: TableHeaderProps): React.JSX.Element;
|
|
22
|
+
declare function TableBody({ className, ...props }: TableBodyProps): React.JSX.Element;
|
|
23
|
+
declare function TableFooter({ className, ...props }: TableFooterProps): React.JSX.Element;
|
|
24
|
+
declare function TableRow({ className, ...props }: TableRowProps): React.JSX.Element;
|
|
25
|
+
declare function TableHead({ className, ...props }: TableHeadProps): React.JSX.Element;
|
|
26
|
+
declare function TableCell({ className, ...props }: TableCellProps): React.JSX.Element;
|
|
27
|
+
declare function TableCaption({ className, captionSide, ...props }: TableCaptionProps): React.JSX.Element;
|
|
28
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
function Table({ density = "default", bordered = false, fixed = false, stickyHeader = false, containerClassName, className, ...props }) {
|
|
6
|
+
return (_jsx("div", { "data-slot": "table-container", "data-density": density, "data-bordered": bordered || undefined, "data-sticky-header": stickyHeader || undefined, className: cn("relative w-full overflow-x-auto rounded-lg", bordered ? "border border-border/80 bg-card shadow-surface" : "bg-card/40", containerClassName), children: _jsx("table", { "data-slot": "table", className: cn("w-full caption-bottom text-sm text-foreground", density === "compact"
|
|
7
|
+
? "[&_th]:px-3 [&_th]:py-2 [&_td]:px-3 [&_td]:py-2"
|
|
8
|
+
: density === "touch"
|
|
9
|
+
? "[&_th]:px-4 [&_th]:py-4 [&_td]:px-4 [&_td]:py-4"
|
|
10
|
+
: "[&_th]:px-4 [&_th]:py-3 [&_td]:px-4 [&_td]:py-3", bordered &&
|
|
11
|
+
(density === "compact"
|
|
12
|
+
? "[&_tr>*:first-child]:pl-4 [&_tr>*:last-child]:pr-4"
|
|
13
|
+
: "[&_tr>*:first-child]:pl-6 [&_tr>*:last-child]:pr-6"), "[&_tfoot_th]:align-middle [&_tfoot_td]:align-middle", density === "compact"
|
|
14
|
+
? "[&_tfoot_th]:h-10 [&_tfoot_td]:h-10"
|
|
15
|
+
: density === "touch"
|
|
16
|
+
? "[&_tfoot_th]:h-14 [&_tfoot_td]:h-14"
|
|
17
|
+
: "[&_tfoot_th]:h-12 [&_tfoot_td]:h-12", "[&_tfoot_tr]:border-t-2 [&_tfoot_tr]:border-border/80", fixed && "table-fixed", bordered &&
|
|
18
|
+
"[&_td]:border-r [&_th]:border-r [&_tr>*:last-child]:border-r-0", stickyHeader &&
|
|
19
|
+
"[&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10 [&_thead]:bg-background", "[&_thead_th]:bg-muted/60", className), ...props }) }));
|
|
20
|
+
}
|
|
21
|
+
function TableHeader({ className, ...props }) {
|
|
22
|
+
return (_jsx("thead", { "data-slot": "table-header", className: cn("[&_tr]:border-b [&_tr]:border-border/70", className), ...props }));
|
|
23
|
+
}
|
|
24
|
+
function TableBody({ className, ...props }) {
|
|
25
|
+
return (_jsx("tbody", { "data-slot": "table-body", className: cn("[&_tr:last-child]:border-0", className), ...props }));
|
|
26
|
+
}
|
|
27
|
+
function TableFooter({ className, ...props }) {
|
|
28
|
+
return (_jsx("tfoot", { "data-slot": "table-footer", className: cn("bg-muted/50 font-medium [&>tr]:last:border-b-0", className), ...props }));
|
|
29
|
+
}
|
|
30
|
+
function TableRow({ className, ...props }) {
|
|
31
|
+
return (_jsx("tr", { "data-slot": "table-row", className: cn("border-b border-border/60 transition-colors hover:bg-accent/60 has-aria-expanded:bg-accent/40 data-[state=selected]:bg-primary/10", className), ...props }));
|
|
32
|
+
}
|
|
33
|
+
function TableHead({ className, ...props }) {
|
|
34
|
+
return (_jsx("th", { "data-slot": "table-head", className: cn("text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className), ...props }));
|
|
35
|
+
}
|
|
36
|
+
function TableCell({ className, ...props }) {
|
|
37
|
+
return (_jsx("td", { "data-slot": "table-cell", className: cn("align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className), ...props }));
|
|
38
|
+
}
|
|
39
|
+
function TableCaption({ className, captionSide = "top", ...props }) {
|
|
40
|
+
return (_jsx("caption", { "data-slot": "table-caption", "data-caption-side": captionSide, className: cn("px-4 py-3 text-center text-sm leading-6 text-muted-foreground", captionSide === "bottom" &&
|
|
41
|
+
"caption-side-bottom border-t border-border/60", captionSide === "top" &&
|
|
42
|
+
"caption-side-top border-b border-border/60", className), ...props }));
|
|
43
|
+
}
|
|
44
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { Tabs as TabsPrimitive } from "radix-ui";
|
|
4
|
+
declare function Tabs({ className, orientation, ...props }: React.ComponentProps<typeof TabsPrimitive.Root>): React.JSX.Element;
|
|
5
|
+
declare const tabsListVariants: (props?: ({
|
|
6
|
+
variant?: "default" | "line" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
declare function TabsList({ className, variant, ...props }: React.ComponentProps<typeof TabsPrimitive.List> & VariantProps<typeof tabsListVariants>): React.JSX.Element;
|
|
9
|
+
declare function TabsTrigger({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Trigger>): React.JSX.Element;
|
|
10
|
+
declare function TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Content>): React.JSX.Element;
|
|
11
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
import { Tabs as TabsPrimitive } from "radix-ui";
|
|
7
|
+
function Tabs({ className, orientation = "horizontal", ...props }) {
|
|
8
|
+
return (_jsx(TabsPrimitive.Root, { "data-slot": "tabs", "data-orientation": orientation, orientation: orientation, className: cn("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col", className), ...props }));
|
|
9
|
+
}
|
|
10
|
+
const tabsListVariants = cva("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:min-h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none", {
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
default: "bg-muted",
|
|
14
|
+
line: "gap-1 bg-transparent",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
variant: "default",
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
function TabsList({ className, variant = "default", ...props }) {
|
|
22
|
+
return (_jsx(TabsPrimitive.List, { "data-slot": "tabs-list", "data-variant": variant, className: cn(tabsListVariants({ variant }), className), ...props }));
|
|
23
|
+
}
|
|
24
|
+
function TabsTrigger({ className, ...props }) {
|
|
25
|
+
return (_jsx(TabsPrimitive.Trigger, { "data-slot": "tabs-trigger", className: cn("relative 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 text-foreground/60 transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent", "data-[state=active]:bg-background data-[state=active]:text-foreground", "after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-0 group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:right-0 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100", className), ...props }));
|
|
26
|
+
}
|
|
27
|
+
function TabsContent({ className, ...props }) {
|
|
28
|
+
return (_jsx(TabsPrimitive.Content, { "data-slot": "tabs-content", className: cn("min-w-0 flex-1 outline-none", className), ...props }));
|
|
29
|
+
}
|
|
30
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
function Textarea({ className, ...props }) {
|
|
5
|
+
return (_jsx("textarea", { "data-slot": "textarea", className: cn("flex field-sizing-content min-h-16 w-full rounded-md border border-border bg-transparent px-3 py-2 text-base transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm", className), ...props }));
|
|
6
|
+
}
|
|
7
|
+
export { Textarea };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
3
|
+
import { type OverlayPlacement } from "./popover.js";
|
|
4
|
+
declare function TooltipProvider({ delayDuration, ...props }: React.ComponentProps<typeof TooltipPrimitive.Provider>): React.JSX.Element;
|
|
5
|
+
declare function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>): React.JSX.Element;
|
|
6
|
+
declare function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>): React.JSX.Element;
|
|
7
|
+
export interface TooltipContentProps extends Omit<React.ComponentProps<typeof TooltipPrimitive.Content>, "side" | "align" | "sideOffset" | "alignOffset"> {
|
|
8
|
+
placement?: OverlayPlacement;
|
|
9
|
+
offset?: number;
|
|
10
|
+
alignOffset?: number;
|
|
11
|
+
}
|
|
12
|
+
declare function TooltipContent({ className, placement, offset, alignOffset, children, ...props }: TooltipContentProps): React.JSX.Element;
|
|
13
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
6
|
+
import {} from "./popover.js";
|
|
7
|
+
const placementParts = (placement) => {
|
|
8
|
+
const [side, edge] = placement.split("-");
|
|
9
|
+
return { side, align: edge ?? "center" };
|
|
10
|
+
};
|
|
11
|
+
function TooltipProvider({ delayDuration = 0, ...props }) {
|
|
12
|
+
return (_jsx(TooltipPrimitive.Provider, { "data-slot": "tooltip-provider", delayDuration: delayDuration, ...props }));
|
|
13
|
+
}
|
|
14
|
+
function Tooltip({ ...props }) {
|
|
15
|
+
return _jsx(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props });
|
|
16
|
+
}
|
|
17
|
+
function TooltipTrigger({ ...props }) {
|
|
18
|
+
return _jsx(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
19
|
+
}
|
|
20
|
+
function TooltipContent({ className, placement = "top", offset = 0, alignOffset, children, ...props }) {
|
|
21
|
+
const { side, align } = placementParts(placement);
|
|
22
|
+
return (_jsx(TooltipPrimitive.Portal, { children: _jsxs(TooltipPrimitive.Content, { "data-slot": "tooltip-content", side: side, align: align, sideOffset: offset, alignOffset: alignOffset, className: cn("z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95", className), ...props, children: [children, _jsx(TooltipPrimitive.Arrow, { className: "z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" })] }) }));
|
|
23
|
+
}
|
|
24
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ButtonHTMLAttributes, type HTMLAttributes, type ReactNode, type Ref } from "react";
|
|
2
|
+
export interface AffixProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
3
|
+
offsetTop?: number;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
ref?: Ref<HTMLDivElement>;
|
|
6
|
+
}
|
|
7
|
+
export interface BackTopProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children" | "aria-label"> {
|
|
8
|
+
"aria-label": string;
|
|
9
|
+
visibilityHeight?: number;
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
ref?: Ref<HTMLButtonElement>;
|
|
12
|
+
}
|
|
13
|
+
export declare function Affix({ offsetTop, children, ref, className, style, ...props }: AffixProps): import("react").JSX.Element;
|
|
14
|
+
export declare function BackTop({ visibilityHeight, children, ref, className, onClick, type, ...props }: BackTopProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState, } from "react";
|
|
3
|
+
import { ArrowUp } from "lucide-react";
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
5
|
+
function finiteOr(value, fallback) {
|
|
6
|
+
return Number.isFinite(value) ? value : fallback;
|
|
7
|
+
}
|
|
8
|
+
export function Affix({ offsetTop = 0, children, ref, className, style, ...props }) {
|
|
9
|
+
const top = finiteOr(offsetTop, 0);
|
|
10
|
+
return (_jsx("div", { ...props, ref: ref, "data-slot": "affix", className: cn("z-20", className), style: { zIndex: 20, ...style, position: "sticky", top }, children: children }));
|
|
11
|
+
}
|
|
12
|
+
export function BackTop({ visibilityHeight = 200, children, ref, className, onClick, type = "button", ...props }) {
|
|
13
|
+
const threshold = Math.max(0, finiteOr(visibilityHeight, 200));
|
|
14
|
+
const [visible, setVisible] = useState(false);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const updateVisibility = () => setVisible(window.scrollY >= threshold);
|
|
17
|
+
updateVisibility();
|
|
18
|
+
window.addEventListener("scroll", updateVisibility, { passive: true });
|
|
19
|
+
return () => window.removeEventListener("scroll", updateVisibility);
|
|
20
|
+
}, [threshold]);
|
|
21
|
+
if (!visible)
|
|
22
|
+
return null;
|
|
23
|
+
return (_jsx("button", { ...props, ref: ref, type: type, "data-slot": "back-top", "data-visibility-height": threshold, className: cn("fixed right-6 bottom-6 z-40 inline-flex size-10 items-center justify-center rounded-full border bg-popover text-foreground shadow-overlay transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50", className), onClick: (event) => {
|
|
24
|
+
onClick?.(event);
|
|
25
|
+
if (event.defaultPrevented)
|
|
26
|
+
return;
|
|
27
|
+
window.scrollTo({ top: 0, behavior: "smooth" });
|
|
28
|
+
}, children: children ?? _jsx(ArrowUp, { "aria-hidden": "true" }) }));
|
|
29
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Component, type AriaAttributes, type CSSProperties, type HTMLAttributes, type MouseEvent, type ReactNode } from "react";
|
|
2
|
+
export type AlertType = "success" | "info" | "warning" | "error";
|
|
3
|
+
export type AlertVariant = "outlined" | "filled";
|
|
4
|
+
export type AlertSemantic = "root" | "icon" | "section" | "title" | "description" | "actions" | "close";
|
|
5
|
+
export interface AlertClosableConfig extends AriaAttributes {
|
|
6
|
+
afterClose?: () => void;
|
|
7
|
+
closeIcon?: ReactNode;
|
|
8
|
+
onClose?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
9
|
+
}
|
|
10
|
+
export interface AlertSemanticInfo {
|
|
11
|
+
props: Readonly<{
|
|
12
|
+
type: AlertType;
|
|
13
|
+
variant: AlertVariant;
|
|
14
|
+
banner: boolean;
|
|
15
|
+
showIcon: boolean;
|
|
16
|
+
closable: boolean;
|
|
17
|
+
hasDescription: boolean;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
export type AlertClassNames = Partial<Record<AlertSemantic, string>> | ((info: AlertSemanticInfo) => Partial<Record<AlertSemantic, string>>);
|
|
21
|
+
export type AlertStyles = Partial<Record<AlertSemantic, CSSProperties>> | ((info: AlertSemanticInfo) => Partial<Record<AlertSemantic, CSSProperties>>);
|
|
22
|
+
export interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, "title"> {
|
|
23
|
+
title?: ReactNode;
|
|
24
|
+
description?: ReactNode;
|
|
25
|
+
type?: AlertType;
|
|
26
|
+
showIcon?: boolean;
|
|
27
|
+
icon?: ReactNode;
|
|
28
|
+
action?: ReactNode;
|
|
29
|
+
closable?: boolean | AlertClosableConfig;
|
|
30
|
+
banner?: boolean;
|
|
31
|
+
variant?: AlertVariant;
|
|
32
|
+
classNames?: AlertClassNames;
|
|
33
|
+
styles?: AlertStyles;
|
|
34
|
+
}
|
|
35
|
+
export interface AlertErrorBoundaryProps {
|
|
36
|
+
children?: ReactNode;
|
|
37
|
+
title?: ReactNode;
|
|
38
|
+
description?: ReactNode;
|
|
39
|
+
}
|
|
40
|
+
declare class AlertErrorBoundary extends Component<AlertErrorBoundaryProps, {
|
|
41
|
+
error: Error | null;
|
|
42
|
+
}> {
|
|
43
|
+
state: {
|
|
44
|
+
error: Error | null;
|
|
45
|
+
};
|
|
46
|
+
static getDerivedStateFromError(error: Error): {
|
|
47
|
+
error: Error;
|
|
48
|
+
};
|
|
49
|
+
render(): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
|
|
50
|
+
}
|
|
51
|
+
export declare const Alert: import("react").ForwardRefExoticComponent<AlertProps & import("react").RefAttributes<HTMLDivElement>> & {
|
|
52
|
+
ErrorBoundary: typeof AlertErrorBoundary;
|
|
53
|
+
};
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Component, forwardRef, useEffect, useMemo, useRef, useState, } from "react";
|
|
3
|
+
import { CircleCheck, CircleX, Info, TriangleAlert, X } from "lucide-react";
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
5
|
+
const tones = {
|
|
6
|
+
success: { border: "border-success/35", filled: "bg-success-subtle", outlined: "bg-success-subtle/35", icon: "text-success" },
|
|
7
|
+
info: { border: "border-info/35", filled: "bg-info-subtle", outlined: "bg-info-subtle/35", icon: "text-info" },
|
|
8
|
+
warning: { border: "border-warning/35", filled: "bg-warning-subtle", outlined: "bg-warning-subtle/35", icon: "text-warning" },
|
|
9
|
+
error: { border: "border-destructive/35", filled: "bg-danger-subtle", outlined: "bg-danger-subtle/35", icon: "text-destructive" },
|
|
10
|
+
};
|
|
11
|
+
const defaultIcons = {
|
|
12
|
+
success: _jsx(CircleCheck, { "aria-hidden": "true" }),
|
|
13
|
+
info: _jsx(Info, { "aria-hidden": "true" }),
|
|
14
|
+
warning: _jsx(TriangleAlert, { "aria-hidden": "true" }),
|
|
15
|
+
error: _jsx(CircleX, { "aria-hidden": "true" }),
|
|
16
|
+
};
|
|
17
|
+
const closeDurationMs = 160;
|
|
18
|
+
const AlertBase = forwardRef(function Alert({ title, description, children, type, showIcon, icon, action, closable = false, banner = false, variant = "outlined", classNames, styles, className, style, role, ...props }, ref) {
|
|
19
|
+
const resolvedType = type ?? (banner ? "warning" : "info");
|
|
20
|
+
const resolvedShowIcon = showIcon ?? banner;
|
|
21
|
+
const hasDescription = description !== undefined && description !== null;
|
|
22
|
+
const hasContent = children !== undefined && children !== null;
|
|
23
|
+
const closableConfig = typeof closable === "object" ? closable : undefined;
|
|
24
|
+
const isClosable = Boolean(closable);
|
|
25
|
+
const [visible, setVisible] = useState(true);
|
|
26
|
+
const [closing, setClosing] = useState(false);
|
|
27
|
+
const timerRef = useRef(null);
|
|
28
|
+
const semanticInfo = useMemo(() => ({ props: { type: resolvedType, variant, banner, showIcon: resolvedShowIcon, closable: isClosable, hasDescription } }), [banner, hasDescription, isClosable, resolvedShowIcon, resolvedType, variant]);
|
|
29
|
+
const semanticClassNames = typeof classNames === "function" ? classNames(semanticInfo) : (classNames ?? {});
|
|
30
|
+
const semanticStyles = typeof styles === "function" ? styles(semanticInfo) : (styles ?? {});
|
|
31
|
+
useEffect(() => () => { if (timerRef.current)
|
|
32
|
+
clearTimeout(timerRef.current); }, []);
|
|
33
|
+
if (!visible)
|
|
34
|
+
return null;
|
|
35
|
+
const tone = tones[resolvedType];
|
|
36
|
+
const closeAria = closableConfig ? Object.fromEntries(Object.entries(closableConfig).filter(([key]) => key.startsWith("aria-"))) : {};
|
|
37
|
+
const rich = hasDescription || (title !== undefined && title !== null && hasContent);
|
|
38
|
+
return (_jsxs("div", { ...props, ref: ref, role: role ?? "alert", "data-slot": "alert", "data-type": resolvedType, "data-variant": variant, "data-banner": banner || undefined, className: cn("relative flex w-full min-w-0 gap-3 border text-sm text-foreground transition-[opacity,transform] duration-150", rich ? "items-start px-5 py-4 sm:px-6" : "items-center px-3 py-2.5", banner ? "rounded-none border-x-0" : "rounded-lg", variant === "filled" ? cn("border-transparent", tone.filled) : cn(tone.border, tone.outlined), closing && "pointer-events-none scale-[0.99] opacity-0", semanticClassNames.root, className), style: { ...semanticStyles.root, ...style }, children: [resolvedShowIcon ? _jsx("span", { "data-slot": "alert-icon", className: cn("flex shrink-0 items-center justify-center [&_svg]:shrink-0", rich ? "mt-0.5 [&_svg]:size-6" : "[&_svg]:size-4", tone.icon, semanticClassNames.icon), style: semanticStyles.icon, children: icon ?? defaultIcons[resolvedType] }) : null, _jsxs("div", { "data-slot": "alert-section", className: cn("min-w-0 flex-1", semanticClassNames.section), style: semanticStyles.section, children: [title !== undefined && title !== null ? _jsx("div", { "data-slot": "alert-title", className: cn("font-medium leading-5 text-foreground", rich && "text-base leading-6", semanticClassNames.title), style: semanticStyles.title, children: title }) : null, hasDescription ? _jsx("div", { "data-slot": "alert-description", className: cn("text-sm leading-relaxed text-muted-foreground", title !== undefined && title !== null && "mt-1", semanticClassNames.description), style: semanticStyles.description, children: description }) : null, hasContent ? _jsx("div", { className: cn("text-sm leading-relaxed", (title !== undefined && title !== null) || hasDescription ? "mt-2" : undefined), children: children }) : null] }), action ? _jsx("div", { "data-slot": "alert-actions", className: cn("flex shrink-0 items-center gap-2", rich && "pt-0.5", semanticClassNames.actions), style: semanticStyles.actions, children: action }) : null, isClosable ? (_jsx("button", { type: "button", ...closeAria, "data-slot": "alert-close", "aria-label": closeAria["aria-label"] ?? "Close alert", className: cn("-mr-1 inline-flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-black/5 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring dark:hover:bg-white/10", rich && "-mt-0.5", semanticClassNames.close), style: semanticStyles.close, onClick: (event) => {
|
|
39
|
+
closableConfig?.onClose?.(event);
|
|
40
|
+
if (timerRef.current)
|
|
41
|
+
clearTimeout(timerRef.current);
|
|
42
|
+
setClosing(true);
|
|
43
|
+
timerRef.current = setTimeout(() => { setVisible(false); closableConfig?.afterClose?.(); }, closeDurationMs);
|
|
44
|
+
}, children: closableConfig?.closeIcon ?? _jsx(X, { "aria-hidden": "true", className: "size-4" }) })) : null] }));
|
|
45
|
+
});
|
|
46
|
+
AlertBase.displayName = "Alert";
|
|
47
|
+
class AlertErrorBoundary extends Component {
|
|
48
|
+
state = { error: null };
|
|
49
|
+
static getDerivedStateFromError(error) { return { error }; }
|
|
50
|
+
render() {
|
|
51
|
+
if (!this.state.error)
|
|
52
|
+
return this.props.children;
|
|
53
|
+
return _jsx(AlertBase, { type: "error", showIcon: true, title: this.props.title ?? "Something went wrong", description: this.props.description ?? this.state.error.message });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export const Alert = Object.assign(AlertBase, { ErrorBoundary: AlertErrorBoundary });
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
export interface AnchorItem {
|
|
3
|
+
key: string;
|
|
4
|
+
title: ReactNode;
|
|
5
|
+
href?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface AnchorProps extends HTMLAttributes<HTMLElement> {
|
|
8
|
+
items: readonly AnchorItem[];
|
|
9
|
+
/**
|
|
10
|
+
* Top offset in pixels for local hash targets. Leave at 0 to preserve native
|
|
11
|
+
* anchor scrolling; document headings can instead own sticky-header spacing
|
|
12
|
+
* through CSS `scroll-margin-top`.
|
|
13
|
+
*/
|
|
14
|
+
offset?: number;
|
|
15
|
+
}
|
|
16
|
+
export declare function Anchor({ items, offset, className, "aria-label": ariaLabel, ...props }: AnchorProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
|
+
function localHashTarget(href) {
|
|
4
|
+
if (!href.startsWith("#") || href.length === 1)
|
|
5
|
+
return null;
|
|
6
|
+
try {
|
|
7
|
+
return document.getElementById(decodeURIComponent(href.slice(1)));
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export function Anchor({ items, offset = 0, className, "aria-label": ariaLabel = "On this page", ...props }) {
|
|
14
|
+
const handleLinkClick = (event, href) => {
|
|
15
|
+
if (!offset || event.defaultPrevented)
|
|
16
|
+
return;
|
|
17
|
+
const target = localHashTarget(href);
|
|
18
|
+
if (!target)
|
|
19
|
+
return;
|
|
20
|
+
event.preventDefault();
|
|
21
|
+
const top = window.scrollY + target.getBoundingClientRect().top - offset;
|
|
22
|
+
window.scrollTo({ top: Math.max(0, top), behavior: "smooth" });
|
|
23
|
+
if (window.location.hash !== href) {
|
|
24
|
+
window.history.pushState(null, "", href);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
return (_jsx("nav", { ...props, "aria-label": ariaLabel, "data-slot": "anchor", className: cn("space-y-1", className), children: items.map((item) => {
|
|
28
|
+
const href = item.href || `#${item.key}`;
|
|
29
|
+
return (_jsx("a", { href: href, onClick: (event) => handleLinkClick(event, href), className: "block rounded px-2 py-1 text-sm text-muted-foreground hover:bg-accent hover:text-foreground", children: item.title }, item.key));
|
|
30
|
+
}) }));
|
|
31
|
+
}
|
package/dist/core/app.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { HTMLAttributes, Ref } from "react";
|
|
2
|
+
export interface AspectRatioProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
ratio?: number;
|
|
4
|
+
ref?: Ref<HTMLDivElement>;
|
|
5
|
+
}
|
|
6
|
+
export declare function AspectRatio({ ratio, className, children, style, ref, ...props }: AspectRatioProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
|
+
export function AspectRatio({ ratio = 16 / 9, className, children, style, ref, ...props }) {
|
|
4
|
+
const resolvedRatio = Number.isFinite(ratio) && ratio > 0 ? ratio : 16 / 9;
|
|
5
|
+
return (_jsx("div", { ...props, ref: ref, "data-slot": "aspect-ratio", className: cn("relative w-full", className), style: { ...style, aspectRatio: resolvedRatio }, children: children }));
|
|
6
|
+
}
|