@patternfly/react-core 4.174.1 → 4.175.2

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 (117) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/esm/components/Card/Card.d.ts +6 -0
  3. package/dist/esm/components/Card/Card.d.ts.map +1 -1
  4. package/dist/esm/components/Card/Card.js +2 -2
  5. package/dist/esm/components/Card/Card.js.map +1 -1
  6. package/dist/esm/components/Menu/Menu.d.ts +2 -0
  7. package/dist/esm/components/Menu/Menu.d.ts.map +1 -1
  8. package/dist/esm/components/Menu/Menu.js +3 -3
  9. package/dist/esm/components/Menu/Menu.js.map +1 -1
  10. package/dist/esm/components/Nav/NavItem.d.ts +1 -1
  11. package/dist/esm/components/Nav/NavItem.d.ts.map +1 -1
  12. package/dist/esm/components/Nav/NavItem.js +41 -31
  13. package/dist/esm/components/Nav/NavItem.js.map +1 -1
  14. package/dist/esm/components/Panel/Panel.d.ts +13 -0
  15. package/dist/esm/components/Panel/Panel.d.ts.map +1 -0
  16. package/dist/esm/components/Panel/Panel.js +10 -0
  17. package/dist/esm/components/Panel/Panel.js.map +1 -0
  18. package/dist/esm/components/Panel/PanelFooter.d.ts +9 -0
  19. package/dist/esm/components/Panel/PanelFooter.d.ts.map +1 -0
  20. package/dist/esm/components/Panel/PanelFooter.js +10 -0
  21. package/dist/esm/components/Panel/PanelFooter.js.map +1 -0
  22. package/dist/esm/components/Panel/PanelHeader.d.ts +9 -0
  23. package/dist/esm/components/Panel/PanelHeader.d.ts.map +1 -0
  24. package/dist/esm/components/Panel/PanelHeader.js +10 -0
  25. package/dist/esm/components/Panel/PanelHeader.js.map +1 -0
  26. package/dist/esm/components/Panel/PanelMain.d.ts +11 -0
  27. package/dist/esm/components/Panel/PanelMain.d.ts.map +1 -0
  28. package/dist/esm/components/Panel/PanelMain.js +10 -0
  29. package/dist/esm/components/Panel/PanelMain.js.map +1 -0
  30. package/dist/esm/components/Panel/PanelMainBody.d.ts +9 -0
  31. package/dist/esm/components/Panel/PanelMainBody.d.ts.map +1 -0
  32. package/dist/esm/components/Panel/PanelMainBody.js +10 -0
  33. package/dist/esm/components/Panel/PanelMainBody.js.map +1 -0
  34. package/dist/esm/components/Panel/index.d.ts +6 -0
  35. package/dist/esm/components/Panel/index.d.ts.map +1 -0
  36. package/dist/esm/components/Panel/index.js +6 -0
  37. package/dist/esm/components/Panel/index.js.map +1 -0
  38. package/dist/esm/components/index.d.ts +1 -0
  39. package/dist/esm/components/index.d.ts.map +1 -1
  40. package/dist/esm/components/index.js +1 -0
  41. package/dist/esm/components/index.js.map +1 -1
  42. package/dist/esm/helpers/Popper/Popper.d.ts.map +1 -1
  43. package/dist/esm/helpers/Popper/Popper.js +6 -1
  44. package/dist/esm/helpers/Popper/Popper.js.map +1 -1
  45. package/dist/js/components/Card/Card.d.ts +6 -0
  46. package/dist/js/components/Card/Card.d.ts.map +1 -1
  47. package/dist/js/components/Card/Card.js +2 -2
  48. package/dist/js/components/Card/Card.js.map +1 -1
  49. package/dist/js/components/Menu/Menu.d.ts +2 -0
  50. package/dist/js/components/Menu/Menu.d.ts.map +1 -1
  51. package/dist/js/components/Menu/Menu.js +3 -3
  52. package/dist/js/components/Menu/Menu.js.map +1 -1
  53. package/dist/js/components/Nav/NavItem.d.ts +1 -1
  54. package/dist/js/components/Nav/NavItem.d.ts.map +1 -1
  55. package/dist/js/components/Nav/NavItem.js +41 -31
  56. package/dist/js/components/Nav/NavItem.js.map +1 -1
  57. package/dist/js/components/Panel/Panel.d.ts +13 -0
  58. package/dist/js/components/Panel/Panel.d.ts.map +1 -0
  59. package/dist/js/components/Panel/Panel.js +14 -0
  60. package/dist/js/components/Panel/Panel.js.map +1 -0
  61. package/dist/js/components/Panel/PanelFooter.d.ts +9 -0
  62. package/dist/js/components/Panel/PanelFooter.d.ts.map +1 -0
  63. package/dist/js/components/Panel/PanelFooter.js +14 -0
  64. package/dist/js/components/Panel/PanelFooter.js.map +1 -0
  65. package/dist/js/components/Panel/PanelHeader.d.ts +9 -0
  66. package/dist/js/components/Panel/PanelHeader.d.ts.map +1 -0
  67. package/dist/js/components/Panel/PanelHeader.js +14 -0
  68. package/dist/js/components/Panel/PanelHeader.js.map +1 -0
  69. package/dist/js/components/Panel/PanelMain.d.ts +11 -0
  70. package/dist/js/components/Panel/PanelMain.d.ts.map +1 -0
  71. package/dist/js/components/Panel/PanelMain.js +14 -0
  72. package/dist/js/components/Panel/PanelMain.js.map +1 -0
  73. package/dist/js/components/Panel/PanelMainBody.d.ts +9 -0
  74. package/dist/js/components/Panel/PanelMainBody.d.ts.map +1 -0
  75. package/dist/js/components/Panel/PanelMainBody.js +14 -0
  76. package/dist/js/components/Panel/PanelMainBody.js.map +1 -0
  77. package/dist/js/components/Panel/index.d.ts +6 -0
  78. package/dist/js/components/Panel/index.d.ts.map +1 -0
  79. package/dist/js/components/Panel/index.js +9 -0
  80. package/dist/js/components/Panel/index.js.map +1 -0
  81. package/dist/js/components/index.d.ts +1 -0
  82. package/dist/js/components/index.d.ts.map +1 -1
  83. package/dist/js/components/index.js +1 -0
  84. package/dist/js/components/index.js.map +1 -1
  85. package/dist/js/helpers/Popper/Popper.d.ts.map +1 -1
  86. package/dist/js/helpers/Popper/Popper.js +6 -1
  87. package/dist/js/helpers/Popper/Popper.js.map +1 -1
  88. package/dist/umd/react-core.css +180 -3
  89. package/dist/umd/react-core.js +978 -914
  90. package/dist/umd/react-core.min.css +180 -3
  91. package/dist/umd/react-core.min.js +4 -4
  92. package/package.json +6 -6
  93. package/src/components/Card/Card.tsx +15 -3
  94. package/src/components/Card/__tests__/Card.test.tsx +24 -0
  95. package/src/components/Card/__tests__/__snapshots__/Card.test.tsx.snap +11 -1
  96. package/src/components/Card/examples/Card.md +133 -26
  97. package/src/components/Menu/Menu.tsx +4 -0
  98. package/src/components/Menu/__tests__/Menu.test.tsx +11 -0
  99. package/src/components/Menu/__tests__/__snapshots__/Menu.test.tsx.snap +11 -0
  100. package/src/components/Nav/NavItem.tsx +78 -48
  101. package/src/components/Nav/__tests__/Generated/NavItem.test.tsx +1 -1
  102. package/src/components/Nav/__tests__/Generated/__snapshots__/NavItem.test.tsx.snap +13 -11
  103. package/src/components/Nav/examples/Nav.md +4 -3
  104. package/src/components/Panel/Panel.tsx +37 -0
  105. package/src/components/Panel/PanelFooter.tsx +22 -0
  106. package/src/components/Panel/PanelHeader.tsx +22 -0
  107. package/src/components/Panel/PanelMain.tsx +29 -0
  108. package/src/components/Panel/PanelMainBody.tsx +22 -0
  109. package/src/components/Panel/__tests__/Panel.test.tsx +62 -0
  110. package/src/components/Panel/__tests__/__snapshots__/Panel.test.tsx.snap +83 -0
  111. package/src/components/Panel/examples/Panel.md +203 -0
  112. package/src/components/Panel/index.ts +5 -0
  113. package/src/components/Tooltip/examples/Tooltip.md +18 -12
  114. package/src/components/index.ts +1 -0
  115. package/src/demos/DateTimePicker.md +103 -0
  116. package/src/demos/Nav.md +105 -0
  117. package/src/helpers/Popper/Popper.tsx +7 -1
