UNPKG

@primer/react

Version:

An implementation of GitHub's Primer Design System using React

106 lines (105 loc) 2.64 kB
import { IconButton } from "../Button/IconButton.js"; import { ButtonComponent } from "../Button/Button.js"; import ActionList_module_css_default from "./ActionList.module.css.js"; import { c } from "react-compiler-runtime"; import { clsx } from "clsx"; import { jsx } from "react/jsx-runtime"; import { forwardRef } from "react"; //#region src/ActionList/TrailingAction.tsx const TrailingAction = /*#__PURE__*/ forwardRef((t0, forwardedRef) => { const $ = c(25); let className; let icon; let label; let loading; let props; let style; let t1; let t2; let t3; if ($[0] !== t0) { ({as: t1, icon, label, href: t2, className, style, loading, tooltipDirection: t3, ...props} = t0); $[0] = t0; $[1] = className; $[2] = icon; $[3] = label; $[4] = loading; $[5] = props; $[6] = style; $[7] = t1; $[8] = t2; $[9] = t3; } else { className = $[1]; icon = $[2]; label = $[3]; loading = $[4]; props = $[5]; style = $[6]; t1 = $[7]; t2 = $[8]; t3 = $[9]; } const as = t1 === void 0 ? "button" : t1; const href = t2 === void 0 ? null : t2; const tooltipDirection = t3 === void 0 ? "w" : t3; let t4; if ($[10] !== className) { t4 = clsx(className, ActionList_module_css_default.TrailingAction); $[10] = className; $[11] = t4; } else t4 = $[11]; let t5; if ($[12] !== as || $[13] !== forwardedRef || $[14] !== href || $[15] !== icon || $[16] !== label || $[17] !== loading || $[18] !== props || $[19] !== tooltipDirection) { t5 = icon ? /*#__PURE__*/ jsx(IconButton, { as, "aria-label": label, icon, variant: "invisible", tooltipDirection, href, loading, "data-loading": Boolean(loading), ref: forwardedRef, className: ActionList_module_css_default.TrailingActionButton, ...props }) : /*#__PURE__*/ jsx(ButtonComponent, { variant: "invisible", as, href, loading, "data-loading": Boolean(loading), "data-has-label": "true", ref: forwardedRef, className: ActionList_module_css_default.TrailingActionButton, ...props, children: label }); $[12] = as; $[13] = forwardedRef; $[14] = href; $[15] = icon; $[16] = label; $[17] = loading; $[18] = props; $[19] = tooltipDirection; $[20] = t5; } else t5 = $[20]; let t6; if ($[21] !== style || $[22] !== t4 || $[23] !== t5) { t6 = /*#__PURE__*/ jsx("span", { className: t4, "data-component": "ActionList.TrailingAction", style, children: t5 }); $[21] = style; $[22] = t4; $[23] = t5; $[24] = t6; } else t6 = $[24]; return t6; }); TrailingAction.__SLOT__ = Symbol("ActionList.TrailingAction"); //#endregion export { TrailingAction };