import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { Check } from "@truststack/icons-ui";
import { Pressable } from "react-native";
import { Checkbox as TCheckbox, View, XStack, createStyledContext, styled, withStaticProperties } from "tamagui";
import { Icon } from "./Icon.native.js";
import { Body } from "./typography.native.js";
var CheckboxContext = createStyledContext({
    checked: !1
  }),
  CheckboxFrame = styled(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 = styled(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 = withStaticProperties(CheckboxFrame, {
    Props: CheckboxContext.Provider,
    Indicator: TCheckbox.Indicator,
    Container: CheckboxContainer
  });
function Checkbox(param) {
  var {
    checked,
    onChange
  } = param;
  return /* @__PURE__ */_jsx(Pressable, {
    onPress: function () {
      return onChange && onChange(!checked);
    },
    children: /* @__PURE__ */_jsx(C, {
      checked,
      children: /* @__PURE__ */_jsx(C.Container, {
        children: checked ? /* @__PURE__ */_jsx(Icon, {
          size: 18,
          col: "$onPrimary",
          Icon: Check
        }) : /* @__PURE__ */_jsx(_Fragment, {})
      })
    })
  });
}
function CheckboxLabel(param) {
  var {
    checked,
    onChange,
    label
  } = param;
  return /* @__PURE__ */_jsx(Pressable, {
    onPress: function () {
      return onChange && onChange(!checked);
    },
    style: {
      width: "100%"
    },
    children: /* @__PURE__ */_jsxs(XStack, {
      alignItems: "center",
      gap: 20,
      children: [/* @__PURE__ */_jsx(C, {
        checked,
        children: /* @__PURE__ */_jsx(C.Container, {
          borderRadius: 10,
          children: checked ? /* @__PURE__ */_jsx(Icon, {
            size: 15,
            col: "$onPrimary",
            Icon: Check
          }) : /* @__PURE__ */_jsx(_Fragment, {})
        })
      }), /* @__PURE__ */_jsx(Body, {
        size: "large",
        children: label
      })]
    })
  });
}
export { Checkbox, CheckboxLabel };
//# sourceMappingURL=Checkbox.native.js.map
