UNPKG

@vela-ui/react

Version:

Vela UI React components

113 lines (109 loc) 4.09 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/input.tsx var input_exports = {}; __export(input_exports, { Input: () => Input }); module.exports = __toCommonJS(input_exports); 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/input.tsx var import_jsx_runtime = require("react/jsx-runtime"); var inputVariants = (0, import_tailwind_variants2.tv)({ extend: focusRing, base: "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex w-full min-w-0 rounded-md border bg-transparent py-1 shadow-xs transition-[color,box-shadow] file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50", variants: { size: { xs: "h-8 px-2 text-xs", sm: "h-9 px-2.5 text-sm", md: "h-10 px-3 text-sm", lg: "h-11 px-4 text-base", xl: "h-12 px-4.5 text-base" }, hasStartContent: { true: "pl-10" }, hasEndContent: { true: "pr-10" }, isFocused: focusRing.variants.isFocusVisible }, defaultVariants: { size: "md" } }); function Input({ className, size, startContent, endContent, ...props }) { if (startContent || endContent) { return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "relative", children: [ startContent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-muted-foreground pointer-events-none absolute top-0 bottom-0 left-0 flex items-center px-3", children: startContent }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)( import_react_aria_components.Input, { "data-slot": "input", className: (0, import_react_aria_components.composeRenderProps)( className, (className2, renderProps) => inputVariants({ ...renderProps, size, hasStartContent: !!startContent, hasEndContent: !!endContent, className: className2 }) ), ...props } ), endContent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-muted-foreground pointer-events-none absolute top-0 right-0 bottom-0 flex items-center px-3", children: endContent }) ] }); } return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( import_react_aria_components.Input, { "data-slot": "input", className: (0, import_react_aria_components.composeRenderProps)( className, (className2, renderProps) => inputVariants({ ...renderProps, size, className: className2 }) ), ...props } ); } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { Input });