import { b9 as x, cU as B, w as n, bv as b, a0 as t, ba as w, cK as h, bd as c, be as f, ev as y, ew as C, bB as v, ex as V, bf as T, U as p, V as l, P as a, bh as g, bi as i, bj as r, bg as s, bk as P, bl as I, bm as S, bn as $, bo as m, bp as E } from "./684d2f28.js";
import { useContext as u } from "react";
import { Button100 as D, buttonRefMethods as M, ButtonCompWrapper as L } from "./926d8ea1.js";
import "react-dom";
import "./d6402597.js";
const R = x.div`
  display: flex;
`, j = x(L)`
  width: 100%;
  display: flex;
  justify-content: ${(o) => o.$align};

  > button {
    width: ${(o) => o.$align !== "stretch" && "auto"};
    border: ${(o) => !o.$showBorder && "none"};
    box-shadow: ${(o) => !o.$showBorder && "none"};
  }
`, U = function() {
  const o = {
    value: B("value"),
    showText: n(b, !0),
    trueText: n(w, t("toggleButton.trueDefaultText")),
    falseText: n(w, t("toggleButton.falseDefaultText")),
    onEvent: h,
    disabled: c,
    loading: c,
    trueIcon: n(f, "/icon:solid/AngleUp"),
    falseIcon: n(f, "/icon:solid/AngleDown"),
    iconPosition: y,
    alignment: C,
    style: v(V),
    showBorder: n(b, !0),
    viewRef: T
  };
  return new p(o, (e) => {
    const d = e.showText && (e.value.value ? e.trueText : e.falseText) || void 0;
    return /* @__PURE__ */ l(j, {
      disabled: e.disabled,
      $align: e.alignment,
      $showBorder: e.showBorder,
      children: /* @__PURE__ */ a(D, {
        ref: e.viewRef,
        $buttonStyle: e.style,
        loading: e.loading,
        disabled: e.disabled,
        onClick: () => {
          e.onEvent("change"), e.value.onChange(!e.value.value);
        },
        children: [e.iconPosition === "right" && d, /* @__PURE__ */ l(R, {
          children: e.value.value ? e.trueIcon : e.falseIcon
        }), e.iconPosition === "left" && d]
      })
    });
  }).setPropertyViewFn((e) => /* @__PURE__ */ a(g, {
    children: [/* @__PURE__ */ l(i, {
      name: r.basic,
      children: e.value.propertyView({
        label: t("prop.defaultValue"),
        tooltip: t("toggleButton.valueDesc")
      })
    }), (u(s).editorModeStatus === "logic" || u(s).editorModeStatus === "both") && /* @__PURE__ */ a(g, {
      children: [/* @__PURE__ */ a(i, {
        name: r.interaction,
        children: [e.onEvent.getPropertyView(), P(e), I(e), S(e)]
      }), /* @__PURE__ */ a(i, {
        name: r.advanced,
        children: [e.showText.propertyView({
          label: t("toggleButton.showText")
        }), e.showText.getView() && e.trueText.propertyView({
          label: t("toggleButton.trueLabel")
        }), e.showText.getView() && e.falseText.propertyView({
          label: t("toggleButton.falseLabel")
        }), e.trueIcon.propertyView({
          label: t("toggleButton.trueIconLabel")
        }), e.falseIcon.propertyView({
          label: t("toggleButton.falseIconLabel")
        }), e.showText.getView() && e.iconPosition.propertyView({
          label: t("toggleButton.iconPosition"),
          radioButton: !0
        }), e.alignment.propertyView({
          label: t("toggleButton.alignment"),
          radioButton: !0
        })]
      })]
    }), (u(s).editorModeStatus === "layout" || u(s).editorModeStatus === "both") && /* @__PURE__ */ l(g, {
      children: /* @__PURE__ */ a(i, {
        name: r.style,
        children: [e.showBorder.propertyView({
          label: t("toggleButton.showBorder")
        }), e.style.getPropertyView()]
      })
    })]
  })).setExposeMethodConfigs(M).build();
}(), H = $(U, [new m("value", t("dropdown.textDesc")), new m("loading", t("button.loadingDesc")), ...E]);
export {
  H as ToggleButtonComp
};
