Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activate Focus on Input elements #2808

Merged
merged 3 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions resources/js/components/forms/basic/InputText.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
:pt="props.pt"
:ptOptions="props.ptOptions"
:unstyled="props.unstyled"
:autofocus="props.autofocus"
@update:modelValue="($event) => emits('updated', $event)"
/>
</template>
Expand All @@ -19,17 +20,23 @@ import InputText, { InputTextPassThroughOptions } from "primevue/inputtext";
import type { PassThroughOptions } from "primevue/passthrough";
import type { DesignToken, Nullable, PassThrough } from "@primevue/core";

const props = defineProps<{
size?: "small" | "large" | undefined;
invalid?: boolean | undefined;
variant?: "outlined" | "filled" | undefined;
fluid?: boolean;
dt?: DesignToken<any>;
pt?: PassThrough<InputTextPassThroughOptions>;
ptOptions?: PassThroughOptions;
unstyled?: boolean;
class?: string;
}>();
const props = withDefaults(
defineProps<{
size?: "small" | "large" | undefined;
invalid?: boolean | undefined;
variant?: "outlined" | "filled" | undefined;
fluid?: boolean;
dt?: DesignToken<any>;
pt?: PassThrough<InputTextPassThroughOptions>;
ptOptions?: PassThroughOptions;
unstyled?: boolean;
class?: string;
autofocus?: boolean;
}>(),
{
autofocus: false,
},
);

const emits = defineEmits(["updated"]);
const modelValue = defineModel<Nullable<string>>();
Expand Down
6 changes: 3 additions & 3 deletions resources/js/components/forms/users/CreateEditUser.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<Dialog v-model:visible="visible" class="border-none max-w-lg w-full">
<Dialog v-model:visible="visible" modal class="border-none max-w-lg w-full">
<template #container="{ closeCallback }">
<div class="p-9 w-full flex flex-col gap-2 justify-center">
<FloatLabel class="w-full" variant="on">
<InputText id="username" v-model="username" aria-label="Username" />
<InputText id="username" v-model="username" aria-label="Username" :autofocus="true" />
<label class="" for="username">{{ $t("lychee.USERNAME") }}</label>
</FloatLabel>
<FloatLabel class="w-full" variant="on">
Expand Down Expand Up @@ -60,14 +60,14 @@
</template>
<script setup lang="ts">
import { Ref, ref, watch } from "vue";
import Dialog from "primevue/dialog";
import Button from "primevue/button";
import Checkbox from "primevue/checkbox";
import FloatLabel from "primevue/floatlabel";
import { useToast } from "primevue/usetoast";
import InputText from "@/components/forms/basic/InputText.vue";
import InputPassword from "@/components/forms/basic/InputPassword.vue";
import UserManagementService from "@/services/user-management-service";
import Dialog from "primevue/dialog";
import { useLycheeStateStore } from "@/stores/LycheeState";
import { storeToRefs } from "pinia";
import Textarea from "../basic/Textarea.vue";
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/modals/LoginModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</div>
<div class="inline-flex flex-col gap-2 px-9">
<FloatLabel variant="on">
<InputText id="username" v-model="username" autocomplete="username" />
<InputText id="username" v-model="username" autocomplete="username" :autofocus="true" />
<label class="" for="username">{{ $t("lychee.USERNAME") }}</label>
</FloatLabel>
</div>
Expand Down
Loading