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,8 +1,7 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import type { PropVariant } 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
|
|
|
7
6
|
export type CardProps = {
|
|
8
7
|
children: Snippet;
|
|
@@ -10,10 +9,10 @@
|
|
|
10
9
|
footer?: Snippet;
|
|
11
10
|
variant?: Exclude<PropVariant, 'none' | 'ghost'>;
|
|
12
11
|
ui?: {
|
|
13
|
-
base?:
|
|
14
|
-
header?:
|
|
15
|
-
content?:
|
|
16
|
-
footer?:
|
|
12
|
+
base?: ClassValue;
|
|
13
|
+
header?: ClassValue;
|
|
14
|
+
content?: ClassValue;
|
|
15
|
+
footer?: ClassValue;
|
|
17
16
|
};
|
|
18
17
|
};
|
|
19
18
|
</script>
|
|
@@ -21,7 +20,7 @@
|
|
|
21
20
|
<script lang="ts">
|
|
22
21
|
let { header, children, footer, variant = 'solid', ui = {} }: CardProps = $props();
|
|
23
22
|
|
|
24
|
-
const
|
|
23
|
+
const variants = $derived.by(() =>
|
|
25
24
|
tv({
|
|
26
25
|
slots: {
|
|
27
26
|
base: 'rounded overflow-hidden',
|
|
@@ -32,18 +31,18 @@
|
|
|
32
31
|
variants: {
|
|
33
32
|
variant: {
|
|
34
33
|
solid: {
|
|
35
|
-
base: 'bg-surface-
|
|
34
|
+
base: 'bg-surface-inverted text-label-inverted',
|
|
36
35
|
header: 'border-transparent',
|
|
37
36
|
footer: 'border-transparent',
|
|
38
37
|
},
|
|
39
38
|
outline: {
|
|
40
|
-
base: 'border border-surface-
|
|
39
|
+
base: 'border border-surface-accented divide-y divide-surface-accented',
|
|
41
40
|
},
|
|
42
41
|
soft: {
|
|
43
|
-
base: 'bg-surface
|
|
42
|
+
base: 'bg-surface/10 divide-y divide-surface-accented',
|
|
44
43
|
},
|
|
45
44
|
subtle: {
|
|
46
|
-
base: 'bg-surface
|
|
45
|
+
base: 'bg-surface/10 border-surface-accented border divide-y divide-surface-accented',
|
|
47
46
|
},
|
|
48
47
|
},
|
|
49
48
|
},
|
|
@@ -52,19 +51,19 @@
|
|
|
52
51
|
);
|
|
53
52
|
</script>
|
|
54
53
|
|
|
55
|
-
<div class={
|
|
54
|
+
<div class={variants.base({ class: [ui.base] })}>
|
|
56
55
|
{#if header}
|
|
57
|
-
<div class={
|
|
56
|
+
<div class={variants.header({ class: [ui.header] })}>
|
|
58
57
|
{@render header()}
|
|
59
58
|
</div>
|
|
60
59
|
{/if}
|
|
61
60
|
|
|
62
|
-
<div class={
|
|
61
|
+
<div class={variants.content({ class: ui.content })}>
|
|
63
62
|
{@render children()}
|
|
64
63
|
</div>
|
|
65
64
|
|
|
66
65
|
{#if footer}
|
|
67
|
-
<div class={
|
|
66
|
+
<div class={variants.header({ class: [ui.header] })}>
|
|
68
67
|
{@render footer()}
|
|
69
68
|
</div>
|
|
70
69
|
{/if}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { PropVariant } from '../index.js';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
import type
|
|
3
|
+
import { type ClassValue } from 'tailwind-variants';
|
|
4
4
|
export type CardProps = {
|
|
5
5
|
children: Snippet;
|
|
6
6
|
header?: Snippet;
|
|
7
7
|
footer?: Snippet;
|
|
8
8
|
variant?: Exclude<PropVariant, 'none' | 'ghost'>;
|
|
9
9
|
ui?: {
|
|
10
|
-
base?:
|
|
11
|
-
header?:
|
|
12
|
-
content?:
|
|
13
|
-
footer?:
|
|
10
|
+
base?: ClassValue;
|
|
11
|
+
header?: ClassValue;
|
|
12
|
+
content?: ClassValue;
|
|
13
|
+
footer?: ClassValue;
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
16
|
declare const Card: import("svelte").Component<CardProps, {}, "">;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
-
import type
|
|
3
|
-
import { tv } from 'tailwind-variants';
|
|
2
|
+
import { tv, type ClassValue } from 'tailwind-variants';
|
|
4
3
|
import type { Component, Snippet } from 'svelte';
|
|
5
4
|
import { type PropColor, isComponent, isSnippet, Checkbox } from '../index.js';
|
|
6
5
|
|
|
@@ -21,9 +20,9 @@
|
|
|
21
20
|
legend?: string | Snippet | Component;
|
|
22
21
|
orientation?: 'horizontal' | 'vertical';
|
|
23
22
|
ui?: {
|
|
24
|
-
root?:
|
|
25
|
-
container?:
|
|
26
|
-
checkbox?:
|
|
23
|
+
root?: ClassValue;
|
|
24
|
+
container?: ClassValue;
|
|
25
|
+
checkbox?: ClassValue;
|
|
27
26
|
};
|
|
28
27
|
};
|
|
29
28
|
</script>
|
|
@@ -44,7 +43,7 @@
|
|
|
44
43
|
...props
|
|
45
44
|
}: CheckboxGroupProps = $props();
|
|
46
45
|
|
|
47
|
-
const
|
|
46
|
+
const variants = $derived.by(() =>
|
|
48
47
|
tv({
|
|
49
48
|
slots: {
|
|
50
49
|
root: '',
|
|
@@ -96,10 +95,10 @@
|
|
|
96
95
|
},
|
|
97
96
|
variant: {
|
|
98
97
|
list: { container: 'gap-2' },
|
|
99
|
-
card: { container: 'gap-2', checkbox: 'p-4 rounded-lg border border-
|
|
98
|
+
card: { container: 'gap-2', checkbox: 'p-4 rounded-lg border border-surface-accented' },
|
|
100
99
|
table: {
|
|
101
100
|
container: 'gap-0 ',
|
|
102
|
-
checkbox: 'border border-
|
|
101
|
+
checkbox: 'border border-surface-accented p-4 data-[state=checked]:z-1',
|
|
103
102
|
},
|
|
104
103
|
},
|
|
105
104
|
orientation: {
|
|
@@ -128,7 +127,7 @@
|
|
|
128
127
|
selected: true,
|
|
129
128
|
variant: ['table', 'card'],
|
|
130
129
|
class: {
|
|
131
|
-
checkbox: 'border-
|
|
130
|
+
checkbox: 'border-label-muted',
|
|
132
131
|
},
|
|
133
132
|
},
|
|
134
133
|
{
|
|
@@ -177,7 +176,7 @@
|
|
|
177
176
|
selected: true,
|
|
178
177
|
variant: ['table'],
|
|
179
178
|
class: {
|
|
180
|
-
checkbox: 'bg-surface-
|
|
179
|
+
checkbox: 'bg-surface-elevated',
|
|
181
180
|
},
|
|
182
181
|
},
|
|
183
182
|
{
|
|
@@ -217,7 +216,7 @@
|
|
|
217
216
|
);
|
|
218
217
|
</script>
|
|
219
218
|
|
|
220
|
-
<div class={
|
|
219
|
+
<div class={variants.root({ class: [ui.root] })}>
|
|
221
220
|
{#if typeof legend === 'string'}
|
|
222
221
|
<legend>{legend}</legend>
|
|
223
222
|
{:else if isSnippet(legend)}
|
|
@@ -227,7 +226,7 @@
|
|
|
227
226
|
<Legend />
|
|
228
227
|
{/if}
|
|
229
228
|
|
|
230
|
-
<fieldset class={
|
|
229
|
+
<fieldset class={variants.container({ class: [ui.container] })}>
|
|
231
230
|
{#each items as item, index (index)}
|
|
232
231
|
{@const key = typeof item === 'object' ? item[valuekey] : item}
|
|
233
232
|
|
|
@@ -236,7 +235,7 @@
|
|
|
236
235
|
{color}
|
|
237
236
|
as={variant === 'list' ? 'div' : 'label'}
|
|
238
237
|
ui={{
|
|
239
|
-
root:
|
|
238
|
+
root: variants.checkbox({
|
|
240
239
|
class: [ui.checkbox],
|
|
241
240
|
selected: value.includes(key),
|
|
242
241
|
}),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ClassValue } from 'tailwind-variants';
|
|
2
2
|
import type { Component, Snippet } from 'svelte';
|
|
3
3
|
import { type PropColor } from '../index.js';
|
|
4
4
|
export type CheckboxGroupProps = {
|
|
@@ -16,9 +16,9 @@ export type CheckboxGroupProps = {
|
|
|
16
16
|
legend?: string | Snippet | Component;
|
|
17
17
|
orientation?: 'horizontal' | 'vertical';
|
|
18
18
|
ui?: {
|
|
19
|
-
root?:
|
|
20
|
-
container?:
|
|
21
|
-
checkbox?:
|
|
19
|
+
root?: ClassValue;
|
|
20
|
+
container?: ClassValue;
|
|
21
|
+
checkbox?: ClassValue;
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
24
|
declare const CheckboxGroup: Component<CheckboxGroupProps, {}, "value">;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import { 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 'vitest-browser-svelte';
|
|
7
6
|
|
|
8
7
|
export type CheckboxProps = {
|
|
@@ -18,11 +17,11 @@
|
|
|
18
17
|
indicator?: 'start' | 'end' | 'hidden';
|
|
19
18
|
as?: string;
|
|
20
19
|
ui?: {
|
|
21
|
-
root?:
|
|
22
|
-
container?:
|
|
23
|
-
icon?:
|
|
24
|
-
label?:
|
|
25
|
-
description?:
|
|
20
|
+
root?: ClassValue;
|
|
21
|
+
container?: ClassValue;
|
|
22
|
+
icon?: ClassValue;
|
|
23
|
+
label?: ClassValue;
|
|
24
|
+
description?: ClassValue;
|
|
26
25
|
};
|
|
27
26
|
};
|
|
28
27
|
</script>
|
|
@@ -40,89 +39,91 @@
|
|
|
40
39
|
required,
|
|
41
40
|
indicator = 'start',
|
|
42
41
|
as = 'div',
|
|
43
|
-
ui = {}
|
|
42
|
+
ui = {},
|
|
44
43
|
}: CheckboxProps = $props();
|
|
45
44
|
const id = $props.id();
|
|
46
45
|
|
|
47
|
-
const
|
|
46
|
+
const variants = $derived.by(() =>
|
|
48
47
|
tv({
|
|
49
48
|
slots: {
|
|
50
49
|
root: 'relative flex-inline gap-2',
|
|
51
50
|
container:
|
|
52
|
-
'rounded-md border border-
|
|
51
|
+
'rounded-md border border-surface-accented relative transition m-0.5 mr-0 grid place-items-center',
|
|
53
52
|
icon: 'pi text-white',
|
|
54
53
|
label: 'text-sm font-medium',
|
|
55
|
-
description: 'text-sm text-
|
|
54
|
+
description: 'text-sm text-label-muted',
|
|
56
55
|
},
|
|
57
56
|
variants: {
|
|
58
57
|
color: {
|
|
59
58
|
primary: {
|
|
60
|
-
container: [value && 'bg-primary-500 border-primary-500 text-primary-500']
|
|
59
|
+
container: [value && 'bg-primary-500 border-primary-500 text-primary-500'],
|
|
61
60
|
},
|
|
62
61
|
surface: {
|
|
63
|
-
container: [
|
|
62
|
+
container: [
|
|
63
|
+
value && 'bg-surface-inverted border-surface-inverted text-surface-inverted',
|
|
64
|
+
],
|
|
64
65
|
},
|
|
65
66
|
info: {
|
|
66
|
-
container: [value && 'bg-info-500 border-info-500 text-info-500']
|
|
67
|
+
container: [value && 'bg-info-500 border-info-500 text-info-500'],
|
|
67
68
|
},
|
|
68
69
|
success: {
|
|
69
|
-
container: [value && 'bg-success-500 border-success-500 text-success-500']
|
|
70
|
+
container: [value && 'bg-success-500 border-success-500 text-success-500'],
|
|
70
71
|
},
|
|
71
72
|
warning: {
|
|
72
|
-
container: [value && 'bg-warning-500 border-warning-500 text-warning-500']
|
|
73
|
+
container: [value && 'bg-warning-500 border-warning-500 text-warning-500'],
|
|
73
74
|
},
|
|
74
75
|
error: {
|
|
75
|
-
container: [value && 'bg-error-500 border-error-500 text-error-500']
|
|
76
|
-
}
|
|
76
|
+
container: [value && 'bg-error-500 border-error-500 text-error-500'],
|
|
77
|
+
},
|
|
77
78
|
},
|
|
78
79
|
size: {
|
|
79
80
|
xs: {
|
|
80
81
|
container: 'size-3',
|
|
81
|
-
icon: 'size-3'
|
|
82
|
+
icon: 'size-3',
|
|
82
83
|
},
|
|
83
84
|
sm: {
|
|
84
85
|
container: 'size-3.5',
|
|
85
|
-
icon: 'size-3.5'
|
|
86
|
+
icon: 'size-3.5',
|
|
86
87
|
},
|
|
87
88
|
md: {
|
|
88
89
|
container: 'size-4',
|
|
89
|
-
icon: 'size-4'
|
|
90
|
+
icon: 'size-4',
|
|
90
91
|
},
|
|
91
92
|
lg: {
|
|
92
93
|
container: 'size-4.5',
|
|
93
|
-
icon: 'size-4.5'
|
|
94
|
+
icon: 'size-4.5',
|
|
94
95
|
},
|
|
95
96
|
xl: {
|
|
96
97
|
container: 'size-5',
|
|
97
|
-
icon: 'size-5'
|
|
98
|
-
}
|
|
98
|
+
icon: 'size-5',
|
|
99
|
+
},
|
|
99
100
|
},
|
|
100
101
|
indicator: {
|
|
101
102
|
start: '',
|
|
102
103
|
end: {
|
|
103
|
-
root: 'flex-row-reverse'
|
|
104
|
+
root: 'flex-row-reverse',
|
|
104
105
|
},
|
|
105
106
|
hidden: {
|
|
106
|
-
container: 'hidden'
|
|
107
|
-
}
|
|
108
|
-
}
|
|
107
|
+
container: 'hidden',
|
|
108
|
+
},
|
|
109
|
+
},
|
|
109
110
|
},
|
|
110
|
-
compoundVariants: []
|
|
111
|
-
})({ color, size, indicator })
|
|
111
|
+
compoundVariants: [],
|
|
112
|
+
})({ color, size, indicator }),
|
|
112
113
|
);
|
|
113
114
|
</script>
|
|
114
115
|
|
|
115
116
|
<svelte:element
|
|
116
117
|
this={as}
|
|
117
118
|
data-state={value ? 'checked' : 'unchecked'}
|
|
118
|
-
class={
|
|
119
|
-
class: [disabled && 'opacity-50', ui.root]
|
|
119
|
+
class={variants.root({
|
|
120
|
+
class: [disabled && 'opacity-50', ui.root],
|
|
120
121
|
})}
|
|
121
122
|
>
|
|
122
123
|
<button
|
|
123
124
|
{id}
|
|
124
125
|
aria-label="checkbox"
|
|
125
|
-
class={
|
|
126
|
+
class={variants.container({ class: [ui.container] })}
|
|
126
127
|
onclick={() => {
|
|
127
128
|
if (disabled) return;
|
|
128
129
|
if (value === 'intermediate') return (value = true);
|
|
@@ -137,8 +138,8 @@
|
|
|
137
138
|
<div class="flex flex-col justify-start">
|
|
138
139
|
<label
|
|
139
140
|
for={id}
|
|
140
|
-
class={
|
|
141
|
-
class: [required ? 'after:content-["*"] after:text-error-500' : '', ui.label]
|
|
141
|
+
class={variants.label({
|
|
142
|
+
class: [required ? 'after:content-["*"] after:text-error-500' : '', ui.label],
|
|
142
143
|
})}
|
|
143
144
|
>
|
|
144
145
|
{#if typeof label === 'string'}
|
|
@@ -149,7 +150,7 @@
|
|
|
149
150
|
</label>
|
|
150
151
|
|
|
151
152
|
{#if description}
|
|
152
|
-
<div class={
|
|
153
|
+
<div class={variants.description({ class: ui.description })}>
|
|
153
154
|
{#if typeof description === 'string'}
|
|
154
155
|
{description}
|
|
155
156
|
{:else}
|
|
@@ -161,10 +162,10 @@
|
|
|
161
162
|
{/if}
|
|
162
163
|
</svelte:element>
|
|
163
164
|
|
|
164
|
-
{#snippet Icon(ico?: CheckboxProps['icon'], icon_class?:
|
|
165
|
+
{#snippet Icon(ico?: CheckboxProps['icon'], icon_class?: ClassValue)}
|
|
165
166
|
<div class={['absolute', icon_class]}>
|
|
166
167
|
{#if typeof ico === 'string'}
|
|
167
|
-
<div class={
|
|
168
|
+
<div class={variants.icon({ class: [ico, ui.icon] })}></div>
|
|
168
169
|
{:else if isSnippet(ico)}
|
|
169
170
|
{@render ico()}
|
|
170
171
|
{:else if isComponent(ico)}
|
|
@@ -1,6 +1,6 @@
|
|
|
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 'vitest-browser-svelte';
|
|
5
5
|
export type CheckboxProps = {
|
|
6
6
|
value?: boolean | 'intermediate';
|
|
@@ -15,11 +15,11 @@ export type CheckboxProps = {
|
|
|
15
15
|
indicator?: 'start' | 'end' | 'hidden';
|
|
16
16
|
as?: string;
|
|
17
17
|
ui?: {
|
|
18
|
-
root?:
|
|
19
|
-
container?:
|
|
20
|
-
icon?:
|
|
21
|
-
label?:
|
|
22
|
-
description?:
|
|
18
|
+
root?: ClassValue;
|
|
19
|
+
container?: ClassValue;
|
|
20
|
+
icon?: ClassValue;
|
|
21
|
+
label?: ClassValue;
|
|
22
|
+
description?: ClassValue;
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
25
|
declare const Checkbox: import("svelte").Component<CheckboxProps, {}, "value">;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import type { PropColor } 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
|
|
|
7
6
|
export type ChipProps = {
|
|
8
7
|
children: Snippet;
|
|
@@ -11,8 +10,8 @@
|
|
|
11
10
|
position?: 'top-left' | 'top-right' | 'bottom-right' | 'bottom-left';
|
|
12
11
|
size?: number;
|
|
13
12
|
ui?: {
|
|
14
|
-
base?:
|
|
15
|
-
chip?:
|
|
13
|
+
base?: ClassValue;
|
|
14
|
+
chip?: ClassValue;
|
|
16
15
|
};
|
|
17
16
|
};
|
|
18
17
|
</script>
|
|
@@ -24,55 +23,55 @@
|
|
|
24
23
|
color = 'primary',
|
|
25
24
|
position = 'top-right',
|
|
26
25
|
size = 8,
|
|
27
|
-
ui = {}
|
|
26
|
+
ui = {},
|
|
28
27
|
}: ChipProps = $props();
|
|
29
28
|
|
|
30
|
-
const
|
|
29
|
+
const variants = $derived.by(() =>
|
|
31
30
|
tv({
|
|
32
31
|
slots: {
|
|
33
32
|
base: 'relative inline-flex items-center justify-center shrink-0',
|
|
34
33
|
chip: [
|
|
35
|
-
'absolute rounded-full ring ring-
|
|
36
|
-
'-translate-y-1/2 translate-x-1/2 px-0.5'
|
|
37
|
-
]
|
|
34
|
+
'absolute rounded-full ring ring-inverted flex items-center justify-center text-label-inverted font-medium whitespace-nowrap',
|
|
35
|
+
'-translate-y-1/2 translate-x-1/2 px-0.5',
|
|
36
|
+
],
|
|
38
37
|
},
|
|
39
38
|
variants: {
|
|
40
39
|
color: {
|
|
41
40
|
primary: {
|
|
42
|
-
chip: 'bg-primary'
|
|
41
|
+
chip: 'bg-primary',
|
|
43
42
|
},
|
|
44
43
|
surface: {
|
|
45
|
-
chip: 'bg-surface'
|
|
44
|
+
chip: 'bg-surface',
|
|
46
45
|
},
|
|
47
46
|
success: {
|
|
48
|
-
chip: 'bg-success'
|
|
47
|
+
chip: 'bg-success',
|
|
49
48
|
},
|
|
50
49
|
info: {
|
|
51
|
-
chip: 'bg-info'
|
|
50
|
+
chip: 'bg-info',
|
|
52
51
|
},
|
|
53
52
|
warning: {
|
|
54
|
-
chip: 'bg-warning'
|
|
53
|
+
chip: 'bg-warning',
|
|
55
54
|
},
|
|
56
55
|
error: {
|
|
57
|
-
chip: 'bg-error'
|
|
58
|
-
}
|
|
56
|
+
chip: 'bg-error',
|
|
57
|
+
},
|
|
59
58
|
},
|
|
60
59
|
position: {
|
|
61
60
|
'top-right': { chip: 'top-0 right-0' },
|
|
62
61
|
'bottom-right': { chip: 'bottom-0 right-0' },
|
|
63
62
|
'top-left': { chip: 'top-0 left-0' },
|
|
64
|
-
'bottom-left': { chip: 'bottom-0 left-0' }
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
})({ color, position })
|
|
63
|
+
'bottom-left': { chip: 'bottom-0 left-0' },
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
})({ color, position }),
|
|
68
67
|
);
|
|
69
68
|
</script>
|
|
70
69
|
|
|
71
|
-
<div class={
|
|
70
|
+
<div class={variants.base({ class: [ui.base] })}>
|
|
72
71
|
{@render children()}
|
|
73
72
|
|
|
74
73
|
<span
|
|
75
|
-
class={
|
|
74
|
+
class={variants.chip({ class: ui.chip })}
|
|
76
75
|
style:height="{size}px"
|
|
77
76
|
style:min-width="{size}px"
|
|
78
77
|
style:font-size="{size}px"
|
|
@@ -1,6 +1,6 @@
|
|
|
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
|
export type ChipProps = {
|
|
5
5
|
children: Snippet;
|
|
6
6
|
text?: string;
|
|
@@ -8,8 +8,8 @@ export type ChipProps = {
|
|
|
8
8
|
position?: 'top-left' | 'top-right' | 'bottom-right' | 'bottom-left';
|
|
9
9
|
size?: number;
|
|
10
10
|
ui?: {
|
|
11
|
-
base?:
|
|
12
|
-
chip?:
|
|
11
|
+
base?: ClassValue;
|
|
12
|
+
chip?: ClassValue;
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
15
|
declare const Chip: import("svelte").Component<ChipProps, {}, "">;
|
|
@@ -2,16 +2,15 @@
|
|
|
2
2
|
import { type ButtonProps, Button } from '../index.js';
|
|
3
3
|
import { Collapsible } from 'bits-ui';
|
|
4
4
|
import { defu } from 'defu';
|
|
5
|
-
import type
|
|
6
|
-
import { tv } from 'tailwind-variants';
|
|
5
|
+
import { tv, type ClassValue } from 'tailwind-variants';
|
|
7
6
|
|
|
8
7
|
export type CollapsibleProps = ButtonProps & {
|
|
9
8
|
open?: boolean;
|
|
10
9
|
disabled?: boolean;
|
|
11
|
-
class?:
|
|
10
|
+
class?: ClassValue;
|
|
12
11
|
ui?: {
|
|
13
|
-
root?:
|
|
14
|
-
content?:
|
|
12
|
+
root?: ClassValue;
|
|
13
|
+
content?: ClassValue;
|
|
15
14
|
};
|
|
16
15
|
};
|
|
17
16
|
</script>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { type ButtonProps } from '../index.js';
|
|
2
2
|
import { Collapsible } from 'bits-ui';
|
|
3
|
-
import type
|
|
3
|
+
import { type ClassValue } from 'tailwind-variants';
|
|
4
4
|
export type CollapsibleProps = ButtonProps & {
|
|
5
5
|
open?: boolean;
|
|
6
6
|
disabled?: boolean;
|
|
7
|
-
class?:
|
|
7
|
+
class?: ClassValue;
|
|
8
8
|
ui?: {
|
|
9
|
-
root?:
|
|
10
|
-
content?:
|
|
9
|
+
root?: ClassValue;
|
|
10
|
+
content?: ClassValue;
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
declare const Collapsible: import("svelte").Component<CollapsibleProps, {}, "open">;
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
3
3
|
import { cn } from 'tailwind-variants';
|
|
4
4
|
const { children, class: classes, ...rest }: SvelteHTMLElements['h1'] = $props();
|
|
5
|
+
|
|
6
|
+
const classname = $derived(
|
|
7
|
+
cn(
|
|
8
|
+
'text-4xl font-bold mb-8 scroll-mt-[calc(45px+var(--ui-header-height))] lg:scroll-mt-(--ui-header-height)',
|
|
9
|
+
classes,
|
|
10
|
+
),
|
|
11
|
+
);
|
|
5
12
|
</script>
|
|
6
13
|
|
|
7
|
-
<h1
|
|
8
|
-
{...rest}
|
|
9
|
-
class={cn(
|
|
10
|
-
'text-4xl font-bold mb-8 scroll-mt-[calc(45px+var(--ui-header-height))] lg:scroll-mt-(--ui-header-height)',
|
|
11
|
-
classes,
|
|
12
|
-
)}
|
|
13
|
-
>
|
|
14
|
+
<h1 {...rest} class={classname}>
|
|
14
15
|
{@render children?.()}
|
|
15
16
|
</h1>
|
|
@@ -2,18 +2,19 @@
|
|
|
2
2
|
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
3
3
|
import { cn } from 'tailwind-variants';
|
|
4
4
|
const { children, class: classes, ...rest }: SvelteHTMLElements['h2'] = $props();
|
|
5
|
+
|
|
6
|
+
const classname = $derived(
|
|
7
|
+
cn(
|
|
8
|
+
'relative text-2xl text-label-highlighted font-bold mt-12 mb-6',
|
|
9
|
+
'scroll-mt-[calc(48px+45px+var(--ui-header-height))] lg:scroll-mt-[calc(48px+var(--ui-header-height))]',
|
|
10
|
+
'[&>a]:focus-visible:outline-primary',
|
|
11
|
+
'[&>a>code]:transition-colors [&>a>code]:border-dashed [&>a>code]:font-bold [&>a>code]:text-xl/7',
|
|
12
|
+
'hover:[&>a>code]:border-primary hover:[&>a>code]:text-primary',
|
|
13
|
+
classes,
|
|
14
|
+
),
|
|
15
|
+
);
|
|
5
16
|
</script>
|
|
6
17
|
|
|
7
|
-
<h2
|
|
8
|
-
{...rest}
|
|
9
|
-
class={cn(
|
|
10
|
-
'relative text-2xl text-highlighted font-bold mt-12 mb-6',
|
|
11
|
-
'scroll-mt-[calc(48px+45px+var(--ui-header-height))] lg:scroll-mt-[calc(48px+var(--ui-header-height))]',
|
|
12
|
-
'[&>a]:focus-visible:outline-primary',
|
|
13
|
-
'[&>a>code]:transition-colors [&>a>code]:border-dashed [&>a>code]:font-bold [&>a>code]:text-xl/7',
|
|
14
|
-
'hover:[&>a>code]:border-primary hover:[&>a>code]:text-primary',
|
|
15
|
-
classes,
|
|
16
|
-
)}
|
|
17
|
-
>
|
|
18
|
+
<h2 {...rest} class={classname}>
|
|
18
19
|
{@render children?.()}
|
|
19
20
|
</h2>
|
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
3
3
|
import { cn } from 'tailwind-variants';
|
|
4
4
|
const { children, class: classes, ...rest }: SvelteHTMLElements['h3'] = $props();
|
|
5
|
+
|
|
6
|
+
const classname = $derived(
|
|
7
|
+
cn(
|
|
8
|
+
'relative text-xl text-label-highlighted font-bold mt-8 mb-3 scroll-mt-[calc(32px+45px+var(--ui-header-height))] lg:scroll-mt-[calc(32px+var(--ui-header-height))] [&>a]:focus-visible:outline-primary [&>a>code]:border-dashed hover:[&>a>code]:border-primary hover:[&>a>code]:text-primary [&>a>code]:text-lg/6 [&>a>code]:font-bold',
|
|
9
|
+
'[&>a>code]:transition-colors',
|
|
10
|
+
classes,
|
|
11
|
+
),
|
|
12
|
+
);
|
|
5
13
|
</script>
|
|
6
14
|
|
|
7
|
-
<h3
|
|
8
|
-
{...rest}
|
|
9
|
-
class={cn(
|
|
10
|
-
'relative text-xl text-highlighted font-bold mt-8 mb-3 scroll-mt-[calc(32px+45px+var(--ui-header-height))] lg:scroll-mt-[calc(32px+var(--ui-header-height))] [&>a]:focus-visible:outline-primary [&>a>code]:border-dashed hover:[&>a>code]:border-primary hover:[&>a>code]:text-primary [&>a>code]:text-lg/6 [&>a>code]:font-bold',
|
|
11
|
-
'[&>a>code]:transition-colors',
|
|
12
|
-
classes,
|
|
13
|
-
)}
|
|
14
|
-
>
|
|
15
|
+
<h3 {...rest} class={classname}>
|
|
15
16
|
{@render children?.()}
|
|
16
17
|
</h3>
|