myoperator-ui 0.0.108 → 0.0.110
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 +48 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2792,27 +2792,57 @@ export interface DialogContentProps
|
|
|
2792
2792
|
hideCloseButton?: boolean;
|
|
2793
2793
|
}
|
|
2794
2794
|
|
|
2795
|
+
// Helper to check if children contain DialogDescription
|
|
2796
|
+
const hasDialogDescription = (children: React.ReactNode): boolean => {
|
|
2797
|
+
let found = false;
|
|
2798
|
+
React.Children.forEach(children, (child) => {
|
|
2799
|
+
if (React.isValidElement(child)) {
|
|
2800
|
+
if (child.type === DialogDescription) {
|
|
2801
|
+
found = true;
|
|
2802
|
+
} else {
|
|
2803
|
+
const childProps = child.props as { children?: React.ReactNode };
|
|
2804
|
+
if (childProps.children) {
|
|
2805
|
+
if (hasDialogDescription(childProps.children)) {
|
|
2806
|
+
found = true;
|
|
2807
|
+
}
|
|
2808
|
+
}
|
|
2809
|
+
}
|
|
2810
|
+
}
|
|
2811
|
+
});
|
|
2812
|
+
return found;
|
|
2813
|
+
};
|
|
2814
|
+
|
|
2795
2815
|
const DialogContent = React.forwardRef<
|
|
2796
2816
|
React.ElementRef<typeof DialogPrimitive.Content>,
|
|
2797
2817
|
DialogContentProps
|
|
2798
|
-
>(({ className, children, size, hideCloseButton = false, ...props }, ref) =>
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
)
|
|
2818
|
+
>(({ className, children, size, hideCloseButton = false, ...props }, ref) => {
|
|
2819
|
+
const hasDescription = hasDialogDescription(children);
|
|
2820
|
+
|
|
2821
|
+
return (
|
|
2822
|
+
<DialogPortal>
|
|
2823
|
+
<DialogOverlay />
|
|
2824
|
+
<DialogPrimitive.Content
|
|
2825
|
+
ref={ref}
|
|
2826
|
+
className={cn(dialogContentVariants({ size, className }))}
|
|
2827
|
+
{...props}
|
|
2828
|
+
>
|
|
2829
|
+
{children}
|
|
2830
|
+
{/* Accessibility: Add hidden description if none provided */}
|
|
2831
|
+
{!hasDescription && (
|
|
2832
|
+
<DialogPrimitive.Description className="sr-only">
|
|
2833
|
+
Dialog content
|
|
2834
|
+
</DialogPrimitive.Description>
|
|
2835
|
+
)}
|
|
2836
|
+
{!hideCloseButton && (
|
|
2837
|
+
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
|
|
2838
|
+
<X className="h-4 w-4" />
|
|
2839
|
+
<span className="sr-only">Close</span>
|
|
2840
|
+
</DialogPrimitive.Close>
|
|
2841
|
+
)}
|
|
2842
|
+
</DialogPrimitive.Content>
|
|
2843
|
+
</DialogPortal>
|
|
2844
|
+
);
|
|
2845
|
+
});
|
|
2816
2846
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
2817
2847
|
|
|
2818
2848
|
const DialogHeader = ({
|