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 Radio_exports = {};
__export(Radio_exports, {
  Radio: () => Radio,
  RadioGroup: () => RadioGroup
});
module.exports = __toCommonJS(Radio_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 RadioContext = (0, import_tamagui.createStyledContext)({
  selected: !1
}), Frame = (0, import_tamagui.styled)(import_tamagui.ThemeableStack, {
  name: "Radio",
  context: RadioContext,
  justifyContent: "center",
  alignItems: "center",
  width: 40,
  height: 40,
  borderRadius: "$shape.corner_full",
  cursor: "pointer",
  animateOnly: ["backgroundColor"],
  animation: "100ms",
  hoverStyle: {
    backgroundColor: "$onSurfaceOpacity"
  },
  variants: {
    selected: {
      true: {},
      false: {}
    }
  }
}), Icon = (0, import_tamagui.styled)(import_Icon.Icon, {
  name: "RadioIcon",
  context: RadioContext,
  size: 20,
  disabledStyle: {
    col: "$onSurface",
    opacity: 0.38
  },
  variants: {
    selected: {
      true: {
        col: "$primary",
        Icon: import_icons_ui.CircleDot
      },
      false: {
        col: "$onSurfaceVariant",
        Icon: import_icons_ui.Circle
      }
    }
  }
}), RadioComposed = (0, import_tamagui.withStaticProperties)(Frame, {
  Props: RadioContext.Provider,
  Icon
}), Radio = RadioComposed.styleable((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioComposed, { ...props, ref, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioComposed.Icon, {}) }));
function RadioGroup({
  items = [],
  value,
  onChange,
  ...props
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.YStack, { ...props, children: items?.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
    import_react_native.Pressable,
    {
      style: { width: "100%" },
      onPress: () => onChange(item.value),
      children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_tamagui.XStack, { alignItems: "center", gap: 20, children: [
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Radio, { selected: item.value == value }),
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_typography.Body, { size: "large", children: item.label })
      ] })
    },
    `radio-item-${index}`
  )) });
}
//# sourceMappingURL=Radio.js.map
