@patternfly/react-core 4.267.11 → 4.267.13

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": "@patternfly/react-core",
3
- "version": "4.267.11",
3
+ "version": "4.267.13",
4
4
  "description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
5
5
  "main": "dist/js/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -71,5 +71,5 @@
71
71
  "react": "^16.8 || ^17 || ^18",
72
72
  "react-dom": "^16.8 || ^17 || ^18"
73
73
  },
74
- "gitHead": "ac2ae116262808313d4bed95611c382b3b76f98b"
74
+ "gitHead": "122f28feeb8a8130c8beb9e2504ba34e48b911b1"
75
75
  }
@@ -81,7 +81,7 @@ export interface FileUploadProps
81
81
  // Props available in FileUpload but not FileUploadField:
82
82
 
83
83
  /** Optional extra props to customize react-dropzone. */
84
- dropzoneProps?: DropzoneProps;
84
+ dropzoneProps?: Partial<DropzoneProps>;
85
85
  /** Clear button was clicked. */
86
86
  onClearClick?: React.MouseEventHandler<HTMLButtonElement>;
87
87
  /** On data changed - if type='text' or type='dataURL' and file was loaded it will call this method */
@@ -2,13 +2,13 @@ import * as React from 'react';
2
2
  import styles from '@patternfly/react-styles/css/components/Menu/menu';
3
3
  import { css } from '@patternfly/react-styles';
4
4
 
5
- export interface MenuGroupProps extends React.HTMLProps<HTMLElement> {
5
+ export interface MenuGroupProps extends Omit<React.HTMLProps<HTMLElement>, 'label'> {
6
6
  /** Items within group */
7
7
  children?: React.ReactNode;
8
8
  /** Additional classes added to the MenuGroup */
9
9
  className?: string;
10
10
  /** Group label */
11
- label?: string;
11
+ label?: React.ReactNode | React.FC;
12
12
  /** ID for title label */
13
13
  titleId?: string;
14
14
  /** Forwarded ref */
@@ -25,16 +25,23 @@ const MenuGroupBase: React.FunctionComponent<MenuGroupProps> = ({
25
25
  innerRef,
26
26
  labelHeadingLevel: HeadingLevel = 'h1',
27
27
  ...props
28
- }: MenuGroupProps) => (
29
- <section {...props} className={css('pf-c-menu__group', className)} ref={innerRef}>
30
- {label && (
31
- <HeadingLevel className={css(styles.menuGroupTitle)} id={titleId}>
32
- {label}
33
- </HeadingLevel>
34
- )}
35
- {children}
36
- </section>
37
- );
28
+ }: MenuGroupProps) => {
29
+ const Wrapper = typeof label === 'function' ? label : HeadingLevel;
30
+ return (
31
+ <section {...props} className={css('pf-c-menu__group', className)} ref={innerRef}>
32
+ <>
33
+ {['function', 'string'].includes(typeof label) ? (
34
+ <Wrapper className={css(styles.menuGroupTitle)} id={titleId}>
35
+ {label as React.ReactNode}
36
+ </Wrapper>
37
+ ) : (
38
+ label
39
+ )}
40
+ {children}
41
+ </>
42
+ </section>
43
+ );
44
+ };
38
45
 
39
46
  export const MenuGroup = React.forwardRef((props: MenuGroupProps, ref: React.Ref<HTMLElement>) => (
40
47
  <MenuGroupBase {...props} innerRef={ref} />
@@ -591,4 +591,4 @@ test('prepends create option to list of options if isCreateOptionOnTop flag is s
591
591
 
592
592
  const createOption = screen.getAllByRole('option')[0];
593
593
  expect(createOption).toHaveTextContent('Create "m"');
594
- });
594
+ });