@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.
@@ -1,3 +1,7 @@
1
- export type InputProps = React.ComponentProps<"input">;
2
- declare function Input({ className, ...props }: InputProps): import("react").JSX.Element;
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
- return /* @__PURE__ */ jsx(
5
- "input",
6
- {
7
- className: cn(
8
- "w-full p-2 pr-8 text-brand-1 placeholder:text-brand-1 rounded-sm bg-complement-1-50 outline-none focus-visible:border-ring focus-visible:ring-ring focus-visible:ring-2",
9
- className
10
- ),
11
- name: "search",
12
- ...props
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
- export type SearchInputProps = React.ComponentProps<"input">;
2
- declare function SearchInput({ className, ...props }: SearchInputProps): import("react").JSX.Element;
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 { jsxs, jsx } from "react/jsx-runtime";
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({ className, ...props }) {
11
- return /* @__PURE__ */ jsxs("div", { className: cn("relative", className), children: [
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@bccampus/ui-components",
3
- "version": "0.5.9",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "packageManager": "yarn@4.10.3",
6
6
  "exports": {
@@ -1,16 +1,33 @@
1
1
  import { cn } from "@/lib/utils";
2
- export type InputProps = React.ComponentProps<"input">;
2
+ import type { LucideProps } from "lucide-react";
3
3
 
4
- function Input({ className, ...props }: InputProps) {
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
- <input
7
- className={cn(
8
- "w-full p-2 pr-8 text-brand-1 placeholder:text-brand-1 rounded-sm bg-complement-1-50 outline-none focus-visible:border-ring focus-visible:ring-ring focus-visible:ring-2",
9
- className
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
- name="search"
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
- export type SearchInputProps = React.ComponentProps<"input">;
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 };