xiod-ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +73 -0
- package/README.md +167 -0
- package/dist/components/accordion.d.ts +9 -0
- package/dist/components/accordion.js +46 -0
- package/dist/components/agent-steps.d.ts +47 -0
- package/dist/components/agent-steps.js +223 -0
- package/dist/components/alert-dialog.d.ts +21 -0
- package/dist/components/alert-dialog.js +74 -0
- package/dist/components/alert.d.ts +12 -0
- package/dist/components/alert.js +45 -0
- package/dist/components/aspect-ratio.d.ts +9 -0
- package/dist/components/aspect-ratio.js +22 -0
- package/dist/components/autocomplete.d.ts +35 -0
- package/dist/components/autocomplete.js +160 -0
- package/dist/components/avatar.d.ts +17 -0
- package/dist/components/avatar.js +65 -0
- package/dist/components/badge.d.ts +15 -0
- package/dist/components/badge.js +46 -0
- package/dist/components/breadcrumb.d.ts +12 -0
- package/dist/components/breadcrumb.js +75 -0
- package/dist/components/button-group.d.ts +14 -0
- package/dist/components/button-group.js +45 -0
- package/dist/components/button-split.d.ts +19 -0
- package/dist/components/button-split.js +73 -0
- package/dist/components/button.d.ts +15 -0
- package/dist/components/button.js +54 -0
- package/dist/components/calendar.d.ts +63 -0
- package/dist/components/calendar.js +425 -0
- package/dist/components/card.d.ts +17 -0
- package/dist/components/card.js +139 -0
- package/dist/components/carousel.d.ts +59 -0
- package/dist/components/carousel.js +503 -0
- package/dist/components/checkbox.d.ts +16 -0
- package/dist/components/checkbox.js +86 -0
- package/dist/components/circular-progress.d.ts +28 -0
- package/dist/components/circular-progress.js +127 -0
- package/dist/components/collapsible.d.ts +8 -0
- package/dist/components/collapsible.js +27 -0
- package/dist/components/color-picker.d.ts +159 -0
- package/dist/components/color-picker.js +1589 -0
- package/dist/components/combobox.d.ts +46 -0
- package/dist/components/combobox.js +237 -0
- package/dist/components/command.d.ts +22 -0
- package/dist/components/command.js +129 -0
- package/dist/components/context-menu.d.ts +38 -0
- package/dist/components/context-menu.js +164 -0
- package/dist/components/copy-to-clipboard.d.ts +32 -0
- package/dist/components/copy-to-clipboard.js +83 -0
- package/dist/components/corner-badge.d.ts +22 -0
- package/dist/components/corner-badge.js +84 -0
- package/dist/components/dashboard-grid.d.ts +83 -0
- package/dist/components/dashboard-grid.js +486 -0
- package/dist/components/date-picker.d.ts +29 -0
- package/dist/components/date-picker.js +261 -0
- package/dist/components/dialog.d.ts +26 -0
- package/dist/components/dialog.js +97 -0
- package/dist/components/dot-matrix.d.ts +32 -0
- package/dist/components/dot-matrix.js +707 -0
- package/dist/components/draggable.d.ts +42 -0
- package/dist/components/draggable.js +346 -0
- package/dist/components/drawer.d.ts +66 -0
- package/dist/components/drawer.js +304 -0
- package/dist/components/empty.d.ts +14 -0
- package/dist/components/empty.js +75 -0
- package/dist/components/field.d.ts +12 -0
- package/dist/components/field.js +44 -0
- package/dist/components/fieldset.d.ts +7 -0
- package/dist/components/fieldset.js +21 -0
- package/dist/components/file-upload.d.ts +61 -0
- package/dist/components/file-upload.js +482 -0
- package/dist/components/form.d.ts +6 -0
- package/dist/components/form.js +14 -0
- package/dist/components/frame.d.ts +10 -0
- package/dist/components/frame.js +47 -0
- package/dist/components/gauge.d.ts +27 -0
- package/dist/components/gauge.js +74 -0
- package/dist/components/grid.d.ts +26 -0
- package/dist/components/grid.js +204 -0
- package/dist/components/group.d.ts +19 -0
- package/dist/components/group.js +45 -0
- package/dist/components/input-group.d.ts +15 -0
- package/dist/components/input-group.js +61 -0
- package/dist/components/input-otp.d.ts +24 -0
- package/dist/components/input-otp.js +50 -0
- package/dist/components/input-payment.d.ts +131 -0
- package/dist/components/input-payment.js +1140 -0
- package/dist/components/input-phone.d.ts +70 -0
- package/dist/components/input-phone.js +657 -0
- package/dist/components/input-sensitive.d.ts +12 -0
- package/dist/components/input-sensitive.js +169 -0
- package/dist/components/input.d.ts +13 -0
- package/dist/components/input.js +26 -0
- package/dist/components/kbd.d.ts +6 -0
- package/dist/components/kbd.js +19 -0
- package/dist/components/kinetic-click.d.ts +48 -0
- package/dist/components/kinetic-click.js +1184 -0
- package/dist/components/label.d.ts +6 -0
- package/dist/components/label.js +18 -0
- package/dist/components/list-box.d.ts +20 -0
- package/dist/components/list-box.js +148 -0
- package/dist/components/loader.d.ts +13 -0
- package/dist/components/loader.js +430 -0
- package/dist/components/marker.d.ts +15 -0
- package/dist/components/marker.js +59 -0
- package/dist/components/menu.d.ts +42 -0
- package/dist/components/menu.js +186 -0
- package/dist/components/menubar.d.ts +40 -0
- package/dist/components/menubar.js +107 -0
- package/dist/components/message.d.ts +33 -0
- package/dist/components/message.js +112 -0
- package/dist/components/meter.d.ts +10 -0
- package/dist/components/meter.js +42 -0
- package/dist/components/morphic-toast.d.ts +61 -0
- package/dist/components/morphic-toast.js +916 -0
- package/dist/components/navigation-menu.d.ts +26 -0
- package/dist/components/navigation-menu.js +116 -0
- package/dist/components/number-field.d.ts +15 -0
- package/dist/components/number-field.js +86 -0
- package/dist/components/option-picker.d.ts +18 -0
- package/dist/components/option-picker.js +89 -0
- package/dist/components/orb.d.ts +38 -0
- package/dist/components/orb.js +1413 -0
- package/dist/components/pagination.d.ts +25 -0
- package/dist/components/pagination.js +147 -0
- package/dist/components/popover.d.ts +22 -0
- package/dist/components/popover.js +79 -0
- package/dist/components/preview-card.d.ts +16 -0
- package/dist/components/preview-card.js +60 -0
- package/dist/components/progress.d.ts +21 -0
- package/dist/components/progress.js +139 -0
- package/dist/components/radio.d.ts +16 -0
- package/dist/components/radio.js +68 -0
- package/dist/components/resizable.d.ts +58 -0
- package/dist/components/resizable.js +964 -0
- package/dist/components/ruler-picker.d.ts +27 -0
- package/dist/components/ruler-picker.js +253 -0
- package/dist/components/scroll-area.d.ts +13 -0
- package/dist/components/scroll-area.js +34 -0
- package/dist/components/scroll-bar.d.ts +13 -0
- package/dist/components/scroll-bar.js +47 -0
- package/dist/components/select.d.ts +29 -0
- package/dist/components/select.js +140 -0
- package/dist/components/separator.d.ts +6 -0
- package/dist/components/separator.js +15 -0
- package/dist/components/sidebar.d.ts +65 -0
- package/dist/components/sidebar.js +408 -0
- package/dist/components/skeleton.d.ts +5 -0
- package/dist/components/skeleton.js +12 -0
- package/dist/components/slider.d.ts +12 -0
- package/dist/components/slider.js +96 -0
- package/dist/components/sortable.d.ts +44 -0
- package/dist/components/sortable.js +327 -0
- package/dist/components/switch.d.ts +15 -0
- package/dist/components/switch.js +63 -0
- package/dist/components/table.d.ts +12 -0
- package/dist/components/table.js +65 -0
- package/dist/components/tabs.d.ts +12 -0
- package/dist/components/tabs.js +39 -0
- package/dist/components/text.d.ts +14 -0
- package/dist/components/text.js +69 -0
- package/dist/components/textarea.d.ts +9 -0
- package/dist/components/textarea.js +20 -0
- package/dist/components/theme-provider.d.ts +52 -0
- package/dist/components/theme-provider.js +148 -0
- package/dist/components/timeline.d.ts +34 -0
- package/dist/components/timeline.js +147 -0
- package/dist/components/toast.d.ts +17 -0
- package/dist/components/toast.js +161 -0
- package/dist/components/toggle-group.d.ts +14 -0
- package/dist/components/toggle-group.js +53 -0
- package/dist/components/toggle.d.ts +11 -0
- package/dist/components/toggle.js +36 -0
- package/dist/components/toolbar.d.ts +11 -0
- package/dist/components/toolbar.js +49 -0
- package/dist/components/tooltip.d.ts +17 -0
- package/dist/components/tooltip.js +56 -0
- package/dist/components/waveform.d.ts +61 -0
- package/dist/components/waveform.js +500 -0
- package/dist/components/wheel-picker.d.ts +44 -0
- package/dist/components/wheel-picker.js +771 -0
- package/dist/hooks/use-copy-to-clipboard.d.ts +9 -0
- package/dist/hooks/use-copy-to-clipboard.js +36 -0
- package/dist/hooks/use-media-query.d.ts +21 -0
- package/dist/hooks/use-media-query.js +58 -0
- package/dist/styles.css +202 -0
- package/dist/themes/afterglow.css +89 -0
- package/dist/themes/afterglow.scoped.css +90 -0
- package/dist/themes/blacklight.css +89 -0
- package/dist/themes/blacklight.scoped.css +90 -0
- package/dist/themes/cathode.css +89 -0
- package/dist/themes/cathode.scoped.css +90 -0
- package/dist/themes/cel.css +89 -0
- package/dist/themes/cel.scoped.css +90 -0
- package/dist/themes/cinder.css +89 -0
- package/dist/themes/cinder.scoped.css +90 -0
- package/dist/themes/clay.css +89 -0
- package/dist/themes/clay.scoped.css +90 -0
- package/dist/themes/cobalt.css +89 -0
- package/dist/themes/cobalt.scoped.css +90 -0
- package/dist/themes/crimson.css +89 -0
- package/dist/themes/crimson.scoped.css +90 -0
- package/dist/themes/ion.css +89 -0
- package/dist/themes/ion.scoped.css +90 -0
- package/dist/themes/iris.css +89 -0
- package/dist/themes/iris.scoped.css +90 -0
- package/dist/themes/lagoon.css +89 -0
- package/dist/themes/lagoon.scoped.css +90 -0
- package/dist/themes/mochi.css +89 -0
- package/dist/themes/mochi.scoped.css +90 -0
- package/dist/themes/riso.css +89 -0
- package/dist/themes/riso.scoped.css +90 -0
- package/dist/themes/roast.css +89 -0
- package/dist/themes/roast.scoped.css +90 -0
- package/dist/themes/sage.css +89 -0
- package/dist/themes/sage.scoped.css +90 -0
- package/dist/themes/sepia.css +89 -0
- package/dist/themes/sepia.scoped.css +90 -0
- package/dist/themes/sorbet.css +89 -0
- package/dist/themes/sorbet.scoped.css +90 -0
- package/dist/themes/taffy.css +89 -0
- package/dist/themes/taffy.scoped.css +90 -0
- package/dist/themes/toxin.css +89 -0
- package/dist/themes/toxin.scoped.css +90 -0
- package/package.json +140 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { VariantProps } from "class-variance-authority";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
//#region src/components/copy-to-clipboard.d.ts
|
|
5
|
+
export declare const copyToClipboardVariants: (props?: ({
|
|
6
|
+
size?: "sm" | "lg" | "default" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
export interface CopyToClipboardProps extends useRender.ComponentProps<"div">, VariantProps<typeof copyToClipboardVariants> {
|
|
9
|
+
/** The text to display in the field */
|
|
10
|
+
text: string;
|
|
11
|
+
/**
|
|
12
|
+
* If provided, this text will be copied to clipboard instead of the `text` prop.
|
|
13
|
+
*/
|
|
14
|
+
textToCopy?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Text shown in the tooltip on hover.
|
|
17
|
+
* @default "Copy"
|
|
18
|
+
*/
|
|
19
|
+
tooltipText?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Text shown in the toast after copying.
|
|
22
|
+
* @default "Copied!"
|
|
23
|
+
*/
|
|
24
|
+
copiedText?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Disable the tooltip entirely.
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
disableTooltip?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare function CopyToClipboard({ className, size, text, textToCopy, tooltipText, copiedText, disableTooltip, render, ...props }: CopyToClipboardProps): React$1.ReactElement;
|
|
32
|
+
//#endregion
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCopyToClipboard } from "../hooks/use-copy-to-clipboard.js";
|
|
3
|
+
import { anchoredToastManager } from "./toast.js";
|
|
4
|
+
import { Tooltip, TooltipContent as TooltipPopup, TooltipProvider, TooltipTrigger } from "./tooltip.js";
|
|
5
|
+
import { cn } from "cn";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { cva } from "class-variance-authority";
|
|
8
|
+
import * as React$1 from "react";
|
|
9
|
+
import { Check } from "xiod-icons/icons/Check";
|
|
10
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
11
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
12
|
+
import { Copy } from "xiod-icons/icons/Copy";
|
|
13
|
+
//#region src/components/copy-to-clipboard.tsx
|
|
14
|
+
const copyToClipboardVariants = cva("relative inline-flex w-fit max-w-full min-w-0 items-center rounded-lg border border-input bg-background not-dark:bg-clip-padding text-base text-foreground shadow-xs/5 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/24 sm:text-sm dark:bg-input/32 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]", {
|
|
15
|
+
variants: { size: {
|
|
16
|
+
default: "h-8.5 sm:h-7.5",
|
|
17
|
+
sm: "h-7.5 sm:h-6.5",
|
|
18
|
+
lg: "h-9.5 sm:h-8.5"
|
|
19
|
+
} },
|
|
20
|
+
defaultVariants: { size: "default" }
|
|
21
|
+
});
|
|
22
|
+
function CopyToClipboard({ className, size = "default", text, textToCopy, tooltipText = "Copy", copiedText = "Copied!", disableTooltip = false, render, ...props }) {
|
|
23
|
+
const { copyToClipboard, isCopied } = useCopyToClipboard({ timeout: 2e3 });
|
|
24
|
+
const buttonRef = React$1.useRef(null);
|
|
25
|
+
const valueToCopy = textToCopy ?? text;
|
|
26
|
+
const handleCopy = React$1.useCallback(() => {
|
|
27
|
+
copyToClipboard(valueToCopy);
|
|
28
|
+
if (buttonRef.current) anchoredToastManager.add({
|
|
29
|
+
description: copiedText,
|
|
30
|
+
positionerProps: {
|
|
31
|
+
anchor: buttonRef.current,
|
|
32
|
+
side: "top",
|
|
33
|
+
sideOffset: 8
|
|
34
|
+
},
|
|
35
|
+
data: { tooltipStyle: true },
|
|
36
|
+
timeout: 2e3
|
|
37
|
+
});
|
|
38
|
+
}, [
|
|
39
|
+
copyToClipboard,
|
|
40
|
+
valueToCopy,
|
|
41
|
+
copiedText
|
|
42
|
+
]);
|
|
43
|
+
const buttonContent = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
44
|
+
className: cn("absolute inset-0 flex items-center justify-center transition-[transform,opacity] duration-200", isCopied ? "translate-y-0 opacity-100" : "translate-y-full opacity-0 pointer-events-none"),
|
|
45
|
+
"aria-hidden": "true",
|
|
46
|
+
children: /* @__PURE__ */ jsx(Check, { className: "size-4 text-success" })
|
|
47
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
48
|
+
className: cn("absolute inset-0 flex items-center justify-center transition-[transform,opacity] duration-200", isCopied ? "-translate-y-full opacity-0 pointer-events-none" : "translate-y-0 opacity-100"),
|
|
49
|
+
"aria-hidden": "true",
|
|
50
|
+
children: /* @__PURE__ */ jsx(Copy, { className: "size-4 text-muted-foreground transition-colors group-hover/btn:text-foreground" })
|
|
51
|
+
})] });
|
|
52
|
+
const buttonElement = /* @__PURE__ */ jsx("button", {
|
|
53
|
+
ref: buttonRef,
|
|
54
|
+
type: "button",
|
|
55
|
+
onClick: handleCopy,
|
|
56
|
+
"aria-label": tooltipText,
|
|
57
|
+
className: cn("group/btn relative isolate flex aspect-square h-full items-center justify-center overflow-hidden rounded-r-[calc(var(--radius-lg)-1px)] border-l border-border text-muted-foreground transition-[color,background-color,box-shadow] hover:bg-accent hover:text-accent-foreground focus-visible:-outline-offset-1 focus-visible:outline-ring pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0"),
|
|
58
|
+
children: buttonContent
|
|
59
|
+
});
|
|
60
|
+
const wrappedButton = disableTooltip ? buttonElement : /* @__PURE__ */ jsx(TooltipProvider, {
|
|
61
|
+
delay: 200,
|
|
62
|
+
children: /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: buttonElement }), /* @__PURE__ */ jsx(TooltipPopup, {
|
|
63
|
+
side: "top",
|
|
64
|
+
sideOffset: 8,
|
|
65
|
+
children: tooltipText
|
|
66
|
+
})] })
|
|
67
|
+
});
|
|
68
|
+
const defaultProps = {
|
|
69
|
+
className: cn(copyToClipboardVariants({ size }), className),
|
|
70
|
+
"data-slot": "copy-to-clipboard"
|
|
71
|
+
};
|
|
72
|
+
const wrapperProps = mergeProps(defaultProps, props, { children: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
73
|
+
className: "flex-1 truncate ps-[calc(--spacing(3)-1px)] pe-3 font-mono text-[0.875em] text-foreground sm:ps-[calc(--spacing(2.5)-1px)]",
|
|
74
|
+
children: text
|
|
75
|
+
}), wrappedButton] }) });
|
|
76
|
+
return useRender({
|
|
77
|
+
defaultTagName: "div",
|
|
78
|
+
render,
|
|
79
|
+
props: wrapperProps
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
export { CopyToClipboard, copyToClipboardVariants };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { badgeVariants } from "./badge.js";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
5
|
+
//#region src/components/corner-badge.d.ts
|
|
6
|
+
declare const cornerBadgeVariants: (props?: ({
|
|
7
|
+
position?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | null | undefined;
|
|
8
|
+
overlap?: "rectangle" | "circular" | null | undefined;
|
|
9
|
+
dot?: boolean | null | undefined;
|
|
10
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
|
+
interface CornerBadgeProps extends useRender.ComponentProps<"span"> {
|
|
12
|
+
variant?: VariantProps<typeof badgeVariants>["variant"];
|
|
13
|
+
size?: VariantProps<typeof badgeVariants>["size"];
|
|
14
|
+
position?: VariantProps<typeof cornerBadgeVariants>["position"];
|
|
15
|
+
overlap?: VariantProps<typeof cornerBadgeVariants>["overlap"];
|
|
16
|
+
dot?: boolean;
|
|
17
|
+
invisible?: boolean;
|
|
18
|
+
}
|
|
19
|
+
declare function CornerBadge({ className, variant, size, position, overlap, dot, invisible, render, ...props }: CornerBadgeProps): React$1.ReactElement;
|
|
20
|
+
declare function CornerBadgeAnchor({ className, render, ...props }: useRender.ComponentProps<"div">): React$1.ReactElement;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { CornerBadge, CornerBadgeAnchor, cornerBadgeVariants };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { badgeVariants } from "./badge.js";
|
|
3
|
+
import { cn } from "cn";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
6
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
7
|
+
//#region src/components/corner-badge.tsx
|
|
8
|
+
const cornerBadgeVariants = cva("absolute z-10 flex origin-center items-center justify-center whitespace-nowrap transition-[transform,opacity,scale] duration-200 ring-2 ring-background data-invisible:scale-0 data-invisible:opacity-0", {
|
|
9
|
+
variants: {
|
|
10
|
+
position: {
|
|
11
|
+
"top-right": "top-0 right-0 -translate-y-1/2 translate-x-1/2",
|
|
12
|
+
"top-left": "top-0 left-0 -translate-y-1/2 -translate-x-1/2",
|
|
13
|
+
"bottom-right": "bottom-0 right-0 translate-y-1/2 translate-x-1/2",
|
|
14
|
+
"bottom-left": "bottom-0 left-0 translate-y-1/2 -translate-x-1/2"
|
|
15
|
+
},
|
|
16
|
+
overlap: {
|
|
17
|
+
rectangle: "",
|
|
18
|
+
circular: ""
|
|
19
|
+
},
|
|
20
|
+
dot: {
|
|
21
|
+
true: "size-3 min-w-3 p-0 sm:size-2.5 sm:min-w-2.5 rounded-full [&_svg]:hidden",
|
|
22
|
+
false: ""
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
compoundVariants: [
|
|
26
|
+
{
|
|
27
|
+
position: "top-right",
|
|
28
|
+
overlap: "circular",
|
|
29
|
+
className: "top-[14.6%] right-[14.6%] -translate-y-1/2 translate-x-1/2"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
position: "top-left",
|
|
33
|
+
overlap: "circular",
|
|
34
|
+
className: "top-[14.6%] left-[14.6%] -translate-y-1/2 -translate-x-1/2"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
position: "bottom-right",
|
|
38
|
+
overlap: "circular",
|
|
39
|
+
className: "bottom-[14.6%] right-[14.6%] translate-y-1/2 translate-x-1/2"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
position: "bottom-left",
|
|
43
|
+
overlap: "circular",
|
|
44
|
+
className: "bottom-[14.6%] left-[14.6%] translate-y-1/2 -translate-x-1/2"
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
defaultVariants: {
|
|
48
|
+
position: "top-right",
|
|
49
|
+
overlap: "rectangle",
|
|
50
|
+
dot: false
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
function CornerBadge({ className, variant, size, position, overlap, dot, invisible, render, ...props }) {
|
|
54
|
+
const defaultProps = {
|
|
55
|
+
className: cn(badgeVariants({
|
|
56
|
+
variant,
|
|
57
|
+
size
|
|
58
|
+
}), cornerBadgeVariants({
|
|
59
|
+
position,
|
|
60
|
+
overlap,
|
|
61
|
+
dot
|
|
62
|
+
}), className),
|
|
63
|
+
"data-invisible": invisible,
|
|
64
|
+
"data-slot": "corner-badge"
|
|
65
|
+
};
|
|
66
|
+
return useRender({
|
|
67
|
+
defaultTagName: "span",
|
|
68
|
+
props: mergeProps(defaultProps, props),
|
|
69
|
+
render
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function CornerBadgeAnchor({ className, render, ...props }) {
|
|
73
|
+
const defaultProps = {
|
|
74
|
+
className: cn("relative inline-flex shrink-0 align-middle", className),
|
|
75
|
+
"data-slot": "corner-badge-anchor"
|
|
76
|
+
};
|
|
77
|
+
return useRender({
|
|
78
|
+
defaultTagName: "div",
|
|
79
|
+
props: mergeProps(defaultProps, props),
|
|
80
|
+
render
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
export { CornerBadge, CornerBadgeAnchor, cornerBadgeVariants };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { VariantProps } from "class-variance-authority";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
//#region src/components/dashboard-grid.d.ts
|
|
5
|
+
export interface DashboardTileData {
|
|
6
|
+
i: string;
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
w: number;
|
|
10
|
+
h: number;
|
|
11
|
+
minW?: number;
|
|
12
|
+
maxW?: number;
|
|
13
|
+
minH?: number;
|
|
14
|
+
maxH?: number;
|
|
15
|
+
static?: boolean;
|
|
16
|
+
isDraggable?: boolean;
|
|
17
|
+
isResizable?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export type CompactType = "vertical" | "horizontal" | null;
|
|
20
|
+
export interface Breakpoints {
|
|
21
|
+
lg?: number;
|
|
22
|
+
md?: number;
|
|
23
|
+
sm?: number;
|
|
24
|
+
xs?: number;
|
|
25
|
+
xxs?: number;
|
|
26
|
+
}
|
|
27
|
+
export interface BreakpointCols {
|
|
28
|
+
lg?: number;
|
|
29
|
+
md?: number;
|
|
30
|
+
sm?: number;
|
|
31
|
+
xs?: number;
|
|
32
|
+
xxs?: number;
|
|
33
|
+
}
|
|
34
|
+
export declare const defaultBreakpoints: Required<Breakpoints>;
|
|
35
|
+
export declare const defaultCols: Required<BreakpointCols>;
|
|
36
|
+
export declare const dashboardGridVariants: (props?: ({
|
|
37
|
+
variant?: "default" | "ghost" | "canvas" | "bordered" | null | undefined;
|
|
38
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
39
|
+
export declare const dashboardTileVariants: (props?: ({
|
|
40
|
+
variant?: "default" | "expressive" | "flat" | null | undefined;
|
|
41
|
+
isDragging?: boolean | null | undefined;
|
|
42
|
+
isResizing?: boolean | null | undefined;
|
|
43
|
+
isStatic?: boolean | null | undefined;
|
|
44
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
45
|
+
export declare function compactLayout(layout: DashboardTileData[], compactType: CompactType, cols: number): DashboardTileData[];
|
|
46
|
+
export interface DashboardGridProps extends useRender.ComponentProps<"div">, VariantProps<typeof dashboardGridVariants> {
|
|
47
|
+
layout: DashboardTileData[];
|
|
48
|
+
cols?: number | BreakpointCols;
|
|
49
|
+
breakpoints?: Breakpoints;
|
|
50
|
+
rowHeight?: number;
|
|
51
|
+
margin?: [number, number];
|
|
52
|
+
containerPadding?: [number, number];
|
|
53
|
+
compactType?: CompactType;
|
|
54
|
+
preventCollision?: boolean;
|
|
55
|
+
isDraggable?: boolean;
|
|
56
|
+
isResizable?: boolean;
|
|
57
|
+
showGridLines?: boolean;
|
|
58
|
+
onLayoutChange?: (layout: DashboardTileData[]) => void;
|
|
59
|
+
onTileRemove?: (id: string) => void;
|
|
60
|
+
}
|
|
61
|
+
declare function DashboardGrid({ className, variant, layout: externalLayout, cols: colsProp, breakpoints, rowHeight, margin, containerPadding, compactType, preventCollision, isDraggable, isResizable, showGridLines, onLayoutChange, onTileRemove, render, children, ...props }: DashboardGridProps): React$1.ReactElement;
|
|
62
|
+
export interface DashboardTileProps extends useRender.ComponentProps<"div">, VariantProps<typeof dashboardTileVariants> {
|
|
63
|
+
id: string;
|
|
64
|
+
}
|
|
65
|
+
declare function DashboardTile({ className, variant, id, render, children, ...props }: DashboardTileProps): React$1.ReactElement | null;
|
|
66
|
+
export interface DashboardTileHeaderProps extends useRender.ComponentProps<"div"> {
|
|
67
|
+
id?: string;
|
|
68
|
+
}
|
|
69
|
+
declare function DashboardTileHeader({ className, id, render, children, ...props }: DashboardTileHeaderProps): React$1.ReactElement;
|
|
70
|
+
export interface DashboardTileTitleProps extends useRender.ComponentProps<"span"> {}
|
|
71
|
+
declare function DashboardTileTitle({ className, render, children, ...props }: DashboardTileTitleProps): React$1.ReactElement;
|
|
72
|
+
export interface DashboardTileControlsProps extends useRender.ComponentProps<"div"> {
|
|
73
|
+
id?: string;
|
|
74
|
+
}
|
|
75
|
+
declare function DashboardTileControls({ className, id, render, children, ...props }: DashboardTileControlsProps): React$1.ReactElement;
|
|
76
|
+
export interface DashboardTileHandleProps extends useRender.ComponentProps<"div"> {
|
|
77
|
+
id?: string;
|
|
78
|
+
}
|
|
79
|
+
declare function DashboardTileHandle({ className, id, render, ...props }: DashboardTileHandleProps): React$1.ReactElement;
|
|
80
|
+
export interface DashboardTileResizeHandleProps extends useRender.ComponentProps<"div"> {}
|
|
81
|
+
declare function DashboardTileResizeHandle({ className, render, ...props }: DashboardTileResizeHandleProps): React$1.ReactElement;
|
|
82
|
+
//#endregion
|
|
83
|
+
export { DashboardGrid, DashboardTile, DashboardTileControls, DashboardTileHandle, DashboardTileHeader, DashboardTileResizeHandle, DashboardTileTitle };
|