@7onic-ui/react 0.3.14 → 0.3.15

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
@@ -866,6 +866,16 @@ var buttonVariants = (0, import_class_variance_authority3.cva)(
866
866
  }
867
867
  }
868
868
  );
869
+ var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
870
+ function renderInsideChild(children, render) {
871
+ let child = children;
872
+ const resolve = React5.use;
873
+ if (typeof child === "object" && child !== null && child.$$typeof === REACT_LAZY_TYPE && typeof resolve === "function") {
874
+ child = resolve(child._payload);
875
+ }
876
+ if (!React5.isValidElement(child)) return render(children);
877
+ return React5.cloneElement(child, void 0, render(child.props.children));
878
+ }
869
879
  var Button = React5.forwardRef(
870
880
  ({
871
881
  className,
@@ -909,6 +919,17 @@ var Button = React5.forwardRef(
909
919
  // icon-only → 20px
910
920
  }[size || "default"];
911
921
  const selectedStyles = selected ? variant === "outline" ? "bg-background-muted" : variant === "ghost" ? "font-semibold" : "" : "";
922
+ const renderContent = (content) => loading ? /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(
923
+ "svg",
924
+ {
925
+ className: cn(iconSizeClass, "animate-spin"),
926
+ fill: "none",
927
+ viewBox: "0 0 24 24",
928
+ "aria-hidden": "true"
929
+ },
930
+ /* @__PURE__ */ React5.createElement("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
931
+ /* @__PURE__ */ React5.createElement("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
932
+ ), /* @__PURE__ */ React5.createElement("span", null, content)) : /* @__PURE__ */ React5.createElement(React5.Fragment, null, leftIcon && /* @__PURE__ */ React5.createElement("span", { className: cn(iconSizeClass, "[&>svg]:w-full [&>svg]:h-full"), "aria-hidden": "true" }, leftIcon), content, rightIcon && /* @__PURE__ */ React5.createElement("span", { className: cn(iconSizeClass, "[&>svg]:w-full [&>svg]:h-full"), "aria-hidden": "true" }, rightIcon));
912
933
  return /* @__PURE__ */ React5.createElement(
913
934
  Comp,
914
935
  {
@@ -919,17 +940,7 @@ var Button = React5.forwardRef(
919
940
  "aria-pressed": selected || void 0,
920
941
  ...props
921
942
  },
922
- loading ? /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(
923
- "svg",
924
- {
925
- className: cn(iconSizeClass, "animate-spin"),
926
- fill: "none",
927
- viewBox: "0 0 24 24",
928
- "aria-hidden": "true"
929
- },
930
- /* @__PURE__ */ React5.createElement("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
931
- /* @__PURE__ */ React5.createElement("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
932
- ), /* @__PURE__ */ React5.createElement("span", null, children)) : /* @__PURE__ */ React5.createElement(React5.Fragment, null, leftIcon && /* @__PURE__ */ React5.createElement("span", { className: cn(iconSizeClass, "[&>svg]:w-full [&>svg]:h-full"), "aria-hidden": "true" }, leftIcon), children, rightIcon && /* @__PURE__ */ React5.createElement("span", { className: cn(iconSizeClass, "[&>svg]:w-full [&>svg]:h-full"), "aria-hidden": "true" }, rightIcon))
943
+ asChild ? renderInsideChild(children, renderContent) : renderContent(children)
933
944
  );
934
945
  }
935
946
  );
@@ -995,6 +1006,16 @@ var iconButtonVariants = (0, import_class_variance_authority4.cva)(
995
1006
  }
996
1007
  }
997
1008
  );
1009
+ var REACT_LAZY_TYPE2 = /* @__PURE__ */ Symbol.for("react.lazy");
1010
+ function renderInsideChild2(children, render) {
1011
+ let child = children;
1012
+ const resolve = React6.use;
1013
+ if (typeof child === "object" && child !== null && child.$$typeof === REACT_LAZY_TYPE2 && typeof resolve === "function") {
1014
+ child = resolve(child._payload);
1015
+ }
1016
+ if (!React6.isValidElement(child)) return render(children);
1017
+ return React6.cloneElement(child, void 0, render(child.props.children));
1018
+ }
998
1019
  var IconButton = React6.forwardRef(
999
1020
  ({ className, variant: variantProp, color: colorProp, size: sizeProp, radius: radiusProp, asChild = false, loading, pressEffect, children, disabled: disabledProp, ...props }, ref) => {
1000
1021
  const groupContext = useButtonGroup();
@@ -1016,6 +1037,17 @@ var IconButton = React6.forwardRef(
1016
1037
  lg: "icon-lg"
1017
1038
  // 24px
1018
1039
  }[size || "default"];
1040
+ const renderContent = (content) => loading ? /* @__PURE__ */ React6.createElement(
1041
+ "svg",
1042
+ {
1043
+ className: cn(iconSize, "animate-spin"),
1044
+ fill: "none",
1045
+ viewBox: "0 0 24 24",
1046
+ "aria-hidden": "true"
1047
+ },
1048
+ /* @__PURE__ */ React6.createElement("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
1049
+ /* @__PURE__ */ React6.createElement("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
1050
+ ) : /* @__PURE__ */ React6.createElement("span", { className: cn(iconSize, "[&>svg]:w-full [&>svg]:h-full"), "aria-hidden": "true" }, content);
1019
1051
  return /* @__PURE__ */ React6.createElement(
1020
1052
  Comp,
1021
1053
  {
@@ -1025,17 +1057,7 @@ var IconButton = React6.forwardRef(
1025
1057
  "aria-busy": loading || void 0,
1026
1058
  ...props
1027
1059
  },
1028
- loading ? /* @__PURE__ */ React6.createElement(
1029
- "svg",
1030
- {
1031
- className: cn(iconSize, "animate-spin"),
1032
- fill: "none",
1033
- viewBox: "0 0 24 24",
1034
- "aria-hidden": "true"
1035
- },
1036
- /* @__PURE__ */ React6.createElement("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
1037
- /* @__PURE__ */ React6.createElement("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
1038
- ) : /* @__PURE__ */ React6.createElement("span", { className: cn(iconSize, "[&>svg]:w-full [&>svg]:h-full"), "aria-hidden": "true" }, children)
1060
+ asChild ? renderInsideChild2(children, renderContent) : renderContent(children)
1039
1061
  );
1040
1062
  }
1041
1063
  );
@@ -3527,6 +3549,16 @@ var dotColorMap = {
3527
3549
  error: "bg-error",
3528
3550
  info: "bg-info"
3529
3551
  };
3552
+ var REACT_LAZY_TYPE3 = /* @__PURE__ */ Symbol.for("react.lazy");
3553
+ function renderInsideChild3(children, render) {
3554
+ let child = children;
3555
+ const resolve = React21.use;
3556
+ if (typeof child === "object" && child !== null && child.$$typeof === REACT_LAZY_TYPE3 && typeof resolve === "function") {
3557
+ child = resolve(child._payload);
3558
+ }
3559
+ if (!React21.isValidElement(child)) return render(children);
3560
+ return React21.cloneElement(child, void 0, render(child.props.children));
3561
+ }
3530
3562
  var Badge = React21.forwardRef(
3531
3563
  ({
3532
3564
  className,
@@ -3547,6 +3579,43 @@ var Badge = React21.forwardRef(
3547
3579
  const colorClasses = colorMap[color][variant];
3548
3580
  const outlineClasses = variant === "outline" ? "border bg-transparent" : "";
3549
3581
  const dotColor = variant === "solid" ? "bg-current" : dotColorMap[color];
3582
+ const renderContent = (content) => /* @__PURE__ */ React21.createElement(React21.Fragment, null, dot && /* @__PURE__ */ React21.createElement(
3583
+ "span",
3584
+ {
3585
+ className: cn("shrink-0 rounded-full", badgeDotSizes[resolvedSize], dotColor),
3586
+ "aria-hidden": "true"
3587
+ }
3588
+ ), icon && /* @__PURE__ */ React21.createElement(
3589
+ "span",
3590
+ {
3591
+ className: cn("shrink-0 [&>svg]:w-full [&>svg]:h-full", badgeIconSizes[resolvedSize]),
3592
+ "aria-hidden": "true"
3593
+ },
3594
+ icon
3595
+ ), content, removable && !asChild && /* @__PURE__ */ React21.createElement(
3596
+ "button",
3597
+ {
3598
+ type: "button",
3599
+ className: "shrink-0 -mr-0.5 ml-0.5 rounded-full p-0.5 opacity-70 hover:opacity-100 transition-opacity focus-visible:focus-ring",
3600
+ onClick: (e) => {
3601
+ e.stopPropagation();
3602
+ onRemove?.();
3603
+ },
3604
+ "aria-label": "Remove"
3605
+ },
3606
+ /* @__PURE__ */ React21.createElement(
3607
+ "svg",
3608
+ {
3609
+ className: "w-3 h-3",
3610
+ fill: "none",
3611
+ viewBox: "0 0 24 24",
3612
+ stroke: "currentColor",
3613
+ strokeWidth: 2,
3614
+ "aria-hidden": "true"
3615
+ },
3616
+ /* @__PURE__ */ React21.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
3617
+ )
3618
+ ));
3550
3619
  return /* @__PURE__ */ React21.createElement(
3551
3620
  Comp,
3552
3621
  {
@@ -3559,46 +3628,7 @@ var Badge = React21.forwardRef(
3559
3628
  ),
3560
3629
  ...props
3561
3630
  },
3562
- dot && /* @__PURE__ */ React21.createElement(
3563
- "span",
3564
- {
3565
- className: cn("shrink-0 rounded-full", badgeDotSizes[resolvedSize], dotColor),
3566
- "aria-hidden": "true"
3567
- }
3568
- ),
3569
- icon && /* @__PURE__ */ React21.createElement(
3570
- "span",
3571
- {
3572
- className: cn("shrink-0 [&>svg]:w-full [&>svg]:h-full", badgeIconSizes[resolvedSize]),
3573
- "aria-hidden": "true"
3574
- },
3575
- icon
3576
- ),
3577
- children,
3578
- removable && /* @__PURE__ */ React21.createElement(
3579
- "button",
3580
- {
3581
- type: "button",
3582
- className: "shrink-0 -mr-0.5 ml-0.5 rounded-full p-0.5 opacity-70 hover:opacity-100 transition-opacity focus-visible:focus-ring",
3583
- onClick: (e) => {
3584
- e.stopPropagation();
3585
- onRemove?.();
3586
- },
3587
- "aria-label": "Remove"
3588
- },
3589
- /* @__PURE__ */ React21.createElement(
3590
- "svg",
3591
- {
3592
- className: "w-3 h-3",
3593
- fill: "none",
3594
- viewBox: "0 0 24 24",
3595
- stroke: "currentColor",
3596
- strokeWidth: 2,
3597
- "aria-hidden": "true"
3598
- },
3599
- /* @__PURE__ */ React21.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
3600
- )
3601
- )
3631
+ asChild ? renderInsideChild3(children, renderContent) : renderContent(children)
3602
3632
  );
3603
3633
  }
3604
3634
  );
@@ -4293,6 +4323,16 @@ function ChevronDownIcon({ className }) {
4293
4323
  function ChevronRightIcon2({ className }) {
4294
4324
  return /* @__PURE__ */ React25.createElement("svg", { className, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, "aria-hidden": "true" }, /* @__PURE__ */ React25.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 5l7 7-7 7" }));
4295
4325
  }
4326
+ var REACT_LAZY_TYPE4 = /* @__PURE__ */ Symbol.for("react.lazy");
4327
+ function renderInsideChild4(children, render) {
4328
+ let child = children;
4329
+ const resolve = React25.use;
4330
+ if (typeof child === "object" && child !== null && child.$$typeof === REACT_LAZY_TYPE4 && typeof resolve === "function") {
4331
+ child = resolve(child._payload);
4332
+ }
4333
+ if (!React25.isValidElement(child)) return render(children);
4334
+ return React25.cloneElement(child, void 0, render(child.props.children));
4335
+ }
4296
4336
  var contentRadiusMap3 = {
4297
4337
  sm: "rounded",
4298
4338
  // 4px
@@ -4642,7 +4682,10 @@ var NavigationMenuLink = React25.forwardRef(
4642
4682
  );
4643
4683
  }
4644
4684
  const Comp = asChild ? import_react_slot6.Slot : "a";
4685
+ const iconNode = icon && /* @__PURE__ */ React25.createElement("span", { className: cn("shrink-0", s.icon) }, icon);
4686
+ const childText = asChild && React25.isValidElement(children) ? children.props.children : children;
4645
4687
  if (inContent) {
4688
+ const renderContent2 = (content) => /* @__PURE__ */ React25.createElement(React25.Fragment, null, iconNode, !collapsed && content);
4646
4689
  return /* @__PURE__ */ React25.createElement(
4647
4690
  Comp,
4648
4691
  {
@@ -4660,10 +4703,10 @@ var NavigationMenuLink = React25.forwardRef(
4660
4703
  ...active ? { "aria-current": "page" } : {},
4661
4704
  ...props
4662
4705
  },
4663
- icon && /* @__PURE__ */ React25.createElement("span", { className: cn("shrink-0", s.icon) }, icon),
4664
- !collapsed && children
4706
+ asChild ? renderInsideChild4(children, renderContent2) : renderContent2(children)
4665
4707
  );
4666
4708
  }
4709
+ const renderContent = (content) => /* @__PURE__ */ React25.createElement(React25.Fragment, null, iconNode, !collapsed && /* @__PURE__ */ React25.createElement("span", { className: "truncate" }, content));
4667
4710
  return /* @__PURE__ */ React25.createElement(
4668
4711
  Comp,
4669
4712
  {
@@ -4679,11 +4722,10 @@ var NavigationMenuLink = React25.forwardRef(
4679
4722
  className
4680
4723
  ),
4681
4724
  ...active ? { "aria-current": "page" } : {},
4682
- ...collapsed && typeof children === "string" ? { title: children } : {},
4725
+ ...collapsed && typeof childText === "string" ? { title: childText } : {},
4683
4726
  ...props
4684
4727
  },
4685
- icon && /* @__PURE__ */ React25.createElement("span", { className: cn("shrink-0", s.icon) }, icon),
4686
- !collapsed && /* @__PURE__ */ React25.createElement("span", { className: "truncate" }, children)
4728
+ asChild ? renderInsideChild4(children, renderContent) : renderContent(children)
4687
4729
  );
4688
4730
  }
4689
4731
  );