@synerise/ds-modal 1.1.3 → 1.1.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/CHANGELOG.md CHANGED
@@ -3,6 +3,25 @@
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.1.5](https://github.com/synerise/synerise-design/compare/@synerise/ds-modal@1.1.4...@synerise/ds-modal@1.1.5) (2025-06-11)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **modal:** make content fit inside modal ([1aa284e](https://github.com/synerise/synerise-design/commit/1aa284e304c2957c59dc2cc597103b65ad0b5a36))
12
+
13
+
14
+
15
+
16
+
17
+ ## [1.1.4](https://github.com/synerise/synerise-design/compare/@synerise/ds-modal@1.1.3...@synerise/ds-modal@1.1.4) (2025-06-05)
18
+
19
+ **Note:** Version bump only for package @synerise/ds-modal
20
+
21
+
22
+
23
+
24
+
6
25
  ## [1.1.3](https://github.com/synerise/synerise-design/compare/@synerise/ds-modal@1.1.2...@synerise/ds-modal@1.1.3) (2025-06-03)
7
26
 
8
27
  **Note:** Version bump only for package @synerise/ds-modal
package/README.md CHANGED
@@ -66,6 +66,9 @@ Some features of the Modal component have been deprecated. Please refer to the [
66
66
  | mask | Whether show mask or not. | Boolean | `true` |
67
67
  | closeIcon | custom close icon | ReactNode | - |
68
68
  | maskStyle | Style for modal's mask element. | object | {} |
69
+ | maxHeightViewport | height of modal with with scrollbar | true / number | 80 |
70
+
71
+
69
72
 
70
73
  and it is extended by props for ModalFooterBuilder:
71
74
 
package/dist/Modal.js CHANGED
@@ -1,10 +1,12 @@
1
- var _excluded = ["texts", "bodyBackground", "headerActions", "title", "description", "size", "blank", "settingButtonText", "titleContainerStyle"];
1
+ var _excluded = ["texts", "bodyBackground", "headerActions", "title", "description", "size", "blank", "settingButtonText", "titleContainerStyle", "maxViewportHeight", "children"];
2
2
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
3
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
4
- import React from 'react';
4
+ import React, { useRef } from 'react';
5
5
  import classnames from 'classnames';
6
6
  import '@synerise/ds-core/dist/js/style';
7
7
  import { Modal as AntModal } from 'antd';
8
+ import Scrollbar from '@synerise/ds-scrollbar';
9
+ import { useResizeObserver } from '@synerise/ds-utils';
8
10
  import { ModalFooter } from './Elements/ModalFooter';
9
11
  import { ModalTitle } from './Elements/ModalTitle';
10
12
  import "./style/index.css";
@@ -33,21 +35,42 @@ export var Modal = function Modal(props) {
33
35
  blank = props.blank,
34
36
  settingButtonText = props.settingButtonText,
35
37
  titleContainerStyle = props.titleContainerStyle,
38
+ maxViewportHeight = props.maxViewportHeight,
39
+ children = props.children,
36
40
  antModalProps = _objectWithoutPropertiesLoose(props, _excluded);
37
41
  var className = classnames("bodybg-" + bodyBackground, antModalProps.className, {
38
42
  'modal-blank': Boolean(blank)
39
43
  }, {
40
44
  'with-description': Boolean(description)
41
45
  });
46
+ var mainSlideRef = useRef(null);
47
+ var _useResizeObserver = useResizeObserver(mainSlideRef),
48
+ height = _useResizeObserver.height;
49
+ var DEFAULT_HEIGHT = 999999;
50
+ var DEFAULT_VIEWPORT_HEIGHT = 80;
51
+ var maxHeight = function maxHeight() {
52
+ if (maxViewportHeight !== undefined) {
53
+ if (typeof maxViewportHeight === 'number') {
54
+ return maxViewportHeight;
55
+ }
56
+ return DEFAULT_VIEWPORT_HEIGHT;
57
+ }
58
+ return undefined;
59
+ };
42
60
  var isFullscreen = size === 'fullScreen';
43
61
  return /*#__PURE__*/React.createElement(S.AntdModal, _extends({}, antModalProps, {
62
+ maxHeight: maxHeight(),
44
63
  className: className,
45
64
  isFullscreen: isFullscreen,
46
65
  width: size && mapSizeToWidth[size],
47
66
  closable: false,
48
67
  title: (title || description || blank) && /*#__PURE__*/React.createElement(ModalTitle, props),
49
68
  footer: antModalProps.footer !== null ? antModalProps.footer || /*#__PURE__*/React.createElement(ModalFooter, props) : null
50
- }));
69
+ }), maxHeight() ? /*#__PURE__*/React.createElement(S.ModalWrapper, {
70
+ ref: mainSlideRef
71
+ }, /*#__PURE__*/React.createElement(Scrollbar, {
72
+ maxHeight: height || DEFAULT_HEIGHT
73
+ }, children)) : children);
51
74
  };