@@ -305,7 +305,7 @@ NavExpandableThirdLevelList = () => {
305
305
  onSelect = result => {
306
306
  setActiveGroup(result.groupId);
307
307
  setActiveItem(result.itemId);
308
- };
308
+ };
309
309
 
310
310
  onToggle = result => {
311
311
  // eslint-disable-next-line no-console
@@ -387,7 +387,7 @@ NavExpandableThirdLevelList = () => {
387
387
  </NavList>
388
388
  </Nav>
389
389
  );
390
- }
390
+ };
391
391
  ```
392
392
 
393
393
  ### Mixed
@@ -628,7 +628,7 @@ NavWithFlyout = () => {
628
628
 
629
629
  const numFlyouts = 5;
630
630
  const FlyoutMenu = ({ depth, children }) => (
631
- <Menu key={depth} containsFlyout id={`menu-${depth}`} onSelect={onMenuSelect}>
631
+ <Menu key={depth} containsFlyout isNavFlyout id={`menu-${depth}`} onSelect={onMenuSelect}>
632
632
  <MenuContent>
633
633
  <MenuList>
634
634
  <MenuItem flyoutMenu={children} itemId={`next-menu-${depth}`} to={`#menu-link-${depth}`}>
@@ -646,6 +646,7 @@ NavWithFlyout = () => {
646
646
  </MenuContent>
647
647
  </Menu>
648
648
  );
