@patternfly/react-core 4.158.1 → 4.159.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/esm/components/DragDrop/Draggable.d.ts.map +1 -1
  3. package/dist/esm/components/DragDrop/Draggable.js +13 -7
  4. package/dist/esm/components/DragDrop/Draggable.js.map +1 -1
  5. package/dist/esm/components/DragDrop/Droppable.d.ts.map +1 -1
  6. package/dist/esm/components/DragDrop/Droppable.js +3 -1
  7. package/dist/esm/components/DragDrop/Droppable.js.map +1 -1
  8. package/dist/esm/components/Select/Select.d.ts +3 -0
  9. package/dist/esm/components/Select/Select.d.ts.map +1 -1
  10. package/dist/esm/components/Select/Select.js +2 -1
  11. package/dist/esm/components/Select/Select.js.map +1 -1
  12. package/dist/esm/components/Select/SelectMenu.d.ts +3 -0
  13. package/dist/esm/components/Select/SelectMenu.d.ts.map +1 -1
  14. package/dist/esm/components/Select/SelectMenu.js +4 -3
  15. package/dist/esm/components/Select/SelectMenu.js.map +1 -1
  16. package/dist/esm/components/Select/selectConstants.d.ts +4 -0
  17. package/dist/esm/components/Select/selectConstants.d.ts.map +1 -1
  18. package/dist/esm/components/Select/selectConstants.js +5 -0
  19. package/dist/esm/components/Select/selectConstants.js.map +1 -1
  20. package/dist/esm/components/Tabs/Tabs.d.ts +20 -0
  21. package/dist/esm/components/Tabs/Tabs.d.ts.map +1 -1
  22. package/dist/esm/components/Tabs/Tabs.js +44 -14
  23. package/dist/esm/components/Tabs/Tabs.js.map +1 -1
  24. package/dist/esm/components/Wizard/WizardNavItem.js +1 -1
  25. package/dist/js/components/DragDrop/Draggable.d.ts.map +1 -1
  26. package/dist/js/components/DragDrop/Draggable.js +13 -7
  27. package/dist/js/components/DragDrop/Draggable.js.map +1 -1
  28. package/dist/js/components/DragDrop/Droppable.d.ts.map +1 -1
  29. package/dist/js/components/DragDrop/Droppable.js +3 -1
  30. package/dist/js/components/DragDrop/Droppable.js.map +1 -1
  31. package/dist/js/components/Select/Select.d.ts +3 -0
  32. package/dist/js/components/Select/Select.d.ts.map +1 -1
  33. package/dist/js/components/Select/Select.js +1 -0
  34. package/dist/js/components/Select/Select.js.map +1 -1
  35. package/dist/js/components/Select/SelectMenu.d.ts +3 -0
  36. package/dist/js/components/Select/SelectMenu.d.ts.map +1 -1
  37. package/dist/js/components/Select/SelectMenu.js +3 -2
  38. package/dist/js/components/Select/SelectMenu.js.map +1 -1
  39. package/dist/js/components/Select/selectConstants.d.ts +4 -0
  40. package/dist/js/components/Select/selectConstants.d.ts.map +1 -1
  41. package/dist/js/components/Select/selectConstants.js +6 -1
  42. package/dist/js/components/Select/selectConstants.js.map +1 -1
  43. package/dist/js/components/Tabs/Tabs.d.ts +20 -0
  44. package/dist/js/components/Tabs/Tabs.d.ts.map +1 -1
  45. package/dist/js/components/Tabs/Tabs.js +44 -14
  46. package/dist/js/components/Tabs/Tabs.js.map +1 -1
  47. package/dist/js/components/Wizard/WizardNavItem.js +1 -1
  48. package/dist/umd/react-core.css +13638 -13562
  49. package/dist/umd/react-core.js +104 -49
  50. package/dist/umd/react-core.min.css +10666 -10590
  51. package/dist/umd/react-core.min.js +2 -2
  52. package/package.json +6 -6
  53. package/src/components/DragDrop/Draggable.tsx +20 -11
  54. package/src/components/DragDrop/Droppable.tsx +3 -1
  55. package/src/components/Drawer/examples/Drawer.md +0 -78
  56. package/src/components/Page/examples/Page.md +289 -103
  57. package/src/components/Select/Select.tsx +4 -1
  58. package/src/components/Select/SelectMenu.tsx +10 -2
  59. package/src/components/Select/__tests__/Generated/__snapshots__/SelectMenu.test.tsx.snap +1 -0
  60. package/src/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +57 -0
  61. package/src/components/Select/selectConstants.tsx +5 -0
  62. package/src/components/Sidebar/examples/Sidebar.md +6 -3
  63. package/src/components/Tabs/Tabs.tsx +97 -13
  64. package/src/components/Tabs/__tests__/Generated/__snapshots__/Tabs.test.tsx.snap +4 -4
  65. package/src/components/Tabs/__tests__/Tabs.test.tsx +50 -0
  66. package/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap +276 -30
  67. package/src/components/Tabs/examples/Tabs.md +96 -0
  68. package/src/components/Wizard/WizardNavItem.tsx +1 -1
  69. package/src/demos/CardDemos.md +443 -0
  70. package/src/demos/ComposableMenu.md +125 -17
  71. package/src/demos/Page/Page.md +322 -12
