goey-toast 0.1.4 → 0.2.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/README.md +51 -13
- package/dist/index.cjs +314 -83
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +68 -60
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.js +314 -83
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -11,10 +11,13 @@
|
|
|
11
11
|
- Promise toasts with loading → success/error transitions
|
|
12
12
|
- Action buttons with optional success label morph-back
|
|
13
13
|
- Description body supporting strings and React components
|
|
14
|
-
- Configurable
|
|
14
|
+
- Configurable display duration and bounce intensity
|
|
15
15
|
- Custom fill color, border color, and border width
|
|
16
16
|
- CSS class overrides via `classNames` prop
|
|
17
|
-
-
|
|
17
|
+
- 6 positions with automatic horizontal mirroring for right-side positions
|
|
18
|
+
- Center positions with symmetric morph animation
|
|
19
|
+
- Hover pause: hovering an expanded toast pauses the dismiss timer
|
|
20
|
+
- Hover re-expand: hovering a collapsed pill re-expands the toast
|
|
18
21
|
- Pre-dismiss collapse animation
|
|
19
22
|
|
|
20
23
|
## Installation
|
|
@@ -103,6 +106,8 @@ Options passed as the second argument to `goeyToast()` and type-specific methods
|
|
|
103
106
|
| `borderColor` | `string` | Border color of the blob |
|
|
104
107
|
| `borderWidth` | `number` | Border width in px (default 1.5) |
|
|
105
108
|
| `timing` | `GoeyToastTimings` | Animation timing overrides |
|
|
109
|
+
| `spring` | `boolean` | Enable spring/bounce animations (default `true`) |
|
|
110
|
+
| `bounce` | `number` | Spring intensity from `0.05` (subtle) to `0.8` (dramatic), default `0.4` |
|
|
106
111
|
|
|
107
112
|
### `GoeyToastAction`
|
|
108
113
|
|
|
@@ -118,9 +123,6 @@ Fine-tune animation speeds per toast.
|
|
|
118
123
|
|
|
119
124
|
| Property | Type | Default | Description |
|
|
120
125
|
| ------------------ | -------- | ------- | ------------------------------------ |
|
|
121
|
-
| `expandDelay` | `number` | 330 | Milliseconds before expand starts |
|
|
122
|
-
| `expandDuration` | `number` | 0.9 | Seconds for pill-to-blob morph |
|
|
123
|
-
| `collapseDuration` | `number` | 0.9 | Seconds for blob-to-pill morph |
|
|
124
126
|
| `displayDuration` | `number` | 4000 | Milliseconds toast stays expanded |
|
|
125
127
|
|
|
126
128
|
### `GoeyToastClassNames`
|
|
@@ -144,12 +146,14 @@ Props for the `<GoeyToaster />` component.
|
|
|
144
146
|
|
|
145
147
|
| Prop | Type | Default | Description |
|
|
146
148
|
| ------------ | ------------------------------------- | ---------------- | --------------------------------------------- |
|
|
147
|
-
| `position` | `'top-left' \| 'top-right' \| 'bottom-left' \| 'bottom-right'` | `'bottom-right'` | Toast position
|
|
149
|
+
| `position` | `'top-left' \| 'top-center' \| 'top-right' \| 'bottom-left' \| 'bottom-center' \| 'bottom-right'` | `'bottom-right'` | Toast position |
|
|
148
150
|
| `duration` | `number` | -- | Default display duration in ms |
|
|
149
151
|
| `gap` | `number` | `14` | Gap between stacked toasts (px) |
|
|
150
152
|
| `offset` | `number \| string` | `'24px'` | Distance from screen edge |
|
|
151
153
|
| `theme` | `'light' \| 'dark'` | `'light'` | Color theme |
|
|
152
154
|
| `toastOptions` | `Partial<ExternalToast>` | -- | Default options passed to Sonner |
|
|
155
|
+
| `spring` | `boolean` | `true` | Enable spring/bounce animations globally |
|
|
156
|
+
| `bounce` | `number` | `0.4` | Spring intensity: `0.05` (subtle) to `0.8` (dramatic) |
|
|
153
157
|
|
|
154
158
|
### `GoeyPromiseData<T>`
|
|
155
159
|
|
|
@@ -167,6 +171,8 @@ Configuration for `goeyToast.promise()`.
|
|
|
167
171
|
| `borderColor` | `string` | No | Border color of the blob |
|
|
168
172
|
| `borderWidth` | `number` | No | Border width in px |
|
|
169
173
|
| `timing` | `GoeyToastTimings` | No | Animation timing overrides |
|
|
174
|
+
| `spring` | `boolean` | No | Enable spring/bounce animations (default `true`) |
|
|
175
|
+
| `bounce` | `number` | No | Spring intensity: `0.05` (subtle) to `0.8` (dramatic), default `0.4` |
|
|
170
176
|
|
|
171
177
|
**`description` sub-fields:**
|
|
172
178
|
|
|
@@ -259,20 +265,52 @@ goeyToast.success('Styled!', {
|
|
|
259
265
|
})
|
|
260
266
|
```
|
|
261
267
|
|
|
262
|
-
###
|
|
268
|
+
### Display Duration
|
|
263
269
|
|
|
264
270
|
```tsx
|
|
265
271
|
goeyToast.success('Saved', {
|
|
266
272
|
description: 'Your changes have been synced.',
|
|
267
|
-
timing: {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
+
timing: { displayDuration: 5000 },
|
|
274
|
+
})
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### Disabling Spring Animations
|
|
278
|
+
|
|
279
|
+
Disable bounce/spring animations for a cleaner, more subtle look:
|
|
280
|
+
|
|
281
|
+
```tsx
|
|
282
|
+
// Per-toast: disable spring for this toast only
|
|
283
|
+
goeyToast.success('Saved', {
|
|
284
|
+
description: 'Your changes have been synced.',
|
|
285
|
+
spring: false,
|
|
273
286
|
})
|
|
287
|
+
|
|
288
|
+
// Globally: disable spring for all toasts
|
|
289
|
+
<GoeyToaster spring={false} />
|
|
274
290
|
```
|
|
275
291
|
|
|
292
|
+
When `spring` is `false`, all spring-based animations (landing squish, blob squish, morph transitions, pill resize, header squish) use smooth ease-in-out curves instead. Error shake animations still work regardless of this setting.
|
|
293
|
+
|
|
294
|
+
### Bounce Intensity
|
|
295
|
+
|
|
296
|
+
Control how dramatic the spring effect feels with a single `bounce` value:
|
|
297
|
+
|
|
298
|
+
```tsx
|
|
299
|
+
// Subtle, barely-there spring
|
|
300
|
+
goeyToast.success('Saved', { bounce: 0.1 })
|
|
301
|
+
|
|
302
|
+
// Default feel
|
|
303
|
+
goeyToast.success('Saved', { bounce: 0.4 })
|
|
304
|
+
|
|
305
|
+
// Jelly mode
|
|
306
|
+
goeyToast.success('Saved', { bounce: 0.8 })
|
|
307
|
+
|
|
308
|
+
// Set globally via GoeyToaster
|
|
309
|
+
<GoeyToaster bounce={0.6} />
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
The `bounce` value (0.05 to 0.8) controls spring stiffness, damping, and squish magnitude together so you get a consistent feel from one number.
|
|
313
|
+
|
|
276
314
|
## Exports
|
|
277
315
|
|
|
278
316
|
```ts
|