@apptimate/ui 3.9.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -112,15 +112,24 @@ export function Dropdown({ trigger, children, align = 'left', valign = 'bottom',
|
|
|
112
112
|
|
|
113
113
|
interface DropdownItemProps {
|
|
114
114
|
children: ReactNode;
|
|
115
|
-
onClick?: () => void;
|
|
115
|
+
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
116
116
|
className?: string;
|
|
117
117
|
isActive?: boolean;
|
|
118
|
+
icon?: ReactNode;
|
|
119
|
+
preventClose?: boolean;
|
|
118
120
|
}
|
|
119
121
|
|
|
120
|
-
export function DropdownItem({ children, onClick, className, isActive }: DropdownItemProps) {
|
|
122
|
+
export function DropdownItem({ children, onClick, className, isActive, icon, preventClose }: DropdownItemProps) {
|
|
123
|
+
const handleClick = (e: React.MouseEvent<HTMLDivElement>) => {
|
|
124
|
+
if (preventClose) {
|
|
125
|
+
e.stopPropagation();
|
|
126
|
+
}
|
|
127
|
+
onClick?.(e);
|
|
128
|
+
};
|
|
129
|
+
|
|
121
130
|
return (
|
|
122
131
|
<div
|
|
123
|
-
onClick={
|
|
132
|
+
onClick={handleClick}
|
|
124
133
|
className={cn(
|
|
125
134
|
"px-3 py-2 text-[13px] rounded-[6px] cursor-pointer transition-colors flex items-center gap-2",
|
|
126
135
|
isActive
|
|
@@ -129,7 +138,9 @@ export function DropdownItem({ children, onClick, className, isActive }: Dropdow
|
|
|
129
138
|
className
|
|
130
139
|
)}
|
|
131
140
|
>
|
|
141
|
+
{icon && <span className="flex items-center justify-center text-current opacity-70 shrink-0">{icon}</span>}
|
|
132
142
|
{children}
|
|
133
143
|
</div>
|
|
134
144
|
);
|
|
135
145
|
}
|
|
146
|
+
|
|
@@ -5,14 +5,23 @@ import { Inbox } from 'lucide-react';
|
|
|
5
5
|
|
|
6
6
|
export interface EmptyStateProps {
|
|
7
7
|
message?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
description?: string;
|
|
8
10
|
icon?: React.ReactNode;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
|
-
export const EmptyState = ({ message = "No records found.", icon }: EmptyStateProps) => {
|
|
13
|
+
export const EmptyState = ({ message = "No records found.", title, description, icon }: EmptyStateProps) => {
|
|
12
14
|
return (
|
|
13
|
-
<div className="flex flex-col items-center justify-center opacity-40">
|
|
15
|
+
<div className="flex flex-col items-center justify-center opacity-40 text-center">
|
|
14
16
|
{icon || <Inbox size={42} strokeWidth={1.5} className="mb-3 text-foreground-disabled" />}
|
|
15
|
-
|
|
17
|
+
{title ? (
|
|
18
|
+
<>
|
|
19
|
+
<h3 className="text-[16px] font-semibold text-foreground-disabled mb-1">{title}</h3>
|
|
20
|
+
{description && <p className="text-[14px] font-medium text-foreground-disabled">{description}</p>}
|
|
21
|
+
</>
|
|
22
|
+
) : (
|
|
23
|
+
<p className="text-[14px] font-medium text-foreground-disabled">{message}</p>
|
|
24
|
+
)}
|
|
16
25
|
</div>
|
|
17
26
|
);
|
|
18
27
|
};
|
|
@@ -16,7 +16,7 @@ export interface PopConfirmProps {
|
|
|
16
16
|
onConfirm: (callback: () => void, setLoading: (loading: boolean) => void) => void | Promise<any>;
|
|
17
17
|
|
|
18
18
|
/** Called when user cancels. Call callback() to close. */
|
|
19
|
-
onCancel
|
|
19
|
+
onCancel?: (callback: () => void) => void;
|
|
20
20
|
|
|
21
21
|
/** Text for the confirm button (default: 'Confirm') */
|
|
22
22
|
confirmText?: string;
|
|
@@ -92,7 +92,11 @@ export const PopConfirm = ({
|
|
|
92
92
|
}, [onConfirm, close]);
|
|
93
93
|
|
|
94
94
|
const handleCancel = useCallback(() => {
|
|
95
|
-
onCancel
|
|
95
|
+
if (onCancel) {
|
|
96
|
+
onCancel(close);
|
|
97
|
+
} else {
|
|
98
|
+
close();
|
|
99
|
+
}
|
|
96
100
|
}, [onCancel, close]);
|
|
97
101
|
|
|
98
102
|
const handleTriggerClick = useCallback(
|
package/src/index.tsx
CHANGED
|
@@ -21,6 +21,7 @@ export * from './base-components/DesktopFilterPopover';
|
|
|
21
21
|
export * from './base-components/Input';
|
|
22
22
|
export * from './base-components/Textarea';
|
|
23
23
|
export * from './base-components/Label';
|
|
24
|
+
export * from './base-components/Textarea';
|
|
24
25
|
export * from './base-components/Modal';
|
|
25
26
|
export * from './base-components/ActionModal';
|
|
26
27
|
export * from './base-components/Pagination';
|