UNPKG

@atlaskit/comment

Version:

A comment displays discussions and user feedback.

45 lines (44 loc) • 1.66 kB
import React, { forwardRef } from 'react'; import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler'; import Button from '@atlaskit/button/button'; var ActionItem = /*#__PURE__*/forwardRef(function (_ref, ref) { var children = _ref.children, providedOnClick = _ref.onClick, onFocus = _ref.onFocus, onMouseOver = _ref.onMouseOver, isDisabled = _ref.isDisabled; var onClick = usePlatformLeafEventHandler({ fn: function fn(event, analyticsEvent) { return providedOnClick && providedOnClick(event, analyticsEvent); }, action: 'clicked', componentName: 'commentAction', packageName: "@atlaskit/comment", packageVersion: "14.2.5" }); return ( /*#__PURE__*/ /** * It is not normally acceptable to add click and key handlers to non-interactive * elements as this is an accessibility anti-pattern. However, because this * instance is to add support for analytics instead of creating an inaccessible * custom element, we can add role="presentation" so that there are no negative * impacts to assistive technologies. */ // eslint-disable-next-line @atlassian/a11y/interactive-element-not-keyboard-focusable React.createElement("span", { role: "presentation", onClick: onClick, onFocus: onFocus, onMouseOver: onMouseOver }, /*#__PURE__*/React.createElement(Button, { ref: ref, appearance: "subtle-link", spacing: "none", type: "button", isDisabled: isDisabled }, children)) ); }); // eslint-disable-next-line @repo/internal/react/require-jsdoc export default ActionItem;