misc: update mono ui

This commit is contained in:
Xylight committed 2024-09-30 18:06:44 -07:00
1 parent e284ae14ef
commit 8129275fa7
7 files changed
+202 -201

No files matched your search

+3 -2
View File
@@ -51,7 +51,7 @@
<!-- svelte-ignore a11y-click-events-have-key-events --> <!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-positive-tabindex --> <!-- svelte-ignore a11y-positive-tabindex -->
<div <div
class="fixed top-0 left-0 w-screen h-[100svh] overflow-auto bg-black/50 class="fixed top-0 left-0 w-screen h-[100svh] overflow-auto bg-white/50 dark:bg-black/50
flex flex-col z-[100] backdrop-blur-sm" flex flex-col z-[100] backdrop-blur-sm"
transition:fade={{ duration: 150 }} transition:fade={{ duration: 150 }}
on:click={() => history.back()} on:click={() => history.back()}
@@ -80,9 +80,10 @@
transition:fly={{ duration: 350, y: 14, easing: backOut }} transition:fly={{ duration: 350, y: 14, easing: backOut }}
> >
<Material <Material
class="gap-1 p-2 flex flex-row items-center" class="gap-1 p-2 flex flex-row items-center dark:bg-zinc-950"
rounding="full" rounding="full"
padding="none" padding="none"
color="uniform"
on:click={(e) => e.stopPropagation()} on:click={(e) => e.stopPropagation()}
> >
<Button <Button
+121 -125
View File
@@ -1,143 +1,144 @@
<script context="module" lang="ts"> <script context="module" lang="ts">
export type ButtonColor = keyof typeof buttonColor export type ButtonColor = keyof typeof buttonColor
export type ButtonAlignment = keyof typeof buttonAlignment export type ButtonAlignment = keyof typeof buttonAlignment
export type ButtonShadow = keyof typeof buttonShadow export type ButtonShadow = keyof typeof buttonShadow
export const buttonAlignment = { export const buttonAlignment = {
left: 'justify-start text-left', left: 'justify-start text-left',
center: 'justify-center text-center', center: 'justify-center text-center',
right: 'justify-end text-right' right: 'justify-end text-right',
} }
export const buttonColor = { export const buttonColor = {
primary: `border border-transparent bg-primary-900 text-white primary: `border border-transparent bg-primary-900 text-white
dark:bg-primary-100 dark:text-black hover:brightness-125 dark:hover:brightness-90 active:brightness-90 dark:bg-primary-100 dark:text-black hover:brightness-125 dark:hover:brightness-90 active:brightness-90
active:dark:brightness-75`, active:dark:brightness-75`,
secondary: `border border-slate-200 border-b-slate-300 dark:border-zinc-800 dark:border-t-zinc-700/70 bg-white dark:bg-zinc-900 secondary: `border border-slate-200 border-b-slate-300 dark:border-zinc-800 dark:border-t-zinc-700/70 bg-white dark:bg-zinc-900
hover:bg-slate-100 hover:dark:bg-zinc-800 hover:dark:border-zinc-700 hover:dark:border-zinc-700 active:dark:bg-zinc-900 active:bg-slate-200`, hover:bg-slate-100 hover:dark:bg-zinc-800 hover:dark:border-zinc-700 hover:dark:border-zinc-700 active:dark:bg-zinc-900 active:bg-slate-200`,
tertiary: tertiary:
'border border-transparent bg-transparent hover:bg-slate-100 hover:dark:bg-zinc-800 dark:text-zinc-200', 'border border-transparent bg-transparent hover:bg-slate-100 hover:dark:bg-zinc-800 dark:text-zinc-200',
danger: 'border border-red-500 bg-red-500 hover:text-red-500 hover:bg-transparent text-white', danger:
'danger-subtle': 'text-red-500 hover:bg-red-500 hover:!text-inherit', 'border border-red-500 bg-red-500 hover:text-red-500 hover:bg-transparent text-white',
'danger-subtle': 'text-red-500 hover:bg-red-500 hover:!text-inherit',
'success-subtle': 'text-green-500 hover:bg-green-500 hover:!text-inherit', 'success-subtle': 'text-green-500 hover:bg-green-500 hover:!text-inherit',
'warning-subtle': 'text-yellow-500 hover:bg-yellow-500 hover:!text-inherit', 'warning-subtle': 'text-yellow-500 hover:bg-yellow-500 hover:!text-inherit',
ghost: `border border-slate-200 dark:border-zinc-800 bg-transparent ghost: `border border-slate-200 dark:border-zinc-800 bg-transparent
hover:bg-slate-100 hover:dark:bg-zinc-800 hover:dark:border-zinc-700 dark:text-zinc-400 hover:text-inherit hover:bg-slate-100 hover:dark:bg-zinc-800 hover:dark:border-zinc-700 dark:text-zinc-400 hover:text-inherit
hover:dark:text-inherit`, hover:dark:text-inherit`,
elevated: `bg-slate-100 dark:bg-zinc-800 border border-slate-200 elevated: `bg-slate-100 dark:bg-zinc-800 border border-slate-200
dark:border-zinc-700 hover:bg-zinc-200 hover:dark:bg-zinc-700 hover:border-slate-300 dark:border-zinc-700 hover:bg-zinc-200 hover:dark:bg-zinc-700 hover:border-slate-300
hover:dark:border-zinc-600`, hover:dark:border-zinc-600`,
elevatedLow: `bg-slate-100 dark:bg-zinc-900 border border-slate-200 elevatedLow: `bg-slate-100 dark:bg-zinc-900 border border-slate-200
dark:border-zinc-800 hover:bg-slate-200 hover:dark:bg-zinc-800 hover:border-slate-300 dark:border-zinc-800 hover:bg-slate-200 hover:dark:bg-zinc-800 hover:border-slate-300
hover:dark:border-zinc-700`, hover:dark:border-zinc-700`,
none: '' none: '',
} }
export const buttonShadow = { export const buttonShadow = {
sm: 'shadow-sm', sm: 'shadow-sm',
none: 'shadow-none' none: 'shadow-none',
} }
export type ButtonSize = keyof typeof buttonSize export type ButtonSize = keyof typeof buttonSize
export const buttonSize = { export const buttonSize = {
sm: 'px-2 py-1', sm: 'px-2 py-1',
md: 'px-3 py-1.5', md: 'px-3 py-1.5',
lg: 'px-4 py-2', lg: 'px-4 py-2',
xl: 'px-6 py-3', xl: 'px-6 py-3',
'square-sm': 'w-6 h-6', 'square-sm': 'w-6 h-6',
'square-md': 'w-8 h-8', 'square-md': 'w-8 h-8',
'square-lg': 'w-10 h-10', 'square-lg': 'w-10 h-10',
'square-xl': 'w-12 h-12', 'square-xl': 'w-12 h-12',
custom: '' custom: '',
} }
</script> </script>
<script lang="ts"> <script lang="ts">
import Spinner from '../loader/Spinner.svelte' import Spinner from '../loader/Spinner.svelte'
type ButtonRoundness = 'pill' | 'xl' | 'lg' | 'md' | 'none' type ButtonRoundness = 'pill' | 'xl' | 'lg' | 'md' | 'none'
type ButtonRoundingSide = 'all' | 'left' | 'right' | 'top' | 'bottom' type ButtonRoundingSide = 'all' | 'left' | 'right' | 'top' | 'bottom'
const buttonRounding = { const buttonRounding = {
pill: { pill: {
all: 'rounded-full', all: 'rounded-full',
left: 'rounded-l-full', left: 'rounded-l-full',
right: 'rounded-r-full', right: 'rounded-r-full',
top: 'rounded-t-full', top: 'rounded-t-full',
bottom: 'rounded-b-full' bottom: 'rounded-b-full',
}, },
xl: { xl: {
all: 'rounded-xl', all: 'rounded-xl',
left: 'rounded-l-xl', left: 'rounded-l-xl',
right: 'rounded-r-xl', right: 'rounded-r-xl',
top: 'rounded-t-xl', top: 'rounded-t-xl',
bottom: 'rounded-b-xl' bottom: 'rounded-b-xl',
}, },
lg: { lg: {
all: 'rounded-lg', all: 'rounded-lg',
left: 'rounded-l-lg', left: 'rounded-l-lg',
right: 'rounded-r-lg', right: 'rounded-r-lg',
top: 'rounded-t-lg', top: 'rounded-t-lg',
bottom: 'rounded-b-lg' bottom: 'rounded-b-lg',
}, },
md: { md: {
all: 'rounded-md', all: 'rounded-md',
left: 'rounded-l-md', left: 'rounded-l-md',
right: 'rounded-r-md', right: 'rounded-r-md',
top: 'rounded-t-md', top: 'rounded-t-md',
bottom: 'rounded-b-md' bottom: 'rounded-b-md',
}, },
none: { none: {
all: '', all: '',
left: '', left: '',
right: '', right: '',
top: '', top: '',
bottom: '' bottom: '',
} },
} }
export let loading = false export let loading = false
export let submit = false export let submit = false
export let color: ButtonColor = 'secondary' export let color: ButtonColor = 'secondary'
export let size: ButtonSize = 'md' export let size: ButtonSize = 'md'
export let rounding: ButtonRoundness = size == 'lg' ? 'xl' : 'lg' export let rounding: ButtonRoundness = size == 'lg' ? 'xl' : 'lg'
export let roundingSide: ButtonRoundingSide = 'all' export let roundingSide: ButtonRoundingSide = 'all'
export let alignment: ButtonAlignment = 'center' export let alignment: ButtonAlignment = 'center'
export let shadow: ButtonShadow = 'none' export let shadow: ButtonShadow = 'none'
export let column: boolean = false export let column: boolean = false
export let loaderWidth: number | undefined = undefined export let loaderWidth: number | undefined = undefined
export let href: string | undefined = undefined export let href: string | undefined = undefined
</script> </script>
<svelte:element <svelte:element
this={href ? 'a' : 'button'} this={href ? 'a' : 'button'}
role={href ? 'link' : 'button'} role={href ? 'link' : 'button'}
{href} {href}
{...$$restProps} {...$$restProps}
on:click on:click
on:contextmenu on:contextmenu
on:drag on:drag
on:drop on:drop
on:dragstart on:dragstart
on:dragend on:dragend
class=" class="
{buttonColor[color]} {buttonColor[color]}
{buttonSize[size]} {buttonSize[size]}
{buttonRounding[rounding][roundingSide]} {buttonRounding[rounding][roundingSide]}
@@ -147,32 +148,27 @@
disabled:dark:!border-zinc-700 disabled:dark:!bg-zinc-800 disabled:text-inherit disabled:dark:!border-zinc-700 disabled:dark:!bg-zinc-800 disabled:text-inherit
font-medium cursor-pointer font-medium cursor-pointer
{$$props.class} {$$props.class}
{loading ? (color == 'primary' ? '!bg-transparent !text-inherit' : '') : ''}" {loading
type={submit ? 'submit' : 'button'} ? color == 'primary'
? '!bg-transparent !text-inherit'
: ''
: ''}"
type={submit ? 'submit' : 'button'}
> >
<div <div
class="flex {column class="flex {column
? 'flex-col justify-center' ? 'flex-col justify-center'
: 'flex-row items-center'} h-full gap-1.5 {buttonAlignment[alignment]}" : 'flex-row items-center'} h-full gap-1.5 {buttonAlignment[alignment]}"
> >
{#if loading} {#if loading}
<Spinner <Spinner width={loaderWidth ?? 16}
width={loaderWidth />
? loaderWidth {:else if $$slots.prefix}
: size == 'lg' <slot name="prefix" />
? 18 {/if}
: size == 'md' <slot />
? 16 <slot name="suffix" />
: size == 'sm' </div>
? 14
: 14}
/>
{:else if $$slots.prefix}
<slot name="prefix" />
{/if}
<slot />
<slot name="suffix" />
</div>
</svelte:element> </svelte:element>
<!-- <!--
+53 -51
View File
@@ -1,63 +1,65 @@
<script lang="ts"> <script lang="ts">
type Elevation = keyof typeof elevationClass type Elevation = keyof typeof elevationClass
type Padding = keyof typeof paddingClass type Padding = keyof typeof paddingClass
type Rounding = keyof typeof roundedClass type Rounding = keyof typeof roundedClass
type Color = keyof typeof colorClass type Color = keyof typeof colorClass
const elevationClass = { const elevationClass = {
flat: '', flat: '',
low: 'shadow-xs', low: 'shadow-xs',
medium: 'shadow-sm', medium: 'shadow-sm',
high: 'shadow-md', high: 'shadow-md',
xhigh: 'shadow-lg', xhigh: 'shadow-lg',
max: 'shadow-xl' max: 'shadow-xl',
} }
const paddingClass = { const paddingClass = {
none: 'p-0', none: 'p-0',
sm: 'p-2', sm: 'p-2',
md: 'p-4', md: 'p-4',
lg: 'p-5', lg: 'p-5',
xl: 'p-6' xl: 'p-6',
} }
const roundedClass = { const roundedClass = {
none: 'rounded-none', none: 'rounded-none',
sm: 'rounded-sm', sm: 'rounded-sm',
md: 'rounded-md', md: 'rounded-md',
lg: 'rounded-lg', lg: 'rounded-lg',
xl: 'rounded-xl', xl: 'rounded-xl',
'2xl': 'rounded-2xl', '2xl': 'rounded-2xl',
full: 'rounded-full' full: 'rounded-full',
} }
const colorClass = { const colorClass = {
default: default:
'bg-white dark:bg-zinc-900 border border-slate-200 dark:border-zinc-800 border-b-slate-300 dark:border-t-zinc-700', 'bg-white dark:bg-zinc-900 border border-slate-200 dark:border-zinc-800 border-b-slate-300 dark:border-t-zinc-700',
distinct: distinct:
'bg-white dark:bg-zinc-900 border border-slate-200 dark:border-zinc-800 border-b-slate-300 dark:border-t-zinc-700', 'bg-white dark:bg-zinc-900 border border-slate-200 dark:border-zinc-800 border-b-slate-300 dark:border-t-zinc-700',
transparent: transparent:
'border border-slate-200 dark:border-zinc-900 border-b-slate-300 dark:border-t-zinc-800', 'border border-slate-200 dark:border-zinc-900 border-b-slate-300 dark:border-t-zinc-800',
none: '' uniform:
} 'bg-white dark:bg-zinc-900 border border-slate-100 dark:border-zinc-800',
none: '',
}
export let elevation: Elevation = 'flat' export let elevation: Elevation = 'flat'
export let padding: Padding = 'md' export let padding: Padding = 'md'
export let rounding: Rounding = 'lg' export let rounding: Rounding = 'lg'
export let color: Color = 'default' export let color: Color = 'default'
export let element: string = 'div' export let element: string = 'div'
</script> </script>
<svelte:element <svelte:element
this={element} this={element}
on:click on:click
on:keypress on:keypress
on:keydown on:keydown
on:keyup on:keyup
on:focus on:focus
{...$$restProps} {...$$restProps}
class="{elevationClass[elevation]} class="{elevationClass[elevation]}
{paddingClass[padding]} {paddingClass[padding]}
{roundedClass[rounding]} {roundedClass[rounding]}
{colorClass[color]} {colorClass[color]}
@@ -65,5 +67,5 @@
{$$props.class} {$$props.class}
" "
> >
<slot /> <slot />
</svelte:element> </svelte:element>
+7 -6
View File
@@ -14,6 +14,7 @@
export let openOnHover: boolean = false export let openOnHover: boolean = false
export let open: boolean = false export let open: boolean = false
export let manual: boolean = false
export let placement: Placement = 'bottom-start' export let placement: Placement = 'bottom-start'
export let middleware: Middleware[] = [ export let middleware: Middleware[] = [
@@ -29,6 +30,7 @@
{placement} {placement}
{middleware} {middleware}
{strategy} {strategy}
{manual}
{...$$restProps} {...$$restProps}
bind:open bind:open
popoverClass="backdrop-blur-xl rounded-xl w-full max-w-[280px]" popoverClass="backdrop-blur-xl rounded-xl w-full max-w-[280px]"
@@ -40,13 +42,12 @@
class="w-full max-w-[280px] origin-top-left class="w-full max-w-[280px] origin-top-left
max-h-[32rem] overflow-auto list-none shadow-lg rounded-xl" max-h-[32rem] overflow-auto list-none shadow-lg rounded-xl"
> >
<Material <div
class="flex flex-col py-2 list-none bg-white/80 dark:bg-zinc-900/80 px-2 gap-px" class="flex flex-col py-2 list-none bg-white/80 dark:bg-zinc-900/80 px-2 gap-px
color="distinct" rounded-xl
padding="none" border border-slate-200 dark:border-zinc-800 border-opacity-50"
rounding="xl"
> >
<slot /> <slot />
</Material> </div>
</div> </div>
</Popover> </Popover>
+1 -1
View File
@@ -68,7 +68,7 @@
on:click={(e) => { on:click={(e) => {
if (openOnHover) return if (openOnHover) return
if (!el?.contains(e.target)) { if (!el?.contains(e.target) && open) {
open = false open = false
} }
}} }}
+4 -3
View File
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Spinner } from '../index.js' import { Spinner } from '../index.js'
import { backOut } from 'svelte/easing' import { backOut, expoOut } from 'svelte/easing'
import { type Toast, toasts, toastColors } from './toasts.js' import { type Toast, toasts, toastColors } from './toasts.js'
import { import {
InformationCircle, InformationCircle,
@@ -19,11 +19,12 @@
<div <div
class="{toastColors[ class="{toastColors[
toast.type toast.type
]} relative w-80 rounded-lg overflow-hidden flex flex-row items-center" ]} relative w-80 rounded-xl overflow-hidden flex flex-row items-center"
transition:fly={{ transition:fly={{
duration: 300, duration: 600,
y: 8, y: 8,
opacity: 0, opacity: 0,
easing: expoOut,
}} }}
> >
{#if toast.loading} {#if toast.loading}
+13 -13
View File
@@ -1,21 +1,21 @@
<script lang="ts"> <script lang="ts">
import Toast from './Toast.svelte' import Toast from './Toast.svelte'
import { flip } from 'svelte/animate' import { flip } from 'svelte/animate'
import { toasts } from './toasts.js' import { toasts } from './toasts.js'
import { backInOut, backOut } from 'svelte/easing' import { backInOut, backOut, expoOut } from 'svelte/easing'
</script> </script>
<div <div
class="fixed right-0 bottom-0 flex flex-col items-end justify-end z-[200] p-4 class="fixed right-0 bottom-0 flex flex-col items-end justify-end z-[200] p-4
group overflow-hidden h-screen min-w-[24rem] pointer-events-none gap-4" group overflow-hidden h-screen min-w-[24rem] pointer-events-none gap-4"
> >
{#each $toasts as toast, index (toast.id)} {#each $toasts as toast, index (toast.id)}
<div <div
animate:flip={{ duration: 500, easing: backOut }} animate:flip={{ duration: 500, easing: expoOut }}
class="pointer-events-auto transition-all class="pointer-events-auto transition-all
duration-300" duration-300"
> >
<Toast {toast} /> <Toast {toast} />
</div> </div>
{/each} {/each}
</div> </div>