docs: close documentation facts, structure and related-component mapping
HD-04 scope, against heroui ce90ea3 cn sources: - stale/fictional content: input.md no longer claims TextField is unmigrated; color-field.md no longer claims ColorPicker is private; header.md drops the fictional Header.Root subcomponent and the stale 'menus not migrated' wording (MenuSection label registration is now documented from HeaderRoot source); radio-group.md drops three copied CheckboxGroup wordings (variant override is Radio's, scalar emits, native single-value submit); input-otp.md drops the fictional data-complete state and lists the real missing upstream props - toggle-button disabled row now matches the real CSS hooks (:disabled / [aria-disabled], with data-disabled as a marker only) - part API / CSS classes / interactive states restored per pinned sources: button (full class lists + real variable-based global CSS), accordion (per-part tables + variant/state lists), card (per-part tables + variant list), switch (SwitchGroup snippet + Switch/ SwitchGroup class lists + states), color-field Group (class list + states), input-otp (variant notes, global CSS, class/state lists); input-group gains the two upstream usage chapters - RelatedComponents restored from the pinned componentRelationships (first-3, filtered against componentsMap): 64 pages rewritten, list-box/slider sections added, 7 empty-mapping pages' fabricated entries removed; RelatedShowcases left unmigrated with its real data inventory recorded (2 cases, showcase-site cards) - defaults unified on implementation evidence: granularity (inferred day/minute) and visibleYears (full min-max span, no "or 20" fallback); HD-03 hand-offs resolved (trigger focus-visible noted for HD-06, width guards kept) - new demos: header-collection-grouping (MenuSection/ListBoxSection label wiring), empty-state-collection (collection empty slot); empty-state page deduplicated with a boundary compatibility note - ComponentPreview minHeight/isBgSolid restored per the 30 upstream marks; tabs-overflow max-w-full kept after measuring internal scroll - tests: +3 header registration/demo cases, +1 empty-state collection case; full suite 110 files / 1630 tests, typecheck and build:docs pass
This commit is contained in:
@@ -80,7 +80,11 @@ import {
|
||||
<Label>选择颜色</Label>
|
||||
</ColorPickerTrigger>
|
||||
<ColorPickerPopover>
|
||||
<ColorArea color-space="hsb" x-channel="saturation" y-channel="brightness">
|
||||
<ColorArea
|
||||
color-space="hsb"
|
||||
x-channel="saturation"
|
||||
y-channel="brightness"
|
||||
>
|
||||
<ColorAreaThumb />
|
||||
</ColorArea>
|
||||
<ColorSlider channel="hue" color-space="hsb">
|
||||
@@ -173,84 +177,84 @@ ColorPicker 组件使用以下 CSS 类([查看源码样式](https://github.com
|
||||
|
||||
对应固定源的 [React Aria ColorPicker](https://react-spectrum.adobe.com/react-aria/ColorPicker.html):共享颜色 owner + `DialogTrigger`/`Popover` 组合。普通颜色值使用 `v-model`,输出本库 `Color`。
|
||||
|
||||
| Prop | 类型 | 默认值 | 描述 |
|
||||
| -------------- | --------------------------------------------- | ---------- | -------------------------------------------------------------------- |
|
||||
| `modelValue` | `string \| Color` | - | 当前接受颜色(`v-model`;受控) |
|
||||
| `value` | `string \| Color` | - | 低优先级受控别名;`modelValue` 存在时优先 |
|
||||
| `defaultValue` | `string \| Color` | `"#000000"` | 非受控初值;未提供时使用固定源默认黑值 |
|
||||
| `open` | `boolean` | - | 受控展开;拒绝打开时仍发出 `update:open`/`openChange` |
|
||||
| `isOpen` | `boolean` | - | 展开别名;`open` 与 `isOpen` 同时存在时 `open` 优先,不会双输入竞争 |
|
||||
| `defaultOpen` | `boolean` | `false` | 非受控初始展开 |
|
||||
| `isDisabled` | `boolean` | `false` | 禁用整个组合(库扩展,作用于自身子组件) |
|
||||
| `disabled` | `boolean` | `false` | `isDisabled` 别名 |
|
||||
| `isReadOnly` | `boolean` | `false` | 只读:保留展示与程序化赋值,阻止子控件编辑(库扩展) |
|
||||
| `name` | `string` | - | Vue 扩展:单个隐藏输入提交完整精度颜色 |
|
||||
| `form` | `string` | - | Vue 扩展:关联外部表单 id |
|
||||
| `as` | `string` | `"div"` | 自定义根元素标签 |
|
||||
| `class` | `string \| Array \| Object` | - | 附加 CSS 类(Vue class 绑定) |
|
||||
| 默认作用域插槽 | `({ color, isOpen, close, isDisabled, isReadOnly }) => VNodeChild` | - | 根渲染状态 |
|
||||
| Prop | 类型 | 默认值 | 描述 |
|
||||
| -------------- | ------------------------------------------------------------------ | ----------- | ------------------------------------------------------------------- |
|
||||
| `modelValue` | `string \| Color` | - | 当前接受颜色(`v-model`;受控) |
|
||||
| `value` | `string \| Color` | - | 低优先级受控别名;`modelValue` 存在时优先 |
|
||||
| `defaultValue` | `string \| Color` | `"#000000"` | 非受控初值;未提供时使用固定源默认黑值 |
|
||||
| `open` | `boolean` | - | 受控展开;拒绝打开时仍发出 `update:open`/`openChange` |
|
||||
| `isOpen` | `boolean` | - | 展开别名;`open` 与 `isOpen` 同时存在时 `open` 优先,不会双输入竞争 |
|
||||
| `defaultOpen` | `boolean` | `false` | 非受控初始展开 |
|
||||
| `isDisabled` | `boolean` | `false` | 禁用整个组合(库扩展,作用于自身子组件) |
|
||||
| `disabled` | `boolean` | `false` | `isDisabled` 别名 |
|
||||
| `isReadOnly` | `boolean` | `false` | 只读:保留展示与程序化赋值,阻止子控件编辑(库扩展) |
|
||||
| `name` | `string` | - | Vue 扩展:单个隐藏输入提交完整精度颜色 |
|
||||
| `form` | `string` | - | Vue 扩展:关联外部表单 id |
|
||||
| `as` | `string` | `"div"` | 自定义根元素标签 |
|
||||
| `class` | `string \| Array \| Object` | - | 附加 CSS 类(Vue class 绑定) |
|
||||
| 默认作用域插槽 | `({ color, isOpen, close, isDisabled, isReadOnly }) => VNodeChild` | - | 根渲染状态 |
|
||||
|
||||
事件:
|
||||
|
||||
| 事件 | 参数 | 时机 |
|
||||
| --------------------- | ------- | -------------------------------------------------------------------- |
|
||||
| `update:modelValue` / `change` | `Color` | 子控件提出不同颜色时一起触发(`v-model` 使用前者);受控父组件可拒绝提案 |
|
||||
| `changeEnd` | `Color` | 有颜色提案的手势正常结束时传出最后提案;不表示父组件已接受,取消时不触发 |
|
||||
| `update:open` / `update:isOpen` / `openChange` | `boolean` | 展开状态提案;受控拒绝时保持提案事件,不改变实际展开 |
|
||||
| 事件 | 参数 | 时机 |
|
||||
| ---------------------------------------------- | --------- | ------------------------------------------------------------------------ |
|
||||
| `update:modelValue` / `change` | `Color` | 子控件提出不同颜色时一起触发(`v-model` 使用前者);受控父组件可拒绝提案 |
|
||||
| `changeEnd` | `Color` | 有颜色提案的手势正常结束时传出最后提案;不表示父组件已接受,取消时不触发 |
|
||||
| `update:open` / `update:isOpen` / `openChange` | `boolean` | 展开状态提案;受控拒绝时保持提案事件,不改变实际展开 |
|
||||
|
||||
受控拒绝、相同提案重试、外部替换与事务取消的行为与共享颜色 owner 一致:父组件不接受提案时坐标、滑块、字段文本、预览与表单值保持接受值,提案不会冒充已接受颜色,也不会经 hex 往返量化。
|
||||
|
||||
### ColorPickerTrigger
|
||||
|
||||
| Prop | 类型 | 默认值 | 描述 |
|
||||
| --------------- | -------------------------------- | -------- | -------------------------------------------------------- |
|
||||
| `as` | `string` | `"button"` | 自定义根元素标签 |
|
||||
| `asChild` | `boolean` | `false` | 把触发器属性合并到默认插槽根节点 |
|
||||
| `isDisabled` | `boolean` | `false` | 额外禁用;owner 禁用时同样禁用 |
|
||||
| `class` | `string \| Array \| Object` | - | 附加 CSS 类 |
|
||||
| 默认作用域插槽 | `({ color, isDisabled }) => VNodeChild` | - | 触发器内容状态 |
|
||||
| Prop | 类型 | 默认值 | 描述 |
|
||||
| -------------- | --------------------------------------- | ---------- | -------------------------------- |
|
||||
| `as` | `string` | `"button"` | 自定义根元素标签 |
|
||||
| `asChild` | `boolean` | `false` | 把触发器属性合并到默认插槽根节点 |
|
||||
| `isDisabled` | `boolean` | `false` | 额外禁用;owner 禁用时同样禁用 |
|
||||
| `class` | `string \| Array \| Object` | - | 附加 CSS 类 |
|
||||
| 默认作用域插槽 | `({ color, isDisabled }) => VNodeChild` | - | 触发器内容状态 |
|
||||
|
||||
触发器渲染为真实 `button[type=button]`,不会意外提交外层表单;固定源的 Button render props(`isHovered`/`isPressed` 等)在 Vue 版收敛为 `color`/`isDisabled` 两个插槽状态,差异已记录。
|
||||
|
||||
### ColorPickerPopover
|
||||
|
||||
| Prop | 类型 | 默认值 | 描述 |
|
||||
| --------------------------- | -------------------------- | --------------- | ---------------------------------------- |
|
||||
| `placement` | `OverlayPlacement` | `"bottom left"` | 弹出层位置(RTL 下自动镜像) |
|
||||
| `offset` | `number` | `8` | 与锚点的间距 |
|
||||
| `crossOffset` | `number` | `0` | 交叉轴偏移 |
|
||||
| `shouldFlip` | `boolean` | `true` | 视口碰撞时翻转 |
|
||||
| `containerPadding` | `number` | `12` | 碰撞计算的容器留白 |
|
||||
| `to` | `string \| HTMLElement` | - | 自定义 Teleport 目标 |
|
||||
| `isNonModal` | `boolean` | `false` | 非模态:不锁定焦点与滚动 |
|
||||
| `isDismissable` | `boolean` | `true` | 允许外部点击关闭 |
|
||||
| `isKeyboardDismissDisabled` | `boolean` | `false` | 禁用 Esc 关闭 |
|
||||
| `class` | `string \| Array \| Object` | - | 附加 CSS 类 |
|
||||
| 默认作用域插槽 | `({ isOpen, close }) => VNodeChild` | - | 弹层内容状态 |
|
||||
| Prop | 类型 | 默认值 | 描述 |
|
||||
| --------------------------- | ----------------------------------- | --------------- | ---------------------------- |
|
||||
| `placement` | `OverlayPlacement` | `"bottom left"` | 弹出层位置(RTL 下自动镜像) |
|
||||
| `offset` | `number` | `8` | 与锚点的间距 |
|
||||
| `crossOffset` | `number` | `0` | 交叉轴偏移 |
|
||||
| `shouldFlip` | `boolean` | `true` | 视口碰撞时翻转 |
|
||||
| `containerPadding` | `number` | `12` | 碰撞计算的容器留白 |
|
||||
| `to` | `string \| HTMLElement` | - | 自定义 Teleport 目标 |
|
||||
| `isNonModal` | `boolean` | `false` | 非模态:不锁定焦点与滚动 |
|
||||
| `isDismissable` | `boolean` | `true` | 允许外部点击关闭 |
|
||||
| `isKeyboardDismissDisabled` | `boolean` | `false` | 禁用 Esc 关闭 |
|
||||
| `class` | `string \| Array \| Object` | - | 附加 CSS 类 |
|
||||
| 默认作用域插槽 | `({ isOpen, close }) => VNodeChild` | - | 弹层内容状态 |
|
||||
|
||||
弹层内容通过 Teleport 渲染,Surface 默认上下文穿过 Teleport;嵌套的 `Select`/`ListBox` 等内层弹层各自独立处理 Esc、外部点击与焦点恢复,不会误关外层 ColorPicker。
|
||||
|
||||
### Render Props
|
||||
|
||||
| 插槽状态 | 类型 | 含义 |
|
||||
| ------------------------------------------------------- | --------------- | ------------------------------------ |
|
||||
| `color`(根) | `Color` | 当前接受颜色(组合不允许空值) |
|
||||
| `isOpen` / `isDisabled` / `isReadOnly`(根) | `boolean` | 真实状态 |
|
||||
| `close`(根 / 弹层) | `() => void` | 关闭弹层 |
|
||||
| `color` / `isDisabled`(Trigger) | `Color \| null` / `boolean` | 触发器内容状态 |
|
||||
| `isOpen`(Popover) | `boolean` | 弹层展开状态 |
|
||||
| 插槽状态 | 类型 | 含义 |
|
||||
| -------------------------------------------- | --------------------------- | ------------------------------ |
|
||||
| `color`(根) | `Color` | 当前接受颜色(组合不允许空值) |
|
||||
| `isOpen` / `isDisabled` / `isReadOnly`(根) | `boolean` | 真实状态 |
|
||||
| `close`(根 / 弹层) | `() => void` | 关闭弹层 |
|
||||
| `color` / `isDisabled`(Trigger) | `Color \| null` / `boolean` | 触发器内容状态 |
|
||||
| `isOpen`(Popover) | `boolean` | 弹层展开状态 |
|
||||
|
||||
Root 实例通过 `defineExpose` 提供 `element`(真实根 DOM)与 `color`(接受颜色)。不暴露颜色 owner、事务 token 或弹层内部状态。
|
||||
|
||||
### 展开与焦点
|
||||
|
||||
| 操作 | 行为 |
|
||||
| ------------------- | ------------------------------------------------------------------------ |
|
||||
| 触发器 click | 切换弹层;可取消的 `click`(`preventDefault`)会阻止打开 |
|
||||
| `Esc` | 先恢复/丢弃子控件草稿,再关闭弹层并把焦点还给触发器 |
|
||||
| 外部点击 | 关闭弹层;未结束的颜色事务立即取消,不补发虚假 `changeEnd` |
|
||||
| `Tab` / `Shift+Tab` | 焦点在弹层内循环(模态);嵌套 Select 的内层选项可正常聚焦与选择 |
|
||||
| 焦点恢复 | 关闭后焦点回到触发器;退出动画期间弹层保持不可交互 |
|
||||
| 操作 | 行为 |
|
||||
| ------------------- | ---------------------------------------------------------------- |
|
||||
| 触发器 click | 切换弹层;可取消的 `click`(`preventDefault`)会阻止打开 |
|
||||
| `Esc` | 先恢复/丢弃子控件草稿,再关闭弹层并把焦点还给触发器 |
|
||||
| 外部点击 | 关闭弹层;未结束的颜色事务立即取消,不补发虚假 `changeEnd` |
|
||||
| `Tab` / `Shift+Tab` | 焦点在弹层内循环(模态);嵌套 Select 的内层选项可正常聚焦与选择 |
|
||||
| 焦点恢复 | 关闭后焦点回到触发器;退出动画期间弹层保持不可交互 |
|
||||
|
||||
### 表单
|
||||
|
||||
@@ -262,4 +266,6 @@ Root 实例通过 `defineExpose` 提供 `element`(真实根 DOM)与 `color`
|
||||
|
||||
## 相关组件
|
||||
|
||||
[ColorArea 颜色区域](./color-area) · [ColorSlider 颜色滑块](./color-slider) · [ColorSwatch 颜色色块](./color-swatch)
|
||||
|
||||
已公开 [ColorField 颜色输入框](/components/color-field)(含 ColorInputGroup)、[ColorArea 颜色区域](/components/color-area)、[ColorSlider 颜色滑块](/components/color-slider)、[ColorSwatch 颜色色块](/components/color-swatch)、[ColorSwatchPicker 颜色色块选择器](/components/color-swatch-picker) 与 [ColorPicker 颜色选择器](/components/color-picker)。颜色家族共用同一颜色 owner,Picker 的 Trigger/Popover 组合可嵌套上述任意子组件。
|
||||
|
||||
Reference in New Issue
Block a user