Expand website and game trackers
Some checks failed
Test and deploy staging / staging (push) Failing after 5m29s
Some checks failed
Test and deploy staging / staging (push) Failing after 5m29s
This commit is contained in:
40
src/lib/components/ui/native-select/native-select.svelte
Normal file
40
src/lib/components/ui/native-select/native-select.svelte
Normal file
@@ -0,0 +1,40 @@
|
||||
<script lang="ts">
|
||||
import ChevronDownIcon from '@lucide/svelte/icons/chevron-down';
|
||||
import { cn, type WithElementRef } from '$lib/utils.js';
|
||||
import type { HTMLSelectAttributes } from 'svelte/elements';
|
||||
|
||||
type NativeSelectProps = Omit<WithElementRef<HTMLSelectAttributes>, 'size'> & {
|
||||
size?: 'sm' | 'default';
|
||||
};
|
||||
|
||||
let {
|
||||
ref = $bindable(null),
|
||||
value = $bindable(),
|
||||
class: className,
|
||||
size = 'default',
|
||||
children,
|
||||
...restProps
|
||||
}: NativeSelectProps = $props();
|
||||
</script>
|
||||
|
||||
<div
|
||||
class={cn('group/native-select relative w-fit has-[select:disabled]:opacity-50', className)}
|
||||
data-slot="native-select-wrapper"
|
||||
data-size={size}
|
||||
>
|
||||
<select
|
||||
bind:value
|
||||
bind:this={ref}
|
||||
data-slot="native-select"
|
||||
data-size={size}
|
||||
class="border-input placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 dark:hover:bg-input/50 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:aria-invalid:border-destructive/50 h-9 w-full min-w-0 appearance-none rounded-md border bg-transparent py-1 pr-8 pl-2.5 text-sm shadow-xs transition-[color,box-shadow] select-none focus-visible:ring-3 aria-invalid:ring-3 data-[size=sm]:h-8 outline-none disabled:pointer-events-none disabled:cursor-not-allowed"
|
||||
{...restProps}
|
||||
>
|
||||
{@render children?.()}
|
||||
</select>
|
||||
<ChevronDownIcon
|
||||
class="text-muted-foreground top-1/2 right-2.5 size-4 -translate-y-1/2 pointer-events-none absolute select-none"
|
||||
aria-hidden
|
||||
data-slot="native-select-icon"
|
||||
/>
|
||||
</div>
|
||||
Reference in New Issue
Block a user