@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.39 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
*-------------------------------------------------------------------------------------------
*/
import * as t from "react";
import n from "prop-types";
import { dispatchEvent as l, useDir as o, getTabIndex as k, classNames as d } from "@progress/kendo-react-common";
const r = t.forwardRef((e, s) => {
const c = t.useRef(null), i = t.useRef(null), m = t.useCallback(() => {
i.current && i.current.focus();
}, [i]);
t.useImperativeHandle(c, () => ({
element: i.current,
focus: m,
props: e
})), t.useImperativeHandle(s, () => c.current);
const u = t.useCallback(
(a) => {
e.id && l(e.onItemSelect, a, a.target, {
id: e.id
});
},
[e.onItemSelect]
), b = t.useCallback(
(a) => {
e.id && l(e.onKeyDown, a, a.target, {
id: e.id
});
},
[e.onKeyDown]
);
return /* @__PURE__ */ t.createElement(
"a",
{
href: "#",
"aria-current": e.ariaCurrent ? e.ariaCurrent : e.isLast,
role: "link",
id: e.id,
ref: i,
style: e.style,
dir: o(i, e.dir),
tabIndex: k(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: (a) => {
a.preventDefault(), u(a);
},
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: n.string,
className: n.string,
tabIndex: n.number,
style: n.object,
dir: n.string,
disabled: n.bool,
text: n.string,
icon: n.node,
iconClass: n.string,
onClick: n.func,
ariaCurrent: n.bool
};
r.displayName = "KendoReactBreadcrumbLink";
r.propTypes = f;
export {
r as BreadcrumbLink
};