@lark-apaas/client-toolkit 1.1.0 → 1.1.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,27 @@ 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",
|
|
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
|
+
size: 10,
|
|
65
|
+
className: "text-[#646A73]"
|
|
66
|
+
})
|
|
46
67
|
})
|
|
47
68
|
]
|
|
48
69
|
})
|
|
49
70
|
}),
|
|
50
71
|
/*#__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",
|
|
72
|
+
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
73
|
side: "top",
|
|
53
74
|
align: "end",
|
|
54
75
|
sideOffset: 8,
|
|
@@ -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",
|