@patternfly/react-core 4.232.8 → 4.232.11
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 +24 -0
- package/dist/esm/components/Page/PageBreadcrumb.d.ts +3 -1
- package/dist/esm/components/Page/PageBreadcrumb.d.ts.map +1 -1
- package/dist/esm/components/Page/PageBreadcrumb.js +8 -2
- package/dist/esm/components/Page/PageBreadcrumb.js.map +1 -1
- package/dist/esm/components/Page/PageGroup.d.ts +3 -1
- package/dist/esm/components/Page/PageGroup.d.ts.map +1 -1
- package/dist/esm/components/Page/PageGroup.js +8 -2
- package/dist/esm/components/Page/PageGroup.js.map +1 -1
- package/dist/esm/components/Page/PageNavigation.d.ts +3 -1
- package/dist/esm/components/Page/PageNavigation.d.ts.map +1 -1
- package/dist/esm/components/Page/PageNavigation.js +8 -2
- package/dist/esm/components/Page/PageNavigation.js.map +1 -1
- package/dist/esm/components/Page/PageSection.d.ts +4 -0
- package/dist/esm/components/Page/PageSection.d.ts.map +1 -1
- package/dist/esm/components/Page/PageSection.js +8 -2
- package/dist/esm/components/Page/PageSection.js.map +1 -1
- package/dist/js/components/Page/PageBreadcrumb.d.ts +3 -1
- package/dist/js/components/Page/PageBreadcrumb.d.ts.map +1 -1
- package/dist/js/components/Page/PageBreadcrumb.js +8 -2
- package/dist/js/components/Page/PageBreadcrumb.js.map +1 -1
- package/dist/js/components/Page/PageGroup.d.ts +3 -1
- package/dist/js/components/Page/PageGroup.d.ts.map +1 -1
- package/dist/js/components/Page/PageGroup.js +8 -2
- package/dist/js/components/Page/PageGroup.js.map +1 -1
- package/dist/js/components/Page/PageNavigation.d.ts +3 -1
- package/dist/js/components/Page/PageNavigation.d.ts.map +1 -1
- package/dist/js/components/Page/PageNavigation.js +8 -2
- package/dist/js/components/Page/PageNavigation.js.map +1 -1
- package/dist/js/components/Page/PageSection.d.ts +4 -0
- package/dist/js/components/Page/PageSection.d.ts.map +1 -1
- package/dist/js/components/Page/PageSection.js +8 -2
- package/dist/js/components/Page/PageSection.js.map +1 -1
- package/dist/umd/react-core.js +444 -515
- package/dist/umd/react-core.min.css +106 -106
- package/dist/umd/react-core.min.js +5 -5
- package/package.json +10 -10
- package/src/components/Page/PageBreadcrumb.tsx +11 -0
- package/src/components/Page/PageGroup.tsx +11 -0
- package/src/components/Page/PageNavigation.tsx +11 -0
- package/src/components/Page/PageSection.tsx +13 -0
- package/src/components/Page/__tests__/PageBreadcrumb.test.tsx +41 -1
- package/src/components/Page/__tests__/PageGroup.test.tsx +41 -1
- package/src/components/Page/__tests__/PageNavigation.test.tsx +41 -1
- package/src/components/Page/__tests__/PageSection.test.tsx +41 -1
- package/src/components/SearchInput/examples/SearchInput.md +6 -223
- package/src/components/SearchInput/examples/SearchInputAdvanced.tsx +56 -0
- package/src/components/SearchInput/examples/SearchInputBasic.tsx +12 -0
- package/src/components/SearchInput/examples/SearchInputFocusSearch.tsx +14 -0
- package/src/components/SearchInput/examples/SearchInputWithNavigableOptions.tsx +43 -0
- package/src/components/SearchInput/examples/SearchInputWithResultCount.tsx +27 -0
- package/src/components/SearchInput/examples/SearchInputWithSubmitButton.tsx +16 -0
- package/src/demos/JumpLinks.md +1 -0
- package/src/demos/examples/BackToTop/BackToTopNameDemo.tsx +6 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button, Checkbox, FormGroup, SearchInput } from '@patternfly/react-core';
|
|
3
|
+
import ExternalLinkSquareAltIcon from '@patternfly/react-icons/dist/esm/icons/external-link-square-alt-icon';
|
|
4
|
+
|
|
5
|
+
export const SearchInputAdvanced: React.FunctionComponent = () => {
|
|
6
|
+
const [value, setValue] = React.useState('username:player firstname:john');
|
|
7
|
+
const [useEqualsAsDelimiter, setUseEqualsAsDelimiter] = React.useState(false);
|
|
8
|
+
const [useCustomFooter, setUseCustomFooter] = React.useState(false);
|
|
9
|
+
|
|
10
|
+
const toggleDelimiter = (checked: boolean) => {
|
|
11
|
+
setValue(value.replace(/:|=/g, checked ? '=' : ':'));
|
|
12
|
+
setUseEqualsAsDelimiter(checked);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<>
|
|
17
|
+
<Checkbox
|
|
18
|
+
label="Use equal sign as search attribute delimiter"
|
|
19
|
+
isChecked={useEqualsAsDelimiter}
|
|
20
|
+
onChange={toggleDelimiter}
|
|
21
|
+
aria-label="change delimiter checkbox"
|
|
22
|
+
id="toggle-delimiter"
|
|
23
|
+
name="toggle-delimiter"
|
|
24
|
+
/>
|
|
25
|
+
<Checkbox
|
|
26
|
+
label="Add custom footer element after the attributes in the menu"
|
|
27
|
+
isChecked={useCustomFooter}
|
|
28
|
+
onChange={value => setUseCustomFooter(value)}
|
|
29
|
+
aria-label="change use custom footer checkbox"
|
|
30
|
+
id="toggle-custom-footer"
|
|
31
|
+
name="toggle-custom-footer"
|
|
32
|
+
/>
|
|
33
|
+
<br />
|
|
34
|
+
<SearchInput
|
|
35
|
+
attributes={[
|
|
36
|
+
{ attr: 'username', display: 'Username' },
|
|
37
|
+
{ attr: 'firstname', display: 'First name' }
|
|
38
|
+
]}
|
|
39
|
+
advancedSearchDelimiter={useEqualsAsDelimiter ? '=' : ':'}
|
|
40
|
+
value={value}
|
|
41
|
+
onChange={setValue}
|
|
42
|
+
onSearch={setValue}
|
|
43
|
+
onClear={() => setValue('')}
|
|
44
|
+
formAdditionalItems={
|
|
45
|
+
useCustomFooter ? (
|
|
46
|
+
<FormGroup>
|
|
47
|
+
<Button variant="link" isInline icon={<ExternalLinkSquareAltIcon />} iconPosition="right">
|
|
48
|
+
Link
|
|
49
|
+
</Button>
|
|
50
|
+
</FormGroup>
|
|
51
|
+
) : null
|
|
52
|
+
}
|
|
53
|
+
/>
|
|
54
|
+
</>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SearchInput } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const SearchInputBasic: React.FunctionComponent = () => {
|
|
5
|
+
const [value, setValue] = React.useState('');
|
|
6
|
+
|
|
7
|
+
const onChange = (value: string) => {
|
|
8
|
+
setValue(value);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
return <SearchInput placeholder="Find by name" value={value} onChange={onChange} onClear={() => onChange('')} />;
|
|
12
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SearchInput, Button } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const SearchInputFocusSearch: React.FunctionComponent = () => {
|
|
5
|
+
const [value, setValue] = React.useState('');
|
|
6
|
+
const ref: React.MutableRefObject<HTMLInputElement | null> = React.useRef(null);
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<>
|
|
10
|
+
<SearchInput ref={ref} value={value} onChange={setValue} onClear={() => setValue('')} />
|
|
11
|
+
<Button onClick={() => ref.current && ref.current.focus()}>Focus on the search input</Button>
|
|
12
|
+
</>
|
|
13
|
+
);
|
|
14
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SearchInput } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const SearchInputWithNavigableOptions: React.FunctionComponent = () => {
|
|
5
|
+
const [value, setValue] = React.useState('');
|
|
6
|
+
const [resultsCount, setResultsCount] = React.useState(0);
|
|
7
|
+
const [currentResult, setCurrentResult] = React.useState(1);
|
|
8
|
+
|
|
9
|
+
const onChange = (value: string) => {
|
|
10
|
+
setValue(value);
|
|
11
|
+
setResultsCount(3);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const onClear = () => {
|
|
15
|
+
setValue('');
|
|
16
|
+
setResultsCount(0);
|
|
17
|
+
setCurrentResult(1);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const onNext = () => {
|
|
21
|
+
const newCurrentResult = currentResult + 1;
|
|
22
|
+
setCurrentResult(newCurrentResult > resultsCount ? resultsCount : newCurrentResult);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const onPrevious = () => {
|
|
26
|
+
const newCurrentResult = currentResult - 1;
|
|
27
|
+
setCurrentResult(newCurrentResult > 0 ? newCurrentResult : 1);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<SearchInput
|
|
32
|
+
placeholder="Find by name"
|
|
33
|
+
value={value}
|
|
34
|
+
onChange={onChange}
|
|
35
|
+
onClear={onClear}
|
|
36
|
+
isNextNavigationButtonDisabled={currentResult === 3}
|
|
37
|
+
isPreviousNavigationButtonDisabled={currentResult === 1}
|
|
38
|
+
resultsCount={`${currentResult} / ${resultsCount}`}
|
|
39
|
+
onNextClick={onNext}
|
|
40
|
+
onPreviousClick={onPrevious}
|
|
41
|
+
/>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SearchInput } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const SearchInputWithResultCount: React.FunctionComponent = () => {
|
|
5
|
+
const [value, setValue] = React.useState('');
|
|
6
|
+
const [resultsCount, setResultsCount] = React.useState(0);
|
|
7
|
+
|
|
8
|
+
const onChange = (value: string) => {
|
|
9
|
+
setValue(value);
|
|
10
|
+
setResultsCount(3);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const onClear = () => {
|
|
14
|
+
setValue('');
|
|
15
|
+
setResultsCount(0);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<SearchInput
|
|
20
|
+
placeholder="Find by name"
|
|
21
|
+
value={value}
|
|
22
|
+
onChange={onChange}
|
|
23
|
+
onClear={onClear}
|
|
24
|
+
resultsCount={resultsCount}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SearchInput } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const SearchInputWithSubmitButton: React.FunctionComponent = () => {
|
|
5
|
+
const [value, setValue] = React.useState('');
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<SearchInput
|
|
9
|
+
placeholder="Find by name"
|
|
10
|
+
value={value}
|
|
11
|
+
onChange={setValue}
|
|
12
|
+
onSearch={setValue}
|
|
13
|
+
onClear={() => setValue('')}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
};
|
package/src/demos/JumpLinks.md
CHANGED
|
@@ -10,6 +10,7 @@ import DashboardWrapper from './examples/DashboardWrapper';
|
|
|
10
10
|
JumpLinks has a scrollspy built-in to make your implementation easier. When implementing JumpLinks be sure to:
|
|
11
11
|
|
|
12
12
|
1. Find the correct `scrollableSelector` for your page via [Firefox's debugging scrollable overflow](https://developer.mozilla.org/en-US/docs/Tools/Page_Inspector/How_to/Debug_Scrollable_Overflow) or by adding `hasOverflowScroll` to a [PageSection](/components/page#pagesection) or [PageGroup](/components/page#pagegroup).
|
|
13
|
+
- If you add `hasOverflowScroll` to a Page sub-component you should also add a relevant aria-label to that component as well.
|
|
13
14
|
2. Provide `href`s to your JumpLinksItems which match the `id` of elements you want to spy on. If you wish to scroll to a different item than you're linking to use the `node` prop.
|
|
14
15
|
|
|
15
16
|
### Scrollspy with subsections
|
|
@@ -34,7 +34,12 @@ export const Name = () => {
|
|
|
34
34
|
<Switch label="Always show BackToTopButton" onChange={handleChange} isChecked={isAlwaysVisible} />
|
|
35
35
|
</TextContent>
|
|
36
36
|
</PageSection>
|
|
37
|
-
<PageSection
|
|
37
|
+
<PageSection
|
|
38
|
+
hasOverflowScroll
|
|
39
|
+
name="scrolling-section"
|
|
40
|
+
tabIndex={0}
|
|
41
|
+
aria-label="Scrollable container of demonstration cards with a back to top element"
|
|
42
|
+
>
|
|
38
43
|
<Gallery hasGutter>
|
|
39
44
|
{Array.apply(0, Array(60)).map((_x: any, i: number) => (
|
|
40
45
|
<GalleryItem key={i}>
|