Neues Design: Tailwind + shadcn-vue statt Vuetify/Material 3
Some checks failed
CI / PHP 8.4 / mariadb:10.6 (pull_request) Failing after 1m3s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m7s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Failing after 1m16s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Failing after 1m20s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m29s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m33s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 1m28s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m33s
CI / Build-Artefakte aktuell (pull_request) Failing after 52s
Some checks failed
CI / PHP 8.4 / mariadb:10.6 (pull_request) Failing after 1m3s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m7s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Failing after 1m16s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Failing after 1m20s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m29s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m33s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 1m28s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m33s
CI / Build-Artefakte aktuell (pull_request) Failing after 52s
- Nüchterne, professionelle Optik: neutrale Flächen, Markenfarbe nur als Akzent, Inter-Schrift (lokal) - Zweizeiliger Header mit Suche, Hauptnavigation und Avatar-Menü - Startseite mit Begrüßungskarte, Schnellzugriffen und „Neu im Team“ - Personenverzeichnis mit Suche, Abteilungsfilter und Seitenaufteilung - Markenfarbe exakt übernommen, Abstufungen serverseitig in OKLCH (ColorPalette) – gemeinsam für Portal und Admin, keine Farbberechnung im Browser - Schnellzugriffe im Admin pflegbar - Filament-Avatare lokal statt über ui-avatars.com (DSGVO) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9c0f8de791
commit
5a3f1f34c7
141 changed files with 3873 additions and 974 deletions
|
|
@ -1,8 +1,8 @@
|
|||
import '../css/app.css';
|
||||
import 'vue-sonner/style.css';
|
||||
|
||||
import { createApp, h } from 'vue';
|
||||
import { createInertiaApp } from '@inertiajs/vue3';
|
||||
import { createPortalVuetify } from './plugins/vuetify';
|
||||
|
||||
createInertiaApp({
|
||||
title: (title, page) => {
|
||||
|
|
@ -21,17 +21,11 @@ createInertiaApp({
|
|||
return page();
|
||||
},
|
||||
setup({ el, App, props, plugin }) {
|
||||
const shared = props.initialPage.props;
|
||||
|
||||
createApp({ render: () => h(App, props) })
|
||||
.use(plugin)
|
||||
.use(createPortalVuetify({
|
||||
primaryColor: shared.branding.primary_color,
|
||||
theme: shared.auth.user?.theme ?? 'system',
|
||||
}))
|
||||
.mount(el);
|
||||
},
|
||||
progress: {
|
||||
color: 'rgb(var(--v-theme-primary))',
|
||||
color: 'var(--brand)',
|
||||
},
|
||||
});
|
||||
|
|
|
|||
26
resources/js/components/BrandLogo.vue
Normal file
26
resources/js/components/BrandLogo.vue
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { usePage } from '@inertiajs/vue3';
|
||||
|
||||
defineProps({
|
||||
inverted: { type: Boolean, default: false },
|
||||
});
|
||||
|
||||
const branding = computed(() => usePage().props.branding);
|
||||
const monogram = computed(() => branding.value.portal_name.trim().charAt(0).toUpperCase());
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span class="flex items-center gap-3">
|
||||
<img v-if="branding.logo_url" :src="branding.logo_url" :alt="branding.portal_name" class="h-8 w-auto" />
|
||||
<template v-else>
|
||||
<span
|
||||
class="grid size-8 place-items-center rounded-md text-base font-bold"
|
||||
:class="inverted ? 'bg-white/15 text-white' : 'bg-brand text-brand-foreground'"
|
||||
>
|
||||
{{ monogram }}
|
||||
</span>
|
||||
<span class="text-[17px] font-semibold tracking-tight">{{ branding.portal_name }}</span>
|
||||
</template>
|
||||
</span>
|
||||
</template>
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { usePage } from '@inertiajs/vue3';
|
||||
|
||||
defineProps({
|
||||
height: { type: Number, default: 32 },
|
||||
});
|
||||
|
||||
const branding = computed(() => usePage().props.branding);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span class="d-inline-flex align-center ga-3">
|
||||
<img
|
||||
v-if="branding.logo_url"
|
||||
:src="branding.logo_url"
|
||||
:alt="branding.portal_name"
|
||||
:style="{ height: `${height}px`, width: 'auto' }"
|
||||
/>
|
||||
<span class="text-title-large font-weight-medium">{{ branding.portal_name }}</span>
|
||||
</span>
|
||||
</template>
|
||||
19
resources/js/components/FormField.vue
Normal file
19
resources/js/components/FormField.vue
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<script setup>
|
||||
import { Label } from '@/components/ui/label';
|
||||
|
||||
defineProps({
|
||||
id: { type: String, required: true },
|
||||
label: { type: String, required: true },
|
||||
error: { type: String, default: '' },
|
||||
hint: { type: String, default: '' },
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="grid content-start gap-1.5">
|
||||
<Label :for="id" class="text-[13px] font-medium">{{ label }}</Label>
|
||||
<slot />
|
||||
<p v-if="error" class="text-[13px] text-destructive">{{ error }}</p>
|
||||
<p v-else-if="hint" class="text-[13px] text-muted-foreground">{{ hint }}</p>
|
||||
</div>
|
||||
</template>
|
||||
32
resources/js/components/GreetingCard.vue
Normal file
32
resources/js/components/GreetingCard.vue
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<script setup>
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import { Building2, MapPin } from '@lucide/vue';
|
||||
import PersonAvatar from '@/components/PersonAvatar.vue';
|
||||
|
||||
defineProps({
|
||||
user: { type: Object, required: true },
|
||||
profile: { type: Object, required: true },
|
||||
greeting: { type: String, required: true },
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="overflow-hidden rounded-lg bg-brand text-brand-foreground">
|
||||
<div class="flex items-center gap-4 p-5">
|
||||
<PersonAvatar :person="user" class="size-[72px] ring-2 ring-white/40" />
|
||||
<div class="min-w-0">
|
||||
<div class="text-[13px] opacity-80">{{ greeting }},</div>
|
||||
<div class="truncate text-lg font-semibold">{{ user.name }}</div>
|
||||
<div v-if="profile.job_title" class="truncate text-[13px] opacity-85">{{ profile.job_title }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-x-5 gap-y-1 px-5 pb-4 text-[13px] opacity-85">
|
||||
<span v-if="profile.department" class="inline-flex items-center gap-1.5"><Building2 class="size-3.5" />{{ profile.department }}</span>
|
||||
<span v-if="profile.location" class="inline-flex items-center gap-1.5"><MapPin class="size-3.5" />{{ profile.location }}</span>
|
||||
</div>
|
||||
<div class="grid grid-cols-2 border-t border-white/15 text-[13px] font-medium">
|
||||
<Link :href="`/personen/${user.id}`" class="px-5 py-3 hover:bg-white/10">Mein Profil</Link>
|
||||
<Link href="/profil/bearbeiten" class="border-l border-white/15 px-5 py-3 hover:bg-white/10">Profil bearbeiten</Link>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
27
resources/js/components/Panel.vue
Normal file
27
resources/js/components/Panel.vue
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<script setup>
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import { ChevronRight } from '@lucide/vue';
|
||||
|
||||
defineProps({
|
||||
title: { type: String, default: '' },
|
||||
actionLabel: { type: String, default: '' },
|
||||
actionHref: { type: String, default: '' },
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="rounded-lg border bg-card text-card-foreground">
|
||||
<header v-if="title || $slots.actions" class="flex items-center justify-between gap-4 px-5 pt-4 pb-3">
|
||||
<h2 class="text-[15px] font-semibold">{{ title }}</h2>
|
||||
<slot name="actions">
|
||||
<Link v-if="actionHref" :href="actionHref" class="inline-flex items-center gap-0.5 text-[13px] font-medium text-brand-text hover:underline">
|
||||
{{ actionLabel }}
|
||||
<ChevronRight class="size-3.5" />
|
||||
</Link>
|
||||
</slot>
|
||||
</header>
|
||||
<div class="px-5 pb-5" :class="{ 'pt-5': !title && !$slots.actions }">
|
||||
<slot />
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
18
resources/js/components/PersonAvatar.vue
Normal file
18
resources/js/components/PersonAvatar.vue
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<script setup>
|
||||
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
defineProps({
|
||||
person: { type: Object, required: true },
|
||||
class: { type: [String, Array, Object], default: '' },
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Avatar :class="cn('size-10', $props.class)">
|
||||
<AvatarImage v-if="person.avatar_url" :src="person.avatar_url" :alt="person.name" />
|
||||
<AvatarFallback class="bg-brand-soft font-semibold text-brand-soft-foreground">
|
||||
{{ person.initials }}
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
</template>
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
<script setup>
|
||||
defineProps({
|
||||
user: { type: Object, required: true },
|
||||
size: { type: [Number, String], default: 40 },
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-avatar :size="size" color="primary-container">
|
||||
<v-img v-if="user.avatar_url" :src="user.avatar_url" :alt="user.name" cover />
|
||||
<span v-else class="text-on-primary-container font-weight-medium" :style="{ fontSize: `${Number(size) * 0.4}px` }">
|
||||
{{ user.initials }}
|
||||
</span>
|
||||
</v-avatar>
|
||||
</template>
|
||||
18
resources/js/components/ui/avatar/Avatar.vue
Normal file
18
resources/js/components/ui/avatar/Avatar.vue
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import { AvatarRoot } from "reka-ui"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes["class"]
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AvatarRoot
|
||||
data-slot="avatar"
|
||||
:class="cn('relative flex size-8 shrink-0 overflow-hidden rounded-full', props.class)"
|
||||
>
|
||||
<slot />
|
||||
</AvatarRoot>
|
||||
</template>
|
||||
21
resources/js/components/ui/avatar/AvatarFallback.vue
Normal file
21
resources/js/components/ui/avatar/AvatarFallback.vue
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<script setup lang="ts">
|
||||
import type { AvatarFallbackProps } from "reka-ui"
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import { reactiveOmit } from "@vueuse/core"
|
||||
import { AvatarFallback } from "reka-ui"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const props = defineProps<AvatarFallbackProps & { class?: HTMLAttributes["class"] }>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, "class")
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AvatarFallback
|
||||
data-slot="avatar-fallback"
|
||||
v-bind="delegatedProps"
|
||||
:class="cn('bg-muted flex size-full items-center justify-center rounded-full', props.class)"
|
||||
>
|
||||
<slot />
|
||||
</AvatarFallback>
|
||||
</template>
|
||||
16
resources/js/components/ui/avatar/AvatarImage.vue
Normal file
16
resources/js/components/ui/avatar/AvatarImage.vue
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<script setup lang="ts">
|
||||
import type { AvatarImageProps } from "reka-ui"
|
||||
import { AvatarImage } from "reka-ui"
|
||||
|
||||
const props = defineProps<AvatarImageProps>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AvatarImage
|
||||
data-slot="avatar-image"
|
||||
v-bind="props"
|
||||
class="aspect-square size-full"
|
||||
>
|
||||
<slot />
|
||||
</AvatarImage>
|
||||
</template>
|
||||
3
resources/js/components/ui/avatar/index.ts
Normal file
3
resources/js/components/ui/avatar/index.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export { default as Avatar } from "./Avatar.vue"
|
||||
export { default as AvatarFallback } from "./AvatarFallback.vue"
|
||||
export { default as AvatarImage } from "./AvatarImage.vue"
|
||||
26
resources/js/components/ui/badge/Badge.vue
Normal file
26
resources/js/components/ui/badge/Badge.vue
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<script setup lang="ts">
|
||||
import type { PrimitiveProps } from "reka-ui"
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import type { BadgeVariants } from "."
|
||||
import { reactiveOmit } from "@vueuse/core"
|
||||
import { Primitive } from "reka-ui"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { badgeVariants } from "."
|
||||
|
||||
const props = defineProps<PrimitiveProps & {
|
||||
variant?: BadgeVariants["variant"]
|
||||
class?: HTMLAttributes["class"]
|
||||
}>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, "class")
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Primitive
|
||||
data-slot="badge"
|
||||
:class="cn(badgeVariants({ variant }), props.class)"
|
||||
v-bind="delegatedProps"
|
||||
>
|
||||
<slot />
|
||||
</Primitive>
|
||||
</template>
|
||||
26
resources/js/components/ui/badge/index.ts
Normal file
26
resources/js/components/ui/badge/index.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import type { VariantProps } from "class-variance-authority"
|
||||
import { cva } from "class-variance-authority"
|
||||
|
||||
export { default as Badge } from "./Badge.vue"
|
||||
|
||||
export const badgeVariants = cva(
|
||||
"inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default:
|
||||
"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
|
||||
secondary:
|
||||
"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
|
||||
destructive:
|
||||
"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
||||
outline:
|
||||
"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: "default",
|
||||
},
|
||||
},
|
||||
)
|
||||
export type BadgeVariants = VariantProps<typeof badgeVariants>
|
||||
31
resources/js/components/ui/button/Button.vue
Normal file
31
resources/js/components/ui/button/Button.vue
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<script setup lang="ts">
|
||||
import type { PrimitiveProps } from "reka-ui"
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import type { ButtonVariants } from "."
|
||||
import { Primitive } from "reka-ui"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { buttonVariants } from "."
|
||||
|
||||
interface Props extends PrimitiveProps {
|
||||
variant?: ButtonVariants["variant"]
|
||||
size?: ButtonVariants["size"]
|
||||
class?: HTMLAttributes["class"]
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
as: "button",
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Primitive
|
||||
data-slot="button"
|
||||
:data-variant="variant"
|
||||
:data-size="size"
|
||||
:as="as"
|
||||
:as-child="asChild"
|
||||
:class="cn(buttonVariants({ variant, size }), props.class)"
|
||||
>
|
||||
<slot />
|
||||
</Primitive>
|
||||
</template>
|
||||
40
resources/js/components/ui/button/index.ts
Normal file
40
resources/js/components/ui/button/index.ts
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import type { VariantProps } from "class-variance-authority"
|
||||
import { cva } from "class-variance-authority"
|
||||
|
||||
export { default as Button } from "./Button.vue"
|
||||
|
||||
export const buttonVariants = cva(
|
||||
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default:
|
||||
"bg-primary text-primary-foreground hover:bg-primary/90",
|
||||
destructive:
|
||||
"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
||||
outline:
|
||||
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
||||
secondary:
|
||||
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
||||
ghost:
|
||||
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
||||
link: "text-primary underline-offset-4 hover:underline",
|
||||
},
|
||||
size: {
|
||||
"default": "h-9 px-4 py-2 has-[>svg]:px-3",
|
||||
"xs": "h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",
|
||||
"sm": "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
||||
"lg": "h-10 rounded-md px-6 has-[>svg]:px-4",
|
||||
"icon": "size-9",
|
||||
"icon-xs": "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3",
|
||||
"icon-sm": "size-8",
|
||||
"icon-lg": "size-10",
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: "default",
|
||||
size: "default",
|
||||
},
|
||||
},
|
||||
)
|
||||
export type ButtonVariants = VariantProps<typeof buttonVariants>
|
||||
35
resources/js/components/ui/checkbox/Checkbox.vue
Normal file
35
resources/js/components/ui/checkbox/Checkbox.vue
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<script setup lang="ts">
|
||||
import type { CheckboxRootEmits, CheckboxRootProps } from "reka-ui"
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import { Check } from "@lucide/vue"
|
||||
import { reactiveOmit } from "@vueuse/core"
|
||||
import { CheckboxIndicator, CheckboxRoot, useForwardPropsEmits } from "reka-ui"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const props = defineProps<CheckboxRootProps & { class?: HTMLAttributes["class"] }>()
|
||||
const emits = defineEmits<CheckboxRootEmits>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, "class")
|
||||
|
||||
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<CheckboxRoot
|
||||
v-slot="slotProps"
|
||||
data-slot="checkbox"
|
||||
v-bind="forwarded"
|
||||
:class="
|
||||
cn('peer border-input data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50',
|
||||
props.class)"
|
||||
>
|
||||
<CheckboxIndicator
|
||||
data-slot="checkbox-indicator"
|
||||
class="grid place-content-center text-current transition-none"
|
||||
>
|
||||
<slot v-bind="slotProps">
|
||||
<Check class="size-3.5" />
|
||||
</slot>
|
||||
</CheckboxIndicator>
|
||||
</CheckboxRoot>
|
||||
</template>
|
||||
1
resources/js/components/ui/checkbox/index.ts
Normal file
1
resources/js/components/ui/checkbox/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { default as Checkbox } from "./Checkbox.vue"
|
||||
19
resources/js/components/ui/dropdown-menu/DropdownMenu.vue
Normal file
19
resources/js/components/ui/dropdown-menu/DropdownMenu.vue
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<script setup lang="ts">
|
||||
import type { DropdownMenuRootEmits, DropdownMenuRootProps } from "reka-ui"
|
||||
import { DropdownMenuRoot, useForwardPropsEmits } from "reka-ui"
|
||||
|
||||
const props = defineProps<DropdownMenuRootProps>()
|
||||
const emits = defineEmits<DropdownMenuRootEmits>()
|
||||
|
||||
const forwarded = useForwardPropsEmits(props, emits)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<DropdownMenuRoot
|
||||
v-slot="slotProps"
|
||||
data-slot="dropdown-menu"
|
||||
v-bind="forwarded"
|
||||
>
|
||||
<slot v-bind="slotProps" />
|
||||
</DropdownMenuRoot>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<script setup lang="ts">
|
||||
import type { DropdownMenuCheckboxItemEmits, DropdownMenuCheckboxItemProps } from "reka-ui"
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import { Check } from "@lucide/vue"
|
||||
import { reactiveOmit } from "@vueuse/core"
|
||||
import {
|
||||
DropdownMenuCheckboxItem,
|
||||
DropdownMenuItemIndicator,
|
||||
useForwardPropsEmits,
|
||||
} from "reka-ui"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const props = defineProps<DropdownMenuCheckboxItemProps & { class?: HTMLAttributes["class"] }>()
|
||||
const emits = defineEmits<DropdownMenuCheckboxItemEmits>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, "class")
|
||||
|
||||
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<DropdownMenuCheckboxItem
|
||||
data-slot="dropdown-menu-checkbox-item"
|
||||
v-bind="forwarded"
|
||||
:class=" cn(
|
||||
`focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,
|
||||
props.class,
|
||||
)"
|
||||
>
|
||||
<span class="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
||||
<DropdownMenuItemIndicator>
|
||||
<slot name="indicator-icon">
|
||||
<Check class="size-4" />
|
||||
</slot>
|
||||
</DropdownMenuItemIndicator>
|
||||
</span>
|
||||
<slot />
|
||||
</DropdownMenuCheckboxItem>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<script setup lang="ts">
|
||||
import type { DropdownMenuContentEmits, DropdownMenuContentProps } from "reka-ui"
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import { reactiveOmit } from "@vueuse/core"
|
||||
import {
|
||||
DropdownMenuContent,
|
||||
DropdownMenuPortal,
|
||||
useForwardPropsEmits,
|
||||
} from "reka-ui"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
defineOptions({
|
||||
inheritAttrs: false,
|
||||
})
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<DropdownMenuContentProps & { class?: HTMLAttributes["class"] }>(),
|
||||
{
|
||||
sideOffset: 4,
|
||||
},
|
||||
)
|
||||
const emits = defineEmits<DropdownMenuContentEmits>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, "class")
|
||||
|
||||
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<DropdownMenuPortal>
|
||||
<DropdownMenuContent
|
||||
data-slot="dropdown-menu-content"
|
||||
v-bind="{ ...$attrs, ...forwarded }"
|
||||
:class="cn('bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--reka-dropdown-menu-content-available-height) min-w-[8rem] origin-(--reka-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md', props.class)"
|
||||
>
|
||||
<slot />
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenuPortal>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<script setup lang="ts">
|
||||
import type { DropdownMenuGroupProps } from "reka-ui"
|
||||
import { DropdownMenuGroup } from "reka-ui"
|
||||
|
||||
const props = defineProps<DropdownMenuGroupProps>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<DropdownMenuGroup
|
||||
data-slot="dropdown-menu-group"
|
||||
v-bind="props"
|
||||
>
|
||||
<slot />
|
||||
</DropdownMenuGroup>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<script setup lang="ts">
|
||||
import type { DropdownMenuItemProps } from "reka-ui"
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import { reactiveOmit } from "@vueuse/core"
|
||||
import { DropdownMenuItem, useForwardProps } from "reka-ui"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const props = withDefaults(defineProps<DropdownMenuItemProps & {
|
||||
class?: HTMLAttributes["class"]
|
||||
inset?: boolean
|
||||
variant?: "default" | "destructive"
|
||||
}>(), {
|
||||
variant: "default",
|
||||
})
|
||||
|
||||
const delegatedProps = reactiveOmit(props, "inset", "variant", "class")
|
||||
|
||||
const forwardedProps = useForwardProps(delegatedProps)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<DropdownMenuItem
|
||||
data-slot="dropdown-menu-item"
|
||||
:data-inset="inset ? '' : undefined"
|
||||
:data-variant="variant"
|
||||
v-bind="forwardedProps"
|
||||
:class="cn(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!`, props.class)"
|
||||
>
|
||||
<slot />
|
||||
</DropdownMenuItem>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<script setup lang="ts">
|
||||
import type { DropdownMenuLabelProps } from "reka-ui"
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import { reactiveOmit } from "@vueuse/core"
|
||||
import { DropdownMenuLabel, useForwardProps } from "reka-ui"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const props = defineProps<DropdownMenuLabelProps & { class?: HTMLAttributes["class"], inset?: boolean }>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, "class", "inset")
|
||||
const forwardedProps = useForwardProps(delegatedProps)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<DropdownMenuLabel
|
||||
data-slot="dropdown-menu-label"
|
||||
:data-inset="inset ? '' : undefined"
|
||||
v-bind="forwardedProps"
|
||||
:class="cn('px-2 py-1.5 text-sm font-medium data-[inset]:pl-8', props.class)"
|
||||
>
|
||||
<slot />
|
||||
</DropdownMenuLabel>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<script setup lang="ts">
|
||||
import type { DropdownMenuRadioGroupEmits, DropdownMenuRadioGroupProps } from "reka-ui"
|
||||
import {
|
||||
DropdownMenuRadioGroup,
|
||||
useForwardPropsEmits,
|
||||
} from "reka-ui"
|
||||
|
||||
const props = defineProps<DropdownMenuRadioGroupProps>()
|
||||
const emits = defineEmits<DropdownMenuRadioGroupEmits>()
|
||||
|
||||
const forwarded = useForwardPropsEmits(props, emits)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<DropdownMenuRadioGroup
|
||||
data-slot="dropdown-menu-radio-group"
|
||||
v-bind="forwarded"
|
||||
>
|
||||
<slot />
|
||||
</DropdownMenuRadioGroup>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<script setup lang="ts">
|
||||
import type { DropdownMenuRadioItemEmits, DropdownMenuRadioItemProps } from "reka-ui"
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import { Circle } from "@lucide/vue"
|
||||
import { reactiveOmit } from "@vueuse/core"
|
||||
import {
|
||||
DropdownMenuItemIndicator,
|
||||
DropdownMenuRadioItem,
|
||||
useForwardPropsEmits,
|
||||
} from "reka-ui"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const props = defineProps<DropdownMenuRadioItemProps & { class?: HTMLAttributes["class"] }>()
|
||||
|
||||
const emits = defineEmits<DropdownMenuRadioItemEmits>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, "class")
|
||||
|
||||
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<DropdownMenuRadioItem
|
||||
data-slot="dropdown-menu-radio-item"
|
||||
v-bind="forwarded"
|
||||
:class="cn(
|
||||
`focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,
|
||||
props.class,
|
||||
)"
|
||||
>
|
||||
<span class="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
||||
<DropdownMenuItemIndicator>
|
||||
<slot name="indicator-icon">
|
||||
<Circle class="size-2 fill-current" />
|
||||
</slot>
|
||||
</DropdownMenuItemIndicator>
|
||||
</span>
|
||||
<slot />
|
||||
</DropdownMenuRadioItem>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<script setup lang="ts">
|
||||
import type { DropdownMenuSeparatorProps } from "reka-ui"
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import { reactiveOmit } from "@vueuse/core"
|
||||
import {
|
||||
DropdownMenuSeparator,
|
||||
} from "reka-ui"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const props = defineProps<DropdownMenuSeparatorProps & {
|
||||
class?: HTMLAttributes["class"]
|
||||
}>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, "class")
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<DropdownMenuSeparator
|
||||
data-slot="dropdown-menu-separator"
|
||||
v-bind="delegatedProps"
|
||||
:class="cn('bg-border -mx-1 my-1 h-px', props.class)"
|
||||
/>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes["class"]
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span
|
||||
data-slot="dropdown-menu-shortcut"
|
||||
:class="cn('text-muted-foreground ml-auto text-xs tracking-widest', props.class)"
|
||||
>
|
||||
<slot />
|
||||
</span>
|
||||
</template>
|
||||
18
resources/js/components/ui/dropdown-menu/DropdownMenuSub.vue
Normal file
18
resources/js/components/ui/dropdown-menu/DropdownMenuSub.vue
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<script setup lang="ts">
|
||||
import type { DropdownMenuSubEmits, DropdownMenuSubProps } from "reka-ui"
|
||||
import {
|
||||
DropdownMenuSub,
|
||||
useForwardPropsEmits,
|
||||
} from "reka-ui"
|
||||
|
||||
const props = defineProps<DropdownMenuSubProps>()
|
||||
const emits = defineEmits<DropdownMenuSubEmits>()
|
||||
|
||||
const forwarded = useForwardPropsEmits(props, emits)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<DropdownMenuSub v-slot="slotProps" data-slot="dropdown-menu-sub" v-bind="forwarded">
|
||||
<slot v-bind="slotProps" />
|
||||
</DropdownMenuSub>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<script setup lang="ts">
|
||||
import type { DropdownMenuSubContentEmits, DropdownMenuSubContentProps } from "reka-ui"
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import { reactiveOmit } from "@vueuse/core"
|
||||
import {
|
||||
DropdownMenuSubContent,
|
||||
useForwardPropsEmits,
|
||||
} from "reka-ui"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const props = defineProps<DropdownMenuSubContentProps & { class?: HTMLAttributes["class"] }>()
|
||||
const emits = defineEmits<DropdownMenuSubContentEmits>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, "class")
|
||||
|
||||
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<DropdownMenuSubContent
|
||||
data-slot="dropdown-menu-sub-content"
|
||||
v-bind="forwarded"
|
||||
:class="cn('bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] max-w-(--reka-dropdown-menu-content-available-width) origin-(--reka-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg', props.class)"
|
||||
>
|
||||
<slot />
|
||||
</DropdownMenuSubContent>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<script setup lang="ts">
|
||||
import type { DropdownMenuSubTriggerProps } from "reka-ui"
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import { ChevronRight } from "@lucide/vue"
|
||||
import { reactiveOmit } from "@vueuse/core"
|
||||
import {
|
||||
DropdownMenuSubTrigger,
|
||||
useForwardProps,
|
||||
} from "reka-ui"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const props = defineProps<DropdownMenuSubTriggerProps & { class?: HTMLAttributes["class"], inset?: boolean }>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, "class", "inset")
|
||||
const forwardedProps = useForwardProps(delegatedProps)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<DropdownMenuSubTrigger
|
||||
data-slot="dropdown-menu-sub-trigger"
|
||||
v-bind="forwardedProps"
|
||||
:data-inset="inset ? '' : undefined"
|
||||
:class="cn(
|
||||
`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!`,
|
||||
props.class,
|
||||
)"
|
||||
>
|
||||
<slot />
|
||||
<ChevronRight class="ml-auto size-4" />
|
||||
</DropdownMenuSubTrigger>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<script setup lang="ts">
|
||||
import type { DropdownMenuTriggerProps } from "reka-ui"
|
||||
import { DropdownMenuTrigger, useForwardProps } from "reka-ui"
|
||||
|
||||
const props = defineProps<DropdownMenuTriggerProps>()
|
||||
|
||||
const forwardedProps = useForwardProps(props)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<DropdownMenuTrigger
|
||||
data-slot="dropdown-menu-trigger"
|
||||
v-bind="forwardedProps"
|
||||
>
|
||||
<slot />
|
||||
</DropdownMenuTrigger>
|
||||
</template>
|
||||
16
resources/js/components/ui/dropdown-menu/index.ts
Normal file
16
resources/js/components/ui/dropdown-menu/index.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
export { default as DropdownMenu } from "./DropdownMenu.vue"
|
||||
|
||||
export { default as DropdownMenuCheckboxItem } from "./DropdownMenuCheckboxItem.vue"
|
||||
export { default as DropdownMenuContent } from "./DropdownMenuContent.vue"
|
||||
export { default as DropdownMenuGroup } from "./DropdownMenuGroup.vue"
|
||||
export { default as DropdownMenuItem } from "./DropdownMenuItem.vue"
|
||||
export { default as DropdownMenuLabel } from "./DropdownMenuLabel.vue"
|
||||
export { default as DropdownMenuRadioGroup } from "./DropdownMenuRadioGroup.vue"
|
||||
export { default as DropdownMenuRadioItem } from "./DropdownMenuRadioItem.vue"
|
||||
export { default as DropdownMenuSeparator } from "./DropdownMenuSeparator.vue"
|
||||
export { default as DropdownMenuShortcut } from "./DropdownMenuShortcut.vue"
|
||||
export { default as DropdownMenuSub } from "./DropdownMenuSub.vue"
|
||||
export { default as DropdownMenuSubContent } from "./DropdownMenuSubContent.vue"
|
||||
export { default as DropdownMenuSubTrigger } from "./DropdownMenuSubTrigger.vue"
|
||||
export { default as DropdownMenuTrigger } from "./DropdownMenuTrigger.vue"
|
||||
export { DropdownMenuPortal } from "reka-ui"
|
||||
33
resources/js/components/ui/input/Input.vue
Normal file
33
resources/js/components/ui/input/Input.vue
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import { useVModel } from "@vueuse/core"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const props = defineProps<{
|
||||
defaultValue?: string | number
|
||||
modelValue?: string | number
|
||||
class?: HTMLAttributes["class"]
|
||||
}>()
|
||||
|
||||
const emits = defineEmits<{
|
||||
(e: "update:modelValue", payload: string | number): void
|
||||
}>()
|
||||
|
||||
const modelValue = useVModel(props, "modelValue", emits, {
|
||||
passive: true,
|
||||
defaultValue: props.defaultValue,
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<input
|
||||
v-model="modelValue"
|
||||
data-slot="input"
|
||||
:class="cn(
|
||||
'file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',
|
||||
'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-3',
|
||||
'aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',
|
||||
props.class,
|
||||
)"
|
||||
>
|
||||
</template>
|
||||
1
resources/js/components/ui/input/index.ts
Normal file
1
resources/js/components/ui/input/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { default as Input } from "./Input.vue"
|
||||
26
resources/js/components/ui/label/Label.vue
Normal file
26
resources/js/components/ui/label/Label.vue
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<script setup lang="ts">
|
||||
import type { LabelProps } from "reka-ui"
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import { reactiveOmit } from "@vueuse/core"
|
||||
import { Label } from "reka-ui"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const props = defineProps<LabelProps & { class?: HTMLAttributes["class"] }>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, "class")
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Label
|
||||
data-slot="label"
|
||||
v-bind="delegatedProps"
|
||||
:class="
|
||||
cn(
|
||||
'flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<slot />
|
||||
</Label>
|
||||
</template>
|
||||
1
resources/js/components/ui/label/index.ts
Normal file
1
resources/js/components/ui/label/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { default as Label } from "./Label.vue"
|
||||
29
resources/js/components/ui/separator/Separator.vue
Normal file
29
resources/js/components/ui/separator/Separator.vue
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<script setup lang="ts">
|
||||
import type { SeparatorProps } from "reka-ui"
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import { reactiveOmit } from "@vueuse/core"
|
||||
import { Separator } from "reka-ui"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const props = withDefaults(defineProps<
|
||||
SeparatorProps & { class?: HTMLAttributes["class"] }
|
||||
>(), {
|
||||
orientation: "horizontal",
|
||||
decorative: true,
|
||||
})
|
||||
|
||||
const delegatedProps = reactiveOmit(props, "class")
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Separator
|
||||
data-slot="separator"
|
||||
v-bind="delegatedProps"
|
||||
:class="
|
||||
cn(
|
||||
'bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
1
resources/js/components/ui/separator/index.ts
Normal file
1
resources/js/components/ui/separator/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { default as Separator } from "./Separator.vue"
|
||||
42
resources/js/components/ui/sonner/Sonner.vue
Normal file
42
resources/js/components/ui/sonner/Sonner.vue
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<script lang="ts" setup>
|
||||
import type { ToasterProps } from "vue-sonner"
|
||||
import { CircleCheckIcon, InfoIcon, Loader2Icon, OctagonXIcon, TriangleAlertIcon, XIcon } from "@lucide/vue"
|
||||
import { Toaster as Sonner } from "vue-sonner"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const props = defineProps<ToasterProps>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Sonner
|
||||
:class="cn('toaster group', props.class)"
|
||||
:style="{
|
||||
'--normal-bg': 'var(--popover)',
|
||||
'--normal-text': 'var(--popover-foreground)',
|
||||
'--normal-border': 'var(--border)',
|
||||
'--border-radius': 'var(--radius)',
|
||||
}"
|
||||
v-bind="props"
|
||||
>
|
||||
<template #success-icon>
|
||||
<CircleCheckIcon class="size-4" />
|
||||
</template>
|
||||
<template #info-icon>
|
||||
<InfoIcon class="size-4" />
|
||||
</template>
|
||||
<template #warning-icon>
|
||||
<TriangleAlertIcon class="size-4" />
|
||||
</template>
|
||||
<template #error-icon>
|
||||
<OctagonXIcon class="size-4" />
|
||||
</template>
|
||||
<template #loading-icon>
|
||||
<div>
|
||||
<Loader2Icon class="size-4 animate-spin" />
|
||||
</div>
|
||||
</template>
|
||||
<template #close-icon>
|
||||
<XIcon class="size-4" />
|
||||
</template>
|
||||
</Sonner>
|
||||
</template>
|
||||
1
resources/js/components/ui/sonner/index.ts
Normal file
1
resources/js/components/ui/sonner/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { default as Toaster } from "./Sonner.vue"
|
||||
28
resources/js/components/ui/textarea/Textarea.vue
Normal file
28
resources/js/components/ui/textarea/Textarea.vue
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import { useVModel } from "@vueuse/core"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes["class"]
|
||||
defaultValue?: string | number
|
||||
modelValue?: string | number
|
||||
}>()
|
||||
|
||||
const emits = defineEmits<{
|
||||
(e: "update:modelValue", payload: string | number): void
|
||||
}>()
|
||||
|
||||
const modelValue = useVModel(props, "modelValue", emits, {
|
||||
passive: true,
|
||||
defaultValue: props.defaultValue,
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<textarea
|
||||
v-model="modelValue"
|
||||
data-slot="textarea"
|
||||
:class="cn('border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm', props.class)"
|
||||
/>
|
||||
</template>
|
||||
1
resources/js/components/ui/textarea/index.ts
Normal file
1
resources/js/components/ui/textarea/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { default as Textarea } from "./Textarea.vue"
|
||||
|
|
@ -1,19 +1,27 @@
|
|||
import { router, usePage } from '@inertiajs/vue3';
|
||||
import { computed } from 'vue';
|
||||
import { useTheme } from 'vuetify';
|
||||
import { router, usePage } from '@inertiajs/vue3';
|
||||
|
||||
const media = typeof window !== 'undefined' ? window.matchMedia('(prefers-color-scheme: dark)') : null;
|
||||
|
||||
function apply(preference) {
|
||||
const dark = preference === 'dark' || (preference === 'system' && media?.matches);
|
||||
|
||||
document.documentElement.classList.toggle('dark', dark);
|
||||
document.documentElement.dataset.theme = preference;
|
||||
}
|
||||
|
||||
media?.addEventListener('change', () => apply(document.documentElement.dataset.theme ?? 'system'));
|
||||
|
||||
/**
|
||||
* Darstellung (System/Hell/Dunkel) der angemeldeten Person – wird sofort
|
||||
* angewendet und im Profil gespeichert.
|
||||
* Darstellung der angemeldeten Person (System/Hell/Dunkel) – sofort anwenden
|
||||
* und im Profil speichern.
|
||||
*/
|
||||
export function useThemePreference() {
|
||||
const theme = useTheme();
|
||||
const page = usePage();
|
||||
|
||||
const preference = computed(() => page.props.auth.user?.theme ?? 'system');
|
||||
|
||||
function setPreference(value) {
|
||||
theme.change(value);
|
||||
apply(value);
|
||||
router.put('/profil/darstellung', { theme: value }, { preserveScroll: true, preserveState: true });
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||
<script setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { Link, router, usePage } from '@inertiajs/vue3';
|
||||
import { useDisplay } from 'vuetify';
|
||||
import { Head, Link, router, usePage } from '@inertiajs/vue3';
|
||||
import { ChevronDown, LogOut, Monitor, Moon, Search, Settings, Sun, UserRound, UserRoundPen } from '@lucide/vue';
|
||||
import {
|
||||
mdiAccountCircleOutline,
|
||||
mdiAccountEditOutline,
|
||||
mdiCogOutline,
|
||||
mdiHomeOutline,
|
||||
mdiLogout,
|
||||
mdiMenu,
|
||||
mdiMonitor,
|
||||
mdiWeatherNight,
|
||||
mdiWhiteBalanceSunny,
|
||||
} from '@mdi/js';
|
||||
import BrandMark from '../components/BrandMark.vue';
|
||||
import UserAvatar from '../components/UserAvatar.vue';
|
||||
import { useThemePreference } from '../composables/useThemePreference';
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuLabel,
|
||||
DropdownMenuRadioGroup,
|
||||
DropdownMenuRadioItem,
|
||||
DropdownMenuSeparator,
|
||||
DropdownMenuTrigger,
|
||||
} from '@/components/ui/dropdown-menu';
|
||||
import { Toaster } from '@/components/ui/sonner';
|
||||
import BrandLogo from '@/components/BrandLogo.vue';
|
||||
import PersonAvatar from '@/components/PersonAvatar.vue';
|
||||
import { useThemePreference } from '@/composables/useThemePreference';
|
||||
|
||||
defineProps({
|
||||
title: { type: String, default: '' },
|
||||
|
|
@ -23,131 +23,123 @@ defineProps({
|
|||
|
||||
const page = usePage();
|
||||
const user = computed(() => page.props.auth.user);
|
||||
const { mdAndUp } = useDisplay();
|
||||
const drawer = ref(null);
|
||||
const navigation = computed(() => page.props.navigation);
|
||||
const { preference, setPreference } = useThemePreference();
|
||||
|
||||
const navigation = [
|
||||
{ title: 'Start', icon: mdiHomeOutline, href: '/', match: (url) => url === '/' },
|
||||
{ title: 'Mein Profil', icon: mdiAccountCircleOutline, href: '/profil', match: (url) => url.startsWith(`/personen/${user.value.id}`) },
|
||||
];
|
||||
const search = ref(new URLSearchParams(page.url.split('?')[1] ?? '').get('q') ?? '');
|
||||
|
||||
function submitSearch() {
|
||||
router.get('/personen', search.value ? { q: search.value } : {});
|
||||
}
|
||||
|
||||
const themeOptions = [
|
||||
{ value: 'system', title: 'System', icon: mdiMonitor },
|
||||
{ value: 'light', title: 'Hell', icon: mdiWhiteBalanceSunny },
|
||||
{ value: 'dark', title: 'Dunkel', icon: mdiWeatherNight },
|
||||
{ value: 'system', label: 'Wie im System', icon: Monitor },
|
||||
{ value: 'light', label: 'Hell', icon: Sun },
|
||||
{ value: 'dark', label: 'Dunkel', icon: Moon },
|
||||
];
|
||||
|
||||
function isActive(item) {
|
||||
return item.match(page.url.split('?')[0]);
|
||||
}
|
||||
|
||||
// Echte Links (Mittelklick, neuer Tab) – ein normaler Klick navigiert per Inertia.
|
||||
function visit(event, href) {
|
||||
if (event.metaKey || event.ctrlKey || event.shiftKey || event.button === 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
router.visit(href);
|
||||
}
|
||||
|
||||
function logout() {
|
||||
router.post('/logout');
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-app>
|
||||
<v-app-bar>
|
||||
<v-app-bar-nav-icon v-if="!mdAndUp" :icon="mdiMenu" aria-label="Menü" @click="drawer = !drawer" />
|
||||
<v-app-bar-title>
|
||||
<Link href="/" class="brand-link">
|
||||
<BrandMark />
|
||||
<Head v-if="title" :title="title" />
|
||||
|
||||
<div class="min-h-screen">
|
||||
<header class="sticky top-0 z-40 border-b bg-card/95 backdrop-blur supports-[backdrop-filter]:bg-card/85">
|
||||
<div class="mx-auto flex h-16 max-w-[1440px] items-center gap-4 px-4 lg:px-6">
|
||||
<Link href="/" class="shrink-0 text-foreground" aria-label="Startseite">
|
||||
<BrandLogo />
|
||||
</Link>
|
||||
</v-app-bar-title>
|
||||
|
||||
<template #append>
|
||||
<v-menu location="bottom end" :close-on-content-click="false" min-width="280">
|
||||
<template #activator="{ props: menuProps }">
|
||||
<v-btn v-bind="menuProps" icon variant="text" class="mr-2" :aria-label="`Menü für ${user.name}`">
|
||||
<UserAvatar :user="user" :size="40" />
|
||||
</v-btn>
|
||||
</template>
|
||||
<form class="mx-auto hidden w-full max-w-lg md:block" role="search" @submit.prevent="submitSearch">
|
||||
<label class="relative block">
|
||||
<span class="sr-only">Personen suchen</span>
|
||||
<Search class="pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground" />
|
||||
<input
|
||||
v-model="search"
|
||||
type="search"
|
||||
placeholder="Personen suchen …"
|
||||
class="h-10 w-full rounded-md border border-input bg-background pr-3 pl-9 text-sm placeholder:text-muted-foreground focus-visible:border-brand-400 focus-visible:ring-3 focus-visible:ring-ring/30 focus-visible:outline-none"
|
||||
/>
|
||||
</label>
|
||||
</form>
|
||||
|
||||
<v-card rounded="xl" color="surface-container-high" elevation="3">
|
||||
<div class="d-flex align-center ga-4 pa-4">
|
||||
<UserAvatar :user="user" :size="56" />
|
||||
<div class="overflow-hidden">
|
||||
<div class="text-title-medium text-truncate">{{ user.name }}</div>
|
||||
<div v-if="user.job_title" class="text-body-medium text-medium-emphasis text-truncate">{{ user.job_title }}</div>
|
||||
<div class="text-body-small text-medium-emphasis text-truncate">{{ user.email }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ml-auto flex items-center gap-1 md:ml-0">
|
||||
<Link href="/personen" class="grid size-10 place-items-center rounded-md text-muted-foreground hover:bg-accent md:hidden" aria-label="Personen suchen">
|
||||
<Search class="size-5" />
|
||||
</Link>
|
||||
|
||||
<v-divider />
|
||||
<a
|
||||
v-if="user.is_admin"
|
||||
href="/admin"
|
||||
class="hidden h-10 items-center gap-2 rounded-md px-3 text-sm font-medium text-foreground/80 hover:bg-accent hover:text-foreground lg:inline-flex"
|
||||
>
|
||||
<Settings class="size-[18px]" />
|
||||
Administration
|
||||
</a>
|
||||
|
||||
<v-list bg-color="transparent" density="comfortable">
|
||||
<v-list-item :prepend-icon="mdiAccountCircleOutline" title="Mein Profil" href="/profil" @click="visit($event, '/profil')" />
|
||||
<v-list-item :prepend-icon="mdiAccountEditOutline" title="Profil bearbeiten" href="/profil/bearbeiten" @click="visit($event, '/profil/bearbeiten')" />
|
||||
<v-list-item v-if="user.is_admin" :prepend-icon="mdiCogOutline" title="Administration" href="/admin" />
|
||||
</v-list>
|
||||
|
||||
<div class="px-4 pb-2">
|
||||
<div class="text-label-large text-medium-emphasis mb-2">Darstellung</div>
|
||||
<v-btn-toggle
|
||||
:model-value="preference"
|
||||
mandatory
|
||||
divided
|
||||
variant="outlined"
|
||||
density="comfortable"
|
||||
class="w-100"
|
||||
@update:model-value="setPreference"
|
||||
>
|
||||
<v-btn v-for="option in themeOptions" :key="option.value" :value="option.value" class="flex-grow-1" :prepend-icon="option.icon">
|
||||
{{ option.title }}
|
||||
</v-btn>
|
||||
</v-btn-toggle>
|
||||
</div>
|
||||
|
||||
<v-divider class="mt-2" />
|
||||
|
||||
<v-list bg-color="transparent" density="comfortable">
|
||||
<v-list-item :prepend-icon="mdiLogout" title="Abmelden" @click="logout" />
|
||||
</v-list>
|
||||
</v-card>
|
||||
</v-menu>
|
||||
</template>
|
||||
</v-app-bar>
|
||||
|
||||
<v-navigation-drawer v-model="drawer" :permanent="mdAndUp" width="280">
|
||||
<v-list nav class="pa-3">
|
||||
<v-list-item
|
||||
v-for="item in navigation"
|
||||
:key="item.href"
|
||||
:href="item.href"
|
||||
:prepend-icon="item.icon"
|
||||
:title="item.title"
|
||||
:class="{ 'bg-secondary-container': isActive(item) }"
|
||||
:aria-current="isActive(item) ? 'page' : undefined"
|
||||
rounded="xl"
|
||||
@click="visit($event, item.href)"
|
||||
/>
|
||||
</v-list>
|
||||
</v-navigation-drawer>
|
||||
|
||||
<v-main>
|
||||
<div class="page-container pa-4 pa-md-8">
|
||||
<h1 v-if="title" class="text-headline-medium mb-6">{{ title }}</h1>
|
||||
<slot />
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger
|
||||
class="flex items-center gap-2 rounded-full py-1 pr-2 pl-1 hover:bg-accent focus-visible:ring-3 focus-visible:ring-ring/40 focus-visible:outline-none"
|
||||
:aria-label="`Menü für ${user.name}`"
|
||||
>
|
||||
<PersonAvatar :person="user" class="size-9" />
|
||||
<ChevronDown class="size-4 text-muted-foreground" />
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end" class="w-72">
|
||||
<DropdownMenuLabel class="flex items-center gap-3 py-2 font-normal">
|
||||
<PersonAvatar :person="user" class="size-10" />
|
||||
<div class="min-w-0">
|
||||
<div class="truncate text-sm font-semibold">{{ user.name }}</div>
|
||||
<div class="truncate text-xs text-muted-foreground">{{ user.email }}</div>
|
||||
</div>
|
||||
</DropdownMenuLabel>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem as-child>
|
||||
<Link :href="`/personen/${user.id}`"><UserRound /> Mein Profil</Link>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem as-child>
|
||||
<Link href="/profil/bearbeiten"><UserRoundPen /> Profil bearbeiten</Link>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem v-if="user.is_admin" as-child>
|
||||
<a href="/admin"><Settings /> Administration</a>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuLabel class="text-xs font-medium text-muted-foreground">Darstellung</DropdownMenuLabel>
|
||||
<DropdownMenuRadioGroup :model-value="preference" @update:model-value="setPreference">
|
||||
<DropdownMenuRadioItem v-for="option in themeOptions" :key="option.value" :value="option.value">
|
||||
<component :is="option.icon" class="size-4 text-muted-foreground" />
|
||||
{{ option.label }}
|
||||
</DropdownMenuRadioItem>
|
||||
</DropdownMenuRadioGroup>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem as-child>
|
||||
<Link href="/logout" method="post" as="button" class="w-full"><LogOut /> Abmelden</Link>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
</div>
|
||||
</v-main>
|
||||
</v-app>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.brand-link {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
<nav class="mx-auto max-w-[1440px] overflow-x-auto px-4 lg:px-6" aria-label="Hauptnavigation">
|
||||
<ul class="flex h-12 items-stretch gap-6">
|
||||
<li v-for="item in navigation" :key="item.href" class="flex">
|
||||
<Link
|
||||
:href="item.href"
|
||||
class="relative flex items-center text-sm font-medium whitespace-nowrap transition-colors"
|
||||
:class="item.active ? 'text-brand-text' : 'text-foreground/70 hover:text-foreground'"
|
||||
:aria-current="item.active ? 'page' : undefined"
|
||||
>
|
||||
{{ item.label }}
|
||||
<span v-if="item.active" class="absolute inset-x-0 bottom-0 h-0.5 rounded-full bg-brand" />
|
||||
</Link>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main class="mx-auto max-w-[1440px] px-4 py-6 lg:px-6 lg:py-8">
|
||||
<slot />
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<Toaster position="bottom-right" />
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -1,25 +1,44 @@
|
|||
<script setup>
|
||||
import BrandMark from '../components/BrandMark.vue';
|
||||
import { computed } from 'vue';
|
||||
import { Head, usePage } from '@inertiajs/vue3';
|
||||
import BrandLogo from '@/components/BrandLogo.vue';
|
||||
|
||||
defineProps({
|
||||
const props = defineProps({
|
||||
title: { type: String, default: '' },
|
||||
description: { type: String, default: '' },
|
||||
});
|
||||
|
||||
const branding = computed(() => usePage().props.branding);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-app>
|
||||
<v-main class="bg-surface-container">
|
||||
<v-container class="fill-height d-flex align-center justify-center">
|
||||
<div class="w-100 mx-auto" style="max-width: 440px">
|
||||
<div class="d-flex justify-center mb-8">
|
||||
<BrandMark :height="48" />
|
||||
</div>
|
||||
<v-card rounded="xl" color="surface" class="pa-4 pa-sm-8">
|
||||
<h1 v-if="title" class="text-headline-small mb-6">{{ title }}</h1>
|
||||
<slot />
|
||||
</v-card>
|
||||
<Head :title="props.title" />
|
||||
|
||||
<div class="grid min-h-screen lg:grid-cols-[minmax(0,5fr)_minmax(0,6fr)]">
|
||||
<aside class="relative hidden overflow-hidden bg-brand text-brand-foreground lg:flex lg:flex-col lg:justify-between lg:p-12">
|
||||
<div
|
||||
class="pointer-events-none absolute inset-0 opacity-[0.12]"
|
||||
style="background-image: radial-gradient(circle at 20% 20%, white 0, transparent 45%), radial-gradient(circle at 90% 80%, white 0, transparent 40%)"
|
||||
/>
|
||||
<BrandLogo inverted class="relative" />
|
||||
<div class="relative max-w-md">
|
||||
<p class="text-3xl leading-tight font-semibold tracking-tight">Alles Wichtige für Ihren Arbeitsalltag – an einem Ort.</p>
|
||||
<p class="mt-4 text-[15px] opacity-80">Neuigkeiten, Ansprechpartner und Anwendungen von {{ branding.portal_name }}.</p>
|
||||
</div>
|
||||
<p class="relative text-xs opacity-60">© {{ new Date().getFullYear() }} {{ branding.portal_name }}</p>
|
||||
</aside>
|
||||
|
||||
<main class="flex items-center justify-center bg-background px-4 py-12 sm:px-8">
|
||||
<div class="w-full max-w-[400px]">
|
||||
<div class="mb-10 lg:hidden">
|
||||
<BrandLogo />
|
||||
</div>
|
||||
</v-container>
|
||||
</v-main>
|
||||
</v-app>
|
||||
<h1 class="text-2xl font-semibold tracking-tight">{{ props.title }}</h1>
|
||||
<p v-if="props.description" class="mt-2 text-sm text-muted-foreground">{{ props.description }}</p>
|
||||
<div class="mt-8">
|
||||
<slot />
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
56
resources/js/lib/icons.js
Normal file
56
resources/js/lib/icons.js
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
import {
|
||||
BookOpen,
|
||||
Briefcase,
|
||||
Building2,
|
||||
CalendarDays,
|
||||
Car,
|
||||
Clock,
|
||||
FileText,
|
||||
Folder,
|
||||
GraduationCap,
|
||||
Headset,
|
||||
HeartHandshake,
|
||||
Lightbulb,
|
||||
Link,
|
||||
Mail,
|
||||
Megaphone,
|
||||
MessageSquare,
|
||||
Monitor,
|
||||
Phone,
|
||||
Plane,
|
||||
Receipt,
|
||||
ShieldCheck,
|
||||
Users,
|
||||
Utensils,
|
||||
Wrench,
|
||||
} from '@lucide/vue';
|
||||
|
||||
/**
|
||||
* Symbole für Schnellzugriffe – muss zu App\Support\QuickLinks::ICONS passen.
|
||||
*/
|
||||
export const quickLinkIcons = {
|
||||
link: Link,
|
||||
clock: Clock,
|
||||
'calendar-days': CalendarDays,
|
||||
plane: Plane,
|
||||
receipt: Receipt,
|
||||
'graduation-cap': GraduationCap,
|
||||
headset: Headset,
|
||||
utensils: Utensils,
|
||||
car: Car,
|
||||
'file-text': FileText,
|
||||
'book-open': BookOpen,
|
||||
users: Users,
|
||||
mail: Mail,
|
||||
'message-square': MessageSquare,
|
||||
lightbulb: Lightbulb,
|
||||
'shield-check': ShieldCheck,
|
||||
'heart-handshake': HeartHandshake,
|
||||
'building-2': Building2,
|
||||
wrench: Wrench,
|
||||
monitor: Monitor,
|
||||
folder: Folder,
|
||||
phone: Phone,
|
||||
megaphone: Megaphone,
|
||||
briefcase: Briefcase,
|
||||
};
|
||||
7
resources/js/lib/utils.ts
Normal file
7
resources/js/lib/utils.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import type { ClassValue } from 'clsx';
|
||||
import { clsx } from 'clsx';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
|
|
@ -1,6 +1,10 @@
|
|||
<script setup>
|
||||
import { Head, Link, useForm } from '@inertiajs/vue3';
|
||||
import GuestLayout from '../../layouts/GuestLayout.vue';
|
||||
import { Link, useForm } from '@inertiajs/vue3';
|
||||
import { ArrowLeft, LoaderCircle } from '@lucide/vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import FormField from '@/components/FormField.vue';
|
||||
import GuestLayout from '@/layouts/GuestLayout.vue';
|
||||
|
||||
defineProps({
|
||||
status: { type: String, default: null },
|
||||
|
|
@ -10,31 +14,25 @@ const form = useForm({ email: '' });
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<Head title="Passwort vergessen" />
|
||||
<GuestLayout title="Passwort vergessen" description="Wir senden Ihnen einen Link, mit dem Sie ein neues Passwort festlegen können.">
|
||||
<div v-if="status" class="mb-6 rounded-md border border-brand-200 bg-brand-soft px-4 py-3 text-sm text-brand-soft-foreground">
|
||||
{{ status }}
|
||||
</div>
|
||||
|
||||
<GuestLayout title="Passwort vergessen">
|
||||
<p class="text-body-medium text-medium-emphasis mb-6">
|
||||
Geben Sie Ihre E-Mail-Adresse ein. Wir senden Ihnen einen Link, mit dem Sie ein neues Passwort festlegen können.
|
||||
</p>
|
||||
<form class="grid gap-5" @submit.prevent="form.post('/forgot-password')">
|
||||
<FormField id="email" label="E-Mail-Adresse" :error="form.errors.email">
|
||||
<Input id="email" v-model="form.email" type="email" autocomplete="username" autofocus class="h-10" />
|
||||
</FormField>
|
||||
|
||||
<v-alert v-if="status" type="success" variant="tonal" class="mb-6">{{ status }}</v-alert>
|
||||
<Button type="submit" size="lg" class="h-10 w-full" :disabled="form.processing">
|
||||
<LoaderCircle v-if="form.processing" class="animate-spin" />
|
||||
Link senden
|
||||
</Button>
|
||||
|
||||
<v-form @submit.prevent="form.post('/forgot-password')">
|
||||
<v-text-field
|
||||
v-model="form.email"
|
||||
label="E-Mail-Adresse"
|
||||
type="email"
|
||||
autocomplete="username"
|
||||
autofocus
|
||||
:error-messages="form.errors.email"
|
||||
class="mb-4"
|
||||
/>
|
||||
|
||||
<v-btn type="submit" size="large" block :loading="form.processing">Link senden</v-btn>
|
||||
|
||||
<div class="text-center mt-6">
|
||||
<Link href="/login" class="text-primary text-body-medium">Zurück zur Anmeldung</Link>
|
||||
</div>
|
||||
</v-form>
|
||||
<Link href="/login" class="inline-flex items-center justify-center gap-1.5 text-sm font-medium text-muted-foreground hover:text-foreground">
|
||||
<ArrowLeft class="size-4" />
|
||||
Zurück zur Anmeldung
|
||||
</Link>
|
||||
</form>
|
||||
</GuestLayout>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,13 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { Head, Link, useForm } from '@inertiajs/vue3';
|
||||
import { mdiEyeOffOutline, mdiEyeOutline } from '@mdi/js';
|
||||
import GuestLayout from '../../layouts/GuestLayout.vue';
|
||||
import { Link, useForm } from '@inertiajs/vue3';
|
||||
import { Eye, EyeOff, LoaderCircle } from '@lucide/vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import FormField from '@/components/FormField.vue';
|
||||
import GuestLayout from '@/layouts/GuestLayout.vue';
|
||||
|
||||
defineProps({
|
||||
canResetPassword: { type: Boolean, default: false },
|
||||
|
|
@ -25,39 +30,52 @@ function submit() {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<Head title="Anmelden" />
|
||||
<GuestLayout title="Anmelden" description="Melden Sie sich mit Ihrer dienstlichen E-Mail-Adresse an.">
|
||||
<div v-if="status" class="mb-6 rounded-md border border-brand-200 bg-brand-soft px-4 py-3 text-sm text-brand-soft-foreground">
|
||||
{{ status }}
|
||||
</div>
|
||||
|
||||
<GuestLayout title="Anmelden">
|
||||
<v-alert v-if="status" type="success" variant="tonal" class="mb-6">{{ status }}</v-alert>
|
||||
<form class="grid gap-5" @submit.prevent="submit">
|
||||
<FormField id="email" label="E-Mail-Adresse" :error="form.errors.email">
|
||||
<Input id="email" v-model="form.email" type="email" autocomplete="username" autofocus class="h-10" :aria-invalid="!!form.errors.email" />
|
||||
</FormField>
|
||||
|
||||
<v-form @submit.prevent="submit">
|
||||
<v-text-field
|
||||
v-model="form.email"
|
||||
label="E-Mail-Adresse"
|
||||
type="email"
|
||||
autocomplete="username"
|
||||
autofocus
|
||||
:error-messages="form.errors.email"
|
||||
class="mb-2"
|
||||
/>
|
||||
<v-text-field
|
||||
v-model="form.password"
|
||||
label="Passwort"
|
||||
:type="showPassword ? 'text' : 'password'"
|
||||
autocomplete="current-password"
|
||||
:append-inner-icon="showPassword ? mdiEyeOffOutline : mdiEyeOutline"
|
||||
:error-messages="form.errors.password"
|
||||
@click:append-inner="showPassword = !showPassword"
|
||||
/>
|
||||
<FormField id="password" label="Passwort" :error="form.errors.password">
|
||||
<div class="relative">
|
||||
<Input
|
||||
id="password"
|
||||
v-model="form.password"
|
||||
:type="showPassword ? 'text' : 'password'"
|
||||
autocomplete="current-password"
|
||||
class="h-10 pr-10"
|
||||
:aria-invalid="!!form.errors.password"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
class="absolute inset-y-0 right-0 grid w-10 place-items-center text-muted-foreground hover:text-foreground"
|
||||
:aria-label="showPassword ? 'Passwort verbergen' : 'Passwort anzeigen'"
|
||||
@click="showPassword = !showPassword"
|
||||
>
|
||||
<EyeOff v-if="showPassword" class="size-4" />
|
||||
<Eye v-else class="size-4" />
|
||||
</button>
|
||||
</div>
|
||||
</FormField>
|
||||
|
||||
<div class="d-flex align-center justify-space-between flex-wrap mb-6">
|
||||
<v-checkbox v-model="form.remember" label="Angemeldet bleiben" hide-details density="compact" />
|
||||
<Link v-if="canResetPassword" href="/forgot-password" class="text-primary text-body-medium">
|
||||
<div class="flex items-center justify-between">
|
||||
<Label class="flex items-center gap-2 text-sm font-normal">
|
||||
<Checkbox v-model="form.remember" />
|
||||
Angemeldet bleiben
|
||||
</Label>
|
||||
<Link v-if="canResetPassword" href="/forgot-password" class="text-sm font-medium text-brand-text hover:underline">
|
||||
Passwort vergessen?
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
<v-btn type="submit" size="large" block :loading="form.processing">Anmelden</v-btn>
|
||||
</v-form>
|
||||
<Button type="submit" size="lg" class="mt-2 h-10 w-full" :disabled="form.processing">
|
||||
<LoaderCircle v-if="form.processing" class="animate-spin" />
|
||||
Anmelden
|
||||
</Button>
|
||||
</form>
|
||||
</GuestLayout>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
<script setup>
|
||||
import { Head, useForm } from '@inertiajs/vue3';
|
||||
import GuestLayout from '../../layouts/GuestLayout.vue';
|
||||
import { useForm } from '@inertiajs/vue3';
|
||||
import { LoaderCircle } from '@lucide/vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import FormField from '@/components/FormField.vue';
|
||||
import GuestLayout from '@/layouts/GuestLayout.vue';
|
||||
|
||||
const props = defineProps({
|
||||
email: { type: String, default: '' },
|
||||
|
|
@ -22,15 +26,22 @@ function submit() {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<Head title="Neues Passwort" />
|
||||
<GuestLayout title="Neues Passwort festlegen" description="Mindestens 10 Zeichen, mit Buchstaben und Ziffern.">
|
||||
<form class="grid gap-5" @submit.prevent="submit">
|
||||
<FormField id="email" label="E-Mail-Adresse" :error="form.errors.email">
|
||||
<Input id="email" v-model="form.email" type="email" autocomplete="username" class="h-10" />
|
||||
</FormField>
|
||||
<FormField id="password" label="Neues Passwort" :error="form.errors.password">
|
||||
<Input id="password" v-model="form.password" type="password" autocomplete="new-password" autofocus class="h-10" />
|
||||
</FormField>
|
||||
<FormField id="password_confirmation" label="Passwort wiederholen">
|
||||
<Input id="password_confirmation" v-model="form.password_confirmation" type="password" autocomplete="new-password" class="h-10" />
|
||||
</FormField>
|
||||
|
||||
<GuestLayout title="Neues Passwort festlegen">
|
||||
<v-form @submit.prevent="submit">
|
||||
<v-text-field v-model="form.email" label="E-Mail-Adresse" type="email" autocomplete="username" :error-messages="form.errors.email" class="mb-2" />
|
||||
<v-text-field v-model="form.password" label="Neues Passwort" type="password" autocomplete="new-password" autofocus :error-messages="form.errors.password" class="mb-2" />
|
||||
<v-text-field v-model="form.password_confirmation" label="Passwort wiederholen" type="password" autocomplete="new-password" class="mb-4" />
|
||||
|
||||
<v-btn type="submit" size="large" block :loading="form.processing">Passwort speichern</v-btn>
|
||||
</v-form>
|
||||
<Button type="submit" size="lg" class="h-10 w-full" :disabled="form.processing">
|
||||
<LoaderCircle v-if="form.processing" class="animate-spin" />
|
||||
Passwort speichern
|
||||
</Button>
|
||||
</form>
|
||||
</GuestLayout>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -1,51 +1,105 @@
|
|||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { Head, usePage } from '@inertiajs/vue3';
|
||||
import { mdiAccountEditOutline, mdiNewspaperVariantOutline, mdiPuzzleOutline } from '@mdi/js';
|
||||
import AppLayout from '../layouts/AppLayout.vue';
|
||||
import { Link, usePage } from '@inertiajs/vue3';
|
||||
import { ArrowRight, Search, UserRoundPen } from '@lucide/vue';
|
||||
import GreetingCard from '@/components/GreetingCard.vue';
|
||||
import Panel from '@/components/Panel.vue';
|
||||
import PersonAvatar from '@/components/PersonAvatar.vue';
|
||||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
import { quickLinkIcons } from '@/lib/icons';
|
||||
|
||||
const props = defineProps({
|
||||
profile: { type: Object, required: true },
|
||||
quickLinks: { type: Array, required: true },
|
||||
newColleagues: { type: Object, required: true },
|
||||
peopleCount: { type: Number, required: true },
|
||||
});
|
||||
|
||||
const page = usePage();
|
||||
const user = computed(() => page.props.auth.user);
|
||||
const firstName = computed(() => user.value.name.split(' ')[0]);
|
||||
const me = computed(() => ({ ...user.value, avatar_url: props.profile.avatar_url }));
|
||||
|
||||
const greeting = computed(() => {
|
||||
const hour = new Date().getHours();
|
||||
|
||||
if (hour < 11) return 'Guten Morgen';
|
||||
if (hour < 18) return 'Hallo';
|
||||
if (hour < 18) return 'Guten Tag';
|
||||
|
||||
return 'Guten Abend';
|
||||
});
|
||||
|
||||
const profileIncomplete = computed(() => !props.profile.avatar_url || !props.profile.job_title);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Head title="Start" />
|
||||
<AppLayout title="Startseite">
|
||||
<div class="grid gap-6 lg:grid-cols-12">
|
||||
<div class="grid content-start gap-6 lg:col-span-8">
|
||||
<GreetingCard :user="me" :profile="profile" :greeting="greeting" class="lg:hidden" />
|
||||
|
||||
<AppLayout>
|
||||
<div class="mb-8">
|
||||
<h1 class="text-headline-large">{{ greeting }}, {{ firstName }}!</h1>
|
||||
<p class="text-body-large text-medium-emphasis mt-1">Willkommen in {{ page.props.branding.portal_name }}.</p>
|
||||
<Panel title="Schnellzugriffe">
|
||||
<div class="grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-4 xl:grid-cols-6">
|
||||
<component
|
||||
:is="link.url.startsWith('/') && !link.new_tab ? Link : 'a'"
|
||||
v-for="link in quickLinks"
|
||||
:key="link.label + link.url"
|
||||
:href="link.url"
|
||||
:target="link.new_tab ? '_blank' : undefined"
|
||||
:rel="link.new_tab ? 'noopener' : undefined"
|
||||
class="group flex flex-col items-center gap-2.5 rounded-lg border bg-card px-3 py-4 text-center transition-colors hover:border-brand-200 hover:bg-brand-soft"
|
||||
>
|
||||
<component :is="quickLinkIcons[link.icon] ?? quickLinkIcons.link" class="size-6 text-brand-text" :stroke-width="1.75" />
|
||||
<span class="text-[13px] leading-tight font-medium">{{ link.label }}</span>
|
||||
</component>
|
||||
</div>
|
||||
</Panel>
|
||||
|
||||
<Panel v-if="newColleagues.data.length" title="Neu im Team" action-label="Alle Personen" action-href="/personen">
|
||||
<ul class="grid gap-3 sm:grid-cols-2 xl:grid-cols-3">
|
||||
<li v-for="person in newColleagues.data" :key="person.id">
|
||||
<Link :href="`/personen/${person.id}`" class="flex items-center gap-3 rounded-lg border p-3 transition-colors hover:bg-accent">
|
||||
<PersonAvatar :person="person" class="size-11" />
|
||||
<div class="min-w-0">
|
||||
<div class="truncate text-sm font-semibold">{{ person.name }}</div>
|
||||
<div class="truncate text-[13px] text-muted-foreground">{{ person.job_title || person.department }}</div>
|
||||
</div>
|
||||
</Link>
|
||||
</li>
|
||||
</ul>
|
||||
</Panel>
|
||||
</div>
|
||||
|
||||
<aside class="grid content-start gap-6 lg:col-span-4">
|
||||
<GreetingCard :user="me" :profile="profile" :greeting="greeting" class="hidden lg:block" />
|
||||
|
||||
<Link
|
||||
v-if="profileIncomplete"
|
||||
href="/profil/bearbeiten"
|
||||
class="flex items-start gap-3 rounded-lg border border-dashed border-brand-300 bg-card p-4 transition-colors hover:bg-brand-soft"
|
||||
>
|
||||
<UserRoundPen class="mt-0.5 size-5 shrink-0 text-brand-text" />
|
||||
<div>
|
||||
<div class="text-sm font-semibold">Profil vervollständigen</div>
|
||||
<p class="mt-0.5 text-[13px] text-muted-foreground">Mit Foto und Funktion finden Kolleginnen und Kollegen Sie schneller.</p>
|
||||
</div>
|
||||
</Link>
|
||||
|
||||
<Panel title="Personen finden">
|
||||
<form action="/personen" method="get" class="relative" role="search">
|
||||
<Search class="pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground" />
|
||||
<input
|
||||
name="q"
|
||||
type="search"
|
||||
placeholder="Name, Funktion, Abteilung …"
|
||||
class="h-10 w-full rounded-md border border-input bg-background pr-3 pl-9 text-sm placeholder:text-muted-foreground focus-visible:border-brand-400 focus-visible:ring-3 focus-visible:ring-ring/30 focus-visible:outline-none"
|
||||
/>
|
||||
</form>
|
||||
<Link href="/personen" class="mt-4 flex items-center justify-between text-[13px] text-muted-foreground hover:text-foreground">
|
||||
{{ peopleCount.toLocaleString('de-DE') }} Kolleginnen und Kollegen im Verzeichnis
|
||||
<ArrowRight class="size-4" />
|
||||
</Link>
|
||||
</Panel>
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
<v-row>
|
||||
<v-col cols="12" md="4">
|
||||
<v-card class="h-100" rounded="xl" href="/profil/bearbeiten">
|
||||
<v-card-item :prepend-icon="mdiAccountEditOutline" title="Ihr Profil" />
|
||||
<v-card-text>Profilbild, Funktion und Kontaktdaten helfen Kolleginnen und Kollegen, Sie zu finden.</v-card-text>
|
||||
</v-card>
|
||||
</v-col>
|
||||
<v-col cols="12" md="4">
|
||||
<v-card class="h-100" rounded="xl" color="secondary-container">
|
||||
<v-card-item :prepend-icon="mdiNewspaperVariantOutline" title="Neuigkeiten" />
|
||||
<v-card-text>Hier erscheinen bald Beiträge aus Ihren Kategorien.</v-card-text>
|
||||
</v-card>
|
||||
</v-col>
|
||||
<v-col cols="12" md="4">
|
||||
<v-card class="h-100" rounded="xl" color="tertiary-container">
|
||||
<v-card-item :prepend-icon="mdiPuzzleOutline" title="Module" />
|
||||
<v-card-text>Weitere Funktionen kommen als Plugins hinzu und lassen sich einzeln aktivieren.</v-card-text>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</AppLayout>
|
||||
</template>
|
||||
|
|
|
|||
112
resources/js/pages/People/Index.vue
Normal file
112
resources/js/pages/People/Index.vue
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import { Link, router } from '@inertiajs/vue3';
|
||||
import { useDebounceFn } from '@vueuse/core';
|
||||
import { ChevronLeft, ChevronRight, Mail, Phone, Search, SearchX } from '@lucide/vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import PersonAvatar from '@/components/PersonAvatar.vue';
|
||||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
|
||||
const props = defineProps({
|
||||
people: { type: Object, required: true },
|
||||
filters: { type: Object, required: true },
|
||||
departments: { type: Array, required: true },
|
||||
});
|
||||
|
||||
const search = ref(props.filters.q ?? '');
|
||||
const department = ref(props.filters.abteilung ?? '');
|
||||
|
||||
function apply() {
|
||||
const query = {};
|
||||
|
||||
if (search.value) query.q = search.value;
|
||||
if (department.value) query.abteilung = department.value;
|
||||
|
||||
router.get('/personen', query, { preserveState: true, preserveScroll: true, replace: true });
|
||||
}
|
||||
|
||||
watch(search, useDebounceFn(apply, 300));
|
||||
watch(department, apply);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AppLayout title="Personen">
|
||||
<div class="mb-6 flex flex-wrap items-end justify-between gap-4">
|
||||
<div>
|
||||
<h1 class="text-2xl font-semibold tracking-tight">Personen</h1>
|
||||
<p class="mt-1 text-sm text-muted-foreground">
|
||||
{{ people.meta.total.toLocaleString('de-DE') }}
|
||||
{{ people.meta.total === 1 ? 'Person' : 'Personen' }}{{ filters.q || filters.abteilung ? ' gefunden' : ' im Verzeichnis' }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="flex w-full flex-col gap-3 sm:w-auto sm:flex-row">
|
||||
<label class="relative block sm:w-80">
|
||||
<span class="sr-only">Suchen</span>
|
||||
<Search class="pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground" />
|
||||
<input
|
||||
v-model="search"
|
||||
type="search"
|
||||
placeholder="Name, Funktion, Standort …"
|
||||
class="h-10 w-full rounded-md border border-input bg-card pr-3 pl-9 text-sm placeholder:text-muted-foreground focus-visible:border-brand-400 focus-visible:ring-3 focus-visible:ring-ring/30 focus-visible:outline-none"
|
||||
/>
|
||||
</label>
|
||||
<select
|
||||
v-model="department"
|
||||
class="h-10 rounded-md border border-input bg-card px-3 text-sm focus-visible:border-brand-400 focus-visible:ring-3 focus-visible:ring-ring/30 focus-visible:outline-none sm:w-56"
|
||||
aria-label="Abteilung"
|
||||
>
|
||||
<option value="">Alle Abteilungen</option>
|
||||
<option v-for="item in departments" :key="item" :value="item">{{ item }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul v-if="people.data.length" class="grid gap-4 sm:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4">
|
||||
<li v-for="person in people.data" :key="person.id" class="flex flex-col rounded-lg border bg-card">
|
||||
<Link :href="`/personen/${person.id}`" class="flex items-center gap-3 p-4 pb-3">
|
||||
<PersonAvatar :person="person" class="size-12" />
|
||||
<div class="min-w-0">
|
||||
<div class="truncate text-[15px] font-semibold hover:underline">{{ person.name }}</div>
|
||||
<div class="truncate text-[13px] text-muted-foreground">{{ person.job_title || '–' }}</div>
|
||||
</div>
|
||||
</Link>
|
||||
<div class="px-4 pb-3 text-[13px] text-muted-foreground">
|
||||
<span v-if="person.department" class="font-medium text-brand-text">{{ person.department }}</span>
|
||||
<span v-if="person.department && person.location"> · </span>
|
||||
<span v-if="person.location">{{ person.location }}</span>
|
||||
</div>
|
||||
<div class="mt-auto flex border-t text-[13px]">
|
||||
<a :href="`mailto:${person.email}`" class="flex flex-1 items-center justify-center gap-1.5 py-2.5 text-muted-foreground hover:bg-accent hover:text-foreground">
|
||||
<Mail class="size-4" /> E-Mail
|
||||
</a>
|
||||
<a
|
||||
v-if="person.phone"
|
||||
:href="`tel:${person.phone}`"
|
||||
class="flex flex-1 items-center justify-center gap-1.5 border-l py-2.5 text-muted-foreground hover:bg-accent hover:text-foreground"
|
||||
>
|
||||
<Phone class="size-4" /> Anrufen
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div v-else class="grid place-items-center rounded-lg border border-dashed bg-card px-6 py-16 text-center">
|
||||
<SearchX class="size-8 text-muted-foreground" />
|
||||
<p class="mt-3 font-medium">Niemand gefunden</p>
|
||||
<p class="mt-1 text-sm text-muted-foreground">Versuchen Sie einen anderen Suchbegriff oder eine andere Abteilung.</p>
|
||||
</div>
|
||||
|
||||
<nav v-if="people.meta.last_page > 1" class="mt-6 flex items-center justify-between" aria-label="Seiten">
|
||||
<p class="text-sm text-muted-foreground">Seite {{ people.meta.current_page }} von {{ people.meta.last_page }}</p>
|
||||
<div class="flex gap-2">
|
||||
<Button variant="outline" size="sm" :disabled="!people.links.prev" @click="router.get(people.links.prev, {}, { preserveScroll: false })">
|
||||
<ChevronLeft /> Zurück
|
||||
</Button>
|
||||
<Button variant="outline" size="sm" :disabled="!people.links.next" @click="router.get(people.links.next, {}, { preserveScroll: false })">
|
||||
Weiter <ChevronRight />
|
||||
</Button>
|
||||
</div>
|
||||
</nav>
|
||||
</AppLayout>
|
||||
</template>
|
||||
|
|
@ -1,24 +1,20 @@
|
|||
<script setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { Head, router, useForm, usePage } from '@inertiajs/vue3';
|
||||
import { mdiCameraOutline, mdiDeleteOutline } from '@mdi/js';
|
||||
import AppLayout from '../../layouts/AppLayout.vue';
|
||||
import UserAvatar from '../../components/UserAvatar.vue';
|
||||
import { ref } from 'vue';
|
||||
import { router, useForm } from '@inertiajs/vue3';
|
||||
import { Camera, LoaderCircle, Trash2 } from '@lucide/vue';
|
||||
import { toast } from 'vue-sonner';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import FormField from '@/components/FormField.vue';
|
||||
import Panel from '@/components/Panel.vue';
|
||||
import PersonAvatar from '@/components/PersonAvatar.vue';
|
||||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
|
||||
const props = defineProps({
|
||||
profile: { type: Object, required: true },
|
||||
});
|
||||
|
||||
const page = usePage();
|
||||
const status = computed(() => page.props.flash.status);
|
||||
const snackbar = ref(false);
|
||||
const snackbarText = ref('');
|
||||
|
||||
function notify(text) {
|
||||
snackbarText.value = text;
|
||||
snackbar.value = true;
|
||||
}
|
||||
|
||||
// Stammdaten
|
||||
const form = useForm({
|
||||
first_name: props.profile.first_name ?? '',
|
||||
|
|
@ -35,18 +31,28 @@ const form = useForm({
|
|||
function saveProfile() {
|
||||
form.put('/profil', {
|
||||
preserveScroll: true,
|
||||
onSuccess: () => notify('Profil gespeichert.'),
|
||||
onSuccess: () => {
|
||||
form.defaults();
|
||||
toast.success('Profil gespeichert');
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const fields = [
|
||||
{ key: 'first_name', label: 'Vorname', autocomplete: 'given-name' },
|
||||
{ key: 'last_name', label: 'Nachname', autocomplete: 'family-name' },
|
||||
{ key: 'email', label: 'E-Mail-Adresse', type: 'email', autocomplete: 'email', wide: true },
|
||||
{ key: 'job_title', label: 'Funktion', autocomplete: 'organization-title' },
|
||||
{ key: 'department', label: 'Abteilung' },
|
||||
{ key: 'location', label: 'Standort' },
|
||||
{ key: 'phone', label: 'Telefon', type: 'tel', autocomplete: 'tel' },
|
||||
{ key: 'mobile', label: 'Mobil', type: 'tel' },
|
||||
];
|
||||
|
||||
// Profilbild
|
||||
const avatarInput = ref(null);
|
||||
const avatarForm = useForm({ avatar: null });
|
||||
|
||||
function chooseAvatar() {
|
||||
avatarInput.value?.click();
|
||||
}
|
||||
|
||||
function uploadAvatar(event) {
|
||||
const file = event.target.files?.[0];
|
||||
|
||||
|
|
@ -56,7 +62,7 @@ function uploadAvatar(event) {
|
|||
avatarForm.post('/profil/bild', {
|
||||
preserveScroll: true,
|
||||
forceFormData: true,
|
||||
onSuccess: () => notify('Profilbild aktualisiert.'),
|
||||
onSuccess: () => toast.success('Profilbild aktualisiert'),
|
||||
onFinish: () => {
|
||||
event.target.value = '';
|
||||
},
|
||||
|
|
@ -66,7 +72,7 @@ function uploadAvatar(event) {
|
|||
function removeAvatar() {
|
||||
router.delete('/profil/bild', {
|
||||
preserveScroll: true,
|
||||
onSuccess: () => notify('Profilbild entfernt.'),
|
||||
onSuccess: () => toast.success('Profilbild entfernt'),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -83,74 +89,93 @@ function savePassword() {
|
|||
errorBag: 'updatePassword',
|
||||
onSuccess: () => {
|
||||
passwordForm.reset();
|
||||
notify('Passwort geändert.');
|
||||
toast.success('Passwort geändert');
|
||||
},
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Head title="Profil bearbeiten" />
|
||||
|
||||
<AppLayout title="Profil bearbeiten">
|
||||
<v-row>
|
||||
<v-col cols="12" md="4">
|
||||
<v-card rounded="xl" class="text-center pa-6">
|
||||
<UserAvatar :user="profile" :size="144" class="mb-4" />
|
||||
<div class="text-title-large">{{ profile.name }}</div>
|
||||
<h1 class="mb-6 text-2xl font-semibold tracking-tight">Profil bearbeiten</h1>
|
||||
|
||||
<input ref="avatarInput" type="file" accept="image/jpeg,image/png,image/webp" hidden @change="uploadAvatar" />
|
||||
|
||||
<div class="d-flex flex-column ga-2 mt-6">
|
||||
<v-btn :prepend-icon="mdiCameraOutline" :loading="avatarForm.processing" @click="chooseAvatar">
|
||||
{{ profile.avatar_url ? 'Bild ändern' : 'Bild hochladen' }}
|
||||
</v-btn>
|
||||
<v-btn v-if="profile.avatar_url" variant="text" color="error" :prepend-icon="mdiDeleteOutline" @click="removeAvatar">
|
||||
Bild entfernen
|
||||
</v-btn>
|
||||
<div class="grid gap-6 lg:grid-cols-12">
|
||||
<div class="lg:col-span-4">
|
||||
<Panel title="Profilbild">
|
||||
<div class="flex flex-col items-center text-center">
|
||||
<PersonAvatar :person="profile" class="size-32 text-3xl" />
|
||||
<input ref="avatarInput" type="file" accept="image/jpeg,image/png,image/webp" class="hidden" @change="uploadAvatar" />
|
||||
<div class="mt-5 flex flex-wrap justify-center gap-2">
|
||||
<Button variant="outline" :disabled="avatarForm.processing" @click="avatarInput?.click()">
|
||||
<LoaderCircle v-if="avatarForm.processing" class="animate-spin" />
|
||||
<Camera v-else />
|
||||
{{ profile.avatar_url ? 'Bild ändern' : 'Bild hochladen' }}
|
||||
</Button>
|
||||
<Button v-if="profile.avatar_url" variant="ghost" class="text-destructive hover:text-destructive" @click="removeAvatar">
|
||||
<Trash2 /> Entfernen
|
||||
</Button>
|
||||
</div>
|
||||
<p v-if="avatarForm.errors.avatar" class="mt-3 text-[13px] text-destructive">{{ avatarForm.errors.avatar }}</p>
|
||||
<p class="mt-3 text-[13px] text-muted-foreground">JPG, PNG oder WebP, höchstens 8 MB. Das Bild wird quadratisch zugeschnitten.</p>
|
||||
</div>
|
||||
<div v-if="avatarForm.errors.avatar" class="text-error text-body-small mt-3">{{ avatarForm.errors.avatar }}</div>
|
||||
<div class="text-body-small text-medium-emphasis mt-3">JPG, PNG oder WebP, höchstens 8 MB.</div>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</Panel>
|
||||
</div>
|
||||
|
||||
<v-col cols="12" md="8">
|
||||
<v-card rounded="xl" title="Persönliche Angaben" class="mb-6">
|
||||
<v-card-text>
|
||||
<v-form @submit.prevent="saveProfile">
|
||||
<v-row dense>
|
||||
<v-col cols="12" sm="6"><v-text-field v-model="form.first_name" label="Vorname" :error-messages="form.errors.first_name" /></v-col>
|
||||
<v-col cols="12" sm="6"><v-text-field v-model="form.last_name" label="Nachname" :error-messages="form.errors.last_name" /></v-col>
|
||||
<v-col cols="12"><v-text-field v-model="form.email" label="E-Mail-Adresse" type="email" :error-messages="form.errors.email" /></v-col>
|
||||
<v-col cols="12" sm="6"><v-text-field v-model="form.job_title" label="Funktion" :error-messages="form.errors.job_title" /></v-col>
|
||||
<v-col cols="12" sm="6"><v-text-field v-model="form.department" label="Abteilung" :error-messages="form.errors.department" /></v-col>
|
||||
<v-col cols="12" sm="6"><v-text-field v-model="form.location" label="Standort" :error-messages="form.errors.location" /></v-col>
|
||||
<v-col cols="12" sm="6"><v-text-field v-model="form.phone" label="Telefon" type="tel" :error-messages="form.errors.phone" /></v-col>
|
||||
<v-col cols="12" sm="6"><v-text-field v-model="form.mobile" label="Mobil" type="tel" :error-messages="form.errors.mobile" /></v-col>
|
||||
<v-col cols="12"><v-textarea v-model="form.about" label="Über mich" rows="4" auto-grow counter="2000" :error-messages="form.errors.about" /></v-col>
|
||||
</v-row>
|
||||
<div class="d-flex justify-end mt-2">
|
||||
<v-btn type="submit" :loading="form.processing" :disabled="!form.isDirty">Speichern</v-btn>
|
||||
</div>
|
||||
</v-form>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
<div class="grid content-start gap-6 lg:col-span-8">
|
||||
<Panel title="Persönliche Angaben">
|
||||
<form class="grid gap-5" @submit.prevent="saveProfile">
|
||||
<div class="grid gap-5 sm:grid-cols-2">
|
||||
<FormField
|
||||
v-for="field in fields"
|
||||
:id="field.key"
|
||||
:key="field.key"
|
||||
:label="field.label"
|
||||
:error="form.errors[field.key]"
|
||||
:class="{ 'sm:col-span-2': field.wide }"
|
||||
>
|
||||
<Input
|
||||
:id="field.key"
|
||||
v-model="form[field.key]"
|
||||
:type="field.type ?? 'text'"
|
||||
:autocomplete="field.autocomplete"
|
||||
:aria-invalid="!!form.errors[field.key]"
|
||||
/>
|
||||
</FormField>
|
||||
<FormField id="about" label="Über mich" :error="form.errors.about" hint="Aufgaben, Themen, bei denen man Sie ansprechen kann." class="sm:col-span-2">
|
||||
<Textarea id="about" v-model="form.about" rows="4" maxlength="2000" />
|
||||
</FormField>
|
||||
</div>
|
||||
<div class="flex justify-end border-t pt-5">
|
||||
<Button type="submit" :disabled="form.processing || !form.isDirty">
|
||||
<LoaderCircle v-if="form.processing" class="animate-spin" />
|
||||
Speichern
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</Panel>
|
||||
|
||||
<v-card v-if="profile.has_password" rounded="xl" title="Passwort ändern">
|
||||
<v-card-text>
|
||||
<v-form @submit.prevent="savePassword">
|
||||
<v-text-field v-model="passwordForm.current_password" label="Aktuelles Passwort" type="password" autocomplete="current-password" :error-messages="passwordForm.errors.current_password" class="mb-2" />
|
||||
<v-text-field v-model="passwordForm.password" label="Neues Passwort" type="password" autocomplete="new-password" :error-messages="passwordForm.errors.password" class="mb-2" />
|
||||
<v-text-field v-model="passwordForm.password_confirmation" label="Neues Passwort wiederholen" type="password" autocomplete="new-password" />
|
||||
<div class="d-flex justify-end mt-2">
|
||||
<v-btn type="submit" :loading="passwordForm.processing">Passwort ändern</v-btn>
|
||||
</div>
|
||||
</v-form>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<v-snackbar v-model="snackbar" :timeout="3000">{{ snackbarText }}</v-snackbar>
|
||||
<Panel v-if="profile.has_password" title="Passwort ändern">
|
||||
<form class="grid gap-5" @submit.prevent="savePassword">
|
||||
<FormField id="current_password" label="Aktuelles Passwort" :error="passwordForm.errors.current_password" class="sm:max-w-sm">
|
||||
<Input id="current_password" v-model="passwordForm.current_password" type="password" autocomplete="current-password" />
|
||||
</FormField>
|
||||
<div class="grid gap-5 sm:grid-cols-2">
|
||||
<FormField id="password" label="Neues Passwort" :error="passwordForm.errors.password" hint="Mindestens 10 Zeichen, mit Buchstaben und Ziffern.">
|
||||
<Input id="password" v-model="passwordForm.password" type="password" autocomplete="new-password" />
|
||||
</FormField>
|
||||
<FormField id="password_confirmation" label="Neues Passwort wiederholen">
|
||||
<Input id="password_confirmation" v-model="passwordForm.password_confirmation" type="password" autocomplete="new-password" />
|
||||
</FormField>
|
||||
</div>
|
||||
<div class="flex justify-end border-t pt-5">
|
||||
<Button type="submit" :disabled="passwordForm.processing">
|
||||
<LoaderCircle v-if="passwordForm.processing" class="animate-spin" />
|
||||
Passwort ändern
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</Panel>
|
||||
</div>
|
||||
</div>
|
||||
</AppLayout>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -1,16 +1,11 @@
|
|||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { Head, Link } from '@inertiajs/vue3';
|
||||
import {
|
||||
mdiAccountEditOutline,
|
||||
mdiCellphone,
|
||||
mdiDomain,
|
||||
mdiEmailOutline,
|
||||
mdiMapMarkerOutline,
|
||||
mdiPhoneOutline,
|
||||
} from '@mdi/js';
|
||||
import AppLayout from '../../layouts/AppLayout.vue';
|
||||
import UserAvatar from '../../components/UserAvatar.vue';
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import { Building2, Mail, MapPin, Phone, Smartphone, UserRoundPen } from '@lucide/vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import Panel from '@/components/Panel.vue';
|
||||
import PersonAvatar from '@/components/PersonAvatar.vue';
|
||||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
|
||||
const props = defineProps({
|
||||
person: { type: Object, required: true },
|
||||
|
|
@ -18,52 +13,57 @@ const props = defineProps({
|
|||
});
|
||||
|
||||
const contact = computed(() => [
|
||||
{ icon: mdiEmailOutline, label: 'E-Mail', value: props.person.email, href: `mailto:${props.person.email}` },
|
||||
{ icon: mdiPhoneOutline, label: 'Telefon', value: props.person.phone, href: props.person.phone && `tel:${props.person.phone}` },
|
||||
{ icon: mdiCellphone, label: 'Mobil', value: props.person.mobile, href: props.person.mobile && `tel:${props.person.mobile}` },
|
||||
{ icon: mdiDomain, label: 'Abteilung', value: props.person.department },
|
||||
{ icon: mdiMapMarkerOutline, label: 'Standort', value: props.person.location },
|
||||
{ icon: Mail, label: 'E-Mail', value: props.person.email, href: `mailto:${props.person.email}` },
|
||||
{ icon: Phone, label: 'Telefon', value: props.person.phone, href: props.person.phone && `tel:${props.person.phone}` },
|
||||
{ icon: Smartphone, label: 'Mobil', value: props.person.mobile, href: props.person.mobile && `tel:${props.person.mobile}` },
|
||||
{ icon: Building2, label: 'Abteilung', value: props.person.department },
|
||||
{ icon: MapPin, label: 'Standort', value: props.person.location },
|
||||
].filter((item) => item.value));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Head :title="person.name" />
|
||||
|
||||
<AppLayout>
|
||||
<v-card rounded="xl" class="mb-6">
|
||||
<div class="d-flex flex-column flex-sm-row align-center ga-6 pa-6 pa-md-8">
|
||||
<UserAvatar :user="person" :size="128" />
|
||||
<div class="flex-grow-1 text-center text-sm-start">
|
||||
<h1 class="text-headline-medium">{{ person.name }}</h1>
|
||||
<div v-if="person.job_title" class="text-title-medium text-medium-emphasis mt-1">{{ person.job_title }}</div>
|
||||
<AppLayout :title="person.name">
|
||||
<section class="overflow-hidden rounded-lg border bg-card">
|
||||
<div class="h-28 bg-brand sm:h-32" style="background-image: linear-gradient(120deg, transparent 40%, rgb(255 255 255 / 0.08))" />
|
||||
<div class="flex flex-col gap-4 px-6 pb-6 sm:flex-row sm:items-end sm:justify-between">
|
||||
<div class="flex flex-col gap-4 sm:flex-row sm:items-end">
|
||||
<PersonAvatar :person="person" class="-mt-14 size-28 text-2xl ring-4 ring-card" />
|
||||
<div class="sm:pb-1">
|
||||
<h1 class="text-2xl font-semibold tracking-tight">{{ person.name }}</h1>
|
||||
<p v-if="person.job_title" class="mt-0.5 text-[15px] text-muted-foreground">{{ person.job_title }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex gap-2 sm:pb-1">
|
||||
<Button v-if="isOwnProfile" variant="outline" as-child>
|
||||
<Link href="/profil/bearbeiten"><UserRoundPen /> Profil bearbeiten</Link>
|
||||
</Button>
|
||||
<Button v-else as-child>
|
||||
<a :href="`mailto:${person.email}`"><Mail /> E-Mail schreiben</a>
|
||||
</Button>
|
||||
</div>
|
||||
<Link v-if="isOwnProfile" href="/profil/bearbeiten">
|
||||
<v-btn variant="tonal" :prepend-icon="mdiAccountEditOutline">Profil bearbeiten</v-btn>
|
||||
</Link>
|
||||
</div>
|
||||
</v-card>
|
||||
</section>
|
||||
|
||||
<v-row>
|
||||
<v-col cols="12" md="5">
|
||||
<v-card rounded="xl" title="Kontakt" class="h-100">
|
||||
<v-list bg-color="transparent">
|
||||
<v-list-item
|
||||
v-for="item in contact"
|
||||
:key="item.label"
|
||||
:prepend-icon="item.icon"
|
||||
:title="item.value"
|
||||
:subtitle="item.label"
|
||||
:href="item.href || undefined"
|
||||
/>
|
||||
</v-list>
|
||||
</v-card>
|
||||
</v-col>
|
||||
<v-col cols="12" md="7">
|
||||
<v-card rounded="xl" title="Über mich" class="h-100">
|
||||
<v-card-text v-if="person.about" class="text-body-large" style="white-space: pre-line">{{ person.about }}</v-card-text>
|
||||
<v-card-text v-else class="text-medium-emphasis">Noch keine Angaben.</v-card-text>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<div class="mt-6 grid gap-6 lg:grid-cols-12">
|
||||
<Panel title="Kontakt" class="lg:col-span-5">
|
||||
<dl class="grid gap-4">
|
||||
<div v-for="item in contact" :key="item.label" class="flex items-start gap-3">
|
||||
<component :is="item.icon" class="mt-0.5 size-4 shrink-0 text-muted-foreground" />
|
||||
<div class="min-w-0">
|
||||
<dt class="text-xs text-muted-foreground">{{ item.label }}</dt>
|
||||
<dd class="truncate text-sm">
|
||||
<a v-if="item.href" :href="item.href" class="text-brand-text hover:underline">{{ item.value }}</a>
|
||||
<template v-else>{{ item.value }}</template>
|
||||
</dd>
|
||||
</div>
|
||||
</div>
|
||||
</dl>
|
||||
</Panel>
|
||||
|
||||
<Panel title="Über mich" class="lg:col-span-7">
|
||||
<p v-if="person.about" class="text-sm leading-relaxed whitespace-pre-line">{{ person.about }}</p>
|
||||
<p v-else class="text-sm text-muted-foreground">Noch keine Angaben.</p>
|
||||
</Panel>
|
||||
</div>
|
||||
</AppLayout>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
import 'vuetify/styles';
|
||||
import { createVuetify } from 'vuetify';
|
||||
import { md3 } from 'vuetify/blueprints';
|
||||
import { aliases, mdi } from 'vuetify/iconsets/mdi-svg';
|
||||
import { de } from 'vuetify/locale';
|
||||
import { vuetifyThemes } from '../theme/material';
|
||||
|
||||
/**
|
||||
* @param {{ primaryColor: string, theme: 'system'|'light'|'dark' }} options
|
||||
*/
|
||||
export function createPortalVuetify({ primaryColor, theme }) {
|
||||
return createVuetify({
|
||||
blueprint: md3,
|
||||
// SVG-Icons aus @mdi/js: nur die tatsächlich genutzten Icons landen im Bundle.
|
||||
icons: {
|
||||
defaultSet: 'mdi',
|
||||
aliases,
|
||||
sets: { mdi },
|
||||
},
|
||||
locale: {
|
||||
locale: 'de',
|
||||
messages: { de },
|
||||
},
|
||||
theme: {
|
||||
defaultTheme: theme,
|
||||
themes: vuetifyThemes(primaryColor),
|
||||
},
|
||||
defaults: {
|
||||
VAppBar: { color: 'surface-container' },
|
||||
VNavigationDrawer: { color: 'surface-container-low' },
|
||||
VCard: { color: 'surface-container-low', elevation: 0 },
|
||||
VTextField: { color: 'primary' },
|
||||
VTextarea: { color: 'primary' },
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
import {
|
||||
argbFromHex,
|
||||
hexFromArgb,
|
||||
Hct,
|
||||
MaterialDynamicColors,
|
||||
SchemeTonalSpot,
|
||||
} from '@material/material-color-utilities';
|
||||
|
||||
/**
|
||||
* Material-3-Rollen, die als Vuetify-Farben bereitgestellt werden.
|
||||
* Schlüssel = Vuetify-Farbname, Wert = Rolle aus MaterialDynamicColors.
|
||||
*/
|
||||
const ROLES = {
|
||||
primary: 'primary',
|
||||
'on-primary': 'onPrimary',
|
||||
'primary-container': 'primaryContainer',
|
||||
'on-primary-container': 'onPrimaryContainer',
|
||||
secondary: 'secondary',
|
||||
'on-secondary': 'onSecondary',
|
||||
'secondary-container': 'secondaryContainer',
|
||||
'on-secondary-container': 'onSecondaryContainer',
|
||||
tertiary: 'tertiary',
|
||||
'on-tertiary': 'onTertiary',
|
||||
'tertiary-container': 'tertiaryContainer',
|
||||
'on-tertiary-container': 'onTertiaryContainer',
|
||||
error: 'error',
|
||||
'on-error': 'onError',
|
||||
'error-container': 'errorContainer',
|
||||
'on-error-container': 'onErrorContainer',
|
||||
background: 'background',
|
||||
'on-background': 'onBackground',
|
||||
surface: 'surface',
|
||||
'on-surface': 'onSurface',
|
||||
'surface-variant': 'surfaceVariant',
|
||||
'on-surface-variant': 'onSurfaceVariant',
|
||||
'surface-bright': 'surfaceBright',
|
||||
'surface-dim': 'surfaceDim',
|
||||
'surface-container-lowest': 'surfaceContainerLowest',
|
||||
'surface-container-low': 'surfaceContainerLow',
|
||||
'surface-container': 'surfaceContainer',
|
||||
'surface-container-high': 'surfaceContainerHigh',
|
||||
'surface-container-highest': 'surfaceContainerHighest',
|
||||
'inverse-surface': 'inverseSurface',
|
||||
'inverse-on-surface': 'inverseOnSurface',
|
||||
'inverse-primary': 'inversePrimary',
|
||||
outline: 'outline',
|
||||
'outline-variant': 'outlineVariant',
|
||||
};
|
||||
|
||||
/**
|
||||
* Berechnet aus einer Seed-Farbe das komplette Material-3-Farbschema
|
||||
* (Dynamic Color, Variante „Tonal Spot“).
|
||||
*
|
||||
* @param {string} seedHex z. B. "#2E6B5E"
|
||||
* @param {boolean} isDark
|
||||
* @returns {Record<string, string>} Vuetify-Farben
|
||||
*/
|
||||
export function materialColors(seedHex, isDark) {
|
||||
const scheme = new SchemeTonalSpot(Hct.fromInt(argbFromHex(seedHex)), isDark, 0);
|
||||
const colors = {};
|
||||
|
||||
for (const [name, role] of Object.entries(ROLES)) {
|
||||
colors[name] = hexFromArgb(MaterialDynamicColors[role].getArgb(scheme));
|
||||
}
|
||||
|
||||
// Vuetify nutzt „surface-light“ z. B. für Chips und Hover-Flächen.
|
||||
colors['surface-light'] = colors['surface-container-high'];
|
||||
|
||||
// Statusfarben ohne M3-Entsprechung: auf die Palette abgestimmte Töne.
|
||||
colors.info = isDark ? '#9ECAFF' : '#0061A4';
|
||||
colors.success = isDark ? '#7DDC7A' : '#1E6C23';
|
||||
colors.warning = isDark ? '#FFB86E' : '#8B5000';
|
||||
|
||||
return colors;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} seedHex
|
||||
*/
|
||||
export function vuetifyThemes(seedHex) {
|
||||
return {
|
||||
light: { dark: false, colors: materialColors(seedHex, false) },
|
||||
dark: { dark: true, colors: materialColors(seedHex, true) },
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue