// src/components/List/List.tsx
import { Children, cloneElement, isValidElement } from "react";
import classNames from "classnames/dedupe";
import "@simplybusiness/mobius/src/components/List/List.css";
import { jsx } from "react/jsx-runtime";
var List = ({ ref, ...props }) => {
  const Component = props.isOrdered ? "ol" : "ul";
  const { children, icon, ...otherProps } = props;
  const { isOrdered, liststyletype, isReversed, ...restProps } = otherProps;
  const mappedProps = {
    ...restProps,
    reversed: isReversed
  };
  const classes = classNames(
    "mobius",
    "mobius-list",
    {
      "--has-icon": icon,
      [`--is-${liststyletype}`]: liststyletype
    },
    otherProps.className
  );
  return /* @__PURE__ */ jsx(
    Component,
    {
      ref,
      ...mappedProps,
      className: classes,
      children: Children.map(children, (child) => {
        if (isValidElement(child)) {
          return cloneElement(child, {
            parentIcon: icon
          });
        }
        return child;
      })
    }
  );
};
List.displayName = "List";

export {
  List
};
//# sourceMappingURL=chunk-EZ4S7XVZ.js.map
