sv5ui 1.1.2 → 1.2.0
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 +6 -0
- package/dist/Alert/Alert.svelte +33 -22
- package/dist/Alert/Alert.svelte.d.ts +1 -1
- package/dist/Alert/alert.types.d.ts +4 -0
- package/dist/Avatar/Avatar.svelte +72 -46
- package/dist/Avatar/avatar.types.d.ts +36 -3
- package/dist/Avatar/avatar.variants.d.ts +138 -0
- package/dist/Avatar/avatar.variants.js +23 -12
- package/dist/Avatar/index.d.ts +1 -1
- package/dist/AvatarGroup/AvatarGroup.svelte +11 -6
- package/dist/AvatarGroup/AvatarGroup.svelte.d.ts +1 -1
- package/dist/AvatarGroup/avatar-group.types.d.ts +18 -3
- package/dist/AvatarGroup/avatar-group.variants.d.ts +85 -0
- package/dist/AvatarGroup/avatar-group.variants.js +19 -29
- package/dist/Badge/Badge.svelte +4 -3
- package/dist/Badge/Badge.svelte.d.ts +1 -1
- package/dist/Badge/badge.types.d.ts +9 -0
- package/dist/Breadcrumb/Breadcrumb.svelte +20 -7
- package/dist/Breadcrumb/Breadcrumb.svelte.d.ts +1 -1
- package/dist/Breadcrumb/breadcrumb.types.d.ts +5 -1
- package/dist/Breadcrumb/breadcrumb.variants.d.ts +15 -5
- package/dist/Breadcrumb/breadcrumb.variants.js +7 -3
- package/dist/Button/Button.svelte +71 -16
- package/dist/Button/Button.svelte.d.ts +0 -1
- package/dist/Button/button.types.d.ts +61 -2
- package/dist/Calendar/Calendar.svelte +4 -0
- package/dist/Calendar/Calendar.svelte.d.ts +1 -1
- package/dist/Calendar/calendar.types.d.ts +4 -0
- package/dist/Card/Card.svelte +5 -4
- package/dist/Card/Card.svelte.d.ts +1 -1
- package/dist/Card/card.types.d.ts +5 -1
- package/dist/Checkbox/Checkbox.svelte +37 -11
- package/dist/Checkbox/Checkbox.svelte.d.ts +1 -1
- package/dist/Checkbox/checkbox.types.d.ts +16 -1
- package/dist/Checkbox/checkbox.variants.d.ts +90 -0
- package/dist/Checkbox/checkbox.variants.js +73 -4
- package/dist/Chip/Chip.svelte +3 -2
- package/dist/Chip/Chip.svelte.d.ts +1 -1
- package/dist/Chip/chip.types.d.ts +5 -1
- package/dist/Chip/chip.variants.d.ts +135 -45
- package/dist/Chip/chip.variants.js +9 -9
- package/dist/ContextMenu/ContextMenu.svelte +87 -77
- package/dist/ContextMenu/ContextMenu.svelte.d.ts +1 -1
- package/dist/ContextMenu/context-menu.types.d.ts +9 -3
- package/dist/ContextMenu/context-menu.types.js +1 -1
- package/dist/ContextMenu/context-menu.variants.d.ts +74 -160
- package/dist/ContextMenu/context-menu.variants.js +63 -95
- package/dist/DropdownMenu/DropdownMenu.svelte +37 -43
- package/dist/DropdownMenu/DropdownMenu.svelte.d.ts +1 -1
- package/dist/DropdownMenu/dropdown-menu.types.d.ts +9 -3
- package/dist/DropdownMenu/dropdown-menu.types.js +1 -1
- package/dist/DropdownMenu/dropdown-menu.variants.d.ts +79 -230
- package/dist/DropdownMenu/dropdown-menu.variants.js +68 -111
- package/dist/DropdownMenu/index.d.ts +1 -1
- package/dist/Empty/Empty.svelte +68 -33
- package/dist/Empty/Empty.svelte.d.ts +1 -1
- package/dist/Empty/empty.types.d.ts +26 -9
- package/dist/Empty/empty.variants.d.ts +150 -130
- package/dist/Empty/empty.variants.js +33 -324
- package/dist/FieldGroup/FieldGroup.svelte +11 -6
- package/dist/FieldGroup/FieldGroup.svelte.d.ts +1 -1
- package/dist/FieldGroup/field-group.types.d.ts +4 -0
- package/dist/FormField/FormField.svelte +17 -18
- package/dist/FormField/FormField.svelte.d.ts +1 -1
- package/dist/FormField/form-field.types.d.ts +4 -0
- package/dist/Icon/Icon.svelte +13 -7
- package/dist/Icon/icon.types.d.ts +18 -9
- package/dist/Input/Input.svelte +30 -29
- package/dist/Kbd/Kbd.svelte +13 -3
- package/dist/Kbd/Kbd.svelte.d.ts +1 -1
- package/dist/Kbd/index.d.ts +1 -1
- package/dist/Kbd/kbd.types.d.ts +15 -1
- package/dist/Kbd/kbd.variants.d.ts +92 -30
- package/dist/Kbd/kbd.variants.js +55 -35
- package/dist/Kbd/useKbd.svelte.d.ts +2 -2
- package/dist/Kbd/useKbd.svelte.js +34 -41
- package/dist/Link/Link.svelte +69 -24
- package/dist/Link/Link.svelte.d.ts +1 -1
- package/dist/Link/link.types.d.ts +26 -8
- package/dist/Link/link.variants.d.ts +35 -60
- package/dist/Link/link.variants.js +8 -110
- package/dist/Modal/Modal.svelte +9 -1
- package/dist/Modal/modal.types.d.ts +5 -0
- package/dist/Modal/modal.variants.d.ts +5 -0
- package/dist/Modal/modal.variants.js +1 -0
- package/dist/Pagination/Pagination.svelte +143 -94
- package/dist/Pagination/Pagination.svelte.d.ts +1 -1
- package/dist/Pagination/index.d.ts +1 -1
- package/dist/Pagination/pagination.types.d.ts +21 -2
- package/dist/Pagination/pagination.variants.d.ts +21 -387
- package/dist/Pagination/pagination.variants.js +63 -59
- package/dist/Popover/Popover.svelte +9 -12
- package/dist/Popover/Popover.svelte.d.ts +1 -1
- package/dist/Popover/popover.types.d.ts +4 -0
- package/dist/Popover/popover.variants.d.ts +5 -75
- package/dist/Popover/popover.variants.js +6 -16
- package/dist/Progress/Progress.svelte +58 -30
- package/dist/Progress/progress.types.d.ts +9 -1
- package/dist/Progress/progress.variants.d.ts +55 -25
- package/dist/Progress/progress.variants.js +34 -28
- package/dist/RadioGroup/RadioGroup.svelte +105 -61
- package/dist/RadioGroup/RadioGroup.svelte.d.ts +1 -1
- package/dist/RadioGroup/radio-group.types.d.ts +16 -1
- package/dist/RadioGroup/radio-group.variants.d.ts +90 -0
- package/dist/RadioGroup/radio-group.variants.js +73 -4
- package/dist/Select/Select.svelte +9 -6
- package/dist/Select/Select.svelte.d.ts +1 -1
- package/dist/Select/select.types.d.ts +4 -0
- package/dist/SelectMenu/SelectMenu.svelte +436 -0
- package/dist/SelectMenu/SelectMenu.svelte.d.ts +5 -0
- package/dist/SelectMenu/index.d.ts +2 -0
- package/dist/SelectMenu/index.js +1 -0
- package/dist/SelectMenu/select-menu.types.d.ts +262 -0
- package/dist/SelectMenu/select-menu.types.js +1 -0
- package/dist/SelectMenu/select-menu.variants.d.ts +759 -0
- package/dist/SelectMenu/select-menu.variants.js +33 -0
- package/dist/Separator/Separator.svelte +1 -2
- package/dist/Separator/separator.variants.d.ts +1 -5
- package/dist/Separator/separator.variants.js +2 -2
- package/dist/Skeleton/Skeleton.svelte +18 -2
- package/dist/Skeleton/Skeleton.svelte.d.ts +1 -1
- package/dist/Skeleton/skeleton.types.d.ts +10 -1
- package/dist/Slideover/Slideover.svelte +9 -1
- package/dist/Slideover/slideover.types.d.ts +5 -0
- package/dist/Slideover/slideover.variants.d.ts +20 -5
- package/dist/Slideover/slideover.variants.js +4 -29
- package/dist/Switch/Switch.svelte +32 -31
- package/dist/Switch/Switch.svelte.d.ts +1 -1
- package/dist/Switch/switch.types.d.ts +6 -1
- package/dist/Switch/switch.variants.js +6 -6
- package/dist/Tabs/Tabs.svelte +6 -9
- package/dist/Tabs/Tabs.svelte.d.ts +1 -1
- package/dist/Tabs/tabs.types.d.ts +4 -0
- package/dist/Tabs/tabs.variants.js +2 -0
- package/dist/Textarea/Textarea.svelte +26 -25
- package/dist/ThemeModeButton/theme-mode-button.types.d.ts +7 -2
- package/dist/Timeline/Timeline.svelte +62 -19
- package/dist/Timeline/Timeline.svelte.d.ts +1 -1
- package/dist/Timeline/index.d.ts +1 -1
- package/dist/Timeline/timeline.types.d.ts +8 -0
- package/dist/Tooltip/Tooltip.svelte +12 -10
- package/dist/Tooltip/Tooltip.svelte.d.ts +1 -1
- package/dist/Tooltip/tooltip.types.d.ts +8 -4
- package/dist/Tooltip/tooltip.variants.d.ts +10 -75
- package/dist/Tooltip/tooltip.variants.js +8 -17
- package/dist/User/User.svelte +13 -9
- package/dist/User/User.svelte.d.ts +1 -1
- package/dist/User/user.types.d.ts +4 -0
- package/dist/User/user.variants.d.ts +60 -0
- package/dist/User/user.variants.js +13 -1
- package/dist/config.d.ts +4 -0
- package/dist/config.js +4 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/Input/Input.svelte
CHANGED
|
@@ -94,15 +94,16 @@
|
|
|
94
94
|
loading && isTrailing ? loadingIcon : trailingIcon || (trailing ? icon : undefined)
|
|
95
95
|
)
|
|
96
96
|
|
|
97
|
-
const ariaDescribedBy = $derived
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
const ariaDescribedBy = $derived(
|
|
98
|
+
!formFieldContext
|
|
99
|
+
? undefined
|
|
100
|
+
: hasError
|
|
101
|
+
? `${formFieldContext.ariaId}-error`
|
|
102
|
+
: `${formFieldContext.ariaId}-description ${formFieldContext.ariaId}-help`
|
|
103
|
+
)
|
|
103
104
|
|
|
104
|
-
const
|
|
105
|
-
|
|
105
|
+
const variantSlots = $derived(
|
|
106
|
+
inputVariants({
|
|
106
107
|
variant,
|
|
107
108
|
color: resolvedColor,
|
|
108
109
|
size: resolvedSize,
|
|
@@ -111,26 +112,26 @@
|
|
|
111
112
|
loading,
|
|
112
113
|
highlight: resolvedHighlight
|
|
113
114
|
})
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
115
|
+
)
|
|
116
|
+
const classes = $derived({
|
|
117
|
+
root: variantSlots.root({
|
|
118
|
+
class: [config.slots.root, fieldGroupClass?.root, className, ui?.root]
|
|
119
|
+
}),
|
|
120
|
+
base: variantSlots.base({
|
|
121
|
+
class: [config.slots.base, fieldGroupClass?.base, ui?.base]
|
|
122
|
+
}),
|
|
123
|
+
leading: variantSlots.leading({ class: [config.slots.leading, ui?.leading] }),
|
|
124
|
+
leadingIcon: variantSlots.leadingIcon({
|
|
125
|
+
class: [config.slots.leadingIcon, ui?.leadingIcon]
|
|
126
|
+
}),
|
|
127
|
+
leadingAvatar: variantSlots.leadingAvatar({
|
|
128
|
+
class: [config.slots.leadingAvatar, ui?.leadingAvatar]
|
|
129
|
+
}),
|
|
130
|
+
leadingAvatarSize: variantSlots.leadingAvatarSize() as AvatarSize,
|
|
131
|
+
trailing: variantSlots.trailing({ class: [config.slots.trailing, ui?.trailing] }),
|
|
132
|
+
trailingIcon: variantSlots.trailingIcon({
|
|
133
|
+
class: [config.slots.trailingIcon, ui?.trailingIcon]
|
|
134
|
+
})
|
|
134
135
|
})
|
|
135
136
|
</script>
|
|
136
137
|
|
|
@@ -150,6 +151,7 @@
|
|
|
150
151
|
{/if}
|
|
151
152
|
|
|
152
153
|
<input
|
|
154
|
+
{...restProps}
|
|
153
155
|
bind:this={ref}
|
|
154
156
|
bind:value
|
|
155
157
|
{type}
|
|
@@ -159,7 +161,6 @@
|
|
|
159
161
|
aria-describedby={ariaDescribedBy}
|
|
160
162
|
aria-invalid={resolvedHighlight ? true : undefined}
|
|
161
163
|
class={classes.base}
|
|
162
|
-
{...restProps}
|
|
163
164
|
/>
|
|
164
165
|
|
|
165
166
|
{#if trailingSlot}
|
package/dist/Kbd/Kbd.svelte
CHANGED
|
@@ -6,27 +6,37 @@
|
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
<script lang="ts">
|
|
9
|
+
import { onMount } from 'svelte'
|
|
9
10
|
import { kbdVariants, kbdDefaults } from './kbd.variants.js'
|
|
10
11
|
import { getComponentConfig } from '../config.js'
|
|
11
12
|
|
|
12
13
|
const config = getComponentConfig('kbd', kbdDefaults)
|
|
13
14
|
|
|
14
15
|
let {
|
|
16
|
+
ref = $bindable(null),
|
|
15
17
|
as = 'kbd',
|
|
16
18
|
value,
|
|
17
19
|
color = config.defaultVariants.color,
|
|
18
20
|
size = config.defaultVariants.size,
|
|
19
21
|
variant = config.defaultVariants.variant,
|
|
22
|
+
ui,
|
|
20
23
|
class: className,
|
|
21
24
|
children,
|
|
22
25
|
...restProps
|
|
23
26
|
}: Props = $props()
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
let mounted = $state(false)
|
|
29
|
+
onMount(() => (mounted = true))
|
|
30
|
+
|
|
31
|
+
const displayValue = $derived(resolveKey(value, mounted))
|
|
32
|
+
const kbdClass = $derived(
|
|
33
|
+
kbdVariants({ color, size, variant }).base({
|
|
34
|
+
class: [config.slots.base, className, ui?.base]
|
|
35
|
+
})
|
|
36
|
+
)
|
|
27
37
|
</script>
|
|
28
38
|
|
|
29
|
-
<svelte:element this={as} class={kbdClass} {...restProps}>
|
|
39
|
+
<svelte:element this={as} bind:this={ref} class={kbdClass} {...restProps}>
|
|
30
40
|
{#if children}
|
|
31
41
|
{@render children()}
|
|
32
42
|
{:else if displayValue}
|
package/dist/Kbd/Kbd.svelte.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { KbdProps } from './kbd.types.js';
|
|
2
2
|
export type Props = KbdProps;
|
|
3
|
-
declare const Kbd: import("svelte").Component<KbdProps, {}, "">;
|
|
3
|
+
declare const Kbd: import("svelte").Component<KbdProps, {}, "ref">;
|
|
4
4
|
type Kbd = ReturnType<typeof Kbd>;
|
|
5
5
|
export default Kbd;
|
package/dist/Kbd/index.d.ts
CHANGED
package/dist/Kbd/kbd.types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
1
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
3
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
3
|
-
import type { KbdVariantProps } from './kbd.variants.js';
|
|
4
|
+
import type { KbdVariantProps, KbdSlots } from './kbd.variants.js';
|
|
4
5
|
export type KeyboardShortcutCallback = (event: KeyboardEvent) => void;
|
|
5
6
|
export interface UseKbdOptions {
|
|
6
7
|
/**
|
|
@@ -43,6 +44,10 @@ export interface UseKbdReturn {
|
|
|
43
44
|
readonly pressedKeys: ReadonlySet<string>;
|
|
44
45
|
}
|
|
45
46
|
export type KbdProps = Omit<HTMLAttributes<HTMLElement>, 'class'> & {
|
|
47
|
+
/**
|
|
48
|
+
* Bindable reference to the root DOM element.
|
|
49
|
+
*/
|
|
50
|
+
ref?: HTMLElement | null;
|
|
46
51
|
/**
|
|
47
52
|
* Sets the HTML element type to render.
|
|
48
53
|
* @default 'kbd'
|
|
@@ -70,8 +75,17 @@ export type KbdProps = Omit<HTMLAttributes<HTMLElement>, 'class'> & {
|
|
|
70
75
|
* @default 'outline'
|
|
71
76
|
*/
|
|
72
77
|
variant?: NonNullable<KbdVariantProps['variant']>;
|
|
78
|
+
/**
|
|
79
|
+
* Override styles for specific kbd slots.
|
|
80
|
+
* Available slots: base.
|
|
81
|
+
*/
|
|
82
|
+
ui?: Partial<Record<KbdSlots, ClassNameValue>>;
|
|
73
83
|
/**
|
|
74
84
|
* Additional CSS classes for the root element.
|
|
75
85
|
*/
|
|
76
86
|
class?: ClassNameValue;
|
|
87
|
+
/**
|
|
88
|
+
* Default content slot for custom key display.
|
|
89
|
+
*/
|
|
90
|
+
children?: Snippet;
|
|
77
91
|
};
|
|
@@ -10,17 +10,29 @@ export declare const kbdVariants: import("tailwind-variants").TVReturnType<{
|
|
|
10
10
|
surface: string;
|
|
11
11
|
};
|
|
12
12
|
size: {
|
|
13
|
-
sm:
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
sm: {
|
|
14
|
+
base: string;
|
|
15
|
+
};
|
|
16
|
+
md: {
|
|
17
|
+
base: string;
|
|
18
|
+
};
|
|
19
|
+
lg: {
|
|
20
|
+
base: string;
|
|
21
|
+
};
|
|
16
22
|
};
|
|
17
23
|
variant: {
|
|
18
24
|
solid: string;
|
|
19
|
-
outline:
|
|
25
|
+
outline: {
|
|
26
|
+
base: string;
|
|
27
|
+
};
|
|
20
28
|
soft: string;
|
|
21
|
-
subtle:
|
|
29
|
+
subtle: {
|
|
30
|
+
base: string;
|
|
31
|
+
};
|
|
22
32
|
};
|
|
23
|
-
},
|
|
33
|
+
}, {
|
|
34
|
+
base: string;
|
|
35
|
+
}, undefined, {
|
|
24
36
|
color: {
|
|
25
37
|
primary: string;
|
|
26
38
|
secondary: string;
|
|
@@ -31,17 +43,29 @@ export declare const kbdVariants: import("tailwind-variants").TVReturnType<{
|
|
|
31
43
|
surface: string;
|
|
32
44
|
};
|
|
33
45
|
size: {
|
|
34
|
-
sm:
|
|
35
|
-
|
|
36
|
-
|
|
46
|
+
sm: {
|
|
47
|
+
base: string;
|
|
48
|
+
};
|
|
49
|
+
md: {
|
|
50
|
+
base: string;
|
|
51
|
+
};
|
|
52
|
+
lg: {
|
|
53
|
+
base: string;
|
|
54
|
+
};
|
|
37
55
|
};
|
|
38
56
|
variant: {
|
|
39
57
|
solid: string;
|
|
40
|
-
outline:
|
|
58
|
+
outline: {
|
|
59
|
+
base: string;
|
|
60
|
+
};
|
|
41
61
|
soft: string;
|
|
42
|
-
subtle:
|
|
62
|
+
subtle: {
|
|
63
|
+
base: string;
|
|
64
|
+
};
|
|
43
65
|
};
|
|
44
|
-
},
|
|
66
|
+
}, {
|
|
67
|
+
base: string;
|
|
68
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
45
69
|
color: {
|
|
46
70
|
primary: string;
|
|
47
71
|
secondary: string;
|
|
@@ -52,17 +76,29 @@ export declare const kbdVariants: import("tailwind-variants").TVReturnType<{
|
|
|
52
76
|
surface: string;
|
|
53
77
|
};
|
|
54
78
|
size: {
|
|
55
|
-
sm:
|
|
56
|
-
|
|
57
|
-
|
|
79
|
+
sm: {
|
|
80
|
+
base: string;
|
|
81
|
+
};
|
|
82
|
+
md: {
|
|
83
|
+
base: string;
|
|
84
|
+
};
|
|
85
|
+
lg: {
|
|
86
|
+
base: string;
|
|
87
|
+
};
|
|
58
88
|
};
|
|
59
89
|
variant: {
|
|
60
90
|
solid: string;
|
|
61
|
-
outline:
|
|
91
|
+
outline: {
|
|
92
|
+
base: string;
|
|
93
|
+
};
|
|
62
94
|
soft: string;
|
|
63
|
-
subtle:
|
|
95
|
+
subtle: {
|
|
96
|
+
base: string;
|
|
97
|
+
};
|
|
64
98
|
};
|
|
65
|
-
},
|
|
99
|
+
}, {
|
|
100
|
+
base: string;
|
|
101
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
66
102
|
/** Static key symbols (same across all platforms) */
|
|
67
103
|
export declare const kbdKeysMap: Record<string, string>;
|
|
68
104
|
/** Platform-specific key mappings */
|
|
@@ -71,6 +107,7 @@ export declare const kbdKeysPlatformMap: Record<string, {
|
|
|
71
107
|
other: string;
|
|
72
108
|
}>;
|
|
73
109
|
export type KbdVariantProps = VariantProps<typeof kbdVariants>;
|
|
110
|
+
export type KbdSlots = keyof ReturnType<typeof kbdVariants>;
|
|
74
111
|
export declare const kbdDefaults: {
|
|
75
112
|
defaultVariants: import("tailwind-variants").TVDefaultVariants<{
|
|
76
113
|
color: {
|
|
@@ -83,17 +120,29 @@ export declare const kbdDefaults: {
|
|
|
83
120
|
surface: string;
|
|
84
121
|
};
|
|
85
122
|
size: {
|
|
86
|
-
sm:
|
|
87
|
-
|
|
88
|
-
|
|
123
|
+
sm: {
|
|
124
|
+
base: string;
|
|
125
|
+
};
|
|
126
|
+
md: {
|
|
127
|
+
base: string;
|
|
128
|
+
};
|
|
129
|
+
lg: {
|
|
130
|
+
base: string;
|
|
131
|
+
};
|
|
89
132
|
};
|
|
90
133
|
variant: {
|
|
91
134
|
solid: string;
|
|
92
|
-
outline:
|
|
135
|
+
outline: {
|
|
136
|
+
base: string;
|
|
137
|
+
};
|
|
93
138
|
soft: string;
|
|
94
|
-
subtle:
|
|
139
|
+
subtle: {
|
|
140
|
+
base: string;
|
|
141
|
+
};
|
|
95
142
|
};
|
|
96
|
-
},
|
|
143
|
+
}, {
|
|
144
|
+
base: string;
|
|
145
|
+
}, {
|
|
97
146
|
color: {
|
|
98
147
|
primary: string;
|
|
99
148
|
secondary: string;
|
|
@@ -104,15 +153,28 @@ export declare const kbdDefaults: {
|
|
|
104
153
|
surface: string;
|
|
105
154
|
};
|
|
106
155
|
size: {
|
|
107
|
-
sm:
|
|
108
|
-
|
|
109
|
-
|
|
156
|
+
sm: {
|
|
157
|
+
base: string;
|
|
158
|
+
};
|
|
159
|
+
md: {
|
|
160
|
+
base: string;
|
|
161
|
+
};
|
|
162
|
+
lg: {
|
|
163
|
+
base: string;
|
|
164
|
+
};
|
|
110
165
|
};
|
|
111
166
|
variant: {
|
|
112
167
|
solid: string;
|
|
113
|
-
outline:
|
|
168
|
+
outline: {
|
|
169
|
+
base: string;
|
|
170
|
+
};
|
|
114
171
|
soft: string;
|
|
115
|
-
subtle:
|
|
172
|
+
subtle: {
|
|
173
|
+
base: string;
|
|
174
|
+
};
|
|
116
175
|
};
|
|
117
|
-
},
|
|
176
|
+
}, {
|
|
177
|
+
base: string;
|
|
178
|
+
}>;
|
|
179
|
+
slots: Partial<Record<KbdSlots, string>>;
|
|
118
180
|
};
|
package/dist/Kbd/kbd.variants.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
2
|
export const kbdVariants = tv({
|
|
3
|
-
|
|
3
|
+
slots: {
|
|
4
|
+
base: 'inline-flex items-center justify-center px-1 rounded-sm font-medium font-sans uppercase'
|
|
5
|
+
},
|
|
4
6
|
variants: {
|
|
5
7
|
color: {
|
|
6
8
|
primary: '',
|
|
@@ -12,101 +14,117 @@ export const kbdVariants = tv({
|
|
|
12
14
|
surface: ''
|
|
13
15
|
},
|
|
14
16
|
size: {
|
|
15
|
-
sm: 'h-4 min-w-4 text-[10px]',
|
|
16
|
-
md: 'h-5 min-w-5 text-[11px]',
|
|
17
|
-
lg: 'h-6 min-w-6 text-[12px]'
|
|
17
|
+
sm: { base: 'h-4 min-w-4 text-[10px]' },
|
|
18
|
+
md: { base: 'h-5 min-w-5 text-[11px]' },
|
|
19
|
+
lg: { base: 'h-6 min-w-6 text-[12px]' }
|
|
18
20
|
},
|
|
19
21
|
variant: {
|
|
20
22
|
solid: '',
|
|
21
|
-
outline: 'ring ring-inset',
|
|
23
|
+
outline: { base: 'ring ring-inset' },
|
|
22
24
|
soft: '',
|
|
23
|
-
subtle: 'ring ring-inset'
|
|
25
|
+
subtle: { base: 'ring ring-inset' }
|
|
24
26
|
}
|
|
25
27
|
},
|
|
26
28
|
compoundVariants: [
|
|
27
29
|
// Solid variants
|
|
28
|
-
{ color: 'primary', variant: 'solid', class: 'bg-primary text-on-primary' },
|
|
29
|
-
{ color: 'secondary', variant: 'solid', class: 'bg-secondary text-on-secondary' },
|
|
30
|
-
{ color: 'success', variant: 'solid', class: 'bg-success text-on-success' },
|
|
31
|
-
{ color: 'warning', variant: 'solid', class: 'bg-warning text-on-warning' },
|
|
32
|
-
{ color: 'error', variant: 'solid', class: 'bg-error text-on-error' },
|
|
33
|
-
{ color: 'info', variant: 'solid', class: 'bg-info text-on-info' },
|
|
34
|
-
{
|
|
30
|
+
{ color: 'primary', variant: 'solid', class: { base: 'bg-primary text-on-primary' } },
|
|
31
|
+
{ color: 'secondary', variant: 'solid', class: { base: 'bg-secondary text-on-secondary' } },
|
|
32
|
+
{ color: 'success', variant: 'solid', class: { base: 'bg-success text-on-success' } },
|
|
33
|
+
{ color: 'warning', variant: 'solid', class: { base: 'bg-warning text-on-warning' } },
|
|
34
|
+
{ color: 'error', variant: 'solid', class: { base: 'bg-error text-on-error' } },
|
|
35
|
+
{ color: 'info', variant: 'solid', class: { base: 'bg-info text-on-info' } },
|
|
36
|
+
{
|
|
37
|
+
color: 'surface',
|
|
38
|
+
variant: 'solid',
|
|
39
|
+
class: { base: 'bg-inverse-surface text-inverse-on-surface' }
|
|
40
|
+
},
|
|
35
41
|
// Outline variants
|
|
36
|
-
{ color: 'primary', variant: 'outline', class: 'ring-primary/50 text-primary' },
|
|
37
|
-
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
{ color: 'primary', variant: 'outline', class: { base: 'ring-primary/50 text-primary' } },
|
|
43
|
+
{
|
|
44
|
+
color: 'secondary',
|
|
45
|
+
variant: 'outline',
|
|
46
|
+
class: { base: 'ring-secondary/50 text-secondary' }
|
|
47
|
+
},
|
|
48
|
+
{ color: 'success', variant: 'outline', class: { base: 'ring-success/50 text-success' } },
|
|
49
|
+
{ color: 'warning', variant: 'outline', class: { base: 'ring-warning/50 text-warning' } },
|
|
50
|
+
{ color: 'error', variant: 'outline', class: { base: 'ring-error/50 text-error' } },
|
|
51
|
+
{ color: 'info', variant: 'outline', class: { base: 'ring-info/50 text-info' } },
|
|
42
52
|
{
|
|
43
53
|
color: 'surface',
|
|
44
54
|
variant: 'outline',
|
|
45
|
-
class: 'ring-outline-variant text-on-surface-variant'
|
|
55
|
+
class: { base: 'ring-outline-variant text-on-surface-variant' }
|
|
46
56
|
},
|
|
47
57
|
// Soft variants
|
|
48
58
|
{
|
|
49
59
|
color: 'primary',
|
|
50
60
|
variant: 'soft',
|
|
51
|
-
class: 'bg-primary-container text-on-primary-container'
|
|
61
|
+
class: { base: 'bg-primary-container text-on-primary-container' }
|
|
52
62
|
},
|
|
53
63
|
{
|
|
54
64
|
color: 'secondary',
|
|
55
65
|
variant: 'soft',
|
|
56
|
-
class: 'bg-secondary-container text-on-secondary-container'
|
|
66
|
+
class: { base: 'bg-secondary-container text-on-secondary-container' }
|
|
57
67
|
},
|
|
58
68
|
{
|
|
59
69
|
color: 'success',
|
|
60
70
|
variant: 'soft',
|
|
61
|
-
class: 'bg-success-container text-on-success-container'
|
|
71
|
+
class: { base: 'bg-success-container text-on-success-container' }
|
|
62
72
|
},
|
|
63
73
|
{
|
|
64
74
|
color: 'warning',
|
|
65
75
|
variant: 'soft',
|
|
66
|
-
class: 'bg-warning-container text-on-warning-container'
|
|
76
|
+
class: { base: 'bg-warning-container text-on-warning-container' }
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
color: 'error',
|
|
80
|
+
variant: 'soft',
|
|
81
|
+
class: { base: 'bg-error-container text-on-error-container' }
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
color: 'info',
|
|
85
|
+
variant: 'soft',
|
|
86
|
+
class: { base: 'bg-info-container text-on-info-container' }
|
|
67
87
|
},
|
|
68
|
-
{ color: 'error', variant: 'soft', class: 'bg-error-container text-on-error-container' },
|
|
69
|
-
{ color: 'info', variant: 'soft', class: 'bg-info-container text-on-info-container' },
|
|
70
88
|
{
|
|
71
89
|
color: 'surface',
|
|
72
90
|
variant: 'soft',
|
|
73
|
-
class: 'bg-surface-container-highest text-on-surface'
|
|
91
|
+
class: { base: 'bg-surface-container-highest text-on-surface' }
|
|
74
92
|
},
|
|
75
93
|
// Subtle variants
|
|
76
94
|
{
|
|
77
95
|
color: 'primary',
|
|
78
96
|
variant: 'subtle',
|
|
79
|
-
class: 'ring-primary/25 bg-primary-container text-on-primary-container'
|
|
97
|
+
class: { base: 'ring-primary/25 bg-primary-container text-on-primary-container' }
|
|
80
98
|
},
|
|
81
99
|
{
|
|
82
100
|
color: 'secondary',
|
|
83
101
|
variant: 'subtle',
|
|
84
|
-
class: 'ring-secondary/25 bg-secondary-container text-on-secondary-container'
|
|
102
|
+
class: { base: 'ring-secondary/25 bg-secondary-container text-on-secondary-container' }
|
|
85
103
|
},
|
|
86
104
|
{
|
|
87
105
|
color: 'success',
|
|
88
106
|
variant: 'subtle',
|
|
89
|
-
class: 'ring-success/25 bg-success-container text-on-success-container'
|
|
107
|
+
class: { base: 'ring-success/25 bg-success-container text-on-success-container' }
|
|
90
108
|
},
|
|
91
109
|
{
|
|
92
110
|
color: 'warning',
|
|
93
111
|
variant: 'subtle',
|
|
94
|
-
class: 'ring-warning/25 bg-warning-container text-on-warning-container'
|
|
112
|
+
class: { base: 'ring-warning/25 bg-warning-container text-on-warning-container' }
|
|
95
113
|
},
|
|
96
114
|
{
|
|
97
115
|
color: 'error',
|
|
98
116
|
variant: 'subtle',
|
|
99
|
-
class: 'ring-error/25 bg-error-container text-on-error-container'
|
|
117
|
+
class: { base: 'ring-error/25 bg-error-container text-on-error-container' }
|
|
100
118
|
},
|
|
101
119
|
{
|
|
102
120
|
color: 'info',
|
|
103
121
|
variant: 'subtle',
|
|
104
|
-
class: 'ring-info/25 bg-info-container text-on-info-container'
|
|
122
|
+
class: { base: 'ring-info/25 bg-info-container text-on-info-container' }
|
|
105
123
|
},
|
|
106
124
|
{
|
|
107
125
|
color: 'surface',
|
|
108
126
|
variant: 'subtle',
|
|
109
|
-
class: 'ring-outline-variant bg-surface-container-highest text-on-surface'
|
|
127
|
+
class: { base: 'ring-outline-variant bg-surface-container-highest text-on-surface' }
|
|
110
128
|
}
|
|
111
129
|
],
|
|
112
130
|
defaultVariants: {
|
|
@@ -121,6 +139,7 @@ export const kbdKeysMap = {
|
|
|
121
139
|
shift: '⇧',
|
|
122
140
|
control: '⌃',
|
|
123
141
|
option: '⌥',
|
|
142
|
+
win: '⊞',
|
|
124
143
|
enter: '↵',
|
|
125
144
|
delete: '⌦',
|
|
126
145
|
backspace: '⌫',
|
|
@@ -144,5 +163,6 @@ export const kbdKeysPlatformMap = {
|
|
|
144
163
|
alt: { mac: '⌥', other: 'Alt' }
|
|
145
164
|
};
|
|
146
165
|
export const kbdDefaults = {
|
|
147
|
-
defaultVariants: kbdVariants.defaultVariants
|
|
166
|
+
defaultVariants: kbdVariants.defaultVariants,
|
|
167
|
+
slots: {}
|
|
148
168
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { kbdKeysMap, kbdKeysPlatformMap } from './kbd.variants.js';
|
|
2
2
|
import type { UseKbdOptions, UseKbdReturn } from './kbd.types.js';
|
|
3
|
+
export declare function isMac(): boolean;
|
|
3
4
|
/** @internal */
|
|
4
5
|
export declare const __resetPlatformCache: () => void;
|
|
5
|
-
export declare
|
|
6
|
-
export declare function resolveKey(value: string | undefined): string | null;
|
|
6
|
+
export declare function resolveKey(value: string | undefined, platformReady?: boolean): string | null;
|
|
7
7
|
export declare function resolveShortcut(shortcut: string | undefined): string[];
|
|
8
8
|
export declare function formatShortcut(shortcut: string | undefined, separator?: string): string;
|
|
9
9
|
export declare function normalizeKey(eventKey: string): string;
|