var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
import React, { forwardRef } from "react";
import { cl } from "../../utils/helpers/index.js";
import { ChipsRemovable } from "../removable/ChipsRemovable.js";
import { ChipsToggle } from "../toggle/ChipsToggle.js";
/**
 * A component that displays a list of items as chips.
 *
 * @see [📝 Documentation](https://aksel.nav.no/komponenter/core/chips)
 * @see 🏷️ {@link ChipsProps}
 *
 * @example
 * ```jsx
 *    <Chips size="small">
 *      {options.map((c) => (
 *        <Chips.Toggle
 *          selected={selected.includes(c)}
 *          key={c}
 *          onClick={() =>
 *            setSelected(
 *              selected.includes(c)
 *                ? selected.filter((x) => x !== c)
 *                : [...selected, c]
 *            )
 *          }
 *        >
 *          {c}
 *        </Chips.Toggle>
 *      ))}
 *    </Chips>
 * ```
 */
export const Chips = forwardRef((_a, ref) => {
    var { className, size = "medium", children } = _a, rest = __rest(_a, ["className", "size", "children"]);
    return (React.createElement("ul", Object.assign({}, rest, { ref: ref, className: cl("aksel-chips", className, `aksel-chips--${size}`, {
            "aksel-body-short aksel-body-short--small": size === "medium",
            "aksel-detail aksel-detail--small": size === "small",
        }) }), React.Children.map(children, (chip, index) => {
        return React.createElement("li", { key: (chip === null || chip === void 0 ? void 0 : chip.toString()) || index }, chip);
    })));
});
Chips.Toggle = ChipsToggle;
Chips.Removable = ChipsRemovable;
export default Chips;
//# sourceMappingURL=ChipsRoot.js.map