Skip to content

Commit

Permalink
fix: type error
Browse files Browse the repository at this point in the history
  • Loading branch information
ryo-manba committed Dec 30, 2024
1 parent 3fa49ac commit bbdd9d7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/components/popover/src/use-popover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ export interface Props extends HTMLNextUIProps<"div"> {
onClose?: () => void;
}

const DEFAULT_PLACEMENT = "top";

export type UsePopoverProps = Props &
Omit<ReactAriaPopoverProps, "triggerRef" | "popoverRef"> &
OverlayTriggerProps &
Expand Down Expand Up @@ -110,7 +112,7 @@ export function usePopover(originalProps: UsePopoverProps) {
portalContainer,
updatePositionDeps,
dialogProps: dialogPropsProp,
placement: placementProp = "top",
placement: placementProp = DEFAULT_PLACEMENT,
triggerType = "dialog",
showArrow = false,
offset = 7,
Expand Down Expand Up @@ -204,7 +206,7 @@ export function usePopover(originalProps: UsePopoverProps) {
"data-focus": dataAttr(isFocused),
"data-arrow": dataAttr(showArrow),
"data-focus-visible": dataAttr(isFocusVisible),
"data-placement": getArrowPlacement(placement || "top", placementProp),
"data-placement": getArrowPlacement(placement || DEFAULT_PLACEMENT, placementProp),
...mergeProps(focusProps, dialogPropsProp, props),
className: slots.base({class: clsx(baseStyles)}),
style: {
Expand All @@ -218,7 +220,7 @@ export function usePopover(originalProps: UsePopoverProps) {
"data-slot": "content",
"data-open": dataAttr(state.isOpen),
"data-arrow": dataAttr(showArrow),
"data-placement": getArrowPlacement(placement || "top", placementProp),
"data-placement": getArrowPlacement(placement || DEFAULT_PLACEMENT, placementProp),
className: slots.content({class: clsx(classNames?.content, props.className)}),
}),
[slots, state.isOpen, showArrow, placement, placementProp, classNames],
Expand Down Expand Up @@ -305,7 +307,7 @@ export function usePopover(originalProps: UsePopoverProps) {
classNames,
showArrow,
triggerRef,
placement,
placement: placement || DEFAULT_PLACEMENT,
isNonModal,
popoverRef: domRef,
portalContainer,
Expand Down

0 comments on commit bbdd9d7

Please sign in to comment.