@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,89 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Command as CommandPrimitive } from "cmdk";
|
|
3
|
+
import { type VariantProps } from "class-variance-authority";
|
|
4
|
+
declare const commandVariants: (props?: ({
|
|
5
|
+
variant?: "default" | "glass" | "frosted" | "outline" | "ghost" | "matte" | "liquid" | null | undefined;
|
|
6
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
export type CommandProps = React.ComponentPropsWithoutRef<typeof CommandPrimitive> & VariantProps<typeof commandVariants>;
|
|
9
|
+
export declare const Command: React.ForwardRefExoticComponent<Omit<{
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
12
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
13
|
+
} & {
|
|
14
|
+
asChild?: boolean;
|
|
15
|
+
}, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
|
16
|
+
label?: string;
|
|
17
|
+
shouldFilter?: boolean;
|
|
18
|
+
filter?: (value: string, search: string, keywords?: string[]) => number;
|
|
19
|
+
defaultValue?: string;
|
|
20
|
+
value?: string;
|
|
21
|
+
onValueChange?: (value: string) => void;
|
|
22
|
+
loop?: boolean;
|
|
23
|
+
disablePointerSelection?: boolean;
|
|
24
|
+
vimBindings?: boolean;
|
|
25
|
+
} & React.RefAttributes<HTMLDivElement>, "ref"> & VariantProps<(props?: ({
|
|
26
|
+
variant?: "default" | "glass" | "frosted" | "outline" | "ghost" | "matte" | "liquid" | null | undefined;
|
|
27
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
28
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLDivElement>>;
|
|
29
|
+
export declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof React.InputHTMLAttributes<HTMLInputElement>> & {
|
|
30
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
31
|
+
} & {
|
|
32
|
+
asChild?: boolean;
|
|
33
|
+
}, "key" | "asChild" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "onChange" | "type" | "value"> & {
|
|
34
|
+
value?: string;
|
|
35
|
+
onValueChange?: (search: string) => void;
|
|
36
|
+
} & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
37
|
+
export declare const CommandList: React.ForwardRefExoticComponent<Omit<{
|
|
38
|
+
children?: React.ReactNode;
|
|
39
|
+
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
40
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
41
|
+
} & {
|
|
42
|
+
asChild?: boolean;
|
|
43
|
+
}, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
|
44
|
+
label?: string;
|
|
45
|
+
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
46
|
+
export declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
|
|
47
|
+
children?: React.ReactNode;
|
|
48
|
+
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
49
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
50
|
+
} & {
|
|
51
|
+
asChild?: boolean;
|
|
52
|
+
}, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
53
|
+
export declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
|
|
54
|
+
children?: React.ReactNode;
|
|
55
|
+
} & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
56
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
57
|
+
} & {
|
|
58
|
+
asChild?: boolean;
|
|
59
|
+
}, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild">, "heading" | "value"> & {
|
|
60
|
+
heading?: React.ReactNode;
|
|
61
|
+
value?: string;
|
|
62
|
+
forceMount?: boolean;
|
|
63
|
+
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
64
|
+
export declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
65
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
66
|
+
} & {
|
|
67
|
+
asChild?: boolean;
|
|
68
|
+
}, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
|
69
|
+
alwaysRender?: boolean;
|
|
70
|
+
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
71
|
+
export declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
|
|
72
|
+
children?: React.ReactNode;
|
|
73
|
+
} & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
74
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
75
|
+
} & {
|
|
76
|
+
asChild?: boolean;
|
|
77
|
+
}, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild">, "onSelect" | "value" | "disabled"> & {
|
|
78
|
+
disabled?: boolean;
|
|
79
|
+
onSelect?: (value: string) => void;
|
|
80
|
+
value?: string;
|
|
81
|
+
keywords?: string[];
|
|
82
|
+
forceMount?: boolean;
|
|
83
|
+
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
84
|
+
export declare const CommandShortcut: {
|
|
85
|
+
({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>): import("react/jsx-runtime").JSX.Element;
|
|
86
|
+
displayName: string;
|
|
87
|
+
};
|
|
88
|
+
export {};
|
|
89
|
+
//# sourceMappingURL=command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/components/command.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,MAAM,CAAA;AAClD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAKjE,QAAA,MAAM,eAAe;;;8EA6BpB,CAAA;AA6FD,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,gBAAgB,CAAC,GAChF,YAAY,CAAC,OAAO,eAAe,CAAC,CAAA;AAEtC,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;sHAgBlB,CAAA;AAIF,eAAO,MAAM,YAAY;;;;;;;0FAqBvB,CAAA;AAIF,eAAO,MAAM,WAAW;;;;;;;;sFAStB,CAAA;AAIF,eAAO,MAAM,YAAY;;;;;;uJAKvB,CAAA;AAIF,eAAO,MAAM,YAAY;;;;;;;;;;sFAmBvB,CAAA;AAIF,eAAO,MAAM,gBAAgB;;;;;;sFAS3B,CAAA;AAIF,eAAO,MAAM,WAAW;;;;;;;;;;;;sFAatB,CAAA;AAIF,eAAO,MAAM,eAAe;8BAA6B,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;;CAE7F,CAAA"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Command as CommandPrimitive } from "cmdk";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
import { Search } from "lucide-react";
|
|
7
|
+
import { cn } from "../lib/cn";
|
|
8
|
+
const commandVariants = cva("flex h-full w-full flex-col overflow-hidden rounded-xl border transition-[background-color,border-color,box-shadow] duration-fast ease-standard motion-reduce:transition-none", {
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: "border-[var(--color-border)] bg-[var(--color-surface)] text-[var(--color-foreground)] shadow-[0_12px_24px_-20px_rgb(2_6_23_/_0.28)] dark:shadow-[0_12px_24px_-18px_rgb(0_0_0_/_0.45)]",
|
|
12
|
+
glass: "bg-[var(--glass-2-surface)] backdrop-blur-xl backdrop-saturate-[180%] border-white/15 [border-top-color:var(--glass-refraction-top)] text-[var(--color-foreground)] shadow-[0_0_0_1px_rgb(255_255_255_/_0.08)_inset,var(--shadow-glass-sm)] dark:border-white/[0.1] dark:shadow-[0_0_0_1px_rgb(255_255_255_/_0.05)_inset,0_8px_24px_rgb(0_0_0_/_0.35)]",
|
|
13
|
+
frosted: "bg-[var(--glass-3-surface)] backdrop-blur-[40px] backdrop-saturate-[200%] border-white/25 [border-top-color:var(--glass-refraction-top)] text-[var(--color-foreground)] shadow-[0_0_0_1px_rgb(255_255_255_/_0.12)_inset,0_0_20px_rgb(255_255_255_/_0.1)_inset,var(--shadow-glass-md)] dark:border-white/[0.14] dark:shadow-[0_0_0_1px_rgb(255_255_255_/_0.07)_inset,0_0_20px_rgb(255_255_255_/_0.03)_inset,0_8px_24px_rgb(0_0_0_/_0.4)]",
|
|
14
|
+
outline: "border-[var(--color-border)] bg-transparent text-[var(--color-foreground)]",
|
|
15
|
+
ghost: "border-transparent bg-transparent text-[var(--color-foreground)]",
|
|
16
|
+
liquid: "border-white/25 [border-top-color:var(--glass-refraction-top)] bg-[radial-gradient(circle_at_16%_10%,rgb(255_255_255_/_0.74),transparent_45%),linear-gradient(162deg,rgb(255_255_255_/_0.62),rgb(236_236_236_/_0.35))] text-[var(--color-foreground)] backdrop-blur-xl backdrop-saturate-[180%] shadow-[0_0_0_1px_rgb(255_255_255_/_0.2)_inset,var(--shadow-glass-md)] dark:border-white/[0.14] dark:bg-[linear-gradient(162deg,rgb(255_255_255_/_0.12),rgb(255_255_255_/_0.05))] dark:shadow-[0_0_0_1px_rgb(255_255_255_/_0.06)_inset,0_12px_36px_rgb(0_0_0_/_0.4)]",
|
|
17
|
+
matte: "border-black/10 bg-[linear-gradient(180deg,rgb(250_250_250),rgb(236_236_238))] text-[var(--color-foreground)] dark:border-white/[0.14] dark:bg-[linear-gradient(180deg,rgb(55_60_70_/_0.9),rgb(37_42_50_/_0.9))]"
|
|
18
|
+
},
|
|
19
|
+
size: {
|
|
20
|
+
sm: "text-xs",
|
|
21
|
+
md: "text-sm",
|
|
22
|
+
lg: "text-base"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: {
|
|
26
|
+
variant: "default",
|
|
27
|
+
size: "md"
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
const CommandContext = React.createContext({
|
|
31
|
+
variant: "default",
|
|
32
|
+
size: "md"
|
|
33
|
+
});
|
|
34
|
+
function useCommandContext() {
|
|
35
|
+
return React.useContext(CommandContext);
|
|
36
|
+
}
|
|
37
|
+
const commandInputWrapperVariants = cva("flex items-center border-b transition-[background-color,border-color] duration-fast ease-standard focus-within:bg-[var(--color-foreground)]/[0.03] dark:focus-within:bg-white/[0.05]", {
|
|
38
|
+
variants: {
|
|
39
|
+
variant: {
|
|
40
|
+
default: "border-[var(--color-border)]",
|
|
41
|
+
glass: "border-white/12 bg-[var(--glass-1-surface)]/60",
|
|
42
|
+
frosted: "border-white/16 bg-[var(--glass-2-surface)]/70",
|
|
43
|
+
outline: "border-[var(--color-border)]/80 bg-transparent",
|
|
44
|
+
ghost: "border-[var(--color-border)]/50 bg-transparent",
|
|
45
|
+
liquid: "border-white/20 bg-[linear-gradient(180deg,rgb(255_255_255_/_0.35),rgb(255_255_255_/_0.12))] dark:border-white/[0.12] dark:bg-white/[0.06]",
|
|
46
|
+
matte: "border-black/10 bg-black/[0.03] dark:border-white/[0.14] dark:bg-white/[0.05]"
|
|
47
|
+
},
|
|
48
|
+
size: {
|
|
49
|
+
sm: "px-2",
|
|
50
|
+
md: "px-3",
|
|
51
|
+
lg: "px-4"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
defaultVariants: {
|
|
55
|
+
variant: "default",
|
|
56
|
+
size: "md"
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
const commandInputVariants = cva("w-full rounded-md bg-transparent outline-none placeholder:text-neutral-500 disabled:cursor-not-allowed disabled:opacity-50", {
|
|
60
|
+
variants: {
|
|
61
|
+
size: {
|
|
62
|
+
sm: "h-8 py-2 text-xs",
|
|
63
|
+
md: "h-10 py-3 text-sm",
|
|
64
|
+
lg: "h-12 py-3 text-base"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
defaultVariants: {
|
|
68
|
+
size: "md"
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
const commandItemVariants = cva("relative flex cursor-default select-none items-center gap-2 rounded-lg px-2.5 outline-none transition-[background-color,color,border-color,box-shadow] duration-fast ease-standard data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", {
|
|
72
|
+
variants: {
|
|
73
|
+
variant: {
|
|
74
|
+
default: "data-[selected=true]:bg-[var(--color-foreground)]/[0.08] data-[selected=true]:text-[var(--color-foreground)] dark:data-[selected=true]:bg-white/[0.12]",
|
|
75
|
+
glass: "data-[selected=true]:border data-[selected=true]:border-white/18 data-[selected=true]:bg-white/40 data-[selected=true]:text-[var(--color-foreground)] dark:data-[selected=true]:border-white/[0.12] dark:data-[selected=true]:bg-white/[0.14]",
|
|
76
|
+
frosted: "data-[selected=true]:border data-[selected=true]:border-white/22 data-[selected=true]:bg-white/50 data-[selected=true]:text-[var(--color-foreground)] dark:data-[selected=true]:border-white/[0.14] dark:data-[selected=true]:bg-white/[0.16]",
|
|
77
|
+
outline: "data-[selected=true]:border data-[selected=true]:border-[var(--color-border)] data-[selected=true]:bg-[var(--color-surface)] dark:data-[selected=true]:border-white/20 dark:data-[selected=true]:bg-white/[0.06]",
|
|
78
|
+
ghost: "data-[selected=true]:bg-[var(--color-foreground)]/[0.07] dark:data-[selected=true]:bg-white/[0.1]",
|
|
79
|
+
liquid: "data-[selected=true]:border data-[selected=true]:border-white/25 data-[selected=true]:bg-[linear-gradient(165deg,rgb(255_255_255_/_0.6),rgb(242_242_242_/_0.34))] data-[selected=true]:shadow-[0_0_0_1px_rgb(255_255_255_/_0.2)_inset] dark:data-[selected=true]:border-white/[0.14] dark:data-[selected=true]:bg-[linear-gradient(165deg,rgb(255_255_255_/_0.14),rgb(255_255_255_/_0.06))]",
|
|
80
|
+
matte: "data-[selected=true]:bg-black/[0.06] dark:data-[selected=true]:bg-white/[0.11]"
|
|
81
|
+
},
|
|
82
|
+
size: {
|
|
83
|
+
sm: "py-1 text-xs",
|
|
84
|
+
md: "py-1.5 text-sm",
|
|
85
|
+
lg: "py-2 text-base"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
defaultVariants: {
|
|
89
|
+
variant: "default",
|
|
90
|
+
size: "md"
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
export const Command = React.forwardRef(({ className, variant, size, ...props }, ref) => {
|
|
94
|
+
const resolvedVariant = variant ?? "default";
|
|
95
|
+
const resolvedSize = size ?? "md";
|
|
96
|
+
return (_jsx(CommandContext.Provider, { value: { variant: resolvedVariant, size: resolvedSize }, children: _jsx(CommandPrimitive, { ref: ref, className: cn(commandVariants({ variant: resolvedVariant, size: resolvedSize }), className), ...props }) }));
|
|
97
|
+
});
|
|
98
|
+
Command.displayName = "Command";
|
|
99
|
+
export const CommandInput = React.forwardRef(({ className, ...props }, ref) => {
|
|
100
|
+
const { size, variant } = useCommandContext();
|
|
101
|
+
return (_jsxs("div", { className: cn(commandInputWrapperVariants({ size, variant })), "cmdk-input-wrapper": "", children: [_jsx(Search, { className: cn("mr-2 shrink-0 text-neutral-500", size === "sm" ? "h-3.5 w-3.5" : "h-4 w-4") }), _jsx(CommandPrimitive.Input, { ref: ref, className: cn(commandInputVariants({ size }), className), ...props })] }));
|
|
102
|
+
});
|
|
103
|
+
CommandInput.displayName = "CommandInput";
|
|
104
|
+
export const CommandList = React.forwardRef(({ className, ...props }, ref) => (_jsx(CommandPrimitive.List, { ref: ref, className: cn("max-h-[320px] overflow-y-auto overflow-x-hidden p-1.5", className), ...props })));
|
|
105
|
+
CommandList.displayName = "CommandList";
|
|
106
|
+
export const CommandEmpty = React.forwardRef(({ className, ...props }, ref) => (_jsx(CommandPrimitive.Empty, { ref: ref, className: cn("py-8 text-center text-sm", className), ...props })));
|
|
107
|
+
CommandEmpty.displayName = "CommandEmpty";
|
|
108
|
+
export const CommandGroup = React.forwardRef(({ className, ...props }, ref) => {
|
|
109
|
+
const { variant } = useCommandContext();
|
|
110
|
+
return (_jsx(CommandPrimitive.Group, { ref: ref, className: cn("overflow-hidden p-1 text-[var(--color-foreground)] [&_[cmdk-group-heading]]:px-2.5 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-[11px] [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:uppercase [&_[cmdk-group-heading]]:tracking-[0.08em]", variant === "glass" || variant === "liquid" || variant === "frosted"
|
|
111
|
+
? "[&_[cmdk-group-heading]]:text-neutral-500 dark:[&_[cmdk-group-heading]]:text-neutral-300"
|
|
112
|
+
: "[&_[cmdk-group-heading]]:text-neutral-500 dark:[&_[cmdk-group-heading]]:text-neutral-400", className), ...props }));
|
|
113
|
+
});
|
|
114
|
+
CommandGroup.displayName = "CommandGroup";
|
|
115
|
+
export const CommandSeparator = React.forwardRef(({ className, ...props }, ref) => (_jsx(CommandPrimitive.Separator, { ref: ref, className: cn("my-1 h-px bg-[var(--color-border)]", className), ...props })));
|
|
116
|
+
CommandSeparator.displayName = "CommandSeparator";
|
|
117
|
+
export const CommandItem = React.forwardRef(({ className, ...props }, ref) => {
|
|
118
|
+
const { size, variant } = useCommandContext();
|
|
119
|
+
return (_jsx(CommandPrimitive.Item, { ref: ref, className: cn(commandItemVariants({ size, variant }), className), ...props }));
|
|
120
|
+
});
|
|
121
|
+
CommandItem.displayName = "CommandItem";
|
|
122
|
+
export const CommandShortcut = ({ className, ...props }) => (_jsx("span", { className: cn("ml-auto text-[11px] tracking-[0.08em] text-neutral-400", className), ...props }));
|
|
123
|
+
CommandShortcut.displayName = "CommandShortcut";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const counterVariants: (props?: ({
|
|
4
|
+
variant?: "default" | "glass" | "outline" | "ghost" | null | undefined;
|
|
5
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
export type CounterProps = Omit<React.HTMLAttributes<HTMLSpanElement>, "children"> & VariantProps<typeof counterVariants> & {
|
|
8
|
+
value: number;
|
|
9
|
+
max?: number;
|
|
10
|
+
};
|
|
11
|
+
export declare const Counter: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLSpanElement>, "children"> & VariantProps<(props?: ({
|
|
12
|
+
variant?: "default" | "glass" | "outline" | "ghost" | null | undefined;
|
|
13
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
14
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & {
|
|
15
|
+
value: number;
|
|
16
|
+
max?: number;
|
|
17
|
+
} & React.RefAttributes<HTMLSpanElement>>;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=counter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"counter.d.ts","sourceRoot":"","sources":["../../src/components/counter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,QAAA,MAAM,eAAe;;;8EAuBpB,CAAA;AAED,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,UAAU,CAAC,GAChF,YAAY,CAAC,OAAO,eAAe,CAAC,GAAG;IACrC,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAEH,eAAO,MAAM,OAAO;;;;WAJT,MAAM;UACP,MAAM;yCAaf,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx } 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 counterVariants = cva("inline-flex items-center justify-center rounded-full border font-medium tabular-nums transition-[background-color,color,border-color] duration-fast ease-standard motion-reduce:transition-none", {
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default: "border-[var(--color-border)] bg-[var(--color-surface)] text-[var(--color-foreground)] dark:border-white/20",
|
|
9
|
+
glass: "border-white/20 [border-top-color:var(--glass-refraction-top)] bg-[var(--glass-1-surface)] text-[var(--color-foreground)] dark:border-white/[0.14] dark:bg-white/[0.05]",
|
|
10
|
+
outline: "border-[var(--color-border)] bg-transparent text-[var(--color-foreground)] dark:border-white/20",
|
|
11
|
+
ghost: "border-transparent bg-[var(--color-foreground)]/[0.08] text-[var(--color-foreground)] dark:bg-white/[0.1]"
|
|
12
|
+
},
|
|
13
|
+
size: {
|
|
14
|
+
sm: "h-5 min-w-5 px-1.5 text-[10px]",
|
|
15
|
+
md: "h-6 min-w-6 px-2 text-xs",
|
|
16
|
+
lg: "h-7 min-w-7 px-2.5 text-sm"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
defaultVariants: {
|
|
20
|
+
variant: "default",
|
|
21
|
+
size: "md"
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
export const Counter = React.forwardRef(({ className, variant, size, value, max = 99, ...props }, ref) => {
|
|
25
|
+
const displayValue = value > max ? `${max}+` : `${value}`;
|
|
26
|
+
return (_jsx("span", { ref: ref, className: cn(counterVariants({ variant, size }), className), ...props, children: displayValue }));
|
|
27
|
+
});
|
|
28
|
+
Counter.displayName = "Counter";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type TableProps, type TableRowTone } from "./table";
|
|
3
|
+
type DataTableAccessor<TData> = keyof TData | ((row: TData) => unknown);
|
|
4
|
+
export type DataTableColumn<TData> = {
|
|
5
|
+
id: string;
|
|
6
|
+
header: React.ReactNode;
|
|
7
|
+
accessor: DataTableAccessor<TData>;
|
|
8
|
+
cell?: (context: {
|
|
9
|
+
row: TData;
|
|
10
|
+
value: unknown;
|
|
11
|
+
rowId: string;
|
|
12
|
+
}) => React.ReactNode;
|
|
13
|
+
sortable?: boolean;
|
|
14
|
+
searchable?: boolean;
|
|
15
|
+
canHide?: boolean;
|
|
16
|
+
hidden?: boolean;
|
|
17
|
+
align?: "left" | "center" | "right";
|
|
18
|
+
className?: string;
|
|
19
|
+
headerClassName?: string;
|
|
20
|
+
};
|
|
21
|
+
export type DataTableProps<TData extends Record<string, unknown>> = {
|
|
22
|
+
columns: DataTableColumn<TData>[];
|
|
23
|
+
data: TData[];
|
|
24
|
+
getRowId?: (row: TData, index: number) => string;
|
|
25
|
+
rowTone?: (row: TData) => TableRowTone;
|
|
26
|
+
onRowClick?: (row: TData) => void;
|
|
27
|
+
onSelectionChange?: (rows: TData[]) => void;
|
|
28
|
+
searchable?: boolean;
|
|
29
|
+
searchPlaceholder?: string;
|
|
30
|
+
selectable?: boolean;
|
|
31
|
+
pageSize?: number;
|
|
32
|
+
pageSizeOptions?: number[];
|
|
33
|
+
emptyMessage?: string;
|
|
34
|
+
className?: string;
|
|
35
|
+
} & Omit<TableProps, "children">;
|
|
36
|
+
export declare function DataTable<TData extends Record<string, unknown>>({ columns, data, getRowId, rowTone, onRowClick, onSelectionChange, searchable, searchPlaceholder, selectable, pageSize, pageSizeOptions, emptyMessage, className, ...tableProps }: DataTableProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=data-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-table.d.ts","sourceRoot":"","sources":["../../src/components/data-table.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAe9B,OAAO,EAQL,KAAK,UAAU,EACf,KAAK,YAAY,EAClB,MAAM,SAAS,CAAA;AAKhB,KAAK,iBAAiB,CAAC,KAAK,IAAI,MAAM,KAAK,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,KAAK,OAAO,CAAC,CAAA;AAEvE,MAAM,MAAM,eAAe,CAAC,KAAK,IAAI;IACnC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,QAAQ,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAA;IAClC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,GAAG,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,KAAK,CAAC,SAAS,CAAA;IAClF,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;IACnC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,cAAc,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IAClE,OAAO,EAAE,eAAe,CAAC,KAAK,CAAC,EAAE,CAAA;IACjC,IAAI,EAAE,KAAK,EAAE,CAAA;IACb,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IAChD,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,YAAY,CAAA;IACtC,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAA;IACjC,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,IAAI,CAAA;IAC3C,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,GAAG,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;AAsDhC,wBAAgB,SAAS,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAC/D,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,UAAU,EACV,iBAAiB,EACjB,UAAiB,EACjB,iBAAoC,EACpC,UAAkB,EAClB,QAAa,EACb,eAA8B,EAC9B,YAA4B,EAC5B,SAAS,EACT,GAAG,UAAU,EACd,EAAE,cAAc,CAAC,KAAK,CAAC,2CAmVvB"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { ArrowDown, ArrowUp, ArrowUpDown, ChevronLeft, ChevronRight, Columns3 } from "lucide-react";
|
|
5
|
+
import { Button } from "./button";
|
|
6
|
+
import { Checkbox } from "./checkbox";
|
|
7
|
+
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "./dropdown-menu";
|
|
8
|
+
import { Input } from "./input";
|
|
9
|
+
import { Select } from "./select";
|
|
10
|
+
import { Table, TableBody, TableCell, TableEmpty, TableHead, TableHeader, TableRow } from "./table";
|
|
11
|
+
import { cn } from "../lib/cn";
|
|
12
|
+
function toComparable(value) {
|
|
13
|
+
if (typeof value === "number") {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
if (value instanceof Date) {
|
|
17
|
+
return value.getTime();
|
|
18
|
+
}
|
|
19
|
+
if (typeof value === "boolean") {
|
|
20
|
+
return value ? 1 : 0;
|
|
21
|
+
}
|
|
22
|
+
return String(value ?? "").toLowerCase();
|
|
23
|
+
}
|
|
24
|
+
function resolveColumnValue(row, accessor) {
|
|
25
|
+
if (typeof accessor === "function") {
|
|
26
|
+
return accessor(row);
|
|
27
|
+
}
|
|
28
|
+
return row[accessor];
|
|
29
|
+
}
|
|
30
|
+
function stringValue(value) {
|
|
31
|
+
if (typeof value === "string") {
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
35
|
+
return `${value}`;
|
|
36
|
+
}
|
|
37
|
+
if (value instanceof Date) {
|
|
38
|
+
return value.toISOString();
|
|
39
|
+
}
|
|
40
|
+
if (value == null) {
|
|
41
|
+
return "";
|
|
42
|
+
}
|
|
43
|
+
return String(value);
|
|
44
|
+
}
|
|
45
|
+
export function DataTable({ columns, data, getRowId, rowTone, onRowClick, onSelectionChange, searchable = true, searchPlaceholder = "Search rows...", selectable = false, pageSize = 10, pageSizeOptions = [10, 20, 50], emptyMessage = "No results.", className, ...tableProps }) {
|
|
46
|
+
const [query, setQuery] = React.useState("");
|
|
47
|
+
const [currentPage, setCurrentPage] = React.useState(1);
|
|
48
|
+
const [rowsPerPage, setRowsPerPage] = React.useState(pageSize);
|
|
49
|
+
const [selectedRowIds, setSelectedRowIds] = React.useState({});
|
|
50
|
+
const [sort, setSort] = React.useState(null);
|
|
51
|
+
const [columnVisibility, setColumnVisibility] = React.useState(() => {
|
|
52
|
+
return Object.fromEntries(columns.map((column) => [column.id, column.hidden !== true]));
|
|
53
|
+
});
|
|
54
|
+
React.useEffect(() => {
|
|
55
|
+
setColumnVisibility((prev) => {
|
|
56
|
+
const next = {};
|
|
57
|
+
for (const column of columns) {
|
|
58
|
+
if (Object.prototype.hasOwnProperty.call(prev, column.id)) {
|
|
59
|
+
next[column.id] = prev[column.id];
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
next[column.id] = column.hidden !== true;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return next;
|
|
66
|
+
});
|
|
67
|
+
}, [columns]);
|
|
68
|
+
const rows = React.useMemo(() => {
|
|
69
|
+
return data.map((entry, index) => ({
|
|
70
|
+
id: getRowId ? getRowId(entry, index) : `${index}`,
|
|
71
|
+
data: entry
|
|
72
|
+
}));
|
|
73
|
+
}, [data, getRowId]);
|
|
74
|
+
const visibleColumns = React.useMemo(() => {
|
|
75
|
+
return columns.filter((column) => columnVisibility[column.id] !== false);
|
|
76
|
+
}, [columnVisibility, columns]);
|
|
77
|
+
const filteredRows = React.useMemo(() => {
|
|
78
|
+
if (!searchable || query.trim().length === 0) {
|
|
79
|
+
return rows;
|
|
80
|
+
}
|
|
81
|
+
const searchQuery = query.toLowerCase();
|
|
82
|
+
return rows.filter((row) => {
|
|
83
|
+
return visibleColumns.some((column) => {
|
|
84
|
+
if (column.searchable === false) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
const raw = resolveColumnValue(row.data, column.accessor);
|
|
88
|
+
return stringValue(raw).toLowerCase().includes(searchQuery);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
}, [query, rows, searchable, visibleColumns]);
|
|
92
|
+
const sortedRows = React.useMemo(() => {
|
|
93
|
+
if (!sort) {
|
|
94
|
+
return filteredRows;
|
|
95
|
+
}
|
|
96
|
+
const column = columns.find((item) => item.id === sort.id);
|
|
97
|
+
if (!column || column.sortable === false) {
|
|
98
|
+
return filteredRows;
|
|
99
|
+
}
|
|
100
|
+
return [...filteredRows].sort((a, b) => {
|
|
101
|
+
const left = toComparable(resolveColumnValue(a.data, column.accessor));
|
|
102
|
+
const right = toComparable(resolveColumnValue(b.data, column.accessor));
|
|
103
|
+
if (left === right) {
|
|
104
|
+
return 0;
|
|
105
|
+
}
|
|
106
|
+
if (left > right) {
|
|
107
|
+
return sort.direction === "asc" ? 1 : -1;
|
|
108
|
+
}
|
|
109
|
+
return sort.direction === "asc" ? -1 : 1;
|
|
110
|
+
});
|
|
111
|
+
}, [columns, filteredRows, sort]);
|
|
112
|
+
const totalPages = Math.max(1, Math.ceil(sortedRows.length / rowsPerPage));
|
|
113
|
+
React.useEffect(() => {
|
|
114
|
+
if (currentPage > totalPages) {
|
|
115
|
+
setCurrentPage(totalPages);
|
|
116
|
+
}
|
|
117
|
+
}, [currentPage, totalPages]);
|
|
118
|
+
React.useEffect(() => {
|
|
119
|
+
setCurrentPage(1);
|
|
120
|
+
}, [query, rowsPerPage, columnVisibility]);
|
|
121
|
+
const start = (currentPage - 1) * rowsPerPage;
|
|
122
|
+
const pageRows = sortedRows.slice(start, start + rowsPerPage);
|
|
123
|
+
const pageRowIds = pageRows.map((row) => row.id);
|
|
124
|
+
const selectedCount = Object.values(selectedRowIds).filter(Boolean).length;
|
|
125
|
+
const allPageSelected = pageRowIds.length > 0 && pageRowIds.every((id) => selectedRowIds[id]);
|
|
126
|
+
const somePageSelected = pageRowIds.some((id) => selectedRowIds[id]) && !allPageSelected;
|
|
127
|
+
React.useEffect(() => {
|
|
128
|
+
if (!onSelectionChange) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const selectedRows = rows.filter((row) => selectedRowIds[row.id]).map((row) => row.data);
|
|
132
|
+
onSelectionChange(selectedRows);
|
|
133
|
+
}, [onSelectionChange, rows, selectedRowIds]);
|
|
134
|
+
function toggleSort(columnId, sortable) {
|
|
135
|
+
if (sortable === false) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
setSort((current) => {
|
|
139
|
+
if (!current || current.id !== columnId) {
|
|
140
|
+
return { id: columnId, direction: "asc" };
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
id: columnId,
|
|
144
|
+
direction: current.direction === "asc" ? "desc" : "asc"
|
|
145
|
+
};
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
function renderSortIcon(columnId, sortable) {
|
|
149
|
+
if (sortable === false) {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
if (sort?.id !== columnId) {
|
|
153
|
+
return _jsx(ArrowUpDown, { className: "h-3.5 w-3.5 opacity-70", "aria-hidden": true });
|
|
154
|
+
}
|
|
155
|
+
return sort.direction === "asc" ? (_jsx(ArrowUp, { className: "h-3.5 w-3.5", "aria-hidden": true })) : (_jsx(ArrowDown, { className: "h-3.5 w-3.5", "aria-hidden": true }));
|
|
156
|
+
}
|
|
157
|
+
const hidableColumns = columns.filter((column) => column.canHide !== false);
|
|
158
|
+
return (_jsxs("div", { className: cn("space-y-4", className), children: [_jsxs("div", { className: "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between", children: [_jsxs("div", { className: "flex flex-1 items-center gap-2", children: [searchable ? (_jsx(Input, { value: query, onChange: (event) => setQuery(event.target.value), placeholder: searchPlaceholder, "aria-label": "Search table rows", className: "w-full sm:max-w-xs" })) : null, selectable && selectedCount > 0 ? (_jsxs("p", { className: "text-xs text-neutral-500 dark:text-neutral-400", children: [selectedCount, " selected"] })) : null] }), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [hidableColumns.length > 0 ? (_jsxs(DropdownMenu, { children: [_jsxs(DropdownMenuTrigger, { variant: "outline", size: "sm", className: "gap-1.5", children: [_jsx(Columns3, { className: "h-3.5 w-3.5" }), "Columns"] }), _jsxs(DropdownMenuContent, { align: "end", variant: "glass", className: "w-48", children: [_jsx(DropdownMenuLabel, { children: "Toggle columns" }), _jsx(DropdownMenuSeparator, {}), hidableColumns.map((column) => (_jsx(DropdownMenuCheckboxItem, { checked: columnVisibility[column.id] !== false, onCheckedChange: (checked) => {
|
|
159
|
+
setColumnVisibility((prev) => ({
|
|
160
|
+
...prev,
|
|
161
|
+
[column.id]: checked === true
|
|
162
|
+
}));
|
|
163
|
+
}, children: typeof column.header === "string" ? column.header : column.id }, column.id)))] })] })) : null, _jsxs("div", { className: "flex items-center gap-2 text-xs text-neutral-500 dark:text-neutral-400", children: [_jsx("span", { children: "Rows" }), _jsx(Select, { size: "sm", value: `${rowsPerPage}`, onChange: (event) => setRowsPerPage(Number(event.target.value)), options: pageSizeOptions.map((option) => ({ value: `${option}`, label: `${option}` })), className: "w-20", "aria-label": "Rows per page" })] })] })] }), _jsxs(Table, { ...tableProps, children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [selectable ? (_jsx(TableHead, { className: "w-10", sticky: tableProps.stickyFirstColumn, children: _jsx(Checkbox, { "aria-label": "Select all page rows", checked: allPageSelected ? true : somePageSelected ? "indeterminate" : false, onCheckedChange: (checked) => {
|
|
164
|
+
setSelectedRowIds((prev) => {
|
|
165
|
+
const next = { ...prev };
|
|
166
|
+
for (const rowId of pageRowIds) {
|
|
167
|
+
next[rowId] = checked === true;
|
|
168
|
+
}
|
|
169
|
+
return next;
|
|
170
|
+
});
|
|
171
|
+
} }) })) : null, visibleColumns.map((column) => (_jsx(TableHead, { align: column.align, className: column.headerClassName, sticky: tableProps.stickyFirstColumn && selectable && column === visibleColumns[0], children: _jsxs("button", { type: "button", onClick: () => toggleSort(column.id, column.sortable), className: cn("inline-flex items-center gap-1.5", column.sortable !== false && "transition-colors hover:text-[var(--color-foreground)]"), "aria-label": `Sort by ${typeof column.header === "string" ? column.header : column.id}`, children: [_jsx("span", { children: column.header }), renderSortIcon(column.id, column.sortable)] }) }, column.id)))] }) }), _jsx(TableBody, { children: pageRows.length === 0 ? (_jsx(TableEmpty, { colSpan: visibleColumns.length + (selectable ? 1 : 0), children: emptyMessage })) : (pageRows.map((row) => (_jsxs(TableRow, { tone: rowTone ? rowTone(row.data) : "default", "data-state": selectedRowIds[row.id] ? "selected" : undefined, className: cn(onRowClick && "cursor-pointer"), onClick: () => onRowClick?.(row.data), children: [selectable ? (_jsx(TableCell, { sticky: tableProps.stickyFirstColumn, className: "w-10", children: _jsx(Checkbox, { "aria-label": `Select row ${row.id}`, checked: selectedRowIds[row.id] === true, onCheckedChange: (checked) => {
|
|
172
|
+
setSelectedRowIds((prev) => ({
|
|
173
|
+
...prev,
|
|
174
|
+
[row.id]: checked === true
|
|
175
|
+
}));
|
|
176
|
+
}, onClick: (event) => event.stopPropagation() }) })) : null, visibleColumns.map((column, index) => {
|
|
177
|
+
const value = resolveColumnValue(row.data, column.accessor);
|
|
178
|
+
const content = column.cell
|
|
179
|
+
? column.cell({ row: row.data, value, rowId: row.id })
|
|
180
|
+
: value;
|
|
181
|
+
return (_jsx(TableCell, { align: column.align, className: column.className, sticky: tableProps.stickyFirstColumn && !selectable && index === 0, children: content }, `${row.id}-${column.id}`));
|
|
182
|
+
})] }, row.id)))) })] }), _jsxs("div", { className: "flex flex-col gap-2 text-xs text-neutral-500 dark:text-neutral-400 sm:flex-row sm:items-center sm:justify-between", children: [_jsxs("p", { children: ["Showing ", pageRows.length === 0 ? 0 : start + 1, "-", Math.min(start + rowsPerPage, sortedRows.length), " of", " ", sortedRows.length] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("p", { children: ["Page ", currentPage, " of ", totalPages] }), _jsxs(Button, { variant: "outline", size: "sm", onClick: () => setCurrentPage((page) => Math.max(1, page - 1)), disabled: currentPage <= 1, className: "gap-1", children: [_jsx(ChevronLeft, { className: "h-3.5 w-3.5" }), "Previous"] }), _jsxs(Button, { variant: "outline", size: "sm", onClick: () => setCurrentPage((page) => Math.min(totalPages, page + 1)), disabled: currentPage >= totalPages, className: "gap-1", children: ["Next", _jsx(ChevronRight, { className: "h-3.5 w-3.5" })] })] })] })] }));
|
|
183
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface DepthCardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/** Maximum tilt angle in degrees */
|
|
4
|
+
maxTilt?: number;
|
|
5
|
+
/** Perspective distance in px */
|
|
6
|
+
perspective?: number;
|
|
7
|
+
/** Scale on hover */
|
|
8
|
+
hoverScale?: number;
|
|
9
|
+
/** Glare effect */
|
|
10
|
+
glare?: boolean;
|
|
11
|
+
/** Glare max opacity */
|
|
12
|
+
glareOpacity?: number;
|
|
13
|
+
}
|
|
14
|
+
export declare const DepthCard: React.ForwardRefExoticComponent<DepthCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
//# sourceMappingURL=depth-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"depth-card.d.ts","sourceRoot":"","sources":["../../src/components/depth-card.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,MAAM,WAAW,cAAe,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC1E,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iCAAiC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,qBAAqB;IACrB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,mBAAmB;IACnB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,wBAAwB;IACxB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,eAAO,MAAM,SAAS,uFA2FrB,CAAA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
export const DepthCard = React.forwardRef(({ className, children, maxTilt = 15, perspective = 800, hoverScale = 1.02, glare = true, glareOpacity = 0.2, onMouseMove, onMouseLeave, style, ...props }, ref) => {
|
|
7
|
+
const prefersReducedMotion = usePrefersReducedMotion();
|
|
8
|
+
const localRef = React.useRef(null);
|
|
9
|
+
const setRefs = React.useCallback((node) => {
|
|
10
|
+
localRef.current = node;
|
|
11
|
+
if (typeof ref === "function") {
|
|
12
|
+
ref(node);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (ref)
|
|
16
|
+
ref.current = node;
|
|
17
|
+
}, [ref]);
|
|
18
|
+
const handleMouseMove = React.useCallback((event) => {
|
|
19
|
+
if (prefersReducedMotion || !localRef.current) {
|
|
20
|
+
onMouseMove?.(event);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const rect = localRef.current.getBoundingClientRect();
|
|
24
|
+
const x = (event.clientX - rect.left) / rect.width;
|
|
25
|
+
const y = (event.clientY - rect.top) / rect.height;
|
|
26
|
+
const tiltX = (0.5 - y) * maxTilt;
|
|
27
|
+
const tiltY = (x - 0.5) * maxTilt;
|
|
28
|
+
localRef.current.style.setProperty("--depth-tilt-x", `${tiltX.toFixed(2)}deg`);
|
|
29
|
+
localRef.current.style.setProperty("--depth-tilt-y", `${tiltY.toFixed(2)}deg`);
|
|
30
|
+
localRef.current.style.setProperty("--depth-scale", `${hoverScale}`);
|
|
31
|
+
if (glare) {
|
|
32
|
+
localRef.current.style.setProperty("--glare-x", `${(x * 100).toFixed(1)}%`);
|
|
33
|
+
localRef.current.style.setProperty("--glare-y", `${(y * 100).toFixed(1)}%`);
|
|
34
|
+
localRef.current.style.setProperty("--glare-opacity", `${glareOpacity}`);
|
|
35
|
+
}
|
|
36
|
+
onMouseMove?.(event);
|
|
37
|
+
}, [maxTilt, hoverScale, glare, glareOpacity, onMouseMove, prefersReducedMotion]);
|
|
38
|
+
const handleMouseLeave = React.useCallback((event) => {
|
|
39
|
+
if (localRef.current) {
|
|
40
|
+
localRef.current.style.setProperty("--depth-tilt-x", "0deg");
|
|
41
|
+
localRef.current.style.setProperty("--depth-tilt-y", "0deg");
|
|
42
|
+
localRef.current.style.setProperty("--depth-scale", "1");
|
|
43
|
+
localRef.current.style.setProperty("--glare-opacity", "0");
|
|
44
|
+
}
|
|
45
|
+
onMouseLeave?.(event);
|
|
46
|
+
}, [onMouseLeave]);
|
|
47
|
+
return (_jsxs("div", { ref: setRefs, className: cn("relative overflow-hidden rounded-xl border border-white/10 bg-white/5 p-6 shadow-lg backdrop-blur-md transition-transform duration-300 ease-out [transform:perspective(var(--depth-perspective,800px))_rotateX(var(--depth-tilt-x,0deg))_rotateY(var(--depth-tilt-y,0deg))_scale(var(--depth-scale,1))] motion-reduce:transform-none", className), style: {
|
|
48
|
+
"--depth-perspective": `${perspective}px`,
|
|
49
|
+
...style,
|
|
50
|
+
}, onMouseMove: handleMouseMove, onMouseLeave: handleMouseLeave, ...props, children: [glare && (_jsx("span", { "aria-hidden": "true", className: "pointer-events-none absolute inset-0 opacity-[var(--glare-opacity,0)] transition-opacity duration-300 [background:radial-gradient(300px_circle_at_var(--glare-x,50%)_var(--glare-y,50%),rgb(255_255_255_/_0.4),transparent_70%)] motion-reduce:hidden" })), _jsx("div", { className: "relative z-[1]", children: children })] }));
|
|
51
|
+
});
|
|
52
|
+
DepthCard.displayName = "DepthCard";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface DotPatternProps extends React.SVGAttributes<SVGSVGElement> {
|
|
3
|
+
dotSize?: number;
|
|
4
|
+
gap?: number;
|
|
5
|
+
dotColor?: string;
|
|
6
|
+
dotOpacity?: number;
|
|
7
|
+
cr?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const DotPattern: React.ForwardRefExoticComponent<DotPatternProps & React.RefAttributes<SVGSVGElement>>;
|
|
10
|
+
//# sourceMappingURL=dot-pattern.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dot-pattern.d.ts","sourceRoot":"","sources":["../../src/components/dot-pattern.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,MAAM,WAAW,eAAgB,SAAQ,KAAK,CAAC,aAAa,CAAC,aAAa,CAAC;IACzE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ;AAED,eAAO,MAAM,UAAU,uFAiDtB,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../lib/cn";
|
|
4
|
+
export const DotPattern = React.forwardRef(({ className, dotSize = 1.5, gap = 20, dotColor = "currentColor", dotOpacity = 0.2, cr, ...props }, ref) => {
|
|
5
|
+
const id = React.useId();
|
|
6
|
+
const patternId = `dot-pattern-${id}`;
|
|
7
|
+
const radius = cr ?? dotSize;
|
|
8
|
+
return (_jsxs("svg", { ref: ref, "aria-hidden": true, className: cn("pointer-events-none absolute inset-0 h-full w-full fill-neutral-400/40", className), ...props, children: [_jsx("defs", { children: _jsx("pattern", { id: patternId, x: 0, y: 0, width: gap, height: gap, patternUnits: "userSpaceOnUse", children: _jsx("circle", { cx: dotSize, cy: dotSize, r: radius, fill: dotColor, fillOpacity: dotOpacity }) }) }), _jsx("rect", { width: "100%", height: "100%", fill: `url(#${patternId})` })] }));
|
|
9
|
+
});
|
|
10
|
+
DotPattern.displayName = "DotPattern";
|