@sanity/ui 5.0.0-alpha.5 → 5.0.0-alpha.7

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.d.ts CHANGED
@@ -180,6 +180,47 @@ declare const DENSITY: readonly ["compact", "regular", "loose"];
180
180
  /** @public */
181
181
  export declare type Density = (typeof DENSITY)[number];
182
182
 
183
+ /**
184
+ * @beta
185
+ *
186
+ * Renders a modal dialog element — should not be used for nonmodal dialogs.
187
+ * Modal dialogs make their containing documents inert, and render on the topmost
188
+ * layer within that containing document; they must be dimissed before the containing
189
+ * document and its contents become unblocked. They also trap focus within the bounds
190
+ * of the dialog element and its descendants.
191
+ *
192
+ * For more on dialogs and modality, refer to the HTML specification for the dialog element:
193
+ * https://html.spec.whatwg.org/dev/interactive-elements.html#the-dialog-element
194
+ */
195
+ export declare const Dialog: typeof DialogRoot;
196
+
197
+ declare function DialogContent(props: ComponentProps<"div">): JSX.Element;
198
+
199
+ declare function DialogFooter(props: ComponentProps<"div">): JSX.Element;
200
+
201
+ /** @beta */
202
+ export declare interface DialogProps extends Omit<
203
+ React.ComponentProps<"dialog">,
204
+ "open"
205
+ > {
206
+ /** Text to be displayed as the dialog's heading; optional but recommended for optimal accessibility and presentation */
207
+ header?: string;
208
+ /** Used to set the value of open to false. Fires whenever the dialog is closed, either programmatically or by the user (via Esc key, clicking background, clicking the dialog's close button, or any other means.) */
209
+ onClose: React.ReactEventHandler<HTMLDialogElement>;
210
+ /** Whether the dialog is open; defaults to false. */
211
+ open?: boolean;
212
+ /** Max width of the dialog */
213
+ size?: Responsive<ContainerSize>;
214
+ }
215
+
216
+ declare function DialogRoot({ open, size, ...props }: DialogProps): JSX.Element;
217
+
218
+ declare namespace DialogRoot {
219
+ var displayName: string;
220
+ var Content: typeof DialogContent;
221
+ var Footer: typeof DialogFooter;
222
+ }
223
+
183
224
  declare const DISPLAY_BLOCK: readonly ["block", "inline-block", "none"];
184
225
 
185
226
  declare const DISPLAY_FLEX: readonly ["flex", "inline-flex", "none"];
@@ -641,45 +682,6 @@ export declare type MarginProps = {
641
682
  marginLeft?: Responsive<SpaceAutoNegative>;
642
683
  };
643
684
 
