@tollerud/ui 1.0.6 → 1.0.7

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.cjs CHANGED
@@ -3,6 +3,7 @@
3
3
  var clsx = require('clsx');
4
4
  var tailwindMerge = require('tailwind-merge');
5
5
  var React2 = require('react');
6
+ var reactSlot = require('@radix-ui/react-slot');
6
7
  var jsxRuntime = require('react/jsx-runtime');
7
8
  var framerMotion = require('framer-motion');
8
9
  var DialogPrimitive = require('@radix-ui/react-dialog');
@@ -54,20 +55,24 @@ var sizes = {
54
55
  md: "px-4 py-2 text-base",
55
56
  lg: "px-6 py-3 text-lg"
56
57
  };
58
+ function buttonVariants({ variant = "secondary", size = "md", className } = {}) {
59
+ return cn(
60
+ "inline-flex items-center justify-center gap-2 font-semibold rounded transition-all duration-[150ms] focus-visible:outline-2 focus-visible:outline-tollerud-yellow focus-visible:outline-offset-2",
61
+ "border cursor-pointer",
62
+ "disabled:opacity-50 disabled:pointer-events-none",
63
+ variants[variant],
64
+ sizes[size],
65
+ className
66
+ );
67
+ }
57
68
  var Button = React2.forwardRef(
58
- ({ className, variant = "secondary", size = "md", ...props }, ref) => {
69
+ ({ className, variant = "secondary", size = "md", asChild = false, ...props }, ref) => {
70
+ const Comp = asChild ? reactSlot.Slot : "button";
59
71
  return /* @__PURE__ */ jsxRuntime.jsx(
60
- "button",
72
+ Comp,
61
73
  {
62
74
  ref,
63
- className: cn(
64
- "inline-flex items-center justify-center gap-2 font-semibold rounded transition-all duration-[150ms] focus-visible:outline-2 focus-visible:outline-tollerud-yellow focus-visible:outline-offset-2",
65
- "border cursor-pointer",
66
- "disabled:opacity-50 disabled:pointer-events-none",
67
- variants[variant],
68
- sizes[size],
69
- className
70
- ),
75
+ className: buttonVariants({ variant, size, className }),
71
76
  ...props
72
77
  }
73
78
  );
@@ -2745,6 +2750,7 @@ exports.Tooltip = Tooltip;
2745
2750
  exports.TooltipContent = TooltipContent;
2746
2751
  exports.TooltipProvider = TooltipProvider;
2747
2752
  exports.TooltipTrigger = TooltipTrigger;
2753
+ exports.buttonVariants = buttonVariants;
2748
2754
  exports.cn = cn;
2749
2755
  //# sourceMappingURL=index.cjs.map
2750
2756
  //# sourceMappingURL=index.cjs.map