@gridui/popover 1.1.6 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +2 -2
- package/dist/styles.css +12 -12
- package/docs/catalog.json +10 -2
- package/docs/reference/README.md +8 -0
- package/docs/reference/popover-anchor.md +63 -0
- package/docs/reference/popover-close.md +61 -0
- package/docs/reference/popover-panel.md +169 -0
- package/docs/reference/popover-trigger.md +101 -0
- package/docs/reference/popover.md +57 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -8,3 +8,5 @@ Load styles for any composed dependency used by this family. Applications own ro
|
|
|
8
8
|
See [component ownership](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/component-ownership.md) and [release history](https://github.com/sudo-ui/GridUI-React-Monorepo/tree/main/packages-core/popover/.changeset/history).
|
|
9
9
|
|
|
10
10
|
Surface motion uses `@gridui/overlay`; load `@gridui/overlay/styles.css` after Theme and before this family.
|
|
11
|
+
|
|
12
|
+
[Component reference](docs/reference/README.md) contains focused API pages for each public component.
|
package/dist/index.js
CHANGED
|
@@ -170,7 +170,7 @@ import { cva } from "class-variance-authority";
|
|
|
170
170
|
var menuPanelStyles = cva(cn(
|
|
171
171
|
overlaySurfaceStyles(),
|
|
172
172
|
"gridui-menu-panel",
|
|
173
|
-
"gridui-u-z-(--gridui-z-popover) gridui-u-box-border gridui-u-p-gridui-24 gridui-u-type-supporting gridui-u-overflow-y-auto gridui-u-overscroll-contain gridui-u-w-3xl gridui-u-max-w-[min(calc(100vw-2*var(--gridui-page-gutter)),var(--radix-popover-content-available-width))] gridui-u-max-h-(--radix-popover-content-available-height) gridui-u-rounded-control"
|
|
173
|
+
"gridui-u-popover--z-(--gridui-z-popover) gridui-u-popover--box-border gridui-u-popover--p-gridui-24 gridui-u-popover--type-supporting gridui-u-popover--overflow-y-auto gridui-u-popover--overscroll-contain gridui-u-popover--w-3xl gridui-u-popover--max-w-[min(calc(100vw-2*var(--gridui-page-gutter)),var(--radix-popover-content-available-width))] gridui-u-popover--max-h-(--radix-popover-content-available-height) gridui-u-popover--rounded-control"
|
|
174
174
|
));
|
|
175
175
|
|
|
176
176
|
// src/popover-panel/popover-panel.tsx
|
|
@@ -254,7 +254,7 @@ var PopoverPanel = (props) => {
|
|
|
254
254
|
|
|
255
255
|
// src/popover-trigger/style.ts
|
|
256
256
|
import { cva as cva2 } from "class-variance-authority";
|
|
257
|
-
var popoverTriggerStyles = cva2("gridui-menu-trigger gridui-u-data-[state=open]:bg-surface");
|
|
257
|
+
var popoverTriggerStyles = cva2("gridui-menu-trigger gridui-u-popover--data-[state=open]:bg-surface");
|
|
258
258
|
|
|
259
259
|
// src/popover-trigger/popover-trigger.tsx
|
|
260
260
|
import { Button } from "@gridui/button";
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/shared/context.ts", "../src/popover/hover-intent.ts", "../src/popover/popover.tsx", "../src/popover-anchor/popover-anchor.tsx", "../src/popover-close/popover-close.tsx", "../src/popover-panel/style.ts", "../src/popover-panel/popover-panel.tsx", "../src/popover-trigger/style.ts", "../src/popover-trigger/popover-trigger.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * @author WMXPY\n * @package Popover\n * @namespace Shared\n * @description Context\n */\n\nimport { createContext, type PointerEvent } from \"react\";\n\nexport type NavigationInteraction = {\n readonly hoverOpened: {\n current: boolean;\n };\n readonly enter: (event: PointerEvent<HTMLElement>) => void;\n readonly leave: (event: PointerEvent<HTMLElement>) => void;\n readonly activate: () => void;\n readonly dismiss: () => void;\n};\n\nexport const Interaction = createContext<NavigationInteraction | null>(null);\n", "/**\n * @author WMXPY\n * @package Popover\n * @namespace Popover\n * @description Hover Intent\n */\n\nexport const createHoverIntent = (open: () => void, close: () => void) => {\n let timer: ReturnType<typeof setTimeout> | undefined;\n let dismissed = false;\n const cancel = (): void => {\n clearTimeout(timer);\n timer = undefined;\n };\n return {\n enter(alreadyOpen: boolean): void {\n cancel();\n if (!dismissed && !alreadyOpen) {\n timer = setTimeout(open, 150);\n }\n },\n leave(shouldClose: boolean): void {\n cancel();\n dismissed = false;\n if (shouldClose) {\n timer = setTimeout(close, 250);\n }\n },\n dismiss(): void {\n cancel();\n dismissed = true;\n },\n cancel,\n };\n};\n", "/**\n * @author WMXPY\n * @package Popover\n * @namespace Popover\n * @description Popover\n */\n\nimport { Interaction, type NavigationInteraction } from \"../shared/context\";\nimport { createHoverIntent } from \"./hover-intent\";\nimport { OverlayOpen, useOverlayState } from \"@gridui/overlay\";\nimport * as Primitive from \"@radix-ui/react-popover\";\nimport { type ComponentPropsWithRef, type FC, useEffect, useMemo, useRef } from \"react\";\n\nexport type PopoverProps = ComponentPropsWithRef<typeof Primitive.Root> & {\n readonly hoverEnabled?: boolean;\n};\n\nexport const Popover: FC<PopoverProps> = (props: PopoverProps) => {\n const {\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n hoverEnabled = true,\n ...restProps\n } = props;\n const { open, onOpenChange: change } = useOverlayState({\n open: controlledOpen,\n defaultOpen,\n onOpenChange,\n });\n const hoverOpened = useRef(false);\n const openRef = useRef(open);\n const changeRef = useRef(change);\n const hoverTarget = useRef<HTMLElement | null>(null);\n useEffect(() => {\n openRef.current = open;\n changeRef.current = change;\n }, [\n open,\n change,\n ]);\n const intent = useMemo(() => {\n return createHoverIntent(() => {\n if (!hoverTarget.current?.isConnected || hoverTarget.current.matches(\":disabled, [aria-disabled='true']\")) {\n return;\n }\n hoverOpened.current = true;\n changeRef.current(true);\n }, () => {\n changeRef.current(false);\n });\n }, []);\n useEffect(() => {\n return intent.cancel;\n }, [intent]);\n useEffect(() => {\n if (!hoverEnabled) {\n intent.cancel();\n }\n }, [\n hoverEnabled,\n intent,\n ]);\n useEffect(() => {\n if (!open) {\n intent.cancel();\n }\n }, [\n intent,\n open,\n ]);\n const interaction: NavigationInteraction = {\n hoverOpened,\n enter(event) {\n if (hoverEnabled && event.pointerType === \"mouse\" && !event.currentTarget.matches(\":disabled, [aria-disabled='true']\")\n && window.matchMedia(\"(hover: hover) and (pointer: fine)\").matches) {\n hoverTarget.current = event.currentTarget;\n intent.enter(openRef.current);\n }\n },\n leave(event) {\n const focused = event.currentTarget.contains(document.activeElement);\n intent.leave(hoverOpened.current && !focused);\n },\n activate() {\n intent.cancel();\n hoverOpened.current = false;\n },\n dismiss() {\n intent.dismiss();\n hoverOpened.current = false;\n },\n };\n return (<Interaction.Provider\n value={interaction}\n >\n <OverlayOpen.Provider\n value={open}\n >\n <Primitive.Root\n {...restProps}\n open={open}\n onOpenChange={(next) => {\n if (!next) {\n interaction.dismiss();\n }\n change(next);\n }}\n />\n </OverlayOpen.Provider>\n </Interaction.Provider>);\n};\n", "/**\n * @author WMXPY\n * @package Popover\n * @namespace PopoverAnchor\n * @description Popover Anchor\n */\n\nimport * as Primitive from \"@radix-ui/react-popover\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type PopoverAnchorProps = ComponentPropsWithRef<typeof Primitive.Anchor>;\n\nexport const PopoverAnchor: FC<PopoverAnchorProps> = (props: PopoverAnchorProps) => {\n return (<Primitive.Anchor\n {...props}\n />);\n};\n", "/**\n * @author WMXPY\n * @package Popover\n * @namespace PopoverClose\n * @description Popover Close\n */\n\nimport * as Primitive from \"@radix-ui/react-popover\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type PopoverCloseProps = ComponentPropsWithRef<typeof Primitive.Close>;\n\nexport const PopoverClose: FC<PopoverCloseProps> = (props: PopoverCloseProps) => {\n return (<Primitive.Close\n {...props}\n />);\n};\n", "/**\n * @author WMXPY\n * @package Popover\n * @namespace PopoverPanel\n * @description Style\n */\n\nimport { overlaySurfaceStyles } from \"@gridui/overlay\";\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const menuPanelStyles = cva(cn(\n overlaySurfaceStyles(),\n \"gridui-menu-panel\",\n \"gridui-u-z-(--gridui-z-popover) gridui-u-box-border gridui-u-p-gridui-24 gridui-u-type-supporting gridui-u-overflow-y-auto gridui-u-overscroll-contain gridui-u-w-3xl gridui-u-max-w-[min(calc(100vw-2*var(--gridui-page-gutter)),var(--radix-popover-content-available-width))] gridui-u-max-h-(--radix-popover-content-available-height) gridui-u-rounded-control\",\n));\n", "/**\n * @author WMXPY\n * @package Popover\n * @namespace PopoverPanel\n * @description Popover Panel\n */\n\nimport { Interaction } from \"../shared/context\";\nimport { menuPanelStyles } from \"./style\";\nimport { interactionLayerProps, RetainedLayer, useInteractionOutline, useScrollbars } from \"@gridui/overlay\";\nimport { cn } from \"@gridui/style-utils\";\nimport * as Primitive from \"@radix-ui/react-popover\";\nimport { type ComponentPropsWithRef, type FC, useContext } from \"react\";\n\nexport type PopoverPanelProps = ComponentPropsWithRef<typeof Primitive.Content>;\n\nexport const PopoverPanel: FC<PopoverPanelProps> = (props: PopoverPanelProps) => {\n const {\n className,\n ref: forwardedRef,\n forceMount,\n align = \"start\",\n sideOffset = 8,\n collisionPadding = 16,\n onPointerEnter,\n onPointerLeave,\n onOpenAutoFocus,\n onCloseAutoFocus,\n onEscapeKeyDown,\n ...restProps\n } = props;\n const interaction = useContext(Interaction);\n const scrollbarRef = useScrollbars({ ref: forwardedRef });\n const ref = useInteractionOutline({\n ref: scrollbarRef,\n selector: 'a[href], button, input, select, textarea, summary, [tabindex], [role=\"option\"]',\n });\n const content = (<Primitive.Content\n {...interactionLayerProps}\n {...restProps}\n ref={ref}\n forceMount={forceMount}\n align={align}\n sideOffset={sideOffset}\n collisionPadding={collisionPadding}\n className={cn(menuPanelStyles(), className)}\n onPointerEnter={(event) => {\n onPointerEnter?.(event);\n if (!event.defaultPrevented) {\n interaction?.enter(event);\n }\n }}\n onPointerLeave={(event) => {\n onPointerLeave?.(event);\n if (!event.defaultPrevented) {\n interaction?.leave(event);\n }\n }}\n onOpenAutoFocus={(event) => {\n onOpenAutoFocus?.(event);\n if (interaction?.hoverOpened.current) {\n event.preventDefault();\n }\n }}\n onCloseAutoFocus={(event) => {\n onCloseAutoFocus?.(event);\n if (interaction?.hoverOpened.current) {\n event.preventDefault();\n }\n }}\n onEscapeKeyDown={(event) => {\n onEscapeKeyDown?.(event);\n if (!event.defaultPrevented) {\n interaction?.dismiss();\n }\n }}\n />);\n return (<Primitive.Portal\n forceMount={forceMount}\n >\n {forceMount ? (<RetainedLayer>\n {content}\n </RetainedLayer>) : content}\n </Primitive.Portal>);\n};\n", "/**\n * @author WMXPY\n * @package Popover\n * @namespace PopoverTrigger\n * @description Style\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const popoverTriggerStyles = cva(\"gridui-menu-trigger gridui-u-data-[state=open]:bg-surface\");\n", "/**\n * @author WMXPY\n * @package Popover\n * @namespace PopoverTrigger\n * @description Popover Trigger\n */\n\nimport { Interaction } from \"../shared/context\";\nimport { popoverTriggerStyles } from \"./style\";\nimport { Button, type ButtonProps } from \"@gridui/button\";\nimport { cn } from \"@gridui/style-utils\";\nimport * as Primitive from \"@radix-ui/react-popover\";\nimport { type FC, useContext } from \"react\";\n\nexport type PopoverTriggerProps = ButtonProps;\n\nexport const PopoverTrigger: FC<PopoverTriggerProps> = (props: PopoverTriggerProps) => {\n const {\n size = \"small\",\n className,\n onPointerEnter,\n onPointerLeave,\n onPointerDown,\n onKeyDown,\n ...restProps\n } = props;\n const interaction = useContext(Interaction);\n const buttonProps: ButtonProps = restProps.variant === undefined ? {\n ...restProps,\n variant: \"quiet\",\n } : restProps;\n return (<Primitive.Trigger\n asChild\n >\n <Button\n {...buttonProps}\n size={size}\n className={cn(popoverTriggerStyles(), className)}\n onPointerEnter={(event) => {\n onPointerEnter?.(event);\n if (!restProps.disabled\n && !restProps.loading\n && !event.defaultPrevented) {\n interaction?.enter(event);\n }\n }}\n onPointerLeave={(event) => {\n onPointerLeave?.(event);\n if (!event.defaultPrevented) {\n interaction?.leave(event);\n }\n }}\n onPointerDown={(event) => {\n onPointerDown?.(event);\n if (!event.defaultPrevented) {\n interaction?.activate();\n }\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (!event.defaultPrevented && (event.key === \"Enter\" || event.key === \" \")) {\n interaction?.activate();\n }\n }}\n />\n </Primitive.Trigger>);\n};\n"],
|
|
5
|
-
"mappings": ";AAOA,SAAS,qBAAwC;AAY1C,IAAM,cAAc,cAA4C,IAAI;;;ACZpE,IAAM,oBAAoB,CAAC,MAAkB,UAAsB;AACtE,MAAI;AACJ,MAAI,YAAY;AAChB,QAAM,SAAS,MAAY;AACvB,iBAAa,KAAK;AAClB,YAAQ;AAAA,EACZ;AACA,SAAO;AAAA,IACH,MAAM,aAA4B;AAC9B,aAAO;AACP,UAAI,CAAC,aAAa,CAAC,aAAa;AAC5B,gBAAQ,WAAW,MAAM,GAAG;AAAA,MAChC;AAAA,IACJ;AAAA,IACA,MAAM,aAA4B;AAC9B,aAAO;AACP,kBAAY;AACZ,UAAI,aAAa;AACb,gBAAQ,WAAW,OAAO,GAAG;AAAA,MACjC;AAAA,IACJ;AAAA,IACA,UAAgB;AACZ,aAAO;AACP,kBAAY;AAAA,IAChB;AAAA,IACA;AAAA,EACJ;AACJ;;;ACzBA,SAAS,aAAa,uBAAuB;AAC7C,YAAY,eAAe;AAC3B,SAA8C,WAAW,SAAS,cAAc;AAwFpE;AAlFL,IAAM,UAA4B,CAAC,UAAwB;AAC9D,QAAM;AAAA,IACF,MAAM;AAAA,IACN,cAAc;AAAA,IACd;AAAA,IACA,eAAe;AAAA,IACf,GAAG;AAAA,EACP,IAAI;AACJ,QAAM,EAAE,MAAM,cAAc,OAAO,IAAI,gBAAgB;AAAA,IACnD,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACJ,CAAC;AACD,QAAM,cAAc,OAAO,KAAK;AAChC,QAAM,UAAU,OAAO,IAAI;AAC3B,QAAM,YAAY,OAAO,MAAM;AAC/B,QAAM,cAAc,O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popover\n * @namespace Shared\n * @description Context\n */\n\nimport { createContext, type PointerEvent } from \"react\";\n\nexport type NavigationInteraction = {\n readonly hoverOpened: {\n current: boolean;\n };\n readonly enter: (event: PointerEvent<HTMLElement>) => void;\n readonly leave: (event: PointerEvent<HTMLElement>) => void;\n readonly activate: () => void;\n readonly dismiss: () => void;\n};\n\nexport const Interaction = createContext<NavigationInteraction | null>(null);\n", "/**\n * @author WMXPY\n * @package Popover\n * @namespace Popover\n * @description Hover Intent\n */\n\nexport const createHoverIntent = (open: () => void, close: () => void) => {\n let timer: ReturnType<typeof setTimeout> | undefined;\n let dismissed = false;\n const cancel = (): void => {\n clearTimeout(timer);\n timer = undefined;\n };\n return {\n enter(alreadyOpen: boolean): void {\n cancel();\n if (!dismissed && !alreadyOpen) {\n timer = setTimeout(open, 150);\n }\n },\n leave(shouldClose: boolean): void {\n cancel();\n dismissed = false;\n if (shouldClose) {\n timer = setTimeout(close, 250);\n }\n },\n dismiss(): void {\n cancel();\n dismissed = true;\n },\n cancel,\n };\n};\n", "/**\n * @author WMXPY\n * @package Popover\n * @namespace Popover\n * @description Popover\n */\n\nimport { Interaction, type NavigationInteraction } from \"../shared/context\";\nimport { createHoverIntent } from \"./hover-intent\";\nimport { OverlayOpen, useOverlayState } from \"@gridui/overlay\";\nimport * as Primitive from \"@radix-ui/react-popover\";\nimport { type ComponentPropsWithRef, type FC, useEffect, useMemo, useRef } from \"react\";\n\nexport type PopoverProps = ComponentPropsWithRef<typeof Primitive.Root> & {\n readonly hoverEnabled?: boolean;\n};\n\nexport const Popover: FC<PopoverProps> = (props: PopoverProps) => {\n const {\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n hoverEnabled = true,\n ...restProps\n } = props;\n const { open, onOpenChange: change } = useOverlayState({\n open: controlledOpen,\n defaultOpen,\n onOpenChange,\n });\n const hoverOpened = useRef(false);\n const openRef = useRef(open);\n const changeRef = useRef(change);\n const hoverTarget = useRef<HTMLElement | null>(null);\n useEffect(() => {\n openRef.current = open;\n changeRef.current = change;\n }, [\n open,\n change,\n ]);\n const intent = useMemo(() => {\n return createHoverIntent(() => {\n if (!hoverTarget.current?.isConnected || hoverTarget.current.matches(\":disabled, [aria-disabled='true']\")) {\n return;\n }\n hoverOpened.current = true;\n changeRef.current(true);\n }, () => {\n changeRef.current(false);\n });\n }, []);\n useEffect(() => {\n return intent.cancel;\n }, [intent]);\n useEffect(() => {\n if (!hoverEnabled) {\n intent.cancel();\n }\n }, [\n hoverEnabled,\n intent,\n ]);\n useEffect(() => {\n if (!open) {\n intent.cancel();\n }\n }, [\n intent,\n open,\n ]);\n const interaction: NavigationInteraction = {\n hoverOpened,\n enter(event) {\n if (hoverEnabled && event.pointerType === \"mouse\" && !event.currentTarget.matches(\":disabled, [aria-disabled='true']\")\n && window.matchMedia(\"(hover: hover) and (pointer: fine)\").matches) {\n hoverTarget.current = event.currentTarget;\n intent.enter(openRef.current);\n }\n },\n leave(event) {\n const focused = event.currentTarget.contains(document.activeElement);\n intent.leave(hoverOpened.current && !focused);\n },\n activate() {\n intent.cancel();\n hoverOpened.current = false;\n },\n dismiss() {\n intent.dismiss();\n hoverOpened.current = false;\n },\n };\n return (<Interaction.Provider\n value={interaction}\n >\n <OverlayOpen.Provider\n value={open}\n >\n <Primitive.Root\n {...restProps}\n open={open}\n onOpenChange={(next) => {\n if (!next) {\n interaction.dismiss();\n }\n change(next);\n }}\n />\n </OverlayOpen.Provider>\n </Interaction.Provider>);\n};\n", "/**\n * @author WMXPY\n * @package Popover\n * @namespace PopoverAnchor\n * @description Popover Anchor\n */\n\nimport * as Primitive from \"@radix-ui/react-popover\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type PopoverAnchorProps = ComponentPropsWithRef<typeof Primitive.Anchor>;\n\nexport const PopoverAnchor: FC<PopoverAnchorProps> = (props: PopoverAnchorProps) => {\n return (<Primitive.Anchor\n {...props}\n />);\n};\n", "/**\n * @author WMXPY\n * @package Popover\n * @namespace PopoverClose\n * @description Popover Close\n */\n\nimport * as Primitive from \"@radix-ui/react-popover\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type PopoverCloseProps = ComponentPropsWithRef<typeof Primitive.Close>;\n\nexport const PopoverClose: FC<PopoverCloseProps> = (props: PopoverCloseProps) => {\n return (<Primitive.Close\n {...props}\n />);\n};\n", "/**\n * @author WMXPY\n * @package Popover\n * @namespace PopoverPanel\n * @description Style\n */\n\nimport { overlaySurfaceStyles } from \"@gridui/overlay\";\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const menuPanelStyles = cva(cn(\n overlaySurfaceStyles(),\n \"gridui-menu-panel\",\n \"gridui-u-popover--z-(--gridui-z-popover) gridui-u-popover--box-border gridui-u-popover--p-gridui-24 gridui-u-popover--type-supporting gridui-u-popover--overflow-y-auto gridui-u-popover--overscroll-contain gridui-u-popover--w-3xl gridui-u-popover--max-w-[min(calc(100vw-2*var(--gridui-page-gutter)),var(--radix-popover-content-available-width))] gridui-u-popover--max-h-(--radix-popover-content-available-height) gridui-u-popover--rounded-control\",\n));\n", "/**\n * @author WMXPY\n * @package Popover\n * @namespace PopoverPanel\n * @description Popover Panel\n */\n\nimport { Interaction } from \"../shared/context\";\nimport { menuPanelStyles } from \"./style\";\nimport { interactionLayerProps, RetainedLayer, useInteractionOutline, useScrollbars } from \"@gridui/overlay\";\nimport { cn } from \"@gridui/style-utils\";\nimport * as Primitive from \"@radix-ui/react-popover\";\nimport { type ComponentPropsWithRef, type FC, useContext } from \"react\";\n\nexport type PopoverPanelProps = ComponentPropsWithRef<typeof Primitive.Content>;\n\nexport const PopoverPanel: FC<PopoverPanelProps> = (props: PopoverPanelProps) => {\n const {\n className,\n ref: forwardedRef,\n forceMount,\n align = \"start\",\n sideOffset = 8,\n collisionPadding = 16,\n onPointerEnter,\n onPointerLeave,\n onOpenAutoFocus,\n onCloseAutoFocus,\n onEscapeKeyDown,\n ...restProps\n } = props;\n const interaction = useContext(Interaction);\n const scrollbarRef = useScrollbars({ ref: forwardedRef });\n const ref = useInteractionOutline({\n ref: scrollbarRef,\n selector: 'a[href], button, input, select, textarea, summary, [tabindex], [role=\"option\"]',\n });\n const content = (<Primitive.Content\n {...interactionLayerProps}\n {...restProps}\n ref={ref}\n forceMount={forceMount}\n align={align}\n sideOffset={sideOffset}\n collisionPadding={collisionPadding}\n className={cn(menuPanelStyles(), className)}\n onPointerEnter={(event) => {\n onPointerEnter?.(event);\n if (!event.defaultPrevented) {\n interaction?.enter(event);\n }\n }}\n onPointerLeave={(event) => {\n onPointerLeave?.(event);\n if (!event.defaultPrevented) {\n interaction?.leave(event);\n }\n }}\n onOpenAutoFocus={(event) => {\n onOpenAutoFocus?.(event);\n if (interaction?.hoverOpened.current) {\n event.preventDefault();\n }\n }}\n onCloseAutoFocus={(event) => {\n onCloseAutoFocus?.(event);\n if (interaction?.hoverOpened.current) {\n event.preventDefault();\n }\n }}\n onEscapeKeyDown={(event) => {\n onEscapeKeyDown?.(event);\n if (!event.defaultPrevented) {\n interaction?.dismiss();\n }\n }}\n />);\n return (<Primitive.Portal\n forceMount={forceMount}\n >\n {forceMount ? (<RetainedLayer>\n {content}\n </RetainedLayer>) : content}\n </Primitive.Portal>);\n};\n", "/**\n * @author WMXPY\n * @package Popover\n * @namespace PopoverTrigger\n * @description Style\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const popoverTriggerStyles = cva(\"gridui-menu-trigger gridui-u-popover--data-[state=open]:bg-surface\");\n", "/**\n * @author WMXPY\n * @package Popover\n * @namespace PopoverTrigger\n * @description Popover Trigger\n */\n\nimport { Interaction } from \"../shared/context\";\nimport { popoverTriggerStyles } from \"./style\";\nimport { Button, type ButtonProps } from \"@gridui/button\";\nimport { cn } from \"@gridui/style-utils\";\nimport * as Primitive from \"@radix-ui/react-popover\";\nimport { type FC, useContext } from \"react\";\n\nexport type PopoverTriggerProps = ButtonProps;\n\nexport const PopoverTrigger: FC<PopoverTriggerProps> = (props: PopoverTriggerProps) => {\n const {\n size = \"small\",\n className,\n onPointerEnter,\n onPointerLeave,\n onPointerDown,\n onKeyDown,\n ...restProps\n } = props;\n const interaction = useContext(Interaction);\n const buttonProps: ButtonProps = restProps.variant === undefined ? {\n ...restProps,\n variant: \"quiet\",\n } : restProps;\n return (<Primitive.Trigger\n asChild\n >\n <Button\n {...buttonProps}\n size={size}\n className={cn(popoverTriggerStyles(), className)}\n onPointerEnter={(event) => {\n onPointerEnter?.(event);\n if (!restProps.disabled\n && !restProps.loading\n && !event.defaultPrevented) {\n interaction?.enter(event);\n }\n }}\n onPointerLeave={(event) => {\n onPointerLeave?.(event);\n if (!event.defaultPrevented) {\n interaction?.leave(event);\n }\n }}\n onPointerDown={(event) => {\n onPointerDown?.(event);\n if (!event.defaultPrevented) {\n interaction?.activate();\n }\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (!event.defaultPrevented && (event.key === \"Enter\" || event.key === \" \")) {\n interaction?.activate();\n }\n }}\n />\n </Primitive.Trigger>);\n};\n"],
|
|
5
|
+
"mappings": ";AAOA,SAAS,qBAAwC;AAY1C,IAAM,cAAc,cAA4C,IAAI;;;ACZpE,IAAM,oBAAoB,CAAC,MAAkB,UAAsB;AACtE,MAAI;AACJ,MAAI,YAAY;AAChB,QAAM,SAAS,MAAY;AACvB,iBAAa,KAAK;AAClB,YAAQ;AAAA,EACZ;AACA,SAAO;AAAA,IACH,MAAM,aAA4B;AAC9B,aAAO;AACP,UAAI,CAAC,aAAa,CAAC,aAAa;AAC5B,gBAAQ,WAAW,MAAM,GAAG;AAAA,MAChC;AAAA,IACJ;AAAA,IACA,MAAM,aAA4B;AAC9B,aAAO;AACP,kBAAY;AACZ,UAAI,aAAa;AACb,gBAAQ,WAAW,OAAO,GAAG;AAAA,MACjC;AAAA,IACJ;AAAA,IACA,UAAgB;AACZ,aAAO;AACP,kBAAY;AAAA,IAChB;AAAA,IACA;AAAA,EACJ;AACJ;;;ACzBA,SAAS,aAAa,uBAAuB;AAC7C,Y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A,YAC5B;AAAA,UACJ;AAAA,UACA,eAAe,CAAC,UAAU;AACtB,4BAAgB,KAAK;AACrB,gBAAI,CAAC,MAAM,kBAAkB;AACzB,2BAAa,SAAS;AAAA,YAC1B;AAAA,UACJ;AAAA,UACA,WAAW,CAAC,UAAU;AAClB,wBAAY,KAAK;AACjB,gBAAI,CAAC,MAAM,qBAAqB,MAAM,QAAQ,WAAW,MAAM,QAAQ,MAAM;AACzE,2BAAa,SAAS;AAAA,YAC1B;AAAA,UACJ;AAAA;AAAA,MACJ;AAAA;AAAA,EACJ;AACJ;",
|
|
6
6
|
"names": ["Primitive", "jsx", "Primitive", "jsx", "cn", "Primitive", "jsx", "cva", "cn", "Primitive", "useContext", "jsx"]
|
|
7
7
|
}
|
package/dist/styles.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! tailwindcss v4.3.
|
|
1
|
+
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
|
|
2
2
|
@layer theme, base, components, utilities;
|
|
3
3
|
@layer theme {
|
|
4
4
|
:root, :host {
|
|
@@ -6,38 +6,38 @@
|
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
@layer utilities {
|
|
9
|
-
.gridui-u-z-\(--gridui-z-popover\) {
|
|
9
|
+
.gridui-u-popover--z-\(--gridui-z-popover\) {
|
|
10
10
|
z-index: var(--gridui-z-popover);
|
|
11
11
|
}
|
|
12
|
-
.gridui-u-box-border {
|
|
12
|
+
.gridui-u-popover--box-border {
|
|
13
13
|
box-sizing: border-box;
|
|
14
14
|
}
|
|
15
|
-
.gridui-u-max-h-\(--radix-popover-content-available-height\) {
|
|
15
|
+
.gridui-u-popover--max-h-\(--radix-popover-content-available-height\) {
|
|
16
16
|
max-height: var(--radix-popover-content-available-height);
|
|
17
17
|
}
|
|
18
|
-
.gridui-u-w-3xl {
|
|
18
|
+
.gridui-u-popover--w-3xl {
|
|
19
19
|
width: var(--container-3xl);
|
|
20
20
|
}
|
|
21
|
-
.gridui-u-max-w-\[min\(calc\(100vw-2\*var\(--gridui-page-gutter\)\)\,var\(--radix-popover-content-available-width\)\)\] {
|
|
21
|
+
.gridui-u-popover--max-w-\[min\(calc\(100vw-2\*var\(--gridui-page-gutter\)\)\,var\(--radix-popover-content-available-width\)\)\] {
|
|
22
22
|
max-width: min(calc(100vw - 2 * var(--gridui-page-gutter)), var(--radix-popover-content-available-width));
|
|
23
23
|
}
|
|
24
|
-
.gridui-u-overflow-y-auto {
|
|
24
|
+
.gridui-u-popover--overflow-y-auto {
|
|
25
25
|
overflow-y: auto;
|
|
26
26
|
}
|
|
27
|
-
.gridui-u-overscroll-contain {
|
|
27
|
+
.gridui-u-popover--overscroll-contain {
|
|
28
28
|
overscroll-behavior: contain;
|
|
29
29
|
}
|
|
30
|
-
.gridui-u-rounded-control {
|
|
30
|
+
.gridui-u-popover--rounded-control {
|
|
31
31
|
border-radius: var(--gridui-control-radius);
|
|
32
32
|
}
|
|
33
|
-
.gridui-u-p-gridui-24 {
|
|
33
|
+
.gridui-u-popover--p-gridui-24 {
|
|
34
34
|
padding: var(--gridui-space-24);
|
|
35
35
|
}
|
|
36
|
-
.gridui-u-type-supporting {
|
|
36
|
+
.gridui-u-popover--type-supporting {
|
|
37
37
|
font: var(--gridui-type-supporting);
|
|
38
38
|
letter-spacing: normal;
|
|
39
39
|
}
|
|
40
|
-
.gridui-u-data-\[state\=open\]\:bg-surface[data-state="open"] {
|
|
40
|
+
.gridui-u-popover--data-\[state\=open\]\:bg-surface[data-state="open"] {
|
|
41
41
|
background-color: var(--gridui-surface);
|
|
42
42
|
}
|
|
43
43
|
}
|
package/docs/catalog.json
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"name": "@gridui/popover",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.8",
|
|
5
5
|
"category": "core",
|
|
6
6
|
"description": "GridUI React popover",
|
|
7
7
|
"usage": "Surface motion uses `@gridui/overlay`; load `@gridui/overlay/styles.css` after Theme and before this family.",
|
|
8
8
|
"documentation": [
|
|
9
|
-
"README.md"
|
|
9
|
+
"README.md",
|
|
10
|
+
"docs/reference/README.md",
|
|
11
|
+
"docs/reference/popover-anchor.md",
|
|
12
|
+
"docs/reference/popover-close.md",
|
|
13
|
+
"docs/reference/popover-panel.md",
|
|
14
|
+
"docs/reference/popover-trigger.md",
|
|
15
|
+
"docs/reference/popover.md"
|
|
10
16
|
],
|
|
11
17
|
"exports": [
|
|
12
18
|
{
|
|
@@ -67,6 +73,8 @@
|
|
|
67
73
|
"@gridui/popover/styles.css"
|
|
68
74
|
],
|
|
69
75
|
"examples": [
|
|
76
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/popover/stories/contextual-panels.mdx",
|
|
77
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/popover/stories/hover-panels.mdx",
|
|
70
78
|
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/popover/stories/popover.stories.tsx"
|
|
71
79
|
]
|
|
72
80
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
|
|
2
|
+
# PopoverAnchor
|
|
3
|
+
|
|
4
|
+
Public PopoverAnchor component from @gridui/popover. See the package guide for its composition contract.
|
|
5
|
+
|
|
6
|
+
Import from ``@gridui/popover`` and load Theme before this family's stylesheet.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { PopoverAnchor } from "@gridui/popover";
|
|
10
|
+
import "@gridui/theme/styles.css";
|
|
11
|
+
import "@gridui/popover/styles.css";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/popover/README.md) for shared behavior and stylesheet dependencies.
|
|
15
|
+
|
|
16
|
+
## API
|
|
17
|
+
|
|
18
|
+
The public Props type is the source of these signatures. Defaults below are explicit implementation defaults; story presets are separate. Native attributes remain available through the exported Props type.
|
|
19
|
+
|
|
20
|
+
### children
|
|
21
|
+
|
|
22
|
+
``ReactNode`` · Optional
|
|
23
|
+
|
|
24
|
+
Content rendered inside the component.
|
|
25
|
+
|
|
26
|
+
### onFocus
|
|
27
|
+
|
|
28
|
+
``(event: FocusEvent<HTMLDivElement, Element>): void`` · Optional
|
|
29
|
+
|
|
30
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
31
|
+
|
|
32
|
+
### onBlur
|
|
33
|
+
|
|
34
|
+
``(event: FocusEvent<HTMLDivElement, Element>): void`` · Optional
|
|
35
|
+
|
|
36
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
37
|
+
|
|
38
|
+
### onChange
|
|
39
|
+
|
|
40
|
+
``(event: ChangeEvent<HTMLDivElement, Element>): void`` · Optional
|
|
41
|
+
|
|
42
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
43
|
+
|
|
44
|
+
### onSubmit
|
|
45
|
+
|
|
46
|
+
``(event: SubmitEvent<HTMLDivElement>): void`` · Optional
|
|
47
|
+
|
|
48
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
49
|
+
|
|
50
|
+
### onClick
|
|
51
|
+
|
|
52
|
+
``(event: MouseEvent<HTMLDivElement, MouseEvent>): void`` · Optional
|
|
53
|
+
|
|
54
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
55
|
+
|
|
56
|
+
### asChild
|
|
57
|
+
|
|
58
|
+
``boolean | undefined`` · Optional
|
|
59
|
+
|
|
60
|
+
### virtualRef
|
|
61
|
+
|
|
62
|
+
``RefObject<Measurable | null> | undefined`` · Optional
|
|
63
|
+
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
|
|
2
|
+
# PopoverClose
|
|
3
|
+
|
|
4
|
+
Compose PopoverClose with Popover inside the same @gridui/popover component family.
|
|
5
|
+
|
|
6
|
+
Import from ``@gridui/popover`` and load Theme before this family's stylesheet.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { PopoverClose } from "@gridui/popover";
|
|
10
|
+
import "@gridui/theme/styles.css";
|
|
11
|
+
import "@gridui/popover/styles.css";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/popover/README.md) for shared behavior and stylesheet dependencies.
|
|
15
|
+
|
|
16
|
+
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/popover/stories/popover.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
|
|
17
|
+
|
|
18
|
+
## API
|
|
19
|
+
|
|
20
|
+
The public Props type is the source of these signatures. Defaults below are explicit implementation defaults; story presets are separate. Native attributes remain available through the exported Props type.
|
|
21
|
+
|
|
22
|
+
### children
|
|
23
|
+
|
|
24
|
+
``ReactNode`` · Optional
|
|
25
|
+
|
|
26
|
+
Content rendered inside the component.
|
|
27
|
+
|
|
28
|
+
### onFocus
|
|
29
|
+
|
|
30
|
+
``(event: FocusEvent<HTMLButtonElement, Element>): void`` · Optional
|
|
31
|
+
|
|
32
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
33
|
+
|
|
34
|
+
### onBlur
|
|
35
|
+
|
|
36
|
+
``(event: FocusEvent<HTMLButtonElement, Element>): void`` · Optional
|
|
37
|
+
|
|
38
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
39
|
+
|
|
40
|
+
### onChange
|
|
41
|
+
|
|
42
|
+
``(event: ChangeEvent<HTMLButtonElement, Element>): void`` · Optional
|
|
43
|
+
|
|
44
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
45
|
+
|
|
46
|
+
### onSubmit
|
|
47
|
+
|
|
48
|
+
``(event: SubmitEvent<HTMLButtonElement>): void`` · Optional
|
|
49
|
+
|
|
50
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
51
|
+
|
|
52
|
+
### onClick
|
|
53
|
+
|
|
54
|
+
``(event: MouseEvent<HTMLButtonElement, MouseEvent>): void`` · Optional
|
|
55
|
+
|
|
56
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
57
|
+
|
|
58
|
+
### asChild
|
|
59
|
+
|
|
60
|
+
``boolean | undefined`` · Optional
|
|
61
|
+
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
<!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
|
|
2
|
+
# PopoverPanel
|
|
3
|
+
|
|
4
|
+
Compose PopoverPanel with Popover inside the same @gridui/popover component family.
|
|
5
|
+
|
|
6
|
+
Import from ``@gridui/popover`` and load Theme before this family's stylesheet.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { PopoverPanel } from "@gridui/popover";
|
|
10
|
+
import "@gridui/theme/styles.css";
|
|
11
|
+
import "@gridui/popover/styles.css";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/popover/README.md) for shared behavior and stylesheet dependencies.
|
|
15
|
+
|
|
16
|
+
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/popover/stories/popover.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
|
|
17
|
+
|
|
18
|
+
## API
|
|
19
|
+
|
|
20
|
+
The public Props type is the source of these signatures. Defaults below are explicit implementation defaults; story presets are separate. Native attributes remain available through the exported Props type.
|
|
21
|
+
|
|
22
|
+
### forceMount
|
|
23
|
+
|
|
24
|
+
``true | undefined`` · Optional
|
|
25
|
+
|
|
26
|
+
Used to force mounting when more control is needed. Useful when
|
|
27
|
+
controlling animation with React animation libraries.
|
|
28
|
+
|
|
29
|
+
### children
|
|
30
|
+
|
|
31
|
+
``ReactNode`` · Optional
|
|
32
|
+
|
|
33
|
+
Content rendered inside the component.
|
|
34
|
+
|
|
35
|
+
### onFocus
|
|
36
|
+
|
|
37
|
+
``(event: FocusEvent<HTMLDivElement, Element>): void`` · Optional
|
|
38
|
+
|
|
39
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
40
|
+
|
|
41
|
+
### onBlur
|
|
42
|
+
|
|
43
|
+
``(event: FocusEvent<HTMLDivElement, Element>): void`` · Optional
|
|
44
|
+
|
|
45
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
46
|
+
|
|
47
|
+
### onChange
|
|
48
|
+
|
|
49
|
+
``(event: ChangeEvent<HTMLDivElement, Element>): void`` · Optional
|
|
50
|
+
|
|
51
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
52
|
+
|
|
53
|
+
### onSubmit
|
|
54
|
+
|
|
55
|
+
``(event: SubmitEvent<HTMLDivElement>): void`` · Optional
|
|
56
|
+
|
|
57
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
58
|
+
|
|
59
|
+
### onClick
|
|
60
|
+
|
|
61
|
+
``(event: MouseEvent<HTMLDivElement, MouseEvent>): void`` · Optional
|
|
62
|
+
|
|
63
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
64
|
+
|
|
65
|
+
### asChild
|
|
66
|
+
|
|
67
|
+
``boolean | undefined`` · Optional
|
|
68
|
+
|
|
69
|
+
### deferPointerDownOutside
|
|
70
|
+
|
|
71
|
+
``boolean | undefined`` · Optional
|
|
72
|
+
|
|
73
|
+
When `true`, a `'pointerdown'` event outside of the layered element will
|
|
74
|
+
wait for the interaction's click event before dispatching, allowing
|
|
75
|
+
third-party code to stop propagation of later events and cancel dismissal.
|
|
76
|
+
|
|
77
|
+
### onEscapeKeyDown
|
|
78
|
+
|
|
79
|
+
``(event: KeyboardEvent): void`` · Optional
|
|
80
|
+
|
|
81
|
+
Event handler called when the escape key is down.
|
|
82
|
+
Can be prevented.
|
|
83
|
+
|
|
84
|
+
### onPointerDownOutside
|
|
85
|
+
|
|
86
|
+
``(event: CustomEvent<{ originalEvent: PointerEvent; }>): void`` · Optional
|
|
87
|
+
|
|
88
|
+
Event handler called when the a `pointerdown` event happens outside of the `DismissableLayer`.
|
|
89
|
+
Can be prevented.
|
|
90
|
+
|
|
91
|
+
### onFocusOutside
|
|
92
|
+
|
|
93
|
+
``(event: CustomEvent<{ originalEvent: FocusEvent; }>): void`` · Optional
|
|
94
|
+
|
|
95
|
+
Event handler called when the focus moves outside of the `DismissableLayer`.
|
|
96
|
+
Can be prevented.
|
|
97
|
+
|
|
98
|
+
### onInteractOutside
|
|
99
|
+
|
|
100
|
+
``(event: CustomEvent<{ originalEvent: PointerEvent; }> | CustomEvent<{ originalEvent: FocusEvent; }>): void`` · Optional
|
|
101
|
+
|
|
102
|
+
Event handler called when an interaction happens outside the `DismissableLayer`.
|
|
103
|
+
Specifically, when a `pointerdown` event happens outside or focus moves outside of it.
|
|
104
|
+
Can be prevented.
|
|
105
|
+
|
|
106
|
+
### onOpenAutoFocus
|
|
107
|
+
|
|
108
|
+
``(event: Event): void`` · Optional
|
|
109
|
+
|
|
110
|
+
Event handler called when auto-focusing on open.
|
|
111
|
+
Can be prevented.
|
|
112
|
+
|
|
113
|
+
### onCloseAutoFocus
|
|
114
|
+
|
|
115
|
+
``(event: Event): void`` · Optional
|
|
116
|
+
|
|
117
|
+
Event handler called when auto-focusing on close.
|
|
118
|
+
Can be prevented.
|
|
119
|
+
|
|
120
|
+
### side
|
|
121
|
+
|
|
122
|
+
``"left" | "right" | "top" | "bottom" | undefined`` · Optional
|
|
123
|
+
|
|
124
|
+
### sideOffset
|
|
125
|
+
|
|
126
|
+
``number | undefined`` · Optional
|
|
127
|
+
|
|
128
|
+
Default: ``8``
|
|
129
|
+
|
|
130
|
+
### align
|
|
131
|
+
|
|
132
|
+
``"center" | "start" | "end" | undefined`` · Optional
|
|
133
|
+
|
|
134
|
+
Default: ``"start"``
|
|
135
|
+
|
|
136
|
+
### alignOffset
|
|
137
|
+
|
|
138
|
+
``number | undefined`` · Optional
|
|
139
|
+
|
|
140
|
+
### arrowPadding
|
|
141
|
+
|
|
142
|
+
``number | undefined`` · Optional
|
|
143
|
+
|
|
144
|
+
### avoidCollisions
|
|
145
|
+
|
|
146
|
+
``boolean | undefined`` · Optional
|
|
147
|
+
|
|
148
|
+
### collisionBoundary
|
|
149
|
+
|
|
150
|
+
``(Element | null) | (Element | null)[] | undefined`` · Optional
|
|
151
|
+
|
|
152
|
+
### collisionPadding
|
|
153
|
+
|
|
154
|
+
``number | Partial<Record<"left" | "right" | "top" | "bottom", number>> | undefined`` · Optional
|
|
155
|
+
|
|
156
|
+
Default: ``16``
|
|
157
|
+
|
|
158
|
+
### sticky
|
|
159
|
+
|
|
160
|
+
``("partial" | "always") | undefined`` · Optional
|
|
161
|
+
|
|
162
|
+
### hideWhenDetached
|
|
163
|
+
|
|
164
|
+
``boolean | undefined`` · Optional
|
|
165
|
+
|
|
166
|
+
### updatePositionStrategy
|
|
167
|
+
|
|
168
|
+
``("always" | "optimized") | undefined`` · Optional
|
|
169
|
+
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
|
|
2
|
+
# PopoverTrigger
|
|
3
|
+
|
|
4
|
+
Compose PopoverTrigger with Popover inside the same @gridui/popover component family.
|
|
5
|
+
|
|
6
|
+
Import from ``@gridui/popover`` and load Theme before this family's stylesheet.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { PopoverTrigger } from "@gridui/popover";
|
|
10
|
+
import "@gridui/theme/styles.css";
|
|
11
|
+
import "@gridui/popover/styles.css";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/popover/README.md) for shared behavior and stylesheet dependencies.
|
|
15
|
+
|
|
16
|
+
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/popover/stories/popover.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
|
|
17
|
+
|
|
18
|
+
## API
|
|
19
|
+
|
|
20
|
+
The public Props type is the source of these signatures. Defaults below are explicit implementation defaults; story presets are separate. Native attributes remain available through the exported Props type.
|
|
21
|
+
|
|
22
|
+
### children
|
|
23
|
+
|
|
24
|
+
``ReactNode`` · Optional
|
|
25
|
+
|
|
26
|
+
Content rendered inside the component.
|
|
27
|
+
|
|
28
|
+
### onFocus
|
|
29
|
+
|
|
30
|
+
``(event: FocusEvent<HTMLButtonElement, Element>): void`` · Optional
|
|
31
|
+
|
|
32
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
33
|
+
|
|
34
|
+
### onBlur
|
|
35
|
+
|
|
36
|
+
``(event: FocusEvent<HTMLButtonElement, Element>): void`` · Optional
|
|
37
|
+
|
|
38
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
39
|
+
|
|
40
|
+
### onChange
|
|
41
|
+
|
|
42
|
+
``(event: ChangeEvent<HTMLButtonElement, Element>): void`` · Optional
|
|
43
|
+
|
|
44
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
45
|
+
|
|
46
|
+
### onSubmit
|
|
47
|
+
|
|
48
|
+
``(event: SubmitEvent<HTMLButtonElement>): void`` · Optional
|
|
49
|
+
|
|
50
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
51
|
+
|
|
52
|
+
### onClick
|
|
53
|
+
|
|
54
|
+
``(event: MouseEvent<HTMLButtonElement, MouseEvent>): void`` · Optional
|
|
55
|
+
|
|
56
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
57
|
+
|
|
58
|
+
### size
|
|
59
|
+
|
|
60
|
+
``"small" | "standard" | "large" | "extra-large" | null | undefined`` · Optional
|
|
61
|
+
|
|
62
|
+
Default: ``"small"``
|
|
63
|
+
|
|
64
|
+
Component size preset.
|
|
65
|
+
|
|
66
|
+
### iconMotion
|
|
67
|
+
|
|
68
|
+
``"none" | "outward" | null | undefined`` · Optional
|
|
69
|
+
|
|
70
|
+
### variant
|
|
71
|
+
|
|
72
|
+
``"text" | "primary" | "secondary" | "quiet" | "highlight" | "underlined" | null | undefined`` · Optional
|
|
73
|
+
|
|
74
|
+
Visual variant.
|
|
75
|
+
|
|
76
|
+
### layout
|
|
77
|
+
|
|
78
|
+
``"cell" | "standard" | "icon" | "entry" | "rail" | "divided" | null | undefined`` · Optional
|
|
79
|
+
|
|
80
|
+
Layout within the containing region.
|
|
81
|
+
|
|
82
|
+
### startIcon
|
|
83
|
+
|
|
84
|
+
``ReactNode`` · Optional
|
|
85
|
+
|
|
86
|
+
### startIconLayout
|
|
87
|
+
|
|
88
|
+
``"divided" | "inline" | undefined`` · Optional
|
|
89
|
+
|
|
90
|
+
### startIconSize
|
|
91
|
+
|
|
92
|
+
``"standard" | "large" | "extra-large" | undefined`` · Optional
|
|
93
|
+
|
|
94
|
+
### endIcon
|
|
95
|
+
|
|
96
|
+
``ReactNode`` · Optional
|
|
97
|
+
|
|
98
|
+
### loading
|
|
99
|
+
|
|
100
|
+
``boolean | undefined`` · Optional
|
|
101
|
+
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
|
|
2
|
+
# Popover
|
|
3
|
+
|
|
4
|
+
Anchors an interactive surface to a trigger. Use it for contextual controls or details that do not require a modal dialog.
|
|
5
|
+
|
|
6
|
+
Import from ``@gridui/popover`` and load Theme before this family's stylesheet.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { Popover } from "@gridui/popover";
|
|
10
|
+
import "@gridui/theme/styles.css";
|
|
11
|
+
import "@gridui/popover/styles.css";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/popover/README.md) for shared behavior and stylesheet dependencies.
|
|
15
|
+
|
|
16
|
+
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/popover/stories/popover.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
|
|
17
|
+
|
|
18
|
+
## API
|
|
19
|
+
|
|
20
|
+
The public Props type is the source of these signatures. Defaults below are explicit implementation defaults; story presets are separate. Native attributes remain available through the exported Props type.
|
|
21
|
+
|
|
22
|
+
### children
|
|
23
|
+
|
|
24
|
+
``ReactNode`` · Optional
|
|
25
|
+
|
|
26
|
+
Content rendered inside the component.
|
|
27
|
+
|
|
28
|
+
### open
|
|
29
|
+
|
|
30
|
+
``boolean | undefined`` · Optional
|
|
31
|
+
|
|
32
|
+
Controlled visibility. Pair with onOpenChange.
|
|
33
|
+
|
|
34
|
+
### defaultOpen
|
|
35
|
+
|
|
36
|
+
``boolean | undefined`` · Optional
|
|
37
|
+
|
|
38
|
+
Default: ``false``
|
|
39
|
+
|
|
40
|
+
Initial uncontrolled visibility. Reset the story after changing it.
|
|
41
|
+
|
|
42
|
+
### onOpenChange
|
|
43
|
+
|
|
44
|
+
``(open: boolean): void`` · Optional
|
|
45
|
+
|
|
46
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
47
|
+
|
|
48
|
+
### modal
|
|
49
|
+
|
|
50
|
+
``boolean | undefined`` · Optional
|
|
51
|
+
|
|
52
|
+
### hoverEnabled
|
|
53
|
+
|
|
54
|
+
``boolean | undefined`` · Optional
|
|
55
|
+
|
|
56
|
+
Default: ``true``
|
|
57
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridui/popover",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"description": "GridUI React popover",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"react-dom": "^19.2.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@gridui/button": "^
|
|
31
|
-
"@gridui/overlay": "^
|
|
32
|
-
"@gridui/style-utils": "^
|
|
30
|
+
"@gridui/button": "^4.1.0",
|
|
31
|
+
"@gridui/overlay": "^2.0.0",
|
|
32
|
+
"@gridui/style-utils": "^4.0.0",
|
|
33
33
|
"@gridui/theme": "^2.5.3",
|
|
34
34
|
"@radix-ui/react-popover": "1.3.1",
|
|
35
35
|
"class-variance-authority": "0.7.1"
|