@asabot/panel-ui 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +41 -2
- package/dist/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/dist/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/dist/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/dist/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/dist/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
- package/dist/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
- package/dist/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
- package/dist/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
- package/dist/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
- package/dist/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
- package/dist/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/dist/assets/noto-sans-sc-100-wght-normal-DluiXYzi.woff2 +0 -0
- package/dist/assets/noto-sans-sc-101-wght-normal-CPkZHnw0.woff2 +0 -0
- package/dist/assets/noto-sans-sc-102-wght-normal-gzIulUH6.woff2 +0 -0
- package/dist/assets/noto-sans-sc-103-wght-normal-CJfSBxFo.woff2 +0 -0
- package/dist/assets/noto-sans-sc-104-wght-normal-B3QMglgE.woff2 +0 -0
- package/dist/assets/noto-sans-sc-105-wght-normal-xXh_OMfk.woff2 +0 -0
- package/dist/assets/noto-sans-sc-106-wght-normal-B9n3jMjP.woff2 +0 -0
- package/dist/assets/noto-sans-sc-107-wght-normal-D7fvVprN.woff2 +0 -0
- package/dist/assets/noto-sans-sc-108-wght-normal-J0_LhxVo.woff2 +0 -0
- package/dist/assets/noto-sans-sc-109-wght-normal-Dsp-De_0.woff2 +0 -0
- package/dist/assets/noto-sans-sc-110-wght-normal-DE_6NUrb.woff2 +0 -0
- package/dist/assets/noto-sans-sc-111-wght-normal-C4S-TlTn.woff2 +0 -0
- package/dist/assets/noto-sans-sc-112-wght-normal-BcFuP3w6.woff2 +0 -0
- package/dist/assets/noto-sans-sc-113-wght-normal-Dk932kmj.woff2 +0 -0
- package/dist/assets/noto-sans-sc-114-wght-normal-CO_5Xo-i.woff2 +0 -0
- package/dist/assets/noto-sans-sc-115-wght-normal-BWy07H14.woff2 +0 -0
- package/dist/assets/noto-sans-sc-116-wght-normal-B4HVAfHo.woff2 +0 -0
- package/dist/assets/noto-sans-sc-117-wght-normal-siZzFqgK.woff2 +0 -0
- package/dist/assets/noto-sans-sc-118-wght-normal-xhBB7f6V.woff2 +0 -0
- package/dist/assets/noto-sans-sc-119-wght-normal-Ck_g2FGz.woff2 +0 -0
- package/dist/assets/noto-sans-sc-21-wght-normal-D0x9-yBt.woff2 +0 -0
- package/dist/assets/noto-sans-sc-22-wght-normal-BBUVTShg.woff2 +0 -0
- package/dist/assets/noto-sans-sc-23-wght-normal-Du1oYWkE.woff2 +0 -0
- package/dist/assets/noto-sans-sc-24-wght-normal-CmWjJ0gt.woff2 +0 -0
- package/dist/assets/noto-sans-sc-25-wght-normal-BFHiqilg.woff2 +0 -0
- package/dist/assets/noto-sans-sc-26-wght-normal-C0sF2Z2f.woff2 +0 -0
- package/dist/assets/noto-sans-sc-27-wght-normal-COFdrquJ.woff2 +0 -0
- package/dist/assets/noto-sans-sc-28-wght-normal-DMgdNu1o.woff2 +0 -0
- package/dist/assets/noto-sans-sc-29-wght-normal-Cmq8em30.woff2 +0 -0
- package/dist/assets/noto-sans-sc-30-wght-normal-CZWqZ3yU.woff2 +0 -0
- package/dist/assets/noto-sans-sc-31-wght-normal-Wfi_lutW.woff2 +0 -0
- package/dist/assets/noto-sans-sc-32-wght-normal-BRJQ4PY5.woff2 +0 -0
- package/dist/assets/noto-sans-sc-33-wght-normal-CUVQXNAJ.woff2 +0 -0
- package/dist/assets/noto-sans-sc-34-wght-normal-Bspba0wC.woff2 +0 -0
- package/dist/assets/noto-sans-sc-35-wght-normal-K8fX_YPG.woff2 +0 -0
- package/dist/assets/noto-sans-sc-36-wght-normal-CkITyjoT.woff2 +0 -0
- package/dist/assets/noto-sans-sc-37-wght-normal-WCZ2zfEe.woff2 +0 -0
- package/dist/assets/noto-sans-sc-38-wght-normal-DeM7CUce.woff2 +0 -0
- package/dist/assets/noto-sans-sc-39-wght-normal-BMZNLWQU.woff2 +0 -0
- package/dist/assets/noto-sans-sc-4-wght-normal-AR5bdDjz.woff2 +0 -0
- package/dist/assets/noto-sans-sc-40-wght-normal-BQ5xpS5j.woff2 +0 -0
- package/dist/assets/noto-sans-sc-41-wght-normal-Hthm7FFi.woff2 +0 -0
- package/dist/assets/noto-sans-sc-42-wght-normal-eaS2gKds.woff2 +0 -0
- package/dist/assets/noto-sans-sc-43-wght-normal-o-T53XXV.woff2 +0 -0
- package/dist/assets/noto-sans-sc-44-wght-normal-BJH5J4Ez.woff2 +0 -0
- package/dist/assets/noto-sans-sc-45-wght-normal-BKuxSCOJ.woff2 +0 -0
- package/dist/assets/noto-sans-sc-46-wght-normal-BR_5Mu6e.woff2 +0 -0
- package/dist/assets/noto-sans-sc-47-wght-normal-CyY7gKNX.woff2 +0 -0
- package/dist/assets/noto-sans-sc-48-wght-normal-BNMfTR6k.woff2 +0 -0
- package/dist/assets/noto-sans-sc-49-wght-normal-DX-0y7wg.woff2 +0 -0
- package/dist/assets/noto-sans-sc-5-wght-normal-CfWugllB.woff2 +0 -0
- package/dist/assets/noto-sans-sc-50-wght-normal-DAOGW-Dr.woff2 +0 -0
- package/dist/assets/noto-sans-sc-51-wght-normal-BlFLOjcP.woff2 +0 -0
- package/dist/assets/noto-sans-sc-52-wght-normal-OZjrybnw.woff2 +0 -0
- package/dist/assets/noto-sans-sc-53-wght-normal-CwyWNT6x.woff2 +0 -0
- package/dist/assets/noto-sans-sc-54-wght-normal-DM0nRe18.woff2 +0 -0
- package/dist/assets/noto-sans-sc-55-wght-normal-DBK2wUOR.woff2 +0 -0
- package/dist/assets/noto-sans-sc-56-wght-normal-C-VKK1LS.woff2 +0 -0
- package/dist/assets/noto-sans-sc-57-wght-normal-Cdbfh5kq.woff2 +0 -0
- package/dist/assets/noto-sans-sc-58-wght-normal-CflMKARZ.woff2 +0 -0
- package/dist/assets/noto-sans-sc-59-wght-normal-BS4Kwzxx.woff2 +0 -0
- package/dist/assets/noto-sans-sc-6-wght-normal-ChnZIQfQ.woff2 +0 -0
- package/dist/assets/noto-sans-sc-60-wght-normal-B7QOYsXJ.woff2 +0 -0
- package/dist/assets/noto-sans-sc-61-wght-normal-C8JjQS7w.woff2 +0 -0
- package/dist/assets/noto-sans-sc-62-wght-normal-bS4wq1Gg.woff2 +0 -0
- package/dist/assets/noto-sans-sc-63-wght-normal-BJr8P-OB.woff2 +0 -0
- package/dist/assets/noto-sans-sc-64-wght-normal-DVB11t7j.woff2 +0 -0
- package/dist/assets/noto-sans-sc-65-wght-normal-DMPCXBvK.woff2 +0 -0
- package/dist/assets/noto-sans-sc-66-wght-normal-BobaG10V.woff2 +0 -0
- package/dist/assets/noto-sans-sc-67-wght-normal-Dzk7WhCR.woff2 +0 -0
- package/dist/assets/noto-sans-sc-68-wght-normal-DGbCD9xu.woff2 +0 -0
- package/dist/assets/noto-sans-sc-69-wght-normal-Ctrv1EqA.woff2 +0 -0
- package/dist/assets/noto-sans-sc-70-wght-normal-RgTO941D.woff2 +0 -0
- package/dist/assets/noto-sans-sc-71-wght-normal-D9sG-CWv.woff2 +0 -0
- package/dist/assets/noto-sans-sc-72-wght-normal-C4oWy3ul.woff2 +0 -0
- package/dist/assets/noto-sans-sc-73-wght-normal-B1ZoOTgM.woff2 +0 -0
- package/dist/assets/noto-sans-sc-74-wght-normal-F7dH_rZJ.woff2 +0 -0
- package/dist/assets/noto-sans-sc-75-wght-normal-Cp2wp4si.woff2 +0 -0
- package/dist/assets/noto-sans-sc-76-wght-normal-B494D7xS.woff2 +0 -0
- package/dist/assets/noto-sans-sc-77-wght-normal-B3MVY9Ax.woff2 +0 -0
- package/dist/assets/noto-sans-sc-78-wght-normal-5jX7iNMC.woff2 +0 -0
- package/dist/assets/noto-sans-sc-79-wght-normal-BIoZy8fr.woff2 +0 -0
- package/dist/assets/noto-sans-sc-80-wght-normal-Bje1Fxy1.woff2 +0 -0
- package/dist/assets/noto-sans-sc-81-wght-normal-B2NN7Qi3.woff2 +0 -0
- package/dist/assets/noto-sans-sc-82-wght-normal-CUggNZi4.woff2 +0 -0
- package/dist/assets/noto-sans-sc-83-wght-normal-99rD8YO-.woff2 +0 -0
- package/dist/assets/noto-sans-sc-84-wght-normal-zMBmUocm.woff2 +0 -0
- package/dist/assets/noto-sans-sc-85-wght-normal-CjI3qdxG.woff2 +0 -0
- package/dist/assets/noto-sans-sc-86-wght-normal-BHY8TVEH.woff2 +0 -0
- package/dist/assets/noto-sans-sc-87-wght-normal-DioZSHnU.woff2 +0 -0
- package/dist/assets/noto-sans-sc-88-wght-normal-BXYxwf2t.woff2 +0 -0
- package/dist/assets/noto-sans-sc-89-wght-normal-ClMFrFaL.woff2 +0 -0
- package/dist/assets/noto-sans-sc-90-wght-normal-BnOlPreP.woff2 +0 -0
- package/dist/assets/noto-sans-sc-91-wght-normal-DTr9RQcS.woff2 +0 -0
- package/dist/assets/noto-sans-sc-97-wght-normal-9u6Aiav-.woff2 +0 -0
- package/dist/assets/noto-sans-sc-98-wght-normal-BR-H2C0V.woff2 +0 -0
- package/dist/assets/noto-sans-sc-99-wght-normal-BI6XPoxp.woff2 +0 -0
- package/dist/assets/noto-sans-sc-cyrillic-wght-normal-BGmsQlw-.woff2 +0 -0
- package/dist/assets/noto-sans-sc-latin-ext-wght-normal-DuJTpTg_.woff2 +0 -0
- package/dist/assets/noto-sans-sc-latin-wght-normal-DDW8mKAR.woff2 +0 -0
- package/dist/assets/noto-sans-sc-vietnamese-wght-normal-Bi3ATJ76.woff2 +0 -0
- package/dist/avatar.d.ts +11 -0
- package/dist/avatar.js +25 -0
- package/dist/compatibility-info.d.ts +11 -0
- package/dist/compatibility-info.js +12 -0
- package/dist/delivery-failure.d.ts +4 -0
- package/dist/delivery-failure.js +10 -0
- package/dist/fonts.css +1 -0
- package/dist/format.d.ts +25 -0
- package/dist/format.js +33 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +21 -0
- package/dist/licenses/geist-mono.txt +93 -0
- package/dist/licenses/geist.txt +93 -0
- package/dist/licenses/noto-sans-sc.txt +93 -0
- package/dist/logo.d.ts +3 -0
- package/dist/logo.js +8 -0
- package/dist/markdown.d.ts +4 -0
- package/dist/markdown.js +25 -0
- package/dist/message-chart.d.ts +6 -0
- package/dist/message-chart.js +103 -0
- package/dist/motion.d.ts +45 -0
- package/dist/motion.js +22 -0
- package/dist/plugin-page-layout.d.ts +7 -0
- package/dist/plugin-page-layout.js +6 -0
- package/dist/provider.d.ts +4 -0
- package/dist/provider.js +6 -0
- package/dist/schema-form.d.ts +39 -0
- package/dist/schema-form.js +244 -0
- package/dist/segments.d.ts +10 -0
- package/dist/segments.js +81 -0
- package/dist/styles.css +2 -0
- package/dist/trace-view.d.ts +6 -0
- package/dist/trace-view.js +58 -0
- package/dist/types.d.ts +85 -0
- package/dist/types.js +1 -0
- package/dist/ui/button.d.ts +25 -0
- package/dist/ui/button.js +24 -0
- package/dist/ui/date-picker.d.ts +15 -0
- package/dist/ui/date-picker.js +167 -0
- package/dist/ui/dialog.d.ts +20 -0
- package/dist/ui/dialog.js +17 -0
- package/dist/ui/input.d.ts +14 -0
- package/dist/ui/input.js +15 -0
- package/dist/ui/misc.d.ts +62 -0
- package/dist/ui/misc.js +53 -0
- package/dist/ui/primitives.d.ts +59 -0
- package/dist/ui/primitives.js +51 -0
- package/dist/ui/select.d.ts +17 -0
- package/dist/ui/select.js +12 -0
- package/dist/ui/switch.d.ts +8 -0
- package/dist/ui/switch.js +8 -0
- package/dist/utils.d.ts +4 -0
- package/dist/utils.js +15 -0
- package/package.json +68 -3
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
2
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
3
|
+
import { type ReactNode } from 'react';
|
|
4
|
+
export declare function Tooltip({ content, children, side, }: {
|
|
5
|
+
content: ReactNode;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
8
|
+
}): import("react").JSX.Element;
|
|
9
|
+
export declare const TooltipProvider: import("react").FC<TooltipPrimitive.TooltipProviderProps>;
|
|
10
|
+
/** Segmented control with a sliding selection pill. */
|
|
11
|
+
export declare function Segmented<V extends string>({ value, onChange, options, size, className, }: {
|
|
12
|
+
value: V;
|
|
13
|
+
onChange: (value: V) => void;
|
|
14
|
+
options: {
|
|
15
|
+
value: V;
|
|
16
|
+
label: ReactNode;
|
|
17
|
+
}[];
|
|
18
|
+
size?: 'sm' | 'md';
|
|
19
|
+
className?: string;
|
|
20
|
+
}): import("react").JSX.Element;
|
|
21
|
+
/** Page-level view switch: text tabs over a hairline, with a sliding underline. */
|
|
22
|
+
export declare function PageTabs<V extends string>({ value, onChange, tabs, className, }: {
|
|
23
|
+
value: V;
|
|
24
|
+
onChange: (value: V) => void;
|
|
25
|
+
tabs: {
|
|
26
|
+
value: V;
|
|
27
|
+
label: ReactNode;
|
|
28
|
+
}[];
|
|
29
|
+
className?: string;
|
|
30
|
+
}): import("react").JSX.Element;
|
|
31
|
+
/** Tabs with an animated underline indicator. */
|
|
32
|
+
export declare function Tabs<V extends string>({ value, onChange, tabs, children, className, }: {
|
|
33
|
+
value: V;
|
|
34
|
+
onChange: (value: V) => void;
|
|
35
|
+
tabs: {
|
|
36
|
+
value: V;
|
|
37
|
+
label: ReactNode;
|
|
38
|
+
count?: number;
|
|
39
|
+
}[];
|
|
40
|
+
children: ReactNode;
|
|
41
|
+
className?: string;
|
|
42
|
+
}): import("react").JSX.Element;
|
|
43
|
+
export declare const TabPanel: import("react").ForwardRefExoticComponent<TabsPrimitive.TabsContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
44
|
+
export declare function Menu({ trigger, children, align, }: {
|
|
45
|
+
trigger: ReactNode;
|
|
46
|
+
children: ReactNode;
|
|
47
|
+
align?: 'start' | 'end';
|
|
48
|
+
}): import("react").JSX.Element;
|
|
49
|
+
export declare function MenuItem({ icon, children, onSelect, danger, disabled, }: {
|
|
50
|
+
icon?: ReactNode;
|
|
51
|
+
children: ReactNode;
|
|
52
|
+
onSelect: () => void;
|
|
53
|
+
danger?: boolean;
|
|
54
|
+
disabled?: boolean;
|
|
55
|
+
}): import("react").JSX.Element;
|
|
56
|
+
export declare const MenuSeparator: () => import("react").JSX.Element;
|
|
57
|
+
/** Animates numeric changes (count-up on mount, smooth roll on updates). */
|
|
58
|
+
export declare function NumberTicker({ value, format, className, }: {
|
|
59
|
+
value: number;
|
|
60
|
+
format?: (n: number) => string;
|
|
61
|
+
className?: string;
|
|
62
|
+
}): import("react").JSX.Element;
|
package/dist/ui/misc.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as DropdownPrimitive from '@radix-ui/react-dropdown-menu';
|
|
3
|
+
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
4
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
5
|
+
import { animate, motion, useMotionValue, useTransform } from 'motion/react';
|
|
6
|
+
import { useEffect, useId } from 'react';
|
|
7
|
+
import { snappy, spring } from '../motion.js';
|
|
8
|
+
import { cn } from '../utils.js';
|
|
9
|
+
export function Tooltip({ content, children, side = 'top', }) {
|
|
10
|
+
return (_jsxs(TooltipPrimitive.Root, { delayDuration: 250, children: [_jsx(TooltipPrimitive.Trigger, { asChild: true, children: children }), _jsx(TooltipPrimitive.Portal, { children: _jsx(TooltipPrimitive.Content, { side: side, sideOffset: 6, className: "z-50 rounded-lg bg-fg px-2.5 py-1.5 text-[12px] font-medium text-bg shadow-pop data-[state=delayed-open]:animate-[pop-in_140ms_cubic-bezier(0.16,1,0.3,1)]", children: content }) })] }));
|
|
11
|
+
}
|
|
12
|
+
export const TooltipProvider = TooltipPrimitive.Provider;
|
|
13
|
+
/** Segmented control with a sliding selection pill. */
|
|
14
|
+
export function Segmented({ value, onChange, options, size = 'md', className, }) {
|
|
15
|
+
const id = useId();
|
|
16
|
+
return (_jsx("fieldset", { className: cn('m-0 inline-flex min-w-0 items-center rounded-[10px] border border-border bg-surface-2 p-0.5', size === 'sm' ? 'h-7' : 'h-9', className), children: options.map((option) => {
|
|
17
|
+
const active = option.value === value;
|
|
18
|
+
return (_jsxs("button", { type: "button", "aria-pressed": active, onClick: () => onChange(option.value), className: cn('relative h-full cursor-pointer rounded-lg px-3 font-medium transition-colors duration-150', size === 'sm' ? 'text-[12px]' : 'text-[13px]', active ? 'text-fg' : 'text-fg-3 hover:text-fg-2'), children: [active && (_jsx(motion.span, { layoutId: `segmented-${id}`, transition: spring, className: "absolute inset-0 rounded-lg border border-border bg-surface shadow-card" })), _jsx("span", { className: "relative", children: option.label })] }, option.value));
|
|
19
|
+
}) }));
|
|
20
|
+
}
|
|
21
|
+
/** Page-level view switch: text tabs over a hairline, with a sliding underline. */
|
|
22
|
+
export function PageTabs({ value, onChange, tabs, className, }) {
|
|
23
|
+
const id = useId();
|
|
24
|
+
return (_jsx("div", { role: "tablist", className: cn('flex flex-wrap gap-x-3 border-b border-border sm:gap-x-5', className), children: tabs.map((tab) => {
|
|
25
|
+
const active = tab.value === value;
|
|
26
|
+
return (_jsxs("button", { type: "button", role: "tab", "aria-selected": active, onClick: () => onChange(tab.value), className: cn('relative flex h-10 shrink-0 cursor-pointer items-center gap-1.5 whitespace-nowrap text-[13.5px] font-medium transition-colors', active ? 'text-fg' : 'text-fg-3 hover:text-fg-2'), children: [tab.label, active && (_jsx(motion.span, { layoutId: `page-tab-${id}`, transition: spring, className: "absolute inset-x-0 -bottom-px h-[2px] rounded-full bg-accent" }))] }, tab.value));
|
|
27
|
+
}) }));
|
|
28
|
+
}
|
|
29
|
+
/** Tabs with an animated underline indicator. */
|
|
30
|
+
export function Tabs({ value, onChange, tabs, children, className, }) {
|
|
31
|
+
const id = useId();
|
|
32
|
+
return (_jsxs(TabsPrimitive.Root, { value: value, onValueChange: (next) => onChange(next), className: className, children: [_jsx(TabsPrimitive.List, { className: "flex gap-1 border-b border-border px-6", children: tabs.map((tab) => (_jsxs(TabsPrimitive.Trigger, { value: tab.value, className: cn('relative -mb-px flex h-10 cursor-pointer items-center gap-1.5 px-2 text-[13px] font-medium transition-colors outline-none', tab.value === value ? 'text-fg' : 'text-fg-3 hover:text-fg-2'), children: [tab.label, tab.count !== undefined && (_jsx("span", { className: "rounded-full bg-surface-2 px-1.5 text-[11px] text-fg-3 tabular", children: tab.count })), tab.value === value && (_jsx(motion.span, { layoutId: `tab-${id}`, transition: spring, className: "absolute inset-x-1 bottom-0 h-[2px] rounded-full bg-accent" }))] }, tab.value))) }), children] }));
|
|
33
|
+
}
|
|
34
|
+
export const TabPanel = TabsPrimitive.Content;
|
|
35
|
+
export function Menu({ trigger, children, align = 'end', }) {
|
|
36
|
+
return (_jsxs(DropdownPrimitive.Root, { children: [_jsx(DropdownPrimitive.Trigger, { asChild: true, children: trigger }), _jsx(DropdownPrimitive.Portal, { children: _jsx(DropdownPrimitive.Content, { align: align, sideOffset: 6, className: "z-50 min-w-44 rounded-xl border border-border bg-surface p-1 shadow-pop data-[state=open]:animate-[pop-in_150ms_cubic-bezier(0.16,1,0.3,1)]", children: children }) })] }));
|
|
37
|
+
}
|
|
38
|
+
export function MenuItem({ icon, children, onSelect, danger = false, disabled = false, }) {
|
|
39
|
+
return (_jsxs(DropdownPrimitive.Item, { disabled: disabled, onSelect: onSelect, className: cn('flex h-8 cursor-pointer items-center gap-2 rounded-lg px-2.5 text-[13px] outline-none select-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 [&>svg]:size-3.5', danger
|
|
40
|
+
? 'text-danger data-[highlighted]:bg-danger-soft'
|
|
41
|
+
: 'text-fg-2 data-[highlighted]:bg-surface-2 data-[highlighted]:text-fg'), children: [icon, children] }));
|
|
42
|
+
}
|
|
43
|
+
export const MenuSeparator = () => _jsx(DropdownPrimitive.Separator, { className: "my-1 h-px bg-border" });
|
|
44
|
+
/** Animates numeric changes (count-up on mount, smooth roll on updates). */
|
|
45
|
+
export function NumberTicker({ value, format, className, }) {
|
|
46
|
+
const motionValue = useMotionValue(0);
|
|
47
|
+
const text = useTransform(motionValue, (latest) => format ? format(latest) : Math.round(latest).toLocaleString('zh-CN'));
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
const controls = animate(motionValue, value, { ...snappy, stiffness: 120, damping: 24 });
|
|
50
|
+
return () => controls.stop();
|
|
51
|
+
}, [motionValue, value]);
|
|
52
|
+
return _jsx(motion.span, { className: cn('tabular', className), children: text });
|
|
53
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export declare function Card({ className, ...props }: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
3
|
+
export declare function CardHeader({ title, description, action, className, }: {
|
|
4
|
+
title: ReactNode;
|
|
5
|
+
description?: ReactNode;
|
|
6
|
+
action?: ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
9
|
+
declare const tones: {
|
|
10
|
+
readonly neutral: 'bg-surface-2 text-fg-2 border-border';
|
|
11
|
+
readonly accent: 'bg-accent-soft text-accent-soft-fg border-transparent';
|
|
12
|
+
readonly success: 'bg-success-soft text-success border-transparent';
|
|
13
|
+
readonly warning: 'bg-warning-soft text-warning border-transparent';
|
|
14
|
+
readonly danger: 'bg-danger-soft text-danger border-transparent';
|
|
15
|
+
readonly info: 'bg-info-soft text-info border-transparent';
|
|
16
|
+
};
|
|
17
|
+
export type Tone = keyof typeof tones;
|
|
18
|
+
export declare function Badge({ tone, dot, pulse, className, children, }: {
|
|
19
|
+
tone?: Tone;
|
|
20
|
+
dot?: boolean;
|
|
21
|
+
pulse?: boolean;
|
|
22
|
+
className?: string;
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
}): import("react").JSX.Element;
|
|
25
|
+
export declare function StatusDot({ tone, pulse, className, }: {
|
|
26
|
+
tone: Tone;
|
|
27
|
+
pulse?: boolean;
|
|
28
|
+
className?: string;
|
|
29
|
+
}): import("react").JSX.Element;
|
|
30
|
+
export declare function Kbd({ children, className }: {
|
|
31
|
+
children: ReactNode;
|
|
32
|
+
className?: string;
|
|
33
|
+
}): import("react").JSX.Element;
|
|
34
|
+
export declare function Spinner({ className }: {
|
|
35
|
+
className?: string;
|
|
36
|
+
}): import("react").JSX.Element;
|
|
37
|
+
export declare function Skeleton({ className }: {
|
|
38
|
+
className?: string;
|
|
39
|
+
}): import("react").JSX.Element;
|
|
40
|
+
export declare function EmptyState({ icon, title, description, action, className, }: {
|
|
41
|
+
icon: ReactNode;
|
|
42
|
+
title: ReactNode;
|
|
43
|
+
description?: ReactNode;
|
|
44
|
+
action?: ReactNode;
|
|
45
|
+
className?: string;
|
|
46
|
+
}): import("react").JSX.Element;
|
|
47
|
+
/** Failed query: shows the reason and a retry button instead of leaving a skeleton on screen forever. */
|
|
48
|
+
export declare function ErrorState({ error, onRetry, retrying, className, }: {
|
|
49
|
+
error: Error;
|
|
50
|
+
onRetry: () => void;
|
|
51
|
+
retrying?: boolean;
|
|
52
|
+
className?: string;
|
|
53
|
+
}): import("react").JSX.Element;
|
|
54
|
+
export declare function PageHeader({ title, description, actions, }: {
|
|
55
|
+
title: ReactNode;
|
|
56
|
+
description?: ReactNode;
|
|
57
|
+
actions?: ReactNode;
|
|
58
|
+
}): import("react").JSX.Element;
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { motion } from 'motion/react';
|
|
3
|
+
import { softSpring } from '../motion.js';
|
|
4
|
+
import { cn } from '../utils.js';
|
|
5
|
+
export function Card({ className, ...props }) {
|
|
6
|
+
return _jsx("div", { className: cn('card', className), ...props });
|
|
7
|
+
}
|
|
8
|
+
export function CardHeader({ title, description, action, className, }) {
|
|
9
|
+
return (_jsxs("div", { className: cn('flex items-start justify-between gap-4 px-5 pt-4 pb-3', className), children: [_jsxs("div", { className: "min-w-0", children: [_jsx("h3", { className: "text-[13.5px] font-semibold tracking-[-0.01em] text-fg", children: title }), description && _jsx("p", { className: "mt-0.5 text-[12.5px] text-fg-3", children: description })] }), action && _jsx("div", { className: "flex shrink-0 items-center gap-2", children: action })] }));
|
|
10
|
+
}
|
|
11
|
+
const tones = {
|
|
12
|
+
neutral: 'bg-surface-2 text-fg-2 border-border',
|
|
13
|
+
accent: 'bg-accent-soft text-accent-soft-fg border-transparent',
|
|
14
|
+
success: 'bg-success-soft text-success border-transparent',
|
|
15
|
+
warning: 'bg-warning-soft text-warning border-transparent',
|
|
16
|
+
danger: 'bg-danger-soft text-danger border-transparent',
|
|
17
|
+
info: 'bg-info-soft text-info border-transparent',
|
|
18
|
+
};
|
|
19
|
+
export function Badge({ tone = 'neutral', dot = false, pulse = false, className, children, }) {
|
|
20
|
+
return (_jsxs("span", { className: cn('inline-flex h-[22px] items-center gap-1.5 rounded-md border px-2 text-[11.5px] font-medium whitespace-nowrap', tones[tone], className), children: [dot && _jsx(StatusDot, { tone: tone, pulse: pulse }), children] }));
|
|
21
|
+
}
|
|
22
|
+
const dotColors = {
|
|
23
|
+
neutral: 'bg-fg-3',
|
|
24
|
+
accent: 'bg-accent',
|
|
25
|
+
success: 'bg-success',
|
|
26
|
+
warning: 'bg-warning',
|
|
27
|
+
danger: 'bg-danger',
|
|
28
|
+
info: 'bg-info',
|
|
29
|
+
};
|
|
30
|
+
export function StatusDot({ tone, pulse = false, className, }) {
|
|
31
|
+
return (_jsxs("span", { className: cn('relative inline-flex size-1.5 shrink-0', className), children: [pulse && (_jsx("span", { className: cn('absolute inset-0 rounded-full motion-safe:animate-pulse-soft', dotColors[tone]) })), _jsx("span", { className: cn('relative inline-flex size-full rounded-full', dotColors[tone]) })] }));
|
|
32
|
+
}
|
|
33
|
+
export function Kbd({ children, className }) {
|
|
34
|
+
return (_jsx("kbd", { className: cn('inline-flex h-5 min-w-5 items-center justify-center rounded-[5px] border border-border bg-surface-2 px-1 font-sans text-[11px] font-medium text-fg-3', className), children: children }));
|
|
35
|
+
}
|
|
36
|
+
export function Spinner({ className }) {
|
|
37
|
+
return (_jsxs("svg", { className: cn('size-4 animate-spin', className), viewBox: "0 0 24 24", fill: "none", "aria-hidden": true, children: [_jsx("circle", { cx: "12", cy: "12", r: "9", stroke: "currentColor", strokeOpacity: "0.2", strokeWidth: "3" }), _jsx("path", { d: "M21 12a9 9 0 0 0-9-9", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round" })] }));
|
|
38
|
+
}
|
|
39
|
+
export function Skeleton({ className }) {
|
|
40
|
+
return _jsx("div", { className: cn('skeleton', className) });
|
|
41
|
+
}
|
|
42
|
+
export function EmptyState({ icon, title, description, action, className, }) {
|
|
43
|
+
return (_jsxs(motion.div, { initial: { opacity: 0, y: 6 }, animate: { opacity: 1, y: 0 }, transition: softSpring, className: cn('flex flex-col items-center justify-center px-6 py-14 text-center', className), children: [_jsx("div", { className: "mb-4 flex size-11 items-center justify-center rounded-xl border border-border bg-surface-2 text-fg-3 [&>svg]:size-5", children: icon }), _jsx("p", { className: "text-sm font-medium text-fg", children: title }), description && _jsx("p", { className: "mt-1 max-w-sm text-[13px] leading-relaxed text-fg-3", children: description }), action && _jsx("div", { className: "mt-5", children: action })] }));
|
|
44
|
+
}
|
|
45
|
+
/** Failed query: shows the reason and a retry button instead of leaving a skeleton on screen forever. */
|
|
46
|
+
export function ErrorState({ error, onRetry, retrying = false, className, }) {
|
|
47
|
+
return (_jsx(EmptyState, { icon: _jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, className: "text-danger", children: [_jsx("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" }), _jsx("path", { d: "M12 9v4" }), _jsx("path", { d: "M12 17h.01" })] }), title: "\u52A0\u8F7D\u5931\u8D25", description: error.message, className: className, action: _jsxs("button", { type: "button", onClick: onRetry, disabled: retrying, className: "inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-lg border border-border bg-surface px-3 text-[12.5px] font-medium text-fg shadow-card transition-colors hover:bg-surface-2 disabled:cursor-wait disabled:opacity-60", children: [retrying && _jsx(Spinner, { className: "size-3.5" }), "\u91CD\u8BD5"] }) }));
|
|
48
|
+
}
|
|
49
|
+
export function PageHeader({ title, description, actions, }) {
|
|
50
|
+
return (_jsxs("div", { className: "mb-6 flex flex-wrap items-end justify-between gap-4", children: [_jsxs("div", { children: [_jsx("h1", { className: "text-[22px] font-semibold tracking-[-0.025em] text-fg", children: title }), description && _jsx("p", { className: "mt-1 text-[13.5px] text-fg-3", children: description })] }), actions && _jsx("div", { className: "flex items-center gap-2", children: actions })] }));
|
|
51
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface SelectOption<V extends string> {
|
|
3
|
+
value: V;
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function Select<V extends string>({ id, value, onValueChange, options, placeholder, className, disabled, 'aria-label': ariaLabel, 'aria-invalid': invalid, }: {
|
|
8
|
+
id?: string;
|
|
9
|
+
value: V | undefined;
|
|
10
|
+
onValueChange: (value: V) => void;
|
|
11
|
+
options: readonly SelectOption<V>[];
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
className?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
'aria-label'?: string;
|
|
16
|
+
'aria-invalid'?: boolean;
|
|
17
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
3
|
+
import { Check, ChevronDown, ChevronUp } from 'lucide-react';
|
|
4
|
+
import { cn } from '../utils.js';
|
|
5
|
+
const optionKey = (value) => `:${value}`;
|
|
6
|
+
export function Select({ id, value, onValueChange, options, placeholder, className, disabled, 'aria-label': ariaLabel, 'aria-invalid': invalid, }) {
|
|
7
|
+
return (_jsxs(SelectPrimitive.Root, { disabled: disabled, value: value === undefined ? '' : optionKey(value), onValueChange: (next) => {
|
|
8
|
+
const option = options.find((item) => optionKey(item.value) === next);
|
|
9
|
+
if (option)
|
|
10
|
+
onValueChange(option.value);
|
|
11
|
+
}, children: [_jsxs(SelectPrimitive.Trigger, { id: id, "aria-label": ariaLabel, "aria-invalid": invalid, className: cn('group inline-flex h-9 min-w-0 max-w-full cursor-pointer items-center justify-between gap-2 rounded-[10px] border border-border bg-surface px-3 text-[13.5px] text-fg shadow-card outline-none transition-[border-color,box-shadow] hover:border-border-strong focus-visible:border-accent focus-visible:shadow-[0_0_0_3px_var(--ring)] data-[state=open]:border-accent data-[placeholder]:text-fg-3 disabled:cursor-not-allowed disabled:opacity-60 aria-[invalid=true]:border-danger', className), children: [_jsx("span", { className: "min-w-0 flex-1 truncate text-left", children: _jsx(SelectPrimitive.Value, { placeholder: placeholder }) }), _jsx(SelectPrimitive.Icon, { className: "shrink-0", children: _jsx(ChevronDown, { className: "size-3.5 text-fg-3 motion-safe:transition-transform group-data-[state=open]:rotate-180" }) })] }), _jsx(SelectPrimitive.Portal, { children: _jsxs(SelectPrimitive.Content, { position: "popper", align: "start", sideOffset: 6, collisionPadding: 8, className: "z-50 max-h-[min(18rem,var(--radix-select-content-available-height))] w-max min-w-[min(var(--radix-select-trigger-width),var(--radix-select-content-available-width))] max-w-[min(max(24rem,var(--radix-select-trigger-width)),var(--radix-select-content-available-width))] overflow-hidden rounded-xl border border-border bg-surface p-1 shadow-pop motion-safe:data-[state=open]:animate-[pop-in_160ms_cubic-bezier(0.16,1,0.3,1)]", children: [_jsx(SelectPrimitive.ScrollUpButton, { className: "flex h-5 shrink-0 items-center justify-center text-fg-3", children: _jsx(ChevronUp, { "aria-hidden": "true", className: "size-3.5" }) }), _jsx(SelectPrimitive.Viewport, { className: "min-h-0", children: options.map((option) => (_jsxs(SelectPrimitive.Item, { value: optionKey(option.value), disabled: option.disabled, className: "relative flex min-h-8 cursor-pointer items-center rounded-md py-1.5 pr-8 pl-2.5 text-[13px] leading-snug wrap-anywhere text-fg-2 outline-none select-none data-[disabled]:cursor-not-allowed data-[disabled]:text-fg-3 data-[highlighted]:bg-accent-soft data-[highlighted]:text-accent-soft-fg data-[state=checked]:font-medium", children: [_jsx(SelectPrimitive.ItemText, { children: option.label }), _jsx(SelectPrimitive.ItemIndicator, { className: "absolute top-1/2 right-2.5 -translate-y-1/2", children: _jsx(Check, { className: "size-3.5 text-accent", strokeWidth: 2.5 }) })] }, option.value))) }), _jsx(SelectPrimitive.ScrollDownButton, { className: "flex h-5 shrink-0 items-center justify-center text-fg-3", children: _jsx(ChevronDown, { "aria-hidden": "true", className: "size-3.5" }) })] }) })] }));
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function Switch({ id, checked, onCheckedChange, disabled, className, 'aria-label': ariaLabel, }: {
|
|
2
|
+
id?: string;
|
|
3
|
+
checked: boolean;
|
|
4
|
+
onCheckedChange: (checked: boolean) => void;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
'aria-label'?: string;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
3
|
+
import { motion } from 'motion/react';
|
|
4
|
+
import { snappy } from '../motion.js';
|
|
5
|
+
import { cn } from '../utils.js';
|
|
6
|
+
export function Switch({ id, checked, onCheckedChange, disabled, className, 'aria-label': ariaLabel, }) {
|
|
7
|
+
return (_jsx(SwitchPrimitive.Root, { id: id, checked: checked, onCheckedChange: onCheckedChange, disabled: disabled, "aria-label": ariaLabel, className: cn('relative inline-flex h-[22px] w-[38px] shrink-0 cursor-pointer items-center rounded-full p-[2px] transition-colors duration-200', 'disabled:cursor-not-allowed disabled:opacity-50', checked ? 'bg-accent' : 'bg-surface-3 shadow-[inset_0_0_0_1px_var(--border-strong)]', className), children: _jsx(SwitchPrimitive.Thumb, { asChild: true, children: _jsx(motion.span, { layout: true, transition: snappy, className: cn('block size-[18px] rounded-full bg-white shadow-[0_1px_3px_rgb(0_0_0/0.25),0_0_0_0.5px_rgb(0_0_0/0.04)]', checked ? 'ml-auto' : 'ml-0') }) }) }));
|
|
8
|
+
}
|
package/dist/utils.d.ts
ADDED
package/dist/utils.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
|
+
import { twMerge } from 'tailwind-merge';
|
|
3
|
+
export function cn(...inputs) {
|
|
4
|
+
return twMerge(clsx(inputs));
|
|
5
|
+
}
|
|
6
|
+
/** Generate a UUID v4 in both HTTP and HTTPS pages. */
|
|
7
|
+
export function createUuid() {
|
|
8
|
+
const bytes = crypto.getRandomValues(new Uint8Array(16));
|
|
9
|
+
const hex = Array.from(bytes, (byte, index) => {
|
|
10
|
+
// Set the UUID version and variant bits.
|
|
11
|
+
const value = index === 6 ? (byte & 0x0f) | 0x40 : index === 8 ? (byte & 0x3f) | 0x80 : byte;
|
|
12
|
+
return value.toString(16).padStart(2, '0');
|
|
13
|
+
}).join('');
|
|
14
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,71 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asabot/panel-ui",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "AsaBot 控制台和插件页面共用的 React 组件与主题",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/isyuah/AsaBot.git",
|
|
10
|
+
"directory": "packages/panel-ui"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"default": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./markdown": {
|
|
18
|
+
"types": "./dist/markdown.d.ts",
|
|
19
|
+
"default": "./dist/markdown.js"
|
|
20
|
+
},
|
|
21
|
+
"./styles.css": "./dist/styles.css",
|
|
22
|
+
"./fonts.css": "./dist/fonts.css"
|
|
23
|
+
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"README.md",
|
|
30
|
+
"LICENSE"
|
|
31
|
+
],
|
|
32
|
+
"sideEffects": [
|
|
33
|
+
"**/*.css"
|
|
34
|
+
],
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"react": "^19.0.0",
|
|
37
|
+
"react-dom": "^19.0.0"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@radix-ui/react-dialog": "^1.3.1",
|
|
41
|
+
"@radix-ui/react-dropdown-menu": "^2.2.1",
|
|
42
|
+
"@radix-ui/react-popover": "^1.3.1",
|
|
43
|
+
"@radix-ui/react-select": "^2.4.1",
|
|
44
|
+
"@radix-ui/react-switch": "^1.4.1",
|
|
45
|
+
"@radix-ui/react-tabs": "^1.2.1",
|
|
46
|
+
"@radix-ui/react-tooltip": "^1.4.1",
|
|
47
|
+
"clsx": "^2.1.1",
|
|
48
|
+
"lucide-react": "^1.71.0",
|
|
49
|
+
"motion": "^14.12.0",
|
|
50
|
+
"react-markdown": "^10.1.0",
|
|
51
|
+
"remark-gfm": "^4.0.1",
|
|
52
|
+
"tailwind-merge": "^3.7.0"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@fontsource-variable/geist": "^5.3.0",
|
|
56
|
+
"@fontsource-variable/geist-mono": "^5.3.0",
|
|
57
|
+
"@fontsource-variable/noto-sans-sc": "^5.3.1",
|
|
58
|
+
"@tailwindcss/vite": "^4.3.5",
|
|
59
|
+
"@types/react": "^19.3.0",
|
|
60
|
+
"@types/react-dom": "^19.3.0",
|
|
61
|
+
"react": "^19.3.1",
|
|
62
|
+
"react-dom": "^19.3.1",
|
|
63
|
+
"tailwindcss": "^4.3.5",
|
|
64
|
+
"typescript": "^7.0.2",
|
|
65
|
+
"vite": "^8.3.8"
|
|
66
|
+
},
|
|
67
|
+
"scripts": {
|
|
68
|
+
"build": "vite build && tsc -p tsconfig.json",
|
|
69
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
70
|
+
}
|
|
6
71
|
}
|