@patternfly/react-core 5.1.1-prerelease.2 → 5.1.1-prerelease.20
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 +113 -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/Chip/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/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/DragDrop/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/Text/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/Tile/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/ApplicationLauncher/package.json +1 -1
- package/dist/dynamic/deprecated/components/ContextSelector/package.json +1 -1
- package/dist/dynamic/deprecated/components/Dropdown/package.json +1 -1
- package/dist/dynamic/deprecated/components/OptionsMenu/package.json +1 -1
- package/dist/dynamic/deprecated/components/PageHeader/package.json +1 -1
- package/dist/dynamic/deprecated/components/Select/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/favorites/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/next/components/package.json +1 -1
- package/dist/esm/components/BackToTop/BackToTop.js +1 -1
- package/dist/esm/components/BackToTop/BackToTop.js.map +1 -1
- package/dist/esm/components/Button/Button.d.ts +2 -2
- package/dist/esm/components/Button/Button.d.ts.map +1 -1
- package/dist/esm/components/Button/Button.js +3 -3
- package/dist/esm/components/Button/Button.js.map +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopy.d.ts.map +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopy.js +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopy.js.map +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopyExpanded.js +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopyExpanded.js.map +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopyToggle.d.ts.map +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopyToggle.js +5 -2
- package/dist/esm/components/ClipboardCopy/ClipboardCopyToggle.js.map +1 -1
- package/dist/esm/components/Drawer/Drawer.d.ts +3 -3
- package/dist/esm/components/Drawer/Drawer.d.ts.map +1 -1
- package/dist/esm/components/Drawer/Drawer.js +3 -3
- package/dist/esm/components/Drawer/Drawer.js.map +1 -1
- package/dist/esm/components/Drawer/DrawerPanelContent.d.ts +16 -0
- package/dist/esm/components/Drawer/DrawerPanelContent.d.ts.map +1 -1
- package/dist/esm/components/Drawer/DrawerPanelContent.js +132 -41
- package/dist/esm/components/Drawer/DrawerPanelContent.js.map +1 -1
- package/dist/esm/components/Dropdown/Dropdown.d.ts +3 -1
- package/dist/esm/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/esm/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/esm/components/Icon/Icon.d.ts +4 -0
- package/dist/esm/components/Icon/Icon.d.ts.map +1 -1
- package/dist/esm/components/Icon/Icon.js +2 -2
- package/dist/esm/components/Icon/Icon.js.map +1 -1
- package/dist/esm/components/Label/Label.d.ts +4 -2
- package/dist/esm/components/Label/Label.d.ts.map +1 -1
- package/dist/esm/components/Label/Label.js +19 -4
- package/dist/esm/components/Label/Label.js.map +1 -1
- package/dist/esm/components/Menu/MenuContainer.d.ts +1 -1
- package/dist/esm/components/Menu/MenuContainer.d.ts.map +1 -1
- package/dist/esm/components/Modal/ModalContent.d.ts.map +1 -1
- package/dist/esm/components/Modal/ModalContent.js +3 -1
- package/dist/esm/components/Modal/ModalContent.js.map +1 -1
- package/dist/esm/components/Nav/NavItem.d.ts +1 -1
- package/dist/esm/components/Nav/NavItem.d.ts.map +1 -1
- package/dist/esm/components/Nav/NavList.d.ts +10 -4
- package/dist/esm/components/Nav/NavList.d.ts.map +1 -1
- package/dist/esm/components/Nav/NavList.js +29 -8
- package/dist/esm/components/Nav/NavList.js.map +1 -1
- package/dist/esm/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/esm/components/SearchInput/SearchInput.js +4 -2
- package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/esm/components/Select/Select.d.ts +9 -1
- package/dist/esm/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/Slider/Slider.d.ts +8 -4
- package/dist/esm/components/Slider/Slider.d.ts.map +1 -1
- package/dist/esm/components/Slider/Slider.js +62 -16
- package/dist/esm/components/Slider/Slider.js.map +1 -1
- package/dist/esm/components/Slider/SliderStep.d.ts.map +1 -1
- package/dist/esm/components/Slider/SliderStep.js +2 -1
- package/dist/esm/components/Slider/SliderStep.js.map +1 -1
- package/dist/esm/components/Tabs/Tabs.d.ts +11 -6
- package/dist/esm/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/esm/components/Tabs/Tabs.js +35 -16
- package/dist/esm/components/Tabs/Tabs.js.map +1 -1
- package/dist/esm/components/TextInput/TextInput.d.ts +3 -1
- package/dist/esm/components/TextInput/TextInput.d.ts.map +1 -1
- package/dist/esm/components/TextInput/TextInput.js +8 -7
- package/dist/esm/components/TextInput/TextInput.js.map +1 -1
- package/dist/esm/components/Timestamp/Timestamp.d.ts +4 -0
- package/dist/esm/components/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/esm/components/Timestamp/Timestamp.js +7 -4
- package/dist/esm/components/Timestamp/Timestamp.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarContent.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarContent.js +8 -6
- package/dist/esm/components/Toolbar/ToolbarContent.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarExpandableContent.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarExpandableContent.js +3 -5
- package/dist/esm/components/Toolbar/ToolbarExpandableContent.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarFilter.d.ts +4 -0
- package/dist/esm/components/Toolbar/ToolbarFilter.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarFilter.js +8 -4
- package/dist/esm/components/Toolbar/ToolbarFilter.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarToggleGroup.d.ts +14 -0
- package/dist/esm/components/Toolbar/ToolbarToggleGroup.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarToggleGroup.js +21 -20
- package/dist/esm/components/Toolbar/ToolbarToggleGroup.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarUtils.d.ts +4 -0
- package/dist/esm/components/Toolbar/ToolbarUtils.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarUtils.js +2 -1
- package/dist/esm/components/Toolbar/ToolbarUtils.js.map +1 -1
- package/dist/esm/components/Toolbar/index.d.ts +1 -0
- package/dist/esm/components/Toolbar/index.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/index.js +1 -0
- package/dist/esm/components/Toolbar/index.js.map +1 -1
- package/dist/esm/helpers/Popper/Popper.d.ts +2 -1
- package/dist/esm/helpers/Popper/Popper.d.ts.map +1 -1
- package/dist/esm/helpers/Popper/Popper.js +27 -5
- package/dist/esm/helpers/Popper/Popper.js.map +1 -1
- package/dist/js/components/BackToTop/BackToTop.js +1 -1
- package/dist/js/components/BackToTop/BackToTop.js.map +1 -1
- package/dist/js/components/Button/Button.d.ts +2 -2
- package/dist/js/components/Button/Button.d.ts.map +1 -1
- package/dist/js/components/Button/Button.js +3 -3
- package/dist/js/components/Button/Button.js.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopy.d.ts.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopy.js +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopy.js.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopyExpanded.js +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopyExpanded.js.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopyToggle.d.ts.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopyToggle.js +5 -2
- package/dist/js/components/ClipboardCopy/ClipboardCopyToggle.js.map +1 -1
- package/dist/js/components/Drawer/Drawer.d.ts +3 -3
- package/dist/js/components/Drawer/Drawer.d.ts.map +1 -1
- package/dist/js/components/Drawer/Drawer.js +3 -3
- package/dist/js/components/Drawer/Drawer.js.map +1 -1
- package/dist/js/components/Drawer/DrawerPanelContent.d.ts +16 -0
- package/dist/js/components/Drawer/DrawerPanelContent.d.ts.map +1 -1
- package/dist/js/components/Drawer/DrawerPanelContent.js +132 -41
- package/dist/js/components/Drawer/DrawerPanelContent.js.map +1 -1
- package/dist/js/components/Dropdown/Dropdown.d.ts +3 -1
- package/dist/js/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/js/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/js/components/Icon/Icon.d.ts +4 -0
- package/dist/js/components/Icon/Icon.d.ts.map +1 -1
- package/dist/js/components/Icon/Icon.js +2 -2
- package/dist/js/components/Icon/Icon.js.map +1 -1
- package/dist/js/components/Label/Label.d.ts +4 -2
- package/dist/js/components/Label/Label.d.ts.map +1 -1
- package/dist/js/components/Label/Label.js +19 -4
- package/dist/js/components/Label/Label.js.map +1 -1
- package/dist/js/components/Menu/MenuContainer.d.ts +1 -1
- package/dist/js/components/Menu/MenuContainer.d.ts.map +1 -1
- package/dist/js/components/Modal/ModalContent.d.ts.map +1 -1
- package/dist/js/components/Modal/ModalContent.js +3 -1
- package/dist/js/components/Modal/ModalContent.js.map +1 -1
- package/dist/js/components/Nav/NavItem.d.ts +1 -1
- package/dist/js/components/Nav/NavItem.d.ts.map +1 -1
- package/dist/js/components/Nav/NavList.d.ts +10 -4
- package/dist/js/components/Nav/NavList.d.ts.map +1 -1
- package/dist/js/components/Nav/NavList.js +29 -8
- package/dist/js/components/Nav/NavList.js.map +1 -1
- package/dist/js/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/js/components/SearchInput/SearchInput.js +4 -2
- package/dist/js/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/js/components/Select/Select.d.ts +9 -1
- package/dist/js/components/Select/Select.d.ts.map +1 -1
- package/dist/js/components/Select/Select.js.map +1 -1
- package/dist/js/components/Slider/Slider.d.ts +8 -4
- package/dist/js/components/Slider/Slider.d.ts.map +1 -1
- package/dist/js/components/Slider/Slider.js +62 -16
- package/dist/js/components/Slider/Slider.js.map +1 -1
- package/dist/js/components/Slider/SliderStep.d.ts.map +1 -1
- package/dist/js/components/Slider/SliderStep.js +2 -1
- package/dist/js/components/Slider/SliderStep.js.map +1 -1
- package/dist/js/components/Tabs/Tabs.d.ts +11 -6
- package/dist/js/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/js/components/Tabs/Tabs.js +35 -16
- package/dist/js/components/Tabs/Tabs.js.map +1 -1
- package/dist/js/components/TextInput/TextInput.d.ts +3 -1
- package/dist/js/components/TextInput/TextInput.d.ts.map +1 -1
- package/dist/js/components/TextInput/TextInput.js +8 -7
- package/dist/js/components/TextInput/TextInput.js.map +1 -1
- package/dist/js/components/Timestamp/Timestamp.d.ts +4 -0
- package/dist/js/components/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/js/components/Timestamp/Timestamp.js +7 -4
- package/dist/js/components/Timestamp/Timestamp.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarContent.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarContent.js +8 -6
- package/dist/js/components/Toolbar/ToolbarContent.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarExpandableContent.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarExpandableContent.js +3 -5
- package/dist/js/components/Toolbar/ToolbarExpandableContent.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarFilter.d.ts +4 -0
- package/dist/js/components/Toolbar/ToolbarFilter.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarFilter.js +8 -4
- package/dist/js/components/Toolbar/ToolbarFilter.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarToggleGroup.d.ts +14 -0
- package/dist/js/components/Toolbar/ToolbarToggleGroup.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarToggleGroup.js +21 -20
- package/dist/js/components/Toolbar/ToolbarToggleGroup.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarUtils.d.ts +4 -0
- package/dist/js/components/Toolbar/ToolbarUtils.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarUtils.js +2 -1
- package/dist/js/components/Toolbar/ToolbarUtils.js.map +1 -1
- package/dist/js/components/Toolbar/index.d.ts +1 -0
- package/dist/js/components/Toolbar/index.d.ts.map +1 -1
- package/dist/js/components/Toolbar/index.js +1 -0
- package/dist/js/components/Toolbar/index.js.map +1 -1
- package/dist/js/helpers/Popper/Popper.d.ts +2 -1
- package/dist/js/helpers/Popper/Popper.d.ts.map +1 -1
- package/dist/js/helpers/Popper/Popper.js +29 -6
- package/dist/js/helpers/Popper/Popper.js.map +1 -1
- package/dist/styles/base-no-reset.css +3 -4
- package/dist/styles/base.css +3 -4
- 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 +6 -6
- package/src/components/Alert/__tests__/AlertGroup.test.tsx +77 -73
- package/src/components/BackToTop/BackToTop.tsx +1 -1
- package/src/components/BackToTop/__tests__/BackToTop.test.tsx +1 -1
- package/src/components/BackToTop/__tests__/__snapshots__/BackToTop.test.tsx.snap +1 -1
- package/src/components/BackgroundImage/__tests__/BackgroundImage.test.tsx +21 -7
- package/src/components/BackgroundImage/__tests__/__snapshots__/BackgroundImage.test.tsx.snap +11 -0
- package/src/components/Brand/__tests__/Brand.test.tsx +105 -30
- package/src/components/Breadcrumb/examples/BreadcrumbDropdown.tsx +25 -3
- package/src/components/Button/Button.tsx +5 -5
- package/src/components/Button/examples/ButtonVariations.tsx +1 -1
- package/src/components/Checkbox/examples/Checkbox.md +8 -2
- package/src/components/Checkbox/examples/CheckboxControlled.tsx +18 -16
- package/src/components/ClipboardCopy/ClipboardCopy.tsx +1 -0
- package/src/components/ClipboardCopy/ClipboardCopyExpanded.tsx +1 -1
- package/src/components/ClipboardCopy/ClipboardCopyToggle.tsx +5 -2
- package/src/components/ClipboardCopy/__tests__/__snapshots__/ClipboardCopyExpanded.test.tsx.snap +3 -1
- package/src/components/ClipboardCopy/__tests__/__snapshots__/ClipboardCopyToggle.test.tsx.snap +16 -12
- package/src/components/Drawer/Drawer.tsx +6 -6
- package/src/components/Drawer/DrawerPanelContent.tsx +192 -81
- package/src/components/Drawer/__tests__/DrawerPanelContent.test.tsx +89 -0
- package/src/components/Drawer/examples/Drawer.md +43 -12
- package/src/components/Drawer/examples/DrawerFocusTrap.tsx +58 -0
- package/src/components/Drawer/examples/{DrawerInlinePanelRight.tsx → DrawerInlinePanelEnd.tsx} +1 -1
- package/src/components/Drawer/examples/{DrawerInlinePanelLeft.tsx → DrawerInlinePanelStart.tsx} +2 -2
- package/src/components/Drawer/examples/{DrawerPanelLeft.tsx → DrawerPanelEnd.tsx} +2 -2
- package/src/components/Drawer/examples/{DrawerPanelRight.tsx → DrawerPanelStart.tsx} +2 -2
- package/src/components/Drawer/examples/{DrawerResizableOnRight.tsx → DrawerResizableAtEnd.tsx} +3 -3
- package/src/components/Drawer/examples/{DrawerResizableOnLeft.tsx → DrawerResizableAtStart.tsx} +2 -2
- package/src/components/Dropdown/Dropdown.tsx +3 -1
- package/src/components/Icon/Icon.tsx +15 -1
- package/src/components/Icon/__tests__/Icon.test.tsx +16 -0
- package/src/components/Label/Label.tsx +29 -3
- package/src/components/Label/__tests__/Label.test.tsx +35 -0
- package/src/components/Label/__tests__/__snapshots__/Label.test.tsx.snap +1 -0
- package/src/components/Label/examples/LabelFilled.tsx +220 -168
- package/src/components/Label/examples/LabelOutline.tsx +280 -226
- package/src/components/Menu/MenuContainer.tsx +1 -1
- package/src/components/Menu/examples/MenuWithDrilldownBreadcrumbs.tsx +32 -15
- package/src/components/Modal/ModalContent.tsx +4 -6
- package/src/components/Nav/NavItem.tsx +1 -1
- package/src/components/Nav/NavList.tsx +44 -12
- package/src/components/Nav/__tests__/__snapshots__/Nav.test.tsx.snap +10 -10
- package/src/components/Page/__tests__/__snapshots__/Page.test.tsx.snap +6 -6
- package/src/components/SearchInput/SearchInput.tsx +5 -2
- package/src/components/SearchInput/__tests__/__snapshots__/SearchInput.test.tsx.snap +105 -65
- package/src/components/SearchInput/examples/SearchInputAdvanced.tsx +1 -1
- package/src/components/Select/Select.tsx +9 -1
- package/src/components/Slider/Slider.tsx +69 -20
- package/src/components/Slider/SliderStep.tsx +2 -1
- package/src/components/Slider/_tests_/Slider.test.tsx +3 -3
- package/src/components/Slider/examples/SliderActions.tsx +3 -3
- package/src/components/Tabs/Tabs.tsx +50 -26
- package/src/components/Tabs/examples/Tabs.md +1 -3
- package/src/components/TextInput/TextInput.tsx +11 -7
- package/src/components/TextInput/__tests__/TextInput.test.tsx +16 -1
- package/src/components/TextInput/__tests__/__snapshots__/TextInput.test.tsx.snap +2 -1
- package/src/components/TextInput/examples/TextInput.md +2 -2
- package/src/components/TextInput/examples/{TextInputLeftTruncated.tsx → TextInputStartTruncated.tsx} +3 -3
- package/src/components/Tile/examples/Tile.md +14 -10
- package/src/components/Timestamp/Timestamp.tsx +12 -3
- package/src/components/Timestamp/__tests__/Timestamp.test.tsx +6 -0
- package/src/components/Timestamp/examples/Timestamp.md +8 -0
- package/src/components/Timestamp/examples/TimestampDefault.tsx +7 -1
- package/src/components/Timestamp/examples/TimestampDefaultTooltip.tsx +1 -1
- package/src/components/Toolbar/ToolbarContent.tsx +7 -11
- package/src/components/Toolbar/ToolbarExpandableContent.tsx +7 -3
- package/src/components/Toolbar/ToolbarFilter.tsx +12 -2
- package/src/components/Toolbar/ToolbarToggleGroup.tsx +92 -47
- package/src/components/Toolbar/ToolbarUtils.tsx +6 -1
- package/src/components/Toolbar/__tests__/Generated/__snapshots__/ToolbarContent.test.tsx.snap +0 -8
- package/src/components/Toolbar/__tests__/Toolbar.test.tsx +3 -4
- package/src/components/Toolbar/__tests__/ToolbarToggleGroup.test.tsx +13 -10
- package/src/components/Toolbar/__tests__/__snapshots__/Toolbar.test.tsx.snap +0 -59
- package/src/components/Toolbar/examples/Toolbar.md +6 -6
- package/src/components/Toolbar/index.ts +1 -0
- package/src/demos/Card/Card.md +3 -664
- package/src/demos/Card/examples/CardView.tsx +575 -0
- package/src/demos/CardDemos.md +4 -4
- package/src/demos/CustomMenus/examples/ApplicationLauncherDemo.tsx +1 -1
- package/src/demos/DataListDemo.md +7 -4
- package/src/demos/NotificationDrawer/NotificationDrawer.md +2 -1435
- package/src/demos/NotificationDrawer/examples/NotificationDrawerBasic.tsx +557 -0
- package/src/demos/NotificationDrawer/examples/NotificationDrawerGrouped.tsx +796 -0
- package/src/demos/PrimaryDetail.md +4 -5
- package/src/deprecated/components/ContextSelector/__tests__/__snapshots__/ContextSelector.test.tsx.snap +42 -26
- package/src/helpers/Popper/Popper.tsx +43 -6
- package/src/components/Alert/__tests__/__snapshots__/AlertGroup.test.tsx.snap +0 -10
- package/src/components/Brand/__tests__/__snapshots__/Brand.test.tsx.snap +0 -11
- package/src/components/Checkbox/examples/checkbox.css +0 -3
- /package/src/demos/Card/{CardData.jsx → examples/CardData.jsx} +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import styles from '@patternfly/react-styles/css/components/ClipboardCopy/clipboard-copy';
|
|
3
|
+
import { css } from '@patternfly/react-styles';
|
|
2
4
|
import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon';
|
|
3
|
-
import AngleDownIcon from '@patternfly/react-icons/dist/esm/icons/angle-down-icon';
|
|
4
5
|
import { Button } from '../Button';
|
|
5
6
|
|
|
6
7
|
export interface ClipboardCopyToggleProps
|
|
@@ -31,7 +32,9 @@ export const ClipboardCopyToggle: React.FunctionComponent<ClipboardCopyTogglePro
|
|
|
31
32
|
aria-expanded={isExpanded}
|
|
32
33
|
{...props}
|
|
33
34
|
>
|
|
34
|
-
|
|
35
|
+
<div className={css(styles.clipboardCopyToggleIcon)}>
|
|
36
|
+
<AngleRightIcon aria-hidden="true" />
|
|
37
|
+
</div>
|
|
35
38
|
</Button>
|
|
36
39
|
);
|
|
37
40
|
ClipboardCopyToggle.displayName = 'ClipboardCopyToggle';
|
package/src/components/ClipboardCopy/__tests__/__snapshots__/ClipboardCopyToggle.test.tsx.snap
CHANGED
|
@@ -15,19 +15,23 @@ exports[`ClipboardCopyToggle toggle button render 1`] = `
|
|
|
15
15
|
id="my-id"
|
|
16
16
|
type="button"
|
|
17
17
|
>
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
class="pf-v5-svg"
|
|
21
|
-
fill="currentColor"
|
|
22
|
-
height="1em"
|
|
23
|
-
role="img"
|
|
24
|
-
viewBox="0 0 256 512"
|
|
25
|
-
width="1em"
|
|
18
|
+
<div
|
|
19
|
+
class="pf-v5-c-clipboard-copy__toggle-icon"
|
|
26
20
|
>
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
<svg
|
|
22
|
+
aria-hidden="true"
|
|
23
|
+
class="pf-v5-svg"
|
|
24
|
+
fill="currentColor"
|
|
25
|
+
height="1em"
|
|
26
|
+
role="img"
|
|
27
|
+
viewBox="0 0 256 512"
|
|
28
|
+
width="1em"
|
|
29
|
+
>
|
|
30
|
+
<path
|
|
31
|
+
d="M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"
|
|
32
|
+
/>
|
|
33
|
+
</svg>
|
|
34
|
+
</div>
|
|
31
35
|
</button>
|
|
32
36
|
</DocumentFragment>
|
|
33
37
|
`;
|
|
@@ -11,7 +11,7 @@ export enum DrawerColorVariant {
|
|
|
11
11
|
export interface DrawerProps extends React.HTMLProps<HTMLDivElement> {
|
|
12
12
|
/** Additional classes added to the Drawer. */
|
|
13
13
|
className?: string;
|
|
14
|
-
/** Content rendered in the
|
|
14
|
+
/** Content rendered in the drawer panel */
|
|
15
15
|
children?: React.ReactNode;
|
|
16
16
|
/** Indicates if the drawer is expanded */
|
|
17
17
|
isExpanded?: boolean;
|
|
@@ -19,8 +19,8 @@ export interface DrawerProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
19
19
|
isInline?: boolean;
|
|
20
20
|
/** Indicates if the drawer will always show both content and panel. */
|
|
21
21
|
isStatic?: boolean;
|
|
22
|
-
/** Position of the drawer panel */
|
|
23
|
-
position?: '
|
|
22
|
+
/** Position of the drawer panel. left and right are deprecated, use start and end instead. */
|
|
23
|
+
position?: 'start' | 'end' | 'bottom' | 'left' | 'right';
|
|
24
24
|
/** Callback when drawer panel is expanded after waiting 250ms for animation to complete. */
|
|
25
25
|
onExpand?: (event: KeyboardEvent | React.MouseEvent | React.TransitionEvent) => void;
|
|
26
26
|
}
|
|
@@ -39,7 +39,7 @@ export const DrawerContext = React.createContext<Partial<DrawerContextProps>>({
|
|
|
39
39
|
isExpanded: false,
|
|
40
40
|
isStatic: false,
|
|
41
41
|
onExpand: () => {},
|
|
42
|
-
position: '
|
|
42
|
+
position: 'end',
|
|
43
43
|
drawerRef: null,
|
|
44
44
|
drawerContentRef: null,
|
|
45
45
|
isInline: false
|
|
@@ -51,7 +51,7 @@ export const Drawer: React.FunctionComponent<DrawerProps> = ({
|
|
|
51
51
|
isExpanded = false,
|
|
52
52
|
isInline = false,
|
|
53
53
|
isStatic = false,
|
|
54
|
-
position = '
|
|
54
|
+
position = 'end',
|
|
55
55
|
onExpand = () => {},
|
|
56
56
|
...props
|
|
57
57
|
}: DrawerProps) => {
|
|
@@ -66,7 +66,7 @@ export const Drawer: React.FunctionComponent<DrawerProps> = ({
|
|
|
66
66
|
isExpanded && styles.modifiers.expanded,
|
|
67
67
|
isInline && styles.modifiers.inline,
|
|
68
68
|
isStatic && styles.modifiers.static,
|
|
69
|
-
position === 'left' && styles.modifiers.panelLeft,
|
|
69
|
+
(position === 'left' || position === 'start') && styles.modifiers.panelLeft,
|
|
70
70
|
position === 'bottom' && styles.modifiers.panelBottom,
|
|
71
71
|
className
|
|
72
72
|
)}
|
|
@@ -4,6 +4,22 @@ import { css } from '@patternfly/react-styles';
|
|
|
4
4
|
import { DrawerColorVariant, DrawerContext } from './Drawer';
|
|
5
5
|
import { formatBreakpointMods } from '../../helpers/util';
|
|
6
6
|
import { GenerateId } from '../../helpers/GenerateId/GenerateId';
|
|
7
|
+
import { FocusTrap } from '../../helpers/FocusTrap/FocusTrap';
|
|
8
|
+
|
|
9
|
+
export interface DrawerPanelFocusTrapObject {
|
|
10
|
+
/** Enables a focus trap on the drawer panel content. This will also automatically
|
|
11
|
+
* handle focus management when the panel expands and when it collapses. Do not pass
|
|
12
|
+
* this prop if the isStatic prop on the drawer component is true.
|
|
13
|
+
*/
|
|
14
|
+
enabled?: boolean;
|
|
15
|
+
/** The element to focus when the drawer panel content expands. By default the
|
|
16
|
+
* first focusable element will receive focus. If there are no focusable elements, the
|
|
17
|
+
* panel itself will receive focus.
|
|
18
|
+
*/
|
|
19
|
+
elementToFocusOnExpand?: HTMLElement | SVGElement | string;
|
|
20
|
+
/** One or more id's to use for the drawer panel content's accessible label. */
|
|
21
|
+
'aria-labelledby'?: string;
|
|
22
|
+
}
|
|
7
23
|
|
|
8
24
|
export interface DrawerPanelContentProps extends React.HTMLProps<HTMLDivElement> {
|
|
9
25
|
/** Additional classes added to the drawer. */
|
|
@@ -37,6 +53,8 @@ export interface DrawerPanelContentProps extends React.HTMLProps<HTMLDivElement>
|
|
|
37
53
|
};
|
|
38
54
|
/** Color variant of the background of the drawer panel */
|
|
39
55
|
colorVariant?: DrawerColorVariant | 'light-200' | 'no-background' | 'default';
|
|
56
|
+
/** Adds and customizes a focus trap on the drawer panel content. */
|
|
57
|
+
focusTrap?: DrawerPanelFocusTrapObject;
|
|
40
58
|
}
|
|
41
59
|
let isResizing: boolean = null;
|
|
42
60
|
let newSize: number = 0;
|
|
@@ -55,6 +73,7 @@ export const DrawerPanelContent: React.FunctionComponent<DrawerPanelContentProps
|
|
|
55
73
|
resizeAriaLabel = 'Resize',
|
|
56
74
|
widths,
|
|
57
75
|
colorVariant = DrawerColorVariant.default,
|
|
76
|
+
focusTrap,
|
|
58
77
|
...props
|
|
59
78
|
}: DrawerPanelContentProps) => {
|
|
60
79
|
const panel = React.useRef<HTMLDivElement>();
|
|
@@ -64,13 +83,22 @@ export const DrawerPanelContent: React.FunctionComponent<DrawerPanelContentProps
|
|
|
64
83
|
React.useContext(DrawerContext);
|
|
65
84
|
const hidden = isStatic ? false : !isExpanded;
|
|
66
85
|
const [isExpandedInternal, setIsExpandedInternal] = React.useState(!hidden);
|
|
86
|
+
const [isFocusTrapActive, setIsFocusTrapActive] = React.useState(false);
|
|
87
|
+
const previouslyFocusedElement = React.useRef(null);
|
|
67
88
|
let currWidth: number = 0;
|
|
68
89
|
let panelRect: DOMRect;
|
|
69
|
-
let
|
|
70
|
-
let
|
|
90
|
+
let end: number;
|
|
91
|
+
let start: number;
|
|
71
92
|
let bottom: number;
|
|
72
93
|
let setInitialVals: boolean = true;
|
|
73
94
|
|
|
95
|
+
if (isStatic && focusTrap?.enabled) {
|
|
96
|
+
// eslint-disable-next-line no-console
|
|
97
|
+
console.warn(
|
|
98
|
+
`DrawerPanelContent: The focusTrap.enabled prop cannot be true if the Drawer's isStatic prop is true. This will cause a permanent focus trap.`
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
74
102
|
React.useEffect(() => {
|
|
75
103
|
if (!isStatic && isExpanded) {
|
|
76
104
|
setIsExpandedInternal(isExpanded);
|
|
@@ -80,23 +108,52 @@ export const DrawerPanelContent: React.FunctionComponent<DrawerPanelContentProps
|
|
|
80
108
|
const calcValueNow = () => {
|
|
81
109
|
let splitterPos;
|
|
82
110
|
let drawerSize;
|
|
111
|
+
const isRTL = window.getComputedStyle(panel.current).getPropertyValue('direction') === 'rtl';
|
|
83
112
|
|
|
84
|
-
if (isInline && position === 'right') {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
splitterRef.current.getBoundingClientRect().right -
|
|
98
|
-
|
|
99
|
-
|
|
113
|
+
if (isInline && (position === 'end' || position === 'right')) {
|
|
114
|
+
if (isRTL) {
|
|
115
|
+
splitterPos = panel.current.getBoundingClientRect().left - splitterRef.current.getBoundingClientRect().right;
|
|
116
|
+
drawerSize = drawerRef.current.getBoundingClientRect().left - drawerRef.current.getBoundingClientRect().right;
|
|
117
|
+
} else {
|
|
118
|
+
splitterPos = panel.current.getBoundingClientRect().right - splitterRef.current.getBoundingClientRect().left;
|
|
119
|
+
drawerSize = drawerRef.current.getBoundingClientRect().right - drawerRef.current.getBoundingClientRect().left;
|
|
120
|
+
}
|
|
121
|
+
} else if (isInline && (position === 'start' || position === 'left')) {
|
|
122
|
+
if (isRTL) {
|
|
123
|
+
splitterPos = splitterRef.current.getBoundingClientRect().left - panel.current.getBoundingClientRect().right;
|
|
124
|
+
drawerSize = drawerRef.current.getBoundingClientRect().left - drawerRef.current.getBoundingClientRect().right;
|
|
125
|
+
} else {
|
|
126
|
+
splitterPos = splitterRef.current.getBoundingClientRect().right - panel.current.getBoundingClientRect().left;
|
|
127
|
+
drawerSize = drawerRef.current.getBoundingClientRect().right - drawerRef.current.getBoundingClientRect().left;
|
|
128
|
+
}
|
|
129
|
+
} else if (position === 'end' || position === 'right') {
|
|
130
|
+
if (isRTL) {
|
|
131
|
+
splitterPos =
|
|
132
|
+
drawerContentRef.current.getBoundingClientRect().left - splitterRef.current.getBoundingClientRect().right;
|
|
133
|
+
drawerSize =
|
|
134
|
+
drawerContentRef.current.getBoundingClientRect().left -
|
|
135
|
+
drawerContentRef.current.getBoundingClientRect().right;
|
|
136
|
+
} else {
|
|
137
|
+
splitterPos =
|
|
138
|
+
drawerContentRef.current.getBoundingClientRect().right - splitterRef.current.getBoundingClientRect().left;
|
|
139
|
+
drawerSize =
|
|
140
|
+
drawerContentRef.current.getBoundingClientRect().right -
|
|
141
|
+
drawerContentRef.current.getBoundingClientRect().left;
|
|
142
|
+
}
|
|
143
|
+
} else if (position === 'start' || position === 'left') {
|
|
144
|
+
if (isRTL) {
|
|
145
|
+
splitterPos =
|
|
146
|
+
splitterRef.current.getBoundingClientRect().left - drawerContentRef.current.getBoundingClientRect().right;
|
|
147
|
+
drawerSize =
|
|
148
|
+
drawerContentRef.current.getBoundingClientRect().left -
|
|
149
|
+
drawerContentRef.current.getBoundingClientRect().right;
|
|
150
|
+
} else {
|
|
151
|
+
splitterPos =
|
|
152
|
+
splitterRef.current.getBoundingClientRect().right - drawerContentRef.current.getBoundingClientRect().left;
|
|
153
|
+
drawerSize =
|
|
154
|
+
drawerContentRef.current.getBoundingClientRect().right -
|
|
155
|
+
drawerContentRef.current.getBoundingClientRect().left;
|
|
156
|
+
}
|
|
100
157
|
} else if (position === 'bottom') {
|
|
101
158
|
splitterPos =
|
|
102
159
|
drawerContentRef.current.getBoundingClientRect().bottom - splitterRef.current.getBoundingClientRect().top;
|
|
@@ -138,6 +195,8 @@ export const DrawerPanelContent: React.FunctionComponent<DrawerPanelContentProps
|
|
|
138
195
|
};
|
|
139
196
|
|
|
140
197
|
const handleControlMove = (e: MouseEvent | TouchEvent, controlPosition: number) => {
|
|
198
|
+
const isRTL = window.getComputedStyle(panel.current).getPropertyValue('direction') === 'rtl';
|
|
199
|
+
|
|
141
200
|
e.stopPropagation();
|
|
142
201
|
if (!isResizing) {
|
|
143
202
|
return;
|
|
@@ -145,17 +204,22 @@ export const DrawerPanelContent: React.FunctionComponent<DrawerPanelContentProps
|
|
|
145
204
|
|
|
146
205
|
if (setInitialVals) {
|
|
147
206
|
panelRect = panel.current.getBoundingClientRect();
|
|
148
|
-
|
|
149
|
-
|
|
207
|
+
if (isRTL) {
|
|
208
|
+
start = panelRect.right;
|
|
209
|
+
end = panelRect.left;
|
|
210
|
+
} else {
|
|
211
|
+
end = panelRect.right;
|
|
212
|
+
start = panelRect.left;
|
|
213
|
+
}
|
|
150
214
|
bottom = panelRect.bottom;
|
|
151
215
|
setInitialVals = false;
|
|
152
216
|
}
|
|
153
217
|
const mousePos = controlPosition;
|
|
154
218
|
let newSize = 0;
|
|
155
|
-
if (position === 'right') {
|
|
156
|
-
newSize =
|
|
157
|
-
} else if (position === 'left') {
|
|
158
|
-
newSize = mousePos -
|
|
219
|
+
if (position === 'end' || position === 'right') {
|
|
220
|
+
newSize = isRTL ? mousePos - end : end - mousePos;
|
|
221
|
+
} else if (position === 'start' || position === 'left') {
|
|
222
|
+
newSize = isRTL ? start - mousePos : mousePos - start;
|
|
159
223
|
} else {
|
|
160
224
|
newSize = bottom - mousePos;
|
|
161
225
|
}
|
|
@@ -197,6 +261,8 @@ export const DrawerPanelContent: React.FunctionComponent<DrawerPanelContentProps
|
|
|
197
261
|
const callbackMouseUp = React.useCallback(handleMouseup, []);
|
|
198
262
|
|
|
199
263
|
const handleKeys = (e: React.KeyboardEvent) => {
|
|
264
|
+
const isRTL = window.getComputedStyle(panel.current).getPropertyValue('direction') === 'rtl';
|
|
265
|
+
|
|
200
266
|
const key = e.key;
|
|
201
267
|
if (
|
|
202
268
|
key !== 'Escape' &&
|
|
@@ -220,9 +286,17 @@ export const DrawerPanelContent: React.FunctionComponent<DrawerPanelContentProps
|
|
|
220
286
|
newSize = position === 'bottom' ? panelRect.height : panelRect.width;
|
|
221
287
|
let delta = 0;
|
|
222
288
|
if (key === 'ArrowRight') {
|
|
223
|
-
|
|
289
|
+
if (isRTL) {
|
|
290
|
+
delta = position === 'left' || position === 'start' ? -increment : increment;
|
|
291
|
+
} else {
|
|
292
|
+
delta = position === 'left' || position === 'start' ? increment : -increment;
|
|
293
|
+
}
|
|
224
294
|
} else if (key === 'ArrowLeft') {
|
|
225
|
-
|
|
295
|
+
if (isRTL) {
|
|
296
|
+
delta = position === 'left' || position === 'start' ? increment : -increment;
|
|
297
|
+
} else {
|
|
298
|
+
delta = position === 'left' || position === 'start' ? -increment : increment;
|
|
299
|
+
}
|
|
226
300
|
} else if (key === 'ArrowUp') {
|
|
227
301
|
delta = increment;
|
|
228
302
|
} else if (key === 'ArrowDown') {
|
|
@@ -246,64 +320,101 @@ export const DrawerPanelContent: React.FunctionComponent<DrawerPanelContentProps
|
|
|
246
320
|
if (maxSize) {
|
|
247
321
|
boundaryCssVars['--pf-v5-c-drawer__panel--md--FlexBasis--max'] = maxSize;
|
|
248
322
|
}
|
|
323
|
+
|
|
324
|
+
const isValidFocusTrap = focusTrap?.enabled && !isStatic;
|
|
325
|
+
const Component = isValidFocusTrap ? FocusTrap : 'div';
|
|
326
|
+
|
|
249
327
|
return (
|
|
250
328
|
<GenerateId prefix="pf-drawer-panel-">
|
|
251
|
-
{(panelId) =>
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
329
|
+
{(panelId) => {
|
|
330
|
+
const focusTrapProps = {
|
|
331
|
+
tabIndex: -1,
|
|
332
|
+
'aria-modal': true,
|
|
333
|
+
role: 'dialog',
|
|
334
|
+
active: isFocusTrapActive,
|
|
335
|
+
'aria-labelledby': focusTrap?.['aria-labelledby'] || id || panelId,
|
|
336
|
+
focusTrapOptions: {
|
|
337
|
+
fallbackFocus: () => panel.current,
|
|
338
|
+
onActivate: () => {
|
|
339
|
+
if (previouslyFocusedElement.current !== document.activeElement) {
|
|
340
|
+
previouslyFocusedElement.current = document.activeElement;
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
onDeactivate: () => {
|
|
344
|
+
previouslyFocusedElement.current &&
|
|
345
|
+
previouslyFocusedElement.current.focus &&
|
|
346
|
+
previouslyFocusedElement.current.focus();
|
|
347
|
+
},
|
|
348
|
+
clickOutsideDeactivates: true,
|
|
349
|
+
returnFocusOnDeactivate: false,
|
|
350
|
+
// FocusTrap's initialFocus can accept false as a value to prevent initial focus.
|
|
351
|
+
// We want to prevent this in case false is ever passed in.
|
|
352
|
+
initialFocus: focusTrap?.elementToFocusOnExpand || undefined,
|
|
353
|
+
escapeDeactivates: false
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
return (
|
|
358
|
+
<Component
|
|
359
|
+
{...(isValidFocusTrap && focusTrapProps)}
|
|
360
|
+
id={id || panelId}
|
|
361
|
+
className={css(
|
|
362
|
+
styles.drawerPanel,
|
|
363
|
+
isResizable && styles.modifiers.resizable,
|
|
364
|
+
hasNoBorder && styles.modifiers.noBorder,
|
|
365
|
+
formatBreakpointMods(widths, styles),
|
|
366
|
+
colorVariant === DrawerColorVariant.light200 && styles.modifiers.light_200,
|
|
367
|
+
colorVariant === DrawerColorVariant.noBackground && styles.modifiers.noBackground,
|
|
368
|
+
className
|
|
369
|
+
)}
|
|
370
|
+
onTransitionEnd={(ev) => {
|
|
371
|
+
if ((ev.target as HTMLElement) === panel.current) {
|
|
372
|
+
if (!hidden && ev.nativeEvent.propertyName === 'transform') {
|
|
373
|
+
onExpand(ev);
|
|
374
|
+
}
|
|
375
|
+
setIsExpandedInternal(!hidden);
|
|
376
|
+
if (isValidFocusTrap && ev.nativeEvent.propertyName === 'transform') {
|
|
377
|
+
setIsFocusTrapActive((prevIsFocusTrapActive) => !prevIsFocusTrapActive);
|
|
378
|
+
}
|
|
268
379
|
}
|
|
269
|
-
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
380
|
+
}}
|
|
381
|
+
hidden={hidden}
|
|
382
|
+
{...((defaultSize || minSize || maxSize) && {
|
|
383
|
+
style: boundaryCssVars as React.CSSProperties
|
|
384
|
+
})}
|
|
385
|
+
{...props}
|
|
386
|
+
ref={panel}
|
|
387
|
+
>
|
|
388
|
+
{isExpandedInternal && (
|
|
389
|
+
<React.Fragment>
|
|
390
|
+
{isResizable && (
|
|
391
|
+
<React.Fragment>
|
|
392
|
+
<div
|
|
393
|
+
className={css(styles.drawerSplitter, position !== 'bottom' && styles.modifiers.vertical)}
|
|
394
|
+
role="separator"
|
|
395
|
+
tabIndex={0}
|
|
396
|
+
aria-orientation={position === 'bottom' ? 'horizontal' : 'vertical'}
|
|
397
|
+
aria-label={resizeAriaLabel}
|
|
398
|
+
aria-valuenow={separatorValue}
|
|
399
|
+
aria-valuemin={0}
|
|
400
|
+
aria-valuemax={100}
|
|
401
|
+
aria-controls={id || panelId}
|
|
402
|
+
onMouseDown={handleMousedown}
|
|
403
|
+
onKeyDown={handleKeys}
|
|
404
|
+
onTouchStart={handleTouchStart}
|
|
405
|
+
ref={splitterRef}
|
|
406
|
+
>
|
|
407
|
+
<div className={css(styles.drawerSplitterHandle)} aria-hidden></div>
|
|
408
|
+
</div>
|
|
409
|
+
<div className={css(styles.drawerPanelMain)}>{children}</div>
|
|
410
|
+
</React.Fragment>
|
|
411
|
+
)}
|
|
412
|
+
{!isResizable && children}
|
|
413
|
+
</React.Fragment>
|
|
414
|
+
)}
|
|
415
|
+
</Component>
|
|
416
|
+
);
|
|
417
|
+
}}
|
|
307
418
|
</GenerateId>
|
|
308
419
|
);
|
|
309
420
|
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { DrawerPanelContent } from '../DrawerPanelContent';
|
|
4
|
+
import { Drawer } from '../Drawer';
|
|
5
|
+
|
|
6
|
+
test('Does not render with aria-labelledby by default', () => {
|
|
7
|
+
render(
|
|
8
|
+
<Drawer isExpanded>
|
|
9
|
+
<DrawerPanelContent>Drawer panel content</DrawerPanelContent>
|
|
10
|
+
</Drawer>
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
expect(screen.getByText('Drawer panel content')).not.toHaveAccessibleName();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test('Renders with aria-labelledby when focusTrap.enabled is true', () => {
|
|
17
|
+
render(
|
|
18
|
+
<Drawer isExpanded>
|
|
19
|
+
<DrawerPanelContent focusTrap={{ enabled: true }}>Drawer panel content</DrawerPanelContent>
|
|
20
|
+
</Drawer>
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
expect(screen.getByText('Drawer panel content')).toHaveAccessibleName('Drawer panel content');
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test('Renders with aria-labelledby when id is passed in', () => {
|
|
27
|
+
render(
|
|
28
|
+
<Drawer isExpanded>
|
|
29
|
+
<DrawerPanelContent id="drawer-panel-content" focusTrap={{ enabled: true }}>
|
|
30
|
+
Drawer panel content
|
|
31
|
+
</DrawerPanelContent>
|
|
32
|
+
</Drawer>
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
expect(screen.getByText('Drawer panel content')).toHaveAccessibleName('Drawer panel content');
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test('Renders with custom aria-labelledby', () => {
|
|
39
|
+
render(
|
|
40
|
+
<Drawer isExpanded>
|
|
41
|
+
<DrawerPanelContent focusTrap={{ enabled: true, 'aria-labelledby': 'drawer-panel-title' }}>
|
|
42
|
+
<span id="drawer-panel-title">Title</span>
|
|
43
|
+
<span>Drawer panel content</span>
|
|
44
|
+
</DrawerPanelContent>
|
|
45
|
+
</Drawer>
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
expect(screen.getByText('Drawer panel content').parentElement).toHaveAccessibleName('Title');
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test('Does not render with aria-modal="true" by default', () => {
|
|
52
|
+
render(
|
|
53
|
+
<Drawer isExpanded>
|
|
54
|
+
<DrawerPanelContent>Drawer panel content</DrawerPanelContent>
|
|
55
|
+
</Drawer>
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
expect(screen.getByText('Drawer panel content')).not.toHaveAttribute('aria-modal');
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test('Renders with aria-modal="true" when focusTrap.enabled is true', () => {
|
|
62
|
+
render(
|
|
63
|
+
<Drawer isExpanded>
|
|
64
|
+
<DrawerPanelContent focusTrap={{ enabled: true }}>Drawer panel content</DrawerPanelContent>
|
|
65
|
+
</Drawer>
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
expect(screen.getByText('Drawer panel content')).toHaveAttribute('aria-modal', 'true');
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test('Does not render with role="dialog" by default', () => {
|
|
72
|
+
render(
|
|
73
|
+
<Drawer isExpanded>
|
|
74
|
+
<DrawerPanelContent>Drawer panel content</DrawerPanelContent>
|
|
75
|
+
</Drawer>
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test('Renders with role="dialog" when focusTrap.enabled is true', () => {
|
|
82
|
+
render(
|
|
83
|
+
<Drawer isExpanded>
|
|
84
|
+
<DrawerPanelContent focusTrap={{ enabled: true }}>Drawer panel content</DrawerPanelContent>
|
|
85
|
+
</Drawer>
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
expect(screen.getByRole('dialog')).toBeInTheDocument();
|
|
89
|
+
});
|