add medium size to Dialog, leftIcon/rightIcon props to Button
This commit is contained in:
parent
0e5f7e1642
commit
7dcb100412
2 changed files with 27 additions and 2 deletions
|
|
@ -44,6 +44,10 @@
|
|||
leftAccessory?: Snippet | undefined
|
||||
/** Right accessory content */
|
||||
rightAccessory?: Snippet | undefined
|
||||
/** Left icon name */
|
||||
leftIcon?: string | undefined
|
||||
/** Right icon name */
|
||||
rightIcon?: string | undefined
|
||||
/** Icon name (legacy support) */
|
||||
icon?: string | undefined
|
||||
/** Icon position (legacy support) */
|
||||
|
|
@ -77,6 +81,8 @@
|
|||
children,
|
||||
leftAccessory,
|
||||
rightAccessory,
|
||||
leftIcon,
|
||||
rightIcon,
|
||||
icon,
|
||||
iconPosition = 'left',
|
||||
disabled = false,
|
||||
|
|
@ -127,6 +133,10 @@
|
|||
<span class="accessory">
|
||||
{@render leftAccessory()}
|
||||
</span>
|
||||
{:else if leftIcon}
|
||||
<span class="accessory">
|
||||
<Icon name={leftIcon} size={iconSizes[size]} />
|
||||
</span>
|
||||
{:else if hasLeftIcon && !iconOnly && icon}
|
||||
<span class="accessory">
|
||||
<Icon name={icon} size={iconSizes[size]} />
|
||||
|
|
@ -147,6 +157,10 @@
|
|||
<span class="accessory">
|
||||
{@render rightAccessory()}
|
||||
</span>
|
||||
{:else if rightIcon}
|
||||
<span class="accessory">
|
||||
<Icon name={rightIcon} size={iconSizes[size]} />
|
||||
</span>
|
||||
{:else if hasRightIcon && !iconOnly && icon}
|
||||
<span class="accessory">
|
||||
<Icon name={icon} size={iconSizes[size]} />
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import { Dialog as DialogBase } from 'bits-ui'
|
||||
import type { Snippet } from 'svelte'
|
||||
|
||||
type DialogSize = 'default' | 'large'
|
||||
type DialogSize = 'default' | 'medium' | 'large'
|
||||
|
||||
interface DialogProps {
|
||||
open: boolean
|
||||
|
|
@ -18,7 +18,13 @@
|
|||
children
|
||||
}: DialogProps = $props()
|
||||
|
||||
const sizeClass = $derived(size === 'large' ? 'dialog-content-large' : '')
|
||||
const sizeClass = $derived(
|
||||
size === 'large'
|
||||
? 'dialog-content-large'
|
||||
: size === 'medium'
|
||||
? 'dialog-content-medium'
|
||||
: ''
|
||||
)
|
||||
|
||||
function handleOpenChange(newOpen: boolean) {
|
||||
open = newOpen
|
||||
|
|
@ -100,6 +106,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
// Medium dialog variant - wider than default, grows with content
|
||||
:global(.dialog-content-medium) {
|
||||
width: 900px;
|
||||
}
|
||||
|
||||
// Large dialog variant for collection modals, etc.
|
||||
:global(.dialog-content-large) {
|
||||
width: 90vw;
|
||||
|
|
|
|||
Loading…
Reference in a new issue