649
+
649
650
  let curFlyout = <FlyoutMenu depth={1} />;
650
651
  for (let i = 2; i < numFlyouts - 1; i++) {
651
652
  curFlyout = <FlyoutMenu depth={i}>{curFlyout}</FlyoutMenu>;
@@ -0,0 +1,37 @@
1
+ import * as React from 'react';
2
+ import styles from '@patternfly/react-styles/css/components/Panel/panel';
3
+ import { css } from '@patternfly/react-styles';
4
+
5
+ export interface PanelProps extends React.HTMLProps<HTMLDivElement> {
6
+ /** Content rendered inside the panel */
7
+ children?: React.ReactNode;
8
+ /** Class to add to outer div */
9
+ className?: string;
10
+ /** Adds panel variant styles */
11
+ variant?: 'raised' | 'bordered';
12
+ /** Flag to add scrollable styling to the panel */
13
+ isScrollable?: boolean;
14
+ }
15
+
16
+ export const Panel: React.FunctionComponent<PanelProps> = ({
17
+ className,
18
+ children,
19
+ variant,
20
+ isScrollable,
21
+ ...props
22
+ }: PanelProps) => (
23
+ <div
24
+ className={css(
25
+ styles.panel,
26
+ variant === 'raised' && styles.modifiers.raised,
27
+ variant === 'bordered' && styles.modifiers.bordered,
28
+ isScrollable && styles.modifiers.scrollable,
29
+ className
30
+ )}
31
+ {...props}
32
+ >
33
+ {children}
34
+ </div>
35
+ );
36
+
37
+ Panel.displayName = 'Panel';
@@ -0,0 +1,22 @@
1
+ import * as React from 'react';
2
+ import styles from '@patternfly/react-styles/css/components/Panel/panel';
3
+ import { css } from '@patternfly/react-styles';
4
+
5
+ export interface PanelFooterProps extends React.HTMLProps<HTMLDivElement> {
6
+ /** Content rendered inside the panel footer */
7
+ children?: React.ReactNode;
8
+ /** Class to add to outer div */
9
+ className?: string;
10
+ }
11
+
12
+ export const PanelFooter: React.FunctionComponent<PanelFooterProps> = ({
13
+ className,
14
+ children,
15
+ ...props
16
+ }: PanelFooterProps) => (
17
+ <div className={css(styles.panelFooter, className)} {...props}>
18
+ {children}
19
+ </div>
20
+ );
21
+
22
+ PanelFooter.displayName = 'PanelFooter';
@@ -0,0 +1,22 @@
1
+ import * as React from 'react';
2
+ import styles from '@patternfly/react-styles/css/components/Panel/panel';
3
+ import { css } from '@patternfly/react-styles';
4
+
5
+ export interface PanelHeaderProps extends React.HTMLProps<HTMLDivElement> {
6
+ /** Content rendered inside the panel header */
7
+ children?: React.ReactNode;
8
+ /** Class to add to outer div */
9
+ className?: string;
10
+ }
11
+
12
+ export const PanelHeader: React.FunctionComponent<PanelHeaderProps> = ({
13
+ className,
14
+ children,
15
+ ...props
16
+ }: PanelHeaderProps) => (
17
+ <div className={css(styles.panelHeader, className)} {...props}>
18
+ {children}
19
+ </div>
20
+ );
21
+
22
+ PanelHeader.displayName = 'PanelHeader';
@@ -0,0 +1,29 @@
1
+ import * as React from 'react';
2
+ import styles from '@patternfly/react-styles/css/components/Panel/panel';
3
+ import { css } from '@patternfly/react-styles';
4
+
5
+ export interface PanelMainProps extends React.HTMLProps<HTMLDivElement> {
6
+ /** Content rendered inside the panel main div */
7
+ children?: React.ReactNode;
8
+ /** Class to add to outer div */
9
+ className?: string;
10
+ /** Max height of the panel main div as a string with the value and unit */
11
+ maxHeight?: string;
12
+ }
13
+
14
+ export const PanelMain: React.FunctionComponent<PanelMainProps> = ({
15
+ className,
16
+ children,
17
+ maxHeight,
18
+ ...props
19
+ }: PanelMainProps) => (
20
+ <div
21
+ className={css(styles.panelMain, className)}
22
+ style={{ '--pf-c-panel__main--MaxHeight': maxHeight } as React.CSSProperties}
23
+ {...props}
24
+ >
25
+ {children}
26
+ </div>
27
+ );
28
+
29
+ PanelMain.displayName = 'PanelMain';
@@ -0,0 +1,22 @@
1
+ import * as React from 'react';
2
+ import styles from '@patternfly/react-styles/css/components/Panel/panel';
3
+ import { css } from '@patternfly/react-styles';
4
+
5
+ export interface PanelMainBodyProps extends React.HTMLProps<HTMLDivElement> {
6
+ /** Content rendered inside the panel main body div */
7
+ children?: React.ReactNode;
8
+ /** Class to add to outer div */
9
+ className?: string;
10
+ }
11
+
12
+ export const PanelMainBody: React.FunctionComponent<PanelMainBodyProps> = ({
13
+ className,
14
+ children,
15
+ ...props
16
+ }: PanelMainBodyProps) => (
17
+ <div className={css(styles.panelMainBody, className)} {...props}>
18
+ {children}
19
+ </div>
20
+ );
21
+
22
+ PanelMainBody.displayName = 'PanelMainBody';
@@ -0,0 +1,62 @@
1
+ import React from 'react';
2
+ import { shallow } from 'enzyme';
3
+ import { Panel } from '../Panel';
4
+ import { PanelMain } from '../PanelMain';
5
+ import { PanelMainBody } from '../PanelMainBody';
6
+ import { PanelHeader } from '../PanelHeader';
7
+ import { PanelFooter } from '../PanelFooter';
8
+
9
+ describe('Panel', () => {
10
+ test('renders content', () => {
11
+ const view = shallow(<Panel>Foo</Panel>);
12
+ expect(view).toMatchSnapshot();
13
+ });
14
+
15
+ test('renders content with raised styling', () => {
16
+ const view = shallow(<Panel variant='raised'>Foo</Panel>);
17
+ expect(view).toMatchSnapshot();
18
+ });
19
+
20
+ test('renders content with bordered styling', () => {
21
+ const view = shallow(<Panel variant='bordered'>Foo</Panel>);
22
+ expect(view).toMatchSnapshot();
23
+ });
24
+
25
+ test('renders content with scrollable styling', () => {
26
+ const view = shallow(<Panel isScrollable>Foo</Panel>);
27
+ expect(view).toMatchSnapshot();
28
+ });
29
+ });
30
+
31
+ describe('PanelMain', () => {
32
+ test('renders content', () => {
33
+ const view = shallow(<PanelMain>Foo</PanelMain>);
34
+ expect(view).toMatchSnapshot();
35
+ });
36
+
37
+ test('renders content with the set maximum height', () => {
38
+ const view = shallow(<PanelMain maxHeight={'80px'}>Foo</PanelMain>);
39
+ expect(view).toMatchSnapshot();
40
+ });
41
+ });
42
+
43
+ describe('PanelMainBody', () => {
44
+ test('renders content', () => {
45
+ const view = shallow(<PanelMainBody>Foo</PanelMainBody>);
46
+ expect(view).toMatchSnapshot();
47
+ });
48
+ });
49
+
50
+ describe('PanelHeader', () => {
51
+ test('renders content', () => {
52
+ const view = shallow(<PanelHeader>Foo</PanelHeader>);
53
+ expect(view).toMatchSnapshot();
54
+ });
55
+ });
56
+
57
+ describe('PanelFooter', () => {
58
+ test('renders content', () => {
59
+ const view = shallow(<PanelFooter>Foo</PanelFooter>);
60
+ expect(view).toMatchSnapshot();
61
+ });
62
+ });
@@ -0,0 +1,83 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Panel renders content 1`] = `
4
+ <div
5
+ className="pf-c-panel"
6
+ >
7
+ Foo
8
+ </div>
9
+ `;
10
+
11
+ exports[`Panel renders content with bordered styling 1`] = `
12
+ <div
13
+ className="pf-c-panel pf-m-bordered"
14
+ >
15
+ Foo
16
+ </div>
17
+ `;
18
+
19
+ exports[`Panel renders content with raised styling 1`] = `
20
+ <div
21
+ className="pf-c-panel pf-m-raised"
22
+ >
23
+ Foo
24
+ </div>
25
+ `;
26
+
27
+ exports[`Panel renders content with scrollable styling 1`] = `
28
+ <div
29
+ className="pf-c-panel pf-m-scrollable"
30
+ >
31
+ Foo
32
+ </div>
33
+ `;
34
+
35
+ exports[`PanelFooter renders content 1`] = `
36
+ <div
37
+ className="pf-c-panel__footer"
38
+ >
39
+ Foo
40
+ </div>
41
+ `;
42
+
43
+ exports[`PanelHeader renders content 1`] = `
44
+ <div
45
+ className="pf-c-panel__header"
46
+ >
47
+ Foo
48
+ </div>
49
+ `;
50
+
51
+ exports[`PanelMain renders content 1`] = `
52
+ <div
53
+ className="pf-c-panel__main"
54
+ style={
55
+ Object {
56
+ "--pf-c-panel__main--MaxHeight": undefined,
57
+ }
58
+ }
59
+ >
60
+ Foo
61
+ </div>
62
+ `;
63
+
64
+ exports[`PanelMain renders content with the set maximum height 1`] = `
65
+ <div
66
+ className="pf-c-panel__main"
67
+ style={
68
+ Object {
69
+ "--pf-c-panel__main--MaxHeight": "80px",
70
+ }
71
+ }
72
+ >
73
+ Foo
74
+ </div>
75
+ `;
76
+
77
+ exports[`PanelMainBody renders content 1`] = `
78
+ <div
79
+ className="pf-c-panel__main-body"
80
+ >
81
+ Foo
82
+ </div>
83
+ `;
@@ -0,0 +1,203 @@
1
+ ---
2
+ id: Panel
3
+ section: components
4
+ cssPrefix: pf-c-panel
5
+ propComponents: [Panel, PanelMain, PanelMainBody, PanelHeader, PanelFooter]
6
+ beta: true
7
+ ---
8
+
9
+ ## Examples
10
+
11
+ ### Basic
12
+
13
+ ```js
14
+ import React from 'react';
15
+ import { Panel, PanelMain, PanelMainBody } from '@patternfly/react-core';
16
+
17
+ const BasicPanel = () => (
18
+ <Panel>
19
+ <PanelMain>
20
+ <PanelMainBody>Main content</PanelMainBody>
21
+ </PanelMain>
22
+ </Panel>
23
+ );
24
+ ```
25
+
26
+ ### Header
27
+
28
+ ```js
29
+ import React from 'react';
30
+ import { Panel, PanelMain, PanelMainBody, PanelHeader, Divider } from '@patternfly/react-core';
31
+
32
+ const HeaderPanel = () => (
33
+ <Panel>
34
+ <PanelHeader>Header content</PanelHeader>
35
+ <Divider />
36
+ <PanelMain>
37
+ <PanelMainBody>Main content</PanelMainBody>
38
+ </PanelMain>
39
+ </Panel>
40
+ );
41
+ ```
42
+
43
+ ### Footer
44
+
45
+ ```js
46
+ import React from 'react';
47
+ import { Panel, PanelMain, PanelMainBody, PanelFooter } from '@patternfly/react-core';
48
+
49
+ const FooterPanel = () => (
50
+ <Panel>
51
+ <PanelMain>
52
+ <PanelMainBody>Main content</PanelMainBody>
53
+ </PanelMain>
54
+ <PanelFooter>Footer content</PanelFooter>
55
+ </Panel>
56
+ );
57
+ ```
58
+
59
+ ### Header and footer
60
+
61
+ ```js
62
+ import React from 'react';
63
+ import { Panel, PanelMain, PanelMainBody, PanelHeader, Divider, PanelFooter } from '@patternfly/react-core';
64
+
65
+ const HeaderFooterPanel = () => (
66
+ <Panel>
67
+ <PanelHeader>Header content</PanelHeader>
68
+ <Divider />
69
+ <PanelMain>
70
+ <PanelMainBody>Main content</PanelMainBody>
71
+ </PanelMain>
72
+ <PanelFooter>Footer content</PanelFooter>
73
+ </Panel>
74
+ );
75
+ ```
76
+
77
+ ### No body
78
+
79
+ ```js
80
+ import React from 'react';
81
+ import { Panel, PanelMain } from '@patternfly/react-core';
82
+
83
+ const NoBodyPanel = () => (
84
+ <Panel>
85
+ <PanelMain>Main content</PanelMain>
86
+ </Panel>
87
+ );
88
+ ```
89
+
90
+ ### Raised
91
+
92
+ ```js
93
+ import React from 'react';
94
+ import { Panel, PanelMain, PanelMainBody } from '@patternfly/react-core';
95
+
96
+ const RaisedPanel = () => (
97
+ <Panel variant="raised">
98
+ <PanelMain>
99
+ <PanelMainBody>Main content</PanelMainBody>
100
+ </PanelMain>
101
+ </Panel>
102
+ );
103
+ ```
104
+
105
+ ### Bordered
106
+
107
+ ```js
108
+ import React from 'react';
109
+ import { Panel, PanelMain, PanelMainBody } from '@patternfly/react-core';
110
+
111
+ const BorderedPanel = () => (
112
+ <Panel variant="bordered">
113
+ <PanelMain>
114
+ <PanelMainBody>Main content</PanelMainBody>
115
+ </PanelMain>
116
+ </Panel>
117
+ );
118
+ ```
119
+
120
+ ### Scrollable
121
+
122
+ ```js
123
+ import React from 'react';
124
+ import { Panel, PanelMain, PanelMainBody } from '@patternfly/react-core';
125
+
126
+ const ScrollablePanel = () => (
127
+ <Panel isScrollable>
128
+ <PanelMain tabIndex={0}>
129
+ <PanelMainBody>
130
+ Main content
131
+ <br />
132
+ <br />
133
+ Main content
134
+ <br />
135
+ <br />
136
+ Main content
137
+ <br />
138
+ <br />
139
+ Main content
140
+ <br />
141
+ <br />
142
+ Main content
143
+ <br />
144
+ <br />
145
+ Main content
146
+ <br />
147
+ <br />
148
+ Main content
149
+ <br />
150
+ <br />
151
+ Main content
152
+ <br />
153
+ <br />
154
+ Main content
155
+ </PanelMainBody>
156
+ </PanelMain>
157
+ </Panel>
158
+ );
159
+ ```
160
+
161
+ ### Scrollable with header and footer
162
+
163
+ ```js
164
+ import React from 'react';
165
+ import { Panel, PanelMain, PanelMainBody, PanelHeader, Divider, PanelFooter } from '@patternfly/react-core';
166
+
167
+ const ScrollableHeaderFooterPanel = () => (
168
+ <Panel isScrollable>
169
+ <PanelHeader>Header content</PanelHeader>
170
+ <Divider />
171
+ <PanelMain tabIndex={0}>
172
+ <PanelMainBody>
173
+ Main content
174
+ <br />
175
+ <br />
176
+ Main content
177
+ <br />
178
+ <br />
179
+ Main content
180
+ <br />
181
+ <br />
182
+ Main content
183
+ <br />
184
+ <br />
185
+ Main content
186
+ <br />
187
+ <br />
188
+ Main content
189
+ <br />
190
+ <br />
191
+ Main content
192
+ <br />
193
+ <br />
194
+ Main content
195
+ <br />
196
+ <br />
197
+ Main content
198
+ </PanelMainBody>
199
+ </PanelMain>
200
+ <PanelFooter>Footer content</PanelFooter>
201
+ </Panel>
202
+ );
203
+ ```
@@ -0,0 +1,5 @@
1
+ export * from './Panel';
2
+ export * from './PanelMain';
3
+ export * from './PanelMainBody';
4
+ export * from './PanelHeader';
5
+ export * from './PanelFooter';
@@ -6,6 +6,7 @@ propComponents: ['Tooltip']
6
6
  ---
7
7
 
8
8
  import OutlinedQuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/outlined-question-circle-icon';
9
+ import CopyIcon from '@patternfly/react-icons/dist/esm/icons/copy-icon';
9
10
  import './TooltipExamples.css';
10
11
 
11
12
  ## Examples
@@ -66,19 +67,24 @@ import { Tooltip } from '@patternfly/react-core';
66
67
  ### On icon
67
68
  ```js
68
69
  import React from 'react';
69
- import { Tooltip } from '@patternfly/react-core';
70
- import OutlinedQuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/outlined-question-circle-icon';
70
+ import { Tooltip, Button } from '@patternfly/react-core';
71
+ import CopyIcon from '@patternfly/react-icons/dist/esm/icons/copy-icon';
71
72
 
72
- <div style={{ margin: '100px' }}>
73
- <Tooltip
74
- position="top"
75
- content={
76
- <div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.</div>
77
- }
78
- >
79
- <OutlinedQuestionCircleIcon title="An icon with a tooltip" />
80
- </Tooltip>
81
- </div>
73
+ IconExample = () => {
74
+ const [showSuccessContent, setShowSuccessContent] = React.useState(false);
75
+ const copyText = 'Copy to clipboard';
76
+ const doneCopyText = 'Successfully copied to clipboard!';
77
+ const [content, setContent] = React.useState(copyText);
78
+ return (
79
+ <div style={{ margin: '100px' }}>
80
+ <Tooltip content={showSuccessContent ? doneCopyText : copyText}>
81
+ <Button variant="plain" id="tt-ref" onClick={() => setShowSuccessContent(!showSuccessContent)}>
82
+ <CopyIcon />
83
+ </Button>
84
+ </Tooltip>
85
+ </div>
86
+ );
87
+ };
82
88
  ```
83
89
 
84
90
  ### Options
@@ -80,3 +80,4 @@ export * from './TreeView';
80
80
  export * from './Wizard';
81
81
  export * from './DragDrop';
82
82
  export * from './TextInputGroup';
83
+ export * from './Panel';
@@ -0,0 +1,103 @@
1
+ ---
2
+ id: Date and time picker
3
+ section: demos
4
+ beta: true
5
+ ---
6
+
7
+ import OutlinedCalendarAltIcon from '@patternfly/react-icons/dist/esm/icons/outlined-calendar-alt-icon';
8
+ import OutlinedClockIcon from '@patternfly/react-icons/dist/esm/icons/outlined-clock-icon';
9
+
10
+ ## Demos
11
+
12
+ In this demo, learn how to use a [CalendarMonth](/components/calendar-month) component and a [Dropdown](/components/dropdown) component to compose a simple DateTimePicker. The input is read only, meaning that the following example does not cover pasting a copied date and time. Also, you can pick the time only from the predefined options and cannot change it in the input.
13
+
14
+ ### Date and time picker
15
+
16
+ ```js
17
+ import React from 'react';
18
+ import { Dropdown, DropdownToggle, DropdownItem, CalendarMonth, InputGroup, TextInput, Button, Popover } from '@patternfly/react-core';
19
+ import OutlinedCalendarAltIcon from '@patternfly/react-icons/dist/esm/icons/outlined-calendar-alt-icon';
20
+ import OutlinedClockIcon from '@patternfly/react-icons/dist/esm/icons/outlined-clock-icon';
21
+
22
+ DateTimePicker = () => {
23
+ const [isCalendarOpen, setIsCalendarOpen] = React.useState(false);
24
+ const [isTimeOpen, setIsTimeOpen] = React.useState(false);
25
+ const [valueDate, setValueDate] = React.useState("YYYY-MM-DD");
26
+ const [valueTime, setValueTime] = React.useState("HH:MM");
27
+ const times = Array.from(new Array(10), (_, i) => i + 8);
28
+ const defaultTime = "0:00";
29
+ const dateFormat = date => date.toLocaleDateString('en-US', { year: 'numeric', month: '2-digit', day: '2-digit' }).replace(/\//g,'-');
30
+
31
+ const onToggleCalendar = () => {
32
+ setIsCalendarOpen(!isCalendarOpen);
33
+ setIsTimeOpen(false);
34
+ };
35
+
36
+ const onToggleTime = ev => {
37
+ setIsTimeOpen(!isTimeOpen);
38
+ setIsCalendarOpen(false);
39
+ };
40
+
41
+ const onSelectCalendar = newValueDate => {
42
+ const newValue = dateFormat(newValueDate);
43
+ setValueDate(newValue);
44
+ setIsCalendarOpen(!isCalendarOpen);
45
+ // setting default time when it is not picked
46
+ if (valueTime === "HH:MM") {
47
+ setValueTime(defaultTime);
48
+ }
49
+ };
50
+
51
+ const onSelectTime = ev => {
52
+ setValueTime(ev.target.value);
53
+ setIsTimeOpen(!isTimeOpen);
54
+ };
55
+
56
+ const timeOptions = times.map(time => (
57
+ <DropdownItem key={time} component="button" value={`${time}:00`}>
58
+ {`${time}:00`}
59
+ </DropdownItem>
60
+ ))
61
+ const calendar = (
62
+ <CalendarMonth
63
+ date={valueDate}
64
+ onChange={onSelectCalendar}
65
+ />
66
+ );
67
+ const time = (
68
+ <Dropdown
69
+ onSelect={onSelectTime}
70
+ toggle={
71
+ <DropdownToggle toggleIndicator={null} onToggle={onToggleTime} style={{ padding: '6px 16px' }}>
72
+ <OutlinedClockIcon />
73
+ </DropdownToggle>
74
+ }
75
+ isOpen={isTimeOpen}
76
+ dropdownItems={timeOptions}
77
+ />
78
+ );
79
+ const calendarButton = (
80
+ <Button variant="control" onClick={onToggleCalendar}>
81
+ <OutlinedCalendarAltIcon />
82
+ </Button>
83
+ );
84
+ return (
85
+ <div style={{ width: '300px' }}>
86
+ <Popover
87
+ position="bottom"
88
+ bodyContent={calendar}
89
+ showClose={false}
90
+ isVisible={isCalendarOpen}
91
+ hasNoPadding
92
+ hasAutoWidth
93
+ >
94
+ <InputGroup>
95
+ <TextInput type="'datetime-local" id="date-time" value={valueDate + ' ' + valueTime} isReadOnly/>
96
+ {calendarButton}
97
+ {time}
98
+ </InputGroup>
99
+ </Popover>
100
+ </div>
101
+ );
102
+ };
103
+ ```