mirror of https://github.com/TZGyn/shortener
update select component + remove custom icon for select component
parent
e35b9c2e25
commit
9363f9bd7e
Binary file not shown.
@ -1,15 +1,16 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Select as SelectPrimitive } from 'bits-ui'
|
import { Select as SelectPrimitive } from "bits-ui";
|
||||||
import { cn } from '$lib/utils'
|
import { cn } from "$lib/utils.js";
|
||||||
|
|
||||||
type $$Props = SelectPrimitive.LabelProps
|
type $$Props = SelectPrimitive.LabelProps;
|
||||||
|
|
||||||
let className: $$Props['class'] = undefined
|
let className: $$Props["class"] = undefined;
|
||||||
export { className as class }
|
export { className as class };
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<SelectPrimitive.Label
|
<SelectPrimitive.Label
|
||||||
class={cn('py-1.5 pl-8 pr-2 text-sm font-semibold', className)}
|
class={cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className)}
|
||||||
{...$$restProps}>
|
{...$$restProps}
|
||||||
|
>
|
||||||
<slot />
|
<slot />
|
||||||
</SelectPrimitive.Label>
|
</SelectPrimitive.Label>
|
||||||
|
|||||||
@ -1,13 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Select as SelectPrimitive } from 'bits-ui'
|
import { Select as SelectPrimitive } from "bits-ui";
|
||||||
import { cn } from '$lib/utils'
|
import { cn } from "$lib/utils.js";
|
||||||
|
|
||||||
type $$Props = SelectPrimitive.SeparatorProps
|
type $$Props = SelectPrimitive.SeparatorProps;
|
||||||
|
|
||||||
let className: $$Props['class'] = undefined
|
let className: $$Props["class"] = undefined;
|
||||||
export { className as class }
|
export { className as class };
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<SelectPrimitive.Separator
|
<SelectPrimitive.Separator class={cn("-mx-1 my-1 h-px bg-muted", className)} {...$$restProps} />
|
||||||
class={cn('-mx-1 my-1 h-px bg-muted', className)}
|
|
||||||
{...$$restProps} />
|
|
||||||
|
|||||||
@ -1,33 +1,27 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Select as SelectPrimitive } from 'bits-ui'
|
import { Select as SelectPrimitive } from "bits-ui";
|
||||||
import { ChevronDown } from 'lucide-svelte'
|
import ChevronDown from "lucide-svelte/icons/chevron-down";
|
||||||
import { cn } from '$lib/utils'
|
import { cn } from "$lib/utils.js";
|
||||||
|
|
||||||
type $$Props = SelectPrimitive.TriggerProps
|
type $$Props = SelectPrimitive.TriggerProps;
|
||||||
type $$Events = SelectPrimitive.TriggerEvents
|
type $$Events = SelectPrimitive.TriggerEvents;
|
||||||
|
|
||||||
let className: $$Props['class'] = undefined
|
let className: $$Props["class"] = undefined;
|
||||||
export let customIcon: any
|
export { className as class };
|
||||||
export { className as class }
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<SelectPrimitive.Trigger
|
<SelectPrimitive.Trigger
|
||||||
class={cn(
|
class={cn(
|
||||||
'flex h-10 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
|
"flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 aria-[invalid]:border-destructive [&>span]:line-clamp-1 data-[placeholder]:[&>span]:text-muted-foreground",
|
||||||
className,
|
className
|
||||||
)}
|
)}
|
||||||
{...$$restProps}
|
{...$$restProps}
|
||||||
let:builder
|
let:builder
|
||||||
on:click
|
on:click
|
||||||
on:keydown>
|
on:keydown
|
||||||
|
>
|
||||||
<slot {builder} />
|
<slot {builder} />
|
||||||
<div>
|
<div>
|
||||||
{#if customIcon}
|
|
||||||
<svelte:component
|
|
||||||
this={customIcon}
|
|
||||||
class="h-4 w-4 opacity-50" />
|
|
||||||
{:else}
|
|
||||||
<ChevronDown class="h-4 w-4 opacity-50" />
|
<ChevronDown class="h-4 w-4 opacity-50" />
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
</SelectPrimitive.Trigger>
|
</SelectPrimitive.Trigger>
|
||||||
|
|||||||
Loading…
Reference in New Issue