solid-element-ui 0.2.5 → 0.2.6
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/{src/alert-dialog → alert-dialog}/alert-dialog.d.ts +1 -1
- package/dist/{src/badge → badge}/badge.d.ts +2 -2
- package/dist/index.css +3 -1
- package/dist/index.js +16097 -17258
- package/dist/{src/separator → separator}/separator.d.ts +11 -5
- package/dist/{src/skeleton → skeleton}/skeleton.d.ts +2 -2
- package/dist/{src/slider → slider}/slider.d.ts +12 -0
- package/dist/{src/toast → toast}/toast.d.ts +3 -1
- package/dist/{src/toggle-button → toggle-button}/toggle-button.d.ts +0 -3
- package/package.json +10 -6
- package/src/accordion/accordion.tsx +1 -1
- package/src/alert-dialog/alert-dialog.tsx +45 -14
- package/src/badge/badge.tsx +8 -11
- package/src/checkbox/checkbox.tsx +2 -3
- package/src/collapsible/collapsible.tsx +2 -2
- package/src/color-area/color-area.tsx +1 -1
- package/src/combobox/combobox.tsx +2 -2
- package/src/context-menu/context-menu.tsx +3 -3
- package/src/dialog/dialog.tsx +2 -3
- package/src/dropdown-menu/dropdown-menu.tsx +3 -3
- package/src/hover-card/hover-card.tsx +1 -2
- package/src/index.tsx +4 -1
- package/src/link/link.tsx +4 -4
- package/src/menubar/menubar.tsx +9 -5
- package/src/meter/meter.tsx +6 -6
- package/src/number-field/number-field.tsx +6 -7
- package/src/pagination/pagination.tsx +4 -5
- package/src/popover/popover.tsx +2 -3
- package/src/progress/progress.tsx +2 -2
- package/src/radio-group/radio-group.tsx +6 -6
- package/src/search/search.tsx +8 -8
- package/src/segmented-control/segmented-control.tsx +3 -3
- package/src/select/select.tsx +8 -9
- package/src/separator/separator.tsx +6 -4
- package/src/skeleton/skeleton.tsx +1 -1
- package/src/slider/slider.tsx +12 -9
- package/src/style/{index.css → global.css} +20 -14
- package/src/switch/switch.tsx +7 -7
- package/src/tabs/tabs.tsx +5 -5
- package/src/text-field/text-field.tsx +7 -7
- package/src/toast/toast.tsx +15 -11
- package/src/toggle-button/toggle-button.tsx +5 -4
- package/src/toggle-group/toggle-group.tsx +6 -7
- package/src/tooltip/tooltip.tsx +9 -14
- /package/dist/{src/accordion → accordion}/accordion.d.ts +0 -0
- /package/dist/{src/alert → alert}/alert.d.ts +0 -0
- /package/dist/{src/breadcrumbs → breadcrumbs}/breadcrumbs.d.ts +0 -0
- /package/dist/{src/button → button}/button.d.ts +0 -0
- /package/dist/{src/checkbox → checkbox}/checkbox.d.ts +0 -0
- /package/dist/{src/collapsible → collapsible}/collapsible.d.ts +0 -0
- /package/dist/{src/color-area → color-area}/color-area.d.ts +0 -0
- /package/dist/{src/color-channel-field → color-channel-field}/color-channel-field.d.ts +0 -0
- /package/dist/{src/color-field → color-field}/color-field.d.ts +0 -0
- /package/dist/{src/color-slider → color-slider}/color-slider.d.ts +0 -0
- /package/dist/{src/color-swatch → color-swatch}/color-swatch.d.ts +0 -0
- /package/dist/{src/color-wheel → color-wheel}/color-wheel.d.ts +0 -0
- /package/dist/{src/combobox → combobox}/combobox.d.ts +0 -0
- /package/dist/{src/context-menu → context-menu}/context-menu.d.ts +0 -0
- /package/dist/{src/dialog → dialog}/dialog.d.ts +0 -0
- /package/dist/{src/dropdown-menu → dropdown-menu}/dropdown-menu.d.ts +0 -0
- /package/dist/{src/file-field → file-field}/file-field.d.ts +0 -0
- /package/dist/{src/hover-card → hover-card}/hover-card.d.ts +0 -0
- /package/dist/{src/image → image}/image.d.ts +0 -0
- /package/dist/{src/index.d.ts → index.d.ts} +0 -0
- /package/dist/{src/link → link}/link.d.ts +0 -0
- /package/dist/{src/menubar → menubar}/menubar.d.ts +0 -0
- /package/dist/{src/meter → meter}/meter.d.ts +0 -0
- /package/dist/{src/navigation-menu → navigation-menu}/navigation-menu.d.ts +0 -0
- /package/dist/{src/number-field → number-field}/number-field.d.ts +0 -0
- /package/dist/{src/pagination → pagination}/pagination.d.ts +0 -0
- /package/dist/{src/popover → popover}/popover.d.ts +0 -0
- /package/dist/{src/progress → progress}/progress.d.ts +0 -0
- /package/dist/{src/radio-group → radio-group}/radio-group.d.ts +0 -0
- /package/dist/{src/rating-group → rating-group}/rating-group.d.ts +0 -0
- /package/dist/{src/search → search}/search.d.ts +0 -0
- /package/dist/{src/segmented-control → segmented-control}/segmented-control.d.ts +0 -0
- /package/dist/{src/select → select}/select.d.ts +0 -0
- /package/dist/{src/switch → switch}/switch.d.ts +0 -0
- /package/dist/{src/tabs → tabs}/tabs.d.ts +0 -0
- /package/dist/{src/text-field → text-field}/text-field.d.ts +0 -0
- /package/dist/{src/time-field → time-field}/time-field.d.ts +0 -0
- /package/dist/{src/toggle-group → toggle-group}/toggle-group.d.ts +0 -0
- /package/dist/{src/tooltip → tooltip}/tooltip.d.ts +0 -0
|
@@ -13,10 +13,12 @@ declare const separatorStyles: import('tailwind-variants').TVReturnType<{
|
|
|
13
13
|
};
|
|
14
14
|
variant: {
|
|
15
15
|
default: string;
|
|
16
|
-
muted: string;
|
|
17
16
|
primary: string;
|
|
17
|
+
success: string;
|
|
18
|
+
warning: string;
|
|
19
|
+
danger: string;
|
|
18
20
|
};
|
|
19
|
-
}, undefined, "bg-
|
|
21
|
+
}, undefined, "bg-foreground shrink-0 transition-colors", {
|
|
20
22
|
orientation: {
|
|
21
23
|
horizontal: string;
|
|
22
24
|
vertical: string;
|
|
@@ -28,8 +30,10 @@ declare const separatorStyles: import('tailwind-variants').TVReturnType<{
|
|
|
28
30
|
};
|
|
29
31
|
variant: {
|
|
30
32
|
default: string;
|
|
31
|
-
muted: string;
|
|
32
33
|
primary: string;
|
|
34
|
+
success: string;
|
|
35
|
+
warning: string;
|
|
36
|
+
danger: string;
|
|
33
37
|
};
|
|
34
38
|
}, undefined, import('tailwind-variants').TVReturnType<{
|
|
35
39
|
orientation: {
|
|
@@ -43,10 +47,12 @@ declare const separatorStyles: import('tailwind-variants').TVReturnType<{
|
|
|
43
47
|
};
|
|
44
48
|
variant: {
|
|
45
49
|
default: string;
|
|
46
|
-
muted: string;
|
|
47
50
|
primary: string;
|
|
51
|
+
success: string;
|
|
52
|
+
warning: string;
|
|
53
|
+
danger: string;
|
|
48
54
|
};
|
|
49
|
-
}, undefined, "bg-
|
|
55
|
+
}, undefined, "bg-foreground shrink-0 transition-colors", unknown, unknown, undefined>>;
|
|
50
56
|
type SeparatorVariants = VariantProps<typeof separatorStyles>;
|
|
51
57
|
export interface SeparatorProps extends ComponentProps<typeof KSeparator>, SeparatorVariants {
|
|
52
58
|
class?: string;
|
|
@@ -12,7 +12,7 @@ declare const skeletonStyles: import('tailwind-variants').TVReturnType<{
|
|
|
12
12
|
wave: string;
|
|
13
13
|
none: string;
|
|
14
14
|
};
|
|
15
|
-
}, undefined, "bg-
|
|
15
|
+
}, undefined, "bg-foreground", {
|
|
16
16
|
variant: {
|
|
17
17
|
rect: string;
|
|
18
18
|
circle: string;
|
|
@@ -34,7 +34,7 @@ declare const skeletonStyles: import('tailwind-variants').TVReturnType<{
|
|
|
34
34
|
wave: string;
|
|
35
35
|
none: string;
|
|
36
36
|
};
|
|
37
|
-
}, undefined, "bg-
|
|
37
|
+
}, undefined, "bg-foreground", unknown, unknown, undefined>>;
|
|
38
38
|
type SkeletonVariants = VariantProps<typeof skeletonStyles>;
|
|
39
39
|
export interface SkeletonProps extends Omit<ComponentProps<typeof KSkeleton>, "class" | "width" | "height">, SkeletonVariants {
|
|
40
40
|
width?: string | number;
|
|
@@ -11,6 +11,10 @@ declare const sliderStyles: import('tailwind-variants').TVReturnType<{
|
|
|
11
11
|
fill: string;
|
|
12
12
|
thumb: string;
|
|
13
13
|
};
|
|
14
|
+
warning: {
|
|
15
|
+
fill: string;
|
|
16
|
+
thumb: string;
|
|
17
|
+
};
|
|
14
18
|
success: {
|
|
15
19
|
fill: string;
|
|
16
20
|
thumb: string;
|
|
@@ -48,6 +52,10 @@ declare const sliderStyles: import('tailwind-variants').TVReturnType<{
|
|
|
48
52
|
fill: string;
|
|
49
53
|
thumb: string;
|
|
50
54
|
};
|
|
55
|
+
warning: {
|
|
56
|
+
fill: string;
|
|
57
|
+
thumb: string;
|
|
58
|
+
};
|
|
51
59
|
success: {
|
|
52
60
|
fill: string;
|
|
53
61
|
thumb: string;
|
|
@@ -85,6 +93,10 @@ declare const sliderStyles: import('tailwind-variants').TVReturnType<{
|
|
|
85
93
|
fill: string;
|
|
86
94
|
thumb: string;
|
|
87
95
|
};
|
|
96
|
+
warning: {
|
|
97
|
+
fill: string;
|
|
98
|
+
thumb: string;
|
|
99
|
+
};
|
|
88
100
|
success: {
|
|
89
101
|
fill: string;
|
|
90
102
|
thumb: string;
|
|
@@ -87,5 +87,7 @@ export interface ToastProps extends Omit<ComponentProps<typeof KToast>, "class">
|
|
|
87
87
|
class?: string;
|
|
88
88
|
}
|
|
89
89
|
export declare const ToastProvider: (props: ParentProps) => import("solid-js").JSX.Element;
|
|
90
|
-
export declare const showToast: (props: Omit<ToastProps, "toastId">) => number
|
|
90
|
+
export declare const showToast: (props: Omit<ToastProps, "toastId">) => number | {
|
|
91
|
+
toastId: () => string;
|
|
92
|
+
};
|
|
91
93
|
export {};
|
|
@@ -5,7 +5,6 @@ declare const toggleStyles: import('tailwind-variants').TVReturnType<{
|
|
|
5
5
|
variant: {
|
|
6
6
|
solid: string;
|
|
7
7
|
outline: string;
|
|
8
|
-
ghost: string;
|
|
9
8
|
};
|
|
10
9
|
size: {
|
|
11
10
|
sm: string;
|
|
@@ -17,7 +16,6 @@ declare const toggleStyles: import('tailwind-variants').TVReturnType<{
|
|
|
17
16
|
variant: {
|
|
18
17
|
solid: string;
|
|
19
18
|
outline: string;
|
|
20
|
-
ghost: string;
|
|
21
19
|
};
|
|
22
20
|
size: {
|
|
23
21
|
sm: string;
|
|
@@ -29,7 +27,6 @@ declare const toggleStyles: import('tailwind-variants').TVReturnType<{
|
|
|
29
27
|
variant: {
|
|
30
28
|
solid: string;
|
|
31
29
|
outline: string;
|
|
32
|
-
ghost: string;
|
|
33
30
|
};
|
|
34
31
|
size: {
|
|
35
32
|
sm: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-element-ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "sanguogege",
|
|
@@ -34,23 +34,27 @@
|
|
|
34
34
|
"exports": {
|
|
35
35
|
".": {
|
|
36
36
|
"types": "./dist/index.d.ts",
|
|
37
|
-
"import": "./dist/index.js",
|
|
38
37
|
"solid": "./src/index.tsx",
|
|
38
|
+
"import": {
|
|
39
|
+
"node": "./dist/index.js",
|
|
40
|
+
"default": "./dist/index.js"
|
|
41
|
+
},
|
|
42
|
+
"browser": "./dist/index.js",
|
|
39
43
|
"default": "./dist/index.js"
|
|
40
44
|
},
|
|
41
|
-
"./index.css": "./dist/
|
|
45
|
+
"./index.css": "./dist/global.css"
|
|
42
46
|
},
|
|
43
47
|
"source": "./src/index.tsx",
|
|
44
48
|
"scripts": {
|
|
45
49
|
"build": "tsc -b && vite build"
|
|
46
50
|
},
|
|
47
51
|
"peerDependencies": {
|
|
48
|
-
"solid-js": "^1.9.
|
|
52
|
+
"solid-js": "^1.9.11"
|
|
49
53
|
},
|
|
50
54
|
"dependencies": {
|
|
51
55
|
"@kobalte/core": "^0.13.11",
|
|
52
|
-
"lucide-solid": "^0.
|
|
53
|
-
"tailwind-merge": "^3.
|
|
56
|
+
"lucide-solid": "^0.577.0",
|
|
57
|
+
"tailwind-merge": "^3.5.0",
|
|
54
58
|
"tailwind-variants": "^3.2.2"
|
|
55
59
|
},
|
|
56
60
|
"devDependencies": {
|
|
@@ -15,7 +15,7 @@ const accordionStyles = tv(
|
|
|
15
15
|
header: "flex",
|
|
16
16
|
trigger: [
|
|
17
17
|
"flex flex-1 items-center justify-between cursor-pointer py-4 px-4 text-md font-medium transition-all ",
|
|
18
|
-
"bg-
|
|
18
|
+
"bg-foreground hover:bg-foreground/80",
|
|
19
19
|
],
|
|
20
20
|
content: [
|
|
21
21
|
"overflow-hidden text-md transition-all bg-transparent text-main",
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { AlertDialog as KAlertDialog } from "@kobalte/core/alert-dialog";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
splitProps,
|
|
4
|
+
type JSX,
|
|
5
|
+
type ComponentProps,
|
|
6
|
+
createSignal,
|
|
7
|
+
} from "solid-js";
|
|
3
8
|
import { tv } from "tailwind-variants";
|
|
4
9
|
import { X } from "lucide-solid";
|
|
5
10
|
import { Button } from "../button/button";
|
|
6
11
|
|
|
7
|
-
// TODO 修改点击确定时的行为,目前是关闭对话框
|
|
8
|
-
|
|
9
12
|
const alertDialogStyles = tv(
|
|
10
13
|
{
|
|
11
14
|
slots: {
|
|
@@ -39,10 +42,14 @@ interface AlertDialogProps extends ComponentProps<typeof KAlertDialog> {
|
|
|
39
42
|
description?: string;
|
|
40
43
|
action?: JSX.Element;
|
|
41
44
|
cancel?: JSX.Element;
|
|
42
|
-
onConfirm?: () => void
|
|
45
|
+
onConfirm?: () => void | Promise<void>;
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
export const AlertDialog = (props: AlertDialogProps) => {
|
|
49
|
+
// 使用受控模式
|
|
50
|
+
const [isOpen, setIsOpen] = createSignal(false);
|
|
51
|
+
const [loading, setLoading] = createSignal(false);
|
|
52
|
+
|
|
46
53
|
const [local, others] = splitProps(props, [
|
|
47
54
|
"trigger",
|
|
48
55
|
"title",
|
|
@@ -52,13 +59,34 @@ export const AlertDialog = (props: AlertDialogProps) => {
|
|
|
52
59
|
"onConfirm",
|
|
53
60
|
]);
|
|
54
61
|
|
|
55
|
-
const handleConfirm = () => {
|
|
56
|
-
|
|
62
|
+
const handleConfirm = async (e: MouseEvent) => {
|
|
63
|
+
// 阻止默认行为和冒泡,确保点击不会误触发 Kobalte 的内部关闭逻辑
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
e.stopPropagation();
|
|
66
|
+
|
|
67
|
+
if (local.onConfirm) {
|
|
68
|
+
setLoading(true);
|
|
69
|
+
try {
|
|
70
|
+
await local.onConfirm();
|
|
71
|
+
// 只有逻辑成功执行后,才手动关闭
|
|
72
|
+
setIsOpen(false);
|
|
73
|
+
} catch (error) {
|
|
74
|
+
console.error("确认操作失败:", error);
|
|
75
|
+
// 报错时不关闭,让用户留在页面
|
|
76
|
+
} finally {
|
|
77
|
+
setLoading(false);
|
|
78
|
+
}
|
|
79
|
+
} else {
|
|
80
|
+
setIsOpen(false);
|
|
81
|
+
}
|
|
57
82
|
};
|
|
58
83
|
|
|
59
84
|
return (
|
|
60
|
-
<KAlertDialog {...others}>
|
|
61
|
-
<
|
|
85
|
+
<KAlertDialog {...others} open={isOpen()} onOpenChange={setIsOpen}>
|
|
86
|
+
<div onClick={() => setIsOpen(true)} class="inline-block">
|
|
87
|
+
{local.trigger}
|
|
88
|
+
</div>
|
|
89
|
+
|
|
62
90
|
<KAlertDialog.Portal>
|
|
63
91
|
<KAlertDialog.Overlay class={overlay()} />
|
|
64
92
|
<KAlertDialog.Content class={content()}>
|
|
@@ -66,11 +94,13 @@ export const AlertDialog = (props: AlertDialogProps) => {
|
|
|
66
94
|
<KAlertDialog.Title class={title()}>
|
|
67
95
|
{local.title}
|
|
68
96
|
</KAlertDialog.Title>
|
|
97
|
+
{/* 这里使用 CloseButton 是正确的,因为它专门负责“取消/关闭” */}
|
|
69
98
|
<KAlertDialog.CloseButton class={closeButton()}>
|
|
70
99
|
<X size={18} />
|
|
71
100
|
</KAlertDialog.CloseButton>
|
|
72
101
|
</div>
|
|
73
|
-
|
|
102
|
+
|
|
103
|
+
<div class="mt-2">
|
|
74
104
|
{local.description && (
|
|
75
105
|
<KAlertDialog.Description class={description()}>
|
|
76
106
|
{local.description}
|
|
@@ -84,15 +114,16 @@ export const AlertDialog = (props: AlertDialogProps) => {
|
|
|
84
114
|
<Button variant="outline">取消</Button>
|
|
85
115
|
)}
|
|
86
116
|
</KAlertDialog.CloseButton>
|
|
87
|
-
|
|
88
|
-
<KAlertDialog.CloseButton onClick={handleConfirm}>
|
|
117
|
+
<div onClick={handleConfirm}>
|
|
89
118
|
{local.action || (
|
|
90
|
-
<Button color="primary"
|
|
119
|
+
<Button color="primary" loading={loading()}>
|
|
120
|
+
确认
|
|
121
|
+
</Button>
|
|
91
122
|
)}
|
|
92
|
-
</
|
|
123
|
+
</div>
|
|
93
124
|
</div>
|
|
94
125
|
</KAlertDialog.Content>
|
|
95
126
|
</KAlertDialog.Portal>
|
|
96
127
|
</KAlertDialog>
|
|
97
128
|
);
|
|
98
|
-
};
|
|
129
|
+
};
|
package/src/badge/badge.tsx
CHANGED
|
@@ -4,18 +4,16 @@ import { tv, type VariantProps } from "tailwind-variants";
|
|
|
4
4
|
|
|
5
5
|
const badgeStyles = tv(
|
|
6
6
|
{
|
|
7
|
-
base: "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none",
|
|
7
|
+
base: "inline-flex items-center rounded-full border border-transparent px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none",
|
|
8
8
|
variants: {
|
|
9
9
|
variant: {
|
|
10
|
-
default:
|
|
11
|
-
"border-transparent bg-zinc-900 text-zinc-50 hover:bg-zinc-900/80 dark:bg-zinc-50 dark:text-zinc-900",
|
|
10
|
+
default: " bg-reversal-bg text-reversal",
|
|
12
11
|
secondary:
|
|
13
|
-
"
|
|
14
|
-
outline:
|
|
15
|
-
"text-zinc-950 border-zinc-200 dark:text-zinc-50 dark:border-zinc-800",
|
|
12
|
+
"bg-foreground text-muted",
|
|
13
|
+
outline: "text-main border-light",
|
|
16
14
|
success:
|
|
17
|
-
"
|
|
18
|
-
danger: "
|
|
15
|
+
"bg-success/20 text-success ",
|
|
16
|
+
danger: "bg-danger/20 text-danger",
|
|
19
17
|
},
|
|
20
18
|
},
|
|
21
19
|
defaultVariants: {
|
|
@@ -30,14 +28,13 @@ const badgeStyles = tv(
|
|
|
30
28
|
type BadgeVariants = VariantProps<typeof badgeStyles>;
|
|
31
29
|
|
|
32
30
|
export interface BadgeProps
|
|
33
|
-
extends ComponentProps<typeof KBadge>,
|
|
34
|
-
BadgeVariants {}
|
|
31
|
+
extends ComponentProps<typeof KBadge>, BadgeVariants {}
|
|
35
32
|
|
|
36
33
|
export const Badge = (props: BadgeProps) => {
|
|
37
34
|
const [local, variantProps, others] = splitProps(
|
|
38
35
|
props,
|
|
39
36
|
["class"],
|
|
40
|
-
["variant"]
|
|
37
|
+
["variant"],
|
|
41
38
|
);
|
|
42
39
|
|
|
43
40
|
return (
|
|
@@ -5,18 +5,17 @@ import { Check } from "lucide-solid";
|
|
|
5
5
|
|
|
6
6
|
// TODO 添加checkbox 的几种形状尺寸,看情况吧
|
|
7
7
|
|
|
8
|
-
|
|
9
8
|
|
|
10
9
|
const checkboxStyles = tv(
|
|
11
10
|
{
|
|
12
11
|
slots: {
|
|
13
12
|
root: "group flex items-center gap-2 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50",
|
|
14
13
|
control: [
|
|
15
|
-
"flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border border-
|
|
14
|
+
"flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border border-base transition-all",
|
|
16
15
|
"group-focus-visible:outline-none group-focus-visible:ring-2 group-focus-visible:ring-zinc-950",
|
|
17
16
|
"data-[checked]:bg-zinc-900 data-[checked]:border-zinc-900 data-[checked]:text-zinc-50",
|
|
18
17
|
"data-[disabled]:bg-zinc-400 data-[disabled]:border-zinc-400",
|
|
19
|
-
"dark:
|
|
18
|
+
"dark:data-[checked]:bg-zinc-50 dark:data-[checked]:text-zinc-900 dark:group-focus-visible:ring-zinc-300",
|
|
20
19
|
],
|
|
21
20
|
label: "text-sm font-medium leading-none select-none data-[disabled]:text-zinc-400",
|
|
22
21
|
indicator: "h-3.5 w-3.5",
|
|
@@ -8,11 +8,11 @@ const collapsibleStyles = tv(
|
|
|
8
8
|
slots: {
|
|
9
9
|
root: "w-full space-y-2",
|
|
10
10
|
trigger:
|
|
11
|
-
"flex w-full items-center justify-between border border-
|
|
11
|
+
"flex w-full items-center justify-between border border-light bg-foreground px-4 py-2 text-sm font-medium hover:bg-foreground/80 transition-all group mb-0",
|
|
12
12
|
content:
|
|
13
13
|
"overflow-hidden text-sm transition-all data-[expanded]:animate-collapsible-down data-[closed]:animate-collapsible-up",
|
|
14
14
|
contentInner:
|
|
15
|
-
"px-4 py-3 text-main border border-
|
|
15
|
+
"px-4 py-3 text-main border border-light !border-t-0",
|
|
16
16
|
icon: "h-4 w-4 text-zinc-500 transition-transform duration-200 group-data-[expanded]:rotate-180",
|
|
17
17
|
},
|
|
18
18
|
},
|
|
@@ -5,7 +5,7 @@ import { tv } from "tailwind-variants";
|
|
|
5
5
|
const colorAreaStyles = tv(
|
|
6
6
|
{
|
|
7
7
|
slots: {
|
|
8
|
-
root: "relative h-48 w-full shrink-0 rounded-lg border border-
|
|
8
|
+
root: "relative h-48 w-full shrink-0 rounded-lg border border-base touch-none",
|
|
9
9
|
background: "h-full w-full rounded-[inherit]",
|
|
10
10
|
thumb: [
|
|
11
11
|
"z-10 h-5 w-5 rounded-full border-2 border-white bg-transparent shadow-md transition-[transform]",
|
|
@@ -11,11 +11,11 @@ const comboboxStyles = tv(
|
|
|
11
11
|
root: "flex flex-col gap-1.5 w-full",
|
|
12
12
|
label: "text-sm font-medium text-zinc-900 dark:text-zinc-100 select-none",
|
|
13
13
|
control:
|
|
14
|
-
"relative flex items-center rounded-md border border-
|
|
14
|
+
"relative flex items-center rounded-md border border-base bg-app shadow-sm transition-colors focus-within:ring-1 focus-within:ring-zinc-950 dark:focus-within:ring-zinc-300",
|
|
15
15
|
input: "h-9 w-full bg-transparent px-3 py-1 text-sm outline-none placeholder:text-zinc-500 disabled:cursor-not-allowed",
|
|
16
16
|
trigger: "flex h-9 w-9 items-center justify-center text-zinc-500",
|
|
17
17
|
content: [
|
|
18
|
-
"z-50 min-w-[8rem] overflow-hidden rounded-md border border-
|
|
18
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border border-base bg-app text-zinc-950 shadow-md animate-in zoom-in-95 dark:text-zinc-50",
|
|
19
19
|
"data-[expanded]:animate-in data-[closed]:animate-out",
|
|
20
20
|
],
|
|
21
21
|
listbox: "p-1",
|
|
@@ -9,11 +9,11 @@ const menuStyles = tv(
|
|
|
9
9
|
{
|
|
10
10
|
slots: {
|
|
11
11
|
content: [
|
|
12
|
-
"z-50 min-w-[10rem] overflow-hidden rounded-md border border-
|
|
12
|
+
"z-50 min-w-[10rem] overflow-hidden rounded-md border border-light bg-app p-1 text-main shadow-md dark:text-zinc-50",
|
|
13
13
|
"data-[expanded]:animate-in data-[closed]:animate-out",
|
|
14
14
|
],
|
|
15
|
-
item: "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[highlighted]:bg-
|
|
16
|
-
separator: "-mx-1 my-1 h-px
|
|
15
|
+
item: "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[highlighted]:bg-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 ",
|
|
16
|
+
separator: "-mx-1 my-1 h-px border-light",
|
|
17
17
|
subIcon: "ml-auto h-4 w-4",
|
|
18
18
|
},
|
|
19
19
|
},
|
package/src/dialog/dialog.tsx
CHANGED
|
@@ -10,13 +10,12 @@ const dialogStyles = tv(
|
|
|
10
10
|
{
|
|
11
11
|
slots: {
|
|
12
12
|
overlay: [
|
|
13
|
-
"fixed inset-0 z-50
|
|
13
|
+
"fixed inset-0 z-50 backdrop-blur-sm animate-in duration-200",
|
|
14
14
|
"data-[expanded]:animate-in data-[closed]:animate-out",
|
|
15
15
|
],
|
|
16
16
|
content: [
|
|
17
17
|
[
|
|
18
|
-
"fixed left-[50%] top-[50%] z-50 w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-
|
|
19
|
-
"animate-in fade-in-0 zoom-in-95 duration-200 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-50",
|
|
18
|
+
"fixed left-[50%] top-[50%] z-50 w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-base bg-app text-main p-4 shadow-lg rounded-xl",
|
|
20
19
|
"data-[expanded]:animate-in data-[closed]:animate-out",
|
|
21
20
|
],
|
|
22
21
|
],
|
|
@@ -3,18 +3,18 @@ import { splitProps, type JSX, For, Show } from "solid-js";
|
|
|
3
3
|
import { tv } from "tailwind-variants";
|
|
4
4
|
import { ChevronRight } from "lucide-solid";
|
|
5
5
|
|
|
6
|
-
// TODO 样式
|
|
6
|
+
// TODO Dropdown Menu 样式
|
|
7
7
|
|
|
8
8
|
const menuStyles = tv(
|
|
9
9
|
{
|
|
10
10
|
slots: {
|
|
11
11
|
trigger: "inline-block cursor-pointer",
|
|
12
12
|
content: [
|
|
13
|
-
"z-50 min-w-[8rem] overflow-hidden rounded-md border border-
|
|
13
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border border-light bg-white p-1 text-zinc-950 shadow-md animate-in zoom-in-95 dark:bg-zinc-950 dark:text-zinc-50",
|
|
14
14
|
"data-[expanded]:animate-in data-[closed]:animate-out",
|
|
15
15
|
],
|
|
16
16
|
item: "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[highlighted]:bg-zinc-100 data-[highlighted]:text-zinc-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:data-[highlighted]:bg-zinc-800 dark:data-[highlighted]:text-zinc-50",
|
|
17
|
-
separator: "-mx-1 my-1 h-px
|
|
17
|
+
separator: "-mx-1 my-1 h-px border-light",
|
|
18
18
|
subIcon: "ml-auto h-4 w-4",
|
|
19
19
|
},
|
|
20
20
|
},
|
|
@@ -6,8 +6,7 @@ const hoverCardStyles = tv(
|
|
|
6
6
|
{
|
|
7
7
|
slots: {
|
|
8
8
|
content: [
|
|
9
|
-
"z-50 w-64 rounded-xl border bg-
|
|
10
|
-
"dark:bg-slate-900 dark:border-slate-800 antialiased",
|
|
9
|
+
"z-50 w-64 rounded-xl border border-light bg-app p-4 shadow-lg outline-none",
|
|
11
10
|
"data-[expanded]:animate-in data-[closed]:animate-out",
|
|
12
11
|
],
|
|
13
12
|
arrow: "fill-white stroke-slate-200 dark:fill-slate-900 dark:stroke-slate-800",
|
package/src/index.tsx
CHANGED
package/src/link/link.tsx
CHANGED
|
@@ -8,11 +8,11 @@ const linkStyles = tv(
|
|
|
8
8
|
variants: {
|
|
9
9
|
variant: {
|
|
10
10
|
default:
|
|
11
|
-
"text-
|
|
11
|
+
"text-main hover:text-main/80 underline-offset-4",
|
|
12
12
|
primary:
|
|
13
|
-
"text-
|
|
14
|
-
muted: "text-
|
|
15
|
-
button: "bg-
|
|
13
|
+
"text-primary hover:text-primary/80 font-medium",
|
|
14
|
+
muted: "text-muted hover:text-muted/80",
|
|
15
|
+
button: "bg-reversal-bg text-reversal hover:reversal-bg/90 px-4 py-2 text-sm ",
|
|
16
16
|
},
|
|
17
17
|
underline: {
|
|
18
18
|
always: "underline",
|
package/src/menubar/menubar.tsx
CHANGED
|
@@ -7,15 +7,19 @@ import { tv } from "tailwind-variants";
|
|
|
7
7
|
const menubarStyles = tv(
|
|
8
8
|
{
|
|
9
9
|
slots: {
|
|
10
|
-
root: "flex h-10 items-center space-x-1 rounded-md border bg-
|
|
10
|
+
root: "flex h-10 items-center space-x-1 rounded-md border bg-app p-1 shadow-sm ",
|
|
11
11
|
trigger:
|
|
12
|
-
"flex cursor-default select-none items-center rounded-sm px-3 py-1.5 text-sm font-medium outline-none focus:
|
|
12
|
+
"flex cursor-default select-none items-center rounded-sm px-3 py-1.5 text-sm font-medium outline-none focus:foreground data-[state=open]:foreground",
|
|
13
13
|
content: [
|
|
14
|
-
"z-50 min-w-[12rem] overflow-hidden rounded-md border bg-
|
|
14
|
+
"z-50 min-w-[12rem] overflow-hidden rounded-md border bg-app p-1 shadow-md border-light animate-in fade-in zoom-in-95",
|
|
15
15
|
"data-[expanded]:animate-in data-[closed]:animate-out",
|
|
16
16
|
],
|
|
17
|
-
item:
|
|
18
|
-
|
|
17
|
+
item: [
|
|
18
|
+
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none ",
|
|
19
|
+
|
|
20
|
+
"focus:bg-foreground data-[disabled]:opacity-50",
|
|
21
|
+
],
|
|
22
|
+
separator: "-mx-1 my-1 h-px border-light",
|
|
19
23
|
shortcut: "ml-auto text-xs tracking-widest text-slate-500",
|
|
20
24
|
},
|
|
21
25
|
},
|
package/src/meter/meter.tsx
CHANGED
|
@@ -9,16 +9,16 @@ const meterStyles = tv(
|
|
|
9
9
|
slots: {
|
|
10
10
|
root: "flex flex-col gap-2 w-full antialiased",
|
|
11
11
|
labelContainer:
|
|
12
|
-
"flex justify-between items-center text-sm font-medium text-
|
|
13
|
-
track: "h-2.5 w-full rounded-full bg-
|
|
12
|
+
"flex justify-between items-center text-sm font-medium text-main",
|
|
13
|
+
track: "h-2.5 w-full rounded-full bg-foreground overflow-hidden",
|
|
14
14
|
fill: "h-full transition-all duration-500 ease-out rounded-full",
|
|
15
15
|
},
|
|
16
16
|
variants: {
|
|
17
17
|
color: {
|
|
18
|
-
primary: { fill: "bg-
|
|
19
|
-
success: { fill: "bg-
|
|
20
|
-
warning: { fill: "bg-
|
|
21
|
-
danger: { fill: "bg-
|
|
18
|
+
primary: { fill: "bg-primary" },
|
|
19
|
+
success: { fill: "bg-success" },
|
|
20
|
+
warning: { fill: "bg-warning" },
|
|
21
|
+
danger: { fill: "bg-danger" },
|
|
22
22
|
},
|
|
23
23
|
},
|
|
24
24
|
defaultVariants: {
|
|
@@ -7,20 +7,19 @@ const numberFieldStyles = tv(
|
|
|
7
7
|
{
|
|
8
8
|
slots: {
|
|
9
9
|
root: "flex flex-col gap-1.5 w-full antialiased",
|
|
10
|
-
label: "text-sm font-medium text-
|
|
10
|
+
label: "text-sm font-medium text-main ml-1",
|
|
11
11
|
container: [
|
|
12
|
-
"relative flex items-center rounded-md border border-slate-200 bg-
|
|
12
|
+
"relative flex items-center rounded-md border border-slate-200 bg-app transition-shadow shadow-sm",
|
|
13
13
|
"focus-within:ring-2 focus-within:ring-blue-500/20 focus-within:border-blue-500",
|
|
14
|
-
"dark:bg-slate-950 dark:border-slate-800",
|
|
15
14
|
],
|
|
16
|
-
input: "flex-1 bg-transparent px-3 py-2 text-sm outline-none placeholder:text-
|
|
15
|
+
input: "flex-1 bg-transparent px-3 py-2 text-sm outline-none placeholder:text-muted disabled:cursor-not-allowed",
|
|
17
16
|
controls:
|
|
18
17
|
"flex flex-col border-l border-slate-200 dark:border-slate-800",
|
|
19
18
|
stepper: [
|
|
20
|
-
"flex h-1/2 w-8 items-center justify-center transition-colors hover:bg-
|
|
21
|
-
"
|
|
19
|
+
"flex h-1/2 w-8 items-center justify-center transition-colors hover:bg-foreground active:bg-foreground",
|
|
20
|
+
"disabled:opacity-30 disabled:pointer-events-none",
|
|
22
21
|
],
|
|
23
|
-
errorMessage: "text-xs text-
|
|
22
|
+
errorMessage: "text-xs text-danger font-medium ml-1 mt-1",
|
|
24
23
|
},
|
|
25
24
|
},
|
|
26
25
|
{
|
|
@@ -12,15 +12,14 @@ const paginationStyles = tv(
|
|
|
12
12
|
root: "flex w-full justify-center antialiased",
|
|
13
13
|
itemsContainer: "flex items-center gap-1",
|
|
14
14
|
item: [
|
|
15
|
-
"inline-flex h-9 w-9 items-center justify-center rounded-md text-sm font-medium transition-colors",
|
|
16
|
-
"hover:bg-
|
|
17
|
-
"data-[
|
|
18
|
-
"dark:hover:bg-slate-800 dark:hover:text-slate-50 dark:data-[selected]:bg-slate-50 dark:data-[selected]:text-slate-900",
|
|
15
|
+
"inline-flex h-9 w-9 items-center justify-center rounded-md text-sm font-medium transition-colors text-main",
|
|
16
|
+
"hover:bg-foreground hover:text-muted",
|
|
17
|
+
"data-[current]:bg-foreground data-[current]:text-muted",
|
|
19
18
|
"disabled:pointer-events-none disabled:opacity-50",
|
|
20
19
|
],
|
|
21
20
|
ellipsis: "flex h-9 w-9 items-center justify-center text-slate-400",
|
|
22
21
|
trigger:
|
|
23
|
-
"inline-flex h-9 w-9 items-center justify-center rounded-md border border-
|
|
22
|
+
"inline-flex h-9 w-9 items-center justify-center rounded-md border border-light bg-transparent hover:bg-foreground ",
|
|
24
23
|
},
|
|
25
24
|
},
|
|
26
25
|
{
|
package/src/popover/popover.tsx
CHANGED
|
@@ -11,11 +11,10 @@ const popoverStyles = tv(
|
|
|
11
11
|
{
|
|
12
12
|
slots: {
|
|
13
13
|
content: [
|
|
14
|
-
"z-50 w-72 rounded-md border bg-
|
|
15
|
-
"dark:bg-slate-950 dark:border-slate-800 dark:text-slate-50",
|
|
14
|
+
"z-50 w-72 rounded-md border border-light bg-app p-4 shadow-md outline-none antialiased text-main",
|
|
16
15
|
"data-[expanded]:animate-in data-[closed]:animate-out",
|
|
17
16
|
],
|
|
18
|
-
arrow: "fill-
|
|
17
|
+
arrow: "fill-app stroke-slate-200 dark:stroke-slate-800",
|
|
19
18
|
},
|
|
20
19
|
},
|
|
21
20
|
{
|
|
@@ -10,8 +10,8 @@ const progressStyles = tv(
|
|
|
10
10
|
root: "flex flex-col gap-2 w-full antialiased",
|
|
11
11
|
labelContainer:
|
|
12
12
|
"flex justify-between items-center text-sm font-medium text-slate-700 dark:text-slate-300",
|
|
13
|
-
track: "h-2 w-full rounded-full bg-
|
|
14
|
-
fill: "h-full bg-
|
|
13
|
+
track: "h-2 w-full rounded-full bg-appoverflow-hidden",
|
|
14
|
+
fill: "h-full bg-primary transition-all duration-300 ease-in-out data-[indeterminate]:animate-progress-indeterminate",
|
|
15
15
|
},
|
|
16
16
|
variants: {
|
|
17
17
|
size: {
|