@zag-js/toast 1.47.0 → 1.48.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.
Files changed (41) hide show
  1. package/dist/index.d.mts +10 -17
  2. package/dist/index.d.ts +10 -17
  3. package/dist/index.js +18 -45
  4. package/dist/index.mjs +5 -11
  5. package/dist/toast-group.connect.d.mts +4 -8
  6. package/dist/toast-group.connect.d.ts +4 -8
  7. package/dist/toast-group.connect.js +73 -97
  8. package/dist/toast-group.connect.mjs +68 -61
  9. package/dist/toast-group.machine.d.mts +2 -8
  10. package/dist/toast-group.machine.d.ts +2 -8
  11. package/dist/toast-group.machine.js +292 -346
  12. package/dist/toast-group.machine.mjs +287 -310
  13. package/dist/toast.anatomy.d.mts +2 -6
  14. package/dist/toast.anatomy.d.ts +2 -6
  15. package/dist/toast.anatomy.js +8 -40
  16. package/dist/toast.anatomy.mjs +4 -14
  17. package/dist/toast.connect.d.mts +4 -8
  18. package/dist/toast.connect.d.ts +4 -8
  19. package/dist/toast.connect.js +133 -158
  20. package/dist/toast.connect.mjs +128 -122
  21. package/dist/toast.dom.d.mts +19 -23
  22. package/dist/toast.dom.d.ts +19 -23
  23. package/dist/toast.dom.js +54 -83
  24. package/dist/toast.dom.mjs +39 -47
  25. package/dist/toast.machine.d.mts +2 -8
  26. package/dist/toast.machine.d.ts +2 -8
  27. package/dist/toast.machine.js +272 -300
  28. package/dist/toast.machine.mjs +267 -264
  29. package/dist/toast.store.d.mts +2 -8
  30. package/dist/toast.store.d.ts +2 -8
  31. package/dist/toast.store.js +344 -306
  32. package/dist/toast.store.mjs +340 -281
  33. package/dist/toast.types.d.mts +372 -374
  34. package/dist/toast.types.d.ts +372 -374
  35. package/dist/toast.types.js +4 -18
  36. package/dist/toast.types.mjs +1 -0
  37. package/dist/toast.utils.d.mts +10 -14
  38. package/dist/toast.utils.d.ts +10 -14
  39. package/dist/toast.utils.js +167 -217
  40. package/dist/toast.utils.mjs +157 -186
  41. package/package.json +9 -9
@@ -1,41 +1,9 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/toast.anatomy.ts
21
- var toast_anatomy_exports = {};
22
- __export(toast_anatomy_exports, {
23
- anatomy: () => anatomy,
24
- parts: () => parts
25
- });
26
- module.exports = __toCommonJS(toast_anatomy_exports);
27
- var import_anatomy = require("@zag-js/anatomy");
28
- var anatomy = (0, import_anatomy.createAnatomy)("toast").parts(
29
- "group",
30
- "root",
31
- "title",
32
- "description",
33
- "actionTrigger",
34
- "closeTrigger"
35
- );
36
- var parts = anatomy.build();
37
- // Annotate the CommonJS export names for ESM import in node:
38
- 0 && (module.exports = {
39
- anatomy,
40
- parts
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
41
4
  });
5
+ // src/toast.anatomy.ts
6
+ const anatomy = (0, require("@zag-js/anatomy").createAnatomy)("toast").parts("group", "root", "title", "description", "actionTrigger", "closeTrigger");
7
+ const parts = anatomy.build();
8
+ exports.anatomy = anatomy;
9
+ exports.parts = parts;
@@ -1,15 +1,5 @@
1
- // src/toast.anatomy.ts
2
1
  import { createAnatomy } from "@zag-js/anatomy";
