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.
Files changed (83) hide show
  1. package/dist/{src/alert-dialog → alert-dialog}/alert-dialog.d.ts +1 -1
  2. package/dist/{src/badge → badge}/badge.d.ts +2 -2
  3. package/dist/index.css +3 -1
  4. package/dist/index.js +16097 -17258
  5. package/dist/{src/separator → separator}/separator.d.ts +11 -5
  6. package/dist/{src/skeleton → skeleton}/skeleton.d.ts +2 -2
  7. package/dist/{src/slider → slider}/slider.d.ts +12 -0
  8. package/dist/{src/toast → toast}/toast.d.ts +3 -1
  9. package/dist/{src/toggle-button → toggle-button}/toggle-button.d.ts +0 -3
  10. package/package.json +10 -6
  11. package/src/accordion/accordion.tsx +1 -1
  12. package/src/alert-dialog/alert-dialog.tsx +45 -14
  13. package/src/badge/badge.tsx +8 -11
  14. package/src/checkbox/checkbox.tsx +2 -3
  15. package/src/collapsible/collapsible.tsx +2 -2
  16. package/src/color-area/color-area.tsx +1 -1
  17. package/src/combobox/combobox.tsx +2 -2
  18. package/src/context-menu/context-menu.tsx +3 -3
  19. package/src/dialog/dialog.tsx +2 -3
  20. package/src/dropdown-menu/dropdown-menu.tsx +3 -3
  21. package/src/hover-card/hover-card.tsx +1 -2
  22. package/src/index.tsx +4 -1
  23. package/src/link/link.tsx +4 -4
  24. package/src/menubar/menubar.tsx +9 -5
  25. package/src/meter/meter.tsx +6 -6
  26. package/src/number-field/number-field.tsx +6 -7
  27. package/src/pagination/pagination.tsx +4 -5
  28. package/src/popover/popover.tsx +2 -3
  29. package/src/progress/progress.tsx +2 -2
  30. package/src/radio-group/radio-group.tsx +6 -6
  31. package/src/search/search.tsx +8 -8
  32. package/src/segmented-control/segmented-control.tsx +3 -3
  33. package/src/select/select.tsx +8 -9
  34. package/src/separator/separator.tsx +6 -4
  35. package/src/skeleton/skeleton.tsx +1 -1
  36. package/src/slider/slider.tsx +12 -9
  37. package/src/style/{index.css → global.css} +20 -14
  38. package/src/switch/switch.tsx +7 -7
  39. package/src/tabs/tabs.tsx +5 -5
  40. package/src/text-field/text-field.tsx +7 -7
  41. package/src/toast/toast.tsx +15 -11
  42. package/src/toggle-button/toggle-button.tsx +5 -4
  43. package/src/toggle-group/toggle-group.tsx +6 -7
  44. package/src/tooltip/tooltip.tsx +9 -14
  45. /package/dist/{src/accordion → accordion}/accordion.d.ts +0 -0
  46. /package/dist/{src/alert → alert}/alert.d.ts +0 -0
  47. /package/dist/{src/breadcrumbs → breadcrumbs}/breadcrumbs.d.ts +0 -0
  48. /package/dist/{src/button → button}/button.d.ts +0 -0
  49. /package/dist/{src/checkbox → checkbox}/checkbox.d.ts +0 -0
  50. /package/dist/{src/collapsible → collapsible}/collapsible.d.ts +0 -0
  51. /package/dist/{src/color-area → color-area}/color-area.d.ts +0 -0
  52. /package/dist/{src/color-channel-field → color-channel-field}/color-channel-field.d.ts +0 -0
  53. /package/dist/{src/color-field → color-field}/color-field.d.ts +0 -0
  54. /package/dist/{src/color-slider → color-slider}/color-slider.d.ts +0 -0
  55. /package/dist/{src/color-swatch → color-swatch}/color-swatch.d.ts +0 -0
  56. /package/dist/{src/color-wheel → color-wheel}/color-wheel.d.ts +0 -0
  57. /package/dist/{src/combobox → combobox}/combobox.d.ts +0 -0
  58. /package/dist/{src/context-menu → context-menu}/context-menu.d.ts +0 -0
  59. /package/dist/{src/dialog → dialog}/dialog.d.ts +0 -0
  60. /package/dist/{src/dropdown-menu → dropdown-menu}/dropdown-menu.d.ts +0 -0
  61. /package/dist/{src/file-field → file-field}/file-field.d.ts +0 -0
  62. /package/dist/{src/hover-card → hover-card}/hover-card.d.ts +0 -0
  63. /package/dist/{src/image → image}/image.d.ts +0 -0
  64. /package/dist/{src/index.d.ts → index.d.ts} +0 -0
  65. /package/dist/{src/link → link}/link.d.ts +0 -0
  66. /package/dist/{src/menubar → menubar}/menubar.d.ts +0 -0
  67. /package/dist/{src/meter → meter}/meter.d.ts +0 -0
  68. /package/dist/{src/navigation-menu → navigation-menu}/navigation-menu.d.ts +0 -0
  69. /package/dist/{src/number-field → number-field}/number-field.d.ts +0 -0
  70. /package/dist/{src/pagination → pagination}/pagination.d.ts +0 -0
  71. /package/dist/{src/popover → popover}/popover.d.ts +0 -0
  72. /package/dist/{src/progress → progress}/progress.d.ts +0 -0
  73. /package/dist/{src/radio-group → radio-group}/radio-group.d.ts +0 -0
  74. /package/dist/{src/rating-group → rating-group}/rating-group.d.ts +0 -0
  75. /package/dist/{src/search → search}/search.d.ts +0 -0
  76. /package/dist/{src/segmented-control → segmented-control}/segmented-control.d.ts +0 -0
  77. /package/dist/{src/select → select}/select.d.ts +0 -0
  78. /package/dist/{src/switch → switch}/switch.d.ts +0 -0
  79. /package/dist/{src/tabs → tabs}/tabs.d.ts +0 -0
  80. /package/dist/{src/text-field → text-field}/text-field.d.ts +0 -0
  81. /package/dist/{src/time-field → time-field}/time-field.d.ts +0 -0
  82. /package/dist/{src/toggle-group → toggle-group}/toggle-group.d.ts +0 -0
  83. /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-slate-200 dark:bg-slate-800 shrink-0 transition-colors", {
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-slate-200 dark:bg-slate-800 shrink-0 transition-colors", unknown, unknown, undefined>>;
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-slate-200 dark:bg-slate-800", {
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-slate-200 dark:bg-slate-800", unknown, unknown, undefined>>;
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.5",
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/index.css"
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.10"
52
+ "solid-js": "^1.9.11"
49
53
  },
