51 lines
1.3 KiB
Plaintext
51 lines
1.3 KiB
Plaintext
"use client";
|
|
import {
|
|
useChip
|
|
} from "./chunk-P5JPZ5W3.mjs";
|
|
|
|
// src/chip.tsx
|
|
import { CloseFilledIcon } from "@heroui/shared-icons";
|
|
import { forwardRef } from "@heroui/system";
|
|
import { useMemo } from "react";
|
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
var Chip = forwardRef((props, ref) => {
|
|
const {
|
|
Component,
|
|
children,
|
|
slots,
|
|
classNames,
|
|
isDot,
|
|
isCloseable,
|
|
startContent,
|
|
endContent,
|
|
getCloseButtonProps,
|
|
getChipProps
|
|
} = useChip({
|
|
...props,
|
|
ref
|
|
});
|
|
const start = useMemo(() => {
|
|
if (isDot && !startContent) {
|
|
return /* @__PURE__ */ jsx("span", { className: slots.dot({ class: classNames == null ? void 0 : classNames.dot }) });
|
|
}
|
|
return startContent;
|
|
}, [slots, startContent, isDot]);
|
|
const end = useMemo(() => {
|
|
if (isCloseable) {
|
|
return /* @__PURE__ */ jsx("span", { ...getCloseButtonProps(), children: endContent || /* @__PURE__ */ jsx(CloseFilledIcon, {}) });
|
|
}
|
|
return endContent;
|
|
}, [endContent, isCloseable, getCloseButtonProps]);
|
|
return /* @__PURE__ */ jsxs(Component, { ...getChipProps(), children: [
|
|
start,
|
|
/* @__PURE__ */ jsx("span", { className: slots.content({ class: classNames == null ? void 0 : classNames.content }), children }),
|
|
end
|
|
] });
|
|
});
|
|
Chip.displayName = "HeroUI.Chip";
|
|
var chip_default = Chip;
|
|
|
|
export {
|
|
chip_default
|
|
};
|