@moontra/moonui 2.0.11 → 2.1.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/index.js +16 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/ui/button.tsx +15 -11
package/package.json
CHANGED
|
@@ -4,12 +4,12 @@ import { cn } from "../../lib/utils";
|
|
|
4
4
|
import { Loader2 } from "lucide-react";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* MoonUI Button Component
|
|
8
8
|
*
|
|
9
9
|
* A world-class, accessible, and versatile button component.
|
|
10
10
|
* Pixel-perfect design with extensive variants and states.
|
|
11
11
|
*/
|
|
12
|
-
const
|
|
12
|
+
const moonUIButtonVariants = cva(
|
|
13
13
|
["inline-flex items-center justify-center gap-2 whitespace-nowrap",
|
|
14
14
|
"font-medium relative",
|
|
15
15
|
"transition-all duration-200 ease-out",
|
|
@@ -156,10 +156,10 @@ const buttonVariants = cva(
|
|
|
156
156
|
}
|
|
157
157
|
);
|
|
158
158
|
|
|
159
|
-
// Button component props
|
|
160
|
-
export interface
|
|
159
|
+
// MoonUI Button component props
|
|
160
|
+
export interface MoonUIButtonProps
|
|
161
161
|
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
162
|
-
VariantProps<typeof
|
|
162
|
+
VariantProps<typeof moonUIButtonVariants> {
|
|
163
163
|
asChild?: boolean;
|
|
164
164
|
loading?: boolean;
|
|
165
165
|
leftIcon?: React.ReactNode;
|
|
@@ -167,9 +167,9 @@ export interface ButtonProps
|
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
/**
|
|
170
|
-
*
|
|
170
|
+
* MoonUI Button Component
|
|
171
171
|
*
|
|
172
|
-
* @param props - Button component properties
|
|
172
|
+
* @param props - MoonUI Button component properties
|
|
173
173
|
* @param props.variant - Visual variant (primary, secondary, ghost, etc.)
|
|
174
174
|
* @param props.size - Button size (xs, sm, md, lg, xl)
|
|
175
175
|
* @param props.loading - Loading state display
|
|
@@ -179,7 +179,7 @@ export interface ButtonProps
|
|
|
179
179
|
* @param props.rounded - Corner rounding style (default, full, none)
|
|
180
180
|
* @param props.asChild - For Radix UI polymorphic component
|
|
181
181
|
*/
|
|
182
|
-
const
|
|
182
|
+
const MoonUIButton = React.forwardRef<HTMLButtonElement, MoonUIButtonProps>(
|
|
183
183
|
({
|
|
184
184
|
className,
|
|
185
185
|
variant,
|
|
@@ -199,7 +199,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
199
199
|
|
|
200
200
|
return (
|
|
201
201
|
<Comp
|
|
202
|
-
className={cn(
|
|
202
|
+
className={cn(moonUIButtonVariants({ variant, size, rounded, fullWidth, className }))}
|
|
203
203
|
ref={ref}
|
|
204
204
|
disabled={disabled || loading}
|
|
205
205
|
data-loading={loading ? "" : undefined}
|
|
@@ -216,6 +216,10 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
216
216
|
}
|
|
217
217
|
);
|
|
218
218
|
|
|
219
|
-
|
|
219
|
+
MoonUIButton.displayName = "MoonUIButton";
|
|
220
220
|
|
|
221
|
-
export {
|
|
221
|
+
export { MoonUIButton, moonUIButtonVariants };
|
|
222
|
+
|
|
223
|
+
// Backward compatibility exports
|
|
224
|
+
export { MoonUIButton as Button, moonUIButtonVariants as buttonVariants };
|
|
225
|
+
export type { MoonUIButtonProps as ButtonProps };
|