import "core-js/modules/es.symbol.js";
import "core-js/modules/es.array.filter.js";
import "core-js/modules/es.array.for-each.js";
import "core-js/modules/es.array.push.js";
import "core-js/modules/es.object.define-properties.js";
import "core-js/modules/es.object.define-property.js";
import "core-js/modules/es.object.get-own-property-descriptor.js";
import "core-js/modules/es.object.get-own-property-descriptors.js";
import "core-js/modules/es.object.keys.js";
import "core-js/modules/es.object.to-string.js";
import "core-js/modules/esnext.iterator.constructor.js";
import "core-js/modules/esnext.iterator.filter.js";
import "core-js/modules/esnext.iterator.for-each.js";
import "core-js/modules/web.dom-collections.for-each.js";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
import classNames from 'classnames';
import React, { forwardRef, useRef, useImperativeHandle } from 'react';
import './index.css';
import { TextBubble } from '../text-bubble';
import { IconText } from '../icon-text';
import { FcrIconType } from '../icon/type';
import { jsx as _jsx } from "react/jsx-runtime";
export var LatestButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
  var styles = _ref.styles,
    txt = _ref.txt,
    iconTransform = _ref.iconTransform,
    _ref$direction = _ref.direction,
    direction = _ref$direction === void 0 ? 'bottom' : _ref$direction,
    onClick = _ref.onClick;
  var divRef = useRef(null);
  useImperativeHandle(ref, function () {
    return {
      dom: divRef.current
    };
  });
  var cls = classNames('fcr-latest-btn', {
    'fcr-latest-btn--top': direction === 'top',
    'fcr-latest-btn--bottom': direction === 'bottom'
  });
  return /*#__PURE__*/_jsx("div", {
    ref: divRef,
    className: cls,
    style: _objectSpread({}, styles),
    onClick: onClick,
    children: /*#__PURE__*/_jsx(TextBubble, {
      styles: {
        borderRight: 0,
        borderTopRightRadius: 0,
        borderBottomRightRadius: 0,
        padding: '8px 10px 8px 15px',
        cursor: 'pointer'
      },
      txt: /*#__PURE__*/_jsx(IconText, {
        fontSize: "small",
        icon: FcrIconType.FCR_V2_CHEVRON_DOWN2,
        colors: {
          iconPrimary: 'var(--fcr_ui_scene_icontext1)'
        },
        txt: txt,
        iconTransform: iconTransform
      }),
      type: "purple",
      lineHeight: "large"
    })
  });
});