@schemavaults/ui 0.14.2 → 0.14.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import type { InputHTMLAttributes, ReactElement } from "react";
|
|
1
|
+
import type { InputHTMLAttributes, ReactElement, ReactNode } from "react";
|
|
2
|
+
import type { LucideIcon } from "lucide-react";
|
|
2
3
|
export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
4
|
+
icon?: LucideIcon;
|
|
5
|
+
rightButton?: ReactNode;
|
|
3
6
|
}
|
|
4
7
|
declare const Input: {
|
|
5
|
-
({ className, type, ...props }: InputProps): ReactElement;
|
|
8
|
+
({ className, type, icon: Icon, rightButton, ...props }: InputProps): ReactElement;
|
|
6
9
|
displayName: string;
|
|
7
10
|
};
|
|
8
11
|
export { Input };
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { cn } from "../../../lib/utils";
|
|
4
|
-
const Input = ({ className, type, ...props }) => {
|
|
5
|
-
|
|
4
|
+
const Input = ({ className, type, icon: Icon, rightButton, ...props }) => {
|
|
5
|
+
const hasAdornments = Icon || rightButton;
|
|
6
|
+
const inputElement = (_jsx("input", { type: type, className: cn("flex h-10 w-full text-sm bg-transparent placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50", hasAdornments
|
|
7
|
+
? cn(Icon ? "pl-9" : "pl-3", rightButton ? "pr-0" : "pr-3", "py-2")
|
|
8
|
+
: "rounded-md border border-input bg-background px-3 py-2 ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", className), ...props }));
|
|
9
|
+
if (!hasAdornments)
|
|
10
|
+
return inputElement;
|
|
11
|
+
return (_jsxs("div", { className: "relative flex items-center rounded-md border border-input bg-background ring-offset-background focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2", children: [Icon && (_jsx(Icon, { className: "absolute left-3 h-4 w-4 text-muted-foreground pointer-events-none" })), inputElement, rightButton] }));
|
|
6
12
|
};
|
|
7
13
|
Input.displayName = "Input";
|
|
8
14
|
export { Input };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../../src/components/ui/input/input.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../../src/components/ui/input/input.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAKb,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAOjC,MAAM,KAAK,GAAG,CAAC,EACb,SAAS,EACT,IAAI,EACJ,IAAI,EAAE,IAAI,EACV,WAAW,EACX,GAAG,KAAK,EACG,EAAgB,EAAE;IAC7B,MAAM,aAAa,GAAG,IAAI,IAAI,WAAW,CAAC;IAE1C,MAAM,YAAY,GAAG,CACnB,gBACE,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,EAAE,CACX,sJAAsJ,EACtJ,aAAa;YACX,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC;YACnE,CAAC,CAAC,wNAAwN,EAC5N,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC;IAEF,IAAI,CAAC,aAAa;QAAE,OAAO,YAAY,CAAC;IAExC,OAAO,CACL,eAAK,SAAS,EAAC,sKAAsK,aAClL,IAAI,IAAI,CACP,KAAC,IAAI,IAAC,SAAS,EAAC,mEAAmE,GAAG,CACvF,EACA,YAAY,EACZ,WAAW,IACR,CACP,CAAC;AACJ,CAAC,CAAC;AACF,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC;AAE5B,OAAO,EAAE,KAAK,EAAE,CAAC;AAEjB,eAAe,KAAK,CAAC"}
|