3
- var anatomy = createAnatomy("toast").parts(
4
- "group",
5
- "root",
6
- "title",
7
- "description",
8
- "actionTrigger",
9
- "closeTrigger"
10
- );
11
- var parts = anatomy.build();
12
- export {
13
- anatomy,
14
- parts
15
- };
2
+ // src/toast.anatomy.ts
3
+ const anatomy = createAnatomy("toast").parts("group", "root", "title", "description", "actionTrigger", "closeTrigger");
4
+ const parts = anatomy.build();
5
+ export { anatomy, parts };
@@ -1,8 +1,4 @@
1
- import { Service } from '@zag-js/core';
2
- import { PropTypes, NormalizeProps } from '@zag-js/types';
3
- import { ToastSchema, ToastApi } from './toast.types.mjs';
4
- import '@zag-js/dom-query';
5
-
6
- declare function connect<T extends PropTypes, O>(service: Service<ToastSchema<O>>, normalize: NormalizeProps<T>): ToastApi<T, O>;
7
-
8
- export { connect };
1
+ import { ToastApi, ToastSchema } from "./toast.types.mjs";
2
+ import { Service } from "@zag-js/core";
3
+ import { NormalizeProps, PropTypes } from "@zag-js/types";
4
+ export declare function connect<T extends PropTypes, O>(service: Service<ToastSchema<O>>, normalize: NormalizeProps<T>): ToastApi<T, O>;
@@ -1,8 +1,4 @@
1
- import { Service } from '@zag-js/core';
2
- import { PropTypes, NormalizeProps } from '@zag-js/types';
3
- import { ToastSchema, ToastApi } from './toast.types.js';
4
- import '@zag-js/dom-query';
5
-
6
- declare function connect<T extends PropTypes, O>(service: Service<ToastSchema<O>>, normalize: NormalizeProps<T>): ToastApi<T, O>;
7
-
8
- export { connect };
1
+ import { ToastApi, ToastSchema } from "./toast.types.js";
2
+ import { NormalizeProps, PropTypes } from "@zag-js/types";
3
+ import { Service } from "@zag-js/core";
4
+ export declare function connect<T extends PropTypes, O>(service: Service<ToastSchema<O>>, normalize: NormalizeProps<T>): ToastApi<T, O>;
@@ -1,161 +1,136 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/toast.connect.ts
31
- var toast_connect_exports = {};
32
- __export(toast_connect_exports, {
33
- connect: () => connect
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
34
4
  });
