var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b || (b = {}))
    if (__hasOwnProp.call(b, prop))
      __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b)) {
      if (__propIsEnum.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    }
  return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __objRest = (source, exclude) => {
  var target = {};
  for (var prop in source)
    if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
      target[prop] = source[prop];
  if (source != null && __getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(source)) {
      if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
        target[prop] = source[prop];
    }
  return target;
};
import { jsx, jsxs } from "react/jsx-runtime";
import React, { isValidElement } from "react";
import styled, { withTheme } from "styled-components";
import { TouchableWithoutFeedback } from "react-native";
import { string, node, shape, oneOfType, func } from "prop-types";
import get from "lodash.get";
import Text from "../../../Text";
import Icon from "../../../Icon";
import theme from "../../../Theme/helpers/themeReader";
const { card, cardnative } = theme.components;
const List = styled.View`
  margin-top: ${cardnative.plan.list.margin.top}px;
`;
const Item = styled.View`
  margin-bottom: ${card.plan.list.item.margin.bottom}px;
`;
const Wrapper = styled.View`
  flex-direction: row;
  align-items: center;
`;
const IconWrapper = styled.View`
  margin-right: ${cardnative.plan.list.item.icon.margin.right}px;
`;
const Button = styled.View`
  margin-top: ${card.plan.list.button.margin.top}px;
`;
const ButtonText = styled(Text.Medium)`
  font-size: ${card.plan.list.button.font.size}px;
  color: ${card.plan.list.button.font.color};
`;
const ItemText = styled(Text.Small)`
  color: ${({ color }) => color || card.plan.list.item.font.color};
`;
const ListItem = withTheme(
  (_a) => {
    var {
      text,
      variant = void 0,
      theme: yogaTheme,
      icon = void 0,
      buttonProps: _b = {}
    } = _a, _c = _b, { children } = _c, buttonProps = __objRest(_c, ["children"]);
    const itemColor = get(yogaTheme.yoga.colors, variant);
    if (variant && !itemColor)
      console.warn(
        `Invalid token ${variant}, you can use ${JSON.stringify(
          Object.keys(yogaTheme.yoga.colors)
        )}`
      );
    return /* @__PURE__ */ jsxs(Item, { children: [
      /* @__PURE__ */ jsxs(Wrapper, { children: [
        icon && /* @__PURE__ */ jsx(IconWrapper, { children: isValidElement(icon) ? icon : /* @__PURE__ */ jsx(Icon, { as: icon, size: "small", fill: variant || "text.primary" }) }),
        /* @__PURE__ */ jsx(ItemText, { color: itemColor, children: text })
      ] }),
      Boolean(Object.keys(buttonProps).length) && /* @__PURE__ */ jsx(TouchableWithoutFeedback, __spreadProps(__spreadValues({}, buttonProps), { children: /* @__PURE__ */ jsx(Button, { children: /* @__PURE__ */ jsx(ButtonText, { children }) }) }))
    ] });
  }
);
List.displayName = "PlanCard.List";
ListItem.displayName = "PlanCard.ListItem";
Button.displayName = "PlanCard.ListButton";
ListItem.propTypes = {
  text: string.isRequired,
  /** an icon to be displayed on the begin of the item */
  icon: oneOfType([node, func]),
  /** if provided displays a button below the item text. It accepts all button
   * element props */
  buttonProps: shape({}),
  /** if provided a color variant, like "vibin", "hope", "energy" the icon and
   * the item text will be rendered on this color.
   */
  variant: string
};
export {
  List,
  ListItem
};
