-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
55 additions
and
50 deletions.
There are no files selected for viewing
15 changes: 10 additions & 5 deletions
15
src/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,40 @@ | ||
<script lang="ts"> | ||
import { DropdownMenu as DropdownMenuPrimitive, type WithoutChild } from "bits-ui"; | ||
import { DropdownMenu as DropdownMenuPrimitive, type WithoutChildrenOrChild } from "bits-ui"; | ||
import Check from "lucide-svelte/icons/check"; | ||
import Minus from "lucide-svelte/icons/minus"; | ||
import { cn } from "$lib/utils.js"; | ||
import type { Snippet } from "svelte"; | ||
let { | ||
ref = $bindable(null), | ||
checked = $bindable(false), | ||
indeterminate = $bindable(false), | ||
class: className, | ||
children: childrenProp, | ||
...restProps | ||
}: WithoutChild<DropdownMenuPrimitive.CheckboxItemProps> = $props(); | ||
}: WithoutChildrenOrChild<DropdownMenuPrimitive.CheckboxItemProps> & { | ||
children?: Snippet; | ||
} = $props(); | ||
</script> | ||
|
||
<DropdownMenuPrimitive.CheckboxItem | ||
bind:ref | ||
bind:checked | ||
bind:indeterminate | ||
class={cn( | ||
"data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50", | ||
className | ||
)} | ||
{...restProps} | ||
> | ||
{#snippet children({ checked })} | ||
{#snippet children({ checked, indeterminate })} | ||
<span class="absolute left-2 flex size-3.5 items-center justify-center"> | ||
{#if checked === "indeterminate"} | ||
{#if indeterminate} | ||
<Minus class="size-4" /> | ||
{:else} | ||
<Check class={cn("size-4", !checked && "text-transparent")} /> | ||
{/if} | ||
</span> | ||
{@render childrenProp?.({ checked })} | ||
{@render childrenProp?.()} | ||
{/snippet} | ||
</DropdownMenuPrimitive.CheckboxItem> |
15 changes: 10 additions & 5 deletions
15
src/lib/components/ui/menubar/menubar-checkbox-item.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,40 @@ | ||
<script lang="ts"> | ||
import { Menubar as MenubarPrimitive, type WithoutChild } from "bits-ui"; | ||
import { Menubar as MenubarPrimitive, type WithoutChildrenOrChild } from "bits-ui"; | ||
import Check from "lucide-svelte/icons/check"; | ||
import Minus from "lucide-svelte/icons/minus"; | ||
import { cn } from "$lib/utils.js"; | ||
import type { Snippet } from "svelte"; | ||
let { | ||
ref = $bindable(null), | ||
class: className, | ||
checked = $bindable(false), | ||
indeterminate = $bindable(false), | ||
children: childrenProp, | ||
...restProps | ||
}: WithoutChild<MenubarPrimitive.CheckboxItemProps> = $props(); | ||
}: WithoutChildrenOrChild<MenubarPrimitive.CheckboxItemProps> & { | ||
children?: Snippet; | ||
} = $props(); | ||
</script> | ||
|
||
<MenubarPrimitive.CheckboxItem | ||
bind:ref | ||
bind:checked | ||
bind:indeterminate | ||
class={cn( | ||
"data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50", | ||
className | ||
)} | ||
{...restProps} | ||
> | ||
{#snippet children({ checked })} | ||
{#snippet children({ checked, indeterminate })} | ||
<span class="absolute left-2 flex size-3.5 items-center justify-center"> | ||
{#if checked === "indeterminate"} | ||
{#if indeterminate} | ||
<Minus class="size-4" /> | ||
{:else} | ||
<Check class={cn("size-4", !checked && "text-transparent")} /> | ||
{/if} | ||
</span> | ||
{@render childrenProp?.({ checked })} | ||
{@render childrenProp?.()} | ||
{/snippet} | ||
</MenubarPrimitive.CheckboxItem> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,20 @@ | ||
<script lang="ts"> | ||
import { Toaster as Sonner, type ToasterProps as SonnerProps } from 'svelte-sonner'; | ||
import { ColorSchemeStore } from '$lib/stores/ColorSchemeStore'; | ||
import { Toaster as Sonner, type ToasterProps as SonnerProps } from "svelte-sonner"; | ||
import { ColorSchemeStore } from '$lib/stores/ColorSchemeStore'; | ||
let restProps: SonnerProps = $props(); | ||
let restProps: SonnerProps = $props(); | ||
</script> | ||
|
||
<Sonner | ||
theme={$ColorSchemeStore} | ||
class="toaster group" | ||
toastOptions={{ | ||
classes: { | ||
toast: | ||
'group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg', | ||
description: 'group-[.toast]:text-muted-foreground', | ||
actionButton: 'group-[.toast]:bg-primary group-[.toast]:text-primary-foreground', | ||
cancelButton: 'group-[.toast]:bg-muted group-[.toast]:text-muted-foreground', | ||
}, | ||
}} | ||
{...restProps} | ||
theme={$ColorSchemeStore} | ||
class="toaster group" | ||
toastOptions={{ | ||
classes: { | ||
toast: "group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg", | ||
description: "group-[.toast]:text-muted-foreground", | ||
actionButton: "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground", | ||
cancelButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground", | ||
}, | ||
}} | ||
{...restProps} | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters