@xerobi/ui 0.1.0 → 0.1.1
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/dist/components/alert-dialog/alert-dialog.js +2 -2
- package/dist/components/clipboard-text/clipboard-text.d.ts +15 -0
- package/dist/components/clipboard-text/clipboard-text.js +58 -0
- package/dist/components/clipboard-text/index.d.ts +1 -0
- package/dist/components/clipboard-text/index.js +1 -0
- package/dist/components/dialog/dialog.js +2 -2
- package/dist/components/index.d.ts +7 -1
- package/dist/components/index.js +7 -1
- package/dist/components/inline-copy-text/index.d.ts +1 -0
- package/dist/components/inline-copy-text/index.js +1 -0
- package/dist/components/inline-copy-text/inline-copy-text.d.ts +35 -0
- package/dist/components/inline-copy-text/inline-copy-text.js +66 -0
- package/dist/components/navigation-progress/index.d.ts +1 -0
- package/dist/components/navigation-progress/index.js +1 -0
- package/dist/components/navigation-progress/navigation-progress.d.ts +10 -0
- package/dist/components/navigation-progress/navigation-progress.js +59 -0
- package/dist/components/sensitive-input/index.d.ts +1 -0
- package/dist/components/sensitive-input/index.js +1 -0
- package/dist/components/sensitive-input/sensitive-input.d.ts +14 -0
- package/dist/components/sensitive-input/sensitive-input.js +175 -0
- package/dist/components/sheet/sheet.js +1 -1
- package/dist/components/spinner/spinner.js +2 -2
- package/dist/components/switch/switch.d.ts +53 -2
- package/dist/components/switch/switch.js +47 -3
- package/dist/components/toast/index.d.ts +1 -0
- package/dist/components/toast/index.js +1 -0
- package/dist/components/toast/toast.d.ts +90 -0
- package/dist/components/toast/toast.js +137 -0
- package/dist/components/toolbar/index.d.ts +1 -0
- package/dist/components/toolbar/index.js +1 -0
- package/dist/components/toolbar/toolbar.d.ts +18 -0
- package/dist/components/toolbar/toolbar.js +53 -0
- package/dist/components/tooltip/tooltip.d.ts +50 -3
- package/dist/components/tooltip/tooltip.js +39 -7
- package/dist/components/xerobi-logo/index.d.ts +1 -0
- package/dist/components/xerobi-logo/index.js +1 -0
- package/dist/components/xerobi-logo/xerobi-logo.d.ts +60 -0
- package/dist/components/xerobi-logo/xerobi-logo.js +88 -0
- package/dist/styles/globals.css +36 -1
- package/docs/compliance-report.md +1 -1
- package/docs/publishing.md +1 -1
- package/package.json +29 -5
- package/dist/components/snackbar/classes.d.ts +0 -18
- package/dist/components/snackbar/classes.js +0 -19
- package/dist/components/snackbar/index.d.ts +0 -3
- package/dist/components/snackbar/index.js +0 -3
- package/dist/components/snackbar/snackbar.d.ts +0 -8
- package/dist/components/snackbar/snackbar.js +0 -39
- package/dist/styles/snackbar.css +0 -68
|
@@ -13,10 +13,10 @@ function AlertDialogPortal({ ...props }) {
|
|
|
13
13
|
return (_jsx(AlertDialogPrimitive.Portal, { "data-slot": "alert-dialog-portal", ...props }));
|
|
14
14
|
}
|
|
15
15
|
function AlertDialogOverlay({ className, ...props }) {
|
|
16
|
-
return (_jsx(AlertDialogPrimitive.Backdrop, { "data-slot": "alert-dialog-overlay", className: cn("fixed inset-0 isolate z-modal bg-grey-800/48 duration-150 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0", className), ...props }));
|
|
16
|
+
return (_jsx(AlertDialogPrimitive.Backdrop, { "data-slot": "alert-dialog-overlay", className: cn("fixed inset-0 isolate z-modal bg-grey-800/48 duration-150 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 supports-backdrop-filter:backdrop-blur-xs", className), ...props }));
|
|
17
17
|
}
|
|
18
18
|
function AlertDialogContent({ className, size = "default", ...props }) {
|
|
19
|
-
return (_jsxs(AlertDialogPortal, { children: [_jsx(AlertDialogOverlay, {}), _jsx(AlertDialogPrimitive.Popup, { "data-slot": "alert-dialog-content", "data-size": size, className: cn("group/alert-dialog-content fixed top-1/2 left-1/2 z-modal grid w-full -translate-x-1/2 -translate-y-1/2 gap-0 rounded-2xl
|
|
19
|
+
return (_jsxs(AlertDialogPortal, { children: [_jsx(AlertDialogOverlay, {}), _jsx(AlertDialogPrimitive.Popup, { "data-slot": "alert-dialog-content", "data-size": size, className: cn("group/alert-dialog-content fixed top-1/2 left-1/2 z-modal grid w-full -translate-x-1/2 -translate-y-1/2 gap-0 rounded-2xl xui-paper p-0 text-body2 text-popover-foreground shadow-dialog duration-150 outline-none data-[size=default]:max-w-[calc(100%-2rem)] data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-[444px] data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className), ...props })] }));
|
|
20
20
|
}
|
|
21
21
|
function AlertDialogHeader({ className, ...props }) {
|
|
22
22
|
return (_jsx("div", { "data-slot": "alert-dialog-header", className: cn("grid grid-rows-[auto_1fr] place-items-center gap-1 p-6 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]", className), ...props }));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type ClipboardTextSize = "sm" | "base" | "lg";
|
|
2
|
+
export interface ClipboardTextProps {
|
|
3
|
+
text: string;
|
|
4
|
+
textToCopy?: string;
|
|
5
|
+
masked?: boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
onCopy?: () => void;
|
|
8
|
+
size?: ClipboardTextSize;
|
|
9
|
+
labels?: {
|
|
10
|
+
copyAction?: string;
|
|
11
|
+
revealAction?: string;
|
|
12
|
+
hideAction?: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare const ClipboardText: import("react").ForwardRefExoticComponent<ClipboardTextProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Check, Copy, Eye, EyeOff } from "lucide-react";
|
|
4
|
+
import { forwardRef, useCallback, useEffect, useRef, useState } from "react";
|
|
5
|
+
import { cn } from "cn";
|
|
6
|
+
import { Button } from "../button/index.js";
|
|
7
|
+
const COPIED_FEEDBACK_MS = 1500;
|
|
8
|
+
const sizeConfig = {
|
|
9
|
+
sm: { height: "h-8", text: "text-xs", button: "h-8 px-2" },
|
|
10
|
+
base: { height: "h-10", text: "text-sm", button: "h-10 px-3" },
|
|
11
|
+
lg: { height: "h-10", text: "text-sm", button: "h-10 px-3" },
|
|
12
|
+
};
|
|
13
|
+
export const ClipboardText = /* @__PURE__ */ forwardRef(({ text, textToCopy, masked = false, className, size = "lg", onCopy, labels: { copyAction = "Copy to clipboard", revealAction = "Reveal value", hideAction = "Hide value", } = {}, }, ref) => {
|
|
14
|
+
const [copied, setCopied] = useState(false);
|
|
15
|
+
const [revealed, setRevealed] = useState(false);
|
|
16
|
+
const resetTimeoutRef = useRef(null);
|
|
17
|
+
const config = sizeConfig[size];
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
return () => {
|
|
20
|
+
if (resetTimeoutRef.current !== null) {
|
|
21
|
+
clearTimeout(resetTimeoutRef.current);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}, []);
|
|
25
|
+
const copyToClipboard = useCallback(async () => {
|
|
26
|
+
try {
|
|
27
|
+
if (navigator.clipboard && navigator.clipboard.writeText) {
|
|
28
|
+
await navigator.clipboard.writeText(textToCopy ?? text);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
const textarea = document.createElement("textarea");
|
|
32
|
+
textarea.value = textToCopy ?? text;
|
|
33
|
+
textarea.style.position = "absolute";
|
|
34
|
+
textarea.style.left = "-9999px";
|
|
35
|
+
document.body.appendChild(textarea);
|
|
36
|
+
textarea.select();
|
|
37
|
+
document.execCommand("copy");
|
|
38
|
+
document.body.removeChild(textarea);
|
|
39
|
+
}
|
|
40
|
+
setCopied(true);
|
|
41
|
+
if (resetTimeoutRef.current !== null) {
|
|
42
|
+
clearTimeout(resetTimeoutRef.current);
|
|
43
|
+
}
|
|
44
|
+
resetTimeoutRef.current = setTimeout(() => {
|
|
45
|
+
setCopied(false);
|
|
46
|
+
resetTimeoutRef.current = null;
|
|
47
|
+
}, COPIED_FEEDBACK_MS);
|
|
48
|
+
onCopy?.();
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
console.warn("Clipboard copy failed", error);
|
|
52
|
+
}
|
|
53
|
+
}, [text, textToCopy, onCopy]);
|
|
54
|
+
return (_jsxs("div", { ref: ref, className: cn(
|
|
55
|
+
// Mirrors your Input primitive styles so it looks native
|
|
56
|
+
"flex w-full min-w-0 items-center overflow-hidden rounded-md border border-input bg-transparent font-mono transition-colors", "hover:border-text-primary focus-within:border-text-primary focus-within:ring-3 focus-within:ring-ring/30", config.height, config.text, className), children: [_jsx("span", { className: "min-w-0 grow truncate px-3.5", children: masked && !revealed ? "••••••••" : text }), masked && (_jsx(Button, { size: "sm", variant: "ghost", onClick: () => setRevealed((v) => !v), "aria-label": revealed ? hideAction : revealAction, "aria-pressed": revealed, className: cn("h-full shrink-0 rounded-none border-l border-input px-3", "focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:ring-inset"), children: revealed ? _jsx(EyeOff, { className: "size-4" }) : _jsx(Eye, { className: "size-4" }) })), _jsxs(Button, { size: "sm", variant: "ghost", onClick: copyToClipboard, "aria-label": copyAction, className: cn("relative isolate h-full shrink-0 overflow-hidden rounded-none rounded-r-[inherit] border-l border-input px-3", "focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:ring-inset"), children: [_jsx("span", { className: cn("absolute inset-0 flex items-center justify-center transition-all duration-200", copied ? "translate-y-0 opacity-100" : "translate-y-full opacity-0"), children: _jsx(Check, { className: "size-4 text-green-500" }) }), _jsx("span", { className: cn("flex items-center justify-center transition-all duration-200", copied ? "-translate-y-full opacity-0" : "translate-y-0 opacity-100"), children: _jsx(Copy, { className: "size-4" }) })] }), _jsx("span", { className: "sr-only", "aria-live": "polite", children: copied ? "Copied" : "" })] }));
|
|
57
|
+
});
|
|
58
|
+
ClipboardText.displayName = "ClipboardText";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./clipboard-text.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./clipboard-text.js";
|
|
@@ -17,10 +17,10 @@ function DialogClose({ ...props }) {
|
|
|
17
17
|
return _jsx(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
|
|
18
18
|
}
|
|
19
19
|
function DialogOverlay({ className, ...props }) {
|
|
20
|
-
return (_jsx(DialogPrimitive.Backdrop, { "data-slot": "dialog-overlay", className: cn("fixed inset-0 isolate z-modal bg-grey-800/48 duration-150 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0", className), ...props }));
|
|
20
|
+
return (_jsx(DialogPrimitive.Backdrop, { "data-slot": "dialog-overlay", className: cn("fixed inset-0 isolate z-modal bg-grey-800/48 duration-150 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 supports-backdrop-filter:backdrop-blur-xs", className), ...props }));
|
|
21
21
|
}
|
|
22
22
|
function DialogContent({ className, children, showCloseButton = true, ...props }) {
|
|
23
|
-
return (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Popup, { "data-slot": "dialog-content", className: cn("fixed top-1/2 left-1/2 z-modal grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-0 rounded-2xl
|
|
23
|
+
return (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Popup, { "data-slot": "dialog-content", className: cn("fixed top-1/2 left-1/2 z-modal grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-0 rounded-2xl xui-paper p-0 text-body2 text-popover-foreground shadow-dialog duration-150 outline-none sm:max-w-[600px] data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className), ...props, children: [children, showCloseButton && (_jsxs(DialogPrimitive.Close, { "data-slot": "dialog-close", render: _jsx(Button, { variant: "ghost", className: "absolute top-4 right-4", size: "icon-sm" }), children: [_jsx(XIcon, {}), _jsx("span", { className: "sr-only", children: "Close" })] }))] })] }));
|
|
24
24
|
}
|
|
25
25
|
function DialogHeader({ className, ...props }) {
|
|
26
26
|
return (_jsx("div", { "data-slot": "dialog-header", className: cn("flex flex-col gap-1 p-6", className), ...props }));
|
|
@@ -69,7 +69,7 @@ export * from "./separator/index.js";
|
|
|
69
69
|
export * from "./sheet/index.js";
|
|
70
70
|
export * from "./skeleton/index.js";
|
|
71
71
|
export * from "./slider/index.js";
|
|
72
|
-
export * from "./
|
|
72
|
+
export * from "./toast/index.js";
|
|
73
73
|
export * from "./spinner/index.js";
|
|
74
74
|
export * from "./svg-color/index.js";
|
|
75
75
|
export * from "./switch/index.js";
|
|
@@ -82,3 +82,9 @@ export * from "./toggle-group/index.js";
|
|
|
82
82
|
export * from "./tooltip/index.js";
|
|
83
83
|
export * from "./upload/index.js";
|
|
84
84
|
export * from "./walktour/index.js";
|
|
85
|
+
export * from "./toolbar/index.js";
|
|
86
|
+
export * from "./sensitive-input/index.js";
|
|
87
|
+
export * from "./inline-copy-text/index.js";
|
|
88
|
+
export * from "./clipboard-text/index.js";
|
|
89
|
+
export * from "./xerobi-logo/index.js";
|
|
90
|
+
export * from "./navigation-progress/index.js";
|
package/dist/components/index.js
CHANGED
|
@@ -69,7 +69,7 @@ export * from "./separator/index.js";
|
|
|
69
69
|
export * from "./sheet/index.js";
|
|
70
70
|
export * from "./skeleton/index.js";
|
|
71
71
|
export * from "./slider/index.js";
|
|
72
|
-
export * from "./
|
|
72
|
+
export * from "./toast/index.js";
|
|
73
73
|
export * from "./spinner/index.js";
|
|
74
74
|
export * from "./svg-color/index.js";
|
|
75
75
|
export * from "./switch/index.js";
|
|
@@ -82,3 +82,9 @@ export * from "./toggle-group/index.js";
|
|
|
82
82
|
export * from "./tooltip/index.js";
|
|
83
83
|
export * from "./upload/index.js";
|
|
84
84
|
export * from "./walktour/index.js";
|
|
85
|
+
export * from "./toolbar/index.js";
|
|
86
|
+
export * from "./sensitive-input/index.js";
|
|
87
|
+
export * from "./inline-copy-text/index.js";
|
|
88
|
+
export * from "./clipboard-text/index.js";
|
|
89
|
+
export * from "./xerobi-logo/index.js";
|
|
90
|
+
export * from "./navigation-progress/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./inline-copy-text.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./inline-copy-text.js";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ReactNode } from "react";
|
|
2
|
+
export interface InlineCopyTextLabels {
|
|
3
|
+
/** Accessible name before the text is copied. @default "Copy to clipboard" */
|
|
4
|
+
copyAction?: string;
|
|
5
|
+
/** Accessible name and live-region message after copying. @default "Copied" */
|
|
6
|
+
copied?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface InlineCopyTextProps extends Omit<ComponentPropsWithoutRef<"button">, "children" | "onCopy" | "value"> {
|
|
9
|
+
/** Text content to display. */
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
/** The value to copy. Required if children is not a simple string. */
|
|
12
|
+
value?: string;
|
|
13
|
+
/** Callback fired after text is copied successfully. */
|
|
14
|
+
onCopy?: () => void;
|
|
15
|
+
/** Accessible labels for localization. */
|
|
16
|
+
labels?: InlineCopyTextLabels;
|
|
17
|
+
/**
|
|
18
|
+
* Typography style.
|
|
19
|
+
* - `text` matches standard body text
|
|
20
|
+
* - `mono` uses a monospace font (good for IDs, keys, tokens)
|
|
21
|
+
*/
|
|
22
|
+
variant?: "text" | "mono";
|
|
23
|
+
/** Whether to truncate the text if it overflows. @default true */
|
|
24
|
+
truncate?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Compact, borderless copy control for IDs and other short values displayed
|
|
28
|
+
* inline or inside dense table cells.
|
|
29
|
+
*
|
|
30
|
+
* The copy icon appears when the control is hovered or focused. It also
|
|
31
|
+
* responds to an enclosing unnamed Tailwind `group`, allowing table rows to
|
|
32
|
+
* reveal the icon when the row is hovered. After a successful copy, the icon
|
|
33
|
+
* changes to a checkmark and the copied message is announced.
|
|
34
|
+
*/
|
|
35
|
+
export declare const InlineCopyText: import("react").ForwardRefExoticComponent<InlineCopyTextProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Check, Copy } from "lucide-react";
|
|
4
|
+
import { forwardRef, useCallback, useEffect, useRef, useState, } from "react";
|
|
5
|
+
import { cn } from "cn"; // Replace with your utility path
|
|
6
|
+
const COPIED_FEEDBACK_MS = 1500;
|
|
7
|
+
/**
|
|
8
|
+
* Compact, borderless copy control for IDs and other short values displayed
|
|
9
|
+
* inline or inside dense table cells.
|
|
10
|
+
*
|
|
11
|
+
* The copy icon appears when the control is hovered or focused. It also
|
|
12
|
+
* responds to an enclosing unnamed Tailwind `group`, allowing table rows to
|
|
13
|
+
* reveal the icon when the row is hovered. After a successful copy, the icon
|
|
14
|
+
* changes to a checkmark and the copied message is announced.
|
|
15
|
+
*/
|
|
16
|
+
export const InlineCopyText = /* @__PURE__ */ forwardRef(({ children, value, variant = "mono", truncate = true, className, onClick, onCopy, labels: { copyAction = "Copy to clipboard", copied: copiedLabel = "Copied", } = {}, ...props }, ref) => {
|
|
17
|
+
const [copied, setCopied] = useState(false);
|
|
18
|
+
const resetTimeoutRef = useRef(null);
|
|
19
|
+
// Resolve the value to copy
|
|
20
|
+
const valueToCopy = value !== undefined
|
|
21
|
+
? value
|
|
22
|
+
: (typeof children === "string" ? children : undefined);
|
|
23
|
+
if (valueToCopy === undefined) {
|
|
24
|
+
throw new Error("InlineCopyText requires a `value` prop when `children` is not a string.");
|
|
25
|
+
}
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
return () => {
|
|
28
|
+
if (resetTimeoutRef.current !== null) {
|
|
29
|
+
clearTimeout(resetTimeoutRef.current);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}, []);
|
|
33
|
+
const copyToClipboard = useCallback(async () => {
|
|
34
|
+
if (resetTimeoutRef.current !== null) {
|
|
35
|
+
clearTimeout(resetTimeoutRef.current);
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
await navigator.clipboard.writeText(valueToCopy);
|
|
39
|
+
setCopied(true);
|
|
40
|
+
resetTimeoutRef.current = setTimeout(() => {
|
|
41
|
+
setCopied(false);
|
|
42
|
+
resetTimeoutRef.current = null;
|
|
43
|
+
}, COPIED_FEEDBACK_MS);
|
|
44
|
+
onCopy?.();
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
setCopied(false);
|
|
48
|
+
console.warn("Clipboard copy failed", error);
|
|
49
|
+
}
|
|
50
|
+
}, [onCopy, valueToCopy]);
|
|
51
|
+
return (_jsxs("button", { ...props, ref: ref, type: "button", className: cn(
|
|
52
|
+
// Base layout & interaction
|
|
53
|
+
"group/inline-copy flex min-w-0 max-w-full cursor-pointer items-center gap-1.5 rounded-sm border-0 bg-transparent p-0 text-left", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-1",
|
|
54
|
+
// Typography
|
|
55
|
+
variant === "mono" ? "font-mono text-sm text-zinc-600 dark:text-zinc-400" : "text-sm text-zinc-600 dark:text-zinc-400", className), onClick: (event) => {
|
|
56
|
+
onClick?.(event);
|
|
57
|
+
if (!event.defaultPrevented) {
|
|
58
|
+
void copyToClipboard();
|
|
59
|
+
}
|
|
60
|
+
}, "aria-label": copied ? copiedLabel : copyAction, children: [_jsx("span", { className: cn(truncate && "truncate"), children: children }), copied ? (_jsx(Check, { "aria-hidden": true, size: 14, className: "shrink-0 text-green-500 dark:text-green-400" })) : (_jsx(Copy, { "aria-hidden": true, size: 14, className: cn("shrink-0 opacity-0 transition-opacity motion-reduce:transition-none",
|
|
61
|
+
// Show icon on button hover/focus
|
|
62
|
+
"group-hover/inline-copy:opacity-100 group-focus-visible/inline-copy:opacity-100",
|
|
63
|
+
// Also show icon if ANY parent group is hovered (e.g. a table row)
|
|
64
|
+
"group-focus-within:opacity-100 group-hover:opacity-100") })), _jsx("span", { className: "sr-only", "aria-live": "polite", children: copied ? copiedLabel : "" })] }));
|
|
65
|
+
});
|
|
66
|
+
InlineCopyText.displayName = "InlineCopyText";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./navigation-progress.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./navigation-progress.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface NavigationProgressProps {
|
|
2
|
+
/**
|
|
3
|
+
* Optional: For TanStack Router/Start, you can pass `useRouterState` output directly
|
|
4
|
+
* to get exact loading states. If omitted, it falls back to click/link interception.
|
|
5
|
+
*/
|
|
6
|
+
isPending?: boolean;
|
|
7
|
+
/** Optional: Customize the color (defaults to bg-primary) */
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function NavigationProgress({ isPending, className }: NavigationProgressProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useState, useCallback } from "react";
|
|
4
|
+
import { cn } from "cn"; // Replace with your utility path
|
|
5
|
+
export function NavigationProgress({ isPending, className }) {
|
|
6
|
+
const [isNavigating, setIsNavigating] = useState(false);
|
|
7
|
+
// Use the explicit `isPending` prop if provided (TanStack Start),
|
|
8
|
+
// otherwise rely on the internal state (Next.js / Astro fallback).
|
|
9
|
+
const pending = isPending !== undefined ? isPending : isNavigating;
|
|
10
|
+
const startNavigation = useCallback(() => {
|
|
11
|
+
if (isPending !== undefined)
|
|
12
|
+
return; // Let the framework handle it
|
|
13
|
+
setIsNavigating(true);
|
|
14
|
+
}, [isPending]);
|
|
15
|
+
const stopNavigation = useCallback(() => {
|
|
16
|
+
if (isPending !== undefined)
|
|
17
|
+
return;
|
|
18
|
+
// Add a tiny delay so the user actually sees the bar complete
|
|
19
|
+
setTimeout(() => setIsNavigating(false), 300);
|
|
20
|
+
}, [isPending]);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (isPending !== undefined)
|
|
23
|
+
return; // Skip if explicitly controlled
|
|
24
|
+
// 1. Intercept internal link clicks
|
|
25
|
+
const handleAnchorClick = (event) => {
|
|
26
|
+
const target = event.target;
|
|
27
|
+
const anchor = target.closest("a");
|
|
28
|
+
if (anchor &&
|
|
29
|
+
anchor.href &&
|
|
30
|
+
anchor.target !== "_blank" &&
|
|
31
|
+
anchor.origin === window.location.origin &&
|
|
32
|
+
!event.defaultPrevented &&
|
|
33
|
+
!event.metaKey &&
|
|
34
|
+
!event.ctrlKey &&
|
|
35
|
+
!event.shiftKey) {
|
|
36
|
+
startNavigation();
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
// 2. Stop navigation when the new page finishes loading
|
|
40
|
+
const handlePopState = () => {
|
|
41
|
+
stopNavigation();
|
|
42
|
+
};
|
|
43
|
+
// 3. Astro/Next.js full page reload detection
|
|
44
|
+
window.addEventListener("beforeunload", startNavigation);
|
|
45
|
+
document.addEventListener("click", handleAnchorClick);
|
|
46
|
+
window.addEventListener("popstate", handlePopState);
|
|
47
|
+
// For Next.js/React client-side transitions, the new route will mount
|
|
48
|
+
// and this component will re-render. We use a timeout to "finish" the bar.
|
|
49
|
+
stopNavigation();
|
|
50
|
+
return () => {
|
|
51
|
+
window.removeEventListener("beforeunload", startNavigation);
|
|
52
|
+
document.removeEventListener("click", handleAnchorClick);
|
|
53
|
+
window.removeEventListener("popstate", handlePopState);
|
|
54
|
+
};
|
|
55
|
+
}, [isPending, startNavigation, stopNavigation]);
|
|
56
|
+
return (_jsx("div", { "aria-hidden": true, className: cn("pointer-events-none fixed inset-x-0 top-0 z-50 h-[3px] overflow-hidden transition-opacity duration-200", className), style: { opacity: pending ? 1 : 0 }, children: _jsx("div", { className: cn("h-full w-1/3 rounded-r-full bg-primary",
|
|
57
|
+
// Tailwind arbitrary animation for the loading bar
|
|
58
|
+
pending && "animate-[nav-progress_1s_ease-in-out_infinite]") }) }));
|
|
59
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./sensitive-input.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./sensitive-input.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ReactNode } from "react";
|
|
2
|
+
export interface SensitiveInputProps extends Omit<ComponentPropsWithoutRef<"input">, "size" | "type" | "value" | "defaultValue"> {
|
|
3
|
+
value?: string;
|
|
4
|
+
defaultValue?: string;
|
|
5
|
+
onValueChange?: (value: string) => void;
|
|
6
|
+
onCopy?: () => void;
|
|
7
|
+
size?: "xs" | "sm" | "base" | "lg";
|
|
8
|
+
variant?: "default" | "error";
|
|
9
|
+
label?: ReactNode;
|
|
10
|
+
labelTooltip?: ReactNode;
|
|
11
|
+
description?: ReactNode;
|
|
12
|
+
error?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const SensitiveInput: import("react").ForwardRefExoticComponent<SensitiveInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Eye, EyeOff } from "lucide-react";
|
|
4
|
+
import { forwardRef, useCallback, useId, useRef, useState, } from "react";
|
|
5
|
+
import { cn } from "cn"; // Replace with your cn utility path
|
|
6
|
+
import { Input as BaseInput } from "@base-ui/react/input";
|
|
7
|
+
// Assuming you have an Input component or just standard Tailwind
|
|
8
|
+
// If you use a custom Input, replace these with its variants.
|
|
9
|
+
const inputVariants = ({ size, variant }) => {
|
|
10
|
+
const base = "relative flex w-full rounded-md border bg-transparent transition-colors text-sm";
|
|
11
|
+
const sizes = {
|
|
12
|
+
xs: "h-7 px-1.5 text-xs",
|
|
13
|
+
sm: "h-8 px-2 text-sm",
|
|
14
|
+
base: "h-9 px-3 text-sm",
|
|
15
|
+
lg: "h-10 px-4 text-base",
|
|
16
|
+
};
|
|
17
|
+
const variants = {
|
|
18
|
+
default: "border-zinc-200 focus-within:border-zinc-400 dark:border-zinc-800 dark:focus-within:border-zinc-600",
|
|
19
|
+
error: "border-red-500 focus-within:border-red-600",
|
|
20
|
+
};
|
|
21
|
+
return cn(base, sizes[size], variants[variant]);
|
|
22
|
+
};
|
|
23
|
+
// Simple utility to simulate your useCopyFeedback hook
|
|
24
|
+
function useCopyFeedback() {
|
|
25
|
+
const [copied, setCopied] = useState(false);
|
|
26
|
+
// FIX: The callback now explicitly receives `(isCurrent: () => boolean)`
|
|
27
|
+
const runCopy = async (fn, onError) => {
|
|
28
|
+
// Create a synchronous check to see if the component is still mounted/valid
|
|
29
|
+
let valid = true;
|
|
30
|
+
const isCurrent = () => valid;
|
|
31
|
+
try {
|
|
32
|
+
await fn(isCurrent);
|
|
33
|
+
setCopied(true);
|
|
34
|
+
setTimeout(() => setCopied(false), 2000);
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
onError?.(err);
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
return { copied, runCopy };
|
|
43
|
+
}
|
|
44
|
+
export const SensitiveInput = /* @__PURE__ */ forwardRef(({ value: controlledValue, defaultValue = "", onChange, onValueChange, onCopy, size = "base", variant: variantProp, disabled = false, readOnly = false, id, autoComplete = "off", className, label, labelTooltip, description, error, required, ...inputProps }, ref) => {
|
|
45
|
+
const variant = variantProp ?? (error ? "error" : "default");
|
|
46
|
+
const ariaLabelFallback = typeof label === "string" ? label : "Sensitive value";
|
|
47
|
+
const isControlled = controlledValue !== undefined;
|
|
48
|
+
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
49
|
+
const value = isControlled ? controlledValue : internalValue;
|
|
50
|
+
const hasValue = value.length > 0;
|
|
51
|
+
const [mode, setMode] = useState(() => (hasValue ? "masked" : "empty"));
|
|
52
|
+
const { copied, runCopy } = useCopyFeedback();
|
|
53
|
+
const inputRef = useRef(null);
|
|
54
|
+
const containerRef = useRef(null);
|
|
55
|
+
const liveRegionId = useId();
|
|
56
|
+
const generatedId = useId();
|
|
57
|
+
const inputId = id ?? generatedId;
|
|
58
|
+
const maskedInstructionId = useId();
|
|
59
|
+
const mergedRef = useCallback((node) => {
|
|
60
|
+
inputRef.current = node;
|
|
61
|
+
if (typeof ref === "function")
|
|
62
|
+
ref(node);
|
|
63
|
+
else if (ref)
|
|
64
|
+
ref.current = node;
|
|
65
|
+
}, [ref]);
|
|
66
|
+
// Clipboard handling with fallback
|
|
67
|
+
const copyToClipboard = useCallback(async (e) => {
|
|
68
|
+
e.stopPropagation();
|
|
69
|
+
const didCopy = await runCopy(async (isCurrent) => {
|
|
70
|
+
try {
|
|
71
|
+
if (navigator.clipboard && navigator.clipboard.writeText) {
|
|
72
|
+
await navigator.clipboard.writeText(value);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
catch { }
|
|
77
|
+
// isCurrent is now correctly typed
|
|
78
|
+
if (!isCurrent())
|
|
79
|
+
return;
|
|
80
|
+
const textarea = document.createElement("textarea");
|
|
81
|
+
textarea.value = value;
|
|
82
|
+
textarea.style.position = "absolute";
|
|
83
|
+
textarea.style.left = "-9999px";
|
|
84
|
+
document.body.appendChild(textarea);
|
|
85
|
+
textarea.select();
|
|
86
|
+
try {
|
|
87
|
+
if (!document.execCommand("copy"))
|
|
88
|
+
throw new Error("Copy failed");
|
|
89
|
+
}
|
|
90
|
+
finally {
|
|
91
|
+
document.body.removeChild(textarea);
|
|
92
|
+
}
|
|
93
|
+
}, (err) => console.warn("Clipboard copy failed", err));
|
|
94
|
+
if (didCopy)
|
|
95
|
+
onCopy?.();
|
|
96
|
+
}, [value, onCopy, runCopy]);
|
|
97
|
+
// Sync mode when clearing value
|
|
98
|
+
const prevHasValueRef = useRef(hasValue);
|
|
99
|
+
if (prevHasValueRef.current !== hasValue) {
|
|
100
|
+
prevHasValueRef.current = hasValue;
|
|
101
|
+
if (!hasValue && mode === "masked")
|
|
102
|
+
setMode("empty");
|
|
103
|
+
}
|
|
104
|
+
const handleContainerClick = useCallback((e) => {
|
|
105
|
+
if (disabled)
|
|
106
|
+
return;
|
|
107
|
+
if (containerRef.current) {
|
|
108
|
+
const rect = containerRef.current.getBoundingClientRect();
|
|
109
|
+
if (e.clientX < rect.left ||
|
|
110
|
+
e.clientX > rect.right ||
|
|
111
|
+
e.clientY < rect.top ||
|
|
112
|
+
e.clientY > rect.bottom)
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (mode === "masked" && hasValue) {
|
|
116
|
+
setMode("revealed");
|
|
117
|
+
if (!readOnly)
|
|
118
|
+
setTimeout(() => inputRef.current?.focus(), 0);
|
|
119
|
+
}
|
|
120
|
+
}, [mode, hasValue, disabled, readOnly]);
|
|
121
|
+
const handleToggleVisibility = useCallback((e) => {
|
|
122
|
+
e.stopPropagation();
|
|
123
|
+
if (mode === "revealed")
|
|
124
|
+
setMode("masked");
|
|
125
|
+
else if (mode === "empty" && hasValue)
|
|
126
|
+
setMode("revealed");
|
|
127
|
+
}, [mode, hasValue]);
|
|
128
|
+
const handleChange = useCallback((e) => {
|
|
129
|
+
const newValue = e.target.value;
|
|
130
|
+
if (!isControlled)
|
|
131
|
+
setInternalValue(newValue);
|
|
132
|
+
if (mode === "empty" && newValue.length > 0)
|
|
133
|
+
setMode("revealed");
|
|
134
|
+
onChange?.(e);
|
|
135
|
+
onValueChange?.(newValue);
|
|
136
|
+
}, [isControlled, onChange, onValueChange, mode]);
|
|
137
|
+
const handleBlur = useCallback((e) => {
|
|
138
|
+
if (containerRef.current &&
|
|
139
|
+
e.relatedTarget instanceof Node &&
|
|
140
|
+
containerRef.current.contains(e.relatedTarget))
|
|
141
|
+
return;
|
|
142
|
+
if (hasValue)
|
|
143
|
+
setMode("masked");
|
|
144
|
+
}, [hasValue]);
|
|
145
|
+
const handleContainerKeyDown = useCallback((e) => {
|
|
146
|
+
if (disabled)
|
|
147
|
+
return;
|
|
148
|
+
if (mode === "masked" && hasValue) {
|
|
149
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
150
|
+
e.preventDefault();
|
|
151
|
+
setMode("revealed");
|
|
152
|
+
if (!readOnly)
|
|
153
|
+
setTimeout(() => inputRef.current?.focus(), 0);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}, [mode, hasValue, disabled, readOnly]);
|
|
157
|
+
const handleInputKeyDown = useCallback((e) => {
|
|
158
|
+
if (mode === "revealed" && e.key === "Escape") {
|
|
159
|
+
setMode("masked");
|
|
160
|
+
setTimeout(() => containerRef.current?.focus(), 0);
|
|
161
|
+
}
|
|
162
|
+
}, [mode]);
|
|
163
|
+
const isMaskedWithValue = mode === "masked" && hasValue;
|
|
164
|
+
const showEyeButton = !disabled && (mode === "revealed" || (mode === "empty" && hasValue));
|
|
165
|
+
const iconSize = size === "xs" || size === "sm" ? "size-3" : "size-4";
|
|
166
|
+
const containerClassName = cn(inputVariants({ size, variant }), "group/container relative flex w-full items-center", "focus-within:outline-2 focus-within:outline-blue-500 focus-within:outline-offset-1", isMaskedWithValue && !disabled && "cursor-pointer", disabled && "cursor-not-allowed opacity-50", className);
|
|
167
|
+
const containerContent = (_jsxs(_Fragment, { children: [_jsx(BaseInput, { ref: mergedRef, id: inputId, type: mode === "revealed" ? "text" : "password", value: value, onChange: handleChange, onBlur: handleBlur, onKeyDown: handleInputKeyDown, disabled: disabled, readOnly: readOnly || isMaskedWithValue, required: required, autoComplete: autoComplete, tabIndex: isMaskedWithValue ? -1 : 0, className: cn("w-full border-0 bg-transparent p-0 text-zinc-900 ring-0 outline-none disabled:cursor-not-allowed disabled:text-zinc-500 dark:text-zinc-100", size === "xs" && "pr-5", size === "sm" && "pr-6", size === "base" && "pr-8", size === "lg" && "pr-10", isMaskedWithValue && "pointer-events-none text-transparent"), "aria-hidden": isMaskedWithValue, ...inputProps }), _jsx("span", { className: cn("pointer-events-none absolute inset-y-0 left-0 flex items-center overflow-hidden select-none", size === "xs" && "right-5 px-1.5", size === "sm" && "right-6 px-2", size === "base" && "right-8 px-3", size === "lg" && "right-10 px-4", !isMaskedWithValue && "invisible", isMaskedWithValue && "pointer-events-auto", "text-zinc-900 dark:text-zinc-100", "group/mask"), "aria-hidden": "true", children: _jsxs("span", { className: "relative", children: [_jsx("span", { className: cn(isMaskedWithValue && !disabled && "group-focus-within/container:invisible group-hover/mask:invisible"), children: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" }), isMaskedWithValue && !disabled && (_jsx("span", { className: "invisible absolute top-0 left-0 whitespace-nowrap text-zinc-500 group-focus-within/container:visible group-hover/mask:visible", children: "Click to reveal" }))] }) }), _jsx("button", { type: "button", onClick: handleToggleVisibility, onKeyDown: (e) => e.stopPropagation(), "aria-label": mode === "revealed" ? "Hide value" : "Reveal value", tabIndex: showEyeButton ? 0 : -1, className: cn("absolute top-1/2 right-0 -translate-y-1/2 cursor-pointer text-zinc-400 hover:text-zinc-900 focus:ring-2 focus:ring-blue-500 focus-visible:rounded-sm", "m-0 inline-flex h-auto min-h-0 items-center justify-center border-none bg-transparent p-0 shadow-none", size === "xs" && "right-1.5", size === "sm" && "right-2", size === "base" && "right-3", size === "lg" && "right-4", iconSize, !showEyeButton && "pointer-events-none opacity-0"), children: mode === "revealed" ? (_jsx(EyeOff, { className: "size-full", strokeWidth: 2 })) : (_jsx(Eye, { className: "size-full", strokeWidth: 2 })) }), hasValue && !disabled && (_jsx("button", { type: "button", onClick: copyToClipboard, onKeyDown: (e) => e.stopPropagation(), "aria-label": copied ? "Copied" : "Copy to clipboard", className: cn("absolute -top-px right-2 -translate-y-full cursor-pointer rounded-t-md bg-blue-600 px-2 py-0.5 text-[10px] font-medium text-white opacity-0 transition-opacity group-focus-within/container:opacity-100 group-hover/container:opacity-100 hover:bg-blue-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500", "m-0 h-auto min-h-0 border-none shadow-none"), children: copied ? "Copied" : "Copy" }))] }));
|
|
168
|
+
const input = (_jsxs("div", { className: "relative w-full", children: [isMaskedWithValue ? (_jsx("div", { ref: containerRef, role: "button", tabIndex: disabled ? -1 : 0, className: containerClassName, onClick: handleContainerClick, onKeyDown: handleContainerKeyDown, "aria-label": `${ariaLabelFallback}, masked.`, "aria-describedby": `${maskedInstructionId} ${liveRegionId}`, "aria-disabled": disabled, children: containerContent })) : (_jsx("div", { ref: containerRef, className: containerClassName, children: containerContent })), isMaskedWithValue && (_jsx("span", { id: maskedInstructionId, className: "sr-only", children: "Click or press Enter to reveal." })), _jsxs("span", { id: liveRegionId, className: "sr-only", "aria-live": "polite", children: [mode === "masked" && hasValue && "Value hidden", copied && "Copied to clipboard"] })] }));
|
|
169
|
+
// You can swap this out for your own `<Field>` component
|
|
170
|
+
if (label) {
|
|
171
|
+
return (_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsxs("label", { className: "flex items-center gap-1 text-sm font-medium text-zinc-900 dark:text-zinc-100", children: [label, required && _jsx("span", { className: "text-red-500", children: "*" }), labelTooltip && _jsx("span", { title: labelTooltip, className: "cursor-help text-zinc-400", children: "\u24D8" })] }), input, description && _jsx("p", { className: "text-xs text-zinc-500", children: description }), error && _jsx("p", { className: "text-xs text-red-500", children: error })] }));
|
|
172
|
+
}
|
|
173
|
+
return input;
|
|
174
|
+
});
|
|
175
|
+
SensitiveInput.displayName = "SensitiveInput";
|
|
@@ -17,7 +17,7 @@ function SheetPortal({ ...props }) {
|
|
|
17
17
|
return _jsx(SheetPrimitive.Portal, { "data-slot": "sheet-portal", ...props });
|
|
18
18
|
}
|
|
19
19
|
function SheetOverlay({ className, ...props }) {
|
|
20
|
-
return (_jsx(SheetPrimitive.Backdrop, { "data-slot": "sheet-overlay", className: cn("fixed inset-0 z-modal bg-grey-800/48 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0", className), ...props }));
|
|
20
|
+
return (_jsx(SheetPrimitive.Backdrop, { "data-slot": "sheet-overlay", className: cn("fixed inset-0 z-modal bg-grey-800/48 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs", className), ...props }));
|
|
21
21
|
}
|
|
22
22
|
function SheetContent({ className, children, side = "right", showCloseButton = true, ...props }) {
|
|
23
23
|
return (_jsxs(SheetPortal, { children: [_jsx(SheetOverlay, {}), _jsxs(SheetPrimitive.Popup, { "data-slot": "sheet-content", "data-side": side, className: cn("xui-paper fixed z-modal flex flex-col gap-4 text-body2 text-popover-foreground transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:shadow-[40px_40px_80px_-8px_rgb(var(--shadow-tint)/0.24)] data-[side=right]:shadow-[-40px_40px_80px_-8px_rgb(var(--shadow-tint)/0.24)] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm", className), ...props, children: [children, showCloseButton && (_jsxs(SheetPrimitive.Close, { "data-slot": "sheet-close", render: _jsx(Button, { variant: "ghost", className: "absolute top-4 right-4", size: "icon-sm" }), children: [_jsx(XIcon, {}), _jsx("span", { className: "sr-only", children: "Close" })] }))] })] }));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { cn } from "cn";
|
|
4
|
-
import {
|
|
4
|
+
import { Loader } from "lucide-react";
|
|
5
5
|
function Spinner({ className, ...props }) {
|
|
6
|
-
return (_jsx(
|
|
6
|
+
return (_jsx(Loader, { "data-slot": "spinner", role: "status", "aria-label": "Loading", className: cn("size-4 animate-spin", className), ...props }));
|
|
7
7
|
}
|
|
8
8
|
export { Spinner };
|