@invopop/popui 0.1.54 → 0.1.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/button/button.svelte +11 -8
- package/package.json +1 -1
|
@@ -177,6 +177,7 @@
|
|
|
177
177
|
<script lang="ts">
|
|
178
178
|
import { Icon } from '@steeze-ui/svelte-icon'
|
|
179
179
|
import ShortcutWrapper from '../ShortcutWrapper.svelte'
|
|
180
|
+
import clsx from 'clsx'
|
|
180
181
|
|
|
181
182
|
let {
|
|
182
183
|
class: className,
|
|
@@ -200,13 +201,15 @@
|
|
|
200
201
|
let iconOnly = $derived(!children)
|
|
201
202
|
let hasIcon = $derived(!!icon && !iconOnly)
|
|
202
203
|
|
|
203
|
-
let iconSize = $derived(
|
|
204
|
-
|
|
204
|
+
let iconSize = $derived.by(() => {
|
|
205
|
+
if (shortcut) return 'size-3'
|
|
206
|
+
|
|
207
|
+
return {
|
|
205
208
|
sm: 'size-3',
|
|
206
209
|
md: 'size-4',
|
|
207
210
|
lg: 'size-4'
|
|
208
211
|
}[size]
|
|
209
|
-
)
|
|
212
|
+
})
|
|
210
213
|
|
|
211
214
|
// For icon-right, we need to reverse the padding
|
|
212
215
|
let paddingClass = $derived(
|
|
@@ -225,7 +228,7 @@
|
|
|
225
228
|
{#snippet iconContent()}
|
|
226
229
|
{#if shortcut}
|
|
227
230
|
<ShortcutWrapper
|
|
228
|
-
size="
|
|
231
|
+
size="sm"
|
|
229
232
|
theme={['dark', 'primary', 'danger'].includes(variant) ? 'navigation' : 'light'}
|
|
230
233
|
>
|
|
231
234
|
{@render iconElement()}
|
|
@@ -237,10 +240,10 @@
|
|
|
237
240
|
|
|
238
241
|
{#snippet buttonContent()}
|
|
239
242
|
<div
|
|
240
|
-
class={
|
|
241
|
-
'
|
|
242
|
-
!iconOnly &&
|
|
243
|
-
)}
|
|
243
|
+
class={clsx('inline-flex items-center transition-transform group-active:translate-y-px', {
|
|
244
|
+
'gap-1': !iconOnly && !shortcut,
|
|
245
|
+
'gap-1.5': !iconOnly && shortcut
|
|
246
|
+
})}
|
|
244
247
|
>
|
|
245
248
|
{#if icon && !children}
|
|
246
249
|
{@render iconContent()}
|