import {
  FillButtonUniDriver,
  FillPreviewUniDriver
} from "@wix/design-system/dist/testkit/unidriver.js";
import { toHexFormat } from "./../../../ricos-styles/index.js";
import { dataHook } from "./../../../wix-rich-content-common/index.js";
import { ADD_CUSTOM_COLOR_BUTTON, RESET_COLOR_BUTTON, SWATCH, SWATCHES } from "./data-hooks.js";
const createColorSwatchesUnidriver = (getBase) => {
  const getSwatchesBase = async () => getBase().get(dataHook(SWATCHES));
  const getSwatch = async (index) => {
    const swatches = await getSwatchesBase();
    return swatches.$$(dataHook(SWATCH)).get(index);
  };
  return {
    addCustomColorButton: FillButtonUniDriver(
      getBase().$(dataHook(ADD_CUSTOM_COLOR_BUTTON)),
      getBase()
    ),
    resetColorButton: FillButtonUniDriver(getBase().$(dataHook(RESET_COLOR_BUTTON)), getBase()),
    getSwatch: async (index) => {
      const swatch = await getSwatch(index);
      return {
        ...FillPreviewUniDriver(swatch, getBase()),
        getColor: async () => {
          const el = await swatch.$(`button`);
          const style = await el.prop("style");
          return toHexFormat(style.getPropertyValue("--fill-preview-background-color-0"));
        },
        getStyle: async () => {
          const el = await swatch.$(`button`);
          const style = await el.prop("style");
          return style;
        },
        getNativeElement: async () => await swatch.$(`button`).unwrap()
      };
    }
  };
};
export {
  createColorSwatchesUnidriver
};
//# sourceMappingURL=color-swatches-unidriver.js.map
