uisv 0.0.12 → 0.0.14
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 +108 -0
- package/dist/components/accordion.svelte.d.ts +58 -0
- package/dist/components/alert.svelte +271 -0
- package/dist/components/alert.svelte.d.ts +23 -0
- package/dist/components/badge.svelte +225 -0
- package/dist/components/badge.svelte.d.ts +19 -0
- package/dist/components/banner.svelte +254 -0
- package/dist/components/banner.svelte.d.ts +23 -0
- package/dist/components/button.svelte +409 -0
- package/dist/components/button.svelte.d.ts +49 -0
- package/dist/components/card.svelte +70 -0
- package/dist/components/card.svelte.d.ts +17 -0
- package/dist/components/checkbox-group.svelte +258 -0
- package/dist/components/checkbox-group.svelte.d.ts +26 -0
- package/dist/components/checkbox.svelte +175 -0
- package/dist/components/checkbox.svelte.d.ts +27 -0
- package/dist/components/chip.svelte +82 -0
- package/dist/components/chip.svelte.d.ts +17 -0
- package/dist/components/color-picker.svelte +48 -0
- package/dist/components/color-picker.svelte.d.ts +10 -0
- package/dist/components/h1.svelte +15 -0
- package/dist/components/h1.svelte.d.ts +3 -0
- package/dist/components/h2.svelte +19 -0
- package/dist/components/h2.svelte.d.ts +3 -0
- package/dist/components/h3.svelte +16 -0
- package/dist/components/h3.svelte.d.ts +3 -0
- package/dist/components/h4.svelte +19 -0
- package/dist/components/h4.svelte.d.ts +3 -0
- package/dist/components/h5.svelte +19 -0
- package/dist/components/h5.svelte.d.ts +3 -0
- package/dist/components/h6.svelte +19 -0
- package/dist/components/h6.svelte.d.ts +3 -0
- package/dist/components/index.d.ts +45 -0
- package/dist/components/index.js +45 -0
- package/dist/components/input-time.svelte +234 -0
- package/dist/components/input-time.svelte.d.ts +54 -0
- package/dist/components/input.svelte +285 -0
- package/dist/components/input.svelte.d.ts +55 -0
- package/dist/components/kbd.svelte +239 -0
- package/dist/components/kbd.svelte.d.ts +40 -0
- package/dist/components/p.svelte +9 -0
- package/dist/components/p.svelte.d.ts +3 -0
- package/dist/components/pin-input.svelte +162 -0
- package/dist/components/pin-input.svelte.d.ts +25 -0
- package/dist/components/placeholder.svelte +34 -0
- package/dist/components/placeholder.svelte.d.ts +3 -0
- package/dist/components/popover.svelte +151 -0
- package/dist/components/popover.svelte.d.ts +88 -0
- package/dist/components/progress.svelte +124 -0
- package/dist/components/progress.svelte.d.ts +21 -0
- package/dist/components/select.svelte +171 -0
- package/dist/components/select.svelte.d.ts +50 -0
- package/dist/components/slider.svelte +172 -0
- package/dist/components/slider.svelte.d.ts +44 -0
- package/dist/components/switch.svelte +180 -0
- package/dist/components/switch.svelte.d.ts +27 -0
- package/dist/components/tabs.svelte +245 -0
- package/dist/components/tabs.svelte.d.ts +34 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -0
- package/dist/utilities.svelte.d.ts +24 -0
- package/dist/utilities.svelte.js +47 -0
- package/dist/vite.d.ts +52 -0
- package/dist/vite.js +132 -0
- package/package.json +35 -38
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PropColor } from '../index.js';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
+
export type ChipProps = {
|
|
5
|
+
children: Snippet;
|
|
6
|
+
text?: string;
|
|
7
|
+
color?: PropColor;
|
|
8
|
+
position?: 'top-left' | 'top-right' | 'bottom-right' | 'bottom-left';
|
|
9
|
+
size?: number;
|
|
10
|
+
ui?: {
|
|
11
|
+
base?: ClassNameValue;
|
|
12
|
+
chip?: ClassNameValue;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
declare const Chip: import("svelte").Component<ChipProps, {}, "">;
|
|
16
|
+
type Chip = ReturnType<typeof Chip>;
|
|
17
|
+
export default Chip;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { ColorTranslator } from 'colortranslator';
|
|
3
|
+
import { tv } from 'tailwind-variants';
|
|
4
|
+
|
|
5
|
+
export type ColorPickerProps = {
|
|
6
|
+
throttle?: number;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
value?: string;
|
|
9
|
+
format?: 'hex' | 'rgb' | 'hsl' | 'cmyk' | 'lab';
|
|
10
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
11
|
+
};
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
let {
|
|
16
|
+
throttle = 50,
|
|
17
|
+
disabled,
|
|
18
|
+
value = $bindable('#FFF'),
|
|
19
|
+
format = 'hex',
|
|
20
|
+
size = 'md',
|
|
21
|
+
}: ColorPickerProps = $props();
|
|
22
|
+
|
|
23
|
+
const translated = $derived(new ColorTranslator(value));
|
|
24
|
+
|
|
25
|
+
const classes = $derived(
|
|
26
|
+
tv({
|
|
27
|
+
slots: {
|
|
28
|
+
root: '',
|
|
29
|
+
picker: '',
|
|
30
|
+
select: '',
|
|
31
|
+
track: '',
|
|
32
|
+
thumb: '',
|
|
33
|
+
},
|
|
34
|
+
variants: {
|
|
35
|
+
size: {
|
|
36
|
+
xs: {},
|
|
37
|
+
sm: {},
|
|
38
|
+
md: {},
|
|
39
|
+
lg: {},
|
|
40
|
+
xl: {},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
})({ size }),
|
|
44
|
+
);
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<!-- linear-gradient(0deg,red,#f0f 17%,#00f 33%,#0ff,#0f0 67%,#ff0 83%,red) -->
|
|
48
|
+
<div></div>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type ColorPickerProps = {
|
|
2
|
+
throttle?: number;
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
value?: string;
|
|
5
|
+
format?: 'hex' | 'rgb' | 'hsl' | 'cmyk' | 'lab';
|
|
6
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
7
|
+
};
|
|
8
|
+
declare const ColorPicker: import("svelte").Component<ColorPickerProps, {}, "value">;
|
|
9
|
+
type ColorPicker = ReturnType<typeof ColorPicker>;
|
|
10
|
+
export default ColorPicker;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
3
|
+
import { cn } from 'tailwind-variants';
|
|
4
|
+
const { children, class: classes, ...rest }: SvelteHTMLElements['h1'] = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
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
|
+
{@render children?.()}
|
|
15
|
+
</h1>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
3
|
+
import { cn } from 'tailwind-variants';
|
|
4
|
+
const { children, class: classes, ...rest }: SvelteHTMLElements['h2'] = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
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 border-dashed font-bold text-xl/7)',
|
|
14
|
+
'hover:[&>a>code]:(border-primary text-primary)',
|
|
15
|
+
classes,
|
|
16
|
+
)}
|
|
17
|
+
>
|
|
18
|
+
{@render children?.()}
|
|
19
|
+
</h2>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
3
|
+
import { cn } from 'tailwind-variants';
|
|
4
|
+
const { children, class: classes, ...rest }: SvelteHTMLElements['h3'] = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
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
|
+
{@render children?.()}
|
|
16
|
+
</h3>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
3
|
+
import { cn } from 'tailwind-variants';
|
|
4
|
+
const { children, class: classes, ...rest }: SvelteHTMLElements['h4'] = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<h4
|
|
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
|
+
'hover:[&>a>code]:(border-primary text-primary)',
|
|
13
|
+
'[&>a>code]:(transition-colors text-xl/7 font-bold border-dashed)',
|
|
14
|
+
'[&>a]:focus-visible:outline-primary',
|
|
15
|
+
classes,
|
|
16
|
+
)}
|
|
17
|
+
>
|
|
18
|
+
{@render children?.()}
|
|
19
|
+
</h4>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
3
|
+
import { cn } from 'tailwind-variants';
|
|
4
|
+
const { children, class: classes, ...rest }: SvelteHTMLElements['h5'] = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<h5
|
|
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
|
+
'hover:[&>a>code]:(border-primary text-primary)',
|
|
13
|
+
'[&>a>code]:(transition-colors text-xl/7 font-bold border-dashed)',
|
|
14
|
+
'[&>a]:focus-visible:outline-primary',
|
|
15
|
+
classes,
|
|
16
|
+
)}
|
|
17
|
+
>
|
|
18
|
+
{@render children?.()}
|
|
19
|
+
</h5>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
3
|
+
import { cn } from 'tailwind-variants';
|
|
4
|
+
const { children, class: classes, ...rest }: SvelteHTMLElements['h6'] = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<h6
|
|
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
|
+
'hover:[&>a>code]:(border-primary text-primary)',
|
|
13
|
+
'[&>a>code]:(transition-colors text-xl/7 font-bold border-dashed)',
|
|
14
|
+
'[&>a]:focus-visible:outline-primary',
|
|
15
|
+
classes,
|
|
16
|
+
)}
|
|
17
|
+
>
|
|
18
|
+
{@render children?.()}
|
|
19
|
+
</h6>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export * from './button.svelte';
|
|
2
|
+
export { default as Button } from './button.svelte';
|
|
3
|
+
export * from './badge.svelte';
|
|
4
|
+
export { default as Input } from './input.svelte';
|
|
5
|
+
export * from './badge.svelte';
|
|
6
|
+
export { default as InputTime } from './input-time.svelte';
|
|
7
|
+
export * from './badge.svelte';
|
|
8
|
+
export { default as Badge } from './badge.svelte';
|
|
9
|
+
export * from './alert.svelte';
|
|
10
|
+
export { default as Alert } from './alert.svelte';
|
|
11
|
+
export * from './banner.svelte';
|
|
12
|
+
export { default as Banner } from './banner.svelte';
|
|
13
|
+
export * from './progress.svelte';
|
|
14
|
+
export { default as Progress } from './progress.svelte';
|
|
15
|
+
export * from './card.svelte';
|
|
16
|
+
export { default as Card } from './card.svelte';
|
|
17
|
+
export * from './chip.svelte';
|
|
18
|
+
export { default as Chip } from './chip.svelte';
|
|
19
|
+
export * from './switch.svelte';
|
|
20
|
+
export { default as Switch } from './switch.svelte';
|
|
21
|
+
export * from './slider.svelte';
|
|
22
|
+
export { default as Slider } from './slider.svelte';
|
|
23
|
+
export * from './checkbox.svelte';
|
|
24
|
+
export { default as Checkbox } from './checkbox.svelte';
|
|
25
|
+
export * from './checkbox-group.svelte';
|
|
26
|
+
export { default as CheckboxGroup } from './checkbox-group.svelte';
|
|
27
|
+
export { default as H1 } from './h1.svelte';
|
|
28
|
+
export { default as H2 } from './h2.svelte';
|
|
29
|
+
export { default as H3 } from './h3.svelte';
|
|
30
|
+
export { default as H4 } from './h4.svelte';
|
|
31
|
+
export { default as H5 } from './h5.svelte';
|
|
32
|
+
export { default as H6 } from './h6.svelte';
|
|
33
|
+
export { default as P } from './p.svelte';
|
|
34
|
+
export * from './pin-input.svelte';
|
|
35
|
+
export { default as PinInput } from './pin-input.svelte';
|
|
36
|
+
export * from './accordion.svelte';
|
|
37
|
+
export { default as Accordion } from './accordion.svelte';
|
|
38
|
+
export * from './kbd.svelte';
|
|
39
|
+
export { default as Kbd } from './kbd.svelte';
|
|
40
|
+
export * from './tabs.svelte';
|
|
41
|
+
export { default as Tabs } from './tabs.svelte';
|
|
42
|
+
export * from './color-picker.svelte';
|
|
43
|
+
export { default as ColorPicker } from './color-picker.svelte';
|
|
44
|
+
export * from './select.svelte';
|
|
45
|
+
export { default as Select } from './select.svelte';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export * from './button.svelte';
|
|
2
|
+
export { default as Button } from './button.svelte';
|
|
3
|
+
export * from './badge.svelte';
|
|
4
|
+
export { default as Input } from './input.svelte';
|
|
5
|
+
export * from './badge.svelte';
|
|
6
|
+
export { default as InputTime } from './input-time.svelte';
|
|
7
|
+
export * from './badge.svelte';
|
|
8
|
+
export { default as Badge } from './badge.svelte';
|
|
9
|
+
export * from './alert.svelte';
|
|
10
|
+
export { default as Alert } from './alert.svelte';
|
|
11
|
+
export * from './banner.svelte';
|
|
12
|
+
export { default as Banner } from './banner.svelte';
|
|
13
|
+
export * from './progress.svelte';
|
|
14
|
+
export { default as Progress } from './progress.svelte';
|
|
15
|
+
export * from './card.svelte';
|
|
16
|
+
export { default as Card } from './card.svelte';
|
|
17
|
+
export * from './chip.svelte';
|
|
18
|
+
export { default as Chip } from './chip.svelte';
|
|
19
|
+
export * from './switch.svelte';
|
|
20
|
+
export { default as Switch } from './switch.svelte';
|
|
21
|
+
export * from './slider.svelte';
|
|
22
|
+
export { default as Slider } from './slider.svelte';
|
|
23
|
+
export * from './checkbox.svelte';
|
|
24
|
+
export { default as Checkbox } from './checkbox.svelte';
|
|
25
|
+
export * from './checkbox-group.svelte';
|
|
26
|
+
export { default as CheckboxGroup } from './checkbox-group.svelte';
|
|
27
|
+
export { default as H1 } from './h1.svelte';
|
|
28
|
+
export { default as H2 } from './h2.svelte';
|
|
29
|
+
export { default as H3 } from './h3.svelte';
|
|
30
|
+
export { default as H4 } from './h4.svelte';
|
|
31
|
+
export { default as H5 } from './h5.svelte';
|
|
32
|
+
export { default as H6 } from './h6.svelte';
|
|
33
|
+
export { default as P } from './p.svelte';
|
|
34
|
+
export * from './pin-input.svelte';
|
|
35
|
+
export { default as PinInput } from './pin-input.svelte';
|
|
36
|
+
export * from './accordion.svelte';
|
|
37
|
+
export { default as Accordion } from './accordion.svelte';
|
|
38
|
+
export * from './kbd.svelte';
|
|
39
|
+
export { default as Kbd } from './kbd.svelte';
|
|
40
|
+
export * from './tabs.svelte';
|
|
41
|
+
export { default as Tabs } from './tabs.svelte';
|
|
42
|
+
export * from './color-picker.svelte';
|
|
43
|
+
export { default as ColorPicker } from './color-picker.svelte';
|
|
44
|
+
export * from './select.svelte';
|
|
45
|
+
export { default as Select } from './select.svelte';
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { type PropColor } from '../index.js';
|
|
3
|
+
import type { Component, Snippet } from 'svelte';
|
|
4
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
5
|
+
import { tv } from 'tailwind-variants';
|
|
6
|
+
import { Time } from '@internationalized/date';
|
|
7
|
+
|
|
8
|
+
export { Time };
|
|
9
|
+
export { default as InputTime } from './input-time.svelte';
|
|
10
|
+
|
|
11
|
+
export type InputTimeProps = {
|
|
12
|
+
id?: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
hourcycle?: 12 | 24;
|
|
15
|
+
max?: Time;
|
|
16
|
+
min?: Time;
|
|
17
|
+
/**
|
|
18
|
+
* The placeholder text when the input is empty.
|
|
19
|
+
*/
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
/**
|
|
22
|
+
* @default primary
|
|
23
|
+
*/
|
|
24
|
+
color?: PropColor;
|
|
25
|
+
/**
|
|
26
|
+
* @default outline
|
|
27
|
+
*/
|
|
28
|
+
variant?: 'outline' | 'soft' | 'subtle' | 'ghost' | 'none';
|
|
29
|
+
/**
|
|
30
|
+
* @default md
|
|
31
|
+
*/
|
|
32
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
33
|
+
/**
|
|
34
|
+
* @default off
|
|
35
|
+
*/
|
|
36
|
+
autocomplete?: 'on' | 'off';
|
|
37
|
+
/**
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
autofocus?: boolean | number;
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Highlight the ring color like a focus state.
|
|
44
|
+
*/
|
|
45
|
+
highlight?: boolean;
|
|
46
|
+
value?: Time;
|
|
47
|
+
icon?: string | Snippet | Component;
|
|
48
|
+
ui?: {
|
|
49
|
+
root?: ClassNameValue;
|
|
50
|
+
leading?: ClassNameValue;
|
|
51
|
+
icon?: ClassNameValue;
|
|
52
|
+
trailing?: ClassNameValue;
|
|
53
|
+
segment?: ClassNameValue;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<script lang="ts">
|
|
59
|
+
import { TimeField } from 'bits-ui';
|
|
60
|
+
|
|
61
|
+
let {
|
|
62
|
+
hourcycle = 12,
|
|
63
|
+
value = $bindable(),
|
|
64
|
+
color = 'primary',
|
|
65
|
+
variant = 'outline',
|
|
66
|
+
size = 'md',
|
|
67
|
+
icon,
|
|
68
|
+
disabled,
|
|
69
|
+
highlight,
|
|
70
|
+
ui = {},
|
|
71
|
+
...rest
|
|
72
|
+
}: InputTimeProps = $props();
|
|
73
|
+
|
|
74
|
+
const variants = $derived(
|
|
75
|
+
tv({
|
|
76
|
+
slots: {
|
|
77
|
+
root: 'inline-flex items-center rounded transition-all ring ring-inset ring-transparent',
|
|
78
|
+
leading: 'text-muted',
|
|
79
|
+
trailing: 'text-muted',
|
|
80
|
+
icon: '',
|
|
81
|
+
segment: [
|
|
82
|
+
'rounded text-center outline-hidden transition-all focus:bg-surface-accented shrink',
|
|
83
|
+
'aria-[valuetext="Empty"]:text-dimmed data-[segment="literal"]:(text-muted px-1) data-invalid:text-error data-disabled:(cursor-not-allowed opacity-75)',
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
variants: {
|
|
87
|
+
fieldGroup: {
|
|
88
|
+
horizontal: {
|
|
89
|
+
root: '',
|
|
90
|
+
},
|
|
91
|
+
vertical: {
|
|
92
|
+
root: '',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
size: {
|
|
96
|
+
xs: {
|
|
97
|
+
root: 'px-2 h-6 text-xs',
|
|
98
|
+
leading: 'ps-2',
|
|
99
|
+
trailing: 'pe-2',
|
|
100
|
+
icon: 'size-4',
|
|
101
|
+
segment: 'px-1',
|
|
102
|
+
},
|
|
103
|
+
sm: {
|
|
104
|
+
root: 'px-2.5 h-7 text-xs',
|
|
105
|
+
leading: 'ps-2.5',
|
|
106
|
+
trailing: 'pe-2.5',
|
|
107
|
+
icon: 'size-4',
|
|
108
|
+
segment: 'px-1',
|
|
109
|
+
},
|
|
110
|
+
md: {
|
|
111
|
+
root: 'px-2.5 h-8 text-sm',
|
|
112
|
+
leading: 'ps-2.5',
|
|
113
|
+
trailing: 'pe-2.5',
|
|
114
|
+
icon: 'size-5',
|
|
115
|
+
segment: 'px-2',
|
|
116
|
+
},
|
|
117
|
+
lg: {
|
|
118
|
+
root: 'px-3 h-9 text-sm',
|
|
119
|
+
leading: 'ps-3',
|
|
120
|
+
trailing: 'pe-3',
|
|
121
|
+
icon: 'size-5',
|
|
122
|
+
segment: 'px-3',
|
|
123
|
+
},
|
|
124
|
+
xl: {
|
|
125
|
+
root: 'px-3 h-10 text-base',
|
|
126
|
+
leading: 'ps-3',
|
|
127
|
+
trailing: 'pe-3',
|
|
128
|
+
icon: 'size-6',
|
|
129
|
+
segment: 'px-3',
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
variant: {
|
|
133
|
+
outline: { root: 'ring ring-surface-accented' },
|
|
134
|
+
soft: {
|
|
135
|
+
root: 'bg-surface-muted hover:bg-surface-elevated focus-within:bg-surface-elevated',
|
|
136
|
+
},
|
|
137
|
+
subtle: { root: 'ring ring-accented' },
|
|
138
|
+
ghost: { root: 'hover:bg-surface-elevated focus-within:bg-surface-elevated' },
|
|
139
|
+
none: { root: '' },
|
|
140
|
+
},
|
|
141
|
+
color: {
|
|
142
|
+
primary: { root: '' },
|
|
143
|
+
surface: { root: '' },
|
|
144
|
+
info: { root: '' },
|
|
145
|
+
success: { root: '' },
|
|
146
|
+
warning: { root: '' },
|
|
147
|
+
error: { root: '' },
|
|
148
|
+
},
|
|
149
|
+
leading: {
|
|
150
|
+
false: { leading: 'hidden' },
|
|
151
|
+
},
|
|
152
|
+
trailing: {
|
|
153
|
+
false: { trailing: 'hidden' },
|
|
154
|
+
},
|
|
155
|
+
loading: {
|
|
156
|
+
true: '',
|
|
157
|
+
},
|
|
158
|
+
highlight: {
|
|
159
|
+
true: '',
|
|
160
|
+
},
|
|
161
|
+
type: {
|
|
162
|
+
file: 'file:me-1.5 file:font-medium file:text-muted file:outline-none',
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
compoundVariants: [
|
|
166
|
+
{
|
|
167
|
+
color: 'primary',
|
|
168
|
+
variant: ['outline', 'subtle'],
|
|
169
|
+
highlight: true,
|
|
170
|
+
class: {
|
|
171
|
+
root: 'ring-primary-500 ring-2',
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
color: 'surface',
|
|
176
|
+
variant: ['outline', 'subtle'],
|
|
177
|
+
highlight: true,
|
|
178
|
+
class: {
|
|
179
|
+
root: 'ring-surface-800 ring-2',
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
color: 'info',
|
|
184
|
+
variant: ['outline', 'subtle'],
|
|
185
|
+
highlight: true,
|
|
186
|
+
class: {
|
|
187
|
+
root: 'ring-info-500 ring-2',
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
color: 'success',
|
|
192
|
+
variant: ['outline', 'subtle'],
|
|
193
|
+
highlight: true,
|
|
194
|
+
class: {
|
|
195
|
+
root: 'ring-success-500 ring-2',
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
color: 'warning',
|
|
200
|
+
variant: ['outline', 'subtle'],
|
|
201
|
+
highlight: true,
|
|
202
|
+
class: {
|
|
203
|
+
root: 'ring-warning-500 ring-2',
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
color: 'error',
|
|
208
|
+
variant: ['outline', 'subtle'],
|
|
209
|
+
highlight: true,
|
|
210
|
+
class: {
|
|
211
|
+
root: 'ring-error-500 ring-2',
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
],
|
|
215
|
+
})({
|
|
216
|
+
size,
|
|
217
|
+
color,
|
|
218
|
+
variant,
|
|
219
|
+
highlight,
|
|
220
|
+
}),
|
|
221
|
+
);
|
|
222
|
+
</script>
|
|
223
|
+
|
|
224
|
+
<TimeField.Root bind:value hourCycle={hourcycle}>
|
|
225
|
+
<TimeField.Input name="hello" class={variants.root({ class: ui.root })}>
|
|
226
|
+
{#snippet children({ segments })}
|
|
227
|
+
{#each segments as { part, value }, i (part + i)}
|
|
228
|
+
<TimeField.Segment {part} class={variants.segment({ class: ui.segment })}>
|
|
229
|
+
{value}
|
|
230
|
+
</TimeField.Segment>
|
|
231
|
+
{/each}
|
|
232
|
+
{/snippet}
|
|
233
|
+
</TimeField.Input>
|
|
234
|
+
</TimeField.Root>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type PropColor } from '../index.js';
|
|
2
|
+
import type { Component, Snippet } from 'svelte';
|
|
3
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
+
import { Time } from '@internationalized/date';
|
|
5
|
+
export { Time };
|
|
6
|
+
export { default as InputTime } from './input-time.svelte';
|
|
7
|
+
export type InputTimeProps = {
|
|
8
|
+
id?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
hourcycle?: 12 | 24;
|
|
11
|
+
max?: Time;
|
|
12
|
+
min?: Time;
|
|
13
|
+
/**
|
|
14
|
+
* The placeholder text when the input is empty.
|
|
15
|
+
*/
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
/**
|
|
18
|
+
* @default primary
|
|
19
|
+
*/
|
|
20
|
+
color?: PropColor;
|
|
21
|
+
/**
|
|
22
|
+
* @default outline
|
|
23
|
+
*/
|
|
24
|
+
variant?: 'outline' | 'soft' | 'subtle' | 'ghost' | 'none';
|
|
25
|
+
/**
|
|
26
|
+
* @default md
|
|
27
|
+
*/
|
|
28
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
29
|
+
/**
|
|
30
|
+
* @default off
|
|
31
|
+
*/
|
|
32
|
+
autocomplete?: 'on' | 'off';
|
|
33
|
+
/**
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
36
|
+
autofocus?: boolean | number;
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Highlight the ring color like a focus state.
|
|
40
|
+
*/
|
|
41
|
+
highlight?: boolean;
|
|
42
|
+
value?: Time;
|
|
43
|
+
icon?: string | Snippet | Component;
|
|
44
|
+
ui?: {
|
|
45
|
+
root?: ClassNameValue;
|
|
46
|
+
leading?: ClassNameValue;
|
|
47
|
+
icon?: ClassNameValue;
|
|
48
|
+
trailing?: ClassNameValue;
|
|
49
|
+
segment?: ClassNameValue;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
declare const InputTime: Component<InputTimeProps, {}, "value">;
|
|
53
|
+
type InputTime = ReturnType<typeof InputTime>;
|
|
54
|
+
export default InputTime;
|