UNPKG

@vela-ui/react

Version:

Vela UI React components

138 lines (132 loc) 4.73 kB
"use strict"; "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/components/link.tsx var link_exports = {}; __export(link_exports, { Link: () => Link, LinkButton: () => LinkButton }); module.exports = __toCommonJS(link_exports); var import_react_aria_components2 = require("react-aria-components"); var import_tailwind_variants3 = require("tailwind-variants"); // src/components/button.tsx var import_react_aria_components = require("react-aria-components"); var import_tailwind_variants2 = require("tailwind-variants"); // src/lib/classes.ts var import_tailwind_variants = require("tailwind-variants"); var focusRing = (0, import_tailwind_variants.tv)({ base: "outline-hidden", variants: { isFocusVisible: { true: "border-ring ring-ring/50 ring-[3px]" }, isInvalid: { true: "ring-destructive/20 dark:ring-destructive/40 border-destructive" } } }); // src/components/button.tsx var import_jsx_runtime = require("react/jsx-runtime"); var buttonVariants = (0, import_tailwind_variants2.tv)({ extend: focusRing, base: "inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", variants: { variant: { default: "bg-primary text-primary-foreground hover:bg-primary/90 shadow-xs", destructive: "bg-destructive hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60 text-white shadow-xs", outline: "bg-background hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 border shadow-xs", secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 shadow-xs", ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50", link: "text-primary underline-offset-4 hover:underline" }, size: { xs: "h-8 gap-1 px-2.5 text-xs", sm: "h-9 px-3.5", md: "h-10 px-4 [&_svg:not([class*='size-'])]:size-5", lg: "h-11 gap-2.5 px-5 text-base [&_svg:not([class*='size-'])]:size-5", xl: "h-12 gap-2.5 px-5 text-base [&_svg:not([class*='size-'])]:size-5", icon: "size-10" }, isDisabled: { true: "pointer-events-none opacity-50" }, isPending: { true: "pointer-events-none opacity-50" } }, defaultVariants: { variant: "default", size: "md" } }); // src/components/link.tsx var import_jsx_runtime2 = require("react/jsx-runtime"); var linkVariants = (0, import_tailwind_variants3.tv)({ base: "underline-offset-4 outline-0 outline-offset-2 outline-current focus-visible:outline-2", variants: { variant: { hover: "hover:underline", underline: "underline", none: "no-underline" }, isDisabled: { true: "pointer-events-none cursor-default opacity-50" } }, defaultVariants: { variant: "hover" } }); function Link({ className, variant, ...props }) { return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( import_react_aria_components2.Link, { "data-slot": "link", className: (0, import_react_aria_components2.composeRenderProps)( className, (className2, renderProps) => linkVariants({ ...renderProps, variant, className: className2 }) ), ...props } ); } function LinkButton({ className, variant, size, ...props }) { return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( import_react_aria_components2.Link, { "data-slot": "link", className: (0, import_react_aria_components2.composeRenderProps)( className, (className2, renderProps) => buttonVariants({ ...renderProps, variant, size, className: className2 }) ), ...props } ); } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { Link, LinkButton });