@forte-ui/react 1.0.0-alpha.1
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/README.md +240 -0
- package/dist/Accordion-9JunkjgY.js +111 -0
- package/dist/Alert-Cn_WUF3L.js +183 -0
- package/dist/AspectRatio-gSjpTVk-.js +39 -0
- package/dist/Avatar-BuitDluH.js +87 -0
- package/dist/Badge-sArNWMre.js +33 -0
- package/dist/Breadcrumb-Cq7tFtMX.js +170 -0
- package/dist/Button-AiyKnx5I.js +42 -0
- package/dist/ButtonGroup-C-CrwPXP.js +54 -0
- package/dist/Calendar-D7Q-QJ_e.js +503 -0
- package/dist/Checkbox-DfNbmOed.js +56 -0
- package/dist/Collapsible-D8UKiGip.js +86 -0
- package/dist/ColorPicker-B-eCI31W.js +612 -0
- package/dist/Combobox-D-BN-Tvp.js +302 -0
- package/dist/ContextMenu-D81uDaMG.js +44 -0
- package/dist/DatePicker-CfkMsaI-.js +192 -0
- package/dist/Dialog-_n8FpFs5.js +432 -0
- package/dist/Drawer-DKQF3OO7.js +158 -0
- package/dist/Field-FLFEO70D.js +58 -0
- package/dist/Fieldset-CYhh71Qt.js +28 -0
- package/dist/Form-DVPmW9XV.js +17 -0
- package/dist/Input-BgGWhO2q.js +18 -0
- package/dist/InputGroup-DsZyDXNn.js +89 -0
- package/dist/Menu-CKu9xE2h.js +261 -0
- package/dist/Menubar-Dax027Db.js +19 -0
- package/dist/NavList-DGvcIoJm.js +176 -0
- package/dist/NavigationMenu-BayQkUUb.js +209 -0
- package/dist/NumberField-P55SA8T7.js +191 -0
- package/dist/OTPField-CjHvBNSN.js +55 -0
- package/dist/Popover-BXhn2Wwt.js +142 -0
- package/dist/PreviewCard-Dnitrky0.js +99 -0
- package/dist/Progress-BlomDp-X.js +81 -0
- package/dist/ProgressCircle-j6XBl0fk.js +112 -0
- package/dist/Radio-BIcX4INJ.js +37 -0
- package/dist/Resizable-7nJJM97e.js +609 -0
- package/dist/ScrollArea-CBMGJ6hh.js +83 -0
- package/dist/Select-BP-zvdXm.js +237 -0
- package/dist/Separator-DewJBzaJ.js +21 -0
- package/dist/Skeleton-zr6ObCCq.js +79 -0
- package/dist/Slider-Bh8_cti1.js +104 -0
- package/dist/Spinner-BF0uD4hR.js +53 -0
- package/dist/Switch-OBewMMvM.js +39 -0
- package/dist/Tabs-LgkSbPSF.js +132 -0
- package/dist/Textarea-CqZJL41e.js +51 -0
- package/dist/Toast-BWayxAcd.js +304 -0
- package/dist/Toggle-BrhMnkF5.js +45 -0
- package/dist/Toolbar-OmOVCk3i.js +88 -0
- package/dist/Tooltip-CI4chsRw.js +101 -0
- package/dist/clsx-By2n9mTe.js +16 -0
- package/dist/cn.d.ts +8 -0
- package/dist/cn.js +11 -0
- package/dist/components/accordion/Accordion.d.ts +117 -0
- package/dist/components/accordion/Accordion.js +3 -0
- package/dist/components/accordion/index.d.ts +2 -0
- package/dist/components/accordion/index.js +2 -0
- package/dist/components/alert/Alert.d.ts +167 -0
- package/dist/components/alert/Alert.js +3 -0
- package/dist/components/alert/index.d.ts +2 -0
- package/dist/components/alert/index.js +2 -0
- package/dist/components/aspect-ratio/AspectRatio.d.ts +128 -0
- package/dist/components/aspect-ratio/AspectRatio.js +3 -0
- package/dist/components/aspect-ratio/index.d.ts +2 -0
- package/dist/components/aspect-ratio/index.js +2 -0
- package/dist/components/avatar/Avatar.d.ts +176 -0
- package/dist/components/avatar/Avatar.js +3 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/avatar/index.js +2 -0
- package/dist/components/badge/Badge.d.ts +117 -0
- package/dist/components/badge/Badge.js +3 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/badge/index.js +2 -0
- package/dist/components/breadcrumb/Breadcrumb.d.ts +244 -0
- package/dist/components/breadcrumb/Breadcrumb.js +3 -0
- package/dist/components/breadcrumb/index.d.ts +2 -0
- package/dist/components/breadcrumb/index.js +2 -0
- package/dist/components/button/Button.d.ts +73 -0
- package/dist/components/button/Button.js +3 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/button/index.js +2 -0
- package/dist/components/button-group/ButtonGroup.d.ts +113 -0
- package/dist/components/button-group/ButtonGroup.js +3 -0
- package/dist/components/button-group/index.d.ts +2 -0
- package/dist/components/button-group/index.js +2 -0
- package/dist/components/calendar/Calendar.d.ts +201 -0
- package/dist/components/calendar/Calendar.js +3 -0
- package/dist/components/calendar/index.d.ts +2 -0
- package/dist/components/calendar/index.js +2 -0
- package/dist/components/checkbox/Checkbox.d.ts +130 -0
- package/dist/components/checkbox/Checkbox.js +3 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/checkbox/index.js +2 -0
- package/dist/components/collapsible/Collapsible.d.ts +91 -0
- package/dist/components/collapsible/Collapsible.js +3 -0
- package/dist/components/collapsible/index.d.ts +2 -0
- package/dist/components/collapsible/index.js +2 -0
- package/dist/components/color-picker/ColorPicker.d.ts +553 -0
- package/dist/components/color-picker/ColorPicker.js +4 -0
- package/dist/components/color-picker/color.d.ts +102 -0
- package/dist/components/color-picker/color.js +249 -0
- package/dist/components/color-picker/index.d.ts +2 -0
- package/dist/components/color-picker/index.js +3 -0
- package/dist/components/combobox/Combobox.d.ts +553 -0
- package/dist/components/combobox/Combobox.js +3 -0
- package/dist/components/combobox/index.d.ts +2 -0
- package/dist/components/combobox/index.js +2 -0
- package/dist/components/context-menu/ContextMenu.d.ts +103 -0
- package/dist/components/context-menu/ContextMenu.js +3 -0
- package/dist/components/context-menu/index.d.ts +3 -0
- package/dist/components/context-menu/index.js +2 -0
- package/dist/components/date-picker/DatePicker.d.ts +268 -0
- package/dist/components/date-picker/DatePicker.js +3 -0
- package/dist/components/date-picker/index.d.ts +2 -0
- package/dist/components/date-picker/index.js +2 -0
- package/dist/components/dialog/Dialog.d.ts +567 -0
- package/dist/components/dialog/Dialog.js +3 -0
- package/dist/components/dialog/index.d.ts +2 -0
- package/dist/components/dialog/index.js +2 -0
- package/dist/components/drawer/Drawer.d.ts +351 -0
- package/dist/components/drawer/Drawer.js +3 -0
- package/dist/components/drawer/index.d.ts +2 -0
- package/dist/components/drawer/index.js +2 -0
- package/dist/components/field/Field.d.ts +170 -0
- package/dist/components/field/Field.js +3 -0
- package/dist/components/field/index.d.ts +2 -0
- package/dist/components/field/index.js +2 -0
- package/dist/components/fieldset/Fieldset.d.ts +60 -0
- package/dist/components/fieldset/Fieldset.js +3 -0
- package/dist/components/fieldset/index.d.ts +2 -0
- package/dist/components/fieldset/index.js +2 -0
- package/dist/components/form/Form.d.ts +76 -0
- package/dist/components/form/Form.js +3 -0
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/form/index.js +2 -0
- package/dist/components/input/Input.d.ts +67 -0
- package/dist/components/input/Input.js +3 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/index.js +2 -0
- package/dist/components/input-group/InputGroup.d.ts +214 -0
- package/dist/components/input-group/InputGroup.js +3 -0
- package/dist/components/input-group/index.d.ts +2 -0
- package/dist/components/input-group/index.js +2 -0
- package/dist/components/menu/Menu.d.ts +587 -0
- package/dist/components/menu/Menu.js +3 -0
- package/dist/components/menu/index.d.ts +2 -0
- package/dist/components/menu/index.js +2 -0
- package/dist/components/menubar/Menubar.d.ts +104 -0
- package/dist/components/menubar/Menubar.js +3 -0
- package/dist/components/menubar/index.d.ts +2 -0
- package/dist/components/menubar/index.js +2 -0
- package/dist/components/nav-list/NavList.d.ts +290 -0
- package/dist/components/nav-list/NavList.js +3 -0
- package/dist/components/nav-list/index.d.ts +2 -0
- package/dist/components/nav-list/index.js +2 -0
- package/dist/components/navigation-menu/NavigationMenu.d.ts +483 -0
- package/dist/components/navigation-menu/NavigationMenu.js +3 -0
- package/dist/components/navigation-menu/index.d.ts +2 -0
- package/dist/components/navigation-menu/index.js +2 -0
- package/dist/components/number-field/NumberField.d.ts +303 -0
- package/dist/components/number-field/NumberField.js +3 -0
- package/dist/components/number-field/index.d.ts +2 -0
- package/dist/components/number-field/index.js +2 -0
- package/dist/components/otp-field/OTPField.d.ts +206 -0
- package/dist/components/otp-field/OTPField.js +3 -0
- package/dist/components/otp-field/index.d.ts +2 -0
- package/dist/components/otp-field/index.js +2 -0
- package/dist/components/popover/Popover.d.ts +394 -0
- package/dist/components/popover/Popover.js +3 -0
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/popover/index.js +2 -0
- package/dist/components/preview-card/PreviewCard.d.ts +307 -0
- package/dist/components/preview-card/PreviewCard.js +3 -0
- package/dist/components/preview-card/index.d.ts +2 -0
- package/dist/components/preview-card/index.js +2 -0
- package/dist/components/progress/Progress.d.ts +156 -0
- package/dist/components/progress/Progress.js +3 -0
- package/dist/components/progress/ProgressCircle.d.ts +166 -0
- package/dist/components/progress/ProgressCircle.js +3 -0
- package/dist/components/progress/index.d.ts +4 -0
- package/dist/components/progress/index.js +3 -0
- package/dist/components/radio/Radio.d.ts +144 -0
- package/dist/components/radio/Radio.js +3 -0
- package/dist/components/radio/index.d.ts +2 -0
- package/dist/components/radio/index.js +2 -0
- package/dist/components/resizable/Resizable.d.ts +211 -0
- package/dist/components/resizable/Resizable.js +3 -0
- package/dist/components/resizable/index.d.ts +2 -0
- package/dist/components/resizable/index.js +2 -0
- package/dist/components/scroll-area/ScrollArea.d.ts +113 -0
- package/dist/components/scroll-area/ScrollArea.js +3 -0
- package/dist/components/scroll-area/index.d.ts +2 -0
- package/dist/components/scroll-area/index.js +2 -0
- package/dist/components/select/Select.d.ts +345 -0
- package/dist/components/select/Select.js +3 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/index.js +2 -0
- package/dist/components/separator/Separator.d.ts +75 -0
- package/dist/components/separator/Separator.js +3 -0
- package/dist/components/separator/index.d.ts +2 -0
- package/dist/components/separator/index.js +2 -0
- package/dist/components/skeleton/Skeleton.d.ts +169 -0
- package/dist/components/skeleton/Skeleton.js +3 -0
- package/dist/components/skeleton/index.d.ts +2 -0
- package/dist/components/skeleton/index.js +2 -0
- package/dist/components/slider/Slider.d.ts +208 -0
- package/dist/components/slider/Slider.js +3 -0
- package/dist/components/slider/index.d.ts +2 -0
- package/dist/components/slider/index.js +2 -0
- package/dist/components/spinner/Spinner.d.ts +92 -0
- package/dist/components/spinner/Spinner.js +3 -0
- package/dist/components/spinner/index.d.ts +2 -0
- package/dist/components/spinner/index.js +2 -0
- package/dist/components/switch/Switch.d.ts +80 -0
- package/dist/components/switch/Switch.js +3 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/index.js +2 -0
- package/dist/components/tabs/Tabs.d.ts +125 -0
- package/dist/components/tabs/Tabs.js +3 -0
- package/dist/components/tabs/index.d.ts +2 -0
- package/dist/components/tabs/index.js +2 -0
- package/dist/components/textarea/Textarea.d.ts +119 -0
- package/dist/components/textarea/Textarea.js +3 -0
- package/dist/components/textarea/index.d.ts +2 -0
- package/dist/components/textarea/index.js +2 -0
- package/dist/components/toast/Toast.d.ts +517 -0
- package/dist/components/toast/Toast.js +3 -0
- package/dist/components/toast/index.d.ts +2 -0
- package/dist/components/toast/index.js +2 -0
- package/dist/components/toggle/Toggle.d.ts +171 -0
- package/dist/components/toggle/Toggle.js +3 -0
- package/dist/components/toggle/index.d.ts +2 -0
- package/dist/components/toggle/index.js +2 -0
- package/dist/components/toolbar/Toolbar.d.ts +318 -0
- package/dist/components/toolbar/Toolbar.js +3 -0
- package/dist/components/toolbar/index.d.ts +2 -0
- package/dist/components/toolbar/index.js +2 -0
- package/dist/components/tooltip/Tooltip.d.ts +361 -0
- package/dist/components/tooltip/Tooltip.js +3 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/tooltip/index.js +2 -0
- package/dist/index.d.ts +92 -0
- package/dist/index.js +86 -0
- package/dist/styles/Accordion.css +1 -0
- package/dist/styles/Alert.css +1 -0
- package/dist/styles/AspectRatio.css +1 -0
- package/dist/styles/Avatar.css +1 -0
- package/dist/styles/Badge.css +1 -0
- package/dist/styles/Breadcrumb.css +1 -0
- package/dist/styles/Button.css +1 -0
- package/dist/styles/ButtonGroup.css +1 -0
- package/dist/styles/Calendar.css +1 -0
- package/dist/styles/Checkbox.css +1 -0
- package/dist/styles/Collapsible.css +1 -0
- package/dist/styles/ColorPicker.css +1 -0
- package/dist/styles/Combobox.css +1 -0
- package/dist/styles/ContextMenu.css +1 -0
- package/dist/styles/DatePicker.css +1 -0
- package/dist/styles/Dialog.css +1 -0
- package/dist/styles/Drawer.css +1 -0
- package/dist/styles/Field.css +1 -0
- package/dist/styles/Fieldset.css +1 -0
- package/dist/styles/Form.css +1 -0
- package/dist/styles/Input.css +1 -0
- package/dist/styles/InputGroup.css +1 -0
- package/dist/styles/Menu.css +1 -0
- package/dist/styles/Menubar.css +1 -0
- package/dist/styles/NavList.css +1 -0
- package/dist/styles/NavigationMenu.css +1 -0
- package/dist/styles/NumberField.css +1 -0
- package/dist/styles/OTPField.css +1 -0
- package/dist/styles/Popover.css +1 -0
- package/dist/styles/PreviewCard.css +1 -0
- package/dist/styles/Progress.css +1 -0
- package/dist/styles/ProgressCircle.css +1 -0
- package/dist/styles/Radio.css +1 -0
- package/dist/styles/Resizable.css +1 -0
- package/dist/styles/ScrollArea.css +1 -0
- package/dist/styles/Select.css +1 -0
- package/dist/styles/Separator.css +1 -0
- package/dist/styles/Skeleton.css +1 -0
- package/dist/styles/Slider.css +1 -0
- package/dist/styles/Spinner.css +1 -0
- package/dist/styles/Switch.css +1 -0
- package/dist/styles/Tabs.css +1 -0
- package/dist/styles/Textarea.css +1 -0
- package/dist/styles/Toast.css +1 -0
- package/dist/styles/Toggle.css +1 -0
- package/dist/styles/Toolbar.css +1 -0
- package/dist/styles/Tooltip.css +1 -0
- package/dist/styles/a11y.css +119 -0
- package/dist/styles/layers.css +39 -0
- package/dist/styles/motion.css +194 -0
- package/dist/styles/patterns.css +236 -0
- package/dist/styles/properties.css +62 -0
- package/dist/styles/reset.css +11 -0
- package/dist/styles/tailwind.css +281 -0
- package/dist/styles/theme.css +57 -0
- package/dist/styles/tokens.color.css +223 -0
- package/dist/styles/tokens.css +460 -0
- package/dist/tailwind-merge.d.ts +52 -0
- package/dist/tailwind-merge.js +52 -0
- package/docs-data/props.json +8047 -0
- package/docs-data/theming.json +9600 -0
- package/docs-data/tokens.json +4070 -0
- package/package.json +78 -0
|
@@ -0,0 +1,567 @@
|
|
|
1
|
+
import { Dialog as BaseDialog, DialogRootProps as BaseDialogRootProps, DialogTriggerProps as BaseDialogTriggerProps, DialogPopupProps as BaseDialogPopupProps, DialogPortalProps as BaseDialogPortalProps, DialogTitleProps as BaseDialogTitleProps, DialogDescriptionProps as BaseDialogDescriptionProps, DialogCloseProps as BaseDialogCloseProps } from '@base-ui/react/dialog';
|
|
2
|
+
import { AlertDialog as BaseAlertDialog, AlertDialogRootProps as BaseAlertDialogRootProps, AlertDialogTriggerProps as BaseAlertDialogTriggerProps } from '@base-ui/react/alert-dialog';
|
|
3
|
+
import { ButtonTone } from '../button';
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
export type DialogSize = "sm" | "md" | "lg" | "fullscreen";
|
|
6
|
+
export type DialogFooterAlign = "start" | "center" | "end" | "between";
|
|
7
|
+
/**
|
|
8
|
+
* Props for `Dialog.Root`. Every Base UI `Dialog.Root` prop is forwarded
|
|
9
|
+
* unchanged — `open`, `defaultOpen`, `onOpenChange`, `onOpenChangeComplete`,
|
|
10
|
+
* `modal`, `disablePointerDismissal`, `actionsRef`, `handle`, `triggerId`,
|
|
11
|
+
* `defaultTriggerId`.
|
|
12
|
+
*
|
|
13
|
+
* `Root` renders no DOM element, so it accepts no `className`, `style` or
|
|
14
|
+
* `ref`. Style the popup instead.
|
|
15
|
+
*/
|
|
16
|
+
export type DialogRootProps<Payload = unknown> = BaseDialogRootProps<Payload>;
|
|
17
|
+
/**
|
|
18
|
+
* Groups all parts of a dialog and owns its open state.
|
|
19
|
+
*
|
|
20
|
+
* Renders no DOM element of its own.
|
|
21
|
+
*/
|
|
22
|
+
export declare function DialogRoot<Payload>(props: DialogRootProps<Payload>): React.JSX.Element;
|
|
23
|
+
/**
|
|
24
|
+
* Props for `AlertDialog.Root`.
|
|
25
|
+
*
|
|
26
|
+
* Identical to `DialogRootProps` minus `modal` and `disablePointerDismissal`:
|
|
27
|
+
* an alert dialog is *always* modal and never dismisses on an outside press,
|
|
28
|
+
* because it interrupts the user to ask a question that has to be answered.
|
|
29
|
+
*/
|
|
30
|
+
export type AlertDialogRootProps<Payload = unknown> = BaseAlertDialogRootProps<Payload>;
|
|
31
|
+
/**
|
|
32
|
+
* Groups all parts of an alert dialog — a modal, non-dismissible dialog that
|
|
33
|
+
* requires an explicit response.
|
|
34
|
+
*
|
|
35
|
+
* Renders no DOM element of its own.
|
|
36
|
+
*/
|
|
37
|
+
export declare function AlertDialogRoot<Payload>(props: AlertDialogRootProps<Payload>): React.JSX.Element;
|
|
38
|
+
export interface DialogTriggerProps<Payload = unknown> extends Omit<BaseDialogTriggerProps<Payload>, "className"> {
|
|
39
|
+
/**
|
|
40
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
41
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
42
|
+
*/
|
|
43
|
+
className?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* `React.forwardRef` erases generics, so the exported value is re-typed with
|
|
47
|
+
* a generic call signature — the same shape Base UI itself exports — to keep
|
|
48
|
+
* `payload` and `handle` inferring together.
|
|
49
|
+
*/
|
|
50
|
+
interface DialogTriggerComponent {
|
|
51
|
+
<Payload>(props: DialogTriggerProps<Payload>): React.JSX.Element;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A button that opens the dialog.
|
|
55
|
+
*
|
|
56
|
+
* Renders a `<button>`. Pass `render={<Button />}` to compose it with a
|
|
57
|
+
* styled button — the trigger's own neutral styling steps aside when `render`
|
|
58
|
+
* is present, so the two never fight over the cascade.
|
|
59
|
+
*/
|
|
60
|
+
export declare const DialogTrigger: DialogTriggerComponent;
|
|
61
|
+
export interface AlertDialogTriggerProps<Payload = unknown> extends Omit<BaseAlertDialogTriggerProps<Payload>, "className"> {
|
|
62
|
+
/**
|
|
63
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
64
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
65
|
+
*/
|
|
66
|
+
className?: string;
|
|
67
|
+
}
|
|
68
|
+
interface AlertDialogTriggerComponent {
|
|
69
|
+
<Payload>(props: AlertDialogTriggerProps<Payload>): React.JSX.Element;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* A button that opens the alert dialog.
|
|
73
|
+
*
|
|
74
|
+
* Renders a `<button>`. Identical to `Dialog.Trigger` except that it accepts
|
|
75
|
+
* an `AlertDialog` handle.
|
|
76
|
+
*/
|
|
77
|
+
export declare const AlertDialogTrigger: AlertDialogTriggerComponent;
|
|
78
|
+
export interface DialogPopupProps extends Omit<BaseDialogPopupProps, "className"> {
|
|
79
|
+
/**
|
|
80
|
+
* Maximum width of the popup. `"fullscreen"` drops the radius and the
|
|
81
|
+
* viewport padding and lets the surface fill the screen, which is the
|
|
82
|
+
* usual mobile treatment for a long form.
|
|
83
|
+
* @default "md"
|
|
84
|
+
*/
|
|
85
|
+
size?: DialogSize;
|
|
86
|
+
/**
|
|
87
|
+
* Keep the portal — and therefore the popup — in the DOM while the dialog
|
|
88
|
+
* is closed. Needed when something inside must stay mounted (an iframe, a
|
|
89
|
+
* media element, uncommitted form state).
|
|
90
|
+
* @default false
|
|
91
|
+
*/
|
|
92
|
+
keepMounted?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Element the portal renders into. Defaults to `document.body`; set it when
|
|
95
|
+
* the dialog must live inside a specific stacking or shadow root.
|
|
96
|
+
*/
|
|
97
|
+
container?: BaseDialogPortalProps["container"];
|
|
98
|
+
/**
|
|
99
|
+
* Render the scrim behind the popup. Turn it off for a non-modal dialog
|
|
100
|
+
* that should leave the page visibly usable.
|
|
101
|
+
* @default true
|
|
102
|
+
*/
|
|
103
|
+
backdrop?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Render the backdrop even when this dialog is nested inside another one.
|
|
106
|
+
* Base UI suppresses nested backdrops by default — the parent dims itself
|
|
107
|
+
* through `[data-nested-dialog-open]` instead — so only set this when a
|
|
108
|
+
* nested dialog genuinely needs its own scrim.
|
|
109
|
+
* @default false
|
|
110
|
+
*/
|
|
111
|
+
forceBackdrop?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Additional class name(s) for the backdrop element. The popup's own
|
|
114
|
+
* `className` cannot reach it, since the backdrop is a sibling rendered
|
|
115
|
+
* inside this component.
|
|
116
|
+
*/
|
|
117
|
+
backdropClassName?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Additional class name(s) for the scrollable viewport that positions the
|
|
120
|
+
* popup. Use it to change alignment (e.g. pin the dialog to the top), or to
|
|
121
|
+
* re-point `--forte-dialog-z-index` — it defaults to 40, one band under the
|
|
122
|
+
* anchored popups, so a `Select` or `Tooltip` inside a dialog stays above
|
|
123
|
+
* it. The backdrop reads `--forte-dialog-backdrop-z-index` (39) from
|
|
124
|
+
* `backdropClassName`, since it is the viewport's sibling.
|
|
125
|
+
*/
|
|
126
|
+
viewportClassName?: string;
|
|
127
|
+
/**
|
|
128
|
+
* Additional class name(s) for the popup itself. Applied after the internal
|
|
129
|
+
* styles so consumer utilities (e.g. Tailwind) win without needing
|
|
130
|
+
* `!important`.
|
|
131
|
+
*/
|
|
132
|
+
className?: string;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* The dialog surface, together with the three wrappers it always needs:
|
|
136
|
+
* `Portal` → `Backdrop` + `Viewport` → `Popup`. Collapsing them into one
|
|
137
|
+
* component keeps the common case to a single element while leaving every
|
|
138
|
+
* Base UI `Popup` prop (`initialFocus`, `finalFocus`, `render`, …) available.
|
|
139
|
+
*
|
|
140
|
+
* `Title`, `Description` and `Close` must be rendered *inside* this component:
|
|
141
|
+
* that is what auto-wires `aria-labelledby` / `aria-describedby`, and a close
|
|
142
|
+
* button outside the popup is unreachable to touch screen-reader users.
|
|
143
|
+
*
|
|
144
|
+
* The same component serves `AlertDialog` — Base UI's alert dialog re-exports
|
|
145
|
+
* these exact parts.
|
|
146
|
+
*/
|
|
147
|
+
export declare const DialogPopup: React.ForwardRefExoticComponent<Omit<DialogPopupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
148
|
+
export interface DialogSurfaceProps extends Omit<React.ComponentPropsWithoutRef<"div">, "className"> {
|
|
149
|
+
/**
|
|
150
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
151
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
152
|
+
*/
|
|
153
|
+
className?: string;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The visible panel, for dialogs that also carry chrome *outside* it — a close
|
|
157
|
+
* button floating clear of the corner, a caption under the sheet, pager arrows
|
|
158
|
+
* beside it.
|
|
159
|
+
*
|
|
160
|
+
* Use it and `Dialog.Popup` stops painting: the popup keeps the sizing, the
|
|
161
|
+
* focus trap and the enter/exit gesture but turns into a transparent container,
|
|
162
|
+
* and this element becomes the surface. Everything stays inside `Dialog.Popup`
|
|
163
|
+
* and therefore inside the tab order and the accessibility tree — which is the
|
|
164
|
+
* whole point, since in a modal dialog anything outside the popup is inert.
|
|
165
|
+
*
|
|
166
|
+
* There is no prop to pair it with. The stylesheet asks `.popup:has(> .surface)`,
|
|
167
|
+
* so the popup switches on the presence of this element and the two cannot
|
|
168
|
+
* disagree. Keep it a *direct* child of `Dialog.Popup`.
|
|
169
|
+
*
|
|
170
|
+
* A plain `<div>`, not a Base UI part — the primitive has no such anatomy, and
|
|
171
|
+
* Base UI's own example for this pattern uses a bare div too.
|
|
172
|
+
*/
|
|
173
|
+
export declare const DialogSurface: React.ForwardRefExoticComponent<DialogSurfaceProps & React.RefAttributes<HTMLDivElement>>;
|
|
174
|
+
export interface DialogTitleProps extends Omit<BaseDialogTitleProps, "className"> {
|
|
175
|
+
/**
|
|
176
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
177
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
178
|
+
*/
|
|
179
|
+
className?: string;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* The dialog's accessible name.
|
|
183
|
+
*
|
|
184
|
+
* Renders an `<h2>`. Inside `Dialog.Popup` it is wired up as the popup's
|
|
185
|
+
* `aria-labelledby` automatically; every dialog should have one.
|
|
186
|
+
*/
|
|
187
|
+
export declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogTitleProps, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
188
|
+
export interface DialogDescriptionProps extends Omit<BaseDialogDescriptionProps, "className"> {
|
|
189
|
+
/**
|
|
190
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
191
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
192
|
+
*/
|
|
193
|
+
className?: string;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* A short explanation of what the dialog is for.
|
|
197
|
+
*
|
|
198
|
+
* Renders a `<p>`. Inside `Dialog.Popup` it becomes the popup's
|
|
199
|
+
* `aria-describedby`, so it is announced after the title.
|
|
200
|
+
*/
|
|
201
|
+
export declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogDescriptionProps, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
202
|
+
export interface DialogCloseProps extends Omit<BaseDialogCloseProps, "className"> {
|
|
203
|
+
/**
|
|
204
|
+
* Render as a square button sized for a single icon — the corner "×"
|
|
205
|
+
* treatment. Enforces the 24px minimum hit target from WCAG SC 2.5.8.
|
|
206
|
+
* Always pair with `aria-label`, since there is no text to announce.
|
|
207
|
+
* @default false
|
|
208
|
+
*/
|
|
209
|
+
iconOnly?: boolean;
|
|
210
|
+
/**
|
|
211
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
212
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
213
|
+
*/
|
|
214
|
+
className?: string;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* A button that closes the dialog.
|
|
218
|
+
*
|
|
219
|
+
* Renders a `<button>`. Keep it inside `Dialog.Popup`: in a modal dialog the
|
|
220
|
+
* rest of the page is inert, and a touch screen-reader user has no other way
|
|
221
|
+
* out. Pass `render={<Button />}` to compose it with a styled button — the
|
|
222
|
+
* close button's own neutral styling steps aside when `render` is present.
|
|
223
|
+
*/
|
|
224
|
+
export declare const DialogClose: React.ForwardRefExoticComponent<Omit<DialogCloseProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
225
|
+
export interface DialogFooterProps extends Omit<React.ComponentPropsWithoutRef<"div">, "className"> {
|
|
226
|
+
/**
|
|
227
|
+
* How the actions are distributed along the footer. `"between"` is the
|
|
228
|
+
* pattern for a destructive action pushed away from the safe one.
|
|
229
|
+
* @default "end"
|
|
230
|
+
*/
|
|
231
|
+
align?: DialogFooterAlign;
|
|
232
|
+
/**
|
|
233
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
234
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
235
|
+
*/
|
|
236
|
+
className?: string;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* The action row at the bottom of a dialog.
|
|
240
|
+
*
|
|
241
|
+
* A plain `<div>` — not a Base UI part — that supplies the standard spacing
|
|
242
|
+
* and alignment for the confirm/cancel buttons. In a `size="fullscreen"`
|
|
243
|
+
* dialog it sinks to the bottom edge.
|
|
244
|
+
*/
|
|
245
|
+
export declare const DialogFooter: React.ForwardRefExoticComponent<DialogFooterProps & React.RefAttributes<HTMLDivElement>>;
|
|
246
|
+
/**
|
|
247
|
+
* The fields every built-in dialog understands.
|
|
248
|
+
*
|
|
249
|
+
* `title` and `description` are the two fields a toast takes, and they mean
|
|
250
|
+
* the same thing here — which is why `dialog.confirm("Delete this?")` becomes
|
|
251
|
+
* the *title* rather than the body. The title is the dialog's accessible name,
|
|
252
|
+
* and a dialog without one is announced as just "dialog".
|
|
253
|
+
*/
|
|
254
|
+
export interface DialogMessageOptions {
|
|
255
|
+
/** The question or the statement, and the dialog's accessible name. */
|
|
256
|
+
title?: React.ReactNode;
|
|
257
|
+
/** A second line under it, and the dialog's accessible description. */
|
|
258
|
+
description?: React.ReactNode;
|
|
259
|
+
/**
|
|
260
|
+
* Maximum width of the popup. These dialogs hold a sentence and two
|
|
261
|
+
* buttons, so they start narrower than a composed one.
|
|
262
|
+
* @default "sm"
|
|
263
|
+
*/
|
|
264
|
+
size?: DialogSize;
|
|
265
|
+
/**
|
|
266
|
+
* Tone of the button that answers the dialog. Reach for `"danger"` whenever
|
|
267
|
+
* the answer destroys something — it also moves the footer to
|
|
268
|
+
* `align="between"`, which pushes the safe button away from it.
|
|
269
|
+
* @default "primary"
|
|
270
|
+
*/
|
|
271
|
+
tone?: ButtonTone;
|
|
272
|
+
/**
|
|
273
|
+
* Additional class name(s) for the popup — the place to set a
|
|
274
|
+
* `--forte-dialog-*` knob for one call.
|
|
275
|
+
*/
|
|
276
|
+
className?: string;
|
|
277
|
+
}
|
|
278
|
+
/** Options for `dialog.alert()`. */
|
|
279
|
+
export interface DialogAlertOptions extends DialogMessageOptions {
|
|
280
|
+
/**
|
|
281
|
+
* Label of the single acknowledging button.
|
|
282
|
+
* @default the provider's `labels.ok`, "OK"
|
|
283
|
+
*/
|
|
284
|
+
okLabel?: React.ReactNode;
|
|
285
|
+
}
|
|
286
|
+
/** Options for `dialog.confirm()`. */
|
|
287
|
+
export interface DialogConfirmOptions extends DialogMessageOptions {
|
|
288
|
+
/**
|
|
289
|
+
* Label of the button that resolves the promise with `true`.
|
|
290
|
+
* @default the provider's `labels.confirm`, "Confirm"
|
|
291
|
+
*/
|
|
292
|
+
confirmLabel?: React.ReactNode;
|
|
293
|
+
/**
|
|
294
|
+
* Label of the button that resolves it with `false`.
|
|
295
|
+
* @default the provider's `labels.cancel`, "Cancel"
|
|
296
|
+
*/
|
|
297
|
+
cancelLabel?: React.ReactNode;
|
|
298
|
+
/**
|
|
299
|
+
* How the two buttons are distributed along the footer.
|
|
300
|
+
* @default `"between"` when `tone` is `"danger"`, `"end"` otherwise
|
|
301
|
+
*/
|
|
302
|
+
align?: DialogFooterAlign;
|
|
303
|
+
}
|
|
304
|
+
/** Options for `dialog.confirmWithInput()`. */
|
|
305
|
+
export interface DialogConfirmWithInputOptions extends DialogConfirmOptions {
|
|
306
|
+
/**
|
|
307
|
+
* The exact string the user has to type before the confirm button enables.
|
|
308
|
+
* Surrounding whitespace is ignored, since a pasted value often carries a
|
|
309
|
+
* trailing space and that is not a different answer.
|
|
310
|
+
*/
|
|
311
|
+
confirmValue: string;
|
|
312
|
+
/**
|
|
313
|
+
* Label above the input.
|
|
314
|
+
* @default the provider's `labels.confirmInput`, "Type <confirmValue> to confirm"
|
|
315
|
+
*/
|
|
316
|
+
inputLabel?: React.ReactNode;
|
|
317
|
+
/**
|
|
318
|
+
* Placeholder inside the input.
|
|
319
|
+
* @default `confirmValue`
|
|
320
|
+
*/
|
|
321
|
+
placeholder?: string;
|
|
322
|
+
/**
|
|
323
|
+
* Whether the typed value has to match `confirmValue`'s case. Leave it on
|
|
324
|
+
* for a destructive action: an answer that has to be typed exactly is the
|
|
325
|
+
* whole point of the pattern.
|
|
326
|
+
* @default true
|
|
327
|
+
*/
|
|
328
|
+
caseSensitive?: boolean;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* What a component rendered by `dialog.show()` receives.
|
|
332
|
+
*
|
|
333
|
+
* It renders the *contents* of the dialog — normally one `Dialog.Popup` — and
|
|
334
|
+
* not the root. The provider owns the root, which is what lets it stack the
|
|
335
|
+
* dialog on whatever is already open, hold the entry in the tree until the
|
|
336
|
+
* exit transition ends, and guarantee that the promise settles even when the
|
|
337
|
+
* dialog is dismissed by Escape rather than answered by a button.
|
|
338
|
+
*/
|
|
339
|
+
export interface CustomDialogProps<Payload = void, Result = void> {
|
|
340
|
+
/** The second argument `dialog.show()` was called with. */
|
|
341
|
+
payload: Payload;
|
|
342
|
+
/**
|
|
343
|
+
* Answers the dialog: resolves the promise with `result` and starts the exit
|
|
344
|
+
* transition. Stable for the life of the dialog, and safe to call twice —
|
|
345
|
+
* the first answer is the one that is kept.
|
|
346
|
+
*/
|
|
347
|
+
close: (result: Result) => void;
|
|
348
|
+
/**
|
|
349
|
+
* Dismisses the dialog: resolves the promise with `dismissValue` — the same
|
|
350
|
+
* thing Escape and an outside press do. It exists because `close()` demands
|
|
351
|
+
* a `Result`, and a cancel button has none to give.
|
|
352
|
+
*/
|
|
353
|
+
dismiss: () => void;
|
|
354
|
+
}
|
|
355
|
+
/** A component that can be handed to `dialog.show()`. */
|
|
356
|
+
export type CustomDialogComponent<Payload = void, Result = void> = React.ComponentType<CustomDialogProps<Payload, Result>>;
|
|
357
|
+
/** Options for `dialog.show()`. */
|
|
358
|
+
export interface DialogShowOptions<Result = void> {
|
|
359
|
+
/**
|
|
360
|
+
* Render an `AlertDialog.Root` instead of a `Dialog.Root`: always modal,
|
|
361
|
+
* never dismissed by a press outside it. Use it when the dialog asks a
|
|
362
|
+
* question that has to be answered.
|
|
363
|
+
* @default false
|
|
364
|
+
*/
|
|
365
|
+
alert?: boolean;
|
|
366
|
+
/**
|
|
367
|
+
* What the promise resolves to when the dialog is dismissed — Escape, an
|
|
368
|
+
* outside press, the provider unmounting — rather than answered through
|
|
369
|
+
* `close()`.
|
|
370
|
+
* @default undefined
|
|
371
|
+
*/
|
|
372
|
+
dismissValue?: Result;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* The copy the built-in dialogs put on screen that the call site does not
|
|
376
|
+
* supply. Override it on `Dialog.Provider` — that is the translation seam, and
|
|
377
|
+
* it is the reason `confirm()` can take a message and nothing else.
|
|
378
|
+
*/
|
|
379
|
+
export interface DialogLabels {
|
|
380
|
+
/** The single button on `alert()`. */
|
|
381
|
+
ok: React.ReactNode;
|
|
382
|
+
/** The affirmative button on `confirm()` and `confirmWithInput()`. */
|
|
383
|
+
confirm: React.ReactNode;
|
|
384
|
+
/** The dismissing button on both. */
|
|
385
|
+
cancel: React.ReactNode;
|
|
386
|
+
/** The label above the input on `confirmWithInput()`. */
|
|
387
|
+
confirmInput: (confirmValue: string) => React.ReactNode;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* The dialog API — what `useDialog()` returns, and what
|
|
391
|
+
* `Dialog.createManager()` gives you outside React.
|
|
392
|
+
*
|
|
393
|
+
* Every method resolves when the user answers or dismisses the dialog, not
|
|
394
|
+
* when it finishes animating away: an `await dialog.confirm()` continues the
|
|
395
|
+
* moment the decision is made.
|
|
396
|
+
*/
|
|
397
|
+
export interface DialogApi {
|
|
398
|
+
/**
|
|
399
|
+
* Shows a message that has to be acknowledged. Resolves when it is.
|
|
400
|
+
*
|
|
401
|
+
* A bare message becomes the `title`, which is the dialog's accessible name.
|
|
402
|
+
*/
|
|
403
|
+
alert: (options: React.ReactNode | DialogAlertOptions) => Promise<void>;
|
|
404
|
+
/**
|
|
405
|
+
* Asks a yes-or-no question. Resolves to `true` when the user confirms, and
|
|
406
|
+
* to `false` for every other way out — Cancel, Escape, the provider
|
|
407
|
+
* unmounting.
|
|
408
|
+
*/
|
|
409
|
+
confirm: (options: React.ReactNode | DialogConfirmOptions) => Promise<boolean>;
|
|
410
|
+
/**
|
|
411
|
+
* Asks a yes-or-no question whose confirm button stays disabled until the
|
|
412
|
+
* user types `confirmValue`. The pattern for a delete that cannot be undone.
|
|
413
|
+
*/
|
|
414
|
+
confirmWithInput: (options: DialogConfirmWithInputOptions) => Promise<boolean>;
|
|
415
|
+
/**
|
|
416
|
+
* Shows a component of your own and resolves with whatever it passes to
|
|
417
|
+
* `close()`. Resolves to `dismissValue` — `undefined` unless you say
|
|
418
|
+
* otherwise — when it is dismissed instead.
|
|
419
|
+
*/
|
|
420
|
+
show: <Payload, Result = void>(Component: CustomDialogComponent<Payload, Result>, payload: Payload, options?: DialogShowOptions<Result>) => Promise<Result | undefined>;
|
|
421
|
+
/** Dismisses the topmost dialog, exactly as Escape does. */
|
|
422
|
+
close: () => void;
|
|
423
|
+
/** Dismisses every dialog on the stack. */
|
|
424
|
+
closeAll: () => void;
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* A manager from `Dialog.createManager()`. Same methods as `useDialog()`,
|
|
428
|
+
* usable from anywhere.
|
|
429
|
+
*/
|
|
430
|
+
export type DialogManager = DialogApi;
|
|
431
|
+
/**
|
|
432
|
+
* Creates a dialog manager that works outside React.
|
|
433
|
+
*
|
|
434
|
+
* ```ts
|
|
435
|
+
* // dialogs.ts
|
|
436
|
+
* export const dialogs = Dialog.createManager();
|
|
437
|
+
*
|
|
438
|
+
* // anywhere — an API client, a router guard, a store
|
|
439
|
+
* if (await dialogs.confirm("Discard your draft?")) discard();
|
|
440
|
+
*
|
|
441
|
+
* // app root
|
|
442
|
+
* <Dialog.Provider manager={dialogs}>…</Dialog.Provider>
|
|
443
|
+
* ```
|
|
444
|
+
*
|
|
445
|
+
* Pass the manager itself, not something inside it — unlike `Toast.Provider`,
|
|
446
|
+
* which has a Base UI manager underneath to hand over.
|
|
447
|
+
*
|
|
448
|
+
* A dialog opened before a provider has mounted is *queued* rather than
|
|
449
|
+
* dropped, because a dropped one would leave its promise pending for the life
|
|
450
|
+
* of the page. It appears as soon as a provider mounts. If none ever does, the
|
|
451
|
+
* `await` never returns — so mount the provider at the root, once.
|
|
452
|
+
*/
|
|
453
|
+
export declare function createDialogManager(): DialogManager;
|
|
454
|
+
export interface DialogProviderProps {
|
|
455
|
+
/** The part of the app that can open dialogs. */
|
|
456
|
+
children?: React.ReactNode;
|
|
457
|
+
/**
|
|
458
|
+
* A manager from `Dialog.createManager()`. Pass one and the provider drives
|
|
459
|
+
* that manager's stack instead of its own, which is what lets code outside
|
|
460
|
+
* React open a dialog. `useDialog()` reaches the same stack either way.
|
|
461
|
+
*/
|
|
462
|
+
manager?: DialogManager;
|
|
463
|
+
/**
|
|
464
|
+
* Overrides for the built-in button labels — the only copy `alert()`,
|
|
465
|
+
* `confirm()` and `confirmWithInput()` put on screen that the call site does
|
|
466
|
+
* not supply. Set it once here instead of passing `okLabel` and
|
|
467
|
+
* `cancelLabel` to every call; this is the translation seam.
|
|
468
|
+
*/
|
|
469
|
+
labels?: Partial<DialogLabels>;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Enables `useDialog()` underneath it, and renders whatever is opened.
|
|
473
|
+
*
|
|
474
|
+
* ```tsx
|
|
475
|
+
* <Dialog.Provider>
|
|
476
|
+
* <App />
|
|
477
|
+
* </Dialog.Provider>
|
|
478
|
+
* ```
|
|
479
|
+
*
|
|
480
|
+
* Mount it once, above everything that might ask a question. It renders no DOM
|
|
481
|
+
* element of its own and every dialog is portalled to `<body>`, so where it
|
|
482
|
+
* sits in the tree does not matter beyond that.
|
|
483
|
+
*
|
|
484
|
+
* The stack it renders is *nested*: a dialog opened while another is on screen
|
|
485
|
+
* becomes that dialog's child, which is what makes the parent step back and
|
|
486
|
+
* dim instead of being covered by a second backdrop.
|
|
487
|
+
*/
|
|
488
|
+
export declare function DialogProvider({ children, manager, labels, }: DialogProviderProps): React.JSX.Element;
|
|
489
|
+
/**
|
|
490
|
+
* Opens dialogs from inside a component, and waits for the answer.
|
|
491
|
+
*
|
|
492
|
+
* ```tsx
|
|
493
|
+
* const dialog = useDialog();
|
|
494
|
+
*
|
|
495
|
+
* if (await dialog.confirm("Delete this draft?")) {
|
|
496
|
+
* await deleteDraft();
|
|
497
|
+
* }
|
|
498
|
+
* ```
|
|
499
|
+
*
|
|
500
|
+
* Must be called under a `Dialog.Provider`.
|
|
501
|
+
*
|
|
502
|
+
* The object and every method on it keep the same identity for the life of the
|
|
503
|
+
* provider, so both the object and one pulled out by destructuring are safe in
|
|
504
|
+
* a dependency array.
|
|
505
|
+
*/
|
|
506
|
+
export declare function useDialog(): DialogApi;
|
|
507
|
+
/**
|
|
508
|
+
* A modal surface built on Base UI's `Dialog`.
|
|
509
|
+
*
|
|
510
|
+
* ```tsx
|
|
511
|
+
* <Dialog.Root>
|
|
512
|
+
* <Dialog.Trigger render={<Button />}>Edit profile</Dialog.Trigger>
|
|
513
|
+
* <Dialog.Popup size="sm">
|
|
514
|
+
* <Dialog.Title>Edit profile</Dialog.Title>
|
|
515
|
+
* <Dialog.Description>Change your display name.</Dialog.Description>
|
|
516
|
+
* <Dialog.Footer>
|
|
517
|
+
* <Dialog.Close render={<Button variant="soft" tone="neutral" />}>
|
|
518
|
+
* Cancel
|
|
519
|
+
* </Dialog.Close>
|
|
520
|
+
* <Dialog.Close render={<Button />}>Save</Dialog.Close>
|
|
521
|
+
* </Dialog.Footer>
|
|
522
|
+
* </Dialog.Popup>
|
|
523
|
+
* </Dialog.Root>
|
|
524
|
+
* ```
|
|
525
|
+
*
|
|
526
|
+
* `Dialog.Provider` and `useDialog()` are the other way to reach the same
|
|
527
|
+
* surface — a dialog opened by a call and awaited for its answer, for the
|
|
528
|
+
* questions that have no button on screen to hang a `Root` off.
|
|
529
|
+
*/
|
|
530
|
+
export declare const Dialog: {
|
|
531
|
+
Root: typeof DialogRoot;
|
|
532
|
+
Trigger: DialogTriggerComponent;
|
|
533
|
+
Popup: React.ForwardRefExoticComponent<Omit<DialogPopupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
534
|
+
Surface: React.ForwardRefExoticComponent<DialogSurfaceProps & React.RefAttributes<HTMLDivElement>>;
|
|
535
|
+
Title: React.ForwardRefExoticComponent<Omit<DialogTitleProps, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
536
|
+
Description: React.ForwardRefExoticComponent<Omit<DialogDescriptionProps, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
537
|
+
Close: React.ForwardRefExoticComponent<Omit<DialogCloseProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
538
|
+
Footer: React.ForwardRefExoticComponent<DialogFooterProps & React.RefAttributes<HTMLDivElement>>;
|
|
539
|
+
/** Enables `useDialog()` underneath it, and renders what it opens. */
|
|
540
|
+
Provider: typeof DialogProvider;
|
|
541
|
+
/** Creates a handle that connects a `Dialog.Root` to detached triggers. */
|
|
542
|
+
createHandle: typeof BaseDialog.createHandle;
|
|
543
|
+
/** Creates a dialog manager usable outside React. */
|
|
544
|
+
createManager: typeof createDialogManager;
|
|
545
|
+
};
|
|
546
|
+
/**
|
|
547
|
+
* An always-modal dialog that interrupts the user and requires an answer —
|
|
548
|
+
* confirming a delete, discarding unsaved work.
|
|
549
|
+
*
|
|
550
|
+
* Shares every part and every style with `Dialog`; only `Root` and `Trigger`
|
|
551
|
+
* differ. There is deliberately no `modal` or `disablePointerDismissal` prop:
|
|
552
|
+
* an alert dialog traps focus, locks page scroll, and cannot be dismissed by
|
|
553
|
+
* clicking outside it. Give it at least one `AlertDialog.Close`.
|
|
554
|
+
*/
|
|
555
|
+
export declare const AlertDialog: {
|
|
556
|
+
Root: typeof AlertDialogRoot;
|
|
557
|
+
Trigger: AlertDialogTriggerComponent;
|
|
558
|
+
Popup: React.ForwardRefExoticComponent<Omit<DialogPopupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
559
|
+
Surface: React.ForwardRefExoticComponent<DialogSurfaceProps & React.RefAttributes<HTMLDivElement>>;
|
|
560
|
+
Title: React.ForwardRefExoticComponent<Omit<DialogTitleProps, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
561
|
+
Description: React.ForwardRefExoticComponent<Omit<DialogDescriptionProps, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
562
|
+
Close: React.ForwardRefExoticComponent<Omit<DialogCloseProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
563
|
+
Footer: React.ForwardRefExoticComponent<DialogFooterProps & React.RefAttributes<HTMLDivElement>>;
|
|
564
|
+
/** Creates a handle that connects an `AlertDialog.Root` to detached triggers. */
|
|
565
|
+
createHandle: typeof BaseAlertDialog.createHandle;
|
|
566
|
+
};
|
|
567
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { a as e, c as t, d as n, f as r, h as i, i as a, l as o, m as s, n as c, o as l, p as u, r as d, s as f, t as p, u as m } from "../../Dialog-_n8FpFs5.js";
|
|
3
|
+
export { p as AlertDialog, c as AlertDialogRoot, d as AlertDialogTrigger, a as Dialog, e as DialogClose, l as DialogDescription, f as DialogFooter, t as DialogPopup, o as DialogProvider, m as DialogRoot, n as DialogSurface, r as DialogTitle, u as DialogTrigger, s as createDialogManager, i as useDialog };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { Dialog, AlertDialog, useDialog, DialogProvider, createDialogManager, } from './Dialog';
|
|
2
|
+
export type { DialogSize, DialogFooterAlign, DialogRootProps, DialogTriggerProps, DialogPopupProps, DialogSurfaceProps, DialogTitleProps, DialogDescriptionProps, DialogCloseProps, DialogFooterProps, AlertDialogRootProps, AlertDialogTriggerProps, DialogProviderProps, DialogApi, DialogManager, DialogLabels, DialogMessageOptions, DialogAlertOptions, DialogConfirmOptions, DialogConfirmWithInputOptions, DialogShowOptions, CustomDialogProps, CustomDialogComponent, } from './Dialog';
|