@patternfly/react-core 4.249.0 → 4.250.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 (190) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/esm/next/components/Select/Select.d.ts +28 -0
  3. package/dist/esm/next/components/Select/Select.d.ts.map +1 -0
  4. package/dist/esm/next/components/Select/Select.js +62 -0
  5. package/dist/esm/next/components/Select/Select.js.map +1 -0
  6. package/dist/esm/next/components/Select/SelectGroup.d.ts +12 -0
  7. package/dist/esm/next/components/Select/SelectGroup.d.ts.map +1 -0
  8. package/dist/esm/next/components/Select/SelectGroup.js +10 -0
  9. package/dist/esm/next/components/Select/SelectGroup.js.map +1 -0
  10. package/dist/esm/next/components/Select/SelectList.d.ts +10 -0
  11. package/dist/esm/next/components/Select/SelectList.d.ts.map +1 -0
  12. package/dist/esm/next/components/Select/SelectList.js +10 -0
  13. package/dist/esm/next/components/Select/SelectList.js.map +1 -0
  14. package/dist/esm/next/components/Select/SelectOption.d.ts +20 -0
  15. package/dist/esm/next/components/Select/SelectOption.d.ts.map +1 -0
  16. package/dist/esm/next/components/Select/SelectOption.js +10 -0
  17. package/dist/esm/next/components/Select/SelectOption.js.map +1 -0
  18. package/dist/esm/next/components/Select/index.d.ts +5 -0
  19. package/dist/esm/next/components/Select/index.d.ts.map +1 -0
  20. package/dist/esm/next/components/Select/index.js +5 -0
  21. package/dist/esm/next/components/Select/index.js.map +1 -0
  22. package/dist/esm/next/components/Wizard/Wizard.d.ts +9 -7
  23. package/dist/esm/next/components/Wizard/Wizard.d.ts.map +1 -1
  24. package/dist/esm/next/components/Wizard/Wizard.js +62 -48
  25. package/dist/esm/next/components/Wizard/Wizard.js.map +1 -1
  26. package/dist/esm/next/components/Wizard/WizardBody.d.ts +2 -2
  27. package/dist/esm/next/components/Wizard/WizardBody.d.ts.map +1 -1
  28. package/dist/esm/next/components/Wizard/WizardBody.js +1 -1
  29. package/dist/esm/next/components/Wizard/WizardBody.js.map +1 -1
  30. package/dist/esm/next/components/Wizard/WizardContext.d.ts +21 -20
  31. package/dist/esm/next/components/Wizard/WizardContext.d.ts.map +1 -1
  32. package/dist/esm/next/components/Wizard/WizardContext.js +63 -32
  33. package/dist/esm/next/components/Wizard/WizardContext.js.map +1 -1
  34. package/dist/esm/next/components/Wizard/WizardFooter.d.ts +20 -6
  35. package/dist/esm/next/components/Wizard/WizardFooter.d.ts.map +1 -1
  36. package/dist/esm/next/components/Wizard/WizardFooter.js +13 -4
  37. package/dist/esm/next/components/Wizard/WizardFooter.js.map +1 -1
  38. package/dist/esm/next/components/Wizard/WizardHeader.d.ts +1 -1
  39. package/dist/esm/next/components/Wizard/WizardHeader.d.ts.map +1 -1
  40. package/dist/esm/next/components/Wizard/WizardHeader.js +2 -2
  41. package/dist/esm/next/components/Wizard/WizardHeader.js.map +1 -1
  42. package/dist/esm/next/components/Wizard/WizardNav.d.ts +5 -5
  43. package/dist/esm/next/components/Wizard/WizardNav.d.ts.map +1 -1
  44. package/dist/esm/next/components/Wizard/WizardNav.js +3 -4
  45. package/dist/esm/next/components/Wizard/WizardNav.js.map +1 -1
  46. package/dist/esm/next/components/Wizard/WizardNavInternal.d.ts +14 -0
  47. package/dist/esm/next/components/Wizard/WizardNavInternal.d.ts.map +1 -0
  48. package/dist/esm/next/components/Wizard/WizardNavInternal.js +49 -0
  49. package/dist/esm/next/components/Wizard/WizardNavInternal.js.map +1 -0
  50. package/dist/esm/next/components/Wizard/WizardNavItem.d.ts +12 -8
  51. package/dist/esm/next/components/Wizard/WizardNavItem.d.ts.map +1 -1
  52. package/dist/esm/next/components/Wizard/WizardNavItem.js +23 -12
  53. package/dist/esm/next/components/Wizard/WizardNavItem.js.map +1 -1
  54. package/dist/esm/next/components/Wizard/WizardStep.d.ts +22 -6
  55. package/dist/esm/next/components/Wizard/WizardStep.d.ts.map +1 -1
  56. package/dist/esm/next/components/Wizard/WizardStep.js +20 -1
  57. package/dist/esm/next/components/Wizard/WizardStep.js.map +1 -1
  58. package/dist/esm/next/components/Wizard/WizardToggle.d.ts +9 -15
  59. package/dist/esm/next/components/Wizard/WizardToggle.d.ts.map +1 -1
  60. package/dist/esm/next/components/Wizard/WizardToggle.js +15 -50
  61. package/dist/esm/next/components/Wizard/WizardToggle.js.map +1 -1
  62. package/dist/esm/next/components/Wizard/hooks/useWizardFooter.d.ts +2 -2
  63. package/dist/esm/next/components/Wizard/hooks/useWizardFooter.d.ts.map +1 -1
  64. package/dist/esm/next/components/Wizard/hooks/useWizardFooter.js +3 -3
  65. package/dist/esm/next/components/Wizard/hooks/useWizardFooter.js.map +1 -1
  66. package/dist/esm/next/components/Wizard/types.d.ts +37 -46
  67. package/dist/esm/next/components/Wizard/types.d.ts.map +1 -1
  68. package/dist/esm/next/components/Wizard/types.js +10 -2
  69. package/dist/esm/next/components/Wizard/types.js.map +1 -1
  70. package/dist/esm/next/components/Wizard/utils.d.ts +4 -5
  71. package/dist/esm/next/components/Wizard/utils.d.ts.map +1 -1
  72. package/dist/esm/next/components/Wizard/utils.js +20 -13
  73. package/dist/esm/next/components/Wizard/utils.js.map +1 -1
  74. package/dist/esm/next/components/index.d.ts +2 -1
  75. package/dist/esm/next/components/index.d.ts.map +1 -1
  76. package/dist/esm/next/components/index.js +2 -1
  77. package/dist/esm/next/components/index.js.map +1 -1
  78. package/dist/js/next/components/Select/Select.d.ts +28 -0
  79. package/dist/js/next/components/Select/Select.d.ts.map +1 -0
  80. package/dist/js/next/components/Select/Select.js +65 -0
  81. package/dist/js/next/components/Select/Select.js.map +1 -0
  82. package/dist/js/next/components/Select/SelectGroup.d.ts +12 -0
  83. package/dist/js/next/components/Select/SelectGroup.d.ts.map +1 -0
  84. package/dist/js/next/components/Select/SelectGroup.js +14 -0
  85. package/dist/js/next/components/Select/SelectGroup.js.map +1 -0
  86. package/dist/js/next/components/Select/SelectList.d.ts +10 -0
  87. package/dist/js/next/components/Select/SelectList.d.ts.map +1 -0
  88. package/dist/js/next/components/Select/SelectList.js +14 -0
  89. package/dist/js/next/components/Select/SelectList.js.map +1 -0
  90. package/dist/js/next/components/Select/SelectOption.d.ts +20 -0
  91. package/dist/js/next/components/Select/SelectOption.d.ts.map +1 -0
  92. package/dist/js/next/components/Select/SelectOption.js +14 -0
  93. package/dist/js/next/components/Select/SelectOption.js.map +1 -0
  94. package/dist/js/next/components/Select/index.d.ts +5 -0
  95. package/dist/js/next/components/Select/index.d.ts.map +1 -0
  96. package/dist/js/next/components/Select/index.js +8 -0
  97. package/dist/js/next/components/Select/index.js.map +1 -0
  98. package/dist/js/next/components/Wizard/Wizard.d.ts +9 -7
  99. package/dist/js/next/components/Wizard/Wizard.d.ts.map +1 -1
  100. package/dist/js/next/components/Wizard/Wizard.js +59 -45
  101. package/dist/js/next/components/Wizard/Wizard.js.map +1 -1
  102. package/dist/js/next/components/Wizard/WizardBody.d.ts +2 -2
  103. package/dist/js/next/components/Wizard/WizardBody.d.ts.map +1 -1
  104. package/dist/js/next/components/Wizard/WizardBody.js +1 -1
  105. package/dist/js/next/components/Wizard/WizardBody.js.map +1 -1
  106. package/dist/js/next/components/Wizard/WizardContext.d.ts +21 -20
  107. package/dist/js/next/components/Wizard/WizardContext.d.ts.map +1 -1
  108. package/dist/js/next/components/Wizard/WizardContext.js +61 -30
  109. package/dist/js/next/components/Wizard/WizardContext.js.map +1 -1
  110. package/dist/js/next/components/Wizard/WizardFooter.d.ts +20 -6
  111. package/dist/js/next/components/Wizard/WizardFooter.d.ts.map +1 -1
  112. package/dist/js/next/components/Wizard/WizardFooter.js +15 -6
  113. package/dist/js/next/components/Wizard/WizardFooter.js.map +1 -1
  114. package/dist/js/next/components/Wizard/WizardHeader.d.ts +1 -1
  115. package/dist/js/next/components/Wizard/WizardHeader.d.ts.map +1 -1
  116. package/dist/js/next/components/Wizard/WizardHeader.js +2 -2
  117. package/dist/js/next/components/Wizard/WizardHeader.js.map +1 -1
  118. package/dist/js/next/components/Wizard/WizardNav.d.ts +5 -5
  119. package/dist/js/next/components/Wizard/WizardNav.d.ts.map +1 -1
  120. package/dist/js/next/components/Wizard/WizardNav.js +3 -4
  121. package/dist/js/next/components/Wizard/WizardNav.js.map +1 -1
  122. package/dist/js/next/components/Wizard/WizardNavInternal.d.ts +14 -0
  123. package/dist/js/next/components/Wizard/WizardNavInternal.d.ts.map +1 -0
  124. package/dist/js/next/components/Wizard/WizardNavInternal.js +54 -0
  125. package/dist/js/next/components/Wizard/WizardNavInternal.js.map +1 -0
  126. package/dist/js/next/components/Wizard/WizardNavItem.d.ts +12 -8
  127. package/dist/js/next/components/Wizard/WizardNavItem.d.ts.map +1 -1
  128. package/dist/js/next/components/Wizard/WizardNavItem.js +23 -12
  129. package/dist/js/next/components/Wizard/WizardNavItem.js.map +1 -1
  130. package/dist/js/next/components/Wizard/WizardStep.d.ts +22 -6
  131. package/dist/js/next/components/Wizard/WizardStep.d.ts.map +1 -1
  132. package/dist/js/next/components/Wizard/WizardStep.js +20 -1
  133. package/dist/js/next/components/Wizard/WizardStep.js.map +1 -1
  134. package/dist/js/next/components/Wizard/WizardToggle.d.ts +9 -15
  135. package/dist/js/next/components/Wizard/WizardToggle.d.ts.map +1 -1
  136. package/dist/js/next/components/Wizard/WizardToggle.js +15 -51
  137. package/dist/js/next/components/Wizard/WizardToggle.js.map +1 -1
  138. package/dist/js/next/components/Wizard/hooks/useWizardFooter.d.ts +2 -2
  139. package/dist/js/next/components/Wizard/hooks/useWizardFooter.d.ts.map +1 -1
  140. package/dist/js/next/components/Wizard/hooks/useWizardFooter.js +3 -3
  141. package/dist/js/next/components/Wizard/hooks/useWizardFooter.js.map +1 -1
  142. package/dist/js/next/components/Wizard/types.d.ts +37 -46
  143. package/dist/js/next/components/Wizard/types.d.ts.map +1 -1
  144. package/dist/js/next/components/Wizard/types.js +12 -3
  145. package/dist/js/next/components/Wizard/types.js.map +1 -1
  146. package/dist/js/next/components/Wizard/utils.d.ts +4 -5
  147. package/dist/js/next/components/Wizard/utils.d.ts.map +1 -1
  148. package/dist/js/next/components/Wizard/utils.js +24 -15
  149. package/dist/js/next/components/Wizard/utils.js.map +1 -1
  150. package/dist/js/next/components/index.d.ts +2 -1
  151. package/dist/js/next/components/index.d.ts.map +1 -1
  152. package/dist/js/next/components/index.js +2 -1
  153. package/dist/js/next/components/index.js.map +1 -1
  154. package/dist/umd/react-core.min.css +940 -940
  155. package/package.json +2 -2
  156. package/src/next/components/Select/Select.tsx +129 -0
  157. package/src/next/components/Select/SelectGroup.tsx +24 -0
  158. package/src/next/components/Select/SelectList.tsx +21 -0
  159. package/src/next/components/Select/SelectOption.tsx +31 -0
  160. package/src/next/components/Select/examples/Select.md +37 -0
  161. package/src/next/components/Select/examples/SelectBasic.tsx +54 -0
  162. package/src/next/components/Select/examples/SelectCheckbox.tsx +67 -0
  163. package/src/next/components/Select/examples/SelectGrouped.tsx +63 -0
  164. package/src/next/components/Select/examples/SelectMultiTypeahead.tsx +195 -0
  165. package/src/next/components/Select/examples/SelectTypeahead.tsx +191 -0
  166. package/src/next/components/Select/index.ts +4 -0
  167. package/src/next/components/Wizard/Wizard.tsx +107 -64
  168. package/src/next/components/Wizard/WizardBody.tsx +4 -4
  169. package/src/next/components/Wizard/WizardContext.tsx +117 -65
  170. package/src/next/components/Wizard/WizardFooter.tsx +39 -17
  171. package/src/next/components/Wizard/WizardHeader.tsx +6 -3
  172. package/src/next/components/Wizard/WizardNav.tsx +9 -10
  173. package/src/next/components/Wizard/WizardNavInternal.tsx +137 -0
  174. package/src/next/components/Wizard/WizardNavItem.tsx +47 -20
  175. package/src/next/components/Wizard/WizardStep.tsx +52 -7
  176. package/src/next/components/Wizard/WizardToggle.tsx +24 -142
  177. package/src/next/components/Wizard/__tests__/Wizard.test.tsx +10 -13
  178. package/src/next/components/Wizard/__tests__/WizardBody.test.tsx +3 -3
  179. package/src/next/components/Wizard/__tests__/WizardFooter.test.tsx +11 -14
  180. package/src/next/components/Wizard/__tests__/WizardStep.test.tsx +100 -0
  181. package/src/next/components/Wizard/__tests__/WizardToggle.test.tsx +4 -4
  182. package/src/next/components/Wizard/examples/Wizard.md +40 -15
  183. package/src/next/components/Wizard/examples/WizardBasic.tsx +2 -2
  184. package/src/next/components/Wizard/examples/WizardCustomNav.tsx +4 -4
  185. package/src/next/components/Wizard/examples/WizardKitchenSink.tsx +126 -60
  186. package/src/next/components/Wizard/hooks/__tests__/useWizardFooter.test.tsx +23 -34
  187. package/src/next/components/Wizard/hooks/useWizardFooter.tsx +5 -5
  188. package/src/next/components/Wizard/types.tsx +59 -53
  189. package/src/next/components/Wizard/utils.ts +25 -16
  190. package/src/next/components/index.ts +2 -1
