@progress/kendo-react-grid
Version:
React Data Grid (Table) provides 100+ ready-to-use data grid features. KendoReact Grid package
53 lines (52 loc) • 1.94 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
"use client";
import * as a from "react";
import { GridContext as m } from "../../utils/GridContext.mjs";
import { IconWrap as d } from "@progress/kendo-react-common";
import { caretAltDownIcon as s, caretAltLeftIcon as f, caretAltRightIcon as p } from "@progress/kendo-svg-icons";
import { useLocalization as u } from "@progress/kendo-react-intl";
import { groupCollapse as g, groupExpand as I, messages as h } from "../../messages/index.mjs";
import { GROUP_EXPAND_ACTION as x } from "@progress/kendo-react-data-tools";
const b = (t) => {
const e = a.useContext(m), l = u(), o = t.expanded ? g : I, i = l.toLanguageString(o, h[o]), n = e.dir === "rtl";
return (
// eslint-disable-next-line jsx-a11y/anchor-is-valid
/* @__PURE__ */ a.createElement(
"a",
{
onClick: (r) => {
var c;
r.preventDefault(), e != null && e.itemChange && e.itemChange({
dataItem: t.dataItem,
dataIndex: t.dataIndex,
syntheticEvent: r,
field: void 0,
value: !t.expanded
}), (c = e == null ? void 0 : e.dispatchGroupExpand) == null || c.call(e, {
type: x.TOGGLE,
group: t.group
});
},
href: "#",
tabIndex: -1,
"aria-label": i
},
/* @__PURE__ */ a.createElement(
d,
{
name: t.expanded ? "caret-alt-down" : n ? "caret-alt-left" : "caret-alt-right",
icon: t.expanded ? s : n ? f : p
}
)
)
);
};
export {
b as GridGroupCellToggle
};