toast-23 1.0.2 → 2.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/LICENSE +21 -0
- package/README.md +113 -102
- package/dist/context.d.ts.map +1 -1
- package/dist/devtools.d.ts +24 -0
- package/dist/devtools.d.ts.map +1 -0
- package/dist/headless-store.d.ts +3 -0
- package/dist/headless-store.d.ts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +1464 -279
- package/dist/index.mjs.map +1 -1
- package/dist/inject-styles.d.ts +13 -0
- package/dist/inject-styles.d.ts.map +1 -0
- package/dist/notification.d.ts +4 -0
- package/dist/notification.d.ts.map +1 -0
- package/dist/provider.d.ts.map +1 -1
- package/dist/sound.d.ts +3 -0
- package/dist/sound.d.ts.map +1 -0
- package/dist/standalone.d.ts +14 -22
- package/dist/standalone.d.ts.map +1 -1
- package/dist/toast-23.css +1 -1
- package/dist/toast-container.d.ts +5 -5
- package/dist/toast-container.d.ts.map +1 -1
- package/dist/toast-item.d.ts +16 -3
- package/dist/toast-item.d.ts.map +1 -1
- package/dist/types.d.ts +137 -39
- package/dist/types.d.ts.map +1 -1
- package/dist/use-toast-headless.d.ts +14 -0
- package/dist/use-toast-headless.d.ts.map +1 -0
- package/dist/use-toast.d.ts.map +1 -1
- package/dist/utils.d.ts +4 -6
- package/dist/utils.d.ts.map +1 -1
- package/package.json +9 -4
package/dist/toast-23.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.toast23-container,.toast23-container *,.toast23-container *:before,.toast23-container *:after{box-sizing:border-box;margin:0;padding:0}.toast23-container{position:fixed;z-index:9999;display:flex;flex-direction:column;gap:.75rem;padding:1rem;pointer-events:none;max-height:100vh;overflow:hidden}.toast23-container--top-right{top:0;right:0}.toast23-container--top-left{top:0;left:0}.toast23-container--top-center{top:0;left:50%;transform:translate(-50%);align-items:center}.toast23-container--bottom-right{bottom:0;right:0;flex-direction:column-reverse}.toast23-container--bottom-left{bottom:0;left:0;flex-direction:column-reverse}.toast23-container--bottom-center{bottom:0;left:50%;transform:translate(-50%);flex-direction:column-reverse;align-items:center}.toast23-item{pointer-events:auto;position:relative;display:flex;align-items:flex-start;gap:.75rem;min-width:320px;max-width:26rem;padding:.875rem 1rem;border-radius:.75rem;border:1px solid;overflow:hidden;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;line-height:1.5;box-shadow:0 4px 6px -1px #00000014,0 2px 4px -2px #0000000d;transform:translate(0);opacity:1;transition:transform .3s cubic-bezier(.4,0,.2,1),opacity .3s cubic-bezier(.4,0,.2,1);cursor:default}.toast23-item:hover{box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000000f}.toast23-container--top-right .toast23-item--entering,.toast23-container--top-right .toast23-item--exiting,.toast23-container--bottom-right .toast23-item--entering,.toast23-container--bottom-right .toast23-item--exiting{transform:translate(calc(100% + 1rem));opacity:0}.toast23-container--top-left .toast23-item--entering,.toast23-container--top-left .toast23-item--exiting,.toast23-container--bottom-left .toast23-item--entering,.toast23-container--bottom-left .toast23-item--exiting{transform:translate(calc(-100% - 1rem));opacity:0}.toast23-container--top-center .toast23-item--entering,.toast23-container--top-center .toast23-item--exiting{transform:translateY(-100%);opacity:0}.toast23-container--bottom-center .toast23-item--entering,.toast23-container--bottom-center .toast23-item--exiting{transform:translateY(100%);opacity:0}.toast23-item--success{background:#f0fdf4f2;border-color:#bbf7d0}.toast23-item--error{background:#fef2f2f2;border-color:#fecaca}.toast23-item--warning{background:#fefce8f2;border-color:#fef08a}.toast23-item--info{background:#eff6fff2;border-color:#bfdbfe}.toast23-item--default,.toast23-item--loading{background:#f9fafbf2;border-color:#e5e7eb}@media(prefers-color-scheme:dark){.toast23-item--success{background:#16653440;border-color:#166534}.toast23-item--error{background:#991b1b40;border-color:#991b1b}.toast23-item--warning{background:#854d0e40;border-color:#854d0e}.toast23-item--info{background:#1e40af40;border-color:#1e40af}.toast23-item--default,.toast23-item--loading{background:#37415180;border-color:#4b5563}.toast23-title{color:#f9fafb!important}.toast23-message{color:#e5e7eb!important}.toast23-message--with-title{color:#d1d5db!important}.toast23-dismiss{color:#9ca3af!important}.toast23-dismiss:hover{color:#e5e7eb!important}.toast23-queue-badge{color:#d1d5db!important;background:#374151b3!important;border-color:#4b5563!important}}.dark .toast23-item--success{background:#16653440;border-color:#166534}.dark .toast23-item--error{background:#991b1b40;border-color:#991b1b}.dark .toast23-item--warning{background:#854d0e40;border-color:#854d0e}.dark .toast23-item--info{background:#1e40af40;border-color:#1e40af}.dark .toast23-item--default,.dark .toast23-item--loading{background:#37415180;border-color:#4b5563}.dark .toast23-title{color:#f9fafb}.dark .toast23-message{color:#e5e7eb}.dark .toast23-message--with-title{color:#d1d5db}.dark .toast23-dismiss{color:#9ca3af}.dark .toast23-dismiss:hover{color:#e5e7eb}.dark .toast23-queue-badge{color:#d1d5db;background:#374151b3;border-color:#4b5563}.toast23-icon{display:flex;align-items:center;flex-shrink:0;margin-top:1px}.toast23-icon--success{color:#22c55e}.toast23-icon--error{color:#ef4444}.toast23-icon--warning{color:#eab308}.toast23-icon--info{color:#3b82f6}.toast23-icon--default{color:#6b7280}.toast23-icon--loading{color:#3b82f6}.toast23-content{flex:1;min-width:0}.toast23-title{font-size:.875rem;font-weight:600;color:#111827;margin-bottom:.125rem;line-height:1.3}.toast23-message{font-size:.875rem;font-weight:500;color:#1f2937;word-break:break-word}.toast23-message--with-title{color:#6b7280;font-weight:400}.toast23-dismiss{display:flex;align-items:center;justify-content:center;flex-shrink:0;width:1.5rem;height:1.5rem;border:none;background:transparent;color:#9ca3af;cursor:pointer;border-radius:.25rem;transition:color .15s ease,background-color .15s ease;margin:-.125rem -.25rem 0 0;padding:0}.toast23-dismiss:hover{color:#374151;background:#0000000d}.toast23-dismiss:focus-visible{outline:2px solid #3b82f6;outline-offset:1px}.toast23-progress{position:absolute;bottom:0;left:0;height:3.5px;border-radius:0 0 0 .75rem}.toast23-progress--success{background:#22c55e}.toast23-progress--error{background:#ef4444}.toast23-progress--warning{background:#eab308}.toast23-progress--info{background:#3b82f6}.toast23-progress--default{background:#6b7280}.toast23-queue-badge{font-family:inherit;font-size:.75rem;font-weight:500;color:#6b7280;background:#fffc;border:1px solid #e5e7eb;border-radius:9999px;padding:.25rem .75rem;text-align:center;pointer-events:none;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}.toast23-spinner{animation:toast23-spin .7s linear infinite}@keyframes toast23-spin{to{transform:rotate(360deg)}}@media(max-width:480px){.toast23-container{padding:.75rem;left:0!important;right:0!important}.toast23-item{min-width:0;max-width:100%}}
|
|
1
|
+
:root{--toast23-z: 9999;--toast23-min-width: 320px;--toast23-max-width: 26rem;--toast23-radius: .75rem;--toast23-gap: .75rem;--toast23-padding: .875rem 1rem;--toast23-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;--toast23-shadow: 0 4px 6px -1px rgba(0, 0, 0, .08), 0 2px 4px -2px rgba(0, 0, 0, .05);--toast23-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -4px rgba(0, 0, 0, .06);--toast23-bg-default: rgba(249, 250, 251, .95);--toast23-bg-success: rgba(240, 253, 244, .95);--toast23-bg-error: rgba(254, 242, 242, .95);--toast23-bg-warning: rgba(254, 252, 232, .95);--toast23-bg-info: rgba(239, 246, 255, .95);--toast23-border-default: #e5e7eb;--toast23-border-success: #bbf7d0;--toast23-border-error: #fecaca;--toast23-border-warning: #fef08a;--toast23-border-info: #bfdbfe;--toast23-color-success: #22c55e;--toast23-color-error: #ef4444;--toast23-color-warning: #eab308;--toast23-color-info: #3b82f6;--toast23-color-default: #6b7280;--toast23-color-loading: #3b82f6;--toast23-text-title: #111827;--toast23-text-body: #1f2937;--toast23-text-muted: #6b7280;--toast23-action-bg: rgba(0, 0, 0, .06);--toast23-action-bg-hover: rgba(0, 0, 0, .1);--toast23-action-text: #111827;--toast23-cancel-bg: #d1d5db;--toast23-cancel-bg-hover: #9ca3af;--toast23-cancel-text: #111827;--toast23-queue-bg: rgba(255, 255, 255, .8);--toast23-enter-duration: .3s;--toast23-exit-duration: .3s;--toast23-easing: cubic-bezier(.4, 0, .2, 1)}.toast23-container,.toast23-container *,.toast23-container *:before,.toast23-container *:after{box-sizing:border-box;margin:0;padding:0}.toast23-container{position:fixed;z-index:var(--toast23-z);display:flex;flex-direction:column;gap:var(--toast23-gap);padding:1rem;pointer-events:none;max-height:100vh;overflow:visible}.toast23-container--inline{position:absolute;inset:0;height:100%;pointer-events:none}.toast23-container--top-right{top:0;right:0}.toast23-container--top-left{top:0;left:0}.toast23-container--top-center{top:0;left:50%;transform:translate(-50%);align-items:center}.toast23-container--bottom-right{bottom:0;right:0;flex-direction:column-reverse}.toast23-container--bottom-left{bottom:0;left:0;flex-direction:column-reverse}.toast23-container--bottom-center{bottom:0;left:50%;transform:translate(-50%);flex-direction:column-reverse;align-items:center}.toast23-container--rtl.toast23-container--top-right,.toast23-container--rtl.toast23-container--bottom-right{right:auto;left:0}.toast23-container--rtl.toast23-container--top-left,.toast23-container--rtl.toast23-container--bottom-left{left:auto;right:0}.toast23-item{pointer-events:auto;position:relative;display:flex;align-items:flex-start;gap:.75rem;min-width:var(--toast23-min-width);max-width:var(--toast23-max-width);padding:var(--toast23-padding);border-radius:var(--toast23-radius);overflow:hidden;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);font-family:var(--toast23-font);line-height:1.5;box-shadow:inset 0 0 0 1px var(--toast23-item-border, transparent),var(--toast23-shadow);transform:translate(0);opacity:1;transition:transform var(--toast23-enter-duration) var(--toast23-easing),opacity var(--toast23-enter-duration) var(--toast23-easing),box-shadow .15s ease;cursor:default;touch-action:pan-y}.toast23-item:hover{box-shadow:inset 0 0 0 1px var(--toast23-item-border, transparent),var(--toast23-shadow-hover)}.toast23-container--top-right .toast23-item--entering,.toast23-container--top-right .toast23-item--exiting,.toast23-container--bottom-right .toast23-item--entering,.toast23-container--bottom-right .toast23-item--exiting{transform:translate(calc(100% + 1rem));opacity:0}.toast23-container--top-left .toast23-item--entering,.toast23-container--top-left .toast23-item--exiting,.toast23-container--bottom-left .toast23-item--entering,.toast23-container--bottom-left .toast23-item--exiting{transform:translate(calc(-100% - 1rem));opacity:0}.toast23-container--top-center .toast23-item--entering,.toast23-container--top-center .toast23-item--exiting{transform:translateY(-100%);opacity:0}.toast23-container--bottom-center .toast23-item--entering,.toast23-container--bottom-center .toast23-item--exiting{transform:translateY(100%);opacity:0}.toast23-container--stack .toast23-item--stack{transition:transform .25s var(--toast23-easing),opacity .25s var(--toast23-easing),box-shadow .15s ease}.toast23-item--success{background:var(--toast23-bg-success);--toast23-item-border: var(--toast23-border-success)}.toast23-item--error{background:var(--toast23-bg-error);--toast23-item-border: var(--toast23-border-error)}.toast23-item--warning{background:var(--toast23-bg-warning);--toast23-item-border: var(--toast23-border-warning)}.toast23-item--info{background:var(--toast23-bg-info);--toast23-item-border: var(--toast23-border-info)}.toast23-item--default,.toast23-item--loading{background:var(--toast23-bg-default);--toast23-item-border: var(--toast23-border-default)}@media(prefers-color-scheme:dark){:root{--toast23-bg-default: rgba(55, 65, 81, .5);--toast23-bg-success: rgba(22, 101, 52, .25);--toast23-bg-error: rgba(153, 27, 27, .25);--toast23-bg-warning: rgba(133, 77, 14, .25);--toast23-bg-info: rgba(30, 64, 175, .25);--toast23-border-default: #4b5563;--toast23-border-success: #166534;--toast23-border-error: #991b1b;--toast23-border-warning: #854d0e;--toast23-border-info: #1e40af;--toast23-text-title: #f9fafb;--toast23-text-body: #e5e7eb;--toast23-text-muted: #d1d5db;--toast23-action-bg: rgba(255, 255, 255, .08);--toast23-action-bg-hover: rgba(255, 255, 255, .15);--toast23-action-text: #f9fafb;--toast23-cancel-bg: #374151;--toast23-cancel-bg-hover: #4b5563;--toast23-cancel-text: #f9fafb;--toast23-queue-bg: rgba(55, 65, 81, .7)}}.dark,.toast23-container--dark{--toast23-bg-default: rgba(55, 65, 81, .5);--toast23-bg-success: rgba(22, 101, 52, .25);--toast23-bg-error: rgba(153, 27, 27, .25);--toast23-bg-warning: rgba(133, 77, 14, .25);--toast23-bg-info: rgba(30, 64, 175, .25);--toast23-border-default: #4b5563;--toast23-border-success: #166534;--toast23-border-error: #991b1b;--toast23-border-warning: #854d0e;--toast23-border-info: #1e40af;--toast23-text-title: #f9fafb;--toast23-text-body: #e5e7eb;--toast23-text-muted: #d1d5db;--toast23-action-bg: rgba(255, 255, 255, .08);--toast23-action-bg-hover: rgba(255, 255, 255, .15);--toast23-action-text: #f9fafb;--toast23-cancel-bg: #374151;--toast23-cancel-bg-hover: #4b5563;--toast23-cancel-text: #f9fafb;--toast23-queue-bg: rgba(55, 65, 81, .7)}.toast23-container--light{--toast23-bg-default: rgba(249, 250, 251, .95);--toast23-bg-success: rgba(240, 253, 244, .95);--toast23-bg-error: rgba(254, 242, 242, .95);--toast23-bg-warning: rgba(254, 252, 232, .95);--toast23-bg-info: rgba(239, 246, 255, .95);--toast23-border-default: #e5e7eb;--toast23-border-success: #bbf7d0;--toast23-border-error: #fecaca;--toast23-border-warning: #fef08a;--toast23-border-info: #bfdbfe;--toast23-text-title: #111827;--toast23-text-body: #1f2937;--toast23-text-muted: #6b7280;--toast23-action-bg: rgba(0, 0, 0, .06);--toast23-action-bg-hover: rgba(0, 0, 0, .1);--toast23-action-text: #111827;--toast23-cancel-bg: #d1d5db;--toast23-cancel-bg-hover: #9ca3af;--toast23-cancel-text: #111827;--toast23-queue-bg: rgba(255, 255, 255, .8)}.toast23-icon{display:flex;align-items:center;flex-shrink:0;margin-top:1px}.toast23-icon--success{color:var(--toast23-color-success)}.toast23-icon--error{color:var(--toast23-color-error)}.toast23-icon--warning{color:var(--toast23-color-warning)}.toast23-icon--info{color:var(--toast23-color-info)}.toast23-icon--default{color:var(--toast23-color-default)}.toast23-icon--loading{color:var(--toast23-color-loading)}.toast23-content{flex:1;min-width:0}.toast23-title{font-size:.875rem;font-weight:600;color:var(--toast23-text-title);margin-bottom:.125rem;line-height:1.3}.toast23-message{font-size:.875rem;font-weight:500;color:var(--toast23-text-body);word-break:break-word}.toast23-message--with-title{color:var(--toast23-text-muted);font-weight:400}.toast23-actions{display:flex;gap:.375rem;align-items:center;flex-shrink:0;margin-left:.25rem}.toast23-item--confirm{flex-wrap:wrap;padding-right:2.5rem}.toast23-item--confirm .toast23-dismiss{position:absolute;top:.5rem;right:.5rem;margin:0}.toast23-item--confirm .toast23-actions{flex-basis:100%;margin-left:0;margin-top:.625rem;gap:.5rem;justify-content:stretch}.toast23-item--confirm .toast23-action{flex:1 1 0;justify-content:center;padding:.5rem .85rem;font-size:.875rem}.toast23-action{display:inline-flex;align-items:center;justify-content:center;padding:.3rem .65rem;border:none;background:var(--toast23-action-bg);color:var(--toast23-action-text);font:600 .8125rem var(--toast23-font);border-radius:.375rem;cursor:pointer;transition:background-color .15s ease;white-space:nowrap}.toast23-action:hover{background:var(--toast23-action-bg-hover)}.toast23-action:focus-visible{outline:2px solid var(--toast23-color-info);outline-offset:1px}.toast23-action--cancel{background:var(--toast23-cancel-bg);color:var(--toast23-cancel-text);font-weight:600}.toast23-action--cancel:hover{background:var(--toast23-cancel-bg-hover)}.toast23-action--confirm{background:var(--toast23-color-info);color:#fff;box-shadow:0 1px 2px #00000014,0 0 0 1px #0000000d}.toast23-action--confirm:hover{filter:brightness(1.08)}.toast23-action--confirm:active{filter:brightness(.95)}.toast23-dismiss{display:flex;align-items:center;justify-content:center;flex-shrink:0;width:1.5rem;height:1.5rem;border:none;background:transparent;color:var(--toast23-text-muted);cursor:pointer;border-radius:.25rem;transition:color .15s ease,background-color .15s ease;margin:-.125rem -.25rem 0 0;padding:0}.toast23-dismiss:hover{color:var(--toast23-text-title);background:#0000000d}.toast23-dismiss:focus-visible{outline:2px solid var(--toast23-color-info);outline-offset:1px}.toast23-progress{position:absolute;bottom:0;left:0;width:100%;height:3.5px;transform-origin:left center;will-change:transform;border-radius:0 0 0 var(--toast23-radius)}.toast23-container--rtl .toast23-progress{transform-origin:right center;left:auto;right:0;border-radius:0 0 var(--toast23-radius) 0}.toast23-progress--success{background:var(--toast23-color-success)}.toast23-progress--error{background:var(--toast23-color-error)}.toast23-progress--warning{background:var(--toast23-color-warning)}.toast23-progress--info{background:var(--toast23-color-info)}.toast23-progress--default{background:var(--toast23-color-default)}.toast23-queue-badge{font-family:inherit;font-size:.75rem;font-weight:500;color:var(--toast23-text-muted);background:var(--toast23-queue-bg);border:1px solid var(--toast23-border-default);border-radius:9999px;padding:.25rem .75rem;text-align:center;pointer-events:none;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}.toast23-spinner{animation:toast23-spin .7s linear infinite}@keyframes toast23-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.toast23-item,.toast23-item--entering,.toast23-item--exiting,.toast23-progress{transition-duration:1ms!important;transform:none!important}.toast23-item--entering,.toast23-item--exiting{opacity:0}.toast23-spinner{animation:none}}@media(max-width:480px){.toast23-container{padding:.75rem;left:0!important;right:0!important}.toast23-item{min-width:0;max-width:100%}}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { InternalToast, ToastPosition } from './types';
|
|
1
|
+
import { InternalToast, ToastDirection, ToastLayout, ToastPosition, ToastTheme } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* toast-23 — Positioned Toast Container
|
|
4
|
-
*
|
|
5
|
-
* Renders a group of toasts for a given screen position.
|
|
6
|
-
* Handles queue logic: only `maxVisible` non-exiting toasts are shown,
|
|
7
|
-
* plus any currently animating-out toasts.
|
|
8
4
|
*/
|
|
9
5
|
import * as React from "react";
|
|
10
6
|
interface ToastContainerProps {
|
|
11
7
|
position: ToastPosition;
|
|
12
8
|
toasts: InternalToast[];
|
|
13
9
|
maxVisible: number;
|
|
10
|
+
layout: ToastLayout;
|
|
11
|
+
dir: ToastDirection;
|
|
12
|
+
theme: ToastTheme;
|
|
13
|
+
inline: boolean;
|
|
14
14
|
}
|
|
15
15
|
export declare const ToastContainer: React.FC<ToastContainerProps>;
|
|
16
16
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast-container.d.ts","sourceRoot":"","sources":["../src/toast-container.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"toast-container.d.ts","sourceRoot":"","sources":["../src/toast-container.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,WAAW,EACX,aAAa,EACb,UAAU,EACX,MAAM,SAAS,CAAC;AAKjB,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,aAAa,CAAC;IACxB,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;IACpB,GAAG,EAAE,cAAc,CAAC;IACpB,KAAK,EAAE,UAAU,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAwExD,CAAC"}
|
package/dist/toast-item.d.ts
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
1
|
-
import { InternalToast } from './types';
|
|
1
|
+
import { InternalToast, ToastDirection } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* toast-23 — Individual Toast Component
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Hover behavior (by design): hovering REFILLS the progress bar to 100% and
|
|
6
|
+
* pauses the dismiss timer. Unhovering restarts the countdown from 100% over
|
|
7
|
+
* the full duration.
|
|
8
|
+
*
|
|
9
|
+
* Progress bar uses `transform: scaleX()` for GPU-accelerated animation.
|
|
10
|
+
* If `toast.progress` is set (0..1), the bar shows that determinate value
|
|
11
|
+
* instead of the auto-shrink animation.
|
|
7
12
|
*/
|
|
8
13
|
import * as React from "react";
|
|
9
14
|
interface ToastItemProps {
|
|
10
15
|
toast: InternalToast;
|
|
11
16
|
onDismiss: (id: string) => void;
|
|
12
17
|
onRemove: (id: string) => void;
|
|
18
|
+
globallyPaused: boolean;
|
|
19
|
+
swipeEnabled: boolean;
|
|
20
|
+
swipeThreshold: number;
|
|
21
|
+
stackIndex: number;
|
|
22
|
+
stackMode: boolean;
|
|
23
|
+
stackExpanded: boolean;
|
|
24
|
+
stackIsBottom: boolean;
|
|
25
|
+
dir: ToastDirection;
|
|
13
26
|
}
|
|
14
27
|
export declare const ToastItem: React.FC<ToastItemProps>;
|
|
15
28
|
export {};
|
package/dist/toast-item.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast-item.d.ts","sourceRoot":"","sources":["../src/toast-item.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"toast-item.d.ts","sourceRoot":"","sources":["../src/toast-item.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAyB7D,UAAU,cAAc;IACtB,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,GAAG,EAAE,cAAc,CAAC;CACrB;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAgW9C,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,69 +1,135 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
/** Visual variant of a toast notification. */
|
|
3
2
|
export type ToastVariant = "success" | "error" | "warning" | "info" | "default";
|
|
4
|
-
/** Screen position where toasts are rendered. */
|
|
5
3
|
export type ToastPosition = "top-right" | "top-left" | "top-center" | "bottom-right" | "bottom-left" | "bottom-center";
|
|
6
|
-
/**
|
|
4
|
+
/** Layout direction. Affects slide direction and progress-bar origin. */
|
|
5
|
+
export type ToastDirection = "ltr" | "rtl";
|
|
6
|
+
/** Color theme. `auto` follows `prefers-color-scheme`. */
|
|
7
|
+
export type ToastTheme = "auto" | "light" | "dark";
|
|
8
|
+
/** Action button rendered inside a toast. */
|
|
9
|
+
export interface ToastAction {
|
|
10
|
+
label: ReactNode;
|
|
11
|
+
/** Called when clicked. Receives a `dismiss` helper so the toast can be closed. */
|
|
12
|
+
onClick: (dismiss: () => void) => void;
|
|
13
|
+
/** Whether clicking the button auto-dismisses the toast. @default true */
|
|
14
|
+
dismissOnClick?: boolean;
|
|
15
|
+
/** Optional className for custom styling. */
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
7
18
|
export interface ToastOptions {
|
|
8
|
-
/** Provide a fixed id to update an existing toast or prevent duplicates. */
|
|
9
19
|
id?: string;
|
|
10
|
-
/** Optional heading displayed above the message. */
|
|
11
20
|
title?: string;
|
|
12
|
-
/** Visual variant. Defaults to `"default"`. */
|
|
13
21
|
variant?: ToastVariant;
|
|
14
|
-
/** Auto-dismiss duration in ms. `0` = persistent. Defaults to provider value. */
|
|
15
22
|
duration?: number;
|
|
16
|
-
/** Screen position override. Defaults to provider value. */
|
|
17
23
|
position?: ToastPosition;
|
|
18
|
-
/** Whether the user can manually dismiss the toast. Defaults to `true`. */
|
|
19
24
|
dismissible?: boolean;
|
|
20
|
-
/** Delay in ms before removing from DOM after dismiss
|
|
25
|
+
/** Delay in ms before removing from DOM after dismiss. @default 300 */
|
|
21
26
|
removeDelay?: number;
|
|
27
|
+
/** Action button (e.g. Undo). */
|
|
28
|
+
action?: ToastAction;
|
|
29
|
+
/** Secondary action button — typically used for cancel/decline. */
|
|
30
|
+
cancelAction?: ToastAction;
|
|
31
|
+
/** Called when the toast leaves state (dismissed manually, by timer, or programmatically). */
|
|
32
|
+
onDismiss?: () => void;
|
|
33
|
+
/** Group identifier — used by `dismissGroup` / `removeGroup`. */
|
|
34
|
+
group?: string;
|
|
35
|
+
/** Play a sound on display. Boolean uses default tone; string is variant override. @default false */
|
|
36
|
+
sound?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Fallback to an OS notification when the document is hidden. The first time
|
|
39
|
+
* a hidden-tab toast fires with this enabled, the browser's notification
|
|
40
|
+
* permission prompt may be shown. @default false
|
|
41
|
+
*/
|
|
42
|
+
fallbackToNotification?: boolean;
|
|
22
43
|
}
|
|
23
|
-
/** Options for `toast.promise()`. */
|
|
24
44
|
export interface PromiseOptions<T> {
|
|
25
|
-
/** Message shown while the promise is pending. */
|
|
26
45
|
loading: string;
|
|
27
|
-
/** Message on fulfillment. Can be a function receiving the resolved value. */
|
|
28
46
|
success: string | ((data: T) => string);
|
|
29
|
-
/** Message on rejection. Can be a function receiving the error. */
|
|
30
47
|
error: string | ((err: unknown) => string);
|
|
48
|
+
/**
|
|
49
|
+
* Optional progress reporter. Returns a function the caller invokes with a
|
|
50
|
+
* value 0..1 to update a determinate progress bar.
|
|
51
|
+
*/
|
|
52
|
+
progress?: (report: (pct: number) => void) => void;
|
|
31
53
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
54
|
+
export interface ConfirmOptions {
|
|
55
|
+
/** Label for the confirm button. @default "Confirm" */
|
|
56
|
+
confirmLabel?: ReactNode;
|
|
57
|
+
/** Label for the cancel button. @default "Cancel" */
|
|
58
|
+
cancelLabel?: ReactNode;
|
|
59
|
+
/** Variant of the toast. @default "warning" */
|
|
60
|
+
variant?: ToastVariant;
|
|
61
|
+
/** Title shown above the message. */
|
|
62
|
+
title?: string;
|
|
63
|
+
/** Position override. */
|
|
64
|
+
position?: ToastPosition;
|
|
65
|
+
}
|
|
66
|
+
/** The callable toast API. */
|
|
37
67
|
export interface ToastApi {
|
|
38
68
|
(message: string | ReactNode, options?: ToastOptions): string;
|
|
39
69
|
success: (message: string, options?: Omit<ToastOptions, "variant">) => string;
|
|
40
70
|
error: (message: string, options?: Omit<ToastOptions, "variant">) => string;
|
|
41
71
|
warning: (message: string, options?: Omit<ToastOptions, "variant">) => string;
|
|
42
72
|
info: (message: string, options?: Omit<ToastOptions, "variant">) => string;
|
|
43
|
-
/** Show a loading toast. Returns the toast id for later update. */
|
|
44
73
|
loading: (message: string, options?: Omit<ToastOptions, "variant">) => string;
|
|
45
|
-
/** Show a custom toast with JSX content and no default styles. */
|
|
46
74
|
custom: (content: ReactNode, options?: Omit<ToastOptions, "variant">) => string;
|
|
47
|
-
/** Tracks an async operation with loading → success / error transitions. */
|
|
48
75
|
promise: <T>(promise: Promise<T> | (() => Promise<T>), options: PromiseOptions<T>, toastOptions?: ToastOptions) => Promise<T>;
|
|
49
|
-
/**
|
|
76
|
+
/** Confirmation toast — resolves with `true` (confirm) or `false` (cancel/dismiss). */
|
|
77
|
+
confirm: (message: string, options?: ConfirmOptions) => Promise<boolean>;
|
|
50
78
|
dismiss: (id?: string) => void;
|
|
51
|
-
/** Instantly removes a toast from DOM (no exit animation). Omits id to remove all. */
|
|
52
79
|
remove: (id?: string) => void;
|
|
80
|
+
/** Dismiss every toast in a group. */
|
|
81
|
+
dismissGroup: (group: string) => void;
|
|
82
|
+
/** Remove (instantly) every toast in a group. */
|
|
83
|
+
removeGroup: (group: string) => void;
|
|
84
|
+
/** Pauses every active toast's timer. */
|
|
85
|
+
pauseAll: () => void;
|
|
86
|
+
/** Resumes timers paused via `pauseAll`. */
|
|
87
|
+
resumeAll: () => void;
|
|
88
|
+
/** Read the history of dismissed toasts (newest first). */
|
|
89
|
+
history: () => ReadonlyArray<ToastHistoryEntry>;
|
|
53
90
|
}
|
|
54
|
-
/**
|
|
91
|
+
/** Layout mode for the toast column. */
|
|
92
|
+
export type ToastLayout = "default" | "stack";
|
|
55
93
|
export interface Toast23ProviderProps {
|
|
56
94
|
children: ReactNode;
|
|
57
|
-
/** Maximum number of simultaneously visible toasts. @default 5 */
|
|
58
95
|
maxVisible?: number;
|
|
59
|
-
/** Default position on screen. @default "top-right" */
|
|
60
96
|
position?: ToastPosition;
|
|
61
|
-
/** Default auto-dismiss duration in ms. @default 5000 */
|
|
62
97
|
duration?: number;
|
|
98
|
+
/** Layout mode. `stack` collapses background toasts and expands on hover. @default "default" */
|
|
99
|
+
layout?: ToastLayout;
|
|
100
|
+
/** Layout direction. @default "ltr" */
|
|
101
|
+
dir?: ToastDirection;
|
|
102
|
+
/**
|
|
103
|
+
* Force a color theme. `"auto"` follows the OS `prefers-color-scheme` and
|
|
104
|
+
* any ancestor `.dark` class. Use `"dark"` or `"light"` when toasts portal
|
|
105
|
+
* outside the consumer's theme wrapper. @default "auto"
|
|
106
|
+
*/
|
|
107
|
+
theme?: ToastTheme;
|
|
108
|
+
/** Where to render the toast portal. `null` = `document.body`. Pass an element for inline mode. */
|
|
109
|
+
target?: HTMLElement | null;
|
|
110
|
+
/** Number of dismissed toasts to retain in history. @default 50 */
|
|
111
|
+
historySize?: number;
|
|
112
|
+
/** Keyboard shortcut to focus the toast container. @default "F8" — set to null to disable */
|
|
113
|
+
focusShortcut?: string | null;
|
|
114
|
+
/** Swipe distance (px) past which a swipe dismisses the toast. @default 80 */
|
|
115
|
+
swipeThreshold?: number;
|
|
116
|
+
/** Whether swipe-to-dismiss is enabled. @default true */
|
|
117
|
+
swipeEnabled?: boolean;
|
|
118
|
+
/** Default `sound` option applied to every toast. @default false */
|
|
119
|
+
sound?: boolean;
|
|
120
|
+
/** Default `fallbackToNotification` for every toast. @default false */
|
|
121
|
+
fallbackToNotification?: boolean;
|
|
122
|
+
}
|
|
123
|
+
/** Single entry in the dismissed-toast history log. */
|
|
124
|
+
export interface ToastHistoryEntry {
|
|
125
|
+
id: string;
|
|
126
|
+
message: string | ReactNode;
|
|
127
|
+
title?: string;
|
|
128
|
+
variant: ToastVariant;
|
|
129
|
+
dismissedAt: number;
|
|
130
|
+
group?: string;
|
|
63
131
|
}
|
|
64
|
-
/** Extended variant that includes the internal "loading" state. */
|
|
65
132
|
export type InternalVariant = ToastVariant | "loading";
|
|
66
|
-
/** Full internal representation of a toast stored in state. */
|
|
67
133
|
export interface InternalToast {
|
|
68
134
|
id: string;
|
|
69
135
|
message: string | ReactNode;
|
|
@@ -72,18 +138,29 @@ export interface InternalToast {
|
|
|
72
138
|
duration: number;
|
|
73
139
|
position: ToastPosition;
|
|
74
140
|
dismissible: boolean;
|
|
75
|
-
/** Delay in ms before DOM removal after dismiss (exit animation time). */
|
|
76
141
|
removeDelay: number;
|
|
77
|
-
/** True once the provider has started the exit animation. */
|
|
78
142
|
isExiting: boolean;
|
|
79
|
-
/** Epoch timestamp when the toast was created. */
|
|
80
143
|
createdAt: number;
|
|
81
|
-
/** Increments on update — used to reset progress bar animation. */
|
|
82
144
|
version: number;
|
|
83
|
-
/** When true, renders as a custom toast with no default styling. */
|
|
84
145
|
isCustom?: boolean;
|
|
146
|
+
action?: ToastAction;
|
|
147
|
+
cancelAction?: ToastAction;
|
|
148
|
+
onDismiss?: () => void;
|
|
149
|
+
group?: string;
|
|
150
|
+
sound?: boolean;
|
|
151
|
+
fallbackToNotification?: boolean;
|
|
152
|
+
/** Determinate progress value 0..1, or undefined for indeterminate. */
|
|
153
|
+
progress?: number;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Per-provider external store backing the headless hook and DevTools.
|
|
157
|
+
* Created by each provider so multiple providers/instances stay isolated.
|
|
158
|
+
*/
|
|
159
|
+
export interface HeadlessStore {
|
|
160
|
+
publish: (next: ReadonlyArray<InternalToast>) => void;
|
|
161
|
+
getSnapshot: () => ReadonlyArray<InternalToast>;
|
|
162
|
+
subscribe: (listener: () => void) => () => void;
|
|
85
163
|
}
|
|
86
|
-
/** Reducer action types. */
|
|
87
164
|
export type ToasterAction = {
|
|
88
165
|
type: "ADD";
|
|
89
166
|
toast: InternalToast;
|
|
@@ -100,19 +177,40 @@ export type ToasterAction = {
|
|
|
100
177
|
} | {
|
|
101
178
|
type: "UPSERT";
|
|
102
179
|
toast: InternalToast;
|
|
180
|
+
} | {
|
|
181
|
+
type: "DISMISS_GROUP";
|
|
182
|
+
group: string;
|
|
183
|
+
} | {
|
|
184
|
+
type: "REMOVE_GROUP";
|
|
185
|
+
group: string;
|
|
103
186
|
};
|
|
104
|
-
/** Shape of the internal context value. */
|
|
105
187
|
export interface ToasterContextValue {
|
|
106
|
-
addToast: (message: string | ReactNode, options?: ToastOptions & {
|
|
188
|
+
addToast: (message: string | ReactNode, options?: Omit<ToastOptions, "variant"> & {
|
|
189
|
+
variant?: InternalVariant;
|
|
107
190
|
isCustom?: boolean;
|
|
108
191
|
}) => string;
|
|
109
|
-
updateToast: (id: string, updates: Partial<
|
|
192
|
+
updateToast: (id: string, updates: Partial<InternalToast>) => void;
|
|
110
193
|
dismissToast: (id?: string) => void;
|
|
111
194
|
removeToast: (id?: string) => void;
|
|
195
|
+
dismissGroup: (group: string) => void;
|
|
196
|
+
removeGroup: (group: string) => void;
|
|
197
|
+
pauseAll: () => void;
|
|
198
|
+
resumeAll: () => void;
|
|
199
|
+
history: () => ReadonlyArray<ToastHistoryEntry>;
|
|
200
|
+
/** Per-provider store powering `useToast23Headless` and `Toast23DevTools`. */
|
|
201
|
+
headlessStore: HeadlessStore;
|
|
112
202
|
config: {
|
|
113
203
|
maxVisible: number;
|
|
114
204
|
position: ToastPosition;
|
|
115
205
|
duration: number;
|
|
206
|
+
layout: ToastLayout;
|
|
207
|
+
dir: ToastDirection;
|
|
208
|
+
theme: ToastTheme;
|
|
209
|
+
swipeThreshold: number;
|
|
210
|
+
swipeEnabled: boolean;
|
|
211
|
+
sound: boolean;
|
|
212
|
+
fallbackToNotification: boolean;
|
|
116
213
|
};
|
|
214
|
+
isPausedGlobally: boolean;
|
|
117
215
|
}
|
|
118
216
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;AAEhF,MAAM,MAAM,aAAa,GACrB,WAAW,GACX,UAAU,GACV,YAAY,GACZ,cAAc,GACd,aAAa,GACb,eAAe,CAAC;AAEpB,yEAAyE;AACzE,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,KAAK,CAAC;AAE3C,0DAA0D;AAC1D,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAEnD,6CAA6C;AAC7C,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,SAAS,CAAC;IACjB,mFAAmF;IACnF,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IACvC,0EAA0E;IAC1E,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,CAAC,EAAE,MAAM,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,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAChD,8EAA8E;IAC9E,aAAa,EAAE,aAAa,CAAC;IAC7B,MAAM,EAAE;QACN,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,aAAa,CAAC;QACxB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,WAAW,CAAC;QACpB,GAAG,EAAE,cAAc,CAAC;QACpB,KAAK,EAAE,UAAU,CAAC;QAClB,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,OAAO,CAAC;QACtB,KAAK,EAAE,OAAO,CAAC;QACf,sBAAsB,EAAE,OAAO,CAAC;KACjC,CAAC;IACF,gBAAgB,EAAE,OAAO,CAAC;CAC3B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { InternalToast, ToastHistoryEntry } from './types';
|
|
2
|
+
export interface HeadlessApi {
|
|
3
|
+
toasts: ReadonlyArray<InternalToast>;
|
|
4
|
+
dismiss: (id?: string) => void;
|
|
5
|
+
remove: (id?: string) => void;
|
|
6
|
+
dismissGroup: (group: string) => void;
|
|
7
|
+
removeGroup: (group: string) => void;
|
|
8
|
+
pauseAll: () => void;
|
|
9
|
+
resumeAll: () => void;
|
|
10
|
+
history: () => ReadonlyArray<ToastHistoryEntry>;
|
|
11
|
+
isPausedGlobally: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function useToast23Headless(): HeadlessApi;
|
|
14
|
+
//# sourceMappingURL=use-toast-headless.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-toast-headless.d.ts","sourceRoot":"","sources":["../src/use-toast-headless.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEhE,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IACrC,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAChD,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED,wBAAgB,kBAAkB,IAAI,WAAW,CA0BhD"}
|
package/dist/use-toast.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-toast.d.ts","sourceRoot":"","sources":["../src/use-toast.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"use-toast.d.ts","sourceRoot":"","sources":["../src/use-toast.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAGV,QAAQ,EAET,MAAM,SAAS,CAAC;AAIjB,wBAAgB,QAAQ,IAAI,QAAQ,CAqJnC"}
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* toast-23 — Utility helpers
|
|
3
3
|
*/
|
|
4
|
-
/**
|
|
5
|
-
* Generates a unique toast id.
|
|
6
|
-
* Works in SSR (no dependency on `crypto`).
|
|
7
|
-
*/
|
|
8
4
|
export declare function generateId(): string;
|
|
5
|
+
export declare function cx(...args: (string | false | null | undefined | 0)[]): string;
|
|
9
6
|
/**
|
|
10
|
-
*
|
|
7
|
+
* Returns the swipe-axis sign for a position: -1 means swipe-left dismisses,
|
|
8
|
+
* +1 means swipe-right dismisses. Top/bottom-center positions allow either.
|
|
11
9
|
*/
|
|
12
|
-
export declare function
|
|
10
|
+
export declare function getSwipeDirection(position: string): -1 | 0 | 1;
|
|
13
11
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED,wBAAgB,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,GAAG,CAAC,CAAC,EAAE,GAAG,MAAM,CAE7E;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAI9D"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "toast-23",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "A lightweight, accessible, fully-typed React toast notification library with zero dependencies.",
|
|
5
|
-
"author": "",
|
|
5
|
+
"author": "Thabit S (Its-sultan)",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=18"
|
|
10
|
+
},
|
|
8
11
|
"main": "./dist/index.cjs",
|
|
9
12
|
"module": "./dist/index.mjs",
|
|
10
13
|
"types": "./dist/index.d.ts",
|
|
@@ -23,7 +26,8 @@
|
|
|
23
26
|
},
|
|
24
27
|
"files": [
|
|
25
28
|
"dist",
|
|
26
|
-
"
|
|
29
|
+
"README.md",
|
|
30
|
+
"LICENSE"
|
|
27
31
|
],
|
|
28
32
|
"sideEffects": [
|
|
29
33
|
"*.css"
|
|
@@ -71,7 +75,8 @@
|
|
|
71
75
|
],
|
|
72
76
|
"repository": {
|
|
73
77
|
"type": "git",
|
|
74
|
-
"url": "git+https://github.com/Its-sultan/toast-23.git"
|
|
78
|
+
"url": "git+https://github.com/Its-sultan/toast-23.git",
|
|
79
|
+
"directory": "toast-23-lib"
|
|
75
80
|
},
|
|
76
81
|
"homepage": "https://github.com/Its-sultan/toast-23",
|
|
77
82
|
"bugs": {
|