@@ -1,34 +1,37 @@
1
1
  import React from 'react';
2
- import { WizardNavProps, WizardNavItemProps } from '../Wizard';
2
+ import { WizardNavProps, WizardNavItemProps, WizardFooterProps } from '../Wizard';
3
3
 
4
4
  /** Type used to define 'basic' steps, or in other words, steps that are neither parents or children of parents. */
5
5
  export interface WizardBasicStep {
6
- /** Name of the step's nav item */
6
+ /** Name of the step's navigation item */
7
7
  name: React.ReactNode;
8
8
  /** Unique identifier */
9
9
  id: string | number;
10
- /** Flag to disable the step's nav item */
10
+ /** Flag to disable the step's navigation item */
11
11
  isDisabled?: boolean;
12
12
  /** Flag to represent whether the step has been visited (navigated to) */
13
- visited?: boolean;
14
- /** Content shown when the step's nav item is selected. When treated as a parent step, only sub-step content will be shown. */
13
+ isVisited?: boolean;
14
+ /** Flag to determine whether the step is hidden */
15
+ isHidden?: boolean;
16
+ /** Content shown when the step's navigation item is selected. When treated as a parent step, only sub-step content will be shown. */
15
17
  component?: React.ReactElement;
16
- /** (Unused if nav is controlled) Custom WizardNavItem */
17
- navItem?: React.ReactElement<WizardNavItemProps>;
18
- /** (Unused if footer is controlled) Can change the Next button text. If nextButtonText is also set for the Wizard, this step specific one overrides it. */
19
- nextButtonText?: React.ReactNode;
20
- /** (Unused if footer is controlled) The condition needed to disable the Next button */
21
- disableNext?: boolean;
22
- /** (Unused if footer is controlled) True to hide the Cancel button */
23
- hideCancelButton?: boolean;
24
- /** (Unused if footer is controlled) True to hide the Back button */
25
- hideBackButton?: boolean;
18
+ /** Replaces the step's navigation item or its properties. */
19
+ navItem?: WizardNavItemType;
20
+ /** Replaces the step's footer. The step's footer takes precedance over the wizard's footer. */
21
+ footer?: React.ReactElement | Partial<WizardFooterProps>;
22
+ /** Used to determine icon next to the step's navItem */
23
+ status?: 'default' | 'error';
24
+ }
25
+
26
+ export enum WizardNavItemStatus {
27
+ Default = 'default',
28
+ Error = 'error'
26
29
  }
