@campxdev/react-blueprint 3.0.0-alpha.1 → 3.0.0-alpha.3
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/cjs/index.js +1 -1
- package/dist/cjs/types/src/components/DataDisplay/DataTable/DataTable.d.ts +3 -0
- package/dist/cjs/types/src/components/DataDisplay/DataTable/components/TableView.d.ts +3 -0
- package/dist/cjs/types/src/components/Input/DatePicker/DatePicker.d.ts +2 -2
- package/dist/cjs/types/src/components/Input/DateTimePicker/DateTimePicker.d.ts +2 -2
- package/dist/cjs/types/src/components/Input/PasswordField/PasswordField.d.ts +2 -1
- package/dist/cjs/types/src/components/Input/TextField/TextField.d.ts +2 -1
- package/dist/cjs/types/src/components/Input/Textarea/Textarea.d.ts +12 -0
- package/dist/cjs/types/src/components/Input/export.d.ts +1 -0
- package/dist/cjs/types/src/components/Layout/AppLayout/index.d.ts +1 -0
- package/dist/cjs/types/src/components/Layout/PageHeader/PageHeader.d.ts +3 -2
- package/dist/cjs/types/src/components/Navigation/Breadcrumbs/Breadcrumbs.d.ts +3 -1
- package/dist/cjs/types/src/shadcn-components/Input/Textarea/Textarea.d.ts +3 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/types/src/components/DataDisplay/DataTable/DataTable.d.ts +3 -0
- package/dist/esm/types/src/components/DataDisplay/DataTable/components/TableView.d.ts +3 -0
- package/dist/esm/types/src/components/Input/DatePicker/DatePicker.d.ts +2 -2
- package/dist/esm/types/src/components/Input/DateTimePicker/DateTimePicker.d.ts +2 -2
- package/dist/esm/types/src/components/Input/PasswordField/PasswordField.d.ts +2 -1
- package/dist/esm/types/src/components/Input/TextField/TextField.d.ts +2 -1
- package/dist/esm/types/src/components/Input/Textarea/Textarea.d.ts +12 -0
- package/dist/esm/types/src/components/Input/export.d.ts +1 -0
- package/dist/esm/types/src/components/Layout/AppLayout/index.d.ts +1 -0
- package/dist/esm/types/src/components/Layout/PageHeader/PageHeader.d.ts +3 -2
- package/dist/esm/types/src/components/Navigation/Breadcrumbs/Breadcrumbs.d.ts +3 -1
- package/dist/esm/types/src/shadcn-components/Input/Textarea/Textarea.d.ts +3 -0
- package/dist/index.d.ts +88 -21
- package/dist/styles.css +11 -14
- package/package.json +1 -1
- package/src/components/DataDisplay/DataTable/DataTable.tsx +5 -0
- package/src/components/DataDisplay/DataTable/components/TableHeaders/TableActionHeader.tsx +1 -1
- package/src/components/DataDisplay/DataTable/components/TableView.tsx +13 -8
- package/src/components/DataDisplay/DataTable/components/ViewList/ViewButton.tsx +1 -1
- package/src/components/Feedback/Snackbar/Snackbar.tsx +5 -8
- package/src/components/Input/DatePicker/DatePicker.tsx +38 -21
- package/src/components/Input/DateTimePicker/DateTimePicker.tsx +44 -27
- package/src/components/Input/MultiSelect/components/MultiSelectInput.tsx +1 -1
- package/src/components/Input/PasswordField/PasswordField.tsx +5 -2
- package/src/components/Input/SingleSelect/components/SingleInput.tsx +1 -1
- package/src/components/Input/TextField/TextField.tsx +7 -0
- package/src/components/Input/Textarea/Textarea.tsx +67 -0
- package/src/components/Input/export.ts +1 -0
- package/src/components/Layout/AppLayout/components/Sidebar/MenuBar.tsx +1 -0
- package/src/components/Layout/AppLayout/components/Sidebar/MenuItem.tsx +2 -2
- package/src/components/Layout/AppLayout/components/Sidebar/StyledComponents.tsx +1 -1
- package/src/components/Layout/AppLayout/index.ts +3 -0
- package/src/components/Layout/PageHeader/PageHeader.tsx +8 -6
- package/src/components/Navigation/Breadcrumbs/Breadcrumbs.tsx +17 -6
- package/src/components/Navigation/TabsContainer/TabsContainer.tsx +1 -1
- package/src/hooks/usePageHeader.ts +1 -1
- package/src/shadcn-components/DataDisplay/Typography/Typography.tsx +1 -1
- package/src/shadcn-components/Input/Textarea/Textarea.tsx +18 -0
|
@@ -19,6 +19,9 @@ type DataTableProps<TData = any> = {
|
|
|
19
19
|
rowSelectionModel?: Record<string, boolean>;
|
|
20
20
|
onRowSelectionModelChange?: (newRowSelectionModel: Record<string, boolean>) => void;
|
|
21
21
|
selectionActions?: React.ReactNode[];
|
|
22
|
+
onRowClick?: (params: {
|
|
23
|
+
row: Row<TData>;
|
|
24
|
+
}) => void;
|
|
22
25
|
enableSorting?: boolean;
|
|
23
26
|
sortingState?: SortingState;
|
|
24
27
|
onSortingChange?: (newSortingState: SortingState) => void;
|
|
@@ -15,6 +15,9 @@ interface TableViewProps<TData = any> {
|
|
|
15
15
|
totalCount?: number;
|
|
16
16
|
onPageChange?: (page: number) => void;
|
|
17
17
|
onLimitChange?: (limit: number) => void;
|
|
18
|
+
onRowClick?: (params: {
|
|
19
|
+
row: Row<TData>;
|
|
20
|
+
}) => void;
|
|
18
21
|
}
|
|
19
22
|
declare const TableView: React.ForwardRefExoticComponent<TableViewProps<any> & React.RefAttributes<HTMLDivElement>>;
|
|
20
23
|
export default TableView;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
type DateFormat = 'yyyy' | 'MMMM yyyy' | 'dd MMMM yyyy' | 'dd/MM/yyyy';
|
|
3
2
|
export type DatePickerProps = {
|
|
4
3
|
label?: React.ReactNode | string;
|
|
@@ -28,7 +27,8 @@ export type DatePickerProps = {
|
|
|
28
27
|
onOpen?: () => void;
|
|
29
28
|
onClose?: () => void;
|
|
30
29
|
onBlur?: React.FocusEventHandler;
|
|
30
|
+
fullWidth?: boolean;
|
|
31
31
|
[key: string]: any;
|
|
32
32
|
};
|
|
33
|
-
export declare const DatePicker: ({ label, name, value, onChange, required, format, helperText, placeholder, shortcutsItems, openPickerIcon: Icon, containerProps, error, disabled, minDate, maxDate, disablePast, disableFuture, shouldDisableDate, shouldDisableMonth, shouldDisableYear, className, onOpen, onClose, ...rest }: DatePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export declare const DatePicker: ({ label, name, value, onChange, required, format, helperText, placeholder, shortcutsItems, openPickerIcon: Icon, containerProps, error, disabled, minDate, maxDate, disablePast, disableFuture, shouldDisableDate, shouldDisableMonth, shouldDisableYear, className, onOpen, onClose, fullWidth, ...rest }: DatePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
34
34
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
type DateTimePickerViews = 'year' | 'month' | 'day' | 'hours' | 'minutes' | 'seconds';
|
|
3
2
|
type DateTimeFormat = 'yyyy' | 'MMMM yyyy' | 'MMM yyyy' | 'dd MMMM yyyy' | 'dd/MM/yyyy' | 'MM/dd/yyyy' | 'yyyy-MM-dd' | 'yyyy-MM-dd hh:mm a' | 'dd MMM yyyy hh:mm a' | 'dd/MM/yyyy hh:mm a' | 'yyyy-MM-dd hh:mm:ss a' | 'dd MMM yyyy hh:mm:ss a' | 'dd/MM/yyyy hh:mm:ss a' | 'hh:mm a' | 'hh:mm:ss a' | 'MMM dd, yyyy hh:mm a' | 'MMM dd, yyyy hh:mm:ss a' | 'EEE, MMM dd yyyy' | 'EEEE, MMMM dd, yyyy';
|
|
4
3
|
export type DateTimePickerProps = {
|
|
@@ -30,7 +29,8 @@ export type DateTimePickerProps = {
|
|
|
30
29
|
onOpen?: () => void;
|
|
31
30
|
onClose?: () => void;
|
|
32
31
|
onBlur?: React.FocusEventHandler;
|
|
32
|
+
fullWidth?: boolean;
|
|
33
33
|
[key: string]: any;
|
|
34
34
|
};
|
|
35
|
-
export declare const DateTimePicker: ({ label, name, value, onChange, required, format, views, helperText, placeholder, shortcutsItems, openPickerIcon: Icon, containerProps, error, disabled, minDate, maxDate, disablePast, disableFuture, shouldDisableDate, shouldDisableMonth, shouldDisableYear, className, onOpen, onClose, ...rest }: DateTimePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
export declare const DateTimePicker: ({ label, name, value, onChange, required, format, views, helperText, placeholder, shortcutsItems, openPickerIcon: Icon, containerProps, error, disabled, minDate, maxDate, disablePast, disableFuture, shouldDisableDate, shouldDisableMonth, shouldDisableYear, className, onOpen, onClose, fullWidth, ...rest }: DateTimePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
36
36
|
export {};
|
|
@@ -11,5 +11,6 @@ export type PasswordFieldProps = {
|
|
|
11
11
|
error?: boolean;
|
|
12
12
|
helperText?: string;
|
|
13
13
|
className?: string;
|
|
14
|
+
fullWidth?: boolean;
|
|
14
15
|
} & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'>;
|
|
15
|
-
export declare const PasswordField: ({ name, label, value, onChange, required, containerProps, description, placeholder, disabled, error, helperText, className, ...rest }: PasswordFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare const PasswordField: ({ name, label, value, onChange, required, containerProps, description, placeholder, disabled, error, helperText, className, fullWidth, ...rest }: PasswordFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,5 +7,6 @@ export type TextFieldProps = {
|
|
|
7
7
|
required?: boolean;
|
|
8
8
|
fullWidth?: boolean;
|
|
9
9
|
error?: boolean;
|
|
10
|
+
helperText?: React.ReactNode;
|
|
10
11
|
} & React.ComponentProps<typeof Input>;
|
|
11
|
-
export declare const TextField: ({ name, label, value, onChange, required, containerProps, description, fullWidth, className, error, ...rest }: TextFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const TextField: ({ name, label, value, onChange, required, containerProps, description, fullWidth, className, error, helperText, ...rest }: TextFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Textarea as ShadcnTextarea } from '@/shadcn-components/Input/Textarea/Textarea';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export type TextareaProps = {
|
|
4
|
+
containerProps?: React.HTMLAttributes<HTMLDivElement>;
|
|
5
|
+
description?: string;
|
|
6
|
+
label?: React.ReactNode | string;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
fullWidth?: boolean;
|
|
9
|
+
error?: boolean;
|
|
10
|
+
helperText?: React.ReactNode;
|
|
11
|
+
} & React.ComponentProps<typeof ShadcnTextarea>;
|
|
12
|
+
export declare const Textarea: ({ name, label, value, onChange, required, containerProps, description, fullWidth, className, error, helperText, ...rest }: TextareaProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,3 +3,4 @@ export type { AppLayoutProps, HelpDocsAction, HelpDocsConfig } from './types';
|
|
|
3
3
|
export { SidebarProvider, useSidebar } from './context/SidebarContext';
|
|
4
4
|
export { MenuToggleButton } from './components/MenuToggleButton';
|
|
5
5
|
export { UserProfilePopup } from './components/UserProfilePopup';
|
|
6
|
+
export * from './components/Sidebar/interfaces';
|
|
@@ -3,7 +3,8 @@ import { SearchBarProps } from '../../Input/SearchBar/SearchBar';
|
|
|
3
3
|
interface PageHeaderProps {
|
|
4
4
|
uniqueId?: string;
|
|
5
5
|
pathTrimCount: number;
|
|
6
|
-
|
|
6
|
+
breadcrumbAction?: ReactElement;
|
|
7
|
+
searchBarProps?: SearchBarProps;
|
|
7
8
|
filterButtonProps?: {
|
|
8
9
|
label?: string;
|
|
9
10
|
startIcon?: ReactNode;
|
|
@@ -19,5 +20,5 @@ interface PageHeaderProps {
|
|
|
19
20
|
}) => ReactNode[]);
|
|
20
21
|
};
|
|
21
22
|
}
|
|
22
|
-
declare const PageHeader: ({ uniqueId, pathTrimCount,
|
|
23
|
+
declare const PageHeader: ({ uniqueId, pathTrimCount, breadcrumbAction, searchBarProps, filterButtonProps, addButtonProps, actionProps, }: PageHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
24
|
export { PageHeader, type PageHeaderProps };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
1
2
|
export type BreadcrumbsProps = {
|
|
2
3
|
pathTrimCount: number;
|
|
3
4
|
containerClassName?: string;
|
|
5
|
+
action?: ReactElement;
|
|
4
6
|
};
|
|
5
|
-
export declare const Breadcrumbs: ({ pathTrimCount, containerClassName, }: BreadcrumbsProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const Breadcrumbs: ({ pathTrimCount, containerClassName, action, }: BreadcrumbsProps) => import("react/jsx-runtime").JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { LayoutType, AnimationTiming } from 'recharts/types/util/types';
|
|
|
6
6
|
import { CurveType } from 'recharts/types/shape/Curve';
|
|
7
7
|
import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
|
|
8
8
|
import { VariantProps } from 'class-variance-authority';
|
|
9
|
-
import { ColumnDef,
|
|
9
|
+
import { ColumnDef, Row, SortingState } from '@tanstack/react-table';
|
|
10
10
|
export { ColumnDef } from '@tanstack/react-table';
|
|
11
11
|
import { Axios, AxiosInstance } from 'axios';
|
|
12
12
|
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
@@ -437,7 +437,7 @@ interface CardProps extends Omit<React$1.ComponentProps<typeof Card$1>, 'title'
|
|
|
437
437
|
declare const Card: React$1.ForwardRefExoticComponent<Omit<CardProps, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
438
438
|
|
|
439
439
|
declare const badgeVariants: (props?: ({
|
|
440
|
-
variant?: "default" | "
|
|
440
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | null | undefined;
|
|
441
441
|
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
442
442
|
declare function Badge({ className, variant, asChild, ...props }: React$1.ComponentProps<'span'> & VariantProps<typeof badgeVariants> & {
|
|
443
443
|
asChild?: boolean;
|
|
@@ -488,6 +488,9 @@ type DataTableProps<TData = any> = {
|
|
|
488
488
|
rowSelectionModel?: Record<string, boolean>;
|
|
489
489
|
onRowSelectionModelChange?: (newRowSelectionModel: Record<string, boolean>) => void;
|
|
490
490
|
selectionActions?: React__default.ReactNode[];
|
|
491
|
+
onRowClick?: (params: {
|
|
492
|
+
row: Row<TData>;
|
|
493
|
+
}) => void;
|
|
491
494
|
enableSorting?: boolean;
|
|
492
495
|
sortingState?: SortingState;
|
|
493
496
|
onSortingChange?: (newSortingState: SortingState) => void;
|
|
@@ -510,7 +513,7 @@ type DataTableProps<TData = any> = {
|
|
|
510
513
|
declare const DataTable: <TData extends Record<string, any> = any>(props: DataTableProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
511
514
|
|
|
512
515
|
declare const typographyVariants: (props?: ({
|
|
513
|
-
variant?: "blockquote" | "h1" | "h2" | "h3" | "h4" | "p" | "small" | "list" | "
|
|
516
|
+
variant?: "blockquote" | "h1" | "h2" | "h3" | "h4" | "p" | "small" | "list" | "inlineCode" | "lead" | "large" | "muted" | null | undefined;
|
|
514
517
|
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
515
518
|
interface TypographyProps extends React$1.HTMLAttributes<HTMLElement>, VariantProps<typeof typographyVariants> {
|
|
516
519
|
as?: React$1.ElementType;
|
|
@@ -612,7 +615,7 @@ type TooltipProps = {
|
|
|
612
615
|
declare const Tooltip: ({ children, title, placement, open, defaultOpen, onOpenChange, delayDuration, }: TooltipProps) => react_jsx_runtime.JSX.Element;
|
|
613
616
|
|
|
614
617
|
declare const buttonVariants: (props?: ({
|
|
615
|
-
variant?: "input" | "link" | "default" | "
|
|
618
|
+
variant?: "input" | "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
616
619
|
size?: "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg" | null | undefined;
|
|
617
620
|
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
618
621
|
|
|
@@ -627,7 +630,7 @@ declare const Button: ({ loading, disabled, children, startIcon, endIcon, fullWi
|
|
|
627
630
|
|
|
628
631
|
type DateFormat = 'yyyy' | 'MMMM yyyy' | 'dd MMMM yyyy' | 'dd/MM/yyyy';
|
|
629
632
|
type DatePickerProps = {
|
|
630
|
-
label?: React
|
|
633
|
+
label?: React.ReactNode | string;
|
|
631
634
|
name?: string;
|
|
632
635
|
value?: Date;
|
|
633
636
|
onChange?: (date: Date | undefined) => void;
|
|
@@ -639,8 +642,8 @@ type DatePickerProps = {
|
|
|
639
642
|
getValue: () => Date;
|
|
640
643
|
}[];
|
|
641
644
|
required?: boolean;
|
|
642
|
-
containerProps?: React
|
|
643
|
-
openPickerIcon?: React
|
|
645
|
+
containerProps?: React.HTMLAttributes<HTMLDivElement>;
|
|
646
|
+
openPickerIcon?: React.ReactNode;
|
|
644
647
|
error?: any;
|
|
645
648
|
disabled?: boolean;
|
|
646
649
|
minDate?: Date;
|
|
@@ -653,15 +656,16 @@ type DatePickerProps = {
|
|
|
653
656
|
className?: string;
|
|
654
657
|
onOpen?: () => void;
|
|
655
658
|
onClose?: () => void;
|
|
656
|
-
onBlur?: React
|
|
659
|
+
onBlur?: React.FocusEventHandler;
|
|
660
|
+
fullWidth?: boolean;
|
|
657
661
|
[key: string]: any;
|
|
658
662
|
};
|
|
659
|
-
declare const DatePicker: ({ label, name, value, onChange, required, format, helperText, placeholder, shortcutsItems, openPickerIcon: Icon, containerProps, error, disabled, minDate, maxDate, disablePast, disableFuture, shouldDisableDate, shouldDisableMonth, shouldDisableYear, className, onOpen, onClose, ...rest }: DatePickerProps) => react_jsx_runtime.JSX.Element;
|
|
663
|
+
declare const DatePicker: ({ label, name, value, onChange, required, format, helperText, placeholder, shortcutsItems, openPickerIcon: Icon, containerProps, error, disabled, minDate, maxDate, disablePast, disableFuture, shouldDisableDate, shouldDisableMonth, shouldDisableYear, className, onOpen, onClose, fullWidth, ...rest }: DatePickerProps) => react_jsx_runtime.JSX.Element;
|
|
660
664
|
|
|
661
665
|
type DateTimePickerViews = 'year' | 'month' | 'day' | 'hours' | 'minutes' | 'seconds';
|
|
662
666
|
type DateTimeFormat = 'yyyy' | 'MMMM yyyy' | 'MMM yyyy' | 'dd MMMM yyyy' | 'dd/MM/yyyy' | 'MM/dd/yyyy' | 'yyyy-MM-dd' | 'yyyy-MM-dd hh:mm a' | 'dd MMM yyyy hh:mm a' | 'dd/MM/yyyy hh:mm a' | 'yyyy-MM-dd hh:mm:ss a' | 'dd MMM yyyy hh:mm:ss a' | 'dd/MM/yyyy hh:mm:ss a' | 'hh:mm a' | 'hh:mm:ss a' | 'MMM dd, yyyy hh:mm a' | 'MMM dd, yyyy hh:mm:ss a' | 'EEE, MMM dd yyyy' | 'EEEE, MMMM dd, yyyy';
|
|
663
667
|
type DateTimePickerProps = {
|
|
664
|
-
label?: React
|
|
668
|
+
label?: React.ReactNode | string;
|
|
665
669
|
name?: string;
|
|
666
670
|
value?: Date;
|
|
667
671
|
onChange?: (date: Date | undefined) => void;
|
|
@@ -674,8 +678,8 @@ type DateTimePickerProps = {
|
|
|
674
678
|
getValue: () => Date;
|
|
675
679
|
}[];
|
|
676
680
|
required?: boolean;
|
|
677
|
-
containerProps?: React
|
|
678
|
-
openPickerIcon?: React
|
|
681
|
+
containerProps?: React.HTMLAttributes<HTMLDivElement>;
|
|
682
|
+
openPickerIcon?: React.ReactNode;
|
|
679
683
|
error?: any;
|
|
680
684
|
disabled?: boolean;
|
|
681
685
|
minDate?: Date;
|
|
@@ -688,10 +692,11 @@ type DateTimePickerProps = {
|
|
|
688
692
|
className?: string;
|
|
689
693
|
onOpen?: () => void;
|
|
690
694
|
onClose?: () => void;
|
|
691
|
-
onBlur?: React
|
|
695
|
+
onBlur?: React.FocusEventHandler;
|
|
696
|
+
fullWidth?: boolean;
|
|
692
697
|
[key: string]: any;
|
|
693
698
|
};
|
|
694
|
-
declare const DateTimePicker: ({ label, name, value, onChange, required, format, views, helperText, placeholder, shortcutsItems, openPickerIcon: Icon, containerProps, error, disabled, minDate, maxDate, disablePast, disableFuture, shouldDisableDate, shouldDisableMonth, shouldDisableYear, className, onOpen, onClose, ...rest }: DateTimePickerProps) => react_jsx_runtime.JSX.Element;
|
|
699
|
+
declare const DateTimePicker: ({ label, name, value, onChange, required, format, views, helperText, placeholder, shortcutsItems, openPickerIcon: Icon, containerProps, error, disabled, minDate, maxDate, disablePast, disableFuture, shouldDisableDate, shouldDisableMonth, shouldDisableYear, className, onOpen, onClose, fullWidth, ...rest }: DateTimePickerProps) => react_jsx_runtime.JSX.Element;
|
|
695
700
|
|
|
696
701
|
type FileUploadProps = {
|
|
697
702
|
label: string;
|
|
@@ -847,8 +852,9 @@ type PasswordFieldProps = {
|
|
|
847
852
|
error?: boolean;
|
|
848
853
|
helperText?: string;
|
|
849
854
|
className?: string;
|
|
855
|
+
fullWidth?: boolean;
|
|
850
856
|
} & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'>;
|
|
851
|
-
declare const PasswordField: ({ name, label, value, onChange, required, containerProps, description, placeholder, disabled, error, helperText, className, ...rest }: PasswordFieldProps) => react_jsx_runtime.JSX.Element;
|
|
857
|
+
declare const PasswordField: ({ name, label, value, onChange, required, containerProps, description, placeholder, disabled, error, helperText, className, fullWidth, ...rest }: PasswordFieldProps) => react_jsx_runtime.JSX.Element;
|
|
852
858
|
|
|
853
859
|
type RadioGroupProps = {
|
|
854
860
|
containerProps?: React.HTMLAttributes<HTMLDivElement>;
|
|
@@ -957,6 +963,19 @@ interface SwitchProps extends React$1.ComponentPropsWithoutRef<typeof Switch$1>
|
|
|
957
963
|
}
|
|
958
964
|
declare const Switch: React$1.ForwardRefExoticComponent<SwitchProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
959
965
|
|
|
966
|
+
declare function Textarea$1({ className, ...props }: React$1.ComponentProps<'textarea'>): react_jsx_runtime.JSX.Element;
|
|
967
|
+
|
|
968
|
+
type TextareaProps = {
|
|
969
|
+
containerProps?: React$1.HTMLAttributes<HTMLDivElement>;
|
|
970
|
+
description?: string;
|
|
971
|
+
label?: React$1.ReactNode | string;
|
|
972
|
+
required?: boolean;
|
|
973
|
+
fullWidth?: boolean;
|
|
974
|
+
error?: boolean;
|
|
975
|
+
helperText?: React$1.ReactNode;
|
|
976
|
+
} & React$1.ComponentProps<typeof Textarea$1>;
|
|
977
|
+
declare const Textarea: ({ name, label, value, onChange, required, containerProps, description, fullWidth, className, error, helperText, ...rest }: TextareaProps) => react_jsx_runtime.JSX.Element;
|
|
978
|
+
|
|
960
979
|
declare function Input({ className, type, ...props }: React$1.ComponentProps<"input">): react_jsx_runtime.JSX.Element;
|
|
961
980
|
|
|
962
981
|
type TextFieldProps = {
|
|
@@ -966,8 +985,9 @@ type TextFieldProps = {
|
|
|
966
985
|
required?: boolean;
|
|
967
986
|
fullWidth?: boolean;
|
|
968
987
|
error?: boolean;
|
|
988
|
+
helperText?: React$1.ReactNode;
|
|
969
989
|
} & React$1.ComponentProps<typeof Input>;
|
|
970
|
-
declare const TextField: ({ name, label, value, onChange, required, containerProps, description, fullWidth, className, error, ...rest }: TextFieldProps) => react_jsx_runtime.JSX.Element;
|
|
990
|
+
declare const TextField: ({ name, label, value, onChange, required, containerProps, description, fullWidth, className, error, helperText, ...rest }: TextFieldProps) => react_jsx_runtime.JSX.Element;
|
|
971
991
|
|
|
972
992
|
interface SideMenuItemProps {
|
|
973
993
|
name: string;
|
|
@@ -982,6 +1002,51 @@ interface SubMenuData {
|
|
|
982
1002
|
path: string;
|
|
983
1003
|
permissionKey?: string;
|
|
984
1004
|
}
|
|
1005
|
+
interface MenuState {
|
|
1006
|
+
menu: SideMenuItemProps[];
|
|
1007
|
+
title: string | null;
|
|
1008
|
+
path: string | null;
|
|
1009
|
+
}
|
|
1010
|
+
interface GetActiveMenuProps {
|
|
1011
|
+
menu: SideMenuItemProps[];
|
|
1012
|
+
pathArray: string[];
|
|
1013
|
+
previousMenuState: any;
|
|
1014
|
+
}
|
|
1015
|
+
interface InternalMenuClickHandlerProps {
|
|
1016
|
+
menuTitle: string;
|
|
1017
|
+
menuPath: string;
|
|
1018
|
+
internalMenu: SideMenuItemProps[];
|
|
1019
|
+
}
|
|
1020
|
+
interface SidebarNavigationHook {
|
|
1021
|
+
menuPosition: number;
|
|
1022
|
+
currentMenuState: MenuState;
|
|
1023
|
+
history: MenuState[];
|
|
1024
|
+
internalMenuClickHandler: (params: InternalMenuClickHandlerProps) => void;
|
|
1025
|
+
previousMenuClickHandler: () => void;
|
|
1026
|
+
}
|
|
1027
|
+
interface MenuItemProps {
|
|
1028
|
+
index: number;
|
|
1029
|
+
menuItem: SideMenuItemProps;
|
|
1030
|
+
currentMenuPath: string | null;
|
|
1031
|
+
internalMenuClickHandler: (params: InternalMenuClickHandlerProps) => void;
|
|
1032
|
+
onClose?: () => void;
|
|
1033
|
+
collapsed?: boolean;
|
|
1034
|
+
setCollapsed?: any;
|
|
1035
|
+
}
|
|
1036
|
+
interface SubMenuItemProps {
|
|
1037
|
+
index: number;
|
|
1038
|
+
subMenuItem: SubMenuData;
|
|
1039
|
+
subMenuButtonPath: string;
|
|
1040
|
+
}
|
|
1041
|
+
interface MenuBarProps {
|
|
1042
|
+
currentMenuState: MenuState;
|
|
1043
|
+
menuPosition: number;
|
|
1044
|
+
internalMenuClickHandler: (params: InternalMenuClickHandlerProps) => void;
|
|
1045
|
+
previousMenuClickHandler: () => void;
|
|
1046
|
+
onClose?: () => void;
|
|
1047
|
+
collapsed?: boolean;
|
|
1048
|
+
setCollapsed?: any;
|
|
1049
|
+
}
|
|
985
1050
|
|
|
986
1051
|
interface UserProfilePopupProps {
|
|
987
1052
|
/** User's full name */
|
|
@@ -1078,7 +1143,8 @@ declare const PageContent: ({ children, className }: PageContentProps) => react_
|
|
|
1078
1143
|
interface PageHeaderProps {
|
|
1079
1144
|
uniqueId?: string;
|
|
1080
1145
|
pathTrimCount: number;
|
|
1081
|
-
|
|
1146
|
+
breadcrumbAction?: ReactElement;
|
|
1147
|
+
searchBarProps?: SearchBarProps;
|
|
1082
1148
|
filterButtonProps?: {
|
|
1083
1149
|
label?: string;
|
|
1084
1150
|
startIcon?: ReactNode;
|
|
@@ -1094,13 +1160,14 @@ interface PageHeaderProps {
|
|
|
1094
1160
|
}) => ReactNode[]);
|
|
1095
1161
|
};
|
|
1096
1162
|
}
|
|
1097
|
-
declare const PageHeader: ({ uniqueId, pathTrimCount,
|
|
1163
|
+
declare const PageHeader: ({ uniqueId, pathTrimCount, breadcrumbAction, searchBarProps, filterButtonProps, addButtonProps, actionProps, }: PageHeaderProps) => react_jsx_runtime.JSX.Element;
|
|
1098
1164
|
|
|
1099
1165
|
type BreadcrumbsProps = {
|
|
1100
1166
|
pathTrimCount: number;
|
|
1101
1167
|
containerClassName?: string;
|
|
1168
|
+
action?: ReactElement;
|
|
1102
1169
|
};
|
|
1103
|
-
declare const Breadcrumbs: ({ pathTrimCount, containerClassName, }: BreadcrumbsProps) => react_jsx_runtime.JSX.Element;
|
|
1170
|
+
declare const Breadcrumbs: ({ pathTrimCount, containerClassName, action, }: BreadcrumbsProps) => react_jsx_runtime.JSX.Element;
|
|
1104
1171
|
|
|
1105
1172
|
interface CalendarEvent {
|
|
1106
1173
|
id: string | number;
|
|
@@ -1497,5 +1564,5 @@ declare const splitBreadcrumbIdSlug: (param: string) => {
|
|
|
1497
1564
|
declare const isLocal: boolean;
|
|
1498
1565
|
declare const isDevelopment: boolean;
|
|
1499
1566
|
|
|
1500
|
-
export { Accordion, ActivityLogView, Alert, AnimatedGIFs, AppLayout, Breadcrumbs, Button, Calendar, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, Card$1 as CardRoot, CardTitle, Chip, Chips, CircularAvatar, ComingSoon, ConfirmDialog, DataTable, DatePicker, DateTimePicker, Dialog, DialogButton, DropDownButton, DropDownIcon, DropdownMenu, DropdownMenuItem, EmptyIllustration, FileUpload, FormActions, FormControlWrapper, FormWrapper, HorizontalBarChart, HorizontalStepper, IconButtons, Icons, InternalServerError, LabelWrapper, LineChart, MenuToggleButton, MultiCheckBox, MultiSelect, NoInterneConnection, NoItemFound, OtpInput, PageContent, PageHeader, PageNotFound, PasswordField, PieChart, PreviewFiles, RadioGroup, ReactJoyRide, ResourceNotFound, SearchBar, Select, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, SidebarProvider, SingleCheckBox, SingleSelect, Skeleton, Snackbar, Spinner, StatusCard, Stepper, Svgs, Switch, TablePagination, TabsContainer, TextField, Timeline, Tooltip, Typography, UnAuthorized, UploadDialog, UserProfilePopup, VerticalBarChart, VerticalStepper, buttonVariants, calculateEventStats, cn, createBreadcrumbIdSlug, exportEventsToCSV, filterEventsByDateRange, generateBusinessEvents, generateRecurringEvents, getBreadcrumbsCharacter, groupEventsByDate, isDevelopment, isLocal, reactBlueprintReducers, splitBreadcrumbIdSlug, typographyVariants, useMediaQuery, usePageHeader, useParams, useSidebar, useUrlParams, validateEvent };
|
|
1501
|
-
export type { AccordionItemProps, Activity, ActivityAction, AlertProps, AppLayoutProps, BarChartData, BarChartProps, BarChartVariant, BreadcrumbsProps, ButtonConfig, ButtonProps, CalendarDateClickInfo, CalendarDateSelectInfo, CalendarEvent, CalendarEventClickInfo, CalendarEventDropInfo, CalendarEventResizeInfo, CalendarHeaderToolbar, CalendarProps, CalendarView, CardProps, ChartConfig, CheckboxProps, ChipProps, CircularAvatarProps, ConfirmDialogProps, ConfirmDialogType, DataTableProps, DatePickerProps, DateTimePickerProps, DialogButtonProps, DialogProps, DropdownMenuItemProps, DropdownMenuProps, EventStats, FileUploadProps, FormActionsProps, HelpDocsAction, HelpDocsConfig, HorizontalBarChartProps, IconComponent, IconProps, IconsType, LabelWrapperProps, LineChartProps, MaxWidthSize$1 as MaxWidthSize, MultiCheckboxProps, MultiSelectProps, OtpInputProps, PageHeaderProps, PaginationProps, PasswordFieldProps, PieChartProps, PreviewFilesProps, RadioGroupProps, RecurringEventConfig, SearchBarProps, SelectProps, Severity, SingleSelectProps, SnackbarPosition, SnackbarProps, StatusCardProps, StepItem, StepperProps, StepperVariantProps, SwitchProps, TabsContainerProps, TextFieldProps, TimelineItems, TimelineProps, TooltipProps, TreeMapProps, TypographyProps, UploadDialogProps, VerticalBarChartProps };
|
|
1567
|
+
export { Accordion, ActivityLogView, Alert, AnimatedGIFs, AppLayout, Breadcrumbs, Button, Calendar, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, Card$1 as CardRoot, CardTitle, Chip, Chips, CircularAvatar, ComingSoon, ConfirmDialog, DataTable, DatePicker, DateTimePicker, Dialog, DialogButton, DropDownButton, DropDownIcon, DropdownMenu, DropdownMenuItem, EmptyIllustration, FileUpload, FormActions, FormControlWrapper, FormWrapper, HorizontalBarChart, HorizontalStepper, IconButtons, Icons, InternalServerError, LabelWrapper, LineChart, MenuToggleButton, MultiCheckBox, MultiSelect, NoInterneConnection, NoItemFound, OtpInput, PageContent, PageHeader, PageNotFound, PasswordField, PieChart, PreviewFiles, RadioGroup, ReactJoyRide, ResourceNotFound, SearchBar, Select, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, SidebarProvider, SingleCheckBox, SingleSelect, Skeleton, Snackbar, Spinner, StatusCard, Stepper, Svgs, Switch, TablePagination, TabsContainer, TextField, Textarea, Timeline, Tooltip, Typography, UnAuthorized, UploadDialog, UserProfilePopup, VerticalBarChart, VerticalStepper, buttonVariants, calculateEventStats, cn, createBreadcrumbIdSlug, exportEventsToCSV, filterEventsByDateRange, generateBusinessEvents, generateRecurringEvents, getBreadcrumbsCharacter, groupEventsByDate, isDevelopment, isLocal, reactBlueprintReducers, splitBreadcrumbIdSlug, typographyVariants, useMediaQuery, usePageHeader, useParams, useSidebar, useUrlParams, validateEvent };
|
|
1568
|
+
export type { AccordionItemProps, Activity, ActivityAction, AlertProps, AppLayoutProps, BarChartData, BarChartProps, BarChartVariant, BreadcrumbsProps, ButtonConfig, ButtonProps, CalendarDateClickInfo, CalendarDateSelectInfo, CalendarEvent, CalendarEventClickInfo, CalendarEventDropInfo, CalendarEventResizeInfo, CalendarHeaderToolbar, CalendarProps, CalendarView, CardProps, ChartConfig, CheckboxProps, ChipProps, CircularAvatarProps, ConfirmDialogProps, ConfirmDialogType, DataTableProps, DatePickerProps, DateTimePickerProps, DialogButtonProps, DialogProps, DropdownMenuItemProps, DropdownMenuProps, EventStats, FileUploadProps, FormActionsProps, GetActiveMenuProps, HelpDocsAction, HelpDocsConfig, HorizontalBarChartProps, IconComponent, IconProps, IconsType, InternalMenuClickHandlerProps, LabelWrapperProps, LineChartProps, MaxWidthSize$1 as MaxWidthSize, MenuBarProps, MenuItemProps, MenuState, MultiCheckboxProps, MultiSelectProps, OtpInputProps, PageHeaderProps, PaginationProps, PasswordFieldProps, PieChartProps, PreviewFilesProps, RadioGroupProps, RecurringEventConfig, SearchBarProps, SelectProps, Severity, SideMenuItemProps, SidebarNavigationHook, SingleSelectProps, SnackbarPosition, SnackbarProps, StatusCardProps, StepItem, StepperProps, StepperVariantProps, SubMenuData, SubMenuItemProps, SwitchProps, TabsContainerProps, TextFieldProps, TextareaProps, TimelineItems, TimelineProps, TooltipProps, TreeMapProps, TypographyProps, UploadDialogProps, VerticalBarChartProps };
|
package/dist/styles.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! tailwindcss v4.1.
|
|
1
|
+
/*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */
|
|
2
2
|
@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&display=swap');
|
|
3
3
|
@layer properties;
|
|
4
4
|
@layer theme, base, components, utilities;
|
|
@@ -495,9 +495,6 @@
|
|
|
495
495
|
.my-6 {
|
|
496
496
|
margin-block: calc(var(--spacing) * 6);
|
|
497
497
|
}
|
|
498
|
-
.mt-0 {
|
|
499
|
-
margin-top: calc(var(--spacing) * 0);
|
|
500
|
-
}
|
|
501
498
|
.mt-0\.5 {
|
|
502
499
|
margin-top: calc(var(--spacing) * 0.5);
|
|
503
500
|
}
|
|
@@ -603,6 +600,9 @@
|
|
|
603
600
|
.table-row {
|
|
604
601
|
display: table-row;
|
|
605
602
|
}
|
|
603
|
+
.field-sizing-content {
|
|
604
|
+
field-sizing: content;
|
|
605
|
+
}
|
|
606
606
|
.aspect-square {
|
|
607
607
|
aspect-ratio: 1 / 1;
|
|
608
608
|
}
|
|
@@ -629,6 +629,10 @@
|
|
|
629
629
|
width: calc(var(--spacing) * 4);
|
|
630
630
|
height: calc(var(--spacing) * 4);
|
|
631
631
|
}
|
|
632
|
+
.size-5 {
|
|
633
|
+
width: calc(var(--spacing) * 5);
|
|
634
|
+
height: calc(var(--spacing) * 5);
|
|
635
|
+
}
|
|
632
636
|
.size-8 {
|
|
633
637
|
width: calc(var(--spacing) * 8);
|
|
634
638
|
height: calc(var(--spacing) * 8);
|
|
@@ -790,6 +794,9 @@
|
|
|
790
794
|
.min-h-4 {
|
|
791
795
|
min-height: calc(var(--spacing) * 4);
|
|
792
796
|
}
|
|
797
|
+
.min-h-16 {
|
|
798
|
+
min-height: calc(var(--spacing) * 16);
|
|
799
|
+
}
|
|
793
800
|
.min-h-\[2rem\] {
|
|
794
801
|
min-height: 2rem;
|
|
795
802
|
}
|
|
@@ -3100,11 +3107,6 @@
|
|
|
3100
3107
|
margin-inline: calc(var(--spacing) * 0);
|
|
3101
3108
|
}
|
|
3102
3109
|
}
|
|
3103
|
-
.md\:mt-2 {
|
|
3104
|
-
@media (width >= 48rem) {
|
|
3105
|
-
margin-top: calc(var(--spacing) * 2);
|
|
3106
|
-
}
|
|
3107
|
-
}
|
|
3108
3110
|
.md\:block {
|
|
3109
3111
|
@media (width >= 48rem) {
|
|
3110
3112
|
display: block;
|
|
@@ -3652,11 +3654,6 @@
|
|
|
3652
3654
|
border-bottom-right-radius: calc(var(--radius) - 2px);
|
|
3653
3655
|
}
|
|
3654
3656
|
}
|
|
3655
|
-
.\[\&\:not\(\:first-child\)\]\:mt-6 {
|
|
3656
|
-
&:not(:first-child) {
|
|
3657
|
-
margin-top: calc(var(--spacing) * 6);
|
|
3658
|
-
}
|
|
3659
|
-
}
|
|
3660
3657
|
.\[\&\:nth-child\(2\)\[data-selected\=true\]_button\]\:rounded-l-md {
|
|
3661
3658
|
&:nth-child(2)[data-selected=true] button {
|
|
3662
3659
|
border-top-left-radius: calc(var(--radius) - 2px);
|
package/package.json
CHANGED
|
@@ -51,6 +51,9 @@ type DataTableProps<TData = any> = {
|
|
|
51
51
|
) => void;
|
|
52
52
|
selectionActions?: React.ReactNode[];
|
|
53
53
|
|
|
54
|
+
// Row click handler
|
|
55
|
+
onRowClick?: (params: { row: Row<TData> }) => void;
|
|
56
|
+
|
|
54
57
|
// Sorting props
|
|
55
58
|
enableSorting?: boolean;
|
|
56
59
|
sortingState?: SortingState;
|
|
@@ -106,6 +109,7 @@ const DataTable = <TData extends Record<string, any> = any>(
|
|
|
106
109
|
cellClassName,
|
|
107
110
|
isLoading = false,
|
|
108
111
|
columnVisibilityModel,
|
|
112
|
+
onRowClick,
|
|
109
113
|
} = props;
|
|
110
114
|
|
|
111
115
|
// Get layout mode and column visibility from Redux if tableActionProps is provided
|
|
@@ -290,6 +294,7 @@ const DataTable = <TData extends Record<string, any> = any>(
|
|
|
290
294
|
totalCount={totalCount}
|
|
291
295
|
onPageChange={onPageChange}
|
|
292
296
|
onLimitChange={onLimitChange}
|
|
297
|
+
onRowClick={onRowClick}
|
|
293
298
|
/>
|
|
294
299
|
)}
|
|
295
300
|
</div>
|
|
@@ -29,6 +29,7 @@ interface TableViewProps<TData = any> {
|
|
|
29
29
|
totalCount?: number;
|
|
30
30
|
onPageChange?: (page: number) => void;
|
|
31
31
|
onLimitChange?: (limit: number) => void;
|
|
32
|
+
onRowClick?: (params: { row: Row<TData> }) => void;
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
const TableView = React.forwardRef<HTMLDivElement, TableViewProps>(
|
|
@@ -48,6 +49,7 @@ const TableView = React.forwardRef<HTMLDivElement, TableViewProps>(
|
|
|
48
49
|
totalCount,
|
|
49
50
|
onPageChange,
|
|
50
51
|
onLimitChange,
|
|
52
|
+
onRowClick,
|
|
51
53
|
},
|
|
52
54
|
ref,
|
|
53
55
|
) => {
|
|
@@ -131,14 +133,16 @@ const TableView = React.forwardRef<HTMLDivElement, TableViewProps>(
|
|
|
131
133
|
className={rowHeightClass}
|
|
132
134
|
>
|
|
133
135
|
{/* Use visible header columns count to render correct number of skeleton cells */}
|
|
134
|
-
{table
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
136
|
+
{table
|
|
137
|
+
.getHeaderGroups()[0]
|
|
138
|
+
?.headers.map((_: any, cellIndex: number) => (
|
|
139
|
+
<TableCell
|
|
140
|
+
key={`skeleton-cell-${rowIndex}-${cellIndex}`}
|
|
141
|
+
className={cn(cellIndex === 0 && 'pl-4', cellClassName)}
|
|
142
|
+
>
|
|
143
|
+
<Skeleton className="h-4 w-full" />
|
|
144
|
+
</TableCell>
|
|
145
|
+
))}
|
|
142
146
|
</TableRow>
|
|
143
147
|
))
|
|
144
148
|
) : table.getRowModel().rows?.length ? (
|
|
@@ -153,6 +157,7 @@ const TableView = React.forwardRef<HTMLDivElement, TableViewProps>(
|
|
|
153
157
|
key={row.id}
|
|
154
158
|
data-state={row.getIsSelected() && 'selected'}
|
|
155
159
|
className={cn(rowHeightClass, customRowClassName)}
|
|
160
|
+
onClick={() => onRowClick?.({ row })}
|
|
156
161
|
>
|
|
157
162
|
{row.getVisibleCells().map((cell: any, index: number) => (
|
|
158
163
|
<TableCell
|
|
@@ -103,7 +103,7 @@ export const ViewButton = ({
|
|
|
103
103
|
/>
|
|
104
104
|
|
|
105
105
|
<ConfirmDialog
|
|
106
|
-
message="Do you really want to delete
|
|
106
|
+
message="Do you really want to delete this view? This action cannot be undone."
|
|
107
107
|
isOpen={dialogOpen}
|
|
108
108
|
onCancel={() => {
|
|
109
109
|
setDialogOpen(false);
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
TriangleAlertIcon,
|
|
6
6
|
XIcon,
|
|
7
7
|
} from 'lucide-react';
|
|
8
|
-
import { useEffect
|
|
8
|
+
import { useEffect } from 'react';
|
|
9
9
|
import { Typography } from '../../DataDisplay/Typography/Typography';
|
|
10
10
|
import { Button } from '../../Input/Button/Button';
|
|
11
11
|
|
|
@@ -33,12 +33,9 @@ export const Snackbar = ({
|
|
|
33
33
|
anchorOrigin,
|
|
34
34
|
autoHideDuration,
|
|
35
35
|
}: SnackbarProps) => {
|
|
36
|
-
const [visible, setVisible] = useState(open);
|
|
37
|
-
|
|
38
36
|
useEffect(() => {
|
|
39
37
|
if (open && autoHideDuration) {
|
|
40
38
|
const timer = setTimeout(() => {
|
|
41
|
-
setVisible(false);
|
|
42
39
|
if (onClose) {
|
|
43
40
|
onClose('timeout');
|
|
44
41
|
}
|
|
@@ -61,13 +58,12 @@ export const Snackbar = ({
|
|
|
61
58
|
};
|
|
62
59
|
|
|
63
60
|
const handleClose = () => {
|
|
64
|
-
setVisible(false);
|
|
65
61
|
if (onClose) {
|
|
66
62
|
onClose('clickaway');
|
|
67
63
|
}
|
|
68
64
|
};
|
|
69
65
|
|
|
70
|
-
if (!
|
|
66
|
+
if (!open) return null;
|
|
71
67
|
|
|
72
68
|
const vertical = anchorOrigin?.vertical || 'top';
|
|
73
69
|
const horizontal = anchorOrigin?.horizontal || 'center';
|
|
@@ -83,12 +79,13 @@ export const Snackbar = ({
|
|
|
83
79
|
|
|
84
80
|
return (
|
|
85
81
|
<div
|
|
86
|
-
className={`fixed ${positionClasses} z-[9999] pointer-events-auto`}
|
|
82
|
+
className={`fixed ${positionClasses} z-[9999] pointer-events-auto w-fit max-w-lg`}
|
|
87
83
|
role="alert"
|
|
88
84
|
aria-live="polite"
|
|
89
85
|
>
|
|
90
86
|
<div
|
|
91
|
-
className={`group pointer-events-auto relative flex
|
|
87
|
+
className={`group pointer-events-auto relative flex bg-background items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all`}
|
|
88
|
+
style={{ minWidth: '350px' }}
|
|
92
89
|
data-sonner-toast=""
|
|
93
90
|
>
|
|
94
91
|
<div className="flex items-start gap-3 flex-1">
|