UNPKG

@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
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2026 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ "use client"; import * as t from "react"; import { GridContext as d } from "../../utils/GridContext.mjs"; import { IconWrap as f } from "@progress/kendo-react-common"; import { chevronDownIcon as h, chevronLeftIcon as p, chevronRightIcon as u } from "@progress/kendo-svg-icons"; import { useLocalization as g } from "@progress/kendo-react-intl"; import { groupCollapse as I, groupExpand as v, messages as x } from "../../messages/index.mjs"; import { GROUP_EXPAND_ACTION as E } from "@progress/kendo-react-data-tools"; const D = (o) => { const e = t.useContext(d), c = g(), n = o.expanded ? I : v, m = c.toLanguageString(n, x[n]), a = e.dir === "rtl", l = a ? "chevron-left" : "chevron-right", s = a ? p : u; return ( // eslint-disable-next-line jsx-a11y/anchor-is-valid /* @__PURE__ */ t.createElement( "a", { onClick: (r) => { var i; r.preventDefault(), e != null && e.itemChange && e.itemChange({ dataItem: o.dataItem, dataIndex: o.dataIndex, syntheticEvent: r, field: void 0, value: !o.expanded }), (i = e == null ? void 0 : e.dispatchGroupExpand) == null || i.call(e, { type: E.TOGGLE, group: o.group }); }, href: "#", tabIndex: -1, "aria-label": m }, /* @__PURE__ */ t.createElement( f, { name: o.expanded ? "chevron-down" : l, icon: o.expanded ? h : s } ) ) ); }; export { D as GridGroupCellToggle };