136 lines
3.6 KiB
Vue
136 lines
3.6 KiB
Vue
<script setup lang="ts">
|
||
import { shallowRef } from "vue";
|
||
import Slider from "../../../packages/vue/tests/fixtures/ColorSliderFoundation.vue";
|
||
import Picker from "../../../packages/vue/tests/fixtures/ColorPickerComposition.vue";
|
||
import { Button } from "@heroui-vue/components";
|
||
const changes = shallowRef(0),
|
||
ends = shallowRef(0),
|
||
rejected = shallowRef(0),
|
||
rejectEnds = shallowRef(0);
|
||
</script>
|
||
<template>
|
||
<main class="color-slider-lab">
|
||
<h1>颜色轨道与 Picker 组合 · 私有基建</h1>
|
||
<p>
|
||
自定义轨道、原生焦点输入和共享接受值;正式公开部件与文档示例仍待收尾。
|
||
</p>
|
||
<div class="color-slider-grid">
|
||
<section id="slider-accepted">
|
||
<h2>灰色色相 / 拖动完成</h2>
|
||
<Slider
|
||
channel="hue"
|
||
default-value="hsb(270,0%,50%,.125)"
|
||
aria-label="Hue"
|
||
@change="changes++"
|
||
@change-end="ends++"
|
||
/>
|
||
<output>change {{ changes }} / changeEnd {{ ends }}</output>
|
||
</section>
|
||
<section id="slider-rejected">
|
||
<h2>受控拒绝 / 重复提案</h2>
|
||
<Slider
|
||
channel="hue"
|
||
model-value="hsb(270,0%,50%,.125)"
|
||
aria-label="Rejected hue"
|
||
@change="rejected++"
|
||
@change-end="rejectEnds++"
|
||
/>
|
||
<output>change {{ rejected }} / changeEnd {{ rejectEnds }}</output>
|
||
</section>
|
||
<section id="slider-rtl">
|
||
<h2>RGB / RTL / 缩放与边框</h2>
|
||
<div class="slider-scale">
|
||
<Slider
|
||
channel="red"
|
||
dir="rtl"
|
||
default-value="rgba(128,100,50,.25)"
|
||
aria-label="RTL red"
|
||
/>
|
||
</div>
|
||
</section>
|
||
<section id="slider-alpha">
|
||
<h2>透明度与两侧边帽</h2>
|
||
<Slider
|
||
channel="alpha"
|
||
default-value="hsba(270,50%,50%,.12345)"
|
||
aria-label="Alpha"
|
||
/>
|
||
</section>
|
||
<section id="slider-lightness">
|
||
<h2>HSL 明度中间色</h2>
|
||
<Slider
|
||
channel="lightness"
|
||
default-value="hsla(0,100%,50%,.25)"
|
||
aria-label="Lightness"
|
||
/>
|
||
</section>
|
||
<section id="slider-vertical">
|
||
<h2>竖向 / RTL</h2>
|
||
<div style="height: 180px; width: 60px">
|
||
<Slider
|
||
channel="hue"
|
||
orientation="vertical"
|
||
dir="rtl"
|
||
default-value="hsb(90,0%,50%)"
|
||
aria-label="Vertical hue"
|
||
/>
|
||
</div>
|
||
</section>
|
||
<section id="picker-composition">
|
||
<h2>Popover / 唯一提交 / reset</h2>
|
||
<form>
|
||
<Picker name="color" />
|
||
<Button type="reset" variant="secondary">重置</Button>
|
||
</form>
|
||
</section>
|
||
</div>
|
||
</main>
|
||
</template>
|
||
<style>
|
||
.color-slider-lab {
|
||
padding: 32px;
|
||
min-height: 100vh;
|
||
background: var(--background);
|
||
color: var(--foreground);
|
||
font-family: Inter, sans-serif;
|
||
}
|
||
.color-slider-lab h1 {
|
||
font-size: 24px;
|
||
font-weight: 600;
|
||
margin-bottom: 8px;
|
||
}
|
||
.color-slider-lab p {
|
||
color: var(--muted);
|
||
margin-bottom: 24px;
|
||
}
|
||
.color-slider-grid {
|
||
display: grid;
|
||
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
||
gap: 24px;
|
||
}
|
||
.color-slider-grid section {
|
||
padding: 24px;
|
||
border: 1px solid var(--border);
|
||
border-radius: 20px;
|
||
}
|
||
.color-slider-grid h2 {
|
||
font-size: 16px;
|
||
font-weight: 600;
|
||
margin-bottom: 20px;
|
||
}
|
||
.color-slider-grid output {
|
||
display: block;
|
||
margin-top: 16px;
|
||
overflow-wrap: anywhere;
|
||
}
|
||
.slider-scale {
|
||
transform: scale(0.9);
|
||
transform-origin: left center;
|
||
width: 111.111%;
|
||
}
|
||
.slider-scale [data-color-slider-track] {
|
||
border: 4px solid transparent;
|
||
box-sizing: content-box;
|
||
}
|
||
</style>
|