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
@@ -0,0 +1,36 @@
<script setup lang="ts">
import { shallowRef } from "vue";
import type { Color } from "@heroui-vue/components";
import {
ColorField,
ColorFieldGroup,
ColorFieldInput,
ColorFieldPrefix,
ColorSwatch,
Label,
parseColor,
} from "@heroui-vue/components";
const color = shallowRef<Color | null>(parseColor("#0485F7"));
</script>
<template>
<ColorField
class="w-[280px]"
name="color"
as="div"
data-custom="foo"
v-slot="{ isFocused }"
v-model="color"
>
<Label>颜色</Label>
<ColorFieldGroup
as="div"
data-custom="foo"
:data-field-focused="isFocused || undefined"
>
<ColorFieldPrefix>
<ColorSwatch :color="color ?? undefined" size="xs" />
</ColorFieldPrefix>
<ColorFieldInput />
</ColorFieldGroup>
</ColorField>
</template>