@gridui/popover 1.3.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -3
- package/dist/index.js +2 -3
- package/dist/index.js.map +2 -2
- package/dist/popover-panel/popover-panel.d.ts +2 -0
- package/dist/styles.css +58 -68
- package/docs/catalog.json +6 -6
- package/docs/reference/popover-anchor.md +1 -1
- package/docs/reference/popover-close.md +2 -2
- package/docs/reference/popover-panel.md +7 -3
- package/docs/reference/popover-trigger.md +9 -11
- package/docs/reference/popover.md +2 -2
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @gridui/popover
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Overlays family. Public API: `Popover`, `PopoverAnchor`, `PopoverAnchorProps`, `PopoverClose`, `PopoverCloseProps`, `PopoverPanel`, `PopoverPanelProps`, `PopoverProps`, `PopoverTrigger`, `PopoverTriggerProps`.
|
|
4
4
|
|
|
5
5
|
Import components from `@gridui/popover` and load `@gridui/popover/styles.css` after Theme.
|
|
6
6
|
Applications own routes, labels, state persistence, and branding.
|
|
@@ -15,7 +15,7 @@ dependency styles; Theme/reset remain separate. See the
|
|
|
15
15
|
for static HTML loading, SSR limits, and avoiding duplicate CSS.
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
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-
|
|
18
|
+
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-overlays/popover/.changeset/history).
|
|
19
19
|
|
|
20
20
|
Surface motion uses `@gridui/overlay`; its styles are included.
|
|
21
21
|
|
|
@@ -23,5 +23,12 @@ Surface motion uses `@gridui/overlay`; its styles are included.
|
|
|
23
23
|
|
|
24
24
|
Shared animation policy and tempo come from `MotionConfig` in `@gridui/motion`.
|
|
25
25
|
Disabled or reduced-motion policy settles decoration without disabling interaction.
|
|
26
|
-
See the [motion guide](https://github.com/sudo-ui/GridUI-React-Monorepo/tree/main/packages-
|
|
26
|
+
See the [motion guide](https://github.com/sudo-ui/GridUI-React-Monorepo/tree/main/packages-foundation/motion)
|
|
27
27
|
for CSS scopes, portal behavior, and specialized timing contracts.
|
|
28
|
+
|
|
29
|
+
## Sizing and density
|
|
30
|
+
|
|
31
|
+
PopoverPanel accepts CSS width with available-space constraints. PopoverTrigger uses the medium Button default and supports explicit Button sizes. A trigger size never implicitly selects panel width or content density.
|
|
32
|
+
|
|
33
|
+
See the [shared sizing contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/usage/sizing.md)
|
|
34
|
+
for native attributes, scope precedence, tokens and target behavior.
|
package/dist/index.js
CHANGED
|
@@ -186,6 +186,7 @@ var PopoverPanel = (props) => {
|
|
|
186
186
|
const motionStyle = useMotionStyle();
|
|
187
187
|
const {
|
|
188
188
|
className,
|
|
189
|
+
width,
|
|
189
190
|
container,
|
|
190
191
|
ref: forwardedRef,
|
|
191
192
|
forceMount,
|
|
@@ -246,7 +247,7 @@ var PopoverPanel = (props) => {
|
|
|
246
247
|
interaction?.dismiss();
|
|
247
248
|
}
|
|
248
249
|
},
|
|
249
|
-
style: { ...props.style, ...motionStyle }
|
|
250
|
+
style: { width, ...props.style, ...motionStyle }
|
|
250
251
|
}
|
|
251
252
|
);
|
|
252
253
|
return /* @__PURE__ */ jsx4(
|
|
@@ -271,7 +272,6 @@ import { useContext as useContext2 } from "react";
|
|
|
271
272
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
272
273
|
var PopoverTrigger = (props) => {
|
|
273
274
|
const {
|
|
274
|
-
size = "small",
|
|
275
275
|
className,
|
|
276
276
|
onPointerEnter,
|
|
277
277
|
onPointerLeave,
|
|
@@ -292,7 +292,6 @@ var PopoverTrigger = (props) => {
|
|
|
292
292
|
Button,
|
|
293
293
|
{
|
|
294
294
|
...buttonProps,
|
|
295
|
-
size,
|
|
296
295
|
className: cn3(popoverTriggerStyles(), className),
|
|
297
296
|
onPointerEnter: (event) => {
|
|
298
297
|
onPointerEnter?.(event);
|
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/popover-panel.tsx", "../src/popover-panel/style.ts", "../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 Popover Panel\n */\n\nimport { useMotionStyle } from \"@gridui/motion/policy\";\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 readonly container?: ComponentPropsWithRef<typeof Primitive.Portal>[\"container\"];\n};\n\nexport const PopoverPanel: FC<PopoverPanelProps> = (props: PopoverPanelProps) => {\n const motionStyle = useMotionStyle();\n const {\n className,\n container,\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 style={{ ...(props.style), ...motionStyle }}\n />);\n return (<Primitive.Portal\n container={container}\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 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 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,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,OAA2B,IAAI;AACnD,YAAU,MAAM;AACZ,YAAQ,UAAU;AAClB,cAAU,UAAU;AAAA,EACxB,GAAG;AAAA,IACC;AAAA,IACA;AA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AAY;AAAA,QAAZ;AAAA,UACG,OAAO;AAAA,UAEP;AAAA,YAAW;AAAA,YAAV;AAAA,cACI,GAAG;AAAA,cACJ;AAAA,cACA,cAAc,CAAC,SAAS;AACpB,oBAAI,CAAC,MAAM;AACP,8BAAY,QAAQ;AAAA,gBACxB;AACA,uBAAO,IAAI;AAAA,cACf;AAAA;AAAA,UACJ;AAAA;AAAA,MACJ;AAAA;AAAA,EACJ;AACJ;;;ACxGA,YAAYA,gBAAe;AAMf,gBAAAC,YAAA;AADL,IAAM,gBAAwC,CAAC,UAA8B;AAChF,SAAQ,gBAAAA;AAAA,IAAW;AAAA,IAAV;AAAA,MACJ,GAAG;AAAA;AAAA,EACR;AACJ;;;ACTA,YAAYC,gBAAe;AAMf,gBAAAC,YAAA;AADL,IAAM,eAAsC,CAAC,UAA6B;AAC7E,SAAQ,gBAAAA;AAAA,IAAW;AAAA,IAAV;AAAA,MACJ,GAAG;AAAA;AAAA,EACR;AACJ;;;
|
|
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 Popover Panel\n */\n\nimport type { CSSProperties } from \"react\";\nimport { useMotionStyle } from \"@gridui/motion/policy\";\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 readonly width?: CSSProperties[\"width\"];\n readonly container?: ComponentPropsWithRef<typeof Primitive.Portal>[\"container\"];\n};\n\nexport const PopoverPanel: FC<PopoverPanelProps> = (props: PopoverPanelProps) => {\n const motionStyle = useMotionStyle();\n const {\n className,\n width,\n container,\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 style={{ width, ...(props.style), ...motionStyle }}\n />);\n return (<Primitive.Portal\n container={container}\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 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 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 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 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,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,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
|
}
|
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
* @namespace PopoverPanel
|
|
5
5
|
* @description Popover Panel
|
|
6
6
|
*/
|
|
7
|
+
import type { CSSProperties } from "react";
|
|
7
8
|
import * as Primitive from "@radix-ui/react-popover";
|
|
8
9
|
import { type ComponentPropsWithRef, type FC } from "react";
|
|
9
10
|
export type PopoverPanelProps = ComponentPropsWithRef<typeof Primitive.Content> & {
|
|
11
|
+
readonly width?: CSSProperties["width"];
|
|
10
12
|
readonly container?: ComponentPropsWithRef<typeof Primitive.Portal>["container"];
|
|
11
13
|
};
|
|
12
14
|
export declare const PopoverPanel: FC<PopoverPanelProps>;
|
package/dist/styles.css
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
|
|
2
2
|
@layer properties;
|
|
3
3
|
@layer theme, base, components, utilities;
|
|
4
|
-
@layer theme {
|
|
5
|
-
:root, :host {
|
|
6
|
-
--spacing: 0.25rem;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
4
|
@layer utilities {
|
|
10
5
|
.gridui-u-button--pointer-events-none {
|
|
11
6
|
pointer-events: none;
|
|
@@ -13,24 +8,13 @@
|
|
|
13
8
|
.gridui-u-button--inline-flex {
|
|
14
9
|
display: inline-flex;
|
|
15
10
|
}
|
|
11
|
+
.gridui-u-button--size-\(--_gridui-button-min\) {
|
|
12
|
+
width: var(--_gridui-button-min);
|
|
13
|
+
height: var(--_gridui-button-min);
|
|
14
|
+
}
|
|
16
15
|
.gridui-u-button--h-full {
|
|
17
16
|
height: 100%;
|
|
18
17
|
}
|
|
19
|
-
.gridui-u-button--h-gridui-control {
|
|
20
|
-
height: var(--gridui-control-min-height);
|
|
21
|
-
}
|
|
22
|
-
.gridui-u-button--min-h-18 {
|
|
23
|
-
min-height: calc(var(--spacing) * 18);
|
|
24
|
-
}
|
|
25
|
-
.gridui-u-button--min-h-gridui-control {
|
|
26
|
-
min-height: var(--gridui-control-min-height);
|
|
27
|
-
}
|
|
28
|
-
.gridui-u-button--min-h-gridui-control-large {
|
|
29
|
-
min-height: var(--gridui-control-min-height-large);
|
|
30
|
-
}
|
|
31
|
-
.gridui-u-button--min-h-gridui-control-small {
|
|
32
|
-
min-height: var(--gridui-control-min-height-small);
|
|
33
|
-
}
|
|
34
18
|
.gridui-u-button--w-fit {
|
|
35
19
|
width: fit-content;
|
|
36
20
|
}
|
|
@@ -40,14 +24,14 @@
|
|
|
40
24
|
.gridui-u-button--w-gridui-64 {
|
|
41
25
|
width: var(--gridui-space-64);
|
|
42
26
|
}
|
|
43
|
-
.gridui-u-button--w-gridui-control {
|
|
44
|
-
width: var(--gridui-control-min-height);
|
|
45
|
-
}
|
|
46
27
|
.gridui-u-button--w-gridui-control-large {
|
|
47
|
-
width: var(--gridui-control-min-height-large);
|
|
28
|
+
width: max(var(--gridui-control-min-height-large), var(--gridui-target-min-size));
|
|
29
|
+
}
|
|
30
|
+
.gridui-u-button--w-gridui-control-medium {
|
|
31
|
+
width: max(var(--gridui-control-min-height-medium), var(--gridui-target-min-size));
|
|
48
32
|
}
|
|
49
33
|
.gridui-u-button--w-gridui-control-small {
|
|
50
|
-
width: var(--gridui-control-min-height-small);
|
|
34
|
+
width: max(var(--gridui-control-min-height-small), var(--gridui-target-min-size));
|
|
51
35
|
}
|
|
52
36
|
.gridui-u-button--max-w-full {
|
|
53
37
|
max-width: 100%;
|
|
@@ -253,35 +237,10 @@
|
|
|
253
237
|
.gridui-u-button--\[\&_svg\]\:shrink-0 svg {
|
|
254
238
|
flex-shrink: 0;
|
|
255
239
|
}
|
|
256
|
-
.gridui-u-button--\[\&\.gridui-button-extra-large\]\:h-18.gridui-button-extra-large {
|
|
257
|
-
height: calc(var(--spacing) * 18);
|
|
258
|
-
}
|
|
259
|
-
.gridui-u-button--\[\&\.gridui-button-extra-large\]\:w-18.gridui-button-extra-large {
|
|
260
|
-
width: calc(var(--spacing) * 18);
|
|
261
|
-
}
|
|
262
|
-
.gridui-u-button--\[\&\.gridui-button-large\]\:h-gridui-control-large.gridui-button-large {
|
|
263
|
-
height: var(--gridui-control-min-height-large);
|
|
264
|
-
}
|
|
265
|
-
.gridui-u-button--\[\&\.gridui-button-large\]\:w-gridui-control-large.gridui-button-large {
|
|
266
|
-
width: var(--gridui-control-min-height-large);
|
|
267
|
-
}
|
|
268
|
-
.gridui-u-button--\[\&\.gridui-button-small\]\:h-gridui-control-small.gridui-button-small {
|
|
269
|
-
height: var(--gridui-control-min-height-small);
|
|
270
|
-
}
|
|
271
|
-
.gridui-u-button--\[\&\.gridui-button-small\]\:w-gridui-control-small.gridui-button-small {
|
|
272
|
-
width: var(--gridui-control-min-height-small);
|
|
273
|
-
}
|
|
274
|
-
@media (pointer: coarse) {
|
|
275
|
-
.gridui-u-button--pointer-coarse\:\[\&\.gridui-button-small\]\:h-gridui-control.gridui-button-small {
|
|
276
|
-
height: var(--gridui-control-min-height);
|
|
277
|
-
}
|
|
278
|
-
.gridui-u-button--pointer-coarse\:\[\&\.gridui-button-small\]\:w-gridui-control.gridui-button-small {
|
|
279
|
-
width: var(--gridui-control-min-height);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
240
|
}
|
|
283
241
|
@layer components {
|
|
284
242
|
.gridui-button {
|
|
243
|
+
min-height: var(--_gridui-button-min);
|
|
285
244
|
border: 1px solid transparent;
|
|
286
245
|
}
|
|
287
246
|
.gridui-button-cell {
|
|
@@ -327,8 +286,27 @@
|
|
|
327
286
|
transform: var(--gridui-motion-transform, translate(calc(-1 * var(--gridui-space-4)), calc(-1 * var(--gridui-space-4))));
|
|
328
287
|
}
|
|
329
288
|
}
|
|
289
|
+
.gridui-button-medium {
|
|
290
|
+
--_gridui-button-min: max(var(--gridui-control-min-height-medium), var(--gridui-target-min-size));
|
|
291
|
+
padding-block: var(--gridui-space-8);
|
|
292
|
+
padding-inline: var(--gridui-space-16);
|
|
293
|
+
}
|
|
294
|
+
.gridui-button-small {
|
|
295
|
+
--_gridui-button-min: max(var(--gridui-control-min-height-small), var(--gridui-target-min-size));
|
|
296
|
+
padding-block: var(--gridui-space-4);
|
|
297
|
+
padding-inline: var(--gridui-space-8);
|
|
298
|
+
}
|
|
299
|
+
.gridui-button-large {
|
|
300
|
+
--_gridui-button-min: max(var(--gridui-control-min-height-large), var(--gridui-target-min-size));
|
|
301
|
+
padding-block: var(--gridui-space-8);
|
|
302
|
+
padding-inline: var(--gridui-space-24);
|
|
303
|
+
}
|
|
304
|
+
.gridui-button-extra-large {
|
|
305
|
+
--_gridui-button-min: max(var(--gridui-control-min-height-extra-large), var(--gridui-target-min-size));
|
|
306
|
+
padding-block: var(--gridui-space-16);
|
|
307
|
+
padding-inline: var(--gridui-space-24);
|
|
308
|
+
}
|
|
330
309
|
.gridui-button-group {
|
|
331
|
-
--gridui-button-group-padding-block: var(--gridui-space-24);
|
|
332
310
|
container: gridui-button-group / inline-size;
|
|
333
311
|
min-width: 0;
|
|
334
312
|
}
|
|
@@ -371,12 +349,19 @@
|
|
|
371
349
|
min-width: 0;
|
|
372
350
|
}
|
|
373
351
|
.gridui-button-group-items[data-layout="cells"] > [data-gridui-button-group-item] {
|
|
374
|
-
|
|
375
|
-
padding: var(--gridui-button-group-padding-block) var(--gridui-space-24);
|
|
352
|
+
padding-block: var(--gridui-button-group-padding-block, var(--_gridui-button-group-block, var(--gridui-space-8)));
|
|
376
353
|
border: 0;
|
|
377
354
|
border-radius: 0;
|
|
378
355
|
}
|
|
379
356
|
}
|
|
357
|
+
@layer components {
|
|
358
|
+
.gridui-button-group-items > [data-size="small"] {
|
|
359
|
+
--_gridui-button-group-block: var(--gridui-space-4);
|
|
360
|
+
}
|
|
361
|
+
.gridui-button-group-items > [data-size="extra-large"] {
|
|
362
|
+
--_gridui-button-group-block: var(--gridui-space-16);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
380
365
|
@property --tw-border-style {
|
|
381
366
|
syntax: "*";
|
|
382
367
|
inherits: false;
|
|
@@ -403,11 +388,6 @@
|
|
|
403
388
|
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
|
|
404
389
|
@layer properties;
|
|
405
390
|
@layer theme, base, components, utilities;
|
|
406
|
-
@layer theme {
|
|
407
|
-
:root, :host {
|
|
408
|
-
--spacing: 0.25rem;
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
391
|
@layer utilities {
|
|
412
392
|
.gridui-u-overlay--z-\(--gridui-z-popover\) {
|
|
413
393
|
z-index: var(--gridui-z-popover);
|
|
@@ -422,9 +402,6 @@
|
|
|
422
402
|
width: var(--gridui-space-16);
|
|
423
403
|
height: var(--gridui-space-16);
|
|
424
404
|
}
|
|
425
|
-
.gridui-u-overlay--min-h-10 {
|
|
426
|
-
min-height: calc(var(--spacing) * 10);
|
|
427
|
-
}
|
|
428
405
|
.gridui-u-overlay--min-w-0 {
|
|
429
406
|
min-width: 0px;
|
|
430
407
|
}
|
|
@@ -463,15 +440,9 @@
|
|
|
463
440
|
.gridui-u-overlay--p-0 {
|
|
464
441
|
padding: 0px;
|
|
465
442
|
}
|
|
466
|
-
.gridui-u-overlay--p-gridui-8 {
|
|
467
|
-
padding: var(--gridui-space-8);
|
|
468
|
-
}
|
|
469
443
|
.gridui-u-overlay--px-gridui-8 {
|
|
470
444
|
padding-inline: var(--gridui-space-8);
|
|
471
445
|
}
|
|
472
|
-
.gridui-u-overlay--py-gridui-8 {
|
|
473
|
-
padding-block: var(--gridui-space-8);
|
|
474
|
-
}
|
|
475
446
|
.gridui-u-overlay--type-data {
|
|
476
447
|
font: var(--gridui-type-data);
|
|
477
448
|
font-family: var(--gridui-font-body);
|
|
@@ -578,6 +549,25 @@
|
|
|
578
549
|
animation: none;
|
|
579
550
|
}
|
|
580
551
|
}
|
|
552
|
+
.gridui-overlay-list {
|
|
553
|
+
--gridui-overlay-row-min: var(--gridui-control-min-height-medium);
|
|
554
|
+
--gridui-overlay-row-padding: var(--gridui-space-8);
|
|
555
|
+
}
|
|
556
|
+
.gridui-overlay-density-compact {
|
|
557
|
+
--gridui-overlay-row-min: var(--gridui-control-min-height-small);
|
|
558
|
+
--gridui-overlay-row-padding: var(--gridui-space-4);
|
|
559
|
+
}
|
|
560
|
+
.gridui-overlay-density-comfortable {
|
|
561
|
+
--gridui-overlay-row-min: var(--gridui-control-min-height-medium);
|
|
562
|
+
--gridui-overlay-row-padding: var(--gridui-space-8);
|
|
563
|
+
}
|
|
564
|
+
.gridui-overlay-list-item {
|
|
565
|
+
min-block-size: max(var(--gridui-overlay-row-min, var(--gridui-control-min-height-medium)), var(--gridui-target-min-size));
|
|
566
|
+
padding-block: var(--gridui-overlay-row-padding, var(--gridui-space-8));
|
|
567
|
+
}
|
|
568
|
+
.gridui-overlay-list-label {
|
|
569
|
+
padding-block: var(--gridui-overlay-row-padding, var(--gridui-space-8));
|
|
570
|
+
}
|
|
581
571
|
}
|
|
582
572
|
@property --tw-border-style {
|
|
583
573
|
syntax: "*";
|
package/docs/catalog.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"name": "@gridui/popover",
|
|
4
|
-
"version": "
|
|
5
|
-
"category": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
|
+
"category": "overlays",
|
|
6
6
|
"description": "GridUI React popover",
|
|
7
7
|
"usage": "Surface motion uses `@gridui/overlay`; its styles are included.",
|
|
8
8
|
"documentation": [
|
|
@@ -74,9 +74,9 @@
|
|
|
74
74
|
],
|
|
75
75
|
"styledImport": "@gridui/popover/styled",
|
|
76
76
|
"examples": [
|
|
77
|
-
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
78
|
-
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
79
|
-
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
80
|
-
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
77
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-overlays/popover/stories/contextual-panels.mdx",
|
|
78
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-overlays/popover/stories/getting-started.mdx",
|
|
79
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-overlays/popover/stories/hover-panels.mdx",
|
|
80
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-overlays/popover/stories/popover.stories.tsx"
|
|
81
81
|
]
|
|
82
82
|
}
|
|
@@ -11,7 +11,7 @@ import "@gridui/theme/styles.css";
|
|
|
11
11
|
import "@gridui/popover/styles.css";
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-overlays/popover/README.md) for shared behavior and stylesheet dependencies.
|
|
15
15
|
|
|
16
16
|
## API
|
|
17
17
|
|
|
@@ -11,9 +11,9 @@ import "@gridui/theme/styles.css";
|
|
|
11
11
|
import "@gridui/popover/styles.css";
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-overlays/popover/README.md) for shared behavior and stylesheet dependencies.
|
|
15
15
|
|
|
16
|
-
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
16
|
+
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-overlays/popover/stories/popover.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
|
|
17
17
|
|
|
18
18
|
## API
|
|
19
19
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
|
|
2
2
|
# PopoverPanel
|
|
3
3
|
|
|
4
|
-
Compose PopoverPanel with
|
|
4
|
+
Compose PopoverPanel with ResponsiveNavigationMenu inside the same @gridui/popover component family.
|
|
5
5
|
|
|
6
6
|
Import from ``@gridui/popover`` and load Theme before this family's stylesheet.
|
|
7
7
|
|
|
@@ -11,9 +11,9 @@ import "@gridui/theme/styles.css";
|
|
|
11
11
|
import "@gridui/popover/styles.css";
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-overlays/popover/README.md) for shared behavior and stylesheet dependencies.
|
|
15
15
|
|
|
16
|
-
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
16
|
+
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-layout/responsive-navigation/stories/navigation-menu.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
|
|
17
17
|
|
|
18
18
|
## API
|
|
19
19
|
|
|
@@ -167,6 +167,10 @@ Default: ``16``
|
|
|
167
167
|
|
|
168
168
|
``("always" | "optimized") | undefined`` · Optional
|
|
169
169
|
|
|
170
|
+
### width
|
|
171
|
+
|
|
172
|
+
``Property.Width<string | number> | undefined`` · Optional
|
|
173
|
+
|
|
170
174
|
### container
|
|
171
175
|
|
|
172
176
|
``Element | DocumentFragment | null | undefined`` · Optional
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
|
|
2
2
|
# PopoverTrigger
|
|
3
3
|
|
|
4
|
-
Compose PopoverTrigger with
|
|
4
|
+
Compose PopoverTrigger with ResponsiveNavigationMenu inside the same @gridui/popover component family.
|
|
5
5
|
|
|
6
6
|
Import from ``@gridui/popover`` and load Theme before this family's stylesheet.
|
|
7
7
|
|
|
@@ -11,9 +11,9 @@ import "@gridui/theme/styles.css";
|
|
|
11
11
|
import "@gridui/popover/styles.css";
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-overlays/popover/README.md) for shared behavior and stylesheet dependencies.
|
|
15
15
|
|
|
16
|
-
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
16
|
+
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-layout/responsive-navigation/stories/navigation-menu.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
|
|
17
17
|
|
|
18
18
|
## API
|
|
19
19
|
|
|
@@ -55,17 +55,15 @@ Called when the corresponding interaction occurs; inspect the arguments in Actio
|
|
|
55
55
|
|
|
56
56
|
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
57
57
|
|
|
58
|
-
###
|
|
59
|
-
|
|
60
|
-
``"small" | "standard" | "large" | "extra-large" | null | undefined`` · Optional
|
|
58
|
+
### iconMotion
|
|
61
59
|
|
|
62
|
-
|
|
60
|
+
``"none" | "outward" | null | undefined`` · Optional
|
|
63
61
|
|
|
64
|
-
|
|
62
|
+
### size
|
|
65
63
|
|
|
66
|
-
|
|
64
|
+
``ActionSize | undefined`` · Optional
|
|
67
65
|
|
|
68
|
-
|
|
66
|
+
Component size preset.
|
|
69
67
|
|
|
70
68
|
### variant
|
|
71
69
|
|
|
@@ -89,7 +87,7 @@ Layout within the containing region.
|
|
|
89
87
|
|
|
90
88
|
### startIconSize
|
|
91
89
|
|
|
92
|
-
``"
|
|
90
|
+
``"medium" | "large" | "extra-large" | undefined`` · Optional
|
|
93
91
|
|
|
94
92
|
### endIcon
|
|
95
93
|
|
|
@@ -11,9 +11,9 @@ import "@gridui/theme/styles.css";
|
|
|
11
11
|
import "@gridui/popover/styles.css";
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-overlays/popover/README.md) for shared behavior and stylesheet dependencies.
|
|
15
15
|
|
|
16
|
-
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
16
|
+
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-overlays/popover/stories/popover.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
|
|
17
17
|
|
|
18
18
|
## API
|
|
19
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridui/popover",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "GridUI React popover",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"react-dom": "^19.2.0"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@gridui/button": "^
|
|
36
|
-
"@gridui/motion": "^1.0.
|
|
37
|
-
"@gridui/overlay": "^2.
|
|
38
|
-
"@gridui/style-utils": "^4.
|
|
39
|
-
"@gridui/theme": "^
|
|
35
|
+
"@gridui/button": "^6.0.0",
|
|
36
|
+
"@gridui/motion": "^1.0.3",
|
|
37
|
+
"@gridui/overlay": "^2.5.0",
|
|
38
|
+
"@gridui/style-utils": "^4.1.0",
|
|
39
|
+
"@gridui/theme": "^5.0.0",
|
|
40
40
|
"@radix-ui/react-popover": "1.3.1",
|
|
41
41
|
"class-variance-authority": "0.7.1"
|
|
42
42
|
},
|