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
|
@@ -6,17 +6,17 @@ const radioStyles = tv(
|
|
|
6
6
|
{
|
|
7
7
|
slots: {
|
|
8
8
|
root: "flex flex-col gap-3 antialiased",
|
|
9
|
-
label: "text-sm font-semibold text-
|
|
9
|
+
label: "text-sm font-semibold text-main mb-1",
|
|
10
10
|
item: "group flex items-center gap-3 cursor-pointer disabled:cursor-not-allowed",
|
|
11
11
|
control: [
|
|
12
|
-
"flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-slate-300 bg-
|
|
13
|
-
"group-hover:border-
|
|
12
|
+
"flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-slate-300 bg-app transition-all shadow-sm",
|
|
13
|
+
"group-hover:border-light group-data-[checked]:border-primary group-data-[checked]:bg-primary",
|
|
14
14
|
"group-focus-visible:ring-2 group-focus-visible:ring-blue-500/20",
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
],
|
|
17
|
-
indicator: "h-2 w-2 rounded-full bg-
|
|
17
|
+
indicator: "h-2 w-2 rounded-full bg-app shadow-sm",
|
|
18
18
|
itemLabel:
|
|
19
|
-
"text-sm font-medium text-
|
|
19
|
+
"text-sm font-medium text-main group-data-[disabled]:opacity-50",
|
|
20
20
|
},
|
|
21
21
|
variants: {
|
|
22
22
|
orientation: {
|
package/src/search/search.tsx
CHANGED
|
@@ -9,13 +9,13 @@ const searchStyles = tv(
|
|
|
9
9
|
root: "relative flex flex-col gap-1.5 w-full",
|
|
10
10
|
inputWrapper: "relative flex items-center transition-all",
|
|
11
11
|
input: [
|
|
12
|
-
"flex h-10 w-full rounded-md border border-
|
|
13
|
-
"ring-offset-
|
|
14
|
-
"placeholder:text-
|
|
15
|
-
"disabled:cursor-not-allowed disabled:opacity-50
|
|
12
|
+
"flex h-10 w-full rounded-md border border-light bg-app px-9 py-2 text-sm",
|
|
13
|
+
"ring-offset-app file:border-0 file:bg-transparent file:text-sm file:font-medium",
|
|
14
|
+
"placeholder:text-muted focus-visible:outline-none focus-visible:ring-2",
|
|
15
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
16
16
|
],
|
|
17
|
-
icon: "absolute left-3 h-4 w-4 text-
|
|
18
|
-
clear: "absolute right-3 h-4 w-4 text-
|
|
17
|
+
icon: "absolute left-3 h-4 w-4 text-main pointer-events-none",
|
|
18
|
+
clear: "absolute right-3 h-4 w-4 text-main hover:text-muted cursor-pointer transition-colors",
|
|
19
19
|
},
|
|
20
20
|
variants: {
|
|
21
21
|
size: {
|
|
@@ -36,8 +36,8 @@ const searchStyles = tv(
|
|
|
36
36
|
},
|
|
37
37
|
},
|
|
38
38
|
ringColor: {
|
|
39
|
-
primary: { input: "focus-visible:ring-
|
|
40
|
-
danger: { input: "focus-visible:ring-
|
|
39
|
+
primary: { input: "focus-visible:ring-primary" },
|
|
40
|
+
danger: { input: "focus-visible:ring-danger" },
|
|
41
41
|
},
|
|
42
42
|
},
|
|
43
43
|
defaultVariants: {
|
|
@@ -9,15 +9,15 @@ const segmentedStyles = tv(
|
|
|
9
9
|
slots: {
|
|
10
10
|
root: "relative flex flex-col",
|
|
11
11
|
container:
|
|
12
|
-
"relative flex items-center w-full rounded-lg bg-
|
|
12
|
+
"relative flex items-center w-full rounded-lg bg-foreground p-1 text-main",
|
|
13
13
|
item: [
|
|
14
14
|
" z-10 inline-flex flex-1 items-center justify-center whitespace-nowrap rounded-md px-3 py-1.5 text-sm font-medium transition-all cursor-pointer",
|
|
15
15
|
"outline-none focus-visible:ring-2 focus-visible:ring-slate-400 focus-visible:ring-offset-2",
|
|
16
16
|
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
17
|
-
"
|
|
17
|
+
" transition-colors duration-200",
|
|
18
18
|
],
|
|
19
19
|
indicator:
|
|
20
|
-
"absolute z-0 bg-
|
|
20
|
+
"absolute z-0 bg-app shadow-sm rounded-md transition-all duration-200 ease-in-out ",
|
|
21
21
|
label: "mb-2 text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
22
22
|
itemLabel: "flex w-full cursor-pointer items-center justify-center",
|
|
23
23
|
},
|
package/src/select/select.tsx
CHANGED
|
@@ -7,25 +7,24 @@ const selectStyles = tv(
|
|
|
7
7
|
{
|
|
8
8
|
slots: {
|
|
9
9
|
root: "flex flex-col gap-1.5 w-full",
|
|
10
|
-
label: "text-sm font-medium text-
|
|
10
|
+
label: "text-sm font-medium text-muted",
|
|
11
11
|
trigger: [
|
|
12
|
-
"flex h-10 w-full items-center justify-between rounded-md border border-
|
|
13
|
-
"ring-offset-white placeholder:text-
|
|
14
|
-
"disabled:cursor-not-allowed disabled:opacity-50
|
|
12
|
+
"flex h-10 w-full text-main items-center justify-between rounded-md border border-light bg-app px-3 py-2 text-sm",
|
|
13
|
+
"ring-offset-white placeholder:text-muted focus:outline-none focus:ring-1 focus:ring-blue-500",
|
|
14
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
15
15
|
],
|
|
16
16
|
content: [
|
|
17
|
-
"relative z-50 min-w-[8rem] overflow-hidden rounded-md border border-
|
|
18
|
-
"data-[expanded]:animate-in data-[closed]:animate-out
|
|
17
|
+
"relative z-50 min-w-[8rem] overflow-hidden rounded-md border border-light bg-app shadow-md text-main",
|
|
18
|
+
"data-[expanded]:animate-in data-[closed]:animate-out",
|
|
19
19
|
],
|
|
20
20
|
listbox: "p-1",
|
|
21
21
|
item: [
|
|
22
22
|
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none",
|
|
23
|
-
"focus:bg-
|
|
24
|
-
"dark:focus:bg-slate-800 dark:focus:text-slate-50",
|
|
23
|
+
"focus:bg-foreground focus:text-main data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
25
24
|
],
|
|
26
25
|
itemIndicator:
|
|
27
26
|
"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",
|
|
28
|
-
description: "
|
|
27
|
+
description: "mt-1 text-xs text-muted",
|
|
29
28
|
},
|
|
30
29
|
variants: {
|
|
31
30
|
size: {
|
|
@@ -4,7 +4,7 @@ import { tv, type VariantProps } from "tailwind-variants";
|
|
|
4
4
|
|
|
5
5
|
const separatorStyles = tv(
|
|
6
6
|
{
|
|
7
|
-
base: "bg-
|
|
7
|
+
base: "bg-foreground shrink-0 transition-colors",
|
|
8
8
|
variants: {
|
|
9
9
|
orientation: {
|
|
10
10
|
horizontal: "h-[1px] w-full my-4",
|
|
@@ -16,9 +16,11 @@ const separatorStyles = tv(
|
|
|
16
16
|
thick: "data-[orientation=horizontal]:h-[4px] data-[orientation=vertical]:w-[4px] rounded-full",
|
|
17
17
|
},
|
|
18
18
|
variant: {
|
|
19
|
-
default: "bg-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
default: "bg-foreground",
|
|
20
|
+
primary: "bg-primary",
|
|
21
|
+
success: "bg-success",
|
|
22
|
+
warning: "bg-warning",
|
|
23
|
+
danger: "bg-danger",
|
|
22
24
|
},
|
|
23
25
|
},
|
|
24
26
|
defaultVariants: {
|
package/src/slider/slider.tsx
CHANGED
|
@@ -2,28 +2,31 @@ import { Slider as KSlider } from "@kobalte/core/slider";
|
|
|
2
2
|
import { splitProps, type ComponentProps, For, Show } from "solid-js";
|
|
3
3
|
import { tv, type VariantProps } from "tailwind-variants";
|
|
4
4
|
|
|
5
|
+
// FIXME 点击轨道时报错
|
|
6
|
+
|
|
5
7
|
const sliderStyles = tv(
|
|
6
8
|
{
|
|
7
9
|
slots: {
|
|
8
10
|
root: "relative flex flex-col items-center select-none touch-none w-full gap-2",
|
|
9
11
|
labelWrapper: "flex w-full justify-between items-center",
|
|
10
|
-
label: "text-sm font-medium text-
|
|
11
|
-
value: "text-sm text-
|
|
12
|
-
track: "relative h-2 w-full grow rounded-full bg-
|
|
13
|
-
fill: "absolute h-full rounded-full
|
|
12
|
+
label: "text-sm font-medium text-muted",
|
|
13
|
+
value: "text-sm text-muted font-mono",
|
|
14
|
+
track: "relative h-2 w-full grow rounded-full bg-foreground",
|
|
15
|
+
fill: "absolute h-full rounded-full ",
|
|
14
16
|
thumb: [
|
|
15
|
-
"block h-5 w-5 rounded-full border-2
|
|
17
|
+
"block h-5 w-5 rounded-full border-2 bg-app ring-offset-white transition-colors",
|
|
16
18
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400 focus-visible:ring-offset-2",
|
|
17
19
|
"disabled:pointer-events-none disabled:opacity-50 hover:scale-110 active:scale-95 transition-transform",
|
|
18
20
|
],
|
|
19
21
|
},
|
|
20
22
|
variants: {
|
|
21
23
|
variant: {
|
|
22
|
-
default: { fill: "bg-
|
|
23
|
-
danger: { fill: "bg-
|
|
24
|
+
default: { fill: "bg-primary", thumb: "border-primary" },
|
|
25
|
+
danger: { fill: "bg-danger", thumb: "border-danger" },
|
|
26
|
+
warning: { fill: "bg-warning", thumb: "border-warning" },
|
|
24
27
|
success: {
|
|
25
|
-
fill: "bg-
|
|
26
|
-
thumb: "border-
|
|
28
|
+
fill: "bg-success",
|
|
29
|
+
thumb: "border-success",
|
|
27
30
|
},
|
|
28
31
|
},
|
|
29
32
|
size: {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
@import "tailwindcss";
|
|
2
2
|
|
|
3
|
-
/* --- 1. 先定义 CSS 变量 --- */
|
|
4
3
|
@layer theme {
|
|
5
4
|
:root {
|
|
6
5
|
--primary: var(--color-blue-600);
|
|
@@ -8,22 +7,27 @@
|
|
|
8
7
|
--warning: var(--color-orange-600);
|
|
9
8
|
--danger: var(--color-red-600);
|
|
10
9
|
|
|
11
|
-
--app-bg:
|
|
12
|
-
--app-
|
|
13
|
-
--app-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
--app-
|
|
17
|
-
--
|
|
10
|
+
--app-bg: var(--color-white); /* 应用背景色 */
|
|
11
|
+
--app-bg-reversal: var(--color-zinc-900); /* 应用反转背景色 */
|
|
12
|
+
--app-foreground: var(--color-zinc-100); /* 应用前景色 */
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
--app-text-main: var(--color-zinc-950); /* 应用主文字色 */
|
|
16
|
+
--app-text-muted: var(--color-zinc-600); /* 应用次级文字色*/
|
|
17
|
+
--app-border: var(--color-zinc-500); /* 应用边框色*/
|
|
18
|
+
--app-border-light: var(--color-zinc-300); /* 应用浅边框色 */
|
|
19
|
+
--app-ring: var(--color-zinc-300);
|
|
20
|
+
--app-text-reversal: var(--color-zinc-100); /* 应用反转文字色 */
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
[data-theme="dark"] {
|
|
21
|
-
--app-text-reversal:
|
|
24
|
+
--app-text-reversal: var(--color-zinc-950);
|
|
25
|
+
--app-bg-reversal: var(--color-zinc-50);
|
|
22
26
|
--app-bg: var(--color-zinc-950);
|
|
23
27
|
--app-text-main: var(--color-zinc-50);
|
|
24
28
|
--app-text-muted: var(--color-zinc-400);
|
|
25
29
|
--app-ring: var(--color-zinc-600);
|
|
26
|
-
--
|
|
30
|
+
--app-foreground: var(--color-zinc-900);
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
[data-theme="coffee"] {
|
|
@@ -31,7 +35,7 @@
|
|
|
31
35
|
--app-text-main: #f3e5d8;
|
|
32
36
|
--app-ring: #8b5e3c;
|
|
33
37
|
}
|
|
34
|
-
|
|
38
|
+
|
|
35
39
|
@keyframes accordion-down {
|
|
36
40
|
from {
|
|
37
41
|
height: 0;
|
|
@@ -120,13 +124,15 @@
|
|
|
120
124
|
--color-success: var(--success);
|
|
121
125
|
--color-warning: var(--warning);
|
|
122
126
|
--color-danger: var(--danger);
|
|
123
|
-
|
|
124
|
-
--color-header: var(--container-header);
|
|
127
|
+
|
|
125
128
|
--color-app: var(--app-bg);
|
|
129
|
+
--color-foreground: var(--app-foreground);
|
|
130
|
+
--color-reversal-bg: var(--app-bg-reversal);
|
|
126
131
|
--color-main: var(--app-text-main);
|
|
127
132
|
--color-muted: var(--app-text-muted);
|
|
133
|
+
--color-reversal: var(--app-text-reversal);
|
|
128
134
|
--color-base: var(--app-border);
|
|
129
|
-
--color-
|
|
135
|
+
--color-light: var(--app-border-light);
|
|
130
136
|
--radius-app: 0.75rem;
|
|
131
137
|
|
|
132
138
|
/* 注册动画到主题 */
|
package/src/switch/switch.tsx
CHANGED
|
@@ -8,16 +8,16 @@ const switchStyles = tv(
|
|
|
8
8
|
root: "inline-flex items-center gap-2 group",
|
|
9
9
|
control: [
|
|
10
10
|
"inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors",
|
|
11
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-
|
|
11
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-primary focus-visible:ring-offset-2",
|
|
12
12
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
13
|
-
"bg-
|
|
13
|
+
"bg-foreground data-[checked]:bg-primary",
|
|
14
14
|
],
|
|
15
15
|
thumb: [
|
|
16
|
-
"pointer-events-none block h-5 w-5 rounded-full bg-
|
|
16
|
+
"pointer-events-none block h-5 w-5 rounded-full bg-app shadow-lg ring-0 transition-transform",
|
|
17
17
|
"data-[checked]:translate-x-5 translate-x-0",
|
|
18
18
|
],
|
|
19
19
|
label: "text-sm font-medium leading-none group-data-[disabled]:opacity-70",
|
|
20
|
-
description: "text-xs text-
|
|
20
|
+
description: "text-xs text-muted",
|
|
21
21
|
},
|
|
22
22
|
variants: {
|
|
23
23
|
size: {
|
|
@@ -37,15 +37,15 @@ const switchStyles = tv(
|
|
|
37
37
|
variant: {
|
|
38
38
|
primary: {
|
|
39
39
|
control:
|
|
40
|
-
"data-[checked]:bg-
|
|
40
|
+
"data-[checked]:bg-primary",
|
|
41
41
|
},
|
|
42
42
|
success: {
|
|
43
43
|
control:
|
|
44
|
-
"data-[checked]:bg-
|
|
44
|
+
"data-[checked]:bg-success",
|
|
45
45
|
},
|
|
46
46
|
danger: {
|
|
47
47
|
control:
|
|
48
|
-
"data-[checked]:bg-
|
|
48
|
+
"data-[checked]:bg-danger",
|
|
49
49
|
},
|
|
50
50
|
},
|
|
51
51
|
},
|
package/src/tabs/tabs.tsx
CHANGED
|
@@ -6,16 +6,16 @@ const tabsStyles = tv(
|
|
|
6
6
|
{
|
|
7
7
|
slots: {
|
|
8
8
|
root: "flex flex-col w-full",
|
|
9
|
-
list: "relative flex items-center border-b border-
|
|
9
|
+
list: "relative flex items-center border-b border-base",
|
|
10
10
|
trigger: [
|
|
11
11
|
"relative flex h-9 items-center justify-center px-4 text-sm font-medium transition-colors outline-none select-none cursor-pointer",
|
|
12
|
-
"text-
|
|
13
|
-
"data-[selected]:text-
|
|
12
|
+
"text-muted hover:text-muted/80 ",
|
|
13
|
+
"data-[selected]:text-main",
|
|
14
14
|
],
|
|
15
15
|
indicator:
|
|
16
|
-
"absolute bottom-[-1px] h-0.5 bg-
|
|
16
|
+
"absolute bottom-[-1px] h-0.5 bg-reversal-bg transition-all duration-200",
|
|
17
17
|
content:
|
|
18
|
-
"mt-4 text-sm text-
|
|
18
|
+
"mt-4 text-sm text-main focus-visible:outline-none",
|
|
19
19
|
},
|
|
20
20
|
},
|
|
21
21
|
{
|
|
@@ -6,17 +6,17 @@ const textFieldStyles = tv(
|
|
|
6
6
|
{
|
|
7
7
|
slots: {
|
|
8
8
|
root: "flex flex-col gap-1.5 w-full",
|
|
9
|
-
label: "text-sm font-medium text-
|
|
9
|
+
label: "text-sm font-medium text-muted peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
10
10
|
input: [
|
|
11
|
-
"flex h-10 w-full rounded-md border border-
|
|
11
|
+
"flex h-10 w-full rounded-md border border-light bg-app px-3 py-2 text-sm transition-shadow text-main",
|
|
12
12
|
"ring-offset-white file:border-0 file:bg-transparent file:text-sm file:font-medium",
|
|
13
|
-
"placeholder:text-
|
|
14
|
-
"disabled:cursor-not-allowed disabled:opacity-50
|
|
15
|
-
"data-[invalid]:border-
|
|
13
|
+
"placeholder:text-muted/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary",
|
|
14
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
15
|
+
"data-[invalid]:border-danger data-[invalid]:focus-visible:ring-danger",
|
|
16
16
|
],
|
|
17
|
-
description: "text-xs text-
|
|
17
|
+
description: "text-xs text-muted",
|
|
18
18
|
errorMessage:
|
|
19
|
-
"text-xs text-
|
|
19
|
+
"text-xs text-danger animate-in fade-in-50 slide-in-from-top-1",
|
|
20
20
|
},
|
|
21
21
|
variants: {
|
|
22
22
|
size: {
|
package/src/toast/toast.tsx
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Toast as KToast, toaster } from "@kobalte/core/toast";
|
|
2
|
+
|
|
3
|
+
import { isServer } from "solid-js/web";
|
|
2
4
|
import {
|
|
3
5
|
splitProps,
|
|
4
6
|
type ComponentProps,
|
|
@@ -24,8 +26,8 @@ const toastStyles = tv(
|
|
|
24
26
|
title: "text-sm font-semibold",
|
|
25
27
|
description: "text-xs opacity-90 leading-relaxed",
|
|
26
28
|
closeButton: [
|
|
27
|
-
"absolute right-2 top-2 rounded-md p-1
|
|
28
|
-
"focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100
|
|
29
|
+
"absolute right-2 top-2 rounded-md p-1 opacity-0 transition-opacity hover:text-main",
|
|
30
|
+
"focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100",
|
|
29
31
|
],
|
|
30
32
|
content: "flex flex-col gap-1 flex-1",
|
|
31
33
|
icon: "h-5 w-5 shrink-0 mt-0.5", // 稍微下移一点对齐文字
|
|
@@ -33,20 +35,20 @@ const toastStyles = tv(
|
|
|
33
35
|
variants: {
|
|
34
36
|
variant: {
|
|
35
37
|
info: {
|
|
36
|
-
root: "bg-
|
|
37
|
-
icon: "text-
|
|
38
|
+
root: "bg-app border-light text-main",
|
|
39
|
+
icon: "text-primary",
|
|
38
40
|
},
|
|
39
41
|
success: {
|
|
40
|
-
root: "bg-
|
|
41
|
-
icon: "text-
|
|
42
|
+
root: "bg-success/50 border-success text-success",
|
|
43
|
+
icon: "text-success",
|
|
42
44
|
},
|
|
43
45
|
warning: {
|
|
44
|
-
root: "bg-
|
|
45
|
-
icon: "text-
|
|
46
|
+
root: "bg-warning/50 border-warning text-warning",
|
|
47
|
+
icon: "text-warning",
|
|
46
48
|
},
|
|
47
49
|
error: {
|
|
48
|
-
root: "bg-
|
|
49
|
-
icon: "text-
|
|
50
|
+
root: "bg-danger/50 border-danger text-danger",
|
|
51
|
+
icon: "text-danger",
|
|
50
52
|
},
|
|
51
53
|
},
|
|
52
54
|
},
|
|
@@ -73,7 +75,6 @@ const iconMap = {
|
|
|
73
75
|
error: CircleAlert,
|
|
74
76
|
} as const; // 使用 const 断言增强类型推导
|
|
75
77
|
|
|
76
|
-
// 优化:允许包裹 Children,这样在 App.tsx 顶层包裹即可
|
|
77
78
|
export const ToastProvider = (props: ParentProps) => {
|
|
78
79
|
return (
|
|
79
80
|
<>
|
|
@@ -124,5 +125,8 @@ const Toast = (props: ToastProps) => {
|
|
|
124
125
|
};
|
|
125
126
|
|
|
126
127
|
export const showToast = (props: Omit<ToastProps, "toastId">) => {
|
|
128
|
+
if (isServer) {
|
|
129
|
+
return { toastId: () => "server-id" }; // 给个假实现,不报错就行
|
|
130
|
+
}
|
|
127
131
|
return toaster.show((data) => <Toast toastId={data.toastId} {...props} />);
|
|
128
132
|
};
|
|
@@ -2,19 +2,20 @@ import { ToggleButton as KToggle } from "@kobalte/core/toggle-button";
|
|
|
2
2
|
import { splitProps, type JSX, type ComponentProps } from "solid-js";
|
|
3
3
|
import { tv, type VariantProps } from "tailwind-variants";
|
|
4
4
|
|
|
5
|
+
// TODO 切换样式问题
|
|
6
|
+
|
|
5
7
|
const toggleStyles = tv(
|
|
6
8
|
{
|
|
7
9
|
base: [
|
|
8
10
|
"inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors",
|
|
9
|
-
"focus-visible:outline-none focus-visible:ring-
|
|
11
|
+
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-slate-400 focus-visible:ring-offset-1",
|
|
10
12
|
"disabled:pointer-events-none disabled:opacity-50 select-none cursor-pointer",
|
|
11
13
|
],
|
|
12
14
|
variants: {
|
|
13
15
|
variant: {
|
|
14
|
-
solid: "bg-
|
|
16
|
+
solid: "bg-foreground text-main hover:bg-foreground/80 data-[pressed]:bg-reversal-bg data-[pressed]:text-reversal",
|
|
15
17
|
outline:
|
|
16
|
-
"border border-
|
|
17
|
-
ghost: "bg-transparent hover:bg-slate-100 data-[pressed]:bg-slate-200 dark:hover:bg-slate-800 dark:data-[pressed]:bg-slate-800",
|
|
18
|
+
"border border-light bg-transparent hover:bg-slate-100 data-[pressed]:bg-slate-900 data-[pressed]:text-white dark:hover:bg-slate-800 dark:data-[pressed]:bg-slate-50 dark:data-[pressed]:text-slate-900",
|
|
18
19
|
},
|
|
19
20
|
size: {
|
|
20
21
|
sm: "h-8 px-3 text-xs",
|
|
@@ -8,24 +8,23 @@ import { tv, type VariantProps } from "tailwind-variants";
|
|
|
8
8
|
const toggleGroupStyles = tv(
|
|
9
9
|
{
|
|
10
10
|
slots: {
|
|
11
|
-
root: "inline-flex items-center justify-center rounded-md border border-
|
|
11
|
+
root: "inline-flex items-center justify-center rounded-md border border-light bg-transparent p-1",
|
|
12
12
|
item: [
|
|
13
13
|
"inline-flex items-center justify-center rounded-sm px-3 py-1.5 text-sm font-medium transition-all cursor-pointer",
|
|
14
14
|
"outline-none focus-visible:ring-2 focus-visible:ring-slate-400 focus-visible:ring-offset-2",
|
|
15
15
|
"disabled:pointer-events-none disabled:opacity-50",
|
|
16
|
-
"hover:bg-
|
|
17
|
-
"data-[pressed]:bg-slate-100 data-[pressed]:text-slate-900 dark:data-[pressed]:bg-slate-800 dark:data-[pressed]:text-slate-50",
|
|
16
|
+
"hover:bg-foreground/80 hover:text-muted/80",
|
|
18
17
|
],
|
|
19
|
-
},
|
|
18
|
+
},
|
|
20
19
|
variants: {
|
|
21
20
|
variant: {
|
|
22
21
|
default: {
|
|
23
22
|
root: "bg-transparent",
|
|
24
|
-
item: "data-[pressed]:bg-
|
|
23
|
+
item: "data-[pressed]:bg-foreground data-[pressed]:text-main",
|
|
25
24
|
},
|
|
26
25
|
outline: {
|
|
27
|
-
root: "border border-
|
|
28
|
-
item: "border-r last:border-r-0 border-
|
|
26
|
+
root: "border border-light",
|
|
27
|
+
item: "border-r last:border-r-0 border-light rounded-none first:rounded-l-md last:rounded-r-md",
|
|
29
28
|
},
|
|
30
29
|
},
|
|
31
30
|
size: {
|
package/src/tooltip/tooltip.tsx
CHANGED
|
@@ -2,14 +2,12 @@ import { Tooltip as KTooltip } from "@kobalte/core/tooltip";
|
|
|
2
2
|
import { splitProps, type JSX, type ComponentProps } from "solid-js";
|
|
3
3
|
import { tv, type VariantProps } from "tailwind-variants";
|
|
4
4
|
|
|
5
|
-
// FIXME 为什么没有箭头
|
|
6
|
-
|
|
7
5
|
const tooltipStyles = tv(
|
|
8
6
|
{
|
|
9
7
|
slots: {
|
|
10
8
|
content: [
|
|
11
|
-
"z-50
|
|
12
|
-
"animate-in
|
|
9
|
+
"z-50 rounded-md px-4 py-1.5 text-xs shadow-md",
|
|
10
|
+
"animate-in zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
13
11
|
],
|
|
14
12
|
arrow: "",
|
|
15
13
|
},
|
|
@@ -17,12 +15,12 @@ const tooltipStyles = tv(
|
|
|
17
15
|
variant: {
|
|
18
16
|
default: {
|
|
19
17
|
content:
|
|
20
|
-
"bg-
|
|
21
|
-
arrow: "
|
|
18
|
+
"bg-reversal-bg text-reversal ",
|
|
19
|
+
arrow: "fill-muted",
|
|
22
20
|
},
|
|
23
21
|
danger: {
|
|
24
|
-
content: "bg-
|
|
25
|
-
arrow: "
|
|
22
|
+
content: "bg-danger text-white",
|
|
23
|
+
arrow: "fill-danger",
|
|
26
24
|
},
|
|
27
25
|
},
|
|
28
26
|
},
|
|
@@ -56,8 +54,8 @@ export const Tooltip = (props: TooltipProps) => {
|
|
|
56
54
|
|
|
57
55
|
return (
|
|
58
56
|
<KTooltip
|
|
59
|
-
gutter={4}
|
|
60
|
-
openDelay={200}
|
|
57
|
+
gutter={4}
|
|
58
|
+
openDelay={200}
|
|
61
59
|
{...others}
|
|
62
60
|
>
|
|
63
61
|
<KTooltip.Trigger class="block">
|
|
@@ -66,10 +64,7 @@ export const Tooltip = (props: TooltipProps) => {
|
|
|
66
64
|
|
|
67
65
|
<KTooltip.Portal>
|
|
68
66
|
<KTooltip.Content class={styles.content()}>
|
|
69
|
-
|
|
70
|
-
fill="currentColor" 配合 styles.arrow() 里的 text 颜色实现变体同步
|
|
71
|
-
*/}
|
|
72
|
-
<KTooltip.Arrow class={styles.arrow()} size={8} />
|
|
67
|
+
<KTooltip.Arrow class={styles.arrow()} />
|
|
73
68
|
{local.content}
|
|
74
69
|
</KTooltip.Content>
|
|
75
70
|
</KTooltip.Portal>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|