Sha256: 0ad5a58815012916a72274a10bf3b6f773530e0599ca228a69408cb2453bdcf6

Contents?: true

Size: 717 Bytes

Versions: 1

Compression:

Stored size: 717 Bytes

Contents

import { CocoComponent } from "@js/coco";
import { getData } from "@helpers/alpine";

export default CocoComponent("appColorPickerButton", ({ selected }) => {
  selected = selected ? "#" + selected.replace("#", "") : "#FFFFFF";
  return {
    selectedColor: selected,

    getPicker() {
      return getData(
        this.$root.querySelector("[data-role='color-picker']").firstElementChild
      );
    },

    get selectedColorHex() {
      return this.selectedColor && this.selectedColor.replace("#", "");
    },

    set selectedColorHex(value) {
      this.selectedColor == "#" + value.replace("#", "");
    },

    onDropdownMount() {
      this.getPicker().setSelectedColor(this.selectedColor);
    },
  };
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
coveragebook_components-0.5.0 app/components/coco/app/elements/color_picker_button/color_picker_button.js