feat: publish ColorField and shared color input parts

This commit is contained in:
maoyingjie
2026-10-27 11:53:02 +08:00
parent 108a120c81
commit 6a7a89be6b
34 changed files with 1511 additions and 39 deletions
+35 -9
View File
@@ -1,14 +1,19 @@
<script setup lang="ts">
import { shallowRef } from "vue";
import ColorField from "../../../packages/vue/src/components/color-field/ColorField.vue";
import ColorInputGroup from "../../../packages/vue/src/components/color-field/ColorInputGroup.vue";
import ColorInputGroupInput from "../../../packages/vue/src/components/color-field/ColorInputGroupInput.vue";
import Prefix from "../../../packages/vue/src/components/color-field/ColorInputGroupPrefix.vue";
import Suffix from "../../../packages/vue/src/components/color-field/ColorInputGroupSuffix.vue";
import {
ColorField,
ColorInputGroup,
ColorInputGroupInput,
ColorInputGroupPrefix as Prefix,
ColorInputGroupSuffix as Suffix,
parseColor,
type Color,
} from "@heroui-vue/components";
import Picker from "../../../packages/vue/tests/fixtures/ColorPickerComposition.vue";
import { parseColor } from "../../../packages/vue/src/components/color/value";
import { Label, Description, FieldError, Button } from "@heroui-vue/components";
const value = shallowRef(parseColor("#123456")),
const rtl = shallowRef(false);
const proposals = shallowRef(0);
const value = shallowRef<Color | null>(parseColor("#123456")),
submitted = shallowRef("尚未提交"),
channelSubmitted = shallowRef("尚未提交");
function submit(event: Event, channel = false) {
@@ -20,11 +25,13 @@ function submit(event: Event, channel = false) {
}
</script>
<template>
<main class="color-field-lab">
<main class="color-field-lab" :dir="rtl ? 'rtl' : 'ltr'">
<h1>颜色字段正式协议 · 内部验收</h1>
<p>
组合部件、原生关联、格式化通道、提交和共享颜色;公开导出与正式文档尚未接入。
组合部件、原生关联、格式化通道、提交和共享颜色;本页通过公共导出验证正式字段;Picker
保留内部组合夹具。
</p>
<Button @click="rtl = !rtl">切换 RTL</Button>
<div class="color-field-grid">
<section id="field-native">
<h2>受控 Hex / 原生 Enter</h2>
@@ -49,6 +56,25 @@ function submit(event: Event, channel = false) {
<output>接受值:{{ value?.toString("hex") ?? "empty" }}</output>
</form>
</section>
<section id="field-rejected">
<h2>受控拒绝与重试</h2>
<form @submit.prevent>
<ColorField
name="rejected"
model-value="#123456"
@change="proposals++"
>
<Label>拒绝颜色</Label>
<ColorInputGroup><ColorInputGroupInput /></ColorInputGroup>
</ColorField>
<Button type="reset">重置拒绝字段</Button>
<output>提案次数:{{ proposals }}</output>
</form>
<ColorField is-read-only default-value="#ABCDEF">
<Label>只读颜色</Label>
<ColorInputGroup><ColorInputGroupInput /></ColorInputGroup>
</ColorField>
</section>
<section id="field-channel">
<h2>百分数显示 / 小数提交</h2>
<form @submit.prevent="submit($event, true)">