@xleddyl/443-components-vue 0.16.45 → 0.16.46

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.
@@ -7,6 +7,7 @@
7
7
  :aria-busy="form.submitting.value ? 'true' : void 0"
8
8
  @submit="onSubmitEvent"
9
9
  @reset="onResetEvent"
10
+ @keydown="onKeydown"
10
11
  >
11
12
  <template v-if="alerts === 'start'">
12
13
  <slot name="alerts" :errors="rootErrors" :warnings="rootWarnings">
@@ -62,7 +62,7 @@
62
62
  size="lg"
63
63
  block
64
64
  trailing-icon="arrow-right"
65
- :loading="passwordForm.submitting.value"
65
+ :loading="passwordForm.submitting.value || signingIn"
66
66
  >
67
67
  {{ submitText }}
68
68
  </Button>
@@ -125,6 +125,7 @@ const view = ref(reason.value === SIGNED_OUT_REASON ? "signedOut" : "login");
125
125
  const email = ref("");
126
126
  const account = ref(null);
127
127
  const signedOutReady = ref(false);
128
+ const signingIn = ref(false);
128
129
  const content = ref();
129
130
  const emailText = computed(() => props.emailLabel ?? t("auth.email"));
130
131
  const passwordText = computed(() => props.passwordLabel ?? t("auth.password"));
@@ -145,7 +146,7 @@ const frame = computed(() => ({
145
146
  skipLabel: props.skipLabel
146
147
  }));
147
148
  const passwordStep = computed(
148
- () => view.value === "login" && step.value === "password" && !!email.value
149
+ () => signingIn.value || view.value === "login" && step.value === "password" && !!email.value
149
150
  );
150
151
  const title = computed(() => {
151
152
  if (view.value === "login") return props.title ?? t("auth.loginTitle");
@@ -176,7 +177,15 @@ const emailForm = useForm({
176
177
  });
177
178
  const passwordForm = useForm({
178
179
  schema: { password: { initial: "", required: true } },
179
- onSubmit: (values) => props.submit({ email: email.value, password: values.password }),
180
+ onSubmit: async (values) => {
181
+ signingIn.value = true;
182
+ try {
183
+ await props.submit({ email: email.value, password: values.password });
184
+ } catch (error) {
185
+ signingIn.value = false;
186
+ throw error;
187
+ }
188
+ },
180
189
  submitError: props.submitError
181
190
  });
182
191
  function normalizeEmail(value) {
@@ -206,7 +215,7 @@ function focusInput() {
206
215
  content.value?.querySelector("input:not([readonly])")?.focus();
207
216
  }
208
217
  watch(step, (value) => {
209
- if (value !== "password") passwordForm.reset();
218
+ if (value !== "password" && !signingIn.value) passwordForm.reset();
210
219
  });
211
220
  onMounted(() => {
212
221
  if (view.value === "signedOut") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xleddyl/443-components-vue",
3
- "version": "0.16.45",
3
+ "version": "0.16.46",
4
4
  "description": "Compact, scoped dashboard components for Vue and Nuxt",
5
5
  "license": "MIT",
6
6
  "author": "Edoardo Alberti (https://github.com/xleddyl)",