@sebgroup/green-react 3.14.1 → 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';
@@ -1422,6 +1423,7 @@ var IconButton = function IconButton(_a) {
1422
1423
  "aria-controls": props['aria-controls'],
1423
1424
  "aria-expanded": props['aria-expanded'],
1424
1425
  type: (_b = props.type) !== null && _b !== void 0 ? _b : 'button',
1426
+ title: props.title,
1425
1427
  children: children
1426
1428
  });
1427
1429
  };
@@ -2965,6 +2967,7 @@ var Modal = function Modal(_a) {
2965
2967
  _useState6 = _slicedToArray(_useState5, 2),
2966
2968
  shouldRender = _useState6[0],
2967
2969
  setShouldRender = _useState6[1];
2970
+ var modalRef = useRef(null);
2968
2971
  useEffect(function () {
2969
2972
  if (isOpen && !shouldRender && status === UNMOUNTED) {
2970
2973
  setShouldRender(true);
@@ -2983,6 +2986,17 @@ var Modal = function Modal(_a) {
2983
2986
  setShouldRender(false);
2984
2987
  }, DELAY);
2985
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
+ };
2986
3000
  }, [isOpen, shouldRender, status]);
2987
3001
  if (!isOpen) return null;
2988
3002
  var bodyId = "".concat(uuid, "_body");
@@ -3005,6 +3019,7 @@ var Modal = function Modal(_a) {
3005
3019
  modalContent = jsxs("aside", Object.assign({
3006
3020
  className: className
3007
3021
  }, dialogProps, {
3022
+ ref: modalRef,
3008
3023
  children: [jsx(ModalHeader, Object.assign({
3009
3024
  id: headerId,
3010
3025
  setStatus: setStatus,
@@ -3019,6 +3034,7 @@ var Modal = function Modal(_a) {
3019
3034
  case 'takeover':
3020
3035
  {
3021
3036
  modalContent = jsxs("main", Object.assign({}, dialogProps, {
3037
+ ref: modalRef,
3022
3038
  children: [jsx(ModalHeader, Object.assign({
3023
3039
  id: headerId
3024
3040
  }, props)), jsx(ModalBody, Object.assign({
@@ -3031,6 +3047,7 @@ var Modal = function Modal(_a) {
3031
3047
  {
3032
3048
  modalContent = jsx("div", {
3033
3049
  className: "gds-dialog-wrapper",
3050
+ ref: modalRef,
3034
3051
  children: jsxs("section", Object.assign({}, dialogProps, {
3035
3052
  children: [jsx(ModalHeader, Object.assign({
3036
3053
  id: headerId
package/package.json CHANGED
@@ -1,21 +1,22 @@
1
1
  {
2
2
  "name": "@sebgroup/green-react",
3
- "version": "3.14.1",
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
- "@sebgroup/green-core": "^1.35.0",
10
- "@sebgroup/chlorophyll": "^3.4.1",
9
+ "@sebgroup/green-core": "^1.38.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",
@@ -7,6 +7,7 @@ interface IconButtonInterface {
7
7
  'aria-expanded'?: boolean;
8
8
  'aria-controls'?: string;
9
9
  size?: 'small' | 'normal';
10
+ title?: string;
10
11
  }
11
12
  export declare const IconButton: ({ children, onClick, ...props }: IconButtonInterface) => import("react/jsx-runtime").JSX.Element;
12
13
  export {};