@yamada-ui/close-button
Version:
Yamada UI close button component
87 lines (86 loc) • 2.89 kB
JavaScript
"use client"
;
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/close-button.tsx
var close_button_exports = {};
__export(close_button_exports, {
CloseButton: () => CloseButton
});
module.exports = __toCommonJS(close_button_exports);
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=close-button.js.map