@bccampus/ui-components 0.5.9 → 0.6.0
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.
- package/dist/components/ui/input.d.ts +6 -2
- package/dist/components/ui/input.js +19 -13
- package/dist/components/ui/search-input.d.ts +2 -2
- package/dist/components/ui/search-input.js +3 -7
- package/package.json +1 -1
- package/src/components/ui/input.tsx +26 -9
- package/src/components/ui/search-input.tsx +3 -11
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { LucideProps } from 'lucide-react';
|
|
2
|
+
export interface InputProps extends React.ComponentProps<"input"> {
|
|
3
|
+
leftIcon?: React.JSXElementConstructor<LucideProps>;
|
|
4
|
+
rightIcon?: React.JSXElementConstructor<LucideProps>;
|
|
5
|
+
}
|
|
6
|
+
declare function Input({ className, leftIcon, rightIcon, ...props }: InputProps): import("react").JSX.Element;
|
|
3
7
|
export { Input };
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { c as cn } from "../../_chunks/utils.js";
|
|
3
|
-
function Input({ className, ...props }) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
function Input({ className, leftIcon, rightIcon, ...props }) {
|
|
4
|
+
const LeftComp = leftIcon ? leftIcon : null;
|
|
5
|
+
const RightComp = rightIcon ? rightIcon : null;
|
|
6
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("relative", className), children: [
|
|
7
|
+
LeftComp && /* @__PURE__ */ jsx(LeftComp, { className: "absolute size-4 top-1/2 left-2 -translate-y-1/2 pointer-events-none text-primary" }),
|
|
8
|
+
/* @__PURE__ */ jsx(
|
|
9
|
+
"input",
|
|
10
|
+
{
|
|
11
|
+
className: cn(
|
|
12
|
+
"w-full p-2 rounded-sm outline-none focus-visible:border-ring focus-visible:ring-ring focus-visible:ring-2",
|
|
13
|
+
"text-brand-1 placeholder:text-brand-1 bg-complement-1-50 dark:text-foreground dark:placeholder:text-white dark:bg-brand-1",
|
|
14
|
+
{ "pl-8": LeftComp, "pr-8": RightComp }
|
|
15
|
+
),
|
|
16
|
+
...props
|
|
17
|
+
}
|
|
18
|
+
),
|
|
19
|
+
RightComp && /* @__PURE__ */ jsx(RightComp, { className: "absolute size-4 top-1/2 right-3 -translate-y-1/2 pointer-events-none text-primary" })
|
|
20
|
+
] });
|
|
15
21
|
}
|
|
16
22
|
export {
|
|
17
23
|
Input
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare function SearchInput({
|
|
1
|
+
import { InputProps } from './input';
|
|
2
|
+
declare function SearchInput({ ...props }: InputProps): import("react").JSX.Element;
|
|
3
3
|
export { SearchInput };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as cn } from "../../_chunks/utils.js";
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
2
|
import { Input } from "./input.js";
|
|
4
3
|
import { c as createLucideIcon } from "../../_chunks/createLucideIcon.js";
|
|
5
4
|
const __iconNode = [
|
|
@@ -7,11 +6,8 @@ const __iconNode = [
|
|
|
7
6
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
8
7
|
];
|
|
9
8
|
const Search = createLucideIcon("search", __iconNode);
|
|
10
|
-
function SearchInput({
|
|
11
|
-
return /* @__PURE__ */
|
|
12
|
-
/* @__PURE__ */ jsx(Input, { ...props }),
|
|
13
|
-
/* @__PURE__ */ jsx(Search, { className: "absolute size-4 top-1/2 right-3 -translate-y-1/2 pointer-events-none text-primary" })
|
|
14
|
-
] });
|
|
9
|
+
function SearchInput({ ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx(Input, { rightIcon: Search, ...props });
|
|
15
11
|
}
|
|
16
12
|
export {
|
|
17
13
|
SearchInput
|
package/package.json
CHANGED
|
@@ -1,16 +1,33 @@
|
|
|
1
1
|
import { cn } from "@/lib/utils";
|
|
2
|
-
|
|
2
|
+
import type { LucideProps } from "lucide-react";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
export interface InputProps extends React.ComponentProps<"input"> {
|
|
5
|
+
leftIcon?: React.JSXElementConstructor<LucideProps>;
|
|
6
|
+
rightIcon?: React.JSXElementConstructor<LucideProps>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function Input({ className, leftIcon, rightIcon, ...props }: InputProps) {
|
|
10
|
+
const LeftComp = leftIcon ? leftIcon : null;
|
|
11
|
+
const RightComp = rightIcon ? rightIcon : null;
|
|
5
12
|
return (
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
|
|
13
|
+
<div className={cn("relative", className)}>
|
|
14
|
+
{LeftComp && (
|
|
15
|
+
<LeftComp className="absolute size-4 top-1/2 left-2 -translate-y-1/2 pointer-events-none text-primary" />
|
|
16
|
+
)}
|
|
17
|
+
|
|
18
|
+
<input
|
|
19
|
+
className={cn(
|
|
20
|
+
"w-full p-2 rounded-sm outline-none focus-visible:border-ring focus-visible:ring-ring focus-visible:ring-2",
|
|
21
|
+
"text-brand-1 placeholder:text-brand-1 bg-complement-1-50 dark:text-foreground dark:placeholder:text-white dark:bg-brand-1",
|
|
22
|
+
{ "pl-8": LeftComp, "pr-8": RightComp },
|
|
23
|
+
)}
|
|
24
|
+
{...props}
|
|
25
|
+
/>
|
|
26
|
+
|
|
27
|
+
{RightComp && (
|
|
28
|
+
<RightComp className="absolute size-4 top-1/2 right-3 -translate-y-1/2 pointer-events-none text-primary" />
|
|
10
29
|
)}
|
|
11
|
-
|
|
12
|
-
{...props}
|
|
13
|
-
/>
|
|
30
|
+
</div>
|
|
14
31
|
);
|
|
15
32
|
}
|
|
16
33
|
|
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
import { cn } from "@/lib/utils";
|
|
2
1
|
import { Search } from "lucide-react";
|
|
3
|
-
import { Input } from "./input";
|
|
2
|
+
import { Input, type InputProps } from "./input";
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function SearchInput({ className, ...props }: SearchInputProps) {
|
|
8
|
-
return (
|
|
9
|
-
<div className={cn("relative", className)}>
|
|
10
|
-
<Input {...props} />
|
|
11
|
-
<Search className="absolute size-4 top-1/2 right-3 -translate-y-1/2 pointer-events-none text-primary" />
|
|
12
|
-
</div>
|
|
13
|
-
);
|
|
4
|
+
function SearchInput({ ...props }: InputProps) {
|
|
5
|
+
return <Input rightIcon={Search} {...props} />;
|
|
14
6
|
}
|
|
15
7
|
|
|
16
8
|
export { SearchInput };
|