@patternfly/react-core 6.5.0-prerelease.65 → 6.5.0-prerelease.67
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 +10 -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/Compass/package.json +1 -1
- package/dist/dynamic/components/Content/package.json +1 -1
- package/dist/dynamic/components/DataList/package.json +1 -1
- package/dist/dynamic/components/DatePicker/package.json +1 -1
- package/dist/dynamic/components/DescriptionList/package.json +1 -1
- package/dist/dynamic/components/Divider/package.json +1 -1
- package/dist/dynamic/components/Drawer/package.json +1 -1
- package/dist/dynamic/components/Dropdown/package.json +1 -1
- package/dist/dynamic/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/components/EmptyState/package.json +1 -1
- package/dist/dynamic/components/ExpandableSection/package.json +1 -1
- package/dist/dynamic/components/FileUpload/package.json +1 -1
- package/dist/dynamic/components/Form/package.json +1 -1
- package/dist/dynamic/components/FormSelect/package.json +1 -1
- package/dist/dynamic/components/HelperText/package.json +1 -1
- package/dist/dynamic/components/Hero/package.json +1 -1
- package/dist/dynamic/components/Hint/package.json +1 -1
- package/dist/dynamic/components/Icon/package.json +1 -1
- package/dist/dynamic/components/InputGroup/package.json +1 -1
- package/dist/dynamic/components/JumpLinks/package.json +1 -1
- package/dist/dynamic/components/Label/package.json +1 -1
- package/dist/dynamic/components/List/package.json +1 -1
- package/dist/dynamic/components/LoginPage/package.json +1 -1
- package/dist/dynamic/components/Masthead/package.json +1 -1
- package/dist/dynamic/components/Menu/package.json +1 -1
- package/dist/dynamic/components/MenuToggle/package.json +1 -1
- package/dist/dynamic/components/Modal/package.json +1 -1
- package/dist/dynamic/components/MultipleFileUpload/package.json +1 -1
- package/dist/dynamic/components/Nav/package.json +1 -1
- package/dist/dynamic/components/NotificationBadge/package.json +1 -1
- package/dist/dynamic/components/NotificationDrawer/package.json +1 -1
- package/dist/dynamic/components/NumberInput/package.json +1 -1
- package/dist/dynamic/components/OverflowMenu/package.json +1 -1
- package/dist/dynamic/components/Page/package.json +1 -1
- package/dist/dynamic/components/Pagination/package.json +1 -1
- package/dist/dynamic/components/Panel/package.json +1 -1
- package/dist/dynamic/components/Popover/package.json +1 -1
- package/dist/dynamic/components/Progress/package.json +1 -1
- package/dist/dynamic/components/ProgressStepper/package.json +1 -1
- package/dist/dynamic/components/Radio/package.json +1 -1
- package/dist/dynamic/components/SearchInput/package.json +1 -1
- package/dist/dynamic/components/Select/package.json +1 -1
- package/dist/dynamic/components/Sidebar/package.json +1 -1
- package/dist/dynamic/components/SimpleList/package.json +1 -1
- package/dist/dynamic/components/Skeleton/package.json +1 -1
- package/dist/dynamic/components/SkipToContent/package.json +1 -1
- package/dist/dynamic/components/Slider/package.json +1 -1
- package/dist/dynamic/components/Spinner/package.json +1 -1
- package/dist/dynamic/components/Switch/package.json +1 -1
- package/dist/dynamic/components/Tabs/package.json +1 -1
- package/dist/dynamic/components/TextArea/package.json +1 -1
- package/dist/dynamic/components/TextInput/package.json +1 -1
- package/dist/dynamic/components/TextInputGroup/package.json +1 -1
- package/dist/dynamic/components/TimePicker/package.json +1 -1
- package/dist/dynamic/components/Timestamp/package.json +1 -1
- package/dist/dynamic/components/Title/package.json +1 -1
- package/dist/dynamic/components/ToggleGroup/package.json +1 -1
- package/dist/dynamic/components/Toolbar/package.json +1 -1
- package/dist/dynamic/components/Tooltip/package.json +1 -1
- package/dist/dynamic/components/TreeView/package.json +1 -1
- package/dist/dynamic/components/Truncate/package.json +1 -1
- package/dist/dynamic/components/Wizard/hooks/package.json +1 -1
- package/dist/dynamic/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/Chip/package.json +1 -1
- package/dist/dynamic/deprecated/components/DragDrop/package.json +1 -1
- package/dist/dynamic/deprecated/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/deprecated/components/Modal/package.json +1 -1
- package/dist/dynamic/deprecated/components/Tile/package.json +1 -1
- package/dist/dynamic/deprecated/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/package.json +1 -1
- package/dist/dynamic/helpers/AnimationsProvider/AnimationsProvider/package.json +1 -1
- package/dist/dynamic/helpers/AnimationsProvider/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/SSRSafeIds/SSRSafeIds/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/useSSRSafeId/package.json +1 -1
- package/dist/dynamic/helpers/useUnmountEffect/package.json +1 -1
- package/dist/dynamic/helpers/util/package.json +1 -1
- package/dist/dynamic/layouts/Bullseye/package.json +1 -1
- package/dist/dynamic/layouts/Flex/package.json +1 -1
- package/dist/dynamic/layouts/Gallery/package.json +1 -1
- package/dist/dynamic/layouts/Grid/package.json +1 -1
- package/dist/dynamic/layouts/Level/package.json +1 -1
- package/dist/dynamic/layouts/Split/package.json +1 -1
- package/dist/dynamic/layouts/Stack/package.json +1 -1
- package/dist/dynamic/styles/package.json +1 -1
- package/dist/dynamic-modules.json +2 -0
- package/dist/esm/components/Drawer/Drawer.d.ts +3 -0
- package/dist/esm/components/Drawer/Drawer.d.ts.map +1 -1
- package/dist/esm/components/Drawer/Drawer.js +3 -0
- package/dist/esm/components/Drawer/Drawer.js.map +1 -1
- package/dist/esm/components/Drawer/DrawerPanelContent.d.ts +10 -1
- package/dist/esm/components/Drawer/DrawerPanelContent.d.ts.map +1 -1
- package/dist/esm/components/Drawer/DrawerPanelContent.js +2 -2
- package/dist/esm/components/Drawer/DrawerPanelContent.js.map +1 -1
- package/dist/esm/components/Drawer/DrawerSection.d.ts +6 -1
- package/dist/esm/components/Drawer/DrawerSection.d.ts.map +1 -1
- package/dist/esm/components/Drawer/DrawerSection.js +2 -2
- package/dist/esm/components/Drawer/DrawerSection.js.map +1 -1
- package/dist/esm/components/Label/Label.d.ts +21 -1
- package/dist/esm/components/Label/Label.d.ts.map +1 -1
- package/dist/esm/components/Label/Label.js +37 -15
- package/dist/esm/components/Label/Label.js.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroup.d.ts +6 -2
- package/dist/esm/components/TextInputGroup/TextInputGroup.d.ts.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroup.js +2 -1
- package/dist/esm/components/TextInputGroup/TextInputGroup.js.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.js +15 -3
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.js.map +1 -1
- package/dist/js/components/Drawer/Drawer.d.ts +3 -0
- package/dist/js/components/Drawer/Drawer.d.ts.map +1 -1
- package/dist/js/components/Drawer/Drawer.js +3 -0
- package/dist/js/components/Drawer/Drawer.js.map +1 -1
- package/dist/js/components/Drawer/DrawerPanelContent.d.ts +10 -1
- package/dist/js/components/Drawer/DrawerPanelContent.d.ts.map +1 -1
- package/dist/js/components/Drawer/DrawerPanelContent.js +2 -2
- package/dist/js/components/Drawer/DrawerPanelContent.js.map +1 -1
- package/dist/js/components/Drawer/DrawerSection.d.ts +6 -1
- package/dist/js/components/Drawer/DrawerSection.d.ts.map +1 -1
- package/dist/js/components/Drawer/DrawerSection.js +2 -2
- package/dist/js/components/Drawer/DrawerSection.js.map +1 -1
- package/dist/js/components/Label/Label.d.ts +21 -1
- package/dist/js/components/Label/Label.d.ts.map +1 -1
- package/dist/js/components/Label/Label.js +38 -16
- package/dist/js/components/Label/Label.js.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroup.d.ts +6 -2
- package/dist/js/components/TextInputGroup/TextInputGroup.d.ts.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroup.js +2 -1
- package/dist/js/components/TextInputGroup/TextInputGroup.js.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroupMain.js +14 -2
- package/dist/js/components/TextInputGroup/TextInputGroupMain.js.map +1 -1
- package/dist/umd/assets/{output-Cf2rQdn-.css → output-CpfEvslC.css} +22072 -22072
- 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 +2 -2
- package/src/components/Content/examples/Content.md +1 -1
- package/src/components/Drawer/Drawer.tsx +3 -0
- package/src/components/Drawer/DrawerPanelContent.tsx +16 -1
- package/src/components/Drawer/DrawerSection.tsx +8 -1
- package/src/components/Drawer/__tests__/DrawerPanelContent.test.tsx +31 -1
- package/src/components/Drawer/__tests__/DrawerSection.test.tsx +37 -0
- package/src/components/Drawer/examples/Drawer.md +1 -1
- package/src/components/Label/Label.tsx +40 -18
- package/src/components/Label/__tests__/Label.test.tsx +6 -6
- package/src/components/Label/__tests__/__snapshots__/Label.test.tsx.snap +36 -0
- package/src/components/Label/examples/LabelCompact.tsx +7 -7
- package/src/components/Label/examples/LabelCustomRender.tsx +2 -2
- package/src/components/Label/examples/LabelEditable.tsx +3 -3
- package/src/components/Label/examples/LabelFilled.tsx +122 -122
- package/src/components/Label/examples/LabelGroupBasic.tsx +3 -3
- package/src/components/Label/examples/LabelGroupCategory.tsx +3 -3
- package/src/components/Label/examples/LabelGroupCategoryRemovable.tsx +2 -2
- package/src/components/Label/examples/LabelGroupEditableAdd.tsx +2 -2
- package/src/components/Label/examples/LabelGroupEditableAddDropdown.tsx +2 -2
- package/src/components/Label/examples/LabelGroupEditableAddModal.tsx +2 -1
- package/src/components/Label/examples/LabelGroupEditableLabels.tsx +5 -5
- package/src/components/Label/examples/LabelGroupOverflow.tsx +6 -6
- package/src/components/Label/examples/LabelGroupVerticalCategoryOverflowRemovable.tsx +2 -2
- package/src/components/Label/examples/LabelOutline.tsx +204 -120
- package/src/components/TextInputGroup/TextInputGroup.tsx +8 -3
- package/src/components/TextInputGroup/TextInputGroupMain.tsx +15 -3
- package/src/components/TextInputGroup/__tests__/TextInputGroup.test.tsx +10 -0
- package/src/components/TextInputGroup/__tests__/TextInputGroupMain.test.tsx +10 -0
- package/src/demos/RTL/examples/PaginatedTable.tsx +5 -4
- package/src/demos/examples/Card/CardHorizontalGrid.tsx +9 -8
- package/src/demos/examples/Card/CardStatus.tsx +6 -5
- package/src/demos/examples/PrimaryDetail/PrimaryDetailContentPadding.tsx +2 -2
- package/src/demos/examples/Tabs/TabsOpen.tsx +4 -3
- package/src/demos/examples/Tabs/TabsOpenWithSecondaryTabs.tsx +4 -3
package/helpers/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"6.5.0-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"6.5.0-prerelease.66","private":true}
|
package/layouts/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"6.5.0-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"6.5.0-prerelease.66","private":true}
|
package/next/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"6.5.0-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"6.5.0-prerelease.66","private":true}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "6.5.0-prerelease.
|
|
3
|
+
"version": "6.5.0-prerelease.67",
|
|
4
4
|
"description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"react": "^17 || ^18 || ^19",
|
|
64
64
|
"react-dom": "^17 || ^18 || ^19"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "87b8d39b54f1159b6f4c08fadff0d513227b0626"
|
|
67
67
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
id: Content
|
|
3
3
|
section: components
|
|
4
4
|
cssPrefix: pf-v6-c-content
|
|
5
|
-
propComponents: ['Content']
|
|
5
|
+
propComponents: ['Content', 'ContentVariants']
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
The `<Content>` component allows you to establish a block of HTML content and apply simple, built-in styling. `<Content>` can be used for any element supported by the `component` property (including `h1` through `h6`, `hr`, `p`, `a`, `small`, `blockquote`, and `pre`).
|
|
@@ -5,6 +5,9 @@ import { css } from '@patternfly/react-styles';
|
|
|
5
5
|
export enum DrawerColorVariant {
|
|
6
6
|
default = 'default',
|
|
7
7
|
secondary = 'secondary',
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated `DrawerColorVariant.noBackground` is deprecated. Use the `isPlain` prop on `DrawerPanelContent` and the `DrawerSection`instead.
|
|
10
|
+
*/
|
|
8
11
|
noBackground = 'no-background'
|
|
9
12
|
}
|
|
10
13
|
|
|
@@ -37,6 +37,12 @@ export interface DrawerPanelContentProps extends Omit<React.HTMLProps<HTMLDivEle
|
|
|
37
37
|
isResizable?: boolean;
|
|
38
38
|
/** @beta Flag indicating that the drawer panel should disable glass styles. This prop is intended to work with isPill drawers. */
|
|
39
39
|
hasNoGlass?: boolean;
|
|
40
|
+
/** @beta Flag indicating that the drawer panel should use glass styles when in glass theme */
|
|
41
|
+
isGlass?: boolean;
|
|
42
|
+
/** @beta Flag indicating that the drawer panel should use plain styles. This only applies when the drawer is static or inline. */
|
|
43
|
+
isPlain?: boolean;
|
|
44
|
+
/** @beta Flag indicating that plain styles should be disabled when glass styles are used. This only applies when the drawer is static or inline. */
|
|
45
|
+
isNoPlainOnGlass?: boolean;
|
|
40
46
|
/** Callback for resize end. */
|
|
41
47
|
onResize?: (event: MouseEvent | TouchEvent | React.KeyboardEvent, width: number, id: string) => void;
|
|
42
48
|
/** The minimum size of a drawer. */
|
|
@@ -56,7 +62,10 @@ export interface DrawerPanelContentProps extends Omit<React.HTMLProps<HTMLDivEle
|
|
|
56
62
|
xl?: 'width_25' | 'width_33' | 'width_50' | 'width_66' | 'width_75' | 'width_100';
|
|
57
63
|
'2xl'?: 'width_25' | 'width_33' | 'width_50' | 'width_66' | 'width_75' | 'width_100';
|
|
58
64
|
};
|
|
59
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* Color variant of the background of the drawer panel.
|
|
67
|
+
* The `no-background`is deprecated; use the `isPlain` prop instead.
|
|
68
|
+
*/
|
|
60
69
|
colorVariant?: DrawerColorVariant | 'no-background' | 'default' | 'secondary';
|
|
61
70
|
/** Adds and customizes a focus trap on the drawer panel content. */
|
|
62
71
|
focusTrap?: DrawerPanelFocusTrapObject;
|
|
@@ -71,6 +80,9 @@ export const DrawerPanelContent: React.FunctionComponent<DrawerPanelContentProps
|
|
|
71
80
|
hasNoBorder = false,
|
|
72
81
|
isResizable = false,
|
|
73
82
|
hasNoGlass = false,
|
|
83
|
+
isGlass = false,
|
|
84
|
+
isPlain = false,
|
|
85
|
+
isNoPlainOnGlass = false,
|
|
74
86
|
onResize,
|
|
75
87
|
minSize,
|
|
76
88
|
defaultSize,
|
|
@@ -368,6 +380,9 @@ export const DrawerPanelContent: React.FunctionComponent<DrawerPanelContentProps
|
|
|
368
380
|
styles.drawerPanel,
|
|
369
381
|
isResizable && styles.modifiers.resizable,
|
|
370
382
|
hasNoGlass && 'pf-m-no-glass',
|
|
383
|
+
isGlass && styles.modifiers.glass,
|
|
384
|
+
isPlain && styles.modifiers.plain,
|
|
385
|
+
isNoPlainOnGlass && styles.modifiers.noPlainOnGlass,
|
|
371
386
|
hasNoBorder && styles.modifiers.noBorder,
|
|
372
387
|
formatBreakpointMods(widths, styles),
|
|
373
388
|
colorVariant === DrawerColorVariant.noBackground && styles.modifiers.noBackground,
|
|
@@ -7,19 +7,26 @@ export interface DrawerSectionProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
7
7
|
className?: string;
|
|
8
8
|
/** Content to be rendered in the drawer section. */
|
|
9
9
|
children?: React.ReactNode;
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Color variant of the background of the drawer section.
|
|
12
|
+
* The `no-background` value is deprecated; use the `isPlain` prop instead.
|
|
13
|
+
*/
|
|
11
14
|
colorVariant?: DrawerColorVariant | 'no-background' | 'default' | 'secondary';
|
|
15
|
+
/** @beta Flag indicating that the drawer section should use plain styles. */
|
|
16
|
+
isPlain?: boolean;
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
export const DrawerSection: React.FunctionComponent<DrawerSectionProps> = ({
|
|
15
20
|
className = '',
|
|
16
21
|
children,
|
|
17
22
|
colorVariant = DrawerColorVariant.default,
|
|
23
|
+
isPlain = false,
|
|
18
24
|
...props
|
|
19
25
|
}: DrawerSectionProps) => (
|
|
20
26
|
<div
|
|
21
27
|
className={css(
|
|
22
28
|
styles.drawerSection,
|
|
29
|
+
isPlain && styles.modifiers.plain,
|
|
23
30
|
colorVariant === DrawerColorVariant.noBackground && styles.modifiers.noBackground,
|
|
24
31
|
colorVariant === DrawerColorVariant.secondary && styles.modifiers.secondary,
|
|
25
32
|
className
|
|
@@ -13,7 +13,7 @@ test(`Renders with only class ${styles.drawerPanel} by default`, () => {
|
|
|
13
13
|
expect(screen.getByText('Drawer panel content')).toHaveClass(styles.drawerPanel, { exact: true });
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
test(`Renders with class ${styles.modifiers.noBackground} when colorVariant="no-background"`, () => {
|
|
16
|
+
test(`Renders with class ${styles.modifiers.noBackground} when deprecated colorVariant="no-background" is used`, () => {
|
|
17
17
|
render(
|
|
18
18
|
<Drawer isExpanded>
|
|
19
19
|
<DrawerPanelContent colorVariant="no-background">Drawer panel content</DrawerPanelContent>
|
|
@@ -188,3 +188,33 @@ test(`Renders with class 'pf-m-no-glass' when hasNoGlass is true`, () => {
|
|
|
188
188
|
|
|
189
189
|
expect(screen.getByText('Drawer panel content')).toHaveClass('pf-m-no-glass');
|
|
190
190
|
});
|
|
191
|
+
|
|
192
|
+
test(`Renders with class ${styles.modifiers.glass} when isGlass is true`, () => {
|
|
193
|
+
render(
|
|
194
|
+
<Drawer isExpanded>
|
|
195
|
+
<DrawerPanelContent isGlass>Drawer panel content</DrawerPanelContent>
|
|
196
|
+
</Drawer>
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
expect(screen.getByText('Drawer panel content')).toHaveClass(styles.modifiers.glass);
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
test(`Renders with class ${styles.modifiers.plain} when isPlain is true`, () => {
|
|
203
|
+
render(
|
|
204
|
+
<Drawer isExpanded>
|
|
205
|
+
<DrawerPanelContent isPlain>Drawer panel content</DrawerPanelContent>
|
|
206
|
+
</Drawer>
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
expect(screen.getByText('Drawer panel content')).toHaveClass(styles.modifiers.plain);
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
test(`Renders with class ${styles.modifiers.noPlainOnGlass} when isNoPlainOnGlass is true`, () => {
|
|
213
|
+
render(
|
|
214
|
+
<Drawer isExpanded>
|
|
215
|
+
<DrawerPanelContent isNoPlainOnGlass>Drawer panel content</DrawerPanelContent>
|
|
216
|
+
</Drawer>
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
expect(screen.getByText('Drawer panel content')).toHaveClass(styles.modifiers.noPlainOnGlass);
|
|
220
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { DrawerColorVariant } from '../Drawer';
|
|
3
|
+
import { DrawerSection } from '../DrawerSection';
|
|
4
|
+
import styles from '@patternfly/react-styles/css/components/Drawer/drawer';
|
|
5
|
+
|
|
6
|
+
test(`Renders with only class ${styles.drawerSection} by default`, () => {
|
|
7
|
+
render(<DrawerSection>Section content</DrawerSection>);
|
|
8
|
+
|
|
9
|
+
expect(screen.getByText('Section content')).toHaveClass(styles.drawerSection, { exact: true });
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test(`Applies ${styles.drawerSection} and ${styles.modifiers.plain} when isPlain is true`, () => {
|
|
13
|
+
render(<DrawerSection isPlain>Section content</DrawerSection>);
|
|
14
|
+
|
|
15
|
+
const section = screen.getByText('Section content');
|
|
16
|
+
expect(section).toHaveClass(styles.drawerSection);
|
|
17
|
+
expect(section).toHaveClass(styles.modifiers.plain);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test(`Does not apply ${styles.modifiers.plain} when isPlain is false`, () => {
|
|
21
|
+
render(<DrawerSection isPlain={false}>Section content</DrawerSection>);
|
|
22
|
+
|
|
23
|
+
expect(screen.getByText('Section content')).not.toHaveClass(styles.modifiers.plain);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test(`Applies plain and secondary modifiers together when isPlain and colorVariant are set`, () => {
|
|
27
|
+
render(
|
|
28
|
+
<DrawerSection isPlain colorVariant={DrawerColorVariant.secondary}>
|
|
29
|
+
Section content
|
|
30
|
+
</DrawerSection>
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const section = screen.getByText('Section content');
|
|
34
|
+
expect(section).toHaveClass(styles.drawerSection);
|
|
35
|
+
expect(section).toHaveClass(styles.modifiers.plain);
|
|
36
|
+
expect(section).toHaveClass(styles.modifiers.secondary);
|
|
37
|
+
});
|
|
@@ -13,13 +13,35 @@ import RhUiErrorFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-erro
|
|
|
13
13
|
import RhUiWarningFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-warning-fill-icon';
|
|
14
14
|
import RhUiInformationFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-information-fill-icon';
|
|
15
15
|
|
|
16
|
+
/** Semantic status for labels (default icon and status styling). */
|
|
17
|
+
export enum LabelStatus {
|
|
18
|
+
success = 'success',
|
|
19
|
+
warning = 'warning',
|
|
20
|
+
danger = 'danger',
|
|
21
|
+
info = 'info',
|
|
22
|
+
custom = 'custom'
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Label palette color when not using the `status` prop. */
|
|
26
|
+
export enum LabelColor {
|
|
27
|
+
blue = 'blue',
|
|
28
|
+
teal = 'teal',
|
|
29
|
+
green = 'green',
|
|
30
|
+
orange = 'orange',
|
|
31
|
+
purple = 'purple',
|
|
32
|
+
red = 'red',
|
|
33
|
+
orangered = 'orangered',
|
|
34
|
+
grey = 'grey',
|
|
35
|
+
yellow = 'yellow'
|
|
36
|
+
}
|
|
37
|
+
|
|
16
38
|
export interface LabelProps extends React.HTMLProps<HTMLSpanElement> {
|
|
17
39
|
/** Content rendered inside the label. */
|
|
18
40
|
children?: React.ReactNode;
|
|
19
41
|
/** Additional classes added to the label. */
|
|
20
42
|
className?: string;
|
|
21
43
|
/** Color of the label. */
|
|
22
|
-
color?: 'blue' | 'teal' | 'green' | 'orange' | 'purple' | 'red' | 'orangered' | 'grey' | 'yellow';
|
|
44
|
+
color?: 'blue' | 'teal' | 'green' | 'orange' | 'purple' | 'red' | 'orangered' | 'grey' | 'yellow' | LabelColor;
|
|
23
45
|
/** Variant of the label. */
|
|
24
46
|
variant?: 'outline' | 'filled' | 'overflow' | 'add';
|
|
25
47
|
/** Status of the label with a respective icon and color. Overrides the color set by the color property. */
|
|
@@ -82,30 +104,30 @@ export interface LabelProps extends React.HTMLProps<HTMLSpanElement> {
|
|
|
82
104
|
}) => React.ReactNode;
|
|
83
105
|
}
|
|
84
106
|
|
|
85
|
-
const colorStyles = {
|
|
86
|
-
blue: styles.modifiers.blue,
|
|
87
|
-
teal: styles.modifiers.teal,
|
|
88
|
-
green: styles.modifiers.green,
|
|
89
|
-
orange: styles.modifiers.orange,
|
|
90
|
-
purple: styles.modifiers.purple,
|
|
91
|
-
red: styles.modifiers.red,
|
|
92
|
-
orangered: styles.modifiers.orangered,
|
|
93
|
-
yellow: styles.modifiers.yellow,
|
|
94
|
-
grey: ''
|
|
107
|
+
const colorStyles: Record<LabelColor, string> = {
|
|
108
|
+
[LabelColor.blue]: styles.modifiers.blue,
|
|
109
|
+
[LabelColor.teal]: styles.modifiers.teal,
|
|
110
|
+
[LabelColor.green]: styles.modifiers.green,
|
|
111
|
+
[LabelColor.orange]: styles.modifiers.orange,
|
|
112
|
+
[LabelColor.purple]: styles.modifiers.purple,
|
|
113
|
+
[LabelColor.red]: styles.modifiers.red,
|
|
114
|
+
[LabelColor.orangered]: styles.modifiers.orangered,
|
|
115
|
+
[LabelColor.yellow]: styles.modifiers.yellow,
|
|
116
|
+
[LabelColor.grey]: ''
|
|
95
117
|
};
|
|
96
118
|
|
|
97
|
-
const statusIcons = {
|
|
98
|
-
success: <RhUiCheckCircleFillIcon />,
|
|
99
|
-
warning: <RhUiWarningFillIcon />,
|
|
100
|
-
danger: <RhUiErrorFillIcon />,
|
|
101
|
-
info: <RhUiInformationFillIcon />,
|
|
102
|
-
custom: <RhUiNotificationFillIcon />
|
|
119
|
+
const statusIcons: Record<LabelStatus, React.ReactNode> = {
|
|
120
|
+
[LabelStatus.success]: <RhUiCheckCircleFillIcon />,
|
|
121
|
+
[LabelStatus.warning]: <RhUiWarningFillIcon />,
|
|
122
|
+
[LabelStatus.danger]: <RhUiErrorFillIcon />,
|
|
123
|
+
[LabelStatus.info]: <RhUiInformationFillIcon />,
|
|
124
|
+
[LabelStatus.custom]: <RhUiNotificationFillIcon />
|
|
103
125
|
};
|
|
104
126
|
|
|
105
127
|
export const Label: React.FunctionComponent<LabelProps> = ({
|
|
106
128
|
children,
|
|
107
129
|
className = '',
|
|
108
|
-
color =
|
|
130
|
+
color = LabelColor.grey,
|
|
109
131
|
variant = 'filled',
|
|
110
132
|
status,
|
|
111
133
|
isCompact = false,
|
|
@@ -2,9 +2,9 @@ import { render, screen } from '@testing-library/react';
|
|
|
2
2
|
import userEvent from '@testing-library/user-event';
|
|
3
3
|
import '@testing-library/jest-dom';
|
|
4
4
|
|
|
5
|
-
import { Label } from '../Label';
|
|
5
|
+
import { Label, LabelColor } from '../Label';
|
|
6
6
|
|
|
7
|
-
const labelColors =
|
|
7
|
+
const labelColors = Object.values(LabelColor);
|
|
8
8
|
|
|
9
9
|
describe('Label', () => {
|
|
10
10
|
test('renders', () => {
|
|
@@ -51,17 +51,17 @@ describe('Label', () => {
|
|
|
51
51
|
expect(asFragment()).toMatchSnapshot();
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
-
labelColors.forEach((color
|
|
54
|
+
labelColors.forEach((color) =>
|
|
55
55
|
test(`label with ${color} color`, () => {
|
|
56
|
-
const { asFragment } = render(<Label color={color
|
|
56
|
+
const { asFragment } = render(<Label color={color}>Something</Label>);
|
|
57
57
|
expect(asFragment()).toMatchSnapshot();
|
|
58
58
|
})
|
|
59
59
|
);
|
|
60
60
|
|
|
61
|
-
labelColors.forEach((color
|
|
61
|
+
labelColors.forEach((color) =>
|
|
62
62
|
test(`label with ${color} color with outline variant`, () => {
|
|
63
63
|
const { asFragment } = render(
|
|
64
|
-
<Label color={color
|
|
64
|
+
<Label color={color} variant="outline">
|
|
65
65
|
Something
|
|
66
66
|
</Label>
|
|
67
67
|
);
|
|
@@ -452,6 +452,42 @@ exports[`Label label with red color with outline variant 1`] = `
|
|
|
452
452
|
</DocumentFragment>
|
|
453
453
|
`;
|
|
454
454
|
|
|
455
|
+
exports[`Label label with orangered color 1`] = `
|
|
456
|
+
<DocumentFragment>
|
|
457
|
+
<span
|
|
458
|
+
class="pf-v6-c-label pf-m-orangered pf-m-filled"
|
|
459
|
+
>
|
|
460
|
+
<span
|
|
461
|
+
class="pf-v6-c-label__content"
|
|
462
|
+
>
|
|
463
|
+
<span
|
|
464
|
+
class="pf-v6-c-label__text"
|
|
465
|
+
>
|
|
466
|
+
Something
|
|
467
|
+
</span>
|
|
468
|
+
</span>
|
|
469
|
+
</span>
|
|
470
|
+
</DocumentFragment>
|
|
471
|
+
`;
|
|
472
|
+
|
|
473
|
+
exports[`Label label with orangered color with outline variant 1`] = `
|
|
474
|
+
<DocumentFragment>
|
|
475
|
+
<span
|
|
476
|
+
class="pf-v6-c-label pf-m-orangered pf-m-outline"
|
|
477
|
+
>
|
|
478
|
+
<span
|
|
479
|
+
class="pf-v6-c-label__content"
|
|
480
|
+
>
|
|
481
|
+
<span
|
|
482
|
+
class="pf-v6-c-label__text"
|
|
483
|
+
>
|
|
484
|
+
Something
|
|
485
|
+
</span>
|
|
486
|
+
</span>
|
|
487
|
+
</span>
|
|
488
|
+
</DocumentFragment>
|
|
489
|
+
`;
|
|
490
|
+
|
|
455
491
|
exports[`Label label with teal color 1`] = `
|
|
456
492
|
<DocumentFragment>
|
|
457
493
|
<span
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fragment } from 'react';
|
|
2
|
-
import { Label } from '@patternfly/react-core';
|
|
2
|
+
import { Label, LabelColor } from '@patternfly/react-core';
|
|
3
3
|
import CubeIcon from '@patternfly/react-icons/dist/esm/icons/cube-icon';
|
|
4
4
|
import RhUiInformationFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-information-fill-icon';
|
|
5
5
|
|
|
@@ -42,24 +42,24 @@ export const LabelCompact: React.FunctionComponent = () => (
|
|
|
42
42
|
>
|
|
43
43
|
Compact clickable removable (disabled)
|
|
44
44
|
</Label>
|
|
45
|
-
<Label variant="outline" color=
|
|
45
|
+
<Label variant="outline" color={LabelColor.blue} isCompact icon={<CubeIcon />}>
|
|
46
46
|
Compact icon
|
|
47
47
|
</Label>
|
|
48
|
-
<Label variant="outline" color=
|
|
48
|
+
<Label variant="outline" color={LabelColor.blue} isCompact onClose={() => Function.prototype}>
|
|
49
49
|
Compact removable
|
|
50
50
|
</Label>
|
|
51
|
-
<Label variant="outline" color=
|
|
51
|
+
<Label variant="outline" color={LabelColor.blue} isCompact icon={<CubeIcon />} onClose={() => Function.prototype}>
|
|
52
52
|
Compact icon removable
|
|
53
53
|
</Label>
|
|
54
|
-
<Label variant="outline" color=
|
|
54
|
+
<Label variant="outline" color={LabelColor.blue} isCompact href="#compact">
|
|
55
55
|
Compact link
|
|
56
56
|
</Label>
|
|
57
|
-
<Label variant="outline" color=
|
|
57
|
+
<Label variant="outline" color={LabelColor.blue} isCompact href="#compact" onClose={() => Function.prototype}>
|
|
58
58
|
Compact link removable
|
|
59
59
|
</Label>
|
|
60
60
|
<Label
|
|
61
61
|
variant="outline"
|
|
62
|
-
color=
|
|
62
|
+
color={LabelColor.blue}
|
|
63
63
|
isCompact
|
|
64
64
|
icon={<CubeIcon />}
|
|
65
65
|
onClose={() => Function.prototype}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Label } from '@patternfly/react-core';
|
|
1
|
+
import { Label, LabelColor } from '@patternfly/react-core';
|
|
2
2
|
import RhUiInformationFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-information-fill-icon';
|
|
3
3
|
|
|
4
4
|
export const LabelCustomRender: React.FunctionComponent = () => (
|
|
5
5
|
<Label
|
|
6
|
-
color=
|
|
6
|
+
color={LabelColor.blue}
|
|
7
7
|
icon={<RhUiInformationFillIcon />}
|
|
8
8
|
onClose={() => Function.prototype}
|
|
9
9
|
render={({ className, content, componentRef }) => (
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fragment, useState } from 'react';
|
|
2
|
-
import { Label } from '@patternfly/react-core';
|
|
2
|
+
import { Label, LabelColor } from '@patternfly/react-core';
|
|
3
3
|
|
|
4
4
|
export const LabelEditable: React.FunctionComponent = () => {
|
|
5
5
|
const [labelText, setLabelText] = useState('Editable label');
|
|
@@ -24,7 +24,7 @@ export const LabelEditable: React.FunctionComponent = () => {
|
|
|
24
24
|
return (
|
|
25
25
|
<Fragment>
|
|
26
26
|
<Label
|
|
27
|
-
color=
|
|
27
|
+
color={LabelColor.blue}
|
|
28
28
|
onClose={() => {}}
|
|
29
29
|
closeBtnAriaLabel="Custom close button for editable label"
|
|
30
30
|
onEditCancel={onEditCancel}
|
|
@@ -38,7 +38,7 @@ export const LabelEditable: React.FunctionComponent = () => {
|
|
|
38
38
|
{labelText}
|
|
39
39
|
</Label>
|
|
40
40
|
<Label
|
|
41
|
-
color=
|
|
41
|
+
color={LabelColor.grey}
|
|
42
42
|
isCompact
|
|
43
43
|
onClose={() => {}}
|
|
44
44
|
closeBtnAriaLabel="Custom close button for compact editable label"
|