@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
80 lines (76 loc) • 3.48 kB
JavaScript
"use client";
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
const require_children = require('../../utils/children.cjs');
const require_factory = require('../../core/system/factory.cjs');
const require_create_component = require('../../core/components/create-component.cjs');
const require_quote_icon = require('../icon/icons/quote-icon.cjs');
const require_blockquote_style = require('./blockquote.style.cjs');
let react = require("react");
react = require_rolldown_runtime.__toESM(react);
let react_jsx_runtime = require("react/jsx-runtime");
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
//#region src/components/blockquote/blockquote.tsx
const { ComponentContext, PropsContext: BlockquotePropsContext, useComponentContext, usePropsContext: useBlockquotePropsContext, withContext, withProvider } = require_create_component.createSlotComponent("blockquote", require_blockquote_style.blockquoteStyle);
/**
* `Blockquote` is a component that represents a blockquote. By default, it renders a `blockquote` element.
*
* @see https://yamada-ui.com/docs/components/blockquote
*/
const BlockquoteRoot = withProvider(({ children, cite, citeUrl, icon, withDash, captionProps, citeProps, contentProps,...rest }) => {
const validChildren = require_children.useValidChildren(children);
const customBlockquoteContent = require_children.useFindChild(validChildren, BlockquoteContent);
const customBlockquoteCaption = require_children.useFindChild(validChildren, BlockquoteCaption);
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContext, {
value: (0, react.useMemo)(() => ({
citeUrl,
withDash
}), [citeUrl, withDash]),
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_factory.styled.figure, {
...rest,
children: [
icon,
customBlockquoteContent ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BlockquoteContent, {
...contentProps,
children
}),
customBlockquoteCaption ?? (cite ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BlockquoteCaption, {
...captionProps,
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BlockquoteCite, {
...citeProps,
children: cite
})
}) : null)
]
})
});
}, "root")();
const BlockquoteContent = withContext("blockquote", "content")(void 0, ({ cite, citeUrl: citeUrlProp,...rest }) => {
const { citeUrl } = useComponentContext();
return {
...rest,
citeurl: cite ?? citeUrlProp ?? citeUrl
};
});
const BlockquoteCaption = withContext("figcaption", "caption")(void 0, ({ children, withDash: withDashProp,...rest }) => {
const { withDash } = useComponentContext();
withDashProp ??= withDash;
return {
...rest,
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
withDashProp ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: "—" }) : null,
" ",
children
] })
};
});
const BlockquoteCite = withContext("cite", "cite")();
const BlockquoteIcon = withContext(require_quote_icon.QuoteIcon, "icon")();
//#endregion
exports.BlockquoteCaption = BlockquoteCaption;
exports.BlockquoteCite = BlockquoteCite;
exports.BlockquoteContent = BlockquoteContent;
exports.BlockquoteIcon = BlockquoteIcon;
exports.BlockquotePropsContext = BlockquotePropsContext;
exports.BlockquoteRoot = BlockquoteRoot;
exports.useBlockquotePropsContext = useBlockquotePropsContext;
//# sourceMappingURL=blockquote.cjs.map