-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Checkbox component and update admin message types; bump bits-ui v…
…ersion
- Loading branch information
Showing
9 changed files
with
159 additions
and
55 deletions.
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<script lang="ts"> | ||
import { Checkbox as CheckboxPrimitive, 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"; | ||
let { | ||
ref = $bindable(null), | ||
checked = $bindable(false), | ||
class: className, | ||
...restProps | ||
}: WithoutChildrenOrChild<CheckboxPrimitive.RootProps> = $props(); | ||
</script> | ||
|
||
<CheckboxPrimitive.Root | ||
bind:ref | ||
class={cn( | ||
"border-primary ring-offset-background focus-visible:ring-ring data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground peer box-content size-4 shrink-0 rounded-sm border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50", | ||
className | ||
)} | ||
bind:checked | ||
{...restProps} | ||
> | ||
{#snippet children({ checked })} | ||
<div class="flex size-4 items-center justify-center text-current"> | ||
{#if checked === "indeterminate"} | ||
<Minus class="size-3.5" /> | ||
{:else} | ||
<Check class={cn("size-3.5", !checked && "text-transparent")} /> | ||
{/if} | ||
</div> | ||
{/snippet} | ||
</CheckboxPrimitive.Root> |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import Root from "./checkbox.svelte"; | ||
export { | ||
Root, | ||
// | ||
Root as Checkbox, | ||
}; |
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
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export type Token = { | ||
value: string, | ||
email: string, | ||
firstname: string, | ||
lastname: string, | ||
} | ||
|
||
export type Message = { | ||
text: string | undefined, | ||
token: Token | undefined, | ||
} |