@patternfly/react-core 4.271.1 → 4.272.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 (118) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/components/LoginPage/LoginPage.d.ts +1 -1
  3. package/components/LoginPage/LoginPage.d.ts.map +1 -1
  4. package/components/Menu/MenuItem.d.ts +1 -1
  5. package/components/Menu/MenuItem.d.ts.map +1 -1
  6. package/components/SearchInput/SearchInput.d.ts +2 -0
  7. package/components/SearchInput/SearchInput.d.ts.map +1 -1
  8. package/components/SearchInput/SearchInput.js +2 -2
  9. package/components/SearchInput/SearchInput.js.map +1 -1
  10. package/components/Select/Select.d.ts +3 -3
  11. package/components/Select/Select.d.ts.map +1 -1
  12. package/components/Tabs/Tabs.d.ts +3 -3
  13. package/components/Tabs/Tabs.d.ts.map +1 -1
  14. package/components/TextInputGroup/TextInputGroupMain.d.ts +2 -0
  15. package/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -1
  16. package/components/TextInputGroup/TextInputGroupMain.js +2 -2
  17. package/components/TextInputGroup/TextInputGroupMain.js.map +1 -1
  18. package/components/TimePicker/TimePicker.d.ts +2 -2
  19. package/components/TimePicker/TimePicker.d.ts.map +1 -1
  20. package/components/TimePicker/TimePicker.js +3 -3
  21. package/components/TimePicker/TimePicker.js.map +1 -1
  22. package/components/Wizard/Wizard.d.ts +2 -0
  23. package/components/Wizard/Wizard.d.ts.map +1 -1
  24. package/components/Wizard/Wizard.js +4 -3
  25. package/components/Wizard/Wizard.js.map +1 -1
  26. package/components/Wizard/WizardBody.d.ts +2 -0
  27. package/components/Wizard/WizardBody.d.ts.map +1 -1
  28. package/components/Wizard/WizardBody.js +2 -2
  29. package/components/Wizard/WizardBody.js.map +1 -1
  30. package/components/Wizard/WizardToggle.d.ts +2 -0
  31. package/components/Wizard/WizardToggle.d.ts.map +1 -1
  32. package/components/Wizard/WizardToggle.js +2 -2
  33. package/components/Wizard/WizardToggle.js.map +1 -1
  34. package/dist/esm/components/LoginPage/LoginPage.d.ts +1 -1
  35. package/dist/esm/components/LoginPage/LoginPage.d.ts.map +1 -1
  36. package/dist/esm/components/Menu/MenuItem.d.ts +1 -1
  37. package/dist/esm/components/Menu/MenuItem.d.ts.map +1 -1
  38. package/dist/esm/components/SearchInput/SearchInput.d.ts +2 -0
  39. package/dist/esm/components/SearchInput/SearchInput.d.ts.map +1 -1
  40. package/dist/esm/components/SearchInput/SearchInput.js +2 -2
  41. package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
  42. package/dist/esm/components/Select/Select.d.ts +3 -3
  43. package/dist/esm/components/Select/Select.d.ts.map +1 -1
  44. package/dist/esm/components/Tabs/Tabs.d.ts +3 -3
  45. package/dist/esm/components/Tabs/Tabs.d.ts.map +1 -1
  46. package/dist/esm/components/TextInputGroup/TextInputGroupMain.d.ts +2 -0
  47. package/dist/esm/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -1
  48. package/dist/esm/components/TextInputGroup/TextInputGroupMain.js +2 -2
  49. package/dist/esm/components/TextInputGroup/TextInputGroupMain.js.map +1 -1
  50. package/dist/esm/components/TimePicker/TimePicker.d.ts +2 -2
  51. package/dist/esm/components/TimePicker/TimePicker.d.ts.map +1 -1
  52. package/dist/esm/components/TimePicker/TimePicker.js +3 -3
  53. package/dist/esm/components/TimePicker/TimePicker.js.map +1 -1
  54. package/dist/esm/components/Wizard/Wizard.d.ts +2 -0
  55. package/dist/esm/components/Wizard/Wizard.d.ts.map +1 -1
  56. package/dist/esm/components/Wizard/Wizard.js +4 -3
  57. package/dist/esm/components/Wizard/Wizard.js.map +1 -1
  58. package/dist/esm/components/Wizard/WizardBody.d.ts +2 -0
  59. package/dist/esm/components/Wizard/WizardBody.d.ts.map +1 -1
  60. package/dist/esm/components/Wizard/WizardBody.js +2 -2
  61. package/dist/esm/components/Wizard/WizardBody.js.map +1 -1
  62. package/dist/esm/components/Wizard/WizardToggle.d.ts +2 -0
  63. package/dist/esm/components/Wizard/WizardToggle.d.ts.map +1 -1
  64. package/dist/esm/components/Wizard/WizardToggle.js +2 -2
  65. package/dist/esm/components/Wizard/WizardToggle.js.map +1 -1
  66. package/dist/js/components/LoginPage/LoginPage.d.ts +1 -1
  67. package/dist/js/components/LoginPage/LoginPage.d.ts.map +1 -1
  68. package/dist/js/components/Menu/MenuItem.d.ts +1 -1
  69. package/dist/js/components/Menu/MenuItem.d.ts.map +1 -1
  70. package/dist/js/components/SearchInput/SearchInput.d.ts +2 -0
  71. package/dist/js/components/SearchInput/SearchInput.d.ts.map +1 -1
  72. package/dist/js/components/SearchInput/SearchInput.js +2 -2
  73. package/dist/js/components/SearchInput/SearchInput.js.map +1 -1
  74. package/dist/js/components/Select/Select.d.ts +3 -3
  75. package/dist/js/components/Select/Select.d.ts.map +1 -1
  76. package/dist/js/components/Tabs/Tabs.d.ts +3 -3
  77. package/dist/js/components/Tabs/Tabs.d.ts.map +1 -1
  78. package/dist/js/components/TextInputGroup/TextInputGroupMain.d.ts +2 -0
  79. package/dist/js/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -1
  80. package/dist/js/components/TextInputGroup/TextInputGroupMain.js +2 -2
  81. package/dist/js/components/TextInputGroup/TextInputGroupMain.js.map +1 -1
  82. package/dist/js/components/TimePicker/TimePicker.d.ts +2 -2
  83. package/dist/js/components/TimePicker/TimePicker.d.ts.map +1 -1
  84. package/dist/js/components/TimePicker/TimePicker.js +3 -3
  85. package/dist/js/components/TimePicker/TimePicker.js.map +1 -1
  86. package/dist/js/components/Wizard/Wizard.d.ts +2 -0
  87. package/dist/js/components/Wizard/Wizard.d.ts.map +1 -1
  88. package/dist/js/components/Wizard/Wizard.js +4 -3
  89. package/dist/js/components/Wizard/Wizard.js.map +1 -1
  90. package/dist/js/components/Wizard/WizardBody.d.ts +2 -0
  91. package/dist/js/components/Wizard/WizardBody.d.ts.map +1 -1
  92. package/dist/js/components/Wizard/WizardBody.js +2 -2
  93. package/dist/js/components/Wizard/WizardBody.js.map +1 -1
  94. package/dist/js/components/Wizard/WizardToggle.d.ts +2 -0
  95. package/dist/js/components/Wizard/WizardToggle.d.ts.map +1 -1
  96. package/dist/js/components/Wizard/WizardToggle.js +2 -2
  97. package/dist/js/components/Wizard/WizardToggle.js.map +1 -1
  98. package/dist/umd/react-core.min.js +2 -2
  99. package/package.json +2 -2
  100. package/src/components/Alert/examples/Alert.md +1 -1
  101. package/src/components/LoginPage/LoginPage.tsx +1 -1
  102. package/src/components/Menu/MenuItem.tsx +1 -1
  103. package/src/components/SearchInput/SearchInput.tsx +4 -0
  104. package/src/components/Select/Select.tsx +3 -3
  105. package/src/components/Tabs/Tabs.tsx +3 -3
  106. package/src/components/Tabs/examples/Tabs.md +3 -3
  107. package/src/components/TextArea/examples/TextArea.md +1 -1
  108. package/src/components/TextInputGroup/TextInputGroupMain.tsx +4 -0
  109. package/src/components/TimePicker/TimePicker.tsx +11 -3
  110. package/src/components/TimePicker/__tests__/TimePicker.test.tsx +8 -1
  111. package/src/components/TimePicker/examples/TimePicker.md +1 -1
  112. package/src/components/Wizard/Wizard.tsx +6 -1
  113. package/src/components/Wizard/WizardBody.tsx +3 -1
  114. package/src/components/Wizard/WizardToggle.tsx +5 -1
  115. package/src/components/Wizard/examples/WizardWithDrawer.tsx +5 -0
  116. package/src/demos/DatePicker/DatePicker.md +2 -2
  117. package/src/demos/Wizard/WizardDemo.md +4 -0
  118. package/src/next/components/Wizard/examples/WizardKitchenSink.tsx +9 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.271.1",