52
75
  Modal.info = AntModal.info;
53
76
  Modal.success = AntModal.success;
@@ -7,4 +7,6 @@ export declare const AntdModal: import("styled-components").StyledComponent<impo
7
7
  config: typeof import("antd/lib/modal/confirm").modalGlobalConfig;
8
8
  }, any, {
9
9
  isFullscreen?: boolean | undefined;
10
+ maxHeight?: number | undefined;
10
11
  }, never>;
12
+ export declare const ModalWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -11,6 +11,12 @@ export var ButtonsWrapper = styled.div.withConfig({
11
11
  export var AntdModal = styled(Modal).withConfig({
12
12
  displayName: "Modalstyles__AntdModal",
13
13
  componentId: "sc-jdspxw-2"
14
- })(["", ""], function (props) {
14
+ })(["", " ", ""], function (props) {
15
15
  return props.isFullscreen && css(["&&{position:fixed;top:0;left:0;right:0;bottom:0;margin:0;max-width:none;padding:0;.ant-modal-content{display:flex;flex-direction:column;height:100%;}.ant-modal-body{flex:1 1 100%;overflow:scroll;}}"]);
16
- });
16
+ }, function (props) {
17
+ return props.maxHeight && css(["&&{position:fixed;left:50%;bottom:0;translate:-50%;.ant-modal-content{display:flex;max-height:", "vh;flex-direction:column;height:100%;}.ant-modal-body{flex:1 1 100%;overflow:scroll;padding-right:0px;min-height:0;}}"], props.maxHeight);
18
+ });
19
+ export var ModalWrapper = styled.div.withConfig({
20
+ displayName: "Modalstyles__ModalWrapper",
21
+ componentId: "sc-jdspxw-3"
22
+ })(["position:relative;height:100%;min-height:0;display:flex;flex-direction:column;overflow:hidden;"]);
@@ -15,6 +15,7 @@ export type ModalProps = {
15
15
  cancelButton?: string;
16
16
  };
17
17
  children?: ReactNode;
18
+ maxViewportHeight?: true | number;
18
19
  } & AntdModalProps & ModalFooterBuilder;
19
20
  export type ModalFooterBuilder = {
20
21
  prefix?: ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-modal",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "Modal UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "synerise/synerise-design",
@@ -34,10 +34,11 @@
34
34
  ],
35
35
  "types": "dist/index.d.ts",
36
36
  "dependencies": {
37
- "@synerise/ds-button": "^1.3.2",
38
- "@synerise/ds-icon": "^1.5.1",
39
- "@synerise/ds-typography": "^1.0.9",
40
- "@synerise/ds-utils": "^1.1.1",
37
+ "@synerise/ds-button": "^1.3.3",
38
+ "@synerise/ds-icon": "^1.5.2",
39
+ "@synerise/ds-scrollbar": "^1.0.9",
40
+ "@synerise/ds-typography": "^1.0.10",
41
+ "@synerise/ds-utils": "^1.2.0",
41
42
  "classnames": "2.3.2"
42
43
  },
43
44
  "peerDependencies": {
@@ -46,5 +47,5 @@
46
47
  "react": ">=16.9.0 <= 18.3.1",
47
48
  "styled-components": "^5.3.3"
48
49
  },
49
- "gitHead": "12eaee0c6431aac9a7b2dbc42e0f8567b3de7244"
50
+ "gitHead": "35c8f09d6a248f199237766c1f5181f4b3fc88af"
50
51
  }