35
- module.exports = __toCommonJS(toast_connect_exports);
36
- var import_dom_query = require("@zag-js/dom-query");
37
- var import_utils = require("@zag-js/utils");
38
- var import_toast = require("./toast.anatomy.js");
39
- var dom = __toESM(require("./toast.dom.js"));
40
- var import_toast2 = require("./toast.utils.js");
41
- var defaultTranslations = {
42
- closeTriggerLabel: "Dismiss notification"
43
- };
5
+ const require_toast_anatomy = require("./toast.anatomy.js");
6
+ const require_toast_dom = require("./toast.dom.js");
7
+ const require_toast_utils = require("./toast.utils.js");
8
+ let _zag_js_dom_query = require("@zag-js/dom-query");
9
+ let _zag_js_utils = require("@zag-js/utils");
10
+ // src/toast.connect.ts
11
+ const defaultTranslations = { closeTriggerLabel: "Dismiss notification" };
44
12
  function connect(service, normalize) {
45
- const { state, send, prop, scope, context, computed } = service;
46
- const translations = (0, import_utils.mergeWithDefault)(defaultTranslations, prop("translations"));
47
- const visible = state.hasTag("visible");
48
- const paused = state.hasTag("paused");
49
- const mounted = context.get("mounted");
50
- const rendered = context.get("rendered");
51
- const frontmost = computed("frontmost");
52
- const placement = prop("parent").computed("placement");
53
- const type = prop("type");
54
- const stacked = prop("parent").state.matches("stack");
55
- const title = prop("title");
56
- const description = prop("description");
57
- const action = prop("action");
58
- const [side, align = "center"] = placement.split("-");
59
- return {
60
- type,
61
- title,
62
- description,
63
- placement,
64
- visible,
65
- paused,
66
- closable: !!prop("closable"),
67
- pause() {
68
- prop("parent").prop("store").pause(prop("id"));
69
- },
70
- resume() {
71
- prop("parent").prop("store").resume(prop("id"));
72
- },
73
- dismiss() {
74
- send({ type: "DISMISS", src: "programmatic" });
75
- },
76
- getRootProps() {
77
- return normalize.element({
78
- ...import_toast.parts.root.attrs,
79
- dir: prop("dir"),
80
- id: dom.getRootId(scope),
81
- "data-state": visible ? "open" : "closed",
82
- "data-type": type,
83
- "data-placement": placement,
84
- "data-align": align,
85
- "data-side": side,
86
- "data-mounted": (0, import_dom_query.dataAttr)(mounted),
87
- "data-paused": (0, import_dom_query.dataAttr)(paused),
88
- "data-first": (0, import_dom_query.dataAttr)(frontmost),
89
- "data-sibling": (0, import_dom_query.dataAttr)(!frontmost),
90
- "data-stack": (0, import_dom_query.dataAttr)(stacked),
91
- "data-overlap": (0, import_dom_query.dataAttr)(!stacked),
92
- role: "status",
93
- "aria-atomic": "true",
94
- "aria-describedby": description && rendered.description ? dom.getDescriptionId(scope) : void 0,
95
- "aria-labelledby": title && rendered.title ? dom.getTitleId(scope) : void 0,
96
- tabIndex: 0,
97
- style: (0, import_toast2.getPlacementStyle)(service, visible),
98
- onKeyDown(event) {
99
- if (event.defaultPrevented) return;
100
- if (event.key == "Escape") {
101
- send({ type: "DISMISS", src: "keyboard" });
102
- event.preventDefault();
103
- }
104
- }
105
- });
106
- },
107
- /* Leave a ghost div to avoid setting hover to false when transitioning out */
108
- getGhostBeforeProps() {
109
- return normalize.element({
110
- "data-ghost": "before",
111
- style: (0, import_toast2.getGhostBeforeStyle)(service, visible)
112
- });
113
- },
114
- /* Needed to avoid setting hover to false when in between toasts */
115
- getGhostAfterProps() {
116
- return normalize.element({
117
- "data-ghost": "after",
118
- style: (0, import_toast2.getGhostAfterStyle)()
119
- });
120
- },
121
- getTitleProps() {
122
- return normalize.element({
123
- ...import_toast.parts.title.attrs,
124
- id: dom.getTitleId(scope)
125
- });
126
- },
127
- getDescriptionProps() {
128
- return normalize.element({
129
- ...import_toast.parts.description.attrs,
130
- id: dom.getDescriptionId(scope)
131
- });
132
- },
133
- getActionTriggerProps() {
134
- return normalize.button({
135
- ...import_toast.parts.actionTrigger.attrs,
136
- type: "button",
137
- onClick(event) {
138
- if (event.defaultPrevented) return;
139
- action?.onClick?.();
140
- send({ type: "DISMISS", src: "user" });
141
- }
142
- });
143
- },
144
- getCloseTriggerProps() {
145
- return normalize.button({
146
- id: dom.getCloseTriggerId(scope),
147
- ...import_toast.parts.closeTrigger.attrs,
148
- type: "button",
149
- "aria-label": translations?.closeTriggerLabel,
150
- onClick(event) {
151
- if (event.defaultPrevented) return;
152
- send({ type: "DISMISS", src: "user" });
153
- }
154
- });
155
- }
156
- };
13
+ const { state, send, prop, scope, context, computed } = service;
14
+ const translations = (0, _zag_js_utils.mergeWithDefault)(defaultTranslations, prop("translations"));
15
+ const visible = state.hasTag("visible");
16
+ const paused = state.hasTag("paused");
17
+ const mounted = context.get("mounted");
18
+ const rendered = context.get("rendered");
19
+ const frontmost = computed("frontmost");
20
+ const placement = prop("parent").computed("placement");
21
+ const type = prop("type");
22
+ const stacked = prop("parent").state.matches("stack");
23
+ const title = prop("title");
24
+ const description = prop("description");
25
+ const action = prop("action");
26
+ const [side, align = "center"] = placement.split("-");
27
+ return {
28
+ type,
29
+ title,
30
+ description,
31
+ placement,
32
+ visible,
33
+ paused,
34
+ closable: !!prop("closable"),
35
+ pause() {
36
+ prop("parent").prop("store").pause(prop("id"));
37
+ },
38
+ resume() {
39
+ prop("parent").prop("store").resume(prop("id"));
40
+ },
41
+ dismiss() {
42
+ send({
43
+ type: "DISMISS",
44
+ src: "programmatic"
45
+ });
46
+ },
47
+ getRootProps() {
48
+ return normalize.element({
49
+ ...require_toast_anatomy.parts.root.attrs,
50
+ dir: prop("dir"),
51
+ id: require_toast_dom.getRootId(scope),
52
+ "data-state": visible ? "open" : "closed",
53
+ "data-type": type,
54
+ "data-placement": placement,
55
+ "data-align": align,
56
+ "data-side": side,
57
+ "data-mounted": (0, _zag_js_dom_query.dataAttr)(mounted),
58
+ "data-paused": (0, _zag_js_dom_query.dataAttr)(paused),
59
+ "data-first": (0, _zag_js_dom_query.dataAttr)(frontmost),
60
+ "data-sibling": (0, _zag_js_dom_query.dataAttr)(!frontmost),
61
+ "data-stack": (0, _zag_js_dom_query.dataAttr)(stacked),
62
+ "data-overlap": (0, _zag_js_dom_query.dataAttr)(!stacked),
63
+ role: "status",
64
+ "aria-atomic": "true",
65
+ "aria-describedby": description && rendered.description ? require_toast_dom.getDescriptionId(scope) : void 0,
66
+ "aria-labelledby": title && rendered.title ? require_toast_dom.getTitleId(scope) : void 0,
67
+ tabIndex: 0,
68
+ style: require_toast_utils.getPlacementStyle(service, visible),
69
+ onKeyDown(event) {
70
+ if (event.defaultPrevented) return;
71
+ if (event.key == "Escape") {
72
+ send({
73
+ type: "DISMISS",
74
+ src: "keyboard"
75
+ });
76
+ event.preventDefault();
77
+ }
78
+ }
79
+ });
80
+ },
81
+ getGhostBeforeProps() {
82
+ return normalize.element({
83
+ "data-ghost": "before",
84
+ style: require_toast_utils.getGhostBeforeStyle(service, visible)
85
+ });
86
+ },
87
+ getGhostAfterProps() {
88
+ return normalize.element({
89
+ "data-ghost": "after",
90
+ style: require_toast_utils.getGhostAfterStyle()
91
+ });
92
+ },
93
+ getTitleProps() {
94
+ return normalize.element({
95
+ ...require_toast_anatomy.parts.title.attrs,
96
+ id: require_toast_dom.getTitleId(scope)
97
+ });
98
+ },
99
+ getDescriptionProps() {
100
+ return normalize.element({
101
+ ...require_toast_anatomy.parts.description.attrs,
102
+ id: require_toast_dom.getDescriptionId(scope)
103
+ });
104
+ },
105
+ getActionTriggerProps() {
106
+ return normalize.button({
107
+ ...require_toast_anatomy.parts.actionTrigger.attrs,
108
+ type: "button",
109
+ onClick(event) {
110
+ if (event.defaultPrevented) return;
111
+ action?.onClick?.();
112
+ send({
113
+ type: "DISMISS",
114
+ src: "user"
115
+ });
116
+ }
117
+ });
118
+ },
119
+ getCloseTriggerProps() {
120
+ return normalize.button({
121
+ id: require_toast_dom.getCloseTriggerId(scope),
122
+ ...require_toast_anatomy.parts.closeTrigger.attrs,
123
+ type: "button",
124
+ "aria-label": translations?.closeTriggerLabel,
125
+ onClick(event) {
126
+ if (event.defaultPrevented) return;
127
+ send({
128
+ type: "DISMISS",
129
+ src: "user"
130
+ });
131
+ }
132
+ });
133
+ }
134
+ };
157
135
  }
