@patternfly/react-core 4.235.8 → 4.236.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": "@patternfly/react-core",
3
- "version": "4.235.8",
3
+ "version": "4.236.0",
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",
@@ -44,9 +44,9 @@
44
44
  "generate": "node scripts/copyStyles.js"
45
45
  },
46
46
  "dependencies": {
47
- "@patternfly/react-icons": "^4.86.8",
48
- "@patternfly/react-styles": "^4.85.8",
49
- "@patternfly/react-tokens": "^4.87.8",
47
+ "@patternfly/react-icons": "^4.87.0",
48
+ "@patternfly/react-styles": "^4.86.0",
49
+ "@patternfly/react-tokens": "^4.88.0",
50
50
  "focus-trap": "6.9.2",
51
51
  "react-dropzone": "9.0.0",
52
52
  "tippy.js": "5.1.2",
@@ -70,5 +70,5 @@
70
70
  "react": "^16.8.0 || ^17.0.0",
71
71
  "react-dom": "^16.8.0 || ^17.0.0"
72
72
  },
73
- "gitHead": "6c9b5c5d59f891999837cd42cf974865548e6b7a"
73
+ "gitHead": "a4b7c93b2fad078f13a177a886317bbb054f4922"
74
74
  }
@@ -106,7 +106,7 @@ describe('Dropdown', () => {
106
106
  <Dropdown
107
107
  dropdownItems={dropdownItems}
108
108
  toggle={
109
- <DropdownToggle id="Dropdown Toggle" isPrimary>
109
+ <DropdownToggle id="Dropdown Toggle" toggleVariant="primary">
110
110
  Dropdown
111
111
  </DropdownToggle>
112
112
  }
@@ -46,7 +46,7 @@ export const DropdownPrimaryToggle: React.FunctionComponent = () => {
46
46
  <Dropdown
47
47
  onSelect={onSelect}
48
48
  toggle={
49
- <DropdownToggle id="toggle-primary" isPrimary onToggle={onToggle}>
49
+ <DropdownToggle id="toggle-primary" toggleVariant="primary" onToggle={onToggle}>
50
50
  Dropdown
51
51
  </DropdownToggle>
52
52
  }
@@ -124,7 +124,13 @@ export class MenuToggleBase extends React.Component<MenuToggleProps> {
124
124
  };
125
125
 
126
126
  if (isTypeahead) {
127
- return <div ref={innerRef as React.Ref<HTMLDivElement>} className={css(commonStyles)} {...componentProps} />;
127
+ return (
128
+ <div
129
+ ref={innerRef as React.Ref<HTMLDivElement>}
130
+ className={css(commonStyles, styles.modifiers.typeahead)}
131
+ {...componentProps}
132
+ />
133
+ );
128
134
  }
129
135
 
130
136
  if (splitButtonOptions) {
@@ -65,6 +65,8 @@ export interface PageSectionProps extends React.HTMLProps<HTMLDivElement> {
65
65
  * This prop should also be passed in if a heading is not being used to describe the content of the page section.
66
66
  */
67
67
  'aria-label'?: string;
68
+ /** Sets the base component to render. Defaults to section */
69
+ component?: keyof JSX.IntrinsicElements;
68
70
  }
69
71
 
70
72
  const variantType = {
@@ -98,6 +100,7 @@ export const PageSection: React.FunctionComponent<PageSectionProps> = ({
98
100
  hasShadowBottom = false,
99
101
  hasOverflowScroll = false,
100
102
  'aria-label': ariaLabel,
103
+ component = 'section',
101
104
  ...props
102
105
  }: PageSectionProps) => {
103
106
  const { height, getVerticalBreakpoint } = React.useContext(PageContext);
@@ -109,8 +112,10 @@ export const PageSection: React.FunctionComponent<PageSectionProps> = ({
109
112
  }
110
113
  }, [hasOverflowScroll, ariaLabel]);
111
114
 
115
+ const Component = component as any;
116
+
112
117
  return (
113
- <section
118
+ <Component
114
119
  {...props}
115
120
  className={css(
116
121
  variantType[type],
@@ -133,7 +138,7 @@ export const PageSection: React.FunctionComponent<PageSectionProps> = ({
133
138
  >
134
139
  {isWidthLimited && <div className={css(styles.pageMainBody)}>{children}</div>}
135
140
  {!isWidthLimited && children}
136
- </section>
141
+ </Component>
137
142
  );
138
143
  };
139
144
  PageSection.displayName = 'PageSection';
@@ -128,3 +128,15 @@ test('Logs a warning in the console when an aria-label is not included with hasO
128
128
 
129
129
  expect(consoleWarning).toHaveBeenCalled();
130
130
  });
131
+
132
+ test('Renders as a section by default', () => {
133
+ render(<PageSection>test</PageSection>);
134
+
135
+ expect(screen.getByText('test')).toHaveProperty('nodeName', 'SECTION');
136
+ });
137
+
138
+ test('Renders as other elements when a different element type is passed using the component prop', () => {
139
+ render(<PageSection component="main">test</PageSection>);
140
+
141
+ expect(screen.getByRole('main')).toHaveTextContent('test');
142
+ });