27
30
 
28
31
  /** Type used to define parent steps. */
29
32
  export interface WizardParentStep extends WizardBasicStep {
30
33
  /** Nested step IDs */
31
- subStepIds: string[];
34
+ subStepIds: (string | number)[];
32
35
  }
33
36
 
34
37
  /** Type used to define sub-steps. */
@@ -37,34 +40,6 @@ export interface WizardSubStep extends WizardBasicStep {
37
40
  parentId: string | number;
38
41
  }
39
42
 
40
- /** Used to customize aspects of the Wizard's default navigation. */
41
- export interface DefaultWizardNavProps {
42
- /** Flag indicating nav items with sub steps are expandable */
43
- isExpandable?: boolean;
44
- /** Aria-label for the Nav */
45
- ariaLabel?: string;
46
- /** Sets aria-labelledby on nav element */
47
- ariaLabelledBy?: string;
48
- /** Disable step nav items until they are visited */
49
- forceStepVisit?: boolean;
50
- }
51
-
52
- /** Used to customize aspects of the Wizard's default footer. */
53
- export interface DefaultWizardFooterProps {
54
- /** The Next button text */
55
- nextButtonText?: React.ReactNode;
56
- /** The Back button text */
57
- backButtonText?: React.ReactNode;
58
- /** The Cancel button text */
59
- cancelButtonText?: React.ReactNode;
60
- /** Next button callback */
61
- onNext?: () => WizardNavStepFunction | void;
62
- /** Back button callback */
63
- onBack?: () => WizardNavStepFunction | void;
64
- /** Cancel link callback */
65
- onClose?: () => void;
66
- }
67
-
68
43
  /** Encompasses all step type variants that are internally controlled by the Wizard. */
