import { CALLBAR_BUTTON_VALID_WIDTH_SIZE as d } from "./callbar-button-constants.js";
import c, { addClassStyleAttrs as u, removeClassStyleAttrs as b, extractVueListeners as p } from "../../common/utils/index.js";
import { resolveComponent as i, createBlock as f, openBlock as m, mergeProps as o, withCtx as l, renderSlot as r, createTextVNode as h, toDisplayString as y, createElementVNode as B, normalizeClass as C, createVNode as _, toHandlers as S } from "vue";
import { _ as g } from "../../_plugin-vue_export-helper-CHgC5LLL.js";
import T from "../tooltip/tooltip.js";
import v from "../button/button.js";
const A = {
  compatConfig: { MODE: 3 },
  name: "DtRecipeCallbarButton",
  components: { DtButton: v, DtTooltip: T },
  inheritAttrs: !1,
  props: {
    /**
     * Id for the item.
     */
    id: {
      type: String,
      default() {
        return c.getUniqueString();
      }
    },
    /**
     * Determines whether the button should have active styling
     * default is false.
     * @values true, false
     * @see https://dialtone.dialpad.com/components/button/
     */
    active: {
      type: Boolean,
      default: !1
    },
    /**
     * Determines whether the button should have danger styling
     * default is false.
     * @values true, false
     * @see https://dialtone.dialpad.com/components/button/
     */
    danger: {
      type: Boolean,
      default: !1
    },
    /**
     * Determines whether the button should be disabled
     * default is false.
     * @values true, false
     */
    disabled: {
      type: Boolean,
      default: !1
    },
    /**
     * Whether the button is a circle or not.
     * @values true, false
     * @see https://dialtone.dialpad.com/components/button/
     */
    circle: {
      type: Boolean,
      default: !1
    },
    /**
     * Aria label for the button. If empty, it takes its value from the default slot.
     */
    ariaLabel: {
      type: String,
      default: null,
      validator: (t) => t || (void 0).$slots.default
    },
    /**
     * Additional class name for the button wrapper element.
     */
    buttonClass: {
      type: [String, Array, Object],
      default: ""
    },
    /**
     * Additional class name for the button text.
     */
    textClass: {
      type: [String, Array, Object],
      default: ""
    },
    /*
     * Width size. Valid values are: 'xl', 'lg', 'md' and 'sm'.
     */
    buttonWidthSize: {
      type: String,
      default: "xl",
      validator: (t) => d.includes(t)
    },
    /**
     * The fill and outline of the button associated with its visual importance.
     * @values clear, outlined, primary
     */
    importance: {
      type: String,
      default: ""
    },
    /**
     * Whether the tooltip has an inverted background color.
     * @values true, false
     */
    invertedTooltip: {
      type: Boolean,
      default: !1
    },
    /**
     * Use this if you would like to manually override the logic for when the tooltip shows.
     * Otherwise it will just show on hover/focus.
     * @values null, true, false
     */
    showTooltip: {
      type: Boolean,
      default: null
    },
    /**
     * The message that displays in the tooltip. This will be overridden by the tooltip slot.
     */
    tooltipText: {
      type: String,
      default: void 0
    },
    /**
     * Whether there is a delay before the tooltip shows on hover/focus.
     * @values true, false
     */
    tooltipDelay: {
      type: Boolean,
      default: void 0
    }
  },
  emits: [
    /**
     * Native click event
     *
     * @event click
     * @type {PointerEvent | KeyboardEvent}
     */
    "click"
  ],
  computed: {
    callbarButtonClass() {
      return [
        this.buttonClass,
        "d-recipe-callbar-button",
        {
          "d-recipe-callbar-button--circle": this.circle,
          "d-recipe-callbar-button--active": this.active,
          "d-recipe-callbar-button--danger": this.danger,
          "d-btn--disabled": this.disabled
        }
      ];
    },
    callbarButtonTextClass() {
      return [
        "d-recipe-callbar-button__text",
        this.textClass
      ];
    },
    buttonWidth() {
      switch (this.buttonWidthSize) {
        case "sm":
          return "4.5rem";
        case "md":
          return "6rem";
        default:
          return "8.4rem";
      }
    },
    buttonImportance() {
      return this.importance ? this.importance : this.circle ? "outlined" : "clear";
    },
    callbarButtonListeners() {
      return {
        ...p(this.$attrs),
        click: (t) => this.$emit("click", t)
      };
    }
  },
  methods: {
    removeClassStyleAttrs: b,
    addClassStyleAttrs: u
  }
};
function D(t, x, e, w, L, a) {
  const n = i("dt-button"), s = i("dt-tooltip");
  return m(), f(s, o({
    id: e.id,
    inverted: e.invertedTooltip
  }, a.addClassStyleAttrs(t.$attrs), {
    delay: e.tooltipDelay,
    show: e.showTooltip,
    offset: [0, 24]
  }), {
    anchor: l(() => [
      B("span", {
        class: C({ "d-recipe-callbar-button--disabled": e.disabled })
      }, [
        _(n, o({
          importance: a.buttonImportance,
          kind: "muted",
          "icon-position": "top",
          "aria-disabled": e.disabled,
          "aria-label": e.ariaLabel,
          "label-class": a.callbarButtonTextClass,
          width: a.buttonWidth,
          class: a.callbarButtonClass
        }, a.removeClassStyleAttrs(t.$attrs), S(a.callbarButtonListeners)), {
          icon: l(() => [
            r(t.$slots, "icon")
          ]),
          default: l(() => [
            r(t.$slots, "default")
          ]),
          _: 3
        }, 16, ["importance", "aria-disabled", "aria-label", "label-class", "width", "class"])
      ], 2)
    ]),
    default: l(() => [
      r(t.$slots, "tooltip", {}, () => [
        h(y(e.tooltipText), 1)
      ])
    ]),
    _: 3
  }, 16, ["id", "inverted", "delay", "show"]);
}
const z = /* @__PURE__ */ g(A, [["render", D]]);
export {
  z as default
};
//# sourceMappingURL=callbar-button.js.map
