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