Skip to content

Commit

Permalink
chore: update typing
Browse files Browse the repository at this point in the history
  • Loading branch information
fkhadra committed Dec 16, 2024
1 parent f0b1911 commit 23648a2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/ProgressBar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import cx from 'clsx';

import { Default, isFn, Type } from './../utils';
import { Default, isFn, Type } from '../utils';
import { Theme, ToastClassName, TypeOptions } from '../types';

export interface ProgressBarProps {
Expand Down
13 changes: 11 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export type Theme = 'light' | 'dark' | 'colored' | (string & {});

export type ToastPosition = 'top-right' | 'top-center' | 'top-left' | 'bottom-right' | 'bottom-center' | 'bottom-left';

export type CloseToastFunc = (reason?: boolean | string) => void;
export type CloseToastFunc = ((reason?: boolean | string) => void) & ((e: React.MouseEvent) => void);

export interface ToastContentProps<Data = unknown> {
closeToast: CloseToastFunc;
Expand Down Expand Up @@ -152,6 +152,12 @@ interface CommonOptions {
*/
theme?: Theme;

/**
* When set to `true` the built-in progress bar won't be rendered at all. Autoclose delay won't have any effect as well
* This is only used when you want to replace the progress bar with your own.
*
* See https://stackblitz.com/edit/react-toastify-custom-progress-bar?file=src%2FApp.tsx for an example.
*/
customProgressBar?: boolean;
}

Expand Down Expand Up @@ -197,13 +203,16 @@ export interface ToastOptions<Data = unknown> extends CommonOptions {
/**
* Set the percentage for the controlled progress bar. `Value must be between 0 and 1.`
*/
progress?: number | string;
progress?: number;

/**
* Let you provide any data, useful when you are using your own component
*/
data?: Data;

/**
* Let you specify the aria-label
*/
ariaLabel?: string;

/**
Expand Down

0 comments on commit 23648a2

Please sign in to comment.