uisv 0.0.6 → 0.0.7
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/README.md +1 -1
- package/dist/components/accordion.svelte +108 -0
- package/dist/components/accordion.svelte.d.ts +58 -0
- package/dist/components/alert.svelte +2 -4
- package/dist/components/alert.svelte.d.ts +2 -2
- package/dist/components/badge.svelte +1 -1
- package/dist/components/badge.svelte.d.ts +1 -1
- package/dist/components/banner.svelte +2 -4
- package/dist/components/banner.svelte.d.ts +2 -2
- package/dist/components/button.svelte +1 -2
- package/dist/components/button.svelte.d.ts +1 -1
- package/dist/components/checkbox.svelte +1 -2
- package/dist/components/checkbox.svelte.d.ts +1 -1
- package/dist/components/checkboxgroup.svelte +1 -2
- package/dist/components/checkboxgroup.svelte.d.ts +1 -1
- package/dist/components/chip.svelte +1 -1
- package/dist/components/chip.svelte.d.ts +1 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +4 -0
- package/dist/components/kbd.svelte +239 -0
- package/dist/components/kbd.svelte.d.ts +40 -0
- package/dist/components/pin-input.svelte +1 -1
- package/dist/components/pin-input.svelte.d.ts +1 -1
- package/dist/components/progress.svelte +1 -1
- package/dist/components/progress.svelte.d.ts +1 -1
- package/dist/components/slider.svelte +1 -1
- package/dist/components/slider.svelte.d.ts +1 -1
- package/dist/components/switch.svelte +1 -2
- package/dist/components/switch.svelte.d.ts +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/utils/common.d.ts +0 -1
- package/dist/utils/common.js +0 -2
- package/package.json +1 -1
- package/dist/types.d.ts +0 -7
- package/dist/types.js +0 -1
- package/dist/utils/keys.d.ts +0 -8
- package/dist/utils/keys.js +0 -8
- package/dist/utils/types.d.ts +0 -1
- package/dist/utils/types.js +0 -1
package/README.md
CHANGED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { Accordion } from 'bits-ui';
|
|
3
|
+
import type { Component, Snippet } from 'svelte';
|
|
4
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
5
|
+
import { tv } from 'tailwind-variants';
|
|
6
|
+
|
|
7
|
+
export type AccordionItem = {
|
|
8
|
+
label: string;
|
|
9
|
+
icon?: string | Snippet | Component;
|
|
10
|
+
trailingicon?: string | Snippet | Component;
|
|
11
|
+
content: string;
|
|
12
|
+
value?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export type AccordionProps = {
|
|
16
|
+
value?: string | string[];
|
|
17
|
+
items: AccordionItem[];
|
|
18
|
+
collapsible?: boolean;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
type?: 'single' | 'multiple';
|
|
21
|
+
trailingicon?: string | Snippet | Component;
|
|
22
|
+
leading?: Snippet<[{ item: AccordionItem; index: number; open: boolean }]>;
|
|
23
|
+
default?: Snippet<[{ item: AccordionItem; index: number; open: boolean }]>;
|
|
24
|
+
trailing?: Snippet<[{ item: AccordionItem; index: number; open: boolean }]>;
|
|
25
|
+
content?: Snippet<[{ item: AccordionItem; index: number; open: boolean }]>;
|
|
26
|
+
body?: Snippet<[{ item: AccordionItem; index: number; open: boolean }]>;
|
|
27
|
+
ui?: {
|
|
28
|
+
root?: ClassNameValue;
|
|
29
|
+
item?: ClassNameValue;
|
|
30
|
+
header?: ClassNameValue;
|
|
31
|
+
trigger?: ClassNameValue;
|
|
32
|
+
content?: ClassNameValue;
|
|
33
|
+
body?: ClassNameValue;
|
|
34
|
+
leadingicon?: ClassNameValue;
|
|
35
|
+
trailingicon?: ClassNameValue;
|
|
36
|
+
label?: ClassNameValue;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<script lang="ts">
|
|
42
|
+
let {
|
|
43
|
+
value = $bindable(),
|
|
44
|
+
items,
|
|
45
|
+
collapsible = true,
|
|
46
|
+
disabled,
|
|
47
|
+
type = 'single',
|
|
48
|
+
trailingicon = 'i-lucide-baret-down',
|
|
49
|
+
leading,
|
|
50
|
+
default: defau,
|
|
51
|
+
trailing,
|
|
52
|
+
content,
|
|
53
|
+
body,
|
|
54
|
+
ui = {}
|
|
55
|
+
}: AccordionProps = $props();
|
|
56
|
+
const classes = $derived(
|
|
57
|
+
tv({
|
|
58
|
+
slots: {
|
|
59
|
+
root: 'w-full',
|
|
60
|
+
item: 'border-b border-default last:border-b-0',
|
|
61
|
+
header: 'flex',
|
|
62
|
+
trigger:
|
|
63
|
+
'group flex-1 flex items-center gap-1.5 font-medium text-sm py-3.5 focus-visible:outline-primary min-w-0',
|
|
64
|
+
content:
|
|
65
|
+
'data-[state=open]:animate-[accordion-down_200ms_ease-out] data-[state=closed]:animate-[accordion-up_200ms_ease-out] overflow-hidden focus:outline-none',
|
|
66
|
+
body: 'text-sm pb-3.5',
|
|
67
|
+
leadingIcon: 'shrink-0 size-5',
|
|
68
|
+
trailingIcon:
|
|
69
|
+
'shrink-0 size-5 ms-auto group-data-[state=open]:rotate-180 transition-transform duration-200',
|
|
70
|
+
label: 'text-start break-words'
|
|
71
|
+
},
|
|
72
|
+
variants: {
|
|
73
|
+
disabled: {
|
|
74
|
+
true: {
|
|
75
|
+
trigger: 'cursor-not-allowed opacity-75'
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
})({
|
|
80
|
+
disabled
|
|
81
|
+
})
|
|
82
|
+
);
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
<Accordion.Root
|
|
86
|
+
class={classes.root({ class: ui.root })}
|
|
87
|
+
type="multiple"
|
|
88
|
+
bind:value={
|
|
89
|
+
() => {
|
|
90
|
+
if (!value) return;
|
|
91
|
+
if (Array.isArray(value)) return value;
|
|
92
|
+
return [value];
|
|
93
|
+
},
|
|
94
|
+
(val) => {
|
|
95
|
+
if (!val) return (value = val);
|
|
96
|
+
value = type === 'single' ? val[0] : val;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
>
|
|
100
|
+
{#each items as item, idx (idx)}
|
|
101
|
+
<Accordion.Item value="item-1">
|
|
102
|
+
<Accordion.Header>
|
|
103
|
+
<Accordion.Trigger>{item.label}</Accordion.Trigger>
|
|
104
|
+
</Accordion.Header>
|
|
105
|
+
<Accordion.Content>This is the collapsible content for this section.</Accordion.Content>
|
|
106
|
+
</Accordion.Item>
|
|
107
|
+
{/each}
|
|
108
|
+
</Accordion.Root>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Accordion } from 'bits-ui';
|
|
2
|
+
import type { Component, Snippet } from 'svelte';
|
|
3
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
+
export type AccordionItem = {
|
|
5
|
+
label: string;
|
|
6
|
+
icon?: string | Snippet | Component;
|
|
7
|
+
trailingicon?: string | Snippet | Component;
|
|
8
|
+
content: string;
|
|
9
|
+
value?: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type AccordionProps = {
|
|
13
|
+
value?: string | string[];
|
|
14
|
+
items: AccordionItem[];
|
|
15
|
+
collapsible?: boolean;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
type?: 'single' | 'multiple';
|
|
18
|
+
trailingicon?: string | Snippet | Component;
|
|
19
|
+
leading?: Snippet<[{
|
|
20
|
+
item: AccordionItem;
|
|
21
|
+
index: number;
|
|
22
|
+
open: boolean;
|
|
23
|
+
}]>;
|
|
24
|
+
default?: Snippet<[{
|
|
25
|
+
item: AccordionItem;
|
|
26
|
+
index: number;
|
|
27
|
+
open: boolean;
|
|
28
|
+
}]>;
|
|
29
|
+
trailing?: Snippet<[{
|
|
30
|
+
item: AccordionItem;
|
|
31
|
+
index: number;
|
|
32
|
+
open: boolean;
|
|
33
|
+
}]>;
|
|
34
|
+
content?: Snippet<[{
|
|
35
|
+
item: AccordionItem;
|
|
36
|
+
index: number;
|
|
37
|
+
open: boolean;
|
|
38
|
+
}]>;
|
|
39
|
+
body?: Snippet<[{
|
|
40
|
+
item: AccordionItem;
|
|
41
|
+
index: number;
|
|
42
|
+
open: boolean;
|
|
43
|
+
}]>;
|
|
44
|
+
ui?: {
|
|
45
|
+
root?: ClassNameValue;
|
|
46
|
+
item?: ClassNameValue;
|
|
47
|
+
header?: ClassNameValue;
|
|
48
|
+
trigger?: ClassNameValue;
|
|
49
|
+
content?: ClassNameValue;
|
|
50
|
+
body?: ClassNameValue;
|
|
51
|
+
leadingicon?: ClassNameValue;
|
|
52
|
+
trailingicon?: ClassNameValue;
|
|
53
|
+
label?: ClassNameValue;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
declare const Accordion: Component<AccordionProps, {}, "value">;
|
|
57
|
+
type Accordion = ReturnType<typeof Accordion>;
|
|
58
|
+
export default Accordion;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
-
import type
|
|
2
|
+
import { type PropColor, isSnippet } from '../index.js';
|
|
3
3
|
import type { Component, Snippet } from 'svelte';
|
|
4
|
-
import
|
|
4
|
+
import Button, { type ButtonProps } from './button.svelte';
|
|
5
5
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
6
6
|
import { tv } from 'tailwind-variants';
|
|
7
|
-
import { isSnippet } from '../utils/common.js';
|
|
8
7
|
import { defu } from 'defu';
|
|
9
|
-
import Button from './button.svelte';
|
|
10
8
|
|
|
11
9
|
export type AlertProps = {
|
|
12
10
|
title?: string | Snippet;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type PropColor } from '../index.js';
|
|
2
2
|
import type { Component, Snippet } from 'svelte';
|
|
3
|
-
import type
|
|
3
|
+
import { type ButtonProps } from './button.svelte';
|
|
4
4
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
5
5
|
export type AlertProps = {
|
|
6
6
|
title?: string | Snippet;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
<script lang="ts">
|
|
20
20
|
import { tv } from 'tailwind-variants';
|
|
21
21
|
import { isSnippet } from '../utils/common.js';
|
|
22
|
-
import type { PropColor } from '../
|
|
22
|
+
import type { PropColor } from '../index.js';
|
|
23
23
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
24
24
|
|
|
25
25
|
let {
|
|
@@ -12,7 +12,7 @@ export type BadgeProps = {
|
|
|
12
12
|
icon?: ClassNameValue;
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
|
-
import type { PropColor } from '../
|
|
15
|
+
import type { PropColor } from '../index.js';
|
|
16
16
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
17
17
|
declare const Badge: Component<BadgeProps, {}, "">;
|
|
18
18
|
type Badge = ReturnType<typeof Badge>;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
-
import type
|
|
2
|
+
import { isSnippet, type PropColor } from '../index.js';
|
|
3
3
|
import type { Component, Snippet } from 'svelte';
|
|
4
|
-
import
|
|
4
|
+
import Button, { type ButtonProps } from './button.svelte';
|
|
5
5
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
6
6
|
import { tv } from 'tailwind-variants';
|
|
7
|
-
import { isSnippet } from '../utils/common.js';
|
|
8
7
|
import { defu } from 'defu';
|
|
9
8
|
import { useId } from 'bits-ui';
|
|
10
|
-
import Button from './button.svelte';
|
|
11
9
|
|
|
12
10
|
export type BannerProps = {
|
|
13
11
|
title: string | Snippet;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type PropColor } from '../index.js';
|
|
2
2
|
import type { Component, Snippet } from 'svelte';
|
|
3
|
-
import type
|
|
3
|
+
import { type ButtonProps } from './button.svelte';
|
|
4
4
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
5
5
|
export type BannerProps = {
|
|
6
6
|
title: string | Snippet;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
// import { FORM_LOADING_CONTEXT_KEY } from '../utils/keys.js';
|
|
3
3
|
import { type Component, type Snippet } from 'svelte';
|
|
4
|
-
import { isSnippet } from '../utils/common.js';
|
|
5
4
|
import { tv } from 'tailwind-variants';
|
|
6
|
-
import type
|
|
5
|
+
import { type PropColor, isSnippet } from '../index.js';
|
|
7
6
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
8
7
|
|
|
9
8
|
export type ButtonProps = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Component, type Snippet } from 'svelte';
|
|
2
|
-
import type
|
|
2
|
+
import { type PropColor } from '../index.js';
|
|
3
3
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
4
|
export type ButtonProps = {
|
|
5
5
|
/** The underlying DOM element being rendered. You can bind to this to get a reference to the element. */
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
-
import type
|
|
3
|
-
import { isComponent, isSnippet } from '../utils/common.js';
|
|
2
|
+
import { type PropColor, isComponent, isSnippet } from '../index.js';
|
|
4
3
|
import type { Snippet } from 'svelte';
|
|
5
4
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
6
5
|
import { tv } from 'tailwind-variants';
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
-
import { isComponent, isSnippet } from '../utils/common.js';
|
|
3
2
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
3
|
import { tv } from 'tailwind-variants';
|
|
5
4
|
import { Checkbox } from './index.js';
|
|
6
5
|
import type { Component, Snippet } from 'svelte';
|
|
7
|
-
import type
|
|
6
|
+
import { type PropColor, isComponent, isSnippet } from '../index.js';
|
|
8
7
|
|
|
9
8
|
/* eslint @typescript-eslint/no-explicit-any: 0 */
|
|
10
9
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
2
2
|
import type { Component, Snippet } from 'svelte';
|
|
3
|
-
import type
|
|
3
|
+
import { type PropColor } from '../index.js';
|
|
4
4
|
export type CheckboxGroupProps = {
|
|
5
5
|
color?: PropColor;
|
|
6
6
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
@@ -28,3 +28,7 @@ export * from './p.svelte';
|
|
|
28
28
|
export { default as P } from './p.svelte';
|
|
29
29
|
export * from './pin-input.svelte';
|
|
30
30
|
export { default as PinInput } from './pin-input.svelte';
|
|
31
|
+
export * from './accordion.svelte';
|
|
32
|
+
export { default as Accordion } from './accordion.svelte';
|
|
33
|
+
export * from './kbd.svelte';
|
|
34
|
+
export { default as KBD } from './kbd.svelte';
|
package/dist/components/index.js
CHANGED
|
@@ -28,3 +28,7 @@ export * from './p.svelte';
|
|
|
28
28
|
export { default as P } from './p.svelte';
|
|
29
29
|
export * from './pin-input.svelte';
|
|
30
30
|
export { default as PinInput } from './pin-input.svelte';
|
|
31
|
+
export * from './accordion.svelte';
|
|
32
|
+
export { default as Accordion } from './accordion.svelte';
|
|
33
|
+
export * from './kbd.svelte';
|
|
34
|
+
export { default as KBD } from './kbd.svelte';
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { PropColor } from '../index.js';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
5
|
+
import { tv } from 'tailwind-variants';
|
|
6
|
+
|
|
7
|
+
export type KbdProps = {
|
|
8
|
+
children?: Snippet;
|
|
9
|
+
value?: string;
|
|
10
|
+
color?: PropColor;
|
|
11
|
+
variant?: 'solid' | 'outline' | 'soft' | 'subtle';
|
|
12
|
+
size?: 'sm' | 'md' | 'lg';
|
|
13
|
+
class?: ClassNameValue;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const KBD_KEYS = {
|
|
17
|
+
meta: '',
|
|
18
|
+
ctrl: '',
|
|
19
|
+
alt: '',
|
|
20
|
+
win: '⊞',
|
|
21
|
+
command: '⌘',
|
|
22
|
+
shift: '⇧',
|
|
23
|
+
control: '⌃',
|
|
24
|
+
option: '⌥',
|
|
25
|
+
enter: '↵',
|
|
26
|
+
delete: '⌦',
|
|
27
|
+
backspace: '⌫',
|
|
28
|
+
escape: 'Esc',
|
|
29
|
+
tab: '⇥',
|
|
30
|
+
capslock: '⇪',
|
|
31
|
+
arrowup: '↑',
|
|
32
|
+
arrowright: '→',
|
|
33
|
+
arrowdown: '↓',
|
|
34
|
+
arrowleft: '←',
|
|
35
|
+
pageup: '⇞',
|
|
36
|
+
pagedown: '⇟',
|
|
37
|
+
home: '↖',
|
|
38
|
+
end: '↘'
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type KbdKey = keyof typeof KBD_KEYS;
|
|
42
|
+
export type KbdSpecificKey = 'meta' | 'alt' | 'ctrl';
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<script lang="ts">
|
|
46
|
+
const {
|
|
47
|
+
children,
|
|
48
|
+
value,
|
|
49
|
+
color = 'primary',
|
|
50
|
+
variant = 'outline',
|
|
51
|
+
size = 'md',
|
|
52
|
+
class: klass
|
|
53
|
+
}: KbdProps = $props();
|
|
54
|
+
|
|
55
|
+
const macOS = $derived.by(() => {
|
|
56
|
+
if (typeof navigator === 'undefined') return null;
|
|
57
|
+
if (!navigator.userAgent) return null;
|
|
58
|
+
return navigator.userAgent.match(/Macintosh;/);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const kbdKeysSpecificMap = $derived({
|
|
62
|
+
meta: macOS ? KBD_KEYS.command : 'Ctrl',
|
|
63
|
+
alt: macOS ? KBD_KEYS.command : 'Ctrl',
|
|
64
|
+
ctrl: macOS ? KBD_KEYS.option : 'Alt'
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
function getKey(value?: KbdKey | string) {
|
|
68
|
+
if (!value) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (['meta', 'alt', 'ctrl'].includes(value)) {
|
|
73
|
+
return kbdKeysSpecificMap[value as KbdSpecificKey];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return KBD_KEYS[value as KbdKey] || value.toUpperCase();
|
|
77
|
+
}
|
|
78
|
+
</script>
|
|
79
|
+
|
|
80
|
+
<kbd
|
|
81
|
+
class={tv({
|
|
82
|
+
base: 'inline-flex items-center justify-center px-1 rounded-sm font-medium font-sans text-xs',
|
|
83
|
+
variants: {
|
|
84
|
+
color: {
|
|
85
|
+
primary: '',
|
|
86
|
+
secondary: '',
|
|
87
|
+
info: '',
|
|
88
|
+
success: '',
|
|
89
|
+
warning: '',
|
|
90
|
+
error: ''
|
|
91
|
+
},
|
|
92
|
+
variant: {
|
|
93
|
+
solid: 'text-white border border-b-3 border-r-2',
|
|
94
|
+
outline: 'border border-b-3 border-r-2',
|
|
95
|
+
soft: '',
|
|
96
|
+
subtle: 'border border-b-3 border-r-2'
|
|
97
|
+
},
|
|
98
|
+
size: {
|
|
99
|
+
sm: 'h-4 min-w-4',
|
|
100
|
+
md: 'h-5 min-w-5',
|
|
101
|
+
lg: 'h-6 min-w-6'
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
compoundVariants: [
|
|
105
|
+
{
|
|
106
|
+
color: 'primary',
|
|
107
|
+
variant: 'outline',
|
|
108
|
+
class: 'border-primary text-primary'
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
color: 'secondary',
|
|
112
|
+
variant: 'outline',
|
|
113
|
+
class: 'border-secondary-600'
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
color: 'info',
|
|
117
|
+
variant: 'outline',
|
|
118
|
+
class: 'border-info text-info'
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
color: 'success',
|
|
122
|
+
variant: 'outline',
|
|
123
|
+
class: 'border-success text-success'
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
color: 'warning',
|
|
127
|
+
variant: 'outline',
|
|
128
|
+
class: 'border-warning text-warning'
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
color: 'error',
|
|
132
|
+
variant: 'outline',
|
|
133
|
+
class: 'border-error text-error'
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
// SOLID
|
|
137
|
+
{
|
|
138
|
+
color: 'primary',
|
|
139
|
+
variant: 'solid',
|
|
140
|
+
class: 'bg-primary border-primary-600'
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
color: 'secondary',
|
|
144
|
+
variant: 'solid',
|
|
145
|
+
class: 'bg-secondary-600 border-secondary-700'
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
color: 'info',
|
|
149
|
+
variant: 'solid',
|
|
150
|
+
class: 'bg-info border-info-600'
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
color: 'success',
|
|
154
|
+
variant: 'solid',
|
|
155
|
+
class: 'bg-success border-success-600'
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
color: 'warning',
|
|
159
|
+
variant: 'solid',
|
|
160
|
+
class: 'bg-warning border-warning-600'
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
color: 'error',
|
|
164
|
+
variant: 'solid',
|
|
165
|
+
class: 'bg-error border-error-600'
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
// SOFT
|
|
169
|
+
{
|
|
170
|
+
color: 'primary',
|
|
171
|
+
variant: 'soft',
|
|
172
|
+
class: 'bg-primary-100 text-primary'
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
color: 'secondary',
|
|
176
|
+
variant: 'soft',
|
|
177
|
+
class: 'bg-secondary-100 text-secondary-700'
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
color: 'info',
|
|
181
|
+
variant: 'soft',
|
|
182
|
+
class: 'bg-info-100 text-info'
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
color: 'success',
|
|
186
|
+
variant: 'soft',
|
|
187
|
+
class: 'bg-success-100 text-success'
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
color: 'warning',
|
|
191
|
+
variant: 'soft',
|
|
192
|
+
class: 'bg-warning-100 text-warning'
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
color: 'error',
|
|
196
|
+
variant: 'soft',
|
|
197
|
+
class: 'bg-error-100 text-error'
|
|
198
|
+
},
|
|
199
|
+
|
|
200
|
+
// SUBTLE
|
|
201
|
+
{
|
|
202
|
+
color: 'primary',
|
|
203
|
+
variant: 'subtle',
|
|
204
|
+
class: 'bg-primary-100 border-primary-200 text-primary'
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
color: 'secondary',
|
|
208
|
+
variant: 'subtle',
|
|
209
|
+
class: 'bg-secondary-100 border-secondary-200 text-secondary-700'
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
color: 'info',
|
|
213
|
+
variant: 'subtle',
|
|
214
|
+
class: 'bg-info-100 border-info-200 text-info'
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
color: 'success',
|
|
218
|
+
variant: 'subtle',
|
|
219
|
+
class: 'bg-success-100 border-success-200 text-success'
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
color: 'warning',
|
|
223
|
+
variant: 'subtle',
|
|
224
|
+
class: 'bg-warning-100 border-warning-200 text-warning'
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
color: 'error',
|
|
228
|
+
variant: 'subtle',
|
|
229
|
+
class: 'bg-error-100 border-error-200 text-error'
|
|
230
|
+
}
|
|
231
|
+
]
|
|
232
|
+
})({ color, variant, size, class: [klass] })}
|
|
233
|
+
>
|
|
234
|
+
{#if value}
|
|
235
|
+
{getKey(value)}
|
|
236
|
+
{:else}
|
|
237
|
+
{@render children?.()}
|
|
238
|
+
{/if}
|
|
239
|
+
</kbd>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { PropColor } from '../index.js';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
+
export type KbdProps = {
|
|
5
|
+
children?: Snippet;
|
|
6
|
+
value?: string;
|
|
7
|
+
color?: PropColor;
|
|
8
|
+
variant?: 'solid' | 'outline' | 'soft' | 'subtle';
|
|
9
|
+
size?: 'sm' | 'md' | 'lg';
|
|
10
|
+
class?: ClassNameValue;
|
|
11
|
+
};
|
|
12
|
+
export declare const KBD_KEYS: {
|
|
13
|
+
meta: string;
|
|
14
|
+
ctrl: string;
|
|
15
|
+
alt: string;
|
|
16
|
+
win: string;
|
|
17
|
+
command: string;
|
|
18
|
+
shift: string;
|
|
19
|
+
control: string;
|
|
20
|
+
option: string;
|
|
21
|
+
enter: string;
|
|
22
|
+
delete: string;
|
|
23
|
+
backspace: string;
|
|
24
|
+
escape: string;
|
|
25
|
+
tab: string;
|
|
26
|
+
capslock: string;
|
|
27
|
+
arrowup: string;
|
|
28
|
+
arrowright: string;
|
|
29
|
+
arrowdown: string;
|
|
30
|
+
arrowleft: string;
|
|
31
|
+
pageup: string;
|
|
32
|
+
pagedown: string;
|
|
33
|
+
home: string;
|
|
34
|
+
end: string;
|
|
35
|
+
};
|
|
36
|
+
export type KbdKey = keyof typeof KBD_KEYS;
|
|
37
|
+
export type KbdSpecificKey = 'meta' | 'alt' | 'ctrl';
|
|
38
|
+
declare const Kbd: import("svelte").Component<KbdProps, {}, "">;
|
|
39
|
+
type Kbd = ReturnType<typeof Kbd>;
|
|
40
|
+
export default Kbd;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
-
import type
|
|
3
|
-
import { isComponent, isSnippet } from '../utils/common.js';
|
|
2
|
+
import { type PropColor, isComponent, isSnippet } from '../index.js';
|
|
4
3
|
import type { Snippet } from 'svelte';
|
|
5
4
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
6
5
|
import { tv } from 'tailwind-variants';
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/utils/common.d.ts
CHANGED
package/dist/utils/common.js
CHANGED
package/package.json
CHANGED
package/dist/types.d.ts
DELETED
package/dist/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/utils/keys.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare const FORM_OPTION_CONTEXT_KEY: unique symbol;
|
|
2
|
-
export declare const FORM_BUS_CONTEXT_KEY: unique symbol;
|
|
3
|
-
export declare const FORM_STATE_CONTEXT_KEY: unique symbol;
|
|
4
|
-
export declare const FORM_FIELD_CONTEXT_KEY: unique symbol;
|
|
5
|
-
export declare const FORM_TID_CONTEXT_KEY: unique symbol;
|
|
6
|
-
export declare const FORM_INPUTS_CONTEXT_KEY: unique symbol;
|
|
7
|
-
export declare const FORM_LOADING_CONTEXT_KEY: unique symbol;
|
|
8
|
-
export declare const FORM_ERRORS_CONTEXT_KEY: unique symbol;
|
package/dist/utils/keys.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export const FORM_OPTION_CONTEXT_KEY = Symbol('uisv.form-options');
|
|
2
|
-
export const FORM_BUS_CONTEXT_KEY = Symbol('uisv.form-events');
|
|
3
|
-
export const FORM_STATE_CONTEXT_KEY = Symbol('uisv.form-state');
|
|
4
|
-
export const FORM_FIELD_CONTEXT_KEY = Symbol('uisv.form-field');
|
|
5
|
-
export const FORM_TID_CONTEXT_KEY = Symbol('uisv.input-id');
|
|
6
|
-
export const FORM_INPUTS_CONTEXT_KEY = Symbol('uisv.form-inputs');
|
|
7
|
-
export const FORM_LOADING_CONTEXT_KEY = Symbol('uisv.form-loading');
|
|
8
|
-
export const FORM_ERRORS_CONTEXT_KEY = Symbol('uisv.form-errors');
|
package/dist/utils/types.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/utils/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|