UNPKG

@ducor/react

Version:

admin template ui interface

56 lines (55 loc) 3.38 kB
var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { forwardRef } from "react"; import { twMerge } from "tailwind-merge"; var baseStyles = "font-semibold py-2 rounded focus:outline-none transition duration-200 ease-in-out whitespace-nowrap"; var sizeStyles = { xs: "px-1 text-xs", sm: "px-3 text-xs", md: "px-4 text-sm", lg: "px-6 text-base w-full", }; var Button = forwardRef(function (_a, ref) { var _b = _a.variant, variant = _b === void 0 ? "primary" : _b, _c = _a.size, size = _c === void 0 ? "md" : _c, children = _a.children, onClick = _a.onClick, disabled = _a.disabled, _d = _a.type, type = _d === void 0 ? "button" : _d, className = _a.className, title = _a.title, props = __rest(_a, ["variant", "size", "children", "onClick", "disabled", "type", "className", "title"]); var variantStyles = { primary: "bg-indigo-600 text-white hover:bg-indigo-700", secondary: "bg-gray-300 text-black hover:bg-gray-400", success: "bg-green-600 text-white hover:bg-green-700", danger: "bg-red-600 text-white hover:bg-red-700", warning: "bg-orange-500 text-white hover:bg-orange-600", black: "bg-black text-white border border-black hover:bg-white hover:text-black ", transparent: "rounded-full hover:bg-black hover:bg-opacity-10 text-gray-500 hover:text-gray-600", notification: "relative rounded-full bg-gray-800 text-gray-400 hover:text-white", submit: "bg-blue-500 hover:bg-blue-700 text-white font-bold rounded", info: "bg-blue-400 text-white hover:bg-blue-500", gray: "flex items-center border bg-gray-300 hover:bg-gray-200 rounded-md justify-center text-sm ", }; return (_jsx("button", __assign({ className: twMerge(baseStyles, variantStyles[variant], sizeStyles[size], disabled ? "opacity-50 cursor-not-allowed" : "", className ? className : ""), onClick: onClick, ref: ref, disabled: disabled ? true : false, type: type, title: title }, props, { children: children }))); }); export var BtnClose = function (_a) { var onClose = _a.onClose, className = _a.className, _b = _a.title, title = _b === void 0 ? "Close panel" : _b; return (_jsxs("button", { onClick: onClose, className: twMerge("rounded-md block bg-white text-gray-400 hover:text-gray-500 ", className), children: [_jsx("span", { className: 'sr-only', children: title }), _jsx("i", { className: 'feather-x block size-5 mt-1' })] })); }; Button.displayName = "Button"; export default Button;