@onewelcome/react-lib-components 5.0.0 → 5.2.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 (83) hide show
  1. package/dist/cjs/Button/Button.module.cjs.js +1 -1
  2. package/dist/cjs/Button/IconButton.module.cjs.js +1 -1
  3. package/dist/cjs/DataGrid/DataGridActions/DataGridColumnsToggle.cjs.js +1 -1
  4. package/dist/cjs/DataGrid/DataGridActions/DataGridColumnsToggle.cjs.js.map +1 -1
  5. package/dist/cjs/Form/Radio/Radio.cjs.js.map +1 -1
  6. package/dist/cjs/Form/Select/Option.cjs.js +1 -1
  7. package/dist/cjs/Form/Select/Option.cjs.js.map +1 -1
  8. package/dist/cjs/Icon/Icon.module.cjs.js +1 -1
  9. package/dist/cjs/Link/Link.module.cjs.js +1 -1
  10. package/dist/cjs/Notifications/BaseModal/BaseModal.cjs.js +1 -1
  11. package/dist/cjs/Notifications/BaseModal/BaseModal.cjs.js.map +1 -1
  12. package/dist/cjs/Notifications/BaseModal/useRepeatFocus.cjs.js +2 -0
  13. package/dist/cjs/Notifications/BaseModal/useRepeatFocus.cjs.js.map +1 -0
  14. package/dist/cjs/Stepper/Step.cjs.js +1 -1
  15. package/dist/cjs/Stepper/Step.cjs.js.map +1 -1
  16. package/dist/cjs/Stepper/Step.module.cjs.js +1 -1
  17. package/dist/cjs/Stepper/Stepper.cjs.js +1 -1
  18. package/dist/cjs/Stepper/Stepper.cjs.js.map +1 -1
  19. package/dist/cjs/Stepper/Stepper.module.cjs.js +1 -1
  20. package/dist/cjs/Tooltip/Tooltip.cjs.js +1 -1
  21. package/dist/cjs/Tooltip/Tooltip.cjs.js.map +1 -1
  22. package/dist/cjs/Wizard/Wizard.cjs.js.map +1 -1
  23. package/dist/cjs/Wizard/WizardActions/WizardActions.cjs.js.map +1 -1
  24. package/dist/cjs/Wizard/WizardStateProvider.cjs.js.map +1 -1
  25. package/dist/cjs/Wizard/WizardSteps/WizardSteps.cjs.js.map +1 -1
  26. package/dist/cjs/src/components/Notifications/BaseModal/useRepeatFocus.d.ts +7 -0
  27. package/dist/cjs/src/components/Stepper/Step.d.ts +5 -3
  28. package/dist/cjs/src/components/Stepper/Stepper.d.ts +3 -1
  29. package/dist/cjs/src/components/Wizard/WizardActions/WizardActions.d.ts +3 -0
  30. package/dist/cjs/src/components/Wizard/WizardStateProvider.d.ts +3 -0
  31. package/dist/cjs/src/components/Wizard/WizardSteps/WizardSteps.d.ts +3 -0
  32. package/dist/cjs/src/index.d.ts +1 -0
  33. package/dist/esm/Button/Button.module.esm.js +1 -1
  34. package/dist/esm/Button/IconButton.module.esm.js +1 -1
  35. package/dist/esm/DataGrid/DataGridActions/DataGridColumnsToggle.esm.js +1 -1
  36. package/dist/esm/DataGrid/DataGridActions/DataGridColumnsToggle.esm.js.map +1 -1
  37. package/dist/esm/Form/Radio/Radio.esm.js.map +1 -1
  38. package/dist/esm/Form/Select/Option.esm.js +1 -1
  39. package/dist/esm/Form/Select/Option.esm.js.map +1 -1
  40. package/dist/esm/Icon/Icon.module.esm.js +1 -1
  41. package/dist/esm/Link/Link.module.esm.js +1 -1
  42. package/dist/esm/Notifications/BaseModal/BaseModal.esm.js +1 -1
  43. package/dist/esm/Notifications/BaseModal/BaseModal.esm.js.map +1 -1
  44. package/dist/esm/Notifications/BaseModal/useRepeatFocus.esm.js +2 -0
  45. package/dist/esm/Notifications/BaseModal/useRepeatFocus.esm.js.map +1 -0
  46. package/dist/esm/Stepper/Step.esm.js +1 -1
  47. package/dist/esm/Stepper/Step.esm.js.map +1 -1
  48. package/dist/esm/Stepper/Step.module.esm.js +1 -1
  49. package/dist/esm/Stepper/Stepper.esm.js +1 -1
  50. package/dist/esm/Stepper/Stepper.esm.js.map +1 -1
  51. package/dist/esm/Stepper/Stepper.module.esm.js +1 -1
  52. package/dist/esm/Tooltip/Tooltip.esm.js +1 -1
  53. package/dist/esm/Tooltip/Tooltip.esm.js.map +1 -1
  54. package/dist/esm/Wizard/Wizard.esm.js.map +1 -1
  55. package/dist/esm/Wizard/WizardActions/WizardActions.esm.js.map +1 -1
  56. package/dist/esm/Wizard/WizardStateProvider.esm.js.map +1 -1
  57. package/dist/esm/Wizard/WizardSteps/WizardSteps.esm.js.map +1 -1
  58. package/dist/esm/src/components/Notifications/BaseModal/useRepeatFocus.d.ts +7 -0
  59. package/dist/esm/src/components/Stepper/Step.d.ts +5 -3
  60. package/dist/esm/src/components/Stepper/Stepper.d.ts +3 -1
  61. package/dist/esm/src/components/Wizard/WizardActions/WizardActions.d.ts +3 -0
  62. package/dist/esm/src/components/Wizard/WizardStateProvider.d.ts +3 -0
  63. package/dist/esm/src/components/Wizard/WizardSteps/WizardSteps.d.ts +3 -0
  64. package/dist/esm/src/index.d.ts +1 -0
  65. package/package.json +2 -1
  66. package/src/components/DataGrid/DataGridActions/DataGridColumnsToggle.tsx +5 -1
  67. package/src/components/Form/Radio/Radio.tsx +3 -1
  68. package/src/components/Form/Select/Option.tsx +1 -1
  69. package/src/components/Notifications/BaseModal/BaseModal.test.tsx +36 -1
  70. package/src/components/Notifications/BaseModal/BaseModal.tsx +10 -3
  71. package/src/components/Notifications/BaseModal/useRepeatFocus.tsx +73 -0
  72. package/src/components/Stepper/Step.module.scss +129 -59
  73. package/src/components/Stepper/Step.tsx +57 -54
  74. package/src/components/Stepper/Stepper.module.scss +12 -8
  75. package/src/components/Stepper/Stepper.test.tsx +3 -3
  76. package/src/components/Stepper/Stepper.tsx +17 -7
  77. package/src/components/Tooltip/Tooltip.tsx +2 -2
  78. package/src/components/Wizard/Wizard.tsx +3 -0
  79. package/src/components/Wizard/WizardActions/WizardActions.tsx +3 -0
  80. package/src/components/Wizard/WizardStateProvider.tsx +3 -0
  81. package/src/components/Wizard/WizardSteps/WizardSteps.tsx +3 -0
  82. package/src/index.ts +1 -0
  83. package/src/mixins.module.scss +1 -0
