@patternfly/react-core 4.192.17 → 4.192.21

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 (52) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/esm/components/DescriptionList/DescriptionListTerm.d.ts +2 -0
  3. package/dist/esm/components/DescriptionList/DescriptionListTerm.d.ts.map +1 -1
  4. package/dist/esm/components/DescriptionList/DescriptionListTerm.js +2 -1
  5. package/dist/esm/components/DescriptionList/DescriptionListTerm.js.map +1 -1
  6. package/dist/esm/components/Progress/Progress.js +1 -1
  7. package/dist/esm/components/Progress/Progress.js.map +1 -1
  8. package/dist/esm/components/Select/Select.d.ts +1 -1
  9. package/dist/esm/components/Select/Select.d.ts.map +1 -1
  10. package/dist/esm/components/Select/Select.js +1 -2
  11. package/dist/esm/components/Select/Select.js.map +1 -1
  12. package/dist/esm/components/TimePicker/TimePicker.d.ts.map +1 -1
  13. package/dist/esm/components/TimePicker/TimePicker.js +4 -4
  14. package/dist/esm/components/TimePicker/TimePicker.js.map +1 -1
  15. package/dist/esm/components/TimePicker/TimePickerUtils.d.ts +1 -1
  16. package/dist/esm/components/TimePicker/TimePickerUtils.d.ts.map +1 -1
  17. package/dist/esm/components/TimePicker/TimePickerUtils.js +2 -2
  18. package/dist/esm/components/TimePicker/TimePickerUtils.js.map +1 -1
  19. package/dist/js/components/DescriptionList/DescriptionListTerm.d.ts +2 -0
  20. package/dist/js/components/DescriptionList/DescriptionListTerm.d.ts.map +1 -1
  21. package/dist/js/components/DescriptionList/DescriptionListTerm.js +2 -1
  22. package/dist/js/components/DescriptionList/DescriptionListTerm.js.map +1 -1
  23. package/dist/js/components/Progress/Progress.js +1 -1
  24. package/dist/js/components/Progress/Progress.js.map +1 -1
  25. package/dist/js/components/Select/Select.d.ts +1 -1
  26. package/dist/js/components/Select/Select.d.ts.map +1 -1
  27. package/dist/js/components/Select/Select.js +6 -7
  28. package/dist/js/components/Select/Select.js.map +1 -1
  29. package/dist/js/components/TimePicker/TimePicker.d.ts.map +1 -1
  30. package/dist/js/components/TimePicker/TimePicker.js +4 -4
  31. package/dist/js/components/TimePicker/TimePicker.js.map +1 -1
  32. package/dist/js/components/TimePicker/TimePickerUtils.d.ts +1 -1
  33. package/dist/js/components/TimePicker/TimePickerUtils.d.ts.map +1 -1
  34. package/dist/js/components/TimePicker/TimePickerUtils.js +2 -2
  35. package/dist/js/components/TimePicker/TimePickerUtils.js.map +1 -1
  36. package/dist/umd/react-core.css +68 -8
  37. package/dist/umd/react-core.js +11 -9
  38. package/dist/umd/react-core.min.css +80 -20
  39. package/dist/umd/react-core.min.js +2 -2
  40. package/package.json +6 -6
  41. package/src/components/DescriptionList/DescriptionListTerm.tsx +4 -0
  42. package/src/components/DescriptionList/examples/DescriptionList.md +55 -0
  43. package/src/components/Menu/examples/Menu.md +11 -204
  44. package/src/components/Menu/examples/MenuDrilldown.tsx +179 -0
  45. package/src/components/Menu/examples/MenuDrilldownInitialState.tsx +179 -0
  46. package/src/components/Progress/Progress.tsx +1 -1
  47. package/src/components/Select/Select.tsx +2 -3
  48. package/src/components/TimePicker/TimePicker.tsx +4 -4
  49. package/src/components/TimePicker/TimePickerUtils.tsx +3 -2
  50. package/src/components/TimePicker/__tests__/TimePicker.test.tsx +9 -1
  51. package/src/components/TimePicker/examples/TimePicker.md +3 -3
  52. package/src/demos/PrimaryDetail.md +4 -4
