@tamagui/dialog 1.0.1-beta.102 → 1.0.1-beta.105
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/LICENSE +21 -0
- package/dist/cjs/Dialog.js +57 -52
- package/dist/cjs/Dialog.js.map +2 -2
- package/dist/esm/Dialog.js +36 -30
- package/dist/esm/Dialog.js.map +2 -2
- package/dist/jsx/Dialog.js +20 -23
- package/dist/jsx/Dialog.js.map +2 -2
- package/package.json +17 -16
- package/src/Dialog.tsx +49 -41
- package/types/Dialog.d.ts +29 -31
- package/types/Dialog.d.ts.map +1 -1
package/dist/jsx/Dialog.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Dialog.tsx"],
|
|
4
|
-
"sourcesContent": ["import { AnimatePresence } from '@tamagui/animate-presence'\nimport { useComposedRefs } from '@tamagui/compose-refs'\nimport { useGet } from '@tamagui/core'\nimport {\n GetProps,\n MediaPropKeys,\n Slot,\n Theme,\n composeEventHandlers,\n isWeb,\n styled,\n useId,\n useMedia,\n useThemeName,\n withStaticProperties,\n} from '@tamagui/core'\nimport { Scope, createContext, createContextScope } from '@tamagui/create-context'\nimport { Dismissable, DismissableProps } from '@tamagui/dismissable'\nimport { FocusScope, FocusScopeProps } from '@tamagui/focus-scope'\nimport { PortalHost, PortalItem, PortalItemProps } from '@tamagui/portal'\nimport { Sheet, SheetController } from '@tamagui/sheet'\nimport { ThemeableStack, YStack, YStackProps } from '@tamagui/stacks'\nimport { H2, Paragraph } from '@tamagui/text'\nimport { useControllableState } from '@tamagui/use-controllable-state'\nimport { hideOthers } from 'aria-hidden'\nimport * as React from 'react'\nimport { View } from 'react-native'\nimport { RemoveScroll } from 'react-remove-scroll'\n\nconst DIALOG_NAME = 'Dialog'\n\ntype ScopedProps<P> = P & { __scopeDialog?: Scope }\ntype TamaguiElement = HTMLElement | View\n\nconst [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME)\n\ninterface DialogProps {\n sheetBreakpoint?: MediaPropKeys | false\n children?: React.ReactNode\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?(open: boolean): void\n modal?: boolean\n\n /**\n * @see https://github.com/theKashey/react-remove-scroll#usage\n */\n allowPinchZoom?: RemoveScrollProps['allowPinchZoom']\n}\n\ntype NonNull<A> = Exclude<A, void | null>\n\ntype DialogContextValue = {\n triggerRef: React.RefObject<TamaguiElement>\n contentRef: React.RefObject<TamaguiElement>\n contentId: string\n titleId: string\n descriptionId: string\n onOpenToggle(): void\n open: NonNull<DialogProps['open']>\n onOpenChange: NonNull<DialogProps['onOpenChange']>\n modal: NonNull<DialogProps['modal']>\n allowPinchZoom: NonNull<DialogProps['allowPinchZoom']>\n sheetBreakpoint: NonNull<DialogProps['sheetBreakpoint']>\n scopeKey: string\n}\n\nconst [DialogProvider, useDialogContext] = createDialogContext<DialogContextValue>(DIALOG_NAME)\n\ntype RemoveScrollProps = React.ComponentProps<typeof RemoveScroll>\n\n/* -------------------------------------------------------------------------------------------------\n * DialogTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'DialogTrigger'\n\nconst DialogTriggerFrame = styled(YStack, {\n name: TRIGGER_NAME,\n})\n\ninterface DialogTriggerProps extends YStackProps {}\n\nconst DialogTrigger = React.forwardRef<TamaguiElement, DialogTriggerProps>(\n (props: ScopedProps<DialogTriggerProps>, forwardedRef) => {\n const { __scopeDialog, ...triggerProps } = props\n const context = useDialogContext(TRIGGER_NAME, __scopeDialog)\n const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef)\n return (\n <DialogTriggerFrame\n tag=\"button\"\n aria-haspopup=\"dialog\"\n aria-expanded={context.open}\n aria-controls={context.contentId}\n data-state={getState(context.open)}\n {...triggerProps}\n ref={composedTriggerRef}\n onPress={composeEventHandlers(props.onPress, context.onOpenToggle)}\n />\n )\n }\n)\n\nDialogTrigger.displayName = TRIGGER_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * DialogPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'DialogPortal'\n\ntype PortalContextValue = { forceMount?: true }\nconst [PortalProvider, usePortalContext] = createDialogContext<PortalContextValue>(PORTAL_NAME, {\n forceMount: undefined,\n})\n\ntype DialogPortalProps = Omit<PortalItemProps, 'asChild'> &\n YStackProps & {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true\n }\n\nexport const DialogPortalFrame = styled(YStack, {\n alignItems: 'center',\n justifyContent: 'center',\n fullscreen: true,\n zIndex: 100,\n ...(isWeb && {\n maxHeight: '100vh',\n }),\n})\n\nconst DialogPortal: React.FC<DialogPortalProps> = DialogPortalFrame.extractable(\n (props: ScopedProps<DialogPortalProps>) => {\n const { __scopeDialog, forceMount, children, ...frameProps } = props\n const themeName = useThemeName()\n const context = useDialogContext(PORTAL_NAME, __scopeDialog)\n const isShowing = forceMount || context.open\n const contents = <AnimatePresence>{isShowing ? children : null}</AnimatePresence>\n const isSheet = useShowDialogSheet(context)\n if (!context.modal || isSheet || (!isWeb && !isShowing)) {\n return contents\n }\n return (\n <PortalItem>\n {/* have to re-propogate context, sketch */}\n <DialogProvider scope={__scopeDialog} {...context}>\n <Theme name={themeName}>\n <PortalProvider scope={__scopeDialog} forceMount={forceMount}>\n <DialogPortalFrame pointerEvents={isShowing ? 'auto' : 'none'} {...frameProps}>\n {contents}\n </DialogPortalFrame>\n </PortalProvider>\n </Theme>\n </DialogProvider>\n </PortalItem>\n )\n }\n)\n\nDialogPortal.displayName = PORTAL_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * DialogOverlay\n * -----------------------------------------------------------------------------------------------*/\n\nconst OVERLAY_NAME = 'DialogOverlay'\n\nconst DialogOverlayFrame = styled(ThemeableStack, {\n name: OVERLAY_NAME,\n pointerEvents: 'auto',\n backgrounded: true,\n fullscreen: true,\n})\n\ninterface DialogOverlayProps extends YStackProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true\n}\n\nconst DialogOverlay = React.forwardRef<TamaguiElement, DialogOverlayProps>(\n ({ __scopeDialog, ...props }: ScopedProps<DialogOverlayProps>, forwardedRef) => {\n const portalContext = usePortalContext(OVERLAY_NAME, __scopeDialog)\n const { forceMount = portalContext.forceMount, ...overlayProps } = props\n const context = useDialogContext(OVERLAY_NAME, __scopeDialog)\n const showSheet = useShowDialogSheet(context)\n\n if (!forceMount) {\n if (!context.modal || showSheet) {\n return null\n }\n }\n\n return <DialogOverlayImpl {...overlayProps} ref={forwardedRef} />\n }\n)\n\nDialogOverlay.displayName = OVERLAY_NAME\n\ntype DialogOverlayImplProps = GetProps<typeof DialogOverlayFrame>\n\nconst DialogOverlayImpl = React.forwardRef<TamaguiElement, DialogOverlayImplProps>(\n (props: ScopedProps<DialogOverlayImplProps>, forwardedRef) => {\n const { __scopeDialog, ...overlayProps } = props\n const context = useDialogContext(OVERLAY_NAME, __scopeDialog)\n const content = (\n <DialogOverlayFrame\n data-state={getState(context.open)}\n // We re-enable pointer-events prevented by `Dialog.Content` to allow scrolling the overlay.\n pointerEvents=\"auto\"\n {...overlayProps}\n ref={forwardedRef}\n />\n )\n\n if (!isWeb) {\n return content\n }\n\n return (\n // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`\n // ie. when `Overlay` and `Content` are siblings\n <RemoveScroll as={Slot} allowPinchZoom={context.allowPinchZoom} shards={[context.contentRef]}>\n {content}\n </RemoveScroll>\n )\n }\n)\n\n/* -------------------------------------------------------------------------------------------------\n * DialogContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'DialogContent'\n\nconst DialogContentFrame = styled(ThemeableStack, {\n name: CONTENT_NAME,\n tag: 'dialog',\n pointerEvents: 'auto',\n position: 'relative',\n backgrounded: true,\n padded: true,\n radiused: true,\n elevate: true,\n\n variants: {\n size: {\n '...size': (val, extras) => {\n return {}\n },\n },\n },\n\n defaultVariants: {\n size: '$4',\n },\n})\n\ntype DialogContentFrameProps = GetProps<typeof DialogContentFrame>\n\ninterface DialogContentProps extends DialogContentFrameProps, DialogContentTypeProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true\n}\n\nconst DialogContent = DialogContentFrame.extractable(\n React.forwardRef<TamaguiElement, DialogContentProps>(\n ({ __scopeDialog, ...props }: ScopedProps<DialogContentProps>, forwardedRef) => {\n const portalContext = usePortalContext(CONTENT_NAME, __scopeDialog)\n const { forceMount = portalContext.forceMount, ...contentProps } = props\n const context = useDialogContext(CONTENT_NAME, __scopeDialog)\n\n return (\n <>\n {context.modal ? (\n <DialogContentModal {...contentProps} ref={forwardedRef} />\n ) : (\n <DialogContentNonModal {...contentProps} ref={forwardedRef} />\n )}\n </>\n )\n }\n )\n)\n\nDialogContent.displayName = CONTENT_NAME\n\n/* -----------------------------------------------------------------------------------------------*/\n\ninterface DialogContentTypeProps\n extends Omit<DialogContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents'> {}\n\nconst DialogContentModal = React.forwardRef<TamaguiElement, DialogContentTypeProps>(\n ({ __scopeDialog, children, ...props }: ScopedProps<DialogContentTypeProps>, forwardedRef) => {\n const context = useDialogContext(CONTENT_NAME, __scopeDialog)\n const contentRef = React.useRef<HTMLDivElement>(null)\n const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef)\n\n // aria-hide everything except the content (better supported equivalent to setting aria-modal)\n React.useEffect(() => {\n if (!context.open) return\n const content = contentRef.current\n if (content) return hideOthers(content)\n }, [context.open])\n\n return (\n <DialogContentImpl\n {...props}\n ref={composedRefs}\n // we make sure focus isn't trapped once `DialogContent` has been closed\n // (closed !== unmounted when animating out)\n trapFocus={context.open}\n disableOutsidePointerEvents\n onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {\n event.preventDefault()\n context.triggerRef.current?.focus()\n })}\n onPointerDownOutside={composeEventHandlers(props.onPointerDownOutside, (event) => {\n const originalEvent = event['detail'].originalEvent\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick\n // If the event is a right-click, we shouldn't close because\n // it is effectively as if we right-clicked the `Overlay`.\n if (isRightClick) event.preventDefault()\n })}\n // When focus is trapped, a `focusout` event may still happen.\n // We make sure we don't trigger our `onDismiss` in such case.\n onFocusOutside={composeEventHandlers(props.onFocusOutside, (event) =>\n event.preventDefault()\n )}\n >\n {children}\n </DialogContentImpl>\n )\n }\n)\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst DialogContentNonModal = React.forwardRef<TamaguiElement, DialogContentTypeProps>(\n (props: ScopedProps<DialogContentTypeProps>, forwardedRef) => {\n const context = useDialogContext(CONTENT_NAME, props.__scopeDialog)\n const hasInteractedOutsideRef = React.useRef(false)\n\n return (\n <DialogContentImpl\n {...props}\n ref={forwardedRef}\n trapFocus={false}\n disableOutsidePointerEvents={false}\n onCloseAutoFocus={(event) => {\n props.onCloseAutoFocus?.(event)\n\n if (!event.defaultPrevented) {\n if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus()\n // Always prevent auto focus because we either focus manually or want user agent focus\n event.preventDefault()\n }\n\n hasInteractedOutsideRef.current = false\n }}\n onInteractOutside={(event) => {\n props.onInteractOutside?.(event)\n\n if (!event.defaultPrevented) hasInteractedOutsideRef.current = true\n\n // Prevent dismissing when clicking the trigger.\n // As the trigger is already setup to close, without doing so would\n // cause it to close and immediately open.\n //\n // We use `onInteractOutside` as some browsers also\n // focus on pointer down, creating the same issue.\n const target = event.target as HTMLElement\n const trigger = context.triggerRef.current\n if (!(trigger instanceof HTMLElement)) return\n const targetIsTrigger = trigger.contains(target)\n if (targetIsTrigger) event.preventDefault()\n }}\n />\n )\n }\n)\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype DialogContentImplProps = DialogContentFrameProps &\n Omit<DismissableProps, 'onDismiss'> & {\n /**\n * When `true`, focus cannot escape the `Content` via keyboard,\n * pointer, or a programmatic focus.\n * @defaultValue false\n */\n trapFocus?: FocusScopeProps['trapped']\n\n /**\n * Event handler called when auto-focusing on open.\n * Can be prevented.\n */\n onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus']\n\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus']\n }\n\nconst DialogContentImpl = React.forwardRef<TamaguiElement, DialogContentImplProps>(\n (props: ScopedProps<DialogContentImplProps>, forwardedRef) => {\n const {\n __scopeDialog,\n trapFocus,\n onOpenAutoFocus,\n onCloseAutoFocus,\n disableOutsidePointerEvents,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n ...contentProps\n } = props\n const context = useDialogContext(CONTENT_NAME, __scopeDialog)\n const contentRef = React.useRef<HTMLDivElement>(null)\n const composedRefs = useComposedRefs(forwardedRef, contentRef)\n const showSheet = useShowDialogSheet(context)\n\n const contents = (\n <DialogContentFrame\n id={context.contentId}\n aria-describedby={context.descriptionId}\n aria-labelledby={context.titleId}\n data-state={getState(context.open)}\n {...contentProps}\n />\n )\n\n if (showSheet) {\n return (\n <PortalItem hostName={`${context.scopeKey}SheetContents`}>\n {contentProps.children}\n </PortalItem>\n )\n }\n\n return (\n <>\n <FocusScope\n loop\n trapped={trapFocus}\n onMountAutoFocus={onOpenAutoFocus}\n onUnmountAutoFocus={onCloseAutoFocus}\n >\n <Dismissable\n disableOutsidePointerEvents={disableOutsidePointerEvents}\n onEscapeKeyDown={onEscapeKeyDown}\n onPointerDownOutside={onPointerDownOutside}\n onFocusOutside={onFocusOutside}\n onInteractOutside={onInteractOutside}\n // @ts-ignore\n ref={composedRefs}\n onDismiss={() => context.onOpenChange(false)}\n >\n {contents}\n </Dismissable>\n </FocusScope>\n {process.env.NODE_ENV === 'development' && (\n <>\n <TitleWarning titleId={context.titleId} />\n <DescriptionWarning contentRef={contentRef} descriptionId={context.descriptionId} />\n </>\n )}\n </>\n )\n }\n)\n\n/* -------------------------------------------------------------------------------------------------\n * DialogSheetContents\n * -----------------------------------------------------------------------------------------------*/\n\nconst SHEET_CONTENTS_NAME = 'DialogSheetContents'\n\nexport const DialogSheetContents = ({ __scopeDialog }: ScopedProps<{}>) => {\n const context = useDialogContext(SHEET_CONTENTS_NAME, __scopeDialog)\n return <PortalHost name={`${context.scopeKey}SheetContents`}></PortalHost>\n}\n\nDialogSheetContents.displayName = SHEET_CONTENTS_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * DialogTitle\n * -----------------------------------------------------------------------------------------------*/\n\nconst TITLE_NAME = 'DialogTitle'\nconst DialogTitleFrame = styled(H2, {\n name: TITLE_NAME,\n})\n\ntype DialogTitleProps = GetProps<typeof DialogTitleFrame>\n\nconst DialogTitle = React.forwardRef<TamaguiElement, DialogTitleProps>(\n (props: ScopedProps<DialogTitleProps>, forwardedRef) => {\n const { __scopeDialog, ...titleProps } = props\n const context = useDialogContext(TITLE_NAME, __scopeDialog)\n return <DialogTitleFrame id={context.titleId} {...titleProps} ref={forwardedRef} />\n }\n)\n\nDialogTitle.displayName = TITLE_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * DialogDescription\n * -----------------------------------------------------------------------------------------------*/\n\nconst DialogDescriptionFrame = styled(Paragraph, {\n name: 'DialogDescription',\n})\n\ntype DialogDescriptionProps = GetProps<typeof DialogDescriptionFrame>\n\nconst DESCRIPTION_NAME = 'DialogDescription'\n\nconst DialogDescription = React.forwardRef<TamaguiElement, DialogDescriptionProps>(\n (props: ScopedProps<DialogDescriptionProps>, forwardedRef) => {\n const { __scopeDialog, ...descriptionProps } = props\n const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog)\n return (\n <DialogDescriptionFrame id={context.descriptionId} {...descriptionProps} ref={forwardedRef} />\n )\n }\n)\n\nDialogDescription.displayName = DESCRIPTION_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * DialogClose\n * -----------------------------------------------------------------------------------------------*/\n\nconst CLOSE_NAME = 'DialogClose'\n\ntype DialogCloseProps = YStackProps\n\nconst DialogClose = React.forwardRef<TamaguiElement, DialogCloseProps>(\n (props: ScopedProps<DialogCloseProps>, forwardedRef) => {\n const { __scopeDialog, ...closeProps } = props\n const context = useDialogContext(CLOSE_NAME, __scopeDialog)\n const isSheet = useShowDialogSheet(context)\n\n if (isSheet) {\n return null\n }\n\n return (\n <YStack\n tag=\"button\"\n {...closeProps}\n ref={forwardedRef}\n onPress={composeEventHandlers(props.onPress, () => context.onOpenChange(false))}\n />\n )\n }\n)\n\nDialogClose.displayName = CLOSE_NAME\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getState(open: boolean) {\n return open ? 'open' : 'closed'\n}\n\nconst TITLE_WARNING_NAME = 'DialogTitleWarning'\n\nconst [WarningProvider, useWarningContext] = createContext(TITLE_WARNING_NAME, {\n contentName: CONTENT_NAME,\n titleName: TITLE_NAME,\n docsSlug: 'dialog',\n})\n\ntype TitleWarningProps = { titleId?: string }\n\nconst TitleWarning: React.FC<TitleWarningProps> = ({ titleId }) => {\n const titleWarningContext = useWarningContext(TITLE_WARNING_NAME)\n\n const MESSAGE = `\\`${titleWarningContext.contentName}\\` requires a \\`${titleWarningContext.titleName}\\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \\`${titleWarningContext.titleName}\\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`\n\n React.useEffect(() => {\n if (!isWeb) return\n if (titleId) {\n const hasTitle = document.getElementById(titleId)\n if (!hasTitle) throw new Error(MESSAGE)\n }\n }, [MESSAGE, titleId])\n\n return null\n}\n\nconst DESCRIPTION_WARNING_NAME = 'DialogDescriptionWarning'\n\ntype DescriptionWarningProps = {\n contentRef: React.RefObject<TamaguiElement>\n descriptionId?: string\n}\n\nconst DescriptionWarning: React.FC<DescriptionWarningProps> = ({ contentRef, descriptionId }) => {\n const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME)\n const MESSAGE = `Warning: Missing \\`Description\\` or \\`aria-describedby={undefined}\\` for {${descriptionWarningContext.contentName}}.`\n\n React.useEffect(() => {\n if (!isWeb) return\n const contentNode = contentRef.current\n if (!(contentNode instanceof HTMLElement)) {\n return\n }\n const describedById = contentNode.getAttribute('aria-describedby')\n // if we have an id and the user hasn't set aria-describedby={undefined}\n if (descriptionId && describedById) {\n const hasDescription = document.getElementById(descriptionId)\n if (!hasDescription) console.warn(MESSAGE)\n }\n }, [MESSAGE, contentRef, descriptionId])\n\n return null\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Dialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst DialogInner = React.forwardRef<{ open: (val: boolean) => void }, DialogProps>(function Dialog(\n props: ScopedProps<DialogProps>,\n ref\n) {\n const {\n __scopeDialog,\n children,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n modal = true,\n allowPinchZoom = false,\n sheetBreakpoint = false,\n } = props\n const triggerRef = React.useRef<HTMLButtonElement>(null)\n const contentRef = React.useRef<TamaguiElement>(null)\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n })\n\n React.useImperativeHandle(\n ref,\n () => ({\n open: setOpen,\n }),\n [setOpen]\n )\n\n return (\n <DialogProvider\n scope={__scopeDialog}\n scopeKey={__scopeDialog ? Object.keys(__scopeDialog)[0] : ''}\n triggerRef={triggerRef}\n contentRef={contentRef}\n contentId={useId() || ''}\n titleId={useId() || ''}\n descriptionId={useId() || ''}\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n modal={modal}\n allowPinchZoom={allowPinchZoom}\n sheetBreakpoint={sheetBreakpoint}\n >\n <DialogSheetController onChangeOpen={setOpen} __scopeDialog={__scopeDialog}>\n {children}\n </DialogSheetController>\n </DialogProvider>\n )\n})\n\nconst Dialog = withStaticProperties(DialogInner, {\n Trigger: DialogTrigger,\n Portal: DialogPortal,\n Overlay: DialogOverlay,\n Content: DialogContent,\n Title: DialogTitle,\n Description: DialogDescription,\n Close: DialogClose,\n SheetContents: DialogSheetContents,\n Sheet,\n})\n\nconst DialogSheetController = (\n props: ScopedProps<{}> & {\n children: React.ReactNode\n onChangeOpen: React.Dispatch<React.SetStateAction<boolean>>\n }\n) => {\n const context = useDialogContext('DialogSheetController', props.__scopeDialog)\n const showSheet = useShowDialogSheet(context)\n const breakpointActive = useDialogBreakpointActive(context)\n const getShowSheet = useGet(showSheet)\n return (\n <SheetController\n onChangeOpen={(val) => {\n if (getShowSheet()) {\n props.onChangeOpen(val)\n }\n }}\n open={context.open}\n hidden={breakpointActive === false}\n >\n {props.children}\n </SheetController>\n )\n}\n\nconst useDialogBreakpointActive = (context: DialogContextValue) => {\n const media = useMedia()\n return context.sheetBreakpoint ? media[context.sheetBreakpoint] : false\n}\n\nconst useShowDialogSheet = (context: DialogContextValue) => {\n const breakpointActive = useDialogBreakpointActive(context)\n return context.open === false ? false : breakpointActive\n}\n\nexport {\n createDialogScope,\n //\n Dialog,\n DialogTrigger,\n DialogPortal,\n DialogOverlay,\n DialogContent,\n DialogTitle,\n DialogDescription,\n DialogClose,\n //\n WarningProvider,\n}\nexport type {\n DialogProps,\n DialogTriggerProps,\n DialogPortalProps,\n DialogOverlayProps,\n DialogContentProps,\n DialogTitleProps,\n DialogDescriptionProps,\n DialogCloseProps,\n}\n"],
|
|
5
|
-
"mappings": "AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import { AnimatePresence } from '@tamagui/animate-presence'\nimport { hideOthers } from '@tamagui/aria-hidden'\nimport { useComposedRefs } from '@tamagui/compose-refs'\nimport {\n GetProps,\n MediaPropKeys,\n Slot,\n TamaguiElement,\n Theme,\n composeEventHandlers,\n isWeb,\n styled,\n useGet,\n useId,\n useMedia,\n useThemeName,\n withStaticProperties,\n} from '@tamagui/core'\nimport { Scope, createContext, createContextScope } from '@tamagui/create-context'\nimport { Dismissable, DismissableProps } from '@tamagui/dismissable'\nimport { FocusScope, FocusScopeProps } from '@tamagui/focus-scope'\nimport { PortalHost, PortalItem, PortalItemProps } from '@tamagui/portal'\nimport { RemoveScroll } from '@tamagui/remove-scroll'\nimport { Sheet, SheetController } from '@tamagui/sheet'\nimport { ThemeableStack, YStack, YStackProps } from '@tamagui/stacks'\nimport { H2, Paragraph } from '@tamagui/text'\nimport { useControllableState } from '@tamagui/use-controllable-state'\nimport * as React from 'react'\n\nconst DIALOG_NAME = 'Dialog'\n\ntype ScopedProps<P> = P & { __scopeDialog?: Scope }\n\nconst [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME)\n\ntype RemoveScrollProps = React.ComponentProps<typeof RemoveScroll>\n\ninterface DialogProps {\n sheetBreakpoint?: MediaPropKeys | false\n children?: React.ReactNode\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?(open: boolean): void\n modal?: boolean\n\n /**\n * @see https://github.com/theKashey/react-remove-scroll#usage\n */\n allowPinchZoom?: RemoveScrollProps['allowPinchZoom']\n}\n\ntype NonNull<A> = Exclude<A, void | null>\n\ntype DialogContextValue = {\n triggerRef: React.RefObject<TamaguiElement>\n contentRef: React.RefObject<TamaguiElement>\n contentId: string\n titleId: string\n descriptionId: string\n onOpenToggle(): void\n open: NonNull<DialogProps['open']>\n onOpenChange: NonNull<DialogProps['onOpenChange']>\n modal: NonNull<DialogProps['modal']>\n allowPinchZoom: NonNull<DialogProps['allowPinchZoom']>\n sheetBreakpoint: NonNull<DialogProps['sheetBreakpoint']>\n scopeKey: string\n}\n\nconst [DialogProvider, useDialogContext] = createDialogContext<DialogContextValue>(DIALOG_NAME)\n\n/* -------------------------------------------------------------------------------------------------\n * DialogTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'DialogTrigger'\n\nconst DialogTriggerFrame = styled(YStack, {\n name: TRIGGER_NAME,\n})\n\ninterface DialogTriggerProps extends YStackProps {}\n\nconst DialogTrigger = React.forwardRef<TamaguiElement, DialogTriggerProps>(\n (props: ScopedProps<DialogTriggerProps>, forwardedRef) => {\n const { __scopeDialog, ...triggerProps } = props\n const context = useDialogContext(TRIGGER_NAME, __scopeDialog)\n const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef)\n return (\n <DialogTriggerFrame\n tag=\"button\"\n aria-haspopup=\"dialog\"\n aria-expanded={context.open}\n aria-controls={context.contentId}\n data-state={getState(context.open)}\n {...triggerProps}\n ref={composedTriggerRef}\n onPress={composeEventHandlers(props.onPress, context.onOpenToggle)}\n />\n )\n }\n)\n\nDialogTrigger.displayName = TRIGGER_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * DialogPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'DialogPortal'\n\ntype PortalContextValue = { forceMount?: true }\nconst [PortalProvider, usePortalContext] = createDialogContext<PortalContextValue>(PORTAL_NAME, {\n forceMount: undefined,\n})\n\ntype DialogPortalProps = Omit<PortalItemProps, 'asChild'> &\n YStackProps & {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true\n }\n\nexport const DialogPortalFrame = styled(YStack, {\n alignItems: 'center',\n justifyContent: 'center',\n fullscreen: true,\n zIndex: 100,\n ...(isWeb && {\n maxHeight: '100vh',\n }),\n})\n\nconst DialogPortal: React.FC<DialogPortalProps> = DialogPortalFrame.extractable(\n (props: ScopedProps<DialogPortalProps>) => {\n const { __scopeDialog, forceMount, children, ...frameProps } = props\n const themeName = useThemeName()\n const context = useDialogContext(PORTAL_NAME, __scopeDialog)\n const isShowing = forceMount || context.open\n const contents = <AnimatePresence>{isShowing ? children : null}</AnimatePresence>\n const isSheet = useShowDialogSheet(context)\n if (!context.modal || isSheet) {\n return contents\n }\n return (\n <PortalItem>\n {/* have to re-propogate context, sketch */}\n <DialogProvider scope={__scopeDialog} {...context}>\n <Theme name={themeName}>\n <PortalProvider scope={__scopeDialog} forceMount={forceMount}>\n <DialogPortalFrame pointerEvents={isShowing ? 'auto' : 'none'} {...frameProps}>\n {contents}\n </DialogPortalFrame>\n </PortalProvider>\n </Theme>\n </DialogProvider>\n </PortalItem>\n )\n }\n)\n\nDialogPortal.displayName = PORTAL_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * DialogOverlay\n * -----------------------------------------------------------------------------------------------*/\n\nconst OVERLAY_NAME = 'DialogOverlay'\n\nconst DialogOverlayFrame = styled(ThemeableStack, {\n name: OVERLAY_NAME,\n pointerEvents: 'auto',\n backgrounded: true,\n fullscreen: true,\n})\n\ninterface DialogOverlayProps extends YStackProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true\n}\n\nconst DialogOverlay = React.forwardRef<TamaguiElement, DialogOverlayProps>(\n ({ __scopeDialog, ...props }: ScopedProps<DialogOverlayProps>, forwardedRef) => {\n const portalContext = usePortalContext(OVERLAY_NAME, __scopeDialog)\n const { forceMount = portalContext.forceMount, ...overlayProps } = props\n const context = useDialogContext(OVERLAY_NAME, __scopeDialog)\n const showSheet = useShowDialogSheet(context)\n\n if (!forceMount) {\n if (!context.modal || showSheet) {\n return null\n }\n }\n\n return <DialogOverlayImpl context={context} {...overlayProps} ref={forwardedRef} />\n }\n)\n\nDialogOverlay.displayName = OVERLAY_NAME\n\ntype DialogOverlayImplProps = GetProps<typeof DialogOverlayFrame> & {\n context: DialogContextValue\n}\n\nconst DialogOverlayImpl = React.forwardRef<TamaguiElement, DialogOverlayImplProps>(\n (props, forwardedRef) => {\n const { context, ...overlayProps } = props\n return (\n // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`\n // ie. when `Overlay` and `Content` are siblings\n <RemoveScroll\n enabled={context.open}\n as={Slot}\n allowPinchZoom={context.allowPinchZoom}\n shards={[context.contentRef]}\n >\n <DialogOverlayFrame\n data-state={getState(context.open)}\n // We re-enable pointer-events prevented by `Dialog.Content` to allow scrolling the overlay.\n pointerEvents=\"auto\"\n {...overlayProps}\n ref={forwardedRef}\n />\n </RemoveScroll>\n )\n }\n)\n\n/* -------------------------------------------------------------------------------------------------\n * DialogContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'DialogContent'\n\nconst DialogContentFrame = styled(ThemeableStack, {\n name: CONTENT_NAME,\n tag: 'dialog',\n pointerEvents: 'auto',\n position: 'relative',\n backgrounded: true,\n padded: true,\n radiused: true,\n elevate: true,\n\n variants: {\n size: {\n '...size': (val, extras) => {\n return {}\n },\n },\n },\n\n defaultVariants: {\n size: '$4',\n },\n})\n\ntype DialogContentFrameProps = GetProps<typeof DialogContentFrame>\n\ninterface DialogContentProps\n extends DialogContentFrameProps,\n Omit<DialogContentTypeProps, 'context'> {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true\n}\n\nconst DialogContent = DialogContentFrame.extractable(\n React.forwardRef<TamaguiElement, DialogContentProps>(\n ({ __scopeDialog, ...props }: ScopedProps<DialogContentProps>, forwardedRef) => {\n const portalContext = usePortalContext(CONTENT_NAME, __scopeDialog)\n const { forceMount = portalContext.forceMount, ...contentProps } = props\n const context = useDialogContext(CONTENT_NAME, __scopeDialog)\n\n return (\n <>\n {context.modal ? (\n <DialogContentModal context={context} {...contentProps} ref={forwardedRef} />\n ) : (\n <DialogContentNonModal context={context} {...contentProps} ref={forwardedRef} />\n )}\n </>\n )\n }\n )\n)\n\nDialogContent.displayName = CONTENT_NAME\n\n/* -----------------------------------------------------------------------------------------------*/\n\ninterface DialogContentTypeProps\n extends Omit<DialogContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents'> {\n context: DialogContextValue\n}\n\nconst DialogContentModal = React.forwardRef<TamaguiElement, DialogContentTypeProps>(\n ({ children, context, ...props }: ScopedProps<DialogContentTypeProps>, forwardedRef) => {\n const contentRef = React.useRef<HTMLDivElement>(null)\n const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef)\n\n // aria-hide everything except the content (better supported equivalent to setting aria-modal)\n React.useEffect(() => {\n if (!context.open) return\n const content = contentRef.current\n if (content) return hideOthers(content)\n }, [context.open])\n\n return (\n <DialogContentImpl\n {...props}\n context={context}\n ref={composedRefs}\n // we make sure focus isn't trapped once `DialogContent` has been closed\n // (closed !== unmounted when animating out)\n trapFocus={context.open}\n disableOutsidePointerEvents\n onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {\n event.preventDefault()\n context.triggerRef.current?.focus()\n })}\n onPointerDownOutside={composeEventHandlers(props.onPointerDownOutside, (event) => {\n const originalEvent = event['detail'].originalEvent\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick\n // If the event is a right-click, we shouldn't close because\n // it is effectively as if we right-clicked the `Overlay`.\n if (isRightClick) event.preventDefault()\n })}\n // When focus is trapped, a `focusout` event may still happen.\n // We make sure we don't trigger our `onDismiss` in such case.\n onFocusOutside={composeEventHandlers(props.onFocusOutside, (event) =>\n event.preventDefault()\n )}\n >\n {children}\n </DialogContentImpl>\n )\n }\n)\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst DialogContentNonModal = React.forwardRef<TamaguiElement, DialogContentTypeProps>(\n (props: ScopedProps<DialogContentTypeProps>, forwardedRef) => {\n const hasInteractedOutsideRef = React.useRef(false)\n\n return (\n <DialogContentImpl\n {...props}\n ref={forwardedRef}\n trapFocus={false}\n disableOutsidePointerEvents={false}\n onCloseAutoFocus={(event) => {\n props.onCloseAutoFocus?.(event)\n\n if (!event.defaultPrevented) {\n if (!hasInteractedOutsideRef.current) {\n props.context.triggerRef.current?.focus()\n }\n // Always prevent auto focus because we either focus manually or want user agent focus\n event.preventDefault()\n }\n\n hasInteractedOutsideRef.current = false\n }}\n onInteractOutside={(event) => {\n props.onInteractOutside?.(event)\n\n if (!event.defaultPrevented) hasInteractedOutsideRef.current = true\n\n // Prevent dismissing when clicking the trigger.\n // As the trigger is already setup to close, without doing so would\n // cause it to close and immediately open.\n //\n // We use `onInteractOutside` as some browsers also\n // focus on pointer down, creating the same issue.\n const target = event.target as HTMLElement\n const trigger = props.context.triggerRef.current\n if (!(trigger instanceof HTMLElement)) return\n const targetIsTrigger = trigger.contains(target)\n if (targetIsTrigger) event.preventDefault()\n }}\n />\n )\n }\n)\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype DialogContentImplProps = DialogContentFrameProps &\n Omit<DismissableProps, 'onDismiss'> & {\n /**\n * When `true`, focus cannot escape the `Content` via keyboard,\n * pointer, or a programmatic focus.\n * @defaultValue false\n */\n trapFocus?: FocusScopeProps['trapped']\n\n /**\n * Event handler called when auto-focusing on open.\n * Can be prevented.\n */\n onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus']\n\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus']\n\n context: DialogContextValue\n }\n\nconst DialogContentImpl = React.forwardRef<TamaguiElement, DialogContentImplProps>(\n (props: ScopedProps<DialogContentImplProps>, forwardedRef) => {\n const {\n __scopeDialog,\n trapFocus,\n onOpenAutoFocus,\n onCloseAutoFocus,\n disableOutsidePointerEvents,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n context,\n ...contentProps\n } = props\n const contentRef = React.useRef<HTMLDivElement>(null)\n const composedRefs = useComposedRefs(forwardedRef, contentRef)\n const showSheet = useShowDialogSheet(context)\n\n const contents = (\n <DialogContentFrame\n id={context.contentId}\n aria-describedby={context.descriptionId}\n aria-labelledby={context.titleId}\n data-state={getState(context.open)}\n {...contentProps}\n />\n )\n\n if (showSheet) {\n return (\n <PortalItem hostName={`${context.scopeKey}SheetContents`}>\n {contentProps.children}\n </PortalItem>\n )\n }\n\n if (!isWeb) {\n return contents\n }\n\n return (\n <>\n <FocusScope\n loop\n trapped={trapFocus}\n onMountAutoFocus={onOpenAutoFocus}\n onUnmountAutoFocus={onCloseAutoFocus}\n >\n <Dismissable\n disableOutsidePointerEvents={disableOutsidePointerEvents}\n onEscapeKeyDown={onEscapeKeyDown}\n onPointerDownOutside={onPointerDownOutside}\n onFocusOutside={onFocusOutside}\n onInteractOutside={onInteractOutside}\n // @ts-ignore\n ref={composedRefs}\n onDismiss={() => context.onOpenChange(false)}\n >\n {contents}\n </Dismissable>\n </FocusScope>\n {process.env.NODE_ENV === 'development' && (\n <>\n <TitleWarning titleId={context.titleId} />\n <DescriptionWarning contentRef={contentRef} descriptionId={context.descriptionId} />\n </>\n )}\n </>\n )\n }\n)\n\n/* -------------------------------------------------------------------------------------------------\n * DialogSheetContents\n * -----------------------------------------------------------------------------------------------*/\n\nconst SHEET_CONTENTS_NAME = 'DialogSheetContents'\n\nexport const DialogSheetContents = ({ __scopeDialog }: ScopedProps<{}>) => {\n const context = useDialogContext(SHEET_CONTENTS_NAME, __scopeDialog)\n return <PortalHost name={`${context.scopeKey}SheetContents`}></PortalHost>\n}\n\nDialogSheetContents.displayName = SHEET_CONTENTS_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * DialogTitle\n * -----------------------------------------------------------------------------------------------*/\n\nconst TITLE_NAME = 'DialogTitle'\nconst DialogTitleFrame = styled(H2, {\n name: TITLE_NAME,\n})\n\ntype DialogTitleProps = GetProps<typeof DialogTitleFrame>\n\nconst DialogTitle = React.forwardRef<TamaguiElement, DialogTitleProps>(\n (props: ScopedProps<DialogTitleProps>, forwardedRef) => {\n const { __scopeDialog, ...titleProps } = props\n const context = useDialogContext(TITLE_NAME, __scopeDialog)\n return <DialogTitleFrame id={context.titleId} {...titleProps} ref={forwardedRef} />\n }\n)\n\nDialogTitle.displayName = TITLE_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * DialogDescription\n * -----------------------------------------------------------------------------------------------*/\n\nconst DialogDescriptionFrame = styled(Paragraph, {\n name: 'DialogDescription',\n})\n\ntype DialogDescriptionProps = GetProps<typeof DialogDescriptionFrame>\n\nconst DESCRIPTION_NAME = 'DialogDescription'\n\nconst DialogDescription = React.forwardRef<TamaguiElement, DialogDescriptionProps>(\n (props: ScopedProps<DialogDescriptionProps>, forwardedRef) => {\n const { __scopeDialog, ...descriptionProps } = props\n const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog)\n return (\n <DialogDescriptionFrame id={context.descriptionId} {...descriptionProps} ref={forwardedRef} />\n )\n }\n)\n\nDialogDescription.displayName = DESCRIPTION_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * DialogClose\n * -----------------------------------------------------------------------------------------------*/\n\nconst CLOSE_NAME = 'DialogClose'\n\ntype DialogCloseProps = YStackProps\n\nconst DialogClose = React.forwardRef<TamaguiElement, DialogCloseProps>(\n (props: ScopedProps<DialogCloseProps>, forwardedRef) => {\n const { __scopeDialog, ...closeProps } = props\n const context = useDialogContext(CLOSE_NAME, __scopeDialog)\n const isSheet = useShowDialogSheet(context)\n\n if (isSheet) {\n return null\n }\n\n return (\n <YStack\n tag=\"button\"\n {...closeProps}\n ref={forwardedRef}\n onPress={composeEventHandlers(props.onPress, () => context.onOpenChange(false))}\n />\n )\n }\n)\n\nDialogClose.displayName = CLOSE_NAME\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getState(open: boolean) {\n return open ? 'open' : 'closed'\n}\n\nconst TITLE_WARNING_NAME = 'DialogTitleWarning'\n\nconst [DialogWarningProvider, useWarningContext] = createContext(TITLE_WARNING_NAME, {\n contentName: CONTENT_NAME,\n titleName: TITLE_NAME,\n docsSlug: 'dialog',\n})\n\ntype TitleWarningProps = { titleId?: string }\n\nconst TitleWarning: React.FC<TitleWarningProps> = ({ titleId }) => {\n const titleWarningContext = useWarningContext(TITLE_WARNING_NAME)\n\n const MESSAGE = `\\`${titleWarningContext.contentName}\\` requires a \\`${titleWarningContext.titleName}\\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \\`${titleWarningContext.titleName}\\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`\n\n React.useEffect(() => {\n if (!isWeb) return\n if (titleId) {\n const hasTitle = document.getElementById(titleId)\n if (!hasTitle) throw new Error(MESSAGE)\n }\n }, [MESSAGE, titleId])\n\n return null\n}\n\nconst DESCRIPTION_WARNING_NAME = 'DialogDescriptionWarning'\n\ntype DescriptionWarningProps = {\n contentRef: React.RefObject<TamaguiElement>\n descriptionId?: string\n}\n\nconst DescriptionWarning: React.FC<DescriptionWarningProps> = ({ contentRef, descriptionId }) => {\n const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME)\n const MESSAGE = `Warning: Missing \\`Description\\` or \\`aria-describedby={undefined}\\` for {${descriptionWarningContext.contentName}}.`\n\n React.useEffect(() => {\n if (!isWeb) return\n const contentNode = contentRef.current\n if (!(contentNode instanceof HTMLElement)) {\n return\n }\n const describedById = contentNode.getAttribute('aria-describedby')\n // if we have an id and the user hasn't set aria-describedby={undefined}\n if (descriptionId && describedById) {\n const hasDescription = document.getElementById(descriptionId)\n if (!hasDescription) console.warn(MESSAGE)\n }\n }, [MESSAGE, contentRef, descriptionId])\n\n return null\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Dialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst DialogInner = React.forwardRef<{ open: (val: boolean) => void }, DialogProps>(function Dialog(\n props: ScopedProps<DialogProps>,\n ref\n) {\n const {\n __scopeDialog,\n children,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n modal = true,\n allowPinchZoom = false,\n sheetBreakpoint = false,\n } = props\n const triggerRef = React.useRef<HTMLButtonElement>(null)\n const contentRef = React.useRef<TamaguiElement>(null)\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n })\n\n React.useImperativeHandle(\n ref,\n () => ({\n open: setOpen,\n }),\n [setOpen]\n )\n\n return (\n <DialogProvider\n scope={__scopeDialog}\n scopeKey={__scopeDialog ? Object.keys(__scopeDialog)[0] : ''}\n triggerRef={triggerRef}\n contentRef={contentRef}\n contentId={useId() || ''}\n titleId={useId() || ''}\n descriptionId={useId() || ''}\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n modal={modal}\n allowPinchZoom={allowPinchZoom}\n sheetBreakpoint={sheetBreakpoint}\n >\n <DialogSheetController onChangeOpen={setOpen} __scopeDialog={__scopeDialog}>\n {children}\n </DialogSheetController>\n </DialogProvider>\n )\n})\n\nconst Dialog = withStaticProperties(DialogInner, {\n Trigger: DialogTrigger,\n Portal: DialogPortal,\n Overlay: DialogOverlay,\n Content: DialogContent,\n Title: DialogTitle,\n Description: DialogDescription,\n Close: DialogClose,\n SheetContents: DialogSheetContents,\n Sheet,\n})\n\nconst DialogSheetController = (\n props: ScopedProps<{}> & {\n children: React.ReactNode\n onChangeOpen: React.Dispatch<React.SetStateAction<boolean>>\n }\n) => {\n const context = useDialogContext('DialogSheetController', props.__scopeDialog)\n const showSheet = useShowDialogSheet(context)\n const breakpointActive = useDialogBreakpointActive(context)\n const getShowSheet = useGet(showSheet)\n return (\n <SheetController\n onChangeOpen={(val) => {\n if (getShowSheet()) {\n props.onChangeOpen(val)\n }\n }}\n open={context.open}\n hidden={breakpointActive === false}\n >\n {props.children}\n </SheetController>\n )\n}\n\nconst useDialogBreakpointActive = (context: DialogContextValue) => {\n const media = useMedia()\n return context.sheetBreakpoint ? media[context.sheetBreakpoint] : false\n}\n\nconst useShowDialogSheet = (context: DialogContextValue) => {\n const breakpointActive = useDialogBreakpointActive(context)\n return context.open === false ? false : breakpointActive\n}\n\nexport {\n createDialogScope,\n //\n Dialog,\n DialogTrigger,\n DialogPortal,\n DialogOverlay,\n DialogContent,\n DialogTitle,\n DialogDescription,\n DialogClose,\n //\n DialogWarningProvider,\n}\nexport type {\n DialogProps,\n DialogTriggerProps,\n DialogPortalProps,\n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"1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.105",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"types": "./types/index.d.ts",
|
|
6
6
|
"main": "dist/cjs",
|
|
@@ -21,20 +21,21 @@
|
|
|
21
21
|
"clean:build": "tamagui-build clean:build"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@tamagui/animate-presence": "^1.0.1-beta.
|
|
25
|
-
"@tamagui/
|
|
26
|
-
"@tamagui/
|
|
27
|
-
"@tamagui/
|
|
28
|
-
"@tamagui/
|
|
29
|
-
"@tamagui/
|
|
30
|
-
"@tamagui/
|
|
31
|
-
"@tamagui/
|
|
32
|
-
"@tamagui/
|
|
33
|
-
"@tamagui/
|
|
34
|
-
"@tamagui/
|
|
35
|
-
"@tamagui/
|
|
36
|
-
"
|
|
37
|
-
"
|
|
24
|
+
"@tamagui/animate-presence": "^1.0.1-beta.105",
|
|
25
|
+
"@tamagui/aria-hidden": "^1.0.1-beta.105",
|
|
26
|
+
"@tamagui/compose-refs": "^1.0.1-beta.105",
|
|
27
|
+
"@tamagui/core": "^1.0.1-beta.105",
|
|
28
|
+
"@tamagui/create-context": "^1.0.1-beta.105",
|
|
29
|
+
"@tamagui/dismissable": "^1.0.1-beta.105",
|
|
30
|
+
"@tamagui/focus-scope": "^1.0.1-beta.105",
|
|
31
|
+
"@tamagui/polyfill-dev": "^1.0.1-beta.105",
|
|
32
|
+
"@tamagui/popper": "^1.0.1-beta.105",
|
|
33
|
+
"@tamagui/portal": "^1.0.1-beta.105",
|
|
34
|
+
"@tamagui/remove-scroll": "^1.0.1-beta.105",
|
|
35
|
+
"@tamagui/sheet": "^1.0.1-beta.105",
|
|
36
|
+
"@tamagui/stacks": "^1.0.1-beta.105",
|
|
37
|
+
"@tamagui/text": "^1.0.1-beta.105",
|
|
38
|
+
"@tamagui/use-controllable-state": "^1.0.1-beta.105"
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
|
40
41
|
"react": "*",
|
|
@@ -42,7 +43,7 @@
|
|
|
42
43
|
"react-native": "*"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
|
-
"@tamagui/build": "^1.0.1-beta.
|
|
46
|
+
"@tamagui/build": "^1.0.1-beta.105",
|
|
46
47
|
"@types/react-dom": "^18.0.3",
|
|
47
48
|
"@types/react-native": "^0.69.2",
|
|
48
49
|
"react": "*",
|
package/src/Dialog.tsx
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { AnimatePresence } from '@tamagui/animate-presence'
|
|
2
|
+
import { hideOthers } from '@tamagui/aria-hidden'
|
|
2
3
|
import { useComposedRefs } from '@tamagui/compose-refs'
|
|
3
|
-
import { useGet } from '@tamagui/core'
|
|
4
4
|
import {
|
|
5
5
|
GetProps,
|
|
6
6
|
MediaPropKeys,
|
|
7
7
|
Slot,
|
|
8
|
+
TamaguiElement,
|
|
8
9
|
Theme,
|
|
9
10
|
composeEventHandlers,
|
|
10
11
|
isWeb,
|
|
11
12
|
styled,
|
|
13
|
+
useGet,
|
|
12
14
|
useId,
|
|
13
15
|
useMedia,
|
|
14
16
|
useThemeName,
|
|
@@ -18,22 +20,21 @@ import { Scope, createContext, createContextScope } from '@tamagui/create-contex
|
|
|
18
20
|
import { Dismissable, DismissableProps } from '@tamagui/dismissable'
|
|
19
21
|
import { FocusScope, FocusScopeProps } from '@tamagui/focus-scope'
|
|
20
22
|
import { PortalHost, PortalItem, PortalItemProps } from '@tamagui/portal'
|
|
23
|
+
import { RemoveScroll } from '@tamagui/remove-scroll'
|
|
21
24
|
import { Sheet, SheetController } from '@tamagui/sheet'
|
|
22
25
|
import { ThemeableStack, YStack, YStackProps } from '@tamagui/stacks'
|
|
23
26
|
import { H2, Paragraph } from '@tamagui/text'
|
|
24
27
|
import { useControllableState } from '@tamagui/use-controllable-state'
|
|
25
|
-
import { hideOthers } from 'aria-hidden'
|
|
26
28
|
import * as React from 'react'
|
|
27
|
-
import { View } from 'react-native'
|
|
28
|
-
import { RemoveScroll } from 'react-remove-scroll'
|
|
29
29
|
|
|
30
30
|
const DIALOG_NAME = 'Dialog'
|
|
31
31
|
|
|
32
32
|
type ScopedProps<P> = P & { __scopeDialog?: Scope }
|
|
33
|
-
type TamaguiElement = HTMLElement | View
|
|
34
33
|
|
|
35
34
|
const [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME)
|
|
36
35
|
|
|
36
|
+
type RemoveScrollProps = React.ComponentProps<typeof RemoveScroll>
|
|
37
|
+
|
|
37
38
|
interface DialogProps {
|
|
38
39
|
sheetBreakpoint?: MediaPropKeys | false
|
|
39
40
|
children?: React.ReactNode
|
|
@@ -67,8 +68,6 @@ type DialogContextValue = {
|
|
|
67
68
|
|
|
68
69
|
const [DialogProvider, useDialogContext] = createDialogContext<DialogContextValue>(DIALOG_NAME)
|
|
69
70
|
|
|
70
|
-
type RemoveScrollProps = React.ComponentProps<typeof RemoveScroll>
|
|
71
|
-
|
|
72
71
|
/* -------------------------------------------------------------------------------------------------
|
|
73
72
|
* DialogTrigger
|
|
74
73
|
* -----------------------------------------------------------------------------------------------*/
|
|
@@ -141,7 +140,7 @@ const DialogPortal: React.FC<DialogPortalProps> = DialogPortalFrame.extractable(
|
|
|
141
140
|
const isShowing = forceMount || context.open
|
|
142
141
|
const contents = <AnimatePresence>{isShowing ? children : null}</AnimatePresence>
|
|
143
142
|
const isSheet = useShowDialogSheet(context)
|
|
144
|
-
if (!context.modal || isSheet
|
|
143
|
+
if (!context.modal || isSheet) {
|
|
145
144
|
return contents
|
|
146
145
|
}
|
|
147
146
|
return (
|
|
@@ -197,37 +196,35 @@ const DialogOverlay = React.forwardRef<TamaguiElement, DialogOverlayProps>(
|
|
|
197
196
|
}
|
|
198
197
|
}
|
|
199
198
|
|
|
200
|
-
return <DialogOverlayImpl {...overlayProps} ref={forwardedRef} />
|
|
199
|
+
return <DialogOverlayImpl context={context} {...overlayProps} ref={forwardedRef} />
|
|
201
200
|
}
|
|
202
201
|
)
|
|
203
202
|
|
|
204
203
|
DialogOverlay.displayName = OVERLAY_NAME
|
|
205
204
|
|
|
206
|
-
type DialogOverlayImplProps = GetProps<typeof DialogOverlayFrame>
|
|
205
|
+
type DialogOverlayImplProps = GetProps<typeof DialogOverlayFrame> & {
|
|
206
|
+
context: DialogContextValue
|
|
207
|
+
}
|
|
207
208
|
|
|
208
209
|
const DialogOverlayImpl = React.forwardRef<TamaguiElement, DialogOverlayImplProps>(
|
|
209
|
-
(props
|
|
210
|
-
const {
|
|
211
|
-
const context = useDialogContext(OVERLAY_NAME, __scopeDialog)
|
|
212
|
-
const content = (
|
|
213
|
-
<DialogOverlayFrame
|
|
214
|
-
data-state={getState(context.open)}
|
|
215
|
-
// We re-enable pointer-events prevented by `Dialog.Content` to allow scrolling the overlay.
|
|
216
|
-
pointerEvents="auto"
|
|
217
|
-
{...overlayProps}
|
|
218
|
-
ref={forwardedRef}
|
|
219
|
-
/>
|
|
220
|
-
)
|
|
221
|
-
|
|
222
|
-
if (!isWeb) {
|
|
223
|
-
return content
|
|
224
|
-
}
|
|
225
|
-
|
|
210
|
+
(props, forwardedRef) => {
|
|
211
|
+
const { context, ...overlayProps } = props
|
|
226
212
|
return (
|
|
227
213
|
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
228
214
|
// ie. when `Overlay` and `Content` are siblings
|
|
229
|
-
<RemoveScroll
|
|
230
|
-
{
|
|
215
|
+
<RemoveScroll
|
|
216
|
+
enabled={context.open}
|
|
217
|
+
as={Slot}
|
|
218
|
+
allowPinchZoom={context.allowPinchZoom}
|
|
219
|
+
shards={[context.contentRef]}
|
|
220
|
+
>
|
|
221
|
+
<DialogOverlayFrame
|
|
222
|
+
data-state={getState(context.open)}
|
|
223
|
+
// We re-enable pointer-events prevented by `Dialog.Content` to allow scrolling the overlay.
|
|
224
|
+
pointerEvents="auto"
|
|
225
|
+
{...overlayProps}
|
|
226
|
+
ref={forwardedRef}
|
|
227
|
+
/>
|
|
231
228
|
</RemoveScroll>
|
|
232
229
|
)
|
|
233
230
|
}
|
|
@@ -264,7 +261,9 @@ const DialogContentFrame = styled(ThemeableStack, {
|
|
|
264
261
|
|
|
265
262
|
type DialogContentFrameProps = GetProps<typeof DialogContentFrame>
|
|
266
263
|
|
|
267
|
-
interface DialogContentProps
|
|
264
|
+
interface DialogContentProps
|
|
265
|
+
extends DialogContentFrameProps,
|
|
266
|
+
Omit<DialogContentTypeProps, 'context'> {
|
|
268
267
|
/**
|
|
269
268
|
* Used to force mounting when more control is needed. Useful when
|
|
270
269
|
* controlling animation with React animation libraries.
|
|
@@ -282,9 +281,9 @@ const DialogContent = DialogContentFrame.extractable(
|
|
|
282
281
|
return (
|
|
283
282
|
<>
|
|
284
283
|
{context.modal ? (
|
|
285
|
-
<DialogContentModal {...contentProps} ref={forwardedRef} />
|
|
284
|
+
<DialogContentModal context={context} {...contentProps} ref={forwardedRef} />
|
|
286
285
|
) : (
|
|
287
|
-
<DialogContentNonModal {...contentProps} ref={forwardedRef} />
|
|
286
|
+
<DialogContentNonModal context={context} {...contentProps} ref={forwardedRef} />
|
|
288
287
|
)}
|
|
289
288
|
</>
|
|
290
289
|
)
|
|
@@ -297,11 +296,12 @@ DialogContent.displayName = CONTENT_NAME
|
|
|
297
296
|
/* -----------------------------------------------------------------------------------------------*/
|
|
298
297
|
|
|
299
298
|
interface DialogContentTypeProps
|
|
300
|
-
extends Omit<DialogContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents'> {
|
|
299
|
+
extends Omit<DialogContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents'> {
|
|
300
|
+
context: DialogContextValue
|
|
301
|
+
}
|
|
301
302
|
|
|
302
303
|
const DialogContentModal = React.forwardRef<TamaguiElement, DialogContentTypeProps>(
|
|
303
|
-
({
|
|
304
|
-
const context = useDialogContext(CONTENT_NAME, __scopeDialog)
|
|
304
|
+
({ children, context, ...props }: ScopedProps<DialogContentTypeProps>, forwardedRef) => {
|
|
305
305
|
const contentRef = React.useRef<HTMLDivElement>(null)
|
|
306
306
|
const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef)
|
|
307
307
|
|
|
@@ -315,6 +315,7 @@ const DialogContentModal = React.forwardRef<TamaguiElement, DialogContentTypePro
|
|
|
315
315
|
return (
|
|
316
316
|
<DialogContentImpl
|
|
317
317
|
{...props}
|
|
318
|
+
context={context}
|
|
318
319
|
ref={composedRefs}
|
|
319
320
|
// we make sure focus isn't trapped once `DialogContent` has been closed
|
|
320
321
|
// (closed !== unmounted when animating out)
|
|
@@ -348,7 +349,6 @@ const DialogContentModal = React.forwardRef<TamaguiElement, DialogContentTypePro
|
|
|
348
349
|
|
|
349
350
|
const DialogContentNonModal = React.forwardRef<TamaguiElement, DialogContentTypeProps>(
|
|
350
351
|
(props: ScopedProps<DialogContentTypeProps>, forwardedRef) => {
|
|
351
|
-
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog)
|
|
352
352
|
const hasInteractedOutsideRef = React.useRef(false)
|
|
353
353
|
|
|
354
354
|
return (
|
|
@@ -361,7 +361,9 @@ const DialogContentNonModal = React.forwardRef<TamaguiElement, DialogContentType
|
|
|
361
361
|
props.onCloseAutoFocus?.(event)
|
|
362
362
|
|
|
363
363
|
if (!event.defaultPrevented) {
|
|
364
|
-
if (!hasInteractedOutsideRef.current)
|
|
364
|
+
if (!hasInteractedOutsideRef.current) {
|
|
365
|
+
props.context.triggerRef.current?.focus()
|
|
366
|
+
}
|
|
365
367
|
// Always prevent auto focus because we either focus manually or want user agent focus
|
|
366
368
|
event.preventDefault()
|
|
367
369
|
}
|
|
@@ -380,7 +382,7 @@ const DialogContentNonModal = React.forwardRef<TamaguiElement, DialogContentType
|
|
|
380
382
|
// We use `onInteractOutside` as some browsers also
|
|
381
383
|
// focus on pointer down, creating the same issue.
|
|
382
384
|
const target = event.target as HTMLElement
|
|
383
|
-
const trigger = context.triggerRef.current
|
|
385
|
+
const trigger = props.context.triggerRef.current
|
|
384
386
|
if (!(trigger instanceof HTMLElement)) return
|
|
385
387
|
const targetIsTrigger = trigger.contains(target)
|
|
386
388
|
if (targetIsTrigger) event.preventDefault()
|
|
@@ -412,6 +414,8 @@ type DialogContentImplProps = DialogContentFrameProps &
|
|
|
412
414
|
* Can be prevented.
|
|
413
415
|
*/
|
|
414
416
|
onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus']
|
|
417
|
+
|
|
418
|
+
context: DialogContextValue
|
|
415
419
|
}
|
|
416
420
|
|
|
417
421
|
const DialogContentImpl = React.forwardRef<TamaguiElement, DialogContentImplProps>(
|
|
@@ -426,9 +430,9 @@ const DialogContentImpl = React.forwardRef<TamaguiElement, DialogContentImplProp
|
|
|
426
430
|
onPointerDownOutside,
|
|
427
431
|
onFocusOutside,
|
|
428
432
|
onInteractOutside,
|
|
433
|
+
context,
|
|
429
434
|
...contentProps
|
|
430
435
|
} = props
|
|
431
|
-
const context = useDialogContext(CONTENT_NAME, __scopeDialog)
|
|
432
436
|
const contentRef = React.useRef<HTMLDivElement>(null)
|
|
433
437
|
const composedRefs = useComposedRefs(forwardedRef, contentRef)
|
|
434
438
|
const showSheet = useShowDialogSheet(context)
|
|
@@ -451,6 +455,10 @@ const DialogContentImpl = React.forwardRef<TamaguiElement, DialogContentImplProp
|
|
|
451
455
|
)
|
|
452
456
|
}
|
|
453
457
|
|
|
458
|
+
if (!isWeb) {
|
|
459
|
+
return contents
|
|
460
|
+
}
|
|
461
|
+
|
|
454
462
|
return (
|
|
455
463
|
<>
|
|
456
464
|
<FocusScope
|
|
@@ -580,7 +588,7 @@ function getState(open: boolean) {
|
|
|
580
588
|
|
|
581
589
|
const TITLE_WARNING_NAME = 'DialogTitleWarning'
|
|
582
590
|
|
|
583
|
-
const [
|
|
591
|
+
const [DialogWarningProvider, useWarningContext] = createContext(TITLE_WARNING_NAME, {
|
|
584
592
|
contentName: CONTENT_NAME,
|
|
585
593
|
titleName: TITLE_NAME,
|
|
586
594
|
docsSlug: 'dialog',
|
|
@@ -752,7 +760,7 @@ export {
|
|
|
752
760
|
DialogDescription,
|
|
753
761
|
DialogClose,
|
|
754
762
|
//
|
|
755
|
-
|
|
763
|
+
DialogWarningProvider,
|
|
756
764
|
}
|
|
757
765
|
export type {
|
|
758
766
|
DialogProps,
|
package/types/Dialog.d.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { GetProps, MediaPropKeys } from '@tamagui/core';
|
|
1
|
+
import { GetProps, MediaPropKeys, TamaguiElement } from '@tamagui/core';
|
|
2
2
|
import { Scope } from '@tamagui/create-context';
|
|
3
3
|
import { DismissableProps } from '@tamagui/dismissable';
|
|
4
4
|
import { FocusScopeProps } from '@tamagui/focus-scope';
|
|
5
5
|
import { PortalItemProps } from '@tamagui/portal';
|
|
6
|
+
import { RemoveScroll } from '@tamagui/remove-scroll';
|
|
6
7
|
import { YStackProps } from '@tamagui/stacks';
|
|
7
8
|
import * as React from 'react';
|
|
8
|
-
import { View } from 'react-native';
|
|
9
|
-
import { RemoveScroll } from 'react-remove-scroll';
|
|
10
9
|
declare type ScopedProps<P> = P & {
|
|
11
10
|
__scopeDialog?: Scope;
|
|
12
11
|
};
|
|
13
|
-
declare type TamaguiElement = HTMLElement | View;
|
|
14
12
|
declare const createDialogScope: import("@tamagui/create-context").CreateScope;
|
|
13
|
+
declare type RemoveScrollProps = React.ComponentProps<typeof RemoveScroll>;
|
|
15
14
|
interface DialogProps {
|
|
16
15
|
sheetBreakpoint?: MediaPropKeys | false;
|
|
17
16
|
children?: React.ReactNode;
|
|
@@ -21,7 +20,21 @@ interface DialogProps {
|
|
|
21
20
|
modal?: boolean;
|
|
22
21
|
allowPinchZoom?: RemoveScrollProps['allowPinchZoom'];
|
|
23
22
|
}
|
|
24
|
-
declare type
|
|
23
|
+
declare type NonNull<A> = Exclude<A, void | null>;
|
|
24
|
+
declare type DialogContextValue = {
|
|
25
|
+
triggerRef: React.RefObject<TamaguiElement>;
|
|
26
|
+
contentRef: React.RefObject<TamaguiElement>;
|
|
27
|
+
contentId: string;
|
|
28
|
+
titleId: string;
|
|
29
|
+
descriptionId: string;
|
|
30
|
+
onOpenToggle(): void;
|
|
31
|
+
open: NonNull<DialogProps['open']>;
|
|
32
|
+
onOpenChange: NonNull<DialogProps['onOpenChange']>;
|
|
33
|
+
modal: NonNull<DialogProps['modal']>;
|
|
34
|
+
allowPinchZoom: NonNull<DialogProps['allowPinchZoom']>;
|
|
35
|
+
sheetBreakpoint: NonNull<DialogProps['sheetBreakpoint']>;
|
|
36
|
+
scopeKey: string;
|
|
37
|
+
};
|
|
25
38
|
interface DialogTriggerProps extends YStackProps {
|
|
26
39
|
}
|
|
27
40
|
declare const DialogTrigger: React.ForwardRefExoticComponent<DialogTriggerProps & React.RefAttributes<TamaguiElement>>;
|
|
@@ -137,16 +150,18 @@ declare const DialogContentFrame: import("@tamagui/core").TamaguiComponent<Omit<
|
|
|
137
150
|
size?: import("@tamagui/core").SizeTokens | undefined;
|
|
138
151
|
}>;
|
|
139
152
|
declare type DialogContentFrameProps = GetProps<typeof DialogContentFrame>;
|
|
140
|
-
interface DialogContentProps extends DialogContentFrameProps, DialogContentTypeProps {
|
|
153
|
+
interface DialogContentProps extends DialogContentFrameProps, Omit<DialogContentTypeProps, 'context'> {
|
|
141
154
|
forceMount?: true;
|
|
142
155
|
}
|
|
143
156
|
declare const DialogContent: React.ForwardRefExoticComponent<DialogContentProps & React.RefAttributes<TamaguiElement>>;
|
|
144
157
|
interface DialogContentTypeProps extends Omit<DialogContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents'> {
|
|
158
|
+
context: DialogContextValue;
|
|
145
159
|
}
|
|
146
160
|
declare type DialogContentImplProps = DialogContentFrameProps & Omit<DismissableProps, 'onDismiss'> & {
|
|
147
161
|
trapFocus?: FocusScopeProps['trapped'];
|
|
148
162
|
onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'];
|
|
149
163
|
onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'];
|
|
164
|
+
context: DialogContextValue;
|
|
150
165
|
};
|
|
151
166
|
export declare const DialogSheetContents: {
|
|
152
167
|
({ __scopeDialog }: ScopedProps<{}>): JSX.Element;
|
|
@@ -1529,7 +1544,7 @@ declare const DialogClose: React.ForwardRefExoticComponent<Omit<import("react-na
|
|
|
1529
1544
|
readonly fullscreen?: boolean | undefined;
|
|
1530
1545
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
1531
1546
|
}>> & React.RefAttributes<TamaguiElement>>;
|
|
1532
|
-
declare const
|
|
1547
|
+
declare const DialogWarningProvider: {
|
|
1533
1548
|
(props: {
|
|
1534
1549
|
contentName: string;
|
|
1535
1550
|
titleName: string;
|
|
@@ -2235,9 +2250,10 @@ declare const Dialog: React.ForwardRefExoticComponent<DialogProps & React.RefAtt
|
|
|
2235
2250
|
animationConfig?: import("react-native").Animated.SpringAnimationConfig | undefined;
|
|
2236
2251
|
disableDrag?: boolean | undefined;
|
|
2237
2252
|
modal?: boolean | undefined;
|
|
2253
|
+
allowPinchZoom?: boolean | undefined;
|
|
2238
2254
|
} & {
|
|
2239
2255
|
__scopeSheet?: Scope<any>;
|
|
2240
|
-
} & React.RefAttributes<View>, "theme" | "themeInverse"> & {
|
|
2256
|
+
} & React.RefAttributes<import("react-native").View>, "theme" | "themeInverse"> & {
|
|
2241
2257
|
theme?: import("@tamagui/core").ThemeName | null | undefined;
|
|
2242
2258
|
themeInverse?: boolean | undefined;
|
|
2243
2259
|
}) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
|
|
@@ -2253,7 +2269,7 @@ declare const Dialog: React.ForwardRefExoticComponent<DialogProps & React.RefAtt
|
|
|
2253
2269
|
}>> & {
|
|
2254
2270
|
__scopeSheet?: Scope<any>;
|
|
2255
2271
|
}) => JSX.Element | null;
|
|
2256
|
-
Frame:
|
|
2272
|
+
Frame: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
|
|
2257
2273
|
readonly fullscreen?: boolean | undefined;
|
|
2258
2274
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
2259
2275
|
} & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
|
|
@@ -2262,27 +2278,9 @@ declare const Dialog: React.ForwardRefExoticComponent<DialogProps & React.RefAtt
|
|
|
2262
2278
|
}>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
|
|
2263
2279
|
readonly fullscreen?: boolean | undefined;
|
|
2264
2280
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
2265
|
-
}>>
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
}, string | number> & {
|
|
2269
|
-
[x: string]: undefined;
|
|
2270
|
-
} & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
|
|
2271
|
-
readonly fullscreen?: boolean | undefined;
|
|
2272
|
-
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
2273
|
-
}, string | number> & {
|
|
2274
|
-
[x: string]: undefined;
|
|
2275
|
-
}>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
|
|
2276
|
-
readonly fullscreen?: boolean | undefined;
|
|
2277
|
-
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
2278
|
-
}, string | number> & {
|
|
2279
|
-
[x: string]: undefined;
|
|
2280
|
-
}>>), any, import("@tamagui/core").StackPropsBase, {
|
|
2281
|
-
readonly fullscreen?: boolean | undefined;
|
|
2282
|
-
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
2283
|
-
} & ({} | {
|
|
2284
|
-
[x: string]: undefined;
|
|
2285
|
-
})>;
|
|
2281
|
+
}>> & {
|
|
2282
|
+
__scopeSheet?: Scope<any>;
|
|
2283
|
+
} & React.RefAttributes<unknown>>;
|
|
2286
2284
|
Overlay: ({ __scopeSheet, ...props }: Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
|
|
2287
2285
|
readonly fullscreen?: boolean | undefined;
|
|
2288
2286
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
@@ -2303,6 +2301,6 @@ declare const Dialog: React.ForwardRefExoticComponent<DialogProps & React.RefAtt
|
|
|
2303
2301
|
}) => JSX.Element;
|
|
2304
2302
|
};
|
|
2305
2303
|
};
|
|
2306
|
-
export { createDialogScope, Dialog, DialogTrigger, DialogPortal, DialogOverlay, DialogContent, DialogTitle, DialogDescription, DialogClose,
|
|
2304
|
+
export { createDialogScope, Dialog, DialogTrigger, DialogPortal, DialogOverlay, DialogContent, DialogTitle, DialogDescription, DialogClose, DialogWarningProvider, };
|
|
2307
2305
|
export type { DialogProps, DialogTriggerProps, DialogPortalProps, DialogOverlayProps, DialogContentProps, DialogTitleProps, DialogDescriptionProps, DialogCloseProps, };
|
|
2308
2306
|
//# sourceMappingURL=Dialog.d.ts.map
|
package/types/Dialog.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../src/Dialog.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,QAAQ,EACR,aAAa,
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../src/Dialog.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,QAAQ,EACR,aAAa,EAEb,cAAc,EAUf,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,KAAK,EAAqC,MAAM,yBAAyB,CAAA;AAClF,OAAO,EAAe,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACpE,OAAO,EAAc,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAClE,OAAO,EAA0B,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAErD,OAAO,EAA0B,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGrE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,aAAK,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,aAAa,CAAC,EAAE,KAAK,CAAA;CAAE,CAAA;AAEnD,QAAA,MAA4B,iBAAiB,+CAAmC,CAAA;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