@patternfly/react-core 4.166.0 → 4.168.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 +145 -0
- package/README.md +1 -1
- package/dist/esm/components/Dropdown/DropdownToggle.d.ts +1 -1
- package/dist/esm/components/Dropdown/DropdownToggle.d.ts.map +1 -1
- package/dist/esm/components/Dropdown/KebabToggle.d.ts +1 -1
- package/dist/esm/components/Dropdown/KebabToggle.d.ts.map +1 -1
- package/dist/esm/components/DualListSelector/DualListSelector.d.ts +1 -0
- package/dist/esm/components/DualListSelector/DualListSelector.d.ts.map +1 -1
- package/dist/esm/components/DualListSelector/DualListSelector.js +23 -10
- package/dist/esm/components/DualListSelector/DualListSelector.js.map +1 -1
- package/dist/esm/components/Label/Label.d.ts +4 -4
- package/dist/esm/components/Label/Label.d.ts.map +1 -1
- package/dist/esm/components/LabelGroup/LabelGroup.d.ts +3 -3
- package/dist/esm/components/LabelGroup/LabelGroup.d.ts.map +1 -1
- package/dist/esm/components/Menu/Menu.d.ts +11 -11
- package/dist/esm/components/Menu/Menu.d.ts.map +1 -1
- package/dist/esm/components/Menu/MenuItem.d.ts +5 -5
- package/dist/esm/components/Menu/MenuItem.d.ts.map +1 -1
- package/dist/esm/components/Select/Select.d.ts +1 -1
- package/dist/esm/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/components/Select/SelectOption.d.ts +1 -1
- package/dist/esm/components/Select/SelectOption.d.ts.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroup.d.ts +9 -0
- package/dist/esm/components/TextInputGroup/TextInputGroup.d.ts.map +1 -0
- package/dist/esm/components/TextInputGroup/TextInputGroup.js +10 -0
- package/dist/esm/components/TextInputGroup/TextInputGroup.js.map +1 -0
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.d.ts +15 -0
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -0
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.js +15 -0
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.js.map +1 -0
- package/dist/esm/components/TextInputGroup/TextInputGroupUtilities.d.ts +9 -0
- package/dist/esm/components/TextInputGroup/TextInputGroupUtilities.d.ts.map +1 -0
- package/dist/esm/components/TextInputGroup/TextInputGroupUtilities.js +10 -0
- package/dist/esm/components/TextInputGroup/TextInputGroupUtilities.js.map +1 -0
- package/dist/esm/components/TextInputGroup/index.d.ts +4 -0
- package/dist/esm/components/TextInputGroup/index.d.ts.map +1 -0
- package/dist/esm/components/TextInputGroup/index.js +4 -0
- package/dist/esm/components/TextInputGroup/index.js.map +1 -0
- package/dist/esm/components/Toolbar/Toolbar.d.ts +2 -0
- package/dist/esm/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/Toolbar.js +2 -2
- package/dist/esm/components/Toolbar/Toolbar.js.map +1 -1
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/js/components/Dropdown/DropdownToggle.d.ts +1 -1
- package/dist/js/components/Dropdown/DropdownToggle.d.ts.map +1 -1
- package/dist/js/components/Dropdown/KebabToggle.d.ts +1 -1
- package/dist/js/components/Dropdown/KebabToggle.d.ts.map +1 -1
- package/dist/js/components/DualListSelector/DualListSelector.d.ts +1 -0
- package/dist/js/components/DualListSelector/DualListSelector.d.ts.map +1 -1
- package/dist/js/components/DualListSelector/DualListSelector.js +23 -10
- package/dist/js/components/DualListSelector/DualListSelector.js.map +1 -1
- package/dist/js/components/Label/Label.d.ts +4 -4
- package/dist/js/components/Label/Label.d.ts.map +1 -1
- package/dist/js/components/LabelGroup/LabelGroup.d.ts +3 -3
- package/dist/js/components/LabelGroup/LabelGroup.d.ts.map +1 -1
- package/dist/js/components/Menu/Menu.d.ts +11 -11
- package/dist/js/components/Menu/Menu.d.ts.map +1 -1
- package/dist/js/components/Menu/MenuItem.d.ts +5 -5
- package/dist/js/components/Menu/MenuItem.d.ts.map +1 -1
- package/dist/js/components/Select/Select.d.ts +1 -1
- package/dist/js/components/Select/Select.d.ts.map +1 -1
- package/dist/js/components/Select/SelectOption.d.ts +1 -1
- package/dist/js/components/Select/SelectOption.d.ts.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroup.d.ts +9 -0
- package/dist/js/components/TextInputGroup/TextInputGroup.d.ts.map +1 -0
- package/dist/js/components/TextInputGroup/TextInputGroup.js +14 -0
- package/dist/js/components/TextInputGroup/TextInputGroup.js.map +1 -0
- package/dist/js/components/TextInputGroup/TextInputGroupMain.d.ts +15 -0
- package/dist/js/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -0
- package/dist/js/components/TextInputGroup/TextInputGroupMain.js +19 -0
- package/dist/js/components/TextInputGroup/TextInputGroupMain.js.map +1 -0
- package/dist/js/components/TextInputGroup/TextInputGroupUtilities.d.ts +9 -0
- package/dist/js/components/TextInputGroup/TextInputGroupUtilities.d.ts.map +1 -0
- package/dist/js/components/TextInputGroup/TextInputGroupUtilities.js +14 -0
- package/dist/js/components/TextInputGroup/TextInputGroupUtilities.js.map +1 -0
- package/dist/js/components/TextInputGroup/index.d.ts +4 -0
- package/dist/js/components/TextInputGroup/index.d.ts.map +1 -0
- package/dist/js/components/TextInputGroup/index.js +7 -0
- package/dist/js/components/TextInputGroup/index.js.map +1 -0
- package/dist/js/components/Toolbar/Toolbar.d.ts +2 -0
- package/dist/js/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/js/components/Toolbar/Toolbar.js +2 -2
- package/dist/js/components/Toolbar/Toolbar.js.map +1 -1
- package/dist/js/components/index.d.ts +1 -0
- package/dist/js/components/index.d.ts.map +1 -1
- package/dist/js/components/index.js +1 -0
- package/dist/js/components/index.js.map +1 -1
- package/dist/styles/assets/pficon/pficon.woff +0 -0
- package/dist/styles/assets/pficon/pficon.woff2 +0 -0
- package/dist/umd/react-core.css +360 -17
- package/dist/umd/react-core.js +953 -885
- package/dist/umd/react-core.min.css +360 -17
- package/dist/umd/react-core.min.js +3 -3
- package/package.json +6 -6
- package/src/components/CodeBlock/examples/CodeBlock.md +0 -1
- package/src/components/DataList/examples/DataList.md +4 -3
- package/src/components/DragDrop/examples/DragDrop.md +1 -0
- package/src/components/Dropdown/DropdownToggle.tsx +1 -1
- package/src/components/Dropdown/KebabToggle.tsx +1 -1
- package/src/components/DualListSelector/DualListSelector.tsx +25 -23
- package/src/components/DualListSelector/examples/DualListSelector.md +3 -0
- package/src/components/HelperText/examples/HelperText.md +0 -1
- package/src/components/Label/Label.tsx +4 -4
- package/src/components/Label/examples/Label.md +1 -1
- package/src/components/LabelGroup/LabelGroup.tsx +3 -3
- package/src/components/LabelGroup/examples/LabelGroup.md +1 -1
- package/src/components/Menu/Menu.tsx +11 -11
- package/src/components/Menu/MenuItem.tsx +5 -5
- package/src/components/Menu/examples/Menu.md +2 -9
- package/src/components/Modal/__tests__/ModalBox.test.tsx +11 -21
- package/src/components/Modal/__tests__/ModalBoxDescription.test.tsx +12 -0
- package/src/components/Modal/__tests__/ModalBoxTitle.test.tsx +59 -0
- package/src/components/Modal/__tests__/ModalContent.test.tsx +15 -10
- package/src/components/Modal/__tests__/__snapshots__/ModalBox.test.tsx.snap +12 -30
- package/src/components/Modal/__tests__/__snapshots__/ModalBoxDescription.test.tsx.snap +10 -0
- package/src/components/Modal/__tests__/__snapshots__/ModalBoxTitle.test.tsx.snap +158 -0
- package/src/components/Modal/__tests__/__snapshots__/ModalContent.test.tsx.snap +53 -22
- package/src/components/Select/Select.tsx +1 -1
- package/src/components/Select/SelectOption.tsx +1 -1
- package/src/components/Select/examples/Select.md +4 -11
- package/src/components/Sidebar/examples/Sidebar.md +0 -1
- package/src/components/TextInputGroup/TextInputGroup.tsx +22 -0
- package/src/components/TextInputGroup/TextInputGroupMain.tsx +43 -0
- package/src/components/TextInputGroup/TextInputGroupUtilities.tsx +22 -0
- package/src/components/TextInputGroup/__tests__/TextInputGroup.test.tsx +77 -0
- package/src/components/TextInputGroup/__tests__/__snapshots__/TextInputGroup.test.tsx.snap +211 -0
- package/src/components/TextInputGroup/examples/TextInputGroup.md +138 -0
- package/src/components/TextInputGroup/index.ts +3 -0
- package/src/components/Toolbar/Toolbar.tsx +4 -0
- package/src/components/Wizard/examples/Wizard.md +17 -1
- package/src/components/index.ts +1 -0
- package/src/demos/ComposableMenu.md +4 -13
- package/src/demos/DataListDemo.md +0 -2
- package/src/demos/DatePicker.md +1 -0
- package/src/demos/NotificationDrawer/NotificationDrawer.md +1 -0
- package/src/demos/ProgressDemo.md +82 -0
- package/src/demos/ProgressStepperDemo.md +1 -0
- package/src/demos/SearchInput/SearchInput.md +1 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import styles from '@patternfly/react-styles/css/components/TextInputGroup/text-input-group';
|
|
3
|
+
import { css } from '@patternfly/react-styles';
|
|
4
|
+
|
|
5
|
+
export interface TextInputGroupUtilitiesProps extends React.HTMLProps<HTMLDivElement> {
|
|
6
|
+
/** Content rendered inside the text input group utilities div */
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
/** Additional classes applied to the text input group utilities container */
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const TextInputGroupUtilities: React.FunctionComponent<TextInputGroupUtilitiesProps> = ({
|
|
13
|
+
children,
|
|
14
|
+
className,
|
|
15
|
+
...props
|
|
16
|
+
}: TextInputGroupUtilitiesProps) => (
|
|
17
|
+
<div className={css(styles.textInputGroupUtilities, className)} {...props}>
|
|
18
|
+
{children}
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
TextInputGroupUtilities.displayName = 'TextInputGroupUtilities';
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { mount } from 'enzyme';
|
|
3
|
+
import { TextInputGroup } from '../TextInputGroup';
|
|
4
|
+
import { TextInputGroupMain } from '../TextInputGroupMain';
|
|
5
|
+
import { TextInputGroupUtilities } from '../TextInputGroupUtilities';
|
|
6
|
+
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
|
|
7
|
+
|
|
8
|
+
describe('TextInputGroup', () => {
|
|
9
|
+
test('renders content', () => {
|
|
10
|
+
const view = mount(
|
|
11
|
+
<TextInputGroup>
|
|
12
|
+
<TextInputGroupMain>Foo</TextInputGroupMain>
|
|
13
|
+
<TextInputGroupUtilities />
|
|
14
|
+
</TextInputGroup>
|
|
15
|
+
);
|
|
16
|
+
expect(view).toMatchSnapshot();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test('gets custom class and id', () => {
|
|
20
|
+
const view = mount(
|
|
21
|
+
<TextInputGroup className="custom-class" id="test-id">
|
|
22
|
+
<TextInputGroupMain>Foo</TextInputGroupMain>
|
|
23
|
+
<TextInputGroupUtilities />
|
|
24
|
+
</TextInputGroup>
|
|
25
|
+
);
|
|
26
|
+
expect(view).toMatchSnapshot();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('renders with the proper stying for an icon on the left side of the component', () => {
|
|
30
|
+
const view = mount(
|
|
31
|
+
<TextInputGroup>
|
|
32
|
+
<TextInputGroupMain>Foo</TextInputGroupMain>
|
|
33
|
+
<TextInputGroupUtilities />
|
|
34
|
+
</TextInputGroup>
|
|
35
|
+
);
|
|
36
|
+
expect(view).toMatchSnapshot();
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
describe('TextInputGroupMain', () => {
|
|
41
|
+
test('renders content', () => {
|
|
42
|
+
const view = mount(<TextInputGroupMain>Foo</TextInputGroupMain>);
|
|
43
|
+
expect(view).toMatchSnapshot();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test('renders given input icon props', () => {
|
|
47
|
+
const view = mount(<TextInputGroupMain icon={<SearchIcon />}>Foo</TextInputGroupMain>);
|
|
48
|
+
expect(view).toMatchSnapshot();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test('renders the input with custom aria label when given', () => {
|
|
52
|
+
const view = mount(<TextInputGroupMain aria-label="Foo">Foo</TextInputGroupMain>);
|
|
53
|
+
expect(view).toMatchSnapshot();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('does not call onChange callback when the input does not change', () => {
|
|
57
|
+
const onChangeMock = jest.fn();
|
|
58
|
+
|
|
59
|
+
const view = mount(<TextInputGroupMain onChange={onChangeMock}>Foo</TextInputGroupMain>);
|
|
60
|
+
expect(onChangeMock).not.toHaveBeenCalled();
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test('calls the onChange callback when the input changes', () => {
|
|
64
|
+
const onChangeMock = jest.fn();
|
|
65
|
+
|
|
66
|
+
const view = mount(<TextInputGroupMain onChange={onChangeMock}>Foo</TextInputGroupMain>);
|
|
67
|
+
view.find('input').simulate('change', { target: { value: 'Foo' } });
|
|
68
|
+
expect(onChangeMock).toHaveBeenCalledTimes(1);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
describe('TextInputGroupUtilities', () => {
|
|
73
|
+
test('renders the content', () => {
|
|
74
|
+
const view = mount(<TextInputGroupUtilities>{<button>Foo</button>}</TextInputGroupUtilities>);
|
|
75
|
+
expect(view).toMatchSnapshot();
|
|
76
|
+
});
|
|
77
|
+
});
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`TextInputGroup gets custom class and id 1`] = `
|
|
4
|
+
<TextInputGroup
|
|
5
|
+
className="custom-class"
|
|
6
|
+
id="test-id"
|
|
7
|
+
>
|
|
8
|
+
<div
|
|
9
|
+
className="pf-c-text-input-group custom-class"
|
|
10
|
+
id="test-id"
|
|
11
|
+
>
|
|
12
|
+
<TextInputGroupMain
|
|
13
|
+
aria-label="Type to filter"
|
|
14
|
+
>
|
|
15
|
+
<div
|
|
16
|
+
className="pf-c-text-input-group__main"
|
|
17
|
+
>
|
|
18
|
+
Foo
|
|
19
|
+
<span
|
|
20
|
+
className="pf-c-text-input-group__text"
|
|
21
|
+
>
|
|
22
|
+
<input
|
|
23
|
+
aria-label="Type to filter"
|
|
24
|
+
className="pf-c-text-input-group__text-input"
|
|
25
|
+
type="text"
|
|
26
|
+
/>
|
|
27
|
+
</span>
|
|
28
|
+
</div>
|
|
29
|
+
</TextInputGroupMain>
|
|
30
|
+
<TextInputGroupUtilities>
|
|
31
|
+
<div
|
|
32
|
+
className="pf-c-text-input-group__utilities"
|
|
33
|
+
/>
|
|
34
|
+
</TextInputGroupUtilities>
|
|
35
|
+
</div>
|
|
36
|
+
</TextInputGroup>
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
exports[`TextInputGroup renders content 1`] = `
|
|
40
|
+
<TextInputGroup>
|
|
41
|
+
<div
|
|
42
|
+
className="pf-c-text-input-group"
|
|
43
|
+
>
|
|
44
|
+
<TextInputGroupMain
|
|
45
|
+
aria-label="Type to filter"
|
|
46
|
+
>
|
|
47
|
+
<div
|
|
48
|
+
className="pf-c-text-input-group__main"
|
|
49
|
+
>
|
|
50
|
+
Foo
|
|
51
|
+
<span
|
|
52
|
+
className="pf-c-text-input-group__text"
|
|
53
|
+
>
|
|
54
|
+
<input
|
|
55
|
+
aria-label="Type to filter"
|
|
56
|
+
className="pf-c-text-input-group__text-input"
|
|
57
|
+
type="text"
|
|
58
|
+
/>
|
|
59
|
+
</span>
|
|
60
|
+
</div>
|
|
61
|
+
</TextInputGroupMain>
|
|
62
|
+
<TextInputGroupUtilities>
|
|
63
|
+
<div
|
|
64
|
+
className="pf-c-text-input-group__utilities"
|
|
65
|
+
/>
|
|
66
|
+
</TextInputGroupUtilities>
|
|
67
|
+
</div>
|
|
68
|
+
</TextInputGroup>
|
|
69
|
+
`;
|
|
70
|
+
|
|
71
|
+
exports[`TextInputGroup renders with the proper stying for an icon on the left side of the component 1`] = `
|
|
72
|
+
<TextInputGroup>
|
|
73
|
+
<div
|
|
74
|
+
className="pf-c-text-input-group"
|
|
75
|
+
>
|
|
76
|
+
<TextInputGroupMain
|
|
77
|
+
aria-label="Type to filter"
|
|
78
|
+
>
|
|
79
|
+
<div
|
|
80
|
+
className="pf-c-text-input-group__main"
|
|
81
|
+
>
|
|
82
|
+
Foo
|
|
83
|
+
<span
|
|
84
|
+
className="pf-c-text-input-group__text"
|
|
85
|
+
>
|
|
86
|
+
<input
|
|
87
|
+
aria-label="Type to filter"
|
|
88
|
+
className="pf-c-text-input-group__text-input"
|
|
89
|
+
type="text"
|
|
90
|
+
/>
|
|
91
|
+
</span>
|
|
92
|
+
</div>
|
|
93
|
+
</TextInputGroupMain>
|
|
94
|
+
<TextInputGroupUtilities>
|
|
95
|
+
<div
|
|
96
|
+
className="pf-c-text-input-group__utilities"
|
|
97
|
+
/>
|
|
98
|
+
</TextInputGroupUtilities>
|
|
99
|
+
</div>
|
|
100
|
+
</TextInputGroup>
|
|
101
|
+
`;
|
|
102
|
+
|
|
103
|
+
exports[`TextInputGroupMain renders content 1`] = `
|
|
104
|
+
<TextInputGroupMain
|
|
105
|
+
aria-label="Type to filter"
|
|
106
|
+
>
|
|
107
|
+
<div
|
|
108
|
+
className="pf-c-text-input-group__main"
|
|
109
|
+
>
|
|
110
|
+
Foo
|
|
111
|
+
<span
|
|
112
|
+
className="pf-c-text-input-group__text"
|
|
113
|
+
>
|
|
114
|
+
<input
|
|
115
|
+
aria-label="Type to filter"
|
|
116
|
+
className="pf-c-text-input-group__text-input"
|
|
117
|
+
type="text"
|
|
118
|
+
/>
|
|
119
|
+
</span>
|
|
120
|
+
</div>
|
|
121
|
+
</TextInputGroupMain>
|
|
122
|
+
`;
|
|
123
|
+
|
|
124
|
+
exports[`TextInputGroupMain renders given input icon props 1`] = `
|
|
125
|
+
<TextInputGroupMain
|
|
126
|
+
aria-label="Type to filter"
|
|
127
|
+
icon={
|
|
128
|
+
<SearchIcon
|
|
129
|
+
color="currentColor"
|
|
130
|
+
noVerticalAlign={false}
|
|
131
|
+
size="sm"
|
|
132
|
+
/>
|
|
133
|
+
}
|
|
134
|
+
>
|
|
135
|
+
<div
|
|
136
|
+
className="pf-c-text-input-group__main pf-m-icon"
|
|
137
|
+
>
|
|
138
|
+
Foo
|
|
139
|
+
<span
|
|
140
|
+
className="pf-c-text-input-group__text"
|
|
141
|
+
>
|
|
142
|
+
<span
|
|
143
|
+
className="pf-c-text-input-group__icon"
|
|
144
|
+
>
|
|
145
|
+
<SearchIcon
|
|
146
|
+
color="currentColor"
|
|
147
|
+
noVerticalAlign={false}
|
|
148
|
+
size="sm"
|
|
149
|
+
>
|
|
150
|
+
<svg
|
|
151
|
+
aria-hidden={true}
|
|
152
|
+
aria-labelledby={null}
|
|
153
|
+
fill="currentColor"
|
|
154
|
+
height="1em"
|
|
155
|
+
role="img"
|
|
156
|
+
style={
|
|
157
|
+
Object {
|
|
158
|
+
"verticalAlign": "-0.125em",
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
viewBox="0 0 512 512"
|
|
162
|
+
width="1em"
|
|
163
|
+
>
|
|
164
|
+
<path
|
|
165
|
+
d="M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"
|
|
166
|
+
/>
|
|
167
|
+
</svg>
|
|
168
|
+
</SearchIcon>
|
|
169
|
+
</span>
|
|
170
|
+
<input
|
|
171
|
+
aria-label="Type to filter"
|
|
172
|
+
className="pf-c-text-input-group__text-input"
|
|
173
|
+
type="text"
|
|
174
|
+
/>
|
|
175
|
+
</span>
|
|
176
|
+
</div>
|
|
177
|
+
</TextInputGroupMain>
|
|
178
|
+
`;
|
|
179
|
+
|
|
180
|
+
exports[`TextInputGroupMain renders the input with custom aria label when given 1`] = `
|
|
181
|
+
<TextInputGroupMain
|
|
182
|
+
aria-label="Foo"
|
|
183
|
+
>
|
|
184
|
+
<div
|
|
185
|
+
className="pf-c-text-input-group__main"
|
|
186
|
+
>
|
|
187
|
+
Foo
|
|
188
|
+
<span
|
|
189
|
+
className="pf-c-text-input-group__text"
|
|
190
|
+
>
|
|
191
|
+
<input
|
|
192
|
+
aria-label="Foo"
|
|
193
|
+
className="pf-c-text-input-group__text-input"
|
|
194
|
+
type="text"
|
|
195
|
+
/>
|
|
196
|
+
</span>
|
|
197
|
+
</div>
|
|
198
|
+
</TextInputGroupMain>
|
|
199
|
+
`;
|
|
200
|
+
|
|
201
|
+
exports[`TextInputGroupUtilities renders the content 1`] = `
|
|
202
|
+
<TextInputGroupUtilities>
|
|
203
|
+
<div
|
|
204
|
+
className="pf-c-text-input-group__utilities"
|
|
205
|
+
>
|
|
206
|
+
<button>
|
|
207
|
+
Foo
|
|
208
|
+
</button>
|
|
209
|
+
</div>
|
|
210
|
+
</TextInputGroupUtilities>
|
|
211
|
+
`;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: Text input group
|
|
3
|
+
section: components
|
|
4
|
+
cssPrefix: pf-c-text-input-group
|
|
5
|
+
propComponents: ['TextInputGroup', 'TextInputGroupMain', 'TextInputGroupUtilities']
|
|
6
|
+
beta: true
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
|
|
10
|
+
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
|
|
11
|
+
|
|
12
|
+
## Examples
|
|
13
|
+
|
|
14
|
+
### Basic
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
import React from 'react';
|
|
18
|
+
import { TextInputGroup, TextInputGroupMain } from '@patternfly/react-core';
|
|
19
|
+
|
|
20
|
+
const BasicTextInputGroup = () => (
|
|
21
|
+
<TextInputGroup>
|
|
22
|
+
<TextInputGroupMain />
|
|
23
|
+
</TextInputGroup>
|
|
24
|
+
);
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Utilities and icon
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
import React from 'react';
|
|
31
|
+
import { TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, Button } from '@patternfly/react-core';
|
|
32
|
+
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
|
|
33
|
+
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
|
|
34
|
+
|
|
35
|
+
const TextInputGroupWithIcons = () => {
|
|
36
|
+
const [inputValue, setInputValue] = React.useState('');
|
|
37
|
+
|
|
38
|
+
/** callback for updating the inputValue state in this component so that the input can be controlled */
|
|
39
|
+
const handleInputChange = event => {
|
|
40
|
+
setInputValue(event.target.value);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/** show the input clearing button only when the input is not empty */
|
|
44
|
+
const showClearButton = inputValue;
|
|
45
|
+
|
|
46
|
+
/** callback for clearing the text input */
|
|
47
|
+
const clearInput = () => {
|
|
48
|
+
setInputValue('');
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<TextInputGroup>
|
|
53
|
+
<TextInputGroupMain icon={<SearchIcon />} value={inputValue} onChange={handleInputChange} />
|
|
54
|
+
<TextInputGroupUtilities>
|
|
55
|
+
{showClearButton && (
|
|
56
|
+
<Button variant="plain" onClick={clearInput} aria-label="Clear button and input">
|
|
57
|
+
<TimesIcon />
|
|
58
|
+
</Button>
|
|
59
|
+
)}
|
|
60
|
+
</TextInputGroupUtilities>
|
|
61
|
+
</TextInputGroup>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Filters
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
import React from 'react';
|
|
70
|
+
import { TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, Button } from '@patternfly/react-core';
|
|
71
|
+
import { Chip, ChipGroup } from '@patternfly/react-core';
|
|
72
|
+
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
|
|
73
|
+
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
|
|
74
|
+
|
|
75
|
+
const TextInputGroupWithChips = () => {
|
|
76
|
+
const [inputValue, setInputValue] = React.useState('');
|
|
77
|
+
const [currentChips, setCurrentChips] = React.useState([
|
|
78
|
+
'chip one',
|
|
79
|
+
'chip two',
|
|
80
|
+
'chip three',
|
|
81
|
+
'chip four',
|
|
82
|
+
'chip five',
|
|
83
|
+
'chip six',
|
|
84
|
+
'chip seven',
|
|
85
|
+
'chip eight',
|
|
86
|
+
'chip nine',
|
|
87
|
+
'chip ten',
|
|
88
|
+
'chip eleven',
|
|
89
|
+
'chip twelve',
|
|
90
|
+
'chip thirteen',
|
|
91
|
+
'chip fourteen'
|
|
92
|
+
]);
|
|
93
|
+
|
|
94
|
+
/** show the search icon only when there are no chips to prevent the chips from being displayed behind the icon */
|
|
95
|
+
const showSearchIcon = !currentChips.length;
|
|
96
|
+
|
|
97
|
+
/** callback for updating the inputValue state in this component so that the input can be controlled */
|
|
98
|
+
const handleInputChange = event => {
|
|
99
|
+
setInputValue(event.target.value);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/** callback for removing a chip from the chip selections */
|
|
103
|
+
const deleteChip = chipToDelete => {
|
|
104
|
+
const newChips = currentChips.filter(chip => !Object.is(chip, chipToDelete));
|
|
105
|
+
setCurrentChips(newChips);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/** show the input/chip clearing button only when either the text input or chip group are not empty */
|
|
109
|
+
const showClearButton = inputValue || !!currentChips.length;
|
|
110
|
+
|
|
111
|
+
/** callback for clearing all selected chips and the text input */
|
|
112
|
+
const clearChipsAndInput = () => {
|
|
113
|
+
setCurrentChips([]);
|
|
114
|
+
setInputValue('');
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<TextInputGroup>
|
|
119
|
+
<TextInputGroupMain icon={showSearchIcon && <SearchIcon />} value={inputValue} onChange={handleInputChange}>
|
|
120
|
+
<ChipGroup>
|
|
121
|
+
{currentChips.map(currentChip => (
|
|
122
|
+
<Chip key={currentChip} onClick={() => deleteChip(currentChip)}>
|
|
123
|
+
{currentChip}
|
|
124
|
+
</Chip>
|
|
125
|
+
))}
|
|
126
|
+
</ChipGroup>
|
|
127
|
+
</TextInputGroupMain>
|
|
128
|
+
<TextInputGroupUtilities>
|
|
129
|
+
{showClearButton && (
|
|
130
|
+
<Button variant="plain" onClick={clearChipsAndInput} aria-label="Clear button and input">
|
|
131
|
+
<TimesIcon />
|
|
132
|
+
</Button>
|
|
133
|
+
)}
|
|
134
|
+
</TextInputGroupUtilities>
|
|
135
|
+
</TextInputGroup>
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
```
|
|
@@ -30,6 +30,8 @@ export interface ToolbarProps extends React.HTMLProps<HTMLDivElement>, OUIAProps
|
|
|
30
30
|
isStatic?: boolean;
|
|
31
31
|
/** Flag indicating the toolbar should use the Page insets */
|
|
32
32
|
usePageInsets?: boolean;
|
|
33
|
+
/** Flag indicating the toolbar should stick to the top of its container */
|
|
34
|
+
isSticky?: boolean;
|
|
33
35
|
/** Insets at various breakpoints. */
|
|
34
36
|
inset?: {
|
|
35
37
|
default?: 'insetNone' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl';
|
|
@@ -121,6 +123,7 @@ export class Toolbar extends React.Component<ToolbarProps, ToolbarState> {
|
|
|
121
123
|
isStatic,
|
|
122
124
|
inset,
|
|
123
125
|
usePageInsets,
|
|
126
|
+
isSticky,
|
|
124
127
|
ouiaId,
|
|
125
128
|
...props
|
|
126
129
|
} = this.props;
|
|
@@ -139,6 +142,7 @@ export class Toolbar extends React.Component<ToolbarProps, ToolbarState> {
|
|
|
139
142
|
isFullHeight && styles.modifiers.fullHeight,
|
|
140
143
|
isStatic && styles.modifiers.static,
|
|
141
144
|
usePageInsets && styles.modifiers.pageInsets,
|
|
145
|
+
isSticky && styles.modifiers.sticky,
|
|
142
146
|
formatBreakpointMods(inset, styles),
|
|
143
147
|
className
|
|
144
148
|
)}
|
|
@@ -318,6 +318,22 @@ class ValidationWizard extends React.Component {
|
|
|
318
318
|
```
|
|
319
319
|
|
|
320
320
|
### Validate on button press
|
|
321
|
+
|
|
322
|
+
This example demonstrates how to use the `WizardContextConsumer` to consume the `WizardContext`. `WizardContext` can be used to imperatively move to a specific wizard step.
|
|
323
|
+
|
|
324
|
+
The definition of the `WizardContext` is as follows:
|
|
325
|
+
|
|
326
|
+
```
|
|
327
|
+
interface WizardContext {
|
|
328
|
+
goToStepById: (stepId: number | string) => void;
|
|
329
|
+
goToStepByName: (stepName: string) => void;
|
|
330
|
+
onNext: () => void;
|
|
331
|
+
onBack: () => void;
|
|
332
|
+
onClose: () => void;
|
|
333
|
+
activeStep: WizardStep;
|
|
334
|
+
}
|
|
335
|
+
```
|
|
336
|
+
|
|
321
337
|
```js
|
|
322
338
|
import React from 'react';
|
|
323
339
|
import { Button, Wizard, WizardFooter, WizardContextConsumer, Alert } from '@patternfly/react-core';
|
|
@@ -333,7 +349,7 @@ class ValidateButtonPressWizard extends React.Component {
|
|
|
333
349
|
|
|
334
350
|
this.closeWizard = () => {
|
|
335
351
|
console.log("close wizard");
|
|
336
|
-
}
|
|
352
|
+
};
|
|
337
353
|
|
|
338
354
|
this.validateLastStep = onNext => {
|
|
339
355
|
const { stepsValid } = this.state;
|
package/src/components/index.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: Composable menu
|
|
3
3
|
section: demos
|
|
4
|
-
beta: true
|
|
5
4
|
---
|
|
6
5
|
|
|
7
6
|
import { Link } from '@reach/router';
|
|
@@ -106,7 +105,6 @@ import React from 'react';
|
|
|
106
105
|
import {
|
|
107
106
|
MenuToggle,
|
|
108
107
|
Menu,
|
|
109
|
-
MenuContent,
|
|
110
108
|
MenuList,
|
|
111
109
|
MenuItem,
|
|
112
110
|
MenuGroup,
|
|
@@ -116,9 +114,6 @@ import {
|
|
|
116
114
|
import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
|
|
117
115
|
import ClipboardIcon from '@patternfly/react-icons/dist/esm/icons/clipboard-icon';
|
|
118
116
|
import CodeBranchIcon from '@patternfly/react-icons/dist/esm/icons/code-branch-icon';
|
|
119
|
-
import LayerGroupIcon from '@patternfly/react-icons/dist/esm/icons/layer-group-icon';
|
|
120
|
-
import CubeIcon from '@patternfly/react-icons/dist/esm/icons/cube-icon';
|
|
121
|
-
import TableIcon from '@patternfly/react-icons/dist/esm/icons/table-icon';
|
|
122
117
|
import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';
|
|
123
118
|
|
|
124
119
|
ActionComposableMenu = () => {
|
|
@@ -303,7 +298,7 @@ SelectComposableMenu = () => {
|
|
|
303
298
|
|
|
304
299
|
### Drilldown menu with toggle
|
|
305
300
|
|
|
306
|
-
```js
|
|
301
|
+
```js isBeta
|
|
307
302
|
import React from 'react';
|
|
308
303
|
import {
|
|
309
304
|
MenuToggle,
|
|
@@ -547,7 +542,7 @@ DrilldownComposableMenu = () => {
|
|
|
547
542
|
|
|
548
543
|
```js
|
|
549
544
|
import React from 'react';
|
|
550
|
-
import { MenuToggle, Menu, MenuContent, MenuGroup, MenuList,
|
|
545
|
+
import { MenuToggle, Menu, MenuContent, MenuGroup, MenuList, Popper, TreeView } from '@patternfly/react-core';
|
|
551
546
|
|
|
552
547
|
FilterTreeComposableMenu = () => {
|
|
553
548
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
@@ -786,9 +781,9 @@ FilterTreeComposableMenu = () => {
|
|
|
786
781
|
|
|
787
782
|
The flyout will automatically position to the left or top if it would otherwise go outside the window. The menu must be placed in a container outside the main content like Popper, [Popover](/components/popover) or [Tooltip](/components/tooltip) since it may go over the side nav.
|
|
788
783
|
|
|
789
|
-
```js
|
|
784
|
+
```js isBeta
|
|
790
785
|
import React from 'react';
|
|
791
|
-
import { MenuToggle, Menu, MenuContent,
|
|
786
|
+
import { MenuToggle, Menu, MenuContent, MenuList, MenuItem, Popper } from '@patternfly/react-core';
|
|
792
787
|
|
|
793
788
|
MenuWithFlyout = () => {
|
|
794
789
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
@@ -1182,18 +1177,14 @@ import {
|
|
|
1182
1177
|
MenuFooter,
|
|
1183
1178
|
MenuList,
|
|
1184
1179
|
MenuItem,
|
|
1185
|
-
MenuGroup,
|
|
1186
1180
|
MenuInput,
|
|
1187
1181
|
Popper,
|
|
1188
|
-
Tooltip,
|
|
1189
1182
|
Divider,
|
|
1190
1183
|
TextInput,
|
|
1191
1184
|
InputGroup,
|
|
1192
1185
|
Button
|
|
1193
1186
|
} from '@patternfly/react-core';
|
|
1194
|
-
import { Link } from '@reach/router';
|
|
1195
1187
|
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
|
|
1196
|
-
import pfIcon from './examples/pf-logo-small.svg';
|
|
1197
1188
|
|
|
1198
1189
|
MenuContextSelector = () => {
|
|
1199
1190
|
const items = [
|
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
DataListItem,
|
|
22
22
|
DataListItemRow,
|
|
23
23
|
DataListCell,
|
|
24
|
-
DataListCheck,
|
|
25
24
|
DataListAction,
|
|
26
25
|
DataListToggle,
|
|
27
26
|
DataListContent,
|
|
@@ -40,7 +39,6 @@ import {
|
|
|
40
39
|
Tooltip
|
|
41
40
|
} from '@patternfly/react-core';
|
|
42
41
|
import CodeBranchIcon from '@patternfly/react-icons/dist/esm/icons/code-branch-icon';
|
|
43
|
-
import AngleDownIcon from '@patternfly/react-icons/dist/esm/icons/angle-down-icon';
|
|
44
42
|
import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon';
|
|
45
43
|
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
|
|
46
44
|
|
package/src/demos/DatePicker.md
CHANGED