@popgrids/ui 0.0.24 → 0.0.25

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 CHANGED
@@ -378,45 +378,53 @@ function Button({
378
378
  theme = "brand",
379
379
  trailing,
380
380
  variant = "default",
381
+ href,
381
382
  ...props
382
383
  }) {
383
- return /* @__PURE__ */ jsx(
384
- Button$1,
385
- {
386
- "data-slot": "button",
387
- className: cn(
388
- buttonVariants({
389
- variant,
390
- size,
391
- align,
392
- outline,
393
- collapsed,
394
- pill,
395
- className,
396
- hasLeading: !!leading,
397
- theme,
398
- hasTrailing: !!trailing
399
- }),
400
- tintVariants({ variant, outline })
401
- ),
402
- ...props,
403
- children: /* @__PURE__ */ jsxs(Fragment, { children: [
404
- loading && (loadingElement || /* @__PURE__ */ jsx(Loader, { className: "absolute inset-0 m-auto", variant: "spinner", theme: "reversed" })),
405
- leading && /* @__PURE__ */ jsx("div", { className: cn("group-aria-busy/button:opacity-0 transition-opacity", { "opacity-0": loading }), children: leading }),
406
- children && /* @__PURE__ */ jsx("span", { className: cn("min-w-[18px] truncate relative transition-opacity", { "opacity-0": loading }), children }),
407
- trailing && /* @__PURE__ */ jsx(
408
- "div",
409
- {
410
- className: cn("group-aria-busy/button:opacity-0 transition-opacity", {
411
- "opacity-0": loading,
412
- "absolute top-1/2 right-0 translate-x-1/2 -translate-y-1/2": collapsed
413
- }),
414
- children: trailing
415
- }
416
- )
417
- ] })
418
- }
384
+ const sharedClassName = cn(
385
+ buttonVariants({
386
+ variant,
387
+ size,
388
+ align,
389
+ outline,
390
+ collapsed,
391
+ pill,
392
+ className,
393
+ hasLeading: !!leading,
394
+ theme,
395
+ hasTrailing: !!trailing
396
+ }),
397
+ tintVariants({ variant, outline })
419
398
  );
399
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
400
+ loading && (loadingElement || /* @__PURE__ */ jsx(Loader, { className: "absolute inset-0 m-auto", variant: "spinner", theme: "reversed" })),
401
+ leading && /* @__PURE__ */ jsx("div", { className: cn("group-aria-busy/button:opacity-0 transition-opacity", { "opacity-0": loading }), children: leading }),
402
+ children && /* @__PURE__ */ jsx("span", { className: cn("min-w-[18px] truncate relative transition-opacity", { "opacity-0": loading }), children }),
403
+ trailing && /* @__PURE__ */ jsx(
404
+ "div",
405
+ {
406
+ className: cn("group-aria-busy/button:opacity-0 transition-opacity", {
407
+ "opacity-0": loading,
408
+ "absolute top-1/2 right-0 translate-x-1/2 -translate-y-1/2": collapsed
409
+ }),
410
+ children: trailing
411
+ }
412
+ )
413
+ ] });
414
+ if (href != null) {
415
+ return /* @__PURE__ */ jsx(
416
+ "a",
417
+ {
418
+ "data-slot": "button",
419
+ className: sharedClassName,
420
+ href,
421
+ ...props,
422
+ children: content
423
+ }
424
+ );
425
+ }
426
+ const buttonProps = props;
427
+ return /* @__PURE__ */ jsx(Button$1, { "data-slot": "button", className: sharedClassName, ...buttonProps, children: content });
420
428
  }
421
429
  var buttonLinkVariants = cva(
422
430
  "inline-flex relative items-center gap-1.5 whitespace-nowrap font-medium transition-all rounded-xs -translate-y-px border-y border-x-4 border-transparent [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none no-underline cursor-pointer",