uisv 0.0.20 → 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 +33 -38
- package/dist/components/badge.svelte.d.ts +3 -3
- package/dist/components/banner.svelte +47 -55
- 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 -48
- package/dist/components/button.svelte.d.ts +12 -12
- package/dist/components/calendar.svelte +6 -7
- package/dist/components/calendar.svelte.d.ts +3 -3
- package/dist/components/card.svelte +14 -15
- 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 +21 -22
- 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/icon.svelte +0 -2
- 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.d.ts +2 -1
- package/dist/vite.js +32 -37
- package/package.json +31 -26
|
@@ -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[]>(): {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import { type PropColor, Icon } from '../index.js';
|
|
3
3
|
import type { Snippet, Component } from 'svelte';
|
|
4
|
-
import type
|
|
5
|
-
import { tv } from 'tailwind-variants';
|
|
4
|
+
import { tv, type ClassValue } from 'tailwind-variants';
|
|
6
5
|
|
|
7
6
|
export type SwitchProps = {
|
|
8
7
|
value?: boolean;
|
|
@@ -17,11 +16,11 @@
|
|
|
17
16
|
description?: string | Snippet;
|
|
18
17
|
required?: boolean;
|
|
19
18
|
ui?: {
|
|
20
|
-
root?:
|
|
21
|
-
container?:
|
|
22
|
-
thumb?:
|
|
23
|
-
label?:
|
|
24
|
-
description?:
|
|
19
|
+
root?: ClassValue;
|
|
20
|
+
container?: ClassValue;
|
|
21
|
+
thumb?: ClassValue;
|
|
22
|
+
label?: ClassValue;
|
|
23
|
+
description?: ClassValue;
|
|
25
24
|
};
|
|
26
25
|
};
|
|
27
26
|
</script>
|
|
@@ -42,18 +41,18 @@
|
|
|
42
41
|
ui = {},
|
|
43
42
|
}: SwitchProps = $props();
|
|
44
43
|
|
|
45
|
-
const
|
|
44
|
+
const variants = $derived.by(() =>
|
|
46
45
|
tv({
|
|
47
46
|
slots: {
|
|
48
47
|
root: 'flex-inline gap-2',
|
|
49
|
-
container: 'rounded-full bg-
|
|
48
|
+
container: 'rounded-full bg-surface-accented p-0.5 relative transition',
|
|
50
49
|
thumb: [
|
|
51
50
|
'bg-white block rounded-full absolute top-0.5 transition grid place-items-center',
|
|
52
|
-
value ? 'translate-x-full' : 'text-
|
|
51
|
+
value ? 'translate-x-full' : 'text-label-muted',
|
|
53
52
|
],
|
|
54
53
|
icon: 'pi',
|
|
55
54
|
label: 'text-sm',
|
|
56
|
-
description: 'text-sm text-
|
|
55
|
+
description: 'text-sm text-label-muted',
|
|
57
56
|
},
|
|
58
57
|
variants: {
|
|
59
58
|
color: {
|
|
@@ -61,7 +60,7 @@
|
|
|
61
60
|
container: ['', value && 'bg-primary-500 text-primary-500'],
|
|
62
61
|
},
|
|
63
62
|
surface: {
|
|
64
|
-
container: ['', value && 'bg-
|
|
63
|
+
container: ['', value && 'bg-surface-inverted text-surface-inverted'],
|
|
65
64
|
},
|
|
66
65
|
info: {
|
|
67
66
|
container: ['', value && 'bg-info-500 text-info-500'],
|
|
@@ -111,23 +110,23 @@
|
|
|
111
110
|
|
|
112
111
|
<div
|
|
113
112
|
data-state={value ? 'checked' : 'unchecked'}
|
|
114
|
-
class={
|
|
113
|
+
class={variants.root({
|
|
115
114
|
class: [(loading || disabled) && 'opacity-50', ui.thumb],
|
|
116
115
|
})}
|
|
117
116
|
>
|
|
118
117
|
<button
|
|
119
118
|
aria-label="switch"
|
|
120
119
|
data-state={value ? 'checked' : 'unchecked'}
|
|
121
|
-
class={
|
|
120
|
+
class={variants.container({ class: [loading && 'cursor-not-allowed', ui.thumb] })}
|
|
122
121
|
onclick={() => {
|
|
123
122
|
if (loading || disabled) return;
|
|
124
123
|
value = !value;
|
|
125
124
|
}}
|
|
126
125
|
>
|
|
127
|
-
<span data-state={value ? 'checked' : 'unchecked'} class={
|
|
126
|
+
<span data-state={value ? 'checked' : 'unchecked'} class={variants.thumb({ class: ui.thumb })}>
|
|
128
127
|
<Icon
|
|
129
128
|
name={loading ? loadingicon : value ? checkedicon : uncheckedicon}
|
|
130
|
-
class={
|
|
129
|
+
class={variants.icon({ class: [loading && 'animate-spin'] })}
|
|
131
130
|
/>
|
|
132
131
|
</span>
|
|
133
132
|
</button>
|
|
@@ -135,7 +134,7 @@
|
|
|
135
134
|
{#if label}
|
|
136
135
|
<span>
|
|
137
136
|
<div
|
|
138
|
-
class={
|
|
137
|
+
class={variants.label({
|
|
139
138
|
class: [required ? 'after:content-["*"] after:text-error-500' : '', ui.thumb],
|
|
140
139
|
})}
|
|
141
140
|
>
|
|
@@ -147,7 +146,7 @@
|
|
|
147
146
|
</div>
|
|
148
147
|
|
|
149
148
|
{#if description}
|
|
150
|
-
<div class={
|
|
149
|
+
<div class={variants.description({ class: ui.thumb })}>
|
|
151
150
|
{#if typeof description === 'string'}
|
|
152
151
|
{description}
|
|
153
152
|
{:else}
|
|
@@ -158,7 +157,3 @@
|
|
|
158
157
|
</span>
|
|
159
158
|
{/if}
|
|
160
159
|
</div>
|
|
161
|
-
|
|
162
|
-
{#snippet icon(ico?: SwitchProps['checkedicon'], icon_class?: ClassNameValue)}
|
|
163
|
-
<div class={['absolute', icon_class]}></div>
|
|
164
|
-
{/snippet}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type PropColor } from '../index.js';
|
|
2
2
|
import type { Snippet, Component } from 'svelte';
|
|
3
|
-
import type
|
|
3
|
+
import { type ClassValue } from 'tailwind-variants';
|
|
4
4
|
export type SwitchProps = {
|
|
5
5
|
value?: boolean;
|
|
6
6
|
color?: PropColor;
|
|
@@ -14,11 +14,11 @@ export type SwitchProps = {
|
|
|
14
14
|
description?: string | Snippet;
|
|
15
15
|
required?: boolean;
|
|
16
16
|
ui?: {
|
|
17
|
-
root?:
|
|
18
|
-
container?:
|
|
19
|
-
thumb?:
|
|
20
|
-
label?:
|
|
21
|
-
description?:
|
|
17
|
+
root?: ClassValue;
|
|
18
|
+
container?: ClassValue;
|
|
19
|
+
thumb?: ClassValue;
|
|
20
|
+
label?: ClassValue;
|
|
21
|
+
description?: ClassValue;
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
24
|
declare const Switch: Component<SwitchProps, {}, "value">;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import { Tabs } from 'bits-ui';
|
|
3
3
|
import { isComponent, isSnippet, useElementRects, type PropColor } from '../index.js';
|
|
4
|
-
import type
|
|
5
|
-
import { tv } from 'tailwind-variants';
|
|
4
|
+
import { tv, type ClassValue } from 'tailwind-variants';
|
|
6
5
|
import { type Component, type Snippet } from 'svelte';
|
|
7
6
|
import { ElementRect } from 'runed';
|
|
8
7
|
|
|
@@ -24,12 +23,12 @@
|
|
|
24
23
|
disabled?: boolean;
|
|
25
24
|
orientation?: 'vertical' | 'horizontal';
|
|
26
25
|
ui?: {
|
|
27
|
-
root?:
|
|
28
|
-
item?:
|
|
29
|
-
list?:
|
|
30
|
-
content?:
|
|
31
|
-
icon?:
|
|
32
|
-
indicator?:
|
|
26
|
+
root?: ClassValue;
|
|
27
|
+
item?: ClassValue;
|
|
28
|
+
list?: ClassValue;
|
|
29
|
+
content?: ClassValue;
|
|
30
|
+
icon?: ClassValue;
|
|
31
|
+
indicator?: ClassValue;
|
|
33
32
|
};
|
|
34
33
|
[k: `content_${string}`]: Snippet<[{ item: TabItem; value: number }]>;
|
|
35
34
|
};
|
|
@@ -65,12 +64,12 @@
|
|
|
65
64
|
return result;
|
|
66
65
|
});
|
|
67
66
|
|
|
68
|
-
const
|
|
67
|
+
const variants = $derived.by(() =>
|
|
69
68
|
tv({
|
|
70
69
|
slots: {
|
|
71
70
|
root: '',
|
|
72
71
|
list: 'flex relative p-1',
|
|
73
|
-
item: 'flex items-center justify-center text-muted data-[state="inactive"]:hover:text-highlighted font-medium z-1 transition-all',
|
|
72
|
+
item: 'flex items-center justify-center text-label-muted data-[state="inactive"]:hover:text-label-highlighted font-medium z-1 transition-all',
|
|
74
73
|
icon: '',
|
|
75
74
|
content: 'mt-2',
|
|
76
75
|
indicator: 'absolute z-0 transition-all duration-200 rounded-md w---width',
|
|
@@ -79,7 +78,7 @@
|
|
|
79
78
|
variant: {
|
|
80
79
|
pill: {
|
|
81
80
|
list: 'bg-surface-elevated rounded-lg',
|
|
82
|
-
item: 'flex-1 data-[state="active"]:text-inverted',
|
|
81
|
+
item: 'flex-1 data-[state="active"]:text-label-inverted',
|
|
83
82
|
trigger: 'flex-1',
|
|
84
83
|
indicator: 'rounded-md shadow-xs',
|
|
85
84
|
},
|
|
@@ -96,8 +95,8 @@
|
|
|
96
95
|
indicator: 'bg-primary-500',
|
|
97
96
|
},
|
|
98
97
|
surface: {
|
|
99
|
-
item: 'data-[variant="link"]:data-[state="active"]:text-
|
|
100
|
-
indicator: 'bg-surface-
|
|
98
|
+
item: 'data-[variant="link"]:data-[state="active"]:text-label-muted',
|
|
99
|
+
indicator: 'bg-surface-inverted',
|
|
101
100
|
},
|
|
102
101
|
info: {
|
|
103
102
|
item: 'data-[variant="link"]:data-[state="active"]:text-info-500',
|
|
@@ -183,10 +182,10 @@
|
|
|
183
182
|
<Tabs.Root
|
|
184
183
|
{disabled}
|
|
185
184
|
bind:value={() => value.toString(), (v) => (value = parseInt(v))}
|
|
186
|
-
class={
|
|
185
|
+
class={variants.root({ class: ui.root })}
|
|
187
186
|
{orientation}
|
|
188
187
|
>
|
|
189
|
-
<Tabs.List bind:ref={container_el} class={
|
|
188
|
+
<Tabs.List bind:ref={container_el} class={variants.list({ class: ui.list })}>
|
|
190
189
|
{#each items as item, idx (idx)}
|
|
191
190
|
{@const label = typeof item === 'string' ? item : item.label}
|
|
192
191
|
|
|
@@ -201,7 +200,7 @@
|
|
|
201
200
|
}
|
|
202
201
|
}
|
|
203
202
|
value={idx.toString()}
|
|
204
|
-
class={
|
|
203
|
+
class={variants.item({ class: ui.item })}
|
|
205
204
|
data-variant={variant}
|
|
206
205
|
>
|
|
207
206
|
{@render RenderIcon(typeof item === 'string' ? undefined : item.icon)}
|
|
@@ -211,7 +210,7 @@
|
|
|
211
210
|
{/each}
|
|
212
211
|
|
|
213
212
|
<span
|
|
214
|
-
class={
|
|
213
|
+
class={variants.indicator({ class: ui.indicator })}
|
|
215
214
|
style:--width="{rect.w}px"
|
|
216
215
|
style:--left="{rect.l}px"
|
|
217
216
|
style:--height="{rect.w}px"
|
|
@@ -221,7 +220,7 @@
|
|
|
221
220
|
{#each items as item, idx (idx)}
|
|
222
221
|
{#if typeof item === 'object' && item.content}
|
|
223
222
|
{@const Content = item.content}
|
|
224
|
-
<Tabs.Content value={idx.toString()} class={
|
|
223
|
+
<Tabs.Content value={idx.toString()} class={variants.content({ class: ui.content })}>
|
|
225
224
|
{#if `content_${idx}` in rest}
|
|
226
225
|
{@render rest[`content_${idx}`]({ item, value: idx })}
|
|
227
226
|
{:else if typeof Content === 'string'}
|
|
@@ -238,8 +237,8 @@
|
|
|
238
237
|
{#if isSnippet(IconProp)}
|
|
239
238
|
{@render IconProp()}
|
|
240
239
|
{:else if isComponent(IconProp)}
|
|
241
|
-
<IconProp class={
|
|
240
|
+
<IconProp class={variants.icon({ class: ui.icon })} />
|
|
242
241
|
{:else if typeof IconProp === 'string'}
|
|
243
|
-
<div class={
|
|
242
|
+
<div class={variants.icon({ class: [IconProp, ui.icon] })}></div>
|
|
244
243
|
{/if}
|
|
245
244
|
{/snippet}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Tabs } from 'bits-ui';
|
|
2
2
|
import { type PropColor } from '../index.js';
|
|
3
|
-
import type
|
|
3
|
+
import { type ClassValue } from 'tailwind-variants';
|
|
4
4
|
import { type Component, type Snippet } from 'svelte';
|
|
5
5
|
export type TabItem = string | {
|
|
6
6
|
label: string;
|
|
@@ -17,12 +17,12 @@ export type TabsProps = {
|
|
|
17
17
|
disabled?: boolean;
|
|
18
18
|
orientation?: 'vertical' | 'horizontal';
|
|
19
19
|
ui?: {
|
|
20
|
-
root?:
|
|
21
|
-
item?:
|
|
22
|
-
list?:
|
|
23
|
-
content?:
|
|
24
|
-
icon?:
|
|
25
|
-
indicator?:
|
|
20
|
+
root?: ClassValue;
|
|
21
|
+
item?: ClassValue;
|
|
22
|
+
list?: ClassValue;
|
|
23
|
+
content?: ClassValue;
|
|
24
|
+
icon?: ClassValue;
|
|
25
|
+
indicator?: ClassValue;
|
|
26
26
|
};
|
|
27
27
|
[k: `content_${string}`]: Snippet<[{
|
|
28
28
|
item: TabItem;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { TooltipContentProps, TooltipArrowProps, PortalProps } from 'bits-ui';
|
|
3
|
+
import { Tooltip } from 'bits-ui';
|
|
4
|
+
import { type KbdProps, type ButtonProps, isSnippet, Button, Kbd } from '../index.js';
|
|
5
|
+
import type { Snippet } from 'svelte';
|
|
6
|
+
import { fly } from 'svelte/transition';
|
|
7
|
+
import { tv, type ClassValue } from 'tailwind-variants';
|
|
8
|
+
|
|
9
|
+
export type TooltipProps = {
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
open?: boolean;
|
|
12
|
+
kbds?: KbdProps['value'][] | KbdProps[];
|
|
13
|
+
trigger?: ButtonProps | Snippet<[Record<string, unknown>]>;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
portal?: PortalProps;
|
|
16
|
+
content?: TooltipContentProps;
|
|
17
|
+
ui?: {
|
|
18
|
+
content?: ClassValue;
|
|
19
|
+
wrapper?: ClassValue;
|
|
20
|
+
kbds?: ClassValue;
|
|
21
|
+
arrow?: ClassValue;
|
|
22
|
+
};
|
|
23
|
+
arrow?: boolean | TooltipArrowProps;
|
|
24
|
+
};
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<script lang="ts">
|
|
28
|
+
let {
|
|
29
|
+
children,
|
|
30
|
+
open = $bindable(false),
|
|
31
|
+
kbds,
|
|
32
|
+
trigger,
|
|
33
|
+
disabled,
|
|
34
|
+
portal,
|
|
35
|
+
content,
|
|
36
|
+
ui = {},
|
|
37
|
+
arrow,
|
|
38
|
+
...rest
|
|
39
|
+
}: TooltipProps = $props();
|
|
40
|
+
|
|
41
|
+
const variants = $derived(
|
|
42
|
+
tv({
|
|
43
|
+
slots: {
|
|
44
|
+
content: '',
|
|
45
|
+
wrapper: '',
|
|
46
|
+
kbds: '',
|
|
47
|
+
kbdsize: '',
|
|
48
|
+
arrow: '',
|
|
49
|
+
},
|
|
50
|
+
})(),
|
|
51
|
+
);
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<Tooltip.Root bind:open disabled={!(children || kbds?.length) || disabled}>
|
|
55
|
+
{#if !!trigger}
|
|
56
|
+
<Tooltip.Trigger {...rest}>
|
|
57
|
+
{#snippet child({ props })}
|
|
58
|
+
{#if isSnippet(trigger)}
|
|
59
|
+
{@render trigger(props)}
|
|
60
|
+
{:else}
|
|
61
|
+
<Button {...props} {...trigger} />
|
|
62
|
+
{/if}
|
|
63
|
+
{/snippet}
|
|
64
|
+
</Tooltip.Trigger>
|
|
65
|
+
{/if}
|
|
66
|
+
|
|
67
|
+
<Tooltip.Portal {...portal}>
|
|
68
|
+
<Tooltip.Content {...content} forceMount>
|
|
69
|
+
{#snippet child({ props, wrapperProps })}
|
|
70
|
+
<div {...wrapperProps} class={variants.wrapper({ class: [ui.wrapper] })}>
|
|
71
|
+
<div {...props} class={variants.content({ class: [ui.content] })} transition:fly>
|
|
72
|
+
{@render children?.()}
|
|
73
|
+
|
|
74
|
+
{#if kbds?.length}
|
|
75
|
+
<span class={variants.kbds({ class: ui.kbds })}>
|
|
76
|
+
{#each kbds as kbd, idx (idx)}
|
|
77
|
+
<Kbd {...typeof kbd === 'string' ? { value: kbd } : kbd} />
|
|
78
|
+
{/each}
|
|
79
|
+
</span>
|
|
80
|
+
{/if}
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
{/snippet}
|
|
84
|
+
children
|
|
85
|
+
|
|
86
|
+
{#if arrow}
|
|
87
|
+
<Tooltip.Arrow
|
|
88
|
+
{...typeof arrow === 'boolean' ? {} : arrow}
|
|
89
|
+
class={variants.arrow({ class: ui.arrow })}
|
|
90
|
+
/>
|
|
91
|
+
{/if}
|
|
92
|
+
</Tooltip.Content>
|
|
93
|
+
</Tooltip.Portal>
|
|
94
|
+
</Tooltip.Root>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { TooltipContentProps, TooltipArrowProps, PortalProps } from 'bits-ui';
|
|
2
|
+
import { Tooltip } from 'bits-ui';
|
|
3
|
+
import { type KbdProps, type ButtonProps } from '../index.js';
|
|
4
|
+
import type { Snippet } from 'svelte';
|
|
5
|
+
import { type ClassValue } from 'tailwind-variants';
|
|
6
|
+
export type TooltipProps = {
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
open?: boolean;
|
|
9
|
+
kbds?: KbdProps['value'][] | KbdProps[];
|
|
10
|
+
trigger?: ButtonProps | Snippet<[Record<string, unknown>]>;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
portal?: PortalProps;
|
|
13
|
+
content?: TooltipContentProps;
|
|
14
|
+
ui?: {
|
|
15
|
+
content?: ClassValue;
|
|
16
|
+
wrapper?: ClassValue;
|
|
17
|
+
kbds?: ClassValue;
|
|
18
|
+
arrow?: ClassValue;
|
|
19
|
+
};
|
|
20
|
+
arrow?: boolean | TooltipArrowProps;
|
|
21
|
+
};
|
|
22
|
+
declare const Tooltip: import("svelte").Component<TooltipProps, {}, "open">;
|
|
23
|
+
type Tooltip = ReturnType<typeof Tooltip>;
|
|
24
|
+
export default Tooltip;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Context } from 'runed';
|
|
2
|
+
export declare const app_icons: Context<Record<"arrowdown" | "arrowleft" | "arrowright" | "arrowup" | "caution" | "check" | "chevrondoubleleft" | "chevrondoubleright" | "chevrondown" | "chevronleft" | "chevronright" | "chevronup" | "close" | "copy" | "copycheck" | "dark" | "drag" | "ellipsis" | "error" | "external" | "eye" | "eyeoff" | "file" | "folder" | "folderopen" | "hash" | "info" | "light" | "loading" | "menu" | "minus" | "panelclose" | "panelopen" | "plus" | "reload" | "search" | "stop" | "success" | "system" | "tip" | "upload" | "warning", string>>;
|
|
3
|
+
export type AppIcons = keyof typeof DEFAULT_ICONS;
|
|
4
|
+
export declare const DEFAULT_ICONS: {
|
|
5
|
+
arrowdown: string;
|
|
6
|
+
arrowleft: string;
|
|
7
|
+
arrowright: string;
|
|
8
|
+
arrowup: string;
|
|
9
|
+
caution: string;
|
|
10
|
+
check: string;
|
|
11
|
+
chevrondoubleleft: string;
|
|
12
|
+
chevrondoubleright: string;
|
|
13
|
+
chevrondown: string;
|
|
14
|
+
chevronleft: string;
|
|
15
|
+
chevronright: string;
|
|
16
|
+
chevronup: string;
|
|
17
|
+
close: string;
|
|
18
|
+
copy: string;
|
|
19
|
+
copycheck: string;
|
|
20
|
+
dark: string;
|
|
21
|
+
drag: string;
|
|
22
|
+
ellipsis: string;
|
|
23
|
+
error: string;
|
|
24
|
+
external: string;
|
|
25
|
+
eye: string;
|
|
26
|
+
eyeoff: string;
|
|
27
|
+
file: string;
|
|
28
|
+
folder: string;
|
|
29
|
+
folderopen: string;
|
|
30
|
+
hash: string;
|
|
31
|
+
info: string;
|
|
32
|
+
light: string;
|
|
33
|
+
loading: string;
|
|
34
|
+
menu: string;
|
|
35
|
+
minus: string;
|
|
36
|
+
panelclose: string;
|
|
37
|
+
panelopen: string;
|
|
38
|
+
plus: string;
|
|
39
|
+
reload: string;
|
|
40
|
+
search: string;
|
|
41
|
+
stop: string;
|
|
42
|
+
success: string;
|
|
43
|
+
system: string;
|
|
44
|
+
tip: string;
|
|
45
|
+
upload: string;
|
|
46
|
+
warning: string;
|
|
47
|
+
};
|