50
54
  "dependencies": {
51
55
  "@kobalte/core": "^0.13.11",
52
- "lucide-solid": "^0.562.0",
53
- "tailwind-merge": "^3.4.0",
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-header hover:bg-header/80",
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 { splitProps, type JSX, type ComponentProps } from "solid-js";
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
- local.onConfirm?.();
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
- <KAlertDialog.Trigger>{local.trigger}</KAlertDialog.Trigger>
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
- <div>
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">确认</Button>
119
+ <Button color="primary" loading={loading()}>
120
+ 确认
121
+ </Button>
91
122
  )}
92
- </KAlertDialog.CloseButton>
123
+ </div>
93
124
  </div>
94
125
  </KAlertDialog.Content>
95
126
  </KAlertDialog.Portal>
96
127
  </KAlertDialog>
97
128
  );
98
- };
129
+ };
@@ -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
- "border-transparent bg-zinc-100 text-zinc-900 hover:bg-zinc-100/80 dark:bg-zinc-800 dark:text-zinc-50",
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
- "border-transparent bg-emerald-100 text-emerald-800 dark:bg-emerald-900/30 dark:text-emerald-400",
18
- danger: "border-transparent bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400",
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-zinc-300 transition-all",
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:border-zinc-700 dark:data-[checked]:bg-zinc-50 dark:data-[checked]:text-zinc-900 dark:group-focus-visible:ring-zinc-300",
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-base/30 bg-header px-4 py-2 text-sm font-medium hover:bg-header/80 transition-all group mb-0",
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-base/20 !border-t-0",
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-zinc-200 dark:border-zinc-800 touch-none",
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-zinc-200 bg-white shadow-sm transition-colors focus-within:ring-1 focus-within:ring-zinc-950 dark:border-zinc-800 dark:bg-zinc-950 dark:focus-within:ring-zinc-300",
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-zinc-200 bg-white text-zinc-950 shadow-md animate-in fade-in-0 zoom-in-95 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-50",
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-zinc-200 bg-white p-1 text-zinc-950 shadow-md dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-50",
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-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",
16
- separator: "-mx-1 my-1 h-px bg-zinc-100 dark:bg-zinc-800",
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
  },
