@synerise/ds-modal 1.5.0 → 1.5.1

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/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.5.1](https://github.com/synerise/synerise-design/compare/@synerise/ds-modal@1.5.0...@synerise/ds-modal@1.5.1) (2026-05-26)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **modal:** imperative api leak ([baca840](https://github.com/synerise/synerise-design/commit/baca840aea23d21f7fd156668c2c3361158979a2))
11
+
6
12
  # [1.5.0](https://github.com/synerise/synerise-design/compare/@synerise/ds-modal@1.4.14...@synerise/ds-modal@1.5.0) (2026-05-22)
7
13
 
8
14
  ### Features
@@ -83,15 +83,8 @@ const ModalContent = forwardRef(({
83
83
  }
84
84
  closeModal();
85
85
  };
86
- const handleOk = async (event) => {
87
- if (!onOk) {
88
- return;
89
- }
90
- const onOkResult = onOk(event);
91
- if (onOkResult?.then !== void 0) {
92
- await onOkResult;
93
- closeModal();
94
- }
86
+ const handleOk = (event) => {
87
+ onOk?.(event);
95
88
  };
96
89
  const cancelClick = (event) => {
97
90
  event.stopPropagation();
@@ -1,2 +1,2 @@
1
1
  import { ModalHandle, ModalProps } from './Modal.types';
2
- export declare const showModal: ({ afterClose, ...initial }: ModalProps) => ModalHandle;
2
+ export declare const showModal: ({ onOk, afterClose, ...initial }: ModalProps) => ModalHandle;
package/dist/ShowModal.js CHANGED
@@ -2,21 +2,31 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { setPortalContent } from "@synerise/ds-core";
3
3
  import { Modal } from "./Modal.js";
4
4
  let modalInstanceId = 0;
5
+ const isThenable = (value) => !!value && typeof value.then === "function";
5
6
  const showModal = ({
7
+ onOk,
6
8
  afterClose,
7
9
  ...initial
8
10
  }) => {
9
11
  const cleanup = () => {
10
12
  setPortalContent(null);
11
13
  };
14
+ const handle = {
15
+ destroy: cleanup
16
+ };
17
+ const handleOk = async (event) => {
18
+ const result = onOk?.(event);
19
+ if (isThenable(result)) {
20
+ await result;
21
+ handle.destroy();
22
+ }
23
+ };
12
24
  modalInstanceId += 1;
13
- setPortalContent(/* @__PURE__ */ jsx(Modal, { ...initial, open: true, afterClose: () => {
25
+ setPortalContent(/* @__PURE__ */ jsx(Modal, { ...initial, open: true, onOk: onOk ? handleOk : void 0, afterClose: () => {
14
26
  afterClose?.();
15
27
  cleanup();
16
28
  } }, modalInstanceId));
17
- return {
18
- destroy: cleanup
19
- };
29
+ return handle;
20
30
  };
21
31
  export {
22
32
  showModal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-modal",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "Modal UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "synerise/synerise-design",
@@ -38,12 +38,12 @@
38
38
  "sideEffects": false,
39
39
  "types": "dist/index.d.ts",
40
40
  "dependencies": {
41
- "@synerise/ds-button": "^1.5.30",
42
- "@synerise/ds-icon": "^1.18.1",
43
- "@synerise/ds-scrollbar": "^1.4.0",
44
- "@synerise/ds-tabs": "^1.1.38",
45
- "@synerise/ds-typography": "^1.1.23",
46
- "@synerise/ds-utils": "^1.9.0"
41
+ "@synerise/ds-button": "^1.5.31",
42
+ "@synerise/ds-icon": "^1.18.2",
43
+ "@synerise/ds-scrollbar": "^1.4.1",
44
+ "@synerise/ds-tabs": "^1.1.39",
45
+ "@synerise/ds-typography": "^1.1.24",
46
+ "@synerise/ds-utils": "^1.9.1"
47
47
  },
48
48
  "devDependencies": {
49
49
  "vitest": "4"
@@ -53,5 +53,5 @@
53
53
  "react": ">=16.9.0 <= 18.3.1",
54
54
  "styled-components": "^5.3.3"
55
55
  },
56
- "gitHead": "f257f56d8991010593efd5ea9915335e813671a6"
56
+ "gitHead": "be94b7e7ec28b566a3279e24248e610d87d8c0a5"
57
57
  }