@lark-apaas/client-toolkit 1.1.0 → 1.1.2-alpha.shadcn.1
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.
|
@@ -3,8 +3,14 @@ import { useEffect, useRef, useState } from "react";
|
|
|
3
3
|
import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover.js";
|
|
4
4
|
import { getCsrfToken } from "../../utils/getCsrfToken.js";
|
|
5
5
|
import { getAppId } from "../../utils/getAppId.js";
|
|
6
|
+
import { useIsMobile } from "../../hooks/index.js";
|
|
7
|
+
import { X } from "lucide-react";
|
|
8
|
+
import { Button } from "../ui/button.js";
|
|
6
9
|
const Component = ()=>{
|
|
10
|
+
const HasClosedKey = `miaoda-creatByMiaoda-has-closed-${getAppId(window.location.pathname)}`;
|
|
11
|
+
const [visible, setVisible] = useState(!window.localStorage?.getItem(HasClosedKey));
|
|
7
12
|
const [open, setOpen] = useState(false);
|
|
13
|
+
const isMobile = useIsMobile();
|
|
8
14
|
const [userinfo, setUserinfo] = useState(null);
|
|
9
15
|
const [isInternetVisible, setIsInternetVisible] = useState(false);
|
|
10
16
|
const timeoutRef = useRef(null);
|
|
@@ -19,7 +25,7 @@ const Component = ()=>{
|
|
|
19
25
|
});
|
|
20
26
|
}, []);
|
|
21
27
|
if ('production' !== process.env.NODE_ENV) return null;
|
|
22
|
-
if (!userinfo) return null;
|
|
28
|
+
if (isMobile || !visible || !userinfo) return null;
|
|
23
29
|
return /*#__PURE__*/ jsxs(Popover, {
|
|
24
30
|
open: open,
|
|
25
31
|
onOpenChange: setOpen,
|
|
@@ -43,12 +49,26 @@ const Component = ()=>{
|
|
|
43
49
|
/*#__PURE__*/ jsx("p", {
|
|
44
50
|
className: "shrink-0 min-w-[92px]",
|
|
45
51
|
children: "由妙搭 AI 搭建"
|
|
52
|
+
}),
|
|
53
|
+
/*#__PURE__*/ jsx(Button, {
|
|
54
|
+
size: "icon",
|
|
55
|
+
variant: "ghost",
|
|
56
|
+
className: "cursor-pointer rounded-full w-4 h-4 hover:bg-[#1f232914]",
|
|
57
|
+
onClick: (e)=>{
|
|
58
|
+
e.stopPropagation();
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
setVisible(false);
|
|
61
|
+
window.localStorage?.setItem(HasClosedKey, 'true');
|
|
62
|
+
},
|
|
63
|
+
children: /*#__PURE__*/ jsx(X, {
|
|
64
|
+
className: "text-[#646A73] !w-[10px] !h-[10px]"
|
|
65
|
+
})
|
|
46
66
|
})
|
|
47
67
|
]
|
|
48
68
|
})
|
|
49
69
|
}),
|
|
50
70
|
/*#__PURE__*/ jsxs(PopoverContent, {
|
|
51
|
-
className: "w-80 pt-2 bg-white rounded-xl shadow-[0px_10px_36px_10px_rgba(31,35,41,0.04)] shadow-[0px_8px_24px_0px_rgba(31,35,41,0.04)] shadow-[0px_6px_12px_-10px_rgba(31,35,41,0.06)] outline outline-[0.50px] outline-offset-[-0.50px] outline-[#DEE0E3] inline-flex flex-col justify-center items-start overflow-hidden p-0",
|
|
71
|
+
className: "w-80 border-0 pt-2 bg-white rounded-xl shadow-[0px_10px_36px_10px_rgba(31,35,41,0.04)] shadow-[0px_8px_24px_0px_rgba(31,35,41,0.04)] shadow-[0px_6px_12px_-10px_rgba(31,35,41,0.06)] outline outline-[0.50px] outline-offset-[-0.50px] outline-[#DEE0E3] inline-flex flex-col justify-center items-start overflow-hidden p-0",
|
|
52
72
|
side: "top",
|
|
53
73
|
align: "end",
|
|
54
74
|
sideOffset: 8,
|
|
@@ -78,7 +98,7 @@ const Component = ()=>{
|
|
|
78
98
|
className: "shrink-0 w-[14px] h-[14px]"
|
|
79
99
|
}),
|
|
80
100
|
/*#__PURE__*/ jsx("div", {
|
|
81
|
-
className: "flex-1 justify-start text-
|
|
101
|
+
className: "flex-1 justify-start text-[#2B2F36] text-sm font-normal font-['PingFang_SC'] leading-5",
|
|
82
102
|
children: "运营方"
|
|
83
103
|
})
|
|
84
104
|
]
|
|
@@ -86,7 +106,7 @@ const Component = ()=>{
|
|
|
86
106
|
/*#__PURE__*/ jsx("div", {
|
|
87
107
|
className: "flex justify-start items-center gap-1 overflow-hidden",
|
|
88
108
|
children: /*#__PURE__*/ jsx("div", {
|
|
89
|
-
className: "justify-start text-
|
|
109
|
+
className: "justify-start text-[#646A73] text-sm font-normal font-['PingFang_SC'] leading-5",
|
|
90
110
|
children: userinfo?.name
|
|
91
111
|
})
|
|
92
112
|
})
|
|
@@ -116,7 +136,7 @@ const Component = ()=>{
|
|
|
116
136
|
className: "shrink-0 w-[14px] h-[14px]"
|
|
117
137
|
}),
|
|
118
138
|
/*#__PURE__*/ jsx("div", {
|
|
119
|
-
className: "flex-1 justify-start text-
|
|
139
|
+
className: "flex-1 justify-start text-[#2B2F36] text-sm font-normal font-['PingFang_SC'] leading-5",
|
|
120
140
|
children: "了解妙搭"
|
|
121
141
|
}),
|
|
122
142
|
/*#__PURE__*/ jsx("img", {
|
|
@@ -134,7 +154,7 @@ const Component = ()=>{
|
|
|
134
154
|
children: /*#__PURE__*/ jsx("div", {
|
|
135
155
|
className: "flex-1 flex justify-start items-center gap-2",
|
|
136
156
|
children: /*#__PURE__*/ jsx("div", {
|
|
137
|
-
className: "justify-start text-
|
|
157
|
+
className: "justify-start text-[#8F959E] text-xs font-normal font-['PingFang_SC'] leading-5",
|
|
138
158
|
children: "包含 AI 生成内容,请注意甄别"
|
|
139
159
|
})
|
|
140
160
|
})
|
|
@@ -3,15 +3,15 @@ import "react";
|
|
|
3
3
|
import { Slot } from "@radix-ui/react-slot";
|
|
4
4
|
import { cva } from "class-variance-authority";
|
|
5
5
|
import { clsxWithTw } from "../../utils/utils.js";
|
|
6
|
-
const buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-
|
|
6
|
+
const buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-normal transition-all disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/20 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
|
|
7
7
|
variants: {
|
|
8
8
|
variant: {
|
|
9
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
10
|
-
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
11
|
-
outline: "border bg-background
|
|
12
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
13
|
-
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
14
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
9
|
+
default: "bg-primary text-primary-foreground not-disabled:hover:bg-primary/90",
|
|
10
|
+
destructive: "bg-destructive text-white not-disabled:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
11
|
+
outline: "border bg-background not-disabled:hover:bg-accent not-disabled:hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:not-disabled:hover:bg-input/50",
|
|
12
|
+
secondary: "bg-secondary text-secondary-foreground not-disabled:hover:bg-secondary/80",
|
|
13
|
+
ghost: "not-disabled:hover:bg-accent not-disabled:hover:text-accent-foreground dark:not-disabled:hover:bg-accent/50",
|
|
14
|
+
link: "text-primary underline-offset-4 not-disabled:hover:underline"
|
|
15
15
|
},
|
|
16
16
|
size: {
|
|
17
17
|
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
package/lib/override.css
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
.ant-btn-icon {
|
|
7
|
-
vertical-align: -.125em;
|
|
8
|
-
}
|
|
1
|
+
@layer base {
|
|
2
|
+
* {
|
|
3
|
+
border-color: var(--border);
|
|
4
|
+
outline-color: var(--ring);
|
|
5
|
+
}
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
body {
|
|
8
|
+
background-color: var(--background);
|
|
9
|
+
color: var(--foreground);
|
|
10
|
+
}
|
|
12
11
|
}
|
|
13
12
|
|