@@ -0,0 +1,179 @@
1
+ import React from 'react';
2
+ import { Menu, MenuContent, MenuList, MenuItem, Divider, DrilldownMenu } from '@patternfly/react-core';
3
+ import StorageDomainIcon from '@patternfly/react-icons/dist/esm/icons/storage-domain-icon';
4
+ import CodeBranchIcon from '@patternfly/react-icons/dist/esm/icons/code-branch-icon';
5
+ import LayerGroupIcon from '@patternfly/react-icons/dist/esm/icons/layer-group-icon';
6
+ import CubeIcon from '@patternfly/react-icons/dist/esm/icons/cube-icon';
7
+
8
+ export const MenuDrilldownInitialState: React.FunctionComponent = () => {
9
+ const [menuDrilledIn, setMenuDrilledIn] = React.useState<string[]>(['rootMenu', 'drilldownMenuStart']);
10
+ const [drilldownPath, setDrilldownPath] = React.useState<string[]>(['group:start_rollout', 'group:app_grouping']);
11
+ const [menuHeights, setMenuHeights] = React.useState<any>({ rootMenu: 216 }); // The root menu height must be defined when starting from a drilled in state
12
+ const [activeMenu, setActiveMenu] = React.useState<string>('drilldownMenuStartGrouping');
13
+
14
+ const drillIn = (fromMenuId: string, toMenuId: string, pathId: string) => {
15
+ setMenuDrilledIn([...menuDrilledIn, fromMenuId]);
16
+ setDrilldownPath([...drilldownPath, pathId]);
17
+ setActiveMenu(toMenuId);
18
+ };
19
+
20
+ const drillOut = (toMenuId: string) => {
21
+ const menuDrilledInSansLast = menuDrilledIn.slice(0, menuDrilledIn.length - 1);
22
+ const pathSansLast = drilldownPath.slice(0, drilldownPath.length - 1);
23
+ setMenuDrilledIn(menuDrilledInSansLast);
24
+ setDrilldownPath(pathSansLast);
25
+ setActiveMenu(toMenuId);
26
+ };
27
+
28
+ const setHeight = (menuId: string, height: number) => {
29
+ if (menuHeights[menuId] === undefined || (menuId !== 'rootMenu' && menuHeights[menuId] !== height)) {
30
+ setMenuHeights({ ...menuHeights, [menuId]: height });
31
+ }
32
+ };
33
+
34
+ return (
35
+ <Menu
36
+ id="rootMenu"
37
+ containsDrilldown
38
+ drilldownItemPath={drilldownPath}
39
+ drilledInMenus={menuDrilledIn}
40
+ activeMenu={activeMenu}
41
+ onDrillIn={drillIn}
42
+ onDrillOut={drillOut}
43
+ onGetMenuHeight={setHeight}
44
+ >
45
+ <MenuContent menuHeight={`${menuHeights[activeMenu]}px`}>
46
+ <MenuList>
47
+ <MenuItem
48
+ itemId="group:start_rollout"
49
+ direction="down"
50
+ drilldownMenu={
51
+ <DrilldownMenu id="drilldownMenuStart">
52
+ <MenuItem itemId="group:start_rollout_breadcrumb" direction="up">
53
+ Start rollout
54
+ </MenuItem>
55
+ <Divider component="li" />
56
+ <MenuItem
57
+ itemId="group:app_grouping"
58
+ description="Groups A-C"
59
+ direction="down"
60
+ drilldownMenu={
61
+ <DrilldownMenu id="drilldownMenuStartGrouping">
62
+ <MenuItem itemId="group:app_grouping_breadcrumb" direction="up">
63
+ Application grouping
64
+ </MenuItem>
65
+ <Divider component="li" />
66
+ <MenuItem itemId="group_a">Group A</MenuItem>
67
+ <MenuItem itemId="group_b">Group B</MenuItem>
68
+ <MenuItem itemId="group_c">Group C</MenuItem>
69
+ </DrilldownMenu>
70
+ }
71
+ >
72
+ Application grouping
73
+ </MenuItem>
74
+ <MenuItem itemId="count">Count</MenuItem>
75
+ <MenuItem
76
+ itemId="group:labels"
77
+ direction="down"
78
+ drilldownMenu={
79
+ <DrilldownMenu id="drilldownMenuStartLabels">
80
+ <MenuItem itemId="group:labels_breadcrumb" direction="up">
81
+ Labels
82
+ </MenuItem>
83
+ <Divider component="li" />
84
+ <MenuItem itemId="label_1">Label 1</MenuItem>
85
+ <MenuItem itemId="label_2">Label 2</MenuItem>
86
+ <MenuItem itemId="label_3">Label 3</MenuItem>
87
+ </DrilldownMenu>
88
+ }
89
+ >
90
+ Labels
91
+ </MenuItem>
92
+ <MenuItem itemId="annotations">Annotations</MenuItem>
93
+ </DrilldownMenu>
94
+ }
95
+ >
96
+ Start rollout
97
+ </MenuItem>
98
+ <MenuItem
99
+ itemId="group:pause_rollout"
100
+ direction="down"
101
+ drilldownMenu={
102
+ <DrilldownMenu id="drilldownMenuPause">
103
+ <MenuItem itemId="group:pause_rollout_breadcrumb" direction="up">
104
+ Pause rollouts
105
+ </MenuItem>
106
+ <Divider component="li" />
107
+ <MenuItem
108
+ itemId="group:app_grouping"
109
+ description="Groups A-C"
110
+ direction="down"
111
+ drilldownMenu={
112
+ <DrilldownMenu id="drilldownMenuGrouping">
113
+ <MenuItem itemId="group:app_grouping_breadcrumb" direction="up">
114
+ Application grouping
115
+ </MenuItem>
116
+ <Divider component="li" />
117
+ <MenuItem itemId="group_a">Group A</MenuItem>
118
+ <MenuItem itemId="group_b">Group B</MenuItem>
119
+ <MenuItem itemId="group_c">Group C</MenuItem>
120
+ </DrilldownMenu>
121
+ }
122
+ >
123
+ Application grouping
124
+ </MenuItem>
125
+ <MenuItem itemId="count">Count</MenuItem>
126
+ <MenuItem
127
+ itemId="group:labels"
128
+ direction="down"
129
+ drilldownMenu={
130
+ <DrilldownMenu id="drilldownMenuLabels">
131
+ <MenuItem itemId="group:labels_breadcrumb" direction="up">
132
+ Labels
133
+ </MenuItem>
134
+ <Divider component="li" />
135
+ <MenuItem itemId="label_1">Label 1</MenuItem>
136
+ <MenuItem itemId="label_2">Label 2</MenuItem>
137
+ <MenuItem itemId="label_3">Label 3</MenuItem>
138
+ </DrilldownMenu>
139
+ }
140
+ >
141
+ Labels
142
+ </MenuItem>
143
+ <MenuItem itemId="annotations">Annotations</MenuItem>
144
+ </DrilldownMenu>
145
+ }
146
+ >
147
+ Pause rollouts
148
+ </MenuItem>
149
+ <MenuItem
150
+ itemId="group:storage"
151
+ icon={<StorageDomainIcon aria-hidden />}
152
+ direction="down"
153
+ drilldownMenu={
154
+ <DrilldownMenu id="drilldownMenuStorage">
155
+ <MenuItem itemId="group:storage_breadcrumb" icon={<StorageDomainIcon aria-hidden />} direction="up">
156
+ Add storage
157
+ </MenuItem>
158
+ <Divider component="li" />
159
+ <MenuItem icon={<CodeBranchIcon aria-hidden />} itemId="git">
160
+ From git
161
+ </MenuItem>
162
+ <MenuItem icon={<LayerGroupIcon aria-hidden />} itemId="container">
163
+ Container image
164
+ </MenuItem>
165
+ <MenuItem icon={<CubeIcon aria-hidden />} itemId="docker">
166
+ Docker file
167
+ </MenuItem>
168
+ </DrilldownMenu>
169
+ }
170
+ >
171
+ Add storage
172
+ </MenuItem>
173
+ <MenuItem itemId="edit">Edit</MenuItem>
174
+ <MenuItem itemId="delete_deployment">Delete deployment config</MenuItem>
175
+ </MenuList>
176
+ </MenuContent>
177
+ </Menu>
178
+ );
179
+ };
@@ -113,7 +113,7 @@ export class Progress extends React.Component<ProgressProps> {
113
113
  );
