@moda/om 17.0.0 → 17.1.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.
@@ -8,5 +8,6 @@ export declare type ExpandableProps = React.HTMLAttributes<HTMLDivElement> & {
8
8
  icon?: 'chevron' | 'plus-minus';
9
9
  virtual?: boolean;
10
10
  'data-testid'?: string;
11
+ onToggle?: () => void;
11
12
  };
12
13
  export declare const Expandable: React.FC<ExpandableProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moda/om",
3
- "version": "17.0.0",
3
+ "version": "17.1.0",
4
4
  "description": "Moda Operandi design system",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -13,6 +13,7 @@ export type ExpandableProps = React.HTMLAttributes<HTMLDivElement> & {
13
13
  icon?: 'chevron' | 'plus-minus';
14
14
  virtual?: boolean;
15
15
  'data-testid'?: string;
16
+ onToggle?: () => void;
16
17
  };
17
18
 
18
19
  export const Expandable: React.FC<ExpandableProps> = ({
@@ -25,6 +26,7 @@ export const Expandable: React.FC<ExpandableProps> = ({
25
26
  defaultExpanded = false,
26
27
  // eslint-disable-next-line @typescript-eslint/naming-convention
27
28
  expanded: __expanded__,
29
+ onToggle,
28
30
  ...rest
29
31
  }) => {
30
32
  const [expanded, setExpanded] = useState(defaultExpanded);
@@ -33,7 +35,10 @@ export const Expandable: React.FC<ExpandableProps> = ({
33
35
  if (__expanded__ != null && __expanded__ !== expanded) setExpanded(__expanded__);
34
36
  }, [expanded, __expanded__]);
35
37
 
36
- const handleClick = useCallback(() => setExpanded(expanded => !expanded), []);
38
+ const handleClick = useCallback(() => {
39
+ setExpanded(expanded => !expanded);
40
+ onToggle?.();
41
+ }, [onToggle]);
37
42
 
38
43
  return (
39
44
  <div