"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
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 __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var List_exports = {};
__export(List_exports, {
  List: () => List,
  ListItem: () => ListItem
});
module.exports = __toCommonJS(List_exports);
var import_jsx_runtime = require("react/jsx-runtime");
var import_react = __toESM(require("react"));
var import_styled_components = __toESM(require("styled-components"));
var import_prop_types = require("prop-types");
var import_Text = __toESM(require("../../../Text"));
var import_themeReader = __toESM(require("../../../Theme/helpers/themeReader"));
var import_Box = __toESM(require("../../../Box"));
const { card, cardweb } = import_themeReader.default.components;
const truncateStyle = import_styled_components.css`
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
`;
const List = import_styled_components.default.ul`
  margin: ${cardweb.plan.list.margin.top}px 0 0;
  padding: 0;

  list-style: none;
`;
const IconWrapper = import_styled_components.default.div`
  display: flex;
  align-items: center;
  margin-right: ${cardweb.plan.list.item.icon.margin.right}px;
  min-height: ${(props) => props.theme.yoga.spacing.medium}px;
`;
const Item = import_styled_components.default.li`
  :not(:last-child) {
    margin-bottom: ${card.plan.list.item.margin.bottom}px;
  }
`;
const Wrapper = (0, import_styled_components.default)(import_Box.default)`
  display: flex;
  flex-direction: column;
  width: 100%;

  ${(props) => props.as === "button" && import_styled_components.css`
      border: none;
      padding: 0;
      background: transparent;
      cursor: pointer;
      text-align: start;
    `}

  svg {
    flex-shrink: 0;
  }
`;
const ItemText = (0, import_styled_components.default)(import_Text.default.Small)`
  display: inline-block;
  height: 100%;
  vertical-align: middle;

  color: ${card.plan.list.item.font.color};

  ${(props) => props.truncate && truncateStyle}
`;
const Button = import_styled_components.default.button`
  display: block;
  padding: 0;
  margin-top: ${card.plan.list.button.margin.top}px;

  width: 100%;

  letter-spacing: normal;

  background-color: transparent;
  border: none;

  font-family: ${import_themeReader.default.baseFont.family};
  font-size: ${card.plan.list.button.font.size}px;
  font-weight: ${card.plan.list.button.font.weight};
  color: ${card.plan.list.button.font.color};

  cursor: pointer;
  text-decoration: none;
  text-align: left;
  outline: none;

  ${truncateStyle}
`;
const emptyObj = {};
const ListItem = (0, import_styled_components.withTheme)((props) => {
  const {
    text,
    truncate = true,
    icon: Icon,
    buttonProps = emptyObj,
    theme: yogaTheme,
    children,
    onClick
  } = props;
  const wrapperProps = onClick ? { as: "button", type: "button", onClick } : {};
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Item, { children: [
    /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Wrapper, __spreadProps(__spreadValues({}, wrapperProps), { children: [
      /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_Box.default, { display: "flex", alignItems: "flex-start", width: "100%", children: [
        Icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconWrapper, { children: (0, import_react.isValidElement)(Icon) ? Icon : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
          Icon,
          {
            width: 16,
            height: 16,
            fill: yogaTheme.yoga.colors.text.primary
          }
        ) }),
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemText, { as: "span", truncate, children: text })
      ] }),
      children
    ] })),
    Boolean(Object.keys(buttonProps).length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, __spreadValues({}, buttonProps))
  ] });
});
List.displayName = "PlanCard.List";
ListItem.displayName = "PlanCard.ListItem";
Button.displayName = "PlanCard.ListButton";
ListItem.propTypes = {
  text: (0, import_prop_types.oneOfType)([import_prop_types.string, import_prop_types.node]).isRequired,
  /** an icon to be displayed on the begin of the item */
  icon: (0, import_prop_types.oneOfType)([import_prop_types.node, import_prop_types.func]),
  /** if provided displays a button below the item text. It accepts all button
   * element props */
  buttonProps: (0, import_prop_types.shape)({}),
  /** if provided makes the item clickable */
  onClick: import_prop_types.func,
  children: import_prop_types.node,
  truncate: import_prop_types.bool
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  List,
  ListItem
});
