@insymetri/styleguide 0.1.72 → 0.1.73
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.
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
iconName: IconName
|
|
10
10
|
variant?: 'primary' | 'secondary' | 'ghost' | 'danger' | 'success' | 'accent'
|
|
11
11
|
size?: 'sm' | 'md' | 'lg'
|
|
12
|
+
shape?: 'square' | 'circle'
|
|
12
13
|
loading?: boolean
|
|
13
14
|
disabled?: boolean
|
|
14
15
|
class?: string
|
|
@@ -19,6 +20,7 @@
|
|
|
19
20
|
iconName,
|
|
20
21
|
variant = 'ghost',
|
|
21
22
|
size = 'md',
|
|
23
|
+
shape = 'square',
|
|
22
24
|
loading = false,
|
|
23
25
|
disabled = false,
|
|
24
26
|
class: className,
|
|
@@ -47,15 +49,15 @@
|
|
|
47
49
|
} as const
|
|
48
50
|
|
|
49
51
|
const densityClasses = {
|
|
50
|
-
compact: 'w-28 h-28 p-0
|
|
51
|
-
default: 'w-32 h-32 p-0
|
|
52
|
-
comfortable: 'w-40 h-40 p-0
|
|
53
|
-
mobile: 'w-48 h-48 p-0
|
|
52
|
+
compact: 'w-28 h-28 p-0',
|
|
53
|
+
default: 'w-32 h-32 p-0',
|
|
54
|
+
comfortable: 'w-40 h-40 p-0',
|
|
55
|
+
mobile: 'w-48 h-48 p-0',
|
|
54
56
|
} as const
|
|
55
57
|
|
|
56
58
|
const fixedSizeClasses = {
|
|
57
|
-
sm: 'w-24 h-24 p-0
|
|
58
|
-
lg: 'w-40 h-40 p-0
|
|
59
|
+
sm: 'w-24 h-24 p-0',
|
|
60
|
+
lg: 'w-40 h-40 p-0',
|
|
59
61
|
} as const
|
|
60
62
|
|
|
61
63
|
const iconSizeClasses = {
|
|
@@ -67,12 +69,14 @@
|
|
|
67
69
|
const resolvedSizeClasses = $derived(
|
|
68
70
|
size === 'md' ? densityClasses[density.value] : fixedSizeClasses[size]
|
|
69
71
|
)
|
|
72
|
+
|
|
73
|
+
const radiusClass = $derived(shape === 'circle' ? 'rounded-full' : 'rounded-control')
|
|
70
74
|
</script>
|
|
71
75
|
|
|
72
76
|
<button
|
|
73
77
|
bind:this={ref}
|
|
74
78
|
disabled={isDisabled}
|
|
75
|
-
class={cn(baseClasses, variantClasses[variant], resolvedSizeClasses, className)}
|
|
79
|
+
class={cn(baseClasses, variantClasses[variant], resolvedSizeClasses, radiusClass, className)}
|
|
76
80
|
{...restProps}
|
|
77
81
|
>
|
|
78
82
|
{#if loading}
|
|
@@ -4,6 +4,7 @@ type Props = Omit<HTMLButtonAttributes, 'disabled'> & {
|
|
|
4
4
|
iconName: IconName;
|
|
5
5
|
variant?: 'primary' | 'secondary' | 'ghost' | 'danger' | 'success' | 'accent';
|
|
6
6
|
size?: 'sm' | 'md' | 'lg';
|
|
7
|
+
shape?: 'square' | 'circle';
|
|
7
8
|
loading?: boolean;
|
|
8
9
|
disabled?: boolean;
|
|
9
10
|
class?: string;
|
|
@@ -33,6 +33,19 @@
|
|
|
33
33
|
</table>
|
|
34
34
|
</section>
|
|
35
35
|
|
|
36
|
+
<!-- Shape -->
|
|
37
|
+
<section>
|
|
38
|
+
<h2 class="text-default-emphasis text-primary mb-8">Shape</h2>
|
|
39
|
+
<div class="flex items-center gap-16">
|
|
40
|
+
{#each sizes as size}
|
|
41
|
+
<div class="flex items-center gap-8">
|
|
42
|
+
<IIIconButton iconName="plus" variant="secondary" {size} shape="square" />
|
|
43
|
+
<IIIconButton iconName="plus" variant="secondary" {size} shape="circle" />
|
|
44
|
+
</div>
|
|
45
|
+
{/each}
|
|
46
|
+
</div>
|
|
47
|
+
</section>
|
|
48
|
+
|
|
36
49
|
<!-- Different Icons -->
|
|
37
50
|
<section>
|
|
38
51
|
<h2 class="text-default-emphasis text-primary mb-8">Common Icons</h2>
|