@grasp-labs/ds-react-components 0.13.0 → 0.14.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/dialog/Dialog.d.ts +3 -1
- package/dist/components/drawer/Drawer.d.ts +13 -0
- package/dist/components/drawer/index.d.ts +1 -0
- package/dist/components/errorBoundary/ErrorBoundary.d.ts +26 -0
- package/dist/components/errorBoundary/index.d.ts +1 -0
- package/dist/components/errorPage/ErrorPage.d.ts +11 -0
- package/dist/components/errorPage/index.d.ts +1 -0
- package/dist/components/jsonEditor/config.d.ts +3 -0
- package/dist/components/popover/Popover.d.ts +1 -3
- package/dist/components/portal/Portal.d.ts +10 -0
- package/dist/components/portal/index.d.ts +1 -0
- package/dist/components/spinner/CenteredSpinner.d.ts +12 -0
- package/dist/components/spinner/Spinner.d.ts +11 -0
- package/dist/components/spinner/index.d.ts +2 -0
- package/dist/components/table/Table.d.ts +1 -21
- package/dist/components/table/index.d.ts +3 -3
- package/dist/components/table/types.d.ts +16 -0
- package/dist/components/toast/Toaster.d.ts +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useDropdownPosition.d.ts +12 -0
- package/dist/{index-CQ7w5dl6.js → index-CDEDmkC7.js} +3184 -2896
- package/dist/index.css +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/{index.esm-DgyjJxy1.js → index.esm-BRuCtMqY.js} +1 -1
- package/dist/index.js +92 -85
- package/dist/tailwind-styles.css +35 -77
- package/package.json +4 -4
|
@@ -10,6 +10,8 @@ export type DialogProps = {
|
|
|
10
10
|
closeOnEscape?: boolean;
|
|
11
11
|
/** Whether to show close button in header */
|
|
12
12
|
showClose?: boolean;
|
|
13
|
+
/** Accessible label for the close button */
|
|
14
|
+
closeButtonAriaLabel?: string;
|
|
13
15
|
/** Additional CSS classes for the dialog backdrop */
|
|
14
16
|
backdropClassName?: string;
|
|
15
17
|
/** Size variant for the dialog */
|
|
@@ -28,4 +30,4 @@ export type DialogProps = {
|
|
|
28
30
|
* @param props - The props for the Dialog component
|
|
29
31
|
* @returns A modal dialog with backdrop
|
|
30
32
|
*/
|
|
31
|
-
export declare const Dialog: ({ isOpen, onClose, closeOnBackdropClick, closeOnEscape, showClose, backdropClassName, size, className, title, headerActions, footerActions, children, headerClassName, bodyClassName, footerClassName, }: DialogProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
33
|
+
export declare const Dialog: ({ isOpen, onClose, closeOnBackdropClick, closeOnEscape, showClose, closeButtonAriaLabel, backdropClassName, size, className, title, headerActions, footerActions, children, headerClassName, bodyClassName, footerClassName, }: DialogProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CardProps } from '../card/Card';
|
|
2
|
+
export type DrawerProps = {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
placement?: "top" | "right" | "bottom" | "left";
|
|
6
|
+
size?: "sm" | "lg";
|
|
7
|
+
closeOnBackdropClick?: boolean;
|
|
8
|
+
showClose?: boolean;
|
|
9
|
+
closeButtonAriaLabel?: string;
|
|
10
|
+
drawerClassName?: string;
|
|
11
|
+
backdropClassName?: string;
|
|
12
|
+
} & Omit<CardProps, "className">;
|
|
13
|
+
export declare function Drawer({ isOpen, onClose, placement, size, closeOnBackdropClick, showClose, closeButtonAriaLabel, drawerClassName, backdropClassName, title, headerActions, footerActions, children, headerClassName, bodyClassName, footerClassName, }: DrawerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Drawer, type DrawerProps } from './Drawer';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { default as React, Component, ReactNode } from 'react';
|
|
2
|
+
export type ErrorBoundaryProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
fallback?: (error: Error, errorInfo: React.ErrorInfo | null) => ReactNode;
|
|
5
|
+
onError?: (error: Error, errorInfo: React.ErrorInfo) => void;
|
|
6
|
+
errorTitle?: string;
|
|
7
|
+
errorMessage?: string;
|
|
8
|
+
retryText?: string;
|
|
9
|
+
};
|
|
10
|
+
type ErrorBoundaryState = {
|
|
11
|
+
hasError: boolean;
|
|
12
|
+
error: Error | null;
|
|
13
|
+
errorInfo: React.ErrorInfo | null;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Error boundary component that catches JavaScript errors anywhere in the child component tree.
|
|
17
|
+
* Displays a fallback UI when an error occurs.
|
|
18
|
+
*/
|
|
19
|
+
export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
20
|
+
constructor(props: ErrorBoundaryProps);
|
|
21
|
+
static getDerivedStateFromError(error: Error): Partial<ErrorBoundaryState>;
|
|
22
|
+
componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
|
|
23
|
+
handleReset: () => void;
|
|
24
|
+
render(): ReactNode;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ErrorBoundary';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type ErrorPageProps = {
|
|
3
|
+
title?: string;
|
|
4
|
+
message?: string;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* A user-friendly error display component built with library components.
|
|
9
|
+
* Shows an error page when critical errors occur.
|
|
10
|
+
*/
|
|
11
|
+
export declare const ErrorPage: ({ title, message, children, }: ErrorPageProps) => React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ErrorPage';
|
|
@@ -25,8 +25,6 @@ export type PopoverProps = {
|
|
|
25
25
|
arrowClassName?: string;
|
|
26
26
|
/** Offset distance from the trigger element in pixels */
|
|
27
27
|
offset?: number;
|
|
28
|
-
/** Whether the popover should render via a React portal */
|
|
29
|
-
renderInPortal?: boolean;
|
|
30
28
|
/** Optional id applied to the popover panel */
|
|
31
29
|
id?: string;
|
|
32
30
|
/** ARIA role describing the type of popover */
|
|
@@ -57,4 +55,4 @@ export type PopoverProps = {
|
|
|
57
55
|
* @param props - The props for the Popover component
|
|
58
56
|
* @returns A popover with trigger and floating content
|
|
59
57
|
*/
|
|
60
|
-
export declare const Popover: ({ children, content, isOpen, onClose, closeOnClickOutside, closeOnEscape, placement, showArrow, triggerClassName, className, arrowClassName, offset,
|
|
58
|
+
export declare const Popover: ({ children, content, isOpen, onClose, closeOnClickOutside, closeOnEscape, placement, showArrow, triggerClassName, className, arrowClassName, offset, id, role, ariaLabel, ariaLabelledBy, ariaDescribedBy, initialFocusRef, returnFocusOnClose, }: PopoverProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type PortalProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
container?: Element | null;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* A portal component that renders children into a DOM node outside the parent hierarchy.
|
|
8
|
+
* SSR-safe: returns null during server-side rendering and initial client render to avoid hydration mismatches.
|
|
9
|
+
*/
|
|
10
|
+
export declare function Portal({ children, container }: PortalProps): import('react').ReactPortal | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Portal, type PortalProps } from './Portal';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React, SVGProps } from 'react';
|
|
2
|
+
type CenteredSpinnerProps = {
|
|
3
|
+
size?: number;
|
|
4
|
+
} & Omit<SVGProps<SVGSVGElement>, "width" | "height">;
|
|
5
|
+
/**
|
|
6
|
+
* CenteredSpinner component
|
|
7
|
+
*
|
|
8
|
+
* A full-page centered spinner for loading states that take over the entire viewport.
|
|
9
|
+
* Useful for initial page loads, route transitions, or full-page data fetching.
|
|
10
|
+
*/
|
|
11
|
+
export declare const CenteredSpinner: ({ size, ...props }: CenteredSpinnerProps) => React.JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React, SVGProps } from 'react';
|
|
2
|
+
type SpinnerProps = {
|
|
3
|
+
size?: number;
|
|
4
|
+
} & SVGProps<SVGSVGElement>;
|
|
5
|
+
/**
|
|
6
|
+
* Spinner component
|
|
7
|
+
*
|
|
8
|
+
* A reusable spinning loader component that can be used as an icon
|
|
9
|
+
*/
|
|
10
|
+
export declare const Spinner: ({ size, className, ...props }: SpinnerProps) => React.JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -1,25 +1,5 @@
|
|
|
1
|
-
import { PaginationState, TableOptions } from '@tanstack/react-table';
|
|
2
1
|
import { JSX } from 'react';
|
|
3
|
-
|
|
4
|
-
* Props for the Table component.
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
export type TableProps<T> = Omit<TableOptions<T>, "getCoreRowModel"> & {
|
|
8
|
-
className?: string;
|
|
9
|
-
scrollWrapperClassName?: string;
|
|
10
|
-
getCoreRowModel?: TableOptions<T>["getCoreRowModel"];
|
|
11
|
-
enableRowSelection?: boolean;
|
|
12
|
-
enableMultiRowSelection?: boolean;
|
|
13
|
-
enablePagination?: boolean;
|
|
14
|
-
paginationProps?: {
|
|
15
|
-
itemsPerPageOptions?: number[];
|
|
16
|
-
pagination?: PaginationState;
|
|
17
|
-
onPaginationChange?: (pagination: PaginationState) => void;
|
|
18
|
-
totalItems?: number;
|
|
19
|
-
itemsPerPageText?: string;
|
|
20
|
-
fromText?: string;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
2
|
+
import { TableProps } from './types';
|
|
23
3
|
/**
|
|
24
4
|
* A customizable table component using TanStack Table.
|
|
25
5
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
export { Pagination } from './components/Pagination';
|
|
2
|
+
export type { PaginationProps } from './components/Pagination';
|
|
1
3
|
export { default as Table } from './Table';
|
|
2
|
-
export type { TableProps } from './Table';
|
|
3
4
|
export { TableCell } from './TableCell';
|
|
4
5
|
export { TableHeaderCell } from './TableHeaderCell';
|
|
5
|
-
export {
|
|
6
|
-
export type { PaginationProps } from './components/Pagination';
|
|
6
|
+
export type { TableProps } from './types';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PaginationState, TableOptions } from '@tanstack/react-table';
|
|
2
|
+
export type TableProps<T> = Omit<TableOptions<T>, "state" | "getCoreRowModel" | "onPaginationChange" | "getPaginationRowModel" | "manualPagination" | "pageCount" | "autoResetPageIndex" | "onSortingChange" | "onRowSelectionChange"> & {
|
|
3
|
+
className?: string;
|
|
4
|
+
scrollWrapperClassName?: string;
|
|
5
|
+
getCoreRowModel?: TableOptions<T>["getCoreRowModel"];
|
|
6
|
+
enablePagination?: boolean;
|
|
7
|
+
paginationProps?: {
|
|
8
|
+
itemsPerPageOptions?: number[];
|
|
9
|
+
pagination?: PaginationState;
|
|
10
|
+
onPaginationChange?: (pagination: PaginationState) => void;
|
|
11
|
+
totalItems?: number;
|
|
12
|
+
itemsPerPageText?: string;
|
|
13
|
+
fromText?: string;
|
|
14
|
+
};
|
|
15
|
+
state?: Omit<TableOptions<T>["state"], "sorting" | "rowSelection" | "pagination">;
|
|
16
|
+
};
|
|
@@ -7,4 +7,4 @@ import { ToasterProps } from './types';
|
|
|
7
7
|
* of toasts. State management (adding, removing toasts) should be handled
|
|
8
8
|
* by the consuming application.
|
|
9
9
|
*/
|
|
10
|
-
export declare const Toaster: ({ toasts, onDismiss, maxToasts, className, }: ToasterProps) => import(
|
|
10
|
+
export declare const Toaster: ({ toasts, onDismiss, maxToasts, className, }: ToasterProps) => import("react/jsx-runtime").JSX.Element | null;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
export type DropdownPosition = {
|
|
3
|
+
top: number;
|
|
4
|
+
left: number;
|
|
5
|
+
width: number;
|
|
6
|
+
};
|
|
7
|
+
export type UseDropdownPositionOptions = {
|
|
8
|
+
isOpen: boolean;
|
|
9
|
+
triggerRef: RefObject<HTMLElement | null>;
|
|
10
|
+
maxHeight: number;
|
|
11
|
+
};
|
|
12
|
+
export declare const useDropdownPosition: ({ isOpen, triggerRef, maxHeight, }: UseDropdownPositionOptions) => DropdownPosition;
|