@leaflink/stash 47.1.0 → 47.2.1
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/dist/Select.js +2 -2
- package/dist/Select.js.map +1 -1
- package/dist/Select.vue.d.ts +2 -2
- package/dist/Step.js +94 -67
- package/dist/Step.js.map +1 -1
- package/dist/Stepper.js +105 -39
- package/dist/Stepper.js.map +1 -1
- package/dist/components.css +1 -1
- package/dist/keys-7ecef029.js.map +1 -1
- package/dist/locale.js +13 -10
- package/dist/locale.js.map +1 -1
- package/dist/useStepper.d.ts +7 -0
- package/dist/useStepper.js +46 -41
- package/dist/useStepper.js.map +1 -1
- package/package.json +1 -1
package/dist/Select.vue.d.ts
CHANGED
|
@@ -143,7 +143,7 @@ declare const _default: __VLS_WithTemplateSlots<DefineComponent<__VLS_WithDefaul
|
|
|
143
143
|
allowEmpty: string | boolean | null;
|
|
144
144
|
displayBy: string;
|
|
145
145
|
searchBy: string[];
|
|
146
|
-
options: any[];
|
|
146
|
+
options: any[] | readonly any[];
|
|
147
147
|
lazy: () => any[];
|
|
148
148
|
modelValue: any;
|
|
149
149
|
hideSearch: boolean;
|
|
@@ -236,7 +236,7 @@ export declare interface SelectProps {
|
|
|
236
236
|
/**
|
|
237
237
|
* The list of all options to select from.
|
|
238
238
|
*/
|
|
239
|
-
options?: Option_2[];
|
|
239
|
+
options?: Option_2[] | readonly Option_2[];
|
|
240
240
|
/**
|
|
241
241
|
* Lazily evaluate and set component `options`. Will execute upon user mouseover.
|
|
242
242
|
*/
|
package/dist/Step.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
1
|
+
import { defineComponent as x, useSlots as b, useCssModule as g, inject as y, computed as d, onBeforeMount as k, openBlock as i, createElementBlock as r, normalizeClass as a, unref as t, createElementVNode as n, createBlock as B, toDisplayString as w, createCommentVNode as u, createTextVNode as N, renderSlot as C } from "vue";
|
|
2
|
+
import { t as E } from "./locale.js";
|
|
3
|
+
import T from "./Icon.js";
|
|
4
|
+
import { S as z } from "./keys-7ecef029.js";
|
|
5
|
+
import { _ as M } from "./_plugin-vue_export-helper-dad06003.js";
|
|
6
|
+
import "lodash-es/get";
|
|
5
7
|
import "lodash-es/uniqueId";
|
|
6
8
|
import "./index-79ce320f.js";
|
|
7
9
|
import "./Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js";
|
|
8
|
-
const
|
|
9
|
-
key: 0,
|
|
10
|
-
class: "tw-mr-3 tw-flex tw-flex-col tw-items-center"
|
|
11
|
-
}, S = { key: 1 }, z = /* @__PURE__ */ v({
|
|
10
|
+
const S = { key: 1 }, I = /* @__PURE__ */ x({
|
|
12
11
|
__name: "Step",
|
|
13
12
|
props: {
|
|
14
13
|
active: { type: Boolean, default: !1 },
|
|
@@ -21,96 +20,124 @@ const N = {
|
|
|
21
20
|
loading: { type: Boolean, default: !1 }
|
|
22
21
|
},
|
|
23
22
|
setup(f) {
|
|
24
|
-
const e = f,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
const e = f, _ = b(), s = g(), l = y(z), c = d(() => (l == null ? void 0 : l.orientation) === "horizontal"), p = d(() => (l == null ? void 0 : l.theme) === "light"), o = l == null ? void 0 : l.showResponsiveNav, h = d(() => e.loading ? "working" : e.completed ? "circle-check" : "circle-info"), v = d(
|
|
24
|
+
() => E("ll.stepper.currentStep", { num: e.step, total: String(l == null ? void 0 : l.stepCount.value) })
|
|
25
|
+
);
|
|
26
|
+
return k(() => {
|
|
27
|
+
l && l.registerStep(e.nested);
|
|
28
|
+
}), (m, K) => (i(), r("li", {
|
|
29
|
+
class: a(["stash-step tw-relative tw-flex tw-w-full", [
|
|
30
|
+
t(s).step,
|
|
31
|
+
{
|
|
32
|
+
[t(s)["nested-step--active"]]: e.nested && e.active,
|
|
33
|
+
"last:tw-w-auto": c.value && !t(o),
|
|
34
|
+
[t(s)["stash-step--singular"]]: t(o),
|
|
35
|
+
"tw-relative tw-w-full tw-shrink-0 tw-snap-start tw-flex-col tw-justify-center": t(o)
|
|
36
|
+
}
|
|
31
37
|
]]),
|
|
32
38
|
"data-test": "stash-step"
|
|
33
39
|
}, [
|
|
34
|
-
e.nested ?
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
e.nested ? u("", !0) : (i(), r("div", {
|
|
41
|
+
key: 0,
|
|
42
|
+
class: a(["stash-step__indicator tw-flex tw-flex-col tw-items-center", { "tw-mr-3": !t(o) }]),
|
|
43
|
+
"data-test": "stash-step|indicator"
|
|
44
|
+
}, [
|
|
45
|
+
n("div", {
|
|
46
|
+
class: a([
|
|
47
|
+
t(s).circle,
|
|
38
48
|
{
|
|
39
|
-
[t(
|
|
40
|
-
[t(
|
|
41
|
-
[t(
|
|
42
|
-
[t(
|
|
43
|
-
[t(
|
|
49
|
+
[t(s)["circle--todo"]]: !e.error && !e.active && !e.completed,
|
|
50
|
+
[t(s)["circle--error"]]: e.error && !e.active,
|
|
51
|
+
[t(s)["circle--completed"]]: e.completed && !e.active,
|
|
52
|
+
[t(s)["circle--active"]]: e.active,
|
|
53
|
+
[t(s)["circle--loading"]]: e.loading
|
|
44
54
|
}
|
|
45
55
|
])
|
|
46
56
|
}, [
|
|
47
|
-
(e.completed || e.error || e.loading) && !e.active ? (
|
|
57
|
+
(e.completed || e.error || e.loading) && !e.active ? (i(), B(T, {
|
|
48
58
|
key: 0,
|
|
49
|
-
name:
|
|
50
|
-
class:
|
|
59
|
+
name: h.value,
|
|
60
|
+
class: a({ "fx-spin": e.loading }),
|
|
51
61
|
size: "dense"
|
|
52
|
-
}, null, 8, ["name", "class"])) : (
|
|
62
|
+
}, null, 8, ["name", "class"])) : (i(), r("span", S, w(e.step), 1))
|
|
53
63
|
], 2),
|
|
54
|
-
|
|
55
|
-
class:
|
|
56
|
-
t(
|
|
57
|
-
{ [t(
|
|
64
|
+
n("div", {
|
|
65
|
+
class: a(["tw-my-1.5 tw-w-px tw-bg-ice-500", [
|
|
66
|
+
t(s).line,
|
|
67
|
+
{ [t(s)["line--expanded"]]: e.completed || e.active, "tw-hidden": c.value }
|
|
58
68
|
]])
|
|
59
69
|
}, null, 2)
|
|
60
|
-
])),
|
|
61
|
-
|
|
62
|
-
class:
|
|
70
|
+
], 2)),
|
|
71
|
+
n("div", {
|
|
72
|
+
class: a(["tw-flex", [
|
|
63
73
|
{
|
|
64
74
|
"tw-w-full tw-flex-row tw-items-center": c.value,
|
|
65
|
-
"tw-
|
|
75
|
+
"tw-mt-1.5 tw-justify-center": t(o),
|
|
76
|
+
"tw-flex-col": !c.value || t(o)
|
|
66
77
|
}
|
|
67
78
|
]])
|
|
68
79
|
}, [
|
|
69
|
-
|
|
70
|
-
class:
|
|
71
|
-
t(
|
|
80
|
+
n("div", {
|
|
81
|
+
class: a(["stash-step__title tw-whitespace-nowrap", [
|
|
82
|
+
t(s).title,
|
|
72
83
|
{
|
|
73
84
|
"tw-cursor-pointer": !e.active && (e.completed || e.error),
|
|
74
85
|
"tw-cursor-not-allowed": e.disabled,
|
|
75
86
|
"tw-text-ice-900": p.value,
|
|
76
87
|
"!tw-font-semibold": e.active,
|
|
77
|
-
"tw-text-white": !e.disabled && !p.value
|
|
88
|
+
"tw-text-white": !e.disabled && !p.value,
|
|
89
|
+
"tw-place-self-center": t(o)
|
|
78
90
|
}
|
|
79
|
-
]])
|
|
80
|
-
|
|
81
|
-
|
|
91
|
+
]]),
|
|
92
|
+
"data-test": "stash-step|title"
|
|
93
|
+
}, [
|
|
94
|
+
N(w(e.text) + " ", 1),
|
|
95
|
+
t(o) ? (i(), r("p", {
|
|
96
|
+
key: 0,
|
|
97
|
+
class: a(["stash-step__pagination-label tw-mb-0 tw-whitespace-nowrap tw-text-center tw-text-xs", p.value ? "tw-text-ice-700" : "tw-text-white"]),
|
|
98
|
+
"data-test": "stash-step|pagination-label"
|
|
99
|
+
}, w(v.value), 3)) : u("", !0)
|
|
100
|
+
], 2),
|
|
101
|
+
c.value ? (i(), r("div", {
|
|
82
102
|
key: 0,
|
|
83
|
-
class:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
103
|
+
class: a([
|
|
104
|
+
t(s).line,
|
|
105
|
+
{
|
|
106
|
+
[t(s)["line--expanded"]]: e.completed || e.active,
|
|
107
|
+
"tw-mx-1.5 tw-border-t group-last:tw-hidden": !t(o)
|
|
108
|
+
}
|
|
109
|
+
])
|
|
110
|
+
}, null, 2)) : u("", !0),
|
|
111
|
+
n("div", {
|
|
112
|
+
class: a(["stash-step--nested-steps", { "tw-pb-9": !m.nested && !t(_).default, "tw-hidden": c.value }])
|
|
87
113
|
}, [
|
|
88
|
-
|
|
89
|
-
class:
|
|
114
|
+
n("ul", {
|
|
115
|
+
class: a([t(s).nested, { "tw-hidden": !t(_).default }])
|
|
90
116
|
}, [
|
|
91
|
-
|
|
117
|
+
C(m.$slots, "default")
|
|
92
118
|
], 2)
|
|
93
119
|
], 2)
|
|
94
120
|
], 2)
|
|
95
121
|
], 2));
|
|
96
122
|
}
|
|
97
|
-
}),
|
|
98
|
-
step:
|
|
99
|
-
title:
|
|
100
|
-
"nested-step--active": "_nested-step--
|
|
101
|
-
line:
|
|
102
|
-
"line--expanded": "_line--
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
"circle--
|
|
106
|
-
"circle--
|
|
107
|
-
"circle--
|
|
108
|
-
"circle--
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
123
|
+
}), R = "_step_1h5eb_2", V = "_title_1h5eb_11", P = "_line_1h5eb_22", $ = "_circle_1h5eb_62", D = "_nested_1h5eb_18", H = {
|
|
124
|
+
step: R,
|
|
125
|
+
title: V,
|
|
126
|
+
"nested-step--active": "_nested-step--active_1h5eb_18",
|
|
127
|
+
line: P,
|
|
128
|
+
"line--expanded": "_line--expanded_1h5eb_27",
|
|
129
|
+
"stash-step--singular": "_stash-step--singular_1h5eb_31",
|
|
130
|
+
circle: $,
|
|
131
|
+
"circle--todo": "_circle--todo_1h5eb_73",
|
|
132
|
+
"circle--active": "_circle--active_1h5eb_79",
|
|
133
|
+
"circle--loading": "_circle--loading_1h5eb_85",
|
|
134
|
+
"circle--completed": "_circle--completed_1h5eb_92",
|
|
135
|
+
"circle--error": "_circle--error_1h5eb_99",
|
|
136
|
+
nested: D
|
|
137
|
+
}, J = {
|
|
138
|
+
$style: H
|
|
139
|
+
}, W = /* @__PURE__ */ M(I, [["__cssModules", J]]);
|
|
113
140
|
export {
|
|
114
|
-
|
|
141
|
+
W as default
|
|
115
142
|
};
|
|
116
143
|
//# sourceMappingURL=Step.js.map
|
package/dist/Step.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Step.js","sources":["../src/components/Step/Step.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, inject, onBeforeMount, useCssModule, useSlots } from 'vue';\n\n import Icon from '../Icon/Icon.vue';\n import { STEPPER_INJECTION_KEY } from '../Stepper/keys';\n\n export interface StepProps {\n /**\n * Indicates if the step is currently active.\n * This takes precedence over `completed` and `error`\n */\n active?: boolean;\n /**\n * Indicates if the step is completed\n */\n completed?: boolean;\n /**\n * Indicates if the step has an error\n * This takes precedence over `completed`\n */\n error?: boolean;\n /**\n * The text to display in the step.\n */\n text: string;\n /**\n * Indicates if the step is nested\n */\n nested?: boolean;\n /**\n * The text to display in the step circle\n */\n step?: string;\n /**\n * Indicates if the step is disabled\n */\n disabled?: boolean;\n /**\n * Indicates if the step is in a loading state\n */\n loading?: boolean;\n }\n\n const props = withDefaults(defineProps<StepProps>(), {\n active: false,\n completed: false,\n error: false,\n nested: false,\n step: undefined,\n disabled: false,\n loading: false,\n });\n\n const slots = useSlots();\n const classes = useCssModule();\n\n const injectedStepper = inject(STEPPER_INJECTION_KEY);\n\n const isHorizontal = computed(() => injectedStepper?.orientation === 'horizontal');\n\n const isLightThemed = computed(() => injectedStepper?.theme === 'light');\n\n const iconName = computed(() => {\n if (props.loading) {\n return 'working';\n }\n return props.completed ? 'circle-check' : 'circle-info';\n });\n\n // OnBeforeMount ensures that steps and substeps are registered in the correct order\n onBeforeMount(() => {\n if (injectedStepper) {\n injectedStepper.registerStep(props.nested);\n }\n });\n</script>\n\n<template>\n <li\n class=\"stash-step tw-relative tw-flex tw-w-full\"\n data-test=\"stash-step\"\n :class=\"[\n classes.step,\n {
|
|
1
|
+
{"version":3,"file":"Step.js","sources":["../src/components/Step/Step.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, inject, onBeforeMount, useCssModule, useSlots } from 'vue';\n\n import { t } from '../../locale';\n import Icon from '../Icon/Icon.vue';\n import { STEPPER_INJECTION_KEY } from '../Stepper/keys';\n\n export interface StepProps {\n /**\n * Indicates if the step is currently active.\n * This takes precedence over `completed` and `error`\n */\n active?: boolean;\n /**\n * Indicates if the step is completed\n */\n completed?: boolean;\n /**\n * Indicates if the step has an error\n * This takes precedence over `completed`\n */\n error?: boolean;\n /**\n * The text to display in the step.\n */\n text: string;\n /**\n * Indicates if the step is nested\n */\n nested?: boolean;\n /**\n * The text to display in the step circle\n */\n step?: string;\n /**\n * Indicates if the step is disabled\n */\n disabled?: boolean;\n /**\n * Indicates if the step is in a loading state\n */\n loading?: boolean;\n }\n\n const props = withDefaults(defineProps<StepProps>(), {\n active: false,\n completed: false,\n error: false,\n nested: false,\n step: undefined,\n disabled: false,\n loading: false,\n });\n\n const slots = useSlots();\n const classes = useCssModule();\n\n const injectedStepper = inject(STEPPER_INJECTION_KEY);\n\n const isHorizontal = computed(() => injectedStepper?.orientation === 'horizontal');\n\n const isLightThemed = computed(() => injectedStepper?.theme === 'light');\n\n const showResponsiveNav = injectedStepper?.showResponsiveNav;\n\n const iconName = computed(() => {\n if (props.loading) {\n return 'working';\n }\n return props.completed ? 'circle-check' : 'circle-info';\n });\n\n const currentStepText = computed(() =>\n t('ll.stepper.currentStep', { num: props.step, total: String(injectedStepper?.stepCount.value) }),\n );\n\n // OnBeforeMount ensures that steps and substeps are registered in the correct order\n onBeforeMount(() => {\n if (injectedStepper) {\n injectedStepper.registerStep(props.nested);\n }\n });\n</script>\n\n<template>\n <li\n class=\"stash-step tw-relative tw-flex tw-w-full\"\n data-test=\"stash-step\"\n :class=\"[\n classes.step,\n {\n [classes['nested-step--active']]: props.nested && props.active,\n 'last:tw-w-auto': isHorizontal && !showResponsiveNav,\n [classes['stash-step--singular']]: showResponsiveNav,\n 'tw-relative tw-w-full tw-shrink-0 tw-snap-start tw-flex-col tw-justify-center': showResponsiveNav,\n },\n ]\"\n >\n <div\n v-if=\"!props.nested\"\n class=\"stash-step__indicator tw-flex tw-flex-col tw-items-center\"\n :class=\"{ 'tw-mr-3': !showResponsiveNav }\"\n data-test=\"stash-step|indicator\"\n >\n <div\n :class=\"[\n classes.circle,\n {\n [classes['circle--todo']]: !props.error && !props.active && !props.completed,\n [classes['circle--error']]: props.error && !props.active,\n [classes['circle--completed']]: props.completed && !props.active,\n [classes['circle--active']]: props.active,\n [classes['circle--loading']]: props.loading,\n },\n ]\"\n >\n <Icon\n v-if=\"(props.completed || props.error || props.loading) && !props.active\"\n :name=\"iconName\"\n :class=\"{ 'fx-spin': props.loading }\"\n size=\"dense\"\n />\n <span v-else>{{ props.step }}</span>\n </div>\n <div\n class=\"tw-my-1.5 tw-w-px tw-bg-ice-500\"\n :class=\"[\n classes.line,\n { [classes['line--expanded']]: props.completed || props.active, 'tw-hidden': isHorizontal },\n ]\"\n />\n </div>\n <!-- step title, line(s), and nested steps -->\n <div\n class=\"tw-flex\"\n :class=\"[\n {\n 'tw-w-full tw-flex-row tw-items-center': isHorizontal,\n 'tw-mt-1.5 tw-justify-center': showResponsiveNav,\n 'tw-flex-col': !isHorizontal || showResponsiveNav,\n },\n ]\"\n >\n <div\n class=\"stash-step__title tw-whitespace-nowrap\"\n data-test=\"stash-step|title\"\n :class=\"[\n classes.title,\n {\n 'tw-cursor-pointer': !props.active && (props.completed || props.error),\n 'tw-cursor-not-allowed': props.disabled,\n 'tw-text-ice-900': isLightThemed,\n '!tw-font-semibold': props.active,\n 'tw-text-white': !props.disabled && !isLightThemed,\n 'tw-place-self-center': showResponsiveNav,\n },\n ]\"\n >\n {{ props.text }}\n <p\n v-if=\"showResponsiveNav\"\n class=\"stash-step__pagination-label tw-mb-0 tw-whitespace-nowrap tw-text-center tw-text-xs\"\n data-test=\"stash-step|pagination-label\"\n :class=\"isLightThemed ? 'tw-text-ice-700' : 'tw-text-white'\"\n >\n {{ currentStepText }}\n </p>\n </div>\n <div\n v-if=\"isHorizontal\"\n :class=\"[\n classes.line,\n {\n [classes['line--expanded']]: props.completed || props.active,\n 'tw-mx-1.5 tw-border-t group-last:tw-hidden': !showResponsiveNav,\n },\n ]\"\n />\n <div\n class=\"stash-step--nested-steps\"\n :class=\"{ 'tw-pb-9': !nested && !slots.default, 'tw-hidden': isHorizontal }\"\n >\n <ul :class=\"[classes.nested, { 'tw-hidden': !slots.default }]\">\n <!-- @slot Default slot to compose multiple nested steps -->\n <slot></slot>\n </ul>\n </div>\n </div>\n </li>\n</template>\n\n<style module>\n .step::before {\n content: '●';\n position: absolute;\n color: theme('colors.white');\n left: -28px;\n opacity: 0;\n transition: opacity 500ms cubic-bezier(0.85, 0, 0.15, 1);\n }\n\n .title {\n font-weight: theme('fontWeight.medium');\n font-size: 1rem;\n margin-top: 1px;\n user-select: none;\n }\n\n .nested-step--active::before {\n opacity: 1;\n }\n\n .line {\n flex-grow: 0;\n transition: flex-grow 500ms cubic-bezier(0.87, 0, 0.13, 1);\n }\n\n .line--expanded {\n flex-grow: 1;\n }\n\n .stash-step--singular .line {\n @apply tw-absolute\n tw-inset-x-0\n tw-top-3\n tw-h-px\n tw-border-t-0\n before:tw-absolute\n before:tw-left-0\n before:tw-right-2/4\n before:tw-mr-16\n before:tw-block\n before:tw-h-px\n before:tw-bg-ice-500\n after:tw-absolute\n after:tw-left-2/4\n after:tw-right-0\n after:tw-ml-16\n after:tw-block\n after:tw-h-px\n after:tw-bg-ice-500;\n }\n\n .stash-step--singular .line::after,\n .stash-step--singular .line::before {\n content: '';\n }\n\n .step:not(.stash-step--singular):last-child .line {\n display: none;\n }\n\n .circle {\n width: theme('spacing.6');\n height: theme('spacing.6');\n line-height: theme('spacing.6');\n border-radius: theme('borderRadius.full');\n display: grid;\n place-items: center;\n font-weight: theme('fontWeight.medium');\n transition: background-color 500ms, color 500ms;\n }\n\n .circle--todo {\n background-color: rgb(255 255 255 / 50%);\n color: #4d4a69;\n border: 1px solid #747293;\n }\n\n .circle--active {\n background-color: var(--color-blue-500);\n color: theme('colors.white');\n border: 1px solid transparent;\n }\n\n .circle--loading {\n background-color: theme('colors.white');\n border: 1px solid var(--color-ice-500);\n color: var(--color-ice-700);\n cursor: pointer;\n }\n\n .circle--completed {\n background-color: theme('colors.white');\n border: 1px solid var(--color-ice-500);\n color: var(--color-green-500);\n cursor: pointer;\n }\n\n .circle--error {\n background-color: theme('colors.white');\n border: 1px solid var(--color-ice-500);\n color: var(--color-red-500);\n cursor: pointer;\n }\n\n .nested {\n padding: calc(theme('spacing.3') + theme('spacing[1.5]')) 0;\n }\n\n .nested li + li {\n margin-top: theme('spacing.3');\n }\n\n .nested .title {\n font-weight: theme('fontWeight.normal');\n font-size: 0.9rem;\n }\n</style>\n"],"names":["slots","useSlots","classes","useCssModule","injectedStepper","inject","STEPPER_INJECTION_KEY","isHorizontal","computed","isLightThemed","showResponsiveNav","iconName","props","currentStepText","t","onBeforeMount"],"mappings":";;;;;;;;;;;;;;;;;;;;;;iBAsDQA,IAAQC,KACRC,IAAUC,KAEVC,IAAkBC,EAAOC,CAAqB,GAE9CC,IAAeC,EAAS,OAAMJ,KAAA,gBAAAA,EAAiB,iBAAgB,YAAY,GAE3EK,IAAgBD,EAAS,OAAMJ,KAAA,gBAAAA,EAAiB,WAAU,OAAO,GAEjEM,IAAoBN,KAAA,gBAAAA,EAAiB,mBAErCO,IAAWH,EAAS,MACpBI,EAAM,UACD,YAEFA,EAAM,YAAY,iBAAiB,aAC3C,GAEKC,IAAkBL;AAAA,MAAS,MAC/BM,EAAE,0BAA0B,EAAE,KAAKF,EAAM,MAAM,OAAO,OAAOR,KAAA,gBAAAA,EAAiB,UAAU,KAAK,GAAG;AAAA,IAAA;AAIlG,WAAAW,EAAc,MAAM;AAClB,MAAIX,KACcA,EAAA,aAAaQ,EAAM,MAAM;AAAA,IAC3C,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/Stepper.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { defineComponent as C, ref as I, computed as o, watch as r, watchEffect as g, provide as y, nextTick as E, openBlock as i, createElementBlock as N, createElementVNode as z, normalizeClass as p, renderSlot as T, createBlock as u, unref as d, withCtx as v, createVNode as m, createCommentVNode as f } from "vue";
|
|
2
|
+
import B from "./useMediaQuery.js";
|
|
3
|
+
import A from "./useStepper.js";
|
|
4
|
+
import h from "./Button.js";
|
|
5
|
+
import w from "./Icon.js";
|
|
6
|
+
import { S as R } from "./keys-7ecef029.js";
|
|
7
|
+
import "./Button.vue_used_vue_type_style_index_0_lang.module-63d31dc0.js";
|
|
8
|
+
import "./_plugin-vue_export-helper-dad06003.js";
|
|
9
|
+
import "lodash-es/uniqueId";
|
|
10
|
+
import "./index-79ce320f.js";
|
|
11
|
+
import "./Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js";
|
|
12
|
+
const V = { class: "tw-relative" }, F = /* @__PURE__ */ C({
|
|
5
13
|
__name: "Stepper",
|
|
6
14
|
props: {
|
|
7
15
|
step: { default: -1 },
|
|
@@ -11,43 +19,101 @@ const x = /* @__PURE__ */ i({
|
|
|
11
19
|
theme: { default: "dark" }
|
|
12
20
|
},
|
|
13
21
|
emits: ["update:step", "update:substep"],
|
|
14
|
-
setup(
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
(
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
|
|
22
|
+
setup(x, { expose: _, emit: n }) {
|
|
23
|
+
const t = x, l = I(), e = A({
|
|
24
|
+
linear: t.linear,
|
|
25
|
+
activeStep: t.step,
|
|
26
|
+
activeSubstep: t.substep,
|
|
27
|
+
ref: l
|
|
28
|
+
}), S = B("screen and (min-width: 961px)"), a = o(() => t.orientation === "horizontal" && !S.value), b = o(() => e.activeStepIndex.value <= 0), k = o(
|
|
29
|
+
() => !e.isStepCompleted(e.activeStepIndex.value) || e.activeStepIndex.value === e.steps.value.length - 1
|
|
30
|
+
);
|
|
31
|
+
r(
|
|
32
|
+
() => t.step,
|
|
33
|
+
(s) => e.activeStepIndex.value = s
|
|
34
|
+
), r(
|
|
35
|
+
() => t.substep,
|
|
36
|
+
(s) => e.activeSubstepIndex.value = s
|
|
37
|
+
), r(
|
|
38
|
+
() => e.activeStepIndex.value,
|
|
39
|
+
(s) => {
|
|
40
|
+
n("update:step", s), c();
|
|
41
|
+
}
|
|
42
|
+
), r(
|
|
43
|
+
() => e.activeSubstepIndex.value,
|
|
44
|
+
(s) => n("update:substep", s)
|
|
45
|
+
), g(() => {
|
|
46
|
+
a.value && c();
|
|
47
|
+
}), y(R, {
|
|
48
|
+
registerStep: e.registerStep,
|
|
49
|
+
orientation: t.orientation,
|
|
50
|
+
stepCount: e.stepCount,
|
|
51
|
+
theme: t.theme,
|
|
52
|
+
showResponsiveNav: a
|
|
53
|
+
}), _({
|
|
54
|
+
back: e.back,
|
|
55
|
+
next: e.next,
|
|
56
|
+
goTo: e.goTo,
|
|
57
|
+
isStepCompleted: e.isStepCompleted,
|
|
58
|
+
isStepActive: e.isStepActive
|
|
59
|
+
});
|
|
60
|
+
async function c() {
|
|
61
|
+
if (!a.value)
|
|
62
|
+
return;
|
|
63
|
+
await E();
|
|
64
|
+
const s = e.activeStepElement.value;
|
|
65
|
+
s && s.scrollIntoView({ behavior: "instant", inline: "start", block: "nearest" });
|
|
66
|
+
}
|
|
67
|
+
return (s, L) => (i(), N("div", V, [
|
|
68
|
+
z("ul", {
|
|
69
|
+
ref_key: "stepperListRef",
|
|
70
|
+
ref: l,
|
|
71
|
+
class: p(["stash-stepper tw-flex", {
|
|
72
|
+
"tw-flex-col": t.orientation === "vertical",
|
|
73
|
+
"stash-stepper--vertical": t.orientation === "vertical",
|
|
74
|
+
"stash-stepper--horizontal": t.orientation === "horizontal",
|
|
75
|
+
"tw-mx-9 tw-snap-x tw-snap-mandatory tw-overflow-x-hidden": a.value
|
|
76
|
+
}]),
|
|
77
|
+
"data-test": "stash-stepper"
|
|
78
|
+
}, [
|
|
79
|
+
T(s.$slots, "default")
|
|
80
|
+
], 2),
|
|
81
|
+
a.value ? (i(), u(h, {
|
|
82
|
+
key: 0,
|
|
83
|
+
class: p(["stash-stepper__arrow stash-stepper__arrow--prev", t.theme === "light" ? "tw-text-blue-500" : "tw-text-white"]),
|
|
84
|
+
"data-test": "stash-stepper|prev-arrow",
|
|
85
|
+
disabled: b.value,
|
|
86
|
+
icon: "",
|
|
87
|
+
onClick: d(e).back
|
|
88
|
+
}, {
|
|
89
|
+
default: v(() => [
|
|
90
|
+
m(w, {
|
|
91
|
+
name: "chevron-left",
|
|
92
|
+
size: "dense"
|
|
93
|
+
})
|
|
94
|
+
]),
|
|
95
|
+
_: 1
|
|
96
|
+
}, 8, ["class", "disabled", "onClick"])) : f("", !0),
|
|
97
|
+
a.value ? (i(), u(h, {
|
|
98
|
+
key: 1,
|
|
99
|
+
class: p(["stash-stepper__arrow stash-stepper__arrow--next", t.theme === "light" ? "tw-text-blue-500" : "tw-text-white"]),
|
|
100
|
+
"data-test": "stash-stepper|next-arrow",
|
|
101
|
+
disabled: k.value,
|
|
102
|
+
icon: "",
|
|
103
|
+
onClick: d(e).next
|
|
104
|
+
}, {
|
|
105
|
+
default: v(() => [
|
|
106
|
+
m(w, {
|
|
107
|
+
name: "chevron-right",
|
|
108
|
+
size: "dense"
|
|
109
|
+
})
|
|
110
|
+
]),
|
|
111
|
+
_: 1
|
|
112
|
+
}, 8, ["class", "disabled", "onClick"])) : f("", !0)
|
|
113
|
+
]));
|
|
48
114
|
}
|
|
49
115
|
});
|
|
50
116
|
export {
|
|
51
|
-
|
|
117
|
+
F as default
|
|
52
118
|
};
|
|
53
119
|
//# sourceMappingURL=Stepper.js.map
|
package/dist/Stepper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stepper.js","sources":["../src/components/Stepper/Stepper.vue"],"sourcesContent":["<script lang=\"ts\">\n import { StepperOrientation, StepperTheme } from './Stepper.types';\n export * from './Stepper.types';\n\n export interface StepperProps {\n /**\n * The current step index\n */\n step?: number;\n /**\n * The current substep index\n */\n substep?: number;\n /**\n * A linear stepper prevents navigation to steps that are ahead of the completed ones\n */\n linear?: boolean;\n /**\n * Determines whether the stepper is horizontal or vertical\n */\n orientation?: StepperOrientation;\n /**\n * Determines the theme of the stepper\n */\n theme?: StepperTheme;\n }\n</script>\n\n<script setup lang=\"ts\">\n import { provide, watch } from 'vue';\n\n import useStepper from '../../composables/useStepper/useStepper';\n import { STEPPER_INJECTION_KEY } from './keys';\n\n const props = withDefaults(defineProps<StepperProps>(), {\n step: -1,\n substep: -1,\n linear: false,\n orientation: 'vertical',\n theme: 'dark',\n });\n\n const emit =\n defineEmits<{\n /**\n * Emitted when the step changes\n */\n (e: 'update:step', step: number): void;\n /**\n * Emitted when the substep changes\n */\n (e: 'update:substep', substep: number): void;\n }>();\n\n const stepper = useStepper({
|
|
1
|
+
{"version":3,"file":"Stepper.js","sources":["../src/components/Stepper/Stepper.vue"],"sourcesContent":["<script lang=\"ts\">\n import { StepperOrientation, StepperTheme } from './Stepper.types';\n export * from './Stepper.types';\n\n export interface StepperProps {\n /**\n * The current step index\n */\n step?: number;\n /**\n * The current substep index\n */\n substep?: number;\n /**\n * A linear stepper prevents navigation to steps that are ahead of the completed ones\n */\n linear?: boolean;\n /**\n * Determines whether the stepper is horizontal or vertical\n */\n orientation?: StepperOrientation;\n /**\n * Determines the theme of the stepper\n */\n theme?: StepperTheme;\n }\n</script>\n\n<script setup lang=\"ts\">\n import { computed, nextTick, provide, ref, watch, watchEffect } from 'vue';\n\n import useMediaQuery from '../../composables/useMediaQuery/useMediaQuery';\n import useStepper from '../../composables/useStepper/useStepper';\n import Button from '../Button/Button.vue';\n import Icon from '../Icon/Icon.vue';\n import { STEPPER_INJECTION_KEY } from './keys';\n\n const props = withDefaults(defineProps<StepperProps>(), {\n step: -1,\n substep: -1,\n linear: false,\n orientation: 'vertical',\n theme: 'dark',\n });\n\n const emit =\n defineEmits<{\n /**\n * Emitted when the step changes\n */\n (e: 'update:step', step: number): void;\n /**\n * Emitted when the substep changes\n */\n (e: 'update:substep', substep: number): void;\n }>();\n\n const stepperListRef = ref();\n const stepper = useStepper({\n linear: props.linear,\n activeStep: props.step,\n activeSubstep: props.substep,\n ref: stepperListRef,\n });\n\n const isLargeScreen = useMediaQuery('screen and (min-width: 961px)');\n const showResponsiveNav = computed(() => props.orientation === 'horizontal' && !isLargeScreen.value);\n const isPrevArrowDisabled = computed(() => stepper.activeStepIndex.value <= 0);\n const isNextArrowDisabled = computed(\n () =>\n !stepper.isStepCompleted(stepper.activeStepIndex.value) ||\n stepper.activeStepIndex.value === stepper.steps.value.length - 1,\n );\n\n watch(\n () => props.step,\n (value) => (stepper.activeStepIndex.value = value),\n );\n\n watch(\n () => props.substep,\n (value) => (stepper.activeSubstepIndex.value = value),\n );\n\n watch(\n () => stepper.activeStepIndex.value,\n (value) => {\n emit('update:step', value);\n scrollToStep();\n },\n );\n\n watch(\n () => stepper.activeSubstepIndex.value,\n (value) => emit('update:substep', value),\n );\n\n /**\n * Watches for media query changes to determine if the mobile horizontal stepper is active.\n * This is done to ensure the mobile stepper remains in sync with any step changes at the desktop view.\n */\n watchEffect(() => {\n if (showResponsiveNav.value) {\n scrollToStep();\n }\n });\n\n provide(STEPPER_INJECTION_KEY, {\n registerStep: stepper.registerStep,\n orientation: props.orientation,\n stepCount: stepper.stepCount,\n theme: props.theme,\n showResponsiveNav,\n });\n\n defineExpose({\n back: stepper.back,\n next: stepper.next,\n goTo: stepper.goTo,\n isStepCompleted: stepper.isStepCompleted,\n isStepActive: stepper.isStepActive,\n });\n\n /**\n * Scrolls to the active step when the horizontal stepper is active.\n * This limited to top-level steps only.\n */\n async function scrollToStep() {\n if (!showResponsiveNav.value) {\n return;\n }\n\n // allows the DOM to update before scrolling to the active step.\n await nextTick();\n\n const step = stepper.activeStepElement.value;\n\n if (step) {\n step.scrollIntoView({ behavior: 'instant', inline: 'start', block: 'nearest' });\n }\n }\n</script>\n\n<template>\n <div class=\"tw-relative\">\n <ul\n ref=\"stepperListRef\"\n class=\"stash-stepper tw-flex\"\n :class=\"{\n 'tw-flex-col': props.orientation === 'vertical',\n 'stash-stepper--vertical': props.orientation === 'vertical',\n 'stash-stepper--horizontal': props.orientation === 'horizontal',\n 'tw-mx-9 tw-snap-x tw-snap-mandatory tw-overflow-x-hidden': showResponsiveNav,\n }\"\n data-test=\"stash-stepper\"\n >\n <!-- @slot Default slot to compose multiple steps -->\n <slot></slot>\n </ul>\n <Button\n v-if=\"showResponsiveNav\"\n class=\"stash-stepper__arrow stash-stepper__arrow--prev\"\n :class=\"props.theme === 'light' ? 'tw-text-blue-500' : 'tw-text-white'\"\n data-test=\"stash-stepper|prev-arrow\"\n :disabled=\"isPrevArrowDisabled\"\n icon\n @click=\"stepper.back\"\n >\n <Icon name=\"chevron-left\" size=\"dense\" />\n </Button>\n <Button\n v-if=\"showResponsiveNav\"\n class=\"stash-stepper__arrow stash-stepper__arrow--next\"\n :class=\"props.theme === 'light' ? 'tw-text-blue-500' : 'tw-text-white'\"\n data-test=\"stash-stepper|next-arrow\"\n :disabled=\"isNextArrowDisabled\"\n icon\n @click=\"stepper.next\"\n >\n <Icon name=\"chevron-right\" size=\"dense\" />\n </Button>\n </div>\n</template>\n\n<style>\n .stash-stepper--vertical .stash-step:last-child .stash-step--nested-steps {\n @apply tw-hidden;\n }\n\n .stash-stepper__arrow {\n @apply tw-absolute\n tw-top-0\n tw-flex\n tw-h-6\n tw-w-6\n tw-min-w-auto\n tw-items-center\n tw-justify-center\n tw-rounded-full\n tw-border\n tw-border-solid\n tw-border-ice-500\n tw-text-center\n disabled:tw-text-ice-500 disabled:tw-opacity-50;\n }\n\n .stash-stepper__arrow--prev {\n @apply tw-left-0;\n }\n\n .stash-stepper__arrow--next {\n @apply tw-right-0;\n }\n</style>\n"],"names":["stepperListRef","ref","stepper","useStepper","props","isLargeScreen","useMediaQuery","showResponsiveNav","computed","isPrevArrowDisabled","isNextArrowDisabled","watch","value","emit","scrollToStep","watchEffect","provide","STEPPER_INJECTION_KEY","__expose","nextTick","step"],"mappings":";;;;;;;;;;;;;;;;;;;;;;iBAyDQA,IAAiBC,KACjBC,IAAUC,EAAW;AAAA,MACzB,QAAQC,EAAM;AAAA,MACd,YAAYA,EAAM;AAAA,MAClB,eAAeA,EAAM;AAAA,MACrB,KAAKJ;AAAA,IAAA,CACN,GAEKK,IAAgBC,EAAc,+BAA+B,GAC7DC,IAAoBC,EAAS,MAAMJ,EAAM,gBAAgB,gBAAgB,CAACC,EAAc,KAAK,GAC7FI,IAAsBD,EAAS,MAAMN,EAAQ,gBAAgB,SAAS,CAAC,GACvEQ,IAAsBF;AAAA,MAC1B,MACE,CAACN,EAAQ,gBAAgBA,EAAQ,gBAAgB,KAAK,KACtDA,EAAQ,gBAAgB,UAAUA,EAAQ,MAAM,MAAM,SAAS;AAAA,IAAA;AAGnE,IAAAS;AAAA,MACE,MAAMP,EAAM;AAAA,MACZ,CAACQ,MAAWV,EAAQ,gBAAgB,QAAQU;AAAA,IAAA,GAG9CD;AAAA,MACE,MAAMP,EAAM;AAAA,MACZ,CAACQ,MAAWV,EAAQ,mBAAmB,QAAQU;AAAA,IAAA,GAGjDD;AAAA,MACE,MAAMT,EAAQ,gBAAgB;AAAA,MAC9B,CAACU,MAAU;AACT,QAAAC,EAAK,eAAeD,CAAK,GACZE;MACf;AAAA,IAAA,GAGFH;AAAA,MACE,MAAMT,EAAQ,mBAAmB;AAAA,MACjC,CAACU,MAAUC,EAAK,kBAAkBD,CAAK;AAAA,IAAA,GAOzCG,EAAY,MAAM;AAChB,MAAIR,EAAkB,SACPO;IACf,CACD,GAEDE,EAAQC,GAAuB;AAAA,MAC7B,cAAcf,EAAQ;AAAA,MACtB,aAAaE,EAAM;AAAA,MACnB,WAAWF,EAAQ;AAAA,MACnB,OAAOE,EAAM;AAAA,MACb,mBAAAG;AAAA,IAAA,CACD,GAEYW,EAAA;AAAA,MACX,MAAMhB,EAAQ;AAAA,MACd,MAAMA,EAAQ;AAAA,MACd,MAAMA,EAAQ;AAAA,MACd,iBAAiBA,EAAQ;AAAA,MACzB,cAAcA,EAAQ;AAAA,IAAA,CACvB;AAMD,mBAAeY,IAAe;AACxB,UAAA,CAACP,EAAkB;AACrB;AAIF,YAAMY,EAAS;AAET,YAAAC,IAAOlB,EAAQ,kBAAkB;AAEvC,MAAIkB,KACGA,EAAA,eAAe,EAAE,UAAU,WAAW,QAAQ,SAAS,OAAO,WAAW;AAAA,IAElF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|