@glinui/ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion.d.ts +42 -0
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/accordion.js +85 -0
- package/dist/components/alert-dialog.d.ts +30 -0
- package/dist/components/alert-dialog.d.ts.map +1 -0
- package/dist/components/alert-dialog.js +53 -0
- package/dist/components/alert.d.ts +15 -0
- package/dist/components/alert.d.ts.map +1 -0
- package/dist/components/alert.js +39 -0
- package/dist/components/animated-gradient.d.ts +11 -0
- package/dist/components/animated-gradient.d.ts.map +1 -0
- package/dist/components/animated-gradient.js +23 -0
- package/dist/components/aurora-background.d.ts +15 -0
- package/dist/components/aurora-background.d.ts.map +1 -0
- package/dist/components/aurora-background.js +26 -0
- package/dist/components/avatar.d.ts +54 -0
- package/dist/components/avatar.d.ts.map +1 -0
- package/dist/components/avatar.js +92 -0
- package/dist/components/badge.d.ts +13 -0
- package/dist/components/badge.d.ts.map +1 -0
- package/dist/components/badge.js +32 -0
- package/dist/components/blur-fade.d.ts +17 -0
- package/dist/components/blur-fade.d.ts.map +1 -0
- package/dist/components/blur-fade.js +48 -0
- package/dist/components/blur-spotlight.d.ts +13 -0
- package/dist/components/blur-spotlight.d.ts.map +1 -0
- package/dist/components/blur-spotlight.js +58 -0
- package/dist/components/border-beam.d.ts +11 -0
- package/dist/components/border-beam.d.ts.map +1 -0
- package/dist/components/border-beam.js +14 -0
- package/dist/components/button.d.ts +17 -0
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/button.js +33 -0
- package/dist/components/card.d.ts +39 -0
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/card.js +81 -0
- package/dist/components/checkbox.d.ts +14 -0
- package/dist/components/checkbox.d.ts.map +1 -0
- package/dist/components/checkbox.js +58 -0
- package/dist/components/chip.d.ts +15 -0
- package/dist/components/chip.d.ts.map +1 -0
- package/dist/components/chip.js +35 -0
- package/dist/components/chromatic-text.d.ts +11 -0
- package/dist/components/chromatic-text.d.ts.map +1 -0
- package/dist/components/chromatic-text.js +22 -0
- package/dist/components/code.d.ts +13 -0
- package/dist/components/code.d.ts.map +1 -0
- package/dist/components/code.js +27 -0
- package/dist/components/command.d.ts +89 -0
- package/dist/components/command.d.ts.map +1 -0
- package/dist/components/command.js +123 -0
- package/dist/components/counter.d.ts +19 -0
- package/dist/components/counter.d.ts.map +1 -0
- package/dist/components/counter.js +28 -0
- package/dist/components/data-table.d.ts +38 -0
- package/dist/components/data-table.d.ts.map +1 -0
- package/dist/components/data-table.js +183 -0
- package/dist/components/depth-card.d.ts +15 -0
- package/dist/components/depth-card.d.ts.map +1 -0
- package/dist/components/depth-card.js +52 -0
- package/dist/components/dot-pattern.d.ts +10 -0
- package/dist/components/dot-pattern.d.ts.map +1 -0
- package/dist/components/dot-pattern.js +10 -0
- package/dist/components/dropdown-menu.d.ts +74 -0
- package/dist/components/dropdown-menu.d.ts.map +1 -0
- package/dist/components/dropdown-menu.js +90 -0
- package/dist/components/floating-panel.d.ts +17 -0
- package/dist/components/floating-panel.d.ts.map +1 -0
- package/dist/components/floating-panel.js +57 -0
- package/dist/components/glass-breadcrumb.d.ts +17 -0
- package/dist/components/glass-breadcrumb.d.ts.map +1 -0
- package/dist/components/glass-breadcrumb.js +14 -0
- package/dist/components/glass-card.d.ts +20 -0
- package/dist/components/glass-card.d.ts.map +1 -0
- package/dist/components/glass-card.js +36 -0
- package/dist/components/glass-dock.d.ts +21 -0
- package/dist/components/glass-dock.d.ts.map +1 -0
- package/dist/components/glass-dock.js +54 -0
- package/dist/components/glass-navbar.d.ts +21 -0
- package/dist/components/glass-navbar.d.ts.map +1 -0
- package/dist/components/glass-navbar.js +43 -0
- package/dist/components/glass-toggle.d.ts +15 -0
- package/dist/components/glass-toggle.d.ts.map +1 -0
- package/dist/components/glass-toggle.js +32 -0
- package/dist/components/glow-border.d.ts +13 -0
- package/dist/components/glow-border.d.ts.map +1 -0
- package/dist/components/glow-border.js +10 -0
- package/dist/components/gradient-mesh.d.ts +13 -0
- package/dist/components/gradient-mesh.d.ts.map +1 -0
- package/dist/components/gradient-mesh.js +25 -0
- package/dist/components/heading.d.ts +18 -0
- package/dist/components/heading.d.ts.map +1 -0
- package/dist/components/heading.js +28 -0
- package/dist/components/hover-card.d.ts +32 -0
- package/dist/components/hover-card.d.ts.map +1 -0
- package/dist/components/hover-card.js +28 -0
- package/dist/components/icon-frame.d.ts +13 -0
- package/dist/components/icon-frame.d.ts.map +1 -0
- package/dist/components/icon-frame.js +27 -0
- package/dist/components/input.d.ts +13 -0
- package/dist/components/input.d.ts.map +1 -0
- package/dist/components/input.js +38 -0
- package/dist/components/kbd.d.ts +13 -0
- package/dist/components/kbd.d.ts.map +1 -0
- package/dist/components/kbd.js +27 -0
- package/dist/components/label.d.ts +13 -0
- package/dist/components/label.d.ts.map +1 -0
- package/dist/components/label.js +27 -0
- package/dist/components/light-leak.d.ts +15 -0
- package/dist/components/light-leak.d.ts.map +1 -0
- package/dist/components/light-leak.js +29 -0
- package/dist/components/link.d.ts +15 -0
- package/dist/components/link.d.ts.map +1 -0
- package/dist/components/link.js +32 -0
- package/dist/components/liquid-button.d.ts +17 -0
- package/dist/components/liquid-button.d.ts.map +1 -0
- package/dist/components/liquid-button.js +18 -0
- package/dist/components/magnetic-cta.d.ts +18 -0
- package/dist/components/magnetic-cta.d.ts.map +1 -0
- package/dist/components/magnetic-cta.js +46 -0
- package/dist/components/marquee.d.ts +10 -0
- package/dist/components/marquee.d.ts.map +1 -0
- package/dist/components/marquee.js +16 -0
- package/dist/components/meteor-shower.d.ts +11 -0
- package/dist/components/meteor-shower.d.ts.map +1 -0
- package/dist/components/meteor-shower.js +39 -0
- package/dist/components/modal.d.ts +30 -0
- package/dist/components/modal.d.ts.map +1 -0
- package/dist/components/modal.js +39 -0
- package/dist/components/morphing-tabs.d.ts +22 -0
- package/dist/components/morphing-tabs.d.ts.map +1 -0
- package/dist/components/morphing-tabs.js +72 -0
- package/dist/components/number-ticker.d.ts +11 -0
- package/dist/components/number-ticker.d.ts.map +1 -0
- package/dist/components/number-ticker.js +66 -0
- package/dist/components/orbiting-circles.d.ts +21 -0
- package/dist/components/orbiting-circles.d.ts.map +1 -0
- package/dist/components/orbiting-circles.js +24 -0
- package/dist/components/particle-field.d.ts +19 -0
- package/dist/components/particle-field.d.ts.map +1 -0
- package/dist/components/particle-field.js +41 -0
- package/dist/components/popover.d.ts +27 -0
- package/dist/components/popover.d.ts.map +1 -0
- package/dist/components/popover.js +52 -0
- package/dist/components/prism-border.d.ts +13 -0
- package/dist/components/prism-border.d.ts.map +1 -0
- package/dist/components/prism-border.js +16 -0
- package/dist/components/progress.d.ts +58 -0
- package/dist/components/progress.d.ts.map +1 -0
- package/dist/components/progress.js +108 -0
- package/dist/components/pulsating-button.d.ts +13 -0
- package/dist/components/pulsating-button.d.ts.map +1 -0
- package/dist/components/pulsating-button.js +40 -0
- package/dist/components/radio-group.d.ts +27 -0
- package/dist/components/radio-group.d.ts.map +1 -0
- package/dist/components/radio-group.js +58 -0
- package/dist/components/retro-grid.d.ts +13 -0
- package/dist/components/retro-grid.d.ts.map +1 -0
- package/dist/components/retro-grid.js +17 -0
- package/dist/components/reveal-text.d.ts +17 -0
- package/dist/components/reveal-text.d.ts.map +1 -0
- package/dist/components/reveal-text.js +61 -0
- package/dist/components/ripple-button.d.ts +11 -0
- package/dist/components/ripple-button.d.ts.map +1 -0
- package/dist/components/ripple-button.js +47 -0
- package/dist/components/ripple.d.ts +13 -0
- package/dist/components/ripple.d.ts.map +1 -0
- package/dist/components/ripple.js +24 -0
- package/dist/components/select.d.ts +24 -0
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/select.js +30 -0
- package/dist/components/separator.d.ts +29 -0
- package/dist/components/separator.d.ts.map +1 -0
- package/dist/components/separator.js +84 -0
- package/dist/components/sheet.d.ts +41 -0
- package/dist/components/sheet.d.ts.map +1 -0
- package/dist/components/sheet.js +85 -0
- package/dist/components/shimmer-button.d.ts +13 -0
- package/dist/components/shimmer-button.d.ts.map +1 -0
- package/dist/components/shimmer-button.js +32 -0
- package/dist/components/skeleton.d.ts +17 -0
- package/dist/components/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton.js +42 -0
- package/dist/components/slider.d.ts +14 -0
- package/dist/components/slider.d.ts.map +1 -0
- package/dist/components/slider.js +89 -0
- package/dist/components/sonner.d.ts +14 -0
- package/dist/components/sonner.d.ts.map +1 -0
- package/dist/components/sonner.js +70 -0
- package/dist/components/spotlight-card.d.ts +11 -0
- package/dist/components/spotlight-card.d.ts.map +1 -0
- package/dist/components/spotlight-card.js +39 -0
- package/dist/components/spotlight.d.ts +19 -0
- package/dist/components/spotlight.d.ts.map +1 -0
- package/dist/components/spotlight.js +23 -0
- package/dist/components/status-dot.d.ts +24 -0
- package/dist/components/status-dot.d.ts.map +1 -0
- package/dist/components/status-dot.js +46 -0
- package/dist/components/switch.d.ts +42 -0
- package/dist/components/switch.d.ts.map +1 -0
- package/dist/components/switch.js +77 -0
- package/dist/components/table.d.ts +69 -0
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/table.js +176 -0
- package/dist/components/tabs.d.ts +34 -0
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +75 -0
- package/dist/components/text-reveal.d.ts +6 -0
- package/dist/components/text-reveal.d.ts.map +1 -0
- package/dist/components/text-reveal.js +56 -0
- package/dist/components/text.d.ts +13 -0
- package/dist/components/text.d.ts.map +1 -0
- package/dist/components/text.js +27 -0
- package/dist/components/textarea.d.ts +13 -0
- package/dist/components/textarea.d.ts.map +1 -0
- package/dist/components/textarea.js +37 -0
- package/dist/components/toast.d.ts +23 -0
- package/dist/components/toast.d.ts.map +1 -0
- package/dist/components/toast.js +36 -0
- package/dist/components/tooltip.d.ts +35 -0
- package/dist/components/tooltip.d.ts.map +1 -0
- package/dist/components/tooltip.js +34 -0
- package/dist/components/tree.d.ts +50 -0
- package/dist/components/tree.d.ts.map +1 -0
- package/dist/components/tree.js +77 -0
- package/dist/components/typewriter.d.ts +25 -0
- package/dist/components/typewriter.d.ts.map +1 -0
- package/dist/components/typewriter.js +109 -0
- package/dist/components/word-rotate.d.ts +11 -0
- package/dist/components/word-rotate.d.ts.map +1 -0
- package/dist/components/word-rotate.js +29 -0
- package/dist/index.d.ts +80 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +79 -0
- package/dist/lib/cn.d.ts +3 -0
- package/dist/lib/cn.d.ts.map +1 -0
- package/dist/lib/cn.js +5 -0
- package/dist/lib/use-liquid-glass.d.ts +46 -0
- package/dist/lib/use-liquid-glass.d.ts.map +1 -0
- package/dist/lib/use-liquid-glass.js +144 -0
- package/dist/lib/use-prefers-reduced-motion.d.ts +2 -0
- package/dist/lib/use-prefers-reduced-motion.d.ts.map +1 -0
- package/dist/lib/use-prefers-reduced-motion.js +23 -0
- package/package.json +72 -0
|
@@ -0,0 +1,39 @@
|
|
|
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/cn";
|
|
5
|
+
import { usePrefersReducedMotion } from "../lib/use-prefers-reduced-motion";
|
|
6
|
+
import { GlassCard } from "./glass-card";
|
|
7
|
+
export const SpotlightCard = React.forwardRef(({ className, children, onMouseMove, onMouseLeave, spotlightClassName, ...props }, ref) => {
|
|
8
|
+
const prefersReducedMotion = usePrefersReducedMotion();
|
|
9
|
+
const localRef = React.useRef(null);
|
|
10
|
+
const setRefs = React.useCallback((node) => {
|
|
11
|
+
localRef.current = node;
|
|
12
|
+
if (typeof ref === "function") {
|
|
13
|
+
ref(node);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (ref) {
|
|
17
|
+
ref.current = node;
|
|
18
|
+
}
|
|
19
|
+
}, [ref]);
|
|
20
|
+
const handleMouseMove = React.useCallback((event) => {
|
|
21
|
+
if (!prefersReducedMotion && localRef.current) {
|
|
22
|
+
const rect = localRef.current.getBoundingClientRect();
|
|
23
|
+
const x = event.clientX - rect.left;
|
|
24
|
+
const y = event.clientY - rect.top;
|
|
25
|
+
localRef.current.style.setProperty("--spot-x", `${x.toFixed(2)}px`);
|
|
26
|
+
localRef.current.style.setProperty("--spot-y", `${y.toFixed(2)}px`);
|
|
27
|
+
localRef.current.dataset.spotlightActive = "true";
|
|
28
|
+
}
|
|
29
|
+
onMouseMove?.(event);
|
|
30
|
+
}, [onMouseMove, prefersReducedMotion]);
|
|
31
|
+
const handleMouseLeave = React.useCallback((event) => {
|
|
32
|
+
if (localRef.current) {
|
|
33
|
+
localRef.current.dataset.spotlightActive = "false";
|
|
34
|
+
}
|
|
35
|
+
onMouseLeave?.(event);
|
|
36
|
+
}, [onMouseLeave]);
|
|
37
|
+
return (_jsxs(GlassCard, { ref: setRefs, className: cn("group overflow-hidden", className), "data-spotlight-active": "false", onMouseMove: handleMouseMove, onMouseLeave: handleMouseLeave, ...props, children: [_jsx("span", { "aria-hidden": "true", "data-slot": "spotlight-overlay", className: cn("pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-fast ease-standard [background:radial-gradient(220px_circle_at_var(--spot-x,_50%)_var(--spot-y,_50%),rgb(255_255_255_/_0.3),transparent_70%)] group-hover:opacity-100 motion-reduce:hidden motion-reduce:transition-none", spotlightClassName) }), _jsx("div", { className: "relative z-[1]", children: children })] }));
|
|
38
|
+
});
|
|
39
|
+
SpotlightCard.displayName = "SpotlightCard";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface SpotlightProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/** Whether the spotlight is active */
|
|
4
|
+
active?: boolean;
|
|
5
|
+
/** X position of spotlight center (px or %) */
|
|
6
|
+
x?: number | string;
|
|
7
|
+
/** Y position of spotlight center (px or %) */
|
|
8
|
+
y?: number | string;
|
|
9
|
+
/** Spotlight radius in px */
|
|
10
|
+
size?: number;
|
|
11
|
+
/** Overlay color */
|
|
12
|
+
overlayColor?: string;
|
|
13
|
+
/** Click overlay to dismiss */
|
|
14
|
+
onDismiss?: () => void;
|
|
15
|
+
/** Pulsing animation */
|
|
16
|
+
pulse?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare const Spotlight: React.ForwardRefExoticComponent<SpotlightProps & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
//# sourceMappingURL=spotlight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spotlight.d.ts","sourceRoot":"","sources":["../../src/components/spotlight.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,MAAM,WAAW,cAAe,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC1E,sCAAsC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,+CAA+C;IAC/C,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,+CAA+C;IAC/C,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,6BAA6B;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,oBAAoB;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,+BAA+B;IAC/B,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,wBAAwB;IACxB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,eAAO,MAAM,SAAS,uFA0DrB,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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/cn";
|
|
5
|
+
export const Spotlight = React.forwardRef(({ className, children, active = true, x = "50%", y = "50%", size = 150, overlayColor = "rgba(0, 0, 0, 0.7)", onDismiss, pulse = false, style, ...props }, ref) => {
|
|
6
|
+
if (!active)
|
|
7
|
+
return null;
|
|
8
|
+
const posX = typeof x === "number" ? `${x}px` : x;
|
|
9
|
+
const posY = typeof y === "number" ? `${y}px` : y;
|
|
10
|
+
return (_jsxs("div", { ref: ref, className: cn("fixed inset-0 z-[100] transition-opacity duration-300", className), style: {
|
|
11
|
+
background: `radial-gradient(circle ${size}px at ${posX} ${posY}, transparent 0%, ${overlayColor} 100%)`,
|
|
12
|
+
...style,
|
|
13
|
+
}, onClick: onDismiss, role: onDismiss ? "button" : undefined, tabIndex: onDismiss ? 0 : undefined, "aria-label": onDismiss ? "Dismiss spotlight" : undefined, onKeyDown: onDismiss ? (e) => { if (e.key === "Enter" || e.key === " ")
|
|
14
|
+
onDismiss(); } : undefined, ...props, children: [pulse && (_jsx("div", { "aria-hidden": "true", className: "absolute rounded-full border-2 border-white/30 animate-spotlight-pulse motion-reduce:[animation:none]", style: {
|
|
15
|
+
"--spotlight-pulse-duration": "3s",
|
|
16
|
+
left: posX,
|
|
17
|
+
top: posY,
|
|
18
|
+
width: size * 2,
|
|
19
|
+
height: size * 2,
|
|
20
|
+
transform: "translate(-50%, -50%)",
|
|
21
|
+
} })), children] }));
|
|
22
|
+
});
|
|
23
|
+
Spotlight.displayName = "Spotlight";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const statusDotVariants: (props?: ({
|
|
4
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
declare const dotVariants: (props?: ({
|
|
7
|
+
status?: "success" | "warning" | "info" | "neutral" | "danger" | null | undefined;
|
|
8
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
9
|
+
pulse?: boolean | null | undefined;
|
|
10
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
|
+
export type StatusDotProps = React.HTMLAttributes<HTMLSpanElement> & VariantProps<typeof statusDotVariants> & VariantProps<typeof dotVariants> & {
|
|
12
|
+
label?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const StatusDot: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLSpanElement> & VariantProps<(props?: ({
|
|
15
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
16
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & VariantProps<(props?: ({
|
|
17
|
+
status?: "success" | "warning" | "info" | "neutral" | "danger" | null | undefined;
|
|
18
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
19
|
+
pulse?: boolean | null | undefined;
|
|
20
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & {
|
|
21
|
+
label?: string;
|
|
22
|
+
} & React.RefAttributes<HTMLSpanElement>>;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=status-dot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-dot.d.ts","sourceRoot":"","sources":["../../src/components/status-dot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,QAAA,MAAM,iBAAiB;;8EAWrB,CAAA;AAEF,QAAA,MAAM,WAAW;;;;8EAwBf,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC,GAChE,YAAY,CAAC,OAAO,iBAAiB,CAAC,GACtC,YAAY,CAAC,OAAO,WAAW,CAAC,GAAG;IACjC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAEH,eAAO,MAAM,SAAS;;;;;;;YAHV,MAAM;yCAcjB,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { cn } from "../lib/cn";
|
|
5
|
+
const statusDotVariants = cva("inline-flex items-center gap-2", {
|
|
6
|
+
variants: {
|
|
7
|
+
size: {
|
|
8
|
+
sm: "text-xs",
|
|
9
|
+
md: "text-sm",
|
|
10
|
+
lg: "text-base"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: {
|
|
14
|
+
size: "md"
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
const dotVariants = cva("rounded-full", {
|
|
18
|
+
variants: {
|
|
19
|
+
status: {
|
|
20
|
+
neutral: "bg-neutral-500",
|
|
21
|
+
info: "bg-sky-500",
|
|
22
|
+
success: "bg-emerald-500",
|
|
23
|
+
warning: "bg-amber-500",
|
|
24
|
+
danger: "bg-rose-500"
|
|
25
|
+
},
|
|
26
|
+
size: {
|
|
27
|
+
sm: "h-1.5 w-1.5",
|
|
28
|
+
md: "h-2 w-2",
|
|
29
|
+
lg: "h-2.5 w-2.5"
|
|
30
|
+
},
|
|
31
|
+
pulse: {
|
|
32
|
+
true: "motion-safe:animate-pulse",
|
|
33
|
+
false: ""
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
defaultVariants: {
|
|
37
|
+
status: "neutral",
|
|
38
|
+
size: "md",
|
|
39
|
+
pulse: false
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
export const StatusDot = React.forwardRef(({ className, size, status, pulse, label, children, ...props }, ref) => {
|
|
43
|
+
const content = label ?? children;
|
|
44
|
+
return (_jsxs("span", { ref: ref, className: cn(statusDotVariants({ size }), className), ...props, children: [_jsx("span", { "aria-hidden": true, className: cn(dotVariants({ status, size, pulse })) }), content ? _jsx("span", { className: "text-[var(--color-foreground)]", children: content }) : null] }));
|
|
45
|
+
});
|
|
46
|
+
StatusDot.displayName = "StatusDot";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as SwitchPrimitive from "@radix-ui/react-switch";
|
|
3
|
+
import { type VariantProps } from "class-variance-authority";
|
|
4
|
+
declare const switchVariants: (props?: ({
|
|
5
|
+
variant?: "default" | "glass" | "frosted" | "matte" | "liquid" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
export type SwitchProps = Omit<React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>, "onCheckedChange"> & VariantProps<typeof switchVariants> & {
|
|
8
|
+
/** Controlled checked state. */
|
|
9
|
+
checked?: boolean;
|
|
10
|
+
/** Initial checked state for uncontrolled usage. */
|
|
11
|
+
defaultChecked?: boolean;
|
|
12
|
+
/** Callback fired when the checked state changes. */
|
|
13
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
14
|
+
/** Prevents interaction and applies muted styling. */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/** Marks the switch as required within a form. */
|
|
17
|
+
required?: boolean;
|
|
18
|
+
/** Form field name submitted with form data. */
|
|
19
|
+
name?: string;
|
|
20
|
+
/** Value submitted with the form when checked. */
|
|
21
|
+
value?: string;
|
|
22
|
+
};
|
|
23
|
+
export declare const Switch: React.ForwardRefExoticComponent<Omit<Omit<SwitchPrimitive.SwitchProps & React.RefAttributes<HTMLButtonElement>, "ref">, "onCheckedChange"> & VariantProps<(props?: ({
|
|
24
|
+
variant?: "default" | "glass" | "frosted" | "matte" | "liquid" | null | undefined;
|
|
25
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & {
|
|
26
|
+
/** Controlled checked state. */
|
|
27
|
+
checked?: boolean;
|
|
28
|
+
/** Initial checked state for uncontrolled usage. */
|
|
29
|
+
defaultChecked?: boolean;
|
|
30
|
+
/** Callback fired when the checked state changes. */
|
|
31
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
32
|
+
/** Prevents interaction and applies muted styling. */
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
/** Marks the switch as required within a form. */
|
|
35
|
+
required?: boolean;
|
|
36
|
+
/** Form field name submitted with form data. */
|
|
37
|
+
name?: string;
|
|
38
|
+
/** Value submitted with the form when checked. */
|
|
39
|
+
value?: string;
|
|
40
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=switch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../src/components/switch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,QAAA,MAAM,cAAc;;8EA6CnB,CAAA;AAgCD,MAAM,MAAM,WAAW,GAAG,IAAI,CAC5B,KAAK,CAAC,wBAAwB,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,EAC3D,iBAAiB,CAClB,GACC,YAAY,CAAC,OAAO,cAAc,CAAC,GAAG;IACpC,gCAAgC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,oDAAoD;IACpD,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,qDAAqD;IACrD,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IAC5C,sDAAsD;IACtD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAEH,eAAO,MAAM,MAAM;;;IAhBf,gCAAgC;cACtB,OAAO;IACjB,oDAAoD;qBACnC,OAAO;IACxB,qDAAqD;sBACnC,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI;IAC5C,sDAAsD;eAC3C,OAAO;IAClB,kDAAkD;eACvC,OAAO;IAClB,gDAAgD;WACzC,MAAM;IACb,kDAAkD;YAC1C,MAAM;2CAgBhB,CAAA"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as SwitchPrimitive from "@radix-ui/react-switch";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../lib/cn";
|
|
6
|
+
const switchVariants = cva("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border transition-colors duration-fast ease-standard outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent)] focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-60 motion-reduce:transition-none", {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default: "border-transparent bg-neutral-300 shadow-sm data-[state=checked]:bg-[var(--color-accent)] dark:bg-neutral-700",
|
|
10
|
+
glass: [
|
|
11
|
+
"border-white/20 [border-top-color:var(--glass-refraction-top)]",
|
|
12
|
+
"bg-[var(--glass-2-surface)] backdrop-blur-md backdrop-saturate-[180%]",
|
|
13
|
+
"shadow-[0_0_0_1px_rgb(255_255_255_/_0.08)_inset,var(--shadow-soft)]",
|
|
14
|
+
"data-[state=checked]:bg-[var(--color-accent)]/85 data-[state=checked]:border-[var(--color-accent)]/30",
|
|
15
|
+
"dark:border-white/[0.1] dark:data-[state=checked]:bg-[var(--color-accent)]/80"
|
|
16
|
+
].join(" "),
|
|
17
|
+
frosted: [
|
|
18
|
+
"border-white/30 [border-top-color:var(--glass-refraction-top)]",
|
|
19
|
+
"bg-[var(--glass-3-surface)] backdrop-blur-[40px] backdrop-saturate-[200%]",
|
|
20
|
+
"shadow-[0_0_0_1px_rgb(255_255_255_/_0.12)_inset,0_0_12px_rgb(255_255_255_/_0.1)_inset,var(--shadow-soft)]",
|
|
21
|
+
"data-[state=checked]:bg-[var(--color-accent)]/85 data-[state=checked]:border-[var(--color-accent)]/30",
|
|
22
|
+
"dark:border-white/[0.14] dark:data-[state=checked]:bg-[var(--color-accent)]/80"
|
|
23
|
+
].join(" "),
|
|
24
|
+
liquid: [
|
|
25
|
+
"border-white/25 [border-top-color:var(--glass-refraction-top)]",
|
|
26
|
+
"bg-[radial-gradient(circle_at_30%_20%,rgb(255_255_255_/_0.6),transparent_50%),linear-gradient(165deg,rgb(255_255_255_/_0.5),rgb(238_238_238_/_0.3))]",
|
|
27
|
+
"backdrop-blur-xl backdrop-saturate-[180%]",
|
|
28
|
+
"shadow-[0_0_0_1px_rgb(255_255_255_/_0.18)_inset,0_2px_6px_rgb(0_0_0_/_0.06)]",
|
|
29
|
+
"data-[state=checked]:bg-[var(--color-accent)] data-[state=checked]:border-[var(--color-accent)]/30",
|
|
30
|
+
"data-[state=checked]:shadow-[0_0_0_1px_rgb(255_255_255_/_0.2)_inset,0_0_14px_var(--color-accent)/25]",
|
|
31
|
+
"dark:border-white/[0.14] dark:[border-top-color:rgb(255_255_255_/_0.32)]",
|
|
32
|
+
"dark:bg-[linear-gradient(165deg,rgb(255_255_255_/_0.1),rgb(255_255_255_/_0.04))]",
|
|
33
|
+
"dark:data-[state=checked]:bg-[var(--color-accent)]/85"
|
|
34
|
+
].join(" "),
|
|
35
|
+
matte: [
|
|
36
|
+
"border-black/10",
|
|
37
|
+
"bg-[linear-gradient(180deg,rgb(220_220_224),rgb(200_200_206))]",
|
|
38
|
+
"shadow-[0_1px_2px_rgb(0_0_0_/_0.06),0_0_0_1px_rgb(0_0_0_/_0.03)_inset]",
|
|
39
|
+
"data-[state=checked]:bg-[var(--color-accent)]",
|
|
40
|
+
"dark:border-white/[0.14] dark:bg-[linear-gradient(180deg,rgb(55_60_70_/_0.8),rgb(40_44_52_/_0.8))]"
|
|
41
|
+
].join(" ")
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
defaultVariants: {
|
|
45
|
+
variant: "default"
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
const thumbVariants = cva("pointer-events-none block h-5 w-5 translate-x-0.5 rounded-full shadow transition-transform duration-fast ease-standard data-[state=checked]:translate-x-5 motion-reduce:transition-none", {
|
|
49
|
+
variants: {
|
|
50
|
+
variant: {
|
|
51
|
+
default: "bg-white",
|
|
52
|
+
glass: [
|
|
53
|
+
"bg-white border border-white/30 [border-top-color:var(--glass-refraction-top)]",
|
|
54
|
+
"shadow-[0_1px_3px_rgb(0_0_0_/_0.12),0_0_0_1px_rgb(255_255_255_/_0.3)_inset]",
|
|
55
|
+
"dark:bg-white/95 dark:border-white/20"
|
|
56
|
+
].join(" "),
|
|
57
|
+
frosted: [
|
|
58
|
+
"bg-white border border-white/40 [border-top-color:var(--glass-refraction-top)]",
|
|
59
|
+
"shadow-[0_1px_3px_rgb(0_0_0_/_0.14),0_0_0_1px_rgb(255_255_255_/_0.35)_inset,0_0_8px_rgb(255_255_255_/_0.1)_inset]",
|
|
60
|
+
"dark:bg-white/95 dark:border-white/25"
|
|
61
|
+
].join(" "),
|
|
62
|
+
liquid: [
|
|
63
|
+
"bg-white border border-white/40 [border-top-color:var(--glass-refraction-top)]",
|
|
64
|
+
"shadow-[0_2px_6px_rgb(0_0_0_/_0.14),0_0_0_1px_rgb(255_255_255_/_0.4)_inset]",
|
|
65
|
+
"dark:bg-white/95 dark:border-white/25"
|
|
66
|
+
].join(" "),
|
|
67
|
+
matte: "bg-white dark:bg-neutral-200"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
defaultVariants: {
|
|
71
|
+
variant: "default"
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
export const Switch = React.forwardRef(({ className, variant, ...props }, ref) => {
|
|
75
|
+
return (_jsx(SwitchPrimitive.Root, { ref: ref, className: cn(switchVariants({ variant }), className), ...props, children: _jsx(SwitchPrimitive.Thumb, { className: cn(thumbVariants({ variant })) }) }));
|
|
76
|
+
});
|
|
77
|
+
Switch.displayName = "Switch";
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const tableWrapperVariants: (props?: ({
|
|
4
|
+
variant?: "default" | "glass" | "outline" | "ghost" | "matte" | "liquid" | null | undefined;
|
|
5
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
declare const tableRowToneVariants: (props?: ({
|
|
8
|
+
tone?: "default" | "success" | "warning" | "info" | "danger" | null | undefined;
|
|
9
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
|
+
export type TableProps = React.HTMLAttributes<HTMLTableElement> & VariantProps<typeof tableWrapperVariants> & {
|
|
11
|
+
containerClassName?: string;
|
|
12
|
+
striped?: boolean;
|
|
13
|
+
interactive?: boolean;
|
|
14
|
+
stickyHeader?: boolean;
|
|
15
|
+
stickyFirstColumn?: boolean;
|
|
16
|
+
grid?: boolean;
|
|
17
|
+
noWrap?: boolean;
|
|
18
|
+
rowDividers?: boolean;
|
|
19
|
+
layout?: "auto" | "fixed";
|
|
20
|
+
};
|
|
21
|
+
export declare const Table: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableElement> & VariantProps<(props?: ({
|
|
22
|
+
variant?: "default" | "glass" | "outline" | "ghost" | "matte" | "liquid" | null | undefined;
|
|
23
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
24
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & {
|
|
25
|
+
containerClassName?: string;
|
|
26
|
+
striped?: boolean;
|
|
27
|
+
interactive?: boolean;
|
|
28
|
+
stickyHeader?: boolean;
|
|
29
|
+
stickyFirstColumn?: boolean;
|
|
30
|
+
grid?: boolean;
|
|
31
|
+
noWrap?: boolean;
|
|
32
|
+
rowDividers?: boolean;
|
|
33
|
+
layout?: "auto" | "fixed";
|
|
34
|
+
} & React.RefAttributes<HTMLTableElement>>;
|
|
35
|
+
export declare const TableHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
36
|
+
export declare const TableBody: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
37
|
+
export declare const TableFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
38
|
+
export type TableRowTone = NonNullable<VariantProps<typeof tableRowToneVariants>["tone"]>;
|
|
39
|
+
export type TableRowProps = React.HTMLAttributes<HTMLTableRowElement> & {
|
|
40
|
+
tone?: TableRowTone;
|
|
41
|
+
};
|
|
42
|
+
export declare const TableRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & {
|
|
43
|
+
tone?: TableRowTone;
|
|
44
|
+
} & React.RefAttributes<HTMLTableRowElement>>;
|
|
45
|
+
export type TableHeadProps = React.ThHTMLAttributes<HTMLTableCellElement> & {
|
|
46
|
+
align?: "left" | "center" | "right";
|
|
47
|
+
sticky?: boolean;
|
|
48
|
+
};
|
|
49
|
+
export declare const TableHead: React.ForwardRefExoticComponent<React.ThHTMLAttributes<HTMLTableCellElement> & {
|
|
50
|
+
align?: "left" | "center" | "right";
|
|
51
|
+
sticky?: boolean;
|
|
52
|
+
} & React.RefAttributes<HTMLTableCellElement>>;
|
|
53
|
+
export type TableCellProps = React.TdHTMLAttributes<HTMLTableCellElement> & {
|
|
54
|
+
align?: "left" | "center" | "right";
|
|
55
|
+
truncate?: boolean;
|
|
56
|
+
sticky?: boolean;
|
|
57
|
+
};
|
|
58
|
+
export declare const TableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & {
|
|
59
|
+
align?: "left" | "center" | "right";
|
|
60
|
+
truncate?: boolean;
|
|
61
|
+
sticky?: boolean;
|
|
62
|
+
} & React.RefAttributes<HTMLTableCellElement>>;
|
|
63
|
+
export declare const TableCaption: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableCaptionElement> & React.RefAttributes<HTMLTableCaptionElement>>;
|
|
64
|
+
export declare function TableEmpty({ colSpan, children }: {
|
|
65
|
+
colSpan: number;
|
|
66
|
+
children?: React.ReactNode;
|
|
67
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
68
|
+
export {};
|
|
69
|
+
//# sourceMappingURL=table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/components/table.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,QAAA,MAAM,oBAAoB;;;8EAsBxB,CAAA;AA4CF,QAAA,MAAM,oBAAoB;;8EAaxB,CAAA;AAgEF,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,GAC7D,YAAY,CAAC,OAAO,oBAAoB,CAAC,GAAG;IAC1C,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CAC1B,CAAA;AAEH,eAAO,MAAM,KAAK;;;;yBAXO,MAAM;cACjB,OAAO;kBACH,OAAO;mBACN,OAAO;wBACF,OAAO;WACpB,OAAO;aACL,OAAO;kBACF,OAAO;aACZ,MAAM,GAAG,OAAO;0CA4D5B,CAAA;AAID,eAAO,MAAM,WAAW,+HAoBtB,CAAA;AAIF,eAAO,MAAM,SAAS,+HAUpB,CAAA;AAIF,eAAO,MAAM,WAAW,+HAkBtB,CAAA;AAIF,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;AAEzF,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,cAAc,CAAC,mBAAmB,CAAC,GAAG;IACtE,IAAI,CAAC,EAAE,YAAY,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,QAAQ;WAHZ,YAAY;6CA4BpB,CAAA;AAID,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,GAAG;IAC1E,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;IACnC,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,SAAS;YAJZ,MAAM,GAAG,QAAQ,GAAG,OAAO;aAC1B,OAAO;8CA2BjB,CAAA;AAID,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,GAAG;IAC1E,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,SAAS;YALZ,MAAM,GAAG,QAAQ,GAAG,OAAO;eACxB,OAAO;aACT,OAAO;8CA4BjB,CAAA;AAID,eAAO,MAAM,YAAY,+HAUvB,CAAA;AAIF,wBAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAQhG"}
|
|
@@ -0,0 +1,176 @@
|
|
|
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/cn";
|
|
6
|
+
const tableWrapperVariants = cva("relative w-full overflow-auto rounded-xl border", {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default: "border-[var(--color-border)] bg-[var(--color-surface)]",
|
|
10
|
+
glass: "glass-2",
|
|
11
|
+
outline: "border-[var(--color-border)] bg-transparent",
|
|
12
|
+
ghost: "border-transparent bg-transparent",
|
|
13
|
+
liquid: "border-white/25 [border-top-color:rgb(255_255_255_/_0.76)] bg-[radial-gradient(circle_at_16%_10%,rgb(255_255_255_/_0.72),transparent_45%),linear-gradient(165deg,rgb(255_255_255_/_0.62),rgb(236_236_236_/_0.32))] backdrop-blur-xl dark:border-white/[0.14] dark:[border-top-color:rgb(255_255_255_/_0.3)] dark:bg-[linear-gradient(165deg,rgb(255_255_255_/_0.12),rgb(255_255_255_/_0.05))]",
|
|
14
|
+
matte: "border-black/10 bg-[linear-gradient(180deg,rgb(252_252_252),rgb(241_241_243))] dark:border-white/[0.12] dark:bg-[linear-gradient(180deg,rgb(56_60_69_/_0.9),rgb(38_42_50_/_0.9))]"
|
|
15
|
+
},
|
|
16
|
+
size: {
|
|
17
|
+
sm: "text-xs",
|
|
18
|
+
md: "text-sm",
|
|
19
|
+
lg: "text-base"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
defaultVariants: {
|
|
23
|
+
variant: "default",
|
|
24
|
+
size: "md"
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
const tableHeadCellVariants = cva("align-middle font-medium text-neutral-500 dark:text-neutral-400 [&:has([role=checkbox])]:pr-0", {
|
|
28
|
+
variants: {
|
|
29
|
+
size: {
|
|
30
|
+
sm: "h-8 px-2",
|
|
31
|
+
md: "h-10 px-3",
|
|
32
|
+
lg: "h-12 px-4"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
defaultVariants: {
|
|
36
|
+
size: "md"
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
const tableCellVariants = cva("align-middle [&:has([role=checkbox])]:pr-0", {
|
|
40
|
+
variants: {
|
|
41
|
+
size: {
|
|
42
|
+
sm: "p-2",
|
|
43
|
+
md: "p-3",
|
|
44
|
+
lg: "p-4"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
defaultVariants: {
|
|
48
|
+
size: "md"
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
const tableAlignmentVariants = cva("", {
|
|
52
|
+
variants: {
|
|
53
|
+
align: {
|
|
54
|
+
left: "text-left",
|
|
55
|
+
center: "text-center",
|
|
56
|
+
right: "text-right"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
defaultVariants: {
|
|
60
|
+
align: "left"
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
const tableRowToneVariants = cva("", {
|
|
64
|
+
variants: {
|
|
65
|
+
tone: {
|
|
66
|
+
default: "",
|
|
67
|
+
info: "bg-sky-500/[0.04] dark:bg-sky-400/[0.08]",
|
|
68
|
+
success: "bg-emerald-500/[0.04] dark:bg-emerald-400/[0.08]",
|
|
69
|
+
warning: "bg-amber-500/[0.05] dark:bg-amber-400/[0.1]",
|
|
70
|
+
danger: "bg-rose-500/[0.05] dark:bg-rose-400/[0.1]"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
defaultVariants: {
|
|
74
|
+
tone: "default"
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
const TableContext = React.createContext({
|
|
78
|
+
variant: "default",
|
|
79
|
+
size: "md",
|
|
80
|
+
striped: false,
|
|
81
|
+
interactive: true,
|
|
82
|
+
stickyHeader: false,
|
|
83
|
+
stickyFirstColumn: false,
|
|
84
|
+
grid: false,
|
|
85
|
+
noWrap: false,
|
|
86
|
+
rowDividers: true
|
|
87
|
+
});
|
|
88
|
+
function useTableContext() {
|
|
89
|
+
return React.useContext(TableContext);
|
|
90
|
+
}
|
|
91
|
+
function getStickySurfaceClass(variant) {
|
|
92
|
+
switch (variant) {
|
|
93
|
+
case "glass":
|
|
94
|
+
return "bg-[var(--glass-2-surface)]";
|
|
95
|
+
case "liquid":
|
|
96
|
+
return "bg-[var(--color-surface)]/95 backdrop-blur-md";
|
|
97
|
+
case "matte":
|
|
98
|
+
return "bg-[var(--color-surface)]";
|
|
99
|
+
case "ghost":
|
|
100
|
+
return "bg-[var(--color-background)]";
|
|
101
|
+
case "outline":
|
|
102
|
+
return "bg-[var(--color-background)]";
|
|
103
|
+
default:
|
|
104
|
+
return "bg-[var(--color-surface)]";
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function getFirstStickySurfaceClass(variant) {
|
|
108
|
+
switch (variant) {
|
|
109
|
+
case "glass":
|
|
110
|
+
return "first:bg-[var(--glass-2-surface)]";
|
|
111
|
+
case "liquid":
|
|
112
|
+
return "first:bg-[var(--color-surface)]/95 first:backdrop-blur-md";
|
|
113
|
+
case "matte":
|
|
114
|
+
return "first:bg-[var(--color-surface)]";
|
|
115
|
+
case "ghost":
|
|
116
|
+
return "first:bg-[var(--color-background)]";
|
|
117
|
+
case "outline":
|
|
118
|
+
return "first:bg-[var(--color-background)]";
|
|
119
|
+
default:
|
|
120
|
+
return "first:bg-[var(--color-surface)]";
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
export const Table = React.forwardRef(({ className, variant, size, containerClassName, striped = false, interactive = true, stickyHeader = false, stickyFirstColumn = false, grid = false, noWrap = false, rowDividers = true, layout = "auto", ...props }, ref) => {
|
|
124
|
+
const resolvedVariant = variant ?? "default";
|
|
125
|
+
const resolvedSize = size ?? "md";
|
|
126
|
+
return (_jsx(TableContext.Provider, { value: {
|
|
127
|
+
variant: resolvedVariant,
|
|
128
|
+
size: resolvedSize,
|
|
129
|
+
striped,
|
|
130
|
+
interactive,
|
|
131
|
+
stickyHeader,
|
|
132
|
+
stickyFirstColumn,
|
|
133
|
+
grid,
|
|
134
|
+
noWrap,
|
|
135
|
+
rowDividers
|
|
136
|
+
}, children: _jsx("div", { "data-slot": "table-container", className: cn(tableWrapperVariants({ variant: resolvedVariant, size: resolvedSize }), containerClassName), children: _jsx("table", { ref: ref, "data-slot": "table", className: cn("w-full caption-bottom", layout === "fixed" ? "table-fixed" : "table-auto", className), ...props }) }) }));
|
|
137
|
+
});
|
|
138
|
+
Table.displayName = "Table";
|
|
139
|
+
export const TableHeader = React.forwardRef(({ className, ...props }, ref) => {
|
|
140
|
+
const { stickyHeader, variant, rowDividers } = useTableContext();
|
|
141
|
+
return (_jsx("thead", { ref: ref, "data-slot": "table-header", className: cn(rowDividers && "[&_tr]:border-b [&_tr]:border-[var(--color-border)]", stickyHeader && "sticky top-0 z-10", stickyHeader && getStickySurfaceClass(variant), stickyHeader && "backdrop-blur-sm", className), ...props }));
|
|
142
|
+
});
|
|
143
|
+
TableHeader.displayName = "TableHeader";
|
|
144
|
+
export const TableBody = React.forwardRef(({ className, ...props }, ref) => (_jsx("tbody", { ref: ref, "data-slot": "table-body", className: cn("[&_tr:last-child]:border-0", className), ...props })));
|
|
145
|
+
TableBody.displayName = "TableBody";
|
|
146
|
+
export const TableFooter = React.forwardRef(({ className, ...props }, ref) => {
|
|
147
|
+
const { variant } = useTableContext();
|
|
148
|
+
return (_jsx("tfoot", { ref: ref, "data-slot": "table-footer", className: cn("border-t border-[var(--color-border)] font-medium [&>tr]:last:border-b-0", variant === "glass" ? "bg-[var(--glass-1-surface)]" : "bg-[var(--color-surface)]/50", className), ...props }));
|
|
149
|
+
});
|
|
150
|
+
TableFooter.displayName = "TableFooter";
|
|
151
|
+
export const TableRow = React.forwardRef(({ className, tone = "default", ...props }, ref) => {
|
|
152
|
+
const { variant, striped, interactive, rowDividers } = useTableContext();
|
|
153
|
+
return (_jsx("tr", { ref: ref, "data-slot": "table-row", className: cn(rowDividers ? "border-b border-[var(--color-border)]" : "border-0", "transition-colors duration-fast ease-standard motion-reduce:transition-none", "data-[state=selected]:bg-[var(--color-surface)]", striped &&
|
|
154
|
+
(variant === "glass"
|
|
155
|
+
? "even:bg-[var(--glass-1-surface)]/55"
|
|
156
|
+
: "even:bg-[var(--color-surface)]/35"), interactive &&
|
|
157
|
+
(variant === "glass" ? "hover:bg-[var(--glass-1-surface)]" : "hover:bg-[var(--color-surface)]/50"), tableRowToneVariants({ tone }), className), ...props }));
|
|
158
|
+
});
|
|
159
|
+
TableRow.displayName = "TableRow";
|
|
160
|
+
export const TableHead = React.forwardRef(({ className, align = "left", sticky = false, ...props }, ref) => {
|
|
161
|
+
const { size, grid, noWrap, stickyFirstColumn, variant } = useTableContext();
|
|
162
|
+
return (_jsx("th", { ref: ref, "data-slot": "table-head", className: cn(tableHeadCellVariants({ size }), tableAlignmentVariants({ align }), noWrap && "whitespace-nowrap", grid && "border-r border-[var(--color-border)] last:border-r-0", stickyFirstColumn &&
|
|
163
|
+
"first:sticky first:left-0 first:z-[3] first:shadow-[6px_0_10px_-10px_rgb(0_0_0_/_0.35)]", stickyFirstColumn && getFirstStickySurfaceClass(variant), sticky && "sticky left-0 z-[4] shadow-[6px_0_10px_-10px_rgb(0_0_0_/_0.35)]", sticky && getStickySurfaceClass(variant), className), ...props }));
|
|
164
|
+
});
|
|
165
|
+
TableHead.displayName = "TableHead";
|
|
166
|
+
export const TableCell = React.forwardRef(({ className, align = "left", truncate = false, sticky = false, ...props }, ref) => {
|
|
167
|
+
const { size, grid, noWrap, stickyFirstColumn, variant } = useTableContext();
|
|
168
|
+
return (_jsx("td", { ref: ref, "data-slot": "table-cell", className: cn(tableCellVariants({ size }), tableAlignmentVariants({ align }), noWrap && "whitespace-nowrap", truncate && "max-w-[18rem] truncate", grid && "border-r border-[var(--color-border)] last:border-r-0", stickyFirstColumn &&
|
|
169
|
+
"first:sticky first:left-0 first:z-[1] first:shadow-[6px_0_10px_-10px_rgb(0_0_0_/_0.28)]", stickyFirstColumn && getFirstStickySurfaceClass(variant), sticky && "sticky left-0 z-[2] shadow-[6px_0_10px_-10px_rgb(0_0_0_/_0.28)]", sticky && getStickySurfaceClass(variant), className), ...props }));
|
|
170
|
+
});
|
|
171
|
+
TableCell.displayName = "TableCell";
|
|
172
|
+
export const TableCaption = React.forwardRef(({ className, ...props }, ref) => (_jsx("caption", { ref: ref, "data-slot": "table-caption", className: cn("mt-4 text-sm text-neutral-500", className), ...props })));
|
|
173
|
+
TableCaption.displayName = "TableCaption";
|
|
174
|
+
export function TableEmpty({ colSpan, children }) {
|
|
175
|
+
return (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: colSpan, align: "center", className: "h-24 text-neutral-500 dark:text-neutral-400", children: children ?? "No results." }) }));
|
|
176
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
3
|
+
import { type VariantProps } from "class-variance-authority";
|
|
4
|
+
declare const tabsListVariants: (props?: ({
|
|
5
|
+
variant?: "default" | "glass" | "outline" | "ghost" | "matte" | "liquid" | null | undefined;
|
|
6
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
declare const tabsTriggerVariants: (props?: ({
|
|
9
|
+
variant?: "default" | "glass" | "outline" | "ghost" | "matte" | "liquid" | null | undefined;
|
|
10
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
11
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
12
|
+
declare const tabsContentVariants: (props?: ({
|
|
13
|
+
variant?: "default" | "glass" | "outline" | "ghost" | "matte" | "liquid" | null | undefined;
|
|
14
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
15
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
16
|
+
export type TabsProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.Root>;
|
|
17
|
+
export declare const Tabs: React.ForwardRefExoticComponent<TabsPrimitive.TabsProps & React.RefAttributes<HTMLDivElement>>;
|
|
18
|
+
export type TabsListProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.List> & VariantProps<typeof tabsListVariants>;
|
|
19
|
+
export declare const TabsList: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsListProps & React.RefAttributes<HTMLDivElement>, "ref"> & VariantProps<(props?: ({
|
|
20
|
+
variant?: "default" | "glass" | "outline" | "ghost" | "matte" | "liquid" | null | undefined;
|
|
21
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
22
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLDivElement>>;
|
|
23
|
+
export type TabsTriggerProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger> & VariantProps<typeof tabsTriggerVariants>;
|
|
24
|
+
export declare const TabsTrigger: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & VariantProps<(props?: ({
|
|
25
|
+
variant?: "default" | "glass" | "outline" | "ghost" | "matte" | "liquid" | null | undefined;
|
|
26
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
27
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLButtonElement>>;
|
|
28
|
+
export type TabsContentProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content> & VariantProps<typeof tabsContentVariants>;
|
|
29
|
+
export declare const TabsContent: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & VariantProps<(props?: ({
|
|
30
|
+
variant?: "default" | "glass" | "outline" | "ghost" | "matte" | "liquid" | null | undefined;
|
|
31
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
32
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLDivElement>>;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=tabs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../src/components/tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,aAAa,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,QAAA,MAAM,gBAAgB;;;8EAyBrB,CAAA;AAED,QAAA,MAAM,mBAAmB;;;8EA6BxB,CAAA;AAED,QAAA,MAAM,mBAAmB;;;8EAyBxB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,aAAa,CAAC,IAAI,CAAC,CAAA;AAEjF,eAAO,MAAM,IAAI,gGAAqB,CAAA;AAEtC,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,aAAa,CAAC,IAAI,CAAC,GACnF,YAAY,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAEvC,eAAO,MAAM,QAAQ;;;sHAQpB,CAAA;AAID,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,aAAa,CAAC,OAAO,CAAC,GACzF,YAAY,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAE1C,eAAO,MAAM,WAAW;;;yHAStB,CAAA;AAIF,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,aAAa,CAAC,OAAO,CAAC,GACzF,YAAY,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAE1C,eAAO,MAAM,WAAW;;;sHAStB,CAAA"}
|