@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,394 @@
|
|
|
1
|
+
import { Popover as BasePopover } from '@base-ui/react/popover';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export type PopoverSize = "sm" | "md" | "lg";
|
|
4
|
+
export type PopoverFooterAlign = "start" | "center" | "end" | "between";
|
|
5
|
+
export interface PopoverRootProps<Payload = unknown> extends BasePopover.Root.Props<Payload> {
|
|
6
|
+
/**
|
|
7
|
+
* Whether the popover is open when it first mounts. For a controlled
|
|
8
|
+
* popover use `open` instead.
|
|
9
|
+
* @default false
|
|
10
|
+
*/
|
|
11
|
+
defaultOpen?: BasePopover.Root.Props<Payload>["defaultOpen"];
|
|
12
|
+
/**
|
|
13
|
+
* Whether the popover is currently open. Pass this together with
|
|
14
|
+
* `onOpenChange` to control the popover.
|
|
15
|
+
*/
|
|
16
|
+
open?: BasePopover.Root.Props<Payload>["open"];
|
|
17
|
+
/**
|
|
18
|
+
* Called when the popover wants to open or close. The second argument
|
|
19
|
+
* carries the reason (`'trigger-press'`, `'trigger-hover'`,
|
|
20
|
+
* `'trigger-focus'`, `'outside-press'`, `'escape-key'`, `'close-press'`,
|
|
21
|
+
* `'focus-out'`, `'imperative-action'`, `'none'`), the trigger involved,
|
|
22
|
+
* and can `cancel()` the change — which is how a popover holding an
|
|
23
|
+
* unsaved form asks before it closes.
|
|
24
|
+
*/
|
|
25
|
+
onOpenChange?: BasePopover.Root.Props<Payload>["onOpenChange"];
|
|
26
|
+
/**
|
|
27
|
+
* Called after the open or close transition has finished. Use this rather
|
|
28
|
+
* than a timer when work has to wait for the popup to actually leave.
|
|
29
|
+
*/
|
|
30
|
+
onOpenChangeComplete?: BasePopover.Root.Props<Payload>["onOpenChangeComplete"];
|
|
31
|
+
/**
|
|
32
|
+
* Whether the popover takes the page over while it is open.
|
|
33
|
+
*
|
|
34
|
+
* - `false` — the rest of the page stays scrollable and clickable.
|
|
35
|
+
* - `true` — page scroll is locked and pointer interaction outside the
|
|
36
|
+
* popup is disabled.
|
|
37
|
+
* - `'trap-focus'` — focus is trapped inside the popup, but scrolling and
|
|
38
|
+
* outside pointer interaction still work.
|
|
39
|
+
*
|
|
40
|
+
* With `true` or `'trap-focus'`, render a `Popover.Close` inside the popup:
|
|
41
|
+
* it is what a touch screen-reader user uses to get out, and with `true` it
|
|
42
|
+
* is also what switches focus trapping on.
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
modal?: BasePopover.Root.Props<Payload>["modal"];
|
|
46
|
+
/**
|
|
47
|
+
* Imperative escape hatch. `close()` closes the popover; `unmount()` forces
|
|
48
|
+
* the popup out of the DOM, for when an exit animation is driven
|
|
49
|
+
* externally.
|
|
50
|
+
*/
|
|
51
|
+
actionsRef?: BasePopover.Root.Props<Payload>["actionsRef"];
|
|
52
|
+
/**
|
|
53
|
+
* Associates this popover with detached triggers created through
|
|
54
|
+
* `Popover.createHandle()`, so one popup can serve triggers that live
|
|
55
|
+
* elsewhere in the tree.
|
|
56
|
+
*/
|
|
57
|
+
handle?: BasePopover.Root.Props<Payload>["handle"];
|
|
58
|
+
/**
|
|
59
|
+
* Which trigger the popover is currently attached to, for controlled
|
|
60
|
+
* multi-trigger setups. There is no separate `onTriggerIdChange` — read the
|
|
61
|
+
* new id off `eventDetails.trigger` inside `onOpenChange`.
|
|
62
|
+
*/
|
|
63
|
+
triggerId?: BasePopover.Root.Props<Payload>["triggerId"];
|
|
64
|
+
/**
|
|
65
|
+
* The initially attached trigger id. Pairs with `defaultOpen` the way
|
|
66
|
+
* `triggerId` pairs with `open`.
|
|
67
|
+
*/
|
|
68
|
+
defaultTriggerId?: BasePopover.Root.Props<Payload>["defaultTriggerId"];
|
|
69
|
+
/**
|
|
70
|
+
* The trigger and popup for this popover. May also be a render function
|
|
71
|
+
* receiving `{ payload }` from the trigger that opened it.
|
|
72
|
+
*/
|
|
73
|
+
children?: BasePopover.Root.Props<Payload>["children"];
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Groups one popover's trigger and popup, and owns its open state. Renders no
|
|
77
|
+
* DOM element, so it takes no `className`, `style` or `ref`.
|
|
78
|
+
*/
|
|
79
|
+
declare function PopoverRoot<Payload = unknown>(props: PopoverRootProps<Payload>): React.JSX.Element;
|
|
80
|
+
export interface PopoverTriggerProps<Payload = unknown> extends Omit<BasePopover.Trigger.Props<Payload>, "className"> {
|
|
81
|
+
/**
|
|
82
|
+
* Also open the popover when the trigger is hovered. This is the setting
|
|
83
|
+
* that turns an "i" info icon into the accessible alternative to a tooltip:
|
|
84
|
+
* hover reveals it for pointer users while press still reveals it for
|
|
85
|
+
* everyone else.
|
|
86
|
+
* @default false
|
|
87
|
+
*/
|
|
88
|
+
openOnHover?: BasePopover.Trigger.Props<Payload>["openOnHover"];
|
|
89
|
+
/**
|
|
90
|
+
* How long the pointer must rest on the trigger before the popover opens,
|
|
91
|
+
* in milliseconds. Requires `openOnHover`.
|
|
92
|
+
* @default 300
|
|
93
|
+
*/
|
|
94
|
+
delay?: BasePopover.Trigger.Props<Payload>["delay"];
|
|
95
|
+
/**
|
|
96
|
+
* How long the popover lingers after the pointer leaves, in milliseconds.
|
|
97
|
+
* Requires `openOnHover`.
|
|
98
|
+
* @default 0
|
|
99
|
+
*/
|
|
100
|
+
closeDelay?: BasePopover.Trigger.Props<Payload>["closeDelay"];
|
|
101
|
+
/**
|
|
102
|
+
* Whether the rendered element is a real `<button>`. Set it to `false` when
|
|
103
|
+
* `render` replaces the button with something else (a `<div>`, a table
|
|
104
|
+
* row), so Base UI supplies the keyboard and role behaviour the element
|
|
105
|
+
* does not have natively.
|
|
106
|
+
* @default true
|
|
107
|
+
*/
|
|
108
|
+
nativeButton?: BasePopover.Trigger.Props<Payload>["nativeButton"];
|
|
109
|
+
/**
|
|
110
|
+
* Associates a detached trigger with the `Popover.Root` carrying the same
|
|
111
|
+
* handle, created once outside render with `Popover.createHandle()`.
|
|
112
|
+
*/
|
|
113
|
+
handle?: BasePopover.Trigger.Props<Payload>["handle"];
|
|
114
|
+
/**
|
|
115
|
+
* Data handed to the popover when this trigger opens it, so one popup can
|
|
116
|
+
* render different content per trigger. Read it from the render-function
|
|
117
|
+
* form of `Popover.Root`'s children.
|
|
118
|
+
*/
|
|
119
|
+
payload?: BasePopover.Trigger.Props<Payload>["payload"];
|
|
120
|
+
/**
|
|
121
|
+
* Identifies the trigger. Also how `Popover.Root`'s `triggerId` names the
|
|
122
|
+
* active trigger in controlled multi-trigger mode.
|
|
123
|
+
*/
|
|
124
|
+
id?: BasePopover.Trigger.Props<Payload>["id"];
|
|
125
|
+
/**
|
|
126
|
+
* Replaces the rendered `<button>` with another element or component —
|
|
127
|
+
* `render={<Button variant="outline" />}` is the common case. The trigger's
|
|
128
|
+
* own neutral styling steps aside when this is present, so the two never
|
|
129
|
+
* fight over the cascade.
|
|
130
|
+
*/
|
|
131
|
+
render?: BasePopover.Trigger.Props<Payload>["render"];
|
|
132
|
+
/**
|
|
133
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
134
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
135
|
+
*/
|
|
136
|
+
className?: string;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* `React.forwardRef` erases generics, so the exported value is re-typed with a
|
|
140
|
+
* generic call signature — the same shape Base UI itself exports — to keep
|
|
141
|
+
* `payload` and `handle` inferring together.
|
|
142
|
+
*/
|
|
143
|
+
interface PopoverTriggerComponent {
|
|
144
|
+
<Payload>(props: PopoverTriggerProps<Payload> & React.RefAttributes<HTMLButtonElement>): React.JSX.Element;
|
|
145
|
+
}
|
|
146
|
+
type PositionerProps = BasePopover.Positioner.Props;
|
|
147
|
+
export interface PopoverPopupProps extends Omit<BasePopover.Popup.Props, "className"> {
|
|
148
|
+
/**
|
|
149
|
+
* Width cap for the popup. The popup shrinks to fit its content and only
|
|
150
|
+
* grows to this width when the content asks for it, so this is a ceiling
|
|
151
|
+
* rather than a fixed measure. Further clamped to the space the positioner
|
|
152
|
+
* reports as available.
|
|
153
|
+
* @default "md"
|
|
154
|
+
*/
|
|
155
|
+
size?: PopoverSize;
|
|
156
|
+
/**
|
|
157
|
+
* Which side of the trigger to place the popup on. Flips automatically to
|
|
158
|
+
* avoid collisions. `"inline-start"` / `"inline-end"` follow writing
|
|
159
|
+
* direction.
|
|
160
|
+
* @default "bottom"
|
|
161
|
+
*/
|
|
162
|
+
side?: PositionerProps["side"];
|
|
163
|
+
/**
|
|
164
|
+
* How the popup lines up with the trigger along the chosen side.
|
|
165
|
+
* @default "center"
|
|
166
|
+
*/
|
|
167
|
+
align?: PositionerProps["align"];
|
|
168
|
+
/**
|
|
169
|
+
* Gap between trigger and popup, in pixels, or a function returning one.
|
|
170
|
+
* When an `Arrow` is rendered this must exceed the arrow's height or the
|
|
171
|
+
* arrow overlaps the trigger; the default leaves room for the default
|
|
172
|
+
* arrow.
|
|
173
|
+
* @default 8
|
|
174
|
+
*/
|
|
175
|
+
sideOffset?: PositionerProps["sideOffset"];
|
|
176
|
+
/**
|
|
177
|
+
* Shifts the popup along the alignment axis, in pixels, or a function
|
|
178
|
+
* returning one.
|
|
179
|
+
* @default 0
|
|
180
|
+
*/
|
|
181
|
+
alignOffset?: PositionerProps["alignOffset"];
|
|
182
|
+
/**
|
|
183
|
+
* Minimum distance, in pixels, the arrow keeps from the popup's corners
|
|
184
|
+
* before it is allowed to sit off-centre (`data-uncentered`).
|
|
185
|
+
* @default 5
|
|
186
|
+
*/
|
|
187
|
+
arrowPadding?: PositionerProps["arrowPadding"];
|
|
188
|
+
/**
|
|
189
|
+
* The element the popup positions against, when it should not be the
|
|
190
|
+
* trigger. Accepts an element, a ref, a getter, or a virtual element — a
|
|
191
|
+
* text selection or a right-click point.
|
|
192
|
+
*/
|
|
193
|
+
anchor?: PositionerProps["anchor"];
|
|
194
|
+
/**
|
|
195
|
+
* The boundary the popup tries to stay inside of.
|
|
196
|
+
* @default "clipping-ancestors"
|
|
197
|
+
*/
|
|
198
|
+
collisionBoundary?: PositionerProps["collisionBoundary"];
|
|
199
|
+
/**
|
|
200
|
+
* Space, in pixels, kept between the popup and the collision boundary.
|
|
201
|
+
* @default 5
|
|
202
|
+
*/
|
|
203
|
+
collisionPadding?: PositionerProps["collisionPadding"];
|
|
204
|
+
/**
|
|
205
|
+
* How the popup reacts when it would overflow the boundary — whether it
|
|
206
|
+
* flips, shifts, or stays put.
|
|
207
|
+
*/
|
|
208
|
+
collisionAvoidance?: PositionerProps["collisionAvoidance"];
|
|
209
|
+
/**
|
|
210
|
+
* Keeps the popup glued to the trigger while it scrolls out of view instead
|
|
211
|
+
* of letting it detach.
|
|
212
|
+
* @default false
|
|
213
|
+
*/
|
|
214
|
+
sticky?: PositionerProps["sticky"];
|
|
215
|
+
/**
|
|
216
|
+
* Whether the popup is positioned with `position: absolute` or
|
|
217
|
+
* `position: fixed`.
|
|
218
|
+
* @default "absolute"
|
|
219
|
+
*/
|
|
220
|
+
positionMethod?: PositionerProps["positionMethod"];
|
|
221
|
+
/**
|
|
222
|
+
* Stops the popup re-measuring the anchor on scroll and resize. Cheaper,
|
|
223
|
+
* but the popup drifts if the anchor moves.
|
|
224
|
+
* @default false
|
|
225
|
+
*/
|
|
226
|
+
disableAnchorTracking?: PositionerProps["disableAnchorTracking"];
|
|
227
|
+
/**
|
|
228
|
+
* Render a scrim behind the popup. Off by default — a popover normally
|
|
229
|
+
* leaves the page visible and usable. Turn it on with `modal` on
|
|
230
|
+
* `Popover.Root`, where the page is already inert and the scrim is what
|
|
231
|
+
* says so.
|
|
232
|
+
* @default false
|
|
233
|
+
*/
|
|
234
|
+
backdrop?: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* Keeps the portal — and therefore the popup — in the DOM while the popover
|
|
237
|
+
* is closed. Needed when something inside must stay mounted (an iframe, a
|
|
238
|
+
* media element, uncommitted form state).
|
|
239
|
+
* @default false
|
|
240
|
+
*/
|
|
241
|
+
keepMounted?: BasePopover.Portal.Props["keepMounted"];
|
|
242
|
+
/**
|
|
243
|
+
* Where the portal renders. Defaults to `document.body`; point it at a
|
|
244
|
+
* container when the popup has to live inside a specific stacking or shadow
|
|
245
|
+
* root.
|
|
246
|
+
*/
|
|
247
|
+
container?: BasePopover.Portal.Props["container"];
|
|
248
|
+
/**
|
|
249
|
+
* Additional class name(s) for the backdrop element. The popup's own
|
|
250
|
+
* `className` cannot reach it, since the backdrop is a sibling rendered
|
|
251
|
+
* inside this component. Also where `--forte-popover-backdrop-z-index` goes.
|
|
252
|
+
*/
|
|
253
|
+
backdropClassName?: string;
|
|
254
|
+
/**
|
|
255
|
+
* Additional class name(s) for the positioner element, which owns placement
|
|
256
|
+
* and `z-index`. Use it to re-stack a single popover through
|
|
257
|
+
* `--forte-popover-z-index`.
|
|
258
|
+
*/
|
|
259
|
+
positionerClassName?: string;
|
|
260
|
+
/**
|
|
261
|
+
* Forwarded to the popup element.
|
|
262
|
+
*/
|
|
263
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
264
|
+
/**
|
|
265
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
266
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
267
|
+
*/
|
|
268
|
+
className?: string;
|
|
269
|
+
}
|
|
270
|
+
export interface PopoverArrowProps extends Omit<BasePopover.Arrow.Props, "className"> {
|
|
271
|
+
/**
|
|
272
|
+
* Replaces the built-in wedge. The default SVG inherits the popup's colours
|
|
273
|
+
* through `--forte-popover-bg`, so a custom skin usually needs nothing here.
|
|
274
|
+
*/
|
|
275
|
+
children?: React.ReactNode;
|
|
276
|
+
/**
|
|
277
|
+
* Forwarded to the arrow element.
|
|
278
|
+
*/
|
|
279
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
280
|
+
/**
|
|
281
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
282
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
283
|
+
*/
|
|
284
|
+
className?: string;
|
|
285
|
+
}
|
|
286
|
+
export interface PopoverTitleProps extends Omit<BasePopover.Title.Props, "className"> {
|
|
287
|
+
/**
|
|
288
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
289
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
290
|
+
*/
|
|
291
|
+
className?: string;
|
|
292
|
+
}
|
|
293
|
+
export interface PopoverDescriptionProps extends Omit<BasePopover.Description.Props, "className"> {
|
|
294
|
+
/**
|
|
295
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
296
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
297
|
+
*/
|
|
298
|
+
className?: string;
|
|
299
|
+
}
|
|
300
|
+
export interface PopoverCloseProps extends Omit<BasePopover.Close.Props, "className"> {
|
|
301
|
+
/**
|
|
302
|
+
* Render as a square button sized for a single icon — the corner "×"
|
|
303
|
+
* treatment. Enforces the 24px minimum hit target from WCAG SC 2.5.8.
|
|
304
|
+
* Always pair with `aria-label`, since there is no text to announce.
|
|
305
|
+
* @default false
|
|
306
|
+
*/
|
|
307
|
+
iconOnly?: boolean;
|
|
308
|
+
/**
|
|
309
|
+
* Replaces the rendered `<button>`. The close button's own neutral styling
|
|
310
|
+
* steps aside when this is present.
|
|
311
|
+
*/
|
|
312
|
+
render?: BasePopover.Close.Props["render"];
|
|
313
|
+
/**
|
|
314
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
315
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
316
|
+
*/
|
|
317
|
+
className?: string;
|
|
318
|
+
}
|
|
319
|
+
export interface PopoverFooterProps extends Omit<React.ComponentPropsWithoutRef<"div">, "className"> {
|
|
320
|
+
/**
|
|
321
|
+
* How the actions are distributed along the footer. `"between"` is the
|
|
322
|
+
* pattern for a destructive action pushed away from the safe one.
|
|
323
|
+
* @default "end"
|
|
324
|
+
*/
|
|
325
|
+
align?: PopoverFooterAlign;
|
|
326
|
+
/**
|
|
327
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
328
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
329
|
+
*/
|
|
330
|
+
className?: string;
|
|
331
|
+
}
|
|
332
|
+
export interface PopoverViewportProps extends Omit<BasePopover.Viewport.Props, "className"> {
|
|
333
|
+
/**
|
|
334
|
+
* The content that changes from trigger to trigger.
|
|
335
|
+
*/
|
|
336
|
+
children?: BasePopover.Viewport.Props["children"];
|
|
337
|
+
/**
|
|
338
|
+
* Forwarded to the viewport element.
|
|
339
|
+
*/
|
|
340
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
341
|
+
/**
|
|
342
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
343
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
344
|
+
*/
|
|
345
|
+
className?: string;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* An anchored surface for content the user has to read or act on, built on
|
|
349
|
+
* Base UI's unstyled `Popover` primitive.
|
|
350
|
+
*
|
|
351
|
+
* ```tsx
|
|
352
|
+
* <Popover.Root>
|
|
353
|
+
* <Popover.Trigger render={<Button variant="outline" />}>
|
|
354
|
+
* Notifications
|
|
355
|
+
* </Popover.Trigger>
|
|
356
|
+
* <Popover.Popup>
|
|
357
|
+
* <Popover.Arrow />
|
|
358
|
+
* <Popover.Title>Notifications</Popover.Title>
|
|
359
|
+
* <Popover.Description>You are all caught up.</Popover.Description>
|
|
360
|
+
* </Popover.Popup>
|
|
361
|
+
* </Popover.Root>
|
|
362
|
+
* ```
|
|
363
|
+
*
|
|
364
|
+
* ## Popover or tooltip?
|
|
365
|
+
*
|
|
366
|
+
* The question is what the TRIGGER is for, not how much text the popup holds.
|
|
367
|
+
* If the trigger's purpose *is* to open the popup — the little "i" info icon
|
|
368
|
+
* is the usual case — it is a popover. If the trigger does something else and
|
|
369
|
+
* the popup merely labels it, it is a `Tooltip`.
|
|
370
|
+
*
|
|
371
|
+
* A popover is the accessible choice whenever the content matters: the popup
|
|
372
|
+
* is announced, it can be tabbed into, and it opens on touch — none of which
|
|
373
|
+
* is true of a tooltip. For the info-icon pattern, set `openOnHover` on
|
|
374
|
+
* `Popover.Trigger` and it behaves like a tooltip for pointer users while
|
|
375
|
+
* staying reachable for everyone else.
|
|
376
|
+
*
|
|
377
|
+
* Styling is driven by `data-*` attributes and `--forte-popover-*` custom
|
|
378
|
+
* properties, so it can be re-skinned from plain CSS or targeted with Tailwind
|
|
379
|
+
* arbitrary variants (`data-[side=top]:...`) without wrapping.
|
|
380
|
+
*/
|
|
381
|
+
export declare const Popover: {
|
|
382
|
+
Root: typeof PopoverRoot;
|
|
383
|
+
Trigger: PopoverTriggerComponent;
|
|
384
|
+
Popup: React.ForwardRefExoticComponent<Omit<PopoverPopupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
385
|
+
Arrow: React.ForwardRefExoticComponent<Omit<PopoverArrowProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
386
|
+
Title: React.ForwardRefExoticComponent<Omit<PopoverTitleProps, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
387
|
+
Description: React.ForwardRefExoticComponent<Omit<PopoverDescriptionProps, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
388
|
+
Close: React.ForwardRefExoticComponent<Omit<PopoverCloseProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
389
|
+
Footer: React.ForwardRefExoticComponent<PopoverFooterProps & React.RefAttributes<HTMLDivElement>>;
|
|
390
|
+
Viewport: React.ForwardRefExoticComponent<Omit<PopoverViewportProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
391
|
+
/** Creates a handle that connects a `Popover.Root` to detached triggers. */
|
|
392
|
+
createHandle: typeof BasePopover.createHandle;
|
|
393
|
+
};
|
|
394
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { Popover } from './Popover';
|
|
2
|
+
export type { PopoverSize, PopoverFooterAlign, PopoverRootProps, PopoverTriggerProps, PopoverPopupProps, PopoverArrowProps, PopoverTitleProps, PopoverDescriptionProps, PopoverCloseProps, PopoverFooterProps, PopoverViewportProps, } from './Popover';
|