import { Color, ColorSwatch, ColorSwatchRoot, colorSwatchVariants, parseColor, type ColorChannel, type ColorInput, type ColorSpace, type ColorSwatchProps, type ColorSwatchRenderProps, type ColorSwatchRootProps, type ColorSwatchSlots, type ColorSwatchStyle, type ColorSwatchStyleFn, type ColorValue, } from "@heroui-vue/components"; const color = parseColor("#0485F7"); const value: ColorValue = color; const format: ColorSpace = "hsl"; const channel: ColorChannel = "alpha"; const input: ColorInput = { space: "rgb", r: 4, g: 133, b: 247, alpha: 1 }; const constructed = new Color(input); const style: ColorSwatchStyle = { outline: "1px solid black" }; const styleFn: ColorSwatchStyleFn = ({ color: current }) => ({ background: current.toString("css"), }); const styleRender: ColorSwatchStyle = ({ color: current }) => ({ background: current.toString("css"), }); const props: ColorSwatchProps = { color, colorName: "海洋蓝", shape: "square", size: "xl", as: "div", asChild: false, style, styleFn, }; const rootProps: ColorSwatchRootProps = props; const inlineStyle: ColorSwatchProps = { color: "#0485F7", style: ({ color: current }) => ({ background: current.toString("css") }), }; const slots: ColorSwatchSlots = { default: ({ color: current }: ColorSwatchRenderProps) => current.toString("hex"), }; // @ts-expect-error shape is constrained to circle | square const badShape: ColorSwatchProps = { shape: "pill" }; // @ts-expect-error size is constrained to the baseline set const badSize: ColorSwatchProps = { size: "xxl" }; // @ts-expect-error color accepts strings, Color or null const badColor: ColorSwatchProps = { color: 42 }; // @ts-expect-error ColorChannel is the public channel union const badChannel: ColorChannel = "yellow"; // @ts-expect-error ColorSpace is limited to rgb | hsl | hsb const badSpace: ColorSpace = "lab"; // @ts-expect-error ColorInput requires the space discriminator const badInput: ColorInput = { r: 1, g: 2, b: 3, alpha: 1 }; // @ts-expect-error withAlpha accepts a number const badAlpha = color.withAlpha("0.5"); void [ ColorSwatch, ColorSwatchRoot, colorSwatchVariants, value, format, channel, constructed, props, rootProps, styleRender, inlineStyle, slots, badShape, badSize, badColor, badChannel, badSpace, badInput, badAlpha, ];