diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b7d764..8b174c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,15 @@ ### Features +- 4.2.0 + + - Refactored entire codebase to TypeScript. + - Switched from yarn to pnpm to manage package dependencies. + - Bundle Size reduced to 4 KB + - No change to the package API or features. Everything should work as before. + - 4.2.0-beta.0 - - Refactored entire codebase to TypeScript. + - Refactored entire codebase to TypeScript. - Switched from yarn to pnpm to manage package dependencies. - Bundle Size reduced to 4 KB - No change to the package API or features. Everything should work as before. @@ -22,6 +29,7 @@ - 4.0.0 - Breaking Change + - Hide the toast on Click Before: @@ -69,9 +77,9 @@ ```javascript cogoToast.success('This is a success message.', { - onClick: hide => { - hide(); - }, + onClick: (hide) => { + hide(); + }, }); ``` diff --git a/index.d.ts b/index.d.ts index 54d9c58..c08250a 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,4 +1,4 @@ -import { MouseEventHandler } from 'react'; +import { ReactNode, MouseEventHandler } from 'react'; export type CTOptions = Partial<{ hideAfter: number; @@ -25,9 +25,12 @@ export type HideToastFunction = () => void; export type CTReturn = Promise & { hide?: HideToastFunction }; -export type CTMethod = (message: string, options?: CTOptions) => CTReturn; +export type CTMethod = (message: string | ReactNode, options?: CTOptions) => CTReturn; -export type CTMainMethod = (message: string, options?: CTOptions & { type: string }) => CTReturn; +export type CTMainMethod = ( + message: string | ReactNode, + options?: CTOptions & { type: string }, +) => CTReturn; export type CToast = CTMainMethod & { success: CTMethod; @@ -44,3 +47,5 @@ declare namespace cogoToast { const warn: CTMethod; const error: CTMethod; } + +export default cogoToast; diff --git a/package.json b/package.json index 897de97..9c01089 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "cogo-toast", "description": "Beautiful, Zero Configuration, Toast Messages - Built with React", - "version": "4.2.0-beta.0", + "version": "4.2.0", "license": "MIT", "scripts": { "setup": "pnpm install && cd docs && pnpm install",