69
44
  export type WizardControlStep = WizardBasicStep | WizardParentStep | WizardSubStep;
70
45
 
@@ -72,26 +47,57 @@ export type WizardControlStep = WizardBasicStep | WizardParentStep | WizardSubSt
72
47
  export type WizardNavStepFunction = (currentStep: WizardNavStepData, previousStep: WizardNavStepData) => void;
73
48
 
74
49
  /** Data returned for either parameter of WizardNavStepFunction. */
75
- export type WizardNavStepData = Pick<WizardControlStep, 'id' | 'name'>;
50
+ export interface WizardNavStepData {
51
+ /** Unique identifier */
52
+ id: string | number;
53
+ /** Name of the step */
54
+ name: string;
55
+ /** Index of the step (starts at 1) */
56
+ index: number;
57
+ }
58
+
59
+ export type WizardFooterType = Partial<WizardFooterProps> | CustomWizardFooterFunction | React.ReactElement;
60
+ export type WizardNavType = Partial<WizardNavProps> | CustomWizardNavFunction | React.ReactElement;
61
+ export type WizardNavItemType = Partial<WizardNavItemProps> | CustomWizardNavItemFunction | React.ReactElement;
76
62
 
77
63
  /** Callback for the Wizard's 'nav' property. Returns element which replaces the Wizard's default navigation. */
