@carbon/react
Version:
React components for the Carbon Design System
45 lines (43 loc) • 1.7 kB
JavaScript
/**
* Copyright IBM Corp. 2016, 2026
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
const require_runtime = require("../../_virtual/_rolldown/runtime.js");
const require_deprecate = require("../../prop-types/deprecate.js");
let react = require("react");
react = require_runtime.__toESM(react);
let prop_types = require("prop-types");
prop_types = require_runtime.__toESM(prop_types);
let react_jsx_runtime = require("react/jsx-runtime");
//#region src/components/UIShell/Link.tsx
/**
* Copyright IBM Corp. 2016, 2026
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
const Link = (0, react.forwardRef)((props, ref) => {
const { element, as: BaseComponent, isSideNavExpanded: _isSideNavExpanded, ...rest } = props;
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BaseComponent ?? element ?? "a", {
ref,
...rest
});
});
/**
* Link is a custom component that allows us to supporting rendering elements
* other than `a` in our markup. The goal is to allow users to support passing
* in their own components to support use-cases like `react-router` or
* `@reach/router`
*/
const LinkPropTypes = {
as: prop_types.default.elementType,
element: require_deprecate.deprecate(prop_types.default.elementType, "The `element` prop for `Link` has been deprecated. Please use `as` instead. This will be removed in the next major release."),
isSideNavExpanded: prop_types.default.bool
};
Link.displayName = "Link";
Link.propTypes = LinkPropTypes;
//#endregion
exports.LinkPropTypes = LinkPropTypes;
exports.default = Link;