Raft 设计系统

组件 · 反馈

PaneDropOverlay

拖动的标签页会落在哪里:分出时新的一格会占的那一半,或者整格,用放下位置的样子铺上阴影,文字放在 HUD 胶囊里。

实验性也叫 Split zone, Drop zone, Dock overlay
import { PaneDropOverlay } from "@botiverse/raft-ui/wip";

PaneDropOverlay 显示拖动的标签页会落在哪里,铺出新的一格会占的地方:在一格的边上,是分出后会占的那一半;在中间,是整格。阴影用放下位置唯一的样子 DropPlaceholder,这个区域的文字放在一个 HUD 胶囊里(标签页与分栏)。

pane-drop-overlay/compositions/zones

何时使用

场景使用
标签页被拖到一格或对话上PaneDropOverlay
标签页被拖到标签栏上标签栏的插入线(TabBar insertAt)
在列表内或列表之间拖动一项Drag:列表里的虚线位置
不接受这一项的地方不铺阴影:指针旁边的拒绝提示(拖放)

结构

  • 覆盖层,铺在这个区域会占的地方(paneDropArea),里面一个 DropPlaceholder,用较深的填充,因为它盖在实时内容上。
  • 文字,放在中间的 HUD 胶囊里。

行为

  • paneDropZone(rect, x, y) 给出一个点所在的区域:整格(包括标签栏)宽或高 25% 以内最近的那条边,否则是 center。
  • 边上铺那一半:「向上分出」「向下分出」「向左分出」「向右分出」。中间铺整格:「放进这一格」。在对话上时由 App 在 label 里传它自己的话:「在对话右边分出一栏」。
  • 开着 portal(默认)时,它渲染在最近的 portal 容器里,没有就在 document.body,以 fixed 放在拖动的层级上,所以盖在从固定图层叠到各格上的页面上面;rect 用视口 px。关掉时,它以 absolute 放在这一格的定位父元素里。
  • 在区域之间移动时用 120ms 和拖动落定的缓动。

内容

  • 说出放下后会做什么,用标签页菜单里的说法:「向右分出」「放进这一格」。译文通过 messages 传入。

无障碍

  • 它对辅助技术隐藏:拖动的播报会说出标签页在哪里(拖放)。
  • 拖动从来不是唯一的方式:标签页菜单里的「移到别的分栏」是键盘的路。

规则

  • 铺出新的一格会占的地方,从不只画一条线或一个轮廓。
  • 不接受标签页的地方什么都不铺。

API

PaneDropOverlay

实验性Where a dragged tab will land, as the area the new pane will take: an edge shades that half of the pane, its tab bar included, and the middle shades the whole pane, each with its words in a HUD chip. The shade is the one look for a place, `DropPlaceholder`, on the strong fill because it lies over live content. Hidden from assistive technology: the drag's announcements say where the tab is.
Prop类型默认值
labelWords in place of the zone's own, such as "Split right of the conversation".string
messagesPartial<PaneDropOverlayMessages>
portalRender in a portal (the nearest `PortalContainerProvider`'s container, else `document.body`), `fixed` above live pages laid over the panes. Off: `absolute` in the pane's own positioned parent.booleantrue
rect (required)The pane's box in client px (`portal`) or in its positioned parent's px: the whole pane, its tab bar included.PaneDropRect
zone (required)PaneDropZone

Also takes the attributes of its element.