@refraction-ui/react 0.23.3 → 0.24.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.
@@ -1,6 +1,5 @@
1
1
  import {
2
2
  cn,
3
- createKeyboardHandler,
4
3
  cva,
5
4
  devWarn
6
5
  } from "./chunk-75BKRTPO.js";
@@ -156,15 +155,33 @@ var DropdownMenuContent = React.forwardRef(
156
155
  document.addEventListener("pointerdown", onPointerDown);
157
156
  return () => document.removeEventListener("pointerdown", onPointerDown);
158
157
  }, [open, onOpenChange, triggerRef]);
158
+ React.useEffect(() => {
159
+ if (!open) return;
160
+ contentRef.current?.querySelector('[role="menuitem"]:not([aria-disabled="true"])')?.focus({ preventScroll: true });
161
+ }, [open]);
159
162
  const handleKeyDown = (e) => {
160
- const handler = createKeyboardHandler({
161
- Escape: (ev) => {
162
- ev.preventDefault();
163
- onOpenChange(false);
164
- }
165
- });
166
- handler(e.nativeEvent);
167
163
  onKeyDown?.(e);
164
+ if (e.defaultPrevented) return;
165
+ if (e.key === "Escape") {
166
+ e.preventDefault();
167
+ onOpenChange(false);
168
+ triggerRef.current?.focus();
169
+ return;
170
+ }
171
+ if (e.key === "Tab") {
172
+ triggerRef.current?.focus();
173
+ onOpenChange(false);
174
+ return;
175
+ }
176
+ if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(e.key)) return;
177
+ const items = Array.from(contentRef.current?.querySelectorAll(
178
+ '[role="menuitem"]:not([aria-disabled="true"])'
179
+ ) ?? []);
180
+ if (items.length === 0) return;
181
+ e.preventDefault();
182
+ const current = items.indexOf(document.activeElement);
183
+ const index = e.key === "Home" ? 0 : e.key === "End" ? items.length - 1 : e.key === "ArrowDown" ? (current + 1) % items.length : (current - 1 + items.length) % items.length;
184
+ items[index].focus();
168
185
  };
169
186
  if (!open) return null;
