const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
let react = require("react");
react = require_runtime.__toESM(react);
let classnames = require("classnames");
classnames = require_runtime.__toESM(classnames);
require("./index.less");
//#region src/pro/priceKeyboard/components/shortcuts/index.tsx
const Shortcuts = (0, react.forwardRef)((props, ref) => {
	const { presets, onChange, disabled, size = "default" } = props;
	const handleItemClick = (item) => {
		if (disabled || item.disabled) return;
		if (item.onClick) {
			const _next = () => onChange === null || onChange === void 0 ? void 0 : onChange(`${item.value}`);
			item.onClick(item, _next);
		} else onChange === null || onChange === void 0 || 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", {
			ref,
			className: (0, classnames.default)("pisell-virtual-keyboard-shortcuts", { disabled: props.disabled })
		}, presets.map((item, index) => {
			var _item$render;
			const itemProps = {
				key: index,
				className: (0, classnames.default)("pisell-virtual-keyboard-shortcut", {
					disabled: item.disabled,
					large: size === "large"
				}),
				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,
		ref
	]);
});
Shortcuts.displayName = "Shortcuts";
var shortcuts_default = (0, react.memo)(Shortcuts);
//#endregion
exports.default = shortcuts_default;