@@ -17,7 +17,7 @@
17
17
  @use "../../mixins.module.scss";
18
18
 
19
19
  @mixin stepState($status: "waiting") {
20
- & .step-content .step {
20
+ & .step {
21
21
  color: var(--stepper-default-text-color);
22
22
 
23
23
  @if $status == "current" {
@@ -34,16 +34,14 @@
34
34
  }
35
35
  }
36
36
 
37
- &:not(:last-child)::after {
38
- @if $status == "current" or $status == "error" {
39
- border-color: var(--stepper-line-color);
40
- } @else if $status == "done" {
41
- border-color: var(--stepper-line-bold-color);
37
+ & .stepper-line {
38
+ @if $status == "done" {
39
+ background-color: var(--stepper-line-bold-color);
42
40
  }
43
41
  }
44
42
 
45
43
  &:hover {
46
- & .step-content .step {
44
+ & .step {
47
45
  @if $status == "current" {
48
46
  border-color: var(--stepper-current-hover-color);
49
47
  background-color: var(--stepper-current-hover-color);
@@ -61,7 +59,7 @@
61
59
  }
62
60
 
63
61
  &:active {
64
- & .step-content .step {
62
+ & .step {
65
63
  @if $status == "current" {
66
64
  border-color: var(--stepper-current-active-color);
67
65
  background-color: var(--stepper-current-active-color);
@@ -78,10 +76,11 @@
78
76
  }
79
77
  }
80
78
 
81
- &:disabled {
79
+ &.disabled {
82
80
  cursor: not-allowed;
83
81
 
84
- & .step-content .step {
82
+ & .step {
83
+ cursor: not-allowed;
85
84
  @if $status == "current" {
86
85
  border-color: var(--stepper-current-disabled-color);
87
86
  background-color: var(--stepper-current-disabled-color);
@@ -97,7 +96,8 @@
97
96
  }
98
97
  }
99
98
 
100
- & .step-content .label {
99
+ & .label {
100
+ cursor: not-allowed;
101
101
  color: var(--stepper-label-disabled-color);
102
102
 
103
103
  & .caption {
@@ -108,8 +108,8 @@
108
108
  );
109
109
  }
110
110
  }
111
- &:not(:last-child)::after {
112
- border-color: if(
111
+ & .stepper-line {
112
+ background-color: if(
113
113
  $status == "done",
114
114
  var(--stepper-line-bold-disabled-color),
115
115
  var(--stepper-line-disabled-color)
@@ -119,57 +119,110 @@
119
119
  }
120
120
 
121
121
  .step-wrapper {
122
- display: flex;
123
- flex: 1;
124
- flex-direction: row;
125
- justify-content: center;
126
- align-items: center;
122
+ pointer-events: none; //turn off pointer-events beside .label and .step where we turn it on
123
+ display: grid;
124
+ gap: 0.5rem;
125
+ grid-template-columns: 1.875rem 1fr;
126
+ grid-template-rows: auto 1fr;
127
127
  background-color: transparent;
128
128
  border: 0;
129
129
  padding: 0;
130
130
  margin: 0;
131
- cursor: pointer;
132
131
 
133
- @include mixins.focusVisibleOutline($outlineOffset: 0px);
132
+ &.horizontal {
133
+ grid-template-columns: 1.875rem auto 1fr;
134
+ grid-template-rows: auto 1fr;
135
+ align-items: start;
136
+ width: 100%;
134
137
 
135
- .step-content {
136
- display: flex;
137
- justify-content: center;
138
- align-items: center;
139
- }
138
+ .stepper-line {
139
+ background-color: var(--stepper-line-color);
140
+ min-height: auto;
141
+ height: 2px;
142
+ width: 100%;
143
+ min-width: 1rem;
144
+ border-radius: 2px;
145
+ margin-top: 0.8125rem;
146
+ }
140
147
 
141
- &:last-child {
142
- flex-grow: 0;
143
- flex-basis: fit-content;
144
- }
148
+ .label {
149
+ margin-top: 0.25rem;
150
+ }
145
151
 
146
- &:not(:last-child)::after {
147
- content: "";
148
- margin: 0 0.5rem;
149
- flex-grow: 1;
150
- min-width: 0.5rem;
151
- border-bottom: 2px solid var(--stepper-line-color);
152
- }
152
+ &.text-bottom {
153
+ grid-template-columns: 5rem 1fr;
154
+ gap: 0;
155
+
156
+ .step {
157
+ justify-self: center;
158
+ }
159
+
160
+ .label {
161
+ justify-self: center;
162
+ text-align: center;
163
+ grid-column-start: 1;
164
+ grid-column-end: 1;
165
+ grid-row-start: 2;
166
+ grid-row-end: 2;
167
+ }
168
+
169
+ .stepper-line {
170
+ margin-right: -1.125rem;
171
+ margin-left: -1.125rem;
172
+ width: calc(100% + 2.25rem);
173
+ }
174
+
175
+ .label-inner-wrapper {
176
+ display: inline;
177
+ }
178
+
179
+ &.last-step {
180
+ justify-content: center;
181
+ grid-template-columns: 5rem;
182
+ grid-template-rows: auto 1fr;
183
+ flex: 1 0 5rem;
184
+ display: grid;
153
185
 
154
- &.vertical {
155
- display: flex;
156
- flex-direction: column;
157
- flex-grow: 1;
186
+ .label {
187
+ width: auto;
188
+ }
189
+ }
190
+ }
191
+
192
+ &.last-step {
193
+ display: flex;
194
+ width: max-content;
158
195
 
159
- &:last-child {
160
- flex-grow: 0;
161
- flex-basis: fit-content;
196
+ .label {
197
+ width: max-content;
198
+ }
162
199
  }
163
200
 
164
- &:not(:last-child)::after {
165
- content: "";
166
- border-bottom: none;
167
- margin: 0.5rem 0 0.5rem 1.6875rem;
168
- border-left: 2px solid var(--stepper-line-color);
169
- min-height: 0.5rem;
170
- height: 100%;
171
- width: 100%;
201
+ .label-inner-wrapper {
202
+ display: flex;
172
203
  }
204
+
205
+ .stepper-line-extender {
206
+ display: block;
207
+ flex: 1;
208
+ margin-left: 0.4375rem;
209
+ margin-right: -1rem;
210
+ margin-top: 0.5625rem;
211
+ }
212
+ }
213
+
214
+ .stepper-line {
215
+ pointer-events: none;
216
+ justify-self: center;
217
+ background-color: var(--stepper-line-color);
218
+ min-height: 0.375rem; //on design pixes used in rounding does not count, so that's why it's not 4px but 6px
219
+ height: 100%;
220
+ width: 2px;
221
+ border-radius: 2px;
222
+ }
223
+
224
+ &.vertical.has-caption .stepper-line {
225
+ min-height: 1.375rem; //on design pixes used in rounding does not count, so that's why it's not 20px but 22px
173
226
  }
174
227
 
175
228
  &.waiting {
@@ -179,7 +232,7 @@
179
232
  &.current {
180
233
  @include stepState($status: "current");
181
234
 
182
- & .step-content .label {
235
+ & .label {
183
236
  font-weight: 700;
184
237
  & .caption {
185
238
  font-weight: 400;
@@ -194,13 +247,15 @@
194
247
  &.error {
195
248
  @include stepState($status: "error");
196
249
 
197
- & .step-content .label .caption {
250
+ & .label .caption {
198
251
  color: var(--stepper-caption-error-color);
199
252
  }
200
253
  }
201
254
  }
202
255
 
203
256
  .step {
257
+ pointer-events: visible;
258
+ cursor: pointer;
204
259
  flex-shrink: 0;
205
260
  box-sizing: border-box;
206
261
  display: flex;
@@ -216,16 +271,31 @@
216
271
  }
217
272
 
218
273
  .label {
219
- flex-shrink: 0;
220
- position: relative;
221
- margin-left: 0.5rem;
274
+ pointer-events: visible;
275
+ cursor: pointer;
276
+ grid-column-start: 2;
277
+ grid-column-end: 2;
278
+ grid-row-start: 1;
279
+ grid-row-end: span 2;
280
+ align-self: start;
281
+
282
+ margin: 0.25rem 0 0;
283
+ padding: 0;
284
+ background-color: initial;
285
+ border: none;
286
+ text-align: left;
222
287
  color: var(--stepper-label-color);
288
+ font-family: var(--font-family);
289
+ font-size: var(--font-size-form-label);
290
+ line-height: 1.25rem;
291
+
292
+ @include mixins.focusVisibleOutline($outlineOffset: "1px");
223
293
  }
224
294
 
225
295
  .caption {
226
- position: absolute;
227
- top: 1.25rem;
228
- left: 0;
296
+ display: block;
229
297
  color: var(--stepper-caption-color);
298
+ font-family: var(--font-family);
230
299
  font-size: 0.75rem;
300
+ line-height: 1rem;
231
301
  }
@@ -14,19 +14,14 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import React, {
18
- ComponentPropsWithRef,
19
- ForwardRefRenderFunction,
20
- useLayoutEffect,
21
- useRef,
22
- useState
23
- } from "react";
17
+ import React, { CSSProperties, ComponentPropsWithRef, ForwardRefRenderFunction } from "react";
24
18
  import { Icon, Icons } from "../Icon/Icon";
25
19
  import classes from "./Step.module.scss";
20
+ import { gapBetweenStepsInRem } from "./Stepper";
26
21
 
27
22
  export type StepStatus = "waiting" | "current" | "done" | "error";
28
23
 
29
- export interface Props extends ComponentPropsWithRef<"button"> {
24
+ export interface Props extends Omit<ComponentPropsWithRef<"div">, "onClick"> {
30
25
  status: StepStatus;
31
26
  label: string;
32
27
  caption?: string;
@@ -34,6 +29,8 @@ export interface Props extends ComponentPropsWithRef<"button"> {
34
29
  lastStep?: boolean;
35
30
  disabled?: boolean;
36
31
  direction?: "horizontal" | "vertical";
32
+ textPosition?: "bottom" | "right";
33
+ onClick?: (event: React.MouseEvent<HTMLButtonElement | HTMLDivElement>) => void;
37
34
  }
38
35
 
39
36
  const getStepContent = (index: number, status: StepStatus) => {
@@ -49,63 +46,69 @@ const getStepContent = (index: number, status: StepStatus) => {
49
46
  }
50
47
  };
51
48
 
52
- export const StepComponent: ForwardRefRenderFunction<HTMLButtonElement, Props> = (
53
- { label, caption, status, index, direction, disabled, lastStep, ...rest }: Props,
49
+ const getStepMaxWidth = (isHorizontal: boolean, lastStep: boolean, index: number) => {
50
+ if (isHorizontal && lastStep) {
51
+ const percentage = 100 / (index + 1);
52
+ const gapSize = index * gapBetweenStepsInRem;
53
+ return `calc(${percentage}% - ${gapSize}rem)`;
54
+ }
55
+ };
56
+
57
+ export const StepComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (
58
+ {
59
+ label,
60
+ caption,
61
+ status,
62
+ index,
63
+ direction,
64
+ disabled,
65
+ lastStep,
66
+ onClick,
67
+ textPosition,
68
+ ...rest
69
+ }: Props,
54
70
  ref
55
71
  ) => {
56
72
  const stepIndex = index ?? 0;
57
73
  const additionalClasses = [classes[status]];
58
- const [stepContentHeight, setStepContentHeight] = useState<number>(28);
59
- const [stepContentWidth, setStepContentWidth] = useState<number>(28);
60
- direction === "vertical" && additionalClasses.push(classes["vertical"]);
61
-
62
- const captionRef = useRef<HTMLSpanElement>(null);
63
- const labelRef = useRef<HTMLSpanElement>(null);
64
- const stepContentRef = useRef<HTMLDivElement>(null);
74
+ const additionalStyles: CSSProperties = {};
75
+ const isHorizontal = direction === "horizontal";
76
+ const isTextBottom = textPosition === "bottom";
77
+ const hasCaption = !!caption;
65
78
 
66
- useLayoutEffect(() => {
67
- if (captionRef.current && stepContentRef.current && labelRef.current && lastStep) {
68
- if (direction == "vertical") {
69
- const capionHeight = captionRef.current.getBoundingClientRect().height;
70
- const stepContentHeight = stepContentRef.current.getBoundingClientRect().height;
71
- setStepContentHeight(capionHeight + stepContentHeight);
72
- }
79
+ additionalClasses.push(isHorizontal ? classes["horizontal"] : classes["vertical"]);
80
+ disabled && additionalClasses.push(classes["disabled"]);
81
+ isTextBottom && additionalClasses.push(classes["text-bottom"]);
82
+ lastStep && additionalClasses.push(classes["last-step"]);
83
+ hasCaption && additionalClasses.push(classes["has-caption"]);
73
84
 
74
- if (direction == "horizontal") {
75
- const captionWidth = captionRef.current.getBoundingClientRect().width;
76
- const labelWidth = labelRef.current.getBoundingClientRect().width;
77
- setStepContentWidth(captionWidth > labelWidth ? captionWidth + 36 : labelWidth + 36);
78
- }
79
- }
80
- }, []);
85
+ additionalStyles["maxWidth"] = getStepMaxWidth(isHorizontal, !!lastStep, index!);
81
86
 
82
87
  return (
83
- <button
84
- {...rest}
85
- ref={ref}
86
- disabled={disabled}
87
- aria-current={status === "current" ? "step" : undefined}
88
+ <div
89
+ style={additionalStyles}
88
90
  className={`${classes["step-wrapper"]} ${additionalClasses.join(" ")}`}
91
+ {...rest}
89
92
  >
90
- <div
91
- style={{
92
- height: lastStep && direction == "vertical" ? `${stepContentHeight}px` : "auto",
93
- width: lastStep && direction == "horizontal" ? `${stepContentWidth}px` : "auto"
94
- }}
95
- >
96
- <div ref={stepContentRef} className={classes["step-content"]}>
97
- <div aria-hidden className={classes["step"]}>
98
- {getStepContent(stepIndex, status)}
99
- </div>
100
- <span ref={labelRef} className={classes["label"]}>
101
- {label}
102
- <span ref={captionRef} className={classes["caption"]}>
103
- {caption}
104
- </span>
105
- </span>
106
- </div>
93
+ <div aria-hidden className={classes["step"]} onClick={onClick}>
94
+ {getStepContent(stepIndex, status)}
107
95
  </div>
108
- </button>
96
+ <button
97
+ aria-current={status === "current" ? "step" : undefined}
98
+ className={classes["label"]}
99
+ disabled={disabled}
100
+ onClick={onClick}
101
+ >
102
+ <span className={classes["label-inner-wrapper"]}>
103
+ {label}{" "}
104
+ {!lastStep && isHorizontal && !isTextBottom && (
105
+ <div className={`${classes["stepper-line"]} ${classes["stepper-line-extender"]}`}></div>
106
+ )}
107
+ </span>
108
+ <span className={classes["caption"]}>{caption}</span>
109
+ </button>
110
+ {!lastStep && <div className={classes["stepper-line"]}></div>}
111
+ </div>
109
112
  );
110
113
  };
111
114
 
@@ -1,13 +1,17 @@
1
1
  .stepper {
2
- width: 100%;
3
2
  display: flex;
4
- justify-content: center;
5
- align-items: center;
3
+ gap: 0.5rem;
4
+ justify-content: flex-start;
5
+ width: auto;
6
+ flex-direction: column;
6
7
 
7
- &.vertical {
8
- flex-direction: column;
9
- justify-content: flex-start;
10
- height: 100%;
11
- width: auto;
8
+ &.horizontal {
9
+ justify-content: center;
10
+ flex-direction: row;
11
+ width: 100%;
12
+
13
+ &.text-bottom {
14
+ gap: 0;
15
+ }
12
16
  }
13
17
  }
@@ -62,13 +62,13 @@ describe("<Stepper/> should render", () => {
62
62
  });
63
63
 
64
64
  it("should render the horizontal stepper", () => {
65
- const { StepperComponent, getAllByText } = createStepper(params => ({
65
+ const { StepperComponent } = createStepper(params => ({
66
66
  ...params,
67
67
  direction: "horizontal"
68
68
  }));
69
69
 
70
70
  expect(StepperComponent).toBeDefined();
71
- expect(StepperComponent.classList.contains("horizontal")).toBe(true);
71
+ expect(StepperComponent.classList).toContain("horizontal");
72
72
  });
73
73
 
74
74
  it("should render the vertical stepper", () => {
@@ -78,6 +78,6 @@ describe("<Stepper/> should render", () => {
78
78
  }));
79
79
 
80
80
  expect(StepperComponent).toBeDefined();
81
- expect(StepperComponent.classList.contains("vertical")).toBe(true);
81
+ expect(StepperComponent.classList).not.toContain("horizontal");
82
82
  });
83
83
  });
@@ -21,16 +21,25 @@ import classes from "./Stepper.module.scss";
21
21
  export interface Props extends ComponentPropsWithRef<"div"> {
22
22
  steps: StepProps[];
23
23
  direction: "horizontal" | "vertical";
24
+ textPosition?: "bottom" | "right";
24
25
  }
25
26
 
26
- export const Stepper = ({ steps, direction = "horizontal", ...rest }: Props) => {
27
+ export const gapBetweenStepsInRem = 0.5;
28
+
29
+ export const Stepper = ({
30
+ steps,
31
+ direction = "horizontal",
32
+ textPosition,
33
+ className,
34
+ ...rest
35
+ }: Props) => {
36
+ const additionalClasses = [];
37
+ direction === "horizontal" && additionalClasses.push(classes["horizontal"]);
38
+ textPosition === "bottom" && additionalClasses.push(classes["text-bottom"]);
39
+ className && additionalClasses.push(className);
40
+
27
41
  return (
28
- <div
29
- {...rest}
30
- className={`${classes["stepper"]} ${
31
- direction === "horizontal" ? classes["horizontal"] : classes["vertical"]
32
- }`}
33
- >
42
+ <div {...rest} className={`${classes["stepper"]} ${additionalClasses.join(" ")}`}>
34
43
  {steps.map((step, index) => (
35
44
  <Step
36
45
  {...step}
@@ -38,6 +47,7 @@ export const Stepper = ({ steps, direction = "horizontal", ...rest }: Props) =>
38
47
  index={index}
39
48
  direction={direction}
40
49
  lastStep={index + 1 === steps.length}
50
+ textPosition={textPosition}
41
51
  />
42
52
  ))}
43
53
  </div>
@@ -157,11 +157,11 @@ const TooltipComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (
157
157
  useEffect(() => {
158
158
  if (!visible) return;
159
159
 
160
- function escapePressHandler(event: KeyboardEvent) {
160
+ const escapePressHandler = (event: KeyboardEvent) => {
161
161
  if (event.key === "Escape") {
162
162
  setVisible(false);
163
163
  }
164
- }
164
+ };
165
165
 
166
166
  document.addEventListener("keyup", escapePressHandler);
167
167
 
@@ -47,6 +47,9 @@ const useStepChanging = (onStepChange: (stepNo: number) => void) => {
47
47
  }, [currentStepNo]);
48
48
  };
49
49
 
50
+ /**
51
+ * @deprecated
52
+ */
50
53
  const WizardContent = ({ steps, mode, onStepChange, children }: Props) => {
51
54
  useSetWizardState(steps, mode);
52
55
  useStepChanging(onStepChange);
@@ -61,6 +61,9 @@ const useNextStepNo = (mode: WizardMode, currentStepNo: number, steps: Step[]) =
61
61
  const usePreviousStepNo = (mode: WizardMode, currentStepNo: number, steps: Step[]) =>
62
62
  useMemo(calculatePrevStepNo(steps, currentStepNo), [mode, currentStepNo, steps]);
63
63
 
64
+ /**
65
+ * @deprecated
66
+ */
64
67
  export const WizardActions = ({ actions }: Props) => {
65
68
  const {
66
69
  state: { mode, steps, currentStepNo },
@@ -30,6 +30,9 @@ export interface Props {
30
30
  children?: React.ReactNode;
31
31
  }
32
32
 
33
+ /**
34
+ * @deprecated
35
+ */
33
36
  const WizardStateProvider = ({ children, initialState }: Props) => {
34
37
  const [state, dispatch] = useReducer(reducer, initialState);
35
38
  return (
@@ -48,4 +48,7 @@ const WizardStepsComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (
48
48
  );
49
49
  };
50
50
 
51
+ /**
52
+ * @deprecated
53
+ */
51
54
  export const WizardSteps = React.forwardRef(WizardStepsComponent);
package/src/index.ts CHANGED
@@ -54,6 +54,7 @@ export { StatusIndicator } from "./components/StatusIndicator/StatusIndicator";
54
54
  export type { Props as StatusIndicatorProps } from "./components/StatusIndicator/StatusIndicator";
55
55
  export { Stepper } from "./components/Stepper/Stepper";
56
56
  export type { Props as StepperProps } from "./components/Stepper/Stepper";
57
+ export type { Props as StepProps } from "./components/Stepper/Step";
57
58
  export { Pagination } from "./components/Pagination/Pagination";
58
59
  export type {
59
60
  Props as PaginationProps,
@@ -144,6 +144,7 @@
144
144
  outline: 2px solid var(--color-focus);
145
145
  outline-offset: 2px;
146
146
  border-radius: 1px;
147
+ z-index: 2;
147
148
  }
148
149
 
149
150
  &:active:not(.disabled),