@atlaskit/lozenge
Version:
A lozenge is a visual indicator used to highlight an item's status for quick recognition.
70 lines • 2.75 kB
JavaScript
/* lozenge-dropdown-trigger.tsx generated by @compiled/babel-plugin v0.39.1 */
import _extends from "@babel/runtime/helpers/extends";
import * as React from 'react';
import { ax, ix } from "@compiled/react/runtime";
import { forwardRef, memo } from 'react';
import __noop from '@atlaskit/ds-lib/noop';
import LozengeBase from './lozenge-base';
/**
* __Lozenge Dropdown Trigger__
*
* An interactive lozenge component that acts as a dropdown trigger.
* Built on LozengeBase with dropdown interaction patterns.
*
* - Supports all color variants from the lozenge
* - Shows selected state with dedicated color tokens
* - Includes a chevron icon on the right of the text
* - Built for dropdown menu interactions
* - Supports analytics events and UFO press interactions
*/
var LozengeDropdownTrigger = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref) {
var children = _ref.children,
testId = _ref.testId,
_ref$appearance = _ref.appearance,
appearance = _ref$appearance === void 0 ? 'neutral' : _ref$appearance,
_ref$spacing = _ref.spacing,
spacing = _ref$spacing === void 0 ? 'default' : _ref$spacing,
iconBefore = _ref.iconBefore,
trailingMetric = _ref.trailingMetric,
trailingMetricAppearance = _ref.trailingMetricAppearance,
_ref$isSelected = _ref.isSelected,
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
_ref$isLoading = _ref.isLoading,
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
_ref$maxWidth = _ref.maxWidth,
maxWidth = _ref$maxWidth === void 0 ? 200 : _ref$maxWidth,
_ref$onClick = _ref.onClick,
onClick = _ref$onClick === void 0 ? __noop : _ref$onClick,
style = _ref.style,
analyticsContext = _ref.analyticsContext,
interactionName = _ref.interactionName,
ariaControls = _ref['aria-controls'],
ariaExpanded = _ref['aria-expanded'],
ariaHaspopup = _ref['aria-haspopup'],
ariaLabel = _ref['aria-label'];
var baseProps = {
appearance: appearance,
spacing: spacing,
iconBefore: iconBefore,
trailingMetric: trailingMetric,
trailingMetricAppearance: trailingMetricAppearance,
isSelected: isSelected,
isLoading: isLoading,
maxWidth: maxWidth,
style: style,
testId: testId,
onClick: onClick,
analyticsContext: analyticsContext,
interactionName: interactionName,
children: children,
'aria-controls': ariaControls,
'aria-expanded': ariaExpanded,
'aria-haspopup': ariaHaspopup,
'aria-label': ariaLabel
};
return /*#__PURE__*/React.createElement(LozengeBase, _extends({
ref: ref
}, baseProps), children);
}));
LozengeDropdownTrigger.displayName = 'LozengeDropdownTrigger';
export default LozengeDropdownTrigger;