@sebgroup/green-react 3.15.0 → 3.16.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/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <div align="center">
2
- <img width="600" alt="green-react" src="https://github.com/sebgroup/green/assets/11420341/ad4c9fe3-137f-4230-9ea7-a4de87752aa9">
2
+ <img width="600" alt="green-react" src="https://github.com/seb-oss/green/assets/11420341/ad4c9fe3-137f-4230-9ea7-a4de87752aa9">
3
3
  <h1>@sebgroup/green-react</h1>
4
4
  <p>
5
5
  React components with SEB's look and feel.
package/index.esm.js CHANGED
@@ -9,6 +9,7 @@ import { GdsDropdown, GdsOption } from '@sebgroup/green-core/components/dropdown
9
9
  import { GdsContextMenu, GdsMenuItem, GdsMenuHeading } from '@sebgroup/green-core/components/context-menu/index.js';
10
10
  import classNames from 'classnames';
11
11
  import { GdsGroupedList, GdsListItem } from '@sebgroup/green-core/components/grouped-list/index.js';
12
+ import { disableBodyScroll, enableBodyScroll, clearAllBodyScrollLocks } from 'body-scroll-lock';
12
13
  import { IconAirplaneUp as IconAirplaneUp$1 } from '@sebgroup/green-core/components/icon/icons/airplane-up.js';
13
14
  import { IconAppleMusic as IconAppleMusic$1 } from '@sebgroup/green-core/components/icon/icons/apple-music.js';
14
15
  import { IconArchive as IconArchive$1 } from '@sebgroup/green-core/components/icon/icons/archive.js';
@@ -2966,6 +2967,7 @@ var Modal = function Modal(_a) {
2966
2967
  _useState6 = _slicedToArray(_useState5, 2),
2967
2968
  shouldRender = _useState6[0],
2968
2969
  setShouldRender = _useState6[1];
2970
+ var modalRef = useRef(null);
2969
2971
  useEffect(function () {
2970
2972
  if (isOpen && !shouldRender && status === UNMOUNTED) {
2971
2973
  setShouldRender(true);
@@ -2984,6 +2986,17 @@ var Modal = function Modal(_a) {
2984
2986
  setShouldRender(false);
2985
2987
  }, DELAY);
2986
2988
  }
2989
+ if (isOpen && modalRef.current) {
2990
+ // Disable scrolling on the body when the modal is open
2991
+ disableBodyScroll(modalRef.current);
2992
+ } else if (modalRef.current) {
2993
+ // Enable scrolling on the body when the modal is closed
2994
+ enableBodyScroll(modalRef.current);
2995
+ }
2996
+ return function () {
2997
+ // Cleanup by enabling body scroll and removing all scroll locks
2998
+ clearAllBodyScrollLocks();
2999
+ };
2987
3000
  }, [isOpen, shouldRender, status]);
2988
3001
  if (!isOpen) return null;
2989
3002
  var bodyId = "".concat(uuid, "_body");
@@ -3006,6 +3019,7 @@ var Modal = function Modal(_a) {
3006
3019
  modalContent = jsxs("aside", Object.assign({
3007
3020
  className: className
3008
3021
  }, dialogProps, {
3022
+ ref: modalRef,
3009
3023
  children: [jsx(ModalHeader, Object.assign({
3010
3024
  id: headerId,
3011
3025
  setStatus: setStatus,
@@ -3020,6 +3034,7 @@ var Modal = function Modal(_a) {
3020
3034
  case 'takeover':
3021
3035
  {
3022
3036
  modalContent = jsxs("main", Object.assign({}, dialogProps, {
3037
+ ref: modalRef,
3023
3038
  children: [jsx(ModalHeader, Object.assign({
3024
3039
  id: headerId
3025
3040
  }, props)), jsx(ModalBody, Object.assign({
@@ -3032,6 +3047,7 @@ var Modal = function Modal(_a) {
3032
3047
  {
3033
3048
  modalContent = jsx("div", {
3034
3049
  className: "gds-dialog-wrapper",
3050
+ ref: modalRef,
3035
3051
  children: jsxs("section", Object.assign({}, dialogProps, {
3036
3052
  children: [jsx(ModalHeader, Object.assign({
3037
3053
  id: headerId
package/package.json CHANGED
@@ -1,21 +1,22 @@
1
1
  {
2
2
  "name": "@sebgroup/green-react",
3
- "version": "3.15.0",
3
+ "version": "3.16.0",
4
4
  "peerDependencies": {
5
5
  "react": "^17 || ^18",
6
6
  "react-dom": "^17 || ^18"
7
7
  },
8
8
  "dependencies": {
9
9
  "@sebgroup/green-core": "^1.38.1",
10
- "@sebgroup/chlorophyll": "^3.4.1",
10
+ "@sebgroup/chlorophyll": "^3.6.2",
11
11
  "@sebgroup/extract": "^3.0.1",
12
12
  "@lit/react": "^1.0.2",
13
- "classnames": "^2.3.2"
13
+ "classnames": "^2.3.2",
14
+ "body-scroll-lock": "^3.1.5"
14
15
  },
15
16
  "description": "React components built on top of @sebgroup/chlorophyll.",
16
17
  "repository": {
17
18
  "type": "git",
18
- "url": "git+https://github.com/sebgroup/green.git"
19
+ "url": "git+https://github.com/seb-oss/green.git"
19
20
  },
20
21
  "publishConfig": {
21
22
  "registry": "https://registry.npmjs.org/",
@@ -26,7 +27,7 @@
26
27
  "contributors": [],
27
28
  "license": "Apache-2.0",
28
29
  "bugs": {
29
- "url": "https://github.com/sebgroup/green/labels/react"
30
+ "url": "https://github.com/seb-oss/green/labels/react"
30
31
  },
31
32
  "homepage": "https://storybook.seb.io/latest/react/",
32
33
  "module": "./index.esm.js",