@proyecto-viviana/solidaria 0.2.1 → 0.2.2

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.
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/interactions/createPress.ts", "../src/interactions/PressEvent.ts", "../src/utils/mergeProps.ts", "../src/utils/filterDOMProps.ts", "../src/utils/reactivity.ts", "../src/utils/platform.ts", "../src/utils/dom.ts", "../src/utils/geometry.ts", "../src/utils/events.ts", "../src/utils/textSelection.ts", "../src/utils/focus.ts", "../src/utils/globalListeners.ts", "../src/utils/env.ts", "../src/utils/createDescription.ts", "../src/interactions/createLongPress.ts", "../src/interactions/createMove.ts", "../src/interactions/createFocus.ts", "../src/interactions/createFocusWithin.ts", "../src/interactions/createFocusable.ts", "../src/interactions/createKeyboard.ts", "../src/interactions/createFocusRing.ts", "../src/interactions/createInteractionModality.ts", "../src/interactions/createHover.ts", "../src/button/createButton.ts", "../src/button/createToggleButton.ts", "../src/checkbox/createCheckbox.ts", "../src/toggle/index.ts", "../src/toggle/createToggle.ts", "../src/checkbox/index.ts", "../src/ssr/index.tsx", "../src/label/createLabels.ts", "../src/label/createLabel.ts", "../src/label/createField.ts", "../src/checkbox/createCheckboxGroup.ts", "../src/checkbox/createCheckboxGroupItem.ts", "../src/radio/index.ts", "../src/radio/createRadioGroup.ts", "../src/radio/createRadio.ts", "../src/switch/createSwitch.ts", "../src/link/createLink.ts", "../src/textfield/createTextField.ts", "../src/progress/createProgressBar.ts", "../src/separator/createSeparator.ts", "../src/toolbar/createToolbar.ts", "../src/i18n/locale.tsx", "../src/i18n/utils.ts", "../src/i18n/NumberFormatter.ts", "../src/i18n/createNumberFormatter.ts", "../src/i18n/createDateFormatter.ts", "../src/i18n/createCollator.ts", "../src/i18n/createFilter.ts", "../src/i18n/createStringFormatter.ts", "../src/autocomplete/createAutocomplete.ts", "../src/overlays/createPreventScroll.ts", "../src/overlays/createOverlayTrigger.ts", "../src/overlays/createOverlay.ts", "../src/overlays/createInteractOutside.ts", "../src/overlays/ariaHideOutside.ts", "../src/overlays/createModal.tsx", "../src/listbox/createListBox.ts", "../src/selection/createTypeSelect.ts", "../src/listbox/createOption.ts", "../src/menu/createMenu.ts", "../src/menu/createMenuItem.ts", "../src/menu/createMenuTrigger.ts", "../src/select/createSelect.ts", "../src/select/createHiddenSelect.tsx", "../src/form/createFormValidation.ts", "../src/tabs/createTabs.ts", "../src/breadcrumbs/createBreadcrumbs.ts", "../src/numberfield/createNumberField.ts", "../src/searchfield/createSearchField.ts", "../src/slider/createSlider.ts", "../src/tooltip/createTooltip.ts", "../src/tooltip/createTooltipTrigger.ts", "../src/combobox/createComboBox.ts", "../src/live-announcer/announce.ts", "../src/combobox/intl/en-US.json", "../src/combobox/intl/es-ES.json", "../src/combobox/intl/index.ts", "../src/dialog/createDialog.ts", "../src/toast/createToast.ts", "../src/toast/createToastRegion.ts", "../src/popover/createPopover.ts", "../src/popover/createOverlayPosition.ts", "../src/popover/calculatePosition.ts", "../src/focus/FocusScope.tsx", "../src/focus/createFocusRestore.ts", "../src/focus/createVirtualFocus.ts", "../src/focus/createAutoFocus.ts", "../src/disclosure/createDisclosure.ts", "../src/disclosure/createDisclosureGroup.ts", "../src/meter/createMeter.ts", "../src/tag/createTagGroup.ts", "../src/tag/createTag.ts", "../src/calendar/createCalendar.ts", "../src/calendar/createCalendarGrid.ts", "../src/calendar/createCalendarCell.ts", "../../../node_modules/.deno/@internationalized+date@3.10.1/node_modules/@internationalized/date/dist/packages/@internationalized/date/src/utils.ts", "../../../node_modules/.deno/@internationalized+date@3.10.1/node_modules/@internationalized/date/dist/packages/@internationalized/date/src/calendars/GregorianCalendar.ts", "../../../node_modules/.deno/@internationalized+date@3.10.1/node_modules/@internationalized/date/dist/packages/@internationalized/date/src/queries.ts", "../../../node_modules/.deno/@internationalized+date@3.10.1/node_modules/@internationalized/date/dist/packages/@internationalized/date/src/conversion.ts", "../../../node_modules/.deno/@internationalized+date@3.10.1/node_modules/@internationalized/date/dist/packages/@internationalized/date/src/manipulation.ts", "../../../node_modules/.deno/@internationalized+date@3.10.1/node_modules/@internationalized/date/dist/packages/@internationalized/date/src/string.ts", "../../../node_modules/.deno/@swc+helpers@0.5.18/node_modules/@swc/helpers/esm/_check_private_redeclaration.js", "../../../node_modules/.deno/@swc+helpers@0.5.18/node_modules/@swc/helpers/esm/_class_private_field_init.js", "../../../node_modules/.deno/@internationalized+date@3.10.1/node_modules/@internationalized/date/dist/packages/@internationalized/date/src/CalendarDate.ts", "../../../node_modules/.deno/@internationalized+date@3.10.1/node_modules/@internationalized/date/dist/packages/@internationalized/date/src/DateFormatter.ts", "../src/calendar/createRangeCalendar.ts", "../src/calendar/createRangeCalendarCell.ts", "../src/datepicker/createDateField.ts", "../src/datepicker/createDateSegment.ts", "../src/datepicker/createTimeField.ts", "../src/datepicker/createDatePicker.ts", "../src/grid/createGrid.ts", "../src/grid/GridKeyboardDelegate.ts", "../src/grid/createGridRow.ts", "../src/grid/createGridCell.ts", "../src/table/createTable.ts", "../src/table/createTableHeaderRow.ts", "../src/table/createTableColumnHeader.ts", "../src/table/createTableRow.ts", "../src/table/createTableCell.ts", "../src/table/createTableRowGroup.ts", "../src/table/createTableSelectionCheckbox.ts", "../src/table/createTableSelectAllCheckbox.ts", "../src/gridlist/createGridList.ts", "../src/gridlist/createGridListItem.ts", "../src/gridlist/createGridListSelectionCheckbox.ts", "../src/tree/createTree.ts", "../src/tree/createTreeItem.ts", "../src/tree/createTreeSelectionCheckbox.ts", "../src/color/createColorSlider.ts", "../src/color/createColorArea.ts", "../src/color/createColorWheel.ts", "../src/color/createColorField.ts", "../src/color/createColorSwatch.ts", "../src/dnd/createDrag.ts", "../src/dnd/utils.ts", "../src/dnd/createDrop.ts", "../src/dnd/createDraggableCollection.ts", "../src/dnd/createDroppableCollection.ts", "../src/dnd/createDraggableItem.ts", "../src/dnd/createDroppableItem.ts", "../src/landmark/createLandmark.ts", "../src/visually-hidden/createVisuallyHidden.ts", "../src/form/createFormReset.ts"],
4
+ "sourcesContent": ["/**\n * createPress - Handles press interactions across mouse, touch, keyboard, and virtual clicks.\n *\n * This is a 1-1 port of React-Aria's usePress hook adapted for SolidJS.\n * All behaviors, edge cases, and platform-specific handling are preserved.\n */\n\nimport { createSignal, JSX, Accessor, onCleanup } from 'solid-js';\nimport { PressEvent, PointerType, createPressEvent, BaseEventForPress } from './PressEvent';\nimport {\n nodeContains,\n getEventTarget,\n isValidKeyboardEvent,\n isHTMLAnchorLink,\n shouldPreventDefaultKeyboard,\n isVirtualClick,\n isVirtualPointerEvent,\n isPointOverTarget,\n getTouchFromEvent,\n getTouchById,\n disableTextSelection,\n restoreTextSelection,\n preventFocus,\n openLink,\n isMac,\n createGlobalListeners,\n setEventTarget,\n} from '../utils';\n\n// Re-export PressEvent types\nexport { PressEvent, type PointerType } from './PressEvent';\nexport type { IPressEvent, PressEventType } from './PressEvent';\n\nexport interface CreatePressProps {\n /** Whether the target is currently disabled. */\n isDisabled?: Accessor<boolean> | boolean;\n /** Handler called when the press is released over the target. */\n onPress?: (e: PressEvent) => void;\n /** Handler called when a press interaction starts. */\n onPressStart?: (e: PressEvent) => void;\n /**\n * Handler called when a press interaction ends, either\n * over the target or when the pointer leaves the target.\n */\n onPressEnd?: (e: PressEvent) => void;\n /** Handler called when a press is released over the target, regardless of whether it started on the target. */\n onPressUp?: (e: PressEvent) => void;\n /** Handler called when the press state changes. */\n onPressChange?: (isPressed: boolean) => void;\n /**\n * Handler called on native click event.\n * Some third-party libraries pass onClick instead of onPress.\n * This matches the browser's native activation behavior for certain elements.\n */\n onClick?: (e: MouseEvent) => void;\n /** Whether the press should be visual only, not triggering onPress. */\n isPressed?: Accessor<boolean> | boolean;\n /** Whether to prevent focus when pressing. */\n preventFocusOnPress?: boolean;\n /** Whether long press should cancel when pointer moves out of target. */\n shouldCancelOnPointerExit?: boolean;\n /** Whether text selection should be allowed during press. */\n allowTextSelectionOnPress?: boolean;\n}\n\nexport interface PressResult {\n /** Whether the target is currently pressed. */\n isPressed: Accessor<boolean>;\n /** Props to spread on the target element. */\n pressProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\nfunction isDisabledValue(isDisabled: Accessor<boolean> | boolean | undefined): boolean {\n if (typeof isDisabled === 'function') {\n return isDisabled();\n }\n return isDisabled ?? false;\n}\n\nfunction isPressedValue(isPressed: Accessor<boolean> | boolean | undefined): boolean {\n if (typeof isPressed === 'function') {\n return isPressed();\n }\n return isPressed ?? false;\n}\n\n// Symbol to track if a link click was handled by us\nconst LINK_CLICKED = Symbol('linkClicked');\n\n// CSS for preventing double-tap zoom delay\nlet pressableCSSInjected = false;\nfunction injectPressableCSS(): void {\n if (pressableCSSInjected || typeof document === 'undefined') return;\n\n const style = document.createElement('style');\n style.id = 'solidaria-pressable-style';\n style.textContent = `\n [data-solidaria-pressable] {\n touch-action: pan-x pan-y pinch-zoom;\n }\n `;\n document.head.appendChild(style);\n pressableCSSInjected = true;\n}\n\n/**\n * Handles press interactions across mouse, touch, keyboard, and screen readers.\n * Provides consistent press behavior regardless of input method.\n *\n * Based on react-aria's usePress but adapted for SolidJS.\n */\nexport function createPress(props: CreatePressProps = {}): PressResult {\n // Internal pressed state (for visual feedback)\n const [internalIsPressed, setInternalIsPressed] = createSignal(false);\n\n // Use controlled isPressed if provided, otherwise internal state\n const isPressed = (): boolean => {\n const controlledPressed = isPressedValue(props.isPressed);\n if (controlledPressed) {\n return controlledPressed;\n }\n return internalIsPressed();\n };\n\n // State tracking (using plain variables - SolidJS doesn't need refs for mutable state)\n let pressState = {\n isPressed: false,\n ignoreEmulatedMouseEvents: false,\n ignoreClickAfterPress: false,\n didFirePressStart: false,\n isTriggeringEvent: false,\n activePointerId: null as number | null,\n target: null as Element | null,\n isOverTarget: false,\n pointerType: null as PointerType | null,\n userSelect: undefined as string | undefined,\n metaKeyEvents: null as Map<string, KeyboardEvent> | null,\n clickCleanup: null as (() => void) | null,\n };\n\n // Global listeners manager\n const { addGlobalListener, removeAllGlobalListeners } = createGlobalListeners();\n\n // Inject CSS on first use\n injectPressableCSS();\n\n // --- Event Triggers ---\n\n const triggerPressStart = (originalEvent: BaseEventForPress | Event, pointerType: PointerType): boolean => {\n if (isDisabledValue(props.isDisabled) || pressState.didFirePressStart) {\n return false;\n }\n\n let shouldStopPropagation = true;\n pressState.isTriggeringEvent = true;\n\n if (props.onPressStart) {\n const event = createPressEvent('pressstart', pointerType, originalEvent, pressState.target!);\n props.onPressStart(event);\n shouldStopPropagation = event.shouldStopPropagation;\n }\n\n if (props.onPressChange) {\n props.onPressChange(true);\n }\n\n pressState.isTriggeringEvent = false;\n pressState.didFirePressStart = true;\n setInternalIsPressed(true);\n\n return shouldStopPropagation;\n };\n\n const triggerPressEnd = (originalEvent: BaseEventForPress | Event, pointerType: PointerType, wasPressed = true): boolean => {\n if (!pressState.didFirePressStart) {\n return true;\n }\n\n pressState.didFirePressStart = false;\n pressState.isTriggeringEvent = true;\n\n let shouldStopPropagation = true;\n if (props.onPressEnd) {\n const event = createPressEvent('pressend', pointerType, originalEvent, pressState.target!);\n props.onPressEnd(event);\n shouldStopPropagation = event.shouldStopPropagation;\n }\n\n if (props.onPressChange) {\n props.onPressChange(false);\n }\n\n setInternalIsPressed(false);\n\n if (wasPressed && !isDisabledValue(props.isDisabled)) {\n if (props.onPress) {\n const event = createPressEvent('press', pointerType, originalEvent, pressState.target!);\n props.onPress(event);\n }\n }\n\n pressState.isTriggeringEvent = false;\n\n return shouldStopPropagation;\n };\n\n const triggerPressUp = (originalEvent: BaseEventForPress | Event, pointerType: PointerType): boolean => {\n if (isDisabledValue(props.isDisabled)) {\n return true;\n }\n\n if (props.onPressUp) {\n pressState.isTriggeringEvent = true;\n const event = createPressEvent('pressup', pointerType, originalEvent, pressState.target!);\n props.onPressUp(event);\n pressState.isTriggeringEvent = false;\n return event.shouldStopPropagation;\n }\n\n return true;\n };\n\n const triggerSyntheticClick = (originalEvent: KeyboardEvent | TouchEvent, target: HTMLElement): void => {\n if (isDisabledValue(props.isDisabled)) {\n return;\n }\n\n if (props.onClick) {\n const event = new MouseEvent('click', originalEvent as MouseEventInit);\n setEventTarget(event, target);\n props.onClick(event);\n }\n };\n\n const cancel = (originalEvent: BaseEventForPress | Event): void => {\n if (!pressState.isPressed) {\n return;\n }\n\n if (pressState.target && pressState.didFirePressStart && pressState.pointerType != null) {\n triggerPressEnd(originalEvent, pressState.pointerType, false);\n }\n\n pressState.isPressed = false;\n pressState.isOverTarget = false;\n pressState.activePointerId = null;\n pressState.pointerType = null;\n\n removeAllGlobalListeners();\n\n // Clean up click timeout/listener if set\n if (pressState.clickCleanup) {\n pressState.clickCleanup();\n pressState.clickCleanup = null;\n }\n\n if (!props.allowTextSelectionOnPress) {\n restoreTextSelection(pressState.target as HTMLElement);\n }\n };\n\n // --- Pointer Event Handlers (used when PointerEvent is available) ---\n\n const onPointerDown: JSX.EventHandler<HTMLElement, PointerEvent> = (e) => {\n // Only handle left clicks, and ignore events that bubbled through portals\n const button = e.button ?? 0;\n if (button !== 0 || !nodeContains(e.currentTarget, getEventTarget(e))) {\n return;\n }\n\n // iOS VoiceOver bug: fires pointer events with incorrect coordinates\n // Let the click handler deal with it instead\n if (isVirtualPointerEvent(e)) {\n pressState.pointerType = 'virtual';\n return;\n }\n\n pressState.pointerType = e.pointerType as PointerType;\n\n if (!pressState.isPressed) {\n pressState.isPressed = true;\n pressState.isOverTarget = true;\n pressState.activePointerId = e.pointerId;\n pressState.target = e.currentTarget;\n\n if (!props.allowTextSelectionOnPress) {\n disableTextSelection(pressState.target as HTMLElement);\n }\n\n const shouldStopPropagation = triggerPressStart(e, pressState.pointerType);\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n\n // Set up global listeners for pointer events\n addGlobalListener('pointerup', onPointerUp);\n addGlobalListener('pointercancel', onPointerCancel);\n }\n };\n\n // Mouse down handler when using pointer events - only prevents focus, doesn't trigger press\n const onMouseDownPointer: JSX.EventHandler<HTMLElement, MouseEvent> = (e) => {\n if (!nodeContains(e.currentTarget, getEventTarget(e))) {\n return;\n }\n\n if (e.button === 0) {\n // Prevent focus if requested\n if (props.preventFocusOnPress) {\n preventFocus(e.currentTarget);\n }\n e.stopPropagation();\n }\n };\n\n const onPointerUp = (e: PointerEvent): void => {\n // Only handle events for our active pointer\n const button = e.button ?? 0;\n if (e.pointerId !== pressState.activePointerId || !pressState.isPressed || button !== 0 || !pressState.target) {\n return;\n }\n\n const isOverTarget = nodeContains(pressState.target, getEventTarget(e) as Element);\n if (isOverTarget && pressState.pointerType != null && pressState.pointerType !== 'virtual') {\n // Pointer released over target - wait for onClick to complete the press sequence.\n // This matches React-Aria's behavior for compatibility with DOM mutations and third-party libraries.\n // https://github.com/adobe/react-spectrum/issues/1513\n // https://issues.chromium.org/issues/40732224\n //\n // However, if stopPropagation is called on the click event (e.g., by a child input element),\n // the onClick handler on this element won't fire. We work around this by triggering a click\n // ourselves after a timeout. This timeout is canceled during the click event in case the\n // real one fires first. The timeout must be at least 32ms, because Safari on iOS delays the\n // click event on non-form elements without certain ARIA roles (for hover emulation).\n // https://github.com/WebKit/WebKit/blob/dccfae42bb29bd4bdef052e469f604a9387241c0/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm#L875-L892\n let clickFired = false;\n const timeout = setTimeout(() => {\n // Guard for SSR/test environments where the element may no longer exist\n if (typeof HTMLElement === 'undefined') {\n return;\n }\n if (pressState.isPressed && pressState.target instanceof HTMLElement) {\n if (clickFired) {\n // Click already happened, just cancel the press state\n cancel(e);\n } else {\n // Click didn't happen (probably due to stopPropagation), trigger it manually\n pressState.target.focus();\n pressState.target.click();\n }\n }\n }, 80);\n\n // Use a capturing listener to track if a click occurred.\n // If stopPropagation is called it may never reach our handler.\n const doc = pressState.target.ownerDocument ?? document;\n const clickListener = () => {\n clickFired = true;\n };\n doc.addEventListener('click', clickListener, true);\n\n // Store cleanup function\n pressState.clickCleanup = () => {\n clearTimeout(timeout);\n doc.removeEventListener('click', clickListener, true);\n };\n\n pressState.isOverTarget = false;\n } else {\n // Pointer released outside target, or virtual - cancel the press\n cancel(e);\n }\n };\n\n const onPointerCancel = (e: PointerEvent): void => {\n if (e.pointerId === pressState.activePointerId) {\n cancel(e);\n }\n };\n\n const onPointerEnter: JSX.EventHandler<HTMLElement, PointerEvent> = (e) => {\n if (e.pointerId === pressState.activePointerId && pressState.target && !pressState.isOverTarget && pressState.pointerType != null) {\n pressState.isOverTarget = true;\n triggerPressStart(e, pressState.pointerType);\n }\n };\n\n const onPointerLeave: JSX.EventHandler<HTMLElement, PointerEvent> = (e) => {\n if (e.pointerId === pressState.activePointerId && pressState.target && pressState.isOverTarget && pressState.pointerType != null) {\n pressState.isOverTarget = false;\n triggerPressEnd(e, pressState.pointerType, false);\n\n if (props.shouldCancelOnPointerExit) {\n cancel(e);\n }\n }\n };\n\n // --- Touch Event Helpers ---\n\n const createTouchEvent = (target: Element, event: TouchEvent): BaseEventForPress => {\n let clientX = 0;\n let clientY = 0;\n if (event.targetTouches && event.targetTouches.length === 1) {\n clientX = event.targetTouches[0].clientX;\n clientY = event.targetTouches[0].clientY;\n }\n return {\n currentTarget: target,\n shiftKey: event.shiftKey,\n ctrlKey: event.ctrlKey,\n metaKey: event.metaKey,\n altKey: event.altKey,\n clientX,\n clientY,\n };\n };\n\n // --- Touch Event Handlers (fallback for testing/older browsers) ---\n\n const onTouchStart: JSX.EventHandler<HTMLElement, TouchEvent> = (e) => {\n if (isDisabledValue(props.isDisabled)) {\n return;\n }\n\n // If already pressed via pointer events, ignore touch events\n if (pressState.isPressed) {\n return;\n }\n\n const touch = getTouchFromEvent(e);\n if (!touch) {\n return;\n }\n\n pressState.activePointerId = touch.identifier;\n pressState.ignoreEmulatedMouseEvents = true;\n pressState.isOverTarget = true;\n pressState.isPressed = true;\n pressState.target = e.currentTarget;\n pressState.pointerType = 'touch';\n\n if (!props.allowTextSelectionOnPress) {\n disableTextSelection(pressState.target as HTMLElement);\n }\n\n const shouldStopPropagation = triggerPressStart(createTouchEvent(pressState.target, e), 'touch');\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n\n addGlobalListener('scroll', onScroll, { capture: true, isWindow: true });\n };\n\n const onTouchMove: JSX.EventHandler<HTMLElement, TouchEvent> = (e) => {\n if (!pressState.isPressed) {\n return;\n }\n\n const touch = getTouchById(e, pressState.activePointerId);\n if (!touch) {\n return;\n }\n\n const target = pressState.target!;\n const isOverTarget = isPointOverTarget(touch, target);\n\n if (isOverTarget !== pressState.isOverTarget) {\n pressState.isOverTarget = isOverTarget;\n if (isOverTarget) {\n triggerPressStart(createTouchEvent(target, e), 'touch');\n } else {\n triggerPressEnd(createTouchEvent(target, e), 'touch', false);\n\n if (props.shouldCancelOnPointerExit) {\n cancel(createTouchEvent(target, e));\n }\n }\n }\n };\n\n const onTouchEnd: JSX.EventHandler<HTMLElement, TouchEvent> = (e) => {\n if (!pressState.isPressed) {\n return;\n }\n\n const touch = getTouchById(e, pressState.activePointerId);\n if (!touch) {\n return;\n }\n\n const target = pressState.target!;\n const isOverTarget = isPointOverTarget(touch, target);\n\n if (isOverTarget) {\n triggerPressUp(createTouchEvent(target, e), 'touch');\n }\n\n triggerPressEnd(createTouchEvent(target, e), 'touch', isOverTarget && pressState.isOverTarget);\n\n pressState.isPressed = false;\n pressState.isOverTarget = false;\n pressState.activePointerId = null;\n pressState.pointerType = null;\n\n removeAllGlobalListeners();\n\n if (!props.allowTextSelectionOnPress) {\n restoreTextSelection(target as HTMLElement);\n }\n };\n\n const onTouchCancel: JSX.EventHandler<HTMLElement, TouchEvent> = (e) => {\n if (pressState.target) {\n cancel(createTouchEvent(pressState.target, e));\n } else {\n cancel(e);\n }\n };\n\n const onScroll = (e: Event): void => {\n if (pressState.isPressed && nodeContains(e.target as Element, pressState.target)) {\n cancel(e);\n }\n };\n\n // --- Mouse Event Handlers (fallback when PointerEvent is not available) ---\n\n const onMouseDownFallback: JSX.EventHandler<HTMLElement, MouseEvent> = (e) => {\n // Only handle left button\n if (e.button !== 0) {\n return;\n }\n\n // Ignore emulated mouse events from touch\n if (pressState.ignoreEmulatedMouseEvents) {\n e.stopPropagation();\n return;\n }\n\n pressState.isPressed = true;\n pressState.isOverTarget = true;\n pressState.target = e.currentTarget;\n pressState.pointerType = isVirtualClick(e) ? 'virtual' : 'mouse';\n\n const shouldStopPropagation = triggerPressStart(e, pressState.pointerType);\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n\n addGlobalListener('mouseup', onMouseUpFallback);\n };\n\n const onMouseUpFallback = (e: MouseEvent): void => {\n if (e.button !== 0) {\n return;\n }\n\n if (!pressState.ignoreEmulatedMouseEvents && e.button === 0 && !pressState.isPressed) {\n triggerPressUp(e, pressState.pointerType || 'mouse');\n }\n };\n\n const onMouseEnterFallback: JSX.EventHandler<HTMLElement, MouseEvent> = (e) => {\n if (!pressState.isPressed || pressState.ignoreEmulatedMouseEvents) {\n return;\n }\n\n if (pressState.isPressed && !pressState.ignoreEmulatedMouseEvents && pressState.pointerType != null) {\n pressState.isOverTarget = true;\n triggerPressStart(e, pressState.pointerType);\n }\n };\n\n const onMouseLeaveFallback: JSX.EventHandler<HTMLElement, MouseEvent> = (e) => {\n if (!pressState.isPressed || pressState.ignoreEmulatedMouseEvents) {\n return;\n }\n\n if (pressState.isPressed && !pressState.ignoreEmulatedMouseEvents && pressState.pointerType != null) {\n pressState.isOverTarget = false;\n triggerPressEnd(e, pressState.pointerType, false);\n\n if (props.shouldCancelOnPointerExit) {\n cancel(e);\n }\n }\n };\n\n // --- Keyboard Event Handlers ---\n\n const onKeyDown: JSX.EventHandler<HTMLElement, KeyboardEvent> = (e) => {\n if (isDisabledValue(props.isDisabled)) {\n return;\n }\n\n if (!isValidKeyboardEvent(e, e.currentTarget)) {\n // Allow event to propagate for invalid keys\n if (e.key === 'Enter') {\n e.stopPropagation();\n }\n return;\n }\n\n // Prevent key repeat\n if (e.repeat) {\n e.preventDefault();\n return;\n }\n\n pressState.target = e.currentTarget;\n pressState.isPressed = true;\n pressState.isOverTarget = true;\n pressState.pointerType = 'keyboard';\n\n const shouldStopPropagation = triggerPressStart(e, 'keyboard');\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n\n // Prevent default for non-native interactive elements\n if (shouldPreventDefaultKeyboard(e.currentTarget, e.key)) {\n e.preventDefault();\n }\n\n // macOS bug: keyup doesn't fire while Meta key is held\n // Track keydown events while Meta is held so we can manually dispatch keyup\n if (isMac() && e.metaKey && !e.ctrlKey && !e.altKey) {\n pressState.metaKeyEvents = pressState.metaKeyEvents || new Map();\n pressState.metaKeyEvents.set(e.key, e);\n }\n\n // For Enter key on native buttons, the click fires on keydown\n // Set flag to ignore it\n if (e.key === 'Enter') {\n pressState.ignoreClickAfterPress = true;\n }\n\n // Set up global keyup listener\n addGlobalListener('keyup', onKeyUp, { capture: true });\n };\n\n const onKeyUp = (e: KeyboardEvent): void => {\n if (!pressState.isPressed || pressState.pointerType !== 'keyboard') {\n return;\n }\n\n if (!isValidKeyboardEvent(e, pressState.target!)) {\n return;\n }\n\n // Handle macOS Meta key bug\n if (isMac() && e.key === 'Meta' && pressState.metaKeyEvents?.size) {\n // When Meta releases, dispatch keyup for any keys that were pressed during\n for (const [key, event] of pressState.metaKeyEvents) {\n pressState.target?.dispatchEvent(\n new KeyboardEvent('keyup', {\n key,\n code: event.code,\n bubbles: true,\n cancelable: true,\n })\n );\n }\n pressState.metaKeyEvents.clear();\n return;\n }\n\n const target = pressState.target!;\n const shouldStopPropagation = triggerPressUp(e, 'keyboard');\n const shouldStopPropagationEnd = triggerPressEnd(e, 'keyboard', pressState.isOverTarget);\n\n pressState.isPressed = false;\n pressState.pointerType = null;\n\n removeAllGlobalListeners();\n\n // Prevent default to avoid triggering native action\n e.preventDefault();\n\n // Fire synthetic click for keyboard activation\n if (pressState.isOverTarget && pressState.target) {\n triggerSyntheticClick(e, pressState.target as HTMLElement);\n }\n\n // Handle link activation with non-Enter keys (Space)\n // Native links only respond to Enter, but we want Space to work too\n if (e.key === ' ' && isHTMLAnchorLink(target) && !(target as any)[LINK_CLICKED]) {\n (target as any)[LINK_CLICKED] = true;\n openLink(target as HTMLAnchorElement, e);\n // Clean up the marker\n setTimeout(() => {\n delete (target as any)[LINK_CLICKED];\n }, 0);\n }\n\n // For Space key, the click fires after keyup\n // Set flag to ignore it\n if (e.key === ' ') {\n pressState.ignoreClickAfterPress = true;\n }\n\n if (shouldStopPropagation && shouldStopPropagationEnd) {\n e.stopPropagation();\n }\n };\n\n // --- Click Event Handler ---\n\n const onClick: JSX.EventHandler<HTMLElement, MouseEvent> = (e) => {\n // Don't handle click if it's not on the target\n if (!nodeContains(e.currentTarget, e.target as Element)) {\n return;\n }\n\n // Only process left clicks that aren't from our own event triggers\n if (e.button === 0 && !pressState.isTriggeringEvent) {\n if (pressState.ignoreClickAfterPress) {\n pressState.ignoreClickAfterPress = false;\n return;\n }\n\n if (isDisabledValue(props.isDisabled)) {\n e.preventDefault();\n return;\n }\n\n // Call user's onClick handler if provided\n // This matches React-Aria's behavior for third-party library compatibility\n props.onClick?.(e);\n\n // If triggered from a screen reader or by using element.click(),\n // trigger as if it were a keyboard/virtual click.\n let shouldStopPropagation = true;\n\n if (\n !pressState.ignoreEmulatedMouseEvents &&\n !pressState.isPressed &&\n (pressState.pointerType === 'virtual' || isVirtualClick(e))\n ) {\n pressState.target = e.currentTarget;\n shouldStopPropagation = triggerPressStart(e, 'virtual');\n shouldStopPropagation = triggerPressUp(e, 'virtual') && shouldStopPropagation;\n shouldStopPropagation = triggerPressEnd(e, 'virtual', true) && shouldStopPropagation;\n } else if (pressState.isPressed && pressState.pointerType !== 'keyboard') {\n // Complete the press sequence for pointer/touch/mouse events\n const pointerType =\n pressState.pointerType ||\n ((e as unknown as PointerEvent).pointerType as PointerType) ||\n 'virtual';\n shouldStopPropagation = triggerPressUp(e, pointerType);\n shouldStopPropagation = triggerPressEnd(e, pointerType, true) && shouldStopPropagation;\n pressState.isOverTarget = false;\n cancel(e);\n }\n\n pressState.ignoreEmulatedMouseEvents = false;\n\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n }\n };\n\n // --- Drag Event Handler ---\n\n const onDragStart: JSX.EventHandler<HTMLElement, DragEvent> = (e) => {\n // Safari doesn't fire pointercancel on drag, so we need to cancel manually\n if (pressState.isPressed) {\n cancel(e);\n }\n };\n\n // --- Build Props ---\n // Conditionally use pointer events or mouse events based on browser support\n // This matches React-Aria's approach exactly\n\n const pressProps: JSX.HTMLAttributes<HTMLElement> & { 'data-solidaria-pressable': string } =\n typeof PointerEvent !== 'undefined'\n ? {\n // Keyboard events\n onKeyDown,\n onKeyUp,\n onClick,\n onDragStart,\n // Pointer events (preferred when available)\n onPointerDown,\n onPointerEnter,\n onPointerLeave,\n // Mouse down only for focus prevention when using pointer events\n onMouseDown: onMouseDownPointer,\n // Touch events (always included for ignoreEmulatedMouseEvents handling)\n onTouchStart,\n onTouchMove,\n onTouchEnd,\n onTouchCancel,\n // Attribute for CSS touch-action\n 'data-solidaria-pressable': '',\n }\n : {\n // Keyboard events\n onKeyDown,\n onKeyUp,\n onClick,\n onDragStart,\n // Mouse events (fallback when PointerEvent not available)\n onMouseDown: onMouseDownFallback,\n onMouseUp: onMouseUpFallback,\n onMouseEnter: onMouseEnterFallback,\n onMouseLeave: onMouseLeaveFallback,\n // Touch events (always included)\n onTouchStart,\n onTouchMove,\n onTouchEnd,\n onTouchCancel,\n // Attribute for CSS touch-action\n 'data-solidaria-pressable': '',\n };\n\n // Clean up on unmount\n onCleanup(() => {\n removeAllGlobalListeners();\n // Clean up click timeout/listener if pending\n if (pressState.clickCleanup) {\n pressState.clickCleanup();\n pressState.clickCleanup = null;\n }\n });\n\n return {\n isPressed,\n pressProps,\n };\n}\n", "/**\n * PressEvent class that matches React-Aria's PressEvent interface.\n * Wraps native events with press-specific data.\n */\n\nexport type PointerType = 'mouse' | 'pen' | 'touch' | 'keyboard' | 'virtual';\nexport type PressEventType = 'pressstart' | 'pressend' | 'pressup' | 'press';\n\n/** Base event properties needed for press event creation */\nexport interface BaseEventForPress {\n currentTarget: EventTarget | null;\n shiftKey: boolean;\n ctrlKey: boolean;\n metaKey: boolean;\n altKey: boolean;\n clientX?: number;\n clientY?: number;\n}\n\nexport interface IPressEvent {\n /** The type of press event being fired. */\n type: PressEventType;\n /** The pointer type that triggered the press event. */\n pointerType: PointerType;\n /** The target element of the press event. */\n target: Element;\n /** Whether the shift keyboard modifier was held during the press event. */\n shiftKey: boolean;\n /** Whether the ctrl keyboard modifier was held during the press event. */\n ctrlKey: boolean;\n /** Whether the meta keyboard modifier was held during the press event. */\n metaKey: boolean;\n /** Whether the alt keyboard modifier was held during the press event. */\n altKey: boolean;\n /** X position of the press relative to the target element. */\n x: number;\n /** Y position of the press relative to the target element. */\n y: number;\n /**\n * By default, press events stop propagation to parent elements.\n * Call continuePropagation() to allow the event to bubble up.\n */\n continuePropagation(): void;\n}\n\n/**\n * PressEvent class that provides all press event data.\n * Based on React-Aria's PressEvent implementation.\n */\nexport class PressEvent implements IPressEvent {\n type: PressEventType;\n pointerType: PointerType;\n target: Element;\n shiftKey: boolean;\n ctrlKey: boolean;\n metaKey: boolean;\n altKey: boolean;\n x: number;\n y: number;\n\n #shouldStopPropagation = true;\n\n constructor(\n type: PressEventType,\n pointerType: PointerType,\n originalEvent: Event | null,\n target: Element | null\n ) {\n this.type = type;\n this.pointerType = pointerType;\n const eventTarget = target ?? ((originalEvent as any)?.currentTarget as Element | undefined);\n this.target = eventTarget as Element;\n\n // Extract modifier keys from the original event\n const e = originalEvent as MouseEvent | KeyboardEvent | null;\n this.shiftKey = e?.shiftKey ?? false;\n this.ctrlKey = e?.ctrlKey ?? false;\n this.metaKey = e?.metaKey ?? false;\n this.altKey = e?.altKey ?? false;\n\n // Calculate position relative to target\n this.x = 0;\n this.y = 0;\n\n if (originalEvent && 'clientX' in originalEvent && eventTarget) {\n const rect = eventTarget.getBoundingClientRect();\n this.x = (originalEvent as MouseEvent).clientX - rect.left;\n this.y = (originalEvent as MouseEvent).clientY - rect.top;\n } else if (eventTarget) {\n // For keyboard events, use center of element\n const rect = eventTarget.getBoundingClientRect();\n this.x = rect.width / 2;\n this.y = rect.height / 2;\n }\n }\n\n /**\n * Call this to allow the press event to propagate to parent elements.\n * By default, press events stop propagation.\n */\n continuePropagation(): void {\n this.#shouldStopPropagation = false;\n }\n\n /**\n * Whether the event should stop propagation.\n * Used internally by the press handler.\n */\n get shouldStopPropagation(): boolean {\n return this.#shouldStopPropagation;\n }\n}\n\n/**\n * Creates a PressEvent from a native event.\n */\nexport function createPressEvent(\n type: PressEventType,\n pointerType: PointerType,\n originalEvent: BaseEventForPress | Event | null,\n target: Element | null\n): PressEvent {\n return new PressEvent(type, pointerType, originalEvent as Event | null, target);\n}\n", "type Props = { [key: string]: unknown };\n\n/**\n * Merges multiple props objects together, handling event handlers specially\n * by chaining them rather than replacing.\n *\n * Based on react-aria's mergeProps but adapted for SolidJS.\n *\n * @param args - Props objects to merge\n * @returns Merged props object. Use type parameter R to specify the result type.\n */\nexport function mergeProps<R extends object = Record<string, unknown>, T extends object = object>(...args: T[]): R {\n const result: Props = {};\n\n for (const props of args) {\n for (const key in props) {\n const value = props[key];\n const existingValue = result[key];\n\n if (\n typeof existingValue === 'function' &&\n typeof value === 'function' &&\n key.startsWith('on') &&\n key[2] === key[2]?.toUpperCase()\n ) {\n // Chain event handlers\n result[key] = chainHandlers(existingValue as Function, value as Function);\n } else if (key === 'class' || key === 'className') {\n // Merge class names\n result[key] = mergeClassNames(existingValue, value);\n } else if (key === 'style' && typeof existingValue === 'object' && typeof value === 'object') {\n // Merge style objects\n result[key] = { ...(existingValue as object), ...(value as object) };\n } else if (value !== undefined) {\n result[key] = value;\n }\n }\n }\n\n return result as R;\n}\n\nfunction chainHandlers(existingHandler: Function, newHandler: Function) {\n return (...args: unknown[]) => {\n existingHandler(...args);\n newHandler(...args);\n };\n}\n\nfunction mergeClassNames(...classes: unknown[]): string {\n return classes.filter(Boolean).join(' ');\n}\n", "/**\n * filterDOMProps for Solidaria\n *\n * Filters out all props that aren't valid DOM props.\n * This is a 1:1 port of @react-aria/utils filterDOMProps.\n */\n\nconst DOMPropNames = new Set(['id']);\n\nconst labelablePropNames = new Set([\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n 'aria-details',\n]);\n\n// See LinkDOMProps in dom.d.ts.\nconst linkPropNames = new Set([\n 'href',\n 'hrefLang',\n 'target',\n 'rel',\n 'download',\n 'ping',\n 'referrerPolicy',\n]);\n\nconst globalAttrs = new Set(['dir', 'lang', 'hidden', 'inert', 'translate']);\n\nconst globalEvents = new Set([\n 'onClick',\n 'onAuxClick',\n 'onContextMenu',\n 'onDoubleClick',\n 'onMouseDown',\n 'onMouseEnter',\n 'onMouseLeave',\n 'onMouseMove',\n 'onMouseOut',\n 'onMouseOver',\n 'onMouseUp',\n 'onTouchCancel',\n 'onTouchEnd',\n 'onTouchMove',\n 'onTouchStart',\n 'onPointerDown',\n 'onPointerMove',\n 'onPointerUp',\n 'onPointerCancel',\n 'onPointerEnter',\n 'onPointerLeave',\n 'onPointerOver',\n 'onPointerOut',\n 'onGotPointerCapture',\n 'onLostPointerCapture',\n 'onScroll',\n 'onWheel',\n 'onAnimationStart',\n 'onAnimationEnd',\n 'onAnimationIteration',\n 'onTransitionCancel',\n 'onTransitionEnd',\n 'onTransitionRun',\n 'onTransitionStart',\n]);\n\nconst propRe = /^(data-.*)$/;\n\nexport interface FilterDOMPropsOptions {\n /**\n * If labelling associated aria properties should be included in the filter.\n */\n labelable?: boolean;\n /** Whether the element is a link and should include DOM props for <a> elements. */\n isLink?: boolean;\n /** Whether to include global DOM attributes. */\n global?: boolean;\n /** Whether to include DOM events. */\n events?: boolean;\n /**\n * A Set of other property names that should be included in the filter.\n */\n propNames?: Set<string>;\n}\n\n/**\n * Filters out all props that aren't valid DOM props or defined via override prop obj.\n * @param props - The component props to be filtered.\n * @param opts - Props to override.\n */\nexport function filterDOMProps<T extends object>(\n props: T,\n opts: FilterDOMPropsOptions = {}\n): Partial<T> {\n const { labelable, isLink, global, events = global, propNames } = opts;\n const filteredProps: Partial<T> = {};\n\n for (const prop in props) {\n if (\n Object.prototype.hasOwnProperty.call(props, prop) &&\n (DOMPropNames.has(prop) ||\n (labelable && labelablePropNames.has(prop)) ||\n (isLink && linkPropNames.has(prop)) ||\n (global && globalAttrs.has(prop)) ||\n (events &&\n (globalEvents.has(prop) ||\n (prop.endsWith('Capture') && globalEvents.has(prop.slice(0, -7))))) ||\n propNames?.has(prop) ||\n propRe.test(prop))\n ) {\n (filteredProps as Record<string, unknown>)[prop] = props[prop];\n }\n }\n\n return filteredProps;\n}\n", "/**\n * Reactivity utilities for Solidaria\n *\n * Provides type-safe utilities for working with SolidJS reactivity patterns.\n */\n\nimport { Accessor } from 'solid-js';\n\n/**\n * A value that may be either a raw value or an accessor function.\n * This is a common pattern in SolidJS for props that may be reactive.\n */\nexport type MaybeAccessor<T> = T | Accessor<T>;\n\n/**\n * Unwraps a MaybeAccessor to get the underlying value.\n * If the input is a function, it calls it to get the value.\n * Otherwise, it returns the value directly.\n *\n * @param value - The value or accessor to unwrap.\n */\nexport function access<T>(value: MaybeAccessor<T>): T {\n return typeof value === 'function' ? (value as Accessor<T>)() : value;\n}\n\n/**\n * A value that may be undefined or an accessor that returns the value or undefined.\n */\nexport type MaybeAccessorValue<T> = T | undefined | Accessor<T | undefined>;\n\n/**\n * Checks if a value is an accessor function.\n */\nexport function isAccessor<T>(value: MaybeAccessor<T>): value is Accessor<T> {\n return typeof value === 'function';\n}\n", "/**\n * Platform detection utilities.\n * Based on @react-aria/utils platform detection.\n */\n\nfunction testPlatform(re: RegExp): boolean {\n return typeof window !== 'undefined' && window.navigator != null\n ? re.test(window.navigator.platform || (window.navigator as any).userAgentData?.platform || '')\n : false;\n}\n\nfunction testUserAgent(re: RegExp): boolean {\n return typeof window !== 'undefined' && window.navigator != null\n ? re.test(window.navigator.userAgent)\n : false;\n}\n\nexport function isMac(): boolean {\n return testPlatform(/^Mac/i);\n}\n\nexport function isIPhone(): boolean {\n return testPlatform(/^iPhone/i);\n}\n\nexport function isIPad(): boolean {\n return testPlatform(/^iPad/i) || (isMac() && navigator.maxTouchPoints > 1);\n}\n\nexport function isIOS(): boolean {\n return isIPhone() || isIPad();\n}\n\nexport function isAppleDevice(): boolean {\n return isMac() || isIOS();\n}\n\nexport function isWebKit(): boolean {\n return testUserAgent(/AppleWebKit/i) && !isChrome();\n}\n\nexport function isChrome(): boolean {\n return testUserAgent(/Chrome/i);\n}\n\nexport function isAndroid(): boolean {\n return testUserAgent(/Android/i);\n}\n\nexport function isFirefox(): boolean {\n return testUserAgent(/Firefox/i);\n}\n", "/**\n * DOM utilities for cross-browser compatibility.\n * Based on @react-aria/utils DOM utilities.\n */\n\n/**\n * Gets the owner document of an element, or the global document.\n */\nexport function getOwnerDocument(el: Element | null | undefined): Document {\n return el?.ownerDocument ?? document;\n}\n\n/**\n * Gets the owner window of an element, or the global window.\n */\nexport function getOwnerWindow(el: Element | null | undefined): Window & typeof globalThis {\n return getOwnerDocument(el).defaultView ?? window;\n}\n\n/**\n * Cross-browser implementation of Node.contains that works with ShadowDOM.\n * In Safari, Node.contains doesn't properly detect elements inside shadow roots.\n */\nexport function nodeContains(parent: Node | null, child: Node | null): boolean {\n if (!parent || !child) {\n return false;\n }\n\n // Standard contains check\n if (parent.contains(child)) {\n return true;\n }\n\n // Check if child is in a shadow root\n let node: Node | null = child;\n while (node) {\n if (node === parent) {\n return true;\n }\n\n // Check shadow root host\n if ((node as ShadowRoot).host) {\n node = (node as ShadowRoot).host;\n } else {\n node = node.parentNode;\n }\n }\n\n return false;\n}\n\n/**\n * Gets the event target, handling composed path for shadow DOM.\n */\nexport function getEventTarget<T extends EventTarget>(event: Event): T | null {\n // Use composedPath to get the real target when using Shadow DOM\n if (typeof event.composedPath === 'function') {\n const path = event.composedPath();\n if (path.length > 0) {\n return path[0] as T;\n }\n }\n return event.target as T | null;\n}\n\n/**\n * Checks if an element is a valid focusable element.\n */\nexport function isFocusable(element: Element): boolean {\n // Check if element is disabled\n if ((element as HTMLInputElement).disabled) {\n return false;\n }\n\n // Check native focusable elements\n const tagName = element.tagName.toLowerCase();\n if (['input', 'select', 'textarea', 'button', 'a', 'area'].includes(tagName)) {\n // For anchor elements, they must have href to be focusable\n if (tagName === 'a' || tagName === 'area') {\n return element.hasAttribute('href');\n }\n return true;\n }\n\n // Check for tabIndex\n const tabIndex = element.getAttribute('tabindex');\n if (tabIndex != null && tabIndex !== '-1') {\n return true;\n }\n\n // Check for contenteditable\n if (element.hasAttribute('contenteditable') && element.getAttribute('contenteditable') !== 'false') {\n return true;\n }\n\n return false;\n}\n\n/**\n * Checks if a keyboard event should trigger the default action (like clicking).\n */\nexport function isValidKeyboardEvent(event: KeyboardEvent, currentTarget: Element): boolean {\n const { key, code } = event;\n const element = currentTarget as HTMLElement;\n const tagName = element.tagName.toLowerCase();\n const role = element.getAttribute('role');\n\n // Only accept Enter and Space\n const isActivationKey = key === 'Enter' || key === ' ' || key === 'Spacebar' || code === 'Space';\n if (!isActivationKey) {\n return false;\n }\n\n // Text inputs should handle their own keyboard events\n if (tagName === 'textarea') {\n return false;\n }\n\n // Content editable elements should handle their own keyboard events\n if (element.isContentEditable) {\n return false;\n }\n\n // Links should only respond to Enter, not Space\n const isLink = role === 'link' || (!role && isHTMLAnchorLink(element));\n if (isLink && key !== 'Enter') {\n return false;\n }\n\n // Input elements have specific key handling\n if (tagName === 'input') {\n return isValidInputKey(element as HTMLInputElement, key);\n }\n\n return true;\n}\n\n/**\n * Checks if a key is valid for a specific input type.\n */\nexport function isValidInputKey(target: HTMLInputElement, key: string): boolean {\n const type = target.type.toLowerCase();\n\n // Checkbox and radio only respond to Space\n if (type === 'checkbox' || type === 'radio') {\n return key === ' ' || key === 'Spacebar';\n }\n\n // Text-like inputs handle their own keyboard events\n const textInputTypes = [\n 'text', 'search', 'url', 'tel', 'email', 'password',\n 'date', 'month', 'week', 'time', 'datetime-local', 'number'\n ];\n if (textInputTypes.includes(type)) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Checks if an element is an HTML anchor link (has href attribute).\n */\nexport function isHTMLAnchorLink(target: Element): boolean {\n return target.tagName === 'A' && target.hasAttribute('href');\n}\n\n/**\n * Whether to prevent default on keyboard events for this element.\n */\nexport function shouldPreventDefaultKeyboard(target: Element, key: string): boolean {\n const tagName = target.tagName.toLowerCase();\n\n // Never prevent default on inputs - they handle their own behavior\n if (tagName === 'input' || tagName === 'textarea' || tagName === 'select') {\n return false;\n }\n\n // Don't prevent default on links for Enter (native navigation)\n if ((tagName === 'a' || target.getAttribute('role') === 'link') && key === 'Enter') {\n return false;\n }\n\n // Buttons with submit/reset type should not prevent default\n if (tagName === 'button') {\n const type = (target as HTMLButtonElement).type;\n if (type === 'submit' || type === 'reset') {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Whether to prevent default on pointer up for this element.\n */\nexport function shouldPreventDefaultUp(target: Element): boolean {\n const tagName = target.tagName.toLowerCase();\n\n // Never prevent default on form elements\n if (tagName === 'input' || tagName === 'textarea' || tagName === 'select') {\n return false;\n }\n\n // Don't prevent default on links\n if (tagName === 'a' || target.getAttribute('role') === 'link') {\n return false;\n }\n\n // Buttons with submit/reset type should not prevent default\n if (tagName === 'button') {\n const type = (target as HTMLButtonElement).type;\n if (type === 'submit' || type === 'reset') {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Opens a link, supporting both same-window and new-window navigation.\n * Used for keyboard activation of links with Space key (which doesn't natively open links).\n */\nexport function openLink(target: HTMLAnchorElement, event: Event, allowOpener = false): void {\n const { href, target: linkTarget, rel } = target;\n (openLink as { isOpening?: boolean }).isOpening = true;\n\n // Handle modifier keys for open-in-new-tab behavior\n const keyEvent = event as KeyboardEvent;\n const shouldOpenInNewTab =\n linkTarget === '_blank' ||\n keyEvent?.metaKey ||\n keyEvent?.ctrlKey ||\n keyEvent?.shiftKey ||\n keyEvent?.altKey;\n\n if (shouldOpenInNewTab) {\n const features = !allowOpener && rel?.includes('noopener') ? 'noopener' : undefined;\n window.open(href, linkTarget || '_blank', features);\n } else {\n window.location.href = href;\n }\n\n (openLink as { isOpening?: boolean }).isOpening = false;\n}\n\n(openLink as { isOpening?: boolean }).isOpening = false;\n\n// ============================================\n// Scroll utilities\n// ============================================\n\n/**\n * Checks if an element is scrollable based on its overflow style.\n * @param node - The element to check\n * @param checkForOverflow - If true, also check if the element actually overflows\n */\nexport function isScrollable(node: Element | null, checkForOverflow?: boolean): boolean {\n if (!node) {\n return false;\n }\n\n const style = window.getComputedStyle(node);\n const scrollable = /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY);\n\n if (scrollable && checkForOverflow) {\n return node.scrollHeight !== node.clientHeight || node.scrollWidth !== node.clientWidth;\n }\n\n return scrollable;\n}\n\n/**\n * Gets the nearest scrollable parent element.\n * @param node - The starting element\n * @param checkForOverflow - If true, only return parents that actually overflow\n */\nexport function getScrollParent(node: Element, checkForOverflow?: boolean): Element {\n let scrollableNode: Element | null = node;\n\n if (isScrollable(scrollableNode, checkForOverflow)) {\n scrollableNode = scrollableNode.parentElement;\n }\n\n while (scrollableNode && !isScrollable(scrollableNode, checkForOverflow)) {\n scrollableNode = scrollableNode.parentElement;\n }\n\n return scrollableNode || document.scrollingElement || document.documentElement;\n}\n\n/**\n * Checks if an element will open a virtual keyboard when focused.\n * Used for iOS Safari scroll handling.\n */\nexport function willOpenKeyboard(target: Element | null): boolean {\n if (!target) {\n return false;\n }\n\n const tagName = target.tagName.toLowerCase();\n\n // Inputs that open keyboard (not all input types do)\n if (tagName === 'input') {\n const type = (target as HTMLInputElement).type.toLowerCase();\n // These input types open the keyboard\n const keyboardTypes = [\n 'text', 'search', 'url', 'tel', 'email', 'password',\n 'date', 'month', 'week', 'time', 'datetime-local', 'number'\n ];\n return keyboardTypes.includes(type);\n }\n\n // Textareas always open keyboard\n if (tagName === 'textarea') {\n return true;\n }\n\n // Contenteditable elements open keyboard\n if (target.hasAttribute('contenteditable') && target.getAttribute('contenteditable') !== 'false') {\n return true;\n }\n\n return false;\n}\n", "/**\n * Geometry utilities for pointer/touch hit testing.\n * Based on @react-aria/interactions geometry utilities.\n */\n\nexport interface Rect {\n top: number;\n right: number;\n bottom: number;\n left: number;\n}\n\nexport interface EventPoint {\n clientX: number;\n clientY: number;\n width?: number;\n height?: number;\n radiusX?: number;\n radiusY?: number;\n}\n\n/**\n * Checks if two rectangles overlap.\n */\nexport function areRectanglesOverlapping(a: Rect, b: Rect): boolean {\n // Check if one rectangle is to the left of the other\n if (a.left > b.right || b.left > a.right) {\n return false;\n }\n\n // Check if one rectangle is above the other\n if (a.top > b.bottom || b.top > a.bottom) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Gets the bounding rectangle for an event point (touch/pointer).\n * Takes into account the size of the touch point.\n */\nexport function getPointClientRect(point: EventPoint): Rect {\n let offsetX = 0;\n let offsetY = 0;\n\n // Use width/height if available (PointerEvent)\n if (point.width !== undefined && point.width > 0) {\n offsetX = point.width / 2;\n } else if (point.radiusX !== undefined && point.radiusX > 0) {\n // Fallback to radiusX/radiusY (Touch)\n offsetX = point.radiusX;\n }\n\n if (point.height !== undefined && point.height > 0) {\n offsetY = point.height / 2;\n } else if (point.radiusY !== undefined && point.radiusY > 0) {\n offsetY = point.radiusY;\n }\n\n return {\n top: point.clientY - offsetY,\n right: point.clientX + offsetX,\n bottom: point.clientY + offsetY,\n left: point.clientX - offsetX,\n };\n}\n\n/**\n * Checks if a pointer/touch point is over an element.\n */\nexport function isPointOverTarget(point: EventPoint, target: Element): boolean {\n const rect = target.getBoundingClientRect();\n const pointRect = getPointClientRect(point);\n\n return areRectanglesOverlapping(\n {\n top: rect.top,\n right: rect.right,\n bottom: rect.bottom,\n left: rect.left,\n },\n pointRect\n );\n}\n\n/**\n * Gets the first touch from a TouchEvent's targetTouches.\n */\nexport function getTouchFromEvent(event: TouchEvent): Touch | null {\n const { targetTouches } = event;\n if (targetTouches.length > 0) {\n return targetTouches[0];\n }\n return null;\n}\n\n/**\n * Finds a touch by its identifier in changedTouches.\n */\nexport function getTouchById(event: TouchEvent, pointerId: number | null): Touch | null {\n if (pointerId == null) {\n return null;\n }\n\n const { changedTouches } = event;\n for (let i = 0; i < changedTouches.length; i++) {\n const touch = changedTouches[i];\n if (touch.identifier === pointerId) {\n return touch;\n }\n }\n\n return null;\n}\n", "/**\n * Event utilities for detecting virtual clicks and event handling.\n * Based on @react-aria/utils event utilities.\n */\n\nimport { isAndroid } from './platform';\n\n/**\n * Checks if a click event was generated from a virtual source like a screen reader.\n * Virtual clicks typically have detail of 0 and may have zero coordinates.\n */\nexport function isVirtualClick(event: MouseEvent | PointerEvent): boolean {\n // JAWS/NVDA with Firefox.\n if ((event as PointerEvent).pointerType === '' && event.isTrusted) {\n return true;\n }\n\n // Android TalkBack's detail value varies depending on the event listener providing the event.\n // If pointerType is defined, event is from a click listener.\n if (isAndroid() && (event as PointerEvent).pointerType) {\n return event.type === 'click' && (event as MouseEvent).buttons === 1;\n }\n\n return event.detail === 0 && !(event as PointerEvent).pointerType;\n}\n\n/**\n * Checks if a pointer event was generated by a virtual source.\n * iOS VoiceOver fires pointer events with incorrect coordinates.\n * These events have zero width/height.\n */\nexport function isVirtualPointerEvent(event: PointerEvent): boolean {\n // If the pointer size is zero, then we assume it's from a screen reader.\n // Android TalkBack double tap will sometimes return a event with width and height of 1\n // and pointerType === 'mouse' so we need to check for a specific combination of event attributes.\n // Cannot use \"event.pressure === 0\" as the sole check due to Safari pointer events always returning pressure === 0.\n return (\n (!isAndroid() && event.width === 0 && event.height === 0) ||\n (event.width === 1 &&\n event.height === 1 &&\n event.pressure === 0 &&\n event.detail === 0 &&\n event.pointerType === 'mouse')\n );\n}\n\n/**\n * Creates a synthetic mouse event for programmatic clicking.\n */\nexport function createMouseEvent(type: string, nativeEvent?: Event): MouseEvent {\n const init: MouseEventInit = {\n bubbles: true,\n cancelable: true,\n view: window,\n };\n\n // Copy properties from the native event if provided\n if (nativeEvent) {\n const e = nativeEvent as MouseEvent;\n init.screenX = e.screenX;\n init.screenY = e.screenY;\n init.clientX = e.clientX;\n init.clientY = e.clientY;\n init.ctrlKey = e.ctrlKey;\n init.shiftKey = e.shiftKey;\n init.altKey = e.altKey;\n init.metaKey = e.metaKey;\n init.button = e.button;\n init.buttons = e.buttons;\n init.relatedTarget = e.relatedTarget;\n }\n\n return new MouseEvent(type, init);\n}\n\n/**\n * Creates a chain of event handlers that calls each in sequence.\n */\nexport function chain<T extends (...args: any[]) => any>(\n ...callbacks: (T | undefined | null)[]\n): T {\n return ((...args: Parameters<T>) => {\n for (const callback of callbacks) {\n if (typeof callback === 'function') {\n callback(...args);\n }\n }\n }) as T;\n}\n\n/**\n * Sets the target property on an event object.\n * Used for synthetic events where target needs to be modified.\n */\nexport function setEventTarget<T extends Event>(event: T, target: EventTarget): void {\n Object.defineProperty(event, 'target', {\n value: target,\n writable: false,\n configurable: true,\n });\n Object.defineProperty(event, 'currentTarget', {\n value: target,\n writable: false,\n configurable: true,\n });\n}\n", "/**\n * Text selection management utilities.\n * Based on @react-aria/interactions textSelection utilities.\n *\n * On iOS, long press triggers text selection. The only way to prevent this\n * is to set user-select: none on the entire page. On other platforms,\n * we can just set it on the target element.\n */\n\nimport { isIOS } from './platform';\nimport { getOwnerDocument } from './dom';\n\ntype State = 'default' | 'disabled' | 'restoring';\n\n// Global state to manage text selection across multiple press interactions\nlet state: State = 'default';\nlet savedUserSelect = '';\nlet modifiedElementMap = new WeakMap<HTMLElement, string>();\n\n/**\n * Disables text selection on the page or element during press.\n * On iOS, applies to the entire document. On other platforms, just the target.\n */\nexport function disableTextSelection(target?: HTMLElement): void {\n if (isIOS()) {\n // iOS requires disabling selection on the entire page\n if (state === 'default') {\n const documentElement = getOwnerDocument(target).documentElement;\n savedUserSelect = documentElement.style.webkitUserSelect;\n documentElement.style.webkitUserSelect = 'none';\n }\n state = 'disabled';\n } else if (target) {\n // On other platforms, just disable on the target\n const element = target as HTMLElement;\n if (!modifiedElementMap.has(element)) {\n modifiedElementMap.set(element, element.style.userSelect);\n element.style.userSelect = 'none';\n }\n }\n}\n\n/**\n * Restores text selection after press ends.\n * On iOS, waits 300ms to avoid selection appearing during tap.\n */\nexport function restoreTextSelection(target?: HTMLElement): void {\n if (isIOS()) {\n // Don't restore if another press is active\n if (state !== 'disabled') {\n return;\n }\n\n state = 'restoring';\n\n // Wait for iOS to finish any pending selection actions\n // 300ms is the iOS long-press delay\n setTimeout(() => {\n // Use runAfterTransition to avoid CSS recomputation during animation\n runAfterTransition(() => {\n // Only restore if still in 'restoring' state (no new press started)\n if (state === 'restoring') {\n const documentElement = getOwnerDocument(target).documentElement;\n if (savedUserSelect) {\n documentElement.style.webkitUserSelect = savedUserSelect;\n } else {\n documentElement.style.removeProperty('-webkit-user-select');\n }\n savedUserSelect = '';\n state = 'default';\n }\n });\n }, 300);\n } else if (target) {\n // On other platforms, restore immediately\n const element = target as HTMLElement;\n const savedValue = modifiedElementMap.get(element);\n if (savedValue !== undefined) {\n if (savedValue) {\n element.style.userSelect = savedValue;\n } else {\n element.style.removeProperty('user-select');\n }\n modifiedElementMap.delete(element);\n }\n }\n}\n\n// Tracks pending transitions for runAfterTransition\nconst pendingTransitions = new Set<() => void>();\nlet transitionTimeout: ReturnType<typeof setTimeout> | null = null;\n\n/**\n * Runs a callback after CSS transitions complete.\n * Batches multiple callbacks to avoid unnecessary layout thrashing.\n */\nfunction runAfterTransition(callback: () => void): void {\n // If we haven't started tracking transitions, run immediately\n pendingTransitions.add(callback);\n\n // Debounce - wait for any transitions to settle\n if (transitionTimeout != null) {\n clearTimeout(transitionTimeout);\n }\n\n transitionTimeout = setTimeout(() => {\n // Run all pending callbacks\n for (const cb of pendingTransitions) {\n cb();\n }\n pendingTransitions.clear();\n transitionTimeout = null;\n }, 0);\n}\n", "/**\n * Focus management utilities.\n * Based on @react-aria/utils focus utilities.\n */\n\nimport { getOwnerDocument } from './dom';\n\n/**\n * Focuses an element without scrolling the page.\n * Uses preventScroll option with fallback for older browsers.\n */\nexport function focusWithoutScrolling(element: HTMLElement | null): void {\n if (!element) return;\n\n // Try using the modern preventScroll option\n try {\n element.focus({ preventScroll: true });\n } catch {\n // Fallback for browsers that don't support preventScroll\n // Save scroll positions and restore after focus\n const scrollableElements = getScrollableAncestors(element);\n const scrollPositions = scrollableElements.map((el) => ({\n element: el,\n scrollTop: el.scrollTop,\n scrollLeft: el.scrollLeft,\n }));\n\n element.focus();\n\n // Restore scroll positions\n for (const { element: el, scrollTop, scrollLeft } of scrollPositions) {\n el.scrollTop = scrollTop;\n el.scrollLeft = scrollLeft;\n }\n }\n}\n\n/**\n * Gets all scrollable ancestors of an element.\n */\nfunction getScrollableAncestors(element: Element): Element[] {\n const ancestors: Element[] = [];\n let parent = element.parentElement;\n\n while (parent) {\n const style = getComputedStyle(parent);\n const overflowY = style.overflowY;\n const overflowX = style.overflowX;\n\n if (\n overflowY === 'auto' ||\n overflowY === 'scroll' ||\n overflowX === 'auto' ||\n overflowX === 'scroll'\n ) {\n ancestors.push(parent);\n }\n\n parent = parent.parentElement;\n }\n\n // Also include the document scrolling element\n const doc = getOwnerDocument(element);\n ancestors.push(doc.documentElement);\n\n return ancestors;\n}\n\n// State for preventFocus\nlet ignoreFocus = false;\nlet preventFocusTimeout: ReturnType<typeof setTimeout> | null = null;\n\n/**\n * Prevents focus from moving to a new element temporarily.\n * Used when clicking on a button that shouldn't steal focus.\n */\nexport function preventFocus(target: Element): void {\n // Find the closest focusable ancestor\n const focusableAncestor = findFocusableAncestor(target);\n if (!focusableAncestor) return;\n\n const document = getOwnerDocument(target);\n const activeElement = document.activeElement;\n\n // Set flag to ignore next focus event\n ignoreFocus = true;\n\n // Capture focus events and prevent them from changing focus\n const onFocus = (e: Event) => {\n if (ignoreFocus) {\n e.stopImmediatePropagation();\n // Refocus the original element if focus moved\n if (activeElement && activeElement !== document.body) {\n (activeElement as HTMLElement).focus();\n }\n }\n };\n\n const onBlur = (e: Event) => {\n if (ignoreFocus) {\n e.stopImmediatePropagation();\n }\n };\n\n // Use capturing to intercept focus before it reaches elements\n // Cast to HTMLElement to access focus event listeners\n const el = focusableAncestor as HTMLElement;\n el.addEventListener('focus', onFocus, true);\n el.addEventListener('blur', onBlur, true);\n el.addEventListener('focusin', onFocus, true);\n el.addEventListener('focusout', onBlur, true);\n\n // Clean up after the current event cycle\n if (preventFocusTimeout != null) {\n clearTimeout(preventFocusTimeout);\n }\n\n preventFocusTimeout = setTimeout(() => {\n ignoreFocus = false;\n el.removeEventListener('focus', onFocus, true);\n el.removeEventListener('blur', onBlur, true);\n el.removeEventListener('focusin', onFocus, true);\n el.removeEventListener('focusout', onBlur, true);\n preventFocusTimeout = null;\n }, 0);\n}\n\n/**\n * Finds the closest focusable ancestor or the element itself.\n */\nfunction findFocusableAncestor(element: Element): Element | null {\n let current: Element | null = element;\n\n while (current) {\n if (\n current.hasAttribute('tabindex') ||\n ['INPUT', 'BUTTON', 'SELECT', 'TEXTAREA', 'A'].includes(current.tagName)\n ) {\n return current;\n }\n current = current.parentElement;\n }\n\n return element;\n}\n\n/**\n * Safely focuses an element, alias for focusWithoutScrolling.\n * This matches the react-aria focusSafely function name.\n */\nexport const focusSafely = focusWithoutScrolling;\n", "/**\n * Global listener management utility.\n * Based on @react-aria/utils useGlobalListeners hook, adapted for SolidJS.\n *\n * In SolidJS, we use onCleanup for automatic cleanup instead of useEffect return.\n */\n\nimport { onCleanup } from 'solid-js';\n\nexport interface GlobalListenerOptions extends AddEventListenerOptions {\n /** Whether to add the listener to the window instead of document */\n isWindow?: boolean;\n}\n\n/**\n * Creates a manager for global event listeners that automatically cleans up.\n * Use this in a component to register document/window level listeners\n * that will be removed when the component unmounts.\n */\nexport function createGlobalListeners() {\n const listeners: Array<{\n target: EventTarget;\n type: string;\n handler: EventListener;\n options?: AddEventListenerOptions;\n }> = [];\n\n /**\n * Adds a global event listener.\n */\n function addGlobalListener<K extends keyof DocumentEventMap>(\n type: K,\n handler: (ev: DocumentEventMap[K]) => void,\n options?: GlobalListenerOptions\n ): void;\n function addGlobalListener<K extends keyof WindowEventMap>(\n type: K,\n handler: (ev: WindowEventMap[K]) => void,\n options?: GlobalListenerOptions & { isWindow: true }\n ): void;\n function addGlobalListener(\n type: string,\n handler: EventListener,\n options?: GlobalListenerOptions\n ): void {\n const target = options?.isWindow ? window : document;\n const listenerOptions = options\n ? {\n capture: options.capture,\n passive: options.passive,\n once: options.once,\n }\n : undefined;\n\n target.addEventListener(type, handler, listenerOptions);\n listeners.push({ target, type, handler, options: listenerOptions });\n }\n\n /**\n * Removes a specific global event listener.\n */\n function removeGlobalListener<K extends keyof DocumentEventMap>(\n type: K,\n handler: (ev: DocumentEventMap[K]) => void,\n options?: AddEventListenerOptions\n ): void;\n function removeGlobalListener<K extends keyof WindowEventMap>(\n type: K,\n handler: (ev: WindowEventMap[K]) => void,\n options?: AddEventListenerOptions & { isWindow: true }\n ): void;\n function removeGlobalListener(\n type: string,\n handler: EventListener,\n options?: AddEventListenerOptions & { isWindow?: boolean }\n ): void {\n const target = options?.isWindow ? window : document;\n const listenerOptions = options\n ? {\n capture: options.capture,\n }\n : undefined;\n\n target.removeEventListener(type, handler, listenerOptions);\n\n // Remove from tracked listeners\n const index = listeners.findIndex(\n (l) =>\n l.target === target &&\n l.type === type &&\n l.handler === handler &&\n l.options?.capture === listenerOptions?.capture\n );\n if (index !== -1) {\n listeners.splice(index, 1);\n }\n }\n\n /**\n * Removes all registered global listeners.\n */\n function removeAllGlobalListeners(): void {\n for (const { target, type, handler, options } of listeners) {\n target.removeEventListener(type, handler, options);\n }\n listeners.length = 0;\n }\n\n // Automatically clean up when the component/scope is disposed\n onCleanup(removeAllGlobalListeners);\n\n return {\n addGlobalListener,\n removeGlobalListener,\n removeAllGlobalListeners,\n };\n}\n\n/**\n * Simple utility to add a single global listener with automatic cleanup.\n * For one-off listeners where the full manager isn't needed.\n */\nexport function addGlobalListenerOnce<K extends keyof DocumentEventMap>(\n type: K,\n handler: (ev: DocumentEventMap[K]) => void,\n options?: GlobalListenerOptions\n): () => void {\n const target = options?.isWindow ? window : document;\n const listenerOptions = options\n ? {\n capture: options.capture,\n passive: options.passive,\n once: options.once,\n }\n : undefined;\n\n target.addEventListener(type, handler as EventListener, listenerOptions);\n\n return () => {\n target.removeEventListener(type, handler as EventListener, listenerOptions);\n };\n}\n", "/**\n * Environment detection utilities.\n * These avoid direct references to process.env which can cause TypeScript issues in browser environments.\n * Compatible with Node.js, Deno, and Vite environments.\n */\n\n// Type-safe access to import.meta.env (Vite) and Deno.env\ndeclare const Deno: { env?: { get(key: string): string | undefined } } | undefined;\n\nfunction getEnvVar(key: string): string | undefined {\n // Check Vite's import.meta.env\n if (typeof import.meta !== 'undefined' && (import.meta as any).env) {\n return (import.meta as any).env[key];\n }\n // Check Deno\n if (typeof Deno !== 'undefined' && Deno.env) {\n return Deno.env.get(key);\n }\n // Check Node.js process.env via globalThis\n if (typeof globalThis !== 'undefined' && (globalThis as any).process?.env) {\n return (globalThis as any).process.env[key];\n }\n return undefined;\n}\n\n/**\n * Check if we're running in a test environment.\n */\nexport function isTestEnv(): boolean {\n return getEnvVar('NODE_ENV') === 'test';\n}\n\n/**\n * Check if we're running in a development environment (not production).\n */\nexport function isDevEnv(): boolean {\n // Check Vite's DEV flag\n if (typeof import.meta !== 'undefined' && (import.meta as any).env?.DEV) {\n return true;\n }\n const nodeEnv = getEnvVar('NODE_ENV');\n return nodeEnv !== 'production';\n}\n\n/**\n * Check if we're running in production.\n */\nexport function isProdEnv(): boolean {\n // Check Vite's PROD flag\n if (typeof import.meta !== 'undefined' && (import.meta as any).env?.PROD) {\n return true;\n }\n return getEnvVar('NODE_ENV') === 'production';\n}\n", "/**\n * createDescription - Creates a hidden element for dynamic aria-describedby content.\n *\n * This utility creates a visually hidden element containing description text and\n * returns an aria-describedby prop pointing to it. Multiple components using the\n * same description will share the same element (reference counted).\n *\n * Port of @react-aria/utils/useDescription.\n *\n * @example\n * ```tsx\n * function SortableColumn(props) {\n * const descriptionProps = createDescription(\n * () => props.sortDirection ? `Sorted ${props.sortDirection}` : undefined\n * );\n *\n * return (\n * <th {...descriptionProps}>\n * {props.children}\n * </th>\n * );\n * }\n * ```\n */\n\nimport { createSignal, createEffect, onCleanup, type Accessor } from 'solid-js';\nimport { isServer } from 'solid-js/web';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface DescriptionProps {\n 'aria-describedby'?: string;\n}\n\n// ============================================\n// STATE\n// ============================================\n\nlet descriptionId = 0;\nconst descriptionNodes = new Map<string, { refCount: number; element: Element }>();\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Creates an invisible description element and returns aria-describedby props.\n *\n * The element is created in the DOM and reference counted - multiple uses of\n * the same description text will share the same element. When all references\n * are removed, the element is cleaned up.\n *\n * @param description - Accessor that returns the description text, or undefined\n * @returns Object with aria-describedby prop (or empty object if no description)\n *\n * @example\n * ```tsx\n * const descProps = createDescription(() => 'Press Enter to submit');\n * return <button {...descProps}>Submit</button>;\n * ```\n */\nexport function createDescription(description: Accessor<string | undefined>): DescriptionProps {\n // SSR: return empty object\n if (isServer) {\n return {};\n }\n\n const [id, setId] = createSignal<string | undefined>();\n\n createEffect(() => {\n const desc = description();\n\n if (!desc) {\n setId(undefined);\n return;\n }\n\n let node = descriptionNodes.get(desc);\n\n if (!node) {\n // Create new description element\n const newId = `solidaria-description-${descriptionId++}`;\n setId(newId);\n\n const element = document.createElement('div');\n element.id = newId;\n element.style.display = 'none';\n element.textContent = desc;\n document.body.appendChild(element);\n\n node = { refCount: 0, element };\n descriptionNodes.set(desc, node);\n } else {\n // Reuse existing element\n setId(node.element.id);\n }\n\n node.refCount++;\n\n // Cleanup when description changes or component unmounts\n onCleanup(() => {\n if (node && --node.refCount === 0) {\n node.element.remove();\n descriptionNodes.delete(desc);\n }\n });\n });\n\n // Return reactive props object\n return {\n get 'aria-describedby'() {\n const desc = description();\n return desc ? id() : undefined;\n },\n };\n}\n\n/**\n * Utility to get all active description nodes (for testing).\n * @internal\n */\nexport function getDescriptionNodeCount(): number {\n return descriptionNodes.size;\n}\n\n/**\n * Utility to clear all description nodes (for testing cleanup).\n * @internal\n */\nexport function clearDescriptionNodes(): void {\n for (const [, node] of descriptionNodes) {\n node.element.remove();\n }\n descriptionNodes.clear();\n}\n", "/**\n * createLongPress - Handles long press interactions across mouse and touch.\n *\n * Port of @react-aria/interactions useLongPress, adapted for SolidJS.\n */\n\nimport { JSX, onCleanup } from 'solid-js';\nimport { createPress, type PressEvent } from './createPress';\nimport { mergeProps, focusWithoutScrolling, createGlobalListeners } from '../utils';\nimport { createDescription } from '../utils/createDescription';\nimport { type MaybeAccessor } from '../utils/reactivity';\n\nexport interface LongPressEvent {\n /** The type of long press event being fired. */\n type: 'longpressstart' | 'longpressend' | 'longpress';\n /** The pointer type that triggered the long press. */\n pointerType: PressEvent['pointerType'];\n /** The target element of the long press event. */\n target: Element;\n /** Whether the shift keyboard modifier was held during the long press event. */\n shiftKey: boolean;\n /** Whether the ctrl keyboard modifier was held during the long press event. */\n ctrlKey: boolean;\n /** Whether the meta keyboard modifier was held during the long press event. */\n metaKey: boolean;\n /** Whether the alt keyboard modifier was held during the long press event. */\n altKey: boolean;\n /** X position relative to the target. */\n x: number;\n /** Y position relative to the target. */\n y: number;\n}\n\nexport interface LongPressProps {\n /** Whether long press events should be disabled. */\n isDisabled?: MaybeAccessor<boolean>;\n /** Handler that is called when a long press interaction starts. */\n onLongPressStart?: (e: LongPressEvent) => void;\n /**\n * Handler that is called when a long press interaction ends, either\n * over the target or when the pointer leaves the target.\n */\n onLongPressEnd?: (e: LongPressEvent) => void;\n /**\n * Handler that is called when the threshold time is met while\n * the press is over the target.\n */\n onLongPress?: (e: LongPressEvent) => void;\n /**\n * The amount of time in milliseconds to wait before triggering a long press.\n * @default 500ms\n */\n threshold?: number;\n /**\n * A description for assistive technology users indicating that a long press\n * action is available, e.g. \"Long press to open menu\".\n */\n accessibilityDescription?: string;\n}\n\nexport interface LongPressResult {\n /** Props to spread on the target element. */\n longPressProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\nconst DEFAULT_THRESHOLD = 500;\n\nfunction isDisabledValue(isDisabled: MaybeAccessor<boolean> | undefined): boolean {\n return typeof isDisabled === 'function' ? isDisabled() : !!isDisabled;\n}\n\nfunction createLongPressEvent(type: LongPressEvent['type'], e: PressEvent): LongPressEvent {\n return {\n type,\n pointerType: e.pointerType,\n target: e.target,\n shiftKey: e.shiftKey,\n ctrlKey: e.ctrlKey,\n metaKey: e.metaKey,\n altKey: e.altKey,\n x: e.x,\n y: e.y,\n };\n}\n\n/**\n * Handles long press interactions across mouse and touch devices.\n */\nexport function createLongPress(props: LongPressProps = {}): LongPressResult {\n const {\n isDisabled,\n onLongPressStart,\n onLongPressEnd,\n onLongPress,\n threshold = DEFAULT_THRESHOLD,\n accessibilityDescription,\n } = props;\n\n let timeoutId: ReturnType<typeof setTimeout> | undefined;\n const { addGlobalListener } = createGlobalListeners();\n\n const { pressProps } = createPress({\n isDisabled,\n onPressStart(e) {\n e.continuePropagation();\n if (e.pointerType === 'mouse' || e.pointerType === 'touch') {\n onLongPressStart?.(createLongPressEvent('longpressstart', e));\n\n timeoutId = setTimeout(() => {\n // Prevent other press handlers from also handling this event.\n e.target.dispatchEvent(new PointerEvent('pointercancel', { bubbles: true }));\n\n // Ensure target is focused. On touch devices, browsers typically focus on pointer up.\n if (document.activeElement !== e.target) {\n focusWithoutScrolling(e.target as HTMLElement);\n }\n\n onLongPress?.(createLongPressEvent('longpress', e));\n timeoutId = undefined;\n }, threshold);\n\n if (e.pointerType === 'touch') {\n const onContextMenu = (event: Event) => {\n event.preventDefault();\n };\n const target = e.target as HTMLElement;\n target.addEventListener('contextmenu', onContextMenu, { once: true });\n\n addGlobalListener(\n 'pointerup',\n () => {\n setTimeout(() => {\n target.removeEventListener('contextmenu', onContextMenu);\n }, 30);\n },\n { isWindow: true, once: true }\n );\n }\n }\n },\n onPressEnd(e) {\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n\n if (onLongPressEnd && (e.pointerType === 'mouse' || e.pointerType === 'touch')) {\n onLongPressEnd(createLongPressEvent('longpressend', e));\n }\n },\n });\n\n const descriptionProps = createDescription(() =>\n onLongPress && !isDisabledValue(isDisabled) ? accessibilityDescription : undefined\n );\n\n onCleanup(() => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n });\n\n const longPressProps = mergeProps(pressProps) as JSX.HTMLAttributes<HTMLElement>;\n Object.defineProperty(longPressProps, 'aria-describedby', {\n get: () => descriptionProps['aria-describedby'],\n enumerable: true,\n configurable: true,\n });\n\n return {\n longPressProps,\n };\n}\n", "/**\n * createMove - Handles move interactions across mouse, touch, pointer, and keyboard.\n *\n * Port of @react-aria/interactions useMove, adapted for SolidJS.\n */\n\nimport { JSX, createSignal, createEffect, onCleanup } from 'solid-js';\nimport { disableTextSelection, restoreTextSelection, createGlobalListeners } from '../utils';\n\nexport type PointerType = 'mouse' | 'pen' | 'touch' | 'keyboard';\n\ninterface BaseMoveEvent {\n pointerType: PointerType;\n shiftKey: boolean;\n ctrlKey: boolean;\n metaKey: boolean;\n altKey: boolean;\n}\n\nexport interface MoveStartEvent extends BaseMoveEvent {\n type: 'movestart';\n}\n\nexport interface MoveMoveEvent extends BaseMoveEvent {\n type: 'move';\n deltaX: number;\n deltaY: number;\n}\n\nexport interface MoveEndEvent extends BaseMoveEvent {\n type: 'moveend';\n}\n\nexport interface MoveEvents {\n onMoveStart?: (e: MoveStartEvent) => void;\n onMove?: (e: MoveMoveEvent) => void;\n onMoveEnd?: (e: MoveEndEvent) => void;\n}\n\nexport interface MoveResult {\n /** Props to spread on the target element. */\n moveProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\ninterface MoveState {\n didMove: boolean;\n lastPosition: { pageX: number; pageY: number } | null;\n id: number | null;\n}\n\nfunction createBaseEvent(\n originalEvent: { shiftKey: boolean; ctrlKey: boolean; metaKey: boolean; altKey: boolean },\n pointerType: PointerType\n): BaseMoveEvent {\n return {\n pointerType,\n shiftKey: originalEvent.shiftKey,\n ctrlKey: originalEvent.ctrlKey,\n metaKey: originalEvent.metaKey,\n altKey: originalEvent.altKey,\n };\n}\n\n/**\n * Handles move interactions across mouse, touch, pointer, and keyboard.\n */\nexport function createMove(props: MoveEvents = {}): MoveResult {\n const { onMoveStart, onMove, onMoveEnd } = props;\n\n const state: MoveState = {\n didMove: false,\n lastPosition: null,\n id: null,\n };\n\n const { addGlobalListener, removeGlobalListener } = createGlobalListeners();\n const [pointerDown, setPointerDown] = createSignal<'pointer' | 'mouse' | 'touch' | null>(null);\n\n const move = (\n originalEvent: { shiftKey: boolean; ctrlKey: boolean; metaKey: boolean; altKey: boolean },\n pointerType: PointerType,\n deltaX: number,\n deltaY: number\n ) => {\n if (deltaX === 0 && deltaY === 0) {\n return;\n }\n\n if (!state.didMove) {\n state.didMove = true;\n onMoveStart?.({\n type: 'movestart',\n ...createBaseEvent(originalEvent, pointerType),\n });\n }\n\n onMove?.({\n type: 'move',\n deltaX,\n deltaY,\n ...createBaseEvent(originalEvent, pointerType),\n });\n };\n\n const end = (originalEvent: { shiftKey: boolean; ctrlKey: boolean; metaKey: boolean; altKey: boolean }, pointerType: PointerType) => {\n restoreTextSelection();\n if (state.didMove) {\n onMoveEnd?.({\n type: 'moveend',\n ...createBaseEvent(originalEvent, pointerType),\n });\n }\n };\n\n createEffect(() => {\n const activePointer = pointerDown();\n if (!activePointer) return;\n\n if (activePointer === 'pointer') {\n const onPointerMove = (e: PointerEvent) => {\n if (e.pointerId === state.id) {\n const pointerType = (e.pointerType || 'mouse') as PointerType;\n move(e, pointerType, e.pageX - (state.lastPosition?.pageX ?? 0), e.pageY - (state.lastPosition?.pageY ?? 0));\n state.lastPosition = { pageX: e.pageX, pageY: e.pageY };\n }\n };\n\n const onPointerUp = (e: PointerEvent) => {\n if (e.pointerId === state.id) {\n const pointerType = (e.pointerType || 'mouse') as PointerType;\n end(e, pointerType);\n state.id = null;\n removeGlobalListener('pointermove', onPointerMove, { isWindow: true });\n removeGlobalListener('pointerup', onPointerUp, { isWindow: true });\n removeGlobalListener('pointercancel', onPointerUp, { isWindow: true });\n setPointerDown(null);\n }\n };\n\n addGlobalListener('pointermove', onPointerMove, { isWindow: true });\n addGlobalListener('pointerup', onPointerUp, { isWindow: true });\n addGlobalListener('pointercancel', onPointerUp, { isWindow: true });\n onCleanup(() => {\n removeGlobalListener('pointermove', onPointerMove, { isWindow: true });\n removeGlobalListener('pointerup', onPointerUp, { isWindow: true });\n removeGlobalListener('pointercancel', onPointerUp, { isWindow: true });\n });\n }\n\n // Mouse/touch listeners are attached directly in their handlers.\n });\n\n const start = () => {\n disableTextSelection();\n state.didMove = false;\n };\n\n const moveProps: JSX.HTMLAttributes<HTMLElement> = {};\n\n const hasPointerEvents = typeof window !== 'undefined' && typeof window.PointerEvent !== 'undefined';\n\n moveProps.onMouseDown = (e: MouseEvent) => {\n if (pointerDown() != null) {\n return;\n }\n if (e.button === 0) {\n start();\n e.stopPropagation();\n e.preventDefault();\n state.lastPosition = { pageX: e.pageX, pageY: e.pageY };\n setPointerDown('mouse');\n\n const onMouseMove = (event: MouseEvent) => {\n move(\n event,\n 'mouse',\n event.pageX - (state.lastPosition?.pageX ?? 0),\n event.pageY - (state.lastPosition?.pageY ?? 0)\n );\n state.lastPosition = { pageX: event.pageX, pageY: event.pageY };\n };\n const onMouseUp = (event: MouseEvent) => {\n end(event, 'mouse');\n removeGlobalListener('mousemove', onMouseMove);\n removeGlobalListener('mouseup', onMouseUp);\n setPointerDown(null);\n };\n addGlobalListener('mousemove', onMouseMove);\n addGlobalListener('mouseup', onMouseUp);\n }\n };\n\n moveProps.onTouchStart = (e: TouchEvent) => {\n if (pointerDown() != null || e.changedTouches.length === 0 || state.id != null) {\n return;\n }\n const { pageX, pageY, identifier } = e.changedTouches[0];\n start();\n e.stopPropagation();\n e.preventDefault();\n state.lastPosition = { pageX, pageY };\n state.id = identifier;\n setPointerDown('touch');\n\n const onTouchMove = (event: TouchEvent) => {\n const touchIndex = [...event.changedTouches].findIndex(\n ({ identifier: touchId }) => touchId === state.id\n );\n if (touchIndex >= 0) {\n const { pageX: moveX, pageY: moveY } = event.changedTouches[touchIndex];\n move(event, 'touch', moveX - (state.lastPosition?.pageX ?? 0), moveY - (state.lastPosition?.pageY ?? 0));\n state.lastPosition = { pageX: moveX, pageY: moveY };\n }\n };\n const onTouchEnd = (event: TouchEvent) => {\n const touchIndex = [...event.changedTouches].findIndex(\n ({ identifier: touchId }) => touchId === state.id\n );\n if (touchIndex >= 0) {\n end(event, 'touch');\n state.id = null;\n removeGlobalListener('touchmove', onTouchMove);\n removeGlobalListener('touchend', onTouchEnd);\n removeGlobalListener('touchcancel', onTouchEnd);\n setPointerDown(null);\n }\n };\n addGlobalListener('touchmove', onTouchMove);\n addGlobalListener('touchend', onTouchEnd);\n addGlobalListener('touchcancel', onTouchEnd);\n };\n\n if (hasPointerEvents) {\n moveProps.onPointerDown = (e: PointerEvent) => {\n const button = e.button ?? 0;\n if (button === 0 && state.id == null) {\n start();\n e.stopPropagation();\n e.preventDefault();\n state.lastPosition = { pageX: e.pageX, pageY: e.pageY };\n state.id = e.pointerId;\n setPointerDown('pointer');\n }\n };\n }\n\n const triggerKeyboardMove = (\n e: KeyboardEvent,\n deltaX: number,\n deltaY: number\n ) => {\n start();\n move(e, 'keyboard', deltaX, deltaY);\n end(e, 'keyboard');\n };\n\n moveProps.onKeyDown = (e: KeyboardEvent) => {\n switch (e.key) {\n case 'Left':\n case 'ArrowLeft':\n e.preventDefault();\n e.stopPropagation();\n triggerKeyboardMove(e, -1, 0);\n break;\n case 'Right':\n case 'ArrowRight':\n e.preventDefault();\n e.stopPropagation();\n triggerKeyboardMove(e, 1, 0);\n break;\n case 'Up':\n case 'ArrowUp':\n e.preventDefault();\n e.stopPropagation();\n triggerKeyboardMove(e, 0, -1);\n break;\n case 'Down':\n case 'ArrowDown':\n e.preventDefault();\n e.stopPropagation();\n triggerKeyboardMove(e, 0, 1);\n break;\n default:\n break;\n }\n };\n\n return { moveProps };\n}\n", "/**\n * createFocus - Handles focus events for the immediate target.\n *\n * This is a 1-1 port of React-Aria's useFocus hook adapted for SolidJS.\n * Focus events on child elements will be ignored.\n */\n\nimport { JSX, onCleanup } from 'solid-js';\nimport { getOwnerDocument, getEventTarget } from '../utils';\nfunction getActiveElement(doc: Document): Element | null {\n let activeElement = doc.activeElement;\n while (activeElement && (activeElement as Element).shadowRoot?.activeElement) {\n activeElement = (activeElement as Element).shadowRoot?.activeElement ?? null;\n }\n return activeElement;\n}\n\nexport interface FocusEvents {\n /** Handler that is called when the element receives focus. */\n onFocus?: (e: FocusEvent) => void;\n /** Handler that is called when the element loses focus. */\n onBlur?: (e: FocusEvent) => void;\n /** Handler that is called when the element's focus status changes. */\n onFocusChange?: (isFocused: boolean) => void;\n}\n\nexport interface CreateFocusProps extends FocusEvents {\n /** Whether the focus events should be disabled. */\n isDisabled?: boolean;\n}\n\nexport interface FocusResult {\n /** Props to spread onto the target element. */\n focusProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n/**\n * Synthetic blur event handler for Firefox bug workaround.\n * React (and we) don't fire onBlur when an element is disabled.\n * Most browsers fire a native focusout event in this case, except for Firefox.\n * We use a MutationObserver to watch for the disabled attribute.\n */\nfunction createSyntheticBlurHandler(\n _onBlur: ((e: FocusEvent) => void) | undefined\n): (_e: FocusEvent, target: Element) => (() => void) | undefined {\n let isFocused = false;\n let observer: MutationObserver | null = null;\n\n return (_e: FocusEvent, target: Element) => {\n if (\n target instanceof HTMLButtonElement ||\n target instanceof HTMLInputElement ||\n target instanceof HTMLTextAreaElement ||\n target instanceof HTMLSelectElement\n ) {\n isFocused = true;\n\n const onBlurHandler = (_blurEvent: Event) => {\n isFocused = false;\n\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n };\n\n target.addEventListener('focusout', onBlurHandler, { once: true });\n\n observer = new MutationObserver(() => {\n if (isFocused && (target as HTMLButtonElement).disabled) {\n observer?.disconnect();\n const relatedTarget = target === document.activeElement ? null : document.activeElement;\n target.dispatchEvent(new FocusEvent('blur', { relatedTarget }));\n target.dispatchEvent(new FocusEvent('focusout', { bubbles: true, relatedTarget }));\n }\n });\n\n observer.observe(target, { attributes: true, attributeFilter: ['disabled'] });\n\n // Return cleanup function\n return () => {\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n };\n }\n\n return undefined;\n };\n}\n\n/**\n * Handles focus events for the immediate target.\n * Focus events on child elements will be ignored.\n *\n * Based on react-aria's useFocus but adapted for SolidJS.\n */\nexport function createFocus(props: CreateFocusProps = {}): FocusResult {\n const { isDisabled, onFocus: onFocusProp, onBlur: onBlurProp, onFocusChange } = props;\n\n let cleanupRef: (() => void) | undefined;\n const syntheticBlurHandler = createSyntheticBlurHandler(onBlurProp);\n\n // Cleanup on unmount\n onCleanup(() => {\n if (cleanupRef) {\n cleanupRef();\n }\n });\n\n const onBlur: JSX.EventHandler<HTMLElement, FocusEvent> = (e) => {\n // Only handle if target is the currentTarget (not bubbled from children)\n if (e.target === e.currentTarget) {\n if (onBlurProp) {\n onBlurProp(e);\n }\n\n if (onFocusChange) {\n onFocusChange(false);\n }\n\n cleanupRef?.();\n cleanupRef = undefined;\n }\n };\n\n const onFocus: JSX.EventHandler<HTMLElement, FocusEvent> = (e) => {\n // Double check that document.activeElement actually matches e.target\n // in case a previously chained focus handler already moved focus somewhere else.\n const ownerDocument = getOwnerDocument(e.target);\n const activeElement = ownerDocument ? getActiveElement(ownerDocument) : null;\n\n if (e.target === e.currentTarget && activeElement === getEventTarget(e)) {\n if (onFocusProp) {\n onFocusProp(e);\n }\n\n if (onFocusChange) {\n onFocusChange(true);\n }\n\n // Set up synthetic blur handler for Firefox bug\n cleanupRef = syntheticBlurHandler(e, e.target);\n }\n };\n\n // If disabled or no handlers, return empty props\n if (isDisabled) {\n return {\n focusProps: {},\n };\n }\n\n const hasHandlers = onFocusProp || onFocusChange || onBlurProp;\n\n return {\n focusProps: {\n onFocus: hasHandlers ? onFocus : undefined,\n onBlur: onBlurProp || onFocusChange ? onBlur : undefined,\n },\n };\n}\n", "/**\n * createFocusWithin - Handles focus events for the target and its descendants.\n *\n * This is a 1-1 port of React-Aria's useFocusWithin hook adapted for SolidJS.\n */\n\nimport { JSX, onCleanup } from 'solid-js';\nimport { getOwnerDocument, getEventTarget, nodeContains, createGlobalListeners } from '../utils';\nimport { setEventTarget } from '../utils/events';\n\nexport interface FocusWithinProps {\n /** Whether the focus within events should be disabled. */\n isDisabled?: boolean;\n /** Handler that is called when the target element or a descendant receives focus. */\n onFocusWithin?: (e: FocusEvent) => void;\n /** Handler that is called when the target element and all descendants lose focus. */\n onBlurWithin?: (e: FocusEvent) => void;\n /** Handler that is called when the focus within state changes. */\n onFocusWithinChange?: (isFocusWithin: boolean) => void;\n}\n\nexport interface FocusWithinResult {\n /** Props to spread onto the target element. */\n focusWithinProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\nfunction getActiveElement(doc: Document): Element | null {\n let activeElement = doc.activeElement;\n while (activeElement && (activeElement as Element).shadowRoot?.activeElement) {\n activeElement = (activeElement as Element).shadowRoot?.activeElement ?? null;\n }\n return activeElement;\n}\n\nfunction createSyntheticBlurHandler(\n _onBlurWithin: ((e: FocusEvent) => void) | undefined\n): (_e: FocusEvent, target: Element) => (() => void) | undefined {\n let isFocused = false;\n let observer: MutationObserver | null = null;\n\n return (_e: FocusEvent, target: Element) => {\n if (\n target instanceof HTMLButtonElement ||\n target instanceof HTMLInputElement ||\n target instanceof HTMLTextAreaElement ||\n target instanceof HTMLSelectElement\n ) {\n isFocused = true;\n\n const onBlurHandler = () => {\n isFocused = false;\n\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n };\n\n target.addEventListener('focusout', onBlurHandler, { once: true });\n\n observer = new MutationObserver(() => {\n if (isFocused && (target as HTMLButtonElement).disabled) {\n observer?.disconnect();\n const relatedTarget = target === document.activeElement ? null : document.activeElement;\n target.dispatchEvent(new FocusEvent('blur', { relatedTarget }));\n target.dispatchEvent(new FocusEvent('focusout', { bubbles: true, relatedTarget }));\n }\n });\n\n observer.observe(target, { attributes: true, attributeFilter: ['disabled'] });\n\n return () => {\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n };\n }\n\n return undefined;\n };\n}\n\n/**\n * Handles focus events for the target and its descendants.\n *\n * Based on react-aria's useFocusWithin but adapted for SolidJS.\n */\nexport function createFocusWithin(props: FocusWithinProps = {}): FocusWithinResult {\n const { isDisabled, onBlurWithin, onFocusWithin, onFocusWithinChange } = props;\n\n // State tracking\n let isFocusWithin = false;\n\n // Global listeners manager\n const { addGlobalListener, removeAllGlobalListeners } = createGlobalListeners();\n const syntheticBlurHandler = createSyntheticBlurHandler(onBlurWithin);\n let cleanupRef: (() => void) | undefined;\n\n // Cleanup on unmount\n onCleanup(() => {\n cleanupRef?.();\n removeAllGlobalListeners();\n });\n\n const onBlur: JSX.EventHandler<HTMLElement, FocusEvent> = (e) => {\n // Ignore events bubbling through portals\n if (!e.currentTarget.contains(e.target as Node)) {\n return;\n }\n\n // We don't want to trigger onBlurWithin and then immediately onFocusWithin again\n // when moving focus inside the element. Only trigger if the currentTarget doesn't\n // include the relatedTarget (where focus is moving).\n if (isFocusWithin && !e.currentTarget.contains(e.relatedTarget as Node)) {\n isFocusWithin = false;\n removeAllGlobalListeners();\n cleanupRef?.();\n cleanupRef = undefined;\n\n if (onBlurWithin) {\n onBlurWithin(e);\n }\n\n if (onFocusWithinChange) {\n onFocusWithinChange(false);\n }\n }\n };\n\n const onFocus: JSX.EventHandler<HTMLElement, FocusEvent> = (e) => {\n // Ignore events bubbling through portals\n if (!e.currentTarget.contains(e.target as Node)) {\n return;\n }\n\n // Double check that document.activeElement actually matches e.target\n // in case a previously chained focus handler already moved focus somewhere else.\n const ownerDocument = getOwnerDocument(e.target);\n const activeElement = ownerDocument ? getActiveElement(ownerDocument) : null;\n\n if (!isFocusWithin && activeElement === getEventTarget(e)) {\n if (onFocusWithin) {\n onFocusWithin(e);\n }\n\n if (onFocusWithinChange) {\n onFocusWithinChange(true);\n }\n\n isFocusWithin = true;\n cleanupRef = syntheticBlurHandler(e, e.target);\n\n // Browsers don't fire blur events when elements are removed from the DOM.\n // However, if a focus event occurs outside the element we're tracking, we\n // can manually fire onBlur.\n const currentTarget = e.currentTarget;\n\n addGlobalListener(\n 'focus',\n (focusEvent: Event) => {\n if (isFocusWithin && !nodeContains(currentTarget, (focusEvent as FocusEvent).target as Element)) {\n // Create a synthetic blur event\n const window = ownerDocument?.defaultView;\n if (window) {\n const nativeEvent = new window.FocusEvent('blur', {\n relatedTarget: (focusEvent as FocusEvent).target as Element,\n });\n setEventTarget(nativeEvent, currentTarget);\n\n isFocusWithin = false;\n removeAllGlobalListeners();\n\n if (onBlurWithin) {\n onBlurWithin(nativeEvent);\n }\n\n if (onFocusWithinChange) {\n onFocusWithinChange(false);\n }\n cleanupRef?.();\n cleanupRef = undefined;\n }\n }\n },\n { capture: true }\n );\n }\n };\n\n if (isDisabled) {\n return {\n focusWithinProps: {\n onFocus: undefined,\n onBlur: undefined,\n },\n };\n }\n\n return {\n focusWithinProps: {\n onFocus,\n onBlur,\n },\n };\n}\n", "/**\n * createFocusable - Makes an element focusable and capable of auto focus.\n *\n * This is a 1-1 port of React-Aria's useFocusable hook adapted for SolidJS.\n */\n\nimport { JSX, Accessor, createContext, useContext, onMount } from 'solid-js';\nimport { createFocus, type FocusEvents } from './createFocus';\nimport { createKeyboard, type KeyboardEvents } from './createKeyboard';\nimport { mergeProps, focusSafely } from '../utils';\n\nexport interface FocusableDOMProps {\n /** Whether to exclude the element from the sequential tab order. */\n excludeFromTabOrder?: boolean;\n}\n\nexport interface FocusableProps extends FocusEvents, KeyboardEvents {\n /** Whether the element should receive focus on mount. */\n autoFocus?: boolean;\n}\n\nexport interface CreateFocusableProps extends FocusableProps, FocusableDOMProps {\n /** Whether focus should be disabled. */\n isDisabled?: Accessor<boolean> | boolean;\n}\n\nexport interface FocusableResult {\n /** Props to spread on the focusable element. */\n focusableProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n// --- FocusableContext ---\n\nexport interface FocusableContextValue {\n ref?: (el: HTMLElement) => void;\n [key: string]: unknown;\n}\n\n/**\n * Context for passing focusable props to nested focusable children.\n * Used by FocusableProvider to pass DOM props to the nearest focusable child.\n */\nexport const FocusableContext = createContext<FocusableContextValue | null>(null);\n\n/**\n * Hook to consume the FocusableContext and sync the ref.\n */\nfunction useFocusableContext(\n setRef: (el: HTMLElement) => void\n): Omit<FocusableContextValue, 'ref'> {\n const context = useContext(FocusableContext) || {};\n\n // If context has a ref, sync our ref to it\n if (context.ref) {\n const contextRef = context.ref;\n // Create a combined ref that calls both\n const originalSetRef = setRef;\n setRef = (el: HTMLElement) => {\n originalSetRef(el);\n contextRef(el);\n };\n }\n\n // Return context without the ref\n const { ref: _, ...otherProps } = context;\n return otherProps;\n}\n\nexport interface FocusableProviderProps {\n /** The child element to provide DOM props to. */\n children?: JSX.Element;\n}\n\nfunction isDisabledValue(isDisabled: Accessor<boolean> | boolean | undefined): boolean {\n if (typeof isDisabled === 'function') {\n return isDisabled();\n }\n return isDisabled ?? false;\n}\n\n/**\n * Makes an element focusable, handling disabled state and tab order.\n * Provides focus state tracking and autoFocus support.\n *\n * Based on react-aria's useFocusable but adapted for SolidJS.\n *\n * @example\n * ```tsx\n * import { createFocusable } from 'solidaria';\n *\n * function FocusableInput(props) {\n * let ref;\n * const { focusableProps } = createFocusable({\n * autoFocus: props.autoFocus,\n * onFocusChange: (focused) => console.log('Focus:', focused),\n * });\n *\n * return (\n * <input\n * {...focusableProps}\n * ref={(el) => { ref = el; focusableProps.ref?.(el); }}\n * />\n * );\n * }\n * ```\n */\nexport function createFocusable(\n props: CreateFocusableProps = {},\n ref?: (el: HTMLElement) => void\n): FocusableResult {\n let elementRef: HTMLElement | null = null;\n let autoFocusDone = false;\n\n // Set up ref handler\n const setRef = (el: HTMLElement) => {\n elementRef = el;\n ref?.(el);\n };\n\n // Get focus and keyboard props from the respective hooks\n const { focusProps } = createFocus({\n isDisabled: isDisabledValue(props.isDisabled),\n onFocus: props.onFocus,\n onBlur: props.onBlur,\n onFocusChange: props.onFocusChange,\n });\n\n const { keyboardProps } = createKeyboard({\n isDisabled: isDisabledValue(props.isDisabled),\n onKeyDown: props.onKeyDown,\n onKeyUp: props.onKeyUp,\n });\n\n // Merge focus and keyboard interactions\n const interactions = mergeProps(focusProps, keyboardProps);\n\n // Get context props (from FocusableProvider if present)\n const contextProps = useFocusableContext(setRef);\n const interactionProps = isDisabledValue(props.isDisabled) ? {} : contextProps;\n\n // Handle autoFocus\n onMount(() => {\n if (props.autoFocus && elementRef && !autoFocusDone) {\n focusSafely(elementRef);\n autoFocusDone = true;\n }\n });\n\n // Always set a tabIndex so that Safari allows focusing native buttons and inputs.\n let tabIndex: number | undefined = props.excludeFromTabOrder ? -1 : 0;\n if (isDisabledValue(props.isDisabled)) {\n tabIndex = undefined;\n }\n\n // Build final focusable props\n const focusableProps = mergeProps(\n {\n ...interactions,\n tabIndex,\n ref: setRef,\n },\n interactionProps\n ) as JSX.HTMLAttributes<HTMLElement>;\n\n return {\n focusableProps,\n };\n}\n", "/**\n * createKeyboard - Handles keyboard interactions for a focusable element.\n *\n * This is a 1-1 port of React-Aria's useKeyboard hook adapted for SolidJS.\n */\n\nimport { JSX } from 'solid-js';\n\n/**\n * Keyboard event with continuePropagation support.\n * By default, keyboard events stop propagation.\n */\nexport interface KeyboardEvent extends globalThis.KeyboardEvent {\n /** Call this to allow the event to propagate to parent elements. */\n continuePropagation(): void;\n}\n\nexport interface KeyboardEvents {\n /** Handler that is called when a key is pressed. */\n onKeyDown?: (e: KeyboardEvent) => void;\n /** Handler that is called when a key is released. */\n onKeyUp?: (e: KeyboardEvent) => void;\n}\n\nexport interface CreateKeyboardProps extends KeyboardEvents {\n /** Whether the keyboard events should be disabled. */\n isDisabled?: boolean;\n}\n\nexport interface KeyboardResult {\n /** Props to spread onto the target element. */\n keyboardProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n/**\n * Wraps a keyboard event handler to make stopPropagation the default,\n * and support continuePropagation instead.\n */\nfunction createEventHandler<T extends globalThis.KeyboardEvent>(\n handler?: (e: KeyboardEvent) => void\n): ((e: T) => void) | undefined {\n if (!handler) {\n return undefined;\n }\n\n return (e: T) => {\n let shouldStopPropagation = true;\n\n // Create a wrapped event with continuePropagation\n const event = Object.assign(e, {\n continuePropagation() {\n shouldStopPropagation = false;\n },\n }) as KeyboardEvent;\n\n handler(event);\n\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n };\n}\n\n/**\n * Handles keyboard interactions for a focusable element.\n *\n * Based on react-aria's useKeyboard but adapted for SolidJS.\n */\nexport function createKeyboard(props: CreateKeyboardProps = {}): KeyboardResult {\n if (props.isDisabled) {\n return {\n keyboardProps: {},\n };\n }\n\n return {\n keyboardProps: {\n onKeyDown: createEventHandler(props.onKeyDown),\n onKeyUp: createEventHandler(props.onKeyUp),\n },\n };\n}\n", "/**\n * createFocusRing hook for Solidaria\n *\n * Determines whether a focus ring should be visible for a given element.\n * Focus rings are visible when the user navigates with keyboard, but hidden\n * when using mouse/touch.\n *\n * Port of @react-aria/focus useFocusRing.\n */\n\nimport { type JSX, type Accessor, createSignal, createEffect, onCleanup, createMemo } from 'solid-js';\nimport { createFocus } from './createFocus';\nimport { createFocusWithin } from './createFocusWithin';\nimport {\n createFocusVisibleListener,\n isFocusVisible as isGlobalFocusVisible,\n} from './createInteractionModality';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface FocusRingProps {\n /** Whether the element is a text input. */\n isTextInput?: boolean;\n /** Whether the element will be auto focused. */\n autoFocus?: boolean;\n /** Whether focus should be tracked within the element. */\n within?: boolean;\n}\n\nexport interface FocusRingResult {\n /** Whether the element is currently focused. */\n isFocused: Accessor<boolean>;\n /** Whether the focus ring should be visible. */\n isFocusVisible: Accessor<boolean>;\n /** Props to spread on the element to track focus. */\n focusProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Determines whether a focus ring should be visible for a given element.\n *\n * Focus rings are visible when:\n * - The element is focused AND\n * - The user is navigating with keyboard (not mouse/touch)\n *\n * For text inputs, focus rings are always visible when focused.\n */\nexport function createFocusRing(props: FocusRingProps = {}): FocusRingResult {\n const { isTextInput = false, autoFocus = false, within = false } = props;\n\n const [isFocused, setIsFocused] = createSignal(false);\n const [focusVisibleFlag, setFocusVisibleFlag] = createSignal(\n autoFocus || isGlobalFocusVisible()\n );\n const isFocusVisible = createMemo(() => isFocused() && focusVisibleFlag());\n\n createEffect(() => {\n const cleanup = createFocusVisibleListener((visible) => {\n setFocusVisibleFlag(visible);\n }, { isTextInput });\n onCleanup(cleanup);\n });\n\n const onFocusChange = (focused: boolean) => {\n setIsFocused(focused);\n };\n\n const focusResult = createFocus({\n isDisabled: within,\n onFocusChange,\n });\n\n const focusWithinResult = createFocusWithin({\n isDisabled: !within,\n onFocusWithinChange: onFocusChange,\n });\n\n return {\n isFocused,\n isFocusVisible,\n focusProps: (within ? focusWithinResult.focusWithinProps : focusResult.focusProps) as JSX.HTMLAttributes<HTMLElement>,\n };\n}\n", "/**\n * createInteractionModality + focus-visible tracking for solidaria\n *\n * Port of @react-aria/interactions useFocusVisible/useInteractionModality.\n * Tracks the current interaction modality (keyboard, pointer, or virtual) and\n * provides focus-visible state and listeners.\n */\n\nimport { type Accessor, createSignal, createEffect, onCleanup } from 'solid-js';\nimport { isServer } from 'solid-js/web';\nimport { getOwnerDocument, getOwnerWindow, isMac, isVirtualClick, openLink } from '../utils';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport type Modality = 'keyboard' | 'pointer' | 'virtual';\nexport type PointerType = 'mouse' | 'pen' | 'touch' | 'keyboard' | 'virtual';\ntype HandlerEvent = PointerEvent | MouseEvent | KeyboardEvent | FocusEvent | null;\ntype Handler = (modality: Modality, e: HandlerEvent) => void;\n\nexport type FocusVisibleHandler = (isFocusVisible: boolean) => void;\n\nexport interface FocusVisibleProps {\n /** Whether the element is a text input. */\n isTextInput?: boolean;\n /** Whether the element will be auto focused. */\n autoFocus?: boolean;\n}\n\nexport interface FocusVisibleResult {\n /** Whether keyboard focus is visible globally. */\n isFocusVisible: Accessor<boolean>;\n}\n\nexport interface InteractionModalityResult {\n /** The current interaction modality. */\n modality: Accessor<Modality | null>;\n}\n\n// ============================================\n// GLOBAL STATE\n// ============================================\n\nlet currentModality: Modality | null = null;\nlet currentPointerType: PointerType = 'keyboard';\nconst changeHandlers = new Set<Handler>();\n\nexport let hasSetupGlobalListeners: Map<\n Window,\n { focus: typeof window.HTMLElement.prototype.focus; canOverride: boolean }\n> = new Map();\nlet hasEventBeforeFocus = false;\nlet hasBlurredWindowRecently = false;\nlet ignoreFocusEvent = false;\n\nconst FOCUS_VISIBLE_INPUT_KEYS: Record<string, boolean> = {\n Tab: true,\n Escape: true,\n};\n\nfunction triggerChangeHandlers(modality: Modality, e: HandlerEvent) {\n for (const handler of changeHandlers) {\n handler(modality, e);\n }\n}\n\nfunction isValidKey(e: KeyboardEvent) {\n return !(\n e.metaKey ||\n (!isMac() && e.altKey) ||\n e.ctrlKey ||\n e.key === 'Control' ||\n e.key === 'Shift' ||\n e.key === 'Meta'\n );\n}\n\nfunction handleKeyboardEvent(e: KeyboardEvent) {\n hasEventBeforeFocus = true;\n const isOpening = (openLink as { isOpening?: boolean }).isOpening;\n if (!isOpening && isValidKey(e)) {\n currentModality = 'keyboard';\n currentPointerType = 'keyboard';\n triggerChangeHandlers('keyboard', e);\n }\n}\n\nfunction handlePointerEvent(e: PointerEvent | MouseEvent) {\n currentModality = 'pointer';\n currentPointerType = 'pointerType' in e ? (e.pointerType as PointerType) : 'mouse';\n if (e.type === 'mousedown' || e.type === 'pointerdown') {\n hasEventBeforeFocus = true;\n triggerChangeHandlers('pointer', e);\n }\n}\n\nfunction handleClickEvent(e: MouseEvent) {\n const isOpening = (openLink as { isOpening?: boolean }).isOpening;\n if (!isOpening && isVirtualClick(e)) {\n hasEventBeforeFocus = true;\n currentModality = 'virtual';\n currentPointerType = 'virtual';\n }\n}\n\nfunction handleFocusEvent(e: FocusEvent) {\n if (!e.isTrusted || ignoreFocusEvent) {\n return;\n }\n\n const target = e.target as EventTarget | null;\n const targetElement = target && (target as Element).nodeType ? (target as Element) : null;\n const ownerWindow = targetElement ? getOwnerWindow(targetElement) : window;\n const ownerDocument = targetElement ? getOwnerDocument(targetElement) : document;\n\n if (target === ownerWindow || target === ownerDocument) {\n return;\n }\n\n if (!hasEventBeforeFocus && !hasBlurredWindowRecently) {\n currentModality = 'virtual';\n currentPointerType = 'virtual';\n triggerChangeHandlers('virtual', e);\n }\n\n hasEventBeforeFocus = false;\n hasBlurredWindowRecently = false;\n}\n\nfunction handleWindowBlur() {\n if (ignoreFocusEvent) {\n return;\n }\n\n hasEventBeforeFocus = false;\n hasBlurredWindowRecently = true;\n}\n\nfunction setupGlobalFocusEvents(element?: HTMLElement | null) {\n if (typeof window === 'undefined' || typeof document === 'undefined') {\n return;\n }\n\n const windowObject = getOwnerWindow(element);\n if (hasSetupGlobalListeners.get(windowObject)) {\n return;\n }\n\n const documentObject = getOwnerDocument(element);\n\n const originalFocus = windowObject.HTMLElement.prototype.focus;\n let canOverride = true;\n try {\n windowObject.HTMLElement.prototype.focus = function () {\n hasEventBeforeFocus = true;\n originalFocus.apply(this, arguments as unknown as [options?: FocusOptions | undefined]);\n };\n } catch {\n canOverride = false;\n }\n\n documentObject.addEventListener('keydown', handleKeyboardEvent, true);\n documentObject.addEventListener('keyup', handleKeyboardEvent, true);\n documentObject.addEventListener('click', handleClickEvent, true);\n\n windowObject.addEventListener('focus', handleFocusEvent, true);\n windowObject.addEventListener('blur', handleWindowBlur, false);\n\n if (typeof windowObject.PointerEvent !== 'undefined') {\n documentObject.addEventListener('pointerdown', handlePointerEvent, true);\n documentObject.addEventListener('pointermove', handlePointerEvent, true);\n documentObject.addEventListener('pointerup', handlePointerEvent, true);\n } else {\n documentObject.addEventListener('mousedown', handlePointerEvent, true);\n documentObject.addEventListener('mousemove', handlePointerEvent, true);\n documentObject.addEventListener('mouseup', handlePointerEvent, true);\n }\n\n windowObject.addEventListener(\n 'beforeunload',\n () => {\n tearDownWindowFocusTracking(element);\n },\n { once: true }\n );\n\n hasSetupGlobalListeners.set(windowObject, { focus: originalFocus, canOverride });\n}\n\nfunction tearDownWindowFocusTracking(element?: HTMLElement | null, loadListener?: () => void) {\n if (typeof window === 'undefined' || typeof document === 'undefined') {\n return;\n }\n\n const windowObject = getOwnerWindow(element);\n const documentObject = getOwnerDocument(element);\n\n if (loadListener) {\n documentObject.removeEventListener('DOMContentLoaded', loadListener);\n }\n\n if (!hasSetupGlobalListeners.has(windowObject)) {\n return;\n }\n\n const entry = hasSetupGlobalListeners.get(windowObject)!;\n if (entry.canOverride) {\n windowObject.HTMLElement.prototype.focus = entry.focus;\n }\n\n documentObject.removeEventListener('keydown', handleKeyboardEvent, true);\n documentObject.removeEventListener('keyup', handleKeyboardEvent, true);\n documentObject.removeEventListener('click', handleClickEvent, true);\n\n windowObject.removeEventListener('focus', handleFocusEvent, true);\n windowObject.removeEventListener('blur', handleWindowBlur, false);\n\n if (typeof windowObject.PointerEvent !== 'undefined') {\n documentObject.removeEventListener('pointerdown', handlePointerEvent, true);\n documentObject.removeEventListener('pointermove', handlePointerEvent, true);\n documentObject.removeEventListener('pointerup', handlePointerEvent, true);\n } else {\n documentObject.removeEventListener('mousedown', handlePointerEvent, true);\n documentObject.removeEventListener('mousemove', handlePointerEvent, true);\n documentObject.removeEventListener('mouseup', handlePointerEvent, true);\n }\n\n hasSetupGlobalListeners.delete(windowObject);\n}\n\n/**\n * Adds a window (i.e. iframe) to the list of windows that are being tracked for focus visible.\n */\nexport function addWindowFocusTracking(element?: HTMLElement | null): () => void {\n const documentObject = getOwnerDocument(element);\n let loadListener: (() => void) | undefined;\n\n if (documentObject.readyState !== 'loading') {\n setupGlobalFocusEvents(element);\n } else {\n loadListener = () => {\n setupGlobalFocusEvents(element);\n };\n documentObject.addEventListener('DOMContentLoaded', loadListener);\n }\n\n return () => tearDownWindowFocusTracking(element, loadListener);\n}\n\nexport function setupGlobalFocusListeners(): void {\n addWindowFocusTracking();\n}\n\nif (typeof document !== 'undefined') {\n addWindowFocusTracking();\n}\n\n/**\n * If true, keyboard focus is visible.\n */\nexport function isFocusVisible(): boolean {\n return currentModality !== 'pointer';\n}\n\n/**\n * Gets the current interaction modality.\n */\nexport function getInteractionModality(): Modality | null {\n return currentModality;\n}\n\n/**\n * Sets the current interaction modality.\n */\nexport function setInteractionModality(modality: Modality): void {\n currentModality = modality;\n currentPointerType = modality === 'pointer' ? 'mouse' : modality;\n triggerChangeHandlers(modality, null);\n}\n\n/**\n * Gets the current pointer type.\n */\nexport function getPointerType(): PointerType {\n return currentPointerType;\n}\n\nfunction isKeyboardFocusEvent(\n isTextInput: boolean,\n modality: Modality,\n e: HandlerEvent\n): boolean {\n if (!e) {\n return true;\n }\n\n const target = 'target' in e ? (e.target as Element | null) : null;\n const ownerDocument = target ? getOwnerDocument(target) : document;\n const ownerWindow = target ? getOwnerWindow(target) : window;\n\n const IHTMLInputElement = ownerWindow.HTMLInputElement;\n const IHTMLTextAreaElement = ownerWindow.HTMLTextAreaElement;\n const IHTMLElement = ownerWindow.HTMLElement;\n const IKeyboardEvent = ownerWindow.KeyboardEvent;\n\n const nonTextInputTypes = new Set([\n 'checkbox',\n 'radio',\n 'range',\n 'color',\n 'file',\n 'image',\n 'button',\n 'submit',\n 'reset',\n ]);\n\n isTextInput =\n isTextInput ||\n (ownerDocument.activeElement instanceof IHTMLInputElement &&\n !nonTextInputTypes.has(ownerDocument.activeElement.type)) ||\n ownerDocument.activeElement instanceof IHTMLTextAreaElement ||\n (ownerDocument.activeElement instanceof IHTMLElement && ownerDocument.activeElement.isContentEditable);\n\n return !(\n isTextInput &&\n modality === 'keyboard' &&\n e instanceof IKeyboardEvent &&\n !FOCUS_VISIBLE_INPUT_KEYS[e.key]\n );\n}\n\n/**\n * Listens for trigger change and reports if focus is visible.\n */\nexport function createFocusVisibleListener(\n handler: FocusVisibleHandler,\n opts?: { isTextInput?: boolean }\n): () => void {\n setupGlobalFocusEvents();\n const listener: Handler = (modality: Modality, e: HandlerEvent) => {\n if (!isKeyboardFocusEvent(!!opts?.isTextInput, modality, e)) {\n return;\n }\n handler(isFocusVisible());\n };\n changeHandlers.add(listener);\n return () => {\n changeHandlers.delete(listener);\n };\n}\n\n/**\n * Manages focus visible state for the page.\n */\nexport function createFocusVisible(props: FocusVisibleProps = {}): FocusVisibleResult {\n if (isServer) {\n return { isFocusVisible: () => false };\n }\n\n const { isTextInput, autoFocus } = props;\n const [isVisible, setIsVisible] = createSignal<boolean>(autoFocus || isFocusVisible());\n\n createEffect(() => {\n const cleanup = createFocusVisibleListener(setIsVisible, { isTextInput });\n onCleanup(cleanup);\n });\n\n return { isFocusVisible: isVisible };\n}\n\n/**\n * Tracks the current interaction modality.\n */\nexport function createInteractionModality(): InteractionModalityResult {\n if (isServer) {\n return {\n modality: () => null,\n };\n }\n\n const [modality, setModality] = createSignal<Modality | null>(currentModality);\n\n createEffect(() => {\n setupGlobalFocusEvents();\n const handler: Handler = (newModality: Modality) => {\n setModality(newModality);\n };\n changeHandlers.add(handler);\n onCleanup(() => {\n changeHandlers.delete(handler);\n });\n });\n\n return {\n modality,\n };\n}\n\n/**\n * Adds a listener for modality changes.\n */\nexport function addModalityListener(handler: (modality: Modality) => void): () => void {\n const wrapped: Handler = (modality) => {\n handler(modality);\n };\n changeHandlers.add(wrapped);\n return () => {\n changeHandlers.delete(wrapped);\n };\n}\n\n/**\n * Hook to track whether the user is currently interacting with the keyboard.\n */\nexport function useIsKeyboardFocused(): Accessor<boolean> {\n if (isServer) {\n return () => false;\n }\n\n const { modality } = createInteractionModality();\n return () => modality() === 'keyboard';\n}\n", "/**\n * createHover hook for Solidaria\n *\n * Handles pointer hover interactions for an element. Normalizes behavior\n * across browsers and platforms, and ignores emulated mouse events on touch devices.\n *\n * Port of @react-aria/interactions useHover.\n */\n\nimport { type JSX, type Accessor, createSignal, createEffect, onCleanup, createMemo } from 'solid-js';\nimport { type MaybeAccessor, access } from '../utils/reactivity';\nimport { isTestEnv } from '../utils/env';\nimport { createGlobalListeners, nodeContains } from '../utils';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface HoverEvent {\n /** The type of hover event being fired. */\n type: 'hoverstart' | 'hoverend';\n /** The pointer type that triggered the hover event. */\n pointerType: 'mouse' | 'pen';\n /** The target element of the hover event. */\n target: Element;\n}\n\nexport interface HoverEvents {\n /** Handler called when the hover starts. */\n onHoverStart?: (e: HoverEvent) => void;\n /** Handler called when the hover ends. */\n onHoverEnd?: (e: HoverEvent) => void;\n /** Handler called when the hover state changes. */\n onHoverChange?: (isHovering: boolean) => void;\n}\n\nexport interface CreateHoverProps extends HoverEvents {\n /** Whether the hover events should be disabled. */\n isDisabled?: boolean;\n}\n\n/** Event handler props returned by createHover - safe to spread on any element */\nexport type HoverProps = Pick<\n JSX.HTMLAttributes<HTMLElement>,\n | 'onPointerEnter'\n | 'onPointerLeave'\n | 'onPointerOver'\n | 'onPointerOut'\n | 'onMouseEnter'\n | 'onMouseLeave'\n>;\n\nexport interface HoverResult {\n /** Props to spread on the target element. */\n hoverProps: HoverProps;\n /** Whether the element is currently hovered. */\n isHovered: Accessor<boolean>;\n}\n\n// ============================================\n// GLOBAL STATE\n// ============================================\n\n// iOS fires onPointerEnter twice: once with pointerType=\"touch\" and again with pointerType=\"mouse\".\n// We want to ignore these emulated events so they do not trigger hover behavior.\nlet globalIgnoreEmulatedMouseEvents = false;\nlet hoverCount = 0;\n\nfunction setGlobalIgnoreEmulatedMouseEvents() {\n globalIgnoreEmulatedMouseEvents = true;\n setTimeout(() => {\n globalIgnoreEmulatedMouseEvents = false;\n }, 50);\n}\n\nfunction handleGlobalPointerEvent(e: PointerEvent) {\n if (e.pointerType === 'touch') {\n setGlobalIgnoreEmulatedMouseEvents();\n }\n}\n\nfunction setupGlobalTouchEvents() {\n if (typeof document === 'undefined') {\n return () => {};\n }\n\n if (hoverCount === 0) {\n if (typeof PointerEvent !== 'undefined') {\n document.addEventListener('pointerup', handleGlobalPointerEvent);\n } else if (isTestEnv()) {\n document.addEventListener('touchend', setGlobalIgnoreEmulatedMouseEvents);\n }\n }\n\n hoverCount++;\n return () => {\n hoverCount--;\n if (hoverCount > 0) {\n return;\n }\n\n if (typeof PointerEvent !== 'undefined') {\n document.removeEventListener('pointerup', handleGlobalPointerEvent);\n } else if (isTestEnv()) {\n document.removeEventListener('touchend', setGlobalIgnoreEmulatedMouseEvents);\n }\n };\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Handles pointer hover interactions for an element.\n */\nexport function createHover(props: MaybeAccessor<CreateHoverProps> = {}): HoverResult {\n const getProps = () => access(props);\n const [isHovered, setIsHovered] = createSignal(false);\n const { addGlobalListener, removeAllGlobalListeners } = createGlobalListeners();\n\n // Track internal hover state\n let state = {\n isHovered: false,\n ignoreEmulatedMouseEvents: false,\n pointerType: '' as 'mouse' | 'pen' | '',\n target: null as Element | null,\n };\n\n // Setup global touch events\n createEffect(() => {\n const cleanup = setupGlobalTouchEvents();\n onCleanup(cleanup);\n });\n\n // Reset hover when disabled\n createEffect(() => {\n const p = getProps();\n if (p.isDisabled && state.isHovered) {\n triggerHoverEnd(state.target as Element, state.pointerType as 'mouse' | 'pen');\n }\n });\n\n function triggerHoverStart(target: Element, pointerType: 'mouse' | 'pen', eventTarget: Element | null) {\n const p = getProps();\n state.pointerType = pointerType;\n\n const isOverTarget = eventTarget instanceof Element ? target.contains(eventTarget) : true;\n if (p.isDisabled || state.isHovered || !isOverTarget) {\n return;\n }\n\n state.isHovered = true;\n state.target = target;\n\n addGlobalListener('pointerover', (event: PointerEvent) => {\n if (state.isHovered && state.target && !nodeContains(state.target, event.target as Element)) {\n triggerHoverEnd(event.target as Element, event.pointerType as 'mouse' | 'pen');\n }\n }, { capture: true });\n\n p.onHoverStart?.({\n type: 'hoverstart',\n target,\n pointerType,\n });\n\n p.onHoverChange?.(true);\n setIsHovered(true);\n }\n\n function triggerHoverEnd(target: Element | null, pointerType: 'mouse' | 'pen') {\n const p = getProps();\n state.pointerType = '';\n state.target = null;\n\n if (!state.isHovered || !target) {\n return;\n }\n\n state.isHovered = false;\n removeAllGlobalListeners();\n\n p.onHoverEnd?.({\n type: 'hoverend',\n target,\n pointerType,\n });\n\n p.onHoverChange?.(false);\n setIsHovered(false);\n }\n\n const hoverProps = createMemo<JSX.HTMLAttributes<HTMLElement>>(() => {\n if (typeof PointerEvent !== 'undefined') {\n return {\n onPointerEnter: (e: PointerEvent) => {\n if (globalIgnoreEmulatedMouseEvents && e.pointerType === 'mouse') {\n return;\n }\n if (e.pointerType === 'touch') {\n return;\n }\n triggerHoverStart(e.currentTarget as Element, e.pointerType as 'mouse' | 'pen', e.target as Element);\n },\n onPointerLeave: (e: PointerEvent) => {\n const p = getProps();\n if (!p.isDisabled && (e.currentTarget as Element).contains(e.target as Element)) {\n triggerHoverEnd(e.currentTarget as Element, e.pointerType as 'mouse' | 'pen');\n }\n },\n onPointerOver: (e: PointerEvent) => {\n if (globalIgnoreEmulatedMouseEvents && e.pointerType === 'mouse') {\n return;\n }\n if (e.pointerType === 'touch') {\n return;\n }\n triggerHoverStart(e.currentTarget as Element, e.pointerType as 'mouse' | 'pen', e.target as Element);\n },\n onPointerOut: (e: PointerEvent) => {\n const p = getProps();\n if (!p.isDisabled && (e.currentTarget as Element).contains(e.target as Element)) {\n triggerHoverEnd(e.currentTarget as Element, e.pointerType as 'mouse' | 'pen');\n }\n },\n };\n }\n\n // Fallback for environments without PointerEvent (mainly tests)\n return {\n onTouchStart: () => {\n state.ignoreEmulatedMouseEvents = true;\n },\n onMouseEnter: (e: MouseEvent) => {\n if (!state.ignoreEmulatedMouseEvents && !globalIgnoreEmulatedMouseEvents) {\n triggerHoverStart(e.currentTarget as Element, 'mouse', e.target as Element);\n }\n state.ignoreEmulatedMouseEvents = false;\n },\n onMouseLeave: (e: MouseEvent) => {\n const p = getProps();\n if (!p.isDisabled && (e.currentTarget as Element).contains(e.target as Element)) {\n triggerHoverEnd(e.currentTarget as Element, 'mouse');\n }\n },\n };\n });\n\n return {\n hoverProps: hoverProps() as HoverProps,\n isHovered,\n };\n}\n", "import { Accessor } from 'solid-js';\nimport { createPress } from '../interactions';\nimport { createFocusable } from '../interactions';\nimport { mergeProps, filterDOMProps } from '../utils';\nimport type { AriaButtonProps, ButtonAria } from './types';\n\nfunction isDisabledValue(isDisabled: Accessor<boolean> | boolean | undefined): boolean {\n if (typeof isDisabled === 'function') {\n return isDisabled();\n }\n return isDisabled ?? false;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a button component.\n * Handles press interactions across mouse, touch, keyboard and screen readers.\n *\n * Based on react-aria's useButton but adapted for SolidJS.\n *\n * @example\n * ```tsx\n * import { createButton } from 'solidaria';\n *\n * function Button(props) {\n * let ref;\n * const { buttonProps, isPressed } = createButton(props);\n *\n * return (\n * <button\n * {...buttonProps}\n * ref={ref}\n * class={isPressed() ? 'pressed' : ''}\n * >\n * {props.children}\n * </button>\n * );\n * }\n * ```\n */\nexport function createButton(props: AriaButtonProps = {}): ButtonAria {\n const elementType = props.elementType ?? 'button';\n\n const { pressProps, isPressed } = createPress({\n isDisabled: props.isDisabled,\n onPress: props.onPress,\n onPressStart: props.onPressStart,\n onPressEnd: props.onPressEnd,\n onPressUp: props.onPressUp,\n onPressChange: props.onPressChange,\n onClick: props.onClick,\n preventFocusOnPress: props.preventFocusOnPress,\n });\n\n const { focusableProps } = createFocusable({\n isDisabled: props.isDisabled,\n autoFocus: props.autoFocus,\n excludeFromTabOrder: props.excludeFromTabOrder,\n });\n\n const isNativeButton = elementType === 'button' || elementType === 'input';\n const isLink = elementType === 'a';\n const disabled = isDisabledValue(props.isDisabled);\n\n // Handle allowFocusWhenDisabled - set tabIndex to -1 when disabled but focusable\n // This allows tooltips to be shown on disabled buttons\n if (props.allowFocusWhenDisabled && disabled) {\n (focusableProps as Record<string, unknown>).tabIndex = -1;\n }\n\n // Build base props based on element type\n let additionalProps: Record<string, unknown> = {};\n\n if (isNativeButton) {\n additionalProps = {\n type: props.type ?? 'button',\n disabled: disabled,\n // Form-related attributes\n ...(props.form && { form: props.form }),\n ...(props.formAction && { formAction: props.formAction }),\n ...(props.formEncType && { formEncType: props.formEncType }),\n ...(props.formMethod && { formMethod: props.formMethod }),\n ...(props.formNoValidate && { formNoValidate: props.formNoValidate }),\n ...(props.formTarget && { formTarget: props.formTarget }),\n ...(props.name && { name: props.name }),\n ...(props.value && { value: props.value }),\n };\n } else {\n // Non-native buttons need role and tabIndex\n additionalProps = {\n role: 'button',\n tabIndex: disabled ? undefined : 0,\n 'aria-disabled': disabled ? true : undefined,\n };\n\n if (isLink) {\n additionalProps.href = props.href;\n additionalProps.target = props.target;\n additionalProps.rel = props.rel;\n }\n }\n\n // ARIA attributes\n const ariaProps: Record<string, unknown> = {};\n\n if (props['aria-pressed'] !== undefined) {\n ariaProps['aria-pressed'] = props['aria-pressed'];\n }\n if (props['aria-haspopup'] !== undefined) {\n ariaProps['aria-haspopup'] = props['aria-haspopup'];\n }\n if (props['aria-expanded'] !== undefined) {\n ariaProps['aria-expanded'] = props['aria-expanded'];\n }\n if (props['aria-label']) {\n ariaProps['aria-label'] = props['aria-label'];\n }\n if (props['aria-labelledby']) {\n ariaProps['aria-labelledby'] = props['aria-labelledby'];\n }\n if (props['aria-describedby']) {\n ariaProps['aria-describedby'] = props['aria-describedby'];\n }\n if (props['aria-controls']) {\n ariaProps['aria-controls'] = props['aria-controls'];\n }\n if (props['aria-current'] !== undefined) {\n ariaProps['aria-current'] = props['aria-current'];\n }\n\n const buttonProps = mergeProps(\n filterDOMProps(props as Record<string, unknown>, { labelable: true }),\n additionalProps,\n ariaProps,\n focusableProps as Record<string, unknown>,\n pressProps as Record<string, unknown>\n );\n\n return {\n buttonProps,\n isPressed,\n };\n}\n", "import { Accessor, createSignal } from 'solid-js';\nimport { createButton } from './createButton';\nimport { mergeProps } from '../utils';\nimport type { AriaButtonProps, ButtonAria } from './types';\nimport type { PressEvent } from '../interactions';\n\nexport interface AriaToggleButtonProps extends Omit<AriaButtonProps, 'aria-pressed'> {\n /** Whether the button is selected (controlled). */\n isSelected?: Accessor<boolean> | boolean;\n /** Handler called when the button's selection state changes. */\n onChange?: (isSelected: boolean) => void;\n /** The default selected state (uncontrolled). */\n defaultSelected?: boolean;\n}\n\nexport interface ToggleButtonAria extends ButtonAria {\n /** Whether the button is currently selected. */\n isSelected: Accessor<boolean>;\n}\n\nfunction getSelectedValue(isSelected: Accessor<boolean> | boolean | undefined): boolean {\n if (typeof isSelected === 'function') {\n return isSelected();\n }\n return isSelected ?? false;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a toggle button component.\n * Toggle buttons allow users to toggle a selection on or off.\n *\n * Based on react-aria's useToggleButton but adapted for SolidJS.\n *\n * @example\n * ```tsx\n * import { createToggleButton } from 'solidaria';\n *\n * function ToggleButton(props) {\n * const { buttonProps, isPressed, isSelected } = createToggleButton(props);\n *\n * return (\n * <button\n * {...buttonProps}\n * class={isSelected() ? 'selected' : ''}\n * style={{ opacity: isPressed() ? 0.8 : 1 }}\n * >\n * {props.children}\n * </button>\n * );\n * }\n * ```\n */\nexport function createToggleButton(props: AriaToggleButtonProps = {}): ToggleButtonAria {\n // Handle controlled vs uncontrolled state\n const isControlled = props.isSelected !== undefined;\n const [uncontrolledSelected, setUncontrolledSelected] = createSignal(\n props.defaultSelected ?? false\n );\n\n const isSelected = (): boolean => {\n if (isControlled) {\n return getSelectedValue(props.isSelected);\n }\n return uncontrolledSelected();\n };\n\n const toggleSelection = () => {\n const newValue = !isSelected();\n if (!isControlled) {\n setUncontrolledSelected(newValue);\n }\n props.onChange?.(newValue);\n };\n\n // Create the press handler that toggles selection\n const onPress = (e: PressEvent) => {\n toggleSelection();\n props.onPress?.(e);\n };\n\n // Get button props with our custom press handler\n const { buttonProps: baseButtonProps, isPressed } = createButton(\n mergeProps(props, {\n onPress,\n }) as AriaButtonProps\n );\n\n // Create buttonProps with a getter for aria-pressed so it stays reactive\n const buttonProps = {\n ...baseButtonProps,\n get 'aria-pressed'() {\n return isSelected();\n },\n };\n\n return {\n buttonProps,\n isPressed,\n isSelected,\n };\n}\n", "/**\n * Checkbox hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a checkbox component.\n * Checkboxes allow users to select multiple items from a list of individual items,\n * or to mark one individual item as selected.\n *\n * This is a 1:1 port of @react-aria/checkbox's useCheckbox hook.\n */\n\nimport { JSX, Accessor, createEffect } from 'solid-js';\nimport { createToggle, type AriaToggleProps } from '../toggle';\nimport { type ToggleState } from '@proyecto-viviana/solid-stately';\nimport { createPress } from '../interactions/createPress';\nimport { mergeProps } from '../utils/mergeProps';\nimport { type MaybeAccessor, access } from '../utils/reactivity';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaCheckboxProps extends AriaToggleProps {\n /**\n * Indeterminism is presentational only.\n * The indeterminate visual representation remains regardless of user interaction.\n */\n isIndeterminate?: boolean;\n /**\n * Whether the checkbox is required.\n */\n isRequired?: boolean;\n /**\n * The validation behavior for the checkbox.\n * @default 'aria'\n */\n validationBehavior?: 'aria' | 'native';\n}\n\nexport interface CheckboxAria {\n /** Props for the label wrapper element. */\n labelProps: JSX.LabelHTMLAttributes<HTMLLabelElement>;\n /** Props for the input element. */\n inputProps: JSX.InputHTMLAttributes<HTMLInputElement>;\n /** Whether the checkbox is selected. */\n isSelected: Accessor<boolean>;\n /** Whether the checkbox is in a pressed state. */\n isPressed: Accessor<boolean>;\n /** Whether the checkbox is disabled. */\n isDisabled: boolean;\n /** Whether the checkbox is read only. */\n isReadOnly: boolean;\n /** Whether the checkbox is invalid. */\n isInvalid: boolean;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the behavior and accessibility implementation for a checkbox component.\n * Checkboxes allow users to select multiple items from a list of individual items,\n * or to mark one individual item as selected.\n *\n * @param props - Props for the checkbox.\n * @param state - State for the checkbox, as returned by `createToggleState`.\n * @param inputRef - A ref accessor for the HTML input element.\n */\nexport function createCheckbox(\n props: MaybeAccessor<AriaCheckboxProps>,\n state: ToggleState,\n inputRef: () => HTMLInputElement | null\n): CheckboxAria {\n const getProps = () => access(props);\n\n // Get toggle aria props\n const toggleResult = createToggle(props, state, inputRef);\n const {\n labelProps: baseLabelProps,\n isSelected,\n isPressed,\n isDisabled,\n isReadOnly,\n isInvalid,\n } = toggleResult;\n\n // Handle indeterminate state\n createEffect(() => {\n const input = inputRef();\n const isIndeterminate = getProps().isIndeterminate;\n if (input) {\n // indeterminate is a property, but it can only be set via javascript\n // https://css-tricks.com/indeterminate-checkboxes/\n input.indeterminate = !!isIndeterminate;\n }\n });\n\n // Reset validation state on label press for checkbox with a hidden input.\n const { pressProps } = createPress({\n get isDisabled() {\n return isDisabled || isReadOnly;\n },\n onPress() {\n // Validation state reset would be handled here if we had form validation\n // For now, this is a no-op placeholder matching React-Aria's pattern\n },\n });\n\n return {\n labelProps: mergeProps(\n baseLabelProps as unknown as Record<string, unknown>,\n pressProps as unknown as Record<string, unknown>,\n {\n // Prevent label from being focused when mouse down on it.\n // Note, this does not prevent the input from being focused in the `click` event.\n onMouseDown: (e: MouseEvent) => e.preventDefault(),\n } as Record<string, unknown>\n ) as JSX.LabelHTMLAttributes<HTMLLabelElement>,\n get inputProps() {\n const p = getProps();\n const { isRequired, validationBehavior = 'aria' } = p;\n\n return mergeProps(toggleResult.inputProps, {\n checked: isSelected(),\n 'aria-required': (isRequired && validationBehavior === 'aria') || undefined,\n required: isRequired && validationBehavior === 'native',\n }) as JSX.InputHTMLAttributes<HTMLInputElement>;\n },\n isSelected,\n isPressed,\n isDisabled,\n isReadOnly,\n isInvalid,\n };\n}\n", "// Re-export state from solid-stately\nexport { createToggleState } from '@proyecto-viviana/solid-stately';\nexport type { ToggleStateOptions, ToggleState } from '@proyecto-viviana/solid-stately';\n\n// ARIA hook (solidaria-specific)\nexport { createToggle } from './createToggle';\nexport type { AriaToggleProps, ToggleAria } from './createToggle';\n", "/**\n * Toggle hook for Solidaria\n *\n * Handles interactions for toggle elements, e.g. Checkboxes and Switches.\n *\n * This is a 1:1 port of @react-aria/toggle's useToggle hook.\n */\n\nimport { JSX, Accessor, createEffect } from 'solid-js';\nimport { createPress } from '../interactions/createPress';\nimport { createFocusable } from '../interactions/createFocusable';\nimport { mergeProps } from '../utils/mergeProps';\nimport { filterDOMProps } from '../utils/filterDOMProps';\nimport { type MaybeAccessor, access } from '../utils/reactivity';\nimport { isDevEnv } from '../utils/env';\nimport { type ToggleState } from '@proyecto-viviana/solid-stately';\nimport { type PressEvent } from '../interactions/PressEvent';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaToggleProps {\n /** Whether the element should be selected (controlled). */\n isSelected?: boolean;\n /** Whether the element should be selected by default (uncontrolled). */\n defaultSelected?: boolean;\n /** Handler that is called when the element's selection state changes. */\n onChange?: (isSelected: boolean) => void;\n /** The value of the input element, used when submitting an HTML form. */\n value?: string;\n /** The name of the input element, used when submitting an HTML form. */\n name?: string;\n /** The form to associate the input with. */\n form?: string;\n /** Whether the element is disabled. */\n isDisabled?: boolean;\n /** Whether the element is read only. */\n isReadOnly?: boolean;\n /** Whether the element is required. */\n isRequired?: boolean;\n /** Whether the element is invalid. */\n isInvalid?: boolean;\n /** The element's children. */\n children?: JSX.Element;\n /** Defines a string value that labels the current element. */\n 'aria-label'?: string;\n /** Identifies the element (or elements) that labels the current element. */\n 'aria-labelledby'?: string;\n /** Identifies the element (or elements) that describes the object. */\n 'aria-describedby'?: string;\n /** Identifies the element (or elements) that provide an error message for the object. */\n 'aria-errormessage'?: string;\n /** Identifies the element (or elements) whose contents or presence are controlled by the current element. */\n 'aria-controls'?: string;\n /** The element's unique identifier. */\n id?: string;\n /** Handler that is called when the press is released over the target. */\n onPress?: (e: PressEvent) => void;\n /** Handler that is called when a press interaction starts. */\n onPressStart?: (e: PressEvent) => void;\n /** Handler that is called when a press interaction ends, either over the target or when the pointer leaves the target. */\n onPressEnd?: (e: PressEvent) => void;\n /** Handler that is called when the press state changes. */\n onPressChange?: (isPressed: boolean) => void;\n /** Handler that is called when a press is released over the target, regardless of whether it started on the target or not. */\n onPressUp?: (e: PressEvent) => void;\n /** Handler that is called when the element is clicked. */\n onClick?: (e: MouseEvent) => void;\n /** Handler that is called when the element receives focus. */\n onFocus?: (e: FocusEvent) => void;\n /** Handler that is called when the element loses focus. */\n onBlur?: (e: FocusEvent) => void;\n /** Handler that is called when the element's focus status changes. */\n onFocusChange?: (isFocused: boolean) => void;\n /** Handler that is called when a key is pressed. */\n onKeyDown?: (e: KeyboardEvent) => void;\n /** Handler that is called when a key is released. */\n onKeyUp?: (e: KeyboardEvent) => void;\n /** Whether to exclude the element from the tab order. */\n excludeFromTabOrder?: boolean;\n /** Whether to autofocus the element. */\n autoFocus?: boolean;\n}\n\nexport interface ToggleAria {\n /** Props to be spread on the label element. */\n labelProps: JSX.LabelHTMLAttributes<HTMLLabelElement>;\n /** Props to be spread on the input element. */\n inputProps: JSX.InputHTMLAttributes<HTMLInputElement>;\n /** Whether the toggle is selected. */\n isSelected: Accessor<boolean>;\n /** Whether the toggle is in a pressed state. */\n isPressed: Accessor<boolean>;\n /** Whether the toggle is disabled. */\n isDisabled: boolean;\n /** Whether the toggle is read only. */\n isReadOnly: boolean;\n /** Whether the toggle is invalid. */\n isInvalid: boolean;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Handles interactions for toggle elements, e.g. Checkboxes and Switches.\n */\nexport function createToggle(\n props: MaybeAccessor<AriaToggleProps>,\n state: ToggleState,\n ref: () => HTMLInputElement | null\n): ToggleAria {\n const getProps = () => access(props);\n\n const isDisabled = () => getProps().isDisabled ?? false;\n const isReadOnly = () => getProps().isReadOnly ?? false;\n const isInvalid = () => {\n return getProps().isInvalid ?? false;\n };\n\n // Handle press state for keyboard interactions and cases where labelProps is not used.\n const { pressProps, isPressed } = createPress({\n get onPressStart() { return getProps().onPressStart; },\n get onPressEnd() { return getProps().onPressEnd; },\n get onPressChange() { return getProps().onPressChange; },\n get onPress() { return getProps().onPress; },\n get onPressUp() { return getProps().onPressUp; },\n get isDisabled() { return isDisabled(); },\n });\n\n // Handle press state on the label.\n const { pressProps: labelPressProps, isPressed: isLabelPressed } = createPress({\n get onPressStart() { return getProps().onPressStart; },\n get onPressEnd() { return getProps().onPressEnd; },\n get onPressChange() { return getProps().onPressChange; },\n get onPressUp() { return getProps().onPressUp; },\n onPress(e: PressEvent) {\n getProps().onPress?.(e);\n state.toggle();\n ref()?.focus();\n },\n get isDisabled() { return isDisabled() || isReadOnly(); },\n });\n\n // Handle focusable - extract the relevant props for createFocusable\n const { focusableProps } = createFocusable({\n get isDisabled() { return isDisabled(); },\n get autoFocus() { return getProps().autoFocus; },\n get onFocus() { return getProps().onFocus; },\n get onBlur() { return getProps().onBlur; },\n get onFocusChange() { return getProps().onFocusChange; },\n get onKeyDown() { return getProps().onKeyDown; },\n get onKeyUp() { return getProps().onKeyUp; },\n get excludeFromTabOrder() { return getProps().excludeFromTabOrder; },\n }, ref as unknown as (el: HTMLElement) => void);\n\n // Combine press and focusable props for input\n const interactions = mergeProps(pressProps, focusableProps);\n\n // Filter DOM props\n const domProps = () => filterDOMProps(getProps() as unknown as Record<string, unknown>, { labelable: true });\n\n // Handle input change\n const onChange: JSX.EventHandler<HTMLInputElement, Event> = (e) => {\n // Since we spread props on label, onChange will end up there as well as in here.\n // So we have to stop propagation at the lowest level that we care about\n e.stopPropagation();\n\n // Don't update state if readonly\n if (isReadOnly()) {\n // Reset the checkbox to its previous state since the browser already toggled it\n e.currentTarget.checked = state.isSelected();\n return;\n }\n\n state.setSelected(e.currentTarget.checked);\n };\n\n // Warn if no accessible label\n createEffect(() => {\n const p = getProps();\n const hasChildren = p.children != null;\n const hasAriaLabel = p['aria-label'] != null || p['aria-labelledby'] != null;\n if (!hasChildren && !hasAriaLabel && isDevEnv()) {\n console.warn('If you do not provide children, you must specify an aria-label for accessibility');\n }\n });\n\n // Combined pressed state\n const combinedIsPressed: Accessor<boolean> = () => isPressed() || isLabelPressed();\n\n return {\n labelProps: mergeProps(labelPressProps, {\n onClick: (e: MouseEvent) => e.preventDefault(),\n }),\n get inputProps() {\n const p = getProps();\n return mergeProps(domProps(), {\n 'aria-invalid': isInvalid() || undefined,\n 'aria-errormessage': p['aria-errormessage'],\n 'aria-controls': p['aria-controls'],\n 'aria-readonly': isReadOnly() || undefined,\n onChange,\n disabled: isDisabled(),\n ...(p.value == null ? {} : { value: p.value }),\n name: p.name,\n form: p.form,\n type: 'checkbox' as const,\n ...interactions,\n // Stop click propagation to prevent labelProps.onClick from calling preventDefault\n // which would prevent the checkbox from toggling in JSDOM/testing-library environments\n onClick: (e: MouseEvent) => e.stopPropagation(),\n }) as JSX.InputHTMLAttributes<HTMLInputElement>;\n },\n isSelected: state.isSelected,\n isPressed: combinedIsPressed,\n isDisabled: isDisabled(),\n isReadOnly: isReadOnly(),\n isInvalid: isInvalid(),\n };\n}\n", "export { createCheckbox } from './createCheckbox';\nexport type { AriaCheckboxProps, CheckboxAria } from './createCheckbox';\n\n// Re-export state from solid-stately\nexport { createCheckboxGroupState } from '@proyecto-viviana/solid-stately';\nexport type { CheckboxGroupProps, CheckboxGroupState } from '@proyecto-viviana/solid-stately';\n\n// ARIA hooks (solidaria-specific)\nexport { createCheckboxGroup, checkboxGroupData } from './createCheckboxGroup';\nexport type { AriaCheckboxGroupProps, CheckboxGroupAria } from './createCheckboxGroup';\n\nexport { createCheckboxGroupItem } from './createCheckboxGroupItem';\nexport type { AriaCheckboxGroupItemProps } from './createCheckboxGroupItem';\n", "/**\n * SSR utilities for Solidaria\n *\n * SolidJS has built-in SSR support with `isServer` and `createUniqueId()`.\n * These utilities provide a consistent API matching React-Aria's patterns\n * with additional features for hydration management.\n */\n\nimport {\n type Accessor,\n type JSX,\n type ParentProps,\n createContext,\n createEffect,\n createMemo,\n createSignal,\n onCleanup,\n onMount,\n useContext,\n createUniqueId,\n} from 'solid-js';\nimport { isServer } from 'solid-js/web';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface SSRProviderProps extends ParentProps {}\n\nexport interface SSRContextValue {\n /** Whether currently rendering on the server. */\n isSSR: boolean;\n /** Prefix for generated IDs, allowing nested providers. */\n prefix: string;\n}\n\n// ============================================\n// CONTEXT\n// ============================================\n\nconst SSRContext = createContext<SSRContextValue>({\n isSSR: isServer,\n prefix: '',\n});\n\n// ============================================\n// BASIC UTILITIES\n// ============================================\n\n/**\n * Returns whether the component is currently being server side rendered.\n * Can be used to delay browser-specific rendering until after hydration.\n *\n * Note: This returns a static boolean. For reactive hydration detection,\n * use `createHydrationState()`.\n */\nexport function createIsSSR(): boolean {\n return isServer;\n}\n\n/**\n * Check if we can use DOM APIs.\n * This is useful for code that needs to run only in the browser.\n */\nexport const canUseDOM = !isServer;\n\n/**\n * Generate a unique ID that is stable across server and client.\n * Uses SolidJS's built-in createUniqueId which handles SSR correctly.\n *\n * @param defaultId - Optional default ID to use instead of generating one.\n *\n * @example\n * ```tsx\n * function TextField(props) {\n * const inputId = createId(props.id);\n * return (\n * <>\n * <label for={inputId}>{props.label}</label>\n * <input id={inputId} />\n * </>\n * );\n * }\n * ```\n */\nexport function createId(defaultId?: string): string {\n if (defaultId) {\n return defaultId;\n }\n const ctx = useContext(SSRContext);\n const uniqueId = createUniqueId();\n return ctx.prefix ? `solidaria-${ctx.prefix}-${uniqueId}` : `solidaria-${uniqueId}`;\n}\n\n// ============================================\n// SSR PROVIDER\n// ============================================\n\n/**\n * Provides SSR context to the component tree.\n *\n * While SolidJS handles most SSR scenarios automatically, this provider\n * can be useful for:\n * - Nested ID prefixes to avoid collisions in micro-frontends\n * - Explicit hydration boundary markers\n * - Testing SSR behavior\n *\n * @example\n * ```tsx\n * // Root of your app\n * <SSRProvider>\n * <App />\n * </SSRProvider>\n *\n * // With custom prefix for micro-frontend\n * <SSRProvider prefix=\"widget\">\n * <Widget />\n * </SSRProvider>\n * ```\n */\nexport function SSRProvider(props: SSRProviderProps & { prefix?: string }): JSX.Element {\n const parentContext = useContext(SSRContext);\n\n const value = createMemo<SSRContextValue>(() => ({\n isSSR: isServer,\n prefix: props.prefix\n ? parentContext.prefix\n ? `${parentContext.prefix}-${props.prefix}`\n : props.prefix\n : parentContext.prefix,\n }));\n\n return (\n <SSRContext.Provider value={value()}>\n {props.children}\n </SSRContext.Provider>\n );\n}\n\n// ============================================\n// HYDRATION STATE\n// ============================================\n\n/**\n * Tracks whether the component is currently hydrating.\n *\n * During server-side rendering, this returns `true`. After hydration\n * completes on the client, it switches to `false`. This is useful for\n * components that need to show different content during hydration.\n *\n * @example\n * ```tsx\n * function ClientOnlyComponent() {\n * const isHydrating = createHydrationState();\n *\n * return (\n * <Show when={!isHydrating()} fallback={<LoadingPlaceholder />}>\n * <InteractiveWidget />\n * </Show>\n * );\n * }\n * ```\n */\nexport function createHydrationState(): Accessor<boolean> {\n // On the server, always return true\n if (isServer) {\n return () => true;\n }\n\n // On the client, track hydration state\n const [isHydrating, setIsHydrating] = createSignal(true);\n\n onMount(() => {\n setIsHydrating(false);\n });\n\n return isHydrating;\n}\n\n/**\n * Hook that returns `true` during SSR and initial hydration.\n * Use this to delay browser-specific code until hydration is complete.\n *\n * Unlike `createIsSSR()` which is static, this updates reactively\n * after hydration completes.\n *\n * @example\n * ```tsx\n * function BrowserOnlyFeature() {\n * const isSSR = useIsSSR();\n *\n * createEffect(() => {\n * if (!isSSR()) {\n * // Safe to access browser APIs here\n * window.localStorage.getItem('key');\n * }\n * });\n *\n * return <Show when={!isSSR()}>...</Show>;\n * }\n * ```\n */\nexport function useIsSSR(): Accessor<boolean> {\n return createHydrationState();\n}\n\n// ============================================\n// SAFE BROWSER EFFECTS\n// ============================================\n\n/**\n * Creates an effect that only runs on the client after hydration.\n * This is a convenience wrapper that ensures browser-specific code\n * doesn't run during SSR.\n *\n * @param fn - The effect function to run\n *\n * @example\n * ```tsx\n * function Analytics() {\n * createBrowserEffect(() => {\n * // Safe to access window, document, localStorage, etc.\n * window.analytics.track('page_view');\n * });\n *\n * return null;\n * }\n * ```\n */\nexport function createBrowserEffect(fn: () => void | (() => void)): void {\n if (isServer) {\n return;\n }\n\n createEffect(() => {\n const cleanup = fn();\n if (typeof cleanup === 'function') {\n onCleanup(cleanup);\n }\n });\n}\n\n/**\n * Creates a value that is computed only on the client.\n * On the server, returns the fallback value.\n *\n * @param fn - Function to compute the value on the client\n * @param fallback - Value to return during SSR\n *\n * @example\n * ```tsx\n * function WindowSize() {\n * const width = createBrowserValue(\n * () => window.innerWidth,\n * 0\n * );\n *\n * return <span>Width: {width()}</span>;\n * }\n * ```\n */\nexport function createBrowserValue<T>(\n fn: () => T,\n fallback: T\n): Accessor<T> {\n if (isServer) {\n return () => fallback;\n }\n\n const [value, setValue] = createSignal<T>(fallback);\n\n onMount(() => {\n setValue(() => fn());\n });\n\n return value;\n}\n\n// ============================================\n// WINDOW/DOCUMENT SAFE ACCESS\n// ============================================\n\n/**\n * Returns the window object if available, or undefined during SSR.\n * Useful for accessing browser globals safely.\n *\n * @example\n * ```tsx\n * const win = getWindow();\n * if (win) {\n * win.addEventListener('resize', handler);\n * }\n * ```\n */\nexport function getWindow(): Window | undefined {\n if (typeof window !== 'undefined') {\n return window;\n }\n return undefined;\n}\n\n/**\n * Returns the document object if available, or undefined during SSR.\n * Useful for accessing document safely.\n *\n * @example\n * ```tsx\n * const doc = getDocument();\n * if (doc) {\n * doc.addEventListener('keydown', handler);\n * }\n * ```\n */\nexport function getDocument(): Document | undefined {\n if (typeof document !== 'undefined') {\n return document;\n }\n return undefined;\n}\n\n/**\n * Returns the owner document of an element, with SSR safety.\n *\n * @param el - The element to get the owner document from\n */\nexport function getOwnerDocument(el: Element | null | undefined): Document | undefined {\n return el?.ownerDocument ?? getDocument();\n}\n\n/**\n * Returns the owner window of an element, with SSR safety.\n *\n * @param el - The element to get the owner window from\n */\nexport function getOwnerWindow(el: Element | null | undefined): Window | undefined {\n return getOwnerDocument(el)?.defaultView ?? getWindow();\n}\n\n// ============================================\n// PORTAL HELPERS\n// ============================================\n\n/**\n * Gets the appropriate container for portals, with SSR safety.\n * Returns the specified container, or document.body on the client,\n * or undefined during SSR.\n *\n * @param container - Optional custom container element\n *\n * @example\n * ```tsx\n * function Modal(props) {\n * const container = getPortalContainer(props.container);\n *\n * return (\n * <Show when={container}>\n * <Portal mount={container}>\n * {props.children}\n * </Portal>\n * </Show>\n * );\n * }\n * ```\n */\nexport function getPortalContainer(container?: Element): Element | undefined {\n if (container) {\n return container;\n }\n return getDocument()?.body;\n}\n", "/**\n * Labels utility for Solidaria\n *\n * Merges aria-label and aria-labelledby into aria-labelledby when both exist.\n *\n * This is a 1:1 port of @react-aria/utils's useLabels hook.\n */\n\nimport { createId } from '../ssr';\nimport type { AriaLabelingProps, DOMProps } from './createLabel';\n\n/**\n * Merges aria-label and aria-labelledby into aria-labelledby when both exist.\n *\n * @param props - Aria label props.\n * @param defaultLabel - Default value for aria-label when not present.\n */\nexport function createLabels(\n props: DOMProps & AriaLabelingProps,\n defaultLabel?: string\n): DOMProps & AriaLabelingProps {\n let {\n id,\n 'aria-label': label,\n 'aria-labelledby': labelledBy,\n } = props;\n\n // Generate an ID if not provided\n id = createId(id);\n\n // If there is both an aria-label and aria-labelledby,\n // combine them by pointing to the element itself.\n if (labelledBy && label) {\n const ids = new Set([id, ...labelledBy.trim().split(/\\s+/)]);\n labelledBy = [...ids].join(' ');\n } else if (labelledBy) {\n labelledBy = labelledBy.trim().split(/\\s+/).join(' ');\n }\n\n // If no labels are provided, use the default\n if (!label && !labelledBy && defaultLabel) {\n label = defaultLabel;\n }\n\n return {\n id,\n 'aria-label': label,\n 'aria-labelledby': labelledBy,\n };\n}\n", "/**\n * Label hook for Solidaria\n *\n * Provides the accessibility implementation for labels and their associated elements.\n * Labels provide context for user inputs.\n *\n * This is a 1:1 port of @react-aria/label's useLabel hook.\n */\n\nimport { JSX } from 'solid-js';\nimport { createId } from '../ssr';\nimport { createLabels } from './createLabels';\nimport { type MaybeAccessor, access } from '../utils/reactivity';\nimport { isDevEnv } from '../utils/env';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaLabelingProps {\n /** Defines a string value that labels the current element. */\n 'aria-label'?: string;\n /** Identifies the element (or elements) that labels the current element. */\n 'aria-labelledby'?: string;\n /** Identifies the element (or elements) that describes the object. */\n 'aria-describedby'?: string;\n /** Identifies the element (or elements) that provide a detailed, extended description for the object. */\n 'aria-details'?: string;\n}\n\nexport interface LabelableProps {\n /** The content to display as the label. */\n label?: JSX.Element;\n}\n\nexport interface DOMProps {\n /** The element's unique identifier. */\n id?: string;\n}\n\nexport interface LabelAriaProps extends LabelableProps, DOMProps, AriaLabelingProps {\n /**\n * The HTML element used to render the label, e.g. 'label', or 'span'.\n * @default 'label'\n */\n labelElementType?: 'label' | 'span' | 'div';\n}\n\nexport interface LabelAria {\n /** Props to apply to the label container element. */\n labelProps: JSX.LabelHTMLAttributes<HTMLLabelElement> | JSX.HTMLAttributes<HTMLSpanElement>;\n /** Props to apply to the field container element being labeled. */\n fieldProps: AriaLabelingProps & DOMProps;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the accessibility implementation for labels and their associated elements.\n * Labels provide context for user inputs.\n *\n * @param props - The props for labels and fields.\n */\nexport function createLabel(props: MaybeAccessor<LabelAriaProps>): LabelAria {\n const getProps = () => access(props);\n\n const id = createId(getProps().id);\n const labelId = createId();\n\n const getLabelProps = (): LabelAria['labelProps'] => {\n const { label, labelElementType = 'label' } = getProps();\n\n if (!label) {\n return {};\n }\n\n return {\n id: labelId,\n ...(labelElementType === 'label' ? { for: id } : {}),\n };\n };\n\n const getFieldProps = (): LabelAria['fieldProps'] => {\n const {\n label,\n 'aria-labelledby': ariaLabelledby,\n 'aria-label': ariaLabel,\n } = getProps();\n\n let labelledBy = ariaLabelledby;\n\n if (label) {\n labelledBy = ariaLabelledby ? `${labelId} ${ariaLabelledby}` : labelId;\n } else if (!ariaLabelledby && !ariaLabel && isDevEnv()) {\n console.warn(\n 'If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility'\n );\n }\n\n return createLabels({\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': labelledBy,\n });\n };\n\n return {\n get labelProps() {\n return getLabelProps();\n },\n get fieldProps() {\n return getFieldProps();\n },\n };\n}\n", "/**\n * Field hook for Solidaria\n *\n * Provides the accessibility implementation for input fields.\n * Fields accept user input, gain context from their label, and may display\n * a description or error message.\n *\n * This is a 1:1 port of @react-aria/label's useField hook.\n */\n\nimport { JSX } from 'solid-js';\nimport { createId } from '../ssr';\nimport { createLabel, type LabelAriaProps, type LabelAria, type AriaLabelingProps, type DOMProps } from './createLabel';\nimport { mergeProps } from '../utils/mergeProps';\nimport { type MaybeAccessor, access } from '../utils/reactivity';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface HelpTextProps {\n /** A description for the field. Provides a hint such as specific requirements for what to choose. */\n description?: JSX.Element;\n /** An error message for the field. */\n errorMessage?: JSX.Element | ((validation: ValidationResult) => JSX.Element);\n}\n\nexport interface ValidationResult {\n /** Whether the input value is invalid. */\n isInvalid: boolean;\n /** The current error messages for the input if it is invalid, otherwise an empty array. */\n validationErrors: string[];\n /** The native validity state for the input. */\n validationDetails: ValidityState;\n}\n\nexport interface Validation<T> {\n /** Whether the input value is invalid. */\n isInvalid?: boolean;\n /** Whether the input is required before form submission. */\n isRequired?: boolean;\n /** A function that returns an error message if a given value is invalid. */\n validate?: (value: T) => string | string[] | true | null | undefined;\n}\n\nexport interface AriaFieldProps extends LabelAriaProps, HelpTextProps, Omit<Validation<any>, 'isRequired'> {}\n\nexport interface FieldAria extends LabelAria {\n /** Props for the description element, if any. */\n descriptionProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the error message element, if any. */\n errorMessageProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the accessibility implementation for input fields.\n * Fields accept user input, gain context from their label, and may display\n * a description or error message.\n *\n * @param props - Props for the Field.\n */\nexport function createField(props: MaybeAccessor<AriaFieldProps>): FieldAria {\n const getProps = () => access(props);\n\n const { labelProps, fieldProps: baseLabelFieldProps } = createLabel(props);\n\n // Generate IDs for description and error message\n const descriptionId = createId();\n const errorMessageId = createId();\n\n const getDescriptionProps = (): FieldAria['descriptionProps'] => {\n const { description, errorMessage, isInvalid } = getProps();\n\n // Only include ID if description exists or there's an error message that might be shown\n if (!description && !errorMessage && !isInvalid) {\n return {};\n }\n\n return {\n id: descriptionId,\n };\n };\n\n const getErrorMessageProps = (): FieldAria['errorMessageProps'] => {\n const { errorMessage, isInvalid } = getProps();\n\n // Only include ID if there's an error message and the field is invalid\n if (!errorMessage && !isInvalid) {\n return {};\n }\n\n return {\n id: errorMessageId,\n };\n };\n\n const getFieldProps = (): AriaLabelingProps & DOMProps => {\n const { description, errorMessage, isInvalid } = getProps();\n\n const describedByIds: string[] = [];\n\n // Add description ID if description exists\n if (description) {\n describedByIds.push(descriptionId);\n }\n\n // Add error message ID if field is invalid and error message exists\n // Use aria-describedby for error message because aria-errormessage is unsupported\n // using VoiceOver or NVDA. See https://github.com/adobe/react-spectrum/issues/1346#issuecomment-740136268\n if (isInvalid && errorMessage) {\n describedByIds.push(errorMessageId);\n }\n\n // Add any existing aria-describedby from props\n const existingDescribedBy = getProps()['aria-describedby'];\n if (existingDescribedBy) {\n describedByIds.push(existingDescribedBy);\n }\n\n const ariaDescribedBy = describedByIds.length > 0 ? describedByIds.join(' ') : undefined;\n\n return mergeProps(baseLabelFieldProps, {\n 'aria-describedby': ariaDescribedBy,\n }) as AriaLabelingProps & DOMProps;\n };\n\n return {\n get labelProps() {\n return labelProps;\n },\n get fieldProps() {\n return getFieldProps();\n },\n get descriptionProps() {\n return getDescriptionProps();\n },\n get errorMessageProps() {\n return getErrorMessageProps();\n },\n };\n}\n", "/**\n * Checkbox group hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a checkbox group component.\n * Checkbox groups allow users to select multiple items from a list of options.\n *\n * This is a 1:1 port of @react-aria/checkbox's useCheckboxGroup hook.\n */\n\nimport { JSX } from 'solid-js';\nimport { createField } from '../label';\nimport { createFocusWithin } from '../interactions/createFocusWithin';\nimport { filterDOMProps } from '../utils/filterDOMProps';\nimport { mergeProps } from '../utils/mergeProps';\nimport { type MaybeAccessor, access } from '../utils/reactivity';\nimport { type CheckboxGroupState, type CheckboxGroupProps } from '@proyecto-viviana/solid-stately';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaCheckboxGroupProps extends CheckboxGroupProps {\n /** Defines a string value that labels the current element. */\n 'aria-label'?: string;\n /** Identifies the element (or elements) that labels the current element. */\n 'aria-labelledby'?: string;\n /** Identifies the element (or elements) that describes the object. */\n 'aria-describedby'?: string;\n /** Identifies the element (or elements) that provide a detailed, extended description for the object. */\n 'aria-details'?: string;\n /** A description for the field. Provides a hint such as specific requirements for what to choose. */\n description?: JSX.Element;\n /** An error message for the field. */\n errorMessage?: JSX.Element;\n}\n\nexport interface CheckboxGroupAria {\n /** Props for the checkbox group wrapper element. */\n groupProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the checkbox group's visible label (if any). */\n labelProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the checkbox group description element, if any. */\n descriptionProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the checkbox group error message element, if any. */\n errorMessageProps: JSX.HTMLAttributes<HTMLElement>;\n /** Whether the checkbox group is invalid. */\n isInvalid: boolean;\n}\n\n// WeakMap to share data between checkbox group and checkbox group items\nexport const checkboxGroupData = new WeakMap<\n CheckboxGroupState,\n {\n name?: string;\n form?: string;\n descriptionId?: string;\n errorMessageId?: string;\n validationBehavior: 'aria' | 'native';\n }\n>();\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the behavior and accessibility implementation for a checkbox group component.\n * Checkbox groups allow users to select multiple items from a list of options.\n *\n * @param props - Props for the checkbox group.\n * @param state - State for the checkbox group, as returned by `createCheckboxGroupState`.\n */\nexport function createCheckboxGroup(\n props: MaybeAccessor<AriaCheckboxGroupProps>,\n state: CheckboxGroupState\n): CheckboxGroupAria {\n const getProps = () => access(props);\n\n const isInvalid = () => state.isInvalid;\n\n // Use field for label association\n const { labelProps, fieldProps, descriptionProps, errorMessageProps } = createField({\n get label() { return getProps().label; },\n get 'aria-label'() { return getProps()['aria-label']; },\n get 'aria-labelledby'() { return getProps()['aria-labelledby']; },\n get 'aria-describedby'() { return getProps()['aria-describedby']; },\n get 'aria-details'() { return getProps()['aria-details']; },\n get description() { return getProps().description; },\n get errorMessage() { return getProps().errorMessage ?? (isInvalid() ? 'Invalid selection' : undefined); },\n get isInvalid() { return isInvalid(); },\n // Checkbox group is not an HTML input element so it\n // shouldn't be labeled by a <label> element.\n labelElementType: 'span',\n });\n\n // Store data for checkbox group items\n checkboxGroupData.set(state, {\n name: getProps().name,\n form: getProps().form,\n descriptionId: descriptionProps.id,\n errorMessageId: errorMessageProps.id,\n validationBehavior: 'aria',\n });\n\n // Filter DOM props\n const domProps = () => filterDOMProps(getProps() as unknown as Record<string, unknown>, { labelable: true });\n\n // Handle focus within\n const { focusWithinProps } = createFocusWithin({\n get onBlurWithin() { return getProps().onBlur; },\n get onFocusWithin() { return getProps().onFocus; },\n get onFocusWithinChange() { return getProps().onFocusChange; },\n });\n\n return {\n get groupProps() {\n return mergeProps(domProps(), {\n role: 'group',\n 'aria-disabled': state.isDisabled || undefined,\n ...fieldProps,\n ...focusWithinProps,\n }) as JSX.HTMLAttributes<HTMLElement>;\n },\n get labelProps() {\n return labelProps as JSX.HTMLAttributes<HTMLElement>;\n },\n get descriptionProps() {\n return descriptionProps;\n },\n get errorMessageProps() {\n return errorMessageProps;\n },\n get isInvalid() {\n return isInvalid();\n },\n };\n}\n", "/**\n * Checkbox group item hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a checkbox component\n * contained within a checkbox group.\n *\n * This is a 1:1 port of @react-aria/checkbox's useCheckboxGroupItem hook.\n */\n\nimport { JSX } from 'solid-js';\nimport { createCheckbox, type AriaCheckboxProps, type CheckboxAria } from './createCheckbox';\nimport { type ToggleState, type CheckboxGroupState } from '@proyecto-viviana/solid-stately';\nimport { checkboxGroupData } from './createCheckboxGroup';\nimport { type MaybeAccessor, access } from '../utils/reactivity';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaCheckboxGroupItemProps extends Omit<AriaCheckboxProps, 'isSelected' | 'defaultSelected'> {\n /** The value of the checkbox. */\n value: string;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the behavior and accessibility implementation for a checkbox component\n * contained within a checkbox group.\n *\n * @param props - Props for the checkbox.\n * @param state - State for the checkbox group, as returned by `createCheckboxGroupState`.\n * @param inputRef - A ref accessor for the HTML input element.\n */\nexport function createCheckboxGroupItem(\n props: MaybeAccessor<AriaCheckboxGroupItemProps>,\n state: CheckboxGroupState,\n inputRef: () => HTMLInputElement | null\n): CheckboxAria {\n const getProps = () => access(props);\n\n // Create toggle state that syncs with the group state\n const toggleState: ToggleState = {\n isSelected: () => state.isSelected(getProps().value),\n defaultSelected: state.defaultValue.includes(getProps().value),\n setSelected(isSelected: boolean) {\n const value = getProps().value;\n if (isSelected) {\n state.addValue(value);\n } else {\n state.removeValue(value);\n }\n getProps().onChange?.(isSelected);\n },\n toggle() {\n state.toggleValue(getProps().value);\n },\n };\n\n // Get group data\n const getGroupData = () => checkboxGroupData.get(state);\n\n // Build checkbox props\n const checkboxProps = (): AriaCheckboxProps => {\n const p = getProps();\n const groupData = getGroupData();\n\n return {\n ...p,\n isReadOnly: p.isReadOnly ?? state.isReadOnly,\n isDisabled: p.isDisabled ?? state.isDisabled,\n name: p.name ?? groupData?.name,\n form: p.form ?? groupData?.form,\n isRequired: p.isRequired ?? state.isRequired(),\n validationBehavior: p.validationBehavior ?? groupData?.validationBehavior ?? 'aria',\n };\n };\n\n // Use the checkbox hook\n const result = createCheckbox(checkboxProps, toggleState, inputRef);\n\n // Add group-level aria-describedby\n return {\n ...result,\n get inputProps() {\n const baseInputProps = result.inputProps;\n const groupData = getGroupData();\n\n const describedByIds: string[] = [];\n\n // Add props aria-describedby\n const propsDescribedBy = getProps()['aria-describedby'];\n if (propsDescribedBy) {\n describedByIds.push(propsDescribedBy);\n }\n\n // Add error message ID if group is invalid\n if (state.isInvalid && groupData?.errorMessageId) {\n describedByIds.push(groupData.errorMessageId);\n }\n\n // Add description ID\n if (groupData?.descriptionId) {\n describedByIds.push(groupData.descriptionId);\n }\n\n const ariaDescribedBy = describedByIds.length > 0 ? describedByIds.join(' ') : undefined;\n\n return {\n ...baseInputProps,\n 'aria-describedby': ariaDescribedBy,\n } as JSX.InputHTMLAttributes<HTMLInputElement>;\n },\n };\n}\n", "// Re-export state from solid-stately\nexport {\n createRadioGroupState,\n radioGroupSyncVersion,\n type RadioGroupProps,\n type RadioGroupState,\n} from '@proyecto-viviana/solid-stately';\n\n// ARIA hooks (solidaria-specific)\n// Radio Group\nexport {\n createRadioGroup,\n radioGroupData,\n type AriaRadioGroupProps,\n type RadioGroupAria,\n} from './createRadioGroup';\n\n// Radio\nexport {\n createRadio,\n type AriaRadioProps,\n type RadioAria,\n} from './createRadio';\n", "/**\n * Radio group hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a radio group component.\n * Radio groups allow users to select a single item from a list of mutually exclusive options.\n *\n * This is a 1:1 port of @react-aria/radio's useRadioGroup hook.\n */\n\nimport { JSX } from 'solid-js';\nimport { createField } from '../label/createField';\nimport { createFocusWithin } from '../interactions/createFocusWithin';\nimport { mergeProps } from '../utils/mergeProps';\nimport { filterDOMProps } from '../utils/filterDOMProps';\nimport { createId } from '../ssr';\nimport { type MaybeAccessor, access } from '../utils/reactivity';\nimport { type RadioGroupState } from '@proyecto-viviana/solid-stately';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaRadioGroupProps {\n /** The content to display as the label. */\n label?: JSX.Element;\n /** A description for the radio group. Provides additional context. */\n description?: JSX.Element;\n /** An error message for the radio group. */\n errorMessage?: JSX.Element | ((validation: { isInvalid: boolean; validationErrors: string[] }) => JSX.Element);\n /** Whether the radio group is disabled. */\n isDisabled?: boolean;\n /** Whether the radio group is read only. */\n isReadOnly?: boolean;\n /** Whether the radio group is required. */\n isRequired?: boolean;\n /** Whether the radio group is invalid. */\n isInvalid?: boolean;\n /** The axis the Radio Button(s) should align with. Defaults to 'vertical'. */\n orientation?: 'horizontal' | 'vertical';\n /** The name of the radio group, used when submitting an HTML form. */\n name?: string;\n /** The form to associate the radio group with. */\n form?: string;\n /** Validation behavior for the radio group. */\n validationBehavior?: 'aria' | 'native';\n /** Handler that is called when the radio group receives focus. */\n onFocus?: (e: FocusEvent) => void;\n /** Handler that is called when the radio group loses focus. */\n onBlur?: (e: FocusEvent) => void;\n /** Handler that is called when the radio group's focus status changes. */\n onFocusChange?: (isFocused: boolean) => void;\n /** Defines a string value that labels the current element. */\n 'aria-label'?: string;\n /** Identifies the element (or elements) that labels the current element. */\n 'aria-labelledby'?: string;\n /** Identifies the element (or elements) that describes the object. */\n 'aria-describedby'?: string;\n /** Identifies the element (or elements) that provide an error message for the object. */\n 'aria-errormessage'?: string;\n /** The element's unique identifier. */\n id?: string;\n}\n\nexport interface RadioGroupAria {\n /** Props for the radio group wrapper element. */\n radioGroupProps: JSX.HTMLAttributes<HTMLDivElement>;\n /** Props for the radio group's visible label (if any). */\n labelProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the radio group description element, if any. */\n descriptionProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the radio group error message element, if any. */\n errorMessageProps: JSX.HTMLAttributes<HTMLElement>;\n /** Whether the radio group is invalid. */\n isInvalid: boolean;\n /** Validation errors, if any. */\n validationErrors: string[];\n /** Validation details, if any. */\n validationDetails: Record<string, boolean>;\n}\n\n// WeakMap to share data between radio group and radio items\ninterface RadioGroupData {\n name: string;\n form: string | undefined;\n descriptionId: string | undefined;\n errorMessageId: string | undefined;\n validationBehavior: 'aria' | 'native';\n}\n\nexport const radioGroupData: WeakMap<RadioGroupState, RadioGroupData> = new WeakMap();\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the behavior and accessibility implementation for a radio group component.\n * Radio groups allow users to select a single item from a list of mutually exclusive options.\n */\nexport function createRadioGroup(\n props: MaybeAccessor<AriaRadioGroupProps>,\n state: RadioGroupState\n): RadioGroupAria {\n const getProps = () => access(props);\n\n const orientation = () => getProps().orientation ?? 'vertical';\n const isReadOnly = () => getProps().isReadOnly ?? false;\n const isRequired = () => getProps().isRequired ?? false;\n const isDisabled = () => getProps().isDisabled ?? false;\n const validationBehavior = () => getProps().validationBehavior ?? 'aria';\n\n // Use field for label, description, error message\n const { labelProps, fieldProps, descriptionProps, errorMessageProps } = createField({\n get label() { return getProps().label; },\n get description() { return getProps().description; },\n get errorMessage() { return getProps().errorMessage; },\n get isInvalid() { return state.isInvalid; },\n // Radio group is not an HTML input element so it\n // shouldn't be labeled by a <label> element.\n labelElementType: 'span',\n });\n\n // Handle focus within - reset focusable radio when group loses focus and no selection\n const { focusWithinProps } = createFocusWithin({\n onBlurWithin(e: FocusEvent) {\n getProps().onBlur?.(e);\n if (!state.selectedValue()) {\n state.setLastFocusedValue(null);\n }\n },\n onFocusWithin: (e: FocusEvent) => getProps().onFocus?.(e),\n onFocusWithinChange: (isFocused: boolean) => getProps().onFocusChange?.(isFocused),\n });\n\n // Filter DOM props\n const domProps = () => filterDOMProps(getProps() as unknown as Record<string, unknown>, { labelable: true });\n\n // Generate group name\n const groupName = getProps().name ?? createId();\n\n // Store data for radio items to access\n radioGroupData.set(state, {\n name: groupName,\n form: getProps().form,\n descriptionId: descriptionProps.id,\n errorMessageId: errorMessageProps.id,\n validationBehavior: validationBehavior(),\n });\n\n // Keyboard navigation handler for arrow keys\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const onKeyDown = (_e: KeyboardEvent) => {\n // For now, we rely on native radio behavior\n // The complex tree walker implementation can be added later if needed\n // Most browsers handle arrow key navigation natively for radio groups\n };\n\n return {\n get radioGroupProps() {\n return mergeProps(\n domProps(),\n focusWithinProps as unknown as Record<string, unknown>,\n {\n role: 'radiogroup',\n onKeyDown,\n 'aria-invalid': state.isInvalid || undefined,\n 'aria-errormessage': getProps()['aria-errormessage'],\n 'aria-readonly': isReadOnly() || undefined,\n 'aria-required': isRequired() || undefined,\n 'aria-disabled': isDisabled() || undefined,\n 'aria-orientation': orientation(),\n ...fieldProps,\n }\n ) as JSX.HTMLAttributes<HTMLDivElement>;\n },\n labelProps: labelProps as JSX.HTMLAttributes<HTMLElement>,\n descriptionProps,\n errorMessageProps,\n get isInvalid() {\n return state.isInvalid;\n },\n get validationErrors() {\n return []; // Simplified - full validation can be added later\n },\n get validationDetails() {\n return {}; // Simplified - full validation can be added later\n },\n };\n}\n", "/**\n * Radio hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for an individual\n * radio button in a radio group.\n *\n * This is a 1:1 port of @react-aria/radio's useRadio hook.\n */\n\nimport { JSX, Accessor, createEffect } from 'solid-js';\nimport { createPress } from '../interactions/createPress';\nimport { createFocusable } from '../interactions/createFocusable';\nimport { mergeProps } from '../utils/mergeProps';\nimport { filterDOMProps } from '../utils/filterDOMProps';\nimport { type MaybeAccessor, access } from '../utils/reactivity';\nimport { isDevEnv } from '../utils/env';\nimport { type RadioGroupState, radioGroupSyncVersion } from '@proyecto-viviana/solid-stately';\nimport { radioGroupData } from './createRadioGroup';\nimport { type PressEvent } from '../interactions/PressEvent';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaRadioProps {\n /** The value of the radio button, used when submitting an HTML form. */\n value: string;\n /** Whether the radio button is disabled. */\n isDisabled?: boolean;\n /** The label for the radio button. */\n children?: JSX.Element;\n /** Defines a string value that labels the current element. */\n 'aria-label'?: string;\n /** Identifies the element (or elements) that labels the current element. */\n 'aria-labelledby'?: string;\n /** Identifies the element (or elements) that describes the object. */\n 'aria-describedby'?: string;\n /** Handler that is called when the press is released over the target. */\n onPress?: (e: PressEvent) => void;\n /** Handler that is called when a press interaction starts. */\n onPressStart?: (e: PressEvent) => void;\n /** Handler that is called when a press interaction ends, either over the target or when the pointer leaves the target. */\n onPressEnd?: (e: PressEvent) => void;\n /** Handler that is called when the press state changes. */\n onPressChange?: (isPressed: boolean) => void;\n /** Handler that is called when a press is released over the target, regardless of whether it started on the target or not. */\n onPressUp?: (e: PressEvent) => void;\n /** Handler that is called when the element is clicked. */\n onClick?: (e: MouseEvent) => void;\n /** Handler that is called when the element receives focus. */\n onFocus?: (e: FocusEvent) => void;\n /** Handler that is called when the element loses focus. */\n onBlur?: (e: FocusEvent) => void;\n /** Handler that is called when the element's focus status changes. */\n onFocusChange?: (isFocused: boolean) => void;\n /** Handler that is called when a key is pressed. */\n onKeyDown?: (e: KeyboardEvent) => void;\n /** Handler that is called when a key is released. */\n onKeyUp?: (e: KeyboardEvent) => void;\n /** Whether to autofocus the element. */\n autoFocus?: boolean;\n}\n\nexport interface RadioAria {\n /** Props for the label wrapper element. */\n labelProps: JSX.LabelHTMLAttributes<HTMLLabelElement>;\n /** Props for the input element. */\n inputProps: JSX.InputHTMLAttributes<HTMLInputElement>;\n /** Whether the radio is disabled. */\n isDisabled: boolean;\n /** Whether the radio is currently selected. */\n isSelected: Accessor<boolean>;\n /** Whether the radio is in a pressed state. */\n isPressed: Accessor<boolean>;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the behavior and accessibility implementation for an individual\n * radio button in a radio group.\n */\nexport function createRadio(\n props: MaybeAccessor<AriaRadioProps>,\n state: RadioGroupState,\n ref: () => HTMLInputElement | null\n): RadioAria {\n const getProps = () => access(props);\n\n const isDisabled = () => getProps().isDisabled || state.isDisabled;\n const value = () => getProps().value;\n const isSelected: Accessor<boolean> = () => {\n const selected = state.selectedValue();\n const v = value();\n return selected === v;\n };\n\n // Warn if no accessible label\n createEffect(() => {\n const p = getProps();\n const hasChildren = p.children != null;\n const hasAriaLabel = p['aria-label'] != null || p['aria-labelledby'] != null;\n if (!hasChildren && !hasAriaLabel && isDevEnv()) {\n console.warn('If you do not provide children, you must specify an aria-label for accessibility');\n }\n });\n\n // SolidJS-specific: Sync DOM checked state whenever selection changes\n // This handles:\n // 1. Initial render with controlled value\n // 2. Controlled mode where parent doesn't update value after click\n // 3. Native radio group behavior (clicking one unchecks others)\n //\n // Unlike React's VDOM reconciliation that re-applies all props on every render,\n // SolidJS only updates when signals change. Native radio behavior can change\n // the DOM checked state without our knowledge, so we need to actively sync.\n //\n // We track `syncVersion` to ensure this effect runs on EVERY selection attempt,\n // even in controlled mode where isSelected() may not change.\n createEffect(() => {\n const inputEl = ref();\n if (!inputEl) return;\n\n // Track syncVersion to trigger on any selection attempt\n // This is crucial for controlled mode where isSelected() may not change\n // syncVersion is stored in an internal WeakMap to maintain API parity with React-Aria\n const syncVersion = radioGroupSyncVersion.get(state);\n syncVersion?.();\n\n // Read the reactive state to establish tracking and get current value\n const shouldBeChecked = isSelected();\n\n // Sync the DOM checked state immediately\n if (inputEl.checked !== shouldBeChecked) {\n inputEl.checked = shouldBeChecked;\n }\n });\n\n // Handle input change\n // SolidJS-specific: Unlike React, the input's `checked` state can get out of sync\n // with our reactive state. This happens because:\n // 1. A readonly `<input type=\"radio\" />` is always \"checkable\" in the browser\n // 2. Even controlled inputs (`<input checked={isChecked} />`) will change their\n // internal `checked` state when clicked, regardless of what the signal says\n //\n // To prevent this, we force the input's `checked` DOM property to match our state\n // after processing the change. This is the pattern used by Kobalte and other\n // SolidJS component libraries.\n const onChange: JSX.EventHandler<HTMLInputElement, Event> = (e) => {\n e.stopPropagation();\n\n const target = e.target as HTMLInputElement;\n\n // Guard against disabled state - JSDOM's fireEvent may bypass disabled check\n if (isDisabled()) {\n target.checked = isSelected();\n return;\n }\n\n state.setSelectedValue(value());\n\n // Focus the input when clicked\n // In real browsers this happens automatically, but JSDOM/fireEvent doesn't trigger it\n target.focus();\n\n // Force the DOM checked state to match our reactive state\n // This handles controlled mode where the parent might not update the value\n target.checked = isSelected();\n };\n\n // Handle press state for keyboard interactions and cases where labelProps is not used.\n const { pressProps, isPressed } = createPress({\n get onPressStart() { return getProps().onPressStart; },\n get onPressEnd() { return getProps().onPressEnd; },\n get onPressChange() { return getProps().onPressChange; },\n get onPress() { return getProps().onPress; },\n get onPressUp() { return getProps().onPressUp; },\n get isDisabled() { return isDisabled(); },\n });\n\n // Handle press state on the label.\n const { pressProps: labelPressProps, isPressed: isLabelPressed } = createPress({\n get onPressStart() { return getProps().onPressStart; },\n get onPressEnd() { return getProps().onPressEnd; },\n get onPressChange() { return getProps().onPressChange; },\n get onPressUp() { return getProps().onPressUp; },\n onPress(e: PressEvent) {\n getProps().onPress?.(e);\n state.setSelectedValue(value());\n ref()?.focus();\n },\n get isDisabled() { return isDisabled(); },\n });\n\n // Handle focusable\n const { focusableProps } = createFocusable({\n get isDisabled() { return isDisabled(); },\n get autoFocus() { return getProps().autoFocus; },\n onFocus(e: FocusEvent) {\n getProps().onFocus?.(e);\n state.setLastFocusedValue(value());\n },\n get onBlur() { return getProps().onBlur; },\n get onFocusChange() { return getProps().onFocusChange; },\n get onKeyDown() { return getProps().onKeyDown; },\n get onKeyUp() { return getProps().onKeyUp; },\n }, ref as unknown as (el: HTMLElement) => void);\n\n // Combine press and focusable props for input\n const interactions = mergeProps(pressProps, focusableProps);\n\n // Filter DOM props\n const domProps = () => filterDOMProps(getProps() as unknown as Record<string, unknown>, { labelable: true });\n\n // Calculate tabIndex based on selection and focus state\n const getTabIndex = (): number | undefined => {\n if (isDisabled()) {\n return undefined;\n }\n\n const selected = state.selectedValue();\n const lastFocused = state.lastFocusedValue();\n const currentValue = value();\n\n if (selected != null) {\n // If there's a selection, only the selected radio is focusable\n if (selected === currentValue) {\n return 0;\n }\n return -1;\n } else {\n // If no selection, the last focused or first radio is focusable\n if (lastFocused === currentValue || lastFocused == null) {\n return 0;\n }\n return -1;\n }\n };\n\n // Get group data\n const getGroupData = () => radioGroupData.get(state);\n\n // Combined pressed state\n const combinedIsPressed: Accessor<boolean> = () => isPressed() || isLabelPressed();\n\n return {\n labelProps: mergeProps(labelPressProps, {\n onClick: (e: MouseEvent) => e.preventDefault(),\n onMouseDown: (e: MouseEvent) => e.preventDefault(),\n }),\n get inputProps() {\n const p = getProps();\n const groupData = getGroupData();\n\n // Build aria-describedby\n const describedByIds: string[] = [];\n if (p['aria-describedby']) {\n describedByIds.push(p['aria-describedby']);\n }\n if (state.isInvalid && groupData?.errorMessageId) {\n describedByIds.push(groupData.errorMessageId);\n }\n if (groupData?.descriptionId) {\n describedByIds.push(groupData.descriptionId);\n }\n const ariaDescribedBy = describedByIds.length > 0 ? describedByIds.join(' ') : undefined;\n\n return mergeProps(domProps(), interactions, {\n type: 'radio' as const,\n name: groupData?.name,\n form: groupData?.form,\n tabIndex: getTabIndex(),\n disabled: isDisabled(),\n required: state.isRequired && groupData?.validationBehavior === 'native',\n checked: isSelected(),\n value: value(),\n onChange,\n 'aria-describedby': ariaDescribedBy,\n }) as JSX.InputHTMLAttributes<HTMLInputElement>;\n },\n isDisabled: isDisabled(),\n isSelected,\n isPressed: combinedIsPressed,\n };\n}\n", "/**\n * Switch hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a switch component.\n * A switch is similar to a checkbox, but represents on/off values as opposed to selection.\n *\n * This is a 1:1 port of @react-aria/switch's useSwitch hook.\n */\n\nimport { JSX, Accessor } from 'solid-js';\nimport { createToggle, type AriaToggleProps } from '../toggle/createToggle';\nimport { type ToggleState } from '@proyecto-viviana/solid-stately';\nimport { type MaybeAccessor } from '../utils/reactivity';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaSwitchProps extends AriaToggleProps {\n // Switch uses the same props as toggle\n}\n\nexport interface SwitchAria {\n /** Props for the label wrapper element. */\n labelProps: JSX.LabelHTMLAttributes<HTMLLabelElement>;\n /** Props for the input element. */\n inputProps: JSX.InputHTMLAttributes<HTMLInputElement>;\n /** Whether the switch is selected. */\n isSelected: Accessor<boolean>;\n /** Whether the switch is in a pressed state. */\n isPressed: Accessor<boolean>;\n /** Whether the switch is disabled. */\n isDisabled: boolean;\n /** Whether the switch is read only. */\n isReadOnly: boolean;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the behavior and accessibility implementation for a switch component.\n * A switch is similar to a checkbox, but represents on/off values as opposed to selection.\n */\nexport function createSwitch(\n props: MaybeAccessor<AriaSwitchProps>,\n state: ToggleState,\n ref: () => HTMLInputElement | null\n): SwitchAria {\n // Don't destructure inputProps - it's a getter that needs to be evaluated each time\n const toggle = createToggle(props, state, ref);\n\n return {\n labelProps: toggle.labelProps,\n get inputProps() {\n // Access toggle.inputProps (the getter) each time to get fresh values\n const baseProps = toggle.inputProps;\n return {\n ...baseProps,\n role: 'switch' as const,\n checked: toggle.isSelected(),\n };\n },\n isSelected: toggle.isSelected,\n isPressed: toggle.isPressed,\n isDisabled: toggle.isDisabled,\n isReadOnly: toggle.isReadOnly,\n };\n}\n", "/**\n * Link hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a link component.\n * A link allows a user to navigate to another page or resource within a web page\n * or application.\n *\n * This is a 1:1 port of @react-aria/link's useLink hook.\n */\n\nimport { type Accessor } from 'solid-js';\nimport { createPress } from '../interactions/createPress';\nimport { createFocusable } from '../interactions/createFocusable';\nimport { mergeProps } from '../utils/mergeProps';\nimport { filterDOMProps } from '../utils/filterDOMProps';\nimport { type MaybeAccessor, access } from '../utils/reactivity';\nimport { type PressEvent } from '../interactions/PressEvent';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaLinkProps {\n /** Whether the link is disabled. */\n isDisabled?: boolean;\n /** The HTML element used to render the link, e.g. 'a', or 'span'. @default 'a' */\n elementType?: string;\n /** The URL to link to. */\n href?: string;\n /** The target window for the link. */\n target?: string;\n /** The relationship between the linked resource and the current page. */\n rel?: string;\n /** Handler that is called when the press is released over the target. */\n onPress?: (e: PressEvent) => void;\n /** Handler that is called when a press interaction starts. */\n onPressStart?: (e: PressEvent) => void;\n /** Handler that is called when a press interaction ends. */\n onPressEnd?: (e: PressEvent) => void;\n /** Handler that is called when the element is clicked. */\n onClick?: (e: MouseEvent) => void;\n /** Handler that is called when the element receives focus. */\n onFocus?: (e: FocusEvent) => void;\n /** Handler that is called when the element loses focus. */\n onBlur?: (e: FocusEvent) => void;\n /** Handler that is called when the element's focus status changes. */\n onFocusChange?: (isFocused: boolean) => void;\n /** Handler that is called when a key is pressed. */\n onKeyDown?: (e: KeyboardEvent) => void;\n /** Handler that is called when a key is released. */\n onKeyUp?: (e: KeyboardEvent) => void;\n /** Whether to autofocus the element. */\n autoFocus?: boolean;\n /** Indicates the current \"page\" or state within a set of related elements. */\n 'aria-current'?: 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false' | boolean;\n /** Defines a string value that labels the current element. */\n 'aria-label'?: string;\n /** Identifies the element (or elements) that labels the current element. */\n 'aria-labelledby'?: string;\n /** Identifies the element (or elements) that describes the object. */\n 'aria-describedby'?: string;\n}\n\nexport interface LinkAria {\n /** Props for the link element. */\n linkProps: Record<string, unknown>;\n /** Whether the link is currently pressed. */\n isPressed: Accessor<boolean>;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the behavior and accessibility implementation for a link component.\n * A link allows a user to navigate to another page or resource within a web page\n * or application.\n */\nexport function createLink(\n props: MaybeAccessor<AriaLinkProps> = {}\n): LinkAria {\n const getProps = () => access(props);\n\n const isDisabled = () => getProps().isDisabled ?? false;\n const elementType = () => getProps().elementType ?? 'a';\n\n // Create press handling\n const { pressProps, isPressed } = createPress({\n get isDisabled() { return isDisabled(); },\n get onPress() { return getProps().onPress; },\n get onPressStart() { return getProps().onPressStart; },\n get onPressEnd() { return getProps().onPressEnd; },\n });\n\n // Create focusable handling\n const { focusableProps } = createFocusable({\n get isDisabled() { return isDisabled(); },\n get autoFocus() { return getProps().autoFocus; },\n get onFocus() { return getProps().onFocus; },\n get onBlur() { return getProps().onBlur; },\n get onFocusChange() { return getProps().onFocusChange; },\n get onKeyDown() { return getProps().onKeyDown; },\n get onKeyUp() { return getProps().onKeyUp; },\n });\n\n // Build link props\n const getLinkProps = (): Record<string, unknown> => {\n const p = getProps();\n const elType = elementType();\n const disabled = isDisabled();\n\n let baseProps: Record<string, unknown> = {};\n\n // If not an <a>, add role and tabIndex\n if (elType !== 'a') {\n baseProps = {\n role: 'link',\n tabIndex: disabled ? undefined : 0,\n };\n }\n\n // Add link-specific props\n if (elType === 'a') {\n if (p.href) baseProps.href = p.href;\n if (p.target) baseProps.target = p.target;\n if (p.rel) baseProps.rel = p.rel;\n }\n\n // ARIA attributes\n const ariaProps: Record<string, unknown> = {\n 'aria-disabled': disabled || undefined,\n };\n\n if (p['aria-current'] !== undefined) {\n ariaProps['aria-current'] = p['aria-current'];\n }\n if (p['aria-label']) {\n ariaProps['aria-label'] = p['aria-label'];\n }\n if (p['aria-labelledby']) {\n ariaProps['aria-labelledby'] = p['aria-labelledby'];\n }\n if (p['aria-describedby']) {\n ariaProps['aria-describedby'] = p['aria-describedby'];\n }\n\n // Handle onClick - prevent default navigation when appropriate\n const onClick = (e: MouseEvent) => {\n // If disabled, prevent navigation and don't call user's onClick\n if (disabled) {\n e.preventDefault();\n return;\n }\n\n // If onPress is provided, prevent default navigation\n // This allows onPress to handle the action (e.g., client-side routing)\n if (p.onPress) {\n e.preventDefault();\n }\n\n // Call user's onClick if provided\n p.onClick?.(e);\n };\n\n return mergeProps(\n filterDOMProps(p as Record<string, unknown>, { labelable: true }),\n baseProps,\n ariaProps,\n focusableProps as Record<string, unknown>,\n pressProps as Record<string, unknown>,\n { onClick }\n );\n };\n\n return {\n get linkProps() {\n return getLinkProps();\n },\n isPressed,\n };\n}\n", "/**\n * TextField hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a text field.\n *\n * This is a 1:1 port of @react-aria/textfield's useTextField hook.\n */\n\nimport { JSX } from 'solid-js';\nimport { createField, type AriaFieldProps, type FieldAria } from '../label';\nimport { createFocusable, type FocusableProps } from '../interactions';\nimport { mergeProps, filterDOMProps } from '../utils';\nimport { type MaybeAccessor, access } from '../utils/reactivity';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaTextFieldProps extends AriaFieldProps, FocusableProps {\n /** The current value (controlled). */\n value?: string;\n /** The default value (uncontrolled). */\n defaultValue?: string;\n /** Handler that is called when the value changes. */\n onChange?: (value: string) => void;\n /** Whether the input is disabled. */\n isDisabled?: boolean;\n /** Whether the input is read only. */\n isReadOnly?: boolean;\n /** Whether the input is required. */\n isRequired?: boolean;\n /** The type of input to render. */\n type?: 'text' | 'search' | 'url' | 'tel' | 'email' | 'password' | string;\n /** The input mode hint for virtual keyboards. */\n inputMode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';\n /** The name of the input element, used when submitting an HTML form. */\n name?: string;\n /** Regex pattern to validate the input value. */\n pattern?: string;\n /** The maximum number of characters supported by the input. */\n maxLength?: number;\n /** The minimum number of characters required by the input. */\n minLength?: number;\n /** Placeholder text for the input. */\n placeholder?: string;\n /** Whether to enable auto complete. */\n autoComplete?: string;\n /** Whether to enable auto correct. */\n autoCorrect?: string;\n /** Whether to enable spell check. */\n spellCheck?: 'true' | 'false';\n /** Controls whether and how text input is automatically capitalized. */\n autoCapitalize?: 'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters';\n /** The element type to use for the input. Defaults to 'input'. */\n inputElementType?: 'input' | 'textarea';\n\n // Clipboard events\n onCopy?: JSX.EventHandler<HTMLInputElement | HTMLTextAreaElement, ClipboardEvent>;\n onCut?: JSX.EventHandler<HTMLInputElement | HTMLTextAreaElement, ClipboardEvent>;\n onPaste?: JSX.EventHandler<HTMLInputElement | HTMLTextAreaElement, ClipboardEvent>;\n\n // Composition events\n onCompositionStart?: JSX.EventHandler<HTMLInputElement | HTMLTextAreaElement, CompositionEvent>;\n onCompositionEnd?: JSX.EventHandler<HTMLInputElement | HTMLTextAreaElement, CompositionEvent>;\n onCompositionUpdate?: JSX.EventHandler<HTMLInputElement | HTMLTextAreaElement, CompositionEvent>;\n\n // Selection events\n onSelect?: JSX.EventHandler<HTMLInputElement | HTMLTextAreaElement, Event>;\n\n // Input events\n onBeforeInput?: JSX.EventHandler<HTMLInputElement | HTMLTextAreaElement, InputEvent>;\n onInput?: JSX.EventHandler<HTMLInputElement | HTMLTextAreaElement, InputEvent>;\n}\n\nexport interface TextFieldAria<T extends HTMLInputElement | HTMLTextAreaElement = HTMLInputElement> extends Omit<FieldAria, 'fieldProps'> {\n /** Props for the input element. */\n inputProps: JSX.InputHTMLAttributes<T>;\n /** Whether the text field is invalid. */\n isInvalid: boolean;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the behavior and accessibility implementation for a text field.\n * Text fields allow users to input text with a keyboard.\n *\n * @param props - Props for the text field.\n * @param ref - Optional ref callback for the input element.\n */\nexport function createTextField<T extends HTMLInputElement | HTMLTextAreaElement = HTMLInputElement>(\n props: MaybeAccessor<AriaTextFieldProps>,\n ref?: (el: T) => void\n): TextFieldAria<T> {\n const getProps = () => access(props);\n\n // Get field accessibility props (label, description, error message)\n const { labelProps, fieldProps, descriptionProps, errorMessageProps } = createField(props);\n\n // Get focusable props\n const { focusableProps } = createFocusable(\n {\n get isDisabled() {\n return getProps().isDisabled;\n },\n get autoFocus() {\n return getProps().autoFocus;\n },\n onFocus: getProps().onFocus,\n onBlur: getProps().onBlur,\n onFocusChange: getProps().onFocusChange,\n onKeyDown: getProps().onKeyDown,\n onKeyUp: getProps().onKeyUp,\n },\n ref as ((el: HTMLElement) => void) | undefined\n );\n\n // Filter DOM props\n const getDomProps = () => filterDOMProps(getProps() as Record<string, unknown>, { labelable: true });\n\n // Build input props\n const getInputProps = (): JSX.InputHTMLAttributes<T> => {\n const p = getProps();\n const isInvalid = p.isInvalid ?? false;\n const isTextarea = p.inputElementType === 'textarea';\n\n return mergeProps(\n getDomProps(),\n {\n disabled: p.isDisabled,\n readOnly: p.isReadOnly,\n required: p.isRequired,\n 'aria-required': p.isRequired || undefined,\n 'aria-invalid': isInvalid || undefined,\n value: p.value ?? p.defaultValue ?? '',\n onChange: (e: Event) => {\n const target = e.target as HTMLInputElement | HTMLTextAreaElement;\n p.onChange?.(target.value);\n },\n // Don't include type and pattern for textarea elements\n type: isTextarea ? undefined : (p.type ?? 'text'),\n inputMode: p.inputMode,\n name: p.name,\n pattern: isTextarea ? undefined : p.pattern,\n maxLength: p.maxLength,\n minLength: p.minLength,\n placeholder: p.placeholder,\n autoComplete: p.autoComplete,\n autoCorrect: p.autoCorrect,\n autoCapitalize: p.autoCapitalize,\n spellCheck: p.spellCheck,\n\n // Clipboard events\n onCopy: p.onCopy,\n onCut: p.onCut,\n onPaste: p.onPaste,\n\n // Composition events\n onCompositionStart: p.onCompositionStart,\n onCompositionEnd: p.onCompositionEnd,\n onCompositionUpdate: p.onCompositionUpdate,\n\n // Selection events\n onSelect: p.onSelect,\n\n // Input events\n onBeforeInput: p.onBeforeInput,\n onInput: p.onInput,\n },\n focusableProps as Record<string, unknown>,\n fieldProps as Record<string, unknown>\n ) as JSX.InputHTMLAttributes<T>;\n };\n\n const getIsInvalid = () => {\n return getProps().isInvalid ?? false;\n };\n\n return {\n get labelProps() {\n return labelProps;\n },\n get inputProps() {\n return getInputProps();\n },\n get descriptionProps() {\n return descriptionProps;\n },\n get errorMessageProps() {\n return errorMessageProps;\n },\n get isInvalid() {\n return getIsInvalid();\n },\n };\n}\n", "/**\n * ProgressBar hook for Solidaria\n *\n * Provides the accessibility implementation for a progress bar component.\n * Progress bars show either determinate or indeterminate progress of an operation\n * over time.\n *\n * This is a 1:1 port of @react-aria/progress's useProgressBar hook.\n */\n\nimport { createLabel } from '../label/createLabel';\nimport { mergeProps } from '../utils/mergeProps';\nimport { filterDOMProps } from '../utils/filterDOMProps';\nimport { type MaybeAccessor, access } from '../utils/reactivity';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaProgressBarProps {\n /** The current value (controlled). */\n value?: number;\n /** The smallest value allowed for the input. @default 0 */\n minValue?: number;\n /** The largest value allowed for the input. @default 100 */\n maxValue?: number;\n /** The content to display as the value's label (e.g. 1 of 4). */\n valueLabel?: string;\n /** Whether presentation is indeterminate when progress isn't known. */\n isIndeterminate?: boolean;\n /** The display format of the value label. */\n formatOptions?: Intl.NumberFormatOptions;\n /** The content to display as the label. */\n label?: string;\n /** An accessibility label for this item. */\n 'aria-label'?: string;\n /** Identifies the element (or elements) that labels the current element. */\n 'aria-labelledby'?: string;\n /** Identifies the element (or elements) that describes the object. */\n 'aria-describedby'?: string;\n /** Identifies the element (or elements) that provide a detailed, extended description for the object. */\n 'aria-details'?: string;\n}\n\nexport interface ProgressBarAria {\n /** Props for the progress bar container element. */\n progressBarProps: Record<string, unknown>;\n /** Props for the progress bar's visual label element (if any). */\n labelProps: Record<string, unknown>;\n}\n\n// ============================================\n// UTILITIES\n// ============================================\n\nfunction clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the accessibility implementation for a progress bar component.\n * Progress bars show either determinate or indeterminate progress of an operation\n * over time.\n */\nexport function createProgressBar(\n props: MaybeAccessor<AriaProgressBarProps> = {}\n): ProgressBarAria {\n const getProps = () => access(props);\n\n // Create label handling\n const { labelProps, fieldProps } = createLabel({\n get label() { return getProps().label; },\n get 'aria-label'() { return getProps()['aria-label']; },\n get 'aria-labelledby'() { return getProps()['aria-labelledby']; },\n // Progress bar is not an HTML input element so it\n // shouldn't be labeled by a <label> element.\n labelElementType: 'span',\n });\n\n // Build progress bar props\n const getProgressBarProps = (): Record<string, unknown> => {\n const p = getProps();\n const value = p.value ?? 0;\n const minValue = p.minValue ?? 0;\n const maxValue = p.maxValue ?? 100;\n const isIndeterminate = p.isIndeterminate ?? false;\n const formatOptions = p.formatOptions ?? { style: 'percent' as const };\n\n const clampedValue = clamp(value, minValue, maxValue);\n const percentage = (clampedValue - minValue) / (maxValue - minValue);\n\n // Format value label\n let valueLabel = p.valueLabel;\n if (!isIndeterminate && !valueLabel) {\n const valueToFormat = formatOptions.style === 'percent' ? percentage : clampedValue;\n try {\n const formatter = new Intl.NumberFormat(undefined, formatOptions);\n valueLabel = formatter.format(valueToFormat);\n } catch {\n // Fallback if formatting fails\n valueLabel = `${Math.round(percentage * 100)}%`;\n }\n }\n\n const domProps = filterDOMProps(p as Record<string, unknown>, { labelable: true });\n\n return mergeProps(domProps, fieldProps as Record<string, unknown>, {\n 'aria-valuenow': isIndeterminate ? undefined : clampedValue,\n 'aria-valuemin': minValue,\n 'aria-valuemax': maxValue,\n 'aria-valuetext': isIndeterminate ? undefined : valueLabel,\n role: 'progressbar',\n });\n };\n\n return {\n get progressBarProps() {\n return getProgressBarProps();\n },\n get labelProps() {\n return labelProps as Record<string, unknown>;\n },\n };\n}\n", "/**\n * createSeparator - SolidJS implementation of React Aria's useSeparator\n *\n * A separator is a visual divider between two groups of content,\n * e.g. groups of menu items or sections of a page.\n */\n\nimport type { JSX } from 'solid-js';\nimport { access, type MaybeAccessor } from '../utils';\nimport { filterDOMProps } from '../utils';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport type Orientation = 'horizontal' | 'vertical';\n\nexport interface AriaSeparatorProps {\n /**\n * The orientation of the separator.\n * @default 'horizontal'\n */\n orientation?: Orientation;\n /**\n * The HTML element type that will be used to render the separator.\n * @default 'hr'\n */\n elementType?: string;\n /** An accessibility label for the separator. */\n 'aria-label'?: string;\n /** Identifies the element(s) that labels the separator. */\n 'aria-labelledby'?: string;\n /** The element's unique identifier. */\n id?: string;\n}\n\nexport interface SeparatorAria {\n /** Props for the separator element. */\n separatorProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n// ============================================\n// CREATE SEPARATOR\n// ============================================\n\n/**\n * Provides the accessibility implementation for a separator.\n * A separator is a visual divider between two groups of content,\n * e.g. groups of menu items or sections of a page.\n */\nexport function createSeparator(\n props: MaybeAccessor<AriaSeparatorProps> = {}\n): SeparatorAria {\n const getSeparatorProps = (): JSX.HTMLAttributes<HTMLElement> => {\n const p = access(props);\n const domProps = filterDOMProps(p as Record<string, unknown>, { labelable: true });\n\n // if orientation is horizontal, aria-orientation default is horizontal, so we leave it undefined\n // if it's vertical, we need to specify it\n let ariaOrientation: 'vertical' | undefined;\n if (p.orientation === 'vertical') {\n ariaOrientation = 'vertical';\n }\n\n // hr elements implicitly have role = separator and a horizontal orientation\n if (p.elementType !== 'hr') {\n return {\n ...domProps,\n role: 'separator',\n 'aria-orientation': ariaOrientation,\n };\n }\n\n return domProps;\n };\n\n return {\n get separatorProps() {\n return getSeparatorProps();\n },\n };\n}\n", "/**\n * createToolbar - Accessibility hook for toolbar elements\n *\n * Provides keyboard navigation between toolbar items using arrow keys.\n * Based on @react-aria/toolbar useToolbar.\n */\n\nimport {\n createSignal,\n onMount,\n onCleanup,\n type Accessor,\n} from 'solid-js'\nimport { type MaybeAccessor, access } from '../utils'\nimport { useLocale } from '../i18n'\nimport { getOwnerDocument, isFocusable } from '../utils'\nimport { focusSafely } from '../utils/focus'\n\n// ============================================\n// TYPES\n// ============================================\n\nexport type Orientation = 'horizontal' | 'vertical'\n\nexport interface AriaToolbarProps {\n /** The orientation of the toolbar. @default 'horizontal' */\n orientation?: MaybeAccessor<Orientation>\n /** An accessibility label for the toolbar. */\n 'aria-label'?: MaybeAccessor<string>\n /** Identifies the element (or elements) that labels the toolbar. */\n 'aria-labelledby'?: MaybeAccessor<string>\n}\n\nexport interface ToolbarAria {\n /** Props for the toolbar container element. */\n toolbarProps: {\n role: 'toolbar' | 'group'\n 'aria-orientation': Orientation\n 'aria-label'?: string\n 'aria-labelledby'?: string\n tabIndex?: number\n ref: (el: HTMLElement) => void\n }\n /** The orientation of the toolbar. */\n orientation: Accessor<Orientation>\n}\n\n// ============================================\n// FOCUS MANAGER FOR TOOLBAR\n// ============================================\n\ninterface FocusManagerOptions {\n from?: Element\n tabbable?: boolean\n wrap?: boolean\n accept?: (node: Element) => boolean\n}\n\ninterface FocusManager {\n focusNext(opts?: FocusManagerOptions): HTMLElement | null\n focusPrevious(opts?: FocusManagerOptions): HTMLElement | null\n focusFirst(opts?: FocusManagerOptions): HTMLElement | null\n focusLast(opts?: FocusManagerOptions): HTMLElement | null\n}\n\nfunction isTabbable(element: Element): boolean {\n if (!isFocusable(element)) {\n return false\n }\n const tabIndex = element.getAttribute('tabindex')\n if (tabIndex != null) {\n return parseInt(tabIndex, 10) >= 0\n }\n return true\n}\n\nfunction getFocusableElements(root: Element, tabbable = false): HTMLElement[] {\n const elements: HTMLElement[] = []\n const filter = tabbable ? isTabbable : isFocusable\n\n // Check the root element itself\n if (filter(root)) {\n elements.push(root as HTMLElement)\n }\n\n // Check all descendants\n const descendants = root.querySelectorAll('*')\n for (let i = 0; i < descendants.length; i++) {\n const el = descendants[i]\n if (filter(el)) {\n elements.push(el as HTMLElement)\n }\n }\n\n return elements\n}\n\nfunction getActiveElement(doc: Document): Element | null {\n let activeElement = doc.activeElement\n while (activeElement?.shadowRoot?.activeElement) {\n activeElement = activeElement.shadowRoot.activeElement\n }\n return activeElement\n}\n\nfunction createFocusManager(ref: Accessor<HTMLElement | undefined>): FocusManager {\n return {\n focusNext(opts: FocusManagerOptions = {}) {\n const root = ref()\n if (!root) return null\n\n const { from, tabbable = true, wrap = false, accept } = opts\n const doc = getOwnerDocument(root)\n const current = from || getActiveElement(doc)\n\n let elements = getFocusableElements(root, tabbable)\n if (accept) {\n elements = elements.filter(accept)\n }\n\n if (!current || elements.length === 0) return null\n\n const currentIndex = elements.indexOf(current as HTMLElement)\n let nextIndex = currentIndex + 1\n\n if (nextIndex >= elements.length) {\n if (wrap) {\n nextIndex = 0\n } else {\n return null\n }\n }\n\n const nextElement = elements[nextIndex]\n if (nextElement) {\n focusSafely(nextElement)\n return nextElement\n }\n\n return null\n },\n\n focusPrevious(opts: FocusManagerOptions = {}) {\n const root = ref()\n if (!root) return null\n\n const { from, tabbable = true, wrap = false, accept } = opts\n const doc = getOwnerDocument(root)\n const current = from || getActiveElement(doc)\n\n let elements = getFocusableElements(root, tabbable)\n if (accept) {\n elements = elements.filter(accept)\n }\n\n if (!current || elements.length === 0) return null\n\n const currentIndex = elements.indexOf(current as HTMLElement)\n let prevIndex = currentIndex - 1\n\n if (prevIndex < 0) {\n if (wrap) {\n prevIndex = elements.length - 1\n } else {\n return null\n }\n }\n\n const prevElement = elements[prevIndex]\n if (prevElement) {\n focusSafely(prevElement)\n return prevElement\n }\n\n return null\n },\n\n focusFirst(opts: FocusManagerOptions = {}) {\n const root = ref()\n if (!root) return null\n\n const { tabbable = true, accept } = opts\n let elements = getFocusableElements(root, tabbable)\n if (accept) {\n elements = elements.filter(accept)\n }\n\n if (elements.length > 0) {\n focusSafely(elements[0])\n return elements[0]\n }\n\n return null\n },\n\n focusLast(opts: FocusManagerOptions = {}) {\n const root = ref()\n if (!root) return null\n\n const { tabbable = true, accept } = opts\n let elements = getFocusableElements(root, tabbable)\n if (accept) {\n elements = elements.filter(accept)\n }\n\n if (elements.length > 0) {\n const lastElement = elements[elements.length - 1]\n focusSafely(lastElement)\n return lastElement\n }\n\n return null\n },\n }\n}\n\n// ============================================\n// CREATE TOOLBAR HOOK\n// ============================================\n\n/**\n * Provides the behavior and accessibility implementation for a toolbar.\n * A toolbar is a container for a set of interactive controls with arrow key navigation.\n *\n * @example\n * ```tsx\n * let ref;\n * const { toolbarProps } = createToolbar({ orientation: 'horizontal' });\n * return (\n * <div {...toolbarProps}>\n * <Button>Cut</Button>\n * <Button>Copy</Button>\n * <Button>Paste</Button>\n * </div>\n * );\n * ```\n */\nexport function createToolbar(props: AriaToolbarProps = {}): ToolbarAria {\n let toolbarRef: HTMLElement | undefined\n const [isInToolbar, setIsInToolbar] = createSignal(false)\n let lastFocusedElement: Element | null = null\n\n const locale = useLocale()\n const orientation = () => access(props.orientation) ?? 'horizontal'\n const ariaLabel = () => access(props['aria-label'])\n const ariaLabelledby = () => access(props['aria-labelledby'])\n\n const focusManager = createFocusManager(() => toolbarRef)\n\n // Check if this toolbar is nested inside another toolbar\n onMount(() => {\n if (toolbarRef) {\n const parentToolbar = toolbarRef.parentElement?.closest('[role=\"toolbar\"]')\n setIsInToolbar(!!parentToolbar)\n }\n })\n\n // Keyboard event handler\n const onKeyDown = (e: KeyboardEvent) => {\n // Don't handle if nested toolbar (parent handles navigation)\n if (isInToolbar()) return\n\n const dir = locale().direction\n const isRTL = dir === 'rtl'\n const isHorizontal = orientation() === 'horizontal'\n\n let handled = false\n\n switch (e.key) {\n case 'ArrowRight':\n if (isHorizontal) {\n if (isRTL) {\n focusManager.focusPrevious({ tabbable: true })\n } else {\n focusManager.focusNext({ tabbable: true })\n }\n handled = true\n }\n break\n case 'ArrowLeft':\n if (isHorizontal) {\n if (isRTL) {\n focusManager.focusNext({ tabbable: true })\n } else {\n focusManager.focusPrevious({ tabbable: true })\n }\n handled = true\n }\n break\n case 'ArrowDown':\n if (!isHorizontal) {\n focusManager.focusNext({ tabbable: true })\n handled = true\n }\n break\n case 'ArrowUp':\n if (!isHorizontal) {\n focusManager.focusPrevious({ tabbable: true })\n handled = true\n }\n break\n case 'Tab':\n // Store the last focused element for re-entry\n lastFocusedElement = e.target as Element\n break\n }\n\n if (handled) {\n e.preventDefault()\n e.stopPropagation()\n }\n }\n\n // Focus handler - restore last focused element when re-entering\n const onFocus = (e: FocusEvent) => {\n if (isInToolbar()) return\n\n // Only restore if focus is coming from outside the toolbar\n const root = toolbarRef\n if (!root) return\n\n const relatedTarget = e.relatedTarget as Element | null\n\n // If focus came from outside and we have a last focused element\n if (\n lastFocusedElement &&\n root.contains(lastFocusedElement) &&\n (!relatedTarget || !root.contains(relatedTarget))\n ) {\n // Restore focus to the last focused element\n focusSafely(lastFocusedElement as HTMLElement)\n }\n }\n\n // Set up capture event listeners\n const setRef = (el: HTMLElement) => {\n toolbarRef = el\n\n // Use capture phase for keyboard events\n el.addEventListener('keydown', onKeyDown, true)\n el.addEventListener('focus', onFocus, true)\n\n onCleanup(() => {\n el.removeEventListener('keydown', onKeyDown, true)\n el.removeEventListener('focus', onFocus, true)\n })\n }\n\n return {\n toolbarProps: {\n get role() {\n return isInToolbar() ? 'group' : 'toolbar'\n },\n get 'aria-orientation'() {\n return orientation()\n },\n get 'aria-label'() {\n return ariaLabel()\n },\n get 'aria-labelledby'() {\n // Only use aria-labelledby if no aria-label is provided\n return ariaLabel() ? undefined : ariaLabelledby()\n },\n ref: setRef,\n },\n orientation,\n }\n}\n", "/**\n * Locale context and provider for solidaria\n *\n * Provides locale and text direction to the component tree.\n *\n * Port of @react-aria/i18n context and useDefaultLocale.\n */\n\nimport {\n type Accessor,\n type JSX,\n type ParentProps,\n createContext,\n createEffect,\n createMemo,\n createSignal,\n onCleanup,\n useContext,\n} from 'solid-js';\nimport { isRTL } from './utils';\n\n// ============================================\n// TYPES\n// ============================================\n\n/** Text direction: left-to-right or right-to-left. */\nexport type Direction = 'ltr' | 'rtl';\n\n/** Locale information including language code and text direction. */\nexport interface Locale {\n /** The BCP47 language code for the locale (e.g., 'en-US', 'ar-SA'). */\n locale: string;\n /** The writing direction for the locale. */\n direction: Direction;\n}\n\nexport interface I18nProviderProps extends ParentProps {\n /** The locale to apply to the children. If not provided, uses browser default. */\n locale?: string;\n}\n\n// ============================================\n// GLOBAL STATE\n// ============================================\n\n// Symbol for server-provided locale\nconst localeSymbol = Symbol.for('solidaria.i18n.locale');\n\nlet currentLocale: Locale | null = null;\nconst listeners = new Set<(locale: Locale) => void>();\n\n/**\n * Gets the default locale from the browser/system.\n */\nexport function getDefaultLocale(): Locale {\n let locale =\n (typeof window !== 'undefined' &&\n (window as unknown as Record<symbol, string>)[localeSymbol]) ||\n (typeof navigator !== 'undefined' &&\n (navigator.language ||\n (navigator as unknown as { userLanguage?: string }).userLanguage)) ||\n 'en-US';\n\n // Validate the locale is supported\n try {\n Intl.DateTimeFormat.supportedLocalesOf([locale]);\n } catch {\n locale = 'en-US';\n }\n\n return {\n locale,\n direction: isRTL(locale) ? 'rtl' : 'ltr',\n };\n}\n\nfunction updateLocale(): void {\n currentLocale = getDefaultLocale();\n for (const listener of listeners) {\n listener(currentLocale);\n }\n}\n\n// ============================================\n// CONTEXT\n// ============================================\n\nconst I18nContext = createContext<Accessor<Locale> | null>(null);\n\n// ============================================\n// HOOKS\n// ============================================\n\n/**\n * Returns the current browser/system locale, and updates when it changes.\n *\n * @example\n * ```tsx\n * const locale = createDefaultLocale();\n * console.log(locale().locale); // 'en-US'\n * console.log(locale().direction); // 'ltr'\n * ```\n */\nexport function createDefaultLocale(): Accessor<Locale> {\n if (!currentLocale) {\n currentLocale = getDefaultLocale();\n }\n\n const [locale, setLocale] = createSignal<Locale>(currentLocale);\n\n createEffect(() => {\n if (typeof window === 'undefined') {\n return;\n }\n\n if (listeners.size === 0) {\n window.addEventListener('languagechange', updateLocale);\n }\n\n listeners.add(setLocale);\n\n onCleanup(() => {\n listeners.delete(setLocale);\n if (listeners.size === 0) {\n window.removeEventListener('languagechange', updateLocale);\n }\n });\n });\n\n return locale;\n}\n\n/**\n * Returns the current locale and layout direction from context or browser default.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const locale = useLocale();\n * return <div dir={locale().direction}>{locale().locale}</div>;\n * }\n * ```\n */\nexport function useLocale(): Accessor<Locale> {\n const context = useContext(I18nContext);\n const defaultLocale = createDefaultLocale();\n return context || defaultLocale;\n}\n\n// ============================================\n// PROVIDER\n// ============================================\n\n/**\n * Provides the locale for the application to all child components.\n *\n * @example\n * ```tsx\n * // Use browser default locale\n * <I18nProvider>\n * <App />\n * </I18nProvider>\n *\n * // Override with specific locale\n * <I18nProvider locale=\"ar-SA\">\n * <App /> // Will have RTL direction\n * </I18nProvider>\n * ```\n */\nexport function I18nProvider(props: I18nProviderProps): JSX.Element {\n const defaultLocale = createDefaultLocale();\n\n const locale = createMemo<Locale>(() => {\n if (props.locale) {\n return {\n locale: props.locale,\n direction: isRTL(props.locale) ? 'rtl' : 'ltr',\n };\n }\n return defaultLocale();\n });\n\n return (\n <I18nContext.Provider value={locale}>\n {props.children}\n </I18nContext.Provider>\n );\n}\n", "/**\n * i18n utilities for solidaria\n *\n * RTL detection and locale utilities.\n *\n * Port of @react-aria/i18n utils.\n */\n\n// https://en.wikipedia.org/wiki/Right-to-left\nconst RTL_SCRIPTS = new Set([\n 'Arab',\n 'Syrc',\n 'Samr',\n 'Mand',\n 'Thaa',\n 'Mend',\n 'Nkoo',\n 'Adlm',\n 'Rohg',\n 'Hebr',\n]);\n\nconst RTL_LANGS = new Set([\n 'ae',\n 'ar',\n 'arc',\n 'bcc',\n 'bqi',\n 'ckb',\n 'dv',\n 'fa',\n 'glk',\n 'he',\n 'ku',\n 'mzn',\n 'nqo',\n 'pnb',\n 'ps',\n 'sd',\n 'ug',\n 'ur',\n 'yi',\n]);\n\n/**\n * Determines if a locale is read right to left.\n * Uses Intl.Locale API when available for accurate detection.\n */\nexport function isRTL(localeString: string): boolean {\n // If the Intl.Locale API is available, use it to get the locale's text direction.\n if (typeof Intl !== 'undefined' && Intl.Locale) {\n try {\n const locale = new Intl.Locale(localeString).maximize();\n\n // Use the text info object to get the direction if possible.\n // getTextInfo() was implemented as a property by some browsers before it was standardized as a function.\n const localeAny = locale as unknown as {\n getTextInfo?: () => { direction: string };\n textInfo?: { direction: string };\n };\n const textInfo = typeof localeAny.getTextInfo === 'function'\n ? localeAny.getTextInfo()\n : localeAny.textInfo;\n\n if (textInfo) {\n return textInfo.direction === 'rtl';\n }\n\n // Fallback: guess using the script.\n if (locale.script) {\n return RTL_SCRIPTS.has(locale.script);\n }\n } catch {\n // Fall through to language-based detection\n }\n }\n\n // If not, just guess by the language (first part of the locale)\n const lang = localeString.split('-')[0];\n return RTL_LANGS.has(lang);\n}\n\n/**\n * Creates a cache key for formatter options.\n */\nexport function createCacheKey(\n locale: string,\n options?: Record<string, unknown>\n): string {\n if (!options) {\n return locale;\n }\n return (\n locale +\n Object.entries(options)\n .sort((a, b) => (a[0] < b[0] ? -1 : 1))\n .join()\n );\n}\n", "/**\n * NumberFormatter for solidaria\n *\n * A wrapper around Intl.NumberFormat with caching and polyfills.\n *\n * Port of @internationalized/number NumberFormatter.\n */\n\n// ============================================\n// FEATURE DETECTION\n// ============================================\n\nlet supportsSignDisplay = false;\ntry {\n supportsSignDisplay =\n new Intl.NumberFormat('de-DE', { signDisplay: 'exceptZero' }).resolvedOptions()\n .signDisplay === 'exceptZero';\n} catch {\n // Not supported\n}\n\nlet supportsUnit = false;\ntry {\n supportsUnit =\n new Intl.NumberFormat('de-DE', { style: 'unit', unit: 'degree' }).resolvedOptions()\n .style === 'unit';\n} catch {\n // Not supported\n}\n\n// ============================================\n// POLYFILLS\n// ============================================\n\n// Polyfill for units since Safari doesn't support them yet.\n// Currently only polyfilling the unit degree in narrow format.\nconst UNITS: Record<string, Record<string, Record<string, string>>> = {\n degree: {\n narrow: {\n default: '\u00B0',\n 'ja-JP': ' \u5EA6',\n 'zh-TW': '\u5EA6',\n 'sl-SI': ' \u00B0',\n },\n },\n};\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface NumberFormatOptions extends Intl.NumberFormatOptions {\n /** Overrides default numbering system for the current locale. */\n numberingSystem?: string;\n}\n\ninterface NumberRangeFormatPart extends Intl.NumberFormatPart {\n source: 'startRange' | 'endRange' | 'shared';\n}\n\n// ============================================\n// CACHE\n// ============================================\n\nconst formatterCache = new Map<string, Intl.NumberFormat>();\n\nfunction getCachedNumberFormatter(\n locale: string,\n options: NumberFormatOptions = {}\n): Intl.NumberFormat {\n let processedLocale = locale;\n const { numberingSystem } = options;\n\n if (numberingSystem && !processedLocale.includes('-nu-')) {\n if (!processedLocale.includes('-u-')) {\n processedLocale += '-u-';\n }\n processedLocale += `-nu-${numberingSystem}`;\n }\n\n let processedOptions = options;\n if (options.style === 'unit' && !supportsUnit) {\n const { unit, unitDisplay = 'short' } = options;\n if (!unit) {\n throw new Error('unit option must be provided with style: \"unit\"');\n }\n if (!UNITS[unit]?.[unitDisplay]) {\n throw new Error(`Unsupported unit ${unit} with unitDisplay = ${unitDisplay}`);\n }\n processedOptions = { ...options, style: 'decimal' };\n }\n\n const cacheKey =\n processedLocale +\n (processedOptions\n ? Object.entries(processedOptions)\n .sort((a, b) => (a[0] < b[0] ? -1 : 1))\n .join()\n : '');\n\n if (formatterCache.has(cacheKey)) {\n return formatterCache.get(cacheKey)!;\n }\n\n const numberFormatter = new Intl.NumberFormat(processedLocale, processedOptions);\n formatterCache.set(cacheKey, numberFormatter);\n return numberFormatter;\n}\n\n// ============================================\n// SIGN DISPLAY POLYFILL\n// ============================================\n\nfunction numberFormatSignDisplayPolyfill(\n numberFormat: Intl.NumberFormat,\n signDisplay: string,\n num: number\n): string {\n if (signDisplay === 'auto') {\n return numberFormat.format(num);\n } else if (signDisplay === 'never') {\n return numberFormat.format(Math.abs(num));\n } else {\n let needsPositiveSign = false;\n let processedNum = num;\n\n if (signDisplay === 'always') {\n needsPositiveSign = num > 0 || Object.is(num, 0);\n } else if (signDisplay === 'exceptZero') {\n if (Object.is(num, -0) || Object.is(num, 0)) {\n processedNum = Math.abs(num);\n } else {\n needsPositiveSign = num > 0;\n }\n }\n\n if (needsPositiveSign) {\n const negative = numberFormat.format(-processedNum);\n const noSign = numberFormat.format(processedNum);\n // Ignore RTL/LTR marker characters\n const minus = negative.replace(noSign, '').replace(/\\u200e|\\u061C/, '');\n if ([...minus].length !== 1) {\n console.warn(\n 'solidaria i18n polyfill for NumberFormat signDisplay: Unsupported case'\n );\n }\n const positive = negative\n .replace(noSign, '!!!')\n .replace(minus, '+')\n .replace('!!!', noSign);\n return positive;\n } else {\n return numberFormat.format(processedNum);\n }\n }\n}\n\n// ============================================\n// NUMBER FORMATTER CLASS\n// ============================================\n\n/**\n * A wrapper around Intl.NumberFormat providing additional options, polyfills, and caching.\n *\n * @example\n * ```ts\n * const formatter = new NumberFormatter('en-US', {\n * style: 'currency',\n * currency: 'USD',\n * });\n * formatter.format(1234.56); // '$1,234.56'\n * ```\n */\nexport class NumberFormatter implements Intl.NumberFormat {\n private numberFormatter: Intl.NumberFormat;\n private options: NumberFormatOptions;\n\n constructor(locale: string, options: NumberFormatOptions = {}) {\n this.numberFormatter = getCachedNumberFormatter(locale, options);\n this.options = options;\n }\n\n /** Formats a number value as a string, according to the locale and options. */\n format(value: number): string {\n let res = '';\n\n if (!supportsSignDisplay && this.options.signDisplay != null) {\n res = numberFormatSignDisplayPolyfill(\n this.numberFormatter,\n this.options.signDisplay,\n value\n );\n } else {\n res = this.numberFormatter.format(value);\n }\n\n if (this.options.style === 'unit' && !supportsUnit) {\n const { unit, unitDisplay = 'short', locale } = this.resolvedOptions();\n if (!unit) {\n return res;\n }\n const values = UNITS[unit]?.[unitDisplay];\n res += values[locale] || values.default;\n }\n\n return res;\n }\n\n /** Formats a number to an array of parts. */\n formatToParts(value: number): Intl.NumberFormatPart[] {\n return this.numberFormatter.formatToParts(value);\n }\n\n /** Formats a number range as a string. */\n formatRange(start: number, end: number): string {\n if (typeof this.numberFormatter.formatRange === 'function') {\n return this.numberFormatter.formatRange(start, end);\n }\n\n if (end < start) {\n throw new RangeError('End date must be >= start date');\n }\n\n // Fallback for old browsers\n return `${this.format(start)} \u2013 ${this.format(end)}`;\n }\n\n /** Formats a number range as an array of parts. */\n formatRangeToParts(start: number, end: number): NumberRangeFormatPart[] {\n if (typeof this.numberFormatter.formatRangeToParts === 'function') {\n return this.numberFormatter.formatRangeToParts(start, end);\n }\n\n if (end < start) {\n throw new RangeError('End date must be >= start date');\n }\n\n const startParts = this.numberFormatter.formatToParts(start);\n const endParts = this.numberFormatter.formatToParts(end);\n return [\n ...startParts.map((p) => ({ ...p, source: 'startRange' as const })),\n { type: 'literal' as const, value: ' \u2013 ', source: 'shared' as const },\n ...endParts.map((p) => ({ ...p, source: 'endRange' as const })),\n ];\n }\n\n /** Returns the resolved formatting options. */\n resolvedOptions(): Intl.ResolvedNumberFormatOptions {\n let options = this.numberFormatter.resolvedOptions();\n\n if (!supportsSignDisplay && this.options.signDisplay != null) {\n options = { ...options, signDisplay: this.options.signDisplay };\n }\n\n if (!supportsUnit && this.options.style === 'unit') {\n options = {\n ...options,\n style: 'unit',\n unit: this.options.unit,\n unitDisplay: this.options.unitDisplay,\n };\n }\n\n return options;\n }\n}\n", "/**\n * createNumberFormatter hook for solidaria\n *\n * Provides localized number formatting with automatic locale updates.\n *\n * Port of @react-aria/i18n useNumberFormatter.\n */\n\nimport { createMemo } from 'solid-js';\nimport { useLocale } from './locale';\nimport { NumberFormatter, type NumberFormatOptions } from './NumberFormatter';\n\n/**\n * Provides localized number formatting for the current locale.\n * Automatically updates when the locale changes.\n *\n * @example\n * ```tsx\n * function PriceDisplay(props: { value: number }) {\n * const formatter = createNumberFormatter({\n * style: 'currency',\n * currency: 'USD',\n * });\n *\n * return <span>{formatter().format(props.value)}</span>;\n * }\n * ```\n *\n * @example\n * ```tsx\n * // Percent formatting\n * const percentFormatter = createNumberFormatter({\n * style: 'percent',\n * minimumFractionDigits: 1,\n * });\n * percentFormatter().format(0.125); // '12.5%'\n *\n * // Unit formatting\n * const tempFormatter = createNumberFormatter({\n * style: 'unit',\n * unit: 'celsius',\n * });\n * tempFormatter().format(25); // '25\u00B0C'\n * ```\n */\nexport function createNumberFormatter(\n options: NumberFormatOptions = {}\n): () => NumberFormatter {\n const locale = useLocale();\n\n return createMemo(() => new NumberFormatter(locale().locale, options));\n}\n", "/**\n * createDateFormatter hook for solidaria\n *\n * Provides localized date formatting with caching.\n *\n * Port of @react-aria/i18n useDateFormatter.\n */\n\nimport { createMemo } from 'solid-js';\nimport { useLocale } from './locale';\nimport { createCacheKey } from './utils';\n\n// ============================================\n// CACHE\n// ============================================\n\nconst dateFormatterCache = new Map<string, Intl.DateTimeFormat>();\n\n/**\n * Gets or creates a cached date formatter.\n */\nfunction getCachedDateFormatter(\n locale: string,\n options?: Intl.DateTimeFormatOptions\n): Intl.DateTimeFormat {\n const cacheKey = createCacheKey(locale, options as Record<string, unknown>);\n\n if (dateFormatterCache.has(cacheKey)) {\n return dateFormatterCache.get(cacheKey)!;\n }\n\n const formatter = new Intl.DateTimeFormat(locale, options);\n dateFormatterCache.set(cacheKey, formatter);\n return formatter;\n}\n\n// ============================================\n// HOOK\n// ============================================\n\n/**\n * Provides localized date and time formatting for the current locale.\n * Automatically updates when the locale changes.\n *\n * @example\n * ```tsx\n * function DateDisplay(props: { date: Date }) {\n * const formatter = createDateFormatter({\n * year: 'numeric',\n * month: 'long',\n * day: 'numeric',\n * });\n *\n * return <span>{formatter().format(props.date)}</span>;\n * }\n * ```\n *\n * @example\n * ```tsx\n * // Short date\n * const shortDate = createDateFormatter({ dateStyle: 'short' });\n * shortDate().format(new Date()); // '1/19/26' (US) or '19/01/26' (UK)\n *\n * // Full date with time\n * const fullDateTime = createDateFormatter({\n * dateStyle: 'full',\n * timeStyle: 'short',\n * });\n *\n * // Time only\n * const timeFormatter = createDateFormatter({\n * hour: 'numeric',\n * minute: '2-digit',\n * });\n * ```\n */\nexport function createDateFormatter(\n options?: Intl.DateTimeFormatOptions\n): () => Intl.DateTimeFormat {\n const locale = useLocale();\n\n return createMemo(() => getCachedDateFormatter(locale().locale, options));\n}\n", "/**\n * createCollator hook for solidaria\n *\n * Provides localized string comparison/collation with caching.\n *\n * Port of @react-aria/i18n useCollator.\n */\n\nimport { createMemo } from 'solid-js';\nimport { useLocale } from './locale';\nimport { createCacheKey } from './utils';\n\n// ============================================\n// CACHE\n// ============================================\n\nconst collatorCache = new Map<string, Intl.Collator>();\n\n/**\n * Gets or creates a cached collator.\n */\nfunction getCachedCollator(\n locale: string,\n options?: Intl.CollatorOptions\n): Intl.Collator {\n const cacheKey = createCacheKey(locale, options as Record<string, unknown>);\n\n if (collatorCache.has(cacheKey)) {\n return collatorCache.get(cacheKey)!;\n }\n\n const collator = new Intl.Collator(locale, options);\n collatorCache.set(cacheKey, collator);\n return collator;\n}\n\n// ============================================\n// HOOK\n// ============================================\n\n/**\n * Provides localized string collation for the current locale.\n * Useful for sorting strings according to locale-specific rules.\n *\n * @example\n * ```tsx\n * function SortedList(props: { items: string[] }) {\n * const collator = createCollator();\n *\n * const sortedItems = () =>\n * [...props.items].sort((a, b) => collator().compare(a, b));\n *\n * return (\n * <ul>\n * <For each={sortedItems()}>\n * {(item) => <li>{item}</li>}\n * </For>\n * </ul>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * // Case-insensitive sorting\n * const collator = createCollator({ sensitivity: 'base' });\n *\n * // Numeric sorting\n * const numericCollator = createCollator({ numeric: true });\n * // ['a1', 'a10', 'a2'].sort(numericCollator().compare) -> ['a1', 'a2', 'a10']\n * ```\n */\nexport function createCollator(\n options?: Intl.CollatorOptions\n): () => Intl.Collator {\n const locale = useLocale();\n\n return createMemo(() => getCachedCollator(locale().locale, options));\n}\n", "/**\n * createFilter hook for solidaria\n *\n * Provides localized string filtering with collation support.\n *\n * Port of @react-aria/i18n useFilter.\n */\n\nimport { createMemo } from 'solid-js';\nimport { createCollator } from './createCollator';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface Filter {\n /** Returns whether a string starts with a given substring. */\n startsWith(string: string, substring: string): boolean;\n /** Returns whether a string ends with a given substring. */\n endsWith(string: string, substring: string): boolean;\n /** Returns whether a string contains a given substring. */\n contains(string: string, substring: string): boolean;\n}\n\n// ============================================\n// HOOK\n// ============================================\n\n/**\n * Provides localized string search functionality for filtering or matching items.\n * Respects locale-specific collation rules for case and diacritic sensitivity.\n *\n * @example\n * ```tsx\n * function SearchableList(props: { items: { name: string }[] }) {\n * const [query, setQuery] = createSignal('');\n * const filter = createFilter({ sensitivity: 'base' });\n *\n * const filteredItems = () =>\n * props.items.filter((item) =>\n * filter().contains(item.name, query())\n * );\n *\n * return (\n * <>\n * <input\n * value={query()}\n * onInput={(e) => setQuery(e.target.value)}\n * placeholder=\"Search...\"\n * />\n * <ul>\n * <For each={filteredItems()}>\n * {(item) => <li>{item.name}</li>}\n * </For>\n * </ul>\n * </>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * // Case-insensitive, diacritic-insensitive filtering\n * const filter = createFilter({ sensitivity: 'base' });\n * filter().contains('Caf\u00E9', 'cafe'); // true\n * filter().startsWith('Hello', 'hello'); // true\n * ```\n */\nexport function createFilter(options?: Intl.CollatorOptions): () => Filter {\n const collator = createCollator({\n usage: 'search',\n ...options,\n });\n\n return createMemo(() => {\n const coll = collator();\n\n const startsWith = (str: string, substring: string): boolean => {\n if (substring.length === 0) {\n return true;\n }\n\n // Normalize both strings for safe slicing\n const normalizedStr = str.normalize('NFC');\n const normalizedSub = substring.normalize('NFC');\n\n return (\n coll.compare(normalizedStr.slice(0, normalizedSub.length), normalizedSub) ===\n 0\n );\n };\n\n const endsWith = (str: string, substring: string): boolean => {\n if (substring.length === 0) {\n return true;\n }\n\n const normalizedStr = str.normalize('NFC');\n const normalizedSub = substring.normalize('NFC');\n\n return (\n coll.compare(normalizedStr.slice(-normalizedSub.length), normalizedSub) === 0\n );\n };\n\n const contains = (str: string, substring: string): boolean => {\n if (substring.length === 0) {\n return true;\n }\n\n const normalizedStr = str.normalize('NFC');\n const normalizedSub = substring.normalize('NFC');\n const sliceLen = normalizedSub.length;\n\n for (let scan = 0; scan + sliceLen <= normalizedStr.length; scan++) {\n const slice = normalizedStr.slice(scan, scan + sliceLen);\n if (coll.compare(normalizedSub, slice) === 0) {\n return true;\n }\n }\n\n return false;\n };\n\n return {\n startsWith,\n endsWith,\n contains,\n };\n });\n}\n", "/**\n * String formatter for localized strings with ICU MessageFormat support.\n * Port of @react-aria/i18n useLocalizedStringFormatter.\n */\n\nimport {\n LocalizedString,\n LocalizedStringDictionary,\n LocalizedStringFormatter,\n type LocalizedStrings,\n} from '@internationalized/string';\nimport { createMemo, type Accessor } from 'solid-js';\nimport { useLocale } from './locale';\n\n// Cache for dictionaries to avoid recreating them\nconst cache = new WeakMap<LocalizedStrings<string, LocalizedString>, LocalizedStringDictionary<string, LocalizedString>>();\n\nfunction getCachedDictionary<K extends string, T extends LocalizedString>(\n strings: LocalizedStrings<K, T>\n): LocalizedStringDictionary<K, T> {\n let dictionary = cache.get(strings as LocalizedStrings<string, LocalizedString>);\n if (!dictionary) {\n dictionary = new LocalizedStringDictionary(strings as LocalizedStrings<string, LocalizedString>);\n cache.set(strings as LocalizedStrings<string, LocalizedString>, dictionary);\n }\n return dictionary as LocalizedStringDictionary<K, T>;\n}\n\n/**\n * Returns a cached LocalizedStringDictionary for the given strings.\n */\nexport function createStringDictionary<K extends string = string, T extends LocalizedString = string>(\n strings: LocalizedStrings<K, T>,\n packageName?: string\n): LocalizedStringDictionary<K, T> {\n return (\n (packageName && LocalizedStringDictionary.getGlobalDictionaryForPackage(packageName)) ||\n getCachedDictionary(strings)\n );\n}\n\n/**\n * Provides localized string formatting for the current locale.\n * Supports interpolating variables, selecting the correct pluralization,\n * and formatting numbers. Automatically updates when the locale changes.\n *\n * @param strings - A mapping of languages to localized strings by key.\n * @param packageName - Optional package name for global dictionary lookup.\n *\n * @example\n * ```tsx\n * const strings = {\n * 'en-US': {\n * greeting: 'Hello, {name}!',\n * count: '{count, plural, one {# item} other {# items}}'\n * }\n * };\n *\n * function MyComponent() {\n * const stringFormatter = createStringFormatter(strings);\n *\n * return (\n * <div>\n * {stringFormatter().format('greeting', { name: 'World' })}\n * {stringFormatter().format('count', { count: 5 })}\n * </div>\n * );\n * }\n * ```\n */\nexport function createStringFormatter<K extends string = string, T extends LocalizedString = string>(\n strings: LocalizedStrings<K, T>,\n packageName?: string\n): Accessor<LocalizedStringFormatter<K, T>> {\n const localeAccessor = useLocale();\n const dictionary = createStringDictionary(strings, packageName);\n\n return createMemo(() => new LocalizedStringFormatter(localeAccessor().locale, dictionary));\n}\n\n// Re-export types for convenience\nexport type {\n LocalizedString,\n LocalizedStringDictionary,\n LocalizedStringFormatter,\n LocalizedStrings,\n};\n", "/**\n * createAutocomplete - Accessibility hook for autocomplete components\n *\n * Provides keyboard navigation, virtual focus via aria-activedescendant,\n * and filtering capabilities for autocomplete inputs.\n *\n * Based on @react-aria/autocomplete useAutocomplete.\n */\n\nimport {\n createSignal,\n createEffect,\n onCleanup,\n type Accessor,\n} from 'solid-js'\nimport { createId } from '../ssr'\nimport { type AutocompleteState } from '@proyecto-viviana/solid-stately'\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface CollectionOptions {\n /** The id of the collection element. */\n id?: string\n /** Accessible label for the collection. */\n 'aria-label'?: string\n /** Whether the collection items should use virtual focus instead of being focused directly. */\n shouldUseVirtualFocus: boolean\n /** Whether typeahead is disabled. */\n disallowTypeAhead: boolean\n}\n\nexport interface AutocompleteInputProps {\n /** Current input value. */\n value: Accessor<string>\n /** Handler for input value changes. */\n onChange: (value: string) => void\n /** Handler for key events. */\n onKeyDown: (e: KeyboardEvent) => void\n /** Handler for focus events. */\n onFocus: (e: FocusEvent) => void\n /** Handler for blur events. */\n onBlur: (e: FocusEvent) => void\n /** The id of the currently focused item for aria-activedescendant. */\n 'aria-activedescendant': Accessor<string | undefined>\n /** The id of the controlled collection. */\n 'aria-controls': string\n /** Autocomplete type. */\n 'aria-autocomplete': 'list' | 'none' | 'inline' | 'both'\n /** Enter key hint for mobile keyboards. */\n enterKeyHint: 'go'\n /** Disable autocorrect. */\n autoCorrect: 'off'\n /** Disable spell check. */\n spellCheck: 'false'\n /** Disable browser autocomplete. */\n autoComplete: 'off'\n}\n\nexport interface AriaAutocompleteOptions<_T = unknown> {\n /** Ref accessor for the input element. */\n inputRef: Accessor<HTMLInputElement | undefined>\n /** Ref accessor for the collection element. */\n collectionRef: Accessor<HTMLElement | undefined>\n /**\n * An optional filter function used to determine if an option should be included.\n * @param textValue - The text value of the item\n * @param inputValue - The current input value\n */\n filter?: (textValue: string, inputValue: string) => boolean\n /**\n * Whether to focus the first item after filtering.\n * @default false\n */\n disableAutoFocusFirst?: boolean\n /**\n * Whether to disable virtual focus (aria-activedescendant).\n * @default false\n */\n disableVirtualFocus?: boolean\n}\n\nexport interface AutocompleteAria<_T = unknown> {\n /** Props for the autocomplete input element. */\n inputProps: AutocompleteInputProps\n /** Props for the collection (ListBox/Menu). */\n collectionProps: CollectionOptions\n /** A filter function that returns if the item should be shown. */\n filter?: (textValue: string) => boolean\n}\n\n// ============================================\n// CONSTANTS\n// ============================================\n\n// Custom event names for collection communication\nexport const AUTOCOMPLETE_FOCUS_EVENT = 'autocomplete:focus'\nexport const AUTOCOMPLETE_CLEAR_FOCUS_EVENT = 'autocomplete:clearfocus'\n\n// ============================================\n// CREATE AUTOCOMPLETE HOOK\n// ============================================\n\n/**\n * Provides the behavior and accessibility implementation for an autocomplete component.\n * An autocomplete combines a text input with a collection, allowing users to filter\n * the collection's contents to match a query.\n *\n * @example\n * ```tsx\n * const state = createAutocompleteState({ defaultInputValue: '' });\n * let inputRef, collectionRef;\n *\n * const { inputProps, collectionProps, filter } = createAutocomplete({\n * inputRef: () => inputRef,\n * collectionRef: () => collectionRef,\n * filter: (textValue, inputValue) =>\n * textValue.toLowerCase().includes(inputValue.toLowerCase()),\n * }, state);\n *\n * return (\n * <div>\n * <input ref={inputRef} {...inputProps} />\n * <ul ref={collectionRef} {...collectionProps}>\n * {items.filter(item => filter?.(item.name) ?? true).map(item => (\n * <li key={item.id}>{item.name}</li>\n * ))}\n * </ul>\n * </div>\n * );\n * ```\n */\nexport function createAutocomplete<T = unknown>(\n props: AriaAutocompleteOptions<T>,\n state: AutocompleteState\n): AutocompleteAria<T> {\n const {\n inputRef,\n collectionRef,\n filter,\n disableAutoFocusFirst = false,\n disableVirtualFocus = false,\n } = props\n\n const collectionId = createId()\n const [shouldUseVirtualFocus] = createSignal(!disableVirtualFocus)\n let lastInputType = ''\n\n // Track the input type for determining focus behavior\n const handleInput = (e: Event) => {\n const inputEvent = e as InputEvent\n lastInputType = inputEvent.inputType || ''\n }\n\n // Set up input event listener\n createEffect(() => {\n const input = inputRef()\n if (input) {\n input.addEventListener('input', handleInput)\n onCleanup(() => {\n input.removeEventListener('input', handleInput)\n })\n }\n })\n\n // Focus first item in collection\n const focusFirstItem = () => {\n const collection = collectionRef()\n if (collection) {\n collection.dispatchEvent(\n new CustomEvent(AUTOCOMPLETE_FOCUS_EVENT, {\n cancelable: true,\n bubbles: true,\n detail: { focusStrategy: 'first' },\n })\n )\n }\n }\n\n // Clear virtual focus\n const clearVirtualFocus = (clearFocusKey = false) => {\n state.setFocusedNodeId(null)\n const collection = collectionRef()\n if (collection) {\n collection.dispatchEvent(\n new CustomEvent(AUTOCOMPLETE_CLEAR_FOCUS_EVENT, {\n cancelable: true,\n bubbles: true,\n detail: { clearFocusKey },\n })\n )\n }\n }\n\n // Handle input value changes\n const onChange = (value: string) => {\n // Focus first item when typing forward, clear when backspacing/pasting\n if (lastInputType === 'insertText' && !disableAutoFocusFirst) {\n focusFirstItem()\n } else if (\n lastInputType &&\n (lastInputType.includes('insert') ||\n lastInputType.includes('delete') ||\n lastInputType.includes('history'))\n ) {\n clearVirtualFocus(true)\n }\n\n state.setInputValue(value)\n }\n\n // Handle keyboard navigation\n const onKeyDown = (e: KeyboardEvent) => {\n if ((e as any).isComposing) {\n return\n }\n\n const focusedNodeId = state.focusedNodeId()\n const collection = collectionRef()\n\n switch (e.key) {\n case 'Escape':\n // Let the input handle Escape (e.g., clear value)\n if (e.defaultPrevented) {\n return\n }\n break\n\n case ' ':\n // Space shouldn't trigger item action\n return\n\n case 'Tab':\n // Let Tab propagate normally for focus management\n return\n\n case 'ArrowUp':\n case 'ArrowDown':\n case 'Home':\n case 'End':\n case 'PageUp':\n case 'PageDown': {\n // Prevent cursor movement in input\n e.preventDefault()\n\n // Dispatch focus event to collection\n if (collection) {\n collection.dispatchEvent(\n new CustomEvent(AUTOCOMPLETE_FOCUS_EVENT, {\n cancelable: true,\n bubbles: true,\n })\n )\n }\n break\n }\n\n case 'ArrowLeft':\n case 'ArrowRight':\n // Clear activedescendant so screen reader announces cursor movement\n clearVirtualFocus()\n return\n\n case 'Enter':\n // Trigger click on focused item\n if (focusedNodeId) {\n const item = document.getElementById(focusedNodeId)\n if (item) {\n item.click()\n e.preventDefault()\n }\n }\n return\n }\n\n // Forward keyboard events to collection/focused item\n if (!e.defaultPrevented && collection) {\n e.stopPropagation()\n\n if (focusedNodeId) {\n const item = document.getElementById(focusedNodeId)\n if (item) {\n item.dispatchEvent(new KeyboardEvent(e.type, e))\n }\n } else {\n collection.dispatchEvent(new KeyboardEvent(e.type, e))\n }\n }\n }\n\n // Handle focus events\n const onFocus = (e: FocusEvent) => {\n if (!e.isTrusted) return\n\n // Restore virtual focus when refocusing input\n const focusedNodeId = state.focusedNodeId()\n if (focusedNodeId) {\n const item = document.getElementById(focusedNodeId)\n if (item) {\n // Item still exists, keep focus on it\n }\n }\n }\n\n const onBlur = (e: FocusEvent) => {\n if (!e.isTrusted) return\n // Virtual focus blur handling would go here\n }\n\n // Create filter function\n const filterFn = filter\n ? (textValue: string) => filter(textValue, state.inputValue())\n : undefined\n\n return {\n inputProps: {\n value: state.inputValue,\n onChange,\n onKeyDown,\n onFocus,\n onBlur,\n get 'aria-activedescendant'() {\n return () => (shouldUseVirtualFocus() ? state.focusedNodeId() ?? undefined : undefined)\n },\n 'aria-controls': collectionId,\n 'aria-autocomplete': 'list',\n enterKeyHint: 'go',\n autoCorrect: 'off',\n spellCheck: 'false',\n autoComplete: 'off',\n },\n collectionProps: {\n id: collectionId,\n 'aria-label': 'Suggestions',\n shouldUseVirtualFocus: shouldUseVirtualFocus(),\n disallowTypeAhead: shouldUseVirtualFocus(),\n },\n filter: filterFn,\n }\n}\n", "/**\n * Prevents scrolling on the document body while mounted.\n * Based on @react-aria/overlays usePreventScroll.\n */\n\nimport { createEffect, onCleanup } from 'solid-js';\nimport { isIOS, getScrollParent, isScrollable, willOpenKeyboard, chain } from '../utils';\n\nexport interface PreventScrollOptions {\n /** Whether the scroll lock is disabled. */\n isDisabled?: boolean;\n}\n\nconst visualViewport = typeof document !== 'undefined' && window.visualViewport;\n\n// The number of active createPreventScroll calls. Used to determine whether to revert back to the original page style/scroll position\nlet preventScrollCount = 0;\nlet restore: (() => void) | undefined;\n\n/**\n * Prevents scrolling on the document body on mount, and\n * restores it on unmount. Also ensures that content does not\n * shift due to the scrollbars disappearing.\n */\nexport function createPreventScroll(options: PreventScrollOptions = {}): void {\n createEffect(() => {\n const isDisabled = options.isDisabled;\n\n if (isDisabled) {\n return;\n }\n\n preventScrollCount++;\n if (preventScrollCount === 1) {\n if (isIOS()) {\n restore = preventScrollMobileSafari();\n } else {\n restore = preventScrollStandard();\n }\n }\n\n onCleanup(() => {\n preventScrollCount--;\n if (preventScrollCount === 0 && restore) {\n restore();\n restore = undefined;\n }\n });\n });\n}\n\n// For most browsers, all we need to do is set `overflow: hidden` on the root element, and\n// add some padding to prevent the page from shifting when the scrollbar is hidden.\nfunction preventScrollStandard(): () => void {\n const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;\n const restoreFns: Array<() => void> = [];\n\n if (scrollbarWidth > 0) {\n // Use scrollbar-gutter when supported because it also works for fixed positioned elements.\n if ('scrollbarGutter' in document.documentElement.style) {\n restoreFns.push(setStyle(document.documentElement, 'scrollbarGutter', 'stable'));\n } else {\n restoreFns.push(setStyle(document.documentElement, 'paddingRight', `${scrollbarWidth}px`));\n }\n }\n\n restoreFns.push(setStyle(document.documentElement, 'overflow', 'hidden'));\n\n return () => {\n restoreFns.forEach((fn) => fn());\n };\n}\n\n// Mobile Safari is a whole different beast. Even with overflow: hidden,\n// it still scrolls the page in many situations:\n//\n// 1. When the bottom toolbar and address bar are collapsed, page scrolling is always allowed.\n// 2. When the keyboard is visible, the viewport does not resize. Instead, the keyboard covers part of\n// it, so it becomes scrollable.\n// 3. When tapping on an input, the page always scrolls so that the input is centered in the visual viewport.\n// This may cause even fixed position elements to scroll off the screen.\n// 4. When using the next/previous buttons in the keyboard to navigate between inputs, the whole page always\n// scrolls, even if the input is inside a nested scrollable element that could be scrolled instead.\n//\n// In order to work around these cases, and prevent scrolling without jankiness, we do a few things:\n//\n// 1. Prevent default on `touchmove` events that are not in a scrollable element. This prevents touch scrolling\n// on the window.\n// 2. Set `overscroll-behavior: contain` on nested scrollable regions so they do not scroll the page when at\n// the top or bottom. Work around a bug where this does not work when the element does not actually overflow\n// by preventing default in a `touchmove` event. This is best effort: we can't prevent default when pinch\n// zooming or when an element contains text selection, which may allow scrolling in some cases.\n// 3. Prevent default on `touchend` events on input elements and handle focusing the element ourselves.\n// 4. When focus moves to an input, create an off screen input and focus that temporarily. This prevents\n// Safari from scrolling the page. After a small delay, focus the real input and scroll it into view\n// ourselves, without scrolling the whole page.\nfunction preventScrollMobileSafari(): () => void {\n let scrollable: Element;\n let allowTouchMove = false;\n\n const onTouchStart = (e: TouchEvent) => {\n // Store the nearest scrollable parent element from the element that the user touched.\n const target = e.target as Element;\n scrollable = isScrollable(target) ? target : getScrollParent(target, true);\n allowTouchMove = false;\n\n // If the target is selected, don't preventDefault in touchmove to allow user to adjust selection.\n const selection = target.ownerDocument.defaultView!.getSelection();\n if (selection && !selection.isCollapsed && selection.containsNode(target, true)) {\n allowTouchMove = true;\n }\n\n // If this is a focused input element with a selected range, allow user to drag the selection handles.\n if (\n 'selectionStart' in target &&\n 'selectionEnd' in target &&\n (target.selectionStart as number) < (target.selectionEnd as number) &&\n target.ownerDocument.activeElement === target\n ) {\n allowTouchMove = true;\n }\n };\n\n // Prevent scrolling up when at the top and scrolling down when at the bottom\n // of a nested scrollable area, otherwise mobile Safari will start scrolling\n // the window instead.\n // This must be applied before the touchstart event as of iOS 26, so inject it as a <style> element.\n const style = document.createElement('style');\n style.textContent = `\n@layer {\n * {\n overscroll-behavior: contain;\n }\n}`.trim();\n document.head.prepend(style);\n\n const onTouchMove = (e: TouchEvent) => {\n // Allow pinch-zooming.\n if (e.touches.length === 2 || allowTouchMove) {\n return;\n }\n\n // Prevent scrolling the window.\n if (!scrollable || scrollable === document.documentElement || scrollable === document.body) {\n e.preventDefault();\n return;\n }\n\n // overscroll-behavior should prevent scroll chaining, but currently does not\n // if the element doesn't actually overflow. https://bugs.webkit.org/show_bug.cgi?id=243452\n // This checks that both the width and height do not overflow, otherwise we might\n // block horizontal scrolling too. In that case, adding `touch-action: pan-x` to\n // the element will prevent vertical page scrolling. We can't add that automatically\n // because it must be set before the touchstart event.\n if (scrollable.scrollHeight === scrollable.clientHeight && scrollable.scrollWidth === scrollable.clientWidth) {\n e.preventDefault();\n }\n };\n\n const onBlur = (e: FocusEvent) => {\n const target = e.target as HTMLElement;\n const relatedTarget = e.relatedTarget as HTMLElement | null;\n if (relatedTarget && willOpenKeyboard(relatedTarget)) {\n // Focus without scrolling the whole page, and then scroll into view manually.\n relatedTarget.focus({ preventScroll: true });\n scrollIntoViewWhenReady(relatedTarget, willOpenKeyboard(target));\n } else if (!relatedTarget) {\n // When tapping the Done button on the keyboard, focus moves to the body.\n // FocusScope will then restore focus back to the input. Later when tapping\n // the same input again, it is already focused, so no blur event will fire,\n // resulting in the flow above never running and Safari's native scrolling occurring.\n // Instead, move focus to the parent focusable element (e.g. the dialog).\n const focusable = target.parentElement?.closest('[tabindex]') as HTMLElement | null;\n focusable?.focus({ preventScroll: true });\n }\n };\n\n // Override programmatic focus to scroll into view without scrolling the whole page.\n const focus = HTMLElement.prototype.focus;\n HTMLElement.prototype.focus = function (opts) {\n // Track whether the keyboard was already visible before.\n const wasKeyboardVisible = document.activeElement != null && willOpenKeyboard(document.activeElement);\n\n // Focus the element without scrolling the page.\n focus.call(this, { ...opts, preventScroll: true });\n\n if (!opts || !opts.preventScroll) {\n scrollIntoViewWhenReady(this, wasKeyboardVisible);\n }\n };\n\n const removeEvents = chain(\n addEvent(document, 'touchstart', onTouchStart, { passive: false, capture: true }),\n addEvent(document, 'touchmove', onTouchMove, { passive: false, capture: true }),\n addEvent(document, 'blur', onBlur, true)\n );\n\n return () => {\n removeEvents();\n style.remove();\n HTMLElement.prototype.focus = focus;\n };\n}\n\n// Sets a CSS property on an element, and returns a function to revert it to the previous value.\nfunction setStyle(element: HTMLElement, styleName: string, value: string): () => void {\n const cur = element.style.getPropertyValue(styleName) || (element.style as unknown as Record<string, string>)[styleName];\n (element.style as unknown as Record<string, string>)[styleName] = value;\n\n return () => {\n (element.style as unknown as Record<string, string>)[styleName] = cur;\n };\n}\n\n// Adds an event listener to an element, and returns a function to remove it.\nfunction addEvent<K extends keyof GlobalEventHandlersEventMap>(\n target: Document | Window,\n event: K,\n handler: (this: Document | Window, ev: GlobalEventHandlersEventMap[K]) => void,\n options?: boolean | AddEventListenerOptions\n): () => void {\n target.addEventListener(event, handler as EventListener, options);\n return () => {\n target.removeEventListener(event, handler as EventListener, options);\n };\n}\n\nfunction scrollIntoViewWhenReady(target: Element, wasKeyboardVisible: boolean): void {\n if (wasKeyboardVisible || !visualViewport) {\n // If the keyboard was already visible, scroll the target into view immediately.\n scrollIntoView(target);\n } else {\n // Otherwise, wait for the visual viewport to resize before scrolling so we can\n // measure the correct position to scroll to.\n visualViewport.addEventListener('resize', () => scrollIntoView(target), { once: true });\n }\n}\n\nfunction scrollIntoView(target: Element): void {\n const root = document.scrollingElement || document.documentElement;\n let nextTarget: Element | null = target;\n while (nextTarget && nextTarget !== root) {\n // Find the parent scrollable element and adjust the scroll position if the target is not already in view.\n const scrollableParent = getScrollParent(nextTarget);\n if (scrollableParent !== document.documentElement && scrollableParent !== document.body && scrollableParent !== nextTarget) {\n const scrollableRect = scrollableParent.getBoundingClientRect();\n const targetRect = nextTarget.getBoundingClientRect();\n if (targetRect.top < scrollableRect.top || targetRect.bottom > scrollableRect.top + nextTarget.clientHeight) {\n let bottom = scrollableRect.bottom;\n if (visualViewport) {\n bottom = Math.min(bottom, visualViewport.offsetTop + visualViewport.height);\n }\n\n // Center within the viewport.\n const adjustment = (targetRect.top - scrollableRect.top) - ((bottom - scrollableRect.top) / 2 - targetRect.height / 2);\n scrollableParent.scrollTo({\n // Clamp to the valid range to prevent over-scrolling.\n top: Math.max(0, Math.min(scrollableParent.scrollHeight - scrollableParent.clientHeight, scrollableParent.scrollTop + adjustment)),\n behavior: 'smooth'\n });\n }\n }\n\n nextTarget = scrollableParent.parentElement;\n }\n}\n", "/**\n * Handles the behavior and accessibility for an overlay trigger.\n * Based on @react-aria/overlays useOverlayTrigger.\n */\n\nimport { createEffect } from 'solid-js';\nimport type { OverlayTriggerState } from '@proyecto-viviana/solid-stately';\nimport { createId } from '../ssr';\nimport { access, type MaybeAccessor } from '../utils';\n\nexport interface OverlayTriggerProps {\n /** Type of overlay that is opened by the trigger. */\n type: 'dialog' | 'menu' | 'listbox' | 'tree' | 'grid';\n}\n\nexport interface OverlayTriggerAria {\n /** Props for the trigger element. */\n triggerProps: {\n 'aria-haspopup'?: boolean | 'listbox';\n 'aria-expanded': boolean;\n 'aria-controls'?: string;\n onPress: () => void;\n };\n /** Props for the overlay container element. */\n overlayProps: {\n id: string;\n };\n}\n\n// Map for storing close functions, used by useCloseOnScroll\nexport const onCloseMap = new WeakMap<Element, () => void>();\n\n/**\n * Handles the behavior and accessibility for an overlay trigger, e.g. a button\n * that opens a popover, menu, or other overlay that is positioned relative to the trigger.\n */\nexport function createOverlayTrigger(\n props: MaybeAccessor<OverlayTriggerProps>,\n state: OverlayTriggerState,\n ref?: () => Element | null\n): OverlayTriggerAria {\n const propsAccessor = () => access(props);\n const overlayId = createId();\n\n // Backward compatibility. Share state close function with useOverlayPosition so it can close on scroll\n // without forcing users to pass onClose.\n createEffect(() => {\n const element = ref?.();\n if (element) {\n onCloseMap.set(element, state.close);\n }\n });\n\n // Aria 1.1 supports multiple values for aria-haspopup other than just menus.\n // https://www.w3.org/TR/wai-aria-1.1/#aria-haspopup\n // However, we only add it for menus for now because screen readers often\n // announce it as a menu even for other values.\n const getAriaHasPopup = (): boolean | 'listbox' | undefined => {\n const type = propsAccessor().type;\n if (type === 'menu') {\n return true;\n } else if (type === 'listbox') {\n return 'listbox';\n }\n return undefined;\n };\n\n return {\n triggerProps: {\n get 'aria-haspopup'() {\n return getAriaHasPopup();\n },\n get 'aria-expanded'() {\n return state.isOpen();\n },\n get 'aria-controls'() {\n return state.isOpen() ? overlayId : undefined;\n },\n onPress: state.toggle,\n },\n overlayProps: {\n id: overlayId,\n },\n };\n}\n", "/**\n * Provides the behavior for overlays such as dialogs, popovers, and menus.\n * Based on @react-aria/overlays useOverlay.\n */\n\nimport { createEffect, onCleanup, type JSX } from 'solid-js';\nimport { createInteractOutside } from './createInteractOutside';\nimport { createFocusWithin } from '../interactions/createFocusWithin';\n\nexport interface AriaOverlayProps {\n /** Whether the overlay is currently open. */\n isOpen?: boolean;\n /** Handler that is called when the overlay should close. */\n onClose?: () => void;\n /**\n * Whether to close the overlay when the user interacts outside it.\n * @default false\n */\n isDismissable?: boolean;\n /** Whether the overlay should close when focus is lost or moves outside it. */\n shouldCloseOnBlur?: boolean;\n /**\n * Whether pressing the escape key to close the overlay should be disabled.\n * @default false\n */\n isKeyboardDismissDisabled?: boolean;\n /**\n * When user interacts with the argument element outside of the overlay ref,\n * return true if onClose should be called. This gives you a chance to filter\n * out interaction with elements that should not dismiss the overlay.\n * By default, onClose will always be called on interaction outside the overlay ref.\n */\n shouldCloseOnInteractOutside?: (element: Element) => boolean;\n}\n\nexport interface OverlayAria {\n /** Props to apply to the overlay container element. */\n overlayProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props to apply to the underlay element, if any. */\n underlayProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n// Stack of visible overlays, used to ensure only topmost overlay closes\nconst visibleOverlays: Array<() => Element | null> = [];\n\n/**\n * Provides the behavior for overlays such as dialogs, popovers, and menus.\n * Hides the overlay when the user interacts outside it, when the Escape key is pressed,\n * or optionally, on blur. Only the top-most overlay will close at once.\n */\nexport function createOverlay(\n props: AriaOverlayProps,\n ref: () => Element | null\n): OverlayAria {\n const {\n onClose,\n shouldCloseOnBlur,\n isOpen,\n isDismissable = false,\n isKeyboardDismissDisabled = false,\n shouldCloseOnInteractOutside,\n } = props;\n\n // Add the overlay ref to the stack of visible overlays on mount, and remove on unmount.\n createEffect(() => {\n if (isOpen && !visibleOverlays.includes(ref)) {\n visibleOverlays.push(ref);\n }\n\n onCleanup(() => {\n const index = visibleOverlays.indexOf(ref);\n if (index >= 0) {\n visibleOverlays.splice(index, 1);\n }\n });\n });\n\n // Only hide the overlay when it is the topmost visible overlay in the stack\n const onHide = () => {\n if (visibleOverlays[visibleOverlays.length - 1] === ref && onClose) {\n onClose();\n }\n };\n\n const onInteractOutsideStart = (e: PointerEvent) => {\n if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.target as Element)) {\n if (visibleOverlays[visibleOverlays.length - 1] === ref) {\n e.stopPropagation();\n e.preventDefault();\n }\n }\n };\n\n const onInteractOutside = (e: PointerEvent) => {\n if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.target as Element)) {\n if (visibleOverlays[visibleOverlays.length - 1] === ref) {\n e.stopPropagation();\n e.preventDefault();\n }\n onHide();\n }\n };\n\n // Handle clicking outside the overlay to close it\n createInteractOutside({\n ref,\n onInteractOutside: isDismissable && isOpen ? onInteractOutside : undefined,\n onInteractOutsideStart,\n isDisabled: !isDismissable || !isOpen,\n });\n\n // Handle focus within for blur detection\n const { focusWithinProps } = createFocusWithin({\n isDisabled: !shouldCloseOnBlur,\n onBlurWithin: (e) => {\n // Do not close if relatedTarget is null, which means focus is lost to the body.\n // That can happen when switching tabs, or due to a browser bug.\n // Clicking on the body to close the overlay should already be handled by createInteractOutside.\n if (!e.relatedTarget) {\n return;\n }\n\n if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.relatedTarget as Element)) {\n onClose?.();\n }\n },\n });\n\n // Handle the escape key\n const onKeyDown: JSX.EventHandler<HTMLElement, KeyboardEvent> = (e) => {\n if (e.key === 'Escape' && !isKeyboardDismissDisabled && !(e as any).nativeEvent?.isComposing) {\n e.stopPropagation();\n e.preventDefault();\n onHide();\n }\n };\n\n const onPointerDownUnderlay: JSX.EventHandler<HTMLElement, PointerEvent> = (e) => {\n // Fixes a Firefox issue that starts text selection\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1675846\n if (e.target === e.currentTarget) {\n e.preventDefault();\n }\n };\n\n return {\n overlayProps: {\n onKeyDown,\n ...focusWithinProps,\n },\n underlayProps: {\n onPointerDown: onPointerDownUnderlay,\n },\n };\n}\n", "/**\n * Detects interactions outside a given element.\n * Based on @react-aria/interactions useInteractOutside.\n */\n\nimport { createEffect, onCleanup } from 'solid-js';\nimport { getOwnerDocument } from '../utils';\n\nexport interface InteractOutsideProps {\n /** Reference to the element to detect interactions outside of. */\n ref: () => Element | null;\n /** Handler called when an interaction outside the element completes. */\n onInteractOutside?: (e: PointerEvent) => void;\n /** Handler called when an interaction outside the element starts. */\n onInteractOutsideStart?: (e: PointerEvent) => void;\n /** Whether the interact outside events should be disabled. */\n isDisabled?: boolean;\n}\n\n/**\n * Detects interactions outside a given element, used in components like\n * Dialogs and Popovers so they can close when a user clicks outside them.\n */\nexport function createInteractOutside(props: InteractOutsideProps): void {\n let isPointerDown = false;\n let ignoreEmulatedMouseEvents = false;\n\n createEffect(() => {\n const { ref, onInteractOutside, onInteractOutsideStart, isDisabled } = props;\n\n if (isDisabled) {\n return;\n }\n\n const element = ref();\n const documentObject = getOwnerDocument(element);\n\n const onPointerDown = (e: PointerEvent) => {\n if (onInteractOutside && isValidEvent(e, ref)) {\n if (onInteractOutsideStart) {\n onInteractOutsideStart(e);\n }\n isPointerDown = true;\n }\n };\n\n const triggerInteractOutside = (e: PointerEvent) => {\n if (onInteractOutside) {\n onInteractOutside(e);\n }\n };\n\n // Use pointer events if available. Otherwise, fall back to mouse and touch events.\n if (typeof PointerEvent !== 'undefined') {\n const onClick = (e: PointerEvent) => {\n if (isPointerDown && isValidEvent(e, ref)) {\n triggerInteractOutside(e);\n }\n isPointerDown = false;\n };\n\n // Use click instead of pointerup to avoid Android Chrome issue\n // https://issues.chromium.org/issues/40732224\n documentObject.addEventListener('pointerdown', onPointerDown as EventListener, true);\n documentObject.addEventListener('click', onClick as EventListener, true);\n\n onCleanup(() => {\n documentObject.removeEventListener('pointerdown', onPointerDown as EventListener, true);\n documentObject.removeEventListener('click', onClick as EventListener, true);\n });\n } else {\n // Fallback for environments without PointerEvent (mainly tests)\n const onMouseUp = (e: MouseEvent) => {\n if (ignoreEmulatedMouseEvents) {\n ignoreEmulatedMouseEvents = false;\n } else if (isPointerDown && isValidEvent(e as unknown as PointerEvent, ref)) {\n triggerInteractOutside(e as unknown as PointerEvent);\n }\n isPointerDown = false;\n };\n\n const onTouchEnd = (e: TouchEvent) => {\n ignoreEmulatedMouseEvents = true;\n if (isPointerDown && isValidEvent(e as unknown as PointerEvent, ref)) {\n triggerInteractOutside(e as unknown as PointerEvent);\n }\n isPointerDown = false;\n };\n\n const onMouseDown = (e: MouseEvent) => {\n if (onInteractOutside && isValidEvent(e as unknown as PointerEvent, ref)) {\n if (onInteractOutsideStart) {\n onInteractOutsideStart(e as unknown as PointerEvent);\n }\n isPointerDown = true;\n }\n };\n\n const onTouchStart = (e: TouchEvent) => {\n if (onInteractOutside && isValidEvent(e as unknown as PointerEvent, ref)) {\n if (onInteractOutsideStart) {\n onInteractOutsideStart(e as unknown as PointerEvent);\n }\n isPointerDown = true;\n }\n };\n\n documentObject.addEventListener('mousedown', onMouseDown as EventListener, true);\n documentObject.addEventListener('mouseup', onMouseUp as EventListener, true);\n documentObject.addEventListener('touchstart', onTouchStart as EventListener, true);\n documentObject.addEventListener('touchend', onTouchEnd as EventListener, true);\n\n onCleanup(() => {\n documentObject.removeEventListener('mousedown', onMouseDown as EventListener, true);\n documentObject.removeEventListener('mouseup', onMouseUp as EventListener, true);\n documentObject.removeEventListener('touchstart', onTouchStart as EventListener, true);\n documentObject.removeEventListener('touchend', onTouchEnd as EventListener, true);\n });\n }\n });\n}\n\nfunction isValidEvent(event: PointerEvent | MouseEvent | TouchEvent, ref: () => Element | null): boolean {\n // Only handle primary button clicks\n if ('button' in event && event.button > 0) {\n return false;\n }\n\n if (event.target) {\n // If the event target is no longer in the document, ignore\n const ownerDocument = (event.target as Element).ownerDocument;\n if (!ownerDocument || !ownerDocument.documentElement.contains(event.target as Node)) {\n return false;\n }\n // If the target is within a top layer element (e.g. toasts), ignore\n if ((event.target as Element).closest?.('[data-solidaria-top-layer]')) {\n return false;\n }\n }\n\n const element = ref();\n if (!element) {\n return false;\n }\n\n // When the event source is inside a Shadow DOM, event.target is just the shadow root.\n // Using event.composedPath instead means we can get the actual element inside the shadow root.\n return !event.composedPath().includes(element);\n}\n", "/**\n * Hides all elements in the DOM outside the given targets from screen readers.\n * Based on @react-aria/overlays ariaHideOutside.\n */\n\nimport { getOwnerWindow } from '../utils';\n\nconst supportsInert = typeof HTMLElement !== 'undefined' && 'inert' in HTMLElement.prototype;\n\nexport interface AriaHideOutsideOptions {\n /** The root element to start hiding from. */\n root?: Element;\n /** Whether to use the `inert` attribute instead of `aria-hidden`. */\n shouldUseInert?: boolean;\n}\n\n// Keeps a ref count of all hidden elements. Added to when hiding an element, and\n// subtracted from when showing it again. When it reaches zero, aria-hidden is removed.\nconst refCountMap = new WeakMap<Element, number>();\n\ninterface ObserverWrapper {\n visibleNodes: Set<Element>;\n hiddenNodes: Set<Element>;\n observe: () => void;\n disconnect: () => void;\n}\n\nconst observerStack: ObserverWrapper[] = [];\n\n/**\n * Hides all elements in the DOM outside the given targets from screen readers using aria-hidden,\n * and returns a function to revert these changes. In addition, changes to the DOM are watched\n * and new elements outside the targets are automatically hidden.\n * @param targets - The elements that should remain visible.\n * @param options - Options for hiding behavior.\n * @returns - A function to restore all hidden elements.\n */\nexport function ariaHideOutside(\n targets: Element[],\n options?: AriaHideOutsideOptions | Element\n): () => void {\n const windowObj = getOwnerWindow(targets?.[0]);\n const opts = options instanceof windowObj.Element ? { root: options } : options;\n const root = opts?.root ?? document.body;\n const shouldUseInert = opts?.shouldUseInert && supportsInert;\n const visibleNodes = new Set<Element>(targets);\n const hiddenNodes = new Set<Element>();\n\n const getHidden = (element: Element): boolean => {\n return shouldUseInert && element instanceof windowObj.HTMLElement\n ? element.inert\n : element.getAttribute('aria-hidden') === 'true';\n };\n\n const setHidden = (element: Element, hidden: boolean): void => {\n if (shouldUseInert && element instanceof windowObj.HTMLElement) {\n element.inert = hidden;\n } else if (hidden) {\n element.setAttribute('aria-hidden', 'true');\n } else {\n element.removeAttribute('aria-hidden');\n if (element instanceof windowObj.HTMLElement) {\n // We only ever call setHidden with hidden = false when the nodeCount is 1 aka\n // we are trying to make the element visible to screen readers again, so remove inert as well\n element.inert = false;\n }\n }\n };\n\n const hide = (node: Element): void => {\n let refCount = refCountMap.get(node) ?? 0;\n\n // If already aria-hidden, and the ref count is zero, then this element\n // was already hidden and there's nothing for us to do.\n if (getHidden(node) && refCount === 0) {\n return;\n }\n\n if (refCount === 0) {\n setHidden(node, true);\n }\n\n hiddenNodes.add(node);\n refCountMap.set(node, refCount + 1);\n };\n\n const walk = (walkRoot: Element): void => {\n // Keep live announcer and top layer elements (e.g. toasts) visible.\n for (const element of walkRoot.querySelectorAll('[data-live-announcer], [data-solidaria-top-layer]')) {\n visibleNodes.add(element);\n }\n\n const acceptNode = (node: Element): number => {\n // Skip this node and its children if it is one of the target nodes, or a live announcer.\n // Also skip children of already hidden nodes, as aria-hidden is recursive. An exception is\n // made for elements with role=\"row\" since VoiceOver on iOS has issues hiding elements with role=\"row\".\n // For that case we want to hide the cells inside as well (https://bugs.webkit.org/show_bug.cgi?id=222623).\n if (\n hiddenNodes.has(node) ||\n visibleNodes.has(node) ||\n (node.parentElement && hiddenNodes.has(node.parentElement) && node.parentElement.getAttribute('role') !== 'row')\n ) {\n return NodeFilter.FILTER_REJECT;\n }\n\n // Skip this node but continue to children if one of the targets is inside the node.\n for (const target of visibleNodes) {\n if (node.contains(target)) {\n return NodeFilter.FILTER_SKIP;\n }\n }\n\n return NodeFilter.FILTER_ACCEPT;\n };\n\n const walker = document.createTreeWalker(walkRoot, NodeFilter.SHOW_ELEMENT, { acceptNode });\n\n // TreeWalker does not include the root.\n const acceptRoot = acceptNode(walkRoot);\n if (acceptRoot === NodeFilter.FILTER_ACCEPT) {\n hide(walkRoot);\n }\n\n if (acceptRoot !== NodeFilter.FILTER_REJECT) {\n let node = walker.nextNode() as Element;\n while (node != null) {\n hide(node);\n node = walker.nextNode() as Element;\n }\n }\n };\n\n // If there is already a MutationObserver listening from a previous call,\n // disconnect it so the new one takes over.\n if (observerStack.length) {\n observerStack[observerStack.length - 1].disconnect();\n }\n\n walk(root);\n\n const observer = new MutationObserver((changes) => {\n for (const change of changes) {\n if (change.type !== 'childList') {\n continue;\n }\n\n // If the parent element of the added nodes is not within one of the targets,\n // and not already inside a hidden node, hide all of the new children.\n if (![...visibleNodes, ...hiddenNodes].some((node) => node.contains(change.target))) {\n for (const node of change.addedNodes) {\n if (\n (node instanceof HTMLElement || node instanceof SVGElement) &&\n (node.dataset.liveAnnouncer === 'true' || node.dataset.solidariaTopLayer === 'true')\n ) {\n visibleNodes.add(node);\n } else if (node instanceof Element) {\n walk(node);\n }\n }\n }\n }\n });\n\n observer.observe(root, { childList: true, subtree: true });\n\n const observerWrapper: ObserverWrapper = {\n visibleNodes,\n hiddenNodes,\n observe() {\n observer.observe(root, { childList: true, subtree: true });\n },\n disconnect() {\n observer.disconnect();\n },\n };\n\n observerStack.push(observerWrapper);\n\n return (): void => {\n observer.disconnect();\n\n for (const node of hiddenNodes) {\n const count = refCountMap.get(node);\n if (count == null) {\n continue;\n }\n if (count === 1) {\n setHidden(node, false);\n refCountMap.delete(node);\n } else {\n refCountMap.set(node, count - 1);\n }\n }\n\n // Remove this observer from the stack, and start the previous one.\n if (observerWrapper === observerStack[observerStack.length - 1]) {\n observerStack.pop();\n if (observerStack.length) {\n observerStack[observerStack.length - 1].observe();\n }\n } else {\n observerStack.splice(observerStack.indexOf(observerWrapper), 1);\n }\n };\n}\n\n/**\n * Keeps an element visible when aria-hiding is active.\n * Used for elements like live regions that should remain accessible.\n */\nexport function keepVisible(element: Element): (() => void) | undefined {\n const observer = observerStack[observerStack.length - 1];\n if (observer && !observer.visibleNodes.has(element)) {\n observer.visibleNodes.add(element);\n return () => {\n observer.visibleNodes.delete(element);\n };\n }\n}\n", "/**\n * Modal context and hooks for managing modal accessibility.\n * Based on @react-aria/overlays useModal.\n */\n\nimport {\n createContext,\n createSignal,\n useContext,\n createEffect,\n onCleanup,\n type JSX,\n type Accessor,\n type ParentComponent,\n} from 'solid-js';\nimport { Portal } from 'solid-js/web';\nimport { isServer } from 'solid-js/web';\n\nexport interface ModalProviderProps {\n children: JSX.Element;\n}\n\ninterface ModalContext {\n parent: ModalContext | null;\n modalCount: Accessor<number>;\n addModal: () => void;\n removeModal: () => void;\n}\n\nconst ModalContext = createContext<ModalContext | null>(null);\n\n/**\n * Each ModalProvider tracks how many modals are open in its subtree. On mount, the modals\n * trigger `addModal` to increment the count, and trigger `removeModal` on unmount to decrement it.\n * This is done recursively so that all parent providers are incremented and decremented.\n * If the modal count is greater than zero, we add `aria-hidden` to this provider to hide its\n * subtree from screen readers. This is done using SolidJS context in order to account for things\n * like portals, which can cause the component tree and the DOM tree to differ significantly in structure.\n */\nexport const ModalProvider: ParentComponent<ModalProviderProps> = (props) => {\n const parent = useContext(ModalContext);\n const [modalCount, setModalCount] = createSignal(0);\n\n const context: ModalContext = {\n parent,\n modalCount,\n addModal() {\n setModalCount((count) => count + 1);\n if (parent) {\n parent.addModal();\n }\n },\n removeModal() {\n setModalCount((count) => count - 1);\n if (parent) {\n parent.removeModal();\n }\n },\n };\n\n return (\n <ModalContext.Provider value={context}>\n {props.children}\n </ModalContext.Provider>\n );\n};\n\nexport interface ModalProviderAria {\n /** Props to be spread on the container element. */\n modalProviderProps: {\n 'aria-hidden'?: true;\n };\n}\n\n/**\n * Used to determine if the tree should be aria-hidden based on how many\n * modals are open.\n */\nexport function useModalProvider(): ModalProviderAria {\n const context = useContext(ModalContext);\n return {\n modalProviderProps: {\n get 'aria-hidden'() {\n return context && context.modalCount() > 0 ? true : undefined;\n },\n },\n };\n}\n\n/**\n * Creates a root node that will be aria-hidden if there are other modals open.\n */\nconst OverlayContainerDOM: ParentComponent<ModalProviderProps> = (props) => {\n const { modalProviderProps } = useModalProvider();\n return (\n <div data-overlay-container {...modalProviderProps}>\n {props.children}\n </div>\n );\n};\n\n/**\n * An OverlayProvider acts as a container for the top-level application.\n * Any application that uses modal dialogs or other overlays should\n * be wrapped in a `<OverlayProvider>`. This is used to ensure that\n * the main content of the application is hidden from screen readers\n * if a modal or other overlay is opened. Only the top-most modal or\n * overlay should be accessible at once.\n */\nexport const OverlayProvider: ParentComponent<ModalProviderProps> = (props) => {\n return (\n <ModalProvider>\n <OverlayContainerDOM>{props.children}</OverlayContainerDOM>\n </ModalProvider>\n );\n};\n\nexport interface OverlayContainerProps extends ModalProviderProps {\n /**\n * The container element in which the overlay portal will be placed.\n * @default document.body\n */\n portalContainer?: Element;\n}\n\n/**\n * A container for overlays like modals and popovers. Renders the overlay\n * into a Portal which is placed at the end of the document body.\n * Also ensures that the overlay is hidden from screen readers if a\n * nested modal is opened. Only the top-most modal or overlay should\n * be accessible at once.\n */\nexport const OverlayContainer: ParentComponent<OverlayContainerProps> = (props) => {\n // Don't render portal on server\n if (isServer) {\n return null;\n }\n\n const portalContainer = () => props.portalContainer ?? document.body;\n\n createEffect(() => {\n const container = portalContainer();\n if (container?.closest('[data-overlay-container]')) {\n throw new Error('An OverlayContainer must not be inside another container. Please change the portalContainer prop.');\n }\n });\n\n return (\n <Portal mount={portalContainer()}>\n <OverlayProvider>{props.children}</OverlayProvider>\n </Portal>\n );\n};\n\nexport interface AriaModalOptions {\n /** Whether the modal is disabled. */\n isDisabled?: boolean;\n}\n\nexport interface ModalAria {\n /** Props for the modal content element. */\n modalProps: {\n 'data-ismodal': boolean;\n };\n}\n\n/**\n * Hides content outside the current `<OverlayContainer>` from screen readers\n * on mount and restores it on unmount. Typically used by modal dialogs and\n * other types of overlays to ensure that only the top-most modal is\n * accessible at once.\n */\nexport function createModal(options?: AriaModalOptions): ModalAria {\n // Add aria-hidden to all parent providers on mount, and restore on unmount.\n const context = useContext(ModalContext);\n\n if (!context) {\n throw new Error('Modal is not contained within a provider');\n }\n\n createEffect(() => {\n if (options?.isDisabled || !context.parent) {\n return;\n }\n\n // The immediate context is from the provider containing this modal, so we only\n // want to trigger aria-hidden on its parents not on the modal provider itself.\n context.parent.addModal();\n\n onCleanup(() => {\n if (context.parent) {\n context.parent.removeModal();\n }\n });\n });\n\n return {\n modalProps: {\n 'data-ismodal': !options?.isDisabled,\n },\n };\n}\n", "/**\n * Provides the behavior and accessibility implementation for a listbox component.\n * A listbox displays a list of options and allows a user to select one or more of them.\n * Based on @react-aria/listbox useListBox.\n */\n\nimport { createEffect, onCleanup, type JSX } from 'solid-js';\nimport { createFocusWithin } from '../interactions/createFocusWithin';\nimport { createLabel } from '../label/createLabel';\nimport { createTypeSelect } from '../selection/createTypeSelect';\nimport { filterDOMProps } from '../utils/filterDOMProps';\nimport { mergeProps } from '../utils/mergeProps';\nimport { createId } from '../ssr';\nimport { access, type MaybeAccessor } from '../utils/reactivity';\nimport { isDevEnv } from '../utils/env';\nimport type { ListState, Key } from '@proyecto-viviana/solid-stately';\n\nexport interface AriaListBoxProps {\n /** An ID for the listbox. */\n id?: string;\n /** Whether the listbox is disabled. */\n isDisabled?: boolean;\n /** The label for the listbox. */\n label?: JSX.Element;\n /** An accessible label for the listbox when no visible label is provided. */\n 'aria-label'?: string;\n /** The ID of an element that labels the listbox. */\n 'aria-labelledby'?: string;\n /** The ID of an element that describes the listbox. */\n 'aria-describedby'?: string;\n /** Handler called when focus moves into the listbox. */\n onFocus?: (e: FocusEvent) => void;\n /** Handler called when focus moves out of the listbox. */\n onBlur?: (e: FocusEvent) => void;\n /** Handler called when the focus state changes. */\n onFocusChange?: (isFocused: boolean) => void;\n /** Handler called when an item is activated (pressed). */\n onAction?: (key: Key) => void;\n /** Whether focus should automatically wrap around. */\n shouldFocusWrap?: boolean;\n /** Whether selection should occur on press up. */\n shouldSelectOnPressUp?: boolean;\n /** Whether to focus items on hover. */\n shouldFocusOnHover?: boolean;\n /** Whether type-to-select is disabled. @default false */\n disallowTypeAhead?: boolean;\n}\n\nexport interface ListBoxAria {\n /** Props for the listbox element. */\n listBoxProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the listbox's label element (if any). */\n labelProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n// Shared data between listbox and options\nconst listBoxData = new WeakMap<object, ListBoxData>();\n\ninterface ListBoxData {\n id: string;\n onAction?: (key: Key) => void;\n shouldSelectOnPressUp?: boolean;\n shouldFocusOnHover?: boolean;\n}\n\nexport function getListBoxData(state: ListState): ListBoxData | undefined {\n return listBoxData.get(state);\n}\n\n/**\n * Provides the behavior and accessibility implementation for a listbox component.\n * A listbox displays a list of options and allows a user to select one or more of them.\n */\nexport function createListBox<T>(\n props: MaybeAccessor<AriaListBoxProps>,\n state: ListState<T>,\n _ref?: () => HTMLElement | null\n): ListBoxAria {\n const getProps = () => access(props);\n const id = createId(getProps().id);\n\n // Development-time warning for missing accessibility labels\n if (isDevEnv()) {\n const p = getProps();\n if (!p.label && !p['aria-label'] && !p['aria-labelledby']) {\n console.warn(\n '[solidaria] A ListBox requires an aria-label or aria-labelledby attribute for accessibility.'\n );\n }\n }\n\n // Filter DOM props\n const domProps = () => filterDOMProps(getProps() as unknown as Record<string, unknown>, { labelable: true });\n\n // Share data with child options\n createEffect(() => {\n const p = getProps();\n listBoxData.set(state, {\n id,\n onAction: p.onAction,\n shouldSelectOnPressUp: p.shouldSelectOnPressUp,\n shouldFocusOnHover: p.shouldFocusOnHover,\n });\n\n onCleanup(() => {\n listBoxData.delete(state);\n });\n });\n\n // Handle focus within\n const { focusWithinProps } = createFocusWithin({\n onFocusWithin: (e) => getProps().onFocus?.(e),\n onBlurWithin: (e) => getProps().onBlur?.(e),\n onFocusWithinChange: (isFocused) => {\n getProps().onFocusChange?.(isFocused);\n state.setFocused(isFocused);\n },\n });\n\n // Label handling\n const { labelProps, fieldProps } = createLabel({\n get id() {\n return id;\n },\n get label() {\n return getProps().label;\n },\n get 'aria-label'() {\n return getProps()['aria-label'];\n },\n get 'aria-labelledby'() {\n return getProps()['aria-labelledby'];\n },\n labelElementType: 'span',\n });\n\n // Type-to-select\n const { typeSelectProps } = createTypeSelect({\n collection: () => state.collection(),\n focusedKey: () => state.focusedKey(),\n onFocusedKeyChange: (key) => state.setFocusedKey(key),\n isKeyDisabled: (key) => state.isDisabled(key),\n get isDisabled() {\n return getProps().disallowTypeAhead ?? false;\n },\n });\n\n // Keyboard navigation\n const onKeyDown: JSX.EventHandler<HTMLElement, KeyboardEvent> = (e) => {\n if (getProps().isDisabled) return;\n\n const collection = state.collection();\n\n switch (e.key) {\n case 'ArrowDown': {\n e.preventDefault();\n const currentKey = state.focusedKey();\n const nextKey = currentKey ? collection.getKeyAfter(currentKey) : collection.getFirstKey();\n if (nextKey) {\n state.setFocusedKey(nextKey);\n if (!e.shiftKey && state.selectionMode() === 'single') {\n state.replaceSelection(nextKey);\n } else if (e.shiftKey && state.selectionMode() === 'multiple') {\n state.extendSelection(nextKey, collection);\n }\n }\n break;\n }\n case 'ArrowUp': {\n e.preventDefault();\n const currentKey = state.focusedKey();\n const prevKey = currentKey ? collection.getKeyBefore(currentKey) : collection.getLastKey();\n if (prevKey) {\n state.setFocusedKey(prevKey);\n if (!e.shiftKey && state.selectionMode() === 'single') {\n state.replaceSelection(prevKey);\n } else if (e.shiftKey && state.selectionMode() === 'multiple') {\n state.extendSelection(prevKey, collection);\n }\n }\n break;\n }\n case 'Home': {\n e.preventDefault();\n const firstKey = collection.getFirstKey();\n if (firstKey) {\n state.setFocusedKey(firstKey);\n if (e.ctrlKey && e.shiftKey && state.selectionMode() === 'multiple') {\n // Select from current to first\n state.extendSelection(firstKey, collection);\n } else if (!e.shiftKey && state.selectionMode() === 'single') {\n state.replaceSelection(firstKey);\n }\n }\n break;\n }\n case 'End': {\n e.preventDefault();\n const lastKey = collection.getLastKey();\n if (lastKey) {\n state.setFocusedKey(lastKey);\n if (e.ctrlKey && e.shiftKey && state.selectionMode() === 'multiple') {\n // Select from current to last\n state.extendSelection(lastKey, collection);\n } else if (!e.shiftKey && state.selectionMode() === 'single') {\n state.replaceSelection(lastKey);\n }\n }\n break;\n }\n case ' ':\n case 'Enter': {\n e.preventDefault();\n const focusedKey = state.focusedKey();\n if (focusedKey != null) {\n if (state.selectionMode() !== 'none') {\n state.toggleSelection(focusedKey);\n }\n getProps().onAction?.(focusedKey);\n }\n break;\n }\n case 'a': {\n if (e.ctrlKey && state.selectionMode() === 'multiple') {\n e.preventDefault();\n state.selectAll();\n }\n break;\n }\n case 'Escape': {\n e.preventDefault();\n if (!state.disallowEmptySelection()) {\n state.clearSelection();\n }\n break;\n }\n }\n };\n\n return {\n get labelProps() {\n return labelProps as JSX.HTMLAttributes<HTMLElement>;\n },\n get listBoxProps() {\n const p = getProps();\n const selectionMode = state.selectionMode();\n\n const baseProps = mergeProps(\n domProps(),\n focusWithinProps as Record<string, unknown>,\n fieldProps as Record<string, unknown>,\n {\n role: 'listbox',\n tabIndex: p.isDisabled ? undefined : 0,\n 'aria-disabled': p.isDisabled || undefined,\n 'aria-multiselectable': selectionMode === 'multiple' ? true : undefined,\n onKeyDown,\n }\n );\n\n // Add type-select props if enabled\n if (!p.disallowTypeAhead) {\n return mergeProps(baseProps, typeSelectProps as Record<string, unknown>) as JSX.HTMLAttributes<HTMLElement>;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLElement>;\n },\n };\n}\n", "/**\n * createTypeSelect - Handles typeahead interactions with collections.\n * Based on @react-aria/selection useTypeSelect.\n *\n * Allows users to navigate to items by typing characters that match\n * item text values. Supports multi-character search with debouncing.\n */\n\nimport type { JSX, Accessor } from 'solid-js';\nimport type { Key, Collection, CollectionNode } from '@proyecto-viviana/solid-stately';\n\n/**\n * Controls how long to wait before clearing the typeahead buffer.\n */\nconst TYPEAHEAD_DEBOUNCE_WAIT_MS = 1000; // 1 second\n\nexport interface TypeSelectOptions<T> {\n /** The collection to search through. */\n collection: Accessor<Collection<T>>;\n /** The currently focused key. */\n focusedKey: Accessor<Key | null>;\n /** Callback to set the focused key when a match is found. */\n onFocusedKeyChange: (key: Key) => void;\n /** Callback when an item is focused by typing. */\n onTypeSelect?: (key: Key) => void;\n /** Function to check if a key is disabled. */\n isKeyDisabled?: (key: Key) => boolean;\n /** Whether type-to-select is disabled. */\n isDisabled?: boolean;\n}\n\nexport interface TypeSelectAria {\n /** Props to spread on the collection element. */\n typeSelectProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n// Internal state for tracking the search buffer\ninterface TypeSelectState {\n search: string;\n timeout: ReturnType<typeof setTimeout> | undefined;\n}\n\n/**\n * Get a printable character from a key event.\n * Returns the character if it's a single printable character,\n * or empty string for non-printable keys.\n */\nfunction getStringForKey(key: string): string {\n // If the key is of length 1, it is an ASCII value.\n // Otherwise, if there are no ASCII characters in the key name,\n // it is a Unicode character.\n // See https://www.w3.org/TR/uievents-key/\n if (key.length === 1 || !/^[A-Z]/i.test(key)) {\n return key;\n }\n return '';\n}\n\n/**\n * Search for a key in the collection that matches the search string.\n * Starts searching from the key after `fromKey`, wrapping around if needed.\n */\nfunction getKeyForSearch<T>(\n collection: Collection<T>,\n search: string,\n fromKey: Key | null,\n isKeyDisabled?: (key: Key) => boolean\n): Key | null {\n const searchLower = search.toLowerCase();\n\n // Collect all items in order\n const items: CollectionNode<T>[] = [];\n for (const item of collection) {\n if (item.type === 'item') {\n items.push(item);\n }\n }\n\n if (items.length === 0) return null;\n\n // Find the starting index\n let startIndex = 0;\n if (fromKey != null) {\n const fromIndex = items.findIndex(item => item.key === fromKey);\n if (fromIndex !== -1) {\n // Start searching from the item AFTER the current one\n startIndex = (fromIndex + 1) % items.length;\n }\n }\n\n // Search from startIndex, wrapping around\n for (let i = 0; i < items.length; i++) {\n const index = (startIndex + i) % items.length;\n const item = items[index];\n\n // Skip disabled items\n if (item.isDisabled || (isKeyDisabled && isKeyDisabled(item.key))) {\n continue;\n }\n\n // Check if the text value starts with the search string\n const textValue = item.textValue || '';\n if (textValue.toLowerCase().startsWith(searchLower)) {\n return item.key;\n }\n }\n\n return null;\n}\n\n/**\n * Creates typeahead/type-to-select functionality for a collection.\n *\n * @example\n * ```tsx\n * const { typeSelectProps } = createTypeSelect({\n * collection: () => state.collection(),\n * focusedKey: () => state.focusedKey(),\n * onFocusedKeyChange: (key) => state.setFocusedKey(key),\n * });\n *\n * return <ul {...mergeProps(listBoxProps, typeSelectProps)}>...</ul>;\n * ```\n */\nexport function createTypeSelect<T>(options: TypeSelectOptions<T>): TypeSelectAria {\n // Create mutable state object to persist across keystrokes\n const state: TypeSelectState = {\n search: '',\n timeout: undefined,\n };\n\n const onKeyDownCapture: JSX.EventHandler<HTMLElement, KeyboardEvent> = (e) => {\n if (options.isDisabled) return;\n\n const character = getStringForKey(e.key);\n\n // Ignore non-printable characters, modifier key combos,\n // and events that didn't originate from within the element\n if (\n !character ||\n e.ctrlKey ||\n e.metaKey ||\n e.altKey ||\n !e.currentTarget.contains(e.target as HTMLElement)\n ) {\n return;\n }\n\n // Don't start search with space (common action key)\n if (state.search.length === 0 && character === ' ') {\n return;\n }\n\n // If there's already search text and the user types a space,\n // prevent it from triggering selection and include it in the search\n if (character === ' ' && state.search.trim().length > 0) {\n e.preventDefault();\n e.stopPropagation();\n }\n\n // Append to the search buffer\n state.search += character;\n\n // Find a matching key\n const collection = options.collection();\n const currentKey = options.focusedKey();\n\n // First, try to find a match starting after the current key\n let key = getKeyForSearch(collection, state.search, currentKey, options.isKeyDisabled);\n\n // If no match found, try from the beginning\n if (key == null && currentKey != null) {\n key = getKeyForSearch(collection, state.search, null, options.isKeyDisabled);\n }\n\n if (key != null) {\n options.onFocusedKeyChange(key);\n options.onTypeSelect?.(key);\n }\n\n // Reset the debounce timer\n if (state.timeout !== undefined) {\n clearTimeout(state.timeout);\n }\n state.timeout = setTimeout(() => {\n state.search = '';\n }, TYPEAHEAD_DEBOUNCE_WAIT_MS);\n };\n\n // Handler for bubble phase (used in test environments and as fallback)\n const onKeyDown: JSX.EventHandler<HTMLElement, KeyboardEvent> = onKeyDownCapture;\n\n return {\n typeSelectProps: {\n // Use capture phase to handle spacebar before other handlers in production\n onKeyDownCapture,\n // Also attach to bubble phase for test environments\n onKeyDown,\n } as JSX.HTMLAttributes<HTMLElement>,\n };\n}\n", "/**\n * Provides the behavior and accessibility implementation for an option in a listbox.\n * Based on @react-aria/listbox useOption.\n */\n\nimport { type JSX, type Accessor } from 'solid-js';\nimport { createPress } from '../interactions/createPress';\nimport { createHover } from '../interactions/createHover';\nimport { createFocusRing } from '../interactions/createFocusRing';\nimport { mergeProps } from '../utils/mergeProps';\nimport { access, type MaybeAccessor } from '../utils/reactivity';\nimport { getListBoxData } from './createListBox';\nimport type { ListState, Key } from '@proyecto-viviana/solid-stately';\n\nexport interface AriaOptionProps {\n /** The unique key for the option. */\n key: Key;\n /** Whether the option is disabled. */\n isDisabled?: boolean;\n /** An accessible label for the option. */\n 'aria-label'?: string;\n /** Whether selection should occur on press up. */\n shouldSelectOnPressUp?: boolean;\n /** Whether to focus the option on hover. */\n shouldFocusOnHover?: boolean;\n}\n\nexport interface OptionAria {\n /** Props for the option element. */\n optionProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the label text inside the option. */\n labelProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the description text inside the option. */\n descriptionProps: JSX.HTMLAttributes<HTMLElement>;\n /** Whether the option is currently selected. */\n isSelected: Accessor<boolean>;\n /** Whether the option is currently focused. */\n isFocused: Accessor<boolean>;\n /** Whether the option is keyboard focused. */\n isFocusVisible: Accessor<boolean>;\n /** Whether the option is currently pressed. */\n isPressed: Accessor<boolean>;\n /** Whether the option is disabled. */\n isDisabled: Accessor<boolean>;\n}\n\n/**\n * Provides the behavior and accessibility implementation for an option in a listbox.\n */\nexport function createOption<T>(\n props: MaybeAccessor<AriaOptionProps>,\n state: ListState<T>,\n _ref?: () => HTMLElement | null\n): OptionAria {\n const getProps = () => access(props);\n\n // Get shared data from listbox\n const getData = () => getListBoxData(state);\n\n // Computed states\n const isDisabled: Accessor<boolean> = () => {\n return getProps().isDisabled ?? state.isDisabled(getProps().key);\n };\n\n const isSelected: Accessor<boolean> = () => {\n return state.isSelected(getProps().key);\n };\n\n const isFocused: Accessor<boolean> = () => {\n return state.focusedKey() === getProps().key;\n };\n\n // Handle press\n const { pressProps, isPressed } = createPress({\n get isDisabled() {\n return isDisabled();\n },\n onPress() {\n const key = getProps().key;\n const data = getData();\n\n if (state.selectionMode() !== 'none') {\n state.select(key);\n }\n\n // Call onAction from listbox\n data?.onAction?.(key);\n },\n });\n\n // Handle hover\n const { hoverProps, isHovered } = createHover({\n get isDisabled() {\n return isDisabled();\n },\n onHoverStart() {\n const shouldFocus = getProps().shouldFocusOnHover ?? getData()?.shouldFocusOnHover;\n if (shouldFocus) {\n state.setFocusedKey(getProps().key);\n }\n },\n });\n\n // Handle focus ring\n const { isFocusVisible, focusProps } = createFocusRing();\n\n // Generate unique IDs for label and description\n const labelId = `${getProps().key}-label`;\n const descriptionId = `${getProps().key}-desc`;\n\n return {\n get optionProps() {\n const key = getProps().key;\n const selectionMode = state.selectionMode();\n const ariaLabel = getProps()['aria-label'];\n\n return mergeProps(\n pressProps as Record<string, unknown>,\n hoverProps as Record<string, unknown>,\n focusProps as Record<string, unknown>,\n {\n role: 'option',\n id: String(key),\n 'aria-selected': selectionMode !== 'none' ? isSelected() : undefined,\n 'aria-disabled': isDisabled() || undefined,\n 'aria-label': ariaLabel,\n 'aria-labelledby': !ariaLabel ? labelId : undefined,\n 'aria-describedby': descriptionId,\n tabIndex: isFocused() ? 0 : -1,\n 'data-selected': isSelected() || undefined,\n 'data-focused': isFocused() || undefined,\n 'data-focus-visible': isFocusVisible() || undefined,\n 'data-pressed': isPressed() || undefined,\n 'data-disabled': isDisabled() || undefined,\n 'data-hovered': isHovered() || undefined,\n } as Record<string, unknown>\n ) as JSX.HTMLAttributes<HTMLElement>;\n },\n labelProps: {\n id: labelId,\n },\n descriptionProps: {\n id: descriptionId,\n },\n isSelected,\n isFocused,\n isFocusVisible: () => isFocused() && isFocusVisible(),\n isPressed,\n isDisabled,\n };\n}\n", "/**\n * Provides the behavior and accessibility implementation for a menu component.\n * A menu displays a list of actions or options that a user can choose.\n * Based on @react-aria/menu useMenu.\n */\n\nimport { createEffect, onCleanup, type JSX, type Accessor } from 'solid-js';\nimport { createFocusWithin } from '../interactions/createFocusWithin';\nimport { createLabel } from '../label/createLabel';\nimport { createTypeSelect } from '../selection/createTypeSelect';\nimport { filterDOMProps } from '../utils/filterDOMProps';\nimport { mergeProps } from '../utils/mergeProps';\nimport { createId } from '../ssr';\nimport { access, type MaybeAccessor } from '../utils/reactivity';\nimport { isDevEnv } from '../utils/env';\nimport type { MenuState, Key, Collection } from '@proyecto-viviana/solid-stately';\n\n/**\n * Default number of items to skip for page up/down when DOM measurement is not available.\n */\nconst DEFAULT_PAGE_SIZE = 10;\n\n/**\n * Find the next non-disabled key in a collection.\n */\nfunction findNextNonDisabledKey<T>(\n collection: Collection<T>,\n currentKey: Key | null,\n direction: 'next' | 'prev',\n isDisabled: (key: Key) => boolean,\n wrap: boolean\n): Key | null {\n const getNextKey = direction === 'next'\n ? (key: Key) => collection.getKeyAfter(key)\n : (key: Key) => collection.getKeyBefore(key);\n\n const getFirstKey = direction === 'next'\n ? () => collection.getFirstKey()\n : () => collection.getLastKey();\n\n let nextKey = currentKey != null ? getNextKey(currentKey) : getFirstKey();\n\n // Skip disabled keys\n while (nextKey != null && isDisabled(nextKey)) {\n nextKey = getNextKey(nextKey);\n }\n\n // If we've reached the end and wrapping is enabled\n if (nextKey == null && wrap) {\n nextKey = getFirstKey();\n // Skip disabled keys from the start\n while (nextKey != null && isDisabled(nextKey)) {\n nextKey = getNextKey(nextKey);\n }\n }\n\n return nextKey;\n}\n\nexport interface AriaMenuProps {\n /** An ID for the menu. */\n id?: string;\n /** Whether the menu is disabled. */\n isDisabled?: boolean;\n /** The label for the menu. */\n label?: JSX.Element;\n /** An accessible label for the menu when no visible label is provided. */\n 'aria-label'?: string;\n /** The ID of an element that labels the menu. */\n 'aria-labelledby'?: string;\n /** The ID of an element that describes the menu. */\n 'aria-describedby'?: string;\n /** Handler called when focus moves into the menu. */\n onFocus?: (e: FocusEvent) => void;\n /** Handler called when focus moves out of the menu. */\n onBlur?: (e: FocusEvent) => void;\n /** Handler called when the focus state changes. */\n onFocusChange?: (isFocused: boolean) => void;\n /** Handler called when an item is activated (pressed). */\n onAction?: (key: Key) => void;\n /** Handler called when the menu should close. */\n onClose?: () => void;\n /** Whether focus should automatically wrap around. */\n shouldFocusWrap?: boolean;\n /** Whether to auto-focus the first item when the menu opens. */\n autoFocus?: boolean | 'first' | 'last';\n /** Whether type-to-select is disabled. @default false */\n disallowTypeAhead?: boolean;\n}\n\nexport interface MenuAria {\n /** Props for the menu element. */\n menuProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the menu's label element (if any). */\n labelProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n// Shared data between menu and menu items\nconst menuData = new WeakMap<object, MenuData>();\n\ninterface MenuData {\n id: string;\n onAction?: (key: Key) => void;\n onClose?: () => void;\n}\n\nexport function getMenuData(state: MenuState): MenuData | undefined {\n return menuData.get(state);\n}\n\n/**\n * Provides the behavior and accessibility implementation for a menu component.\n * A menu displays a list of actions or options that a user can choose.\n */\nexport function createMenu<T>(\n props: MaybeAccessor<AriaMenuProps>,\n state: MenuState<T>,\n ref?: Accessor<HTMLElement | null>\n): MenuAria {\n const getProps = () => access(props);\n const id = createId(getProps().id);\n\n // Development-time warning for missing accessibility labels\n if (isDevEnv()) {\n const p = getProps();\n if (!p.label && !p['aria-label'] && !p['aria-labelledby']) {\n console.warn(\n '[solidaria] A Menu requires an aria-label or aria-labelledby attribute for accessibility.'\n );\n }\n }\n\n // Filter DOM props\n const domProps = () => filterDOMProps(getProps() as unknown as Record<string, unknown>, { labelable: true });\n\n // Share data with child menu items\n createEffect(() => {\n const p = getProps();\n menuData.set(state, {\n id,\n onAction: p.onAction,\n onClose: p.onClose,\n });\n\n onCleanup(() => {\n menuData.delete(state);\n });\n });\n\n // Handle focus within\n const { focusWithinProps } = createFocusWithin({\n onFocusWithin: (e) => getProps().onFocus?.(e),\n onBlurWithin: (e) => getProps().onBlur?.(e),\n onFocusWithinChange: (isFocused) => {\n getProps().onFocusChange?.(isFocused);\n state.setFocused(isFocused);\n },\n });\n\n // Label handling\n const { labelProps, fieldProps } = createLabel({\n get id() {\n return id;\n },\n get label() {\n return getProps().label;\n },\n get 'aria-label'() {\n return getProps()['aria-label'];\n },\n get 'aria-labelledby'() {\n return getProps()['aria-labelledby'];\n },\n labelElementType: 'span',\n });\n\n // Type-to-select\n const { typeSelectProps } = createTypeSelect({\n collection: () => state.collection(),\n focusedKey: () => state.focusedKey(),\n onFocusedKeyChange: (key) => state.setFocusedKey(key),\n isKeyDisabled: (key) => state.isDisabled(key),\n get isDisabled() {\n return getProps().disallowTypeAhead ?? false;\n },\n });\n\n // Keyboard navigation\n const onKeyDown: JSX.EventHandler<HTMLElement, KeyboardEvent> = (e) => {\n if (getProps().isDisabled) return;\n\n const collection = state.collection();\n const p = getProps();\n const wrap = p.shouldFocusWrap ?? false;\n\n // Use state.isDisabled which properly checks the disabledKeys accessor\n const isDisabled = (key: Key) => state.isDisabled(key);\n\n switch (e.key) {\n case 'ArrowDown': {\n e.preventDefault();\n const currentKey = state.focusedKey();\n const nextKey = findNextNonDisabledKey(collection, currentKey, 'next', isDisabled, wrap);\n if (nextKey != null) {\n state.setFocusedKey(nextKey);\n }\n break;\n }\n case 'ArrowUp': {\n e.preventDefault();\n const currentKey = state.focusedKey();\n const prevKey = findNextNonDisabledKey(collection, currentKey, 'prev', isDisabled, wrap);\n if (prevKey != null) {\n state.setFocusedKey(prevKey);\n }\n break;\n }\n case 'Home': {\n e.preventDefault();\n // Find first non-disabled key\n let firstKey = collection.getFirstKey();\n while (firstKey != null && isDisabled(firstKey)) {\n firstKey = collection.getKeyAfter(firstKey);\n }\n if (firstKey != null) {\n state.setFocusedKey(firstKey);\n }\n break;\n }\n case 'End': {\n e.preventDefault();\n // Find last non-disabled key\n let lastKey = collection.getLastKey();\n while (lastKey != null && isDisabled(lastKey)) {\n lastKey = collection.getKeyBefore(lastKey);\n }\n if (lastKey != null) {\n state.setFocusedKey(lastKey);\n }\n break;\n }\n case ' ':\n case 'Enter': {\n e.preventDefault();\n const focusedKey = state.focusedKey();\n // Don't activate disabled items\n if (focusedKey != null && !isDisabled(focusedKey)) {\n p.onAction?.(focusedKey);\n p.onClose?.();\n }\n break;\n }\n case 'Escape': {\n e.preventDefault();\n p.onClose?.();\n break;\n }\n case 'PageDown': {\n e.preventDefault();\n const currentKey = state.focusedKey();\n const el = ref?.();\n\n if (el) {\n // Use DOM measurements to calculate how many items fit in a page\n const visibleHeight = el.clientHeight;\n let traveled = 0;\n let targetKey = currentKey;\n\n while (targetKey != null && traveled < visibleHeight) {\n const nextKey = collection.getKeyAfter(targetKey);\n if (nextKey == null) break;\n\n // Try to measure the item height\n const itemElement = el.querySelector(`[data-key=\"${targetKey}\"]`);\n traveled += itemElement?.clientHeight ?? 32;\n\n // Skip disabled items\n if (!isDisabled(nextKey)) {\n targetKey = nextKey;\n } else {\n // Skip over disabled items without counting them\n const afterDisabled = findNextNonDisabledKey(collection, nextKey, 'next', isDisabled, false);\n if (afterDisabled != null) {\n targetKey = afterDisabled;\n } else {\n break;\n }\n }\n }\n\n if (targetKey != null && targetKey !== currentKey) {\n state.setFocusedKey(targetKey);\n }\n } else {\n // Fallback: move by DEFAULT_PAGE_SIZE items\n let count = DEFAULT_PAGE_SIZE;\n let targetKey = currentKey;\n\n while (count > 0 && targetKey != null) {\n const nextKey = findNextNonDisabledKey(collection, targetKey, 'next', isDisabled, false);\n if (nextKey == null) break;\n targetKey = nextKey;\n count--;\n }\n\n if (targetKey != null) {\n state.setFocusedKey(targetKey);\n }\n }\n break;\n }\n case 'PageUp': {\n e.preventDefault();\n const currentKey = state.focusedKey();\n const el = ref?.();\n\n if (el) {\n // Use DOM measurements to calculate how many items fit in a page\n const visibleHeight = el.clientHeight;\n let traveled = 0;\n let targetKey = currentKey;\n\n while (targetKey != null && traveled < visibleHeight) {\n const prevKey = collection.getKeyBefore(targetKey);\n if (prevKey == null) break;\n\n // Try to measure the item height\n const itemElement = el.querySelector(`[data-key=\"${targetKey}\"]`);\n traveled += itemElement?.clientHeight ?? 32;\n\n // Skip disabled items\n if (!isDisabled(prevKey)) {\n targetKey = prevKey;\n } else {\n // Skip over disabled items without counting them\n const beforeDisabled = findNextNonDisabledKey(collection, prevKey, 'prev', isDisabled, false);\n if (beforeDisabled != null) {\n targetKey = beforeDisabled;\n } else {\n break;\n }\n }\n }\n\n if (targetKey != null && targetKey !== currentKey) {\n state.setFocusedKey(targetKey);\n }\n } else {\n // Fallback: move by DEFAULT_PAGE_SIZE items\n let count = DEFAULT_PAGE_SIZE;\n let targetKey = currentKey;\n\n while (count > 0 && targetKey != null) {\n const prevKey = findNextNonDisabledKey(collection, targetKey, 'prev', isDisabled, false);\n if (prevKey == null) break;\n targetKey = prevKey;\n count--;\n }\n\n if (targetKey != null) {\n state.setFocusedKey(targetKey);\n }\n }\n break;\n }\n }\n };\n\n return {\n get labelProps() {\n return labelProps as JSX.HTMLAttributes<HTMLElement>;\n },\n get menuProps() {\n const p = getProps();\n\n const baseProps = mergeProps(\n domProps(),\n focusWithinProps as Record<string, unknown>,\n fieldProps as Record<string, unknown>,\n {\n role: 'menu',\n tabIndex: p.isDisabled ? undefined : 0,\n 'aria-disabled': p.isDisabled || undefined,\n onKeyDown,\n } as Record<string, unknown>\n );\n\n // Add type-select props if enabled\n if (!p.disallowTypeAhead) {\n return mergeProps(baseProps, typeSelectProps as Record<string, unknown>) as JSX.HTMLAttributes<HTMLElement>;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLElement>;\n },\n };\n}\n", "/**\n * Provides the behavior and accessibility implementation for a menu item.\n * Based on @react-aria/menu useMenuItem.\n */\n\nimport { type JSX, type Accessor } from 'solid-js';\nimport { createPress } from '../interactions/createPress';\nimport { createHover } from '../interactions/createHover';\nimport { createFocusRing } from '../interactions/createFocusRing';\nimport { mergeProps } from '../utils/mergeProps';\nimport { access, type MaybeAccessor } from '../utils/reactivity';\nimport { getMenuData } from './createMenu';\nimport type { MenuState, Key } from '@proyecto-viviana/solid-stately';\n\nexport interface AriaMenuItemProps {\n /** The unique key for the menu item. */\n key: Key;\n /** Whether the menu item is disabled. */\n isDisabled?: boolean;\n /** An accessible label for the menu item. */\n 'aria-label'?: string;\n /** Handler called when the menu item is selected. */\n onAction?: () => void;\n /** Whether to close the menu when this item is selected. */\n closeOnSelect?: boolean;\n}\n\nexport interface MenuItemAria {\n /** Props for the menu item element. */\n menuItemProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the label text inside the menu item. */\n labelProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the description text inside the menu item. */\n descriptionProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the keyboard shortcut inside the menu item. */\n keyboardShortcutProps: JSX.HTMLAttributes<HTMLElement>;\n /** Whether the menu item is currently focused. */\n isFocused: Accessor<boolean>;\n /** Whether the menu item is keyboard focused. */\n isFocusVisible: Accessor<boolean>;\n /** Whether the menu item is currently pressed. */\n isPressed: Accessor<boolean>;\n /** Whether the menu item is disabled. */\n isDisabled: Accessor<boolean>;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a menu item.\n */\nexport function createMenuItem<T>(\n props: MaybeAccessor<AriaMenuItemProps>,\n state: MenuState<T>,\n _ref?: () => HTMLElement | null\n): MenuItemAria {\n const getProps = () => access(props);\n\n // Get shared data from menu\n const getData = () => getMenuData(state);\n\n // Computed states\n const isDisabled: Accessor<boolean> = () => {\n return getProps().isDisabled ?? state.isDisabled(getProps().key);\n };\n\n const isFocused: Accessor<boolean> = () => {\n return state.focusedKey() === getProps().key;\n };\n\n // Handle press\n const { pressProps, isPressed } = createPress({\n get isDisabled() {\n return isDisabled();\n },\n onPress() {\n const p = getProps();\n const key = p.key;\n const data = getData();\n\n // Call item-specific onAction\n p.onAction?.();\n\n // Call menu-level onAction\n data?.onAction?.(key);\n\n // Close menu if closeOnSelect is not explicitly false\n if (p.closeOnSelect !== false) {\n data?.onClose?.();\n }\n },\n });\n\n // Handle hover\n const { hoverProps } = createHover({\n get isDisabled() {\n return isDisabled();\n },\n onHoverStart() {\n state.setFocusedKey(getProps().key);\n },\n });\n\n // Handle focus ring\n const { isFocusVisible, focusProps } = createFocusRing();\n\n // Generate unique IDs for label and description\n const labelId = `${getProps().key}-label`;\n const descriptionId = `${getProps().key}-desc`;\n const keyboardId = `${getProps().key}-kbd`;\n\n return {\n get menuItemProps() {\n const key = getProps().key;\n const ariaLabel = getProps()['aria-label'];\n\n return mergeProps(\n pressProps as Record<string, unknown>,\n hoverProps as Record<string, unknown>,\n focusProps as Record<string, unknown>,\n {\n role: 'menuitem',\n id: String(key),\n 'aria-disabled': isDisabled() || undefined,\n 'aria-label': ariaLabel,\n 'aria-labelledby': !ariaLabel ? labelId : undefined,\n 'aria-describedby': descriptionId,\n tabIndex: isFocused() ? 0 : -1,\n 'data-focused': isFocused() || undefined,\n 'data-focus-visible': isFocusVisible() || undefined,\n 'data-pressed': isPressed() || undefined,\n 'data-disabled': isDisabled() || undefined,\n } as Record<string, unknown>\n ) as JSX.HTMLAttributes<HTMLElement>;\n },\n labelProps: {\n id: labelId,\n },\n descriptionProps: {\n id: descriptionId,\n },\n keyboardShortcutProps: {\n id: keyboardId,\n 'aria-hidden': true,\n },\n isFocused,\n isFocusVisible: () => isFocused() && isFocusVisible(),\n isPressed,\n isDisabled,\n };\n}\n", "/**\n * Provides the behavior and accessibility implementation for a menu trigger.\n * Based on @react-aria/menu useMenuTrigger.\n */\n\nimport { type JSX } from 'solid-js';\nimport { createId } from '../ssr';\nimport { access, type MaybeAccessor } from '../utils/reactivity';\nimport type { OverlayTriggerState } from '@proyecto-viviana/solid-stately';\n\nexport interface AriaMenuTriggerProps {\n /** The type of menu that the menu trigger opens. */\n type?: 'menu' | 'listbox';\n /** Whether the menu trigger is disabled. */\n isDisabled?: boolean;\n /** An ID for the menu. */\n id?: string;\n}\n\nexport interface MenuTriggerAria {\n /** Props for the menu trigger button. */\n menuTriggerProps: JSX.HTMLAttributes<HTMLElement> & {\n onPress: () => void;\n onKeyDown: (e: KeyboardEvent) => void;\n };\n /** Props for the menu element. */\n menuProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a menu trigger.\n */\nexport function createMenuTrigger(\n props: MaybeAccessor<AriaMenuTriggerProps>,\n state: OverlayTriggerState\n): MenuTriggerAria {\n const getProps = () => access(props);\n const menuId = createId(getProps().id);\n\n const onPress = () => {\n if (!getProps().isDisabled) {\n state.toggle();\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (getProps().isDisabled) return;\n\n switch (e.key) {\n case 'Enter':\n case ' ':\n case 'ArrowDown': {\n e.preventDefault();\n if (!state.isOpen()) {\n state.open();\n }\n break;\n }\n case 'ArrowUp': {\n e.preventDefault();\n if (!state.isOpen()) {\n state.open();\n }\n break;\n }\n }\n };\n\n return {\n get menuTriggerProps() {\n const p = getProps();\n const type = p.type ?? 'menu';\n const isOpen = state.isOpen();\n\n return {\n 'aria-haspopup': type,\n 'aria-expanded': isOpen,\n 'aria-controls': isOpen ? menuId : undefined,\n 'aria-disabled': p.isDisabled || undefined,\n onPress,\n onKeyDown,\n };\n },\n menuProps: {\n id: menuId,\n },\n };\n}\n", "/**\n * Provides the behavior and accessibility implementation for a select component.\n * A select displays a collapsible list of options and allows a user to select one of them.\n * Based on @react-aria/select useSelect.\n */\n\nimport { type JSX, type Accessor, createEffect, onCleanup } from 'solid-js';\nimport { createPress } from '../interactions/createPress';\nimport { createFocusRing } from '../interactions/createFocusRing';\nimport { createLabel } from '../label/createLabel';\nimport { createTypeSelect } from '../selection/createTypeSelect';\nimport { filterDOMProps } from '../utils/filterDOMProps';\nimport { mergeProps } from '../utils/mergeProps';\nimport { createId } from '../ssr';\nimport { access, type MaybeAccessor } from '../utils/reactivity';\nimport type { SelectState, CollectionNode } from '@proyecto-viviana/solid-stately';\n\nexport interface AriaSelectProps {\n /** An ID for the select. */\n id?: string;\n /** Whether the select is disabled. */\n isDisabled?: boolean;\n /** Whether the select is required. */\n isRequired?: boolean;\n /** The label for the select. */\n label?: JSX.Element;\n /** An accessible label for the select when no visible label is provided. */\n 'aria-label'?: string;\n /** The ID of an element that labels the select. */\n 'aria-labelledby'?: string;\n /** The ID of an element that describes the select. */\n 'aria-describedby'?: string;\n /** Placeholder text when no option is selected. */\n placeholder?: string;\n /** Whether the select should be auto-focused. */\n autoFocus?: boolean;\n /** Handler called when focus moves to the select. */\n onFocus?: (e: FocusEvent) => void;\n /** Handler called when focus moves away from the select. */\n onBlur?: (e: FocusEvent) => void;\n /** Handler called when the focus state changes. */\n onFocusChange?: (isFocused: boolean) => void;\n /** The name of the select, used when submitting an HTML form. */\n name?: string;\n /** Whether type-to-select is disabled. @default false */\n disallowTypeAhead?: boolean;\n}\n\nexport interface SelectAria<T> {\n /** Props for the label element. */\n labelProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the trigger button element. */\n triggerProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the value display element. */\n valueProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the listbox/menu popup. */\n menuProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the description element, if any. */\n descriptionProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the error message element, if any. */\n errorMessageProps: JSX.HTMLAttributes<HTMLElement>;\n /** Whether the select is currently focused. */\n isFocused: Accessor<boolean>;\n /** Whether the select has keyboard focus. */\n isFocusVisible: Accessor<boolean>;\n /** Whether the select is currently open. */\n isOpen: Accessor<boolean>;\n /** The currently selected item. */\n selectedItem: Accessor<CollectionNode<T> | null>;\n}\n\n// Shared data between select and options\nconst selectData = new WeakMap<object, SelectData>();\n\ninterface SelectData {\n id: string;\n}\n\nexport function getSelectData(state: SelectState): SelectData | undefined {\n return selectData.get(state);\n}\n\n/**\n * Provides the behavior and accessibility implementation for a select component.\n */\nexport function createSelect<T>(\n props: MaybeAccessor<AriaSelectProps>,\n state: SelectState<T>,\n _ref?: () => HTMLElement | null\n): SelectAria<T> {\n const getProps = () => access(props);\n const id = createId(getProps().id);\n\n // Generate IDs for associated elements\n const buttonId = `${id}-button`;\n const listBoxId = `${id}-listbox`;\n const valueId = `${id}-value`;\n const descriptionId = `${id}-description`;\n const errorMessageId = `${id}-error`;\n\n // Filter DOM props\n const domProps = () =>\n filterDOMProps(getProps() as unknown as Record<string, unknown>, { labelable: true });\n\n // Share data with child options\n createEffect(() => {\n selectData.set(state, { id });\n\n onCleanup(() => {\n selectData.delete(state);\n });\n });\n\n // Label handling\n const { labelProps, fieldProps } = createLabel({\n get id() {\n return buttonId;\n },\n get label() {\n return getProps().label;\n },\n get 'aria-label'() {\n return getProps()['aria-label'];\n },\n get 'aria-labelledby'() {\n return getProps()['aria-labelledby'];\n },\n labelElementType: 'span',\n });\n\n // Focus ring for keyboard focus styling\n const { isFocusVisible, focusProps } = createFocusRing({\n get autoFocus() {\n return getProps().autoFocus;\n },\n });\n\n // Track focus state\n const isFocused = state.isFocused;\n\n // Handle press on trigger\n const { pressProps } = createPress({\n get isDisabled() {\n return getProps().isDisabled ?? state.isDisabled;\n },\n onPress() {\n state.toggle();\n },\n });\n\n // Helper to find next non-disabled key\n const findNextKey = (fromKey: string | number | null, direction: 'forward' | 'backward'): string | number | null => {\n const collection = state.collection();\n let key = fromKey;\n\n if (key == null) {\n return direction === 'forward' ? collection.getFirstKey() : collection.getLastKey();\n }\n\n const getNext = direction === 'forward'\n ? (k: string | number) => collection.getKeyAfter(k)\n : (k: string | number) => collection.getKeyBefore(k);\n\n let next = getNext(key);\n while (next != null) {\n // Check if item is disabled via state.isKeyDisabled or item.isDisabled\n const isDisabled = state.isKeyDisabled?.(next) || collection.getItem(next)?.isDisabled;\n if (!isDisabled) {\n return next;\n }\n next = getNext(next);\n }\n\n return null;\n };\n\n // Helper to check if key is disabled\n const isKeyDisabled = (key: string | number): boolean => {\n const collection = state.collection();\n return state.isKeyDisabled?.(key) || collection.getItem(key)?.isDisabled || false;\n };\n\n // Type-to-select - for Select, typing directly selects items when closed\n const { typeSelectProps } = createTypeSelect({\n collection: () => state.collection(),\n focusedKey: () => state.selectedKey(), // Use selectedKey as the \"focused\" key for closed Select\n onFocusedKeyChange: (key) => {\n // When closed, type-to-select directly changes selection\n if (!state.isOpen()) {\n state.setSelectedKey(key);\n } else {\n // When open, update focused key (listbox handles selection)\n state.setFocusedKey(key);\n }\n },\n isKeyDisabled,\n get isDisabled() {\n return getProps().disallowTypeAhead ?? false;\n },\n });\n\n // Keyboard navigation\n const onKeyDown: JSX.EventHandler<HTMLElement, KeyboardEvent> = (e) => {\n if (getProps().isDisabled) return;\n\n const collection = state.collection();\n const currentKey = state.selectedKey();\n\n switch (e.key) {\n case 'Enter':\n case ' ':\n e.preventDefault();\n state.toggle();\n break;\n\n case 'ArrowDown':\n e.preventDefault();\n if (!state.isOpen()) {\n // ArrowDown: Open the dropdown and focus first/selected item\n state.open();\n const focusKey = currentKey ?? collection.getFirstKey();\n if (focusKey) {\n state.setFocusedKey(focusKey);\n }\n }\n // When open, navigation is handled by the listbox\n break;\n\n case 'ArrowUp':\n e.preventDefault();\n if (!state.isOpen()) {\n // ArrowUp: Open the dropdown and focus last/selected item\n state.open();\n const focusKey = currentKey ?? collection.getLastKey();\n if (focusKey) {\n state.setFocusedKey(focusKey);\n }\n }\n // When open, navigation is handled by the listbox\n break;\n\n case 'ArrowRight':\n // ArrowRight: Select next option (for horizontal keyboard navigation pattern)\n if (!state.isOpen()) {\n e.preventDefault();\n const nextKey = findNextKey(currentKey, 'forward');\n if (nextKey != null) {\n state.setSelectedKey(nextKey);\n }\n }\n break;\n\n case 'ArrowLeft':\n // ArrowLeft: Select previous option (for horizontal keyboard navigation pattern)\n if (!state.isOpen()) {\n e.preventDefault();\n const prevKey = findNextKey(currentKey, 'backward');\n if (prevKey != null) {\n state.setSelectedKey(prevKey);\n }\n }\n break;\n\n case 'Home':\n // Home: Select first option\n if (!state.isOpen()) {\n e.preventDefault();\n const firstKey = collection.getFirstKey();\n if (firstKey != null) {\n // Find first non-disabled key\n const item = collection.getItem(firstKey);\n if (item && !item.isDisabled) {\n state.setSelectedKey(firstKey);\n } else {\n const nextKey = findNextKey(firstKey, 'forward');\n if (nextKey != null) {\n state.setSelectedKey(nextKey);\n }\n }\n }\n }\n break;\n\n case 'End':\n // End: Select last option\n if (!state.isOpen()) {\n e.preventDefault();\n const lastKey = collection.getLastKey();\n if (lastKey != null) {\n // Find last non-disabled key\n const item = collection.getItem(lastKey);\n if (item && !item.isDisabled) {\n state.setSelectedKey(lastKey);\n } else {\n const prevKey = findNextKey(lastKey, 'backward');\n if (prevKey != null) {\n state.setSelectedKey(prevKey);\n }\n }\n }\n }\n break;\n\n case 'Escape':\n if (state.isOpen()) {\n e.preventDefault();\n state.close();\n }\n break;\n }\n };\n\n // Handle focus events\n const handleFocus = (e: FocusEvent) => {\n state.setFocused(true);\n getProps().onFocus?.(e);\n getProps().onFocusChange?.(true);\n };\n\n const handleBlur = (e: FocusEvent) => {\n state.setFocused(false);\n getProps().onBlur?.(e);\n getProps().onFocusChange?.(false);\n };\n\n return {\n get labelProps() {\n return labelProps as JSX.HTMLAttributes<HTMLElement>;\n },\n get triggerProps() {\n const p = getProps();\n const isOpen = state.isOpen();\n const isDisabled = p.isDisabled ?? state.isDisabled;\n\n const baseProps = mergeProps(\n domProps(),\n pressProps as Record<string, unknown>,\n focusProps as Record<string, unknown>,\n fieldProps as Record<string, unknown>,\n {\n id: buttonId,\n role: 'combobox',\n type: 'button',\n tabIndex: isDisabled ? undefined : 0,\n 'aria-haspopup': 'listbox',\n 'aria-expanded': isOpen,\n 'aria-controls': isOpen ? listBoxId : undefined,\n 'aria-disabled': isDisabled || undefined,\n 'aria-required': p.isRequired || undefined,\n 'aria-describedby': p['aria-describedby'] || undefined,\n onKeyDown,\n onFocus: handleFocus,\n onBlur: handleBlur,\n 'data-open': isOpen || undefined,\n 'data-disabled': isDisabled || undefined,\n 'data-focus-visible': isFocusVisible() || undefined,\n } as Record<string, unknown>\n );\n\n // Add type-select props if enabled\n if (!p.disallowTypeAhead) {\n return mergeProps(baseProps, typeSelectProps as Record<string, unknown>) as JSX.HTMLAttributes<HTMLElement>;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLElement>;\n },\n get valueProps() {\n return {\n id: valueId,\n } as JSX.HTMLAttributes<HTMLElement>;\n },\n get menuProps() {\n return {\n id: listBoxId,\n role: 'listbox',\n 'aria-labelledby': buttonId,\n tabIndex: -1,\n } as JSX.HTMLAttributes<HTMLElement>;\n },\n get descriptionProps() {\n return {\n id: descriptionId,\n } as JSX.HTMLAttributes<HTMLElement>;\n },\n get errorMessageProps() {\n return {\n id: errorMessageId,\n } as JSX.HTMLAttributes<HTMLElement>;\n },\n isFocused,\n isFocusVisible: () => isFocused() && isFocusVisible(),\n isOpen: state.isOpen,\n selectedItem: state.selectedItem,\n };\n}\n", "/**\n * Provides a hidden native select element for form integration.\n * Based on @react-aria/select useHiddenSelect.\n */\n\nimport { type JSX, type Accessor, For, createEffect, onCleanup } from 'solid-js';\nimport { access, type MaybeAccessor } from '../utils/reactivity';\nimport { createFormValidation } from '../form/createFormValidation';\nimport type { SelectState, Key, FormValidationState } from '@proyecto-viviana/solid-stately';\n\nexport type ValidationBehavior = 'aria' | 'native';\n\nexport interface AriaHiddenSelectProps<T> {\n /** The state object for the select. */\n state: SelectState<T>;\n /** The name attribute for the hidden select. */\n name?: string;\n /** Whether the select is disabled. */\n isDisabled?: boolean;\n /** Whether the select is required. */\n isRequired?: boolean;\n /** Describes the type of autocomplete functionality the select should provide. */\n autoComplete?: string;\n /** The `form` attribute to associate the select with a form by ID. */\n form?: string;\n /** Validation behavior: 'aria' for realtime, 'native' for on submit. */\n validationBehavior?: ValidationBehavior;\n /** A ref to the trigger element for focus on validation error. */\n triggerRef?: Accessor<HTMLElement | null>;\n /** Form validation state (optional, for native validation). */\n validationState?: FormValidationState;\n}\n\nexport interface HiddenSelectAria {\n /** Props for the container element. */\n containerProps: JSX.HTMLAttributes<HTMLDivElement>;\n /** Props for the hidden select element. */\n selectProps: JSX.SelectHTMLAttributes<HTMLSelectElement>;\n /** Props for the hidden input element (for form submission). */\n inputProps: JSX.InputHTMLAttributes<HTMLInputElement>;\n}\n\n/**\n * Provides the accessibility implementation for a hidden select.\n * This is used for native form submission and accessibility on mobile devices.\n */\nexport function createHiddenSelect<T>(\n props: MaybeAccessor<AriaHiddenSelectProps<T>>\n): HiddenSelectAria {\n const getProps = () => access(props);\n\n // Track the select element for form reset/validation\n let selectRef: HTMLSelectElement | undefined;\n\n // Set up form reset handler\n createEffect(() => {\n const p = getProps();\n if (!selectRef) return;\n\n const form = selectRef.form;\n if (!form) return;\n\n const handleReset = () => {\n // Reset to default selected key (first key or null)\n const defaultKey = p.state.collection().getFirstKey();\n p.state.setSelectedKey(defaultKey);\n };\n\n form.addEventListener('reset', handleReset);\n\n onCleanup(() => {\n form.removeEventListener('reset', handleReset);\n });\n });\n\n // Set up form validation handler for native validation\n createEffect(() => {\n const p = getProps();\n if (!selectRef || p.validationBehavior !== 'native' || !p.validationState) return;\n\n createFormValidation(\n {\n validationBehavior: p.validationBehavior,\n focus: () => p.triggerRef?.()?.focus(),\n },\n p.validationState,\n () => selectRef\n );\n });\n\n return {\n get containerProps() {\n return {\n 'aria-hidden': true,\n 'data-a11y-ignore': 'aria-hidden-focus',\n } as JSX.HTMLAttributes<HTMLDivElement>;\n },\n get selectProps() {\n const p = getProps();\n const state = p.state;\n const selectedKey = state.selectedKey();\n const validationBehavior = p.validationBehavior ?? 'aria';\n\n return {\n ref: (el: HTMLSelectElement) => { selectRef = el; },\n tabIndex: -1,\n autoComplete: p.autoComplete,\n disabled: p.isDisabled ?? state.isDisabled,\n name: p.name,\n form: p.form,\n // Add required attribute for native form validation\n required: validationBehavior === 'native' && p.isRequired,\n value: selectedKey != null ? String(selectedKey) : '',\n onChange: (e: Event) => {\n const target = e.target as HTMLSelectElement;\n state.setSelectedKey(target.value as Key);\n },\n style: {\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n height: '100%',\n opacity: 0,\n 'font-size': '16px', // Prevents zoom on iOS\n border: 'none',\n cursor: 'default',\n margin: 0,\n padding: 0,\n 'pointer-events': 'none',\n },\n } as JSX.SelectHTMLAttributes<HTMLSelectElement>;\n },\n get inputProps() {\n const p = getProps();\n const state = p.state;\n const selectedKey = state.selectedKey();\n const validationBehavior = p.validationBehavior ?? 'aria';\n\n // For native validation with required, use type=\"text\" with display:none\n // so the browser will validate it on form submit\n const useTextInput = validationBehavior === 'native' && p.isRequired;\n\n return {\n type: useTextInput ? 'text' : 'hidden',\n name: p.name,\n form: p.form,\n value: selectedKey != null ? String(selectedKey) : '',\n disabled: p.isDisabled ?? state.isDisabled,\n required: useTextInput ? p.isRequired : undefined,\n style: useTextInput ? { display: 'none' } : undefined,\n } as JSX.InputHTMLAttributes<HTMLInputElement>;\n },\n };\n}\n\nexport interface HiddenSelectProps<T> {\n /** The state object for the select. */\n state: SelectState<T>;\n /** The name attribute for the hidden select. */\n name?: string;\n /** Whether the select is disabled. */\n isDisabled?: boolean;\n /** Whether the select is required. */\n isRequired?: boolean;\n /** A ref to the trigger element. */\n triggerRef?: () => HTMLElement | null;\n /** Label for the select. */\n label?: string;\n /** Describes the type of autocomplete functionality the select should provide. */\n autoComplete?: string;\n /** The `form` attribute to associate the select with a form by ID. */\n form?: string;\n /** Validation behavior: 'aria' for realtime, 'native' for on submit. */\n validationBehavior?: ValidationBehavior;\n /** Form validation state (optional, for native validation). */\n validationState?: FormValidationState;\n}\n\n/**\n * A component that renders a hidden native select for form submission.\n * This is useful on mobile devices where native select behavior is preferred.\n */\nexport function HiddenSelect<T>(props: HiddenSelectProps<T>): JSX.Element {\n const { containerProps, selectProps } = createHiddenSelect({\n get state() {\n return props.state;\n },\n get name() {\n return props.name;\n },\n get isDisabled() {\n return props.isDisabled;\n },\n get isRequired() {\n return props.isRequired;\n },\n get autoComplete() {\n return props.autoComplete;\n },\n get form() {\n return props.form;\n },\n get validationBehavior() {\n return props.validationBehavior;\n },\n get triggerRef() {\n return props.triggerRef;\n },\n get validationState() {\n return props.validationState;\n },\n });\n\n const collection = () => props.state.collection();\n const selectedKey = () => props.state.selectedKey();\n\n return (\n <div {...containerProps}>\n <label>\n {props.label}\n <select {...selectProps}>\n <option />\n <For each={Array.from(collection())}>\n {(item) => (\n <option value={String(item.key)} selected={item.key === selectedKey()}>\n {item.textValue}\n </option>\n )}\n </For>\n </select>\n </label>\n </div>\n );\n}\n", "/**\n * createFormValidation hook for solidaria\n *\n * Connects form validation state to native HTML form validation.\n * Handles the invalid event, form reset, and focus management.\n *\n * Port of react-aria's useFormValidation.\n */\n\nimport { type Accessor, createEffect, onCleanup } from 'solid-js';\nimport {\n type FormValidationState,\n type ValidationResult,\n} from '@proyecto-viviana/solid-stately';\nimport { setInteractionModality } from '../interactions/createInteractionModality';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport type ValidatableElement =\n | HTMLInputElement\n | HTMLTextAreaElement\n | HTMLSelectElement;\n\nexport type ValidationBehavior = 'aria' | 'native';\n\nexport interface FormValidationProps {\n /** Validation behavior: 'aria' for realtime, 'native' for on submit. */\n validationBehavior?: ValidationBehavior;\n /** Custom focus function to call on validation error. */\n focus?: () => void;\n}\n\n// ============================================\n// HELPERS\n// ============================================\n\nfunction getValidity(input: ValidatableElement): ValidityState {\n // Create a snapshot of the validity state (the native object is live)\n const validity = input.validity;\n return {\n badInput: validity.badInput,\n customError: validity.customError,\n patternMismatch: validity.patternMismatch,\n rangeOverflow: validity.rangeOverflow,\n rangeUnderflow: validity.rangeUnderflow,\n stepMismatch: validity.stepMismatch,\n tooLong: validity.tooLong,\n tooShort: validity.tooShort,\n typeMismatch: validity.typeMismatch,\n valueMissing: validity.valueMissing,\n valid: validity.valid,\n };\n}\n\nfunction getNativeValidity(input: ValidatableElement): ValidationResult {\n return {\n isInvalid: !input.validity.valid,\n validationDetails: getValidity(input),\n validationErrors: input.validationMessage ? [input.validationMessage] : [],\n };\n}\n\nfunction getFirstInvalidInput(form: HTMLFormElement): ValidatableElement | null {\n for (let i = 0; i < form.elements.length; i++) {\n const element = form.elements[i] as ValidatableElement;\n if (!element.validity.valid) {\n return element;\n }\n }\n return null;\n}\n\n// ============================================\n// HOOK\n// ============================================\n\n/**\n * Connects form validation state to a native HTML form input.\n *\n * This hook:\n * - Sets custom validity on the native input based on validation state\n * - Handles the 'invalid' event to commit validation and focus the first invalid input\n * - Handles form reset to clear validation state\n * - Handles input change to commit validation\n *\n * @example\n * ```tsx\n * function MyTextField(props) {\n * let inputRef: HTMLInputElement | undefined;\n *\n * const validationState = createFormValidationState({\n * value: props.value,\n * validate: props.validate,\n * validationBehavior: 'native',\n * });\n *\n * createFormValidation(\n * { validationBehavior: 'native' },\n * validationState,\n * () => inputRef\n * );\n *\n * return (\n * <input\n * ref={inputRef}\n * value={props.value}\n * aria-invalid={validationState.displayValidation().isInvalid || undefined}\n * />\n * );\n * }\n * ```\n */\nexport function createFormValidation(\n props: FormValidationProps,\n state: FormValidationState,\n ref: Accessor<ValidatableElement | undefined>\n): void {\n const validationBehavior = () => props.validationBehavior ?? 'aria';\n const focus = () => props.focus;\n\n // Track whether we should ignore form reset (for React-like programmatic resets)\n let isIgnoredReset = false;\n\n // Set custom validity on the native input\n createEffect(() => {\n const input = ref();\n if (\n validationBehavior() === 'native' &&\n input &&\n !input.disabled\n ) {\n const realtimeValidation = state.realtimeValidation();\n const errorMessage = realtimeValidation.isInvalid\n ? realtimeValidation.validationErrors.join(' ') || 'Invalid value.'\n : '';\n input.setCustomValidity(errorMessage);\n\n // Prevent default tooltip for validation message\n if (!input.hasAttribute('title')) {\n input.title = '';\n }\n\n // Update validation with native validity if not already invalid\n if (!realtimeValidation.isInvalid) {\n state.updateValidation(getNativeValidity(input));\n }\n }\n });\n\n // Set up event listeners\n createEffect(() => {\n const input = ref();\n if (!input) {\n return;\n }\n\n const form = input.form;\n\n // Handle invalid event\n const onInvalid = (e: Event) => {\n // Only commit validation if we are not already displaying one\n if (!state.displayValidation().isInvalid) {\n state.commitValidation();\n }\n\n // Auto focus the first invalid input in a form\n if (!e.defaultPrevented && form && getFirstInvalidInput(form) === input) {\n const focusFn = focus();\n if (focusFn) {\n focusFn();\n } else {\n input.focus();\n }\n // Always show focus ring\n setInteractionModality('keyboard');\n }\n\n // Prevent default browser error UI\n e.preventDefault();\n };\n\n // Handle change event\n const onChange = () => {\n state.commitValidation();\n };\n\n // Handle form reset\n const onReset = () => {\n if (!isIgnoredReset) {\n state.resetValidation();\n }\n };\n\n // Patch form.reset to detect programmatic resets\n let originalReset: (() => void) | undefined;\n if (form) {\n originalReset = form.reset.bind(form);\n form.reset = () => {\n // Ignore programmatic resets outside user events\n isIgnoredReset =\n !window.event ||\n (window.event.type === 'message' &&\n window.event.target instanceof MessagePort);\n originalReset?.();\n isIgnoredReset = false;\n };\n }\n\n input.addEventListener('invalid', onInvalid);\n input.addEventListener('change', onChange);\n form?.addEventListener('reset', onReset);\n\n onCleanup(() => {\n input.removeEventListener('invalid', onInvalid);\n input.removeEventListener('change', onChange);\n form?.removeEventListener('reset', onReset);\n if (form && originalReset) {\n form.reset = originalReset;\n }\n });\n });\n}\n", "/**\n * ARIA hooks for tab components.\n * Based on @react-aria/tabs.\n */\n\nimport { type Accessor, createMemo, onMount } from 'solid-js';\nimport { createFocusRing } from '../interactions';\nimport { createPress } from '../interactions';\nimport { createHover } from '../interactions';\nimport { createId } from '../ssr';\nimport type { Key, Collection, CollectionNode } from '@proyecto-viviana/solid-stately';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport type TabOrientation = 'horizontal' | 'vertical';\nexport type KeyboardActivation = 'automatic' | 'manual';\n\nexport interface TabListState<T = unknown> {\n collection: Accessor<Collection<T>>;\n selectedKey: Accessor<Key | null>;\n setSelectedKey(key: Key): void;\n selectedItem: Accessor<CollectionNode<T> | null>;\n isDisabled: Accessor<boolean>;\n keyboardActivation: Accessor<KeyboardActivation>;\n orientation: Accessor<TabOrientation>;\n isKeyDisabled(key: Key): boolean;\n disabledKeys: Accessor<Set<Key>>;\n isFocused: Accessor<boolean>;\n setFocused(isFocused: boolean): void;\n focusedKey: Accessor<Key | null>;\n setFocusedKey(key: Key | null): void;\n}\n\nexport interface AriaTabListProps {\n /** The orientation of the tab list. */\n orientation?: TabOrientation;\n /** How tabs are activated (on focus or on click). */\n keyboardActivation?: KeyboardActivation;\n /** Whether the tab list is disabled. */\n isDisabled?: boolean;\n /** Label for the tab list. */\n 'aria-label'?: string;\n /** ID of element that labels the tab list. */\n 'aria-labelledby'?: string;\n /** ID of element that describes the tab list. */\n 'aria-describedby'?: string;\n}\n\nexport interface TabListAria {\n /** Props for the tab list container element. */\n tabListProps: {\n role: 'tablist';\n 'aria-orientation': TabOrientation;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'aria-describedby'?: string;\n onKeyDown: (e: KeyboardEvent) => void;\n onFocus: (e: FocusEvent) => void;\n onBlur: (e: FocusEvent) => void;\n };\n}\n\nexport interface AriaTabProps {\n /** The key of the tab. */\n key: Key;\n /** Whether the tab is disabled. */\n isDisabled?: boolean;\n /** Label for the tab. */\n 'aria-label'?: string;\n}\n\nexport interface TabAria {\n /** Props for the tab element. */\n tabProps: {\n id: string;\n role: 'tab';\n 'aria-selected': boolean;\n 'aria-disabled': boolean | undefined;\n 'aria-controls': string | undefined;\n 'aria-label'?: string;\n tabIndex: number;\n onKeyDown: (e: KeyboardEvent) => void;\n onMouseDown: (e: MouseEvent) => void;\n onPointerDown: (e: PointerEvent) => void;\n onClick: (e: MouseEvent) => void;\n onFocus: (e: FocusEvent) => void;\n };\n /** Whether the tab is selected. */\n isSelected: Accessor<boolean>;\n /** Whether the tab is disabled. */\n isDisabled: Accessor<boolean>;\n /** Whether the tab is pressed. */\n isPressed: Accessor<boolean>;\n /** Whether the tab has focus. */\n isFocused: Accessor<boolean>;\n /** Whether the tab has visible focus ring. */\n isFocusVisible: Accessor<boolean>;\n /** Whether the tab is hovered. */\n isHovered: Accessor<boolean>;\n}\n\nexport interface AriaTabPanelProps {\n /** The key of the associated tab. */\n id?: Key;\n /** Label for the tab panel. */\n 'aria-label'?: string;\n /** ID of element that labels the tab panel. */\n 'aria-labelledby'?: string;\n /** ID of element that describes the tab panel. */\n 'aria-describedby'?: string;\n}\n\nexport interface TabPanelAria {\n /** Props for the tab panel element. */\n tabPanelProps: {\n id: string;\n role: 'tabpanel';\n 'aria-labelledby': string;\n 'aria-label'?: string;\n 'aria-describedby'?: string;\n tabIndex: number;\n };\n /** Whether this panel is the selected one. */\n isSelected: Accessor<boolean>;\n}\n\n// ============================================\n// ID MANAGEMENT\n// ============================================\n\nconst tabListIds = new WeakMap<TabListState<unknown>, string>();\n\nfunction getTabListId<T>(state: TabListState<T>): string {\n let id = tabListIds.get(state as TabListState<unknown>);\n if (!id) {\n id = createId();\n tabListIds.set(state as TabListState<unknown>, id);\n }\n return id;\n}\n\nfunction generateTabId<T>(state: TabListState<T>, key: Key): string {\n const baseId = getTabListId(state);\n const keyStr = String(key).replace(/\\s+/g, '-');\n return `${baseId}-tab-${keyStr}`;\n}\n\nfunction generateTabPanelId<T>(state: TabListState<T>, key: Key): string {\n const baseId = getTabListId(state);\n const keyStr = String(key).replace(/\\s+/g, '-');\n return `${baseId}-tabpanel-${keyStr}`;\n}\n\n// ============================================\n// KEYBOARD DELEGATE\n// ============================================\n\nfunction getNextKey<T>(state: TabListState<T>, currentKey: Key): Key | null {\n const coll = state.collection();\n const keys = [...coll].map(node => node.key);\n const currentIndex = keys.indexOf(currentKey);\n\n if (currentIndex === -1) return keys[0] ?? null;\n\n // Find next non-disabled key, wrapping around\n for (let i = 1; i <= keys.length; i++) {\n const nextIndex = (currentIndex + i) % keys.length;\n const nextKey = keys[nextIndex];\n if (!state.isKeyDisabled(nextKey)) {\n return nextKey;\n }\n }\n\n return null;\n}\n\nfunction getPreviousKey<T>(state: TabListState<T>, currentKey: Key): Key | null {\n const coll = state.collection();\n const keys = [...coll].map(node => node.key);\n const currentIndex = keys.indexOf(currentKey);\n\n if (currentIndex === -1) return keys[keys.length - 1] ?? null;\n\n // Find previous non-disabled key, wrapping around\n for (let i = 1; i <= keys.length; i++) {\n const prevIndex = (currentIndex - i + keys.length) % keys.length;\n const prevKey = keys[prevIndex];\n if (!state.isKeyDisabled(prevKey)) {\n return prevKey;\n }\n }\n\n return null;\n}\n\nfunction getFirstKey<T>(state: TabListState<T>): Key | null {\n const coll = state.collection();\n for (const node of coll) {\n if (!state.isKeyDisabled(node.key)) {\n return node.key;\n }\n }\n return null;\n}\n\nfunction getLastKey<T>(state: TabListState<T>): Key | null {\n const coll = state.collection();\n const keys = [...coll].map(node => node.key).reverse();\n for (const key of keys) {\n if (!state.isKeyDisabled(key)) {\n return key;\n }\n }\n return null;\n}\n\n// ============================================\n// HOOKS\n// ============================================\n\n/**\n * Creates ARIA props for a tab list container.\n */\nexport function createTabList<T>(\n props: AriaTabListProps,\n state: TabListState<T>\n): TabListAria {\n const orientation = () => props.orientation ?? state.orientation() ?? 'horizontal';\n const keyboardActivation = () => props.keyboardActivation ?? state.keyboardActivation() ?? 'automatic';\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (state.isDisabled()) return;\n\n const currentKey = state.focusedKey() ?? state.selectedKey();\n if (currentKey === null) return;\n\n let nextKey: Key | null = null;\n const isHorizontal = orientation() === 'horizontal';\n\n switch (e.key) {\n case 'ArrowLeft':\n if (isHorizontal) {\n // TODO: RTL support\n nextKey = getPreviousKey(state, currentKey);\n }\n break;\n case 'ArrowRight':\n if (isHorizontal) {\n nextKey = getNextKey(state, currentKey);\n }\n break;\n case 'ArrowUp':\n if (!isHorizontal) {\n nextKey = getPreviousKey(state, currentKey);\n }\n break;\n case 'ArrowDown':\n if (!isHorizontal) {\n nextKey = getNextKey(state, currentKey);\n }\n break;\n case 'Home':\n nextKey = getFirstKey(state);\n break;\n case 'End':\n nextKey = getLastKey(state);\n break;\n case 'Enter':\n case ' ':\n // In manual mode, Enter/Space activates the focused tab\n if (keyboardActivation() === 'manual' && state.focusedKey()) {\n state.setSelectedKey(state.focusedKey()!);\n e.preventDefault();\n }\n return;\n default:\n return;\n }\n\n if (nextKey !== null) {\n e.preventDefault();\n state.setFocusedKey(nextKey);\n\n // In automatic mode, selection follows focus\n if (keyboardActivation() === 'automatic') {\n state.setSelectedKey(nextKey);\n }\n }\n };\n\n const handleFocus = () => {\n state.setFocused(true);\n // If no focused key, focus the selected key\n if (state.focusedKey() === null && state.selectedKey() !== null) {\n state.setFocusedKey(state.selectedKey());\n }\n };\n\n const handleBlur = (e: FocusEvent) => {\n // Only blur if focus is leaving the tab list entirely\n const relatedTarget = e.relatedTarget as Element | null;\n if (relatedTarget && (e.currentTarget as Element).contains(relatedTarget)) {\n return;\n }\n state.setFocused(false);\n };\n\n return {\n tabListProps: {\n role: 'tablist',\n 'aria-orientation': orientation(),\n 'aria-label': props['aria-label'],\n 'aria-labelledby': props['aria-labelledby'],\n 'aria-describedby': props['aria-describedby'],\n onKeyDown: handleKeyDown,\n onFocus: handleFocus,\n onBlur: handleBlur,\n },\n };\n}\n\n/**\n * Creates ARIA props for an individual tab.\n */\nexport function createTab<T>(\n props: AriaTabProps,\n state: TabListState<T>,\n ref?: Accessor<HTMLElement | null>\n): TabAria {\n const key = () => props.key;\n\n const isSelected = createMemo(() => state.selectedKey() === key());\n const isDisabled = createMemo(() => {\n if (props.isDisabled) return true;\n return state.isKeyDisabled(key());\n });\n\n const isFocused = createMemo(() => state.focusedKey() === key());\n\n // Focus ring\n const { isFocusVisible, focusProps } = createFocusRing();\n\n // Press handling\n const { isPressed, pressProps } = createPress({\n get isDisabled() {\n return isDisabled();\n },\n onPress: () => {\n state.setSelectedKey(key());\n state.setFocusedKey(key());\n },\n });\n\n // Hover handling\n const { isHovered } = createHover({\n get isDisabled() {\n return isDisabled();\n },\n });\n\n // Generate IDs\n const tabId = generateTabId(state, key());\n const tabPanelId = generateTabPanelId(state, key());\n\n // Helper to safely call event handlers that may be bound tuples\n const callHandler = <E extends Event>(\n handler: ((e: E) => void) | [object, (e: E) => void] | undefined,\n event: E\n ) => {\n if (!handler) return;\n if (Array.isArray(handler)) {\n handler[1].call(handler[0], event);\n } else {\n handler(event);\n }\n };\n\n // Focus management\n const handleFocus = (e: FocusEvent) => {\n state.setFocusedKey(key());\n callHandler(focusProps.onFocus as any, e);\n };\n\n // Combine all handlers\n const handleKeyDown = (e: KeyboardEvent) => {\n callHandler(pressProps.onKeyDown as any, e);\n };\n\n const handleMouseDown = (e: MouseEvent) => {\n callHandler(pressProps.onMouseDown as any, e);\n };\n\n const handlePointerDown = (e: PointerEvent) => {\n callHandler(pressProps.onPointerDown as any, e);\n };\n\n const handleClick = (e: MouseEvent) => {\n callHandler(pressProps.onClick as any, e);\n };\n\n // Focus this tab when it becomes selected and focused\n onMount(() => {\n const cleanup = createMemo(() => {\n if (isFocused() && ref?.()) {\n ref()?.focus();\n }\n });\n return cleanup;\n });\n\n return {\n tabProps: {\n id: tabId,\n role: 'tab',\n 'aria-selected': isSelected(),\n 'aria-disabled': isDisabled() || undefined,\n 'aria-controls': isSelected() ? tabPanelId : undefined,\n 'aria-label': props['aria-label'],\n tabIndex: isSelected() && !isDisabled() ? 0 : -1,\n onKeyDown: handleKeyDown,\n onMouseDown: handleMouseDown,\n onPointerDown: handlePointerDown,\n onClick: handleClick,\n onFocus: handleFocus,\n },\n isSelected,\n isDisabled,\n isPressed,\n isFocused,\n isFocusVisible,\n isHovered,\n };\n}\n\n/**\n * Creates ARIA props for a tab panel.\n */\nexport function createTabPanel<T>(\n props: AriaTabPanelProps,\n state: TabListState<T> | null\n): TabPanelAria {\n // If state is null, the panel is always visible (for SSR scenarios)\n const isSelected = createMemo(() => {\n if (state === null) return true;\n if (props.id === undefined) return false;\n return state.selectedKey() === props.id;\n });\n\n // Generate IDs based on the associated tab key\n const tabPanelId = state && props.id !== undefined\n ? generateTabPanelId(state, props.id)\n : createId();\n\n const tabId = state && props.id !== undefined\n ? generateTabId(state, props.id)\n : '';\n\n return {\n tabPanelProps: {\n id: tabPanelId,\n role: 'tabpanel',\n 'aria-labelledby': props['aria-labelledby'] ?? tabId,\n 'aria-label': props['aria-label'],\n 'aria-describedby': props['aria-describedby'],\n // Make panel focusable if no tabbable children\n tabIndex: 0,\n },\n isSelected,\n };\n}\n", "/**\n * Breadcrumbs hooks for Solidaria\n *\n * Provides accessibility implementation for breadcrumb navigation.\n * Port of @react-aria/breadcrumbs.\n */\n\nimport { createLink, type AriaLinkProps, type LinkAria } from '../link';\nimport { filterDOMProps } from '../utils/filterDOMProps';\nimport { mergeProps } from '../utils/mergeProps';\nimport { type MaybeAccessor, access } from '../utils/reactivity';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaBreadcrumbsProps {\n /** Provides a label for the breadcrumbs navigation. */\n 'aria-label'?: string;\n /** Identifies the element (or elements) that labels the breadcrumbs. */\n 'aria-labelledby'?: string;\n /** Identifies the element (or elements) that describes the breadcrumbs. */\n 'aria-describedby'?: string;\n /** Whether the breadcrumbs are disabled. */\n isDisabled?: boolean;\n}\n\nexport interface BreadcrumbsAria {\n /** Props for the breadcrumbs nav element. */\n navProps: Record<string, unknown>;\n}\n\nexport interface AriaBreadcrumbItemProps extends Omit<AriaLinkProps, 'aria-current'> {\n /** Whether this is the current/last item in the breadcrumb trail. */\n isCurrent?: boolean;\n /** The type of current location for aria-current. @default 'page' */\n 'aria-current'?: 'page' | 'step' | 'location' | 'date' | 'time' | boolean;\n /** The HTML element type. @default 'a' */\n elementType?: string;\n}\n\nexport interface BreadcrumbItemAria extends LinkAria {\n /** Props for the breadcrumb item element. */\n itemProps: Record<string, unknown>;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides accessibility implementation for the breadcrumbs navigation container.\n */\nexport function createBreadcrumbs(\n props: MaybeAccessor<AriaBreadcrumbsProps> = {}\n): BreadcrumbsAria {\n const getProps = () => access(props);\n\n const getNavProps = (): Record<string, unknown> => {\n const p = getProps();\n\n // Default aria-label to \"Breadcrumbs\" if not provided\n const ariaLabel = p['aria-label'] ?? 'Breadcrumbs';\n\n return mergeProps(\n filterDOMProps(p as Record<string, unknown>, { labelable: true }),\n {\n 'aria-label': ariaLabel,\n }\n );\n };\n\n return {\n get navProps() {\n return getNavProps();\n },\n };\n}\n\n/**\n * Provides accessibility implementation for an individual breadcrumb item.\n */\nexport function createBreadcrumbItem(\n props: MaybeAccessor<AriaBreadcrumbItemProps> = {}\n): BreadcrumbItemAria {\n const getProps = () => access(props);\n\n const isCurrent = () => getProps().isCurrent ?? false;\n const isDisabled = () => getProps().isDisabled ?? false;\n const elementType = () => getProps().elementType ?? 'a';\n\n // Check if element is a heading\n const isHeading = () => /^h[1-6]$/.test(elementType());\n\n // Use createLink for base link behavior\n // Current items are treated as disabled (can't navigate to current page)\n const { linkProps, isPressed } = createLink({\n get isDisabled() {\n return isDisabled() || isCurrent();\n },\n get elementType() {\n return elementType();\n },\n get href() {\n return getProps().href;\n },\n get target() {\n return getProps().target;\n },\n get rel() {\n return getProps().rel;\n },\n get onPress() {\n return getProps().onPress;\n },\n get onPressStart() {\n return getProps().onPressStart;\n },\n get onPressEnd() {\n return getProps().onPressEnd;\n },\n get onClick() {\n return getProps().onClick;\n },\n get onFocus() {\n return getProps().onFocus;\n },\n get onBlur() {\n return getProps().onBlur;\n },\n get onFocusChange() {\n return getProps().onFocusChange;\n },\n get onKeyDown() {\n return getProps().onKeyDown;\n },\n get onKeyUp() {\n return getProps().onKeyUp;\n },\n get autoFocus() {\n return getProps().autoFocus;\n },\n get 'aria-label'() {\n return getProps()['aria-label'];\n },\n get 'aria-labelledby'() {\n return getProps()['aria-labelledby'];\n },\n get 'aria-describedby'() {\n return getProps()['aria-describedby'];\n },\n });\n\n const getItemProps = (): Record<string, unknown> => {\n const p = getProps();\n const current = isCurrent();\n\n // Start with link props (unless it's a heading)\n let baseProps: Record<string, unknown> = isHeading() ? {} : linkProps;\n\n // Add aria-current for current page\n if (current) {\n const ariaCurrent = p['aria-current'] ?? 'page';\n baseProps = mergeProps(baseProps, {\n 'aria-current': ariaCurrent,\n });\n\n // Adjust tabIndex for current item\n // If autoFocus is true, we want the item focusable\n if (p.autoFocus) {\n baseProps = mergeProps(baseProps, {\n tabIndex: -1,\n });\n }\n }\n\n // Add aria-disabled for disabled items\n if (isDisabled()) {\n baseProps = mergeProps(baseProps, {\n 'aria-disabled': true,\n });\n }\n\n return baseProps;\n };\n\n return {\n get itemProps() {\n return getItemProps();\n },\n get linkProps() {\n return linkProps;\n },\n isPressed,\n };\n}\n", "/**\n * Provides the behavior and accessibility implementation for a number field.\n * Based on @react-aria/numberfield useNumberField.\n */\n\nimport { type JSX, createMemo } from 'solid-js';\nimport { createLabel } from '../label/createLabel';\nimport { filterDOMProps } from '../utils/filterDOMProps';\nimport { mergeProps } from '../utils/mergeProps';\nimport { createId } from '../ssr';\nimport { access, type MaybeAccessor } from '../utils/reactivity';\nimport type { NumberFieldState } from '@proyecto-viviana/solid-stately';\n\nexport interface AriaNumberFieldProps {\n /** A label for the number field. */\n label?: JSX.Element;\n /** An accessible label for the number field. */\n 'aria-label'?: string;\n /** The element ID that labels the number field. */\n 'aria-labelledby'?: string;\n /** The element ID that describes the number field. */\n 'aria-describedby'?: string;\n /** Whether the number field is disabled. */\n isDisabled?: boolean;\n /** Whether the number field is read-only. */\n isReadOnly?: boolean;\n /** Whether the number field is required. */\n isRequired?: boolean;\n /** Whether the number field is invalid. */\n isInvalid?: boolean;\n /** A description for the number field. */\n description?: JSX.Element;\n /** An error message for the number field. */\n errorMessage?: JSX.Element;\n /** The ID of the number field. */\n id?: string;\n /** Whether to auto-focus the input. */\n autoFocus?: boolean;\n /** The name for the form input. */\n name?: string;\n}\n\nexport interface NumberFieldAria {\n /** Props for the label element. */\n labelProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the input element group. */\n groupProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the input element. */\n inputProps: JSX.InputHTMLAttributes<HTMLInputElement>;\n /** Props for the increment button. */\n incrementButtonProps: JSX.ButtonHTMLAttributes<HTMLButtonElement>;\n /** Props for the decrement button. */\n decrementButtonProps: JSX.ButtonHTMLAttributes<HTMLButtonElement>;\n /** Props for the description element. */\n descriptionProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the error message element. */\n errorMessageProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a number field.\n */\nexport function createNumberField(\n props: MaybeAccessor<AriaNumberFieldProps>,\n state: NumberFieldState,\n inputRef?: () => HTMLInputElement | null\n): NumberFieldAria {\n const getProps = () => access(props);\n const id = createId(getProps().id);\n\n // Generate IDs for associated elements\n const inputId = `${id}-input`;\n const incrementId = `${id}-increment`;\n const decrementId = `${id}-decrement`;\n const descriptionId = `${id}-description`;\n const errorMessageId = `${id}-error`;\n\n // Label handling\n const { labelProps, fieldProps } = createLabel({\n get id() {\n return inputId;\n },\n get label() {\n return getProps().label;\n },\n get 'aria-label'() {\n return getProps()['aria-label'];\n },\n get 'aria-labelledby'() {\n return getProps()['aria-labelledby'];\n },\n labelElementType: 'span',\n });\n\n // Get the label text for button aria-labels\n const getLabelText = (): string => {\n const p = getProps();\n if (p['aria-label']) return p['aria-label'];\n if (typeof p.label === 'string') return p.label;\n return 'value';\n };\n\n // Filter DOM props\n const domProps = createMemo(() =>\n filterDOMProps(getProps() as unknown as Record<string, unknown>, { labelable: true })\n );\n\n // Handle input change\n const onInputChange: JSX.EventHandler<HTMLInputElement, Event> = (e) => {\n const value = e.currentTarget.value;\n if (state.validate(value)) {\n state.setInputValue(value);\n }\n };\n\n // Handle input blur - commit value\n const onInputBlur: JSX.EventHandler<HTMLInputElement, FocusEvent> = () => {\n state.commit();\n };\n\n // Handle keyboard events\n const onKeyDown: JSX.EventHandler<HTMLInputElement, KeyboardEvent> = (e) => {\n const p = getProps();\n if (p.isDisabled || p.isReadOnly) return;\n\n switch (e.key) {\n case 'ArrowUp':\n e.preventDefault();\n state.increment();\n break;\n case 'ArrowDown':\n e.preventDefault();\n state.decrement();\n break;\n case 'PageUp':\n e.preventDefault();\n state.incrementToMax();\n break;\n case 'PageDown':\n e.preventDefault();\n state.decrementToMin();\n break;\n case 'Home':\n e.preventDefault();\n state.decrementToMin();\n break;\n case 'End':\n e.preventDefault();\n state.incrementToMax();\n break;\n case 'Enter':\n state.commit();\n break;\n }\n };\n\n // Handle increment button\n const onIncrementPress = () => {\n state.increment();\n // Return focus to input\n inputRef?.()?.focus();\n };\n\n // Handle decrement button\n const onDecrementPress = () => {\n state.decrement();\n // Return focus to input\n inputRef?.()?.focus();\n };\n\n // Build aria-describedby\n const getAriaDescribedBy = () => {\n const p = getProps();\n const parts: string[] = [];\n if (p['aria-describedby']) parts.push(p['aria-describedby']);\n if (p.description) parts.push(descriptionId);\n if (p.isInvalid && p.errorMessage) parts.push(errorMessageId);\n return parts.length > 0 ? parts.join(' ') : undefined;\n };\n\n return {\n get labelProps() {\n return labelProps as JSX.HTMLAttributes<HTMLElement>;\n },\n get groupProps() {\n return {\n role: 'group',\n 'aria-disabled': getProps().isDisabled || undefined,\n } as JSX.HTMLAttributes<HTMLElement>;\n },\n get inputProps() {\n const p = getProps();\n const isDisabled = p.isDisabled ?? state.isDisabled();\n const isReadOnly = p.isReadOnly ?? state.isReadOnly();\n\n return mergeProps(\n domProps(),\n fieldProps as Record<string, unknown>,\n {\n id: inputId,\n type: 'text',\n inputMode: 'decimal' as const,\n autoComplete: 'off',\n autoCorrect: 'off',\n spellcheck: false,\n role: 'spinbutton',\n 'aria-valuenow': isNaN(state.numberValue()) ? undefined : state.numberValue(),\n 'aria-valuemin': state.minValue(),\n 'aria-valuemax': state.maxValue(),\n 'aria-valuetext': isNaN(state.numberValue()) ? undefined : state.inputValue(),\n 'aria-invalid': p.isInvalid || undefined,\n 'aria-required': p.isRequired || undefined,\n 'aria-describedby': getAriaDescribedBy(),\n disabled: isDisabled || undefined,\n readOnly: isReadOnly || undefined,\n value: state.inputValue(),\n onChange: onInputChange,\n onBlur: onInputBlur,\n onKeyDown,\n name: p.name,\n autoFocus: p.autoFocus,\n } as Record<string, unknown>\n ) as JSX.InputHTMLAttributes<HTMLInputElement>;\n },\n get incrementButtonProps() {\n const p = getProps();\n const isDisabled = p.isDisabled ?? state.isDisabled();\n const canIncrement = state.canIncrement();\n\n return {\n id: incrementId,\n type: 'button' as const,\n tabIndex: -1, // Exclude from tab order\n 'aria-label': `Increase ${getLabelText()}`,\n 'aria-controls': inputId,\n disabled: isDisabled || !canIncrement,\n onClick: onIncrementPress,\n onMouseDown: (e: MouseEvent) => e.preventDefault(), // Prevent focus\n } as JSX.ButtonHTMLAttributes<HTMLButtonElement>;\n },\n get decrementButtonProps() {\n const p = getProps();\n const isDisabled = p.isDisabled ?? state.isDisabled();\n const canDecrement = state.canDecrement();\n\n return {\n id: decrementId,\n type: 'button' as const,\n tabIndex: -1, // Exclude from tab order\n 'aria-label': `Decrease ${getLabelText()}`,\n 'aria-controls': inputId,\n disabled: isDisabled || !canDecrement,\n onClick: onDecrementPress,\n onMouseDown: (e: MouseEvent) => e.preventDefault(), // Prevent focus\n } as JSX.ButtonHTMLAttributes<HTMLButtonElement>;\n },\n get descriptionProps() {\n return {\n id: descriptionId,\n } as JSX.HTMLAttributes<HTMLElement>;\n },\n get errorMessageProps() {\n return {\n id: errorMessageId,\n } as JSX.HTMLAttributes<HTMLElement>;\n },\n };\n}\n", "/**\n * Provides the behavior and accessibility implementation for a search field.\n * A search field allows a user to enter and clear a search query.\n * Based on @react-aria/searchfield useSearchField.\n */\n\nimport { type JSX } from 'solid-js';\nimport { createTextField, type AriaTextFieldProps, type TextFieldAria } from '../textfield';\nimport { mergeProps } from '../utils';\nimport { type MaybeAccessor, access } from '../utils/reactivity';\nimport type { SearchFieldState } from '@proyecto-viviana/solid-stately';\n\nexport interface AriaSearchFieldProps extends Omit<AriaTextFieldProps, 'type'> {\n /** Handler that is called when the user submits the search (pressing Enter). */\n onSubmit?: (value: string) => void;\n /** Handler that is called when the clear button is pressed or Escape clears the field. */\n onClear?: () => void;\n}\n\nexport interface SearchFieldAria extends Omit<TextFieldAria, 'inputProps'> {\n /** Props for the input element. */\n inputProps: JSX.InputHTMLAttributes<HTMLInputElement>;\n /** Props for the clear button. */\n clearButtonProps: {\n 'aria-label': string;\n tabIndex: number;\n disabled?: boolean;\n onMouseDown: (e: MouseEvent) => void;\n onClick: () => void;\n };\n}\n\n/**\n * Provides the behavior and accessibility implementation for a search field.\n */\nexport function createSearchField(\n props: MaybeAccessor<AriaSearchFieldProps>,\n state: SearchFieldState,\n inputRef?: () => HTMLInputElement | null\n): SearchFieldAria {\n const getProps = () => access(props);\n\n // Use createTextField for the base implementation\n const textFieldAria = createTextField({\n get value() {\n return state.value();\n },\n get isDisabled() {\n return getProps().isDisabled;\n },\n get isReadOnly() {\n return getProps().isReadOnly;\n },\n get isRequired() {\n return getProps().isRequired;\n },\n get isInvalid() {\n return getProps().isInvalid;\n },\n get label() {\n return getProps().label;\n },\n get 'aria-label'() {\n return getProps()['aria-label'];\n },\n get 'aria-labelledby'() {\n return getProps()['aria-labelledby'];\n },\n get 'aria-describedby'() {\n return getProps()['aria-describedby'];\n },\n get description() {\n return getProps().description;\n },\n get errorMessage() {\n return getProps().errorMessage;\n },\n get placeholder() {\n return getProps().placeholder;\n },\n get name() {\n return getProps().name;\n },\n get autoFocus() {\n return getProps().autoFocus;\n },\n get autoComplete() {\n return getProps().autoComplete;\n },\n get maxLength() {\n return getProps().maxLength;\n },\n get minLength() {\n return getProps().minLength;\n },\n get pattern() {\n return getProps().pattern;\n },\n type: 'search',\n onChange: (value: string) => {\n state.setValue(value);\n getProps().onChange?.(value);\n },\n });\n\n // Handle keyboard events for search field\n const onKeyDown: JSX.EventHandler<HTMLInputElement, KeyboardEvent> = (e) => {\n const p = getProps();\n\n if (p.isDisabled || p.isReadOnly) {\n if (e.key === 'Enter') {\n e.preventDefault();\n }\n return;\n }\n\n if (e.key === 'Enter' && p.onSubmit) {\n e.preventDefault();\n p.onSubmit(state.value());\n }\n\n if (e.key === 'Escape') {\n const currentValue = state.value();\n const inputValue = inputRef?.()?.value ?? '';\n\n // Only clear if there's a value\n if (currentValue !== '' || inputValue !== '') {\n e.preventDefault();\n e.stopPropagation();\n state.setValue('');\n p.onClear?.();\n }\n }\n };\n\n // Handle clear button click\n const onClearButtonClick = () => {\n const p = getProps();\n state.setValue('');\n p.onClear?.();\n // Focus the input after clearing\n inputRef?.()?.focus();\n };\n\n // Prevent focus from leaving input on mobile when clicking clear button\n const onClearButtonMouseDown = (e: MouseEvent) => {\n e.preventDefault();\n };\n\n return {\n get labelProps() {\n return textFieldAria.labelProps;\n },\n get inputProps() {\n return mergeProps(\n textFieldAria.inputProps as Record<string, unknown>,\n {\n onKeyDown,\n // Clear defaultValue since it's handled by state\n defaultValue: undefined,\n } as Record<string, unknown>\n ) as JSX.InputHTMLAttributes<HTMLInputElement>;\n },\n get clearButtonProps() {\n const p = getProps();\n const isDisabled = p.isDisabled || p.isReadOnly;\n\n return {\n 'aria-label': 'Clear search',\n tabIndex: -1, // Exclude from tab order\n disabled: isDisabled,\n onMouseDown: onClearButtonMouseDown,\n onClick: onClearButtonClick,\n };\n },\n get descriptionProps() {\n return textFieldAria.descriptionProps;\n },\n get errorMessageProps() {\n return textFieldAria.errorMessageProps;\n },\n get isInvalid() {\n return textFieldAria.isInvalid;\n },\n };\n}\n", "/**\n * Provides the behavior and accessibility implementation for a slider component.\n * A slider allows users to select a value from a range.\n * Based on @react-aria/slider useSlider.\n */\n\nimport { type JSX, onCleanup, onMount } from 'solid-js';\nimport { createLabel } from '../label/createLabel';\nimport { createFocusRing } from '../interactions/createFocusRing';\nimport { filterDOMProps } from '../utils/filterDOMProps';\nimport { mergeProps } from '../utils/mergeProps';\nimport { createId } from '../ssr';\nimport { access, type MaybeAccessor } from '../utils/reactivity';\nimport type { SliderState, SliderOrientation } from '@proyecto-viviana/solid-stately';\n\nexport interface AriaSliderProps {\n /** An ID for the slider. */\n id?: string;\n /** Whether the slider is disabled. */\n isDisabled?: boolean;\n /** The label for the slider. */\n label?: JSX.Element;\n /** An accessible label for the slider when no visible label is provided. */\n 'aria-label'?: string;\n /** The ID of an element that labels the slider. */\n 'aria-labelledby'?: string;\n /** The ID of an element that describes the slider. */\n 'aria-describedby'?: string;\n /** The orientation of the slider. */\n orientation?: SliderOrientation;\n}\n\nexport interface SliderAria {\n /** Props for the label element. */\n labelProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the root group element. */\n groupProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the track element. */\n trackProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the thumb element. */\n thumbProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the hidden input element. */\n inputProps: JSX.InputHTMLAttributes<HTMLInputElement>;\n /** Props for the output element (showing current value). */\n outputProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a slider.\n */\nexport function createSlider(\n props: MaybeAccessor<AriaSliderProps>,\n state: SliderState,\n trackRef?: () => HTMLElement | null\n): SliderAria {\n const getProps = () => access(props);\n const id = createId(getProps().id);\n\n // Generate IDs for associated elements\n const inputId = `${id}-input`;\n const outputId = `${id}-output`;\n\n // Filter DOM props\n const domProps = () =>\n filterDOMProps(getProps() as unknown as Record<string, unknown>, { labelable: true });\n\n // Label handling\n const { labelProps, fieldProps } = createLabel({\n get id() {\n return inputId;\n },\n get label() {\n return getProps().label;\n },\n get 'aria-label'() {\n return getProps()['aria-label'];\n },\n get 'aria-labelledby'() {\n return getProps()['aria-labelledby'];\n },\n labelElementType: 'span',\n });\n\n // Focus ring for keyboard focus styling\n const { isFocusVisible, focusProps } = createFocusRing({\n within: true,\n });\n\n // Track pointer state for drag handling\n let currentPointerId: number | null = null;\n\n // Calculate position from pointer event\n const getPositionFromPointer = (clientX: number, clientY: number): number => {\n const track = trackRef?.();\n if (!track) return 0;\n\n const rect = track.getBoundingClientRect();\n const isVertical = state.orientation === 'vertical';\n\n let position: number;\n if (isVertical) {\n position = (rect.bottom - clientY) / rect.height;\n } else {\n position = (clientX - rect.left) / rect.width;\n }\n\n return Math.max(0, Math.min(1, position));\n };\n\n // Handle pointer down on track\n const onTrackPointerDown = (e: PointerEvent) => {\n if (state.isDisabled || e.button !== 0) return;\n\n e.preventDefault();\n currentPointerId = e.pointerId;\n\n const track = trackRef?.();\n if (track) {\n track.setPointerCapture(e.pointerId);\n }\n\n const percent = getPositionFromPointer(e.clientX, e.clientY);\n state.setValuePercent(percent);\n state.setDragging(true);\n };\n\n // Handle pointer move for dragging\n const onTrackPointerMove = (e: PointerEvent) => {\n if (!state.isDragging() || e.pointerId !== currentPointerId) return;\n\n const percent = getPositionFromPointer(e.clientX, e.clientY);\n state.setValuePercent(percent);\n };\n\n // Handle pointer up to end drag\n const onTrackPointerUp = (e: PointerEvent) => {\n if (e.pointerId !== currentPointerId) return;\n\n const track = trackRef?.();\n if (track) {\n track.releasePointerCapture(e.pointerId);\n }\n\n currentPointerId = null;\n state.setDragging(false);\n };\n\n // Keyboard navigation for thumb\n const onThumbKeyDown = (e: KeyboardEvent) => {\n if (state.isDisabled) return;\n\n const isVertical = state.orientation === 'vertical';\n\n switch (e.key) {\n case 'ArrowRight':\n case 'ArrowUp':\n e.preventDefault();\n if ((e.key === 'ArrowRight' && !isVertical) || (e.key === 'ArrowUp' && isVertical)) {\n state.increment();\n } else {\n state.decrement();\n }\n break;\n case 'ArrowLeft':\n case 'ArrowDown':\n e.preventDefault();\n if ((e.key === 'ArrowLeft' && !isVertical) || (e.key === 'ArrowDown' && isVertical)) {\n state.decrement();\n } else {\n state.increment();\n }\n break;\n case 'PageUp':\n e.preventDefault();\n state.increment(state.pageStep / state.step);\n break;\n case 'PageDown':\n e.preventDefault();\n state.decrement(state.pageStep / state.step);\n break;\n case 'Home':\n e.preventDefault();\n state.setValue(state.minValue);\n break;\n case 'End':\n e.preventDefault();\n state.setValue(state.maxValue);\n break;\n }\n };\n\n // Handle focus events\n const onFocus = () => {\n state.setFocused(true);\n };\n\n const onBlur = () => {\n state.setFocused(false);\n };\n\n // Handle pointer down on thumb (for direct thumb dragging)\n const onThumbPointerDown = (e: PointerEvent) => {\n if (state.isDisabled || e.button !== 0) return;\n\n e.preventDefault();\n e.stopPropagation(); // Prevent track from also handling\n currentPointerId = e.pointerId;\n\n // Capture pointer on document for smooth dragging\n document.body.setPointerCapture(e.pointerId);\n state.setDragging(true);\n };\n\n // Global pointer move handler for thumb dragging\n const onDocumentPointerMove = (e: PointerEvent) => {\n if (!state.isDragging() || e.pointerId !== currentPointerId) return;\n\n const percent = getPositionFromPointer(e.clientX, e.clientY);\n state.setValuePercent(percent);\n };\n\n // Global pointer up handler\n const onDocumentPointerUp = (e: PointerEvent) => {\n if (e.pointerId !== currentPointerId) return;\n\n try {\n document.body.releasePointerCapture(e.pointerId);\n } catch {\n // Ignore if capture was already released\n }\n\n currentPointerId = null;\n state.setDragging(false);\n };\n\n // Set up global listeners on mount (client-side only)\n onMount(() => {\n if (typeof document === 'undefined') return;\n\n document.addEventListener('pointermove', onDocumentPointerMove);\n document.addEventListener('pointerup', onDocumentPointerUp);\n document.addEventListener('pointercancel', onDocumentPointerUp);\n\n // Cleanup when component unmounts\n onCleanup(() => {\n document.removeEventListener('pointermove', onDocumentPointerMove);\n document.removeEventListener('pointerup', onDocumentPointerUp);\n document.removeEventListener('pointercancel', onDocumentPointerUp);\n });\n });\n\n return {\n get labelProps() {\n return labelProps as JSX.HTMLAttributes<HTMLElement>;\n },\n get groupProps() {\n return mergeProps(\n domProps(),\n fieldProps as Record<string, unknown>,\n {\n role: 'group',\n 'data-disabled': state.isDisabled || undefined,\n 'data-orientation': state.orientation,\n } as Record<string, unknown>\n ) as JSX.HTMLAttributes<HTMLElement>;\n },\n get trackProps() {\n return {\n onPointerDown: onTrackPointerDown,\n onPointerMove: onTrackPointerMove,\n onPointerUp: onTrackPointerUp,\n onPointerCancel: onTrackPointerUp,\n style: {\n position: 'relative',\n 'touch-action': 'none',\n },\n 'data-disabled': state.isDisabled || undefined,\n 'data-orientation': state.orientation,\n 'data-dragging': state.isDragging() || undefined,\n } as JSX.HTMLAttributes<HTMLElement>;\n },\n get thumbProps() {\n const percent = state.getValuePercent();\n const isVertical = state.orientation === 'vertical';\n\n return mergeProps(\n focusProps as Record<string, unknown>,\n {\n role: 'slider',\n tabIndex: state.isDisabled ? undefined : 0,\n 'aria-valuemin': state.minValue,\n 'aria-valuemax': state.maxValue,\n 'aria-valuenow': state.value(),\n 'aria-valuetext': state.getFormattedValue(),\n 'aria-orientation': state.orientation,\n 'aria-disabled': state.isDisabled || undefined,\n 'aria-labelledby': (labelProps as { id?: string }).id,\n onPointerDown: onThumbPointerDown,\n onKeyDown: onThumbKeyDown,\n onFocus,\n onBlur,\n style: {\n position: 'absolute',\n [isVertical ? 'bottom' : 'left']: `${percent * 100}%`,\n transform: isVertical ? 'translateY(50%)' : 'translateX(-50%)',\n },\n 'data-disabled': state.isDisabled || undefined,\n 'data-dragging': state.isDragging() || undefined,\n 'data-focus-visible': isFocusVisible() || undefined,\n } as Record<string, unknown>\n ) as JSX.HTMLAttributes<HTMLElement>;\n },\n get inputProps() {\n return {\n type: 'range',\n id: inputId,\n min: state.minValue,\n max: state.maxValue,\n step: state.step,\n value: state.value(),\n disabled: state.isDisabled,\n 'aria-hidden': true,\n tabIndex: -1,\n style: {\n position: 'absolute',\n width: '1px',\n height: '1px',\n padding: '0',\n margin: '-1px',\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n 'white-space': 'nowrap',\n border: '0',\n },\n onChange: (e: Event) => {\n const target = e.target as HTMLInputElement;\n state.setValue(parseFloat(target.value));\n },\n } as JSX.InputHTMLAttributes<HTMLInputElement>;\n },\n get outputProps() {\n return {\n id: outputId,\n 'for': inputId,\n 'aria-live': 'off',\n } as JSX.HTMLAttributes<HTMLElement>;\n },\n };\n}\n", "/**\n * createTooltip hook for Solidaria\n *\n * Provides the accessibility implementation for a Tooltip component.\n *\n * Port of @react-aria/tooltip useTooltip.\n */\n\nimport { type JSX } from 'solid-js';\nimport { type TooltipTriggerState } from '@proyecto-viviana/solid-stately';\nimport { createHover } from '../interactions/createHover';\nimport { filterDOMProps, mergeProps } from '../utils';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface TooltipProps {\n /** Whether the tooltip is disabled. */\n isDisabled?: boolean;\n /** Custom aria-label for the tooltip. */\n 'aria-label'?: string;\n /** ID of an element that labels the tooltip. */\n 'aria-labelledby'?: string;\n /** ID of an element that describes the tooltip. */\n 'aria-describedby'?: string;\n}\n\nexport interface TooltipAria {\n /** Props to spread on the tooltip element. */\n tooltipProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the accessibility implementation for a Tooltip component.\n *\n * When hovering over the tooltip itself, it stays open. When the mouse leaves\n * the tooltip, it closes.\n *\n * @example\n * ```tsx\n * import { createTooltip } from 'solidaria';\n * import { createTooltipTriggerState } from 'solid-stately';\n *\n * function Tooltip(props) {\n * const state = props.state;\n * const { tooltipProps } = createTooltip(props, state);\n *\n * return (\n * <div {...tooltipProps} role=\"tooltip\">\n * {props.children}\n * </div>\n * );\n * }\n * ```\n */\nexport function createTooltip(\n props: TooltipProps = {},\n state?: TooltipTriggerState\n): TooltipAria {\n const domProps = filterDOMProps(props, { labelable: true });\n\n const { hoverProps } = createHover({\n onHoverStart: () => state?.open(true),\n onHoverEnd: () => state?.close(),\n });\n\n return {\n tooltipProps: mergeProps<JSX.HTMLAttributes<HTMLElement>>(\n domProps,\n hoverProps,\n { role: 'tooltip' }\n ),\n };\n}\n", "/**\n * createTooltipTrigger hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a tooltip trigger,\n * e.g. a button that shows a description when focused or hovered.\n *\n * Port of @react-aria/tooltip useTooltipTrigger.\n */\n\nimport { type JSX, createEffect, onCleanup } from 'solid-js';\nimport { type TooltipTriggerState } from '@proyecto-viviana/solid-stately';\nimport { createHover } from '../interactions/createHover';\nimport { createFocusable } from '../interactions/createFocusable';\nimport { createId } from '../ssr';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface TooltipTriggerProps {\n /** Whether the tooltip should be disabled. */\n isDisabled?: boolean;\n /**\n * The trigger mechanism for the tooltip.\n * @default 'focus'\n */\n trigger?: 'focus';\n /**\n * Whether the tooltip should close when the trigger is pressed.\n * @default true\n */\n shouldCloseOnPress?: boolean;\n}\n\nexport interface TooltipTriggerAria {\n /** Props to spread on the trigger element. */\n triggerProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props to spread on the tooltip element (id for accessibility). */\n tooltipProps: { id: string };\n}\n\n// ============================================\n// GLOBAL STATE\n// ============================================\n\ntype Modality = 'keyboard' | 'pointer' | 'virtual';\nlet currentModality: Modality | null = null;\n\n// Track interaction modality (pointer vs keyboard)\nif (typeof document !== 'undefined') {\n document.addEventListener('keydown', () => {\n currentModality = 'keyboard';\n }, true);\n document.addEventListener('pointerdown', () => {\n currentModality = 'pointer';\n }, true);\n document.addEventListener('pointermove', () => {\n currentModality = 'pointer';\n }, true);\n}\n\nfunction isFocusVisible(): boolean {\n return currentModality === 'keyboard';\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the behavior and accessibility implementation for a tooltip trigger.\n *\n * @example\n * ```tsx\n * import { createTooltipTrigger } from 'solidaria';\n * import { createTooltipTriggerState } from 'solid-stately';\n *\n * function TooltipButton(props) {\n * let ref;\n * const state = createTooltipTriggerState({ delay: 500 });\n * const { triggerProps, tooltipProps } = createTooltipTrigger(\n * { isDisabled: props.isDisabled },\n * state,\n * () => ref\n * );\n *\n * return (\n * <>\n * <button ref={ref} {...triggerProps}>\n * Hover me\n * </button>\n * <Show when={state.isOpen()}>\n * <div {...tooltipProps}>Tooltip content</div>\n * </Show>\n * </>\n * );\n * }\n * ```\n */\nexport function createTooltipTrigger(\n props: TooltipTriggerProps,\n state: TooltipTriggerState,\n ref: () => HTMLElement | null | undefined\n): TooltipTriggerAria {\n const {\n isDisabled = false,\n trigger,\n shouldCloseOnPress = true,\n } = props;\n\n const tooltipId = createId();\n\n // Track hover and focus state\n let isHovered = false;\n let isFocused = false;\n\n const handleShow = () => {\n if (isHovered || isFocused) {\n state.open(isFocused);\n }\n };\n\n const handleHide = (immediate?: boolean) => {\n if (!isHovered && !isFocused) {\n state.close(immediate);\n }\n };\n\n // Handle Escape key to dismiss tooltip\n createEffect(() => {\n if (!state.isOpen()) return;\n\n const onKeyDown = (e: KeyboardEvent) => {\n const element = ref();\n if (element) {\n if (e.key === 'Escape') {\n e.stopPropagation();\n state.close(true);\n }\n }\n };\n\n document.addEventListener('keydown', onKeyDown, true);\n onCleanup(() => {\n document.removeEventListener('keydown', onKeyDown, true);\n });\n });\n\n const onHoverStart = () => {\n if (trigger === 'focus') {\n return;\n }\n // Hover events (onPointerEnter) only fire from pointer interactions,\n // so we can always set isHovered to true here\n isHovered = true;\n handleShow();\n };\n\n const onHoverEnd = () => {\n if (trigger === 'focus') {\n return;\n }\n isFocused = false;\n isHovered = false;\n handleHide();\n };\n\n const onPressStart = () => {\n if (!shouldCloseOnPress) {\n return;\n }\n isFocused = false;\n isHovered = false;\n handleHide(true);\n };\n\n const onFocus = () => {\n const visible = isFocusVisible();\n if (visible) {\n isFocused = true;\n handleShow();\n }\n };\n\n const onBlur = () => {\n isFocused = false;\n isHovered = false;\n handleHide(true);\n };\n\n const { hoverProps } = createHover({\n isDisabled,\n onHoverStart,\n onHoverEnd,\n });\n\n const { focusableProps } = createFocusable({\n isDisabled,\n onFocus,\n onBlur,\n });\n\n const triggerProps = {\n ...focusableProps,\n ...hoverProps,\n get 'aria-describedby'() {\n return state.isOpen() ? tooltipId : undefined;\n },\n onPointerDown: onPressStart,\n onKeyDown: onPressStart,\n // Remove tabIndex set by focusableProps to avoid overriding\n tabIndex: undefined,\n };\n\n return {\n triggerProps: triggerProps as JSX.HTMLAttributes<HTMLElement>,\n tooltipProps: {\n id: tooltipId,\n },\n };\n}\n", "/**\n * Provides the behavior and accessibility implementation for a combobox component.\n * A combobox combines a text input with a listbox, allowing users to filter a list of options.\n * Based on @react-aria/combobox useComboBox.\n */\n\nimport { type JSX, type Accessor, createEffect, onCleanup } from 'solid-js';\nimport { isServer } from 'solid-js/web';\nimport { createPress } from '../interactions/createPress';\nimport { createFocusRing } from '../interactions/createFocusRing';\nimport { createLabel } from '../label/createLabel';\nimport { filterDOMProps } from '../utils/filterDOMProps';\nimport { mergeProps } from '../utils/mergeProps';\nimport { createId } from '../ssr';\nimport { access, type MaybeAccessor } from '../utils/reactivity';\nimport { isAppleDevice } from '../utils/platform';\nimport { openLink } from '../utils/dom';\nimport { ariaHideOutside } from '../overlays/ariaHideOutside';\nimport { announce } from '../live-announcer';\nimport { createStringFormatter } from '../i18n';\nimport { comboBoxIntlStrings } from './intl';\nimport { isDevEnv } from '../utils/env';\nimport type { ComboBoxState, CollectionNode, Key } from '@proyecto-viviana/solid-stately';\n\n/**\n * Helper to count items in a collection\n */\nfunction getItemCount<T>(collection: { getKeys(): Iterable<Key> }): number {\n let count = 0;\n for (const _ of collection.getKeys()) {\n count++;\n }\n return count;\n}\n\nexport interface AriaComboBoxProps {\n /** An ID for the combobox. */\n id?: string;\n /** Whether the combobox is disabled. */\n isDisabled?: boolean;\n /** Whether the combobox is required. */\n isRequired?: boolean;\n /** Whether the combobox is read-only. */\n isReadOnly?: boolean;\n /** The label for the combobox. */\n label?: JSX.Element;\n /** An accessible label for the combobox when no visible label is provided. */\n 'aria-label'?: string;\n /** The ID of an element that labels the combobox. */\n 'aria-labelledby'?: string;\n /** The ID of an element that describes the combobox. */\n 'aria-describedby'?: string;\n /** Placeholder text for the input when no value is entered. */\n placeholder?: string;\n /** Whether the combobox should be auto-focused. */\n autoFocus?: boolean;\n /** Handler called when focus moves to the combobox input. */\n onFocus?: (e: FocusEvent) => void;\n /** Handler called when focus moves away from the combobox input. */\n onBlur?: (e: FocusEvent) => void;\n /** Handler called when the focus state changes. */\n onFocusChange?: (isFocused: boolean) => void;\n /** The name of the combobox, used when submitting an HTML form. */\n name?: string;\n /**\n * Describes the type of autocomplete functionality the input should provide.\n * @default 'list'\n */\n autoComplete?: 'list' | 'none' | 'inline' | 'both';\n /** Whether focus should wrap from the last item to the first. */\n shouldFocusWrap?: boolean;\n}\n\nexport interface ComboBoxAria<T> {\n /** Props for the label element. */\n labelProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the input element. */\n inputProps: JSX.InputHTMLAttributes<HTMLInputElement>;\n /** Props for the trigger button element. */\n buttonProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the listbox popup. */\n listBoxProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the description element, if any. */\n descriptionProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the error message element, if any. */\n errorMessageProps: JSX.HTMLAttributes<HTMLElement>;\n /** Whether the input is currently focused. */\n isFocused: Accessor<boolean>;\n /** Whether the input has keyboard focus. */\n isFocusVisible: Accessor<boolean>;\n /** Whether the listbox is currently open. */\n isOpen: Accessor<boolean>;\n /** The currently selected item. */\n selectedItem: Accessor<CollectionNode<T> | null>;\n}\n\n// Shared data between combobox and options\nconst comboBoxData = new WeakMap<object, ComboBoxData>();\n\ninterface ComboBoxData {\n id: string;\n}\n\nexport function getComboBoxData(state: ComboBoxState<unknown>): ComboBoxData | undefined {\n return comboBoxData.get(state);\n}\n\n/**\n * Provides the behavior and accessibility implementation for a combobox component.\n */\nexport function createComboBox<T>(\n props: MaybeAccessor<AriaComboBoxProps>,\n state: ComboBoxState<T>,\n inputRef: () => HTMLInputElement | null,\n buttonRef?: () => HTMLElement | null,\n listBoxRef?: () => HTMLElement | null\n): ComboBoxAria<T> {\n const getProps = () => access(props);\n const id = createId(getProps().id);\n\n // Development-time warning for missing accessibility labels\n if (isDevEnv()) {\n const p = getProps();\n if (!p.label && !p['aria-label'] && !p['aria-labelledby']) {\n console.warn(\n '[solidaria] A ComboBox requires a label, aria-label, or aria-labelledby attribute for accessibility.'\n );\n }\n }\n\n // Track if a pointerdown happened inside the listbox to prevent blur from closing\n let isPointerDownInsideListBox = false;\n\n // Generate IDs for associated elements\n const inputId = `${id}-input`;\n const buttonId = `${id}-button`;\n const listBoxId = `${id}-listbox`;\n const descriptionId = `${id}-description`;\n const errorMessageId = `${id}-error`;\n\n // Set up global pointerdown listener to track clicks inside listbox\n // This is needed because the option's createPress stops propagation\n createEffect(() => {\n if (typeof document === 'undefined') return;\n\n const handleGlobalPointerDown = (e: PointerEvent) => {\n const target = e.target as HTMLElement;\n // Check if the click is inside the listbox\n if (target.closest(`[id=\"${listBoxId}\"]`)) {\n isPointerDownInsideListBox = true;\n }\n };\n\n document.addEventListener('pointerdown', handleGlobalPointerDown, true);\n\n onCleanup(() => {\n document.removeEventListener('pointerdown', handleGlobalPointerDown, true);\n });\n });\n\n // Filter DOM props\n const domProps = () =>\n filterDOMProps(getProps() as unknown as Record<string, unknown>, { labelable: true });\n\n // Share data with child options\n createEffect(() => {\n comboBoxData.set(state, { id });\n\n onCleanup(() => {\n comboBoxData.delete(state);\n });\n });\n\n // Label handling\n const { labelProps, fieldProps } = createLabel({\n get id() {\n return inputId;\n },\n get label() {\n return getProps().label;\n },\n get 'aria-label'() {\n return getProps()['aria-label'];\n },\n get 'aria-labelledby'() {\n return getProps()['aria-labelledby'];\n },\n labelElementType: 'label',\n });\n\n // Focus ring for keyboard focus styling\n const { isFocusVisible, focusProps } = createFocusRing({\n get autoFocus() {\n return getProps().autoFocus;\n },\n });\n\n // Track focus state from state\n const isFocused = state.isFocused;\n\n // String formatter for VoiceOver announcements\n // Only create on client side\n const stringFormatter = !isServer ? createStringFormatter(comboBoxIntlStrings) : null;\n\n // Track previous values for announcements\n let lastFocusedKey: Key | null = null;\n let lastSelectedKey: Key | null = null;\n let lastOptionCount = 0;\n let lastIsOpen = false;\n\n // VoiceOver has issues with announcing aria-activedescendant properly on change\n // (especially on iOS). We use a live region announcer to announce focus changes\n // manually. This matches React Aria's behavior.\n createEffect(() => {\n if (isServer || !stringFormatter) return;\n\n const focusedKey = state.focusedKey();\n const isOpen = state.isOpen();\n const collection = state.collection();\n\n // Get the focused item\n const focusedItem = focusedKey != null && isOpen\n ? collection.getItem(focusedKey)\n : null;\n\n // Announce focus changes on Apple devices\n if (isAppleDevice() && focusedItem != null && focusedKey !== lastFocusedKey) {\n const isSelected = state.selectedKey() === focusedKey;\n const optionText = focusedItem.textValue || '';\n\n // For now, we don't support sections, so isGroupChange is always false\n const announcement = stringFormatter().format('focusAnnouncement', {\n isGroupChange: false,\n groupTitle: '',\n groupCount: 0,\n optionText,\n isSelected,\n });\n\n announce(announcement, 'polite');\n }\n\n lastFocusedKey = focusedKey;\n });\n\n // Announce the number of available suggestions when it changes\n createEffect(() => {\n if (isServer || !stringFormatter) return;\n\n const isOpen = state.isOpen();\n const collection = state.collection();\n const optionCount = getItemCount(collection);\n const focusedKey = state.focusedKey();\n\n // Only announce the number of options available when the menu opens if there is no\n // focused item, otherwise screen readers will typically read e.g. \"1 of 6\".\n // The exception is VoiceOver since this isn't included in the message above.\n const didOpenWithoutFocusedItem =\n isOpen !== lastIsOpen &&\n (focusedKey == null || isAppleDevice());\n\n if (isOpen && (didOpenWithoutFocusedItem || optionCount !== lastOptionCount)) {\n const announcement = stringFormatter().format('countAnnouncement', { optionCount });\n announce(announcement, 'polite');\n }\n\n lastOptionCount = optionCount;\n lastIsOpen = isOpen;\n });\n\n // Announce when a selection occurs for VoiceOver. Other screen readers typically do this automatically.\n createEffect(() => {\n if (isServer || !stringFormatter) return;\n\n const selectedKey = state.selectedKey();\n const selectedItem = state.selectedItem();\n\n if (isAppleDevice() && state.isFocused() && selectedItem && selectedKey !== lastSelectedKey) {\n const optionText = selectedItem.textValue || '';\n const announcement = stringFormatter().format('selectedAnnouncement', { optionText });\n announce(announcement, 'polite');\n }\n\n lastSelectedKey = selectedKey;\n });\n\n // Hide other page content from screen readers when the listbox is open.\n // This requires both the input and listbox refs to be available.\n // Note: This feature is important for screen reader accessibility but\n // only works when a popoverRef/listBoxRef is provided.\n createEffect(() => {\n if (isServer) return;\n\n const isOpen = state.isOpen();\n const inputEl = inputRef();\n const listBoxEl = listBoxRef?.();\n\n // Only apply ariaHideOutside if we have both elements available\n // This ensures the listbox won't be accidentally hidden\n if (isOpen && inputEl && listBoxEl) {\n const cleanup = ariaHideOutside([inputEl, listBoxEl]);\n onCleanup(cleanup);\n }\n });\n\n // Handle press on button trigger\n const { pressProps } = createPress({\n get isDisabled() {\n return getProps().isDisabled ?? state.isDisabled;\n },\n onPress() {\n state.toggle(null, 'manual');\n // Focus input after toggling\n inputRef()?.focus();\n },\n });\n\n // Handle input change\n const onInputChange: JSX.EventHandler<HTMLInputElement, InputEvent> = (e) => {\n const target = e.target as HTMLInputElement;\n state.setInputValue(target.value);\n };\n\n // Keyboard navigation for input\n const onInputKeyDown: JSX.EventHandler<HTMLInputElement, KeyboardEvent> = (e) => {\n const p = getProps();\n if (p.isDisabled || p.isReadOnly) return;\n\n const collection = state.collection();\n const focusedKey = state.focusedKey();\n const shouldWrap = p.shouldFocusWrap ?? false;\n\n switch (e.key) {\n case 'Enter':\n if (state.isOpen() && focusedKey != null) {\n e.preventDefault();\n\n // Check if the focused item is a link\n // Link href can be in props (for components) or value (for dynamic items)\n const collectionItem = collection.getItem(focusedKey);\n const itemHref = collectionItem?.props?.href ?? (collectionItem?.value as Record<string, unknown> | null)?.href;\n if (itemHref) {\n // Find the actual anchor element in the DOM and trigger navigation\n const listBox = listBoxRef?.();\n if (listBox) {\n const item = listBox.querySelector(\n `[data-key=\"${CSS.escape(String(focusedKey))}\"]`\n );\n if (item instanceof HTMLAnchorElement) {\n openLink(item, e);\n }\n }\n state.close();\n } else {\n state.commit();\n }\n }\n break;\n\n case 'Escape':\n if (state.isOpen()) {\n e.preventDefault();\n e.stopPropagation();\n state.revert();\n }\n break;\n\n case 'ArrowDown':\n e.preventDefault();\n if (!state.isOpen()) {\n state.open('first', 'manual');\n } else {\n // Move to next item\n if (focusedKey == null) {\n const firstKey = collection.getFirstKey();\n if (firstKey != null) {\n state.setFocusedKey(firstKey);\n }\n } else {\n let nextKey = collection.getKeyAfter(focusedKey);\n // Skip disabled keys\n while (nextKey != null && state.isKeyDisabled(nextKey)) {\n nextKey = collection.getKeyAfter(nextKey);\n }\n if (nextKey != null) {\n state.setFocusedKey(nextKey);\n } else if (shouldWrap) {\n // Wrap to first\n let firstKey = collection.getFirstKey();\n while (firstKey != null && state.isKeyDisabled(firstKey)) {\n firstKey = collection.getKeyAfter(firstKey);\n }\n if (firstKey != null) {\n state.setFocusedKey(firstKey);\n }\n }\n }\n }\n break;\n\n case 'ArrowUp':\n e.preventDefault();\n if (!state.isOpen()) {\n state.open('last', 'manual');\n } else {\n // Move to previous item\n if (focusedKey == null) {\n const lastKey = collection.getLastKey();\n if (lastKey != null) {\n state.setFocusedKey(lastKey);\n }\n } else {\n let prevKey = collection.getKeyBefore(focusedKey);\n // Skip disabled keys\n while (prevKey != null && state.isKeyDisabled(prevKey)) {\n prevKey = collection.getKeyBefore(prevKey);\n }\n if (prevKey != null) {\n state.setFocusedKey(prevKey);\n } else if (shouldWrap) {\n // Wrap to last\n let lastKey = collection.getLastKey();\n while (lastKey != null && state.isKeyDisabled(lastKey)) {\n lastKey = collection.getKeyBefore(lastKey);\n }\n if (lastKey != null) {\n state.setFocusedKey(lastKey);\n }\n }\n }\n }\n break;\n\n case 'Home':\n if (state.isOpen()) {\n e.preventDefault();\n let firstKey = collection.getFirstKey();\n while (firstKey != null && state.isKeyDisabled(firstKey)) {\n firstKey = collection.getKeyAfter(firstKey);\n }\n if (firstKey != null) {\n state.setFocusedKey(firstKey);\n }\n }\n break;\n\n case 'End':\n if (state.isOpen()) {\n e.preventDefault();\n let lastKey = collection.getLastKey();\n while (lastKey != null && state.isKeyDisabled(lastKey)) {\n lastKey = collection.getKeyBefore(lastKey);\n }\n if (lastKey != null) {\n state.setFocusedKey(lastKey);\n }\n }\n break;\n\n case 'Tab':\n // Commit on Tab if menu is open\n if (state.isOpen() && focusedKey != null) {\n state.commit();\n }\n break;\n }\n };\n\n // Handle focus events\n const handleFocus = (e: FocusEvent) => {\n state.setFocused(true);\n getProps().onFocus?.(e);\n getProps().onFocusChange?.(true);\n };\n\n // Track the last touch event time for iPad VoiceOver double-tap debouncing\n let lastEventTime = 0;\n\n const handleBlur = (e: FocusEvent) => {\n // Use synchronous ref checks instead of requestAnimationFrame\n // This matches React Aria's implementation and is more reliable\n const relatedTarget = e.relatedTarget as HTMLElement | null;\n const button = buttonRef?.();\n const listBox = listBoxRef?.();\n\n // Don't blur if focus is moving to the button\n const blurFromButton = button && button === relatedTarget;\n\n // Don't blur if focus is moving into the listbox/popover\n const blurIntoPopover = listBox?.contains(relatedTarget);\n\n if (blurFromButton || blurIntoPopover) {\n return;\n }\n\n // If a pointerdown happened inside the listbox, don't close\n // This handles the case when clicking on a non-focusable option\n if (isPointerDownInsideListBox) {\n isPointerDownInsideListBox = false;\n return;\n }\n\n // Call user's onBlur handler\n getProps().onBlur?.(e);\n\n state.setFocused(false);\n getProps().onFocusChange?.(false);\n };\n\n // Handle touch events for iPad VoiceOver\n // VoiceOver on iOS fires a touchend at the center of the element on double-tap.\n // We detect this and toggle the combobox manually to avoid issues with focus management.\n const handleTouchEnd = (e: TouchEvent) => {\n const p = getProps();\n const isDisabled = p.isDisabled ?? state.isDisabled;\n const isReadOnly = p.isReadOnly ?? state.isReadOnly;\n\n if (isDisabled || isReadOnly) {\n return;\n }\n\n // Debounce rapid consecutive touchend events (< 500ms)\n // This handles VoiceOver's double-tap behavior\n if (e.timeStamp - lastEventTime < 500) {\n e.preventDefault();\n inputRef()?.focus();\n return;\n }\n\n // Detect VoiceOver virtual click - it fires at the exact center of the element\n const rect = (e.target as Element).getBoundingClientRect();\n const touch = e.changedTouches[0];\n const centerX = Math.ceil(rect.left + 0.5 * rect.width);\n const centerY = Math.ceil(rect.top + 0.5 * rect.height);\n\n if (touch.clientX === centerX && touch.clientY === centerY) {\n e.preventDefault();\n inputRef()?.focus();\n state.toggle(null, 'manual');\n lastEventTime = e.timeStamp;\n }\n };\n\n return {\n get labelProps() {\n return labelProps as JSX.HTMLAttributes<HTMLElement>;\n },\n get inputProps() {\n const p = getProps();\n const isOpen = state.isOpen();\n const isDisabled = p.isDisabled ?? state.isDisabled;\n const isReadOnly = p.isReadOnly ?? state.isReadOnly;\n const focusedKey = state.focusedKey();\n\n return mergeProps(\n domProps(),\n focusProps as Record<string, unknown>,\n fieldProps as Record<string, unknown>,\n {\n id: inputId,\n type: 'text',\n role: 'combobox',\n get value() {\n return state.inputValue();\n },\n tabIndex: isDisabled ? undefined : 0,\n disabled: isDisabled || undefined,\n readOnly: isReadOnly || undefined,\n placeholder: p.placeholder,\n autoComplete: 'off',\n 'aria-autocomplete': p.autoComplete ?? 'list',\n 'aria-haspopup': 'listbox',\n 'aria-expanded': isOpen,\n 'aria-controls': isOpen ? listBoxId : undefined,\n 'aria-activedescendant': isOpen && focusedKey != null\n ? `${listBoxId}-option-${focusedKey}`\n : undefined,\n 'aria-disabled': isDisabled || undefined,\n 'aria-required': p.isRequired || undefined,\n 'aria-describedby': p['aria-describedby'] || undefined,\n name: p.name,\n onInput: onInputChange,\n onKeyDown: onInputKeyDown,\n onFocus: handleFocus,\n onBlur: handleBlur,\n onTouchEnd: handleTouchEnd,\n 'data-open': isOpen || undefined,\n 'data-disabled': isDisabled || undefined,\n 'data-readonly': isReadOnly || undefined,\n 'data-focus-visible': isFocusVisible() || undefined,\n } as Record<string, unknown>\n ) as JSX.InputHTMLAttributes<HTMLInputElement>;\n },\n get buttonProps() {\n const p = getProps();\n const isOpen = state.isOpen();\n const isDisabled = p.isDisabled ?? state.isDisabled;\n\n return mergeProps(\n pressProps as Record<string, unknown>,\n {\n id: buttonId,\n type: 'button',\n tabIndex: -1,\n 'aria-haspopup': 'listbox',\n 'aria-expanded': isOpen,\n 'aria-controls': isOpen ? listBoxId : undefined,\n 'aria-disabled': isDisabled || undefined,\n 'aria-label': stringFormatter?.().format('buttonLabel') ?? 'Show suggestions',\n 'data-open': isOpen || undefined,\n 'data-disabled': isDisabled || undefined,\n } as Record<string, unknown>\n ) as JSX.HTMLAttributes<HTMLElement>;\n },\n get listBoxProps() {\n return {\n id: listBoxId,\n role: 'listbox',\n 'aria-labelledby': inputId,\n tabIndex: -1,\n // Track pointerdown inside listbox to prevent blur from closing\n // Use capture phase because createPress calls stopPropagation on pointerdown\n onPointerDownCapture: () => {\n isPointerDownInsideListBox = true;\n },\n onMouseDownCapture: () => {\n // Fallback for environments without PointerEvent\n isPointerDownInsideListBox = true;\n },\n } as JSX.HTMLAttributes<HTMLElement>;\n },\n get descriptionProps() {\n return {\n id: descriptionId,\n } as JSX.HTMLAttributes<HTMLElement>;\n },\n get errorMessageProps() {\n return {\n id: errorMessageId,\n } as JSX.HTMLAttributes<HTMLElement>;\n },\n isFocused,\n isFocusVisible: () => isFocused() && isFocusVisible(),\n isOpen: state.isOpen,\n selectedItem: state.selectedItem,\n };\n}\n", "/**\n * Live announcer for solidaria\n *\n * Provides functions to make announcements to screen readers using\n * ARIA live regions. Useful for announcing dynamic content changes.\n *\n * Port of react-aria's @react-aria/live-announcer.\n *\n * SSR Safety: All functions are safe to call during SSR. The announcer\n * will only be created when running in the browser.\n */\n\nimport { onCleanup, createEffect } from 'solid-js';\nimport { isServer } from 'solid-js/web';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport type Assertiveness = 'assertive' | 'polite';\n\nexport type Message = string | { 'aria-labelledby': string };\n\n// ============================================\n// CONSTANTS\n// ============================================\n\nconst LIVEREGION_TIMEOUT_DELAY = 7000;\n\n// ============================================\n// LIVE ANNOUNCER CLASS\n// ============================================\n\n/**\n * Singleton class that manages live region announcements.\n * Implemented using vanilla DOM for simplicity and framework independence.\n */\nclass LiveAnnouncer {\n node: HTMLElement | null = null;\n assertiveLog: HTMLElement | null = null;\n politeLog: HTMLElement | null = null;\n\n constructor() {\n if (typeof document !== 'undefined') {\n this.node = document.createElement('div');\n this.node.dataset.liveAnnouncer = 'true';\n // Visually hidden styles\n Object.assign(this.node.style, {\n border: '0',\n clip: 'rect(0 0 0 0)',\n clipPath: 'inset(50%)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: '0',\n position: 'absolute',\n width: '1px',\n whiteSpace: 'nowrap',\n });\n\n this.assertiveLog = this.createLog('assertive');\n this.node.appendChild(this.assertiveLog);\n\n this.politeLog = this.createLog('polite');\n this.node.appendChild(this.politeLog);\n\n document.body.prepend(this.node);\n }\n }\n\n isAttached(): boolean {\n return this.node?.isConnected ?? false;\n }\n\n createLog(ariaLive: string): HTMLElement {\n const node = document.createElement('div');\n node.setAttribute('role', 'log');\n node.setAttribute('aria-live', ariaLive);\n node.setAttribute('aria-relevant', 'additions');\n return node;\n }\n\n destroy(): void {\n if (!this.node) {\n return;\n }\n\n document.body.removeChild(this.node);\n this.node = null;\n }\n\n announce(\n message: Message,\n assertiveness: Assertiveness = 'assertive',\n timeout: number = LIVEREGION_TIMEOUT_DELAY\n ): void {\n if (!this.node) {\n return;\n }\n\n const node = document.createElement('div');\n if (typeof message === 'object') {\n // To read an aria-labelledby, the element must have an appropriate role, such as img.\n node.setAttribute('role', 'img');\n node.setAttribute('aria-labelledby', message['aria-labelledby']);\n } else {\n node.textContent = message;\n }\n\n if (assertiveness === 'assertive') {\n this.assertiveLog?.appendChild(node);\n } else {\n this.politeLog?.appendChild(node);\n }\n\n if (message !== '') {\n setTimeout(() => {\n node.remove();\n }, timeout);\n }\n }\n\n clear(assertiveness?: Assertiveness): void {\n if (!this.node) {\n return;\n }\n\n if ((!assertiveness || assertiveness === 'assertive') && this.assertiveLog) {\n this.assertiveLog.innerHTML = '';\n }\n\n if ((!assertiveness || assertiveness === 'polite') && this.politeLog) {\n this.politeLog.innerHTML = '';\n }\n }\n}\n\n// ============================================\n// SINGLETON INSTANCE\n// ============================================\n\nlet liveAnnouncer: LiveAnnouncer | null = null;\n\n// ============================================\n// PUBLIC API\n// ============================================\n\n/**\n * Announces a message to screen readers using ARIA live regions.\n *\n * @param message - The message to announce, or an object with aria-labelledby\n * @param assertiveness - 'assertive' interrupts, 'polite' waits for a pause\n * @param timeout - How long to keep the message in the DOM (default 7000ms)\n *\n * @example\n * ```tsx\n * // Simple announcement\n * announce('Item added to cart');\n *\n * // Polite announcement (won't interrupt)\n * announce('3 results found', 'polite');\n *\n * // Using aria-labelledby for complex content\n * announce({ 'aria-labelledby': 'my-element-id' });\n * ```\n */\nexport function announce(\n message: Message,\n assertiveness: Assertiveness = 'assertive',\n timeout: number = LIVEREGION_TIMEOUT_DELAY\n): void {\n if (!liveAnnouncer) {\n liveAnnouncer = new LiveAnnouncer();\n // Wait for the live announcer regions to be added to the DOM, then announce.\n // Otherwise Safari won't announce the message if it's added too quickly.\n // Found most times less than 100ms were not consistent when announcing with Safari.\n\n // Check for test environment\n const isTestEnv = typeof (globalThis as Record<string, unknown>).IS_SOLIDARIA_TEST === 'boolean'\n ? (globalThis as Record<string, unknown>).IS_SOLIDARIA_TEST\n : typeof (globalThis as Record<string, unknown>).vitest !== 'undefined';\n\n if (!isTestEnv) {\n setTimeout(() => {\n if (liveAnnouncer?.isAttached()) {\n liveAnnouncer?.announce(message, assertiveness, timeout);\n }\n }, 100);\n } else {\n liveAnnouncer.announce(message, assertiveness, timeout);\n }\n } else {\n liveAnnouncer.announce(message, assertiveness, timeout);\n }\n}\n\n/**\n * Clears all queued announcements for the given assertiveness level.\n *\n * @param assertiveness - Which log to clear ('assertive' or 'polite')\n *\n * @example\n * ```tsx\n * // Clear assertive announcements\n * clearAnnouncer('assertive');\n *\n * // Clear polite announcements\n * clearAnnouncer('polite');\n * ```\n */\nexport function clearAnnouncer(assertiveness?: Assertiveness): void {\n if (liveAnnouncer) {\n liveAnnouncer.clear(assertiveness);\n }\n}\n\n/**\n * Removes the live announcer from the DOM entirely.\n * Call this when unmounting your app or when announcements are no longer needed.\n *\n * @example\n * ```tsx\n * // Clean up on app unmount\n * onCleanup(() => {\n * destroyAnnouncer();\n * });\n * ```\n */\nexport function destroyAnnouncer(): void {\n if (liveAnnouncer) {\n liveAnnouncer.destroy();\n liveAnnouncer = null;\n }\n}\n\n// ============================================\n// HOOK-BASED API\n// ============================================\n\nexport interface UseAnnouncerResult {\n /** Announce a message to screen readers. */\n announce: (\n message: Message,\n assertiveness?: Assertiveness,\n timeout?: number\n ) => void;\n /** Clear announcements for the given assertiveness level. */\n clear: (assertiveness?: Assertiveness) => void;\n}\n\n/**\n * Hook that provides access to the live announcer with automatic cleanup.\n *\n * This is the recommended way to use the announcer in SolidJS components.\n * It ensures the announcer is created only on the client and provides\n * type-safe methods for announcing and clearing messages.\n *\n * SSR Safety: Returns no-op functions during SSR. The announcer is only\n * created when the component mounts on the client.\n *\n * @example\n * ```tsx\n * function SearchResults(props) {\n * const announcer = useAnnouncer();\n *\n * createEffect(() => {\n * const count = props.results.length;\n * announcer.announce(`${count} results found`, 'polite');\n * });\n *\n * return <ul>...</ul>;\n * }\n * ```\n *\n * @example\n * ```tsx\n * function Form() {\n * const announcer = useAnnouncer();\n *\n * const onSubmit = async () => {\n * try {\n * await submitForm();\n * announcer.announce('Form submitted successfully');\n * } catch (error) {\n * announcer.announce('Error submitting form', 'assertive');\n * }\n * };\n *\n * return <form onSubmit={onSubmit}>...</form>;\n * }\n * ```\n */\nexport function useAnnouncer(): UseAnnouncerResult {\n // During SSR, return no-op functions\n if (isServer) {\n return {\n announce: () => {},\n clear: () => {},\n };\n }\n\n // Ensure the announcer is initialized\n createEffect(() => {\n // Initialize on first use\n if (!liveAnnouncer) {\n liveAnnouncer = new LiveAnnouncer();\n }\n });\n\n return {\n announce: (\n message: Message,\n assertiveness: Assertiveness = 'assertive',\n timeout: number = LIVEREGION_TIMEOUT_DELAY\n ) => {\n announce(message, assertiveness, timeout);\n },\n clear: (assertiveness?: Assertiveness) => {\n clearAnnouncer(assertiveness);\n },\n };\n}\n", "{\n \"focusAnnouncement\": \"{isGroupChange, select, true {Entered group {groupTitle}, with {groupCount, plural, one {# option} other {# options}}. } other {}}{optionText}{isSelected, select, true {, selected} other {}}\",\n \"countAnnouncement\": \"{optionCount, plural, one {# option} other {# options}} available.\",\n \"selectedAnnouncement\": \"{optionText}, selected\",\n \"buttonLabel\": \"Show suggestions\",\n \"listboxLabel\": \"Suggestions\"\n}\n", "{\n \"focusAnnouncement\": \"{isGroupChange, select, true {Grupo {groupTitle} activado, con {groupCount, plural, one {# opci\u00F3n} other {# opciones}}. } other {}}{optionText}{isSelected, select, true {, seleccionado} other {}}\",\n \"countAnnouncement\": \"{optionCount, plural, one {# opci\u00F3n disponible} other {# opciones disponibles}}.\",\n \"selectedAnnouncement\": \"{optionText}, seleccionado\",\n \"buttonLabel\": \"Mostrar sugerencias\",\n \"listboxLabel\": \"Sugerencias\"\n}\n", "/**\n * ComboBox internationalization strings\n * Based on @react-aria/combobox/intl\n */\n\nimport type { LocalizedStrings } from '@internationalized/string';\n\n// Import locale files\nimport enUS from './en-US.json' with { type: 'json' };\nimport esES from './es-ES.json' with { type: 'json' };\n\nexport type ComboBoxIntlStrings = {\n focusAnnouncement: string;\n countAnnouncement: string;\n selectedAnnouncement: string;\n buttonLabel: string;\n listboxLabel: string;\n};\n\nexport const comboBoxIntlStrings: LocalizedStrings<keyof ComboBoxIntlStrings, string> = {\n 'en-US': enUS,\n 'es-ES': esES,\n};\n", "/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/**\n * Ported from React Aria:\n * https://github.com/adobe/react-spectrum/blob/main/packages/@react-aria/dialog/src/useDialog.ts\n */\n\nimport { Accessor, createEffect, createMemo, createSignal, createUniqueId, onCleanup } from 'solid-js'\nimport { filterDOMProps, focusSafely } from '../utils'\nimport type { AriaLabelingProps, DOMProps } from './types'\n\nexport interface AriaDialogProps extends DOMProps, AriaLabelingProps {\n /**\n * The role of the dialog element.\n * @default 'dialog'\n */\n role?: 'dialog' | 'alertdialog'\n}\n\nexport interface DialogAria {\n /** Props for the dialog container element. */\n dialogProps: Accessor<Record<string, any>>\n\n /** Props for the dialog title element. */\n titleProps: Accessor<Record<string, any>>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a dialog component.\n * A dialog is an overlay shown above other content in an application.\n */\nexport function createDialog(\n props: AriaDialogProps | Accessor<AriaDialogProps>,\n ref: Accessor<HTMLElement | undefined>\n): DialogAria {\n // Support both direct props and accessor pattern\n const getProps = typeof props === 'function' ? props : () => props\n\n const role = () => getProps().role ?? 'dialog'\n const generatedTitleId = createUniqueId()\n const [isRefocusing, setIsRefocusing] = createSignal(false)\n\n const titleId = createMemo(() => {\n const p = getProps()\n // Use provided aria-labelledby, or generated ID if no aria-label\n if (p['aria-labelledby']) return undefined\n return p['aria-label'] ? undefined : generatedTitleId\n })\n\n // Focus the dialog itself on mount, unless a child element is already focused.\n // Only run on the client (SSR-safe)\n createEffect(() => {\n // Guard against SSR - document is not available on the server\n if (typeof document === 'undefined') return\n\n const dialogEl = ref()\n if (dialogEl && !dialogEl.contains(document.activeElement)) {\n focusSafely(dialogEl)\n\n // Safari on iOS does not move the VoiceOver cursor to the dialog\n // or announce that it has opened until it has rendered. A workaround\n // is to wait for half a second, then blur and re-focus the dialog.\n const timeout = setTimeout(() => {\n // Check that the dialog is still focused, or focused was lost to the body.\n if (document.activeElement === dialogEl || document.activeElement === document.body) {\n setIsRefocusing(true)\n dialogEl.blur()\n focusSafely(dialogEl)\n setIsRefocusing(false)\n }\n }, 500)\n\n onCleanup(() => {\n clearTimeout(timeout)\n })\n }\n })\n\n // Note: Focus containment is typically handled by createModal at a higher level\n // For standalone dialogs, focus containment should be managed by the overlay system\n\n const dialogProps = createMemo(() => {\n const p = getProps()\n return {\n ...filterDOMProps(p),\n role: role(),\n tabIndex: -1,\n 'aria-label': p['aria-label'],\n 'aria-labelledby': p['aria-labelledby'] || titleId(),\n 'aria-describedby': p['aria-describedby'],\n // Prevent blur events from reaching createOverlay, which may cause\n // popovers to close. Since focus is contained within the dialog,\n // we don't want this to occur due to the above createEffect.\n onBlur: (e: FocusEvent) => {\n if (isRefocusing()) {\n e.stopPropagation()\n }\n }\n }\n })\n\n const titlePropsValue = createMemo(() => ({\n id: titleId()\n }))\n\n return {\n dialogProps,\n titleProps: titlePropsValue\n }\n}\n", "/**\n * createToast hook for Solidaria\n *\n * Provides the accessibility implementation for a Toast component.\n *\n * Port of @react-aria/toast useToast.\n */\n\nimport { type JSX, createMemo } from 'solid-js';\nimport { type QueuedToast, type ToastState } from '@proyecto-viviana/solid-stately';\nimport { createId } from '../ssr';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaToastProps<T> {\n /** The toast to display. */\n toast: QueuedToast<T>;\n /** The toast state from createToastState. */\n state: ToastState<T>;\n}\n\nexport interface ToastAria {\n /** Props for the toast container element. */\n toastProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the toast content element (contains the message). */\n contentProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the toast title element. */\n titleProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the toast description element. */\n descriptionProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the close button. */\n closeButtonProps: JSX.ButtonHTMLAttributes<HTMLButtonElement>;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the accessibility implementation for a Toast component.\n *\n * The toast uses role=\"alertdialog\" to announce content to screen readers.\n * The content area uses role=\"alert\" for the actual message.\n *\n * @example\n * ```tsx\n * import { createToast } from 'solidaria';\n *\n * function Toast(props) {\n * const {\n * toastProps,\n * contentProps,\n * titleProps,\n * closeButtonProps\n * } = createToast({ toast: props.toast, state: props.state });\n *\n * return (\n * <div {...toastProps}>\n * <div {...contentProps}>\n * <div {...titleProps}>{props.toast.content.title}</div>\n * </div>\n * <button {...closeButtonProps}>\u00D7</button>\n * </div>\n * );\n * }\n * ```\n */\nexport function createToast<T>(props: AriaToastProps<T>): ToastAria {\n const titleId = createId();\n const descriptionId = createId();\n\n const close = () => {\n props.state.close(props.toast.key);\n };\n\n // Toast container - role=\"alertdialog\" for screen readers\n const toastProps = createMemo<JSX.HTMLAttributes<HTMLElement>>(() => ({\n role: 'alertdialog',\n 'aria-modal': 'false',\n 'aria-labelledby': titleId,\n 'aria-describedby': descriptionId,\n 'data-animation': props.toast.animation,\n 'data-key': props.toast.key,\n }));\n\n // Content area with role=\"alert\" for immediate announcement\n const contentProps = createMemo<JSX.HTMLAttributes<HTMLElement>>(() => ({\n role: 'alert',\n 'aria-atomic': 'true',\n 'aria-live': 'assertive',\n }));\n\n // Title props\n const titleProps = createMemo<JSX.HTMLAttributes<HTMLElement>>(() => ({\n id: titleId,\n }));\n\n // Description props\n const descriptionProps = createMemo<JSX.HTMLAttributes<HTMLElement>>(() => ({\n id: descriptionId,\n }));\n\n // Close button\n const closeButtonProps = createMemo<JSX.ButtonHTMLAttributes<HTMLButtonElement>>(() => ({\n 'aria-label': 'Close',\n onClick: close,\n }));\n\n return {\n get toastProps() { return toastProps(); },\n get contentProps() { return contentProps(); },\n get titleProps() { return titleProps(); },\n get descriptionProps() { return descriptionProps(); },\n get closeButtonProps() { return closeButtonProps(); },\n };\n}\n", "/**\n * createToastRegion hook for Solidaria\n *\n * Provides the accessibility implementation for a ToastRegion component.\n * The region is a landmark that contains all visible toasts.\n *\n * Port of @react-aria/toast useToastRegion.\n */\n\nimport { type JSX, createMemo } from 'solid-js';\nimport { type ToastState } from '@proyecto-viviana/solid-stately';\nimport { mergeProps } from '../utils';\nimport { createHover } from '../interactions/createHover';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaToastRegionProps<T> {\n /** The toast state from createToastState. */\n state: ToastState<T>;\n /** An accessible label for the region. */\n 'aria-label'?: string;\n}\n\nexport interface ToastRegionAria {\n /** Props for the toast region container element. */\n regionProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the accessibility implementation for a ToastRegion component.\n *\n * The region is a landmark (role=\"region\") that contains all visible toasts.\n * It pauses toast timers on hover or focus to give users time to read/interact.\n *\n * @example\n * ```tsx\n * import { createToastRegion } from 'solidaria';\n * import { For, Show } from 'solid-js';\n *\n * function ToastRegion(props) {\n * let ref;\n * const { regionProps } = createToastRegion({ state: props.state });\n *\n * return (\n * <Show when={props.state.visibleToasts().length > 0}>\n * <div {...regionProps} ref={ref}>\n * <For each={props.state.visibleToasts()}>\n * {(toast) => <Toast toast={toast} state={props.state} />}\n * </For>\n * </div>\n * </Show>\n * );\n * }\n * ```\n */\nexport function createToastRegion<T>(props: AriaToastRegionProps<T>): ToastRegionAria {\n // Pause timers on hover\n const { hoverProps } = createHover({\n onHoverStart: () => {\n props.state.pauseAll();\n },\n onHoverEnd: () => {\n props.state.resumeAll();\n },\n });\n\n // Pause timers on focus\n const handleFocus = () => {\n props.state.pauseAll();\n };\n\n const handleBlur = (e: FocusEvent) => {\n // Only resume if focus moved outside the region\n const target = e.relatedTarget as HTMLElement | null;\n const currentTarget = e.currentTarget as HTMLElement;\n if (!target || !currentTarget.contains(target)) {\n props.state.resumeAll();\n }\n };\n\n // Region props\n const regionProps = createMemo<JSX.HTMLAttributes<HTMLElement>>(() => ({\n ...hoverProps,\n role: 'region' as const,\n 'aria-label': props['aria-label'] ?? 'Notifications',\n tabIndex: -1,\n onFocusIn: handleFocus,\n onFocusOut: handleBlur,\n }));\n\n return {\n get regionProps() { return regionProps(); },\n };\n}\n", "/**\n * Provides the behavior and accessibility implementation for a popover component.\n * A popover is an overlay element positioned relative to a trigger.\n *\n * Ported from @react-aria/overlays usePopover.\n */\n\nimport { createEffect, onCleanup, type JSX } from 'solid-js';\nimport { createOverlay } from '../overlays/createOverlay';\nimport {\n createOverlayPosition,\n type AriaPositionProps,\n type PlacementAxis,\n} from './createOverlayPosition';\nimport { createPreventScroll } from '../overlays/createPreventScroll';\nimport { ariaHideOutside, keepVisible } from '../overlays/ariaHideOutside';\nimport { mergeProps } from '../utils/mergeProps';\n\nexport interface OverlayTriggerState {\n /** Whether the overlay is currently open. */\n isOpen: () => boolean;\n /** Opens the overlay. */\n open: () => void;\n /** Closes the overlay. */\n close: () => void;\n /** Toggles the overlay's open state. */\n toggle: () => void;\n}\n\nexport interface AriaPopoverProps\n extends Omit<AriaPositionProps, 'isOpen' | 'onClose' | 'targetRef' | 'overlayRef'> {\n /**\n * The ref for the element which the popover positions itself with respect to.\n */\n triggerRef: () => Element | null;\n /**\n * The ref for the popover element.\n */\n popoverRef: () => Element | null;\n /** A ref for the popover arrow element. */\n arrowRef?: () => Element | null;\n /**\n * An optional ref for a group of popovers, e.g. submenus.\n * When provided, this element is used to detect outside interactions\n * and hiding elements from assistive technologies instead of the popoverRef.\n */\n groupRef?: () => Element | null;\n /**\n * Whether the popover is non-modal, i.e. elements outside the popover may be\n * interacted with by assistive technologies.\n *\n * Most popovers should not use this option as it may negatively impact the screen\n * reader experience. Only use with components such as combobox, which are designed\n * to handle this situation carefully.\n */\n isNonModal?: boolean;\n /**\n * Whether pressing the escape key to close the popover should be disabled.\n *\n * Most popovers should not use this option. When set to true, an alternative\n * way to close the popover with a keyboard must be provided.\n *\n * @default false\n */\n isKeyboardDismissDisabled?: boolean;\n /**\n * When user interacts with the argument element outside of the popover ref,\n * return true if onClose should be called. This gives you a chance to filter\n * out interaction with elements that should not dismiss the popover.\n * By default, onClose will always be called on interaction outside the popover ref.\n */\n shouldCloseOnInteractOutside?: (element: Element) => boolean;\n /**\n * The type of trigger that opened the popover.\n * Used for submenu detection.\n */\n trigger?: string;\n}\n\nexport interface PopoverAria {\n /** Props for the popover element. */\n popoverProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the popover tip arrow if any. */\n arrowProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props to apply to the underlay element, if any. */\n underlayProps: JSX.HTMLAttributes<HTMLElement>;\n /** Placement of the popover with respect to the trigger. */\n placement: () => PlacementAxis | null;\n /** The origin of the target in the overlay's coordinate system. Useful for animations. */\n triggerAnchorPoint: () => { x: number; y: number } | null;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a popover component.\n * A popover is an overlay element positioned relative to a trigger.\n */\nexport function createPopover(\n props: AriaPopoverProps,\n state: OverlayTriggerState\n): PopoverAria {\n const triggerRef = () => props.triggerRef();\n const popoverRef = () => props.popoverRef();\n const groupRef = () => props.groupRef?.() ?? null;\n const isNonModal = () => props.isNonModal ?? false;\n const isKeyboardDismissDisabled = () => props.isKeyboardDismissDisabled ?? false;\n const shouldCloseOnInteractOutside = props.shouldCloseOnInteractOutside;\n const isSubmenu = () => props.trigger === 'SubmenuTrigger';\n\n // Overlay behavior (dismiss handling)\n const { overlayProps, underlayProps } = createOverlay(\n {\n isOpen: state.isOpen(),\n onClose: state.close,\n shouldCloseOnBlur: true,\n isDismissable: !isNonModal() || isSubmenu(),\n isKeyboardDismissDisabled: isKeyboardDismissDisabled(),\n shouldCloseOnInteractOutside,\n },\n () => groupRef() ?? popoverRef()\n );\n\n // Overlay positioning\n const {\n overlayProps: positionProps,\n arrowProps,\n placement,\n triggerAnchorPoint,\n } = createOverlayPosition({\n ...props,\n targetRef: triggerRef,\n overlayRef: popoverRef,\n isOpen: state.isOpen(),\n onClose: isNonModal() && !isSubmenu() ? state.close : null,\n });\n\n // Prevent scroll when modal popover is open\n createPreventScroll({\n isDisabled: isNonModal() || !state.isOpen(),\n });\n\n // Aria-hide outside elements\n createEffect(() => {\n if (state.isOpen() && popoverRef()) {\n const element = groupRef() ?? popoverRef();\n if (!element) return;\n\n let cleanup: (() => void) | undefined;\n\n if (isNonModal()) {\n cleanup = keepVisible(element);\n } else {\n cleanup = ariaHideOutside([element], { shouldUseInert: true });\n }\n\n onCleanup(() => {\n cleanup?.();\n });\n }\n });\n\n return {\n popoverProps: mergeProps(overlayProps, positionProps),\n arrowProps,\n underlayProps,\n placement,\n triggerAnchorPoint,\n };\n}\n\nexport { type PlacementAxis } from './createOverlayPosition';\n", "/**\n * Handles positioning overlays like popovers and menus relative to a trigger\n * element, and updating the position when the window resizes.\n *\n * Ported from @react-aria/overlays useOverlayPosition.\n */\n\nimport { createEffect, createSignal, onCleanup, type JSX } from 'solid-js';\nimport {\n calculatePosition,\n getRect,\n type Placement,\n type PlacementAxis,\n type PositionResult,\n} from './calculatePosition';\n\nexport interface PositionProps {\n /**\n * The placement of the element with respect to its anchor element.\n * @default 'bottom'\n */\n placement?: Placement;\n /**\n * The placement padding that should be applied between the element and its\n * surrounding container.\n * @default 12\n */\n containerPadding?: number;\n /**\n * The additional offset applied along the main axis between the element and its\n * anchor element.\n * @default 0\n */\n offset?: number;\n /**\n * The additional offset applied along the cross axis between the element and its\n * anchor element.\n * @default 0\n */\n crossOffset?: number;\n /**\n * Whether the element should flip its orientation (e.g. top to bottom or left to right) when\n * there is insufficient room for it to render completely.\n * @default true\n */\n shouldFlip?: boolean;\n /** Whether the overlay is currently open. */\n isOpen?: boolean;\n}\n\nexport interface AriaPositionProps extends PositionProps {\n /**\n * Cross size of the overlay arrow in pixels.\n * @default 0\n */\n arrowSize?: number;\n /**\n * Element that that serves as the positioning boundary.\n * @default document.body\n */\n boundaryElement?: Element;\n /**\n * The ref for the element which the overlay positions itself with respect to.\n */\n targetRef: () => Element | null;\n /**\n * The ref for the overlay element.\n */\n overlayRef: () => Element | null;\n /**\n * The ref for the arrow element.\n */\n arrowRef?: () => Element | null;\n /**\n * A ref for the scrollable region within the overlay.\n * @default overlayRef\n */\n scrollRef?: () => Element | null;\n /**\n * Whether the overlay should update its position automatically.\n * @default true\n */\n shouldUpdatePosition?: boolean;\n /** Handler that is called when the overlay should close. */\n onClose?: (() => void) | null;\n /**\n * The maxHeight specified for the overlay element.\n * By default, it will take all space up to the current viewport height.\n */\n maxHeight?: number;\n /**\n * The minimum distance the arrow's edge should be from the edge of the overlay element.\n * @default 0\n */\n arrowBoundaryOffset?: number;\n}\n\nexport interface PositionAria {\n /** Props for the overlay container element. */\n overlayProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the overlay tip arrow if any. */\n arrowProps: JSX.HTMLAttributes<HTMLElement>;\n /** Placement of the overlay with respect to the overlay trigger. */\n placement: () => PlacementAxis | null;\n /** The origin of the target in the overlay's coordinate system. Useful for animations. */\n triggerAnchorPoint: () => { x: number; y: number } | null;\n /** Updates the position of the overlay. */\n updatePosition: () => void;\n}\n\nconst visualViewport = typeof document !== 'undefined' ? window.visualViewport : null;\n\nfunction translateRTL(position: string, direction: string): string {\n if (direction === 'rtl') {\n return position.replace('start', 'right').replace('end', 'left');\n }\n return position.replace('start', 'left').replace('end', 'right');\n}\n\n/**\n * Handles positioning overlays like popovers and menus relative to a trigger\n * element, and updating the position when the window resizes.\n */\nexport function createOverlayPosition(props: AriaPositionProps): PositionAria {\n const direction = 'ltr'; // TODO: get from locale context\n\n const arrowSize = () => props.arrowSize ?? 0;\n const targetRef = () => props.targetRef();\n const overlayRef = () => props.overlayRef();\n const arrowRef = () => props.arrowRef?.() ?? null;\n const scrollRef = () => props.scrollRef?.() ?? overlayRef();\n const placement = () => (props.placement ?? 'bottom') as Placement;\n const containerPadding = () => props.containerPadding ?? 12;\n const shouldFlip = () => props.shouldFlip ?? true;\n const boundaryElement = () =>\n props.boundaryElement ?? (typeof document !== 'undefined' ? document.body : null);\n const offset = () => props.offset ?? 0;\n const crossOffset = () => props.crossOffset ?? 0;\n const shouldUpdatePosition = () => props.shouldUpdatePosition ?? true;\n const isOpen = () => props.isOpen ?? true;\n const onClose = () => props.onClose;\n const maxHeight = () => props.maxHeight;\n const arrowBoundaryOffset = () => props.arrowBoundaryOffset ?? 0;\n\n const [position, setPosition] = createSignal<PositionResult | null>(null);\n\n // Track the last scale to freeze overlay during pinch zoom\n let lastScale = visualViewport?.scale;\n\n createEffect(() => {\n if (isOpen()) {\n lastScale = visualViewport?.scale;\n }\n });\n\n const updatePosition = () => {\n const overlayNode = overlayRef();\n const targetNode = targetRef();\n const boundary = boundaryElement();\n\n if (!shouldUpdatePosition() || !isOpen() || !overlayNode || !targetNode || !boundary) {\n return;\n }\n\n if (visualViewport?.scale !== lastScale) {\n return;\n }\n\n const scrollNode = scrollRef();\n const arrowNode = arrowRef();\n\n // Reset overlay's previous max height\n const overlay = overlayNode as HTMLElement;\n if (!maxHeight() && overlayNode) {\n overlay.style.top = '0px';\n overlay.style.bottom = '';\n overlay.style.maxHeight = (window.visualViewport?.height ?? window.innerHeight) + 'px';\n }\n\n const result = calculatePosition({\n placement: translateRTL(placement(), direction) as Placement,\n overlayNode,\n targetNode,\n scrollNode: scrollNode || overlayNode,\n padding: containerPadding(),\n shouldFlip: shouldFlip(),\n boundaryElement: boundary,\n offset: offset(),\n crossOffset: crossOffset(),\n maxHeight: maxHeight(),\n arrowSize: arrowSize() ?? (arrowNode ? getRect(arrowNode, true).width : 0),\n arrowBoundaryOffset: arrowBoundaryOffset(),\n });\n\n if (!result.position) {\n return;\n }\n\n // Apply styles directly for immediate positioning\n overlay.style.top = '';\n overlay.style.bottom = '';\n overlay.style.left = '';\n overlay.style.right = '';\n\n Object.keys(result.position).forEach((key) => {\n (overlay.style as any)[key] = (result.position as any)[key] + 'px';\n });\n overlay.style.maxHeight = result.maxHeight != null ? result.maxHeight + 'px' : '';\n\n setPosition(result);\n };\n\n // Update position when dependencies change\n createEffect(() => {\n // Track all dependencies\n shouldUpdatePosition();\n placement();\n overlayRef();\n targetRef();\n arrowRef();\n scrollRef();\n containerPadding();\n shouldFlip();\n boundaryElement();\n offset();\n crossOffset();\n isOpen();\n maxHeight();\n arrowBoundaryOffset();\n arrowSize();\n\n updatePosition();\n });\n\n // Update position on window resize\n createEffect(() => {\n if (!isOpen()) return;\n\n const handleResize = () => updatePosition();\n window.addEventListener('resize', handleResize, false);\n\n onCleanup(() => {\n window.removeEventListener('resize', handleResize, false);\n });\n });\n\n // Update position when overlay changes size using ResizeObserver\n createEffect(() => {\n const overlayNode = overlayRef();\n if (!overlayNode || !isOpen()) return;\n\n const resizeObserver = new ResizeObserver(() => updatePosition());\n resizeObserver.observe(overlayNode);\n\n onCleanup(() => {\n resizeObserver.disconnect();\n });\n });\n\n // Update position when target changes size\n createEffect(() => {\n const targetNode = targetRef();\n if (!targetNode || !isOpen()) return;\n\n const resizeObserver = new ResizeObserver(() => updatePosition());\n resizeObserver.observe(targetNode);\n\n onCleanup(() => {\n resizeObserver.disconnect();\n });\n });\n\n // Handle visual viewport resize (for iOS virtual keyboard)\n createEffect(() => {\n if (!isOpen()) return;\n\n let timeout: ReturnType<typeof setTimeout>;\n let isResizing = false;\n\n const onResize = () => {\n isResizing = true;\n clearTimeout(timeout);\n timeout = setTimeout(() => {\n isResizing = false;\n }, 500);\n updatePosition();\n };\n\n const onScroll = () => {\n if (isResizing) {\n onResize();\n }\n };\n\n visualViewport?.addEventListener('resize', onResize);\n visualViewport?.addEventListener('scroll', onScroll);\n\n onCleanup(() => {\n visualViewport?.removeEventListener('resize', onResize);\n visualViewport?.removeEventListener('scroll', onScroll);\n clearTimeout(timeout);\n });\n });\n\n // Close on scroll (when scrolling a parent of the trigger)\n createEffect(() => {\n const targetNode = targetRef();\n const closeHandler = onClose();\n if (!targetNode || !isOpen() || !closeHandler) return;\n\n const handleScroll = (e: Event) => {\n const target = e.target as Element;\n // Don't close if scrolling within the overlay\n if (overlayRef()?.contains(target)) return;\n // Close if scrolling a parent of the target (but not body/html)\n if (\n target !== document.body &&\n target !== document.documentElement &&\n target.contains(targetNode)\n ) {\n closeHandler();\n }\n };\n\n document.addEventListener('scroll', handleScroll, true);\n\n onCleanup(() => {\n document.removeEventListener('scroll', handleScroll, true);\n });\n });\n\n return {\n overlayProps: {\n style: {\n position: position() ? 'absolute' : 'fixed',\n top: !position() ? 0 : undefined,\n left: !position() ? 0 : undefined,\n 'z-index': 100000,\n 'max-height': position()?.maxHeight ?? '100vh',\n } as JSX.CSSProperties,\n },\n placement: () => position()?.placement ?? null,\n triggerAnchorPoint: () => position()?.triggerAnchorPoint ?? null,\n arrowProps: {\n 'aria-hidden': 'true',\n role: 'presentation',\n style: {\n left: position()?.arrowOffsetLeft != null ? `${position()!.arrowOffsetLeft}px` : undefined,\n top: position()?.arrowOffsetTop != null ? `${position()!.arrowOffsetTop}px` : undefined,\n } as JSX.CSSProperties,\n },\n updatePosition,\n };\n}\n\nexport { type Placement, type PlacementAxis } from './calculatePosition';\n", "/**\n * Position calculation utilities for popovers and overlays.\n * Ported from @react-aria/overlays calculatePosition.ts\n */\n\n// Types\nexport type Placement =\n | 'bottom'\n | 'bottom left'\n | 'bottom right'\n | 'bottom start'\n | 'bottom end'\n | 'top'\n | 'top left'\n | 'top right'\n | 'top start'\n | 'top end'\n | 'left'\n | 'left top'\n | 'left bottom'\n | 'right'\n | 'right top'\n | 'right bottom'\n | 'start'\n | 'start top'\n | 'start bottom'\n | 'end'\n | 'end top'\n | 'end bottom';\n\nexport type PlacementAxis = 'top' | 'bottom' | 'left' | 'right';\nexport type Axis = 'top' | 'left';\nexport type SizeAxis = 'width' | 'height';\n\ninterface Position {\n top?: number;\n left?: number;\n bottom?: number;\n right?: number;\n}\n\ninterface Dimensions {\n width: number;\n height: number;\n totalWidth: number;\n totalHeight: number;\n top: number;\n left: number;\n scroll: Position;\n}\n\ninterface ParsedPlacement {\n placement: PlacementAxis;\n crossPlacement: PlacementAxis | 'center';\n axis: Axis;\n crossAxis: Axis;\n size: SizeAxis;\n crossSize: SizeAxis;\n}\n\ninterface Offset {\n top: number;\n left: number;\n width: number;\n height: number;\n}\n\nexport interface PositionOpts {\n arrowSize: number;\n placement: Placement;\n targetNode: Element;\n overlayNode: Element;\n scrollNode: Element;\n padding: number;\n shouldFlip: boolean;\n boundaryElement: Element;\n offset: number;\n crossOffset: number;\n maxHeight?: number;\n arrowBoundaryOffset?: number;\n}\n\ntype HeightGrowthDirection = 'top' | 'bottom';\n\nexport interface PositionResult {\n position: Position;\n arrowOffsetLeft?: number;\n arrowOffsetTop?: number;\n triggerAnchorPoint: { x: number; y: number };\n maxHeight: number;\n placement: PlacementAxis;\n}\n\n// Constants\nconst AXIS: Record<string, Axis> = {\n top: 'top',\n bottom: 'top',\n left: 'left',\n right: 'left',\n};\n\nconst FLIPPED_DIRECTION: Record<string, string> = {\n top: 'bottom',\n bottom: 'top',\n left: 'right',\n right: 'left',\n};\n\nconst CROSS_AXIS: Record<string, Axis> = {\n top: 'left',\n left: 'top',\n};\n\nconst AXIS_SIZE: Record<string, SizeAxis> = {\n top: 'height',\n left: 'width',\n};\n\nconst TOTAL_SIZE: Record<string, string> = {\n width: 'totalWidth',\n height: 'totalHeight',\n};\n\nconst PARSED_PLACEMENT_CACHE: Record<string, ParsedPlacement> = {};\n\nfunction clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n\nfunction isWebKit(): boolean {\n return typeof window !== 'undefined' && 'WebkitAppearance' in document.documentElement.style;\n}\n\nconst getVisualViewport = () =>\n typeof document !== 'undefined' ? window.visualViewport : null;\n\nfunction getContainerDimensions(\n containerNode: Element,\n visualViewport: VisualViewport | null\n): Dimensions {\n let width = 0,\n height = 0,\n totalWidth = 0,\n totalHeight = 0,\n top = 0,\n left = 0;\n const scroll: Position = {};\n const isPinchZoomedIn = (visualViewport?.scale ?? 1) > 1;\n\n if (containerNode.tagName === 'BODY' || containerNode.tagName === 'HTML') {\n const documentElement = document.documentElement;\n totalWidth = documentElement.clientWidth;\n totalHeight = documentElement.clientHeight;\n width = visualViewport?.width ?? totalWidth;\n height = visualViewport?.height ?? totalHeight;\n scroll.top = documentElement.scrollTop || (containerNode as HTMLElement).scrollTop;\n scroll.left = documentElement.scrollLeft || (containerNode as HTMLElement).scrollLeft;\n\n if (visualViewport) {\n top = visualViewport.offsetTop;\n left = visualViewport.offsetLeft;\n }\n } else {\n ({ width, height, top, left } = getElementOffset(containerNode, false));\n scroll.top = (containerNode as HTMLElement).scrollTop;\n scroll.left = (containerNode as HTMLElement).scrollLeft;\n totalWidth = width;\n totalHeight = height;\n }\n\n if (\n isWebKit() &&\n (containerNode.tagName === 'BODY' || containerNode.tagName === 'HTML') &&\n isPinchZoomedIn\n ) {\n scroll.top = 0;\n scroll.left = 0;\n top = visualViewport?.pageTop ?? 0;\n left = visualViewport?.pageLeft ?? 0;\n }\n\n return { width, height, totalWidth, totalHeight, scroll, top, left };\n}\n\nfunction getScroll(node: Element): Offset {\n return {\n top: (node as HTMLElement).scrollTop,\n left: (node as HTMLElement).scrollLeft,\n width: (node as HTMLElement).scrollWidth,\n height: (node as HTMLElement).scrollHeight,\n };\n}\n\nfunction getDelta(\n axis: Axis,\n offset: number,\n size: number,\n boundaryDimensions: Dimensions,\n containerDimensions: Dimensions,\n padding: number,\n containerOffsetWithBoundary: Offset\n): number {\n const containerScroll = containerDimensions.scroll[axis] ?? 0;\n const boundarySize = boundaryDimensions[AXIS_SIZE[axis]];\n\n const boundaryStartEdge =\n containerOffsetWithBoundary[axis] +\n (boundaryDimensions.scroll[AXIS[axis]] ?? 0) +\n padding;\n const boundaryEndEdge =\n containerOffsetWithBoundary[axis] +\n (boundaryDimensions.scroll[AXIS[axis]] ?? 0) +\n boundarySize -\n padding;\n\n const startEdgeOffset =\n offset -\n containerScroll +\n (boundaryDimensions.scroll[AXIS[axis]] ?? 0) +\n containerOffsetWithBoundary[axis] -\n boundaryDimensions[AXIS[axis]];\n const endEdgeOffset =\n offset -\n containerScroll +\n size +\n (boundaryDimensions.scroll[AXIS[axis]] ?? 0) +\n containerOffsetWithBoundary[axis] -\n boundaryDimensions[AXIS[axis]];\n\n if (startEdgeOffset < boundaryStartEdge) {\n return boundaryStartEdge - startEdgeOffset;\n } else if (endEdgeOffset > boundaryEndEdge) {\n return Math.max(boundaryEndEdge - endEdgeOffset, boundaryStartEdge - startEdgeOffset);\n } else {\n return 0;\n }\n}\n\nfunction getMargins(node: Element): Position {\n const style = window.getComputedStyle(node);\n return {\n top: parseInt(style.marginTop, 10) || 0,\n bottom: parseInt(style.marginBottom, 10) || 0,\n left: parseInt(style.marginLeft, 10) || 0,\n right: parseInt(style.marginRight, 10) || 0,\n };\n}\n\nfunction parsePlacement(input: Placement): ParsedPlacement {\n if (PARSED_PLACEMENT_CACHE[input]) {\n return PARSED_PLACEMENT_CACHE[input];\n }\n\n const [placement, crossPlacement = 'center'] = input.split(' ') as [PlacementAxis, string];\n const axis: Axis = AXIS[placement] || 'right';\n const crossAxis: Axis = CROSS_AXIS[axis];\n\n let resolvedCrossPlacement: PlacementAxis | 'center' = 'center';\n if (AXIS[crossPlacement]) {\n resolvedCrossPlacement = crossPlacement as PlacementAxis;\n }\n\n const size = AXIS_SIZE[axis];\n const crossSize = AXIS_SIZE[crossAxis];\n PARSED_PLACEMENT_CACHE[input] = {\n placement,\n crossPlacement: resolvedCrossPlacement,\n axis,\n crossAxis,\n size,\n crossSize,\n };\n return PARSED_PLACEMENT_CACHE[input];\n}\n\nfunction computePosition(\n childOffset: Offset,\n _boundaryDimensions: Dimensions,\n overlaySize: Offset,\n placementInfo: ParsedPlacement,\n offset: number,\n crossOffset: number,\n _containerOffsetWithBoundary: Offset,\n isContainerPositioned: boolean,\n arrowSize: number,\n arrowBoundaryOffset: number,\n containerDimensions: Dimensions\n): Position {\n const { placement, crossPlacement, axis, crossAxis, size, crossSize } = placementInfo;\n const position: Position = {};\n\n position[crossAxis] = childOffset[crossAxis] ?? 0;\n if (crossPlacement === 'center') {\n position[crossAxis]! += ((childOffset[crossSize] ?? 0) - (overlaySize[crossSize] ?? 0)) / 2;\n } else if (crossPlacement !== crossAxis) {\n position[crossAxis]! += (childOffset[crossSize] ?? 0) - (overlaySize[crossSize] ?? 0);\n }\n\n position[crossAxis]! += crossOffset;\n\n const minPosition =\n childOffset[crossAxis] - overlaySize[crossSize] + arrowSize + arrowBoundaryOffset;\n const maxPosition =\n childOffset[crossAxis] + childOffset[crossSize] - arrowSize - arrowBoundaryOffset;\n position[crossAxis] = clamp(position[crossAxis]!, minPosition, maxPosition);\n\n if (placement === axis) {\n const containerHeight = isContainerPositioned\n ? containerDimensions[size]\n : (containerDimensions as any)[TOTAL_SIZE[size]];\n position[FLIPPED_DIRECTION[axis] as keyof Position] = Math.floor(\n containerHeight - childOffset[axis] + offset\n );\n } else {\n position[axis] = Math.floor(childOffset[axis] + childOffset[size] + offset);\n }\n return position;\n}\n\nfunction getMaxHeight(\n position: Position,\n boundaryDimensions: Dimensions,\n containerOffsetWithBoundary: Offset,\n _isContainerPositioned: boolean,\n margins: Position,\n padding: number,\n overlayHeight: number,\n heightGrowthDirection: HeightGrowthDirection,\n containerDimensions: Dimensions,\n isContainerDescendentOfBoundary: boolean,\n visualViewport: VisualViewport | null\n): number {\n const overlayTop =\n (position.top != null\n ? position.top\n : (containerDimensions as any)[TOTAL_SIZE.height] -\n (position.bottom ?? 0) -\n overlayHeight) - (containerDimensions.scroll.top ?? 0);\n\n const boundaryToContainerTransformOffset = isContainerDescendentOfBoundary\n ? containerOffsetWithBoundary.top\n : 0;\n const boundingRect = {\n top: Math.max(\n boundaryDimensions.top + boundaryToContainerTransformOffset,\n (visualViewport?.offsetTop ?? boundaryDimensions.top) + boundaryToContainerTransformOffset\n ),\n bottom: Math.min(\n boundaryDimensions.top + boundaryDimensions.height + boundaryToContainerTransformOffset,\n (visualViewport?.offsetTop ?? 0) + (visualViewport?.height ?? 0)\n ),\n };\n\n const maxHeight =\n heightGrowthDirection !== 'top'\n ? Math.max(\n 0,\n boundingRect.bottom -\n overlayTop -\n ((margins.top ?? 0) + (margins.bottom ?? 0) + padding)\n )\n : Math.max(\n 0,\n overlayTop +\n overlayHeight -\n boundingRect.top -\n ((margins.top ?? 0) + (margins.bottom ?? 0) + padding)\n );\n return maxHeight;\n}\n\nfunction getAvailableSpace(\n boundaryDimensions: Dimensions,\n containerOffsetWithBoundary: Offset,\n childOffset: Offset,\n margins: Position,\n padding: number,\n placementInfo: ParsedPlacement,\n containerDimensions: Dimensions,\n isContainerDescendentOfBoundary: boolean\n): number {\n const { placement, axis, size } = placementInfo;\n if (placement === axis) {\n return Math.max(\n 0,\n childOffset[axis] -\n (containerDimensions.scroll[axis] ?? 0) -\n (boundaryDimensions[axis] +\n (isContainerDescendentOfBoundary ? containerOffsetWithBoundary[axis] : 0)) -\n (margins[axis] ?? 0) -\n (margins[FLIPPED_DIRECTION[axis] as keyof Position] ?? 0) -\n padding\n );\n }\n\n return Math.max(\n 0,\n boundaryDimensions[size] +\n boundaryDimensions[axis] +\n (isContainerDescendentOfBoundary ? containerOffsetWithBoundary[axis] : 0) -\n childOffset[axis] -\n childOffset[size] +\n (containerDimensions.scroll[axis] ?? 0) -\n (margins[axis] ?? 0) -\n (margins[FLIPPED_DIRECTION[axis] as keyof Position] ?? 0) -\n padding\n );\n}\n\nexport function calculatePositionInternal(\n placementInput: Placement,\n childOffset: Offset,\n overlaySize: Offset,\n _scrollSize: Offset,\n margins: Position,\n padding: number,\n flip: boolean,\n boundaryDimensions: Dimensions,\n containerDimensions: Dimensions,\n containerOffsetWithBoundary: Offset,\n offset: number,\n crossOffset: number,\n isContainerPositioned: boolean,\n userSetMaxHeight: number | undefined,\n arrowSize: number,\n arrowBoundaryOffset: number,\n isContainerDescendentOfBoundary: boolean,\n visualViewport: VisualViewport | null\n): PositionResult {\n let placementInfo = parsePlacement(placementInput);\n let { size, crossAxis, crossSize, placement, crossPlacement } = placementInfo;\n let position = computePosition(\n childOffset,\n boundaryDimensions,\n overlaySize,\n placementInfo,\n offset,\n crossOffset,\n containerOffsetWithBoundary,\n isContainerPositioned,\n arrowSize,\n arrowBoundaryOffset,\n containerDimensions\n );\n let normalizedOffset = offset;\n const space = getAvailableSpace(\n boundaryDimensions,\n containerOffsetWithBoundary,\n childOffset,\n margins,\n padding + offset,\n placementInfo,\n containerDimensions,\n isContainerDescendentOfBoundary\n );\n\n if (flip && overlaySize[size] > space) {\n const flippedPlacementInfo = parsePlacement(\n `${FLIPPED_DIRECTION[placement]} ${crossPlacement}` as Placement\n );\n const flippedPosition = computePosition(\n childOffset,\n boundaryDimensions,\n overlaySize,\n flippedPlacementInfo,\n offset,\n crossOffset,\n containerOffsetWithBoundary,\n isContainerPositioned,\n arrowSize,\n arrowBoundaryOffset,\n containerDimensions\n );\n\n const flippedSpace = getAvailableSpace(\n boundaryDimensions,\n containerOffsetWithBoundary,\n childOffset,\n margins,\n padding + offset,\n flippedPlacementInfo,\n containerDimensions,\n isContainerDescendentOfBoundary\n );\n\n if (flippedSpace > space) {\n placementInfo = flippedPlacementInfo;\n position = flippedPosition;\n normalizedOffset = offset;\n }\n }\n\n let heightGrowthDirection: HeightGrowthDirection = 'bottom';\n if (placementInfo.axis === 'top') {\n if (placementInfo.placement === 'top') {\n heightGrowthDirection = 'top';\n } else if (placementInfo.placement === 'bottom') {\n heightGrowthDirection = 'bottom';\n }\n } else if (placementInfo.crossAxis === 'top') {\n if (placementInfo.crossPlacement === 'top') {\n heightGrowthDirection = 'bottom';\n } else if (placementInfo.crossPlacement === 'bottom') {\n heightGrowthDirection = 'top';\n }\n }\n\n let delta = getDelta(\n crossAxis,\n position[crossAxis]!,\n overlaySize[crossSize],\n boundaryDimensions,\n containerDimensions,\n padding,\n containerOffsetWithBoundary\n );\n position[crossAxis]! += delta;\n\n let maxHeight = getMaxHeight(\n position,\n boundaryDimensions,\n containerOffsetWithBoundary,\n isContainerPositioned,\n margins,\n padding,\n overlaySize.height,\n heightGrowthDirection,\n containerDimensions,\n isContainerDescendentOfBoundary,\n visualViewport\n );\n\n if (userSetMaxHeight && userSetMaxHeight < maxHeight) {\n maxHeight = userSetMaxHeight;\n }\n\n overlaySize.height = Math.min(overlaySize.height, maxHeight);\n\n position = computePosition(\n childOffset,\n boundaryDimensions,\n overlaySize,\n placementInfo,\n normalizedOffset,\n crossOffset,\n containerOffsetWithBoundary,\n isContainerPositioned,\n arrowSize,\n arrowBoundaryOffset,\n containerDimensions\n );\n delta = getDelta(\n crossAxis,\n position[crossAxis]!,\n overlaySize[crossSize],\n boundaryDimensions,\n containerDimensions,\n padding,\n containerOffsetWithBoundary\n );\n position[crossAxis]! += delta;\n\n const arrowPosition: Position = {};\n\n ({ placement, crossPlacement } = placementInfo);\n let origin = childOffset[crossAxis] - position[crossAxis]! - (margins[AXIS[crossAxis]] ?? 0);\n let preferredArrowPosition = origin + 0.5 * childOffset[crossSize];\n\n const arrowMinPosition = arrowSize / 2 + arrowBoundaryOffset;\n const overlayMargin =\n AXIS[crossAxis] === 'left'\n ? (margins.left ?? 0) + (margins.right ?? 0)\n : (margins.top ?? 0) + (margins.bottom ?? 0);\n const arrowMaxPosition =\n overlaySize[crossSize] - overlayMargin - arrowSize / 2 - arrowBoundaryOffset;\n\n const arrowOverlappingChildMinEdge =\n childOffset[crossAxis] +\n arrowSize / 2 -\n (position[crossAxis]! + (margins[AXIS[crossAxis]] ?? 0));\n const arrowOverlappingChildMaxEdge =\n childOffset[crossAxis] +\n childOffset[crossSize] -\n arrowSize / 2 -\n (position[crossAxis]! + (margins[AXIS[crossAxis]] ?? 0));\n\n const arrowPositionOverlappingChild = clamp(\n preferredArrowPosition,\n arrowOverlappingChildMinEdge,\n arrowOverlappingChildMaxEdge\n );\n arrowPosition[crossAxis] = clamp(arrowPositionOverlappingChild, arrowMinPosition, arrowMaxPosition);\n\n if (arrowSize) {\n origin = arrowPosition[crossAxis]!;\n } else if (crossPlacement === 'right' || crossPlacement === 'bottom') {\n origin += childOffset[crossSize];\n } else if (crossPlacement === 'center') {\n origin += childOffset[crossSize] / 2;\n }\n\n const crossOrigin = placement === 'left' || placement === 'top' ? overlaySize[size] : 0;\n const triggerAnchorPoint = {\n x: placement === 'top' || placement === 'bottom' ? origin : crossOrigin,\n y: placement === 'left' || placement === 'right' ? origin : crossOrigin,\n };\n\n return {\n position,\n maxHeight: maxHeight,\n arrowOffsetLeft: arrowPosition.left,\n arrowOffsetTop: arrowPosition.top,\n placement,\n triggerAnchorPoint,\n };\n}\n\nexport function getRect(node: Element, ignoreScale: boolean) {\n const { top, left, width: bWidth, height: bHeight } = node.getBoundingClientRect();\n let width = bWidth;\n let height = bHeight;\n\n if (ignoreScale && node instanceof (node.ownerDocument.defaultView as any).HTMLElement) {\n width = (node as HTMLElement).offsetWidth;\n height = (node as HTMLElement).offsetHeight;\n }\n\n return { top, left, width, height };\n}\n\nfunction getElementOffset(node: Element, ignoreScale: boolean): Offset {\n const { top, left, width, height } = getRect(node, ignoreScale);\n const { scrollTop, scrollLeft, clientTop, clientLeft } = document.documentElement;\n return {\n top: top + scrollTop - clientTop,\n left: left + scrollLeft - clientLeft,\n width,\n height,\n };\n}\n\nfunction getPosition(node: Element, parent: Element, ignoreScale: boolean): Offset {\n const style = window.getComputedStyle(node);\n let offset: Offset;\n if (style.position === 'fixed') {\n offset = getRect(node, ignoreScale);\n } else {\n offset = getElementOffset(node, ignoreScale);\n const parentOffset = getElementOffset(parent, ignoreScale);\n const parentStyle = window.getComputedStyle(parent);\n parentOffset.top +=\n (parseInt(parentStyle.borderTopWidth, 10) || 0) - (parent as HTMLElement).scrollTop;\n parentOffset.left +=\n (parseInt(parentStyle.borderLeftWidth, 10) || 0) - (parent as HTMLElement).scrollLeft;\n offset.top -= parentOffset.top;\n offset.left -= parentOffset.left;\n }\n\n offset.top -= parseInt(style.marginTop, 10) || 0;\n offset.left -= parseInt(style.marginLeft, 10) || 0;\n return offset;\n}\n\nfunction getContainingBlock(node: HTMLElement): Element {\n let offsetParent = node.offsetParent;\n\n if (\n offsetParent &&\n offsetParent === document.body &&\n window.getComputedStyle(offsetParent).position === 'static' &&\n !isContainingBlock(offsetParent)\n ) {\n offsetParent = document.documentElement;\n }\n\n if (offsetParent == null) {\n offsetParent = node.parentElement;\n while (offsetParent && !isContainingBlock(offsetParent)) {\n offsetParent = offsetParent.parentElement;\n }\n }\n\n return offsetParent || document.documentElement;\n}\n\nfunction isContainingBlock(node: Element): boolean {\n const style = window.getComputedStyle(node);\n return (\n style.transform !== 'none' ||\n /transform|perspective/.test(style.willChange) ||\n style.filter !== 'none' ||\n style.contain === 'paint' ||\n ('backdropFilter' in style && (style as any).backdropFilter !== 'none') ||\n ('WebkitBackdropFilter' in style && (style as any).WebkitBackdropFilter !== 'none')\n );\n}\n\n/**\n * Determines where to place the overlay with regards to the target and the position of an optional indicator.\n */\nexport function calculatePosition(opts: PositionOpts): PositionResult {\n const {\n placement,\n targetNode,\n overlayNode,\n scrollNode,\n padding,\n shouldFlip,\n boundaryElement,\n offset,\n crossOffset,\n maxHeight,\n arrowSize = 0,\n arrowBoundaryOffset = 0,\n } = opts;\n\n const visualViewport = getVisualViewport();\n const container =\n overlayNode instanceof HTMLElement\n ? getContainingBlock(overlayNode)\n : document.documentElement;\n const isViewportContainer = container === document.documentElement;\n const containerPositionStyle = window.getComputedStyle(container).position;\n const isContainerPositioned = !!containerPositionStyle && containerPositionStyle !== 'static';\n const childOffset: Offset = isViewportContainer\n ? getElementOffset(targetNode, false)\n : getPosition(targetNode, container, false);\n\n if (!isViewportContainer) {\n const { marginTop, marginLeft } = window.getComputedStyle(targetNode);\n childOffset.top += parseInt(marginTop, 10) || 0;\n childOffset.left += parseInt(marginLeft, 10) || 0;\n }\n\n const overlaySize: Offset = getElementOffset(overlayNode, true);\n const margins = getMargins(overlayNode);\n overlaySize.width += (margins.left ?? 0) + (margins.right ?? 0);\n overlaySize.height += (margins.top ?? 0) + (margins.bottom ?? 0);\n\n const scrollSize = getScroll(scrollNode);\n const boundaryDimensions = getContainerDimensions(boundaryElement, visualViewport);\n const containerDimensions = getContainerDimensions(container, visualViewport);\n const containerOffsetWithBoundary: Offset = getPosition(boundaryElement, container, false);\n\n const isContainerDescendentOfBoundary = boundaryElement.contains(container);\n return calculatePositionInternal(\n placement,\n childOffset,\n overlaySize,\n scrollSize,\n margins,\n padding,\n shouldFlip,\n boundaryDimensions,\n containerDimensions,\n containerOffsetWithBoundary,\n offset,\n crossOffset,\n isContainerPositioned,\n maxHeight,\n arrowSize,\n arrowBoundaryOffset,\n isContainerDescendentOfBoundary,\n visualViewport\n );\n}\n", "/**\n * FocusScope component for managing focus containment, restoration, and auto-focus.\n * Based on @react-aria/focus FocusScope.\n */\n\nimport {\n createContext,\n useContext,\n createEffect,\n onCleanup,\n type JSX,\n type Accessor,\n type ParentComponent,\n createSignal,\n onMount,\n} from 'solid-js'\nimport { isServer } from 'solid-js/web'\nimport { getOwnerDocument, isFocusable } from '../utils'\nimport { focusSafely } from '../utils/focus'\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface FocusScopeProps {\n /** The contents of the focus scope. */\n children: JSX.Element\n /**\n * Whether to contain focus inside the scope, so users cannot\n * move focus outside, for example in a modal dialog.\n */\n contain?: boolean\n /**\n * Whether to restore focus back to the element that was focused\n * when the focus scope mounted, after the focus scope unmounts.\n */\n restoreFocus?: boolean\n /** Whether to auto focus the first focusable element in the focus scope on mount. */\n autoFocus?: boolean\n}\n\nexport interface FocusManagerOptions {\n /** The element to start searching from. The currently focused element by default. */\n from?: Element\n /** Whether to only include tabbable elements, or all focusable elements. */\n tabbable?: boolean\n /** Whether focus should wrap around when it reaches the end of the scope. */\n wrap?: boolean\n /** A callback that determines whether the given element is focused. */\n accept?: (node: Element) => boolean\n}\n\nexport interface FocusManager {\n /** Moves focus to the next focusable or tabbable element in the focus scope. */\n focusNext(opts?: FocusManagerOptions): HTMLElement | null\n /** Moves focus to the previous focusable or tabbable element in the focus scope. */\n focusPrevious(opts?: FocusManagerOptions): HTMLElement | null\n /** Moves focus to the first focusable or tabbable element in the focus scope. */\n focusFirst(opts?: FocusManagerOptions): HTMLElement | null\n /** Moves focus to the last focusable or tabbable element in the focus scope. */\n focusLast(opts?: FocusManagerOptions): HTMLElement | null\n}\n\n// ============================================\n// CONTEXT\n// ============================================\n\ninterface FocusScopeContextValue {\n focusManager: FocusManager\n scopeRef: Accessor<Element[]>\n}\n\nconst FocusScopeContext = createContext<FocusScopeContextValue | null>(null)\n\n/**\n * Returns a FocusManager interface for the parent FocusScope.\n * A FocusManager can be used to programmatically move focus within\n * a FocusScope, e.g. in response to user events like keyboard navigation.\n */\nexport function useFocusManager(): FocusManager | undefined {\n return useContext(FocusScopeContext)?.focusManager\n}\n\n// ============================================\n// UTILITIES\n// ============================================\n\n/**\n * Checks if an element is tabbable (focusable via Tab key).\n */\nfunction isTabbable(element: Element): boolean {\n if (!isFocusable(element)) {\n return false\n }\n\n // Check tabIndex\n const tabIndex = element.getAttribute('tabindex')\n if (tabIndex != null) {\n return parseInt(tabIndex, 10) >= 0\n }\n\n return true\n}\n\n/**\n * Gets all focusable elements within a scope.\n */\nfunction getFocusableElements(scope: Element[], tabbable = false): HTMLElement[] {\n const elements: HTMLElement[] = []\n const filter = tabbable ? isTabbable : isFocusable\n\n for (const scopeElement of scope) {\n // Check the element itself\n if (filter(scopeElement)) {\n elements.push(scopeElement as HTMLElement)\n }\n\n // Check all descendants\n const descendants = scopeElement.querySelectorAll('*')\n for (let i = 0; i < descendants.length; i++) {\n const el = descendants[i]\n if (filter(el)) {\n elements.push(el as HTMLElement)\n }\n }\n }\n\n return elements\n}\n\n/**\n * Checks if an element is within a scope.\n */\nfunction isElementInScope(element: Element | null, scope: Element[]): boolean {\n if (!element) return false\n return scope.some(node => node.contains(element))\n}\n\n/**\n * Gets the active element, accounting for shadow DOM.\n */\nfunction getActiveElement(doc: Document): Element | null {\n let activeElement = doc.activeElement\n while (activeElement?.shadowRoot?.activeElement) {\n activeElement = activeElement.shadowRoot.activeElement\n }\n return activeElement\n}\n\n// ============================================\n// FOCUS SCOPE COMPONENT\n// ============================================\n\n/**\n * A FocusScope manages focus for its descendants. It supports containing focus inside\n * the scope, restoring focus to the previously focused element on unmount, and auto\n * focusing children on mount. It also acts as a container for a programmatic focus\n * management interface that can be used to move focus forward and back in response\n * to user events.\n */\nexport const FocusScope: ParentComponent<FocusScopeProps> = (props) => {\n if (isServer) {\n return <>{props.children}</>\n }\n\n let startRef: HTMLSpanElement | undefined\n let endRef: HTMLSpanElement | undefined\n const [scopeElements, setScopeElements] = createSignal<Element[]>([])\n\n // Store the element that was focused when the scope mounted\n let nodeToRestore: Element | null = null\n\n // Create focus manager\n const focusManager: FocusManager = {\n focusNext(opts = {}) {\n const scope = scopeElements()\n if (scope.length === 0) return null\n\n const { from, tabbable = true, wrap = false, accept } = opts\n const elements = getFocusableElements(scope, tabbable).filter(el => !accept || accept(el))\n const doc = getOwnerDocument(scope[0])\n const current = from || getActiveElement(doc)\n\n if (!current || elements.length === 0) return null\n\n const currentIndex = elements.indexOf(current as HTMLElement)\n let nextIndex = currentIndex + 1\n\n if (nextIndex >= elements.length) {\n if (wrap) {\n nextIndex = 0\n } else {\n return null\n }\n }\n\n const nextElement = elements[nextIndex]\n if (nextElement) {\n focusSafely(nextElement)\n return nextElement\n }\n\n return null\n },\n\n focusPrevious(opts = {}) {\n const scope = scopeElements()\n if (scope.length === 0) return null\n\n const { from, tabbable = true, wrap = false, accept } = opts\n const elements = getFocusableElements(scope, tabbable).filter(el => !accept || accept(el))\n const doc = getOwnerDocument(scope[0])\n const current = from || getActiveElement(doc)\n\n if (!current || elements.length === 0) return null\n\n const currentIndex = elements.indexOf(current as HTMLElement)\n let prevIndex = currentIndex - 1\n\n if (prevIndex < 0) {\n if (wrap) {\n prevIndex = elements.length - 1\n } else {\n return null\n }\n }\n\n const prevElement = elements[prevIndex]\n if (prevElement) {\n focusSafely(prevElement)\n return prevElement\n }\n\n return null\n },\n\n focusFirst(opts = {}) {\n const scope = scopeElements()\n if (scope.length === 0) return null\n\n const { tabbable = true, accept } = opts\n const elements = getFocusableElements(scope, tabbable).filter(el => !accept || accept(el))\n\n if (elements.length > 0) {\n focusSafely(elements[0])\n return elements[0]\n }\n\n return null\n },\n\n focusLast(opts = {}) {\n const scope = scopeElements()\n if (scope.length === 0) return null\n\n const { tabbable = true, accept } = opts\n const elements = getFocusableElements(scope, tabbable).filter(el => !accept || accept(el))\n\n if (elements.length > 0) {\n const lastElement = elements[elements.length - 1]\n focusSafely(lastElement)\n return lastElement\n }\n\n return null\n },\n }\n\n // Collect scope elements after render\n onMount(() => {\n if (!startRef || !endRef) return\n\n const nodes: Element[] = []\n let node = startRef.nextSibling\n while (node && node !== endRef) {\n if (node.nodeType === Node.ELEMENT_NODE) {\n nodes.push(node as Element)\n }\n node = node.nextSibling\n }\n setScopeElements(nodes)\n })\n\n // Save the currently focused element for restoration (must happen before autoFocus/contain effects run).\n onMount(() => {\n if (!props.restoreFocus) return\n\n // Focus can be in the main document, or inside this iframe's document.\n const scopeDoc = startRef ? getOwnerDocument(startRef) : document\n const scopeActive = getActiveElement(scopeDoc)\n const topActive = getActiveElement(document)\n\n // If the scope is in an iframe and that iframe is currently focused, prefer the iframe document's active element.\n if (\n scopeDoc !== document &&\n document.activeElement instanceof HTMLIFrameElement &&\n document.activeElement.contentDocument === scopeDoc &&\n scopeActive &&\n scopeActive !== scopeDoc.body\n ) {\n nodeToRestore = scopeActive\n return\n }\n\n nodeToRestore = topActive\n })\n\n // Auto-focus first element\n createEffect(() => {\n if (!props.autoFocus) return\n\n const scope = scopeElements()\n if (scope.length === 0) return\n\n const doc = getOwnerDocument(scope[0])\n const activeElement = getActiveElement(doc)\n\n // Only auto-focus if focus is not already inside the scope\n if (!isElementInScope(activeElement, scope)) {\n focusManager.focusFirst()\n }\n })\n\n // Focus containment\n createEffect(() => {\n if (!props.contain) return\n\n const scope = scopeElements()\n if (scope.length === 0) return\n\n const doc = getOwnerDocument(scope[0])\n let focusedNode: Element | null = null\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey) {\n return\n }\n\n const scope = scopeElements()\n const activeElement = getActiveElement(doc)\n if (!isElementInScope(activeElement, scope)) {\n return\n }\n\n const elements = getFocusableElements(scope, true)\n if (elements.length === 0) return\n\n const firstElement = elements[0]\n const lastElement = elements[elements.length - 1]\n\n if (e.shiftKey && activeElement === firstElement) {\n e.preventDefault()\n focusSafely(lastElement)\n } else if (!e.shiftKey && activeElement === lastElement) {\n e.preventDefault()\n focusSafely(firstElement)\n }\n }\n\n const onFocusIn = (e: FocusEvent) => {\n const scope = scopeElements()\n const target = e.target as Element\n\n if (isElementInScope(target, scope)) {\n focusedNode = target\n } else if (focusedNode) {\n // Focus escaped the scope, bring it back\n focusSafely(focusedNode as HTMLElement)\n } else {\n // No previous focus, focus first element\n focusManager.focusFirst()\n }\n }\n\n doc.addEventListener('keydown', onKeyDown, true)\n doc.addEventListener('focusin', onFocusIn, true)\n\n onCleanup(() => {\n doc.removeEventListener('keydown', onKeyDown, true)\n doc.removeEventListener('focusin', onFocusIn, true)\n })\n })\n\n // Restore focus on unmount\n onCleanup(() => {\n if (props.restoreFocus && nodeToRestore && (nodeToRestore as HTMLElement).focus) {\n const doc = getOwnerDocument(nodeToRestore as Element)\n const win = doc.defaultView ?? window\n\n // Use requestAnimationFrame to ensure the element is still in the DOM\n win.requestAnimationFrame(() => {\n if (nodeToRestore && doc.body.contains(nodeToRestore as Node)) {\n ;(nodeToRestore as HTMLElement).focus()\n }\n })\n }\n })\n\n return (\n <FocusScopeContext.Provider value={{ focusManager, scopeRef: scopeElements }}>\n <span data-focus-scope-start hidden ref={startRef} />\n {props.children}\n <span data-focus-scope-end hidden ref={endRef} />\n </FocusScopeContext.Provider>\n )\n}\n\nexport default FocusScope\n", "/**\n * Focus restoration utilities for solidaria\n *\n * Provides enhanced focus restoration with retry logic, cross-scope tracking,\n * and safe restoration patterns.\n */\n\nimport { createEffect, onCleanup, onMount } from 'solid-js';\nimport { isServer } from 'solid-js/web';\nimport { getOwnerDocument } from '../utils';\nimport { focusSafely } from '../utils/focus';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface FocusRestoreOptions {\n /**\n * Whether to restore focus when the component unmounts.\n * @default true\n */\n restoreOnUnmount?: boolean;\n /**\n * Maximum number of retries if the element is not in the DOM.\n * @default 3\n */\n maxRetries?: number;\n /**\n * Delay between retries in milliseconds.\n * @default 50\n */\n retryDelay?: number;\n /**\n * Callback when focus is successfully restored.\n */\n onRestore?: (element: HTMLElement) => void;\n /**\n * Callback when focus restoration fails.\n */\n onRestoreFailed?: () => void;\n /**\n * Whether to prevent scrolling when restoring focus.\n * @default true\n */\n preventScroll?: boolean;\n}\n\nexport interface FocusRestoreResult {\n /**\n * Manually restore focus to the saved element.\n */\n restore: () => boolean;\n /**\n * Get the saved element (if any).\n */\n getSavedElement: () => HTMLElement | null;\n /**\n * Save the currently focused element.\n */\n saveCurrentFocus: () => void;\n /**\n * Clear the saved element without restoring.\n */\n clear: () => void;\n}\n\n// ============================================\n// GLOBAL FOCUS STACK\n// ============================================\n\n// Stack to track focus history across scopes\nconst focusStack: HTMLElement[] = [];\n\n/**\n * Push an element onto the focus stack.\n */\nexport function pushFocusStack(element: HTMLElement): void {\n focusStack.push(element);\n}\n\n/**\n * Pop the last element from the focus stack.\n */\nexport function popFocusStack(): HTMLElement | undefined {\n return focusStack.pop();\n}\n\n/**\n * Get the current focus stack length.\n */\nexport function getFocusStackLength(): number {\n return focusStack.length;\n}\n\n/**\n * Clear the entire focus stack.\n */\nexport function clearFocusStack(): void {\n focusStack.length = 0;\n}\n\n// ============================================\n// UTILITIES\n// ============================================\n\n/**\n * Gets the active element, accounting for shadow DOM.\n */\nfunction getActiveElement(doc: Document): HTMLElement | null {\n let activeElement = doc.activeElement as HTMLElement | null;\n while (activeElement?.shadowRoot?.activeElement) {\n activeElement = activeElement.shadowRoot.activeElement as HTMLElement;\n }\n return activeElement;\n}\n\n/**\n * Checks if an element is still valid for focus restoration.\n */\nfunction isValidForRestore(element: HTMLElement | null): boolean {\n if (!element) return false;\n if (!document.body.contains(element)) return false;\n if (element.hasAttribute('disabled')) return false;\n if (element.getAttribute('aria-disabled') === 'true') return false;\n if (element.getAttribute('aria-hidden') === 'true') return false;\n return true;\n}\n\n/**\n * Attempts to restore focus with retries.\n */\nfunction tryRestoreFocus(\n element: HTMLElement | null,\n options: Required<Pick<FocusRestoreOptions, 'maxRetries' | 'retryDelay' | 'preventScroll' | 'onRestore' | 'onRestoreFailed'>>\n): void {\n const { maxRetries, retryDelay, preventScroll, onRestore, onRestoreFailed } = options;\n let attempts = 0;\n\n const attempt = () => {\n if (!element) {\n onRestoreFailed?.();\n return;\n }\n\n if (isValidForRestore(element)) {\n if (preventScroll) {\n focusSafely(element);\n } else {\n element.focus();\n }\n onRestore?.(element);\n return;\n }\n\n attempts++;\n if (attempts < maxRetries) {\n setTimeout(attempt, retryDelay);\n } else {\n onRestoreFailed?.();\n }\n };\n\n // Use requestAnimationFrame for the first attempt to ensure DOM is ready\n requestAnimationFrame(attempt);\n}\n\n// ============================================\n// HOOK\n// ============================================\n\n/**\n * Creates a focus restoration manager.\n *\n * This hook saves the currently focused element when mounted and provides\n * methods to restore focus later, with retry logic for reliability.\n *\n * @example\n * ```tsx\n * function Modal(props) {\n * const focusRestore = createFocusRestore({\n * restoreOnUnmount: true,\n * onRestore: () => console.log('Focus restored'),\n * });\n *\n * return (\n * <div role=\"dialog\">\n * {props.children}\n * <button onClick={() => focusRestore.restore()}>\n * Close\n * </button>\n * </div>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * // Manual focus management\n * function Dropdown() {\n * const focusRestore = createFocusRestore({ restoreOnUnmount: false });\n *\n * const onOpen = () => {\n * focusRestore.saveCurrentFocus();\n * // Focus dropdown content\n * };\n *\n * const onClose = () => {\n * focusRestore.restore();\n * };\n *\n * return <div>...</div>;\n * }\n * ```\n */\nexport function createFocusRestore(\n options: FocusRestoreOptions = {}\n): FocusRestoreResult {\n const {\n restoreOnUnmount = true,\n maxRetries = 3,\n retryDelay = 50,\n onRestore,\n onRestoreFailed,\n preventScroll = true,\n } = options;\n\n // During SSR, return no-op functions\n if (isServer) {\n return {\n restore: () => false,\n getSavedElement: () => null,\n saveCurrentFocus: () => {},\n clear: () => {},\n };\n }\n\n let savedElement: HTMLElement | null = null;\n\n // Save focus on mount\n onMount(() => {\n saveCurrentFocus();\n });\n\n // Restore focus on cleanup\n onCleanup(() => {\n if (restoreOnUnmount && savedElement) {\n tryRestoreFocus(savedElement, {\n maxRetries,\n retryDelay,\n preventScroll,\n onRestore: onRestore ?? (() => {}),\n onRestoreFailed: onRestoreFailed ?? (() => {}),\n });\n }\n });\n\n function saveCurrentFocus(): void {\n const doc = typeof document !== 'undefined' ? document : null;\n if (!doc) return;\n\n const active = getActiveElement(doc);\n if (active && active !== doc.body) {\n savedElement = active;\n pushFocusStack(active);\n }\n }\n\n function restore(): boolean {\n if (!savedElement) return false;\n\n if (isValidForRestore(savedElement)) {\n if (preventScroll) {\n focusSafely(savedElement);\n } else {\n savedElement.focus();\n }\n onRestore?.(savedElement);\n return true;\n }\n\n // Try the focus stack\n while (focusStack.length > 0) {\n const stackElement = popFocusStack();\n if (stackElement && isValidForRestore(stackElement)) {\n if (preventScroll) {\n focusSafely(stackElement);\n } else {\n stackElement.focus();\n }\n onRestore?.(stackElement);\n return true;\n }\n }\n\n onRestoreFailed?.();\n return false;\n }\n\n function getSavedElement(): HTMLElement | null {\n return savedElement;\n }\n\n function clear(): void {\n savedElement = null;\n }\n\n return {\n restore,\n getSavedElement,\n saveCurrentFocus,\n clear,\n };\n}\n", "/**\n * Virtual focus management for solidaria\n *\n * Provides virtual focus for large collections where tracking DOM focus\n * on every item is impractical. Instead, a single element receives real\n * focus while aria-activedescendant indicates the virtually focused item.\n *\n * This is commonly used in:\n * - Virtualized lists (where not all items are in the DOM)\n * - Large trees\n * - Autocomplete/combobox suggestions\n * - Grid/table navigation\n */\n\nimport { type Accessor, createSignal, createEffect, onCleanup } from 'solid-js';\nimport { isServer } from 'solid-js/web';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface VirtualFocusOptions<T> {\n /**\n * The items in the collection.\n */\n items: Accessor<T[]>;\n /**\n * Function to get a unique key for each item.\n */\n getKey: (item: T) => string;\n /**\n * Function to check if an item is disabled.\n */\n isDisabled?: (item: T) => boolean;\n /**\n * Initial focused key.\n */\n defaultFocusedKey?: string;\n /**\n * Controlled focused key.\n */\n focusedKey?: Accessor<string | null>;\n /**\n * Callback when focused key changes.\n */\n onFocusChange?: (key: string | null) => void;\n /**\n * Whether to wrap focus at the edges.\n * @default true\n */\n wrap?: boolean;\n /**\n * Whether to loop through disabled items.\n * @default false\n */\n skipDisabled?: boolean;\n /**\n * Orientation for keyboard navigation.\n * @default 'vertical'\n */\n orientation?: 'horizontal' | 'vertical' | 'both';\n}\n\nexport interface VirtualFocusResult<T> {\n /**\n * The currently focused key.\n */\n focusedKey: Accessor<string | null>;\n /**\n * The currently focused item (if any).\n */\n focusedItem: Accessor<T | null>;\n /**\n * Set the focused key.\n */\n setFocusedKey: (key: string | null) => void;\n /**\n * Move focus to the next item.\n */\n focusNext: () => void;\n /**\n * Move focus to the previous item.\n */\n focusPrevious: () => void;\n /**\n * Move focus to the first item.\n */\n focusFirst: () => void;\n /**\n * Move focus to the last item.\n */\n focusLast: () => void;\n /**\n * Move focus by a page (for large lists).\n */\n focusPageDown: (pageSize?: number) => void;\n /**\n * Move focus up by a page (for large lists).\n */\n focusPageUp: (pageSize?: number) => void;\n /**\n * Check if a key is the currently focused key.\n */\n isFocused: (key: string) => boolean;\n /**\n * Props to spread on the container element.\n */\n containerProps: {\n 'aria-activedescendant': Accessor<string | undefined>;\n onKeyDown: (e: KeyboardEvent) => void;\n };\n /**\n * Get props for an item element.\n */\n getItemProps: (key: string) => {\n id: string;\n 'aria-selected'?: boolean;\n };\n}\n\n// ============================================\n// CONSTANTS\n// ============================================\n\nconst DEFAULT_PAGE_SIZE = 10;\n\n// ============================================\n// HOOK\n// ============================================\n\n/**\n * Creates virtual focus management for a collection.\n *\n * Virtual focus uses aria-activedescendant to indicate which item is\n * \"focused\" while keeping real DOM focus on a container element. This\n * is more performant for large collections and required for virtualized\n * lists where items may not be in the DOM.\n *\n * @example\n * ```tsx\n * function Listbox(props) {\n * const virtualFocus = createVirtualFocus({\n * items: () => props.items,\n * getKey: (item) => item.id,\n * isDisabled: (item) => item.disabled,\n * });\n *\n * return (\n * <ul\n * role=\"listbox\"\n * tabIndex={0}\n * aria-activedescendant={virtualFocus.containerProps['aria-activedescendant']()}\n * onKeyDown={virtualFocus.containerProps.onKeyDown}\n * >\n * <For each={props.items}>\n * {(item) => (\n * <li\n * {...virtualFocus.getItemProps(item.id)}\n * role=\"option\"\n * aria-selected={virtualFocus.isFocused(item.id)}\n * >\n * {item.name}\n * </li>\n * )}\n * </For>\n * </ul>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * // With controlled focus\n * function ControlledListbox() {\n * const [focusedKey, setFocusedKey] = createSignal<string | null>(null);\n *\n * const virtualFocus = createVirtualFocus({\n * items: () => items,\n * getKey: (item) => item.id,\n * focusedKey: focusedKey,\n * onFocusChange: setFocusedKey,\n * });\n *\n * return <ul>...</ul>;\n * }\n * ```\n */\nexport function createVirtualFocus<T>(\n options: VirtualFocusOptions<T>\n): VirtualFocusResult<T> {\n const {\n items,\n getKey,\n isDisabled = () => false,\n defaultFocusedKey,\n focusedKey: controlledFocusedKey,\n onFocusChange,\n wrap = true,\n skipDisabled = true,\n orientation = 'vertical',\n } = options;\n\n // During SSR, return minimal implementation\n if (isServer) {\n const emptyAccessor = () => null;\n return {\n focusedKey: emptyAccessor,\n focusedItem: emptyAccessor,\n setFocusedKey: () => {},\n focusNext: () => {},\n focusPrevious: () => {},\n focusFirst: () => {},\n focusLast: () => {},\n focusPageDown: () => {},\n focusPageUp: () => {},\n isFocused: () => false,\n containerProps: {\n 'aria-activedescendant': () => undefined,\n onKeyDown: () => {},\n },\n getItemProps: (key: string) => ({ id: `item-${key}` }),\n };\n }\n\n // Internal state for uncontrolled mode\n const [internalKey, setInternalKey] = createSignal<string | null>(\n defaultFocusedKey ?? null\n );\n\n // Use controlled or uncontrolled value\n const focusedKey = controlledFocusedKey ?? internalKey;\n\n const setFocusedKey = (key: string | null) => {\n if (controlledFocusedKey) {\n onFocusChange?.(key);\n } else {\n setInternalKey(key);\n onFocusChange?.(key);\n }\n };\n\n // Get focused item\n const focusedItem = (): T | null => {\n const key = focusedKey();\n if (!key) return null;\n return items().find((item) => getKey(item) === key) ?? null;\n };\n\n // Get valid items (not disabled if skipDisabled is true)\n const getValidItems = (): T[] => {\n if (!skipDisabled) return items();\n return items().filter((item) => !isDisabled(item));\n };\n\n // Get index of key in valid items\n const getKeyIndex = (key: string | null): number => {\n if (!key) return -1;\n const validItems = getValidItems();\n return validItems.findIndex((item) => getKey(item) === key);\n };\n\n // Focus by index\n const focusByIndex = (index: number): void => {\n const validItems = getValidItems();\n if (validItems.length === 0) return;\n\n let targetIndex = index;\n\n if (wrap) {\n targetIndex = ((index % validItems.length) + validItems.length) % validItems.length;\n } else {\n targetIndex = Math.max(0, Math.min(index, validItems.length - 1));\n }\n\n const item = validItems[targetIndex];\n if (item) {\n setFocusedKey(getKey(item));\n }\n };\n\n const focusNext = (): void => {\n const currentIndex = getKeyIndex(focusedKey());\n focusByIndex(currentIndex + 1);\n };\n\n const focusPrevious = (): void => {\n const currentIndex = getKeyIndex(focusedKey());\n if (currentIndex === -1) {\n focusByIndex(getValidItems().length - 1);\n } else {\n focusByIndex(currentIndex - 1);\n }\n };\n\n const focusFirst = (): void => {\n focusByIndex(0);\n };\n\n const focusLast = (): void => {\n focusByIndex(getValidItems().length - 1);\n };\n\n const focusPageDown = (pageSize: number = DEFAULT_PAGE_SIZE): void => {\n const currentIndex = getKeyIndex(focusedKey());\n focusByIndex(currentIndex + pageSize);\n };\n\n const focusPageUp = (pageSize: number = DEFAULT_PAGE_SIZE): void => {\n const currentIndex = getKeyIndex(focusedKey());\n if (currentIndex === -1) {\n focusByIndex(getValidItems().length - 1);\n } else {\n focusByIndex(currentIndex - pageSize);\n }\n };\n\n const isFocused = (key: string): boolean => {\n return focusedKey() === key;\n };\n\n // Keyboard handler\n const onKeyDown = (e: KeyboardEvent): void => {\n const isVertical = orientation === 'vertical' || orientation === 'both';\n const isHorizontal = orientation === 'horizontal' || orientation === 'both';\n\n switch (e.key) {\n case 'ArrowDown':\n if (isVertical) {\n e.preventDefault();\n focusNext();\n }\n break;\n case 'ArrowUp':\n if (isVertical) {\n e.preventDefault();\n focusPrevious();\n }\n break;\n case 'ArrowRight':\n if (isHorizontal) {\n e.preventDefault();\n focusNext();\n }\n break;\n case 'ArrowLeft':\n if (isHorizontal) {\n e.preventDefault();\n focusPrevious();\n }\n break;\n case 'Home':\n e.preventDefault();\n focusFirst();\n break;\n case 'End':\n e.preventDefault();\n focusLast();\n break;\n case 'PageDown':\n e.preventDefault();\n focusPageDown();\n break;\n case 'PageUp':\n e.preventDefault();\n focusPageUp();\n break;\n }\n };\n\n const containerProps = {\n 'aria-activedescendant': () => {\n const key = focusedKey();\n return key ? `item-${key}` : undefined;\n },\n onKeyDown,\n };\n\n const getItemProps = (key: string) => ({\n id: `item-${key}`,\n });\n\n return {\n focusedKey,\n focusedItem,\n setFocusedKey,\n focusNext,\n focusPrevious,\n focusFirst,\n focusLast,\n focusPageDown,\n focusPageUp,\n isFocused,\n containerProps,\n getItemProps,\n };\n}\n", "/**\n * Auto-focus management for solidaria\n *\n * Provides priority-based auto-focus with deferred execution\n * and conflict resolution for multiple auto-focus elements.\n */\n\nimport { createEffect, onCleanup, onMount } from 'solid-js';\nimport { isServer } from 'solid-js/web';\nimport { focusSafely } from '../utils/focus';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AutoFocusOptions {\n /**\n * Whether auto-focus is enabled.\n * @default true\n */\n isEnabled?: boolean;\n /**\n * Priority level (higher = more important).\n * When multiple elements request auto-focus, the highest priority wins.\n * @default 0\n */\n priority?: number;\n /**\n * Delay in milliseconds before focusing.\n * Useful for animations or transitions.\n * @default 0\n */\n delay?: number;\n /**\n * Whether to focus even if another element is already focused.\n * @default false\n */\n force?: boolean;\n /**\n * Whether to prevent scrolling when focusing.\n * @default true\n */\n preventScroll?: boolean;\n /**\n * Callback when focus is applied.\n */\n onFocus?: (element: HTMLElement) => void;\n /**\n * Callback when focus is skipped (due to lower priority or other reasons).\n */\n onSkip?: () => void;\n}\n\nexport interface AutoFocusResult {\n /**\n * Manually trigger the auto-focus.\n */\n focus: () => void;\n /**\n * Cancel any pending auto-focus.\n */\n cancel: () => void;\n}\n\n// ============================================\n// AUTO-FOCUS QUEUE\n// ============================================\n\ninterface QueuedFocus {\n ref: () => HTMLElement | null | undefined;\n priority: number;\n delay: number;\n force: boolean;\n preventScroll: boolean;\n onFocus?: (element: HTMLElement) => void;\n onSkip?: () => void;\n}\n\n// Global queue for managing auto-focus requests\nlet autoFocusQueue: QueuedFocus[] = [];\nlet processingTimeout: ReturnType<typeof setTimeout> | null = null;\n\n/**\n * Process the auto-focus queue and focus the highest priority element.\n */\nfunction processAutoFocusQueue(): void {\n if (processingTimeout) {\n clearTimeout(processingTimeout);\n processingTimeout = null;\n }\n\n if (autoFocusQueue.length === 0) return;\n\n // Sort by priority (highest first)\n autoFocusQueue.sort((a, b) => b.priority - a.priority);\n\n // Get the highest priority item\n const winner = autoFocusQueue[0];\n const losers = autoFocusQueue.slice(1);\n\n // Clear the queue\n autoFocusQueue = [];\n\n // Notify losers\n for (const loser of losers) {\n loser.onSkip?.();\n }\n\n // Focus the winner\n const element = winner.ref();\n if (!element) {\n winner.onSkip?.();\n return;\n }\n\n // Check if we should focus\n const activeElement = document.activeElement;\n const shouldFocus =\n winner.force ||\n !activeElement ||\n activeElement === document.body ||\n activeElement === document.documentElement;\n\n if (!shouldFocus) {\n winner.onSkip?.();\n return;\n }\n\n // Apply focus with optional delay\n if (winner.delay > 0) {\n setTimeout(() => {\n const el = winner.ref();\n if (el && document.body.contains(el)) {\n if (winner.preventScroll) {\n focusSafely(el);\n } else {\n el.focus();\n }\n winner.onFocus?.(el);\n }\n }, winner.delay);\n } else {\n if (winner.preventScroll) {\n focusSafely(element);\n } else {\n element.focus();\n }\n winner.onFocus?.(element);\n }\n}\n\n/**\n * Queue an element for auto-focus.\n */\nfunction queueAutoFocus(item: QueuedFocus): void {\n autoFocusQueue.push(item);\n\n // Schedule processing on next frame to allow all components to register\n if (processingTimeout === null) {\n processingTimeout = setTimeout(processAutoFocusQueue, 0);\n }\n}\n\n/**\n * Remove an item from the auto-focus queue.\n */\nfunction removeFromQueue(ref: () => HTMLElement | null | undefined): void {\n autoFocusQueue = autoFocusQueue.filter((item) => item.ref !== ref);\n}\n\n// ============================================\n// HOOK\n// ============================================\n\n/**\n * Creates auto-focus behavior for an element.\n *\n * This hook registers the element for auto-focus when mounted. If multiple\n * elements request auto-focus, the one with the highest priority wins.\n *\n * @param ref - Accessor for the element to focus\n * @param options - Auto-focus options\n *\n * @example\n * ```tsx\n * function Dialog(props) {\n * let contentRef: HTMLDivElement | undefined;\n *\n * createAutoFocus(() => contentRef, {\n * priority: 10, // High priority for dialogs\n * onFocus: () => console.log('Dialog focused'),\n * });\n *\n * return (\n * <div ref={contentRef} tabIndex={-1}>\n * {props.children}\n * </div>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * // With delay for animations\n * function AnimatedPanel() {\n * let panelRef: HTMLDivElement | undefined;\n *\n * createAutoFocus(() => panelRef, {\n * delay: 300, // Wait for animation\n * });\n *\n * return <div ref={panelRef} class=\"animated-panel\">...</div>;\n * }\n * ```\n *\n * @example\n * ```tsx\n * // Conditional auto-focus\n * function Input(props) {\n * let inputRef: HTMLInputElement | undefined;\n *\n * createAutoFocus(() => inputRef, {\n * isEnabled: props.autoFocus,\n * });\n *\n * return <input ref={inputRef} />;\n * }\n * ```\n */\nexport function createAutoFocus(\n ref: () => HTMLElement | null | undefined,\n options: AutoFocusOptions = {}\n): AutoFocusResult {\n const {\n isEnabled = true,\n priority = 0,\n delay = 0,\n force = false,\n preventScroll = true,\n onFocus,\n onSkip,\n } = options;\n\n // During SSR, return no-op functions\n if (isServer) {\n return {\n focus: () => {},\n cancel: () => {},\n };\n }\n\n let canceled = false;\n\n // Queue auto-focus on mount\n onMount(() => {\n if (!isEnabled || canceled) return;\n\n queueAutoFocus({\n ref,\n priority,\n delay,\n force,\n preventScroll,\n onFocus,\n onSkip,\n });\n });\n\n // Remove from queue on cleanup\n onCleanup(() => {\n removeFromQueue(ref);\n });\n\n const focus = (): void => {\n if (canceled) return;\n\n const element = ref();\n if (!element) return;\n\n if (preventScroll) {\n focusSafely(element);\n } else {\n element.focus();\n }\n onFocus?.(element);\n };\n\n const cancel = (): void => {\n canceled = true;\n removeFromQueue(ref);\n };\n\n return {\n focus,\n cancel,\n };\n}\n\n// ============================================\n// UTILITIES\n// ============================================\n\n/**\n * Clears all pending auto-focus requests.\n * Useful for testing or when navigating away.\n */\nexport function clearAutoFocusQueue(): void {\n if (processingTimeout) {\n clearTimeout(processingTimeout);\n processingTimeout = null;\n }\n autoFocusQueue = [];\n}\n\n/**\n * Gets the current auto-focus queue length.\n * Useful for debugging.\n */\nexport function getAutoFocusQueueLength(): number {\n return autoFocusQueue.length;\n}\n", "/**\n * createDisclosure hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a disclosure component.\n *\n * Port of @react-aria/disclosure useDisclosure.\n */\n\nimport { type JSX, createEffect } from 'solid-js';\nimport { type DisclosureState } from '@proyecto-viviana/solid-stately';\nimport { createId, canUseDOM } from '../ssr';\nimport { createPress } from '../interactions/createPress';\nimport { mergeProps } from '../utils/mergeProps';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaDisclosureProps {\n /** Whether the disclosure is disabled. */\n isDisabled?: boolean;\n}\n\nexport interface DisclosureAria {\n /** Props for the disclosure trigger button. */\n buttonProps: JSX.ButtonHTMLAttributes<HTMLButtonElement>;\n /** Props for the disclosure panel. */\n panelProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the behavior and accessibility implementation for a disclosure component.\n *\n * A disclosure is a widget that can be toggled to show or hide content.\n * It consists of a trigger button and a panel.\n *\n * @example\n * ```tsx\n * import { createDisclosure } from 'solidaria';\n * import { createDisclosureState } from 'solid-stately';\n *\n * function Disclosure(props) {\n * const state = createDisclosureState(props);\n * let panelRef;\n * const { buttonProps, panelProps } = createDisclosure(\n * { get isDisabled() { return props.isDisabled; } },\n * state,\n * () => panelRef\n * );\n *\n * return (\n * <div>\n * <button {...buttonProps}>Toggle</button>\n * <div {...panelProps} ref={panelRef}>\n * {props.children}\n * </div>\n * </div>\n * );\n * }\n * ```\n */\nexport function createDisclosure(\n props: AriaDisclosureProps | (() => AriaDisclosureProps),\n state: DisclosureState,\n panelRef: () => HTMLElement | null\n): DisclosureAria {\n // Handle both plain object and accessor function patterns\n const getProps = typeof props === 'function' ? props : () => props;\n\n const triggerId = createId();\n const panelId = createId();\n\n // Handle panel visibility with hidden attribute\n createEffect(() => {\n if (!canUseDOM) return;\n\n const panel = panelRef();\n if (!panel) return;\n\n if (state.isExpanded()) {\n panel.removeAttribute('hidden');\n } else {\n // Use 'until-found' for find-in-page support where available\n panel.setAttribute('hidden', 'until-found');\n }\n });\n\n // Use createPress for proper interaction handling (matches Select/Menu pattern)\n const { pressProps } = createPress({\n get isDisabled() {\n return getProps().isDisabled;\n },\n onPress() {\n state.toggle();\n },\n });\n\n return {\n // Button props - merge with pressProps for consistent interaction handling\n // Using getter (not createMemo) to match createSelect pattern\n get buttonProps(): JSX.ButtonHTMLAttributes<HTMLButtonElement> {\n const p = getProps();\n // Note: Don't add duplicate onKeyDown handler here!\n // createPress already handles Enter/Space via its onPress callback.\n // Adding another toggle call would double-toggle (toggle on keydown, toggle again on keyup).\n return mergeProps(\n pressProps as Record<string, unknown>,\n {\n id: triggerId,\n type: 'button',\n 'aria-expanded': state.isExpanded(),\n 'aria-controls': panelId,\n disabled: p.isDisabled,\n } as Record<string, unknown>\n ) as JSX.ButtonHTMLAttributes<HTMLButtonElement>;\n },\n // Panel props\n get panelProps(): JSX.HTMLAttributes<HTMLElement> {\n return {\n id: panelId,\n role: 'region',\n 'aria-labelledby': triggerId,\n hidden: !state.isExpanded() || undefined,\n };\n },\n };\n}\n", "/**\n * createDisclosureGroup hook for Solidaria\n *\n * Provides accessibility implementation for a group of disclosures (accordion).\n *\n * Port of @react-aria/disclosure.\n */\n\nimport { type JSX, createMemo } from 'solid-js';\nimport { type DisclosureGroupState } from '@proyecto-viviana/solid-stately';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaDisclosureGroupProps {\n /** Whether the disclosure group is disabled. */\n isDisabled?: boolean;\n}\n\nexport interface DisclosureGroupAria {\n /** Props for the disclosure group container. */\n groupProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides accessibility implementation for a group of disclosures (accordion).\n *\n * @example\n * ```tsx\n * import { createDisclosureGroup } from 'solidaria';\n * import { createDisclosureGroupState } from 'solid-stately';\n *\n * function Accordion(props) {\n * const state = createDisclosureGroupState(props);\n * const { groupProps } = createDisclosureGroup(props, state);\n *\n * return (\n * <div {...groupProps}>\n * {props.children}\n * </div>\n * );\n * }\n * ```\n */\nexport function createDisclosureGroup(\n props: AriaDisclosureGroupProps,\n state: DisclosureGroupState\n): DisclosureGroupAria {\n const groupProps = createMemo<JSX.HTMLAttributes<HTMLElement>>(() => ({\n role: 'group',\n 'aria-disabled': props.isDisabled || state.isDisabled || undefined,\n }));\n\n return {\n get groupProps() { return groupProps(); },\n };\n}\n", "/**\n * Meter hook for Solidaria\n *\n * Provides the accessibility implementation for a meter component.\n * Meters represent a quantity within a known range, or a fractional value.\n * Unlike progress bars, meters represent a current value rather than progress toward a goal.\n *\n * This is a port of @react-aria/meter's useMeter hook.\n */\n\nimport { createProgressBar, type AriaProgressBarProps } from '../progress/createProgressBar';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaMeterProps extends Omit<AriaProgressBarProps, 'isIndeterminate'> {\n /** The current value (controlled). */\n value?: number;\n /** The smallest value allowed for the input. @default 0 */\n minValue?: number;\n /** The largest value allowed for the input. @default 100 */\n maxValue?: number;\n /** The content to display as the value's label (e.g. 1 of 4). */\n valueLabel?: string;\n /** The display format of the value label. */\n formatOptions?: Intl.NumberFormatOptions;\n /** The content to display as the label. */\n label?: string;\n /** An accessibility label for this item. */\n 'aria-label'?: string;\n /** Identifies the element (or elements) that labels the current element. */\n 'aria-labelledby'?: string;\n /** Identifies the element (or elements) that describes the object. */\n 'aria-describedby'?: string;\n /** Identifies the element (or elements) that provide a detailed, extended description for the object. */\n 'aria-details'?: string;\n}\n\nexport interface MeterAria {\n /** Props for the meter container element. */\n meterProps: Record<string, unknown>;\n /** Props for the meter's visual label element (if any). */\n labelProps: Record<string, unknown>;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the accessibility implementation for a meter component.\n * Meters represent a quantity within a known range, or a fractional value.\n */\nexport function createMeter(props: AriaMeterProps = {}): MeterAria {\n // Reuse progress bar implementation\n const { progressBarProps, labelProps } = createProgressBar(props);\n\n return {\n get meterProps() {\n return {\n ...progressBarProps,\n // Use the meter role if available, but fall back to progressbar if not\n // Chrome currently falls back from meter automatically, and Firefox\n // does not support meter at all. Safari 13+ seems to support meter properly.\n // https://bugs.chromium.org/p/chromium/issues/detail?id=944542\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1460378\n role: 'meter progressbar',\n };\n },\n get labelProps() {\n return labelProps;\n },\n };\n}\n", "/**\n * TagGroup hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a tag group component.\n * A tag group is a focusable list of labels, categories, keywords, filters, or other items,\n * with support for keyboard navigation, selection, and removal.\n *\n * Based on @react-aria/tag useTagGroup\n */\n\nimport { createEffect, onCleanup } from 'solid-js';\nimport { createLabel } from '../label/createLabel';\nimport { filterDOMProps } from '../utils/filterDOMProps';\nimport { mergeProps } from '../utils/mergeProps';\nimport { createId } from '../ssr';\nimport { access, type MaybeAccessor } from '../utils/reactivity';\nimport type { ListState, Key } from '@proyecto-viviana/solid-stately';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaTagGroupProps {\n /** An ID for the tag group. */\n id?: string;\n /** Whether the tag group is disabled. */\n isDisabled?: boolean;\n /** The label for the tag group. */\n label?: string;\n /** An accessible label for the tag group when no visible label is provided. */\n 'aria-label'?: string;\n /** The ID of an element that labels the tag group. */\n 'aria-labelledby'?: string;\n /** The ID of an element that describes the tag group. */\n 'aria-describedby'?: string;\n /** A description of the tag group. */\n description?: string;\n /** An error message for the tag group. */\n errorMessage?: string;\n /** Handler that is called when a user removes a tag. */\n onRemove?: (keys: Set<Key>) => void;\n}\n\nexport interface TagGroupAria {\n /** Props for the tag group container element. */\n gridProps: Record<string, unknown>;\n /** Props for the tag group's visible label (if any). */\n labelProps: Record<string, unknown>;\n /** Props for the tag group description element, if any. */\n descriptionProps: Record<string, unknown>;\n /** Props for the tag group error message element, if any. */\n errorMessageProps: Record<string, unknown>;\n}\n\n// Shared data between tag group and tags\nconst tagGroupData = new WeakMap<object, TagGroupData>();\n\ninterface TagGroupData {\n id: string;\n onRemove?: (keys: Set<Key>) => void;\n}\n\nexport function getTagGroupData(state: ListState): TagGroupData | undefined {\n return tagGroupData.get(state);\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the behavior and accessibility implementation for a tag group component.\n * A tag group is a focusable list of labels, categories, keywords, filters, or other items,\n * with support for keyboard navigation, selection, and removal.\n */\nexport function createTagGroup<T>(\n props: MaybeAccessor<AriaTagGroupProps>,\n state: ListState<T>,\n _ref?: () => HTMLElement | null\n): TagGroupAria {\n const getProps = () => access(props);\n const id = createId(getProps().id);\n const descriptionId = createId();\n const errorMessageId = createId();\n\n // Filter DOM props\n const domProps = () => filterDOMProps(getProps() as unknown as Record<string, unknown>, { labelable: true });\n\n // Create label handling\n const { labelProps, fieldProps } = createLabel({\n get label() { return getProps().label; },\n get 'aria-label'() { return getProps()['aria-label']; },\n get 'aria-labelledby'() { return getProps()['aria-labelledby']; },\n labelElementType: 'span',\n });\n\n // Share data with child tags\n createEffect(() => {\n const p = getProps();\n tagGroupData.set(state, {\n id,\n onRemove: p.onRemove,\n });\n\n onCleanup(() => {\n tagGroupData.delete(state);\n });\n });\n\n // Build aria-describedby\n const getAriaDescribedBy = () => {\n const p = getProps();\n const ids: string[] = [];\n if (p['aria-describedby']) {\n ids.push(p['aria-describedby']);\n }\n if (p.description) {\n ids.push(descriptionId);\n }\n if (p.errorMessage) {\n ids.push(errorMessageId);\n }\n return ids.length > 0 ? ids.join(' ') : undefined;\n };\n\n return {\n get gridProps() {\n const p = getProps();\n const hasItems = state.collection().size > 0;\n\n return mergeProps(domProps(), fieldProps as Record<string, unknown>, {\n id,\n role: hasItems ? 'grid' : 'group',\n 'aria-atomic': false,\n 'aria-relevant': 'additions',\n 'aria-describedby': getAriaDescribedBy(),\n 'aria-disabled': p.isDisabled || undefined,\n });\n },\n get labelProps() {\n return labelProps as Record<string, unknown>;\n },\n get descriptionProps() {\n return {\n id: descriptionId,\n };\n },\n get errorMessageProps() {\n return {\n id: errorMessageId,\n };\n },\n };\n}\n", "/**\n * Tag hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a tag component.\n * Tags are individual items within a TagGroup.\n *\n * Based on @react-aria/tag useTag\n */\n\nimport { createMemo } from 'solid-js';\nimport { createFocusable } from '../interactions/createFocusable';\nimport { createPress } from '../interactions/createPress';\nimport { filterDOMProps } from '../utils/filterDOMProps';\nimport { mergeProps } from '../utils/mergeProps';\nimport { createId } from '../ssr';\nimport { access, type MaybeAccessor } from '../utils/reactivity';\nimport { getTagGroupData } from './createTagGroup';\nimport type { ListState, Key } from '@proyecto-viviana/solid-stately';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaTagProps {\n /** The unique key for this tag. */\n key: Key;\n /** Whether the tag is disabled. */\n isDisabled?: boolean;\n /** A text value for the tag used for accessibility. */\n textValue?: string;\n}\n\nexport interface TagAria {\n /** Props for the tag row element. */\n rowProps: Record<string, unknown>;\n /** Props for the tag cell element. */\n gridCellProps: Record<string, unknown>;\n /** Props for the tag remove button. */\n removeButtonProps: Record<string, unknown>;\n /** Whether the tag can be removed. */\n allowsRemoving: boolean;\n /** Whether the tag is selected. */\n isSelected: boolean;\n /** Whether the tag is disabled. */\n isDisabled: boolean;\n /** Whether the tag is focused. */\n isFocused: boolean;\n /** Whether the tag is pressed. */\n isPressed: boolean;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the behavior and accessibility implementation for a tag component.\n * Tags are individual items within a TagGroup.\n */\nexport function createTag<T>(\n props: MaybeAccessor<AriaTagProps>,\n state: ListState<T>,\n ref: () => HTMLElement | null\n): TagAria {\n const getProps = () => access(props);\n const rowId = createId();\n const cellId = createId();\n const removeButtonId = createId();\n\n // Get shared data from tag group\n const getData = () => getTagGroupData(state);\n\n // Get key\n const key = () => getProps().key;\n\n // Compute states\n const isDisabled = createMemo(() => {\n const p = getProps();\n return p.isDisabled || state.isDisabled(key());\n });\n\n const isSelected = createMemo(() => {\n return state.isSelected(key());\n });\n\n const isFocused = createMemo(() => {\n return state.focusedKey() === key();\n });\n\n // Handle press for selection\n const { pressProps, isPressed } = createPress({\n isDisabled,\n onPress: () => {\n if (!isDisabled()) {\n state.toggleSelection(key());\n }\n },\n });\n\n // Handle focusable\n const { focusableProps } = createFocusable({\n isDisabled,\n }, ref);\n\n // Handle keyboard for removal\n const handleKeyDown = (e: KeyboardEvent) => {\n if (isDisabled()) return;\n\n if (e.key === 'Delete' || e.key === 'Backspace') {\n e.preventDefault();\n const data = getData();\n if (data?.onRemove) {\n // Remove selected keys if this tag is selected, otherwise just this tag\n if (isSelected()) {\n const selection = state.selectedKeys();\n const keysToRemove = selection === 'all'\n ? new Set(Array.from(state.collection()).map(item => (item as { key: Key }).key))\n : new Set(selection);\n data.onRemove(keysToRemove);\n } else {\n data.onRemove(new Set([key()]));\n }\n }\n }\n };\n\n // Compute tabIndex\n const tabIndex = createMemo(() => {\n if (isDisabled()) return -1;\n // If this is the focused item, or if nothing is focused yet\n if (isFocused() || state.focusedKey() === null) {\n return 0;\n }\n return -1;\n });\n\n // Filter DOM props\n const domProps = () => filterDOMProps(getProps() as unknown as Record<string, unknown>);\n\n // Check if removal is allowed\n const allowsRemoving = createMemo(() => {\n const data = getData();\n return !!data?.onRemove;\n });\n\n return {\n get rowProps() {\n return mergeProps(domProps(), focusableProps as Record<string, unknown>, pressProps as Record<string, unknown>, {\n id: rowId,\n role: 'row',\n tabIndex: tabIndex(),\n 'aria-selected': isSelected(),\n 'aria-disabled': isDisabled() || undefined,\n onKeyDown: handleKeyDown,\n });\n },\n get gridCellProps() {\n return {\n id: cellId,\n role: 'gridcell',\n 'aria-describedby': allowsRemoving() ? removeButtonId : undefined,\n };\n },\n get removeButtonProps() {\n const data = getData();\n return {\n id: removeButtonId,\n 'aria-label': 'Remove',\n 'aria-labelledby': `${removeButtonId} ${rowId}`,\n isDisabled: isDisabled(),\n onPress: () => {\n if (data?.onRemove && !isDisabled()) {\n data.onRemove(new Set([key()]));\n }\n },\n };\n },\n get allowsRemoving() {\n return allowsRemoving();\n },\n get isSelected() {\n return isSelected();\n },\n get isDisabled() {\n return isDisabled();\n },\n get isFocused() {\n return isFocused();\n },\n get isPressed() {\n return isPressed();\n },\n };\n}\n", "/**\n * createCalendar hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a calendar component.\n * Based on @react-aria/calendar useCalendar\n */\n\nimport { createMemo } from 'solid-js';\nimport { createId } from '../ssr';\nimport { access, type MaybeAccessor } from '../utils/reactivity';\nimport { mergeProps } from '../utils/mergeProps';\nimport type { CalendarState } from '@proyecto-viviana/solid-stately';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaCalendarProps {\n /** An ID for the calendar. */\n id?: string;\n /** Whether the calendar is disabled. */\n isDisabled?: boolean;\n /** Whether the calendar is read-only. */\n isReadOnly?: boolean;\n /** An accessible label for the calendar. */\n 'aria-label'?: string;\n /** The ID of an element that labels the calendar. */\n 'aria-labelledby'?: string;\n /** The ID of an element that describes the calendar. */\n 'aria-describedby'?: string;\n /** Minimum number of visible months. */\n visibleMonths?: number;\n}\n\nexport interface CalendarAria {\n /** Props for the calendar container element. */\n calendarProps: Record<string, unknown>;\n /** Props for the previous button. */\n prevButtonProps: Record<string, unknown>;\n /** Props for the next button. */\n nextButtonProps: Record<string, unknown>;\n /** Props for the title/heading element. */\n titleProps: Record<string, unknown>;\n /** An accessible label for the title. */\n title: string;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the behavior and accessibility implementation for a calendar component.\n */\nexport function createCalendar<T extends CalendarState>(\n props: MaybeAccessor<AriaCalendarProps>,\n state: T\n): CalendarAria {\n const getProps = () => access(props);\n const id = createId(getProps().id);\n const titleId = createId();\n\n // Title (e.g., \"December 2024\")\n const title = createMemo(() => state.title());\n\n // Previous button props\n const prevButtonProps = createMemo(() => {\n const p = getProps();\n const isDisabled = p.isDisabled || state.isDisabled();\n\n return {\n 'aria-label': 'Previous month',\n onClick: () => {\n if (!isDisabled) {\n state.focusPreviousPage();\n }\n },\n disabled: isDisabled,\n tabIndex: -1,\n };\n });\n\n // Next button props\n const nextButtonProps = createMemo(() => {\n const p = getProps();\n const isDisabled = p.isDisabled || state.isDisabled();\n\n return {\n 'aria-label': 'Next month',\n onClick: () => {\n if (!isDisabled) {\n state.focusNextPage();\n }\n },\n disabled: isDisabled,\n tabIndex: -1,\n };\n });\n\n // Title props\n const titleProps = createMemo(() => ({\n id: titleId,\n 'aria-live': 'polite' as const,\n }));\n\n // Calendar container props\n const calendarProps = createMemo(() => {\n const p = getProps();\n\n return mergeProps(\n {\n id,\n role: 'group',\n 'aria-labelledby': p['aria-labelledby'] ?? titleId,\n 'aria-label': p['aria-label'],\n 'aria-describedby': p['aria-describedby'],\n }\n );\n });\n\n return {\n get calendarProps() {\n return calendarProps();\n },\n get prevButtonProps() {\n return prevButtonProps();\n },\n get nextButtonProps() {\n return nextButtonProps();\n },\n get titleProps() {\n return titleProps();\n },\n get title() {\n return title();\n },\n };\n}\n", "/**\n * createCalendarGrid hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a calendar grid.\n * Based on @react-aria/calendar useCalendarGrid\n */\n\nimport { createMemo, onMount, onCleanup } from 'solid-js';\nimport { type MaybeAccessor } from '../utils/reactivity';\nimport type { CalendarState, CalendarDate } from '@proyecto-viviana/solid-stately';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaCalendarGridProps {\n /** The start date of the grid (defaults to start of focused month). */\n startDate?: CalendarDate;\n /** The end date of the grid (defaults to end of focused month). */\n endDate?: CalendarDate;\n /** The number of weeks to display. */\n weekdayStyle?: 'narrow' | 'short' | 'long';\n}\n\nexport interface CalendarGridAria {\n /** Props for the grid element (table or grid role). */\n gridProps: Record<string, unknown>;\n /** Props for the header row. */\n headerProps: Record<string, unknown>;\n /** Week day labels for the header. */\n weekDays: string[];\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the behavior and accessibility implementation for a calendar grid.\n */\nexport function createCalendarGrid<T extends CalendarState>(\n _props: MaybeAccessor<AriaCalendarGridProps>,\n state: T,\n ref?: () => HTMLElement | null\n): CalendarGridAria {\n // Week days for headers\n const weekDays = createMemo(() => state.weekDays());\n\n // Handle keyboard navigation\n const handleKeyDown = (e: KeyboardEvent) => {\n if (state.isDisabled()) return;\n\n switch (e.key) {\n case 'ArrowLeft':\n e.preventDefault();\n state.focusPreviousDay();\n break;\n case 'ArrowRight':\n e.preventDefault();\n state.focusNextDay();\n break;\n case 'ArrowUp':\n e.preventDefault();\n state.focusPreviousWeek();\n break;\n case 'ArrowDown':\n e.preventDefault();\n state.focusNextWeek();\n break;\n case 'PageUp':\n e.preventDefault();\n if (e.shiftKey) {\n state.focusPreviousSection(); // Previous year\n } else {\n state.focusPreviousPage(); // Previous month\n }\n break;\n case 'PageDown':\n e.preventDefault();\n if (e.shiftKey) {\n state.focusNextSection(); // Next year\n } else {\n state.focusNextPage(); // Next month\n }\n break;\n case 'Home':\n e.preventDefault();\n state.focusPageStart();\n break;\n case 'End':\n e.preventDefault();\n state.focusPageEnd();\n break;\n case 'Enter':\n case ' ':\n e.preventDefault();\n state.selectFocusedDate();\n break;\n }\n };\n\n // Register keyboard listener\n onMount(() => {\n const element = ref?.();\n if (element) {\n element.addEventListener('keydown', handleKeyDown);\n onCleanup(() => {\n element.removeEventListener('keydown', handleKeyDown);\n });\n }\n });\n\n // Grid props\n const gridProps = createMemo(() => ({\n role: 'grid',\n 'aria-readonly': state.isReadOnly() || undefined,\n 'aria-disabled': state.isDisabled() || undefined,\n tabIndex: state.isFocused() ? 0 : -1,\n onFocus: () => state.setFocused(true),\n onBlur: () => state.setFocused(false),\n onKeyDown: handleKeyDown,\n }));\n\n // Header props\n const headerProps = createMemo(() => ({\n role: 'row',\n }));\n\n return {\n get gridProps() {\n return gridProps();\n },\n get headerProps() {\n return headerProps();\n },\n get weekDays() {\n return weekDays();\n },\n };\n}\n", "/**\n * createCalendarCell hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a calendar cell.\n * Based on @react-aria/calendar useCalendarCell\n */\n\nimport { createSignal, createMemo, onMount } from 'solid-js';\nimport { access, type MaybeAccessor } from '../utils/reactivity';\nimport type { CalendarState, CalendarDate, DateValue } from '@proyecto-viviana/solid-stately';\nimport { isToday as isTodayUtil, DateFormatter, getLocalTimeZone } from '@internationalized/date';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaCalendarCellProps {\n /** The date represented by the cell. */\n date: DateValue;\n /** Whether the cell is disabled. */\n isDisabled?: boolean;\n}\n\nexport interface CalendarCellAria {\n /** Props for the cell element (td or gridcell). */\n cellProps: Record<string, unknown>;\n /** Props for the button inside the cell. */\n buttonProps: Record<string, unknown>;\n /** Whether the cell is selected. */\n isSelected: boolean;\n /** Whether the cell is focused. */\n isFocused: boolean;\n /** Whether the cell is disabled. */\n isDisabled: boolean;\n /** Whether the cell is unavailable (e.g., booked date). */\n isUnavailable: boolean;\n /** Whether the cell is outside the visible month. */\n isOutsideMonth: boolean;\n /** Whether the cell represents today. */\n isToday: boolean;\n /** Whether the cell is pressed. */\n isPressed: boolean;\n /** The formatted date string. */\n formattedDate: string;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the behavior and accessibility implementation for a calendar cell.\n */\nexport function createCalendarCell<T extends CalendarState>(\n props: MaybeAccessor<AriaCalendarCellProps>,\n state: T,\n ref?: () => HTMLElement | null\n): CalendarCellAria {\n const getProps = () => access(props);\n const [isPressed, setIsPressed] = createSignal(false);\n const timeZone = getLocalTimeZone();\n\n // Get the date from props\n const date = createMemo(() => getProps().date as CalendarDate);\n\n // Check states\n const isSelected = createMemo(() => state.isSelected(date()));\n const isFocused = createMemo(() => state.isCellFocused(date()));\n const isDisabled = createMemo(() => {\n return getProps().isDisabled || state.isCellDisabled(date());\n });\n const isUnavailable = createMemo(() => state.isCellUnavailable(date()));\n const isOutsideMonth = createMemo(() => state.isOutsideVisibleRange(date()));\n const isToday = createMemo(() => isTodayUtil(date(), timeZone));\n\n // Format the date for display\n const formattedDate = createMemo(() => {\n return date().day.toString();\n });\n\n // Handle pointer down - this is where selection happens\n // Using pointerdown instead of click ensures selection happens immediately\n // before focus changes can interfere with the event\n const handlePointerDown = (e: PointerEvent) => {\n if (!isDisabled() && !isUnavailable()) {\n setIsPressed(true);\n // Select the date on pointer down for immediate response\n // This matches React Aria's behavior of using onPressStart\n state.selectDate(date());\n // Prevent default to avoid double-triggering with onClick\n e.preventDefault();\n }\n };\n\n // Handle click - kept for accessibility (keyboard Enter/Space)\n const handleClick = () => {\n // Only select on click if not already selected via pointerdown\n // This handles keyboard activation (Enter/Space)\n if (!isDisabled() && !isUnavailable()) {\n state.selectDate(date());\n }\n };\n\n const handlePointerUp = () => {\n setIsPressed(false);\n };\n\n // Focus the button when it becomes focused in state\n onMount(() => {\n const element = ref?.();\n if (element && isFocused()) {\n element.focus();\n }\n });\n\n // Cell props (for the td element)\n const cellProps = createMemo(() => ({\n role: 'gridcell',\n 'aria-disabled': isDisabled() || undefined,\n 'aria-selected': isSelected() || undefined,\n }));\n\n // Button props (for the interactive element inside)\n const buttonProps = createMemo(() => {\n const d = date();\n const formatter = new DateFormatter('en-US', {\n weekday: 'long',\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n });\n\n return {\n role: 'button',\n tabIndex: isFocused() ? 0 : -1,\n 'aria-label': formatter.format(d.toDate(timeZone)),\n 'aria-disabled': isDisabled() || undefined,\n 'aria-pressed': isPressed() || undefined,\n disabled: isDisabled(),\n onClick: handleClick,\n onPointerDown: handlePointerDown,\n onPointerUp: handlePointerUp,\n onPointerLeave: handlePointerUp,\n onFocus: () => {\n // Only update if this cell isn't already the focused date\n // This prevents infinite loops when focus is programmatically set\n if (!state.isCellFocused(d)) {\n state.setFocusedDate(d);\n }\n state.setFocused(true);\n },\n };\n });\n\n return {\n get cellProps() {\n return cellProps();\n },\n get buttonProps() {\n return buttonProps();\n },\n get isSelected() {\n return isSelected();\n },\n get isFocused() {\n return isFocused();\n },\n get isDisabled() {\n return isDisabled();\n },\n get isUnavailable() {\n return isUnavailable();\n },\n get isOutsideMonth() {\n return isOutsideMonth();\n },\n get isToday() {\n return isToday();\n },\n get isPressed() {\n return isPressed();\n },\n get formattedDate() {\n return formattedDate();\n },\n };\n}\n", "/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport type Mutable<T> = {\n -readonly[P in keyof T]: T[P]\n};\n\nexport function mod(amount: number, numerator: number): number {\n return amount - numerator * Math.floor(amount / numerator);\n}\n", "/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from ICU.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate, Calendar, CalendarIdentifier} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {mod, Mutable} from '../utils';\n\nconst EPOCH = 1721426; // 001/01/03 Julian C.E.\nexport function gregorianToJulianDay(era: string, year: number, month: number, day: number): number {\n year = getExtendedYear(era, year);\n\n let y1 = year - 1;\n let monthOffset = -2;\n if (month <= 2) {\n monthOffset = 0;\n } else if (isLeapYear(year)) {\n monthOffset = -1;\n }\n\n return (\n EPOCH -\n 1 +\n 365 * y1 +\n Math.floor(y1 / 4) -\n Math.floor(y1 / 100) +\n Math.floor(y1 / 400) +\n Math.floor((367 * month - 362) / 12 + monthOffset + day)\n );\n}\n\nexport function isLeapYear(year: number): boolean {\n return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n}\n\nexport function getExtendedYear(era: string, year: number): number {\n return era === 'BC' ? 1 - year : year;\n}\n\nexport function fromExtendedYear(year: number): [string, number] {\n let era = 'AD';\n if (year <= 0) {\n era = 'BC';\n year = 1 - year;\n }\n\n return [era, year];\n}\n\nconst daysInMonth = {\n standard: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],\n leapyear: [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n};\n\n/**\n * The Gregorian calendar is the most commonly used calendar system in the world. It supports two eras: BC, and AD.\n * Years always contain 12 months, and 365 or 366 days depending on whether it is a leap year.\n */\nexport class GregorianCalendar implements Calendar {\n identifier: CalendarIdentifier = 'gregory';\n\n fromJulianDay(jd: number): CalendarDate {\n let jd0 = jd;\n let depoch = jd0 - EPOCH;\n let quadricent = Math.floor(depoch / 146097);\n let dqc = mod(depoch, 146097);\n let cent = Math.floor(dqc / 36524);\n let dcent = mod(dqc, 36524);\n let quad = Math.floor(dcent / 1461);\n let dquad = mod(dcent, 1461);\n let yindex = Math.floor(dquad / 365);\n\n let extendedYear = quadricent * 400 + cent * 100 + quad * 4 + yindex + (cent !== 4 && yindex !== 4 ? 1 : 0);\n let [era, year] = fromExtendedYear(extendedYear);\n let yearDay = jd0 - gregorianToJulianDay(era, year, 1, 1);\n let leapAdj = 2;\n if (jd0 < gregorianToJulianDay(era, year, 3, 1)) {\n leapAdj = 0;\n } else if (isLeapYear(year)) {\n leapAdj = 1;\n }\n let month = Math.floor(((yearDay + leapAdj) * 12 + 373) / 367);\n let day = jd0 - gregorianToJulianDay(era, year, month, 1) + 1;\n\n return new CalendarDate(era, year, month, day);\n }\n\n toJulianDay(date: AnyCalendarDate): number {\n return gregorianToJulianDay(date.era, date.year, date.month, date.day);\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return daysInMonth[isLeapYear(date.year) ? 'leapyear' : 'standard'][date.month - 1];\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getMonthsInYear(date: AnyCalendarDate): number {\n return 12;\n }\n\n getDaysInYear(date: AnyCalendarDate): number {\n return isLeapYear(date.year) ? 366 : 365;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getYearsInEra(date: AnyCalendarDate): number {\n return 9999;\n }\n\n getEras(): string[] {\n return ['BC', 'AD'];\n }\n\n isInverseEra(date: AnyCalendarDate): boolean {\n return date.era === 'BC';\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>): void {\n if (date.year <= 0) {\n date.era = date.era === 'BC' ? 'AD' : 'BC';\n date.year = 1 - date.year;\n }\n }\n}\n", "/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AnyCalendarDate, AnyTime, Calendar} from './types';\nimport {CalendarDate, CalendarDateTime, ZonedDateTime} from './CalendarDate';\nimport {fromAbsolute, toAbsolute, toCalendar, toCalendarDate} from './conversion';\nimport {weekStartData} from './weekStartData';\n\ntype DateValue = CalendarDate | CalendarDateTime | ZonedDateTime;\n\n/** Returns whether the given dates occur on the same day, regardless of the time or calendar system. */\nexport function isSameDay(a: DateValue, b: DateValue): boolean {\n b = toCalendar(b, a.calendar);\n return a.era === b.era && a.year === b.year && a.month === b.month && a.day === b.day;\n}\n\n/** Returns whether the given dates occur in the same month, using the calendar system of the first date. */\nexport function isSameMonth(a: DateValue, b: DateValue): boolean {\n b = toCalendar(b, a.calendar);\n // In the Japanese calendar, months can span multiple eras/years, so only compare the first of the month.\n a = startOfMonth(a);\n b = startOfMonth(b);\n return a.era === b.era && a.year === b.year && a.month === b.month;\n}\n\n/** Returns whether the given dates occur in the same year, using the calendar system of the first date. */\nexport function isSameYear(a: DateValue, b: DateValue): boolean {\n b = toCalendar(b, a.calendar);\n a = startOfYear(a);\n b = startOfYear(b);\n return a.era === b.era && a.year === b.year;\n}\n\n/** Returns whether the given dates occur on the same day, and are of the same calendar system. */\nexport function isEqualDay(a: DateValue, b: DateValue): boolean {\n return isEqualCalendar(a.calendar, b.calendar) && isSameDay(a, b);\n}\n\n/** Returns whether the given dates occur in the same month, and are of the same calendar system. */\nexport function isEqualMonth(a: DateValue, b: DateValue): boolean {\n return isEqualCalendar(a.calendar, b.calendar) && isSameMonth(a, b);\n}\n\n/** Returns whether the given dates occur in the same year, and are of the same calendar system. */\nexport function isEqualYear(a: DateValue, b: DateValue): boolean {\n return isEqualCalendar(a.calendar, b.calendar) && isSameYear(a, b);\n}\n\n/** Returns whether two calendars are the same. */\nexport function isEqualCalendar(a: Calendar, b: Calendar): boolean {\n return a.isEqual?.(b) ?? b.isEqual?.(a) ?? a.identifier === b.identifier;\n}\n\n/** Returns whether the date is today in the given time zone. */\nexport function isToday(date: DateValue, timeZone: string): boolean {\n return isSameDay(date, today(timeZone));\n}\n\nconst DAY_MAP = {\n sun: 0,\n mon: 1,\n tue: 2,\n wed: 3,\n thu: 4,\n fri: 5,\n sat: 6\n};\n\ntype DayOfWeek = 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat';\n\n/**\n * Returns the day of week for the given date and locale. Days are numbered from zero to six,\n * where zero is the first day of the week in the given locale. For example, in the United States,\n * the first day of the week is Sunday, but in France it is Monday.\n */\nexport function getDayOfWeek(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): number {\n let julian = date.calendar.toJulianDay(date);\n\n // If julian is negative, then julian % 7 will be negative, so we adjust\n // accordingly. Julian day 0 is Monday.\n let weekStart = firstDayOfWeek ? DAY_MAP[firstDayOfWeek] : getWeekStart(locale);\n let dayOfWeek = Math.ceil(julian + 1 - weekStart) % 7;\n if (dayOfWeek < 0) {\n dayOfWeek += 7;\n }\n\n return dayOfWeek;\n}\n\n/** Returns the current time in the given time zone. */\nexport function now(timeZone: string): ZonedDateTime {\n return fromAbsolute(Date.now(), timeZone);\n}\n\n/** Returns today's date in the given time zone. */\nexport function today(timeZone: string): CalendarDate {\n return toCalendarDate(now(timeZone));\n}\n\nexport function compareDate(a: AnyCalendarDate, b: AnyCalendarDate): number {\n return a.calendar.toJulianDay(a) - b.calendar.toJulianDay(b);\n}\n\nexport function compareTime(a: AnyTime, b: AnyTime): number {\n return timeToMs(a) - timeToMs(b);\n}\n\nfunction timeToMs(a: AnyTime): number {\n return a.hour * 60 * 60 * 1000 + a.minute * 60 * 1000 + a.second * 1000 + a.millisecond;\n}\n\n/**\n * Returns the number of hours in the given date and time zone.\n * Usually this is 24, but it could be 23 or 25 if the date is on a daylight saving transition.\n */\nexport function getHoursInDay(a: CalendarDate, timeZone: string): number {\n let ms = toAbsolute(a, timeZone);\n let tomorrow = a.add({days: 1});\n let tomorrowMs = toAbsolute(tomorrow, timeZone);\n return (tomorrowMs - ms) / 3600000;\n}\n\nlet localTimeZone: string | null = null;\n\n/** Returns the time zone identifier for the current user. */\nexport function getLocalTimeZone(): string {\n if (localTimeZone == null) {\n localTimeZone = new Intl.DateTimeFormat().resolvedOptions().timeZone;\n }\n\n return localTimeZone!;\n}\n\n/** Sets the time zone identifier for the current user. */\nexport function setLocalTimeZone(timeZone: string): void {\n localTimeZone = timeZone;\n}\n\n/** Resets the time zone identifier for the current user. */\nexport function resetLocalTimeZone(): void {\n localTimeZone = null;\n}\n\n/** Returns the first date of the month for the given date. */\nexport function startOfMonth(date: ZonedDateTime): ZonedDateTime;\nexport function startOfMonth(date: CalendarDateTime): CalendarDateTime;\nexport function startOfMonth(date: CalendarDate): CalendarDate;\nexport function startOfMonth(date: DateValue): DateValue;\nexport function startOfMonth(date: DateValue): DateValue {\n // Use `subtract` instead of `set` so we don't get constrained in an era.\n return date.subtract({days: date.day - 1});\n}\n\n/** Returns the last date of the month for the given date. */\nexport function endOfMonth(date: ZonedDateTime): ZonedDateTime;\nexport function endOfMonth(date: CalendarDateTime): CalendarDateTime;\nexport function endOfMonth(date: CalendarDate): CalendarDate;\nexport function endOfMonth(date: DateValue): DateValue;\nexport function endOfMonth(date: DateValue): DateValue {\n return date.add({days: date.calendar.getDaysInMonth(date) - date.day});\n}\n\n/** Returns the first day of the year for the given date. */\nexport function startOfYear(date: ZonedDateTime): ZonedDateTime;\nexport function startOfYear(date: CalendarDateTime): CalendarDateTime;\nexport function startOfYear(date: CalendarDate): CalendarDate;\nexport function startOfYear(date: DateValue): DateValue;\nexport function startOfYear(date: DateValue): DateValue {\n return startOfMonth(date.subtract({months: date.month - 1}));\n}\n\n/** Returns the last day of the year for the given date. */\nexport function endOfYear(date: ZonedDateTime): ZonedDateTime;\nexport function endOfYear(date: CalendarDateTime): CalendarDateTime;\nexport function endOfYear(date: CalendarDate): CalendarDate;\nexport function endOfYear(date: DateValue): DateValue;\nexport function endOfYear(date: DateValue): DateValue {\n return endOfMonth(date.add({months: date.calendar.getMonthsInYear(date) - date.month}));\n}\n\nexport function getMinimumMonthInYear(date: AnyCalendarDate): number {\n if (date.calendar.getMinimumMonthInYear) {\n return date.calendar.getMinimumMonthInYear(date);\n }\n\n return 1;\n}\n\nexport function getMinimumDayInMonth(date: AnyCalendarDate): number {\n if (date.calendar.getMinimumDayInMonth) {\n return date.calendar.getMinimumDayInMonth(date);\n }\n\n return 1;\n}\n\n/** Returns the first date of the week for the given date and locale. */\nexport function startOfWeek(date: ZonedDateTime, locale: string, firstDayOfWeek?: DayOfWeek): ZonedDateTime;\nexport function startOfWeek(date: CalendarDateTime, locale: string, firstDayOfWeek?: DayOfWeek): CalendarDateTime;\nexport function startOfWeek(date: CalendarDate, locale: string, firstDayOfWeek?: DayOfWeek): CalendarDate;\nexport function startOfWeek(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): DateValue;\nexport function startOfWeek(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): DateValue {\n let dayOfWeek = getDayOfWeek(date, locale, firstDayOfWeek);\n return date.subtract({days: dayOfWeek});\n}\n\n/** Returns the last date of the week for the given date and locale. */\nexport function endOfWeek(date: ZonedDateTime, locale: string, firstDayOfWeek?: DayOfWeek): ZonedDateTime;\nexport function endOfWeek(date: CalendarDateTime, locale: string, firstDayOfWeek?: DayOfWeek): CalendarDateTime;\nexport function endOfWeek(date: CalendarDate, locale: string, firstDayOfWeek?: DayOfWeek): CalendarDate;\nexport function endOfWeek(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): DateValue;\nexport function endOfWeek(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): DateValue {\n return startOfWeek(date, locale, firstDayOfWeek).add({days: 6});\n}\n\nconst cachedRegions = new Map<string, string>();\nconst cachedWeekInfo = new Map<string, {firstDay: number}>();\n\nfunction getRegion(locale: string): string | undefined {\n // If the Intl.Locale API is available, use it to get the region for the locale.\n // @ts-ignore\n if (Intl.Locale) {\n // Constructing an Intl.Locale is expensive, so cache the result.\n let region = cachedRegions.get(locale);\n if (!region) {\n // @ts-ignore\n region = new Intl.Locale(locale).maximize().region;\n if (region) {\n cachedRegions.set(locale, region);\n }\n }\n return region;\n }\n\n // If not, just try splitting the string.\n // If the second part of the locale string is 'u',\n // then this is a unicode extension, so ignore it.\n // Otherwise, it should be the region.\n let part = locale.split('-')[1];\n return part === 'u' ? undefined : part;\n}\n\nfunction getWeekStart(locale: string): number {\n // TODO: use Intl.Locale for this once browsers support the weekInfo property\n // https://github.com/tc39/proposal-intl-locale-info\n let weekInfo = cachedWeekInfo.get(locale);\n if (!weekInfo) {\n if (Intl.Locale) {\n // @ts-ignore\n let localeInst = new Intl.Locale(locale);\n if ('getWeekInfo' in localeInst) {\n // @ts-expect-error\n weekInfo = localeInst.getWeekInfo();\n if (weekInfo) {\n cachedWeekInfo.set(locale, weekInfo);\n return weekInfo.firstDay;\n }\n }\n }\n let region = getRegion(locale);\n if (locale.includes('-fw-')) {\n // pull the value for the attribute fw from strings such as en-US-u-ca-iso8601-fw-tue or en-US-u-ca-iso8601-fw-mon-nu-thai\n // where the fw attribute could be followed by another unicode locale extension or not\n let day = locale.split('-fw-')[1].split('-')[0];\n if (day === 'mon') {\n weekInfo = {firstDay: 1};\n } else if (day === 'tue') {\n weekInfo = {firstDay: 2};\n } else if (day === 'wed') {\n weekInfo = {firstDay: 3};\n } else if (day === 'thu') {\n weekInfo = {firstDay: 4};\n } else if (day === 'fri') {\n weekInfo = {firstDay: 5};\n } else if (day === 'sat') {\n weekInfo = {firstDay: 6};\n } else {\n weekInfo = {firstDay: 0};\n }\n } else if (locale.includes('-ca-iso8601')) {\n weekInfo = {firstDay: 1};\n } else {\n weekInfo = {firstDay: region ? weekStartData[region] || 0 : 0};\n }\n cachedWeekInfo.set(locale, weekInfo);\n }\n\n return weekInfo.firstDay;\n}\n\n/** Returns the number of weeks in the given month and locale. */\nexport function getWeeksInMonth(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): number {\n let days = date.calendar.getDaysInMonth(date);\n return Math.ceil((getDayOfWeek(startOfMonth(date), locale, firstDayOfWeek) + days) / 7);\n}\n\n/** Returns the lesser of the two provider dates. */\nexport function minDate<A extends DateValue, B extends DateValue>(a?: A | null, b?: B | null): A | B | null | undefined {\n if (a && b) {\n return a.compare(b) <= 0 ? a : b;\n }\n\n return a || b;\n}\n\n/** Returns the greater of the two provider dates. */\nexport function maxDate<A extends DateValue, B extends DateValue>(a?: A | null, b?: B | null): A | B | null | undefined {\n if (a && b) {\n return a.compare(b) >= 0 ? a : b;\n }\n\n return a || b;\n}\n\nconst WEEKEND_DATA = {\n AF: [4, 5],\n AE: [5, 6],\n BH: [5, 6],\n DZ: [5, 6],\n EG: [5, 6],\n IL: [5, 6],\n IQ: [5, 6],\n IR: [5, 5],\n JO: [5, 6],\n KW: [5, 6],\n LY: [5, 6],\n OM: [5, 6],\n QA: [5, 6],\n SA: [5, 6],\n SD: [5, 6],\n SY: [5, 6],\n YE: [5, 6]\n};\n\n/** Returns whether the given date is on a weekend in the given locale. */\nexport function isWeekend(date: DateValue, locale: string): boolean {\n let julian = date.calendar.toJulianDay(date);\n\n // If julian is negative, then julian % 7 will be negative, so we adjust\n // accordingly. Julian day 0 is Monday.\n let dayOfWeek = Math.ceil(julian + 1) % 7;\n if (dayOfWeek < 0) {\n dayOfWeek += 7;\n }\n\n let region = getRegion(locale);\n // Use Intl.Locale for this once weekInfo is supported.\n // https://github.com/tc39/proposal-intl-locale-info\n let [start, end] = WEEKEND_DATA[region!] || [6, 0];\n return dayOfWeek === start || dayOfWeek === end;\n}\n\n/** Returns whether the given date is on a weekday in the given locale. */\nexport function isWeekday(date: DateValue, locale: string): boolean {\n return !isWeekend(date, locale);\n}\n", "/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from the TC39 Temporal proposal.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate, AnyDateTime, AnyTime, Calendar, DateFields, Disambiguation, TimeFields} from './types';\nimport {CalendarDate, CalendarDateTime, Time, ZonedDateTime} from './CalendarDate';\nimport {constrain} from './manipulation';\nimport {getExtendedYear, GregorianCalendar} from './calendars/GregorianCalendar';\nimport {getLocalTimeZone, isEqualCalendar} from './queries';\nimport {Mutable} from './utils';\n\nexport function epochFromDate(date: AnyDateTime): number {\n date = toCalendar(date, new GregorianCalendar());\n let year = getExtendedYear(date.era, date.year);\n return epochFromParts(year, date.month, date.day, date.hour, date.minute, date.second, date.millisecond);\n}\n\nfunction epochFromParts(year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number): number {\n // Note: Date.UTC() interprets one and two-digit years as being in the\n // 20th century, so don't use it\n let date = new Date();\n date.setUTCHours(hour, minute, second, millisecond);\n date.setUTCFullYear(year, month - 1, day);\n return date.getTime();\n}\n\nexport function getTimeZoneOffset(ms: number, timeZone: string): number {\n // Fast path for UTC.\n if (timeZone === 'UTC') {\n return 0;\n }\n\n // Fast path: for local timezone after 1970, use native Date.\n if (ms > 0 && timeZone === getLocalTimeZone()) {\n return new Date(ms).getTimezoneOffset() * -60 * 1000;\n }\n\n let {year, month, day, hour, minute, second} = getTimeZoneParts(ms, timeZone);\n let utc = epochFromParts(year, month, day, hour, minute, second, 0);\n return utc - Math.floor(ms / 1000) * 1000;\n}\n\nconst formattersByTimeZone = new Map<string, Intl.DateTimeFormat>();\n\nfunction getTimeZoneParts(ms: number, timeZone: string) {\n let formatter = formattersByTimeZone.get(timeZone);\n if (!formatter) {\n formatter = new Intl.DateTimeFormat('en-US', {\n timeZone,\n hour12: false,\n era: 'short',\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric'\n });\n\n formattersByTimeZone.set(timeZone, formatter);\n }\n\n let parts = formatter.formatToParts(new Date(ms));\n let namedParts: {[name: string]: string} = {};\n for (let part of parts) {\n if (part.type !== 'literal') {\n namedParts[part.type] = part.value;\n }\n }\n\n\n return {\n // Firefox returns B instead of BC... https://bugzilla.mozilla.org/show_bug.cgi?id=1752253\n year: namedParts.era === 'BC' || namedParts.era === 'B' ? -namedParts.year + 1 : +namedParts.year,\n month: +namedParts.month,\n day: +namedParts.day,\n hour: namedParts.hour === '24' ? 0 : +namedParts.hour, // bugs.chromium.org/p/chromium/issues/detail?id=1045791\n minute: +namedParts.minute,\n second: +namedParts.second\n };\n}\n\nconst DAYMILLIS = 86400000;\n\nexport function possibleAbsolutes(date: CalendarDateTime, timeZone: string): number[] {\n let ms = epochFromDate(date);\n let earlier = ms - getTimeZoneOffset(ms - DAYMILLIS, timeZone);\n let later = ms - getTimeZoneOffset(ms + DAYMILLIS, timeZone);\n return getValidWallTimes(date, timeZone, earlier, later);\n}\n\nfunction getValidWallTimes(date: CalendarDateTime, timeZone: string, earlier: number, later: number): number[] {\n let found = earlier === later ? [earlier] : [earlier, later];\n return found.filter(absolute => isValidWallTime(date, timeZone, absolute));\n}\n\nfunction isValidWallTime(date: CalendarDateTime, timeZone: string, absolute: number) {\n let parts = getTimeZoneParts(absolute, timeZone);\n return date.year === parts.year\n && date.month === parts.month\n && date.day === parts.day\n && date.hour === parts.hour\n && date.minute === parts.minute\n && date.second === parts.second;\n}\n\nexport function toAbsolute(date: CalendarDate | CalendarDateTime, timeZone: string, disambiguation: Disambiguation = 'compatible'): number {\n let dateTime = toCalendarDateTime(date);\n\n // Fast path: if the time zone is UTC, use native Date.\n if (timeZone === 'UTC') {\n return epochFromDate(dateTime);\n }\n\n // Fast path: if the time zone is the local timezone and disambiguation is compatible, use native Date.\n if (timeZone === getLocalTimeZone() && disambiguation === 'compatible') {\n dateTime = toCalendar(dateTime, new GregorianCalendar());\n\n // Don't use Date constructor here because two-digit years are interpreted in the 20th century.\n let date = new Date();\n let year = getExtendedYear(dateTime.era, dateTime.year);\n date.setFullYear(year, dateTime.month - 1, dateTime.day);\n date.setHours(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);\n return date.getTime();\n }\n\n let ms = epochFromDate(dateTime);\n let offsetBefore = getTimeZoneOffset(ms - DAYMILLIS, timeZone);\n let offsetAfter = getTimeZoneOffset(ms + DAYMILLIS, timeZone);\n let valid = getValidWallTimes(dateTime, timeZone, ms - offsetBefore, ms - offsetAfter);\n\n if (valid.length === 1) {\n return valid[0];\n }\n\n if (valid.length > 1) {\n switch (disambiguation) {\n // 'compatible' means 'earlier' for \"fall back\" transitions\n case 'compatible':\n case 'earlier':\n return valid[0];\n case 'later':\n return valid[valid.length - 1];\n case 'reject':\n throw new RangeError('Multiple possible absolute times found');\n }\n }\n\n switch (disambiguation) {\n case 'earlier':\n return Math.min(ms - offsetBefore, ms - offsetAfter);\n // 'compatible' means 'later' for \"spring forward\" transitions\n case 'compatible':\n case 'later':\n return Math.max(ms - offsetBefore, ms - offsetAfter);\n case 'reject':\n throw new RangeError('No such absolute time found');\n }\n}\n\nexport function toDate(dateTime: CalendarDate | CalendarDateTime, timeZone: string, disambiguation: Disambiguation = 'compatible'): Date {\n return new Date(toAbsolute(dateTime, timeZone, disambiguation));\n}\n\n/**\n * Takes a Unix epoch (milliseconds since 1970) and converts it to the provided time zone.\n */\nexport function fromAbsolute(ms: number, timeZone: string): ZonedDateTime {\n let offset = getTimeZoneOffset(ms, timeZone);\n let date = new Date(ms + offset);\n let year = date.getUTCFullYear();\n let month = date.getUTCMonth() + 1;\n let day = date.getUTCDate();\n let hour = date.getUTCHours();\n let minute = date.getUTCMinutes();\n let second = date.getUTCSeconds();\n let millisecond = date.getUTCMilliseconds();\n\n return new ZonedDateTime(year < 1 ? 'BC' : 'AD', year < 1 ? -year + 1 : year, month, day, timeZone, offset, hour, minute, second, millisecond);\n}\n\n/**\n * Takes a `Date` object and converts it to the provided time zone.\n */\nexport function fromDate(date: Date, timeZone: string): ZonedDateTime {\n return fromAbsolute(date.getTime(), timeZone);\n}\n\nexport function fromDateToLocal(date: Date): ZonedDateTime {\n return fromDate(date, getLocalTimeZone());\n}\n\n/** Converts a value with date components such as a `CalendarDateTime` or `ZonedDateTime` into a `CalendarDate`. */\nexport function toCalendarDate(dateTime: AnyCalendarDate): CalendarDate {\n return new CalendarDate(dateTime.calendar, dateTime.era, dateTime.year, dateTime.month, dateTime.day);\n}\n\nexport function toDateFields(date: AnyCalendarDate): DateFields {\n return {\n era: date.era,\n year: date.year,\n month: date.month,\n day: date.day\n };\n}\n\nexport function toTimeFields(date: AnyTime): TimeFields {\n return {\n hour: date.hour,\n minute: date.minute,\n second: date.second,\n millisecond: date.millisecond\n };\n}\n\n/**\n * Converts a date value to a `CalendarDateTime`. An optional `Time` value can be passed to set the time\n * of the resulting value, otherwise it will default to midnight.\n */\nexport function toCalendarDateTime(date: CalendarDate | CalendarDateTime | ZonedDateTime, time?: AnyTime): CalendarDateTime {\n let hour = 0, minute = 0, second = 0, millisecond = 0;\n if ('timeZone' in date) {\n ({hour, minute, second, millisecond} = date);\n } else if ('hour' in date && !time) {\n return date;\n }\n\n if (time) {\n ({hour, minute, second, millisecond} = time);\n }\n\n return new CalendarDateTime(\n date.calendar,\n date.era,\n date.year,\n date.month,\n date.day,\n hour,\n minute,\n second,\n millisecond\n );\n}\n\n/** Extracts the time components from a value containing a date and time. */\nexport function toTime(dateTime: CalendarDateTime | ZonedDateTime): Time {\n return new Time(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);\n}\n\n/** Converts a date from one calendar system to another. */\nexport function toCalendar<T extends AnyCalendarDate>(date: T, calendar: Calendar): T {\n if (isEqualCalendar(date.calendar, calendar)) {\n return date;\n }\n\n let calendarDate = calendar.fromJulianDay(date.calendar.toJulianDay(date));\n let copy: Mutable<T> = date.copy();\n copy.calendar = calendar;\n copy.era = calendarDate.era;\n copy.year = calendarDate.year;\n copy.month = calendarDate.month;\n copy.day = calendarDate.day;\n constrain(copy);\n return copy;\n}\n\n/**\n * Converts a date value to a `ZonedDateTime` in the provided time zone. The `disambiguation` option can be set\n * to control how values that fall on daylight saving time changes are interpreted.\n */\nexport function toZoned(date: CalendarDate | CalendarDateTime | ZonedDateTime, timeZone: string, disambiguation?: Disambiguation): ZonedDateTime {\n if (date instanceof ZonedDateTime) {\n if (date.timeZone === timeZone) {\n return date;\n }\n\n return toTimeZone(date, timeZone);\n }\n\n let ms = toAbsolute(date, timeZone, disambiguation);\n return fromAbsolute(ms, timeZone);\n}\n\nexport function zonedToDate(date: ZonedDateTime): Date {\n let ms = epochFromDate(date) - date.offset;\n return new Date(ms);\n}\n\n/** Converts a `ZonedDateTime` from one time zone to another. */\nexport function toTimeZone(date: ZonedDateTime, timeZone: string): ZonedDateTime {\n let ms = epochFromDate(date) - date.offset;\n return toCalendar(fromAbsolute(ms, timeZone), date.calendar);\n}\n\n/** Converts the given `ZonedDateTime` into the user's local time zone. */\nexport function toLocalTimeZone(date: ZonedDateTime): ZonedDateTime {\n return toTimeZone(date, getLocalTimeZone());\n}\n", "/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AnyCalendarDate, AnyDateTime, AnyTime, CycleOptions, CycleTimeOptions, DateDuration, DateField, DateFields, DateTimeDuration, Disambiguation, TimeDuration, TimeField, TimeFields} from './types';\nimport {CalendarDate, CalendarDateTime, Time, ZonedDateTime} from './CalendarDate';\nimport {epochFromDate, fromAbsolute, toAbsolute, toCalendar, toCalendarDateTime} from './conversion';\nimport {GregorianCalendar} from './calendars/GregorianCalendar';\nimport {Mutable} from './utils';\n\nconst ONE_HOUR = 3600000;\n\nexport function add(date: CalendarDateTime, duration: DateTimeDuration): CalendarDateTime;\nexport function add(date: CalendarDate, duration: DateDuration): CalendarDate;\nexport function add(date: CalendarDate | CalendarDateTime, duration: DateTimeDuration): CalendarDate | CalendarDateTime;\nexport function add(date: CalendarDate | CalendarDateTime, duration: DateTimeDuration): Mutable<AnyCalendarDate | AnyDateTime> {\n let mutableDate: Mutable<AnyCalendarDate | AnyDateTime> = date.copy();\n let days = 'hour' in mutableDate ? addTimeFields(mutableDate, duration) : 0;\n\n addYears(mutableDate, duration.years || 0);\n if (mutableDate.calendar.balanceYearMonth) {\n mutableDate.calendar.balanceYearMonth(mutableDate, date);\n }\n\n mutableDate.month += duration.months || 0;\n\n balanceYearMonth(mutableDate);\n constrainMonthDay(mutableDate);\n\n mutableDate.day += (duration.weeks || 0) * 7;\n mutableDate.day += duration.days || 0;\n mutableDate.day += days;\n\n balanceDay(mutableDate);\n\n if (mutableDate.calendar.balanceDate) {\n mutableDate.calendar.balanceDate(mutableDate);\n }\n\n // Constrain in case adding ended up with a date outside the valid range for the calendar system.\n // The behavior here is slightly different than when constraining in the `set` function in that\n // we adjust smaller fields to their minimum/maximum values rather than constraining each field\n // individually. This matches the general behavior of `add` vs `set` regarding how fields are balanced.\n if (mutableDate.year < 1) {\n mutableDate.year = 1;\n mutableDate.month = 1;\n mutableDate.day = 1;\n }\n\n let maxYear = mutableDate.calendar.getYearsInEra(mutableDate);\n if (mutableDate.year > maxYear) {\n let isInverseEra = mutableDate.calendar.isInverseEra?.(mutableDate);\n mutableDate.year = maxYear;\n mutableDate.month = isInverseEra ? 1 : mutableDate.calendar.getMonthsInYear(mutableDate);\n mutableDate.day = isInverseEra ? 1 : mutableDate.calendar.getDaysInMonth(mutableDate);\n }\n\n if (mutableDate.month < 1) {\n mutableDate.month = 1;\n mutableDate.day = 1;\n }\n\n let maxMonth = mutableDate.calendar.getMonthsInYear(mutableDate);\n if (mutableDate.month > maxMonth) {\n mutableDate.month = maxMonth;\n mutableDate.day = mutableDate.calendar.getDaysInMonth(mutableDate);\n }\n\n mutableDate.day = Math.max(1, Math.min(mutableDate.calendar.getDaysInMonth(mutableDate), mutableDate.day));\n return mutableDate;\n}\n\nfunction addYears(date: Mutable<AnyCalendarDate>, years: number) {\n if (date.calendar.isInverseEra?.(date)) {\n years = -years;\n }\n\n date.year += years;\n}\n\nfunction balanceYearMonth(date: Mutable<AnyCalendarDate>) {\n while (date.month < 1) {\n addYears(date, -1);\n date.month += date.calendar.getMonthsInYear(date);\n }\n\n let monthsInYear = 0;\n while (date.month > (monthsInYear = date.calendar.getMonthsInYear(date))) {\n date.month -= monthsInYear;\n addYears(date, 1);\n }\n}\n\nfunction balanceDay(date: Mutable<AnyCalendarDate>) {\n while (date.day < 1) {\n date.month--;\n balanceYearMonth(date);\n date.day += date.calendar.getDaysInMonth(date);\n }\n\n while (date.day > date.calendar.getDaysInMonth(date)) {\n date.day -= date.calendar.getDaysInMonth(date);\n date.month++;\n balanceYearMonth(date);\n }\n}\n\nfunction constrainMonthDay(date: Mutable<AnyCalendarDate>) {\n date.month = Math.max(1, Math.min(date.calendar.getMonthsInYear(date), date.month));\n date.day = Math.max(1, Math.min(date.calendar.getDaysInMonth(date), date.day));\n}\n\nexport function constrain(date: Mutable<AnyCalendarDate>): void {\n if (date.calendar.constrainDate) {\n date.calendar.constrainDate(date);\n }\n\n date.year = Math.max(1, Math.min(date.calendar.getYearsInEra(date), date.year));\n constrainMonthDay(date);\n}\n\nexport function invertDuration(duration: DateTimeDuration): DateTimeDuration {\n let inverseDuration = {};\n for (let key in duration) {\n if (typeof duration[key] === 'number') {\n inverseDuration[key] = -duration[key];\n }\n }\n\n return inverseDuration;\n}\n\nexport function subtract(date: CalendarDateTime, duration: DateTimeDuration): CalendarDateTime;\nexport function subtract(date: CalendarDate, duration: DateDuration): CalendarDate;\nexport function subtract(date: CalendarDate | CalendarDateTime, duration: DateTimeDuration): CalendarDate | CalendarDateTime {\n return add(date, invertDuration(duration));\n}\n\nexport function set(date: CalendarDateTime, fields: DateFields): CalendarDateTime;\nexport function set(date: CalendarDate, fields: DateFields): CalendarDate;\nexport function set(date: CalendarDate | CalendarDateTime, fields: DateFields): Mutable<AnyCalendarDate> {\n let mutableDate: Mutable<AnyCalendarDate> = date.copy();\n\n if (fields.era != null) {\n mutableDate.era = fields.era;\n }\n\n if (fields.year != null) {\n mutableDate.year = fields.year;\n }\n\n if (fields.month != null) {\n mutableDate.month = fields.month;\n }\n\n if (fields.day != null) {\n mutableDate.day = fields.day;\n }\n\n constrain(mutableDate);\n return mutableDate;\n}\n\nexport function setTime(value: CalendarDateTime, fields: TimeFields): CalendarDateTime;\nexport function setTime(value: Time, fields: TimeFields): Time;\nexport function setTime(value: Time | CalendarDateTime, fields: TimeFields): Mutable<Time | CalendarDateTime> {\n let mutableValue: Mutable<Time | CalendarDateTime> = value.copy();\n\n if (fields.hour != null) {\n mutableValue.hour = fields.hour;\n }\n\n if (fields.minute != null) {\n mutableValue.minute = fields.minute;\n }\n\n if (fields.second != null) {\n mutableValue.second = fields.second;\n }\n\n if (fields.millisecond != null) {\n mutableValue.millisecond = fields.millisecond;\n }\n\n constrainTime(mutableValue);\n return mutableValue;\n}\n\nfunction balanceTime(time: Mutable<AnyTime>): number {\n time.second += Math.floor(time.millisecond / 1000);\n time.millisecond = nonNegativeMod(time.millisecond, 1000);\n\n time.minute += Math.floor(time.second / 60);\n time.second = nonNegativeMod(time.second, 60);\n\n time.hour += Math.floor(time.minute / 60);\n time.minute = nonNegativeMod(time.minute, 60);\n\n let days = Math.floor(time.hour / 24);\n time.hour = nonNegativeMod(time.hour, 24);\n\n return days;\n}\n\nexport function constrainTime(time: Mutable<AnyTime>): void {\n time.millisecond = Math.max(0, Math.min(time.millisecond, 1000));\n time.second = Math.max(0, Math.min(time.second, 59));\n time.minute = Math.max(0, Math.min(time.minute, 59));\n time.hour = Math.max(0, Math.min(time.hour, 23));\n}\n\nfunction nonNegativeMod(a: number, b: number) {\n let result = a % b;\n if (result < 0) {\n result += b;\n }\n return result;\n}\n\nfunction addTimeFields(time: Mutable<AnyTime>, duration: TimeDuration): number {\n time.hour += duration.hours || 0;\n time.minute += duration.minutes || 0;\n time.second += duration.seconds || 0;\n time.millisecond += duration.milliseconds || 0;\n return balanceTime(time);\n}\n\nexport function addTime(time: Time, duration: TimeDuration): Time {\n let res = time.copy();\n addTimeFields(res, duration);\n return res;\n}\n\nexport function subtractTime(time: Time, duration: TimeDuration): Time {\n return addTime(time, invertDuration(duration));\n}\n\nexport function cycleDate(value: CalendarDateTime, field: DateField, amount: number, options?: CycleOptions): CalendarDateTime;\nexport function cycleDate(value: CalendarDate, field: DateField, amount: number, options?: CycleOptions): CalendarDate;\nexport function cycleDate(value: CalendarDate | CalendarDateTime, field: DateField, amount: number, options?: CycleOptions): Mutable<CalendarDate | CalendarDateTime> {\n let mutable: Mutable<CalendarDate | CalendarDateTime> = value.copy();\n\n switch (field) {\n case 'era': {\n let eras = value.calendar.getEras();\n let eraIndex = eras.indexOf(value.era);\n if (eraIndex < 0) {\n throw new Error('Invalid era: ' + value.era);\n }\n eraIndex = cycleValue(eraIndex, amount, 0, eras.length - 1, options?.round);\n mutable.era = eras[eraIndex];\n\n // Constrain the year and other fields within the era, so the era doesn't change when we balance below.\n constrain(mutable);\n break;\n }\n case 'year': {\n if (mutable.calendar.isInverseEra?.(mutable)) {\n amount = -amount;\n }\n\n // The year field should not cycle within the era as that can cause weird behavior affecting other fields.\n // We need to also allow values < 1 so that decrementing goes to the previous era. If we get -Infinity back\n // we know we wrapped around after reaching 9999 (the maximum), so set the year back to 1.\n mutable.year = cycleValue(value.year, amount, -Infinity, 9999, options?.round);\n if (mutable.year === -Infinity) {\n mutable.year = 1;\n }\n\n if (mutable.calendar.balanceYearMonth) {\n mutable.calendar.balanceYearMonth(mutable, value);\n }\n break;\n }\n case 'month':\n mutable.month = cycleValue(value.month, amount, 1, value.calendar.getMonthsInYear(value), options?.round);\n break;\n case 'day':\n mutable.day = cycleValue(value.day, amount, 1, value.calendar.getDaysInMonth(value), options?.round);\n break;\n default:\n throw new Error('Unsupported field ' + field);\n }\n\n if (value.calendar.balanceDate) {\n value.calendar.balanceDate(mutable);\n }\n\n constrain(mutable);\n return mutable;\n}\n\nexport function cycleTime(value: CalendarDateTime, field: TimeField, amount: number, options?: CycleTimeOptions): CalendarDateTime;\nexport function cycleTime(value: Time, field: TimeField, amount: number, options?: CycleTimeOptions): Time;\nexport function cycleTime(value: Time | CalendarDateTime, field: TimeField, amount: number, options?: CycleTimeOptions): Mutable<Time | CalendarDateTime> {\n let mutable: Mutable<Time | CalendarDateTime> = value.copy();\n\n switch (field) {\n case 'hour': {\n let hours = value.hour;\n let min = 0;\n let max = 23;\n if (options?.hourCycle === 12) {\n let isPM = hours >= 12;\n min = isPM ? 12 : 0;\n max = isPM ? 23 : 11;\n }\n mutable.hour = cycleValue(hours, amount, min, max, options?.round);\n break;\n }\n case 'minute':\n mutable.minute = cycleValue(value.minute, amount, 0, 59, options?.round);\n break;\n case 'second':\n mutable.second = cycleValue(value.second, amount, 0, 59, options?.round);\n break;\n case 'millisecond':\n mutable.millisecond = cycleValue(value.millisecond, amount, 0, 999, options?.round);\n break;\n default:\n throw new Error('Unsupported field ' + field);\n }\n\n return mutable;\n}\n\nfunction cycleValue(value: number, amount: number, min: number, max: number, round = false) {\n if (round) {\n value += Math.sign(amount);\n\n if (value < min) {\n value = max;\n }\n\n let div = Math.abs(amount);\n if (amount > 0) {\n value = Math.ceil(value / div) * div;\n } else {\n value = Math.floor(value / div) * div;\n }\n\n if (value > max) {\n value = min;\n }\n } else {\n value += amount;\n if (value < min) {\n value = max - (min - value - 1);\n } else if (value > max) {\n value = min + (value - max - 1);\n }\n }\n\n return value;\n}\n\nexport function addZoned(dateTime: ZonedDateTime, duration: DateTimeDuration): ZonedDateTime {\n let ms: number;\n if ((duration.years != null && duration.years !== 0) || (duration.months != null && duration.months !== 0) || (duration.weeks != null && duration.weeks !== 0) || (duration.days != null && duration.days !== 0)) {\n let res = add(toCalendarDateTime(dateTime), {\n years: duration.years,\n months: duration.months,\n weeks: duration.weeks,\n days: duration.days\n });\n\n // Changing the date may change the timezone offset, so we need to recompute\n // using the 'compatible' disambiguation.\n ms = toAbsolute(res, dateTime.timeZone);\n } else {\n // Otherwise, preserve the offset of the original date.\n ms = epochFromDate(dateTime) - dateTime.offset;\n }\n\n // Perform time manipulation in milliseconds rather than on the original time fields to account for DST.\n // For example, adding one hour during a DST transition may result in the hour field staying the same or\n // skipping an hour. This results in the offset field changing value instead of the specified field.\n ms += duration.milliseconds || 0;\n ms += (duration.seconds || 0) * 1000;\n ms += (duration.minutes || 0) * 60 * 1000;\n ms += (duration.hours || 0) * 60 * 60 * 1000;\n\n let res = fromAbsolute(ms, dateTime.timeZone);\n return toCalendar(res, dateTime.calendar);\n}\n\nexport function subtractZoned(dateTime: ZonedDateTime, duration: DateTimeDuration): ZonedDateTime {\n return addZoned(dateTime, invertDuration(duration));\n}\n\nexport function cycleZoned(dateTime: ZonedDateTime, field: DateField | TimeField, amount: number, options?: CycleTimeOptions): ZonedDateTime {\n // For date fields, we want the time to remain consistent and the UTC offset to potentially change to account for DST changes.\n // For time fields, we want the time to change by the amount given. This may result in the hour field staying the same, but the UTC\n // offset changing in the case of a backward DST transition, or skipping an hour in the case of a forward DST transition.\n switch (field) {\n case 'hour': {\n let min = 0;\n let max = 23;\n if (options?.hourCycle === 12) {\n let isPM = dateTime.hour >= 12;\n min = isPM ? 12 : 0;\n max = isPM ? 23 : 11;\n }\n\n // The minimum and maximum hour may be affected by daylight saving time.\n // For example, it might jump forward at midnight, and skip 1am.\n // Or it might end at midnight and repeat the 11pm hour. To handle this, we get\n // the possible absolute times for the min and max, and find the maximum range\n // that is within the current day.\n let plainDateTime = toCalendarDateTime(dateTime);\n let minDate = toCalendar(setTime(plainDateTime, {hour: min}), new GregorianCalendar());\n let minAbsolute = [toAbsolute(minDate, dateTime.timeZone, 'earlier'), toAbsolute(minDate, dateTime.timeZone, 'later')]\n .filter(ms => fromAbsolute(ms, dateTime.timeZone).day === minDate.day)[0];\n\n let maxDate = toCalendar(setTime(plainDateTime, {hour: max}), new GregorianCalendar());\n let maxAbsolute = [toAbsolute(maxDate, dateTime.timeZone, 'earlier'), toAbsolute(maxDate, dateTime.timeZone, 'later')]\n .filter(ms => fromAbsolute(ms, dateTime.timeZone).day === maxDate.day).pop()!;\n\n // Since hours may repeat, we need to operate on the absolute time in milliseconds.\n // This is done in hours from the Unix epoch so that cycleValue works correctly,\n // and then converted back to milliseconds.\n let ms = epochFromDate(dateTime) - dateTime.offset;\n let hours = Math.floor(ms / ONE_HOUR);\n let remainder = ms % ONE_HOUR;\n ms = cycleValue(\n hours,\n amount,\n Math.floor(minAbsolute / ONE_HOUR),\n Math.floor(maxAbsolute / ONE_HOUR),\n options?.round\n ) * ONE_HOUR + remainder;\n\n // Now compute the new timezone offset, and convert the absolute time back to local time.\n return toCalendar(fromAbsolute(ms, dateTime.timeZone), dateTime.calendar);\n }\n case 'minute':\n case 'second':\n case 'millisecond':\n // @ts-ignore\n return cycleTime(dateTime, field, amount, options);\n case 'era':\n case 'year':\n case 'month':\n case 'day': {\n let res = cycleDate(toCalendarDateTime(dateTime), field, amount, options);\n let ms = toAbsolute(res, dateTime.timeZone);\n return toCalendar(fromAbsolute(ms, dateTime.timeZone), dateTime.calendar);\n }\n default:\n throw new Error('Unsupported field ' + field);\n }\n}\n\nexport function setZoned(dateTime: ZonedDateTime, fields: DateFields & TimeFields, disambiguation?: Disambiguation): ZonedDateTime {\n // Set the date/time fields, and recompute the UTC offset to account for DST changes.\n // We also need to validate by converting back to a local time in case hours are skipped during forward DST transitions.\n let plainDateTime = toCalendarDateTime(dateTime);\n let res = setTime(set(plainDateTime, fields), fields);\n\n // If the resulting plain date time values are equal, return the original time.\n // We don't want to change the offset when setting the time to the same value.\n if (res.compare(plainDateTime) === 0) {\n return dateTime;\n }\n\n let ms = toAbsolute(res, dateTime.timeZone, disambiguation);\n return toCalendar(fromAbsolute(ms, dateTime.timeZone), dateTime.calendar);\n}\n", "/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AnyDateTime, DateTimeDuration, Disambiguation} from './types';\nimport {CalendarDate, CalendarDateTime, Time, ZonedDateTime} from './CalendarDate';\nimport {epochFromDate, fromAbsolute, possibleAbsolutes, toAbsolute, toCalendar, toCalendarDateTime, toTimeZone} from './conversion';\nimport {getLocalTimeZone} from './queries';\nimport {GregorianCalendar} from './calendars/GregorianCalendar';\nimport {Mutable} from './utils';\n\nconst TIME_RE = /^(\\d{2})(?::(\\d{2}))?(?::(\\d{2}))?(\\.\\d+)?$/;\nconst DATE_RE = /^([+-]\\d{6}|\\d{4})-(\\d{2})-(\\d{2})$/;\nconst DATE_TIME_RE = /^([+-]\\d{6}|\\d{4})-(\\d{2})-(\\d{2})(?:T(\\d{2}))?(?::(\\d{2}))?(?::(\\d{2}))?(\\.\\d+)?$/;\nconst ZONED_DATE_TIME_RE = /^([+-]\\d{6}|\\d{4})-(\\d{2})-(\\d{2})(?:T(\\d{2}))?(?::(\\d{2}))?(?::(\\d{2}))?(\\.\\d+)?(?:([+-]\\d{2})(?::?(\\d{2}))?(?::?(\\d{2}))?)?\\[(.*?)\\]$/;\nconst ABSOLUTE_RE = /^([+-]\\d{6}|\\d{4})-(\\d{2})-(\\d{2})(?:T(\\d{2}))?(?::(\\d{2}))?(?::(\\d{2}))?(\\.\\d+)?(?:(?:([+-]\\d{2})(?::?(\\d{2}))?)|Z)$/;\nconst DATE_TIME_DURATION_RE =\n /^((?<negative>-)|\\+)?P((?<years>\\d*)Y)?((?<months>\\d*)M)?((?<weeks>\\d*)W)?((?<days>\\d*)D)?((?<time>T)((?<hours>\\d*[.,]?\\d{1,9})H)?((?<minutes>\\d*[.,]?\\d{1,9})M)?((?<seconds>\\d*[.,]?\\d{1,9})S)?)?$/;\nconst requiredDurationTimeGroups = ['hours', 'minutes', 'seconds'];\nconst requiredDurationGroups = ['years', 'months', 'weeks', 'days', ...requiredDurationTimeGroups];\n\n/** Parses an ISO 8601 time string. */\nexport function parseTime(value: string): Time {\n let m = value.match(TIME_RE);\n if (!m) {\n throw new Error('Invalid ISO 8601 time string: ' + value);\n }\n\n return new Time(\n parseNumber(m[1], 0, 23),\n m[2] ? parseNumber(m[2], 0, 59) : 0,\n m[3] ? parseNumber(m[3], 0, 59) : 0,\n m[4] ? parseNumber(m[4], 0, Infinity) * 1000 : 0\n );\n}\n\n/** Parses an ISO 8601 date string, with no time components. */\nexport function parseDate(value: string): CalendarDate {\n let m = value.match(DATE_RE);\n if (!m) {\n if (ABSOLUTE_RE.test(value)) {\n throw new Error(`Invalid ISO 8601 date string: ${value}. Use parseAbsolute() instead.`);\n }\n throw new Error('Invalid ISO 8601 date string: ' + value);\n }\n\n let date: Mutable<CalendarDate> = new CalendarDate(\n parseNumber(m[1], 0, 9999),\n parseNumber(m[2], 1, 12),\n 1\n );\n\n date.day = parseNumber(m[3], 1, date.calendar.getDaysInMonth(date));\n return date as CalendarDate;\n}\n\n/** Parses an ISO 8601 date and time string, with no time zone. */\nexport function parseDateTime(value: string): CalendarDateTime {\n let m = value.match(DATE_TIME_RE);\n if (!m) {\n if (ABSOLUTE_RE.test(value)) {\n throw new Error(`Invalid ISO 8601 date time string: ${value}. Use parseAbsolute() instead.`);\n }\n throw new Error('Invalid ISO 8601 date time string: ' + value);\n }\n\n let year = parseNumber(m[1], -9999, 9999);\n let era = year < 1 ? 'BC' : 'AD';\n\n let date: Mutable<CalendarDateTime> = new CalendarDateTime(\n era,\n year < 1 ? -year + 1 : year,\n parseNumber(m[2], 1, 12),\n 1,\n m[4] ? parseNumber(m[4], 0, 23) : 0,\n m[5] ? parseNumber(m[5], 0, 59) : 0,\n m[6] ? parseNumber(m[6], 0, 59) : 0,\n m[7] ? parseNumber(m[7], 0, Infinity) * 1000 : 0\n );\n\n date.day = parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));\n return date as CalendarDateTime;\n}\n\n/**\n * Parses an ISO 8601 date and time string with a time zone extension and optional UTC offset\n * (e.g. \"2021-11-07T00:45[America/Los_Angeles]\" or \"2021-11-07T00:45-07:00[America/Los_Angeles]\").\n * Ambiguous times due to daylight saving time transitions are resolved according to the `disambiguation`\n * parameter.\n */\nexport function parseZonedDateTime(value: string, disambiguation?: Disambiguation): ZonedDateTime {\n let m = value.match(ZONED_DATE_TIME_RE);\n if (!m) {\n throw new Error('Invalid ISO 8601 date time string: ' + value);\n }\n\n let year = parseNumber(m[1], -9999, 9999);\n let era = year < 1 ? 'BC' : 'AD';\n\n let date: Mutable<ZonedDateTime> = new ZonedDateTime(\n era,\n year < 1 ? -year + 1 : year,\n parseNumber(m[2], 1, 12),\n 1,\n m[11],\n 0,\n m[4] ? parseNumber(m[4], 0, 23) : 0,\n m[5] ? parseNumber(m[5], 0, 59) : 0,\n m[6] ? parseNumber(m[6], 0, 59) : 0,\n m[7] ? parseNumber(m[7], 0, Infinity) * 1000 : 0\n );\n\n date.day = parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));\n\n let plainDateTime = toCalendarDateTime(date as ZonedDateTime);\n\n let ms: number;\n if (m[8]) {\n let hourOffset = parseNumber(m[8], -23, 23);\n date.offset = Math.sign(hourOffset) * (Math.abs(hourOffset) * 60 * 60 * 1000 + parseNumber(m[9] ?? '0', 0, 59) * 60 * 1000 + parseNumber(m[10] ?? '0', 0, 59) * 1000);\n ms = epochFromDate(date as ZonedDateTime) - date.offset;\n\n // Validate offset against parsed date.\n let absolutes = possibleAbsolutes(plainDateTime, date.timeZone);\n if (!absolutes.includes(ms)) {\n throw new Error(`Offset ${offsetToString(date.offset)} is invalid for ${dateTimeToString(date)} in ${date.timeZone}`);\n }\n } else {\n // Convert to absolute and back to fix invalid times due to DST.\n ms = toAbsolute(toCalendarDateTime(plainDateTime), date.timeZone, disambiguation);\n }\n\n return fromAbsolute(ms, date.timeZone);\n}\n\n/**\n * Parses an ISO 8601 date and time string with a UTC offset (e.g. \"2021-11-07T07:45:00Z\"\n * or \"2021-11-07T07:45:00-07:00\"). The result is converted to the provided time zone.\n */\nexport function parseAbsolute(value: string, timeZone: string): ZonedDateTime {\n let m = value.match(ABSOLUTE_RE);\n if (!m) {\n throw new Error('Invalid ISO 8601 date time string: ' + value);\n }\n\n let year = parseNumber(m[1], -9999, 9999);\n let era = year < 1 ? 'BC' : 'AD';\n\n let date: Mutable<ZonedDateTime> = new ZonedDateTime(\n era,\n year < 1 ? -year + 1 : year,\n parseNumber(m[2], 1, 12),\n 1,\n timeZone,\n 0,\n m[4] ? parseNumber(m[4], 0, 23) : 0,\n m[5] ? parseNumber(m[5], 0, 59) : 0,\n m[6] ? parseNumber(m[6], 0, 59) : 0,\n m[7] ? parseNumber(m[7], 0, Infinity) * 1000 : 0\n );\n\n date.day = parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));\n\n if (m[8]) {\n date.offset = parseNumber(m[8], -23, 23) * 60 * 60 * 1000 + parseNumber(m[9] ?? '0', 0, 59) * 60 * 1000;\n }\n\n return toTimeZone(date as ZonedDateTime, timeZone);\n}\n\n/**\n * Parses an ISO 8601 date and time string with a UTC offset (e.g. \"2021-11-07T07:45:00Z\"\n * or \"2021-11-07T07:45:00-07:00\"). The result is converted to the user's local time zone.\n */\nexport function parseAbsoluteToLocal(value: string): ZonedDateTime {\n return parseAbsolute(value, getLocalTimeZone());\n}\n\nfunction parseNumber(value: string, min: number, max: number) {\n let val = Number(value);\n if (val < min || val > max) {\n throw new RangeError(`Value out of range: ${min} <= ${val} <= ${max}`);\n }\n\n return val;\n}\n\nexport function timeToString(time: Time): string {\n return `${String(time.hour).padStart(2, '0')}:${String(time.minute).padStart(2, '0')}:${String(time.second).padStart(2, '0')}${time.millisecond ? String(time.millisecond / 1000).slice(1) : ''}`;\n}\n\nexport function dateToString(date: CalendarDate): string {\n let gregorianDate = toCalendar(date, new GregorianCalendar());\n let year: string;\n if (gregorianDate.era === 'BC') {\n year = gregorianDate.year === 1\n ? '0000'\n : '-' + String(Math.abs(1 - gregorianDate.year)).padStart(6, '00');\n } else {\n year = String(gregorianDate.year).padStart(4, '0');\n }\n return `${year}-${String(gregorianDate.month).padStart(2, '0')}-${String(gregorianDate.day).padStart(2, '0')}`;\n}\n\nexport function dateTimeToString(date: AnyDateTime): string {\n // @ts-ignore\n return `${dateToString(date)}T${timeToString(date)}`;\n}\n\nfunction offsetToString(offset: number) {\n let sign = Math.sign(offset) < 0 ? '-' : '+';\n offset = Math.abs(offset);\n let offsetHours = Math.floor(offset / (60 * 60 * 1000));\n let offsetMinutes = Math.floor((offset % (60 * 60 * 1000)) / (60 * 1000));\n let offsetSeconds = Math.floor((offset % (60 * 60 * 1000)) % (60 * 1000) / 1000);\n let stringOffset = `${sign}${String(offsetHours).padStart(2, '0')}:${String(offsetMinutes).padStart(2, '0')}`;\n if (offsetSeconds !== 0) {\n stringOffset += `:${String(offsetSeconds).padStart(2, '0')}`;\n }\n\n return stringOffset;\n}\n\nexport function zonedDateTimeToString(date: ZonedDateTime): string {\n return `${dateTimeToString(date)}${offsetToString(date.offset)}[${date.timeZone}]`;\n}\n\n/**\n * Parses an ISO 8601 duration string (e.g. \"P3Y6M6W4DT12H30M5S\").\n * @param value An ISO 8601 duration string.\n * @returns A DateTimeDuration object.\n */\nexport function parseDuration(value: string): Required<DateTimeDuration> {\n const match = value.match(DATE_TIME_DURATION_RE);\n\n if (!match) {\n throw new Error(`Invalid ISO 8601 Duration string: ${value}`);\n }\n\n const parseDurationGroup = (\n group: string | undefined,\n isNegative: boolean\n ): number => {\n if (!group) {\n return 0;\n }\n try {\n const sign = isNegative ? -1 : 1;\n return sign * Number(group.replace(',', '.'));\n } catch {\n throw new Error(`Invalid ISO 8601 Duration string: ${value}`);\n }\n };\n\n const isNegative = !!match.groups?.negative;\n\n const hasRequiredGroups = requiredDurationGroups.some(group => match.groups?.[group]);\n\n if (!hasRequiredGroups) {\n throw new Error(`Invalid ISO 8601 Duration string: ${value}`);\n }\n\n const durationStringIncludesTime = match.groups?.time;\n\n if (durationStringIncludesTime) {\n const hasRequiredDurationTimeGroups = requiredDurationTimeGroups.some(group => match.groups?.[group]);\n if (!hasRequiredDurationTimeGroups) {\n throw new Error(`Invalid ISO 8601 Duration string: ${value}`);\n }\n }\n\n const duration: Mutable<DateTimeDuration> = {\n years: parseDurationGroup(match.groups?.years, isNegative),\n months: parseDurationGroup(match.groups?.months, isNegative),\n weeks: parseDurationGroup(match.groups?.weeks, isNegative),\n days: parseDurationGroup(match.groups?.days, isNegative),\n hours: parseDurationGroup(match.groups?.hours, isNegative),\n minutes: parseDurationGroup(match.groups?.minutes, isNegative),\n seconds: parseDurationGroup(match.groups?.seconds, isNegative)\n };\n\n if (duration.hours !== undefined && ((duration.hours % 1) !== 0) && (duration.minutes || duration.seconds)) {\n throw new Error(`Invalid ISO 8601 Duration string: ${value} - only the smallest unit can be fractional`);\n }\n\n if (duration.minutes !== undefined && ((duration.minutes % 1) !== 0) && duration.seconds) {\n throw new Error(`Invalid ISO 8601 Duration string: ${value} - only the smallest unit can be fractional`);\n }\n\n return duration as Required<DateTimeDuration>;\n}\n", "function _check_private_redeclaration(obj, privateCollection) {\n if (privateCollection.has(obj)) {\n throw new TypeError(\"Cannot initialize the same private elements twice on an object\");\n }\n}\nexport { _check_private_redeclaration as _ };\n", "import { _ as _check_private_redeclaration } from \"./_check_private_redeclaration.js\";\n\nfunction _class_private_field_init(obj, privateMap, value) {\n _check_private_redeclaration(obj, privateMap);\n privateMap.set(obj, value);\n}\nexport { _class_private_field_init as _ };\n", "/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {add, addTime, addZoned, constrain, constrainTime, cycleDate, cycleTime, cycleZoned, set, setTime, setZoned, subtract, subtractTime, subtractZoned} from './manipulation';\nimport {AnyCalendarDate, AnyTime, Calendar, CycleOptions, CycleTimeOptions, DateDuration, DateField, DateFields, DateTimeDuration, Disambiguation, TimeDuration, TimeField, TimeFields} from './types';\nimport {compareDate, compareTime} from './queries';\nimport {dateTimeToString, dateToString, timeToString, zonedDateTimeToString} from './string';\nimport {GregorianCalendar} from './calendars/GregorianCalendar';\nimport {toCalendarDateTime, toDate, toZoned, zonedToDate} from './conversion';\n\nfunction shiftArgs(args: any[]) {\n let calendar: Calendar = typeof args[0] === 'object'\n ? args.shift()\n : new GregorianCalendar();\n\n let era: string;\n if (typeof args[0] === 'string') {\n era = args.shift();\n } else {\n let eras = calendar.getEras();\n era = eras[eras.length - 1];\n }\n\n let year = args.shift();\n let month = args.shift();\n let day = args.shift();\n\n return [calendar, era, year, month, day];\n}\n\n/** A CalendarDate represents a date without any time components in a specific calendar system. */\nexport class CalendarDate {\n // This prevents TypeScript from allowing other types with the same fields to match.\n // i.e. a ZonedDateTime should not be be passable to a parameter that expects CalendarDate.\n // If that behavior is desired, use the AnyCalendarDate interface instead.\n // @ts-ignore\n #type;\n /** The calendar system associated with this date, e.g. Gregorian. */\n public readonly calendar: Calendar;\n /** The calendar era for this date, e.g. \"BC\" or \"AD\". */\n public readonly era: string;\n /** The year of this date within the era. */\n public readonly year: number;\n /**\n * The month number within the year. Note that some calendar systems such as Hebrew\n * may have a variable number of months per year. Therefore, month numbers may not\n * always correspond to the same month names in different years.\n */\n public readonly month: number;\n /** The day number within the month. */\n public readonly day: number;\n\n constructor(year: number, month: number, day: number);\n constructor(era: string, year: number, month: number, day: number);\n constructor(calendar: Calendar, year: number, month: number, day: number);\n constructor(calendar: Calendar, era: string, year: number, month: number, day: number);\n constructor(...args: any[]) {\n let [calendar, era, year, month, day] = shiftArgs(args);\n this.calendar = calendar;\n this.era = era;\n this.year = year;\n this.month = month;\n this.day = day;\n\n constrain(this);\n }\n\n /** Returns a copy of this date. */\n copy(): CalendarDate {\n if (this.era) {\n return new CalendarDate(this.calendar, this.era, this.year, this.month, this.day);\n } else {\n return new CalendarDate(this.calendar, this.year, this.month, this.day);\n }\n }\n\n /** Returns a new `CalendarDate` with the given duration added to it. */\n add(duration: DateDuration): CalendarDate {\n return add(this, duration);\n }\n\n /** Returns a new `CalendarDate` with the given duration subtracted from it. */\n subtract(duration: DateDuration): CalendarDate {\n return subtract(this, duration);\n }\n\n /** Returns a new `CalendarDate` with the given fields set to the provided values. Other fields will be constrained accordingly. */\n set(fields: DateFields): CalendarDate {\n return set(this, fields);\n }\n\n /**\n * Returns a new `CalendarDate` with the given field adjusted by a specified amount.\n * When the resulting value reaches the limits of the field, it wraps around.\n */\n cycle(field: DateField, amount: number, options?: CycleOptions): CalendarDate {\n return cycleDate(this, field, amount, options);\n }\n\n /** Converts the date to a native JavaScript Date object, with the time set to midnight in the given time zone. */\n toDate(timeZone: string): Date {\n return toDate(this, timeZone);\n }\n\n /** Converts the date to an ISO 8601 formatted string. */\n toString(): string {\n return dateToString(this);\n }\n\n /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */\n compare(b: AnyCalendarDate): number {\n return compareDate(this, b);\n }\n}\n\n/** A Time represents a clock time without any date components. */\nexport class Time {\n // This prevents TypeScript from allowing other types with the same fields to match.\n // @ts-ignore\n #type;\n /** The hour, numbered from 0 to 23. */\n public readonly hour: number;\n /** The minute in the hour. */\n public readonly minute: number;\n /** The second in the minute. */\n public readonly second: number;\n /** The millisecond in the second. */\n public readonly millisecond: number;\n\n constructor(\n hour: number = 0,\n minute: number = 0,\n second: number = 0,\n millisecond: number = 0\n ) {\n this.hour = hour;\n this.minute = minute;\n this.second = second;\n this.millisecond = millisecond;\n constrainTime(this);\n }\n\n /** Returns a copy of this time. */\n copy(): Time {\n return new Time(this.hour, this.minute, this.second, this.millisecond);\n }\n\n /** Returns a new `Time` with the given duration added to it. */\n add(duration: TimeDuration): Time {\n return addTime(this, duration);\n }\n\n /** Returns a new `Time` with the given duration subtracted from it. */\n subtract(duration: TimeDuration): Time {\n return subtractTime(this, duration);\n }\n\n /** Returns a new `Time` with the given fields set to the provided values. Other fields will be constrained accordingly. */\n set(fields: TimeFields): Time {\n return setTime(this, fields);\n }\n\n /**\n * Returns a new `Time` with the given field adjusted by a specified amount.\n * When the resulting value reaches the limits of the field, it wraps around.\n */\n cycle(field: TimeField, amount: number, options?: CycleTimeOptions): Time {\n return cycleTime(this, field, amount, options);\n }\n\n /** Converts the time to an ISO 8601 formatted string. */\n toString(): string {\n return timeToString(this);\n }\n\n /** Compares this time with another. A negative result indicates that this time is before the given one, and a positive time indicates that it is after. */\n compare(b: AnyTime): number {\n return compareTime(this, b);\n }\n}\n\n/** A CalendarDateTime represents a date and time without a time zone, in a specific calendar system. */\nexport class CalendarDateTime {\n // This prevents TypeScript from allowing other types with the same fields to match.\n // @ts-ignore\n #type;\n /** The calendar system associated with this date, e.g. Gregorian. */\n public readonly calendar: Calendar;\n /** The calendar era for this date, e.g. \"BC\" or \"AD\". */\n public readonly era: string;\n /** The year of this date within the era. */\n public readonly year: number;\n /**\n * The month number within the year. Note that some calendar systems such as Hebrew\n * may have a variable number of months per year. Therefore, month numbers may not\n * always correspond to the same month names in different years.\n */\n public readonly month: number;\n /** The day number within the month. */\n public readonly day: number;\n /** The hour in the day, numbered from 0 to 23. */\n public readonly hour: number;\n /** The minute in the hour. */\n public readonly minute: number;\n /** The second in the minute. */\n public readonly second: number;\n /** The millisecond in the second. */\n public readonly millisecond: number;\n\n constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(era: string, year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(calendar: Calendar, year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(calendar: Calendar, era: string, year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(...args: any[]) {\n let [calendar, era, year, month, day] = shiftArgs(args);\n this.calendar = calendar;\n this.era = era;\n this.year = year;\n this.month = month;\n this.day = day;\n this.hour = args.shift() || 0;\n this.minute = args.shift() || 0;\n this.second = args.shift() || 0;\n this.millisecond = args.shift() || 0;\n\n constrain(this);\n }\n\n /** Returns a copy of this date. */\n copy(): CalendarDateTime {\n if (this.era) {\n return new CalendarDateTime(this.calendar, this.era, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);\n } else {\n return new CalendarDateTime(this.calendar, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);\n }\n }\n\n /** Returns a new `CalendarDateTime` with the given duration added to it. */\n add(duration: DateTimeDuration): CalendarDateTime {\n return add(this, duration);\n }\n\n /** Returns a new `CalendarDateTime` with the given duration subtracted from it. */\n subtract(duration: DateTimeDuration): CalendarDateTime {\n return subtract(this, duration);\n }\n\n /** Returns a new `CalendarDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */\n set(fields: DateFields & TimeFields): CalendarDateTime {\n return set(setTime(this, fields), fields);\n }\n\n /**\n * Returns a new `CalendarDateTime` with the given field adjusted by a specified amount.\n * When the resulting value reaches the limits of the field, it wraps around.\n */\n cycle(field: DateField | TimeField, amount: number, options?: CycleTimeOptions): CalendarDateTime {\n switch (field) {\n case 'era':\n case 'year':\n case 'month':\n case 'day':\n return cycleDate(this, field, amount, options);\n default:\n return cycleTime(this, field, amount, options);\n }\n }\n\n /** Converts the date to a native JavaScript Date object in the given time zone. */\n toDate(timeZone: string, disambiguation?: Disambiguation): Date {\n return toDate(this, timeZone, disambiguation);\n }\n\n /** Converts the date to an ISO 8601 formatted string. */\n toString(): string {\n return dateTimeToString(this);\n }\n\n /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */\n compare(b: CalendarDate | CalendarDateTime | ZonedDateTime): number {\n let res = compareDate(this, b);\n if (res === 0) {\n return compareTime(this, toCalendarDateTime(b));\n }\n\n return res;\n }\n}\n\n/** A ZonedDateTime represents a date and time in a specific time zone and calendar system. */\nexport class ZonedDateTime {\n // This prevents TypeScript from allowing other types with the same fields to match.\n // @ts-ignore\n #type;\n /** The calendar system associated with this date, e.g. Gregorian. */\n public readonly calendar: Calendar;\n /** The calendar era for this date, e.g. \"BC\" or \"AD\". */\n public readonly era: string;\n /** The year of this date within the era. */\n public readonly year: number;\n /**\n * The month number within the year. Note that some calendar systems such as Hebrew\n * may have a variable number of months per year. Therefore, month numbers may not\n * always correspond to the same month names in different years.\n */\n public readonly month: number;\n /** The day number within the month. */\n public readonly day: number;\n /** The hour in the day, numbered from 0 to 23. */\n public readonly hour: number;\n /** The minute in the hour. */\n public readonly minute: number;\n /** The second in the minute. */\n public readonly second: number;\n /** The millisecond in the second. */\n public readonly millisecond: number;\n /** The IANA time zone identifier that this date and time is represented in. */\n public readonly timeZone: string;\n /** The UTC offset for this time, in milliseconds. */\n public readonly offset: number;\n\n constructor(year: number, month: number, day: number, timeZone: string, offset: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(era: string, year: number, month: number, day: number, timeZone: string, offset: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(calendar: Calendar, year: number, month: number, day: number, timeZone: string, offset: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(calendar: Calendar, era: string, year: number, month: number, day: number, timeZone: string, offset: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(...args: any[]) {\n let [calendar, era, year, month, day] = shiftArgs(args);\n let timeZone = args.shift();\n let offset = args.shift();\n this.calendar = calendar;\n this.era = era;\n this.year = year;\n this.month = month;\n this.day = day;\n this.timeZone = timeZone;\n this.offset = offset;\n this.hour = args.shift() || 0;\n this.minute = args.shift() || 0;\n this.second = args.shift() || 0;\n this.millisecond = args.shift() || 0;\n\n constrain(this);\n }\n\n /** Returns a copy of this date. */\n copy(): ZonedDateTime {\n if (this.era) {\n return new ZonedDateTime(this.calendar, this.era, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);\n } else {\n return new ZonedDateTime(this.calendar, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);\n }\n }\n\n /** Returns a new `ZonedDateTime` with the given duration added to it. */\n add(duration: DateTimeDuration): ZonedDateTime {\n return addZoned(this, duration);\n }\n\n /** Returns a new `ZonedDateTime` with the given duration subtracted from it. */\n subtract(duration: DateTimeDuration): ZonedDateTime {\n return subtractZoned(this, duration);\n }\n\n /** Returns a new `ZonedDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */\n set(fields: DateFields & TimeFields, disambiguation?: Disambiguation): ZonedDateTime {\n return setZoned(this, fields, disambiguation);\n }\n\n /**\n * Returns a new `ZonedDateTime` with the given field adjusted by a specified amount.\n * When the resulting value reaches the limits of the field, it wraps around.\n */\n cycle(field: DateField | TimeField, amount: number, options?: CycleTimeOptions): ZonedDateTime {\n return cycleZoned(this, field, amount, options);\n }\n\n /** Converts the date to a native JavaScript Date object. */\n toDate(): Date {\n return zonedToDate(this);\n }\n\n /** Converts the date to an ISO 8601 formatted string, including the UTC offset and time zone identifier. */\n toString(): string {\n return zonedDateTimeToString(this);\n }\n\n /** Converts the date to an ISO 8601 formatted string in UTC. */\n toAbsoluteString(): string {\n return this.toDate().toISOString();\n }\n\n /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */\n compare(b: CalendarDate | CalendarDateTime | ZonedDateTime): number {\n // TODO: Is this a bad idea??\n return this.toDate().getTime() - toZoned(b, this.timeZone).toDate().getTime();\n }\n}\n", "/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nlet formatterCache = new Map<string, Intl.DateTimeFormat>();\n\ninterface DateRangeFormatPart extends Intl.DateTimeFormatPart {\n source: 'startRange' | 'endRange' | 'shared'\n}\n\n/** A wrapper around Intl.DateTimeFormat that fixes various browser bugs, and polyfills new features. */\nexport class DateFormatter implements Intl.DateTimeFormat {\n private formatter: Intl.DateTimeFormat;\n private options: Intl.DateTimeFormatOptions;\n private resolvedHourCycle: Intl.DateTimeFormatOptions['hourCycle'];\n\n constructor(locale: string, options: Intl.DateTimeFormatOptions = {}) {\n this.formatter = getCachedDateFormatter(locale, options);\n this.options = options;\n }\n\n /** Formats a date as a string according to the locale and format options passed to the constructor. */\n format(value: Date): string {\n return this.formatter.format(value);\n }\n\n /** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */\n formatToParts(value: Date): Intl.DateTimeFormatPart[] {\n return this.formatter.formatToParts(value);\n }\n\n /** Formats a date range as a string. */\n formatRange(start: Date, end: Date): string {\n // @ts-ignore\n if (typeof this.formatter.formatRange === 'function') {\n // @ts-ignore\n return this.formatter.formatRange(start, end);\n }\n\n if (end < start) {\n throw new RangeError('End date must be >= start date');\n }\n\n // Very basic fallback for old browsers.\n return `${this.formatter.format(start)} – ${this.formatter.format(end)}`;\n }\n\n /** Formats a date range as an array of parts. */\n formatRangeToParts(start: Date, end: Date): DateRangeFormatPart[] {\n // @ts-ignore\n if (typeof this.formatter.formatRangeToParts === 'function') {\n // @ts-ignore\n return this.formatter.formatRangeToParts(start, end);\n }\n\n if (end < start) {\n throw new RangeError('End date must be >= start date');\n }\n\n let startParts = this.formatter.formatToParts(start);\n let endParts = this.formatter.formatToParts(end);\n return [\n ...startParts.map(p => ({...p, source: 'startRange'} as DateRangeFormatPart)),\n {type: 'literal', value: ' – ', source: 'shared'},\n ...endParts.map(p => ({...p, source: 'endRange'} as DateRangeFormatPart))\n ];\n }\n\n /** Returns the resolved formatting options based on the values passed to the constructor. */\n resolvedOptions(): Intl.ResolvedDateTimeFormatOptions {\n let resolvedOptions = this.formatter.resolvedOptions();\n if (hasBuggyResolvedHourCycle()) {\n if (!this.resolvedHourCycle) {\n this.resolvedHourCycle = getResolvedHourCycle(resolvedOptions.locale, this.options);\n }\n resolvedOptions.hourCycle = this.resolvedHourCycle;\n resolvedOptions.hour12 = this.resolvedHourCycle === 'h11' || this.resolvedHourCycle === 'h12';\n }\n\n // Safari uses a different name for the Ethiopic (Amete Alem) calendar.\n // https://bugs.webkit.org/show_bug.cgi?id=241564\n if (resolvedOptions.calendar === 'ethiopic-amete-alem') {\n resolvedOptions.calendar = 'ethioaa';\n }\n\n return resolvedOptions;\n }\n}\n\n// There are multiple bugs involving the hour12 and hourCycle options in various browser engines.\n// - Chrome [1] (and the ECMA 402 spec [2]) resolve hour12: false in English and other locales to h24 (24:00 - 23:59)\n// rather than h23 (00:00 - 23:59). Same can happen with hour12: true in French, which Chrome resolves to h11 (00:00 - 11:59)\n// rather than h12 (12:00 - 11:59).\n// - WebKit returns an incorrect hourCycle resolved option in the French locale due to incorrect parsing of 'h' literal\n// in the resolved pattern. It also formats incorrectly when specifying the hourCycle option for the same reason. [3]\n// [1] https://bugs.chromium.org/p/chromium/issues/detail?id=1045791\n// [2] https://github.com/tc39/ecma402/issues/402\n// [3] https://bugs.webkit.org/show_bug.cgi?id=229313\n\n// https://github.com/unicode-org/cldr/blob/018b55eff7ceb389c7e3fc44e2f657eae3b10b38/common/supplemental/supplementalData.xml#L4774-L4802\nconst hour12Preferences = {\n true: {\n // Only Japanese uses the h11 style for 12 hour time. All others use h12.\n ja: 'h11'\n },\n false: {\n // All locales use h23 for 24 hour time. None use h24.\n }\n};\n\nfunction getCachedDateFormatter(locale: string, options: Intl.DateTimeFormatOptions = {}): Intl.DateTimeFormat {\n // Work around buggy hour12 behavior in Chrome / ECMA 402 spec by using hourCycle instead.\n // Only apply the workaround if the issue is detected, because the hourCycle option is buggy in Safari.\n if (typeof options.hour12 === 'boolean' && hasBuggyHour12Behavior()) {\n options = {...options};\n let pref = hour12Preferences[String(options.hour12)][locale.split('-')[0]];\n let defaultHourCycle = options.hour12 ? 'h12' : 'h23';\n options.hourCycle = pref ?? defaultHourCycle;\n delete options.hour12;\n }\n\n let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : '');\n if (formatterCache.has(cacheKey)) {\n return formatterCache.get(cacheKey)!;\n }\n\n let numberFormatter = new Intl.DateTimeFormat(locale, options);\n formatterCache.set(cacheKey, numberFormatter);\n return numberFormatter;\n}\n\nlet _hasBuggyHour12Behavior: boolean | null = null;\nfunction hasBuggyHour12Behavior() {\n if (_hasBuggyHour12Behavior == null) {\n _hasBuggyHour12Behavior = new Intl.DateTimeFormat('en-US', {\n hour: 'numeric',\n hour12: false\n }).format(new Date(2020, 2, 3, 0)) === '24';\n }\n\n return _hasBuggyHour12Behavior;\n}\n\nlet _hasBuggyResolvedHourCycle: boolean | null = null;\nfunction hasBuggyResolvedHourCycle() {\n if (_hasBuggyResolvedHourCycle == null) {\n _hasBuggyResolvedHourCycle = new Intl.DateTimeFormat('fr', {\n hour: 'numeric',\n hour12: false\n }).resolvedOptions().hourCycle === 'h12';\n }\n\n return _hasBuggyResolvedHourCycle;\n}\n\nfunction getResolvedHourCycle(locale: string, options: Intl.DateTimeFormatOptions) {\n if (!options.timeStyle && !options.hour) {\n return undefined;\n }\n\n // Work around buggy results in resolved hourCycle and hour12 options in WebKit.\n // Format the minimum possible hour and maximum possible hour in a day and parse the results.\n locale = locale.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, '');\n locale += (locale.includes('-u-') ? '' : '-u') + '-nu-latn';\n let formatter = getCachedDateFormatter(locale, {\n ...options,\n timeZone: undefined // use local timezone\n });\n\n let min = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 0)).find(p => p.type === 'hour')!.value, 10);\n let max = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 23)).find(p => p.type === 'hour')!.value, 10);\n\n if (min === 0 && max === 23) {\n return 'h23';\n }\n\n if (min === 24 && max === 23) {\n return 'h24';\n }\n\n if (min === 0 && max === 11) {\n return 'h11';\n }\n\n if (min === 12 && max === 11) {\n return 'h12';\n }\n\n throw new Error('Unexpected hour cycle result');\n}\n", "/**\n * createRangeCalendar hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a range calendar component.\n * Based on @react-aria/calendar useRangeCalendar\n */\n\nimport { createMemo } from 'solid-js';\nimport { createId } from '../ssr';\nimport { access, type MaybeAccessor } from '../utils/reactivity';\nimport { mergeProps } from '../utils/mergeProps';\nimport type { RangeCalendarState } from '@proyecto-viviana/solid-stately';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaRangeCalendarProps {\n /** An ID for the calendar. */\n id?: string;\n /** Whether the calendar is disabled. */\n isDisabled?: boolean;\n /** Whether the calendar is read-only. */\n isReadOnly?: boolean;\n /** An accessible label for the calendar. */\n 'aria-label'?: string;\n /** The ID of an element that labels the calendar. */\n 'aria-labelledby'?: string;\n /** The ID of an element that describes the calendar. */\n 'aria-describedby'?: string;\n}\n\nexport interface RangeCalendarAria {\n /** Props for the calendar container element. */\n calendarProps: Record<string, unknown>;\n /** Props for the previous button. */\n prevButtonProps: Record<string, unknown>;\n /** Props for the next button. */\n nextButtonProps: Record<string, unknown>;\n /** Props for the title/heading element. */\n titleProps: Record<string, unknown>;\n /** An accessible label for the title. */\n title: string;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the behavior and accessibility implementation for a range calendar component.\n */\nexport function createRangeCalendar<T extends RangeCalendarState>(\n props: MaybeAccessor<AriaRangeCalendarProps>,\n state: T\n): RangeCalendarAria {\n const getProps = () => access(props);\n const id = createId(getProps().id);\n const titleId = createId();\n\n // Title (e.g., \"December 2024\")\n const title = createMemo(() => state.title());\n\n // Previous button props\n const prevButtonProps = createMemo(() => {\n const p = getProps();\n const isDisabled = p.isDisabled || state.isDisabled();\n\n return {\n 'aria-label': 'Previous month',\n onClick: () => {\n if (!isDisabled) {\n state.focusPreviousPage();\n }\n },\n disabled: isDisabled,\n tabIndex: -1,\n };\n });\n\n // Next button props\n const nextButtonProps = createMemo(() => {\n const p = getProps();\n const isDisabled = p.isDisabled || state.isDisabled();\n\n return {\n 'aria-label': 'Next month',\n onClick: () => {\n if (!isDisabled) {\n state.focusNextPage();\n }\n },\n disabled: isDisabled,\n tabIndex: -1,\n };\n });\n\n // Title props\n const titleProps = createMemo(() => ({\n id: titleId,\n 'aria-live': 'polite' as const,\n }));\n\n // Calendar container props\n const calendarProps = createMemo(() => {\n const p = getProps();\n\n return mergeProps(\n {\n id,\n role: 'group',\n 'aria-labelledby': p['aria-labelledby'] ?? titleId,\n 'aria-label': p['aria-label'],\n 'aria-describedby': p['aria-describedby'],\n }\n );\n });\n\n return {\n get calendarProps() {\n return calendarProps();\n },\n get prevButtonProps() {\n return prevButtonProps();\n },\n get nextButtonProps() {\n return nextButtonProps();\n },\n get titleProps() {\n return titleProps();\n },\n get title() {\n return title();\n },\n };\n}\n", "/**\n * createRangeCalendarCell hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a range calendar cell.\n * Based on @react-aria/calendar useCalendarCell (with range support)\n */\n\nimport { createSignal, createMemo } from 'solid-js';\nimport { access, type MaybeAccessor } from '../utils/reactivity';\nimport type { RangeCalendarState, CalendarDate, DateValue } from '@proyecto-viviana/solid-stately';\nimport { isToday as isTodayUtil, DateFormatter, getLocalTimeZone } from '@internationalized/date';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaRangeCalendarCellProps {\n /** The date represented by the cell. */\n date: DateValue;\n /** Whether the cell is disabled. */\n isDisabled?: boolean;\n}\n\nexport interface RangeCalendarCellAria {\n /** Props for the cell element (td or gridcell). */\n cellProps: Record<string, unknown>;\n /** Props for the button inside the cell. */\n buttonProps: Record<string, unknown>;\n /** Whether the cell is within the selected range. */\n isSelected: boolean;\n /** Whether the cell is the start of the selection. */\n isSelectionStart: boolean;\n /** Whether the cell is the end of the selection. */\n isSelectionEnd: boolean;\n /** Whether the cell is focused. */\n isFocused: boolean;\n /** Whether the cell is disabled. */\n isDisabled: boolean;\n /** Whether the cell is unavailable (e.g., booked date). */\n isUnavailable: boolean;\n /** Whether the cell is outside the visible month. */\n isOutsideMonth: boolean;\n /** Whether the cell represents today. */\n isToday: boolean;\n /** Whether the cell is pressed. */\n isPressed: boolean;\n /** The formatted date string. */\n formattedDate: string;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the behavior and accessibility implementation for a range calendar cell.\n */\nexport function createRangeCalendarCell<T extends RangeCalendarState>(\n props: MaybeAccessor<AriaRangeCalendarCellProps>,\n state: T,\n _ref?: () => HTMLElement | null\n): RangeCalendarCellAria {\n const getProps = () => access(props);\n const [isPressed, setIsPressed] = createSignal(false);\n const timeZone = getLocalTimeZone();\n\n // Get the date from props\n const date = createMemo(() => getProps().date as CalendarDate);\n\n // Check states\n const isSelected = createMemo(() => state.isSelected(date()));\n const isSelectionStart = createMemo(() => state.isSelectionStart(date()));\n const isSelectionEnd = createMemo(() => state.isSelectionEnd(date()));\n const isFocused = createMemo(() => state.isCellFocused(date()));\n const isDisabled = createMemo(() => {\n return getProps().isDisabled || state.isCellDisabled(date());\n });\n const isUnavailable = createMemo(() => state.isCellUnavailable(date()));\n const isOutsideMonth = createMemo(() => state.isOutsideVisibleRange(date()));\n const isToday = createMemo(() => isTodayUtil(date(), timeZone));\n\n // Format the date for display\n const formattedDate = createMemo(() => {\n return date().day.toString();\n });\n\n // Handle click\n const handleClick = () => {\n if (!isDisabled() && !isUnavailable()) {\n state.selectDate(date());\n }\n };\n\n // Handle pointer events for pressed state\n const handlePointerDown = () => {\n if (!isDisabled() && !isUnavailable()) {\n setIsPressed(true);\n }\n };\n\n const handlePointerUp = () => {\n setIsPressed(false);\n };\n\n // Handle hover during range selection\n const handlePointerEnter = () => {\n if (state.isDragging() && !isDisabled() && !isUnavailable()) {\n state.setFocusedDate(date());\n }\n };\n\n // Cell props (for the td element)\n const cellProps = createMemo(() => ({\n role: 'gridcell',\n 'aria-disabled': isDisabled() || undefined,\n 'aria-selected': isSelected() || undefined,\n }));\n\n // Button props (for the interactive element inside)\n const buttonProps = createMemo(() => {\n const d = date();\n const formatter = new DateFormatter('en-US', {\n weekday: 'long',\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n });\n\n return {\n role: 'button',\n tabIndex: isFocused() ? 0 : -1,\n 'aria-label': formatter.format(d.toDate(timeZone)),\n 'aria-disabled': isDisabled() || undefined,\n 'aria-pressed': isPressed() || undefined,\n disabled: isDisabled(),\n onClick: handleClick,\n onPointerDown: handlePointerDown,\n onPointerUp: handlePointerUp,\n onPointerLeave: handlePointerUp,\n onPointerEnter: handlePointerEnter,\n onFocus: () => {\n state.setFocusedDate(d);\n state.setFocused(true);\n },\n };\n });\n\n return {\n get cellProps() {\n return cellProps();\n },\n get buttonProps() {\n return buttonProps();\n },\n get isSelected() {\n return isSelected();\n },\n get isSelectionStart() {\n return isSelectionStart();\n },\n get isSelectionEnd() {\n return isSelectionEnd();\n },\n get isFocused() {\n return isFocused();\n },\n get isDisabled() {\n return isDisabled();\n },\n get isUnavailable() {\n return isUnavailable();\n },\n get isOutsideMonth() {\n return isOutsideMonth();\n },\n get isToday() {\n return isToday();\n },\n get isPressed() {\n return isPressed();\n },\n get formattedDate() {\n return formattedDate();\n },\n };\n}\n", "/**\n * createDateField hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a date field component.\n * Based on @react-aria/datepicker useDateField\n */\n\nimport { createMemo } from 'solid-js';\nimport { createId } from '../ssr';\nimport { createLabel } from '../label/createLabel';\nimport { access, type MaybeAccessor } from '../utils/reactivity';\nimport { mergeProps } from '../utils/mergeProps';\nimport type { DateFieldState, DateSegment } from '@proyecto-viviana/solid-stately';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaDateFieldProps {\n /** An ID for the date field. */\n id?: string;\n /** A visible label for the date field. */\n label?: string;\n /** An accessible label for the date field. */\n 'aria-label'?: string;\n /** The ID of an element that labels the date field. */\n 'aria-labelledby'?: string;\n /** The ID of an element that describes the date field. */\n 'aria-describedby'?: string;\n /** Whether the date field is disabled. */\n isDisabled?: boolean;\n /** Whether the date field is read-only. */\n isReadOnly?: boolean;\n /** Whether the date field is required. */\n isRequired?: boolean;\n /** Whether the date field is invalid. */\n isInvalid?: boolean;\n /** Description text. */\n description?: string;\n /** Error message. */\n errorMessage?: string;\n}\n\nexport interface DateFieldAria {\n /** Props for the label element. */\n labelProps: Record<string, unknown>;\n /** Props for the field container element. */\n fieldProps: Record<string, unknown>;\n /** Props for the input container (holds segments). */\n inputProps: Record<string, unknown>;\n /** Props for the description element. */\n descriptionProps: Record<string, unknown>;\n /** Props for the error message element. */\n errorMessageProps: Record<string, unknown>;\n /** The segments to render. */\n segments: DateSegment[];\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the behavior and accessibility implementation for a date field component.\n */\nexport function createDateField<T extends DateFieldState>(\n props: MaybeAccessor<AriaDateFieldProps>,\n state: T,\n _ref?: () => HTMLElement | null\n): DateFieldAria {\n const getProps = () => access(props);\n const id = createId(getProps().id);\n const descriptionId = createId();\n const errorMessageId = createId();\n\n // Create label handling\n const { labelProps, fieldProps: labelFieldProps } = createLabel({\n get label() { return getProps().label; },\n get 'aria-label'() { return getProps()['aria-label']; },\n get 'aria-labelledby'() { return getProps()['aria-labelledby']; },\n labelElementType: 'span',\n });\n\n // Build aria-describedby\n const getAriaDescribedBy = () => {\n const p = getProps();\n const ids: string[] = [];\n if (p['aria-describedby']) {\n ids.push(p['aria-describedby']);\n }\n if (p.description) {\n ids.push(descriptionId);\n }\n if (p.isInvalid && p.errorMessage) {\n ids.push(errorMessageId);\n }\n return ids.length > 0 ? ids.join(' ') : undefined;\n };\n\n // Segments from state\n const segments = createMemo(() => state.segments());\n\n // Field container props\n const fieldProps = createMemo(() => {\n const p = getProps();\n\n return mergeProps(labelFieldProps as Record<string, unknown>, {\n id,\n role: 'group',\n 'aria-disabled': p.isDisabled || state.isDisabled() || undefined,\n 'aria-readonly': p.isReadOnly || state.isReadOnly() || undefined,\n 'aria-required': p.isRequired || state.isRequired() || undefined,\n 'aria-invalid': p.isInvalid || state.isInvalid() || undefined,\n 'aria-describedby': getAriaDescribedBy(),\n });\n });\n\n // Input container props\n const inputProps = createMemo(() => ({\n role: 'presentation',\n }));\n\n // Description props\n const descriptionProps = createMemo(() => ({\n id: descriptionId,\n }));\n\n // Error message props\n const errorMessageProps = createMemo(() => ({\n id: errorMessageId,\n role: 'alert',\n }));\n\n return {\n get labelProps() {\n return labelProps as Record<string, unknown>;\n },\n get fieldProps() {\n return fieldProps();\n },\n get inputProps() {\n return inputProps();\n },\n get descriptionProps() {\n return descriptionProps();\n },\n get errorMessageProps() {\n return errorMessageProps();\n },\n get segments() {\n return segments();\n },\n };\n}\n", "/**\n * createDateSegment hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a date segment.\n * Based on @react-aria/datepicker useDateSegment\n */\n\nimport { createSignal, createMemo } from 'solid-js';\nimport { access, type MaybeAccessor } from '../utils/reactivity';\nimport type { DateFieldState, DateSegment, DateSegmentType } from '@proyecto-viviana/solid-stately';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaDateSegmentProps {\n /** The segment data. */\n segment: DateSegment;\n}\n\nexport interface DateSegmentAria {\n /** Props for the segment element. */\n segmentProps: Record<string, unknown>;\n /** Whether the segment is focused. */\n isFocused: boolean;\n /** Whether the segment is editable. */\n isEditable: boolean;\n /** Whether the segment is a placeholder. */\n isPlaceholder: boolean;\n /** The text to display. */\n text: string;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the behavior and accessibility implementation for a date segment.\n */\nexport function createDateSegment<T extends DateFieldState>(\n props: MaybeAccessor<AriaDateSegmentProps>,\n state: T,\n _ref?: () => HTMLElement | null\n): DateSegmentAria {\n const getProps = () => access(props);\n const [isFocused, setIsFocused] = createSignal(false);\n const [enteredKeys, setEnteredKeys] = createSignal('');\n\n // Get the segment from props\n const segment = createMemo(() => getProps().segment);\n\n // Check if editable\n const isEditable = createMemo(() => {\n const seg = segment();\n return seg.isEditable && !state.isDisabled() && !state.isReadOnly();\n });\n\n // Handle keyboard input\n const handleKeyDown = (e: KeyboardEvent) => {\n if (!isEditable()) return;\n\n const seg = segment();\n const type = seg.type;\n\n if (type === 'literal') return;\n\n switch (e.key) {\n case 'ArrowUp':\n e.preventDefault();\n state.incrementSegment(type);\n break;\n case 'ArrowDown':\n e.preventDefault();\n state.decrementSegment(type);\n break;\n case 'Backspace':\n case 'Delete':\n e.preventDefault();\n state.clearSegment(type);\n setEnteredKeys('');\n break;\n default:\n // Handle numeric input\n if (/^\\d$/.test(e.key)) {\n e.preventDefault();\n handleNumericInput(e.key, type, seg);\n }\n break;\n }\n };\n\n // Handle numeric input\n const handleNumericInput = (\n key: string,\n type: DateSegmentType,\n seg: DateSegment\n ) => {\n const newKeys = enteredKeys() + key;\n const numValue = parseInt(newKeys, 10);\n const maxValue = seg.maxValue ?? 99;\n const minValue = seg.minValue ?? 0;\n\n // Check if we should accept more digits\n if (numValue <= maxValue) {\n state.setSegment(type, numValue);\n\n // If entering more digits wouldn't make sense, clear entered keys\n const potentialNextValue = parseInt(newKeys + '0', 10);\n if (potentialNextValue > maxValue || newKeys.length >= String(maxValue).length) {\n setEnteredKeys('');\n // Move to next segment (would need focus management)\n } else {\n setEnteredKeys(newKeys);\n }\n } else {\n // Start fresh with just this key\n const singleValue = parseInt(key, 10);\n if (singleValue >= minValue && singleValue <= maxValue) {\n state.setSegment(type, singleValue);\n }\n setEnteredKeys(key);\n }\n };\n\n // Handle focus\n const handleFocus = () => {\n setIsFocused(true);\n setEnteredKeys('');\n };\n\n const handleBlur = () => {\n setIsFocused(false);\n setEnteredKeys('');\n state.confirmPlaceholder();\n };\n\n // Segment props\n const segmentProps = createMemo(() => {\n const seg = segment();\n const type = seg.type;\n\n // Literal segments don't need interaction props\n if (type === 'literal') {\n return {\n 'aria-hidden': true,\n };\n }\n\n return {\n role: 'spinbutton',\n tabIndex: isEditable() ? 0 : -1,\n 'aria-label': getSegmentLabel(type),\n 'aria-valuenow': seg.value,\n 'aria-valuemin': seg.minValue,\n 'aria-valuemax': seg.maxValue,\n 'aria-valuetext': seg.isPlaceholder ? seg.placeholder : seg.text,\n 'aria-readonly': state.isReadOnly() || undefined,\n 'aria-disabled': state.isDisabled() || undefined,\n 'aria-invalid': state.isInvalid() || undefined,\n contentEditable: isEditable(),\n suppressContentEditableWarning: true,\n inputMode: 'numeric' as const,\n autoCorrect: 'off',\n enterKeyHint: 'next' as const,\n spellCheck: false,\n onKeyDown: handleKeyDown,\n onFocus: handleFocus,\n onBlur: handleBlur,\n onMouseDown: (e: MouseEvent) => {\n // Prevent cursor positioning in the middle of the segment\n e.preventDefault();\n },\n };\n });\n\n // Text to display\n const text = createMemo(() => {\n const seg = segment();\n return seg.isPlaceholder ? seg.placeholder : seg.text;\n });\n\n return {\n get segmentProps() {\n return segmentProps();\n },\n get isFocused() {\n return isFocused();\n },\n get isEditable() {\n return isEditable();\n },\n get isPlaceholder() {\n return segment().isPlaceholder;\n },\n get text() {\n return text();\n },\n };\n}\n\n// ============================================\n// HELPER FUNCTIONS\n// ============================================\n\nfunction getSegmentLabel(type: DateSegmentType): string {\n switch (type) {\n case 'year':\n return 'Year';\n case 'month':\n return 'Month';\n case 'day':\n return 'Day';\n case 'hour':\n return 'Hour';\n case 'minute':\n return 'Minute';\n case 'second':\n return 'Second';\n case 'dayPeriod':\n return 'AM/PM';\n case 'era':\n return 'Era';\n case 'timeZoneName':\n return 'Time zone';\n default:\n return '';\n }\n}\n", "/**\n * createTimeField hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a time field component.\n * Based on @react-aria/datepicker useTimeField\n */\n\nimport { createMemo } from 'solid-js';\nimport { createId } from '../ssr';\nimport { createLabel } from '../label/createLabel';\nimport { access, type MaybeAccessor } from '../utils/reactivity';\nimport { mergeProps } from '../utils/mergeProps';\nimport type { TimeFieldState, TimeSegment, TimeValue } from '@proyecto-viviana/solid-stately';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaTimeFieldProps {\n /** An ID for the time field. */\n id?: string;\n /** A visible label for the time field. */\n label?: string;\n /** An accessible label for the time field. */\n 'aria-label'?: string;\n /** The ID of an element that labels the time field. */\n 'aria-labelledby'?: string;\n /** The ID of an element that describes the time field. */\n 'aria-describedby'?: string;\n /** Whether the time field is disabled. */\n isDisabled?: boolean;\n /** Whether the time field is read-only. */\n isReadOnly?: boolean;\n /** Whether the time field is required. */\n isRequired?: boolean;\n /** Whether the time field is invalid. */\n isInvalid?: boolean;\n /** Description text. */\n description?: string;\n /** Error message. */\n errorMessage?: string;\n}\n\nexport interface TimeFieldAria {\n /** Props for the label element. */\n labelProps: Record<string, unknown>;\n /** Props for the field container element. */\n fieldProps: Record<string, unknown>;\n /** Props for the input container (holds segments). */\n inputProps: Record<string, unknown>;\n /** Props for the description element. */\n descriptionProps: Record<string, unknown>;\n /** Props for the error message element. */\n errorMessageProps: Record<string, unknown>;\n /** The segments to render. */\n segments: TimeSegment[];\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the behavior and accessibility implementation for a time field component.\n */\nexport function createTimeField<T extends TimeFieldState<TimeValue>>(\n props: MaybeAccessor<AriaTimeFieldProps>,\n state: T,\n _ref?: () => HTMLElement | null\n): TimeFieldAria {\n const getProps = () => access(props);\n const id = createId(getProps().id);\n const descriptionId = createId();\n const errorMessageId = createId();\n\n // Create label handling\n const { labelProps, fieldProps: labelFieldProps } = createLabel({\n get label() { return getProps().label; },\n get 'aria-label'() { return getProps()['aria-label']; },\n get 'aria-labelledby'() { return getProps()['aria-labelledby']; },\n labelElementType: 'span',\n });\n\n // Build aria-describedby\n const getAriaDescribedBy = () => {\n const p = getProps();\n const ids: string[] = [];\n if (p['aria-describedby']) {\n ids.push(p['aria-describedby']);\n }\n if (p.description) {\n ids.push(descriptionId);\n }\n if (p.isInvalid && p.errorMessage) {\n ids.push(errorMessageId);\n }\n return ids.length > 0 ? ids.join(' ') : undefined;\n };\n\n // Segments from state\n const segments = createMemo(() => state.segments());\n\n // Field container props\n const fieldProps = createMemo(() => {\n const p = getProps();\n\n return mergeProps(labelFieldProps as Record<string, unknown>, {\n id,\n role: 'group',\n 'aria-disabled': p.isDisabled || state.isDisabled() || undefined,\n 'aria-readonly': p.isReadOnly || state.isReadOnly() || undefined,\n 'aria-required': p.isRequired || state.isRequired() || undefined,\n 'aria-invalid': p.isInvalid || state.isInvalid() || undefined,\n 'aria-describedby': getAriaDescribedBy(),\n });\n });\n\n // Input container props\n const inputProps = createMemo(() => ({\n role: 'presentation',\n }));\n\n // Description props\n const descriptionProps = createMemo(() => ({\n id: descriptionId,\n }));\n\n // Error message props\n const errorMessageProps = createMemo(() => ({\n id: errorMessageId,\n role: 'alert',\n }));\n\n return {\n get labelProps() {\n return labelProps as Record<string, unknown>;\n },\n get fieldProps() {\n return fieldProps();\n },\n get inputProps() {\n return inputProps();\n },\n get descriptionProps() {\n return descriptionProps();\n },\n get errorMessageProps() {\n return errorMessageProps();\n },\n get segments() {\n return segments();\n },\n };\n}\n", "/**\n * createDatePicker hook for Solidaria\n *\n * Provides the behavior and accessibility implementation for a date picker component.\n * Based on @react-aria/datepicker useDatePicker\n */\n\nimport { createMemo } from 'solid-js';\nimport { createId } from '../ssr';\nimport { createLabel } from '../label/createLabel';\nimport { access, type MaybeAccessor } from '../utils/reactivity';\nimport { mergeProps } from '../utils/mergeProps';\nimport type { DateFieldState, CalendarState } from '@proyecto-viviana/solid-stately';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaDatePickerProps {\n /** An ID for the date picker. */\n id?: string;\n /** A visible label for the date picker. */\n label?: string;\n /** An accessible label for the date picker. */\n 'aria-label'?: string;\n /** The ID of an element that labels the date picker. */\n 'aria-labelledby'?: string;\n /** The ID of an element that describes the date picker. */\n 'aria-describedby'?: string;\n /** Whether the date picker is disabled. */\n isDisabled?: boolean;\n /** Whether the date picker is read-only. */\n isReadOnly?: boolean;\n /** Whether the date picker is required. */\n isRequired?: boolean;\n /** Whether the date picker is invalid. */\n isInvalid?: boolean;\n /** Description text. */\n description?: string;\n /** Error message. */\n errorMessage?: string;\n}\n\nexport interface DatePickerState {\n /** Whether the calendar is open. */\n isOpen: boolean;\n /** Open the calendar. */\n open: () => void;\n /** Close the calendar. */\n close: () => void;\n /** Toggle the calendar. */\n toggle: () => void;\n}\n\nexport interface DatePickerAria {\n /** Props for the group container. */\n groupProps: Record<string, unknown>;\n /** Props for the label element. */\n labelProps: Record<string, unknown>;\n /** Props for the date field container. */\n fieldProps: Record<string, unknown>;\n /** Props for the button that opens the calendar. */\n buttonProps: Record<string, unknown>;\n /** Props for the calendar dialog. */\n dialogProps: Record<string, unknown>;\n /** Props for the calendar. */\n calendarProps: Record<string, unknown>;\n /** Props for the description element. */\n descriptionProps: Record<string, unknown>;\n /** Props for the error message element. */\n errorMessageProps: Record<string, unknown>;\n}\n\n// ============================================\n// IMPLEMENTATION\n// ============================================\n\n/**\n * Provides the behavior and accessibility implementation for a date picker component.\n */\nexport function createDatePicker<T extends DateFieldState, C extends CalendarState>(\n props: MaybeAccessor<AriaDatePickerProps>,\n state: T,\n overlayState: DatePickerState,\n _calendarState?: C\n): DatePickerAria {\n const getProps = () => access(props);\n const id = createId(getProps().id);\n const descriptionId = createId();\n const errorMessageId = createId();\n const dialogId = createId();\n\n // Create label handling\n const { labelProps, fieldProps: labelFieldProps } = createLabel({\n get label() { return getProps().label; },\n get 'aria-label'() { return getProps()['aria-label']; },\n get 'aria-labelledby'() { return getProps()['aria-labelledby']; },\n labelElementType: 'span',\n });\n\n // Build aria-describedby\n const getAriaDescribedBy = () => {\n const p = getProps();\n const ids: string[] = [];\n if (p['aria-describedby']) {\n ids.push(p['aria-describedby']);\n }\n if (p.description) {\n ids.push(descriptionId);\n }\n if (p.isInvalid && p.errorMessage) {\n ids.push(errorMessageId);\n }\n return ids.length > 0 ? ids.join(' ') : undefined;\n };\n\n // Group props\n const groupProps = createMemo(() => {\n const p = getProps();\n\n return mergeProps(labelFieldProps as Record<string, unknown>, {\n id,\n role: 'group',\n 'aria-disabled': p.isDisabled || state.isDisabled() || undefined,\n 'aria-describedby': getAriaDescribedBy(),\n });\n });\n\n // Field props\n const fieldProps = createMemo(() => ({\n 'aria-haspopup': 'dialog' as const,\n 'aria-expanded': overlayState.isOpen,\n 'aria-controls': overlayState.isOpen ? dialogId : undefined,\n }));\n\n // Button props\n const buttonProps = createMemo(() => {\n const p = getProps();\n const isDisabled = p.isDisabled || state.isDisabled();\n\n return {\n 'aria-label': 'Open calendar',\n 'aria-haspopup': 'dialog' as const,\n 'aria-expanded': overlayState.isOpen,\n 'aria-controls': overlayState.isOpen ? dialogId : undefined,\n disabled: isDisabled,\n tabIndex: -1,\n onClick: () => {\n if (!isDisabled) {\n overlayState.toggle();\n }\n },\n };\n });\n\n // Dialog props\n const dialogProps = createMemo(() => ({\n id: dialogId,\n role: 'dialog',\n 'aria-modal': true,\n 'aria-label': 'Calendar',\n }));\n\n // Calendar props\n const calendarProps = createMemo(() => ({\n 'aria-label': 'Calendar',\n }));\n\n // Description props\n const descriptionProps = createMemo(() => ({\n id: descriptionId,\n }));\n\n // Error message props\n const errorMessageProps = createMemo(() => ({\n id: errorMessageId,\n role: 'alert',\n }));\n\n return {\n get groupProps() {\n return groupProps();\n },\n get labelProps() {\n return labelProps as Record<string, unknown>;\n },\n get fieldProps() {\n return fieldProps();\n },\n get buttonProps() {\n return buttonProps();\n },\n get dialogProps() {\n return dialogProps();\n },\n get calendarProps() {\n return calendarProps();\n },\n get descriptionProps() {\n return descriptionProps();\n },\n get errorMessageProps() {\n return errorMessageProps();\n },\n };\n}\n", "/**\n * createGrid - Provides accessibility for a grid component.\n * Based on @react-aria/grid/useGrid.\n */\n\nimport { createMemo, createSignal, type Accessor } from 'solid-js';\nimport type { JSX } from 'solid-js';\nimport { createId } from '@proyecto-viviana/solid-stately';\nimport type { GridState, GridCollection, Key } from '@proyecto-viviana/solid-stately';\nimport type { GridProps, GridAria, KeyboardDelegate } from './types';\nimport { GridKeyboardDelegate } from './GridKeyboardDelegate';\n\n// Global map to store grid metadata for child components\nconst gridMap = new WeakMap<\n object,\n {\n keyboardDelegate: KeyboardDelegate;\n actions: { onRowAction?: (key: Key) => void; onCellAction?: (key: Key) => void };\n shouldSelectOnPressUp?: boolean;\n }\n>();\n\n/**\n * Get the grid metadata for child components.\n */\nexport function getGridData<T>(state: GridState<T, GridCollection<T>>) {\n return gridMap.get(state);\n}\n\n/**\n * Creates accessibility props for a grid component.\n * A grid displays data in rows and columns and enables navigation via arrow keys.\n */\nexport function createGrid<T extends object>(\n props: Accessor<GridProps>,\n state: Accessor<GridState<T, GridCollection<T>>>,\n ref: Accessor<HTMLElement | null>\n): GridAria {\n const id = createId(props().id);\n\n // Track focused state\n const [_isFocused, setIsFocused] = createSignal(false);\n\n // Create keyboard delegate\n const keyboardDelegate = createMemo(() => {\n const p = props();\n const s = state();\n\n if (p.keyboardDelegate) {\n return p.keyboardDelegate;\n }\n\n return new GridKeyboardDelegate({\n collection: s.collection,\n disabledKeys: s.disabledKeys,\n ref,\n focusMode: p.focusMode ?? 'row',\n direction: 'ltr', // TODO: get from locale\n });\n });\n\n // Store metadata for child components\n const storeGridData = () => {\n const s = state();\n const p = props();\n gridMap.set(s, {\n keyboardDelegate: keyboardDelegate(),\n actions: {\n onRowAction: p.onRowAction,\n onCellAction: p.onCellAction,\n },\n shouldSelectOnPressUp: p.shouldSelectOnPressUp,\n });\n };\n\n // Update grid data whenever state changes\n createMemo(() => {\n storeGridData();\n });\n\n // Keyboard navigation handler\n const onKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const p = props();\n const delegate = keyboardDelegate();\n\n if (s.isKeyboardNavigationDisabled) {\n return;\n }\n\n const focusedKey = s.focusedKey;\n if (focusedKey == null) {\n // If nothing is focused, focus the first item\n if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'Home' || e.key === 'End') {\n const firstKey = delegate.getFirstKey?.();\n if (firstKey != null) {\n e.preventDefault();\n s.setFocusedKey(firstKey);\n }\n }\n return;\n }\n\n let nextKey: Key | null = null;\n\n switch (e.key) {\n case 'ArrowDown':\n nextKey = delegate.getKeyBelow?.(focusedKey) ?? null;\n break;\n case 'ArrowUp':\n nextKey = delegate.getKeyAbove?.(focusedKey) ?? null;\n break;\n case 'ArrowLeft':\n nextKey = delegate.getKeyLeftOf?.(focusedKey) ?? null;\n break;\n case 'ArrowRight':\n nextKey = delegate.getKeyRightOf?.(focusedKey) ?? null;\n break;\n case 'Home':\n if (e.ctrlKey) {\n nextKey = delegate.getFirstKey?.() ?? null;\n } else {\n // Go to first cell in row - for now just use first key\n nextKey = delegate.getFirstKey?.(focusedKey) ?? null;\n }\n break;\n case 'End':\n if (e.ctrlKey) {\n nextKey = delegate.getLastKey?.() ?? null;\n } else {\n // Go to last cell in row - for now just use last key\n nextKey = delegate.getLastKey?.(focusedKey) ?? null;\n }\n break;\n case 'PageDown':\n nextKey = delegate.getKeyPageBelow?.(focusedKey) ?? null;\n break;\n case 'PageUp':\n nextKey = delegate.getKeyPageAbove?.(focusedKey) ?? null;\n break;\n case 'Escape':\n if (p.escapeKeyBehavior !== 'none') {\n s.clearSelection();\n }\n return;\n case 'a':\n if (e.ctrlKey || e.metaKey) {\n e.preventDefault();\n if (s.selectionMode === 'multiple') {\n s.selectAll();\n }\n }\n return;\n case ' ':\n case 'Enter':\n e.preventDefault();\n // Toggle selection or trigger action\n if (s.selectionMode !== 'none') {\n if (e.shiftKey && s.selectionMode === 'multiple') {\n s.extendSelection(focusedKey);\n } else {\n s.toggleSelection(focusedKey);\n }\n }\n return;\n default:\n // Type to select\n if (!p.disallowTypeAhead && e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {\n const key = delegate.getKeyForSearch?.(e.key, focusedKey);\n if (key != null) {\n e.preventDefault();\n s.setFocusedKey(key);\n }\n }\n return;\n }\n\n if (nextKey != null) {\n e.preventDefault();\n s.setFocusedKey(nextKey);\n\n // Handle shift+arrow for range selection\n if (e.shiftKey && s.selectionMode === 'multiple') {\n s.extendSelection(nextKey);\n }\n }\n };\n\n // Focus handling\n const onFocus = (e: FocusEvent) => {\n const s = state();\n const el = ref();\n\n if (!el?.contains(e.target as Element)) {\n return;\n }\n\n if (!s.isFocused) {\n s.setFocused(true);\n setIsFocused(true);\n\n // If no key is focused, focus the first one\n if (s.focusedKey == null) {\n const firstKey = keyboardDelegate().getFirstKey?.();\n if (firstKey != null) {\n s.setFocusedKey(firstKey);\n }\n }\n }\n };\n\n const onBlur = (e: FocusEvent) => {\n const s = state();\n const el = ref();\n\n // Only blur if focus is leaving the grid entirely\n if (el && !el.contains(e.relatedTarget as Element)) {\n s.setFocused(false);\n setIsFocused(false);\n }\n };\n\n // Warn if no label is provided\n createMemo(() => {\n const p = props();\n if (!p['aria-label'] && !p['aria-labelledby']) {\n console.warn('Grid: An aria-label or aria-labelledby prop is required for accessibility.');\n }\n });\n\n const gridProps = createMemo(() => {\n const p = props();\n const s = state();\n\n const baseProps: Record<string, unknown> = {\n role: 'grid',\n id,\n 'aria-label': p['aria-label'],\n 'aria-labelledby': p['aria-labelledby'],\n 'aria-describedby': p['aria-describedby'],\n 'aria-multiselectable': s.selectionMode === 'multiple' ? 'true' : undefined,\n tabIndex: s.collection.size === 0 ? 0 : -1,\n onKeyDown,\n onFocus,\n onBlur,\n };\n\n if (p.isVirtualized) {\n baseProps['aria-rowcount'] = s.collection.rowCount;\n baseProps['aria-colcount'] = s.collection.columnCount;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLElement>;\n });\n\n return {\n get gridProps() {\n return gridProps();\n },\n };\n}\n", "/**\n * GridKeyboardDelegate - Handles keyboard navigation in a grid.\n * Based on @react-aria/grid/GridKeyboardDelegate.\n */\n\nimport type { GridCollection, GridNode, Key } from '@proyecto-viviana/solid-stately';\nimport type { KeyboardDelegate } from './types';\nimport type { Accessor } from 'solid-js';\n\nexport interface GridKeyboardDelegateOptions<T> {\n /** The grid collection. */\n collection: GridCollection<T>;\n /** Set of disabled keys. */\n disabledKeys: Set<Key>;\n /** Ref to the grid element. */\n ref: Accessor<HTMLElement | null>;\n /** Focus mode: row or cell. */\n focusMode: 'row' | 'cell';\n /** Text direction (ltr or rtl). */\n direction: 'ltr' | 'rtl';\n}\n\n/**\n * A keyboard delegate that handles navigation in a grid.\n */\nexport class GridKeyboardDelegate<T> implements KeyboardDelegate {\n private collection: GridCollection<T>;\n private disabledKeys: Set<Key>;\n private ref: Accessor<HTMLElement | null>;\n private focusMode: 'row' | 'cell';\n private direction: 'ltr' | 'rtl';\n\n constructor(options: GridKeyboardDelegateOptions<T>) {\n this.collection = options.collection;\n this.disabledKeys = options.disabledKeys;\n this.ref = options.ref;\n this.focusMode = options.focusMode;\n this.direction = options.direction;\n }\n\n /**\n * Check if a key is disabled.\n */\n private isDisabled(key: Key): boolean {\n return this.disabledKeys.has(key);\n }\n\n /**\n * Get the parent row key for a cell.\n */\n private getRowKey(key: Key): Key | null {\n const item = this.collection.getItem(key);\n if (!item) return null;\n\n if (item.type === 'item') {\n return key;\n }\n\n if (item.type === 'cell' && item.parentKey != null) {\n return item.parentKey;\n }\n\n return null;\n }\n\n /**\n * Get all body rows (excluding header rows).\n */\n private getBodyRows(): GridNode<T>[] {\n return this.collection.rows.filter((row) => row.type === 'item');\n }\n\n /**\n * Get the first non-disabled key.\n */\n getFirstKey(fromKey?: Key, global?: boolean): Key | null {\n const rows = this.getBodyRows();\n\n if (this.focusMode === 'row' || global) {\n // Find first non-disabled row\n for (const row of rows) {\n if (!this.isDisabled(row.key)) {\n return row.key;\n }\n }\n return null;\n }\n\n // Cell focus mode - get first cell of current row or first row\n if (fromKey != null) {\n const rowKey = this.getRowKey(fromKey);\n if (rowKey != null) {\n const children = [...this.collection.getChildren(rowKey)];\n if (children.length > 0) {\n return children[0].key;\n }\n }\n }\n\n // Fall back to first cell of first row\n if (rows.length > 0) {\n const children = [...this.collection.getChildren(rows[0].key)];\n if (children.length > 0) {\n return children[0].key;\n }\n }\n\n return null;\n }\n\n /**\n * Get the last non-disabled key.\n */\n getLastKey(fromKey?: Key, global?: boolean): Key | null {\n const rows = this.getBodyRows();\n\n if (this.focusMode === 'row' || global) {\n // Find last non-disabled row\n for (let i = rows.length - 1; i >= 0; i--) {\n if (!this.isDisabled(rows[i].key)) {\n return rows[i].key;\n }\n }\n return null;\n }\n\n // Cell focus mode - get last cell of current row or last row\n if (fromKey != null) {\n const rowKey = this.getRowKey(fromKey);\n if (rowKey != null) {\n const children = [...this.collection.getChildren(rowKey)];\n if (children.length > 0) {\n return children[children.length - 1].key;\n }\n }\n }\n\n // Fall back to last cell of last row\n if (rows.length > 0) {\n const children = [...this.collection.getChildren(rows[rows.length - 1].key)];\n if (children.length > 0) {\n return children[children.length - 1].key;\n }\n }\n\n return null;\n }\n\n /**\n * Get the key above the current key.\n */\n getKeyAbove(key: Key): Key | null {\n const item = this.collection.getItem(key);\n if (!item) return null;\n\n const rows = this.getBodyRows();\n\n if (this.focusMode === 'row' || item.type === 'item') {\n // Find the row and get the previous one\n const rowKey = item.type === 'item' ? key : item.parentKey;\n const rowIndex = rows.findIndex((r) => r.key === rowKey);\n\n if (rowIndex > 0) {\n // Find previous non-disabled row\n for (let i = rowIndex - 1; i >= 0; i--) {\n if (!this.isDisabled(rows[i].key)) {\n return rows[i].key;\n }\n }\n }\n return null;\n }\n\n // Cell focus mode - get cell in same column of previous row\n if (item.type === 'cell' && item.parentKey != null) {\n const rowIndex = rows.findIndex((r) => r.key === item.parentKey);\n const colIndex = item.column ?? item.index;\n\n if (rowIndex > 0) {\n for (let i = rowIndex - 1; i >= 0; i--) {\n if (!this.isDisabled(rows[i].key)) {\n const children = [...this.collection.getChildren(rows[i].key)];\n const targetCol = Math.min(colIndex, children.length - 1);\n if (targetCol >= 0) {\n return children[targetCol].key;\n }\n }\n }\n }\n }\n\n return null;\n }\n\n /**\n * Get the key below the current key.\n */\n getKeyBelow(key: Key): Key | null {\n const item = this.collection.getItem(key);\n if (!item) return null;\n\n const rows = this.getBodyRows();\n\n if (this.focusMode === 'row' || item.type === 'item') {\n // Find the row and get the next one\n const rowKey = item.type === 'item' ? key : item.parentKey;\n const rowIndex = rows.findIndex((r) => r.key === rowKey);\n\n if (rowIndex >= 0 && rowIndex < rows.length - 1) {\n // Find next non-disabled row\n for (let i = rowIndex + 1; i < rows.length; i++) {\n if (!this.isDisabled(rows[i].key)) {\n return rows[i].key;\n }\n }\n }\n return null;\n }\n\n // Cell focus mode - get cell in same column of next row\n if (item.type === 'cell' && item.parentKey != null) {\n const rowIndex = rows.findIndex((r) => r.key === item.parentKey);\n const colIndex = item.column ?? item.index;\n\n if (rowIndex >= 0 && rowIndex < rows.length - 1) {\n for (let i = rowIndex + 1; i < rows.length; i++) {\n if (!this.isDisabled(rows[i].key)) {\n const children = [...this.collection.getChildren(rows[i].key)];\n const targetCol = Math.min(colIndex, children.length - 1);\n if (targetCol >= 0) {\n return children[targetCol].key;\n }\n }\n }\n }\n }\n\n return null;\n }\n\n /**\n * Get the key to the left of the current key.\n */\n getKeyLeftOf(key: Key): Key | null {\n const item = this.collection.getItem(key);\n if (!item) return null;\n\n // In row focus mode, left/right might not be meaningful\n if (this.focusMode === 'row') {\n return null;\n }\n\n if (item.type === 'cell' && item.parentKey != null) {\n const children = [...this.collection.getChildren(item.parentKey)];\n const colIndex = children.findIndex((c) => c.key === key);\n\n if (this.direction === 'rtl') {\n // RTL: left moves to higher index\n if (colIndex < children.length - 1) {\n return children[colIndex + 1].key;\n }\n } else {\n // LTR: left moves to lower index\n if (colIndex > 0) {\n return children[colIndex - 1].key;\n }\n }\n }\n\n return null;\n }\n\n /**\n * Get the key to the right of the current key.\n */\n getKeyRightOf(key: Key): Key | null {\n const item = this.collection.getItem(key);\n if (!item) return null;\n\n // In row focus mode, left/right might not be meaningful\n if (this.focusMode === 'row') {\n return null;\n }\n\n if (item.type === 'cell' && item.parentKey != null) {\n const children = [...this.collection.getChildren(item.parentKey)];\n const colIndex = children.findIndex((c) => c.key === key);\n\n if (this.direction === 'rtl') {\n // RTL: right moves to lower index\n if (colIndex > 0) {\n return children[colIndex - 1].key;\n }\n } else {\n // LTR: right moves to higher index\n if (colIndex < children.length - 1) {\n return children[colIndex + 1].key;\n }\n }\n }\n\n return null;\n }\n\n /**\n * Get the key for page up.\n */\n getKeyPageAbove(key: Key): Key | null {\n const el = this.ref();\n if (!el) return null;\n\n const item = this.collection.getItem(key);\n if (!item) return null;\n\n const rows = this.getBodyRows();\n const rowKey = this.getRowKey(key);\n const rowIndex = rows.findIndex((r) => r.key === rowKey);\n\n if (rowIndex < 0) return null;\n\n // Calculate how many rows fit in a page (rough estimate)\n const rowHeight = el.scrollHeight / rows.length;\n const pageSize = Math.max(1, Math.floor(el.clientHeight / rowHeight));\n\n const targetIndex = Math.max(0, rowIndex - pageSize);\n\n // Find first non-disabled row at or before target\n for (let i = targetIndex; i >= 0; i--) {\n if (!this.isDisabled(rows[i].key)) {\n if (this.focusMode === 'row' || item.type === 'item') {\n return rows[i].key;\n }\n\n // Cell focus mode - return cell at same column\n const colIndex = item.type === 'cell' ? (item.column ?? item.index) : 0;\n const children = [...this.collection.getChildren(rows[i].key)];\n const targetCol = Math.min(colIndex, children.length - 1);\n if (targetCol >= 0) {\n return children[targetCol].key;\n }\n }\n }\n\n return null;\n }\n\n /**\n * Get the key for page down.\n */\n getKeyPageBelow(key: Key): Key | null {\n const el = this.ref();\n if (!el) return null;\n\n const item = this.collection.getItem(key);\n if (!item) return null;\n\n const rows = this.getBodyRows();\n const rowKey = this.getRowKey(key);\n const rowIndex = rows.findIndex((r) => r.key === rowKey);\n\n if (rowIndex < 0) return null;\n\n // Calculate how many rows fit in a page (rough estimate)\n const rowHeight = el.scrollHeight / rows.length;\n const pageSize = Math.max(1, Math.floor(el.clientHeight / rowHeight));\n\n const targetIndex = Math.min(rows.length - 1, rowIndex + pageSize);\n\n // Find first non-disabled row at or after target\n for (let i = targetIndex; i < rows.length; i++) {\n if (!this.isDisabled(rows[i].key)) {\n if (this.focusMode === 'row' || item.type === 'item') {\n return rows[i].key;\n }\n\n // Cell focus mode - return cell at same column\n const colIndex = item.type === 'cell' ? (item.column ?? item.index) : 0;\n const children = [...this.collection.getChildren(rows[i].key)];\n const targetCol = Math.min(colIndex, children.length - 1);\n if (targetCol >= 0) {\n return children[targetCol].key;\n }\n }\n }\n\n return null;\n }\n\n /**\n * Get the key that matches the search string.\n */\n getKeyForSearch(search: string, fromKey?: Key): Key | null {\n const searchLower = search.toLowerCase();\n const rows = this.getBodyRows();\n\n let startIndex = 0;\n if (fromKey != null) {\n const rowKey = this.getRowKey(fromKey);\n const idx = rows.findIndex((r) => r.key === rowKey);\n if (idx >= 0) {\n startIndex = idx + 1;\n }\n }\n\n // Search from startIndex to end\n for (let i = startIndex; i < rows.length; i++) {\n const row = rows[i];\n if (!this.isDisabled(row.key)) {\n const textValue = row.textValue?.toLowerCase() ?? '';\n if (textValue.startsWith(searchLower)) {\n return row.key;\n }\n }\n }\n\n // Wrap around and search from beginning\n for (let i = 0; i < startIndex; i++) {\n const row = rows[i];\n if (!this.isDisabled(row.key)) {\n const textValue = row.textValue?.toLowerCase() ?? '';\n if (textValue.startsWith(searchLower)) {\n return row.key;\n }\n }\n }\n\n return null;\n }\n}\n", "/**\n * createGridRow - Provides accessibility for a grid row.\n * Based on @react-aria/grid/useGridRow.\n */\n\nimport { createMemo, createSignal, type Accessor } from 'solid-js';\nimport type { JSX } from 'solid-js';\nimport type { GridState, GridCollection } from '@proyecto-viviana/solid-stately';\nimport type { GridRowProps, GridRowAria } from './types';\nimport { getGridData } from './createGrid';\n\n/**\n * Creates accessibility props for a grid row.\n */\nexport function createGridRow<T extends object>(\n props: Accessor<GridRowProps>,\n state: Accessor<GridState<T, GridCollection<T>>>,\n _ref: Accessor<HTMLElement | null>\n): GridRowAria {\n const [isPressed, setIsPressed] = createSignal(false);\n\n const isSelected = createMemo(() => {\n const s = state();\n const p = props();\n return s.isSelected(p.key);\n });\n\n const isDisabled = createMemo(() => {\n const s = state();\n const p = props();\n return s.isDisabled(p.key);\n });\n\n const isFocused = createMemo(() => {\n const s = state();\n const p = props();\n return s.focusedKey === p.key;\n });\n\n // Handle click/press for selection\n const onClick = (e: MouseEvent) => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n // Get grid metadata for actions\n const gridData = getGridData(s);\n const onRowAction = gridData?.actions.onRowAction;\n\n // Handle selection\n if (s.selectionMode !== 'none') {\n if (e.shiftKey && s.selectionMode === 'multiple') {\n s.extendSelection(p.key);\n } else if (e.ctrlKey || e.metaKey) {\n s.toggleSelection(p.key);\n } else {\n // Replace selection\n s.replaceSelection(p.key);\n }\n }\n\n // Call action handler\n if (onRowAction) {\n onRowAction(p.key);\n }\n\n if (p.onAction) {\n p.onAction();\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n\n // Get grid metadata for actions\n const gridData = getGridData(s);\n const onRowAction = gridData?.actions.onRowAction;\n\n // Handle selection\n if (s.selectionMode !== 'none') {\n s.toggleSelection(p.key);\n }\n\n // Call action handler\n if (onRowAction) {\n onRowAction(p.key);\n }\n\n if (p.onAction) {\n p.onAction();\n }\n }\n };\n\n const onFocus = () => {\n const s = state();\n const p = props();\n s.setFocusedKey(p.key);\n };\n\n const onPointerDown = () => {\n setIsPressed(true);\n };\n\n const onPointerUp = () => {\n setIsPressed(false);\n };\n\n const rowProps = createMemo(() => {\n const s = state();\n const p = props();\n\n const baseProps: Record<string, unknown> = {\n role: 'row',\n 'aria-selected': s.selectionMode !== 'none' ? isSelected() : undefined,\n 'aria-disabled': isDisabled() || undefined,\n tabIndex: isFocused() ? 0 : -1,\n onClick,\n onKeyDown,\n onFocus,\n onPointerDown,\n onPointerUp,\n };\n\n if (p.isVirtualized && p.index != null) {\n baseProps['aria-rowindex'] = p.index + 1; // aria-rowindex is 1-based\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLElement>;\n });\n\n return {\n get rowProps() {\n return rowProps();\n },\n get isSelected() {\n return isSelected();\n },\n get isDisabled() {\n return isDisabled();\n },\n get isPressed() {\n return isPressed();\n },\n };\n}\n", "/**\n * createGridCell - Provides accessibility for a grid cell.\n * Based on @react-aria/grid/useGridCell.\n */\n\nimport { createMemo, createSignal, type Accessor } from 'solid-js';\nimport type { JSX } from 'solid-js';\nimport type { GridState, GridCollection } from '@proyecto-viviana/solid-stately';\nimport type { GridCellProps, GridCellAria } from './types';\nimport { getGridData } from './createGrid';\n\n/**\n * Creates accessibility props for a grid cell.\n */\nexport function createGridCell<T extends object>(\n props: Accessor<GridCellProps>,\n state: Accessor<GridState<T, GridCollection<T>>>,\n _ref: Accessor<HTMLElement | null>\n): GridCellAria {\n const [isPressed, setIsPressed] = createSignal(false);\n\n const isSelected = createMemo(() => {\n const s = state();\n const p = props();\n // Check if parent row is selected\n const node = s.collection.getItem(p.key);\n if (node?.parentKey != null) {\n return s.isSelected(node.parentKey);\n }\n return false;\n });\n\n const isDisabled = createMemo(() => {\n const s = state();\n const p = props();\n // Check if parent row is disabled\n const node = s.collection.getItem(p.key);\n if (node?.parentKey != null) {\n return s.isDisabled(node.parentKey);\n }\n return false;\n });\n\n const isFocused = createMemo(() => {\n const s = state();\n const p = props();\n return s.focusedKey === p.key;\n });\n\n // Handle click/press for cell actions\n const onClick = (e: MouseEvent) => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n // Get grid metadata for actions\n const gridData = getGridData(s);\n const onCellAction = gridData?.actions.onCellAction;\n\n // Get parent row key for selection\n const node = s.collection.getItem(p.key);\n const rowKey = node?.parentKey;\n\n // Handle selection on parent row\n if (rowKey != null && s.selectionMode !== 'none') {\n if (e.shiftKey && s.selectionMode === 'multiple') {\n s.extendSelection(rowKey);\n } else if (e.ctrlKey || e.metaKey) {\n s.toggleSelection(rowKey);\n } else {\n // Replace selection\n s.replaceSelection(rowKey);\n }\n }\n\n // Call cell action handler\n if (onCellAction) {\n onCellAction(p.key);\n }\n\n if (p.onAction) {\n p.onAction();\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n // Enter or Space triggers cell action\n if (e.key === 'Enter' || e.key === ' ') {\n // Only handle if there's an action to trigger\n const gridData = getGridData(s);\n const onCellAction = gridData?.actions.onCellAction;\n\n if (onCellAction || p.onAction) {\n e.preventDefault();\n\n if (onCellAction) {\n onCellAction(p.key);\n }\n\n if (p.onAction) {\n p.onAction();\n }\n }\n }\n };\n\n const onFocus = () => {\n const s = state();\n const p = props();\n s.setFocusedKey(p.key);\n };\n\n const onPointerDown = () => {\n setIsPressed(true);\n };\n\n const onPointerUp = () => {\n setIsPressed(false);\n };\n\n const cellProps = createMemo(() => {\n const s = state();\n const p = props();\n const node = s.collection.getItem(p.key);\n\n // Determine the role based on node type\n let role: string = 'gridcell';\n if (node?.type === 'rowheader') {\n role = 'rowheader';\n } else if (node?.type === 'column') {\n role = 'columnheader';\n }\n\n const baseProps: Record<string, unknown> = {\n role,\n 'aria-disabled': isDisabled() || undefined,\n 'aria-selected': s.selectionMode !== 'none' ? isSelected() : undefined,\n tabIndex: isFocused() ? 0 : -1,\n onClick,\n onKeyDown,\n onFocus,\n onPointerDown,\n onPointerUp,\n };\n\n // Add column index for virtualized grids\n if (p.isVirtualized && node?.column != null) {\n baseProps['aria-colindex'] = node.column + 1; // aria-colindex is 1-based\n }\n\n // Add colspan if present\n if (node?.colspan != null && node.colspan > 1) {\n baseProps['aria-colspan'] = node.colspan;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLElement>;\n });\n\n return {\n get cellProps() {\n return cellProps();\n },\n get isSelected() {\n return isSelected();\n },\n get isDisabled() {\n return isDisabled();\n },\n get isPressed() {\n return isPressed();\n },\n get isFocused() {\n return isFocused();\n },\n };\n}\n", "/**\n * createTable - Provides accessibility for a table component.\n * Based on @react-aria/table/useTable.\n */\n\nimport { createMemo, createEffect, on, type Accessor } from 'solid-js';\nimport type { JSX } from 'solid-js';\nimport { createId } from '@proyecto-viviana/solid-stately';\nimport type { TableState, TableCollection, Key, GridNode } from '@proyecto-viviana/solid-stately';\nimport type { AriaTableProps, TableAria } from './types';\nimport { useLocale } from '../i18n';\nimport { announce } from '../live-announcer';\n\n// Global map to store table metadata for child components\nconst tableMap = new WeakMap<\n object,\n {\n tableId: string;\n actions: { onRowAction?: (key: Key) => void; onCellAction?: (key: Key) => void };\n shouldSelectOnPressUp?: boolean;\n focusMode?: 'row' | 'cell';\n }\n>();\n\n/**\n * Get the table metadata for child components.\n */\nexport function getTableData<T>(state: TableState<T, TableCollection<T>>) {\n return tableMap.get(state);\n}\n\n/**\n * Helper to get cells from a row by iterating children\n */\nfunction getChildCells<T>(collection: TableCollection<T>, rowKey: Key): GridNode<T>[] {\n const children = collection.getChildren(rowKey);\n return [...children].filter(node => node.type === 'cell' || node.type === 'rowheader');\n}\n\n/**\n * Helper to get cell at specific index in a row\n */\nfunction getCellAtIndex<T>(collection: TableCollection<T>, rowKey: Key, index: number): GridNode<T> | null {\n const cells = getChildCells(collection, rowKey);\n return cells[index] ?? null;\n}\n\n/**\n * Helper to check if a node is a cell\n */\nfunction isCell<T>(node: GridNode<T> | null): boolean {\n return node?.type === 'cell' || node?.type === 'rowheader';\n}\n\n/**\n * Helper to check if a node is a row\n */\nfunction isRow<T>(node: GridNode<T> | null): boolean {\n return node?.type === 'item';\n}\n\n/**\n * Creates accessibility props for a table component.\n */\nexport function createTable<T extends object>(\n props: Accessor<AriaTableProps>,\n state: Accessor<TableState<T, TableCollection<T>>>,\n ref: Accessor<HTMLTableElement | null>\n): TableAria {\n const id = createId(props().id);\n const locale = useLocale();\n\n // Track previous sort descriptor for announcements\n let prevSortDescriptor: { column: Key; direction: 'ascending' | 'descending' } | null = null;\n let isFirstRender = true;\n\n // Store metadata for child components\n const storeTableData = () => {\n const s = state();\n const p = props();\n tableMap.set(s, {\n tableId: id,\n actions: {\n onRowAction: p.onRowAction,\n onCellAction: p.onCellAction,\n },\n shouldSelectOnPressUp: p.shouldSelectOnPressUp,\n focusMode: p.focusMode,\n });\n };\n\n // Update table data whenever props/state changes\n createMemo(() => {\n storeTableData();\n });\n\n // Announce sort changes (only after initial render)\n createEffect(on(\n () => state().sortDescriptor,\n (sortDescriptor) => {\n if (isFirstRender) {\n isFirstRender = false;\n prevSortDescriptor = sortDescriptor;\n return;\n }\n\n if (sortDescriptor && (\n sortDescriptor.column !== prevSortDescriptor?.column ||\n sortDescriptor.direction !== prevSortDescriptor?.direction\n )) {\n const collection = state().collection;\n const column = collection.columns.find(c => c.key === sortDescriptor.column);\n const columnName = column?.textValue ?? String(sortDescriptor.column);\n const directionText = sortDescriptor.direction === 'ascending' ? 'ascending' : 'descending';\n\n announce(`Sorted by ${columnName}, ${directionText}`, 'assertive', 500);\n }\n\n prevSortDescriptor = sortDescriptor;\n }\n ));\n\n // Keyboard navigation handler with full 2D navigation\n const onKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const collection = s.collection;\n const p = props();\n const focusMode = p.focusMode ?? 'row';\n const isRTL = locale().direction === 'rtl';\n\n if (s.isKeyboardNavigationDisabled) {\n return;\n }\n\n const focusedKey = s.focusedKey;\n if (focusedKey == null) {\n // If nothing is focused, focus the first item\n if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'Home' || e.key === 'End') {\n const firstKey = collection.getFirstKey();\n if (firstKey != null) {\n e.preventDefault();\n s.setFocusedKey(firstKey);\n }\n }\n return;\n }\n\n const focusedItem = collection.getItem(focusedKey);\n if (!focusedItem) return;\n\n let nextKey: Key | null = null;\n\n switch (e.key) {\n case 'ArrowDown': {\n e.preventDefault();\n // If focused on a cell, move to the same column in the next row\n if (isCell(focusedItem) && focusedItem.parentKey != null) {\n const nextRowKey = collection.getKeyAfter(focusedItem.parentKey);\n if (nextRowKey != null) {\n const cellIndex = focusedItem.index;\n const nextCell = getCellAtIndex(collection, nextRowKey, cellIndex);\n nextKey = nextCell?.key ?? nextRowKey;\n }\n } else {\n // Move to next row\n nextKey = collection.getKeyAfter(focusedKey);\n }\n break;\n }\n\n case 'ArrowUp': {\n e.preventDefault();\n // If focused on a cell, move to the same column in the previous row\n if (isCell(focusedItem) && focusedItem.parentKey != null) {\n const prevRowKey = collection.getKeyBefore(focusedItem.parentKey);\n if (prevRowKey != null) {\n const cellIndex = focusedItem.index;\n const prevCell = getCellAtIndex(collection, prevRowKey, cellIndex);\n nextKey = prevCell?.key ?? prevRowKey;\n }\n } else {\n // Move to previous row\n nextKey = collection.getKeyBefore(focusedKey);\n }\n break;\n }\n\n case 'ArrowRight': {\n e.preventDefault();\n const goNext = !isRTL;\n\n if (isRow(focusedItem)) {\n // If on a row, go to the first/last cell\n const cells = getChildCells(collection, focusedKey);\n if (cells.length > 0) {\n nextKey = goNext ? cells[0].key : cells[cells.length - 1].key;\n }\n } else if (isCell(focusedItem) && focusedItem.parentKey != null) {\n // If on a cell, go to the next/prev cell\n const cells = getChildCells(collection, focusedItem.parentKey);\n const currentIndex = focusedItem.index;\n const targetIndex = goNext ? currentIndex + 1 : currentIndex - 1;\n\n if (targetIndex >= 0 && targetIndex < cells.length) {\n nextKey = cells[targetIndex].key;\n } else if (focusMode === 'row') {\n // Wrap to row\n nextKey = focusedItem.parentKey;\n } else {\n // Wrap to first/last cell\n nextKey = goNext ? cells[0].key : cells[cells.length - 1].key;\n }\n }\n break;\n }\n\n case 'ArrowLeft': {\n e.preventDefault();\n const goNext = isRTL;\n\n if (isRow(focusedItem)) {\n // If on a row, go to the last/first cell\n const cells = getChildCells(collection, focusedKey);\n if (cells.length > 0) {\n nextKey = goNext ? cells[0].key : cells[cells.length - 1].key;\n }\n } else if (isCell(focusedItem) && focusedItem.parentKey != null) {\n // If on a cell, go to the prev/next cell\n const cells = getChildCells(collection, focusedItem.parentKey);\n const currentIndex = focusedItem.index;\n const targetIndex = goNext ? currentIndex + 1 : currentIndex - 1;\n\n if (targetIndex >= 0 && targetIndex < cells.length) {\n nextKey = cells[targetIndex].key;\n } else if (focusMode === 'row') {\n // Wrap to row\n nextKey = focusedItem.parentKey;\n } else {\n // Wrap to first/last cell\n nextKey = goNext ? cells[0].key : cells[cells.length - 1].key;\n }\n }\n break;\n }\n\n case 'Home': {\n e.preventDefault();\n if (e.ctrlKey) {\n // Ctrl+Home: Go to first row/cell\n const firstRowKey = collection.getFirstKey();\n if (firstRowKey != null) {\n if (isCell(focusedItem) || focusMode === 'cell') {\n const cells = getChildCells(collection, firstRowKey);\n nextKey = cells[0]?.key ?? firstRowKey;\n } else {\n nextKey = firstRowKey;\n }\n }\n } else if (isCell(focusedItem) && focusedItem.parentKey != null) {\n // Home: Go to first cell in current row\n const cells = getChildCells(collection, focusedItem.parentKey);\n nextKey = cells[0]?.key ?? null;\n } else {\n // On row: go to first row\n nextKey = collection.getFirstKey();\n }\n break;\n }\n\n case 'End': {\n e.preventDefault();\n if (e.ctrlKey) {\n // Ctrl+End: Go to last row/cell\n const lastRowKey = collection.getLastKey();\n if (lastRowKey != null) {\n if (isCell(focusedItem) || focusMode === 'cell') {\n const cells = getChildCells(collection, lastRowKey);\n nextKey = cells[cells.length - 1]?.key ?? lastRowKey;\n } else {\n nextKey = lastRowKey;\n }\n }\n } else if (isCell(focusedItem) && focusedItem.parentKey != null) {\n // End: Go to last cell in current row\n const cells = getChildCells(collection, focusedItem.parentKey);\n nextKey = cells[cells.length - 1]?.key ?? null;\n } else {\n // On row: go to last row\n nextKey = collection.getLastKey();\n }\n break;\n }\n\n case 'PageDown': {\n e.preventDefault();\n // Move down by roughly a page (using DOM measurements if available)\n const el = ref();\n if (el) {\n const visibleHeight = el.clientHeight;\n let currentKey: Key | null = focusedKey;\n let traveled = 0;\n\n // If on a cell, start from the parent row\n if (isCell(focusedItem) && focusedItem.parentKey != null) {\n currentKey = focusedItem.parentKey;\n }\n\n // Move down until we've traveled approximately one page\n while (currentKey != null && traveled < visibleHeight) {\n const next = collection.getKeyAfter(currentKey);\n if (next == null) break;\n\n // Estimate row height (default to 40px if we can't measure)\n const rowElement = el.querySelector(`[data-key=\"${currentKey}\"]`);\n traveled += rowElement?.clientHeight ?? 40;\n currentKey = next;\n }\n\n if (currentKey != null) {\n // If we started on a cell, focus the same column in the new row\n if (isCell(focusedItem)) {\n const cellIndex = focusedItem.index;\n const targetCell = getCellAtIndex(collection, currentKey, cellIndex);\n nextKey = targetCell?.key ?? currentKey;\n } else {\n nextKey = currentKey;\n }\n }\n } else {\n // Fallback: move 10 rows\n let count = 10;\n let current: Key | null = isCell(focusedItem) && focusedItem.parentKey != null\n ? focusedItem.parentKey\n : focusedKey;\n while (count > 0 && current != null) {\n const next = collection.getKeyAfter(current);\n if (next == null) break;\n current = next;\n count--;\n }\n if (current != null && isCell(focusedItem)) {\n const targetCell = getCellAtIndex(collection, current, focusedItem.index);\n nextKey = targetCell?.key ?? current;\n } else {\n nextKey = current;\n }\n }\n break;\n }\n\n case 'PageUp': {\n e.preventDefault();\n // Move up by roughly a page\n const el = ref();\n if (el) {\n const visibleHeight = el.clientHeight;\n let currentKey: Key | null = focusedKey;\n let traveled = 0;\n\n // If on a cell, start from the parent row\n if (isCell(focusedItem) && focusedItem.parentKey != null) {\n currentKey = focusedItem.parentKey;\n }\n\n // Move up until we've traveled approximately one page\n while (currentKey != null && traveled < visibleHeight) {\n const prev = collection.getKeyBefore(currentKey);\n if (prev == null) break;\n\n const rowElement = el.querySelector(`[data-key=\"${currentKey}\"]`);\n traveled += rowElement?.clientHeight ?? 40;\n currentKey = prev;\n }\n\n if (currentKey != null) {\n if (isCell(focusedItem)) {\n const cellIndex = focusedItem.index;\n const targetCell = getCellAtIndex(collection, currentKey, cellIndex);\n nextKey = targetCell?.key ?? currentKey;\n } else {\n nextKey = currentKey;\n }\n }\n } else {\n // Fallback: move 10 rows\n let count = 10;\n let current: Key | null = isCell(focusedItem) && focusedItem.parentKey != null\n ? focusedItem.parentKey\n : focusedKey;\n while (count > 0 && current != null) {\n const prev = collection.getKeyBefore(current);\n if (prev == null) break;\n current = prev;\n count--;\n }\n if (current != null && isCell(focusedItem)) {\n const targetCell = getCellAtIndex(collection, current, focusedItem.index);\n nextKey = targetCell?.key ?? current;\n } else {\n nextKey = current;\n }\n }\n break;\n }\n\n case 'Escape':\n s.clearSelection();\n return;\n\n case 'a':\n if (e.ctrlKey || e.metaKey) {\n e.preventDefault();\n if (s.selectionMode === 'multiple') {\n s.selectAll();\n }\n }\n return;\n\n case ' ':\n case 'Enter':\n e.preventDefault();\n // Toggle selection or trigger action\n if (s.selectionMode !== 'none') {\n // For cells, select the parent row\n const keyToSelect = isCell(focusedItem) && focusedItem.parentKey != null\n ? focusedItem.parentKey\n : focusedKey;\n\n if (e.shiftKey && s.selectionMode === 'multiple') {\n s.extendSelection(keyToSelect);\n } else {\n s.toggleSelection(keyToSelect);\n }\n }\n return;\n\n default:\n return;\n }\n\n if (nextKey != null) {\n s.setFocusedKey(nextKey);\n\n // Handle shift+arrow for range selection\n if (e.shiftKey && s.selectionMode === 'multiple') {\n // For cells, select the parent row\n const focusedNode = collection.getItem(nextKey);\n const keyToSelect = focusedNode && isCell(focusedNode) && focusedNode.parentKey != null\n ? focusedNode.parentKey\n : nextKey;\n s.extendSelection(keyToSelect);\n }\n }\n };\n\n // Focus handling\n const onFocus = (e: FocusEvent) => {\n const s = state();\n const el = ref();\n\n if (!el?.contains(e.target as Element)) {\n return;\n }\n\n if (!s.isFocused) {\n s.setFocused(true);\n\n // If no key is focused, focus the first one\n if (s.focusedKey == null) {\n const firstKey = s.collection.getFirstKey();\n if (firstKey != null) {\n s.setFocusedKey(firstKey);\n }\n }\n }\n };\n\n const onBlur = (e: FocusEvent) => {\n const s = state();\n const el = ref();\n\n // Only blur if focus is leaving the table entirely\n if (el && !el.contains(e.relatedTarget as Element)) {\n s.setFocused(false);\n }\n };\n\n // Warn if no label is provided\n createMemo(() => {\n const p = props();\n if (!p['aria-label'] && !p['aria-labelledby']) {\n console.warn('Table: An aria-label or aria-labelledby prop is required for accessibility.');\n }\n });\n\n const gridProps = createMemo(() => {\n const p = props();\n const s = state();\n\n const baseProps: Record<string, unknown> = {\n role: 'grid',\n id,\n 'aria-label': p['aria-label'],\n 'aria-labelledby': p['aria-labelledby'],\n 'aria-describedby': p['aria-describedby'],\n 'aria-multiselectable': s.selectionMode === 'multiple' ? 'true' : undefined,\n tabIndex: s.collection.size === 0 ? 0 : -1,\n onKeyDown,\n onFocus,\n onBlur,\n };\n\n if (p.isVirtualized) {\n baseProps['aria-rowcount'] = s.collection.rowCount;\n baseProps['aria-colcount'] = s.collection.columnCount;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLTableElement>;\n });\n\n return {\n get gridProps() {\n return gridProps();\n },\n };\n}\n", "/**\n * createTableHeaderRow - Provides accessibility for a table header row.\n * Based on @react-aria/table/useTableHeaderRow.\n */\n\nimport { createMemo, type Accessor } from 'solid-js';\nimport type { JSX } from 'solid-js';\nimport type { TableState, TableCollection } from '@proyecto-viviana/solid-stately';\nimport type { AriaTableHeaderRowProps, TableHeaderRowAria } from './types';\n\n/**\n * Creates accessibility props for a table header row.\n */\nexport function createTableHeaderRow<T extends object>(\n props: Accessor<AriaTableHeaderRowProps>,\n _state: Accessor<TableState<T, TableCollection<T>>>,\n _ref: Accessor<HTMLTableRowElement | null>\n): TableHeaderRowAria {\n const rowProps = createMemo(() => {\n const p = props();\n const node = p.node;\n\n const baseProps: Record<string, unknown> = {\n role: 'row',\n };\n\n // Add aria-rowindex for virtualized tables\n if (p.isVirtualized && node.rowIndex != null) {\n baseProps['aria-rowindex'] = node.rowIndex + 1; // 1-based\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLTableRowElement>;\n });\n\n return {\n get rowProps() {\n return rowProps();\n },\n };\n}\n", "/**\n * createTableColumnHeader - Provides accessibility for a table column header.\n * Based on @react-aria/table/useTableColumnHeader.\n */\n\nimport { createMemo, createSignal, type Accessor } from 'solid-js';\nimport type { JSX } from 'solid-js';\nimport type { TableState, TableCollection } from '@proyecto-viviana/solid-stately';\nimport type { AriaTableColumnHeaderProps, TableColumnHeaderAria } from './types';\nimport { getTableData } from './createTable';\n\n/**\n * Creates accessibility props for a table column header.\n */\nexport function createTableColumnHeader<T extends object>(\n props: Accessor<AriaTableColumnHeaderProps>,\n state: Accessor<TableState<T, TableCollection<T>>>,\n _ref: Accessor<HTMLTableCellElement | null>\n): TableColumnHeaderAria {\n const [_isPressed, setIsPressed] = createSignal(false);\n\n const isFocused = createMemo(() => {\n const s = state();\n const p = props();\n return s.focusedKey === p.node.key;\n });\n\n // Handle click for sorting\n const onClick = () => {\n const s = state();\n const p = props();\n\n if (p.allowsSorting) {\n s.sort(p.node.key);\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n const p = props();\n const s = state();\n\n if (p.allowsSorting && (e.key === 'Enter' || e.key === ' ')) {\n e.preventDefault();\n s.sort(p.node.key);\n }\n };\n\n const onFocus = () => {\n const s = state();\n const p = props();\n s.setFocusedKey(p.node.key);\n };\n\n const onPointerDown = () => {\n setIsPressed(true);\n };\n\n const onPointerUp = () => {\n setIsPressed(false);\n };\n\n const columnHeaderProps = createMemo(() => {\n const s = state();\n const p = props();\n const node = p.node;\n const tableData = getTableData(s);\n\n // Determine sort state\n let ariaSort: 'none' | 'ascending' | 'descending' | undefined = undefined;\n if (p.allowsSorting) {\n const sortDescriptor = s.sortDescriptor;\n if (sortDescriptor?.column === node.key) {\n ariaSort = sortDescriptor.direction;\n } else {\n ariaSort = 'none';\n }\n }\n\n const baseProps: Record<string, unknown> = {\n role: 'columnheader',\n id: tableData ? `${tableData.tableId}-${node.key}` : undefined,\n 'aria-sort': ariaSort,\n tabIndex: isFocused() ? 0 : -1,\n onFocus,\n };\n\n // Add click handler if sortable\n if (p.allowsSorting) {\n baseProps.onClick = onClick;\n baseProps.onKeyDown = onKeyDown;\n baseProps.onPointerDown = onPointerDown;\n baseProps.onPointerUp = onPointerUp;\n baseProps.style = { cursor: 'pointer' };\n }\n\n // Add aria-colindex for virtualized tables\n if (p.isVirtualized && node.column != null) {\n baseProps['aria-colindex'] = node.column + 1; // 1-based\n }\n\n // Add colspan if present\n if (node.colspan != null && node.colspan > 1) {\n baseProps['aria-colspan'] = node.colspan;\n baseProps.colSpan = node.colspan;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLTableCellElement>;\n });\n\n return {\n get columnHeaderProps() {\n return columnHeaderProps();\n },\n };\n}\n", "/**\n * createTableRow - Provides accessibility for a table row.\n * Based on @react-aria/table/useTableRow.\n */\n\nimport { createMemo, createSignal, type Accessor } from 'solid-js';\nimport type { JSX } from 'solid-js';\nimport type { TableState, TableCollection } from '@proyecto-viviana/solid-stately';\nimport type { AriaTableRowProps, TableRowAria } from './types';\nimport { getTableData } from './createTable';\n\n/**\n * Creates accessibility props for a table row.\n */\nexport function createTableRow<T extends object>(\n props: Accessor<AriaTableRowProps>,\n state: Accessor<TableState<T, TableCollection<T>>>,\n _ref: Accessor<HTMLTableRowElement | null>\n): TableRowAria {\n const [isPressed, setIsPressed] = createSignal(false);\n\n const isSelected = createMemo(() => {\n const s = state();\n const p = props();\n return s.isSelected(p.node.key);\n });\n\n const isDisabled = createMemo(() => {\n const s = state();\n const p = props();\n return s.isDisabled(p.node.key);\n });\n\n const isFocused = createMemo(() => {\n const s = state();\n const p = props();\n return s.focusedKey === p.node.key;\n });\n\n // Handle click/press for selection\n const onClick = (e: MouseEvent) => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n // Get table metadata for actions\n const tableData = getTableData(s);\n const onRowAction = tableData?.actions.onRowAction;\n\n // Handle selection\n if (s.selectionMode !== 'none') {\n if (e.shiftKey && s.selectionMode === 'multiple') {\n s.extendSelection(p.node.key);\n } else if (e.ctrlKey || e.metaKey) {\n s.toggleSelection(p.node.key);\n } else {\n // Replace selection\n s.replaceSelection(p.node.key);\n }\n }\n\n // Call action handler\n if (onRowAction) {\n onRowAction(p.node.key);\n }\n\n if (p.onAction) {\n p.onAction();\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n\n // Get table metadata for actions\n const tableData = getTableData(s);\n const onRowAction = tableData?.actions.onRowAction;\n\n // Handle selection\n if (s.selectionMode !== 'none') {\n s.toggleSelection(p.node.key);\n }\n\n // Call action handler\n if (onRowAction) {\n onRowAction(p.node.key);\n }\n\n if (p.onAction) {\n p.onAction();\n }\n }\n };\n\n const onFocus = () => {\n const s = state();\n const p = props();\n s.setFocusedKey(p.node.key);\n };\n\n const onPointerDown = () => {\n setIsPressed(true);\n };\n\n const onPointerUp = () => {\n setIsPressed(false);\n };\n\n const rowProps = createMemo(() => {\n const s = state();\n const p = props();\n const node = p.node;\n\n const baseProps: Record<string, unknown> = {\n role: 'row',\n 'aria-selected': s.selectionMode !== 'none' ? isSelected() : undefined,\n 'aria-disabled': isDisabled() || undefined,\n tabIndex: isFocused() ? 0 : -1,\n onClick,\n onKeyDown,\n onFocus,\n onPointerDown,\n onPointerUp,\n };\n\n // Add aria-rowindex for virtualized tables\n if (p.isVirtualized && node.rowIndex != null) {\n baseProps['aria-rowindex'] = node.rowIndex + 1; // 1-based\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLTableRowElement>;\n });\n\n return {\n get rowProps() {\n return rowProps();\n },\n get isSelected() {\n return isSelected();\n },\n get isDisabled() {\n return isDisabled();\n },\n get isPressed() {\n return isPressed();\n },\n };\n}\n", "/**\n * createTableCell - Provides accessibility for a table cell.\n * Based on @react-aria/table/useTableCell.\n */\n\nimport { createMemo, createSignal, type Accessor } from 'solid-js';\nimport type { JSX } from 'solid-js';\nimport type { TableState, TableCollection } from '@proyecto-viviana/solid-stately';\nimport type { AriaTableCellProps, TableCellAria } from './types';\nimport { getTableData } from './createTable';\n\n/**\n * Creates accessibility props for a table cell.\n */\nexport function createTableCell<T extends object>(\n props: Accessor<AriaTableCellProps>,\n state: Accessor<TableState<T, TableCollection<T>>>,\n _ref: Accessor<HTMLTableCellElement | null>\n): TableCellAria {\n const [isPressed, setIsPressed] = createSignal(false);\n\n const isDisabled = createMemo(() => {\n const s = state();\n const p = props();\n // Check if parent row is disabled\n const node = p.node;\n if (node.parentKey != null) {\n return s.isDisabled(node.parentKey);\n }\n return false;\n });\n\n const isFocused = createMemo(() => {\n const s = state();\n const p = props();\n return s.focusedKey === p.node.key;\n });\n\n // Handle click for cell actions\n const onClick = () => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n // Get table metadata for actions\n const tableData = getTableData(s);\n const onCellAction = tableData?.actions.onCellAction;\n\n // Call cell action handler\n if (onCellAction) {\n onCellAction(p.node.key);\n }\n\n if (p.onAction) {\n p.onAction();\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n // Enter triggers cell action\n if (e.key === 'Enter') {\n const tableData = getTableData(s);\n const onCellAction = tableData?.actions.onCellAction;\n\n if (onCellAction || p.onAction) {\n e.preventDefault();\n\n if (onCellAction) {\n onCellAction(p.node.key);\n }\n\n if (p.onAction) {\n p.onAction();\n }\n }\n }\n };\n\n const onFocus = () => {\n const s = state();\n const p = props();\n s.setFocusedKey(p.node.key);\n };\n\n const onPointerDown = () => {\n setIsPressed(true);\n };\n\n const onPointerUp = () => {\n setIsPressed(false);\n };\n\n const gridCellProps = createMemo(() => {\n const s = state();\n const p = props();\n const node = p.node;\n const tableData = getTableData(s);\n\n // Determine the role based on node type\n let role: string = 'gridcell';\n if (node.type === 'rowheader') {\n role = 'rowheader';\n }\n\n const baseProps: Record<string, unknown> = {\n role,\n id: tableData && node.parentKey != null\n ? `${tableData.tableId}-${node.parentKey}-${node.key}`\n : undefined,\n 'aria-disabled': isDisabled() || undefined,\n tabIndex: isFocused() ? 0 : -1,\n onClick,\n onKeyDown,\n onFocus,\n onPointerDown,\n onPointerUp,\n };\n\n // Add aria-colindex for virtualized tables\n if (p.isVirtualized && node.column != null) {\n baseProps['aria-colindex'] = node.column + 1; // 1-based\n }\n\n // Add colspan if present\n if (node.colspan != null && node.colspan > 1) {\n baseProps['aria-colspan'] = node.colspan;\n baseProps.colSpan = node.colspan;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLTableCellElement>;\n });\n\n return {\n get gridCellProps() {\n return gridCellProps();\n },\n get isPressed() {\n return isPressed();\n },\n };\n}\n", "/**\n * createTableRowGroup - Provides accessibility for a table row group.\n * Based on @react-aria/grid/useTableRowGroup.\n */\n\nimport { createMemo, type Accessor } from 'solid-js';\nimport type { JSX } from 'solid-js';\nimport type { AriaTableRowGroupProps, TableRowGroupAria } from './types';\n\n/**\n * Creates accessibility props for a table row group (thead, tbody, tfoot).\n */\nexport function createTableRowGroup(\n props: Accessor<AriaTableRowGroupProps>\n): TableRowGroupAria {\n const rowGroupProps = createMemo(() => {\n // Access props for reactivity tracking, even though not currently used\n void props();\n\n const baseProps: Record<string, unknown> = {\n role: 'rowgroup',\n };\n\n return baseProps as JSX.HTMLAttributes<HTMLTableSectionElement>;\n });\n\n return {\n get rowGroupProps() {\n return rowGroupProps();\n },\n };\n}\n", "/**\n * createTableSelectionCheckbox - Provides accessibility for a table row selection checkbox.\n * Based on @react-aria/table/useTableSelectionCheckbox.\n */\n\nimport { createMemo, type Accessor } from 'solid-js';\nimport type { JSX } from 'solid-js';\nimport { createId } from '@proyecto-viviana/solid-stately';\nimport type { TableState, TableCollection } from '@proyecto-viviana/solid-stately';\nimport type { AriaTableSelectionCheckboxProps, TableSelectionCheckboxAria } from './types';\n\n/**\n * Creates accessibility props for a table row selection checkbox.\n */\nexport function createTableSelectionCheckbox<T extends object>(\n props: Accessor<AriaTableSelectionCheckboxProps>,\n state: Accessor<TableState<T, TableCollection<T>>>\n): TableSelectionCheckboxAria {\n const checkboxId = createId();\n\n const isSelected = createMemo(() => {\n const s = state();\n const p = props();\n return s.isSelected(p.key);\n });\n\n const isDisabled = createMemo(() => {\n const s = state();\n const p = props();\n return s.isDisabled(p.key);\n });\n\n const onChange = () => {\n const s = state();\n const p = props();\n if (!isDisabled()) {\n s.toggleSelection(p.key);\n }\n };\n\n const checkboxProps = createMemo(() => {\n const baseProps: Record<string, unknown> = {\n id: checkboxId,\n type: 'checkbox',\n checked: isSelected(),\n disabled: isDisabled(),\n onChange,\n 'aria-label': 'Select',\n };\n\n return baseProps as JSX.InputHTMLAttributes<HTMLInputElement>;\n });\n\n return {\n get checkboxProps() {\n return checkboxProps();\n },\n };\n}\n", "/**\n * createTableSelectAllCheckbox - Provides accessibility for a table select-all checkbox.\n * Based on @react-aria/table/useTableSelectAllCheckbox.\n */\n\nimport { createMemo, type Accessor } from 'solid-js';\nimport type { JSX } from 'solid-js';\nimport type { TableState, TableCollection } from '@proyecto-viviana/solid-stately';\nimport type { TableSelectAllCheckboxAria } from './types';\n\n/**\n * Creates accessibility props for a table select-all checkbox.\n */\nexport function createTableSelectAllCheckbox<T extends object>(\n state: Accessor<TableState<T, TableCollection<T>>>\n): TableSelectAllCheckboxAria {\n const isSelectAll = createMemo(() => {\n const s = state();\n return s.selectedKeys === 'all';\n });\n\n const isEmpty = createMemo(() => {\n const s = state();\n return s.collection.size === 0;\n });\n\n const isIndeterminate = createMemo(() => {\n const s = state();\n const selectedKeys = s.selectedKeys;\n if (selectedKeys === 'all') return false;\n if (selectedKeys.size === 0) return false;\n return selectedKeys.size < s.collection.size;\n });\n\n const isDisabled = createMemo(() => {\n const s = state();\n return s.selectionMode !== 'multiple' || isEmpty();\n });\n\n const onChange = () => {\n const s = state();\n if (!isDisabled()) {\n s.toggleSelectAll();\n }\n };\n\n const checkboxProps = createMemo(() => {\n const s = state();\n\n const baseProps: Record<string, unknown> = {\n type: 'checkbox',\n checked: isSelectAll(),\n disabled: isDisabled(),\n onChange,\n 'aria-label': s.selectionMode === 'single' ? 'Select' : 'Select all',\n };\n\n // Handle indeterminate state\n // Note: indeterminate is not a standard HTML attribute, it must be set via JavaScript\n // The component using this should handle this separately\n if (isIndeterminate()) {\n baseProps['data-indeterminate'] = 'true';\n }\n\n return baseProps as JSX.InputHTMLAttributes<HTMLInputElement>;\n });\n\n return {\n get checkboxProps() {\n return checkboxProps();\n },\n };\n}\n", "/**\n * createGridList - Provides accessibility for a grid list.\n * Based on @react-aria/gridlist/useGridList.\n */\n\nimport { createMemo, type Accessor } from 'solid-js';\nimport type { JSX } from 'solid-js';\nimport { createId } from '@proyecto-viviana/solid-stately';\nimport type { GridState, GridCollection, Key } from '@proyecto-viviana/solid-stately';\nimport type { AriaGridListProps, GridListAria } from './types';\n\n/**\n * Metadata stored for a grid list instance.\n */\ninterface GridListData {\n /** The generated ID for the grid list. */\n gridListId: string;\n /** Actions registered for the grid list. */\n actions: {\n onAction?: (key: Key) => void;\n };\n}\n\n/**\n * WeakMap to store grid list data for child components to access.\n */\nconst gridListDataMap = new WeakMap<object, GridListData>();\n\n/**\n * Gets the grid list data for a given state.\n */\nexport function getGridListData<T extends object, C extends GridCollection<T>>(\n state: GridState<T, C>\n): GridListData | undefined {\n return gridListDataMap.get(state);\n}\n\n/**\n * Creates accessibility props for a grid list.\n */\nexport function createGridList<T extends object, C extends GridCollection<T> = GridCollection<T>>(\n props: Accessor<AriaGridListProps>,\n state: Accessor<GridState<T, C>>,\n _ref: Accessor<HTMLUListElement | null>\n): GridListAria {\n // Generate a unique ID for the grid list\n const gridListId = props().id ?? createId();\n\n // Store grid list data for child components\n const gridListData: GridListData = {\n gridListId,\n actions: {\n get onAction() {\n return props().onAction;\n },\n },\n };\n\n // Store in WeakMap using the state as key\n gridListDataMap.set(state(), gridListData);\n\n // Handle keyboard navigation\n const onKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const p = props();\n const collection = s.collection;\n const focusedKey = s.focusedKey;\n\n if (p.isDisabled) return;\n\n switch (e.key) {\n case 'ArrowDown': {\n e.preventDefault();\n if (focusedKey != null) {\n const nextKey = collection.getKeyAfter(focusedKey);\n if (nextKey != null) {\n s.setFocusedKey(nextKey);\n }\n } else {\n const firstKey = collection.getFirstKey();\n if (firstKey != null) {\n s.setFocusedKey(firstKey);\n }\n }\n break;\n }\n case 'ArrowUp': {\n e.preventDefault();\n if (focusedKey != null) {\n const prevKey = collection.getKeyBefore(focusedKey);\n if (prevKey != null) {\n s.setFocusedKey(prevKey);\n }\n } else {\n const lastKey = collection.getLastKey();\n if (lastKey != null) {\n s.setFocusedKey(lastKey);\n }\n }\n break;\n }\n case 'Home': {\n e.preventDefault();\n const firstKey = collection.getFirstKey();\n if (firstKey != null) {\n s.setFocusedKey(firstKey);\n }\n break;\n }\n case 'End': {\n e.preventDefault();\n const lastKey = collection.getLastKey();\n if (lastKey != null) {\n s.setFocusedKey(lastKey);\n }\n break;\n }\n case 'a':\n case 'A': {\n if ((e.ctrlKey || e.metaKey) && s.selectionMode === 'multiple') {\n e.preventDefault();\n s.selectAll();\n }\n break;\n }\n case 'Escape': {\n if (s.selectionMode !== 'none') {\n e.preventDefault();\n s.clearSelection();\n }\n break;\n }\n }\n };\n\n const onFocus = () => {\n const s = state();\n s.setFocused(true);\n\n // If nothing is focused, focus the first item\n if (s.focusedKey == null) {\n const firstKey = s.collection.getFirstKey();\n if (firstKey != null) {\n s.setFocusedKey(firstKey);\n }\n }\n };\n\n const onBlur = () => {\n const s = state();\n s.setFocused(false);\n };\n\n const gridProps = createMemo(() => {\n const p = props();\n const s = state();\n\n const baseProps: Record<string, unknown> = {\n role: 'grid',\n id: gridListId,\n 'aria-label': p['aria-label'],\n 'aria-labelledby': p['aria-labelledby'],\n 'aria-describedby': p['aria-describedby'],\n 'aria-multiselectable': s.selectionMode === 'multiple' ? true : undefined,\n 'aria-disabled': p.isDisabled || undefined,\n tabIndex: p.isDisabled ? undefined : 0,\n onKeyDown,\n onFocus,\n onBlur,\n };\n\n // Add row count for virtualized lists\n if (p.isVirtualized) {\n baseProps['aria-rowcount'] = s.collection.rowCount;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLUListElement>;\n });\n\n return {\n get gridProps() {\n return gridProps();\n },\n };\n}\n", "/**\n * createGridListItem - Provides accessibility for a grid list item.\n * Based on @react-aria/gridlist/useGridListItem.\n */\n\nimport { createMemo, createSignal, type Accessor } from 'solid-js';\nimport type { JSX } from 'solid-js';\nimport type { GridState, GridCollection } from '@proyecto-viviana/solid-stately';\nimport type { AriaGridListItemProps, GridListItemAria } from './types';\nimport { getGridListData } from './createGridList';\n\n/**\n * Creates accessibility props for a grid list item.\n */\nexport function createGridListItem<T extends object, C extends GridCollection<T> = GridCollection<T>>(\n props: Accessor<AriaGridListItemProps>,\n state: Accessor<GridState<T, C>>,\n _ref: Accessor<HTMLLIElement | null>\n): GridListItemAria {\n const [isPressed, setIsPressed] = createSignal(false);\n\n const isSelected = createMemo(() => {\n const s = state();\n const p = props();\n return s.isSelected(p.node.key);\n });\n\n const isDisabled = createMemo(() => {\n const s = state();\n const p = props();\n return s.isDisabled(p.node.key);\n });\n\n const isFocused = createMemo(() => {\n const s = state();\n const p = props();\n return s.focusedKey === p.node.key;\n });\n\n // Handle click/press for selection and actions\n const onClick = (e: MouseEvent) => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n // Get grid list metadata for actions\n const gridListData = getGridListData(s);\n const onAction = gridListData?.actions.onAction;\n\n // Handle selection\n if (s.selectionMode !== 'none') {\n if (e.shiftKey && s.selectionMode === 'multiple') {\n s.extendSelection(p.node.key);\n } else if (e.ctrlKey || e.metaKey) {\n s.toggleSelection(p.node.key);\n } else {\n // Replace selection or toggle if already selected\n if (isSelected() && s.selectedKeys !== 'all') {\n const selectedKeys = s.selectedKeys as Set<unknown>;\n if (selectedKeys.size === 1) {\n // Single selection, trigger action\n if (onAction) {\n onAction(p.node.key);\n }\n if (p.onAction) {\n p.onAction();\n }\n } else {\n s.replaceSelection(p.node.key);\n }\n } else {\n s.replaceSelection(p.node.key);\n }\n }\n } else {\n // No selection mode, just trigger action\n if (onAction) {\n onAction(p.node.key);\n }\n if (p.onAction) {\n p.onAction();\n }\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n if (e.key === 'Enter') {\n // Get grid list metadata for actions\n const gridListData = getGridListData(s);\n const onAction = gridListData?.actions.onAction;\n\n if (onAction || p.onAction) {\n e.preventDefault();\n\n if (onAction) {\n onAction(p.node.key);\n }\n\n if (p.onAction) {\n p.onAction();\n }\n }\n } else if (e.key === ' ') {\n // Space toggles selection\n if (s.selectionMode !== 'none') {\n e.preventDefault();\n s.toggleSelection(p.node.key);\n }\n }\n };\n\n const onFocus = () => {\n const s = state();\n const p = props();\n s.setFocusedKey(p.node.key);\n };\n\n const onPointerDown = () => {\n setIsPressed(true);\n };\n\n const onPointerUp = () => {\n setIsPressed(false);\n };\n\n const rowProps = createMemo(() => {\n const s = state();\n const p = props();\n const node = p.node;\n\n const baseProps: Record<string, unknown> = {\n role: 'row',\n 'aria-selected': s.selectionMode !== 'none' ? isSelected() : undefined,\n 'aria-disabled': isDisabled() || undefined,\n tabIndex: isFocused() ? 0 : -1,\n onClick,\n onKeyDown,\n onFocus,\n onPointerDown,\n onPointerUp,\n };\n\n // Add aria-rowindex for virtualized lists\n if (p.isVirtualized && node.rowIndex != null) {\n baseProps['aria-rowindex'] = node.rowIndex + 1; // 1-based\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLLIElement>;\n });\n\n const gridCellProps = createMemo(() => {\n return {\n role: 'gridcell',\n } as JSX.HTMLAttributes<HTMLDivElement>;\n });\n\n return {\n get rowProps() {\n return rowProps();\n },\n get gridCellProps() {\n return gridCellProps();\n },\n get isSelected() {\n return isSelected();\n },\n get isDisabled() {\n return isDisabled();\n },\n get isPressed() {\n return isPressed();\n },\n };\n}\n", "/**\n * createGridListSelectionCheckbox - Provides accessibility for a grid list item selection checkbox.\n * Based on @react-aria/gridlist.\n */\n\nimport { createMemo, type Accessor } from 'solid-js';\nimport type { JSX } from 'solid-js';\nimport { createId } from '@proyecto-viviana/solid-stately';\nimport type { GridState, GridCollection } from '@proyecto-viviana/solid-stately';\nimport type { AriaGridListSelectionCheckboxProps, GridListSelectionCheckboxAria } from './types';\n\n/**\n * Creates accessibility props for a grid list item selection checkbox.\n */\nexport function createGridListSelectionCheckbox<T extends object, C extends GridCollection<T> = GridCollection<T>>(\n props: Accessor<AriaGridListSelectionCheckboxProps>,\n state: Accessor<GridState<T, C>>\n): GridListSelectionCheckboxAria {\n const checkboxId = createId();\n\n const isSelected = createMemo(() => {\n const s = state();\n const p = props();\n return s.isSelected(p.key);\n });\n\n const isDisabled = createMemo(() => {\n const s = state();\n const p = props();\n return s.isDisabled(p.key);\n });\n\n const onChange = () => {\n const s = state();\n const p = props();\n if (!isDisabled()) {\n s.toggleSelection(p.key);\n }\n };\n\n const checkboxProps = createMemo(() => {\n const baseProps: Record<string, unknown> = {\n id: checkboxId,\n type: 'checkbox',\n checked: isSelected(),\n disabled: isDisabled(),\n onChange,\n 'aria-label': 'Select',\n };\n\n return baseProps as JSX.InputHTMLAttributes<HTMLInputElement>;\n });\n\n return {\n get checkboxProps() {\n return checkboxProps();\n },\n };\n}\n", "/**\n * createTree - Provides accessibility for a tree component.\n * Based on @react-aria/tree/useTree.\n */\n\nimport { createMemo, type Accessor } from 'solid-js';\nimport type { JSX } from 'solid-js';\nimport { createId } from '@proyecto-viviana/solid-stately';\nimport type { TreeState, TreeCollection, Key } from '@proyecto-viviana/solid-stately';\nimport type { AriaTreeProps, TreeAria } from './types';\n\n/**\n * Metadata stored for a tree instance.\n */\ninterface TreeData {\n /** The generated ID for the tree. */\n treeId: string;\n /** Actions registered for the tree. */\n actions: {\n onAction?: (key: Key) => void;\n };\n}\n\n/**\n * WeakMap to store tree data for child components to access.\n */\nconst treeDataMap = new WeakMap<object, TreeData>();\n\n/**\n * Gets the tree data for a given state.\n */\nexport function getTreeData<T extends object, C extends TreeCollection<T>>(\n state: TreeState<T, C>\n): TreeData | undefined {\n return treeDataMap.get(state);\n}\n\n/**\n * Creates accessibility props for a tree.\n */\nexport function createTree<T extends object, C extends TreeCollection<T> = TreeCollection<T>>(\n props: Accessor<AriaTreeProps>,\n state: Accessor<TreeState<T, C>>,\n _ref: Accessor<HTMLDivElement | null>\n): TreeAria {\n // Generate a unique ID for the tree\n const treeId = props().id ?? createId();\n\n // Store tree data for child components\n const treeData: TreeData = {\n treeId,\n actions: {\n get onAction() {\n return props().onAction;\n },\n },\n };\n\n // Store in WeakMap using the state as key\n treeDataMap.set(state(), treeData);\n\n // Handle keyboard navigation\n const onKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const p = props();\n const collection = s.collection;\n const focusedKey = s.focusedKey;\n\n if (p.isDisabled) return;\n\n switch (e.key) {\n case 'ArrowDown': {\n e.preventDefault();\n if (focusedKey != null) {\n const nextKey = collection.getKeyAfter(focusedKey);\n if (nextKey != null) {\n s.setFocusedKey(nextKey);\n }\n } else {\n const firstKey = collection.getFirstKey();\n if (firstKey != null) {\n s.setFocusedKey(firstKey);\n }\n }\n break;\n }\n case 'ArrowUp': {\n e.preventDefault();\n if (focusedKey != null) {\n const prevKey = collection.getKeyBefore(focusedKey);\n if (prevKey != null) {\n s.setFocusedKey(prevKey);\n }\n } else {\n const lastKey = collection.getLastKey();\n if (lastKey != null) {\n s.setFocusedKey(lastKey);\n }\n }\n break;\n }\n case 'ArrowRight': {\n e.preventDefault();\n if (focusedKey != null) {\n const node = collection.getItem(focusedKey);\n if (node?.isExpandable) {\n if (!s.isExpanded(focusedKey)) {\n // Expand the node\n s.expandKey(focusedKey);\n } else {\n // Move to first child\n const children = [...collection.getChildren(focusedKey)];\n if (children.length > 0) {\n s.setFocusedKey(children[0].key);\n }\n }\n }\n }\n break;\n }\n case 'ArrowLeft': {\n e.preventDefault();\n if (focusedKey != null) {\n const node = collection.getItem(focusedKey);\n if (node?.isExpandable && s.isExpanded(focusedKey)) {\n // Collapse the node\n s.collapseKey(focusedKey);\n } else if (node?.parentKey != null) {\n // Move to parent\n s.setFocusedKey(node.parentKey);\n }\n }\n break;\n }\n case 'Home': {\n e.preventDefault();\n const firstKey = collection.getFirstKey();\n if (firstKey != null) {\n s.setFocusedKey(firstKey);\n }\n break;\n }\n case 'End': {\n e.preventDefault();\n const lastKey = collection.getLastKey();\n if (lastKey != null) {\n s.setFocusedKey(lastKey);\n }\n break;\n }\n case 'a':\n case 'A': {\n if ((e.ctrlKey || e.metaKey) && s.selectionMode === 'multiple') {\n e.preventDefault();\n s.selectAll();\n }\n break;\n }\n case 'Escape': {\n if (s.selectionMode !== 'none') {\n e.preventDefault();\n s.clearSelection();\n }\n break;\n }\n case '*': {\n // Expand all siblings at current level\n e.preventDefault();\n if (focusedKey != null) {\n const node = collection.getItem(focusedKey);\n if (node) {\n // Find all siblings at the same level\n const parentKey = node.parentKey;\n let siblings: Key[];\n if (parentKey != null) {\n siblings = [...collection.getChildren(parentKey)].map((n) => n.key);\n } else {\n // Root level siblings\n siblings = collection.rows\n .filter((n) => n.level === 0)\n .map((n) => n.key);\n }\n // Expand all expandable siblings\n for (const siblingKey of siblings) {\n const sibling = collection.getItem(siblingKey);\n if (sibling?.isExpandable && !s.isExpanded(siblingKey)) {\n s.expandKey(siblingKey);\n }\n }\n }\n }\n break;\n }\n }\n };\n\n const onFocus = () => {\n const s = state();\n s.setFocused(true);\n\n // If nothing is focused, focus the first item\n if (s.focusedKey == null) {\n const firstKey = s.collection.getFirstKey();\n if (firstKey != null) {\n s.setFocusedKey(firstKey);\n }\n }\n };\n\n const onBlur = () => {\n const s = state();\n s.setFocused(false);\n };\n\n const treeProps = createMemo(() => {\n const p = props();\n const s = state();\n\n const baseProps: Record<string, unknown> = {\n role: 'treegrid',\n id: treeId,\n 'aria-label': p['aria-label'],\n 'aria-labelledby': p['aria-labelledby'],\n 'aria-describedby': p['aria-describedby'],\n 'aria-multiselectable': s.selectionMode === 'multiple' ? true : undefined,\n 'aria-disabled': p.isDisabled || undefined,\n tabIndex: p.isDisabled ? undefined : 0,\n onKeyDown,\n onFocus,\n onBlur,\n };\n\n // Add row count for virtualized trees\n if (p.isVirtualized) {\n baseProps['aria-rowcount'] = s.collection.rowCount;\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLDivElement>;\n });\n\n return {\n get treeProps() {\n return treeProps();\n },\n };\n}\n", "/**\n * createTreeItem - Provides accessibility for a tree item.\n * Based on @react-aria/tree/useTreeItem.\n */\n\nimport { createMemo, createSignal, type Accessor } from 'solid-js';\nimport type { JSX } from 'solid-js';\nimport type { TreeState, TreeCollection } from '@proyecto-viviana/solid-stately';\nimport type { AriaTreeItemProps, TreeItemAria } from './types';\nimport { getTreeData } from './createTree';\n\n/**\n * Creates accessibility props for a tree item.\n */\nexport function createTreeItem<T extends object, C extends TreeCollection<T> = TreeCollection<T>>(\n props: Accessor<AriaTreeItemProps<T>>,\n state: Accessor<TreeState<T, C>>,\n _ref: Accessor<HTMLDivElement | null>\n): TreeItemAria {\n const [isPressed, setIsPressed] = createSignal(false);\n\n const isSelected = createMemo(() => {\n const s = state();\n const p = props();\n return s.isSelected(p.node.key);\n });\n\n const isDisabled = createMemo(() => {\n const s = state();\n const p = props();\n return s.isDisabled(p.node.key);\n });\n\n const isFocused = createMemo(() => {\n const s = state();\n const p = props();\n return s.focusedKey === p.node.key;\n });\n\n const isExpanded = createMemo(() => {\n const s = state();\n const p = props();\n return s.isExpanded(p.node.key);\n });\n\n const isExpandable = createMemo(() => {\n const p = props();\n return p.node.isExpandable ?? false;\n });\n\n const level = createMemo(() => {\n const p = props();\n return p.node.level;\n });\n\n // Handle click/press for selection and actions\n const onClick = (e: MouseEvent) => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n // Get tree metadata for actions\n const treeData = getTreeData(s);\n const onAction = treeData?.actions.onAction;\n\n // Handle selection\n if (s.selectionMode !== 'none') {\n if (e.shiftKey && s.selectionMode === 'multiple') {\n s.extendSelection(p.node.key);\n } else if (e.ctrlKey || e.metaKey) {\n s.toggleSelection(p.node.key);\n } else {\n // Replace selection or toggle if already selected\n if (isSelected() && s.selectedKeys !== 'all') {\n const selectedKeys = s.selectedKeys as Set<unknown>;\n if (selectedKeys.size === 1) {\n // Single selection, trigger action\n if (onAction) {\n onAction(p.node.key);\n }\n if (p.onAction) {\n p.onAction();\n }\n } else {\n s.replaceSelection(p.node.key);\n }\n } else {\n s.replaceSelection(p.node.key);\n }\n }\n } else {\n // No selection mode, just trigger action\n if (onAction) {\n onAction(p.node.key);\n }\n if (p.onAction) {\n p.onAction();\n }\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n if (e.key === 'Enter') {\n // Get tree metadata for actions\n const treeData = getTreeData(s);\n const onAction = treeData?.actions.onAction;\n\n if (onAction || p.onAction) {\n e.preventDefault();\n\n if (onAction) {\n onAction(p.node.key);\n }\n\n if (p.onAction) {\n p.onAction();\n }\n }\n } else if (e.key === ' ') {\n // Space toggles selection\n if (s.selectionMode !== 'none') {\n e.preventDefault();\n s.toggleSelection(p.node.key);\n }\n }\n };\n\n const onFocus = () => {\n const s = state();\n const p = props();\n s.setFocusedKey(p.node.key);\n };\n\n const onPointerDown = () => {\n setIsPressed(true);\n };\n\n const onPointerUp = () => {\n setIsPressed(false);\n };\n\n const rowProps = createMemo(() => {\n const s = state();\n const p = props();\n const node = p.node;\n\n const baseProps: Record<string, unknown> = {\n role: 'row',\n 'aria-selected': s.selectionMode !== 'none' ? isSelected() : undefined,\n 'aria-disabled': isDisabled() || undefined,\n 'aria-expanded': isExpandable() ? isExpanded() : undefined,\n 'aria-level': node.level + 1, // 1-based for ARIA\n tabIndex: isFocused() ? 0 : -1,\n onClick,\n onKeyDown,\n onFocus,\n onPointerDown,\n onPointerUp,\n };\n\n // Add aria-rowindex for virtualized trees\n if (p.isVirtualized && node.rowIndex != null) {\n baseProps['aria-rowindex'] = node.rowIndex + 1; // 1-based\n }\n\n return baseProps as JSX.HTMLAttributes<HTMLDivElement>;\n });\n\n const gridCellProps = createMemo(() => {\n return {\n role: 'gridcell',\n } as JSX.HTMLAttributes<HTMLDivElement>;\n });\n\n // Expand button handler\n const onExpandClick = (e: MouseEvent) => {\n e.stopPropagation(); // Don't trigger row click\n const s = state();\n const p = props();\n\n if (isDisabled()) return;\n\n s.toggleKey(p.node.key);\n };\n\n const expandButtonProps = createMemo(() => {\n const baseProps: Record<string, unknown> = {\n type: 'button',\n 'aria-label': isExpanded() ? 'Collapse' : 'Expand',\n onClick: onExpandClick,\n tabIndex: -1, // Not in tab order, use arrow keys\n 'aria-hidden': !isExpandable() ? true : undefined,\n };\n\n return baseProps as JSX.ButtonHTMLAttributes<HTMLButtonElement>;\n });\n\n return {\n get rowProps() {\n return rowProps();\n },\n get gridCellProps() {\n return gridCellProps();\n },\n get expandButtonProps() {\n return expandButtonProps();\n },\n get isSelected() {\n return isSelected();\n },\n get isDisabled() {\n return isDisabled();\n },\n get isPressed() {\n return isPressed();\n },\n get isExpanded() {\n return isExpanded();\n },\n get isExpandable() {\n return isExpandable();\n },\n get level() {\n return level();\n },\n };\n}\n", "/**\n * createTreeSelectionCheckbox - Provides accessibility for a tree item's selection checkbox.\n * Based on @react-aria/gridlist/useGridListSelectionCheckbox.\n */\n\nimport { createMemo, type Accessor } from 'solid-js';\nimport type { JSX } from 'solid-js';\nimport type { TreeState, TreeCollection } from '@proyecto-viviana/solid-stately';\nimport type { AriaTreeSelectionCheckboxProps, TreeSelectionCheckboxAria } from './types';\n\n/**\n * Creates accessibility props for a tree selection checkbox.\n */\nexport function createTreeSelectionCheckbox<T extends object, C extends TreeCollection<T> = TreeCollection<T>>(\n props: Accessor<AriaTreeSelectionCheckboxProps>,\n state: Accessor<TreeState<T, C>>\n): TreeSelectionCheckboxAria {\n const isSelected = createMemo(() => {\n const s = state();\n const p = props();\n return s.isSelected(p.key);\n });\n\n const isDisabled = createMemo(() => {\n const s = state();\n const p = props();\n return s.isDisabled(p.key);\n });\n\n const onChange = (e: Event) => {\n const s = state();\n const p = props();\n const target = e.target as HTMLInputElement;\n\n if (isDisabled()) return;\n\n if (target.checked) {\n s.toggleSelection(p.key);\n } else {\n s.toggleSelection(p.key);\n }\n };\n\n const onClick = (e: MouseEvent) => {\n // Stop propagation to prevent row click from also firing\n e.stopPropagation();\n };\n\n const checkboxProps = createMemo(() => {\n const baseProps: Record<string, unknown> = {\n type: 'checkbox',\n 'aria-label': 'Select',\n checked: isSelected(),\n disabled: isDisabled(),\n onChange,\n onClick,\n tabIndex: -1, // Use arrow keys to navigate, not tab\n };\n\n return baseProps as JSX.InputHTMLAttributes<HTMLInputElement>;\n });\n\n return {\n get checkboxProps() {\n return checkboxProps();\n },\n };\n}\n", "/**\n * createColorSlider hook.\n *\n * Provides ARIA attributes and keyboard handling for a color slider.\n */\n\nimport { createMemo, type Accessor } from 'solid-js';\nimport type { ColorSliderState } from '@proyecto-viviana/solid-stately';\nimport { createId } from '../ssr';\nimport type { AriaColorSliderOptions, ColorSliderAria } from './types';\n\n/**\n * Creates ARIA props for a color slider.\n */\nexport function createColorSlider(\n props: Accessor<AriaColorSliderOptions>,\n state: Accessor<ColorSliderState>,\n trackRef: Accessor<HTMLDivElement | null>\n): ColorSliderAria {\n const getProps = () => props();\n const getState = () => state();\n\n // Generate IDs\n const inputId = createId();\n const labelId = createId();\n\n // Get channel name for ARIA label\n const channelName = createMemo(() => {\n const p = getProps();\n if (p.channelName) return p.channelName;\n const s = getState();\n return s.value.getChannelName(s.channel, 'en-US');\n });\n\n // Handle track click\n const onTrackMouseDown = (e: MouseEvent) => {\n if (getProps().isDisabled || getState().isDisabled) return;\n\n const track = trackRef();\n if (!track) return;\n\n const rect = track.getBoundingClientRect();\n const percent = (e.clientX - rect.left) / rect.width;\n getState().setThumbPercent(Math.max(0, Math.min(1, percent)));\n getState().setDragging(true);\n };\n\n // Handle keyboard\n const onKeyDown = (e: KeyboardEvent) => {\n if (getProps().isDisabled || getState().isDisabled) return;\n\n const s = getState();\n let handled = true;\n\n switch (e.key) {\n case 'ArrowRight':\n case 'ArrowUp':\n s.incrementThumb();\n break;\n case 'ArrowLeft':\n case 'ArrowDown':\n s.decrementThumb();\n break;\n case 'PageUp':\n s.incrementThumb(s.pageSize);\n break;\n case 'PageDown':\n s.decrementThumb(s.pageSize);\n break;\n case 'Home':\n s.setThumbValue(s.minValue);\n break;\n case 'End':\n s.setThumbValue(s.maxValue);\n break;\n default:\n handled = false;\n }\n\n if (handled) {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n\n // Track props\n const trackProps = createMemo(() => {\n const s = getState();\n return {\n role: 'presentation' as const,\n onMouseDown: onTrackMouseDown,\n style: {\n position: 'relative' as const,\n 'touch-action': 'none',\n },\n 'data-disabled': s.isDisabled || undefined,\n };\n });\n\n // Thumb props\n const thumbProps = createMemo(() => {\n const s = getState();\n const p = getProps();\n const percent = s.getThumbPercent();\n\n return {\n role: 'presentation' as const,\n style: {\n position: 'absolute' as const,\n left: `${percent * 100}%`,\n top: '50%',\n transform: 'translate(-50%, -50%)',\n 'touch-action': 'none',\n },\n 'data-dragging': s.isDragging || undefined,\n 'data-disabled': s.isDisabled || p.isDisabled || undefined,\n };\n });\n\n // Input props (hidden, for accessibility)\n const inputProps = createMemo(() => {\n const s = getState();\n const p = getProps();\n\n return {\n type: 'range',\n id: inputId,\n min: s.minValue,\n max: s.maxValue,\n step: s.step,\n value: s.getThumbValue(),\n disabled: s.isDisabled || p.isDisabled,\n 'aria-label': p['aria-label'] ?? channelName(),\n 'aria-labelledby': p['aria-labelledby'],\n 'aria-describedby': p['aria-describedby'],\n 'aria-valuetext': s.getThumbValueLabel(),\n onKeyDown,\n onChange: (e: Event) => {\n const target = e.target as HTMLInputElement;\n s.setThumbValue(parseFloat(target.value));\n },\n onFocus: () => {\n // Focus handling\n },\n onBlur: () => {\n if (s.isDragging) {\n s.setDragging(false);\n }\n },\n style: {\n position: 'absolute' as const,\n width: '1px',\n height: '1px',\n padding: '0',\n margin: '-1px',\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n 'white-space': 'nowrap',\n border: '0',\n },\n };\n });\n\n // Output props\n const outputProps = createMemo(() => {\n return {\n 'aria-live': 'off' as const,\n for: inputId,\n };\n });\n\n // Label props\n const labelProps = createMemo(() => {\n return {\n id: labelId,\n for: inputId,\n };\n });\n\n return {\n get trackProps() {\n return trackProps();\n },\n get thumbProps() {\n return thumbProps();\n },\n get inputProps() {\n return inputProps();\n },\n get outputProps() {\n return outputProps();\n },\n get labelProps() {\n return labelProps();\n },\n };\n}\n", "/**\n * createColorArea hook.\n *\n * Provides ARIA attributes and keyboard/pointer handling for a 2D color area.\n */\n\nimport { createMemo, type Accessor } from 'solid-js';\nimport type { ColorAreaState } from '@proyecto-viviana/solid-stately';\nimport { createId } from '../ssr';\nimport type { AriaColorAreaOptions, ColorAreaAria } from './types';\n\n/**\n * Creates ARIA props for a color area.\n */\nexport function createColorArea(\n props: Accessor<AriaColorAreaOptions>,\n state: Accessor<ColorAreaState>,\n areaRef: Accessor<HTMLDivElement | null>\n): ColorAreaAria {\n const getProps = () => props();\n const getState = () => state();\n\n // Generate IDs\n const xInputId = createId();\n const yInputId = createId();\n\n // Calculate position from pointer event\n const getPositionFromEvent = (e: MouseEvent | PointerEvent) => {\n const area = areaRef();\n if (!area) return null;\n\n const rect = area.getBoundingClientRect();\n const x = Math.max(0, Math.min(1, (e.clientX - rect.left) / rect.width));\n const y = Math.max(0, Math.min(1, (e.clientY - rect.top) / rect.height));\n\n return { x, y };\n };\n\n // Handle pointer down\n const onPointerDown = (e: PointerEvent) => {\n if (getProps().isDisabled || getState().isDisabled) return;\n\n const pos = getPositionFromEvent(e);\n if (!pos) return;\n\n getState().setColorFromPoint(pos.x, pos.y);\n getState().setDragging(true);\n\n // Capture pointer for dragging\n (e.target as HTMLElement).setPointerCapture?.(e.pointerId);\n };\n\n // Handle pointer move\n const onPointerMove = (e: PointerEvent) => {\n if (!getState().isDragging) return;\n\n const pos = getPositionFromEvent(e);\n if (!pos) return;\n\n getState().setColorFromPoint(pos.x, pos.y);\n };\n\n // Handle pointer up\n const onPointerUp = (e: PointerEvent) => {\n if (getState().isDragging) {\n getState().setDragging(false);\n (e.target as HTMLElement).releasePointerCapture?.(e.pointerId);\n }\n };\n\n // Handle keyboard for X axis\n const onKeyDownX = (e: KeyboardEvent) => {\n if (getProps().isDisabled || getState().isDisabled) return;\n\n const s = getState();\n let handled = true;\n\n switch (e.key) {\n case 'ArrowRight':\n s.incrementX();\n break;\n case 'ArrowLeft':\n s.decrementX();\n break;\n case 'ArrowUp':\n s.incrementY();\n break;\n case 'ArrowDown':\n s.decrementY();\n break;\n case 'PageUp':\n s.incrementY(s.yChannelPageStep);\n break;\n case 'PageDown':\n s.decrementY(s.yChannelPageStep);\n break;\n case 'Home':\n if (e.ctrlKey) {\n s.setXValue(0);\n s.setYValue(100);\n } else {\n s.setXValue(0);\n }\n break;\n case 'End':\n if (e.ctrlKey) {\n s.setXValue(100);\n s.setYValue(0);\n } else {\n s.setXValue(100);\n }\n break;\n default:\n handled = false;\n }\n\n if (handled) {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n\n // Handle keyboard for Y axis\n const onKeyDownY = (e: KeyboardEvent) => {\n if (getProps().isDisabled || getState().isDisabled) return;\n\n const s = getState();\n let handled = true;\n\n switch (e.key) {\n case 'ArrowUp':\n s.incrementY();\n break;\n case 'ArrowDown':\n s.decrementY();\n break;\n case 'ArrowRight':\n s.incrementX();\n break;\n case 'ArrowLeft':\n s.decrementX();\n break;\n case 'PageUp':\n s.incrementY(s.yChannelPageStep);\n break;\n case 'PageDown':\n s.decrementY(s.yChannelPageStep);\n break;\n case 'Home':\n s.setYValue(100);\n break;\n case 'End':\n s.setYValue(0);\n break;\n default:\n handled = false;\n }\n\n if (handled) {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n\n // Color area props\n const colorAreaProps = createMemo(() => {\n const s = getState();\n const p = getProps();\n\n return {\n role: 'group' as const,\n 'aria-label': p['aria-label'],\n 'aria-labelledby': p['aria-labelledby'],\n 'aria-describedby': p['aria-describedby'],\n 'aria-disabled': s.isDisabled || p.isDisabled || undefined,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n style: {\n position: 'relative' as const,\n 'touch-action': 'none',\n },\n 'data-disabled': s.isDisabled || p.isDisabled || undefined,\n };\n });\n\n // Gradient props (the visual area)\n const gradientProps = createMemo(() => {\n return {\n role: 'presentation' as const,\n style: {\n width: '100%',\n height: '100%',\n },\n };\n });\n\n // Thumb props\n const thumbProps = createMemo(() => {\n const s = getState();\n const p = getProps();\n const pos = s.getThumbPosition();\n\n return {\n role: 'presentation' as const,\n style: {\n position: 'absolute' as const,\n left: `${pos.x * 100}%`,\n top: `${pos.y * 100}%`,\n transform: 'translate(-50%, -50%)',\n 'touch-action': 'none',\n },\n 'data-dragging': s.isDragging || undefined,\n 'data-disabled': s.isDisabled || p.isDisabled || undefined,\n };\n });\n\n // X input props (hidden, for accessibility)\n const xInputProps = createMemo(() => {\n const s = getState();\n const p = getProps();\n const xRange = s.value.getChannelRange(s.xChannel);\n const xName = s.value.getChannelName(s.xChannel, 'en-US');\n\n return {\n type: 'range',\n id: xInputId,\n 'aria-label': `${xName}`,\n 'aria-valuetext': `${xName}: ${s.getXValue()}`,\n min: xRange.minValue,\n max: xRange.maxValue,\n step: xRange.step,\n value: s.getXValue(),\n disabled: s.isDisabled || p.isDisabled,\n onKeyDown: onKeyDownX,\n onChange: (e: Event) => {\n const target = e.target as HTMLInputElement;\n s.setXValue(parseFloat(target.value));\n },\n onBlur: () => {\n if (s.isDragging) {\n s.setDragging(false);\n }\n },\n tabIndex: 0,\n style: {\n position: 'absolute' as const,\n width: '1px',\n height: '1px',\n padding: '0',\n margin: '-1px',\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n 'white-space': 'nowrap',\n border: '0',\n },\n };\n });\n\n // Y input props (hidden, for accessibility)\n const yInputProps = createMemo(() => {\n const s = getState();\n const p = getProps();\n const yRange = s.value.getChannelRange(s.yChannel);\n const yName = s.value.getChannelName(s.yChannel, 'en-US');\n\n return {\n type: 'range',\n id: yInputId,\n 'aria-label': `${yName}`,\n 'aria-valuetext': `${yName}: ${s.getYValue()}`,\n min: yRange.minValue,\n max: yRange.maxValue,\n step: yRange.step,\n value: s.getYValue(),\n disabled: s.isDisabled || p.isDisabled,\n onKeyDown: onKeyDownY,\n onChange: (e: Event) => {\n const target = e.target as HTMLInputElement;\n s.setYValue(parseFloat(target.value));\n },\n tabIndex: -1, // Only first input is in tab order\n style: {\n position: 'absolute' as const,\n width: '1px',\n height: '1px',\n padding: '0',\n margin: '-1px',\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n 'white-space': 'nowrap',\n border: '0',\n },\n };\n });\n\n return {\n get colorAreaProps() {\n return colorAreaProps();\n },\n get gradientProps() {\n return gradientProps();\n },\n get thumbProps() {\n return thumbProps();\n },\n get xInputProps() {\n return xInputProps();\n },\n get yInputProps() {\n return yInputProps();\n },\n };\n}\n", "/**\n * createColorWheel hook.\n *\n * Provides ARIA attributes and keyboard/pointer handling for a circular hue selector.\n */\n\nimport { createMemo, type Accessor } from 'solid-js';\nimport type { ColorWheelState } from '@proyecto-viviana/solid-stately';\nimport { createId } from '../ssr';\nimport type { AriaColorWheelOptions, ColorWheelAria } from './types';\n\n/**\n * Creates ARIA props for a color wheel.\n */\nexport function createColorWheel(\n props: Accessor<AriaColorWheelOptions>,\n state: Accessor<ColorWheelState>,\n wheelRef: Accessor<HTMLDivElement | null>\n): ColorWheelAria {\n const getProps = () => props();\n const getState = () => state();\n\n // Generate IDs\n const inputId = createId();\n\n // Calculate angle from pointer position\n const getAngleFromEvent = (e: MouseEvent | PointerEvent) => {\n const wheel = wheelRef();\n if (!wheel) return null;\n\n const rect = wheel.getBoundingClientRect();\n const centerX = rect.left + rect.width / 2;\n const centerY = rect.top + rect.height / 2;\n\n const dx = e.clientX - centerX;\n const dy = e.clientY - centerY;\n\n return Math.atan2(-dy, dx); // Negative dy because Y is inverted in screen coords\n };\n\n // Handle pointer down\n const onPointerDown = (e: PointerEvent) => {\n if (getProps().isDisabled || getState().isDisabled) return;\n\n const angle = getAngleFromEvent(e);\n if (angle === null) return;\n\n getState().setHueFromAngle(angle);\n getState().setDragging(true);\n\n (e.target as HTMLElement).setPointerCapture?.(e.pointerId);\n };\n\n // Handle pointer move\n const onPointerMove = (e: PointerEvent) => {\n if (!getState().isDragging) return;\n\n const angle = getAngleFromEvent(e);\n if (angle === null) return;\n\n getState().setHueFromAngle(angle);\n };\n\n // Handle pointer up\n const onPointerUp = (e: PointerEvent) => {\n if (getState().isDragging) {\n getState().setDragging(false);\n (e.target as HTMLElement).releasePointerCapture?.(e.pointerId);\n }\n };\n\n // Handle keyboard\n const onKeyDown = (e: KeyboardEvent) => {\n if (getProps().isDisabled || getState().isDisabled) return;\n\n const s = getState();\n let handled = true;\n\n switch (e.key) {\n case 'ArrowRight':\n case 'ArrowUp':\n s.increment();\n break;\n case 'ArrowLeft':\n case 'ArrowDown':\n s.decrement();\n break;\n case 'PageUp':\n s.increment(s.pageStep);\n break;\n case 'PageDown':\n s.decrement(s.pageStep);\n break;\n case 'Home':\n s.setHue(0);\n break;\n case 'End':\n s.setHue(359);\n break;\n default:\n handled = false;\n }\n\n if (handled) {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n\n // Track props (the wheel container)\n const trackProps = createMemo(() => {\n const s = getState();\n const p = getProps();\n\n return {\n role: 'presentation' as const,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n style: {\n position: 'relative' as const,\n 'touch-action': 'none',\n },\n 'data-disabled': s.isDisabled || p.isDisabled || undefined,\n };\n });\n\n // Thumb props\n const thumbProps = createMemo(() => {\n const s = getState();\n const p = getProps();\n const angle = s.getThumbAngle();\n\n // Calculate thumb position on the wheel edge\n // Assumes wheel is circular and thumb is at the outer edge\n // Angle 0 = right (3 o'clock)\n const thumbX = Math.cos(angle);\n const thumbY = -Math.sin(angle); // Negative because CSS Y is inverted\n\n return {\n role: 'presentation' as const,\n style: {\n position: 'absolute' as const,\n // Position relative to center, scaled to radius\n // These will be overridden by the component with actual radius\n left: `calc(50% + ${thumbX * 50}%)`,\n top: `calc(50% + ${thumbY * 50}%)`,\n transform: 'translate(-50%, -50%)',\n 'touch-action': 'none',\n },\n 'data-dragging': s.isDragging || undefined,\n 'data-disabled': s.isDisabled || p.isDisabled || undefined,\n };\n });\n\n // Input props (hidden, for accessibility)\n const inputProps = createMemo(() => {\n const s = getState();\n const p = getProps();\n\n return {\n type: 'range',\n id: inputId,\n min: 0,\n max: 360,\n step: s.step,\n value: s.getHue(),\n disabled: s.isDisabled || p.isDisabled,\n 'aria-label': p['aria-label'] ?? 'Hue',\n 'aria-labelledby': p['aria-labelledby'],\n 'aria-describedby': p['aria-describedby'],\n 'aria-valuetext': `${s.getHue()}\u00B0`,\n onKeyDown,\n onChange: (e: Event) => {\n const target = e.target as HTMLInputElement;\n s.setHue(parseFloat(target.value));\n },\n onBlur: () => {\n if (s.isDragging) {\n s.setDragging(false);\n }\n },\n style: {\n position: 'absolute' as const,\n width: '1px',\n height: '1px',\n padding: '0',\n margin: '-1px',\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n 'white-space': 'nowrap',\n border: '0',\n },\n };\n });\n\n return {\n get trackProps() {\n return trackProps();\n },\n get thumbProps() {\n return thumbProps();\n },\n get inputProps() {\n return inputProps();\n },\n };\n}\n", "/**\n * createColorField hook.\n *\n * Provides ARIA attributes and keyboard handling for a color input field.\n */\n\nimport { createMemo, type Accessor } from 'solid-js';\nimport type { ColorFieldState } from '@proyecto-viviana/solid-stately';\nimport { createId } from '../ssr';\nimport type { AriaColorFieldOptions, ColorFieldAria } from './types';\n\n/**\n * Creates ARIA props for a color field.\n */\nexport function createColorField(\n props: Accessor<AriaColorFieldOptions>,\n state: Accessor<ColorFieldState>,\n _inputRef: Accessor<HTMLInputElement | null>\n): ColorFieldAria {\n const getProps = () => props();\n const getState = () => state();\n\n // Generate IDs\n const inputId = createId();\n const labelId = createId();\n\n // Handle keyboard\n const onKeyDown = (e: KeyboardEvent) => {\n const s = getState();\n const p = getProps();\n\n if (p.isDisabled || s.isDisabled || p.isReadOnly || s.isReadOnly) return;\n\n // Only handle special keys for channel mode\n if (!s.channel) return;\n\n let handled = true;\n\n switch (e.key) {\n case 'ArrowUp':\n s.increment();\n break;\n case 'ArrowDown':\n s.decrement();\n break;\n case 'PageUp':\n s.incrementToMax();\n break;\n case 'PageDown':\n s.decrementToMin();\n break;\n case 'Home':\n if (e.ctrlKey) {\n s.decrementToMin();\n } else {\n handled = false;\n }\n break;\n case 'End':\n if (e.ctrlKey) {\n s.incrementToMax();\n } else {\n handled = false;\n }\n break;\n default:\n handled = false;\n }\n\n if (handled) {\n e.preventDefault();\n }\n };\n\n // Label props\n const labelProps = createMemo(() => {\n return {\n id: labelId,\n for: inputId,\n };\n });\n\n // Input props\n const inputProps = createMemo(() => {\n const s = getState();\n const p = getProps();\n\n // Get channel name if in channel mode\n const channelLabel = s.channel && s.value\n ? s.value.getChannelName(s.channel, 'en-US')\n : undefined;\n\n return {\n id: inputId,\n type: 'text',\n value: s.inputValue,\n disabled: p.isDisabled || s.isDisabled,\n readOnly: p.isReadOnly || s.isReadOnly,\n 'aria-label': p['aria-label'] ?? channelLabel,\n 'aria-labelledby': p['aria-labelledby'],\n 'aria-describedby': p['aria-describedby'],\n 'aria-invalid': s.isInvalid || undefined,\n // For spinbutton role in channel mode\n role: s.channel ? ('spinbutton' as const) : undefined,\n 'aria-valuenow': s.channel && s.value\n ? s.value.getChannelValue(s.channel)\n : undefined,\n 'aria-valuemin': s.channel && s.value\n ? s.value.getChannelRange(s.channel).minValue\n : undefined,\n 'aria-valuemax': s.channel && s.value\n ? s.value.getChannelRange(s.channel).maxValue\n : undefined,\n onInput: (e: InputEvent) => {\n const target = e.target as HTMLInputElement;\n s.setInputValue(target.value);\n },\n onChange: () => {\n // onChange fires on blur or enter\n s.commit();\n },\n onBlur: () => {\n s.commit();\n },\n onKeyDown,\n };\n });\n\n return {\n get labelProps() {\n return labelProps();\n },\n get inputProps() {\n return inputProps();\n },\n };\n}\n", "/**\n * createColorSwatch hook.\n *\n * Provides ARIA attributes for a color swatch display.\n */\n\nimport { createMemo, type Accessor } from 'solid-js';\nimport { normalizeColor } from '@proyecto-viviana/solid-stately';\nimport type { AriaColorSwatchOptions, ColorSwatchAria } from './types';\n\n/**\n * Creates ARIA props for a color swatch.\n */\nexport function createColorSwatch(\n props: Accessor<AriaColorSwatchOptions>\n): ColorSwatchAria {\n const getProps = () => props();\n\n // Swatch props\n const swatchProps = createMemo(() => {\n const p = getProps();\n const color = normalizeColor(p.color);\n const colorName = color.getColorName('en-US');\n\n return {\n role: 'img' as const,\n 'aria-label': p['aria-label'] ?? colorName,\n 'aria-roledescription': 'color swatch',\n style: {\n 'background-color': color.toString('css'),\n },\n };\n });\n\n return {\n get swatchProps() {\n return swatchProps();\n },\n };\n}\n", "/**\n * createDrag - ARIA hook for drag operations.\n *\n * Provides accessibility props for draggable elements with support for\n * mouse, touch, and keyboard interactions.\n */\n\nimport { createMemo, type Accessor } from 'solid-js';\nimport { createDragState } from '@proyecto-viviana/solid-stately';\nimport type { AriaDragOptions, DragAria } from './types';\nimport {\n writeToDataTransfer,\n DROP_OPERATION,\n EFFECT_ALLOWED,\n DROP_EFFECT_TO_DROP_OPERATION,\n setGlobalAllowedDropOperations,\n setGlobalDropEffect,\n getGlobalDropEffect,\n} from './utils';\n\n/**\n * Creates ARIA props for a draggable element.\n *\n * @param props - Accessor returning drag options\n * @returns Drag ARIA props and state\n */\nexport function createDrag(props: Accessor<AriaDragOptions>): DragAria {\n const getProps = createMemo(() => props());\n\n // Create drag state\n const state = createDragState(() => ({\n getItems: getProps().getItems,\n getAllowedDropOperations: getProps().getAllowedDropOperations,\n onDragStart: getProps().onDragStart,\n onDragMove: getProps().onDragMove,\n onDragEnd: getProps().onDragEnd,\n isDisabled: getProps().isDisabled,\n hasDragButton: getProps().hasDragButton,\n preview: getProps().preview,\n }));\n\n // Track position for drag move\n let lastX = 0;\n let lastY = 0;\n\n const onDragStart = (e: DragEvent) => {\n if (e.defaultPrevented) return;\n e.stopPropagation();\n\n const p = getProps();\n\n // Call state handler\n state.startDrag(e.clientX, e.clientY);\n\n // Get items and write to data transfer\n const items = state.getItems();\n e.dataTransfer?.clearData?.();\n if (e.dataTransfer) {\n writeToDataTransfer(e.dataTransfer, items);\n }\n\n // Set allowed drop operations\n let allowed = DROP_OPERATION.all;\n const allowedOps = state.getAllowedDropOperations();\n if (allowedOps.length > 0) {\n allowed = DROP_OPERATION.none;\n for (const op of allowedOps) {\n allowed |= DROP_OPERATION[op] || DROP_OPERATION.none;\n }\n }\n\n setGlobalAllowedDropOperations(allowed);\n const effectAllowed = EFFECT_ALLOWED[allowed] || 'none';\n if (e.dataTransfer) {\n e.dataTransfer.effectAllowed =\n (effectAllowed === 'cancel' ? 'none' : effectAllowed) as DataTransfer['effectAllowed'];\n }\n\n // Handle custom preview\n if (typeof p.preview?.current === 'function' && e.dataTransfer) {\n p.preview.current(items, (node, userX, userY) => {\n if (!node || !e.dataTransfer) return;\n\n const size = node.getBoundingClientRect();\n const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n let defaultX = e.clientX - rect.x;\n let defaultY = e.clientY - rect.y;\n\n if (defaultX > size.width || defaultY > size.height) {\n defaultX = size.width / 2;\n defaultY = size.height / 2;\n }\n\n let offsetX = typeof userX === 'number' ? userX : defaultX;\n let offsetY = typeof userY === 'number' ? userY : defaultY;\n\n offsetX = Math.max(0, Math.min(offsetX, size.width));\n offsetY = Math.max(0, Math.min(offsetY, size.height));\n\n e.dataTransfer.setDragImage(node, offsetX, offsetY);\n });\n }\n\n lastX = e.clientX;\n lastY = e.clientY;\n };\n\n const onDrag = (e: DragEvent) => {\n e.stopPropagation();\n\n if (e.clientX === lastX && e.clientY === lastY) {\n return;\n }\n\n state.moveDrag(e.clientX, e.clientY);\n\n lastX = e.clientX;\n lastY = e.clientY;\n };\n\n const onDragEnd = (e: DragEvent) => {\n e.stopPropagation();\n\n let dropEffect: string = e.dataTransfer?.dropEffect ?? 'none';\n // Chrome Android fix - use global drop effect\n if (getGlobalDropEffect()) {\n dropEffect = getGlobalDropEffect()!;\n }\n\n const dropOperation = DROP_EFFECT_TO_DROP_OPERATION[dropEffect];\n state.endDrag(e.clientX, e.clientY, dropOperation);\n\n setGlobalAllowedDropOperations(DROP_OPERATION.none);\n setGlobalDropEffect(undefined);\n };\n\n // Keyboard/screen reader drag initiation\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Enter' && e.target === e.currentTarget) {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n\n const onKeyUp = (e: KeyboardEvent) => {\n if (e.key === 'Enter' && e.target === e.currentTarget) {\n e.preventDefault();\n e.stopPropagation();\n // Would initiate keyboard-based drag mode\n // This is a simplified version - full implementation needs DragManager\n const rect = (e.target as HTMLElement).getBoundingClientRect();\n state.startDrag(rect.x + rect.width / 2, rect.y + rect.height / 2);\n }\n };\n\n const dragProps = createMemo(() => {\n const p = getProps();\n\n if (p.isDisabled) {\n return {\n draggable: false as const,\n };\n }\n\n const baseProps: Record<string, unknown> = {\n draggable: true as const,\n onDragStart,\n onDrag,\n onDragEnd,\n };\n\n // Add keyboard handlers if no separate drag button\n if (!p.hasDragButton) {\n baseProps.onKeyDown = onKeyDown;\n baseProps.onKeyUp = onKeyUp;\n }\n\n return baseProps;\n });\n\n const dragButtonProps = createMemo(() => {\n const p = getProps();\n\n if (p.isDisabled) {\n return {\n disabled: true,\n };\n }\n\n return {\n type: 'button' as const,\n 'aria-label': 'Drag',\n onKeyDown,\n onKeyUp,\n };\n });\n\n return {\n get dragProps() {\n return dragProps() as DragAria['dragProps'];\n },\n get dragButtonProps() {\n return dragButtonProps() as DragAria['dragButtonProps'];\n },\n get isDragging() {\n return state.isDragging;\n },\n };\n}\n", "/**\n * Drag and Drop utilities for solidaria.\n */\n\nimport type {\n DragItem,\n DropItem,\n TextDropItem,\n FileDropItem,\n DirectoryDropItem,\n DropOperation,\n} from '@proyecto-viviana/solid-stately';\n\n// Native drag types that can be transferred between applications\nexport const NATIVE_DRAG_TYPES: Set<string> = new Set([\n 'text/plain',\n 'text/uri-list',\n 'text/html',\n]);\n\n// Custom drag type for serializing multiple items\nexport const CUSTOM_DRAG_TYPE = 'application/vnd.solidaria.items+json';\n\n// Generic type for unknown file types\nexport const GENERIC_TYPE = 'application/octet-stream';\n\n// Drop operation bit flags\nexport enum DROP_OPERATION {\n none = 0,\n cancel = 0,\n move = 1 << 0,\n copy = 1 << 1,\n link = 1 << 2,\n all = (1 << 0) | (1 << 1) | (1 << 2),\n}\n\n// Map from effectAllowed to DROP_OPERATION\nexport const DROP_OPERATION_ALLOWED: Record<string, number> = {\n none: DROP_OPERATION.none,\n copy: DROP_OPERATION.copy,\n copyLink: DROP_OPERATION.copy | DROP_OPERATION.link,\n copyMove: DROP_OPERATION.copy | DROP_OPERATION.move,\n link: DROP_OPERATION.link,\n linkMove: DROP_OPERATION.link | DROP_OPERATION.move,\n move: DROP_OPERATION.move,\n all: DROP_OPERATION.all,\n uninitialized: DROP_OPERATION.all,\n};\n\n// Map from DROP_OPERATION to effectAllowed\nexport const EFFECT_ALLOWED: Record<number, string> = {\n [DROP_OPERATION.none]: 'none',\n [DROP_OPERATION.move]: 'move',\n [DROP_OPERATION.copy]: 'copy',\n [DROP_OPERATION.copy | DROP_OPERATION.move]: 'copyMove',\n [DROP_OPERATION.link]: 'link',\n [DROP_OPERATION.link | DROP_OPERATION.move]: 'linkMove',\n [DROP_OPERATION.copy | DROP_OPERATION.link]: 'copyLink',\n [DROP_OPERATION.all]: 'all',\n};\n\n// Map from dropEffect to DropOperation\nexport const DROP_EFFECT_TO_DROP_OPERATION: Record<string, DropOperation> = {\n none: 'cancel',\n link: 'link',\n copy: 'copy',\n move: 'move',\n};\n\n// Map from DropOperation to dropEffect\nexport const DROP_OPERATION_TO_DROP_EFFECT: Record<DropOperation, string> = {\n cancel: 'none',\n link: 'link',\n copy: 'copy',\n move: 'move',\n};\n\n/**\n * Get the types present in drag items.\n */\nexport function getTypes(items: DragItem[]): Set<string> {\n const types = new Set<string>();\n for (const item of items) {\n for (const type of Object.keys(item)) {\n types.add(type);\n }\n }\n return types;\n}\n\n/**\n * Write drag items to a DataTransfer object.\n */\nexport function writeToDataTransfer(\n dataTransfer: DataTransfer,\n items: DragItem[]\n): void {\n const groupedByType = new Map<string, string[]>();\n let needsCustomData = false;\n const customData: object[] = [];\n\n for (const item of items) {\n const types = Object.keys(item);\n if (types.length > 1) {\n needsCustomData = true;\n }\n\n const dataByType: Record<string, string> = {};\n for (const type of types) {\n let typeItems = groupedByType.get(type);\n if (!typeItems) {\n typeItems = [];\n groupedByType.set(type, typeItems);\n } else {\n needsCustomData = true;\n }\n\n const data = item[type];\n dataByType[type] = data;\n typeItems.push(data);\n }\n\n customData.push(dataByType);\n }\n\n for (const [type, typeItems] of groupedByType) {\n if (NATIVE_DRAG_TYPES.has(type)) {\n // Join all items of this type with newlines\n const data = typeItems.join('\\n');\n dataTransfer.items.add(data, type);\n } else {\n // Set first item for non-native types\n dataTransfer.items.add(typeItems[0], type);\n }\n }\n\n if (needsCustomData) {\n const data = JSON.stringify(customData);\n dataTransfer.items.add(data, CUSTOM_DRAG_TYPE);\n }\n}\n\n/**\n * Read drop items from a DataTransfer object.\n */\nexport function readFromDataTransfer(dataTransfer: DataTransfer): DropItem[] {\n const items: DropItem[] = [];\n\n if (!dataTransfer) {\n return items;\n }\n\n // Check for custom drag type first\n let hasCustomType = false;\n if (dataTransfer.types.includes(CUSTOM_DRAG_TYPE)) {\n try {\n const data = dataTransfer.getData(CUSTOM_DRAG_TYPE);\n const parsed = JSON.parse(data);\n for (const item of parsed) {\n items.push({\n kind: 'text',\n types: new Set(Object.keys(item)),\n getText: (type) => Promise.resolve(item[type]),\n });\n }\n hasCustomType = true;\n } catch {\n // ignore parsing errors\n }\n }\n\n // Fall back to native items\n if (!hasCustomType) {\n const stringItems = new Map<string, string>();\n\n for (const item of dataTransfer.items) {\n if (item.kind === 'string') {\n const type = item.type || GENERIC_TYPE;\n stringItems.set(type, dataTransfer.getData(item.type));\n } else if (item.kind === 'file') {\n const file = item.getAsFile();\n if (file) {\n items.push(createFileItem(file));\n }\n }\n }\n\n if (stringItems.size > 0) {\n items.push({\n kind: 'text',\n types: new Set(stringItems.keys()),\n getText: (type) => Promise.resolve(stringItems.get(type) ?? ''),\n });\n }\n }\n\n return items;\n}\n\n/**\n * Create a FileDropItem from a File object.\n */\nfunction createFileItem(file: File): FileDropItem {\n return {\n kind: 'file',\n type: file.type || GENERIC_TYPE,\n name: file.name,\n getText: () => file.text(),\n getFile: () => Promise.resolve(file),\n };\n}\n\n/**\n * DragTypes implementation for checking drag types.\n */\nexport class DragTypesImpl {\n private types: Set<string>;\n private includesUnknownTypes: boolean;\n\n constructor(dataTransfer: DataTransfer) {\n this.types = new Set<string>();\n let hasFiles = false;\n\n for (const item of dataTransfer.items) {\n if (item.type !== CUSTOM_DRAG_TYPE) {\n if (item.kind === 'file') {\n hasFiles = true;\n }\n if (item.type) {\n this.types.add(item.type);\n } else {\n this.types.add(GENERIC_TYPE);\n }\n }\n }\n\n // Safari doesn't expose file types until drop\n this.includesUnknownTypes =\n !hasFiles && dataTransfer.types.includes('Files');\n }\n\n has(type: string | symbol): boolean {\n if (\n this.includesUnknownTypes ||\n (typeof type === 'symbol' && this.types.has(GENERIC_TYPE))\n ) {\n return true;\n }\n return typeof type === 'string' && this.types.has(type);\n }\n}\n\n/**\n * Check if a drop item is a text item.\n */\nexport function isTextDropItem(dropItem: DropItem): dropItem is TextDropItem {\n return dropItem.kind === 'text';\n}\n\n/**\n * Check if a drop item is a file item.\n */\nexport function isFileDropItem(dropItem: DropItem): dropItem is FileDropItem {\n return dropItem.kind === 'file';\n}\n\n/**\n * Check if a drop item is a directory item.\n */\nexport function isDirectoryDropItem(\n dropItem: DropItem\n): dropItem is DirectoryDropItem {\n return dropItem.kind === 'directory';\n}\n\n// Global state for tracking drag operations\nlet globalDropEffect: string | undefined;\nlet globalAllowedDropOperations: number = DROP_OPERATION.none;\n\nexport function setGlobalDropEffect(effect: string | undefined): void {\n globalDropEffect = effect;\n}\n\nexport function getGlobalDropEffect(): string | undefined {\n return globalDropEffect;\n}\n\nexport function setGlobalAllowedDropOperations(ops: number): void {\n globalAllowedDropOperations = ops;\n}\n\nexport function getGlobalAllowedDropOperations(): number {\n return globalAllowedDropOperations;\n}\n", "/**\n * createDrop - ARIA hook for drop operations.\n *\n * Provides accessibility props for drop target elements with support for\n * mouse, touch, and keyboard interactions.\n */\n\nimport { createMemo, type Accessor } from 'solid-js';\nimport { createDropState } from '@proyecto-viviana/solid-stately';\nimport type { AriaDropOptions, DropAria } from './types';\nimport {\n readFromDataTransfer,\n DragTypesImpl,\n DROP_OPERATION,\n DROP_OPERATION_ALLOWED,\n DROP_OPERATION_TO_DROP_EFFECT,\n DROP_EFFECT_TO_DROP_OPERATION,\n setGlobalDropEffect,\n getGlobalAllowedDropOperations,\n} from './utils';\nimport type { DropOperation } from '@proyecto-viviana/solid-stately';\n\nconst DROP_ACTIVATE_TIMEOUT = 800;\n\n/**\n * Creates ARIA props for a drop target element.\n *\n * @param props - Accessor returning drop options\n * @returns Drop ARIA props and state\n */\nexport function createDrop(props: Accessor<AriaDropOptions>): DropAria {\n const getProps = createMemo(() => props());\n\n // Create drop state\n const state = createDropState(() => ({\n getDropOperation: getProps().getDropOperation,\n onDropEnter: getProps().onDropEnter,\n onDropMove: getProps().onDropMove,\n onDropActivate: getProps().onDropActivate,\n onDropExit: getProps().onDropExit,\n onDrop: getProps().onDrop,\n isDisabled: getProps().isDisabled,\n }));\n\n // Track internal state\n let x = 0;\n let y = 0;\n let dragOverElements = new Set<Element>();\n let dropEffect: DataTransfer['dropEffect'] = 'none';\n let allowedOperations = DROP_OPERATION.all;\n let dropActivateTimer: ReturnType<typeof setTimeout> | undefined;\n\n const fireDropEnter = (e: DragEvent) => {\n const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n state.enterTarget(e.clientX - rect.x, e.clientY - rect.y);\n };\n\n const fireDropExit = (e: DragEvent) => {\n const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n state.exitTarget(e.clientX - rect.x, e.clientY - rect.y);\n };\n\n const getAllowedOperations = (e: DragEvent): number => {\n let allowed = DROP_OPERATION_ALLOWED[e.dataTransfer?.effectAllowed ?? 'none'] ?? DROP_OPERATION.none;\n\n // Use global allowed operations if set (for internal drags)\n const globalAllowed = getGlobalAllowedDropOperations();\n if (globalAllowed) {\n allowed &= globalAllowed;\n }\n\n // Handle modifier keys for operation switching\n let modifierAllowed = DROP_OPERATION.none;\n\n // macOS: Alt=copy, Ctrl=link, Cmd=move\n // Windows/Linux: Alt=link, Shift=move, Ctrl=copy\n const isMac = typeof navigator !== 'undefined' && /mac/i.test(navigator.platform);\n\n if (isMac) {\n if (e.altKey) modifierAllowed |= DROP_OPERATION.copy;\n if (e.ctrlKey) modifierAllowed |= DROP_OPERATION.link;\n if (e.metaKey) modifierAllowed |= DROP_OPERATION.move;\n } else {\n if (e.altKey) modifierAllowed |= DROP_OPERATION.link;\n if (e.shiftKey) modifierAllowed |= DROP_OPERATION.move;\n if (e.ctrlKey) modifierAllowed |= DROP_OPERATION.copy;\n }\n\n if (modifierAllowed) {\n return allowed & modifierAllowed;\n }\n\n return allowed;\n };\n\n const allowedOperationsToArray = (ops: number): DropOperation[] => {\n const result: DropOperation[] = [];\n if (ops & DROP_OPERATION.move) result.push('move');\n if (ops & DROP_OPERATION.copy) result.push('copy');\n if (ops & DROP_OPERATION.link) result.push('link');\n return result;\n };\n\n const getDropOperationForAllowed = (allowed: number, operation: DropOperation): DropOperation => {\n const op = DROP_OPERATION[operation];\n return allowed & op ? operation : 'cancel';\n };\n\n const onDragEnter = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n dragOverElements.add(e.target as Element);\n if (dragOverElements.size > 1) {\n return;\n }\n\n const p = getProps();\n const allowedOpsBits = getAllowedOperations(e);\n const allowedOps = allowedOperationsToArray(allowedOpsBits);\n let dropOp: DropOperation = allowedOps[0] ?? 'cancel';\n\n if (typeof p.getDropOperation === 'function' && e.dataTransfer) {\n const types = new DragTypesImpl(e.dataTransfer);\n dropOp = getDropOperationForAllowed(\n allowedOpsBits,\n p.getDropOperation(types, allowedOps)\n );\n }\n\n if (typeof p.getDropOperationForPoint === 'function' && e.dataTransfer) {\n const types = new DragTypesImpl(e.dataTransfer);\n const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n dropOp = getDropOperationForAllowed(\n allowedOpsBits,\n p.getDropOperationForPoint(types, allowedOps, e.clientX - rect.x, e.clientY - rect.y)\n );\n }\n\n x = e.clientX;\n y = e.clientY;\n allowedOperations = allowedOpsBits;\n dropEffect = (DROP_OPERATION_TO_DROP_EFFECT[dropOp] || 'none') as DataTransfer['dropEffect'];\n\n if (e.dataTransfer) {\n e.dataTransfer.dropEffect = dropEffect;\n }\n\n if (dropOp !== 'cancel') {\n fireDropEnter(e);\n }\n };\n\n const onDragOver = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n const allowedOpsBits = getAllowedOperations(e);\n\n // Skip if position and operations haven't changed\n if (e.clientX === x && e.clientY === y && allowedOpsBits === allowedOperations) {\n if (e.dataTransfer) {\n e.dataTransfer.dropEffect = dropEffect;\n }\n return;\n }\n\n x = e.clientX;\n y = e.clientY;\n\n const prevDropEffect = dropEffect;\n const p = getProps();\n\n // Update drop effect if allowed operations changed\n if (allowedOpsBits !== allowedOperations) {\n const allowedOps = allowedOperationsToArray(allowedOpsBits);\n let dropOp: DropOperation = allowedOps[0] ?? 'cancel';\n\n if (typeof p.getDropOperation === 'function' && e.dataTransfer) {\n const types = new DragTypesImpl(e.dataTransfer);\n dropOp = getDropOperationForAllowed(\n allowedOpsBits,\n p.getDropOperation(types, allowedOps)\n );\n }\n dropEffect = (DROP_OPERATION_TO_DROP_EFFECT[dropOp] || 'none') as DataTransfer['dropEffect'];\n }\n\n // Check point-specific operation\n if (typeof p.getDropOperationForPoint === 'function' && e.dataTransfer) {\n const types = new DragTypesImpl(e.dataTransfer);\n const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n const dropOp = getDropOperationForAllowed(\n allowedOpsBits,\n p.getDropOperationForPoint(types, allowedOperationsToArray(allowedOpsBits), x - rect.x, y - rect.y)\n );\n dropEffect = (DROP_OPERATION_TO_DROP_EFFECT[dropOp] || 'none') as DataTransfer['dropEffect'];\n }\n\n allowedOperations = allowedOpsBits;\n\n if (e.dataTransfer) {\n e.dataTransfer.dropEffect = dropEffect;\n }\n\n // Fire enter/exit events on drop effect change\n if (dropEffect === 'none' && prevDropEffect !== 'none') {\n fireDropExit(e);\n } else if (dropEffect !== 'none' && prevDropEffect === 'none') {\n fireDropEnter(e);\n }\n\n // Fire move event\n if (dropEffect !== 'none') {\n const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n state.moveInTarget(x - rect.x, y - rect.y);\n }\n\n // Handle drop activate timer\n clearTimeout(dropActivateTimer);\n\n if (typeof p.onDropActivate === 'function' && dropEffect !== 'none') {\n const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n const activateX = x - rect.x;\n const activateY = y - rect.y;\n dropActivateTimer = setTimeout(() => {\n state.activateTarget(activateX, activateY);\n }, DROP_ACTIVATE_TIMEOUT);\n }\n };\n\n const onDragLeave = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n // Track drag over elements (WebKit workaround for relatedTarget being null)\n dragOverElements.delete(e.target as Element);\n\n // Remove elements no longer in DOM\n for (const element of dragOverElements) {\n if (!e.currentTarget || !(e.currentTarget as Element).contains(element)) {\n dragOverElements.delete(element);\n }\n }\n\n if (dragOverElements.size > 0) {\n return;\n }\n\n if (dropEffect !== 'none') {\n fireDropExit(e);\n }\n\n clearTimeout(dropActivateTimer);\n };\n\n const onDropHandler = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n // Track drop effect globally for Chrome Android\n setGlobalDropEffect(dropEffect);\n\n const p = getProps();\n if (typeof p.onDrop === 'function' && e.dataTransfer) {\n const items = readFromDataTransfer(e.dataTransfer);\n const dropOperation = DROP_EFFECT_TO_DROP_OPERATION[dropEffect];\n const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n\n state.drop(e.clientX - rect.x, e.clientY - rect.y, items, dropOperation);\n }\n\n dragOverElements.clear();\n fireDropExit(e);\n clearTimeout(dropActivateTimer);\n };\n\n const dropProps = createMemo(() => {\n const p = getProps();\n\n if (p.isDisabled) {\n return {};\n }\n\n const baseProps: Record<string, unknown> = {\n onDragEnter,\n onDragOver,\n onDragLeave,\n onDrop: onDropHandler,\n };\n\n return baseProps;\n });\n\n const dropButtonProps = createMemo(() => {\n const p = getProps();\n\n if (p.isDisabled) {\n return {\n disabled: true,\n };\n }\n\n return {\n type: 'button' as const,\n 'aria-label': 'Drop',\n };\n });\n\n return {\n get dropProps() {\n return dropProps() as DropAria['dropProps'];\n },\n get isDropTarget() {\n return state.isDropTarget;\n },\n get dropButtonProps() {\n return dropButtonProps() as DropAria['dropButtonProps'];\n },\n };\n}\n", "/**\n * createDraggableCollection - ARIA hook for draggable collection items.\n *\n * Provides accessibility support for dragging items from a collection\n * component like ListBox, GridList, or Table.\n */\n\nimport { createMemo, createEffect, onCleanup, type Accessor } from 'solid-js';\nimport type { DraggableCollectionState } from '@proyecto-viviana/solid-stately';\n\n// Global state for tracking the dragging collection\nlet globalDraggingCollectionRef: HTMLElement | null = null;\n\nexport function setGlobalDraggingCollectionRef(ref: HTMLElement | null): void {\n globalDraggingCollectionRef = ref;\n}\n\nexport function getGlobalDraggingCollectionRef(): HTMLElement | null {\n return globalDraggingCollectionRef;\n}\n\nexport interface DraggableCollectionOptions {\n /** Reference to the collection element. */\n ref: Accessor<HTMLElement | null>;\n}\n\nexport interface DraggableCollectionAria {\n /** The draggable collection state. */\n state: DraggableCollectionState;\n}\n\n/**\n * Creates ARIA support for a draggable collection.\n *\n * @param _options - Collection options\n * @param state - Draggable collection state\n * @returns Draggable collection ARIA result\n */\nexport function createDraggableCollection(\n options: DraggableCollectionOptions,\n state: DraggableCollectionState\n): DraggableCollectionAria {\n const ref = createMemo(() => options.ref());\n\n // Track dragging state globally\n createEffect(() => {\n const currentRef = ref();\n if (state.draggingKeys.size > 0 && globalDraggingCollectionRef !== currentRef) {\n setGlobalDraggingCollectionRef(currentRef);\n }\n });\n\n // Clean up on unmount\n onCleanup(() => {\n if (globalDraggingCollectionRef === ref()) {\n setGlobalDraggingCollectionRef(null);\n }\n });\n\n return {\n state,\n };\n}\n", "/**\n * createDroppableCollection - ARIA hook for droppable collection targets.\n *\n * Provides accessibility support for dropping items into a collection\n * component like ListBox, GridList, or Table.\n */\n\nimport { createMemo, onCleanup, type Accessor } from 'solid-js';\nimport type { JSX } from 'solid-js';\nimport type {\n DroppableCollectionState,\n DropTarget,\n DropOperation,\n DropItem,\n DragTypes,\n} from '@proyecto-viviana/solid-stately';\nimport { createDrop } from './createDrop';\nimport { getGlobalDraggingCollectionRef } from './createDraggableCollection';\n\n// Global state for tracking the drop collection\nlet globalDropCollectionRef: HTMLElement | null = null;\n\nexport function setGlobalDropCollectionRef(ref: HTMLElement | null): void {\n globalDropCollectionRef = ref;\n}\n\nexport function getGlobalDropCollectionRef(): HTMLElement | null {\n return globalDropCollectionRef;\n}\n\nexport interface DropTargetDelegate {\n /**\n * Returns a drop target from a point within the collection.\n */\n getDropTargetFromPoint(\n x: number,\n y: number,\n isValidDropTarget: (target: DropTarget) => boolean\n ): DropTarget | null;\n}\n\nexport interface DroppableCollectionOptions {\n /** Reference to the collection element. */\n ref: Accessor<HTMLElement | null>;\n /** A delegate that provides drop targets for pointer coordinates. */\n dropTargetDelegate: DropTargetDelegate;\n /** Handler called when items are dropped to be inserted. */\n onInsert?: (e: {\n items: DropItem[];\n target: DropTarget;\n dropOperation: DropOperation;\n }) => void;\n /** Handler called when items are dropped on the root. */\n onRootDrop?: (e: { items: DropItem[]; dropOperation: DropOperation }) => void;\n /** Handler called when items are dropped on an item. */\n onItemDrop?: (e: {\n items: DropItem[];\n target: DropTarget;\n dropOperation: DropOperation;\n isInternal: boolean;\n }) => void;\n /** Handler called when items are reordered within the collection. */\n onReorder?: (e: {\n keys: Set<string | number>;\n target: DropTarget;\n dropOperation: DropOperation;\n }) => void;\n /** Handler called when items are moved within/between collections. */\n onMove?: (e: {\n keys: Set<string | number>;\n target: DropTarget;\n dropOperation: DropOperation;\n }) => void;\n /** Handler called when the drop target is activated (held over). */\n onDropActivate?: (e: { target: DropTarget; x: number; y: number }) => void;\n /** Whether the collection is disabled for dropping. */\n isDisabled?: boolean;\n /** Accepted drag types. 'all' accepts any type. */\n acceptedDragTypes?: 'all' | string[];\n}\n\nexport interface DroppableCollectionAria {\n /** Props to spread on the collection element. */\n collectionProps: JSX.HTMLAttributes<HTMLElement>;\n}\n\n/**\n * Creates ARIA support for a droppable collection.\n *\n * @param options - Collection options accessor\n * @param state - Droppable collection state\n * @returns Droppable collection ARIA result\n */\nexport function createDroppableCollection(\n options: Accessor<DroppableCollectionOptions>,\n state: DroppableCollectionState\n): DroppableCollectionAria {\n const getOptions = createMemo(() => options());\n\n // Track the next target during drag operations\n let nextTarget: DropTarget | null = null;\n let currentDropOperation: DropOperation | null = null;\n\n const isInternalDropOperation = (): boolean => {\n const ref = getOptions().ref();\n const draggingRef = getGlobalDraggingCollectionRef();\n return ref !== null && draggingRef === ref;\n };\n\n const getDropOperationForTarget = (\n target: DropTarget,\n types: DragTypes,\n allowedOperations: DropOperation[]\n ): DropOperation => {\n return state.getDropOperation(target, types, allowedOperations);\n };\n\n // Create base drop behavior\n const drop = createDrop(() => ({\n isDisabled: getOptions().isDisabled,\n getDropOperationForPoint: (types, allowedOperations, x, y) => {\n const opts = getOptions();\n const isValidDropTarget = (target: DropTarget) =>\n getDropOperationForTarget(target, types, allowedOperations) !== 'cancel';\n\n const target = opts.dropTargetDelegate.getDropTargetFromPoint(\n x,\n y,\n isValidDropTarget\n );\n\n if (!target) {\n currentDropOperation = 'cancel';\n nextTarget = null;\n return 'cancel';\n }\n\n currentDropOperation = getDropOperationForTarget(\n target,\n types,\n allowedOperations\n );\n\n // If target doesn't accept, try root\n if (currentDropOperation === 'cancel') {\n const rootTarget: DropTarget = { type: 'root' };\n const rootOp = getDropOperationForTarget(\n rootTarget,\n types,\n allowedOperations\n );\n if (rootOp !== 'cancel') {\n nextTarget = rootTarget;\n currentDropOperation = rootOp;\n return currentDropOperation;\n }\n }\n\n // Update drop collection ref\n const ref = opts.ref();\n if (target && currentDropOperation !== 'cancel' && ref !== globalDropCollectionRef) {\n setGlobalDropCollectionRef(ref);\n }\n\n nextTarget = currentDropOperation === 'cancel' ? null : target;\n return currentDropOperation;\n },\n onDropEnter: () => {\n if (nextTarget) {\n state.setTarget(nextTarget);\n }\n },\n onDropMove: () => {\n if (nextTarget) {\n state.setTarget(nextTarget);\n }\n },\n onDropExit: () => {\n setGlobalDropCollectionRef(null);\n state.setTarget(null);\n },\n onDropActivate: (e) => {\n const opts = getOptions();\n if (state.target?.type === 'item' && typeof opts.onDropActivate === 'function') {\n opts.onDropActivate({\n target: state.target,\n x: e.x,\n y: e.y,\n });\n }\n },\n onDrop: (e) => {\n const opts = getOptions();\n setGlobalDropCollectionRef(opts.ref());\n\n if (state.target) {\n handleDrop(e.items, state.target, e.dropOperation);\n }\n },\n }));\n\n const handleDrop = async (\n items: DropItem[],\n target: DropTarget,\n dropOperation: DropOperation\n ) => {\n const opts = getOptions();\n const isInternal = isInternalDropOperation();\n\n // Filter items by accepted types\n let filteredItems = items;\n const acceptedTypes = opts.acceptedDragTypes;\n if (acceptedTypes && acceptedTypes !== 'all') {\n filteredItems = items.filter((item) => {\n const itemTypes =\n item.kind === 'file'\n ? new Set([item.type])\n : item.kind === 'text'\n ? item.types\n : new Set<string>();\n return acceptedTypes.some((type) => itemTypes.has(type));\n });\n }\n\n if (filteredItems.length === 0) return;\n\n // Call appropriate handlers based on target type\n if (target.type === 'root' && opts.onRootDrop) {\n await opts.onRootDrop({ items: filteredItems, dropOperation });\n }\n\n if (target.type === 'item') {\n if (target.dropPosition === 'on' && opts.onItemDrop) {\n await opts.onItemDrop({\n items: filteredItems,\n target,\n dropOperation,\n isInternal,\n });\n }\n\n // Handle move for internal operations\n if (opts.onMove && isInternal) {\n // Would get dragging keys from global state\n await opts.onMove({\n keys: new Set(),\n target,\n dropOperation,\n });\n }\n\n if (target.dropPosition !== 'on') {\n if (!isInternal && opts.onInsert) {\n await opts.onInsert({\n items: filteredItems,\n target,\n dropOperation,\n });\n }\n\n if (isInternal && opts.onReorder) {\n // Would get dragging keys from global state\n await opts.onReorder({\n keys: new Set(),\n target,\n dropOperation,\n });\n }\n }\n }\n };\n\n // Clean up on unmount\n onCleanup(() => {\n const ref = getOptions().ref();\n if (globalDropCollectionRef === ref) {\n setGlobalDropCollectionRef(null);\n }\n });\n\n const collectionProps = createMemo(() => {\n const baseDropProps = drop.dropProps;\n return {\n ...baseDropProps,\n };\n });\n\n return {\n get collectionProps() {\n return collectionProps() as DroppableCollectionAria['collectionProps'];\n },\n };\n}\n", "/**\n * createDraggableItem - ARIA hook for draggable items within a collection.\n *\n * Provides accessibility props for items that can be dragged from a collection.\n */\n\nimport { createMemo, type Accessor } from 'solid-js';\nimport type { JSX } from 'solid-js';\nimport type {\n DraggableCollectionState,\n DragPreviewRenderer,\n} from '@proyecto-viviana/solid-stately';\nimport {\n writeToDataTransfer,\n DROP_OPERATION,\n EFFECT_ALLOWED,\n DROP_EFFECT_TO_DROP_OPERATION,\n setGlobalAllowedDropOperations,\n setGlobalDropEffect,\n getGlobalDropEffect,\n} from './utils';\n\nexport interface DraggableItemOptions {\n /** The unique key of the item. */\n key: string | number;\n /** Whether the item has a separate drag button affordance. */\n hasDragButton?: boolean;\n /** Whether this item is disabled for dragging. */\n isDisabled?: boolean;\n /** Preview renderer function ref. */\n preview?: { current: DragPreviewRenderer | null };\n}\n\nexport interface DraggableItemAria {\n /** Props for the draggable item element. */\n dragProps: JSX.HTMLAttributes<HTMLElement>;\n /** Props for the explicit drag button affordance, if any. */\n dragButtonProps: JSX.ButtonHTMLAttributes<HTMLButtonElement>;\n /** Whether the item is currently being dragged. */\n isDragging: boolean;\n}\n\n/**\n * Creates ARIA props for a draggable item within a collection.\n *\n * @param options - Accessor returning item options\n * @param state - Draggable collection state\n * @returns Draggable item ARIA props\n */\nexport function createDraggableItem(\n options: Accessor<DraggableItemOptions>,\n state: DraggableCollectionState\n): DraggableItemAria {\n const getOptions = createMemo(() => options());\n\n // Track position for drag move\n let lastX = 0;\n let lastY = 0;\n\n const isDragging = createMemo(() => {\n const key = getOptions().key;\n return state.draggingKeys.has(key);\n });\n\n const getKeysForDrag = (): Set<string | number> => {\n const { key } = getOptions();\n // If the key is not selected, only drag that item\n // If it is selected, drag all selected items\n // For now, just return the single key\n return new Set([key]);\n };\n\n const onDragStart = (e: DragEvent) => {\n if (e.defaultPrevented) return;\n e.stopPropagation();\n\n const opts = getOptions();\n if (opts.isDisabled || state.isDisabled) return;\n\n const keys = getKeysForDrag();\n\n // Start drag state\n state.startDrag(keys, e.clientX, e.clientY);\n\n // Get items and write to data transfer\n const items = state.getItems(keys);\n e.dataTransfer?.clearData?.();\n if (e.dataTransfer) {\n writeToDataTransfer(e.dataTransfer, items);\n }\n\n // Set allowed drop operations\n let allowed = DROP_OPERATION.all;\n const allowedOps = state.getAllowedDropOperations();\n if (allowedOps.length > 0) {\n allowed = DROP_OPERATION.none;\n for (const op of allowedOps) {\n allowed |= DROP_OPERATION[op] || DROP_OPERATION.none;\n }\n }\n\n setGlobalAllowedDropOperations(allowed);\n const effectAllowed = EFFECT_ALLOWED[allowed] || 'none';\n if (e.dataTransfer) {\n e.dataTransfer.effectAllowed =\n (effectAllowed === 'cancel' ? 'none' : effectAllowed) as DataTransfer['effectAllowed'];\n }\n\n // Handle custom preview\n if (typeof opts.preview?.current === 'function' && e.dataTransfer) {\n opts.preview.current(items, (node, userX, userY) => {\n if (!node || !e.dataTransfer) return;\n\n const size = node.getBoundingClientRect();\n const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n let defaultX = e.clientX - rect.x;\n let defaultY = e.clientY - rect.y;\n\n if (defaultX > size.width || defaultY > size.height) {\n defaultX = size.width / 2;\n defaultY = size.height / 2;\n }\n\n let offsetX = typeof userX === 'number' ? userX : defaultX;\n let offsetY = typeof userY === 'number' ? userY : defaultY;\n\n offsetX = Math.max(0, Math.min(offsetX, size.width));\n offsetY = Math.max(0, Math.min(offsetY, size.height));\n\n e.dataTransfer.setDragImage(node, offsetX, offsetY);\n });\n }\n\n lastX = e.clientX;\n lastY = e.clientY;\n };\n\n const onDrag = (e: DragEvent) => {\n e.stopPropagation();\n\n if (e.clientX === lastX && e.clientY === lastY) {\n return;\n }\n\n state.moveDrag(e.clientX, e.clientY);\n\n lastX = e.clientX;\n lastY = e.clientY;\n };\n\n const onDragEnd = (e: DragEvent) => {\n e.stopPropagation();\n\n let dropEffect: string = e.dataTransfer?.dropEffect ?? 'none';\n // Chrome Android fix - use global drop effect\n if (getGlobalDropEffect()) {\n dropEffect = getGlobalDropEffect()!;\n }\n\n const dropOperation = DROP_EFFECT_TO_DROP_OPERATION[dropEffect];\n const isInternal = false; // Would check global state\n state.endDrag(e.clientX, e.clientY, dropOperation, isInternal);\n\n setGlobalAllowedDropOperations(DROP_OPERATION.none);\n setGlobalDropEffect(undefined);\n };\n\n // Keyboard/screen reader drag initiation\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Enter' && e.target === e.currentTarget) {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n\n const onKeyUp = (e: KeyboardEvent) => {\n if (e.key === 'Enter' && e.target === e.currentTarget) {\n e.preventDefault();\n e.stopPropagation();\n\n const opts = getOptions();\n if (opts.isDisabled || state.isDisabled) return;\n\n const keys = getKeysForDrag();\n const rect = (e.target as HTMLElement).getBoundingClientRect();\n state.startDrag(keys, rect.x + rect.width / 2, rect.y + rect.height / 2);\n }\n };\n\n const dragProps = createMemo(() => {\n const opts = getOptions();\n\n if (opts.isDisabled || state.isDisabled) {\n return {\n draggable: false as const,\n };\n }\n\n const baseProps: Record<string, unknown> = {\n draggable: true as const,\n onDragStart,\n onDrag,\n onDragEnd,\n };\n\n // Add keyboard handlers if no separate drag button\n if (!opts.hasDragButton) {\n baseProps.onKeyDown = onKeyDown;\n baseProps.onKeyUp = onKeyUp;\n }\n\n return baseProps;\n });\n\n const dragButtonProps = createMemo(() => {\n const opts = getOptions();\n\n if (opts.isDisabled || state.isDisabled) {\n return {\n disabled: true,\n };\n }\n\n return {\n type: 'button' as const,\n 'aria-label': 'Drag',\n onKeyDown,\n onKeyUp,\n };\n });\n\n return {\n get dragProps() {\n return dragProps() as DraggableItemAria['dragProps'];\n },\n get dragButtonProps() {\n return dragButtonProps() as DraggableItemAria['dragButtonProps'];\n },\n get isDragging() {\n return isDragging();\n },\n };\n}\n", "/**\n * createDroppableItem - ARIA hook for droppable items within a collection.\n *\n * Provides accessibility props for items that can receive drops.\n */\n\nimport { createMemo, type Accessor } from 'solid-js';\nimport type { JSX } from 'solid-js';\nimport type {\n DroppableCollectionState,\n DropTarget,\n DropOperation,\n} from '@proyecto-viviana/solid-stately';\nimport {\n DragTypesImpl,\n DROP_OPERATION,\n DROP_OPERATION_ALLOWED,\n DROP_OPERATION_TO_DROP_EFFECT,\n getGlobalAllowedDropOperations,\n} from './utils';\n\nexport interface DroppableItemOptions {\n /** The unique key of the item. */\n key: string | number;\n /** Reference to the item element. */\n ref: Accessor<HTMLElement | null>;\n /** Whether this item is disabled for dropping. */\n isDisabled?: boolean;\n}\n\nexport interface DroppableItemAria {\n /** Props for the droppable item element. */\n dropProps: JSX.HTMLAttributes<HTMLElement>;\n /** Whether the item is currently a drop target. */\n isDropTarget: boolean;\n}\n\n/**\n * Creates ARIA props for a droppable item within a collection.\n *\n * @param options - Accessor returning item options\n * @param state - Droppable collection state\n * @returns Droppable item ARIA props\n */\nexport function createDroppableItem(\n options: Accessor<DroppableItemOptions>,\n state: DroppableCollectionState\n): DroppableItemAria {\n const getOptions = createMemo(() => options());\n\n const isDropTarget = createMemo(() => {\n const { key } = getOptions();\n const target = state.target;\n return target?.type === 'item' && target.key === key;\n });\n\n const getTarget = (dropPosition: 'before' | 'on' | 'after'): DropTarget => {\n const { key } = getOptions();\n return {\n type: 'item',\n key,\n dropPosition,\n };\n };\n\n const getDropOperation = (\n e: DragEvent,\n target: DropTarget\n ): DropOperation => {\n if (!e.dataTransfer) return 'cancel';\n\n const types = new DragTypesImpl(e.dataTransfer);\n let allowedBits =\n DROP_OPERATION_ALLOWED[e.dataTransfer.effectAllowed] || DROP_OPERATION.all;\n\n // Use global allowed operations for internal drags\n const globalAllowed = getGlobalAllowedDropOperations();\n if (globalAllowed) {\n allowedBits &= globalAllowed;\n }\n\n const allowedOperations: DropOperation[] = [];\n if (allowedBits & DROP_OPERATION.move) allowedOperations.push('move');\n if (allowedBits & DROP_OPERATION.copy) allowedOperations.push('copy');\n if (allowedBits & DROP_OPERATION.link) allowedOperations.push('link');\n\n return state.getDropOperation(target, types, allowedOperations);\n };\n\n let dropActivateTimer: ReturnType<typeof setTimeout> | undefined;\n const DROP_ACTIVATE_TIMEOUT = 800;\n\n const onDragEnter = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n const opts = getOptions();\n if (opts.isDisabled) return;\n\n // Determine drop position based on cursor position\n const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n const y = e.clientY - rect.y;\n const height = rect.height;\n\n let dropPosition: 'before' | 'on' | 'after';\n if (y < height * 0.25) {\n dropPosition = 'before';\n } else if (y > height * 0.75) {\n dropPosition = 'after';\n } else {\n dropPosition = 'on';\n }\n\n const target = getTarget(dropPosition);\n const operation = getDropOperation(e, target);\n\n if (operation !== 'cancel') {\n state.setTarget(target);\n e.dataTransfer!.dropEffect = DROP_OPERATION_TO_DROP_EFFECT[operation] as DataTransfer['dropEffect'];\n }\n };\n\n const onDragOver = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n const opts = getOptions();\n if (opts.isDisabled) return;\n\n // Update drop position based on cursor\n const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n const y = e.clientY - rect.y;\n const height = rect.height;\n\n let dropPosition: 'before' | 'on' | 'after';\n if (y < height * 0.25) {\n dropPosition = 'before';\n } else if (y > height * 0.75) {\n dropPosition = 'after';\n } else {\n dropPosition = 'on';\n }\n\n const target = getTarget(dropPosition);\n const operation = getDropOperation(e, target);\n\n if (operation !== 'cancel') {\n state.setTarget(target);\n e.dataTransfer!.dropEffect = DROP_OPERATION_TO_DROP_EFFECT[operation] as DataTransfer['dropEffect'];\n\n // Handle drop activate for 'on' position\n clearTimeout(dropActivateTimer);\n if (dropPosition === 'on') {\n dropActivateTimer = setTimeout(() => {\n // Would trigger onDropActivate\n }, DROP_ACTIVATE_TIMEOUT);\n }\n } else {\n e.dataTransfer!.dropEffect = 'none';\n }\n };\n\n const onDragLeave = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n clearTimeout(dropActivateTimer);\n\n // Only clear target if leaving this item\n const relatedTarget = e.relatedTarget as HTMLElement | null;\n const currentTarget = e.currentTarget as HTMLElement;\n if (!relatedTarget || !currentTarget.contains(relatedTarget)) {\n // Clear if no longer over this item\n const { key } = getOptions();\n if (state.target?.type === 'item' && state.target.key === key) {\n // State clearing handled by parent collection\n }\n }\n };\n\n const onDrop = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n clearTimeout(dropActivateTimer);\n\n // Drop handling is done by the parent collection\n };\n\n const dropProps = createMemo(() => {\n const opts = getOptions();\n\n if (opts.isDisabled) {\n return {};\n }\n\n return {\n onDragEnter,\n onDragOver,\n onDragLeave,\n onDrop,\n };\n });\n\n return {\n get dropProps() {\n return dropProps() as DroppableItemAria['dropProps'];\n },\n get isDropTarget() {\n return isDropTarget();\n },\n };\n}\n", "/**\n * createLandmark - SolidJS implementation of React Aria's useLandmark\n *\n * Provides landmark navigation in an application. Call this with a role and label\n * to register a landmark navigable with the F6 key.\n *\n * ARIA landmarks help screen reader users navigate between major sections of a page.\n * The F6 key (or Shift+F6) cycles through all registered landmarks.\n */\n\nimport type { JSX, Accessor } from 'solid-js';\nimport { createEffect, onCleanup } from 'solid-js';\nimport { access, type MaybeAccessor } from '../utils';\nimport { filterDOMProps } from '../utils';\n\n// ============================================\n// TYPES\n// ============================================\n\n/** ARIA landmark roles */\nexport type AriaLandmarkRole =\n | 'main'\n | 'region'\n | 'search'\n | 'navigation'\n | 'form'\n | 'banner'\n | 'contentinfo'\n | 'complementary';\n\nexport interface AriaLandmarkProps {\n /** The ARIA landmark role. */\n role: AriaLandmarkRole;\n /**\n * A human-readable label for the landmark.\n * Required when multiple landmarks with the same role exist on a page.\n */\n 'aria-label'?: string;\n /** Identifies the element(s) that labels the landmark. */\n 'aria-labelledby'?: string;\n /** The element's unique identifier. */\n id?: string;\n /**\n * A custom focus handler called when this landmark receives focus via F6 navigation.\n * Use this to focus a specific element within the landmark instead of the container.\n */\n focus?: () => void;\n}\n\nexport interface LandmarkAria<T extends HTMLElement = HTMLElement> {\n /** Props to spread on the landmark element. */\n landmarkProps: JSX.HTMLAttributes<T>;\n}\n\nexport interface LandmarkController {\n /** Focus the next landmark in DOM order. */\n focusNext: () => void;\n /** Focus the previous landmark in DOM order. */\n focusPrevious: () => void;\n /** Focus the main landmark. */\n focusMain: () => void;\n /** Navigate to a specific landmark by role. If multiple exist, the first one is focused. */\n navigate: (role: AriaLandmarkRole) => void;\n}\n\n// ============================================\n// INTERNAL: Landmark Entry\n// ============================================\n\ninterface LandmarkEntry {\n ref: HTMLElement;\n role: AriaLandmarkRole;\n label?: string;\n focus?: () => void;\n lastFocused?: HTMLElement;\n}\n\n// ============================================\n// LANDMARK MANAGER (Singleton)\n// ============================================\n\n/**\n * Manages all registered landmarks and handles F6 keyboard navigation.\n */\nclass LandmarkManager {\n private landmarks: LandmarkEntry[] = [];\n private currentIndex = -1;\n private listening = false;\n\n constructor() {\n if (typeof window !== 'undefined') {\n this.startListening();\n }\n }\n\n private startListening() {\n if (this.listening) return;\n this.listening = true;\n\n window.addEventListener('keydown', this.handleKeyDown.bind(this), true);\n }\n\n private handleKeyDown(event: KeyboardEvent) {\n // F6 to navigate landmarks\n if (event.key === 'F6') {\n event.preventDefault();\n if (event.shiftKey) {\n this.focusPrevious();\n } else {\n this.focusNext();\n }\n }\n }\n\n register(entry: LandmarkEntry): void {\n // Insert in DOM order using compareDocumentPosition\n const index = this.findInsertionIndex(entry.ref);\n this.landmarks.splice(index, 0, entry);\n\n // Validate: if multiple landmarks have the same role, they should have different labels\n this.validateLabels();\n }\n\n unregister(ref: HTMLElement): void {\n const index = this.landmarks.findIndex((l) => l.ref === ref);\n if (index !== -1) {\n this.landmarks.splice(index, 1);\n // Adjust currentIndex if needed\n if (this.currentIndex >= this.landmarks.length) {\n this.currentIndex = this.landmarks.length - 1;\n }\n }\n }\n\n private findInsertionIndex(ref: HTMLElement): number {\n // Binary search for insertion point based on DOM order\n let low = 0;\n let high = this.landmarks.length;\n\n while (low < high) {\n const mid = Math.floor((low + high) / 2);\n const comparison = this.landmarks[mid].ref.compareDocumentPosition(ref);\n\n // Node.DOCUMENT_POSITION_FOLLOWING = 4\n if (comparison & Node.DOCUMENT_POSITION_FOLLOWING) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n\n return low;\n }\n\n private validateLabels(): void {\n // Group landmarks by role\n const roleGroups = new Map<AriaLandmarkRole, LandmarkEntry[]>();\n for (const landmark of this.landmarks) {\n const group = roleGroups.get(landmark.role) || [];\n group.push(landmark);\n roleGroups.set(landmark.role, group);\n }\n\n // Warn if multiple landmarks with the same role lack unique labels\n for (const [role, group] of roleGroups) {\n if (group.length > 1) {\n const labels = group.map((l) => l.label);\n const uniqueLabels = new Set(labels.filter(Boolean));\n if (uniqueLabels.size < group.length) {\n console.warn(\n `Multiple landmarks with role \"${role}\" exist. Each should have a unique aria-label or aria-labelledby.`\n );\n }\n }\n }\n }\n\n focusNext(): void {\n if (this.landmarks.length === 0) return;\n\n // Find the currently focused landmark\n const activeElement = document.activeElement;\n this.currentIndex = this.findCurrentLandmarkIndex(activeElement);\n\n // Move to next\n this.currentIndex = (this.currentIndex + 1) % this.landmarks.length;\n this.focusLandmark(this.landmarks[this.currentIndex]);\n }\n\n focusPrevious(): void {\n if (this.landmarks.length === 0) return;\n\n // Find the currently focused landmark\n const activeElement = document.activeElement;\n this.currentIndex = this.findCurrentLandmarkIndex(activeElement);\n\n // Move to previous\n this.currentIndex =\n (this.currentIndex - 1 + this.landmarks.length) % this.landmarks.length;\n this.focusLandmark(this.landmarks[this.currentIndex]);\n }\n\n focusMain(): void {\n const main = this.landmarks.find((l) => l.role === 'main');\n if (main) {\n this.focusLandmark(main);\n }\n }\n\n navigate(role: AriaLandmarkRole): void {\n const landmark = this.landmarks.find((l) => l.role === role);\n if (landmark) {\n this.focusLandmark(landmark);\n }\n }\n\n private findCurrentLandmarkIndex(activeElement: Element | null): number {\n if (!activeElement) return -1;\n\n // Check if active element is within any landmark\n for (let i = 0; i < this.landmarks.length; i++) {\n if (this.landmarks[i].ref.contains(activeElement)) {\n // Store the last focused element for this landmark\n if (activeElement instanceof HTMLElement) {\n this.landmarks[i].lastFocused = activeElement;\n }\n return i;\n }\n }\n\n return -1;\n }\n\n private focusLandmark(landmark: LandmarkEntry): void {\n // If a custom focus handler is provided, use it\n if (landmark.focus) {\n landmark.focus();\n return;\n }\n\n // If we previously focused an element in this landmark, try to restore it\n if (landmark.lastFocused && landmark.ref.contains(landmark.lastFocused)) {\n landmark.lastFocused.focus();\n return;\n }\n\n // Try to find the first focusable element\n const focusable = this.findFirstFocusable(landmark.ref);\n if (focusable) {\n focusable.focus();\n return;\n }\n\n // Fallback: make the landmark itself focusable and focus it\n if (!landmark.ref.hasAttribute('tabindex')) {\n landmark.ref.setAttribute('tabindex', '-1');\n }\n landmark.ref.focus();\n }\n\n private findFirstFocusable(container: HTMLElement): HTMLElement | null {\n const focusableSelectors = [\n 'a[href]',\n 'button:not([disabled])',\n 'input:not([disabled])',\n 'select:not([disabled])',\n 'textarea:not([disabled])',\n '[tabindex]:not([tabindex=\"-1\"])',\n ].join(', ');\n\n return container.querySelector<HTMLElement>(focusableSelectors);\n }\n\n getController(): LandmarkController {\n return {\n focusNext: () => this.focusNext(),\n focusPrevious: () => this.focusPrevious(),\n focusMain: () => this.focusMain(),\n navigate: (role) => this.navigate(role),\n };\n }\n}\n\n// Global singleton instance\nlet landmarkManager: LandmarkManager | null = null;\n\nfunction getLandmarkManager(): LandmarkManager {\n if (!landmarkManager) {\n landmarkManager = new LandmarkManager();\n }\n return landmarkManager;\n}\n\n// ============================================\n// CREATE LANDMARK\n// ============================================\n\n/**\n * Provides landmark navigation in an application.\n * Call this with a role and label to register a landmark navigable with F6.\n *\n * @example\n * ```tsx\n * function Navigation(props) {\n * let ref: HTMLElement;\n * const { landmarkProps } = createLandmark({\n * role: 'navigation',\n * 'aria-label': 'Main navigation'\n * });\n *\n * return (\n * <nav {...landmarkProps} ref={ref}>\n * {props.children}\n * </nav>\n * );\n * }\n * ```\n */\nexport function createLandmark<T extends HTMLElement = HTMLElement>(\n props: MaybeAccessor<AriaLandmarkProps>,\n ref: Accessor<T | undefined>\n): LandmarkAria<T> {\n // Register with the landmark manager\n createEffect(() => {\n const element = ref();\n if (!element) return;\n\n const p = access(props);\n const entry: LandmarkEntry = {\n ref: element,\n role: p.role,\n label: p['aria-label'],\n focus: p.focus,\n };\n\n const manager = getLandmarkManager();\n manager.register(entry);\n\n onCleanup(() => {\n manager.unregister(element);\n });\n });\n\n const getLandmarkProps = (): JSX.HTMLAttributes<T> => {\n const p = access(props);\n const domProps = filterDOMProps(p as unknown as Record<string, unknown>, { labelable: true });\n\n return {\n ...domProps,\n role: p.role,\n };\n };\n\n return {\n get landmarkProps() {\n return getLandmarkProps();\n },\n };\n}\n\n// ============================================\n// LANDMARK CONTROLLER\n// ============================================\n\n/**\n * Returns a controller for programmatic landmark navigation.\n *\n * @example\n * ```tsx\n * const controller = getLandmarkController();\n * controller.focusMain(); // Focus the main landmark\n * controller.focusNext(); // Focus the next landmark\n * ```\n */\nexport function getLandmarkController(): LandmarkController {\n return getLandmarkManager().getController();\n}\n", "/**\n * createVisuallyHidden hook for solidaria\n *\n * Provides styles and props to visually hide content while keeping it\n * accessible to screen readers.\n *\n * Port of react-aria's useVisuallyHidden.\n */\n\nimport { type Accessor, type JSX, createMemo, createSignal } from 'solid-js';\nimport { createFocusWithin } from '../interactions/createFocusWithin';\nimport { access, type MaybeAccessor } from '../utils';\n\n// ============================================\n// TYPES\n// ============================================\n\nexport interface AriaVisuallyHiddenProps {\n /** Inline styles to merge with the visually hidden styles. */\n style?: JSX.CSSProperties;\n /** Whether the element should become visible when focused (e.g., skip links). */\n isFocusable?: boolean;\n}\n\nexport interface VisuallyHiddenAria {\n /** Props to spread on the visually hidden element. */\n visuallyHiddenProps: Accessor<JSX.HTMLAttributes<HTMLElement>>;\n}\n\n// ============================================\n// STYLES\n// ============================================\n\n/**\n * CSS styles that visually hide an element while keeping it accessible.\n * These styles ensure the element is read by screen readers but not visible on screen.\n */\nexport const visuallyHiddenStyles: JSX.CSSProperties = {\n border: '0',\n clip: 'rect(0 0 0 0)',\n 'clip-path': 'inset(50%)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: '0',\n position: 'absolute',\n width: '1px',\n 'white-space': 'nowrap',\n};\n\n// ============================================\n// HOOK\n// ============================================\n\n/**\n * Provides props for an element that hides its children visually\n * but keeps content visible to assistive technology.\n *\n * @example\n * ```tsx\n * function SkipLink() {\n * let ref: HTMLAnchorElement | undefined;\n * const { visuallyHiddenProps } = createVisuallyHidden({ isFocusable: true });\n *\n * return (\n * <a\n * ref={ref}\n * href=\"#main-content\"\n * {...visuallyHiddenProps()}\n * >\n * Skip to main content\n * </a>\n * );\n * }\n *\n * // For content that should always be hidden\n * function ScreenReaderOnly(props: ParentProps) {\n * const { visuallyHiddenProps } = createVisuallyHidden();\n *\n * return (\n * <span {...visuallyHiddenProps()}>\n * {props.children}\n * </span>\n * );\n * }\n * ```\n */\nexport function createVisuallyHidden(\n props: MaybeAccessor<AriaVisuallyHiddenProps> = {}\n): VisuallyHiddenAria {\n const [isFocused, setIsFocused] = createSignal(false);\n\n const isFocusable = () => access(props).isFocusable ?? false;\n const style = () => access(props).style;\n\n // Track focus within for focusable visually hidden elements\n const { focusWithinProps } = createFocusWithin({\n get isDisabled() {\n return !isFocusable();\n },\n onFocusWithinChange: (val: boolean) => setIsFocused(val),\n });\n\n // Compute combined styles\n const combinedStyles = createMemo<JSX.CSSProperties>(() => {\n if (isFocused()) {\n // If focused, show the element (for skip links, etc.)\n return style() ?? {};\n } else if (style()) {\n return { ...visuallyHiddenStyles, ...style() };\n } else {\n return visuallyHiddenStyles;\n }\n });\n\n const visuallyHiddenProps = createMemo<JSX.HTMLAttributes<HTMLElement>>(() => ({\n ...focusWithinProps,\n style: combinedStyles(),\n }));\n\n return {\n visuallyHiddenProps,\n };\n}\n", "/**\n * createFormReset - Handles form reset events for form fields.\n *\n * Resets the field value to its default when the containing form is reset.\n * Port of @react-aria/utils useFormReset.\n */\n\nimport { type Accessor, createEffect, onCleanup } from 'solid-js';\n\nexport interface FormResetOptions<T> {\n /** The default value to reset to. */\n defaultValue: T;\n /** Function to set the current value. */\n onReset: (value: T) => void;\n}\n\n/**\n * Listens for form reset events and resets the field value to its default.\n *\n * @example\n * ```tsx\n * createFormReset(\n * () => inputRef,\n * { label: 'Default' },\n * (value) => state.setSelectedKey(value.key)\n * );\n * ```\n */\nexport function createFormReset<T>(\n ref: Accessor<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | undefined>,\n defaultValue: T,\n onReset: (value: T) => void\n): void {\n createEffect(() => {\n const element = ref();\n if (!element) return;\n\n const form = element.form;\n if (!form) return;\n\n const handleReset = () => {\n onReset(defaultValue);\n };\n\n form.addEventListener('reset', handleReset);\n\n onCleanup(() => {\n form.removeEventListener('reset', handleReset);\n });\n });\n}\n"],
5
+ "mappings": ";AAOA,SAAS,gBAAAA,eAA6B,aAAAC,kBAAiB;;;AC0ChD,IAAM,aAAN,MAAwC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA,yBAAyB;AAAA,EAEzB,YACE,MACA,aACA,eACA,QACA;AACA,SAAK,OAAO;AACZ,SAAK,cAAc;AACnB,UAAM,cAAc,UAAY,eAAuB;AACvD,SAAK,SAAS;AAGd,UAAM,IAAI;AACV,SAAK,WAAW,GAAG,YAAY;AAC/B,SAAK,UAAU,GAAG,WAAW;AAC7B,SAAK,UAAU,GAAG,WAAW;AAC7B,SAAK,SAAS,GAAG,UAAU;AAG3B,SAAK,IAAI;AACT,SAAK,IAAI;AAET,QAAI,iBAAiB,aAAa,iB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,eAAa,KAAK;AAEpD,QAAMC,eAAc,MAAM,OAAO,KAAK,EAAE,eAAe;AACvD,QAAM,QAAQ,MAAM,OAAO,KAAK,EAAE;AAGlC,QAAM,EAAE,iBAAiB,IAAI,kBAAkB;AAAA,IAC7C,IAAI,aAAa;AACf,aAAO,CAACA,aAAY;AAAA,IACtB;AAAA,IACA,qBAAqB,CAAC,QAAiB,aAAa,GAAG;AAAA,EACzD,CAAC;AAGD,QAAM,iBAAiBC,aAA8B,MAAM;AACzD,QAAI,UAAU,GAAG;AAEf,aAAO,MAAM,KAAK,CAAC;AAAA,IACrB,WAAW,MAAM,GAAG;AAClB,aAAO,EAAE,GAAG,sBAAsB,GAAG,MAAM,EAAE;AAAA,IAC/C,OAAO;AACL,aAAO;AAAA,IACT;AAAA,EACF,CAAC;AAED,QAAM,sBAAsBA,aAA4C,OAAO;AAAA,IAC7E,GAAG;AAAA,IACH,OAAO,eAAe;AAAA,EACxB,EAAE;AAEF,SAAO;AAAA,IACL;AAAA,EACF;AACF;;;ACpHA,SAAwB,gBAAAC,gBAAc,aAAAC,mBAAiB;AAqBhD,SAAS,gBACd,KACA,cACA,SACM;AACN,EAAAD,eAAa,MAAM;AACjB,UAAM,UAAU,IAAI;AACpB,QAAI,CAAC,QAAS;AAEd,UAAM,OAAO,QAAQ;AACrB,QAAI,CAAC,KAAM;AAEX,UAAM,cAAc,MAAM;AACxB,cAAQ,YAAY;AAAA,IACtB;AAEA,SAAK,iBAAiB,SAAS,WAAW;AAE1C,IAAAC,YAAU,MAAM;AACd,WAAK,oBAAoB,SAAS,WAAW;AAAA,IAC/C,CAAC;AAAA,EACH,CAAC;AACH;",
6
+ "names": ["createSignal", "onCleanup", "document", "listeners", "onCleanup", "createSignal", "onCleanup", "onCleanup", "isDisabledValue", "onCleanup", "createSignal", "createEffect", "onCleanup", "state", "createSignal", "createEffect", "onCleanup", "onCleanup", "onCleanup", "onCleanup", "getActiveElement", "createSyntheticBlurHandler", "onCleanup", "window", "isDisabledValue", "createSignal", "createEffect", "onCleanup", "createSignal", "createEffect", "onCleanup", "isServer", "isServer", "createSignal", "createEffect", "onCleanup", "createSignal", "isFocusVisible", "createEffect", "onCleanup", "createSignal", "createEffect", "onCleanup", "createMemo", "createSignal", "state", "createEffect", "onCleanup", "createMemo", "isDisabledValue", "createSignal", "createSignal", "createEffect", "createEffect", "state", "createEffect", "state", "createEffect", "createContext", "createEffect", "createMemo", "createSignal", "onCleanup", "onMount", "useContext", "isServer", "getOwnerDocument", "getOwnerWindow", "descriptionId", "state", "state", "radioGroupSyncVersion", "state", "createEffect", "state", "createEffect", "state", "createSignal", "onMount", "onCleanup", "createContext", "createEffect", "createMemo", "createSignal", "onCleanup", "useContext", "createContext", "createSignal", "createEffect", "onCleanup", "useContext", "createMemo", "createMemo", "createMemo", "createMemo", "createMemo", "createMemo", "createMemo", "createMemo", "createMemo", "createMemo", "createMemo", "getActiveElement", "createSignal", "onMount", "isRTL", "onCleanup", "createSignal", "createEffect", "onCleanup", "state", "createSignal", "createEffect", "onCleanup", "createEffect", "onCleanup", "createEffect", "onCleanup", "createEffect", "state", "createEffect", "createEffect", "onCleanup", "createEffect", "onCleanup", "createEffect", "onCleanup", "createEffect", "onCleanup", "createContext", "createSignal", "useContext", "createEffect", "onCleanup", "isServer", "createEffect", "onCleanup", "state", "state", "createEffect", "onCleanup", "state", "isFocusVisible", "descriptionId", "createEffect", "onCleanup", "getNextKey", "getFirstKey", "state", "createEffect", "onCleanup", "state", "isFocusVisible", "descriptionId", "state", "createEffect", "onCleanup", "state", "descriptionId", "createEffect", "onCleanup", "isFocusVisible", "createEffect", "onCleanup", "createEffect", "onCleanup", "state", "createEffect", "onCleanup", "createEffect", "onCleanup", "state", "createMemo", "onMount", "state", "createMemo", "isFocusVisible", "onMount", "createMemo", "state", "descriptionId", "createMemo", "state", "onCleanup", "onMount", "state", "isFocusVisible", "onMount", "onCleanup", "state", "createEffect", "onCleanup", "currentModality", "isFocusVisible", "state", "createEffect", "onCleanup", "createEffect", "onCleanup", "isServer", "createEffect", "isServer", "isTestEnv", "state", "descriptionId", "createEffect", "onCleanup", "isFocusVisible", "isServer", "createEffect", "createMemo", "createSignal", "createUniqueId", "onCleanup", "createUniqueId", "createSignal", "createMemo", "createEffect", "onCleanup", "createMemo", "descriptionId", "createMemo", "createMemo", "createMemo", "createEffect", "onCleanup", "createEffect", "createSignal", "onCleanup", "clamp", "isWebKit", "visualViewport", "visualViewport", "createSignal", "createEffect", "onCleanup", "state", "createEffect", "onCleanup", "createContext", "useContext", "createEffect", "onCleanup", "createSignal", "onMount", "isServer", "createContext", "useContext", "isTabbable", "getFocusableElements", "getActiveElement", "isServer", "createSignal", "onMount", "createEffect", "scope", "onCleanup", "onCleanup", "onMount", "isServer", "getActiveElement", "isServer", "onMount", "onCleanup", "restore", "createSignal", "isServer", "DEFAULT_PAGE_SIZE", "onCleanup", "onMount", "isServer", "isServer", "onMount", "onCleanup", "createEffect", "state", "createEffect", "createMemo", "state", "createEffect", "onCleanup", "state", "descriptionId", "createEffect", "onCleanup", "createMemo", "state", "createMemo", "createMemo", "state", "createMemo", "createMemo", "onMount", "onCleanup", "state", "createSignal", "createMemo", "onMount", "date", "res", "ms", "state", "createSignal", "createMemo", "onMount", "createMemo", "state", "createMemo", "createSignal", "createMemo", "state", "createSignal", "createMemo", "createMemo", "state", "descriptionId", "createMemo", "createSignal", "createMemo", "state", "createSignal", "createMemo", "createMemo", "state", "descriptionId", "createMemo", "createMemo", "state", "descriptionId", "createMemo", "createMemo", "createSignal", "createId", "state", "createId", "createSignal", "createMemo", "createMemo", "createSignal", "state", "createSignal", "createMemo", "createMemo", "createSignal", "state", "createSignal", "createMemo", "createMemo", "createEffect", "createId", "state", "createId", "createMemo", "createEffect", "isRTL", "createMemo", "createMemo", "createSignal", "state", "createSignal", "createMemo", "createMemo", "createSignal", "state", "createSignal", "createMemo", "createMemo", "createSignal", "state", "createSignal", "createMemo", "createMemo", "createMemo", "createId", "state", "createMemo", "state", "createMemo", "createId", "state", "createMemo", "createSignal", "state", "createSignal", "createMemo", "createMemo", "createId", "state", "createMemo", "createId", "state", "createMemo", "createSignal", "state", "createSignal", "createMemo", "createMemo", "state", "createMemo", "state", "createMemo", "createMemo", "state", "createMemo", "createMemo", "state", "createMemo", "createMemo", "state", "createMemo", "createMemo", "createMemo", "DROP_OPERATION", "createMemo", "state", "createMemo", "createMemo", "state", "isMac", "createMemo", "createEffect", "onCleanup", "state", "createMemo", "onCleanup", "state", "createMemo", "target", "onCleanup", "createMemo", "state", "createMemo", "createMemo", "state", "createMemo", "DROP_ACTIVATE_TIMEOUT", "createEffect", "onCleanup", "createEffect", "onCleanup", "createMemo", "createSignal", "createSignal", "isFocusable", "createMemo", "createEffect", "onCleanup"]
7
+ }