Skip to content

Commit 2c122b8

Browse files
authored
Progress Indicator Type updates/fixes. (#3023)
- Abstracted step and data from event into own types. - Match event signatures to intended input.
1 parent e414e27 commit 2c122b8

File tree

1 file changed

+29
-8
lines changed

1 file changed

+29
-8
lines changed

components/progress-indicator.d.ts

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
declare module '@salesforce/design-system-react/components/progress-indicator' {
22
import React from 'react';
3+
4+
type Step = {
5+
id: string | number;
6+
label: string | JSX.Element;
7+
assistiveText?: string;
8+
};
9+
10+
type StepState = {
11+
isCompleted: boolean;
12+
isDisabled: boolean;
13+
isError: boolean;
14+
isSelected: boolean;
15+
step: Step;
16+
};
17+
318
type Props = {
419
/**
520
* **Assistive text for accessibility**
@@ -23,16 +38,16 @@ declare module '@salesforce/design-system-react/components/progress-indicator' {
2338
/**
2439
* Stores all completed steps. It is an array of step objects.
2540
*/
26-
completedSteps?: any[];
41+
completedSteps?: Step[];
2742
/**
2843
* Stores all disabled steps. It is an array of step objects. Steps are still clickable/focusable,
2944
* this only disables cursor change and removes onClick and onFocus event callbacks.
3045
*/
31-
disabledSteps?: any[];
46+
disabledSteps?: Step[];
3247
/**
3348
* Stores all error steps. It is an array of step objects and usually there is only one error step, the current step. If an error occurs a second error icon should be placed to the left of related confirmation buttons (e.g. Cancel, Save) and an Error Popover should appear indicating there are errors. These additional items are NOT part of this component. This note was included for visibility purposes. Please refer to [SLDS website](https://www.lightningdesignsystem.com/components/progress-indicator/) for full details **
3449
*/
35-
errorSteps?: any[];
50+
errorSteps?: Step[];
3651
/**
3752
* HTML id for component.
3853
*/
@@ -48,19 +63,25 @@ declare module '@salesforce/design-system-react/components/progress-indicator' {
4863
* <ProgressIndicator onStepClick={handleStepClick} />
4964
* ```
5065
*/
51-
onStepClick?: (v: any) => any;
66+
onStepClick?: (
67+
event: React.ChangeEvent<HTMLInputElement>,
68+
data: StepState
69+
) => void;
5270
/**
5371
* Triggered when an individual step is focused. By default, it receives an event and returns step state and the step object clicked: `{ isCompleted, isDisabled, isError, isSelected, step }`. Users are able to pass a callback handleClick function in forms of: <function name>(event, data) where data is the callback result.
5472
* ```
5573
* const handleStepFocus = function(event, data) { console.log(data); };
5674
* <ProgressIndicator onStepFocus={handleStepFocus} />
5775
* ```
5876
*/
59-
onStepFocus?: (v: any) => any;
77+
onStepFocus?: (
78+
event: React.ChangeEvent<HTMLInputElement>,
79+
data: StepState
80+
) => void;
6081
/**
6182
* Represents the currently selected or active step. It is a step object.
6283
*/
63-
selectedStep: Record<string, any> /*.isRequired*/;
84+
selectedStep: Step /* .isRequired */;
6485
/**
6586
* It is an array of step objects in the following form:
6687
* ```
@@ -71,11 +92,11 @@ declare module '@salesforce/design-system-react/components/progress-indicator' {
7192
* }],
7293
* ```
7394
*/
74-
steps: any[] /*.isRequired*/;
95+
steps: Step[] /* .isRequired */;
7596
/**
7697
* Stores all steps with opened tooltips. This property is mainly for development purposes. The tooltip should only show on hover for the user.
7798
*/
78-
tooltipIsOpenSteps?: any[];
99+
tooltipIsOpenSteps?: Step[];
79100
/**
80101
* Determines component style.
81102
*/

0 commit comments

Comments
 (0)