@patternfly/react-core 4.250.2 → 4.250.4
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 +16 -0
- package/dist/esm/components/Select/Select.d.ts +2 -0
- package/dist/esm/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/components/Select/Select.js +10 -3
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/js/components/Select/Select.d.ts +2 -0
- package/dist/js/components/Select/Select.d.ts.map +1 -1
- package/dist/js/components/Select/Select.js +10 -3
- package/dist/js/components/Select/Select.js.map +1 -1
- package/dist/umd/react-core.min.css +317 -317
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +2 -2
- package/src/components/Banner/__tests__/Banner.test.tsx +88 -23
- package/src/components/Banner/__tests__/__snapshots__/Banner.test.tsx.snap +2 -83
- package/src/components/Select/Select.tsx +12 -1
- package/src/components/Select/__tests__/Select.test.tsx +32 -0
- package/src/components/Select/examples/Select.md +17 -0
- package/src/components/Sidebar/examples/Sidebar.md +6 -83
- package/src/components/Sidebar/examples/SidebarBasic.tsx +24 -0
- package/src/components/Sidebar/examples/SidebarPanelRightGutter.tsx +24 -0
- package/src/components/Sidebar/examples/SidebarResponsivePanel.tsx +25 -0
- package/src/components/Sidebar/examples/SidebarStack.tsx +24 -0
- package/src/components/Sidebar/examples/SidebarStaticPanel.tsx +25 -0
- package/src/components/Sidebar/examples/SidebarStickyPanel.tsx +25 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.250.
|
|
3
|
+
"version": "4.250.4",
|
|
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",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"react": "^16.8 || ^17 || ^18",
|
|
71
71
|
"react-dom": "^16.8 || ^17 || ^18"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "2f37a674bf64e0a0b40879834d1fb8b9da9f9944"
|
|
74
74
|
}
|
|
@@ -1,27 +1,92 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
1
3
|
import { Banner } from '../Banner';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
<Banner
|
|
9
|
-
variant={variant as 'default' | 'info' | 'success' | 'warning' | 'danger'}
|
|
10
|
-
aria-label={variant}
|
|
11
|
-
screenReaderText={`${variant} banner`}
|
|
12
|
-
>
|
|
13
|
-
{variant} Banner
|
|
14
|
-
</Banner>
|
|
15
|
-
);
|
|
16
|
-
expect(asFragment()).toMatchSnapshot();
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
test(`sticky banner`, () => {
|
|
21
|
-
const { asFragment } = render(
|
|
22
|
-
<Banner aria-label="sticky" isSticky>
|
|
23
|
-
Sticky Banner
|
|
24
|
-
</Banner>
|
|
4
|
+
|
|
5
|
+
test('Renders without children', () => {
|
|
6
|
+
render(
|
|
7
|
+
<div data-testid="banner">
|
|
8
|
+
<Banner />
|
|
9
|
+
</div>
|
|
25
10
|
);
|
|
11
|
+
expect(screen.getByTestId('banner').firstChild).toBeVisible();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
test('Renders children', () => {
|
|
15
|
+
render(<Banner>Test</Banner>);
|
|
16
|
+
expect(screen.getByText('Test')).toBeVisible();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test('Renders with class name pf-c-banner', () => {
|
|
20
|
+
render(<Banner>Test</Banner>);
|
|
21
|
+
expect(screen.getByText('Test')).toHaveClass('pf-c-banner');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test('Renders with custom class name when className prop is provided', () => {
|
|
25
|
+
render(<Banner className="custom-class">Test</Banner>);
|
|
26
|
+
expect(screen.getByText('Test')).toHaveClass('custom-class');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('Renders without any modifier class when variant prop is not passed', () => {
|
|
30
|
+
render(<Banner>Test</Banner>);
|
|
31
|
+
expect(screen.getByText('Test')).toHaveClass('pf-c-banner', { exact: true });
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test('Renders with class name pf-m-success when "success" is passed to variant prop', () => {
|
|
35
|
+
render(<Banner variant="success">Test</Banner>);
|
|
36
|
+
expect(screen.getByText('Test')).toHaveClass('pf-m-success');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('Renders with class name pf-m-danger when "danger" is passed to variant prop', () => {
|
|
40
|
+
render(<Banner variant="danger">Test</Banner>);
|
|
41
|
+
expect(screen.getByText('Test')).toHaveClass('pf-m-danger');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('Renders with class name pf-m-warning when "warning" is passed to variant prop', () => {
|
|
45
|
+
render(<Banner variant="warning">Test</Banner>);
|
|
46
|
+
expect(screen.getByText('Test')).toHaveClass('pf-m-warning');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('Renders with class name pf-m-info when "info" is passed to variant prop', () => {
|
|
50
|
+
render(<Banner variant="info">Test</Banner>);
|
|
51
|
+
expect(screen.getByText('Test')).toHaveClass('pf-m-info');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('Renders pf-u-screen-reader class by default for screenReaderText', () => {
|
|
55
|
+
render(<Banner>Test</Banner>);
|
|
56
|
+
expect(screen.getByText('default banner')).toHaveClass('pf-u-screen-reader', { exact: true });
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test('Renders screenReaderText as "default banner" by default', () => {
|
|
60
|
+
render(<Banner>Test</Banner>);
|
|
61
|
+
expect(screen.getByText('default banner')).toBeInTheDocument();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test('Renders screenReaderText as "success banner" when variant="success"', () => {
|
|
65
|
+
render(<Banner variant="success">Test</Banner>);
|
|
66
|
+
expect(screen.getByText('success banner')).toBeInTheDocument();
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test('Renders custom screenReaderText passed via prop', () => {
|
|
70
|
+
render(<Banner screenReaderText="Custom screen reader text">Test</Banner>);
|
|
71
|
+
expect(screen.getByText('Custom screen reader text')).toBeInTheDocument();
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test('Renders without pf-m-sticky by default', () => {
|
|
75
|
+
render(<Banner>Test</Banner>);
|
|
76
|
+
expect(screen.getByText('Test')).not.toHaveClass('pf-m-sticky');
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test('Renders with class name pf-m-sticky when isSticky prop is passed', () => {
|
|
80
|
+
render(<Banner isSticky>Test</Banner>);
|
|
81
|
+
expect(screen.getByText('Test')).toHaveClass('pf-m-sticky');
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test('Renders with inherited element props spread to the component', () => {
|
|
85
|
+
render(<Banner aria-label="Test label">Test</Banner>);
|
|
86
|
+
expect(screen.getByText('Test')).toHaveAccessibleName('Test label');
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test('Matches the snapshot', () => {
|
|
90
|
+
const { asFragment } = render(<Banner>Test</Banner>);
|
|
26
91
|
expect(asFragment()).toMatchSnapshot();
|
|
27
92
|
});
|
|
@@ -1,60 +1,11 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`
|
|
3
|
+
exports[`Matches the snapshot 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<div
|
|
6
|
-
aria-label="danger"
|
|
7
|
-
class="pf-c-banner pf-m-danger"
|
|
8
|
-
>
|
|
9
|
-
danger Banner
|
|
10
|
-
<span
|
|
11
|
-
class="pf-u-screen-reader"
|
|
12
|
-
>
|
|
13
|
-
danger banner
|
|
14
|
-
</span>
|
|
15
|
-
</div>
|
|
16
|
-
</DocumentFragment>
|
|
17
|
-
`;
|
|
18
|
-
|
|
19
|
-
exports[`default banner 1`] = `
|
|
20
|
-
<DocumentFragment>
|
|
21
|
-
<div
|
|
22
|
-
aria-label="default"
|
|
23
6
|
class="pf-c-banner"
|
|
24
7
|
>
|
|
25
|
-
|
|
26
|
-
<span
|
|
27
|
-
class="pf-u-screen-reader"
|
|
28
|
-
>
|
|
29
|
-
default banner
|
|
30
|
-
</span>
|
|
31
|
-
</div>
|
|
32
|
-
</DocumentFragment>
|
|
33
|
-
`;
|
|
34
|
-
|
|
35
|
-
exports[`info banner 1`] = `
|
|
36
|
-
<DocumentFragment>
|
|
37
|
-
<div
|
|
38
|
-
aria-label="info"
|
|
39
|
-
class="pf-c-banner pf-m-info"
|
|
40
|
-
>
|
|
41
|
-
info Banner
|
|
42
|
-
<span
|
|
43
|
-
class="pf-u-screen-reader"
|
|
44
|
-
>
|
|
45
|
-
info banner
|
|
46
|
-
</span>
|
|
47
|
-
</div>
|
|
48
|
-
</DocumentFragment>
|
|
49
|
-
`;
|
|
50
|
-
|
|
51
|
-
exports[`sticky banner 1`] = `
|
|
52
|
-
<DocumentFragment>
|
|
53
|
-
<div
|
|
54
|
-
aria-label="sticky"
|
|
55
|
-
class="pf-c-banner pf-m-sticky"
|
|
56
|
-
>
|
|
57
|
-
Sticky Banner
|
|
8
|
+
Test
|
|
58
9
|
<span
|
|
59
10
|
class="pf-u-screen-reader"
|
|
60
11
|
>
|
|
@@ -63,35 +14,3 @@ exports[`sticky banner 1`] = `
|
|
|
63
14
|
</div>
|
|
64
15
|
</DocumentFragment>
|
|
65
16
|
`;
|
|
66
|
-
|
|
67
|
-
exports[`success banner 1`] = `
|
|
68
|
-
<DocumentFragment>
|
|
69
|
-
<div
|
|
70
|
-
aria-label="success"
|
|
71
|
-
class="pf-c-banner pf-m-success"
|
|
72
|
-
>
|
|
73
|
-
success Banner
|
|
74
|
-
<span
|
|
75
|
-
class="pf-u-screen-reader"
|
|
76
|
-
>
|
|
77
|
-
success banner
|
|
78
|
-
</span>
|
|
79
|
-
</div>
|
|
80
|
-
</DocumentFragment>
|
|
81
|
-
`;
|
|
82
|
-
|
|
83
|
-
exports[`warning banner 1`] = `
|
|
84
|
-
<DocumentFragment>
|
|
85
|
-
<div
|
|
86
|
-
aria-label="warning"
|
|
87
|
-
class="pf-c-banner pf-m-warning"
|
|
88
|
-
>
|
|
89
|
-
warning Banner
|
|
90
|
-
<span
|
|
91
|
-
class="pf-u-screen-reader"
|
|
92
|
-
>
|
|
93
|
-
warning banner
|
|
94
|
-
</span>
|
|
95
|
-
</div>
|
|
96
|
-
</DocumentFragment>
|
|
97
|
-
`;
|
|
@@ -69,6 +69,8 @@ export interface SelectProps
|
|
|
69
69
|
isDisabled?: boolean;
|
|
70
70
|
/** Flag to indicate if the typeahead select allows new items */
|
|
71
71
|
isCreatable?: boolean;
|
|
72
|
+
/** Flag to indicate if create option should be at top of typeahead */
|
|
73
|
+
isCreateOptionOnTop?: boolean;
|
|
72
74
|
/** Flag indicating if placeholder styles should be applied */
|
|
73
75
|
hasPlaceholderStyle?: boolean;
|
|
74
76
|
/** @beta Flag indicating if the creatable option should set its value as a SelectOptionObject */
|
|
@@ -226,6 +228,7 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
|
|
|
226
228
|
isDisabled: false,
|
|
227
229
|
hasPlaceholderStyle: false,
|
|
228
230
|
isCreatable: false,
|
|
231
|
+
isCreateOptionOnTop: false,
|
|
229
232
|
validated: 'default',
|
|
230
233
|
'aria-label': '',
|
|
231
234
|
'aria-labelledby': '',
|
|
@@ -433,6 +436,7 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
|
|
|
433
436
|
const {
|
|
434
437
|
onFilter,
|
|
435
438
|
isCreatable,
|
|
439
|
+
isCreateOptionOnTop,
|
|
436
440
|
onCreateOption,
|
|
437
441
|
createText,
|
|
438
442
|
noResultsFoundText,
|
|
@@ -542,7 +546,7 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
|
|
|
542
546
|
} as SelectOptionObject)
|
|
543
547
|
: newValue;
|
|
544
548
|
|
|
545
|
-
|
|
549
|
+
const createSelectOption = (
|
|
546
550
|
<SelectOption
|
|
547
551
|
key={`create ${newValue}`}
|
|
548
552
|
value={newOptionValue}
|
|
@@ -551,6 +555,12 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
|
|
|
551
555
|
{createText} "{newValue}"
|
|
552
556
|
</SelectOption>
|
|
553
557
|
);
|
|
558
|
+
|
|
559
|
+
if (isCreateOptionOnTop) {
|
|
560
|
+
typeaheadFilteredChildren.unshift(createSelectOption);
|
|
561
|
+
} else {
|
|
562
|
+
typeaheadFilteredChildren.push(createSelectOption);
|
|
563
|
+
}
|
|
554
564
|
}
|
|
555
565
|
}
|
|
556
566
|
|
|
@@ -1020,6 +1030,7 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
|
|
|
1020
1030
|
footer,
|
|
1021
1031
|
loadingVariant,
|
|
1022
1032
|
isCreateSelectOptionObject,
|
|
1033
|
+
isCreateOptionOnTop,
|
|
1023
1034
|
shouldResetOnSelect,
|
|
1024
1035
|
isFlipEnabled,
|
|
1025
1036
|
removeFindDomNode,
|
|
@@ -560,3 +560,35 @@ test('applies focus styling to the create option when reached via keyboard navig
|
|
|
560
560
|
|
|
561
561
|
expect(createOption.parentElement).toHaveClass('pf-m-focus');
|
|
562
562
|
});
|
|
563
|
+
|
|
564
|
+
test('appends create option to list of options', async () => {
|
|
565
|
+
const user = userEvent.setup();
|
|
566
|
+
|
|
567
|
+
render(
|
|
568
|
+
<Select variant={SelectVariant.typeahead} onToggle={() => {}} isOpen isCreatable>
|
|
569
|
+
{selectOptions}
|
|
570
|
+
</Select>
|
|
571
|
+
);
|
|
572
|
+
|
|
573
|
+
const input = screen.getByRole('textbox');
|
|
574
|
+
await user.type(input, `m`);
|
|
575
|
+
|
|
576
|
+
const createOption = screen.getAllByRole('option')[3];
|
|
577
|
+
expect(createOption).toHaveTextContent('Create "m"');
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
test('prepends create option to list of options if isCreateOptionOnTop flag is set', async () => {
|
|
581
|
+
const user = userEvent.setup();
|
|
582
|
+
|
|
583
|
+
render(
|
|
584
|
+
<Select variant={SelectVariant.typeahead} onToggle={() => {}} isOpen isCreateOptionOnTop isCreatable>
|
|
585
|
+
{selectOptions}
|
|
586
|
+
</Select>
|
|
587
|
+
);
|
|
588
|
+
|
|
589
|
+
const input = screen.getByRole('textbox');
|
|
590
|
+
await user.type(input, `m`);
|
|
591
|
+
|
|
592
|
+
const createOption = screen.getAllByRole('option')[0];
|
|
593
|
+
expect(createOption).toHaveTextContent('Create "m"');
|
|
594
|
+
});
|
|
@@ -1209,6 +1209,7 @@ class TypeaheadSelectInput extends React.Component {
|
|
|
1209
1209
|
selected: null,
|
|
1210
1210
|
isDisabled: false,
|
|
1211
1211
|
isCreatable: false,
|
|
1212
|
+
isCreateOptionOnTop: false,
|
|
1212
1213
|
isInputValuePersisted: false,
|
|
1213
1214
|
isInputFilterPersisted: false,
|
|
1214
1215
|
hasOnCreateOption: false,
|
|
@@ -1258,6 +1259,12 @@ class TypeaheadSelectInput extends React.Component {
|
|
|
1258
1259
|
});
|
|
1259
1260
|
};
|
|
1260
1261
|
|
|
1262
|
+
this.toggleCreateOptionOnTop = checked => {
|
|
1263
|
+
this.setState({
|
|
1264
|
+
isCreateOptionOnTop: checked
|
|
1265
|
+
});
|
|
1266
|
+
};
|
|
1267
|
+
|
|
1261
1268
|
this.toggleCreateNew = checked => {
|
|
1262
1269
|
this.setState({
|
|
1263
1270
|
hasOnCreateOption: checked
|
|
@@ -1289,6 +1296,7 @@ class TypeaheadSelectInput extends React.Component {
|
|
|
1289
1296
|
selected,
|
|
1290
1297
|
isDisabled,
|
|
1291
1298
|
isCreatable,
|
|
1299
|
+
isCreateOptionOnTop,
|
|
1292
1300
|
hasOnCreateOption,
|
|
1293
1301
|
isInputValuePersisted,
|
|
1294
1302
|
isInputFilterPersisted,
|
|
@@ -1315,6 +1323,7 @@ class TypeaheadSelectInput extends React.Component {
|
|
|
1315
1323
|
placeholderText="Select a state"
|
|
1316
1324
|
isDisabled={isDisabled}
|
|
1317
1325
|
isCreatable={isCreatable}
|
|
1326
|
+
isCreateOptionOnTop={isCreateOptionOnTop}
|
|
1318
1327
|
onCreateOption={(hasOnCreateOption && this.onCreateOption) || undefined}
|
|
1319
1328
|
shouldResetOnSelect={resetOnSelect}
|
|
1320
1329
|
>
|
|
@@ -1343,6 +1352,14 @@ class TypeaheadSelectInput extends React.Component {
|
|
|
1343
1352
|
id="toggle-creatable-typeahead"
|
|
1344
1353
|
name="toggle-creatable-typeahead"
|
|
1345
1354
|
/>
|
|
1355
|
+
<Checkbox
|
|
1356
|
+
label="isCreateOptionOnTop"
|
|
1357
|
+
isChecked={this.state.isCreateOptionOnTop}
|
|
1358
|
+
onChange={this.toggleCreateOptionOnTop}
|
|
1359
|
+
aria-label="toggle createOptionOnTop checkbox"
|
|
1360
|
+
id="toggle-create-option-on-top-typeahead"
|
|
1361
|
+
name="toggle-create-option-on-top-typeahead"
|
|
1362
|
+
/>
|
|
1346
1363
|
<Checkbox
|
|
1347
1364
|
label="onCreateOption"
|
|
1348
1365
|
isChecked={this.state.hasOnCreateOption}
|
|
@@ -7,105 +7,28 @@ propComponents: ['Sidebar', 'SidebarContent', 'SidebarPanel']
|
|
|
7
7
|
|
|
8
8
|
## Examples
|
|
9
9
|
### Basic
|
|
10
|
-
```
|
|
11
|
-
import React from 'react';
|
|
12
|
-
import { Sidebar, SidebarContent, SidebarPanel } from '@patternfly/react-core';
|
|
13
|
-
|
|
14
|
-
<Sidebar>
|
|
15
|
-
<SidebarPanel>
|
|
16
|
-
Sidebar panel
|
|
17
|
-
</SidebarPanel>
|
|
18
|
-
<SidebarContent>
|
|
19
|
-
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse dapibus nulla id augue dictum commodo. Donec mollis arcu massa, sollicitudin venenatis est rutrum vitae. Integer pulvinar ligula at augue mollis, ac pulvinar arcu semper. Maecenas nisi lorem, malesuada ac lectus nec, porta pretium neque. Ut convallis libero sit amet metus mattis, vel facilisis lorem malesuada. Duis consectetur ante sit amet magna efficitur, a interdum leo vulputate.</p>
|
|
20
|
-
<p>Praesent at odio nec sapien ultrices tincidunt in non mauris. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Duis consectetur nisl quis facilisis faucibus. Sed eu bibendum risus. Suspendisse porta euismod tortor, at elementum odio suscipit sed. Cras eget ultrices urna, ac feugiat lectus. Integer a pharetra velit, in imperdiet mi. Phasellus vel hendrerit velit. Vestibulum ut augue vitae erat vulputate bibendum a ut magna.</p>
|
|
21
|
-
</SidebarContent>
|
|
22
|
-
</Sidebar>
|
|
10
|
+
```ts file="./SidebarBasic.tsx"
|
|
23
11
|
```
|
|
24
12
|
|
|
25
13
|
### Stack
|
|
26
|
-
```
|
|
27
|
-
import React from 'react';
|
|
28
|
-
import { Sidebar, SidebarContent, SidebarPanel } from '@patternfly/react-core';
|
|
29
|
-
|
|
30
|
-
<Sidebar orientation="stack">
|
|
31
|
-
<SidebarPanel>
|
|
32
|
-
Sidebar panel stacked on top
|
|
33
|
-
</SidebarPanel>
|
|
34
|
-
<SidebarContent>
|
|
35
|
-
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse dapibus nulla id augue dictum commodo. Donec mollis arcu massa, sollicitudin venenatis est rutrum vitae. Integer pulvinar ligula at augue mollis, ac pulvinar arcu semper. Maecenas nisi lorem, malesuada ac lectus nec, porta pretium neque. Ut convallis libero sit amet metus mattis, vel facilisis lorem malesuada. Duis consectetur ante sit amet magna efficitur, a interdum leo vulputate.</p>
|
|
36
|
-
<p>Praesent at odio nec sapien ultrices tincidunt in non mauris. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Duis consectetur nisl quis facilisis faucibus. Sed eu bibendum risus. Suspendisse porta euismod tortor, at elementum odio suscipit sed. Cras eget ultrices urna, ac feugiat lectus. Integer a pharetra velit, in imperdiet mi. Phasellus vel hendrerit velit. Vestibulum ut augue vitae erat vulputate bibendum a ut magna.</p>
|
|
37
|
-
</SidebarContent>
|
|
38
|
-
</Sidebar>
|
|
14
|
+
```ts file="./SidebarStack.tsx"
|
|
39
15
|
```
|
|
40
16
|
|
|
41
17
|
### Panel right with gutter
|
|
42
|
-
```
|
|
43
|
-
import React from 'react';
|
|
44
|
-
import { Sidebar, SidebarContent, SidebarPanel } from '@patternfly/react-core';
|
|
45
|
-
|
|
46
|
-
<Sidebar isPanelRight hasGutter>
|
|
47
|
-
<SidebarPanel>
|
|
48
|
-
Sidebar panel on the right
|
|
49
|
-
</SidebarPanel>
|
|
50
|
-
<SidebarContent>
|
|
51
|
-
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse dapibus nulla id augue dictum commodo. Donec mollis arcu massa, sollicitudin venenatis est rutrum vitae. Integer pulvinar ligula at augue mollis, ac pulvinar arcu semper. Maecenas nisi lorem, malesuada ac lectus nec, porta pretium neque. Ut convallis libero sit amet metus mattis, vel facilisis lorem malesuada. Duis consectetur ante sit amet magna efficitur, a interdum leo vulputate.</p>
|
|
52
|
-
<p>Praesent at odio nec sapien ultrices tincidunt in non mauris. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Duis consectetur nisl quis facilisis faucibus. Sed eu bibendum risus. Suspendisse porta euismod tortor, at elementum odio suscipit sed. Cras eget ultrices urna, ac feugiat lectus. Integer a pharetra velit, in imperdiet mi. Phasellus vel hendrerit velit. Vestibulum ut augue vitae erat vulputate bibendum a ut magna.</p>
|
|
53
|
-
</SidebarContent>
|
|
54
|
-
</Sidebar>
|
|
18
|
+
```ts file="./SidebarPanelRightGutter.tsx"
|
|
55
19
|
```
|
|
56
20
|
|
|
57
21
|
### Sticky panel
|
|
58
22
|
A `tabIndex` should be added to the `Sidebar` when there is scrollable content in order for the overflow content to be accessible by keyboard.
|
|
59
|
-
```
|
|
60
|
-
import React from 'react';
|
|
61
|
-
import { Sidebar, SidebarContent, SidebarPanel } from '@patternfly/react-core';
|
|
62
|
-
|
|
63
|
-
<Sidebar style={{ height: '200px', overflow: 'auto' }} tabIndex={0}>
|
|
64
|
-
<SidebarPanel variant="sticky">
|
|
65
|
-
Sticky sidebar panel
|
|
66
|
-
</SidebarPanel>
|
|
67
|
-
<SidebarContent>
|
|
68
|
-
<p>Scroll me!</p>
|
|
69
|
-
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse dapibus nulla id augue dictum commodo. Donec mollis arcu massa, sollicitudin venenatis est rutrum vitae. Integer pulvinar ligula at augue mollis, ac pulvinar arcu semper. Maecenas nisi lorem, malesuada ac lectus nec, porta pretium neque. Ut convallis libero sit amet metus mattis, vel facilisis lorem malesuada. Duis consectetur ante sit amet magna efficitur, a interdum leo vulputate.</p>
|
|
70
|
-
<p>Praesent at odio nec sapien ultrices tincidunt in non mauris. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Duis consectetur nisl quis facilisis faucibus. Sed eu bibendum risus. Suspendisse porta euismod tortor, at elementum odio suscipit sed. Cras eget ultrices urna, ac feugiat lectus. Integer a pharetra velit, in imperdiet mi. Phasellus vel hendrerit velit. Vestibulum ut augue vitae erat vulputate bibendum a ut magna.</p>
|
|
71
|
-
</SidebarContent>
|
|
72
|
-
</Sidebar>
|
|
23
|
+
```ts file="./SidebarStickyPanel.tsx"
|
|
73
24
|
```
|
|
74
25
|
|
|
75
26
|
### Static panel
|
|
76
27
|
A `tabIndex` should be added to the `Sidebar` when there is scrollable content in order for the overflow content to be accessible by keyboard.
|
|
77
|
-
```
|
|
78
|
-
import React from 'react';
|
|
79
|
-
import { Sidebar, SidebarContent, SidebarPanel } from '@patternfly/react-core';
|
|
80
|
-
|
|
81
|
-
<Sidebar style={{ height: '200px', overflow: 'auto' }} tabIndex={0}>
|
|
82
|
-
<SidebarPanel variant="static">
|
|
83
|
-
Static sidebar panel
|
|
84
|
-
</SidebarPanel>
|
|
85
|
-
<SidebarContent>
|
|
86
|
-
<p>Scroll me!</p>
|
|
87
|
-
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse dapibus nulla id augue dictum commodo. Donec mollis arcu massa, sollicitudin venenatis est rutrum vitae. Integer pulvinar ligula at augue mollis, ac pulvinar arcu semper. Maecenas nisi lorem, malesuada ac lectus nec, porta pretium neque. Ut convallis libero sit amet metus mattis, vel facilisis lorem malesuada. Duis consectetur ante sit amet magna efficitur, a interdum leo vulputate.</p>
|
|
88
|
-
<p>Praesent at odio nec sapien ultrices tincidunt in non mauris. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Duis consectetur nisl quis facilisis faucibus. Sed eu bibendum risus. Suspendisse porta euismod tortor, at elementum odio suscipit sed. Cras eget ultrices urna, ac feugiat lectus. Integer a pharetra velit, in imperdiet mi. Phasellus vel hendrerit velit. Vestibulum ut augue vitae erat vulputate bibendum a ut magna.</p>
|
|
89
|
-
</SidebarContent>
|
|
90
|
-
</Sidebar>
|
|
28
|
+
```ts file="./SidebarStaticPanel.tsx"
|
|
91
29
|
```
|
|
92
30
|
|
|
93
31
|
### Responsive panel width
|
|
94
32
|
A `tabIndex` should be added to the `Sidebar` when there is scrollable content in order for the overflow content to be accessible by keyboard.
|
|
95
|
-
```
|
|
96
|
-
import React from 'react';
|
|
97
|
-
import { Sidebar, SidebarContent, SidebarPanel } from '@patternfly/react-core';
|
|
98
|
-
|
|
99
|
-
<Sidebar style={{ height: '200px', overflow: 'auto' }} tabIndex={0}>
|
|
100
|
-
<SidebarPanel width={{ default: 'width_50', lg: 'width_33', xl: 'width_75' }}>
|
|
101
|
-
Sidebar panel
|
|
102
|
-
</SidebarPanel>
|
|
103
|
-
<SidebarContent>
|
|
104
|
-
<p>Resize me!</p>
|
|
105
|
-
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse dapibus nulla id augue dictum commodo. Donec mollis arcu massa, sollicitudin venenatis est rutrum vitae. Integer pulvinar ligula at augue mollis, ac pulvinar arcu semper. Maecenas nisi lorem, malesuada ac lectus nec, porta pretium neque. Ut convallis libero sit amet metus mattis, vel facilisis lorem malesuada. Duis consectetur ante sit amet magna efficitur, a interdum leo vulputate.</p>
|
|
106
|
-
<p>Praesent at odio nec sapien ultrices tincidunt in non mauris. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Duis consectetur nisl quis facilisis faucibus. Sed eu bibendum risus. Suspendisse porta euismod tortor, at elementum odio suscipit sed. Cras eget ultrices urna, ac feugiat lectus. Integer a pharetra velit, in imperdiet mi. Phasellus vel hendrerit velit. Vestibulum ut augue vitae erat vulputate bibendum a ut magna.</p>
|
|
107
|
-
</SidebarContent>
|
|
108
|
-
</Sidebar>
|
|
33
|
+
```ts file="./SidebarResponsivePanel.tsx"
|
|
109
34
|
```
|
|
110
|
-
|
|
111
|
-
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Sidebar, SidebarContent, SidebarPanel } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const SidebarBasic: React.FunctionComponent = () => (
|
|
5
|
+
<Sidebar>
|
|
6
|
+
<SidebarPanel>Sidebar panel</SidebarPanel>
|
|
7
|
+
<SidebarContent>
|
|
8
|
+
<p>
|
|
9
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse dapibus nulla id augue dictum commodo.
|
|
10
|
+
Donec mollis arcu massa, sollicitudin venenatis est rutrum vitae. Integer pulvinar ligula at augue mollis, ac
|
|
11
|
+
pulvinar arcu semper. Maecenas nisi lorem, malesuada ac lectus nec, porta pretium neque. Ut convallis libero sit
|
|
12
|
+
amet metus mattis, vel facilisis lorem malesuada. Duis consectetur ante sit amet magna efficitur, a interdum leo
|
|
13
|
+
vulputate.
|
|
14
|
+
</p>
|
|
15
|
+
<p>
|
|
16
|
+
Praesent at odio nec sapien ultrices tincidunt in non mauris. Orci varius natoque penatibus et magnis dis
|
|
17
|
+
parturient montes, nascetur ridiculus mus. Duis consectetur nisl quis facilisis faucibus. Sed eu bibendum risus.
|
|
18
|
+
Suspendisse porta euismod tortor, at elementum odio suscipit sed. Cras eget ultrices urna, ac feugiat lectus.
|
|
19
|
+
Integer a pharetra velit, in imperdiet mi. Phasellus vel hendrerit velit. Vestibulum ut augue vitae erat
|
|
20
|
+
vulputate bibendum a ut magna.
|
|
21
|
+
</p>
|
|
22
|
+
</SidebarContent>
|
|
23
|
+
</Sidebar>
|
|
24
|
+
);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Sidebar, SidebarContent, SidebarPanel } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const SidebarPanelRightGutter: React.FunctionComponent = () => (
|
|
5
|
+
<Sidebar isPanelRight hasGutter>
|
|
6
|
+
<SidebarPanel>Sidebar panel on the right</SidebarPanel>
|
|
7
|
+
<SidebarContent>
|
|
8
|
+
<p>
|
|
9
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse dapibus nulla id augue dictum commodo.
|
|
10
|
+
Donec mollis arcu massa, sollicitudin venenatis est rutrum vitae. Integer pulvinar ligula at augue mollis, ac
|
|
11
|
+
pulvinar arcu semper. Maecenas nisi lorem, malesuada ac lectus nec, porta pretium neque. Ut convallis libero sit
|
|
12
|
+
amet metus mattis, vel facilisis lorem malesuada. Duis consectetur ante sit amet magna efficitur, a interdum leo
|
|
13
|
+
vulputate.
|
|
14
|
+
</p>
|
|
15
|
+
<p>
|
|
16
|
+
Praesent at odio nec sapien ultrices tincidunt in non mauris. Orci varius natoque penatibus et magnis dis
|
|
17
|
+
parturient montes, nascetur ridiculus mus. Duis consectetur nisl quis facilisis faucibus. Sed eu bibendum risus.
|
|
18
|
+
Suspendisse porta euismod tortor, at elementum odio suscipit sed. Cras eget ultrices urna, ac feugiat lectus.
|
|
19
|
+
Integer a pharetra velit, in imperdiet mi. Phasellus vel hendrerit velit. Vestibulum ut augue vitae erat
|
|
20
|
+
vulputate bibendum a ut magna.
|
|
21
|
+
</p>
|
|
22
|
+
</SidebarContent>
|
|
23
|
+
</Sidebar>
|
|
24
|
+
);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Sidebar, SidebarContent, SidebarPanel } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const SidebarResponsivePanel: React.FunctionComponent = () => (
|
|
5
|
+
<Sidebar style={{ height: '200px', overflow: 'auto' }} tabIndex={0}>
|
|
6
|
+
<SidebarPanel width={{ default: 'width_50', lg: 'width_33', xl: 'width_75' }}>Sidebar panel</SidebarPanel>
|
|
7
|
+
<SidebarContent>
|
|
8
|
+
<p>Resize me!</p>
|
|
9
|
+
<p>
|
|
10
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse dapibus nulla id augue dictum commodo.
|
|
11
|
+
Donec mollis arcu massa, sollicitudin venenatis est rutrum vitae. Integer pulvinar ligula at augue mollis, ac
|
|
12
|
+
pulvinar arcu semper. Maecenas nisi lorem, malesuada ac lectus nec, porta pretium neque. Ut convallis libero sit
|
|
13
|
+
amet metus mattis, vel facilisis lorem malesuada. Duis consectetur ante sit amet magna efficitur, a interdum leo
|
|
14
|
+
vulputate.
|
|
15
|
+
</p>
|
|
16
|
+
<p>
|
|
17
|
+
Praesent at odio nec sapien ultrices tincidunt in non mauris. Orci varius natoque penatibus et magnis dis
|
|
18
|
+
parturient montes, nascetur ridiculus mus. Duis consectetur nisl quis facilisis faucibus. Sed eu bibendum risus.
|
|
19
|
+
Suspendisse porta euismod tortor, at elementum odio suscipit sed. Cras eget ultrices urna, ac feugiat lectus.
|
|
20
|
+
Integer a pharetra velit, in imperdiet mi. Phasellus vel hendrerit velit. Vestibulum ut augue vitae erat
|
|
21
|
+
vulputate bibendum a ut magna.
|
|
22
|
+
</p>
|
|
23
|
+
</SidebarContent>
|
|
24
|
+
</Sidebar>
|
|
25
|
+
);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Sidebar, SidebarContent, SidebarPanel } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const SidebarStack: React.FunctionComponent = () => (
|
|
5
|
+
<Sidebar orientation="stack">
|
|
6
|
+
<SidebarPanel>Sidebar panel stacked on top</SidebarPanel>
|
|
7
|
+
<SidebarContent>
|
|
8
|
+
<p>
|
|
9
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse dapibus nulla id augue dictum commodo.
|
|
10
|
+
Donec mollis arcu massa, sollicitudin venenatis est rutrum vitae. Integer pulvinar ligula at augue mollis, ac
|
|
11
|
+
pulvinar arcu semper. Maecenas nisi lorem, malesuada ac lectus nec, porta pretium neque. Ut convallis libero sit
|
|
12
|
+
amet metus mattis, vel facilisis lorem malesuada. Duis consectetur ante sit amet magna efficitur, a interdum leo
|
|
13
|
+
vulputate.
|
|
14
|
+
</p>
|
|
15
|
+
<p>
|
|
16
|
+
Praesent at odio nec sapien ultrices tincidunt in non mauris. Orci varius natoque penatibus et magnis dis
|
|
17
|
+
parturient montes, nascetur ridiculus mus. Duis consectetur nisl quis facilisis faucibus. Sed eu bibendum risus.
|
|
18
|
+
Suspendisse porta euismod tortor, at elementum odio suscipit sed. Cras eget ultrices urna, ac feugiat lectus.
|
|
19
|
+
Integer a pharetra velit, in imperdiet mi. Phasellus vel hendrerit velit. Vestibulum ut augue vitae erat
|
|
20
|
+
vulputate bibendum a ut magna.
|
|
21
|
+
</p>
|
|
22
|
+
</SidebarContent>
|
|
23
|
+
</Sidebar>
|
|
24
|
+
);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Sidebar, SidebarContent, SidebarPanel } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const SidebarStaticPanel: React.FunctionComponent = () => (
|
|
5
|
+
<Sidebar style={{ height: '200px', overflow: 'auto' }} tabIndex={0}>
|
|
6
|
+
<SidebarPanel variant="static">Static sidebar panel</SidebarPanel>
|
|
7
|
+
<SidebarContent>
|
|
8
|
+
<p>Scroll me!</p>
|
|
9
|
+
<p>
|
|
10
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse dapibus nulla id augue dictum commodo.
|
|
11
|
+
Donec mollis arcu massa, sollicitudin venenatis est rutrum vitae. Integer pulvinar ligula at augue mollis, ac
|
|
12
|
+
pulvinar arcu semper. Maecenas nisi lorem, malesuada ac lectus nec, porta pretium neque. Ut convallis libero sit
|
|
13
|
+
amet metus mattis, vel facilisis lorem malesuada. Duis consectetur ante sit amet magna efficitur, a interdum leo
|
|
14
|
+
vulputate.
|
|
15
|
+
</p>
|
|
16
|
+
<p>
|
|
17
|
+
Praesent at odio nec sapien ultrices tincidunt in non mauris. Orci varius natoque penatibus et magnis dis
|
|
18
|
+
parturient montes, nascetur ridiculus mus. Duis consectetur nisl quis facilisis faucibus. Sed eu bibendum risus.
|
|
19
|
+
Suspendisse porta euismod tortor, at elementum odio suscipit sed. Cras eget ultrices urna, ac feugiat lectus.
|
|
20
|
+
Integer a pharetra velit, in imperdiet mi. Phasellus vel hendrerit velit. Vestibulum ut augue vitae erat
|
|
21
|
+
vulputate bibendum a ut magna.
|
|
22
|
+
</p>
|
|
23
|
+
</SidebarContent>
|
|
24
|
+
</Sidebar>
|
|
25
|
+
);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Sidebar, SidebarContent, SidebarPanel } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const SidebarStickyPanel: React.FunctionComponent = () => (
|
|
5
|
+
<Sidebar style={{ height: '200px', overflow: 'auto' }} tabIndex={0}>
|
|
6
|
+
<SidebarPanel variant="sticky">Sticky sidebar panel</SidebarPanel>
|
|
7
|
+
<SidebarContent>
|
|
8
|
+
<p>Scroll me!</p>
|
|
9
|
+
<p>
|
|
10
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse dapibus nulla id augue dictum commodo.
|
|
11
|
+
Donec mollis arcu massa, sollicitudin venenatis est rutrum vitae. Integer pulvinar ligula at augue mollis, ac
|
|
12
|
+
pulvinar arcu semper. Maecenas nisi lorem, malesuada ac lectus nec, porta pretium neque. Ut convallis libero sit
|
|
13
|
+
amet metus mattis, vel facilisis lorem malesuada. Duis consectetur ante sit amet magna efficitur, a interdum leo
|
|
14
|
+
vulputate.
|
|
15
|
+
</p>
|
|
16
|
+
<p>
|
|
17
|
+
Praesent at odio nec sapien ultrices tincidunt in non mauris. Orci varius natoque penatibus et magnis dis
|
|
18
|
+
parturient montes, nascetur ridiculus mus. Duis consectetur nisl quis facilisis faucibus. Sed eu bibendum risus.
|
|
19
|
+
Suspendisse porta euismod tortor, at elementum odio suscipit sed. Cras eget ultrices urna, ac feugiat lectus.
|
|
20
|
+
Integer a pharetra velit, in imperdiet mi. Phasellus vel hendrerit velit. Vestibulum ut augue vitae erat
|
|
21
|
+
vulputate bibendum a ut magna.
|
|
22
|
+
</p>
|
|
23
|
+
</SidebarContent>
|
|
24
|
+
</Sidebar>
|
|
25
|
+
);
|