3
+ "version": "4.272.0",
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",
@@ -71,5 +71,5 @@
71
71
  "react": "^16.8 || ^17 || ^18",
72
72
  "react-dom": "^16.8 || ^17 || ^18"
73
73
  },
74
- "gitHead": "541f76a7ca04fc3206d75f13648dda8cc92c9e15"
74
+ "gitHead": "98f8a725aca70798a70fa397ac93e3f870a32b29"
75
75
  }
@@ -360,4 +360,4 @@ Alerts that are asynchronously appended into dynamic [alert groups](/components/
360
360
 
361
361
  This example shows how an alert could be triggered by an asynchronous event in the application. Note that you can customize how the alert will be announced to assistive technology. See the [https://www.patternfly.org/v4/components/alert/accessibility](alert accessibility) for more information.
362
362
  ```ts file="AlertAsyncLiveRegion.tsx"
363
- ```
363
+ ```
@@ -35,7 +35,7 @@ export interface LoginPageProps extends React.HTMLProps<HTMLDivElement> {
35
35
  loginTitle: string;
36
36
  /** Subtitle for the login main body header of the login page */
37
37
  loginSubtitle?: string;
38
- /** @beta Header utilities for the login main body header of the login page */
38
+ /** Header utilities for the login main body header of the login page */
39
39
  headerUtilities?: React.ReactNode;
40
40
  /** Content rendered inside of login main footer band to display a sign up for account message */
41
41
  signUpForAccountMessage?: React.ReactNode;
@@ -24,7 +24,7 @@ export interface MenuItemProps extends Omit<React.HTMLProps<HTMLLIElement>, 'onC
24
24
  itemId?: any;
25
25
  /** Target navigation link. Should not be used if the flyout prop is defined. */
26
26
  to?: string;
27
- /** @beta Flag indicating the item has a checkbox */
27
+ /** Flag indicating the item has a checkbox */
28
28
  hasCheck?: boolean;
29
29
  /** Flag indicating whether the item is active */
30
30
  isActive?: boolean;
@@ -130,6 +130,8 @@ export interface SearchInputProps extends Omit<React.HTMLProps<HTMLDivElement>,
130
130
  submitSearchButtonLabel?: string;
131
131
  /** Value of the search input. */
132
132
  value?: string;
133
+ /** Name attribue for the search input */
134
+ name?: string;
133
135
  }
134
136
 
135
137
  const SearchInputBase: React.FunctionComponent<SearchInputProps> = ({
@@ -164,6 +166,7 @@ const SearchInputBase: React.FunctionComponent<SearchInputProps> = ({
164
166
  removeFindDomNode = false,
165
167
  zIndex = 9999,
166
168
  type = 'text',
169
+ name,
167
170
  ...props
168
171
  }: SearchInputProps) => {
169
172
  const [isSearchMenuOpen, setIsSearchMenuOpen] = React.useState(false);
@@ -304,6 +307,7 @@ const SearchInputBase: React.FunctionComponent<SearchInputProps> = ({
304
307
  onKeyDown={onEnter}
305
308
  onChange={onChangeHandler}
306
309
  type={type}
310
+ name={name}
307
311
  />
308
312
  {renderUtilities && (
309
313
  <TextInputGroupUtilities>
@@ -73,7 +73,7 @@ export interface SelectProps
73
73
  isCreateOptionOnTop?: boolean;
74
74
  /** Flag indicating if placeholder styles should be applied */
75
75
  hasPlaceholderStyle?: boolean;
76
- /** @beta Flag indicating if the creatable option should set its value as a SelectOptionObject */
76
+ /** Flag indicating if the creatable option should set its value as a SelectOptionObject */
77
77
  isCreateSelectOptionObject?: boolean;
78
78
  /** Value to indicate if the select is modified to show that validation state.
79
79
  * If set to success, select will be modified to indicate valid state.
@@ -81,7 +81,7 @@ export interface SelectProps
81
81
  * If set to warning, select will be modified to indicate warning state.
82
82
  */
83
83
  validated?: 'success' | 'warning' | 'error' | 'default';
84
- /** @beta Loading variant to display either the spinner or the view more text button */
84
+ /** Loading variant to display either the spinner or the view more text button */
85
85
  loadingVariant?: 'spinner' | SelectViewMoreObject;
86
86
  /** Text displayed in typeahead select to prompt the user to create an item */
87
87
  createText?: string;
@@ -165,7 +165,7 @@ export interface SelectProps
165
165
  chipGroupComponent?: React.ReactNode;
166
166
  /** Flag for retaining keyboard-entered value in typeahead text field when focus leaves input away */
167
167
  isInputValuePersisted?: boolean;
168
- /** @beta Flag for retaining filter results on blur from keyboard-entered typeahead text */
168
+ /** Flag for retaining filter results on blur from keyboard-entered typeahead text */
169
169
  isInputFilterPersisted?: boolean;
170
170
  /** Flag indicating the typeahead input value should reset upon selection */
171
171
  shouldResetOnSelect?: boolean;
@@ -42,11 +42,11 @@ export interface TabsProps extends Omit<React.HTMLProps<HTMLElement | HTMLDivEle
42
42
  defaultActiveKey?: number | string;
43
43
  /** Callback to handle tab selection */
44
44
  onSelect?: (event: React.MouseEvent<HTMLElement, MouseEvent>, eventKey: number | string) => void;
45
- /** @beta Callback to handle tab closing and adds a basic close button to all tabs. This is overridden by the tab actions property. */
45
+ /** Callback to handle tab closing and adds a basic close button to all tabs. This is overridden by the tab actions property. */
46
46
  onClose?: (event: React.MouseEvent<HTMLElement, MouseEvent>, eventKey: number | string) => void;
47
- /** @beta Callback for the add button. Passing this property inserts the add button */
47
+ /** Callback for the add button. Passing this property inserts the add button */
48
48
  onAdd?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
49
- /** @beta Aria-label for the add button */
49
+ /** Aria-label for the add button */
50
50
  addButtonAriaLabel?: string;
51
51
  /** Uniquely identifies the tabs */
52
52
  id?: string;
@@ -141,15 +141,15 @@ The tooltip should also have the `id` prop passed in. The value given to this pr
141
141
 
142
142
  To enable closeable tabs, pass the `onClose` property to `Tabs`, and to enable the add button, pass the `onAdd` property to `Tabs`. Aria labels may be controlled manually by passing `closeButtonAriaLabel` to `Tab` and `addButtonAriaLabel` to `Tabs`.
143
143
 
144
- ```ts file="./TabsDynamic.tsx" isBeta
144
+ ```ts file="./TabsDynamic.tsx"
145
145
  ```
146
146
 
147
147
  ### Help action
148
148
 
149
- ```ts file="./TabsHelp.tsx" isBeta
149
+ ```ts file="./TabsHelp.tsx"
150
150
  ```
151
151
 
152
152
  ### Help and close actions
153
153
 
154
- ```ts file="./TabsHelpAndClose.tsx" isBeta
154
+ ```ts file="./TabsHelpAndClose.tsx"
155
155
  ```
@@ -56,5 +56,5 @@ propComponents: ['TextArea']
56
56
 
57
57
  **Note:** The icons for the success, invalid, calendar, etc. variations in form control elements are applied as background images to the form element. By default, the image URLs for these icons are data URIs. However, there may be cases where data URIs are not ideal, such as in an application with a content security policy that disallows data URIs for security reasons. The `isIconSprite` variation changes the icon source to an external SVG file that serves as a sprite for all of the supported icons.
58
58
 
59
- ```ts isBeta file="./TextAreaIconSprite.tsx"
59
+ ```ts file="./TextAreaIconSprite.tsx"
60
60
  ```
@@ -39,6 +39,8 @@ export interface TextInputGroupMainProps extends Omit<React.HTMLProps<HTMLDivEle
39
39
  placeholder?: string;
40
40
  /** A reference object to attach to the input box */
41
41
  innerRef?: React.RefObject<any>;
42
+ /** Name for the input */
43
+ name?: string;
42
44
  }
43
45
 
44
46
  export const TextInputGroupMain: React.FunctionComponent<TextInputGroupMainProps> = ({
@@ -54,6 +56,7 @@ export const TextInputGroupMain: React.FunctionComponent<TextInputGroupMainProps
54
56
  value: inputValue,
55
57
  placeholder: inputPlaceHolder,
56
58
  innerRef,
59
+ name,
57
60
  ...props
58
61
  }: TextInputGroupMainProps) => {
59
62
  const { isDisabled } = React.useContext(TextInputGroupContext);
@@ -89,6 +92,7 @@ export const TextInputGroupMain: React.FunctionComponent<TextInputGroupMainProps
89
92
  onBlur={onBlur}
90
93
  value={inputValue || ''}
91
94
  placeholder={inputPlaceHolder}
95
+ name={name}
92
96
  />
93
97
  </span>
94
98
  </div>
@@ -42,7 +42,14 @@ export interface TimePickerProps
42
42
  /** True if the time is 24 hour time. False if the time is 12 hour time */
43
43
  is24Hour?: boolean;
44
44
  /** Optional event handler called each time the value in the time picker input changes. */
45
- onChange?: (time: string, hour?: number, minute?: number, seconds?: number, isValid?: boolean) => void;
45
+ onChange?: (
46
+ event: React.FormEvent<HTMLInputElement>,
47
+ time: string,
48
+ hour?: number,
49
+ minute?: number,
50
+ seconds?: number,
51
+ isValid?: boolean
52
+ ) => void;
46
53
  /** Optional validator can be provided to override the internal time validator. */
47
54
  validateTime?: (time: string) => boolean;
48
55
  /** Id of the time picker */
@@ -389,7 +396,7 @@ export class TimePicker extends React.Component<TimePickerProps, TimePickerState
389
396
  const { delimiter, is24Hour, includeSeconds, setIsOpen } = this.props;
390
397
  const time = parseTime(e.target.textContent, timeRegex, delimiter, !is24Hour, includeSeconds);
391
398
  if (time !== timeState) {
392
- this.onInputChange(time);
399
+ this.onInputChange(time, e);
393
400
  }
394
401
 
395
402
  this.inputRef.current.focus();
@@ -407,12 +414,13 @@ export class TimePicker extends React.Component<TimePickerProps, TimePickerState
407
414
  e.stopPropagation();
408
415
  };
409
416
 
410
- onInputChange = (newTime: string) => {
417
+ onInputChange = (newTime: string, event: React.FormEvent<HTMLInputElement>) => {
411
418
  const { onChange } = this.props;
412
419
  const { timeRegex } = this.state;
413
420
 
414
421
  if (onChange) {
415
422
  onChange(
423
+ event,
416
424
  newTime,
417
425
  getHours(newTime, timeRegex),
418
426
  getMinutes(newTime, timeRegex),
@@ -35,7 +35,14 @@ describe('TimePicker', () => {
35
35
  render(<TimePicker onChange={onChange} {...inputProps} aria-label="time picker" />);
36
36
 
37
37
  await user.type(screen.getByLabelText('time picker'), String(inputProps.value));
38
- expect(onChange).toHaveBeenCalledWith(inputProps.value, expects.hour, expects.minutes, expects.seconds, true);
38
+ expect(onChange).toHaveBeenCalledWith(
39
+ expect.any(Object),
40
+ inputProps.value,
41
+ expects.hour,
42
+ expects.minutes,
43
+ expects.seconds,
44
+ true
45
+ );
39
46
  };
40
47
 
41
48
  test('should return the correct value using the AM/PM pattern - midnight', async () => {
@@ -19,7 +19,7 @@ import React from 'react';
19
19
  import { TimePicker } from '@patternfly/react-core';
20
20
 
21
21
  SimpleTimePicker = () => {
22
- const onChange = (time, hour, minute, seconds, isValid) => {
22
+ const onChange = (_event, time, hour, minute, seconds, isValid) => {
23
23
  console.log('time', time);
24
24
  console.log('hour', hour);
25
25
  console.log('minute', minute);
@@ -112,6 +112,8 @@ export interface WizardProps extends React.HTMLProps<HTMLDivElement> {
112
112
  hasDrawer?: boolean;
113
113
  /** Flag indicating the wizard drawer is expanded */
114
114
  isDrawerExpanded?: boolean;
115
+ /** Callback function for when the drawer is toggled. Can be used to set browser focus in the drawer. */
116
+ onExpandDrawer?: () => void;
115
117
  }
116
118
 
117
119
  interface WizardState {
@@ -149,7 +151,8 @@ export class Wizard extends React.Component<WizardProps, WizardState> {
149
151
  isOpen: undefined,
150
152
  isNavExpandable: false,
151
153
  hasDrawer: false,
152
- isDrawerExpanded: false
154
+ isDrawerExpanded: false,
155
+ onExpandDrawer: () => undefined as any
153
156
  };
154
157
  private titleId: string;
155
158
  private descriptionId: string;
@@ -408,6 +411,7 @@ export class Wizard extends React.Component<WizardProps, WizardState> {
408
411
  onCurrentStepChanged,
409
412
  hasDrawer,
410
413
  isDrawerExpanded,
414
+ onExpandDrawer,
411
415
  ...rest
412
416
  /* eslint-enable @typescript-eslint/no-unused-vars */
413
417
  } = this.props;
@@ -539,6 +543,7 @@ export class Wizard extends React.Component<WizardProps, WizardState> {
539
543
  <WizardToggle
540
544
  hasDrawer={hasDrawer}
541
545
  isDrawerExpanded={isDrawerExpanded}
546
+ onExpandDrawer={onExpandDrawer}
542
547
  mainAriaLabel={mainAriaLabel}
543
548
  isInPage={isOpen === undefined}
544
549
  mainAriaLabelledBy={(title || mainAriaLabelledBy) && (mainAriaLabelledBy || this.titleId)}
@@ -22,6 +22,7 @@ export interface WizardBodyProps {
22
22
  /** Flag indicating the wizard drawer is expanded */
23
23
  isDrawerExpanded?: boolean;
24
24
  /** Callback function for when the drawer is toggled */
25
+ onExpandDrawer?: () => void;
25
26
  }
26
27
 
27
28
  export const WizardBody: React.FunctionComponent<WizardBodyProps> = ({
@@ -32,6 +33,7 @@ export const WizardBody: React.FunctionComponent<WizardBodyProps> = ({
32
33
  mainComponent = 'div',
33
34
  hasDrawer,
34
35
  isDrawerExpanded,
36
+ onExpandDrawer,
35
37
  activeStep
36
38
  }: WizardBodyProps) => {
37
39
  const MainComponent = mainComponent;
@@ -40,7 +42,7 @@ export const WizardBody: React.FunctionComponent<WizardBodyProps> = ({
40
42
  <WizardDrawerWrapper
41
43
  hasDrawer={hasDrawer && activeStep.drawerPanelContent}
42
44
  wrapper={(children: React.ReactNode) => (
43
- <Drawer isInline isExpanded={isDrawerExpanded}>
45
+ <Drawer isInline isExpanded={isDrawerExpanded} onExpand={onExpandDrawer}>
44
46
  <DrawerContent panelContent={activeStep.drawerPanelContent}>{children}</DrawerContent>
45
47
  </Drawer>
46
48
  )}
@@ -33,6 +33,8 @@ export interface WizardToggleProps {
33
33
  hasDrawer?: boolean;
34
34
  /** Flag indicating the wizard drawer is expanded */
35
35
  isDrawerExpanded?: boolean;
36
+ /** Callback function for when the drawer is toggled */
37
+ onExpandDrawer?: () => void;
36
38
  }
37
39
 
38
40
  export const WizardToggle: React.FunctionComponent<WizardToggleProps> = ({
@@ -48,7 +50,8 @@ export const WizardToggle: React.FunctionComponent<WizardToggleProps> = ({
48
50
  mainAriaLabel = null,
49
51
  isInPage = true,
50
52
  hasDrawer,
51
- isDrawerExpanded
53
+ isDrawerExpanded,
54
+ onExpandDrawer
52
55
  }: WizardToggleProps) => {
53
56
  let activeStepIndex;
54
57
  let activeStepName;
@@ -99,6 +102,7 @@ export const WizardToggle: React.FunctionComponent<WizardToggleProps> = ({
99
102
  hasNoBodyPadding={hasNoBodyPadding}
100
103
  activeStep={activeStep}
101
104
  isDrawerExpanded={isDrawerExpanded}
105
+ onExpandDrawer={onExpandDrawer}
102
106
  hasDrawer={hasDrawer}
103
107
  >
104
108
  {hasDrawer && !isDrawerExpanded && activeStep.drawerToggleButton}
@@ -14,6 +14,10 @@ export const WizardWithDrawer: React.FunctionComponent = () => {
14
14
 
15
15
  const drawerRef = React.useRef<HTMLSpanElement>(null);
16
16
 
17
+ const onExpandDrawer = () => {
18
+ drawerRef.current && drawerRef.current.focus();
19
+ };
20
+
17
21
  const onOpenClick = () => {
18
22
  setIsDrawerExpanded(true);
19
23
  };
@@ -117,6 +121,7 @@ export const WizardWithDrawer: React.FunctionComponent = () => {
117
121
  <Wizard
118
122
  height={400}
119
123
  isDrawerExpanded={isDrawerExpanded}
124
+ onExpandDrawer={onExpandDrawer}
120
125
  hasDrawer
121
126
  navAriaLabel={`${title} steps`}
122
127
  steps={steps}
@@ -80,7 +80,7 @@ DateTimeRangePicker = () => {
80
80
  }
81
81
  };
82
82
 
83
- const onFromTimeChange = (time, hour, minute) => {
83
+ const onFromTimeChange = (_event, time, hour, minute) => {
84
84
  if (isValidDate(from)) {
85
85
  const updatedFromDate = new Date(from);
86
86
  updatedFromDate.setHours(hour);
@@ -99,7 +99,7 @@ DateTimeRangePicker = () => {
99
99
  }
100
100
  };
101
101
 
102
- const onToTimeChange = (time, hour, minute) => {
102
+ const onToTimeChange = (_event, time, hour, minute) => {
103
103
  if (isValidDate(to)) {
104
104
  const updatedToDate = new Date(to);
105
105
  updatedToDate.setHours(hour);
@@ -289,6 +289,7 @@ class WizardModalWithDrawerDemo extends React.Component {
289
289
  navAriaLabel={`${title} steps`}
290
290
  hasDrawer
291
291
  isDrawerExpanded={isDrawerExpanded}
292
+ onExpandDrawer={this.onExpand}
292
293
  mainAriaLabel={`${title} content`}
293
294
  titleId="wiz-modal-demo-title"
294
295
  descriptionId="wiz-modal-demo-description"
@@ -539,6 +540,7 @@ class WizardModalWithDrawerDemo extends React.Component {
539
540
  navAriaLabel={`${title} steps`}
540
541
  hasDrawer
541
542
  isDrawerExpanded={isDrawerExpanded}
543
+ onExpandDrawer={this.onExpand}
542
544
  mainAriaLabel={`${title} content`}
543
545
  titleId="wiz-modal-demo-title"
544
546
  descriptionId="wiz-modal-demo-description"
@@ -877,6 +879,7 @@ class FullPageWizard extends React.Component {
877
879
  <Wizard
878
880
  hasDrawer
879
881
  isDrawerExpanded={isDrawerExpanded}
882
+ onExpandDrawer={this.onExpand}
880
883
  navAriaLabel={`${title} steps`}
881
884
  mainAriaLabel={`${title} content`}
882
885
  steps={steps}
@@ -1194,6 +1197,7 @@ class FullPageWizard extends React.Component {
1194
1197
  <Wizard
1195
1198
  hasDrawer
1196
1199
  isDrawerExpanded={isDrawerExpanded}
1200
+ onExpandDrawer={this.onExpand}
1197
1201
  navAriaLabel={`${title} steps`}
1198
1202
  mainAriaLabel={`${title} content`}
1199
1203
  steps={steps}
@@ -76,14 +76,21 @@ const CustomWizardFooter = () => {
76
76
 
77
77
  const StepContentWithDrawer = () => {
78
78
  const [isDrawerExpanded, setIsDrawerExpanded] = React.useState(false);
79
+ const drawerRef = React.useRef<HTMLSpanElement>(null);
80
+
81
+ const onWizardExpand = () => {
82
+ drawerRef.current && drawerRef.current.focus();
83
+ };
79
84
 
80
85
  return (
81
- <Drawer isInline isExpanded={isDrawerExpanded}>
86
+ <Drawer isInline isExpanded={isDrawerExpanded} onExpand={onWizardExpand}>
82
87
  <DrawerContent
83
88
  panelContent={
84
89
  <DrawerPanelContent widths={{ default: 'width_33' }} colorVariant={DrawerColorVariant.light200}>
85
90
  <DrawerHead>
86
- <span tabIndex={isDrawerExpanded ? 0 : -1}>drawer content</span>
91
+ <span tabIndex={isDrawerExpanded ? 0 : -1} ref={drawerRef}>
92
+ drawer content
93
+ </span>
87
94
  <DrawerActions>
88
95
  <DrawerCloseButton onClick={() => setIsDrawerExpanded(false)} />
89
96
  </DrawerActions>