Skip to content

Commit

Permalink
feat: primefaces#6870 Add typing to steps.d.ts
Browse files Browse the repository at this point in the history
Do not implement child props at the moment
  • Loading branch information
gcko committed Sep 2, 2024
1 parent 67968cc commit 03b15c0
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 5 deletions.
2 changes: 1 addition & 1 deletion components/lib/steps/Steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const Steps = React.memo(

const getStepPT = (step, key, index) => {
const stepMetaData = {
props: step.props,
// props: step.props,
parent: metaData,
context: {
index,
Expand Down
52 changes: 48 additions & 4 deletions components/lib/steps/steps.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,50 @@ import { PassThroughOptions } from '../passthrough';
import { PassThroughType } from '../utils/utils';

export declare type StepsPassThroughType<T> = PassThroughType<T, StepsThroughMethodOptions>;
export declare type StepPassThroughType<T> = PassThroughType<T, StepPassThroughMethodOptions>;

/**
* Custom passthrough(pt) option method.
*/
export interface StepPassThroughMethodOptions {
// props: StepsProps;
parent: StepsThroughMethodOptions;
context: StepContext;
}

/**
* Defines current inline context in Steps component.
*/
export interface StepContext {
/**
* Step index.
*/
index: number;
/**
* Total number of steps
*/
count: number;
/**
* Is this the first step?
* @defaultValue false
*/
first: boolean;
/**
* Is this the last step?
* @defaultValue false
*/
last: boolean;
/**
* Is this step currently selected.
* @defaultValue false
*/
selected: boolean;
/**
* Is this step currently disabled.
* @defaultValue false
*/
disabled: boolean;
}

/**
* Custom passthrough(pt) option method.
Expand Down Expand Up @@ -42,19 +86,19 @@ export interface StepsPassThroughOptions {
/**
* Uses to pass attributes to the action's DOM element.
*/
action?: StepsPassThroughType<React.HTMLAttributes<HTMLAnchorElement>>;
action?: StepPassThroughType<React.HTMLAttributes<HTMLAnchorElement>>;
/**
* Uses to pass attributes to the step's DOM element.
*/
step?: StepsPassThroughType<React.HTMLAttributes<HTMLSpanElement>>;
step?: StepPassThroughType<React.HTMLAttributes<HTMLSpanElement>>;
/**
* Uses to pass attributes to the label's DOM element.
*/
label?: StepsPassThroughType<React.HTMLAttributes<HTMLSpanElement>>;
label?: StepPassThroughType<React.HTMLAttributes<HTMLSpanElement>>;
/**
* Uses to pass attributes to the icon's DOM element.
*/
icon?: StepsPassThroughType<React.SVGProps<SVGSVGElement> | React.HTMLAttributes<HTMLSpanElement>>;
icon?: StepPassThroughType<React.SVGProps<SVGSVGElement> | React.HTMLAttributes<HTMLSpanElement>>;
/**
* Used to manage all lifecycle hooks
* @see {@link ComponentHooks}
Expand Down

0 comments on commit 03b15c0

Please sign in to comment.