@ai-matrx/kit 0.5.0 → 0.5.2

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
@@ -868,7 +868,8 @@ function treeContainsComponent(node, Component) {
868
868
  (child) => treeContainsComponent(child, Component)
869
869
  );
870
870
  }
871
- if (typeof process !== "undefined" && true) {
871
+ const runtimeProcess = globalThis.process;
872
+ if (runtimeProcess?.env?.NODE_ENV !== "production") {
872
873
  const keys = typeof node === "object" ? ` with keys {${Object.keys(node).join(", ")}}` : "";
873
874
  console.error(
874
875
  `[treeContainsComponent] A non-renderable value${keys} is being passed as a React child. React will throw 'Objects are not valid as a React child' at the real render site. Stringify it (e.g. JSON.stringify) before rendering.`,
@@ -908,9 +909,9 @@ var AlertDialogDescription = React2.forwardRef(({ className, ...props }, ref) =>
908
909
  }
909
910
  ));
910
911
  AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
911
- var AlertDialogContent = React2.forwardRef(({ className, children, ...props }, ref) => {
912
+ var AlertDialogContent = React2.forwardRef(({ className, children, container, ...props }, ref) => {
912
913
  const hasDescription = treeContainsComponent(children, AlertDialogDescription) || treeContainsComponent(children, AlertDialogPrimitive.Description);
913
- return /* @__PURE__ */ jsxs(AlertDialogPortal, { children: [
914
+ return /* @__PURE__ */ jsxs(AlertDialogPortal, { container: container ?? void 0, children: [
914
915
  /* @__PURE__ */ jsx(AlertDialogOverlay, {}),
915
916
  /* @__PURE__ */ jsxs(
916
917
  AlertDialogContentPrimitive,
@@ -1019,36 +1020,44 @@ function ConfirmDialog({
1019
1020
  variant = "default",
1020
1021
  busy = false,
1021
1022
  confirmDisabled = false,
1023
+ portalContainer,
1022
1024
  onConfirm
1023
1025
  }) {
1024
- return /* @__PURE__ */ jsx2(AlertDialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs2(AlertDialogContent, { className: contentClassName, children: [
1025
- /* @__PURE__ */ jsxs2(AlertDialogHeader, { children: [
1026
- /* @__PURE__ */ jsx2(AlertDialogTitle, { children: title }),
1027
- description ? /* @__PURE__ */ jsx2(AlertDialogDescription, { children: description }) : null
1028
- ] }),
1029
- content ?? null,
1030
- /* @__PURE__ */ jsxs2(AlertDialogFooter, { children: [
1031
- cancelLabel === null ? null : /* @__PURE__ */ jsx2(AlertDialogCancel, { className: "max-lg:min-h-11", disabled: busy, children: cancelLabel }),
1032
- /* @__PURE__ */ jsxs2(
1033
- AlertDialogAction,
1034
- {
1035
- disabled: busy || confirmDisabled,
1036
- onClick: (event) => {
1037
- event.preventDefault();
1038
- void onConfirm();
1039
- },
1040
- className: cn(
1041
- "max-lg:min-h-11",
1042
- variant === "destructive" && "bg-destructive text-destructive-foreground hover:bg-destructive/90"
1043
- ),
1044
- children: [
1045
- busy ? /* @__PURE__ */ jsx2(SpinnerIcon, { className: "mr-2 h-4 w-4 animate-spin" }) : null,
1046
- confirmLabel
1047
- ]
1048
- }
1049
- )
1050
- ] })
1051
- ] }) });
1026
+ return /* @__PURE__ */ jsx2(AlertDialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs2(
1027
+ AlertDialogContent,
1028
+ {
1029
+ className: contentClassName,
1030
+ container: portalContainer ?? void 0,
1031
+ children: [
1032
+ /* @__PURE__ */ jsxs2(AlertDialogHeader, { children: [
1033
+ /* @__PURE__ */ jsx2(AlertDialogTitle, { children: title }),
1034
+ description ? /* @__PURE__ */ jsx2(AlertDialogDescription, { children: description }) : null
1035
+ ] }),
1036
+ content ?? null,
1037
+ /* @__PURE__ */ jsxs2(AlertDialogFooter, { children: [
1038
+ cancelLabel === null ? null : /* @__PURE__ */ jsx2(AlertDialogCancel, { className: "max-lg:min-h-11", disabled: busy, children: cancelLabel }),
1039
+ /* @__PURE__ */ jsxs2(
1040
+ AlertDialogAction,
1041
+ {
1042
+ disabled: busy || confirmDisabled,
1043
+ onClick: (event) => {
1044
+ event.preventDefault();
1045
+ void onConfirm();
1046
+ },
1047
+ className: cn(
1048
+ "max-lg:min-h-11",
1049
+ variant === "destructive" && "bg-destructive text-destructive-foreground hover:bg-destructive/90"
1050
+ ),
1051
+ children: [
1052
+ busy ? /* @__PURE__ */ jsx2(SpinnerIcon, { className: "mr-2 h-4 w-4 animate-spin" }) : null,
1053
+ confirmLabel
1054
+ ]
1055
+ }
1056
+ )
1057
+ ] })
1058
+ ]
1059
+ }
1060
+ ) });
1052
1061
  }
1053
1062
 
1054
1063
  // src/confirm/host.tsx