Skip to content

Commit 14bb64e

Browse files
committed
Adds icon size variants and data-slot attributes
Adds new size variants for icon buttons, allowing for more flexible icon sizing. Adds a `data-slot` attribute to input, separator, and textarea components for improved styling and accessibility. Also migrates form button to a simplified component.
1 parent 52ff61c commit 14bb64e

File tree

5 files changed

+13
-8
lines changed

5 files changed

+13
-8
lines changed

src/Exceptionless.Web/ClientApp/src/lib/features/shared/components/ui/button/button.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
2323
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
2424
icon: "size-9",
25+
"icon-sm": "size-8",
26+
"icon-lg": "size-10",
2527
},
2628
},
2729
defaultVariants: {
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
2-
import * as Button from "$comp/ui/button/index.js";
2+
import { Button, type ButtonProps } from "$comp/ui/button/index.js";
33
4-
let { ref = $bindable(null), ...restProps }: Button.Props = $props();
4+
let { ref = $bindable(null), ...restProps }: ButtonProps = $props();
55
</script>
66

7-
<Button.Root bind:ref type="submit" {...restProps} />
7+
<Button bind:ref type="submit" {...restProps} />

src/Exceptionless.Web/ClientApp/src/lib/features/shared/components/ui/input/input.svelte

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@
1515
type,
1616
files = $bindable(),
1717
class: className,
18+
"data-slot": dataSlot = "input",
1819
...restProps
1920
}: Props = $props();
2021
</script>
2122

2223
{#if type === "file"}
2324
<input
2425
bind:this={ref}
25-
data-slot="input"
26+
data-slot={dataSlot}
2627
class={cn(
27-
"selection:bg-primary dark:bg-input/30 selection:text-primary-foreground border-input ring-offset-background placeholder:text-muted-foreground shadow-xs flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 pt-1.5 text-sm font-medium outline-none transition-[color,box-shadow] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
28+
"selection:bg-primary dark:bg-input/30 selection:text-primary-foreground border-input ring-offset-background placeholder:text-muted-foreground shadow-xs flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 pt-1.5 text-sm font-medium outline-none transition-[color,box-shadow] disabled:cursor-not-allowed disabled:opacity-50",
2829
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
2930
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
3031
className
@@ -37,7 +38,7 @@
3738
{:else}
3839
<input
3940
bind:this={ref}
40-
data-slot="input"
41+
data-slot={dataSlot}
4142
class={cn(
4243
"border-input bg-background selection:bg-primary dark:bg-input/30 selection:text-primary-foreground ring-offset-background placeholder:text-muted-foreground shadow-xs flex h-9 w-full min-w-0 rounded-md border px-3 py-1 text-base outline-none transition-[color,box-shadow] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
4344
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",

src/Exceptionless.Web/ClientApp/src/lib/features/shared/components/ui/separator/separator.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
let {
66
ref = $bindable(null),
77
class: className,
8+
"data-slot": dataSlot = "separator",
89
...restProps
910
}: SeparatorPrimitive.RootProps = $props();
1011
</script>
1112

1213
<SeparatorPrimitive.Root
1314
bind:ref
14-
data-slot="separator"
15+
data-slot={dataSlot}
1516
class={cn(
1617
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=vertical]:h-full data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px",
1718
className

src/Exceptionless.Web/ClientApp/src/lib/features/shared/components/ui/textarea/textarea.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
ref = $bindable(null),
77
value = $bindable(),
88
class: className,
9+
"data-slot": dataSlot = "textarea",
910
...restProps
1011
}: WithoutChildren<WithElementRef<HTMLTextareaAttributes>> = $props();
1112
</script>
1213

1314
<textarea
1415
bind:this={ref}
15-
data-slot="textarea"
16+
data-slot={dataSlot}
1617
class={cn(
1718
"border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 field-sizing-content shadow-xs flex min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base outline-none transition-[color,box-shadow] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
1819
className

0 commit comments

Comments
 (0)