@synerise/ds-modal 2.2.1 → 2.3.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 +19 -0
- package/CLAUDE.md +4 -4
- package/README.md +12 -0
- package/dist/Elements/ModalContent/ModalContent.js +5 -3
- package/package.json +6 -6
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
|
+
## [2.3.1](https://github.com/synerise/synerise-design/compare/@synerise/ds-modal@2.3.0...@synerise/ds-modal@2.3.1) (2026-11-05)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-modal
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [2.3.0](https://github.com/synerise/synerise-design/compare/@synerise/ds-modal@2.2.1...@synerise/ds-modal@2.3.0) (2026-11-03)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* expose ds-modal class hooks on the root, mask, wrap and dialog ([42724b3](https://github.com/synerise/synerise-design/commit/42724b3961d21495f015d0b27b14914e1ad2addd))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [2.2.1](https://github.com/synerise/synerise-design/compare/@synerise/ds-modal@2.2.0...@synerise/ds-modal@2.2.1) (2026-11-03)
|
|
7
26
|
|
|
8
27
|
|
package/CLAUDE.md
CHANGED
|
@@ -154,10 +154,10 @@ Built on top of `Modal` in `@synerise/ds-confirmation`:
|
|
|
154
154
|
DOM structure when visible:
|
|
155
155
|
```
|
|
156
156
|
document.body (portal target)
|
|
157
|
-
└─ ModalRoot (position: absolute, z-index from theme)
|
|
158
|
-
├─ ModalMask (position: fixed, full viewport, semi-transparent)
|
|
159
|
-
└─ ModalScrollWrap (position: fixed, full viewport, overflow: auto, scrollbar-gutter: stable)
|
|
160
|
-
└─ ModalContainer (absolute or fixed, sized, centered)
|
|
157
|
+
└─ ModalRoot `.ds-modal` (+ `.ds-modal-fullscreen` for size="fullScreen"; position: absolute, z-index from theme)
|
|
158
|
+
├─ ModalMask `.ds-modal-mask` (position: fixed, full viewport, semi-transparent)
|
|
159
|
+
└─ ModalScrollWrap `.ds-modal-wrap` (position: fixed, full viewport, overflow: auto, scrollbar-gutter: stable)
|
|
160
|
+
└─ ModalContainer `.ds-modal-dialog` (absolute or fixed, sized, centered)
|
|
161
161
|
├─ ModalTitle (header: title, tabs, actions, close button)
|
|
162
162
|
├─ ModalBody (content, optional grey background)
|
|
163
163
|
└─ ModalFooter (prefix / cancel / infix / ok / suffix)
|
package/README.md
CHANGED
|
@@ -148,6 +148,18 @@ ref.current?.scrollToBottom();
|
|
|
148
148
|
|
|
149
149
|
The dialog container carries `role="dialog"` and `aria-modal="true"`. When a `title` is provided it is linked via `aria-labelledby`; otherwise pass `ariaLabel` to give the dialog an accessible name. A `description`, when present, is linked via `aria-describedby`. The close button's accessible name defaults to the localised `DS.MODAL.CLOSE` translation (`"Close"`), overridable with `closeButtonAriaLabel`. Focus is trapped while the modal is open and restored to the previously focused element on close, and `Escape` closes the modal when `onCancel` is set and `closable` is not `false`.
|
|
150
150
|
|
|
151
|
+
### CSS class hooks
|
|
152
|
+
|
|
153
|
+
Every modal carries stable classes for styling from outside (a host shell offsetting modals next to a side panel, for example), so styles never have to select on `data-testid`:
|
|
154
|
+
|
|
155
|
+
| Class | Element |
|
|
156
|
+
| ---------------------- | ------------------------------------------------------------ |
|
|
157
|
+
| `ds-modal` | the root, next to any `className` you pass |
|
|
158
|
+
| `ds-modal-fullscreen` | the root of a `size="fullScreen"` modal |
|
|
159
|
+
| `ds-modal-mask` | the backdrop |
|
|
160
|
+
| `ds-modal-wrap` | the full-viewport scroll wrapper the dialog is centred in |
|
|
161
|
+
| `ds-modal-dialog` | the dialog container (`role="dialog"`) |
|
|
162
|
+
|
|
151
163
|
### Footer layout slots
|
|
152
164
|
|
|
153
165
|
These props allow fine-grained control of the default footer layout:
|
|
@@ -46,6 +46,7 @@ const ModalContent = forwardRef(({
|
|
|
46
46
|
closeButtonAriaLabel,
|
|
47
47
|
initialFocusRef,
|
|
48
48
|
zIndex,
|
|
49
|
+
className,
|
|
49
50
|
...rest
|
|
50
51
|
}, modalRef) => {
|
|
51
52
|
const scrollRef = useRef(null);
|
|
@@ -55,6 +56,7 @@ const ModalContent = forwardRef(({
|
|
|
55
56
|
const descriptionId = useId();
|
|
56
57
|
const DEFAULT_VIEWPORT_HEIGHT = 80;
|
|
57
58
|
const isFullscreen = size === "fullScreen";
|
|
59
|
+
const rootClassName = ["ds-modal", isFullscreen && "ds-modal-fullscreen", className].filter(Boolean).join(" ");
|
|
58
60
|
const maxHeight = useMemo(() => {
|
|
59
61
|
if (maxViewportHeight !== void 0) {
|
|
60
62
|
if (typeof maxViewportHeight === "number") {
|
|
@@ -120,9 +122,9 @@ const ModalContent = forwardRef(({
|
|
|
120
122
|
useFocusTrap(containerRef, !hidden, {
|
|
121
123
|
initialFocus: initialFocusRef ?? dialogRef
|
|
122
124
|
});
|
|
123
|
-
return /* @__PURE__ */ jsx(OverlayZIndexProvider, { value: resolvedZIndex, children: /* @__PURE__ */ jsxs(ModalRoot, { "data-testid": "ds-modal", ...rest, zIndex: resolvedZIndex, $hidden: hidden, "data-visible": !hidden, onKeyDown: handleKeyDown, tabIndex: -1, ref: containerRef, children: [
|
|
124
|
-
/* @__PURE__ */ jsx(ModalMask, {}),
|
|
125
|
-
/* @__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: [
|
|
125
|
+
return /* @__PURE__ */ jsx(OverlayZIndexProvider, { value: resolvedZIndex, children: /* @__PURE__ */ jsxs(ModalRoot, { "data-testid": "ds-modal", ...rest, className: rootClassName, zIndex: resolvedZIndex, $hidden: hidden, "data-visible": !hidden, onKeyDown: handleKeyDown, tabIndex: -1, ref: containerRef, children: [
|
|
126
|
+
/* @__PURE__ */ jsx(ModalMask, { className: "ds-modal-mask" }),
|
|
127
|
+
/* @__PURE__ */ jsx(ModalScrollWrap, { className: "ds-modal-wrap", ref: scrollRef, onClick: handleMaskClick, children: /* @__PURE__ */ jsxs(ModalContainer, { className: "ds-modal-dialog", 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: [
|
|
126
128
|
/* @__PURE__ */ jsx(ModalTitle, { headerActions, blank, titleContainerStyle, onCancel: closable && onCancel ? handleCancel : void 0, title, titleId, description, descriptionId, headerTabProps, headerBottomBar, closeButtonAriaLabel }),
|
|
127
129
|
/* @__PURE__ */ jsx(ModalBody, { ref: useScrollbar ? void 0 : bodyScrollRef, greyBackground: bodyBackground === "grey", bodyFullWidth, style: bodyStyle, children: useScrollbar ? /* @__PURE__ */ jsx(ModalWrapper, { children: /* @__PURE__ */ jsx(Scrollbar, { scrollbarOptions: {
|
|
128
130
|
suppressScrollX: true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-modal",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "Modal UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "synerise/synerise-design",
|
|
@@ -39,16 +39,16 @@
|
|
|
39
39
|
"sideEffects": false,
|
|
40
40
|
"types": "dist/index.d.ts",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@synerise/ds-button": "^2.2.
|
|
42
|
+
"@synerise/ds-button": "^2.2.2",
|
|
43
43
|
"@synerise/ds-icon": "^2.3.1",
|
|
44
44
|
"@synerise/ds-scrollbar": "^2.1.1",
|
|
45
|
-
"@synerise/ds-tabs": "^2.1.
|
|
45
|
+
"@synerise/ds-tabs": "^2.1.2",
|
|
46
46
|
"@synerise/ds-typography": "^2.1.1",
|
|
47
47
|
"@synerise/ds-utils": "^2.3.1"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@synerise/ds-dropdown": "^2.2.
|
|
51
|
-
"@synerise/ds-popconfirm": "^2.1.
|
|
50
|
+
"@synerise/ds-dropdown": "^2.2.2",
|
|
51
|
+
"@synerise/ds-popconfirm": "^2.1.2",
|
|
52
52
|
"vitest": "4"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"react-intl": ">=3.12.0 <= 6.8",
|
|
59
59
|
"styled-components": "^5.3.3"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "4547f33b8c9317ccc697f89a2b2c62bcf97fbec3"
|
|
62
62
|
}
|