@zag-js/toast 1.43.1 → 1.43.3

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.
@@ -34,12 +34,16 @@ __export(toast_connect_exports, {
34
34
  });
35
35
  module.exports = __toCommonJS(toast_connect_exports);
36
36
  var import_dom_query = require("@zag-js/dom-query");
37
+ var import_utils = require("@zag-js/utils");
37
38
  var import_toast = require("./toast.anatomy.js");
38
39
  var dom = __toESM(require("./toast.dom.js"));
39
40
  var import_toast2 = require("./toast.utils.js");
41
+ var defaultTranslations = {
42
+ closeTriggerLabel: "Dismiss notification"
43
+ };
40
44
  function connect(service, normalize) {
41
45
  const { state, send, prop, scope, context, computed } = service;
42
- const translations = prop("translations");
46
+ const translations = (0, import_utils.mergeWithDefault)(defaultTranslations, prop("translations"));
43
47
  const visible = state.hasTag("visible");
44
48
  const paused = state.hasTag("paused");
45
49
  const mounted = context.get("mounted");
@@ -1,11 +1,15 @@
1
1
  // src/toast.connect.ts
2
2
  import { dataAttr } from "@zag-js/dom-query";
3
+ import { mergeWithDefault } from "@zag-js/utils";
3
4
  import { parts } from "./toast.anatomy.mjs";
4
5
  import * as dom from "./toast.dom.mjs";
5
6
  import { getGhostAfterStyle, getGhostBeforeStyle, getPlacementStyle } from "./toast.utils.mjs";
7
+ var defaultTranslations = {
8
+ closeTriggerLabel: "Dismiss notification"
9
+ };
6
10
  function connect(service, normalize) {
7
11
  const { state, send, prop, scope, context, computed } = service;
8
- const translations = prop("translations");
12
+ const translations = mergeWithDefault(defaultTranslations, prop("translations"));
9
13
  const visible = state.hasTag("visible");
10
14
  const paused = state.hasTag("paused");
11
15
  const mounted = context.get("mounted");
@@ -45,10 +45,6 @@ var machine = (0, import_core.createMachine)({
45
45
  return {
46
46
  closable: true,
47
47
  ...props,
48
- translations: {
49
- closeTriggerLabel: "Dismiss notification",
50
- ...props.translations
51
- },
52
48
  duration: (0, import_toast.getToastDuration)(props.duration, props.type)
53
49
  };
54
50
  },
@@ -11,10 +11,6 @@ var machine = createMachine({
11
11
  return {
12
12
  closable: true,
13
13
  ...props,
14
- translations: {
15
- closeTriggerLabel: "Dismiss notification",
16
- ...props.translations
17
- },
18
14
  duration: getToastDuration(props.duration, props.type)
19
15
  };
20
16
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/toast",
3
- "version": "1.43.1",
3
+ "version": "1.43.3",
4
4
  "description": "Core logic for the toast widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -29,12 +29,12 @@
29
29
  "url": "https://github.com/chakra-ui/zag/issues"
30
30
  },
31
31
  "dependencies": {
32
- "@zag-js/anatomy": "1.43.1",
33
- "@zag-js/core": "1.43.1",
34
- "@zag-js/dom-query": "1.43.1",
35
- "@zag-js/dismissable": "1.43.1",
36
- "@zag-js/utils": "1.43.1",
37
- "@zag-js/types": "1.43.1"
32
+ "@zag-js/anatomy": "1.43.3",
33
+ "@zag-js/core": "1.43.3",
34
+ "@zag-js/dom-query": "1.43.3",
35
+ "@zag-js/utils": "1.43.3",
36
+ "@zag-js/dismissable": "1.43.3",
37
+ "@zag-js/types": "1.43.3"
38
38
  },
39
39
  "devDependencies": {
40
40
  "clean-package": "2.2.0"