UNPKG

@yamada-ui/close-button

Version:

Yamada UI close button component

89 lines (87 loc) 2.88 kB
"use client" "use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/index.ts var index_exports = {}; __export(index_exports, { CloseButton: () => CloseButton }); module.exports = __toCommonJS(index_exports); // src/close-button.tsx var import_core = require("@yamada-ui/core"); var import_icon = require("@yamada-ui/icon"); var import_ripple = require("@yamada-ui/ripple"); var import_utils = require("@yamada-ui/utils"); var import_jsx_runtime = require("react/jsx-runtime"); var CloseButton = (0, import_core.forwardRef)( (props, ref) => { const [styles, mergedProps] = (0, import_core.useComponentStyle)("CloseButton", props); const { className, children, isDisabled, disabled = isDisabled, disableRipple, isRounded, fullRounded = isRounded, __css, ...rest } = (0, import_core.omitThemeProps)(mergedProps); const { onPointerDown, ...rippleProps } = (0, import_ripple.useRipple)({ ...rest, disabled: disableRipple || disabled }); const css = { alignItems: "center", display: "flex", flexShrink: 0, justifyContent: "center", outline: 0, overflow: "hidden", position: "relative", ...styles, ...__css, ...fullRounded ? { borderRadius: "fallback(full, 9999px)" } : {} }; return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)( import_core.ui.button, { ref, type: "button", className: (0, import_utils.cx)("ui-close-button", className), "aria-label": "Close", disabled, __css: css, ...rest, onPointerDown, children: [ children || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.CloseIcon, { height: "1em", width: "1em" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ripple.Ripple, { ...rippleProps }) ] } ); } ); CloseButton.displayName = "CloseButton"; CloseButton.__ui__ = "CloseButton"; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { CloseButton }); //# sourceMappingURL=index.js.map