@patternfly/react-core 4.237.4 → 4.237.7
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 +27 -0
- package/dist/esm/components/Checkbox/Checkbox.d.ts +7 -5
- package/dist/esm/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/esm/components/Checkbox/Checkbox.js +7 -3
- package/dist/esm/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/esm/components/MenuToggle/MenuToggle.d.ts.map +1 -1
- package/dist/esm/components/MenuToggle/MenuToggle.js +1 -1
- package/dist/esm/components/MenuToggle/MenuToggle.js.map +1 -1
- package/dist/esm/components/TextArea/TextArea.d.ts +3 -0
- package/dist/esm/components/TextArea/TextArea.d.ts.map +1 -1
- package/dist/esm/components/TextArea/TextArea.js +21 -10
- package/dist/esm/components/TextArea/TextArea.js.map +1 -1
- package/dist/js/components/Checkbox/Checkbox.d.ts +7 -5
- package/dist/js/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/js/components/Checkbox/Checkbox.js +7 -3
- package/dist/js/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/js/components/MenuToggle/MenuToggle.d.ts.map +1 -1
- package/dist/js/components/MenuToggle/MenuToggle.js +1 -1
- package/dist/js/components/MenuToggle/MenuToggle.js.map +1 -1
- package/dist/js/components/TextArea/TextArea.d.ts +3 -0
- package/dist/js/components/TextArea/TextArea.d.ts.map +1 -1
- package/dist/js/components/TextArea/TextArea.js +21 -10
- package/dist/js/components/TextArea/TextArea.js.map +1 -1
- package/dist/umd/react-core.min.css +2329 -2329
- package/dist/umd/react-core.min.js +4 -4
- package/package.json +5 -5
- package/src/components/Button/examples/Button.md +3 -15
- package/src/components/Button/examples/ButtonAriaDisabled.tsx +15 -2
- package/src/components/Checkbox/Checkbox.tsx +16 -5
- package/src/components/Checkbox/examples/Checkbox.md +5 -0
- package/src/components/Checkbox/examples/CheckboxRequired.tsx +6 -0
- package/src/components/MenuToggle/MenuToggle.tsx +1 -0
- package/src/components/MenuToggle/__tests__/MenuToggle.test.tsx +27 -1
- package/src/components/TextArea/TextArea.tsx +26 -12
- package/src/components/TextArea/examples/TextArea.md +47 -21
- package/src/components/TreeView/examples/TreeView.md +37 -19
- package/src/components/Button/examples/ButtonAriaDisabledLinkTooltip.tsx +0 -10
- package/src/components/Button/examples/ButtonAriaDisabledTooltip.tsx +0 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.237.
|
|
3
|
+
"version": "4.237.7",
|
|
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",
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"generate": "node scripts/copyStyles.js"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@patternfly/react-icons": "^4.88.
|
|
48
|
-
"@patternfly/react-styles": "^4.87.
|
|
49
|
-
"@patternfly/react-tokens": "^4.89.
|
|
47
|
+
"@patternfly/react-icons": "^4.88.7",
|
|
48
|
+
"@patternfly/react-styles": "^4.87.7",
|
|
49
|
+
"@patternfly/react-tokens": "^4.89.7",
|
|
50
50
|
"focus-trap": "6.9.2",
|
|
51
51
|
"react-dropzone": "9.0.0",
|
|
52
52
|
"tippy.js": "5.1.2",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"react": "^16.8.0 || ^17.0.0",
|
|
71
71
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "6a8c488ab5de48d31ab8070271ebf17f9e6a625a"
|
|
74
74
|
}
|
|
@@ -96,21 +96,9 @@ Router links can be used for in-app linking in React environments to prevent pag
|
|
|
96
96
|
|
|
97
97
|
Buttons that are aria-disabled are similar to normal disabled buttons, except they can receive focus. Every button variant can be aria-disabled using the `isAriaDisabled` property.
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### Aria-disabled with tooltip
|
|
103
|
-
|
|
104
|
-
Unlike normal disabled buttons, aria-disabled buttons can support tooltips.
|
|
105
|
-
|
|
106
|
-
```ts file="./ButtonAriaDisabledTooltip.tsx"
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### Aria-disabled link as button with tooltip
|
|
110
|
-
|
|
111
|
-
Aria-disabled buttons can operate as links, which also support tooltips.
|
|
99
|
+
Unlike normal disabled buttons, aria-disabled buttons can support tooltips. Furthermore, aria-disabled buttons can operate as links, which also support tooltips.
|
|
112
100
|
|
|
113
|
-
```ts file="./
|
|
101
|
+
```ts file="./ButtonAriaDisabled.tsx"
|
|
114
102
|
```
|
|
115
103
|
|
|
116
104
|
### Button with count
|
|
@@ -118,4 +106,4 @@ Aria-disabled buttons can operate as links, which also support tooltips.
|
|
|
118
106
|
Buttons can display a `count` in the form of a badge to indicate some value or number by passing in the `countOptions` prop as a `BadgeCountObject` object. The `BadgeCountObject` object will handle `count`, `isRead`, and `className` props for the badge count.
|
|
119
107
|
|
|
120
108
|
```ts file="./ButtonWithCount.tsx" isBeta
|
|
121
|
-
```
|
|
109
|
+
```
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Button } from '@patternfly/react-core';
|
|
2
|
+
import { Button, Tooltip } from '@patternfly/react-core';
|
|
3
3
|
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
|
|
4
4
|
import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';
|
|
5
5
|
|
|
6
6
|
export const ButtonAriaDisabled: React.FunctionComponent = () => (
|
|
7
7
|
<React.Fragment>
|
|
8
|
-
<Button isAriaDisabled>Primary aria disabled</Button>
|
|
8
|
+
<Button isAriaDisabled>Primary aria disabled</Button>
|
|
9
|
+
<Button isAriaDisabled>Secondary aria disabled</Button>{' '}
|
|
9
10
|
<Button variant="secondary" isDanger isAriaDisabled>
|
|
10
11
|
Danger secondary aria disabled
|
|
11
12
|
</Button>{' '}
|
|
@@ -35,5 +36,17 @@ export const ButtonAriaDisabled: React.FunctionComponent = () => (
|
|
|
35
36
|
<Button isAriaDisabled variant="control">
|
|
36
37
|
Control aria disabled
|
|
37
38
|
</Button>
|
|
39
|
+
<br />
|
|
40
|
+
<br />
|
|
41
|
+
<Tooltip content="Aria-disabled buttons are like disabled buttons, but focusable. Allows for tooltip support.">
|
|
42
|
+
<Button isAriaDisabled variant="secondary">
|
|
43
|
+
Secondary button to core docs
|
|
44
|
+
</Button>
|
|
45
|
+
</Tooltip>{' '}
|
|
46
|
+
<Tooltip content="Aria-disabled link as button with tooltip">
|
|
47
|
+
<Button component="a" isAriaDisabled href="https://pf4.patternfly.org/" target="_blank" variant="tertiary">
|
|
48
|
+
Tertiary link as button to core docs
|
|
49
|
+
</Button>
|
|
50
|
+
</Tooltip>
|
|
38
51
|
</React.Fragment>
|
|
39
52
|
);
|
|
@@ -3,20 +3,23 @@ import styles from '@patternfly/react-styles/css/components/Check/check';
|
|
|
3
3
|
import { css } from '@patternfly/react-styles';
|
|
4
4
|
import { PickOptional } from '../../helpers/typeUtils';
|
|
5
5
|
import { getDefaultOUIAId, getOUIAProps, OUIAProps } from '../../helpers';
|
|
6
|
+
import { ASTERISK } from '../../helpers/htmlConstants';
|
|
6
7
|
|
|
7
8
|
export interface CheckboxProps
|
|
8
9
|
extends Omit<React.HTMLProps<HTMLInputElement>, 'type' | 'onChange' | 'disabled' | 'label'>,
|
|
9
10
|
OUIAProps {
|
|
10
|
-
/** Additional classes added to the
|
|
11
|
+
/** Additional classes added to the checkbox. */
|
|
11
12
|
className?: string;
|
|
12
|
-
/** Flag to show if the
|
|
13
|
+
/** Flag to show if the checkbox selection is valid or invalid. */
|
|
13
14
|
isValid?: boolean;
|
|
14
|
-
/** Flag to show if the
|
|
15
|
+
/** Flag to show if the checkbox is disabled. */
|
|
15
16
|
isDisabled?: boolean;
|
|
16
|
-
/** Flag to show if the
|
|
17
|
+
/** Flag to show if the checkbox is required. */
|
|
18
|
+
isRequired?: boolean;
|
|
19
|
+
/** Flag to show if the checkbox is checked. If null, the checkbox will be indeterminate (partially checked). */
|
|
17
20
|
isChecked?: boolean | null;
|
|
18
21
|
checked?: boolean;
|
|
19
|
-
/** A callback for when the
|
|
22
|
+
/** A callback for when the checkbox selection changes. */
|
|
20
23
|
onChange?: (checked: boolean, event: React.FormEvent<HTMLInputElement>) => void;
|
|
21
24
|
/** Label text of the checkbox. */
|
|
22
25
|
label?: React.ReactNode;
|
|
@@ -45,6 +48,7 @@ export class Checkbox extends React.Component<CheckboxProps, CheckboxState> {
|
|
|
45
48
|
className: '',
|
|
46
49
|
isValid: true,
|
|
47
50
|
isDisabled: false,
|
|
51
|
+
isRequired: false,
|
|
48
52
|
isChecked: false,
|
|
49
53
|
onChange: defaultOnChange,
|
|
50
54
|
ouiaSafe: true,
|
|
@@ -69,6 +73,7 @@ export class Checkbox extends React.Component<CheckboxProps, CheckboxState> {
|
|
|
69
73
|
onChange,
|
|
70
74
|
isValid,
|
|
71
75
|
isDisabled,
|
|
76
|
+
isRequired,
|
|
72
77
|
isChecked,
|
|
73
78
|
label,
|
|
74
79
|
checked,
|
|
@@ -106,6 +111,7 @@ export class Checkbox extends React.Component<CheckboxProps, CheckboxState> {
|
|
|
106
111
|
aria-invalid={!isValid}
|
|
107
112
|
aria-label={ariaLabel}
|
|
108
113
|
disabled={isDisabled}
|
|
114
|
+
required={isRequired}
|
|
109
115
|
ref={elem => elem && (elem.indeterminate = isChecked === null)}
|
|
110
116
|
{...checkedProps}
|
|
111
117
|
{...getOUIAProps(Checkbox.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId, ouiaSafe)}
|
|
@@ -113,6 +119,11 @@ export class Checkbox extends React.Component<CheckboxProps, CheckboxState> {
|
|
|
113
119
|
{label && (
|
|
114
120
|
<label className={css(styles.checkLabel, isDisabled && styles.modifiers.disabled)} htmlFor={props.id}>
|
|
115
121
|
{label}
|
|
122
|
+
{isRequired && (
|
|
123
|
+
<span className={css(styles.checkLabelRequired)} aria-hidden="true">
|
|
124
|
+
{ASTERISK}
|
|
125
|
+
</span>
|
|
126
|
+
)}
|
|
116
127
|
</label>
|
|
117
128
|
)}
|
|
118
129
|
{description && <span className={css(styles.checkDescription)}>{description}</span>}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
2
|
import { MenuToggle } from '../MenuToggle';
|
|
3
|
+
import { MenuToggleCheckbox } from '../MenuToggleCheckbox';
|
|
4
4
|
import { Badge } from '../../Badge';
|
|
5
5
|
import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
|
|
6
6
|
import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
|
|
7
|
+
import userEvent from '@testing-library/user-event';
|
|
8
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
7
9
|
|
|
8
10
|
describe('menu toggle', () => {
|
|
9
11
|
test('renders successfully', () => {
|
|
@@ -54,4 +56,28 @@ describe('menu toggle', () => {
|
|
|
54
56
|
const { asFragment } = render(<MenuToggle badge={<Badge>badge</Badge>}>Toggle</MenuToggle>);
|
|
55
57
|
expect(asFragment()).toMatchSnapshot();
|
|
56
58
|
});
|
|
59
|
+
|
|
60
|
+
test('split toggle passes onClick', async () => {
|
|
61
|
+
const mockClick = jest.fn();
|
|
62
|
+
const user = userEvent.setup();
|
|
63
|
+
|
|
64
|
+
render(<MenuToggle
|
|
65
|
+
onClick={mockClick}
|
|
66
|
+
splitButtonOptions={{
|
|
67
|
+
items: [
|
|
68
|
+
<MenuToggleCheckbox
|
|
69
|
+
id="split-button-checkbox-with-text-disabled-example"
|
|
70
|
+
key="split-checkbox-with-text-disabled"
|
|
71
|
+
aria-label="Select all"
|
|
72
|
+
>
|
|
73
|
+
10 selected
|
|
74
|
+
</MenuToggleCheckbox>
|
|
75
|
+
]
|
|
76
|
+
}}
|
|
77
|
+
aria-label="Menu toggle with checkbox split button and text"
|
|
78
|
+
/>);
|
|
79
|
+
|
|
80
|
+
await user.click(screen.getByRole(`button`) as Element);
|
|
81
|
+
expect(mockClick).toHaveBeenCalled();
|
|
82
|
+
});
|
|
57
83
|
});
|
|
@@ -54,6 +54,21 @@ export class TextAreaBase extends React.Component<TextAreaProps> {
|
|
|
54
54
|
'aria-label': null as string
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
+
inputRef = React.createRef<HTMLTextAreaElement>();
|
|
58
|
+
|
|
59
|
+
private setAutoHeight = (field: HTMLTextAreaElement) => {
|
|
60
|
+
field.style.setProperty(heightToken.name, 'inherit');
|
|
61
|
+
const computed = window.getComputedStyle(field);
|
|
62
|
+
// Calculate the height
|
|
63
|
+
const height =
|
|
64
|
+
parseInt(computed.getPropertyValue('border-top-width')) +
|
|
65
|
+
parseInt(computed.getPropertyValue('padding-top')) +
|
|
66
|
+
field.scrollHeight +
|
|
67
|
+
parseInt(computed.getPropertyValue('padding-bottom')) +
|
|
68
|
+
parseInt(computed.getPropertyValue('border-bottom-width'));
|
|
69
|
+
field.style.setProperty(heightToken.name, `${height}px`);
|
|
70
|
+
};
|
|
71
|
+
|
|
57
72
|
constructor(props: TextAreaProps) {
|
|
58
73
|
super(props);
|
|
59
74
|
if (!props.id && !props['aria-label']) {
|
|
@@ -62,20 +77,19 @@ export class TextAreaBase extends React.Component<TextAreaProps> {
|
|
|
62
77
|
}
|
|
63
78
|
}
|
|
64
79
|
|
|
80
|
+
componentDidMount(): void {
|
|
81
|
+
const inputRef = this.props.innerRef || this.inputRef;
|
|
82
|
+
if (this.props.autoResize && canUseDOM) {
|
|
83
|
+
const field = inputRef.current;
|
|
84
|
+
this.setAutoHeight(field);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
65
88
|
private handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
66
89
|
// https://gomakethings.com/automatically-expand-a-textarea-as-the-user-types-using-vanilla-javascript/
|
|
67
90
|
const field = event.currentTarget;
|
|
68
91
|
if (this.props.autoResize && canUseDOM) {
|
|
69
|
-
|
|
70
|
-
const computed = window.getComputedStyle(field);
|
|
71
|
-
// Calculate the height
|
|
72
|
-
const height =
|
|
73
|
-
parseInt(computed.getPropertyValue('border-top-width')) +
|
|
74
|
-
parseInt(computed.getPropertyValue('padding-top')) +
|
|
75
|
-
field.scrollHeight +
|
|
76
|
-
parseInt(computed.getPropertyValue('padding-bottom')) +
|
|
77
|
-
parseInt(computed.getPropertyValue('border-bottom-width'));
|
|
78
|
-
field.style.setProperty(heightToken.name, `${height}px`);
|
|
92
|
+
this.setAutoHeight(field);
|
|
79
93
|
}
|
|
80
94
|
if (this.props.onChange) {
|
|
81
95
|
this.props.onChange(field.value, event);
|
|
@@ -118,14 +132,14 @@ export class TextAreaBase extends React.Component<TextAreaProps> {
|
|
|
118
132
|
required={isRequired}
|
|
119
133
|
disabled={isDisabled || disabled}
|
|
120
134
|
readOnly={isReadOnly || readOnly}
|
|
121
|
-
ref={innerRef}
|
|
135
|
+
ref={innerRef || this.inputRef}
|
|
122
136
|
{...props}
|
|
123
137
|
/>
|
|
124
138
|
);
|
|
125
139
|
}
|
|
126
140
|
}
|
|
127
141
|
|
|
128
|
-
export const TextArea = React.forwardRef
|
|
142
|
+
export const TextArea = React.forwardRef((props: TextAreaProps, ref: React.Ref<HTMLTextAreaElement>) => (
|
|
129
143
|
<TextAreaBase {...props} innerRef={ref as React.MutableRefObject<any>} />
|
|
130
144
|
));
|
|
131
145
|
TextArea.displayName = 'TextArea';
|
|
@@ -6,7 +6,9 @@ propComponents: ['TextArea']
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
## Examples
|
|
9
|
+
|
|
9
10
|
### Basic
|
|
11
|
+
|
|
10
12
|
```js
|
|
11
13
|
import React from 'react';
|
|
12
14
|
import { TextArea } from '@patternfly/react-core';
|
|
@@ -32,6 +34,7 @@ class SimpleTextArea extends React.Component {
|
|
|
32
34
|
```
|
|
33
35
|
|
|
34
36
|
### Invalid
|
|
37
|
+
|
|
35
38
|
```js
|
|
36
39
|
import React from 'react';
|
|
37
40
|
import { TextArea } from '@patternfly/react-core';
|
|
@@ -42,7 +45,7 @@ class InvalidTextArea extends React.Component {
|
|
|
42
45
|
this.state = {
|
|
43
46
|
value: ''
|
|
44
47
|
};
|
|
45
|
-
|
|
48
|
+
|
|
46
49
|
this.handleInvalidTextAreaChange = value => {
|
|
47
50
|
this.setState({ value });
|
|
48
51
|
};
|
|
@@ -65,6 +68,7 @@ class InvalidTextArea extends React.Component {
|
|
|
65
68
|
```
|
|
66
69
|
|
|
67
70
|
### Validated
|
|
71
|
+
|
|
68
72
|
```js
|
|
69
73
|
import React from 'react';
|
|
70
74
|
import { Form, FormGroup, TextArea } from '@patternfly/react-core';
|
|
@@ -78,28 +82,30 @@ class InvalidTextArea extends React.Component {
|
|
|
78
82
|
validated: 'default',
|
|
79
83
|
helperText: 'Share your thoughts.'
|
|
80
84
|
};
|
|
81
|
-
|
|
85
|
+
|
|
82
86
|
this.simulateNetworkCall = callback => {
|
|
83
87
|
setTimeout(callback, 2000);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
this.handleTextAreaChange = value => {
|
|
88
|
+
};
|
|
87
89
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
this.handleTextAreaChange = value => {
|
|
91
|
+
this.setState(
|
|
92
|
+
{
|
|
93
|
+
value,
|
|
94
|
+
validated: 'default',
|
|
95
|
+
helperText: 'Validating...'
|
|
96
|
+
},
|
|
93
97
|
this.simulateNetworkCall(() => {
|
|
94
98
|
if (value && value.length > 0) {
|
|
95
99
|
if (value.length >= 10) {
|
|
96
|
-
this.setState({validated: 'success', helperText: 'Thanks for your comments!'});
|
|
100
|
+
this.setState({ validated: 'success', helperText: 'Thanks for your comments!' });
|
|
97
101
|
} else {
|
|
98
|
-
this.setState({
|
|
102
|
+
this.setState({
|
|
103
|
+
validated: 'error',
|
|
104
|
+
invalidText: 'Your being too brief, please enter at least 10 characters.'
|
|
105
|
+
});
|
|
99
106
|
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
this.setState({validated: 'warning', helperText: 'You must have something to say'});
|
|
107
|
+
} else {
|
|
108
|
+
this.setState({ validated: 'warning', helperText: 'You must have something to say' });
|
|
103
109
|
}
|
|
104
110
|
})
|
|
105
111
|
);
|
|
@@ -134,6 +140,7 @@ class InvalidTextArea extends React.Component {
|
|
|
134
140
|
```
|
|
135
141
|
|
|
136
142
|
### Vertically resizable text area
|
|
143
|
+
|
|
137
144
|
```js
|
|
138
145
|
import React from 'react';
|
|
139
146
|
import { TextArea } from '@patternfly/react-core';
|
|
@@ -153,12 +160,20 @@ class VerticalResizeTextArea extends React.Component {
|
|
|
153
160
|
render() {
|
|
154
161
|
const { value } = this.state;
|
|
155
162
|
|
|
156
|
-
return
|
|
163
|
+
return (
|
|
164
|
+
<TextArea
|
|
165
|
+
value={value}
|
|
166
|
+
onChange={this.handleTextAreaChange}
|
|
167
|
+
resizeOrientation="vertical"
|
|
168
|
+
aria-label="text vertical resize example"
|
|
169
|
+
/>
|
|
170
|
+
);
|
|
157
171
|
}
|
|
158
172
|
}
|
|
159
173
|
```
|
|
160
174
|
|
|
161
175
|
### Horizontally resizable text area
|
|
176
|
+
|
|
162
177
|
```js
|
|
163
178
|
import React from 'react';
|
|
164
179
|
import { TextArea } from '@patternfly/react-core';
|
|
@@ -178,33 +193,43 @@ class HorizontalResizeTextArea extends React.Component {
|
|
|
178
193
|
render() {
|
|
179
194
|
const { value } = this.state;
|
|
180
195
|
|
|
181
|
-
return
|
|
196
|
+
return (
|
|
197
|
+
<TextArea
|
|
198
|
+
value={value}
|
|
199
|
+
onChange={this.handleTextAreaChange}
|
|
200
|
+
resizeOrientation="horizontal"
|
|
201
|
+
aria-label="text horizontal resize example"
|
|
202
|
+
/>
|
|
203
|
+
);
|
|
182
204
|
}
|
|
183
205
|
}
|
|
184
206
|
```
|
|
185
207
|
|
|
186
208
|
### Uncontrolled
|
|
209
|
+
|
|
187
210
|
```js
|
|
188
211
|
import React from 'react';
|
|
189
212
|
import { TextArea } from '@patternfly/react-core';
|
|
190
213
|
|
|
191
|
-
<TextArea defaultValue="default value" aria-label="uncontrolled text area example"
|
|
214
|
+
<TextArea defaultValue="default value" aria-label="uncontrolled text area example" />;
|
|
192
215
|
```
|
|
193
216
|
|
|
194
217
|
### Disabled
|
|
218
|
+
|
|
195
219
|
```js
|
|
196
220
|
import React from 'react';
|
|
197
221
|
import { TextArea } from '@patternfly/react-core';
|
|
198
222
|
|
|
199
|
-
<TextArea aria-label="disabled text area example" isDisabled
|
|
223
|
+
<TextArea aria-label="disabled text area example" isDisabled />;
|
|
200
224
|
```
|
|
201
225
|
|
|
202
226
|
### Auto resizing
|
|
227
|
+
|
|
203
228
|
```js
|
|
204
229
|
import React from 'react';
|
|
205
230
|
import { TextArea } from '@patternfly/react-core';
|
|
206
231
|
|
|
207
|
-
<TextArea aria-label="auto resizing text area example" autoResize
|
|
232
|
+
<TextArea aria-label="auto resizing text area example" autoResize />;
|
|
208
233
|
```
|
|
209
234
|
|
|
210
235
|
### Icon sprite variants
|
|
@@ -249,4 +274,5 @@ IconSpriteTextArea = () => {
|
|
|
249
274
|
/>
|
|
250
275
|
</>
|
|
251
276
|
);
|
|
252
|
-
};
|
|
277
|
+
};
|
|
278
|
+
```
|
|
@@ -20,12 +20,15 @@ class DefaultTreeView extends React.Component {
|
|
|
20
20
|
constructor(props) {
|
|
21
21
|
super(props);
|
|
22
22
|
|
|
23
|
-
this.state = { activeItems:
|
|
23
|
+
this.state = { activeItems: [], allExpanded: null };
|
|
24
24
|
|
|
25
25
|
this.onSelect = (evt, treeViewItem) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
// Ignore folders for selection
|
|
27
|
+
if (treeViewItem && !treeViewItem.children) {
|
|
28
|
+
this.setState({
|
|
29
|
+
activeItems: [treeViewItem]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
29
32
|
};
|
|
30
33
|
|
|
31
34
|
this.onToggle = evt => {
|
|
@@ -288,9 +291,12 @@ class SearchTreeView extends React.Component {
|
|
|
288
291
|
this.state = { activeItems: {}, filteredItems: this.options, isFiltered: null };
|
|
289
292
|
|
|
290
293
|
this.onSelect = (evt, treeViewItem) => {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
+
// Ignore folders for selection
|
|
295
|
+
if (treeViewItem && !treeViewItem.children) {
|
|
296
|
+
this.setState({
|
|
297
|
+
activeItems: [treeViewItem]
|
|
298
|
+
});
|
|
299
|
+
}
|
|
294
300
|
};
|
|
295
301
|
|
|
296
302
|
this.onSearch = evt => {
|
|
@@ -575,9 +581,12 @@ class IconTreeView extends React.Component {
|
|
|
575
581
|
this.state = { activeItems: {} };
|
|
576
582
|
|
|
577
583
|
this.onSelect = (evt, treeViewItem) => {
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
584
|
+
// Ignore folders for selection
|
|
585
|
+
if (treeViewItem && !treeViewItem.children) {
|
|
586
|
+
this.setState({
|
|
587
|
+
activeItems: [treeViewItem]
|
|
588
|
+
});
|
|
589
|
+
}
|
|
581
590
|
};
|
|
582
591
|
}
|
|
583
592
|
|
|
@@ -668,9 +677,12 @@ class BadgesTreeView extends React.Component {
|
|
|
668
677
|
this.state = { activeItems: {} };
|
|
669
678
|
|
|
670
679
|
this.onSelect = (evt, treeViewItem) => {
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
680
|
+
// Ignore folders for selection
|
|
681
|
+
if (treeViewItem && !treeViewItem.children) {
|
|
682
|
+
this.setState({
|
|
683
|
+
activeItems: [treeViewItem]
|
|
684
|
+
});
|
|
685
|
+
}
|
|
674
686
|
};
|
|
675
687
|
}
|
|
676
688
|
|
|
@@ -753,9 +765,12 @@ class CustomBadgesTreeView extends React.Component {
|
|
|
753
765
|
this.state = { activeItems: {} };
|
|
754
766
|
|
|
755
767
|
this.onSelect = (evt, treeViewItem) => {
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
768
|
+
// Ignore folders for selection
|
|
769
|
+
if (treeViewItem && !treeViewItem.children) {
|
|
770
|
+
this.setState({
|
|
771
|
+
activeItems: [treeViewItem]
|
|
772
|
+
});
|
|
773
|
+
}
|
|
759
774
|
};
|
|
760
775
|
}
|
|
761
776
|
|
|
@@ -853,9 +868,12 @@ class IconTreeView extends React.Component {
|
|
|
853
868
|
this.state = { activeItems: {}, isOpen: false };
|
|
854
869
|
|
|
855
870
|
this.onSelect = (evt, treeViewItem) => {
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
871
|
+
// Ignore folders for selection
|
|
872
|
+
if (treeViewItem && !treeViewItem.children) {
|
|
873
|
+
this.setState({
|
|
874
|
+
activeItems: [treeViewItem]
|
|
875
|
+
});
|
|
876
|
+
}
|
|
859
877
|
};
|
|
860
878
|
|
|
861
879
|
this.onToggle = isOpen => {
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Button, Tooltip } from '@patternfly/react-core';
|
|
3
|
-
|
|
4
|
-
export const ButtonAriaDisabledLinkTooltip: React.FunctionComponent = () => (
|
|
5
|
-
<Tooltip content="Aria-disabled link as button with tooltip">
|
|
6
|
-
<Button component="a" isAriaDisabled href="https://pf4.patternfly.org/" target="_blank" variant="tertiary">
|
|
7
|
-
Tertiary link as button to core docs
|
|
8
|
-
</Button>
|
|
9
|
-
</Tooltip>
|
|
10
|
-
);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Button, Tooltip } from '@patternfly/react-core';
|
|
3
|
-
|
|
4
|
-
export const ButtonAriaDisabledTooltip: React.FunctionComponent = () => (
|
|
5
|
-
<Tooltip content="Aria-disabled buttons are like disabled buttons, but focusable. Allows for tooltip support.">
|
|
6
|
-
<Button isAriaDisabled variant="secondary">
|
|
7
|
-
Secondary button to core docs
|
|
8
|
-
</Button>
|
|
9
|
-
</Tooltip>
|
|
10
|
-
);
|