@zag-js/toast 1.0.1 → 1.0.2

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.mts CHANGED
@@ -89,7 +89,7 @@ interface ToastProps<T = any> extends Omit<CommonProperties, "id">, Options<T> {
89
89
  */
90
90
  gap?: number;
91
91
  }
92
- type ToastPropsWithDefault = "type" | "parent" | "duration" | "id";
92
+ type ToastPropsWithDefault = "type" | "parent" | "duration" | "id" | "removeDelay";
93
93
  type ToastSchema<O = any> = {
94
94
  props: RequiredBy<ToastProps<O>, ToastPropsWithDefault>;
95
95
  context: {
@@ -305,11 +305,11 @@ interface ToastApi<T extends PropTypes = PropTypes, O = any> {
305
305
  /**
306
306
  * The title of the toast.
307
307
  */
308
- title: O;
308
+ title?: O | undefined;
309
309
  /**
310
310
  * The description of the toast.
311
311
  */
312
- description: O;
312
+ description?: O | undefined;
313
313
  /**
314
314
  * The type of the toast.
315
315
  */
package/dist/index.d.ts CHANGED
@@ -89,7 +89,7 @@ interface ToastProps<T = any> extends Omit<CommonProperties, "id">, Options<T> {
89
89
  */
90
90
  gap?: number;
91
91
  }
92
- type ToastPropsWithDefault = "type" | "parent" | "duration" | "id";
92
+ type ToastPropsWithDefault = "type" | "parent" | "duration" | "id" | "removeDelay";
93
93
  type ToastSchema<O = any> = {
94
94
  props: RequiredBy<ToastProps<O>, ToastPropsWithDefault>;
95
95
  context: {
@@ -305,11 +305,11 @@ interface ToastApi<T extends PropTypes = PropTypes, O = any> {
305
305
  /**
306
306
  * The title of the toast.
307
307
  */
308
- title: O;
308
+ title?: O | undefined;
309
309
  /**
310
310
  * The description of the toast.
311
311
  */
312
- description: O;
312
+ description?: O | undefined;
313
313
  /**
314
314
  * The type of the toast.
315
315
  */
package/dist/index.js CHANGED
@@ -574,12 +574,10 @@ function connect(service, normalize) {
574
574
  var { not } = core.createGuards();
575
575
  var machine = core.createMachine({
576
576
  props({ props }) {
577
+ utils.ensureProps(props, ["id", "type", "parent", "removeDelay"], "toast");
577
578
  return {
579
+ closable: true,
578
580
  ...props,
579
- id: props.id,
580
- type: props.type,
581
- parent: props.parent,
582
- closable: props.closable ?? true,
583
581
  duration: getToastDuration(props.duration, props.type)
584
582
  };
585
583
  },
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@ import { addDomEvent, raf, dataAttr, contains, MAX_Z_INDEX } from '@zag-js/dom-q
2
2
  import { createAnatomy } from '@zag-js/anatomy';
3
3
  import { createMachine, createGuards } from '@zag-js/core';
4
4
  import { trackDismissableBranch } from '@zag-js/dismissable';
5
- import { uuid, setRafTimeout, runIfFn } from '@zag-js/utils';
5
+ import { uuid, ensureProps, setRafTimeout, runIfFn } from '@zag-js/utils';
6
6
 
7
7
  // src/toast-group.connect.ts
8
8
  var anatomy = createAnatomy("toast").parts(
@@ -572,12 +572,10 @@ function connect(service, normalize) {
572
572
  var { not } = createGuards();
573
573
  var machine = createMachine({
574
574
  props({ props }) {
575
+ ensureProps(props, ["id", "type", "parent", "removeDelay"], "toast");
575
576
  return {
577
+ closable: true,
576
578
  ...props,
577
- id: props.id,
578
- type: props.type,
579
- parent: props.parent,
580
- closable: props.closable ?? true,
581
579
  duration: getToastDuration(props.duration, props.type)
582
580
  };
583
581
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/toast",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Core logic for the toast widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -26,12 +26,12 @@
26
26
  "url": "https://github.com/chakra-ui/zag/issues"
27
27
  },
28
28
  "dependencies": {
29
- "@zag-js/anatomy": "1.0.1",
30
- "@zag-js/core": "1.0.1",
31
- "@zag-js/dom-query": "1.0.1",
32
- "@zag-js/dismissable": "1.0.1",
33
- "@zag-js/utils": "1.0.1",
34
- "@zag-js/types": "1.0.1"
29
+ "@zag-js/anatomy": "1.0.2",
30
+ "@zag-js/core": "1.0.2",
31
+ "@zag-js/dom-query": "1.0.2",
32
+ "@zag-js/dismissable": "1.0.2",
33
+ "@zag-js/utils": "1.0.2",
34
+ "@zag-js/types": "1.0.2"
35
35
  },
36
36
  "devDependencies": {
37
37
  "clean-package": "2.2.0"