@@ -18,6 +18,8 @@ propComponents:
18
18
  ]
19
19
  ---
20
20
 
21
+ import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';
22
+
21
23
  ## Examples
22
24
 
23
25
  ### Vertical nav
@@ -26,12 +28,20 @@ propComponents:
26
28
  import React from 'react';
27
29
  import {
28
30
  Page,
29
- PageHeader,
30
- PageHeaderTools,
31
+ Masthead,
32
+ MastheadToggle,
33
+ MastheadMain,
34
+ MastheadBrand,
35
+ MastheadContent,
31
36
  PageSidebar,
32
37
  PageSection,
33
- PageSectionVariants
38
+ PageSectionVariants,
39
+ PageToggleButton,
40
+ Toolbar,
41
+ ToolbarContent,
42
+ ToolbarItem
34
43
  } from '@patternfly/react-core';
44
+ import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
35
45
 
36
46
  class VerticalPage extends React.Component {
37
47
  constructor(props) {
@@ -49,20 +59,33 @@ class VerticalPage extends React.Component {
49
59
  render() {
50
60
  const { isNavOpen } = this.state;
51
61
 
52
- const logoProps = {
53
- href: 'https://patternfly.org',
54
- onClick: () => console.log('clicked logo'),
55
- target: '_blank'
56
- };
62
+ const headerToolbar = (
63
+ <Toolbar id="toolbar">
64
+ <ToolbarContent>
65
+ <ToolbarItem>header-tools</ToolbarItem>
66
+ </ToolbarContent>
67
+ </Toolbar>
68
+ );
69
+
57
70
  const Header = (
58
- <PageHeader
59
- logo="Logo"
60
- logoProps={logoProps}
61
- headerTools={<PageHeaderTools>header-tools</PageHeaderTools>}
62
- showNavToggle
63
- isNavOpen={isNavOpen}
64
- onNavToggle={this.onNavToggle}
65
- />
71
+ <Masthead>
72
+ <MastheadToggle>
73
+ <PageToggleButton
74
+ variant="plain"
75
+ aria-label="Global navigation"
76
+ isNavOpen={isNavOpen}
77
+ onNavToggle={this.onNavToggle}
78
+ >
79
+ <BarsIcon />
80
+ </PageToggleButton>
81
+ </MastheadToggle>
82
+ <MastheadMain>
83
+ <MastheadBrand href="https://patternfly.org" onClick={() => console.log('clicked logo')} target="_blank">
84
+ Logo
85
+ </MastheadBrand>
86
+ </MastheadMain>
87
+ <MastheadContent>{headerToolbar}</MastheadContent>
88
+ </Masthead>
66
89
  );
67
90
  const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} />;
68
91
 
@@ -83,26 +106,36 @@ class VerticalPage extends React.Component {
83
106
  import React from 'react';
84
107
  import {
85
108
  Page,
86
- PageHeader,
87
- PageHeaderTools,
88
- PageSidebar,
109
+ Masthead,
110
+ MastheadMain,
111
+ MastheadBrand,
112
+ MastheadContent,
89
113
  PageSection,
90
- PageSectionVariants
114
+ PageSectionVariants,
115
+ Toolbar,
116
+ ToolbarContent,
117
+ ToolbarItem
91
118
  } from '@patternfly/react-core';
92
119
 
93
120
  HorizontalPage = () => {
94
- const logoProps = {
95
- href: 'https://patternfly.org',
96
- onClick: () => console.log('clicked logo'),
97
- target: '_blank'
98
- };
121
+ const headerToolbar = (
122
+ <Toolbar id="toolbar">
123
+ <ToolbarContent>
124
+ <ToolbarItem>Navigation</ToolbarItem>
125
+ <ToolbarItem>header-tools</ToolbarItem>
126
+ </ToolbarContent>
127
+ </Toolbar>
128
+ );
129
+
99
130
  const Header = (
100
- <PageHeader
101
- logo="Logo"
102
- logoProps={logoProps}
103
- headerTools={<PageHeaderTools>header-tools</PageHeaderTools>}
104
- topNav="Navigation"
105
- />
131
+ <Masthead display={{ default: 'stack' }} inset={{ default: 'insetXs' }}>
132
+ <MastheadMain>
133
+ <MastheadBrand href="https://patternfly.org" onClick={() => console.log('clicked logo')} target="_blank">
134
+ Logo
135
+ </MastheadBrand>
136
+ </MastheadMain>
137
+ <MastheadContent>{headerToolbar}</MastheadContent>
138
+ </Masthead>
106
139
  );
107
140
 
108
141
  return (
@@ -121,21 +154,35 @@ HorizontalPage = () => {
121
154
  import React from 'react';
122
155
  import {
123
156
  Page,
124
- PageHeader,
125
- PageHeaderTools,
126
- PageSidebar,
157
+ Masthead,
158
+ MastheadMain,
159
+ MastheadBrand,
160
+ MastheadContent,
127
161
  PageSection,
128
- PageSectionVariants
162
+ PageSectionVariants,
163
+ Toolbar,
164
+ ToolbarContent,
165
+ ToolbarItem
129
166
  } from '@patternfly/react-core';
130
167
 
131
168
  TertiaryPage = () => {
132
- const logoProps = {
133
- href: 'https://patternfly.org',
134
- onClick: () => console.log('clicked logo'),
135
- target: '_blank'
136
- };
169
+ const headerToolbar = (
170
+ <Toolbar id="toolbar">
171
+ <ToolbarContent>
172
+ <ToolbarItem>header-tools</ToolbarItem>
173
+ </ToolbarContent>
174
+ </Toolbar>
175
+ );
176
+
137
177
  const Header = (
138
- <PageHeader logo="Logo" logoProps={logoProps} headerTools={<PageHeaderTools>header-tools</PageHeaderTools>} />
178
+ <Masthead display={{ default: 'stack' }} inset={{ default: 'insetXs' }}>
179
+ <MastheadMain>
180
+ <MastheadBrand href="https://patternfly.org" onClick={() => console.log('clicked logo')} target="_blank">
181
+ Logo
182
+ </MastheadBrand>
183
+ </MastheadMain>
184
+ <MastheadContent>{headerToolbar}</MastheadContent>
185
+ </Masthead>
139
186
  );
140
187
 
141
188
  return (
@@ -154,12 +201,20 @@ TertiaryPage = () => {
154
201
  import React from 'react';
155
202
  import {
156
203
  Page,
157
- PageHeader,
158
- PageHeaderTools,
204
+ Masthead,
205
+ MastheadToggle,
206
+ MastheadMain,
207
+ MastheadBrand,
208
+ MastheadContent,
159
209
  PageSidebar,
160
210
  PageSection,
161
- PageSectionVariants
211
+ PageSectionVariants,
212
+ PageToggleButton,
213
+ Toolbar,
214
+ ToolbarContent,
215
+ ToolbarItem
162
216
  } from '@patternfly/react-core';
217
+ import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
163
218
 
164
219
  class VerticalPage extends React.Component {
165
220
  constructor(props) {
@@ -177,20 +232,33 @@ class VerticalPage extends React.Component {
177
232
  render() {
178
233
  const { isNavOpen } = this.state;
179
234
 
180
- const logoProps = {
181
- href: 'https://patternfly.org',
182
- onClick: () => console.log('clicked logo'),
183
- target: '_blank'
184
- };
235
+ const headerToolbar = (
236
+ <Toolbar id="toolbar">
237
+ <ToolbarContent>
238
+ <ToolbarItem>header-tools</ToolbarItem>
239
+ </ToolbarContent>
240
+ </Toolbar>
241
+ );
242
+
185
243
  const Header = (
186
- <PageHeader
187
- logo="Logo"
188
- logoProps={logoProps}
189
- headerTools={<PageHeaderTools>header-tools</PageHeaderTools>}
190
- showNavToggle
191
- isNavOpen={isNavOpen}
192
- onNavToggle={this.onNavToggle}
193
- />
244
+ <Masthead>
245
+ <MastheadToggle>
246
+ <PageToggleButton
247
+ variant="plain"
248
+ aria-label="Global navigation"
249
+ isNavOpen={isNavOpen}
250
+ onNavToggle={this.onNavToggle}
251
+ >
252
+ <BarsIcon />
253
+ </PageToggleButton>
254
+ </MastheadToggle>
255
+ <MastheadMain>
256
+ <MastheadBrand href="https://patternfly.org" onClick={() => console.log('clicked logo')} target="_blank">
257
+ Logo
258
+ </MastheadBrand>
259
+ </MastheadMain>
260
+ <MastheadContent>{headerToolbar}</MastheadContent>
261
+ </Masthead>
194
262
  );
195
263
  const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} />;
196
264
 
@@ -218,12 +286,19 @@ class VerticalPage extends React.Component {
218
286
  import React from 'react';
219
287
  import {
220
288
  Page,
221
- PageHeader,
222
- PageHeaderTools,
289
+ Masthead,
290
+ MastheadToggle,
291
+ MastheadMain,
292
+ MastheadBrand,
293
+ MastheadContent,
223
294
  PageSidebar,
224
295
  PageSection,
225
- PageSectionVariants
296
+ PageToggleButton,
297
+ Toolbar,
298
+ ToolbarContent,
299
+ ToolbarItem
226
300
  } from '@patternfly/react-core';
301
+ import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
227
302
 
228
303
  class FillPage extends React.Component {
229
304
  constructor(props) {
@@ -241,20 +316,33 @@ class FillPage extends React.Component {
241
316
  render() {
242
317
  const { isNavOpen } = this.state;
243
318
 
244
- const logoProps = {
245
- href: 'https://patternfly.org',
246
- onClick: () => console.log('clicked logo'),
247
- target: '_blank'
248
- };
319
+ const headerToolbar = (
320
+ <Toolbar id="toolbar">
321
+ <ToolbarContent>
322
+ <ToolbarItem>header-tools</ToolbarItem>
323
+ </ToolbarContent>
324
+ </Toolbar>
325
+ );
326
+
249
327
  const Header = (
250
- <PageHeader
251
- logo="Logo"
252
- logoProps={logoProps}
253
- headerTools={<PageHeaderTools>header-tools</PageHeaderTools>}
254
- showNavToggle
255
- isNavOpen={isNavOpen}
256
- onNavToggle={this.onNavToggle}
257
- />
328
+ <Masthead>
329
+ <MastheadToggle>
330
+ <PageToggleButton
331
+ variant="plain"
332
+ aria-label="Global navigation"
333
+ isNavOpen={isNavOpen}
334
+ onNavToggle={this.onNavToggle}
335
+ >
336
+ <BarsIcon />
337
+ </PageToggleButton>
338
+ </MastheadToggle>
339
+ <MastheadMain>
340
+ <MastheadBrand href="https://patternfly.org" onClick={() => console.log('clicked logo')} target="_blank">
341
+ Logo
342
+ </MastheadBrand>
343
+ </MastheadMain>
344
+ <MastheadContent>{headerToolbar}</MastheadContent>
345
+ </Masthead>
258
346
  );
259
347
  const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} />;
260
348
 
@@ -280,27 +368,45 @@ class FillPage extends React.Component {
280
368
  import React from 'react';
281
369
  import {
282
370
  Page,
283
- PageHeader,
284
- PageHeaderTools,
371
+ Masthead,
372
+ MastheadToggle,
373
+ MastheadMain,
374
+ MastheadBrand,
375
+ MastheadContent,
285
376
  PageSidebar,
286
377
  PageSection,
287
- PageSectionVariants
378
+ PageSectionVariants,
379
+ PageToggleButton,
380
+ Toolbar,
381
+ ToolbarContent,
382
+ ToolbarItem
288
383
  } from '@patternfly/react-core';
384
+ import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
289
385
 
290
386
  class UncontrolledNavPage extends React.Component {
291
387
  render() {
292
- const logoProps = {
293
- href: 'https://patternfly.org',
294
- onClick: () => console.log('clicked logo'),
295
- target: '_blank'
296
- };
388
+ const headerToolbar = (
389
+ <Toolbar id="toolbar">
390
+ <ToolbarContent>
391
+ <ToolbarItem>header-tools</ToolbarItem>
392
+ </ToolbarContent>
393
+ </Toolbar>
394
+ );
395
+
297
396
  const Header = (
298
- <PageHeader
299
- logo="Logo"
300
- logoProps={logoProps}
301
- headerTools={<PageHeaderTools>header-tools</PageHeaderTools>}
302
- showNavToggle
303
- />
397
+ <Masthead>
398
+ <MastheadToggle>
399
+ <PageToggleButton variant="plain" aria-label="Global navigation">
400
+ <BarsIcon />
401
+ </PageToggleButton>
402
+ </MastheadToggle>
403
+ <MastheadMain>
404
+ <MastheadBrand href="https://patternfly.org" onClick={() => console.log('clicked logo')} target="_blank">
405
+ Logo
406
+ </MastheadBrand>
407
+ </MastheadMain>
408
+ <MastheadContent>{headerToolbar}</MastheadContent>
409
+ </Masthead>
304
410
  );
305
411
  const Sidebar = <PageSidebar nav="Navigation" />;
306
412
 
@@ -321,20 +427,28 @@ class UncontrolledNavPage extends React.Component {
321
427
  import React from 'react';
322
428
  import {
323
429
  Page,
324
- PageHeader,
325
- PageHeaderTools,
430
+ Masthead,
431
+ MastheadToggle,
432
+ MastheadMain,
433
+ MastheadBrand,
434
+ MastheadContent,
326
435
  PageSidebar,
327
436
  PageSection,
328
437
  PageGroup,
329
438
  PageBreadcrumb,
330
439
  PageNavigation,
331
440
  PageSectionVariants,
441
+ PageToggleButton,
332
442
  Breadcrumb,
333
443
  BreadcrumbItem,
334
444
  Nav,
335
445
  NavList,
336
- NavItem
446
+ NavItem,
447
+ Toolbar,
448
+ ToolbarContent,
449
+ ToolbarItem
337
450
  } from '@patternfly/react-core';
451
+ import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
338
452
 
339
453
  class GroupPage extends React.Component {
340
454
  constructor(props) {
@@ -352,20 +466,33 @@ class GroupPage extends React.Component {
352
466
  render() {
353
467
  const { isNavOpen } = this.state;
354
468
 
355
- const logoProps = {
356
- href: 'https://patternfly.org',
357
- onClick: () => console.log('clicked logo'),
358
- target: '_blank'
359
- };
469
+ const headerToolbar = (
470
+ <Toolbar id="toolbar">
471
+ <ToolbarContent>
472
+ <ToolbarItem>header-tools</ToolbarItem>
473
+ </ToolbarContent>
474
+ </Toolbar>
475
+ );
476
+
360
477
  const Header = (
361
- <PageHeader
362
- logo="Logo"
363
- logoProps={logoProps}
364
- headerTools={<PageHeaderTools>header-tools</PageHeaderTools>}
365
- showNavToggle
366
- isNavOpen={isNavOpen}
367
- onNavToggle={this.onNavToggle}
368
- />
478
+ <Masthead>
479
+ <MastheadToggle>
480
+ <PageToggleButton
481
+ variant="plain"
482
+ aria-label="Global navigation"
483
+ isNavOpen={isNavOpen}
484
+ onNavToggle={this.onNavToggle}
485
+ >
486
+ <BarsIcon />
487
+ </PageToggleButton>
488
+ </MastheadToggle>
489
+ <MastheadMain>
490
+ <MastheadBrand href="https://patternfly.org" onClick={() => console.log('clicked logo')} target="_blank">
491
+ Logo
492
+ </MastheadBrand>
493
+ </MastheadMain>
494
+ <MastheadContent>{headerToolbar}</MastheadContent>
495
+ </Masthead>
369
496
  );
370
497
  const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} />;
371
498
 
@@ -404,3 +531,62 @@ class GroupPage extends React.Component {
404
531
  }
405
532
  }
406
533
  ```
534
+
535
+ ### Vertical nav using PageHeader component
536
+
537
+ This example is provided becuase PageHeader and PageHeaderTools are still in use; however, going forward Masthead and Toolbar should be used to make headers rather than PageHeader and PageHeaderTools.
538
+
539
+ ```js
540
+ import React from 'react';
541
+ import {
542
+ Page,
543
+ PageHeader,
544
+ PageHeaderTools,
545
+ PageSidebar,
546
+ PageSection,
547
+ PageSectionVariants
548
+ } from '@patternfly/react-core';
549
+
550
+ class VerticalPage extends React.Component {
551
+ constructor(props) {
552
+ super(props);
553
+ this.state = {
554
+ isNavOpen: true
555
+ };
556
+ this.onNavToggle = () => {
557
+ this.setState({
558
+ isNavOpen: !this.state.isNavOpen
559
+ });
560
+ };
561
+ }
562
+
563
+ render() {
564
+ const { isNavOpen } = this.state;
565
+
566
+ const logoProps = {
567
+ href: 'https://patternfly.org',
568
+ onClick: () => console.log('clicked logo'),
569
+ target: '_blank'
570
+ };
571
+ const Header = (
572
+ <PageHeader
573
+ logo="Logo"
574
+ logoProps={logoProps}
575
+ headerTools={<PageHeaderTools>header-tools</PageHeaderTools>}
576
+ showNavToggle
577
+ isNavOpen={isNavOpen}
578
+ onNavToggle={this.onNavToggle}
579
+ />
580
+ );
581
+ const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} />;
582
+
583
+ return (
584
+ <Page header={Header} sidebar={Sidebar}>
585
+ <PageSection variant={PageSectionVariants.darker}>Section with darker background</PageSection>
586
+ <PageSection variant={PageSectionVariants.dark}>Section with dark background</PageSection>
587
+ <PageSection variant={PageSectionVariants.light}>Section with light background</PageSection>
588
+ </Page>
589
+ );
590
+ }
591
+ }
592
+ ```
@@ -12,7 +12,7 @@ import { SelectMenu } from './SelectMenu';
12
12
  import { SelectOption, SelectOptionObject } from './SelectOption';
13
13
  import { SelectGroup, SelectGroupProps } from './SelectGroup';
14
14
  import { SelectToggle } from './SelectToggle';
15
- import { SelectContext, SelectVariant, SelectDirection, KeyTypes } from './selectConstants';
15
+ import { SelectContext, SelectVariant, SelectPosition, SelectDirection, KeyTypes } from './selectConstants';
16
16
  import { Chip, ChipGroup, ChipGroupProps } from '../ChipGroup';
17
17
  import { Spinner } from '../Spinner';
18
18
  import {
@@ -46,6 +46,8 @@ export interface SelectProps
46
46
  children?: React.ReactElement[];
47
47
  /** Classes applied to the root of the Select */
48
48
  className?: string;
49
+ /** Indicates where menu will be aligned horizontally */
50
+ position?: SelectPosition | 'right' | 'left';
49
51
  /** Flag specifying which direction the Select menu expands */
50
52
  direction?: 'up' | 'down';
51
53
  /** Flag to indicate if select is open */
@@ -171,6 +173,7 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
171
173
  static defaultProps: PickOptional<SelectProps> = {
172
174
  children: [] as React.ReactElement[],
173
175
  className: '',
176
+ position: SelectPosition.left,
174
177
  direction: SelectDirection.down,
175
178
  toggleId: null as string,
176
179
  isOpen: false,
@@ -3,7 +3,7 @@ import styles from '@patternfly/react-styles/css/components/Select/select';
3
3
  import formStyles from '@patternfly/react-styles/css/components/Form/form';
4
4
  import { css } from '@patternfly/react-styles';
5
5
  import { SelectOptionObject, SelectOption } from './SelectOption';
6
- import { SelectConsumer, SelectVariant, SelectContextInterface } from './selectConstants';
6
+ import { SelectConsumer, SelectPosition, SelectVariant, SelectContextInterface } from './selectConstants';
7
7
  import { PickOptional } from '../../helpers/typeUtils';
8
8
 
9
9
  import { SelectGroup } from './SelectGroup';
@@ -28,6 +28,8 @@ export interface SelectMenuProps extends Omit<React.HTMLProps<HTMLElement>, 'che
28
28
  openedOnEnter?: boolean;
29
29
  /** Flag to specify the maximum height of the menu, as a string percentage or number of pixels */
30
30
  maxHeight?: string | number;
31
+ /** Indicates where menu will be alligned horizontally */
32
+ position?: SelectPosition | 'right' | 'left';
31
33
  /** Inner prop passed from parent */
32
34
  noResultsFoundText?: string;
33
35
  /** Inner prop passed from parent */
@@ -56,6 +58,7 @@ class SelectMenuWithRef extends React.Component<SelectMenuProps> {
56
58
  openedOnEnter: false,
57
59
  selected: '',
58
60
  maxHeight: '',
61
+ position: SelectPosition.left,
59
62
  sendRef: () => {},
60
63
  keyHandler: () => {},
61
64
  isCustomContent: false,
@@ -181,6 +184,7 @@ class SelectMenuWithRef extends React.Component<SelectMenuProps> {
181
184
  selected,
182
185
  checked,
183
186
  isGrouped,
187
+ position,
184
188
  sendRef,
185
189
  keyHandler,
186
190
  maxHeight,
@@ -199,7 +203,11 @@ class SelectMenuWithRef extends React.Component<SelectMenuProps> {
199
203
  let Component = 'div';
200
204
  const variantProps = {
201
205
  ref: innerRef,
202
- className: css(!footer ? styles.selectMenu : 'pf-c-select__menu-list', className),
206
+ className: css(
207
+ !footer ? styles.selectMenu : 'pf-c-select__menu-list',
208
+ position === SelectPosition.right && styles.modifiers.alignRight,
209
+ className
210
+ ),
203
211
  ...(maxHeight && { style: { maxHeight, overflow: 'auto' } })
204
212
  } as React.HTMLAttributes<HTMLElement>;
205
213
  const extendedChildren = () =>
@@ -15,6 +15,7 @@ exports[`SelectMenu should match snapshot (auto-generated) 1`] = `
15
15
  maxHeight=""
16
16
  noResultsFoundText="string"
17
17
  openedOnEnter={false}
18
+ position="left"
18
19
  selected=""
19
20
  sendRef={[Function]}
20
21
  />