@tamagui/dialog 1.0.1-beta.78 → 1.0.1-beta.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Dialog.js +7 -3
- package/dist/cjs/Dialog.js.map +2 -2
- package/dist/esm/Dialog.js +7 -3
- package/dist/esm/Dialog.js.map +2 -2
- package/dist/jsx/Dialog.js +8 -3
- package/dist/jsx/Dialog.js.map +7 -0
- package/dist/jsx/index.js +1 -0
- package/dist/jsx/index.js.map +7 -0
- package/package.json +14 -14
- package/src/Dialog.tsx +57 -47
- package/types/Dialog.d.ts +161 -558
- package/types/Dialog.d.ts.map +1 -1
package/src/Dialog.tsx
CHANGED
|
@@ -247,7 +247,7 @@ const DialogContentFrame = styled(ThemeableStack, {
|
|
|
247
247
|
|
|
248
248
|
type DialogContentFrameProps = GetProps<typeof DialogContentFrame>
|
|
249
249
|
|
|
250
|
-
|
|
250
|
+
interface DialogContentProps extends DialogContentFrameProps, DialogContentTypeProps {
|
|
251
251
|
/**
|
|
252
252
|
* Used to force mounting when more control is needed. Useful when
|
|
253
253
|
* controlling animation with React animation libraries.
|
|
@@ -592,53 +592,63 @@ const DescriptionWarning: React.FC<DescriptionWarningProps> = ({ contentRef, des
|
|
|
592
592
|
* Dialog
|
|
593
593
|
* -----------------------------------------------------------------------------------------------*/
|
|
594
594
|
|
|
595
|
-
const
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
595
|
+
const DialogInner = React.forwardRef<{ open: (val: boolean) => void }, DialogProps>(function Dialog(
|
|
596
|
+
props: ScopedProps<DialogProps>,
|
|
597
|
+
ref
|
|
598
|
+
) {
|
|
599
|
+
const {
|
|
600
|
+
__scopeDialog,
|
|
601
|
+
children,
|
|
602
|
+
open: openProp,
|
|
603
|
+
defaultOpen = false,
|
|
604
|
+
onOpenChange,
|
|
605
|
+
modal = true,
|
|
606
|
+
allowPinchZoom = false,
|
|
607
|
+
} = props
|
|
608
|
+
const triggerRef = React.useRef<HTMLButtonElement>(null)
|
|
609
|
+
const contentRef = React.useRef<TamaguiElement>(null)
|
|
610
|
+
const [open, setOpen] = useControllableState({
|
|
611
|
+
prop: openProp,
|
|
612
|
+
defaultProp: defaultOpen,
|
|
613
|
+
onChange: onOpenChange,
|
|
614
|
+
})
|
|
615
|
+
|
|
616
|
+
React.useImperativeHandle(
|
|
617
|
+
ref,
|
|
618
|
+
() => ({
|
|
619
|
+
open: setOpen,
|
|
620
|
+
}),
|
|
621
|
+
[]
|
|
622
|
+
)
|
|
613
623
|
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
)
|
|
624
|
+
return (
|
|
625
|
+
<DialogProvider
|
|
626
|
+
scope={__scopeDialog}
|
|
627
|
+
triggerRef={triggerRef}
|
|
628
|
+
contentRef={contentRef}
|
|
629
|
+
contentId={useId() || ''}
|
|
630
|
+
titleId={useId() || ''}
|
|
631
|
+
descriptionId={useId() || ''}
|
|
632
|
+
open={open}
|
|
633
|
+
onOpenChange={setOpen}
|
|
634
|
+
onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}
|
|
635
|
+
modal={modal}
|
|
636
|
+
allowPinchZoom={allowPinchZoom}
|
|
637
|
+
>
|
|
638
|
+
{children}
|
|
639
|
+
</DialogProvider>
|
|
640
|
+
)
|
|
641
|
+
})
|
|
642
|
+
|
|
643
|
+
const Dialog = withStaticProperties(DialogInner, {
|
|
644
|
+
Trigger: DialogTrigger,
|
|
645
|
+
Portal: DialogPortal,
|
|
646
|
+
Overlay: DialogOverlay,
|
|
647
|
+
Content: DialogContent,
|
|
648
|
+
Title: DialogTitle,
|
|
649
|
+
Description: DialogDescription,
|
|
650
|
+
Close: DialogClose,
|
|
651
|
+
})
|
|
642
652
|
|
|
643
653
|
export {
|
|
644
654
|
createDialogScope,
|