78
64
  export type CustomWizardNavFunction = (
79
65
  isExpanded: boolean,
80
66
  steps: WizardControlStep[],
81
- activeStep: WizardControlStep,
67
+ currentStep: WizardControlStep,
82
68
  goToStepByIndex: (index: number) => void
83
69
  ) => React.ReactElement<WizardNavProps>;
84
70
 
85
- export function isCustomWizardNav(
86
- nav: DefaultWizardNavProps | CustomWizardNavFunction
87
- ): nav is CustomWizardNavFunction {
88
- return typeof nav === 'function';
71
+ /** Callback for the Wizard's 'navItem' property. Returns element which replaces the WizardStep's default navigation item. */
72
+ export type CustomWizardNavItemFunction = (
73
+ step: WizardControlStep,
74
+ currentStep: WizardControlStep,
75
+ steps: WizardControlStep[],
76
+ goToStepByIndex: (index: number) => void
77
+ ) => React.ReactElement<WizardNavItemProps>;
78
+
79
+ /** Callback for the Wizard's 'footer' property. Returns element which replaces the Wizard's default footer. */
80
+ export type CustomWizardFooterFunction = (
81
+ currentStep: WizardControlStep,
82
+ onNext: () => void,
83
+ onBack: () => void,
84
+ onClose: () => void
85
+ ) => React.ReactElement<WizardFooterProps>;
86
+
87
+ export function isCustomWizardNav(nav: WizardNavType): nav is CustomWizardNavFunction | React.ReactElement {
88
+ return typeof nav === 'function' || React.isValidElement(nav);
89
+ }
90
+
91
+ export function isCustomWizardNavItem(
92
+ navItem: WizardNavItemType
93
+ ): navItem is CustomWizardNavItemFunction | React.ReactElement {
94
+ return typeof navItem === 'function' || React.isValidElement(navItem);
89
95
  }
90
96
 
91
97
  export function isCustomWizardFooter(
92
- footer: DefaultWizardFooterProps | React.ReactElement
93
- ): footer is React.ReactElement {
94
- return React.isValidElement(footer);
98
+ footer: WizardFooterType
99
+ ): footer is CustomWizardFooterFunction | React.ReactElement {
100
+ return typeof footer === 'function' || React.isValidElement(footer);
95
101
  }
96
102
 
97
103
  export function isWizardBasicStep(step: WizardControlStep): step is WizardBasicStep {
@@ -3,32 +3,23 @@ import React from 'react';
3
3
  import { WizardControlStep, WizardNavStepData } from './types';
4
4
  import { WizardStep, WizardStepProps } from './WizardStep';
5
5
 
6
- function hasWizardStepProps(props: WizardStepProps | any): props is WizardStepProps {
7
- return props.name !== undefined && props.id !== undefined;
8
- }
9
-
10
6
  /**
11
7
  * Accumulate list of step & sub-step props pulled from child components
12
8
  * @param children
13
9
  * @returns WizardControlStep[]
14
10
  */
15
11
  export const buildSteps = (children: React.ReactElement<WizardStepProps> | React.ReactElement<WizardStepProps>[]) =>
16
- React.Children.toArray(children).reduce((acc: WizardControlStep[], child) => {
17
- if (React.isValidElement(child) && (child.type === WizardStep || hasWizardStepProps(child.props))) {
18
- // Omit "children" and use the whole "child" (WizardStep) for the component prop. Sub-steps will do the same.
19
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
20
- const { steps: subSteps, id, children, ...stepProps } = child.props as WizardStepProps;
12
+ React.Children.toArray(children).reduce((acc: WizardControlStep[], child: React.ReactChild | React.ReactFragment) => {
13
+ if (isWizardStep(child)) {
14
+ const { steps: subSteps, id } = child.props;
21
15
 
22
16
  acc.push({
23
- id,
24
17
  component: child,
25
- ...stepProps,
18
+ ...normalizeStep(child.props),
26
19
  ...(subSteps && {
27
20
  subStepIds: subSteps?.map(subStep => {
28
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
29
- const { children, ...subStepProps } = subStep.props;
30
21
  acc.push({
31
- ...subStepProps,
22
+ ...normalizeStep(subStep.props),
32
23
  component: subStep,
33
24
  parentId: id
34
25
  });
@@ -44,6 +35,24 @@ export const buildSteps = (children: React.ReactElement<WizardStepProps> | React
44
35
  return acc;
45
36
  }, []);
46
37
 
47
- export const normalizeNavStep = ({ id, name }: WizardNavStepData) => ({ id, name });
48
- export const getActiveStep = (steps: WizardControlStep[], currentStepIndex: number) =>
38
+ export function isWizardStep(
39
+ child: any | React.ReactElement<WizardStepProps>
40
+ ): child is React.ReactElement<WizardStepProps> {
41
+ return (
42
+ (React.isValidElement(child) && (child as React.ReactElement<WizardStepProps>).type === WizardStep) ||
43
+ (child.props?.name !== undefined && child.props?.id !== undefined)
44
+ );
45
+ }
46
+
47
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
48
+ export const normalizeStep = ({ children, steps, body, ...controlStep }: WizardStepProps): WizardControlStep =>
49
+ controlStep;
50
+
51
+ export const normalizeNavStep = (navStep: WizardControlStep, steps: WizardControlStep[]): WizardNavStepData => ({
52
+ id: navStep.id,
53
+ name: navStep.name.toString(),
54
+ index: steps.indexOf(navStep) + 1
55
+ });
56
+
57
+ export const getCurrentStep = (steps: WizardControlStep[], currentStepIndex: number) =>
49
58
  steps.find((_, index) => index + 1 === currentStepIndex);
@@ -1,2 +1,3 @@
1
- export * from './Wizard';
2
1
  export * from './Dropdown';
2
+ export * from './Select';
3
+ export * from './Wizard';