@leaflink/stash 48.0.0 → 48.1.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/dist/Stepper.js +17 -14
- package/dist/Stepper.js.map +1 -1
- package/dist/Stepper.vue.d.ts +7 -0
- package/package.json +1 -1
package/dist/Stepper.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as C, ref as I, computed as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { defineComponent as C, ref as I, computed as r, watch as o, watchEffect as g, provide as y, nextTick as N, openBlock as i, createElementBlock as E, createElementVNode as z, normalizeClass as p, renderSlot as B, createBlock as u, unref as d, withCtx as v, createVNode as m, createCommentVNode as f } from "vue";
|
|
2
|
+
import R from "./useMediaQuery.js";
|
|
3
|
+
import T from "./useStepper.js";
|
|
4
4
|
import h from "./Button.js";
|
|
5
5
|
import w from "./Icon.js";
|
|
6
|
-
import { S as
|
|
6
|
+
import { S as A } from "./keys-7ecef029.js";
|
|
7
7
|
import "./Button.vue_used_vue_type_style_index_0_lang.module-63d31dc0.js";
|
|
8
8
|
import "./_plugin-vue_export-helper-dad06003.js";
|
|
9
9
|
import "lodash-es/uniqueId";
|
|
@@ -16,35 +16,38 @@ const V = { class: "tw-relative" }, F = /* @__PURE__ */ C({
|
|
|
16
16
|
substep: { default: -1 },
|
|
17
17
|
linear: { type: Boolean, default: !1 },
|
|
18
18
|
orientation: { default: "vertical" },
|
|
19
|
+
useResponsiveNav: { type: Boolean, default: !1 },
|
|
19
20
|
theme: { default: "dark" }
|
|
20
21
|
},
|
|
21
22
|
emits: ["update:step", "update:substep"],
|
|
22
23
|
setup(x, { expose: _, emit: n }) {
|
|
23
|
-
const t = x, l = I(), e =
|
|
24
|
+
const t = x, l = I(), e = T({
|
|
24
25
|
linear: t.linear,
|
|
25
26
|
activeStep: t.step,
|
|
26
27
|
activeSubstep: t.substep,
|
|
27
28
|
ref: l
|
|
28
|
-
}), S =
|
|
29
|
+
}), S = R("screen and (min-width: 961px)"), a = r(
|
|
30
|
+
() => t.orientation === "horizontal" && (!S.value || t.useResponsiveNav)
|
|
31
|
+
), b = r(() => e.activeStepIndex.value <= 0), k = r(
|
|
29
32
|
() => !e.isStepCompleted(e.activeStepIndex.value) || e.activeStepIndex.value === e.steps.value.length - 1
|
|
30
33
|
);
|
|
31
|
-
|
|
34
|
+
o(
|
|
32
35
|
() => t.step,
|
|
33
36
|
(s) => e.activeStepIndex.value = s
|
|
34
|
-
),
|
|
37
|
+
), o(
|
|
35
38
|
() => t.substep,
|
|
36
39
|
(s) => e.activeSubstepIndex.value = s
|
|
37
|
-
),
|
|
40
|
+
), o(
|
|
38
41
|
() => e.activeStepIndex.value,
|
|
39
42
|
(s) => {
|
|
40
43
|
n("update:step", s), c();
|
|
41
44
|
}
|
|
42
|
-
),
|
|
45
|
+
), o(
|
|
43
46
|
() => e.activeSubstepIndex.value,
|
|
44
47
|
(s) => n("update:substep", s)
|
|
45
48
|
), g(() => {
|
|
46
49
|
a.value && c();
|
|
47
|
-
}), y(
|
|
50
|
+
}), y(A, {
|
|
48
51
|
registerStep: e.registerStep,
|
|
49
52
|
orientation: t.orientation,
|
|
50
53
|
stepCount: e.stepCount,
|
|
@@ -60,11 +63,11 @@ const V = { class: "tw-relative" }, F = /* @__PURE__ */ C({
|
|
|
60
63
|
async function c() {
|
|
61
64
|
if (!a.value)
|
|
62
65
|
return;
|
|
63
|
-
await
|
|
66
|
+
await N();
|
|
64
67
|
const s = e.activeStepElement.value;
|
|
65
68
|
s && s.scrollIntoView({ behavior: "instant", inline: "start", block: "nearest" });
|
|
66
69
|
}
|
|
67
|
-
return (s, L) => (i(),
|
|
70
|
+
return (s, L) => (i(), E("div", V, [
|
|
68
71
|
z("ul", {
|
|
69
72
|
ref_key: "stepperListRef",
|
|
70
73
|
ref: l,
|
|
@@ -76,7 +79,7 @@ const V = { class: "tw-relative" }, F = /* @__PURE__ */ C({
|
|
|
76
79
|
}]),
|
|
77
80
|
"data-test": "stash-stepper"
|
|
78
81
|
}, [
|
|
79
|
-
|
|
82
|
+
B(s.$slots, "default")
|
|
80
83
|
], 2),
|
|
81
84
|
a.value ? (i(), u(h, {
|
|
82
85
|
key: 0,
|
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 { 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":"
|
|
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 * Force responsive view on horizontal orientation\n */\n useResponsiveNav?: boolean;\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 useResponsiveNav: false,\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(\n () => props.orientation === 'horizontal' && (!isLargeScreen.value || props.useResponsiveNav),\n );\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":";;;;;;;;;;;;;;;;;;;;;;;iBA8DQA,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;AAAA,MACxB,MAAMJ,EAAM,gBAAgB,iBAAiB,CAACC,EAAc,SAASD,EAAM;AAAA,IAAA,GAEvEK,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/Stepper.vue.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ declare const _default: __VLS_WithTemplateSlots<DefineComponent<__VLS_WithDefaul
|
|
|
40
40
|
linear: boolean;
|
|
41
41
|
orientation: string;
|
|
42
42
|
theme: string;
|
|
43
|
+
useResponsiveNav: boolean;
|
|
43
44
|
}>, {
|
|
44
45
|
back: () => void;
|
|
45
46
|
next: () => void;
|
|
@@ -55,6 +56,7 @@ declare const _default: __VLS_WithTemplateSlots<DefineComponent<__VLS_WithDefaul
|
|
|
55
56
|
linear: boolean;
|
|
56
57
|
orientation: string;
|
|
57
58
|
theme: string;
|
|
59
|
+
useResponsiveNav: boolean;
|
|
58
60
|
}>>> & {
|
|
59
61
|
"onUpdate:step"?: ((step: number) => any) | undefined;
|
|
60
62
|
"onUpdate:substep"?: ((substep: number) => any) | undefined;
|
|
@@ -64,6 +66,7 @@ declare const _default: __VLS_WithTemplateSlots<DefineComponent<__VLS_WithDefaul
|
|
|
64
66
|
substep: number;
|
|
65
67
|
linear: boolean;
|
|
66
68
|
orientation: StepperOrientation;
|
|
69
|
+
useResponsiveNav: boolean;
|
|
67
70
|
}, {}>, {
|
|
68
71
|
default?(_: {}): any;
|
|
69
72
|
}>;
|
|
@@ -88,6 +91,10 @@ export declare interface StepperProps {
|
|
|
88
91
|
* Determines whether the stepper is horizontal or vertical
|
|
89
92
|
*/
|
|
90
93
|
orientation?: StepperOrientation;
|
|
94
|
+
/**
|
|
95
|
+
* Force responsive view on horizontal orientation
|
|
96
|
+
*/
|
|
97
|
+
useResponsiveNav?: boolean;
|
|
91
98
|
/**
|
|
92
99
|
* Determines the theme of the stepper
|
|
93
100
|
*/
|