@patternfly/react-core 6.1.0-prerelease.8 → 6.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.
- package/CHANGELOG.md +59 -0
- package/components/package.json +1 -1
- package/deprecated/package.json +1 -1
- package/dist/dynamic/components/AboutModal/package.json +1 -1
- package/dist/dynamic/components/Accordion/package.json +1 -1
- package/dist/dynamic/components/ActionList/package.json +1 -1
- package/dist/dynamic/components/Alert/package.json +1 -1
- package/dist/dynamic/components/Avatar/package.json +1 -1
- package/dist/dynamic/components/BackToTop/package.json +1 -1
- package/dist/dynamic/components/Backdrop/package.json +1 -1
- package/dist/dynamic/components/BackgroundImage/package.json +1 -1
- package/dist/dynamic/components/Badge/package.json +1 -1
- package/dist/dynamic/components/Banner/package.json +1 -1
- package/dist/dynamic/components/Brand/package.json +1 -1
- package/dist/dynamic/components/Breadcrumb/package.json +1 -1
- package/dist/dynamic/components/Button/package.json +1 -1
- package/dist/dynamic/components/CalendarMonth/package.json +1 -1
- package/dist/dynamic/components/Card/package.json +1 -1
- package/dist/dynamic/components/Checkbox/package.json +1 -1
- package/dist/dynamic/components/ClipboardCopy/package.json +1 -1
- package/dist/dynamic/components/CodeBlock/package.json +1 -1
- package/dist/dynamic/components/Content/package.json +1 -1
- package/dist/dynamic/components/DataList/package.json +1 -1
- package/dist/dynamic/components/DatePicker/package.json +1 -1
- package/dist/dynamic/components/DescriptionList/package.json +1 -1
- package/dist/dynamic/components/Divider/package.json +1 -1
- package/dist/dynamic/components/Drawer/package.json +1 -1
- package/dist/dynamic/components/Dropdown/package.json +1 -1
- package/dist/dynamic/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/components/EmptyState/package.json +1 -1
- package/dist/dynamic/components/ExpandableSection/package.json +1 -1
- package/dist/dynamic/components/FileUpload/package.json +1 -1
- package/dist/dynamic/components/Form/package.json +1 -1
- package/dist/dynamic/components/FormSelect/package.json +1 -1
- package/dist/dynamic/components/HelperText/package.json +1 -1
- package/dist/dynamic/components/Hint/package.json +1 -1
- package/dist/dynamic/components/Icon/package.json +1 -1
- package/dist/dynamic/components/InputGroup/package.json +1 -1
- package/dist/dynamic/components/JumpLinks/package.json +1 -1
- package/dist/dynamic/components/Label/package.json +1 -1
- package/dist/dynamic/components/List/package.json +1 -1
- package/dist/dynamic/components/LoginPage/package.json +1 -1
- package/dist/dynamic/components/Masthead/package.json +1 -1
- package/dist/dynamic/components/Menu/package.json +1 -1
- package/dist/dynamic/components/MenuToggle/package.json +1 -1
- package/dist/dynamic/components/Modal/package.json +1 -1
- package/dist/dynamic/components/MultipleFileUpload/package.json +1 -1
- package/dist/dynamic/components/Nav/package.json +1 -1
- package/dist/dynamic/components/NotificationBadge/package.json +1 -1
- package/dist/dynamic/components/NotificationDrawer/package.json +1 -1
- package/dist/dynamic/components/NumberInput/package.json +1 -1
- package/dist/dynamic/components/OverflowMenu/package.json +1 -1
- package/dist/dynamic/components/Page/package.json +1 -1
- package/dist/dynamic/components/Pagination/package.json +1 -1
- package/dist/dynamic/components/Panel/package.json +1 -1
- package/dist/dynamic/components/Popover/package.json +1 -1
- package/dist/dynamic/components/Progress/package.json +1 -1
- package/dist/dynamic/components/ProgressStepper/package.json +1 -1
- package/dist/dynamic/components/Radio/package.json +1 -1
- package/dist/dynamic/components/SearchInput/package.json +1 -1
- package/dist/dynamic/components/Select/package.json +1 -1
- package/dist/dynamic/components/Sidebar/package.json +1 -1
- package/dist/dynamic/components/SimpleList/package.json +1 -1
- package/dist/dynamic/components/Skeleton/package.json +1 -1
- package/dist/dynamic/components/SkipToContent/package.json +1 -1
- package/dist/dynamic/components/Slider/package.json +1 -1
- package/dist/dynamic/components/Spinner/package.json +1 -1
- package/dist/dynamic/components/Switch/package.json +1 -1
- package/dist/dynamic/components/Tabs/package.json +1 -1
- package/dist/dynamic/components/TextArea/package.json +1 -1
- package/dist/dynamic/components/TextInput/package.json +1 -1
- package/dist/dynamic/components/TextInputGroup/package.json +1 -1
- package/dist/dynamic/components/TimePicker/package.json +1 -1
- package/dist/dynamic/components/Timestamp/package.json +1 -1
- package/dist/dynamic/components/Title/package.json +1 -1
- package/dist/dynamic/components/ToggleGroup/package.json +1 -1
- package/dist/dynamic/components/Toolbar/package.json +1 -1
- package/dist/dynamic/components/Tooltip/package.json +1 -1
- package/dist/dynamic/components/TreeView/package.json +1 -1
- package/dist/dynamic/components/Truncate/package.json +1 -1
- package/dist/dynamic/components/Wizard/hooks/package.json +1 -1
- package/dist/dynamic/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/Chip/package.json +1 -1
- package/dist/dynamic/deprecated/components/DragDrop/package.json +1 -1
- package/dist/dynamic/deprecated/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/deprecated/components/Modal/package.json +1 -1
- package/dist/dynamic/deprecated/components/Tile/package.json +1 -1
- package/dist/dynamic/deprecated/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/package.json +1 -1
- package/dist/dynamic/helpers/FocusTrap/FocusTrap/package.json +1 -1
- package/dist/dynamic/helpers/GenerateId/GenerateId/package.json +1 -1
- package/dist/dynamic/helpers/KeyboardHandler/package.json +1 -1
- package/dist/dynamic/helpers/OUIA/ouia/package.json +1 -1
- package/dist/dynamic/helpers/Popper/Popper/package.json +1 -1
- package/dist/dynamic/helpers/constants/package.json +1 -1
- package/dist/dynamic/helpers/datetimeUtils/package.json +1 -1
- package/dist/dynamic/helpers/fileUtils/package.json +1 -1
- package/dist/dynamic/helpers/htmlConstants/package.json +1 -1
- package/dist/dynamic/helpers/package.json +1 -1
- package/dist/dynamic/helpers/resizeObserver/package.json +1 -1
- package/dist/dynamic/helpers/typeUtils/package.json +1 -1
- package/dist/dynamic/helpers/useInterval/package.json +1 -1
- package/dist/dynamic/helpers/useIsomorphicLayout/package.json +1 -1
- package/dist/dynamic/helpers/useUnmountEffect/package.json +1 -1
- package/dist/dynamic/helpers/util/package.json +1 -1
- package/dist/dynamic/layouts/Bullseye/package.json +1 -1
- package/dist/dynamic/layouts/Flex/package.json +1 -1
- package/dist/dynamic/layouts/Gallery/package.json +1 -1
- package/dist/dynamic/layouts/Grid/package.json +1 -1
- package/dist/dynamic/layouts/Level/package.json +1 -1
- package/dist/dynamic/layouts/Split/package.json +1 -1
- package/dist/dynamic/layouts/Stack/package.json +1 -1
- package/dist/dynamic/styles/package.json +1 -1
- package/dist/dynamic-modules.json +2 -0
- package/dist/esm/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
- package/dist/esm/components/CalendarMonth/CalendarMonth.js +7 -11
- package/dist/esm/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/dist/esm/components/Dropdown/Dropdown.d.ts +2 -0
- package/dist/esm/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/esm/components/Dropdown/Dropdown.js +12 -3
- package/dist/esm/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/esm/components/FileUpload/FileUpload.d.ts +2 -1
- package/dist/esm/components/FileUpload/FileUpload.d.ts.map +1 -1
- package/dist/esm/components/FileUpload/FileUpload.js +2 -1
- package/dist/esm/components/FileUpload/FileUpload.js.map +1 -1
- package/dist/esm/components/Menu/MenuContainer.d.ts +2 -0
- package/dist/esm/components/Menu/MenuContainer.d.ts.map +1 -1
- package/dist/esm/components/Menu/MenuContainer.js +21 -4
- package/dist/esm/components/Menu/MenuContainer.js.map +1 -1
- package/dist/esm/components/Select/Select.d.ts +4 -0
- package/dist/esm/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/components/Select/Select.js +12 -3
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarFilter.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarFilter.js +4 -2
- package/dist/esm/components/Toolbar/ToolbarFilter.js.map +1 -1
- package/dist/esm/demos/DashboardWrapper.d.ts.map +1 -1
- package/dist/esm/demos/DashboardWrapper.js +10 -2
- package/dist/esm/demos/DashboardWrapper.js.map +1 -1
- package/dist/esm/helpers/KeyboardHandler.d.ts +7 -0
- package/dist/esm/helpers/KeyboardHandler.d.ts.map +1 -1
- package/dist/esm/helpers/KeyboardHandler.js +25 -0
- package/dist/esm/helpers/KeyboardHandler.js.map +1 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.js +7 -11
- package/dist/js/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/dist/js/components/Dropdown/Dropdown.d.ts +2 -0
- package/dist/js/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/js/components/Dropdown/Dropdown.js +11 -2
- package/dist/js/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/js/components/FileUpload/FileUpload.d.ts +2 -1
- package/dist/js/components/FileUpload/FileUpload.d.ts.map +1 -1
- package/dist/js/components/FileUpload/FileUpload.js +2 -1
- package/dist/js/components/FileUpload/FileUpload.js.map +1 -1
- package/dist/js/components/Menu/MenuContainer.d.ts +2 -0
- package/dist/js/components/Menu/MenuContainer.d.ts.map +1 -1
- package/dist/js/components/Menu/MenuContainer.js +22 -5
- package/dist/js/components/Menu/MenuContainer.js.map +1 -1
- package/dist/js/components/Select/Select.d.ts +4 -0
- package/dist/js/components/Select/Select.d.ts.map +1 -1
- package/dist/js/components/Select/Select.js +11 -2
- package/dist/js/components/Select/Select.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarFilter.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarFilter.js +4 -2
- package/dist/js/components/Toolbar/ToolbarFilter.js.map +1 -1
- package/dist/js/demos/DashboardWrapper.d.ts.map +1 -1
- package/dist/js/demos/DashboardWrapper.js +10 -2
- package/dist/js/demos/DashboardWrapper.js.map +1 -1
- package/dist/js/helpers/KeyboardHandler.d.ts +7 -0
- package/dist/js/helpers/KeyboardHandler.d.ts.map +1 -1
- package/dist/js/helpers/KeyboardHandler.js +27 -1
- package/dist/js/helpers/KeyboardHandler.js.map +1 -1
- package/dist/umd/assets/{output-Df7FMwYL.css → output-ByZdJvYx.css} +10342 -10295
- package/dist/umd/react-core.min.js +3 -3
- package/helpers/package.json +1 -1
- package/layouts/package.json +1 -1
- package/next/package.json +1 -1
- package/package.json +7 -7
- package/src/components/CalendarMonth/CalendarMonth.tsx +7 -10
- package/src/components/DataList/examples/DataList.md +16 -4
- package/src/components/Dropdown/Dropdown.tsx +13 -1
- package/src/components/DualListSelector/examples/DualListSelector.md +16 -14
- package/src/components/FileUpload/FileUpload.tsx +3 -1
- package/src/components/FileUpload/__tests__/__snapshots__/FileUpload.test.tsx.snap +1 -1
- package/src/components/FileUpload/examples/FileUpload.md +1 -1
- package/src/components/FileUpload/examples/FileUploadTextWithRestrictions.tsx +24 -7
- package/src/components/LoginPage/examples/LoginPage.md +1 -1
- package/src/components/LoginPage/examples/LoginPageBasic.tsx +2 -2
- package/src/components/LoginPage/examples/LoginPageLanguageSelect.tsx +2 -2
- package/src/components/LoginPage/examples/LoginPageShowHidePassword.tsx +2 -2
- package/src/components/Menu/MenuContainer.tsx +24 -3
- package/src/components/Modal/examples/Modal.md +1 -1
- package/src/components/MultipleFileUpload/__tests__/__snapshots__/MultipleFileUpload.test.tsx.snap +3 -3
- package/src/components/Select/Select.tsx +16 -1
- package/src/components/Select/examples/SelectMultiTypeahead.tsx +1 -1
- package/src/components/Select/examples/SelectMultiTypeaheadCheckbox.tsx +1 -1
- package/src/components/Select/examples/SelectMultiTypeaheadCreatable.tsx +1 -1
- package/src/components/Select/examples/SelectTypeahead.tsx +1 -1
- package/src/components/Select/examples/SelectTypeaheadCreatable.tsx +1 -1
- package/src/components/SkipToContent/examples/SkipToContentBasic.tsx +144 -126
- package/src/components/Toolbar/ToolbarFilter.tsx +2 -1
- package/src/components/Wizard/examples/Wizard.md +2 -1
- package/src/components/Wizard/examples/WizardWithinModal.tsx +5 -8
- package/src/demos/CustomMenus/ApplicationLauncher.md +1 -1
- package/src/demos/CustomMenus/CustomMenus.md +1 -1
- package/src/demos/CustomMenus/examples/ApplicationLauncherDemo.tsx +2 -2
- package/src/demos/CustomMenus/examples/DrilldownMenuDemo.tsx +1 -1
- package/src/demos/DashboardWrapper.tsx +13 -2
- package/src/demos/ExpandableSection/examples/ExpandableTextDemo.tsx +1 -7
- package/src/demos/NotificationDrawer/examples/NotificationDrawerBasic.tsx +15 -1
- package/src/demos/NotificationDrawer/examples/NotificationDrawerGrouped.tsx +15 -1
- package/src/demos/assets/PF-IconLogo.svg +17 -0
- package/src/demos/examples/Masthead/MastheadWithHorizontalNav.tsx +14 -1
- package/src/demos/examples/Masthead/MastheadWithUtilitiesAndUserDropdownMenu.tsx +14 -1
- package/src/demos/examples/Nav/NavDefault.tsx +15 -1
- package/src/demos/examples/Nav/NavExpandable.tsx +15 -1
- package/src/demos/examples/Nav/NavFlyout.tsx +15 -1
- package/src/demos/examples/Nav/NavGrouped.tsx +15 -1
- package/src/demos/examples/Nav/NavHorizontal.tsx +15 -1
- package/src/demos/examples/Nav/NavHorizontalWithSubnav.tsx +15 -1
- package/src/demos/examples/Nav/NavManual.tsx +15 -1
- package/src/demos/examples/Nav/NavWithSubnav.tsx +15 -1
- package/src/demos/examples/Page/PageContextSelector.tsx +14 -1
- package/src/demos/examples/Page/PageStickySectionBreadcrumb.tsx +14 -1
- package/src/demos/examples/Page/PageStickySectionGroup.tsx +14 -1
- package/src/demos/examples/Page/PageStickySectionGroupAlternate.tsx +14 -1
- package/src/demos/examples/Wizard/InPageWithDrawer.tsx +15 -1
- package/src/demos/examples/Wizard/InPageWithDrawerInformationalStep.tsx +14 -1
- package/src/helpers/KeyboardHandler.tsx +27 -0
- package/src/demos/examples/DashboardWrapper.js +0 -126
package/helpers/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"6.1.0-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"6.1.0-prerelease.16","private":true}
|
package/layouts/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"6.1.0-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"6.1.0-prerelease.16","private":true}
|
package/next/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"6.1.0-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"6.1.0-prerelease.16","private":true}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "6.1.0
|
|
3
|
+
"version": "6.1.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",
|
|
@@ -46,15 +46,15 @@
|
|
|
46
46
|
"subpaths": "node ../../scripts/exportSubpaths.mjs --config subpaths.config.json"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@patternfly/react-icons": "^6.1.0
|
|
50
|
-
"@patternfly/react-styles": "^6.1.0
|
|
51
|
-
"@patternfly/react-tokens": "^6.1.0
|
|
49
|
+
"@patternfly/react-icons": "^6.1.0",
|
|
50
|
+
"@patternfly/react-styles": "^6.1.0",
|
|
51
|
+
"@patternfly/react-tokens": "^6.1.0",
|
|
52
52
|
"focus-trap": "7.6.2",
|
|
53
|
-
"react-dropzone": "^14.
|
|
53
|
+
"react-dropzone": "^14.3.5",
|
|
54
54
|
"tslib": "^2.8.1"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@patternfly/patternfly": "6.1.0-prerelease.
|
|
57
|
+
"@patternfly/patternfly": "6.1.0-prerelease.11",
|
|
58
58
|
"case-anything": "^2.1.13",
|
|
59
59
|
"css": "^3.0.0",
|
|
60
60
|
"fs-extra": "^11.2.0"
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"react": "^17 || ^18",
|
|
64
64
|
"react-dom": "^17 || ^18"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "fc70165f6d07de6a24f6943c826c1432ea6d44cf"
|
|
67
67
|
}
|
|
@@ -319,18 +319,15 @@ export const CalendarMonth = ({
|
|
|
319
319
|
onSelectToggle(isOpen);
|
|
320
320
|
}}
|
|
321
321
|
onSelect={(ev, monthNum) => {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
setFocusedDate(newDate);
|
|
329
|
-
setShouldFocus(false);
|
|
330
|
-
onMonthChange(ev, newDate);
|
|
331
|
-
}, 0);
|
|
322
|
+
setIsSelectOpen(false);
|
|
323
|
+
onSelectToggle(false);
|
|
324
|
+
const newDate = changeMonth(Number(monthNum as string));
|
|
325
|
+
setFocusedDate(newDate);
|
|
326
|
+
setShouldFocus(false);
|
|
327
|
+
onMonthChange(ev, newDate);
|
|
332
328
|
}}
|
|
333
329
|
selected={monthFormatted}
|
|
330
|
+
popperProps={{ appendTo: 'inline' }}
|
|
334
331
|
>
|
|
335
332
|
<SelectList>
|
|
336
333
|
{longMonths.map((longMonth, index) => (
|
|
@@ -23,7 +23,7 @@ import AngleDownIcon from '@patternfly/react-icons/dist/esm/icons/angle-down-ico
|
|
|
23
23
|
import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon';
|
|
24
24
|
import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
|
|
25
25
|
import { css } from '@patternfly/react-styles';
|
|
26
|
-
import {
|
|
26
|
+
import { DragDropSort, DragDropContainer, Droppable as NewDroppable } from '@patternfly/react-drag-drop';
|
|
27
27
|
|
|
28
28
|
## Examples
|
|
29
29
|
|
|
@@ -83,11 +83,23 @@ import { DragDrop, Draggable, Droppable } from '@patternfly/react-core/deprecate
|
|
|
83
83
|
|
|
84
84
|
### Draggable
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
To enable drag and drop, wrap the `<DataList>` component with `<DragDropSort>`, define the `variant` property as "DataList", and pass both the sortable items and `onDrop` callback to `<DragDropSort>`. `<DragDropSort>` will create the component's usual children internally based on the items property, so children should not be passed to the wrapped component.
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
Full drag and drop details can be found on the [drag and drop](/components/drag-and-drop) component page.
|
|
89
89
|
|
|
90
|
-
```ts
|
|
90
|
+
```ts file="../../../../../react-drag-drop/src/components/DragDrop/examples/DataListDraggable.tsx"
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Draggable with multiple drop zones
|
|
95
|
+
|
|
96
|
+
To enable multiple drop zones, and create the desired amount of `<Droppable>` components within a `<DragDropContainer>`.
|
|
97
|
+
|
|
98
|
+
Each `<Droppable>` should define the `wrapper` property as the component that acts as the drop zone, `<DataList>`, and the `items` property of their respective draggable items as an array of `<DraggableObject>` data. `<DragDropContainer>` should be passed the `onDrop`, `onContainerMove`, and `onCancel` callbacks to handle items being dropped, items moving between droppable containers, and what happens if the drag is cancelled respectively. `<DragDropContainer>` should also be given a `Record` representing all sortable drop zones' items. Both components should define the `variant` property as "DataList".
|
|
99
|
+
|
|
100
|
+
Full drag and drop details can be found on the [drag and drop](/components/drag-and-drop) component page.
|
|
101
|
+
|
|
102
|
+
```ts file="../../../../../react-drag-drop/src/components/DragDrop/examples/DragDropContainerDataList.tsx"
|
|
91
103
|
|
|
92
104
|
```
|
|
93
105
|
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { css } from '@patternfly/react-styles';
|
|
3
3
|
import { Menu, MenuContent, MenuProps } from '../Menu';
|
|
4
4
|
import { Popper } from '../../helpers/Popper/Popper';
|
|
5
|
-
import { useOUIAProps, OUIAProps } from '../../helpers';
|
|
5
|
+
import { useOUIAProps, OUIAProps, onToggleArrowKeydownDefault } from '../../helpers';
|
|
6
6
|
|
|
7
7
|
export interface DropdownPopperProps {
|
|
8
8
|
/** Vertical direction of the popper. If enableFlip is set to true, this will set the initial direction before the popper flips. */
|
|
@@ -51,6 +51,8 @@ export interface DropdownProps extends MenuProps, OUIAProps {
|
|
|
51
51
|
onOpenChange?: (isOpen: boolean) => void;
|
|
52
52
|
/** Keys that trigger onOpenChange, defaults to tab and escape. It is highly recommended to include Escape in the array, while Tab may be omitted if the menu contains non-menu items that are focusable. */
|
|
53
53
|
onOpenChangeKeys?: string[];
|
|
54
|
+
/** Callback to override the toggle keydown behavior. By default, when the toggle has focus and the menu is open, pressing the up/down arrow keys will focus a valid non-disabled menu item - the first item for the down arrow key and last item for the up arrow key. */
|
|
55
|
+
onToggleKeydown?: (event: KeyboardEvent) => void;
|
|
54
56
|
/** Indicates if the menu should be without the outer box-shadow. */
|
|
55
57
|
isPlain?: boolean;
|
|
56
58
|
/** Indicates if the menu should be scrollable. */
|
|
@@ -85,6 +87,7 @@ const DropdownBase: React.FunctionComponent<DropdownProps> = ({
|
|
|
85
87
|
toggle,
|
|
86
88
|
shouldFocusToggleOnSelect = false,
|
|
87
89
|
onOpenChange,
|
|
90
|
+
onToggleKeydown,
|
|
88
91
|
isPlain,
|
|
89
92
|
isScrollable,
|
|
90
93
|
innerRef,
|
|
@@ -139,6 +142,14 @@ const DropdownBase: React.FunctionComponent<DropdownProps> = ({
|
|
|
139
142
|
toggleRef.current?.focus();
|
|
140
143
|
}
|
|
141
144
|
}
|
|
145
|
+
|
|
146
|
+
if (toggleRef.current?.contains(event.target as Node)) {
|
|
147
|
+
if (onToggleKeydown) {
|
|
148
|
+
onToggleKeydown(event);
|
|
149
|
+
} else if (isOpen) {
|
|
150
|
+
onToggleArrowKeydownDefault(event, menuRef);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
142
153
|
};
|
|
143
154
|
|
|
144
155
|
const handleClick = (event: MouseEvent) => {
|
|
@@ -163,6 +174,7 @@ const DropdownBase: React.FunctionComponent<DropdownProps> = ({
|
|
|
163
174
|
toggleRef,
|
|
164
175
|
onOpenChange,
|
|
165
176
|
onOpenChangeKeys,
|
|
177
|
+
onToggleKeydown,
|
|
166
178
|
shouldPreventScrollOnItemFocus,
|
|
167
179
|
shouldFocusFirstItemOnOpen,
|
|
168
180
|
focusTimeoutDelay
|
|
@@ -22,7 +22,7 @@ import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-i
|
|
|
22
22
|
import PficonSortCommonAscIcon from '@patternfly/react-icons/dist/esm/icons/pficon-sort-common-asc-icon';
|
|
23
23
|
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
|
|
24
24
|
import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
|
|
25
|
-
import {
|
|
25
|
+
import { DragDropSort, DragDropContainer, Droppable as NewDroppable } from '@patternfly/react-drag-drop';
|
|
26
26
|
|
|
27
27
|
## Examples
|
|
28
28
|
|
|
@@ -78,22 +78,24 @@ The dual list selector is built in a composable manner to make customization eas
|
|
|
78
78
|
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
###
|
|
81
|
+
### Draggable
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
To enable drag and drop, wrap the `<DualListSelectorList>` component with `<DragDropSort>`, define the `variant` property as "DualListSelectorList", and pass both the sortable items and `onDrop` callback to `<DragDropSort>`. `<DragDropSort>` will create the component's usual children internally based on the items property, so children inside the `<DualListSelectorList>` should not be passed to the wrapped component.
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
- wrap the `DualListSelectorList` in a `Droppable` component
|
|
87
|
-
- wrap the `DualListSelectorListItem` components in a `Draggable` component
|
|
88
|
-
- define an `onDrop` callback which reorders the sortable options.
|
|
89
|
-
- The `onDrop` function provides the starting location and destination location for a dragged item. It should return
|
|
90
|
-
true to enable the 'drop' animation in the new location and false to enable the 'drop' animation back to the item's
|
|
91
|
-
old position.
|
|
92
|
-
- define an `onDrag` callback which ensures that the drag event will not cross hairs with the `onOptionSelect` click
|
|
93
|
-
event set on the option. Note: the `ignoreNextOptionSelect` state value is used to prevent selection while dragging.
|
|
85
|
+
Full drag and drop details can be found on the [drag and drop](/components/drag-and-drop) component page.
|
|
94
86
|
|
|
95
|
-
|
|
87
|
+
```ts file="../../../../../react-drag-drop/src/components/DragDrop/examples/DualListSelectorDraggable.tsx"
|
|
96
88
|
|
|
97
|
-
```
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Draggable with multiple drop zones
|
|
92
|
+
|
|
93
|
+
To enable multiple drop zones, wrap the `<DualListSelector>` component with `<DragDropContainer>`, and create the desired amount of `<Droppable>` components within `<DragDropContainer>`. `<Droppable>` components should be located where `<DualListSelectorList>` usually would go for each pane to be made draggable.
|
|
94
|
+
|
|
95
|
+
Each `<Droppable>` should define the `wrapper` property as the component that acts as the drop zone, `<DualListSelectorList>`, and the `items` property of their respective draggable items as an array of `<DraggableObject>` data. `<DragDropContainer>` should be passed the `onDrop`, `onContainerMove`, and `onCancel` callbacks to handle items being dropped, items moving between droppable containers, and what happens if the drag is cancelled respectively. `<DragDropContainer>` should also be given a `Record` representing all sortable drop zones' items. Both components should define the `variant` property as "DualListSelectorList".
|
|
96
|
+
|
|
97
|
+
Full drag and drop details can be found on the [drag and drop](/components/drag-and-drop) component page.
|
|
98
|
+
|
|
99
|
+
```ts file="../../../../../react-drag-drop/src/components/DragDrop/examples/DragDropContainerDualListSelector.tsx"
|
|
98
100
|
|
|
99
101
|
```
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { DropzoneInputProps, DropzoneOptions, FileRejection, useDropzone } from 'react-dropzone';
|
|
2
|
+
import { DropzoneInputProps, DropzoneOptions, FileRejection, useDropzone, ErrorCode } from 'react-dropzone';
|
|
3
3
|
import { FileUploadField, FileUploadFieldProps } from './FileUploadField';
|
|
4
4
|
import { readFile, fileReaderType } from '../../helpers/fileUtils';
|
|
5
5
|
import { DropEvent } from '../../helpers/typeUtils';
|
|
@@ -84,6 +84,8 @@ export interface FileUploadProps
|
|
|
84
84
|
onTextChange?: (event: React.ChangeEvent<HTMLTextAreaElement>, text: string) => void;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
export { ErrorCode as DropzoneErrorCode }; // FileInvalidType, FileTooLarge, FileTooSmall, TooManyFiles
|
|
88
|
+
|
|
87
89
|
export const FileUpload: React.FunctionComponent<FileUploadProps> = ({
|
|
88
90
|
id,
|
|
89
91
|
type,
|
|
@@ -87,7 +87,7 @@ exports[`simple fileupload 1`] = `
|
|
|
87
87
|
</span>
|
|
88
88
|
</div>
|
|
89
89
|
<input
|
|
90
|
-
style="
|
|
90
|
+
style="border: 0px; clip: rect(0px, 0px, 0px, 0px); clip-path: inset(50%); height: 1px; margin: 0px -1px -1px 0px; overflow: hidden; padding: 0px; position: absolute; width: 1px; white-space: nowrap;"
|
|
91
91
|
tabindex="-1"
|
|
92
92
|
type="file"
|
|
93
93
|
/>
|
|
@@ -40,7 +40,7 @@ Typing/pasting text in the box will call `onTextChange` with a string, and a str
|
|
|
40
40
|
|
|
41
41
|
### Restricting file size and type
|
|
42
42
|
|
|
43
|
-
Any [props accepted by `react-dropzone`'s `Dropzone` component](https://react-dropzone.js.org/#!/Dropzone) can be passed as a `dropzoneProps` object in order to customize the behavior of the Dropzone, such as restricting the size and type of files allowed. The following example will only accept CSV files smaller than 1 KB. Note that file type determination is not reliable across platforms (see the note on react-dropzone's docs about the `accept` prop), so be sure to test the behavior of your file upload restriction on all browsers and operating systems targeted by your application.
|
|
43
|
+
Any [props accepted by `react-dropzone`'s `Dropzone` component](https://react-dropzone.js.org/#!/Dropzone) can be passed as a `dropzoneProps` object in order to customize the behavior of the Dropzone, such as restricting the size and type of files allowed. You can also capture and act upon native `react-dropzone` errors using the exposed `DropzoneErrorCode` enum. The following example will only accept CSV files smaller than 1 KB. Note that file type determination is not reliable across platforms (see the note on react-dropzone's docs about the `accept` prop), so be sure to test the behavior of your file upload restriction on all browsers and operating systems targeted by your application.
|
|
44
44
|
|
|
45
45
|
#### IMPORTANT: A note about security
|
|
46
46
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {
|
|
3
3
|
FileUpload,
|
|
4
|
+
DropzoneErrorCode,
|
|
4
5
|
FileUploadHelperText,
|
|
5
6
|
Form,
|
|
6
7
|
FormGroup,
|
|
@@ -9,13 +10,13 @@ import {
|
|
|
9
10
|
DropEvent,
|
|
10
11
|
Icon
|
|
11
12
|
} from '@patternfly/react-core';
|
|
12
|
-
import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
|
|
13
13
|
|
|
14
14
|
export const TextFileUploadWithRestrictions: React.FunctionComponent = () => {
|
|
15
15
|
const [value, setValue] = React.useState('');
|
|
16
16
|
const [filename, setFilename] = React.useState('');
|
|
17
17
|
const [isLoading, setIsLoading] = React.useState(false);
|
|
18
18
|
const [isRejected, setIsRejected] = React.useState(false);
|
|
19
|
+
const [message, setMessage] = React.useState('Must be a CSV file no larger than 1 KB');
|
|
19
20
|
|
|
20
21
|
const handleFileInputChange = (_, file: File) => {
|
|
21
22
|
setFilename(file.name);
|
|
@@ -29,16 +30,25 @@ export const TextFileUploadWithRestrictions: React.FunctionComponent = () => {
|
|
|
29
30
|
setValue(value);
|
|
30
31
|
};
|
|
31
32
|
|
|
32
|
-
const
|
|
33
|
+
const reset = () => {
|
|
33
34
|
setFilename('');
|
|
34
35
|
setValue('');
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const handleClear = (_event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
|
|
39
|
+
reset();
|
|
35
40
|
setIsRejected(false);
|
|
36
41
|
};
|
|
37
42
|
|
|
38
43
|
const handleFileRejected = () => {
|
|
44
|
+
reset();
|
|
39
45
|
setIsRejected(true);
|
|
40
46
|
};
|
|
41
47
|
|
|
48
|
+
const handleFileAccepted = () => {
|
|
49
|
+
setIsRejected(false);
|
|
50
|
+
};
|
|
51
|
+
|
|
42
52
|
const handleFileReadStarted = (_event: DropEvent, _fileHandle: File) => {
|
|
43
53
|
setIsLoading(true);
|
|
44
54
|
};
|
|
@@ -66,7 +76,16 @@ export const TextFileUploadWithRestrictions: React.FunctionComponent = () => {
|
|
|
66
76
|
dropzoneProps={{
|
|
67
77
|
accept: { 'text/csv': ['.csv'] },
|
|
68
78
|
maxSize: 1024,
|
|
69
|
-
onDropRejected:
|
|
79
|
+
onDropRejected: (rejections) => {
|
|
80
|
+
const error = rejections[0].errors[0];
|
|
81
|
+
if (error.code === DropzoneErrorCode.FileTooLarge) {
|
|
82
|
+
setMessage('File is too big');
|
|
83
|
+
} else if (error.code === DropzoneErrorCode.FileInvalidType) {
|
|
84
|
+
setMessage('File is not a CSV file');
|
|
85
|
+
}
|
|
86
|
+
handleFileRejected();
|
|
87
|
+
},
|
|
88
|
+
onDropAccepted: handleFileAccepted
|
|
70
89
|
}}
|
|
71
90
|
validated={isRejected ? 'error' : 'default'}
|
|
72
91
|
browseButtonText="Upload"
|
|
@@ -77,10 +96,8 @@ export const TextFileUploadWithRestrictions: React.FunctionComponent = () => {
|
|
|
77
96
|
<HelperTextItem id="restricted-file-example-helpText" variant={isRejected ? 'error' : 'default'}>
|
|
78
97
|
{isRejected ? (
|
|
79
98
|
<>
|
|
80
|
-
<Icon status="danger"
|
|
81
|
-
|
|
82
|
-
</Icon>
|
|
83
|
-
Must be a CSV file no larger than 1 KB
|
|
99
|
+
<Icon status="danger" />
|
|
100
|
+
{message}
|
|
84
101
|
</>
|
|
85
102
|
) : (
|
|
86
103
|
'Upload a CSV file'
|
|
@@ -18,7 +18,7 @@ propComponents:
|
|
|
18
18
|
]
|
|
19
19
|
---
|
|
20
20
|
|
|
21
|
-
import
|
|
21
|
+
import brandImg from '../../assets/PF-IconLogo.svg';
|
|
22
22
|
import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
|
|
23
23
|
import GoogleIcon from '@patternfly/react-icons/dist/esm/icons/google-icon';
|
|
24
24
|
import GithubIcon from '@patternfly/react-icons/dist/esm/icons/github-icon';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import brandImg from '../../assets/PF-IconLogo.svg';
|
|
3
3
|
import {
|
|
4
4
|
LoginFooterItem,
|
|
5
5
|
LoginForm,
|
|
@@ -114,7 +114,7 @@ export const SimpleLoginPage: React.FunctionComponent = () => {
|
|
|
114
114
|
return (
|
|
115
115
|
<LoginPage
|
|
116
116
|
footerListVariants={ListVariant.inline}
|
|
117
|
-
brandImgSrc={
|
|
117
|
+
brandImgSrc={brandImg}
|
|
118
118
|
brandImgAlt="PatternFly logo"
|
|
119
119
|
backgroundImgSrc="/assets/images/pfbg-icon.svg"
|
|
120
120
|
footerListItems={listItem}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import brandImg from '../../assets/PF-IconLogo.svg';
|
|
3
3
|
import {
|
|
4
4
|
LoginFooterItem,
|
|
5
5
|
LoginForm,
|
|
@@ -187,7 +187,7 @@ export const LoginPageLanguageSelect: React.FunctionComponent = () => {
|
|
|
187
187
|
return (
|
|
188
188
|
<LoginPage
|
|
189
189
|
footerListVariants={ListVariant.inline}
|
|
190
|
-
brandImgSrc={
|
|
190
|
+
brandImgSrc={brandImg}
|
|
191
191
|
brandImgAlt="PatternFly logo"
|
|
192
192
|
backgroundImgSrc="/assets/images/pfbg-icon.svg"
|
|
193
193
|
footerListItems={listItem}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import brandImg from '../../assets/PF-IconLogo.svg';
|
|
3
3
|
import {
|
|
4
4
|
LoginFooterItem,
|
|
5
5
|
LoginForm,
|
|
@@ -115,7 +115,7 @@ export const LoginPageHideShowPassword: React.FunctionComponent = () => {
|
|
|
115
115
|
return (
|
|
116
116
|
<LoginPage
|
|
117
117
|
footerListVariants={ListVariant.inline}
|
|
118
|
-
brandImgSrc={
|
|
118
|
+
brandImgSrc={brandImg}
|
|
119
119
|
brandImgAlt="PatternFly logo"
|
|
120
120
|
backgroundImgSrc="/assets/images/pfbg-icon.svg"
|
|
121
121
|
footerListItems={listItem}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Popper } from '../../helpers
|
|
2
|
+
import { onToggleArrowKeydownDefault, Popper } from '../../helpers';
|
|
3
3
|
|
|
4
4
|
export interface MenuPopperProps {
|
|
5
5
|
/** Vertical direction of the popper. If enableFlip is set to true, this will set the initial direction before the popper flips. */
|
|
@@ -17,6 +17,7 @@ export interface MenuPopperProps {
|
|
|
17
17
|
/** Flag to prevent the popper from overflowing its container and becoming partially obscured. */
|
|
18
18
|
preventOverflow?: boolean;
|
|
19
19
|
}
|
|
20
|
+
|
|
20
21
|
export interface MenuContainerProps {
|
|
21
22
|
/** Menu to be rendered */
|
|
22
23
|
menu: React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
@@ -33,6 +34,8 @@ export interface MenuContainerProps {
|
|
|
33
34
|
onOpenChange?: (isOpen: boolean) => void;
|
|
34
35
|
/** Keys that trigger onOpenChange, defaults to tab and escape. It is highly recommended to include Escape in the array, while Tab may be omitted if the menu contains non-menu items that are focusable. */
|
|
35
36
|
onOpenChangeKeys?: string[];
|
|
37
|
+
/** Callback to override the toggle keydown behavior. By default, when the toggle has focus and the menu is open, pressing the up/down arrow keys will focus a valid non-disabled menu item - the first item for the down arrow key and last item for the up arrow key. */
|
|
38
|
+
onToggleKeydown?: (event: KeyboardEvent) => void;
|
|
36
39
|
/** z-index of the dropdown menu */
|
|
37
40
|
zIndex?: number;
|
|
38
41
|
/** Additional properties to pass to the Popper */
|
|
@@ -55,10 +58,11 @@ export const MenuContainer: React.FunctionComponent<MenuContainerProps> = ({
|
|
|
55
58
|
toggle,
|
|
56
59
|
toggleRef,
|
|
57
60
|
onOpenChange,
|
|
61
|
+
onToggleKeydown,
|
|
58
62
|
zIndex = 9999,
|
|
59
63
|
popperProps,
|
|
60
64
|
onOpenChangeKeys = ['Escape', 'Tab'],
|
|
61
|
-
shouldFocusFirstItemOnOpen =
|
|
65
|
+
shouldFocusFirstItemOnOpen = false,
|
|
62
66
|
shouldPreventScrollOnItemFocus = true,
|
|
63
67
|
focusTimeoutDelay = 0
|
|
64
68
|
}: MenuContainerProps) => {
|
|
@@ -90,6 +94,14 @@ export const MenuContainer: React.FunctionComponent<MenuContainerProps> = ({
|
|
|
90
94
|
toggleRef.current?.focus();
|
|
91
95
|
}
|
|
92
96
|
}
|
|
97
|
+
|
|
98
|
+
if (toggleRef.current?.contains(event.target as Node)) {
|
|
99
|
+
if (onToggleKeydown) {
|
|
100
|
+
onToggleKeydown(event);
|
|
101
|
+
} else if (isOpen) {
|
|
102
|
+
onToggleArrowKeydownDefault(event, menuRef);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
93
105
|
};
|
|
94
106
|
|
|
95
107
|
const handleClick = (event: MouseEvent) => {
|
|
@@ -108,7 +120,16 @@ export const MenuContainer: React.FunctionComponent<MenuContainerProps> = ({
|
|
|
108
120
|
window.removeEventListener('keydown', handleMenuKeys);
|
|
109
121
|
window.removeEventListener('click', handleClick);
|
|
110
122
|
};
|
|
111
|
-
}, [
|
|
123
|
+
}, [
|
|
124
|
+
focusTimeoutDelay,
|
|
125
|
+
isOpen,
|
|
126
|
+
menuRef,
|
|
127
|
+
onOpenChange,
|
|
128
|
+
onOpenChangeKeys,
|
|
129
|
+
onToggleKeydown,
|
|
130
|
+
shouldPreventScrollOnItemFocus,
|
|
131
|
+
toggleRef
|
|
132
|
+
]);
|
|
112
133
|
|
|
113
134
|
return (
|
|
114
135
|
<Popper
|
|
@@ -20,7 +20,7 @@ Basic modals give users the option to either confirm or cancel an action.
|
|
|
20
20
|
|
|
21
21
|
To flag an open modal, use the `isOpen` property. To execute a callback when a modal is closed, use the `onClose` property.
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
The `<ModalBody>`, `<ModalHeader>`, and `<ModalFooter>` components are not required, but are typically used to display the main content of the modal, modal title, and any button actions, respectively.
|
|
24
24
|
|
|
25
25
|
```ts file="./ModalBasic.tsx"
|
|
26
26
|
|
package/src/components/MultipleFileUpload/__tests__/__snapshots__/MultipleFileUpload.test.tsx.snap
CHANGED
|
@@ -9,7 +9,7 @@ exports[`MultipleFileUpload renders custom class names 1`] = `
|
|
|
9
9
|
>
|
|
10
10
|
<input
|
|
11
11
|
multiple=""
|
|
12
|
-
style="
|
|
12
|
+
style="border: 0px; clip: rect(0px, 0px, 0px, 0px); clip-path: inset(50%); height: 1px; margin: 0px -1px -1px 0px; overflow: hidden; padding: 0px; position: absolute; width: 1px; white-space: nowrap;"
|
|
13
13
|
tabindex="-1"
|
|
14
14
|
type="file"
|
|
15
15
|
/>
|
|
@@ -27,7 +27,7 @@ exports[`MultipleFileUpload renders with expected class names when horizontal 1`
|
|
|
27
27
|
>
|
|
28
28
|
<input
|
|
29
29
|
multiple=""
|
|
30
|
-
style="
|
|
30
|
+
style="border: 0px; clip: rect(0px, 0px, 0px, 0px); clip-path: inset(50%); height: 1px; margin: 0px -1px -1px 0px; overflow: hidden; padding: 0px; position: absolute; width: 1px; white-space: nowrap;"
|
|
31
31
|
tabindex="-1"
|
|
32
32
|
type="file"
|
|
33
33
|
/>
|
|
@@ -45,7 +45,7 @@ exports[`MultipleFileUpload renders with expected class names when not horizonta
|
|
|
45
45
|
>
|
|
46
46
|
<input
|
|
47
47
|
multiple=""
|
|
48
|
-
style="
|
|
48
|
+
style="border: 0px; clip: rect(0px, 0px, 0px, 0px); clip-path: inset(50%); height: 1px; margin: 0px -1px -1px 0px; overflow: hidden; padding: 0px; position: absolute; width: 1px; white-space: nowrap;"
|
|
49
49
|
tabindex="-1"
|
|
50
50
|
type="file"
|
|
51
51
|
/>
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { css } from '@patternfly/react-styles';
|
|
3
3
|
import { Menu, MenuContent, MenuProps } from '../Menu';
|
|
4
4
|
import { Popper } from '../../helpers/Popper/Popper';
|
|
5
|
-
import { getOUIAProps, OUIAProps, getDefaultOUIAId } from '../../helpers';
|
|
5
|
+
import { getOUIAProps, OUIAProps, getDefaultOUIAId, onToggleArrowKeydownDefault } from '../../helpers';
|
|
6
6
|
|
|
7
7
|
export interface SelectPopperProps {
|
|
8
8
|
/** Vertical direction of the popper. If enableFlip is set to true, this will set the initial direction before the popper flips. */
|
|
@@ -62,6 +62,10 @@ export interface SelectProps extends MenuProps, OUIAProps {
|
|
|
62
62
|
onOpenChange?: (isOpen: boolean) => void;
|
|
63
63
|
/** Keys that trigger onOpenChange, defaults to tab and escape. It is highly recommended to include Escape in the array, while Tab may be omitted if the menu contains non-menu items that are focusable. */
|
|
64
64
|
onOpenChangeKeys?: string[];
|
|
65
|
+
/** Callback to override the toggle keydown behavior. By default, when the toggle has focus and the menu is open, pressing the up/down arrow keys will focus a valid non-disabled menu item - the first item for the down arrow key and last item for the up arrow key. */
|
|
66
|
+
onToggleKeydown?: (event: KeyboardEvent) => void;
|
|
67
|
+
/** Select variant. For typeahead variant focus won't shift to menu items when pressing up/down arrows. */
|
|
68
|
+
variant?: 'default' | 'typeahead';
|
|
65
69
|
/** Indicates if the select should be without the outer box-shadow */
|
|
66
70
|
isPlain?: boolean;
|
|
67
71
|
/** @hide Forwarded ref */
|
|
@@ -95,6 +99,8 @@ const SelectBase: React.FunctionComponent<SelectProps & OUIAProps> = ({
|
|
|
95
99
|
shouldFocusFirstItemOnOpen = false,
|
|
96
100
|
onOpenChange,
|
|
97
101
|
onOpenChangeKeys = ['Escape', 'Tab'],
|
|
102
|
+
onToggleKeydown,
|
|
103
|
+
variant,
|
|
98
104
|
isPlain,
|
|
99
105
|
innerRef,
|
|
100
106
|
zIndex = 9999,
|
|
@@ -144,6 +150,14 @@ const SelectBase: React.FunctionComponent<SelectProps & OUIAProps> = ({
|
|
|
144
150
|
toggleRef.current?.focus();
|
|
145
151
|
}
|
|
146
152
|
}
|
|
153
|
+
|
|
154
|
+
if (toggleRef.current?.contains(event.target as Node)) {
|
|
155
|
+
if (onToggleKeydown) {
|
|
156
|
+
onToggleKeydown(event);
|
|
157
|
+
} else if (isOpen && variant !== 'typeahead') {
|
|
158
|
+
onToggleArrowKeydownDefault(event, menuRef);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
147
161
|
};
|
|
148
162
|
|
|
149
163
|
const handleClick = (event: MouseEvent) => {
|
|
@@ -168,6 +182,7 @@ const SelectBase: React.FunctionComponent<SelectProps & OUIAProps> = ({
|
|
|
168
182
|
toggleRef,
|
|
169
183
|
onOpenChange,
|
|
170
184
|
onOpenChangeKeys,
|
|
185
|
+
onToggleKeydown,
|
|
171
186
|
shouldPreventScrollOnItemFocus,
|
|
172
187
|
shouldFocusFirstItemOnOpen,
|
|
173
188
|
focusTimeoutDelay
|
|
@@ -247,7 +247,7 @@ export const SelectMultiTypeahead: React.FunctionComponent = () => {
|
|
|
247
247
|
!isOpen && closeMenu();
|
|
248
248
|
}}
|
|
249
249
|
toggle={toggle}
|
|
250
|
-
|
|
250
|
+
variant="typeahead"
|
|
251
251
|
>
|
|
252
252
|
<SelectList isAriaMultiselectable id="select-multi-typeahead-listbox">
|
|
253
253
|
{selectOptions.map((option, index) => (
|
|
@@ -241,7 +241,7 @@ export const SelectMultiTypeaheadCheckbox: React.FunctionComponent = () => {
|
|
|
241
241
|
!isOpen && closeMenu();
|
|
242
242
|
}}
|
|
243
243
|
toggle={toggle}
|
|
244
|
-
|
|
244
|
+
variant="typeahead"
|
|
245
245
|
>
|
|
246
246
|
<SelectList isAriaMultiselectable id="select-multi-typeahead-checkbox-listbox">
|
|
247
247
|
{selectOptions.map((option, index) => (
|
|
@@ -260,7 +260,7 @@ export const SelectMultiTypeaheadCreatable: React.FunctionComponent = () => {
|
|
|
260
260
|
!isOpen && closeMenu();
|
|
261
261
|
}}
|
|
262
262
|
toggle={toggle}
|
|
263
|
-
|
|
263
|
+
variant="typeahead"
|
|
264
264
|
>
|
|
265
265
|
<SelectList isAriaMultiselectable id="select-multi-create-typeahead-listbox">
|
|
266
266
|
{selectOptions.map((option, index) => (
|
|
@@ -244,7 +244,7 @@ export const SelectTypeahead: React.FunctionComponent = () => {
|
|
|
244
244
|
!isOpen && closeMenu();
|
|
245
245
|
}}
|
|
246
246
|
toggle={toggle}
|
|
247
|
-
|
|
247
|
+
variant="typeahead"
|
|
248
248
|
>
|
|
249
249
|
<SelectList id="select-typeahead-listbox">
|
|
250
250
|
{selectOptions.map((option, index) => (
|
|
@@ -251,7 +251,7 @@ export const SelectTypeaheadCreatable: React.FunctionComponent = () => {
|
|
|
251
251
|
!isOpen && closeMenu();
|
|
252
252
|
}}
|
|
253
253
|
toggle={toggle}
|
|
254
|
-
|
|
254
|
+
variant="typeahead"
|
|
255
255
|
>
|
|
256
256
|
<SelectList id="select-create-typeahead-listbox">
|
|
257
257
|
{selectOptions.map((option, index) => (
|