@moda/om 21.6.12 → 21.7.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.
@@ -5,5 +5,6 @@ export type SlidingPaneProps = React.HTMLAttributes<HTMLDivElement> & {
5
5
  title: string;
6
6
  visible: boolean;
7
7
  onClose: () => void;
8
+ autoFocus?: boolean;
8
9
  };
9
10
  export declare const SlidingPane: React.FC<SlidingPaneProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moda/om",
3
- "version": "21.6.12",
3
+ "version": "21.7.1",
4
4
  "description": "Moda Operandi design system",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useId } from 'react';
2
2
  import classNames from 'classnames';
3
3
  import ExitIcon from '@moda/icons/exit-16';
4
4
  import { FocusOn } from 'react-focus-on';
@@ -12,6 +12,7 @@ export type SlidingPaneProps = React.HTMLAttributes<HTMLDivElement> & {
12
12
  title: string;
13
13
  visible: boolean;
14
14
  onClose: () => void;
15
+ autoFocus?: boolean;
15
16
  };
16
17
 
17
18
  export const SlidingPane: React.FC<SlidingPaneProps> = ({
@@ -20,8 +21,11 @@ export const SlidingPane: React.FC<SlidingPaneProps> = ({
20
21
  visible,
21
22
  children,
22
23
  onClose,
24
+ autoFocus = true,
23
25
  ...rest
24
26
  }) => {
27
+ const titleId = useId();
28
+
25
29
  return (
26
30
  <>
27
31
  <div
@@ -31,8 +35,16 @@ export const SlidingPane: React.FC<SlidingPaneProps> = ({
31
35
  onClick={onClose}
32
36
  ></div>
33
37
 
34
- <FocusOn enabled={visible} onClickOutside={onClose} onEscapeKey={onClose}>
38
+ <FocusOn
39
+ enabled={visible}
40
+ autoFocus={autoFocus}
41
+ onClickOutside={onClose}
42
+ onEscapeKey={onClose}
43
+ >
35
44
  <div
45
+ role='dialog'
46
+ aria-modal='true'
47
+ aria-labelledby={titleId}
36
48
  className={classNames('SlidingPane', className, {
37
49
  'SlidingPane--active': visible
38
50
  })}
@@ -44,7 +56,7 @@ export const SlidingPane: React.FC<SlidingPaneProps> = ({
44
56
  direction='horizontal'
45
57
  className='SlidingPane__top'
46
58
  >
47
- <Text treatment='h5' family='serif'>
59
+ <Text id={titleId} treatment='h5' family='serif'>
48
60
  {title}
49
61
  </Text>
50
62
  <Clickable className='SlidingPane__close' aria-label='Close' onClick={onClose}>