@patternfly/react-core 5.3.0-prerelease.9 → 5.3.1
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 +107 -0
- package/README.md +2 -1
- 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/DualListSelector/package.json +1 -1
- package/dist/dynamic/next/components/Modal/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 +772 -0
- package/dist/esm/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
- package/dist/esm/components/CalendarMonth/CalendarMonth.js +30 -12
- package/dist/esm/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/dist/esm/components/Card/Card.d.ts +13 -5
- package/dist/esm/components/Card/Card.d.ts.map +1 -1
- package/dist/esm/components/Card/Card.js +7 -3
- package/dist/esm/components/Card/Card.js.map +1 -1
- package/dist/esm/components/Card/CardHeader.d.ts +3 -1
- package/dist/esm/components/Card/CardHeader.d.ts.map +1 -1
- package/dist/esm/components/Card/CardHeader.js +10 -10
- package/dist/esm/components/Card/CardHeader.js.map +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopy.d.ts +2 -2
- package/dist/esm/components/ClipboardCopy/ClipboardCopy.d.ts.map +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopy.js +10 -2
- package/dist/esm/components/ClipboardCopy/ClipboardCopy.js.map +1 -1
- package/dist/esm/components/Dropdown/Dropdown.d.ts +4 -0
- package/dist/esm/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/esm/components/Dropdown/Dropdown.js +4 -3
- package/dist/esm/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/esm/components/Label/Label.d.ts +2 -0
- package/dist/esm/components/Label/Label.d.ts.map +1 -1
- package/dist/esm/components/Label/Label.js +9 -8
- package/dist/esm/components/Label/Label.js.map +1 -1
- package/dist/esm/components/MenuToggle/MenuToggle.d.ts +9 -0
- package/dist/esm/components/MenuToggle/MenuToggle.d.ts.map +1 -1
- package/dist/esm/components/MenuToggle/MenuToggle.js +29 -3
- package/dist/esm/components/MenuToggle/MenuToggle.js.map +1 -1
- package/dist/esm/components/MenuToggle/MenuToggleCheckbox.js +2 -2
- package/dist/esm/components/MenuToggle/MenuToggleCheckbox.js.map +1 -1
- package/dist/esm/components/TextArea/TextArea.d.ts +0 -4
- package/dist/esm/components/TextArea/TextArea.d.ts.map +1 -1
- package/dist/esm/components/TextArea/TextArea.js.map +1 -1
- package/dist/esm/helpers/GenerateId/GenerateId.d.ts +5 -1
- package/dist/esm/helpers/GenerateId/GenerateId.d.ts.map +1 -1
- package/dist/esm/helpers/GenerateId/GenerateId.js +14 -2
- package/dist/esm/helpers/GenerateId/GenerateId.js.map +1 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.js +30 -12
- package/dist/js/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/dist/js/components/Card/Card.d.ts +13 -5
- package/dist/js/components/Card/Card.d.ts.map +1 -1
- package/dist/js/components/Card/Card.js +7 -3
- package/dist/js/components/Card/Card.js.map +1 -1
- package/dist/js/components/Card/CardHeader.d.ts +3 -1
- package/dist/js/components/Card/CardHeader.d.ts.map +1 -1
- package/dist/js/components/Card/CardHeader.js +10 -10
- package/dist/js/components/Card/CardHeader.js.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopy.d.ts +2 -2
- package/dist/js/components/ClipboardCopy/ClipboardCopy.d.ts.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopy.js +10 -2
- package/dist/js/components/ClipboardCopy/ClipboardCopy.js.map +1 -1
- package/dist/js/components/Dropdown/Dropdown.d.ts +4 -0
- package/dist/js/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/js/components/Dropdown/Dropdown.js +4 -3
- package/dist/js/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/js/components/Label/Label.d.ts +2 -0
- package/dist/js/components/Label/Label.d.ts.map +1 -1
- package/dist/js/components/Label/Label.js +9 -8
- package/dist/js/components/Label/Label.js.map +1 -1
- package/dist/js/components/MenuToggle/MenuToggle.d.ts +9 -0
- package/dist/js/components/MenuToggle/MenuToggle.d.ts.map +1 -1
- package/dist/js/components/MenuToggle/MenuToggle.js +30 -4
- package/dist/js/components/MenuToggle/MenuToggle.js.map +1 -1
- package/dist/js/components/MenuToggle/MenuToggleCheckbox.js +2 -2
- package/dist/js/components/MenuToggle/MenuToggleCheckbox.js.map +1 -1
- package/dist/js/components/TextArea/TextArea.d.ts +0 -4
- package/dist/js/components/TextArea/TextArea.d.ts.map +1 -1
- package/dist/js/components/TextArea/TextArea.js.map +1 -1
- package/dist/js/helpers/GenerateId/GenerateId.d.ts +5 -1
- package/dist/js/helpers/GenerateId/GenerateId.d.ts.map +1 -1
- package/dist/js/helpers/GenerateId/GenerateId.js +14 -2
- package/dist/js/helpers/GenerateId/GenerateId.js.map +1 -1
- package/dist/umd/react-core.min.js +1 -1
- 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/CalendarMonth/CalendarMonth.tsx +38 -13
- package/src/components/Card/Card.tsx +24 -7
- package/src/components/Card/CardHeader.tsx +11 -10
- package/src/components/Card/examples/Card.md +11 -9
- package/src/components/Card/examples/CardClickableSelectable.tsx +11 -8
- package/src/components/Card/examples/CardSelectable.tsx +3 -6
- package/src/components/Card/examples/CardSingleSelectable.tsx +14 -6
- package/src/components/Chip/__tests__/ChipGroup.test.tsx +3 -1
- package/src/components/ClipboardCopy/ClipboardCopy.tsx +17 -3
- package/src/components/ClipboardCopy/__tests__/ClipboardCopy.test.tsx +2 -0
- package/src/components/ClipboardCopy/__tests__/__snapshots__/ClipboardCopy.test.tsx.snap +1 -1
- package/src/components/DragDrop/examples/DragDrop.md +1 -0
- package/src/components/Drawer/__tests__/Drawer.test.tsx +2 -0
- package/src/components/Drawer/__tests__/DrawerPanelContent.test.tsx +2 -0
- package/src/components/Drawer/__tests__/Generated/DrawerPanelContent.test.tsx +2 -0
- package/src/components/Drawer/__tests__/Generated/__snapshots__/DrawerPanelContent.test.tsx.snap +1 -1
- package/src/components/Drawer/__tests__/__snapshots__/Drawer.test.tsx.snap +8 -8
- package/src/components/Dropdown/Dropdown.tsx +12 -2
- package/src/components/Form/__tests__/FormFieldGroup.test.tsx +2 -0
- package/src/components/Form/__tests__/FormSection.test.tsx +2 -0
- package/src/components/Form/__tests__/__snapshots__/FormFieldGroup.test.tsx.snap +2 -2
- package/src/components/Form/__tests__/__snapshots__/FormSection.test.tsx.snap +2 -2
- package/src/components/Label/Label.tsx +16 -5
- package/src/components/Label/__tests__/LabelGroup.test.tsx +2 -0
- package/src/components/Label/__tests__/__snapshots__/LabelGroup.test.tsx.snap +8 -8
- package/src/components/Label/examples/LabelCompact.tsx +19 -1
- package/src/components/Label/examples/LabelFilled.tsx +106 -16
- package/src/components/Label/examples/LabelOutline.tsx +168 -16
- package/src/components/MenuToggle/MenuToggle.tsx +35 -0
- package/src/components/MenuToggle/MenuToggleCheckbox.tsx +2 -2
- package/src/components/MenuToggle/__tests__/MenuToggle.test.tsx +15 -0
- package/src/components/MenuToggle/examples/MenuToggle.md +39 -14
- package/src/components/MenuToggle/examples/MenuToggleSplitButtonCheckboxWithToggleText.tsx +51 -0
- package/src/components/MenuToggle/examples/MenuToggleStatus.tsx +20 -0
- package/src/components/MultipleFileUpload/__tests__/MultipleFileUpload.test.tsx +2 -0
- package/src/components/MultipleFileUpload/__tests__/MultipleFileUploadStatus.test.tsx +2 -0
- package/src/components/MultipleFileUpload/__tests__/__snapshots__/MultipleFileUploadStatus.test.tsx.snap +16 -16
- package/src/components/SearchInput/__tests__/SearchInput.test.tsx +1 -0
- package/src/components/SearchInput/__tests__/__snapshots__/SearchInput.test.tsx.snap +2 -2
- package/src/components/Select/examples/Select.md +30 -11
- package/src/components/Select/examples/SelectMultiTypeaheadCheckbox.tsx +6 -1
- package/src/components/Select/examples/SelectValidated.tsx +74 -0
- package/src/components/Tabs/__tests__/Tabs.test.tsx +2 -0
- package/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap +3 -3
- package/src/components/TextArea/TextArea.tsx +0 -4
- package/src/components/Toolbar/__tests__/Toolbar.test.tsx +2 -0
- package/src/components/Toolbar/__tests__/__snapshots__/Toolbar.test.tsx.snap +11 -11
- package/src/demos/AlertGroup.md +2 -0
- package/src/demos/BackToTop.md +1 -0
- package/src/demos/Banner.md +5 -4
- package/src/demos/CardView/CardView.md +2 -0
- package/src/demos/CardView/examples/CardView.tsx +1 -1
- package/src/demos/DataList/examples/DataListBasic.tsx +1 -1
- package/src/demos/DataList/examples/DataListExpandableControlInToolbar.tsx +1 -1
- package/src/demos/DataListDemo.md +1 -0
- package/src/demos/Filters/examples/FilterAttributeSearch.tsx +1 -1
- package/src/demos/Filters/examples/FilterCheckboxSelect.tsx +1 -1
- package/src/demos/Filters/examples/FilterFaceted.tsx +1 -1
- package/src/demos/Filters/examples/FilterMixedSelectGroup.tsx +1 -1
- package/src/demos/Filters/examples/FilterSameSelectGroup.tsx +1 -1
- package/src/demos/Filters/examples/FilterSearchInput.tsx +1 -1
- package/src/demos/Filters/examples/FilterSingleSelect.tsx +1 -1
- package/src/demos/JumpLinks.md +2 -1
- package/src/demos/Nav.md +2 -0
- package/src/demos/PrimaryDetail.md +1 -0
- package/src/demos/RTL/RTL.md +1 -1
- package/src/demos/RTL/examples/{PaginatedTable.jsx → PaginatedTable.tsx} +48 -22
- package/src/demos/Tabs.md +5 -2
- package/src/demos/Toolbar.md +1 -0
- package/src/demos/Wizard/WizardDemo.md +1 -0
- package/src/demos/examples/AlertGroup/AlertGroupToastWithNotificationDrawer.tsx +2 -2
- package/src/demos/examples/BackToTop/BackToTopNameDemo.tsx +1 -1
- package/src/demos/examples/Card/CardStatus.tsx +1 -1
- package/src/demos/examples/JumpLinks/JumpLinksWithDrawer.js +1 -1
- package/src/demos/examples/Nav/NavDefault.tsx +2 -2
- package/src/demos/examples/Nav/NavDrilldown.tsx +1 -1
- package/src/demos/examples/Nav/NavExpandable.tsx +2 -2
- package/src/demos/examples/Nav/NavGrouped.tsx +1 -1
- package/src/demos/examples/Nav/NavHorizontal.tsx +1 -1
- package/src/demos/examples/Nav/NavHorizontalWithSubnav.tsx +1 -1
- package/src/demos/examples/Nav/NavWithSubnav.tsx +2 -2
- package/src/demos/examples/Nav/deprecated/NavLight.tsx +1 -1
- package/src/demos/examples/Nav/deprecated/NavTertiary.tsx +2 -2
- package/src/demos/examples/PrimaryDetail/PrimaryDetailCardView.tsx +1 -1
- package/src/demos/examples/PrimaryDetail/PrimaryDetailContentPadding.tsx +1 -1
- package/src/demos/examples/PrimaryDetail/PrimaryDetailDataListInCard.tsx +1 -1
- package/src/demos/examples/PrimaryDetail/PrimaryDetailFullPage.tsx +1 -1
- package/src/demos/examples/PrimaryDetail/PrimaryDetailInlineModifier.tsx +1 -1
- package/src/demos/examples/PrimaryDetail/PrimaryDetailSimpleListInCard.tsx +1 -1
- package/src/demos/examples/Tabs/ModalTabs.tsx +1 -1
- package/src/demos/examples/Tabs/NestedTabs.tsx +1 -1
- package/src/demos/examples/Tabs/NestedUnindentedTabs.tsx +1 -1
- package/src/demos/examples/Tabs/TabsAndTable.tsx +2 -2
- package/src/demos/examples/Toolbar/ConsoleLogViewerToolbar.tsx +1 -1
- package/src/demos/examples/Wizard/InModal.tsx +1 -1
- package/src/demos/examples/Wizard/InPage.tsx +1 -1
- package/src/deprecated/components/Select/__tests__/Select.test.tsx +2 -0
- package/src/deprecated/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +25 -25
- package/src/helpers/GenerateId/GenerateId.ts +17 -3
- package/src/helpers/GenerateId/__mocks__/GenerateId.ts +11 -0
- package/src/helpers/GenerateId/__tests__/GenerateId.test.tsx +3 -1
|
@@ -24,15 +24,27 @@ export const LabelOutline: React.FunctionComponent = () => {
|
|
|
24
24
|
</Label>{' '}
|
|
25
25
|
<Label variant="outline" href="#outline" onClose={() => Function.prototype}>
|
|
26
26
|
Grey link removable
|
|
27
|
-
</Label>
|
|
27
|
+
</Label>{' '}
|
|
28
28
|
<Label variant="outline" onClick={() => logColor('grey')}>
|
|
29
29
|
Grey clickable
|
|
30
30
|
</Label>{' '}
|
|
31
31
|
<Label variant="outline" onClick={() => logColor('grey')} onClose={() => Function.prototype}>
|
|
32
32
|
Grey clickable removable
|
|
33
|
-
</Label>
|
|
33
|
+
</Label>{' '}
|
|
34
34
|
<Label variant="outline" icon={<InfoCircleIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
|
|
35
35
|
Grey label with icon that overflows
|
|
36
|
+
</Label>{' '}
|
|
37
|
+
<Label variant="outline" isDisabled icon={<InfoCircleIcon />} href="#filled" onClose={() => Function.prototype}>
|
|
38
|
+
Grey link removable (disabled)
|
|
39
|
+
</Label>{' '}
|
|
40
|
+
<Label
|
|
41
|
+
variant="outline"
|
|
42
|
+
isDisabled
|
|
43
|
+
icon={<InfoCircleIcon />}
|
|
44
|
+
onClick={() => logColor('grey')}
|
|
45
|
+
onClose={() => Function.prototype}
|
|
46
|
+
>
|
|
47
|
+
Grey clickable removable (disabled)
|
|
36
48
|
</Label>
|
|
37
49
|
<br />
|
|
38
50
|
<br />
|
|
@@ -53,13 +65,13 @@ export const LabelOutline: React.FunctionComponent = () => {
|
|
|
53
65
|
</Label>{' '}
|
|
54
66
|
<Label variant="outline" color="blue" href="#outline" onClose={() => Function.prototype}>
|
|
55
67
|
Blue link removable
|
|
56
|
-
</Label>
|
|
68
|
+
</Label>{' '}
|
|
57
69
|
<Label variant="outline" color="blue" onClick={() => logColor('blue')}>
|
|
58
70
|
Blue clickable
|
|
59
71
|
</Label>{' '}
|
|
60
72
|
<Label variant="outline" color="blue" onClick={() => logColor('blue')} onClose={() => Function.prototype}>
|
|
61
73
|
Blue clickable removable
|
|
62
|
-
</Label>
|
|
74
|
+
</Label>{' '}
|
|
63
75
|
<Label
|
|
64
76
|
variant="outline"
|
|
65
77
|
color="blue"
|
|
@@ -68,6 +80,26 @@ export const LabelOutline: React.FunctionComponent = () => {
|
|
|
68
80
|
textMaxWidth="16ch"
|
|
69
81
|
>
|
|
70
82
|
Blue label with icon that overflows
|
|
83
|
+
</Label>{' '}
|
|
84
|
+
<Label
|
|
85
|
+
variant="outline"
|
|
86
|
+
color="blue"
|
|
87
|
+
isDisabled
|
|
88
|
+
icon={<InfoCircleIcon />}
|
|
89
|
+
href="#filled"
|
|
90
|
+
onClose={() => Function.prototype}
|
|
91
|
+
>
|
|
92
|
+
Blue link removable (disabled)
|
|
93
|
+
</Label>{' '}
|
|
94
|
+
<Label
|
|
95
|
+
variant="outline"
|
|
96
|
+
color="blue"
|
|
97
|
+
isDisabled
|
|
98
|
+
icon={<InfoCircleIcon />}
|
|
99
|
+
onClick={() => logColor('blue')}
|
|
100
|
+
onClose={() => Function.prototype}
|
|
101
|
+
>
|
|
102
|
+
Blue clickable removable (disabled)
|
|
71
103
|
</Label>
|
|
72
104
|
<br />
|
|
73
105
|
<br />
|
|
@@ -88,13 +120,13 @@ export const LabelOutline: React.FunctionComponent = () => {
|
|
|
88
120
|
</Label>{' '}
|
|
89
121
|
<Label variant="outline" color="green" href="#outline" onClose={() => Function.prototype}>
|
|
90
122
|
Green link removable
|
|
91
|
-
</Label>
|
|
123
|
+
</Label>{' '}
|
|
92
124
|
<Label variant="outline" color="green" onClick={() => logColor('green')}>
|
|
93
125
|
Green clickable
|
|
94
126
|
</Label>{' '}
|
|
95
127
|
<Label variant="outline" color="green" onClick={() => logColor('green')} onClose={() => Function.prototype}>
|
|
96
128
|
Green clickable removable
|
|
97
|
-
</Label>
|
|
129
|
+
</Label>{' '}
|
|
98
130
|
<Label
|
|
99
131
|
variant="outline"
|
|
100
132
|
color="green"
|
|
@@ -103,6 +135,26 @@ export const LabelOutline: React.FunctionComponent = () => {
|
|
|
103
135
|
textMaxWidth="16ch"
|
|
104
136
|
>
|
|
105
137
|
Green label with icon that overflows
|
|
138
|
+
</Label>{' '}
|
|
139
|
+
<Label
|
|
140
|
+
variant="outline"
|
|
141
|
+
color="green"
|
|
142
|
+
isDisabled
|
|
143
|
+
icon={<InfoCircleIcon />}
|
|
144
|
+
href="#filled"
|
|
145
|
+
onClose={() => Function.prototype}
|
|
146
|
+
>
|
|
147
|
+
Green link removable (disabled)
|
|
148
|
+
</Label>{' '}
|
|
149
|
+
<Label
|
|
150
|
+
variant="outline"
|
|
151
|
+
color="green"
|
|
152
|
+
isDisabled
|
|
153
|
+
icon={<InfoCircleIcon />}
|
|
154
|
+
onClick={() => logColor('green')}
|
|
155
|
+
onClose={() => Function.prototype}
|
|
156
|
+
>
|
|
157
|
+
Green clickable removable (disabled)
|
|
106
158
|
</Label>
|
|
107
159
|
<br />
|
|
108
160
|
<br />
|
|
@@ -123,13 +175,13 @@ export const LabelOutline: React.FunctionComponent = () => {
|
|
|
123
175
|
</Label>{' '}
|
|
124
176
|
<Label variant="outline" color="orange" href="#outline" onClose={() => Function.prototype}>
|
|
125
177
|
Orange link removable
|
|
126
|
-
</Label>
|
|
178
|
+
</Label>{' '}
|
|
127
179
|
<Label variant="outline" color="orange" onClick={() => logColor('orange')}>
|
|
128
180
|
Orange clickable
|
|
129
181
|
</Label>{' '}
|
|
130
182
|
<Label variant="outline" color="orange" onClick={() => logColor('orange')} onClose={() => Function.prototype}>
|
|
131
183
|
Orange clickable removable
|
|
132
|
-
</Label>
|
|
184
|
+
</Label>{' '}
|
|
133
185
|
<Label
|
|
134
186
|
variant="outline"
|
|
135
187
|
color="orange"
|
|
@@ -138,6 +190,26 @@ export const LabelOutline: React.FunctionComponent = () => {
|
|
|
138
190
|
textMaxWidth="16ch"
|
|
139
191
|
>
|
|
140
192
|
Orange label with icon that overflows
|
|
193
|
+
</Label>{' '}
|
|
194
|
+
<Label
|
|
195
|
+
variant="outline"
|
|
196
|
+
color="orange"
|
|
197
|
+
isDisabled
|
|
198
|
+
icon={<InfoCircleIcon />}
|
|
199
|
+
href="#filled"
|
|
200
|
+
onClose={() => Function.prototype}
|
|
201
|
+
>
|
|
202
|
+
Orange link removable (disabled)
|
|
203
|
+
</Label>{' '}
|
|
204
|
+
<Label
|
|
205
|
+
variant="outline"
|
|
206
|
+
color="orange"
|
|
207
|
+
isDisabled
|
|
208
|
+
icon={<InfoCircleIcon />}
|
|
209
|
+
onClick={() => logColor('orange')}
|
|
210
|
+
onClose={() => Function.prototype}
|
|
211
|
+
>
|
|
212
|
+
Orange clickable removable (disabled)
|
|
141
213
|
</Label>
|
|
142
214
|
<br />
|
|
143
215
|
<br />
|
|
@@ -158,13 +230,13 @@ export const LabelOutline: React.FunctionComponent = () => {
|
|
|
158
230
|
</Label>{' '}
|
|
159
231
|
<Label variant="outline" color="red" href="#outline" onClose={() => Function.prototype}>
|
|
160
232
|
Red link removable
|
|
161
|
-
</Label>
|
|
233
|
+
</Label>{' '}
|
|
162
234
|
<Label variant="outline" color="red" onClick={() => logColor('red')}>
|
|
163
235
|
Red clickable
|
|
164
236
|
</Label>{' '}
|
|
165
237
|
<Label variant="outline" color="red" onClick={() => logColor('red')} onClose={() => Function.prototype}>
|
|
166
238
|
Red clickable removable
|
|
167
|
-
</Label>
|
|
239
|
+
</Label>{' '}
|
|
168
240
|
<Label
|
|
169
241
|
variant="outline"
|
|
170
242
|
color="red"
|
|
@@ -173,6 +245,26 @@ export const LabelOutline: React.FunctionComponent = () => {
|
|
|
173
245
|
textMaxWidth="16ch"
|
|
174
246
|
>
|
|
175
247
|
Red label with icon that overflows
|
|
248
|
+
</Label>{' '}
|
|
249
|
+
<Label
|
|
250
|
+
variant="outline"
|
|
251
|
+
color="red"
|
|
252
|
+
isDisabled
|
|
253
|
+
icon={<InfoCircleIcon />}
|
|
254
|
+
href="#filled"
|
|
255
|
+
onClose={() => Function.prototype}
|
|
256
|
+
>
|
|
257
|
+
Red link removable (disabled)
|
|
258
|
+
</Label>{' '}
|
|
259
|
+
<Label
|
|
260
|
+
variant="outline"
|
|
261
|
+
color="red"
|
|
262
|
+
isDisabled
|
|
263
|
+
icon={<InfoCircleIcon />}
|
|
264
|
+
onClick={() => logColor('red')}
|
|
265
|
+
onClose={() => Function.prototype}
|
|
266
|
+
>
|
|
267
|
+
Red clickable removable (disabled)
|
|
176
268
|
</Label>
|
|
177
269
|
<br />
|
|
178
270
|
<br />
|
|
@@ -193,13 +285,13 @@ export const LabelOutline: React.FunctionComponent = () => {
|
|
|
193
285
|
</Label>{' '}
|
|
194
286
|
<Label variant="outline" color="purple" href="#outline" onClose={() => Function.prototype}>
|
|
195
287
|
Purple link removable
|
|
196
|
-
</Label>
|
|
288
|
+
</Label>{' '}
|
|
197
289
|
<Label variant="outline" color="purple" onClick={() => logColor('purple')}>
|
|
198
290
|
Purple clickable
|
|
199
291
|
</Label>{' '}
|
|
200
292
|
<Label variant="outline" color="purple" onClick={() => logColor('purple')} onClose={() => Function.prototype}>
|
|
201
293
|
Purple clickable removable
|
|
202
|
-
</Label>
|
|
294
|
+
</Label>{' '}
|
|
203
295
|
<Label
|
|
204
296
|
variant="outline"
|
|
205
297
|
color="purple"
|
|
@@ -208,6 +300,26 @@ export const LabelOutline: React.FunctionComponent = () => {
|
|
|
208
300
|
textMaxWidth="16ch"
|
|
209
301
|
>
|
|
210
302
|
Purple label with icon that overflows
|
|
303
|
+
</Label>{' '}
|
|
304
|
+
<Label
|
|
305
|
+
variant="outline"
|
|
306
|
+
color="purple"
|
|
307
|
+
isDisabled
|
|
308
|
+
icon={<InfoCircleIcon />}
|
|
309
|
+
href="#filled"
|
|
310
|
+
onClose={() => Function.prototype}
|
|
311
|
+
>
|
|
312
|
+
Purple link removable (disabled)
|
|
313
|
+
</Label>{' '}
|
|
314
|
+
<Label
|
|
315
|
+
variant="outline"
|
|
316
|
+
color="purple"
|
|
317
|
+
isDisabled
|
|
318
|
+
icon={<InfoCircleIcon />}
|
|
319
|
+
onClick={() => logColor('purple')}
|
|
320
|
+
onClose={() => Function.prototype}
|
|
321
|
+
>
|
|
322
|
+
Purple clickable removable (disabled)
|
|
211
323
|
</Label>
|
|
212
324
|
<br />
|
|
213
325
|
<br />
|
|
@@ -228,13 +340,13 @@ export const LabelOutline: React.FunctionComponent = () => {
|
|
|
228
340
|
</Label>{' '}
|
|
229
341
|
<Label variant="outline" color="cyan" href="#outline" onClose={() => Function.prototype}>
|
|
230
342
|
Cyan link removable
|
|
231
|
-
</Label>
|
|
343
|
+
</Label>{' '}
|
|
232
344
|
<Label variant="outline" color="cyan" onClick={() => logColor('cyan')}>
|
|
233
345
|
Cyan clickable
|
|
234
346
|
</Label>{' '}
|
|
235
347
|
<Label variant="outline" color="cyan" onClick={() => logColor('cyan')} onClose={() => Function.prototype}>
|
|
236
348
|
Cyan clickable removable
|
|
237
|
-
</Label>
|
|
349
|
+
</Label>{' '}
|
|
238
350
|
<Label
|
|
239
351
|
variant="outline"
|
|
240
352
|
color="cyan"
|
|
@@ -243,6 +355,26 @@ export const LabelOutline: React.FunctionComponent = () => {
|
|
|
243
355
|
textMaxWidth="16ch"
|
|
244
356
|
>
|
|
245
357
|
Cyan label with icon that overflows
|
|
358
|
+
</Label>{' '}
|
|
359
|
+
<Label
|
|
360
|
+
variant="outline"
|
|
361
|
+
color="cyan"
|
|
362
|
+
isDisabled
|
|
363
|
+
icon={<InfoCircleIcon />}
|
|
364
|
+
href="#filled"
|
|
365
|
+
onClose={() => Function.prototype}
|
|
366
|
+
>
|
|
367
|
+
Cyan link removable (disabled)
|
|
368
|
+
</Label>{' '}
|
|
369
|
+
<Label
|
|
370
|
+
variant="outline"
|
|
371
|
+
color="cyan"
|
|
372
|
+
isDisabled
|
|
373
|
+
icon={<InfoCircleIcon />}
|
|
374
|
+
onClick={() => logColor('cyan')}
|
|
375
|
+
onClose={() => Function.prototype}
|
|
376
|
+
>
|
|
377
|
+
Cyan clickable removable (disabled)
|
|
246
378
|
</Label>
|
|
247
379
|
<br />
|
|
248
380
|
<br />
|
|
@@ -263,13 +395,13 @@ export const LabelOutline: React.FunctionComponent = () => {
|
|
|
263
395
|
</Label>{' '}
|
|
264
396
|
<Label variant="outline" color="gold" href="#outline" onClose={() => Function.prototype}>
|
|
265
397
|
Gold link removable
|
|
266
|
-
</Label>
|
|
398
|
+
</Label>{' '}
|
|
267
399
|
<Label variant="outline" color="gold" onClick={() => logColor('gold')}>
|
|
268
400
|
Gold clickable
|
|
269
401
|
</Label>{' '}
|
|
270
402
|
<Label variant="outline" color="gold" onClick={() => logColor('gold')} onClose={() => Function.prototype}>
|
|
271
403
|
Gold clickable removable
|
|
272
|
-
</Label>
|
|
404
|
+
</Label>{' '}
|
|
273
405
|
<Label
|
|
274
406
|
variant="outline"
|
|
275
407
|
color="gold"
|
|
@@ -278,6 +410,26 @@ export const LabelOutline: React.FunctionComponent = () => {
|
|
|
278
410
|
textMaxWidth="16ch"
|
|
279
411
|
>
|
|
280
412
|
Gold label with icon that overflows
|
|
413
|
+
</Label>{' '}
|
|
414
|
+
<Label
|
|
415
|
+
variant="outline"
|
|
416
|
+
color="gold"
|
|
417
|
+
isDisabled
|
|
418
|
+
icon={<InfoCircleIcon />}
|
|
419
|
+
href="#filled"
|
|
420
|
+
onClose={() => Function.prototype}
|
|
421
|
+
>
|
|
422
|
+
Gold link removable (disabled)
|
|
423
|
+
</Label>{' '}
|
|
424
|
+
<Label
|
|
425
|
+
variant="outline"
|
|
426
|
+
color="gold"
|
|
427
|
+
isDisabled
|
|
428
|
+
icon={<InfoCircleIcon />}
|
|
429
|
+
onClick={() => logColor('gold')}
|
|
430
|
+
onClose={() => Function.prototype}
|
|
431
|
+
>
|
|
432
|
+
Gold clickable removable (disabled)
|
|
281
433
|
</Label>
|
|
282
434
|
</React.Fragment>
|
|
283
435
|
);
|
|
@@ -3,6 +3,15 @@ import styles from '@patternfly/react-styles/css/components/MenuToggle/menu-togg
|
|
|
3
3
|
import { css } from '@patternfly/react-styles';
|
|
4
4
|
import CaretDownIcon from '@patternfly/react-icons/dist/esm/icons/caret-down-icon';
|
|
5
5
|
import { BadgeProps } from '../Badge';
|
|
6
|
+
import CheckCircleIcon from '@patternfly/react-icons/dist/esm/icons/check-circle-icon';
|
|
7
|
+
import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
|
|
8
|
+
import ExclamationTriangleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-triangle-icon';
|
|
9
|
+
|
|
10
|
+
export enum MenuToggleStatus {
|
|
11
|
+
success = 'success',
|
|
12
|
+
danger = 'danger',
|
|
13
|
+
warning = 'warning'
|
|
14
|
+
}
|
|
6
15
|
|
|
7
16
|
export type MenuToggleElement = HTMLDivElement | HTMLButtonElement;
|
|
8
17
|
|
|
@@ -37,6 +46,10 @@ export interface MenuToggleProps
|
|
|
37
46
|
splitButtonOptions?: SplitButtonOptions;
|
|
38
47
|
/** Variant styles of the menu toggle */
|
|
39
48
|
variant?: 'default' | 'plain' | 'primary' | 'plainText' | 'secondary' | 'typeahead';
|
|
49
|
+
/** @beta Status styles of the menu toggle */
|
|
50
|
+
status?: 'success' | 'warning' | 'danger';
|
|
51
|
+
/** Overrides the status icon */
|
|
52
|
+
statusIcon?: React.ReactNode;
|
|
40
53
|
/** Optional icon or image rendered inside the toggle, before the children content. It is
|
|
41
54
|
* recommended to wrap most basic icons in our icon component.
|
|
42
55
|
*/
|
|
@@ -69,6 +82,8 @@ class MenuToggleBase extends React.Component<MenuToggleProps> {
|
|
|
69
82
|
isFullWidth,
|
|
70
83
|
splitButtonOptions,
|
|
71
84
|
variant,
|
|
85
|
+
status,
|
|
86
|
+
statusIcon,
|
|
72
87
|
innerRef,
|
|
73
88
|
onClick,
|
|
74
89
|
'aria-label': ariaLabel,
|
|
@@ -77,8 +92,25 @@ class MenuToggleBase extends React.Component<MenuToggleProps> {
|
|
|
77
92
|
const isPlain = variant === 'plain';
|
|
78
93
|
const isPlainText = variant === 'plainText';
|
|
79
94
|
const isTypeahead = variant === 'typeahead';
|
|
95
|
+
|
|
96
|
+
let _statusIcon = statusIcon;
|
|
97
|
+
if (!statusIcon) {
|
|
98
|
+
switch (status) {
|
|
99
|
+
case MenuToggleStatus.success:
|
|
100
|
+
_statusIcon = <CheckCircleIcon aria-hidden="true" />;
|
|
101
|
+
break;
|
|
102
|
+
case MenuToggleStatus.warning:
|
|
103
|
+
_statusIcon = <ExclamationTriangleIcon aria-hidden="true" />;
|
|
104
|
+
break;
|
|
105
|
+
case MenuToggleStatus.danger:
|
|
106
|
+
_statusIcon = <ExclamationCircleIcon aria-hidden="true" />;
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
80
111
|
const toggleControls = (
|
|
81
112
|
<span className={css(styles.menuToggleControls)}>
|
|
113
|
+
{status !== undefined && <span className={css(styles.menuToggleStatusIcon)}>{_statusIcon}</span>}
|
|
82
114
|
<span className={css(styles.menuToggleToggleIcon)}>
|
|
83
115
|
<CaretDownIcon aria-hidden />
|
|
84
116
|
</span>
|
|
@@ -111,6 +143,7 @@ class MenuToggleBase extends React.Component<MenuToggleProps> {
|
|
|
111
143
|
isExpanded && styles.modifiers.expanded,
|
|
112
144
|
variant === 'primary' && styles.modifiers.primary,
|
|
113
145
|
variant === 'secondary' && styles.modifiers.secondary,
|
|
146
|
+
status && styles.modifiers[status],
|
|
114
147
|
(isPlain || isPlainText) && styles.modifiers.plain,
|
|
115
148
|
isPlainText && styles.modifiers.text,
|
|
116
149
|
isFullHeight && styles.modifiers.fullHeight,
|
|
@@ -153,8 +186,10 @@ class MenuToggleBase extends React.Component<MenuToggleProps> {
|
|
|
153
186
|
aria-label={ariaLabel}
|
|
154
187
|
disabled={isDisabled}
|
|
155
188
|
onClick={onClick}
|
|
189
|
+
{...(children && { style: { display: 'flex', paddingLeft: 'var(--pf-v5-global--spacer--sm)' } })}
|
|
156
190
|
{...otherProps}
|
|
157
191
|
>
|
|
192
|
+
{children && <span className={css(styles.menuToggleText)}>{children}</span>}
|
|
158
193
|
{toggleControls}
|
|
159
194
|
</button>
|
|
160
195
|
</div>
|
|
@@ -84,7 +84,7 @@ class MenuToggleCheckbox extends React.Component<MenuToggleCheckboxProps, { ouia
|
|
|
84
84
|
</span>
|
|
85
85
|
);
|
|
86
86
|
return (
|
|
87
|
-
<label className={css(styles.check, !children && styles.modifiers.standalone, className)}
|
|
87
|
+
<label className={css(styles.check, !children && styles.modifiers.standalone, className)}>
|
|
88
88
|
<input
|
|
89
89
|
className={css(styles.checkInput)}
|
|
90
90
|
{...(this.calculateChecked() !== undefined && { onChange: this.handleChange })}
|
|
@@ -93,7 +93,7 @@ class MenuToggleCheckbox extends React.Component<MenuToggleCheckboxProps, { ouia
|
|
|
93
93
|
ref={(elem) => elem && (elem.indeterminate = isChecked === null)}
|
|
94
94
|
aria-invalid={!isValid}
|
|
95
95
|
disabled={isDisabled}
|
|
96
|
-
{...(defaultChecked !== undefined ? { defaultChecked } : { checked:
|
|
96
|
+
{...(defaultChecked !== undefined ? { defaultChecked } : { checked: this.calculateChecked() })}
|
|
97
97
|
{...getOUIAProps(
|
|
98
98
|
MenuToggleCheckbox.displayName,
|
|
99
99
|
ouiaId !== undefined ? ouiaId : this.state.ouiaStateId,
|
|
@@ -57,6 +57,21 @@ describe('menu toggle', () => {
|
|
|
57
57
|
expect(asFragment()).toMatchSnapshot();
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
+
test('shows success status', () => {
|
|
61
|
+
render(<MenuToggle status="success">Toggle</MenuToggle>);
|
|
62
|
+
expect(screen.getByRole('button')).toHaveClass('pf-m-success');
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('shows warning status', () => {
|
|
66
|
+
render(<MenuToggle status="warning">Toggle</MenuToggle>);
|
|
67
|
+
expect(screen.getByRole('button')).toHaveClass('pf-m-warning');
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test('shows danger status', () => {
|
|
71
|
+
render(<MenuToggle status="danger">Toggle</MenuToggle>);
|
|
72
|
+
expect(screen.getByRole('button')).toHaveClass('pf-m-danger');
|
|
73
|
+
});
|
|
74
|
+
|
|
60
75
|
test('split toggle passes onClick', async () => {
|
|
61
76
|
const mockClick = jest.fn();
|
|
62
77
|
const user = userEvent.setup();
|
|
@@ -17,7 +17,7 @@ import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
|
|
|
17
17
|
|
|
18
18
|
### Collapsed toggle
|
|
19
19
|
|
|
20
|
-
A toggle is collapsed until it is selected by a user.
|
|
20
|
+
A toggle is collapsed until it is selected by a user.
|
|
21
21
|
|
|
22
22
|
```ts
|
|
23
23
|
import React from 'react';
|
|
@@ -29,7 +29,7 @@ import { MenuToggle } from '@patternfly/react-core';
|
|
|
29
29
|
|
|
30
30
|
### Expanded toggle
|
|
31
31
|
|
|
32
|
-
When a user selects a toggle, it becomes expanded and is styled with a blue underline. To flag expanded toggles, and apply expanded styling, use the `isExpanded` property .
|
|
32
|
+
When a user selects a toggle, it becomes expanded and is styled with a blue underline. To flag expanded toggles, and apply expanded styling, use the `isExpanded` property .
|
|
33
33
|
|
|
34
34
|
```ts
|
|
35
35
|
import React from 'react';
|
|
@@ -41,7 +41,7 @@ import { MenuToggle } from '@patternfly/react-core';
|
|
|
41
41
|
|
|
42
42
|
### Disabled toggle
|
|
43
43
|
|
|
44
|
-
To disable the selection and expansion of a toggle, use the `isDisabled` property.
|
|
44
|
+
To disable the selection and expansion of a toggle, use the `isDisabled` property.
|
|
45
45
|
|
|
46
46
|
```ts
|
|
47
47
|
import React from 'react';
|
|
@@ -65,7 +65,7 @@ import { MenuToggle, Badge } from '@patternfly/react-core';
|
|
|
65
65
|
|
|
66
66
|
### With icons
|
|
67
67
|
|
|
68
|
-
To add a recognizable icon to a menu toggle, use the `icon` property. The following example adds a `CogIcon` to the
|
|
68
|
+
To add a recognizable icon to a menu toggle, use the `icon` property. The following example adds a `CogIcon` to the toggle.
|
|
69
69
|
|
|
70
70
|
For most basic icons, it is recommended to wrap it inside our [icon component](/components/icon).
|
|
71
71
|
|
|
@@ -111,7 +111,7 @@ import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
|
|
|
111
111
|
|
|
112
112
|
### With avatar and text
|
|
113
113
|
|
|
114
|
-
You can also pass images into the `icon` property. The following example passes in an `<Avatar>` component with an `imgAvatar`.
|
|
114
|
+
You can also pass images into the `icon` property. The following example passes in an `<Avatar>` component with an `imgAvatar`.
|
|
115
115
|
|
|
116
116
|
This can be used alongside a text label that provides more context for the image.
|
|
117
117
|
|
|
@@ -150,9 +150,9 @@ import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
|
|
|
150
150
|
|
|
151
151
|
### Plain toggle with icon
|
|
152
152
|
|
|
153
|
-
To apply plain styling to a menu toggle with an icon, pass in `variant="plain"`. This will remove the default bottom border and caret. You may pass in an `icon` to serve as the menu toggle. The following example passes in an `EllipsisVIcon`.
|
|
153
|
+
To apply plain styling to a menu toggle with an icon, pass in `variant="plain"`. This will remove the default bottom border and caret. You may pass in an `icon` to serve as the menu toggle. The following example passes in an `EllipsisVIcon`.
|
|
154
154
|
|
|
155
|
-
If the toggle does not have any visible text content, use the `aria-label` property to provide an accessible name.
|
|
155
|
+
If the toggle does not have any visible text content, use the `aria-label` property to provide an accessible name.
|
|
156
156
|
|
|
157
157
|
```ts
|
|
158
158
|
import React from 'react';
|
|
@@ -171,6 +171,7 @@ import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-ico
|
|
|
171
171
|
</MenuToggle>
|
|
172
172
|
</React.Fragment>
|
|
173
173
|
```
|
|
174
|
+
|
|
174
175
|
### Plain toggle with text label
|
|
175
176
|
|
|
176
177
|
To apply plain styling to a menu toggle with a text label, pass in `variant="plainText"`. Unlike the “plain” variant, “plainText” adds a caret pointing down in the toggle.
|
|
@@ -201,27 +202,40 @@ The following example shows a split button with a `<MenuToggleCheckbox>`.
|
|
|
201
202
|
Variant styling can be applied to split button toggles to adjust their appearance for different scenarios. Both "primary" and "secondary" variants can be used with split button toggles.
|
|
202
203
|
|
|
203
204
|
```ts file='MenuToggleSplitButtonCheckbox.tsx'
|
|
205
|
+
|
|
204
206
|
```
|
|
205
207
|
|
|
206
|
-
### Split button toggle with
|
|
208
|
+
### Split button toggle with checkbox label
|
|
207
209
|
|
|
208
|
-
To display text in a split button menu toggle, add a label to the `items` property of `splitButtonOptions`.
|
|
210
|
+
To display text in a split button menu toggle, add a label to the `items` property of `splitButtonOptions`.
|
|
209
211
|
|
|
210
212
|
```ts file='MenuToggleSplitButtonCheckboxWithText.tsx'
|
|
213
|
+
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Split button toggle with checkbox and toggle button text
|
|
217
|
+
|
|
218
|
+
For split button toggles that should still contain text which will trigger the toggle's `onClick`, pass `children` to the `MenuToggle`.
|
|
219
|
+
|
|
220
|
+
The following example shows a split button with a `<MenuToggleCheckbox>` and toggle button text.
|
|
221
|
+
|
|
222
|
+
```ts file='MenuToggleSplitButtonCheckboxWithToggleText.tsx'
|
|
223
|
+
|
|
211
224
|
```
|
|
212
225
|
|
|
213
226
|
### Split button toggle with action
|
|
214
227
|
|
|
215
|
-
To add an action to a split button, pass `variant='action'` into `splitButtonOptions` and add a `<MenuToggleAction>` to the `items` property of `splitButtonOptions`.
|
|
228
|
+
To add an action to a split button, pass `variant='action'` into `splitButtonOptions` and add a `<MenuToggleAction>` to the `items` property of `splitButtonOptions`.
|
|
216
229
|
|
|
217
230
|
Actions may be used with primary and secondary toggle variants.
|
|
218
|
-
|
|
231
|
+
|
|
219
232
|
```ts file='MenuToggleSplitButtonAction.tsx'
|
|
233
|
+
|
|
220
234
|
```
|
|
221
235
|
|
|
222
236
|
### Full height toggle
|
|
223
237
|
|
|
224
|
-
A full height toggle fills the height of its parent. To flag a full height toggle, use the `isFullHeight` property.
|
|
238
|
+
A full height toggle fills the height of its parent. To flag a full height toggle, use the `isFullHeight` property.
|
|
225
239
|
|
|
226
240
|
In the following example, the toggle fills the size of the "80px" `<div>` element that it is within.
|
|
227
241
|
|
|
@@ -238,7 +252,7 @@ import { MenuToggle } from '@patternfly/react-core';
|
|
|
238
252
|
|
|
239
253
|
### Full width toggle
|
|
240
254
|
|
|
241
|
-
A full width toggle fills the width of its parent. To flag a full width toggle, use the `isFullWidth` property.
|
|
255
|
+
A full width toggle fills the width of its parent. To flag a full width toggle, use the `isFullWidth` property.
|
|
242
256
|
|
|
243
257
|
In the following example, the toggle fills the width of its parent as the window size changes.
|
|
244
258
|
|
|
@@ -249,7 +263,7 @@ import { MenuToggle } from '@patternfly/react-core';
|
|
|
249
263
|
const fullWidth: React.FunctionComponent = () => {
|
|
250
264
|
return (
|
|
251
265
|
<MenuToggle isFullWidth aria-label="Full width menu toggle" >
|
|
252
|
-
Full width
|
|
266
|
+
Full width
|
|
253
267
|
</MenuToggle>
|
|
254
268
|
);
|
|
255
269
|
}
|
|
@@ -262,4 +276,15 @@ To create a typeahead toggle, pass in `variant="typeahead"` to the `<MenuToggle>
|
|
|
262
276
|
To create a multiple typeahead toggle, pass a `<TextInputGroup>` component implemented like the [text input group's filter example](/components/text-input-group#filters) as a child of `<MenuToggle>`.
|
|
263
277
|
|
|
264
278
|
```ts file='MenuToggleTypeahead.tsx'
|
|
279
|
+
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Status toggle
|
|
283
|
+
|
|
284
|
+
To create a toggle with a status, pass in the `status` property to the `MenuToggle`. The default icon associated with each status may be overridden by using the `statusIcon` property.
|
|
285
|
+
|
|
286
|
+
When the status value is "warning" or "danger", you must include helper text that conveys what is causing the warning/error.
|
|
287
|
+
|
|
288
|
+
```ts isBeta file='MenuToggleStatus.tsx'
|
|
289
|
+
|
|
265
290
|
```
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MenuToggleCheckbox, MenuToggle } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const MenuToggleSplitButtonCheckboxWithToggleText: React.FunctionComponent = () => (
|
|
5
|
+
<React.Fragment>
|
|
6
|
+
<MenuToggle
|
|
7
|
+
splitButtonOptions={{
|
|
8
|
+
items: [
|
|
9
|
+
<MenuToggleCheckbox
|
|
10
|
+
id="split-button-checkbox-with-text-example"
|
|
11
|
+
key="split-checkbox-with-text"
|
|
12
|
+
aria-label="Select all"
|
|
13
|
+
/>
|
|
14
|
+
]
|
|
15
|
+
}}
|
|
16
|
+
aria-label="Menu toggle with checkbox split button and text"
|
|
17
|
+
>
|
|
18
|
+
10 selected
|
|
19
|
+
</MenuToggle>{' '}
|
|
20
|
+
<MenuToggle
|
|
21
|
+
variant="primary"
|
|
22
|
+
splitButtonOptions={{
|
|
23
|
+
items: [
|
|
24
|
+
<MenuToggleCheckbox
|
|
25
|
+
id="split-button-checkbox-primary-example"
|
|
26
|
+
key="split-checkbox-primary"
|
|
27
|
+
aria-label="Select all"
|
|
28
|
+
/>
|
|
29
|
+
]
|
|
30
|
+
}}
|
|
31
|
+
aria-label="Primary menu toggle with checkbox split button"
|
|
32
|
+
>
|
|
33
|
+
10 selected
|
|
34
|
+
</MenuToggle>{' '}
|
|
35
|
+
<MenuToggle
|
|
36
|
+
variant="secondary"
|
|
37
|
+
splitButtonOptions={{
|
|
38
|
+
items: [
|
|
39
|
+
<MenuToggleCheckbox
|
|
40
|
+
id="split-button-checkbox-secondary-example"
|
|
41
|
+
key="split-checkbox-secondary"
|
|
42
|
+
aria-label="Select all"
|
|
43
|
+
/>
|
|
44
|
+
]
|
|
45
|
+
}}
|
|
46
|
+
aria-label="Secondary menu toggle with checkbox split button"
|
|
47
|
+
>
|
|
48
|
+
10 selected
|
|
49
|
+
</MenuToggle>
|
|
50
|
+
</React.Fragment>
|
|
51
|
+
);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MenuToggle, HelperText, HelperTextItem } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const MenuToggleStatus: React.FunctionComponent = () => (
|
|
5
|
+
<React.Fragment>
|
|
6
|
+
<MenuToggle status="success">Success</MenuToggle>
|
|
7
|
+
<br />
|
|
8
|
+
<br />
|
|
9
|
+
<MenuToggle status="warning">Warning</MenuToggle>
|
|
10
|
+
<HelperText>
|
|
11
|
+
<HelperTextItem variant="warning">Warning text that explains the issue.</HelperTextItem>
|
|
12
|
+
</HelperText>
|
|
13
|
+
<br />
|
|
14
|
+
<br />
|
|
15
|
+
<MenuToggle status="danger">Danger</MenuToggle>
|
|
16
|
+
<HelperText>
|
|
17
|
+
<HelperTextItem variant="error">Danger text that explains the issue.</HelperTextItem>
|
|
18
|
+
</HelperText>
|
|
19
|
+
</React.Fragment>
|
|
20
|
+
);
|
|
@@ -2,6 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import { render } from '@testing-library/react';
|
|
3
3
|
import { MultipleFileUpload } from '../MultipleFileUpload';
|
|
4
4
|
|
|
5
|
+
jest.mock('../../../helpers/GenerateId/GenerateId');
|
|
6
|
+
|
|
5
7
|
describe('MultipleFileUpload', () => {
|
|
6
8
|
test('renders with expected class names when not horizontal', () => {
|
|
7
9
|
const { asFragment } = render(<MultipleFileUpload>Foo</MultipleFileUpload>);
|