UNPKG

@progress/kendo-react-charts

Version:

React Chart renders a wide range of high-quality data visualizations. KendoReact Charts package

88 lines (87 loc) 2.66 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import * as n from "react"; import e from "prop-types"; import { Breadcrumb as I } from "@progress/kendo-react-layout"; import { SvgIcon as v } from "@progress/kendo-react-common"; import { homeIcon as w } from "@progress/kendo-svg-icons"; import { DrilldownStateChangeEvent as y } from "./events/drilldown-state-change-event.mjs"; const s = n.forwardRef((t, m) => { const a = n.useRef(null), u = n.useRef(null), d = { valueField: i.valueField, textField: i.textField, iconField: i.iconField, iconClassField: i.iconClassField, ...t }; n.useImperativeHandle(a, () => ({ element: u.current, props: d })), n.useImperativeHandle(m, () => a.current); let l = [{ id: "0", ...t.rootItem || { text: "Home", icon: /* @__PURE__ */ n.createElement( v, { icon: w, style: { marginInlineEnd: "4px" } } ) } }]; t.drilldownState && (l = [ ...l, ...t.drilldownState.steps.map((o, r) => ({ id: (r + 1).toString(), text: o.drilldownValue })) ]); const b = { ...d, data: l }, p = (o) => { var c; const r = "onDrilldownStateChange"; if (t.hasOwnProperty(r)) { const f = l.findIndex((g) => g.id === o.id), F = { steps: (((c = t.drilldownState) == null ? void 0 : c.steps) || []).slice(0, f) }, S = new y({ currentState: t.drilldownState, nextState: F }); t[r].call(void 0, S); } }; return /* @__PURE__ */ n.createElement("div", null, /* @__PURE__ */ n.createElement(I, { ...b, onItemSelect: p })); }), x = { id: e.string, style: e.object, className: e.string, breadcrumbOrderedList: e.elementType, breadcrumbListItem: e.elementType, breadcrumbDelimiter: e.elementType, breadcrumbLink: e.elementType, dir: e.oneOf(["ltr", "rtl"]), disabled: e.bool, valueField: e.string, textField: e.string, iconField: e.string, iconClassField: e.string, onItemSelect: e.func, ariaLabel: e.string, onDrilldownStateChange: e.func, drilldownState: e.shape({ steps: e.array }), rootItem: e.object }, i = { valueField: "id", textField: "text", iconField: "icon", iconClassField: "iconClass", data: [] }; s.displayName = "KendoReactChartBreadcrumb"; s.propTypes = x; export { s as ChartBreadcrumb };