uisv 0.0.21 → 0.0.22
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/accordion.svelte +20 -21
- package/dist/components/accordion.svelte.d.ts +10 -10
- package/dist/components/alert.svelte +22 -28
- package/dist/components/alert.svelte.d.ts +5 -5
- package/dist/components/app.svelte +57 -0
- package/dist/components/app.svelte.d.ts +15 -0
- package/dist/components/badge.svelte +18 -23
- package/dist/components/badge.svelte.d.ts +3 -3
- package/dist/components/banner.svelte +18 -24
- package/dist/components/banner.svelte.d.ts +5 -5
- package/dist/components/breadcrumb.svelte +6 -6
- package/dist/components/breadcrumb.svelte.d.ts +4 -25
- package/dist/components/button.svelte +36 -44
- package/dist/components/button.svelte.d.ts +12 -11
- package/dist/components/calendar.svelte +6 -7
- package/dist/components/calendar.svelte.d.ts +3 -3
- package/dist/components/card.svelte +11 -12
- package/dist/components/card.svelte.d.ts +5 -5
- package/dist/components/checkbox-group.svelte +12 -13
- package/dist/components/checkbox-group.svelte.d.ts +4 -4
- package/dist/components/checkbox.svelte +39 -38
- package/dist/components/checkbox.svelte.d.ts +6 -6
- package/dist/components/chip.svelte +7 -8
- package/dist/components/chip.svelte.d.ts +3 -3
- package/dist/components/collapsible.svelte +4 -5
- package/dist/components/collapsible.svelte.d.ts +4 -4
- package/dist/components/color-picker.svelte +1 -1
- package/dist/components/h1.svelte +8 -7
- package/dist/components/h2.svelte +12 -11
- package/dist/components/h3.svelte +9 -8
- package/dist/components/h4.svelte +12 -11
- package/dist/components/h5.svelte +12 -11
- package/dist/components/h6.svelte +12 -11
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.js +6 -0
- package/dist/components/input-number.svelte +5 -7
- package/dist/components/input-number.svelte.d.ts +5 -5
- package/dist/components/input-time.svelte +11 -12
- package/dist/components/input-time.svelte.d.ts +6 -6
- package/dist/components/input.svelte +11 -12
- package/dist/components/input.svelte.d.ts +6 -6
- package/dist/components/kbd.svelte +6 -7
- package/dist/components/kbd.svelte.d.ts +2 -2
- package/dist/components/modal.svelte +189 -0
- package/dist/components/modal.svelte.d.ts +33 -0
- package/dist/components/p.svelte +3 -1
- package/dist/components/pin-input.svelte +10 -11
- package/dist/components/pin-input.svelte.d.ts +3 -3
- package/dist/components/placeholder.svelte +4 -4
- package/dist/components/popover.svelte +33 -61
- package/dist/components/popover.svelte.d.ts +8 -30
- package/dist/components/progress.svelte +22 -21
- package/dist/components/progress.svelte.d.ts +5 -5
- package/dist/components/select.svelte +48 -53
- package/dist/components/select.svelte.d.ts +22 -29
- package/dist/components/seperator.svelte +6 -7
- package/dist/components/seperator.svelte.d.ts +6 -6
- package/dist/components/slider.svelte +13 -14
- package/dist/components/slider.svelte.d.ts +4 -4
- package/dist/components/switch.svelte +17 -22
- package/dist/components/switch.svelte.d.ts +6 -6
- package/dist/components/tabs.svelte +19 -20
- package/dist/components/tabs.svelte.d.ts +7 -7
- package/dist/components/tooltip.svelte +94 -0
- package/dist/components/tooltip.svelte.d.ts +24 -0
- package/dist/contexts.d.ts +47 -0
- package/dist/contexts.js +46 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/mode.d.ts +89 -0
- package/dist/mode.js +1 -0
- package/dist/utilities.svelte.d.ts +1 -1
- package/dist/vite.js +30 -35
- package/package.json +31 -26
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
import type
|
|
3
|
-
import {
|
|
4
|
-
import { type
|
|
5
|
-
import type { PropColor } from '../index.js';
|
|
2
|
+
import { Popover, type PopoverArrowProps, type PopoverContentProps } from 'bits-ui';
|
|
3
|
+
import { type ClassValue } from 'tailwind-variants';
|
|
4
|
+
import { type ButtonBaseProps } from '../index.js';
|
|
6
5
|
export type PopoverContentSnippet = {
|
|
7
6
|
props: Record<string, unknown>;
|
|
8
7
|
open: boolean;
|
|
9
8
|
wrapperProps: Record<string, unknown>;
|
|
10
9
|
};
|
|
11
|
-
export type PopoverProps = {
|
|
10
|
+
export type PopoverProps = ButtonBaseProps & {
|
|
12
11
|
/**
|
|
13
12
|
* The display mode of the popover.
|
|
14
13
|
*/
|
|
@@ -17,20 +16,14 @@ export type PopoverProps = {
|
|
|
17
16
|
* The props for the content of popover.
|
|
18
17
|
*/
|
|
19
18
|
contentprops?: PopoverContentProps;
|
|
20
|
-
content?: Snippet<[PopoverContentSnippet]>;
|
|
21
19
|
children?: Snippet<[]>;
|
|
22
|
-
/**
|
|
23
|
-
* Snippet if you want to implement your own trigger button
|
|
24
|
-
*/
|
|
25
|
-
trigger?: Snippet<[Record<string, unknown>]>;
|
|
26
20
|
/**
|
|
27
21
|
* Display an arrow alongside the popover.
|
|
28
22
|
*/
|
|
29
|
-
arrow?: boolean;
|
|
23
|
+
arrow?: boolean | PopoverArrowProps;
|
|
30
24
|
/**
|
|
31
25
|
* Render the popover in a portal.
|
|
32
26
|
*/
|
|
33
|
-
portal?: string | false | true | HTMLElement;
|
|
34
27
|
/**
|
|
35
28
|
* The reference (or anchor) element that is being referred to for positioning. If not provided will use the current component as anchor.
|
|
36
29
|
*/
|
|
@@ -43,10 +36,6 @@ export type PopoverProps = {
|
|
|
43
36
|
* When `false`, the popover will not close when clicking outside or pressing escape.
|
|
44
37
|
*/
|
|
45
38
|
dismissible?: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* The open state of the popover when it is initially rendered. Use when you do not need to control its open state.
|
|
48
|
-
*/
|
|
49
|
-
defaultopen?: boolean;
|
|
50
39
|
/**
|
|
51
40
|
* The controlled open state of the popover.
|
|
52
41
|
*/
|
|
@@ -67,21 +56,10 @@ export type PopoverProps = {
|
|
|
67
56
|
*
|
|
68
57
|
*/
|
|
69
58
|
ui?: {
|
|
70
|
-
content?:
|
|
71
|
-
arrow?:
|
|
59
|
+
content?: ClassValue;
|
|
60
|
+
arrow?: ClassValue;
|
|
61
|
+
trigger?: ClassValue;
|
|
72
62
|
};
|
|
73
|
-
/**
|
|
74
|
-
* @default `outline`
|
|
75
|
-
*/
|
|
76
|
-
variant?: ButtonProps['variant'];
|
|
77
|
-
/**
|
|
78
|
-
* @default primary
|
|
79
|
-
*/
|
|
80
|
-
color?: PropColor;
|
|
81
|
-
/**
|
|
82
|
-
*
|
|
83
|
-
*/
|
|
84
|
-
class?: ClassNameValue;
|
|
85
63
|
};
|
|
86
64
|
declare const Popover: import("svelte").Component<PopoverProps, {}, "open">;
|
|
87
65
|
type Popover = ReturnType<typeof Popover>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import type { PropColor } from '../index.js';
|
|
3
|
-
import type
|
|
4
|
-
import { tv } from 'tailwind-variants';
|
|
3
|
+
import { tv, type ClassValue } from 'tailwind-variants';
|
|
5
4
|
|
|
6
5
|
export type ProgressProps = {
|
|
7
6
|
value?: number;
|
|
@@ -13,10 +12,10 @@
|
|
|
13
12
|
inverted?: boolean;
|
|
14
13
|
status?: boolean;
|
|
15
14
|
ui?: {
|
|
16
|
-
base?:
|
|
17
|
-
header?:
|
|
18
|
-
content?:
|
|
19
|
-
footer?:
|
|
15
|
+
base?: ClassValue;
|
|
16
|
+
header?: ClassValue;
|
|
17
|
+
content?: ClassValue;
|
|
18
|
+
footer?: ClassValue;
|
|
20
19
|
};
|
|
21
20
|
};
|
|
22
21
|
</script>
|
|
@@ -47,10 +46,10 @@
|
|
|
47
46
|
|
|
48
47
|
return false;
|
|
49
48
|
});
|
|
50
|
-
const
|
|
49
|
+
const variants = $derived.by(() =>
|
|
51
50
|
tv({
|
|
52
51
|
slots: {
|
|
53
|
-
root: 'relative w-full rounded-full overflow-hidden bg-surface-
|
|
52
|
+
root: 'relative w-full rounded-full overflow-hidden bg-surface-accented',
|
|
54
53
|
status: '',
|
|
55
54
|
indicator: 'absolute transition-all rounded-full',
|
|
56
55
|
steps: '',
|
|
@@ -61,7 +60,7 @@
|
|
|
61
60
|
indicator: 'bg-primary-500',
|
|
62
61
|
},
|
|
63
62
|
surface: {
|
|
64
|
-
indicator: 'bg-
|
|
63
|
+
indicator: 'bg-label-muted',
|
|
65
64
|
},
|
|
66
65
|
info: {
|
|
67
66
|
indicator: 'bg-info-500',
|
|
@@ -92,8 +91,8 @@
|
|
|
92
91
|
</script>
|
|
93
92
|
|
|
94
93
|
<div data-state-indeterminate={indeterminate}>
|
|
95
|
-
<div class={
|
|
96
|
-
<span class={
|
|
94
|
+
<div class={variants.root({ class: [ui.base] })} style:height={`${height}px`}>
|
|
95
|
+
<span class={variants.indicator({ class: ['h-full left-0'] })} style:width={`${percentage}%`}>
|
|
97
96
|
</span>
|
|
98
97
|
</div>
|
|
99
98
|
|
|
@@ -101,7 +100,7 @@
|
|
|
101
100
|
<p
|
|
102
101
|
class={[
|
|
103
102
|
'text-right transition',
|
|
104
|
-
value && value > 0 && max[value] ? 'text-primary-500' : 'text-
|
|
103
|
+
value && value > 0 && max[value] ? 'text-primary-500' : 'text-label-muted',
|
|
105
104
|
]}
|
|
106
105
|
>
|
|
107
106
|
{(value && max[value]) || max[0]}
|
|
@@ -110,15 +109,17 @@
|
|
|
110
109
|
</div>
|
|
111
110
|
|
|
112
111
|
<style>
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
112
|
+
:global {
|
|
113
|
+
@keyframes swing {
|
|
114
|
+
0% {
|
|
115
|
+
width: 0%;
|
|
116
|
+
}
|
|
117
|
+
50% {
|
|
118
|
+
width: 100%;
|
|
119
|
+
}
|
|
120
|
+
100% {
|
|
121
|
+
width: 0%;
|
|
122
|
+
}
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
125
|
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PropColor } from '../index.js';
|
|
2
|
-
import type
|
|
2
|
+
import { type ClassValue } from 'tailwind-variants';
|
|
3
3
|
export type ProgressProps = {
|
|
4
4
|
value?: number;
|
|
5
5
|
max?: number | string[];
|
|
@@ -10,10 +10,10 @@ export type ProgressProps = {
|
|
|
10
10
|
inverted?: boolean;
|
|
11
11
|
status?: boolean;
|
|
12
12
|
ui?: {
|
|
13
|
-
base?:
|
|
14
|
-
header?:
|
|
15
|
-
content?:
|
|
16
|
-
footer?:
|
|
13
|
+
base?: ClassValue;
|
|
14
|
+
header?: ClassValue;
|
|
15
|
+
content?: ClassValue;
|
|
16
|
+
footer?: ClassValue;
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
19
|
declare const Progress: import("svelte").Component<ProgressProps, {}, "">;
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
import type { PropColor, PropVariant } from '../index.js';
|
|
3
3
|
import { Select } from 'bits-ui';
|
|
4
4
|
import type { Component, Snippet } from 'svelte';
|
|
5
|
-
import type
|
|
6
|
-
import
|
|
5
|
+
import { tv, type ClassValue } from 'tailwind-variants';
|
|
6
|
+
import Icon from './icon.svelte';
|
|
7
7
|
|
|
8
8
|
export type SelectItem<T> =
|
|
9
9
|
| T
|
|
10
10
|
| {
|
|
11
11
|
icon?: string | Component;
|
|
12
|
-
|
|
12
|
+
iconposition?: 'leading' | 'trailing';
|
|
13
|
+
label: string | Component | Snippet;
|
|
13
14
|
value: T;
|
|
14
15
|
};
|
|
15
16
|
|
|
@@ -23,34 +24,26 @@
|
|
|
23
24
|
highlight?: boolean;
|
|
24
25
|
placeholder?: string;
|
|
25
26
|
ui?: {
|
|
26
|
-
base?:
|
|
27
|
-
leading?:
|
|
28
|
-
|
|
29
|
-
leadingAvatar?:
|
|
30
|
-
leadingAvatarSize?:
|
|
31
|
-
trailing?:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
itemLeadingAvatar?: ClassNameValue;
|
|
45
|
-
itemLeadingAvatarSize?: ClassNameValue;
|
|
46
|
-
itemLeadingChip?: ClassNameValue;
|
|
47
|
-
itemLeadingChipSize?: ClassNameValue;
|
|
48
|
-
itemTrailing?: ClassNameValue;
|
|
49
|
-
itemTrailingIcon?: ClassNameValue;
|
|
50
|
-
itemWrapper?: ClassNameValue;
|
|
51
|
-
itemLabel?: ClassNameValue;
|
|
52
|
-
itemDescription?: ClassNameValue;
|
|
27
|
+
base?: ClassValue;
|
|
28
|
+
leading?: ClassValue;
|
|
29
|
+
icon?: ClassValue;
|
|
30
|
+
leadingAvatar?: ClassValue;
|
|
31
|
+
leadingAvatarSize?: ClassValue;
|
|
32
|
+
trailing?: ClassValue;
|
|
33
|
+
value?: ClassValue;
|
|
34
|
+
placeholder?: ClassValue;
|
|
35
|
+
arrow?: ClassValue;
|
|
36
|
+
content?: ClassValue;
|
|
37
|
+
viewport?: ClassValue;
|
|
38
|
+
group?: ClassValue;
|
|
39
|
+
empty?: ClassValue;
|
|
40
|
+
label?: ClassValue;
|
|
41
|
+
separator?: ClassValue;
|
|
42
|
+
item?: ClassValue;
|
|
43
|
+
itemicon?: ClassValue;
|
|
44
|
+
dropdownicon?: ClassValue;
|
|
53
45
|
};
|
|
46
|
+
dropdownicon?: string | Component;
|
|
54
47
|
} & (
|
|
55
48
|
| {
|
|
56
49
|
value?: T;
|
|
@@ -76,37 +69,39 @@
|
|
|
76
69
|
highlight,
|
|
77
70
|
placeholder,
|
|
78
71
|
ui = {},
|
|
72
|
+
dropdownicon = 'i-lucide:chevron-down',
|
|
79
73
|
}: SelectProps<T> = $props();
|
|
80
74
|
|
|
81
|
-
const
|
|
75
|
+
const variants = $derived(
|
|
82
76
|
tv({
|
|
83
77
|
slots: {
|
|
84
78
|
base: [
|
|
85
|
-
'relative group rounded-md inline-flex items-center focus:outline-none disabled:cursor-not-allowed disabled:opacity-75',
|
|
79
|
+
'relative group rounded-md inline-flex items-center justify-between focus:outline-none disabled:cursor-not-allowed disabled:opacity-75',
|
|
86
80
|
'transition-colors',
|
|
87
81
|
],
|
|
88
82
|
leading: 'absolute inset-y-0 start-0 flex items-center',
|
|
89
|
-
leadingIcon: 'shrink-0 text-dimmed',
|
|
83
|
+
leadingIcon: 'shrink-0 text-label-dimmed',
|
|
90
84
|
leadingAvatar: 'shrink-0',
|
|
91
85
|
leadingAvatarSize: '',
|
|
92
86
|
trailing: 'absolute inset-y-0 end-0 flex items-center',
|
|
93
|
-
trailingIcon: 'shrink-0 text-dimmed',
|
|
87
|
+
trailingIcon: 'shrink-0 text-label-dimmed',
|
|
94
88
|
value: 'truncate pointer-events-none',
|
|
95
|
-
placeholder: 'truncate text-dimmed',
|
|
89
|
+
placeholder: 'truncate text-label-dimmed',
|
|
96
90
|
arrow: 'fill-bg stroke-default',
|
|
97
91
|
content:
|
|
98
|
-
'max-h-60 w-(--bits-select-anchor-width) bg-inverted shadow-lg rounded-md ring ring-surface-accented overflow-hidden data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] origin-(--bits-select-content-transform-origin) pointer-events-auto flex flex-col',
|
|
92
|
+
'max-h-60 w-(--bits-select-anchor-width) bg-label-inverted shadow-lg rounded-md ring p-1 ring-surface-accented overflow-hidden data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] origin-(--bits-select-content-transform-origin) pointer-events-auto flex flex-col',
|
|
99
93
|
viewport: 'relative divide-y divide-base scroll-py-1 overflow-y-auto flex-1',
|
|
100
94
|
group: 'p-1 isolate',
|
|
101
|
-
empty: 'text-center text-muted',
|
|
102
|
-
label: 'font-semibold text-highlighted',
|
|
95
|
+
empty: 'text-center text-label-muted',
|
|
96
|
+
label: 'font-semibold text-label-highlighted',
|
|
103
97
|
separator: '-mx-1 my-1 h-px bg-border',
|
|
104
98
|
item: [
|
|
105
|
-
'group relative w-full flex items-start select-none outline-none
|
|
106
|
-
'
|
|
99
|
+
'group relative w-full flex items-start select-none outline-none whitespace-nowrap text-default rounded transition',
|
|
100
|
+
'data-disabled:cursor-not-allowed data-disabled:opacity-75',
|
|
101
|
+
'not-[data-disabled]:hover:text-label-highlighted not-[data-disabled]:hover:bg-surface-elevated/50',
|
|
107
102
|
],
|
|
108
103
|
itemLeadingIcon: [
|
|
109
|
-
'shrink-0 text-dimmed group-data-highlighted:not-group-data-disabled:text-default',
|
|
104
|
+
'shrink-0 text-label-dimmed group-data-highlighted:not-group-data-disabled:text-default',
|
|
110
105
|
'transition-colors',
|
|
111
106
|
],
|
|
112
107
|
itemLeadingAvatar: 'shrink-0',
|
|
@@ -117,7 +112,7 @@
|
|
|
117
112
|
itemTrailingIcon: 'shrink-0',
|
|
118
113
|
itemWrapper: 'flex-1 flex flex-col min-w-0',
|
|
119
114
|
itemLabel: 'truncate',
|
|
120
|
-
itemDescription: 'truncate text-muted',
|
|
115
|
+
itemDescription: 'truncate text-label-muted',
|
|
121
116
|
},
|
|
122
117
|
variants: {
|
|
123
118
|
fieldGroup: {
|
|
@@ -210,13 +205,13 @@
|
|
|
210
205
|
},
|
|
211
206
|
variant: {
|
|
212
207
|
outline:
|
|
213
|
-
'text-highlighted bg-default ring ring-inset ring-surface-accented hover:bg-surface-elevated disabled:bg-surface-default',
|
|
214
|
-
soft: 'text-highlighted bg-surface-elevated/50 hover:bg-surface-elevated focus:bg-surface-elevated disabled:bg-surface-elevated/50',
|
|
208
|
+
'text-label-highlighted bg-default ring ring-inset ring-surface-accented hover:bg-surface-elevated disabled:bg-surface-default',
|
|
209
|
+
soft: 'text-label-highlighted bg-surface-elevated/50 hover:bg-surface-elevated focus:bg-surface-elevated disabled:bg-surface-elevated/50',
|
|
215
210
|
subtle:
|
|
216
|
-
'text-highlighted bg-surface-elevated ring ring-inset ring-accented hover:bg-surface-accented/75 disabled:bg-surface-elevated',
|
|
211
|
+
'text-label-highlighted bg-surface-elevated ring ring-inset ring-accented hover:bg-surface-accented/75 disabled:bg-surface-elevated',
|
|
217
212
|
ghost:
|
|
218
|
-
'text-highlighted bg-transparent hover:bg-surface-elevated focus:bg-surface-elevated disabled:bg-transparent dark:disabled:bg-transparent',
|
|
219
|
-
none: 'text-highlighted bg-transparent',
|
|
213
|
+
'text-label-highlighted bg-transparent hover:bg-surface-elevated focus:bg-surface-elevated disabled:bg-transparent dark:disabled:bg-transparent',
|
|
214
|
+
none: 'text-label-highlighted bg-transparent',
|
|
220
215
|
},
|
|
221
216
|
color: {
|
|
222
217
|
primary: '',
|
|
@@ -242,7 +237,7 @@
|
|
|
242
237
|
false: '',
|
|
243
238
|
},
|
|
244
239
|
type: {
|
|
245
|
-
file: 'file:me-1.5 file:font-medium file:text-muted file:outline-none',
|
|
240
|
+
file: 'file:me-1.5 file:font-medium file:text-label-muted file:outline-none',
|
|
246
241
|
},
|
|
247
242
|
},
|
|
248
243
|
compoundVariants: [
|
|
@@ -407,13 +402,13 @@
|
|
|
407
402
|
(v) => (value = v as T | T[] | undefined)
|
|
408
403
|
}
|
|
409
404
|
>
|
|
410
|
-
<Select.Trigger class={
|
|
405
|
+
<Select.Trigger class={variants.base({ class: ui.base })}>
|
|
411
406
|
{value || placeholder}
|
|
412
|
-
<
|
|
407
|
+
<Icon name={dropdownicon} class="size-4" />
|
|
413
408
|
</Select.Trigger>
|
|
414
409
|
<Select.Portal>
|
|
415
410
|
<Select.Content
|
|
416
|
-
class={
|
|
411
|
+
class={variants.content({ class: ui.content })}
|
|
417
412
|
preventScroll={true}
|
|
418
413
|
sideOffset={8}
|
|
419
414
|
>
|
|
@@ -425,13 +420,13 @@
|
|
|
425
420
|
<Select.GroupHeading />
|
|
426
421
|
|
|
427
422
|
{#each item as group_item, gidx (gidx)}
|
|
428
|
-
<Select.Item class={
|
|
423
|
+
<Select.Item class={variants.item({ class: ui.item })} value=""></Select.Item>
|
|
429
424
|
{/each}
|
|
430
425
|
</Select.Group>
|
|
431
426
|
{:else}
|
|
432
427
|
{@const is_object = typeof item === 'object' && item !== null && 'value' in item}
|
|
433
428
|
<Select.Item
|
|
434
|
-
class={
|
|
429
|
+
class={variants.item({ class: ui.item })}
|
|
435
430
|
value={(is_object ? item.value : item) as string}
|
|
436
431
|
>
|
|
437
432
|
{item}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { PropColor, PropVariant } from '../index.js';
|
|
2
2
|
import { Select } from 'bits-ui';
|
|
3
3
|
import type { Component, Snippet } from 'svelte';
|
|
4
|
-
import type
|
|
4
|
+
import { type ClassValue } from 'tailwind-variants';
|
|
5
5
|
export type SelectItem<T> = T | {
|
|
6
6
|
icon?: string | Component;
|
|
7
|
-
|
|
7
|
+
iconposition?: 'leading' | 'trailing';
|
|
8
|
+
label: string | Component | Snippet;
|
|
8
9
|
value: T;
|
|
9
10
|
};
|
|
10
11
|
export type SelectProps<T> = {
|
|
@@ -19,34 +20,26 @@ export type SelectProps<T> = {
|
|
|
19
20
|
highlight?: boolean;
|
|
20
21
|
placeholder?: string;
|
|
21
22
|
ui?: {
|
|
22
|
-
base?:
|
|
23
|
-
leading?:
|
|
24
|
-
|
|
25
|
-
leadingAvatar?:
|
|
26
|
-
leadingAvatarSize?:
|
|
27
|
-
trailing?:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
itemLeadingAvatar?: ClassNameValue;
|
|
41
|
-
itemLeadingAvatarSize?: ClassNameValue;
|
|
42
|
-
itemLeadingChip?: ClassNameValue;
|
|
43
|
-
itemLeadingChipSize?: ClassNameValue;
|
|
44
|
-
itemTrailing?: ClassNameValue;
|
|
45
|
-
itemTrailingIcon?: ClassNameValue;
|
|
46
|
-
itemWrapper?: ClassNameValue;
|
|
47
|
-
itemLabel?: ClassNameValue;
|
|
48
|
-
itemDescription?: ClassNameValue;
|
|
23
|
+
base?: ClassValue;
|
|
24
|
+
leading?: ClassValue;
|
|
25
|
+
icon?: ClassValue;
|
|
26
|
+
leadingAvatar?: ClassValue;
|
|
27
|
+
leadingAvatarSize?: ClassValue;
|
|
28
|
+
trailing?: ClassValue;
|
|
29
|
+
value?: ClassValue;
|
|
30
|
+
placeholder?: ClassValue;
|
|
31
|
+
arrow?: ClassValue;
|
|
32
|
+
content?: ClassValue;
|
|
33
|
+
viewport?: ClassValue;
|
|
34
|
+
group?: ClassValue;
|
|
35
|
+
empty?: ClassValue;
|
|
36
|
+
label?: ClassValue;
|
|
37
|
+
separator?: ClassValue;
|
|
38
|
+
item?: ClassValue;
|
|
39
|
+
itemicon?: ClassValue;
|
|
40
|
+
dropdownicon?: ClassValue;
|
|
49
41
|
};
|
|
42
|
+
dropdownicon?: string | Component;
|
|
50
43
|
} & ({
|
|
51
44
|
value?: T;
|
|
52
45
|
type?: 'single';
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import { Icon, type PropColor, isComponent, isSnippet } from '../index.js';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
|
-
import type
|
|
5
|
-
import { tv } from 'tailwind-variants';
|
|
4
|
+
import { tv, type ClassValue } from 'tailwind-variants';
|
|
6
5
|
import type { Component } from 'svelte';
|
|
7
6
|
|
|
8
7
|
export type SeperatorProps = {
|
|
9
|
-
label?: string | Snippet<[
|
|
8
|
+
label?: string | Snippet<[ClassValue]> | Component;
|
|
10
9
|
icon?: string | Component;
|
|
11
10
|
color?: PropColor;
|
|
12
11
|
type?: 'dashed' | 'solid' | 'dotted';
|
|
@@ -14,10 +13,10 @@
|
|
|
14
13
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
15
14
|
orientation?: 'horizontal' | 'vertical';
|
|
16
15
|
ui?: {
|
|
17
|
-
root?:
|
|
18
|
-
border?:
|
|
19
|
-
icon?:
|
|
20
|
-
label?:
|
|
16
|
+
root?: ClassValue;
|
|
17
|
+
border?: ClassValue;
|
|
18
|
+
icon?: ClassValue;
|
|
19
|
+
label?: ClassValue;
|
|
21
20
|
};
|
|
22
21
|
};
|
|
23
22
|
</script>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type PropColor } from '../index.js';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
import type
|
|
3
|
+
import { type ClassValue } from 'tailwind-variants';
|
|
4
4
|
import type { Component } from 'svelte';
|
|
5
5
|
export type SeperatorProps = {
|
|
6
|
-
label?: string | Snippet<[
|
|
6
|
+
label?: string | Snippet<[ClassValue]> | Component;
|
|
7
7
|
icon?: string | Component;
|
|
8
8
|
color?: PropColor;
|
|
9
9
|
type?: 'dashed' | 'solid' | 'dotted';
|
|
@@ -11,10 +11,10 @@ export type SeperatorProps = {
|
|
|
11
11
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
12
12
|
orientation?: 'horizontal' | 'vertical';
|
|
13
13
|
ui?: {
|
|
14
|
-
root?:
|
|
15
|
-
border?:
|
|
16
|
-
icon?:
|
|
17
|
-
label?:
|
|
14
|
+
root?: ClassValue;
|
|
15
|
+
border?: ClassValue;
|
|
16
|
+
icon?: ClassValue;
|
|
17
|
+
label?: ClassValue;
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
declare const Seperator: Component<SeperatorProps, {}, "">;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import { Slider } from 'bits-ui';
|
|
3
3
|
import type { PropColor } from '../index.js';
|
|
4
|
-
import type
|
|
5
|
-
import { tv } from 'tailwind-variants';
|
|
4
|
+
import { tv, type ClassValue } from 'tailwind-variants';
|
|
6
5
|
|
|
7
6
|
export type SliderProps<T> = {
|
|
8
7
|
value?: T;
|
|
@@ -16,9 +15,9 @@
|
|
|
16
15
|
min?: number;
|
|
17
16
|
max?: number;
|
|
18
17
|
ui?: {
|
|
19
|
-
root?:
|
|
20
|
-
range?:
|
|
21
|
-
thumb?:
|
|
18
|
+
root?: ClassValue;
|
|
19
|
+
range?: ClassValue;
|
|
20
|
+
thumb?: ClassValue;
|
|
22
21
|
};
|
|
23
22
|
};
|
|
24
23
|
</script>
|
|
@@ -54,15 +53,15 @@
|
|
|
54
53
|
},
|
|
55
54
|
});
|
|
56
55
|
const thumbs = $derived(slider_value.get()?.length ?? 1);
|
|
57
|
-
const
|
|
56
|
+
const variants = $derived.by(() =>
|
|
58
57
|
tv({
|
|
59
58
|
slots: {
|
|
60
59
|
root: [
|
|
61
|
-
'relative w-full flex rounded-full bg-
|
|
60
|
+
'relative w-full flex rounded-full bg-label-dimmed',
|
|
62
61
|
orientation === 'horizontal' ? 'items-center' : 'justify-center mx-1',
|
|
63
62
|
],
|
|
64
63
|
range: [
|
|
65
|
-
'rounded-full bg-
|
|
64
|
+
'rounded-full bg-surface-accented p-0.5 relative transition',
|
|
66
65
|
orientation === 'horizontal' ? 'h-full' : 'w-full',
|
|
67
66
|
],
|
|
68
67
|
thumb: 'bg-white rounded-full border-2 outline-none transition',
|
|
@@ -76,8 +75,8 @@
|
|
|
76
75
|
thumb: 'border-primary-500',
|
|
77
76
|
},
|
|
78
77
|
surface: {
|
|
79
|
-
range: ['bg-
|
|
80
|
-
thumb: 'border-
|
|
78
|
+
range: ['bg-surface-inverted'],
|
|
79
|
+
thumb: 'border-surface-inverted',
|
|
81
80
|
},
|
|
82
81
|
info: {
|
|
83
82
|
range: ['bg-info-500'],
|
|
@@ -149,18 +148,18 @@
|
|
|
149
148
|
{step}
|
|
150
149
|
{orientation}
|
|
151
150
|
{disabled}
|
|
152
|
-
class={
|
|
151
|
+
class={variants.root({ class: [disabled ? 'opacity-75 cursor-not-allowed' : '', ui.root] })}
|
|
153
152
|
>
|
|
154
|
-
<Slider.Range class={
|
|
153
|
+
<Slider.Range class={variants.range({ class: [ui.range] })} />
|
|
155
154
|
|
|
156
155
|
{#each { length: thumbs }, index (index)}
|
|
157
|
-
<Slider.Thumb {index} class={
|
|
156
|
+
<Slider.Thumb {index} class={variants.thumb({ class: ['group', ui.thumb] })}>
|
|
158
157
|
{#if thumblabel}
|
|
159
158
|
<Slider.ThumbLabel
|
|
160
159
|
{index}
|
|
161
160
|
position="bottom"
|
|
162
161
|
class={[
|
|
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-
|
|
162
|
+
'opacity-0 transition pointer-events-none text-sm shadow-md px-2 h-6 flex items-center rounded-md mt-1 border border-surface-accented',
|
|
164
163
|
'data-[active=""]:opacity-100 group-hover:opacity-100',
|
|
165
164
|
]}
|
|
166
165
|
>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Slider } from 'bits-ui';
|
|
2
2
|
import type { PropColor } from '../index.js';
|
|
3
|
-
import type
|
|
3
|
+
import { type ClassValue } from 'tailwind-variants';
|
|
4
4
|
export type SliderProps<T> = {
|
|
5
5
|
value?: T;
|
|
6
6
|
default?: number | number[];
|
|
@@ -13,9 +13,9 @@ export type SliderProps<T> = {
|
|
|
13
13
|
min?: number;
|
|
14
14
|
max?: number;
|
|
15
15
|
ui?: {
|
|
16
|
-
root?:
|
|
17
|
-
range?:
|
|
18
|
-
thumb?:
|
|
16
|
+
root?: ClassValue;
|
|
17
|
+
range?: ClassValue;
|
|
18
|
+
thumb?: ClassValue;
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
21
|
declare function $$render<T extends number | number[]>(): {
|