@zag-js/toast 0.2.3 → 0.2.5

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/index.d.ts CHANGED
@@ -2,9 +2,9 @@ import * as _zag_js_core from '@zag-js/core';
2
2
  import { Machine, StateMachine } from '@zag-js/core';
3
3
  import { RootProperties, CommonProperties, Direction, DirectionProperty, Context, RequiredBy, PropTypes, NormalizeProps } from '@zag-js/types';
4
4
 
5
- declare type Type = "success" | "error" | "loading" | "info" | "custom";
6
- declare type Placement = "top-start" | "top" | "top-end" | "bottom-start" | "bottom" | "bottom-end";
7
- declare type SharedContext = {
5
+ type Type = "success" | "error" | "loading" | "info" | "custom";
6
+ type Placement = "top-start" | "top" | "top-end" | "bottom-start" | "bottom" | "bottom-end";
7
+ type SharedContext = {
8
8
  /**
9
9
  * Whether to pause toast when the user leaves the browser tab
10
10
  */
@@ -14,7 +14,7 @@ declare type SharedContext = {
14
14
  */
15
15
  pauseOnInteraction?: boolean;
16
16
  };
17
- declare type ToastOptions = {
17
+ type ToastOptions = {
18
18
  /**
19
19
  * The unique id of the toast
20
20
  */
@@ -65,11 +65,11 @@ declare type ToastOptions = {
65
65
  */
66
66
  onUpdate?: VoidFunction;
67
67
  };
68
- declare type Options = Partial<ToastOptions>;
69
- declare type RenderOptions = Omit<ToastOptions, "render"> & {
68
+ type Options = Partial<ToastOptions>;
69
+ type RenderOptions = Omit<ToastOptions, "render"> & {
70
70
  dismiss(): void;
71
71
  };
72
- declare type MachineContext = SharedContext & RootProperties & CommonProperties & Omit<ToastOptions, "removeDelay"> & {
72
+ type MachineContext = SharedContext & RootProperties & CommonProperties & Omit<ToastOptions, "removeDelay"> & {
73
73
  /**
74
74
  * The duration for the toast to kept alive before it is removed.
75
75
  * Useful for exit transitions.
@@ -88,14 +88,14 @@ declare type MachineContext = SharedContext & RootProperties & CommonProperties
88
88
  */
89
89
  remaining: number;
90
90
  };
91
- declare type MachineState = {
91
+ type MachineState = {
92
92
  value: "active" | "active:temp" | "dismissing" | "inactive" | "persist";
93
93
  tags: "visible" | "paused" | "updating";
94
94
  };
95
- declare type State = StateMachine.State<MachineContext, MachineState>;
96
- declare type Send = StateMachine.Send;
97
- declare type Service = Machine<MachineContext, MachineState>;
98
- declare type GroupPublicContext = SharedContext & DirectionProperty & CommonProperties & {
95
+ type State = StateMachine.State<MachineContext, MachineState>;
96
+ type Send = StateMachine.Send;
97
+ type Service = Machine<MachineContext, MachineState>;
98
+ type GroupPublicContext = SharedContext & DirectionProperty & CommonProperties & {
99
99
  /**
100
100
  * The gutter or spacing between toasts
101
101
  */
@@ -113,29 +113,29 @@ declare type GroupPublicContext = SharedContext & DirectionProperty & CommonProp
113
113
  */
114
114
  offsets: string | Record<"left" | "right" | "bottom" | "top", string>;
115
115
  };
116
- declare type UserDefinedGroupContext = RequiredBy<GroupPublicContext, "id">;
117
- declare type GroupComputedContext = Readonly<{
116
+ type UserDefinedGroupContext = RequiredBy<GroupPublicContext, "id">;
117
+ type GroupComputedContext = Readonly<{
118
118
  /**
119
119
  * @computed
120
120
  * The total number of toasts in the group
121
121
  */
122
122
  readonly count: number;
123
123
  }>;
124
- declare type GroupPrivateContext = Context<{}>;
125
- declare type GroupMachineContext = GroupPublicContext & GroupComputedContext & GroupPrivateContext;
126
- declare type GroupState = StateMachine.State<GroupMachineContext>;
127
- declare type GroupSend = (event: StateMachine.Event<StateMachine.AnyEventObject>) => void;
128
- declare type MaybeFunction<Value, Args> = Value | ((arg: Args) => Value);
129
- declare type PromiseOptions<Value> = {
124
+ type GroupPrivateContext = Context<{}>;
125
+ type GroupMachineContext = GroupPublicContext & GroupComputedContext & GroupPrivateContext;
126
+ type GroupState = StateMachine.State<GroupMachineContext>;
127
+ type GroupSend = (event: StateMachine.Event<StateMachine.AnyEventObject>) => void;
128
+ type MaybeFunction<Value, Args> = Value | ((arg: Args) => Value);
129
+ type PromiseOptions<Value> = {
130
130
  loading: ToastOptions;
131
131
  success: MaybeFunction<ToastOptions, Value>;
132
132
  error: MaybeFunction<ToastOptions, Error>;
133
133
  };
134
- declare type GroupProps = {
134
+ type GroupProps = {
135
135
  placement: Placement;
136
136
  label?: string;
137
137
  };
138
- declare type Toaster = {
138
+ type Toaster = {
139
139
  count: number;
140
140
  isVisible(id: string): boolean;
141
141
  upsert(options: ToastOptions): string | undefined;
@@ -174,6 +174,855 @@ declare function groupMachine(userContext: UserDefinedGroupContext): _zag_js_cor
174
174
 
175
175
  declare function createToastMachine(options?: Options): _zag_js_core.Machine<MachineContext, MachineState, _zag_js_core.StateMachine.AnyEventObject>;
176
176
 
177
+ declare const anatomy: Omit<{
178
+ parts: <U extends string>(...parts: U[]) => Omit<{
179
+ parts: any;
180
+ extendWith: <V extends string>(...parts: V[]) => Omit<{
181
+ parts: any;
182
+ extendWith: <V_1 extends string>(...parts: V_1[]) => Omit<{
183
+ parts: any;
184
+ extendWith: <V_2 extends string>(...parts: V_2[]) => Omit<{
185
+ parts: any;
186
+ extendWith: <V_3 extends string>(...parts: V_3[]) => Omit<{
187
+ parts: any;
188
+ extendWith: <V_4 extends string>(...parts: V_4[]) => Omit<{
189
+ parts: any;
190
+ extendWith: <V_5 extends string>(...parts: V_5[]) => Omit<{
191
+ parts: any;
192
+ extendWith: <V_6 extends string>(...parts: V_6[]) => Omit<{
193
+ parts: any;
194
+ extendWith: <V_7 extends string>(...parts: V_7[]) => Omit<{
195
+ parts: any;
196
+ extendWith: <V_8 extends string>(...parts: V_8[]) => Omit<{
197
+ parts: any;
198
+ extendWith: <V_9 extends string>(...parts: V_9[]) => Omit<any, "parts">;
199
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6 | V_7 | V_8, {
200
+ selector: string;
201
+ attrs: Record<"data-scope" | "data-part", string>;
202
+ }>;
203
+ }, "parts">;
204
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6 | V_7, {
205
+ selector: string;
206
+ attrs: Record<"data-scope" | "data-part", string>;
207
+ }>;
208
+ }, "parts">;
209
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6, {
210
+ selector: string;
211
+ attrs: Record<"data-scope" | "data-part", string>;
212
+ }>;
213
+ }, "parts">;
214
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5, {
215
+ selector: string;
216
+ attrs: Record<"data-scope" | "data-part", string>;
217
+ }>;
218
+ }, "parts">;
219
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4, {
220
+ selector: string;
221
+ attrs: Record<"data-scope" | "data-part", string>;
222
+ }>;
223
+ }, "parts">;
224
+ build: () => Record<U | V | V_1 | V_2 | V_3, {
225
+ selector: string;
226
+ attrs: Record<"data-scope" | "data-part", string>;
227
+ }>;
228
+ }, "parts">;
229
+ build: () => Record<U | V | V_1 | V_2, {
230
+ selector: string;
231
+ attrs: Record<"data-scope" | "data-part", string>;
232
+ }>;
233
+ }, "parts">;
234
+ build: () => Record<U | V | V_1, {
235
+ selector: string;
236
+ attrs: Record<"data-scope" | "data-part", string>;
237
+ }>;
238
+ }, "parts">;
239
+ build: () => Record<U | V, {
240
+ selector: string;
241
+ attrs: Record<"data-scope" | "data-part", string>;
242
+ }>;
243
+ }, "parts">;
244
+ build: () => Record<U, {
245
+ selector: string;
246
+ attrs: Record<"data-scope" | "data-part", string>;
247
+ }>;
248
+ }, "parts">;
249
+ extendWith: <V_10 extends string>(...parts: V_10[]) => Omit<{
250
+ parts: <U extends string>(...parts: U[]) => Omit<{
251
+ parts: any;
252
+ extendWith: <V extends string>(...parts: V[]) => Omit<{
253
+ parts: any;
254
+ extendWith: <V_1 extends string>(...parts: V_1[]) => Omit<{
255
+ parts: any;
256
+ extendWith: <V_2 extends string>(...parts: V_2[]) => Omit<{
257
+ parts: any;
258
+ extendWith: <V_3 extends string>(...parts: V_3[]) => Omit<{
259
+ parts: any;
260
+ extendWith: <V_4 extends string>(...parts: V_4[]) => Omit<{
261
+ parts: any;
262
+ extendWith: <V_5 extends string>(...parts: V_5[]) => Omit<{
263
+ parts: any;
264
+ extendWith: <V_6 extends string>(...parts: V_6[]) => Omit<{
265
+ parts: any;
266
+ extendWith: <V_7 extends string>(...parts: V_7[]) => Omit<{
267
+ parts: any;
268
+ extendWith: <V_8 extends string>(...parts: V_8[]) => Omit<{
269
+ parts: any;
270
+ extendWith: <V_9 extends string>(...parts: V_9[]) => Omit<any, "parts">;
271
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6 | V_7 | V_8, {
272
+ selector: string;
273
+ attrs: Record<"data-scope" | "data-part", string>;
274
+ }>;
275
+ }, "parts">;
276
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6 | V_7, {
277
+ selector: string;
278
+ attrs: Record<"data-scope" | "data-part", string>;
279
+ }>;
280
+ }, "parts">;
281
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6, {
282
+ selector: string;
283
+ attrs: Record<"data-scope" | "data-part", string>;
284
+ }>;
285
+ }, "parts">;
286
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5, {
287
+ selector: string;
288
+ attrs: Record<"data-scope" | "data-part", string>;
289
+ }>;
290
+ }, "parts">;
291
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4, {
292
+ selector: string;
293
+ attrs: Record<"data-scope" | "data-part", string>;
294
+ }>;
295
+ }, "parts">;
296
+ build: () => Record<U | V | V_1 | V_2 | V_3, {
297
+ selector: string;
298
+ attrs: Record<"data-scope" | "data-part", string>;
299
+ }>;
300
+ }, "parts">;
301
+ build: () => Record<U | V | V_1 | V_2, {
302
+ selector: string;
303
+ attrs: Record<"data-scope" | "data-part", string>;
304
+ }>;
305
+ }, "parts">;
306
+ build: () => Record<U | V | V_1, {
307
+ selector: string;
308
+ attrs: Record<"data-scope" | "data-part", string>;
309
+ }>;
310
+ }, "parts">;
311
+ build: () => Record<U | V, {
312
+ selector: string;
313
+ attrs: Record<"data-scope" | "data-part", string>;
314
+ }>;
315
+ }, "parts">;
316
+ build: () => Record<U, {
317
+ selector: string;
318
+ attrs: Record<"data-scope" | "data-part", string>;
319
+ }>;
320
+ }, "parts">;
321
+ extendWith: <V_11 extends string>(...parts: V_11[]) => Omit<{
322
+ parts: <U extends string>(...parts: U[]) => Omit<{
323
+ parts: any;
324
+ extendWith: <V extends string>(...parts: V[]) => Omit<{
325
+ parts: any;
326
+ extendWith: <V_1 extends string>(...parts: V_1[]) => Omit<{
327
+ parts: any;
328
+ extendWith: <V_2 extends string>(...parts: V_2[]) => Omit<{
329
+ parts: any;
330
+ extendWith: <V_3 extends string>(...parts: V_3[]) => Omit<{
331
+ parts: any;
332
+ extendWith: <V_4 extends string>(...parts: V_4[]) => Omit<{
333
+ parts: any;
334
+ extendWith: <V_5 extends string>(...parts: V_5[]) => Omit<{
335
+ parts: any;
336
+ extendWith: <V_6 extends string>(...parts: V_6[]) => Omit<{
337
+ parts: any;
338
+ extendWith: <V_7 extends string>(...parts: V_7[]) => Omit<{
339
+ parts: any;
340
+ extendWith: <V_8 extends string>(...parts: V_8[]) => Omit<{
341
+ parts: any;
342
+ extendWith: <V_9 extends string>(...parts: V_9[]) => Omit<any, "parts">;
343
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6 | V_7 | V_8, {
344
+ selector: string;
345
+ attrs: Record<"data-scope" | "data-part", string>;
346
+ }>;
347
+ }, "parts">;
348
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6 | V_7, {
349
+ selector: string;
350
+ attrs: Record<"data-scope" | "data-part", string>;
351
+ }>;
352
+ }, "parts">;
353
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6, {
354
+ selector: string;
355
+ attrs: Record<"data-scope" | "data-part", string>;
356
+ }>;
357
+ }, "parts">;
358
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5, {
359
+ selector: string;
360
+ attrs: Record<"data-scope" | "data-part", string>;
361
+ }>;
362
+ }, "parts">;
363
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4, {
364
+ selector: string;
365
+ attrs: Record<"data-scope" | "data-part", string>;
366
+ }>;
367
+ }, "parts">;
368
+ build: () => Record<U | V | V_1 | V_2 | V_3, {
369
+ selector: string;
370
+ attrs: Record<"data-scope" | "data-part", string>;
371
+ }>;
372
+ }, "parts">;
373
+ build: () => Record<U | V | V_1 | V_2, {
374
+ selector: string;
375
+ attrs: Record<"data-scope" | "data-part", string>;
376
+ }>;
377
+ }, "parts">;
378
+ build: () => Record<U | V | V_1, {
379
+ selector: string;
380
+ attrs: Record<"data-scope" | "data-part", string>;
381
+ }>;
382
+ }, "parts">;
383
+ build: () => Record<U | V, {
384
+ selector: string;
385
+ attrs: Record<"data-scope" | "data-part", string>;
386
+ }>;
387
+ }, "parts">;
388
+ build: () => Record<U, {
389
+ selector: string;
390
+ attrs: Record<"data-scope" | "data-part", string>;
391
+ }>;
392
+ }, "parts">;
393
+ extendWith: <V_12 extends string>(...parts: V_12[]) => Omit<{
394
+ parts: <U extends string>(...parts: U[]) => Omit<{
395
+ parts: any;
396
+ extendWith: <V extends string>(...parts: V[]) => Omit<{
397
+ parts: any;
398
+ extendWith: <V_1 extends string>(...parts: V_1[]) => Omit<{
399
+ parts: any;
400
+ extendWith: <V_2 extends string>(...parts: V_2[]) => Omit<{
401
+ parts: any;
402
+ extendWith: <V_3 extends string>(...parts: V_3[]) => Omit<{
403
+ parts: any;
404
+ extendWith: <V_4 extends string>(...parts: V_4[]) => Omit<{
405
+ parts: any;
406
+ extendWith: <V_5 extends string>(...parts: V_5[]) => Omit<{
407
+ parts: any;
408
+ extendWith: <V_6 extends string>(...parts: V_6[]) => Omit<{
409
+ parts: any;
410
+ extendWith: <V_7 extends string>(...parts: V_7[]) => Omit<{
411
+ parts: any;
412
+ extendWith: <V_8 extends string>(...parts: V_8[]) => Omit<{
413
+ parts: any;
414
+ extendWith: <V_9 extends string>(...parts: V_9[]) => Omit<any, "parts">;
415
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6 | V_7 | V_8, {
416
+ selector: string;
417
+ attrs: Record<"data-scope" | "data-part", string>;
418
+ }>;
419
+ }, "parts">;
420
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6 | V_7, {
421
+ selector: string;
422
+ attrs: Record<"data-scope" | "data-part", string>;
423
+ }>;
424
+ }, "parts">;
425
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6, {
426
+ selector: string;
427
+ attrs: Record<"data-scope" | "data-part", string>;
428
+ }>;
429
+ }, "parts">;
430
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5, {
431
+ selector: string;
432
+ attrs: Record<"data-scope" | "data-part", string>;
433
+ }>;
434
+ }, "parts">;
435
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4, {
436
+ selector: string;
437
+ attrs: Record<"data-scope" | "data-part", string>;
438
+ }>;
439
+ }, "parts">;
440
+ build: () => Record<U | V | V_1 | V_2 | V_3, {
441
+ selector: string;
442
+ attrs: Record<"data-scope" | "data-part", string>;
443
+ }>;
444
+ }, "parts">;
445
+ build: () => Record<U | V | V_1 | V_2, {
446
+ selector: string;
447
+ attrs: Record<"data-scope" | "data-part", string>;
448
+ }>;
449
+ }, "parts">;
450
+ build: () => Record<U | V | V_1, {
451
+ selector: string;
452
+ attrs: Record<"data-scope" | "data-part", string>;
453
+ }>;
454
+ }, "parts">;
455
+ build: () => Record<U | V, {
456
+ selector: string;
457
+ attrs: Record<"data-scope" | "data-part", string>;
458
+ }>;
459
+ }, "parts">;
460
+ build: () => Record<U, {
461
+ selector: string;
462
+ attrs: Record<"data-scope" | "data-part", string>;
463
+ }>;
464
+ }, "parts">;
465
+ extendWith: <V_13 extends string>(...parts: V_13[]) => Omit<{
466
+ parts: <U extends string>(...parts: U[]) => Omit<{
467
+ parts: any;
468
+ extendWith: <V extends string>(...parts: V[]) => Omit<{
469
+ parts: any;
470
+ extendWith: <V_1 extends string>(...parts: V_1[]) => Omit<{
471
+ parts: any;
472
+ extendWith: <V_2 extends string>(...parts: V_2[]) => Omit<{
473
+ parts: any;
474
+ extendWith: <V_3 extends string>(...parts: V_3[]) => Omit<{
475
+ parts: any;
476
+ extendWith: <V_4 extends string>(...parts: V_4[]) => Omit<{
477
+ parts: any;
478
+ extendWith: <V_5 extends string>(...parts: V_5[]) => Omit<{
479
+ parts: any;
480
+ extendWith: <V_6 extends string>(...parts: V_6[]) => Omit<{
481
+ parts: any;
482
+ extendWith: <V_7 extends string>(...parts: V_7[]) => Omit<{
483
+ parts: any;
484
+ extendWith: <V_8 extends string>(...parts: V_8[]) => Omit<{
485
+ parts: any;
486
+ extendWith: <V_9 extends string>(...parts: V_9[]) => Omit<any, "parts">;
487
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6 | V_7 | V_8, {
488
+ selector: string;
489
+ attrs: Record<"data-scope" | "data-part", string>;
490
+ }>;
491
+ }, "parts">;
492
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6 | V_7, {
493
+ selector: string;
494
+ attrs: Record<"data-scope" | "data-part", string>;
495
+ }>;
496
+ }, "parts">;
497
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6, {
498
+ selector: string;
499
+ attrs: Record<"data-scope" | "data-part", string>;
500
+ }>;
501
+ }, "parts">;
502
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5, {
503
+ selector: string;
504
+ attrs: Record<"data-scope" | "data-part", string>;
505
+ }>;
506
+ }, "parts">;
507
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4, {
508
+ selector: string;
509
+ attrs: Record<"data-scope" | "data-part", string>;
510
+ }>;
511
+ }, "parts">;
512
+ build: () => Record<U | V | V_1 | V_2 | V_3, {
513
+ selector: string;
514
+ attrs: Record<"data-scope" | "data-part", string>;
515
+ }>;
516
+ }, "parts">;
517
+ build: () => Record<U | V | V_1 | V_2, {
518
+ selector: string;
519
+ attrs: Record<"data-scope" | "data-part", string>;
520
+ }>;
521
+ }, "parts">;
522
+ build: () => Record<U | V | V_1, {
523
+ selector: string;
524
+ attrs: Record<"data-scope" | "data-part", string>;
525
+ }>;
526
+ }, "parts">;
527
+ build: () => Record<U | V, {
528
+ selector: string;
529
+ attrs: Record<"data-scope" | "data-part", string>;
530
+ }>;
531
+ }, "parts">;
532
+ build: () => Record<U, {
533
+ selector: string;
534
+ attrs: Record<"data-scope" | "data-part", string>;
535
+ }>;
536
+ }, "parts">;
537
+ extendWith: <V_14 extends string>(...parts: V_14[]) => Omit<{
538
+ parts: <U extends string>(...parts: U[]) => Omit<{
539
+ parts: any;
540
+ extendWith: <V extends string>(...parts: V[]) => Omit<{
541
+ parts: any;
542
+ extendWith: <V_1 extends string>(...parts: V_1[]) => Omit<{
543
+ parts: any;
544
+ extendWith: <V_2 extends string>(...parts: V_2[]) => Omit<{
545
+ parts: any;
546
+ extendWith: <V_3 extends string>(...parts: V_3[]) => Omit<{
547
+ parts: any;
548
+ extendWith: <V_4 extends string>(...parts: V_4[]) => Omit<{
549
+ parts: any;
550
+ extendWith: <V_5 extends string>(...parts: V_5[]) => Omit<{
551
+ parts: any;
552
+ extendWith: <V_6 extends string>(...parts: V_6[]) => Omit<{
553
+ parts: any;
554
+ extendWith: <V_7 extends string>(...parts: V_7[]) => Omit<{
555
+ parts: any;
556
+ extendWith: <V_8 extends string>(...parts: V_8[]) => Omit<{
557
+ parts: any;
558
+ extendWith: <V_9 extends string>(...parts: V_9[]) => Omit<any, "parts">;
559
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6 | V_7 | V_8, {
560
+ selector: string;
561
+ attrs: Record<"data-scope" | "data-part", string>;
562
+ }>;
563
+ }, "parts">;
564
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6 | V_7, {
565
+ selector: string;
566
+ attrs: Record<"data-scope" | "data-part", string>;
567
+ }>;
568
+ }, "parts">;
569
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6, {
570
+ selector: string;
571
+ attrs: Record<"data-scope" | "data-part", string>;
572
+ }>;
573
+ }, "parts">;
574
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5, {
575
+ selector: string;
576
+ attrs: Record<"data-scope" | "data-part", string>;
577
+ }>;
578
+ }, "parts">;
579
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4, {
580
+ selector: string;
581
+ attrs: Record<"data-scope" | "data-part", string>;
582
+ }>;
583
+ }, "parts">;
584
+ build: () => Record<U | V | V_1 | V_2 | V_3, {
585
+ selector: string;
586
+ attrs: Record<"data-scope" | "data-part", string>;
587
+ }>;
588
+ }, "parts">;
589
+ build: () => Record<U | V | V_1 | V_2, {
590
+ selector: string;
591
+ attrs: Record<"data-scope" | "data-part", string>;
592
+ }>;
593
+ }, "parts">;
594
+ build: () => Record<U | V | V_1, {
595
+ selector: string;
596
+ attrs: Record<"data-scope" | "data-part", string>;
597
+ }>;
598
+ }, "parts">;
599
+ build: () => Record<U | V, {
600
+ selector: string;
601
+ attrs: Record<"data-scope" | "data-part", string>;
602
+ }>;
603
+ }, "parts">;
604
+ build: () => Record<U, {
605
+ selector: string;
606
+ attrs: Record<"data-scope" | "data-part", string>;
607
+ }>;
608
+ }, "parts">;
609
+ extendWith: <V_15 extends string>(...parts: V_15[]) => Omit<{
610
+ parts: <U extends string>(...parts: U[]) => Omit<{
611
+ parts: any;
612
+ extendWith: <V extends string>(...parts: V[]) => Omit<{
613
+ parts: any;
614
+ extendWith: <V_1 extends string>(...parts: V_1[]) => Omit<{
615
+ parts: any;
616
+ extendWith: <V_2 extends string>(...parts: V_2[]) => Omit<{
617
+ parts: any;
618
+ extendWith: <V_3 extends string>(...parts: V_3[]) => Omit<{
619
+ parts: any;
620
+ extendWith: <V_4 extends string>(...parts: V_4[]) => Omit<{
621
+ parts: any;
622
+ extendWith: <V_5 extends string>(...parts: V_5[]) => Omit<{
623
+ parts: any;
624
+ extendWith: <V_6 extends string>(...parts: V_6[]) => Omit<{
625
+ parts: any;
626
+ extendWith: <V_7 extends string>(...parts: V_7[]) => Omit<{
627
+ parts: any;
628
+ extendWith: <V_8 extends string>(...parts: V_8[]) => Omit<{
629
+ parts: any;
630
+ extendWith: <V_9 extends string>(...parts: V_9[]) => Omit<any, "parts">;
631
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6 | V_7 | V_8, {
632
+ selector: string;
633
+ attrs: Record<"data-scope" | "data-part", string>;
634
+ }>;
635
+ }, "parts">;
636
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6 | V_7, {
637
+ selector: string;
638
+ attrs: Record<"data-scope" | "data-part", string>;
639
+ }>;
640
+ }, "parts">;
641
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6, {
642
+ selector: string;
643
+ attrs: Record<"data-scope" | "data-part", string>;
644
+ }>;
645
+ }, "parts">;
646
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5, {
647
+ selector: string;
648
+ attrs: Record<"data-scope" | "data-part", string>;
649
+ }>;
650
+ }, "parts">;
651
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4, {
652
+ selector: string;
653
+ attrs: Record<"data-scope" | "data-part", string>;
654
+ }>;
655
+ }, "parts">;
656
+ build: () => Record<U | V | V_1 | V_2 | V_3, {
657
+ selector: string;
658
+ attrs: Record<"data-scope" | "data-part", string>;
659
+ }>;
660
+ }, "parts">;
661
+ build: () => Record<U | V | V_1 | V_2, {
662
+ selector: string;
663
+ attrs: Record<"data-scope" | "data-part", string>;
664
+ }>;
665
+ }, "parts">;
666
+ build: () => Record<U | V | V_1, {
667
+ selector: string;
668
+ attrs: Record<"data-scope" | "data-part", string>;
669
+ }>;
670
+ }, "parts">;
671
+ build: () => Record<U | V, {
672
+ selector: string;
673
+ attrs: Record<"data-scope" | "data-part", string>;
674
+ }>;
675
+ }, "parts">;
676
+ build: () => Record<U, {
677
+ selector: string;
678
+ attrs: Record<"data-scope" | "data-part", string>;
679
+ }>;
680
+ }, "parts">;
681
+ extendWith: <V_16 extends string>(...parts: V_16[]) => Omit<{
682
+ parts: <U extends string>(...parts: U[]) => Omit<{
683
+ parts: any;
684
+ extendWith: <V extends string>(...parts: V[]) => Omit<{
685
+ parts: any;
686
+ extendWith: <V_1 extends string>(...parts: V_1[]) => Omit<{
687
+ parts: any;
688
+ extendWith: <V_2 extends string>(...parts: V_2[]) => Omit<{
689
+ parts: any;
690
+ extendWith: <V_3 extends string>(...parts: V_3[]) => Omit<{
691
+ parts: any;
692
+ extendWith: <V_4 extends string>(...parts: V_4[]) => Omit<{
693
+ parts: any;
694
+ extendWith: <V_5 extends string>(...parts: V_5[]) => Omit<{
695
+ parts: any;
696
+ extendWith: <V_6 extends string>(...parts: V_6[]) => Omit<{
697
+ parts: any;
698
+ extendWith: <V_7 extends string>(...parts: V_7[]) => Omit<{
699
+ parts: any;
700
+ extendWith: <V_8 extends string>(...parts: V_8[]) => Omit<{
701
+ parts: any;
702
+ extendWith: <V_9 extends string>(...parts: V_9[]) => Omit<any, "parts">;
703
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6 | V_7 | V_8, {
704
+ selector: string;
705
+ attrs: Record<"data-scope" | "data-part", string>;
706
+ }>;
707
+ }, "parts">;
708
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6 | V_7, {
709
+ selector: string;
710
+ attrs: Record<"data-scope" | "data-part", string>;
711
+ }>;
712
+ }, "parts">;
713
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6, {
714
+ selector: string;
715
+ attrs: Record<"data-scope" | "data-part", string>;
716
+ }>;
717
+ }, "parts">;
718
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5, {
719
+ selector: string;
720
+ attrs: Record<"data-scope" | "data-part", string>;
721
+ }>;
722
+ }, "parts">;
723
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4, {
724
+ selector: string;
725
+ attrs: Record<"data-scope" | "data-part", string>;
726
+ }>;
727
+ }, "parts">;
728
+ build: () => Record<U | V | V_1 | V_2 | V_3, {
729
+ selector: string;
730
+ attrs: Record<"data-scope" | "data-part", string>;
731
+ }>;
732
+ }, "parts">;
733
+ build: () => Record<U | V | V_1 | V_2, {
734
+ selector: string;
735
+ attrs: Record<"data-scope" | "data-part", string>;
736
+ }>;
737
+ }, "parts">;
738
+ build: () => Record<U | V | V_1, {
739
+ selector: string;
740
+ attrs: Record<"data-scope" | "data-part", string>;
741
+ }>;
742
+ }, "parts">;
743
+ build: () => Record<U | V, {
744
+ selector: string;
745
+ attrs: Record<"data-scope" | "data-part", string>;
746
+ }>;
747
+ }, "parts">;
748
+ build: () => Record<U, {
749
+ selector: string;
750
+ attrs: Record<"data-scope" | "data-part", string>;
751
+ }>;
752
+ }, "parts">;
753
+ extendWith: <V_17 extends string>(...parts: V_17[]) => Omit<{
754
+ parts: <U extends string>(...parts: U[]) => Omit<{
755
+ parts: any;
756
+ extendWith: <V extends string>(...parts: V[]) => Omit<{
757
+ parts: any;
758
+ extendWith: <V_1 extends string>(...parts: V_1[]) => Omit<{
759
+ parts: any;
760
+ extendWith: <V_2 extends string>(...parts: V_2[]) => Omit<{
761
+ parts: any;
762
+ extendWith: <V_3 extends string>(...parts: V_3[]) => Omit<{
763
+ parts: any;
764
+ extendWith: <V_4 extends string>(...parts: V_4[]) => Omit<{
765
+ parts: any;
766
+ extendWith: <V_5 extends string>(...parts: V_5[]) => Omit<{
767
+ parts: any;
768
+ extendWith: <V_6 extends string>(...parts: V_6[]) => Omit<{
769
+ parts: any;
770
+ extendWith: <V_7 extends string>(...parts: V_7[]) => Omit<{
771
+ parts: any;
772
+ extendWith: <V_8 extends string>(...parts: V_8[]) => Omit<{
773
+ parts: any;
774
+ extendWith: <V_9 extends string>(...parts: V_9[]) => Omit<any, "parts">;
775
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6 | V_7 | V_8, {
776
+ selector: string;
777
+ attrs: Record<"data-scope" | "data-part", string>;
778
+ }>;
779
+ }, "parts">;
780
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6 | V_7, {
781
+ selector: string;
782
+ attrs: Record<"data-scope" | "data-part", string>;
783
+ }>;
784
+ }, "parts">;
785
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6, {
786
+ selector: string;
787
+ attrs: Record<"data-scope" | "data-part", string>;
788
+ }>;
789
+ }, "parts">;
790
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5, {
791
+ selector: string;
792
+ attrs: Record<"data-scope" | "data-part", string>;
793
+ }>;
794
+ }, "parts">;
795
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4, {
796
+ selector: string;
797
+ attrs: Record<"data-scope" | "data-part", string>;
798
+ }>;
799
+ }, "parts">;
800
+ build: () => Record<U | V | V_1 | V_2 | V_3, {
801
+ selector: string;
802
+ attrs: Record<"data-scope" | "data-part", string>;
803
+ }>;
804
+ }, "parts">;
805
+ build: () => Record<U | V | V_1 | V_2, {
806
+ selector: string;
807
+ attrs: Record<"data-scope" | "data-part", string>;
808
+ }>;
809
+ }, "parts">;
810
+ build: () => Record<U | V | V_1, {
811
+ selector: string;
812
+ attrs: Record<"data-scope" | "data-part", string>;
813
+ }>;
814
+ }, "parts">;
815
+ build: () => Record<U | V, {
816
+ selector: string;
817
+ attrs: Record<"data-scope" | "data-part", string>;
818
+ }>;
819
+ }, "parts">;
820
+ build: () => Record<U, {
821
+ selector: string;
822
+ attrs: Record<"data-scope" | "data-part", string>;
823
+ }>;
824
+ }, "parts">;
825
+ extendWith: <V_18 extends string>(...parts: V_18[]) => Omit<{
826
+ parts: <U extends string>(...parts: U[]) => Omit<{
827
+ parts: any;
828
+ extendWith: <V extends string>(...parts: V[]) => Omit<{
829
+ parts: any;
830
+ extendWith: <V_1 extends string>(...parts: V_1[]) => Omit<{
831
+ parts: any;
832
+ extendWith: <V_2 extends string>(...parts: V_2[]) => Omit<{
833
+ parts: any;
834
+ extendWith: <V_3 extends string>(...parts: V_3[]) => Omit<{
835
+ parts: any;
836
+ extendWith: <V_4 extends string>(...parts: V_4[]) => Omit<{
837
+ parts: any;
838
+ extendWith: <V_5 extends string>(...parts: V_5[]) => Omit<{
839
+ parts: any;
840
+ extendWith: <V_6 extends string>(...parts: V_6[]) => Omit<{
841
+ parts: any;
842
+ extendWith: <V_7 extends string>(...parts: V_7[]) => Omit<{
843
+ parts: any;
844
+ extendWith: <V_8 extends string>(...parts: V_8[]) => Omit<{
845
+ parts: any;
846
+ extendWith: <V_9 extends string>(...parts: V_9[]) => Omit<any, "parts">;
847
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6 | V_7 | V_8, {
848
+ selector: string;
849
+ attrs: Record<"data-scope" | "data-part", string>;
850
+ }>;
851
+ }, "parts">;
852
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6 | V_7, {
853
+ selector: string;
854
+ attrs: Record<"data-scope" | "data-part", string>;
855
+ }>;
856
+ }, "parts">;
857
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6, {
858
+ selector: string;
859
+ attrs: Record<"data-scope" | "data-part", string>;
860
+ }>;
861
+ }, "parts">;
862
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5, {
863
+ selector: string;
864
+ attrs: Record<"data-scope" | "data-part", string>;
865
+ }>;
866
+ }, "parts">;
867
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4, {
868
+ selector: string;
869
+ attrs: Record<"data-scope" | "data-part", string>;
870
+ }>;
871
+ }, "parts">;
872
+ build: () => Record<U | V | V_1 | V_2 | V_3, {
873
+ selector: string;
874
+ attrs: Record<"data-scope" | "data-part", string>;
875
+ }>;
876
+ }, "parts">;
877
+ build: () => Record<U | V | V_1 | V_2, {
878
+ selector: string;
879
+ attrs: Record<"data-scope" | "data-part", string>;
880
+ }>;
881
+ }, "parts">;
882
+ build: () => Record<U | V | V_1, {
883
+ selector: string;
884
+ attrs: Record<"data-scope" | "data-part", string>;
885
+ }>;
886
+ }, "parts">;
887
+ build: () => Record<U | V, {
888
+ selector: string;
889
+ attrs: Record<"data-scope" | "data-part", string>;
890
+ }>;
891
+ }, "parts">;
892
+ build: () => Record<U, {
893
+ selector: string;
894
+ attrs: Record<"data-scope" | "data-part", string>;
895
+ }>;
896
+ }, "parts">;
897
+ extendWith: <V_19 extends string>(...parts: V_19[]) => Omit<{
898
+ parts: <U extends string>(...parts: U[]) => Omit<{
899
+ parts: any;
900
+ extendWith: <V extends string>(...parts: V[]) => Omit<{
901
+ parts: any;
902
+ extendWith: <V_1 extends string>(...parts: V_1[]) => Omit<{
903
+ parts: any;
904
+ extendWith: <V_2 extends string>(...parts: V_2[]) => Omit<{
905
+ parts: any;
906
+ extendWith: <V_3 extends string>(...parts: V_3[]) => Omit<{
907
+ parts: any;
908
+ extendWith: <V_4 extends string>(...parts: V_4[]) => Omit<{
909
+ parts: any;
910
+ extendWith: <V_5 extends string>(...parts: V_5[]) => Omit<{
911
+ parts: any;
912
+ extendWith: <V_6 extends string>(...parts: V_6[]) => Omit<{
913
+ parts: any;
914
+ extendWith: <V_7 extends string>(...parts: V_7[]) => Omit<{
915
+ parts: any;
916
+ extendWith: <V_8 extends string>(...parts: V_8[]) => Omit<{
917
+ parts: any;
918
+ extendWith: <V_9 extends string>(...parts: V_9[]) => Omit<any, "parts">;
919
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6 | V_7 | V_8, {
920
+ selector: string;
921
+ attrs: Record<"data-scope" | "data-part", string>;
922
+ }>;
923
+ }, "parts">;
924
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6 | V_7, {
925
+ selector: string;
926
+ attrs: Record<"data-scope" | "data-part", string>;
927
+ }>;
928
+ }, "parts">;
929
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5 | V_6, {
930
+ selector: string;
931
+ attrs: Record<"data-scope" | "data-part", string>;
932
+ }>;
933
+ }, "parts">;
934
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4 | V_5, {
935
+ selector: string;
936
+ attrs: Record<"data-scope" | "data-part", string>;
937
+ }>;
938
+ }, "parts">;
939
+ build: () => Record<U | V | V_1 | V_2 | V_3 | V_4, {
940
+ selector: string;
941
+ attrs: Record<"data-scope" | "data-part", string>;
942
+ }>;
943
+ }, "parts">;
944
+ build: () => Record<U | V | V_1 | V_2 | V_3, {
945
+ selector: string;
946
+ attrs: Record<"data-scope" | "data-part", string>;
947
+ }>;
948
+ }, "parts">;
949
+ build: () => Record<U | V | V_1 | V_2, {
950
+ selector: string;
951
+ attrs: Record<"data-scope" | "data-part", string>;
952
+ }>;
953
+ }, "parts">;
954
+ build: () => Record<U | V | V_1, {
955
+ selector: string;
956
+ attrs: Record<"data-scope" | "data-part", string>;
957
+ }>;
958
+ }, "parts">;
959
+ build: () => Record<U | V, {
960
+ selector: string;
961
+ attrs: Record<"data-scope" | "data-part", string>;
962
+ }>;
963
+ }, "parts">;
964
+ build: () => Record<U, {
965
+ selector: string;
966
+ attrs: Record<"data-scope" | "data-part", string>;
967
+ }>;
968
+ }, "parts">;
969
+ extendWith: <V_20 extends string>(...parts: V_20[]) => Omit<any, "parts">;
970
+ build: () => Record<"group" | "root" | "title" | "description" | "closeTrigger" | V_10 | V_11 | V_12 | V_13 | V_14 | V_15 | V_16 | V_17 | V_18 | V_19, {
971
+ selector: string;
972
+ attrs: Record<"data-scope" | "data-part", string>;
973
+ }>;
974
+ }, "parts">;
975
+ build: () => Record<"group" | "root" | "title" | "description" | "closeTrigger" | V_10 | V_11 | V_12 | V_13 | V_14 | V_15 | V_16 | V_17 | V_18, {
976
+ selector: string;
977
+ attrs: Record<"data-scope" | "data-part", string>;
978
+ }>;
979
+ }, "parts">;
980
+ build: () => Record<"group" | "root" | "title" | "description" | "closeTrigger" | V_10 | V_11 | V_12 | V_13 | V_14 | V_15 | V_16 | V_17, {
981
+ selector: string;
982
+ attrs: Record<"data-scope" | "data-part", string>;
983
+ }>;
984
+ }, "parts">;
985
+ build: () => Record<"group" | "root" | "title" | "description" | "closeTrigger" | V_10 | V_11 | V_12 | V_13 | V_14 | V_15 | V_16, {
986
+ selector: string;
987
+ attrs: Record<"data-scope" | "data-part", string>;
988
+ }>;
989
+ }, "parts">;
990
+ build: () => Record<"group" | "root" | "title" | "description" | "closeTrigger" | V_10 | V_11 | V_12 | V_13 | V_14 | V_15, {
991
+ selector: string;
992
+ attrs: Record<"data-scope" | "data-part", string>;
993
+ }>;
994
+ }, "parts">;
995
+ build: () => Record<"group" | "root" | "title" | "description" | "closeTrigger" | V_10 | V_11 | V_12 | V_13 | V_14, {
996
+ selector: string;
997
+ attrs: Record<"data-scope" | "data-part", string>;
998
+ }>;
999
+ }, "parts">;
1000
+ build: () => Record<"group" | "root" | "title" | "description" | "closeTrigger" | V_10 | V_11 | V_12 | V_13, {
1001
+ selector: string;
1002
+ attrs: Record<"data-scope" | "data-part", string>;
1003
+ }>;
1004
+ }, "parts">;
1005
+ build: () => Record<"group" | "root" | "title" | "description" | "closeTrigger" | V_10 | V_11 | V_12, {
1006
+ selector: string;
1007
+ attrs: Record<"data-scope" | "data-part", string>;
1008
+ }>;
1009
+ }, "parts">;
1010
+ build: () => Record<"group" | "root" | "title" | "description" | "closeTrigger" | V_10 | V_11, {
1011
+ selector: string;
1012
+ attrs: Record<"data-scope" | "data-part", string>;
1013
+ }>;
1014
+ }, "parts">;
1015
+ build: () => Record<"group" | "root" | "title" | "description" | "closeTrigger" | V_10, {
1016
+ selector: string;
1017
+ attrs: Record<"data-scope" | "data-part", string>;
1018
+ }>;
1019
+ }, "parts">;
1020
+ build: () => Record<"group" | "root" | "title" | "description" | "closeTrigger", {
1021
+ selector: string;
1022
+ attrs: Record<"data-scope" | "data-part", string>;
1023
+ }>;
1024
+ }, "parts">;
1025
+
177
1026
  declare function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): {
178
1027
  type: Type;
179
1028
  title: string | undefined;
@@ -188,7 +1037,7 @@ declare function connect<T extends PropTypes>(state: State, send: Send, normaliz
188
1037
  rootProps: T["element"];
189
1038
  titleProps: T["element"];
190
1039
  descriptionProps: T["element"];
191
- closeButtonProps: T["button"];
1040
+ closeTriggerProps: T["button"];
192
1041
  render(): any;
193
1042
  };
194
1043
 
@@ -198,4 +1047,4 @@ declare const group: {
198
1047
  };
199
1048
  declare function api(): Toaster | undefined;
200
1049
 
201
- export { GroupMachineContext, MachineContext, MachineState, Placement, Service, ToastOptions, Type, api, connect, createToastMachine as createMachine, group };
1050
+ export { GroupMachineContext, MachineContext, MachineState, Placement, Service, ToastOptions, Type, anatomy, api, connect, createToastMachine as createMachine, group };
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
+ anatomy: () => anatomy,
23
24
  api: () => api,
24
25
  connect: () => connect,
25
26
  createMachine: () => createToastMachine,
@@ -138,13 +139,18 @@ function warn(...a) {
138
139
  // src/toast-group.connect.ts
139
140
  var import_core = require("@zag-js/core");
140
141
 
142
+ // src/toast.anatomy.ts
143
+ var import_anatomy = require("@zag-js/anatomy");
144
+ var anatomy = (0, import_anatomy.createAnatomy)("toast").parts("group", "root", "title", "description", "closeTrigger");
145
+ var parts = anatomy.build();
146
+
141
147
  // src/toast.dom.ts
142
148
  var dom = defineDomHelpers({
143
149
  getGroupId: (placement) => `toast-group:${placement}`,
144
- getContainerId: (ctx) => `toast:${ctx.id}`,
145
- getTitleId: (ctx) => `toast-title:${ctx.id}`,
146
- getDescriptionId: (ctx) => `toast-description:${ctx.id}`,
147
- getCloseButtonId: (ctx) => `toast-close-button:${ctx.id}`,
150
+ getRootId: (ctx) => `toast:${ctx.id}`,
151
+ getTitleId: (ctx) => `toast:${ctx.id}:title`,
152
+ getDescriptionId: (ctx) => `toast:${ctx.id}:description`,
153
+ getCloseTriggerId: (ctx) => `toast${ctx.id}:close`,
148
154
  getPortalId: (ctx) => `toast-portal:${ctx.id}`,
149
155
  getPortalEl: (ctx) => dom.getDoc(ctx).getElementById(dom.getPortalId(ctx)),
150
156
  createPortalEl: (ctx) => {
@@ -312,6 +318,7 @@ function groupConnect(state, send, normalize) {
312
318
  getGroupProps(options) {
313
319
  const { placement, label = "Notifications" } = options;
314
320
  return normalize.element({
321
+ ...parts.group.attrs,
315
322
  tabIndex: -1,
316
323
  "aria-label": label,
317
324
  id: dom.getGroupId(placement),
@@ -609,9 +616,9 @@ function connect(state, send, normalize) {
609
616
  send("DISMISS");
610
617
  },
611
618
  rootProps: normalize.element({
612
- "data-part": "root",
619
+ ...parts.root.attrs,
613
620
  dir: state.context.dir,
614
- id: dom.getContainerId(state.context),
621
+ id: dom.getRootId(state.context),
615
622
  "data-open": dataAttr(isVisible),
616
623
  "data-type": state.context.type,
617
624
  "data-placement": placement,
@@ -653,16 +660,16 @@ function connect(state, send, normalize) {
653
660
  }
654
661
  }),
655
662
  titleProps: normalize.element({
656
- "data-part": "title",
663
+ ...parts.title.attrs,
657
664
  id: dom.getTitleId(state.context)
658
665
  }),
659
666
  descriptionProps: normalize.element({
660
- "data-part": "description",
667
+ ...parts.description.attrs,
661
668
  id: dom.getDescriptionId(state.context)
662
669
  }),
663
- closeButtonProps: normalize.button({
664
- id: dom.getCloseButtonId(state.context),
665
- "data-part": "close-button",
670
+ closeTriggerProps: normalize.button({
671
+ id: dom.getCloseTriggerId(state.context),
672
+ ...parts.closeTrigger.attrs,
666
673
  type: "button",
667
674
  "aria-label": "Dismiss notification",
668
675
  onClick() {
@@ -700,6 +707,7 @@ function api() {
700
707
  }
701
708
  // Annotate the CommonJS export names for ESM import in node:
702
709
  0 && (module.exports = {
710
+ anatomy,
703
711
  api,
704
712
  connect,
705
713
  createMachine,
package/dist/index.mjs CHANGED
@@ -109,13 +109,18 @@ function warn(...a) {
109
109
  // src/toast-group.connect.ts
110
110
  import { subscribe } from "@zag-js/core";
111
111
 
112
+ // src/toast.anatomy.ts
113
+ import { createAnatomy } from "@zag-js/anatomy";
114
+ var anatomy = createAnatomy("toast").parts("group", "root", "title", "description", "closeTrigger");
115
+ var parts = anatomy.build();
116
+
112
117
  // src/toast.dom.ts
113
118
  var dom = defineDomHelpers({
114
119
  getGroupId: (placement) => `toast-group:${placement}`,
115
- getContainerId: (ctx) => `toast:${ctx.id}`,
116
- getTitleId: (ctx) => `toast-title:${ctx.id}`,
117
- getDescriptionId: (ctx) => `toast-description:${ctx.id}`,
118
- getCloseButtonId: (ctx) => `toast-close-button:${ctx.id}`,
120
+ getRootId: (ctx) => `toast:${ctx.id}`,
121
+ getTitleId: (ctx) => `toast:${ctx.id}:title`,
122
+ getDescriptionId: (ctx) => `toast:${ctx.id}:description`,
123
+ getCloseTriggerId: (ctx) => `toast${ctx.id}:close`,
119
124
  getPortalId: (ctx) => `toast-portal:${ctx.id}`,
120
125
  getPortalEl: (ctx) => dom.getDoc(ctx).getElementById(dom.getPortalId(ctx)),
121
126
  createPortalEl: (ctx) => {
@@ -283,6 +288,7 @@ function groupConnect(state, send, normalize) {
283
288
  getGroupProps(options) {
284
289
  const { placement, label = "Notifications" } = options;
285
290
  return normalize.element({
291
+ ...parts.group.attrs,
286
292
  tabIndex: -1,
287
293
  "aria-label": label,
288
294
  id: dom.getGroupId(placement),
@@ -580,9 +586,9 @@ function connect(state, send, normalize) {
580
586
  send("DISMISS");
581
587
  },
582
588
  rootProps: normalize.element({
583
- "data-part": "root",
589
+ ...parts.root.attrs,
584
590
  dir: state.context.dir,
585
- id: dom.getContainerId(state.context),
591
+ id: dom.getRootId(state.context),
586
592
  "data-open": dataAttr(isVisible),
587
593
  "data-type": state.context.type,
588
594
  "data-placement": placement,
@@ -624,16 +630,16 @@ function connect(state, send, normalize) {
624
630
  }
625
631
  }),
626
632
  titleProps: normalize.element({
627
- "data-part": "title",
633
+ ...parts.title.attrs,
628
634
  id: dom.getTitleId(state.context)
629
635
  }),
630
636
  descriptionProps: normalize.element({
631
- "data-part": "description",
637
+ ...parts.description.attrs,
632
638
  id: dom.getDescriptionId(state.context)
633
639
  }),
634
- closeButtonProps: normalize.button({
635
- id: dom.getCloseButtonId(state.context),
636
- "data-part": "close-button",
640
+ closeTriggerProps: normalize.button({
641
+ id: dom.getCloseTriggerId(state.context),
642
+ ...parts.closeTrigger.attrs,
637
643
  type: "button",
638
644
  "aria-label": "Dismiss notification",
639
645
  onClick() {
@@ -670,6 +676,7 @@ function api() {
670
676
  }
671
677
  }
672
678
  export {
679
+ anatomy,
673
680
  api,
674
681
  connect,
675
682
  createToastMachine as createMachine,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/toast",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Core logic for the toast widget implemented as a state machine",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -29,7 +29,8 @@
29
29
  "url": "https://github.com/chakra-ui/zag/issues"
30
30
  },
31
31
  "dependencies": {
32
- "@zag-js/core": "0.2.2",
32
+ "@zag-js/anatomy": "0.1.1",
33
+ "@zag-js/core": "0.2.3",
33
34
  "@zag-js/types": "0.3.1"
34
35
  },
35
36
  "devDependencies": {