import { forwardRef } from "react";
import Button from "../../Button/index.js";
import { isArray } from "../../_util/is.js";
import { jsxs, jsx } from "../../../../../../../@emotion_react@11.10.4_3toe27fv7etiytxb5kxc7fxaw4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js";
function Shortcuts(props, ref) {
  var prefixCls = props.prefixCls, _a = props.shortcuts, shortcuts = _a === void 0 ? [] : _a, onSelectNow = props.onSelectNow, nowText = props.nowText, showNowBtn = props.showNowBtn, showTime = props.showTime, onMouseEnterShortcut = props.onMouseEnterShortcut, onMouseLeaveShortcut = props.onMouseLeaveShortcut;
  function onMouseEnter(shortcut) {
    onMouseEnterShortcut && onMouseEnterShortcut(shortcut);
  }
  function onMouseLeave(shortcut) {
    onMouseLeaveShortcut && onMouseLeaveShortcut(shortcut);
  }
  function onClick(shortcut, e) {
    var onSelectShortcut = props.onSelectShortcut;
    onSelectShortcut && onSelectShortcut(shortcut, e);
  }
  var hasShortcuts = isArray(shortcuts) && shortcuts.length > 0;
  var shouldShowNowBtn = showNowBtn && showTime && !hasShortcuts;
  return /* @__PURE__ */ jsxs("div", {
    ref,
    className: prefixCls + "-shortcuts",
    children: [shouldShowNowBtn && /* @__PURE__ */ jsx(Button, {
      size: "mini",
      onClick: onSelectNow,
      children: nowText
    }), hasShortcuts && shortcuts.map(function(shortcut, index) {
      return /* @__PURE__ */ jsx(Button, {
        size: "mini",
        onMouseEnter: function() {
          return onMouseEnter(shortcut);
        },
        onMouseLeave: function() {
          return onMouseLeave(shortcut);
        },
        onClick: function(e) {
          return onClick(shortcut, e);
        },
        children: shortcut.text
      }, index);
    })]
  });
}
const Shortcuts$1 = forwardRef(Shortcuts);
export {
  Shortcuts$1 as default
};
//# sourceMappingURL=shortcuts.js.map
