-
Notifications
You must be signed in to change notification settings - Fork 734
Typescript/wizard move to typescript #1390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4d7e311
Rename files
M-i-k-e-l 3047cd3
Rename files(2)
M-i-k-e-l 3cdd306
Rename files(3)
M-i-k-e-l 6606907
Move Wizard to typescript
M-i-k-e-l 399752d
Change from false to undefiend
M-i-k-e-l bc7b6c5
Merge branch 'master' into typescript/wizard-move-to-typescript
M-i-k-e-l File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import { WizardStepsConfig } from './types'; | ||
export declare const StatesConfig: WizardStepsConfig; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import React from 'react'; | ||
import { WizardStepProps } from './types'; | ||
declare const _default: React.ComponentClass<WizardStepProps & { | ||
useCustomTheme?: boolean | undefined; | ||
}, any>; | ||
export default _default; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React, { Component } from 'react'; | ||
import WizardStep from './WizardStep'; | ||
import { WizardProps, WizardStepProps, WizardStepStates, WizardStepConfig, WizardStepsConfig } from './types'; | ||
export { WizardProps, WizardStepProps, WizardStepStates, WizardStepConfig, WizardStepsConfig }; | ||
interface State { | ||
maxWidth: number; | ||
} | ||
/** | ||
* @description: Wizard Component: a wizard presents a series of steps in prescribed order | ||
* that the user needs to complete in order to accomplish a goal (e.g. purchase a product). | ||
* | ||
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/WizardScreen.js | ||
* @notes: Use Wizard with nested Wizard.Step(s) to achieve the desired result. | ||
* @gif: https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/Wizard/Wizard.gif?raw=true | ||
* @image: https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/Wizard/WizardPresets.png?raw=true | ||
*/ | ||
declare class Wizard extends Component<WizardProps, State> { | ||
static displayName: string; | ||
static Step: typeof WizardStep; | ||
static States: typeof WizardStepStates; | ||
constructor(props: WizardProps); | ||
componentDidMount(): void; | ||
componentWillUnmount(): void; | ||
onOrientationChange: () => void; | ||
getMaxWidth(): number; | ||
renderChildren(): React.DetailedReactHTMLElement<any, HTMLElement>[] | null | undefined; | ||
render(): JSX.Element; | ||
} | ||
declare const _default: React.ComponentClass<WizardProps & { | ||
useCustomTheme?: boolean | undefined; | ||
}, any> & typeof Wizard; | ||
export default _default; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import { ImageProps } from '../image'; | ||
import { StyleProp, TextStyle, ViewStyle } from 'react-native'; | ||
export declare enum WizardStepStates { | ||
ENABLED = "enabled", | ||
DISABLED = "disabled", | ||
ERROR = "error", | ||
SKIPPED = "skipped", | ||
COMPLETED = "completed" | ||
} | ||
export interface WizardStepProps { | ||
/** | ||
* The state of the step (Wizard.States.X) | ||
*/ | ||
state: WizardStepStates; | ||
/** | ||
* The label of the item | ||
*/ | ||
label?: string; | ||
/** | ||
* Additional styles for the label | ||
*/ | ||
labelStyle?: StyleProp<TextStyle>; | ||
/** | ||
* Additional styles for the connector | ||
*/ | ||
connectorStyle?: StyleProp<ViewStyle>; | ||
/** | ||
* Color of the step index (or of the icon, when provided) | ||
*/ | ||
color?: string; | ||
/** | ||
* Color of the circle | ||
*/ | ||
circleColor?: string; | ||
/** | ||
* The step's circle size (diameter) | ||
*/ | ||
circleSize?: number; | ||
/** | ||
* Circle's background color | ||
*/ | ||
circleBackgroundColor?: string; | ||
/** | ||
* Icon to replace the (default) index | ||
*/ | ||
icon?: ImageProps; | ||
/** | ||
* Additional styles for the index's label (when icon is not provided) | ||
*/ | ||
indexLabelStyle?: StyleProp<TextStyle>; | ||
/** | ||
* Whether the step should be enabled | ||
*/ | ||
enabled?: boolean; | ||
/** | ||
* Extra text to be read in accessibility mode | ||
*/ | ||
accessibilityInfo?: string; | ||
} | ||
export declare type WizardStepConfig = Omit<WizardStepProps, 'state'>; | ||
export interface WizardStepsConfig { | ||
enabled?: WizardStepConfig; | ||
disabled?: WizardStepConfig; | ||
error?: WizardStepConfig; | ||
skipped?: WizardStepConfig; | ||
completed?: WizardStepConfig; | ||
active?: WizardStepConfig; | ||
} | ||
export interface WizardProps { | ||
/** | ||
* The active step's index | ||
*/ | ||
activeIndex: number; | ||
/** | ||
* The configuration of the active step (see Wizard.Step.propTypes) | ||
*/ | ||
activeConfig?: WizardStepProps; | ||
/** | ||
* Callback that is called when the active step is changed (i.e. a step was clicked on). | ||
* The new activeIndex will be the input of the callback. | ||
*/ | ||
onActiveIndexChanged?: (index: number) => void; | ||
/** | ||
* Add or override style of the container | ||
*/ | ||
containerStyle?: StyleProp<ViewStyle>; | ||
testID?: string; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 2 additions & 9 deletions
11
src/components/wizard/WizardStates.js → src/components/wizard/WizardStates.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are all required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are "private" props that are received from the
Wizard
, this was on-purpose.