114
114
  }
115
115
 
116
- const scaledValue = Math.min(100, Math.max(0, Math.floor(((value - min) / (max - min)) * 100)));
116
+ const scaledValue = Math.min(100, Math.max(0, Math.floor(((value - min) / (max - min)) * 100))) || 0;
117
117
  return (
118
118
  <div
119
119
  {...props}
@@ -31,7 +31,6 @@ import {
31
31
  PickOptional,
32
32
  GenerateId
33
33
  } from '../../helpers';
34
- import { getUniqueId } from '../../helpers/util';
35
34
  import { Divider } from '../Divider';
36
35
  import { ToggleMenuBaseProps, Popper } from '../../helpers/Popper/Popper';
37
36
  import { createRenderableFavorites, extendItemsWithFavorite } from '../../helpers/favorites';
@@ -149,7 +148,7 @@ export interface SelectProps
149
148
  customBadgeText?: string | number;
150
149
  /** Prefix for the id of the input in the checkbox select variant*/
151
150
  inputIdPrefix?: string;
152
- /** Value for the typeahead and inline filtering input autocomplete attribute */
151
+ /** Value for the typeahead and inline filtering input autocomplete attribute. When targeting Chrome this property should be a random string. */
153
152
  inputAutoComplete?: string;
154
153
  /** Optional props to pass to the chip group in the typeaheadmulti variant */
155
154
  chipGroupProps?: Omit<ChipGroupProps, 'children' | 'ref'>;
@@ -224,7 +223,7 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
224
223
  inlineFilterPlaceholderText: null,
225
224
  customBadgeText: null,
226
225
  inputIdPrefix: '',
227
- inputAutoComplete: navigator.userAgent.match('Chrome') ? getUniqueId('pf-no-autocomplete') : 'off',
226
+ inputAutoComplete: 'off',
228
227
  menuAppendTo: 'inline',
229
228
  favorites: [] as string[],
230
229
  favoritesLabel: 'Favorites',
@@ -357,7 +357,8 @@ export class TimePicker extends React.Component<TimePickerProps, TimePickerState
357
357
 
358
358
  this.inputRef.current.focus();
359
359
  this.setState({
360
- isOpen: false
360
+ isOpen: false,
361
+ isInvalid: false
361
362
  });
362
363
  };
