uisv 0.0.14 → 0.0.15
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/components/alert.svelte +8 -2
- package/dist/components/alert.svelte.d.ts +2 -2
- package/dist/components/badge.svelte +18 -18
- package/dist/components/badge.svelte.d.ts +2 -2
- package/dist/components/banner.svelte +8 -2
- package/dist/components/banner.svelte.d.ts +2 -2
- package/dist/components/breadcrumb.svelte +75 -0
- package/dist/components/breadcrumb.svelte.d.ts +38 -0
- package/dist/components/button.svelte +58 -52
- package/dist/components/button.svelte.d.ts +6 -2
- package/dist/components/calendar.svelte +99 -0
- package/dist/components/calendar.svelte.d.ts +16 -0
- package/dist/components/card.svelte +11 -10
- package/dist/components/card.svelte.d.ts +2 -1
- package/dist/components/collapsible.svelte +76 -0
- package/dist/components/collapsible.svelte.d.ts +15 -0
- package/dist/components/icon.svelte +58 -0
- package/dist/components/icon.svelte.d.ts +8 -0
- package/dist/components/index.d.ts +12 -0
- package/dist/components/index.js +12 -0
- package/dist/components/input-number.svelte +175 -0
- package/dist/components/input-number.svelte.d.ts +38 -0
- package/dist/components/input-time.svelte +3 -4
- package/dist/components/input-time.svelte.d.ts +3 -4
- package/dist/components/input.svelte +2 -2
- package/dist/components/input.svelte.d.ts +2 -2
- package/dist/components/kbd.svelte +35 -35
- package/dist/components/kbd.svelte.d.ts +2 -2
- package/dist/components/pin-input.svelte +20 -20
- package/dist/components/pin-input.svelte.d.ts +2 -2
- package/dist/components/placeholder.svelte +1 -1
- package/dist/components/select.svelte +2 -2
- package/dist/components/select.svelte.d.ts +2 -2
- package/dist/components/seperator.svelte +212 -0
- package/dist/components/seperator.svelte.d.ts +22 -0
- package/dist/date.d.ts +1 -0
- package/dist/date.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/utilities.svelte.d.ts +7 -0
- package/dist/utilities.svelte.js +20 -0
- package/dist/vite.d.ts +2 -3
- package/dist/vite.js +26 -16
- package/package.json +18 -23
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
type PropColor,
|
|
4
|
+
isSnippet,
|
|
5
|
+
type ButtonProps,
|
|
6
|
+
Button,
|
|
7
|
+
type PropVariant,
|
|
8
|
+
} from '../index.js';
|
|
3
9
|
import type { Component, Snippet } from 'svelte';
|
|
4
10
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
5
11
|
import { tv } from 'tailwind-variants';
|
|
@@ -10,7 +16,7 @@
|
|
|
10
16
|
description?: string | Snippet;
|
|
11
17
|
icon?: string | Snippet | Component;
|
|
12
18
|
color?: PropColor;
|
|
13
|
-
variant?:
|
|
19
|
+
variant?: Exclude<PropVariant, 'none' | 'ghost'>;
|
|
14
20
|
position?: 'bottom' | 'right';
|
|
15
21
|
actions?: ButtonProps[];
|
|
16
22
|
close?: boolean | ButtonProps;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PropColor, type ButtonProps } from '../index.js';
|
|
1
|
+
import { type PropColor, type ButtonProps, type PropVariant } from '../index.js';
|
|
2
2
|
import type { Component, Snippet } from 'svelte';
|
|
3
3
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
4
|
export type AlertProps = {
|
|
@@ -6,7 +6,7 @@ export type AlertProps = {
|
|
|
6
6
|
description?: string | Snippet;
|
|
7
7
|
icon?: string | Snippet | Component;
|
|
8
8
|
color?: PropColor;
|
|
9
|
-
variant?:
|
|
9
|
+
variant?: Exclude<PropVariant, 'none' | 'ghost'>;
|
|
10
10
|
position?: 'bottom' | 'right';
|
|
11
11
|
actions?: ButtonProps[];
|
|
12
12
|
close?: boolean | ButtonProps;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { Component, Snippet } from 'svelte';
|
|
3
3
|
import { tv } from 'tailwind-variants';
|
|
4
|
-
import { type PropColor, isSnippet } from '../index.js';
|
|
4
|
+
import { type PropColor, type PropVariant, isSnippet } from '../index.js';
|
|
5
5
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
6
6
|
|
|
7
7
|
export type BadgeProps = {
|
|
8
8
|
label?: string;
|
|
9
9
|
color?: PropColor;
|
|
10
|
-
variant?:
|
|
10
|
+
variant?: Exclude<PropVariant, 'none' | 'ghost'>;
|
|
11
11
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
12
12
|
icon?: string | Snippet | Component;
|
|
13
13
|
trailingicon?: boolean;
|
|
@@ -76,22 +76,22 @@
|
|
|
76
76
|
{
|
|
77
77
|
color: 'info',
|
|
78
78
|
variant: 'solid',
|
|
79
|
-
class: 'bg-
|
|
79
|
+
class: 'bg-info-500',
|
|
80
80
|
},
|
|
81
81
|
{
|
|
82
82
|
color: 'success',
|
|
83
83
|
variant: 'solid',
|
|
84
|
-
class: 'bg-
|
|
84
|
+
class: 'bg-success-500',
|
|
85
85
|
},
|
|
86
86
|
{
|
|
87
87
|
color: 'error',
|
|
88
88
|
variant: 'solid',
|
|
89
|
-
class: 'bg-
|
|
89
|
+
class: 'bg-error-500',
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
92
|
color: 'warning',
|
|
93
93
|
variant: 'solid',
|
|
94
|
-
class: 'bg-
|
|
94
|
+
class: 'bg-warning-500',
|
|
95
95
|
},
|
|
96
96
|
|
|
97
97
|
{
|
|
@@ -107,22 +107,22 @@
|
|
|
107
107
|
{
|
|
108
108
|
color: 'info',
|
|
109
109
|
variant: 'outline',
|
|
110
|
-
class: 'border-
|
|
110
|
+
class: 'border-info-300 text-info-500',
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
113
|
color: 'success',
|
|
114
114
|
variant: 'outline',
|
|
115
|
-
class: 'border-green-300 text-
|
|
115
|
+
class: 'border-green-300 text-success-500',
|
|
116
116
|
},
|
|
117
117
|
{
|
|
118
118
|
color: 'error',
|
|
119
119
|
variant: 'outline',
|
|
120
|
-
class: 'border-
|
|
120
|
+
class: 'border-error-300 text-error-500',
|
|
121
121
|
},
|
|
122
122
|
{
|
|
123
123
|
color: 'warning',
|
|
124
124
|
variant: 'outline',
|
|
125
|
-
class: 'border-
|
|
125
|
+
class: 'border-warning-300 text-warning-500',
|
|
126
126
|
},
|
|
127
127
|
|
|
128
128
|
{
|
|
@@ -138,22 +138,22 @@
|
|
|
138
138
|
{
|
|
139
139
|
color: 'info',
|
|
140
140
|
variant: 'soft',
|
|
141
|
-
class: 'bg-
|
|
141
|
+
class: 'bg-info-100 text-info-500',
|
|
142
142
|
},
|
|
143
143
|
{
|
|
144
144
|
color: 'success',
|
|
145
145
|
variant: 'soft',
|
|
146
|
-
class: 'bg-
|
|
146
|
+
class: 'bg-success-100 text-success-500',
|
|
147
147
|
},
|
|
148
148
|
{
|
|
149
149
|
color: 'error',
|
|
150
150
|
variant: 'soft',
|
|
151
|
-
class: 'bg-
|
|
151
|
+
class: 'bg-error-100 text-error-500',
|
|
152
152
|
},
|
|
153
153
|
{
|
|
154
154
|
color: 'warning',
|
|
155
155
|
variant: 'soft',
|
|
156
|
-
class: 'bg-
|
|
156
|
+
class: 'bg-warning-100 text-warning-500 ',
|
|
157
157
|
},
|
|
158
158
|
|
|
159
159
|
{
|
|
@@ -169,22 +169,22 @@
|
|
|
169
169
|
{
|
|
170
170
|
color: 'info',
|
|
171
171
|
variant: 'subtle',
|
|
172
|
-
class: 'bg-
|
|
172
|
+
class: 'bg-info-50 text-info-600 border-info-200',
|
|
173
173
|
},
|
|
174
174
|
{
|
|
175
175
|
color: 'success',
|
|
176
176
|
variant: 'subtle',
|
|
177
|
-
class: 'bg-
|
|
177
|
+
class: 'bg-success-100 text-success-600 border-success-300',
|
|
178
178
|
},
|
|
179
179
|
{
|
|
180
180
|
color: 'error',
|
|
181
181
|
variant: 'subtle',
|
|
182
|
-
class: 'bg-
|
|
182
|
+
class: 'bg-error-50 text-error-600 border-error-200',
|
|
183
183
|
},
|
|
184
184
|
{
|
|
185
185
|
color: 'warning',
|
|
186
186
|
variant: 'subtle',
|
|
187
|
-
class: 'bg-
|
|
187
|
+
class: 'bg-warning-50 text-warning-600 border-warning-300',
|
|
188
188
|
},
|
|
189
189
|
],
|
|
190
190
|
})({ variant, size, color });
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Component, Snippet } from 'svelte';
|
|
2
|
-
import { type PropColor } from '../index.js';
|
|
2
|
+
import { type PropColor, type PropVariant } from '../index.js';
|
|
3
3
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
4
|
export type BadgeProps = {
|
|
5
5
|
label?: string;
|
|
6
6
|
color?: PropColor;
|
|
7
|
-
variant?:
|
|
7
|
+
variant?: Exclude<PropVariant, 'none' | 'ghost'>;
|
|
8
8
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
9
|
icon?: string | Snippet | Component;
|
|
10
10
|
trailingicon?: boolean;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
isSnippet,
|
|
4
|
+
type PropColor,
|
|
5
|
+
type ButtonProps,
|
|
6
|
+
Button,
|
|
7
|
+
type PropVariant,
|
|
8
|
+
} from '../index.js';
|
|
3
9
|
import type { Component, Snippet } from 'svelte';
|
|
4
10
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
5
11
|
import { tv } from 'tailwind-variants';
|
|
@@ -10,7 +16,7 @@
|
|
|
10
16
|
title: string | Snippet;
|
|
11
17
|
icon?: string | Snippet | Component;
|
|
12
18
|
color?: PropColor;
|
|
13
|
-
variant?:
|
|
19
|
+
variant?: Exclude<PropVariant, 'none' | 'ghost'>;
|
|
14
20
|
actions?: ButtonProps[];
|
|
15
21
|
close?: boolean | ButtonProps;
|
|
16
22
|
href?: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type PropColor, type ButtonProps } from '../index.js';
|
|
1
|
+
import { type PropColor, type ButtonProps, type PropVariant } from '../index.js';
|
|
2
2
|
import type { Component, Snippet } from 'svelte';
|
|
3
3
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
4
|
export type BannerProps = {
|
|
5
5
|
title: string | Snippet;
|
|
6
6
|
icon?: string | Snippet | Component;
|
|
7
7
|
color?: PropColor;
|
|
8
|
-
variant?:
|
|
8
|
+
variant?: Exclude<PropVariant, 'none' | 'ghost'>;
|
|
9
9
|
actions?: ButtonProps[];
|
|
10
10
|
close?: boolean | ButtonProps;
|
|
11
11
|
href?: string;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { Component, Snippet } from 'svelte';
|
|
3
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
+
import { Button, Icon, type ButtonProps } from './index.js';
|
|
5
|
+
import { tv } from 'tailwind-variants';
|
|
6
|
+
import { isSnippet } from '../utilities.svelte.js';
|
|
7
|
+
|
|
8
|
+
export type BreadcrumbItem = Omit<ButtonProps, 'label'> & {
|
|
9
|
+
label?: string;
|
|
10
|
+
icon?: string | Component;
|
|
11
|
+
snippet?: string;
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type BreadcrumbProps = {
|
|
16
|
+
items: BreadcrumbItem[];
|
|
17
|
+
seperator?: string | Component | Snippet;
|
|
18
|
+
labelkey?: string;
|
|
19
|
+
[key: string]: any | Snippet<[BreadcrumbItem]>;
|
|
20
|
+
};
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<script lang="ts" generics="T extends BreadcrumbItem">
|
|
24
|
+
let {
|
|
25
|
+
items,
|
|
26
|
+
labelkey = 'label',
|
|
27
|
+
seperator = 'i-lucide:chevron-right',
|
|
28
|
+
...rest
|
|
29
|
+
}: BreadcrumbProps = $props();
|
|
30
|
+
|
|
31
|
+
const variants = $derived(
|
|
32
|
+
tv({
|
|
33
|
+
slots: {
|
|
34
|
+
root: '',
|
|
35
|
+
list: 'flex items-center',
|
|
36
|
+
item: '',
|
|
37
|
+
seperator: '',
|
|
38
|
+
},
|
|
39
|
+
variants: {},
|
|
40
|
+
})(),
|
|
41
|
+
);
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<nav class={variants.root({})}>
|
|
45
|
+
<ol class={variants.list({})}>
|
|
46
|
+
{#each items as item, idx (idx)}
|
|
47
|
+
<li class={variants.item({})}>
|
|
48
|
+
{#if item.snippet}
|
|
49
|
+
{@const render = rest[item.snippet]}
|
|
50
|
+
|
|
51
|
+
{#if isSnippet(render)}
|
|
52
|
+
{@render (render as Snippet<[BreadcrumbItem]>)(item)}
|
|
53
|
+
{/if}
|
|
54
|
+
{:else}
|
|
55
|
+
<Button
|
|
56
|
+
label={item[labelkey]}
|
|
57
|
+
icon={item.icon}
|
|
58
|
+
href={item.href}
|
|
59
|
+
variant="link"
|
|
60
|
+
color="surface"
|
|
61
|
+
{...item}
|
|
62
|
+
/>
|
|
63
|
+
{/if}
|
|
64
|
+
</li>
|
|
65
|
+
|
|
66
|
+
{#if idx < items.length - 1}
|
|
67
|
+
{#if isSnippet(seperator)}
|
|
68
|
+
{@render seperator()}
|
|
69
|
+
{:else}
|
|
70
|
+
<Icon name={seperator} class={variants.seperator({})} />
|
|
71
|
+
{/if}
|
|
72
|
+
{/if}
|
|
73
|
+
{/each}
|
|
74
|
+
</ol>
|
|
75
|
+
</nav>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Component, Snippet } from 'svelte';
|
|
2
|
+
import { type ButtonProps } from './index.js';
|
|
3
|
+
export type BreadcrumbItem = Omit<ButtonProps, 'label'> & {
|
|
4
|
+
label?: string;
|
|
5
|
+
icon?: string | Component;
|
|
6
|
+
snippet?: string;
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
};
|
|
9
|
+
export type BreadcrumbProps = {
|
|
10
|
+
items: BreadcrumbItem[];
|
|
11
|
+
seperator?: string | Component | Snippet;
|
|
12
|
+
labelkey?: string;
|
|
13
|
+
[key: string]: any | Snippet<[BreadcrumbItem]>;
|
|
14
|
+
};
|
|
15
|
+
declare function $$render<T extends BreadcrumbItem>(): {
|
|
16
|
+
props: BreadcrumbProps;
|
|
17
|
+
exports: {};
|
|
18
|
+
bindings: "";
|
|
19
|
+
slots: {};
|
|
20
|
+
events: {};
|
|
21
|
+
};
|
|
22
|
+
declare class __sveltets_Render<T extends BreadcrumbItem> {
|
|
23
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
24
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
25
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
26
|
+
bindings(): "";
|
|
27
|
+
exports(): {};
|
|
28
|
+
}
|
|
29
|
+
interface $$IsomorphicComponent {
|
|
30
|
+
new <T extends BreadcrumbItem>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
31
|
+
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
32
|
+
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
33
|
+
<T extends BreadcrumbItem>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
34
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
35
|
+
}
|
|
36
|
+
declare const Breadcrumb: $$IsomorphicComponent;
|
|
37
|
+
type Breadcrumb<T extends BreadcrumbItem> = InstanceType<typeof Breadcrumb<T>>;
|
|
38
|
+
export default Breadcrumb;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import { type Component, type Snippet } from 'svelte';
|
|
3
|
-
import { type PropColor } from '../index.js';
|
|
3
|
+
import { isComponent, type PropColor, type PropVariant } from '../index.js';
|
|
4
4
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
5
5
|
// import { FORM_LOADING_CONTEXT_KEY } from '../utils/keys.js';
|
|
6
6
|
import { isSnippet } from '../index.js';
|
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
iconposition?: 'left' | 'right';
|
|
25
25
|
/** Icon when `loading` is `false` */
|
|
26
26
|
icon?: string | Snippet | Component;
|
|
27
|
+
leadingicon?: string | Snippet | Component;
|
|
28
|
+
trailingicon?: string | Snippet | Component;
|
|
27
29
|
/** Route Location the link should navigate to when clicked on. */
|
|
28
30
|
href?: string;
|
|
29
31
|
label?: string;
|
|
@@ -35,7 +37,7 @@
|
|
|
35
37
|
/**
|
|
36
38
|
* @defaultValue 'solid'
|
|
37
39
|
*/
|
|
38
|
-
variant?:
|
|
40
|
+
variant?: Exclude<PropVariant, 'none'> | 'link';
|
|
39
41
|
// activevariant?: ButtonVariant;
|
|
40
42
|
/**
|
|
41
43
|
* @defaultValue 'md'
|
|
@@ -49,6 +51,8 @@
|
|
|
49
51
|
ui?: {
|
|
50
52
|
base?: ClassNameValue;
|
|
51
53
|
icon?: ClassNameValue;
|
|
54
|
+
leadingicon?: ClassNameValue;
|
|
55
|
+
trailingicon?: ClassNameValue;
|
|
52
56
|
};
|
|
53
57
|
children?: Snippet;
|
|
54
58
|
};
|
|
@@ -75,9 +79,11 @@
|
|
|
75
79
|
href,
|
|
76
80
|
icon,
|
|
77
81
|
loading,
|
|
78
|
-
loadingicon,
|
|
82
|
+
loadingicon = 'i-lucide-loader-circle',
|
|
79
83
|
target,
|
|
80
84
|
type,
|
|
85
|
+
trailingicon,
|
|
86
|
+
leadingicon,
|
|
81
87
|
}: ButtonProps = $props();
|
|
82
88
|
|
|
83
89
|
let internal_loading = $state(false);
|
|
@@ -132,32 +138,32 @@
|
|
|
132
138
|
{
|
|
133
139
|
color: 'primary',
|
|
134
140
|
variant: 'solid',
|
|
135
|
-
class: 'bg-primary-500 hover:
|
|
141
|
+
class: 'bg-primary-500 hover:bg-primary-400',
|
|
136
142
|
},
|
|
137
143
|
{
|
|
138
144
|
color: 'surface',
|
|
139
145
|
variant: 'solid',
|
|
140
|
-
class: 'bg-surface-inverted text-inverted hover:
|
|
146
|
+
class: 'bg-surface-inverted text-inverted hover:bg-toned',
|
|
141
147
|
},
|
|
142
148
|
{
|
|
143
149
|
color: 'info',
|
|
144
150
|
variant: 'solid',
|
|
145
|
-
class: 'bg-info-500 hover:
|
|
151
|
+
class: 'bg-info-500 hover:bg-info-400',
|
|
146
152
|
},
|
|
147
153
|
{
|
|
148
154
|
color: 'success',
|
|
149
155
|
variant: 'solid',
|
|
150
|
-
class: 'bg-success-500 hover:
|
|
156
|
+
class: 'bg-success-500 hover:bg-success-400',
|
|
151
157
|
},
|
|
152
158
|
{
|
|
153
159
|
color: 'error',
|
|
154
160
|
variant: 'solid',
|
|
155
|
-
class: 'bg-error-500 hover:
|
|
161
|
+
class: 'bg-error-500 hover:bg-error-400',
|
|
156
162
|
},
|
|
157
163
|
{
|
|
158
164
|
color: 'warning',
|
|
159
165
|
variant: 'solid',
|
|
160
|
-
class: 'bg-warning-500 hover:
|
|
166
|
+
class: 'bg-warning-500 hover:bg-warning-400',
|
|
161
167
|
},
|
|
162
168
|
|
|
163
169
|
{
|
|
@@ -165,7 +171,7 @@
|
|
|
165
171
|
variant: 'outline',
|
|
166
172
|
class: {
|
|
167
173
|
base: [
|
|
168
|
-
'border-primary/50 text-primary-500 hover:
|
|
174
|
+
'border-primary/50 text-primary-500 hover:bg-primary-50',
|
|
169
175
|
'dark:hover:bg-primary-950',
|
|
170
176
|
],
|
|
171
177
|
},
|
|
@@ -184,7 +190,7 @@
|
|
|
184
190
|
color: 'info',
|
|
185
191
|
variant: 'outline',
|
|
186
192
|
class: {
|
|
187
|
-
base: ['border-info/50 text-
|
|
193
|
+
base: ['border-info/50 text-info-500 hover:bg-info/10', 'dark:hover:bg-info-950'],
|
|
188
194
|
},
|
|
189
195
|
},
|
|
190
196
|
{
|
|
@@ -201,7 +207,7 @@
|
|
|
201
207
|
color: 'error',
|
|
202
208
|
variant: 'outline',
|
|
203
209
|
class: {
|
|
204
|
-
base: ['border-
|
|
210
|
+
base: ['border-error/50 text-error-500 hover:bg-error/10', 'dark:hover:bg-error-950'],
|
|
205
211
|
},
|
|
206
212
|
},
|
|
207
213
|
{
|
|
@@ -209,7 +215,7 @@
|
|
|
209
215
|
variant: 'outline',
|
|
210
216
|
class: {
|
|
211
217
|
base: [
|
|
212
|
-
'border-warning/50 text-warning-500 hover:
|
|
218
|
+
'border-warning/50 text-warning-500 hover:bg-warning/10',
|
|
213
219
|
'dark:hover:bg-warning-950',
|
|
214
220
|
],
|
|
215
221
|
},
|
|
@@ -218,125 +224,125 @@
|
|
|
218
224
|
{
|
|
219
225
|
color: 'primary',
|
|
220
226
|
variant: 'soft',
|
|
221
|
-
class: 'bg-primary-50 text-primary-500 hover:
|
|
227
|
+
class: 'bg-primary-50 text-primary-500 hover:bg-primary-100',
|
|
222
228
|
},
|
|
223
229
|
{
|
|
224
230
|
color: 'surface',
|
|
225
231
|
variant: 'soft',
|
|
226
|
-
class: 'bg-surface-100 text-surface-800 hover:
|
|
232
|
+
class: 'bg-surface-100 text-surface-800 hover:bg-surface-200',
|
|
227
233
|
},
|
|
228
234
|
{
|
|
229
235
|
color: 'info',
|
|
230
236
|
variant: 'soft',
|
|
231
|
-
class: 'bg-
|
|
237
|
+
class: 'bg-info-100 text-info-500 hover:bg-info-50',
|
|
232
238
|
},
|
|
233
239
|
{
|
|
234
240
|
color: 'success',
|
|
235
241
|
variant: 'soft',
|
|
236
|
-
class: 'bg-
|
|
242
|
+
class: 'bg-success-100 text-success-500 hover:bg-success-50',
|
|
237
243
|
},
|
|
238
244
|
{
|
|
239
245
|
color: 'error',
|
|
240
246
|
variant: 'soft',
|
|
241
|
-
class: 'bg-
|
|
247
|
+
class: 'bg-error-100 text-error-500 hover:bg-error-50',
|
|
242
248
|
},
|
|
243
249
|
{
|
|
244
250
|
color: 'warning',
|
|
245
251
|
variant: 'soft',
|
|
246
|
-
class: 'bg-
|
|
252
|
+
class: 'bg-warning-100 text-warning-500 hover:bg-warning-50',
|
|
247
253
|
},
|
|
248
254
|
|
|
249
255
|
{
|
|
250
256
|
color: 'primary',
|
|
251
257
|
variant: 'subtle',
|
|
252
|
-
class: 'bg-primary-50 text-primary-500 border-primary-200 hover:
|
|
258
|
+
class: 'bg-primary-50 text-primary-500 border-primary-200 hover:bg-primary-100',
|
|
253
259
|
},
|
|
254
260
|
{
|
|
255
261
|
color: 'surface',
|
|
256
262
|
variant: 'subtle',
|
|
257
|
-
class: 'bg-surface-50 text-surface-800 border-surface-300 hover:
|
|
263
|
+
class: 'bg-surface-50 text-surface-800 border-surface-300 hover:bg-surface-100',
|
|
258
264
|
},
|
|
259
265
|
{
|
|
260
266
|
color: 'info',
|
|
261
267
|
variant: 'subtle',
|
|
262
|
-
class: 'bg-
|
|
268
|
+
class: 'bg-info-50 text-info-600 border-info-200 hover:bg-info-100',
|
|
263
269
|
},
|
|
264
270
|
{
|
|
265
271
|
color: 'success',
|
|
266
272
|
variant: 'subtle',
|
|
267
|
-
class: 'bg-
|
|
273
|
+
class: 'bg-success-100 text-success-600 border-success-300 hover:bg-success-100',
|
|
268
274
|
},
|
|
269
275
|
{
|
|
270
276
|
color: 'error',
|
|
271
277
|
variant: 'subtle',
|
|
272
|
-
class: 'bg-
|
|
278
|
+
class: 'bg-error-50 text-error-600 border-error-200 hover:bg-error-100',
|
|
273
279
|
},
|
|
274
280
|
{
|
|
275
281
|
color: 'warning',
|
|
276
282
|
variant: 'subtle',
|
|
277
|
-
class: 'bg-
|
|
283
|
+
class: 'bg-warning-50 text-warning-600 border-warning-300 hover:bg-warning-100',
|
|
278
284
|
},
|
|
279
285
|
|
|
280
286
|
{
|
|
281
287
|
color: 'primary',
|
|
282
288
|
variant: 'ghost',
|
|
283
|
-
class: 'text-primary-500 hover:
|
|
289
|
+
class: 'text-primary-500 hover:bg-primary-100',
|
|
284
290
|
},
|
|
285
291
|
{
|
|
286
292
|
color: 'surface',
|
|
287
293
|
variant: 'ghost',
|
|
288
|
-
class: 'text-surface-inverted hover
|
|
294
|
+
class: 'text-surface-inverted hover-surface-elevated text-surface-inverted)',
|
|
289
295
|
},
|
|
290
296
|
{
|
|
291
297
|
color: 'info',
|
|
292
298
|
variant: 'ghost',
|
|
293
|
-
class: 'text-
|
|
299
|
+
class: 'text-info-600 hover:bg-info-100',
|
|
294
300
|
},
|
|
295
301
|
{
|
|
296
302
|
color: 'success',
|
|
297
303
|
variant: 'ghost',
|
|
298
|
-
class: 'text-
|
|
304
|
+
class: 'text-success-600 hover:bg-success-100',
|
|
299
305
|
},
|
|
300
306
|
{
|
|
301
307
|
color: 'error',
|
|
302
308
|
variant: 'ghost',
|
|
303
|
-
class: 'text-
|
|
309
|
+
class: 'text-error-600 hover:bg-error-100',
|
|
304
310
|
},
|
|
305
311
|
{
|
|
306
312
|
color: 'warning',
|
|
307
313
|
variant: 'ghost',
|
|
308
|
-
class: 'text-
|
|
314
|
+
class: 'text-warning-600 hover:bg-warning-100',
|
|
309
315
|
},
|
|
310
316
|
|
|
311
317
|
{
|
|
312
318
|
color: 'primary',
|
|
313
319
|
variant: 'link',
|
|
314
|
-
class: 'text-primary-500 hover:
|
|
320
|
+
class: 'text-primary-500 hover:text-primary-400',
|
|
315
321
|
},
|
|
316
322
|
{
|
|
317
323
|
color: 'surface',
|
|
318
324
|
variant: 'link',
|
|
319
|
-
class: 'text-muted hover:
|
|
325
|
+
class: 'text-muted hover:text-surface-inverted',
|
|
320
326
|
},
|
|
321
327
|
{
|
|
322
328
|
color: 'info',
|
|
323
329
|
variant: 'link',
|
|
324
|
-
class: 'text-
|
|
330
|
+
class: 'text-info-500 hover:text-info-400',
|
|
325
331
|
},
|
|
326
332
|
{
|
|
327
333
|
color: 'success',
|
|
328
334
|
variant: 'link',
|
|
329
|
-
class: 'text-
|
|
335
|
+
class: 'text-success-500 hover:text-success-400',
|
|
330
336
|
},
|
|
331
337
|
{
|
|
332
338
|
color: 'error',
|
|
333
339
|
variant: 'link',
|
|
334
|
-
class: 'text-
|
|
340
|
+
class: 'text-error-500 hover:text-error-400',
|
|
335
341
|
},
|
|
336
342
|
{
|
|
337
343
|
color: 'warning',
|
|
338
344
|
variant: 'link',
|
|
339
|
-
class: 'text-
|
|
345
|
+
class: 'text-warning-500 hover:text-warning-400',
|
|
340
346
|
},
|
|
341
347
|
],
|
|
342
348
|
})({ variant, color, size, block, disabled: disabled || is_loading }),
|
|
@@ -379,8 +385,8 @@
|
|
|
379
385
|
{/if}
|
|
380
386
|
|
|
381
387
|
{#snippet Content()}
|
|
382
|
-
{#if iconposition === 'left'}
|
|
383
|
-
{@render Icon()}
|
|
388
|
+
{#if iconposition === 'left' || leadingicon}
|
|
389
|
+
{@render Icon(is_loading ? loadingicon : leadingicon || icon, ui.leadingicon)}
|
|
384
390
|
{/if}
|
|
385
391
|
|
|
386
392
|
{#if label}
|
|
@@ -389,21 +395,21 @@
|
|
|
389
395
|
{@render children?.()}
|
|
390
396
|
{/if}
|
|
391
397
|
|
|
392
|
-
{#if iconposition !== 'left'}
|
|
393
|
-
{@render Icon()}
|
|
398
|
+
{#if iconposition !== 'left' || trailingicon}
|
|
399
|
+
{@render Icon(trailingicon || icon, ui.trailingicon)}
|
|
394
400
|
{/if}
|
|
395
401
|
{/snippet}
|
|
396
402
|
|
|
397
|
-
{#snippet Icon()}
|
|
398
|
-
{
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
{
|
|
406
|
-
|
|
407
|
-
|
|
403
|
+
{#snippet Icon(IconProp?: string | Snippet | Component, classvalue?: ClassNameValue)}
|
|
404
|
+
{#if typeof IconProp === 'string'}
|
|
405
|
+
<div
|
|
406
|
+
class={variants.icon({
|
|
407
|
+
class: [is_loading && 'animate-spin', IconProp, ui.icon, classvalue],
|
|
408
|
+
})}
|
|
409
|
+
></div>
|
|
410
|
+
{:else if isSnippet(IconProp)}
|
|
411
|
+
{@render IconProp()}
|
|
412
|
+
{:else if isComponent(IconProp)}
|
|
413
|
+
<IconProp />
|
|
408
414
|
{/if}
|
|
409
415
|
{/snippet}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Component, type Snippet } from 'svelte';
|
|
2
|
-
import { type PropColor } from '../index.js';
|
|
2
|
+
import { type PropColor, type PropVariant } from '../index.js';
|
|
3
3
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
4
|
export type ButtonProps = {
|
|
5
5
|
/** The underlying DOM element being rendered. You can bind to this to get a reference to the element. */
|
|
@@ -18,6 +18,8 @@ export type ButtonProps = {
|
|
|
18
18
|
iconposition?: 'left' | 'right';
|
|
19
19
|
/** Icon when `loading` is `false` */
|
|
20
20
|
icon?: string | Snippet | Component;
|
|
21
|
+
leadingicon?: string | Snippet | Component;
|
|
22
|
+
trailingicon?: string | Snippet | Component;
|
|
21
23
|
/** Route Location the link should navigate to when clicked on. */
|
|
22
24
|
href?: string;
|
|
23
25
|
label?: string;
|
|
@@ -28,7 +30,7 @@ export type ButtonProps = {
|
|
|
28
30
|
/**
|
|
29
31
|
* @defaultValue 'solid'
|
|
30
32
|
*/
|
|
31
|
-
variant?:
|
|
33
|
+
variant?: Exclude<PropVariant, 'none'> | 'link';
|
|
32
34
|
/**
|
|
33
35
|
* @defaultValue 'md'
|
|
34
36
|
*/
|
|
@@ -41,6 +43,8 @@ export type ButtonProps = {
|
|
|
41
43
|
ui?: {
|
|
42
44
|
base?: ClassNameValue;
|
|
43
45
|
icon?: ClassNameValue;
|
|
46
|
+
leadingicon?: ClassNameValue;
|
|
47
|
+
trailingicon?: ClassNameValue;
|
|
44
48
|
};
|
|
45
49
|
children?: Snippet;
|
|
46
50
|
};
|