@wordpress/ui 0.13.1-next.v.202605131032.0 → 0.14.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 +40 -1
- package/CONTRIBUTING.md +34 -0
- package/README.md +15 -0
- package/build/alert-dialog/portal.cjs.map +2 -2
- package/build/alert-dialog/types.cjs.map +1 -1
- package/build/button/button.cjs +1 -1
- package/build/button/button.cjs.map +2 -2
- package/build/card/content.cjs +1 -1
- package/build/card/content.cjs.map +2 -2
- package/build/card/full-bleed.cjs +1 -1
- package/build/card/full-bleed.cjs.map +2 -2
- package/build/card/header.cjs +1 -1
- package/build/card/header.cjs.map +2 -2
- package/build/card/root.cjs +1 -1
- package/build/card/root.cjs.map +2 -2
- package/build/collapsible-card/header.cjs.map +2 -2
- package/build/dialog/portal.cjs.map +2 -2
- package/build/dialog/types.cjs.map +1 -1
- package/build/drawer/portal.cjs.map +2 -2
- package/build/drawer/types.cjs.map +1 -1
- package/build/form/primitives/autocomplete/clear.cjs +4 -1
- package/build/form/primitives/autocomplete/clear.cjs.map +2 -2
- package/build/form/primitives/autocomplete/empty.cjs +1 -1
- package/build/form/primitives/autocomplete/empty.cjs.map +2 -2
- package/build/form/primitives/autocomplete/index.cjs +4 -1
- package/build/form/primitives/autocomplete/index.cjs.map +2 -2
- package/build/form/primitives/autocomplete/item.cjs +1 -1
- package/build/form/primitives/autocomplete/item.cjs.map +2 -2
- package/build/form/primitives/autocomplete/list-body.cjs +1 -1
- package/build/form/primitives/autocomplete/list-body.cjs.map +2 -2
- package/build/form/primitives/autocomplete/list.cjs +1 -1
- package/build/form/primitives/autocomplete/list.cjs.map +2 -2
- package/build/form/primitives/autocomplete/popup.cjs +14 -31
- package/build/form/primitives/autocomplete/popup.cjs.map +3 -3
- package/build/form/primitives/autocomplete/portal.cjs +10 -2
- package/build/form/primitives/autocomplete/portal.cjs.map +2 -2
- package/build/form/primitives/autocomplete/positioner.cjs +158 -0
- package/build/form/primitives/autocomplete/positioner.cjs.map +7 -0
- package/build/form/primitives/autocomplete/types.cjs.map +1 -1
- package/build/form/primitives/constants.cjs.map +2 -2
- package/build/form/primitives/select/index.cjs +4 -1
- package/build/form/primitives/select/index.cjs.map +2 -2
- package/build/form/primitives/select/item.cjs +1 -1
- package/build/form/primitives/select/item.cjs.map +2 -2
- package/build/form/primitives/select/popup.cjs +18 -36
- package/build/form/primitives/select/popup.cjs.map +3 -3
- package/build/form/primitives/select/portal.cjs +11 -5
- package/build/form/primitives/select/portal.cjs.map +2 -2
- package/build/form/primitives/select/positioner.cjs +159 -0
- package/build/form/primitives/select/positioner.cjs.map +7 -0
- package/build/form/primitives/select/types.cjs.map +1 -1
- package/build/icon-button/icon-button.cjs +1 -1
- package/build/icon-button/icon-button.cjs.map +2 -2
- package/build/index.cjs +7 -1
- package/build/index.cjs.map +2 -2
- package/build/popover/index.cjs +3 -0
- package/build/popover/index.cjs.map +2 -2
- package/build/popover/popup.cjs +23 -51
- package/build/popover/popup.cjs.map +3 -3
- package/build/popover/portal.cjs.map +2 -2
- package/build/popover/positioner.cjs +168 -0
- package/build/popover/positioner.cjs.map +7 -0
- package/build/popover/root.cjs.map +2 -2
- package/build/popover/types.cjs.map +1 -1
- package/build/tooltip/portal.cjs +10 -2
- package/build/tooltip/portal.cjs.map +2 -2
- package/build/tooltip/positioner.cjs.map +2 -2
- package/build/tooltip/types.cjs.map +1 -1
- package/build/utils/create-overlay-title-validation.cjs.map +2 -2
- package/build/utils/render-slot-with-children.cjs +4 -1
- package/build/utils/render-slot-with-children.cjs.map +2 -2
- package/build/utils/use-enable-wp-compat-overlay-slot.cjs +39 -0
- package/build/utils/use-enable-wp-compat-overlay-slot.cjs.map +7 -0
- package/build/utils/wp-compat-overlay-slot.cjs +177 -0
- package/build/utils/wp-compat-overlay-slot.cjs.map +7 -0
- package/build-module/alert-dialog/portal.mjs.map +2 -2
- package/build-module/button/button.mjs +1 -1
- package/build-module/button/button.mjs.map +2 -2
- package/build-module/card/content.mjs +1 -1
- package/build-module/card/content.mjs.map +2 -2
- package/build-module/card/full-bleed.mjs +1 -1
- package/build-module/card/full-bleed.mjs.map +2 -2
- package/build-module/card/header.mjs +1 -1
- package/build-module/card/header.mjs.map +2 -2
- package/build-module/card/root.mjs +1 -1
- package/build-module/card/root.mjs.map +2 -2
- package/build-module/collapsible-card/header.mjs.map +2 -2
- package/build-module/dialog/portal.mjs.map +2 -2
- package/build-module/drawer/portal.mjs.map +2 -2
- package/build-module/form/primitives/autocomplete/clear.mjs +4 -1
- package/build-module/form/primitives/autocomplete/clear.mjs.map +2 -2
- package/build-module/form/primitives/autocomplete/empty.mjs +1 -1
- package/build-module/form/primitives/autocomplete/empty.mjs.map +2 -2
- package/build-module/form/primitives/autocomplete/index.mjs +3 -1
- package/build-module/form/primitives/autocomplete/index.mjs.map +2 -2
- package/build-module/form/primitives/autocomplete/item.mjs +1 -1
- package/build-module/form/primitives/autocomplete/item.mjs.map +2 -2
- package/build-module/form/primitives/autocomplete/list-body.mjs +1 -1
- package/build-module/form/primitives/autocomplete/list-body.mjs.map +2 -2
- package/build-module/form/primitives/autocomplete/list.mjs +1 -1
- package/build-module/form/primitives/autocomplete/list.mjs.map +2 -2
- package/build-module/form/primitives/autocomplete/popup.mjs +14 -31
- package/build-module/form/primitives/autocomplete/popup.mjs.map +3 -3
- package/build-module/form/primitives/autocomplete/portal.mjs +10 -2
- package/build-module/form/primitives/autocomplete/portal.mjs.map +2 -2
- package/build-module/form/primitives/autocomplete/positioner.mjs +123 -0
- package/build-module/form/primitives/autocomplete/positioner.mjs.map +7 -0
- package/build-module/form/primitives/constants.mjs.map +2 -2
- package/build-module/form/primitives/select/index.mjs +3 -1
- package/build-module/form/primitives/select/index.mjs.map +2 -2
- package/build-module/form/primitives/select/item.mjs +1 -1
- package/build-module/form/primitives/select/item.mjs.map +2 -2
- package/build-module/form/primitives/select/popup.mjs +18 -36
- package/build-module/form/primitives/select/popup.mjs.map +3 -3
- package/build-module/form/primitives/select/portal.mjs +11 -5
- package/build-module/form/primitives/select/portal.mjs.map +2 -2
- package/build-module/form/primitives/select/positioner.mjs +124 -0
- package/build-module/form/primitives/select/positioner.mjs.map +7 -0
- package/build-module/icon-button/icon-button.mjs +1 -1
- package/build-module/icon-button/icon-button.mjs.map +2 -2
- package/build-module/index.mjs +5 -1
- package/build-module/index.mjs.map +2 -2
- package/build-module/popover/index.mjs +2 -0
- package/build-module/popover/index.mjs.map +2 -2
- package/build-module/popover/popup.mjs +23 -51
- package/build-module/popover/popup.mjs.map +3 -3
- package/build-module/popover/portal.mjs.map +2 -2
- package/build-module/popover/positioner.mjs +133 -0
- package/build-module/popover/positioner.mjs.map +7 -0
- package/build-module/popover/root.mjs.map +2 -2
- package/build-module/tooltip/portal.mjs +10 -2
- package/build-module/tooltip/portal.mjs.map +2 -2
- package/build-module/tooltip/positioner.mjs.map +2 -2
- package/build-module/utils/create-overlay-title-validation.mjs.map +2 -2
- package/build-module/utils/render-slot-with-children.mjs +4 -1
- package/build-module/utils/render-slot-with-children.mjs.map +2 -2
- package/build-module/utils/use-enable-wp-compat-overlay-slot.mjs +14 -0
- package/build-module/utils/use-enable-wp-compat-overlay-slot.mjs.map +7 -0
- package/build-module/utils/wp-compat-overlay-slot.mjs +148 -0
- package/build-module/utils/wp-compat-overlay-slot.mjs.map +7 -0
- package/build-types/alert-dialog/portal.d.ts +8 -5
- package/build-types/alert-dialog/portal.d.ts.map +1 -1
- package/build-types/alert-dialog/types.d.ts +2 -2
- package/build-types/alert-dialog/types.d.ts.map +1 -1
- package/build-types/badge/stories/e2e/index.story.d.ts +7 -0
- package/build-types/badge/stories/e2e/index.story.d.ts.map +1 -0
- package/build-types/button/stories/e2e/index.story.d.ts +8 -0
- package/build-types/button/stories/e2e/index.story.d.ts.map +1 -0
- package/build-types/card/full-bleed.d.ts +18 -0
- package/build-types/card/full-bleed.d.ts.map +1 -1
- package/build-types/card/stories/index.story.d.ts +23 -0
- package/build-types/card/stories/index.story.d.ts.map +1 -1
- package/build-types/collapsible-card/header.d.ts +2 -0
- package/build-types/collapsible-card/header.d.ts.map +1 -1
- package/build-types/collapsible-card/stories/index.story.d.ts +14 -0
- package/build-types/collapsible-card/stories/index.story.d.ts.map +1 -1
- package/build-types/dialog/portal.d.ts +8 -6
- package/build-types/dialog/portal.d.ts.map +1 -1
- package/build-types/dialog/types.d.ts +2 -2
- package/build-types/dialog/types.d.ts.map +1 -1
- package/build-types/drawer/portal.d.ts +8 -6
- package/build-types/drawer/portal.d.ts.map +1 -1
- package/build-types/drawer/types.d.ts +2 -2
- package/build-types/drawer/types.d.ts.map +1 -1
- package/build-types/form/primitives/autocomplete/clear.d.ts.map +1 -1
- package/build-types/form/primitives/autocomplete/index.d.ts +2 -1
- package/build-types/form/primitives/autocomplete/index.d.ts.map +1 -1
- package/build-types/form/primitives/autocomplete/popup.d.ts +1 -0
- package/build-types/form/primitives/autocomplete/popup.d.ts.map +1 -1
- package/build-types/form/primitives/autocomplete/portal.d.ts +9 -4
- package/build-types/form/primitives/autocomplete/portal.d.ts.map +1 -1
- package/build-types/form/primitives/autocomplete/positioner.d.ts +12 -0
- package/build-types/form/primitives/autocomplete/positioner.d.ts.map +1 -0
- package/build-types/form/primitives/autocomplete/stories/index.story.d.ts.map +1 -1
- package/build-types/form/primitives/autocomplete/types.d.ts +11 -9
- package/build-types/form/primitives/autocomplete/types.d.ts.map +1 -1
- package/build-types/form/primitives/constants.d.ts +9 -4
- package/build-types/form/primitives/constants.d.ts.map +1 -1
- package/build-types/form/primitives/select/index.d.ts +2 -1
- package/build-types/form/primitives/select/index.d.ts.map +1 -1
- package/build-types/form/primitives/select/popup.d.ts +1 -0
- package/build-types/form/primitives/select/popup.d.ts.map +1 -1
- package/build-types/form/primitives/select/portal.d.ts +9 -4
- package/build-types/form/primitives/select/portal.d.ts.map +1 -1
- package/build-types/form/primitives/select/positioner.d.ts +12 -0
- package/build-types/form/primitives/select/positioner.d.ts.map +1 -0
- package/build-types/form/primitives/select/stories/index.story.d.ts.map +1 -1
- package/build-types/form/primitives/select/types.d.ts +11 -2
- package/build-types/form/primitives/select/types.d.ts.map +1 -1
- package/build-types/icon/stories/index.story.d.ts.map +1 -1
- package/build-types/index.d.ts +2 -0
- package/build-types/index.d.ts.map +1 -1
- package/build-types/popover/index.d.ts +2 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/popup.d.ts +2 -1
- package/build-types/popover/popup.d.ts.map +1 -1
- package/build-types/popover/portal.d.ts +8 -5
- package/build-types/popover/portal.d.ts.map +1 -1
- package/build-types/popover/positioner.d.ts +12 -0
- package/build-types/popover/positioner.d.ts.map +1 -0
- package/build-types/popover/root.d.ts +5 -2
- package/build-types/popover/root.d.ts.map +1 -1
- package/build-types/popover/stories/index.story.d.ts +10 -21
- package/build-types/popover/stories/index.story.d.ts.map +1 -1
- package/build-types/popover/types.d.ts +12 -3
- package/build-types/popover/types.d.ts.map +1 -1
- package/build-types/tooltip/portal.d.ts +9 -4
- package/build-types/tooltip/portal.d.ts.map +1 -1
- package/build-types/tooltip/positioner.d.ts +8 -5
- package/build-types/tooltip/positioner.d.ts.map +1 -1
- package/build-types/tooltip/types.d.ts +3 -3
- package/build-types/tooltip/types.d.ts.map +1 -1
- package/build-types/utils/render-slot-with-children.d.ts.map +1 -1
- package/build-types/utils/test/use-enable-wp-compat-overlay-slot.test.d.ts +2 -0
- package/build-types/utils/test/use-enable-wp-compat-overlay-slot.test.d.ts.map +1 -0
- package/build-types/utils/test/wp-compat-overlay-slot.test.d.ts +2 -0
- package/build-types/utils/test/wp-compat-overlay-slot.test.d.ts.map +1 -0
- package/build-types/utils/use-deprioritized-initial-focus.d.ts +1 -1
- package/build-types/utils/use-enable-wp-compat-overlay-slot.d.ts +17 -0
- package/build-types/utils/use-enable-wp-compat-overlay-slot.d.ts.map +1 -0
- package/build-types/utils/wp-compat-overlay-slot.d.ts +30 -0
- package/build-types/utils/wp-compat-overlay-slot.d.ts.map +1 -0
- package/package.json +14 -14
- package/src/alert-dialog/portal.tsx +1 -4
- package/src/alert-dialog/types.ts +2 -4
- package/src/badge/stories/e2e/index.story.tsx +20 -0
- package/src/button/stories/e2e/index.story.tsx +130 -0
- package/src/button/stories/index.story.tsx +1 -1
- package/src/button/style.module.css +17 -12
- package/src/card/full-bleed.tsx +18 -0
- package/src/card/stories/index.story.tsx +115 -1
- package/src/card/style.module.css +16 -0
- package/src/card/test/index.test.tsx +18 -1
- package/src/collapsible-card/header.tsx +2 -0
- package/src/collapsible-card/stories/index.story.tsx +66 -0
- package/src/dialog/portal.tsx +1 -5
- package/src/dialog/types.ts +2 -2
- package/src/drawer/portal.tsx +1 -5
- package/src/drawer/types.ts +2 -2
- package/src/form/primitives/autocomplete/clear.tsx +10 -4
- package/src/form/primitives/autocomplete/index.ts +2 -1
- package/src/form/primitives/autocomplete/popup.tsx +17 -21
- package/src/form/primitives/autocomplete/portal.tsx +11 -5
- package/src/form/primitives/autocomplete/positioner.tsx +29 -0
- package/src/form/primitives/autocomplete/stories/index.story.tsx +1 -0
- package/src/form/primitives/autocomplete/test/index.test.tsx +219 -0
- package/src/form/primitives/autocomplete/types.ts +15 -15
- package/src/form/primitives/constants.ts +7 -4
- package/src/form/primitives/select/index.ts +2 -1
- package/src/form/primitives/select/popup.tsx +30 -34
- package/src/form/primitives/select/portal.tsx +15 -8
- package/src/form/primitives/select/positioner.tsx +33 -0
- package/src/form/primitives/select/stories/index.story.tsx +1 -0
- package/src/form/primitives/select/test/index.test.tsx +134 -0
- package/src/form/primitives/select/types.ts +12 -2
- package/src/form/select-control/test/index.test.tsx +64 -0
- package/src/icon/stories/index.story.tsx +3 -2
- package/src/icon-button/icon-button.tsx +1 -1
- package/src/icon-button/test/index.test.tsx +10 -10
- package/src/index.ts +2 -0
- package/src/popover/index.ts +12 -1
- package/src/popover/popup.tsx +28 -45
- package/src/popover/portal.tsx +1 -4
- package/src/popover/positioner.tsx +42 -0
- package/src/popover/root.tsx +5 -2
- package/src/popover/stories/index.story.tsx +85 -138
- package/src/popover/test/index.test.tsx +36 -1
- package/src/popover/types.ts +13 -15
- package/src/tabs/stories/index.story.tsx +2 -2
- package/src/tooltip/portal.tsx +11 -5
- package/src/tooltip/positioner.tsx +1 -4
- package/src/tooltip/style.module.css +1 -1
- package/src/tooltip/test/index.test.tsx +110 -0
- package/src/tooltip/types.ts +3 -5
- package/src/utils/create-overlay-title-validation.tsx +1 -1
- package/src/utils/css/item-popup.module.css +7 -4
- package/src/utils/css/wp-compat-overlay-slot.module.css +35 -0
- package/src/utils/render-slot-with-children.ts +4 -1
- package/src/utils/test/use-enable-wp-compat-overlay-slot.test.tsx +74 -0
- package/src/utils/test/wp-compat-overlay-slot.test.ts +300 -0
- package/src/utils/use-enable-wp-compat-overlay-slot.ts +32 -0
- package/src/utils/wp-compat-overlay-slot.ts +129 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Used to apply custom positioning to `Popover`'s floating content.
|
|
3
|
+
*/
|
|
4
|
+
declare const Positioner: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react").PopoverPositionerProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref">, "children" | "className" | "render" | "style"> & {
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
render?: ((props: import("react").HTMLAttributes<any> & {
|
|
8
|
+
ref?: import("react").Ref<any> | undefined;
|
|
9
|
+
}) => React.ReactElement<unknown>) | React.ReactElement<Record<string, unknown>>;
|
|
10
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export { Positioner };
|
|
12
|
+
//# sourceMappingURL=positioner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"positioner.d.ts","sourceRoot":"","sources":["../../src/popover/positioner.tsx"],"names":[],"mappings":"AAOA;;GAEG;AACH,QAAA,MAAM,UAAU;;;;;;kDA6Bf,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -10,8 +10,11 @@ import type { RootProps } from './types';
|
|
|
10
10
|
*
|
|
11
11
|
* - `Popover.Root` — provides open state and context to all sub-components.
|
|
12
12
|
* - `Popover.Trigger` — the button that toggles the popup.
|
|
13
|
-
* - `Popover.Popup` — the floating container
|
|
14
|
-
*
|
|
13
|
+
* - `Popover.Popup` — the floating container. Portals by default or via
|
|
14
|
+
* `portal={ <Popover.Portal /> }`, and is positioned by default or via
|
|
15
|
+
* `positioner={ <Popover.Positioner /> }`.
|
|
16
|
+
* - `Popover.Positioner` — controls placement, alignment, offset, collision
|
|
17
|
+
* behavior, and anchor for the floating content.
|
|
15
18
|
* - `Popover.Arrow` — an optional arrow pointing toward the anchor.
|
|
16
19
|
* - `Popover.Title` — **required** heading that labels the popover for
|
|
17
20
|
* accessibility (can be visually hidden).
|
|
@@ -1 +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
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,iBAAS,IAAI,CAAE,KAAK,EAAE,SAAS,+BAE9B;AAED,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -10,7 +10,7 @@ export declare const Default: Story;
|
|
|
10
10
|
*/
|
|
11
11
|
export declare const NoArrow: Story;
|
|
12
12
|
/**
|
|
13
|
-
* All combinations of `side` and `align` props on `Popover.
|
|
13
|
+
* All combinations of `side` and `align` props on `Popover.Positioner`.
|
|
14
14
|
*
|
|
15
15
|
* Each row shows a side (`top`, `right`, `bottom`, `left`), and each column
|
|
16
16
|
* shows an alignment (`start`, `center`, `end`).
|
|
@@ -96,16 +96,6 @@ export declare const CollisionAvoidance: Story;
|
|
|
96
96
|
* position across document boundaries.
|
|
97
97
|
*/
|
|
98
98
|
export declare const CrossIframe: Story;
|
|
99
|
-
/**
|
|
100
|
-
* Same cross-iframe scenario, but using `SlotFillProvider` and `Slot` from
|
|
101
|
-
* `@wordpress/components` as the render target.
|
|
102
|
-
*
|
|
103
|
-
* The `Slot` renders a `div` in the parent document, and its forwarded ref
|
|
104
|
-
* is passed to `Popover.Portal`'s `container` prop (via `Popover.Popup`'s
|
|
105
|
-
* `portal` prop) so the popup portals into the slot element. This mirrors the
|
|
106
|
-
* legacy Popover's `WithSlotOutsideIframe` pattern.
|
|
107
|
-
*/
|
|
108
|
-
export declare const CrossIframeWithSlotFill: Story;
|
|
109
99
|
/**
|
|
110
100
|
* Popovers in Gutenberg are managed with explicit z-index values, which can
|
|
111
101
|
* create situations where a popover renders below another popover when you
|
|
@@ -124,9 +114,9 @@ export declare const CrossIframeWithSlotFill: Story;
|
|
|
124
114
|
*/
|
|
125
115
|
export declare const WithCustomZIndex: Story;
|
|
126
116
|
/**
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
* anchor types:
|
|
117
|
+
* Pass an `anchor` to `Popover.Positioner` (via `Popover.Popup`'s `positioner`
|
|
118
|
+
* slot) to position the popover against an arbitrary element instead of the
|
|
119
|
+
* built-in trigger. `anchor` accepts four types:
|
|
130
120
|
*
|
|
131
121
|
* 1. **Element** — a direct DOM element reference.
|
|
132
122
|
* 2. **VirtualElement** — an object with a `getBoundingClientRect()` method.
|
|
@@ -147,13 +137,12 @@ export declare const Anchor: Story;
|
|
|
147
137
|
*/
|
|
148
138
|
export declare const ToolbarVariant: Story;
|
|
149
139
|
/**
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
* `max-width` via the `style` prop
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
* legacy Popover's `resize` prop.
|
|
140
|
+
* `Popover.Positioner` exposes `--available-height` and `--available-width`
|
|
141
|
+
* CSS variables representing the space between the anchor and the viewport
|
|
142
|
+
* edge. These cascade down to `Popover.Popup`, where applying them as
|
|
143
|
+
* `max-height` / `max-width` via the `style` prop constrains the popup size.
|
|
144
|
+
* Then add `overflow: auto` on an inner wrapper so scrolling happens inside
|
|
145
|
+
* the popup content area — this replaces the legacy Popover's `resize` prop.
|
|
157
146
|
*
|
|
158
147
|
* Open the popover and resize or scroll the container to see the popup shrink
|
|
159
148
|
* to fit.
|
|
@@ -1 +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;
|
|
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;AAG5D,OAAO,KAAK,OAAO,MAAM,KAAK,CAAC;AAM/B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,OAAO,CAAC,IAAI,CAuBpC,CAAC;eACa,IAAI;AAEnB,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,KAgDzB,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,KAoD9B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,EAAE,KAqCpB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAgFhC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,EAAE,KAiFzB,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,gBAAgB,EAAE,KA8B9B,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,MAAM,EAAE,KA6IpB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,EAAE,KA4B5B,CAAC;AAEF;;;;;;;;;;GAUG;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"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import type { Popover as _Popover } from '@base-ui/react/popover';
|
|
3
3
|
import type { ComponentProps } from '../utils/types';
|
|
4
|
-
export type PortalProps =
|
|
4
|
+
export type PortalProps = ComponentProps<typeof _Popover.Portal>;
|
|
5
|
+
export type PositionerProps = ComponentProps<typeof _Popover.Positioner>;
|
|
5
6
|
export interface RootProps extends Pick<_Popover.Root.Props, 'open' | 'onOpenChange' | 'defaultOpen' | 'modal'> {
|
|
6
7
|
/**
|
|
7
8
|
* The popover sub-components (`Popover.Trigger`, `Popover.Popup`, etc.).
|
|
@@ -14,7 +15,7 @@ export interface TriggerProps extends ComponentProps<'button'>, Pick<_Popover.Tr
|
|
|
14
15
|
*/
|
|
15
16
|
children?: ReactNode;
|
|
16
17
|
}
|
|
17
|
-
export interface PopupProps extends ComponentProps<'div'>, Pick<_Popover.
|
|
18
|
+
export interface PopupProps extends ComponentProps<'div'>, Pick<_Popover.Popup.Props, 'initialFocus' | 'finalFocus'> {
|
|
18
19
|
/**
|
|
19
20
|
* Whether to render a backdrop overlay behind the popover.
|
|
20
21
|
*
|
|
@@ -37,6 +38,14 @@ export interface PopupProps extends ComponentProps<'div'>, Pick<_Popover.Positio
|
|
|
37
38
|
* When omitted, `Popover.Popup` uses `Popover.Portal` with default props.
|
|
38
39
|
*/
|
|
39
40
|
portal?: ReactElement<Omit<PortalProps, 'children'>>;
|
|
41
|
+
/**
|
|
42
|
+
* Optional positioner element, typically `<Popover.Positioner />` with
|
|
43
|
+
* custom positioning props (`side`, `align`, `sideOffset`, collision
|
|
44
|
+
* settings, anchor, etc.). When omitted, `Popover.Popup` uses
|
|
45
|
+
* `Popover.Positioner` with default props. Do not pass `children` on
|
|
46
|
+
* the positioner element; they would be ignored.
|
|
47
|
+
*/
|
|
48
|
+
positioner?: ReactElement<Omit<PositionerProps, 'children'>>;
|
|
40
49
|
/**
|
|
41
50
|
* The visual style variant of the popup.
|
|
42
51
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/popover/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/popover/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,MAAM,WAAW,GAAG,cAAc,CAAE,OAAO,QAAQ,CAAC,MAAM,CAAE,CAAC;AAEnE,MAAM,MAAM,eAAe,GAAG,cAAc,CAAE,OAAO,QAAQ,CAAC,UAAU,CAAE,CAAC;AAE3E,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,MAAM,WAAW,UAChB,SAAQ,cAAc,CAAE,KAAK,CAAE,EAC9B,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;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,YAAY,CAAE,IAAI,CAAE,WAAW,EAAE,UAAU,CAAE,CAAE,CAAC;IAEzD;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,YAAY,CAAE,IAAI,CAAE,eAAe,EAAE,UAAU,CAAE,CAAE,CAAC;IAEjE;;;;;;;;;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"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* `
|
|
4
|
-
* uses this component with default props.
|
|
2
|
+
* Used to apply custom portal behavior to `Tooltip`'s floating content.
|
|
3
|
+
* `container` defaults to the `@wordpress/ui` compat overlay slot.
|
|
5
4
|
*/
|
|
6
|
-
declare const Portal: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").TooltipPortalProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> &
|
|
5
|
+
declare const Portal: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react").TooltipPortalProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref">, "children" | "className" | "render" | "style"> & {
|
|
6
|
+
className?: string;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
render?: ((props: import("react").HTMLAttributes<any> & {
|
|
9
|
+
ref?: import("react").Ref<any> | undefined;
|
|
10
|
+
}) => React.ReactElement<unknown>) | React.ReactElement<Record<string, unknown>>;
|
|
11
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
7
12
|
export { Portal };
|
|
8
13
|
//# sourceMappingURL=portal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../src/tooltip/portal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../src/tooltip/portal.tsx"],"names":[],"mappings":"AAKA;;;GAGG;AACH,QAAA,MAAM,MAAM;;;;;;kDAUX,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* `Tooltip.Popup`'s `positioner` prop to customize `side`, `align`,
|
|
4
|
-
* `sideOffset`, collision behavior, etc. When `positioner` is omitted,
|
|
5
|
-
* `Tooltip.Popup` uses this component with default props.
|
|
2
|
+
* Used to apply custom positioning to `Tooltip`'s floating content.
|
|
6
3
|
*/
|
|
7
|
-
declare const Positioner: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").TooltipPositionerProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> &
|
|
4
|
+
declare const Positioner: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react").TooltipPositionerProps, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref">, "children" | "className" | "render" | "style"> & {
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
render?: ((props: import("react").HTMLAttributes<any> & {
|
|
8
|
+
ref?: import("react").Ref<any> | undefined;
|
|
9
|
+
}) => React.ReactElement<unknown>) | React.ReactElement<Record<string, unknown>>;
|
|
10
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
8
11
|
export { Positioner };
|
|
9
12
|
//# sourceMappingURL=positioner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"positioner.d.ts","sourceRoot":"","sources":["../../src/tooltip/positioner.tsx"],"names":[],"mappings":"AAOA
|
|
1
|
+
{"version":3,"file":"positioner.d.ts","sourceRoot":"","sources":["../../src/tooltip/positioner.tsx"],"names":[],"mappings":"AAOA;;GAEG;AACH,QAAA,MAAM,UAAU;;;;;;kDAoBf,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import type { Tooltip as _Tooltip } from '@base-ui/react/tooltip';
|
|
3
3
|
import type { ComponentProps } from '../utils/types';
|
|
4
|
-
export type PortalProps =
|
|
5
|
-
export type PositionerProps =
|
|
4
|
+
export type PortalProps = ComponentProps<typeof _Tooltip.Portal>;
|
|
5
|
+
export type PositionerProps = ComponentProps<typeof _Tooltip.Positioner>;
|
|
6
6
|
export type RootProps = Pick<_Tooltip.Root.Props, 'disabled' | 'children'>;
|
|
7
7
|
export type ProviderProps = Pick<_Tooltip.Provider.Props, 'delay' | 'children'>;
|
|
8
8
|
export interface TriggerProps extends ComponentProps<'button'> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tooltip/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tooltip/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,MAAM,WAAW,GAAG,cAAc,CAAE,OAAO,QAAQ,CAAC,MAAM,CAAE,CAAC;AAEnE,MAAM,MAAM,eAAe,GAAG,cAAc,CAAE,OAAO,QAAQ,CAAC,UAAU,CAAE,CAAC;AAE3E,MAAM,MAAM,SAAS,GAAG,IAAI,CAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAAE,CAAC;AAE7E,MAAM,MAAM,aAAa,GAAG,IAAI,CAC/B,QAAQ,CAAC,QAAQ,CAAC,KAAK,EACvB,OAAO,GAAG,UAAU,CACpB,CAAC;AAEF,MAAM,WAAW,YAAa,SAAQ,cAAc,CAAE,QAAQ,CAAE;IAC/D;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,WAAW,UAAW,SAAQ,cAAc,CAAE,KAAK,CAAE;IAC1D;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,YAAY,CAAE,IAAI,CAAE,WAAW,EAAE,UAAU,CAAE,CAAE,CAAC;IAEzD;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,YAAY,CAAE,IAAI,CAAE,eAAe,EAAE,UAAU,CAAE,CAAE,CAAC;CACjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-slot-with-children.d.ts","sourceRoot":"","sources":["../../src/utils/render-slot-with-children.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,sBAAsB,CACrC,IAAI,EAAE,YAAY,GAAG,SAAS,EAC9B,WAAW,EAAE,YAAY,EACzB,QAAQ,EAAE,SAAS,GACjB,YAAY,
|
|
1
|
+
{"version":3,"file":"render-slot-with-children.d.ts","sourceRoot":"","sources":["../../src/utils/render-slot-with-children.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,sBAAsB,CACrC,IAAI,EAAE,YAAY,GAAG,SAAS,EAC9B,WAAW,EAAE,YAAY,EACzB,QAAQ,EAAE,SAAS,GACjB,YAAY,CAKd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-enable-wp-compat-overlay-slot.test.d.ts","sourceRoot":"","sources":["../../../src/utils/test/use-enable-wp-compat-overlay-slot.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wp-compat-overlay-slot.test.d.ts","sourceRoot":"","sources":["../../../src/utils/test/wp-compat-overlay-slot.test.ts"],"names":[],"mappings":""}
|
|
@@ -31,7 +31,7 @@ export declare function useDeprioritizedInitialFocus({ initialFocus, deprioritiz
|
|
|
31
31
|
deprioritizedAttributes: string[];
|
|
32
32
|
}): {
|
|
33
33
|
resolvedInitialFocus: boolean | import("react").RefObject<HTMLElement | null> | ((openType: import("@base-ui/utils/useEnhancedClickHandler").InteractionType) => void | boolean | HTMLElement | null) | undefined;
|
|
34
|
-
popupRef: import("react").RefObject<HTMLDivElement>;
|
|
34
|
+
popupRef: import("react").RefObject<HTMLDivElement | null>;
|
|
35
35
|
};
|
|
36
36
|
export {};
|
|
37
37
|
//# sourceMappingURL=use-deprioritized-initial-focus.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opts the host application into the `@wordpress/ui` compat overlay slot —
|
|
3
|
+
* a body-level container into which `@wordpress/ui` overlays portal so they
|
|
4
|
+
* reliably stack above `@wordpress/components` overlays in mixed-library
|
|
5
|
+
* compositions.
|
|
6
|
+
*
|
|
7
|
+
* Call once from a component that mounts for the lifetime of the app
|
|
8
|
+
* (typically the root). Idempotent and one-way: a single caller should not
|
|
9
|
+
* be able to turn off shared infrastructure for everyone else; if the slot
|
|
10
|
+
* isn't wanted, simply don't call this hook.
|
|
11
|
+
*
|
|
12
|
+
* Where `window.wp.components` is on the global — the typical setup for
|
|
13
|
+
* plugins enqueueing `wp-components` through WordPress's script-loader —
|
|
14
|
+
* the slot auto-enables and this hook is a no-op.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useEnableWpCompatOverlaySlot(): void;
|
|
17
|
+
//# sourceMappingURL=use-enable-wp-compat-overlay-slot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-enable-wp-compat-overlay-slot.d.ts","sourceRoot":"","sources":["../../src/utils/use-enable-wp-compat-overlay-slot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,4BAA4B,IAAI,IAAI,CAgBnD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Marker attribute on the compat overlay slot element.
|
|
3
|
+
*/
|
|
4
|
+
export declare const WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE = "data-wp-compat-overlay-slot";
|
|
5
|
+
/**
|
|
6
|
+
* Returns the body-level compat overlay slot when the runtime opts in,
|
|
7
|
+
* lazily creating it on first call. Returns `undefined` otherwise — so the
|
|
8
|
+
* return value can be forwarded straight to a `container` prop, leaving the
|
|
9
|
+
* default portal container in effect.
|
|
10
|
+
*
|
|
11
|
+
* Two opt-in paths:
|
|
12
|
+
*
|
|
13
|
+
* - Auto-detected when `window.wp.components` is on the global — the
|
|
14
|
+
* typical script-loader setup for WordPress plugins and admin screens.
|
|
15
|
+
* - Explicit, via `useEnableWpCompatOverlaySlot()` — for hosts that bundle
|
|
16
|
+
* `@wordpress/components` (or only `@wordpress/ui`) directly rather than
|
|
17
|
+
* relying on the global.
|
|
18
|
+
*
|
|
19
|
+
* The slot is a single `<div data-wp-compat-overlay-slot>` appended to the
|
|
20
|
+
* local document's body. Subsequent calls return the same element; if it's
|
|
21
|
+
* been removed it's recreated, and a slot created by another
|
|
22
|
+
* `@wordpress/ui` instance in the same document is adopted rather than
|
|
23
|
+
* duplicated.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getWpCompatOverlaySlot(): HTMLDivElement | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Test-only escape hatch that drops the cached singleton.
|
|
28
|
+
*/
|
|
29
|
+
export declare function __resetWpCompatOverlaySlotCacheForTests(): void;
|
|
30
|
+
//# sourceMappingURL=wp-compat-overlay-slot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wp-compat-overlay-slot.d.ts","sourceRoot":"","sources":["../../src/utils/wp-compat-overlay-slot.ts"],"names":[],"mappings":"AAcA;;GAEG;AACH,eAAO,MAAM,gCAAgC,gCAAgC,CAAC;AAuC9E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,IAAI,cAAc,GAAG,SAAS,CA6CnE;AAED;;GAEG;AACH,wBAAgB,uCAAuC,IAAI,IAAI,CAE9D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
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,16 +44,16 @@
|
|
|
44
44
|
"sideEffects": false,
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@base-ui/react": "^1.4.1",
|
|
47
|
-
"@wordpress/a11y": "^4.
|
|
48
|
-
"@wordpress/compose": "^
|
|
49
|
-
"@wordpress/element": "^
|
|
50
|
-
"@wordpress/i18n": "^6.
|
|
51
|
-
"@wordpress/icons": "^13.
|
|
52
|
-
"@wordpress/keycodes": "^4.
|
|
53
|
-
"@wordpress/primitives": "^4.
|
|
54
|
-
"@wordpress/private-apis": "^1.
|
|
55
|
-
"@wordpress/style-runtime": "^0.
|
|
56
|
-
"@wordpress/theme": "^0.
|
|
47
|
+
"@wordpress/a11y": "^4.47.0",
|
|
48
|
+
"@wordpress/compose": "^8.0.0",
|
|
49
|
+
"@wordpress/element": "^7.0.0",
|
|
50
|
+
"@wordpress/i18n": "^6.20.0",
|
|
51
|
+
"@wordpress/icons": "^13.2.0",
|
|
52
|
+
"@wordpress/keycodes": "^4.47.0",
|
|
53
|
+
"@wordpress/primitives": "^4.47.0",
|
|
54
|
+
"@wordpress/private-apis": "^1.47.0",
|
|
55
|
+
"@wordpress/style-runtime": "^0.3.0",
|
|
56
|
+
"@wordpress/theme": "^0.14.0",
|
|
57
57
|
"clsx": "^2.1.1",
|
|
58
58
|
"tabbable": "^6.4.0"
|
|
59
59
|
},
|
|
@@ -66,11 +66,11 @@
|
|
|
66
66
|
"storybook": "^10.2.8"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"react": "^
|
|
70
|
-
"react-dom": "^
|
|
69
|
+
"react": "^19.2.4",
|
|
70
|
+
"react-dom": "^19.2.4"
|
|
71
71
|
},
|
|
72
72
|
"publishConfig": {
|
|
73
73
|
"access": "public"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "d653c5fd6161571a0c2ebde28553d6e25624eacc"
|
|
76
76
|
}
|
|
@@ -3,10 +3,7 @@ import { forwardRef } from '@wordpress/element';
|
|
|
3
3
|
import type { PortalProps } from './types';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
* `AlertDialog.Popup`'s `portal` prop to customize the portal target and
|
|
8
|
-
* wrapper. When `portal` is omitted, `AlertDialog.Popup` uses this component
|
|
9
|
-
* with default props.
|
|
6
|
+
* Used to apply custom portal behavior to `AlertDialog`'s overlay content.
|
|
10
7
|
*/
|
|
11
8
|
const Portal = forwardRef< HTMLDivElement, PortalProps >(
|
|
12
9
|
function AlertDialogPortal( props, ref ) {
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import type { AlertDialog as _AlertDialog } from '@base-ui/react/alert-dialog';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
import type { ComponentProps } from '../utils/types';
|
|
5
5
|
|
|
6
|
-
export type PortalProps =
|
|
7
|
-
typeof _AlertDialog.Portal
|
|
8
|
-
>;
|
|
6
|
+
export type PortalProps = ComponentProps< typeof _AlertDialog.Portal >;
|
|
9
7
|
|
|
10
8
|
/**
|
|
11
9
|
* The return type of `onConfirm`. Return `void` (or nothing) to auto-close
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Badge } from '../..';
|
|
3
|
+
|
|
4
|
+
const meta: Meta< typeof Badge > = {
|
|
5
|
+
title: 'Design System/Components/Badge',
|
|
6
|
+
component: Badge,
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
|
|
10
|
+
type Story = StoryObj< typeof Badge >;
|
|
11
|
+
|
|
12
|
+
export const TextOverflow: Story = {
|
|
13
|
+
args: {
|
|
14
|
+
children:
|
|
15
|
+
'This is an extremely long label thatshoulddemonstratetextoverflow behavior',
|
|
16
|
+
},
|
|
17
|
+
parameters: {
|
|
18
|
+
textOverflowContainers: true,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { Meta, StoryFn, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Button } from '../..';
|
|
3
|
+
import type { ButtonProps } from '../../types';
|
|
4
|
+
|
|
5
|
+
const meta: Meta< typeof Button > = {
|
|
6
|
+
title: 'Design System/Components/Button',
|
|
7
|
+
component: Button,
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
|
|
11
|
+
type Story = StoryObj< typeof Button >;
|
|
12
|
+
|
|
13
|
+
const variants: NonNullable< ButtonProps[ 'variant' ] >[] = [
|
|
14
|
+
'solid',
|
|
15
|
+
'outline',
|
|
16
|
+
'minimal',
|
|
17
|
+
'unstyled',
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
export const VariantStates: StoryFn< typeof Button > = (
|
|
21
|
+
props: ButtonProps
|
|
22
|
+
) => {
|
|
23
|
+
const VariantsRow = ( {
|
|
24
|
+
buttonProps,
|
|
25
|
+
name,
|
|
26
|
+
}: {
|
|
27
|
+
buttonProps?: ButtonProps;
|
|
28
|
+
name: string;
|
|
29
|
+
} ) => {
|
|
30
|
+
return (
|
|
31
|
+
<tr>
|
|
32
|
+
<th
|
|
33
|
+
style={ {
|
|
34
|
+
fontSize: 13,
|
|
35
|
+
fontWeight: 'normal',
|
|
36
|
+
padding: 8,
|
|
37
|
+
background: '#f3f4f5',
|
|
38
|
+
} }
|
|
39
|
+
>
|
|
40
|
+
{ name }
|
|
41
|
+
</th>
|
|
42
|
+
{ variants.map( ( variant ) => (
|
|
43
|
+
<td key={ variant } style={ { padding: 4 } }>
|
|
44
|
+
<Button
|
|
45
|
+
{ ...props }
|
|
46
|
+
variant={ variant }
|
|
47
|
+
{ ...buttonProps }
|
|
48
|
+
/>
|
|
49
|
+
</td>
|
|
50
|
+
) ) }
|
|
51
|
+
</tr>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<table>
|
|
57
|
+
<thead>
|
|
58
|
+
<tr style={ { background: '#f3f4f5' } }>
|
|
59
|
+
<th />
|
|
60
|
+
{ variants.map( ( variant ) => (
|
|
61
|
+
<th key={ variant } style={ { padding: 8 } }>
|
|
62
|
+
{ variant }
|
|
63
|
+
</th>
|
|
64
|
+
) ) }
|
|
65
|
+
</tr>
|
|
66
|
+
</thead>
|
|
67
|
+
<tbody>
|
|
68
|
+
<VariantsRow name="(default)" />
|
|
69
|
+
<VariantsRow
|
|
70
|
+
name="disabled"
|
|
71
|
+
buttonProps={ { disabled: true } }
|
|
72
|
+
/>
|
|
73
|
+
<VariantsRow
|
|
74
|
+
name="disabled unfocusable"
|
|
75
|
+
buttonProps={ {
|
|
76
|
+
focusableWhenDisabled: false,
|
|
77
|
+
disabled: true,
|
|
78
|
+
} }
|
|
79
|
+
/>
|
|
80
|
+
<VariantsRow
|
|
81
|
+
name="loading"
|
|
82
|
+
buttonProps={ {
|
|
83
|
+
loading: true,
|
|
84
|
+
} }
|
|
85
|
+
/>
|
|
86
|
+
<VariantsRow
|
|
87
|
+
name="loading disabled"
|
|
88
|
+
buttonProps={ {
|
|
89
|
+
loading: true,
|
|
90
|
+
disabled: true,
|
|
91
|
+
} }
|
|
92
|
+
/>
|
|
93
|
+
<VariantsRow
|
|
94
|
+
name="neutral"
|
|
95
|
+
buttonProps={ {
|
|
96
|
+
tone: 'neutral',
|
|
97
|
+
} }
|
|
98
|
+
/>
|
|
99
|
+
<VariantsRow
|
|
100
|
+
name="pressed"
|
|
101
|
+
buttonProps={ {
|
|
102
|
+
tone: 'neutral',
|
|
103
|
+
'aria-pressed': true,
|
|
104
|
+
} }
|
|
105
|
+
/>
|
|
106
|
+
<VariantsRow
|
|
107
|
+
name="pressed disabled"
|
|
108
|
+
buttonProps={ {
|
|
109
|
+
tone: 'neutral',
|
|
110
|
+
'aria-pressed': true,
|
|
111
|
+
disabled: true,
|
|
112
|
+
} }
|
|
113
|
+
/>
|
|
114
|
+
</tbody>
|
|
115
|
+
</table>
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
VariantStates.args = {
|
|
119
|
+
children: 'Code is poetry',
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export const TextOverflow: Story = {
|
|
123
|
+
args: {
|
|
124
|
+
children:
|
|
125
|
+
'This is an extremely long label thatshoulddemonstratetextoverflow behavior',
|
|
126
|
+
},
|
|
127
|
+
parameters: {
|
|
128
|
+
textOverflowContainers: true,
|
|
129
|
+
},
|
|
130
|
+
};
|
|
@@ -95,7 +95,7 @@ export const AllTonesAndVariants: Story = {
|
|
|
95
95
|
<div
|
|
96
96
|
style={ {
|
|
97
97
|
display: 'grid',
|
|
98
|
-
gridTemplateColumns: 'max-content repeat(2,
|
|
98
|
+
gridTemplateColumns: 'max-content repeat(2, max-content)',
|
|
99
99
|
color: 'var(--wpds-color-fg-content-neutral)',
|
|
100
100
|
} }
|
|
101
101
|
>
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
--wp-ui-button-foreground-color: var(--wpds-color-fg-interactive-brand-strong);
|
|
18
18
|
--wp-ui-button-foreground-color-active: var(--wpds-color-fg-interactive-brand-strong-active);
|
|
19
19
|
--wp-ui-button-foreground-color-disabled: var(--wpds-color-fg-interactive-neutral-strong-disabled);
|
|
20
|
+
--wp-ui-button-padding-block: var(--wpds-dimension-padding-xs);
|
|
20
21
|
--wp-ui-button-padding-inline: var(--wpds-dimension-padding-md);
|
|
21
22
|
--wp-ui-button-height: 40px;
|
|
22
23
|
--wp-ui-button-aspect-ratio: auto; /* Useful for overrides such as icon buttons */
|
|
@@ -40,7 +41,9 @@
|
|
|
40
41
|
gap: var(--wpds-dimension-gap-sm);
|
|
41
42
|
aspect-ratio: var(--wp-ui-button-aspect-ratio);
|
|
42
43
|
min-width: var(--wp-ui-button-min-width);
|
|
43
|
-
|
|
44
|
+
max-width: 100%;
|
|
45
|
+
min-height: var(--wp-ui-button-height);
|
|
46
|
+
padding-block: var(--wp-ui-button-padding-block);
|
|
44
47
|
padding-inline: var(--wp-ui-button-padding-inline);
|
|
45
48
|
border-style: solid;
|
|
46
49
|
border-width: 1px;
|
|
@@ -52,9 +55,14 @@
|
|
|
52
55
|
font-size: var(--wp-ui-button-font-size);
|
|
53
56
|
font-weight: var(--wp-ui-button-font-weight);
|
|
54
57
|
line-height: var(--wpds-typography-line-height-sm);
|
|
58
|
+
text-align: center;
|
|
55
59
|
text-decoration: none;
|
|
56
60
|
color: var(--wp-ui-button-foreground-color);
|
|
57
|
-
|
|
61
|
+
overflow-wrap: anywhere;
|
|
62
|
+
|
|
63
|
+
&:not([data-disabled]) {
|
|
64
|
+
cursor: var(--wpds-cursor-control);
|
|
65
|
+
}
|
|
58
66
|
|
|
59
67
|
@media not ( prefers-reduced-motion ) {
|
|
60
68
|
transition: color 0.1s ease-out;
|
|
@@ -129,6 +137,7 @@
|
|
|
129
137
|
}
|
|
130
138
|
|
|
131
139
|
.is-small {
|
|
140
|
+
--wp-ui-button-padding-block: 0;
|
|
132
141
|
--wp-ui-button-padding-inline: var(--wpds-dimension-padding-sm);
|
|
133
142
|
--wp-ui-button-height: 24px;
|
|
134
143
|
}
|
|
@@ -164,7 +173,9 @@
|
|
|
164
173
|
}
|
|
165
174
|
|
|
166
175
|
.is-neutral {
|
|
167
|
-
|
|
176
|
+
/* Solid and pressed minimal share the strong appearance */
|
|
177
|
+
&.is-solid,
|
|
178
|
+
&.is-minimal[aria-pressed="true"] {
|
|
168
179
|
--wp-ui-button-background-color: var(--wpds-color-bg-interactive-neutral-strong);
|
|
169
180
|
--wp-ui-button-background-color-active: var(--wpds-color-bg-interactive-neutral-strong-active);
|
|
170
181
|
--wp-ui-button-background-color-disabled: var(--wpds-color-bg-interactive-neutral-strong-disabled);
|
|
@@ -173,9 +184,9 @@
|
|
|
173
184
|
--wp-ui-button-foreground-color-disabled: var(--wpds-color-fg-interactive-neutral-strong-disabled);
|
|
174
185
|
}
|
|
175
186
|
|
|
176
|
-
/* Outline and minimal buttons use the same foreground color */
|
|
187
|
+
/* Outline and unpressed minimal buttons use the same foreground color */
|
|
177
188
|
&.is-outline,
|
|
178
|
-
&.is-minimal {
|
|
189
|
+
&.is-minimal:not([aria-pressed="true"]) {
|
|
179
190
|
--wp-ui-button-foreground-color: var(--wpds-color-fg-interactive-neutral);
|
|
180
191
|
--wp-ui-button-foreground-color-active: var(--wpds-color-fg-interactive-neutral-active);
|
|
181
192
|
--wp-ui-button-foreground-color-disabled: var(--wpds-color-fg-interactive-neutral-disabled);
|
|
@@ -190,7 +201,7 @@
|
|
|
190
201
|
--wp-ui-button-border-color-disabled: var(--wpds-color-stroke-interactive-neutral-disabled);
|
|
191
202
|
}
|
|
192
203
|
|
|
193
|
-
&.is-minimal {
|
|
204
|
+
&.is-minimal:not([aria-pressed="true"]) {
|
|
194
205
|
--wp-ui-button-background-color: var(--wpds-color-bg-interactive-neutral-weak);
|
|
195
206
|
--wp-ui-button-background-color-active: var(--wpds-color-bg-interactive-neutral-weak-active);
|
|
196
207
|
--wp-ui-button-background-color-disabled: var(--wpds-color-bg-interactive-neutral-weak-disabled);
|
|
@@ -230,12 +241,6 @@
|
|
|
230
241
|
}
|
|
231
242
|
}
|
|
232
243
|
|
|
233
|
-
[aria-pressed="true"].is-minimal.is-neutral {
|
|
234
|
-
--wp-ui-button-background-color: var(--wpds-color-bg-interactive-neutral-strong);
|
|
235
|
-
--wp-ui-button-background-color-active: var(--wpds-color-bg-interactive-neutral-strong);
|
|
236
|
-
--wp-ui-button-foreground-color: var(--wpds-color-fg-interactive-neutral-strong);
|
|
237
|
-
--wp-ui-button-foreground-color-active: var(--wpds-color-fg-interactive-neutral-strong);
|
|
238
|
-
}
|
|
239
244
|
}
|
|
240
245
|
|
|
241
246
|
@keyframes loading-animation {
|