@moda/om 17.7.0 → 17.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moda/om",
3
- "version": "17.7.0",
3
+ "version": "17.8.0",
4
4
  "description": "Moda Operandi design system",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import classNames from 'classnames';
3
3
  import ExitIcon from '@moda/icons/exit-16';
4
+ import { FocusOn } from 'react-focus-on';
4
5
  import { Clickable } from '../Clickable';
5
6
  import { Text } from '../Text';
6
-
7
- import './SlidingPane.scss';
8
7
  import { Stack } from '../Stack';
8
+ import './SlidingPane.scss';
9
9
 
10
10
  export type SlidingPaneProps = React.HTMLAttributes<HTMLDivElement> & {
11
11
  children: React.ReactNode;
@@ -24,34 +24,36 @@ export const SlidingPane: React.FC<SlidingPaneProps> = ({
24
24
  }) => {
25
25
  return (
26
26
  <>
27
- <div
28
- className={classNames('SlidingPane', className, {
29
- 'SlidingPane--active': visible
30
- })}
31
- {...rest}
32
- >
33
- <Stack
34
- space={0}
35
- justifyContent="center"
36
- direction="horizontal"
37
- className="SlidingPane__top"
38
- >
39
- <Text treatment="h5" family="serif">
40
- {title}
41
- </Text>
42
- <Clickable className="SlidingPane__close" onClick={onClose}>
43
- <ExitIcon />
44
- </Clickable>
45
- </Stack>
46
- <div className="SlidingPane__content">{children}</div>
47
- </div>
48
-
49
27
  <div
50
28
  className={classNames('SlidingPane__overlay', {
51
29
  'SlidingPane__overlay--active': visible
52
30
  })}
53
31
  onClick={onClose}
54
32
  ></div>
33
+
34
+ <FocusOn enabled={visible} onClickOutside={onClose} onEscapeKey={onClose}>
35
+ <div
36
+ className={classNames('SlidingPane', className, {
37
+ 'SlidingPane--active': visible
38
+ })}
39
+ {...rest}
40
+ >
41
+ <Stack
42
+ space={0}
43
+ justifyContent="center"
44
+ direction="horizontal"
45
+ className="SlidingPane__top"
46
+ >
47
+ <Text treatment="h5" family="serif">
48
+ {title}
49
+ </Text>
50
+ <Clickable className="SlidingPane__close" onClick={onClose}>
51
+ <ExitIcon />
52
+ </Clickable>
53
+ </Stack>
54
+ <div className="SlidingPane__content">{children}</div>
55
+ </div>
56
+ </FocusOn>
55
57
  </>
56
58
  );
57
59
  };