363
364
 
@@ -383,8 +384,7 @@ export class TimePicker extends React.Component<TimePickerProps, TimePickerState
383
384
  }
384
385
  this.scrollToSelection(newTime);
385
386
  this.setState({
386
- timeState: newTime,
387
- isInvalid: !this.isValid(newTime)
387
+ timeState: newTime
388
388
  });
389
389
  };
390
390
 
@@ -425,7 +425,7 @@ export class TimePicker extends React.Component<TimePickerProps, TimePickerState
425
425
  } = this.props;
426
426
  const { timeState, isOpen, isInvalid, minTimeState, maxTimeState } = this.state;
427
427
  const style = { '--pf-c-date-picker__input--c-form-control--Width': width } as React.CSSProperties;
428
- const options = makeTimeOptions(stepMinutes, !is24Hour, delimiter, minTimeState, maxTimeState);
428
+ const options = makeTimeOptions(stepMinutes, !is24Hour, delimiter, minTimeState, maxTimeState, includeSeconds);
429
429
  const isValidFormat = this.isValidFormat(timeState);
430
430
  const randomId = id || getUniqueId('time-picker');
431
431
 
@@ -6,7 +6,8 @@ export const makeTimeOptions = (
6
6
  hour12: boolean,
7
7
  delimiter: string,
8
8
  minTime: string,
9
- maxTime: string
9
+ maxTime: string,
10
+ includeSeconds: boolean
10
11
  ) => {
11
12
  const res = [];
12
13
  const iter = new Date(new Date().setHours(0, 0, 0, 0));
@@ -31,7 +32,7 @@ export const makeTimeOptions = (
31
32
  .padStart(2, '0');
32
33
  const timeOption = `${hour}${delimiter}${minutes}${hour12 ? suffix : ''}`;
33
34
  // time option is valid if within min/max constraints
34
- if (isWithinMinMax(minTime, maxTime, timeOption, delimiter)) {
35
+ if (isWithinMinMax(minTime, maxTime, timeOption, delimiter, includeSeconds)) {
35
36
  res.push(timeOption);
36
37
  }
37
38
  iter.setMinutes(iter.getMinutes() + stepMinutes);
@@ -72,7 +72,7 @@ describe('test isInvalid', () => {
72
72
  expect(view.find('.pf-m-error')).toHaveLength(0);
73
73
  })
74
74
 
75
- test('should be invalid after onChange', () => {
75
+ test('should be invalid after onBlur', () => {
76
76
  const validateTime = (time: string) => {
77
77
  return false;
78
78
  }
@@ -87,6 +87,10 @@ describe('test isInvalid', () => {
87
87
  })
88
88
  view.update();
89
89
 
90
+ expect(view.find('.pf-m-error')).toHaveLength(0);
91
+
92
+ view.find('input').simulate('blur');
93
+
90
94
  expect(view.find('.pf-m-error')).toHaveLength(1);
91
95
  })
92
96
  })
@@ -125,6 +129,10 @@ describe('test includeSeconds', () => {
125
129
  act(() => view.find('input').prop('onChange')(event));
126
130
  view.update();
127
131
 
132
+ expect(view.find('.pf-m-error')).toHaveLength(0);
133
+
134
+ view.find('input').simulate('blur');
135
+
128
136
  expect(view.find('.pf-m-error')).toHaveLength(1);
129
137
  });
130
138
  });
@@ -64,14 +64,14 @@ import { TimePicker } from '@patternfly/react-core';
64
64
  import React from 'react';
65
65
  import { TimePicker } from '@patternfly/react-core';
66
66
 
67
- SimpleTimePicker = () => <TimePicker time="3:35:20 PM" includeSeconds />;
67
+ <TimePicker time="3:35:20 PM" includeSeconds />;
68
68
  ```
69
69
 
70
- ### 24 hours with seconds
70
+ ### Basic 24 hours with seconds
71
71
 
72
72
  ```js
73
73
  import React from 'react';
74
74
  import { TimePicker } from '@patternfly/react-core';
75
75
 
76
- SimpleTimePicker = () => <TimePicker time="12:35:50" includeSeconds is24Hour />;
76
+ <TimePicker time="12:35:50" includeSeconds is24Hour />;
77
77
  ```
@@ -275,7 +275,7 @@ class PrimaryDetailFullPage extends React.Component {
275
275
  );
276
276
  const drawerContent = (
277
277
  <React.Fragment>
278
- <Toolbar id="full-page-data-toolbar" className="pf-m-page-insets">
278
+ <Toolbar id="full-page-data-toolbar" usePageInsets>
279
279
  <ToolbarContent>{ToolbarItems}</ToolbarContent>
280
280
  </Toolbar>
281
281
  <DataList
@@ -736,7 +736,7 @@ class PrimaryDetailContentPadding extends React.Component {
736
736
 
737
737
  const drawerContent = (
738
738
  <React.Fragment>
739
- <Toolbar id="content-padding-data-toolbar" className="pf-m-page-insets">
739
+ <Toolbar id="content-padding-data-toolbar" usePageInsets>
740
740
  <ToolbarContent>{ToolbarItems}</ToolbarContent>
741
741
  </Toolbar>
742
742
  <DataList
@@ -1633,7 +1633,7 @@ class PrimaryDetailDataListInCard extends React.Component {
1633
1633
 
1634
1634
  const drawerContent = (
1635
1635
  <React.Fragment>
1636
- <Toolbar id="data-list-data-toolbar" className="pf-m-page-insets">
1636
+ <Toolbar id="data-list-data-toolbar" usePageInsets>
1637
1637
  <ToolbarContent>
1638
1638
  <ToolbarItem>
1639
1639
  <Dropdown
@@ -1998,7 +1998,7 @@ class PrimaryDetailInlineModifier extends React.Component {
1998
1998
  );
1999
1999
  const drawerContent = (
2000
2000
  <React.Fragment>
2001
- <Toolbar id="inline-modifier-data-toolbar" className="pf-m-page-insets">
2001
+ <Toolbar id="inline-modifier-data-toolbar" usePageInsets>
2002
2002
  <ToolbarContent>{ToolbarItems}</ToolbarContent>
2003
2003
  </Toolbar>
2004
2004
  <DataList