var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: !0 });
}, __copyProps = (to, from, except, desc) => {
  if (from && typeof from == "object" || typeof from == "function")
    for (let key of __getOwnPropNames(from))
      !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
var Checkbox_exports = {};
__export(Checkbox_exports, {
  Checkbox: () => Checkbox,
  CheckboxLabel: () => CheckboxLabel
});
module.exports = __toCommonJS(Checkbox_exports);
var import_icons_ui = require("@truststack/icons-ui"), import_react_native = require("react-native-web"), import_tamagui = require("tamagui"), import_Icon = require("./Icon"), import_typography = require("./typography"), import_jsx_runtime = require("react/jsx-runtime");
const CheckboxContext = (0, import_tamagui.createStyledContext)({ checked: !1 }), CheckboxFrame = (0, import_tamagui.styled)(import_tamagui.View, {
  name: "Checkbox",
  context: CheckboxContext,
  width: 40,
  height: 40,
  display: "flex",
  justifyContent: "center",
  alignItems: "center",
  borderRadius: "$shape.corner_full",
  disabledStyle: {
    o: 0.4,
    pe: "none"
  }
}), CheckboxContainer = (0, import_tamagui.styled)(import_tamagui.View, {
  name: "CheckboxContainer",
  context: CheckboxContext,
  width: 18,
  height: 18,
  disabledStyle: {
    o: 0.4,
    pe: "none"
  },
  borderColor: "$onSurfaceVariant",
  backgroundColor: "transparent",
  display: "flex",
  justifyContent: "center",
  alignItems: "center",
  borderRadius: 2,
  borderWidth: 2,
  variants: {
    checked: {
      true: {
        backgroundColor: "$primary",
        borderColor: "$primary"
      }
    }
  }
}), C = (0, import_tamagui.withStaticProperties)(CheckboxFrame, {
  Props: CheckboxContext.Provider,
  Indicator: import_tamagui.Checkbox.Indicator,
  Container: CheckboxContainer
});
function Checkbox({ checked, onChange }) {
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.Pressable, { onPress: () => onChange && onChange(!checked), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(C, { checked, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(C.Container, { children: checked ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { size: 18, col: "$onPrimary", Icon: import_icons_ui.Check }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}) }) }) });
}
function CheckboxLabel({
  checked,
  onChange,
  label
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
    import_react_native.Pressable,
    {
      onPress: () => onChange && onChange(!checked),
      style: { width: "100%" },
      children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_tamagui.XStack, { alignItems: "center", gap: 20, children: [
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(C, { checked, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(C.Container, { borderRadius: 10, children: checked ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { size: 15, col: "$onPrimary", Icon: import_icons_ui.Check }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}) }) }),
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_typography.Body, { size: "large", children: label })
      ] })
    }
  );
}
//# sourceMappingURL=Checkbox.js.map
