import {
  getResponsiveColorDataSwatchIds
} from "@makeswift/prop-controllers";
import { isNonNullable } from "../utils/isNonNullable";
import { useSwatches } from "../../runtimes/react/hooks/makeswift-api";
function useResponsiveColor(color) {
  const swatchIds = color == null ? [] : getResponsiveColorDataSwatchIds(color);
  const swatches = useSwatches(swatchIds);
  if (color == null)
    return null;
  return color.map(({ value: v, ...rest }) => {
    const { swatchId, alpha } = v;
    const swatch = swatches.find((s) => s && s.id === swatchId);
    return swatch == null ? null : { ...rest, value: { swatch, alpha } };
  }).filter(isNonNullable);
}
export {
  useResponsiveColor
};
//# sourceMappingURL=useResponsiveColor.js.map