@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
29 lines (25 loc) • 1.13 kB
JavaScript
"use client";
import { createComponent } from "../../core/components/create-component.js";
import { XIcon } from "../icon/icons/x-icon.js";
import { useI18n } from "../../providers/i18n-provider/i18n-provider.js";
import { IconButton } from "../button/icon-button.js";
import { closeButtonStyle } from "./close-button.style.js";
import { jsx } from "react/jsx-runtime";
//#region src/components/close-button/close-button.tsx
const { PropsContext: CloseButtonPropsContext, usePropsContext: useCloseButtonPropsContext, withContext } = createComponent("close-button", closeButtonStyle);
/**
* `CloseButton` is a component used primarily to trigger the close functionality of a component.
*
* @see https://yamada-ui.com/docs/components/close-button
*/
const CloseButton = withContext(IconButton)(void 0, ({ children, icon,...rest }) => {
const { t } = useI18n("closeButton");
return {
"aria-label": t("Close"),
children: children || icon || /* @__PURE__ */ jsx(XIcon, {}),
...rest
};
});
//#endregion
export { CloseButton, CloseButtonPropsContext, useCloseButtonPropsContext };
//# sourceMappingURL=close-button.js.map