170
187
  const content = React.createElement(
@@ -191,11 +208,12 @@ var DropdownMenuContent = React.forwardRef(
191
208
  );
192
209
  var DropdownMenuItem = React.forwardRef(
193
210
  function DropdownMenuItem2({ className, disabled, onSelect, onClick, children, ...props }, ref) {
194
- const { onOpenChange } = useDropdownMenuContext();
211
+ const { onOpenChange, triggerRef } = useDropdownMenuContext();
195
212
  const handleClick = (e) => {
196
213
  if (disabled) return;
197
214
  onSelect?.();
198
215
  onOpenChange(false);
216
+ triggerRef.current?.focus();
199
217
  onClick?.(e);
200
218
  };
201
219
  const handleKeyDown = (e) => {
@@ -204,6 +222,7 @@ var DropdownMenuItem = React.forwardRef(
204
222
  e.preventDefault();
205
223
  onSelect?.();
206
224
  onOpenChange(false);
225
+ triggerRef.current?.focus();
207
226
  }
208
227
  };
209
228
  return React.createElement(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../dropdown-menu/src/dropdown-menu.ts", "../../dropdown-menu/src/dropdown-menu.styles.ts", "../../react-dropdown-menu/src/dropdown-menu.tsx"],
4
- "sourcesContent": ["import type { AccessibilityProps, KeyboardHandlerMap } from '@refraction-ui/shared'\nimport { createMachine, Keys, generateId } from '@refraction-ui/shared'\n\nexport interface DropdownMenuProps {\n /** Whether the menu is open (controlled) */\n open?: boolean\n /** Whether the menu starts open (uncontrolled) */\n defaultOpen?: boolean\n /** Callback when open state changes */\n onOpenChange?: (open: boolean) => void\n}\n\nexport interface MenuItemProps {\n /** Whether the item is disabled */\n disabled?: boolean\n /** Callback when the item is selected */\n onSelect?: () => void\n}\n\nexport interface DropdownMenuState {\n open: boolean\n}\n\nexport interface DropdownMenuAPI {\n /** Current menu state */\n state: DropdownMenuState\n /** ARIA attributes for the trigger button */\n triggerProps: Partial<AccessibilityProps> & Record<string, unknown>\n /** ARIA attributes for the menu content */\n contentProps: Partial<AccessibilityProps> & Record<string, unknown>\n /** Factory for menu item props */\n getItemProps(item: MenuItemProps): Partial<AccessibilityProps> & Record<string, unknown>\n /** Open the menu */\n open(): void\n /** Close the menu */\n close(): void\n /** Toggle the menu */\n toggle(): void\n /** Keyboard handlers for the menu */\n keyboardHandlers: KeyboardHandlerMap\n /** Generated IDs for aria linking */\n ids: {\n content: string\n }\n}\n\nexport function createDropdownMenu(props: DropdownMenuProps = {}): DropdownMenuAPI {\n const { open: controlledOpen, defaultOpen = false, onOpenChange } = props\n\n const machine = createMachine<'open' | 'closed', 'OPEN' | 'CLOSE'>({\n initial: controlledOpen ?? defaultOpen ? 'open' : 'closed',\n states: {\n closed: { on: { OPEN: 'open' } },\n open: { on: { CLOSE: 'closed' } },\n },\n })\n\n const contentId = generateId('rfr-dropdown-menu')\n\n function isOpen(): boolean {\n if (controlledOpen !== undefined) return controlledOpen\n return machine.matches('open')\n }\n\n function openMenu(): void {\n machine.send('OPEN')\n onOpenChange?.(true)\n }\n\n function closeMenu(): void {\n machine.send('CLOSE')\n onOpenChange?.(false)\n }\n\n function toggleMenu(): void {\n if (isOpen()) {\n closeMenu()\n } else {\n openMenu()\n }\n }\n\n function getItemProps(item: MenuItemProps): Partial<AccessibilityProps> & Record<string, unknown> {\n return {\n role: 'menuitem',\n tabIndex: item.disabled ? -1 : 0,\n 'data-disabled': item.disabled ? '' : undefined,\n 'aria-disabled': item.disabled || undefined,\n }\n }\n\n const keyboardHandlers: KeyboardHandlerMap = {\n [Keys.Escape]: (e: KeyboardEvent) => {\n e.preventDefault()\n closeMenu()\n },\n [Keys.ArrowDown]: (e: KeyboardEvent) => {\n e.preventDefault()\n },\n [Keys.ArrowUp]: (e: KeyboardEvent) => {\n e.preventDefault()\n },\n [Keys.Enter]: (e: KeyboardEvent) => {\n e.preventDefault()\n },\n [Keys.Home]: (e: KeyboardEvent) => {\n e.preventDefault()\n },\n [Keys.End]: (e: KeyboardEvent) => {\n e.preventDefault()\n },\n }\n\n const triggerProps: Partial<AccessibilityProps> & Record<string, unknown> = {\n 'aria-expanded': isOpen(),\n 'aria-controls': contentId,\n 'aria-haspopup': 'menu',\n }\n\n const contentProps: Partial<AccessibilityProps> & Record<string, unknown> = {\n role: 'menu',\n id: contentId,\n 'data-state': isOpen() ? 'open' : 'closed',\n }\n\n return {\n state: { open: isOpen() },\n triggerProps,\n contentProps,\n getItemProps,\n open: openMenu,\n close: closeMenu,\n toggle: toggleMenu,\n keyboardHandlers,\n ids: {\n content: contentId,\n },\n }\n}\n", "import { cva } from '@refraction-ui/shared'\n\nexport const menuContentVariants = cva({\n base: 'z-50 rounded-md border bg-popover shadow-md',\n})\n\nexport const menuItemVariants = cva({\n base: 'relative flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n})\n", "import * as React from 'react'\nimport * as ReactDOM from 'react-dom'\nimport {\n menuContentVariants,\n menuItemVariants,\n type DropdownMenuProps as CoreDropdownMenuProps,\n type MenuItemProps as CoreMenuItemProps,\n} from '@refraction-ui/dropdown-menu'\nimport { cn, createKeyboardHandler, devWarn } from '@refraction-ui/shared'\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\ninterface DropdownMenuContextValue {\n open: boolean\n onOpenChange: (open: boolean) => void\n contentId: string\n /** The trigger element, so the portalled content can anchor to it. */\n triggerRef: React.MutableRefObject<HTMLElement | null>\n}\n\nconst DropdownMenuContext = React.createContext<DropdownMenuContextValue | null>(null)\n\nfunction useDropdownMenuContext(): DropdownMenuContextValue {\n const ctx = React.useContext(DropdownMenuContext)\n if (!ctx) {\n devWarn(\n 'react-dropdown-menu/context-outside-provider',\n 'DropdownMenu compound components (DropdownMenuTrigger/DropdownMenuContent/DropdownMenuItem/etc.) must be rendered inside a <DropdownMenu>. The missing DropdownMenuContext makes this throw.',\n )\n throw new Error('DropdownMenu compound components must be used within <DropdownMenu>')\n }\n return ctx\n}\n\n// ---------------------------------------------------------------------------\n// DropdownMenu (root provider)\n// ---------------------------------------------------------------------------\n\nexport interface DropdownMenuProps {\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n children?: React.ReactNode\n}\n\nexport function DropdownMenu({\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n children,\n}: DropdownMenuProps) {\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen)\n const isControlled = controlledOpen !== undefined\n const open = isControlled ? controlledOpen : uncontrolledOpen\n\n const handleOpenChange = React.useCallback(\n (next: boolean) => {\n if (!isControlled) {\n setUncontrolledOpen(next)\n }\n onOpenChange?.(next)\n },\n [isControlled, onOpenChange],\n )\n\n // React IDs agree across SSR and hydration, unlike the core's process counter.\n const contentId = `rfr-dropdown-menu-${React.useId()}`\n\n const triggerRef = React.useRef<HTMLElement | null>(null)\n\n const ctx = React.useMemo<DropdownMenuContextValue>(\n () => ({\n open,\n onOpenChange: handleOpenChange,\n contentId,\n triggerRef,\n }),\n [open, handleOpenChange, contentId],\n )\n\n return React.createElement(DropdownMenuContext.Provider, { value: ctx }, children)\n}\n\n// ---------------------------------------------------------------------------\n// DropdownMenuTrigger\n// ---------------------------------------------------------------------------\n\nexport interface DropdownMenuTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Merge the trigger's props/behavior onto the child element instead of\n * rendering a `<button>` around it (Radix-style `asChild`). Use it with\n * styled triggers like `<Button>` — otherwise you'd nest a button in a\n * button (invalid HTML and a hydration error). */\n asChild?: boolean\n}\n\nexport const DropdownMenuTrigger = React.forwardRef<HTMLButtonElement, DropdownMenuTriggerProps>(\n function DropdownMenuTrigger({ asChild = false, onClick, children, ...props }, ref) {\n const { open, onOpenChange, contentId, triggerRef } = useDropdownMenuContext()\n const setRefs = (node: HTMLButtonElement | null) => {\n triggerRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) ref.current = node\n }\n\n const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {\n onOpenChange(!open)\n onClick?.(e)\n }\n\n const triggerProps = {\n type: 'button' as const,\n 'aria-expanded': open,\n 'aria-controls': contentId,\n 'aria-haspopup': 'menu' as const,\n onClick: handleClick,\n ...props,\n }\n\n if (asChild) {\n if (!React.isValidElement(children)) {\n devWarn(\n 'dropdown-menu-trigger-asChild-child',\n 'DropdownMenuTrigger: `asChild` expects a single React element child; rendering nothing.',\n )\n return null\n }\n const child = children as React.ReactElement<\n Record<string, unknown>\n > & { ref?: React.Ref<HTMLButtonElement> }\n const childOnClick = child.props.onClick as\n | ((e: React.MouseEvent<HTMLButtonElement>) => void)\n | undefined\n const childRef = child.ref\n const mergedProps = {\n ...triggerProps,\n onClick: (e: React.MouseEvent<HTMLButtonElement>) => {\n childOnClick?.(e)\n if (!e.defaultPrevented) handleClick(e)\n },\n ref: (node: HTMLButtonElement | null) => {\n setRefs(node)\n if (typeof childRef === 'function') childRef(node)\n else if (childRef) childRef.current = node\n },\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return React.cloneElement(child, mergedProps as any)\n }\n\n return React.createElement('button', { ref: setRefs, ...triggerProps }, children)\n },\n)\n\n// ---------------------------------------------------------------------------\n// Positioning\n// ---------------------------------------------------------------------------\n\nexport type DropdownMenuAlign = 'start' | 'center' | 'end'\n\nconst DEFAULT_SIDE_OFFSET = 4\n\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect\n\n/**\n * Fixed-position coordinates that place a menu under its trigger, aligned to\n * the trigger's start, centre or end edge. Pure, so it is unit-testable.\n */\nexport function computeMenuPosition(\n trigger: { top: number; bottom: number; left: number; right: number; width: number },\n contentWidth: number,\n align: DropdownMenuAlign,\n sideOffset: number,\n): React.CSSProperties {\n const left =\n align === 'end'\n ? trigger.right - contentWidth\n : align === 'center'\n ? trigger.left + trigger.width / 2 - contentWidth / 2\n : trigger.left\n return { position: 'fixed', top: trigger.bottom + sideOffset, left: Math.max(0, left), minWidth: trigger.width }\n}\n\n// ---------------------------------------------------------------------------\n// DropdownMenuContent\n// ---------------------------------------------------------------------------\n\nexport interface DropdownMenuContentProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Horizontal alignment to the trigger. Defaults to `start`. */\n align?: DropdownMenuAlign\n /** Gap between trigger and menu in px. Defaults to 4. */\n sideOffset?: number\n}\n\nexport const DropdownMenuContent = React.forwardRef<HTMLDivElement, DropdownMenuContentProps>(\n function DropdownMenuContent(\n { className, children, onKeyDown, align = 'start', sideOffset = DEFAULT_SIDE_OFFSET, style, ...props },\n forwardedRef,\n ) {\n const { open, onOpenChange, contentId, triggerRef } = useDropdownMenuContext()\n const contentRef = React.useRef<HTMLDivElement | null>(null)\n const ref = React.useCallback(\n (node: HTMLDivElement | null) => {\n contentRef.current = node\n if (typeof forwardedRef === 'function') forwardedRef(node)\n else if (forwardedRef) forwardedRef.current = node\n },\n [forwardedRef],\n )\n const [position, setPosition] = React.useState<React.CSSProperties | null>(null)\n\n // The content is portalled to <body>, so anchor it to the trigger with\n // fixed coordinates, and follow the trigger on scroll / resize.\n useIsomorphicLayoutEffect(() => {\n if (!open) return\n const update = () => {\n const trigger = triggerRef.current\n const content = contentRef.current\n if (!trigger) return\n setPosition(\n computeMenuPosition(trigger.getBoundingClientRect(), content?.offsetWidth ?? 0, align, sideOffset),\n )\n }\n update()\n window.addEventListener('resize', update)\n window.addEventListener('scroll', update, true)\n return () => {\n window.removeEventListener('resize', update)\n window.removeEventListener('scroll', update, true)\n }\n }, [open, align, sideOffset, triggerRef])\n\n // Close on a pointer press outside the menu and its trigger.\n React.useEffect(() => {\n if (!open) return\n const onPointerDown = (event: PointerEvent) => {\n const target = event.target as Node\n if (contentRef.current?.contains(target) || triggerRef.current?.contains(target)) return\n onOpenChange(false)\n }\n document.addEventListener('pointerdown', onPointerDown)\n return () => document.removeEventListener('pointerdown', onPointerDown)\n }, [open, onOpenChange, triggerRef])\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n const handler = createKeyboardHandler({\n Escape: (ev) => {\n ev.preventDefault()\n onOpenChange(false)\n },\n })\n handler(e.nativeEvent)\n onKeyDown?.(e)\n }\n\n if (!open) return null\n\n const content = React.createElement(\n 'div',\n {\n ref,\n role: 'menu',\n id: contentId,\n 'data-state': open ? 'open' : 'closed',\n className: cn(menuContentVariants(), className),\n style: position ? { ...position, ...style } : style,\n 'data-align': align,\n onKeyDown: handleKeyDown,\n tabIndex: -1,\n ...props,\n },\n children,\n )\n\n // Render via portal if document is available (client-side)\n if (typeof document !== 'undefined') {\n return ReactDOM.createPortal(content, document.body)\n }\n\n // SSR fallback: render inline\n return content\n },\n)\n\n// ---------------------------------------------------------------------------\n// DropdownMenuItem\n// ---------------------------------------------------------------------------\n\nexport interface DropdownMenuItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> {\n disabled?: boolean\n onSelect?: () => void\n}\n\nexport const DropdownMenuItem = React.forwardRef<HTMLDivElement, DropdownMenuItemProps>(\n function DropdownMenuItem({ className, disabled, onSelect, onClick, children, ...props }, ref) {\n const { onOpenChange } = useDropdownMenuContext()\n\n const handleClick = (e: React.MouseEvent<HTMLDivElement>) => {\n if (disabled) return\n onSelect?.()\n onOpenChange(false)\n onClick?.(e)\n }\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (disabled) return\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n onSelect?.()\n onOpenChange(false)\n }\n }\n\n return React.createElement(\n 'div',\n {\n ref,\n role: 'menuitem',\n tabIndex: disabled ? -1 : 0,\n 'data-disabled': disabled ? '' : undefined,\n 'aria-disabled': disabled || undefined,\n className: cn(menuItemVariants(), className),\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n ...props,\n },\n children,\n )\n },\n)\n\n// ---------------------------------------------------------------------------\n// DropdownMenuSeparator\n// ---------------------------------------------------------------------------\n\nexport interface DropdownMenuSeparatorProps extends React.HTMLAttributes<HTMLDivElement> {}\n\nexport const DropdownMenuSeparator = React.forwardRef<HTMLDivElement, DropdownMenuSeparatorProps>(\n function DropdownMenuSeparator({ className, ...props }, ref) {\n return React.createElement('div', {\n ref,\n role: 'separator',\n className: cn('-mx-1 my-1 h-px bg-muted', className),\n ...props,\n })\n },\n)\n\n// ---------------------------------------------------------------------------\n// DropdownMenuLabel\n// ---------------------------------------------------------------------------\n\nexport interface DropdownMenuLabelProps extends React.HTMLAttributes<HTMLDivElement> {}\n\nexport const DropdownMenuLabel = React.forwardRef<HTMLDivElement, DropdownMenuLabelProps>(\n function DropdownMenuLabel({ className, ...props }, ref) {\n return React.createElement('div', {\n ref,\n className: cn('px-2 py-1.5 text-sm font-semibold', className),\n ...props,\n })\n },\n)\n"],
5
- "mappings": ";;;;;;;;;;;;ACEO,IAAM,sBAAsB,IAAI;EACrC,MAAM;AACR,CAAC;AAEM,IAAM,mBAAmB,IAAI;EAClC,MAAM;AACR,CAAC;;;ACcD,IAAM,sBAA4B,oBAA+C,IAAI;AAErF,SAAS,yBAAmD;AAC1D,QAAM,MAAY,iBAAW,mBAAmB;AAChD,MAAI,CAAC,KAAK;AACR;MACE;MACA;IAAA;AAEF,UAAM,IAAI,MAAM,qEAAqE;EACvF;AACA,SAAO;AACT;AAaO,SAAS,aAAa;EAC3B,MAAM;EACN,cAAc;EACd;EACA;AACF,GAAsB;AACpB,QAAM,CAAC,kBAAkB,mBAAmB,IAAU,eAAS,WAAW;AAC1E,QAAM,eAAe,mBAAmB;AACxC,QAAM,OAAO,eAAe,iBAAiB;AAE7C,QAAM,mBAAyB;IAC7B,CAAC,SAAkB;AACjB,UAAI,CAAC,cAAc;AACjB,4BAAoB,IAAI;MAC1B;AACA,qBAAe,IAAI;IACrB;IACA,CAAC,cAAc,YAAY;EAAA;AAI7B,QAAM,YAAY,qBAA2B,YAAA,CAAO;AAEpD,QAAM,aAAmB,aAA2B,IAAI;AAExD,QAAM,MAAY;IAChB,OAAO;MACL;MACA,cAAc;MACd;MACA;IAAA;IAEF,CAAC,MAAM,kBAAkB,SAAS;EAAA;AAGpC,SAAa,oBAAc,oBAAoB,UAAU,EAAE,OAAO,IAAA,GAAO,QAAQ;AACnF;AAcO,IAAM,sBAA4B;EACvC,SAASA,qBAAoB,EAAE,UAAU,OAAO,SAAS,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AAA,GAAS,KAAK;AAC3D,WAAa,oBAAc,OAAO;MAChC;MACA,MAAM;MACN,WAAW,GAAG,4BAA4B,SAAS;MACnD,GAAG;IAAA,CACJ;EACH;AACF;AAQO,IAAM,oBAA0B;EACrC,SAASC,mBAAkB,EAAE,WAAW,GAAG,MAAA,GAAS,KAAK;AACvD,WAAa,oBAAc,OAAO;MAChC;MACA,WAAW,GAAG,qCAAqC,SAAS;MAC5D,GAAG;IAAA,CACJ;EACH;AACF;",
4
+ "sourcesContent": ["import type { AccessibilityProps, KeyboardHandlerMap } from '@refraction-ui/shared'\nimport { createMachine, Keys, generateId } from '@refraction-ui/shared'\n\nexport interface DropdownMenuProps {\n /** Whether the menu is open (controlled) */\n open?: boolean\n /** Whether the menu starts open (uncontrolled) */\n defaultOpen?: boolean\n /** Callback when open state changes */\n onOpenChange?: (open: boolean) => void\n}\n\nexport interface MenuItemProps {\n /** Whether the item is disabled */\n disabled?: boolean\n /** Callback when the item is selected */\n onSelect?: () => void\n}\n\nexport interface DropdownMenuState {\n open: boolean\n}\n\nexport interface DropdownMenuAPI {\n /** Current menu state */\n state: DropdownMenuState\n /** ARIA attributes for the trigger button */\n triggerProps: Partial<AccessibilityProps> & Record<string, unknown>\n /** ARIA attributes for the menu content */\n contentProps: Partial<AccessibilityProps> & Record<string, unknown>\n /** Factory for menu item props */\n getItemProps(item: MenuItemProps): Partial<AccessibilityProps> & Record<string, unknown>\n /** Open the menu */\n open(): void\n /** Close the menu */\n close(): void\n /** Toggle the menu */\n toggle(): void\n /** Keyboard handlers for the menu */\n keyboardHandlers: KeyboardHandlerMap\n /** Generated IDs for aria linking */\n ids: {\n content: string\n }\n}\n\nexport function createDropdownMenu(props: DropdownMenuProps = {}): DropdownMenuAPI {\n const { open: controlledOpen, defaultOpen = false, onOpenChange } = props\n\n const machine = createMachine<'open' | 'closed', 'OPEN' | 'CLOSE'>({\n initial: controlledOpen ?? defaultOpen ? 'open' : 'closed',\n states: {\n closed: { on: { OPEN: 'open' } },\n open: { on: { CLOSE: 'closed' } },\n },\n })\n\n const contentId = generateId('rfr-dropdown-menu')\n\n function isOpen(): boolean {\n if (controlledOpen !== undefined) return controlledOpen\n return machine.matches('open')\n }\n\n function openMenu(): void {\n machine.send('OPEN')\n onOpenChange?.(true)\n }\n\n function closeMenu(): void {\n machine.send('CLOSE')\n onOpenChange?.(false)\n }\n\n function toggleMenu(): void {\n if (isOpen()) {\n closeMenu()\n } else {\n openMenu()\n }\n }\n\n function getItemProps(item: MenuItemProps): Partial<AccessibilityProps> & Record<string, unknown> {\n return {\n role: 'menuitem',\n tabIndex: item.disabled ? -1 : 0,\n 'data-disabled': item.disabled ? '' : undefined,\n 'aria-disabled': item.disabled || undefined,\n }\n }\n\n const keyboardHandlers: KeyboardHandlerMap = {\n [Keys.Escape]: (e: KeyboardEvent) => {\n e.preventDefault()\n closeMenu()\n },\n [Keys.ArrowDown]: (e: KeyboardEvent) => {\n e.preventDefault()\n },\n [Keys.ArrowUp]: (e: KeyboardEvent) => {\n e.preventDefault()\n },\n [Keys.Enter]: (e: KeyboardEvent) => {\n e.preventDefault()\n },\n [Keys.Home]: (e: KeyboardEvent) => {\n e.preventDefault()\n },\n [Keys.End]: (e: KeyboardEvent) => {\n e.preventDefault()\n },\n }\n\n const triggerProps: Partial<AccessibilityProps> & Record<string, unknown> = {\n 'aria-expanded': isOpen(),\n 'aria-controls': contentId,\n 'aria-haspopup': 'menu',\n }\n\n const contentProps: Partial<AccessibilityProps> & Record<string, unknown> = {\n role: 'menu',\n id: contentId,\n 'data-state': isOpen() ? 'open' : 'closed',\n }\n\n return {\n state: { open: isOpen() },\n triggerProps,\n contentProps,\n getItemProps,\n open: openMenu,\n close: closeMenu,\n toggle: toggleMenu,\n keyboardHandlers,\n ids: {\n content: contentId,\n },\n }\n}\n", "import { cva } from '@refraction-ui/shared'\n\nexport const menuContentVariants = cva({\n base: 'z-50 rounded-md border bg-popover shadow-md',\n})\n\nexport const menuItemVariants = cva({\n base: 'relative flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n})\n", "import * as React from 'react'\nimport * as ReactDOM from 'react-dom'\nimport {\n menuContentVariants,\n menuItemVariants,\n type DropdownMenuProps as CoreDropdownMenuProps,\n type MenuItemProps as CoreMenuItemProps,\n} from '@refraction-ui/dropdown-menu'\nimport { cn, devWarn } from '@refraction-ui/shared'\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\ninterface DropdownMenuContextValue {\n open: boolean\n onOpenChange: (open: boolean) => void\n contentId: string\n /** The trigger element, so the portalled content can anchor to it. */\n triggerRef: React.MutableRefObject<HTMLElement | null>\n}\n\nconst DropdownMenuContext = React.createContext<DropdownMenuContextValue | null>(null)\n\nfunction useDropdownMenuContext(): DropdownMenuContextValue {\n const ctx = React.useContext(DropdownMenuContext)\n if (!ctx) {\n devWarn(\n 'react-dropdown-menu/context-outside-provider',\n 'DropdownMenu compound components (DropdownMenuTrigger/DropdownMenuContent/DropdownMenuItem/etc.) must be rendered inside a <DropdownMenu>. The missing DropdownMenuContext makes this throw.',\n )\n throw new Error('DropdownMenu compound components must be used within <DropdownMenu>')\n }\n return ctx\n}\n\n// ---------------------------------------------------------------------------\n// DropdownMenu (root provider)\n// ---------------------------------------------------------------------------\n\nexport interface DropdownMenuProps {\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n children?: React.ReactNode\n}\n\nexport function DropdownMenu({\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n children,\n}: DropdownMenuProps) {\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen)\n const isControlled = controlledOpen !== undefined\n const open = isControlled ? controlledOpen : uncontrolledOpen\n\n const handleOpenChange = React.useCallback(\n (next: boolean) => {\n if (!isControlled) {\n setUncontrolledOpen(next)\n }\n onOpenChange?.(next)\n },\n [isControlled, onOpenChange],\n )\n\n // React IDs agree across SSR and hydration, unlike the core's process counter.\n const contentId = `rfr-dropdown-menu-${React.useId()}`\n\n const triggerRef = React.useRef<HTMLElement | null>(null)\n\n const ctx = React.useMemo<DropdownMenuContextValue>(\n () => ({\n open,\n onOpenChange: handleOpenChange,\n contentId,\n triggerRef,\n }),\n [open, handleOpenChange, contentId],\n )\n\n return React.createElement(DropdownMenuContext.Provider, { value: ctx }, children)\n}\n\n// ---------------------------------------------------------------------------\n// DropdownMenuTrigger\n// ---------------------------------------------------------------------------\n\nexport interface DropdownMenuTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Merge the trigger's props/behavior onto the child element instead of\n * rendering a `<button>` around it (Radix-style `asChild`). Use it with\n * styled triggers like `<Button>` — otherwise you'd nest a button in a\n * button (invalid HTML and a hydration error). */\n asChild?: boolean\n}\n\nexport const DropdownMenuTrigger = React.forwardRef<HTMLButtonElement, DropdownMenuTriggerProps>(\n function DropdownMenuTrigger({ asChild = false, onClick, children, ...props }, ref) {\n const { open, onOpenChange, contentId, triggerRef } = useDropdownMenuContext()\n const setRefs = (node: HTMLButtonElement | null) => {\n triggerRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) ref.current = node\n }\n\n const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {\n onOpenChange(!open)\n onClick?.(e)\n }\n\n const triggerProps = {\n type: 'button' as const,\n 'aria-expanded': open,\n 'aria-controls': contentId,\n 'aria-haspopup': 'menu' as const,\n onClick: handleClick,\n ...props,\n }\n\n if (asChild) {\n if (!React.isValidElement(children)) {\n devWarn(\n 'dropdown-menu-trigger-asChild-child',\n 'DropdownMenuTrigger: `asChild` expects a single React element child; rendering nothing.',\n )\n return null\n }\n const child = children as React.ReactElement<\n Record<string, unknown>\n > & { ref?: React.Ref<HTMLButtonElement> }\n const childOnClick = child.props.onClick as\n | ((e: React.MouseEvent<HTMLButtonElement>) => void)\n | undefined\n const childRef = child.ref\n const mergedProps = {\n ...triggerProps,\n onClick: (e: React.MouseEvent<HTMLButtonElement>) => {\n childOnClick?.(e)\n if (!e.defaultPrevented) handleClick(e)\n },\n ref: (node: HTMLButtonElement | null) => {\n setRefs(node)\n if (typeof childRef === 'function') childRef(node)\n else if (childRef) childRef.current = node\n },\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return React.cloneElement(child, mergedProps as any)\n }\n\n return React.createElement('button', { ref: setRefs, ...triggerProps }, children)\n },\n)\n\n// ---------------------------------------------------------------------------\n// Positioning\n// ---------------------------------------------------------------------------\n\nexport type DropdownMenuAlign = 'start' | 'center' | 'end'\n\nconst DEFAULT_SIDE_OFFSET = 4\n\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect\n\n/**\n * Fixed-position coordinates that place a menu under its trigger, aligned to\n * the trigger's start, centre or end edge. Pure, so it is unit-testable.\n */\nexport function computeMenuPosition(\n trigger: { top: number; bottom: number; left: number; right: number; width: number },\n contentWidth: number,\n align: DropdownMenuAlign,\n sideOffset: number,\n): React.CSSProperties {\n const left =\n align === 'end'\n ? trigger.right - contentWidth\n : align === 'center'\n ? trigger.left + trigger.width / 2 - contentWidth / 2\n : trigger.left\n return { position: 'fixed', top: trigger.bottom + sideOffset, left: Math.max(0, left), minWidth: trigger.width }\n}\n\n// ---------------------------------------------------------------------------\n// DropdownMenuContent\n// ---------------------------------------------------------------------------\n\nexport interface DropdownMenuContentProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Horizontal alignment to the trigger. Defaults to `start`. */\n align?: DropdownMenuAlign\n /** Gap between trigger and menu in px. Defaults to 4. */\n sideOffset?: number\n}\n\nexport const DropdownMenuContent = React.forwardRef<HTMLDivElement, DropdownMenuContentProps>(\n function DropdownMenuContent(\n { className, children, onKeyDown, align = 'start', sideOffset = DEFAULT_SIDE_OFFSET, style, ...props },\n forwardedRef,\n ) {\n const { open, onOpenChange, contentId, triggerRef } = useDropdownMenuContext()\n const contentRef = React.useRef<HTMLDivElement | null>(null)\n const ref = React.useCallback(\n (node: HTMLDivElement | null) => {\n contentRef.current = node\n if (typeof forwardedRef === 'function') forwardedRef(node)\n else if (forwardedRef) forwardedRef.current = node\n },\n [forwardedRef],\n )\n const [position, setPosition] = React.useState<React.CSSProperties | null>(null)\n\n // The content is portalled to <body>, so anchor it to the trigger with\n // fixed coordinates, and follow the trigger on scroll / resize.\n useIsomorphicLayoutEffect(() => {\n if (!open) return\n const update = () => {\n const trigger = triggerRef.current\n const content = contentRef.current\n if (!trigger) return\n setPosition(\n computeMenuPosition(trigger.getBoundingClientRect(), content?.offsetWidth ?? 0, align, sideOffset),\n )\n }\n update()\n window.addEventListener('resize', update)\n window.addEventListener('scroll', update, true)\n return () => {\n window.removeEventListener('resize', update)\n window.removeEventListener('scroll', update, true)\n }\n }, [open, align, sideOffset, triggerRef])\n\n // Close on a pointer press outside the menu and its trigger.\n React.useEffect(() => {\n if (!open) return\n const onPointerDown = (event: PointerEvent) => {\n const target = event.target as Node\n if (contentRef.current?.contains(target) || triggerRef.current?.contains(target)) return\n onOpenChange(false)\n }\n document.addEventListener('pointerdown', onPointerDown)\n return () => document.removeEventListener('pointerdown', onPointerDown)\n }, [open, onOpenChange, triggerRef])\n\n React.useEffect(() => {\n if (!open) return\n // The initial portal layout can still be below the viewport when effects run.\n // Move keyboard focus without scrolling the document away from the trigger.\n contentRef.current?.querySelector<HTMLElement>('[role=\"menuitem\"]:not([aria-disabled=\"true\"])')?.focus({ preventScroll: true })\n }, [open])\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(e)\n if (e.defaultPrevented) return\n if (e.key === 'Escape') {\n e.preventDefault()\n onOpenChange(false)\n triggerRef.current?.focus()\n return\n }\n if (e.key === 'Tab') {\n // Native traversal must start from the trigger, before the portal unmounts.\n triggerRef.current?.focus()\n onOpenChange(false)\n return\n }\n if (!['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(e.key)) return\n const items = Array.from(contentRef.current?.querySelectorAll<HTMLElement>(\n '[role=\"menuitem\"]:not([aria-disabled=\"true\"])',\n ) ?? [])\n if (items.length === 0) return\n e.preventDefault()\n const current = items.indexOf(document.activeElement as HTMLElement)\n const index = e.key === 'Home' ? 0\n : e.key === 'End' ? items.length - 1\n : e.key === 'ArrowDown' ? (current + 1) % items.length\n : (current - 1 + items.length) % items.length\n items[index].focus()\n }\n\n if (!open) return null\n\n const content = React.createElement(\n 'div',\n {\n ref,\n role: 'menu',\n id: contentId,\n 'data-state': open ? 'open' : 'closed',\n className: cn(menuContentVariants(), className),\n style: position ? { ...position, ...style } : style,\n 'data-align': align,\n onKeyDown: handleKeyDown,\n tabIndex: -1,\n ...props,\n },\n children,\n )\n\n // Render via portal if document is available (client-side)\n if (typeof document !== 'undefined') {\n return ReactDOM.createPortal(content, document.body)\n }\n\n // SSR fallback: render inline\n return content\n },\n)\n\n// ---------------------------------------------------------------------------\n// DropdownMenuItem\n// ---------------------------------------------------------------------------\n\nexport interface DropdownMenuItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> {\n disabled?: boolean\n onSelect?: () => void\n}\n\nexport const DropdownMenuItem = React.forwardRef<HTMLDivElement, DropdownMenuItemProps>(\n function DropdownMenuItem({ className, disabled, onSelect, onClick, children, ...props }, ref) {\n const { onOpenChange, triggerRef } = useDropdownMenuContext()\n\n const handleClick = (e: React.MouseEvent<HTMLDivElement>) => {\n if (disabled) return\n onSelect?.()\n onOpenChange(false)\n triggerRef.current?.focus()\n onClick?.(e)\n }\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (disabled) return\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n onSelect?.()\n onOpenChange(false)\n triggerRef.current?.focus()\n }\n }\n\n return React.createElement(\n 'div',\n {\n ref,\n role: 'menuitem',\n tabIndex: disabled ? -1 : 0,\n 'data-disabled': disabled ? '' : undefined,\n 'aria-disabled': disabled || undefined,\n className: cn(menuItemVariants(), className),\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n ...props,\n },\n children,\n )\n },\n)\n\n// ---------------------------------------------------------------------------\n// DropdownMenuSeparator\n// ---------------------------------------------------------------------------\n\nexport interface DropdownMenuSeparatorProps extends React.HTMLAttributes<HTMLDivElement> {}\n\nexport const DropdownMenuSeparator = React.forwardRef<HTMLDivElement, DropdownMenuSeparatorProps>(\n function DropdownMenuSeparator({ className, ...props }, ref) {\n return React.createElement('div', {\n ref,\n role: 'separator',\n className: cn('-mx-1 my-1 h-px bg-muted', className),\n ...props,\n })\n },\n)\n\n// ---------------------------------------------------------------------------\n// DropdownMenuLabel\n// ---------------------------------------------------------------------------\n\nexport interface DropdownMenuLabelProps extends React.HTMLAttributes<HTMLDivElement> {}\n\nexport const DropdownMenuLabel = React.forwardRef<HTMLDivElement, DropdownMenuLabelProps>(\n function DropdownMenuLabel({ className, ...props }, ref) {\n return React.createElement('div', {\n ref,\n className: cn('px-2 py-1.5 text-sm font-semibold', className),\n ...props,\n })\n },\n)\n"],
5
+ "mappings": ";;;;;;;;;;;ACEO,IAAM,sBAAsB,IAAI;EACrC,MAAM;AACR,CAAC;AAEM,IAAM,mBAAmB,IAAI;EAClC,MAAM;AACR,CAAC;;;ACcD,IAAM,sBAA4B,oBAA+C,IAAI;AAErF,SAAS,yBAAmD;AAC1D,QAAM,MAAY,iBAAW,mBAAmB;AAChD,MAAI,CAAC,KAAK;AACR;MACE;MACA;IAAA;AAEF,UAAM,IAAI,MAAM,qEAAqE;EACvF;AACA,SAAO;AACT;AAaO,SAAS,aAAa;EAC3B,MAAM;EACN,cAAc;EACd;EACA;AACF,GAAsB;AACpB,QAAM,CAAC,kBAAkB,mBAAmB,IAAU,eAAS,WAAW;AAC1E,QAAM,eAAe,mBAAmB;AACxC,QAAM,OAAO,eAAe,iBAAiB;AAE7C,QAAM,mBAAyB;IAC7B,CAAC,SAAkB;AACjB,UAAI,CAAC,cAAc;AACjB,4BAAoB,IAAI;MAC1B;AACA,qBAAe,IAAI;IACrB;IACA,CA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,GAAG,MAAA,GAAS,KAAK;AACvD,WAAa,oBAAc,OAAO;MAChC;MACA,WAAW,GAAG,qCAAqC,SAAS;MAC5D,GAAG;IAAA,CACJ;EACH;AACF;",
6
6
  "names": ["DropdownMenuTrigger", "DropdownMenuContent", "content", "DropdownMenuItem", "DropdownMenuSeparator", "DropdownMenuLabel"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@refraction-ui/react",
3
- "version": "0.23.3",
3
+ "version": "0.24.0",
4
4
  "description": "All Refraction UI React components in one package — headless, accessible, zero-dependency",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",