-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into apporc_staking
- Loading branch information
Showing
44 changed files
with
971 additions
and
317 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
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,3 @@ | ||
export { default as SelectMenu } from './menu.svelte'; | ||
export { default as SelectTrigger } from './trigger.svelte'; | ||
export { default as SelectItem } from './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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<script lang="ts"> | ||
import { melt } from '@melt-ui/svelte'; | ||
import { Check } from 'lucide-svelte'; | ||
import type { Readable } from 'svelte/store'; | ||
import type { ExtendedSelectOption } from '../types'; | ||
interface Props { | ||
variant?: 'pill' | 'form'; | ||
id: string; | ||
// Upstream bug: https://github.com/melt-ui/melt-ui/issues/974 | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
option: any; | ||
item: ExtendedSelectOption; | ||
isSelected: Readable<(value: unknown) => boolean>; | ||
} | ||
const { option, isSelected, ...props }: Props = $props(); | ||
</script> | ||
|
||
<div | ||
class=" | ||
relative | ||
grid | ||
cursor-pointer | ||
grid-cols-[16px_1fr] | ||
items-center | ||
gap-2 | ||
rounded-xl | ||
px-2 | ||
py-1 | ||
font-medium | ||
hover:bg-solar-500 | ||
hover:text-black/95 | ||
focus:z-10 | ||
focus:text-solar-950 | ||
data-[variant=form]:rounded-sm | ||
data-[variant=pill]:rounded-xl | ||
data-[highlighted=true]:bg-solar-500 | ||
data-[highlighted=true]:text-solar-950 | ||
data-[disabled]:opacity-50 | ||
" | ||
data-variant={props.variant} | ||
use:melt={$option(props.item)} | ||
> | ||
{#if props.item.image && typeof props.item.image === 'string'} | ||
<img src={props.item.image} alt={props.item.label} class="mr-2 size-4 object-contain" /> | ||
{:else} | ||
<div class="check"> | ||
<Check class="size-4 {$isSelected(props.item.value) ? 'block' : 'hidden'}" /> | ||
</div> | ||
{/if} | ||
{props.item.label} | ||
</div> |
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,45 @@ | ||
<script lang="ts"> | ||
import { type AnyMeltElement, melt } from '@melt-ui/svelte'; | ||
import { type Snippet } from 'svelte'; | ||
import type { Readable } from 'svelte/store'; | ||
import { fade } from 'svelte/transition'; | ||
interface Props { | ||
variant: 'pill' | 'form'; | ||
id: string; | ||
children: Snippet; | ||
open: Readable<boolean>; | ||
menu: AnyMeltElement; | ||
} | ||
const { menu, ...props }: Props = $props(); | ||
</script> | ||
|
||
{#if props.open} | ||
<div | ||
class=" | ||
z-10 | ||
flex | ||
max-h-[300px] | ||
flex-col | ||
overflow-y-auto | ||
border-2 | ||
border-mineShaft-600 | ||
bg-shark-950 | ||
py-1 | ||
shadow | ||
focus:!ring-0 | ||
data-[variant=form]:rounded-lg | ||
data-[variant=pill]:rounded-2xl | ||
data-[variant=form]:px-2 | ||
data-[variant=form]:py-2 | ||
data-[variant=pill]:px-1 | ||
data-[variant=pill]:py-1 | ||
" | ||
data-variant={props.variant} | ||
use:melt={$menu} | ||
transition:fade={{ duration: 100 }} | ||
id={props.id + '-menu'} | ||
> | ||
{@render props.children()} | ||
</div> | ||
{/if} |
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,53 @@ | ||
<script lang="ts"> | ||
import { type AnyMeltElement, melt } from '@melt-ui/svelte'; | ||
import { ChevronDown } from 'lucide-svelte'; | ||
import { type Snippet } from 'svelte'; | ||
import { type Readable } from 'svelte/store'; | ||
interface Props { | ||
variant?: 'pill' | 'form'; | ||
id: string; | ||
children: Snippet; | ||
open: Readable<boolean>; | ||
trigger: AnyMeltElement; | ||
} | ||
const { trigger, open, ...props }: Props = $props(); | ||
</script> | ||
|
||
<button | ||
class=" | ||
flex | ||
items-center | ||
justify-between | ||
gap-2 | ||
border-2 | ||
border-mineShaft-600 | ||
bg-transparent | ||
pl-4 | ||
pr-3 | ||
font-medium | ||
transition-opacity | ||
hover:opacity-90 | ||
focus:outline-2 | ||
focus:outline-solar-500 | ||
focus-visible:border-transparent | ||
focus-visible:outline | ||
data-[variant=pill]:h-10 | ||
data-[variant=form]:rounded-lg | ||
data-[variant=pill]:rounded-full | ||
data-[variant=form]:py-4 | ||
" | ||
data-variant={props.variant} | ||
use:melt={$trigger} | ||
aria-label="{props.id}-label" | ||
id={props.id} | ||
> | ||
<div class="flex items-center"> | ||
{@render props.children()} | ||
</div> | ||
<ChevronDown | ||
data-open={$open} | ||
class="size-5 transition-transform duration-100 data-[open=true]:rotate-180" | ||
/> | ||
</button> |
Oops, something went wrong.