uisv 0.0.14 → 0.0.16
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/checkbox-group.svelte +1 -1
- package/dist/components/collapsible.svelte +76 -0
- package/dist/components/collapsible.svelte.d.ts +15 -0
- package/dist/components/h2.svelte +3 -3
- package/dist/components/h4.svelte +2 -2
- package/dist/components/h5.svelte +2 -2
- package/dist/components/h6.svelte +2 -2
- package/dist/components/icon.svelte +58 -0
- package/dist/components/icon.svelte.d.ts +8 -0
- package/dist/components/index.d.ts +14 -2
- package/dist/components/index.js +14 -2
- package/dist/components/input-number.svelte +175 -0
- package/dist/components/input-number.svelte.d.ts +38 -0
- package/dist/components/input-time.svelte +4 -5
- package/dist/components/input-time.svelte.d.ts +3 -4
- package/dist/components/input.svelte +22 -25
- package/dist/components/input.svelte.d.ts +7 -7
- package/dist/components/kbd.svelte +35 -35
- package/dist/components/kbd.svelte.d.ts +2 -2
- package/dist/components/pin-input.svelte +21 -21
- package/dist/components/pin-input.svelte.d.ts +2 -2
- package/dist/components/placeholder.svelte +1 -1
- package/dist/components/progress.svelte +17 -17
- package/dist/components/select.svelte +333 -58
- package/dist/components/select.svelte.d.ts +32 -2
- package/dist/components/seperator.svelte +212 -0
- package/dist/components/seperator.svelte.d.ts +22 -0
- package/dist/components/slider.svelte +25 -25
- package/dist/components/switch.svelte +12 -28
- package/dist/components/switch.svelte.d.ts +5 -6
- package/dist/components/tabs.svelte +2 -2
- package/dist/date.d.ts +1 -0
- package/dist/date.js +1 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -1
- package/dist/types.d.ts +3 -0
- package/dist/types.js +1 -0
- package/dist/utilities.svelte.d.ts +9 -2
- package/dist/utilities.svelte.js +24 -4
- package/dist/vite.d.ts +2 -3
- package/dist/vite.js +41 -21
- package/package.json +18 -23
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { Icon, type PropColor, isComponent, isSnippet } from '../index.js';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
5
|
+
import { tv } from 'tailwind-variants';
|
|
6
|
+
import type { Component } from 'svelte';
|
|
7
|
+
|
|
8
|
+
export type SeperatorProps = {
|
|
9
|
+
label?: string | Snippet<[ClassNameValue]> | Component;
|
|
10
|
+
icon?: string | Component;
|
|
11
|
+
color?: PropColor;
|
|
12
|
+
type?: 'dashed' | 'solid' | 'dotted';
|
|
13
|
+
children?: Snippet;
|
|
14
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
15
|
+
orientation?: 'horizontal' | 'vertical';
|
|
16
|
+
ui?: {
|
|
17
|
+
root?: ClassNameValue;
|
|
18
|
+
border?: ClassNameValue;
|
|
19
|
+
icon?: ClassNameValue;
|
|
20
|
+
label?: ClassNameValue;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<script lang="ts">
|
|
26
|
+
let {
|
|
27
|
+
label,
|
|
28
|
+
icon,
|
|
29
|
+
children,
|
|
30
|
+
color = 'primary',
|
|
31
|
+
type = 'solid',
|
|
32
|
+
size = 'xs',
|
|
33
|
+
orientation = 'horizontal',
|
|
34
|
+
ui = {},
|
|
35
|
+
}: SeperatorProps = $props();
|
|
36
|
+
|
|
37
|
+
const variants = $derived(
|
|
38
|
+
tv({
|
|
39
|
+
slots: {
|
|
40
|
+
root: 'flex items-center justify-center text-center',
|
|
41
|
+
border: '',
|
|
42
|
+
icon: 'shrink-0 size-5',
|
|
43
|
+
label: 'text-sm',
|
|
44
|
+
},
|
|
45
|
+
variants: {
|
|
46
|
+
type: {
|
|
47
|
+
solid: {
|
|
48
|
+
border: 'border-solid',
|
|
49
|
+
},
|
|
50
|
+
dashed: {
|
|
51
|
+
border: 'border-dashed',
|
|
52
|
+
},
|
|
53
|
+
dotted: {
|
|
54
|
+
border: 'border-dotted',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
size: {
|
|
58
|
+
xs: {
|
|
59
|
+
root: 'gap-3',
|
|
60
|
+
},
|
|
61
|
+
sm: {
|
|
62
|
+
root: 'gap-3',
|
|
63
|
+
},
|
|
64
|
+
md: {
|
|
65
|
+
root: 'gap-4',
|
|
66
|
+
},
|
|
67
|
+
lg: {
|
|
68
|
+
root: 'gap-5',
|
|
69
|
+
},
|
|
70
|
+
xl: {
|
|
71
|
+
root: 'gap-5',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
color: {
|
|
75
|
+
primary: {
|
|
76
|
+
border: 'border-primary',
|
|
77
|
+
label: 'text-primary',
|
|
78
|
+
icon: 'text-primary',
|
|
79
|
+
},
|
|
80
|
+
surface: {
|
|
81
|
+
border: 'border-surface',
|
|
82
|
+
label: 'text-surface',
|
|
83
|
+
icon: 'text-surface',
|
|
84
|
+
},
|
|
85
|
+
info: {
|
|
86
|
+
border: 'border-info',
|
|
87
|
+
label: 'text-info',
|
|
88
|
+
icon: 'text-info',
|
|
89
|
+
},
|
|
90
|
+
success: {
|
|
91
|
+
border: 'border-success',
|
|
92
|
+
label: 'text-success',
|
|
93
|
+
icon: 'text-success',
|
|
94
|
+
},
|
|
95
|
+
warning: {
|
|
96
|
+
border: 'border-warning',
|
|
97
|
+
label: 'text-warning',
|
|
98
|
+
icon: 'text-warning',
|
|
99
|
+
},
|
|
100
|
+
error: {
|
|
101
|
+
border: 'border-error',
|
|
102
|
+
label: 'text-error',
|
|
103
|
+
icon: 'text-error',
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
orientation: {
|
|
107
|
+
horizontal: {
|
|
108
|
+
root: 'w-full flex-row',
|
|
109
|
+
border: 'w-full',
|
|
110
|
+
},
|
|
111
|
+
vertical: {
|
|
112
|
+
root: 'h-full flex-col',
|
|
113
|
+
border: 'h-full',
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
compoundVariants: [
|
|
118
|
+
{
|
|
119
|
+
orientation: 'horizontal',
|
|
120
|
+
size: 'xs',
|
|
121
|
+
class: {
|
|
122
|
+
border: 'border-t',
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
orientation: 'horizontal',
|
|
127
|
+
size: 'sm',
|
|
128
|
+
class: {
|
|
129
|
+
border: 'border-t-2',
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
orientation: 'horizontal',
|
|
134
|
+
size: 'md',
|
|
135
|
+
class: {
|
|
136
|
+
border: 'border-t-3',
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
orientation: 'horizontal',
|
|
141
|
+
size: 'lg',
|
|
142
|
+
class: {
|
|
143
|
+
border: 'border-t-4',
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
orientation: 'horizontal',
|
|
148
|
+
size: 'xl',
|
|
149
|
+
class: {
|
|
150
|
+
border: 'border-t-5',
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
orientation: 'vertical',
|
|
155
|
+
size: 'xs',
|
|
156
|
+
class: {
|
|
157
|
+
border: 'border-s',
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
orientation: 'vertical',
|
|
162
|
+
size: 'sm',
|
|
163
|
+
class: {
|
|
164
|
+
border: 'border-s-2',
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
orientation: 'vertical',
|
|
169
|
+
size: 'md',
|
|
170
|
+
class: {
|
|
171
|
+
border: 'border-s-3',
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
orientation: 'vertical',
|
|
176
|
+
size: 'lg',
|
|
177
|
+
class: {
|
|
178
|
+
border: 'border-s-4',
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
orientation: 'vertical',
|
|
183
|
+
size: 'xl',
|
|
184
|
+
class: {
|
|
185
|
+
border: 'border-s-5',
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
})({ size, type, color, orientation }),
|
|
190
|
+
);
|
|
191
|
+
</script>
|
|
192
|
+
|
|
193
|
+
<div class={variants.root({ class: ui.root })}>
|
|
194
|
+
<span class={variants.border({ class: ui.border })}></span>
|
|
195
|
+
|
|
196
|
+
{#if icon || label || children}
|
|
197
|
+
{#if icon}
|
|
198
|
+
<Icon name={icon} class={variants.icon({})} />
|
|
199
|
+
{:else if typeof label === 'string' && label.length > 0}
|
|
200
|
+
<span class={variants.label({ class: ui.label })}>{label}</span>
|
|
201
|
+
{:else if isSnippet(label)}
|
|
202
|
+
{@render label()}
|
|
203
|
+
{:else if isComponent(label)}
|
|
204
|
+
{@const Label = label}
|
|
205
|
+
<Label class={variants.label({ class: ui.label })} />
|
|
206
|
+
{:else}
|
|
207
|
+
{@render children?.()}
|
|
208
|
+
{/if}
|
|
209
|
+
|
|
210
|
+
<span class={variants.border({ class: ui.border })}></span>
|
|
211
|
+
{/if}
|
|
212
|
+
</div>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type PropColor } from '../index.js';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
+
import type { Component } from 'svelte';
|
|
5
|
+
export type SeperatorProps = {
|
|
6
|
+
label?: string | Snippet<[ClassNameValue]> | Component;
|
|
7
|
+
icon?: string | Component;
|
|
8
|
+
color?: PropColor;
|
|
9
|
+
type?: 'dashed' | 'solid' | 'dotted';
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
12
|
+
orientation?: 'horizontal' | 'vertical';
|
|
13
|
+
ui?: {
|
|
14
|
+
root?: ClassNameValue;
|
|
15
|
+
border?: ClassNameValue;
|
|
16
|
+
icon?: ClassNameValue;
|
|
17
|
+
label?: ClassNameValue;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
declare const Seperator: Component<SeperatorProps, {}, "">;
|
|
21
|
+
type Seperator = ReturnType<typeof Seperator>;
|
|
22
|
+
export default Seperator;
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
step,
|
|
36
36
|
min,
|
|
37
37
|
max,
|
|
38
|
-
ui = {}
|
|
38
|
+
ui = {},
|
|
39
39
|
}: SliderProps<T> = $props();
|
|
40
40
|
|
|
41
41
|
const default_value = $derived.by(() => {
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
},
|
|
52
52
|
set(v: number[]) {
|
|
53
53
|
value = (v?.length !== 1 ? v : v[0]) as T;
|
|
54
|
-
}
|
|
54
|
+
},
|
|
55
55
|
});
|
|
56
56
|
const thumbs = $derived(slider_value.get()?.length ?? 1);
|
|
57
57
|
const classes = $derived.by(() =>
|
|
@@ -59,85 +59,85 @@
|
|
|
59
59
|
slots: {
|
|
60
60
|
root: [
|
|
61
61
|
'relative w-full flex rounded-full bg-neutral-300',
|
|
62
|
-
orientation === 'horizontal' ? 'items-center' : 'justify-center mx-1'
|
|
62
|
+
orientation === 'horizontal' ? 'items-center' : 'justify-center mx-1',
|
|
63
63
|
],
|
|
64
64
|
range: [
|
|
65
65
|
'rounded-full bg-neutral-200 p-0.5 relative transition',
|
|
66
|
-
orientation === 'horizontal' ? 'h-full' : 'w-full'
|
|
66
|
+
orientation === 'horizontal' ? 'h-full' : 'w-full',
|
|
67
67
|
],
|
|
68
68
|
thumb: 'bg-white rounded-full border-2 outline-none transition',
|
|
69
|
-
tick: ''
|
|
69
|
+
tick: '',
|
|
70
70
|
},
|
|
71
71
|
variants: {
|
|
72
72
|
color: {
|
|
73
73
|
primary: {
|
|
74
74
|
root: '',
|
|
75
75
|
range: 'bg-primary-500',
|
|
76
|
-
thumb: 'border-primary-500'
|
|
76
|
+
thumb: 'border-primary-500',
|
|
77
77
|
},
|
|
78
78
|
surface: {
|
|
79
79
|
range: ['bg-neutral-900'],
|
|
80
|
-
thumb: 'border-neutral-900'
|
|
80
|
+
thumb: 'border-neutral-900',
|
|
81
81
|
},
|
|
82
82
|
info: {
|
|
83
83
|
range: ['bg-info-500'],
|
|
84
|
-
thumb: 'border-info-500'
|
|
84
|
+
thumb: 'border-info-500',
|
|
85
85
|
},
|
|
86
86
|
success: {
|
|
87
87
|
range: ['bg-success-500'],
|
|
88
|
-
thumb: 'border-success-500'
|
|
88
|
+
thumb: 'border-success-500',
|
|
89
89
|
},
|
|
90
90
|
warning: {
|
|
91
91
|
range: ['bg-warning-500'],
|
|
92
|
-
thumb: 'border-warning-500'
|
|
92
|
+
thumb: 'border-warning-500',
|
|
93
93
|
},
|
|
94
94
|
error: {
|
|
95
95
|
range: ['bg-error-500'],
|
|
96
|
-
thumb: 'border-error-500'
|
|
97
|
-
}
|
|
96
|
+
thumb: 'border-error-500',
|
|
97
|
+
},
|
|
98
98
|
},
|
|
99
99
|
size: {
|
|
100
100
|
xs: {
|
|
101
101
|
root: [orientation === 'horizontal' ? 'h-1.5' : ''],
|
|
102
102
|
thumb: 'size-4',
|
|
103
|
-
tick: 'size-2.5'
|
|
103
|
+
tick: 'size-2.5',
|
|
104
104
|
},
|
|
105
105
|
sm: {
|
|
106
106
|
root: [orientation === 'horizontal' ? 'h-1.75' : ''],
|
|
107
107
|
thumb: 'size-4.5',
|
|
108
|
-
tick: 'size-3'
|
|
108
|
+
tick: 'size-3',
|
|
109
109
|
},
|
|
110
110
|
md: {
|
|
111
111
|
root: [orientation === 'horizontal' ? 'h-2' : 'w-2 h-48'],
|
|
112
112
|
thumb: 'size-5',
|
|
113
|
-
tick: 'size-3.5'
|
|
113
|
+
tick: 'size-3.5',
|
|
114
114
|
},
|
|
115
115
|
lg: {
|
|
116
116
|
root: [orientation === 'horizontal' ? 'h-2.5' : ''],
|
|
117
117
|
thumb: 'size-5.5',
|
|
118
|
-
tick: 'size-4'
|
|
118
|
+
tick: 'size-4',
|
|
119
119
|
},
|
|
120
120
|
xl: {
|
|
121
121
|
root: [orientation === 'horizontal' ? 'h-3' : 'w-3'],
|
|
122
122
|
thumb: 'size-6',
|
|
123
|
-
tick: 'size-4.5'
|
|
124
|
-
}
|
|
123
|
+
tick: 'size-4.5',
|
|
124
|
+
},
|
|
125
125
|
},
|
|
126
126
|
orientation: {
|
|
127
127
|
horizontal: {
|
|
128
128
|
root: '',
|
|
129
129
|
thumb: '',
|
|
130
|
-
tick: ''
|
|
130
|
+
tick: '',
|
|
131
131
|
},
|
|
132
132
|
vertical: {
|
|
133
133
|
root: '',
|
|
134
134
|
thumb: '',
|
|
135
|
-
tick: ''
|
|
136
|
-
}
|
|
137
|
-
}
|
|
135
|
+
tick: '',
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
138
|
},
|
|
139
|
-
compoundVariants: []
|
|
140
|
-
})({ color, size, orientation })
|
|
139
|
+
compoundVariants: [],
|
|
140
|
+
})({ color, size, orientation }),
|
|
141
141
|
);
|
|
142
142
|
</script>
|
|
143
143
|
|
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
position="bottom"
|
|
162
162
|
class={[
|
|
163
163
|
'opacity-0 transition pointer-events-none text-sm shadow-md px-2 h-6 flex items-center rounded-md mt-1 border border-surface-200',
|
|
164
|
-
'data-[active=""]:
|
|
164
|
+
'data-[active=""]:opacity-100 group-hover:opacity-100',
|
|
165
165
|
]}
|
|
166
166
|
>
|
|
167
167
|
{slider_value.get()[index]}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
-
import { type PropColor,
|
|
3
|
-
import type { Snippet } from 'svelte';
|
|
2
|
+
import { type PropColor, Icon } from '../index.js';
|
|
3
|
+
import type { Snippet, Component } from 'svelte';
|
|
4
4
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
5
5
|
import { tv } from 'tailwind-variants';
|
|
6
|
-
import type { Component } from 'vitest-browser-svelte';
|
|
7
6
|
|
|
8
7
|
export type SwitchProps = {
|
|
9
8
|
value?: boolean;
|
|
@@ -11,9 +10,9 @@
|
|
|
11
10
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
12
11
|
disabled?: boolean;
|
|
13
12
|
loading?: boolean;
|
|
14
|
-
loadingicon?: string |
|
|
15
|
-
uncheckedicon?: string |
|
|
16
|
-
checkedicon?: string |
|
|
13
|
+
loadingicon?: string | Component;
|
|
14
|
+
uncheckedicon?: string | Component;
|
|
15
|
+
checkedicon?: string | Component;
|
|
17
16
|
label?: string | Snippet;
|
|
18
17
|
description?: string | Snippet;
|
|
19
18
|
required?: boolean;
|
|
@@ -121,18 +120,15 @@
|
|
|
121
120
|
data-state={value ? 'checked' : 'unchecked'}
|
|
122
121
|
class={classes.container({ class: [loading && 'cursor-not-allowed', ui.thumb] })}
|
|
123
122
|
onclick={() => {
|
|
124
|
-
|
|
125
|
-
if (loading) return;
|
|
123
|
+
if (loading || disabled) return;
|
|
126
124
|
value = !value;
|
|
127
125
|
}}
|
|
128
126
|
>
|
|
129
127
|
<span data-state={value ? 'checked' : 'unchecked'} class={classes.thumb({ class: ui.thumb })}>
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
!loading && 'opacity-0',
|
|
135
|
-
])}
|
|
128
|
+
<Icon
|
|
129
|
+
name={loading ? loadingicon : value ? checkedicon : uncheckedicon}
|
|
130
|
+
class={classes.icon({ class: [loading && 'animate-spin'] })}
|
|
131
|
+
/>
|
|
136
132
|
</span>
|
|
137
133
|
</button>
|
|
138
134
|
|
|
@@ -163,18 +159,6 @@
|
|
|
163
159
|
{/if}
|
|
164
160
|
</div>
|
|
165
161
|
|
|
166
|
-
{#snippet
|
|
167
|
-
<div class={['absolute', icon_class]}>
|
|
168
|
-
{#if typeof ico === 'string'}
|
|
169
|
-
<div
|
|
170
|
-
data-state={value ? 'checked' : 'unchecked'}
|
|
171
|
-
class={classes.icon({ class: [ico] })}
|
|
172
|
-
></div>
|
|
173
|
-
{:else if isSnippet(ico)}
|
|
174
|
-
{@render ico()}
|
|
175
|
-
{:else if isComponent(ico)}
|
|
176
|
-
{@const Iconn = ico}
|
|
177
|
-
<Iconn />
|
|
178
|
-
{/if}
|
|
179
|
-
</div>
|
|
162
|
+
{#snippet icon(ico?: SwitchProps['checkedicon'], icon_class?: ClassNameValue)}
|
|
163
|
+
<div class={['absolute', icon_class]}></div>
|
|
180
164
|
{/snippet}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { type PropColor } from '../index.js';
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { Snippet, Component } from 'svelte';
|
|
3
3
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
-
import type { Component } from 'vitest-browser-svelte';
|
|
5
4
|
export type SwitchProps = {
|
|
6
5
|
value?: boolean;
|
|
7
6
|
color?: PropColor;
|
|
8
7
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
8
|
disabled?: boolean;
|
|
10
9
|
loading?: boolean;
|
|
11
|
-
loadingicon?: string |
|
|
12
|
-
uncheckedicon?: string |
|
|
13
|
-
checkedicon?: string |
|
|
10
|
+
loadingicon?: string | Component;
|
|
11
|
+
uncheckedicon?: string | Component;
|
|
12
|
+
checkedicon?: string | Component;
|
|
14
13
|
label?: string | Snippet;
|
|
15
14
|
description?: string | Snippet;
|
|
16
15
|
required?: boolean;
|
|
@@ -22,6 +21,6 @@ export type SwitchProps = {
|
|
|
22
21
|
description?: ClassNameValue;
|
|
23
22
|
};
|
|
24
23
|
};
|
|
25
|
-
declare const Switch:
|
|
24
|
+
declare const Switch: Component<SwitchProps, {}, "value">;
|
|
26
25
|
type Switch = ReturnType<typeof Switch>;
|
|
27
26
|
export default Switch;
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
slots: {
|
|
71
71
|
root: '',
|
|
72
72
|
list: 'flex relative p-1',
|
|
73
|
-
item: 'flex items-center justify-center text-muted data-[state="inactive"]:hover:
|
|
73
|
+
item: 'flex items-center justify-center text-muted data-[state="inactive"]:hover:text-highlighted font-medium z-1 transition-all',
|
|
74
74
|
icon: '',
|
|
75
75
|
content: 'mt-2',
|
|
76
76
|
indicator: 'absolute z-0 transition-all duration-200 rounded-md w---width',
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
variant: {
|
|
80
80
|
pill: {
|
|
81
81
|
list: 'bg-surface-elevated rounded-lg',
|
|
82
|
-
item: 'flex-1 data-[state="active"]:
|
|
82
|
+
item: 'flex-1 data-[state="active"]:text-inverted',
|
|
83
83
|
trigger: 'flex-1',
|
|
84
84
|
indicator: 'rounded-md shadow-xs',
|
|
85
85
|
},
|
package/dist/date.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@internationalized/date';
|
package/dist/date.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@internationalized/date';
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/types.d.ts
ADDED
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,13 +5,13 @@ import { type MaybeGetter, type ElementSizeOptions } from 'runed';
|
|
|
5
5
|
* @param v - The value to check
|
|
6
6
|
* @returns true if the value is a component, false otherwise
|
|
7
7
|
*/
|
|
8
|
-
export declare
|
|
8
|
+
export declare function isComponent(v: unknown): v is Component;
|
|
9
9
|
/**
|
|
10
10
|
* Checks if a value is a Svelte snippet
|
|
11
11
|
* @param v - The value to check
|
|
12
12
|
* @returns true if the value is a snippet, false otherwise
|
|
13
13
|
*/
|
|
14
|
-
export declare
|
|
14
|
+
export declare function isSnippet(v: unknown): v is Snippet;
|
|
15
15
|
/**
|
|
16
16
|
* Returns a reactive value holding the dom rect of `node`s.
|
|
17
17
|
*
|
|
@@ -22,3 +22,10 @@ export declare const isSnippet: (v: unknown) => v is Snippet;
|
|
|
22
22
|
* @returns an array of dom rects.
|
|
23
23
|
*/
|
|
24
24
|
export declare function useElementRects(nodes: MaybeGetter<HTMLElement[]>, options?: ElementSizeOptions): DOMRect[];
|
|
25
|
+
/**
|
|
26
|
+
* Inject reactive style element in head.
|
|
27
|
+
* @param css string
|
|
28
|
+
*/
|
|
29
|
+
export declare function useStyle(css: MaybeGetter<string>): {
|
|
30
|
+
id: string;
|
|
31
|
+
};
|
package/dist/utilities.svelte.js
CHANGED
|
@@ -4,17 +4,17 @@ import { extract, useMutationObserver, useResizeObserver, } from 'runed';
|
|
|
4
4
|
* @param v - The value to check
|
|
5
5
|
* @returns true if the value is a component, false otherwise
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export function isComponent(v) {
|
|
8
8
|
return typeof v === 'function' || (typeof v === 'object' && v !== null && !('$$render' in v));
|
|
9
|
-
}
|
|
9
|
+
}
|
|
10
10
|
/**
|
|
11
11
|
* Checks if a value is a Svelte snippet
|
|
12
12
|
* @param v - The value to check
|
|
13
13
|
* @returns true if the value is a snippet, false otherwise
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export function isSnippet(v) {
|
|
16
16
|
return typeof v === 'object' && v !== null && '$$render' in v;
|
|
17
|
-
}
|
|
17
|
+
}
|
|
18
18
|
/**
|
|
19
19
|
* Returns a reactive value holding the dom rect of `node`s.
|
|
20
20
|
*
|
|
@@ -45,3 +45,23 @@ export function useElementRects(nodes, options = {}) {
|
|
|
45
45
|
});
|
|
46
46
|
return rects;
|
|
47
47
|
}
|
|
48
|
+
let uisv_usestyle_id = 0;
|
|
49
|
+
/**
|
|
50
|
+
* Inject reactive style element in head.
|
|
51
|
+
* @param css string
|
|
52
|
+
*/
|
|
53
|
+
export function useStyle(css) {
|
|
54
|
+
const id = `uisv_styletag_${++uisv_usestyle_id}`;
|
|
55
|
+
let el = $state();
|
|
56
|
+
$effect(() => {
|
|
57
|
+
if (!el) {
|
|
58
|
+
el = (document.getElementById(id) || document.createElement('style'));
|
|
59
|
+
if (!el.isConnected) {
|
|
60
|
+
el.id = id;
|
|
61
|
+
document.head.appendChild(el);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
el.textContent = extract(css);
|
|
65
|
+
});
|
|
66
|
+
return { id };
|
|
67
|
+
}
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { presetIcons } from 'unocss';
|
|
2
2
|
import { type WebFontsOptions } from '@unocss/preset-web-fonts';
|
|
3
3
|
import type { PropColor } from './index.js';
|
|
4
|
-
import type { Plugin } from 'vite';
|
|
5
4
|
export type Colors = Record<string, string | Record<string, string>>;
|
|
6
5
|
export type NestedObject<K extends string, V> = {
|
|
7
6
|
[key in K]: NestedObject<K, V> | V;
|
|
@@ -11,7 +10,7 @@ export type PluginOptions = {
|
|
|
11
10
|
* Colors as UnoCSS color name, hex color, or UnoCSS theme color object
|
|
12
11
|
* @example
|
|
13
12
|
* {
|
|
14
|
-
* primary: '
|
|
13
|
+
* primary: '#FF3E00',
|
|
15
14
|
* surface: 'neutral',
|
|
16
15
|
* info: '#00F',
|
|
17
16
|
* success: '#0F0',
|
|
@@ -49,4 +48,4 @@ export type PluginOptions = {
|
|
|
49
48
|
*/
|
|
50
49
|
icons?: Parameters<typeof presetIcons>[0];
|
|
51
50
|
};
|
|
52
|
-
export declare function uisv(options: PluginOptions): Plugin<any>[][];
|
|
51
|
+
export declare function uisv(options: PluginOptions): import("vite").Plugin<any>[][];
|