@grafana/ui
Version:
Grafana Components Library
50 lines (45 loc) • 2.15 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var jsxRuntime = require('react/jsx-runtime');
var css = require('@emotion/css');
var i18n = require('@grafana/i18n');
var IconButton = require('../../IconButton/IconButton.cjs');
;
const expanderContainerStyles = css.css({
display: "flex",
alignItems: "center",
height: "100%"
});
function ExpanderCell({ row, __rowID }) {
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: expanderContainerStyles, children: /* @__PURE__ */ jsxRuntime.jsx(
IconButton.IconButton,
{
tooltip: i18n.t("grafana-ui.interactive-table.expand-row-tooltip", "Toggle row expanded"),
"aria-controls": row.isExpanded ? __rowID : void 0,
name: row.isExpanded ? "angle-down" : "angle-right",
"aria-expanded": row.isExpanded,
...row.getToggleRowExpandedProps(),
size: "lg"
}
) });
}
function EmptyExpanderHeader() {
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: /* @__PURE__ */ jsxRuntime.jsx(i18n.Trans, { i18nKey: "grafana-ui.interactive-table.expand-row-header", children: "Row expander" }) });
}
function ExpanderHeader({ isAllRowsExpanded, toggleAllRowsExpanded }) {
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: expanderContainerStyles, children: /* @__PURE__ */ jsxRuntime.jsx(
IconButton.IconButton,
{
"aria-label": !isAllRowsExpanded ? i18n.t("grafana-ui.interactive-table.aria-label-expand-all", "Expand all rows") : i18n.t("grafana-ui.interactive-table.aria-label-collapse-all", "Collapse all rows"),
name: !isAllRowsExpanded ? "table-expand-all" : "table-collapse-all",
onClick: () => toggleAllRowsExpanded(),
size: "lg",
tooltip: !isAllRowsExpanded ? i18n.t("grafana-ui.interactive-table.tooltip-expand-all", "Expand all rows") : i18n.t("grafana-ui.interactive-table.tooltip-collapse-all", "Collapse all rows"),
variant: "secondary"
}
) });
}
exports.EmptyExpanderHeader = EmptyExpanderHeader;
exports.ExpanderCell = ExpanderCell;
exports.ExpanderHeader = ExpanderHeader;
//# sourceMappingURL=index.cjs.map