@synerise/ds-modal 1.5.2 → 1.6.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
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.6.0](https://github.com/synerise/synerise-design/compare/@synerise/ds-modal@1.5.2...@synerise/ds-modal@1.6.0) (2026-06-11)
7
+
8
+ ### Features
9
+
10
+ - add bodyScrollRef to Modal for external VirtualTable scroll ([72a8cbb](https://github.com/synerise/synerise-design/commit/72a8cbb40a75aa127ca11fc5984a46aef3a4fb80))
11
+ - focus dialog container on modal open, add initialFocusRef opt-in ([cf80110](https://github.com/synerise/synerise-design/commit/cf801100a30246bd1699debe293f4f7711c435b5))
12
+ - **tabs:** align dimensions with figma and add configurable group top padding ([bd8dbe4](https://github.com/synerise/synerise-design/commit/bd8dbe40a4f2e7dbd45acc3151cafd645181535e))
13
+
6
14
  ## [1.5.2](https://github.com/synerise/synerise-design/compare/@synerise/ds-modal@1.5.1...@synerise/ds-modal@1.5.2) (2026-06-03)
7
15
 
8
16
  ### Bug Fixes
@@ -36,12 +36,14 @@ const ModalContent = forwardRef(({
36
36
  footer,
37
37
  bodyStyle,
38
38
  disableScrollbar,
39
+ bodyScrollRef,
39
40
  closable = true,
40
41
  maskClosable = true,
41
42
  centered,
42
43
  hidden,
43
44
  ariaLabel,
44
45
  closeButtonAriaLabel,
46
+ initialFocusRef,
45
47
  ...rest
46
48
  }, modalRef) => {
47
49
  const scrollRef = useRef(null);
@@ -58,6 +60,7 @@ const ModalContent = forwardRef(({
58
60
  }
59
61
  return void 0;
60
62
  }, [maxViewportHeight]);
63
+ const useScrollbar = !!maxHeight && !disableScrollbar;
61
64
  const scrollToTop = useCallback(() => {
62
65
  scrollRef.current?.scrollTo(0, 0);
63
66
  }, []);
@@ -99,12 +102,17 @@ const ModalContent = forwardRef(({
99
102
  }
100
103
  };
101
104
  const containerRef = useRef(null);
102
- useFocusTrap(containerRef, !hidden);
105
+ const dialogRef = useRef(null);
106
+ useFocusTrap(containerRef, !hidden, {
107
+ initialFocus: initialFocusRef ?? dialogRef
108
+ });
103
109
  return /* @__PURE__ */ jsxs(ModalRoot, { "data-testid": "ds-modal", ...rest, $hidden: hidden, "data-visible": !hidden, onKeyDown: handleKeyDown, tabIndex: -1, ref: containerRef, children: [
104
110
  /* @__PURE__ */ jsx(ModalMask, {}),
105
- /* @__PURE__ */ jsx(ModalScrollWrap, { ref: scrollRef, onClick: handleMaskClick, children: /* @__PURE__ */ jsxs(ModalContainer, { onClick: cancelClick, role: "dialog", "aria-modal": true, "aria-labelledby": title ? titleId : void 0, "aria-label": !title ? ariaLabel : void 0, "aria-describedby": description ? descriptionId : void 0, isFullscreen, $width: size && SIZE_MAP[size], maxHeight, centered, children: [
111
+ /* @__PURE__ */ jsx(ModalScrollWrap, { ref: scrollRef, onClick: handleMaskClick, children: /* @__PURE__ */ jsxs(ModalContainer, { ref: dialogRef, tabIndex: -1, onClick: cancelClick, role: "dialog", "aria-modal": true, "aria-labelledby": title ? titleId : void 0, "aria-label": !title ? ariaLabel : void 0, "aria-describedby": description ? descriptionId : void 0, isFullscreen, $width: size && SIZE_MAP[size], maxHeight, centered, children: [
106
112
  /* @__PURE__ */ jsx(ModalTitle, { headerActions, blank, titleContainerStyle, onCancel: closable && onCancel ? handleCancel : void 0, title, titleId, description, descriptionId, headerTabProps, headerBottomBar, closeButtonAriaLabel }),
107
- /* @__PURE__ */ jsx(ModalBody, { greyBackground: bodyBackground === "grey", bodyFullWidth, style: bodyStyle, children: maxHeight && !disableScrollbar ? /* @__PURE__ */ jsx(ModalWrapper, { children: /* @__PURE__ */ jsx(Scrollbar, { absolute: true, children }) }) : children }),
113
+ /* @__PURE__ */ jsx(ModalBody, { ref: useScrollbar ? void 0 : bodyScrollRef, greyBackground: bodyBackground === "grey", bodyFullWidth, style: bodyStyle, children: useScrollbar ? /* @__PURE__ */ jsx(ModalWrapper, { children: /* @__PURE__ */ jsx(Scrollbar, { scrollbarOptions: {
114
+ suppressScrollX: true
115
+ }, absolute: true, classes: "ds-modal-body-scrollbar", ref: bodyScrollRef, children }) }) : children }),
108
116
  /* @__PURE__ */ jsx(ModalFooter, { CustomFooterButton, prefix, infix, suffix, onOk: onOk ? handleOk : void 0, onCancel: onCancel ? handleCancel : void 0, texts, okButton, okButtonProps, cancelButton, cancelButtonProps, cancelText, okText, okType, footer })
109
117
  ] }) })
110
118
  ] });
@@ -11,7 +11,7 @@ const ModalWrapper = /* @__PURE__ */ styled.div.withConfig({
11
11
  const Scrollbar = /* @__PURE__ */ styled(ScrollbarBase).withConfig({
12
12
  displayName: "ModalContentstyles__Scrollbar",
13
13
  componentId: "sc-1sk67uc-2"
14
- })(["display:flex;flex-direction:column;min-height:0;.scrollbar-container{min-height:0;}.ps__rail-y,.ps__rail-x{z-index:99;}"]);
14
+ })(["display:flex;flex-direction:column;min-height:0;.scrollbar-container{min-height:0;}.ps__rail-y,.ps__rail-x{z-index:99;}.ds-modal-body-scrollbar{width:100%;overflow-x:clip;}"]);
15
15
  const ModalBody = /* @__PURE__ */ styled.div.withConfig({
16
16
  displayName: "ModalContentstyles__ModalBody",
17
17
  componentId: "sc-1sk67uc-3"
@@ -3,7 +3,7 @@ import { useIntl } from "react-intl";
3
3
  import Button from "@synerise/ds-button";
4
4
  import Icon, { CloseM } from "@synerise/ds-icon";
5
5
  import Tabs from "@synerise/ds-tabs";
6
- import { CloseButton, ModalTitleWrapper, TitleContainer, Title, ActionButtons, Description, TabsWrapper, BottomBar } from "./ModalTitle.styles.js";
6
+ import { CloseButton, ModalHeaderTop, ModalTitleWrapper, TitleContainer, Title, ActionButtons, Description, TabsWrapper, BottomBar } from "./ModalTitle.styles.js";
7
7
  const ModalTitle = ({
8
8
  headerActions,
9
9
  blank,
@@ -26,16 +26,18 @@ const ModalTitle = ({
26
26
  });
27
27
  return /* @__PURE__ */ jsxs(Fragment, { children: [
28
28
  blank && onCancel && /* @__PURE__ */ jsx(CloseButton, { mode: "single-icon", "data-testid": "modal-close", className: "close-modal", type: "ghost", "aria-label": closeLabel, onClick: onCancel, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(CloseM, {}) }) }),
29
- (title || description || headerTabProps) && /* @__PURE__ */ jsxs(ModalTitleWrapper, { withDescription: !!description, withTabs: !!headerTabProps, children: [
30
- title && /* @__PURE__ */ jsxs(TitleContainer, { style: titleContainerStyle, "data-testid": "modal-title", children: [
31
- /* @__PURE__ */ jsx(Title, { level: 3, id: titleId, children: title }),
32
- /* @__PURE__ */ jsxs(ActionButtons, { children: [
33
- headerActions,
34
- onCancel && /* @__PURE__ */ jsx(Button, { mode: "single-icon", "data-testid": "modal-close", className: "close-modal", type: "ghost", "aria-label": closeLabel, onClick: onCancel, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(CloseM, {}) }) })
35
- ] })
29
+ (title || description || headerTabProps) && /* @__PURE__ */ jsxs(ModalHeaderTop, { children: [
30
+ /* @__PURE__ */ jsxs(ModalTitleWrapper, { withDescription: !!description, withTabs: !!headerTabProps, children: [
31
+ title && /* @__PURE__ */ jsxs(TitleContainer, { style: titleContainerStyle, "data-testid": "modal-title", children: [
32
+ /* @__PURE__ */ jsx(Title, { level: 3, id: titleId, children: title }),
33
+ /* @__PURE__ */ jsxs(ActionButtons, { children: [
34
+ headerActions,
35
+ onCancel && /* @__PURE__ */ jsx(Button, { mode: "single-icon", "data-testid": "modal-close", className: "close-modal", type: "ghost", "aria-label": closeLabel, onClick: onCancel, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(CloseM, {}) }) })
36
+ ] })
37
+ ] }),
38
+ description && /* @__PURE__ */ jsx(Description, { id: descriptionId, children: description })
36
39
  ] }),
37
- description && /* @__PURE__ */ jsx(Description, { id: descriptionId, children: description }),
38
- headerTabProps && /* @__PURE__ */ jsx(TabsWrapper, { children: /* @__PURE__ */ jsx(Tabs, { ...headerTabProps }) })
40
+ headerTabProps && /* @__PURE__ */ jsx(TabsWrapper, { children: /* @__PURE__ */ jsx(Tabs, { topPadding: 0, ...headerTabProps }) })
39
41
  ] }),
40
42
  headerBottomBar && /* @__PURE__ */ jsx(BottomBar, { children: headerBottomBar })
41
43
  ] });
@@ -4,6 +4,7 @@ export declare const TitleContainer: import('styled-components').StyledComponent
4
4
  export declare const Title: import('styled-components').StyledComponent<({ level, withoutMargin, children, className, ellipsis, ...antdProps }: import('@synerise/ds-typography/dist/Title.types').Props) => React.JSX.Element, any, {}, never>;
5
5
  export declare const ActionButtons: import('styled-components').StyledComponent<"div", any, {}, never>;
6
6
  export declare const BottomBar: import('styled-components').StyledComponent<"div", any, {}, never>;
7
+ export declare const ModalHeaderTop: import('styled-components').StyledComponent<"div", any, {}, never>;
7
8
  export declare const ModalTitleWrapper: import('styled-components').StyledComponent<"div", any, {
8
9
  withDescription?: boolean;
9
10
  withTabs?: boolean;
@@ -1,15 +1,6 @@
1
1
  import styled from "styled-components";
2
2
  import Button from "@synerise/ds-button";
3
3
  import { Title as Title$1 } from "@synerise/ds-typography";
4
- const getBottomPadding = (withTabs, withDescription) => {
5
- if (withTabs) {
6
- return 0;
7
- }
8
- if (withDescription) {
9
- return 12;
10
- }
11
- return 20;
12
- };
13
4
  const CloseButton = /* @__PURE__ */ styled(Button).withConfig({
14
5
  displayName: "ModalTitlestyles__CloseButton",
15
6
  componentId: "sc-hnk65g-0"
@@ -17,7 +8,7 @@ const CloseButton = /* @__PURE__ */ styled(Button).withConfig({
17
8
  const TitleContainer = /* @__PURE__ */ styled.div.withConfig({
18
9
  displayName: "ModalTitlestyles__TitleContainer",
19
10
  componentId: "sc-hnk65g-1"
20
- })(["display:flex;align-items:center;flex-wrap:nowrap;&&{.close-modal{line-height:1;}}"]);
11
+ })(["display:flex;align-items:center;flex-wrap:nowrap;min-height:40px;&&{.close-modal{line-height:1;}}"]);
21
12
  const Title = /* @__PURE__ */ styled(Title$1).withConfig({
22
13
  displayName: "ModalTitlestyles__Title",
23
14
  componentId: "sc-hnk65g-2"
@@ -29,24 +20,29 @@ const ActionButtons = /* @__PURE__ */ styled.div.withConfig({
29
20
  const BottomBar = /* @__PURE__ */ styled.div.withConfig({
30
21
  displayName: "ModalTitlestyles__BottomBar",
31
22
  componentId: "sc-hnk65g-4"
32
- })(["padding:12px 24px;border-bottom:1px solid ", ";"], (props) => props.theme.palette["grey-100"]);
23
+ })(["padding:12px 24px;border-bottom:1px solid ", ";"], (props) => props.theme.palette["grey-200"]);
24
+ const ModalHeaderTop = /* @__PURE__ */ styled.div.withConfig({
25
+ displayName: "ModalTitlestyles__ModalHeaderTop",
26
+ componentId: "sc-hnk65g-5"
27
+ })(["border-bottom:1px solid ", ";"], (props) => props.theme.palette["grey-100"]);
33
28
  const ModalTitleWrapper = /* @__PURE__ */ styled.div.withConfig({
34
29
  displayName: "ModalTitlestyles__ModalTitleWrapper",
35
- componentId: "sc-hnk65g-5"
36
- })(["padding:20px 24px;padding-bottom:", "px;font-size:18px;line-height:32px;border-bottom:1px solid ", ";"], (props) => getBottomPadding(!!props.withTabs, !!props.withDescription), (props) => props.theme.palette["grey-100"]);
30
+ componentId: "sc-hnk65g-6"
31
+ })(["padding:16px 24px;font-size:18px;line-height:32px;"]);
37
32
  const Description = /* @__PURE__ */ styled.div.withConfig({
38
33
  displayName: "ModalTitlestyles__Description",
39
- componentId: "sc-hnk65g-6"
34
+ componentId: "sc-hnk65g-7"
40
35
  })(["font-size:13px;font-weight:normal;line-height:18px;color:", ";display:block;padding:12px 0 0;margin:14px 0 0;background-image:linear-gradient( to right,", " 33%,", " 0% );background-repeat:repeat-x;background-size:4px 1px;background-position:top;"], (props) => props.theme.palette["grey-600"], (props) => props.theme.palette["grey-300"], (props) => props.theme.palette["white"]);
41
36
  const TabsWrapper = /* @__PURE__ */ styled.div.withConfig({
42
37
  displayName: "ModalTitlestyles__TabsWrapper",
43
- componentId: "sc-hnk65g-7"
44
- })(["padding-bottom:1px;"]);
38
+ componentId: "sc-hnk65g-8"
39
+ })(["padding-bottom:1px;padding:0 24px;"]);
45
40
  export {
46
41
  ActionButtons,
47
42
  BottomBar,
48
43
  CloseButton,
49
44
  Description,
45
+ ModalHeaderTop,
50
46
  ModalTitleWrapper,
51
47
  TabsWrapper,
52
48
  Title,
@@ -1,4 +1,4 @@
1
- import { CSSProperties, ComponentType, MouseEvent, ReactNode } from 'react';
1
+ import { CSSProperties, ComponentType, MouseEvent, MutableRefObject, ReactNode, RefObject } from 'react';
2
2
  import { ButtonProps, ButtonType } from '@synerise/ds-button';
3
3
  import { TabsProps } from '@synerise/ds-tabs';
4
4
  /**
@@ -47,6 +47,14 @@ export type ModalProps = {
47
47
  * (default message `'Close'`).
48
48
  */
49
49
  closeButtonAriaLabel?: string;
50
+ /**
51
+ * Ref to the element that should receive focus when the modal opens. By
52
+ * default focus lands on the dialog container itself, which screen readers
53
+ * announce by the dialog's accessible name (no cursor in any field). Provide
54
+ * this only when focusing a specific control is genuinely useful — e.g. the
55
+ * search input of a search dialog or the name field of a rename dialog.
56
+ */
57
+ initialFocusRef?: RefObject<HTMLElement | null>;
50
58
  /**
51
59
  * Background colour of the modal body.
52
60
  * @defaultValue `'white'`
@@ -59,6 +67,15 @@ export type ModalProps = {
59
67
  blank?: boolean;
60
68
  /** When `maxViewportHeight` is set, disables the built-in scrollbar wrapper. */
61
69
  disableScrollbar?: boolean;
70
+ /**
71
+ * Ref to the modal body's scroll element. When the custom scrollbar is active
72
+ * (`maxViewportHeight` set, `disableScrollbar` not), it resolves to that scrollbar's
73
+ * scroll node; when `disableScrollbar` is set, it resolves to the body element itself.
74
+ * Pass the same ref to a child `VirtualTable`'s `scrollElementRef` to make the modal's
75
+ * scroll drive the table's virtualization. Note: when the custom scrollbar is active the
76
+ * node binds one tick after mount (see the ds-scrollbar ref chain).
77
+ */
78
+ bodyScrollRef?: MutableRefObject<HTMLDivElement | null>;
62
79
  /** Removes the padding from the modal body. */
63
80
  bodyFullWidth?: boolean;
64
81
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-modal",
3
- "version": "1.5.2",
3
+ "version": "1.6.0",
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.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"
41
+ "@synerise/ds-button": "^1.5.32",
42
+ "@synerise/ds-icon": "^1.18.3",
43
+ "@synerise/ds-scrollbar": "^1.5.0",
44
+ "@synerise/ds-tabs": "^1.2.0",
45
+ "@synerise/ds-typography": "^1.1.25",
46
+ "@synerise/ds-utils": "^1.10.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "vitest": "4"
@@ -54,5 +54,5 @@
54
54
  "react-intl": ">=3.12.0 <= 6.8",
55
55
  "styled-components": "^5.3.3"
56
56
  },
57
- "gitHead": "5464a62f3d5e1620879a68832ef3f78096390b94"
57
+ "gitHead": "fe3379f50afdce6d8c61a2222ebbf03324107c95"
58
58
  }