gd-ui-library 1.0.0 → 1.0.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.
- package/dist/index.d.mts +27 -0
- package/dist/index.d.ts +14 -2
- package/dist/index.js +152 -77
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +144 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +13 -4
- package/dist/index.cjs +0 -122
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -15
- package/rollup.config.js +0 -29
- package/src/components/Button/Button.tsx +0 -70
- package/src/components/Input/Input.tsx +0 -117
- package/src/index.ts +0 -1
- package/src/lib/utils.ts +0 -5
- package/src/utils/cn.ts +0 -5
- package/tsconfig.json +0 -16
- package/tsup.config.ts +0 -10
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'size'> {
|
|
4
|
+
label?: string;
|
|
5
|
+
error?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
leftIcon?: React.ReactNode;
|
|
9
|
+
rightIcon?: React.ReactNode;
|
|
10
|
+
size?: 'sm' | 'md' | 'lg';
|
|
11
|
+
variant?: 'default' | 'filled' | 'unstyled';
|
|
12
|
+
}
|
|
13
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
14
|
+
|
|
15
|
+
interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> {
|
|
16
|
+
label?: string;
|
|
17
|
+
error?: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
required?: boolean;
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
leftIcon?: React.ReactNode;
|
|
22
|
+
rightIcon?: React.ReactNode;
|
|
23
|
+
size?: "sm" | "md" | "lg";
|
|
24
|
+
}
|
|
25
|
+
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
26
|
+
|
|
27
|
+
export { Button, Input };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
interface
|
|
3
|
+
interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'size'> {
|
|
4
4
|
label?: string;
|
|
5
5
|
error?: string;
|
|
6
6
|
description?: string;
|
|
@@ -10,6 +10,18 @@ interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, '
|
|
|
10
10
|
size?: 'sm' | 'md' | 'lg';
|
|
11
11
|
variant?: 'default' | 'filled' | 'unstyled';
|
|
12
12
|
}
|
|
13
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
14
|
+
|
|
15
|
+
interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> {
|
|
16
|
+
label?: string;
|
|
17
|
+
error?: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
required?: boolean;
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
leftIcon?: React.ReactNode;
|
|
22
|
+
rightIcon?: React.ReactNode;
|
|
23
|
+
size?: "sm" | "md" | "lg";
|
|
24
|
+
}
|
|
13
25
|
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
14
26
|
|
|
15
|
-
export {
|
|
27
|
+
export { Button, Input };
|
package/dist/index.js
CHANGED
|
@@ -1,96 +1,171 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/index.ts
|
|
20
|
+
var index_exports = {};
|
|
21
|
+
__export(index_exports, {
|
|
22
|
+
Button: () => Button,
|
|
23
|
+
Input: () => Input
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(index_exports);
|
|
26
|
+
|
|
27
|
+
// src/components/Button/Button.tsx
|
|
28
|
+
var import_react = require("react");
|
|
3
29
|
|
|
4
30
|
// src/utils/cn.ts
|
|
5
|
-
|
|
31
|
+
var import_clsx = require("clsx");
|
|
6
32
|
function cn(...inputs) {
|
|
7
|
-
return clsx(inputs);
|
|
33
|
+
return (0, import_clsx.clsx)(inputs);
|
|
8
34
|
}
|
|
9
35
|
|
|
10
|
-
// src/components/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const disabledClasses = disabled ? "bg-gray-100 cursor-not-allowed opacity-60" : "";
|
|
40
|
-
return /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
41
|
-
label && /* @__PURE__ */ jsxs(
|
|
42
|
-
"label",
|
|
36
|
+
// src/components/Button/Button.tsx
|
|
37
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
|
+
var Button = (0, import_react.forwardRef)(
|
|
39
|
+
({
|
|
40
|
+
className,
|
|
41
|
+
label,
|
|
42
|
+
error,
|
|
43
|
+
description,
|
|
44
|
+
required,
|
|
45
|
+
leftIcon,
|
|
46
|
+
rightIcon,
|
|
47
|
+
size = "md",
|
|
48
|
+
variant = "default",
|
|
49
|
+
children,
|
|
50
|
+
...props
|
|
51
|
+
}, ref) => {
|
|
52
|
+
const baseStyles = "inline-flex items-center justify-center font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none";
|
|
53
|
+
const sizeStyles = {
|
|
54
|
+
sm: "px-3 py-1.5 text-sm rounded-md",
|
|
55
|
+
md: "px-4 py-2 text-sm rounded-md",
|
|
56
|
+
lg: "px-6 py-3 text-base rounded-lg"
|
|
57
|
+
};
|
|
58
|
+
const variantStyles = {
|
|
59
|
+
default: "bg-white text-gray-900 border border-gray-300 hover:bg-gray-50 focus:ring-blue-500",
|
|
60
|
+
filled: "bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500",
|
|
61
|
+
unstyled: ""
|
|
62
|
+
};
|
|
63
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
64
|
+
"button",
|
|
43
65
|
{
|
|
44
|
-
|
|
66
|
+
ref,
|
|
45
67
|
className: cn(
|
|
46
|
-
|
|
47
|
-
|
|
68
|
+
baseStyles,
|
|
69
|
+
sizeStyles[size],
|
|
70
|
+
variantStyles[variant],
|
|
71
|
+
error && "border-red-500 focus:ring-red-500",
|
|
72
|
+
className
|
|
48
73
|
),
|
|
74
|
+
"aria-invalid": !!error,
|
|
75
|
+
"aria-describedby": description ? `${props.id}-description` : void 0,
|
|
76
|
+
...props,
|
|
49
77
|
children: [
|
|
50
|
-
|
|
51
|
-
|
|
78
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "mr-2", children: leftIcon }),
|
|
79
|
+
label || children,
|
|
80
|
+
rightIcon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "ml-2", children: rightIcon }),
|
|
81
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "ml-1 text-red-500", children: "*" }),
|
|
82
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only", children: error })
|
|
52
83
|
]
|
|
53
84
|
}
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
Button.displayName = "Button";
|
|
89
|
+
|
|
90
|
+
// src/components/Input/Input.tsx
|
|
91
|
+
var import_react2 = require("react");
|
|
92
|
+
var import_lucide_react = require("lucide-react");
|
|
93
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
94
|
+
var Input = (0, import_react2.forwardRef)(
|
|
95
|
+
({
|
|
96
|
+
label,
|
|
97
|
+
error,
|
|
98
|
+
description,
|
|
99
|
+
required,
|
|
100
|
+
placeholder,
|
|
101
|
+
leftIcon,
|
|
102
|
+
rightIcon,
|
|
103
|
+
size = "md",
|
|
104
|
+
className,
|
|
105
|
+
disabled,
|
|
106
|
+
id,
|
|
107
|
+
...props
|
|
108
|
+
}, ref) => {
|
|
109
|
+
const inputId = id || `input-${Math.random().toString(36).slice(2, 9)}`;
|
|
110
|
+
const sizeClasses = {
|
|
111
|
+
sm: "h-9 text-sm px-3",
|
|
112
|
+
md: "h-10 text-sm px-3.5",
|
|
113
|
+
lg: "h-12 text-base px-4"
|
|
114
|
+
}[size];
|
|
115
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "w-full space-y-1.5", children: [
|
|
116
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
117
|
+
"label",
|
|
63
118
|
{
|
|
64
|
-
|
|
65
|
-
id: inputId,
|
|
66
|
-
disabled,
|
|
67
|
-
"aria-invalid": !!error,
|
|
119
|
+
htmlFor: inputId,
|
|
68
120
|
className: cn(
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
variantClasses,
|
|
72
|
-
errorClasses,
|
|
73
|
-
disabledClasses,
|
|
74
|
-
leftIcon && "pl-10",
|
|
75
|
-
rightIcon && "pr-10",
|
|
76
|
-
className
|
|
121
|
+
"text-sm font-medium",
|
|
122
|
+
disabled ? "text-gray-400" : "text-gray-700"
|
|
77
123
|
),
|
|
78
|
-
|
|
124
|
+
children: [
|
|
125
|
+
label,
|
|
126
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "text-red-500 ml-1", children: "*" })
|
|
127
|
+
]
|
|
79
128
|
}
|
|
80
129
|
),
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
130
|
+
description && !error && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "text-xs text-gray-500", children: description }),
|
|
131
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "relative", children: [
|
|
132
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "absolute left-3 top-1/2 -translate-y-1/2 text-gray-400", children: leftIcon }),
|
|
133
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
134
|
+
"input",
|
|
135
|
+
{
|
|
136
|
+
ref,
|
|
137
|
+
id: inputId,
|
|
138
|
+
placeholder,
|
|
139
|
+
disabled,
|
|
140
|
+
"aria-invalid": !!error,
|
|
141
|
+
className: cn(
|
|
142
|
+
"w-full rounded-lg border border-gray-300 bg-white",
|
|
143
|
+
"transition-all duration-150 outline-none",
|
|
144
|
+
"placeholder:text-gray-400 placeholder:text-sm",
|
|
145
|
+
"focus:border-blue-500 focus:ring-2 focus:ring-blue-100",
|
|
146
|
+
"disabled:bg-gray-100 disabled:text-gray-400 disabled:cursor-not-allowed",
|
|
147
|
+
error && "border-red-500 focus:border-red-500 focus:ring-red-100",
|
|
148
|
+
leftIcon && "pl-10",
|
|
149
|
+
rightIcon && "pr-10",
|
|
150
|
+
sizeClasses,
|
|
151
|
+
className
|
|
152
|
+
),
|
|
153
|
+
...props
|
|
154
|
+
}
|
|
155
|
+
),
|
|
156
|
+
rightIcon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "absolute right-3 top-1/2 -translate-y-1/2 text-gray-400", children: rightIcon })
|
|
157
|
+
] }),
|
|
158
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: "flex items-center gap-1 text-xs text-red-500", children: [
|
|
159
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react.AlertCircle, { className: "w-3.5 h-3.5" }),
|
|
160
|
+
error
|
|
161
|
+
] })
|
|
162
|
+
] });
|
|
163
|
+
}
|
|
164
|
+
);
|
|
92
165
|
Input.displayName = "Input";
|
|
93
|
-
export
|
|
166
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
167
|
+
0 && (module.exports = {
|
|
168
|
+
Button,
|
|
94
169
|
Input
|
|
95
|
-
};
|
|
170
|
+
});
|
|
96
171
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/components/Button/Button.tsx","../src/utils/cn.ts","../src/components/Input/Input.tsx"],"sourcesContent":["export { Button } from \"./components/Button/Button\";\r\nexport { Input } from \"./components/Input/Input\";","import React, { ButtonHTMLAttributes, forwardRef } from \"react\";\r\nimport { cn } from \"../../utils/cn\";\r\n\r\nexport interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'size'> {\r\n label?: string;\r\n error?: string;\r\n description?: string;\r\n required?: boolean;\r\n leftIcon?: React.ReactNode;\r\n rightIcon?: React.ReactNode;\r\n size?: 'sm' | 'md' | 'lg';\r\n variant?: 'default' | 'filled' | 'unstyled';\r\n}\r\n\r\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\r\n ({ \r\n className,\r\n label,\r\n error,\r\n description,\r\n required,\r\n leftIcon,\r\n rightIcon,\r\n size = 'md',\r\n variant = 'default',\r\n children,\r\n ...props \r\n }, ref) => {\r\n // Base styles\r\n const baseStyles = \"inline-flex items-center justify-center font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none\";\r\n \r\n // Size variants\r\n const sizeStyles = {\r\n sm: \"px-3 py-1.5 text-sm rounded-md\",\r\n md: \"px-4 py-2 text-sm rounded-md\",\r\n lg: \"px-6 py-3 text-base rounded-lg\"\r\n };\r\n \r\n // Style variants\r\n const variantStyles = {\r\n default: \"bg-white text-gray-900 border border-gray-300 hover:bg-gray-50 focus:ring-blue-500\",\r\n filled: \"bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500\",\r\n unstyled: \"\"\r\n };\r\n \r\n return (\r\n <button\r\n ref={ref}\r\n className={cn(\r\n baseStyles,\r\n sizeStyles[size],\r\n variantStyles[variant],\r\n error && \"border-red-500 focus:ring-red-500\",\r\n className\r\n )}\r\n aria-invalid={!!error}\r\n aria-describedby={description ? `${props.id}-description` : undefined}\r\n {...props}\r\n >\r\n {leftIcon && <span className=\"mr-2\">{leftIcon}</span>}\r\n {label || children}\r\n {rightIcon && <span className=\"ml-2\">{rightIcon}</span>}\r\n {required && <span className=\"ml-1 text-red-500\">*</span>}\r\n {error && <span className=\"sr-only\">{error}</span>}\r\n </button>\r\n );\r\n }\r\n);\r\n\r\nButton.displayName = \"Button\";","import { clsx, type ClassValue } from \"clsx\"\r\n\r\nexport function cn(...inputs: ClassValue[]) {\r\n return clsx(inputs)\r\n}\r\n","import React, { forwardRef } from \"react\";\r\nimport { cn } from \"../../utils/cn\";\r\nimport { AlertCircle } from \"lucide-react\";\r\n\r\nexport interface InputProps\r\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, \"size\"> {\r\n label?: string;\r\n error?: string;\r\n description?: string;\r\n required?: boolean;\r\n placeholder?: string;\r\n leftIcon?: React.ReactNode;\r\n rightIcon?: React.ReactNode;\r\n size?: \"sm\" | \"md\" | \"lg\";\r\n}\r\n\r\nexport const Input = forwardRef<HTMLInputElement, InputProps>(\r\n (\r\n {\r\n label,\r\n error,\r\n description,\r\n required,\r\n placeholder,\r\n leftIcon,\r\n rightIcon,\r\n size = \"md\",\r\n className,\r\n disabled,\r\n id,\r\n ...props\r\n },\r\n ref\r\n ) => {\r\n const inputId = id || `input-${Math.random().toString(36).slice(2, 9)}`;\r\n\r\n const sizeClasses = {\r\n sm: \"h-9 text-sm px-3\",\r\n md: \"h-10 text-sm px-3.5\",\r\n lg: \"h-12 text-base px-4\",\r\n }[size];\r\n\r\n return (\r\n <div className=\"w-full space-y-1.5\">\r\n {/* Label */}\r\n {label && (\r\n <label\r\n htmlFor={inputId}\r\n className={cn(\r\n \"text-sm font-medium\",\r\n disabled ? \"text-gray-400\" : \"text-gray-700\"\r\n )}\r\n >\r\n {label}\r\n {required && <span className=\"text-red-500 ml-1\">*</span>}\r\n </label>\r\n )}\r\n\r\n {/* Description */}\r\n {description && !error && (\r\n <p className=\"text-xs text-gray-500\">{description}</p>\r\n )}\r\n\r\n {/* Input wrapper */}\r\n <div className=\"relative\">\r\n {/* Left Icon */}\r\n {leftIcon && (\r\n <span className=\"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400\">\r\n {leftIcon}\r\n </span>\r\n )}\r\n\r\n {/* Input */}\r\n <input\r\n ref={ref}\r\n id={inputId}\r\n placeholder={placeholder}\r\n disabled={disabled}\r\n aria-invalid={!!error}\r\n className={cn(\r\n \"w-full rounded-lg border border-gray-300 bg-white\",\r\n \"transition-all duration-150 outline-none\",\r\n \"placeholder:text-gray-400 placeholder:text-sm\",\r\n \"focus:border-blue-500 focus:ring-2 focus:ring-blue-100\",\r\n \"disabled:bg-gray-100 disabled:text-gray-400 disabled:cursor-not-allowed\",\r\n error && \"border-red-500 focus:border-red-500 focus:ring-red-100\",\r\n leftIcon && \"pl-10\",\r\n rightIcon && \"pr-10\",\r\n sizeClasses,\r\n className\r\n )}\r\n {...props}\r\n />\r\n\r\n {/* Right Icon */}\r\n {rightIcon && (\r\n <span className=\"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400\">\r\n {rightIcon}\r\n </span>\r\n )}\r\n </div>\r\n \r\n {error && (\r\n <p className=\"flex items-center gap-1 text-xs text-red-500\">\r\n <AlertCircle className=\"w-3.5 h-3.5\" />\r\n {error}\r\n </p>\r\n )}\r\n </div>\r\n );\r\n }\r\n);\r\n\r\nInput.displayName = \"Input\";"],"mappings":"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","names":["import_react","import_jsx_runtime"]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// src/components/Button/Button.tsx
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
|
|
4
|
+
// src/utils/cn.ts
|
|
5
|
+
import { clsx } from "clsx";
|
|
6
|
+
function cn(...inputs) {
|
|
7
|
+
return clsx(inputs);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// src/components/Button/Button.tsx
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
var Button = forwardRef(
|
|
13
|
+
({
|
|
14
|
+
className,
|
|
15
|
+
label,
|
|
16
|
+
error,
|
|
17
|
+
description,
|
|
18
|
+
required,
|
|
19
|
+
leftIcon,
|
|
20
|
+
rightIcon,
|
|
21
|
+
size = "md",
|
|
22
|
+
variant = "default",
|
|
23
|
+
children,
|
|
24
|
+
...props
|
|
25
|
+
}, ref) => {
|
|
26
|
+
const baseStyles = "inline-flex items-center justify-center font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none";
|
|
27
|
+
const sizeStyles = {
|
|
28
|
+
sm: "px-3 py-1.5 text-sm rounded-md",
|
|
29
|
+
md: "px-4 py-2 text-sm rounded-md",
|
|
30
|
+
lg: "px-6 py-3 text-base rounded-lg"
|
|
31
|
+
};
|
|
32
|
+
const variantStyles = {
|
|
33
|
+
default: "bg-white text-gray-900 border border-gray-300 hover:bg-gray-50 focus:ring-blue-500",
|
|
34
|
+
filled: "bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500",
|
|
35
|
+
unstyled: ""
|
|
36
|
+
};
|
|
37
|
+
return /* @__PURE__ */ jsxs(
|
|
38
|
+
"button",
|
|
39
|
+
{
|
|
40
|
+
ref,
|
|
41
|
+
className: cn(
|
|
42
|
+
baseStyles,
|
|
43
|
+
sizeStyles[size],
|
|
44
|
+
variantStyles[variant],
|
|
45
|
+
error && "border-red-500 focus:ring-red-500",
|
|
46
|
+
className
|
|
47
|
+
),
|
|
48
|
+
"aria-invalid": !!error,
|
|
49
|
+
"aria-describedby": description ? `${props.id}-description` : void 0,
|
|
50
|
+
...props,
|
|
51
|
+
children: [
|
|
52
|
+
leftIcon && /* @__PURE__ */ jsx("span", { className: "mr-2", children: leftIcon }),
|
|
53
|
+
label || children,
|
|
54
|
+
rightIcon && /* @__PURE__ */ jsx("span", { className: "ml-2", children: rightIcon }),
|
|
55
|
+
required && /* @__PURE__ */ jsx("span", { className: "ml-1 text-red-500", children: "*" }),
|
|
56
|
+
error && /* @__PURE__ */ jsx("span", { className: "sr-only", children: error })
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
Button.displayName = "Button";
|
|
63
|
+
|
|
64
|
+
// src/components/Input/Input.tsx
|
|
65
|
+
import { forwardRef as forwardRef2 } from "react";
|
|
66
|
+
import { AlertCircle } from "lucide-react";
|
|
67
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
68
|
+
var Input = forwardRef2(
|
|
69
|
+
({
|
|
70
|
+
label,
|
|
71
|
+
error,
|
|
72
|
+
description,
|
|
73
|
+
required,
|
|
74
|
+
placeholder,
|
|
75
|
+
leftIcon,
|
|
76
|
+
rightIcon,
|
|
77
|
+
size = "md",
|
|
78
|
+
className,
|
|
79
|
+
disabled,
|
|
80
|
+
id,
|
|
81
|
+
...props
|
|
82
|
+
}, ref) => {
|
|
83
|
+
const inputId = id || `input-${Math.random().toString(36).slice(2, 9)}`;
|
|
84
|
+
const sizeClasses = {
|
|
85
|
+
sm: "h-9 text-sm px-3",
|
|
86
|
+
md: "h-10 text-sm px-3.5",
|
|
87
|
+
lg: "h-12 text-base px-4"
|
|
88
|
+
}[size];
|
|
89
|
+
return /* @__PURE__ */ jsxs2("div", { className: "w-full space-y-1.5", children: [
|
|
90
|
+
label && /* @__PURE__ */ jsxs2(
|
|
91
|
+
"label",
|
|
92
|
+
{
|
|
93
|
+
htmlFor: inputId,
|
|
94
|
+
className: cn(
|
|
95
|
+
"text-sm font-medium",
|
|
96
|
+
disabled ? "text-gray-400" : "text-gray-700"
|
|
97
|
+
),
|
|
98
|
+
children: [
|
|
99
|
+
label,
|
|
100
|
+
required && /* @__PURE__ */ jsx2("span", { className: "text-red-500 ml-1", children: "*" })
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
description && !error && /* @__PURE__ */ jsx2("p", { className: "text-xs text-gray-500", children: description }),
|
|
105
|
+
/* @__PURE__ */ jsxs2("div", { className: "relative", children: [
|
|
106
|
+
leftIcon && /* @__PURE__ */ jsx2("span", { className: "absolute left-3 top-1/2 -translate-y-1/2 text-gray-400", children: leftIcon }),
|
|
107
|
+
/* @__PURE__ */ jsx2(
|
|
108
|
+
"input",
|
|
109
|
+
{
|
|
110
|
+
ref,
|
|
111
|
+
id: inputId,
|
|
112
|
+
placeholder,
|
|
113
|
+
disabled,
|
|
114
|
+
"aria-invalid": !!error,
|
|
115
|
+
className: cn(
|
|
116
|
+
"w-full rounded-lg border border-gray-300 bg-white",
|
|
117
|
+
"transition-all duration-150 outline-none",
|
|
118
|
+
"placeholder:text-gray-400 placeholder:text-sm",
|
|
119
|
+
"focus:border-blue-500 focus:ring-2 focus:ring-blue-100",
|
|
120
|
+
"disabled:bg-gray-100 disabled:text-gray-400 disabled:cursor-not-allowed",
|
|
121
|
+
error && "border-red-500 focus:border-red-500 focus:ring-red-100",
|
|
122
|
+
leftIcon && "pl-10",
|
|
123
|
+
rightIcon && "pr-10",
|
|
124
|
+
sizeClasses,
|
|
125
|
+
className
|
|
126
|
+
),
|
|
127
|
+
...props
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
rightIcon && /* @__PURE__ */ jsx2("span", { className: "absolute right-3 top-1/2 -translate-y-1/2 text-gray-400", children: rightIcon })
|
|
131
|
+
] }),
|
|
132
|
+
error && /* @__PURE__ */ jsxs2("p", { className: "flex items-center gap-1 text-xs text-red-500", children: [
|
|
133
|
+
/* @__PURE__ */ jsx2(AlertCircle, { className: "w-3.5 h-3.5" }),
|
|
134
|
+
error
|
|
135
|
+
] })
|
|
136
|
+
] });
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
Input.displayName = "Input";
|
|
140
|
+
export {
|
|
141
|
+
Button,
|
|
142
|
+
Input
|
|
143
|
+
};
|
|
144
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Button/Button.tsx","../src/utils/cn.ts","../src/components/Input/Input.tsx"],"sourcesContent":["import React, { ButtonHTMLAttributes, forwardRef } from \"react\";\r\nimport { cn } from \"../../utils/cn\";\r\n\r\nexport interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'size'> {\r\n label?: string;\r\n error?: string;\r\n description?: string;\r\n required?: boolean;\r\n leftIcon?: React.ReactNode;\r\n rightIcon?: React.ReactNode;\r\n size?: 'sm' | 'md' | 'lg';\r\n variant?: 'default' | 'filled' | 'unstyled';\r\n}\r\n\r\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\r\n ({ \r\n className,\r\n label,\r\n error,\r\n description,\r\n required,\r\n leftIcon,\r\n rightIcon,\r\n size = 'md',\r\n variant = 'default',\r\n children,\r\n ...props \r\n }, ref) => {\r\n // Base styles\r\n const baseStyles = \"inline-flex items-center justify-center font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none\";\r\n \r\n // Size variants\r\n const sizeStyles = {\r\n sm: \"px-3 py-1.5 text-sm rounded-md\",\r\n md: \"px-4 py-2 text-sm rounded-md\",\r\n lg: \"px-6 py-3 text-base rounded-lg\"\r\n };\r\n \r\n // Style variants\r\n const variantStyles = {\r\n default: \"bg-white text-gray-900 border border-gray-300 hover:bg-gray-50 focus:ring-blue-500\",\r\n filled: \"bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500\",\r\n unstyled: \"\"\r\n };\r\n \r\n return (\r\n <button\r\n ref={ref}\r\n className={cn(\r\n baseStyles,\r\n sizeStyles[size],\r\n variantStyles[variant],\r\n error && \"border-red-500 focus:ring-red-500\",\r\n className\r\n )}\r\n aria-invalid={!!error}\r\n aria-describedby={description ? `${props.id}-description` : undefined}\r\n {...props}\r\n >\r\n {leftIcon && <span className=\"mr-2\">{leftIcon}</span>}\r\n {label || children}\r\n {rightIcon && <span className=\"ml-2\">{rightIcon}</span>}\r\n {required && <span className=\"ml-1 text-red-500\">*</span>}\r\n {error && <span className=\"sr-only\">{error}</span>}\r\n </button>\r\n );\r\n }\r\n);\r\n\r\nButton.displayName = \"Button\";","import { clsx, type ClassValue } from \"clsx\"\r\n\r\nexport function cn(...inputs: ClassValue[]) {\r\n return clsx(inputs)\r\n}\r\n","import React, { forwardRef } from \"react\";\r\nimport { cn } from \"../../utils/cn\";\r\nimport { AlertCircle } from \"lucide-react\";\r\n\r\nexport interface InputProps\r\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, \"size\"> {\r\n label?: string;\r\n error?: string;\r\n description?: string;\r\n required?: boolean;\r\n placeholder?: string;\r\n leftIcon?: React.ReactNode;\r\n rightIcon?: React.ReactNode;\r\n size?: \"sm\" | \"md\" | \"lg\";\r\n}\r\n\r\nexport const Input = forwardRef<HTMLInputElement, InputProps>(\r\n (\r\n {\r\n label,\r\n error,\r\n description,\r\n required,\r\n placeholder,\r\n leftIcon,\r\n rightIcon,\r\n size = \"md\",\r\n className,\r\n disabled,\r\n id,\r\n ...props\r\n },\r\n ref\r\n ) => {\r\n const inputId = id || `input-${Math.random().toString(36).slice(2, 9)}`;\r\n\r\n const sizeClasses = {\r\n sm: \"h-9 text-sm px-3\",\r\n md: \"h-10 text-sm px-3.5\",\r\n lg: \"h-12 text-base px-4\",\r\n }[size];\r\n\r\n return (\r\n <div className=\"w-full space-y-1.5\">\r\n {/* Label */}\r\n {label && (\r\n <label\r\n htmlFor={inputId}\r\n className={cn(\r\n \"text-sm font-medium\",\r\n disabled ? \"text-gray-400\" : \"text-gray-700\"\r\n )}\r\n >\r\n {label}\r\n {required && <span className=\"text-red-500 ml-1\">*</span>}\r\n </label>\r\n )}\r\n\r\n {/* Description */}\r\n {description && !error && (\r\n <p className=\"text-xs text-gray-500\">{description}</p>\r\n )}\r\n\r\n {/* Input wrapper */}\r\n <div className=\"relative\">\r\n {/* Left Icon */}\r\n {leftIcon && (\r\n <span className=\"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400\">\r\n {leftIcon}\r\n </span>\r\n )}\r\n\r\n {/* Input */}\r\n <input\r\n ref={ref}\r\n id={inputId}\r\n placeholder={placeholder}\r\n disabled={disabled}\r\n aria-invalid={!!error}\r\n className={cn(\r\n \"w-full rounded-lg border border-gray-300 bg-white\",\r\n \"transition-all duration-150 outline-none\",\r\n \"placeholder:text-gray-400 placeholder:text-sm\",\r\n \"focus:border-blue-500 focus:ring-2 focus:ring-blue-100\",\r\n \"disabled:bg-gray-100 disabled:text-gray-400 disabled:cursor-not-allowed\",\r\n error && \"border-red-500 focus:border-red-500 focus:ring-red-100\",\r\n leftIcon && \"pl-10\",\r\n rightIcon && \"pr-10\",\r\n sizeClasses,\r\n className\r\n )}\r\n {...props}\r\n />\r\n\r\n {/* Right Icon */}\r\n {rightIcon && (\r\n <span className=\"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400\">\r\n {rightIcon}\r\n </span>\r\n )}\r\n </div>\r\n \r\n {error && (\r\n <p className=\"flex items-center gap-1 text-xs text-red-500\">\r\n <AlertCircle className=\"w-3.5 h-3.5\" />\r\n {error}\r\n </p>\r\n )}\r\n </div>\r\n );\r\n }\r\n);\r\n\r\nInput.displayName = \"Input\";"],"mappings":"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","names":["forwardRef","jsx","jsxs","forwardRef"]}
|
package/package.json
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gd-ui-library",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "index.
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "Reusable UI components",
|
|
5
|
+
"main": "dist/index.cjs",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
6
11
|
"scripts": {
|
|
7
12
|
"build": "tsup",
|
|
8
13
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
9
14
|
},
|
|
10
|
-
"keywords": [
|
|
15
|
+
"keywords": [
|
|
16
|
+
"react",
|
|
17
|
+
"ui",
|
|
18
|
+
"components"
|
|
19
|
+
],
|
|
11
20
|
"author": "",
|
|
12
21
|
"license": "ISC",
|
|
13
22
|
"type": "commonjs",
|
package/dist/index.cjs
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/index.ts
|
|
20
|
-
var index_exports = {};
|
|
21
|
-
__export(index_exports, {
|
|
22
|
-
Input: () => Input
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(index_exports);
|
|
25
|
-
|
|
26
|
-
// src/components/Input/Input.tsx
|
|
27
|
-
var import_react = require("react");
|
|
28
|
-
|
|
29
|
-
// src/utils/cn.ts
|
|
30
|
-
var import_clsx = require("clsx");
|
|
31
|
-
function cn(...inputs) {
|
|
32
|
-
return (0, import_clsx.clsx)(inputs);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// src/components/Input/Input.tsx
|
|
36
|
-
var import_lucide_react = require("lucide-react");
|
|
37
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
|
-
var Input = (0, import_react.forwardRef)(({
|
|
39
|
-
label,
|
|
40
|
-
error,
|
|
41
|
-
description,
|
|
42
|
-
required,
|
|
43
|
-
leftIcon,
|
|
44
|
-
rightIcon,
|
|
45
|
-
size = "md",
|
|
46
|
-
variant = "default",
|
|
47
|
-
className,
|
|
48
|
-
disabled,
|
|
49
|
-
id,
|
|
50
|
-
...props
|
|
51
|
-
}, ref) => {
|
|
52
|
-
const inputId = id || `input-${Math.random().toString(36).substr(2, 9)}`;
|
|
53
|
-
const sizeClasses = {
|
|
54
|
-
sm: "h-8 text-xs px-3 py-1",
|
|
55
|
-
md: "h-10 text-sm px-4 py-2",
|
|
56
|
-
lg: "h-12 text-base px-5 py-3"
|
|
57
|
-
}[size];
|
|
58
|
-
const variantClasses = {
|
|
59
|
-
default: "border border-gray-300 bg-white focus:border-blue-500 focus:ring-2 focus:ring-blue-200",
|
|
60
|
-
filled: "bg-gray-100 border border-transparent focus:bg-white focus:border-blue-500 focus:ring-2 focus:ring-blue-200",
|
|
61
|
-
unstyled: "border-none bg-transparent p-0 focus:ring-0"
|
|
62
|
-
}[variant];
|
|
63
|
-
const errorClasses = error ? "border-red-500 focus:border-red-500 focus:ring-red-200" : "";
|
|
64
|
-
const disabledClasses = disabled ? "bg-gray-100 cursor-not-allowed opacity-60" : "";
|
|
65
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "w-full", children: [
|
|
66
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
67
|
-
"label",
|
|
68
|
-
{
|
|
69
|
-
htmlFor: inputId,
|
|
70
|
-
className: cn(
|
|
71
|
-
"block text-sm font-medium mb-1.5",
|
|
72
|
-
disabled ? "text-gray-400 cursor-not-allowed" : "text-gray-700"
|
|
73
|
-
),
|
|
74
|
-
children: [
|
|
75
|
-
label,
|
|
76
|
-
required && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-red-500 ml-1", children: "*" })
|
|
77
|
-
]
|
|
78
|
-
}
|
|
79
|
-
),
|
|
80
|
-
description && !error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-gray-500 mb-2", children: description }),
|
|
81
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "relative", children: [
|
|
82
|
-
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: cn(
|
|
83
|
-
"absolute left-3 top-1/2 -translate-y-1/2",
|
|
84
|
-
error ? "text-red-500" : "text-gray-400"
|
|
85
|
-
), children: leftIcon }),
|
|
86
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
87
|
-
"input",
|
|
88
|
-
{
|
|
89
|
-
ref,
|
|
90
|
-
id: inputId,
|
|
91
|
-
disabled,
|
|
92
|
-
"aria-invalid": !!error,
|
|
93
|
-
className: cn(
|
|
94
|
-
"w-full rounded-md transition-all duration-150 outline-none",
|
|
95
|
-
sizeClasses,
|
|
96
|
-
variantClasses,
|
|
97
|
-
errorClasses,
|
|
98
|
-
disabledClasses,
|
|
99
|
-
leftIcon && "pl-10",
|
|
100
|
-
rightIcon && "pr-10",
|
|
101
|
-
className
|
|
102
|
-
),
|
|
103
|
-
...props
|
|
104
|
-
}
|
|
105
|
-
),
|
|
106
|
-
rightIcon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: cn(
|
|
107
|
-
"absolute right-3 top-1/2 -translate-y-1/2",
|
|
108
|
-
error ? "text-red-500" : "text-gray-400"
|
|
109
|
-
), children: rightIcon })
|
|
110
|
-
] }),
|
|
111
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "flex items-center gap-1 mt-1.5 text-xs text-red-500", children: [
|
|
112
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.AlertCircle, { className: "w-3.5 h-3.5" }),
|
|
113
|
-
error
|
|
114
|
-
] })
|
|
115
|
-
] });
|
|
116
|
-
});
|
|
117
|
-
Input.displayName = "Input";
|
|
118
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
119
|
-
0 && (module.exports = {
|
|
120
|
-
Input
|
|
121
|
-
});
|
|
122
|
-
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/components/Input/Input.tsx","../src/utils/cn.ts"],"sourcesContent":["export * from \"./components/Input/Input\"; ","import React, { forwardRef } from 'react';\r\nimport { cn } from '../../utils/cn';\r\nimport { AlertCircle } from 'lucide-react';\r\n\r\nexport interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> {\r\n label?: string;\r\n error?: string;\r\n description?: string;\r\n required?: boolean;\r\n leftIcon?: React.ReactNode;\r\n rightIcon?: React.ReactNode;\r\n size?: 'sm' | 'md' | 'lg';\r\n variant?: 'default' | 'filled' | 'unstyled';\r\n}\r\n\r\nexport const Input = forwardRef<HTMLInputElement, InputProps>(({\r\n label,\r\n error,\r\n description,\r\n required,\r\n leftIcon,\r\n rightIcon,\r\n size = 'md',\r\n variant = 'default',\r\n className,\r\n disabled,\r\n id,\r\n ...props\r\n}, ref) => {\r\n const inputId = id || `input-${Math.random().toString(36).substr(2, 9)}`; \r\n const sizeClasses = {\r\n sm: 'h-8 text-xs px-3 py-1',\r\n md: 'h-10 text-sm px-4 py-2',\r\n lg: 'h-12 text-base px-5 py-3',\r\n }[size];\r\n const variantClasses = {\r\n default: 'border border-gray-300 bg-white focus:border-blue-500 focus:ring-2 focus:ring-blue-200',\r\n filled: 'bg-gray-100 border border-transparent focus:bg-white focus:border-blue-500 focus:ring-2 focus:ring-blue-200',\r\n unstyled: 'border-none bg-transparent p-0 focus:ring-0',\r\n }[variant];\r\n const errorClasses = error\r\n ? 'border-red-500 focus:border-red-500 focus:ring-red-200'\r\n : '';\r\n const disabledClasses = disabled\r\n ? 'bg-gray-100 cursor-not-allowed opacity-60'\r\n : '';\r\n return (\r\n <div className=\"w-full\">\r\n {/* Label */}\r\n {label && (\r\n <label\r\n htmlFor={inputId}\r\n className={cn(\r\n \"block text-sm font-medium mb-1.5\",\r\n disabled ? \"text-gray-400 cursor-not-allowed\" : \"text-gray-700\"\r\n )}\r\n >\r\n {label}\r\n {required && <span className=\"text-red-500 ml-1\">*</span>}\r\n </label>\r\n )}\r\n {/* Description */}\r\n {description && !error && (\r\n <p className=\"text-xs text-gray-500 mb-2\">{description}</p>\r\n )}\r\n {/* Input Container */}\r\n <div className=\"relative\">\r\n {/* Left Icon */}\r\n {leftIcon && (\r\n <span className={cn(\r\n \"absolute left-3 top-1/2 -translate-y-1/2\",\r\n error ? \"text-red-500\" : \"text-gray-400\"\r\n )}>\r\n {leftIcon}\r\n </span>\r\n )}\r\n {/* Input */}\r\n <input\r\n ref={ref}\r\n id={inputId}\r\n disabled={disabled}\r\n aria-invalid={!!error}\r\n className={cn(\r\n \"w-full rounded-md transition-all duration-150 outline-none\",\r\n sizeClasses,\r\n variantClasses,\r\n errorClasses,\r\n disabledClasses,\r\n leftIcon && \"pl-10\",\r\n rightIcon && \"pr-10\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n {/* Right Icon */}\r\n {rightIcon && (\r\n <span className={cn(\r\n \"absolute right-3 top-1/2 -translate-y-1/2\",\r\n error ? \"text-red-500\" : \"text-gray-400\"\r\n )}>\r\n {rightIcon}\r\n </span>\r\n )}\r\n </div>\r\n\r\n {/* Error Message */}\r\n {error && (\r\n <p className=\"flex items-center gap-1 mt-1.5 text-xs text-red-500\">\r\n <AlertCircle className=\"w-3.5 h-3.5\" />\r\n {error}\r\n </p>\r\n )}\r\n </div>\r\n );\r\n});\r\n\r\nInput.displayName = 'Input';","import { clsx, type ClassValue } from \"clsx\"\r\n\r\nexport function cn(...inputs: ClassValue[]) {\r\n return clsx(inputs)\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAkC;;;ACAlC,kBAAsC;AAE/B,SAAS,MAAM,QAAsB;AAC1C,aAAO,kBAAK,MAAM;AACpB;;;ADFA,0BAA4B;AAgDpB;AAnCD,IAAM,YAAQ,yBAAyC,CAAC;AAAA,EAC7D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAG,QAAQ;AACT,QAAM,UAAU,MAAM,SAAS,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,OAAO,GAAG,CAAC,CAAC;AACtE,QAAM,cAAc;AAAA,IAClB,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,EACN,EAAE,IAAI;AACN,QAAM,iBAAiB;AAAA,IACrB,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,UAAU;AAAA,EACZ,EAAE,OAAO;AACT,QAAM,eAAe,QACjB,2DACA;AACJ,QAAM,kBAAkB,WACpB,8CACA;AACJ,SACE,6CAAC,SAAI,WAAU,UAEZ;AAAA,aACC;AAAA,MAAC;AAAA;AAAA,QACC,SAAS;AAAA,QACT,WAAW;AAAA,UACT;AAAA,UACA,WAAW,qCAAqC;AAAA,QAClD;AAAA,QAEC;AAAA;AAAA,UACA,YAAY,4CAAC,UAAK,WAAU,qBAAoB,eAAC;AAAA;AAAA;AAAA,IACpD;AAAA,IAGD,eAAe,CAAC,SACf,4CAAC,OAAE,WAAU,8BAA8B,uBAAY;AAAA,IAGzD,6CAAC,SAAI,WAAU,YAEZ;AAAA,kBACC,4CAAC,UAAK,WAAW;AAAA,QACf;AAAA,QACA,QAAQ,iBAAiB;AAAA,MAC3B,GACG,oBACH;AAAA,MAGF;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA,IAAI;AAAA,UACJ;AAAA,UACA,gBAAc,CAAC,CAAC;AAAA,UAChB,WAAW;AAAA,YACT;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,YAAY;AAAA,YACZ,aAAa;AAAA,YACb;AAAA,UACF;AAAA,UACC,GAAG;AAAA;AAAA,MACN;AAAA,MAEC,aACC,4CAAC,UAAK,WAAW;AAAA,QACf;AAAA,QACA,QAAQ,iBAAiB;AAAA,MAC3B,GACG,qBACH;AAAA,OAEJ;AAAA,IAGC,SACC,6CAAC,OAAE,WAAU,uDACX;AAAA,kDAAC,mCAAY,WAAU,eAAc;AAAA,MACpC;AAAA,OACH;AAAA,KAEJ;AAEJ,CAAC;AAED,MAAM,cAAc;","names":[]}
|
package/dist/index.d.cts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
4
|
-
label?: string;
|
|
5
|
-
error?: string;
|
|
6
|
-
description?: string;
|
|
7
|
-
required?: boolean;
|
|
8
|
-
leftIcon?: React.ReactNode;
|
|
9
|
-
rightIcon?: React.ReactNode;
|
|
10
|
-
size?: 'sm' | 'md' | 'lg';
|
|
11
|
-
variant?: 'default' | 'filled' | 'unstyled';
|
|
12
|
-
}
|
|
13
|
-
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
14
|
-
|
|
15
|
-
export { Input, type InputProps };
|
package/rollup.config.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// rollup.config.js
|
|
2
|
-
import typescript from '@rollup/plugin-typescript';
|
|
3
|
-
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
|
|
4
|
-
import commonjs from '@rollup/plugin-commonjs';
|
|
5
|
-
import resolve from '@rollup/plugin-node-resolve';
|
|
6
|
-
import pkg from './package.json';
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
input: 'src/index.ts',
|
|
10
|
-
output: [
|
|
11
|
-
{
|
|
12
|
-
file: pkg.main,
|
|
13
|
-
format: 'cjs',
|
|
14
|
-
sourcemap: true
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
file: pkg.module,
|
|
18
|
-
format: 'esm',
|
|
19
|
-
sourcemap: true
|
|
20
|
-
}
|
|
21
|
-
],
|
|
22
|
-
plugins: [
|
|
23
|
-
peerDepsExternal(),
|
|
24
|
-
resolve(),
|
|
25
|
-
commonjs(),
|
|
26
|
-
typescript({ tsconfig: './tsconfig.json' })
|
|
27
|
-
],
|
|
28
|
-
external: ['react', 'react-dom']
|
|
29
|
-
};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import React, { ButtonHTMLAttributes, forwardRef } from "react";
|
|
2
|
-
import { cn } from "../../utils/cn";
|
|
3
|
-
|
|
4
|
-
export interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'size'> {
|
|
5
|
-
label?: string;
|
|
6
|
-
error?: string;
|
|
7
|
-
description?: string;
|
|
8
|
-
required?: boolean;
|
|
9
|
-
leftIcon?: React.ReactNode;
|
|
10
|
-
rightIcon?: React.ReactNode;
|
|
11
|
-
size?: 'sm' | 'md' | 'lg';
|
|
12
|
-
variant?: 'default' | 'filled' | 'unstyled';
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
16
|
-
({
|
|
17
|
-
className,
|
|
18
|
-
label,
|
|
19
|
-
error,
|
|
20
|
-
description,
|
|
21
|
-
required,
|
|
22
|
-
leftIcon,
|
|
23
|
-
rightIcon,
|
|
24
|
-
size = 'md',
|
|
25
|
-
variant = 'default',
|
|
26
|
-
children,
|
|
27
|
-
...props
|
|
28
|
-
}, ref) => {
|
|
29
|
-
// Base styles
|
|
30
|
-
const baseStyles = "inline-flex items-center justify-center font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none";
|
|
31
|
-
|
|
32
|
-
// Size variants
|
|
33
|
-
const sizeStyles = {
|
|
34
|
-
sm: "px-3 py-1.5 text-sm rounded-md",
|
|
35
|
-
md: "px-4 py-2 text-sm rounded-md",
|
|
36
|
-
lg: "px-6 py-3 text-base rounded-lg"
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
// Style variants
|
|
40
|
-
const variantStyles = {
|
|
41
|
-
default: "bg-white text-gray-900 border border-gray-300 hover:bg-gray-50 focus:ring-blue-500",
|
|
42
|
-
filled: "bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500",
|
|
43
|
-
unstyled: ""
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<button
|
|
48
|
-
ref={ref}
|
|
49
|
-
className={cn(
|
|
50
|
-
baseStyles,
|
|
51
|
-
sizeStyles[size],
|
|
52
|
-
variantStyles[variant],
|
|
53
|
-
error && "border-red-500 focus:ring-red-500",
|
|
54
|
-
className
|
|
55
|
-
)}
|
|
56
|
-
aria-invalid={!!error}
|
|
57
|
-
aria-describedby={description ? `${props.id}-description` : undefined}
|
|
58
|
-
{...props}
|
|
59
|
-
>
|
|
60
|
-
{leftIcon && <span className="mr-2">{leftIcon}</span>}
|
|
61
|
-
{label || children}
|
|
62
|
-
{rightIcon && <span className="ml-2">{rightIcon}</span>}
|
|
63
|
-
{required && <span className="ml-1 text-red-500">*</span>}
|
|
64
|
-
{error && <span className="sr-only">{error}</span>}
|
|
65
|
-
</button>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
Button.displayName = "Button";
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
import { cn } from '../../utils/cn';
|
|
3
|
-
import { AlertCircle } from 'lucide-react';
|
|
4
|
-
|
|
5
|
-
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
6
|
-
label?: string;
|
|
7
|
-
error?: string;
|
|
8
|
-
description?: string;
|
|
9
|
-
required?: boolean;
|
|
10
|
-
leftIcon?: React.ReactNode;
|
|
11
|
-
rightIcon?: React.ReactNode;
|
|
12
|
-
size?: 'sm' | 'md' | 'lg';
|
|
13
|
-
variant?: 'default' | 'filled' | 'unstyled';
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const Input = forwardRef<HTMLInputElement, InputProps>(({
|
|
17
|
-
label,
|
|
18
|
-
error,
|
|
19
|
-
description,
|
|
20
|
-
required,
|
|
21
|
-
leftIcon,
|
|
22
|
-
rightIcon,
|
|
23
|
-
size = 'md',
|
|
24
|
-
variant = 'default',
|
|
25
|
-
className,
|
|
26
|
-
disabled,
|
|
27
|
-
id,
|
|
28
|
-
...props
|
|
29
|
-
}, ref) => {
|
|
30
|
-
const inputId = id || `input-${Math.random().toString(36).substr(2, 9)}`;
|
|
31
|
-
const sizeClasses = {
|
|
32
|
-
sm: 'h-8 text-xs px-3 py-1',
|
|
33
|
-
md: 'h-10 text-sm px-4 py-2',
|
|
34
|
-
lg: 'h-12 text-base px-5 py-3',
|
|
35
|
-
}[size];
|
|
36
|
-
const variantClasses = {
|
|
37
|
-
default: 'border border-gray-300 bg-white focus:border-blue-500 focus:ring-2 focus:ring-blue-200',
|
|
38
|
-
filled: 'bg-gray-100 border border-transparent focus:bg-white focus:border-blue-500 focus:ring-2 focus:ring-blue-200',
|
|
39
|
-
unstyled: 'border-none bg-transparent p-0 focus:ring-0',
|
|
40
|
-
}[variant];
|
|
41
|
-
const errorClasses = error
|
|
42
|
-
? 'border-red-500 focus:border-red-500 focus:ring-red-200'
|
|
43
|
-
: '';
|
|
44
|
-
const disabledClasses = disabled
|
|
45
|
-
? 'bg-gray-100 cursor-not-allowed opacity-60'
|
|
46
|
-
: '';
|
|
47
|
-
return (
|
|
48
|
-
<div className="w-full">
|
|
49
|
-
{/* Label */}
|
|
50
|
-
{label && (
|
|
51
|
-
<label
|
|
52
|
-
htmlFor={inputId}
|
|
53
|
-
className={cn(
|
|
54
|
-
"block text-sm font-medium mb-1.5",
|
|
55
|
-
disabled ? "text-gray-400 cursor-not-allowed" : "text-gray-700"
|
|
56
|
-
)}
|
|
57
|
-
>
|
|
58
|
-
{label}
|
|
59
|
-
{required && <span className="text-red-500 ml-1">*</span>}
|
|
60
|
-
</label>
|
|
61
|
-
)}
|
|
62
|
-
{/* Description */}
|
|
63
|
-
{description && !error && (
|
|
64
|
-
<p className="text-xs text-gray-500 mb-2">{description}</p>
|
|
65
|
-
)}
|
|
66
|
-
{/* Input Container */}
|
|
67
|
-
<div className="relative">
|
|
68
|
-
{/* Left Icon */}
|
|
69
|
-
{leftIcon && (
|
|
70
|
-
<span className={cn(
|
|
71
|
-
"absolute left-3 top-1/2 -translate-y-1/2",
|
|
72
|
-
error ? "text-red-500" : "text-gray-400"
|
|
73
|
-
)}>
|
|
74
|
-
{leftIcon}
|
|
75
|
-
</span>
|
|
76
|
-
)}
|
|
77
|
-
{/* Input */}
|
|
78
|
-
<input
|
|
79
|
-
ref={ref}
|
|
80
|
-
id={inputId}
|
|
81
|
-
disabled={disabled}
|
|
82
|
-
aria-invalid={!!error}
|
|
83
|
-
className={cn(
|
|
84
|
-
"w-full rounded-md transition-all duration-150 outline-none",
|
|
85
|
-
sizeClasses,
|
|
86
|
-
variantClasses,
|
|
87
|
-
errorClasses,
|
|
88
|
-
disabledClasses,
|
|
89
|
-
leftIcon && "pl-10",
|
|
90
|
-
rightIcon && "pr-10",
|
|
91
|
-
className
|
|
92
|
-
)}
|
|
93
|
-
{...props}
|
|
94
|
-
/>
|
|
95
|
-
{/* Right Icon */}
|
|
96
|
-
{rightIcon && (
|
|
97
|
-
<span className={cn(
|
|
98
|
-
"absolute right-3 top-1/2 -translate-y-1/2",
|
|
99
|
-
error ? "text-red-500" : "text-gray-400"
|
|
100
|
-
)}>
|
|
101
|
-
{rightIcon}
|
|
102
|
-
</span>
|
|
103
|
-
)}
|
|
104
|
-
</div>
|
|
105
|
-
|
|
106
|
-
{/* Error Message */}
|
|
107
|
-
{error && (
|
|
108
|
-
<p className="flex items-center gap-1 mt-1.5 text-xs text-red-500">
|
|
109
|
-
<AlertCircle className="w-3.5 h-3.5" />
|
|
110
|
-
{error}
|
|
111
|
-
</p>
|
|
112
|
-
)}
|
|
113
|
-
</div>
|
|
114
|
-
);
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
Input.displayName = 'Input';
|
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./components/Input/Input";
|
package/src/lib/utils.ts
DELETED
package/src/utils/cn.ts
DELETED
package/tsconfig.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"jsx": "react-jsx",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"target": "ESNext",
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"emitDeclarationOnly": true,
|
|
8
|
-
"outDir": "dist",
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"allowJs": true,
|
|
11
|
-
"moduleResolution": "node",
|
|
12
|
-
"skipLibCheck": true,
|
|
13
|
-
"forceConsistentCasingInFileNames": true
|
|
14
|
-
},
|
|
15
|
-
"include": ["src"]
|
|
16
|
-
}
|
package/tsup.config.ts
DELETED