@xiongtao.xt/tau-plugins 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 +4 -2
- package/package.json +31 -3
- package/runtime.js +1 -0
- package/types/packages/editor/api.d.ts +10 -0
- package/types/packages/editor/contracts.d.ts +3 -0
- package/types/packages/editor/src/api/command.d.ts +61 -0
- package/types/packages/editor/src/api/copy.d.ts +23 -0
- package/types/packages/editor/src/api/drag.d.ts +24 -0
- package/types/packages/editor/src/api/extension.d.ts +100 -0
- package/types/packages/editor/src/api/index.d.ts +54 -0
- package/types/packages/editor/src/api/ingest.d.ts +39 -0
- package/types/packages/editor/src/api/legacy.d.ts +10 -0
- package/types/packages/editor/src/api/marks.d.ts +35 -0
- package/types/packages/editor/src/api/menu.d.ts +37 -0
- package/types/packages/editor/src/api/submission.d.ts +38 -0
- package/types/packages/editor/src/api/toolbar.d.ts +3 -0
- package/types/packages/editor/src/components/AddParagraph/index.d.ts +11 -0
- package/types/packages/editor/src/components/BlockDrag/index.d.ts +35 -0
- package/types/packages/editor/src/components/ElementMenu/index.d.ts +11 -0
- package/types/packages/editor/src/components/FloatingToolbar/index.d.ts +23 -0
- package/types/packages/editor/src/components/HoveringToolbar/FloatingSubmenu.d.ts +19 -0
- package/types/packages/editor/src/components/HoveringToolbar/context.d.ts +8 -0
- package/types/packages/editor/src/components/HoveringToolbar/floatingPosition.d.ts +22 -0
- package/types/packages/editor/src/components/InlineChromiumBugFix/index.d.ts +2 -0
- package/types/packages/editor/src/components/OverlayBackDismiss/index.d.ts +4 -0
- package/types/packages/editor/src/hooks/useIsLastElement.d.ts +3 -0
- package/types/packages/editor/src/kit/elementEmpty.d.ts +5 -0
- package/types/packages/editor/src/menu/conversion.d.ts +3 -0
- package/types/packages/editor/src/model/paragraph.d.ts +5 -0
- package/types/packages/editor/src/services/editorNotifier.d.ts +4 -0
- package/types/packages/editor/src/services/errorReporter.d.ts +13 -0
- package/types/packages/editor/src/services/hooks.d.ts +11 -0
- package/types/packages/editor/src/services/notifier.d.ts +46 -0
- package/types/packages/editor/src/services/overlayBackDismiss.d.ts +10 -0
- package/types/packages/editor/src/services/registry.d.ts +6 -0
- package/types/packages/editor/src/services/tokens.d.ts +10 -0
- package/types/packages/editor/src/theme/ThemeService.d.ts +24 -0
- package/types/packages/editor/src/theme/context.d.ts +26 -0
- package/types/packages/editor/src/types/block-panel.d.ts +12 -0
- package/types/packages/editor/src/types/custom-element.d.ts +10 -0
- package/types/packages/editor/src/types/editor.d.ts +37 -0
- package/types/packages/editor/src/types/element/paragraph.d.ts +6 -0
- package/types/packages/editor/src/types/hotkeys.d.ts +6 -0
- package/types/packages/editor/src/types/hovering-bar.d.ts +8 -0
- package/types/packages/editor/src/types/index.d.ts +7 -0
- package/types/packages/editor/src/types/text.d.ts +1 -0
- package/types/packages/editor/src/types.d.ts +1 -0
- package/types/packages/editor/src/ui/CaretRight.d.ts +3 -0
- package/types/packages/editor/src/ui/Tooltip.d.ts +7 -0
- package/types/packages/editor/src/utils/blockNavigation.d.ts +28 -0
- package/types/packages/editor/src/utils/commandTarget.d.ts +4 -0
- package/types/packages/editor/src/utils/container.d.ts +3 -0
- package/types/packages/editor/src/utils/editor.d.ts +16 -0
- package/types/packages/editor/src/utils/element.d.ts +11 -0
- package/types/packages/editor/src/utils/insertElement.d.ts +11 -0
- package/types/packages/editor/src/utils/nodeOperations.d.ts +19 -0
- package/types/packages/editor/src/utils/paragraphShortcut.d.ts +4 -0
- package/types/packages/editor/src/utils/path.d.ts +6 -0
- package/types/packages/editor/src/utils/plugin.d.ts +4 -0
- package/types/packages/editor/src/utils/selectionSnapshot.d.ts +3 -0
- package/types/packages/editor/src/utils/zoomPan.d.ts +14 -0
- package/types/packages/markdown/src/codec.d.ts +86 -0
- package/types/packages/markdown/src/index.d.ts +7 -0
- package/types/packages/markdown/src/markdown-helper.d.ts +28 -0
- package/types/packages/markdown/src/markdown.d.ts +35 -0
- package/types/packages/markdown/src/markdownSerializerRegistry.d.ts +47 -0
- package/types/packages/markdown/src/model.d.ts +7 -0
- package/types/packages/markdown/src/positionMapper.d.ts +161 -0
- package/types/packages/markdown/src/processor.d.ts +27 -0
- package/types/packages/markdown/src/textCodec.d.ts +39 -0
- package/types/packages/markdown/src/types.d.ts +8 -0
- package/types/packages/plugins/src/contract.d.ts +49 -0
- package/types/packages/plugins/src/editor.d.ts +37 -0
- package/types/packages/plugins/src/index.d.ts +7 -0
- package/types/packages/plugins/src/pages.d.ts +23 -0
- package/types/packages/plugins/src/settings.d.ts +19 -0
- package/types/packages/plugins/src/sidebar.d.ts +29 -0
- package/types/packages/shared/service-contract.d.ts +6 -0
- package/types/packages/shared/service-registry.d.ts +25 -0
- package/types/packages/themes/src/bootstrap.d.ts +26 -0
- package/types/packages/themes/src/defineTheme.d.ts +45 -0
- package/types/packages/themes/src/index.d.ts +10 -0
- package/types/packages/themes/src/register.d.ts +9 -0
- package/types/packages/themes/src/themes/ink.theme.d.ts +11 -0
- package/types/packages/themes/src/themes/mint.theme.d.ts +11 -0
- package/types/packages/themes/src/themes/ocean.theme.d.ts +12 -0
- package/types/packages/themes/src/themes/paper.theme.d.ts +16 -0
- package/types/packages/themes/src/themes/sakura.theme.d.ts +11 -0
- package/types/packages/themes/src/themes/wisteria.theme.d.ts +10 -0
- package/types/packages/themes/src/tokenContract.d.ts +30 -0
- package/types/packages/ui/src/UiProvider.d.ts +17 -0
- package/types/packages/ui/src/cn.d.ts +23 -0
- package/types/packages/ui/src/hooks/fadeScrollClass.d.ts +8 -0
- package/types/packages/ui/src/hooks/index.d.ts +3 -0
- package/types/packages/ui/src/hooks/isEditableTarget.d.ts +2 -0
- package/types/packages/ui/src/hooks/lockBodyScroll.d.ts +1 -0
- package/types/packages/ui/src/hooks/scrollbarAutoHide.d.ts +9 -0
- package/types/packages/ui/src/hooks/useEdgeFade.d.ts +22 -0
- package/types/packages/ui/src/index.d.ts +47 -0
- package/types/packages/ui/src/patterns/FormRow.d.ts +20 -0
- package/types/packages/ui/src/primitives/AnchoredPanel.d.ts +53 -0
- package/types/packages/ui/src/primitives/Button.d.ts +31 -0
- package/types/packages/ui/src/primitives/Checkbox.d.ts +24 -0
- package/types/packages/ui/src/primitives/ConfirmDialog.d.ts +44 -0
- package/types/packages/ui/src/primitives/Dialog.d.ts +82 -0
- package/types/packages/ui/src/primitives/Drawer.d.ts +87 -0
- package/types/packages/ui/src/primitives/EditText.d.ts +32 -0
- package/types/packages/ui/src/primitives/ErrorBoundary.d.ts +16 -0
- package/types/packages/ui/src/primitives/FadeScroll.d.ts +18 -0
- package/types/packages/ui/src/primitives/FileDropZone.d.ts +14 -0
- package/types/packages/ui/src/primitives/FilterPill.d.ts +19 -0
- package/types/packages/ui/src/primitives/IconButton.d.ts +6 -0
- package/types/packages/ui/src/primitives/If.d.ts +6 -0
- package/types/packages/ui/src/primitives/ImagePreview.d.ts +16 -0
- package/types/packages/ui/src/primitives/Loading.d.ts +18 -0
- package/types/packages/ui/src/primitives/LoadingOverlay.d.ts +7 -0
- package/types/packages/ui/src/primitives/Menu.d.ts +93 -0
- package/types/packages/ui/src/primitives/Notification.d.ts +110 -0
- package/types/packages/ui/src/primitives/Panel.d.ts +28 -0
- package/types/packages/ui/src/primitives/Popover.d.ts +58 -0
- package/types/packages/ui/src/primitives/PortalToBody.d.ts +7 -0
- package/types/packages/ui/src/primitives/Radio.d.ts +27 -0
- package/types/packages/ui/src/primitives/RadioGroup.d.ts +32 -0
- package/types/packages/ui/src/primitives/ResizableAndHideableSidebar.d.ts +40 -0
- package/types/packages/ui/src/primitives/ResizeHandle.d.ts +23 -0
- package/types/packages/ui/src/primitives/Segmented.d.ts +44 -0
- package/types/packages/ui/src/primitives/Select.d.ts +78 -0
- package/types/packages/ui/src/primitives/Switch.d.ts +23 -0
- package/types/packages/ui/src/primitives/Tabs.d.ts +17 -0
- package/types/packages/ui/src/primitives/Tag.d.ts +24 -0
- package/types/packages/ui/src/primitives/Toast.d.ts +67 -0
- package/types/packages/ui/src/primitives/Tooltip.d.ts +40 -0
- package/types/packages/ui/src/primitives/ValueDisplay.d.ts +25 -0
- package/types/packages/ui/src/primitives/YearHeatmap.d.ts +15 -0
- package/types/packages/ui/src/primitives/anchoredPosition.d.ts +44 -0
- package/types/packages/ui/src/primitives/datepicker/DatePicker.d.ts +71 -0
- package/types/packages/ui/src/primitives/datepicker/DateRangePicker.d.ts +70 -0
- package/types/packages/ui/src/primitives/datepicker/calendarEngine.d.ts +45 -0
- package/types/packages/ui/src/primitives/editTextClasses.d.ts +1 -0
- package/types/packages/ui/src/primitives/input/Input.d.ts +35 -0
- package/types/packages/ui/src/primitives/input/NumberInput.d.ts +25 -0
- package/types/packages/ui/src/primitives/input/Textarea.d.ts +14 -0
- package/types/packages/ui/src/primitives/mergeRefs.d.ts +6 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ReactNode, type Ref } from "react";
|
|
2
|
+
interface FadeScrollProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
/** 需要拿到滚动容器时用(虚拟列表的 getScrollElement、滚动监听);对象 ref 或回调 ref */
|
|
6
|
+
scrollRef?: Ref<HTMLDivElement | null>;
|
|
7
|
+
/** 内部有 motion 布局动画时开启:渲染为 motion.div 并声明 layoutScroll,动画按滚动偏移校正 */
|
|
8
|
+
layoutScroll?: boolean;
|
|
9
|
+
/** 关掉顶部渐隐(默认开):滚动区顶部紧邻实底工具栏时,渐隐带落在实底上只会显脏 */
|
|
10
|
+
topFade?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 面板内的纵向滚动区:接 edge fade(对齐壳层 useEdgeFade 协议),只在可滚方向渐隐,
|
|
14
|
+
* 内容不贴着面板边缘被硬切;滚动条内缩不贴右缘。右侧 6px 透明边算在宽度里,
|
|
15
|
+
* 调用方右内边距相应减 6px;类名经 cn 合并,调用方可覆盖透明边宽度(如 border-r-[3px])。
|
|
16
|
+
*/
|
|
17
|
+
export declare function FadeScroll({ className, children, scrollRef, layoutScroll, topFade, }: FadeScrollProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface FileDropZoneProps {
|
|
3
|
+
/** 同 <input accept> */
|
|
4
|
+
accept?: string;
|
|
5
|
+
/** 单选:只取第一个文件 */
|
|
6
|
+
onFile?: (file: File) => void;
|
|
7
|
+
/** 多选:拖入或选择的全部文件(同时开启文件框多选) */
|
|
8
|
+
onFiles?: (files: File[]) => void;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
className?: string;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/** 点击选择或拖入文件的区域;拖入时高亮 */
|
|
14
|
+
export declare function FileDropZone({ accept, onFile, onFiles, disabled, className, children, }: FileDropZoneProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 筛选 pill:页面工具栏里的单选筛选项(分类 / 来源 / 状态 / 卡组),可带图标与计数。
|
|
3
|
+
* 选中 = selected 底 + accent 字;未选有两种皮肤:outline = line-1 描边,raised = surface 底 + 卡片投影。
|
|
4
|
+
* 选中与否由调用方受控,本组件只报点击;className 经 cn 合并,可覆盖未选中的文字色(如警示)。
|
|
5
|
+
*/
|
|
6
|
+
import type { ReactNode } from "react";
|
|
7
|
+
export interface FilterPillProps {
|
|
8
|
+
active: boolean;
|
|
9
|
+
onClick(): void;
|
|
10
|
+
label: string;
|
|
11
|
+
/** 不传即不渲染 */
|
|
12
|
+
count?: number;
|
|
13
|
+
/** 标签前的图标(调用方自定尺寸与间距) */
|
|
14
|
+
icon?: ReactNode;
|
|
15
|
+
/** 未选中的皮肤,默认 outline */
|
|
16
|
+
variant?: "outline" | "raised";
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function FilterPill({ active, onClick, label, count, icon, variant, className, }: FilterPillProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 图标按钮 —— 30px 方形无底幽灵按钮,hover 淡墨(A2 反馈语言)。
|
|
3
|
+
* 尺寸/位置微调用 className 覆盖(如侧栏头 27px)。
|
|
4
|
+
*/
|
|
5
|
+
import type { ComponentProps } from "react";
|
|
6
|
+
export declare function IconButton({ className, type, ...props }: ComponentProps<"button">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentType } from "react";
|
|
2
|
+
export declare function ImagePreview({ images, index, onIndexChange, open, onOpenChange, ImageComponent, }: {
|
|
3
|
+
images: readonly {
|
|
4
|
+
src: string;
|
|
5
|
+
alt?: string;
|
|
6
|
+
}[];
|
|
7
|
+
index: number;
|
|
8
|
+
onIndexChange: (index: number) => void;
|
|
9
|
+
open: boolean;
|
|
10
|
+
onOpenChange: (open: boolean) => void;
|
|
11
|
+
ImageComponent?: ComponentType<{
|
|
12
|
+
src: string;
|
|
13
|
+
alt: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
}>;
|
|
16
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 加载态 —— Spinner 圆环 + 页面级居中版式(02 §5.1 词表的 Spinner 归位)。
|
|
3
|
+
* Spinner 可单独行内使用;Loading 铺满父容器居中。
|
|
4
|
+
*
|
|
5
|
+
* 兜底高度走 prop(inline style)而非 Tailwind 类(2026-09-17 修正):原实现把
|
|
6
|
+
* `min-h-[45vh]` 写死在基础类里,调用方传 `className="min-h-0"` 会被它压掉——
|
|
7
|
+
* 同名 utility 的胜负由 Tailwind 生成顺序决定,**不由 class 书写顺序决定**,所以
|
|
8
|
+
* 那个覆盖一直是静默失效的(样板间把 Loading 放进 168px 演示框时内容被裁空,
|
|
9
|
+
* 才暴露出这个潜在缺陷)。改成 prop 后 inline style 可靠压过任意类。
|
|
10
|
+
*/
|
|
11
|
+
import type { ComponentProps } from "react";
|
|
12
|
+
export declare function Spinner({ className, ...props }: ComponentProps<"span">): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function Loading({ label, className, minHeight, }: {
|
|
14
|
+
label?: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
/** 无高度链时的兜底最小高度(默认 45vh);调用方自带高度时传 0 关闭 */
|
|
17
|
+
minHeight?: number | string;
|
|
18
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 菜单基础件:命令、开关、单选组、分隔与子菜单组成的异构浮层。
|
|
3
|
+
* 键盘导航、焦点回收、外点关闭和菜单树互斥由组件内建。
|
|
4
|
+
*/
|
|
5
|
+
import { type ReactElement, type ReactNode } from "react";
|
|
6
|
+
/** 根级:命令项触发后的整树关闭(外点/互斥由 dismiss 层逐层登记承担,D-014) */
|
|
7
|
+
export interface MenuRootContextValue {
|
|
8
|
+
closeMenu: () => void;
|
|
9
|
+
}
|
|
10
|
+
export interface MenuItemProps {
|
|
11
|
+
icon?: ReactNode;
|
|
12
|
+
/** 快捷键提示(展示用;键监听归全局注册表,这里不接线) */
|
|
13
|
+
kbd?: string;
|
|
14
|
+
danger?: boolean;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
onSelect?: () => void;
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
declare function MenuItem({ icon, kbd, danger, disabled, onSelect, children, className }: MenuItemProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export interface MenuCheckboxItemProps {
|
|
22
|
+
checked?: boolean;
|
|
23
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
24
|
+
icon?: ReactNode;
|
|
25
|
+
kbd?: string;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
className?: string;
|
|
29
|
+
}
|
|
30
|
+
declare function MenuCheckboxItem({ checked, onCheckedChange, icon, kbd, disabled, children, className, }: MenuCheckboxItemProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export interface MenuRadioGroupProps {
|
|
32
|
+
value?: string;
|
|
33
|
+
onValueChange?: (value: string) => void;
|
|
34
|
+
children: ReactNode;
|
|
35
|
+
}
|
|
36
|
+
declare function MenuRadioGroup({ value, onValueChange, children }: MenuRadioGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
export interface MenuRadioItemProps {
|
|
38
|
+
value: string;
|
|
39
|
+
icon?: ReactNode;
|
|
40
|
+
kbd?: string;
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
children: ReactNode;
|
|
43
|
+
className?: string;
|
|
44
|
+
}
|
|
45
|
+
declare function MenuRadioItem({ value, icon, kbd, disabled, children, className }: MenuRadioItemProps): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
export interface MenuSubmenuProps {
|
|
47
|
+
label: ReactNode;
|
|
48
|
+
icon?: ReactNode;
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
children: ReactNode;
|
|
51
|
+
}
|
|
52
|
+
declare function MenuSubmenu({ label, icon, disabled, children }: MenuSubmenuProps): import("react/jsx-runtime").JSX.Element;
|
|
53
|
+
declare function MenuSeparator(): import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
declare function MenuGroup({ children }: {
|
|
55
|
+
children: ReactNode;
|
|
56
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
export interface MenuProps {
|
|
58
|
+
/**
|
|
59
|
+
* 触发器(单一元素,克隆注入开合事件 / aria / ref;不强制本组件的按钮样式)。
|
|
60
|
+
* 协议同 Tooltip:元素必须透传 props 与 ref——原生元素或 {...rest} 透传的
|
|
61
|
+
* 组件;不透传的包装组件会吞掉注入,点击无反应。
|
|
62
|
+
*/
|
|
63
|
+
trigger: ReactElement;
|
|
64
|
+
children: ReactNode;
|
|
65
|
+
/** 交叉轴对齐:start = 左缘 / end = 右缘对齐触发器 */
|
|
66
|
+
align?: "start" | "end";
|
|
67
|
+
/** 浮层受控(§5.3 契约;样板间常显标本用它) */
|
|
68
|
+
open?: boolean;
|
|
69
|
+
onOpenChange?: (open: boolean) => void;
|
|
70
|
+
/** 透传浮层(宽度控制如 w-[280px]) */
|
|
71
|
+
className?: string;
|
|
72
|
+
/** 尽量展开:主层与子层高度上限放到视口高度(默认 300px),只有视口放不下才滚动 */
|
|
73
|
+
fit?: boolean;
|
|
74
|
+
}
|
|
75
|
+
export declare function Menu({ trigger, children, align, open: openProp, onOpenChange, className, fit, }: MenuProps): import("react/jsx-runtime").JSX.Element;
|
|
76
|
+
export declare namespace Menu {
|
|
77
|
+
var Item: typeof MenuItem;
|
|
78
|
+
var CheckboxItem: typeof MenuCheckboxItem;
|
|
79
|
+
var RadioGroup: typeof MenuRadioGroup;
|
|
80
|
+
var RadioItem: typeof MenuRadioItem;
|
|
81
|
+
var Submenu: typeof MenuSubmenu;
|
|
82
|
+
var Separator: typeof MenuSeparator;
|
|
83
|
+
var Group: typeof MenuGroup;
|
|
84
|
+
}
|
|
85
|
+
export interface ContextMenuProps {
|
|
86
|
+
/** 被包裹的区域(区域内在任意处右键弹出菜单) */
|
|
87
|
+
children: ReactNode;
|
|
88
|
+
/** 菜单内容(与 Menu 的 children 同构) */
|
|
89
|
+
content: ReactNode;
|
|
90
|
+
className?: string;
|
|
91
|
+
}
|
|
92
|
+
export declare function ContextMenu({ children, content, className }: ContextMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
93
|
+
export {};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notification 基础件 —— 右上角通知卡栈(mockups/notification/,承载方案 A + 卡片 V4)。
|
|
3
|
+
*
|
|
4
|
+
* 与 Toast 分工:Toast 是「你刚做了什么」的一句话回执;Notification 承载不是当下操作
|
|
5
|
+
* 引发的事件(协作者、应用更新、后台任务),有来源 / 标题 / 说明,常需作答。
|
|
6
|
+
*
|
|
7
|
+
* 卡片:34px 身份位(人 = 派生色头像,系统 = 中性图标,成败 = soft 底语义墨)+ 文字列
|
|
8
|
+
* (标题与「来源 · 相对时间」同行,说明至多 2 行)+ 横跨整卡的等宽按钮条(主按钮放最右,
|
|
9
|
+
* 次要统一描边——等分格里每格都要看得出是按钮)。不描边,ring + lift + float 三层影;
|
|
10
|
+
* 关闭钮悬停/聚焦时出现在左上外沿,不与时间抢右上角。
|
|
11
|
+
* 卡栈:新的在上,只完整显示最新 3 张,更多按底边缩放露 8px 纸边叠 2 层;关掉一张
|
|
12
|
+
* 后面的依次补位,计数标签只报数不可点,另有「全部清除」。
|
|
13
|
+
* 停留:sticky(需作答)常驻;否则 8s 自动关,悬停与作答中冻结。
|
|
14
|
+
* 作答:onClick 返回 promise 时该按钮 loading、整条锁定;兑现 → 有 resolvedText 收成
|
|
15
|
+
* 结果行 1.6s 后退场,否则直接退场;拒绝 → 说明位换成错误文案、按钮解锁。
|
|
16
|
+
* 不抢焦点(role=status + aria-live polite),不接 Esc(非阻断浮层,同 Toast)。
|
|
17
|
+
* 层级 z-[190]:Toast(200)压在通知之上,回执不被卡栈挡住。
|
|
18
|
+
*
|
|
19
|
+
* 用法:壳层挂载 <NotificationHost /> 一次;任意处 notify({...}) 返回 id,
|
|
20
|
+
* notify.update(id, patch) / notify.dismiss(id?) / notify.isActive(id)。同 id 再次
|
|
21
|
+
* notify = 原位更新(去重)。
|
|
22
|
+
* 锚定角默认右上,可传 placement="bottom-right" 纯镜像到右下;系统通知独立窗口另可
|
|
23
|
+
* 传 autoDismiss={false} 关掉自动关闭、className 覆盖容器贴边定位,并用 onItemsChange
|
|
24
|
+
* (id 列表增减)与 onCardClick(卡主体点击)把卡栈生命周期桥接到宿主窗口。
|
|
25
|
+
*/
|
|
26
|
+
import { type ComponentProps } from "react";
|
|
27
|
+
import { type LucideIcon } from "lucide-react";
|
|
28
|
+
export type NotificationTone = "neutral" | "ok" | "danger";
|
|
29
|
+
export interface NotificationAction {
|
|
30
|
+
label: string;
|
|
31
|
+
/** 主动作(accent 实心);至多一个,放在数组末尾(主按钮在最右) */
|
|
32
|
+
primary?: boolean;
|
|
33
|
+
/** 返回 promise 即进入作答中:按钮 loading、整条锁定,兑现后退场,拒绝则卡内报错 */
|
|
34
|
+
onClick?: () => unknown;
|
|
35
|
+
/** 作答成功后的结果行文案(如「已同意林然加入协作」);不给则直接退场 */
|
|
36
|
+
resolvedText?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface NotificationOptions {
|
|
39
|
+
/** 业务键:同 id 再次 notify 原位更新而非新增(如 "app-update") */
|
|
40
|
+
id?: string;
|
|
41
|
+
title: string;
|
|
42
|
+
body?: string;
|
|
43
|
+
/** 来源(「协作」「应用更新」),与相对时间同排在标题右侧 */
|
|
44
|
+
source?: string;
|
|
45
|
+
/** 身份位图标;缺省按 tone 取(neutral 铃铛 / ok 对勾 / danger 警示) */
|
|
46
|
+
icon?: LucideIcon;
|
|
47
|
+
/** 人发起的通知:头像文字(通常取名字首字),优先于 icon */
|
|
48
|
+
avatar?: string;
|
|
49
|
+
/** 头像取色种子(如用户 id),同人恒同色;缺省用 avatar 本身 */
|
|
50
|
+
avatarSeed?: string;
|
|
51
|
+
/** 语义只染身份位;卡片本体一律中性 */
|
|
52
|
+
tone?: NotificationTone;
|
|
53
|
+
/** 至多 2 个 */
|
|
54
|
+
actions?: NotificationAction[];
|
|
55
|
+
/** 需作答:常驻到有答案为止(默认 false = 纯告知,duration 后自动关) */
|
|
56
|
+
sticky?: boolean;
|
|
57
|
+
duration?: number;
|
|
58
|
+
/** 事件发生时间(毫秒),缺省为 notify 调用时刻 */
|
|
59
|
+
timestamp?: number;
|
|
60
|
+
}
|
|
61
|
+
export interface NotificationItem extends Omit<NotificationOptions, "id" | "sticky" | "duration" | "timestamp"> {
|
|
62
|
+
id: string;
|
|
63
|
+
sticky: boolean;
|
|
64
|
+
duration: number;
|
|
65
|
+
timestamp: number;
|
|
66
|
+
/** 作答中的动作下标 */
|
|
67
|
+
busy?: number;
|
|
68
|
+
/** 作答成功后的结果行(卡片收成一行) */
|
|
69
|
+
resolvedText?: string;
|
|
70
|
+
/** 作答失败文案(替换说明位) */
|
|
71
|
+
error?: string;
|
|
72
|
+
leaving?: boolean;
|
|
73
|
+
}
|
|
74
|
+
export declare function notify(options: NotificationOptions): string;
|
|
75
|
+
export declare namespace notify {
|
|
76
|
+
var update: (id: string, patch: Partial<Omit<NotificationOptions, "id">>) => void;
|
|
77
|
+
var dismiss: (id?: string) => void;
|
|
78
|
+
var isActive: (id: string) => boolean;
|
|
79
|
+
}
|
|
80
|
+
export interface NotificationCardProps extends Omit<ComponentProps<"div">, "children"> {
|
|
81
|
+
item: NotificationItem;
|
|
82
|
+
/** 相对时间的参照时刻(Host 每 30s 刷新;样板间标本可固定) */
|
|
83
|
+
now?: number;
|
|
84
|
+
onAction?: (index: number) => void;
|
|
85
|
+
onClose?: () => void;
|
|
86
|
+
/** 关闭钮常显(样板间悬停态标本用;产品里靠 hover / focus-within 出现) */
|
|
87
|
+
showClose?: boolean;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* 单张通知卡(受 item 驱动的纯展示件)。导出供样板间构造常显标本——产品代码只应
|
|
91
|
+
* 消费 notify 命令式 API 与 NotificationHost。
|
|
92
|
+
*/
|
|
93
|
+
export declare function NotificationCard({ item, now, onAction, onClose, showClose, className, ...props }: NotificationCardProps): import("react/jsx-runtime").JSX.Element;
|
|
94
|
+
export interface NotificationHostProps {
|
|
95
|
+
/** 卡栈锚定角,默认 "top-right" */
|
|
96
|
+
placement?: "top-right" | "bottom-right";
|
|
97
|
+
/** false 时所有卡都不自动关闭(系统通知窗口用),默认 true */
|
|
98
|
+
autoDismiss?: boolean;
|
|
99
|
+
/** 覆盖容器定位类(例如独立窗口里贴边 top-0/bottom-0 right-0),经 cn() 合并 */
|
|
100
|
+
className?: string;
|
|
101
|
+
/**
|
|
102
|
+
* store 内 id 列表变化时回报(按「已从 store 移除」口径:退场动画中的卡仍在列表里,
|
|
103
|
+
* 直到 LEAVE_MS 后真正移除才消失);挂载时回报一次当前列表。经 id 串比较去抖,
|
|
104
|
+
* 原位更新等内容变化不会触发。
|
|
105
|
+
*/
|
|
106
|
+
onItemsChange?: (ids: string[]) => void;
|
|
107
|
+
/** 非叠层卡主体被点击(卡内 button/a 上的点击不触发);叠层卡不响应点击 */
|
|
108
|
+
onCardClick?: (id: string) => void;
|
|
109
|
+
}
|
|
110
|
+
export declare function NotificationHost({ placement, autoDismiss, className, onItemsChange, onCardClick, }: NotificationHostProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 面板(白卡)族 —— 壳层内容区的基础卡片容器(A2 视觉:surface 底 + shadow-card)。
|
|
3
|
+
* pad 三档:base(宽松版式 18/20)、compact(今日页紧凑版式 12/16)、none(自管内距)。
|
|
4
|
+
* variant:raised(默认,阴影白卡,直接落在 page 底上)/ outline(细描边,落在一整张纸上——纸上再叠阴影卡会糊成一片)。
|
|
5
|
+
* PanelTitle 的下间距由调用方按域密度给(mb-1.5 / mb-2.5),避免同属性类层叠不可控。
|
|
6
|
+
*/
|
|
7
|
+
import type { ComponentProps } from "react";
|
|
8
|
+
declare const PANEL_VARIANTS: {
|
|
9
|
+
readonly raised: "shadow-card";
|
|
10
|
+
readonly outline: "border border-line-1";
|
|
11
|
+
};
|
|
12
|
+
declare const PANEL_PADS: {
|
|
13
|
+
readonly base: "px-5 py-[18px]";
|
|
14
|
+
readonly compact: "px-4 py-3";
|
|
15
|
+
readonly none: "";
|
|
16
|
+
};
|
|
17
|
+
export declare function Panel({ className, pad, variant, ...props }: ComponentProps<"section"> & {
|
|
18
|
+
pad?: keyof typeof PANEL_PADS;
|
|
19
|
+
variant?: keyof typeof PANEL_VARIANTS;
|
|
20
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function PanelTitle({ className, ...props }: ComponentProps<"h2">): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
/** 标题行右侧的说明小字(flex 布局下与标题的间距由 gap 提供) */
|
|
23
|
+
export declare function PanelNote({ className, ...props }: ComponentProps<"small">): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
/** 板内空态注记(描边行,替代原 board-note 空态用法) */
|
|
25
|
+
export declare function EmptyNote({ className, ...props }: ComponentProps<"p">): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
/** 标题行右侧的“前往”链接(无背景,贴卡片右缘,与标题同行对齐)—— 今日页 / 发布页等共用 */
|
|
27
|
+
export declare function PanelAction({ className, ...props }: ComponentProps<"button">): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Popover 基础件 —— 锚定式可交互内容浮层(D-014)。
|
|
3
|
+
*
|
|
4
|
+
* 家族分工:Tooltip 瞬态说明(hover/focus、不可交互)、Menu 命令面板、Select 表单值
|
|
5
|
+
* 选择、Dialog 模态决策、Toast 回执;Popover 收「点击触发、内容可继续操作」的
|
|
6
|
+
* 非模态浮层——说明卡 / 过滤器组 / 色板 / 成员卡 / 卡片预览。antd 存量 Popover 的
|
|
7
|
+
* trigger="hover" 用法迁 Tooltip、placement 12 向同名直映(D-014 迁移口径)。
|
|
8
|
+
*
|
|
9
|
+
* 定位与卡片视觉组合自 AnchoredPanel(基座只有一份);本件叠加交互层:
|
|
10
|
+
* - click toggle(hover 说明归 Tooltip,不设 trigger props;右键归 ContextMenu)
|
|
11
|
+
* - 外点关闭 + 嵌套链共存 + 顶层互斥(useLayerDismiss:浮层内开的 Menu/Select/
|
|
12
|
+
* 二级 Popover 不算外点)
|
|
13
|
+
* - Esc 仅 open 态消费(焦点链 LIFO,同 Select/Menu/Dialog 口径,不进 D-003
|
|
14
|
+
* 注册表——ui 不反向依赖 page/);Esc/Tab 关闭还焦触发器
|
|
15
|
+
* - 打开落初始焦点:卡片内 [data-autofocus] 优先(表单放首输入框),否则卡片自身
|
|
16
|
+
* - Tab 移出即关(非模态不圈闭)
|
|
17
|
+
* - aria:卡片 role=dialog(非模态,无 aria-modal)+ aria-labelledby 头行;
|
|
18
|
+
* 触发器 aria-haspopup=dialog + aria-expanded
|
|
19
|
+
* - 受控 open / onOpenChange(§5.3 浮层 open 契约;样板间常显标本用它)
|
|
20
|
+
*/
|
|
21
|
+
import { type ReactElement, type ReactNode } from "react";
|
|
22
|
+
import type { AnchoredPlacement } from "./anchoredPosition";
|
|
23
|
+
export interface PopoverProps {
|
|
24
|
+
/**
|
|
25
|
+
* 触发器(单一元素,克隆注入开合事件 / aria / ref)。协议同 Tooltip/Menu:元素
|
|
26
|
+
* 必须透传 props 与 ref——原生元素或 {...rest} 透传的组件;不透传的包装组件会
|
|
27
|
+
* 吞掉注入,点击无反应。
|
|
28
|
+
*/
|
|
29
|
+
trigger?: ReactElement;
|
|
30
|
+
/** 已存在的交互元素可直接作为锚点,适用于虚拟列表单元格。 */
|
|
31
|
+
anchor?: HTMLElement | null;
|
|
32
|
+
locked?: boolean;
|
|
33
|
+
/** 内容:Popover.Header / Body / Footer 复合声明(裸内容无内边距,自查排版) */
|
|
34
|
+
children: ReactNode;
|
|
35
|
+
/** 12 向全表(引擎 flip/shift 兜底),默认 top */
|
|
36
|
+
placement?: AnchoredPlacement;
|
|
37
|
+
/** 浮层受控(§5.3 契约;样板间常显标本用它) */
|
|
38
|
+
open?: boolean;
|
|
39
|
+
onOpenChange?: (open: boolean) => void;
|
|
40
|
+
/** 箭头(默认开;8px 菱形,随 flip 自动换边) */
|
|
41
|
+
arrow?: boolean;
|
|
42
|
+
/** 透传浮层卡片(宽度控制如 w-[360px],覆盖 min/max 约束) */
|
|
43
|
+
className?: string;
|
|
44
|
+
}
|
|
45
|
+
export declare function Popover({ trigger, anchor, locked, children, placement, open: openProp, onOpenChange, arrow, className, }: PopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
export declare namespace Popover {
|
|
47
|
+
var Header: typeof PopoverHeader;
|
|
48
|
+
var Body: ({ children, className }: import("./AnchoredPanel").AnchoredPanelBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
var Footer: ({ children, className }: import("./AnchoredPanel").AnchoredPanelFooterProps) => import("react/jsx-runtime").JSX.Element;
|
|
50
|
+
}
|
|
51
|
+
export interface PopoverHeaderProps {
|
|
52
|
+
/** 16px lucide 图标(圆底 accent-soft) */
|
|
53
|
+
icon?: ReactNode;
|
|
54
|
+
children: ReactNode;
|
|
55
|
+
}
|
|
56
|
+
/** 头行:随需出现——说明卡/过滤器用它,色板/成员卡可省(零框架税) */
|
|
57
|
+
declare function PopoverHeader({ icon, children }: PopoverHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Radio —— 单选基础件(Input 方案 A「经典描边」语言,mockups/radio/,2026-09-19 定稿)。
|
|
3
|
+
*
|
|
4
|
+
* 原生 input[type=radio] 承载语义(appearance-none 自绘皮):组内互斥、
|
|
5
|
+
* 方向键移动即选择、读屏语义白送。形制是 Checkbox 的圆形同构:16×16 视觉圆
|
|
6
|
+
* surface + line-1,选中 = 描边转 accent + 中心 accent 实点(110ms 缩放进场)。
|
|
7
|
+
*
|
|
8
|
+
* 结构铁律(同 Checkbox):input / 圆环 / 中心点在同一层互为兄弟——peer-*
|
|
9
|
+
* 变体只匹配 peer 的后续兄弟,深层后代会静默失效。状态语义(与 Input 裁决
|
|
10
|
+
* 同源):
|
|
11
|
+
* - 命中 24×24;focus-visible 才显 ring;hover 描边加深半档,聚焦时让位
|
|
12
|
+
* - 错误态正源 aria-invalid(未选中 danger),选中压过错误(选中优先)
|
|
13
|
+
* - 禁用:label 整项降透明 55%(fieldSet 组禁用时经 :disabled 传播同样生效)
|
|
14
|
+
*
|
|
15
|
+
* 单项不单独成组:须包在 RadioGroup 内(经 context 取 name/受控值),脱离组
|
|
16
|
+
* 使用时自传 name,checked/defaultChecked/onChange 走原生透传。
|
|
17
|
+
*/
|
|
18
|
+
import { type ComponentProps, type ReactNode } from "react";
|
|
19
|
+
export interface RadioProps extends Omit<ComponentProps<"input">, "type"> {
|
|
20
|
+
/** 选项值(组内唯一;选中态 = RadioGroup.value 等于此值) */
|
|
21
|
+
value: string;
|
|
22
|
+
/** 主标签(点文字同选;组内忽略 checked 类受控 prop,值归组) */
|
|
23
|
+
label?: ReactNode;
|
|
24
|
+
/** 描述行(label 下方两行排布,顶对齐;说明性文案走 tau-meta 下限) */
|
|
25
|
+
description?: ReactNode;
|
|
26
|
+
}
|
|
27
|
+
export declare function Radio({ value, label, description, className, disabled, ...props }: RadioProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RadioGroup —— 单选组(Input 方案 A 语言,mockups/radio/,2026-09-19 定稿)。
|
|
3
|
+
*
|
|
4
|
+
* fieldset/legend 承载组语义,原生 radio 组行为白送:Tab 一次进组(选中项/
|
|
5
|
+
* 首个可用项)、方向键移动即选择、组内互斥。组合式 children(描述行只有
|
|
6
|
+
* 组合式能表达,antd options 数据驱动不采);排布两档 orientation,legend
|
|
7
|
+
* 随流向排(横向在行首、纵向独占一行)。
|
|
8
|
+
*
|
|
9
|
+
* 组级 disabled 走 fieldset[disabled](浏览器原生向内传播 :disabled,
|
|
10
|
+
* Radio 的单项降透明随之生效);name 默认 useId 生成,可显式覆盖(表单提交)。
|
|
11
|
+
*/
|
|
12
|
+
import { type ReactNode } from "react";
|
|
13
|
+
/** 组内受控通道:Radio 消费(name/当前值/回报);组外 Radio 退化为裸原生 radio */
|
|
14
|
+
export declare const RadioGroupContext: import("react").Context<{
|
|
15
|
+
name: string;
|
|
16
|
+
value: string | null;
|
|
17
|
+
onValueChange: (value: string) => void;
|
|
18
|
+
} | null>;
|
|
19
|
+
export interface RadioGroupProps<Value extends string> {
|
|
20
|
+
/** 组名(legend,读屏必读;默认可见) */
|
|
21
|
+
label: ReactNode;
|
|
22
|
+
value?: Value;
|
|
23
|
+
defaultValue?: Value;
|
|
24
|
+
onValueChange?: (value: Value) => void;
|
|
25
|
+
orientation?: "horizontal" | "vertical";
|
|
26
|
+
/** radio 组提交名(默认 useId 自动生成;覆盖时须全应用内唯一) */
|
|
27
|
+
name?: string;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
className?: string;
|
|
31
|
+
}
|
|
32
|
+
export declare function RadioGroup<Value extends string>({ label, value: valueProp, defaultValue, onValueChange, orientation, name: nameProp, disabled, children, className, }: RadioGroupProps<Value>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface ResizeableAndHideableSidebarProps {
|
|
3
|
+
width: number;
|
|
4
|
+
open: boolean;
|
|
5
|
+
onWidthChange?: (width: number, actualWidth?: number) => void;
|
|
6
|
+
onActualWidthChange?: (actualWidth: number) => void;
|
|
7
|
+
onToggle?: () => void;
|
|
8
|
+
className?: string;
|
|
9
|
+
style?: React.CSSProperties;
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
minWidth?: number;
|
|
12
|
+
maxWidth?: number;
|
|
13
|
+
/**
|
|
14
|
+
* 拖拽条所在的边。
|
|
15
|
+
* 语义是“resize handle 在组件哪一侧”,不是“侧边栏停靠在哪一侧”。
|
|
16
|
+
* 例如:
|
|
17
|
+
* - 左侧侧边栏通常传 `right`
|
|
18
|
+
* - 右侧侧边栏通常传 `left`
|
|
19
|
+
*/
|
|
20
|
+
resizeHandleSide?: "left" | "right";
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated 兼容旧调用,等价于 `resizeHandleSide`
|
|
23
|
+
*/
|
|
24
|
+
side?: "left" | "right";
|
|
25
|
+
/** 侧边栏的位置(左侧或右侧),用于确定按钮显示位置 */
|
|
26
|
+
sidebarPosition?: "left" | "right";
|
|
27
|
+
disableResize?: boolean;
|
|
28
|
+
handleOffset?: number;
|
|
29
|
+
/**
|
|
30
|
+
* 收起后是否在边缘显示统一的 hover 展开按钮。
|
|
31
|
+
* 适合“收起时完全不可见,只在边缘悬浮展开”的场景。
|
|
32
|
+
*/
|
|
33
|
+
showInternalExpandButtonWhenClosed?: boolean;
|
|
34
|
+
/** 透传 WidthResizable:常驻淡分隔线标出拖拽边界 */
|
|
35
|
+
showDivider?: boolean;
|
|
36
|
+
/** 以 flex 铺满父级剩余空间,替代固定宽度(如视频笔记收起对话后材料栏独占) */
|
|
37
|
+
fillRemaining?: boolean;
|
|
38
|
+
}
|
|
39
|
+
declare const ResizeableAndHideableSidebar: (props: ResizeableAndHideableSidebarProps) => import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
export default ResizeableAndHideableSidebar;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 侧栏拖宽热区:透明 8px 竖条,hover / 拖动时中部显出 2px accent 短线(不画分隔线)。
|
|
3
|
+
* 栏在热区的哪一侧由 side 决定——side="left" 表示栏在热区左边(向右拖变宽),
|
|
4
|
+
* "right" 表示栏在右边(向左拖变宽)。宽度夹在 [min, max];←/→ 每次 ±16px,双击回默认宽度。
|
|
5
|
+
* 定位由调用方给(className,通常 absolute 贴在栏的内缘)。pointer capture 保证拖出窗口不丢事件。
|
|
6
|
+
*/
|
|
7
|
+
export interface ResizeHandleProps {
|
|
8
|
+
/** 当前宽度(受控) */
|
|
9
|
+
value: number;
|
|
10
|
+
min: number;
|
|
11
|
+
max: number;
|
|
12
|
+
onChange: (width: number) => void;
|
|
13
|
+
/** 栏在热区的哪一侧 */
|
|
14
|
+
side: "left" | "right";
|
|
15
|
+
/** 读屏用:调整的是什么(「AI 对话栏宽度」) */
|
|
16
|
+
label: string;
|
|
17
|
+
/** 双击恢复的宽度;不传则双击无操作 */
|
|
18
|
+
defaultValue?: number;
|
|
19
|
+
/** 拖动开始 / 结束(调用方可在拖动期间关掉宽度过渡,免得跟手滞后) */
|
|
20
|
+
onActiveChange?: (active: boolean) => void;
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function ResizeHandle({ value, min, max, onChange, side, label, defaultValue, onActiveChange, className, }: ResizeHandleProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Segmented —— 分段单选器(Input 家族「连体描边」语言,mockups/segmented/,2026-09-23 定稿)。
|
|
3
|
+
*
|
|
4
|
+
* 02 规范 §5.2 裁决的 Tabs 官定替代:内容形态切换(字段不同构)用分段,值切换
|
|
5
|
+
* (字段同构)用 Select。容器是一枚 hairline 控件(surface + line-1,与 Input /
|
|
6
|
+
* Select 触发器同皮),段间 hairline 分割;激活段 accent-soft 轻染 + accent-text
|
|
7
|
+
* ——零轨道、零滑块、零投影(凹槽深底形态已否决,见 mockups/segmented/ 头注)。
|
|
8
|
+
*
|
|
9
|
+
* 原生 input[type=radio] 承载语义(隐藏自绘皮):组内互斥、方向键移动即选择、
|
|
10
|
+
* Tab 一次进组白送。状态纪律同 Input 家族:hover 淡墨只落未选段(不冲淡激活染)、
|
|
11
|
+
* press 加深一档、focus-visible 才显 ring(inset 2px 不被容器圆角裁切)。
|
|
12
|
+
* 段数口径 2–5,再多该用 Select;图标段与纯图标段(label 省略,aria-label 必填)
|
|
13
|
+
* 均支持。复合组件 Segmented.Item 须包在 Segmented 内(经 context 取 name/受控值)。
|
|
14
|
+
* 外框默认 w-fit:放进 flex-col 等拉伸容器也按内容宽排,不会出现框宽段窄的空尾。
|
|
15
|
+
*/
|
|
16
|
+
import { type ComponentProps, type ReactNode } from "react";
|
|
17
|
+
import type { LucideIcon } from "lucide-react";
|
|
18
|
+
export interface SegmentedProps<Value extends string> {
|
|
19
|
+
/** 组名(aria-label,读屏必读;不渲染可见标签——分段器的上下文由摆放位置给出) */
|
|
20
|
+
label: string;
|
|
21
|
+
value?: Value;
|
|
22
|
+
defaultValue?: Value;
|
|
23
|
+
onValueChange?: (value: Value) => void;
|
|
24
|
+
size?: "sm" | "md";
|
|
25
|
+
/** 组级禁用(压过单项);单项禁用走 Item 的 disabled */
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
/** radio 组提交名(默认 useId 自动生成;覆盖时须全应用内唯一) */
|
|
28
|
+
name?: string;
|
|
29
|
+
className?: string;
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
}
|
|
32
|
+
export declare function SegmentedRoot<Value extends string>({ label, value: valueProp, defaultValue, onValueChange, size, disabled, name: nameProp, className, children, }: SegmentedProps<Value>): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export interface SegmentedItemProps extends Omit<ComponentProps<"input">, "type" | "value" | "name" | "checked" | "defaultChecked"> {
|
|
34
|
+
/** 段值(组内唯一;选中态 = Segmented.value 等于此值) */
|
|
35
|
+
value: string;
|
|
36
|
+
/** 段文字;省略时为纯图标段,aria-label 必填 */
|
|
37
|
+
label?: ReactNode;
|
|
38
|
+
icon?: LucideIcon;
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export declare function SegmentedItem({ value, label, icon: Icon, disabled, className, ...props }: SegmentedItemProps): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export declare const Segmented: typeof SegmentedRoot & {
|
|
43
|
+
Item: typeof SegmentedItem;
|
|
44
|
+
};
|