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,99 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Component, Snippet } from 'svelte';
|
|
3
|
+
import { tv } from 'tailwind-variants';
|
|
4
|
+
import { type PropColor, type PropVariant, isSnippet } from '../index.js';
|
|
5
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
6
|
+
import { type DateValue, today } from '../date.js';
|
|
7
|
+
import { Calendar, type CalendarRootProps } from 'bits-ui';
|
|
8
|
+
|
|
9
|
+
export type CalendarProps = CalendarRootProps & {
|
|
10
|
+
color?: PropColor;
|
|
11
|
+
variant?: Exclude<PropVariant, 'none' | 'ghost'>;
|
|
12
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
13
|
+
ui?: {
|
|
14
|
+
base?: ClassNameValue;
|
|
15
|
+
icon?: ClassNameValue;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
let {
|
|
22
|
+
type,
|
|
23
|
+
value = $bindable(),
|
|
24
|
+
label,
|
|
25
|
+
trailingicon,
|
|
26
|
+
color = 'primary',
|
|
27
|
+
size = 'md',
|
|
28
|
+
variant = 'solid',
|
|
29
|
+
ui = {},
|
|
30
|
+
children,
|
|
31
|
+
}: CalendarProps = $props();
|
|
32
|
+
|
|
33
|
+
const classes = $derived.by(() => {
|
|
34
|
+
return tv({
|
|
35
|
+
slots: { icon: '', base: '' },
|
|
36
|
+
variants: {
|
|
37
|
+
color: {
|
|
38
|
+
primary: '',
|
|
39
|
+
surface: '',
|
|
40
|
+
error: '',
|
|
41
|
+
success: '',
|
|
42
|
+
info: '',
|
|
43
|
+
warning: '',
|
|
44
|
+
},
|
|
45
|
+
variant: {
|
|
46
|
+
link: '',
|
|
47
|
+
solid: '',
|
|
48
|
+
outline: '',
|
|
49
|
+
soft: '',
|
|
50
|
+
subtle: '',
|
|
51
|
+
ghost: '',
|
|
52
|
+
},
|
|
53
|
+
size: {
|
|
54
|
+
xs: {},
|
|
55
|
+
sm: {},
|
|
56
|
+
md: {},
|
|
57
|
+
lg: {},
|
|
58
|
+
xl: {},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
compoundVariants: [],
|
|
62
|
+
})({ variant, size, color });
|
|
63
|
+
});
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
<Calendar.Root type={type as typeof type} bind:value>
|
|
67
|
+
{#snippet children({ months, weekdays })}
|
|
68
|
+
<Calendar.Header>
|
|
69
|
+
<Calendar.PrevButton />
|
|
70
|
+
<Calendar.Heading />
|
|
71
|
+
<Calendar.NextButton />
|
|
72
|
+
</Calendar.Header>
|
|
73
|
+
|
|
74
|
+
{#each months as month}
|
|
75
|
+
<Calendar.Grid>
|
|
76
|
+
<Calendar.GridHead>
|
|
77
|
+
<Calendar.GridRow>
|
|
78
|
+
{#each weekdays as day, idx (idx)}
|
|
79
|
+
<Calendar.HeadCell>
|
|
80
|
+
{day}
|
|
81
|
+
</Calendar.HeadCell>
|
|
82
|
+
{/each}
|
|
83
|
+
</Calendar.GridRow>
|
|
84
|
+
</Calendar.GridHead>
|
|
85
|
+
<Calendar.GridBody>
|
|
86
|
+
{#each month.weeks as weekDates, wdidx (wdidx)}
|
|
87
|
+
<Calendar.GridRow>
|
|
88
|
+
{#each weekDates as date, didx (didx)}
|
|
89
|
+
<Calendar.Cell {date} month={month.value}>
|
|
90
|
+
<Calendar.Day />
|
|
91
|
+
</Calendar.Cell>
|
|
92
|
+
{/each}
|
|
93
|
+
</Calendar.GridRow>
|
|
94
|
+
{/each}
|
|
95
|
+
</Calendar.GridBody>
|
|
96
|
+
</Calendar.Grid>
|
|
97
|
+
{/each}
|
|
98
|
+
{/snippet}
|
|
99
|
+
</Calendar.Root>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Component } from 'svelte';
|
|
2
|
+
import { type PropColor, type PropVariant } from '../index.js';
|
|
3
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
+
import { Calendar, type CalendarRootProps } from 'bits-ui';
|
|
5
|
+
export type CalendarProps = CalendarRootProps & {
|
|
6
|
+
color?: PropColor;
|
|
7
|
+
variant?: Exclude<PropVariant, 'none' | 'ghost'>;
|
|
8
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
|
+
ui?: {
|
|
10
|
+
base?: ClassNameValue;
|
|
11
|
+
icon?: ClassNameValue;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
declare const Calendar: Component<CalendarProps, {}, "value">;
|
|
15
|
+
type Calendar = ReturnType<typeof Calendar>;
|
|
16
|
+
export default Calendar;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
+
import type { PropVariant } from '../index.js';
|
|
2
3
|
import type { Snippet } from 'svelte';
|
|
3
4
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
5
|
import { tv } from 'tailwind-variants';
|
|
@@ -7,7 +8,7 @@
|
|
|
7
8
|
children: Snippet;
|
|
8
9
|
header?: Snippet;
|
|
9
10
|
footer?: Snippet;
|
|
10
|
-
variant?:
|
|
11
|
+
variant?: Exclude<PropVariant, 'none' | 'ghost'>;
|
|
11
12
|
ui?: {
|
|
12
13
|
base?: ClassNameValue;
|
|
13
14
|
header?: ClassNameValue;
|
|
@@ -26,28 +27,28 @@
|
|
|
26
27
|
base: 'rounded overflow-hidden',
|
|
27
28
|
header: 'p-4 sm:px-6',
|
|
28
29
|
content: 'p-4 sm:p-6',
|
|
29
|
-
footer: 'p-4 sm:px-6'
|
|
30
|
+
footer: 'p-4 sm:px-6',
|
|
30
31
|
},
|
|
31
32
|
variants: {
|
|
32
33
|
variant: {
|
|
33
34
|
solid: {
|
|
34
35
|
base: 'bg-surface-900 text-surface-50',
|
|
35
36
|
header: 'border-transparent',
|
|
36
|
-
footer: 'border-transparent'
|
|
37
|
+
footer: 'border-transparent',
|
|
37
38
|
},
|
|
38
39
|
outline: {
|
|
39
|
-
base: 'border border-surface-300 divide-y divide-surface-300'
|
|
40
|
+
base: 'border border-surface-300 divide-y divide-surface-300',
|
|
40
41
|
},
|
|
41
42
|
soft: {
|
|
42
|
-
base: 'bg-surface-50 divide-y divide-surface-300'
|
|
43
|
+
base: 'bg-surface-50 divide-y divide-surface-300',
|
|
43
44
|
},
|
|
44
45
|
subtle: {
|
|
45
|
-
base: 'bg-surface-50 border-surface-300 border divide-y divide-surface-300'
|
|
46
|
-
}
|
|
47
|
-
}
|
|
46
|
+
base: 'bg-surface-50 border-surface-300 border divide-y divide-surface-300',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
48
49
|
},
|
|
49
|
-
compoundVariants: []
|
|
50
|
-
})({ variant })
|
|
50
|
+
compoundVariants: [],
|
|
51
|
+
})({ variant }),
|
|
51
52
|
);
|
|
52
53
|
</script>
|
|
53
54
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { PropVariant } from '../index.js';
|
|
1
2
|
import type { Snippet } from 'svelte';
|
|
2
3
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
3
4
|
export type CardProps = {
|
|
4
5
|
children: Snippet;
|
|
5
6
|
header?: Snippet;
|
|
6
7
|
footer?: Snippet;
|
|
7
|
-
variant?:
|
|
8
|
+
variant?: Exclude<PropVariant, 'none' | 'ghost'>;
|
|
8
9
|
ui?: {
|
|
9
10
|
base?: ClassNameValue;
|
|
10
11
|
header?: ClassNameValue;
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
horizontal: {
|
|
107
107
|
container: 'flex-row',
|
|
108
108
|
checkbox:
|
|
109
|
-
'[&:not(:last-child)]
|
|
109
|
+
'[&:not(:last-child)]:-me-px [&:not(:last-child)]:ms-0 first-of-type:rounded-s-lg last-of-type:rounded-e-lg',
|
|
110
110
|
},
|
|
111
111
|
vertical: {
|
|
112
112
|
container: 'flex-col -space-y-px',
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { type ButtonProps, Button } from '../index.js';
|
|
3
|
+
import { Collapsible } from 'bits-ui';
|
|
4
|
+
import { defu } from 'defu';
|
|
5
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
6
|
+
import { tv } from 'tailwind-variants';
|
|
7
|
+
|
|
8
|
+
export type CollapsibleProps = ButtonProps & {
|
|
9
|
+
open?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
class?: ClassNameValue;
|
|
12
|
+
ui?: {
|
|
13
|
+
root?: ClassNameValue;
|
|
14
|
+
content?: ClassNameValue;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<script lang="ts">
|
|
20
|
+
let {
|
|
21
|
+
open = $bindable(false),
|
|
22
|
+
children,
|
|
23
|
+
ui = {},
|
|
24
|
+
class: root_class,
|
|
25
|
+
...rest
|
|
26
|
+
}: CollapsibleProps = $props();
|
|
27
|
+
|
|
28
|
+
const variants = $derived(
|
|
29
|
+
tv({
|
|
30
|
+
slots: {
|
|
31
|
+
root: 'flex flex-col gap-2',
|
|
32
|
+
content:
|
|
33
|
+
'data-[state=open]:animate-[collapsible-down_200ms_ease-out] data-[state=closed]:animate-[collapsible-up_200ms_ease-out] space-y-2 overflow-hidden font-mono text-[15px] tracking-[0.01em] transition-all',
|
|
34
|
+
},
|
|
35
|
+
})(),
|
|
36
|
+
);
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<Collapsible.Root bind:open class={variants.root({ class: [root_class, ui.root] })}>
|
|
40
|
+
<Collapsible.Trigger>
|
|
41
|
+
{#snippet child({ props })}
|
|
42
|
+
<Button
|
|
43
|
+
{...props}
|
|
44
|
+
trailingicon="i-lucide-chevron-down"
|
|
45
|
+
{...rest}
|
|
46
|
+
block
|
|
47
|
+
ui={defu(ui, { trailingicon: 'ms-auto' })}
|
|
48
|
+
/>
|
|
49
|
+
{/snippet}
|
|
50
|
+
</Collapsible.Trigger>
|
|
51
|
+
<Collapsible.Content class={variants.content({ class: ui.content })}>
|
|
52
|
+
{@render children?.()}
|
|
53
|
+
</Collapsible.Content>
|
|
54
|
+
</Collapsible.Root>
|
|
55
|
+
|
|
56
|
+
<style>
|
|
57
|
+
:global {
|
|
58
|
+
@keyframes collapsible-down {
|
|
59
|
+
from {
|
|
60
|
+
height: 0;
|
|
61
|
+
}
|
|
62
|
+
to {
|
|
63
|
+
height: var(--bits-collapsible-content-height);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@keyframes collapsible-up {
|
|
68
|
+
from {
|
|
69
|
+
height: var(--bits-collapsible-content-height);
|
|
70
|
+
}
|
|
71
|
+
to {
|
|
72
|
+
height: 0;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ButtonProps } from '../index.js';
|
|
2
|
+
import { Collapsible } from 'bits-ui';
|
|
3
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
+
export type CollapsibleProps = ButtonProps & {
|
|
5
|
+
open?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
class?: ClassNameValue;
|
|
8
|
+
ui?: {
|
|
9
|
+
root?: ClassNameValue;
|
|
10
|
+
content?: ClassNameValue;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
declare const Collapsible: import("svelte").Component<CollapsibleProps, {}, "open">;
|
|
14
|
+
type Collapsible = ReturnType<typeof Collapsible>;
|
|
15
|
+
export default Collapsible;
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
class={cn(
|
|
10
10
|
'relative text-2xl text-highlighted font-bold mt-12 mb-6',
|
|
11
11
|
'scroll-mt-[calc(48px+45px+var(--ui-header-height))] lg:scroll-mt-[calc(48px+var(--ui-header-height))]',
|
|
12
|
-
'[&>a]:
|
|
13
|
-
'[&>a>code]:
|
|
14
|
-
'hover:[&>a>code]:
|
|
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
15
|
classes,
|
|
16
16
|
)}
|
|
17
17
|
>
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
class={cn(
|
|
10
10
|
'relative text-2xl text-highlighted font-bold mt-12 mb-6',
|
|
11
11
|
'scroll-mt-[calc(48px+45px+var(--ui-header-height))] lg:scroll-mt-[calc(48px+var(--ui-header-height))]',
|
|
12
|
-
'hover:[&>a>code]:
|
|
13
|
-
'[&>a>code]:
|
|
12
|
+
'hover:[&>a>code]:border-primary hover:[&>a>code]:text-primary',
|
|
13
|
+
'[&>a>code]:transition-colors [&>a>code]:text-xl/7 [&>a>code]:font-bold [&>a>code]:border-dashed',
|
|
14
14
|
'[&>a]:focus-visible:outline-primary',
|
|
15
15
|
classes,
|
|
16
16
|
)}
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
class={cn(
|
|
10
10
|
'relative text-2xl text-highlighted font-bold mt-12 mb-6',
|
|
11
11
|
'scroll-mt-[calc(48px+45px+var(--ui-header-height))] lg:scroll-mt-[calc(48px+var(--ui-header-height))]',
|
|
12
|
-
'hover:[&>a>code]:
|
|
13
|
-
'[&>a>code]:
|
|
12
|
+
'hover:[&>a>code]:border-primary hover:[&>a>code]:text-primary',
|
|
13
|
+
'[&>a>code]:transition-colors [&>a>code]:text-xl/7 [&>a>code]:font-bold [&>a>code]:border-dashed',
|
|
14
14
|
'[&>a]:focus-visible:outline-primary',
|
|
15
15
|
classes,
|
|
16
16
|
)}
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
class={cn(
|
|
10
10
|
'relative text-2xl text-highlighted font-bold mt-12 mb-6',
|
|
11
11
|
'scroll-mt-[calc(48px+45px+var(--ui-header-height))] lg:scroll-mt-[calc(48px+var(--ui-header-height))]',
|
|
12
|
-
'hover:[&>a>code]:
|
|
13
|
-
'[&>a>code]:
|
|
12
|
+
'hover:[&>a>code]:border-primary hover:[&>a>code]:text-primary',
|
|
13
|
+
'[&>a>code]:transition-colors [&>a>code]:text-xl/7 [&>a>code]:font-bold [&>a>code]:border-dashed',
|
|
14
14
|
'[&>a]:focus-visible:outline-primary',
|
|
15
15
|
classes,
|
|
16
16
|
)}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
3
|
+
import type { Component } from 'svelte';
|
|
4
|
+
import { useStyle, isComponent } from '../index.js';
|
|
5
|
+
import { useDebounce, watch } from 'runed';
|
|
6
|
+
|
|
7
|
+
export type IconProps = SvelteHTMLElements['base'] & {
|
|
8
|
+
name?: string | Component;
|
|
9
|
+
};
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<script lang="ts">
|
|
13
|
+
let { class: classname, name, ...rest }: IconProps = $props();
|
|
14
|
+
|
|
15
|
+
let css_style = $state('');
|
|
16
|
+
|
|
17
|
+
const resolve = useDebounce(async () => {
|
|
18
|
+
if (typeof name !== 'string') return (css_style = '');
|
|
19
|
+
const url = `https://api.iconify.design/${name.replace(/^i-/, '')}.svg`;
|
|
20
|
+
let svg = await (await fetch(url)).text();
|
|
21
|
+
if (svg === 'Not found') return (css_style = '');
|
|
22
|
+
css_style = `@layer components {
|
|
23
|
+
.${name.replace(':', '\\:')} {
|
|
24
|
+
--un-icon: url('data:image/svg+xml,${svg
|
|
25
|
+
.replaceAll(/[\n\t]/g, '')
|
|
26
|
+
.replaceAll('"', '\"')
|
|
27
|
+
.replace('<', '%3C')
|
|
28
|
+
.replace('>', '%3E')}');
|
|
29
|
+
display: inline-block;
|
|
30
|
+
width: 1em;
|
|
31
|
+
height: 1em;
|
|
32
|
+
background-color: currentColor;
|
|
33
|
+
-webkit-mask-image: var(--un-icon);
|
|
34
|
+
mask-image: var(--un-icon);
|
|
35
|
+
-webkit-mask-repeat: no-repeat;
|
|
36
|
+
mask-repeat: no-repeat;
|
|
37
|
+
-webkit-mask-size: 100% 100%;
|
|
38
|
+
mask-size: 100% 100%;
|
|
39
|
+
}
|
|
40
|
+
}`;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
watch(
|
|
44
|
+
() => name,
|
|
45
|
+
() => {
|
|
46
|
+
resolve();
|
|
47
|
+
},
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
useStyle(() => css_style);
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
{#if typeof name === 'string' && name.length > 0}
|
|
54
|
+
<div {...rest as SvelteHTMLElements['div']} class={[name, classname]}></div>
|
|
55
|
+
{:else if isComponent(name)}
|
|
56
|
+
{@const Icon = name}
|
|
57
|
+
<Icon {...rest} />
|
|
58
|
+
{/if}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
2
|
+
import type { Component } from 'svelte';
|
|
3
|
+
export type IconProps = SvelteHTMLElements['base'] & {
|
|
4
|
+
name?: string | Component;
|
|
5
|
+
};
|
|
6
|
+
declare const Icon: Component<IconProps, {}, "">;
|
|
7
|
+
type Icon = ReturnType<typeof Icon>;
|
|
8
|
+
export default Icon;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * from './button.svelte';
|
|
2
2
|
export { default as Button } from './button.svelte';
|
|
3
|
-
export * from './
|
|
3
|
+
export * from './input.svelte';
|
|
4
4
|
export { default as Input } from './input.svelte';
|
|
5
|
-
export * from './
|
|
5
|
+
export * from './input-time.svelte';
|
|
6
6
|
export { default as InputTime } from './input-time.svelte';
|
|
7
7
|
export * from './badge.svelte';
|
|
8
8
|
export { default as Badge } from './badge.svelte';
|
|
@@ -43,3 +43,15 @@ export * from './color-picker.svelte';
|
|
|
43
43
|
export { default as ColorPicker } from './color-picker.svelte';
|
|
44
44
|
export * from './select.svelte';
|
|
45
45
|
export { default as Select } from './select.svelte';
|
|
46
|
+
export * from './collapsible.svelte';
|
|
47
|
+
export { default as Collapsible } from './collapsible.svelte';
|
|
48
|
+
export * from './placeholder.svelte';
|
|
49
|
+
export { default as Placeholder } from './placeholder.svelte';
|
|
50
|
+
export * from './seperator.svelte';
|
|
51
|
+
export { default as Seperator } from './seperator.svelte';
|
|
52
|
+
export * from './icon.svelte';
|
|
53
|
+
export { default as Icon } from './icon.svelte';
|
|
54
|
+
export * from './breadcrumb.svelte';
|
|
55
|
+
export { default as Breadcrumb } from './breadcrumb.svelte';
|
|
56
|
+
export * from './input-number.svelte';
|
|
57
|
+
export { default as InputNumber } from './input-number.svelte';
|
package/dist/components/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * from './button.svelte';
|
|
2
2
|
export { default as Button } from './button.svelte';
|
|
3
|
-
export * from './
|
|
3
|
+
export * from './input.svelte';
|
|
4
4
|
export { default as Input } from './input.svelte';
|
|
5
|
-
export * from './
|
|
5
|
+
export * from './input-time.svelte';
|
|
6
6
|
export { default as InputTime } from './input-time.svelte';
|
|
7
7
|
export * from './badge.svelte';
|
|
8
8
|
export { default as Badge } from './badge.svelte';
|
|
@@ -43,3 +43,15 @@ export * from './color-picker.svelte';
|
|
|
43
43
|
export { default as ColorPicker } from './color-picker.svelte';
|
|
44
44
|
export * from './select.svelte';
|
|
45
45
|
export { default as Select } from './select.svelte';
|
|
46
|
+
export * from './collapsible.svelte';
|
|
47
|
+
export { default as Collapsible } from './collapsible.svelte';
|
|
48
|
+
export * from './placeholder.svelte';
|
|
49
|
+
export { default as Placeholder } from './placeholder.svelte';
|
|
50
|
+
export * from './seperator.svelte';
|
|
51
|
+
export { default as Seperator } from './seperator.svelte';
|
|
52
|
+
export * from './icon.svelte';
|
|
53
|
+
export { default as Icon } from './icon.svelte';
|
|
54
|
+
export * from './breadcrumb.svelte';
|
|
55
|
+
export { default as Breadcrumb } from './breadcrumb.svelte';
|
|
56
|
+
export * from './input-number.svelte';
|
|
57
|
+
export { default as InputNumber } from './input-number.svelte';
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
type ButtonProps,
|
|
5
|
+
type PropColor,
|
|
6
|
+
type PropSize,
|
|
7
|
+
type PropVariant,
|
|
8
|
+
} from '../index.js';
|
|
9
|
+
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
10
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
11
|
+
import { tv } from 'tailwind-variants';
|
|
12
|
+
import Accordion from './accordion.svelte';
|
|
13
|
+
import { useId } from 'bits-ui';
|
|
14
|
+
|
|
15
|
+
export type InputNumberProps = Omit<SvelteHTMLElements['input'], 'size' | 'value'> & {
|
|
16
|
+
value?: number;
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
color?: PropColor;
|
|
19
|
+
variant?: Exclude<PropVariant, 'solid'>;
|
|
20
|
+
size?: PropSize;
|
|
21
|
+
highlight?: boolean;
|
|
22
|
+
fixed?: boolean;
|
|
23
|
+
orientation?: 'vertical' | 'horizontal';
|
|
24
|
+
increment?: boolean | Omit<ButtonProps, 'href'>;
|
|
25
|
+
decrement?: boolean | Omit<ButtonProps, 'href'>;
|
|
26
|
+
autofocus?: boolean | number;
|
|
27
|
+
min?: number;
|
|
28
|
+
max?: number;
|
|
29
|
+
step?: number;
|
|
30
|
+
stepsnapping?: number;
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
required?: boolean;
|
|
33
|
+
id?: string;
|
|
34
|
+
name?: string;
|
|
35
|
+
format?: Intl.NumberFormatOptions;
|
|
36
|
+
wheelchange?: boolean;
|
|
37
|
+
invertwheelchange?: boolean;
|
|
38
|
+
focusonchange?: boolean;
|
|
39
|
+
autocomplete?: 'on' | 'off' | string;
|
|
40
|
+
ui?: {
|
|
41
|
+
root?: ClassNameValue;
|
|
42
|
+
base?: ClassNameValue;
|
|
43
|
+
increment?: ClassNameValue;
|
|
44
|
+
decrement?: ClassNameValue;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<script lang="ts">
|
|
50
|
+
let {
|
|
51
|
+
value = $bindable(),
|
|
52
|
+
placeholder,
|
|
53
|
+
color = 'primary',
|
|
54
|
+
variant = 'outline',
|
|
55
|
+
size = 'md',
|
|
56
|
+
highlight,
|
|
57
|
+
fixed,
|
|
58
|
+
orientation = 'horizontal',
|
|
59
|
+
increment = true,
|
|
60
|
+
decrement = true,
|
|
61
|
+
autofocus,
|
|
62
|
+
min,
|
|
63
|
+
max,
|
|
64
|
+
step,
|
|
65
|
+
stepsnapping,
|
|
66
|
+
disabled,
|
|
67
|
+
required,
|
|
68
|
+
format,
|
|
69
|
+
wheelchange = true,
|
|
70
|
+
invertwheelchange,
|
|
71
|
+
focusonchange,
|
|
72
|
+
autocomplete,
|
|
73
|
+
ui = {},
|
|
74
|
+
...rest
|
|
75
|
+
}: InputNumberProps = $props();
|
|
76
|
+
const id = useId('uisv-in');
|
|
77
|
+
|
|
78
|
+
const variants = $derived(
|
|
79
|
+
tv({
|
|
80
|
+
slots: {
|
|
81
|
+
root: 'inline-flex relative items-center',
|
|
82
|
+
base: 'outline-none',
|
|
83
|
+
increment: '',
|
|
84
|
+
decrement: '',
|
|
85
|
+
},
|
|
86
|
+
variants: {
|
|
87
|
+
size: {
|
|
88
|
+
xs: {},
|
|
89
|
+
sm: {},
|
|
90
|
+
md: {},
|
|
91
|
+
lg: {},
|
|
92
|
+
xl: {},
|
|
93
|
+
},
|
|
94
|
+
variant: {
|
|
95
|
+
outline: {},
|
|
96
|
+
subtle: {},
|
|
97
|
+
soft: {},
|
|
98
|
+
ghost: {},
|
|
99
|
+
none: {},
|
|
100
|
+
},
|
|
101
|
+
color: {
|
|
102
|
+
primary: {},
|
|
103
|
+
surface: {},
|
|
104
|
+
info: {},
|
|
105
|
+
success: {},
|
|
106
|
+
warning: {},
|
|
107
|
+
error: {},
|
|
108
|
+
},
|
|
109
|
+
orientation: {
|
|
110
|
+
horizontal: {},
|
|
111
|
+
vertical: {},
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
compoundVariants: [
|
|
115
|
+
{
|
|
116
|
+
color: 'primary',
|
|
117
|
+
class: { base: 'bg-pimary-500' },
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
})({ color, size, orientation, variant }),
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
$effect(() => {
|
|
124
|
+
if (typeof value === 'string') value = parseInt(value) || undefined;
|
|
125
|
+
});
|
|
126
|
+
</script>
|
|
127
|
+
|
|
128
|
+
<div class={variants.root({ class: ui.root })}>
|
|
129
|
+
<input
|
|
130
|
+
{...rest}
|
|
131
|
+
{id}
|
|
132
|
+
tabindex="0"
|
|
133
|
+
bind:value
|
|
134
|
+
type="text"
|
|
135
|
+
inputmode="decimal"
|
|
136
|
+
{autocomplete}
|
|
137
|
+
autocorrect="off"
|
|
138
|
+
spellcheck="false"
|
|
139
|
+
{placeholder}
|
|
140
|
+
{max}
|
|
141
|
+
{min}
|
|
142
|
+
{step}
|
|
143
|
+
class={variants.base({ class: ui.base })}
|
|
144
|
+
/>
|
|
145
|
+
|
|
146
|
+
{#if orientation === 'horizontal'}
|
|
147
|
+
{@render crements()}
|
|
148
|
+
{:else}
|
|
149
|
+
<div class="flex flex-col position">
|
|
150
|
+
{@render crements()}
|
|
151
|
+
</div>
|
|
152
|
+
{/if}
|
|
153
|
+
</div>
|
|
154
|
+
|
|
155
|
+
{#snippet crements()}
|
|
156
|
+
{#if increment}
|
|
157
|
+
<Button
|
|
158
|
+
variant="link"
|
|
159
|
+
icon="i-lucide:minus"
|
|
160
|
+
onclick={() => {
|
|
161
|
+
value = value === undefined ? 0 : value - 1;
|
|
162
|
+
}}
|
|
163
|
+
/>
|
|
164
|
+
{/if}
|
|
165
|
+
|
|
166
|
+
{#if increment}
|
|
167
|
+
<Button
|
|
168
|
+
variant="link"
|
|
169
|
+
icon="i-lucide:plus"
|
|
170
|
+
onclick={() => {
|
|
171
|
+
value = value === undefined ? 0 : value + 1;
|
|
172
|
+
}}
|
|
173
|
+
/>
|
|
174
|
+
{/if}
|
|
175
|
+
{/snippet}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type ButtonProps, type PropColor, type PropSize, type PropVariant } from '../index.js';
|
|
2
|
+
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
3
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
+
export type InputNumberProps = Omit<SvelteHTMLElements['input'], 'size' | 'value'> & {
|
|
5
|
+
value?: number;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
color?: PropColor;
|
|
8
|
+
variant?: Exclude<PropVariant, 'solid'>;
|
|
9
|
+
size?: PropSize;
|
|
10
|
+
highlight?: boolean;
|
|
11
|
+
fixed?: boolean;
|
|
12
|
+
orientation?: 'vertical' | 'horizontal';
|
|
13
|
+
increment?: boolean | Omit<ButtonProps, 'href'>;
|
|
14
|
+
decrement?: boolean | Omit<ButtonProps, 'href'>;
|
|
15
|
+
autofocus?: boolean | number;
|
|
16
|
+
min?: number;
|
|
17
|
+
max?: number;
|
|
18
|
+
step?: number;
|
|
19
|
+
stepsnapping?: number;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
required?: boolean;
|
|
22
|
+
id?: string;
|
|
23
|
+
name?: string;
|
|
24
|
+
format?: Intl.NumberFormatOptions;
|
|
25
|
+
wheelchange?: boolean;
|
|
26
|
+
invertwheelchange?: boolean;
|
|
27
|
+
focusonchange?: boolean;
|
|
28
|
+
autocomplete?: 'on' | 'off' | string;
|
|
29
|
+
ui?: {
|
|
30
|
+
root?: ClassNameValue;
|
|
31
|
+
base?: ClassNameValue;
|
|
32
|
+
increment?: ClassNameValue;
|
|
33
|
+
decrement?: ClassNameValue;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
declare const InputNumber: import("svelte").Component<InputNumberProps, {}, "value">;
|
|
37
|
+
type InputNumber = ReturnType<typeof InputNumber>;
|
|
38
|
+
export default InputNumber;
|