@primer/react
Version:
An implementation of GitHub's Primer Design System using React
115 lines (112 loc) • 2.61 kB
JavaScript
import { c } from 'react-compiler-runtime';
import { forwardRef } from 'react';
import { IconButton } from '../Button/IconButton.js';
import { ButtonComponent } from '../Button/Button.js';
import { clsx } from 'clsx';
import classes from './ActionList.module.css.js';
import { jsx } from 'react/jsx-runtime';
const TrailingAction = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
const $ = c(23);
let className;
let icon;
let label;
let loading;
let props;
let style;
let t1;
let t2;
if ($[0] !== t0) {
({
as: t1,
icon,
label,
href: t2,
className,
style,
loading,
...props
} = t0);
$[0] = t0;
$[1] = className;
$[2] = icon;
$[3] = label;
$[4] = loading;
$[5] = props;
$[6] = style;
$[7] = t1;
$[8] = t2;
} else {
className = $[1];
icon = $[2];
label = $[3];
loading = $[4];
props = $[5];
style = $[6];
t1 = $[7];
t2 = $[8];
}
const as = t1 === undefined ? "button" : t1;
const href = t2 === undefined ? null : t2;
let t3;
if ($[9] !== className) {
t3 = clsx(className, classes.TrailingAction);
$[9] = className;
$[10] = t3;
} else {
t3 = $[10];
}
let t4;
if ($[11] !== as || $[12] !== forwardedRef || $[13] !== href || $[14] !== icon || $[15] !== label || $[16] !== loading || $[17] !== props) {
t4 = icon ? /*#__PURE__*/jsx(IconButton, {
as: as,
"aria-label": label,
icon: icon,
variant: "invisible",
tooltipDirection: "w",
href: href,
loading: loading,
"data-loading": Boolean(loading),
ref: forwardedRef,
className: classes.TrailingActionButton,
...props
}) : /*#__PURE__*/jsx(ButtonComponent, {
variant: "invisible",
as: as,
href: href,
loading: loading,
"data-loading": Boolean(loading),
ref: forwardedRef,
className: classes.TrailingActionButton,
...props,
children: label
});
$[11] = as;
$[12] = forwardedRef;
$[13] = href;
$[14] = icon;
$[15] = label;
$[16] = loading;
$[17] = props;
$[18] = t4;
} else {
t4 = $[18];
}
let t5;
if ($[19] !== style || $[20] !== t3 || $[21] !== t4) {
t5 = /*#__PURE__*/jsx("span", {
className: t3,
"data-component": "ActionList.TrailingAction",
style: style,
children: t4
});
$[19] = style;
$[20] = t3;
$[21] = t4;
$[22] = t5;
} else {
t5 = $[22];
}
return t5;
});
TrailingAction.__SLOT__ = Symbol('ActionList.TrailingAction');
export { TrailingAction };