const require_runtime = require("../../../../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_bookingCalendarConstants = require("../const/bookingCalendarConstants.js");
const require_bookingCalendarDateUtils = require("../utils/bookingCalendarDateUtils.js");
let react = require("react");
react = require_runtime.__toESM(react);
let react_window = require("react-window");
//#region src/components/pisellRecordBoard/shellFrame/Calendar/modal/OverflowPopover.tsx
/** 月/周格「+N」悬停层内的虚拟列表（overflowPopover） */
function MonthGridOverflowVirtualList({ items, listWidth, onPickItem }) {
	if (!(items === null || items === void 0 ? void 0 : items.length)) return null;
	const listH = Math.min(items.length * require_bookingCalendarConstants.MONTH_OVERFLOW_POPOVER_ITEM_H, 280);
	const Row = (0, react.useCallback)(({ index, style }) => {
		const extraItem = items[index];
		if (!extraItem) return null;
		return /* @__PURE__ */ react.default.createElement("div", { style: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, style), {}, {
			boxSizing: "border-box",
			paddingLeft: 2,
			paddingRight: 6,
			paddingBottom: 8
		}) }, /* @__PURE__ */ react.default.createElement("button", {
			type: "button",
			onClick: (e) => {
				e.stopPropagation();
				onPickItem(extraItem);
			},
			className: `flex h-full min-h-0 w-full flex-col justify-center rounded-lg px-3 py-2 text-xs text-left ${extraItem.kind === "block" ? "bg-red-700/70 text-red-100" : "bg-violet-700/90 text-violet-50"}`
		}, /* @__PURE__ */ react.default.createElement("div", { className: "truncate" }, extraItem.name), /* @__PURE__ */ react.default.createElement("div", { className: "mt-1 opacity-80" }, require_bookingCalendarDateUtils.formatHourLabel(extraItem.startHour), " -", " ", require_bookingCalendarDateUtils.formatHourLabel(extraItem.endHour))));
	}, [items, onPickItem]);
	return /* @__PURE__ */ react.default.createElement(react_window.FixedSizeList, {
		height: listH,
		itemCount: items.length,
		itemSize: require_bookingCalendarConstants.MONTH_OVERFLOW_POPOVER_ITEM_H,
		width: listWidth,
		style: { overflowX: "hidden" }
	}, Row);
}
//#endregion
exports.MonthGridOverflowVirtualList = MonthGridOverflowVirtualList;
