@hexclave/dashboard-ui-components 1.0.5 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/alert.js +4 -4
- package/dist/components/alert.js.map +1 -1
- package/dist/components/analytics-chart/analytics-chart.js +2 -2
- package/dist/components/analytics-chart/index.js +2 -2
- package/dist/components/badge.js +1 -1
- package/dist/components/badge.js.map +1 -1
- package/dist/components/button.js +3 -3
- package/dist/components/button.js.map +1 -1
- package/dist/components/data-grid/data-grid-toolbar.js +5 -5
- package/dist/components/data-grid/data-grid-toolbar.js.map +1 -1
- package/dist/components/data-grid/data-grid.d.ts.map +1 -1
- package/dist/components/data-grid/data-grid.js +13 -7
- package/dist/components/data-grid/data-grid.js.map +1 -1
- package/dist/components/data-grid/data-grid.test.js +34 -1
- package/dist/components/data-grid/data-grid.test.js.map +1 -1
- package/dist/components/data-grid/index.js +2 -2
- package/dist/components/data-grid/use-url-state.js +1 -1
- package/dist/components/dialog.d.ts +6 -2
- package/dist/components/dialog.d.ts.map +1 -1
- package/dist/components/dialog.js +14 -10
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/input.js +12 -9
- package/dist/components/input.js.map +1 -1
- package/dist/components/pill-toggle.js +1 -1
- package/dist/components/pill-toggle.js.map +1 -1
- package/dist/components/tabs.js +2 -2
- package/dist/components/tabs.js.map +1 -1
- package/dist/dashboard-ui-components.global.js +85 -51
- package/dist/dashboard-ui-components.global.js.map +4 -4
- package/dist/esm/components/alert.js +4 -4
- package/dist/esm/components/alert.js.map +1 -1
- package/dist/esm/components/analytics-chart/analytics-chart.js +2 -2
- package/dist/esm/components/analytics-chart/index.js +2 -2
- package/dist/esm/components/badge.js +1 -1
- package/dist/esm/components/badge.js.map +1 -1
- package/dist/esm/components/button.js +3 -3
- package/dist/esm/components/button.js.map +1 -1
- package/dist/esm/components/data-grid/data-grid-toolbar.js +5 -5
- package/dist/esm/components/data-grid/data-grid-toolbar.js.map +1 -1
- package/dist/esm/components/data-grid/data-grid.d.ts.map +1 -1
- package/dist/esm/components/data-grid/data-grid.js +13 -7
- package/dist/esm/components/data-grid/data-grid.js.map +1 -1
- package/dist/esm/components/data-grid/data-grid.test.js +34 -1
- package/dist/esm/components/data-grid/data-grid.test.js.map +1 -1
- package/dist/esm/components/data-grid/index.js +2 -2
- package/dist/esm/components/data-grid/use-url-state.js +1 -1
- package/dist/esm/components/dialog.d.ts +6 -2
- package/dist/esm/components/dialog.d.ts.map +1 -1
- package/dist/esm/components/dialog.js +13 -11
- package/dist/esm/components/dialog.js.map +1 -1
- package/dist/esm/components/input.js +12 -9
- package/dist/esm/components/input.js.map +1 -1
- package/dist/esm/components/pill-toggle.js +1 -1
- package/dist/esm/components/pill-toggle.js.map +1 -1
- package/dist/esm/components/tabs.js +2 -2
- package/dist/esm/components/tabs.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +12 -0
- package/package.json +3 -3
- package/src/components/alert.tsx +4 -4
- package/src/components/badge.tsx +1 -1
- package/src/components/button.tsx +3 -3
- package/src/components/data-grid/data-grid-toolbar.tsx +12 -12
- package/src/components/data-grid/data-grid.test.tsx +42 -1
- package/src/components/data-grid/data-grid.tsx +17 -6
- package/src/components/dialog.tsx +24 -13
- package/src/components/input.tsx +24 -12
- package/src/components/pill-toggle.tsx +1 -1
- package/src/components/tabs.tsx +6 -3
- package/src/index.ts +2 -0
|
@@ -44,14 +44,12 @@ const dialogSizeClasses = new Map<DesignDialogSize, string>([
|
|
|
44
44
|
]);
|
|
45
45
|
|
|
46
46
|
const dialogSurfaceClasses = new Map<DesignDialogVariant, string>([
|
|
47
|
-
["glassmorphic", "border-0 sm:rounded-2xl bg-
|
|
48
|
-
["plain", "border bg-
|
|
47
|
+
["glassmorphic", "border-0 sm:rounded-2xl bg-white/95 backdrop-blur-2xl ring-1 ring-black/[0.08] shadow-[0_24px_48px_-12px_rgba(0,0,0,0.25),0_4px_24px_-8px_rgba(0,0,0,0.12)] dark:bg-background/80 dark:ring-white/[0.06]"],
|
|
48
|
+
["plain", "border border-black/[0.08] bg-white shadow-lg sm:rounded-lg dark:border-white/[0.06] dark:bg-background"],
|
|
49
49
|
]);
|
|
50
50
|
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
["plain", undefined],
|
|
54
|
-
]);
|
|
51
|
+
export const designDialogGlassmorphicSurfaceClass = dialogSurfaceClasses.get("glassmorphic") ?? "";
|
|
52
|
+
export const designDialogGlassmorphicOverlayClass = "bg-black/50 backdrop-blur-sm";
|
|
55
53
|
|
|
56
54
|
type DesignDialogIcon = React.ElementType<{ className?: string }>;
|
|
57
55
|
|
|
@@ -75,6 +73,10 @@ export type DesignDialogProps = {
|
|
|
75
73
|
bodyClassName?: string,
|
|
76
74
|
footerClassName?: string,
|
|
77
75
|
children?: React.ReactNode,
|
|
76
|
+
contentProps?: Omit<
|
|
77
|
+
React.ComponentPropsWithoutRef<typeof DialogContent>,
|
|
78
|
+
"className" | "children" | "overlayProps" | "noCloseButton"
|
|
79
|
+
>,
|
|
78
80
|
} & DesignDialogRootProps;
|
|
79
81
|
|
|
80
82
|
/**
|
|
@@ -98,12 +100,16 @@ export function DesignDialog({
|
|
|
98
100
|
headerClassName,
|
|
99
101
|
bodyClassName,
|
|
100
102
|
footerClassName,
|
|
103
|
+
contentProps,
|
|
101
104
|
children,
|
|
102
105
|
...dialogRootProps
|
|
103
106
|
}: DesignDialogProps) {
|
|
104
107
|
const resolvedSizeClass = dialogSizeClasses.get(size) ?? "max-w-lg";
|
|
105
108
|
const resolvedSurfaceClass = dialogSurfaceClasses.get(variant) ?? dialogSurfaceClasses.get("glassmorphic");
|
|
106
|
-
const resolvedOverlayClass = cn(
|
|
109
|
+
const resolvedOverlayClass = cn(
|
|
110
|
+
variant === "glassmorphic" ? designDialogGlassmorphicOverlayClass : undefined,
|
|
111
|
+
overlayClassName,
|
|
112
|
+
);
|
|
107
113
|
const shouldRenderTopHeaderRow = Icon != null || title != null || description != null;
|
|
108
114
|
const shouldRenderHeader = customHeader != null || shouldRenderTopHeaderRow || headerContent != null;
|
|
109
115
|
// Use toArray + filter(Boolean) instead of Children.count so that
|
|
@@ -129,23 +135,28 @@ export function DesignDialog({
|
|
|
129
135
|
|
|
130
136
|
<DialogContent
|
|
131
137
|
className={cn(
|
|
132
|
-
"gap-0
|
|
138
|
+
"gap-0 h-auto max-h-[min(100dvh-2rem,36rem)] overflow-hidden p-0",
|
|
133
139
|
resolvedSizeClass,
|
|
134
140
|
resolvedSurfaceClass,
|
|
135
141
|
className
|
|
136
142
|
)}
|
|
137
143
|
overlayProps={resolvedOverlayClass ? { className: resolvedOverlayClass } : undefined}
|
|
138
144
|
noCloseButton={hideTopCloseButton}
|
|
145
|
+
{...contentProps}
|
|
139
146
|
>
|
|
140
147
|
{needsAccessibleTitleFallback && (
|
|
141
148
|
<DialogTitle className="sr-only">Dialog</DialogTitle>
|
|
142
149
|
)}
|
|
143
150
|
{shouldRenderHeader && (
|
|
144
|
-
<DialogHeader className={cn("px-6 pt-6 pb-4 border-b border-foreground/[0.06]", headerClassName)}>
|
|
151
|
+
<DialogHeader className={cn("shrink-0 px-6 pt-6 pb-4 border-b border-foreground/[0.06]", headerClassName)}>
|
|
145
152
|
{customHeader ?? (
|
|
146
153
|
<>
|
|
147
154
|
{shouldRenderTopHeaderRow && (
|
|
148
|
-
<div className={cn(
|
|
155
|
+
<div className={cn(
|
|
156
|
+
"flex gap-3",
|
|
157
|
+
description != null ? "items-start" : "items-center",
|
|
158
|
+
Icon == null && "gap-0",
|
|
159
|
+
)}>
|
|
149
160
|
{Icon != null && (
|
|
150
161
|
<div className="h-9 w-9 rounded-xl bg-primary/10 ring-1 ring-primary/15 flex items-center justify-center shrink-0">
|
|
151
162
|
<Icon className="h-4 w-4 text-primary" />
|
|
@@ -154,7 +165,7 @@ export function DesignDialog({
|
|
|
154
165
|
{(title != null || description != null) && (
|
|
155
166
|
<div className="flex-1 min-w-0 space-y-1">
|
|
156
167
|
{title != null ? (
|
|
157
|
-
<DialogTitle className="text-base">
|
|
168
|
+
<DialogTitle className="text-base font-semibold leading-snug">
|
|
158
169
|
{title}
|
|
159
170
|
</DialogTitle>
|
|
160
171
|
) : null}
|
|
@@ -181,7 +192,7 @@ export function DesignDialog({
|
|
|
181
192
|
{shouldRenderBody && (
|
|
182
193
|
<DialogBody
|
|
183
194
|
className={cn(
|
|
184
|
-
"mx-0 my-0 w-auto",
|
|
195
|
+
"mx-0 my-0 w-auto min-h-0 overflow-y-auto",
|
|
185
196
|
noBodyPadding ? "px-0 py-0" : "px-6 py-4",
|
|
186
197
|
bodyClassName
|
|
187
198
|
)}
|
|
@@ -191,7 +202,7 @@ export function DesignDialog({
|
|
|
191
202
|
)}
|
|
192
203
|
|
|
193
204
|
{footer != null ? (
|
|
194
|
-
<DialogFooter className={cn("px-6 py-3 border-t border-foreground/[0.06] bg-foreground/[0.02]", footerClassName)}>
|
|
205
|
+
<DialogFooter className={cn("shrink-0 px-6 py-3 border-t border-foreground/[0.06] bg-foreground/[0.02]", footerClassName)}>
|
|
195
206
|
{footer}
|
|
196
207
|
</DialogFooter>
|
|
197
208
|
) : null}
|
package/src/components/input.tsx
CHANGED
|
@@ -13,23 +13,31 @@ export type DesignInputProps = {
|
|
|
13
13
|
|
|
14
14
|
export const DesignInput = forwardRefIfNeeded<HTMLInputElement, DesignInputProps>(
|
|
15
15
|
({ className, type, prefixItem, leadingIcon, size = "md", ...props }, ref) => {
|
|
16
|
-
const
|
|
17
|
-
? "h-7
|
|
16
|
+
const heightTextClasses = size === "sm"
|
|
17
|
+
? "h-7 text-xs"
|
|
18
18
|
: size === "lg"
|
|
19
|
-
? "h-10
|
|
20
|
-
: "h-9
|
|
19
|
+
? "h-10 text-sm"
|
|
20
|
+
: "h-9 text-sm";
|
|
21
|
+
const horizontalPaddingClasses = size === "sm" ? "px-2" : size === "lg" ? "px-4" : "px-3";
|
|
21
22
|
const baseClasses = cn(
|
|
22
23
|
"stack-scope flex w-full rounded-xl border border-black/[0.08] dark:border-white/[0.06] bg-white/80 dark:bg-foreground/[0.03] shadow-sm ring-1 ring-black/[0.08] dark:ring-white/[0.06]",
|
|
23
24
|
"file:border-0 file:bg-transparent file:text-sm file:font-medium",
|
|
24
25
|
"placeholder:text-muted-foreground/50 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-foreground/[0.1]",
|
|
25
26
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
26
27
|
"transition-all duration-150 hover:transition-none hover:bg-white dark:hover:bg-foreground/[0.06]",
|
|
27
|
-
|
|
28
|
+
heightTextClasses
|
|
28
29
|
);
|
|
29
30
|
|
|
31
|
+
const leadingIconClasses = size === "sm"
|
|
32
|
+
? "left-2.5 [&_svg]:size-3"
|
|
33
|
+
: size === "lg"
|
|
34
|
+
? "left-3.5 [&_svg]:size-4"
|
|
35
|
+
: "left-3 [&_svg]:size-3.5";
|
|
36
|
+
const leadingIconPadding = size === "sm" ? "pl-8" : size === "lg" ? "pl-10" : "pl-9";
|
|
37
|
+
|
|
30
38
|
if (prefixItem) {
|
|
31
39
|
return (
|
|
32
|
-
<div className="flex flex-row items-center
|
|
40
|
+
<div className="flex w-full flex-row items-center overflow-hidden rounded-xl border border-black/[0.08] bg-white/80 shadow-sm ring-1 ring-black/[0.08] transition-all duration-150 hover:bg-white hover:transition-none dark:border-white/[0.06] dark:bg-foreground/[0.03] dark:ring-white/[0.06] focus-within:ring-1 focus-within:ring-foreground/[0.1] dark:hover:bg-foreground/[0.06]">
|
|
33
41
|
<div className={cn(
|
|
34
42
|
"flex self-stretch items-center justify-center select-none text-muted-foreground/70 border-r border-black/[0.06] dark:border-white/[0.06] bg-black/[0.03] dark:bg-white/[0.02]",
|
|
35
43
|
size === "sm" ? "px-2.5 text-xs" : size === "lg" ? "px-3.5 text-sm" : "px-3 text-sm"
|
|
@@ -43,7 +51,8 @@ export const DesignInput = forwardRefIfNeeded<HTMLInputElement, DesignInputProps
|
|
|
43
51
|
"file:border-0 file:bg-transparent file:text-sm file:font-medium",
|
|
44
52
|
"placeholder:text-muted-foreground/50 focus-visible:outline-none",
|
|
45
53
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
46
|
-
|
|
54
|
+
heightTextClasses,
|
|
55
|
+
horizontalPaddingClasses,
|
|
47
56
|
"rounded-none border-0 shadow-none ring-0 focus-visible:ring-0",
|
|
48
57
|
className
|
|
49
58
|
)}
|
|
@@ -56,13 +65,16 @@ export const DesignInput = forwardRefIfNeeded<HTMLInputElement, DesignInputProps
|
|
|
56
65
|
|
|
57
66
|
if (leadingIcon) {
|
|
58
67
|
return (
|
|
59
|
-
<div className="relative
|
|
60
|
-
<div className=
|
|
68
|
+
<div className={cn("relative w-full", className)}>
|
|
69
|
+
<div className={cn(
|
|
70
|
+
"pointer-events-none absolute top-1/2 -translate-y-1/2 text-muted-foreground [&_svg]:block",
|
|
71
|
+
leadingIconClasses,
|
|
72
|
+
)}>
|
|
61
73
|
{leadingIcon}
|
|
62
74
|
</div>
|
|
63
75
|
<input
|
|
64
76
|
type={type}
|
|
65
|
-
className={cn(baseClasses,
|
|
77
|
+
className={cn(baseClasses, leadingIconPadding)}
|
|
66
78
|
ref={ref}
|
|
67
79
|
{...props}
|
|
68
80
|
/>
|
|
@@ -71,10 +83,10 @@ export const DesignInput = forwardRefIfNeeded<HTMLInputElement, DesignInputProps
|
|
|
71
83
|
}
|
|
72
84
|
|
|
73
85
|
return (
|
|
74
|
-
<div className="
|
|
86
|
+
<div className="w-full">
|
|
75
87
|
<input
|
|
76
88
|
type={type}
|
|
77
|
-
className={cn(baseClasses, className)}
|
|
89
|
+
className={cn(baseClasses, horizontalPaddingClasses, className)}
|
|
78
90
|
ref={ref}
|
|
79
91
|
{...props}
|
|
80
92
|
/>
|
|
@@ -107,7 +107,7 @@ export function DesignPillToggle({
|
|
|
107
107
|
sizeClass.button,
|
|
108
108
|
isActive
|
|
109
109
|
? cn(
|
|
110
|
-
"bg-background text-foreground shadow-sm ring-1",
|
|
110
|
+
"bg-white dark:bg-background text-foreground shadow-sm ring-1",
|
|
111
111
|
glassmorphic
|
|
112
112
|
? "ring-foreground/[0.06] dark:bg-[hsl(240,71%,70%)]/10 dark:text-[hsl(240,71%,90%)] dark:ring-[hsl(240,71%,70%)]/20"
|
|
113
113
|
: activeRingClass
|
package/src/components/tabs.tsx
CHANGED
|
@@ -135,7 +135,7 @@ export function DesignCategoryTabs({
|
|
|
135
135
|
className={cn(
|
|
136
136
|
"flex w-full min-w-0 items-center gap-2",
|
|
137
137
|
glassmorphic
|
|
138
|
-
? "rounded-xl bg-black/[0.
|
|
138
|
+
? "rounded-xl bg-zinc-100/90 p-1 ring-1 ring-black/[0.06] backdrop-blur-sm dark:bg-white/[0.04] dark:ring-white/[0.06]"
|
|
139
139
|
: "border-b border-gray-300 dark:border-gray-800",
|
|
140
140
|
className
|
|
141
141
|
)}
|
|
@@ -164,9 +164,12 @@ export function DesignCategoryTabs({
|
|
|
164
164
|
isActive
|
|
165
165
|
? cn(
|
|
166
166
|
gradientClass.activeText,
|
|
167
|
-
glassmorphic && "bg-
|
|
167
|
+
glassmorphic && "bg-white shadow-sm ring-1 ring-black/[0.12] dark:bg-background dark:ring-white/[0.06]"
|
|
168
|
+
)
|
|
169
|
+
: cn(
|
|
170
|
+
"text-gray-700 dark:text-gray-400",
|
|
171
|
+
glassmorphic && "rounded-lg hover:bg-white/50 dark:hover:bg-white/[0.06]",
|
|
168
172
|
)
|
|
169
|
-
: "text-gray-700 dark:text-gray-400"
|
|
170
173
|
)}
|
|
171
174
|
>
|
|
172
175
|
{loadingCategoryId === category.id && (
|
package/src/index.ts
CHANGED
|
@@ -20,6 +20,8 @@ export {
|
|
|
20
20
|
DesignDialogRoot,
|
|
21
21
|
DesignDialogTitle,
|
|
22
22
|
DesignDialogTrigger,
|
|
23
|
+
designDialogGlassmorphicOverlayClass,
|
|
24
|
+
designDialogGlassmorphicSurfaceClass,
|
|
23
25
|
} from "./components/dialog";
|
|
24
26
|
export type { DesignDialogProps, DesignDialogSize, DesignDialogVariant } from "./components/dialog";
|
|
25
27
|
|