UNPKG

@progress/kendo-react-layout

Version:

React Layout components enable you to create a perceptive and intuitive layout of web projects. KendoReact Layout package

79 lines (78 loc) 2.43 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2026 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import * as t from "react"; import a from "prop-types"; import { dispatchEvent as l, classNames as d, getTabIndex as o, useDir as k } from "@progress/kendo-react-common"; const r = t.forwardRef((e, s) => { const c = t.useRef(null), n = t.useRef(null), m = t.useCallback(() => { n.current && n.current.focus(); }, [n]); t.useImperativeHandle(c, () => ({ element: n.current, focus: m, props: e })), t.useImperativeHandle(s, () => c.current); const u = t.useCallback( (i) => { e.id && l(e.onItemSelect, i, i.target, { id: e.id }); }, [e.onItemSelect] ), b = t.useCallback( (i) => { e.id && l(e.onKeyDown, i, i.target, { id: e.id }); }, [e.onKeyDown] ); return /* @__PURE__ */ t.createElement( "a", { href: "#", "aria-current": e.ariaCurrent || e.isLast ? "page" : void 0, "aria-disabled": e.disabled || e.isLast || void 0, id: e.id, ref: n, style: e.style, dir: k(n, e.dir), tabIndex: o(e.tabIndex, e.disabled), className: d(e.className, { "k-breadcrumb-root-link": e.isFirst, "k-breadcrumb-link": !e.isFirst, "k-breadcrumb-icontext-link": (e.icon !== void 0 || e.iconClass !== void 0) && e.text, "k-breadcrumb-icon-link": (e.icon !== void 0 || e.iconClass !== void 0) && !e.text, "k-disabled": e.disabled }), onClick: (i) => { i.preventDefault(), u(i); }, onKeyDown: b }, e.iconClass ? /* @__PURE__ */ t.createElement("span", { className: d("k-icon", e.iconClass) }) : e.icon ? e.icon : "", e.text && /* @__PURE__ */ t.createElement("span", { className: "k-breadcrumb-item-text" }, e.text) ); }), f = { id: a.string, className: a.string, tabIndex: a.number, style: a.object, dir: a.string, disabled: a.bool, text: a.string, icon: a.node, iconClass: a.string, onClick: a.func, ariaCurrent: a.bool }; r.displayName = "KendoReactBreadcrumbLink"; r.propTypes = f; export { r as BreadcrumbLink };