@patternfly/react-core 4.194.3 → 4.195.0
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 +11 -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.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/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.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/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.js +619 -602
- package/dist/umd/react-core.min.js +2 -2
- package/package.json +5 -5
- 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 +16 -2
- 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/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.0",
|
|
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,9 +34,9 @@
|
|
|
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.0",
|
|
38
|
+
"@patternfly/react-styles": "^4.45.0",
|
|
39
|
+
"@patternfly/react-tokens": "^4.47.0",
|
|
40
40
|
"focus-trap": "6.2.2",
|
|
41
41
|
"react-dropzone": "9.0.0",
|
|
42
42
|
"tippy.js": "5.1.2",
|
|
@@ -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": "313838eb78479aa8ba62194a6d656b5abd611c3f"
|
|
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. */
|
|
@@ -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 = {
|
|
@@ -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 = (
|
|
@@ -52,9 +52,17 @@ exports[`Tooltip should match snapshot (auto-generated) 1`] = `
|
|
|
52
52
|
positionModifiers={
|
|
53
53
|
Object {
|
|
54
54
|
"bottom": "pf-m-bottom",
|
|
55
|
+
"bottom-end": "pf-m-bottom-right",
|
|
56
|
+
"bottom-start": "pf-m-bottom-left",
|
|
55
57
|
"left": "pf-m-left",
|
|
58
|
+
"left-end": "pf-m-left-bottom",
|
|
59
|
+
"left-start": "pf-m-left-top",
|
|
56
60
|
"right": "pf-m-right",
|
|
61
|
+
"right-end": "pf-m-right-bottom",
|
|
62
|
+
"right-start": "pf-m-right-top",
|
|
57
63
|
"top": "pf-m-top",
|
|
64
|
+
"top-end": "pf-m-top-right",
|
|
65
|
+
"top-start": "pf-m-top-left",
|
|
58
66
|
}
|
|
59
67
|
}
|
|
60
68
|
trigger={
|
|
@@ -52,9 +52,17 @@ exports[`tooltip renders 1`] = `
|
|
|
52
52
|
positionModifiers={
|
|
53
53
|
Object {
|
|
54
54
|
"bottom": "pf-m-bottom",
|
|
55
|
+
"bottom-end": "pf-m-bottom-right",
|
|
56
|
+
"bottom-start": "pf-m-bottom-left",
|
|
55
57
|
"left": "pf-m-left",
|
|
58
|
+
"left-end": "pf-m-left-bottom",
|
|
59
|
+
"left-start": "pf-m-left-top",
|
|
56
60
|
"right": "pf-m-right",
|
|
61
|
+
"right-end": "pf-m-right-bottom",
|
|
62
|
+
"right-start": "pf-m-right-top",
|
|
57
63
|
"top": "pf-m-top",
|
|
64
|
+
"top-end": "pf-m-top-right",
|
|
65
|
+
"top-start": "pf-m-top-left",
|
|
58
66
|
}
|
|
59
67
|
}
|
|
60
68
|
trigger={
|
|
@@ -195,6 +195,14 @@ OptionsTooltip = () => {
|
|
|
195
195
|
<SelectOption value="bottom" />
|
|
196
196
|
<SelectOption value="left" />
|
|
197
197
|
<SelectOption value="right" />
|
|
198
|
+
<SelectOption value="top-start" />
|
|
199
|
+
<SelectOption value="top-end" />
|
|
200
|
+
<SelectOption value="bottom-start" />
|
|
201
|
+
<SelectOption value="bottom-end" />
|
|
202
|
+
<SelectOption value="left-start" />
|
|
203
|
+
<SelectOption value="left-end" />
|
|
204
|
+
<SelectOption value="right-start" />
|
|
205
|
+
<SelectOption value="right-end" />
|
|
198
206
|
</Select>
|
|
199
207
|
</div>
|
|
200
208
|
<div style={{ border: '1px solid'}}>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import styles from '@patternfly/react-styles/css/components/Truncate/truncate';
|
|
3
3
|
import { css } from '@patternfly/react-styles';
|
|
4
|
-
import { Tooltip } from '../Tooltip';
|
|
4
|
+
import { Tooltip, TooltipPosition } from '../Tooltip';
|
|
5
5
|
|
|
6
6
|
export enum TruncatePosition {
|
|
7
7
|
start = 'start',
|
|
@@ -26,7 +26,21 @@ interface TruncateProps extends React.HTMLProps<HTMLSpanElement> {
|
|
|
26
26
|
/** Where the text will be truncated */
|
|
27
27
|
position?: 'start' | 'middle' | 'end';
|
|
28
28
|
/** Tooltip position */
|
|
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
|
const sliceContent = (str: string, slice: number) => [str.slice(0, str.length - slice), str.slice(-slice)];
|
|
@@ -26,7 +26,7 @@ Attributes can be deselected (returning you to attribute selection mode) by hitt
|
|
|
26
26
|
|
|
27
27
|
```ts file="./examples/TextInputGroup/AttributeValueFiltering.tsx"
|
|
28
28
|
```
|
|
29
|
-
### Auto-complete search
|
|
29
|
+
### Auto-complete search with typeahead
|
|
30
30
|
|
|
31
31
|
This demo showcases a search input with suggestions, which filters possible selections based on the text you've entered. Unlike the attribute-value filtering demo, it allows creation of new chip items when the text entered is not available in the list of suggestions.
|
|
32
32
|
|
|
@@ -34,7 +34,7 @@ The current text in the input can be converted to a chip at any time by hitting
|
|
|
34
34
|
|
|
35
35
|
Hitting `escape` while focused on the input or menu will close the menu, and the menu will reopen when text is entered.
|
|
36
36
|
|
|
37
|
-
When only one item remains in the suggestion list, tab can be used to auto-complete the typing of that item.
|
|
37
|
+
When only one item remains in the suggestion list, a typeahead hint will show and tab can be used to auto-complete the typing of that item.
|
|
38
38
|
|
|
39
39
|
```ts file="./examples/TextInputGroup/AutoCompleteSearch.tsx"
|
|
40
40
|
```
|
|
@@ -20,6 +20,7 @@ export const AutoCompleteSearch: React.FunctionComponent = () => {
|
|
|
20
20
|
const [inputValue, setInputValue] = React.useState('');
|
|
21
21
|
const [menuIsOpen, setMenuIsOpen] = React.useState(false);
|
|
22
22
|
const [currentChips, setCurrentChips] = React.useState<string[]>([]);
|
|
23
|
+
const [hint, setHint] = React.useState('');
|
|
23
24
|
|
|
24
25
|
/** auto-completing suggestion text items to be shown in the menu */
|
|
25
26
|
const suggestionItems = ['Cluster', 'Kind', 'Label', 'Name', 'Namespace', 'Status'];
|
|
@@ -64,9 +65,24 @@ export const AutoCompleteSearch: React.FunctionComponent = () => {
|
|
|
64
65
|
</MenuItem>
|
|
65
66
|
);
|
|
66
67
|
setMenuItems([noResultItem]);
|
|
68
|
+
setHint('');
|
|
67
69
|
return;
|
|
68
70
|
}
|
|
69
71
|
|
|
72
|
+
/** The hint is set whenever there is only one autocomplete option left. */
|
|
73
|
+
if (filteredMenuItems.length === 1) {
|
|
74
|
+
const hint = filteredMenuItems[0].props.children;
|
|
75
|
+
if (hint.toLowerCase().indexOf(inputValue.toLowerCase())) {
|
|
76
|
+
// the match was found in a place other than the start, so typeahead wouldn't work right
|
|
77
|
+
setHint('');
|
|
78
|
+
} else {
|
|
79
|
+
// use the input for the first part, otherwise case difference could make things look wrong
|
|
80
|
+
setHint(inputValue + hint.substr(inputValue.length));
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
setHint('');
|
|
84
|
+
}
|
|
85
|
+
|
|
70
86
|
/** add a heading to the menu */
|
|
71
87
|
const headingItem = (
|
|
72
88
|
<MenuItem isDisabled key="heading">
|
|
@@ -195,6 +211,7 @@ export const AutoCompleteSearch: React.FunctionComponent = () => {
|
|
|
195
211
|
<TextInputGroupMain
|
|
196
212
|
icon={showSearchIcon && <SearchIcon />}
|
|
197
213
|
value={inputValue}
|
|
214
|
+
hint={hint}
|
|
198
215
|
onChange={handleInputChange}
|
|
199
216
|
onFocus={() => setMenuIsOpen(true)}
|
|
200
217
|
onKeyDown={handleTextInputKeyDown}
|