Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const { addCallbackParam } = require("../../helpers");

// https://github.com/patternfly/patternfly-react/pull/8995
module.exports = {
meta: { fixable: "code" },
create: addCallbackParam(["MultipleFileUpload"], { onFileDrop: "_event" }),
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const { addCallbackParamTester } = require("../../testHelpers");

addCallbackParamTester(
"multipleFileUpload-add-event-param-to-callback",
"MultipleFileUpload",
"onFileDrop"
);
26 changes: 26 additions & 0 deletions packages/pf-codemods/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1401,6 +1401,32 @@ Out:

We've update the `aria-label` prop on MenuItemAction, making it required instead of optional.

### multipleFileUpload-add-event-param-to-callback [(#8995)](https://github.com/patternfly/patternfly-react/pull/8995)

We've updated the `onFileDrop` prop for MultipleFileUpload so that the `event` parameter is the first parameter. Handlers may require an update.

#### Examples

In:

```jsx
<MultipleFileUpload onFileDrop={(id) => handler(id)} />
const handler1 = (id) => {};
<MultipleFileUpload onFileDrop={handler1} />
function handler2(id) {};
<MultipleFileUpload onFileDrop={handler2} />
```

Out:

```jsx
<MultipleFileUpload onFileDrop={(_event, id) => handler(id)} />
const handler1 = (_event, id) => {};
<MultipleFileUpload onFileDrop={handler1} />
function handler2(_event, id) {};
<MultipleFileUpload onFileDrop={handler2} />
```

### nav-warn-flyouts-now-inline [(#8628)](https://github.com/patternfly/patternfly-react/pull/8628)

The placement Nav flyouts in the DOM has been changed, if you have Nav elements with flyouts you may need to update some selectors or snapshots in your test suites. This rule will raise a warning, but will not make any changes.
Expand Down
3 changes: 2 additions & 1 deletion test/test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ const alertVariantOption = AlertVariant.default;
<MenuItemAction />
<Modal titleIconVariant={variantOption}></Modal>
<ModalContent titleIconVariant="default"></ModalContent>
<MultipleFileUpload onFileDrop={foo => handler(foo)} />
<Nav flyout={"menu"} />
<Nav variant='horizontal-subnav' />
<NotificationBadge isRead />
Expand All @@ -183,8 +184,8 @@ const alertVariantOption = AlertVariant.default;
<OverflowMenuDropdownItem index={0} />
<PageGroup aria-label="tester" />
<PageNavigation aria-label="tester" />
<PageSidebar nav="Content" />
<PageSidebar isNavOpen />
<PageSidebar nav="Content" />
<PageToggleButton isNavOpen onNavToggle />
<Pagination defaultToFullPage perPageComponent="div" titles={{
currPage: "test",
Expand Down