@patternfly/react-core 6.0.0-alpha.64 → 6.0.0-alpha.66
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 +12 -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/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/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/Chip/package.json +1 -1
- package/dist/dynamic/deprecated/components/DragDrop/package.json +1 -1
- package/dist/dynamic/deprecated/components/Modal/package.json +1 -0
- 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/next/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/next/components/package.json +1 -1
- package/dist/dynamic/styles/package.json +1 -1
- package/dist/dynamic-modules.json +6 -12
- package/dist/esm/components/AboutModal/AboutModal.js +1 -1
- package/dist/esm/components/AboutModal/AboutModal.js.map +1 -1
- package/dist/esm/components/Badge/Badge.d.ts +2 -0
- package/dist/esm/components/Badge/Badge.d.ts.map +1 -1
- package/dist/esm/components/Badge/Badge.js +2 -2
- package/dist/esm/components/Badge/Badge.js.map +1 -1
- package/dist/esm/components/Button/Button.d.ts.map +1 -1
- package/dist/esm/components/Button/Button.js +1 -1
- package/dist/esm/components/Button/Button.js.map +1 -1
- package/dist/esm/components/Modal/Modal.d.ts +4 -40
- package/dist/esm/components/Modal/Modal.d.ts.map +1 -1
- package/dist/esm/components/Modal/Modal.js +5 -27
- package/dist/esm/components/Modal/Modal.js.map +1 -1
- package/dist/esm/components/Modal/ModalBody.d.ts.map +1 -0
- package/dist/esm/components/Modal/ModalBody.js.map +1 -0
- package/dist/esm/components/Modal/ModalBox.d.ts +3 -3
- package/dist/esm/components/Modal/ModalBox.d.ts.map +1 -1
- package/dist/esm/components/Modal/ModalBox.js +2 -2
- package/dist/esm/components/Modal/ModalBox.js.map +1 -1
- package/dist/esm/components/Modal/ModalBoxCloseButton.js +1 -1
- package/dist/esm/components/Modal/ModalBoxCloseButton.js.map +1 -1
- package/dist/esm/components/Modal/ModalBoxTitle.d.ts +2 -2
- package/dist/esm/components/Modal/ModalBoxTitle.d.ts.map +1 -1
- package/dist/esm/components/Modal/ModalBoxTitle.js +3 -2
- package/dist/esm/components/Modal/ModalBoxTitle.js.map +1 -1
- package/dist/esm/components/Modal/ModalContent.d.ts +3 -41
- package/dist/esm/components/Modal/ModalContent.d.ts.map +1 -1
- package/dist/esm/components/Modal/ModalContent.js +12 -29
- package/dist/esm/components/Modal/ModalContent.js.map +1 -1
- package/dist/esm/components/Modal/ModalFooter.d.ts.map +1 -0
- package/dist/esm/components/Modal/ModalFooter.js.map +1 -0
- package/dist/esm/components/Modal/ModalHeader.d.ts.map +1 -0
- package/dist/esm/components/Modal/ModalHeader.js.map +1 -0
- package/dist/esm/components/Modal/index.d.ts +3 -6
- package/dist/esm/components/Modal/index.d.ts.map +1 -1
- package/dist/esm/components/Modal/index.js +3 -6
- package/dist/esm/components/Modal/index.js.map +1 -1
- package/dist/esm/{next → deprecated}/components/Modal/Modal.d.ts +40 -4
- package/dist/esm/deprecated/components/Modal/Modal.d.ts.map +1 -0
- package/dist/esm/{next → deprecated}/components/Modal/Modal.js +27 -5
- package/dist/esm/deprecated/components/Modal/Modal.js.map +1 -0
- package/dist/esm/{next → deprecated}/components/Modal/ModalBox.d.ts +3 -3
- package/dist/esm/deprecated/components/Modal/ModalBox.d.ts.map +1 -0
- package/dist/esm/deprecated/components/Modal/ModalBox.js +15 -0
- package/dist/esm/deprecated/components/Modal/ModalBox.js.map +1 -0
- package/dist/esm/deprecated/components/Modal/ModalBoxBody.d.ts.map +1 -0
- package/dist/esm/deprecated/components/Modal/ModalBoxBody.js.map +1 -0
- package/dist/esm/deprecated/components/Modal/ModalBoxCloseButton.d.ts.map +1 -0
- package/dist/esm/{next → deprecated}/components/Modal/ModalBoxCloseButton.js +1 -1
- package/dist/esm/deprecated/components/Modal/ModalBoxCloseButton.js.map +1 -0
- package/dist/esm/deprecated/components/Modal/ModalBoxDescription.d.ts.map +1 -0
- package/dist/esm/deprecated/components/Modal/ModalBoxDescription.js.map +1 -0
- package/dist/esm/deprecated/components/Modal/ModalBoxFooter.d.ts.map +1 -0
- package/dist/esm/deprecated/components/Modal/ModalBoxFooter.js.map +1 -0
- package/dist/esm/deprecated/components/Modal/ModalBoxHeader.d.ts.map +1 -0
- package/dist/esm/deprecated/components/Modal/ModalBoxHeader.js.map +1 -0
- package/dist/{js/next → esm/deprecated}/components/Modal/ModalBoxTitle.d.ts +2 -2
- package/dist/esm/deprecated/components/Modal/ModalBoxTitle.d.ts.map +1 -0
- package/dist/esm/{next → deprecated}/components/Modal/ModalBoxTitle.js +2 -3
- package/dist/esm/deprecated/components/Modal/ModalBoxTitle.js.map +1 -0
- package/dist/esm/deprecated/components/Modal/ModalContent.d.ts +80 -0
- package/dist/esm/deprecated/components/Modal/ModalContent.d.ts.map +1 -0
- package/dist/esm/deprecated/components/Modal/ModalContent.js +62 -0
- package/dist/esm/deprecated/components/Modal/ModalContent.js.map +1 -0
- package/dist/esm/deprecated/components/Modal/index.d.ts +8 -0
- package/dist/esm/deprecated/components/Modal/index.d.ts.map +1 -0
- package/dist/esm/deprecated/components/Modal/index.js +8 -0
- package/dist/esm/deprecated/components/Modal/index.js.map +1 -0
- package/dist/esm/deprecated/components/Wizard/Wizard.js +1 -1
- package/dist/esm/deprecated/components/Wizard/Wizard.js.map +1 -1
- package/dist/esm/deprecated/components/index.d.ts +1 -0
- package/dist/esm/deprecated/components/index.d.ts.map +1 -1
- package/dist/esm/deprecated/components/index.js +1 -0
- package/dist/esm/deprecated/components/index.js.map +1 -1
- package/dist/esm/next/components/index.d.ts +0 -1
- package/dist/esm/next/components/index.d.ts.map +1 -1
- package/dist/esm/next/components/index.js +0 -1
- package/dist/esm/next/components/index.js.map +1 -1
- package/dist/js/components/AboutModal/AboutModal.js +1 -1
- package/dist/js/components/AboutModal/AboutModal.js.map +1 -1
- package/dist/js/components/Badge/Badge.d.ts +2 -0
- package/dist/js/components/Badge/Badge.d.ts.map +1 -1
- package/dist/js/components/Badge/Badge.js +2 -2
- package/dist/js/components/Badge/Badge.js.map +1 -1
- package/dist/js/components/Button/Button.d.ts.map +1 -1
- package/dist/js/components/Button/Button.js +1 -1
- package/dist/js/components/Button/Button.js.map +1 -1
- package/dist/js/components/Modal/Modal.d.ts +4 -40
- package/dist/js/components/Modal/Modal.d.ts.map +1 -1
- package/dist/js/components/Modal/Modal.js +5 -27
- package/dist/js/components/Modal/Modal.js.map +1 -1
- package/dist/js/components/Modal/ModalBody.d.ts.map +1 -0
- package/dist/js/components/Modal/ModalBody.js.map +1 -0
- package/dist/js/components/Modal/ModalBox.d.ts +3 -3
- package/dist/js/components/Modal/ModalBox.d.ts.map +1 -1
- package/dist/js/components/Modal/ModalBox.js +2 -2
- package/dist/js/components/Modal/ModalBox.js.map +1 -1
- package/dist/js/components/Modal/ModalBoxCloseButton.js +1 -1
- package/dist/js/components/Modal/ModalBoxCloseButton.js.map +1 -1
- package/dist/js/components/Modal/ModalBoxTitle.d.ts +2 -2
- package/dist/js/components/Modal/ModalBoxTitle.d.ts.map +1 -1
- package/dist/js/components/Modal/ModalBoxTitle.js +3 -2
- package/dist/js/components/Modal/ModalBoxTitle.js.map +1 -1
- package/dist/js/components/Modal/ModalContent.d.ts +3 -41
- package/dist/js/components/Modal/ModalContent.d.ts.map +1 -1
- package/dist/js/components/Modal/ModalContent.js +12 -29
- package/dist/js/components/Modal/ModalContent.js.map +1 -1
- package/dist/js/components/Modal/ModalFooter.d.ts.map +1 -0
- package/dist/js/components/Modal/ModalFooter.js.map +1 -0
- package/dist/js/components/Modal/ModalHeader.d.ts.map +1 -0
- package/dist/js/components/Modal/ModalHeader.js.map +1 -0
- package/dist/js/components/Modal/index.d.ts +3 -6
- package/dist/js/components/Modal/index.d.ts.map +1 -1
- package/dist/js/components/Modal/index.js +3 -6
- package/dist/js/components/Modal/index.js.map +1 -1
- package/dist/js/{next → deprecated}/components/Modal/Modal.d.ts +40 -4
- package/dist/js/deprecated/components/Modal/Modal.d.ts.map +1 -0
- package/dist/js/{next → deprecated}/components/Modal/Modal.js +27 -5
- package/dist/js/deprecated/components/Modal/Modal.js.map +1 -0
- package/dist/js/{next → deprecated}/components/Modal/ModalBox.d.ts +3 -3
- package/dist/js/deprecated/components/Modal/ModalBox.d.ts.map +1 -0
- package/dist/js/deprecated/components/Modal/ModalBox.js +19 -0
- package/dist/js/deprecated/components/Modal/ModalBox.js.map +1 -0
- package/dist/js/deprecated/components/Modal/ModalBoxBody.d.ts.map +1 -0
- package/dist/js/deprecated/components/Modal/ModalBoxBody.js.map +1 -0
- package/dist/js/deprecated/components/Modal/ModalBoxCloseButton.d.ts.map +1 -0
- package/dist/js/{next → deprecated}/components/Modal/ModalBoxCloseButton.js +1 -1
- package/dist/js/deprecated/components/Modal/ModalBoxCloseButton.js.map +1 -0
- package/dist/js/deprecated/components/Modal/ModalBoxDescription.d.ts.map +1 -0
- package/dist/js/deprecated/components/Modal/ModalBoxDescription.js.map +1 -0
- package/dist/js/deprecated/components/Modal/ModalBoxFooter.d.ts.map +1 -0
- package/dist/js/deprecated/components/Modal/ModalBoxFooter.js.map +1 -0
- package/dist/js/deprecated/components/Modal/ModalBoxHeader.d.ts.map +1 -0
- package/dist/js/deprecated/components/Modal/ModalBoxHeader.js.map +1 -0
- package/dist/{esm/next → js/deprecated}/components/Modal/ModalBoxTitle.d.ts +2 -2
- package/dist/js/deprecated/components/Modal/ModalBoxTitle.d.ts.map +1 -0
- package/dist/js/{next → deprecated}/components/Modal/ModalBoxTitle.js +2 -3
- package/dist/js/deprecated/components/Modal/ModalBoxTitle.js.map +1 -0
- package/dist/js/deprecated/components/Modal/ModalContent.d.ts +80 -0
- package/dist/js/deprecated/components/Modal/ModalContent.d.ts.map +1 -0
- package/dist/js/deprecated/components/Modal/ModalContent.js +66 -0
- package/dist/js/deprecated/components/Modal/ModalContent.js.map +1 -0
- package/dist/js/deprecated/components/Modal/index.d.ts +8 -0
- package/dist/js/deprecated/components/Modal/index.d.ts.map +1 -0
- package/dist/js/deprecated/components/Modal/index.js +11 -0
- package/dist/js/deprecated/components/Modal/index.js.map +1 -0
- package/dist/js/deprecated/components/Wizard/Wizard.js +1 -1
- package/dist/js/deprecated/components/Wizard/Wizard.js.map +1 -1
- package/dist/js/deprecated/components/index.d.ts +1 -0
- package/dist/js/deprecated/components/index.d.ts.map +1 -1
- package/dist/js/deprecated/components/index.js +1 -0
- package/dist/js/deprecated/components/index.js.map +1 -1
- package/dist/js/next/components/index.d.ts +0 -1
- package/dist/js/next/components/index.d.ts.map +1 -1
- package/dist/js/next/components/index.js +0 -1
- package/dist/js/next/components/index.js.map +1 -1
- package/dist/umd/assets/{output-BvT0K3uY.css → output-C4GbSx1X.css} +1777 -1777
- 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 +2 -2
- package/src/components/AboutModal/AboutModal.tsx +1 -1
- package/src/components/Badge/Badge.tsx +9 -1
- package/src/components/Badge/__tests__/Badge.test.tsx +5 -0
- package/src/components/Badge/examples/Badge.md +5 -0
- package/src/components/Badge/examples/BadgeDisabled.tsx +19 -0
- package/src/components/Button/Button.tsx +3 -1
- package/src/components/Label/examples/LabelGroupEditableAddModal.tsx +4 -5
- package/src/components/Modal/Modal.tsx +9 -82
- package/src/components/Modal/ModalBox.tsx +6 -6
- package/src/components/Modal/ModalBoxCloseButton.tsx +1 -1
- package/src/components/Modal/ModalBoxTitle.tsx +7 -5
- package/src/components/Modal/ModalContent.tsx +19 -110
- package/src/components/Modal/__tests__/Modal.test.tsx +10 -77
- package/src/components/Modal/__tests__/ModalBoxHeader.test.tsx +12 -5
- package/src/components/Modal/__tests__/ModalBoxTitle.test.tsx +6 -28
- package/src/components/Modal/__tests__/ModalContent.test.tsx +6 -72
- package/src/components/Modal/__tests__/__snapshots__/ModalBoxHeader.test.tsx.snap +16 -2
- package/src/components/Modal/__tests__/__snapshots__/ModalContent.test.tsx.snap +13 -478
- package/src/components/Modal/examples/Modal.md +24 -32
- package/src/components/Modal/examples/ModalBasic.tsx +16 -12
- package/src/components/Modal/examples/ModalCustomFocus.tsx +19 -15
- package/src/{next/components → components}/Modal/examples/ModalCustomHeader.tsx +12 -2
- package/src/components/Modal/examples/ModalCustomTitleIcon.tsx +24 -18
- package/src/components/Modal/examples/ModalCustomWidth.tsx +15 -11
- package/src/components/Modal/examples/ModalNoHeaderFooter.tsx +14 -12
- package/src/{next/components → components}/Modal/examples/ModalSize.tsx +1 -2
- package/src/components/Modal/examples/ModalTitleIcon.tsx +20 -18
- package/src/components/Modal/examples/ModalTopAligned.tsx +15 -11
- package/src/components/Modal/examples/ModalWithDescription.tsx +53 -12
- package/src/components/Modal/examples/ModalWithDropdown.tsx +56 -49
- package/src/components/Modal/examples/ModalWithForm.tsx +150 -139
- package/src/components/Modal/examples/ModalWithHelp.tsx +34 -26
- package/src/components/Modal/examples/ModalWithOverflowingContent.tsx +47 -44
- package/src/components/Modal/examples/ModalWithWizard.tsx +2 -4
- package/src/components/Modal/index.ts +3 -6
- package/src/components/Wizard/examples/Wizard.md +1 -0
- package/src/components/Wizard/examples/WizardWithinModal.tsx +5 -4
- package/src/demos/DatePicker/DatePicker.md +2 -2
- package/src/demos/DatePicker/examples/DateTimePickerInModal.tsx +5 -12
- package/src/demos/LabelGroupDemos.md +3 -0
- package/src/demos/MultipleFileUploadDemos.md +2 -0
- package/src/demos/examples/MultipleFileUpload/MultipleFileUploadRejectedFile.tsx +3 -3
- package/src/{next → deprecated}/components/Modal/Modal.tsx +82 -9
- package/src/{next → deprecated}/components/Modal/ModalBox.tsx +6 -6
- package/src/{next → deprecated}/components/Modal/ModalBoxCloseButton.tsx +1 -1
- package/src/{next → deprecated}/components/Modal/ModalBoxTitle.tsx +5 -7
- package/src/deprecated/components/Modal/ModalContent.tsx +222 -0
- package/src/{next → deprecated}/components/Modal/__tests__/Modal.test.tsx +76 -9
- package/src/deprecated/components/Modal/__tests__/ModalBoxHeader.test.tsx +14 -0
- package/src/{next → deprecated}/components/Modal/__tests__/ModalBoxTitle.test.tsx +28 -6
- package/src/deprecated/components/Modal/__tests__/ModalContent.test.tsx +112 -0
- package/src/{next → deprecated}/components/Modal/__tests__/__snapshots__/ModalBoxHeader.test.tsx.snap +2 -16
- package/src/deprecated/components/Modal/__tests__/__snapshots__/ModalContent.test.tsx.snap +593 -0
- package/src/{next → deprecated}/components/Modal/examples/Modal.md +34 -24
- package/src/deprecated/components/Modal/examples/ModalBasic.tsx +39 -0
- package/src/deprecated/components/Modal/examples/ModalCustomFocus.tsx +39 -0
- package/src/{components → deprecated/components}/Modal/examples/ModalCustomHeaderFooter.tsx +5 -4
- package/src/deprecated/components/Modal/examples/ModalCustomTitleIcon.tsx +47 -0
- package/src/deprecated/components/Modal/examples/ModalCustomWidth.tsx +39 -0
- package/src/{components → deprecated/components}/Modal/examples/ModalLarge.tsx +5 -4
- package/src/{components → deprecated/components}/Modal/examples/ModalMedium.tsx +5 -4
- package/src/deprecated/components/Modal/examples/ModalNoHeaderFooter.tsx +38 -0
- package/src/{components → deprecated/components}/Modal/examples/ModalSmall.tsx +5 -4
- package/src/deprecated/components/Modal/examples/ModalTitleIcon.tsx +46 -0
- package/src/deprecated/components/Modal/examples/ModalTopAligned.tsx +39 -0
- package/src/deprecated/components/Modal/examples/ModalWithDescription.tsx +39 -0
- package/src/deprecated/components/Modal/examples/ModalWithDropdown.tsx +100 -0
- package/src/deprecated/components/Modal/examples/ModalWithForm.tsx +183 -0
- package/src/deprecated/components/Modal/examples/ModalWithHelp.tsx +56 -0
- package/src/deprecated/components/Modal/examples/ModalWithOverflowingContent.tsx +72 -0
- package/src/{next → deprecated}/components/Modal/examples/ModalWithWizard.tsx +7 -5
- package/src/deprecated/components/Modal/index.ts +7 -0
- package/src/deprecated/components/Wizard/Wizard.tsx +1 -1
- package/src/deprecated/components/index.ts +1 -0
- package/src/next/components/index.ts +0 -1
- package/dist/dynamic/next/components/Modal/package.json +0 -1
- package/dist/esm/components/Modal/ModalBoxBody.d.ts.map +0 -1
- package/dist/esm/components/Modal/ModalBoxBody.js.map +0 -1
- package/dist/esm/components/Modal/ModalBoxFooter.d.ts.map +0 -1
- package/dist/esm/components/Modal/ModalBoxFooter.js.map +0 -1
- package/dist/esm/components/Modal/ModalBoxHeader.d.ts.map +0 -1
- package/dist/esm/components/Modal/ModalBoxHeader.js.map +0 -1
- package/dist/esm/next/components/Modal/Modal.d.ts.map +0 -1
- package/dist/esm/next/components/Modal/Modal.js.map +0 -1
- package/dist/esm/next/components/Modal/ModalBody.d.ts.map +0 -1
- package/dist/esm/next/components/Modal/ModalBody.js.map +0 -1
- package/dist/esm/next/components/Modal/ModalBox.d.ts.map +0 -1
- package/dist/esm/next/components/Modal/ModalBox.js +0 -15
- package/dist/esm/next/components/Modal/ModalBox.js.map +0 -1
- package/dist/esm/next/components/Modal/ModalBoxCloseButton.d.ts.map +0 -1
- package/dist/esm/next/components/Modal/ModalBoxCloseButton.js.map +0 -1
- package/dist/esm/next/components/Modal/ModalBoxDescription.d.ts.map +0 -1
- package/dist/esm/next/components/Modal/ModalBoxDescription.js.map +0 -1
- package/dist/esm/next/components/Modal/ModalBoxTitle.d.ts.map +0 -1
- package/dist/esm/next/components/Modal/ModalBoxTitle.js.map +0 -1
- package/dist/esm/next/components/Modal/ModalContent.d.ts +0 -42
- package/dist/esm/next/components/Modal/ModalContent.d.ts.map +0 -1
- package/dist/esm/next/components/Modal/ModalContent.js +0 -45
- package/dist/esm/next/components/Modal/ModalContent.js.map +0 -1
- package/dist/esm/next/components/Modal/ModalFooter.d.ts.map +0 -1
- package/dist/esm/next/components/Modal/ModalFooter.js.map +0 -1
- package/dist/esm/next/components/Modal/ModalHeader.d.ts.map +0 -1
- package/dist/esm/next/components/Modal/ModalHeader.js.map +0 -1
- package/dist/esm/next/components/Modal/index.d.ts +0 -5
- package/dist/esm/next/components/Modal/index.d.ts.map +0 -1
- package/dist/esm/next/components/Modal/index.js +0 -5
- package/dist/esm/next/components/Modal/index.js.map +0 -1
- package/dist/js/components/Modal/ModalBoxBody.d.ts.map +0 -1
- package/dist/js/components/Modal/ModalBoxBody.js.map +0 -1
- package/dist/js/components/Modal/ModalBoxFooter.d.ts.map +0 -1
- package/dist/js/components/Modal/ModalBoxFooter.js.map +0 -1
- package/dist/js/components/Modal/ModalBoxHeader.d.ts.map +0 -1
- package/dist/js/components/Modal/ModalBoxHeader.js.map +0 -1
- package/dist/js/next/components/Modal/Modal.d.ts.map +0 -1
- package/dist/js/next/components/Modal/Modal.js.map +0 -1
- package/dist/js/next/components/Modal/ModalBody.d.ts.map +0 -1
- package/dist/js/next/components/Modal/ModalBody.js.map +0 -1
- package/dist/js/next/components/Modal/ModalBox.d.ts.map +0 -1
- package/dist/js/next/components/Modal/ModalBox.js +0 -19
- package/dist/js/next/components/Modal/ModalBox.js.map +0 -1
- package/dist/js/next/components/Modal/ModalBoxCloseButton.d.ts.map +0 -1
- package/dist/js/next/components/Modal/ModalBoxCloseButton.js.map +0 -1
- package/dist/js/next/components/Modal/ModalBoxDescription.d.ts.map +0 -1
- package/dist/js/next/components/Modal/ModalBoxDescription.js.map +0 -1
- package/dist/js/next/components/Modal/ModalBoxTitle.d.ts.map +0 -1
- package/dist/js/next/components/Modal/ModalBoxTitle.js.map +0 -1
- package/dist/js/next/components/Modal/ModalContent.d.ts +0 -42
- package/dist/js/next/components/Modal/ModalContent.d.ts.map +0 -1
- package/dist/js/next/components/Modal/ModalContent.js +0 -49
- package/dist/js/next/components/Modal/ModalContent.js.map +0 -1
- package/dist/js/next/components/Modal/ModalFooter.d.ts.map +0 -1
- package/dist/js/next/components/Modal/ModalFooter.js.map +0 -1
- package/dist/js/next/components/Modal/ModalHeader.d.ts.map +0 -1
- package/dist/js/next/components/Modal/ModalHeader.js.map +0 -1
- package/dist/js/next/components/Modal/index.d.ts +0 -5
- package/dist/js/next/components/Modal/index.d.ts.map +0 -1
- package/dist/js/next/components/Modal/index.js +0 -8
- package/dist/js/next/components/Modal/index.js.map +0 -1
- package/src/next/components/Modal/ModalContent.tsx +0 -131
- package/src/next/components/Modal/__tests__/ModalBoxHeader.test.tsx +0 -21
- package/src/next/components/Modal/__tests__/ModalContent.test.tsx +0 -46
- package/src/next/components/Modal/__tests__/__snapshots__/ModalContent.test.tsx.snap +0 -128
- package/src/next/components/Modal/examples/ModalBasic.tsx +0 -43
- package/src/next/components/Modal/examples/ModalCustomFocus.tsx +0 -43
- package/src/next/components/Modal/examples/ModalCustomTitleIcon.tsx +0 -54
- package/src/next/components/Modal/examples/ModalCustomWidth.tsx +0 -43
- package/src/next/components/Modal/examples/ModalNoHeaderFooter.tsx +0 -40
- package/src/next/components/Modal/examples/ModalTitleIcon.tsx +0 -48
- package/src/next/components/Modal/examples/ModalTopAligned.tsx +0 -43
- package/src/next/components/Modal/examples/ModalWithDescription.tsx +0 -80
- package/src/next/components/Modal/examples/ModalWithDropdown.tsx +0 -105
- package/src/next/components/Modal/examples/ModalWithForm.tsx +0 -191
- package/src/next/components/Modal/examples/ModalWithHelp.tsx +0 -63
- package/src/next/components/Modal/examples/ModalWithOverflowingContent.tsx +0 -75
- package/src/next/components/Modal/index.ts +0 -4
- /package/dist/esm/{next/components → components}/Modal/ModalBody.d.ts +0 -0
- /package/dist/esm/{next/components → components}/Modal/ModalBody.js +0 -0
- /package/dist/esm/{next/components → components}/Modal/ModalFooter.d.ts +0 -0
- /package/dist/esm/{next/components → components}/Modal/ModalFooter.js +0 -0
- /package/dist/esm/{next/components → components}/Modal/ModalHeader.d.ts +0 -0
- /package/dist/esm/{next/components → components}/Modal/ModalHeader.js +0 -0
- /package/dist/esm/{components → deprecated/components}/Modal/ModalBoxBody.d.ts +0 -0
- /package/dist/esm/{components → deprecated/components}/Modal/ModalBoxBody.js +0 -0
- /package/dist/esm/{next → deprecated}/components/Modal/ModalBoxCloseButton.d.ts +0 -0
- /package/dist/esm/{next → deprecated}/components/Modal/ModalBoxDescription.d.ts +0 -0
- /package/dist/esm/{next → deprecated}/components/Modal/ModalBoxDescription.js +0 -0
- /package/dist/esm/{components → deprecated/components}/Modal/ModalBoxFooter.d.ts +0 -0
- /package/dist/esm/{components → deprecated/components}/Modal/ModalBoxFooter.js +0 -0
- /package/dist/esm/{components → deprecated/components}/Modal/ModalBoxHeader.d.ts +0 -0
- /package/dist/esm/{components → deprecated/components}/Modal/ModalBoxHeader.js +0 -0
- /package/dist/js/{next/components → components}/Modal/ModalBody.d.ts +0 -0
- /package/dist/js/{next/components → components}/Modal/ModalBody.js +0 -0
- /package/dist/js/{next/components → components}/Modal/ModalFooter.d.ts +0 -0
- /package/dist/js/{next/components → components}/Modal/ModalFooter.js +0 -0
- /package/dist/js/{next/components → components}/Modal/ModalHeader.d.ts +0 -0
- /package/dist/js/{next/components → components}/Modal/ModalHeader.js +0 -0
- /package/dist/js/{components → deprecated/components}/Modal/ModalBoxBody.d.ts +0 -0
- /package/dist/js/{components → deprecated/components}/Modal/ModalBoxBody.js +0 -0
- /package/dist/js/{next → deprecated}/components/Modal/ModalBoxCloseButton.d.ts +0 -0
- /package/dist/js/{next → deprecated}/components/Modal/ModalBoxDescription.d.ts +0 -0
- /package/dist/js/{next → deprecated}/components/Modal/ModalBoxDescription.js +0 -0
- /package/dist/js/{components → deprecated/components}/Modal/ModalBoxFooter.d.ts +0 -0
- /package/dist/js/{components → deprecated/components}/Modal/ModalBoxFooter.js +0 -0
- /package/dist/js/{components → deprecated/components}/Modal/ModalBoxHeader.d.ts +0 -0
- /package/dist/js/{components → deprecated/components}/Modal/ModalBoxHeader.js +0 -0
- /package/src/{next/components → components}/Modal/ModalBody.tsx +0 -0
- /package/src/{next/components → components}/Modal/ModalFooter.tsx +0 -0
- /package/src/{next/components → components}/Modal/ModalHeader.tsx +0 -0
- /package/src/{next/components → components}/Modal/__tests__/ModalBody.test.tsx +0 -0
- /package/src/{next/components → components}/Modal/__tests__/ModalFooter.test.tsx +0 -0
- /package/src/{next/components → components}/Modal/__tests__/__snapshots__/ModalBody.test.tsx.snap +0 -0
- /package/src/{next/components → components}/Modal/__tests__/__snapshots__/ModalFooter.test.tsx.snap +0 -0
- /package/src/{components → deprecated/components}/Modal/ModalBoxBody.tsx +0 -0
- /package/src/{next → deprecated}/components/Modal/ModalBoxDescription.tsx +0 -0
- /package/src/{components → deprecated/components}/Modal/ModalBoxFooter.tsx +0 -0
- /package/src/{components → deprecated/components}/Modal/ModalBoxHeader.tsx +0 -0
- /package/src/{next → deprecated}/components/Modal/__tests__/ModalBox.test.tsx +0 -0
- /package/src/{components → deprecated/components}/Modal/__tests__/ModalBoxBody.test.tsx +0 -0
- /package/src/{next → deprecated}/components/Modal/__tests__/ModalBoxCloseButton.test.tsx +0 -0
- /package/src/{next → deprecated}/components/Modal/__tests__/ModalBoxDescription.test.tsx +0 -0
- /package/src/{components → deprecated/components}/Modal/__tests__/ModalBoxFooter.test.tsx +0 -0
- /package/src/{next → deprecated}/components/Modal/__tests__/__snapshots__/ModalBox.test.tsx.snap +0 -0
- /package/src/{components → deprecated/components}/Modal/__tests__/__snapshots__/ModalBoxBody.test.tsx.snap +0 -0
- /package/src/{next → deprecated}/components/Modal/__tests__/__snapshots__/ModalBoxDescription.test.tsx.snap +0 -0
- /package/src/{components → deprecated/components}/Modal/__tests__/__snapshots__/ModalBoxFooter.test.tsx.snap +0 -0
- /package/src/{next → deprecated}/components/Modal/__tests__/__snapshots__/ModalBoxTitle.test.tsx.snap +0 -0
|
@@ -4,6 +4,7 @@ section: components
|
|
|
4
4
|
subsection: file-upload
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
import { Modal as ModalDeprecated, ModalVariant as ModalVariantDeprecated } from '@patternfly/react-core/deprecated';
|
|
7
8
|
import UploadIcon from '@patternfly/react-icons/dist/esm/icons/upload-icon';
|
|
8
9
|
|
|
9
10
|
## Demos
|
|
@@ -13,4 +14,5 @@ import UploadIcon from '@patternfly/react-icons/dist/esm/icons/upload-icon';
|
|
|
13
14
|
This demo shows how to add a modal to alert users that the file(s) they attempted to drop was of a non-acceptable type.
|
|
14
15
|
|
|
15
16
|
```ts file="./examples/MultipleFileUpload/MultipleFileUploadRejectedFile.tsx"
|
|
17
|
+
|
|
16
18
|
```
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
MultipleFileUploadMain,
|
|
6
6
|
MultipleFileUploadStatus,
|
|
7
7
|
MultipleFileUploadStatusItem,
|
|
8
|
-
Modal,
|
|
9
8
|
Checkbox,
|
|
10
9
|
DropEvent
|
|
11
10
|
} from '@patternfly/react-core';
|
|
11
|
+
import { Modal as ModalDeprecated } from '@patternfly/react-core/deprecated';
|
|
12
12
|
import UploadIcon from '@patternfly/react-icons/dist/esm/icons/upload-icon';
|
|
13
13
|
|
|
14
14
|
interface readFile {
|
|
@@ -135,7 +135,7 @@ export const MultipleFileUploadBasic: React.FunctionComponent = () => {
|
|
|
135
135
|
))}
|
|
136
136
|
</MultipleFileUploadStatus>
|
|
137
137
|
)}
|
|
138
|
-
<
|
|
138
|
+
<ModalDeprecated
|
|
139
139
|
isOpen={!!modalText}
|
|
140
140
|
title="Unsupported file"
|
|
141
141
|
titleIconVariant="warning"
|
|
@@ -144,7 +144,7 @@ export const MultipleFileUploadBasic: React.FunctionComponent = () => {
|
|
|
144
144
|
onClose={() => setModalText('')}
|
|
145
145
|
>
|
|
146
146
|
{modalText}
|
|
147
|
-
</
|
|
147
|
+
</ModalDeprecated>
|
|
148
148
|
</MultipleFileUpload>
|
|
149
149
|
<Checkbox
|
|
150
150
|
id="horizontal-checkbox"
|
|
@@ -7,29 +7,53 @@ import { ModalContent } from './ModalContent';
|
|
|
7
7
|
import { OUIAProps, getDefaultOUIAId } from '../../../helpers';
|
|
8
8
|
|
|
9
9
|
export interface ModalProps extends React.HTMLProps<HTMLDivElement>, OUIAProps {
|
|
10
|
+
/** Action buttons to add to the standard modal footer. Ignored if the footer property
|
|
11
|
+
* is passed in.
|
|
12
|
+
*/
|
|
13
|
+
actions?: any;
|
|
10
14
|
/** The parent container to append the modal to. Defaults to "document.body". */
|
|
11
15
|
appendTo?: HTMLElement | (() => HTMLElement);
|
|
12
|
-
/** Id to use for the modal box
|
|
16
|
+
/** Id to use for the modal box descriptor. */
|
|
13
17
|
'aria-describedby'?: string;
|
|
14
|
-
/**
|
|
18
|
+
/** Accessible descriptor of the modal. */
|
|
15
19
|
'aria-label'?: string;
|
|
16
|
-
/** Id to use for the modal box label.
|
|
20
|
+
/** Id to use for the modal box label. */
|
|
17
21
|
'aria-labelledby'?: string;
|
|
22
|
+
/** Accessible label applied to the modal box body. This should be used to communicate
|
|
23
|
+
* important information about the modal box body div element if needed, such as that it
|
|
24
|
+
* is scrollable.
|
|
25
|
+
*/
|
|
26
|
+
bodyAriaLabel?: string;
|
|
27
|
+
/** Accessible role applied to the modal box body. This will default to "region" if the
|
|
28
|
+
* bodyAriaLabel property is passed in. Set to a more appropriate role as applicable
|
|
29
|
+
* based on the modal content and context.
|
|
30
|
+
*/
|
|
31
|
+
bodyAriaRole?: string;
|
|
18
32
|
/** Content rendered inside the modal. */
|
|
19
33
|
children: React.ReactNode;
|
|
20
34
|
/** Additional classes added to the modal. */
|
|
21
35
|
className?: string;
|
|
36
|
+
/** Description of the modal. */
|
|
37
|
+
description?: React.ReactNode;
|
|
22
38
|
/** Flag to disable focus trap. */
|
|
23
39
|
disableFocusTrap?: boolean;
|
|
24
40
|
/** The element to focus when the modal opens. By default the first
|
|
25
41
|
* focusable element will receive focus.
|
|
26
42
|
*/
|
|
27
43
|
elementToFocus?: HTMLElement | SVGElement | string;
|
|
44
|
+
/** Custom footer. */
|
|
45
|
+
footer?: React.ReactNode;
|
|
46
|
+
/** Flag indicating if modal content should be placed in a modal box body wrapper. */
|
|
47
|
+
hasNoBodyWrapper?: boolean;
|
|
48
|
+
/** Complex header (more than just text), supersedes the title property for header content. */
|
|
49
|
+
header?: React.ReactNode;
|
|
50
|
+
/** Optional help section for the modal header. */
|
|
51
|
+
help?: React.ReactNode;
|
|
28
52
|
/** An id to use for the modal box container. */
|
|
29
53
|
id?: string;
|
|
30
54
|
/** Flag to show the modal. */
|
|
31
55
|
isOpen?: boolean;
|
|
32
|
-
/**
|
|
56
|
+
/** A callback for when the close button is clicked. */
|
|
33
57
|
onClose?: (event: KeyboardEvent | React.MouseEvent) => void;
|
|
34
58
|
/** Modal handles pressing of the escape key and closes the modal. If you want to handle
|
|
35
59
|
* this yourself you can use this callback function. */
|
|
@@ -38,6 +62,16 @@ export interface ModalProps extends React.HTMLProps<HTMLDivElement>, OUIAProps {
|
|
|
38
62
|
position?: 'default' | 'top';
|
|
39
63
|
/** Offset from alternate position. Can be any valid CSS length/percentage. */
|
|
40
64
|
positionOffset?: string;
|
|
65
|
+
/** Flag to show the close button in the header area of the modal. */
|
|
66
|
+
showClose?: boolean;
|
|
67
|
+
/** Simple text content of the modal header. Also used for the aria-label on the body. */
|
|
68
|
+
title?: string;
|
|
69
|
+
/** Optional alert icon (or other) to show before the title of the modal header. When the
|
|
70
|
+
* predefined alert types are used the default styling will be automatically applied.
|
|
71
|
+
*/
|
|
72
|
+
titleIconVariant?: 'success' | 'danger' | 'warning' | 'info' | 'custom' | React.ComponentType<any>;
|
|
73
|
+
/** Optional title label text for screen readers. */
|
|
74
|
+
titleLabel?: string;
|
|
41
75
|
/** Variant of the modal. */
|
|
42
76
|
variant?: 'small' | 'medium' | 'large' | 'default';
|
|
43
77
|
/** Default width of the modal. */
|
|
@@ -66,10 +100,24 @@ class Modal extends React.Component<ModalProps, ModalState> {
|
|
|
66
100
|
static displayName = 'Modal';
|
|
67
101
|
static currentId = 0;
|
|
68
102
|
boxId = '';
|
|
103
|
+
labelId = '';
|
|
104
|
+
descriptorId = '';
|
|
69
105
|
|
|
70
106
|
static defaultProps: PickOptional<ModalProps> = {
|
|
107
|
+
className: '',
|
|
71
108
|
isOpen: false,
|
|
109
|
+
title: '',
|
|
110
|
+
titleIconVariant: null,
|
|
111
|
+
titleLabel: '',
|
|
112
|
+
'aria-label': '',
|
|
113
|
+
showClose: true,
|
|
114
|
+
'aria-describedby': '',
|
|
115
|
+
'aria-labelledby': '',
|
|
116
|
+
id: undefined,
|
|
117
|
+
actions: [] as any[],
|
|
118
|
+
onClose: () => undefined as any,
|
|
72
119
|
variant: 'default',
|
|
120
|
+
hasNoBodyWrapper: false,
|
|
73
121
|
appendTo: () => document.body,
|
|
74
122
|
ouiaSafe: true,
|
|
75
123
|
position: 'default'
|
|
@@ -78,7 +126,11 @@ class Modal extends React.Component<ModalProps, ModalState> {
|
|
|
78
126
|
constructor(props: ModalProps) {
|
|
79
127
|
super(props);
|
|
80
128
|
const boxIdNum = Modal.currentId++;
|
|
129
|
+
const labelIdNum = boxIdNum + 1;
|
|
130
|
+
const descriptorIdNum = boxIdNum + 2;
|
|
81
131
|
this.boxId = props.id || `pf-modal-part-${boxIdNum}`;
|
|
132
|
+
this.labelId = `pf-modal-part-${labelIdNum}`;
|
|
133
|
+
this.descriptorId = `pf-modal-part-${descriptorIdNum}`;
|
|
82
134
|
|
|
83
135
|
this.state = {
|
|
84
136
|
container: undefined,
|
|
@@ -116,9 +168,11 @@ class Modal extends React.Component<ModalProps, ModalState> {
|
|
|
116
168
|
componentDidMount() {
|
|
117
169
|
const {
|
|
118
170
|
appendTo,
|
|
119
|
-
|
|
171
|
+
title,
|
|
120
172
|
'aria-label': ariaLabel,
|
|
121
|
-
'aria-labelledby': ariaLabelledby
|
|
173
|
+
'aria-labelledby': ariaLabelledby,
|
|
174
|
+
hasNoBodyWrapper,
|
|
175
|
+
header
|
|
122
176
|
} = this.props;
|
|
123
177
|
const target: HTMLElement = this.getElement(appendTo);
|
|
124
178
|
const container = document.createElement('div');
|
|
@@ -132,9 +186,16 @@ class Modal extends React.Component<ModalProps, ModalState> {
|
|
|
132
186
|
target.classList.remove(css(styles.backdropOpen));
|
|
133
187
|
}
|
|
134
188
|
|
|
135
|
-
if (
|
|
189
|
+
if (this.isEmpty(title) && this.isEmpty(ariaLabel) && this.isEmpty(ariaLabelledby)) {
|
|
136
190
|
// eslint-disable-next-line no-console
|
|
137
|
-
console.error('Modal: Specify at least one of:
|
|
191
|
+
console.error('Modal: Specify at least one of: title, aria-label, aria-labelledby.');
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (this.isEmpty(ariaLabel) && this.isEmpty(ariaLabelledby) && (hasNoBodyWrapper || header)) {
|
|
195
|
+
// eslint-disable-next-line no-console
|
|
196
|
+
console.error(
|
|
197
|
+
'Modal: When using hasNoBodyWrapper or setting a custom header, ensure you assign an accessible name to the the modal container with aria-label or aria-labelledby.'
|
|
198
|
+
);
|
|
138
199
|
}
|
|
139
200
|
}
|
|
140
201
|
|
|
@@ -170,6 +231,11 @@ class Modal extends React.Component<ModalProps, ModalState> {
|
|
|
170
231
|
'aria-labelledby': ariaLabelledby,
|
|
171
232
|
'aria-label': ariaLabel,
|
|
172
233
|
'aria-describedby': ariaDescribedby,
|
|
234
|
+
bodyAriaLabel,
|
|
235
|
+
bodyAriaRole,
|
|
236
|
+
title,
|
|
237
|
+
titleIconVariant,
|
|
238
|
+
titleLabel,
|
|
173
239
|
ouiaId,
|
|
174
240
|
ouiaSafe,
|
|
175
241
|
position,
|
|
@@ -184,15 +250,22 @@ class Modal extends React.Component<ModalProps, ModalState> {
|
|
|
184
250
|
|
|
185
251
|
return ReactDOM.createPortal(
|
|
186
252
|
<ModalContent
|
|
253
|
+
{...props}
|
|
187
254
|
boxId={this.boxId}
|
|
255
|
+
labelId={this.labelId}
|
|
256
|
+
descriptorId={this.descriptorId}
|
|
257
|
+
title={title}
|
|
258
|
+
titleIconVariant={titleIconVariant}
|
|
259
|
+
titleLabel={titleLabel}
|
|
188
260
|
aria-label={ariaLabel}
|
|
189
261
|
aria-describedby={ariaDescribedby}
|
|
190
262
|
aria-labelledby={ariaLabelledby}
|
|
263
|
+
bodyAriaLabel={bodyAriaLabel}
|
|
264
|
+
bodyAriaRole={bodyAriaRole}
|
|
191
265
|
ouiaId={ouiaId !== undefined ? ouiaId : this.state.ouiaStateId}
|
|
192
266
|
ouiaSafe={ouiaSafe}
|
|
193
267
|
position={position}
|
|
194
268
|
elementToFocus={elementToFocus}
|
|
195
|
-
{...props}
|
|
196
269
|
/>,
|
|
197
270
|
container
|
|
198
271
|
) as React.ReactElement;
|
|
@@ -4,9 +4,9 @@ import styles from '@patternfly/react-styles/css/components/ModalBox/modal-box';
|
|
|
4
4
|
import topSpacer from '@patternfly/react-tokens/dist/esm/c_modal_box_m_align_top_spacer';
|
|
5
5
|
|
|
6
6
|
export interface ModalBoxProps extends React.HTMLProps<HTMLDivElement> {
|
|
7
|
-
/** Id to use for the modal box description.
|
|
8
|
-
'aria-describedby'
|
|
9
|
-
/**
|
|
7
|
+
/** Id to use for the modal box description. */
|
|
8
|
+
'aria-describedby': string;
|
|
9
|
+
/** Accessible descriptor of the modal. */
|
|
10
10
|
'aria-label'?: string;
|
|
11
11
|
/** Id to use for the modal box label. */
|
|
12
12
|
'aria-labelledby'?: string;
|
|
@@ -24,12 +24,12 @@ export interface ModalBoxProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
24
24
|
|
|
25
25
|
export const ModalBox: React.FunctionComponent<ModalBoxProps> = ({
|
|
26
26
|
children,
|
|
27
|
-
className,
|
|
27
|
+
className = '',
|
|
28
28
|
variant = 'default',
|
|
29
29
|
position,
|
|
30
30
|
positionOffset,
|
|
31
31
|
'aria-labelledby': ariaLabelledby,
|
|
32
|
-
'aria-label': ariaLabel,
|
|
32
|
+
'aria-label': ariaLabel = '',
|
|
33
33
|
'aria-describedby': ariaDescribedby,
|
|
34
34
|
style,
|
|
35
35
|
...props
|
|
@@ -40,6 +40,7 @@ export const ModalBox: React.FunctionComponent<ModalBoxProps> = ({
|
|
|
40
40
|
}
|
|
41
41
|
return (
|
|
42
42
|
<div
|
|
43
|
+
{...props}
|
|
43
44
|
role="dialog"
|
|
44
45
|
aria-label={ariaLabel || null}
|
|
45
46
|
aria-labelledby={ariaLabelledby || null}
|
|
@@ -54,7 +55,6 @@ export const ModalBox: React.FunctionComponent<ModalBoxProps> = ({
|
|
|
54
55
|
variant === 'medium' && styles.modifiers.md
|
|
55
56
|
)}
|
|
56
57
|
style={style}
|
|
57
|
-
{...props}
|
|
58
58
|
>
|
|
59
59
|
{children}
|
|
60
60
|
</div>
|
|
@@ -18,7 +18,7 @@ export interface ModalBoxCloseButtonProps extends OUIAProps {
|
|
|
18
18
|
|
|
19
19
|
export const ModalBoxCloseButton: React.FunctionComponent<ModalBoxCloseButtonProps> = ({
|
|
20
20
|
className,
|
|
21
|
-
onClose,
|
|
21
|
+
onClose = () => undefined as any,
|
|
22
22
|
'aria-label': ariaLabel = 'Close',
|
|
23
23
|
ouiaId,
|
|
24
24
|
...props
|
|
@@ -17,29 +17,27 @@ export interface ModalBoxTitleProps {
|
|
|
17
17
|
/** Additional classes added to the modal box title. */
|
|
18
18
|
className?: string;
|
|
19
19
|
/** Id of the modal box title. */
|
|
20
|
-
id
|
|
20
|
+
id: string;
|
|
21
21
|
/** Content rendered inside the modal box title. */
|
|
22
22
|
title: React.ReactNode;
|
|
23
23
|
/** Optional alert icon (or other) to show before the title. When the predefined alert types
|
|
24
24
|
* are used the default styling will be automatically applied. */
|
|
25
25
|
titleIconVariant?: 'success' | 'danger' | 'warning' | 'info' | 'custom' | React.ComponentType<any>;
|
|
26
26
|
/** Optional title label text for screen readers. */
|
|
27
|
-
|
|
27
|
+
titleLabel?: string;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export const ModalBoxTitle: React.FunctionComponent<ModalBoxTitleProps> = ({
|
|
31
|
-
className,
|
|
31
|
+
className = '',
|
|
32
32
|
id,
|
|
33
33
|
title,
|
|
34
34
|
titleIconVariant,
|
|
35
|
-
|
|
35
|
+
titleLabel = '',
|
|
36
36
|
...props
|
|
37
37
|
}: ModalBoxTitleProps) => {
|
|
38
38
|
const [hasTooltip, setHasTooltip] = React.useState(false);
|
|
39
39
|
const h1 = React.useRef<HTMLHeadingElement>(null);
|
|
40
|
-
const label =
|
|
41
|
-
titleScreenReaderText ||
|
|
42
|
-
(isVariantIcon(titleIconVariant) ? `${capitalize(titleIconVariant)} alert:` : titleScreenReaderText);
|
|
40
|
+
const label = titleLabel || (isVariantIcon(titleIconVariant) ? `${capitalize(titleIconVariant)} alert:` : titleLabel);
|
|
43
41
|
const variantIcons = {
|
|
44
42
|
success: <CheckCircleIcon />,
|
|
45
43
|
danger: <ExclamationCircleIcon />,
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { FocusTrap } from '../../../helpers';
|
|
3
|
+
import modalStyles from '@patternfly/react-styles/css/components/ModalBox/modal-box';
|
|
4
|
+
import bullsEyeStyles from '@patternfly/react-styles/css/layouts/Bullseye/bullseye';
|
|
5
|
+
import { css } from '@patternfly/react-styles';
|
|
6
|
+
import { getOUIAProps, OUIAProps } from '../../../helpers';
|
|
7
|
+
|
|
8
|
+
import { Backdrop } from '../../../components/Backdrop/Backdrop';
|
|
9
|
+
import { ModalBoxBody } from './ModalBoxBody';
|
|
10
|
+
import { ModalBoxCloseButton } from './ModalBoxCloseButton';
|
|
11
|
+
import { ModalBox } from './ModalBox';
|
|
12
|
+
import { ModalBoxFooter } from './ModalBoxFooter';
|
|
13
|
+
import { ModalBoxDescription } from './ModalBoxDescription';
|
|
14
|
+
import { ModalBoxHeader } from './ModalBoxHeader';
|
|
15
|
+
import { ModalBoxTitle, isVariantIcon } from './ModalBoxTitle';
|
|
16
|
+
|
|
17
|
+
export interface ModalContentProps extends OUIAProps {
|
|
18
|
+
/** Action buttons to add to the standard modal footer. Ignored if the footer property
|
|
19
|
+
* is passed in.
|
|
20
|
+
*/
|
|
21
|
+
actions?: any;
|
|
22
|
+
/** Id to use for the modal box descriptor. */
|
|
23
|
+
'aria-describedby'?: string;
|
|
24
|
+
/** Accessible descriptor of the modal. */
|
|
25
|
+
'aria-label'?: string;
|
|
26
|
+
/** Id to use for the modal box label. */
|
|
27
|
+
'aria-labelledby'?: string | null;
|
|
28
|
+
/** Accessible label applied to the modal box body. This should be used to communicate
|
|
29
|
+
* important information about the modal box body div element if needed, such as that it
|
|
30
|
+
* is scrollable.
|
|
31
|
+
*/
|
|
32
|
+
bodyAriaLabel?: string;
|
|
33
|
+
/** Accessible role applied to the modal box body. This will default to "region" if the
|
|
34
|
+
* bodyAriaLabel property is passed in. Set to a more appropriate role as applicable
|
|
35
|
+
* based on the modal content and context.
|
|
36
|
+
*/
|
|
37
|
+
bodyAriaRole?: string;
|
|
38
|
+
/** Id of the modal box container. */
|
|
39
|
+
boxId: string;
|
|
40
|
+
/** Content rendered inside the modal. */
|
|
41
|
+
children: React.ReactNode;
|
|
42
|
+
/** Additional classes added to the modal box. */
|
|
43
|
+
className?: string;
|
|
44
|
+
/** Description of the modal. */
|
|
45
|
+
description?: React.ReactNode;
|
|
46
|
+
/** Id of the modal box description. */
|
|
47
|
+
descriptorId: string;
|
|
48
|
+
/** Flag to disable focus trap. */
|
|
49
|
+
disableFocusTrap?: boolean;
|
|
50
|
+
/** The element to focus when the modal opens. By default the first
|
|
51
|
+
* focusable element will receive focus.
|
|
52
|
+
*/
|
|
53
|
+
elementToFocus?: HTMLElement | SVGElement | string;
|
|
54
|
+
/** Custom footer. */
|
|
55
|
+
footer?: React.ReactNode;
|
|
56
|
+
/** Flag indicating if modal content should be placed in a modal box body wrapper. */
|
|
57
|
+
hasNoBodyWrapper?: boolean;
|
|
58
|
+
/** Complex header (more than just text), supersedes the title property for header content. */
|
|
59
|
+
header?: React.ReactNode;
|
|
60
|
+
/** Optional help section for the modal header. */
|
|
61
|
+
help?: React.ReactNode;
|
|
62
|
+
/** Flag to show the modal. */
|
|
63
|
+
isOpen?: boolean;
|
|
64
|
+
/** Id of the modal box title. */
|
|
65
|
+
labelId: string;
|
|
66
|
+
/** A callback for when the close button is clicked. */
|
|
67
|
+
onClose?: (event: KeyboardEvent | React.MouseEvent) => void;
|
|
68
|
+
/** Position of the modal. By default a modal will be positioned vertically and horizontally centered. */
|
|
69
|
+
position?: 'default' | 'top';
|
|
70
|
+
/** Offset from alternate position. Can be any valid CSS length/percentage. */
|
|
71
|
+
positionOffset?: string;
|
|
72
|
+
/** Flag to show the close button in the header area of the modal. */
|
|
73
|
+
showClose?: boolean;
|
|
74
|
+
/** Simple text content of the modal header. Also used for the aria-label on the body. */
|
|
75
|
+
title?: string;
|
|
76
|
+
/** Optional alert icon (or other) to show before the title of the modal header. When the
|
|
77
|
+
* predefined alert types are used the default styling will be automatically applied.
|
|
78
|
+
*/
|
|
79
|
+
titleIconVariant?: 'success' | 'danger' | 'warning' | 'info' | 'custom' | React.ComponentType<any>;
|
|
80
|
+
/** Optional title label text for screen readers. */
|
|
81
|
+
titleLabel?: string;
|
|
82
|
+
/** Variant of the modal. */
|
|
83
|
+
variant?: 'small' | 'medium' | 'large' | 'default';
|
|
84
|
+
/** Default width of the modal. */
|
|
85
|
+
width?: number | string;
|
|
86
|
+
/** Maximum width of the modal. */
|
|
87
|
+
maxWidth?: number | string;
|
|
88
|
+
/** Value to overwrite the randomly generated data-ouia-component-id.*/
|
|
89
|
+
ouiaId?: number | string;
|
|
90
|
+
/** Set the value of data-ouia-safe. Only set to true when the component is in a static state, i.e. no animations are occurring. At all other times, this value must be false. */
|
|
91
|
+
ouiaSafe?: boolean;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export const ModalContent: React.FunctionComponent<ModalContentProps> = ({
|
|
95
|
+
children,
|
|
96
|
+
className = '',
|
|
97
|
+
isOpen = false,
|
|
98
|
+
header = null,
|
|
99
|
+
help = null,
|
|
100
|
+
description = null,
|
|
101
|
+
title = '',
|
|
102
|
+
titleIconVariant = null,
|
|
103
|
+
titleLabel = '',
|
|
104
|
+
'aria-label': ariaLabel = '',
|
|
105
|
+
'aria-describedby': ariaDescribedby,
|
|
106
|
+
'aria-labelledby': ariaLabelledby,
|
|
107
|
+
bodyAriaLabel,
|
|
108
|
+
bodyAriaRole,
|
|
109
|
+
showClose = true,
|
|
110
|
+
footer = null,
|
|
111
|
+
actions = [],
|
|
112
|
+
onClose = () => undefined as any,
|
|
113
|
+
variant = 'default',
|
|
114
|
+
position,
|
|
115
|
+
positionOffset,
|
|
116
|
+
width,
|
|
117
|
+
maxWidth,
|
|
118
|
+
boxId,
|
|
119
|
+
labelId,
|
|
120
|
+
descriptorId,
|
|
121
|
+
disableFocusTrap = false,
|
|
122
|
+
hasNoBodyWrapper = false,
|
|
123
|
+
ouiaId,
|
|
124
|
+
ouiaSafe = true,
|
|
125
|
+
elementToFocus,
|
|
126
|
+
...props
|
|
127
|
+
}: ModalContentProps) => {
|
|
128
|
+
if (!isOpen) {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const modalBoxHeader = header ? (
|
|
133
|
+
<ModalBoxHeader help={help}>{header}</ModalBoxHeader>
|
|
134
|
+
) : (
|
|
135
|
+
title && (
|
|
136
|
+
<ModalBoxHeader help={help}>
|
|
137
|
+
<ModalBoxTitle title={title} titleIconVariant={titleIconVariant} titleLabel={titleLabel} id={labelId} />
|
|
138
|
+
{description && <ModalBoxDescription id={descriptorId}>{description}</ModalBoxDescription>}
|
|
139
|
+
</ModalBoxHeader>
|
|
140
|
+
)
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
const modalBoxFooter = footer ? (
|
|
144
|
+
<ModalBoxFooter>{footer}</ModalBoxFooter>
|
|
145
|
+
) : (
|
|
146
|
+
actions.length > 0 && <ModalBoxFooter>{actions}</ModalBoxFooter>
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
const defaultModalBodyAriaRole = bodyAriaLabel ? 'region' : undefined;
|
|
150
|
+
|
|
151
|
+
const hasNoDescription = !description && !ariaDescribedby;
|
|
152
|
+
const id = hasNoDescription ? descriptorId : undefined;
|
|
153
|
+
|
|
154
|
+
const modalBody = hasNoBodyWrapper ? (
|
|
155
|
+
children
|
|
156
|
+
) : (
|
|
157
|
+
<ModalBoxBody aria-label={bodyAriaLabel} role={bodyAriaRole || defaultModalBodyAriaRole} {...props} id={id}>
|
|
158
|
+
{children}
|
|
159
|
+
</ModalBoxBody>
|
|
160
|
+
);
|
|
161
|
+
const ariaLabelledbyFormatted = (): null | string => {
|
|
162
|
+
if (ariaLabelledby === null) {
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
const idRefList: string[] = [];
|
|
166
|
+
if ((ariaLabel && boxId) !== '') {
|
|
167
|
+
idRefList.push(ariaLabel && boxId);
|
|
168
|
+
}
|
|
169
|
+
if (ariaLabelledby) {
|
|
170
|
+
idRefList.push(ariaLabelledby);
|
|
171
|
+
}
|
|
172
|
+
if (title) {
|
|
173
|
+
idRefList.push(labelId);
|
|
174
|
+
}
|
|
175
|
+
return idRefList.join(' ');
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
const modalBox = (
|
|
179
|
+
<ModalBox
|
|
180
|
+
id={boxId}
|
|
181
|
+
className={css(className, isVariantIcon(titleIconVariant) && modalStyles.modifiers[titleIconVariant])}
|
|
182
|
+
variant={variant}
|
|
183
|
+
position={position}
|
|
184
|
+
positionOffset={positionOffset}
|
|
185
|
+
aria-label={ariaLabel}
|
|
186
|
+
aria-labelledby={ariaLabelledbyFormatted()}
|
|
187
|
+
aria-describedby={ariaDescribedby || (hasNoBodyWrapper ? null : descriptorId)}
|
|
188
|
+
{...getOUIAProps(ModalContent.displayName, ouiaId, ouiaSafe)}
|
|
189
|
+
style={
|
|
190
|
+
{
|
|
191
|
+
...(width && { '--pf-v6-c-modal-box--Width': typeof width !== 'number' ? width : `${width}px` }),
|
|
192
|
+
...(maxWidth && {
|
|
193
|
+
'--pf-v6-c-modal-box--MaxWidth': typeof maxWidth !== 'number' ? maxWidth : `${maxWidth}px`
|
|
194
|
+
})
|
|
195
|
+
} as React.CSSProperties
|
|
196
|
+
}
|
|
197
|
+
>
|
|
198
|
+
{showClose && <ModalBoxCloseButton onClose={(event) => onClose(event)} ouiaId={ouiaId} />}
|
|
199
|
+
{modalBoxHeader}
|
|
200
|
+
{modalBody}
|
|
201
|
+
{modalBoxFooter}
|
|
202
|
+
</ModalBox>
|
|
203
|
+
);
|
|
204
|
+
return (
|
|
205
|
+
<Backdrop>
|
|
206
|
+
<FocusTrap
|
|
207
|
+
active={!disableFocusTrap}
|
|
208
|
+
focusTrapOptions={{
|
|
209
|
+
clickOutsideDeactivates: true,
|
|
210
|
+
tabbableOptions: { displayCheck: 'none' },
|
|
211
|
+
// FocusTrap's initialFocus can accept false as a value to prevent initial focus.
|
|
212
|
+
// We want to prevent this in case false is ever passed in.
|
|
213
|
+
initialFocus: elementToFocus || undefined
|
|
214
|
+
}}
|
|
215
|
+
className={css(bullsEyeStyles.bullseye)}
|
|
216
|
+
>
|
|
217
|
+
{modalBox}
|
|
218
|
+
</FocusTrap>
|
|
219
|
+
</Backdrop>
|
|
220
|
+
);
|
|
221
|
+
};
|
|
222
|
+
ModalContent.displayName = 'ModalContent';
|
|
@@ -13,6 +13,7 @@ jest.spyOn(document, 'createElement');
|
|
|
13
13
|
jest.spyOn(document.body, 'addEventListener');
|
|
14
14
|
|
|
15
15
|
const props = {
|
|
16
|
+
title: 'Modal',
|
|
16
17
|
onClose: jest.fn(),
|
|
17
18
|
isOpen: false,
|
|
18
19
|
children: 'modal content'
|
|
@@ -47,9 +48,9 @@ describe('Modal', () => {
|
|
|
47
48
|
test('modal closes with escape', async () => {
|
|
48
49
|
const user = userEvent.setup();
|
|
49
50
|
|
|
50
|
-
render(<Modal {...props} isOpen appendTo={document.body}
|
|
51
|
+
render(<Modal {...props} isOpen appendTo={document.body} />);
|
|
51
52
|
|
|
52
|
-
await user.type(screen.
|
|
53
|
+
await user.type(screen.getByText(props.title), `{${KeyTypes.Escape}}`);
|
|
53
54
|
expect(props.onClose).toHaveBeenCalled();
|
|
54
55
|
});
|
|
55
56
|
|
|
@@ -69,17 +70,13 @@ describe('Modal', () => {
|
|
|
69
70
|
expect(document.body).not.toHaveClass(css(styles.backdropOpen));
|
|
70
71
|
});
|
|
71
72
|
|
|
72
|
-
test('modal shows the close button when
|
|
73
|
+
test('modal shows the close button when showClose is true (true by default)', () => {
|
|
73
74
|
render(<Modal {...props} isOpen />);
|
|
74
75
|
expect(screen.getByRole('button', { name: 'Close' })).toBeInTheDocument();
|
|
75
76
|
});
|
|
76
77
|
|
|
77
|
-
test('modal does not show the close button when
|
|
78
|
-
render(
|
|
79
|
-
<Modal isOpen disableFocusTrap>
|
|
80
|
-
No close button{' '}
|
|
81
|
-
</Modal>
|
|
82
|
-
);
|
|
78
|
+
test('modal does not show the close button when showClose is false', () => {
|
|
79
|
+
render(<Modal {...props} isOpen showClose={false} tabIndex={0} />);
|
|
83
80
|
expect(screen.queryByRole('button', { name: 'Close' })).toBeNull();
|
|
84
81
|
});
|
|
85
82
|
|
|
@@ -97,6 +94,21 @@ describe('Modal', () => {
|
|
|
97
94
|
expect(consoleErrorMock).toHaveBeenCalled();
|
|
98
95
|
});
|
|
99
96
|
|
|
97
|
+
test('modal generates console warning when conflicting accessible name strategies are provided', () => {
|
|
98
|
+
const props = {
|
|
99
|
+
hasNoBodyWrapper: true,
|
|
100
|
+
onClose: jest.fn(),
|
|
101
|
+
isOpen: true,
|
|
102
|
+
children: 'modal content'
|
|
103
|
+
};
|
|
104
|
+
const consoleErrorMock = jest.fn();
|
|
105
|
+
global.console = { error: consoleErrorMock } as any;
|
|
106
|
+
|
|
107
|
+
render(<Modal {...props} />);
|
|
108
|
+
|
|
109
|
+
expect(consoleErrorMock).toHaveBeenCalled();
|
|
110
|
+
});
|
|
111
|
+
|
|
100
112
|
test('modal adds aria-hidden attribute to its siblings when open', () => {
|
|
101
113
|
render(<ModalWithSiblings />, { container: document.body.appendChild(target) });
|
|
102
114
|
|
|
@@ -142,4 +154,59 @@ describe('Modal', () => {
|
|
|
142
154
|
expect(asideSibling).not.toHaveAttribute('aria-hidden');
|
|
143
155
|
expect(articleSibling).not.toHaveAttribute('aria-hidden');
|
|
144
156
|
});
|
|
157
|
+
test('The modalBoxBody has no aria-label when bodyAriaLabel is not passed', () => {
|
|
158
|
+
const props = {
|
|
159
|
+
isOpen: true
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
render(<Modal {...props}>This is a ModalBox</Modal>);
|
|
163
|
+
|
|
164
|
+
const modalBoxBody = screen.getByText('This is a ModalBox');
|
|
165
|
+
expect(modalBoxBody).not.toHaveAccessibleName('modal box body aria label');
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
test('The modalBoxBody has the expected aria-label when bodyAriaLabel is passed', () => {
|
|
169
|
+
const props = {
|
|
170
|
+
isOpen: true
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
render(
|
|
174
|
+
<Modal bodyAriaLabel="modal box body aria label" {...props}>
|
|
175
|
+
This is a ModalBox
|
|
176
|
+
</Modal>
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
const modalBoxBody = screen.getByText('This is a ModalBox');
|
|
180
|
+
expect(modalBoxBody).toHaveAccessibleName('modal box body aria label');
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
test('The modalBoxBody has the expected aria role when bodyAriaLabel is passed and bodyAriaRole is not', () => {
|
|
184
|
+
const props = {
|
|
185
|
+
isOpen: true
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
render(
|
|
189
|
+
<Modal bodyAriaLabel="modal box body aria label" {...props}>
|
|
190
|
+
This is a ModalBox
|
|
191
|
+
</Modal>
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
const modalBoxBody = screen.getByRole('region', { name: 'modal box body aria label' });
|
|
195
|
+
expect(modalBoxBody).toBeInTheDocument();
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
test('The modalBoxBody has the expected aria role when bodyAriaRole is passed', () => {
|
|
199
|
+
const props = {
|
|
200
|
+
isOpen: true
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
render(
|
|
204
|
+
<Modal bodyAriaLabel="modal box body aria label" bodyAriaRole="article" {...props}>
|
|
205
|
+
This is a ModalBox
|
|
206
|
+
</Modal>
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
const modalBoxBody = screen.getByRole('article', { name: 'modal box body aria label' });
|
|
210
|
+
expect(modalBoxBody).toBeInTheDocument();
|
|
211
|
+
});
|
|
145
212
|
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
|
|
4
|
+
import { ModalBoxHeader } from '../ModalBoxHeader';
|
|
5
|
+
|
|
6
|
+
test('ModalBoxHeader Test', () => {
|
|
7
|
+
const { asFragment } = render(<ModalBoxHeader>This is a ModalBox header</ModalBoxHeader>);
|
|
8
|
+
expect(asFragment()).toMatchSnapshot();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test('ModalBoxHeader help renders', () => {
|
|
12
|
+
const { asFragment } = render(<ModalBoxHeader help={<div>test</div>}>This is a ModalBox header</ModalBoxHeader>);
|
|
13
|
+
expect(asFragment()).toMatchSnapshot();
|
|
14
|
+
});
|