vue3-steppy 1.0.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.
- package/LICENSE.md +21 -0
- package/README.md +178 -0
- package/dist/vue3-steppy.js +157 -0
- package/dist/vue3-steppy.umd.cjs +2 -0
- package/package.json +62 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Mike Konstantakos
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
<h1 align="center">Steppy</h1>
|
|
2
|
+
|
|
3
|
+
<h4 align="center">A simple Stepper component for Vue 3</h4>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="">
|
|
7
|
+
<img src=""
|
|
8
|
+
alt="npm">
|
|
9
|
+
</a>
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<a href="#demo">Demo</a> •
|
|
14
|
+
<a href="#key-features">Key Features</a> •
|
|
15
|
+
<a href="#how-to-use">How To Use</a> •
|
|
16
|
+
<a href="#credits">Credits</a> •
|
|
17
|
+
<a href="#license">License</a>
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
## Demo
|
|
21
|
+
|
|
22
|
+
You can try a live demo [here](https://laximas.github.io/vue3-steppy/)
|
|
23
|
+
|
|
24
|
+
## Key Features
|
|
25
|
+
|
|
26
|
+
* Keep track of current step
|
|
27
|
+
* Change step content
|
|
28
|
+
* Configure finalization
|
|
29
|
+
* Customizable
|
|
30
|
+
- Colors
|
|
31
|
+
- Titles
|
|
32
|
+
- Icons
|
|
33
|
+
- Button text
|
|
34
|
+
|
|
35
|
+
## How To Use
|
|
36
|
+
Install
|
|
37
|
+
```bash
|
|
38
|
+
$ npm install vue3-steppy
|
|
39
|
+
```
|
|
40
|
+
Import
|
|
41
|
+
```js
|
|
42
|
+
import {Steppy} from 'vue3-steppy'
|
|
43
|
+
```
|
|
44
|
+
Template
|
|
45
|
+
```html
|
|
46
|
+
<Steppo v-model:step="step">
|
|
47
|
+
<template #1><!-- Step 1 Content --></template>
|
|
48
|
+
<template #2><!-- Step 2 Content --></template>
|
|
49
|
+
<template #3><!-- Step 3 Content --></template>
|
|
50
|
+
</Steppo>
|
|
51
|
+
```
|
|
52
|
+
API Props
|
|
53
|
+
```js
|
|
54
|
+
/**
|
|
55
|
+
* Contains the current step. Very similar to a
|
|
56
|
+
* `value` attribute on an input. In most cases, you'll want
|
|
57
|
+
* to set this as a two-way binding, using the `v-model` directive.
|
|
58
|
+
* @type {Number}
|
|
59
|
+
*/
|
|
60
|
+
step: {
|
|
61
|
+
type: Number,
|
|
62
|
+
default: 1
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Contains the steps with custom titles and icons.
|
|
67
|
+
* @type {Array}
|
|
68
|
+
*
|
|
69
|
+
* @param {Image} iconSuccess - You can point to an imported icon from you assets like:
|
|
70
|
+
* import CheckMark from '../assets/check-mark.png'
|
|
71
|
+
* If you set it to null, a default SVG will be used with primary color 1.
|
|
72
|
+
*
|
|
73
|
+
* @param {boolean} isValid - Used to determine if the user can move to the next step.
|
|
74
|
+
*/
|
|
75
|
+
tabs: {
|
|
76
|
+
type: Array,
|
|
77
|
+
default: reactive([
|
|
78
|
+
{
|
|
79
|
+
title: 'Step 1',
|
|
80
|
+
iconSuccess: null,
|
|
81
|
+
isValid: true
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
title: 'Step 2',
|
|
85
|
+
iconSuccess: null,
|
|
86
|
+
isValid: true
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
title: 'Step 3',
|
|
90
|
+
iconSuccess: null,
|
|
91
|
+
isValid: true
|
|
92
|
+
}
|
|
93
|
+
])
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Function that will run after all steps are completed (done button is clicked).
|
|
98
|
+
* @type {Object}
|
|
99
|
+
*/
|
|
100
|
+
finalize: {
|
|
101
|
+
type: Function,
|
|
102
|
+
default: function () {
|
|
103
|
+
return {}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Text for back button.
|
|
109
|
+
* @type {String}
|
|
110
|
+
*/
|
|
111
|
+
backText: {
|
|
112
|
+
type: String,
|
|
113
|
+
default: 'Back'
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Text for next button.
|
|
118
|
+
* @type {String}
|
|
119
|
+
*/
|
|
120
|
+
nextText: {
|
|
121
|
+
type: String,
|
|
122
|
+
default: 'Next'
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Text for done button.
|
|
127
|
+
* @type {String}
|
|
128
|
+
*/
|
|
129
|
+
doneText: {
|
|
130
|
+
type: String,
|
|
131
|
+
default: 'Done'
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Primary Color 1
|
|
136
|
+
* @type {String}
|
|
137
|
+
*/
|
|
138
|
+
,
|
|
139
|
+
primaryColor1: {
|
|
140
|
+
type: String,
|
|
141
|
+
default: 'orange'
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Primary Color 2
|
|
146
|
+
* @type {String}
|
|
147
|
+
*/
|
|
148
|
+
,
|
|
149
|
+
primaryColor2: {
|
|
150
|
+
type: String,
|
|
151
|
+
default: '#C5C5C5'
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Credits
|
|
156
|
+
|
|
157
|
+
This software uses the following open source packages:
|
|
158
|
+
|
|
159
|
+
- [Vue 3](https://vuejs.org)
|
|
160
|
+
- [Vite](https://vitejs.dev)
|
|
161
|
+
- [core-js](https://www.npmjs.com/package/core-js)
|
|
162
|
+
- [sass](https://www.npmjs.com/package/sass)
|
|
163
|
+
- [sass-loader](https://www.npmjs.com/package/sass-loader)
|
|
164
|
+
- [node-sass](https://www.npmjs.com/package/node-sass)
|
|
165
|
+
- [gh-pages](https://www.npmjs.com/package/gh-pages)
|
|
166
|
+
|
|
167
|
+
## Support
|
|
168
|
+
|
|
169
|
+
<a href="https://www.buymeacoffee.com/laximas" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/purple_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a>
|
|
170
|
+
|
|
171
|
+
## License
|
|
172
|
+
|
|
173
|
+
[MIT](https://github.com/Laximas/vue3-steppy/blob/main/LICENSE.md)
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
> GitHub [Laximas](https://github.com/Laximas) ·
|
|
178
|
+
> LinkedIn [Mike Konstantakos](https://www.linkedin.com/in/mike-konstantakos/)
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
(function(){"use strict";try{if(typeof document!="undefined"){var e=document.createElement("style");e.appendChild(document.createTextNode("body[data-v-ba058e75]{background-image:linear-gradient(60deg,#abecd6 0%,#fbed96 100%);color:#fff;width:100%;height:100vh;display:flex;align-items:center;justify-content:center;font-family:sans-serif}.tx-default-2[data-v-ba058e75]{color:var(--primaryColor1);font-weight:600}.wrapper-steppy[data-v-ba058e75]{background-color:#fff;padding:60px;border-radius:32px;box-shadow:#00000017}.steppy[data-v-ba058e75]{display:flex;align-items:center;justify-content:space-between;width:auto;position:relative;z-index:0;margin-bottom:5px}.steppy-progress[data-v-ba058e75]{position:absolute;background-color:var(--primaryColor2);height:2px;z-index:-1;left:0;right:0;margin:0 auto}.steppy-progress-bar[data-v-ba058e75]{position:absolute;left:0;height:100%;width:0;background-color:var(--primaryColor1);transition:all .5s ease}.steppy-item[data-v-ba058e75]{display:flex;flex-direction:column;align-items:center;color:var(--primaryColor2);transition:all .5s ease}.steppy-item-counter[data-v-ba058e75]{height:68px;width:68px;display:grid;place-items:center;background-color:#fff;border-radius:100%;border:2px solid var(--primaryColor2);position:relative}.steppy-item-counter .icon-success[data-v-ba058e75]{position:absolute;opacity:0;transform:scale(0);width:24px;transition:all .5s ease}.steppy-item-counter .number[data-v-ba058e75]{font-size:22px;transition:all .5s ease}.steppy-item-title[data-v-ba058e75]{position:absolute;text-align:center;font-size:14px;bottom:-43px}.steppy-item.success .steppy-item-counter[data-v-ba058e75]{border-color:var(--primaryColor1);background-color:#fff;color:#fff;font-weight:600}.steppy-item.success .steppy-item-counter .icon-success[data-v-ba058e75]{opacity:1;transform:scale(1)}.steppy-item.success .steppy-item-counter .number[data-v-ba058e75]{opacity:0;transform:scale(0)}.steppy-item.success .steppy-item-title[data-v-ba058e75]{color:var(--primaryColor1)}.steppy-item.current .steppy-item-counter[data-v-ba058e75]{border-color:var(--primaryColor1);background-color:var(--primaryColor1);color:#fff;font-weight:600}.steppy-item.current .steppy-item-title[data-v-ba058e75]{color:#818181}.steppy-pane[data-v-ba058e75]{color:#333;text-align:center;padding:25px;box-shadow:0 0 10px #0000004d;margin:60px 0 20px}.controls[data-v-ba058e75]{display:flex}.btn[data-v-ba058e75]{display:flex;justify-content:center;align-items:center;padding:6px 16px;text-align:center;vertical-align:middle;cursor:pointer;line-height:1.5;transition:all .15s;border-radius:4px;width:fit-content;font-size:.75rem;color:#333;background-color:#f0f0f0;border:1px solid #f0f0f0}.btn[data-v-ba058e75]:disabled{opacity:.5;pointer-events:none}.btn--default-2[data-v-ba058e75]{background-color:var(--primaryColor1);border-color:var(--primaryColor1);color:#fff;margin-left:auto}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
+
import { openBlock as e, createElementBlock as s, normalizeStyle as d, createElementVNode as c, reactive as g, computed as _, unref as b, Fragment as m, renderList as k, normalizeClass as C, createBlock as v, toDisplayString as a, renderSlot as x, createCommentVNode as f } from "vue";
|
|
3
|
+
const V = /* @__PURE__ */ c("path", { d: "M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" }, null, -1), z = [
|
|
4
|
+
V
|
|
5
|
+
], T = {
|
|
6
|
+
__name: "CheckMark",
|
|
7
|
+
props: {
|
|
8
|
+
color: {
|
|
9
|
+
type: String,
|
|
10
|
+
default: "black"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
setup(n) {
|
|
14
|
+
return (r, t) => (e(), s("svg", {
|
|
15
|
+
viewBox: "0 0 24 24",
|
|
16
|
+
style: d({ fill: n.color })
|
|
17
|
+
}, z, 4));
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const B = (n, r) => {
|
|
21
|
+
const t = n.__vccOpts || n;
|
|
22
|
+
for (const [i, u] of r)
|
|
23
|
+
t[i] = u;
|
|
24
|
+
return t;
|
|
25
|
+
}, M = { class: "steppy" }, N = { class: "steppy-progress" }, $ = { class: "steppy-item-counter" }, w = ["src"], D = { class: "number" }, E = { class: "steppy-item-title" }, F = {
|
|
26
|
+
key: 0,
|
|
27
|
+
class: "steppy-pane"
|
|
28
|
+
}, A = { class: "controls" }, I = ["disabled"], L = ["disabled"], O = {
|
|
29
|
+
__name: "Steppy",
|
|
30
|
+
props: {
|
|
31
|
+
step: {
|
|
32
|
+
type: Number,
|
|
33
|
+
default: 1
|
|
34
|
+
},
|
|
35
|
+
tabs: {
|
|
36
|
+
type: Array,
|
|
37
|
+
default: g([
|
|
38
|
+
{
|
|
39
|
+
title: "Step 1",
|
|
40
|
+
iconSuccess: null,
|
|
41
|
+
isValid: !0
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
title: "Step 2",
|
|
45
|
+
iconSuccess: null,
|
|
46
|
+
isValid: !0
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
title: "Step 3",
|
|
50
|
+
iconSuccess: null,
|
|
51
|
+
isValid: !0
|
|
52
|
+
}
|
|
53
|
+
])
|
|
54
|
+
},
|
|
55
|
+
finalize: {
|
|
56
|
+
type: Function,
|
|
57
|
+
default: function() {
|
|
58
|
+
return {};
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
backText: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: "Back"
|
|
64
|
+
},
|
|
65
|
+
nextText: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: "Next"
|
|
68
|
+
},
|
|
69
|
+
doneText: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: "Done"
|
|
72
|
+
},
|
|
73
|
+
primaryColor1: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: "orange"
|
|
76
|
+
},
|
|
77
|
+
primaryColor2: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: "#C5C5C5"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
emits: ["update:step"],
|
|
83
|
+
setup(n, { emit: r }) {
|
|
84
|
+
const t = n, i = _(() => ({
|
|
85
|
+
"--primaryColor1": t.primaryColor1,
|
|
86
|
+
"--primaryColor2": t.primaryColor2
|
|
87
|
+
})), u = () => {
|
|
88
|
+
const l = t.step + 1;
|
|
89
|
+
r("update:step", l);
|
|
90
|
+
}, S = () => {
|
|
91
|
+
const l = t.step - 1;
|
|
92
|
+
r("update:step", l);
|
|
93
|
+
}, h = _(() => 100 / (t.tabs.length - 1) * (t.step - 1) + "%");
|
|
94
|
+
return (l, y) => (e(), s("div", {
|
|
95
|
+
class: "wrapper-steppy",
|
|
96
|
+
style: d(b(i))
|
|
97
|
+
}, [
|
|
98
|
+
c("div", M, [
|
|
99
|
+
c("div", N, [
|
|
100
|
+
c("div", {
|
|
101
|
+
class: "steppy-progress-bar",
|
|
102
|
+
style: d("width:" + b(h))
|
|
103
|
+
}, null, 4)
|
|
104
|
+
]),
|
|
105
|
+
(e(!0), s(m, null, k(t.tabs, (o, p) => (e(), s("div", {
|
|
106
|
+
class: C(["steppy-item", { current: t.step === p + 1, success: t.step > p + 1 }]),
|
|
107
|
+
key: p
|
|
108
|
+
}, [
|
|
109
|
+
c("div", $, [
|
|
110
|
+
o.iconSuccess ? (e(), s("img", {
|
|
111
|
+
key: 0,
|
|
112
|
+
class: "icon-success",
|
|
113
|
+
src: o.iconSuccess,
|
|
114
|
+
alt: "Check Mark"
|
|
115
|
+
}, null, 8, w)) : (e(), v(T, {
|
|
116
|
+
key: 1,
|
|
117
|
+
class: "icon-success",
|
|
118
|
+
color: n.primaryColor1,
|
|
119
|
+
alt: "Check Mark"
|
|
120
|
+
}, null, 8, ["color"])),
|
|
121
|
+
c("span", D, a(p + 1), 1)
|
|
122
|
+
]),
|
|
123
|
+
c("span", E, a(o.title), 1)
|
|
124
|
+
], 2))), 128))
|
|
125
|
+
]),
|
|
126
|
+
(e(!0), s(m, null, k(t.tabs.length, (o) => (e(), s("div", {
|
|
127
|
+
class: "steppy-content",
|
|
128
|
+
key: o
|
|
129
|
+
}, [
|
|
130
|
+
t.step === o ? (e(), s("div", F, [
|
|
131
|
+
x(l.$slots, o, {}, void 0, !0)
|
|
132
|
+
])) : f("", !0)
|
|
133
|
+
]))), 128)),
|
|
134
|
+
c("div", A, [
|
|
135
|
+
t.step !== 1 ? (e(), s("button", {
|
|
136
|
+
key: 0,
|
|
137
|
+
class: "btn",
|
|
138
|
+
onClick: S
|
|
139
|
+
}, a(t.backText), 1)) : f("", !0),
|
|
140
|
+
t.step !== t.tabs.length ? (e(), s("button", {
|
|
141
|
+
key: 1,
|
|
142
|
+
class: "btn btn--default-2",
|
|
143
|
+
onClick: u,
|
|
144
|
+
disabled: !t.tabs[t.step - 1].isValid
|
|
145
|
+
}, a(t.nextText), 9, I)) : (e(), s("button", {
|
|
146
|
+
key: 2,
|
|
147
|
+
class: "btn btn--default-2",
|
|
148
|
+
onClick: y[0] || (y[0] = (...o) => n.finalize && n.finalize(...o)),
|
|
149
|
+
disabled: !t.tabs[t.step - 1].isValid
|
|
150
|
+
}, a(t.doneText), 9, L))
|
|
151
|
+
])
|
|
152
|
+
], 4));
|
|
153
|
+
}
|
|
154
|
+
}, j = /* @__PURE__ */ B(O, [["__scopeId", "data-v-ba058e75"]]);
|
|
155
|
+
export {
|
|
156
|
+
j as Steppy
|
|
157
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(function(){"use strict";try{if(typeof document!="undefined"){var e=document.createElement("style");e.appendChild(document.createTextNode("body[data-v-ba058e75]{background-image:linear-gradient(60deg,#abecd6 0%,#fbed96 100%);color:#fff;width:100%;height:100vh;display:flex;align-items:center;justify-content:center;font-family:sans-serif}.tx-default-2[data-v-ba058e75]{color:var(--primaryColor1);font-weight:600}.wrapper-steppy[data-v-ba058e75]{background-color:#fff;padding:60px;border-radius:32px;box-shadow:#00000017}.steppy[data-v-ba058e75]{display:flex;align-items:center;justify-content:space-between;width:auto;position:relative;z-index:0;margin-bottom:5px}.steppy-progress[data-v-ba058e75]{position:absolute;background-color:var(--primaryColor2);height:2px;z-index:-1;left:0;right:0;margin:0 auto}.steppy-progress-bar[data-v-ba058e75]{position:absolute;left:0;height:100%;width:0;background-color:var(--primaryColor1);transition:all .5s ease}.steppy-item[data-v-ba058e75]{display:flex;flex-direction:column;align-items:center;color:var(--primaryColor2);transition:all .5s ease}.steppy-item-counter[data-v-ba058e75]{height:68px;width:68px;display:grid;place-items:center;background-color:#fff;border-radius:100%;border:2px solid var(--primaryColor2);position:relative}.steppy-item-counter .icon-success[data-v-ba058e75]{position:absolute;opacity:0;transform:scale(0);width:24px;transition:all .5s ease}.steppy-item-counter .number[data-v-ba058e75]{font-size:22px;transition:all .5s ease}.steppy-item-title[data-v-ba058e75]{position:absolute;text-align:center;font-size:14px;bottom:-43px}.steppy-item.success .steppy-item-counter[data-v-ba058e75]{border-color:var(--primaryColor1);background-color:#fff;color:#fff;font-weight:600}.steppy-item.success .steppy-item-counter .icon-success[data-v-ba058e75]{opacity:1;transform:scale(1)}.steppy-item.success .steppy-item-counter .number[data-v-ba058e75]{opacity:0;transform:scale(0)}.steppy-item.success .steppy-item-title[data-v-ba058e75]{color:var(--primaryColor1)}.steppy-item.current .steppy-item-counter[data-v-ba058e75]{border-color:var(--primaryColor1);background-color:var(--primaryColor1);color:#fff;font-weight:600}.steppy-item.current .steppy-item-title[data-v-ba058e75]{color:#818181}.steppy-pane[data-v-ba058e75]{color:#333;text-align:center;padding:25px;box-shadow:0 0 10px #0000004d;margin:60px 0 20px}.controls[data-v-ba058e75]{display:flex}.btn[data-v-ba058e75]{display:flex;justify-content:center;align-items:center;padding:6px 16px;text-align:center;vertical-align:middle;cursor:pointer;line-height:1.5;transition:all .15s;border-radius:4px;width:fit-content;font-size:.75rem;color:#333;background-color:#f0f0f0;border:1px solid #f0f0f0}.btn[data-v-ba058e75]:disabled{opacity:.5;pointer-events:none}.btn--default-2[data-v-ba058e75]{background-color:var(--primaryColor1);border-color:var(--primaryColor1);color:#fff;margin-left:auto}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
+
(function(n,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(n=typeof globalThis<"u"?globalThis:n||self,e(n["vue3-steppy"]={},n.Vue))})(this,function(n,e){"use strict";const d=[e.createElementVNode("path",{d:"M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z"},null,-1)],y={__name:"CheckMark",props:{color:{type:String,default:"black"}},setup(s){return(l,t)=>(e.openBlock(),e.createElementBlock("svg",{viewBox:"0 0 24 24",style:e.normalizeStyle({fill:s.color})},d,4))}},z="",m=(s,l)=>{const t=s.__vccOpts||s;for(const[a,p]of l)t[a]=p;return t},k={class:"steppy"},_={class:"steppy-progress"},f={class:"steppy-item-counter"},S=["src"],b={class:"number"},u={class:"steppy-item-title"},B={key:0,class:"steppy-pane"},g={class:"controls"},h=["disabled"],C=["disabled"],E={__name:"Steppy",props:{step:{type:Number,default:1},tabs:{type:Array,default:e.reactive([{title:"Step 1",iconSuccess:null,isValid:!0},{title:"Step 2",iconSuccess:null,isValid:!0},{title:"Step 3",iconSuccess:null,isValid:!0}])},finalize:{type:Function,default:function(){return{}}},backText:{type:String,default:"Back"},nextText:{type:String,default:"Next"},doneText:{type:String,default:"Done"},primaryColor1:{type:String,default:"orange"},primaryColor2:{type:String,default:"#C5C5C5"}},emits:["update:step"],setup(s,{emit:l}){const t=s,a=e.computed(()=>({"--primaryColor1":t.primaryColor1,"--primaryColor2":t.primaryColor2})),p=()=>{const c=t.step+1;l("update:step",c)},N=()=>{const c=t.step-1;l("update:step",c)},x=e.computed(()=>100/(t.tabs.length-1)*(t.step-1)+"%");return(c,i)=>(e.openBlock(),e.createElementBlock("div",{class:"wrapper-steppy",style:e.normalizeStyle(e.unref(a))},[e.createElementVNode("div",k,[e.createElementVNode("div",_,[e.createElementVNode("div",{class:"steppy-progress-bar",style:e.normalizeStyle("width:"+e.unref(x))},null,4)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.tabs,(o,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["steppy-item",{current:t.step===r+1,success:t.step>r+1}]),key:r},[e.createElementVNode("div",f,[o.iconSuccess?(e.openBlock(),e.createElementBlock("img",{key:0,class:"icon-success",src:o.iconSuccess,alt:"Check Mark"},null,8,S)):(e.openBlock(),e.createBlock(y,{key:1,class:"icon-success",color:s.primaryColor1,alt:"Check Mark"},null,8,["color"])),e.createElementVNode("span",b,e.toDisplayString(r+1),1)]),e.createElementVNode("span",u,e.toDisplayString(o.title),1)],2))),128))]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.tabs.length,o=>(e.openBlock(),e.createElementBlock("div",{class:"steppy-content",key:o},[t.step===o?(e.openBlock(),e.createElementBlock("div",B,[e.renderSlot(c.$slots,o,{},void 0,!0)])):e.createCommentVNode("",!0)]))),128)),e.createElementVNode("div",g,[t.step!==1?(e.openBlock(),e.createElementBlock("button",{key:0,class:"btn",onClick:N},e.toDisplayString(t.backText),1)):e.createCommentVNode("",!0),t.step!==t.tabs.length?(e.openBlock(),e.createElementBlock("button",{key:1,class:"btn btn--default-2",onClick:p,disabled:!t.tabs[t.step-1].isValid},e.toDisplayString(t.nextText),9,h)):(e.openBlock(),e.createElementBlock("button",{key:2,class:"btn btn--default-2",onClick:i[0]||(i[0]=(...o)=>s.finalize&&s.finalize(...o)),disabled:!t.tabs[t.step-1].isValid},e.toDisplayString(t.doneText),9,C))])],4))}},V=m(E,[["__scopeId","data-v-ba058e75"]]);n.Steppy=V,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vue3-steppy",
|
|
3
|
+
"description": "A simple Vue 3 Stepper plugin",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"private": false,
|
|
7
|
+
"author": "Mike Konstantakos",
|
|
8
|
+
"homepage": "https://laximas.github.io/vue3-steppy/",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/Laximas/vue3-steppy.git"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/Laximas/vue3-steppy/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"vue3",
|
|
18
|
+
"vue",
|
|
19
|
+
"stepper",
|
|
20
|
+
"steppy",
|
|
21
|
+
"vue-stepper",
|
|
22
|
+
"vue-steppy",
|
|
23
|
+
"vue3-stepper",
|
|
24
|
+
"vue3-steppy"
|
|
25
|
+
],
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"main": "./dist/vue3-steppy.umd.cjs",
|
|
31
|
+
"module": "./dist/vue3-steppy.js",
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"import": "./dist/vue3-steppy.js",
|
|
35
|
+
"require": "./dist/vue3-steppy.umd.cjs"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"dev": "vite",
|
|
40
|
+
"build": "vite build",
|
|
41
|
+
"predeploy": "npm run build",
|
|
42
|
+
"deploy": "gh-pages -d dist",
|
|
43
|
+
"preview": "vite preview"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"core-js": "^3.8.3",
|
|
47
|
+
"vite-plugin-css-injected-by-js": "^2.4.0",
|
|
48
|
+
"vue": "^3.2.13"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@vitejs/plugin-vue": "^4.0.0",
|
|
52
|
+
"@vue/cli-service": "~5.0.0",
|
|
53
|
+
"gh-pages": "^5.0.0",
|
|
54
|
+
"node-sass": "^8.0.0",
|
|
55
|
+
"sass": "^1.57.1",
|
|
56
|
+
"sass-loader": "^13.2.0",
|
|
57
|
+
"vite": "^4.0.0"
|
|
58
|
+
},
|
|
59
|
+
"directories": {
|
|
60
|
+
"lib": "lib"
|
|
61
|
+
}
|
|
62
|
+
}
|