import {
  Typo
} from "./chunk-PMJIFLDT.js";
import {
  mapWithResponsive
} from "./chunk-LDBWASUA.js";
import {
  Flex
} from "./chunk-25HMMI7R.js";
import {
  __objRest,
  __spreadProps,
  __spreadValues
} from "./chunk-CRTRMMJ7.js";

// src/atoms/list.tsx
import { createContext, useContext, useMemo } from "react";
import { clsx } from "clsx";
import { jsx } from "react/jsx-runtime";
function Root(props) {
  const _a = props, {
    variant,
    size = "large",
    children,
    preSpace,
    className: propsClassName
  } = _a, rest = __objRest(_a, [
    "variant",
    "size",
    "children",
    "preSpace",
    "className"
  ]);
  const Comp = variant === "ol" ? "ol" : "ul";
  const className = useMemo(
    () => clsx(
      {
        "pre-space-small": preSpace === "small"
      },
      propsClassName
    ),
    [preSpace, propsClassName]
  );
  return /* @__PURE__ */ jsx(ListContext.Provider, { value: { size }, children: /* @__PURE__ */ jsx(Flex, __spreadProps(__spreadValues({ asChild: true, direction: "column", gap: "1" }, rest), { className, children: /* @__PURE__ */ jsx(Comp, { children }) })) });
}
function Item(props) {
  const { children } = props;
  const { size } = useList();
  const variant = useMemo(() => {
    return mapWithResponsive({
      value: size,
      mapFn: (sizeValue) => {
        return sizeValue === "small" ? "caption" : "body";
      }
    });
  }, [size]);
  return /* @__PURE__ */ jsx(Typo, { asChild: true, variant, children: /* @__PURE__ */ jsx("li", { children }) });
}
var ListContext = createContext({
  size: "large"
});
function useList() {
  return useContext(ListContext);
}
var List = {
  Root,
  Item
};

export {
  useList,
  List
};
//# sourceMappingURL=chunk-JIJLOKVN.js.map