@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
44 lines (40 loc) • 1.58 kB
JavaScript
"use client";
import { utils_exports } from "../../utils/index.js";
import { styled } from "../../core/system/factory.js";
import { radiusProperties } from "../../core/css/styles.js";
import { useExtractProps } from "../../core/components/props.js";
import { createSlotComponent } from "../../core/components/create-component.js";
import { linkBoxStyle } from "./link-box.style.js";
import { jsx } from "react/jsx-runtime";
//#region src/components/link-box/link-box.tsx
const { ComponentContext, PropsContext: LinkBoxPropsContext, useComponentContext, usePropsContext: useLinkBoxPropsContext, withContext, withProvider } = createSlotComponent("link-box", linkBoxStyle);
/**
* `LinkBox` is a component that allows elements such as articles or cards to function as a single link.
*
* @see https://yamada-ui.com/docs/components/link-box
*/
const LinkBoxRoot = withProvider(({ children,...rest }) => {
return /* @__PURE__ */ jsx(ComponentContext, {
value: useExtractProps(rest, radiusProperties),
children: /* @__PURE__ */ jsx(styled.div, {
...rest,
children
})
});
}, "root")();
const LinkBoxOverlay = withContext("a", "overlay")(void 0, ({ external, _before,...rest }) => {
const context = useComponentContext();
return {
rel: external ? "noopener" : void 0,
target: external ? "_blank" : void 0,
"data-link-box-overlay": (0, utils_exports.dataAttr)(true),
_before: {
..._before,
...context
},
...rest
};
});
//#endregion
export { LinkBoxOverlay, LinkBoxPropsContext, LinkBoxRoot, useLinkBoxPropsContext };
//# sourceMappingURL=link-box.js.map