const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
let react = require("react");
react = require_runtime.__toESM(react);
require("./Presets.less");
//#region src/components/virtual-keyboard/BaseNumberKeyboard/Presets.tsx
const Presets = (props) => {
	const { presets, onChange } = props;
	const handleItemClick = (item) => {
		if (item.onClick) {
			const _next = () => onChange(`${item.value}`);
			item.onClick(item, _next);
		} else onChange(`${item.value}`);
	};
	return (0, react.useMemo)(() => {
		if (!(presets === null || presets === void 0 ? void 0 : presets.length)) return null;
		return /* @__PURE__ */ react.default.createElement("div", { className: "pisell-virtual-keyboard-preset" }, presets.map((item, index) => {
			var _item$render;
			const itemProps = {
				key: index,
				className: "pisell-virtual-keyboard-preset-item",
				style: item.style,
				onClick: () => handleItemClick(item)
			};
			return /* @__PURE__ */ react.default.createElement("div", itemProps, ((_item$render = item.render) === null || _item$render === void 0 ? void 0 : _item$render.call(item, item)) || item.label);
		}));
	}, [presets, onChange]);
};
//#endregion
exports.default = Presets;
