@allbluecn/ui 0.3.13 → 0.4.0
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/ai-command-button.d.ts +10 -0
- package/dist/ai-command-button.js +12 -0
- package/dist/ai-stream-text.d.ts +9 -0
- package/dist/ai-stream-text.js +12 -0
- package/dist/alert-dialog.d.ts +20 -0
- package/dist/alert-dialog.js +101 -0
- package/dist/animated-theme-toggler.d.ts +11 -0
- package/dist/animated-theme-toggler.js +169 -0
- package/dist/auth-client.d.ts +27 -0
- package/dist/auth-client.js +86 -0
- package/dist/auth-layout.d.ts +14 -0
- package/dist/auth-layout.js +43 -0
- package/dist/avatar.d.ts +13 -0
- package/dist/avatar.js +51 -0
- package/dist/badge.d.ts +11 -0
- package/dist/badge.js +28 -0
- package/dist/button.d.ts +12 -0
- package/dist/button.js +48 -0
- package/dist/card.d.ts +13 -0
- package/dist/card.js +56 -0
- package/dist/checkbox.d.ts +6 -0
- package/dist/checkbox.js +22 -0
- package/dist/context-menu.d.ts +33 -0
- package/dist/context-menu.js +125 -0
- package/dist/dialog.d.ts +19 -0
- package/dist/dialog.js +95 -0
- package/dist/dropdown-menu.d.ts +31 -0
- package/dist/dropdown-menu.js +128 -0
- package/dist/empty.d.ts +13 -0
- package/dist/empty.js +59 -0
- package/dist/grid-pattern.d.ts +14 -0
- package/dist/grid-pattern.js +47 -0
- package/dist/icon-packs/index.d.ts +2 -0
- package/dist/icon-packs/index.js +4 -0
- package/dist/icon-packs/knowledge.d.ts +2 -0
- package/dist/icon-packs/knowledge.js +70 -0
- package/dist/icon-packs/prd.d.ts +2 -0
- package/dist/icon-packs/prd.js +86 -0
- package/dist/icon-packs/project.d.ts +2 -0
- package/dist/icon-packs/project.js +74 -0
- package/dist/icon-picker.d.ts +11 -0
- package/dist/icon-picker.js +39 -0
- package/dist/index-CQsbeClc.d.ts +17 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/input.d.ts +5 -0
- package/dist/input.js +14 -0
- package/dist/item.d.ts +25 -0
- package/dist/item.js +118 -0
- package/dist/kbd.d.ts +4 -0
- package/dist/kbd.js +12 -0
- package/dist/label.d.ts +6 -0
- package/dist/label.js +14 -0
- package/dist/layout-panel-top.d.ts +12 -0
- package/dist/layout-panel-top.js +127 -0
- package/dist/name-confirm-dialog.d.ts +15 -0
- package/dist/name-confirm-dialog.js +105 -0
- package/dist/nav-float-button.d.ts +12 -0
- package/dist/nav-float-button.js +249 -0
- package/dist/notion-avatar.d.ts +13 -0
- package/dist/notion-avatar.js +83 -0
- package/dist/placeholder-page.d.ts +10 -0
- package/dist/placeholder-page.js +28 -0
- package/dist/popover.d.ts +12 -0
- package/dist/popover.js +56 -0
- package/dist/reference-inline.d.ts +10 -0
- package/dist/reference-inline.js +35 -0
- package/dist/reference-search.d.ts +12 -0
- package/dist/reference-search.js +26 -0
- package/dist/resizable.d.ts +9 -0
- package/dist/resizable.js +28 -0
- package/dist/select.d.ts +17 -0
- package/dist/select.js +99 -0
- package/dist/separator.d.ts +6 -0
- package/dist/separator.js +17 -0
- package/dist/sheet.d.ts +16 -0
- package/dist/sheet.js +90 -0
- package/dist/sidebar.d.ts +71 -0
- package/dist/sidebar.js +369 -0
- package/dist/skeleton.d.ts +4 -0
- package/dist/skeleton.js +12 -0
- package/dist/sonner.d.ts +5 -0
- package/dist/sonner.js +19 -0
- package/dist/switch.d.ts +8 -0
- package/dist/switch.js +19 -0
- package/dist/textarea.d.ts +5 -0
- package/dist/textarea.js +13 -0
- package/dist/timezone-provider.d.ts +18 -0
- package/dist/timezone-provider.js +29 -0
- package/dist/tooltip.d.ts +9 -0
- package/dist/tooltip.js +35 -0
- package/dist/use-mobile.d.ts +4 -0
- package/dist/use-mobile.js +18 -0
- package/dist/user-avatar.d.ts +14 -0
- package/dist/user-avatar.js +34 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +8 -0
- package/package.json +178 -49
- package/src/ai-command-button.tsx +0 -36
- package/src/ai-stream-text.tsx +0 -37
- package/src/alert-dialog.tsx +0 -216
- package/src/animated-theme-toggler.tsx +0 -272
- package/src/auth-client.ts +0 -108
- package/src/auth-layout.tsx +0 -66
- package/src/avatar.tsx +0 -129
- package/src/badge.tsx +0 -66
- package/src/button.tsx +0 -84
- package/src/card.tsx +0 -120
- package/src/checkbox.tsx +0 -50
- package/src/context-menu.tsx +0 -280
- package/src/dialog.tsx +0 -183
- package/src/dropdown-menu.tsx +0 -286
- package/src/empty.tsx +0 -121
- package/src/grid-pattern.tsx +0 -87
- package/src/icon-packs/index.ts +0 -27
- package/src/icon-packs/knowledge.ts +0 -55
- package/src/icon-packs/prd.ts +0 -63
- package/src/icon-packs/project.ts +0 -59
- package/src/icon-picker.tsx +0 -68
- package/src/index.ts +0 -23
- package/src/input.tsx +0 -36
- package/src/item.tsx +0 -213
- package/src/kbd.tsx +0 -33
- package/src/label.tsx +0 -39
- package/src/layout-panel-top.tsx +0 -160
- package/src/name-confirm-dialog.tsx +0 -153
- package/src/nav-float-button.tsx +0 -301
- package/src/notion-avatar.tsx +0 -126
- package/src/placeholder-page.tsx +0 -42
- package/src/popover.tsx +0 -106
- package/src/reference-inline.tsx +0 -53
- package/src/reference-search.tsx +0 -52
- package/src/resizable.tsx +0 -67
- package/src/select.tsx +0 -207
- package/src/separator.tsx +0 -45
- package/src/sheet.tsx +0 -164
- package/src/sidebar.tsx +0 -708
- package/src/skeleton.tsx +0 -30
- package/src/sonner.tsx +0 -37
- package/src/switch.tsx +0 -48
- package/src/textarea.tsx +0 -35
- package/src/timezone-provider.tsx +0 -55
- package/src/tooltip.tsx +0 -72
- package/src/use-mobile.ts +0 -36
- package/src/user-avatar.tsx +0 -79
- package/src/utils.ts +0 -6
package/src/skeleton.tsx
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
-
// AllBlue - 理想之海
|
|
3
|
-
// Copyright (C) 2026 AllBlue Contributors
|
|
4
|
-
//
|
|
5
|
-
// This program is free software: you can redistribute it and/or modify
|
|
6
|
-
// it under the terms of the GNU Affero General Public License as published by
|
|
7
|
-
// the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
// (at your option) any later version.
|
|
9
|
-
//
|
|
10
|
-
// This program is distributed in the hope that it will be useful,
|
|
11
|
-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
// GNU Affero General Public License for more details.
|
|
14
|
-
//
|
|
15
|
-
// You should have received a copy of the GNU Affero General Public License
|
|
16
|
-
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
|
|
18
|
-
import { cn } from "./utils"
|
|
19
|
-
|
|
20
|
-
function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
|
|
21
|
-
return (
|
|
22
|
-
<div
|
|
23
|
-
data-slot="skeleton"
|
|
24
|
-
className={cn("animate-pulse rounded-md bg-muted", className)}
|
|
25
|
-
{...props}
|
|
26
|
-
/>
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export { Skeleton }
|
package/src/sonner.tsx
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
-
// AllBlue - 理想之海
|
|
3
|
-
// Copyright (C) 2026 AllBlue Contributors
|
|
4
|
-
//
|
|
5
|
-
// This program is free software: you can redistribute it and/or modify
|
|
6
|
-
// it under the terms of the GNU Affero General Public License as published by
|
|
7
|
-
// the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
// (at your option) any later version.
|
|
9
|
-
//
|
|
10
|
-
// This program is distributed in the hope that it will be useful,
|
|
11
|
-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
// GNU Affero General Public License for more details.
|
|
14
|
-
//
|
|
15
|
-
// You should have received a copy of the GNU Affero General Public License
|
|
16
|
-
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
|
|
18
|
-
import { Toaster as Sonner, type ToasterProps, toast } from "sonner"
|
|
19
|
-
import { CircleCheckIcon, InfoIcon, TriangleAlertIcon, OctagonXIcon, Loader2Icon } from "lucide-react"
|
|
20
|
-
|
|
21
|
-
const Toaster = ({ ...props }: ToasterProps) => {
|
|
22
|
-
return (
|
|
23
|
-
<Sonner
|
|
24
|
-
className="toaster group"
|
|
25
|
-
icons={{
|
|
26
|
-
success: <CircleCheckIcon className="size-4 text-emerald-600 dark:text-emerald-500" />,
|
|
27
|
-
info: <InfoIcon className="size-4 text-sky-600 dark:text-sky-500" />,
|
|
28
|
-
warning: <TriangleAlertIcon className="size-4 text-amber-600 dark:text-amber-500" />,
|
|
29
|
-
error: <OctagonXIcon className="size-4 text-red-600 dark:text-red-500" />,
|
|
30
|
-
loading: <Loader2Icon className="size-4 animate-spin" />,
|
|
31
|
-
}}
|
|
32
|
-
{...props}
|
|
33
|
-
/>
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export { Toaster, toast }
|
package/src/switch.tsx
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
-
// AllBlue - 理想之海
|
|
3
|
-
// Copyright (C) 2026 AllBlue Contributors
|
|
4
|
-
//
|
|
5
|
-
// This program is free software: you can redistribute it and/or modify
|
|
6
|
-
// it under the terms of the GNU Affero General Public License as published by
|
|
7
|
-
// the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
// (at your option) any later version.
|
|
9
|
-
//
|
|
10
|
-
// This program is distributed in the hope that it will be useful,
|
|
11
|
-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
// GNU Affero General Public License for more details.
|
|
14
|
-
//
|
|
15
|
-
// You should have received a copy of the GNU Affero General Public License
|
|
16
|
-
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
|
|
18
|
-
import * as React from "react"
|
|
19
|
-
import { Switch as SwitchPrimitive } from "radix-ui"
|
|
20
|
-
|
|
21
|
-
import { cn } from "./utils"
|
|
22
|
-
|
|
23
|
-
function Switch({
|
|
24
|
-
className,
|
|
25
|
-
size = "default",
|
|
26
|
-
...props
|
|
27
|
-
}: React.ComponentProps<typeof SwitchPrimitive.Root> & {
|
|
28
|
-
size?: "sm" | "default"
|
|
29
|
-
}) {
|
|
30
|
-
return (
|
|
31
|
-
<SwitchPrimitive.Root
|
|
32
|
-
data-slot="switch"
|
|
33
|
-
data-size={size}
|
|
34
|
-
className={cn(
|
|
35
|
-
"peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",
|
|
36
|
-
className
|
|
37
|
-
)}
|
|
38
|
-
{...props}
|
|
39
|
-
>
|
|
40
|
-
<SwitchPrimitive.Thumb
|
|
41
|
-
data-slot="switch-thumb"
|
|
42
|
-
className="pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-[state=checked]:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-[state=checked]:translate-x-[calc(100%-2px)] dark:data-[state=checked]:bg-primary-foreground group-data-[size=default]/switch:data-[state=unchecked]:translate-x-0 group-data-[size=sm]/switch:data-[state=unchecked]:translate-x-0 dark:data-[state=unchecked]:bg-foreground"
|
|
43
|
-
/>
|
|
44
|
-
</SwitchPrimitive.Root>
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export { Switch }
|
package/src/textarea.tsx
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
-
// AllBlue - 理想之海
|
|
3
|
-
// Copyright (C) 2026 AllBlue Contributors
|
|
4
|
-
//
|
|
5
|
-
// This program is free software: you can redistribute it and/or modify
|
|
6
|
-
// it under the terms of the GNU Affero General Public License as published by
|
|
7
|
-
// the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
// (at your option) any later version.
|
|
9
|
-
//
|
|
10
|
-
// This program is distributed in the hope that it will be useful,
|
|
11
|
-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
// GNU Affero General Public License for more details.
|
|
14
|
-
//
|
|
15
|
-
// You should have received a copy of the GNU Affero General Public License
|
|
16
|
-
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
|
|
18
|
-
import * as React from "react"
|
|
19
|
-
|
|
20
|
-
import { cn } from "./utils"
|
|
21
|
-
|
|
22
|
-
function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
|
|
23
|
-
return (
|
|
24
|
-
<textarea
|
|
25
|
-
data-slot="textarea"
|
|
26
|
-
className={cn(
|
|
27
|
-
"flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
|
|
28
|
-
className
|
|
29
|
-
)}
|
|
30
|
-
{...props}
|
|
31
|
-
/>
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export { Textarea }
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
-
// AllBlue - 理想之海
|
|
3
|
-
// Copyright (C) 2026 AllBlue Contributors
|
|
4
|
-
//
|
|
5
|
-
// This program is free software: you can redistribute it and/or modify
|
|
6
|
-
// it under the terms of the GNU Affero General Public License as published by
|
|
7
|
-
// the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
// (at your option) any later version.
|
|
9
|
-
//
|
|
10
|
-
// This program is distributed in the hope that it will be useful,
|
|
11
|
-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
// GNU Affero General Public License for more details.
|
|
14
|
-
//
|
|
15
|
-
// You should have received a copy of the GNU Affero General Public License
|
|
16
|
-
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
|
|
18
|
-
import { createContext, useContext, type ReactNode } from 'react'
|
|
19
|
-
import { resolveTimezone } from '@allbluecn/shared/lib/datetime'
|
|
20
|
-
|
|
21
|
-
const TimezoneContext = createContext<string>(
|
|
22
|
-
typeof Intl !== 'undefined'
|
|
23
|
-
? Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
24
|
-
: 'Asia/Shanghai',
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* 提供用户级全局时区。
|
|
29
|
-
* 项目时区覆盖由 useProjectTimezone hook 处理(在项目路由组件内调用)。
|
|
30
|
-
*/
|
|
31
|
-
export function TimezoneProvider({
|
|
32
|
-
userTimezone,
|
|
33
|
-
children,
|
|
34
|
-
}: {
|
|
35
|
-
userTimezone?: string | null
|
|
36
|
-
children: ReactNode
|
|
37
|
-
}) {
|
|
38
|
-
const tz = resolveTimezone(null, userTimezone)
|
|
39
|
-
return (
|
|
40
|
-
<TimezoneContext.Provider value={tz}>{children}</TimezoneContext.Provider>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function useTimezone(): string {
|
|
45
|
-
return useContext(TimezoneContext)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* 在项目内使用:合并项目时区与用户时区。
|
|
50
|
-
* @param projectTz 项目时区(来自 loader 数据),null 表示跟随用户
|
|
51
|
-
*/
|
|
52
|
-
export function useProjectTimezone(projectTz?: string | null): string {
|
|
53
|
-
const userTz = useContext(TimezoneContext)
|
|
54
|
-
return resolveTimezone(projectTz, userTz)
|
|
55
|
-
}
|
package/src/tooltip.tsx
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
-
// AllBlue - 理想之海
|
|
3
|
-
// Copyright (C) 2026 AllBlue Contributors
|
|
4
|
-
//
|
|
5
|
-
// This program is free software: you can redistribute it and/or modify
|
|
6
|
-
// it under the terms of the GNU Affero General Public License as published by
|
|
7
|
-
// the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
// (at your option) any later version.
|
|
9
|
-
//
|
|
10
|
-
// This program is distributed in the hope that it will be useful,
|
|
11
|
-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
// GNU Affero General Public License for more details.
|
|
14
|
-
//
|
|
15
|
-
// You should have received a copy of the GNU Affero General Public License
|
|
16
|
-
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
|
|
18
|
-
import * as React from "react"
|
|
19
|
-
import { Tooltip as TooltipPrimitive } from "radix-ui"
|
|
20
|
-
|
|
21
|
-
import { cn } from "./utils"
|
|
22
|
-
|
|
23
|
-
function TooltipProvider({
|
|
24
|
-
delayDuration = 0,
|
|
25
|
-
...props
|
|
26
|
-
}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
|
|
27
|
-
return (
|
|
28
|
-
<TooltipPrimitive.Provider
|
|
29
|
-
data-slot="tooltip-provider"
|
|
30
|
-
delayDuration={delayDuration}
|
|
31
|
-
{...props}
|
|
32
|
-
/>
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function Tooltip({
|
|
37
|
-
...props
|
|
38
|
-
}: React.ComponentProps<typeof TooltipPrimitive.Root>) {
|
|
39
|
-
return <TooltipPrimitive.Root data-slot="tooltip" {...props} />
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function TooltipTrigger({
|
|
43
|
-
...props
|
|
44
|
-
}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
|
|
45
|
-
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function TooltipContent({
|
|
49
|
-
className,
|
|
50
|
-
sideOffset = 0,
|
|
51
|
-
children,
|
|
52
|
-
...props
|
|
53
|
-
}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
|
|
54
|
-
return (
|
|
55
|
-
<TooltipPrimitive.Portal>
|
|
56
|
-
<TooltipPrimitive.Content
|
|
57
|
-
data-slot="tooltip-content"
|
|
58
|
-
sideOffset={sideOffset}
|
|
59
|
-
className={cn(
|
|
60
|
-
"z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
61
|
-
className
|
|
62
|
-
)}
|
|
63
|
-
{...props}
|
|
64
|
-
>
|
|
65
|
-
{children}
|
|
66
|
-
<TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" />
|
|
67
|
-
</TooltipPrimitive.Content>
|
|
68
|
-
</TooltipPrimitive.Portal>
|
|
69
|
-
)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger }
|
package/src/use-mobile.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
-
// AllBlue - 理想之海
|
|
3
|
-
// Copyright (C) 2026 AllBlue Contributors
|
|
4
|
-
//
|
|
5
|
-
// This program is free software: you can redistribute it and/or modify
|
|
6
|
-
// it under the terms of the GNU Affero General Public License as published by
|
|
7
|
-
// the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
// (at your option) any later version.
|
|
9
|
-
//
|
|
10
|
-
// This program is distributed in the hope that it will be useful,
|
|
11
|
-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
// GNU Affero General Public License for more details.
|
|
14
|
-
//
|
|
15
|
-
// You should have received a copy of the GNU Affero General Public License
|
|
16
|
-
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
|
|
18
|
-
import * as React from "react"
|
|
19
|
-
|
|
20
|
-
const MOBILE_BREAKPOINT = 768
|
|
21
|
-
|
|
22
|
-
export function useIsMobile() {
|
|
23
|
-
const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)
|
|
24
|
-
|
|
25
|
-
React.useEffect(() => {
|
|
26
|
-
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)
|
|
27
|
-
const onChange = () => {
|
|
28
|
-
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
|
|
29
|
-
}
|
|
30
|
-
mql.addEventListener("change", onChange)
|
|
31
|
-
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
|
|
32
|
-
return () => mql.removeEventListener("change", onChange)
|
|
33
|
-
}, [])
|
|
34
|
-
|
|
35
|
-
return !!isMobile
|
|
36
|
-
}
|
package/src/user-avatar.tsx
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
-
// AllBlue - 理想之海
|
|
3
|
-
// Copyright (C) 2026 AllBlue Contributors
|
|
4
|
-
//
|
|
5
|
-
// This program is free software: you can redistribute it and/or modify
|
|
6
|
-
// it under the terms of the GNU Affero General Public License as published by
|
|
7
|
-
// the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
// (at your option) any later version.
|
|
9
|
-
//
|
|
10
|
-
// This program is distributed in the hope that it will be useful,
|
|
11
|
-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
// GNU Affero General Public License for more details.
|
|
14
|
-
//
|
|
15
|
-
// You should have received a copy of the GNU Affero General Public License
|
|
16
|
-
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
|
|
18
|
-
"use client"
|
|
19
|
-
|
|
20
|
-
import { NotionAvatar } from "./notion-avatar"
|
|
21
|
-
import type { AvatarConfig, ShapeType } from "@allbluecn/shared"
|
|
22
|
-
|
|
23
|
-
type UserAvatarProps = {
|
|
24
|
-
avatarConfig?: AvatarConfig | null
|
|
25
|
-
bgShape?: ShapeType | null
|
|
26
|
-
bgColor?: string | null
|
|
27
|
-
name?: string | null
|
|
28
|
-
imageUrl?: string | null
|
|
29
|
-
className?: string
|
|
30
|
-
size?: "xs" | "sm" | "md" | "lg"
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const sizeClasses: Record<string, string> = {
|
|
34
|
-
xs: "w-5 h-5",
|
|
35
|
-
sm: "w-6 h-6",
|
|
36
|
-
md: "w-8 h-8",
|
|
37
|
-
lg: "w-10 h-10",
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function UserAvatar({
|
|
41
|
-
avatarConfig,
|
|
42
|
-
bgShape,
|
|
43
|
-
bgColor,
|
|
44
|
-
name,
|
|
45
|
-
imageUrl,
|
|
46
|
-
className,
|
|
47
|
-
size = "md",
|
|
48
|
-
}: UserAvatarProps) {
|
|
49
|
-
const initial = (name || "U").charAt(0).toUpperCase()
|
|
50
|
-
const shapeClass =
|
|
51
|
-
bgShape === "circle" ? "rounded-full" : bgShape === "square" ? "rounded-none" : "rounded-lg"
|
|
52
|
-
|
|
53
|
-
if (avatarConfig) {
|
|
54
|
-
return (
|
|
55
|
-
<NotionAvatar
|
|
56
|
-
config={avatarConfig}
|
|
57
|
-
shape={bgShape ?? "square"}
|
|
58
|
-
bgColor={bgColor ?? "#fff"}
|
|
59
|
-
className={`${sizeClasses[size]} shrink-0 ${className ?? ""}`}
|
|
60
|
-
/>
|
|
61
|
-
)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (imageUrl) {
|
|
65
|
-
return (
|
|
66
|
-
<div className={`relative shrink-0 overflow-hidden ${shapeClass} ${sizeClasses[size]} ${className ?? ""}`}>
|
|
67
|
-
<img src={imageUrl} alt={name || ""} className="h-full w-full object-cover" />
|
|
68
|
-
</div>
|
|
69
|
-
)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return (
|
|
73
|
-
<div
|
|
74
|
-
className={`flex shrink-0 items-center justify-center ${shapeClass} bg-muted text-xs font-medium ${sizeClasses[size]} ${className ?? ""}`}
|
|
75
|
-
>
|
|
76
|
-
{initial}
|
|
77
|
-
</div>
|
|
78
|
-
)
|
|
79
|
-
}
|