UNPKG

@still-ui/button

Version:

Highly customizable and accessible Button component.

75 lines (72 loc) 2.22 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 src_exports = {}; __export(src_exports, { Button: () => Button_default }); module.exports = __toCommonJS(src_exports); // src/Button.tsx var import_tailwind_variants = require("tailwind-variants"); var import_jsx_runtime = require("react/jsx-runtime"); var button = (0, import_tailwind_variants.tv)({ base: "flex items-center gap-3 rounded bg-sky-600 px-5 py-3 font-bold text-white hover:shadow-lg", variants: { variant: { success: "bg-green-500 hover:shadow-lg", danger: "bg-red-500 hover:shadow-lg", outline: "border border-sky-500 bg-transparent text-sky-500 hover:shadow-lg", ghost: "bg-sky-100 text-sky-800 hover:shadow-lg" }, rounded: { true: "rounded-full" }, size: { sm: "px-4 py-2 text-sm font-medium", md: "", lg: "px-6 py-4 text-lg", xl: "px-7 py-5 text-xl" }, isLoading: { true: "opacity-80 cursor-not-allowed" } } }); var Button = ({ children, className, disabled, icon, isLoading, rounded, size = "md", variant, ...props }) => { return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { className: button({ variant, rounded, size, isLoading, class: className }), ...props, children: [ icon, children ] }); }; var Button_default = Button; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { Button });