@yamada-ui/autocomplete
Version:
Yamada UI autocomplete component
68 lines (66 loc) • 2.24 kB
JavaScript
"use client"
import {
useAutocompleteList
} from "./chunk-IHZ7APGG.mjs";
import {
useAutocompleteContext
} from "./chunk-X5V76SN2.mjs";
// src/autocomplete-list.tsx
import { forwardRef, ui } from "@yamada-ui/core";
import { PopoverContent } from "@yamada-ui/popover";
import { cx } from "@yamada-ui/utils";
import { jsx, jsxs } from "react/jsx-runtime";
var AutocompleteList = forwardRef(
({
className,
children,
footer,
header,
maxW,
maxWidth = maxW,
minW,
minWidth = minW,
w,
width = w,
contentProps,
...rest
}, ref) => {
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
const { styles } = useAutocompleteContext();
const { getContainerProps, getListProps } = useAutocompleteList();
width != null ? width : width = (_c = (_a = styles.list) == null ? void 0 : _a.width) != null ? _c : (_b = styles.list) == null ? void 0 : _b.w;
minWidth != null ? minWidth : minWidth = (_f = (_d = styles.list) == null ? void 0 : _d.minWidth) != null ? _f : (_e = styles.list) == null ? void 0 : _e.minW;
maxWidth != null ? maxWidth : maxWidth = (_i = (_g = styles.list) == null ? void 0 : _g.maxWidth) != null ? _i : (_h = styles.list) == null ? void 0 : _h.maxW;
return /* @__PURE__ */ jsxs(
PopoverContent,
{
as: "div",
className: "ui-autocomplete__popover",
maxWidth,
minWidth,
width,
__css: styles.content,
...getContainerProps(contentProps),
children: [
header ? /* @__PURE__ */ jsx(ui.header, { className: "ui-autocomplete__header", __css: styles.header, children: header }) : null,
/* @__PURE__ */ jsx(
ui.div,
{
className: cx("ui-autocomplete__list", className),
__css: styles.list,
...getListProps(rest, ref),
children
}
),
footer ? /* @__PURE__ */ jsx(ui.footer, { className: "ui-autocomplete__footer", __css: styles.footer, children: footer }) : null
]
}
);
}
);
AutocompleteList.displayName = "AutocompleteList";
AutocompleteList.__ui__ = "AutocompleteList";
export {
AutocompleteList
};
//# sourceMappingURL=chunk-OWWPKTOS.mjs.map