158
- // Annotate the CommonJS export names for ESM import in node:
159
- 0 && (module.exports = {
160
- connect
161
- });
136
+ exports.connect = connect;
@@ -1,126 +1,132 @@
1
- // src/toast.connect.ts
2
- import { dataAttr } from "@zag-js/dom-query";
3
- import { mergeWithDefault } from "@zag-js/utils";
4
1
  import { parts } from "./toast.anatomy.mjs";
5
- import * as dom from "./toast.dom.mjs";
2
+ import { getCloseTriggerId, getDescriptionId, getRootId, getTitleId } from "./toast.dom.mjs";
6
3
  import { getGhostAfterStyle, getGhostBeforeStyle, getPlacementStyle } from "./toast.utils.mjs";
7
- var defaultTranslations = {
8
- closeTriggerLabel: "Dismiss notification"
9
- };
4
+ import { dataAttr } from "@zag-js/dom-query";
5
+ import { mergeWithDefault } from "@zag-js/utils";
6
+ // src/toast.connect.ts
7
+ const defaultTranslations = { closeTriggerLabel: "Dismiss notification" };
10
8
  function connect(service, normalize) {
11
- const { state, send, prop, scope, context, computed } = service;
12
- const translations = mergeWithDefault(defaultTranslations, prop("translations"));
13
- const visible = state.hasTag("visible");
14
- const paused = state.hasTag("paused");
15
- const mounted = context.get("mounted");
16
- const rendered = context.get("rendered");
17
- const frontmost = computed("frontmost");
18
- const placement = prop("parent").computed("placement");
19
- const type = prop("type");
20
- const stacked = prop("parent").state.matches("stack");
21
- const title = prop("title");
22
- const description = prop("description");
23
- const action = prop("action");
24
- const [side, align = "center"] = placement.split("-");
25
- return {
26
- type,
27
- title,
28
- description,
29
- placement,
30
- visible,
31
- paused,
32
- closable: !!prop("closable"),
33
- pause() {
34
- prop("parent").prop("store").pause(prop("id"));
35
- },
36
- resume() {
37
- prop("parent").prop("store").resume(prop("id"));
38
- },
39
- dismiss() {
40
- send({ type: "DISMISS", src: "programmatic" });
41
- },
42
- getRootProps() {
43
- return normalize.element({
44
- ...parts.root.attrs,
45
- dir: prop("dir"),
46
- id: dom.getRootId(scope),
47
- "data-state": visible ? "open" : "closed",
48
- "data-type": type,
49
- "data-placement": placement,
50
- "data-align": align,
51
- "data-side": side,
52
- "data-mounted": dataAttr(mounted),
53
- "data-paused": dataAttr(paused),
54
- "data-first": dataAttr(frontmost),
55
- "data-sibling": dataAttr(!frontmost),
56
- "data-stack": dataAttr(stacked),
57
- "data-overlap": dataAttr(!stacked),
58
- role: "status",
59
- "aria-atomic": "true",
60
- "aria-describedby": description && rendered.description ? dom.getDescriptionId(scope) : void 0,
61
- "aria-labelledby": title && rendered.title ? dom.getTitleId(scope) : void 0,
62
- tabIndex: 0,
63
- style: getPlacementStyle(service, visible),
64
- onKeyDown(event) {
65
- if (event.defaultPrevented) return;
66
- if (event.key == "Escape") {
67
- send({ type: "DISMISS", src: "keyboard" });
68
- event.preventDefault();
69
- }
70
- }
71
- });
72
- },
73
- /* Leave a ghost div to avoid setting hover to false when transitioning out */
74
- getGhostBeforeProps() {
75
- return normalize.element({
76
- "data-ghost": "before",
77
- style: getGhostBeforeStyle(service, visible)
78
- });
79
- },
80
- /* Needed to avoid setting hover to false when in between toasts */
81
- getGhostAfterProps() {
82
- return normalize.element({
83
- "data-ghost": "after",
84
- style: getGhostAfterStyle()
85
- });
86
- },
87
- getTitleProps() {
88
- return normalize.element({
89
- ...parts.title.attrs,
90
- id: dom.getTitleId(scope)
91
- });
92
- },
93
- getDescriptionProps() {
94
- return normalize.element({
95
- ...parts.description.attrs,
96
- id: dom.getDescriptionId(scope)
97
- });
98
- },
99
- getActionTriggerProps() {
100
- return normalize.button({
101
- ...parts.actionTrigger.attrs,
102
- type: "button",
103
- onClick(event) {
104
- if (event.defaultPrevented) return;
105
- action?.onClick?.();
106
- send({ type: "DISMISS", src: "user" });
107
- }
108
- });
109
- },
110
- getCloseTriggerProps() {
111
- return normalize.button({
112
- id: dom.getCloseTriggerId(scope),
113
- ...parts.closeTrigger.attrs,
114
- type: "button",
115
- "aria-label": translations?.closeTriggerLabel,
116
- onClick(event) {
117
- if (event.defaultPrevented) return;
118
- send({ type: "DISMISS", src: "user" });
119
- }
120
- });
121
- }
122
- };
9
+ const { state, send, prop, scope, context, computed } = service;
10
+ const translations = mergeWithDefault(defaultTranslations, prop("translations"));
11
+ const visible = state.hasTag("visible");
12
+ const paused = state.hasTag("paused");
13
+ const mounted = context.get("mounted");
14
+ const rendered = context.get("rendered");
15
+ const frontmost = computed("frontmost");
16
+ const placement = prop("parent").computed("placement");
17
+ const type = prop("type");
18
+ const stacked = prop("parent").state.matches("stack");
19
+ const title = prop("title");
20
+ const description = prop("description");
21
+ const action = prop("action");
22
+ const [side, align = "center"] = placement.split("-");
23
+ return {
24
+ type,
25
+ title,
26
+ description,
27
+ placement,
28
+ visible,
29
+ paused,
30
+ closable: !!prop("closable"),
31
+ pause() {
32
+ prop("parent").prop("store").pause(prop("id"));
33
+ },
34
+ resume() {
35
+ prop("parent").prop("store").resume(prop("id"));
36
+ },
37
+ dismiss() {
38
+ send({
39
+ type: "DISMISS",
40
+ src: "programmatic"
41
+ });
42
+ },
43
+ getRootProps() {
44
+ return normalize.element({
45
+ ...parts.root.attrs,
46
+ dir: prop("dir"),
47
+ id: getRootId(scope),
48
+ "data-state": visible ? "open" : "closed",
49
+ "data-type": type,
50
+ "data-placement": placement,
51
+ "data-align": align,
52
+ "data-side": side,
53
+ "data-mounted": dataAttr(mounted),
54
+ "data-paused": dataAttr(paused),
55
+ "data-first": dataAttr(frontmost),
56
+ "data-sibling": dataAttr(!frontmost),
57
+ "data-stack": dataAttr(stacked),
58
+ "data-overlap": dataAttr(!stacked),
59
+ role: "status",
60
+ "aria-atomic": "true",
61
+ "aria-describedby": description && rendered.description ? getDescriptionId(scope) : void 0,
62
+ "aria-labelledby": title && rendered.title ? getTitleId(scope) : void 0,
63
+ tabIndex: 0,
64
+ style: getPlacementStyle(service, visible),
65
+ onKeyDown(event) {
66
+ if (event.defaultPrevented) return;
67
+ if (event.key == "Escape") {
68
+ send({
69
+ type: "DISMISS",
70
+ src: "keyboard"
71
+ });
72
+ event.preventDefault();
73
+ }
74
+ }
75
+ });
76
+ },
77
+ getGhostBeforeProps() {
78
+ return normalize.element({
79
+ "data-ghost": "before",
80
+ style: getGhostBeforeStyle(service, visible)
81
+ });
82
+ },
83
+ getGhostAfterProps() {
84
+ return normalize.element({
85
+ "data-ghost": "after",
86
+ style: getGhostAfterStyle()
87
+ });
88
+ },
89
+ getTitleProps() {
90
+ return normalize.element({
91
+ ...parts.title.attrs,
92
+ id: getTitleId(scope)
93
+ });
94
+ },
95
+ getDescriptionProps() {
96
+ return normalize.element({
97
+ ...parts.description.attrs,
98
+ id: getDescriptionId(scope)
99
+ });
100
+ },
101
+ getActionTriggerProps() {
102
+ return normalize.button({
103
+ ...parts.actionTrigger.attrs,
104
+ type: "button",
105
+ onClick(event) {
106
+ if (event.defaultPrevented) return;
107
+ action?.onClick?.();
108
+ send({
109
+ type: "DISMISS",
110
+ src: "user"
111
+ });
112
+ }
113
+ });
114
+ },
115
+ getCloseTriggerProps() {
116
+ return normalize.button({
117
+ id: getCloseTriggerId(scope),
118
+ ...parts.closeTrigger.attrs,
119
+ type: "button",
120
+ "aria-label": translations?.closeTriggerLabel,
121
+ onClick(event) {
122
+ if (event.defaultPrevented) return;
123
+ send({
124
+ type: "DISMISS",
125
+ src: "user"
126
+ });
127
+ }
128
+ });
129
+ }
130
+ };
123
131
  }
124
- export {
125
- connect
126
- };
132
+ export { connect };