@patternfly/react-core 4.194.2 → 4.195.2
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 +38 -0
- package/dist/esm/components/Alert/Alert.d.ts +2 -1
- package/dist/esm/components/Alert/Alert.d.ts.map +1 -1
- package/dist/esm/components/Alert/Alert.js.map +1 -1
- package/dist/esm/components/ChipGroup/Chip.d.ts +2 -1
- package/dist/esm/components/ChipGroup/Chip.d.ts.map +1 -1
- package/dist/esm/components/ChipGroup/Chip.js.map +1 -1
- package/dist/esm/components/ChipGroup/ChipGroup.d.ts +2 -1
- package/dist/esm/components/ChipGroup/ChipGroup.d.ts.map +1 -1
- package/dist/esm/components/ChipGroup/ChipGroup.js.map +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopy.d.ts +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopy.d.ts.map +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopy.js +2 -2
- package/dist/esm/components/ClipboardCopy/ClipboardCopy.js.map +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopyButton.d.ts +2 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopyButton.d.ts.map +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopyButton.js.map +1 -1
- package/dist/esm/components/Label/Label.d.ts +2 -1
- package/dist/esm/components/Label/Label.d.ts.map +1 -1
- package/dist/esm/components/Label/Label.js +10 -9
- package/dist/esm/components/Label/Label.js.map +1 -1
- package/dist/esm/components/LabelGroup/LabelGroup.d.ts +2 -1
- package/dist/esm/components/LabelGroup/LabelGroup.d.ts.map +1 -1
- package/dist/esm/components/LabelGroup/LabelGroup.js.map +1 -1
- package/dist/esm/components/NotificationDrawer/NotificationDrawerGroup.d.ts +2 -1
- package/dist/esm/components/NotificationDrawer/NotificationDrawerGroup.d.ts.map +1 -1
- package/dist/esm/components/NotificationDrawer/NotificationDrawerGroup.js.map +1 -1
- package/dist/esm/components/NotificationDrawer/NotificationDrawerListItemHeader.d.ts +2 -1
- package/dist/esm/components/NotificationDrawer/NotificationDrawerListItemHeader.d.ts.map +1 -1
- package/dist/esm/components/NotificationDrawer/NotificationDrawerListItemHeader.js.map +1 -1
- package/dist/esm/components/Popover/Popover.d.ts +1 -1
- package/dist/esm/components/Popover/Popover.d.ts.map +1 -1
- package/dist/esm/components/Popover/Popover.js.map +1 -1
- package/dist/esm/components/Progress/ProgressContainer.d.ts +2 -1
- package/dist/esm/components/Progress/ProgressContainer.d.ts.map +1 -1
- package/dist/esm/components/Progress/ProgressContainer.js.map +1 -1
- package/dist/esm/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/components/Select/Select.js +1 -0
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/Select/SelectToggle.js +1 -1
- package/dist/esm/components/Select/SelectToggle.js.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.d.ts +2 -0
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.js +2 -1
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.js.map +1 -1
- package/dist/esm/components/Tooltip/Tooltip.d.ts +11 -3
- package/dist/esm/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/esm/components/Tooltip/Tooltip.js +17 -1
- package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/components/Truncate/Truncate.d.ts +2 -1
- package/dist/esm/components/Truncate/Truncate.d.ts.map +1 -1
- package/dist/esm/components/Truncate/Truncate.js.map +1 -1
- package/dist/js/components/Alert/Alert.d.ts +2 -1
- package/dist/js/components/Alert/Alert.d.ts.map +1 -1
- package/dist/js/components/Alert/Alert.js.map +1 -1
- package/dist/js/components/ChipGroup/Chip.d.ts +2 -1
- package/dist/js/components/ChipGroup/Chip.d.ts.map +1 -1
- package/dist/js/components/ChipGroup/Chip.js.map +1 -1
- package/dist/js/components/ChipGroup/ChipGroup.d.ts +2 -1
- package/dist/js/components/ChipGroup/ChipGroup.d.ts.map +1 -1
- package/dist/js/components/ChipGroup/ChipGroup.js.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopy.d.ts +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopy.d.ts.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopy.js +2 -2
- package/dist/js/components/ClipboardCopy/ClipboardCopy.js.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopyButton.d.ts +2 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopyButton.d.ts.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopyButton.js.map +1 -1
- package/dist/js/components/Label/Label.d.ts +2 -1
- package/dist/js/components/Label/Label.d.ts.map +1 -1
- package/dist/js/components/Label/Label.js +10 -9
- package/dist/js/components/Label/Label.js.map +1 -1
- package/dist/js/components/LabelGroup/LabelGroup.d.ts +2 -1
- package/dist/js/components/LabelGroup/LabelGroup.d.ts.map +1 -1
- package/dist/js/components/LabelGroup/LabelGroup.js.map +1 -1
- package/dist/js/components/NotificationDrawer/NotificationDrawerGroup.d.ts +2 -1
- package/dist/js/components/NotificationDrawer/NotificationDrawerGroup.d.ts.map +1 -1
- package/dist/js/components/NotificationDrawer/NotificationDrawerGroup.js.map +1 -1
- package/dist/js/components/NotificationDrawer/NotificationDrawerListItemHeader.d.ts +2 -1
- package/dist/js/components/NotificationDrawer/NotificationDrawerListItemHeader.d.ts.map +1 -1
- package/dist/js/components/NotificationDrawer/NotificationDrawerListItemHeader.js.map +1 -1
- package/dist/js/components/Popover/Popover.d.ts +1 -1
- package/dist/js/components/Popover/Popover.d.ts.map +1 -1
- package/dist/js/components/Popover/Popover.js.map +1 -1
- package/dist/js/components/Progress/ProgressContainer.d.ts +2 -1
- package/dist/js/components/Progress/ProgressContainer.d.ts.map +1 -1
- package/dist/js/components/Progress/ProgressContainer.js.map +1 -1
- package/dist/js/components/Select/Select.d.ts.map +1 -1
- package/dist/js/components/Select/Select.js +1 -0
- package/dist/js/components/Select/Select.js.map +1 -1
- package/dist/js/components/Select/SelectToggle.js +1 -1
- package/dist/js/components/Select/SelectToggle.js.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroupMain.d.ts +2 -0
- package/dist/js/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroupMain.js +2 -1
- package/dist/js/components/TextInputGroup/TextInputGroupMain.js.map +1 -1
- package/dist/js/components/Tooltip/Tooltip.d.ts +11 -3
- package/dist/js/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/js/components/Tooltip/Tooltip.js +17 -1
- package/dist/js/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/js/components/Truncate/Truncate.d.ts +2 -1
- package/dist/js/components/Truncate/Truncate.d.ts.map +1 -1
- package/dist/js/components/Truncate/Truncate.js.map +1 -1
- package/dist/umd/react-core.css +359 -87
- package/dist/umd/react-core.js +465 -441
- package/dist/umd/react-core.min.css +296 -24
- package/dist/umd/react-core.min.js +2 -2
- package/package.json +6 -6
- package/src/components/Alert/Alert.tsx +16 -2
- package/src/components/CalendarMonth/examples/CalendarMonth.md +2 -18
- package/src/components/CalendarMonth/examples/CalendarMonthDefault.tsx +4 -0
- package/src/components/CalendarMonth/examples/CalendarMonthSelectableDate.tsx +13 -0
- package/src/components/ChipGroup/Chip.tsx +16 -2
- package/src/components/ChipGroup/ChipGroup.tsx +16 -2
- package/src/components/ClipboardCopy/ClipboardCopy.tsx +16 -3
- package/src/components/ClipboardCopy/ClipboardCopyButton.tsx +2 -1
- package/src/components/Label/Label.tsx +33 -19
- package/src/components/Label/__tests__/Label.test.tsx +2 -2
- package/src/components/Label/__tests__/__snapshots__/Label.test.tsx.snap +5 -9
- package/src/components/LabelGroup/LabelGroup.tsx +16 -2
- package/src/components/NotificationDrawer/NotificationDrawerGroup.tsx +16 -2
- package/src/components/NotificationDrawer/NotificationDrawerListItemHeader.tsx +16 -2
- package/src/components/Popover/Popover.tsx +1 -0
- package/src/components/Progress/ProgressContainer.tsx +16 -2
- package/src/components/Select/Select.tsx +1 -0
- package/src/components/Select/SelectToggle.tsx +1 -1
- package/src/components/TextInputGroup/TextInputGroupMain.tsx +12 -0
- package/src/components/Tooltip/Tooltip.tsx +35 -3
- package/src/components/Tooltip/__tests__/Generated/__snapshots__/Tooltip.test.tsx.snap +8 -0
- package/src/components/Tooltip/__tests__/__snapshots__/Tooltip.test.tsx.snap +8 -0
- package/src/components/Tooltip/examples/Tooltip.md +8 -0
- package/src/components/Truncate/Truncate.tsx +16 -2
- package/src/demos/TextInputGroupDemo.md +2 -2
- package/src/demos/examples/TextInputGroup/AutoCompleteSearch.tsx +17 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.195.2",
|
|
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",
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
"generate": "node scripts/copyStyles.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@patternfly/react-icons": "^4.
|
|
38
|
-
"@patternfly/react-styles": "^4.
|
|
39
|
-
"@patternfly/react-tokens": "^4.
|
|
37
|
+
"@patternfly/react-icons": "^4.46.2",
|
|
38
|
+
"@patternfly/react-styles": "^4.45.2",
|
|
39
|
+
"@patternfly/react-tokens": "^4.47.2",
|
|
40
40
|
"focus-trap": "6.2.2",
|
|
41
41
|
"react-dropzone": "9.0.0",
|
|
42
42
|
"tippy.js": "5.1.2",
|
|
43
43
|
"tslib": "^2.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@patternfly/patternfly": "4.
|
|
46
|
+
"@patternfly/patternfly": "4.177.1",
|
|
47
47
|
"@rollup/plugin-commonjs": "^21.0.0",
|
|
48
48
|
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
49
49
|
"@rollup/plugin-replace": "^3.0.0",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react": "^16.8.0 || ^17.0.0",
|
|
61
61
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "86c4b8516bcafff8f81849c9202f6c34a2463250"
|
|
64
64
|
}
|
|
@@ -7,7 +7,7 @@ import { AlertIcon } from './AlertIcon';
|
|
|
7
7
|
import { capitalize, useOUIAProps, OUIAProps } from '../../helpers';
|
|
8
8
|
import { AlertContext } from './AlertContext';
|
|
9
9
|
import maxLines from '@patternfly/react-tokens/dist/esm/c_alert__title_max_lines';
|
|
10
|
-
import { Tooltip } from '../Tooltip';
|
|
10
|
+
import { Tooltip, TooltipPosition } from '../Tooltip';
|
|
11
11
|
import { AlertToggleExpandButton } from './AlertToggleExpandButton';
|
|
12
12
|
|
|
13
13
|
export enum AlertVariant {
|
|
@@ -52,7 +52,21 @@ export interface AlertProps extends Omit<React.HTMLProps<HTMLDivElement>, 'actio
|
|
|
52
52
|
/** Truncate title to number of lines */
|
|
53
53
|
truncateTitle?: number;
|
|
54
54
|
/** Position of the tooltip which is displayed if text is truncated */
|
|
55
|
-
tooltipPosition?:
|
|
55
|
+
tooltipPosition?:
|
|
56
|
+
| TooltipPosition
|
|
57
|
+
| 'auto'
|
|
58
|
+
| 'top'
|
|
59
|
+
| 'bottom'
|
|
60
|
+
| 'left'
|
|
61
|
+
| 'right'
|
|
62
|
+
| 'top-start'
|
|
63
|
+
| 'top-end'
|
|
64
|
+
| 'bottom-start'
|
|
65
|
+
| 'bottom-end'
|
|
66
|
+
| 'left-start'
|
|
67
|
+
| 'left-end'
|
|
68
|
+
| 'right-start'
|
|
69
|
+
| 'right-end';
|
|
56
70
|
/** Set a custom icon to the alert. If not set the icon is set according to the variant */
|
|
57
71
|
customIcon?: React.ReactNode;
|
|
58
72
|
/** Flag indicating that the alert is expandable */
|
|
@@ -9,27 +9,11 @@ beta: true
|
|
|
9
9
|
## Examples
|
|
10
10
|
|
|
11
11
|
### Default
|
|
12
|
-
```js
|
|
13
|
-
import React from 'react';
|
|
14
|
-
import { CalendarMonth } from '@patternfly/react-core';
|
|
15
12
|
|
|
16
|
-
|
|
13
|
+
```ts file="./CalendarMonthDefault.tsx"
|
|
17
14
|
```
|
|
18
15
|
|
|
19
16
|
### Selectable date
|
|
20
|
-
```js
|
|
21
|
-
import React from 'react';
|
|
22
|
-
import { CalendarMonth } from '@patternfly/react-core';
|
|
23
17
|
|
|
24
|
-
|
|
25
|
-
const [date, setDate] = React.useState(new Date(2020, 10, 24));
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<React.Fragment>
|
|
29
|
-
<pre>Selected date: {date.toString()}</pre>
|
|
30
|
-
<CalendarMonth date={date} onChange={setDate} />
|
|
31
|
-
</React.Fragment>
|
|
32
|
-
);
|
|
33
|
-
}
|
|
18
|
+
```ts file="./CalendarMonthSelectableDate.tsx"
|
|
34
19
|
```
|
|
35
|
-
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CalendarMonth } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const CalendarMonthSelectableDate: React.FunctionComponent = () => {
|
|
5
|
+
const [date, setDate] = React.useState(new Date(2020, 10, 24));
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<React.Fragment>
|
|
9
|
+
<pre>Selected date: {date.toString()}</pre>
|
|
10
|
+
<CalendarMonth date={date} onChange={setDate} />
|
|
11
|
+
</React.Fragment>
|
|
12
|
+
);
|
|
13
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { css } from '@patternfly/react-styles';
|
|
3
3
|
import { Button } from '../Button';
|
|
4
|
-
import { Tooltip } from '../Tooltip';
|
|
4
|
+
import { Tooltip, TooltipPosition } from '../Tooltip';
|
|
5
5
|
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
|
|
6
6
|
import styles from '@patternfly/react-styles/css/components/Chip/chip';
|
|
7
7
|
import { GenerateId } from '../../helpers/GenerateId/GenerateId';
|
|
@@ -23,7 +23,21 @@ export interface ChipProps extends React.HTMLProps<HTMLDivElement>, OUIAProps {
|
|
|
23
23
|
/** Component that will be used for chip. It is recommended that <button> or <li> are used when the chip is an overflow chip. */
|
|
24
24
|
component?: React.ReactNode;
|
|
25
25
|
/** Position of the tooltip which is displayed if text is longer */
|
|
26
|
-
tooltipPosition?:
|
|
26
|
+
tooltipPosition?:
|
|
27
|
+
| TooltipPosition
|
|
28
|
+
| 'auto'
|
|
29
|
+
| 'top'
|
|
30
|
+
| 'bottom'
|
|
31
|
+
| 'left'
|
|
32
|
+
| 'right'
|
|
33
|
+
| 'top-start'
|
|
34
|
+
| 'top-end'
|
|
35
|
+
| 'bottom-start'
|
|
36
|
+
| 'bottom-end'
|
|
37
|
+
| 'left-start'
|
|
38
|
+
| 'left-end'
|
|
39
|
+
| 'right-start'
|
|
40
|
+
| 'right-end';
|
|
27
41
|
}
|
|
28
42
|
|
|
29
43
|
interface ChipState {
|
|
@@ -3,7 +3,7 @@ import styles from '@patternfly/react-styles/css/components/ChipGroup/chip-group
|
|
|
3
3
|
import { css } from '@patternfly/react-styles';
|
|
4
4
|
import { Button } from '../Button';
|
|
5
5
|
import { Chip } from './Chip';
|
|
6
|
-
import { Tooltip } from '../Tooltip';
|
|
6
|
+
import { Tooltip, TooltipPosition } from '../Tooltip';
|
|
7
7
|
import TimesCircleIcon from '@patternfly/react-icons/dist/esm/icons/times-circle-icon';
|
|
8
8
|
import { fillTemplate } from '../../helpers';
|
|
9
9
|
import { GenerateId } from '../../helpers/GenerateId/GenerateId';
|
|
@@ -35,7 +35,21 @@ export interface ChipGroupProps extends React.HTMLProps<HTMLUListElement>, OUIAP
|
|
|
35
35
|
/** Function that is called when clicking on the overflow (expand/collapse) chip button */
|
|
36
36
|
onOverflowChipClick?: (event: React.MouseEvent) => void;
|
|
37
37
|
/** Position of the tooltip which is displayed if the category name text is longer */
|
|
38
|
-
tooltipPosition?:
|
|
38
|
+
tooltipPosition?:
|
|
39
|
+
| TooltipPosition
|
|
40
|
+
| 'auto'
|
|
41
|
+
| 'top'
|
|
42
|
+
| 'bottom'
|
|
43
|
+
| 'left'
|
|
44
|
+
| 'right'
|
|
45
|
+
| 'top-start'
|
|
46
|
+
| 'top-end'
|
|
47
|
+
| 'bottom-start'
|
|
48
|
+
| 'bottom-end'
|
|
49
|
+
| 'left-start'
|
|
50
|
+
| 'left-end'
|
|
51
|
+
| 'right-start'
|
|
52
|
+
| 'right-end';
|
|
39
53
|
}
|
|
40
54
|
|
|
41
55
|
interface ChipGroupState {
|
|
@@ -4,7 +4,6 @@ import { css } from '@patternfly/react-styles';
|
|
|
4
4
|
import { PickOptional } from '../../helpers/typeUtils';
|
|
5
5
|
import { PopoverPosition } from '../Popover';
|
|
6
6
|
import { TextInput } from '../TextInput';
|
|
7
|
-
import { TooltipPosition } from '../Tooltip';
|
|
8
7
|
import { GenerateId } from '../../helpers/GenerateId/GenerateId';
|
|
9
8
|
import { ClipboardCopyButton } from './ClipboardCopyButton';
|
|
10
9
|
import { ClipboardCopyToggle } from './ClipboardCopyToggle';
|
|
@@ -54,7 +53,21 @@ export interface ClipboardCopyProps extends Omit<React.HTMLProps<HTMLDivElement>
|
|
|
54
53
|
/** Adds Clipboard Copy variant styles. */
|
|
55
54
|
variant?: typeof ClipboardCopyVariant | 'inline' | 'expansion' | 'inline-compact';
|
|
56
55
|
/** Copy button popover position. */
|
|
57
|
-
position?:
|
|
56
|
+
position?:
|
|
57
|
+
| PopoverPosition
|
|
58
|
+
| 'auto'
|
|
59
|
+
| 'top'
|
|
60
|
+
| 'bottom'
|
|
61
|
+
| 'left'
|
|
62
|
+
| 'right'
|
|
63
|
+
| 'top-start'
|
|
64
|
+
| 'top-end'
|
|
65
|
+
| 'bottom-start'
|
|
66
|
+
| 'bottom-end'
|
|
67
|
+
| 'left-start'
|
|
68
|
+
| 'left-end'
|
|
69
|
+
| 'right-start'
|
|
70
|
+
| 'right-end';
|
|
58
71
|
/** Maximum width of the tooltip (default 150px). */
|
|
59
72
|
maxWidth?: string;
|
|
60
73
|
/** Delay in ms before the tooltip disappears. */
|
|
@@ -92,7 +105,7 @@ export class ClipboardCopy extends React.Component<ClipboardCopyProps, Clipboard
|
|
|
92
105
|
isExpanded: false,
|
|
93
106
|
isCode: false,
|
|
94
107
|
variant: 'inline',
|
|
95
|
-
position:
|
|
108
|
+
position: PopoverPosition.top,
|
|
96
109
|
maxWidth: '150px',
|
|
97
110
|
exitDelay: 1600,
|
|
98
111
|
entryDelay: 300,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import CopyIcon from '@patternfly/react-icons/dist/esm/icons/copy-icon';
|
|
3
3
|
import { Button } from '../Button';
|
|
4
|
-
import { Tooltip } from '../Tooltip';
|
|
4
|
+
import { Tooltip, TooltipPosition } from '../Tooltip';
|
|
5
5
|
|
|
6
6
|
export interface ClipboardCopyButtonProps
|
|
7
7
|
extends Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, 'ref'> {
|
|
@@ -23,6 +23,7 @@ export interface ClipboardCopyButtonProps
|
|
|
23
23
|
maxWidth?: string;
|
|
24
24
|
/** Position of the copy button tooltip */
|
|
25
25
|
position?:
|
|
26
|
+
| TooltipPosition
|
|
26
27
|
| 'auto'
|
|
27
28
|
| 'top'
|
|
28
29
|
| 'bottom'
|
|
@@ -3,7 +3,7 @@ import { useState } from 'react';
|
|
|
3
3
|
import styles from '@patternfly/react-styles/css/components/Label/label';
|
|
4
4
|
import labelGrpStyles from '@patternfly/react-styles/css/components/LabelGroup/label-group';
|
|
5
5
|
import { Button } from '../Button';
|
|
6
|
-
import { Tooltip } from '../Tooltip';
|
|
6
|
+
import { Tooltip, TooltipPosition } from '../Tooltip';
|
|
7
7
|
import { css } from '@patternfly/react-styles';
|
|
8
8
|
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
|
|
9
9
|
import { useIsomorphicLayoutEffect } from '../../helpers';
|
|
@@ -30,7 +30,21 @@ export interface LabelProps extends React.HTMLProps<HTMLSpanElement> {
|
|
|
30
30
|
/** Flag indicating the label text should be truncated. */
|
|
31
31
|
isTruncated?: boolean;
|
|
32
32
|
/** Position of the tooltip which is displayed if text is truncated */
|
|
33
|
-
tooltipPosition?:
|
|
33
|
+
tooltipPosition?:
|
|
34
|
+
| TooltipPosition
|
|
35
|
+
| 'auto'
|
|
36
|
+
| 'top'
|
|
37
|
+
| 'bottom'
|
|
38
|
+
| 'left'
|
|
39
|
+
| 'right'
|
|
40
|
+
| 'top-start'
|
|
41
|
+
| 'top-end'
|
|
42
|
+
| 'bottom-start'
|
|
43
|
+
| 'bottom-end'
|
|
44
|
+
| 'left-start'
|
|
45
|
+
| 'left-end'
|
|
46
|
+
| 'right-start'
|
|
47
|
+
| 'right-end';
|
|
34
48
|
/** Icon added to the left of the label text. */
|
|
35
49
|
icon?: React.ReactNode;
|
|
36
50
|
/** Close click callback for removable labels. If present, label will have a close button. */
|
|
@@ -164,7 +178,7 @@ export const Label: React.FunctionComponent<LabelProps> = ({
|
|
|
164
178
|
};
|
|
165
179
|
|
|
166
180
|
const LabelComponent = (isOverflowLabel ? 'button' : 'span') as any;
|
|
167
|
-
|
|
181
|
+
|
|
168
182
|
const button = closeBtn ? (
|
|
169
183
|
closeBtn
|
|
170
184
|
) : (
|
|
@@ -185,7 +199,7 @@ export const Label: React.FunctionComponent<LabelProps> = ({
|
|
|
185
199
|
useIsomorphicLayoutEffect(() => {
|
|
186
200
|
setIsTooltipVisible(textRef.current && textRef.current.offsetWidth < textRef.current.scrollWidth);
|
|
187
201
|
}, []);
|
|
188
|
-
|
|
202
|
+
const content = (
|
|
189
203
|
<React.Fragment>
|
|
190
204
|
{icon && <span className={css(styles.labelIcon)}>{icon}</span>}
|
|
191
205
|
{isTruncated && (
|
|
@@ -207,28 +221,30 @@ export const Label: React.FunctionComponent<LabelProps> = ({
|
|
|
207
221
|
setCurrValue(editableInputRef.current.value);
|
|
208
222
|
};
|
|
209
223
|
|
|
210
|
-
|
|
211
|
-
|
|
224
|
+
let labelComponentChild = <span className={css(styles.labelContent)}>{content}</span>;
|
|
225
|
+
|
|
226
|
+
if (href) {
|
|
227
|
+
labelComponentChild = (
|
|
228
|
+
<a className={css(styles.labelContent)} href={href}>
|
|
229
|
+
{content}
|
|
230
|
+
</a>
|
|
231
|
+
);
|
|
232
|
+
} else if (isEditable) {
|
|
233
|
+
labelComponentChild = (
|
|
212
234
|
<button
|
|
213
235
|
ref={editableButtonRef}
|
|
214
|
-
className={css(styles.
|
|
215
|
-
onClick={e => {
|
|
236
|
+
className={css(styles.labelContent)}
|
|
237
|
+
onClick={(e: React.MouseEvent) => {
|
|
216
238
|
setIsEditableActive(true);
|
|
217
239
|
e.stopPropagation();
|
|
218
240
|
}}
|
|
219
241
|
{...editableProps}
|
|
220
242
|
>
|
|
221
|
-
{
|
|
243
|
+
{content}
|
|
222
244
|
</button>
|
|
223
245
|
);
|
|
224
246
|
}
|
|
225
247
|
|
|
226
|
-
let labelComponentChild = (
|
|
227
|
-
<Component className={css(styles.labelContent)} {...(href && { href })}>
|
|
228
|
-
{content}
|
|
229
|
-
</Component>
|
|
230
|
-
);
|
|
231
|
-
|
|
232
248
|
if (render) {
|
|
233
249
|
labelComponentChild = (
|
|
234
250
|
<React.Fragment>
|
|
@@ -243,9 +259,7 @@ export const Label: React.FunctionComponent<LabelProps> = ({
|
|
|
243
259
|
} else if (isTooltipVisible) {
|
|
244
260
|
labelComponentChild = (
|
|
245
261
|
<Tooltip content={children} position={tooltipPosition}>
|
|
246
|
-
|
|
247
|
-
{content}
|
|
248
|
-
</Component>
|
|
262
|
+
{labelComponentChild}
|
|
249
263
|
</Tooltip>
|
|
250
264
|
);
|
|
251
265
|
}
|
|
@@ -268,7 +282,7 @@ export const Label: React.FunctionComponent<LabelProps> = ({
|
|
|
268
282
|
{!isEditableActive && onClose && button}
|
|
269
283
|
{isEditableActive && (
|
|
270
284
|
<input
|
|
271
|
-
className={css(styles.
|
|
285
|
+
className={css(styles.labelContent)}
|
|
272
286
|
type="text"
|
|
273
287
|
id="editable-input"
|
|
274
288
|
ref={editableInputRef}
|
|
@@ -72,12 +72,12 @@ test('editable label', () => {
|
|
|
72
72
|
onEditCancel={jest.fn()}
|
|
73
73
|
onEditComplete={jest.fn()}
|
|
74
74
|
isEditable>Something</Label>);
|
|
75
|
-
const button = view.find('button.pf-c-
|
|
75
|
+
const button = view.find('button.pf-c-label__content');
|
|
76
76
|
expect(button.length).toBe(1);
|
|
77
77
|
expect(view).toMatchSnapshot();
|
|
78
78
|
|
|
79
79
|
button.simulate('click');
|
|
80
|
-
const clickedButton = view.find('button.pf-c-
|
|
80
|
+
const clickedButton = view.find('button.pf-c-label__content');
|
|
81
81
|
expect(clickedButton.length).toBe(0);
|
|
82
82
|
expect(view).toMatchSnapshot();
|
|
83
83
|
});
|
|
@@ -10,16 +10,12 @@ exports[`editable label 1`] = `
|
|
|
10
10
|
<span
|
|
11
11
|
className="pf-c-label pf-m-editable"
|
|
12
12
|
>
|
|
13
|
-
<
|
|
13
|
+
<button
|
|
14
14
|
className="pf-c-label__content"
|
|
15
|
+
onClick={[Function]}
|
|
15
16
|
>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
onClick={[Function]}
|
|
19
|
-
>
|
|
20
|
-
Something
|
|
21
|
-
</button>
|
|
22
|
-
</span>
|
|
17
|
+
Something
|
|
18
|
+
</button>
|
|
23
19
|
<Button
|
|
24
20
|
aria-label="Close Something"
|
|
25
21
|
onClick={[MockFunction]}
|
|
@@ -87,7 +83,7 @@ exports[`editable label 2`] = `
|
|
|
87
83
|
className="pf-c-label pf-m-editable pf-m-editable-active"
|
|
88
84
|
>
|
|
89
85
|
<input
|
|
90
|
-
className="pf-c-
|
|
86
|
+
className="pf-c-label__content"
|
|
91
87
|
id="editable-input"
|
|
92
88
|
onChange={[Function]}
|
|
93
89
|
type="text"
|
|
@@ -4,7 +4,7 @@ import labelStyles from '@patternfly/react-styles/css/components/Label/label';
|
|
|
4
4
|
import { css } from '@patternfly/react-styles';
|
|
5
5
|
import { Button } from '../Button';
|
|
6
6
|
import { Label } from '../Label';
|
|
7
|
-
import { Tooltip } from '../Tooltip';
|
|
7
|
+
import { Tooltip, TooltipPosition } from '../Tooltip';
|
|
8
8
|
import TimesCircleIcon from '@patternfly/react-icons/dist/esm/icons/times-circle-icon';
|
|
9
9
|
import { fillTemplate } from '../../helpers';
|
|
10
10
|
import { GenerateId } from '../../helpers/GenerateId/GenerateId';
|
|
@@ -35,7 +35,21 @@ export interface LabelGroupProps extends React.HTMLProps<HTMLUListElement> {
|
|
|
35
35
|
/** Function that is called when clicking on the label group close button */
|
|
36
36
|
onClick?: (event: React.MouseEvent) => void;
|
|
37
37
|
/** Position of the tooltip which is displayed if the category name text is longer */
|
|
38
|
-
tooltipPosition?:
|
|
38
|
+
tooltipPosition?:
|
|
39
|
+
| TooltipPosition
|
|
40
|
+
| 'auto'
|
|
41
|
+
| 'top'
|
|
42
|
+
| 'bottom'
|
|
43
|
+
| 'left'
|
|
44
|
+
| 'right'
|
|
45
|
+
| 'top-start'
|
|
46
|
+
| 'top-end'
|
|
47
|
+
| 'bottom-start'
|
|
48
|
+
| 'bottom-end'
|
|
49
|
+
| 'left-start'
|
|
50
|
+
| 'left-end'
|
|
51
|
+
| 'right-start'
|
|
52
|
+
| 'right-end';
|
|
39
53
|
/** Flag to implement a vertical layout */
|
|
40
54
|
isVertical?: boolean;
|
|
41
55
|
/** @beta Flag indicating contained labels are editable. Allows spacing for a text input after the labels. */
|
|
@@ -6,7 +6,7 @@ import styles from '@patternfly/react-styles/css/components/NotificationDrawer/n
|
|
|
6
6
|
import maxLines from '@patternfly/react-tokens/dist/esm/c_notification_drawer__group_toggle_title_max_lines';
|
|
7
7
|
|
|
8
8
|
import { Badge } from '../Badge';
|
|
9
|
-
import { Tooltip } from '../Tooltip';
|
|
9
|
+
import { Tooltip, TooltipPosition } from '../Tooltip';
|
|
10
10
|
|
|
11
11
|
export interface NotificationDrawerGroupProps extends Omit<React.HTMLProps<HTMLDivElement>, 'title'> {
|
|
12
12
|
/** Content rendered inside the group */
|
|
@@ -26,7 +26,21 @@ export interface NotificationDrawerGroupProps extends Omit<React.HTMLProps<HTMLD
|
|
|
26
26
|
/** Truncate title to number of lines */
|
|
27
27
|
truncateTitle?: number;
|
|
28
28
|
/** Position of the tooltip which is displayed if text is truncated */
|
|
29
|
-
tooltipPosition?:
|
|
29
|
+
tooltipPosition?:
|
|
30
|
+
| TooltipPosition
|
|
31
|
+
| 'auto'
|
|
32
|
+
| 'top'
|
|
33
|
+
| 'bottom'
|
|
34
|
+
| 'left'
|
|
35
|
+
| 'right'
|
|
36
|
+
| 'top-start'
|
|
37
|
+
| 'top-end'
|
|
38
|
+
| 'bottom-start'
|
|
39
|
+
| 'bottom-end'
|
|
40
|
+
| 'left-start'
|
|
41
|
+
| 'left-end'
|
|
42
|
+
| 'right-start'
|
|
43
|
+
| 'right-end';
|
|
30
44
|
}
|
|
31
45
|
|
|
32
46
|
export const NotificationDrawerGroup: React.FunctionComponent<NotificationDrawerGroupProps> = ({
|
|
@@ -11,7 +11,7 @@ import a11yStyles from '@patternfly/react-styles/css/utilities/Accessibility/acc
|
|
|
11
11
|
|
|
12
12
|
import maxLines from '@patternfly/react-tokens/dist/esm/c_notification_drawer__list_item_header_title_max_lines';
|
|
13
13
|
|
|
14
|
-
import { Tooltip } from '../Tooltip';
|
|
14
|
+
import { Tooltip, TooltipPosition } from '../Tooltip';
|
|
15
15
|
|
|
16
16
|
export const variantIcons = {
|
|
17
17
|
success: CheckCircleIcon,
|
|
@@ -37,7 +37,21 @@ export interface NotificationDrawerListItemHeaderProps extends React.HTMLProps<H
|
|
|
37
37
|
/** Truncate title to number of lines */
|
|
38
38
|
truncateTitle?: number;
|
|
39
39
|
/** Position of the tooltip which is displayed if text is truncated */
|
|
40
|
-
tooltipPosition?:
|
|
40
|
+
tooltipPosition?:
|
|
41
|
+
| TooltipPosition
|
|
42
|
+
| 'auto'
|
|
43
|
+
| 'top'
|
|
44
|
+
| 'bottom'
|
|
45
|
+
| 'left'
|
|
46
|
+
| 'right'
|
|
47
|
+
| 'top-start'
|
|
48
|
+
| 'top-end'
|
|
49
|
+
| 'bottom-start'
|
|
50
|
+
| 'bottom-end'
|
|
51
|
+
| 'left-start'
|
|
52
|
+
| 'left-end'
|
|
53
|
+
| 'right-start'
|
|
54
|
+
| 'right-end';
|
|
41
55
|
}
|
|
42
56
|
|
|
43
57
|
export const NotificationDrawerListItemHeader: React.FunctionComponent<NotificationDrawerListItemHeaderProps> = ({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import progressStyle from '@patternfly/react-styles/css/components/Progress/progress';
|
|
3
3
|
import { css } from '@patternfly/react-styles';
|
|
4
|
-
import { Tooltip } from '../Tooltip';
|
|
4
|
+
import { Tooltip, TooltipPosition } from '../Tooltip';
|
|
5
5
|
import CheckCircleIcon from '@patternfly/react-icons/dist/esm/icons/check-circle-icon';
|
|
6
6
|
import TimesCircleIcon from '@patternfly/react-icons/dist/esm/icons/times-circle-icon';
|
|
7
7
|
import ExclamationTriangleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-triangle-icon';
|
|
@@ -38,7 +38,21 @@ export interface ProgressContainerProps extends Omit<React.HTMLProps<HTMLDivElem
|
|
|
38
38
|
/** Whether string title should be truncated */
|
|
39
39
|
isTitleTruncated?: boolean;
|
|
40
40
|
/** Position of the tooltip which is displayed if title is truncated */
|
|
41
|
-
tooltipPosition?:
|
|
41
|
+
tooltipPosition?:
|
|
42
|
+
| TooltipPosition
|
|
43
|
+
| 'auto'
|
|
44
|
+
| 'top'
|
|
45
|
+
| 'bottom'
|
|
46
|
+
| 'left'
|
|
47
|
+
| 'right'
|
|
48
|
+
| 'top-start'
|
|
49
|
+
| 'top-end'
|
|
50
|
+
| 'bottom-start'
|
|
51
|
+
| 'bottom-end'
|
|
52
|
+
| 'left-start'
|
|
53
|
+
| 'left-end'
|
|
54
|
+
| 'right-start'
|
|
55
|
+
| 'right-end';
|
|
42
56
|
}
|
|
43
57
|
|
|
44
58
|
const variantToIcon = {
|
|
@@ -87,7 +87,7 @@ export class SelectToggle extends React.Component<SelectToggleProps> {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
componentDidMount() {
|
|
90
|
-
document.addEventListener('click', this.onDocClick);
|
|
90
|
+
document.addEventListener('click', this.onDocClick, { capture: true });
|
|
91
91
|
document.addEventListener('touchstart', this.onDocClick);
|
|
92
92
|
document.addEventListener('keydown', this.handleGlobalKeys);
|
|
93
93
|
}
|
|
@@ -23,6 +23,8 @@ export interface TextInputGroupMainProps extends Omit<React.HTMLProps<HTMLDivEle
|
|
|
23
23
|
| 'tel'
|
|
24
24
|
| 'time'
|
|
25
25
|
| 'url';
|
|
26
|
+
/** Suggestion that will show up like a placeholder even with text in the input */
|
|
27
|
+
hint?: string;
|
|
26
28
|
/** Callback for when there is a change in the input field*/
|
|
27
29
|
onChange?: (value: string, event: React.FormEvent<HTMLInputElement>) => void;
|
|
28
30
|
/** Callback for when the input field is focused*/
|
|
@@ -42,6 +44,7 @@ export const TextInputGroupMain: React.FunctionComponent<TextInputGroupMainProps
|
|
|
42
44
|
className,
|
|
43
45
|
icon,
|
|
44
46
|
type = 'text',
|
|
47
|
+
hint,
|
|
45
48
|
onChange = (): any => undefined,
|
|
46
49
|
onFocus,
|
|
47
50
|
onBlur,
|
|
@@ -60,6 +63,15 @@ export const TextInputGroupMain: React.FunctionComponent<TextInputGroupMainProps
|
|
|
60
63
|
<div className={css(styles.textInputGroupMain, icon && styles.modifiers.icon, className)} {...props}>
|
|
61
64
|
{children}
|
|
62
65
|
<span className={css(styles.textInputGroupText)}>
|
|
66
|
+
{hint && (
|
|
67
|
+
<input
|
|
68
|
+
className={css(styles.textInputGroupTextInput, styles.modifiers.hint)}
|
|
69
|
+
type="text"
|
|
70
|
+
disabled
|
|
71
|
+
aria-hidden="true"
|
|
72
|
+
value={hint}
|
|
73
|
+
/>
|
|
74
|
+
)}
|
|
63
75
|
{icon && <span className={css(styles.textInputGroupIcon)}>{icon}</span>}
|
|
64
76
|
<input
|
|
65
77
|
type={type}
|
|
@@ -15,7 +15,15 @@ export enum TooltipPosition {
|
|
|
15
15
|
top = 'top',
|
|
16
16
|
bottom = 'bottom',
|
|
17
17
|
left = 'left',
|
|
18
|
-
right = 'right'
|
|
18
|
+
right = 'right',
|
|
19
|
+
topStart = 'top-start',
|
|
20
|
+
topEnd = 'top-end',
|
|
21
|
+
bottomStart = 'bottom-start',
|
|
22
|
+
bottomEnd = 'bottom-end',
|
|
23
|
+
leftStart = 'left-start',
|
|
24
|
+
leftEnd = 'left-end',
|
|
25
|
+
rightStart = 'right-start',
|
|
26
|
+
rightEnd = 'right-end'
|
|
19
27
|
}
|
|
20
28
|
|
|
21
29
|
export interface TooltipProps extends Omit<React.HTMLProps<HTMLDivElement>, 'content'> {
|
|
@@ -60,7 +68,22 @@ export interface TooltipProps extends Omit<React.HTMLProps<HTMLDivElement>, 'con
|
|
|
60
68
|
* ['top', 'right', 'left']. Since there is no space to the top, it checks if right is available. There's also no
|
|
61
69
|
* space to the right, so it finally shows the tooltip on the left.
|
|
62
70
|
*/
|
|
63
|
-
flipBehavior?:
|
|
71
|
+
flipBehavior?:
|
|
72
|
+
| 'flip'
|
|
73
|
+
| (
|
|
74
|
+
| 'top'
|
|
75
|
+
| 'bottom'
|
|
76
|
+
| 'left'
|
|
77
|
+
| 'right'
|
|
78
|
+
| 'top-start'
|
|
79
|
+
| 'top-end'
|
|
80
|
+
| 'bottom-start'
|
|
81
|
+
| 'bottom-end'
|
|
82
|
+
| 'left-start'
|
|
83
|
+
| 'left-end'
|
|
84
|
+
| 'right-start'
|
|
85
|
+
| 'right-end'
|
|
86
|
+
)[];
|
|
64
87
|
/** Maximum width of the tooltip (default 18.75rem) */
|
|
65
88
|
maxWidth?: string;
|
|
66
89
|
/**
|
|
@@ -71,6 +94,7 @@ export interface TooltipProps extends Omit<React.HTMLProps<HTMLDivElement>, 'con
|
|
|
71
94
|
* The 'auto' position requires the 'enableFlip' prop to be true.
|
|
72
95
|
*/
|
|
73
96
|
position?:
|
|
97
|
+
| TooltipPosition
|
|
74
98
|
| 'auto'
|
|
75
99
|
| 'top'
|
|
76
100
|
| 'bottom'
|
|
@@ -214,7 +238,15 @@ export const Tooltip: React.FunctionComponent<TooltipProps> = ({
|
|
|
214
238
|
top: styles.modifiers.top,
|
|
215
239
|
bottom: styles.modifiers.bottom,
|
|
216
240
|
left: styles.modifiers.left,
|
|
217
|
-
right: styles.modifiers.right
|
|
241
|
+
right: styles.modifiers.right,
|
|
242
|
+
'top-start': styles.modifiers.topLeft,
|
|
243
|
+
'top-end': styles.modifiers.topRight,
|
|
244
|
+
'bottom-start': styles.modifiers.bottomLeft,
|
|
245
|
+
'bottom-end': styles.modifiers.bottomRight,
|
|
246
|
+
'left-start': styles.modifiers.leftTop,
|
|
247
|
+
'left-end': styles.modifiers.leftBottom,
|
|
248
|
+
'right-start': styles.modifiers.rightTop,
|
|
249
|
+
'right-end': styles.modifiers.rightBottom
|
|
218
250
|
};
|
|
219
251
|
const hasCustomMaxWidth = maxWidth !== tooltipMaxWidth.value;
|
|
220
252
|
const content = (
|