@tollerud/ui 1.0.6 → 1.0.8

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