644
- /**
645
- * @beta
646
- *
647
- * Renders a modal dialog element — should not be used for nonmodal dialogs.
648
- * Modal dialogs make their containing documents inert, and render on the topmost
649
- * layer within that containing document; they must be dimissed before the containing
650
- * document and its contents become unblocked. They also trap focus within the bounds
651
- * of the modal element and its descendants.
652
- *
653
- * For more on dialogs and modality, refer to the HTML specification for the dialog element:
654
- * https://html.spec.whatwg.org/dev/interactive-elements.html#the-dialog-element
655
- */
656
- export declare const Modal: typeof ModalRoot;
657
-
658
- declare function ModalContent(props: ComponentProps<"div">): JSX.Element;
659
-
660
- declare function ModalFooter(props: ComponentProps<"div">): JSX.Element;
661
-
662
- /** @beta */
663
- export declare interface ModalProps extends Omit<
664
- React.ComponentProps<"dialog">,
665
- "open"
666
- > {
667
- /** Text to be displayed as the modal's heading; optional but recommended for optimal accessibility and presentation */
668
- header?: string;
669
- /** Used to set the value of open to false. Fires whenever the modal is closed, either programmatically or by the user (via Esc key, clicking background, clicking the modal's close button, or any other means.) */
670
- onClose: React.ReactEventHandler<HTMLDialogElement>;
671
- /** Whether the modal is open; defaults to false. */
672
- open?: boolean;
673
- }
674
-
675
- declare function ModalRoot(props: ModalProps): JSX.Element;
676
-
677
- declare namespace ModalRoot {
678
- var displayName: string;
679
- var Content: typeof ModalContent;
680
- var Footer: typeof ModalFooter;
681
- }
682
-
683
685
  declare const OVERFLOW: readonly [
684
686
  "visible",
685
687
  "hidden",
@@ -742,6 +744,33 @@ export declare type PlacementProps = {
742
744
  placement?: Placement;
743
745
  };
744
746
 
747
+ /** @beta */
748
+ export declare const Popover: typeof PopoverRoot & {
749
+ forwardsTriggerProps: boolean;
750
+ };
751
+
752
+ /** @beta */
753
+ export declare interface PopoverProps
754
+ extends
755
+ Omit<React.ComponentProps<"div">, "children" | "content">,
756
+ PlacementProps {
757
+ /** Anchor name for positioning */
758
+ anchorName?: React.ReactNode;
759
+ /** Focusable trigger element */
760
+ children: React.ReactElement<Record<string, unknown>>;
761
+ /** Popover content */
762
+ content?: React.ReactNode;
763
+ /** Render tooltip in portal */
764
+ portal?: boolean;
765
+ }
766
+
767
+ declare function PopoverRoot({
768
+ placement,
769
+ ...props
770
+ }: PopoverProps & {
771
+ triggerProps?: Record<string, unknown>;
772
+ }): JSX.Element;
773
+
745
774
  declare const POSITION: readonly [
746
775
  "absolute",
747
776
  "fixed",
@@ -952,8 +981,8 @@ declare type ToneProps = {
952
981
  tone?: Tone;
953
982
  };
954
983
 
955
- /** @public */
956
- export declare function Tooltip({ placement, ...props }: TooltipProps): any;
984
+ /** @beta */
985
+ export declare const Tooltip: typeof TooltipRoot;
957
986
 
958
987
  /** @public */
959
988
  export declare function TooltipGroup<T extends ElementType = "div">(
@@ -969,15 +998,28 @@ export declare interface TooltipGroupProps<
969
998
  as?: T;
970
999
  }
971
1000
 
972
- /** @public */
1001
+ /** @beta */
973
1002
  export declare interface TooltipProps
974
- extends React.ComponentProps<"div">, PlacementProps {
975
- /** Tooltip text */
976
- text?: React.ReactNode;
977
- /** Disabled state */
978
- disabled?: boolean;
1003
+ extends
1004
+ Omit<React.ComponentProps<"div">, "children" | "content">,
1005
+ PlacementProps {
1006
+ /** Anchor name for positioning */
1007
+ anchorName?: React.ReactNode;
1008
+ /** Focusable trigger element */
1009
+ children: React.ReactElement<Record<string, unknown>>;
1010
+ /** Tooltip content */
1011
+ content?: React.ReactNode;
1012
+ /** Render tooltip in portal */
1013
+ portal?: boolean;
979
1014
  }
980
1015
 
1016
+ declare function TooltipRoot({
1017
+ placement,
1018
+ ...props
1019
+ }: TooltipProps & {
1020
+ triggerProps?: Record<string, unknown>;
1021
+ }): JSX.Element;
1022
+
981
1023
  /** @public */
982
1024
  export declare interface TypographyProps extends MarginProps, ToneProps {
983
1025
  /** CSS **text-align** property */
@@ -992,6 +1034,9 @@ export declare interface TypographyProps extends MarginProps, ToneProps {
992
1034
  weight?: FontWeight;
993
1035
  }
994
1036
 
1037
+ /** @public */
1038
+ export declare function useIsClient(): boolean;
1039
+
995
1040
  /** @public */
996
1041
  export declare function VisuallyHidden<T extends ElementType = "span">(
997
1042
  props: VisuallyHiddenProps<T> &