sanity 6.3.1-next.16 → 6.3.1-next.4

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.
@@ -2,7 +2,7 @@ import { CSSProperties, Component, ComponentProps, ComponentType, Dispatch, Elem
2
2
  import { ArraySchemaType, AssetMetadataType, AssetSource, AssetSourceSpec, BlockDecoratorDefinition, BlockListDefinition, BlockStyleDefinition, BooleanSchemaType, ConditionalProperty, CrossDatasetReferenceSchemaType, CrossDatasetReferenceValue, CrossDatasetType, CurrentUser, DeprecatedProperty, DocumentSystem, FieldGroup, File as File$1, FileAsset, FileSchemaType, FileValue, FormNodeValidation, GeopointValue, GlobalDocumentReferenceType, I18nTextRecord, Image, ImageAsset, ImageSchemaType, ImageUrlFitMode, ImageValue, IndexTuple, InitialValueProperty, InitialValueResolverContext, IntrinsicTypeName, KeyedObject, KeyedSegment, MendozaEffectPair, NumberSchemaType, ObjectField, ObjectFieldType, ObjectSchemaType, PatchOperations, Path, PathSegment, PortableTextBlock, PortableTextObject, PortableTextTextBlock, PrepareViewOptions, PreviewValue, Reference, ReferenceSchemaType, ReferenceValue, Role, RuleClass, SanityDocument, SanityDocumentLike, Schema, SchemaType, SchemaTypeDefinition, SearchStrategy, SlugSchemaType, SlugValue, SortOrdering, StrictVersionLayeringOptions, StringSchemaType, TextSchemaType, TransactionLogEventWithEffects, TransactionLogEventWithMutations, UploadState, User, ValidationMarker } from "@sanity/types";
3
3
  import { BifurClient } from "@sanity/bifur-client";
4
4
  import { ClientConfig, ClientPerspective, QueryParams, ReconnectEvent, ReleaseDocument, ReleaseDocument as ReleaseDocument$1, ReleaseType, ResetEvent, SanityClient, SanityDocument as SanityDocument$1, SingleActionResult, SingleMutationResult, StackablePerspective, WelcomeBackEvent, WelcomeEvent } from "@sanity/client";
5
- import { AvatarPosition, AvatarProps, AvatarSize, AvatarStatus, BadgeProps, BadgeTone, BoxProps, ButtonProps, ButtonTone, DialogProps, HotkeysProps, MenuButtonProps, MenuItem, Placement, PopoverProps, ResponsivePaddingProps, ResponsiveWidthProps, TextProps, ThemeColorSchemeKey, ToastParams, TooltipProps } from "@sanity/ui";
5
+ import { AvatarPosition, AvatarProps, AvatarSize, AvatarStatus, BadgeProps, BadgeTone, BoxProps, ButtonProps, ButtonTone, CardProps, DialogProps, HotkeysProps, MenuButtonProps, MenuItem, Placement, PopoverProps, ResponsivePaddingProps, ResponsiveWidthProps, Text, TextProps, ThemeColorSchemeKey, ToastParams, TooltipProps } from "@sanity/ui";
6
6
  import { FlatNamespace, KeyPrefix, Namespace, TFunction, TFunction as TFunction$1, i18n as i18n$1 } from "i18next";
7
7
  import { MonoTypeOperatorFunction, Observable, OperatorFunction, Subject } from "rxjs";
8
8
  import { IntentLinkProps, IntentParameters, Router, RouterState, SearchParam } from "sanity/router";
@@ -573,7 +573,7 @@ interface CommandListProps<T = any> extends ResponsivePaddingProps {
573
573
  * @internal
574
574
  */
575
575
  declare const CommandList: import("react").NamedExoticComponent<CommandListProps<any> & import("react").RefAttributes<CommandListHandle>>;
576
- type BaseButtonProps = Pick<ButtonProps<ElementType>, 'as' | 'icon' | 'iconRight' | 'justify' | 'loading' | 'mode' | 'paddingY' | 'paddingLeft' | 'selected' | 'tone' | 'type' | 'width'> & {
576
+ type BaseButtonProps = Pick<ButtonProps, 'as' | 'icon' | 'iconRight' | 'justify' | 'loading' | 'mode' | 'paddingY' | 'paddingLeft' | 'selected' | 'tone' | 'type' | 'width'> & {
577
577
  size?: 'default' | 'large';
578
578
  radius?: 'full';
579
579
  };
@@ -597,10 +597,10 @@ type ButtonProps$1 = BaseButtonProps & (ButtonWithText | IconButton);
597
597
  *
598
598
  * @internal
599
599
  */
600
- declare const Button: import("react").ForwardRefExoticComponent<(Omit<Pick<ButtonProps<ElementType>, "as" | "icon" | "iconRight" | "justify" | "loading" | "mode" | "paddingLeft" | "paddingY" | "selected" | "tone" | "type" | "width"> & {
600
+ declare const Button: import("react").ForwardRefExoticComponent<(Omit<Pick<ButtonProps, "as" | "icon" | "iconRight" | "justify" | "loading" | "mode" | "paddingLeft" | "paddingY" | "selected" | "tone" | "type" | "width"> & {
601
601
  size?: 'default' | 'large';
602
602
  radius?: 'full';
603
- } & ButtonWithText & Omit<HTMLProps<HTMLButtonElement>, "as" | "size" | "title">, "ref"> | Omit<Pick<ButtonProps<ElementType>, "as" | "icon" | "iconRight" | "justify" | "loading" | "mode" | "paddingLeft" | "paddingY" | "selected" | "tone" | "type" | "width"> & {
603
+ } & ButtonWithText & Omit<HTMLProps<HTMLButtonElement>, "as" | "size" | "title">, "ref"> | Omit<Pick<ButtonProps, "as" | "icon" | "iconRight" | "justify" | "loading" | "mode" | "paddingLeft" | "paddingY" | "selected" | "tone" | "type" | "width"> & {
604
604
  size?: 'default' | 'large';
605
605
  radius?: 'full';
606
606
  } & IconButton & Omit<HTMLProps<HTMLButtonElement>, "as" | "size" | "title">, "ref">) & import("react").RefAttributes<HTMLButtonElement>>;
@@ -640,9 +640,7 @@ declare function getDocumentVariantType(documentId: string): DocumentVariantType
640
640
  /**
641
641
  * @internal
642
642
  */
643
- declare const Chip: import("react").ForwardRefExoticComponent<Omit<Omit<any, "as" | keyof import("@sanity/ui").ButtonOwnProps> & import("@sanity/ui").ButtonOwnProps & {
644
- as?: import("@sanity/ui").ElementType<any> | undefined;
645
- }, "ref"> & import("react").RefAttributes<unknown>>;
643
+ declare const Chip: import("react").ForwardRefExoticComponent<Omit<Omit<import("@sanity/ui").ButtonProps & Omit<import("react").HTMLProps<HTMLButtonElement>, "as" | "width">, "ref"> & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<unknown>>;
646
644
  /**
647
645
  *
648
646
  * Checks if the document ID `documentId` has the same ID as `equalsDocumentId`,
@@ -6478,7 +6476,7 @@ interface CommentsListProps {
6478
6476
  * @beta
6479
6477
  * @hidden
6480
6478
  */
6481
- declare const CommentsList: import("react").NamedExoticComponent<CommentsListProps & import("react").RefAttributes<HTMLUListElement>>;
6479
+ declare const CommentsList: import("react").NamedExoticComponent<CommentsListProps & import("react").RefAttributes<HTMLDivElement>>;
6482
6480
  /**
6483
6481
  * @internal
6484
6482
  */
@@ -7723,7 +7721,7 @@ interface DiffInspectWrapperProps {
7723
7721
  as?: ExecutionProps['as'];
7724
7722
  }
7725
7723
  /** @internal */
7726
- declare function DiffInspectWrapper(props: DiffInspectWrapperProps & Omit<BoxProps, 'as'>): React.JSX.Element;
7724
+ declare function DiffInspectWrapper(props: DiffInspectWrapperProps & BoxProps): React.JSX.Element;
7727
7725
  /** @internal */
7728
7726
  declare function DiffStringSegment(props: {
7729
7727
  segment: StringDiffSegment;
@@ -10174,9 +10172,7 @@ interface PreviewCardContextValue {
10174
10172
  /** @internal */
10175
10173
  declare function usePreviewCard(): PreviewCardContextValue;
10176
10174
  /** @internal */
10177
- declare const PreviewCard: import("react").ForwardRefExoticComponent<Omit<Omit<any, "as" | keyof import("@sanity/ui").CardOwnProps> & import("@sanity/ui").CardOwnProps & {
10178
- as?: ElementType | undefined;
10179
- } & Omit<HTMLProps<HTMLDivElement>, "height">, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
10175
+ declare const PreviewCard: import("react").ForwardRefExoticComponent<Omit<CardProps & Omit<HTMLProps<HTMLDivElement>, "height">, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
10180
10176
  /**
10181
10177
  * This is a workaround for a circular import issue.
10182
10178
  * Calling `styled(PreviewCard)` at program load time triggered a build error with the commonjs bundle because it tried
@@ -10184,11 +10180,7 @@ declare const PreviewCard: import("react").ForwardRefExoticComponent<Omit<Omit<a
10184
10180
  * The workaround is to colocate the styled component with the component itself.
10185
10181
  * @internal
10186
10182
  */
10187
- declare const ReferenceInputPreviewCard: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<any, "as" | keyof import("@sanity/ui").CardOwnProps> & import("@sanity/ui").CardOwnProps & {
10188
- as?: ElementType | undefined;
10189
- } & Omit<HTMLProps<HTMLDivElement>, "height">, "ref"> & import("react").RefAttributes<HTMLDivElement>, never>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<Omit<any, "as" | keyof import("@sanity/ui").CardOwnProps> & import("@sanity/ui").CardOwnProps & {
10190
- as?: ElementType | undefined;
10191
- } & Omit<HTMLProps<HTMLDivElement>, "height">, "ref"> & import("react").RefAttributes<HTMLDivElement>>, keyof import("react").Component<any, {}, any>>;
10183
+ declare const ReferenceInputPreviewCard: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<CardProps & Omit<HTMLProps<HTMLDivElement>, "height">, "ref"> & import("react").RefAttributes<HTMLDivElement>, never>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<CardProps & Omit<HTMLProps<HTMLDivElement>, "height">, "ref"> & import("react").RefAttributes<HTMLDivElement>>, keyof import("react").Component<any, {}, any>>;
10192
10184
  /**
10193
10185
  * Portable text preview layout key
10194
10186
  *
@@ -10399,7 +10391,7 @@ interface ResizableProps {
10399
10391
  * @internal
10400
10392
  * Provides a resizable container with a resizer handle.
10401
10393
  */
10402
- declare function Resizable(props: ResizableProps & BoxProps<ElementType> & Omit<HTMLProps<HTMLDivElement>, 'as'>): import("react").JSX.Element;
10394
+ declare function Resizable(props: ResizableProps & BoxProps & Omit<HTMLProps<HTMLDivElement>, 'as'>): import("react").JSX.Element;
10403
10395
  /**
10404
10396
  * @hidden
10405
10397
  * @beta */
@@ -10457,10 +10449,10 @@ type StatusButtonProps = ButtonProps$1 & {
10457
10449
  /** @hidden @beta */
10458
10450
  declare const StatusButton: import("react").ForwardRefExoticComponent<(StatusButtonProps & Omit<HTMLProps<HTMLButtonElement>, "disabled" | "ref" | "size" | "title">) & import("react").RefAttributes<HTMLButtonElement>>;
10459
10451
  /** @internal */
10460
- type TextWithToneProps = TextProps & {
10452
+ interface TextWithToneProps extends ComponentProps<typeof Text> {
10461
10453
  tone: ButtonTone;
10462
10454
  dimmed?: boolean;
10463
- };
10455
+ }
10464
10456
  /** @internal */
10465
10457
  declare const TextWithTone: import("react").ForwardRefExoticComponent<Omit<TextWithToneProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
10466
10458
  /** @internal */
@@ -726,7 +726,7 @@ interface UseDocumentTitle {
726
726
  */
727
727
  declare function useDocumentTitle(): UseDocumentTitle;
728
728
  interface DocumentInspectorHeaderProps {
729
- as?: ElementType;
729
+ as?: CardProps['as'];
730
730
  closeButtonLabel: string;
731
731
  flex?: CardProps['flex'];
732
732
  onClose: () => void;
@@ -64,11 +64,11 @@ function ConfirmPopoverContent(t0) {
64
64
  let t6;
65
65
  $[8] !== cancelButtonText || $[9] !== t ? (t6 = cancelButtonText || t("common.dialog.cancel-button.text"), $[8] = cancelButtonText, $[9] = t, $[10] = t6) : t6 = $[10];
66
66
  let t7;
67
- $[11] !== cancelButtonIcon || $[12] !== onCancel || $[13] !== t6 ? (t7 = /* @__PURE__ */ jsx(Button, { "data-testid": "confirm-popover-cancel-button", icon: cancelButtonIcon, onClick: onCancel, mode: "ghost", padding: 2, text: t6 }), $[11] = cancelButtonIcon, $[12] = onCancel, $[13] = t6, $[14] = t7) : t7 = $[14];
67
+ $[11] !== cancelButtonIcon || $[12] !== onCancel || $[13] !== t6 ? (t7 = /* @__PURE__ */ jsx(Button, { "data-testid": "confirm-popover-cancel-button", icon: cancelButtonIcon, onClick: onCancel, mode: "ghost", padding: 2, text: t6, size: 1 }), $[11] = cancelButtonIcon, $[12] = onCancel, $[13] = t6, $[14] = t7) : t7 = $[14];
68
68
  let t8;
69
69
  $[15] !== confirmButtonText || $[16] !== t ? (t8 = confirmButtonText || t("common.dialog.confirm-button.text"), $[15] = confirmButtonText, $[16] = t, $[17] = t8) : t8 = $[17];
70
70
  let t9;
71
- $[18] !== confirmButtonIcon || $[19] !== onConfirm || $[20] !== t8 || $[21] !== tone ? (t9 = /* @__PURE__ */ jsx(Button, { "data-testid": "confirm-popover-confirm-button", icon: confirmButtonIcon, onClick: onConfirm, padding: 2, text: t8, tone }), $[18] = confirmButtonIcon, $[19] = onConfirm, $[20] = t8, $[21] = tone, $[22] = t9) : t9 = $[22];
71
+ $[18] !== confirmButtonIcon || $[19] !== onConfirm || $[20] !== t8 || $[21] !== tone ? (t9 = /* @__PURE__ */ jsx(Button, { "data-testid": "confirm-popover-confirm-button", icon: confirmButtonIcon, onClick: onConfirm, padding: 2, text: t8, tone, size: 1 }), $[18] = confirmButtonIcon, $[19] = onConfirm, $[20] = t8, $[21] = tone, $[22] = t9) : t9 = $[22];
72
72
  let t10;
73
73
  $[23] !== t7 || $[24] !== t9 ? (t10 = /* @__PURE__ */ jsx(Box, { paddingX: 4, paddingY: 3, style: t5, children: /* @__PURE__ */ jsxs(Grid, { columns: 2, gap: 2, children: [
74
74
  t7,
@@ -1 +1 @@
1
- {"version":3,"file":"MenuGroup.js","sources":["../../src/ui-components/confirmPopover/ConfirmPopover.tsx","../../src/ui-components/menuGroup/MenuGroup.tsx"],"sourcesContent":["/* oxlint-disable no-restricted-imports, @sanity/i18n/no-i18next-import */\nimport {\n Box,\n Button as UIButton,\n Flex,\n Grid,\n Popover as UIPopover,\n type PopoverProps as UIPopoverProps,\n Text,\n useClickOutsideEvent,\n useGlobalKeyDown,\n useLayer,\n} from '@sanity/ui'\nimport {type ComponentType, type ReactNode, useCallback, useRef} from 'react'\nimport {useTranslation} from 'react-i18next'\n\nexport interface ConfirmPopoverProps {\n cancelButtonIcon?: ReactNode | ComponentType\n cancelButtonText?: string\n confirmButtonIcon?: ReactNode | ComponentType\n confirmButtonText?: string\n message: ReactNode\n onCancel: () => void\n onConfirm: () => void\n open: boolean\n referenceElement: HTMLElement | null\n tone?: 'default' | 'primary' | 'positive' | 'caution' | 'critical' | 'neutral' | 'suggest'\n placement?: UIPopoverProps['placement']\n fallbackPlacements?: UIPopoverProps['fallbackPlacements']\n}\n\n/**\n * A popover component for inline confirmation dialogs.\n * Follows the same pattern as document action confirm dialogs.\n *\n * @internal\n */\nexport function ConfirmPopover({\n cancelButtonIcon,\n cancelButtonText,\n confirmButtonIcon,\n confirmButtonText,\n message,\n onCancel,\n onConfirm,\n open,\n referenceElement,\n tone = 'critical',\n placement = 'top',\n fallbackPlacements = ['left', 'bottom'],\n}: ConfirmPopoverProps) {\n if (!open) return null\n\n return (\n <UIPopover\n content={\n <ConfirmPopoverContent\n cancelButtonIcon={cancelButtonIcon}\n cancelButtonText={cancelButtonText}\n confirmButtonIcon={confirmButtonIcon}\n confirmButtonText={confirmButtonText}\n message={message}\n onCancel={onCancel}\n onConfirm={onConfirm}\n tone={tone}\n />\n }\n constrainSize\n fallbackPlacements={fallbackPlacements}\n open\n placement={placement}\n portal\n preventOverflow\n referenceElement={referenceElement}\n />\n )\n}\n\nfunction ConfirmPopoverContent({\n cancelButtonIcon,\n cancelButtonText,\n confirmButtonIcon,\n confirmButtonText,\n message,\n onCancel,\n onConfirm,\n tone,\n}: Omit<ConfirmPopoverProps, 'open' | 'referenceElement' | 'placement' | 'fallbackPlacements'>) {\n const {t} = useTranslation()\n const {isTopLayer} = useLayer()\n const ref = useRef<HTMLDivElement | null>(null)\n\n const handleGlobalKeyDown = useCallback(\n (event: KeyboardEvent) => {\n if (event.key === 'Escape' && isTopLayer) onCancel()\n },\n [isTopLayer, onCancel],\n )\n\n useGlobalKeyDown(handleGlobalKeyDown)\n useClickOutsideEvent(isTopLayer && onCancel, () => [ref.current])\n\n return (\n <Flex direction=\"column\" ref={ref} style={{minWidth: 280, maxWidth: 350}}>\n <Box flex={1} overflow=\"auto\" padding={4}>\n <Text size={1}>{message}</Text>\n </Box>\n <Box paddingX={4} paddingY={3} style={{borderTop: '1px solid var(--card-border-color)'}}>\n <Grid columns={2} gap={2}>\n <UIButton\n data-testid=\"confirm-popover-cancel-button\"\n icon={cancelButtonIcon}\n onClick={onCancel}\n mode=\"ghost\"\n padding={2}\n text={cancelButtonText || t('common.dialog.cancel-button.text')}\n />\n <UIButton\n data-testid=\"confirm-popover-confirm-button\"\n icon={confirmButtonIcon}\n onClick={onConfirm}\n padding={2}\n text={confirmButtonText || t('common.dialog.confirm-button.text')}\n tone={tone}\n />\n </Grid>\n </Box>\n </Flex>\n )\n}\n","/* oxlint-disable no-restricted-imports */\nimport {MenuGroup as UIMenuGroup, type MenuGroupProps as UIMenuGroupProps} from '@sanity/ui'\nimport {type ComponentProps} from 'react'\n\nimport {Tooltip, type TooltipProps} from '../tooltip/Tooltip'\n\n/** @internal */\nexport type MenuGroupProps = Pick<UIMenuGroupProps, 'icon' | 'popover' | 'text' | 'tone'>\n\n/**\n * Customized Sanity UI <MenuGroup> component with pre-defined layout options.\n *\n * @internal\n */\nexport const MenuGroup = (\n props: MenuGroupProps &\n Omit<ComponentProps<'button'>, 'as' | 'height' | 'ref' | 'tabIndex' | 'popover'> & {\n tooltipProps?: TooltipProps | null\n },\n) => {\n const {tooltipProps, ...rest} = props\n\n const children = <UIMenuGroup {...rest} fontSize={1} padding={3} />\n\n if (tooltipProps) {\n return (\n <Tooltip content={tooltipProps?.content} portal {...tooltipProps}>\n {/* This div is needed to make the tooltip work in disabled menu items */}\n <div>{children}</div>\n </Tooltip>\n )\n }\n\n return children\n}\n"],"names":["ConfirmPopover","t0","$","_c","cancelButtonIcon","cancelButtonText","confirmButtonIcon","confirmButtonText","message","onCancel","onConfirm","open","referenceElement","tone","t1","placement","t2","fallbackPlacements","t3","undefined","t4","t5","t6","UIPopover","ConfirmPopoverContent","t","useTranslation","isTopLayer","useLayer","ref","useRef","event","key","useGlobalKeyDown","Symbol","for","current","useClickOutsideEvent","minWidth","maxWidth","borderTop","t7","UIButton","t8","t9","t10","t11","MenuGroup","props","rest","tooltipProps","UIMenuGroup","children","content"],"mappings":";;;;;;AAqCO,SAAAA,eAAAC,IAAA;AAAA,QAAAC,IAAAC,EAAA,EAAA,GAAwB;AAAA,IAAAC;AAAAA,IAAAC;AAAAA,IAAAC;AAAAA,IAAAC;AAAAA,IAAAC;AAAAA,IAAAC;AAAAA,IAAAC;AAAAA,IAAAC;AAAAA,IAAAC;AAAAA,IA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AAAhD,QAAAgB,MAAAA,KAAAhB,EAAA,EAAA,GAHVgB;AAAAA,EAGU;AAEb,SAEMkC;AAAQ;"}
1
+ {"version":3,"file":"MenuGroup.js","sources":["../../src/ui-components/confirmPopover/ConfirmPopover.tsx","../../src/ui-components/menuGroup/MenuGroup.tsx"],"sourcesContent":["/* oxlint-disable no-restricted-imports, @sanity/i18n/no-i18next-import */\nimport {\n Box,\n Button as UIButton,\n Flex,\n Grid,\n Popover as UIPopover,\n type PopoverProps as UIPopoverProps,\n Text,\n useClickOutsideEvent,\n useGlobalKeyDown,\n useLayer,\n} from '@sanity/ui'\nimport {type ComponentType, type ReactNode, useCallback, useRef} from 'react'\nimport {useTranslation} from 'react-i18next'\n\nexport interface ConfirmPopoverProps {\n cancelButtonIcon?: ReactNode | ComponentType\n cancelButtonText?: string\n confirmButtonIcon?: ReactNode | ComponentType\n confirmButtonText?: string\n message: ReactNode\n onCancel: () => void\n onConfirm: () => void\n open: boolean\n referenceElement: HTMLElement | null\n tone?: 'default' | 'primary' | 'positive' | 'caution' | 'critical' | 'neutral' | 'suggest'\n placement?: UIPopoverProps['placement']\n fallbackPlacements?: UIPopoverProps['fallbackPlacements']\n}\n\n/**\n * A popover component for inline confirmation dialogs.\n * Follows the same pattern as document action confirm dialogs.\n *\n * @internal\n */\nexport function ConfirmPopover({\n cancelButtonIcon,\n cancelButtonText,\n confirmButtonIcon,\n confirmButtonText,\n message,\n onCancel,\n onConfirm,\n open,\n referenceElement,\n tone = 'critical',\n placement = 'top',\n fallbackPlacements = ['left', 'bottom'],\n}: ConfirmPopoverProps) {\n if (!open) return null\n\n return (\n <UIPopover\n content={\n <ConfirmPopoverContent\n cancelButtonIcon={cancelButtonIcon}\n cancelButtonText={cancelButtonText}\n confirmButtonIcon={confirmButtonIcon}\n confirmButtonText={confirmButtonText}\n message={message}\n onCancel={onCancel}\n onConfirm={onConfirm}\n tone={tone}\n />\n }\n constrainSize\n fallbackPlacements={fallbackPlacements}\n open\n placement={placement}\n portal\n preventOverflow\n referenceElement={referenceElement}\n />\n )\n}\n\nfunction ConfirmPopoverContent({\n cancelButtonIcon,\n cancelButtonText,\n confirmButtonIcon,\n confirmButtonText,\n message,\n onCancel,\n onConfirm,\n tone,\n}: Omit<ConfirmPopoverProps, 'open' | 'referenceElement' | 'placement' | 'fallbackPlacements'>) {\n const {t} = useTranslation()\n const {isTopLayer} = useLayer()\n const ref = useRef<HTMLDivElement | null>(null)\n\n const handleGlobalKeyDown = useCallback(\n (event: KeyboardEvent) => {\n if (event.key === 'Escape' && isTopLayer) onCancel()\n },\n [isTopLayer, onCancel],\n )\n\n useGlobalKeyDown(handleGlobalKeyDown)\n useClickOutsideEvent(isTopLayer && onCancel, () => [ref.current])\n\n return (\n <Flex direction=\"column\" ref={ref} style={{minWidth: 280, maxWidth: 350}}>\n <Box flex={1} overflow=\"auto\" padding={4}>\n <Text size={1}>{message}</Text>\n </Box>\n <Box paddingX={4} paddingY={3} style={{borderTop: '1px solid var(--card-border-color)'}}>\n <Grid columns={2} gap={2}>\n <UIButton\n data-testid=\"confirm-popover-cancel-button\"\n icon={cancelButtonIcon}\n onClick={onCancel}\n mode=\"ghost\"\n padding={2}\n text={cancelButtonText || t('common.dialog.cancel-button.text')}\n size={1}\n />\n <UIButton\n data-testid=\"confirm-popover-confirm-button\"\n icon={confirmButtonIcon}\n onClick={onConfirm}\n padding={2}\n text={confirmButtonText || t('common.dialog.confirm-button.text')}\n tone={tone}\n size={1}\n />\n </Grid>\n </Box>\n </Flex>\n )\n}\n","/* oxlint-disable no-restricted-imports */\nimport {MenuGroup as UIMenuGroup, type MenuGroupProps as UIMenuGroupProps} from '@sanity/ui'\nimport {type HTMLProps} from 'react'\n\nimport {Tooltip, type TooltipProps} from '../tooltip/Tooltip'\n\n/** @internal */\nexport type MenuGroupProps = Pick<UIMenuGroupProps, 'icon' | 'popover' | 'text' | 'tone'>\n\n/**\n * Customized Sanity UI <MenuGroup> component with pre-defined layout options.\n *\n * @internal\n */\nexport const MenuGroup = (\n props: MenuGroupProps &\n Omit<HTMLProps<HTMLDivElement>, 'as' | 'height' | 'ref' | 'tabIndex' | 'popover'> & {\n tooltipProps?: TooltipProps | null\n },\n) => {\n const {tooltipProps, ...rest} = props\n\n const children = <UIMenuGroup {...rest} fontSize={1} padding={3} />\n\n if (tooltipProps) {\n return (\n <Tooltip content={tooltipProps?.content} portal {...tooltipProps}>\n {/* This div is needed to make the tooltip work in disabled menu items */}\n <div>{children}</div>\n </Tooltip>\n )\n }\n\n return children\n}\n"],"names":["ConfirmPopover","t0","$","_c","cancelButtonIcon","cancelButtonText","confirmButtonIcon","confirmButtonText","message","onCancel","onConfirm","open","referenceElement","tone","t1","placement","t2","fallbackPlacements","t3","undefined","t4","t5","t6","UIPopover","ConfirmPopoverContent","t","useTranslation","isTopLayer","useLayer","ref","useRef","event","key","useGlobalKeyDown","Symbol","for","current","useClickOutsideEvent","minWidth","maxWidth","borderTop","t7","UIButton","t8","t9","t10","t11","MenuGroup","props","rest","tooltipProps","UIMenuGroup","children","content"],"mappings":";;;;;;AAqCO,SAAAA,eAAAC,IAAA;AAAA,QAAAC,IAAAC,EAAA,EAAA,GAAwB;AAAA,IAAAC;AAAAA,IAAAC;AAAAA,IAAAC;AAAAA,IAAAC;AAAAA,IAAAC;AAAAA,IAAAC;AAAAA,IAAAC;AAAAA,IAAAC;AAAAA,IAAAC;AAAAA,IAAAC,MAAAC;AAAAA,IAAAC,WAAAC;AAAAA,IAAAC,oBAAAC;AAAAA,EAAAA,IAAAjB,IAU7BY,OAAAC,OAAAK,SAAA,aAAAL,IACAC,YAAAC,OAAAG,SAAA,QAAAH;AAAiB,MAAAI;AAAAlB,WAAAgB,MACjBE,KAAAF,OAAAC,SAAA,CAAsB,QAAQ,QAAQ,IAAtCD,IAAuChB,OAAAgB,IAAAhB,OAAAkB,MAAAA,KAAAlB,EAAA,CAAA;AAAvC,QAAAe,qBAAAG;AAEA,MAAI,CAACT;AAAI,WAAS;AAAI,MAAAU;A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