uisv 0.0.19 → 0.0.21
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/badge.svelte +19 -19
- package/dist/components/banner.svelte +33 -35
- package/dist/components/button.svelte +49 -68
- package/dist/components/button.svelte.d.ts +2 -2
- package/dist/components/card.svelte +4 -4
- package/dist/components/chip.svelte +15 -15
- package/dist/components/icon.svelte +0 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/mode.d.ts +1 -0
- package/dist/mode.js +1 -0
- package/dist/vite.d.ts +2 -1
- package/dist/vite.js +2 -2
- package/package.json +7 -2
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
{
|
|
72
72
|
color: 'surface',
|
|
73
73
|
variant: 'solid',
|
|
74
|
-
class: 'bg-surface-
|
|
74
|
+
class: 'bg-surface-inverted text-inverted',
|
|
75
75
|
},
|
|
76
76
|
{
|
|
77
77
|
color: 'info',
|
|
@@ -97,94 +97,94 @@
|
|
|
97
97
|
{
|
|
98
98
|
color: 'primary',
|
|
99
99
|
variant: 'outline',
|
|
100
|
-
class: 'border-primary
|
|
100
|
+
class: 'border-primary/50 text-primary',
|
|
101
101
|
},
|
|
102
102
|
{
|
|
103
103
|
color: 'surface',
|
|
104
104
|
variant: 'outline',
|
|
105
|
-
class: 'border-surface-
|
|
105
|
+
class: 'border-surface-accented text-highlighted',
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
108
|
color: 'info',
|
|
109
109
|
variant: 'outline',
|
|
110
|
-
class: 'border-info
|
|
110
|
+
class: 'border-info/50 text-info',
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
113
|
color: 'success',
|
|
114
114
|
variant: 'outline',
|
|
115
|
-
class: 'border-green
|
|
115
|
+
class: 'border-green/50 text-success',
|
|
116
116
|
},
|
|
117
117
|
{
|
|
118
118
|
color: 'error',
|
|
119
119
|
variant: 'outline',
|
|
120
|
-
class: 'border-error
|
|
120
|
+
class: 'border-error/50 text-error',
|
|
121
121
|
},
|
|
122
122
|
{
|
|
123
123
|
color: 'warning',
|
|
124
124
|
variant: 'outline',
|
|
125
|
-
class: 'border-warning
|
|
125
|
+
class: 'border-warning/50 text-warning',
|
|
126
126
|
},
|
|
127
127
|
|
|
128
128
|
{
|
|
129
129
|
color: 'primary',
|
|
130
130
|
variant: 'soft',
|
|
131
|
-
class: ' bg-primary
|
|
131
|
+
class: ' bg-primary/10 text-primary-500',
|
|
132
132
|
},
|
|
133
133
|
{
|
|
134
134
|
color: 'surface',
|
|
135
135
|
variant: 'soft',
|
|
136
|
-
class: 'bg-surface
|
|
136
|
+
class: 'bg-surface/10 text-highlighted',
|
|
137
137
|
},
|
|
138
138
|
{
|
|
139
139
|
color: 'info',
|
|
140
140
|
variant: 'soft',
|
|
141
|
-
class: 'bg-info
|
|
141
|
+
class: 'bg-info/10 text-info-500',
|
|
142
142
|
},
|
|
143
143
|
{
|
|
144
144
|
color: 'success',
|
|
145
145
|
variant: 'soft',
|
|
146
|
-
class: 'bg-success
|
|
146
|
+
class: 'bg-success/10 text-success-500',
|
|
147
147
|
},
|
|
148
148
|
{
|
|
149
149
|
color: 'error',
|
|
150
150
|
variant: 'soft',
|
|
151
|
-
class: 'bg-error
|
|
151
|
+
class: 'bg-error/10 text-error-500',
|
|
152
152
|
},
|
|
153
153
|
{
|
|
154
154
|
color: 'warning',
|
|
155
155
|
variant: 'soft',
|
|
156
|
-
class: 'bg-warning
|
|
156
|
+
class: 'bg-warning/10 text-warning-500 ',
|
|
157
157
|
},
|
|
158
158
|
|
|
159
159
|
{
|
|
160
160
|
color: 'primary',
|
|
161
161
|
variant: 'subtle',
|
|
162
|
-
class: 'bg-primary
|
|
162
|
+
class: 'bg-primary/10 text-primary-500 border-primary/20',
|
|
163
163
|
},
|
|
164
164
|
{
|
|
165
165
|
color: 'surface',
|
|
166
166
|
variant: 'subtle',
|
|
167
|
-
class: 'bg-surface
|
|
167
|
+
class: 'bg-surface/10 text-highlighted border-surface/20 ',
|
|
168
168
|
},
|
|
169
169
|
{
|
|
170
170
|
color: 'info',
|
|
171
171
|
variant: 'subtle',
|
|
172
|
-
class: 'bg-info
|
|
172
|
+
class: 'bg-info/10 text-info-600 border-info/20',
|
|
173
173
|
},
|
|
174
174
|
{
|
|
175
175
|
color: 'success',
|
|
176
176
|
variant: 'subtle',
|
|
177
|
-
class: 'bg-success
|
|
177
|
+
class: 'bg-success/10 text-success-600 border-success/20',
|
|
178
178
|
},
|
|
179
179
|
{
|
|
180
180
|
color: 'error',
|
|
181
181
|
variant: 'subtle',
|
|
182
|
-
class: 'bg-error
|
|
182
|
+
class: 'bg-error/10 text-error-600 border-error/20',
|
|
183
183
|
},
|
|
184
184
|
{
|
|
185
185
|
color: 'warning',
|
|
186
186
|
variant: 'subtle',
|
|
187
|
-
class: 'bg-warning
|
|
187
|
+
class: 'bg-warning/10 text-warning-600 border-warning/20',
|
|
188
188
|
},
|
|
189
189
|
],
|
|
190
190
|
})({ variant, size, color });
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
11
11
|
import { tv } from 'tailwind-variants';
|
|
12
12
|
import { defu } from 'defu';
|
|
13
|
-
import { useId } from 'bits-ui';
|
|
14
13
|
|
|
15
14
|
export type BannerProps = {
|
|
16
15
|
title: string | Snippet;
|
|
@@ -44,18 +43,7 @@
|
|
|
44
43
|
ui = {},
|
|
45
44
|
onclose = () => {},
|
|
46
45
|
}: BannerProps = $props();
|
|
47
|
-
const id = useId();
|
|
48
46
|
|
|
49
|
-
const close_props = $derived.by(() => {
|
|
50
|
-
return defu(typeof close === 'boolean' ? {} : close, {
|
|
51
|
-
icon: 'i-lucide-x',
|
|
52
|
-
variant: 'link',
|
|
53
|
-
color: variant === 'solid' ? 'surface' : color,
|
|
54
|
-
ui: {
|
|
55
|
-
icon: variant === 'solid' ? 'text-white' : '',
|
|
56
|
-
},
|
|
57
|
-
} as ButtonProps);
|
|
58
|
-
});
|
|
59
47
|
const classes = $derived.by(() =>
|
|
60
48
|
tv({
|
|
61
49
|
slots: {
|
|
@@ -75,8 +63,8 @@
|
|
|
75
63
|
},
|
|
76
64
|
variant: {
|
|
77
65
|
solid: {
|
|
78
|
-
base: 'text-
|
|
79
|
-
description: 'text-
|
|
66
|
+
base: 'text-inverted',
|
|
67
|
+
description: 'text-inverted/90',
|
|
80
68
|
},
|
|
81
69
|
outline: 'border',
|
|
82
70
|
soft: '',
|
|
@@ -92,7 +80,7 @@
|
|
|
92
80
|
{
|
|
93
81
|
variant: 'solid',
|
|
94
82
|
color: 'surface',
|
|
95
|
-
class: 'bg-surface-
|
|
83
|
+
class: 'bg-surface-inverted',
|
|
96
84
|
},
|
|
97
85
|
{
|
|
98
86
|
variant: 'solid',
|
|
@@ -118,94 +106,94 @@
|
|
|
118
106
|
{
|
|
119
107
|
variant: 'outline',
|
|
120
108
|
color: 'primary',
|
|
121
|
-
class: 'border-primary
|
|
109
|
+
class: 'border-primary/15 text-primary-500',
|
|
122
110
|
},
|
|
123
111
|
{
|
|
124
112
|
variant: 'outline',
|
|
125
113
|
color: 'surface',
|
|
126
|
-
class: 'border-surface
|
|
114
|
+
class: 'border-surface/15',
|
|
127
115
|
},
|
|
128
116
|
{
|
|
129
117
|
variant: 'outline',
|
|
130
118
|
color: 'info',
|
|
131
|
-
class: 'border-info
|
|
119
|
+
class: 'border-info/15 text-info-500',
|
|
132
120
|
},
|
|
133
121
|
{
|
|
134
122
|
variant: 'outline',
|
|
135
123
|
color: 'success',
|
|
136
|
-
class: 'border-success
|
|
124
|
+
class: 'border-success/15 text-success-500',
|
|
137
125
|
},
|
|
138
126
|
{
|
|
139
127
|
variant: 'outline',
|
|
140
128
|
color: 'warning',
|
|
141
|
-
class: 'border-warning
|
|
129
|
+
class: 'border-warning/15 text-warning-500',
|
|
142
130
|
},
|
|
143
131
|
{
|
|
144
132
|
variant: 'outline',
|
|
145
133
|
color: 'error',
|
|
146
|
-
class: 'border-error
|
|
134
|
+
class: 'border-error/15 text-error-500',
|
|
147
135
|
},
|
|
148
136
|
|
|
149
137
|
{
|
|
150
138
|
variant: 'soft',
|
|
151
139
|
color: 'primary',
|
|
152
|
-
class: 'bg-primary
|
|
140
|
+
class: 'bg-primary/10 text-primary-500',
|
|
153
141
|
},
|
|
154
142
|
{
|
|
155
143
|
variant: 'soft',
|
|
156
144
|
color: 'surface',
|
|
157
|
-
class: 'bg-surface
|
|
145
|
+
class: 'bg-surface/10',
|
|
158
146
|
},
|
|
159
147
|
{
|
|
160
148
|
variant: 'soft',
|
|
161
149
|
color: 'info',
|
|
162
|
-
class: 'bg-info
|
|
150
|
+
class: 'bg-info/10 text-info-500',
|
|
163
151
|
},
|
|
164
152
|
{
|
|
165
153
|
variant: 'soft',
|
|
166
154
|
color: 'success',
|
|
167
|
-
class: 'bg-success
|
|
155
|
+
class: 'bg-success/10 text-success-500',
|
|
168
156
|
},
|
|
169
157
|
{
|
|
170
158
|
variant: 'soft',
|
|
171
159
|
color: 'warning',
|
|
172
|
-
class: 'bg-warning
|
|
160
|
+
class: 'bg-warning/10 text-warning-500',
|
|
173
161
|
},
|
|
174
162
|
{
|
|
175
163
|
variant: 'soft',
|
|
176
164
|
color: 'error',
|
|
177
|
-
class: 'bg-error
|
|
165
|
+
class: 'bg-error/10 text-error-500',
|
|
178
166
|
},
|
|
179
167
|
|
|
180
168
|
{
|
|
181
169
|
variant: 'subtle',
|
|
182
170
|
color: 'primary',
|
|
183
|
-
class: 'bg-primary
|
|
171
|
+
class: 'bg-primary/10 text-primary-500 border-primary/15',
|
|
184
172
|
},
|
|
185
173
|
{
|
|
186
174
|
variant: 'subtle',
|
|
187
175
|
color: 'surface',
|
|
188
|
-
class: 'bg-surface
|
|
176
|
+
class: 'bg-surface/10 border-surface/15',
|
|
189
177
|
},
|
|
190
178
|
{
|
|
191
179
|
variant: 'subtle',
|
|
192
180
|
color: 'info',
|
|
193
|
-
class: 'bg-info
|
|
181
|
+
class: 'bg-info/10 text-info-500 border-info/15',
|
|
194
182
|
},
|
|
195
183
|
{
|
|
196
184
|
variant: 'subtle',
|
|
197
185
|
color: 'success',
|
|
198
|
-
class: 'bg-success
|
|
186
|
+
class: 'bg-success/10 text-success-500 border-success/15',
|
|
199
187
|
},
|
|
200
188
|
{
|
|
201
189
|
variant: 'subtle',
|
|
202
190
|
color: 'warning',
|
|
203
|
-
class: 'bg-warning
|
|
191
|
+
class: 'bg-warning/10 text-warning-500 border-warning/15',
|
|
204
192
|
},
|
|
205
193
|
{
|
|
206
194
|
variant: 'subtle',
|
|
207
195
|
color: 'error',
|
|
208
|
-
class: 'bg-error
|
|
196
|
+
class: 'bg-error/10 text-error-500 border-error/15',
|
|
209
197
|
},
|
|
210
198
|
],
|
|
211
199
|
})({ color, variant }),
|
|
@@ -218,7 +206,7 @@
|
|
|
218
206
|
{target}
|
|
219
207
|
class={classes.base({ class: [ui.base] })}
|
|
220
208
|
>
|
|
221
|
-
<div class="flex
|
|
209
|
+
<div class="flex grow gap-2 text-sm items-center">
|
|
222
210
|
{#if icon}
|
|
223
211
|
<div class="size-6">
|
|
224
212
|
{#if typeof icon === 'string'}
|
|
@@ -254,7 +242,17 @@
|
|
|
254
242
|
|
|
255
243
|
{#if close}
|
|
256
244
|
<div>
|
|
257
|
-
<Button
|
|
245
|
+
<Button
|
|
246
|
+
{...defu<ButtonProps, [ButtonProps]>(typeof close === 'boolean' ? {} : close, {
|
|
247
|
+
icon: 'i-lucide-x',
|
|
248
|
+
variant: 'ghost',
|
|
249
|
+
color: 'surface',
|
|
250
|
+
ui: {
|
|
251
|
+
icon: variant === 'solid' ? 'text-inverted' : '',
|
|
252
|
+
},
|
|
253
|
+
})}
|
|
254
|
+
onclick={onclose}
|
|
255
|
+
/>
|
|
258
256
|
</div>
|
|
259
257
|
{/if}
|
|
260
258
|
</svelte:element>
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
// import { FORM_LOADING_CONTEXT_KEY } from '../utils/keys.js';
|
|
6
6
|
import { isSnippet } from '../index.js';
|
|
7
7
|
import { tv } from 'tailwind-variants';
|
|
8
|
+
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
8
9
|
|
|
9
|
-
export type ButtonProps = {
|
|
10
|
+
export type ButtonProps = SvelteHTMLElements['button'] & {
|
|
10
11
|
/** The underlying DOM element being rendered. You can bind to this to get a reference to the element. */
|
|
11
12
|
ref?: HTMLButtonElement | HTMLAnchorElement;
|
|
12
13
|
/** Where to display the linked URL, as the name for a browsing context. */
|
|
@@ -47,7 +48,6 @@
|
|
|
47
48
|
block?: boolean;
|
|
48
49
|
/** Set loading state automatically based on the `@click` promise state */
|
|
49
50
|
loadingauto?: boolean;
|
|
50
|
-
onclick?: (event: MouseEvent) => void | Promise<void>;
|
|
51
51
|
ui?: {
|
|
52
52
|
base?: ClassNameValue;
|
|
53
53
|
icon?: ClassNameValue;
|
|
@@ -73,17 +73,17 @@
|
|
|
73
73
|
block,
|
|
74
74
|
label,
|
|
75
75
|
loadingauto,
|
|
76
|
-
onclick,
|
|
76
|
+
onclick = () => {},
|
|
77
77
|
ui = {},
|
|
78
78
|
disabled,
|
|
79
79
|
href,
|
|
80
80
|
icon,
|
|
81
81
|
loading,
|
|
82
82
|
loadingicon = 'i-lucide-loader-circle',
|
|
83
|
-
target,
|
|
84
83
|
type,
|
|
85
84
|
trailingicon,
|
|
86
85
|
leadingicon,
|
|
86
|
+
...rest
|
|
87
87
|
}: ButtonProps = $props();
|
|
88
88
|
|
|
89
89
|
let internal_loading = $state(false);
|
|
@@ -170,148 +170,136 @@
|
|
|
170
170
|
color: 'primary',
|
|
171
171
|
variant: 'outline',
|
|
172
172
|
class: {
|
|
173
|
-
base:
|
|
174
|
-
'border-primary/50 text-primary-500 hover:bg-primary-50',
|
|
175
|
-
'dark:hover:bg-primary-950',
|
|
176
|
-
],
|
|
173
|
+
base: 'border-primary/50 text-primary-500 hover:bg-primary/10',
|
|
177
174
|
},
|
|
178
175
|
},
|
|
179
176
|
{
|
|
180
177
|
color: 'surface',
|
|
181
178
|
variant: 'outline',
|
|
182
179
|
class: {
|
|
183
|
-
base:
|
|
184
|
-
'border-surface-accented text-surface-inverted hover:bg-surface/10',
|
|
185
|
-
'dark:hover:bg-surface-800',
|
|
186
|
-
],
|
|
180
|
+
base: 'border-surface-accented text-surface-inverted hover:bg-surface/10',
|
|
187
181
|
},
|
|
188
182
|
},
|
|
189
183
|
{
|
|
190
184
|
color: 'info',
|
|
191
185
|
variant: 'outline',
|
|
192
186
|
class: {
|
|
193
|
-
base:
|
|
187
|
+
base: 'border-info/50 text-info-500 hover:bg-info/10',
|
|
194
188
|
},
|
|
195
189
|
},
|
|
196
190
|
{
|
|
197
191
|
color: 'success',
|
|
198
192
|
variant: 'outline',
|
|
199
193
|
class: {
|
|
200
|
-
base:
|
|
201
|
-
'border-success/50 text-success-500 hover:bg-success/10',
|
|
202
|
-
'dark:hover:bg-success-950',
|
|
203
|
-
],
|
|
194
|
+
base: 'border-success/50 text-success-500 hover:bg-success/10',
|
|
204
195
|
},
|
|
205
196
|
},
|
|
206
197
|
{
|
|
207
198
|
color: 'error',
|
|
208
199
|
variant: 'outline',
|
|
209
200
|
class: {
|
|
210
|
-
base:
|
|
201
|
+
base: 'border-error/50 text-error-500 hover:bg-error/10',
|
|
211
202
|
},
|
|
212
203
|
},
|
|
213
204
|
{
|
|
214
205
|
color: 'warning',
|
|
215
206
|
variant: 'outline',
|
|
216
207
|
class: {
|
|
217
|
-
base:
|
|
218
|
-
'border-warning/50 text-warning-500 hover:bg-warning/10',
|
|
219
|
-
'dark:hover:bg-warning-950',
|
|
220
|
-
],
|
|
208
|
+
base: 'border-warning/50 text-warning-500 hover:bg-warning/10',
|
|
221
209
|
},
|
|
222
210
|
},
|
|
223
211
|
|
|
224
212
|
{
|
|
225
213
|
color: 'primary',
|
|
226
214
|
variant: 'soft',
|
|
227
|
-
class: 'bg-primary
|
|
215
|
+
class: 'bg-primary/10 text-primary-500 hover:bg-primary/15',
|
|
228
216
|
},
|
|
229
217
|
{
|
|
230
218
|
color: 'surface',
|
|
231
219
|
variant: 'soft',
|
|
232
|
-
class: 'bg-surface
|
|
220
|
+
class: 'bg-surface/10 text-hightlighted hover:bg-surface/15',
|
|
233
221
|
},
|
|
234
222
|
{
|
|
235
223
|
color: 'info',
|
|
236
224
|
variant: 'soft',
|
|
237
|
-
class: 'bg-info
|
|
225
|
+
class: 'bg-info/10 text-info-500 hover:bg-info/15',
|
|
238
226
|
},
|
|
239
227
|
{
|
|
240
228
|
color: 'success',
|
|
241
229
|
variant: 'soft',
|
|
242
|
-
class: 'bg-success
|
|
230
|
+
class: 'bg-success/10 text-success-500 hover:bg-success/15',
|
|
243
231
|
},
|
|
244
232
|
{
|
|
245
233
|
color: 'error',
|
|
246
234
|
variant: 'soft',
|
|
247
|
-
class: 'bg-error
|
|
235
|
+
class: 'bg-error/10 text-error-500 hover:bg-error/15',
|
|
248
236
|
},
|
|
249
237
|
{
|
|
250
238
|
color: 'warning',
|
|
251
239
|
variant: 'soft',
|
|
252
|
-
class: 'bg-warning
|
|
240
|
+
class: 'bg-warning/10 text-warning-500 hover:bg-warning/15',
|
|
253
241
|
},
|
|
254
242
|
|
|
255
243
|
{
|
|
256
244
|
color: 'primary',
|
|
257
245
|
variant: 'subtle',
|
|
258
|
-
class: 'bg-primary
|
|
246
|
+
class: 'bg-primary/10 text-primary-500 border-primary/25 hover:bg-primary/15',
|
|
259
247
|
},
|
|
260
248
|
{
|
|
261
249
|
color: 'surface',
|
|
262
250
|
variant: 'subtle',
|
|
263
|
-
class: 'bg-surface
|
|
251
|
+
class: 'bg-surface/10 text-hightlighted border-surface/25 hover:bg-surface/15',
|
|
264
252
|
},
|
|
265
253
|
{
|
|
266
254
|
color: 'info',
|
|
267
255
|
variant: 'subtle',
|
|
268
|
-
class: 'bg-info
|
|
256
|
+
class: 'bg-info/10 text-info-600 border-info/25 hover:bg-info/15',
|
|
269
257
|
},
|
|
270
258
|
{
|
|
271
259
|
color: 'success',
|
|
272
260
|
variant: 'subtle',
|
|
273
|
-
class: 'bg-success
|
|
261
|
+
class: 'bg-success/10 text-success-600 border-success/25 hover:bg-success/15',
|
|
274
262
|
},
|
|
275
263
|
{
|
|
276
264
|
color: 'error',
|
|
277
265
|
variant: 'subtle',
|
|
278
|
-
class: 'bg-error
|
|
266
|
+
class: 'bg-error/10 text-error-600 border-error/25 hover:bg-error/15',
|
|
279
267
|
},
|
|
280
268
|
{
|
|
281
269
|
color: 'warning',
|
|
282
270
|
variant: 'subtle',
|
|
283
|
-
class: 'bg-warning
|
|
271
|
+
class: 'bg-warning/10 text-warning-600 border-warning/25 hover:bg-warning/15',
|
|
284
272
|
},
|
|
285
273
|
|
|
286
274
|
{
|
|
287
275
|
color: 'primary',
|
|
288
276
|
variant: 'ghost',
|
|
289
|
-
class: 'text-primary-500 hover:bg-primary
|
|
277
|
+
class: 'text-primary-500 hover:bg-primary/15',
|
|
290
278
|
},
|
|
291
279
|
{
|
|
292
280
|
color: 'surface',
|
|
293
281
|
variant: 'ghost',
|
|
294
|
-
class: 'text-
|
|
282
|
+
class: 'text-highlighted hover:bg-surface/15',
|
|
295
283
|
},
|
|
296
284
|
{
|
|
297
285
|
color: 'info',
|
|
298
286
|
variant: 'ghost',
|
|
299
|
-
class: 'text-info-600 hover:bg-info
|
|
287
|
+
class: 'text-info-600 hover:bg-info/15',
|
|
300
288
|
},
|
|
301
289
|
{
|
|
302
290
|
color: 'success',
|
|
303
291
|
variant: 'ghost',
|
|
304
|
-
class: 'text-success-600 hover:bg-success
|
|
292
|
+
class: 'text-success-600 hover:bg-success/15',
|
|
305
293
|
},
|
|
306
294
|
{
|
|
307
295
|
color: 'error',
|
|
308
296
|
variant: 'ghost',
|
|
309
|
-
class: 'text-error-600 hover:bg-error
|
|
297
|
+
class: 'text-error-600 hover:bg-error/15',
|
|
310
298
|
},
|
|
311
299
|
{
|
|
312
300
|
color: 'warning',
|
|
313
301
|
variant: 'ghost',
|
|
314
|
-
class: 'text-warning-600 hover:bg-warning
|
|
302
|
+
class: 'text-warning-600 hover:bg-warning/15',
|
|
315
303
|
},
|
|
316
304
|
|
|
317
305
|
{
|
|
@@ -350,41 +338,34 @@
|
|
|
350
338
|
|
|
351
339
|
const only_icon = $derived(!(children || label) && !!icon);
|
|
352
340
|
|
|
353
|
-
async function onClickWrapper(
|
|
341
|
+
async function onClickWrapper(
|
|
342
|
+
e: MouseEvent & { currentTarget: EventTarget & HTMLButtonElement },
|
|
343
|
+
) {
|
|
354
344
|
if (!onclick) return;
|
|
355
345
|
internal_loading = true;
|
|
356
346
|
|
|
357
|
-
await onclick(
|
|
347
|
+
await onclick(e);
|
|
358
348
|
|
|
359
349
|
internal_loading = false;
|
|
360
350
|
}
|
|
361
351
|
</script>
|
|
362
352
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
class: [only_icon ? 'px-0 aspect-square justify-center' : '', ui.base],
|
|
380
|
-
})}
|
|
381
|
-
onclick={onClickWrapper}
|
|
382
|
-
>
|
|
383
|
-
{@render Content()}
|
|
384
|
-
</button>
|
|
385
|
-
{/if}
|
|
386
|
-
|
|
387
|
-
{#snippet Content()}
|
|
353
|
+
<svelte:element
|
|
354
|
+
this={href ? 'a' : 'button'}
|
|
355
|
+
data-button-root
|
|
356
|
+
type={href ? undefined : type}
|
|
357
|
+
href={href && !disabled ? href : undefined}
|
|
358
|
+
disabled={disabled || is_loading}
|
|
359
|
+
aria-disabled={href ? disabled : undefined}
|
|
360
|
+
role={href && disabled ? 'link' : undefined}
|
|
361
|
+
tabindex={href && disabled ? -1 : 0}
|
|
362
|
+
bind:this={ref}
|
|
363
|
+
class={variants.base({
|
|
364
|
+
class: [only_icon && 'px-0 aspect-square justify-center', href && 'cursor-pointer', ui.base],
|
|
365
|
+
})}
|
|
366
|
+
onclick={onClickWrapper}
|
|
367
|
+
{...rest}
|
|
368
|
+
>
|
|
388
369
|
{#if iconposition === 'left' || leadingicon}
|
|
389
370
|
{@render Icon(is_loading ? loadingicon : leadingicon || icon, ui.leadingicon)}
|
|
390
371
|
{/if}
|
|
@@ -398,7 +379,7 @@
|
|
|
398
379
|
{#if iconposition !== 'left' || trailingicon}
|
|
399
380
|
{@render Icon(trailingicon || icon, ui.trailingicon)}
|
|
400
381
|
{/if}
|
|
401
|
-
|
|
382
|
+
</svelte:element>
|
|
402
383
|
|
|
403
384
|
{#snippet Icon(IconProp?: string | Snippet | Component, classvalue?: ClassNameValue)}
|
|
404
385
|
{#if typeof IconProp === 'string'}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type Component, type Snippet } from 'svelte';
|
|
2
2
|
import { type PropColor, type PropVariant } from '../index.js';
|
|
3
3
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
-
|
|
4
|
+
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
5
|
+
export type ButtonProps = SvelteHTMLElements['button'] & {
|
|
5
6
|
/** The underlying DOM element being rendered. You can bind to this to get a reference to the element. */
|
|
6
7
|
ref?: HTMLButtonElement | HTMLAnchorElement;
|
|
7
8
|
/** Where to display the linked URL, as the name for a browsing context. */
|
|
@@ -39,7 +40,6 @@ export type ButtonProps = {
|
|
|
39
40
|
block?: boolean;
|
|
40
41
|
/** Set loading state automatically based on the `@click` promise state */
|
|
41
42
|
loadingauto?: boolean;
|
|
42
|
-
onclick?: (event: MouseEvent) => void | Promise<void>;
|
|
43
43
|
ui?: {
|
|
44
44
|
base?: ClassNameValue;
|
|
45
45
|
icon?: ClassNameValue;
|
|
@@ -32,18 +32,18 @@
|
|
|
32
32
|
variants: {
|
|
33
33
|
variant: {
|
|
34
34
|
solid: {
|
|
35
|
-
base: 'bg-surface-
|
|
35
|
+
base: 'bg-surface-inverted text-inverted',
|
|
36
36
|
header: 'border-transparent',
|
|
37
37
|
footer: 'border-transparent',
|
|
38
38
|
},
|
|
39
39
|
outline: {
|
|
40
|
-
base: 'border border-surface-
|
|
40
|
+
base: 'border border-surface-accented divide-y divide-surface-accented',
|
|
41
41
|
},
|
|
42
42
|
soft: {
|
|
43
|
-
base: 'bg-surface
|
|
43
|
+
base: 'bg-surface/10 divide-y divide-surface-accented',
|
|
44
44
|
},
|
|
45
45
|
subtle: {
|
|
46
|
-
base: 'bg-surface
|
|
46
|
+
base: 'bg-surface/10 border-surface-accented border divide-y divide-surface-accented',
|
|
47
47
|
},
|
|
48
48
|
},
|
|
49
49
|
},
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
color = 'primary',
|
|
25
25
|
position = 'top-right',
|
|
26
26
|
size = 8,
|
|
27
|
-
ui = {}
|
|
27
|
+
ui = {},
|
|
28
28
|
}: ChipProps = $props();
|
|
29
29
|
|
|
30
30
|
const classes = $derived.by(() =>
|
|
@@ -32,39 +32,39 @@
|
|
|
32
32
|
slots: {
|
|
33
33
|
base: 'relative inline-flex items-center justify-center shrink-0',
|
|
34
34
|
chip: [
|
|
35
|
-
'absolute rounded-full ring ring-
|
|
36
|
-
'-translate-y-1/2 translate-x-1/2 px-0.5'
|
|
37
|
-
]
|
|
35
|
+
'absolute rounded-full ring ring-inverted flex items-center justify-center text-inverted font-medium whitespace-nowrap',
|
|
36
|
+
'-translate-y-1/2 translate-x-1/2 px-0.5',
|
|
37
|
+
],
|
|
38
38
|
},
|
|
39
39
|
variants: {
|
|
40
40
|
color: {
|
|
41
41
|
primary: {
|
|
42
|
-
chip: 'bg-primary'
|
|
42
|
+
chip: 'bg-primary',
|
|
43
43
|
},
|
|
44
44
|
surface: {
|
|
45
|
-
chip: 'bg-surface'
|
|
45
|
+
chip: 'bg-surface',
|
|
46
46
|
},
|
|
47
47
|
success: {
|
|
48
|
-
chip: 'bg-success'
|
|
48
|
+
chip: 'bg-success',
|
|
49
49
|
},
|
|
50
50
|
info: {
|
|
51
|
-
chip: 'bg-info'
|
|
51
|
+
chip: 'bg-info',
|
|
52
52
|
},
|
|
53
53
|
warning: {
|
|
54
|
-
chip: 'bg-warning'
|
|
54
|
+
chip: 'bg-warning',
|
|
55
55
|
},
|
|
56
56
|
error: {
|
|
57
|
-
chip: 'bg-error'
|
|
58
|
-
}
|
|
57
|
+
chip: 'bg-error',
|
|
58
|
+
},
|
|
59
59
|
},
|
|
60
60
|
position: {
|
|
61
61
|
'top-right': { chip: 'top-0 right-0' },
|
|
62
62
|
'bottom-right': { chip: 'bottom-0 right-0' },
|
|
63
63
|
'top-left': { chip: 'top-0 left-0' },
|
|
64
|
-
'bottom-left': { chip: 'bottom-0 left-0' }
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
})({ color, position })
|
|
64
|
+
'bottom-left': { chip: 'bottom-0 left-0' },
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
})({ color, position }),
|
|
68
68
|
);
|
|
69
69
|
</script>
|
|
70
70
|
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/mode.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from 'mode-watcher';
|
package/dist/mode.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from 'mode-watcher';
|
package/dist/vite.d.ts
CHANGED
|
@@ -48,4 +48,5 @@ export type PluginOptions = {
|
|
|
48
48
|
*/
|
|
49
49
|
icons?: Parameters<typeof presetIcons>[0];
|
|
50
50
|
};
|
|
51
|
-
|
|
51
|
+
declare const _default: (options?: PluginOptions) => import("vite").Plugin<any>[][];
|
|
52
|
+
export default _default;
|
package/dist/vite.js
CHANGED
|
@@ -3,7 +3,7 @@ import { transformerVariantGroup, transformerCompileClass, transformerDirectives
|
|
|
3
3
|
import {} from '@unocss/preset-web-fonts';
|
|
4
4
|
import { defu } from 'defu';
|
|
5
5
|
import { getColors } from 'theme-colors';
|
|
6
|
-
export
|
|
6
|
+
export default (options = {}) => {
|
|
7
7
|
const _opts = defu(options, {
|
|
8
8
|
colors: {
|
|
9
9
|
primary: {
|
|
@@ -139,4 +139,4 @@ export function uisv(options) {
|
|
|
139
139
|
},
|
|
140
140
|
}),
|
|
141
141
|
];
|
|
142
|
-
}
|
|
142
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uisv",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.21",
|
|
4
4
|
"description": "ui library for the rest of us",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "ui-sv/uisv",
|
|
@@ -44,6 +44,11 @@
|
|
|
44
44
|
"types": "./dist/date.d.ts",
|
|
45
45
|
"svelte": "./dist/date.js",
|
|
46
46
|
"default": "./dist/date.js"
|
|
47
|
+
},
|
|
48
|
+
"./mode": {
|
|
49
|
+
"types": "./dist/mode.d.ts",
|
|
50
|
+
"svelte": "./dist/mode.js",
|
|
51
|
+
"default": "./dist/mode.js"
|
|
47
52
|
}
|
|
48
53
|
},
|
|
49
54
|
"peerDependencies": {
|
|
@@ -78,7 +83,7 @@
|
|
|
78
83
|
"dependencies": {
|
|
79
84
|
"@internationalized/date": "^3.11.0",
|
|
80
85
|
"@unocss/preset-web-fonts": "^66.6.0",
|
|
81
|
-
"bits-ui": "^2.16.
|
|
86
|
+
"bits-ui": "^2.16.5",
|
|
82
87
|
"colortranslator": "^5.0.0",
|
|
83
88
|
"defu": "^6.1.4",
|
|
84
89
|
"maska": "^3.2.0",
|