@wordpress/ui 0.10.0 → 0.11.1-next.v.202604091042.0
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/CHANGELOG.md +27 -0
- package/CONTRIBUTING.md +25 -0
- package/README.md +22 -2
- package/build/alert-dialog/context.cjs +6 -1
- package/build/alert-dialog/context.cjs.map +2 -2
- package/build/alert-dialog/popup.cjs +105 -33
- package/build/alert-dialog/popup.cjs.map +4 -4
- package/build/alert-dialog/root.cjs +106 -6
- package/build/alert-dialog/root.cjs.map +2 -2
- package/build/alert-dialog/trigger.cjs +4 -14
- package/build/alert-dialog/trigger.cjs.map +3 -3
- package/build/alert-dialog/types.cjs.map +1 -1
- package/build/button/button.cjs +16 -6
- package/build/button/button.cjs.map +3 -3
- package/build/card/content.cjs +3 -3
- package/build/card/content.cjs.map +1 -1
- package/build/card/full-bleed.cjs +3 -3
- package/build/card/full-bleed.cjs.map +1 -1
- package/build/card/header.cjs +3 -3
- package/build/card/header.cjs.map +1 -1
- package/build/card/root.cjs +3 -3
- package/build/card/root.cjs.map +1 -1
- package/build/card/title.cjs +3 -3
- package/build/card/title.cjs.map +1 -1
- package/build/collapsible-card/header.cjs +3 -3
- package/build/collapsible-card/header.cjs.map +2 -2
- package/build/empty-state/title.cjs.map +2 -2
- package/build/form/primitives/field/description.cjs +17 -4
- package/build/form/primitives/field/description.cjs.map +3 -3
- package/build/form/primitives/field/details.cjs +3 -3
- package/build/form/primitives/field/details.cjs.map +2 -2
- package/build/form/primitives/field/label.cjs +3 -3
- package/build/form/primitives/field/label.cjs.map +2 -2
- package/build/form/primitives/fieldset/description.cjs +20 -4
- package/build/form/primitives/fieldset/description.cjs.map +3 -3
- package/build/form/primitives/fieldset/details.cjs +3 -3
- package/build/form/primitives/fieldset/details.cjs.map +2 -2
- package/build/form/primitives/fieldset/legend.cjs +3 -3
- package/build/form/primitives/fieldset/legend.cjs.map +2 -2
- package/build/form/primitives/input/input.cjs +23 -7
- package/build/form/primitives/input/input.cjs.map +3 -3
- package/build/form/primitives/input-layout/input-layout.cjs +10 -0
- package/build/form/primitives/input-layout/input-layout.cjs.map +3 -3
- package/build/form/primitives/select/trigger.cjs +3 -3
- package/build/form/primitives/select/trigger.cjs.map +2 -2
- package/build/form/primitives/textarea/textarea.cjs +20 -1
- package/build/form/primitives/textarea/textarea.cjs.map +3 -3
- package/build/index.cjs +3 -0
- package/build/index.cjs.map +2 -2
- package/build/link/link.cjs +16 -6
- package/build/link/link.cjs.map +3 -3
- package/build/popover/arrow.cjs +94 -0
- package/build/popover/arrow.cjs.map +7 -0
- package/build/popover/close.cjs +45 -0
- package/build/popover/close.cjs.map +7 -0
- package/build/popover/context.cjs +76 -0
- package/build/popover/context.cjs.map +7 -0
- package/build/popover/description.cjs +70 -0
- package/build/popover/description.cjs.map +7 -0
- package/build/popover/index.cjs +49 -0
- package/build/popover/index.cjs.map +7 -0
- package/build/popover/popup.cjs +138 -0
- package/build/popover/popup.cjs.map +7 -0
- package/build/popover/root.cjs +35 -0
- package/build/popover/root.cjs.map +7 -0
- package/build/popover/title.cjs +56 -0
- package/build/popover/title.cjs.map +7 -0
- package/build/popover/trigger.cjs +38 -0
- package/build/popover/trigger.cjs.map +7 -0
- package/build/popover/types.cjs +19 -0
- package/build/popover/types.cjs.map +7 -0
- package/build/text/text.cjs +20 -5
- package/build/text/text.cjs.map +3 -3
- package/build/utils/use-deprioritized-initial-focus.cjs.map +2 -2
- package/build-module/alert-dialog/context.mjs +6 -1
- package/build-module/alert-dialog/context.mjs.map +2 -2
- package/build-module/alert-dialog/popup.mjs +107 -33
- package/build-module/alert-dialog/popup.mjs.map +4 -4
- package/build-module/alert-dialog/root.mjs +113 -7
- package/build-module/alert-dialog/root.mjs.map +2 -2
- package/build-module/alert-dialog/trigger.mjs +4 -4
- package/build-module/alert-dialog/trigger.mjs.map +3 -3
- package/build-module/button/button.mjs +16 -6
- package/build-module/button/button.mjs.map +3 -3
- package/build-module/card/content.mjs +3 -3
- package/build-module/card/content.mjs.map +1 -1
- package/build-module/card/full-bleed.mjs +3 -3
- package/build-module/card/full-bleed.mjs.map +1 -1
- package/build-module/card/header.mjs +3 -3
- package/build-module/card/header.mjs.map +1 -1
- package/build-module/card/root.mjs +3 -3
- package/build-module/card/root.mjs.map +1 -1
- package/build-module/card/title.mjs +3 -3
- package/build-module/card/title.mjs.map +1 -1
- package/build-module/collapsible-card/header.mjs +3 -3
- package/build-module/collapsible-card/header.mjs.map +2 -2
- package/build-module/empty-state/title.mjs.map +2 -2
- package/build-module/form/primitives/field/description.mjs +17 -4
- package/build-module/form/primitives/field/description.mjs.map +3 -3
- package/build-module/form/primitives/field/details.mjs +3 -3
- package/build-module/form/primitives/field/details.mjs.map +2 -2
- package/build-module/form/primitives/field/label.mjs +3 -3
- package/build-module/form/primitives/field/label.mjs.map +2 -2
- package/build-module/form/primitives/fieldset/description.mjs +20 -4
- package/build-module/form/primitives/fieldset/description.mjs.map +3 -3
- package/build-module/form/primitives/fieldset/details.mjs +3 -3
- package/build-module/form/primitives/fieldset/details.mjs.map +2 -2
- package/build-module/form/primitives/fieldset/legend.mjs +3 -3
- package/build-module/form/primitives/fieldset/legend.mjs.map +2 -2
- package/build-module/form/primitives/input/input.mjs +23 -7
- package/build-module/form/primitives/input/input.mjs.map +3 -3
- package/build-module/form/primitives/input-layout/input-layout.mjs +10 -0
- package/build-module/form/primitives/input-layout/input-layout.mjs.map +3 -3
- package/build-module/form/primitives/select/trigger.mjs +3 -3
- package/build-module/form/primitives/select/trigger.mjs.map +2 -2
- package/build-module/form/primitives/textarea/textarea.mjs +20 -1
- package/build-module/form/primitives/textarea/textarea.mjs.map +3 -3
- package/build-module/index.mjs +2 -0
- package/build-module/index.mjs.map +2 -2
- package/build-module/link/link.mjs +16 -6
- package/build-module/link/link.mjs.map +3 -3
- package/build-module/popover/arrow.mjs +59 -0
- package/build-module/popover/arrow.mjs.map +7 -0
- package/build-module/popover/close.mjs +20 -0
- package/build-module/popover/close.mjs.map +7 -0
- package/build-module/popover/context.mjs +57 -0
- package/build-module/popover/context.mjs.map +7 -0
- package/build-module/popover/description.mjs +35 -0
- package/build-module/popover/description.mjs.map +7 -0
- package/build-module/popover/index.mjs +18 -0
- package/build-module/popover/index.mjs.map +7 -0
- package/build-module/popover/popup.mjs +105 -0
- package/build-module/popover/popup.mjs.map +7 -0
- package/build-module/popover/root.mjs +10 -0
- package/build-module/popover/root.mjs.map +7 -0
- package/build-module/popover/title.mjs +31 -0
- package/build-module/popover/title.mjs.map +7 -0
- package/build-module/popover/trigger.mjs +13 -0
- package/build-module/popover/trigger.mjs.map +7 -0
- package/build-module/popover/types.mjs +1 -0
- package/build-module/popover/types.mjs.map +7 -0
- package/build-module/text/text.mjs +20 -5
- package/build-module/text/text.mjs.map +3 -3
- package/build-module/utils/use-deprioritized-initial-focus.mjs.map +2 -2
- package/build-types/alert-dialog/context.d.ts +6 -3
- package/build-types/alert-dialog/context.d.ts.map +1 -1
- package/build-types/alert-dialog/popup.d.ts.map +1 -1
- package/build-types/alert-dialog/root.d.ts +2 -8
- package/build-types/alert-dialog/root.d.ts.map +1 -1
- package/build-types/alert-dialog/stories/index.story.d.ts +18 -6
- package/build-types/alert-dialog/stories/index.story.d.ts.map +1 -1
- package/build-types/alert-dialog/trigger.d.ts +2 -1
- package/build-types/alert-dialog/trigger.d.ts.map +1 -1
- package/build-types/alert-dialog/types.d.ts +57 -26
- package/build-types/alert-dialog/types.d.ts.map +1 -1
- package/build-types/button/button.d.ts.map +1 -1
- package/build-types/card/stories/index.story.d.ts.map +1 -1
- package/build-types/empty-state/title.d.ts.map +1 -1
- package/build-types/form/primitives/field/description.d.ts.map +1 -1
- package/build-types/form/primitives/fieldset/description.d.ts.map +1 -1
- package/build-types/form/primitives/input/input.d.ts.map +1 -1
- package/build-types/form/primitives/input-layout/input-layout.d.ts.map +1 -1
- package/build-types/form/primitives/textarea/textarea.d.ts.map +1 -1
- package/build-types/form/stories/shared.d.ts.map +1 -1
- package/build-types/index.d.ts +1 -0
- package/build-types/index.d.ts.map +1 -1
- package/build-types/link/link.d.ts.map +1 -1
- package/build-types/popover/arrow.d.ts +10 -0
- package/build-types/popover/arrow.d.ts.map +1 -0
- package/build-types/popover/close.d.ts +11 -0
- package/build-types/popover/close.d.ts.map +1 -0
- package/build-types/popover/context.d.ts +22 -0
- package/build-types/popover/context.d.ts.map +1 -0
- package/build-types/popover/description.d.ts +10 -0
- package/build-types/popover/description.d.ts.map +1 -0
- package/build-types/popover/index.d.ts +9 -0
- package/build-types/popover/index.d.ts.map +1 -0
- package/build-types/popover/popup.d.ts +11 -0
- package/build-types/popover/popup.d.ts.map +1 -0
- package/build-types/popover/root.d.ts +37 -0
- package/build-types/popover/root.d.ts.map +1 -0
- package/build-types/popover/stories/index.story.d.ts +211 -0
- package/build-types/popover/stories/index.story.d.ts.map +1 -0
- package/build-types/popover/stories/utils.d.ts +25 -0
- package/build-types/popover/stories/utils.d.ts.map +1 -0
- package/build-types/popover/test/index.test.d.ts +2 -0
- package/build-types/popover/test/index.test.d.ts.map +1 -0
- package/build-types/popover/title.d.ts +20 -0
- package/build-types/popover/title.d.ts.map +1 -0
- package/build-types/popover/trigger.d.ts +10 -0
- package/build-types/popover/trigger.d.ts.map +1 -0
- package/build-types/popover/types.d.ts +83 -0
- package/build-types/popover/types.d.ts.map +1 -0
- package/build-types/text/stories/index.story.d.ts +4 -0
- package/build-types/text/stories/index.story.d.ts.map +1 -1
- package/build-types/text/text.d.ts.map +1 -1
- package/build-types/utils/use-deprioritized-initial-focus.d.ts +6 -5
- package/build-types/utils/use-deprioritized-initial-focus.d.ts.map +1 -1
- package/package.json +11 -11
- package/src/alert-dialog/context.tsx +12 -4
- package/src/alert-dialog/popup.tsx +91 -33
- package/src/alert-dialog/root.tsx +191 -13
- package/src/alert-dialog/stories/index.story.tsx +116 -65
- package/src/alert-dialog/style.module.css +11 -0
- package/src/alert-dialog/test/index.test.tsx +1265 -347
- package/src/alert-dialog/trigger.tsx +2 -2
- package/src/alert-dialog/types.ts +59 -28
- package/src/button/button.tsx +2 -0
- package/src/button/style.module.css +4 -0
- package/src/card/stories/index.story.tsx +0 -1
- package/src/card/style.module.css +1 -1
- package/src/card/test/index.test.tsx +0 -1
- package/src/empty-state/title.tsx +0 -1
- package/src/form/primitives/field/description.tsx +6 -1
- package/src/form/primitives/fieldset/description.tsx +9 -1
- package/src/form/primitives/input/input.tsx +6 -1
- package/src/form/primitives/input/style.module.css +4 -0
- package/src/form/primitives/input-layout/input-layout.tsx +2 -0
- package/src/form/primitives/textarea/textarea.tsx +10 -1
- package/src/form/stories/shared.tsx +4 -2
- package/src/index.ts +1 -0
- package/src/link/link.tsx +2 -0
- package/src/link/style.module.css +10 -0
- package/src/popover/arrow.tsx +49 -0
- package/src/popover/close.tsx +24 -0
- package/src/popover/context.tsx +100 -0
- package/src/popover/description.tsx +34 -0
- package/src/popover/index.ts +9 -0
- package/src/popover/popup.tsx +106 -0
- package/src/popover/root.tsx +41 -0
- package/src/popover/stories/index.story.tsx +1315 -0
- package/src/popover/stories/utils.tsx +91 -0
- package/src/popover/style.module.css +64 -0
- package/src/popover/test/index.test.tsx +727 -0
- package/src/popover/title.tsx +50 -0
- package/src/popover/trigger.tsx +17 -0
- package/src/popover/types.ts +113 -0
- package/src/text/stories/index.story.tsx +4 -2
- package/src/text/style.module.css +26 -0
- package/src/text/test/index.test.tsx +1 -4
- package/src/text/text.tsx +8 -1
- package/src/utils/css/field.module.css +4 -1
- package/src/utils/css/focus.module.css +7 -5
- package/src/utils/css/global-css-defense.module.css +117 -0
- package/src/utils/use-deprioritized-initial-focus.ts +5 -4
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { RootProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* An accessible popup anchored to a trigger element.
|
|
4
|
+
*
|
|
5
|
+
* Popover renders ARIA-compliant floating content that appears next to its
|
|
6
|
+
* trigger. It can contain interactive content such as form controls, menus,
|
|
7
|
+
* and rich descriptions.
|
|
8
|
+
*
|
|
9
|
+
* Compose the compound components to build a popover:
|
|
10
|
+
*
|
|
11
|
+
* - `Popover.Root` — provides open state and context to all sub-components.
|
|
12
|
+
* - `Popover.Trigger` — the button that toggles the popup.
|
|
13
|
+
* - `Popover.Popup` — the floating container (portal, positioning, collision
|
|
14
|
+
* avoidance).
|
|
15
|
+
* - `Popover.Arrow` — an optional arrow pointing toward the anchor.
|
|
16
|
+
* - `Popover.Title` — **required** heading that labels the popover for
|
|
17
|
+
* accessibility (can be visually hidden).
|
|
18
|
+
* - `Popover.Description` — optional paragraph linked via `aria-describedby`.
|
|
19
|
+
* - `Popover.Close` — a button that closes the popover when clicked.
|
|
20
|
+
* **Required** when `modal` is `true` or `'trap-focus'` so that focus
|
|
21
|
+
* can cycle correctly and the user can dismiss the popover.
|
|
22
|
+
*
|
|
23
|
+
* ```jsx
|
|
24
|
+
* <Popover.Root>
|
|
25
|
+
* <Popover.Trigger>Open</Popover.Trigger>
|
|
26
|
+
* <Popover.Popup>
|
|
27
|
+
* <Popover.Arrow />
|
|
28
|
+
* <Popover.Title>Popover title</Popover.Title>
|
|
29
|
+
* <Popover.Description>Popover description</Popover.Description>
|
|
30
|
+
* <Popover.Close>Close</Popover.Close>
|
|
31
|
+
* </Popover.Popup>
|
|
32
|
+
* </Popover.Root>
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
declare function Root(props: RootProps): import("react").JSX.Element;
|
|
36
|
+
export { Root };
|
|
37
|
+
//# sourceMappingURL=root.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../src/popover/root.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,iBAAS,IAAI,CAAE,KAAK,EAAE,SAAS,+BAE9B;AAED,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Popover } from '../..';
|
|
3
|
+
declare const meta: Meta<typeof Popover.Root>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Popover.Root>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
/**
|
|
8
|
+
* A popover without the arrow sub-component. Omit `Popover.Arrow`
|
|
9
|
+
* from the popup content when an arrow indicator is not desired.
|
|
10
|
+
*/
|
|
11
|
+
export declare const NoArrow: Story;
|
|
12
|
+
/**
|
|
13
|
+
* All combinations of `side` and `align` props on `Popover.Popup`.
|
|
14
|
+
*
|
|
15
|
+
* Each row shows a side (`top`, `right`, `bottom`, `left`), and each column
|
|
16
|
+
* shows an alignment (`start`, `center`, `end`).
|
|
17
|
+
*/
|
|
18
|
+
export declare const Positioning: Story;
|
|
19
|
+
/**
|
|
20
|
+
* A popover with a close icon button, title, and description. The
|
|
21
|
+
* `Popover.Close` component renders a button that closes the popover when
|
|
22
|
+
* clicked. Here it wraps an `IconButton` for a properly sized, accessible
|
|
23
|
+
* close action — matching the Dialog close-icon pattern.
|
|
24
|
+
*/
|
|
25
|
+
export declare const WithCloseButton: Story;
|
|
26
|
+
/**
|
|
27
|
+
* Use the `open` and `onOpenChange` props on `Popover.Root` to control the
|
|
28
|
+
* popover's visibility programmatically.
|
|
29
|
+
*
|
|
30
|
+
* The checkbox drives the popover state externally. The popover's trigger
|
|
31
|
+
* and click-outside dismiss both sync back to the same state via
|
|
32
|
+
* `onOpenChange`, keeping everything in sync.
|
|
33
|
+
*/
|
|
34
|
+
export declare const Controlled: Story;
|
|
35
|
+
/**
|
|
36
|
+
* Set `modal` to `true` to trap focus inside the popover when it is open.
|
|
37
|
+
* This is useful for complex popover content that requires user interaction,
|
|
38
|
+
* such as forms. Try tabbing through the fields — focus stays inside the
|
|
39
|
+
* popover until it is dismissed.
|
|
40
|
+
*
|
|
41
|
+
* **Note:** focus trapping requires a `Popover.Close` part inside the popup
|
|
42
|
+
* so that screen readers always have an escape route. It can be visually
|
|
43
|
+
* hidden if needed.
|
|
44
|
+
*
|
|
45
|
+
* Pass `backdrop` to `Popover.Popup` to display a semi-transparent overlay
|
|
46
|
+
* beneath the popover, signalling that the page is blocked.
|
|
47
|
+
*/
|
|
48
|
+
export declare const Modal: Story;
|
|
49
|
+
/**
|
|
50
|
+
* The `variant="unstyled"` option strips all visual styling from the popup,
|
|
51
|
+
* making it a blank positioning container for fully custom content.
|
|
52
|
+
*/
|
|
53
|
+
export declare const Unstyled: Story;
|
|
54
|
+
/**
|
|
55
|
+
* Overlay placement positions the popover centered on top of its trigger,
|
|
56
|
+
* effectively covering it. This is achieved by computing a negative
|
|
57
|
+
* `sideOffset` based on the measured sizes of the trigger and popup.
|
|
58
|
+
*
|
|
59
|
+
* This technique is useful when you want the popover to visually replace
|
|
60
|
+
* the trigger element in place.
|
|
61
|
+
*/
|
|
62
|
+
export declare const OverlayPlacement: Story;
|
|
63
|
+
/**
|
|
64
|
+
* To render the popup inline (without a portal), create a local ref to a
|
|
65
|
+
* `<span>` with `display: contents` and pass it as the `container` prop.
|
|
66
|
+
* The popup will render inside the span rather than being portaled to
|
|
67
|
+
* `document.body`, while retaining all positioning behavior.
|
|
68
|
+
*
|
|
69
|
+
* **Note:** `backdrop` will not cover the full viewport in this mode.
|
|
70
|
+
*/
|
|
71
|
+
export declare const Inline: Story;
|
|
72
|
+
/**
|
|
73
|
+
* Use the `collisionAvoidance` prop to control how the popover behaves when
|
|
74
|
+
* it collides with the edges of its collision boundary.
|
|
75
|
+
*
|
|
76
|
+
* Because the popup renders via a portal (outside the scrollable container),
|
|
77
|
+
* the container must be passed as `collisionBoundary` so Floating UI treats
|
|
78
|
+
* it as the clipping edge.
|
|
79
|
+
*
|
|
80
|
+
* - `side: 'flip'` flips to the opposite side (default).
|
|
81
|
+
* - `side: 'none'` disables collision handling.
|
|
82
|
+
*
|
|
83
|
+
* Scroll the container to see collision avoidance in action.
|
|
84
|
+
*/
|
|
85
|
+
export declare const CollisionAvoidance: Story;
|
|
86
|
+
/**
|
|
87
|
+
* When the popover's trigger lives inside an iframe but the popover should
|
|
88
|
+
* render in the parent document, pass a parent-document element to the
|
|
89
|
+
* `container` prop on `Popover.Popup`.
|
|
90
|
+
*
|
|
91
|
+
* This technique is used in Gutenberg where the block editor canvas is an
|
|
92
|
+
* iframe but toolbars and menus must appear outside it.
|
|
93
|
+
*
|
|
94
|
+
* Scroll inside the iframe to verify that the popover tracks the trigger
|
|
95
|
+
* position across document boundaries.
|
|
96
|
+
*/
|
|
97
|
+
export declare const CrossIframe: Story;
|
|
98
|
+
/**
|
|
99
|
+
* Same cross-iframe scenario, but using `SlotFillProvider` and `Slot` from
|
|
100
|
+
* `@wordpress/components` as the render target.
|
|
101
|
+
*
|
|
102
|
+
* The `Slot` renders a `div` in the parent document, and its forwarded ref
|
|
103
|
+
* is passed to `Popover.Popup`'s `container` prop so the popup portals into
|
|
104
|
+
* the slot element. This mirrors the legacy Popover's `WithSlotOutsideIframe`
|
|
105
|
+
* pattern.
|
|
106
|
+
*/
|
|
107
|
+
export declare const CrossIframeWithSlotFill: Story;
|
|
108
|
+
/**
|
|
109
|
+
* Popovers in Gutenberg are managed with explicit z-index values, which can
|
|
110
|
+
* create situations where a popover renders below another popover, when you
|
|
111
|
+
* want it to be rendered above.
|
|
112
|
+
*
|
|
113
|
+
* The `--wp-ui-popover-z-index` CSS variable, available on the
|
|
114
|
+
* `Popover.Popup` component, is an escape hatch that can be used to override
|
|
115
|
+
* the z-index of a given popover on a case-by-case basis.
|
|
116
|
+
*/
|
|
117
|
+
export declare const WithCustomZIndex: Story;
|
|
118
|
+
/**
|
|
119
|
+
* Use the `anchor` prop on `Popover.Popup` to position the popover against an
|
|
120
|
+
* arbitrary element instead of the built-in trigger. Base UI accepts four
|
|
121
|
+
* anchor types:
|
|
122
|
+
*
|
|
123
|
+
* 1. **Element** — a direct DOM element reference.
|
|
124
|
+
* 2. **VirtualElement** — an object with a `getBoundingClientRect()` method.
|
|
125
|
+
* 3. **RefObject** — a `React.RefObject` pointing to an element.
|
|
126
|
+
* 4. **Callback** — a function returning an Element or VirtualElement.
|
|
127
|
+
*
|
|
128
|
+
* This is the most-used pattern in Gutenberg: block popovers anchor to
|
|
129
|
+
* selected block elements, the link popover anchors to the text selection, and
|
|
130
|
+
* data views anchor to right-click positions.
|
|
131
|
+
*/
|
|
132
|
+
export declare const Anchor: Story;
|
|
133
|
+
/**
|
|
134
|
+
* Use `variant="unstyled"` and custom inline styles to replicate a toolbar-like
|
|
135
|
+
* appearance: high-contrast border, no shadow, and a smaller border radius.
|
|
136
|
+
*
|
|
137
|
+
* A first-class `variant="toolbar"` may be added in the future if this pattern
|
|
138
|
+
* becomes widespread.
|
|
139
|
+
*/
|
|
140
|
+
export declare const ToolbarVariant: Story;
|
|
141
|
+
/**
|
|
142
|
+
* Base UI's Positioner exposes `--available-height` and
|
|
143
|
+
* `--available-width` CSS variables representing the space
|
|
144
|
+
* between the anchor and the viewport edge. Apply them as `max-height` /
|
|
145
|
+
* `max-width` via the `style` prop (which targets the positioner) to
|
|
146
|
+
* constrain the popup size. Then add `overflow: auto` on an inner wrapper
|
|
147
|
+
* so scrolling happens inside the popup content area — this replaces the
|
|
148
|
+
* legacy Popover's `resize` prop.
|
|
149
|
+
*
|
|
150
|
+
* Open the popover and resize or scroll the container to see the popup shrink
|
|
151
|
+
* to fit.
|
|
152
|
+
*/
|
|
153
|
+
export declare const ViewportConstrainedSize: Story;
|
|
154
|
+
/**
|
|
155
|
+
* The `onOpenChange` callback on `Popover.Root` receives an `eventDetails`
|
|
156
|
+
* object with a `reason` field that describes why the popover is
|
|
157
|
+
* opening/closing. This replaces the legacy Popover's separate `onClose` and
|
|
158
|
+
* `onFocusOutside` callbacks:
|
|
159
|
+
*
|
|
160
|
+
* - `reason === 'escape-key'` — user pressed Escape (was `onClose`)
|
|
161
|
+
* - `reason === 'outside-press'` — user clicked outside (was `onClose`)
|
|
162
|
+
* - `reason === 'focus-out'` — focus moved outside (was `onFocusOutside`)
|
|
163
|
+
*
|
|
164
|
+
* Open the popover, then dismiss it in different ways to see the logged reason.
|
|
165
|
+
*/
|
|
166
|
+
export declare const OnOpenChangeDetails: Story;
|
|
167
|
+
/**
|
|
168
|
+
* Pass a ref to `initialFocus` on `Popover.Popup` to focus a specific element
|
|
169
|
+
* when the popover opens. This replaces the legacy Popover's `focusOnMount`
|
|
170
|
+
* prop.
|
|
171
|
+
*
|
|
172
|
+
* In this example, the Email field receives focus instead of the first
|
|
173
|
+
* focusable element (Name).
|
|
174
|
+
*/
|
|
175
|
+
export declare const InitialFocus: Story;
|
|
176
|
+
/**
|
|
177
|
+
* Set `modal="trap-focus"` on `Popover.Root` to trap keyboard focus inside the
|
|
178
|
+
* popover without making it fully modal. Unlike `modal={true}`, this mode:
|
|
179
|
+
*
|
|
180
|
+
* - Traps Tab/Shift+Tab cycling within the popover
|
|
181
|
+
* - Does **not** lock page scroll
|
|
182
|
+
* - Does **not** block pointer interaction outside
|
|
183
|
+
*
|
|
184
|
+
* A `Popover.Close` part must be rendered inside the popup so that screen
|
|
185
|
+
* readers can escape. It can be visually hidden if not needed visually.
|
|
186
|
+
*
|
|
187
|
+
* This replaces the legacy Popover's `constrainTabbing` prop. Try tabbing
|
|
188
|
+
* through the fields — focus stays inside — then click the button outside
|
|
189
|
+
* to verify that pointer interaction still works.
|
|
190
|
+
*/
|
|
191
|
+
export declare const TrapFocus: Story;
|
|
192
|
+
/**
|
|
193
|
+
* Set `openOnHover` on `Popover.Trigger` to open the popover when the trigger
|
|
194
|
+
* is hovered. The `delay` and `closeDelay` props control the timing (in ms).
|
|
195
|
+
*
|
|
196
|
+
* This is a capability the legacy Popover does not have natively — consumers
|
|
197
|
+
* would need to wire up `mouseenter`/`mouseleave` handlers manually.
|
|
198
|
+
*/
|
|
199
|
+
export declare const HoverTrigger: Story;
|
|
200
|
+
/**
|
|
201
|
+
* Popups that open when hovering an info icon should use Popover with the
|
|
202
|
+
* `openOnHover` prop on the trigger instead of a tooltip. This way, touch
|
|
203
|
+
* users and screen reader users can access the content.
|
|
204
|
+
*
|
|
205
|
+
* To know when to reach for a popover instead of a tooltip, consider the
|
|
206
|
+
* purpose of the trigger element: If the trigger's purpose is to open the
|
|
207
|
+
* popup itself, it's a popover. If the trigger's purpose is unrelated to
|
|
208
|
+
* opening the popup, it's a tooltip.
|
|
209
|
+
*/
|
|
210
|
+
export declare const InfoTip: Story;
|
|
211
|
+
//# sourceMappingURL=index.story.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/popover/stories/index.story.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAI5D,OAAO,EAAE,OAAO,EAAkB,MAAM,OAAO,CAAC;AAKhD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,OAAO,CAAC,IAAI,CAcpC,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAE,OAAO,OAAO,CAAC,IAAI,CAAE,CAAC;AAE7C,eAAO,MAAM,OAAO,EAAE,KAwBrB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,KAoBrB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAAE,KA4CzB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,KAoC7B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,EAAE,KA4ExB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,KAAK,EAAE,KAkFnB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,KAqBtB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,EAAE,KA+C9B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,EAAE,KA+BpB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAwEhC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,EAAE,KAyEzB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,EAAE,KA6ErC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAuB9B,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,MAAM,EAAE,KA0HpB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,EAAE,KA4B5B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,uBAAuB,EAAE,KAkDrC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAoDjC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,EAAE,KAiE1B,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,SAAS,EAAE,KAiDvB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,EAAE,KAyB1B,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,OAAO,EAAE,KA6CrB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { RefCallback } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Tracks the dimensions of a DOM element via ResizeObserver.
|
|
4
|
+
* Returns a ref callback to attach to the element and its current size.
|
|
5
|
+
*
|
|
6
|
+
* The ref callback performs a synchronous `getBoundingClientRect` read so
|
|
7
|
+
* the first render already has accurate dimensions (avoids a 0×0 flash).
|
|
8
|
+
*/
|
|
9
|
+
export declare function useMeasure<TRef extends HTMLElement>(): readonly [RefCallback<TRef>, {
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
}];
|
|
13
|
+
/**
|
|
14
|
+
* Renders an iframe and portals its `children` into the iframe's body.
|
|
15
|
+
* Forwards a ref to the underlying `<iframe>` element.
|
|
16
|
+
*
|
|
17
|
+
* Waits for the iframe's `load` event before portaling to ensure
|
|
18
|
+
* compatibility with Firefox.
|
|
19
|
+
* See https://github.com/facebook/react/issues/22847#issuecomment-991394558
|
|
20
|
+
*/
|
|
21
|
+
export declare const GenericIframe: import("react").ForwardRefExoticComponent<Omit<GenericIframeProps, "ref"> & import("react").RefAttributes<HTMLIFrameElement>>;
|
|
22
|
+
export type GenericIframeProps = React.ComponentProps<'iframe'> & {
|
|
23
|
+
children: React.ReactNode;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/popover/stories/utils.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEzC;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAE,IAAI,SAAS,WAAW;;;GAgCnD;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,+HA0BvB,CAAC;AAEJ,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,cAAc,CAAE,QAAQ,CAAE,GAAG;IACnE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/popover/test/index.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TitleProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Renders a heading that labels the popover for accessibility.
|
|
4
|
+
*
|
|
5
|
+
* **Required** — every popover must include a `Popover.Title`, even if
|
|
6
|
+
* visually hidden. The rendered element is linked to the popup via
|
|
7
|
+
* `aria-labelledby`. Uses the `heading-xl` text variant, matching Dialog.
|
|
8
|
+
*
|
|
9
|
+
* To visually hide the title while keeping it accessible, wrap it with
|
|
10
|
+
* `VisuallyHidden` using the `render` prop:
|
|
11
|
+
*
|
|
12
|
+
* ```jsx
|
|
13
|
+
* <VisuallyHidden render={ <Popover.Title /> }>
|
|
14
|
+
* Accessible title text
|
|
15
|
+
* </VisuallyHidden>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
declare const Title: import("react").ForwardRefExoticComponent<TitleProps & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
19
|
+
export { Title };
|
|
20
|
+
//# sourceMappingURL=title.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"title.d.ts","sourceRoot":"","sources":["../../src/popover/title.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;;;;;;;;;;;GAeG;AACH,QAAA,MAAM,KAAK,2GAwBV,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TriggerProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Renders a button that toggles the popover popup when clicked.
|
|
4
|
+
*
|
|
5
|
+
* Renders as a `<button>` by default. Also supports hover-triggered
|
|
6
|
+
* popovers via the `openOnHover`, `delay`, and `closeDelay` props.
|
|
7
|
+
*/
|
|
8
|
+
declare const Trigger: import("react").ForwardRefExoticComponent<TriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
9
|
+
export { Trigger };
|
|
10
|
+
//# sourceMappingURL=trigger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trigger.d.ts","sourceRoot":"","sources":["../../src/popover/trigger.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;;GAKG;AACH,QAAA,MAAM,OAAO,4GAIZ,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { Popover as _Popover } from '@base-ui/react/popover';
|
|
3
|
+
import type { ComponentProps } from '../utils/types';
|
|
4
|
+
export interface RootProps extends Pick<_Popover.Root.Props, 'open' | 'onOpenChange' | 'defaultOpen' | 'modal'> {
|
|
5
|
+
/**
|
|
6
|
+
* The popover sub-components (`Popover.Trigger`, `Popover.Popup`, etc.).
|
|
7
|
+
*/
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export interface TriggerProps extends ComponentProps<'button'>, Pick<_Popover.Trigger.Props, 'openOnHover' | 'delay' | 'closeDelay'> {
|
|
11
|
+
/**
|
|
12
|
+
* The content to be rendered inside the component.
|
|
13
|
+
*/
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* `Popover.Popup` maps to two Base UI elements internally: the
|
|
18
|
+
* **Positioner** (outer, handles fixed positioning and z-index) and the
|
|
19
|
+
* **Popup** (inner, holds content and visual styles).
|
|
20
|
+
*
|
|
21
|
+
* `style` and `className` are forwarded to the **Positioner** so that
|
|
22
|
+
* z-index overrides (`--wp-ui-popover-z-index`) and Base UI CSS variables
|
|
23
|
+
* (`--available-height`, `--available-width`) work correctly. All other
|
|
24
|
+
* HTML attributes are forwarded to the inner **Popup** element.
|
|
25
|
+
*/
|
|
26
|
+
export interface PopupProps extends ComponentProps<'div'>, Pick<_Popover.Positioner.Props, 'align' | 'alignOffset' | 'anchor' | 'arrowPadding' | 'collisionAvoidance' | 'collisionBoundary' | 'collisionPadding' | 'side' | 'sideOffset' | 'sticky'>, Pick<_Popover.Popup.Props, 'initialFocus' | 'finalFocus'> {
|
|
27
|
+
/**
|
|
28
|
+
* Whether to render a backdrop overlay behind the popover.
|
|
29
|
+
*
|
|
30
|
+
* Typically used with `modal` to signal that interaction with the rest
|
|
31
|
+
* of the page is blocked. The backdrop is a semi-transparent dark overlay.
|
|
32
|
+
*
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
backdrop?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* The content to be rendered inside the component.
|
|
38
|
+
*/
|
|
39
|
+
children?: ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* A parent element to render the portal into.
|
|
42
|
+
*
|
|
43
|
+
* Useful for cross-document rendering, such as rendering a popover
|
|
44
|
+
* in a parent document when the trigger is inside an iframe.
|
|
45
|
+
*/
|
|
46
|
+
container?: _Popover.Portal.Props['container'];
|
|
47
|
+
/**
|
|
48
|
+
* The visual style variant of the popup.
|
|
49
|
+
*
|
|
50
|
+
* - `'default'` — standard surface styling with background, padding,
|
|
51
|
+
* border radius, and shadow.
|
|
52
|
+
* - `'unstyled'` — no visual treatment; useful as a blank positioning
|
|
53
|
+
* container for fully custom content.
|
|
54
|
+
*
|
|
55
|
+
* @default 'default'
|
|
56
|
+
*/
|
|
57
|
+
variant?: 'default' | 'unstyled';
|
|
58
|
+
}
|
|
59
|
+
export interface ArrowProps extends ComponentProps<'div'> {
|
|
60
|
+
/**
|
|
61
|
+
* Custom arrow visuals to render inside the positioned container.
|
|
62
|
+
*/
|
|
63
|
+
children?: ReactNode;
|
|
64
|
+
}
|
|
65
|
+
export interface TitleProps extends ComponentProps<'h2'> {
|
|
66
|
+
/**
|
|
67
|
+
* The title content to be rendered.
|
|
68
|
+
*/
|
|
69
|
+
children?: ReactNode;
|
|
70
|
+
}
|
|
71
|
+
export interface DescriptionProps extends ComponentProps<'p'> {
|
|
72
|
+
/**
|
|
73
|
+
* The description content to be rendered.
|
|
74
|
+
*/
|
|
75
|
+
children?: ReactNode;
|
|
76
|
+
}
|
|
77
|
+
export interface CloseProps extends ComponentProps<'button'> {
|
|
78
|
+
/**
|
|
79
|
+
* The content to be rendered inside the component.
|
|
80
|
+
*/
|
|
81
|
+
children?: ReactNode;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/popover/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,WAAW,SAChB,SAAQ,IAAI,CACX,QAAQ,CAAC,IAAI,CAAC,KAAK,EACnB,MAAM,GAAG,cAAc,GAAG,aAAa,GAAG,OAAO,CACjD;IACD;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,WAAW,YAChB,SAAQ,cAAc,CAAE,QAAQ,CAAE,EACjC,IAAI,CAAE,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,GAAG,YAAY,CAAE;IACvE;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,UAChB,SAAQ,cAAc,CAAE,KAAK,CAAE,EAC9B,IAAI,CACH,QAAQ,CAAC,UAAU,CAAC,KAAK,EACvB,OAAO,GACP,aAAa,GACb,QAAQ,GACR,cAAc,GACd,oBAAoB,GACpB,mBAAmB,GACnB,kBAAkB,GAClB,MAAM,GACN,YAAY,GACZ,QAAQ,CACV,EACD,IAAI,CAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,cAAc,GAAG,YAAY,CAAE;IAC5D;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAE,WAAW,CAAE,CAAC;IAEjD;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;CACjC;AAED,MAAM,WAAW,UAAW,SAAQ,cAAc,CAAE,KAAK,CAAE;IAC1D;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,WAAW,UAAW,SAAQ,cAAc,CAAE,IAAI,CAAE;IACzD;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,WAAW,gBAAiB,SAAQ,cAAc,CAAE,GAAG,CAAE;IAC9D;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,WAAW,UAAW,SAAQ,cAAc,CAAE,QAAQ,CAAE;IAC7D;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACrB"}
|
|
@@ -4,6 +4,10 @@ declare const meta: Meta<typeof Text>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof Text>;
|
|
6
6
|
export declare const Default: Story;
|
|
7
|
+
/**
|
|
8
|
+
* Important: Setting the `variant` prop to a `heading` variant will not automatically render a heading element.
|
|
9
|
+
* Use the `render` prop to render a heading element with the appropriate level.
|
|
10
|
+
*/
|
|
7
11
|
export declare const AllVariants: Story;
|
|
8
12
|
export declare const WithRenderProp: Story;
|
|
9
13
|
//# sourceMappingURL=index.story.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/text/stories/index.story.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/text/stories/index.story.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAGhC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,IAAI,CAG5B,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAE,OAAO,IAAI,CAAE,CAAC;AAErC,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,KA6BzB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAe5B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/text/text.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/text/text.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAIzC;;;GAGG;AACH,eAAO,MAAM,IAAI,uGAoBd,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Popover as _Popover } from '@base-ui/react/popover';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* The `initialFocus` type shared by Base UI overlay popups (Dialog, Popover,
|
|
4
|
+
* AlertDialog, etc.). We derive it from `Popover.Popup.Props` here, but it
|
|
5
|
+
* is identical across all overlay components.
|
|
5
6
|
*/
|
|
6
|
-
type InitialFocus =
|
|
7
|
+
type InitialFocus = _Popover.Popup.Props['initialFocus'];
|
|
7
8
|
/**
|
|
8
9
|
* Returns a resolved `initialFocus` value that deprioritizes elements
|
|
9
10
|
* marked with a given data attribute (e.g. a close icon), and an internal
|
|
@@ -28,7 +29,7 @@ export declare function useDeprioritizedInitialFocus({ initialFocus, deprioritiz
|
|
|
28
29
|
initialFocus: InitialFocus;
|
|
29
30
|
deprioritizedAttribute: string;
|
|
30
31
|
}): {
|
|
31
|
-
resolvedInitialFocus: boolean | import("react").RefObject<HTMLElement | null> | ((openType: import("@base-ui/utils/useEnhancedClickHandler").InteractionType) => boolean | HTMLElement | null
|
|
32
|
+
resolvedInitialFocus: boolean | import("react").RefObject<HTMLElement | null> | ((openType: import("@base-ui/utils/useEnhancedClickHandler").InteractionType) => void | boolean | HTMLElement | null) | undefined;
|
|
32
33
|
popupRef: import("react").RefObject<HTMLDivElement>;
|
|
33
34
|
};
|
|
34
35
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-deprioritized-initial-focus.d.ts","sourceRoot":"","sources":["../../src/utils/use-deprioritized-initial-focus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"use-deprioritized-initial-focus.d.ts","sourceRoot":"","sources":["../../src/utils/use-deprioritized-initial-focus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAIlE;;;;GAIG;AACH,KAAK,YAAY,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAE,cAAc,CAAE,CAAC;AAe3D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,4BAA4B,CAAE,EAC7C,YAAY,EACZ,sBAAsB,GACtB,EAAE;IACF,YAAY,EAAE,YAAY,CAAC;IAC3B,sBAAsB,EAAE,MAAM,CAAC;CAC/B;;;EAiCA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1-next.v.202604091042.0+668146787",
|
|
4
4
|
"description": "Themeable React UI components for the WordPress Design System.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -44,15 +44,15 @@
|
|
|
44
44
|
"sideEffects": false,
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@base-ui/react": "^1.3.0",
|
|
47
|
-
"@wordpress/a11y": "^4.43.0",
|
|
48
|
-
"@wordpress/compose": "^7.43.0",
|
|
49
|
-
"@wordpress/element": "^6.
|
|
50
|
-
"@wordpress/i18n": "^6.
|
|
51
|
-
"@wordpress/icons": "^12.1.0",
|
|
52
|
-
"@wordpress/keycodes": "^4.43.0",
|
|
53
|
-
"@wordpress/primitives": "^4.43.0",
|
|
54
|
-
"@wordpress/private-apis": "^1.43.0",
|
|
55
|
-
"@wordpress/theme": "^0.10.0",
|
|
47
|
+
"@wordpress/a11y": "^4.43.1-next.v.202604091042.0+668146787",
|
|
48
|
+
"@wordpress/compose": "^7.43.1-next.v.202604091042.0+668146787",
|
|
49
|
+
"@wordpress/element": "^6.44.1-next.v.202604091042.0+668146787",
|
|
50
|
+
"@wordpress/i18n": "^6.17.1-next.v.202604091042.0+668146787",
|
|
51
|
+
"@wordpress/icons": "^12.1.1-next.v.202604091042.0+668146787",
|
|
52
|
+
"@wordpress/keycodes": "^4.43.1-next.v.202604091042.0+668146787",
|
|
53
|
+
"@wordpress/primitives": "^4.43.1-next.v.202604091042.0+668146787",
|
|
54
|
+
"@wordpress/private-apis": "^1.43.1-next.v.202604091042.0+668146787",
|
|
55
|
+
"@wordpress/theme": "^0.10.1-next.v.202604091042.0+668146787",
|
|
56
56
|
"clsx": "^2.1.1",
|
|
57
57
|
"tabbable": "^6.4.0"
|
|
58
58
|
},
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"publishConfig": {
|
|
72
72
|
"access": "public"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "73606df74f1c38a084bfa5db97205259ef817593"
|
|
75
75
|
}
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { createContext } from '@wordpress/element';
|
|
2
|
-
import type { RootProps } from './types';
|
|
3
2
|
|
|
4
|
-
type
|
|
3
|
+
type Phase = 'idle' | 'pending' | 'closing';
|
|
5
4
|
|
|
6
5
|
interface AlertDialogContextValue {
|
|
7
|
-
|
|
6
|
+
phase: Phase;
|
|
7
|
+
showSpinner: boolean;
|
|
8
|
+
errorMessage?: string;
|
|
9
|
+
confirm: () => Promise< void >;
|
|
8
10
|
}
|
|
9
11
|
|
|
12
|
+
const noop = async () => {};
|
|
13
|
+
|
|
10
14
|
const AlertDialogContext = createContext< AlertDialogContextValue >( {
|
|
11
|
-
|
|
15
|
+
phase: 'idle',
|
|
16
|
+
showSpinner: false,
|
|
17
|
+
errorMessage: undefined,
|
|
18
|
+
confirm: noop,
|
|
12
19
|
} );
|
|
13
20
|
|
|
14
21
|
export { AlertDialogContext };
|
|
22
|
+
export type { Phase };
|