@funstack/ui 0.1.0-alpha.13 → 0.1.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/combobox/combobox-popup.d.mts +4 -2
- package/dist/combobox/combobox-popup.d.mts.map +1 -1
- package/dist/combobox/combobox-popup.mjs +19 -3
- package/dist/combobox/combobox-popup.mjs.map +1 -1
- package/dist/combobox/combobox-trigger.d.mts +13 -10
- package/dist/combobox/combobox-trigger.d.mts.map +1 -1
- package/dist/combobox/combobox-trigger.mjs +19 -14
- package/dist/combobox/combobox-trigger.mjs.map +1 -1
- package/dist/dialog/dialog-popup.mjs +3 -2
- package/dist/dialog/dialog-popup.mjs.map +1 -1
- package/dist/internal/anchor-position.mjs.map +1 -1
- package/dist/internal/invoker-press.mjs +46 -0
- package/dist/internal/invoker-press.mjs.map +1 -0
- package/dist/internal/platform-attributes.d.mts +2 -1
- package/dist/internal/platform-attributes.d.mts.map +1 -1
- package/dist/internal/render-element.mjs.map +1 -1
- package/dist/internal/trigger-ref.mjs +2 -2
- package/dist/internal/trigger-ref.mjs.map +1 -1
- package/dist/internal/use-overlay-root.mjs +2 -1
- package/dist/internal/use-overlay-root.mjs.map +1 -1
- package/dist/internal/use-popover-popup.mjs +87 -11
- package/dist/internal/use-popover-popup.mjs.map +1 -1
- package/dist/internal/use-popover-trigger.mjs +14 -11
- package/dist/internal/use-popover-trigger.mjs.map +1 -1
- package/dist/internal/use-resolved-placement.mjs +1 -1
- package/dist/internal/use-resolved-placement.mjs.map +1 -1
- package/dist/menu/menu-context.mjs.map +1 -1
- package/dist/menu/menu-popup.d.mts +3 -1
- package/dist/menu/menu-popup.d.mts.map +1 -1
- package/dist/menu/menu-popup.mjs +14 -3
- package/dist/menu/menu-popup.mjs.map +1 -1
- package/dist/menu/menu-submenu-trigger.d.mts +7 -5
- package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
- package/dist/menu/menu-submenu-trigger.mjs +6 -4
- package/dist/menu/menu-submenu-trigger.mjs.map +1 -1
- package/dist/menu/menu-trigger.d.mts +8 -6
- package/dist/menu/menu-trigger.d.mts.map +1 -1
- package/dist/menu/menu-trigger.mjs +6 -4
- package/dist/menu/menu-trigger.mjs.map +1 -1
- package/dist/popover/index.d.mts +1 -1
- package/dist/popover/index.mjs +1 -1
- package/dist/popover/index.mjs.map +1 -1
- package/dist/popover/popover-close.d.mts +3 -1
- package/dist/popover/popover-close.d.mts.map +1 -1
- package/dist/popover/popover-close.mjs +3 -1
- package/dist/popover/popover-close.mjs.map +1 -1
- package/dist/popover/popover-popup.d.mts +1 -1
- package/dist/popover/popover-popup.mjs +1 -1
- package/dist/popover/popover-popup.mjs.map +1 -1
- package/dist/popover/popover-root.d.mts +1 -1
- package/dist/popover/popover-root.mjs +1 -1
- package/dist/popover/popover-root.mjs.map +1 -1
- package/dist/popover/popover-trigger.d.mts +11 -10
- package/dist/popover/popover-trigger.d.mts.map +1 -1
- package/dist/popover/popover-trigger.mjs +10 -9
- package/dist/popover/popover-trigger.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover-close.mjs","names":[],"sources":["../../src/popover/popover-close.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { isPopoverOpen } from \"../internal/popover-open.js\";\nimport type { Action, ActionDetails, RenderProp, StateValue } from \"../internal/types.js\";\nimport { useOverlayClose } from \"../internal/use-overlay-close.js\";\nimport { usePopoverContext } from \"./popover-context.js\";\n\nexport interface PopoverCloseState {\n /** The `action` is in flight. */\n readonly pending: boolean;\n readonly disabled: boolean;\n}\n\nexport interface PopoverCloseProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * Runs inside this part's own transition (`data-pending` on the button), then closes the\n * popover: in library mode through the Root (`openChangeAction(false)` awaited, view\n * transition if set), in JS-free mode with `hidePopover()`. A rejection reaches the nearest\n * Error Boundary above the Close part and leaves the popover open. If the popover was\n * dismissed and opened again while the action ran, the close is dropped. Without `action` in JS-free\n * mode the button is a native `command=\"hide-popover\"` invoker.\n */\n action?: Action<[details: ActionDetails]>;\n /**\n * Never closes. Native `disabled` on a `<button>`; owned, so a `render` element cannot\n * re-enable it. With a link or component `render` whose click this part handles (library mode,\n * or with `action`), `aria-disabled=\"true\"` instead: the element stays focusable.\n */\n disabled?: boolean;\n className?: StateValue<string | undefined, PopoverCloseState>;\n style?: StateValue<CSSProperties | undefined, PopoverCloseState>;\n children?: StateValue<ReactNode, PopoverCloseState>;\n render?: RenderProp<ComponentPropsWithRef<\"button\">, PopoverCloseState>;\n}\n\n/**\n * A close button: `<button type=\"button\" commandfor command=\"hide-popover\">`. In JS-free mode\n * without `action` the browser hides the popover. In library mode the click is always cancelled\n * and the close goes through the Root (`openChangeAction(false)` awaited, `hidePopover()` in the\n * commit). With `action` the action runs first in this part's own transition (`data-pending` on\n * the button, with `aria-disabled`; a second click meanwhile is ignored); a rejection leaves the\n * popover open.\n *\n * Owned keys (conventions 1.2): `type` (on a `<button>` only), `disabled`, `commandfor`,\n * `command`, `onClick` (library mode, or with `action`), `aria-disabled`, `data-pending`,\n * `data-disabled`.\n */\nexport function PopoverClose({\n action,\n disabled = false,\n className,\n style,\n children,\n render,\n ...rest\n}: PopoverCloseProps) {\n const ctx = usePopoverContext(\"Popover.Close\");\n const { popupRef, recordCloseIntent } = ctx;\n const isLibrary = ctx.mode === \"library\";\n return useOverlayClose({\n part: \"Popover.Close\",\n noun: \"popover\",\n isLibrary,\n popupId: ctx.ids.popup,\n command: \"hide-popover\",\n openGeneration: ctx.openGeneration,\n action,\n details: (event) => createActionDetails(event, {}),\n close: (event) => {\n if (isLibrary) {\n // A library-owned close (design 2.3): awaited, then hidden in the commit.\n ctx.requestClose(event, \"activate\");\n return;\n }\n // JS-free mode with `action`: a browser-owned close; there is no Root state to notify.\n const popup = popupRef.current;\n if (popup === null || !popup.isConnected || !isPopoverOpen(popup)) return;\n recordCloseIntent({ reason: \"activate\", event });\n popup.hidePopover();\n },\n disabled,\n className,\n style,\n children,\n render,\n rest,\n });\n}\n\nPopoverClose.displayName = \"PopoverClose\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"popover-close.mjs","names":[],"sources":["../../src/popover/popover-close.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { isPopoverOpen } from \"../internal/popover-open.js\";\nimport type { Action, ActionDetails, RenderProp, StateValue } from \"../internal/types.js\";\nimport { useOverlayClose } from \"../internal/use-overlay-close.js\";\nimport { usePopoverContext } from \"./popover-context.js\";\n\nexport interface PopoverCloseState {\n /** The `action` is in flight. */\n readonly pending: boolean;\n readonly disabled: boolean;\n}\n\nexport interface PopoverCloseProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * Runs inside this part's own transition (`data-pending` on the button), then closes the\n * popover: in library mode through the Root (`openChangeAction(false)` awaited, view\n * transition if set), in JS-free mode with `hidePopover()`. A rejection reaches the nearest\n * Error Boundary above the Close part and leaves the popover open. If the popover was\n * dismissed and opened again while the action ran, the close is dropped. Without `action` in JS-free\n * mode the button is a native `command=\"hide-popover\"` invoker.\n */\n action?: Action<[details: ActionDetails]>;\n /**\n * Never closes. Native `disabled` on a `<button>`; owned, so a `render` element cannot\n * re-enable it. With a link or component `render` whose click this part handles (library mode,\n * or with `action`), `aria-disabled=\"true\"` instead: the element stays focusable.\n */\n disabled?: boolean;\n className?: StateValue<string | undefined, PopoverCloseState>;\n style?: StateValue<CSSProperties | undefined, PopoverCloseState>;\n children?: StateValue<ReactNode, PopoverCloseState>;\n render?: RenderProp<ComponentPropsWithRef<\"button\">, PopoverCloseState>;\n}\n\n/**\n * A close button: `<button type=\"button\" commandfor command=\"hide-popover\">`. In JS-free mode\n * without `action` the browser hides the popover. In library mode the click is always cancelled\n * and the close goes through the Root (`openChangeAction(false)` awaited, `hidePopover()` in the\n * commit). With `action` the action runs first in this part's own transition (`data-pending` on\n * the button, with `aria-disabled`; a second click meanwhile is ignored); a rejection leaves the\n * popover open. It keeps `commandfor` where the Trigger has `popovertarget` (#121): an invoker\n * inside its own popover exposes no state either way, and the `command` event tells the Popup a\n * foreign hide's reason.\n *\n * Owned keys (conventions 1.2): `type` (on a `<button>` only), `disabled`, `commandfor`,\n * `command`, `onClick` (library mode, or with `action`), `aria-disabled`, `data-pending`,\n * `data-disabled`.\n */\nexport function PopoverClose({\n action,\n disabled = false,\n className,\n style,\n children,\n render,\n ...rest\n}: PopoverCloseProps) {\n const ctx = usePopoverContext(\"Popover.Close\");\n const { popupRef, recordCloseIntent } = ctx;\n const isLibrary = ctx.mode === \"library\";\n return useOverlayClose({\n part: \"Popover.Close\",\n noun: \"popover\",\n isLibrary,\n popupId: ctx.ids.popup,\n command: \"hide-popover\",\n openGeneration: ctx.openGeneration,\n action,\n details: (event) => createActionDetails(event, {}),\n close: (event) => {\n if (isLibrary) {\n // A library-owned close (design 2.3): awaited, then hidden in the commit.\n ctx.requestClose(event, \"activate\");\n return;\n }\n // JS-free mode with `action`: a browser-owned close; there is no Root state to notify.\n const popup = popupRef.current;\n if (popup === null || !popup.isConnected || !isPopoverOpen(popup)) return;\n recordCloseIntent({ reason: \"activate\", event });\n popup.hidePopover();\n },\n disabled,\n className,\n style,\n children,\n render,\n rest,\n });\n}\n\nPopoverClose.displayName = \"PopoverClose\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqDA,SAAgB,aAAa,EAC3B,QACA,WAAW,OACX,WACA,OACA,UACA,QACA,GAAG,QACiB;CACpB,MAAM,MAAM,kBAAkB,eAAe;CAC7C,MAAM,EAAE,UAAU,sBAAsB;CACxC,MAAM,YAAY,IAAI,SAAS;CAC/B,OAAO,gBAAgB;EACrB,MAAM;EACN,MAAM;EACN;EACA,SAAS,IAAI,IAAI;EACjB,SAAS;EACT,gBAAgB,IAAI;EACpB;EACA,UAAU,UAAU,oBAAoB,OAAO,CAAC,CAAC;EACjD,QAAQ,UAAU;GAChB,IAAI,WAAW;IAEb,IAAI,aAAa,OAAO,UAAU;IAClC;GACF;GAEA,MAAM,QAAQ,SAAS;GACvB,IAAI,UAAU,QAAQ,CAAC,MAAM,eAAe,CAAC,cAAc,KAAK,GAAG;GACnE,kBAAkB;IAAE,QAAQ;IAAY;GAAM,CAAC;GAC/C,MAAM,YAAY;EACpB;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;AACH;AAEA,aAAa,cAAc"}
|
|
@@ -75,7 +75,7 @@ export interface PopoverPopupProps extends Omit<ComponentPropsWithRef<"dialog">,
|
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
77
|
* The popover itself: a `<dialog popover="auto" aria-modal="false" role="dialog">` with the id
|
|
78
|
-
* the Trigger's `
|
|
78
|
+
* the Trigger's `popovertarget` names, placed against the Trigger with CSS Anchor Positioning and
|
|
79
79
|
* wired to Title and Description through `aria-labelledby` / `aria-describedby`. Style it with
|
|
80
80
|
* `:popover-open`; it emits `data-side` / `data-align` but no `data-open`. While shown, those are
|
|
81
81
|
* where the browser placed it (the applied `position-try-fallbacks` option; conventions 13.2),
|
|
@@ -11,7 +11,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
11
11
|
//#region src/popover/popover-popup.tsx
|
|
12
12
|
/**
|
|
13
13
|
* The popover itself: a `<dialog popover="auto" aria-modal="false" role="dialog">` with the id
|
|
14
|
-
* the Trigger's `
|
|
14
|
+
* the Trigger's `popovertarget` names, placed against the Trigger with CSS Anchor Positioning and
|
|
15
15
|
* wired to Title and Description through `aria-labelledby` / `aria-describedby`. Style it with
|
|
16
16
|
* `:popover-open`; it emits `data-side` / `data-align` but no `data-open`. While shown, those are
|
|
17
17
|
* where the browser placed it (the applied `position-try-fallbacks` option; conventions 13.2),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover-popup.mjs","names":[],"sources":["../../src/popover/popover-popup.tsx"],"sourcesContent":["\"use client\";\nimport type {\n ComponentPropsWithRef,\n CSSProperties,\n ReactNode,\n RefObject,\n ViewTransitionClass,\n} from \"react\";\nimport type { AnchorAlign, AnchorSide } from \"../internal/anchor-position.js\";\nimport { useTransitionBoundary } from \"../internal/transition-boundary.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useJsFreePropWarnings } from \"../internal/overlay-popup.js\";\nimport { useMergedRefs } from \"../internal/use-merged-refs.js\";\nimport { usePopoverPopup } from \"../internal/use-popover-popup.js\";\nimport { useAnchoredPlacement } from \"../internal/use-resolved-placement.js\";\nimport { resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { PopoverPopupContext, usePopoverContext } from \"./popover-context.js\";\n\n/** `inline-start` / `inline-end` follow the popup's `direction` (conventions 13.1). */\nexport type PopoverSide = AnchorSide;\nexport type PopoverAlign = AnchorAlign;\n\nexport interface PopoverPopupState {\n /**\n * Committed open state (library mode); `false` in JS-free mode. Read `:popover-open` for the\n * DOM truth.\n */\n readonly open: boolean;\n /**\n * While shown: the physical side the browser placed the popup on (after any fallback flip;\n * conventions 13.2). Otherwise the `side` prop. `null` with `side={null}`.\n */\n readonly side: PopoverSide | null;\n /** While shown: the resolved alignment; otherwise the `align` prop. */\n readonly align: PopoverAlign;\n}\n\nexport interface PopoverPopupProps extends Omit<\n ComponentPropsWithRef<\"dialog\">,\n | \"id\"\n | \"popover\"\n | \"open\"\n | \"aria-modal\"\n | \"onToggle\"\n | \"onBeforeToggle\"\n | \"className\"\n | \"style\"\n | \"children\"\n> {\n /**\n * Placement relative to the Trigger through inline `position-area`, with\n * `position-try-fallbacks` flipping it when it does not fit. Default `\"bottom\"`.\n * `\"inline-start\"` / `\"inline-end\"` follow the popup's direction. `null` emits no inline\n * positioning (and no `data-side` / `data-align`), so a stylesheet owns placement.\n */\n side?: PopoverSide | null;\n /**\n * Alignment along the side. Default `\"center\"`. On a top / bottom side `start` / `end` are\n * inline-relative (mirrored under `direction: rtl`); on the other sides the top / bottom\n * edges. Ignored when `side` is `null`.\n */\n align?: PopoverAlign;\n /**\n * Library mode: what happens to the children while the popover is closed.\n * - `false` (default): not rendered. Mounting them is part of the opening transition, so\n * content that suspends holds the open until it is ready. Unmount waits for the popover's\n * exit animation (CSS), or happens in the close commit when `transition` is set.\n * - `true`: rendered inside `<Activity mode=\"hidden\">`: DOM and state preserved, effects\n * stopped, pre-rendered at low priority. Not in the server HTML.\n *\n * Ignored in JS-free mode (always mounted).\n */\n keepMounted?: boolean;\n /**\n * Element to focus when the popover opens: a ref, or a selector resolved inside the popup.\n * The library writes `autofocus` on it right before `showPopover()` and the platform focuses\n * it. Default: the platform's choice for a `<dialog>` (first focusable descendant; the popup\n * itself if none); for `render={<div />}` focus stays on the Trigger.\n *\n * In JS-free mode the browser opens the popover itself, so the attribute is written after\n * hydration and kept while mounted; before hydration only `autoFocus` in the markup works.\n */\n initialFocus?: RefObject<HTMLElement | null> | string;\n /**\n * Library mode only. Forwarded to the `<ViewTransition default>` around the popover element\n * itself. Animates the opening commit, content changes while open, and every library-driven\n * close (Trigger, Close, controlled `open={false}`), in all engines; dismissals (Escape,\n * click outside) are the browser's and animate with CSS only. Ignored (dev warning) in JS-free\n * mode.\n *\n * Static: setting or unsetting it remounts the element. Any value, `\"none\"` included, makes a\n * mount or `<Activity>` reveal inside a transition start a document view transition (a ~250 ms\n * page cross-fade that the next transition waits for).\n * A plain open starts none: the children mount under the already-mounted popover element.\n */\n transition?: ViewTransitionClass;\n className?: StateValue<string | undefined, PopoverPopupState>;\n style?: StateValue<CSSProperties | undefined, PopoverPopupState>;\n children?: StateValue<ReactNode, PopoverPopupState>;\n /** A `<dialog>` (default) or a `<div>` (focus stays on the Trigger). */\n render?: RenderProp<ComponentPropsWithRef<\"dialog\">, PopoverPopupState>;\n}\n\n/**\n * The popover itself: a `<dialog popover=\"auto\" aria-modal=\"false\" role=\"dialog\">` with the id\n * the Trigger's `
|
|
1
|
+
{"version":3,"file":"popover-popup.mjs","names":[],"sources":["../../src/popover/popover-popup.tsx"],"sourcesContent":["\"use client\";\nimport type {\n ComponentPropsWithRef,\n CSSProperties,\n ReactNode,\n RefObject,\n ViewTransitionClass,\n} from \"react\";\nimport type { AnchorAlign, AnchorSide } from \"../internal/anchor-position.js\";\nimport { useTransitionBoundary } from \"../internal/transition-boundary.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useJsFreePropWarnings } from \"../internal/overlay-popup.js\";\nimport { useMergedRefs } from \"../internal/use-merged-refs.js\";\nimport { usePopoverPopup } from \"../internal/use-popover-popup.js\";\nimport { useAnchoredPlacement } from \"../internal/use-resolved-placement.js\";\nimport { resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { PopoverPopupContext, usePopoverContext } from \"./popover-context.js\";\n\n/** `inline-start` / `inline-end` follow the popup's `direction` (conventions 13.1). */\nexport type PopoverSide = AnchorSide;\nexport type PopoverAlign = AnchorAlign;\n\nexport interface PopoverPopupState {\n /**\n * Committed open state (library mode); `false` in JS-free mode. Read `:popover-open` for the\n * DOM truth.\n */\n readonly open: boolean;\n /**\n * While shown: the physical side the browser placed the popup on (after any fallback flip;\n * conventions 13.2). Otherwise the `side` prop. `null` with `side={null}`.\n */\n readonly side: PopoverSide | null;\n /** While shown: the resolved alignment; otherwise the `align` prop. */\n readonly align: PopoverAlign;\n}\n\nexport interface PopoverPopupProps extends Omit<\n ComponentPropsWithRef<\"dialog\">,\n | \"id\"\n | \"popover\"\n | \"open\"\n | \"aria-modal\"\n | \"onToggle\"\n | \"onBeforeToggle\"\n | \"className\"\n | \"style\"\n | \"children\"\n> {\n /**\n * Placement relative to the Trigger through inline `position-area`, with\n * `position-try-fallbacks` flipping it when it does not fit. Default `\"bottom\"`.\n * `\"inline-start\"` / `\"inline-end\"` follow the popup's direction. `null` emits no inline\n * positioning (and no `data-side` / `data-align`), so a stylesheet owns placement.\n */\n side?: PopoverSide | null;\n /**\n * Alignment along the side. Default `\"center\"`. On a top / bottom side `start` / `end` are\n * inline-relative (mirrored under `direction: rtl`); on the other sides the top / bottom\n * edges. Ignored when `side` is `null`.\n */\n align?: PopoverAlign;\n /**\n * Library mode: what happens to the children while the popover is closed.\n * - `false` (default): not rendered. Mounting them is part of the opening transition, so\n * content that suspends holds the open until it is ready. Unmount waits for the popover's\n * exit animation (CSS), or happens in the close commit when `transition` is set.\n * - `true`: rendered inside `<Activity mode=\"hidden\">`: DOM and state preserved, effects\n * stopped, pre-rendered at low priority. Not in the server HTML.\n *\n * Ignored in JS-free mode (always mounted).\n */\n keepMounted?: boolean;\n /**\n * Element to focus when the popover opens: a ref, or a selector resolved inside the popup.\n * The library writes `autofocus` on it right before `showPopover()` and the platform focuses\n * it. Default: the platform's choice for a `<dialog>` (first focusable descendant; the popup\n * itself if none); for `render={<div />}` focus stays on the Trigger.\n *\n * In JS-free mode the browser opens the popover itself, so the attribute is written after\n * hydration and kept while mounted; before hydration only `autoFocus` in the markup works.\n */\n initialFocus?: RefObject<HTMLElement | null> | string;\n /**\n * Library mode only. Forwarded to the `<ViewTransition default>` around the popover element\n * itself. Animates the opening commit, content changes while open, and every library-driven\n * close (Trigger, Close, controlled `open={false}`), in all engines; dismissals (Escape,\n * click outside) are the browser's and animate with CSS only. Ignored (dev warning) in JS-free\n * mode.\n *\n * Static: setting or unsetting it remounts the element. Any value, `\"none\"` included, makes a\n * mount or `<Activity>` reveal inside a transition start a document view transition (a ~250 ms\n * page cross-fade that the next transition waits for).\n * A plain open starts none: the children mount under the already-mounted popover element.\n */\n transition?: ViewTransitionClass;\n className?: StateValue<string | undefined, PopoverPopupState>;\n style?: StateValue<CSSProperties | undefined, PopoverPopupState>;\n children?: StateValue<ReactNode, PopoverPopupState>;\n /** A `<dialog>` (default) or a `<div>` (focus stays on the Trigger). */\n render?: RenderProp<ComponentPropsWithRef<\"dialog\">, PopoverPopupState>;\n}\n\n/**\n * The popover itself: a `<dialog popover=\"auto\" aria-modal=\"false\" role=\"dialog\">` with the id\n * the Trigger's `popovertarget` names, placed against the Trigger with CSS Anchor Positioning and\n * wired to Title and Description through `aria-labelledby` / `aria-describedby`. Style it with\n * `:popover-open`; it emits `data-side` / `data-align` but no `data-open`. While shown, those are\n * where the browser placed it (the applied `position-try-fallbacks` option; conventions 13.2),\n * in both modes; otherwise the requested values.\n *\n * In library mode the children render from committed state, so content that suspends keeps the\n * popover closed (and the Trigger pending) until it is ready; `showPopover({ source: trigger })`\n * runs in the layout effect of the commit that mounted them, and a library-driven close runs\n * `hidePopover()` in the commit that ends it. Dismissals are the browser's: the native `toggle`\n * event becomes `openChangeAction(false, { reason: \"dismiss\" })`.\n *\n * Owned keys (conventions 1.2): `id`, `popover`, `open`, `aria-modal`, `aria-labelledby` and\n * `aria-describedby` (token-merged), and `data-side` / `data-align` unless `side` is `null`.\n * `role` is a default (`\"dialog\"`) the consumer may override.\n */\nexport function PopoverPopup({\n side: sideProp = \"bottom\",\n align: alignProp = \"center\",\n keepMounted,\n initialFocus,\n transition,\n className,\n style,\n children,\n render,\n ...rest\n}: PopoverPopupProps) {\n const ctx = usePopoverContext(\"Popover.Popup\");\n const isLibrary = ctx.mode === \"library\";\n const { ids } = ctx;\n\n useJsFreePropWarnings(\"Popover.Popup\", \"popover\", isLibrary, transition, keepMounted);\n\n const { setElement, renderContent } = usePopoverPopup(ctx, {\n part: \"Popover.Popup\",\n initialFocus,\n keepMounted,\n transition: isLibrary ? transition : undefined,\n });\n\n // Resolved while shown, in library and JS-free mode alike (it hangs off the element's ref and\n // the platform's `toggle`, not off library state).\n const placement = useAnchoredPlacement({ side: sideProp, align: alignProp });\n const { side, align } = placement;\n const ref = useMergedRefs(setElement, placement.ref);\n\n const state: PopoverPopupState = { open: ctx.committed, side, align };\n\n const content = (s: PopoverPopupState): ReactNode => (\n <PopoverPopupContext value={s}>\n {renderContent(() => resolveStateValue(children, s))}\n </PopoverPopupContext>\n );\n\n const libraryProps: ComponentPropsWithRef<\"dialog\"> & DataAttributes = {\n id: ids.popup,\n popover: \"auto\",\n // Never rendered: `showPopover()` does not set it, and an `open` attribute would show the\n // <dialog> outside the top layer. Owned so a `render` element cannot add it.\n open: undefined,\n // Chromium exposes a <dialog popover> as modal without it (research; issue #44).\n \"aria-modal\": \"false\",\n \"aria-labelledby\": ids.title,\n \"aria-describedby\": ids.description,\n // Not owned with `side={null}`: the stylesheet (or a render element) may set them.\n ...placement.dataAttributes,\n };\n\n const element = useRender<ComponentPropsWithRef<\"dialog\">, PopoverPopupState>({\n defaultElement: \"dialog\",\n render,\n state,\n className,\n // The consumer's style wins over the inline placement (design 8).\n style: placement.style(style),\n children: content,\n // `role` is a default the consumer's `rest` overrides (design 3.3): WebKit implements no\n // minimum role for `[popover]`, and a `<div>` popup needs it.\n props: { role: \"dialog\", ...rest },\n libraryProps,\n ref,\n });\n\n return useTransitionBoundary(\"Popover.Popup\", isLibrary ? transition : undefined, element);\n}\n\nPopoverPopup.displayName = \"PopoverPopup\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0HA,SAAgB,aAAa,EAC3B,MAAM,WAAW,UACjB,OAAO,YAAY,UACnB,aACA,cACA,YACA,WACA,OACA,UACA,QACA,GAAG,QACiB;CACpB,MAAM,MAAM,kBAAkB,eAAe;CAC7C,MAAM,YAAY,IAAI,SAAS;CAC/B,MAAM,EAAE,QAAQ;CAEhB,sBAAsB,iBAAiB,WAAW,WAAW,YAAY,WAAW;CAEpF,MAAM,EAAE,YAAY,kBAAkB,gBAAgB,KAAK;EACzD,MAAM;EACN;EACA;EACA,YAAY,YAAY,aAAa,KAAA;CACvC,CAAC;CAID,MAAM,YAAY,qBAAqB;EAAE,MAAM;EAAU,OAAO;CAAU,CAAC;CAC3E,MAAM,EAAE,MAAM,UAAU;CACxB,MAAM,MAAM,cAAc,YAAY,UAAU,GAAG;CAEnD,MAAM,QAA2B;EAAE,MAAM,IAAI;EAAW;EAAM;CAAM;CAEpE,MAAM,WAAW,MACf,oBAAC,qBAAD;EAAqB,OAAO;EACzB,UAAA,oBAAoB,kBAAkB,UAAU,CAAC,CAAC;CAChC,CAAA;CAGvB,MAAM,eAAiE;EACrE,IAAI,IAAI;EACR,SAAS;EAGT,MAAM,KAAA;EAEN,cAAc;EACd,mBAAmB,IAAI;EACvB,oBAAoB,IAAI;EAExB,GAAG,UAAU;CACf;CAEA,MAAM,UAAU,UAA8D;EAC5E,gBAAgB;EAChB;EACA;EACA;EAEA,OAAO,UAAU,MAAM,KAAK;EAC5B,UAAU;EAGV,OAAO;GAAE,MAAM;GAAU,GAAG;EAAK;EACjC;EACA;CACF,CAAC;CAED,OAAO,sBAAsB,iBAAiB,YAAY,aAAa,KAAA,GAAW,OAAO;AAC3F;AAEA,aAAa,cAAc"}
|
|
@@ -50,7 +50,7 @@ export interface PopoverRootProps {
|
|
|
50
50
|
* `className` or `style`; `pending` is exposed through `children(state)` and the Trigger.
|
|
51
51
|
*
|
|
52
52
|
* Without `open`, `defaultOpen` and `openChangeAction` the Popover runs in **JS-free mode**: the
|
|
53
|
-
* Trigger is a native `
|
|
53
|
+
* Trigger is a native `popovertarget` invoker and the browser owns everything. With any
|
|
54
54
|
* of them it runs in **library mode**: opening and the closes the user asks a part for are
|
|
55
55
|
* transitions (the Trigger shows `data-pending`, content renders from committed state,
|
|
56
56
|
* `showPopover()` / `hidePopover()` run when the change has committed); dismissals are the
|
|
@@ -9,7 +9,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
9
9
|
* `className` or `style`; `pending` is exposed through `children(state)` and the Trigger.
|
|
10
10
|
*
|
|
11
11
|
* Without `open`, `defaultOpen` and `openChangeAction` the Popover runs in **JS-free mode**: the
|
|
12
|
-
* Trigger is a native `
|
|
12
|
+
* Trigger is a native `popovertarget` invoker and the browser owns everything. With any
|
|
13
13
|
* of them it runs in **library mode**: opening and the closes the user asks a part for are
|
|
14
14
|
* transitions (the Trigger shows `data-pending`, content renders from committed state,
|
|
15
15
|
* `showPopover()` / `hidePopover()` run when the change has committed); dismissals are the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover-root.mjs","names":[],"sources":["../../src/popover/popover-root.tsx"],"sourcesContent":["\"use client\";\nimport type { ReactNode } from \"react\";\nimport type { ActionDetails, ChangeAction, ChangeReason, StateValue } from \"../internal/types.js\";\nimport { popoverDetails, useOverlayRoot } from \"../internal/use-overlay-root.js\";\nimport { resolveStateValue } from \"../internal/use-render.js\";\nimport { PopoverContext } from \"./popover-context.js\";\n\n/** Details passed as the second argument of `openChangeAction`. */\nexport interface PopoverOpenChangeDetails extends ActionDetails {\n /**\n * `\"activate\"`: the user acted on a part: Trigger (open or close), Close, or a foreign invoker\n * (`details.event` is a `CommandEvent` / `ToggleEvent` then).\n * `\"dismiss\"`: the user closed the popover without a part: Escape, Android back, an assistive-\n * technology dismiss gesture, a click outside; or script / another top-layer element hid it.\n * `\"platform\"`: the popover was found open on mount (opened before hydration); `event` is\n * `undefined`.\n */\n readonly reason: ChangeReason;\n}\n\nexport interface PopoverRootState {\n /** Optimistic open state (`false` in JS-free mode). Content rendered from it must not suspend. */\n readonly open: boolean;\n /** An `openChangeAction` dispatched through this Popover is in flight (library mode only). */\n readonly pending: boolean;\n}\n\nexport interface PopoverRootProps {\n /**\n * Controlled open state. `undefined` means uncontrolled (and, with `defaultOpen` and\n * `openChangeAction` also absent, JS-free mode).\n */\n open?: boolean;\n /**\n * Initial open state in uncontrolled library mode. Opens after hydration, never in the server\n * HTML.\n */\n defaultOpen?: boolean;\n /**\n * Awaited for `true` (the popover opens when it resolves and the content has rendered) and for\n * a `false` the user asked a part for (Trigger, Close: the popover hides when it resolves, with\n * a view transition if `transition` is set; a controlled parent that keeps `open` vetoes it).\n * A notification for a dismissal (Escape, click outside: the popover is already hidden; the\n * action runs inside the Root's transition, and a controlled parent that keeps `open` gets it\n * re-opened, which is not a veto). May be a Server Function. Rejections reach the nearest\n * Error Boundary above Root.\n *\n * A `setState` placed after your own `await` is not a Transition update; wrap it in\n * `startTransition` (React limitation).\n */\n openChangeAction?: ChangeAction<boolean, PopoverOpenChangeDetails>;\n children?: StateValue<ReactNode, PopoverRootState>;\n}\n\n/**\n * Owns the ids, the mode, the open state and the context. Renders no DOM, so it has no `ref`,\n * `className` or `style`; `pending` is exposed through `children(state)` and the Trigger.\n *\n * Without `open`, `defaultOpen` and `openChangeAction` the Popover runs in **JS-free mode**: the\n * Trigger is a native `
|
|
1
|
+
{"version":3,"file":"popover-root.mjs","names":[],"sources":["../../src/popover/popover-root.tsx"],"sourcesContent":["\"use client\";\nimport type { ReactNode } from \"react\";\nimport type { ActionDetails, ChangeAction, ChangeReason, StateValue } from \"../internal/types.js\";\nimport { popoverDetails, useOverlayRoot } from \"../internal/use-overlay-root.js\";\nimport { resolveStateValue } from \"../internal/use-render.js\";\nimport { PopoverContext } from \"./popover-context.js\";\n\n/** Details passed as the second argument of `openChangeAction`. */\nexport interface PopoverOpenChangeDetails extends ActionDetails {\n /**\n * `\"activate\"`: the user acted on a part: Trigger (open or close), Close, or a foreign invoker\n * (`details.event` is a `CommandEvent` / `ToggleEvent` then).\n * `\"dismiss\"`: the user closed the popover without a part: Escape, Android back, an assistive-\n * technology dismiss gesture, a click outside; or script / another top-layer element hid it.\n * `\"platform\"`: the popover was found open on mount (opened before hydration); `event` is\n * `undefined`.\n */\n readonly reason: ChangeReason;\n}\n\nexport interface PopoverRootState {\n /** Optimistic open state (`false` in JS-free mode). Content rendered from it must not suspend. */\n readonly open: boolean;\n /** An `openChangeAction` dispatched through this Popover is in flight (library mode only). */\n readonly pending: boolean;\n}\n\nexport interface PopoverRootProps {\n /**\n * Controlled open state. `undefined` means uncontrolled (and, with `defaultOpen` and\n * `openChangeAction` also absent, JS-free mode).\n */\n open?: boolean;\n /**\n * Initial open state in uncontrolled library mode. Opens after hydration, never in the server\n * HTML.\n */\n defaultOpen?: boolean;\n /**\n * Awaited for `true` (the popover opens when it resolves and the content has rendered) and for\n * a `false` the user asked a part for (Trigger, Close: the popover hides when it resolves, with\n * a view transition if `transition` is set; a controlled parent that keeps `open` vetoes it).\n * A notification for a dismissal (Escape, click outside: the popover is already hidden; the\n * action runs inside the Root's transition, and a controlled parent that keeps `open` gets it\n * re-opened, which is not a veto). May be a Server Function. Rejections reach the nearest\n * Error Boundary above Root.\n *\n * A `setState` placed after your own `await` is not a Transition update; wrap it in\n * `startTransition` (React limitation).\n */\n openChangeAction?: ChangeAction<boolean, PopoverOpenChangeDetails>;\n children?: StateValue<ReactNode, PopoverRootState>;\n}\n\n/**\n * Owns the ids, the mode, the open state and the context. Renders no DOM, so it has no `ref`,\n * `className` or `style`; `pending` is exposed through `children(state)` and the Trigger.\n *\n * Without `open`, `defaultOpen` and `openChangeAction` the Popover runs in **JS-free mode**: the\n * Trigger is a native `popovertarget` invoker and the browser owns everything. With any\n * of them it runs in **library mode**: opening and the closes the user asks a part for are\n * transitions (the Trigger shows `data-pending`, content renders from committed state,\n * `showPopover()` / `hidePopover()` run when the change has committed); dismissals are the\n * browser's and `openChangeAction(false)` is a notification.\n */\nexport function PopoverRoot({ open, defaultOpen, openChangeAction, children }: PopoverRootProps) {\n const context = useOverlayRoot<PopoverOpenChangeDetails>({\n component: \"popover\",\n part: \"Popover.Root\",\n open,\n defaultOpen,\n openChangeAction,\n details: popoverDetails,\n });\n\n const state: PopoverRootState = { open: context.optimistic, pending: context.pending };\n\n return <PopoverContext value={context}>{resolveStateValue(children, state)}</PopoverContext>;\n}\n\nPopoverRoot.displayName = \"PopoverRoot\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAiEA,SAAgB,YAAY,EAAE,MAAM,aAAa,kBAAkB,YAA8B;CAC/F,MAAM,UAAU,eAAyC;EACvD,WAAW;EACX,MAAM;EACN;EACA;EACA;EACA,SAAS;CACX,CAAC;CAED,MAAM,QAA0B;EAAE,MAAM,QAAQ;EAAY,SAAS,QAAQ;CAAQ;CAErF,OAAO,oBAAC,gBAAD;EAAgB,OAAO;EAAU,UAAA,kBAAkB,UAAU,KAAK;CAAkB,CAAA;AAC7F;AAEA,YAAY,cAAc"}
|
|
@@ -3,7 +3,7 @@ import { PopoverTriggerHookState } from "../internal/use-popover-trigger.mjs";
|
|
|
3
3
|
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
4
4
|
//#region src/popover/popover-trigger.d.ts
|
|
5
5
|
export type PopoverTriggerState = PopoverTriggerHookState;
|
|
6
|
-
export interface PopoverTriggerProps extends Omit<ComponentPropsWithRef<"button">, "onClick" | "aria-expanded" | "className" | "style" | "children"> {
|
|
6
|
+
export interface PopoverTriggerProps extends Omit<ComponentPropsWithRef<"button">, "onClick" | "aria-expanded" | "commandfor" | "command" | "popoverTarget" | "popoverTargetAction" | "className" | "style" | "children"> {
|
|
7
7
|
/**
|
|
8
8
|
* Never dispatches. Native `disabled` on a `<button>` (no longer an invoker); in library mode
|
|
9
9
|
* with a link or component `render`, `aria-disabled="true"` instead: the element stays
|
|
@@ -21,17 +21,18 @@ export interface PopoverTriggerProps extends Omit<ComponentPropsWithRef<"button"
|
|
|
21
21
|
render?: RenderProp<ComponentPropsWithRef<"button">, PopoverTriggerState>;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
* The toggle: `<button type="button"
|
|
25
|
-
* JS-free mode the browser
|
|
26
|
-
* library mode the click is cancelled (so the
|
|
27
|
-
* Root's transition: an open, or a library-owned close while
|
|
28
|
-
* `data-open` and `data-pending` until the change has landed;
|
|
29
|
-
* popup (in the top layer, #118).
|
|
24
|
+
* The toggle: `<button type="button" popovertarget>`, with no `aria-expanded`: the browser exposes
|
|
25
|
+
* the popover's state on its invoker (#121). In JS-free mode the browser toggles the popover and
|
|
26
|
+
* the Popup keeps `data-open` current. In library mode the click is cancelled (so the toggle does
|
|
27
|
+
* not run) and dispatched through the Root's transition: an open, or a library-owned close while
|
|
28
|
+
* open. The button shows optimistic `data-open` and `data-pending` until the change has landed; a
|
|
29
|
+
* non-button `render` renders `aria-expanded` from the shown popup (in the top layer, #118).
|
|
30
30
|
*
|
|
31
31
|
* Owned keys (conventions 1.2): `type` (on a `<button>` only), `disabled`, `aria-disabled`
|
|
32
|
-
* (library mode, link or component `render`), `
|
|
33
|
-
* `onClick` (library mode), `data-open`, `data-pending`, `data-disabled
|
|
34
|
-
* `aria-controls` pass
|
|
32
|
+
* (library mode, link or component `render`), `popoverTarget`, `aria-expanded`,
|
|
33
|
+
* `onClick` (library mode), `data-open`, `data-pending`, `data-disabled`; `commandfor`,
|
|
34
|
+
* `command` and `popoverTargetAction` (never written; omitted from the props type). `aria-haspopup` and `aria-controls` pass
|
|
35
|
+
* through.
|
|
35
36
|
*/
|
|
36
37
|
export declare function PopoverTrigger({ disabled, className, style, children, render, ...rest }: PopoverTriggerProps): ReactNode;
|
|
37
38
|
export declare namespace PopoverTrigger {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover-trigger.d.mts","names":[],"sources":["../../src/popover/popover-trigger.tsx"],"mappings":";;;;YAQY,sBAAsB;iBAEjB,4BAA4B,KAC3C;;;;;;
|
|
1
|
+
{"version":3,"file":"popover-trigger.d.mts","names":[],"sources":["../../src/popover/popover-trigger.tsx"],"mappings":";;;;YAQY,sBAAsB;iBAEjB,4BAA4B,KAC3C;;;;;;EAgBA;EACA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;;;;EAKjC,SAAS,WAAW,iCAAiC;;;;;;;;;;;;;;;;wBAiBvC,iBACd,UACA,WACA,OACA,UACA,WACG,QACF,sBAAmB;yBAPN"}
|
|
@@ -4,17 +4,18 @@ import { usePopoverContext } from "./popover-context.mjs";
|
|
|
4
4
|
import { usePopoverTrigger } from "../internal/use-popover-trigger.mjs";
|
|
5
5
|
//#region src/popover/popover-trigger.tsx
|
|
6
6
|
/**
|
|
7
|
-
* The toggle: `<button type="button"
|
|
8
|
-
* JS-free mode the browser
|
|
9
|
-
* library mode the click is cancelled (so the
|
|
10
|
-
* Root's transition: an open, or a library-owned close while
|
|
11
|
-
* `data-open` and `data-pending` until the change has landed;
|
|
12
|
-
* popup (in the top layer, #118).
|
|
7
|
+
* The toggle: `<button type="button" popovertarget>`, with no `aria-expanded`: the browser exposes
|
|
8
|
+
* the popover's state on its invoker (#121). In JS-free mode the browser toggles the popover and
|
|
9
|
+
* the Popup keeps `data-open` current. In library mode the click is cancelled (so the toggle does
|
|
10
|
+
* not run) and dispatched through the Root's transition: an open, or a library-owned close while
|
|
11
|
+
* open. The button shows optimistic `data-open` and `data-pending` until the change has landed; a
|
|
12
|
+
* non-button `render` renders `aria-expanded` from the shown popup (in the top layer, #118).
|
|
13
13
|
*
|
|
14
14
|
* Owned keys (conventions 1.2): `type` (on a `<button>` only), `disabled`, `aria-disabled`
|
|
15
|
-
* (library mode, link or component `render`), `
|
|
16
|
-
* `onClick` (library mode), `data-open`, `data-pending`, `data-disabled
|
|
17
|
-
* `aria-controls` pass
|
|
15
|
+
* (library mode, link or component `render`), `popoverTarget`, `aria-expanded`,
|
|
16
|
+
* `onClick` (library mode), `data-open`, `data-pending`, `data-disabled`; `commandfor`,
|
|
17
|
+
* `command` and `popoverTargetAction` (never written; omitted from the props type). `aria-haspopup` and `aria-controls` pass
|
|
18
|
+
* through.
|
|
18
19
|
*/
|
|
19
20
|
function PopoverTrigger({ disabled = false, className, style, children, render, ...rest }) {
|
|
20
21
|
const ctx = usePopoverContext("Popover.Trigger");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover-trigger.mjs","names":[],"sources":["../../src/popover/popover-trigger.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { usePopoverTrigger } from \"../internal/use-popover-trigger.js\";\nimport type { PopoverTriggerHookState } from \"../internal/use-popover-trigger.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { usePopoverContext } from \"./popover-context.js\";\n\nexport type PopoverTriggerState = PopoverTriggerHookState;\n\nexport interface PopoverTriggerProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\"
|
|
1
|
+
{"version":3,"file":"popover-trigger.mjs","names":[],"sources":["../../src/popover/popover-trigger.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { usePopoverTrigger } from \"../internal/use-popover-trigger.js\";\nimport type { PopoverTriggerHookState } from \"../internal/use-popover-trigger.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { usePopoverContext } from \"./popover-context.js\";\n\nexport type PopoverTriggerState = PopoverTriggerHookState;\n\nexport interface PopoverTriggerProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n | \"onClick\"\n | \"aria-expanded\"\n | \"commandfor\"\n | \"command\"\n | \"popoverTarget\"\n | \"popoverTargetAction\"\n | \"className\"\n | \"style\"\n | \"children\"\n> {\n /**\n * Never dispatches. Native `disabled` on a `<button>` (no longer an invoker); in library mode\n * with a link or component `render`, `aria-disabled=\"true\"` instead: the element stays\n * focusable.\n */\n disabled?: boolean;\n className?: StateValue<string | undefined, PopoverTriggerState>;\n style?: StateValue<CSSProperties | undefined, PopoverTriggerState>;\n /** Rendered from optimistic state; must not suspend. */\n children?: StateValue<ReactNode, PopoverTriggerState>;\n /**\n * Should render a `<button>`; another element works only in library mode (click handler), and\n * a press on it while the popup is open is a light dismiss rather than the awaited close.\n */\n render?: RenderProp<ComponentPropsWithRef<\"button\">, PopoverTriggerState>;\n}\n\n/**\n * The toggle: `<button type=\"button\" popovertarget>`, with no `aria-expanded`: the browser exposes\n * the popover's state on its invoker (#121). In JS-free mode the browser toggles the popover and\n * the Popup keeps `data-open` current. In library mode the click is cancelled (so the toggle does\n * not run) and dispatched through the Root's transition: an open, or a library-owned close while\n * open. The button shows optimistic `data-open` and `data-pending` until the change has landed; a\n * non-button `render` renders `aria-expanded` from the shown popup (in the top layer, #118).\n *\n * Owned keys (conventions 1.2): `type` (on a `<button>` only), `disabled`, `aria-disabled`\n * (library mode, link or component `render`), `popoverTarget`, `aria-expanded`,\n * `onClick` (library mode), `data-open`, `data-pending`, `data-disabled`; `commandfor`,\n * `command` and `popoverTargetAction` (never written; omitted from the props type). `aria-haspopup` and `aria-controls` pass\n * through.\n */\nexport function PopoverTrigger({\n disabled = false,\n className,\n style,\n children,\n render,\n ...rest\n}: PopoverTriggerProps) {\n const ctx = usePopoverContext(\"Popover.Trigger\");\n const { state, libraryProps, ref } = usePopoverTrigger(ctx, {\n part: \"Popover.Trigger\",\n disabled,\n render,\n });\n\n return useRender<ComponentPropsWithRef<\"button\">, PopoverTriggerState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps,\n ref,\n });\n}\n\nPopoverTrigger.displayName = \"PopoverTrigger\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqDA,SAAgB,eAAe,EAC7B,WAAW,OACX,WACA,OACA,UACA,QACA,GAAG,QACmB;CACtB,MAAM,MAAM,kBAAkB,iBAAiB;CAC/C,MAAM,EAAE,OAAO,cAAc,QAAQ,kBAAkB,KAAK;EAC1D,MAAM;EACN;EACA;CACF,CAAC;CAED,OAAO,UAAgE;EACrE,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA;CACF,CAAC;AACH;AAEA,eAAe,cAAc"}
|