feat: migrate ColorSwatch and public color boundary
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
/* Adapted from HeroUI ce90ea3, Apache-2.0; see third-party/HEROUI-LICENSE. */
|
||||
/* ==========================================================================
|
||||
ColorSwatch - visual preview of a color with a transparency checkerboard
|
||||
========================================================================== */
|
||||
|
||||
.hv-color-swatch {
|
||||
@apply relative box-border size-8 shrink-0;
|
||||
|
||||
/* Checkered background pattern for transparency */
|
||||
background:
|
||||
linear-gradient(var(--color-swatch-current), var(--color-swatch-current)),
|
||||
repeating-conic-gradient(#efefef 0% 25%, #f7f7f7 0% 50%) 50% / 16px 16px;
|
||||
|
||||
/* Default border for visibility against similar backgrounds */
|
||||
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
/* Shape variants */
|
||||
.hv-color-swatch--circle {
|
||||
@apply rounded-2xl;
|
||||
}
|
||||
|
||||
.hv-color-swatch--square {
|
||||
@apply rounded-md;
|
||||
}
|
||||
|
||||
/* Size variants */
|
||||
.hv-color-swatch--xs {
|
||||
@apply size-4;
|
||||
|
||||
&.hv-color-swatch--circle {
|
||||
@apply rounded-lg;
|
||||
}
|
||||
}
|
||||
|
||||
.hv-color-swatch--sm {
|
||||
@apply size-6;
|
||||
|
||||
&.hv-color-swatch--circle {
|
||||
@apply rounded-xl;
|
||||
}
|
||||
}
|
||||
|
||||
.hv-color-swatch--md {
|
||||
/* No additional styles — default size (32px) uses circle's base rounded-2xl */
|
||||
}
|
||||
|
||||
.hv-color-swatch--lg {
|
||||
@apply size-9;
|
||||
|
||||
&.hv-color-swatch--circle {
|
||||
@apply rounded-3xl;
|
||||
}
|
||||
}
|
||||
|
||||
.hv-color-swatch--xl {
|
||||
@apply size-10;
|
||||
|
||||
&.hv-color-swatch--circle {
|
||||
@apply rounded-3xl;
|
||||
}
|
||||
}
|
||||
@@ -179,3 +179,6 @@
|
||||
@import "./components/color-input-group.css" layer(components);
|
||||
|
||||
@import "./components/color-picker.css" layer(components);
|
||||
|
||||
/* Public ColorSwatch (COLOR-SWATCH). */
|
||||
@import "./components/color-swatch.css" layer(components);
|
||||
|
||||
@@ -1782,3 +1782,26 @@ export const autocompleteVariants = tv({
|
||||
});
|
||||
|
||||
export type AutocompleteVariants = VariantProps<typeof autocompleteVariants>;
|
||||
|
||||
export const colorSwatchVariants = tv({
|
||||
base: "hv-color-swatch",
|
||||
defaultVariants: {
|
||||
shape: "circle",
|
||||
size: "md",
|
||||
},
|
||||
variants: {
|
||||
shape: {
|
||||
circle: "hv-color-swatch--circle",
|
||||
square: "hv-color-swatch--square",
|
||||
},
|
||||
size: {
|
||||
lg: "hv-color-swatch--lg",
|
||||
md: "hv-color-swatch--md",
|
||||
sm: "hv-color-swatch--sm",
|
||||
xl: "hv-color-swatch--xl",
|
||||
xs: "hv-color-swatch--xs",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export type ColorSwatchVariants = VariantProps<typeof colorSwatchVariants>;
|
||||
|
||||
Reference in New Issue
Block a user