@@ -10,13 +10,12 @@ const dialogStyles = tv(
10
10
  {
11
11
  slots: {
12
12
  overlay: [
13
- "fixed inset-0 z-50 bg-black/50 backdrop-blur-sm animate-in fade-in-0 duration-200",
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-zinc-200 bg-white p-4 shadow-lg rounded-xl",
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-zinc-200 bg-white p-1 text-zinc-950 shadow-md animate-in fade-in-0 zoom-in-95 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-50",
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 bg-zinc-100 dark:bg-zinc-800",
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-white p-4 shadow-lg outline-none",
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
@@ -1,4 +1,7 @@
1
- import "./style/index.css";
1
+ import "./style/global.css";
2
+
3
+ // TODO 组件 form , data等
4
+ // TODO background-color 等颜色相关的属性,添加 dark 模式的支持
2
5
 
3
6
  export { Accordion } from "./accordion/accordion";
4
7
 
package/src/link/link.tsx CHANGED
@@ -8,11 +8,11 @@ const linkStyles = tv(
8
8
  variants: {
9
9
  variant: {
10
10
  default:
11
- "text-slate-900 underline underline-offset-4 hover:text-slate-700 dark:text-slate-100",
11
+ "text-main hover:text-main/80 underline-offset-4",
12
12
  primary:
13
- "text-blue-600 hover:text-blue-500 dark:text-blue-400 font-medium",
14
- muted: "text-slate-500 hover:text-slate-600 dark:text-slate-400",
15
- button: "bg-slate-900 text-slate-50 hover:bg-slate-900/90 px-4 py-2 text-sm dark:bg-slate-50 dark:text-slate-900",
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",
@@ -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-white p-1 shadow-sm dark:bg-slate-950 dark:border-slate-800",
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:bg-slate-100 data-[state=open]:bg-slate-100 dark:focus:bg-slate-800 dark:data-[state=open]:bg-slate-800",
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-white p-1 shadow-md dark:bg-slate-950 dark:border-slate-800 animate-in fade-in zoom-in-95",
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: "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-slate-100 data-[disabled]:opacity-50 dark:focus:bg-slate-800",
18
- separator: "-mx-1 my-1 h-px bg-slate-100 dark:bg-slate-800",
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
  },
@@ -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-slate-700 dark:text-slate-300",
13
- track: "h-2.5 w-full rounded-full bg-slate-100 dark:bg-slate-800 overflow-hidden",
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-blue-600" },
19
- success: { fill: "bg-emerald-500" },
20
- warning: { fill: "bg-amber-500" },
21
- danger: { fill: "bg-red-500" },
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-slate-700 dark:text-slate-300 ml-1",
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-white transition-shadow shadow-sm",
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-slate-400 disabled:cursor-not-allowed",
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-slate-50 active:bg-slate-100",
21
- "dark:hover:bg-slate-900 dark:active:bg-slate-800 disabled:opacity-30 disabled:pointer-events-none",
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-red-500 font-medium ml-1 mt-1",
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-slate-100 hover:text-slate-900",
17
- "data-[selected]:bg-slate-900 data-[selected]:text-slate-50",
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-slate-200 bg-transparent hover:bg-slate-100 dark:border-slate-800 dark:hover:bg-slate-800",
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
  {
@@ -11,11 +11,10 @@ const popoverStyles = tv(
11
11
  {
12
12
  slots: {
13
13
  content: [
14
- "z-50 w-72 rounded-md border bg-white p-4 shadow-md outline-none antialiased",
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-white stroke-slate-200 dark:fill-slate-950 dark:stroke-slate-800",
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-slate-100 dark:bg-slate-800 overflow-hidden",
14
- fill: "h-full bg-blue-600 transition-all duration-300 ease-in-out data-[indeterminate]:animate-progress-indeterminate",
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: {