Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit deb06b0

Browse files
committed
Add typescript definitions
Closes #79
1 parent a8d1f61 commit deb06b0

File tree

6 files changed

+77
-9
lines changed

6 files changed

+77
-9
lines changed

package.json

+6-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
"description": "A vue based tab/form wizard",
55
"main": "dist/vue-form-wizard.js",
66
"files": [
7-
"dist"
7+
"dist",
8+
"types",
9+
"src"
810
],
11+
"typings": "types/index.d.ts",
912
"homepage": "https://github.com/cristijora/vue-form-wizard",
1013
"scripts": {
1114
"dev": "node build/dev-server.js",
@@ -88,12 +91,12 @@
8891
"sinon-chai": "^2.14.0",
8992
"stats-webpack-plugin": "^0.6.0",
9093
"url-loader": "^0.6.2",
91-
"vue": "^2.4.2",
94+
"vue": "^2.5.8",
9295
"vue-form-generator": "^2.1.1",
9396
"vue-loader": "^11.1.4",
9497
"vue-router": "^2.5.1",
9598
"vue-style-loader": "^3.0.3",
96-
"vue-template-compiler": "^2.4.2",
99+
"vue-template-compiler": "^2.5.8",
97100
"vue-test-utils": "^1.0.0-beta.1",
98101
"webpack": "^2.2.1",
99102
"webpack-bundle-analyzer": "^2.9.1",

types/FormWizard.ts

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
export type ShapeType = 'circle' | 'square' | 'tab'
2+
export type LayoutType = 'vertical' | 'horizontal'
3+
export type StepSizeType = 'xs' | 'sm' | 'md' | 'lg'
4+
5+
export declare class Wizard {
6+
/** Wizard title */
7+
title: string
8+
/** Wizard subtitle */
9+
subtitle: string
10+
nextButtonText: string
11+
backButtonText: string
12+
finishButtonText: string
13+
/** Whether to hide footer buttons */
14+
hideButtons: boolean
15+
/** Whether to trigger beforeChange function when navigating back */
16+
validateOnBack: boolean
17+
/** Active step and button color */
18+
color: string
19+
/** Step color when the current step is not valid */
20+
errorColor: string
21+
/** Main step shape */
22+
shape: ShapeType
23+
/** Wizard layout */
24+
layout: LayoutType
25+
/** Additional css classes for steps */
26+
stepsClasses: string[]
27+
/** Step size */
28+
stepSize: StepSizeType
29+
/** Step transition from inactive to active */
30+
transition: string
31+
/** Tab index where the wizard should start */
32+
startIndex: number
33+
}

types/TabContent.ts

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export declare class Tab {
2+
/** Title to be displayed under each step */
3+
title?: string
4+
/** css class for each step icon */
5+
icon?: string
6+
/***
7+
* Function to execute before tab switch. Return value must be boolean
8+
* If the return result is false, tab switch is restricted
9+
*/
10+
beforeChange (): boolean | Promise
11+
/** Vue router route object */
12+
route: string | object
13+
additionalInfo: object
14+
}

types/WizardStep.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export declare class Step {
2+
/** Tab component for the step. This should be usually passed through the `step` scoped slot */
3+
tab: object
4+
transition: string
5+
index: number
6+
}

types/index.d.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import Vue from 'vue'
2+
3+
export function install (vue: typeof Vue): void
4+
5+
import { Wizard } from './FormWizard'
6+
import { Tab } from './TabContent'
7+
import { Step } from './WizardStep'
8+
9+
export class FormWizard extends Wizard {}
10+
export class TabContent extends Tab {}
11+
export class WizardStep extends Step {}
12+

yarn.lock

+6-6
Original file line numberDiff line numberDiff line change
@@ -6338,9 +6338,9 @@ vue-style-loader@^3.0.3:
63386338
hash-sum "^1.0.2"
63396339
loader-utils "^1.0.2"
63406340

6341-
vue-template-compiler@^2.4.2:
6342-
version "2.4.2"
6343-
resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.4.2.tgz#5a45d843f148b098f6c1d1e35ac20c4956d30ad1"
6341+
vue-template-compiler@^2.5.8:
6342+
version "2.5.8"
6343+
resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.5.8.tgz#826ae77e1d5faa7fa5fca554f33872dde38de674"
63446344
dependencies:
63456345
de-indent "^1.0.2"
63466346
he "^1.1.0"
@@ -6355,9 +6355,9 @@ vue-test-utils@^1.0.0-beta.1:
63556355
dependencies:
63566356
lodash "^4.17.4"
63576357

6358-
vue@^2.4.2:
6359-
version "2.4.2"
6360-
resolved "https://registry.yarnpkg.com/vue/-/vue-2.4.2.tgz#a9855261f191c978cc0dc1150531b8d08149b58c"
6358+
vue@^2.5.8:
6359+
version "2.5.8"
6360+
resolved "https://registry.yarnpkg.com/vue/-/vue-2.5.8.tgz#f855c1c27255184a82225f4bef225473e8faf15b"
63616361

63626362
watchpack@^1.3.1:
63636363
version "1.4.0"

0 commit comments

Comments
 (0)